|
|
!(function(){var el=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[9716],{65030:function(yt,ge,b){"use strict";b.d(ge,{Z:function(){return bt}});var I=b(27247),P=b(11913),K=b(43079),D=b(43403),w=b(92310),_=b.n(w),F=b(29301),v=b(76846),s=b(96452),y=b(6089),f=b(80402),c=b(34280),l=b(49658),h=b(59301),d=b(32855),E=b(77900),T=b(8654);function L(be){var ye=be.prefixCls,le=be.align,ke=be.arrow,Fe=be.arrowPos,Ke=ke||{},re=Ke.className,fe=Ke.content,De=Fe.x,Re=De===void 0?0:De,Oe=Fe.y,Ye=Oe===void 0?0:Oe,at=h.useRef();if(!le||!le.points)return null;var Qe={position:"absolute"};if(le.autoArrow!==!1){var Xe=le.points[0],Ge=le.points[1],ct=Xe[0],ot=Xe[1],it=Ge[0],we=Ge[1];ct===it||!["t","b"].includes(ct)?Qe.top=Ye:ct==="t"?Qe.top=0:Qe.bottom=0,ot===we||!["l","r"].includes(ot)?Qe.left=Re:ot==="l"?Qe.left=0:Qe.right=0}return h.createElement("div",{ref:at,className:_()("".concat(ye,"-arrow"),re),style:Qe},fe)}function x(be){var ye=be.prefixCls,le=be.open,ke=be.zIndex,Fe=be.mask,Ke=be.motion;return Fe?h.createElement(E.default,(0,d.Z)({},Ke,{motionAppear:!0,visible:le,removeOnLeave:!0}),function(re){var fe=re.className;return h.createElement("div",{style:{zIndex:ke},className:_()("".concat(ye,"-mask"),fe)})}):null}var A=h.memo(function(be){var ye=be.children;return ye},function(be,ye){return ye.cache}),O=A,U=h.forwardRef(function(be,ye){var le=be.popup,ke=be.className,Fe=be.prefixCls,Ke=be.style,re=be.target,fe=be.onVisibleChanged,De=be.open,Re=be.keepDom,Oe=be.fresh,Ye=be.onClick,at=be.mask,Qe=be.arrow,Xe=be.arrowPos,Ge=be.align,ct=be.motion,ot=be.maskMotion,it=be.forceRender,we=be.getPopupContainer,rt=be.autoDestroy,Ze=be.portal,je=be.zIndex,mt=be.onMouseEnter,Et=be.onMouseLeave,st=be.onPointerEnter,Rt=be.onPointerDownCapture,Nt=be.ready,nt=be.offsetX,Dt=be.offsetY,Se=be.offsetR,_e=be.offsetB,ve=be.onAlign,ee=be.onPrepare,ie=be.stretch,oe=be.targetWidth,he=be.targetHeight,de=typeof le=="function"?le():le,Je=De||Re,et=(we==null?void 0:we.length)>0,ht=h.useState(!we||!et),gt=(0,P.Z)(ht,2),Ot=gt[0],qt=gt[1];if((0,c.Z)(function(){!Ot&&et&&re&&qt(!0)},[Ot,et,re]),!Ot)return null;var Ut="auto",Lt={left:"-1000vw",top:"-1000vh",right:Ut,bottom:Ut};if(Nt||!De){var oi,fi=Ge.points,Qt=Ge.dynamicInset||((oi=Ge._experimental)===null||oi===void 0?void 0:oi.dynamicInset),si=Qt&&fi[0][1]==="r",tt=Qt&&fi[0][0]==="b";si?(Lt.right=Se,Lt.left=Ut):(Lt.left=nt,Lt.right=Ut),tt?(Lt.bottom=_e,Lt.top=Ut):(Lt.top=Dt,Lt.bottom=Ut)}var Ve={};return ie&&(ie.includes("height")&&he?Ve.height=he:ie.includes("minHeight")&&he&&(Ve.minHeight=he),ie.includes("width")&&oe?Ve.width=oe:ie.includes("minWidth")&&oe&&(Ve.minWidth=oe)),De||(Ve.pointerEvents="none"),h.createElement(Ze,{open:it||Je,getContainer:we&&function(){return we(re)},autoDestroy:rt},h.createElement(x,{prefixCls:Fe,open:De,zIndex:je,mask:at,motion:ot}),h.createElement(F.Z,{onResize:ve,disabled:!De},function(pt){return h.createElement(E.default,(0,d.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:it,leavedClassName:"".concat(Fe,"-hidden")},ct,{onAppearPrepare:ee,onEnterPrepare:ee,visible:De,onVisibleChanged:function(Wt){var Xt;ct==null||(Xt=ct.onVisibleChanged)===null||Xt===void 0||Xt.call(ct,Wt),fe(Wt)}}),function(Bt,Wt){var Xt=Bt.className,bi=Bt.style,vi=_()(Fe,Xt,ke);return h.createElement("div",{ref:(0,T.sQ)(pt,ye,Wt),className:vi,style:(0,I.Z)((0,I.Z)((0,I.Z)((0,I.Z)({"--arrow-x":"".concat(Xe.x||0,"px"),"--arrow-y":"".concat(Xe.y||0,"px")},Lt),Ve),bi),{},{boxSizing:"border-box",zIndex:je},Ke),onMouseEnter:mt,onMouseLeave:Et,onPointerEnter:st,onClick:Ye,onPointerDownCapture:Rt},Qe&&h.createElement(L,{prefixCls:Fe,arrow:Qe,arrowPos:Xe,align:Ge}),h.createElement(O,{cache:!De&&!Oe},de))})}))}),N=U,$=h.forwardRef(function(be,ye){var le=be.children,ke=be.getTriggerDOMNode,Fe=(0,T.Yr)(le),Ke=h.useCallback(function(fe){(0,T.mH)(ye,ke?ke(fe):fe)},[ke]),re=(0,T.x1)(Ke,(0,T.C4)(le));return Fe?h.cloneElement(le,{ref:re}):le}),M=$,Z=h.createContext(null),q=Z;function se(be){return be?Array.isArray(be)?be:[be]:[]}function ue(be,ye,le,ke){return h.useMemo(function(){var Fe=se(le!=null?le:ye),Ke=se(ke!=null?ke:ye),re=new Set(Fe),fe=new Set(Ke);return be&&(re.has("hover")&&(re.delete("hover"),re.add("click")),fe.has("hover")&&(fe.delete("hover"),fe.add("click"))),[re,fe]},[be,ye,le,ke])}var J=b(29194);function z(){var be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],le=arguments.length>2?arguments[2]:void 0;return le?be[0]===ye[0]:be[0]===ye[0]&&be[1]===ye[1]}function X(be,ye,le,ke){for(var Fe=le.points,Ke=Object.keys(be),re=0;re<Ke.length;re+=1){var fe,De=Ke[re];if(z((fe=be[De])===null||fe===void 0?void 0:fe.points,Fe,ke))return"".concat(ye,"-placement-").concat(De)}return""}function B(be,ye,le,ke){return ye||(le?{motionName:"".concat(be,"-").concat(le)}:ke?{motionName:ke}:null)}function G(be){return be.ownerDocument.defaultView}function W(be){for(var ye=[],le=be==null?void 0:be.parentElement,ke=["hidden","scroll","clip","auto"];le;){var Fe=G(le).getComputedStyle(le),Ke=Fe.overflowX,re=Fe.overflowY,fe=Fe.overflow;[Ke,re,fe].some(function(De){return ke.includes(De)})&&ye.push(le),le=le.parentElement}return ye}function k(be){var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(be)?ye:be}function C(be){return k(parseFloat(be),0)}function V(be,ye){var le=(0,I.Z)({},be);return(ye||[]).forEach(function(ke){if(!(ke instanceof HTMLBodyElement||ke instanceof HTMLHtmlElement)){var Fe=G(ke).getComputedStyle(ke),Ke=Fe.overflow,re=Fe.overflowClipMargin,fe=Fe.borderTopWidth,De=Fe.borderBottomWidth,Re=Fe.borderLeftWidth,Oe=Fe.borderRightWidth,Ye=ke.getBoundingClientRect(),at=ke.offsetHeight,Qe=ke.clientHeight,Xe=ke.offsetWidth,Ge=ke.clientWidth,ct=C(fe),ot=C(De),it=C(Re),we=C(Oe),rt=k(Math.round(Ye.width/Xe*1e3)/1e3),Ze=k(Math.round(Ye.height/at*1e3)/1e3),je=(Xe-Ge-it-we)*rt,mt=(at-Qe-ct-ot)*Ze,Et=ct*Ze,st=ot*Ze,Rt=it*rt,Nt=we*rt,nt=0,Dt=0;if(Ke==="clip"){var Se=C(re);nt=Se*rt,Dt=Se*Ze}var _e=Ye.x+Rt-nt,ve=Ye.y+Et-Dt,ee=_e+Ye.width+2*nt-Rt-Nt-je,ie=ve+Ye.height+2*Dt-Et-st-mt;le.left=Math.max(le.left,_e),le.top=Math.max(le.top,ve),le.right=Math.min(le.right,ee),le.bottom=Math.min(le.bottom,ie)}}),le}function ne(be){var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,le="".concat(ye),ke=le.match(/^(.*)\%$/);return ke?be*(parseFloat(ke[1])/100):parseFloat(le)}function pe(be,ye){var le=ye||[],ke=(0,P.Z)(le,2),Fe=ke[0],Ke=ke[1];return[ne(be.width,Fe),ne(be.height,Ke)]}function Ce(){var be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[be[0],be[1]]}function We(be,ye){var le=ye[0],ke=ye[1],Fe,Ke;return le==="t"?Ke=be.y:le==="b"?Ke=be.y+be.height:Ke=be.y+be.height/2,ke==="l"?Fe=be.x:ke==="r"?Fe=be.x+be.width:Fe=be.x+be.width/2,{x:Fe,y:Ke}}function me(be,ye){var le={t:"b",b:"t",l:"r",r:"l"};return be.map(function(ke,Fe){return Fe===ye?le[ke]||"c":ke}).join("")}function Ne(be,ye,le,ke,Fe,Ke,re){var fe=h.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Fe[ke]||{}}),De=(0,P.Z)(fe,2),Re=De[0],Oe=De[1],Ye=h.useRef(0),at=h.useMemo(function(){return ye?W(ye):[]},[ye]),Qe=h.useRef({}),Xe=function(){Qe.current={}};be||Xe();var Ge=(0,y.Z)(function(){if(ye&&le&&be){let Ri=function(Dr,rr){var dr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Si,Xr=Je.x+Dr,Lr=Je.y+rr,ai=Xr+tt,xi=Lr+si,Hr=Math.max(Xr,dr.left),St=Math.max(Lr,dr.top),Pt=Math.min(ai,dr.right),ni=Math.min(xi,dr.bottom);return Math.max(0,(Pt-Hr)*(ni-St))},fr=function(){ei=Je.y+li,ur=ei+si,Yi=Je.x+Jt,Li=Yi+tt};var it,we,rt,Ze,je=ye,mt=je.ownerDocument,Et=G(je),st=Et.getComputedStyle(je),Rt=st.position,Nt=je.style.left,nt=je.style.top,Dt=je.style.right,Se=je.style.bottom,_e=je.style.overflow,ve=(0,I.Z)((0,I.Z)({},Fe[ke]),Ke),ee=mt.createElement("div");(it=je.parentElement)===null||it===void 0||it.appendChild(ee),ee.style.left="".concat(je.offsetLeft,"px"),ee.style.top="".concat(je.offsetTop,"px"),ee.style.position=Rt,ee.style.height="".concat(je.offsetHeight,"px"),ee.style.width="".concat(je.offsetWidth,"px"),je.style.left="0",je.style.top="0",je.style.right="auto",je.style.bottom="auto",je.style.overflow="hidden";var ie;if(Array.isArray(le))ie={x:le[0],y:le[1],width:0,height:0};else{var oe,he,de=le.getBoundingClientRect();de.x=(oe=de.x)!==null&&oe!==void 0?oe:de.left,de.y=(he=de.y)!==null&&he!==void 0?he:de.top,ie={x:de.x,y:de.y,width:de.width,height:de.height}}var Je=je.getBoundingClientRect(),et=Et.getComputedStyle(je),ht=et.height,gt=et.width;Je.x=(we=Je.x)!==null&&we!==void 0?we:Je.left,Je.y=(rt=Je.y)!==null&&rt!==void 0?rt:Je.top;var Ot=mt.documentElement,qt=Ot.clientWidth,Ut=Ot.clientHeight,Lt=Ot.scrollWidth,oi=Ot.scrollHeight,fi=Ot.scrollTop,Qt=Ot.scrollLeft,si=Je.height,tt=Je.width,Ve=ie.height,pt=ie.width,Bt={left:0,top:0,right:qt,bottom:Ut},Wt={left:-Qt,top:-fi,right:Lt-Qt,bottom:oi-fi},Xt=ve.htmlRegion,bi="visible",vi="visibleFirst";Xt!=="scroll"&&Xt!==vi&&(Xt=bi);var ii=Xt===vi,Ei=V(Wt,at),jt=V(Bt,at),Si=Xt===bi?jt:Ei,ri=ii?jt:Si;je.style.left="auto",je.style.top="auto",je.style.right="0",je.style.bottom="0";var br=je.getBoundingClientRect();je.style.left=Nt,je.style.top=nt,je.style.right=Dt,je.style.bottom=Se,je.style.overflow=_e,(Ze=je.parentElement)===null||Ze===void 0||Ze.removeChild(ee);var Gt=k(Math.round(tt/parseFloat(gt)*1e3)/1e3),Kt=k(Math.round(si/parseFloat(ht)*1e3)/1e3);if(Gt===0||Kt===0||(0,v.Sh)(le)&&!(0,J.Z)(le))return;var Ft=ve.offset,gi=ve.targetOffset,zt=pe(Je,Ft),yi=(0,P.Z)(zt,2),Bi=yi[0],Ni=yi[1],Ci=pe(ie,gi),pi=(0,P.Z)(Ci,2),lr=pi[0],wn=pi[1];ie.x-=lr,ie.y-=wn;var Ji=ve.points||[],sn=(0,P.Z)(Ji,2),an=sn[0],Er=sn[1],er=Ce(Er),Ti=Ce(an),wi=We(ie,er),zi=We(Je,Ti),Ui=(0,I.Z)({},ve),Jt=wi.x-zi.x+Bi,li=wi.y-zi.y+Ni,$i=Ri(Jt,li),Vi=Ri(Jt,li,jt),Pi=We(ie,["t","l"]),Or=We(Je,["t","l"]),Fr=We(ie,["b","r"]),qi=We(Je,["b","r"]),Sr=ve.overflow||{},zr=Sr.adjustX,ci=Sr.adjustY,mi=Sr.shiftX,Vr=Sr.shiftY,tr=function(rr){return typeof rr=="boolean"?rr:rr>=0},ei,ur,Yi,Li;fr();var qr=tr(ci),hi=Ti[0]===er[0];if(qr&&Ti[0]==="t"&&(ur>ri.bottom||Qe.current.bt)){var wr=li;hi?wr-=si-Ve:wr=Pi.y-qi.y-Ni;var on=Ri(Jt,wr),xn=Ri(Jt,wr,jt);on>$i||on===$i&&(!ii||xn>=Vi)?(Qe.current.bt=!0,li=wr,Ni=-Ni,Ui.points=[me(Ti,0),me(er,0)]):Qe.current.bt=!1}if(qr&&Ti[0]==="b"&&(ei<ri.top||Qe.current.tb)){var xr=li;hi?xr+=si-Ve:xr=Fr.y-Or.y-Ni;var ln=Ri(Jt,xr),An=Ri(Jt,xr,jt);ln>$i||ln===$i&&(!ii||An>=Vi)?(Qe.current.tb=!0,li=xr,Ni=-Ni,Ui.points=[me(Ti,0),me(er,0)]):Qe.current.tb=!1}var Mr=tr(zr),Yr=Ti[1]===er[1];if(Mr&&Ti[1]==="l"&&(Li>ri.right||Qe.current.rl)){var Ar=Jt;Yr?Ar-=tt-pt:Ar=Pi.x-qi.x-Bi;var cr=Ri(Ar,li),Br=Ri(Ar,li,jt);cr>$i||cr===$i&&(!ii||Br>=Vi)?(Qe.current.rl=!0,Jt=Ar,Bi=-Bi,Ui.points=[me(Ti,1),me(er,1)]):Qe.current.rl=!1}if(Mr&&Ti[1]==="r"&&(Yi<ri.left||Qe.current.lr)){var Cr=Jt;Yr?Cr+=tt-pt:Cr=Fr.x-Or.x-Bi;var Oi=Ri(Cr,li),Tr=Ri(Cr,li,jt);Oi>$i||Oi===$i&&(!ii||Tr>=Vi)?(Qe.current.lr=!0,Jt=Cr,Bi=-Bi,Ui.points=[me(Ti,1),me(er,1)]):Qe.current.lr=!1}fr();var Fi=mi===!0?0:mi;typeof Fi=="number"&&(Yi<jt.left&&(Jt-=Yi-jt.left-Bi,ie.x+pt<jt.left+Fi&&(Jt+=ie.x-jt.left+pt-Fi)),Li>jt.right&&(Jt-=Li-jt.right-Bi,ie.x>jt.right-Fi&&(Jt+=ie.x-jt.right+Fi)));var Wi=Vr===!0?0:Vr;typeof Wi=="number"&&(ei<jt.top&&(li-=ei-jt.top-Ni,ie.y+Ve<jt.top+Wi&&(li+=ie.y-jt.top+Ve-Wi)),ur>jt.bottom&&(li-=ur-jt.bottom-Ni,ie.y>jt.bottom-Wi&&(li+=ie.y-jt.bottom+Wi)));var ir=Je.x+Jt,It=ir+tt,Nr=Je.y+li,un=Nr+si,Ur=ie.x,Zr=Ur+pt,cn=ie.y,Cn=cn+Ve,hn=Math.max(ir,Ur),ti=Math.min(It,Zr),Tn=(hn+ti)/2,Dn=Tn-ir,fn=Math.max(Nr,cn),dn=Math.min(un,Cn),Ln=(fn+dn)/2,Rn=Ln-Nr;re==null||re(ye,Ui);var Gi=br.right-Je.x-(Jt+Je.width),$r=br.bottom-Je.y-(li+Je.height);Gt===1&&(Jt=Math.round(Jt),Gi=Math.round(Gi)),Kt===1&&(li=Math.round(li),$r=Math.round($r));var hr={ready:!0,offsetX:Jt/Gt,offsetY:li/Kt,offsetR:Gi/Gt,offsetB:$r/Kt,arrowX:Dn/Gt,arrowY:Rn/Kt,scaleX:Gt,scaleY:Kt,align:Ui};Oe(hr)}}),ct=function(){Ye.current+=1;var we=Ye.current;Promise.resolve().then(function(){Ye.current===we&&Ge()})},ot=function(){Oe(function(we){return(0,I.Z)((0,I.Z)({},we),{},{ready:!1})})};return(0,c.Z)(ot,[ke]),(0,c.Z)(function(){be||ot()},[be]),[Re.ready,Re.offsetX,Re.offsetY,Re.offsetR,Re.offsetB,Re.arrowX,Re.arrowY,Re.scaleX,Re.scaleY,Re.align,ct]}var Be=b(3300);function Me(be,ye,le,ke,Fe){(0,c.Z)(function(){if(be&&ye&&le){let Ye=function(){ke(),Fe()};var Ke=ye,re=le,fe=W(Ke),De=W(re),Re=G(re),Oe=new Set([Re].concat((0,Be.Z)(fe),(0,Be.Z)(De)));return Oe.forEach(function(at){at.addEventListener("scroll",Ye,{passive:!0})}),Re.addEventListener("resize",Ye,{passive:!0}),ke(),function(){Oe.forEach(function(at){at.removeEventListener("scroll",Ye),Re.removeEventListener("resize",Ye)})}}},[be,ye,le])}var wt=b(48736);function He(be,ye,le,ke,Fe,Ke,re,fe){var De=h.useRef(be);De.current=be;var Re=h.useRef(!1);h.useEffect(function(){if(ye&&ke&&(!Fe||Ke)){var Ye=function(){Re.current=!1},at=function(rt){var Ze;De.current&&!re(((Ze=rt.composedPath)===null||Ze===void 0||(Ze=Ze.call(rt))===null||Ze===void 0?void 0:Ze[0])||rt.target)&&!Re.current&&fe(!1)},Qe=G(ke);Qe.addEventListener("pointerdown",Ye,!0),Qe.addEventListener("mousedown",at,!0),Qe.addEventListener("contextmenu",at,!0);var Xe=(0,s.A)(le);if(Xe&&(Xe.addEventListener("mousedown",at,!0),Xe.addEventListener("contextmenu",at,!0)),0)var Ge,ct,ot,it;return function(){Qe.removeEventListener("pointerdown",Ye,!0),Qe.removeEventListener("mousedown",at,!0),Qe.removeEventListener("contextmenu",at,!0),Xe&&(Xe.removeEventListener("mousedown",at,!0),Xe.removeEventListener("contextmenu",at,!0))}}},[ye,le,ke,Fe,Ke]);function Oe(){Re.current=!0}return Oe}var lt=["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 Ue(){var be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D.Z,ye=h.forwardRef(function(le,ke){var Fe=le.prefixCls,Ke=Fe===void 0?"rc-trigger-popup":Fe,re=le.children,fe=le.action,De=fe===void 0?"hover":fe,Re=le.showAction,Oe=le.hideAction,Ye=le.popupVisible,at=le.defaultPopupVisible,Qe=le.onPopupVisibleChange,Xe=le.afterPopupVisibleChange,Ge=le.mouseEnterDelay,ct=le.mouseLeaveDelay,ot=ct===void 0?.1:ct,it=le.focusDelay,we=le.blurDelay,rt=le.mask,Ze=le.maskClosable,je=Ze===void 0?!0:Ze,mt=le.getPopupContainer,Et=le.forceRender,st=le.autoDestroy,Rt=le.destroyPopupOnHide,Nt=le.popup,nt=le.popupClassName,Dt=le.popupStyle,Se=le.popupPlacement,_e=le.builtinPlacements,ve=_e===void 0?{}:_e,ee=le.popupAlign,ie=le.zIndex,oe=le.stretch,he=le.getPopupClassNameFromAlign,de=le.fresh,Je=le.alignPoint,et=le.onPopupClick,ht=le.onPopupAlign,gt=le.arrow,Ot=le.popupMotion,qt=le.maskMotion,Ut=le.popupTransitionName,Lt=le.popupAnimation,oi=le.maskTransitionName,fi=le.maskAnimation,Qt=le.className,si=le.getTriggerDOMNode,tt=(0,K.Z)(le,lt),Ve=st||Rt||!1,pt=h.useState(!1),Bt=(0,P.Z)(pt,2),Wt=Bt[0],Xt=Bt[1];(0,c.Z)(function(){Xt((0,l.Z)())},[]);var bi=h.useRef({}),vi=h.useContext(q),ii=h.useMemo(function(){return{registerSubPopup:function(Pt,ni){bi.current[Pt]=ni,vi==null||vi.registerSubPopup(Pt,ni)}}},[vi]),Ei=(0,f.Z)(),jt=h.useState(null),Si=(0,P.Z)(jt,2),ri=Si[0],br=Si[1],Gt=h.useRef(null),Kt=(0,y.Z)(function(St){Gt.current=St,(0,v.Sh)(St)&&ri!==St&&br(St),vi==null||vi.registerSubPopup(Ei,St)}),Ft=h.useState(null),gi=(0,P.Z)(Ft,2),zt=gi[0],yi=gi[1],Bi=h.useRef(null),Ni=(0,y.Z)(function(St){(0,v.Sh)(St)&&zt!==St&&(yi(St),Bi.current=St)}),Ci=h.Children.only(re),pi=(Ci==null?void 0:Ci.props)||{},lr={},wn=(0,y.Z)(function(St){var Pt,ni,_i=zt;return(_i==null?void 0:_i.contains(St))||((Pt=(0,s.A)(_i))===null||Pt===void 0?void 0:Pt.host)===St||St===_i||(ri==null?void 0:ri.contains(St))||((ni=(0,s.A)(ri))===null||ni===void 0?void 0:ni.host)===St||St===ri||Object.values(bi.current).some(function(ui){return(ui==null?void 0:ui.contains(St))||St===ui})}),Ji=B(Ke,Ot,Lt,Ut),sn=B(Ke,qt,fi,oi),an=h.useState(at||!1),Er=(0,P.Z)(an,2),er=Er[0],Ti=Er[1],wi=Ye!=null?Ye:er,zi=(0,y.Z)(function(St){Ye===void 0&&Ti(St)});(0,c.Z)(function(){Ti(Ye||!1)},[Ye]);var Ui=h.useRef(wi);Ui.current=wi;var Jt=h.useRef([]);Jt.current=[];var li=(0,y.Z)(function(St){var Pt;zi(St),((Pt=Jt.current[Jt.current.length-1])!==null&&Pt!==void 0?Pt:wi)!==St&&(Jt.current.push(St),Qe==null||Qe(St))}),$i=h.useRef(),Vi=function(){clearTimeout($i.current)},Pi=function(Pt){var ni=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Vi(),ni===0?li(Pt):$i.current=setTimeout(function(){li(Pt)},ni*1e3)};h.useEffect(function(){return Vi},[]);var Or=h.useState(!1),Fr=(0,P.Z)(Or,2),qi=Fr[0],Sr=Fr[1];(0,c.Z)(function(St){(!St||wi)&&Sr(!0)},[wi]);var zr=h.useState(null),ci=(0,P.Z)(zr,2),mi=ci[0],Vr=ci[1],tr=h.useState(null),ei=(0,P.Z)(tr,2),ur=ei[0],Yi=ei[1],Li=function(Pt){Yi([Pt.clientX,Pt.clientY])},qr=Ne(wi,ri,Je&&ur!==null?ur:zt,Se,ve,ee,ht),hi=(0,P.Z)(qr,11),wr=hi[0],on=hi[1],xn=hi[2],xr=hi[3],ln=hi[4],An=hi[5],Mr=hi[6],Yr=hi[7],Ar=hi[8],cr=hi[9],Br=hi[10],Cr=ue(Wt,De,Re,Oe),Oi=(0,P.Z)(Cr,2),Tr=Oi[0],Fi=Oi[1],Wi=Tr.has("click"),ir=Fi.has("click")||Fi.has("contextMenu"),It=(0,y.Z)(function(){qi||Br()}),Nr=function(){Ui.current&&Je&&ir&&Pi(!1)};Me(wi,zt,ri,It,Nr),(0,c.Z)(function(){It()},[ur,Se]),(0,c.Z)(function(){wi&&!(ve!=null&&ve[Se])&&It()},[JSON.stringify(ee)]);var un=h.useMemo(function(){var St=X(ve,Ke,cr,Je);return _()(St,he==null?void 0:he(cr))},[cr,he,ve,Ke,Je]);h.useImperativeHandle(ke,function(){return{nativeElement:Bi.current,popupElement:Gt.current,forceAlign:It}});var Ur=h.useState(0),Zr=(0,P.Z)(Ur,2),cn=Zr[0],Cn=Zr[1],hn=h.useState(0),ti=(0,P.Z)(hn,2),Tn=ti[0],Dn=ti[1],fn=function(){if(oe&&zt){var Pt=zt.getBoundingClientRect();Cn(Pt.width),Dn(Pt.height)}},dn=function(){fn(),It()},Ln=function(Pt){Sr(!1),Br(),Xe==null||Xe(Pt)},Rn=function(){return new Promise(function(Pt){fn(),Vr(function(){return Pt})})};(0,c.Z)(function(){mi&&(Br(),mi(),Vr(null))},[mi]);function Gi(St,Pt,ni,_i){lr[St]=function(ui){var pn;_i==null||_i(ui),Pi(Pt,ni);for(var kn=arguments.length,Qr=new Array(kn>1?kn-1:0),Rr=1;Rr<kn;Rr++)Qr[Rr-1]=arguments[Rr];(pn=pi[St])===null||pn===void 0||pn.call.apply(pn,[pi,ui].concat(Qr))}}(Wi||ir)&&(lr.onClick=function(St){var Pt;Ui.current&&ir?Pi(!1):!Ui.current&&Wi&&(Li(St),Pi(!0));for(var ni=arguments.length,_i=new Array(ni>1?ni-1:0),ui=1;ui<ni;ui++)_i[ui-1]=arguments[ui];(Pt=pi.onClick)===null||Pt===void 0||Pt.call.apply(Pt,[pi,St].concat(_i))});var $r=He(wi,ir,zt,ri,rt,je,wn,Pi),hr=Tr.has("hover"),Ri=Fi.has("hover"),fr,Dr;hr&&(Gi("onMouseEnter",!0,Ge,function(St){Li(St)}),Gi("onPointerEnter",!0,Ge,function(St){Li(St)}),fr=function(Pt){(wi||qi)&&ri!==null&&ri!==void 0&&ri.contains(Pt.target)&&Pi(!0,Ge)},Je&&(lr.onMouseMove=function(St){var Pt;(Pt=pi.onMouseMove)===null||Pt===void 0||Pt.call(pi,St)})),Ri&&(Gi("onMouseLeave",!1,ot),Gi("onPointerLeave",!1,ot),Dr=function(){Pi(!1,ot)}),Tr.has("focus")&&Gi("onFocus",!0,it),Fi.has("focus")&&Gi("onBlur",!1,we),Tr.has("contextMenu")&&(lr.onContextMenu=function(St){var Pt;Ui.current&&Fi.has("contextMenu")?Pi(!1):(Li(St),Pi(!0)),St.preventDefault();for(var ni=arguments.length,_i=new Array(ni>1?ni-1:0),ui=1;ui<ni;ui++)_i[ui-1]=arguments[ui];(Pt=pi.onContextMenu)===null||Pt===void 0||Pt.call.apply(Pt,[pi,St].concat(_i))}),Qt&&(lr.className=_()(pi.className,Qt));var rr=h.useRef(!1);rr.current||(rr.current=Et||wi||qi);var dr=(0,I.Z)((0,I.Z)({},pi),lr),Xr={},Lr=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Lr.forEach(function(St){tt[St]&&(Xr[St]=function(){for(var Pt,ni=arguments.length,_i=new Array(ni),ui=0;ui<ni;ui++)_i[ui]=arguments[ui];(Pt=dr[St])===null||Pt===void 0||Pt.call.apply(Pt,[dr].concat(_i)),tt[St].apply(tt,_i)})});var ai=h.cloneElement(Ci,(0,I.Z)((0,I.Z)({},dr),Xr)),xi={x:An,y:Mr},Hr=gt?(0,I.Z)({},gt!==!0?gt:{}):null;return h.createElement(h.Fragment,null,h.createElement(F.Z,{disabled:!wi,ref:Ni,onResize:dn},h.createElement(M,{getTriggerDOMNode:si},ai)),rr.current&&h.createElement(q.Provider,{value:ii},h.createElement(N,{portal:be,ref:Kt,prefixCls:Ke,popup:Nt,className:_()(nt,un),style:Dt,target:zt,onMouseEnter:fr,onMouseLeave:Dr,onPointerEnter:fr,zIndex:ie,open:wi,keepDom:qi,fresh:de,onClick:et,onPointerDownCapture:$r,mask:rt,motion:Ji,maskMotion:sn,onVisibleChanged:Ln,onPrepare:Rn,forceRender:Et,autoDestroy:Ve,getPopupContainer:mt,align:cr,arrow:Hr,arrowPos:xi,ready:wr,offsetX:on,offsetY:xn,offsetR:xr,offsetB:ln,onAlign:It,stretch:oe,targetWidth:cn/Yr,targetHeight:Tn/Ar})))});return ye}var bt=Ue(D.Z)},12085:function(yt,ge){"use strict";ge.Z={header:"header___HqHSe",checkboxs:"checkboxs___ObBnD",field:"field___w_sM6","oj-form-container":"oj-form-container____odYP","oj-left-panel":"oj-left-panel___emEB2","oj-form-info":"oj-form-info___m00Ag",footer:"footer___O4iSJ",collapse:"collapse___Ltfkj","test-case-name":"test-case-name___miZcb","btn-remove-case":"btn-remove-case___cHap2","icon-tag":"icon-tag___gmyTb",btn_back:"btn_back___tNmX3",testJi:"testJi___L3fHb",upBtn:"upBtn___RGH6X",djs:"djs____TS0n",time:"time___IAdHc"}},57884:function(yt,ge,b){"use strict";var I=b(59301),P=b(93314),K=b(99571),D=Object.defineProperty,w=Object.defineProperties,_=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,y=(h,d,E)=>d in h?D(h,d,{enumerable:!0,configurable:!0,writable:!0,value:E}):h[d]=E,f=(h,d)=>{for(var E in d||(d={}))v.call(d,E)&&y(h,E,d[E]);if(F)for(var E of F(d))s.call(d,E)&&y(h,E,d[E]);return h},c=(h,d)=>w(h,_(d));const l=({img:h,buttonProps:d={},styles:E={},customText:T,ButtonText:L,ButtonClick:x,Buttonclass:A,ButtonTwo:O,imgStyles:U,loading:N=!1,className:$=""})=>I.createElement("section",{className:`tc animated fadeIn ${$}`,style:f({color:"#999",margin:"100px auto",visibility:N?"hidden":"visible"},E)},I.createElement("img",{src:h||P,style:c(f({},U),{pointerEvents:"none",userSelect:"none"})}),I.createElement("p",{className:"mt20 font14"},T||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),L&&I.createElement(K.ZP,f({className:A,onClick:x},d),L),O&&O);ge.Z=l},41550:function(yt,ge,b){"use strict";b.d(ge,{Z:function(){return A}});var I=b(59301),P={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},K=b(99571),D=b(70557),w=b(51124),_=b(25399),F=b(49661),v=b(72664),s=b(57884),y=b(90524),f=b(14794),c=b(59301),l=Object.defineProperty,h=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,T=(O,U,N)=>U in O?l(O,U,{enumerable:!0,configurable:!0,writable:!0,value:N}):O[U]=N,L=(O,U)=>{for(var N in U||(U={}))d.call(U,N)&&T(O,N,U[N]);if(h)for(var N of h(U))E.call(U,N)&&T(O,N,U[N]);return O},x=(O,U,N)=>new Promise(($,M)=>{var Z=ue=>{try{se(N.next(ue))}catch(J){M(J)}},q=ue=>{try{se(N.throw(ue))}catch(J){M(J)}},se=ue=>ue.done?$(ue.value):Promise.resolve(ue.value).then(Z,q);se((N=N.apply(O,U)).next())}),A=({editOffice:O="view",data:U,issaver:N,onSaver:$,theme:M,type:Z,filename:q,monacoEditor:se,className:ue,style:J,close:z,onClose:X,hasMask:B,disabledDownload:G,onImgDimensions:W,showNodata:k,recordInfo:C})=>{const[V,ne]=(0,I.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[pe,Ce]=(0,I.useState)(""),[We,me]=(0,I.useState)(),Ne=window.ENV==="build"?"/react/build":"",Be=location.host.startsWith("localhost")?y.Z.PROXY_SERVER:y.Z.API_SERVER,wt=10*(1024*1024),He=(0,I.useRef)();U!=null&&U.startsWith("/api")&&Z!=="txt"&&(U=y.Z.API_SERVER+U);const lt=le=>le.substring(le.lastIndexOf("/")+1).split(".").pop();q&&se&&(se.filename=q),(0,I.useEffect)(()=>{var le,ke;const Fe=(ke=(le=document.cookie)==null?void 0:le.replace(/\s/g,""))==null?void 0:ke.split(";");Fe==null||Fe.map(Ke=>{let re=Ke.split("=");re[0]==="_educoder_session"&&Ce(re[1])})},[]),(0,I.useEffect)(()=>{Z==="office"&&(U.indexOf("bigfilescdn.")>-1||U.indexOf("bigfiles1")>-1?me({url:U,fileType:lt(U),model:U.indexOf("model=edit")?"edit":"view"}):bt())},[Z,U]);function Ue(le){return x(this,null,function*(){le.data.type==="pdfdata"&&($(le.data.data),window.removeEventListener("message",Ue,!1)),console.log("mess---:",le.data)})}const bt=()=>x(void 0,null,function*(){console.log("data:",U);let le=U;U.startsWith("http")||(le=location.origin+le);let ke=new URL(le).pathname.split("/").pop();const Fe=yield(0,v.gJ)({attachment_id:ke});Fe.url=Be+Fe.url,me(Fe)}),be=()=>{if(U.startsWith("http")||U.startsWith("blob:")){ye();return}(0,F.Sv)(q||"educoder",U,q)},ye=()=>{C&&(0,f.fc)({id:C==null?void 0:C.id,watch_type:1,course_id:C==null?void 0:C.course_id}),(0,F.Nd)(q||"educoder",decodeURIComponent(U))};return c.createElement("div",{style:L({},J||{}),className:`${B&&P.bgBlack} ${Z?P.wrp:"hide"}`},z&&c.createElement("div",{className:P.close,ref:He},!!W&&c.createElement(_.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>He.current},c.createElement("span",{onClick:()=>{X(),W()}},c.createElement("i",{className:"icon-yulanpizhu"}))),!G&&c.createElement(_.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>He.current},c.createElement("span",{onClick:ye},c.createElement("i",{className:"icon-quxiaozhiding"}))),N&&c.createElement(_.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>He.current},c.createElement("span",{className:"",onClick:()=>{const le=document.getElementById("pdfiframe");window.addEventListener("message",Ue,!1),setTimeout(()=>{le.contentWindow.postMessage("getData","*")},300)}},c.createElement("i",{className:"icon-baocun"}))),c.createElement(_.Z,{title:"\u5173\u95ED",getPopupContainer:()=>He.current},c.createElement("span",{className:"",onClick:()=>{X()}},c.createElement("i",{className:"icon-guanbi1"})))),c.createElement("div",{className:`${P[ue]} ${ue} ${P.monaco} ${Z==="txt"?"show":"hide"}`},Z==="txt"&&c.createElement(c.Fragment,null,c.createElement(w.ZP,L({},se)))),Z==="audio"&&c.createElement("audio",{src:`${(U==null?void 0:U.indexOf("http://"))>-1||(U==null?void 0:U.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${U}`,autoPlay:!0}),Z==="video"&&c.createElement(c.Fragment,null,(U==null?void 0:U.indexOf("http"))>-1?c.createElement("video",{controls:!0,src:`${U}`,autoPlay:!0}):c.createElement("video",{controls:!0,src:`data:video/mp4;base64,${U}`,autoPlay:!0})),Z==="office"&&We&&c.createElement("iframe",{src:`${Ne}/office.html?key=${We.key}&url=${btoa(We.url)}&callbackUrl=${Be+(We.callbackUrl||"")}&fileType=${We.fileType}&title=${We.title||""}&model=${O}&officeServer=${y.Z.ONLYOFFICE}&disabledDownload=${!!G}`}),Z==="html"&&c.createElement("iframe",{src:U+"&disposition=inline"}),Z==="pdf"&&c.createElement("iframe",{id:"pdfiframe",src:`${Ne}/js/pdfview/index.html?filename=${q||"educoder.pdf"}&url=${encodeURIComponent(U)}&disabledDownload=${!!G}&model=${O}`}),Z==="image"&&c.createElement("img",{src:`${(U==null?void 0:U.indexOf("http://"))>-1||(U==null?void 0:U.indexOf("https://"))>-1?"":"data:image/png;base64,"}${U}`}),(Z==="other"||Z==="download")&&c.createElement(c.Fragment,null,k?c.createElement(s.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:c.createElement(K.ZP,{icon:c.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:be,disabled:G},"\u4E0B\u8F7D")}):c.createElement(K.ZP,{type:"primary",size:"middle",onClick:be,disabled:G},c.createElement(D.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")),Z==="flowChart"&&c.createElement("div",{className:"embed"},c.createElement("iframe",{src:`/drawio/src/main/webapp/viewer.html?id=${U||""}&gapi=0&od=0&db=0&gh=0&gl=0`,width:"100%",height:"100%",frameBorder:"0"})))}},38394:function(yt,ge,b){"use strict";b.d(ge,{z:function(){return se},Z:function(){return ue}});var I=b(59301),P=b(88831),K=b(90290),D=b(64018),w=b(68535),_=b(90524),F=b(49661),v=b(15342),s=b(77736),y=b(99571),f=b(1012),c=b(41550),l=b(59301),d=({html:J})=>{const z=(0,I.useRef)(null),X=(0,I.useRef)(null),B=`.markdown-body p {
|
|
|
margin: 0 0 16px 0 !important;
|
|
|
line-height: 28px;
|
|
|
white-space: pre-wrap;
|
|
|
}
|
|
|
|
|
|
ol,
|
|
|
ul,
|
|
|
li {
|
|
|
list-style-type: none
|
|
|
}
|
|
|
|
|
|
ol,
|
|
|
ul,
|
|
|
dl {
|
|
|
margin-bottom: 0px;
|
|
|
}
|
|
|
|
|
|
.markdown-body {
|
|
|
-ms-text-size-adjust: 100%;
|
|
|
-webkit-text-size-adjust: 100%;
|
|
|
color: #333;
|
|
|
overflow: hidden;
|
|
|
font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", "Monaco", monospace, Tahoma, STXihei, "\u534E\u6587\u7EC6\u9ED1", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "\u5B8B\u4F53", Heiti, "\u9ED1\u4F53", sans-serif;
|
|
|
word-break: break-word;
|
|
|
font-size: 16px;
|
|
|
line-height: 1.6;
|
|
|
white-space: normal;
|
|
|
word-wrap: break-word;
|
|
|
position: relative;
|
|
|
}
|
|
|
|
|
|
.markdown-body ul>li {
|
|
|
list-style-type: disc;
|
|
|
}
|
|
|
|
|
|
.markdown-body ol>li {
|
|
|
list-style-type: decimal;
|
|
|
}
|
|
|
|
|
|
.markdown-body a {
|
|
|
background: transparent;
|
|
|
}
|
|
|
|
|
|
.markdown-body a:active,
|
|
|
.markdown-body a:hover {
|
|
|
outline: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body strong {
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
.markdown-body h1 {
|
|
|
font-size: 2em;
|
|
|
margin: 0.67em 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body img {
|
|
|
border: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body hr {
|
|
|
-moz-box-sizing: content-box;
|
|
|
box-sizing: content-box;
|
|
|
height: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body pre {
|
|
|
overflow: auto;
|
|
|
}
|
|
|
|
|
|
.markdown-body code,
|
|
|
.markdown-body kbd,
|
|
|
.markdown-body pre {
|
|
|
font-family: "Meiryo UI", "YaHei Consolas Hybrid", Consolas, "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace;
|
|
|
font-size: 1em;
|
|
|
}
|
|
|
|
|
|
.markdown-body input {
|
|
|
color: inherit;
|
|
|
font: inherit;
|
|
|
margin: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body html input[disabled] {
|
|
|
cursor: default;
|
|
|
}
|
|
|
|
|
|
.markdown-body input {
|
|
|
line-height: normal;
|
|
|
}
|
|
|
|
|
|
.markdown-body input[type="checkbox"] {
|
|
|
-moz-box-sizing: border-box;
|
|
|
box-sizing: border-box;
|
|
|
padding: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body table {
|
|
|
border-collapse: collapse;
|
|
|
border-spacing: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body td,
|
|
|
.markdown-body th {
|
|
|
padding: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body * {
|
|
|
-moz-box-sizing: border-box;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
|
|
|
.markdown-body input {
|
|
|
font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
|
|
|
}
|
|
|
|
|
|
.markdown-body a {
|
|
|
color: #4183c4;
|
|
|
text-decoration: none;
|
|
|
}
|
|
|
|
|
|
.markdown-body a:hover,
|
|
|
.markdown-body a:active {
|
|
|
text-decoration: underline;
|
|
|
}
|
|
|
|
|
|
.markdown-body hr {
|
|
|
height: 0;
|
|
|
margin: 15px 0;
|
|
|
overflow: hidden;
|
|
|
background: transparent;
|
|
|
border: 0;
|
|
|
border-bottom: 1px solid #ddd;
|
|
|
}
|
|
|
|
|
|
.markdown-body hr:before {
|
|
|
display: table;
|
|
|
content: "";
|
|
|
}
|
|
|
|
|
|
.markdown-body hr:after {
|
|
|
display: table;
|
|
|
clear: both;
|
|
|
content: "";
|
|
|
}
|
|
|
|
|
|
.markdown-body h1,
|
|
|
.markdown-body h2,
|
|
|
.markdown-body h3,
|
|
|
.markdown-body h4,
|
|
|
.markdown-body h5,
|
|
|
.markdown-body h6 {
|
|
|
margin-top: 15px;
|
|
|
margin-bottom: 15px;
|
|
|
line-height: 1.1;
|
|
|
}
|
|
|
|
|
|
.markdown-body h1 {
|
|
|
font-size: 30px;
|
|
|
}
|
|
|
|
|
|
.markdown-body h2 {
|
|
|
font-size: 21px;
|
|
|
}
|
|
|
|
|
|
.markdown-body h3 {
|
|
|
font-size: 16px;
|
|
|
}
|
|
|
|
|
|
.markdown-body h4 {
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
|
|
|
.markdown-body h5 {
|
|
|
font-size: 12px;
|
|
|
}
|
|
|
|
|
|
.markdown-body h6 {
|
|
|
font-size: 11px;
|
|
|
}
|
|
|
|
|
|
.markdown-body blockquote {
|
|
|
margin: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body ul,
|
|
|
.markdown-body ol {
|
|
|
padding: 0;
|
|
|
margin-top: 0;
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
|
|
|
ul.linenums,
|
|
|
ol.linenums {
|
|
|
padding: 16px 0 0 56px !important;
|
|
|
}
|
|
|
|
|
|
.markdown-body ul,
|
|
|
.markdown-body ol {
|
|
|
padding-left: 2em;
|
|
|
}
|
|
|
|
|
|
|
|
|
.markdown-body ol ol,
|
|
|
.markdown-body ul ol {
|
|
|
list-style-type: lower-roman;
|
|
|
}
|
|
|
|
|
|
.markdown-body ul ul ol,
|
|
|
.markdown-body ul ol ol,
|
|
|
.markdown-body ol ul ol,
|
|
|
.markdown-body ol ol ol {
|
|
|
list-style-type: lower-alpha;
|
|
|
}
|
|
|
|
|
|
.markdown-body dd {
|
|
|
margin-left: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body code {
|
|
|
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
|
font-size: 12px;
|
|
|
}
|
|
|
|
|
|
.markdown-body pre {
|
|
|
margin-top: 0;
|
|
|
margin-bottom: 0;
|
|
|
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
|
}
|
|
|
|
|
|
.markdown-body .octicon {
|
|
|
font: normal normal 16px octicons-anchor;
|
|
|
line-height: 1;
|
|
|
display: inline-block;
|
|
|
text-decoration: none;
|
|
|
-webkit-font-smoothing: antialiased;
|
|
|
-moz-osx-font-smoothing: grayscale;
|
|
|
-webkit-user-select: none;
|
|
|
-moz-user-select: none;
|
|
|
-ms-user-select: none;
|
|
|
user-select: none;
|
|
|
}
|
|
|
|
|
|
.markdown-body .octicon-link:before {
|
|
|
content: '\f05c';
|
|
|
}
|
|
|
|
|
|
.markdown-body>*:first-child {
|
|
|
margin-top: 0 !important;
|
|
|
}
|
|
|
|
|
|
.markdown-body>*:last-child {
|
|
|
margin-bottom: 0 !important;
|
|
|
}
|
|
|
|
|
|
.markdown-body .anchor {
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
display: block;
|
|
|
padding-right: 6px;
|
|
|
padding-left: 30px;
|
|
|
margin-left: -30px;
|
|
|
}
|
|
|
|
|
|
.markdown-body .anchor:focus {
|
|
|
outline: none;
|
|
|
}
|
|
|
|
|
|
.markdown-body h1,
|
|
|
.markdown-body h2,
|
|
|
.markdown-body h3,
|
|
|
.markdown-body h4,
|
|
|
.markdown-body h5,
|
|
|
.markdown-body h6 {
|
|
|
position: relative;
|
|
|
margin-top: 1em;
|
|
|
margin-bottom: 16px;
|
|
|
font-weight: bold;
|
|
|
line-height: 1.4;
|
|
|
}
|
|
|
|
|
|
.markdown-body h1 .octicon-link,
|
|
|
.markdown-body h2 .octicon-link,
|
|
|
.markdown-body h3 .octicon-link,
|
|
|
.markdown-body h4 .octicon-link,
|
|
|
.markdown-body h5 .octicon-link,
|
|
|
.markdown-body h6 .octicon-link {
|
|
|
display: none;
|
|
|
color: #000;
|
|
|
vertical-align: middle;
|
|
|
}
|
|
|
|
|
|
.markdown-body h1:hover .anchor,
|
|
|
.markdown-body h2:hover .anchor,
|
|
|
.markdown-body h3:hover .anchor,
|
|
|
.markdown-body h4:hover .anchor,
|
|
|
.markdown-body h5:hover .anchor,
|
|
|
.markdown-body h6:hover .anchor {
|
|
|
padding-left: 8px;
|
|
|
margin-left: -30px;
|
|
|
text-decoration: none;
|
|
|
}
|
|
|
|
|
|
.markdown-body h1:hover .anchor .octicon-link,
|
|
|
.markdown-body h2:hover .anchor .octicon-link,
|
|
|
.markdown-body h3:hover .anchor .octicon-link,
|
|
|
.markdown-body h4:hover .anchor .octicon-link,
|
|
|
.markdown-body h5:hover .anchor .octicon-link,
|
|
|
.markdown-body h6:hover .anchor .octicon-link {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
|
|
|
.markdown-body h1 {
|
|
|
padding-bottom: 0.3em;
|
|
|
font-size: 2.25em;
|
|
|
line-height: 1.2;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
}
|
|
|
|
|
|
.markdown-body h1 .anchor {
|
|
|
line-height: 1;
|
|
|
}
|
|
|
|
|
|
.markdown-body h2 {
|
|
|
padding-bottom: 0.3em;
|
|
|
font-size: 1.75em;
|
|
|
line-height: 1.225;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
}
|
|
|
|
|
|
.markdown-body h2 .anchor {
|
|
|
line-height: 1;
|
|
|
}
|
|
|
|
|
|
.markdown-body h3 {
|
|
|
font-size: 1.5em;
|
|
|
line-height: 1.43;
|
|
|
}
|
|
|
|
|
|
.markdown-body h3 .anchor {
|
|
|
line-height: 1.2;
|
|
|
}
|
|
|
|
|
|
.markdown-body h4 {
|
|
|
font-size: 1.25em;
|
|
|
}
|
|
|
|
|
|
.markdown-body h4 .anchor {
|
|
|
line-height: 1.2;
|
|
|
}
|
|
|
|
|
|
.markdown-body h5 {
|
|
|
font-size: 1em;
|
|
|
}
|
|
|
|
|
|
.markdown-body h5 .anchor {
|
|
|
line-height: 1.1;
|
|
|
}
|
|
|
|
|
|
.markdown-body h6 {
|
|
|
font-size: 1em;
|
|
|
color: #777;
|
|
|
}
|
|
|
|
|
|
.markdown-body h6 .anchor {
|
|
|
line-height: 1.1;
|
|
|
}
|
|
|
|
|
|
.markdown-body p,
|
|
|
.markdown-body blockquote,
|
|
|
.markdown-body ul,
|
|
|
.markdown-body ol,
|
|
|
.markdown-body dl,
|
|
|
.markdown-body table,
|
|
|
.markdown-body pre {
|
|
|
margin-top: 0;
|
|
|
margin-bottom: 16px;
|
|
|
}
|
|
|
|
|
|
.markdown-body ul ul,
|
|
|
.markdown-body ul ol,
|
|
|
.markdown-body ol ol,
|
|
|
.markdown-body ol ul {
|
|
|
margin-top: 0;
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body li>p {
|
|
|
margin-top: 16px;
|
|
|
}
|
|
|
|
|
|
.markdown-body dl {
|
|
|
padding: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body dl dt {
|
|
|
padding: 0;
|
|
|
margin-top: 16px;
|
|
|
font-size: 1em;
|
|
|
font-style: italic;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
.markdown-body dl dd {
|
|
|
padding: 0 16px;
|
|
|
margin-bottom: 16px;
|
|
|
}
|
|
|
|
|
|
.markdown-body blockquote {
|
|
|
padding: 0 15px;
|
|
|
color: #777;
|
|
|
border-left: 4px solid #ddd;
|
|
|
}
|
|
|
|
|
|
.markdown-body blockquote> :first-child {
|
|
|
margin-top: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body blockquote> :last-child {
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body table {
|
|
|
display: block;
|
|
|
width: 100%;
|
|
|
overflow: auto;
|
|
|
word-break: normal;
|
|
|
word-break: keep-all;
|
|
|
}
|
|
|
|
|
|
.markdown-body table th {
|
|
|
font-weight: bold;
|
|
|
text-align: revert;
|
|
|
}
|
|
|
|
|
|
.markdown-body table th,
|
|
|
.markdown-body table td {
|
|
|
padding: 6px 13px;
|
|
|
border: 1px solid #ddd;
|
|
|
}
|
|
|
|
|
|
.markdown-body table tr {
|
|
|
background-color: #fff;
|
|
|
border-top: 1px solid #ccc;
|
|
|
}
|
|
|
|
|
|
.markdown-body table tr:nth-child(2n) {
|
|
|
background-color: #f8f8f8;
|
|
|
}
|
|
|
|
|
|
.markdown-body img {
|
|
|
max-width: 100%;
|
|
|
-moz-box-sizing: border-box;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
|
|
|
.markdown-body code {
|
|
|
padding: 0;
|
|
|
padding-top: 0.2em;
|
|
|
padding-bottom: 0.2em;
|
|
|
margin: 0;
|
|
|
font-size: 85%;
|
|
|
background-color: rgba(0, 0, 0, 0.04);
|
|
|
border-radius: 3px;
|
|
|
}
|
|
|
|
|
|
.markdown-body code:has(.katex) {
|
|
|
background-color: transparent;
|
|
|
}
|
|
|
|
|
|
.markdown-body code:before,
|
|
|
.markdown-body code:after {
|
|
|
letter-spacing: -0.2em;
|
|
|
content: "\\00a0";
|
|
|
}
|
|
|
|
|
|
.markdown-body pre>code {
|
|
|
padding: 0;
|
|
|
margin: 0;
|
|
|
font-size: 100%;
|
|
|
word-break: normal;
|
|
|
white-space: pre;
|
|
|
background: transparent;
|
|
|
border: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body .highlight {
|
|
|
margin-bottom: 16px;
|
|
|
}
|
|
|
|
|
|
.markdown-body .highlight pre,
|
|
|
.markdown-body pre {
|
|
|
padding: 16px;
|
|
|
overflow: auto;
|
|
|
font-size: 85%;
|
|
|
line-height: 1.45;
|
|
|
background-color: #f7f7f7;
|
|
|
border-radius: 3px;
|
|
|
}
|
|
|
|
|
|
.markdown-body .highlight pre {
|
|
|
margin-bottom: 0;
|
|
|
word-break: normal;
|
|
|
}
|
|
|
|
|
|
.markdown-body pre {
|
|
|
word-wrap: normal;
|
|
|
}
|
|
|
|
|
|
.markdown-body pre code {
|
|
|
display: inline;
|
|
|
max-width: initial;
|
|
|
padding: 0;
|
|
|
margin: 0;
|
|
|
overflow: initial;
|
|
|
line-height: inherit;
|
|
|
word-wrap: normal;
|
|
|
background-color: transparent;
|
|
|
border: 0;
|
|
|
}
|
|
|
|
|
|
.markdown-body pre code:before,
|
|
|
.markdown-body pre code:after {
|
|
|
content: normal;
|
|
|
}
|
|
|
|
|
|
.markdown-body kbd {
|
|
|
display: inline-block;
|
|
|
padding: 3px 5px;
|
|
|
font-size: 11px;
|
|
|
line-height: 10px;
|
|
|
color: #555;
|
|
|
vertical-align: middle;
|
|
|
background-color: #fcfcfc;
|
|
|
border: solid 1px #ccc;
|
|
|
border-bottom-color: #bbb;
|
|
|
border-radius: 3px;
|
|
|
box-shadow: inset 0 -1px 0 #bbb;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-c {
|
|
|
color: #969896;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-c1,
|
|
|
.markdown-body .pl-mdh,
|
|
|
.markdown-body .pl-mm,
|
|
|
.markdown-body .pl-mp,
|
|
|
.markdown-body .pl-mr,
|
|
|
.markdown-body .pl-s1 .pl-v,
|
|
|
.markdown-body .pl-s3,
|
|
|
.markdown-body .pl-sc,
|
|
|
.markdown-body .pl-sv {
|
|
|
color: #0086b3;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-e,
|
|
|
.markdown-body .pl-en {
|
|
|
color: #795da3;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-s1 .pl-s2,
|
|
|
.markdown-body .pl-smi,
|
|
|
.markdown-body .pl-smp,
|
|
|
.markdown-body .pl-stj,
|
|
|
.markdown-body .pl-vo,
|
|
|
.markdown-body .pl-vpf {
|
|
|
color: #333;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-ent {
|
|
|
color: #63a35c;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-k,
|
|
|
.markdown-body .pl-s,
|
|
|
.markdown-body .pl-st {
|
|
|
color: #a71d5d;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-pds,
|
|
|
.markdown-body .pl-s1,
|
|
|
.markdown-body .pl-s1 .pl-pse .pl-s2,
|
|
|
.markdown-body .pl-sr,
|
|
|
.markdown-body .pl-sr .pl-cce,
|
|
|
.markdown-body .pl-sr .pl-sra,
|
|
|
.markdown-body .pl-sr .pl-sre,
|
|
|
.markdown-body .pl-src {
|
|
|
color: #df5000;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-mo,
|
|
|
.markdown-body .pl-v {
|
|
|
color: #1d3e81;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-id {
|
|
|
color: #b52a1d;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-ii {
|
|
|
background-color: #b52a1d;
|
|
|
color: #f8f8f8;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-sr .pl-cce {
|
|
|
color: #63a35c;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-ml {
|
|
|
color: #693a17;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-mh,
|
|
|
.markdown-body .pl-mh .pl-en,
|
|
|
.markdown-body .pl-ms {
|
|
|
color: #1d3e81;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-mq {
|
|
|
color: #008080;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-mi {
|
|
|
color: #333;
|
|
|
font-style: italic;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-mb {
|
|
|
color: #333;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-md,
|
|
|
.markdown-body .pl-mdhf {
|
|
|
background-color: #ffecec;
|
|
|
color: #bd2c00;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-mdht,
|
|
|
.markdown-body .pl-mi1 {
|
|
|
background-color: #eaffea;
|
|
|
color: #55a532;
|
|
|
}
|
|
|
|
|
|
.markdown-body .pl-mdr {
|
|
|
color: #795da3;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
.markdown-body kbd {
|
|
|
display: inline-block;
|
|
|
padding: 3px 5px;
|
|
|
font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
|
line-height: 10px;
|
|
|
color: #555;
|
|
|
vertical-align: middle;
|
|
|
background-color: #fcfcfc;
|
|
|
border: solid 1px #ccc;
|
|
|
border-bottom-color: #bbb;
|
|
|
border-radius: 3px;
|
|
|
box-shadow: inset 0 -1px 0 #bbb;
|
|
|
}
|
|
|
|
|
|
.markdown-body .task-list-item {
|
|
|
list-style-type: none;
|
|
|
}
|
|
|
|
|
|
.markdown-body .task-list-item+.task-list-item {
|
|
|
margin-top: 3px;
|
|
|
}
|
|
|
|
|
|
.markdown-body .task-list-item input {
|
|
|
float: left;
|
|
|
margin: 0.3em 0 0.25em -1.6em;
|
|
|
vertical-align: middle;
|
|
|
}
|
|
|
|
|
|
.markdown-body :checked+.radio-label {
|
|
|
z-index: 1;
|
|
|
position: relative;
|
|
|
border-color: #4183c4;
|
|
|
}
|
|
|
|
|
|
|
|
|
/*! Pretty printing styles. Used with prettify.js. */
|
|
|
/* SPAN elements with the classes below are added by prettyprint. */
|
|
|
.pln {
|
|
|
color: #000
|
|
|
}
|
|
|
|
|
|
/* plain text */
|
|
|
|
|
|
@media screen {
|
|
|
.str {
|
|
|
color: #080
|
|
|
}
|
|
|
|
|
|
/* string content */
|
|
|
.kwd {
|
|
|
color: #008
|
|
|
}
|
|
|
|
|
|
/* a keyword */
|
|
|
.com {
|
|
|
color: #800
|
|
|
}
|
|
|
|
|
|
/* a comment */
|
|
|
.typ {
|
|
|
color: #606
|
|
|
}
|
|
|
|
|
|
/* a type name */
|
|
|
.lit {
|
|
|
color: #066
|
|
|
}
|
|
|
|
|
|
/* a literal value */
|
|
|
/* punctuation, lisp open bracket, lisp close bracket */
|
|
|
.pun,
|
|
|
.opn,
|
|
|
.clo {
|
|
|
color: #660
|
|
|
}
|
|
|
|
|
|
.tag {
|
|
|
color: #008
|
|
|
}
|
|
|
|
|
|
/* a markup tag name */
|
|
|
.atn {
|
|
|
color: #606
|
|
|
}
|
|
|
|
|
|
/* a markup attribute name */
|
|
|
.atv {
|
|
|
color: #080
|
|
|
}
|
|
|
|
|
|
/* a markup attribute value */
|
|
|
.dec,
|
|
|
.var {
|
|
|
color: #606
|
|
|
}
|
|
|
|
|
|
/* a declaration; a variable name */
|
|
|
.fun {
|
|
|
color: red
|
|
|
}
|
|
|
|
|
|
/* a function name */
|
|
|
}
|
|
|
|
|
|
/* Use higher contrast and text-weight for printable form. */
|
|
|
@media print,
|
|
|
projection {
|
|
|
.str {
|
|
|
color: #060
|
|
|
}
|
|
|
|
|
|
.kwd {
|
|
|
color: #006;
|
|
|
font-weight: bold
|
|
|
}
|
|
|
|
|
|
.com {
|
|
|
color: #600;
|
|
|
font-style: italic
|
|
|
}
|
|
|
|
|
|
.typ {
|
|
|
color: #404;
|
|
|
font-weight: bold
|
|
|
}
|
|
|
|
|
|
.lit {
|
|
|
color: #044
|
|
|
}
|
|
|
|
|
|
.pun,
|
|
|
.opn,
|
|
|
.clo {
|
|
|
color: #440
|
|
|
}
|
|
|
|
|
|
.tag {
|
|
|
color: #006;
|
|
|
font-weight: bold
|
|
|
}
|
|
|
|
|
|
.atn {
|
|
|
color: #404
|
|
|
}
|
|
|
|
|
|
.atv {
|
|
|
color: #060
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* Put a border around prettyprinted code snippets. */
|
|
|
pre.prettyprint {
|
|
|
padding: 2px;
|
|
|
/* border: 1px solid #888 */
|
|
|
}
|
|
|
|
|
|
/* Specify class=linenums on a pre to get line numbering */
|
|
|
ol.linenums {
|
|
|
margin-top: 0;
|
|
|
margin-bottom: 0
|
|
|
}
|
|
|
|
|
|
/* IE indents via margin-left */
|
|
|
li.L0,
|
|
|
li.L1,
|
|
|
li.L2,
|
|
|
li.L3,
|
|
|
li.L5,
|
|
|
li.L6,
|
|
|
li.L7,
|
|
|
li.L8 {
|
|
|
list-style-type: none
|
|
|
}
|
|
|
|
|
|
/* Alternate shading for lines */
|
|
|
li.L1,
|
|
|
li.L3,
|
|
|
li.L5,
|
|
|
li.L7,
|
|
|
li.L9 {
|
|
|
background: #eee
|
|
|
}
|
|
|
|
|
|
.markdown-body p,
|
|
|
.markdown-body blockquote,
|
|
|
.markdown-body ul,
|
|
|
.markdown-body ol,
|
|
|
.markdown-body dl,
|
|
|
.markdown-body table,
|
|
|
.markdown-body pre {
|
|
|
margin-top: 0;
|
|
|
margin-bottom: 16px;
|
|
|
}`;return(0,I.useEffect)(()=>{const G=z.current.attachShadow({mode:"open"});X.current=document.createElement("div"),X.current.className="markdown-body",X.current.innerHTML=J,G.appendChild(X.current);const W=document.createElement("style");return W.textContent=B,G.appendChild(W),()=>{G.innerHTML=""}},[]),(0,I.useEffect)(()=>{X.current&&(X.current.innerHTML=J)},[J]),l.createElement("div",{ref:z})};function E(J){const z=["onabort","onanimationend","onanimationiteration","onanimationstart","onauxclick","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncopy","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitionend","onvolumechange","onwaiting","onwheel"],X=new RegExp(`\\b(${z.join("|")})\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]*)`,"gi");return J.replace(X,"").trim()}var T={mdBody:"mdBody___raKXb",button:"button___Ch5Pc",previewFlowChart:"previewFlowChart___vY1dq"},L=Object.defineProperty,x=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,U=(J,z,X)=>z in J?L(J,z,{enumerable:!0,configurable:!0,writable:!0,value:X}):J[z]=X,N=(J,z)=>{for(var X in z||(z={}))A.call(z,X)&&U(J,X,z[X]);if(x)for(var X of x(z))O.call(z,X)&&U(J,X,z[X]);return J};const $="@\u2581\u2581@",M="@\u2581@",Z=/<pre[^>]*>/g;function q(J){let z=document.createElement("div");return z.innerHTML=J,z.childNodes.length===0?"":z.childNodes[0].nodeValue}const se=(J,z)=>{J=J||"";const X=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,B=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,G=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,W=/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return z?J.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(X,(k,C,V,ne,pe,Ce,We)=>{const me=C||ne||Ce,Ne=V||pe||We||"?";return _.Z.API_SERVER+"/api/attachments/"+me+Ne+"&t="+(0,F.Jn)(me,Date.now())+(k.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(J=J.replace(W,(k,C,V,ne,pe,Ce,We)=>{const me=C||ne||Ce,Ne=V||pe||We||"?";return _.Z.API_SERVER+"/attachments/download/"+me+Ne+"&t="+(0,F.Jn)(me,Date.now())+(k.indexOf(")")>-1?")":"&")}).replace(X,(k,C,V,ne,pe,Ce,We)=>{const me=C||ne||Ce,Ne=V||pe||We||"?";return _.Z.API_SERVER+"/api/attachments/"+me+Ne+"&t="+(0,F.Jn)(me,Date.now())+(k.indexOf(")")>-1?")":"&")}).replace(B,(k,C,V,ne,pe)=>{const Ce=C||ne,We=V||pe||"";return'"'+_.Z.API_SERVER+"/api/attachments/"+Ce+We+Ce+We+"&t="+(0,F.Jn)(Ce,Date.now())}).replace(G,(k,C,V,ne,pe)=>{const Ce=C||ne,We=V||pe||"";return"("+_.Z.API_SERVER+"/files/uploads/"+Ce+We+Ce+We+"&t="+(0,F.Jn)(Ce,Date.now())}).replaceAll('src="(','src="').replaceAll("src='(",'src="').replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
|
`),J)};var ue=({value:J="",edit:z=!1,className:X,showTextOnly:B,showLines:G,style:W={},stylesPrev:k={},highlightKeywords:C,showProgramFill:V,isProgramFill:ne,disabledFill:pe=!1,programFillValue:Ce,openEditor:We=()=>{},onFillChange:me=Me=>{},onFillBlur:Ne=()=>{},onFillFocus:Be=()=>{}})=>{let Me=E(String(J||""));const wt=(0,I.useRef)(),He=(0,I.useRef)(),[lt,Ue]=(0,I.useState)(""),[bt,be]=(0,I.useState)("office"),[ye,le]=(0,I.useState)([]),ke=(0,I.useRef)("a"+(0,f.Z)()),Fe={},Ke=we=>/<style[\s\S]*?>/i.test(we||""),re=(we,rt,Ze)=>{const je=document.createElement(we===M?"input":"textarea");je.style.width="100%",je.style.height=we===M?"40px":"151px",je.rows=5,je.spellcheck=!1,je.name="edu-program-fill",je.placeholder="\u8BF7\u8F93\u5165",je.dataset.id=rt;const mt=Object.keys(Fe).length;return Fe[mt]=je,`<span class="edu-program-fill-wrap ${we===M?"":"show"}" style="width:${we===M?"600px":"100%"}" title=${Ze||""}><span>${je.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function fe(we){return we=we.replace(/!\[.*?\]\(.*?\)/g,""),we=we.replace(/\[.*?\]\(.*?\)/g,""),we=we.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),we=we.replace(/<embed.*?>/g,""),we=we.replace(/<img.*?>/g,""),we=we.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),we=we.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),we=we.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),we=we.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),we}const De=we=>!B&&Ke(Me)?we:we.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(rt,Ze){let je=Ze.replace(/(\n|\r)/g,"").split("}"),mt=[];return je.map(Et=>{Et!=""&&mt.push(`.${ke.current} ${Et}`)}),`<style>${mt.join("}")}</style>`}),Re=(0,I.useMemo)(()=>{try{const je=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,mt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Et=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,st=/\(\/attachments\/download\//g;Me=Me.replace(st,"("+_.Z.API_SERVER+"/attachments/download/").replace(je,"("+_.Z.API_SERVER+"/api/attachments/").replace(mt,'"'+_.Z.API_SERVER+"/api/attachments/").replace(Et,'"'+_.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
|
`),wt.current.style.display="none"}catch(je){}if(V){let je=-1;return Me=Me.replaceAll("<","<").replaceAll(">",">").replace(/(@▁▁@|@▁@)/g,function(mt,Et,st){var Rt;return++je,re(mt,je,(Rt=Ce==null?void 0:Ce[je])==null?void 0:Rt.value.replaceAll("<","<").replaceAll(">",">"))}),`<pre style="background:#fff;padding:4px">${De(Me||"")}</pre>`}let we=De(Me);we=(0,K.ZP)(we);const rt=(0,K.ez)();Me.match(/\[TOC\]/)&&(we=we.replace("<p>[TOC]</p>",(0,K.Qv)()),(0,K.Iy)()),we=we.replace(/(__special_katext_id_\d+__)/g,(je,mt)=>{const{type:Et,expression:st}=rt[mt];return(0,v.renderToString)(q(st)||"",{displayMode:Et==="block",throwOnError:!1,output:"html"})}),we=we.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,K.AL)();const Ze=document.createElement("div");if(Ze.innerHTML=we,B)return Ze.innerText;if(C){const je=C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return Qe(Ze,je),Ze.innerHTML}return setTimeout(()=>ct(),500),Ze.innerHTML},[Me,C]);(0,I.useEffect)(()=>{Xe.current&&Xe.current.querySelectorAll(["input","textarea"]).forEach(rt=>{rt.oninput=Oe,rt.onblur=Ye,rt.onfocus=at})},[ye]),(0,I.useEffect)(()=>{var we,rt,Ze,je,mt;if(Ce!=null&&Ce.length)try{const Et=Xe.current.querySelectorAll(".edu-program-fill-score"),st=Xe.current.querySelectorAll('[name="edu-program-fill"]');for(const[Rt,Nt]of st.entries())Nt.value=((we=Ce==null?void 0:Ce[Rt])==null?void 0:we.value)||"",((rt=Ce==null?void 0:Ce[Rt])==null?void 0:rt.type)==="warning"?Nt.className="program-fill-warning":((Ze=Ce==null?void 0:Ce[Rt])==null?void 0:Ze.type)==="success"?Nt.className="program-fill-success":Nt.className="";for(const[Rt,Nt]of Et.entries())Nt.innerHTML=(je=Ce==null?void 0:Ce[Rt])!=null&&je.score?`${(mt=Ce==null?void 0:Ce[Rt])==null?void 0:mt.score}\u5206`:"";le(Ce)}catch(Et){console.log(Et,"error")}},[Ce]);const Oe=we=>{ye[we.target.dataset.id]=ye[we.target.dataset.id]||{},ye[we.target.dataset.id].value=we.target.value,le([...ye]),me(ye,we.target.dataset.id)},Ye=we=>{ye[we.target.dataset.id]=ye[we.target.dataset.id]||{},ye[we.target.dataset.id].value=we.target.value,le([...ye]),Ne(ye,we.target.dataset.id)},at=we=>{ye[we.target.dataset.id]=ye[we.target.dataset.id]||{},ye[we.target.dataset.id].value=we.target.value,le([...ye]),Be(ye,we.target.dataset.id)};function Qe(we,rt){return we.childNodes.forEach(Ze=>{var je;if(Ze.childNodes.length>0)Qe(Ze,rt);else if(Ze.nodeName!=="IMG")if(Ze.innerHTML)Ze.innerHTML=(je=Ze.innerHTML)==null?void 0:je.replace(new RegExp(rt,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const mt=document.createElement("span");mt.innerHTML=Ze.textContent.replace(new RegExp(rt,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),Ze.replaceWith(mt)}})}const Xe=(0,I.useRef)();K.jb.WebkitLineClamp=G,G&&(W=N(N({},W),K.jb));function Ge(we){let rt=we.target;if(rt.tagName.toUpperCase()==="A"){let Ze=rt.getAttribute("href");if(Ze.indexOf("office")>-1)we.preventDefault(),Ue(Ze),be("office");else if(Ze.indexOf("application/pdf")>-1)we.preventDefault(),Ue(Ze),be("pdf");else if(Ze.indexOf("text/html")>-1)we.preventDefault(),Ue(Ze),be("html");else if(Ze.startsWith("#")){we.preventDefault();let je=document.getElementById(Ze.replace("#",""));je&&je.scrollIntoView(!0)}}}const ct=()=>{var we;const rt=(we=Xe.current)==null?void 0:we.querySelectorAll("video");rt==null||rt.forEach(Ze=>{if(Ze.oncontextmenu=()=>!1,Ze.src.indexOf(".m3u8")>-1&&!Ze.canPlayType("application/vnd.apple.mpegurl")){if(w.ZP.isSupported()){var je=new w.ZP;je.loadSource(Ze.src),je.attachMedia(Ze)}}})};(0,I.useEffect)(()=>{if(Xe.current&&Re&&Re.match(Z)&&window.PR.prettyPrint(),Xe.current)return Xe.current.addEventListener("click",Ge),()=>{var we;(we=Xe.current)==null||we.removeEventListener("click",Ge),(0,K.AL)(),(0,K.Iy)()}},[Re,Xe.current,Ge]);const ot=we=>{we.target.nodeName==="IMG"&&we.target.className.indexOf("draw-flowchart")>-1?(wt.current.style.zIndex=1,wt.current.style.display="flex",wt.current.style.width=we.target.clientWidth+"px",wt.current.style.height=we.target.clientHeight+"px",wt.current.style.top=we.target.offsetTop+"px",wt.current.style.left=we.target.offsetLeft+"px",we.target.id&&(He.current=we.target.id)):wt.current.style.display="none"},it=()=>{wt.current.style.display="none"};return(0,I.useEffect)(()=>{var we;const rt=Ze=>{Ze.preventDefault(),Ze.clipboardData.setData("text",window.getSelection().toString())};return(we=Xe.current)==null||we.addEventListener("copy",rt),()=>{var Ze;(Ze=Xe.current)==null||Ze.removeEventListener("copy",rt)}},[Xe.current]),I.createElement("div",{style:{position:"relative"},onMouseLeave:it},B&&I.createElement("div",{ref:Xe,className:`${T.mdBody} `},Re),!B&&!Ke(Re)&&I.createElement("div",{ref:Xe,style:N({},W),onMouseOver:ot,className:`${X||""} ${pe?"disabled-fill":""} markdown-body ${T.mdBody} ${ke.current}`,dangerouslySetInnerHTML:{__html:Re}}),!B&&Ke(Re)&&I.createElement(d,{html:Re}),I.createElement("div",{ref:wt,className:`${T.button} ${z?"":T.previewFlowChart}`},I.createElement(s.Z,null,I.createElement(y.ZP,{onClick:()=>{z?We(He.current):(Ue(He.current),be("flowChart"))}},z?"\u7F16\u8F91":"\u9884\u89C8"))),I.createElement(c.Z,{close:!0,data:lt,type:lt!=null&<.length?bt:"",style:N({},k),onClose:()=>Ue("")}))}},766:function(yt,ge,b){"use strict";b.d(ge,{Z:function(){return D}});var I=b(76560),P={ldsRing:"ldsRing___mpBZC",idsRingWrapper:"idsRingWrapper___Of9_n",ldsring:"ldsring___o0w2t"},K=b(59301),D=({message:w,className:_,children:F,style:v={}})=>K.createElement("div",{className:`custom-spinner ${P.idsRingWrapper} ${_}`},K.createElement("div",{className:P.ldsRing},K.createElement("div",null),K.createElement("div",null),K.createElement("div",null),K.createElement("div",null)),w?K.createElement("p",{style:v},w):null,F,K.createElement(I.Outlet,null))},46685:function(yt,ge,b){"use strict";b.d(ge,{Z:function(){return _}});var I=b(59301),P={flex_box_center:"flex_box_center___Gc4dd",flex_space_between:"flex_space_between___K2f1v",flex_box_vertical_center:"flex_box_vertical_center___pupRp",flex_box_center_end:"flex_box_center_end___UDLRC",flex_box_column:"flex_box_column___a5uDo",result:"result___gu5zt",title:"title___xrnx2",left:"left___IAxp9",leftNode:"leftNode___HL8fG",right:"right___ZXYmw",rightNode:"rightNode___jYL5_"},K=b(92310),D=b.n(K),_=({className:F,style:v={},leftNode:s,leftTitle:y="\u81EA\u6D4B\u8F93\u5165",rightNode:f,rightTitle:c="\u8FD0\u884C\u7ED3\u679C"})=>I.createElement("div",{className:D()(P.result,F),style:v},I.createElement("div",{className:P.left},I.createElement("div",{className:P.title},I.createElement("i",{style:{color:"#08CF76"},className:"iconfont iconfont icon-zidingyiceshiyongli font14 mr5"}),I.createElement("span",null,y)),I.createElement("div",{className:P.leftNode},s)),I.createElement("div",{className:P.right},I.createElement("div",{className:P.title},I.createElement("i",{style:{color:"#00DFFF"},className:"iconfont iconfont icon-daimazhihangjieguo font14 mr5"}),I.createElement("span",null,c)),I.createElement("div",{className:P.rightNode},f)))},51124:function(yt,ge,b){"use strict";b.d(ge,{SV:function(){return wt},ZP:function(){return Me}});var I=b(59301),P=b(76374);const K={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},D={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},w={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
|
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
|
`)},{label:"if",content:["if () {"," $0","}"].join(`
|
|
|
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
|
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
|
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
|
|
|
`)},{label:"include <vector>",content:["#include <vector>"].join(`
|
|
|
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
|
|
|
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
|
|
|
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
|
|
|
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
|
|
|
`)},{label:"include <map>",content:["#include <map>"].join(`
|
|
|
`)},{label:"include <string>",content:["#include <string>"].join(`
|
|
|
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
|
|
|
`)}]},_={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
|
`)}]},F={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],quickKey:[{label:"println",content:["println($0)"].join(`
|
|
|
`)}]};var v=b(53184),s=b.n(v),y=(He,lt,Ue)=>new Promise((bt,be)=>{var ye=Fe=>{try{ke(Ue.next(Fe))}catch(Ke){be(Ke)}},le=Fe=>{try{ke(Ue.throw(Fe))}catch(Ke){be(Ke)}},ke=Fe=>Fe.done?bt(Fe.value):Promise.resolve(Fe.value).then(ye,le);ke((Ue=Ue.apply(He,lt)).next())});const f={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},c=(He,lt,Ue,bt)=>{const be=lt.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:Ue.lineNumber,endColumn:Ue.column});return Array.from(new Set(be.match(/\b\w{2,}\b/g)||[])).map(le=>({label:le,kind:He.languages.CompletionItemKind.Text,insertText:le,range:bt}))},l=(He,lt,Ue,bt)=>{He.languages.registerCompletionItemProvider(lt,{provideCompletionItems(be,ye){const le=be.getWordUntilPosition(ye),ke={startLineNumber:ye.lineNumber,endLineNumber:ye.lineNumber,startColumn:le.startColumn,endColumn:le.endColumn},Fe=be.getLineContent(ye.lineNumber).substring(le.startColumn-2,le.endColumn);return{suggestions:[...c(He,be,ye,ke),...Ue.map(re=>({label:re,kind:He.languages.CompletionItemKind.Keyword,documentation:re,insertText:re,insertTextRules:He.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ke})),...bt.map(re=>({label:re.label,kind:He.languages.CompletionItemKind.Snippet,documentation:re.content,insertText:Fe.startsWith("#")?re.content.replace(/#/,""):re.content,insertTextRules:He.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ke}))]}}})};var h=He=>{f.languages.forEach(lt=>{He.languages.registerDocumentFormattingEditProvider(lt,{provideDocumentFormattingEdits(Ue){return y(this,null,function*(){const bt=s()(Ue.getValue(),{indent_size:2,indent_char:" ",max_preserve_newlines:2,preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:0,indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1});return[{range:Ue.getFullModelRange(),text:bt}]})}})}),l(He,"java",D.keywords,D.quickKey),l(He,"cpp",w.keywords,w.quickKey),l(He,"c",K.keywords,[]),l(He,"python",_.keywords,_.quickKey),l(He,"scala",F.keywords,F.quickKey)};const d="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var E=Object.defineProperty,T=(He,lt,Ue)=>lt in He?E(He,lt,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):He[lt]=Ue,L=(He,lt,Ue)=>T(He,typeof lt!="symbol"?lt+"":lt,Ue);const x=class tl{constructor(lt,Ue,bt){this.placeholder=lt,this.editor=Ue,this.monaco=bt,Ue.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return tl.ID}getDomNode(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.style.width="max-content",this.domNode.textContent=this.placeholder,this.domNode.style.fontStyle="initial",this.domNode.style.color="#D7D7D7",this.domNode.style.pointerEvents="none",this.editor.applyFontInfo(this.domNode)),this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[this.monaco.editor.ContentWidgetPositionPreference.EXACT]}}dispose(){this.editor.removeContentWidget(this)}};L(x,"ID","editor.widget.placeholderHint");var O=x,U=b(96236),N=b(6767),$=b(25399),M=b(89392),Z=b(33796),q=b(56102),se=Object.defineProperty,ue=Object.defineProperties,J=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,G=(He,lt,Ue)=>lt in He?se(He,lt,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):He[lt]=Ue,W=(He,lt)=>{for(var Ue in lt||(lt={}))X.call(lt,Ue)&&G(He,Ue,lt[Ue]);if(z)for(var Ue of z(lt))B.call(lt,Ue)&&G(He,Ue,lt[Ue]);return He},k=(He,lt)=>ue(He,J(lt)),C=(He,lt)=>{var Ue={};for(var bt in He)X.call(He,bt)&<.indexOf(bt)<0&&(Ue[bt]=He[bt]);if(He!=null&&z)for(var bt of z(He))lt.indexOf(bt)<0&&B.call(He,bt)&&(Ue[bt]=He[bt]);return Ue},V=(He,lt,Ue)=>new Promise((bt,be)=>{var ye=Fe=>{try{ke(Ue.next(Fe))}catch(Ke){be(Ke)}},le=Fe=>{try{ke(Ue.throw(Fe))}catch(Ke){be(Ke)}},ke=Fe=>Fe.done?bt(Fe.value):Promise.resolve(Fe.value).then(ye,le);ke((Ue=Ue.apply(He,lt)).next())});function ne(He){return/^\d+$/.test(He)?`${He}px`:He}function pe(){}let Ce=!1;const We={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale",solidity:"sol"};function me(He=[]){let lt=He;if(Array.isArray(He)){for(let Ue=0;Ue<He.length;Ue++){let bt=We[He[Ue]];if(bt)return bt}return lt[0]}return We[lt]||lt}let Ne=null;const Be=()=>V(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch(He){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",He)}});var Me=He=>{var lt=He,{width:Ue="100%",height:bt="100%",value:be,language:ye="javascript",style:le={},options:ke={},overrideServices:Fe={},theme:Ke="vs-dark",onEditBlur:re,isCopy:fe=!1,onSave:De,autoHeight:Re=!1,forbidCopy:Oe=!1,onChange:Ye=pe,editorDidMount:at=pe,onFocus:Qe=pe,onBreakPoint:Xe=pe,breakPointValue:Ge=[],filename:ct="educoder.txt",errorLine:ot,errorContent:it="",highlightLine:we,openBreakPoint:rt=!1,placeholder:Ze="",showMiniMap:je=!0}=lt,mt=C(lt,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","isCopy","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint","placeholder","showMiniMap"]);const Et=(0,I.useRef)(),st=(0,I.useRef)({}),Rt=(0,I.useRef)(),Nt=(0,I.useRef)(),nt=(0,I.useRef)([]),Dt=(0,I.useRef)(!1),Se=(0,I.useRef)(),_e=(0,I.useRef)(),ve=(0,I.useRef)(!1),[ee,ie]=(0,I.useState)(!1);function oe(){let tt;return Et.current&&(tt=new P.Z(Ve=>{for(let pt of Ve)(pt.target.offsetHeight>0||pt.target.offsetWidth>0)&&st.current.instance.layout()}),tt.observe(Et.current)),tt}function he(){N.ZP.warning({content:decodeURIComponent(d),key:"monaco-editor-tip"})}const de=()=>{let tt=st.current.instance;if(be!=null&&tt&&ee){const Ve=tt.getModel();Ve&&be!==Ve.getValue()&&(Ce=!0,Ve.setValue(be),tt.layout(),Ce=!1)}};(0,I.useEffect)(()=>{const tt=Z.Z.subscribe("formatDocument",Ve=>{var pt;let Bt=st.current.instance;(pt=Bt==null?void 0:Bt.getAction)==null||pt.call(Bt,"editor.action.formatDocument").run()});return window.updateMonacoValue=Ve=>{Ye(Ve)},tt},[]),(0,I.useEffect)(()=>{var tt;let Ve=st.current.instance;Nt.current&&clearTimeout(Nt.current),Nt.current=setTimeout(()=>{de()},500),be&&(be!=null&&be.length)&&((tt=Ve==null?void 0:Ve.updateOptions)==null||tt.call(Ve,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(be.split(/\r\n|\r|\n/g).length))+3,5)}))},[be,ee,st.current]),(0,I.useEffect)(()=>{if(ot&&st.current&&st.current.instance){let Ve=st.current.instance;Ve.changeViewZones(function(pt){var Bt=document.createElement("div");Bt.style.padding="10px 20px",Bt.style.width="calc(100% - 20px)",Bt.className="my-error-line-wrp",Bt.innerHTML=it,pt.addZone({afterLineNumber:ot||11,heightInLines:3,domNode:Bt})});var tt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ve.addOverlayWidget(tt),Ve.revealPositionInCenter({lineNumber:20,column:1})}},[ot,st.current,ee]);const Je=(tt="",Ve)=>{if(!tt||tt.trim()==="")return!0;const Bt=st.current.instance.getModel().getLineTokens(Ve);let Wt=!1;for(let Xt=0;Xt<2;Xt++)Bt.getStandardTokenType(Xt)===1&&(Wt=!0);return Wt};(0,I.useEffect)(()=>{var tt;const Ve=(tt=st.current)==null?void 0:tt.instance;if(Ve&&ee&&Oe){const pt=Ve.onDidBlurEditorWidget(()=>{ve.current=!1}),Bt=Ve.onDidFocusEditorText(()=>{ve.current=!0});return()=>{pt.dispose(),Bt.dispose()}}},[st.current,ee,Oe]),(0,I.useEffect)(()=>{var tt;if((tt=st.current)!=null&&tt.instance&&ee&&rt){let Ve=st.current.instance,pt=Ve.getModel();if(!pt)return;(()=>{var Gt;let Kt=[],Ft=[];const gi=pt.getAllDecorations();for(let yi of gi)yi.options.className==="highlighted-line"&&(Kt.push((Gt=yi==null?void 0:yi.range)==null?void 0:Gt.startLineNumber),Ft.push(yi==null?void 0:yi.id));if(we===Kt[0])return;pt.deltaDecorations(Ft,[]);const zt=pt.getLineCount();we&&we<=zt&&(Ve.deltaDecorations([],[{range:new Ne.Range(we,1,we,pt.getLineMaxColumn(we)),options:{isWholeLine:!0,className:"highlighted-line"}}]),Ve.revealLineInCenter(we))})();const Wt=(Gt=!1)=>{var Kt;let Ft=[],gi=[];const zt=pt.getAllDecorations();for(let yi of zt)yi.options.linesDecorationsClassName==="breakpoints-select"&&(Ft.push((Kt=yi==null?void 0:yi.range)==null?void 0:Kt.startLineNumber),gi.push(yi==null?void 0:yi.id));if(Gt)return{lines:Ft,ids:gi};Xe(Ft)},Xt=Gt=>V(void 0,null,function*(){let Kt={range:new Ne.Range(Gt,1,Gt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield pt.deltaDecorations([],[Kt]),Wt()}),bi=Gt=>V(void 0,null,function*(){let Kt=[];const Ft=Ve.getLineDecorations(Gt);for(let gi of Ft)gi.options.linesDecorationsClassName==="breakpoints-select"&&Kt.push(gi.id);yield pt.deltaDecorations(Kt,[]),Wt()}),vi=Gt=>{let Kt=Ve.getLineDecorations(Gt);for(let Ft of Kt)if(Ft.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,M.isEqual)(Ge,Wt(!0).lines)){pt.deltaDecorations(Wt(!0).ids,[]);const Gt=Ge.map(Kt=>({range:new Ne.Range(Kt,1,Kt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));pt.deltaDecorations([],Gt)}const ii=Ve.onDidChangeModelContent(Gt=>{let Kt=Ve.getPosition();if(Kt){let Ft=Kt.lineNumber;clearTimeout(_e.current),_e.current=setTimeout(()=>{Je(pt.getLineContent(Ft),Ft)?bi(Ft):vi(Ft)?(bi(Ft),Xt(Ft)):Wt()},100)}}),Ei=Ve.onMouseDown(Gt=>{var Kt,Ft,gi;if(Gt.target.detail&&((gi=(Ft=(Kt=Gt.target)==null?void 0:Kt.element)==null?void 0:Ft.className)!=null&&gi.includes("line-numbers"))){let zt=Gt.target.position.lineNumber;if(Je(pt.getLineContent(zt),zt))return;vi(zt)?bi(zt):Xt(zt)}}),jt=Gt=>{let Kt={range:new Ne.Range(Gt,1,Gt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};nt.current=Ve.deltaDecorations(nt.current,[Kt])},Si=()=>{nt.current=Ve.deltaDecorations(nt.current,[])},ri=Ve.onMouseMove(Gt=>{var Kt,Ft,gi;if(Si(),Gt.target.detail&&((gi=(Ft=(Kt=Gt.target)==null?void 0:Kt.element)==null?void 0:Ft.className)!=null&&gi.includes("line-numbers"))){let zt=Gt.target.position.lineNumber;if(Je(pt.getLineContent(zt),zt))return;jt(zt)}}),br=Ve.onMouseLeave(()=>{Si()});return()=>{ii.dispose(),Ei.dispose(),ri.dispose(),br.dispose()}}},[st.current,ee,Ge,we,rt,ye]),(0,I.useEffect)(()=>{var tt;(tt=st.current)!=null&&tt.instance&&rt&&st.current.instance.setPosition({lineNumber:0,column:0})},[we]);function et(){let tt=st.current.instance;if(tt){const Ve=tt.getSelection(),pt=st.current.pastePos||{},Bt=new Ne.Range(pt.startLineNumber||Ve.endLineNumber,pt.startColumn||Ve.endColumn,pt.endLineNumber||Ve.endLineNumber,pt.endColumn||Ve.endColumn);setTimeout(()=>{tt.executeEdits("",[{range:Bt,text:""}])},300)}}function ht(tt){(window.navigator.platform.match("Mac")?tt.metaKey:tt.ctrlKey)&&tt.keyCode==83&&(tt.preventDefault(),De())}const gt=()=>{if(Re&&st.current.instance){const tt=st.current.instance.getContentHeight();Qt(tt<bt?bt:tt)}else Qt(bt)};function Ot(tt){var Ve=document.createEvent("MouseEvents");Ve.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),tt.dispatchEvent(Ve)}const qt=tt=>{if(!ve.current)return;const{keyCode:Ve,ctrlKey:pt,metaKey:Bt,target:Wt,type:Xt}=tt;return(Xt==="paste"||(Ve===67||Ve===86)&&(Bt||pt))&&Wt.nodeName==="TEXTAREA"&&(he(),tt.preventDefault()),!1};function Ut(tt,Ve){var pt=window.URL||window.webkitURL||window,Bt=new Blob([Ve]),Wt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Wt.href=pt.createObjectURL(Bt),Wt.download=tt,Ot(Wt)}(0,I.useEffect)(()=>{gt()},[gt]),(0,I.useEffect)(()=>{Et.current&&!ee&&Promise.all([b.e(8909),b.e(5028)]).then(b.bind(b,71448)).then(tt=>{try{Ne=tt,st.current.instance=Ne.editor.create(Et.current,{value:be,language:me(ye),theme:Ke,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:je||!1}},Fe);const Ve=st.current.instance;let Wt=[...U.BH._menuItems].find(ii=>ii[0]._debugName=="EditorContext")[1],Xt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],bi=(ii,Ei)=>{var jt,Si;let ri=ii._first;do Ei.includes((Si=(jt=ri.element)==null?void 0:jt.command)==null?void 0:Si.id)&&ii._remove(ri);while(ri=ri.next)};if(at(Ve,Ne),setTimeout(()=>{gt(),st.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{Ut(ct||"educoder.txt",Ve.getValue())}})},500),st.current.subscription=Ve.onDidChangeModelContent(ii=>{Dt.current?clearTimeout(Se.current):(gt(),Ye(Ve.getValue(),ii)),Se.current=setTimeout(()=>{Dt.current=!1},500)}),window.Monaco||h(Ne,me(ye)),Oe&&(bi(Wt,Xt),Et.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",qt),window.removeEventListener("paste",qt),window.addEventListener("keydown",qt),window.addEventListener("paste",qt)),window.Monaco=Ne,re&&Ve.onDidBlurEditorWidget(()=>{re(Ve.getValue())}),Qe&&Ve.onDidFocusEditorText(()=>{Oe&&Be(),Qe(Ve.getValue())}),Oe){Be();try{Ve.onDidPaste(ii=>{const Ei=Ve.getSelection(),jt=st.current.pastePos||{},Si=new Ne.Range(jt.startLineNumber||Ei.endLineNumber,jt.startColumn||Ei.endColumn,jt.endLineNumber||Ei.endLineNumber,jt.endColumn||Ei.endColumn);Ve.executeEdits("",[{range:ii.range,text:""}])})}catch(ii){}}let vi=oe();return Ze&&typeof Ze=="string"&&new O(Ze,Ve,Ne),ie(!0),()=>{const ii=st.current.instance;ii.dispose();const Ei=ii.getModel();Ei&&Ei.dispose(),st.current.subscription&&st.current.subscription.dispose(),vi.unobserve(Et.current)}}catch(Ve){}})},[]),(0,I.useEffect)(()=>{if(st.current.instance&&ee)return document.addEventListener("keydown",ht,!1),()=>{document.removeEventListener("keydown",ht)}},[De,ee]),(0,I.useEffect)(()=>{let tt=st.current.instance;if(tt&&ee){let Ve=me(ye);Ne.editor.setModelLanguage(tt.getModel(),Ve)}},[ye,ee]),(0,I.useEffect)(()=>{st.current.instance&&ee&&Ne.editor.setTheme(Ke)},[Ke,ee]),(0,I.useEffect)(()=>{let tt=st.current.instance;Rt.current=ke,tt&&ee&&(tt.updateOptions(W({},ke)),setTimeout(()=>{tt.getModel().updateOptions(W({},ke))},200))},[JSON.stringify(ke),ee]),(0,I.useEffect)(()=>{let tt=st.current.instance;tt&&ee&&tt.layout()},[Ue,bt,ee]);const[Lt,oi]=(0,I.useState)(ne(Ue)),[fi,Qt]=(0,I.useState)(ne(bt)),si=k(W({},le),{width:Lt,height:fi,position:"relative"});return I.createElement("div",{className:"my-monaco-editor",ref:Et,style:si},fe&&I.createElement(q.CopyToClipboard,{text:be,onCopy:()=>N.ZP.success("\u590D\u5236\u6210\u529F")},I.createElement($.Z,{title:"\u590D\u5236\u4EE3\u7801"},I.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},I.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function wt({width:He="100%",height:lt="100%",original:Ue,modified:bt,language:be,options:ye={}}){const le=(0,I.useRef)(),[ke,Fe]=(0,I.useState)(null);function Ke(Re){let Oe;return le.current&&(Oe=new P.Z(Ye=>{for(let at of Ye)(at.target.offsetHeight>0||at.target.offsetWidth>0)&&Re.layout()}),Oe.observe(le.current)),Oe}(0,I.useEffect)(()=>(le.current&&Promise.all([b.e(8909),b.e(9404)]).then(b.bind(b,2550)).then(Re=>{Ne=Re;const Oe=Ne.editor.createDiffEditor(le.current,k(W({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},ye),{wordWrap:!0}));Fe(Oe);let Ye=Ke(Oe);return()=>{Oe.dispose();const at=Oe.getModel();at&&at.dispose(),Ye.unobserve(le.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,I.useEffect)(()=>{ke&&ke.setModel({original:Ne.editor.createModel(Ue,be),modified:Ne.editor.createModel(bt,be)})},[Ue,bt,be,ke]);const re=ne(He),fe=ne(lt),De={width:re,height:fe};return I.createElement("div",{className:"my-diff-editor",ref:le,style:De})}},12889:function(yt,ge,b){"use strict";b.r(ge),b.d(ge,{default:function(){return l}});var I=b(59301),P=b(12085),K=b(90524),D=b(76560),w=b(29787),_=b(59205),F=b(40148),v=b(51124),s=b(24334),y=b(57309),f=b.n(y),c=(h,d,E)=>new Promise((T,L)=>{var x=U=>{try{O(E.next(U))}catch(N){L(N)}},A=U=>{try{O(E.throw(U))}catch(N){L(N)}},O=U=>U.done?T(U.value):Promise.resolve(U.value).then(x,A);O((E=E.apply(h,d)).next())}),l=()=>{const{submitId:h,id:d}=(0,D.useParams)(),[E,T]=(0,I.useState)(void 0);console.log((0,D.useLocation)(),33);const L=(0,D.useLocation)();function x(){var V;D.history.push(`/problems/${d}/oj/${(V=L==null?void 0:L.query)==null?void 0:V.backId}?tab=1`)}(0,I.useEffect)(()=>((0,D.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!1}),(0,D.getDvaApp)()._store.dispatch({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),()=>{(0,D.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!0}),(0,D.getDvaApp)()._store.dispatch({type:"globalSetting/onlyShowBackTopToggle",payload:!1})}),[]),(0,I.useEffect)(()=>{document.title="\u5728\u7EBF\u5237\u9898"}),(0,I.useEffect)(()=>{h&&function(){return c(this,null,function*(){const ne=yield(0,_.X6)(h);T(ne.data)})}()},[h]);const{status:A,created_at:O,code:U,name:N,language:$,pass_sets_count:M,set_count:Z,error_msg:q,output:se,input:ue,expected_output:J,execute_memory:z,user:X,execute_time:B,input_file_url:G,output_file_url:W,is_file:k,expected_output_file_url:C}=E||{};return I.createElement(w.Z,{spinning:!E,delay:500},I.createElement("div",{className:"record-detail-info"},E?I.createElement(I.Fragment,null,I.createElement("header",{className:P.Z.header},I.createElement("div",null,I.createElement("img",{src:`${K.Z.IMG_SERVER}/images/${X.image_url}`,alt:"user",width:30}),I.createElement("span",null,X.name)),I.createElement("h2",null," ",N," "),I.createElement("button",{className:"ant-btn",onClick:x,style:{border:"1px solid #bacffe",color:"#3061d0"}},"\u8FD4\u56DE\u8BE5\u9898")),I.createElement("div",{className:"record-detail-body"},I.createElement("h2",null," \u63D0\u4EA4\u8BB0\u5F55 "),I.createElement("ul",{className:"record-info"},I.createElement("li",null," \u72B6\u6001\uFF1A",I.createElement("span",{className:A===0?"c-green":"c-red"},F.Im[A])," "),I.createElement("li",null," \u63D0\u4EA4\u65F6\u95F4\uFF1A",I.createElement("span",null,f()(O).format("YYYY-MM-DD HH:mm:ss"))," "),I.createElement("li",null," \u8BED\u8A00\uFF1A",I.createElement("span",null,$)," "),I.createElement("li",null," \u6267\u884C\u7528\u65F6\uFF1A",I.createElement("span",null,B*1e3,"ms")," "),I.createElement("li",null," ",`${M} / ${Z} \u4E2A\u901A\u8FC7\u7684\u6D4B\u8BD5\u7528\u4F8B`," ")),(0,F.gZ)({status:A,error_msg:q,execute_time:B,output:se,input:ue,expected_output:J,input_file_url:G,output_file_url:W,is_file:k,expected_output_file_url:C}),I.createElement("h2",null," \u63D0\u4EA4\u7684\u5185\u5BB9 "),I.createElement(v.ZP,{height:"200px",width:"100%",language:$==null?void 0:$.toLocaleLowerCase(),value:s.Base64.decode(U),options:{readOnly:!0}}))):null))}},40148:function(yt,ge,b){"use strict";b.d(ge,{Im:function(){return q},ZP:function(){return B},gZ:function(){return z}});var I=b(59301),P=b(37568),K=b(99571),D=b(84105),w=b(87395),_=b(49162),F=b(24334),v=b(766),s=b(38394),y=b(49661),f=b(46685),c=b(34376),l=b(92310),h=b.n(l),d=b(59301),E=Object.defineProperty,T=Object.defineProperties,L=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,U=(G,W,k)=>W in G?E(G,W,{enumerable:!0,configurable:!0,writable:!0,value:k}):G[W]=k,N=(G,W)=>{for(var k in W||(W={}))A.call(W,k)&&U(G,k,W[k]);if(x)for(var k of x(W))O.call(W,k)&&U(G,k,W[k]);return G},$=(G,W)=>T(G,L(W));const{TextArea:M}=P.default,Z={visible:!1,tabIndex:"0"},q={[_.h.HIDE_COMPILE_STATUS]:"\u6682\u4E0D\u652F\u6301\u67E5\u770B",[_.h.NOMATCH]:"\u6D4B\u8BD5\u7528\u4F8B\u7ED3\u679C\u4E0D\u5339\u914D",[_.h.OK]:"\u8C03\u8BD5\u901A\u8FC7",2:"\u8C03\u8BD5\u8D85\u65F6",3:"\u8C03\u8BD5pod\u5931\u8D25",4:"\u7F16\u8BD1\u5931\u8D25",5:"\u6267\u884C\u5931\u8D25"};var se=(G=>(G[G.SET_VISIBLE=0]="SET_VISIBLE",G[G.SET_TABINDEX=1]="SET_TABINDEX",G))(se||{});function ue(G,W){switch(W.type){case 0:return $(N({},G),{visible:W.payload});case 1:return $(N({},G),{tabIndex:W.payload});default:throw new Error}}function J({value:G,className:W}){const[k,C]=(0,I.useState)(!1),V=(0,I.useRef)(),ne=(0,I.useRef)();return(0,I.useEffect)(()=>{k&&(ne.current.reset(),ne.current.write((0,y.pp)(G||"")))},[G,k]),(0,I.useEffect)(()=>{var pe,Ce,We,me;if(V.current){ne.current=new c.Terminal({fontSize:14,disableStdin:!0}),ne.current.open(V.current);const Ne=V.current.offsetWidth-14,Be=((me=(We=(Ce=(pe=ne.current)==null?void 0:pe._core)==null?void 0:Ce._renderService)==null?void 0:We.dimensions)==null?void 0:me.actualCellWidth)||9.5,Me=Math.ceil(Ne/Be);ne.current.resize(Me,8),C(!0)}},[]),d.createElement("div",{ref:V,className:h()("XtermText-valueRef",W)})}function z(G){const{status:W,error_msg:k,output:C,input:V,expected_output:ne,is_file:pe,input_file_url:Ce,output_file_url:We,expected_output_file_url:me}=G;let Ne=null;const Be={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch(W){case _.h.NOMATCH:Ne=d.createElement(d.Fragment,null,d.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),!pe&&d.createElement(J,{className:"mb10",value:V}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(Ce,V)},V)),d.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),!pe&&d.createElement(J,{className:"mb10",value:C&&F.Base64.decode(C)||""}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(We,C)},C)),d.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),!pe&&d.createElement(J,{className:"mb10",value:ne&&F.Base64.decode(ne)||""}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(me,ne)},ne)));break;case _.h.EXECUTEFAILURE:Ne=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!pe&&d.createElement(s.Z,{value:V,style:Be}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(Ce,V)},V)),d.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),d.createElement("pre",{className:"error"},F.Base64.decode(k)));break;case _.h.COMPILEFAILURE:Ne=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!pe&&d.createElement(s.Z,{value:V,style:Be}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(Ce,V)},V)),d.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),d.createElement("pre",{className:"error"},F.Base64.decode(k)));break;case _.h.PODFAILURE:Ne=d.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case _.h.TIMEOUT:Ne=d.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return d.createElement(d.Fragment,null," ",Ne," ")}function X(G){const{status:W,error_msg:k,execute_time:C,output:V,input:ne,expected_output:pe,is_file:Ce,input_file_url:We,output_file_url:me,expected_output_file_url:Ne}=G;let Be=null;switch(W){case _.h.OK:Be=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6267\u884C\u7528\u65F6\uFF1A",C,"\u79D2"),d.createElement("p",null,"\u6267\u884C\u7ED3\u679C\uFF1A"),d.createElement("pre",null,F.Base64.decode(V)));break;case _.h.NOMATCH:Be=d.createElement(d.Fragment,null,d.createElement("p",null,"\u8F93\u5165\uFF1A",d.createElement("pre",null,ne)),d.createElement("p",null,"\u8F93\u51FA\uFF1A",V&&F.Base64.decode(V)),d.createElement("p",null,"\u9884\u671F\u8F93\u51FA\uFF1A",pe&&F.Base64.decode(pe)));break;case _.h.EXECUTEFAILURE:Be=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",d.createElement("pre",null,ne)),d.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),d.createElement("pre",{className:"error"},F.Base64.decode(k)));break;case _.h.COMPILEFAILURE:Be=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",d.createElement("pre",null,ne)),d.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),d.createElement("pre",{className:"error"},F.Base64.decode(k)));break;case _.h.PODFAILURE:Be=d.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case _.h.TIMEOUT:Be=d.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return d.createElement(d.Fragment,null," ",Be," ")}var B=({id:G,is_file:W,input:k,debuging:C,submitting:V,executingMessage:ne,debugResult:pe,onChangeInput:Ce,onDebugCode:We,onSubmitCode:me})=>{const[Ne,Be]=(0,I.useReducer)(ue,Z),{visible:Me,tabIndex:wt}=Ne;(0,I.useEffect)(()=>{Be({type:0,payload:!1})},[G]);function He(be){let ye=be.target.id;Be({type:1,payload:ye})}function lt(){Be({type:0,payload:!Me})}const Ue=(0,I.useMemo)(()=>{if(pe){const{status:be}=pe;return d.createElement(d.Fragment,null,X(pe))}return null},[pe]);function bt(){Be({type:0,payload:!0}),Be({type:1,payload:"1"}),We()}return d.createElement("div",{className:"test-case-panel"},d.createElement("div",{className:`test-case-panel-body ${Me?"active":""}`},d.createElement("ul",{className:"s-navs"},d.createElement("li",null,d.createElement("a",{className:"active"},"\u8C03\u8BD5\u4EE3\u7801\u7ED3\u679C"))),d.createElement(f.Z,{leftTitle:"\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B",rightTitle:"\u4EE3\u7801\u6267\u884C\u7ED3\u679C",style:{height:240},leftNode:d.createElement(M,{placeholder:"\u8BF7\u8F93\u5165\u81EA\u6D4B\u7528\u4F8B\uFF08\u5982\u679C\u672A\u586B\u5199\uFF0C\u9996\u6B21\u81EA\u6D4B\u8FD0\u884C\u65F6\uFF0C\u7CFB\u7EDF\u4F1A\u81EA\u52A8\u586B\u5145\u7B2C\u4E00\u4E2A\u975E\u9690\u85CF\u7684\u6587\u672C\u7C7B\u578B\u7684\u6D4B\u8BD5\u7528\u4F8B\uFF09",value:W?"":k,onChange:Ce}),rightNode:C?d.createElement(v.Z,{message:"\u4EE3\u7801\u6267\u884C\u4E2D..."}):pe?Ue:d.createElement("p",{style:{color:"#536879"}},"\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D")})),d.createElement("a",{className:`btn-collapse ${Me?"up":""}`,onClick:lt},Me?d.createElement(D.Z,null):d.createElement(w.Z,null)),d.createElement("footer",{className:"footer"},d.createElement("span",{style:{visibility:"hidden"}},"\u63A7\u5236\u53F0"),d.createElement("div",{className:"flex-container"},d.createElement(K.ZP,{id:"oj-prev",className:"btn-blue",type:"ghost"},"\u4E0A\u4E00\u9898"),d.createElement(K.ZP,{id:"oj-next",className:"btn-blue",type:"ghost"},"\u4E0B\u4E00\u9898"),d.createElement(K.ZP,{className:"btn-green",type:"ghost",loading:C,onClick:bt},"\u8C03\u8BD5\u4EE3\u7801"),d.createElement(K.ZP,{type:"primary",className:"custom-ant-disabled",loading:V,disabled:V,onClick:()=>{Be({type:0,payload:!1}),me()}},"\u8BC4\u6D4B\u5E76\u63D0\u4EA4"))))}},49162:function(yt,ge,b){"use strict";b.d(ge,{h:function(){return I}});var I=(P=>(P[P.NOMATCH=-1]="NOMATCH",P[P.OK=0]="OK",P[P.TIMEOUT=2]="TIMEOUT",P[P.PODFAILURE=3]="PODFAILURE",P[P.COMPILEFAILURE=4]="COMPILEFAILURE",P[P.EXECUTEFAILURE=5]="EXECUTEFAILURE",P[P.HIDE_COMPILE_STATUS=11]="HIDE_COMPILE_STATUS",P))(I||{})},59205:function(yt,ge,b){"use strict";b.d(ge,{H7:function(){return s},KC:function(){return h},M3:function(){return L},MK:function(){return v},MU:function(){return D},Rg:function(){return O},WH:function(){return d},X6:function(){return _},bM:function(){return K},bx:function(){return E},dd:function(){return c},de:function(){return N},fi:function(){return y},fu:function(){return P},gu:function(){return T},n4:function(){return f},qe:function(){return A},rL:function(){return U},rX:function(){return F},uc:function(){return $},vl:function(){return l},wO:function(){return x},zO:function(){return w}});var I=b(82093);function P(M){return(0,I.U2)(`mypractices/${M}.json`,{hidePopLogin:!0})}function K(M,Z){return(0,I.v_)(`mypractices/${M}/code_submit.json`,Z)}function D(M,Z){return(0,I.v_)(`mypractices/${M}/code_debug.json`,Z)}function w(M,Z){return Z.language&&(Z.language=encodeURIComponent(Z.language)),(0,I.U2)(`mypractices/${M}/submit_records.json`,Z)}function _(M){return(0,I.U2)("mypractices/record_detail.json",{id:M})}function F(M,Z){return(0,I.U2)(`mypractices/${M}/result.json`,{mode:Z})}function v(M,Z){return(0,I.v_)(`mypractices/${M}/add_notes.json`,Z)}function s(M,Z){return(0,I.v_)(`mypractices/${M}/restore_initial_code.json`,Z)}function y(M,Z){return(0,I.v_)(`mypractices/${M}/sync_code.json`,Z)}function f(M,Z){return(0,I.v_)(`mypractices/${M}/update_code.json`,Z)}function c(M){return(0,I.v_)(`mypractices/${M}/initial_codes.json`)}function l(M,Z){return(0,I.v_)(`discusses/${M}/plus.json`,Z)}function h(M){return(0,I.U2)("practices/practices_list.json",M)}function d(M,Z){return(0,I.U2)(`practices/${M}/question_solution_articles`,Z)}function E(M,Z){return(0,I.v_)(`practices/${M}/question_solution_articles`,Z)}function T(M,Z){return(0,I.gz)(`practices/${M}/question_solution_articles/${Z==null?void 0:Z.active}`,Z)}function L(M,Z){return(0,I.U2)(`practices/${M}/question_solution_articles/${Z==null?void 0:Z.active}/edit`,Z)}function x(M,Z){return(0,I.U2)(`practices/${M}/question_solution_articles/${Z==null?void 0:Z.active}`,Z)}function A(M,Z){return(0,I.v_)(`practices/${M}/question_solution_articles/${Z==null?void 0:Z.active}/set_authority_or_excellent`,Z)}function O(M,Z){return(0,I.v_)(`practices/${M}/question_solution_articles/${Z==null?void 0:Z.active}/praise_or_treads`,Z)}function U(M,Z){return(0,I.v_)(`practices/${M}/question_solution_articles/${Z==null?void 0:Z.active}/hide`)}function N(M,Z){return(0,I.IV)(`practices/${M}/question_solution_articles/${Z==null?void 0:Z.active}`,Z)}function $(M,Z){return(0,I.v_)(`mypractices/${M}/update_practice_time_sum`,Z)}},90290:function(yt,ge,b){"use strict";b.d(ge,{AL:function(){return O},Iy:function(){return f},Qv:function(){return h},ez:function(){return A},jb:function(){return c}});var I=b(32834),P=b.n(I),K=b(11690),D=b.n(K);let w=1;function _(Z,q){const se=Z.match(/^(\s+)(?:```)/);if(se===null)return q;const ue=se[1];return q.split(`
|
|
|
`).map(J=>{const z=J.match(/^\s+/);if(z===null)return J;const[X]=z;return X.length>=ue.length?J.slice(ue.length):J}).join(`
|
|
|
`)}let F=[],v=["<ul>"];const s=new(P()).Renderer,y=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function f(){F.length=0,v=["<ul>"]}const c={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(Z,q,se,ue){if(q>=Z.length||Z[q].level<=se)return q;var J=Z[q];ue.push("<li><a href='#"+w+J.anchor+"'>"+J.text+"</a>"),q++;var z=[];return q=l(Z,q,J.level,z),z.length>0&&(ue.push("<ul>"),z.forEach(function(X){ue.push(X)}),ue.push("</ul>")),ue.push("</li>"),q=l(Z,q,se,ue),q}function h(){return l(F,0,0,v),v.push("</ul>"),v.join("")}const d={heading(Z){const q=y.exec(Z);if(w+=1,q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},fences(Z){const q=this.rules.block.fences.exec(Z);if(q){const se=q[0];let ue=_(se,q[3]||"");const J=q[2]?q[2].trim():q[2];if(["latex","katex","math"].indexOf(J)>=0){const z=L(),X=ue;ue=z,x[z]={type:"block",expression:X}}return{type:"code",raw:se,lang:J,text:ue}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let T=0;const L=()=>`__special_katext_id_${T++}__`;let x={};function A(){return x}function O(){T=0,x={}}function U(Z){return Z=Z.replace(E,(q,se)=>{const ue=L();return x[ue]={type:"inline",expression:se},ue}),Z}const N=s.listitem;s.listitem=function(Z){return N(U(Z))};const $=s.paragraph;s.paragraph=function(Z){return $(U(Z))};const M=s.tablecell;s.tablecell=function(Z,q){return M(U(Z),q)},s.code=function(Z,q,se){const ue=(q||"").match(/\S*/)[0];return ue?["latex","katex","math"].indexOf(ue)>=0?`<p class='editormd-tex'>${Z}</p>`:`<pre class="prettyprint linenums"><code class="language-${q}">${se?Z:(0,K.escape)(Z,!0)}</code></pre>
|
|
|
`:'<pre class="prettyprint linenums"><code>'+(se?Z:(0,K.escape)(Z,!0))+"</code></pre>"},s.heading=function(Z,q,se){let ue=this.options.headerPrefix+se.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return F.push({anchor:ue,level:q,text:Z}),"<h"+q+' id="'+w+ue+'">'+Z+"</h"+q+">"},P().setOptions({silent:!0,gfm:!0,pedantic:!1}),P().use({tokenizer:d,renderer:s}),ge.ZP=P()},64018:function(){var yt,ge,b,I=!1,P,K;window.PR_SHOULD_USE_CONTINUATION=!0;var D,w;(function(){var _=window,F=["break,continue,do,else,for,if,return,while"],v=[F,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],s=[v,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],y=[s,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],f=[s,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],c=[s,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],l="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",h=[s,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",E=[F,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],T=[F,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],L=[F,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],x=[y,c,f,h,d,E,T,L],A=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,O="str",U="kwd",N="com",$="typ",M="lit",Z="pun",q="pln",se="tag",ue="dec",J="src",z="atn",X="atv",B="nocode",G="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function W(ye){for(var le=0,ke=!1,Fe=!1,Ke=0,re=ye.length;Ke<re;++Ke){var fe=ye[Ke];if(fe.ignoreCase)Fe=!0;else if(/[a-z]/i.test(fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){ke=!0,Fe=!1;break}}var De={b:8,t:9,n:10,v:11,f:12,r:13};function Re(Xe){var Ge=Xe.charCodeAt(0);if(Ge!==92)return Ge;var ct=Xe.charAt(1);return Ge=De[ct],Ge||("0"<=ct&&ct<="7"?parseInt(Xe.substring(1),8):ct==="u"||ct==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function Oe(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var Ge=String.fromCharCode(Xe);return Ge==="\\"||Ge==="-"||Ge==="]"||Ge==="^"?"\\"+Ge:Ge}function Ye(Xe){var Ge=Xe.substring(1,Xe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),ct=[],ot=Ge[0]==="^",it=["["];ot&&it.push("^");for(var we=ot?1:0,rt=Ge.length;we<rt;++we){var Ze=Ge[we];if(/\\[bdsw]/i.test(Ze))it.push(Ze);else{var je=Re(Ze),mt;we+2<rt&&Ge[we+1]==="-"?(mt=Re(Ge[we+2]),we+=2):mt=je,ct.push([je,mt]),mt<65||je>122||(mt<65||je>90||ct.push([Math.max(65,je)|32,Math.min(mt,90)|32]),mt<97||je>122||ct.push([Math.max(97,je)&-33,Math.min(mt,122)&-33]))}}ct.sort(function(Nt,nt){return Nt[0]-nt[0]||nt[1]-Nt[1]});for(var Et=[],st=[],we=0;we<ct.length;++we){var Rt=ct[we];Rt[0]<=st[1]+1?st[1]=Math.max(st[1],Rt[1]):Et.push(st=Rt)}for(var we=0;we<Et.length;++we){var Rt=Et[we];it.push(Oe(Rt[0])),Rt[1]>Rt[0]&&(Rt[1]+1>Rt[0]&&it.push("-"),it.push(Oe(Rt[1])))}return it.push("]"),it.join("")}function at(Xe){for(var Ge=Xe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),ct=Ge.length,ot=[],it=0,we=0;it<ct;++it){var rt=Ge[it];if(rt==="(")++we;else if(rt.charAt(0)==="\\"){var Ze=+rt.substring(1);Ze&&(Ze<=we?ot[Ze]=-1:Ge[it]=Oe(Ze))}}for(var it=1;it<ot.length;++it)ot[it]===-1&&(ot[it]=++le);for(var it=0,we=0;it<ct;++it){var rt=Ge[it];if(rt==="(")++we,ot[we]||(Ge[it]="(?:");else if(rt.charAt(0)==="\\"){var Ze=+rt.substring(1);Ze&&Ze<=we&&(Ge[it]="\\"+ot[Ze])}}for(var it=0;it<ct;++it)Ge[it]==="^"&&Ge[it+1]!=="^"&&(Ge[it]="");if(Xe.ignoreCase&&ke)for(var it=0;it<ct;++it){var rt=Ge[it],je=rt.charAt(0);rt.length>=2&&je==="["?Ge[it]=Ye(rt):je!=="\\"&&(Ge[it]=rt.replace(/[a-zA-Z]/g,function(st){var Rt=st.charCodeAt(0);return"["+String.fromCharCode(Rt&-33,Rt|32)+"]"}))}return Ge.join("")}for(var Qe=[],Ke=0,re=ye.length;Ke<re;++Ke){var fe=ye[Ke];if(fe.global||fe.multiline)throw new Error(""+fe);Qe.push("(?:"+at(fe)+")")}return new RegExp(Qe.join("|"),Fe?"gi":"g")}function k(ye,le){var ke=/(?:^|\s)nocode(?:\s|$)/,Fe=[],Ke=0,re=[],fe=0;function De(Re){var Oe=Re.nodeType;if(Oe==1){if(ke.test(Re.className))return;for(var Ye=Re.firstChild;Ye;Ye=Ye.nextSibling)De(Ye);var at=Re.nodeName.toLowerCase();(at==="br"||at==="li")&&(Fe[fe]=`
|
|
|
`,re[fe<<1]=Ke++,re[fe++<<1|1]=Re)}else if(Oe==3||Oe==4){var Qe=Re.nodeValue;Qe.length&&(le?Qe=Qe.replace(/\r\n?/g,`
|
|
|
`):Qe=Qe.replace(/[ \t\r\n]+/g," "),Fe[fe]=Qe,re[fe<<1]=Ke,Ke+=Qe.length,re[fe++<<1|1]=Re)}}return De(ye),{sourceCode:Fe.join("").replace(/\n$/,""),spans:re}}function C(ye,le,ke,Fe,Ke){if(ke){var re={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:ke,spans:null,basePos:le,decorations:null};Fe(re),Ke.push.apply(Ke,re.decorations)}}var V=/\S/;function ne(ye){for(var le=void 0,ke=ye.firstChild;ke;ke=ke.nextSibling){var Fe=ke.nodeType;le=Fe===1?le?ye:ke:Fe===3&&V.test(ke.nodeValue)?ye:le}return le===ye?void 0:le}function pe(ye,le){var ke={},Fe;(function(){for(var fe=ye.concat(le),De=[],Re={},Oe=0,Ye=fe.length;Oe<Ye;++Oe){var at=fe[Oe],Qe=at[3];if(Qe)for(var Xe=Qe.length;--Xe>=0;)ke[Qe.charAt(Xe)]=at;var Ge=at[1],ct=""+Ge;Re.hasOwnProperty(ct)||(De.push(Ge),Re[ct]=null)}De.push(/[\0-\uffff]/),Fe=W(De)})();var Ke=le.length,re=function(fe){for(var De=fe.sourceCode,Re=fe.basePos,Oe=fe.sourceNode,Ye=[Re,q],at=0,Qe=De.match(Fe)||[],Xe={},Ge=0,ct=Qe.length;Ge<ct;++Ge){var ot=Qe[Ge],it=Xe[ot],we=void 0,rt;if(typeof it=="string")rt=!1;else{var Ze=ke[ot.charAt(0)];if(Ze)we=ot.match(Ze[1]),it=Ze[0];else{for(var je=0;je<Ke;++je)if(Ze=le[je],we=ot.match(Ze[1]),we){it=Ze[0];break}we||(it=q)}rt=it.length>=5&&it.substring(0,5)==="lang-",rt&&!(we&&typeof we[1]=="string")&&(rt=!1,it=J),rt||(Xe[ot]=it)}var mt=at;if(at+=ot.length,!rt)Ye.push(Re+mt,it);else{var Et=we[1],st=ot.indexOf(Et),Rt=st+Et.length;we[2]&&(Rt=ot.length-we[2].length,st=Rt-Et.length);var Nt=it.substring(5);C(Oe,Re+mt,ot.substring(0,st),re,Ye),C(Oe,Re+mt+st,Et,wt(Nt,Et),Ye),C(Oe,Re+mt+Rt,ot.substring(Rt),re,Ye)}}fe.decorations=Ye};return re}function Ce(ye){var le=[],ke=[];ye.tripleQuotedStrings?le.push([O,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?le.push([O,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):le.push([O,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&ke.push([O,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Fe=ye.hashComments;Fe&&(ye.cStyleComments?(Fe>1?le.push([N,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):le.push([N,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ke.push([O,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):le.push([N,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(ke.push([N,/^\/\/[^\r\n]*/,null]),ke.push([N,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ke=ye.regexLiterals;if(Ke){var re=Ke>1?"":`
|
|
|
\r`,fe=re?".":"[\\S\\s]",De="/(?=[^/*"+re+"])(?:[^/\\x5B\\x5C"+re+"]|\\x5C"+fe+"|\\x5B(?:[^\\x5C\\x5D"+re+"]|\\x5C"+fe+")*(?:\\x5D|$))+/";ke.push(["lang-regex",RegExp("^"+G+"("+De+")")])}var Re=ye.types;Re&&ke.push([$,Re]);var Oe=(""+ye.keywords).replace(/^ | $/g,"");Oe.length&&ke.push([U,new RegExp("^(?:"+Oe.replace(/[\s,]+/g,"|")+")\\b"),null]),le.push([q,/^\s+/,null,` \r
|
|
|
\xA0`]);var Ye="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(Ye+="(?!s*/)"),ke.push([M,/^@[a-z_$][a-z_$@0-9]*/i,null],[$,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[q,/^[a-z_$][a-z_$@0-9]*/i,null],[M,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[q,/^\\[\s\S]?/,null],[Z,new RegExp(Ye),null]),pe(le,ke)}var We=Ce({keywords:x,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function me(ye,le,ke){for(var Fe=/(?:^|\s)nocode(?:\s|$)/,Ke=/\r\n?|\n/,re=ye.ownerDocument,fe=re.createElement("li");ye.firstChild;)fe.appendChild(ye.firstChild);var De=[fe];function Re(Ge){var ct=Ge.nodeType;if(ct==1&&!Fe.test(Ge.className))if(Ge.nodeName==="br")Oe(Ge),Ge.parentNode&&Ge.parentNode.removeChild(Ge);else for(var ot=Ge.firstChild;ot;ot=ot.nextSibling)Re(ot);else if((ct==3||ct==4)&&ke){var it=Ge.nodeValue,we=it.match(Ke);if(we){var rt=it.substring(0,we.index);Ge.nodeValue=rt;var Ze=it.substring(we.index+we[0].length);if(Ze){var je=Ge.parentNode;je.insertBefore(re.createTextNode(Ze),Ge.nextSibling)}Oe(Ge),rt||Ge.parentNode.removeChild(Ge)}}}function Oe(Ge){for(;!Ge.nextSibling;)if(Ge=Ge.parentNode,!Ge)return;function ct(we,rt){var Ze=rt?we.cloneNode(!1):we,je=we.parentNode;if(je){var mt=ct(je,1),Et=we.nextSibling;mt.appendChild(Ze);for(var st=Et;st;st=Et)Et=st.nextSibling,mt.appendChild(st)}return Ze}for(var ot=ct(Ge.nextSibling,0),it;(it=ot.parentNode)&&it.nodeType===1;)ot=it;De.push(ot)}for(var Ye=0;Ye<De.length;++Ye)Re(De[Ye]);le===(le|0)&&De[0].setAttribute("value",le);var at=re.createElement("ol");at.className="linenums";for(var Qe=Math.max(0,le-1|0)||0,Ye=0,Xe=De.length;Ye<Xe;++Ye)fe=De[Ye],fe.className="L"+(Ye+Qe)%10,fe.firstChild||fe.appendChild(re.createTextNode("\xA0")),at.appendChild(fe);ye.appendChild(at)}function Ne(ye){var le=/\bMSIE\s(\d+)/.exec(navigator.userAgent);le=le&&+le[1]<=8;var ke=/\n/g,Fe=ye.sourceCode,Ke=Fe.length,re=0,fe=ye.spans,De=fe.length,Re=0,Oe=ye.decorations,Ye=Oe.length,at=0;Oe[Ye]=Ke;var Qe,Xe;for(Xe=Qe=0;Xe<Ye;)Oe[Xe]!==Oe[Xe+2]?(Oe[Qe++]=Oe[Xe++],Oe[Qe++]=Oe[Xe++]):Xe+=2;for(Ye=Qe,Xe=Qe=0;Xe<Ye;){for(var Ge=Oe[Xe],ct=Oe[Xe+1],ot=Xe+2;ot+2<=Ye&&Oe[ot+1]===ct;)ot+=2;Oe[Qe++]=Ge,Oe[Qe++]=ct,Xe=ot}Ye=Oe.length=Qe;var it=ye.sourceNode,we="";it&&(we=it.style.display,it.style.display="none");try{for(var rt=null;Re<De;){var Ze=fe[Re],je=fe[Re+2]||Ke,mt=Oe[at+2]||Ke,ot=Math.min(je,mt),Et=fe[Re+1],st;if(Et.nodeType!==1&&(st=Fe.substring(re,ot))){le&&(st=st.replace(ke,"\r")),Et.nodeValue=st;var Rt=Et.ownerDocument,Nt=Rt.createElement("span");Nt.className=Oe[at+1];var nt=Et.parentNode;nt.replaceChild(Nt,Et),Nt.appendChild(Et),re<je&&(fe[Re+1]=Et=Rt.createTextNode(Fe.substring(ot,je)),nt.insertBefore(Et,Nt.nextSibling))}re=ot,re>=je&&(Re+=2),re>=mt&&(at+=2)}}finally{it&&(it.style.display=we)}}var Be={};function Me(ye,le){for(var ke=le.length;--ke>=0;){var Fe=le[ke];Be.hasOwnProperty(Fe)?_.console&&console.warn("cannot override language handler %s",Fe):Be[Fe]=ye}}function wt(ye,le){return ye&&Be.hasOwnProperty(ye)||(ye=/^\s*</.test(le)?"default-markup":"default-code"),Be[ye]}Me(We,["default-code"]),Me(pe([],[[q,/^[^<?]+/],[ue,/^<!\w[^>]*(?:>|$)/],[N,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[Z,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Me(pe([[q,/^[\s]+/,null,` \r
|
|
|
`],[X,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[se,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[z,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[Z,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),Me(pe([],[[X,/^[\s\S]+/]]),["uq.val"]),Me(Ce({keywords:y,hashComments:!0,cStyleComments:!0,types:A}),["c","cc","cpp","cxx","cyc","m"]),Me(Ce({keywords:"null,true,false"}),["json"]),Me(Ce({keywords:c,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:A}),["cs"]),Me(Ce({keywords:f,cStyleComments:!0}),["java"]),Me(Ce({keywords:L,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Me(Ce({keywords:E,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Me(Ce({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Me(Ce({keywords:T,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Me(Ce({keywords:h,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Me(Ce({keywords:l,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Me(pe([],[[O,/^[\s\S]+/]]),["regex"]);function He(ye){var le=ye.langExtension;try{var ke=k(ye.sourceNode,ye.pre),Fe=ke.sourceCode;ye.sourceCode=Fe,ye.spans=ke.spans,ye.basePos=0,wt(le,Fe)(ye),Ne(ye)}catch(Ke){_.console&&console.log(Ke&&Ke.stack||Ke)}}function lt(ye,le,ke){var Fe=ke||!1,Ke=le||null,re=document.createElement("div");re.innerHTML="<pre>"+ye+"</pre>",re=re.firstChild,Fe&&me(re,Fe,!0);var fe={langExtension:Ke,numberLines:Fe,sourceNode:re,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return He(fe),re.innerHTML}function Ue(ye,le){var ke=le||document.body,Fe=ke.ownerDocument||document;function Ke(Ze){return ke.getElementsByTagName(Ze)}for(var re=[Ke("pre"),Ke("code"),Ke("xmp")],fe=[],De=0;De<re.length;++De)for(var Re=0,Oe=re[De].length;Re<Oe;++Re)fe.push(re[De][Re]);re=null;var Ye=Date;Ye.now||(Ye={now:function(){return+new Date}});var at=0,Qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,Ge=/\bprettyprinted\b/,ct=/pre|xmp/i,ot=/^code$/i,it=/^(?:pre|code|xmp)$/i,we={};function rt(){for(var Ze=_.PR_SHOULD_USE_CONTINUATION?Ye.now()+250:1/0;at<fe.length&&Ye.now()<Ze;at++){for(var je=fe[at],mt=we,Et=je;Et=Et.previousSibling;){var st=Et.nodeType,Rt=(st===7||st===8)&&Et.nodeValue;if(Rt?!/^\??prettify\b/.test(Rt):st!==3||/\S/.test(Et.nodeValue))break;if(Rt){mt={},Rt.replace(/\b(\w+)=([\w:.%+-]+)/g,function(et,ht,gt){mt[ht]=gt});break}}var Nt=je.className;if((mt!==we||Xe.test(Nt))&&!Ge.test(Nt)){for(var nt=!1,Dt=je.parentNode;Dt;Dt=Dt.parentNode){var Se=Dt.tagName;if(it.test(Se)&&Dt.className&&Xe.test(Dt.className)){nt=!0;break}}if(!nt){je.className+=" prettyprinted";var _e=mt.lang;if(!_e){_e=Nt.match(Qe);var ve;!_e&&(ve=ne(je))&&ot.test(ve.tagName)&&(_e=ve.className.match(Qe)),_e&&(_e=_e[1])}var ee;if(ct.test(je.tagName))ee=1;else{var ie=je.currentStyle,oe=Fe.defaultView,he=ie?ie.whiteSpace:oe&&oe.getComputedStyle?oe.getComputedStyle(je,null).getPropertyValue("white-space"):0;ee=he&&he.substring(0,3)==="pre"}var de=mt.linenums;(de=de==="true"||+de)||(de=Nt.match(/\blinenums\b(?::(\d+))?/),de=de?de[1]&&de[1].length?+de[1]:!0:!1),de&&me(je,de,ee);var Je={langExtension:_e,sourceNode:je,numberLines:de,pre:ee,sourceCode:null,basePos:null,spans:null,decorations:null};He(Je)}}}at<fe.length?_.setTimeout(rt,250):typeof ye=="function"&&ye()}rt()}var bt=_.PR={createSimpleLexer:pe,registerLangHandler:Me,sourceDecorator:Ce,PR_ATTRIB_NAME:z,PR_ATTRIB_VALUE:X,PR_COMMENT:N,PR_DECLARATION:ue,PR_KEYWORD:U,PR_LITERAL:M,PR_NOCODE:B,PR_PLAIN:q,PR_PUNCTUATION:Z,PR_SOURCE:J,PR_STRING:O,PR_TAG:se,PR_TYPE:$,prettyPrintOne:I?_.prettyPrintOne=lt:D=lt,prettyPrint:w=I?_.prettyPrint=Ue:w=Ue},be=_.define;typeof be=="function"&&be.amd&&be("google-code-prettify",[],function(){return bt})})()},25769:function(yt,ge,b){"use strict";var I=b(98040),P={"text/plain":"Text","text/html":"Url",default:"Text"},K="Copy to clipboard: #{key}, Enter";function D(_){var F=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return _.replace(/#{\s*key\s*}/g,F)}function w(_,F){var v,s,y,f,c,l,h=!1;F||(F={}),v=F.debug||!1;try{y=I(),f=document.createRange(),c=document.getSelection(),l=document.createElement("span"),l.textContent=_,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(E){if(E.stopPropagation(),F.format)if(E.preventDefault(),typeof E.clipboardData=="undefined"){v&&console.warn("unable to use e.clipboardData"),v&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var T=P[F.format]||P.default;window.clipboardData.setData(T,_)}else E.clipboardData.clearData(),E.clipboardData.setData(F.format,_);F.onCopy&&(E.preventDefault(),F.onCopy(E.clipboardData))}),document.body.appendChild(l),f.selectNodeContents(l),c.addRange(f);var d=document.execCommand("copy");if(!d)throw new Error("copy command was unsuccessful");h=!0}catch(E){v&&console.error("unable to copy using execCommand: ",E),v&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(F.format||"text",_),F.onCopy&&F.onCopy(window.clipboardData),h=!0}catch(T){v&&console.error("unable to copy using clipboardData: ",T),v&&console.error("falling back to prompt"),s=D("message"in F?F.message:K),window.prompt(s,_)}}finally{c&&(typeof c.removeRange=="function"?c.removeRange(f):c.removeAllRanges()),l&&document.body.removeChild(l),y()}return h}yt.exports=w},24334:function(yt,ge,b){var I,P;(function(K,D){yt.exports=D(K)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof b.g!="undefined"?b.g:this,function(K){"use strict";K=K||{};var D=K.Base64,w="2.6.4",_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",F=function(z){for(var X={},B=0,G=z.length;B<G;B++)X[z.charAt(B)]=B;return X}(_),v=String.fromCharCode,s=function(z){if(z.length<2){var X=z.charCodeAt(0);return X<128?z:X<2048?v(192|X>>>6)+v(128|X&63):v(224|X>>>12&15)+v(128|X>>>6&63)+v(128|X&63)}else{var X=65536+(z.charCodeAt(0)-55296)*1024+(z.charCodeAt(1)-56320);return v(240|X>>>18&7)+v(128|X>>>12&63)+v(128|X>>>6&63)+v(128|X&63)}},y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,f=function(z){return z.replace(y,s)},c=function(z){var X=[0,2,1][z.length%3],B=z.charCodeAt(0)<<16|(z.length>1?z.charCodeAt(1):0)<<8|(z.length>2?z.charCodeAt(2):0),G=[_.charAt(B>>>18),_.charAt(B>>>12&63),X>=2?"=":_.charAt(B>>>6&63),X>=1?"=":_.charAt(B&63)];return G.join("")},l=K.btoa&&typeof K.btoa=="function"?function(z){return K.btoa(z)}:function(z){if(z.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return z.replace(/[\s\S]{1,3}/g,c)},h=function(z){return l(f(String(z)))},d=function(z){return z.replace(/[+\/]/g,function(X){return X=="+"?"-":"_"}).replace(/=/g,"")},E=function(z,X){return X?d(h(z)):h(z)},T=function(z){return E(z,!0)},L;K.Uint8Array&&(L=function(z,X){for(var B="",G=0,W=z.length;G<W;G+=3){var k=z[G],C=z[G+1],V=z[G+2],ne=k<<16|C<<8|V;B+=_.charAt(ne>>>18)+_.charAt(ne>>>12&63)+(typeof C!="undefined"?_.charAt(ne>>>6&63):"=")+(typeof V!="undefined"?_.charAt(ne&63):"=")}return X?d(B):B});var x=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,A=function(z){switch(z.length){case 4:var X=(7&z.charCodeAt(0))<<18|(63&z.charCodeAt(1))<<12|(63&z.charCodeAt(2))<<6|63&z.charCodeAt(3),B=X-65536;return v((B>>>10)+55296)+v((B&1023)+56320);case 3:return v((15&z.charCodeAt(0))<<12|(63&z.charCodeAt(1))<<6|63&z.charCodeAt(2));default:return v((31&z.charCodeAt(0))<<6|63&z.charCodeAt(1))}},O=function(z){return z.replace(x,A)},U=function(z){var X=z.length,B=X%4,G=(X>0?F[z.charAt(0)]<<18:0)|(X>1?F[z.charAt(1)]<<12:0)|(X>2?F[z.charAt(2)]<<6:0)|(X>3?F[z.charAt(3)]:0),W=[v(G>>>16),v(G>>>8&255),v(G&255)];return W.length-=[0,0,2,1][B],W.join("")},N=K.atob&&typeof K.atob=="function"?function(z){return K.atob(z)}:function(z){return z.replace(/\S{1,4}/g,U)},$=function(z){return N(String(z).replace(/[^A-Za-z0-9\+\/]/g,""))},M=function(z){return O(N(z))},Z=function(z){return String(z).replace(/[-_]/g,function(X){return X=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},q=function(z){return M(Z(z))},se;K.Uint8Array&&(se=function(z){return Uint8Array.from($(Z(z)),function(X){return X.charCodeAt(0)})});var ue=function(){var z=K.Base64;return K.Base64=D,z};if(K.Base64={VERSION:w,atob:$,btoa:l,fromBase64:q,toBase64:E,utob:f,encode:E,encodeURI:T,btou:O,decode:q,noConflict:ue,fromUint8Array:L,toUint8Array:se},typeof Object.defineProperty=="function"){var J=function(z){return{value:z,enumerable:!1,writable:!0,configurable:!0}};K.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",J(function(){return q(this)})),Object.defineProperty(String.prototype,"toBase64",J(function(z){return E(this,z)})),Object.defineProperty(String.prototype,"toBase64URI",J(function(){return E(this,!0)}))}}return K.Meteor&&(Base64=K.Base64),yt.exports?yt.exports.Base64=K.Base64:(I=[],P=function(){return K.Base64}.apply(ge,I),P!==void 0&&(yt.exports=P)),{Base64:K.Base64}})},53184:function(yt,ge,b){"use strict";var I,P;function K(D,w,_){var F=function(v,s){return D.js_beautify(v,s)};return F.js=D.js_beautify,F.css=w.css_beautify,F.html=_.html_beautify,F.js_beautify=D.js_beautify,F.css_beautify=w.css_beautify,F.html_beautify=_.html_beautify,F}I=[b(58553),b(87804),b(40998)],P=function(D,w,_){return K(D,w,_)}.apply(ge,I),P!==void 0&&(yt.exports=P)},87804:function(yt,ge){var b,I;(function(){var P;(function(){"use strict";var D=[,,function(v){function s(c){this.__parent=c,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=[]}s.prototype.clone_empty=function(){var c=new s(this.__parent);return c.set_indent(this.__indent_count,this.__alignment_count),c},s.prototype.item=function(c){return c<0?this.__items[this.__items.length+c]:this.__items[c]},s.prototype.has_match=function(c){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(c))return!0;return!1},s.prototype.set_indent=function(c,l){this.is_empty()&&(this.__indent_count=c||0,this.__alignment_count=l||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},s.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)},s.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},s.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var c=this.__parent.current_line;return c.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),c.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),c.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,c.__items[0]===" "&&(c.__items.splice(0,1),c.__character_count-=1),!0}return!1},s.prototype.is_empty=function(){return this.__items.length===0},s.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},s.prototype.push=function(c){this.__items.push(c);var l=c.lastIndexOf(`
|
|
|
`);l!==-1?this.__character_count=c.length-l:this.__character_count+=c.length},s.prototype.pop=function(){var c=null;return this.is_empty()||(c=this.__items.pop(),this.__character_count-=c.length),c},s.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},s.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},s.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},s.prototype.toString=function(){var c="";return this.is_empty()?this.__parent.indent_empty_lines&&(c=this.__parent.get_indent_string(this.__indent_count)):(c=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),c+=this.__items.join("")),c};function y(c,l){this.__cache=[""],this.__indent_size=c.indent_size,this.__indent_string=c.indent_char,c.indent_with_tabs||(this.__indent_string=new Array(c.indent_size+1).join(c.indent_char)),l=l||"",c.indent_level>0&&(l=new Array(c.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}y.prototype.get_indent_size=function(c,l){var h=this.__base_string_length;return l=l||0,c<0&&(h=0),h+=c*this.__indent_size,h+=l,h},y.prototype.get_indent_string=function(c,l){var h=this.__base_string;return l=l||0,c<0&&(c=0,h=""),l+=c*this.__indent_size,this.__ensure_cache(l),h+=this.__cache[l],h},y.prototype.__ensure_cache=function(c){for(;c>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var c=this.__cache.length,l=0,h="";this.__indent_size&&c>=this.__indent_size&&(l=Math.floor(c/this.__indent_size),c-=l*this.__indent_size,h=new Array(l+1).join(this.__indent_string)),c&&(h+=new Array(c+1).join(" ")),this.__cache.push(h)};function f(c,l){this.__indent_cache=new y(c,l),this.raw=!1,this._end_with_newline=c.end_with_newline,this.indent_size=c.indent_size,this.wrap_line_length=c.wrap_line_length,this.indent_empty_lines=c.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new s(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}f.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},f.prototype.get_line_number=function(){return this.__lines.length},f.prototype.get_indent_string=function(c,l){return this.__indent_cache.get_indent_string(c,l)},f.prototype.get_indent_size=function(c,l){return this.__indent_cache.get_indent_size(c,l)},f.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},f.prototype.add_new_line=function(c){return this.is_empty()||!c&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},f.prototype.get_code=function(c){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var h=this.__lines.join(`
|
|
|
`);return c!==`
|
|
|
`&&(h=h.replace(/[\n]/g,c)),h},f.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},f.prototype.set_indent=function(c,l){return c=c||0,l=l||0,this.next_line.set_indent(c,l),this.__lines.length>1?(this.current_line.set_indent(c,l),!0):(this.current_line.set_indent(),!1)},f.prototype.add_raw_token=function(c){for(var l=0;l<c.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(c.whitespace_before),this.current_line.push(c.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},f.prototype.add_token=function(c){this.__add_space_before_token(),this.current_line.push(c),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},f.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(" "))},f.prototype.remove_indent=function(c){for(var l=this.__lines.length;c<l;)this.__lines[c]._remove_indent(),c++;this.current_line._remove_wrap_indent()},f.prototype.trim=function(c){for(c=c===void 0?!1:c,this.current_line.trim();c&&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},f.prototype.just_added_newline=function(){return this.current_line.is_empty()},f.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},f.prototype.ensure_empty_line_above=function(c,l){for(var h=this.__lines.length-2;h>=0;){var d=this.__lines[h];if(d.is_empty())break;if(d.item(0).indexOf(c)!==0&&d.item(-1)!==l){this.__lines.splice(h+1,0,new s(this)),this.previous_line=this.__lines[this.__lines.length-2];break}h--}},v.exports.Output=f},,,,function(v){function s(c,l){this.raw_options=y(c,l),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"])}s.prototype._get_array=function(c,l){var h=this.raw_options[c],d=l||[];return typeof h=="object"?h!==null&&typeof h.concat=="function"&&(d=h.concat()):typeof h=="string"&&(d=h.split(/[^a-zA-Z0-9_\/\-]+/)),d},s.prototype._get_boolean=function(c,l){var h=this.raw_options[c],d=h===void 0?!!l:!!h;return d},s.prototype._get_characters=function(c,l){var h=this.raw_options[c],d=l||"";return typeof h=="string"&&(d=h.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),d},s.prototype._get_number=function(c,l){var h=this.raw_options[c];l=parseInt(l,10),isNaN(l)&&(l=0);var d=parseInt(h,10);return isNaN(d)&&(d=l),d},s.prototype._get_selection=function(c,l,h){var d=this._get_selection_list(c,l,h);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+c+`' can only be one of the following values:
|
|
|
`+l+`
|
|
|
You passed in: '`+this.raw_options[c]+"'");return d[0]},s.prototype._get_selection_list=function(c,l,h){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(h=h||[l[0]],!this._is_valid_selection(h,l))throw new Error("Invalid Default Value!");var d=this._get_array(c,h);if(!this._is_valid_selection(d,l))throw new Error("Invalid Option Value: The option '"+c+`' can contain only the following values:
|
|
|
`+l+`
|
|
|
You passed in: '`+this.raw_options[c]+"'");return d},s.prototype._is_valid_selection=function(c,l){return c.length&&l.length&&!c.some(function(h){return l.indexOf(h)===-1})};function y(c,l){var h={};c=f(c);var d;for(d in c)d!==l&&(h[d]=c[d]);if(l&&c[l])for(d in c[l])h[d]=c[l][d];return h}function f(c){var l={},h;for(h in c){var d=h.replace(/-/g,"_");l[d]=c[h]}return l}v.exports.Options=s,v.exports.normalizeOpts=f,v.exports.mergeOpts=y},,function(v){var s=RegExp.prototype.hasOwnProperty("sticky");function y(f){this.__input=f||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__input.charAt(this.__position),this.__position+=1),f},y.prototype.peek=function(f){var c=null;return f=f||0,f+=this.__position,f>=0&&f<this.__input_length&&(c=this.__input.charAt(f)),c},y.prototype.__match=function(f,c){f.lastIndex=c;var l=f.exec(this.__input);return l&&!(s&&f.sticky)&&l.index!==c&&(l=null),l},y.prototype.test=function(f,c){return c=c||0,c+=this.__position,c>=0&&c<this.__input_length?!!this.__match(f,c):!1},y.prototype.testChar=function(f,c){var l=this.peek(c);return f.lastIndex=0,l!==null&&f.test(l)},y.prototype.match=function(f){var c=this.__match(f,this.__position);return c?this.__position+=c[0].length:c=null,c},y.prototype.read=function(f,c,l){var h="",d;return f&&(d=this.match(f),d&&(h+=d[0])),c&&(d||!f)&&(h+=this.readUntil(c,l)),h},y.prototype.readUntil=function(f,c){var l="",h=this.__position;f.lastIndex=this.__position;var d=f.exec(this.__input);return d?(h=d.index,c&&(h+=d[0].length)):h=this.__input_length,l=this.__input.substring(this.__position,h),this.__position=h,l},y.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},y.prototype.get_regexp=function(f,c){var l=null,h="g";return c&&s&&(h="y"),typeof f=="string"&&f!==""?l=new RegExp(f,h):f&&(l=new RegExp(f.source,h)),l},y.prototype.get_literal_regexp=function(f){return RegExp(f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(f){var c=this.__position,l=this.readUntilAfter(f);return this.__position=c,l},y.prototype.lookBack=function(f){var c=this.__position-1;return c>=f.length&&this.__input.substring(c-f.length,c).toLowerCase()===f},v.exports.InputScanner=y},,,,,function(v){function s(y,f){y=typeof y=="string"?y:y.source,f=typeof f=="string"?f:f.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+f,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+f,"g")}s.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var f={};this.__directive_pattern.lastIndex=0;for(var c=this.__directive_pattern.exec(y);c;)f[c[1]]=c[2],c=this.__directive_pattern.exec(y);return f},s.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},v.exports.Directives=s},,function(v,s,y){var f=y(16).Beautifier,c=y(17).Options;function l(h,d){var E=new f(h,d);return E.beautify()}v.exports=l,v.exports.defaultOptions=function(){return new c}},function(v,s,y){var f=y(17).Options,c=y(2).Output,l=y(8).InputScanner,h=y(13).Directives,d=new h(/\/\*/,/\*\//),E=/\r\n|[\r\n]/,T=/\r\n|[\r\n]/g,L=/\s/,x=/(?:\s|\n)+/g,A=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,O=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function U(N,$){this._source_text=N||"",this._options=new f($),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"]}U.prototype.eatString=function(N){var $="";for(this._ch=this._input.next();this._ch;){if($+=this._ch,this._ch==="\\")$+=this._input.next();else if(N.indexOf(this._ch)!==-1||this._ch===`
|
|
|
`)break;this._ch=this._input.next()}return $},U.prototype.eatWhitespace=function(N){for(var $=L.test(this._input.peek()),M=0;L.test(this._input.peek());)this._ch=this._input.next(),N&&this._ch===`
|
|
|
`&&(M===0||M<this._options.max_preserve_newlines)&&(M++,this._output.add_new_line(!0));return $},U.prototype.foundNestedPseudoClass=function(){for(var N=0,$=1,M=this._input.peek($);M;){if(M==="{")return!0;if(M==="(")N+=1;else if(M===")"){if(N===0)return!1;N-=1}else if(M===";"||M==="}")return!1;$++,M=this._input.peek($)}return!1},U.prototype.print_string=function(N){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(N)},U.prototype.preserveSingleSpace=function(N){N&&(this._output.space_before_token=!0)},U.prototype.indent=function(){this._indentLevel++},U.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},U.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var N=this._source_text,$=this._options.eol;$==="auto"&&($=`
|
|
|
`,N&&E.test(N||"")&&($=N.match(E)[0])),N=N.replace(T,`
|
|
|
`);var M=N.match(/^[\t ]*/)[0];this._output=new c(this._options,M),this._input=new l(N),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var Z=0,q=!1,se=!1,ue=!1,J=!1,z=!1,X=this._ch,B=!1,G,W,k;G=this._input.read(x),W=G!=="",k=X,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),X=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var C=this._input.read(A),V=d.get_directives(C);V&&V.ignore==="start"&&(C+=d.readIgnored(this._input)),this.print_string(C),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(O)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(W),this.print_string(this._ch);var ne=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ne.match(/[ :]$/)&&(ne=this.eatString(": ").replace(/\s+$/,""),this.print_string(ne),this._output.space_before_token=!0),Z===0&&ne.indexOf(":")!==-1&&(se=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(W),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var pe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);pe.match(/[ :]$/)&&(pe=this.eatString(": ").replace(/\s+$/,""),this.print_string(pe),this._output.space_before_token=!0),Z===0&&pe.indexOf(":")!==-1?(se=!0,this.indent()):pe in this.NESTED_AT_RULE?(this._nestedLevel+=1,pe in this.CONDITIONAL_GROUP_RULE&&(ue=!0)):Z===0&&!se&&(J=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(W),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")se&&(se=!1,this.outdent()),J=!1,ue?(ue=!1,q=this._indentLevel>=this._nestedLevel):q=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&q&&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)):(k==="("?this._output.space_before_token=!1:k!==","&&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(),k==="{"&&this._output.trim(!0),se&&(this.outdent(),se=!1),this.print_string(this._ch),q=!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 Ce=0;Ce<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Ce++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Ce])){B=!0;break}(q||ue)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!J&&Z===0?(this.print_string(":"),se||(se=!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 We=k==='"'||k==="'";this.preserveSingleSpace(We||W),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")B=!1,Z===0?(se&&(this.outdent(),se=!1),J=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),Z++,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(")")),Z&&(Z--,this.outdent()));else{var me=!1;this._input.lookBack("with")&&(me=!0),this.preserveSingleSpace(W||me),this.print_string(this._ch),se&&k==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),z=!0):(this.eatWhitespace(),Z++,this.indent())}else if(this._ch===")")Z&&(Z--,this.outdent()),z&&this._input.peek()===";"&&this._options.selector_separator_newline&&(z=!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&&(!se||z)&&Z===0&&!J?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!se&&Z===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&&L.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(W),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),L.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 Ne=k==='"'||k==="'";this.preserveSingleSpace(Ne||W),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
|
`&&B&&this._output.add_new_line()}var Be=this._output.get_code($);return Be},v.exports.Beautifier=U},function(v,s,y){var f=y(6).Options;function c(l){f.call(this,l,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var h=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||h;var d=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var E=0;E<d.length;E++)d[E]!=="expand"?this.brace_style="collapse":this.brace_style=d[E]}c.prototype=new f,v.exports.Options=c}],w={};function _(v){var s=w[v];if(s!==void 0)return s.exports;var y=w[v]={exports:{}};return D[v](y,y.exports,_),y.exports}var F=_(15);P=F})();var K=P;b=[],I=function(){return{css_beautify:K}}.apply(ge,b),I!==void 0&&(yt.exports=I)})()},40998:function(yt,ge,b){var I,P;(function(){var K;(function(){"use strict";var F=[,,function(f){function c(d){this.__parent=d,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=[]}c.prototype.clone_empty=function(){var d=new c(this.__parent);return d.set_indent(this.__indent_count,this.__alignment_count),d},c.prototype.item=function(d){return d<0?this.__items[this.__items.length+d]:this.__items[d]},c.prototype.has_match=function(d){for(var E=this.__items.length-1;E>=0;E--)if(this.__items[E].match(d))return!0;return!1},c.prototype.set_indent=function(d,E){this.is_empty()&&(this.__indent_count=d||0,this.__alignment_count=E||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},c.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)},c.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},c.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var d=this.__parent.current_line;return d.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),d.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),d.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,d.__items[0]===" "&&(d.__items.splice(0,1),d.__character_count-=1),!0}return!1},c.prototype.is_empty=function(){return this.__items.length===0},c.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},c.prototype.push=function(d){this.__items.push(d);var E=d.lastIndexOf(`
|
|
|
`);E!==-1?this.__character_count=d.length-E:this.__character_count+=d.length},c.prototype.pop=function(){var d=null;return this.is_empty()||(d=this.__items.pop(),this.__character_count-=d.length),d},c.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},c.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},c.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},c.prototype.toString=function(){var d="";return this.is_empty()?this.__parent.indent_empty_lines&&(d=this.__parent.get_indent_string(this.__indent_count)):(d=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),d+=this.__items.join("")),d};function l(d,E){this.__cache=[""],this.__indent_size=d.indent_size,this.__indent_string=d.indent_char,d.indent_with_tabs||(this.__indent_string=new Array(d.indent_size+1).join(d.indent_char)),E=E||"",d.indent_level>0&&(E=new Array(d.indent_level+1).join(this.__indent_string)),this.__base_string=E,this.__base_string_length=E.length}l.prototype.get_indent_size=function(d,E){var T=this.__base_string_length;return E=E||0,d<0&&(T=0),T+=d*this.__indent_size,T+=E,T},l.prototype.get_indent_string=function(d,E){var T=this.__base_string;return E=E||0,d<0&&(d=0,T=""),E+=d*this.__indent_size,this.__ensure_cache(E),T+=this.__cache[E],T},l.prototype.__ensure_cache=function(d){for(;d>=this.__cache.length;)this.__add_column()},l.prototype.__add_column=function(){var d=this.__cache.length,E=0,T="";this.__indent_size&&d>=this.__indent_size&&(E=Math.floor(d/this.__indent_size),d-=E*this.__indent_size,T=new Array(E+1).join(this.__indent_string)),d&&(T+=new Array(d+1).join(" ")),this.__cache.push(T)};function h(d,E){this.__indent_cache=new l(d,E),this.raw=!1,this._end_with_newline=d.end_with_newline,this.indent_size=d.indent_size,this.wrap_line_length=d.wrap_line_length,this.indent_empty_lines=d.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new c(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(d,E){return this.__indent_cache.get_indent_string(d,E)},h.prototype.get_indent_size=function(d,E){return this.__indent_cache.get_indent_size(d,E)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(d){return this.is_empty()||!d&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(d){this.trim(!0);var E=this.current_line.pop();E&&(E[E.length-1]===`
|
|
|
`&&(E=E.replace(/\n+$/g,"")),this.current_line.push(E)),this._end_with_newline&&this.__add_outputline();var T=this.__lines.join(`
|
|
|
`);return d!==`
|
|
|
`&&(T=T.replace(/[\n]/g,d)),T},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(d,E){return d=d||0,E=E||0,this.next_line.set_indent(d,E),this.__lines.length>1?(this.current_line.set_indent(d,E),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(d){for(var E=0;E<d.newlines;E++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(d.whitespace_before),this.current_line.push(d.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},h.prototype.add_token=function(d){this.__add_space_before_token(),this.current_line.push(d),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},h.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(" "))},h.prototype.remove_indent=function(d){for(var E=this.__lines.length;d<E;)this.__lines[d]._remove_indent(),d++;this.current_line._remove_wrap_indent()},h.prototype.trim=function(d){for(d=d===void 0?!1:d,this.current_line.trim();d&&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},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(d,E){for(var T=this.__lines.length-2;T>=0;){var L=this.__lines[T];if(L.is_empty())break;if(L.item(0).indexOf(d)!==0&&L.item(-1)!==E){this.__lines.splice(T+1,0,new c(this)),this.previous_line=this.__lines[this.__lines.length-2];break}T--}},f.exports.Output=h},function(f){function c(l,h,d,E){this.type=l,this.text=h,this.comments_before=null,this.newlines=d||0,this.whitespace_before=E||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}f.exports.Token=c},,,function(f){function c(d,E){this.raw_options=l(d,E),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"])}c.prototype._get_array=function(d,E){var T=this.raw_options[d],L=E||[];return typeof T=="object"?T!==null&&typeof T.concat=="function"&&(L=T.concat()):typeof T=="string"&&(L=T.split(/[^a-zA-Z0-9_\/\-]+/)),L},c.prototype._get_boolean=function(d,E){var T=this.raw_options[d],L=T===void 0?!!E:!!T;return L},c.prototype._get_characters=function(d,E){var T=this.raw_options[d],L=E||"";return typeof T=="string"&&(L=T.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),L},c.prototype._get_number=function(d,E){var T=this.raw_options[d];E=parseInt(E,10),isNaN(E)&&(E=0);var L=parseInt(T,10);return isNaN(L)&&(L=E),L},c.prototype._get_selection=function(d,E,T){var L=this._get_selection_list(d,E,T);if(L.length!==1)throw new Error("Invalid Option Value: The option '"+d+`' can only be one of the following values:
|
|
|
`+E+`
|
|
|
You passed in: '`+this.raw_options[d]+"'");return L[0]},c.prototype._get_selection_list=function(d,E,T){if(!E||E.length===0)throw new Error("Selection list cannot be empty.");if(T=T||[E[0]],!this._is_valid_selection(T,E))throw new Error("Invalid Default Value!");var L=this._get_array(d,T);if(!this._is_valid_selection(L,E))throw new Error("Invalid Option Value: The option '"+d+`' can contain only the following values:
|
|
|
`+E+`
|
|
|
You passed in: '`+this.raw_options[d]+"'");return L},c.prototype._is_valid_selection=function(d,E){return d.length&&E.length&&!d.some(function(T){return E.indexOf(T)===-1})};function l(d,E){var T={};d=h(d);var L;for(L in d)L!==E&&(T[L]=d[L]);if(E&&d[E])for(L in d[E])T[L]=d[E][L];return T}function h(d){var E={},T;for(T in d){var L=T.replace(/-/g,"_");E[L]=d[T]}return E}f.exports.Options=c,f.exports.normalizeOpts=h,f.exports.mergeOpts=l},,function(f){var c=RegExp.prototype.hasOwnProperty("sticky");function l(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}l.prototype.restart=function(){this.__position=0},l.prototype.back=function(){this.__position>0&&(this.__position-=1)},l.prototype.hasNext=function(){return this.__position<this.__input_length},l.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},l.prototype.peek=function(h){var d=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(d=this.__input.charAt(h)),d},l.prototype.__match=function(h,d){h.lastIndex=d;var E=h.exec(this.__input);return E&&!(c&&h.sticky)&&E.index!==d&&(E=null),E},l.prototype.test=function(h,d){return d=d||0,d+=this.__position,d>=0&&d<this.__input_length?!!this.__match(h,d):!1},l.prototype.testChar=function(h,d){var E=this.peek(d);return h.lastIndex=0,E!==null&&h.test(E)},l.prototype.match=function(h){var d=this.__match(h,this.__position);return d?this.__position+=d[0].length:d=null,d},l.prototype.read=function(h,d,E){var T="",L;return h&&(L=this.match(h),L&&(T+=L[0])),d&&(L||!h)&&(T+=this.readUntil(d,E)),T},l.prototype.readUntil=function(h,d){var E="",T=this.__position;h.lastIndex=this.__position;var L=h.exec(this.__input);return L?(T=L.index,d&&(T+=L[0].length)):T=this.__input_length,E=this.__input.substring(this.__position,T),this.__position=T,E},l.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},l.prototype.get_regexp=function(h,d){var E=null,T="g";return d&&c&&(T="y"),typeof h=="string"&&h!==""?E=new RegExp(h,T):h&&(E=new RegExp(h.source,T)),E},l.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},l.prototype.peekUntilAfter=function(h){var d=this.__position,E=this.readUntilAfter(h);return this.__position=d,E},l.prototype.lookBack=function(h){var d=this.__position-1;return d>=h.length&&this.__input.substring(d-h.length,d).toLowerCase()===h},f.exports.InputScanner=l},function(f,c,l){var h=l(8).InputScanner,d=l(3).Token,E=l(10).TokenStream,T=l(11).WhitespacePattern,L={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},x=function(A,O){this._input=new h(A),this._options=O||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new T(this._input)};x.prototype.tokenize=function(){this._input.restart(),this.__tokens=new E,this._reset();for(var A,O=new d(L.START,""),U=null,N=[],$=new E;O.type!==L.EOF;){for(A=this._get_next_token(O,U);this._is_comment(A);)$.add(A),A=this._get_next_token(O,U);$.isEmpty()||(A.comments_before=$,$=new E),A.parent=U,this._is_opening(A)?(N.push(U),U=A):U&&this._is_closing(A,U)&&(A.opened=U,U.closed=A,U=N.pop(),A.parent=U),A.previous=O,O.next=A,this.__tokens.add(A),O=A}return this.__tokens},x.prototype._is_first_token=function(){return this.__tokens.isEmpty()},x.prototype._reset=function(){},x.prototype._get_next_token=function(A,O){this._readWhitespace();var U=this._input.read(/.+/g);return U?this._create_token(L.RAW,U):this._create_token(L.EOF,"")},x.prototype._is_comment=function(A){return!1},x.prototype._is_opening=function(A){return!1},x.prototype._is_closing=function(A,O){return!1},x.prototype._create_token=function(A,O){var U=new d(A,O,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return U},x.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},f.exports.Tokenizer=x,f.exports.TOKEN=L},function(f){function c(l){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=l}c.prototype.restart=function(){this.__position=0},c.prototype.isEmpty=function(){return this.__tokens_length===0},c.prototype.hasNext=function(){return this.__position<this.__tokens_length},c.prototype.next=function(){var l=null;return this.hasNext()&&(l=this.__tokens[this.__position],this.__position+=1),l},c.prototype.peek=function(l){var h=null;return l=l||0,l+=this.__position,l>=0&&l<this.__tokens_length&&(h=this.__tokens[l]),h},c.prototype.add=function(l){this.__parent_token&&(l.parent=this.__parent_token),this.__tokens.push(l),this.__tokens_length+=1},f.exports.TokenStream=c},function(f,c,l){var h=l(12).Pattern;function d(E,T){h.call(this,E,T),T?this._line_regexp=this._input.get_regexp(T._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}d.prototype=new h,d.prototype.__set_whitespace_patterns=function(E,T){E+="\\t ",T+="\\n\\r",this._match_pattern=this._input.get_regexp("["+E+T+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+T+"]")},d.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var E=this._input.read(this._match_pattern);if(E===" ")this.whitespace_before_token=" ";else if(E){var T=this.__split(this._newline_regexp,E);this.newline_count=T.length-1,this.whitespace_before_token=T[this.newline_count]}return E},d.prototype.matching=function(E,T){var L=this._create();return L.__set_whitespace_patterns(E,T),L._update(),L},d.prototype._create=function(){return new d(this._input,this)},d.prototype.__split=function(E,T){E.lastIndex=0;for(var L=0,x=[],A=E.exec(T);A;)x.push(T.substring(L,A.index)),L=A.index+A[0].length,A=E.exec(T);return L<T.length?x.push(T.substring(L,T.length)):x.push(""),x},f.exports.WhitespacePattern=d},function(f){function c(l,h){this._input=l,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,h&&(this._starting_pattern=this._input.get_regexp(h._starting_pattern,!0),this._match_pattern=this._input.get_regexp(h._match_pattern,!0),this._until_pattern=this._input.get_regexp(h._until_pattern),this._until_after=h._until_after)}c.prototype.read=function(){var l=this._input.read(this._starting_pattern);return(!this._starting_pattern||l)&&(l+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),l},c.prototype.read_match=function(){return this._input.match(this._match_pattern)},c.prototype.until_after=function(l){var h=this._create();return h._until_after=!0,h._until_pattern=this._input.get_regexp(l),h._update(),h},c.prototype.until=function(l){var h=this._create();return h._until_after=!1,h._until_pattern=this._input.get_regexp(l),h._update(),h},c.prototype.starting_with=function(l){var h=this._create();return h._starting_pattern=this._input.get_regexp(l,!0),h._update(),h},c.prototype.matching=function(l){var h=this._create();return h._match_pattern=this._input.get_regexp(l,!0),h._update(),h},c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){},f.exports.Pattern=c},function(f){function c(l,h){l=typeof l=="string"?l:l.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(l+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(l+/\sbeautify\signore:end\s/.source+h,"g")}c.prototype.get_directives=function(l){if(!l.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var d=this.__directive_pattern.exec(l);d;)h[d[1]]=d[2],d=this.__directive_pattern.exec(l);return h},c.prototype.readIgnored=function(l){return l.readUntilAfter(this.__directives_end_ignore_pattern)},f.exports.Directives=c},function(f,c,l){var h=l(12).Pattern,d={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function E(T,L){h.call(this,T,L),this.__template_pattern=null,this._disabled=Object.assign({},d),this._excluded=Object.assign({},d),L&&(this.__template_pattern=this._input.get_regexp(L.__template_pattern),this._excluded=Object.assign(this._excluded,L._excluded),this._disabled=Object.assign(this._disabled,L._disabled));var x=new h(T);this.__patterns={handlebars_comment:x.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:x.starting_with(/{{{/).until_after(/}}}/),handlebars:x.starting_with(/{{/).until_after(/}}/),php:x.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:x.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:x.starting_with(/{%/).until_after(/%}/),django_value:x.starting_with(/{{/).until_after(/}}/),django_comment:x.starting_with(/{#/).until_after(/#}/),smarty:x.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:x.starting_with(/{\*/).until_after(/\*}/),smarty_literal:x.starting_with(/{literal}/).until_after(/{\/literal}/)}}E.prototype=new h,E.prototype._create=function(){return new E(this._input,this)},E.prototype._update=function(){this.__set_templated_pattern()},E.prototype.disable=function(T){var L=this._create();return L._disabled[T]=!0,L._update(),L},E.prototype.read_options=function(T){var L=this._create();for(var x in d)L._disabled[x]=T.templating.indexOf(x)===-1;return L._update(),L},E.prototype.exclude=function(T){var L=this._create();return L._excluded[T]=!0,L._update(),L},E.prototype.read=function(){var T="";this._match_pattern?T=this._input.read(this._starting_pattern):T=this._input.read(this._starting_pattern,this.__template_pattern);for(var L=this._read_template();L;)this._match_pattern?L+=this._input.read(this._match_pattern):L+=this._input.readUntil(this.__template_pattern),T+=L,L=this._read_template();return this._until_after&&(T+=this._input.readUntilAfter(this._until_pattern)),T},E.prototype.__set_templated_pattern=function(){var T=[];this._disabled.php||T.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||T.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||T.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||T.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(T.push(this.__patterns.django._starting_pattern.source),T.push(this.__patterns.django_value._starting_pattern.source),T.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||T.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&T.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+T.join("|")+")")},E.prototype._read_template=function(){var T="",L=this._input.peek();if(L==="<"){var x=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&x==="?"&&(T=T||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&x==="%"&&(T=T||this.__patterns.erb.read())}else L==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(T=T||this.__patterns.handlebars_comment.read(),T=T||this.__patterns.handlebars_unescaped.read(),T=T||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(T=T||this.__patterns.django_value.read()),this._excluded.django||(T=T||this.__patterns.django_comment.read(),T=T||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(T=T||this.__patterns.smarty_comment.read(),T=T||this.__patterns.smarty_literal.read(),T=T||this.__patterns.smarty.read()));return T},f.exports.TemplatablePattern=E},,,,function(f,c,l){var h=l(19).Beautifier,d=l(20).Options;function E(T,L,x,A){var O=new h(T,L,x,A);return O.beautify()}f.exports=E,f.exports.defaultOptions=function(){return new d}},function(f,c,l){var h=l(20).Options,d=l(2).Output,E=l(21).Tokenizer,T=l(21).TOKEN,L=/\r\n|[\r\n]/,x=/\r\n|[\r\n]/g,A=function(J,z){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=J.max_preserve_newlines,this.preserve_newlines=J.preserve_newlines,this._output=new d(J,z)};A.prototype.current_line_has_match=function(J){return this._output.current_line.has_match(J)},A.prototype.set_space_before_token=function(J,z){this._output.space_before_token=J,this._output.non_breaking_space=z},A.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},A.prototype.add_raw_token=function(J){this._output.add_raw_token(J)},A.prototype.print_preserved_newlines=function(J){var z=0;J.type!==T.TEXT&&J.previous.type!==T.TEXT&&(z=J.newlines?1:0),this.preserve_newlines&&(z=J.newlines<this.max_preserve_newlines+1?J.newlines:this.max_preserve_newlines+1);for(var X=0;X<z;X++)this.print_newline(X>0);return z!==0},A.prototype.traverse_whitespace=function(J){return J.whitespace_before||J.newlines?(this.print_preserved_newlines(J)||(this._output.space_before_token=!0),!0):!1},A.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},A.prototype.print_newline=function(J){this._output.add_new_line(J)},A.prototype.print_token=function(J){J.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(J.text))},A.prototype.indent=function(){this.indent_level++},A.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},A.prototype.get_full_indent=function(J){return J=this.indent_level+(J||0),J<1?"":this._output.get_indent_string(J)};var O=function(J){for(var z=null,X=J.next;X.type!==T.EOF&&J.closed!==X;){if(X.type===T.ATTRIBUTE&&X.text==="type"){X.next&&X.next.type===T.EQUALS&&X.next.next&&X.next.next.type===T.VALUE&&(z=X.next.next.text);break}X=X.next}return z},U=function(J,z){var X=null,B=null;return z.closed?(J==="script"?X="text/javascript":J==="style"&&(X="text/css"),X=O(z)||X,X.search("text/css")>-1?B="css":X.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?B="javascript":X.search(/(text|application|dojo)\/(x-)?(html)/)>-1?B="html":X.search(/test\/null/)>-1&&(B="null"),B):null};function N(J,z){return z.indexOf(J)!==-1}function $(J,z,X){this.parent=J||null,this.tag=z?z.tag_name:"",this.indent_level=X||0,this.parser_token=z||null}function M(J){this._printer=J,this._current_frame=null}M.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},M.prototype.record_tag=function(J){var z=new $(this._current_frame,J,this._printer.indent_level);this._current_frame=z},M.prototype._try_pop_frame=function(J){var z=null;return J&&(z=J.parser_token,this._printer.indent_level=J.indent_level,this._current_frame=J.parent),z},M.prototype._get_frame=function(J,z){for(var X=this._current_frame;X&&J.indexOf(X.tag)===-1;){if(z&&z.indexOf(X.tag)!==-1){X=null;break}X=X.parent}return X},M.prototype.try_pop=function(J,z){var X=this._get_frame([J],z);return this._try_pop_frame(X)},M.prototype.indent_to_tag=function(J){var z=this._get_frame(J);z&&(this._printer.indent_level=z.indent_level)};function Z(J,z,X,B){this._source_text=J||"",z=z||{},this._js_beautify=X,this._css_beautify=B,this._tag_stack=null;var G=new h(z,"html");this._options=G,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"}Z.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var J=this._source_text,z=this._options.eol;this._options.eol==="auto"&&(z=`
|
|
|
`,J&&L.test(J)&&(z=J.match(L)[0])),J=J.replace(x,`
|
|
|
`);var X=J.match(/^[\t ]*/)[0],B={text:"",type:""},G=new q(this._options),W=new A(this._options,X),k=new E(J,this._options).tokenize();this._tag_stack=new M(W);for(var C=null,V=k.next();V.type!==T.EOF;)V.type===T.TAG_OPEN||V.type===T.COMMENT?(C=this._handle_tag_open(W,V,G,B,k),G=C):V.type===T.ATTRIBUTE||V.type===T.EQUALS||V.type===T.VALUE||V.type===T.TEXT&&!G.tag_complete?C=this._handle_inside_tag(W,V,G,B):V.type===T.TAG_CLOSE?C=this._handle_tag_close(W,V,G):V.type===T.TEXT?C=this._handle_text(W,V,G):V.type===T.CONTROL_FLOW_OPEN?C=this._handle_control_flow_open(W,V):V.type===T.CONTROL_FLOW_CLOSE?C=this._handle_control_flow_close(W,V):W.add_raw_token(V),B=C,V=k.next();var ne=W._output.get_code(z);return ne},Z.prototype._handle_control_flow_open=function(J,z){var X={text:z.text,type:z.type};return J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),z.newlines?J.print_preserved_newlines(z):J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),J.print_token(z),J.indent(),X},Z.prototype._handle_control_flow_close=function(J,z){var X={text:z.text,type:z.type};return J.deindent(),z.newlines?J.print_preserved_newlines(z):J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),J.print_token(z),X},Z.prototype._handle_tag_close=function(J,z,X){var B={text:z.text,type:z.type};return J.alignment_size=0,X.tag_complete=!0,J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),X.is_unformatted?J.add_raw_token(z):(X.tag_start_char==="<"&&(J.set_space_before_token(z.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&X.has_wrapped_attrs&&J.print_newline(!1)),J.print_token(z)),X.indent_content&&!(X.is_unformatted||X.is_content_unformatted)&&(J.indent(),X.indent_content=!1),!X.is_inline_element&&!(X.is_unformatted||X.is_content_unformatted)&&J.set_wrap_point(),B},Z.prototype._handle_inside_tag=function(J,z,X,B){var G=X.has_wrapped_attrs,W={text:z.text,type:z.type};return J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),X.is_unformatted?J.add_raw_token(z):X.tag_start_char==="{"&&z.type===T.TEXT?J.print_preserved_newlines(z)?(z.newlines=0,J.add_raw_token(z)):J.print_token(z):(z.type===T.ATTRIBUTE?J.set_space_before_token(!0):(z.type===T.EQUALS||z.type===T.VALUE&&z.previous.type===T.EQUALS)&&J.set_space_before_token(!1),z.type===T.ATTRIBUTE&&X.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(J.traverse_whitespace(z),G=G||z.newlines!==0),this._is_wrap_attributes_force&&X.attr_count>=this._options.wrap_attributes_min_attrs&&(B.type!==T.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(J.print_newline(!1),G=!0)),J.print_token(z),G=G||J.previous_token_wrapped(),X.has_wrapped_attrs=G),W},Z.prototype._handle_text=function(J,z,X){var B={text:z.text,type:"TK_CONTENT"};return X.custom_beautifier_name?this._print_custom_beatifier_text(J,z,X):X.is_unformatted||X.is_content_unformatted?J.add_raw_token(z):(J.traverse_whitespace(z),J.print_token(z)),B},Z.prototype._print_custom_beatifier_text=function(J,z,X){var B=this;if(z.text!==""){var G=z.text,W,k=1,C="",V="";X.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?W=this._js_beautify:X.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?W=this._css_beautify:X.custom_beautifier_name==="html"&&(W=function(Ne,Be){var Me=new Z(Ne,Be,B._js_beautify,B._css_beautify);return Me.beautify()}),this._options.indent_scripts==="keep"?k=0:this._options.indent_scripts==="separate"&&(k=-J.indent_level);var ne=J.get_full_indent(k);if(G=G.replace(/\n[ \t]*$/,""),X.custom_beautifier_name!=="html"&&G[0]==="<"&&G.match(/^(<!--|<!\[CDATA\[)/)){var pe=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(G);if(!pe){J.add_raw_token(z);return}C=ne+pe[1]+`
|
|
|
`,G=pe[4],pe[5]&&(V=ne+pe[5]),G=G.replace(/\n[ \t]*$/,""),(pe[2]||pe[3].indexOf(`
|
|
|
`)!==-1)&&(pe=pe[3].match(/[ \t]+$/),pe&&(z.whitespace_before=pe[0]))}if(G)if(W){var Ce=function(){this.eol=`
|
|
|
`};Ce.prototype=this._options.raw_options;var We=new Ce;G=W(ne+G,We)}else{var me=z.whitespace_before;me&&(G=G.replace(new RegExp(`
|
|
|
(`+me+")?","g"),`
|
|
|
`)),G=ne+G.replace(/\n/g,`
|
|
|
`+ne)}C&&(G?G=C+G+`
|
|
|
`+V:G=C+V),J.print_newline(!1),G&&(z.text=G,z.whitespace_before="",z.newlines=0,J.add_raw_token(z),J.print_newline(!0))}},Z.prototype._handle_tag_open=function(J,z,X,B,G){var W=this._get_tag_open_token(z);if((X.is_unformatted||X.is_content_unformatted)&&!X.is_empty_element&&z.type===T.TAG_OPEN&&!W.is_start_tag?(J.add_raw_token(z),W.start_tag_token=this._tag_stack.try_pop(W.tag_name)):(J.traverse_whitespace(z),this._set_tag_position(J,z,W,X,B),W.is_inline_element||J.set_wrap_point(),J.print_token(z)),W.is_start_tag&&this._is_wrap_attributes_force){var k=0,C;do C=G.peek(k),C.type===T.ATTRIBUTE&&(W.attr_count+=1),k+=1;while(C.type!==T.EOF&&C.type!==T.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(W.alignment_size=z.text.length+1),!W.tag_complete&&!W.is_unformatted&&(J.alignment_size=W.alignment_size),W};var q=function(J,z,X){if(this.parent=z||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="",!X)this.tag_complete=!0;else{var B;this.tag_start_char=X.text[0],this.text=X.text,this.tag_start_char==="<"?(B=X.text.match(/^<([^\s>]*)/),this.tag_check=B?B[1]:""):(B=X.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=B?B[1]:"",(X.text.startsWith("{{#>")||X.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&X.next!==null?this.tag_check=X.next.text.split(" ")[0]:this.tag_check=X.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),X.type===T.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||X.closed&&X.closed.text==="/>";var G=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(G=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!J.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(G)))}};Z.prototype._get_tag_open_token=function(J){var z=new q(this._options,this._tag_stack.get_parser_token(),J);return z.alignment_size=this._options.wrap_attributes_indent_size,z.is_end_tag=z.is_end_tag||N(z.tag_check,this._options.void_elements),z.is_empty_element=z.tag_complete||z.is_start_tag&&z.is_end_tag,z.is_unformatted=!z.tag_complete&&N(z.tag_check,this._options.unformatted),z.is_content_unformatted=!z.is_empty_element&&N(z.tag_check,this._options.content_unformatted),z.is_inline_element=N(z.tag_name,this._options.inline)||this._options.inline_custom_elements&&z.tag_name.includes("-")||z.tag_start_char==="{",z},Z.prototype._set_tag_position=function(J,z,X,B,G){if(X.is_empty_element||(X.is_end_tag?X.start_tag_token=this._tag_stack.try_pop(X.tag_name):(this._do_optional_end_element(X)&&(X.is_inline_element||J.print_newline(!1)),this._tag_stack.record_tag(X),(X.tag_name==="script"||X.tag_name==="style")&&!(X.is_unformatted||X.is_content_unformatted)&&(X.custom_beautifier_name=U(X.tag_check,z)))),N(X.tag_check,this._options.extra_liners)&&(J.print_newline(!1),J._output.just_added_blankline()||J.print_newline(!0)),X.is_empty_element){if(X.tag_start_char==="{"&&X.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),X.indent_content=!0;var W=J.current_line_has_match(/{{#if/);W||J.print_newline(!1)}X.tag_name==="!--"&&G.type===T.TAG_CLOSE&&B.is_end_tag&&X.text.indexOf(`
|
|
|
`)===-1||(X.is_inline_element||X.is_unformatted||J.print_newline(!1),this._calcluate_parent_multiline(J,X))}else if(X.is_end_tag){var k=!1;k=X.start_tag_token&&X.start_tag_token.multiline_content,k=k||!X.is_inline_element&&!(B.is_inline_element||B.is_unformatted)&&!(G.type===T.TAG_CLOSE&&X.start_tag_token===B)&&G.type!=="TK_CONTENT",(X.is_content_unformatted||X.is_unformatted)&&(k=!1),k&&J.print_newline(!1)}else X.indent_content=!X.custom_beautifier_name,X.tag_start_char==="<"&&(X.tag_name==="html"?X.indent_content=this._options.indent_inner_html:X.tag_name==="head"?X.indent_content=this._options.indent_head_inner_html:X.tag_name==="body"&&(X.indent_content=this._options.indent_body_inner_html)),!(X.is_inline_element||X.is_unformatted)&&(G.type!=="TK_CONTENT"||X.is_content_unformatted)&&J.print_newline(!1),this._calcluate_parent_multiline(J,X)},Z.prototype._calcluate_parent_multiline=function(J,z){z.parent&&J._output.just_added_newline()&&!((z.is_inline_element||z.is_unformatted)&&z.parent.is_inline_element)&&(z.parent.multiline_content=!0)};var se=["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"],ue=["a","audio","del","ins","map","noscript","video"];Z.prototype._do_optional_end_element=function(J){var z=null;if(!(J.is_empty_element||!J.is_start_tag||!J.parent)){if(J.tag_name==="body")z=z||this._tag_stack.try_pop("head");else if(J.tag_name==="li")z=z||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(J.tag_name==="dd"||J.tag_name==="dt")z=z||this._tag_stack.try_pop("dt",["dl"]),z=z||this._tag_stack.try_pop("dd",["dl"]);else if(J.parent.tag_name==="p"&&se.indexOf(J.tag_name)!==-1){var X=J.parent.parent;(!X||ue.indexOf(X.tag_name)===-1)&&(z=z||this._tag_stack.try_pop("p"))}else J.tag_name==="rp"||J.tag_name==="rt"?(z=z||this._tag_stack.try_pop("rt",["ruby","rtc"]),z=z||this._tag_stack.try_pop("rp",["ruby","rtc"])):J.tag_name==="optgroup"?z=z||this._tag_stack.try_pop("optgroup",["select"]):J.tag_name==="option"?z=z||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):J.tag_name==="colgroup"?z=z||this._tag_stack.try_pop("caption",["table"]):J.tag_name==="thead"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"])):J.tag_name==="tbody"||J.tag_name==="tfoot"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"]),z=z||this._tag_stack.try_pop("thead",["table"]),z=z||this._tag_stack.try_pop("tbody",["table"])):J.tag_name==="tr"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"]),z=z||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(J.tag_name==="th"||J.tag_name==="td")&&(z=z||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),z=z||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return J.parent=this._tag_stack.get_parser_token(),z}},f.exports.Beautifier=Z},function(f,c,l){var h=l(6).Options;function d(E){h.call(this,E,"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"])}d.prototype=new h,f.exports.Options=d},function(f,c,l){var h=l(9).Tokenizer,d=l(9).TOKEN,E=l(13).Directives,T=l(14).TemplatablePattern,L=l(12).Pattern,x={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:d.START,RAW:d.RAW,EOF:d.EOF},A=new E(/<\!--/,/-->/),O=function(U,N){h.call(this,U,N),this._current_tag_name="";var $=new T(this._input).read_options(this._options),M=new L(this._input);if(this.__patterns={word:$.until(/[\n\r\t <]/),word_control_flow_close_excluded:$.until(/[\n\r\t <}]/),single_quote:$.until_after(/'/),double_quote:$.until_after(/"/),attribute:$.until(/[\n\r\t =>]|\/>/),element_name:$.until(/[\n\r\t >\/]/),angular_control_flow_start:M.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:M.starting_with(/{{!--/).until_after(/--}}/),handlebars:M.starting_with(/{{/).until_after(/}}/),handlebars_open:M.until(/[\n\r\t }]/),handlebars_raw_close:M.until(/}}/),comment:M.starting_with(/<!--/).until_after(/-->/),cdata:M.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:M.starting_with(/<!\[/).until_after(/]>/),processing:M.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 Z=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=M.matching(Z).until_after(Z)}};O.prototype=new h,O.prototype._is_comment=function(U){return!1},O.prototype._is_opening=function(U){return U.type===x.TAG_OPEN||U.type===x.CONTROL_FLOW_OPEN},O.prototype._is_closing=function(U,N){return U.type===x.TAG_CLOSE&&N&&((U.text===">"||U.text==="/>")&&N.text[0]==="<"||U.text==="}}"&&N.text[0]==="{"&&N.text[1]==="{")||U.type===x.CONTROL_FLOW_CLOSE&&U.text==="}"&&N.text.endsWith("{")},O.prototype._reset=function(){this._current_tag_name=""},O.prototype._get_next_token=function(U,N){var $=null;this._readWhitespace();var M=this._input.peek();return M===null?this._create_token(x.EOF,""):($=$||this._read_open_handlebars(M,N),$=$||this._read_attribute(M,U,N),$=$||this._read_close(M,N),$=$||this._read_script_and_style(M,U),$=$||this._read_control_flows(M,N),$=$||this._read_raw_content(M,U,N),$=$||this._read_content_word(M,N),$=$||this._read_comment_or_cdata(M),$=$||this._read_processing(M),$=$||this._read_open(M,N),$=$||this._create_token(x.UNKNOWN,this._input.next()),$)},O.prototype._read_comment_or_cdata=function(U){var N=null,$=null,M=null;if(U==="<"){var Z=this._input.peek(1);Z==="!"&&($=this.__patterns.comment.read(),$?(M=A.get_directives($),M&&M.ignore==="start"&&($+=A.readIgnored(this._input))):$=this.__patterns.cdata.read()),$&&(N=this._create_token(x.COMMENT,$),N.directives=M)}return N},O.prototype._read_processing=function(U){var N=null,$=null,M=null;if(U==="<"){var Z=this._input.peek(1);(Z==="!"||Z==="?")&&($=this.__patterns.conditional_comment.read(),$=$||this.__patterns.processing.read()),$&&(N=this._create_token(x.COMMENT,$),N.directives=M)}return N},O.prototype._read_open=function(U,N){var $=null,M=null;return(!N||N.type===x.CONTROL_FLOW_OPEN)&&U==="<"&&($=this._input.next(),this._input.peek()==="/"&&($+=this._input.next()),$+=this.__patterns.element_name.read(),M=this._create_token(x.TAG_OPEN,$)),M},O.prototype._read_open_handlebars=function(U,N){var $=null,M=null;return(!N||N.type===x.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&U==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?($=this.__patterns.handlebars_comment.read(),$=$||this.__patterns.handlebars.read(),M=this._create_token(x.COMMENT,$)):($=this.__patterns.handlebars_open.read(),M=this._create_token(x.TAG_OPEN,$))),M},O.prototype._read_control_flows=function(U,N){var $="",M=null;if(!this._options.templating.includes("angular"))return M;if(U==="@"){if($=this.__patterns.angular_control_flow_start.read(),$==="")return M;for(var Z=$.endsWith("(")?1:0,q=0;!($.endsWith("{")&&Z===q);){var se=this._input.next();if(se===null)break;se==="("?Z++:se===")"&&q++,$+=se}M=this._create_token(x.CONTROL_FLOW_OPEN,$)}else U==="}"&&N&&N.type===x.CONTROL_FLOW_OPEN&&($=this._input.next(),M=this._create_token(x.CONTROL_FLOW_CLOSE,$));return M},O.prototype._read_close=function(U,N){var $=null,M=null;return N&&N.type===x.TAG_OPEN&&(N.text[0]==="<"&&(U===">"||U==="/"&&this._input.peek(1)===">")?($=this._input.next(),U==="/"&&($+=this._input.next()),M=this._create_token(x.TAG_CLOSE,$)):N.text[0]==="{"&&U==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),M=this._create_token(x.TAG_CLOSE,"}}"))),M},O.prototype._read_attribute=function(U,N,$){var M=null,Z="";if($&&$.text[0]==="<")if(U==="=")M=this._create_token(x.EQUALS,this._input.next());else if(U==='"'||U==="'"){var q=this._input.next();U==='"'?q+=this.__patterns.double_quote.read():q+=this.__patterns.single_quote.read(),M=this._create_token(x.VALUE,q)}else Z=this.__patterns.attribute.read(),Z&&(N.type===x.EQUALS?M=this._create_token(x.VALUE,Z):M=this._create_token(x.ATTRIBUTE,Z));return M},O.prototype._is_content_unformatted=function(U){return this._options.void_elements.indexOf(U)===-1&&(this._options.content_unformatted.indexOf(U)!==-1||this._options.unformatted.indexOf(U)!==-1)},O.prototype._read_raw_content=function(U,N,$){var M="";if($&&$.text[0]==="{")M=this.__patterns.handlebars_raw_close.read();else if(N.type===x.TAG_CLOSE&&N.opened.text[0]==="<"&&N.text[0]!=="/"){var Z=N.opened.text.substr(1).toLowerCase();this._is_content_unformatted(Z)&&(M=this._input.readUntil(new RegExp("</"+Z+"[\\n\\r\\t ]*?>","ig")))}return M?this._create_token(x.TEXT,M):null},O.prototype._read_script_and_style=function(U,N){if(N.type===x.TAG_CLOSE&&N.opened.text[0]==="<"&&N.text[0]!=="/"){var $=N.opened.text.substr(1).toLowerCase();if($==="script"||$==="style"){var M=this._read_comment_or_cdata(U);if(M)return M.type=x.TEXT,M;var Z=this._input.readUntil(new RegExp("</"+$+"[\\n\\r\\t ]*?>","ig"));if(Z)return this._create_token(x.TEXT,Z)}}return null},O.prototype._read_content_word=function(U,N){var $="";return this._options.unformatted_content_delimiter&&U===this._options.unformatted_content_delimiter[0]&&($=this.__patterns.unformatted_content_delimiter.read()),$||($=N&&N.type===x.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),$?this._create_token(x.TEXT,$):null},f.exports.Tokenizer=O,f.exports.TOKEN=x}],v={};function s(f){var c=v[f];if(c!==void 0)return c.exports;var l=v[f]={exports:{}};return F[f](l,l.exports,s),l.exports}var y=s(18);K=y})();var D=K;if(1)I=[b,b(58553),b(87804)],P=function(F){var v=b(58553),s=b(87804);return{html_beautify:function(y,f){return D(y,f,v.js_beautify,s.css_beautify)}}}.apply(ge,I),P!==void 0&&(yt.exports=P);else var w,_})()},58553:function(yt,ge){var b,I;(function(){var P;(function(){"use strict";var D=[function(v,s,y){var f=y(1).Beautifier,c=y(5).Options;function l(h,d){var E=new f(h,d);return E.beautify()}v.exports=l,v.exports.defaultOptions=function(){return new c}},function(v,s,y){var f=y(2).Output,c=y(3).Token,l=y(4),h=y(5).Options,d=y(7).Tokenizer,E=y(7).line_starters,T=y(7).positionable_operators,L=y(7).TOKEN;function x(C,V){return V.indexOf(C)!==-1}function A(C){return C.replace(/^\s+/g,"")}function O(C){for(var V={},ne=0;ne<C.length;ne++)V[C[ne].replace(/-/g,"_")]=C[ne];return V}function U(C,V){return C&&C.type===L.RESERVED&&C.text===V}function N(C,V){return C&&C.type===L.RESERVED&&x(C.text,V)}var $=["case","return","do","if","throw","else","await","break","continue","async"],M=["before-newline","after-newline","preserve-newline"],Z=O(M),q=[Z.before_newline,Z.preserve_newline],se={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function ue(C,V){V.multiline_frame||V.mode===se.ForInitializer||V.mode===se.Conditional||C.remove_indent(V.start_line_index)}function J(C){C=C.replace(l.allLineBreaks,`
|
|
|
`);for(var V=[],ne=C.indexOf(`
|
|
|
`);ne!==-1;)V.push(C.substring(0,ne)),C=C.substring(ne+1),ne=C.indexOf(`
|
|
|
`);return C.length&&V.push(C),V}function z(C){return C===se.ArrayLiteral}function X(C){return x(C,[se.Expression,se.ForInitializer,se.Conditional])}function B(C,V){for(var ne=0;ne<C.length;ne++){var pe=C[ne].trim();if(pe.charAt(0)!==V)return!1}return!0}function G(C,V){for(var ne=0,pe=C.length,Ce;ne<pe;ne++)if(Ce=C[ne],Ce&&Ce.indexOf(V)!==0)return!1;return!0}function W(C,V){V=V||{},this._source_text=C||"",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 h(V)}W.prototype.create_flags=function(C,V){var ne=0;C&&(ne=C.indentation_level,!this._output.just_added_newline()&&C.line_indent_level>ne&&(ne=C.line_indent_level));var pe={mode:V,parent:C,last_token:C?C.last_token:new c(L.START_BLOCK,""),last_word:C?C.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:ne,alignment:0,line_indent_level:C?C.line_indent_level:ne,start_line_index:this._output.get_line_number(),ternary_depth:0};return pe},W.prototype._reset=function(C){var V=C.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new f(this._options,V),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(se.BlockStatement);var ne=new d(C,this._options);return this._tokens=ne.tokenize(),C},W.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var C,V=this._reset(this._source_text),ne=this._options.eol;this._options.eol==="auto"&&(ne=`
|
|
|
`,V&&l.lineBreak.test(V||"")&&(ne=V.match(l.lineBreak)[0]));for(var pe=this._tokens.next();pe;)this.handle_token(pe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=pe,pe=this._tokens.next();return C=this._output.get_code(ne),C},W.prototype.handle_token=function(C,V){C.type===L.START_EXPR?this.handle_start_expr(C):C.type===L.END_EXPR?this.handle_end_expr(C):C.type===L.START_BLOCK?this.handle_start_block(C):C.type===L.END_BLOCK?this.handle_end_block(C):C.type===L.WORD?this.handle_word(C):C.type===L.RESERVED?this.handle_word(C):C.type===L.SEMICOLON?this.handle_semicolon(C):C.type===L.STRING?this.handle_string(C):C.type===L.EQUALS?this.handle_equals(C):C.type===L.OPERATOR?this.handle_operator(C):C.type===L.COMMA?this.handle_comma(C):C.type===L.BLOCK_COMMENT?this.handle_block_comment(C,V):C.type===L.COMMENT?this.handle_comment(C,V):C.type===L.DOT?this.handle_dot(C):C.type===L.EOF?this.handle_eof(C):C.type===L.UNKNOWN?this.handle_unknown(C,V):this.handle_unknown(C,V)},W.prototype.handle_whitespace_and_comments=function(C,V){var ne=C.newlines,pe=this._options.keep_array_indentation&&z(this._flags.mode);if(C.comments_before)for(var Ce=C.comments_before.next();Ce;)this.handle_whitespace_and_comments(Ce,V),this.handle_token(Ce,V),Ce=C.comments_before.next();if(pe)for(var We=0;We<ne;We+=1)this.print_newline(We>0,V);else if(this._options.max_preserve_newlines&&ne>this._options.max_preserve_newlines&&(ne=this._options.max_preserve_newlines),this._options.preserve_newlines&&ne>1){this.print_newline(!1,V);for(var me=1;me<ne;me+=1)this.print_newline(!0,V)}};var k=["async","break","continue","return","throw","yield"];W.prototype.allow_wrap_or_preserved_newline=function(C,V){if(V=V===void 0?!1:V,!this._output.just_added_newline()){var ne=this._options.preserve_newlines&&C.newlines||V,pe=x(this._flags.last_token.text,T)||x(C.text,T);if(pe){var Ce=x(this._flags.last_token.text,T)&&x(this._options.operator_position,q)||x(C.text,T);ne=ne&&Ce}if(ne)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(N(this._flags.last_token,k))return;this._output.set_wrap_point()}}},W.prototype.print_newline=function(C,V){if(!V&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==L.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var ne=this._tokens.peek();this._flags.mode===se.Statement&&!(this._flags.if_block&&U(ne,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(C)&&(this._flags.multiline_frame=!0)},W.prototype.print_token_line_indentation=function(C){this._output.just_added_newline()&&(this._options.keep_array_indentation&&C.newlines&&(C.text==="["||z(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(C.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))},W.prototype.print_token=function(C){if(this._output.raw){this._output.add_raw_token(C);return}if(this._options.comma_first&&C.previous&&C.previous.type===L.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var V=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(V),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(C),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(C),this._output.non_breaking_space=!0,this._output.add_token(C.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},W.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},W.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))},W.prototype.set_mode=function(C){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,C),this._flags=this.create_flags(this._previous_flags,C),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},W.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===se.Statement&&ue(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},W.prototype.start_of_object_property=function(){return this._flags.parent.mode===se.ObjectLiteral&&this._flags.mode===se.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||N(this._flags.last_token,["get","set"]))},W.prototype.start_of_statement=function(C){var V=!1;return V=V||N(this._flags.last_token,["var","let","const"])&&C.type===L.WORD,V=V||U(this._flags.last_token,"do"),V=V||!(this._flags.parent.mode===se.ObjectLiteral&&this._flags.mode===se.Statement)&&N(this._flags.last_token,k)&&!C.newlines,V=V||U(this._flags.last_token,"else")&&!(U(C,"if")&&!C.comments_before),V=V||this._flags.last_token.type===L.END_EXPR&&(this._previous_flags.mode===se.ForInitializer||this._previous_flags.mode===se.Conditional),V=V||this._flags.last_token.type===L.WORD&&this._flags.mode===se.BlockStatement&&!this._flags.in_case&&!(C.text==="--"||C.text==="++")&&this._last_last_text!=="function"&&C.type!==L.WORD&&C.type!==L.RESERVED,V=V||this._flags.mode===se.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||N(this._flags.last_token,["get","set"])),V?(this.set_mode(se.Statement),this.indent(),this.handle_whitespace_and_comments(C,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C,N(C,["do","for","if","while"])),!0):!1},W.prototype.handle_start_expr=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C);var V=se.Expression;if(C.text==="["){if(this._flags.last_token.type===L.WORD||this._flags.last_token.text===")"){N(this._flags.last_token,E)&&(this._output.space_before_token=!0),this.print_token(C),this.set_mode(V),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}V=se.ArrayLiteral,z(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()),x(this._flags.last_token.type,[L.START_EXPR,L.END_EXPR,L.WORD,L.OPERATOR,L.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===L.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,V=se.ForInitializer):x(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,V=se.Conditional):x(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&C.whitespace_before===""?this._output.space_before_token=!1:(x(this._flags.last_token.text,E)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===L.EQUALS||this._flags.last_token.type===L.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C);else if(this._flags.last_token.type===L.WORD){this._output.space_before_token=!1;var ne=this._tokens.peek(-3);if(this._options.space_after_named_function&&ne){var pe=this._tokens.peek(-4);N(ne,["async","function"])||ne.text==="*"&&N(pe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===se.ObjectLiteral?(ne.text==="{"||ne.text===","||ne.text==="*"&&(pe.text==="{"||pe.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(C);(this._flags.last_token.type===L.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(x(this._last_last_text,["function","yield"])||this._flags.mode===se.ObjectLiteral&&x(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===L.START_BLOCK?this.print_newline():(this._flags.last_token.type===L.END_EXPR||this._flags.last_token.type===L.START_EXPR||this._flags.last_token.type===L.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===L.COMMA)&&this.allow_wrap_or_preserved_newline(C,C.newlines),this.print_token(C),this.set_mode(V),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},W.prototype.handle_end_expr=function(C){for(;this._flags.mode===se.Statement;)this.restore_mode();this.handle_whitespace_and_comments(C),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(C,C.text==="]"&&z(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===L.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(C),this.restore_mode(),ue(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===se.Conditional&&(this._previous_flags.mode=se.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},W.prototype.handle_start_block=function(C){this.handle_whitespace_and_comments(C);var V=this._tokens.peek(),ne=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===L.END_EXPR?(this.set_mode(se.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(se.BlockStatement):ne&&(x(ne.text,[":",","])&&x(V.type,[L.STRING,L.WORD,L.RESERVED])||x(V.text,["get","set","..."])&&x(ne.type,[L.WORD,L.RESERVED]))?x(this._last_last_text,["class","interface"])&&!x(ne.text,[":",","])?this.set_mode(se.BlockStatement):this.set_mode(se.ObjectLiteral):this._flags.last_token.type===L.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(se.BlockStatement):x(this._flags.last_token.type,[L.EQUALS,L.START_EXPR,L.COMMA,L.OPERATOR])||N(this._flags.last_token,["return","throw","import","default"])?this.set_mode(se.ObjectLiteral):this.set_mode(se.BlockStatement),this._flags.last_token&&N(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var pe=!V.comments_before&&V.text==="}",Ce=pe&&this._flags.last_word==="function"&&this._flags.last_token.type===L.END_EXPR;if(this._options.brace_preserve_inline){var We=0,me=null;this._flags.inline_frame=!0;do if(We+=1,me=this._tokens.peek(We-1),me.newlines){this._flags.inline_frame=!1;break}while(me.type!==L.EOF&&!(me.type===L.END_BLOCK&&me.opened===C))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&C.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==L.OPERATOR&&(Ce||this._flags.last_token.type===L.EQUALS||N(this._flags.last_token,$)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(z(this._previous_flags.mode)&&(this._flags.last_token.type===L.START_EXPR||this._flags.last_token.type===L.COMMA)&&((this._flags.last_token.type===L.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(C),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==L.OPERATOR&&this._flags.last_token.type!==L.START_EXPR&&(x(this._flags.last_token.type,[L.START_BLOCK,L.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(C),this.indent(),!pe&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},W.prototype.handle_end_block=function(C){for(this.handle_whitespace_and_comments(C);this._flags.mode===se.Statement;)this.restore_mode();var V=this._flags.last_token.type===L.START_BLOCK;this._flags.inline_frame&&!V?this._output.space_before_token=!0:this._options.brace_style==="expand"?V||this.print_newline():V||(z(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(C)},W.prototype.handle_word=function(C){if(C.type===L.RESERVED){if(x(C.text,["set","get"])&&this._flags.mode!==se.ObjectLiteral)C.type=L.WORD;else if(C.text==="import"&&x(this._tokens.peek().text,["(","."]))C.type=L.WORD;else if(x(C.text,["as","from"])&&!this._flags.import_block)C.type=L.WORD;else if(this._flags.mode===se.ObjectLiteral){var V=this._tokens.peek();V.text===":"&&(C.type=L.WORD)}}if(this.start_of_statement(C)?N(this._flags.last_token,["var","let","const"])&&C.type===L.WORD&&(this._flags.declaration_statement=!0):C.newlines&&!X(this._flags.mode)&&(this._flags.last_token.type!==L.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==L.EQUALS&&(this._options.preserve_newlines||!N(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(C),this.print_newline()):this.handle_whitespace_and_comments(C),this._flags.do_block&&!this._flags.do_while)if(U(C,"while")){this._output.space_before_token=!0,this.print_token(C),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&&U(C,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===se.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&N(C,["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(C),this._flags.in_case=!0;return}if((this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR||this._flags.last_token.type===L.EQUALS||this._flags.last_token.type===L.OPERATOR)&&!this.start_of_object_property()&&!(x(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===se.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(C),U(C,"function")){(x(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(x(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===L.OPERATOR))&&!this._output.just_added_blankline()&&!C.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===L.RESERVED||this._flags.last_token.type===L.WORD?N(this._flags.last_token,["get","set","new","export"])||N(this._flags.last_token,k)?this._output.space_before_token=!0:U(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===L.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(X(this._flags.mode)||z(this._flags.mode))||this.print_newline(),this.print_token(C),this._flags.last_word=C.text;return}var ne="NONE";if(this._flags.last_token.type===L.END_BLOCK?this._previous_flags.inline_frame?ne="SPACE":N(C,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&C.newlines?ne="NEWLINE":(ne="SPACE",this._output.space_before_token=!0):ne="NEWLINE":this._flags.last_token.type===L.SEMICOLON&&this._flags.mode===se.BlockStatement?ne="NEWLINE":this._flags.last_token.type===L.SEMICOLON&&X(this._flags.mode)?ne="SPACE":this._flags.last_token.type===L.STRING?ne="NEWLINE":this._flags.last_token.type===L.RESERVED||this._flags.last_token.type===L.WORD||this._flags.last_token.text==="*"&&(x(this._last_last_text,["function","yield"])||this._flags.mode===se.ObjectLiteral&&x(this._last_last_text,["{",","]))?ne="SPACE":this._flags.last_token.type===L.START_BLOCK?this._flags.inline_frame?ne="SPACE":ne="NEWLINE":this._flags.last_token.type===L.END_EXPR&&(this._output.space_before_token=!0,ne="NEWLINE"),N(C,E)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?ne="SPACE":ne="NEWLINE"),N(C,["else","catch","finally"]))if((!(this._flags.last_token.type===L.END_BLOCK&&this._previous_flags.mode===se.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&C.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var pe=this._output.current_line;pe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else ne==="NEWLINE"?N(this._flags.last_token,$)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&N(C,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==L.END_EXPR?(this._flags.last_token.type!==L.START_EXPR||!N(C,["var","let","const"]))&&this._flags.last_token.text!==":"&&(U(C,"if")&&U(C.previous,"else")?this._output.space_before_token=!0:this.print_newline()):N(C,E)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&z(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():ne==="SPACE"&&(this._output.space_before_token=!0);C.previous&&(C.previous.type===L.WORD||C.previous.type===L.RESERVED)&&(this._output.space_before_token=!0),this.print_token(C),this._flags.last_word=C.text,C.type===L.RESERVED&&(C.text==="do"?this._flags.do_block=!0:C.text==="if"?this._flags.if_block=!0:C.text==="import"?this._flags.import_block=!0:this._flags.import_block&&U(C,"from")&&(this._flags.import_block=!1))},W.prototype.handle_semicolon=function(C){this.start_of_statement(C)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(C);for(var V=this._tokens.peek();this._flags.mode===se.Statement&&!(this._flags.if_block&&U(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(C)},W.prototype.handle_string=function(C){C.text.startsWith("`")&&C.newlines===0&&C.whitespace_before===""&&(C.previous.text===")"||this._flags.last_token.type===L.WORD)||(this.start_of_statement(C)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(C),this._flags.last_token.type===L.RESERVED||this._flags.last_token.type===L.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR||this._flags.last_token.type===L.EQUALS||this._flags.last_token.type===L.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C):C.text.startsWith("`")&&this._flags.last_token.type===L.END_EXPR&&(C.previous.text==="]"||C.previous.text===")")&&C.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(C)},W.prototype.handle_equals=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(C),this._output.space_before_token=!0},W.prototype.handle_comma=function(C){this.handle_whitespace_and_comments(C,!0),this.print_token(C),this._output.space_before_token=!0,this._flags.declaration_statement?(X(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(C)):this._flags.mode===se.ObjectLiteral||this._flags.mode===se.Statement&&this._flags.parent.mode===se.ObjectLiteral?(this._flags.mode===se.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(C)},W.prototype.handle_operator=function(C){var V=C.text==="*"&&(N(this._flags.last_token,["function","yield"])||x(this._flags.last_token.type,[L.START_BLOCK,L.COMMA,L.END_BLOCK,L.SEMICOLON])),ne=x(C.text,["-","+"])&&(x(this._flags.last_token.type,[L.START_BLOCK,L.START_EXPR,L.EQUALS,L.OPERATOR])||x(this._flags.last_token.text,E)||this._flags.last_token.text===",");if(!this.start_of_statement(C)){var pe=!V;this.handle_whitespace_and_comments(C,pe)}if(C.text==="*"&&this._flags.last_token.type===L.DOT){this.print_token(C);return}if(C.text==="::"){this.print_token(C);return}if(x(C.text,["-","+"])&&this.start_of_object_property()){this.print_token(C);return}if(this._flags.last_token.type===L.OPERATOR&&x(this._options.operator_position,q)&&this.allow_wrap_or_preserved_newline(C),C.text===":"&&this._flags.in_case){this.print_token(C),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==L.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 Ce=!0,We=!0,me=!1;if(C.text===":"?this._flags.ternary_depth===0?Ce=!1:(this._flags.ternary_depth-=1,me=!0):C.text==="?"&&(this._flags.ternary_depth+=1),!ne&&!V&&this._options.preserve_newlines&&x(C.text,T)){var Ne=C.text===":",Be=Ne&&me,Me=Ne&&!me;switch(this._options.operator_position){case Z.before_newline:this._output.space_before_token=!Me,this.print_token(C),(!Ne||Be)&&this.allow_wrap_or_preserved_newline(C),this._output.space_before_token=!0;return;case Z.after_newline:this._output.space_before_token=!0,!Ne||Be?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(C):this._output.space_before_token=!1,this.print_token(C),this._output.space_before_token=!0;return;case Z.preserve_newline:Me||this.allow_wrap_or_preserved_newline(C),Ce=!(this._output.just_added_newline()||Me),this._output.space_before_token=Ce,this.print_token(C),this._output.space_before_token=!0;return}}if(V){this.allow_wrap_or_preserved_newline(C),Ce=!1;var wt=this._tokens.peek();We=wt&&x(wt.type,[L.WORD,L.RESERVED])}else if(C.text==="...")this.allow_wrap_or_preserved_newline(C),Ce=this._flags.last_token.type===L.START_BLOCK,We=!1;else if(x(C.text,["--","++","!","~"])||ne){if((this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR)&&this.allow_wrap_or_preserved_newline(C),Ce=!1,We=!1,C.newlines&&(C.text==="--"||C.text==="++"||C.text==="~")){var He=N(this._flags.last_token,$)&&C.newlines;He&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(He,!0)}this._flags.last_token.text===";"&&X(this._flags.mode)&&(Ce=!0),this._flags.last_token.type===L.RESERVED?Ce=!0:this._flags.last_token.type===L.END_EXPR?Ce=!(this._flags.last_token.text==="]"&&(C.text==="--"||C.text==="++")):this._flags.last_token.type===L.OPERATOR&&(Ce=x(C.text,["--","-","++","+"])&&x(this._flags.last_token.text,["--","-","++","+"]),x(C.text,["+","-"])&&x(this._flags.last_token.text,["--","++"])&&(We=!0)),(this._flags.mode===se.BlockStatement&&!this._flags.inline_frame||this._flags.mode===se.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Ce,this.print_token(C),this._output.space_before_token=We},W.prototype.handle_block_comment=function(C,V){if(this._output.raw){this._output.add_raw_token(C),C.directives&&C.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(C.directives){this.print_newline(!1,V),this.print_token(C),C.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!l.newline.test(C.text)&&!C.newlines){this._output.space_before_token=!0,this.print_token(C),this._output.space_before_token=!0;return}else this.print_block_commment(C,V)},W.prototype.print_block_commment=function(C,V){var ne=J(C.text),pe,Ce=!1,We=!1,me=C.whitespace_before,Ne=me.length;if(this.print_newline(!1,V),this.print_token_line_indentation(C),this._output.add_token(ne[0]),this.print_newline(!1,V),ne.length>1){for(ne=ne.slice(1),Ce=B(ne,"*"),We=G(ne,me),Ce&&(this._flags.alignment=1),pe=0;pe<ne.length;pe++)Ce?(this.print_token_line_indentation(C),this._output.add_token(A(ne[pe]))):We&&ne[pe]?(this.print_token_line_indentation(C),this._output.add_token(ne[pe].substring(Ne))):(this._output.current_line.set_indent(-1),this._output.add_token(ne[pe])),this.print_newline(!1,V);this._flags.alignment=0}},W.prototype.handle_comment=function(C,V){C.newlines?this.print_newline(!1,V):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(C),this.print_newline(!1,V)},W.prototype.handle_dot=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),N(this._flags.last_token,$)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(C,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(C)},W.prototype.handle_unknown=function(C,V){this.print_token(C),C.text[C.text.length-1]===`
|
|
|
`&&this.print_newline(!1,V)},W.prototype.handle_eof=function(C){for(;this._flags.mode===se.Statement;)this.restore_mode();this.handle_whitespace_and_comments(C)},v.exports.Beautifier=W},function(v){function s(c){this.__parent=c,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=[]}s.prototype.clone_empty=function(){var c=new s(this.__parent);return c.set_indent(this.__indent_count,this.__alignment_count),c},s.prototype.item=function(c){return c<0?this.__items[this.__items.length+c]:this.__items[c]},s.prototype.has_match=function(c){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(c))return!0;return!1},s.prototype.set_indent=function(c,l){this.is_empty()&&(this.__indent_count=c||0,this.__alignment_count=l||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},s.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)},s.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},s.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var c=this.__parent.current_line;return c.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),c.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),c.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,c.__items[0]===" "&&(c.__items.splice(0,1),c.__character_count-=1),!0}return!1},s.prototype.is_empty=function(){return this.__items.length===0},s.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},s.prototype.push=function(c){this.__items.push(c);var l=c.lastIndexOf(`
|
|
|
`);l!==-1?this.__character_count=c.length-l:this.__character_count+=c.length},s.prototype.pop=function(){var c=null;return this.is_empty()||(c=this.__items.pop(),this.__character_count-=c.length),c},s.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},s.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},s.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},s.prototype.toString=function(){var c="";return this.is_empty()?this.__parent.indent_empty_lines&&(c=this.__parent.get_indent_string(this.__indent_count)):(c=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),c+=this.__items.join("")),c};function y(c,l){this.__cache=[""],this.__indent_size=c.indent_size,this.__indent_string=c.indent_char,c.indent_with_tabs||(this.__indent_string=new Array(c.indent_size+1).join(c.indent_char)),l=l||"",c.indent_level>0&&(l=new Array(c.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}y.prototype.get_indent_size=function(c,l){var h=this.__base_string_length;return l=l||0,c<0&&(h=0),h+=c*this.__indent_size,h+=l,h},y.prototype.get_indent_string=function(c,l){var h=this.__base_string;return l=l||0,c<0&&(c=0,h=""),l+=c*this.__indent_size,this.__ensure_cache(l),h+=this.__cache[l],h},y.prototype.__ensure_cache=function(c){for(;c>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var c=this.__cache.length,l=0,h="";this.__indent_size&&c>=this.__indent_size&&(l=Math.floor(c/this.__indent_size),c-=l*this.__indent_size,h=new Array(l+1).join(this.__indent_string)),c&&(h+=new Array(c+1).join(" ")),this.__cache.push(h)};function f(c,l){this.__indent_cache=new y(c,l),this.raw=!1,this._end_with_newline=c.end_with_newline,this.indent_size=c.indent_size,this.wrap_line_length=c.wrap_line_length,this.indent_empty_lines=c.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new s(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}f.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},f.prototype.get_line_number=function(){return this.__lines.length},f.prototype.get_indent_string=function(c,l){return this.__indent_cache.get_indent_string(c,l)},f.prototype.get_indent_size=function(c,l){return this.__indent_cache.get_indent_size(c,l)},f.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},f.prototype.add_new_line=function(c){return this.is_empty()||!c&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},f.prototype.get_code=function(c){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var h=this.__lines.join(`
|
|
|
`);return c!==`
|
|
|
`&&(h=h.replace(/[\n]/g,c)),h},f.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},f.prototype.set_indent=function(c,l){return c=c||0,l=l||0,this.next_line.set_indent(c,l),this.__lines.length>1?(this.current_line.set_indent(c,l),!0):(this.current_line.set_indent(),!1)},f.prototype.add_raw_token=function(c){for(var l=0;l<c.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(c.whitespace_before),this.current_line.push(c.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},f.prototype.add_token=function(c){this.__add_space_before_token(),this.current_line.push(c),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},f.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(" "))},f.prototype.remove_indent=function(c){for(var l=this.__lines.length;c<l;)this.__lines[c]._remove_indent(),c++;this.current_line._remove_wrap_indent()},f.prototype.trim=function(c){for(c=c===void 0?!1:c,this.current_line.trim();c&&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},f.prototype.just_added_newline=function(){return this.current_line.is_empty()},f.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},f.prototype.ensure_empty_line_above=function(c,l){for(var h=this.__lines.length-2;h>=0;){var d=this.__lines[h];if(d.is_empty())break;if(d.item(0).indexOf(c)!==0&&d.item(-1)!==l){this.__lines.splice(h+1,0,new s(this)),this.previous_line=this.__lines[this.__lines.length-2];break}h--}},v.exports.Output=f},function(v){function s(y,f,c,l){this.type=y,this.text=f,this.comments_before=null,this.newlines=c||0,this.whitespace_before=l||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}v.exports.Token=s},function(v,s){var y="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",f="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",c="\\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",l="\\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",h="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",d="(?:"+h+"|["+y+c+"])",E="(?:"+h+"|["+f+c+l+"])*";s.identifier=new RegExp(d+E,"g"),s.identifierStart=new RegExp(d),s.identifierMatch=new RegExp("(?:"+h+"|["+f+c+l+"])+");var T=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;s.newline=/[\n\r\u2028\u2029]/,s.lineBreak=new RegExp(`\r
|
|
|
|`+s.newline.source),s.allLineBreaks=new RegExp(s.lineBreak.source,"g")},function(v,s,y){var f=y(6).Options,c=["before-newline","after-newline","preserve-newline"];function l(h){f.call(this,h,"js");var d=this.raw_options.brace_style||null;d==="expand-strict"?this.raw_options.brace_style="expand":d==="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 E=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var T=0;T<E.length;T++)E[T]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=E[T];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",c),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}l.prototype=new f,v.exports.Options=l},function(v){function s(c,l){this.raw_options=y(c,l),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"])}s.prototype._get_array=function(c,l){var h=this.raw_options[c],d=l||[];return typeof h=="object"?h!==null&&typeof h.concat=="function"&&(d=h.concat()):typeof h=="string"&&(d=h.split(/[^a-zA-Z0-9_\/\-]+/)),d},s.prototype._get_boolean=function(c,l){var h=this.raw_options[c],d=h===void 0?!!l:!!h;return d},s.prototype._get_characters=function(c,l){var h=this.raw_options[c],d=l||"";return typeof h=="string"&&(d=h.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),d},s.prototype._get_number=function(c,l){var h=this.raw_options[c];l=parseInt(l,10),isNaN(l)&&(l=0);var d=parseInt(h,10);return isNaN(d)&&(d=l),d},s.prototype._get_selection=function(c,l,h){var d=this._get_selection_list(c,l,h);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+c+`' can only be one of the following values:
|
|
|
`+l+`
|
|
|
You passed in: '`+this.raw_options[c]+"'");return d[0]},s.prototype._get_selection_list=function(c,l,h){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(h=h||[l[0]],!this._is_valid_selection(h,l))throw new Error("Invalid Default Value!");var d=this._get_array(c,h);if(!this._is_valid_selection(d,l))throw new Error("Invalid Option Value: The option '"+c+`' can contain only the following values:
|
|
|
`+l+`
|
|
|
You passed in: '`+this.raw_options[c]+"'");return d},s.prototype._is_valid_selection=function(c,l){return c.length&&l.length&&!c.some(function(h){return l.indexOf(h)===-1})};function y(c,l){var h={};c=f(c);var d;for(d in c)d!==l&&(h[d]=c[d]);if(l&&c[l])for(d in c[l])h[d]=c[l][d];return h}function f(c){var l={},h;for(h in c){var d=h.replace(/-/g,"_");l[d]=c[h]}return l}v.exports.Options=s,v.exports.normalizeOpts=f,v.exports.mergeOpts=y},function(v,s,y){var f=y(8).InputScanner,c=y(9).Tokenizer,l=y(9).TOKEN,h=y(13).Directives,d=y(4),E=y(12).Pattern,T=y(14).TemplatablePattern;function L(B,G){return G.indexOf(B)!==-1}var x={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:l.START,RAW:l.RAW,EOF:l.EOF},A=new h(/\/\*/,/\*\//),O=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,U=/[0-9]/,N=/[^\d\.]/,$=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),M=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";M=M.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),M="\\?\\.(?!\\d) "+M,M=M.replace(/ /g,"|");var Z=new RegExp(M),q="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),se=q.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),ue=new RegExp("^(?:"+se.join("|")+")$"),J,z=function(B,G){c.call(this,B,G),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var W=new E(this._input),k=new T(this._input).read_options(this._options);this.__patterns={template:k,identifier:k.starting_with(d.identifier).matching(d.identifierMatch),number:W.matching(O),punct:W.matching(Z),comment:W.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:W.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:W.matching(/<!--/),html_comment_end:W.matching(/-->/),include:W.starting_with(/#include/).until_after(d.lineBreak),shebang:W.starting_with(/#!/).until_after(d.lineBreak),xml:W.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:k.until(/['\\\n\r\u2028\u2029]/),double_quote:k.until(/["\\\n\r\u2028\u2029]/),template_text:k.until(/[`\\$]/),template_expression:k.until(/[`}\\]/)}};z.prototype=new c,z.prototype._is_comment=function(B){return B.type===x.COMMENT||B.type===x.BLOCK_COMMENT||B.type===x.UNKNOWN},z.prototype._is_opening=function(B){return B.type===x.START_BLOCK||B.type===x.START_EXPR},z.prototype._is_closing=function(B,G){return(B.type===x.END_BLOCK||B.type===x.END_EXPR)&&G&&(B.text==="]"&&G.text==="["||B.text===")"&&G.text==="("||B.text==="}"&&G.text==="{")},z.prototype._reset=function(){J=!1},z.prototype._get_next_token=function(B,G){var W=null;this._readWhitespace();var k=this._input.peek();return k===null?this._create_token(x.EOF,""):(W=W||this._read_non_javascript(k),W=W||this._read_string(k),W=W||this._read_pair(k,this._input.peek(1)),W=W||this._read_word(B),W=W||this._read_singles(k),W=W||this._read_comment(k),W=W||this._read_regexp(k,B),W=W||this._read_xml(k,B),W=W||this._read_punctuation(),W=W||this._create_token(x.UNKNOWN,this._input.next()),W)},z.prototype._read_word=function(B){var G;if(G=this.__patterns.identifier.read(),G!=="")return G=G.replace(d.allLineBreaks,`
|
|
|
`),!(B.type===x.DOT||B.type===x.RESERVED&&(B.text==="set"||B.text==="get"))&&ue.test(G)?(G==="in"||G==="of")&&(B.type===x.WORD||B.type===x.STRING)?this._create_token(x.OPERATOR,G):this._create_token(x.RESERVED,G):this._create_token(x.WORD,G);if(G=this.__patterns.number.read(),G!=="")return this._create_token(x.WORD,G)},z.prototype._read_singles=function(B){var G=null;return B==="("||B==="["?G=this._create_token(x.START_EXPR,B):B===")"||B==="]"?G=this._create_token(x.END_EXPR,B):B==="{"?G=this._create_token(x.START_BLOCK,B):B==="}"?G=this._create_token(x.END_BLOCK,B):B===";"?G=this._create_token(x.SEMICOLON,B):B==="."&&N.test(this._input.peek(1))?G=this._create_token(x.DOT,B):B===","&&(G=this._create_token(x.COMMA,B)),G&&this._input.next(),G},z.prototype._read_pair=function(B,G){var W=null;return B==="#"&&G==="{"&&(W=this._create_token(x.START_BLOCK,B+G)),W&&(this._input.next(),this._input.next()),W},z.prototype._read_punctuation=function(){var B=this.__patterns.punct.read();if(B!=="")return B==="="?this._create_token(x.EQUALS,B):B==="?."?this._create_token(x.DOT,B):this._create_token(x.OPERATOR,B)},z.prototype._read_non_javascript=function(B){var G="";if(B==="#"){if(this._is_first_token()&&(G=this.__patterns.shebang.read(),G))return this._create_token(x.UNKNOWN,G.trim()+`
|
|
|
`);if(G=this.__patterns.include.read(),G)return this._create_token(x.UNKNOWN,G.trim()+`
|
|
|
`);B=this._input.next();var W="#";if(this._input.hasNext()&&this._input.testChar(U)){do B=this._input.next(),W+=B;while(this._input.hasNext()&&B!=="#"&&B!=="=");return B==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(W+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(W+="{}",this._input.next(),this._input.next())),this._create_token(x.WORD,W)}this._input.back()}else if(B==="<"&&this._is_first_token()){if(G=this.__patterns.html_comment_start.read(),G){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)G+=this._input.next();return J=!0,this._create_token(x.COMMENT,G)}}else if(J&&B==="-"&&(G=this.__patterns.html_comment_end.read(),G))return J=!1,this._create_token(x.COMMENT,G);return null},z.prototype._read_comment=function(B){var G=null;if(B==="/"){var W="";if(this._input.peek(1)==="*"){W=this.__patterns.block_comment.read();var k=A.get_directives(W);k&&k.ignore==="start"&&(W+=A.readIgnored(this._input)),W=W.replace(d.allLineBreaks,`
|
|
|
`),G=this._create_token(x.BLOCK_COMMENT,W),G.directives=k}else this._input.peek(1)==="/"&&(W=this.__patterns.comment.read(),G=this._create_token(x.COMMENT,W))}return G},z.prototype._read_string=function(B){if(B==="`"||B==="'"||B==='"'){var G=this._input.next();return this.has_char_escapes=!1,B==="`"?G+=this._read_string_recursive("`",!0,"${"):G+=this._read_string_recursive(B),this.has_char_escapes&&this._options.unescape_strings&&(G=X(G)),this._input.peek()===B&&(G+=this._input.next()),G=G.replace(d.allLineBreaks,`
|
|
|
`),this._create_token(x.STRING,G)}return null},z.prototype._allow_regexp_or_xml=function(B){return B.type===x.RESERVED&&L(B.text,["return","case","throw","else","do","typeof","yield"])||B.type===x.END_EXPR&&B.text===")"&&B.opened.previous.type===x.RESERVED&&L(B.opened.previous.text,["if","while","for"])||L(B.type,[x.COMMENT,x.START_EXPR,x.START_BLOCK,x.START,x.END_BLOCK,x.OPERATOR,x.EQUALS,x.EOF,x.SEMICOLON,x.COMMA])},z.prototype._read_regexp=function(B,G){if(B==="/"&&this._allow_regexp_or_xml(G)){for(var W=this._input.next(),k=!1,C=!1;this._input.hasNext()&&(k||C||this._input.peek()!==B)&&!this._input.testChar(d.newline);)W+=this._input.peek(),k?k=!1:(k=this._input.peek()==="\\",this._input.peek()==="["?C=!0:this._input.peek()==="]"&&(C=!1)),this._input.next();return this._input.peek()===B&&(W+=this._input.next(),W+=this._input.read(d.identifier)),this._create_token(x.STRING,W)}return null},z.prototype._read_xml=function(B,G){if(this._options.e4x&&B==="<"&&this._allow_regexp_or_xml(G)){var W="",k=this.__patterns.xml.read_match();if(k){for(var C=k[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),V=C.indexOf("{")===0,ne=0;k;){var pe=!!k[1],Ce=k[2],We=!!k[k.length-1]||Ce.slice(0,8)==="![CDATA[";if(!We&&(Ce===C||V&&Ce.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(pe?--ne:++ne),W+=k[0],ne<=0)break;k=this.__patterns.xml.read_match()}return k||(W+=this._input.match(/[\s\S]*/g)[0]),W=W.replace(d.allLineBreaks,`
|
|
|
`),this._create_token(x.STRING,W)}}return null};function X(B){for(var G="",W=0,k=new f(B),C=null;k.hasNext();)if(C=k.match(/([\s]|[^\\]|\\\\)+/g),C&&(G+=C[0]),k.peek()==="\\"){if(k.next(),k.peek()==="x")C=k.match(/x([0-9A-Fa-f]{2})/g);else if(k.peek()==="u")C=k.match(/u([0-9A-Fa-f]{4})/g),C||(C=k.match(/u\{([0-9A-Fa-f]+)\}/g));else{G+="\\",k.hasNext()&&(G+=k.next());continue}if(!C||(W=parseInt(C[1],16),W>126&&W<=255&&C[0].indexOf("x")===0))return B;W>=0&&W<32||W>1114111?G+="\\"+C[0]:W===34||W===39||W===92?G+="\\"+String.fromCharCode(W):G+=String.fromCharCode(W)}return G}z.prototype._read_string_recursive=function(B,G,W){var k,C;B==="'"?C=this.__patterns.single_quote:B==='"'?C=this.__patterns.double_quote:B==="`"?C=this.__patterns.template_text:B==="}"&&(C=this.__patterns.template_expression);for(var V=C.read(),ne="";this._input.hasNext();){if(ne=this._input.next(),ne===B||!G&&d.newline.test(ne)){this._input.back();break}else ne==="\\"&&this._input.hasNext()?(k=this._input.peek(),k==="x"||k==="u"?this.has_char_escapes=!0:k==="\r"&&this._input.peek(1)===`
|
|
|
`&&this._input.next(),ne+=this._input.next()):W&&(W==="${"&&ne==="$"&&this._input.peek()==="{"&&(ne+=this._input.next()),W===ne&&(B==="`"?ne+=this._read_string_recursive("}",G,"`"):ne+=this._read_string_recursive("`",G,"${"),this._input.hasNext()&&(ne+=this._input.next())));ne+=C.read(),V+=ne}return V},v.exports.Tokenizer=z,v.exports.TOKEN=x,v.exports.positionable_operators=$.slice(),v.exports.line_starters=q.slice()},function(v){var s=RegExp.prototype.hasOwnProperty("sticky");function y(f){this.__input=f||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__input.charAt(this.__position),this.__position+=1),f},y.prototype.peek=function(f){var c=null;return f=f||0,f+=this.__position,f>=0&&f<this.__input_length&&(c=this.__input.charAt(f)),c},y.prototype.__match=function(f,c){f.lastIndex=c;var l=f.exec(this.__input);return l&&!(s&&f.sticky)&&l.index!==c&&(l=null),l},y.prototype.test=function(f,c){return c=c||0,c+=this.__position,c>=0&&c<this.__input_length?!!this.__match(f,c):!1},y.prototype.testChar=function(f,c){var l=this.peek(c);return f.lastIndex=0,l!==null&&f.test(l)},y.prototype.match=function(f){var c=this.__match(f,this.__position);return c?this.__position+=c[0].length:c=null,c},y.prototype.read=function(f,c,l){var h="",d;return f&&(d=this.match(f),d&&(h+=d[0])),c&&(d||!f)&&(h+=this.readUntil(c,l)),h},y.prototype.readUntil=function(f,c){var l="",h=this.__position;f.lastIndex=this.__position;var d=f.exec(this.__input);return d?(h=d.index,c&&(h+=d[0].length)):h=this.__input_length,l=this.__input.substring(this.__position,h),this.__position=h,l},y.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},y.prototype.get_regexp=function(f,c){var l=null,h="g";return c&&s&&(h="y"),typeof f=="string"&&f!==""?l=new RegExp(f,h):f&&(l=new RegExp(f.source,h)),l},y.prototype.get_literal_regexp=function(f){return RegExp(f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(f){var c=this.__position,l=this.readUntilAfter(f);return this.__position=c,l},y.prototype.lookBack=function(f){var c=this.__position-1;return c>=f.length&&this.__input.substring(c-f.length,c).toLowerCase()===f},v.exports.InputScanner=y},function(v,s,y){var f=y(8).InputScanner,c=y(3).Token,l=y(10).TokenStream,h=y(11).WhitespacePattern,d={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},E=function(T,L){this._input=new f(T),this._options=L||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new h(this._input)};E.prototype.tokenize=function(){this._input.restart(),this.__tokens=new l,this._reset();for(var T,L=new c(d.START,""),x=null,A=[],O=new l;L.type!==d.EOF;){for(T=this._get_next_token(L,x);this._is_comment(T);)O.add(T),T=this._get_next_token(L,x);O.isEmpty()||(T.comments_before=O,O=new l),T.parent=x,this._is_opening(T)?(A.push(x),x=T):x&&this._is_closing(T,x)&&(T.opened=x,x.closed=T,x=A.pop(),T.parent=x),T.previous=L,L.next=T,this.__tokens.add(T),L=T}return this.__tokens},E.prototype._is_first_token=function(){return this.__tokens.isEmpty()},E.prototype._reset=function(){},E.prototype._get_next_token=function(T,L){this._readWhitespace();var x=this._input.read(/.+/g);return x?this._create_token(d.RAW,x):this._create_token(d.EOF,"")},E.prototype._is_comment=function(T){return!1},E.prototype._is_opening=function(T){return!1},E.prototype._is_closing=function(T,L){return!1},E.prototype._create_token=function(T,L){var x=new c(T,L,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return x},E.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},v.exports.Tokenizer=E,v.exports.TOKEN=d},function(v){function s(y){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=y}s.prototype.restart=function(){this.__position=0},s.prototype.isEmpty=function(){return this.__tokens_length===0},s.prototype.hasNext=function(){return this.__position<this.__tokens_length},s.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__tokens[this.__position],this.__position+=1),y},s.prototype.peek=function(y){var f=null;return y=y||0,y+=this.__position,y>=0&&y<this.__tokens_length&&(f=this.__tokens[y]),f},s.prototype.add=function(y){this.__parent_token&&(y.parent=this.__parent_token),this.__tokens.push(y),this.__tokens_length+=1},v.exports.TokenStream=s},function(v,s,y){var f=y(12).Pattern;function c(l,h){f.call(this,l,h),h?this._line_regexp=this._input.get_regexp(h._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}c.prototype=new f,c.prototype.__set_whitespace_patterns=function(l,h){l+="\\t ",h+="\\n\\r",this._match_pattern=this._input.get_regexp("["+l+h+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+h+"]")},c.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var l=this._input.read(this._match_pattern);if(l===" ")this.whitespace_before_token=" ";else if(l){var h=this.__split(this._newline_regexp,l);this.newline_count=h.length-1,this.whitespace_before_token=h[this.newline_count]}return l},c.prototype.matching=function(l,h){var d=this._create();return d.__set_whitespace_patterns(l,h),d._update(),d},c.prototype._create=function(){return new c(this._input,this)},c.prototype.__split=function(l,h){l.lastIndex=0;for(var d=0,E=[],T=l.exec(h);T;)E.push(h.substring(d,T.index)),d=T.index+T[0].length,T=l.exec(h);return d<h.length?E.push(h.substring(d,h.length)):E.push(""),E},v.exports.WhitespacePattern=c},function(v){function s(y,f){this._input=y,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,f&&(this._starting_pattern=this._input.get_regexp(f._starting_pattern,!0),this._match_pattern=this._input.get_regexp(f._match_pattern,!0),this._until_pattern=this._input.get_regexp(f._until_pattern),this._until_after=f._until_after)}s.prototype.read=function(){var y=this._input.read(this._starting_pattern);return(!this._starting_pattern||y)&&(y+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),y},s.prototype.read_match=function(){return this._input.match(this._match_pattern)},s.prototype.until_after=function(y){var f=this._create();return f._until_after=!0,f._until_pattern=this._input.get_regexp(y),f._update(),f},s.prototype.until=function(y){var f=this._create();return f._until_after=!1,f._until_pattern=this._input.get_regexp(y),f._update(),f},s.prototype.starting_with=function(y){var f=this._create();return f._starting_pattern=this._input.get_regexp(y,!0),f._update(),f},s.prototype.matching=function(y){var f=this._create();return f._match_pattern=this._input.get_regexp(y,!0),f._update(),f},s.prototype._create=function(){return new s(this._input,this)},s.prototype._update=function(){},v.exports.Pattern=s},function(v){function s(y,f){y=typeof y=="string"?y:y.source,f=typeof f=="string"?f:f.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+f,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+f,"g")}s.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var f={};this.__directive_pattern.lastIndex=0;for(var c=this.__directive_pattern.exec(y);c;)f[c[1]]=c[2],c=this.__directive_pattern.exec(y);return f},s.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},v.exports.Directives=s},function(v,s,y){var f=y(12).Pattern,c={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function l(h,d){f.call(this,h,d),this.__template_pattern=null,this._disabled=Object.assign({},c),this._excluded=Object.assign({},c),d&&(this.__template_pattern=this._input.get_regexp(d.__template_pattern),this._excluded=Object.assign(this._excluded,d._excluded),this._disabled=Object.assign(this._disabled,d._disabled));var E=new f(h);this.__patterns={handlebars_comment:E.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:E.starting_with(/{{{/).until_after(/}}}/),handlebars:E.starting_with(/{{/).until_after(/}}/),php:E.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:E.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:E.starting_with(/{%/).until_after(/%}/),django_value:E.starting_with(/{{/).until_after(/}}/),django_comment:E.starting_with(/{#/).until_after(/#}/),smarty:E.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:E.starting_with(/{\*/).until_after(/\*}/),smarty_literal:E.starting_with(/{literal}/).until_after(/{\/literal}/)}}l.prototype=new f,l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){this.__set_templated_pattern()},l.prototype.disable=function(h){var d=this._create();return d._disabled[h]=!0,d._update(),d},l.prototype.read_options=function(h){var d=this._create();for(var E in c)d._disabled[E]=h.templating.indexOf(E)===-1;return d._update(),d},l.prototype.exclude=function(h){var d=this._create();return d._excluded[h]=!0,d._update(),d},l.prototype.read=function(){var h="";this._match_pattern?h=this._input.read(this._starting_pattern):h=this._input.read(this._starting_pattern,this.__template_pattern);for(var d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),h+=d,d=this._read_template();return this._until_after&&(h+=this._input.readUntilAfter(this._until_pattern)),h},l.prototype.__set_templated_pattern=function(){var h=[];this._disabled.php||h.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||h.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||h.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||h.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(h.push(this.__patterns.django._starting_pattern.source),h.push(this.__patterns.django_value._starting_pattern.source),h.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||h.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&h.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+h.join("|")+")")},l.prototype._read_template=function(){var h="",d=this._input.peek();if(d==="<"){var E=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&E==="?"&&(h=h||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&E==="%"&&(h=h||this.__patterns.erb.read())}else d==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(h=h||this.__patterns.handlebars_comment.read(),h=h||this.__patterns.handlebars_unescaped.read(),h=h||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(h=h||this.__patterns.django_value.read()),this._excluded.django||(h=h||this.__patterns.django_comment.read(),h=h||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(h=h||this.__patterns.smarty_comment.read(),h=h||this.__patterns.smarty_literal.read(),h=h||this.__patterns.smarty.read()));return h},v.exports.TemplatablePattern=l}],w={};function _(v){var s=w[v];if(s!==void 0)return s.exports;var y=w[v]={exports:{}};return D[v](y,y.exports,_),y.exports}var F=_(0);P=F})();var K=P;b=[],I=function(){return{js_beautify:K}}.apply(ge,b),I!==void 0&&(yt.exports=I)})()},32834:function(yt){(function(ge,b){yt.exports=b()})(this,function(){"use strict";function ge(Se,_e){for(var ve=0;ve<_e.length;ve++){var ee=_e[ve];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(Se,ee.key,ee)}}function b(Se,_e,ve){return _e&&ge(Se.prototype,_e),ve&&ge(Se,ve),Se}function I(Se,_e){if(Se){if(typeof Se=="string")return P(Se,_e);var ve=Object.prototype.toString.call(Se).slice(8,-1);if(ve==="Object"&&Se.constructor&&(ve=Se.constructor.name),ve==="Map"||ve==="Set")return Array.from(Se);if(ve==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ve))return P(Se,_e)}}function P(Se,_e){(_e==null||_e>Se.length)&&(_e=Se.length);for(var ve=0,ee=new Array(_e);ve<_e;ve++)ee[ve]=Se[ve];return ee}function K(Se,_e){var ve=typeof Symbol!="undefined"&&Se[Symbol.iterator]||Se["@@iterator"];if(ve)return(ve=ve.call(Se)).next.bind(ve);if(Array.isArray(Se)||(ve=I(Se))||_e&&Se&&typeof Se.length=="number"){ve&&(Se=ve);var ee=0;return function(){return ee>=Se.length?{done:!0}:{done:!1,value:Se[ee++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var D={exports:{}};function w(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function _(Se){D.exports.defaults=Se}D.exports={defaults:w(),getDefaults:w,changeDefaults:_};var F=/[&<>"']/,v=/[&<>"']/g,s=/[<>"']|&(?!#?\w+;)/,y=/[<>"']|&(?!#?\w+;)/g,f={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(_e){return f[_e]};function l(Se,_e){if(_e){if(F.test(Se))return Se.replace(v,c)}else if(s.test(Se))return Se.replace(y,c);return Se}var h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function d(Se){return Se.replace(h,function(_e,ve){return ve=ve.toLowerCase(),ve==="colon"?":":ve.charAt(0)==="#"?ve.charAt(1)==="x"?String.fromCharCode(parseInt(ve.substring(2),16)):String.fromCharCode(+ve.substring(1)):""})}var E=/(^|[^\[])\^/g;function T(Se,_e){Se=Se.source||Se,_e=_e||"";var ve={replace:function(ie,oe){return oe=oe.source||oe,oe=oe.replace(E,"$1"),Se=Se.replace(ie,oe),ve},getRegex:function(){return new RegExp(Se,_e)}};return ve}var L=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(Se,_e,ve){if(Se){var ee;try{ee=decodeURIComponent(d(ve)).replace(L,"").toLowerCase()}catch(ie){return null}if(ee.indexOf("javascript:")===0||ee.indexOf("vbscript:")===0||ee.indexOf("data:")===0)return null}_e&&!x.test(ve)&&(ve=M(_e,ve));try{ve=encodeURI(ve).replace(/%25/g,"%")}catch(ie){return null}return ve}var O={},U=/^[^:]+:\/*[^/]*$/,N=/^([^:]+:)[\s\S]*$/,$=/^([^:]+:\/*[^/]*)[\s\S]*$/;function M(Se,_e){O[" "+Se]||(U.test(Se)?O[" "+Se]=Se+"/":O[" "+Se]=ue(Se,"/",!0)),Se=O[" "+Se];var ve=Se.indexOf(":")===-1;return _e.substring(0,2)==="//"?ve?_e:Se.replace(N,"$1")+_e:_e.charAt(0)==="/"?ve?_e:Se.replace($,"$1")+_e:Se+_e}var Z={exec:function(){}};function q(Se){for(var _e=1,ve,ee;_e<arguments.length;_e++){ve=arguments[_e];for(ee in ve)Object.prototype.hasOwnProperty.call(ve,ee)&&(Se[ee]=ve[ee])}return Se}function se(Se,_e){var ve=Se.replace(/\|/g,function(oe,he,de){for(var Je=!1,et=he;--et>=0&&de[et]==="\\";)Je=!Je;return Je?"|":" |"}),ee=ve.split(/ \|/),ie=0;if(ee.length>_e)ee.splice(_e);else for(;ee.length<_e;)ee.push("");for(;ie<ee.length;ie++)ee[ie]=ee[ie].trim().replace(/\\\|/g,"|");return ee}function ue(Se,_e,ve){var ee=Se.length;if(ee===0)return"";for(var ie=0;ie<ee;){var oe=Se.charAt(ee-ie-1);if(oe===_e&&!ve)ie++;else if(oe!==_e&&ve)ie++;else break}return Se.substr(0,ee-ie)}function J(Se,_e){if(Se.indexOf(_e[1])===-1)return-1;for(var ve=Se.length,ee=0,ie=0;ie<ve;ie++)if(Se[ie]==="\\")ie++;else if(Se[ie]===_e[0])ee++;else if(Se[ie]===_e[1]&&(ee--,ee<0))return ie;return-1}function z(Se){Se&&Se.sanitize&&!Se.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function X(Se,_e){if(_e<1)return"";for(var ve="";_e>1;)_e&1&&(ve+=Se),_e>>=1,Se+=Se;return ve+Se}var B={escape:l,unescape:d,edit:T,cleanUrl:A,resolveUrl:M,noopTest:Z,merge:q,splitCells:se,rtrim:ue,findClosingBracket:J,checkSanitizeDeprecation:z,repeatString:X},G=D.exports.defaults,W=B.rtrim,k=B.splitCells,C=B.escape,V=B.findClosingBracket;function ne(Se,_e,ve){var ee=_e.href,ie=_e.title?C(_e.title):null,oe=Se[1].replace(/\\([\[\]])/g,"$1");return Se[0].charAt(0)!=="!"?{type:"link",raw:ve,href:ee,title:ie,text:oe}:{type:"image",raw:ve,href:ee,title:ie,text:C(oe)}}function pe(Se,_e){var ve=Se.match(/^(\s+)(?:```)/);if(ve===null)return _e;var ee=ve[1];return _e.split(`
|
|
|
`).map(function(ie){var oe=ie.match(/^\s+/);if(oe===null)return ie;var he=oe[0];return he.length>=ee.length?ie.slice(ee.length):ie}).join(`
|
|
|
`)}var Ce=function(){function Se(ve){this.options=ve||G}var _e=Se.prototype;return _e.space=function(ee){var ie=this.rules.block.newline.exec(ee);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
|
|
|
`}},_e.code=function(ee){var ie=this.rules.block.code.exec(ee);if(ie){var oe=ie[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:ie[0],codeBlockStyle:"indented",text:this.options.pedantic?oe:W(oe,`
|
|
|
`)}}},_e.fences=function(ee){var ie=this.rules.block.fences.exec(ee);if(ie){var oe=ie[0],he=pe(oe,ie[3]||"");return{type:"code",raw:oe,lang:ie[2]?ie[2].trim():ie[2],text:he}}},_e.heading=function(ee){var ie=this.rules.block.heading.exec(ee);if(ie){var oe=ie[2].trim();if(/#$/.test(oe)){var he=W(oe,"#");(this.options.pedantic||!he||/ $/.test(he))&&(oe=he.trim())}return{type:"heading",raw:ie[0],depth:ie[1].length,text:oe}}},_e.nptable=function(ee){var ie=this.rules.block.nptable.exec(ee);if(ie){var oe={type:"table",header:k(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
|
`):[],raw:ie[0]};if(oe.header.length===oe.align.length){var he=oe.align.length,de;for(de=0;de<he;de++)/^ *-+: *$/.test(oe.align[de])?oe.align[de]="right":/^ *:-+: *$/.test(oe.align[de])?oe.align[de]="center":/^ *:-+ *$/.test(oe.align[de])?oe.align[de]="left":oe.align[de]=null;for(he=oe.cells.length,de=0;de<he;de++)oe.cells[de]=k(oe.cells[de],oe.header.length);return oe}}},_e.hr=function(ee){var ie=this.rules.block.hr.exec(ee);if(ie)return{type:"hr",raw:ie[0]}},_e.blockquote=function(ee){var ie=this.rules.block.blockquote.exec(ee);if(ie){var oe=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:oe}}},_e.list=function(ee){var ie=this.rules.block.list.exec(ee);if(ie){var oe=ie[0],he=ie[2],de=he.length>1,Je={type:"list",raw:oe,ordered:de,start:de?+he.slice(0,-1):"",loose:!1,items:[]},et=ie[0].match(this.rules.block.item),ht=!1,gt,Ot,qt,Ut,Lt,oi,fi,Qt,si,tt=et.length;qt=this.rules.block.listItemStart.exec(et[0]);for(var Ve=0;Ve<tt;Ve++){if(gt=et[Ve],oe=gt,this.options.pedantic||(si=gt.match(new RegExp("\\n\\s*\\n {0,"+(qt[0].length-1)+"}\\S")),si&&(Lt=gt.length-si.index+et.slice(Ve+1).join(`
|
|
|
`).length,Je.raw=Je.raw.substring(0,Je.raw.length-Lt),gt=gt.substring(0,si.index),oe=gt,tt=Ve+1)),Ve!==tt-1){if(Ut=this.rules.block.listItemStart.exec(et[Ve+1]),this.options.pedantic?Ut[1].length>qt[1].length:Ut[1].length>=qt[0].length||Ut[1].length>3){et.splice(Ve,2,et[Ve]+(!this.options.pedantic&&Ut[1].length<qt[0].length&&!et[Ve].match(/\n$/)?"":`
|
|
|
`)+et[Ve+1]),Ve--,tt--;continue}else(!this.options.pedantic||this.options.smartLists?Ut[2][Ut[2].length-1]!==he[he.length-1]:de===(Ut[2].length===1))&&(Lt=et.slice(Ve+1).join(`
|
|
|
`).length,Je.raw=Je.raw.substring(0,Je.raw.length-Lt),Ve=tt-1);qt=Ut}Ot=gt.length,gt=gt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~gt.indexOf(`
|
|
|
`)&&(Ot-=gt.length,gt=this.options.pedantic?gt.replace(/^ {1,4}/gm,""):gt.replace(new RegExp("^ {1,"+Ot+"}","gm"),"")),gt=W(gt,`
|
|
|
`),Ve!==tt-1&&(oe=oe+`
|
|
|
`),oi=ht||/\n\n(?!\s*$)/.test(oe),Ve!==tt-1&&(ht=oe.slice(-2)===`
|
|
|
|
|
|
`,oi||(oi=ht)),oi&&(Je.loose=!0),this.options.gfm&&(fi=/^\[[ xX]\] /.test(gt),Qt=void 0,fi&&(Qt=gt[1]!==" ",gt=gt.replace(/^\[[ xX]\] +/,""))),Je.items.push({type:"list_item",raw:oe,task:fi,checked:Qt,loose:oi,text:gt})}return Je}},_e.html=function(ee){var ie=this.rules.block.html.exec(ee);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):C(ie[0]):ie[0]}},_e.def=function(ee){var ie=this.rules.block.def.exec(ee);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var oe=ie[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:oe,raw:ie[0],href:ie[2],title:ie[3]}}},_e.table=function(ee){var ie=this.rules.block.table.exec(ee);if(ie){var oe={type:"table",header:k(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
|
`):[]};if(oe.header.length===oe.align.length){oe.raw=ie[0];var he=oe.align.length,de;for(de=0;de<he;de++)/^ *-+: *$/.test(oe.align[de])?oe.align[de]="right":/^ *:-+: *$/.test(oe.align[de])?oe.align[de]="center":/^ *:-+ *$/.test(oe.align[de])?oe.align[de]="left":oe.align[de]=null;for(he=oe.cells.length,de=0;de<he;de++)oe.cells[de]=k(oe.cells[de].replace(/^ *\| *| *\| *$/g,""),oe.header.length);return oe}}},_e.lheading=function(ee){var ie=this.rules.block.lheading.exec(ee);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},_e.paragraph=function(ee){var ie=this.rules.block.paragraph.exec(ee);if(ie)return{type:"paragraph",raw:ie[0],text:ie[1].charAt(ie[1].length-1)===`
|
|
|
`?ie[1].slice(0,-1):ie[1]}},_e.text=function(ee){var ie=this.rules.block.text.exec(ee);if(ie)return{type:"text",raw:ie[0],text:ie[0]}},_e.escape=function(ee){var ie=this.rules.inline.escape.exec(ee);if(ie)return{type:"escape",raw:ie[0],text:C(ie[1])}},_e.tag=function(ee,ie,oe){var he=this.rules.inline.tag.exec(ee);if(he)return!ie&&/^<a /i.test(he[0])?ie=!0:ie&&/^<\/a>/i.test(he[0])&&(ie=!1),!oe&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?oe=!0:oe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(oe=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:ie,inRawBlock:oe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):C(he[0]):he[0]}},_e.link=function(ee){var ie=this.rules.inline.link.exec(ee);if(ie){var oe=ie[2].trim();if(!this.options.pedantic&&/^</.test(oe)){if(!/>$/.test(oe))return;var he=W(oe.slice(0,-1),"\\");if((oe.length-he.length)%2===0)return}else{var de=V(ie[2],"()");if(de>-1){var Je=ie[0].indexOf("!")===0?5:4,et=Je+ie[1].length+de;ie[2]=ie[2].substring(0,de),ie[0]=ie[0].substring(0,et).trim(),ie[3]=""}}var ht=ie[2],gt="";if(this.options.pedantic){var Ot=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ht);Ot&&(ht=Ot[1],gt=Ot[3])}else gt=ie[3]?ie[3].slice(1,-1):"";return ht=ht.trim(),/^</.test(ht)&&(this.options.pedantic&&!/>$/.test(oe)?ht=ht.slice(1):ht=ht.slice(1,-1)),ne(ie,{href:ht&&ht.replace(this.rules.inline._escapes,"$1"),title:gt&>.replace(this.rules.inline._escapes,"$1")},ie[0])}},_e.reflink=function(ee,ie){var oe;if((oe=this.rules.inline.reflink.exec(ee))||(oe=this.rules.inline.nolink.exec(ee))){var he=(oe[2]||oe[1]).replace(/\s+/g," ");if(he=ie[he.toLowerCase()],!he||!he.href){var de=oe[0].charAt(0);return{type:"text",raw:de,text:de}}return ne(oe,he,oe[0])}},_e.emStrong=function(ee,ie,oe){oe===void 0&&(oe="");var he=this.rules.inline.emStrong.lDelim.exec(ee);if(he&&!(he[3]&&oe.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var de=he[1]||he[2]||"";if(!de||de&&(oe===""||this.rules.inline.punctuation.exec(oe))){var Je=he[0].length-1,et,ht,gt=Je,Ot=0,qt=he[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(qt.lastIndex=0,ie=ie.slice(-1*ee.length+Je);(he=qt.exec(ie))!=null;)if(et=he[1]||he[2]||he[3]||he[4]||he[5]||he[6],!!et){if(ht=et.length,he[3]||he[4]){gt+=ht;continue}else if((he[5]||he[6])&&Je%3&&!((Je+ht)%3)){Ot+=ht;continue}if(gt-=ht,!(gt>0))return ht=Math.min(ht,ht+gt+Ot),Math.min(Je,ht)%2?{type:"em",raw:ee.slice(0,Je+he.index+ht+1),text:ee.slice(1,Je+he.index+ht)}:{type:"strong",raw:ee.slice(0,Je+he.index+ht+1),text:ee.slice(2,Je+he.index+ht-1)}}}}},_e.codespan=function(ee){var ie=this.rules.inline.code.exec(ee);if(ie){var oe=ie[2].replace(/\n/g," "),he=/[^ ]/.test(oe),de=/^ /.test(oe)&&/ $/.test(oe);return he&&de&&(oe=oe.substring(1,oe.length-1)),oe=C(oe,!0),{type:"codespan",raw:ie[0],text:oe}}},_e.br=function(ee){var ie=this.rules.inline.br.exec(ee);if(ie)return{type:"br",raw:ie[0]}},_e.del=function(ee){var ie=this.rules.inline.del.exec(ee);if(ie)return{type:"del",raw:ie[0],text:ie[2]}},_e.autolink=function(ee,ie){var oe=this.rules.inline.autolink.exec(ee);if(oe){var he,de;return oe[2]==="@"?(he=C(this.options.mangle?ie(oe[1]):oe[1]),de="mailto:"+he):(he=C(oe[1]),de=he),{type:"link",raw:oe[0],text:he,href:de,tokens:[{type:"text",raw:he,text:he}]}}},_e.url=function(ee,ie){var oe;if(oe=this.rules.inline.url.exec(ee)){var he,de;if(oe[2]==="@")he=C(this.options.mangle?ie(oe[0]):oe[0]),de="mailto:"+he;else{var Je;do Je=oe[0],oe[0]=this.rules.inline._backpedal.exec(oe[0])[0];while(Je!==oe[0]);he=C(oe[0]),oe[1]==="www."?de="http://"+he:de=he}return{type:"link",raw:oe[0],text:he,href:de,tokens:[{type:"text",raw:he,text:he}]}}},_e.inlineText=function(ee,ie,oe){var he=this.rules.inline.text.exec(ee);if(he){var de;return ie?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):C(he[0]):he[0]:de=C(this.options.smartypants?oe(he[0]):he[0]),{type:"text",raw:he[0],text:de}}},Se}(),We=B.noopTest,me=B.edit,Ne=B.merge,Be={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:We,table:We,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};Be._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Be._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Be.def=me(Be.def).replace("label",Be._label).replace("title",Be._title).getRegex(),Be.bullet=/(?:[*+-]|\d{1,9}[.)])/,Be.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Be.item=me(Be.item,"gm").replace(/bull/g,Be.bullet).getRegex(),Be.listItemStart=me(/^( *)(bull) */).replace("bull",Be.bullet).getRegex(),Be.list=me(Be.list).replace(/bull/g,Be.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Be.def.source+")").getRegex(),Be._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Be._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Be.html=me(Be.html,"i").replace("comment",Be._comment).replace("tag",Be._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Be.paragraph=me(Be._paragraph).replace("hr",Be.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Be._tag).getRegex(),Be.blockquote=me(Be.blockquote).replace("paragraph",Be.paragraph).getRegex(),Be.normal=Ne({},Be),Be.gfm=Ne({},Be.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Be.gfm.nptable=me(Be.gfm.nptable).replace("hr",Be.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Be._tag).getRegex(),Be.gfm.table=me(Be.gfm.table).replace("hr",Be.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Be._tag).getRegex(),Be.pedantic=Ne({},Be.normal,{html:me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Be._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:We,paragraph:me(Be.normal._paragraph).replace("hr",Be.hr).replace("heading",` *#{1,6} *[^
|
|
|
]`).replace("lheading",Be.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:We,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/\_\_[^_*]*?\*[^_*]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/\*\*[^_*]*?\_[^_*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:We,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};Me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Me.punctuation=me(Me.punctuation).replace(/punctuation/g,Me._punctuation).getRegex(),Me.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,Me.escapedEmSt=/\\\*|\\_/g,Me._comment=me(Be._comment).replace("(?:-->|$)","-->").getRegex(),Me.emStrong.lDelim=me(Me.emStrong.lDelim).replace(/punct/g,Me._punctuation).getRegex(),Me.emStrong.rDelimAst=me(Me.emStrong.rDelimAst,"g").replace(/punct/g,Me._punctuation).getRegex(),Me.emStrong.rDelimUnd=me(Me.emStrong.rDelimUnd,"g").replace(/punct/g,Me._punctuation).getRegex(),Me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Me._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,Me.autolink=me(Me.autolink).replace("scheme",Me._scheme).replace("email",Me._email).getRegex(),Me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Me.tag=me(Me.tag).replace("comment",Me._comment).replace("attribute",Me._attribute).getRegex(),Me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Me._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Me.link=me(Me.link).replace("label",Me._label).replace("href",Me._href).replace("title",Me._title).getRegex(),Me.reflink=me(Me.reflink).replace("label",Me._label).getRegex(),Me.reflinkSearch=me(Me.reflinkSearch,"g").replace("reflink",Me.reflink).replace("nolink",Me.nolink).getRegex(),Me.normal=Ne({},Me),Me.pedantic=Ne({},Me.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:me(/^!?\[(label)\]\((.*?)\)/).replace("label",Me._label).getRegex(),reflink:me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Me._label).getRegex()}),Me.gfm=Ne({},Me.normal,{escape:me(Me.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Me.gfm.url=me(Me.gfm.url,"i").replace("email",Me.gfm._extended_email).getRegex(),Me.breaks=Ne({},Me.gfm,{br:me(Me.br).replace("{2,}","*").getRegex(),text:me(Me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var wt={block:Be,inline:Me},He=Ce,lt=D.exports.defaults,Ue=wt.block,bt=wt.inline,be=B.repeatString;function ye(Se){return Se.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function le(Se){var _e="",ve,ee,ie=Se.length;for(ve=0;ve<ie;ve++)ee=Se.charCodeAt(ve),Math.random()>.5&&(ee="x"+ee.toString(16)),_e+="&#"+ee+";";return _e}var ke=function(){function Se(ve){this.tokens=[],this.tokens.links=Object.create(null),this.options=ve||lt,this.options.tokenizer=this.options.tokenizer||new He,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ee={block:Ue.normal,inline:bt.normal};this.options.pedantic?(ee.block=Ue.pedantic,ee.inline=bt.pedantic):this.options.gfm&&(ee.block=Ue.gfm,this.options.breaks?ee.inline=bt.breaks:ee.inline=bt.gfm),this.tokenizer.rules=ee}Se.lex=function(ee,ie){var oe=new Se(ie);return oe.lex(ee)},Se.lexInline=function(ee,ie){var oe=new Se(ie);return oe.inlineTokens(ee)};var _e=Se.prototype;return _e.lex=function(ee){return ee=ee.replace(/\r\n|\r/g,`
|
|
|
`).replace(/\t/g," "),this.blockTokens(ee,this.tokens,!0),this.inline(this.tokens),this.tokens},_e.blockTokens=function(ee,ie,oe){ie===void 0&&(ie=[]),oe===void 0&&(oe=!0),this.options.pedantic&&(ee=ee.replace(/^ +$/gm,""));for(var he,de,Je,et;ee;){if(he=this.tokenizer.space(ee)){ee=ee.substring(he.raw.length),he.type&&ie.push(he);continue}if(he=this.tokenizer.code(ee)){ee=ee.substring(he.raw.length),et=ie[ie.length-1],et&&et.type==="paragraph"?(et.raw+=`
|
|
|
`+he.raw,et.text+=`
|
|
|
`+he.text):ie.push(he);continue}if(he=this.tokenizer.fences(ee)){ee=ee.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.heading(ee)){ee=ee.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.nptable(ee)){ee=ee.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.hr(ee)){ee=ee.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.blockquote(ee)){ee=ee.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],oe),ie.push(he);continue}if(he=this.tokenizer.list(ee)){for(ee=ee.substring(he.raw.length),Je=he.items.length,de=0;de<Je;de++)he.items[de].tokens=this.blockTokens(he.items[de].text,[],!1);ie.push(he);continue}if(he=this.tokenizer.html(ee)){ee=ee.substring(he.raw.length),ie.push(he);continue}if(oe&&(he=this.tokenizer.def(ee))){ee=ee.substring(he.raw.length),this.tokens.links[he.tag]||(this.tokens.links[he.tag]={href:he.href,title:he.title});continue}if(he=this.tokenizer.table(ee)){ee=ee.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.lheading(ee)){ee=ee.substring(he.raw.length),ie.push(he);continue}if(oe&&(he=this.tokenizer.paragraph(ee))){ee=ee.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.text(ee)){ee=ee.substring(he.raw.length),et=ie[ie.length-1],et&&et.type==="text"?(et.raw+=`
|
|
|
`+he.raw,et.text+=`
|
|
|
`+he.text):ie.push(he);continue}if(ee){var ht="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(ht);break}else throw new Error(ht)}}return ie},_e.inline=function(ee){var ie,oe,he,de,Je,et,ht=ee.length;for(ie=0;ie<ht;ie++)switch(et=ee[ie],et.type){case"paragraph":case"text":case"heading":{et.tokens=[],this.inlineTokens(et.text,et.tokens);break}case"table":{for(et.tokens={header:[],cells:[]},de=et.header.length,oe=0;oe<de;oe++)et.tokens.header[oe]=[],this.inlineTokens(et.header[oe],et.tokens.header[oe]);for(de=et.cells.length,oe=0;oe<de;oe++)for(Je=et.cells[oe],et.tokens.cells[oe]=[],he=0;he<Je.length;he++)et.tokens.cells[oe][he]=[],this.inlineTokens(Je[he],et.tokens.cells[oe][he]);break}case"blockquote":{this.inline(et.tokens);break}case"list":{for(de=et.items.length,oe=0;oe<de;oe++)this.inline(et.items[oe].tokens);break}}return ee},_e.inlineTokens=function(ee,ie,oe,he){ie===void 0&&(ie=[]),oe===void 0&&(oe=!1),he===void 0&&(he=!1);var de,Je,et=ee,ht,gt,Ot;if(this.tokens.links){var qt=Object.keys(this.tokens.links);if(qt.length>0)for(;(ht=this.tokenizer.rules.inline.reflinkSearch.exec(et))!=null;)qt.includes(ht[0].slice(ht[0].lastIndexOf("[")+1,-1))&&(et=et.slice(0,ht.index)+"["+be("a",ht[0].length-2)+"]"+et.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ht=this.tokenizer.rules.inline.blockSkip.exec(et))!=null;)et=et.slice(0,ht.index)+"["+be("a",ht[0].length-2)+"]"+et.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(ht=this.tokenizer.rules.inline.escapedEmSt.exec(et))!=null;)et=et.slice(0,ht.index)+"++"+et.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;ee;){if(gt||(Ot=""),gt=!1,de=this.tokenizer.escape(ee)){ee=ee.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.tag(ee,oe,he)){ee=ee.substring(de.raw.length),oe=de.inLink,he=de.inRawBlock;var Ut=ie[ie.length-1];Ut&&de.type==="text"&&Ut.type==="text"?(Ut.raw+=de.raw,Ut.text+=de.text):ie.push(de);continue}if(de=this.tokenizer.link(ee)){ee=ee.substring(de.raw.length),de.type==="link"&&(de.tokens=this.inlineTokens(de.text,[],!0,he)),ie.push(de);continue}if(de=this.tokenizer.reflink(ee,this.tokens.links)){ee=ee.substring(de.raw.length);var Lt=ie[ie.length-1];de.type==="link"?(de.tokens=this.inlineTokens(de.text,[],!0,he),ie.push(de)):Lt&&de.type==="text"&&Lt.type==="text"?(Lt.raw+=de.raw,Lt.text+=de.text):ie.push(de);continue}if(de=this.tokenizer.emStrong(ee,et,Ot)){ee=ee.substring(de.raw.length),de.tokens=this.inlineTokens(de.text,[],oe,he),ie.push(de);continue}if(de=this.tokenizer.codespan(ee)){ee=ee.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.br(ee)){ee=ee.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.del(ee)){ee=ee.substring(de.raw.length),de.tokens=this.inlineTokens(de.text,[],oe,he),ie.push(de);continue}if(de=this.tokenizer.autolink(ee,le)){ee=ee.substring(de.raw.length),ie.push(de);continue}if(!oe&&(de=this.tokenizer.url(ee,le))){ee=ee.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.inlineText(ee,he,ye)){ee=ee.substring(de.raw.length),de.raw.slice(-1)!=="_"&&(Ot=de.raw.slice(-1)),gt=!0,Je=ie[ie.length-1],Je&&Je.type==="text"?(Je.raw+=de.raw,Je.text+=de.text):ie.push(de);continue}if(ee){var oi="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(oi);break}else throw new Error(oi)}}return ie},b(Se,null,[{key:"rules",get:function(){return{block:Ue,inline:bt}}}]),Se}(),Fe=D.exports.defaults,Ke=B.cleanUrl,re=B.escape,fe=function(){function Se(ve){this.options=ve||Fe}var _e=Se.prototype;return _e.code=function(ee,ie,oe){var he=(ie||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(ee,he);de!=null&&de!==ee&&(oe=!0,ee=de)}return ee=ee.replace(/\n$/,"")+`
|
|
|
`,he?'<pre><code class="'+this.options.langPrefix+re(he,!0)+'">'+(oe?ee:re(ee,!0))+`</code></pre>
|
|
|
`:"<pre><code>"+(oe?ee:re(ee,!0))+`</code></pre>
|
|
|
`},_e.blockquote=function(ee){return`<blockquote>
|
|
|
`+ee+`</blockquote>
|
|
|
`},_e.html=function(ee){return ee},_e.heading=function(ee,ie,oe,he){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+he.slug(oe)+'">'+ee+"</h"+ie+`>
|
|
|
`:"<h"+ie+">"+ee+"</h"+ie+`>
|
|
|
`},_e.hr=function(){return this.options.xhtml?`<hr/>
|
|
|
`:`<hr>
|
|
|
`},_e.list=function(ee,ie,oe){var he=ie?"ol":"ul",de=ie&&oe!==1?' start="'+oe+'"':"";return"<"+he+de+`>
|
|
|
`+ee+"</"+he+`>
|
|
|
`},_e.listitem=function(ee){return"<li>"+ee+`</li>
|
|
|
`},_e.checkbox=function(ee){return"<input "+(ee?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},_e.paragraph=function(ee){return"<p>"+ee+`</p>
|
|
|
`},_e.table=function(ee,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
|
|
|
<thead>
|
|
|
`+ee+`</thead>
|
|
|
`+ie+`</table>
|
|
|
`},_e.tablerow=function(ee){return`<tr>
|
|
|
`+ee+`</tr>
|
|
|
`},_e.tablecell=function(ee,ie){var oe=ie.header?"th":"td",he=ie.align?"<"+oe+' align="'+ie.align+'">':"<"+oe+">";return he+ee+"</"+oe+`>
|
|
|
`},_e.strong=function(ee){return"<strong>"+ee+"</strong>"},_e.em=function(ee){return"<em>"+ee+"</em>"},_e.codespan=function(ee){return"<code>"+ee+"</code>"},_e.br=function(){return this.options.xhtml?"<br/>":"<br>"},_e.del=function(ee){return"<del>"+ee+"</del>"},_e.link=function(ee,ie,oe){if(ee=Ke(this.options.sanitize,this.options.baseUrl,ee),ee===null)return oe;var he='<a href="'+re(ee)+'"';return ie&&(he+=' title="'+ie+'"'),he+=">"+oe+"</a>",he},_e.image=function(ee,ie,oe){if(ee=Ke(this.options.sanitize,this.options.baseUrl,ee),ee===null)return oe;var he='<img src="'+ee+'" alt="'+oe+'"';return ie&&(he+=' title="'+ie+'"'),he+=this.options.xhtml?"/>":">",he},_e.text=function(ee){return ee},Se}(),De=function(){function Se(){}var _e=Se.prototype;return _e.strong=function(ee){return ee},_e.em=function(ee){return ee},_e.codespan=function(ee){return ee},_e.del=function(ee){return ee},_e.html=function(ee){return ee},_e.text=function(ee){return ee},_e.link=function(ee,ie,oe){return""+oe},_e.image=function(ee,ie,oe){return""+oe},_e.br=function(){return""},Se}(),Re=function(){function Se(){this.seen={}}var _e=Se.prototype;return _e.serialize=function(ee){return ee.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},_e.getNextSafeSlug=function(ee,ie){var oe=ee,he=0;if(this.seen.hasOwnProperty(oe)){he=this.seen[ee];do he++,oe=ee+"-"+he;while(this.seen.hasOwnProperty(oe))}return ie||(this.seen[ee]=he,this.seen[oe]=0),oe},_e.slug=function(ee,ie){ie===void 0&&(ie={});var oe=this.serialize(ee);return this.getNextSafeSlug(oe,ie.dryrun)},Se}(),Oe=fe,Ye=De,at=Re,Qe=D.exports.defaults,Xe=B.unescape,Ge=function(){function Se(ve){this.options=ve||Qe,this.options.renderer=this.options.renderer||new Oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ye,this.slugger=new at}Se.parse=function(ee,ie){var oe=new Se(ie);return oe.parse(ee)},Se.parseInline=function(ee,ie){var oe=new Se(ie);return oe.parseInline(ee)};var _e=Se.prototype;return _e.parse=function(ee,ie){ie===void 0&&(ie=!0);var oe="",he,de,Je,et,ht,gt,Ot,qt,Ut,Lt,oi,fi,Qt,si,tt,Ve,pt,Bt,Wt=ee.length;for(he=0;he<Wt;he++)switch(Lt=ee[he],Lt.type){case"space":continue;case"hr":{oe+=this.renderer.hr();continue}case"heading":{oe+=this.renderer.heading(this.parseInline(Lt.tokens),Lt.depth,Xe(this.parseInline(Lt.tokens,this.textRenderer)),this.slugger);continue}case"code":{oe+=this.renderer.code(Lt.text,Lt.lang,Lt.escaped);continue}case"table":{for(qt="",Ot="",et=Lt.header.length,de=0;de<et;de++)Ot+=this.renderer.tablecell(this.parseInline(Lt.tokens.header[de]),{header:!0,align:Lt.align[de]});for(qt+=this.renderer.tablerow(Ot),Ut="",et=Lt.cells.length,de=0;de<et;de++){for(gt=Lt.tokens.cells[de],Ot="",ht=gt.length,Je=0;Je<ht;Je++)Ot+=this.renderer.tablecell(this.parseInline(gt[Je]),{header:!1,align:Lt.align[Je]});Ut+=this.renderer.tablerow(Ot)}oe+=this.renderer.table(qt,Ut);continue}case"blockquote":{Ut=this.parse(Lt.tokens),oe+=this.renderer.blockquote(Ut);continue}case"list":{for(oi=Lt.ordered,fi=Lt.start,Qt=Lt.loose,et=Lt.items.length,Ut="",de=0;de<et;de++)tt=Lt.items[de],Ve=tt.checked,pt=tt.task,si="",tt.task&&(Bt=this.renderer.checkbox(Ve),Qt?tt.tokens.length>0&&tt.tokens[0].type==="text"?(tt.tokens[0].text=Bt+" "+tt.tokens[0].text,tt.tokens[0].tokens&&tt.tokens[0].tokens.length>0&&tt.tokens[0].tokens[0].type==="text"&&(tt.tokens[0].tokens[0].text=Bt+" "+tt.tokens[0].tokens[0].text)):tt.tokens.unshift({type:"text",text:Bt}):si+=Bt),si+=this.parse(tt.tokens,Qt),Ut+=this.renderer.listitem(si,pt,Ve);oe+=this.renderer.list(Ut,oi,fi);continue}case"html":{oe+=this.renderer.html(Lt.text);continue}case"paragraph":{oe+=this.renderer.paragraph(this.parseInline(Lt.tokens));continue}case"text":{for(Ut=Lt.tokens?this.parseInline(Lt.tokens):Lt.text;he+1<Wt&&ee[he+1].type==="text";)Lt=ee[++he],Ut+=`
|
|
|
`+(Lt.tokens?this.parseInline(Lt.tokens):Lt.text);oe+=ie?this.renderer.paragraph(Ut):Ut;continue}default:{var Xt='Token with "'+Lt.type+'" type was not found.';if(this.options.silent){console.error(Xt);return}else throw new Error(Xt)}}return oe},_e.parseInline=function(ee,ie){ie=ie||this.renderer;var oe="",he,de,Je=ee.length;for(he=0;he<Je;he++)switch(de=ee[he],de.type){case"escape":{oe+=ie.text(de.text);break}case"html":{oe+=ie.html(de.text);break}case"link":{oe+=ie.link(de.href,de.title,this.parseInline(de.tokens,ie));break}case"image":{oe+=ie.image(de.href,de.title,de.text);break}case"strong":{oe+=ie.strong(this.parseInline(de.tokens,ie));break}case"em":{oe+=ie.em(this.parseInline(de.tokens,ie));break}case"codespan":{oe+=ie.codespan(de.text);break}case"br":{oe+=ie.br();break}case"del":{oe+=ie.del(this.parseInline(de.tokens,ie));break}case"text":{oe+=ie.text(de.text);break}default:{var et='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(et);return}else throw new Error(et)}}return oe},Se}(),ct=ke,ot=Ge,it=Ce,we=fe,rt=De,Ze=Re,je=B.merge,mt=B.checkSanitizeDeprecation,Et=B.escape,st=D.exports.getDefaults,Rt=D.exports.changeDefaults,Nt=D.exports.defaults;function nt(Se,_e,ve){if(typeof Se=="undefined"||Se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Se)+", string expected");if(typeof _e=="function"&&(ve=_e,_e=null),_e=je({},nt.defaults,_e||{}),mt(_e),ve){var ee=_e.highlight,ie;try{ie=ct.lex(Se,_e)}catch(Je){return ve(Je)}var oe=function(et){var ht;if(!et)try{_e.walkTokens&&nt.walkTokens(ie,_e.walkTokens),ht=ot.parse(ie,_e)}catch(gt){et=gt}return _e.highlight=ee,et?ve(et):ve(null,ht)};if(!ee||ee.length<3||(delete _e.highlight,!ie.length))return oe();var he=0;nt.walkTokens(ie,function(Je){Je.type==="code"&&(he++,setTimeout(function(){ee(Je.text,Je.lang,function(et,ht){if(et)return oe(et);ht!=null&&ht!==Je.text&&(Je.text=ht,Je.escaped=!0),he--,he===0&&oe()})},0))}),he===0&&oe();return}try{var de=ct.lex(Se,_e);return _e.walkTokens&&nt.walkTokens(de,_e.walkTokens),ot.parse(de,_e)}catch(Je){if(Je.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,_e.silent)return"<p>An error occurred:</p><pre>"+Et(Je.message+"",!0)+"</pre>";throw Je}}nt.options=nt.setOptions=function(Se){return je(nt.defaults,Se),Rt(nt.defaults),nt},nt.getDefaults=st,nt.defaults=Nt,nt.use=function(Se){var _e=je({},Se);if(Se.renderer&&function(){var ee=nt.defaults.renderer||new we,ie=function(de){var Je=ee[de];ee[de]=function(){for(var et=arguments.length,ht=new Array(et),gt=0;gt<et;gt++)ht[gt]=arguments[gt];var Ot=Se.renderer[de].apply(ee,ht);return Ot===!1&&(Ot=Je.apply(ee,ht)),Ot}};for(var oe in Se.renderer)ie(oe);_e.renderer=ee}(),Se.tokenizer&&function(){var ee=nt.defaults.tokenizer||new it,ie=function(de){var Je=ee[de];ee[de]=function(){for(var et=arguments.length,ht=new Array(et),gt=0;gt<et;gt++)ht[gt]=arguments[gt];var Ot=Se.tokenizer[de].apply(ee,ht);return Ot===!1&&(Ot=Je.apply(ee,ht)),Ot}};for(var oe in Se.tokenizer)ie(oe);_e.tokenizer=ee}(),Se.walkTokens){var ve=nt.defaults.walkTokens;_e.walkTokens=function(ee){Se.walkTokens(ee),ve&&ve(ee)}}nt.setOptions(_e)},nt.walkTokens=function(Se,_e){for(var ve=K(Se),ee;!(ee=ve()).done;){var ie=ee.value;switch(_e(ie),ie.type){case"table":{for(var oe=K(ie.tokens.header),he;!(he=oe()).done;){var de=he.value;nt.walkTokens(de,_e)}for(var Je=K(ie.tokens.cells),et;!(et=Je()).done;)for(var ht=et.value,gt=K(ht),Ot;!(Ot=gt()).done;){var qt=Ot.value;nt.walkTokens(qt,_e)}break}case"list":{nt.walkTokens(ie.items,_e);break}default:ie.tokens&&nt.walkTokens(ie.tokens,_e)}}},nt.parseInline=function(Se,_e){if(typeof Se=="undefined"||Se===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof Se!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(Se)+", string expected");_e=je({},nt.defaults,_e||{}),mt(_e);try{var ve=ct.lexInline(Se,_e);return _e.walkTokens&&nt.walkTokens(ve,_e.walkTokens),ot.parseInline(ve,_e)}catch(ee){if(ee.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,_e.silent)return"<p>An error occurred:</p><pre>"+Et(ee.message+"",!0)+"</pre>";throw ee}},nt.Parser=ot,nt.parser=ot.parse,nt.Renderer=we,nt.TextRenderer=rt,nt.Lexer=ct,nt.lexer=ct.lex,nt.Tokenizer=it,nt.Slugger=Ze,nt.parse=nt;var Dt=nt;return Dt})},11690:function(yt){const ge=/[&<>"']/,b=/[&<>"']/g,I=/[<>"']|&(?!#?\w+;)/,P=/[<>"']|&(?!#?\w+;)/g,K={"&":"&","<":"<",">":">",'"':""","'":"'"},D=M=>K[M];function w(M,Z){if(Z){if(ge.test(M))return M.replace(b,D)}else if(I.test(M))return M.replace(P,D);return M}const _=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(M){return M.replace(_,(Z,q)=>(q=q.toLowerCase(),q==="colon"?":":q.charAt(0)==="#"?q.charAt(1)==="x"?String.fromCharCode(parseInt(q.substring(2),16)):String.fromCharCode(+q.substring(1)):""))}const v=/(^|[^\[])\^/g;function s(M,Z){M=M.source||M,Z=Z||"";const q={replace:(se,ue)=>(ue=ue.source||ue,ue=ue.replace(v,"$1"),M=M.replace(se,ue),q),getRegex:()=>new RegExp(M,Z)};return q}const y=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function c(M,Z,q){if(M){let se;try{se=decodeURIComponent(F(q)).replace(y,"").toLowerCase()}catch(ue){return null}if(se.indexOf("javascript:")===0||se.indexOf("vbscript:")===0||se.indexOf("data:")===0)return null}Z&&!f.test(q)&&(q=T(Z,q));try{q=encodeURI(q).replace(/%25/g,"%")}catch(se){return null}return q}const l={},h=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,E=/^([^:]+:\/*[^/]*)[\s\S]*$/;function T(M,Z){l[" "+M]||(h.test(M)?l[" "+M]=M+"/":l[" "+M]=O(M,"/",!0)),M=l[" "+M];const q=M.indexOf(":")===-1;return Z.substring(0,2)==="//"?q?Z:M.replace(d,"$1")+Z:Z.charAt(0)==="/"?q?Z:M.replace(E,"$1")+Z:M+Z}const L={exec:function(){}};function x(M){let Z=1,q,se;for(;Z<arguments.length;Z++){q=arguments[Z];for(se in q)Object.prototype.hasOwnProperty.call(q,se)&&(M[se]=q[se])}return M}function A(M,Z){const q=M.replace(/\|/g,(J,z,X)=>{let B=!1,G=z;for(;--G>=0&&X[G]==="\\";)B=!B;return B?"|":" |"}),se=q.split(/ \|/);let ue=0;if(se.length>Z)se.splice(Z);else for(;se.length<Z;)se.push("");for(;ue<se.length;ue++)se[ue]=se[ue].trim().replace(/\\\|/g,"|");return se}function O(M,Z,q){const se=M.length;if(se===0)return"";let ue=0;for(;ue<se;){const J=M.charAt(se-ue-1);if(J===Z&&!q)ue++;else if(J!==Z&&q)ue++;else break}return M.substr(0,se-ue)}function U(M,Z){if(M.indexOf(Z[1])===-1)return-1;const q=M.length;let se=0,ue=0;for(;ue<q;ue++)if(M[ue]==="\\")ue++;else if(M[ue]===Z[0])se++;else if(M[ue]===Z[1]&&(se--,se<0))return ue;return-1}function N(M){M&&M.sanitize&&!M.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function $(M,Z){if(Z<1)return"";let q="";for(;Z>1;)Z&1&&(q+=M),Z>>=1,M+=M;return q+M}yt.exports={escape:w,unescape:F,edit:s,cleanUrl:c,resolveUrl:T,noopTest:L,merge:x,splitCells:A,rtrim:O,findClosingBracket:U,checkSanitizeDeprecation:N,repeatString:$}},75918:function(yt,ge,b){"use strict";b.d(ge,{Wi:function(){return _},Z0:function(){return F},aU:function(){return w},eZ:function(){return s},wY:function(){return v}});var I=b(4348),P=b(69323),K=b(13268),D=function(y,f,c,l){function h(d){return d instanceof c?d:new c(function(E){E(d)})}return new(c||(c=Promise))(function(d,E){function T(A){try{x(l.next(A))}catch(O){E(O)}}function L(A){try{x(l.throw(A))}catch(O){E(O)}}function x(A){A.done?d(A.value):h(A.value).then(T,L)}x((l=l.apply(y,f||[])).next())})};class w extends P.JT{constructor(f,c="",l="",h=!0,d){super(),this._onDidChange=this._register(new I.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=f,this._label=c,this._cssClass=l,this._enabled=h,this._actionCallback=d}get id(){return this._id}get label(){return this._label}set label(f){this._setLabel(f)}_setLabel(f){this._label!==f&&(this._label=f,this._onDidChange.fire({label:f}))}get tooltip(){return this._tooltip||""}set tooltip(f){this._setTooltip(f)}_setTooltip(f){this._tooltip!==f&&(this._tooltip=f,this._onDidChange.fire({tooltip:f}))}get class(){return this._cssClass}set class(f){this._setClass(f)}_setClass(f){this._cssClass!==f&&(this._cssClass=f,this._onDidChange.fire({class:f}))}get enabled(){return this._enabled}set enabled(f){this._setEnabled(f)}_setEnabled(f){this._enabled!==f&&(this._enabled=f,this._onDidChange.fire({enabled:f}))}get checked(){return this._checked}set checked(f){this._setChecked(f)}_setChecked(f){this._checked!==f&&(this._checked=f,this._onDidChange.fire({checked:f}))}run(f,c){return D(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(f))})}}class _ extends P.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new I.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new I.Q5),this.onDidRun=this._onDidRun.event}run(f,c){return D(this,void 0,void 0,function*(){if(!f.enabled)return;this._onBeforeRun.fire({action:f});let l;try{yield this.runAction(f,c)}catch(h){l=h}this._onDidRun.fire({action:f,error:l})})}runAction(f,c){return D(this,void 0,void 0,function*(){yield f.run(c)})}}class F extends w{constructor(f){super(F.ID,f,f?"separator text":"separator"),this.checked=!1,this.enabled=!1}}F.ID="vs.actions.separator";class v{constructor(f,c,l,h){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=f,this.label=c,this.class=h,this._actions=l}get actions(){return this._actions}dispose(){}run(){return D(this,void 0,void 0,function*(){})}}class s extends w{constructor(){super(s.ID,K.N("submenu.empty","(empty)"),void 0,!1)}}s.ID="vs.actions.empty"},76068:function(yt,ge,b){"use strict";b.d(ge,{ok:function(){return I}});function I(P,K){if(!P)throw new Error(K?`Assertion failed (${K})`:"Assertion Failed")}},52615:function(yt,ge,b){"use strict";b.d(ge,{CM:function(){return w},JL:function(){return _},dT:function(){return v},fK:function(){return D},lA:function(){return F}});var I=b(4348);class P{constructor(){this._icons=new Map,this._onDidRegister=new I.Q5}add(y){const f=this._icons.get(y.id);f?y.description?f.description=y.description:console.error(`Duplicate registration of codicon ${y.id}`):(this._icons.set(y.id,y),this._onDidRegister.fire(y))}get(y){return this._icons.get(y)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const K=new P,D=K;function w(s,y){return new F(s,y)}function _(s){return s?s.replace(/\$\((.*?)\)/g,(y,f)=>` ${f} `).trim():""}class F{constructor(y,f,c){this.id=y,this.definition=f,this.description=c,K.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var v;(function(s){s.iconNameSegment="[A-Za-z0-9]+",s.iconNameExpression="[A-Za-z0-9\\-]+",s.iconModifierExpression="~[A-Za-z]+";const y=new RegExp(`^(${s.iconNameExpression})(${s.iconModifierExpression})?$`);function f(h){if(h instanceof F)return["codicon","codicon-"+h.id];const d=y.exec(h.id);if(!d)return f(F.error);let[,E,T]=d;const L=["codicon","codicon-"+E];return T&&L.push("codicon-modifier-"+T.substr(1)),L}s.asClassNameArray=f;function c(h){return f(h).join(" ")}s.asClassName=c;function l(h){return"."+f(h).join(".")}s.asCSSSelector=l})(v||(v={})),function(s){s.add=new s("add",{fontCharacter:"\\ea60"}),s.plus=new s("plus",s.add.definition),s.gistNew=new s("gist-new",s.add.definition),s.repoCreate=new s("repo-create",s.add.definition),s.lightbulb=new s("lightbulb",{fontCharacter:"\\ea61"}),s.lightBulb=new s("light-bulb",{fontCharacter:"\\ea61"}),s.repo=new s("repo",{fontCharacter:"\\ea62"}),s.repoDelete=new s("repo-delete",{fontCharacter:"\\ea62"}),s.gistFork=new s("gist-fork",{fontCharacter:"\\ea63"}),s.repoForked=new s("repo-forked",{fontCharacter:"\\ea63"}),s.gitPullRequest=new s("git-pull-request",{fontCharacter:"\\ea64"}),s.gitPullRequestAbandoned=new s("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),s.recordKeys=new s("record-keys",{fontCharacter:"\\ea65"}),s.keyboard=new s("keyboard",{fontCharacter:"\\ea65"}),s.tag=new s("tag",{fontCharacter:"\\ea66"}),s.tagAdd=new s("tag-add",{fontCharacter:"\\ea66"}),s.tagRemove=new s("tag-remove",{fontCharacter:"\\ea66"}),s.person=new s("person",{fontCharacter:"\\ea67"}),s.personFollow=new s("person-follow",{fontCharacter:"\\ea67"}),s.personOutline=new s("person-outline",{fontCharacter:"\\ea67"}),s.personFilled=new s("person-filled",{fontCharacter:"\\ea67"}),s.gitBranch=new s("git-branch",{fontCharacter:"\\ea68"}),s.gitBranchCreate=new s("git-branch-create",{fontCharacter:"\\ea68"}),s.gitBranchDelete=new s("git-branch-delete",{fontCharacter:"\\ea68"}),s.sourceControl=new s("source-control",{fontCharacter:"\\ea68"}),s.mirror=new s("mirror",{fontCharacter:"\\ea69"}),s.mirrorPublic=new s("mirror-public",{fontCharacter:"\\ea69"}),s.star=new s("star",{fontCharacter:"\\ea6a"}),s.starAdd=new s("star-add",{fontCharacter:"\\ea6a"}),s.starDelete=new s("star-delete",{fontCharacter:"\\ea6a"}),s.starEmpty=new s("star-empty",{fontCharacter:"\\ea6a"}),s.comment=new s("comment",{fontCharacter:"\\ea6b"}),s.commentAdd=new s("comment-add",{fontCharacter:"\\ea6b"}),s.alert=new s("alert",{fontCharacter:"\\ea6c"}),s.warning=new s("warning",{fontCharacter:"\\ea6c"}),s.search=new s("search",{fontCharacter:"\\ea6d"}),s.searchSave=new s("search-save",{fontCharacter:"\\ea6d"}),s.logOut=new s("log-out",{fontCharacter:"\\ea6e"}),s.signOut=new s("sign-out",{fontCharacter:"\\ea6e"}),s.logIn=new s("log-in",{fontCharacter:"\\ea6f"}),s.signIn=new s("sign-in",{fontCharacter:"\\ea6f"}),s.eye=new s("eye",{fontCharacter:"\\ea70"}),s.eyeUnwatch=new s("eye-unwatch",{fontCharacter:"\\ea70"}),s.eyeWatch=new s("eye-watch",{fontCharacter:"\\ea70"}),s.circleFilled=new s("circle-filled",{fontCharacter:"\\ea71"}),s.primitiveDot=new s("primitive-dot",{fontCharacter:"\\ea71"}),s.closeDirty=new s("close-dirty",{fontCharacter:"\\ea71"}),s.debugBreakpoint=new s("debug-breakpoint",{fontCharacter:"\\ea71"}),s.debugBreakpointDisabled=new s("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),s.debugHint=new s("debug-hint",{fontCharacter:"\\ea71"}),s.primitiveSquare=new s("primitive-square",{fontCharacter:"\\ea72"}),s.edit=new s("edit",{fontCharacter:"\\ea73"}),s.pencil=new s("pencil",{fontCharacter:"\\ea73"}),s.info=new s("info",{fontCharacter:"\\ea74"}),s.issueOpened=new s("issue-opened",{fontCharacter:"\\ea74"}),s.gistPrivate=new s("gist-private",{fontCharacter:"\\ea75"}),s.gitForkPrivate=new s("git-fork-private",{fontCharacter:"\\ea75"}),s.lock=new s("lock",{fontCharacter:"\\ea75"}),s.mirrorPrivate=new s("mirror-private",{fontCharacter:"\\ea75"}),s.close=new s("close",{fontCharacter:"\\ea76"}),s.removeClose=new s("remove-close",{fontCharacter:"\\ea76"}),s.x=new s("x",{fontCharacter:"\\ea76"}),s.repoSync=new s("repo-sync",{fontCharacter:"\\ea77"}),s.sync=new s("sync",{fontCharacter:"\\ea77"}),s.clone=new s("clone",{fontCharacter:"\\ea78"}),s.desktopDownload=new s("desktop-download",{fontCharacter:"\\ea78"}),s.beaker=new s("beaker",{fontCharacter:"\\ea79"}),s.microscope=new s("microscope",{fontCharacter:"\\ea79"}),s.vm=new s("vm",{fontCharacter:"\\ea7a"}),s.deviceDesktop=new s("device-desktop",{fontCharacter:"\\ea7a"}),s.file=new s("file",{fontCharacter:"\\ea7b"}),s.fileText=new s("file-text",{fontCharacter:"\\ea7b"}),s.more=new s("more",{fontCharacter:"\\ea7c"}),s.ellipsis=new s("ellipsis",{fontCharacter:"\\ea7c"}),s.kebabHorizontal=new s("kebab-horizontal",{fontCharacter:"\\ea7c"}),s.mailReply=new s("mail-reply",{fontCharacter:"\\ea7d"}),s.reply=new s("reply",{fontCharacter:"\\ea7d"}),s.organization=new s("organization",{fontCharacter:"\\ea7e"}),s.organizationFilled=new s("organization-filled",{fontCharacter:"\\ea7e"}),s.organizationOutline=new s("organization-outline",{fontCharacter:"\\ea7e"}),s.newFile=new s("new-file",{fontCharacter:"\\ea7f"}),s.fileAdd=new s("file-add",{fontCharacter:"\\ea7f"}),s.newFolder=new s("new-folder",{fontCharacter:"\\ea80"}),s.fileDirectoryCreate=new s("file-directory-create",{fontCharacter:"\\ea80"}),s.trash=new s("trash",{fontCharacter:"\\ea81"}),s.trashcan=new s("trashcan",{fontCharacter:"\\ea81"}),s.history=new s("history",{fontCharacter:"\\ea82"}),s.clock=new s("clock",{fontCharacter:"\\ea82"}),s.folder=new s("folder",{fontCharacter:"\\ea83"}),s.fileDirectory=new s("file-directory",{fontCharacter:"\\ea83"}),s.symbolFolder=new s("symbol-folder",{fontCharacter:"\\ea83"}),s.logoGithub=new s("logo-github",{fontCharacter:"\\ea84"}),s.markGithub=new s("mark-github",{fontCharacter:"\\ea84"}),s.github=new s("github",{fontCharacter:"\\ea84"}),s.terminal=new s("terminal",{fontCharacter:"\\ea85"}),s.console=new s("console",{fontCharacter:"\\ea85"}),s.repl=new s("repl",{fontCharacter:"\\ea85"}),s.zap=new s("zap",{fontCharacter:"\\ea86"}),s.symbolEvent=new s("symbol-event",{fontCharacter:"\\ea86"}),s.error=new s("error",{fontCharacter:"\\ea87"}),s.stop=new s("stop",{fontCharacter:"\\ea87"}),s.variable=new s("variable",{fontCharacter:"\\ea88"}),s.symbolVariable=new s("symbol-variable",{fontCharacter:"\\ea88"}),s.array=new s("array",{fontCharacter:"\\ea8a"}),s.symbolArray=new s("symbol-array",{fontCharacter:"\\ea8a"}),s.symbolModule=new s("symbol-module",{fontCharacter:"\\ea8b"}),s.symbolPackage=new s("symbol-package",{fontCharacter:"\\ea8b"}),s.symbolNamespace=new s("symbol-namespace",{fontCharacter:"\\ea8b"}),s.symbolObject=new s("symbol-object",{fontCharacter:"\\ea8b"}),s.symbolMethod=new s("symbol-method",{fontCharacter:"\\ea8c"}),s.symbolFunction=new s("symbol-function",{fontCharacter:"\\ea8c"}),s.symbolConstructor=new s("symbol-constructor",{fontCharacter:"\\ea8c"}),s.symbolBoolean=new s("symbol-boolean",{fontCharacter:"\\ea8f"}),s.symbolNull=new s("symbol-null",{fontCharacter:"\\ea8f"}),s.symbolNumeric=new s("symbol-numeric",{fontCharacter:"\\ea90"}),s.symbolNumber=new s("symbol-number",{fontCharacter:"\\ea90"}),s.symbolStructure=new s("symbol-structure",{fontCharacter:"\\ea91"}),s.symbolStruct=new s("symbol-struct",{fontCharacter:"\\ea91"}),s.symbolParameter=new s("symbol-parameter",{fontCharacter:"\\ea92"}),s.symbolTypeParameter=new s("symbol-type-parameter",{fontCharacter:"\\ea92"}),s.symbolKey=new s("symbol-key",{fontCharacter:"\\ea93"}),s.symbolText=new s("symbol-text",{fontCharacter:"\\ea93"}),s.symbolReference=new s("symbol-reference",{fontCharacter:"\\ea94"}),s.goToFile=new s("go-to-file",{fontCharacter:"\\ea94"}),s.symbolEnum=new s("symbol-enum",{fontCharacter:"\\ea95"}),s.symbolValue=new s("symbol-value",{fontCharacter:"\\ea95"}),s.symbolRuler=new s("symbol-ruler",{fontCharacter:"\\ea96"}),s.symbolUnit=new s("symbol-unit",{fontCharacter:"\\ea96"}),s.activateBreakpoints=new s("activate-breakpoints",{fontCharacter:"\\ea97"}),s.archive=new s("archive",{fontCharacter:"\\ea98"}),s.arrowBoth=new s("arrow-both",{fontCharacter:"\\ea99"}),s.arrowDown=new s("arrow-down",{fontCharacter:"\\ea9a"}),s.arrowLeft=new s("arrow-left",{fontCharacter:"\\ea9b"}),s.arrowRight=new s("arrow-right",{fontCharacter:"\\ea9c"}),s.arrowSmallDown=new s("arrow-small-down",{fontCharacter:"\\ea9d"}),s.arrowSmallLeft=new s("arrow-small-left",{fontCharacter:"\\ea9e"}),s.arrowSmallRight=new s("arrow-small-right",{fontCharacter:"\\ea9f"}),s.arrowSmallUp=new s("arrow-small-up",{fontCharacter:"\\eaa0"}),s.arrowUp=new s("arrow-up",{fontCharacter:"\\eaa1"}),s.bell=new s("bell",{fontCharacter:"\\eaa2"}),s.bold=new s("bold",{fontCharacter:"\\eaa3"}),s.book=new s("book",{fontCharacter:"\\eaa4"}),s.bookmark=new s("bookmark",{fontCharacter:"\\eaa5"}),s.debugBreakpointConditionalUnverified=new s("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),s.debugBreakpointConditional=new s("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),s.debugBreakpointConditionalDisabled=new s("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),s.debugBreakpointDataUnverified=new s("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),s.debugBreakpointData=new s("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),s.debugBreakpointDataDisabled=new s("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),s.debugBreakpointLogUnverified=new s("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),s.debugBreakpointLog=new s("debug-breakpoint-log",{fontCharacter:"\\eaab"}),s.debugBreakpointLogDisabled=new s("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),s.briefcase=new s("briefcase",{fontCharacter:"\\eaac"}),s.broadcast=new s("broadcast",{fontCharacter:"\\eaad"}),s.browser=new s("browser",{fontCharacter:"\\eaae"}),s.bug=new s("bug",{fontCharacter:"\\eaaf"}),s.calendar=new s("calendar",{fontCharacter:"\\eab0"}),s.caseSensitive=new s("case-sensitive",{fontCharacter:"\\eab1"}),s.check=new s("check",{fontCharacter:"\\eab2"}),s.checklist=new s("checklist",{fontCharacter:"\\eab3"}),s.chevronDown=new s("chevron-down",{fontCharacter:"\\eab4"}),s.dropDownButton=new s("drop-down-button",s.chevronDown.definition),s.chevronLeft=new s("chevron-left",{fontCharacter:"\\eab5"}),s.chevronRight=new s("chevron-right",{fontCharacter:"\\eab6"}),s.chevronUp=new s("chevron-up",{fontCharacter:"\\eab7"}),s.chromeClose=new s("chrome-close",{fontCharacter:"\\eab8"}),s.chromeMaximize=new s("chrome-maximize",{fontCharacter:"\\eab9"}),s.chromeMinimize=new s("chrome-minimize",{fontCharacter:"\\eaba"}),s.chromeRestore=new s("chrome-restore",{fontCharacter:"\\eabb"}),s.circleOutline=new s("circle-outline",{fontCharacter:"\\eabc"}),s.debugBreakpointUnverified=new s("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),s.circleSlash=new s("circle-slash",{fontCharacter:"\\eabd"}),s.circuitBoard=new s("circuit-board",{fontCharacter:"\\eabe"}),s.clearAll=new s("clear-all",{fontCharacter:"\\eabf"}),s.clippy=new s("clippy",{fontCharacter:"\\eac0"}),s.closeAll=new s("close-all",{fontCharacter:"\\eac1"}),s.cloudDownload=new s("cloud-download",{fontCharacter:"\\eac2"}),s.cloudUpload=new s("cloud-upload",{fontCharacter:"\\eac3"}),s.code=new s("code",{fontCharacter:"\\eac4"}),s.collapseAll=new s("collapse-all",{fontCharacter:"\\eac5"}),s.colorMode=new s("color-mode",{fontCharacter:"\\eac6"}),s.commentDiscussion=new s("comment-discussion",{fontCharacter:"\\eac7"}),s.compareChanges=new s("compare-changes",{fontCharacter:"\\eafd"}),s.creditCard=new s("credit-card",{fontCharacter:"\\eac9"}),s.dash=new s("dash",{fontCharacter:"\\eacc"}),s.dashboard=new s("dashboard",{fontCharacter:"\\eacd"}),s.database=new s("database",{fontCharacter:"\\eace"}),s.debugContinue=new s("debug-continue",{fontCharacter:"\\eacf"}),s.debugDisconnect=new s("debug-disconnect",{fontCharacter:"\\ead0"}),s.debugPause=new s("debug-pause",{fontCharacter:"\\ead1"}),s.debugRestart=new s("debug-restart",{fontCharacter:"\\ead2"}),s.debugStart=new s("debug-start",{fontCharacter:"\\ead3"}),s.debugStepInto=new s("debug-step-into",{fontCharacter:"\\ead4"}),s.debugStepOut=new s("debug-step-out",{fontCharacter:"\\ead5"}),s.debugStepOver=new s("debug-step-over",{fontCharacter:"\\ead6"}),s.debugStop=new s("debug-stop",{fontCharacter:"\\ead7"}),s.debug=new s("debug",{fontCharacter:"\\ead8"}),s.deviceCameraVideo=new s("device-camera-video",{fontCharacter:"\\ead9"}),s.deviceCamera=new s("device-camera",{fontCharacter:"\\eada"}),s.deviceMobile=new s("device-mobile",{fontCharacter:"\\eadb"}),s.diffAdded=new s("diff-added",{fontCharacter:"\\eadc"}),s.diffIgnored=new s("diff-ignored",{fontCharacter:"\\eadd"}),s.diffModified=new s("diff-modified",{fontCharacter:"\\eade"}),s.diffRemoved=new s("diff-removed",{fontCharacter:"\\eadf"}),s.diffRenamed=new s("diff-renamed",{fontCharacter:"\\eae0"}),s.diff=new s("diff",{fontCharacter:"\\eae1"}),s.discard=new s("discard",{fontCharacter:"\\eae2"}),s.editorLayout=new s("editor-layout",{fontCharacter:"\\eae3"}),s.emptyWindow=new s("empty-window",{fontCharacter:"\\eae4"}),s.exclude=new s("exclude",{fontCharacter:"\\eae5"}),s.extensions=new s("extensions",{fontCharacter:"\\eae6"}),s.eyeClosed=new s("eye-closed",{fontCharacter:"\\eae7"}),s.fileBinary=new s("file-binary",{fontCharacter:"\\eae8"}),s.fileCode=new s("file-code",{fontCharacter:"\\eae9"}),s.fileMedia=new s("file-media",{fontCharacter:"\\eaea"}),s.filePdf=new s("file-pdf",{fontCharacter:"\\eaeb"}),s.fileSubmodule=new s("file-submodule",{fontCharacter:"\\eaec"}),s.fileSymlinkDirectory=new s("file-symlink-directory",{fontCharacter:"\\eaed"}),s.fileSymlinkFile=new s("file-symlink-file",{fontCharacter:"\\eaee"}),s.fileZip=new s("file-zip",{fontCharacter:"\\eaef"}),s.files=new s("files",{fontCharacter:"\\eaf0"}),s.filter=new s("filter",{fontCharacter:"\\eaf1"}),s.flame=new s("flame",{fontCharacter:"\\eaf2"}),s.foldDown=new s("fold-down",{fontCharacter:"\\eaf3"}),s.foldUp=new s("fold-up",{fontCharacter:"\\eaf4"}),s.fold=new s("fold",{fontCharacter:"\\eaf5"}),s.folderActive=new s("folder-active",{fontCharacter:"\\eaf6"}),s.folderOpened=new s("folder-opened",{fontCharacter:"\\eaf7"}),s.gear=new s("gear",{fontCharacter:"\\eaf8"}),s.gift=new s("gift",{fontCharacter:"\\eaf9"}),s.gistSecret=new s("gist-secret",{fontCharacter:"\\eafa"}),s.gist=new s("gist",{fontCharacter:"\\eafb"}),s.gitCommit=new s("git-commit",{fontCharacter:"\\eafc"}),s.gitCompare=new s("git-compare",{fontCharacter:"\\eafd"}),s.gitMerge=new s("git-merge",{fontCharacter:"\\eafe"}),s.githubAction=new s("github-action",{fontCharacter:"\\eaff"}),s.githubAlt=new s("github-alt",{fontCharacter:"\\eb00"}),s.globe=new s("globe",{fontCharacter:"\\eb01"}),s.grabber=new s("grabber",{fontCharacter:"\\eb02"}),s.graph=new s("graph",{fontCharacter:"\\eb03"}),s.gripper=new s("gripper",{fontCharacter:"\\eb04"}),s.heart=new s("heart",{fontCharacter:"\\eb05"}),s.home=new s("home",{fontCharacter:"\\eb06"}),s.horizontalRule=new s("horizontal-rule",{fontCharacter:"\\eb07"}),s.hubot=new s("hubot",{fontCharacter:"\\eb08"}),s.inbox=new s("inbox",{fontCharacter:"\\eb09"}),s.issueClosed=new s("issue-closed",{fontCharacter:"\\eba4"}),s.issueReopened=new s("issue-reopened",{fontCharacter:"\\eb0b"}),s.issues=new s("issues",{fontCharacter:"\\eb0c"}),s.italic=new s("italic",{fontCharacter:"\\eb0d"}),s.jersey=new s("jersey",{fontCharacter:"\\eb0e"}),s.json=new s("json",{fontCharacter:"\\eb0f"}),s.kebabVertical=new s("kebab-vertical",{fontCharacter:"\\eb10"}),s.key=new s("key",{fontCharacter:"\\eb11"}),s.law=new s("law",{fontCharacter:"\\eb12"}),s.lightbulbAutofix=new s("lightbulb-autofix",{fontCharacter:"\\eb13"}),s.linkExternal=new s("link-external",{fontCharacter:"\\eb14"}),s.link=new s("link",{fontCharacter:"\\eb15"}),s.listOrdered=new s("list-ordered",{fontCharacter:"\\eb16"}),s.listUnordered=new s("list-unordered",{fontCharacter:"\\eb17"}),s.liveShare=new s("live-share",{fontCharacter:"\\eb18"}),s.loading=new s("loading",{fontCharacter:"\\eb19"}),s.location=new s("location",{fontCharacter:"\\eb1a"}),s.mailRead=new s("mail-read",{fontCharacter:"\\eb1b"}),s.mail=new s("mail",{fontCharacter:"\\eb1c"}),s.markdown=new s("markdown",{fontCharacter:"\\eb1d"}),s.megaphone=new s("megaphone",{fontCharacter:"\\eb1e"}),s.mention=new s("mention",{fontCharacter:"\\eb1f"}),s.milestone=new s("milestone",{fontCharacter:"\\eb20"}),s.mortarBoard=new s("mortar-board",{fontCharacter:"\\eb21"}),s.move=new s("move",{fontCharacter:"\\eb22"}),s.multipleWindows=new s("multiple-windows",{fontCharacter:"\\eb23"}),s.mute=new s("mute",{fontCharacter:"\\eb24"}),s.noNewline=new s("no-newline",{fontCharacter:"\\eb25"}),s.note=new s("note",{fontCharacter:"\\eb26"}),s.octoface=new s("octoface",{fontCharacter:"\\eb27"}),s.openPreview=new s("open-preview",{fontCharacter:"\\eb28"}),s.package_=new s("package",{fontCharacter:"\\eb29"}),s.paintcan=new s("paintcan",{fontCharacter:"\\eb2a"}),s.pin=new s("pin",{fontCharacter:"\\eb2b"}),s.play=new s("play",{fontCharacter:"\\eb2c"}),s.run=new s("run",{fontCharacter:"\\eb2c"}),s.plug=new s("plug",{fontCharacter:"\\eb2d"}),s.preserveCase=new s("preserve-case",{fontCharacter:"\\eb2e"}),s.preview=new s("preview",{fontCharacter:"\\eb2f"}),s.project=new s("project",{fontCharacter:"\\eb30"}),s.pulse=new s("pulse",{fontCharacter:"\\eb31"}),s.question=new s("question",{fontCharacter:"\\eb32"}),s.quote=new s("quote",{fontCharacter:"\\eb33"}),s.radioTower=new s("radio-tower",{fontCharacter:"\\eb34"}),s.reactions=new s("reactions",{fontCharacter:"\\eb35"}),s.references=new s("references",{fontCharacter:"\\eb36"}),s.refresh=new s("refresh",{fontCharacter:"\\eb37"}),s.regex=new s("regex",{fontCharacter:"\\eb38"}),s.remoteExplorer=new s("remote-explorer",{fontCharacter:"\\eb39"}),s.remote=new s("remote",{fontCharacter:"\\eb3a"}),s.remove=new s("remove",{fontCharacter:"\\eb3b"}),s.replaceAll=new s("replace-all",{fontCharacter:"\\eb3c"}),s.replace=new s("replace",{fontCharacter:"\\eb3d"}),s.repoClone=new s("repo-clone",{fontCharacter:"\\eb3e"}),s.repoForcePush=new s("repo-force-push",{fontCharacter:"\\eb3f"}),s.repoPull=new s("repo-pull",{fontCharacter:"\\eb40"}),s.repoPush=new s("repo-push",{fontCharacter:"\\eb41"}),s.report=new s("report",{fontCharacter:"\\eb42"}),s.requestChanges=new s("request-changes",{fontCharacter:"\\eb43"}),s.rocket=new s("rocket",{fontCharacter:"\\eb44"}),s.rootFolderOpened=new s("root-folder-opened",{fontCharacter:"\\eb45"}),s.rootFolder=new s("root-folder",{fontCharacter:"\\eb46"}),s.rss=new s("rss",{fontCharacter:"\\eb47"}),s.ruby=new s("ruby",{fontCharacter:"\\eb48"}),s.saveAll=new s("save-all",{fontCharacter:"\\eb49"}),s.saveAs=new s("save-as",{fontCharacter:"\\eb4a"}),s.save=new s("save",{fontCharacter:"\\eb4b"}),s.screenFull=new s("screen-full",{fontCharacter:"\\eb4c"}),s.screenNormal=new s("screen-normal",{fontCharacter:"\\eb4d"}),s.searchStop=new s("search-stop",{fontCharacter:"\\eb4e"}),s.server=new s("server",{fontCharacter:"\\eb50"}),s.settingsGear=new s("settings-gear",{fontCharacter:"\\eb51"}),s.settings=new s("settings",{fontCharacter:"\\eb52"}),s.shield=new s("shield",{fontCharacter:"\\eb53"}),s.smiley=new s("smiley",{fontCharacter:"\\eb54"}),s.sortPrecedence=new s("sort-precedence",{fontCharacter:"\\eb55"}),s.splitHorizontal=new s("split-horizontal",{fontCharacter:"\\eb56"}),s.splitVertical=new s("split-vertical",{fontCharacter:"\\eb57"}),s.squirrel=new s("squirrel",{fontCharacter:"\\eb58"}),s.starFull=new s("star-full",{fontCharacter:"\\eb59"}),s.starHalf=new s("star-half",{fontCharacter:"\\eb5a"}),s.symbolClass=new s("symbol-class",{fontCharacter:"\\eb5b"}),s.symbolColor=new s("symbol-color",{fontCharacter:"\\eb5c"}),s.symbolConstant=new s("symbol-constant",{fontCharacter:"\\eb5d"}),s.symbolEnumMember=new s("symbol-enum-member",{fontCharacter:"\\eb5e"}),s.symbolField=new s("symbol-field",{fontCharacter:"\\eb5f"}),s.symbolFile=new s("symbol-file",{fontCharacter:"\\eb60"}),s.symbolInterface=new s("symbol-interface",{fontCharacter:"\\eb61"}),s.symbolKeyword=new s("symbol-keyword",{fontCharacter:"\\eb62"}),s.symbolMisc=new s("symbol-misc",{fontCharacter:"\\eb63"}),s.symbolOperator=new s("symbol-operator",{fontCharacter:"\\eb64"}),s.symbolProperty=new s("symbol-property",{fontCharacter:"\\eb65"}),s.wrench=new s("wrench",{fontCharacter:"\\eb65"}),s.wrenchSubaction=new s("wrench-subaction",{fontCharacter:"\\eb65"}),s.symbolSnippet=new s("symbol-snippet",{fontCharacter:"\\eb66"}),s.tasklist=new s("tasklist",{fontCharacter:"\\eb67"}),s.telescope=new s("telescope",{fontCharacter:"\\eb68"}),s.textSize=new s("text-size",{fontCharacter:"\\eb69"}),s.threeBars=new s("three-bars",{fontCharacter:"\\eb6a"}),s.thumbsdown=new s("thumbsdown",{fontCharacter:"\\eb6b"}),s.thumbsup=new s("thumbsup",{fontCharacter:"\\eb6c"}),s.tools=new s("tools",{fontCharacter:"\\eb6d"}),s.triangleDown=new s("triangle-down",{fontCharacter:"\\eb6e"}),s.triangleLeft=new s("triangle-left",{fontCharacter:"\\eb6f"}),s.triangleRight=new s("triangle-right",{fontCharacter:"\\eb70"}),s.triangleUp=new s("triangle-up",{fontCharacter:"\\eb71"}),s.twitter=new s("twitter",{fontCharacter:"\\eb72"}),s.unfold=new s("unfold",{fontCharacter:"\\eb73"}),s.unlock=new s("unlock",{fontCharacter:"\\eb74"}),s.unmute=new s("unmute",{fontCharacter:"\\eb75"}),s.unverified=new s("unverified",{fontCharacter:"\\eb76"}),s.verified=new s("verified",{fontCharacter:"\\eb77"}),s.versions=new s("versions",{fontCharacter:"\\eb78"}),s.vmActive=new s("vm-active",{fontCharacter:"\\eb79"}),s.vmOutline=new s("vm-outline",{fontCharacter:"\\eb7a"}),s.vmRunning=new s("vm-running",{fontCharacter:"\\eb7b"}),s.watch=new s("watch",{fontCharacter:"\\eb7c"}),s.whitespace=new s("whitespace",{fontCharacter:"\\eb7d"}),s.wholeWord=new s("whole-word",{fontCharacter:"\\eb7e"}),s.window=new s("window",{fontCharacter:"\\eb7f"}),s.wordWrap=new s("word-wrap",{fontCharacter:"\\eb80"}),s.zoomIn=new s("zoom-in",{fontCharacter:"\\eb81"}),s.zoomOut=new s("zoom-out",{fontCharacter:"\\eb82"}),s.listFilter=new s("list-filter",{fontCharacter:"\\eb83"}),s.listFlat=new s("list-flat",{fontCharacter:"\\eb84"}),s.listSelection=new s("list-selection",{fontCharacter:"\\eb85"}),s.selection=new s("selection",{fontCharacter:"\\eb85"}),s.listTree=new s("list-tree",{fontCharacter:"\\eb86"}),s.debugBreakpointFunctionUnverified=new s("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),s.debugBreakpointFunction=new s("debug-breakpoint-function",{fontCharacter:"\\eb88"}),s.debugBreakpointFunctionDisabled=new s("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),s.debugStackframeActive=new s("debug-stackframe-active",{fontCharacter:"\\eb89"}),s.debugStackframeDot=new s("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),s.debugStackframe=new s("debug-stackframe",{fontCharacter:"\\eb8b"}),s.debugStackframeFocused=new s("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),s.debugBreakpointUnsupported=new s("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),s.symbolString=new s("symbol-string",{fontCharacter:"\\eb8d"}),s.debugReverseContinue=new s("debug-reverse-continue",{fontCharacter:"\\eb8e"}),s.debugStepBack=new s("debug-step-back",{fontCharacter:"\\eb8f"}),s.debugRestartFrame=new s("debug-restart-frame",{fontCharacter:"\\eb90"}),s.callIncoming=new s("call-incoming",{fontCharacter:"\\eb92"}),s.callOutgoing=new s("call-outgoing",{fontCharacter:"\\eb93"}),s.menu=new s("menu",{fontCharacter:"\\eb94"}),s.expandAll=new s("expand-all",{fontCharacter:"\\eb95"}),s.feedback=new s("feedback",{fontCharacter:"\\eb96"}),s.groupByRefType=new s("group-by-ref-type",{fontCharacter:"\\eb97"}),s.ungroupByRefType=new s("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),s.account=new s("account",{fontCharacter:"\\eb99"}),s.bellDot=new s("bell-dot",{fontCharacter:"\\eb9a"}),s.debugConsole=new s("debug-console",{fontCharacter:"\\eb9b"}),s.library=new s("library",{fontCharacter:"\\eb9c"}),s.output=new s("output",{fontCharacter:"\\eb9d"}),s.runAll=new s("run-all",{fontCharacter:"\\eb9e"}),s.syncIgnored=new s("sync-ignored",{fontCharacter:"\\eb9f"}),s.pinned=new s("pinned",{fontCharacter:"\\eba0"}),s.githubInverted=new s("github-inverted",{fontCharacter:"\\eba1"}),s.debugAlt=new s("debug-alt",{fontCharacter:"\\eb91"}),s.serverProcess=new s("server-process",{fontCharacter:"\\eba2"}),s.serverEnvironment=new s("server-environment",{fontCharacter:"\\eba3"}),s.pass=new s("pass",{fontCharacter:"\\eba4"}),s.stopCircle=new s("stop-circle",{fontCharacter:"\\eba5"}),s.playCircle=new s("play-circle",{fontCharacter:"\\eba6"}),s.record=new s("record",{fontCharacter:"\\eba7"}),s.debugAltSmall=new s("debug-alt-small",{fontCharacter:"\\eba8"}),s.vmConnect=new s("vm-connect",{fontCharacter:"\\eba9"}),s.cloud=new s("cloud",{fontCharacter:"\\ebaa"}),s.merge=new s("merge",{fontCharacter:"\\ebab"}),s.exportIcon=new s("export",{fontCharacter:"\\ebac"}),s.graphLeft=new s("graph-left",{fontCharacter:"\\ebad"}),s.magnet=new s("magnet",{fontCharacter:"\\ebae"}),s.notebook=new s("notebook",{fontCharacter:"\\ebaf"}),s.redo=new s("redo",{fontCharacter:"\\ebb0"}),s.checkAll=new s("check-all",{fontCharacter:"\\ebb1"}),s.pinnedDirty=new s("pinned-dirty",{fontCharacter:"\\ebb2"}),s.passFilled=new s("pass-filled",{fontCharacter:"\\ebb3"}),s.circleLargeFilled=new s("circle-large-filled",{fontCharacter:"\\ebb4"}),s.circleLargeOutline=new s("circle-large-outline",{fontCharacter:"\\ebb5"}),s.combine=new s("combine",{fontCharacter:"\\ebb6"}),s.gather=new s("gather",{fontCharacter:"\\ebb6"}),s.table=new s("table",{fontCharacter:"\\ebb7"}),s.variableGroup=new s("variable-group",{fontCharacter:"\\ebb8"}),s.typeHierarchy=new s("type-hierarchy",{fontCharacter:"\\ebb9"}),s.typeHierarchySub=new s("type-hierarchy-sub",{fontCharacter:"\\ebba"}),s.typeHierarchySuper=new s("type-hierarchy-super",{fontCharacter:"\\ebbb"}),s.gitPullRequestCreate=new s("git-pull-request-create",{fontCharacter:"\\ebbc"}),s.runAbove=new s("run-above",{fontCharacter:"\\ebbd"}),s.runBelow=new s("run-below",{fontCharacter:"\\ebbe"}),s.notebookTemplate=new s("notebook-template",{fontCharacter:"\\ebbf"}),s.debugRerun=new s("debug-rerun",{fontCharacter:"\\ebc0"}),s.workspaceTrusted=new s("workspace-trusted",{fontCharacter:"\\ebc1"}),s.workspaceUntrusted=new s("workspace-untrusted",{fontCharacter:"\\ebc2"}),s.workspaceUnspecified=new s("workspace-unspecified",{fontCharacter:"\\ebc3"}),s.terminalCmd=new s("terminal-cmd",{fontCharacter:"\\ebc4"}),s.terminalDebian=new s("terminal-debian",{fontCharacter:"\\ebc5"}),s.terminalLinux=new s("terminal-linux",{fontCharacter:"\\ebc6"}),s.terminalPowershell=new s("terminal-powershell",{fontCharacter:"\\ebc7"}),s.terminalTmux=new s("terminal-tmux",{fontCharacter:"\\ebc8"}),s.terminalUbuntu=new s("terminal-ubuntu",{fontCharacter:"\\ebc9"}),s.terminalBash=new s("terminal-bash",{fontCharacter:"\\ebca"}),s.arrowSwap=new s("arrow-swap",{fontCharacter:"\\ebcb"}),s.copy=new s("copy",{fontCharacter:"\\ebcc"}),s.personAdd=new s("person-add",{fontCharacter:"\\ebcd"}),s.filterFilled=new s("filter-filled",{fontCharacter:"\\ebce"}),s.wand=new s("wand",{fontCharacter:"\\ebcf"}),s.debugLineByLine=new s("debug-line-by-line",{fontCharacter:"\\ebd0"}),s.inspect=new s("inspect",{fontCharacter:"\\ebd1"}),s.layers=new s("layers",{fontCharacter:"\\ebd2"}),s.layersDot=new s("layers-dot",{fontCharacter:"\\ebd3"}),s.layersActive=new s("layers-active",{fontCharacter:"\\ebd4"}),s.compass=new s("compass",{fontCharacter:"\\ebd5"}),s.compassDot=new s("compass-dot",{fontCharacter:"\\ebd6"}),s.compassActive=new s("compass-active",{fontCharacter:"\\ebd7"}),s.azure=new s("azure",{fontCharacter:"\\ebd8"}),s.issueDraft=new s("issue-draft",{fontCharacter:"\\ebd9"}),s.gitPullRequestClosed=new s("git-pull-request-closed",{fontCharacter:"\\ebda"}),s.gitPullRequestDraft=new s("git-pull-request-draft",{fontCharacter:"\\ebdb"}),s.debugAll=new s("debug-all",{fontCharacter:"\\ebdc"}),s.debugCoverage=new s("debug-coverage",{fontCharacter:"\\ebdd"}),s.runErrors=new s("run-errors",{fontCharacter:"\\ebde"}),s.folderLibrary=new s("folder-library",{fontCharacter:"\\ebdf"}),s.debugContinueSmall=new s("debug-continue-small",{fontCharacter:"\\ebe0"}),s.beakerStop=new s("beaker-stop",{fontCharacter:"\\ebe1"}),s.graphLine=new s("graph-line",{fontCharacter:"\\ebe2"}),s.graphScatter=new s("graph-scatter",{fontCharacter:"\\ebe3"}),s.pieChart=new s("pie-chart",{fontCharacter:"\\ebe4"}),s.bracket=new s("bracket",s.json.definition),s.bracketDot=new s("bracket-dot",{fontCharacter:"\\ebe5"}),s.bracketError=new s("bracket-error",{fontCharacter:"\\ebe6"}),s.lockSmall=new s("lock-small",{fontCharacter:"\\ebe7"}),s.azureDevops=new s("azure-devops",{fontCharacter:"\\ebe8"}),s.verifiedFilled=new s("verified-filled",{fontCharacter:"\\ebe9"})}(F||(F={}))},79881:function(yt,ge,b){"use strict";b.d(ge,{B8:function(){return f},Cp:function(){return D},F0:function(){return v},L6:function(){return y},VV:function(){return F},b1:function(){return s},dL:function(){return K},ri:function(){return w}});class I{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(l){setTimeout(()=>{throw l.stack?new Error(l.message+`
|
|
|
|
|
|
`+l.stack):l},0)}}emit(l){this.listeners.forEach(h=>{h(l)})}onUnexpectedError(l){this.unexpectedErrorHandler(l),this.emit(l)}onUnexpectedExternalError(l){this.unexpectedErrorHandler(l)}}const P=new I;function K(c){F(c)||P.onUnexpectedError(c)}function D(c){F(c)||P.onUnexpectedExternalError(c)}function w(c){if(c instanceof Error){let{name:l,message:h}=c;const d=c.stacktrace||c.stack;return{$isError:!0,name:l,message:h,stack:d}}return c}const _="Canceled";function F(c){return c instanceof Error&&c.name===_&&c.message===_}function v(){const c=new Error(_);return c.name=c.message,c}function s(c){return c?new Error(`Illegal argument: ${c}`):new Error("Illegal argument")}function y(c){return c?new Error(`Illegal state: ${c}`):new Error("Illegal state")}class f extends Error{constructor(l){super("NotSupported"),l&&(this.message=l)}}},4348:function(yt,ge,b){"use strict";b.d(ge,{D0:function(){return f},E7:function(){return c},K3:function(){return y},Q5:function(){return s},ZD:function(){return l},ju:function(){return w}});var I=b(79881),P=b(69323),K=b(34502),D=b(95830),w;(function(h){h.None=()=>P.JT.None;function d(X){return(B,G=null,W)=>{let k=!1,C;return C=X(V=>{if(!k)return C?C.dispose():k=!0,B.call(G,V)},null,W),k&&C.dispose(),C}}h.once=d;function E(X,B){return U((G,W=null,k)=>X(C=>G.call(W,B(C)),null,k))}h.map=E;function T(X,B){return U((G,W=null,k)=>X(C=>{B(C),G.call(W,C)},null,k))}h.forEach=T;function L(X,B){return U((G,W=null,k)=>X(C=>B(C)&&G.call(W,C),null,k))}h.filter=L;function x(X){return X}h.signal=x;function A(...X){return(B,G=null,W)=>(0,P.F8)(...X.map(k=>k(C=>B.call(G,C),null,W)))}h.any=A;function O(X,B,G){let W=G;return E(X,k=>(W=B(W,k),W))}h.reduce=O;function U(X){let B;const G=new s({onFirstListenerAdd(){B=X(G.fire,G)},onLastListenerRemove(){B.dispose()}});return G.event}function N(X,B,G=100,W=!1,k){let C,V,ne,pe=0;const Ce=new s({leakWarningThreshold:k,onFirstListenerAdd(){C=X(We=>{pe++,V=B(V,We),W&&!ne&&(Ce.fire(V),V=void 0),clearTimeout(ne),ne=setTimeout(()=>{const me=V;V=void 0,ne=void 0,(!W||pe>1)&&Ce.fire(me),pe=0},G)})},onLastListenerRemove(){C.dispose()}});return Ce.event}h.debounce=N;function $(X,B=(G,W)=>G===W){let G=!0,W;return L(X,k=>{const C=G||!B(k,W);return G=!1,W=k,C})}h.latch=$;function M(X,B){return[h.filter(X,B),h.filter(X,G=>!B(G))]}h.split=M;function Z(X,B=!1,G=[]){let W=G.slice(),k=X(ne=>{W?W.push(ne):V.fire(ne)});const C=()=>{W&&W.forEach(ne=>V.fire(ne)),W=null},V=new s({onFirstListenerAdd(){k||(k=X(ne=>V.fire(ne)))},onFirstListenerDidAdd(){W&&(B?setTimeout(C):C())},onLastListenerRemove(){k&&k.dispose(),k=null}});return V.event}h.buffer=Z;class q{constructor(B){this.event=B}map(B){return new q(E(this.event,B))}forEach(B){return new q(T(this.event,B))}filter(B){return new q(L(this.event,B))}reduce(B,G){return new q(O(this.event,B,G))}latch(){return new q($(this.event))}debounce(B,G=100,W=!1,k){return new q(N(this.event,B,G,W,k))}on(B,G,W){return this.event(B,G,W)}once(B,G,W){return d(this.event)(B,G,W)}}function se(X){return new q(X)}h.chain=se;function ue(X,B,G=W=>W){const W=(...ne)=>V.fire(G(...ne)),k=()=>X.on(B,W),C=()=>X.removeListener(B,W),V=new s({onFirstListenerAdd:k,onLastListenerRemove:C});return V.event}h.fromNodeEventEmitter=ue;function J(X,B,G=W=>W){const W=(...ne)=>V.fire(G(...ne)),k=()=>X.addEventListener(B,W),C=()=>X.removeEventListener(B,W),V=new s({onFirstListenerAdd:k,onLastListenerRemove:C});return V.event}h.fromDOMEventEmitter=J;function z(X){return new Promise(B=>d(X)(B))}h.toPromise=z})(w||(w={}));class _{constructor(d){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${d}_${_._idPool++}`}start(d){this._stopWatch=new D.G(!0),this._listenerCount=d}stop(){if(this._stopWatch){const d=this._stopWatch.elapsed();this._elapsedOverall+=d,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${d.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}_._idPool=0;let F=-1;class v{constructor(d,E=Math.random().toString(18).slice(2,5)){this.customThreshold=d,this.name=E,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(d){let E=F;if(typeof this.customThreshold=="number"&&(E=this.customThreshold),E<=0||d<E)return;this._stacks||(this._stacks=new Map);const T=new Error().stack.split(`
|
|
|
`).slice(3).join(`
|
|
|
`),L=this._stacks.get(T)||0;if(this._stacks.set(T,L+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=E*.5;let x,A=0;for(const[O,U]of this._stacks)(!x||A<U)&&(x=O,A=U);console.warn(`[${this.name}] potential listener LEAK detected, having ${d} listeners already. MOST frequent listener (${A}):`),console.warn(x)}return()=>{const x=this._stacks.get(T)||0;this._stacks.set(T,x-1)}}}class s{constructor(d){var E;this._disposed=!1,this._options=d,this._leakageMon=F>0?new v(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((E=this._options)===null||E===void 0)&&E._profName?new _(this._options._profName):void 0}get event(){return this._event||(this._event=(d,E,T)=>{var L;this._listeners||(this._listeners=new K.S);const x=this._listeners.isEmpty();x&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const A=this._listeners.push(E?[d,E]:d);x&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,d,E);const O=(L=this._leakageMon)===null||L===void 0?void 0:L.check(this._listeners.size),U=(0,P.OF)(()=>{O&&O(),this._disposed||(A(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return T instanceof P.SL?T.add(U):Array.isArray(T)&&T.push(U),U}),this._event}fire(d){var E,T;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new K.S);for(let L of this._listeners)this._deliveryQueue.push([L,d]);for((E=this._perfMon)===null||E===void 0||E.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[L,x]=this._deliveryQueue.shift();try{typeof L=="function"?L.call(void 0,x):L[0].call(L[1],x)}catch(A){(0,I.dL)(A)}}(T=this._perfMon)===null||T===void 0||T.stop()}}dispose(){var d,E,T,L,x;this._disposed||(this._disposed=!0,(d=this._listeners)===null||d===void 0||d.clear(),(E=this._deliveryQueue)===null||E===void 0||E.clear(),(L=(T=this._options)===null||T===void 0?void 0:T.onLastListenerRemove)===null||L===void 0||L.call(T),(x=this._leakageMon)===null||x===void 0||x.dispose())}}class y extends s{constructor(d){super(d),this._isPaused=0,this._eventQueue=new K.S,this._mergeFn=d==null?void 0:d.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const d=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(d))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(d){this._listeners&&(this._isPaused!==0?this._eventQueue.push(d):super.fire(d))}}class f extends y{constructor(d){var E;super(d),this._delay=(E=d.delay)!==null&&E!==void 0?E:100}fire(d){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(d)}}class c{constructor(){this.buffers=[]}wrapEvent(d){return(E,T,L)=>d(x=>{const A=this.buffers[this.buffers.length-1];A?A.push(()=>E.call(T,x)):E.call(T,x)},void 0,L)}bufferEvents(d){const E=[];this.buffers.push(E);const T=d();return this.buffers.pop(),E.forEach(L=>L()),T}}class l{constructor(){this.listening=!1,this.inputEvent=w.None,this.inputEventListener=P.JT.None,this.emitter=new s({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(d){this.inputEvent=d,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=d(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(yt,ge,b){"use strict";b.d(ge,{I:function(){return I}});function I(P){const K=this;let D=!1,w;return function(){return D||(D=!0,w=P.apply(K,arguments)),w}}},88226:function(yt,ge,b){"use strict";b.d(ge,{$:function(){return I}});var I;(function(P){function K(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}P.is=K;const D=Object.freeze([]);function w(){return D}P.empty=w;function*_(A){yield A}P.single=_;function F(A){return A||D}P.from=F;function v(A){return!A||A[Symbol.iterator]().next().done===!0}P.isEmpty=v;function s(A){return A[Symbol.iterator]().next().value}P.first=s;function y(A,O){for(const U of A)if(O(U))return!0;return!1}P.some=y;function f(A,O){for(const U of A)if(O(U))return U}P.find=f;function*c(A,O){for(const U of A)O(U)&&(yield U)}P.filter=c;function*l(A,O){let U=0;for(const N of A)yield O(N,U++)}P.map=l;function*h(...A){for(const O of A)for(const U of O)yield U}P.concat=h;function*d(A){for(const O of A)for(const U of O)yield U}P.concatNested=d;function E(A,O,U){let N=U;for(const $ of A)N=O(N,$);return N}P.reduce=E;function*T(A,O,U=A.length){for(O<0&&(O+=A.length),U<0?U+=A.length:U>A.length&&(U=A.length);O<U;O++)yield A[O]}P.slice=T;function L(A,O=Number.POSITIVE_INFINITY){const U=[];if(O===0)return[U,A];const N=A[Symbol.iterator]();for(let $=0;$<O;$++){const M=N.next();if(M.done)return[U,P.empty()];U.push(M.value)}return[U,{[Symbol.iterator](){return N}}]}P.consume=L;function x(A,O,U=(N,$)=>N===$){const N=A[Symbol.iterator](),$=O[Symbol.iterator]();for(;;){const M=N.next(),Z=$.next();if(M.done!==Z.done)return!1;if(M.done)return!0;if(!U(M.value,Z.value))return!1}}P.equals=x})(I||(I={}))},69323:function(yt,ge,b){"use strict";b.d(ge,{B9:function(){return l},F8:function(){return h},JT:function(){return T},Jz:function(){return x},OF:function(){return d},SL:function(){return E},Wf:function(){return c},XK:function(){return L},dk:function(){return y}});var I=b(17845),P=b(88226);const K=!1;let D=null;function w(A){D=A}if(K){const A="__is_disposable_tracked__";w(new class{trackDisposable(O){const U=new Error("Potentially leaked disposable").stack;setTimeout(()=>{O[A]||console.log(U)},3e3)}setParent(O,U){if(O&&O!==T.None)try{O[A]=!0}catch(N){}}markAsDisposed(O){if(O&&O!==T.None)try{O[A]=!0}catch(U){}}markAsSingleton(O){}})}function _(A){return D==null||D.trackDisposable(A),A}function F(A){D==null||D.markAsDisposed(A)}function v(A,O){D==null||D.setParent(A,O)}function s(A,O){if(D)for(const U of A)D.setParent(U,O)}function y(A){return D==null||D.markAsSingleton(A),A}class f extends Error{constructor(O){super(`Encountered errors while disposing of store. Errors: [${O.join(", ")}]`),this.errors=O}}function c(A){return typeof A.dispose=="function"&&A.dispose.length===0}function l(A){if(P.$.is(A)){let O=[];for(const U of A)if(U)try{U.dispose()}catch(N){O.push(N)}if(O.length===1)throw O[0];if(O.length>1)throw new f(O);return Array.isArray(A)?[]:A}else if(A)return A.dispose(),A}function h(...A){const O=d(()=>l(A));return s(A,O),O}function d(A){const O=_({dispose:(0,I.I)(()=>{F(O),A()})});return O}class E{constructor(){this._toDispose=new Set,this._isDisposed=!1,_(this)}dispose(){this._isDisposed||(F(this),this._isDisposed=!0,this.clear())}clear(){try{l(this._toDispose.values())}finally{this._toDispose.clear()}}add(O){if(!O)return O;if(O===this)throw new Error("Cannot register a disposable on itself!");return v(O,this),this._isDisposed?E.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(O),O}}E.DISABLE_DISPOSED_WARNING=!1;class T{constructor(){this._store=new E,_(this),v(this._store,this)}dispose(){F(this),this._store.dispose()}_register(O){if(O===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(O)}}T.None=Object.freeze({dispose(){}});class L{constructor(){this._isDisposed=!1,_(this)}get value(){return this._isDisposed?void 0:this._value}set value(O){var U;this._isDisposed||O===this._value||((U=this._value)===null||U===void 0||U.dispose(),O&&v(O,this),this._value=O)}clear(){this.value=void 0}dispose(){var O;this._isDisposed=!0,F(this),(O=this._value)===null||O===void 0||O.dispose(),this._value=void 0}clearAndLeak(){const O=this._value;return this._value=void 0,O&&v(O,null),O}}class x{constructor(O){this.object=O}dispose(){}}},34502:function(yt,ge,b){"use strict";b.d(ge,{S:function(){return P}});class I{constructor(D){this.element=D,this.next=I.Undefined,this.prev=I.Undefined}}I.Undefined=new I(void 0);class P{constructor(){this._first=I.Undefined,this._last=I.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===I.Undefined}clear(){let D=this._first;for(;D!==I.Undefined;){const w=D.next;D.prev=I.Undefined,D.next=I.Undefined,D=w}this._first=I.Undefined,this._last=I.Undefined,this._size=0}unshift(D){return this._insert(D,!1)}push(D){return this._insert(D,!0)}_insert(D,w){const _=new I(D);if(this._first===I.Undefined)this._first=_,this._last=_;else if(w){const v=this._last;this._last=_,_.prev=v,v.next=_}else{const v=this._first;this._first=_,_.next=v,v.prev=_}this._size+=1;let F=!1;return()=>{F||(F=!0,this._remove(_))}}shift(){if(this._first!==I.Undefined){const D=this._first.element;return this._remove(this._first),D}}pop(){if(this._last!==I.Undefined){const D=this._last.element;return this._remove(this._last),D}}_remove(D){if(D.prev!==I.Undefined&&D.next!==I.Undefined){const w=D.prev;w.next=D.next,D.next.prev=w}else D.prev===I.Undefined&&D.next===I.Undefined?(this._first=I.Undefined,this._last=I.Undefined):D.next===I.Undefined?(this._last=this._last.prev,this._last.next=I.Undefined):D.prev===I.Undefined&&(this._first=this._first.next,this._first.prev=I.Undefined);this._size-=1}*[Symbol.iterator](){let D=this._first;for(;D!==I.Undefined;)yield D.element,D=D.next}}},23345:function(yt,ge,b){"use strict";b.d(ge,{$L:function(){return N},ED:function(){return x},IJ:function(){return O},OS:function(){return q},WE:function(){return M},dz:function(){return A},gn:function(){return $},li:function(){return d},r:function(){return J},tY:function(){return U},xS:function(){return Z}});var I=b(97671),P;const K="en";let D=!1,w=!1,_=!1,F=!1,v=!1,s=!1,y=!1,f,c=null,l=null,h;const d=typeof self=="object"?self:typeof b.g=="object"?b.g:{};let E;typeof d.vscode!="undefined"&&typeof d.vscode.process!="undefined"?E=d.vscode.process:typeof I!="undefined"&&(E=I);const T=typeof((P=E==null?void 0:E.versions)===null||P===void 0?void 0:P.electron)=="string"&&E.type==="renderer";if(typeof navigator=="object"&&!T)h=navigator.userAgent,D=h.indexOf("Windows")>=0,w=h.indexOf("Macintosh")>=0,y=(h.indexOf("Macintosh")>=0||h.indexOf("iPad")>=0||h.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_=h.indexOf("Linux")>=0,s=!0,f=navigator.language,c=f;else if(typeof E=="object"){D=E.platform==="win32",w=E.platform==="darwin",_=E.platform==="linux",F=_&&!!E.env.SNAP&&!!E.env.SNAP_REVISION,f=K,c=K;const z=E.env.VSCODE_NLS_CONFIG;if(z)try{const X=JSON.parse(z),B=X.availableLanguages["*"];f=X.locale,c=B||K,l=X._translationsConfigFile}catch(X){}v=!0}else console.error("Unable to resolve platform.");let L=0;w?L=1:D?L=3:_&&(L=2);const x=D,A=w,O=_,U=v,N=s,$=y,M=h,Z=function(){if(d.setImmediate)return d.setImmediate.bind(d);if(typeof d.postMessage=="function"&&!d.importScripts){let B=[];d.addEventListener("message",W=>{if(W.data&&W.data.vscodeSetImmediateId)for(let k=0,C=B.length;k<C;k++){const V=B[k];if(V.id===W.data.vscodeSetImmediateId){B.splice(k,1),V.callback();return}}});let G=0;return W=>{const k=++G;B.push({id:k,callback:W}),d.postMessage({vscodeSetImmediateId:k},"*")}}if(typeof(E==null?void 0:E.nextTick)=="function")return E.nextTick.bind(E);const X=Promise.resolve();return B=>X.then(B)}(),q=w||y?2:D?1:3;let se=!0,ue=!1;function J(){if(!ue){ue=!0;const z=new Uint8Array(2);z[0]=1,z[1]=2,se=new Uint16Array(z.buffer)[0]===513}return se}},95830:function(yt,ge,b){"use strict";b.d(ge,{G:function(){return K}});var I=b(23345);const P=I.li.performance&&typeof I.li.performance.now=="function";class K{constructor(w){this._highResolution=P&&w,this._startTime=this._now(),this._stopTime=-1}static create(w=!0){return new K(w)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?I.li.performance.now():Date.now()}}},82983:function(yt,ge,b){"use strict";b.d(ge,{$i:function(){return pe},C8:function(){return Be},GF:function(){return f},HO:function(){return G},IO:function(){return c},K7:function(){return Ne},Kw:function(){return He},LC:function(){return d},Mh:function(){return Z},P1:function(){return q},PJ:function(){return lt},Qe:function(){return Ce},R1:function(){return y},RP:function(){return V},S6:function(){return Ue},TT:function(){return x},Ut:function(){return k},V8:function(){return E},WU:function(){return K},YK:function(){return ue},YU:function(){return D},ZG:function(){return se},ZH:function(){return z},ab:function(){return We},c1:function(){return Me},df:function(){return N},ec:function(){return w},fi:function(){return bt},fy:function(){return _},j3:function(){return F},j_:function(){return O},m5:function(){return I},mK:function(){return U},mr:function(){return l},oH:function(){return le},oL:function(){return v},ok:function(){return M},ow:function(){return T},qq:function(){return $},qu:function(){return L},rL:function(){return J},uS:function(){return wt},un:function(){return s},uq:function(){return h},vH:function(){return B},xe:function(){return me},zY:function(){return A}});function I(re){return!re||typeof re!="string"?!0:re.trim().length===0}const P=/{(\d+)}/g;function K(re,...fe){return fe.length===0?re:re.replace(P,function(De,Re){const Oe=parseInt(Re,10);return isNaN(Oe)||Oe<0||Oe>=fe.length?De:fe[Oe]})}function D(re){return re.replace(/[<>&]/g,function(fe){switch(fe){case"<":return"<";case">":return">";case"&":return"&";default:return fe}})}function w(re){return re.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function _(re,fe=" "){const De=F(re,fe);return v(De,fe)}function F(re,fe){if(!re||!fe)return re;const De=fe.length;if(De===0||re.length===0)return re;let Re=0;for(;re.indexOf(fe,Re)===Re;)Re=Re+De;return re.substring(Re)}function v(re,fe){if(!re||!fe)return re;const De=fe.length,Re=re.length;if(De===0||Re===0)return re;let Oe=Re,Ye=-1;for(;Ye=re.lastIndexOf(fe,Oe-1),!(Ye===-1||Ye+De!==Oe);){if(Ye===0)return"";Oe=Ye}return re.substring(0,Oe)}function s(re){return re.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function y(re){return re.replace(/\*/g,"")}function f(re,fe,De={}){if(!re)throw new Error("Cannot create regex from empty string");fe||(re=w(re)),De.wholeWord&&(/\B/.test(re.charAt(0))||(re="\\b"+re),/\B/.test(re.charAt(re.length-1))||(re=re+"\\b"));let Re="";return De.global&&(Re+="g"),De.matchCase||(Re+="i"),De.multiline&&(Re+="m"),De.unicode&&(Re+="u"),new RegExp(re,Re)}function c(re){return re.source==="^"||re.source==="^$"||re.source==="$"||re.source==="^\\s*$"?!1:!!(re.exec("")&&re.lastIndex===0)}function l(re){return(re.global?"g":"")+(re.ignoreCase?"i":"")+(re.multiline?"m":"")+(re.unicode?"u":"")}function h(re){return re.split(/\r\n|\r|\n/)}function d(re){for(let fe=0,De=re.length;fe<De;fe++){const Re=re.charCodeAt(fe);if(Re!==32&&Re!==9)return fe}return-1}function E(re,fe=0,De=re.length){for(let Re=fe;Re<De;Re++){const Oe=re.charCodeAt(Re);if(Oe!==32&&Oe!==9)return re.substring(fe,Re)}return re.substring(fe,De)}function T(re,fe=re.length-1){for(let De=fe;De>=0;De--){const Re=re.charCodeAt(De);if(Re!==32&&Re!==9)return De}return-1}function L(re,fe){return re<fe?-1:re>fe?1:0}function x(re,fe,De=0,Re=re.length,Oe=0,Ye=fe.length){for(;De<Re&&Oe<Ye;De++,Oe++){let Xe=re.charCodeAt(De),Ge=fe.charCodeAt(Oe);if(Xe<Ge)return-1;if(Xe>Ge)return 1}const at=Re-De,Qe=Ye-Oe;return at<Qe?-1:at>Qe?1:0}function A(re,fe){return O(re,fe,0,re.length,0,fe.length)}function O(re,fe,De=0,Re=re.length,Oe=0,Ye=fe.length){for(;De<Re&&Oe<Ye;De++,Oe++){let Xe=re.charCodeAt(De),Ge=fe.charCodeAt(Oe);if(Xe===Ge)continue;if(Xe>=128||Ge>=128)return x(re.toLowerCase(),fe.toLowerCase(),De,Re,Oe,Ye);U(Xe)&&(Xe-=32),U(Ge)&&(Ge-=32);const ct=Xe-Ge;if(ct!==0)return ct}const at=Re-De,Qe=Ye-Oe;return at<Qe?-1:at>Qe?1:0}function U(re){return re>=97&&re<=122}function N(re){return re>=65&&re<=90}function $(re,fe){return re.length===fe.length&&O(re,fe)===0}function M(re,fe){const De=fe.length;return fe.length>re.length?!1:O(re,fe,0,De)===0}function Z(re,fe){let De,Re=Math.min(re.length,fe.length);for(De=0;De<Re;De++)if(re.charCodeAt(De)!==fe.charCodeAt(De))return De;return Re}function q(re,fe){let De,Re=Math.min(re.length,fe.length);const Oe=re.length-1,Ye=fe.length-1;for(De=0;De<Re;De++)if(re.charCodeAt(Oe-De)!==fe.charCodeAt(Ye-De))return De;return Re}function se(re){return 55296<=re&&re<=56319}function ue(re){return 56320<=re&&re<=57343}function J(re,fe){return(re-55296<<10)+(fe-56320)+65536}function z(re,fe,De){const Re=re.charCodeAt(De);if(se(Re)&&De+1<fe){const Oe=re.charCodeAt(De+1);if(ue(Oe))return J(Re,Oe)}return Re}function X(re,fe){const De=re.charCodeAt(fe-1);if(ue(De)&&fe>1){const Re=re.charCodeAt(fe-2);if(se(Re))return J(Re,De)}return De}function B(re,fe){const De=be.getInstance(),Re=fe,Oe=re.length,Ye=z(re,Oe,fe);fe+=Ye>=65536?2:1;let at=De.getGraphemeBreakType(Ye);for(;fe<Oe;){const Qe=z(re,Oe,fe),Xe=De.getGraphemeBreakType(Qe);if(bt(at,Xe))break;fe+=Qe>=65536?2:1,at=Xe}return fe-Re}function G(re,fe){const De=be.getInstance(),Re=fe,Oe=X(re,fe);fe-=Oe>=65536?2:1;let Ye=De.getGraphemeBreakType(Oe);for(;fe>0;){const at=X(re,fe),Qe=De.getGraphemeBreakType(at);if(bt(Qe,Ye))break;fe-=at>=65536?2:1,Ye=Qe}return Re-fe}const W=/(?:[\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(re){return W.test(re)}const C=/(?:[\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 V(re){return C.test(re)}const ne=/^[\t\n\r\x20-\x7E]*$/;function pe(re){return ne.test(re)}const Ce=/[\u2028\u2029]/;function We(re){return Ce.test(re)}function me(re){for(let fe=0,De=re.length;fe<De;fe++)if(Ne(re.charCodeAt(fe)))return!0;return!1}function Ne(re){return re=+re,re>=11904&&re<=55215||re>=63744&&re<=64255||re>=65281&&re<=65374}function Be(re){return re>=127462&&re<=127487||re===8986||re===8987||re===9200||re===9203||re>=9728&&re<=10175||re===11088||re===11093||re>=127744&&re<=128591||re>=128640&&re<=128764||re>=128992&&re<=129003||re>=129280&&re<=129535||re>=129648&&re<=129750}const Me="\uFEFF";function wt(re){return!!(re&&re.length>0&&re.charCodeAt(0)===65279)}function He(re,fe=!1){return re?(fe&&(re=re.replace(/\\./g,"")),re.toLowerCase()!==re):!1}function lt(re){return re=re%(2*26),re<26?String.fromCharCode(97+re):String.fromCharCode(65+re-26)}function Ue(re){return be.getInstance().getGraphemeBreakType(re)}function bt(re,fe){return re===0?fe!==5&&fe!==7:re===2&&fe===3?!1:re===4||re===2||re===3||fe===4||fe===2||fe===3?!0:!(re===8&&(fe===8||fe===9||fe===11||fe===12)||(re===11||re===9)&&(fe===9||fe===10)||(re===12||re===10)&&fe===10||fe===5||fe===13||fe===7||re===1||re===13&&fe===14||re===6&&fe===6)}class be{constructor(){this._data=ye()}static getInstance(){return be._INSTANCE||(be._INSTANCE=new be),be._INSTANCE}getGraphemeBreakType(fe){if(fe<32)return fe===10?3:fe===13?2:4;if(fe<127)return 0;const De=this._data,Re=De.length/3;let Oe=1;for(;Oe<=Re;)if(fe<De[3*Oe])Oe=2*Oe;else if(fe>De[3*Oe+1])Oe=2*Oe+1;else return De[3*Oe+2];return 0}}be._INSTANCE=null;function ye(){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 le(re,fe){if(re===0)return 0;const De=ke(re,fe);if(De!==void 0)return De;const Re=X(fe,re);return re-=Fe(Re),re}function ke(re,fe){let De=X(fe,re);for(re-=Fe(De);Ke(De)||De===65039||De===8419;){if(re===0)return;De=X(fe,re),re-=Fe(De)}if(Be(De)){if(re>=0){const Re=X(fe,re);Re===8205&&(re-=Fe(Re))}return re}}function Fe(re){return re>=65536?2:1}function Ke(re){return 127995<=re&&re<=127999}},72999:function(yt,ge,b){"use strict";b.d(ge,{$E:function(){return d},$K:function(){return F},D8:function(){return c},HD:function(){return P},IU:function(){return E},Jp:function(){return v},Kn:function(){return K},cW:function(){return y},f6:function(){return T},hj:function(){return D},jn:function(){return w},kJ:function(){return I},mf:function(){return f},o8:function(){return _},p_:function(){return s},vE:function(){return L}});function I(x){return Array.isArray(x)}function P(x){return typeof x=="string"}function K(x){return typeof x=="object"&&x!==null&&!Array.isArray(x)&&!(x instanceof RegExp)&&!(x instanceof Date)}function D(x){return typeof x=="number"&&!isNaN(x)}function w(x){return x===!0||x===!1}function _(x){return typeof x=="undefined"}function F(x){return!v(x)}function v(x){return _(x)||x===null}function s(x,A){if(!x)throw new Error(A?`Unexpected type, expected '${A}'`:"Unexpected type")}function y(x){if(v(x))throw new Error("Assertion Failed: argument is undefined or null");return x}function f(x){return typeof x=="function"}function c(x,A){const O=Math.min(x.length,A.length);for(let U=0;U<O;U++)l(x[U],A[U])}function l(x,A){if(P(A)){if(typeof x!==A)throw new Error(`argument does not match constraint: typeof ${A}`)}else if(f(A)){try{if(x instanceof A)return}catch(O){}if(!v(x)&&x.constructor===A||A.length===1&&A.call(void 0,x)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function h(x){let A=[],O=Object.getPrototypeOf(x);for(;Object.prototype!==O;)A=A.concat(Object.getOwnPropertyNames(O)),O=Object.getPrototypeOf(O);return A}function d(x){const A=[];for(const O of h(x))typeof x[O]=="function"&&A.push(O);return A}function E(x,A){const O=N=>function(){const $=Array.prototype.slice.call(arguments,0);return A(N,$)};let U={};for(const N of x)U[N]=O(N);return U}function T(x){return x===null?void 0:x}function L(x,A="Unreachable"){throw new Error(A)}},13268:function(yt,ge,b){"use strict";b.d(ge,{N:function(){return P}});function I(K,D){let w;return D.length===0?w=K:w=K.replace(/\{(\d+)\}/g,function(_,F){const v=F[0];return typeof D[v]!="undefined"?D[v]:_}),w}function P(K,D,...w){return I(D,w)}},96236:function(yt,ge,b){"use strict";b.d(ge,{BH:function(){return E},NZ:function(){return T},U8:function(){return L},co:function(){return d},eH:function(){return h},vr:function(){return l}});var I=b(75918),P=b(52615),K=b(4348),D=b(88226),w=b(69323),_=b(34502),F=b(35884),v=b(90689),s=b(16925),y=b(49055),f=function(x,A,O,U){var N=arguments.length,$=N<3?A:U===null?U=Object.getOwnPropertyDescriptor(A,O):U,M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(x,A,O,U);else for(var Z=x.length-1;Z>=0;Z--)(M=x[Z])&&($=(N<3?M($):N>3?M(A,O,$):M(A,O))||$);return N>3&&$&&Object.defineProperty(A,O,$),$},c=function(x,A){return function(O,U){A(O,U,x)}};function l(x){return x.command!==void 0}class h{constructor(A){this.id=h._idPool++,this._debugName=A}}h._idPool=0,h.CommandPalette=new h("CommandPalette"),h.EditorContext=new h("EditorContext"),h.SimpleEditorContext=new h("SimpleEditorContext"),h.EditorContextCopy=new h("EditorContextCopy"),h.EditorContextPeek=new h("EditorContextPeek"),h.MenubarEditMenu=new h("MenubarEditMenu"),h.MenubarCopy=new h("MenubarCopy"),h.MenubarGoMenu=new h("MenubarGoMenu"),h.MenubarSelectionMenu=new h("MenubarSelectionMenu"),h.InlineCompletionsActions=new h("InlineCompletionsActions");const d=(0,s.yh)("menuService"),E=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new K.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:x=>x===h.CommandPalette}}addCommand(x){return this.addCommands(D.$.single(x))}addCommands(x){for(const A of x)this._commands.set(A.id,A);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,w.OF)(()=>{let A=!1;for(const O of x)A=this._commands.delete(O.id)||A;A&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(x){return this._commands.get(x)}getCommands(){const x=new Map;return this._commands.forEach((A,O)=>x.set(O,A)),x}appendMenuItem(x,A){return this.appendMenuItems(D.$.single({id:x,item:A}))}appendMenuItems(x){const A=new Set,O=new _.S;for(const{id:U,item:N}of x){let $=this._menuItems.get(U);$||($=new _.S,this._menuItems.set(U,$)),O.push($.push(N)),A.add(U)}return this._onDidChangeMenu.fire(A),(0,w.OF)(()=>{if(O.size>0){for(let U of O)U();this._onDidChangeMenu.fire(A),O.clear()}})}getMenuItems(x){let A;return this._menuItems.has(x)?A=[...this._menuItems.get(x)]:A=[],x===h.CommandPalette&&this._appendImplicitItems(A),A}_appendImplicitItems(x){const A=new Set;for(const O of x)l(O)&&(A.add(O.command.id),O.alt&&A.add(O.alt.id));this._commands.forEach((O,U)=>{A.has(U)||x.push({command:O})})}};class T extends I.wY{constructor(A,O,U,N){super(`submenuitem.${A.submenu.id}`,typeof A.title=="string"?A.title:A.title.value,[],"submenu"),this.item=A,this._menuService=O,this._contextKeyService=U,this._options=N}get actions(){const A=[],O=this._menuService.createMenu(this.item.submenu,this._contextKeyService),U=O.getActions(this._options);O.dispose();for(const[,N]of U)N.length>0&&(A.push(...N),A.push(new I.Z0));return A.length&&A.pop(),A}}let L=class il{constructor(A,O,U,N,$){var M,Z;if(this._commandService=$,this.id=A.id,this.label=U!=null&&U.renderShortTitle&&A.shortTitle?typeof A.shortTitle=="string"?A.shortTitle:A.shortTitle.value:typeof A.title=="string"?A.title:A.title.value,this.tooltip=(Z=typeof A.tooltip=="string"?A.tooltip:(M=A.tooltip)===null||M===void 0?void 0:M.value)!==null&&Z!==void 0?Z:"",this.enabled=!A.precondition||N.contextMatchesRules(A.precondition),this.checked=void 0,A.toggled){const q=A.toggled.condition?A.toggled:{condition:A.toggled};this.checked=N.contextMatchesRules(q.condition),this.checked&&q.tooltip&&(this.tooltip=typeof q.tooltip=="string"?q.tooltip:q.tooltip.value),q.title&&(this.label=typeof q.title=="string"?q.title:q.title.value)}this.item=A,this.alt=O?new il(O,void 0,U,N,$):void 0,this._options=U,y.kS.isThemeIcon(A.icon)&&(this.class=P.dT.asClassName(A.icon))}dispose(){}run(...A){var O,U;let N=[];return!((O=this._options)===null||O===void 0)&&O.arg&&(N=[...N,this._options.arg]),!((U=this._options)===null||U===void 0)&&U.shouldForwardArgs&&(N=[...N,...A]),this._commandService.executeCommand(this.id,...N)}};L=f([c(3,v.i6),c(4,F.H)],L)},35884:function(yt,ge,b){"use strict";b.d(ge,{H:function(){return F},P:function(){return v}});var I=b(4348),P=b(88226),K=b(69323),D=b(34502),w=b(72999),_=b(16925);const F=(0,_.yh)("commandService"),v=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new I.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(s,y){if(!s)throw new Error("invalid command");if(typeof s=="string"){if(!y)throw new Error("invalid command");return this.registerCommand({id:s,handler:y})}if(s.description){const d=[];for(let T of s.description.args)d.push(T.constraint);const E=s.handler;s.handler=function(T,...L){return(0,w.D8)(L,d),E(T,...L)}}const{id:f}=s;let c=this._commands.get(f);c||(c=new D.S,this._commands.set(f,c));let l=c.unshift(s),h=(0,K.OF)(()=>{l();const d=this._commands.get(f);d!=null&&d.isEmpty()&&this._commands.delete(f)});return this._onDidRegisterCommand.fire(f),h}registerCommandAlias(s,y){return v.registerCommand(s,(f,...c)=>f.get(F).executeCommand(y,...c))}getCommand(s){const y=this._commands.get(s);if(!(!y||y.isEmpty()))return P.$.first(y)}getCommands(){const s=new Map;for(const y of this._commands.keys()){const f=this.getCommand(y);f&&s.set(y,f)}return s}};v.registerCommand("noop",()=>{})},90689:function(yt,ge,b){"use strict";b.d(ge,{Ao:function(){return F},Eq:function(){return J},Fb:function(){return v},K8:function(){return B},i6:function(){return ue},uy:function(){return se}});var I=b(23345),P=b(82983),K=b(16925);let D=I.WE||"";const w=new Map;w.set("false",!1),w.set("true",!0),w.set("isMac",I.dz),w.set("isLinux",I.IJ),w.set("isWindows",I.ED),w.set("isWeb",I.$L),w.set("isMacNative",I.dz&&!I.$L),w.set("isEdge",D.indexOf("Edg/")>=0),w.set("isFirefox",D.indexOf("Firefox")>=0),w.set("isChrome",D.indexOf("Chrome")>=0),w.set("isSafari",D.indexOf("Safari")>=0);const _=Object.prototype.hasOwnProperty;class F{static has(k){return c.create(k)}static equals(k,C){return l.create(k,C)}static regex(k,C){return N.create(k,C)}static not(k){return T.create(k)}static and(...k){return Z.create(k,null)}static or(...k){return q.create(k,null,!0)}static deserialize(k,C=!1){if(k)return this._deserializeOrExpression(k,C)}static _deserializeOrExpression(k,C){let V=k.split("||");return q.create(V.map(ne=>this._deserializeAndExpression(ne,C)),null,!0)}static _deserializeAndExpression(k,C){let V=k.split("&&");return Z.create(V.map(ne=>this._deserializeOne(ne,C)),null)}static _deserializeOne(k,C){if(k=k.trim(),k.indexOf("!=")>=0){let V=k.split("!=");return E.create(V[0].trim(),this._deserializeValue(V[1],C))}if(k.indexOf("==")>=0){let V=k.split("==");return l.create(V[0].trim(),this._deserializeValue(V[1],C))}if(k.indexOf("=~")>=0){let V=k.split("=~");return N.create(V[0].trim(),this._deserializeRegexValue(V[1],C))}if(k.indexOf(" in ")>=0){let V=k.split(" in ");return h.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(k)){const V=k.split(">=");return A.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(k)){const V=k.split(">");return x.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(k)){const V=k.split("<=");return U.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(k)){const V=k.split("<");return O.create(V[0].trim(),V[1].trim())}return/^\!\s*/.test(k)?T.create(k.substr(1).trim()):c.create(k)}static _deserializeValue(k,C){if(k=k.trim(),k==="true")return!0;if(k==="false")return!1;let V=/^'([^']*)'$/.exec(k);return V?V[1].trim():k}static _deserializeRegexValue(k,C){if((0,P.m5)(k)){if(C)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let V=k.indexOf("/"),ne=k.lastIndexOf("/");if(V===ne||V<0){if(C)throw new Error(`bad regexp-value '${k}', missing /-enclosure`);return console.warn(`bad regexp-value '${k}', missing /-enclosure`),null}let pe=k.slice(V+1,ne),Ce=k[ne+1]==="i"?"i":"";try{return new RegExp(pe,Ce)}catch(We){if(C)throw new Error(`bad regexp-value '${k}', parse error: ${We}`);return console.warn(`bad regexp-value '${k}', parse error: ${We}`),null}}}function v(W,k){const C=W?W.substituteConstants():void 0,V=k?k.substituteConstants():void 0;return!C&&!V?!0:!C||!V?!1:C.equals(V)}function s(W,k){return W.cmp(k)}class y{constructor(){this.type=0}cmp(k){return this.type-k.type}equals(k){return k.type===this.type}substituteConstants(){return this}evaluate(k){return!1}serialize(){return"false"}keys(){return[]}negate(){return f.INSTANCE}}y.INSTANCE=new y;class f{constructor(){this.type=1}cmp(k){return this.type-k.type}equals(k){return k.type===this.type}substituteConstants(){return this}evaluate(k){return!0}serialize(){return"true"}keys(){return[]}negate(){return y.INSTANCE}}f.INSTANCE=new f;class c{constructor(k,C){this.key=k,this.negated=C,this.type=2}static create(k,C=null){const V=w.get(k);return typeof V=="boolean"?V?f.INSTANCE:y.INSTANCE:new c(k,C)}cmp(k){return k.type!==this.type?this.type-k.type:z(this.key,k.key)}equals(k){return k.type===this.type?this.key===k.key:!1}substituteConstants(){const k=w.get(this.key);return typeof k=="boolean"?k?f.INSTANCE:y.INSTANCE:this}evaluate(k){return!!k.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=T.create(this.key,this)),this.negated}}class l{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=4}static create(k,C,V=null){if(typeof C=="boolean")return C?c.create(k,V):T.create(k,V);const ne=w.get(k);return typeof ne=="boolean"?C===(ne?"true":"false")?f.INSTANCE:y.INSTANCE:new l(k,C,V)}cmp(k){return k.type!==this.type?this.type-k.type:X(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){const k=w.get(this.key);if(typeof k=="boolean"){const C=k?"true":"false";return this.value===C?f.INSTANCE:y.INSTANCE}return this}evaluate(k){return k.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=E.create(this.key,this.value,this)),this.negated}}class h{constructor(k,C){this.key=k,this.valueKey=C,this.type=10,this.negated=null}static create(k,C){return new h(k,C)}cmp(k){return k.type!==this.type?this.type-k.type:X(this.key,this.valueKey,k.key,k.valueKey)}equals(k){return k.type===this.type?this.key===k.key&&this.valueKey===k.valueKey:!1}substituteConstants(){return this}evaluate(k){const C=k.getValue(this.valueKey),V=k.getValue(this.key);return Array.isArray(C)?C.indexOf(V)>=0:typeof V=="string"&&typeof C=="object"&&C!==null?_.call(C,V):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=d.create(this)),this.negated}}class d{constructor(k){this._actual=k,this.type=11}static create(k){return new d(k)}cmp(k){return k.type!==this.type?this.type-k.type:this._actual.cmp(k._actual)}equals(k){return k.type===this.type?this._actual.equals(k._actual):!1}substituteConstants(){return this}evaluate(k){return!this._actual.evaluate(k)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class E{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=5}static create(k,C,V=null){if(typeof C=="boolean")return C?T.create(k,V):c.create(k,V);const ne=w.get(k);return typeof ne=="boolean"?C===(ne?"true":"false")?y.INSTANCE:f.INSTANCE:new E(k,C,V)}cmp(k){return k.type!==this.type?this.type-k.type:X(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){const k=w.get(this.key);if(typeof k=="boolean"){const C=k?"true":"false";return this.value===C?y.INSTANCE:f.INSTANCE}return this}evaluate(k){return k.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=l.create(this.key,this.value,this)),this.negated}}class T{constructor(k,C){this.key=k,this.negated=C,this.type=3}static create(k,C=null){const V=w.get(k);return typeof V=="boolean"?V?y.INSTANCE:f.INSTANCE:new T(k,C)}cmp(k){return k.type!==this.type?this.type-k.type:z(this.key,k.key)}equals(k){return k.type===this.type?this.key===k.key:!1}substituteConstants(){const k=w.get(this.key);return typeof k=="boolean"?k?y.INSTANCE:f.INSTANCE:this}evaluate(k){return!k.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=c.create(this.key,this)),this.negated}}function L(W,k){if(typeof W=="string"){const C=parseFloat(W);isNaN(C)||(W=C)}return typeof W=="string"||typeof W=="number"?k(W):y.INSTANCE}class x{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=12}static create(k,C,V=null){return L(C,ne=>new x(k,ne,V))}cmp(k){return k.type!==this.type?this.type-k.type:X(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){return this}evaluate(k){return typeof this.value=="string"?!1:parseFloat(k.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=U.create(this.key,this.value,this)),this.negated}}class A{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=13}static create(k,C,V=null){return L(C,ne=>new A(k,ne,V))}cmp(k){return k.type!==this.type?this.type-k.type:X(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){return this}evaluate(k){return typeof this.value=="string"?!1:parseFloat(k.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=O.create(this.key,this.value,this)),this.negated}}class O{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=14}static create(k,C,V=null){return L(C,ne=>new O(k,ne,V))}cmp(k){return k.type!==this.type?this.type-k.type:X(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){return this}evaluate(k){return typeof this.value=="string"?!1:parseFloat(k.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=A.create(this.key,this.value,this)),this.negated}}class U{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=15}static create(k,C,V=null){return L(C,ne=>new U(k,ne,V))}cmp(k){return k.type!==this.type?this.type-k.type:X(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){return this}evaluate(k){return typeof this.value=="string"?!1:parseFloat(k.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=x.create(this.key,this.value,this)),this.negated}}class N{constructor(k,C){this.key=k,this.regexp=C,this.type=7,this.negated=null}static create(k,C){return new N(k,C)}cmp(k){if(k.type!==this.type)return this.type-k.type;if(this.key<k.key)return-1;if(this.key>k.key)return 1;const C=this.regexp?this.regexp.source:"",V=k.regexp?k.regexp.source:"";return C<V?-1:C>V?1:0}equals(k){if(k.type===this.type){const C=this.regexp?this.regexp.source:"",V=k.regexp?k.regexp.source:"";return this.key===k.key&&C===V}return!1}substituteConstants(){return this}evaluate(k){let C=k.getValue(this.key);return this.regexp?this.regexp.test(C):!1}serialize(){const k=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${k}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=$.create(this)),this.negated}}class ${constructor(k){this._actual=k,this.type=8}static create(k){return new $(k)}cmp(k){return k.type!==this.type?this.type-k.type:this._actual.cmp(k._actual)}equals(k){return k.type===this.type?this._actual.equals(k._actual):!1}substituteConstants(){return this}evaluate(k){return!this._actual.evaluate(k)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function M(W){let k=null;for(let C=0,V=W.length;C<V;C++){const ne=W[C].substituteConstants();if(W[C]!==ne&&k===null){k=[];for(let pe=0;pe<C;pe++)k[pe]=W[pe]}k!==null&&(k[C]=ne)}return k===null?W:k}class Z{constructor(k,C){this.expr=k,this.negated=C,this.type=6}static create(k,C){return Z._normalizeArr(k,C)}cmp(k){if(k.type!==this.type)return this.type-k.type;if(this.expr.length<k.expr.length)return-1;if(this.expr.length>k.expr.length)return 1;for(let C=0,V=this.expr.length;C<V;C++){const ne=s(this.expr[C],k.expr[C]);if(ne!==0)return ne}return 0}equals(k){if(k.type===this.type){if(this.expr.length!==k.expr.length)return!1;for(let C=0,V=this.expr.length;C<V;C++)if(!this.expr[C].equals(k.expr[C]))return!1;return!0}return!1}substituteConstants(){const k=M(this.expr);return k===this.expr?this:Z.create(k,this.negated)}evaluate(k){for(let C=0,V=this.expr.length;C<V;C++)if(!this.expr[C].evaluate(k))return!1;return!0}static _normalizeArr(k,C){const V=[];let ne=!1;for(const pe of k)if(pe){if(pe.type===1){ne=!0;continue}if(pe.type===0)return y.INSTANCE;if(pe.type===6){V.push(...pe.expr);continue}V.push(pe)}if(V.length===0&&ne)return f.INSTANCE;if(V.length!==0){if(V.length===1)return V[0];V.sort(s);for(let pe=1;pe<V.length;pe++)V[pe-1].equals(V[pe])&&(V.splice(pe,1),pe--);if(V.length===1)return V[0];for(;V.length>1;){const pe=V[V.length-1];if(pe.type!==9)break;V.pop();const Ce=V.pop(),We=V.length===0,me=q.create(pe.expr.map(Ne=>Z.create([Ne,Ce],null)),null,We);me&&(V.push(me),V.sort(s))}return V.length===1?V[0]:new Z(V,C)}}serialize(){return this.expr.map(k=>k.serialize()).join(" && ")}keys(){const k=[];for(let C of this.expr)k.push(...C.keys());return k}negate(){if(!this.negated){const k=[];for(let C of this.expr)k.push(C.negate());this.negated=q.create(k,this,!0)}return this.negated}}class q{constructor(k,C){this.expr=k,this.negated=C,this.type=9}static create(k,C,V){return q._normalizeArr(k,C,V)}cmp(k){if(k.type!==this.type)return this.type-k.type;if(this.expr.length<k.expr.length)return-1;if(this.expr.length>k.expr.length)return 1;for(let C=0,V=this.expr.length;C<V;C++){const ne=s(this.expr[C],k.expr[C]);if(ne!==0)return ne}return 0}equals(k){if(k.type===this.type){if(this.expr.length!==k.expr.length)return!1;for(let C=0,V=this.expr.length;C<V;C++)if(!this.expr[C].equals(k.expr[C]))return!1;return!0}return!1}substituteConstants(){const k=M(this.expr);return k===this.expr?this:q.create(k,this.negated,!1)}evaluate(k){for(let C=0,V=this.expr.length;C<V;C++)if(this.expr[C].evaluate(k))return!0;return!1}static _normalizeArr(k,C,V){let ne=[],pe=!1;if(k){for(let Ce=0,We=k.length;Ce<We;Ce++){const me=k[Ce];if(me){if(me.type===0){pe=!0;continue}if(me.type===1)return f.INSTANCE;if(me.type===9){ne=ne.concat(me.expr);continue}ne.push(me)}}if(ne.length===0&&pe)return y.INSTANCE;ne.sort(s)}if(ne.length!==0){if(ne.length===1)return ne[0];for(let Ce=1;Ce<ne.length;Ce++)ne[Ce-1].equals(ne[Ce])&&(ne.splice(Ce,1),Ce--);if(ne.length===1)return ne[0];if(V){for(let Ce=0;Ce<ne.length;Ce++)for(let We=Ce+1;We<ne.length;We++)B(ne[Ce],ne[We])&&(ne.splice(We,1),We--);if(ne.length===1)return ne[0]}return new q(ne,C)}}serialize(){return this.expr.map(k=>k.serialize()).join(" || ")}keys(){const k=[];for(let C of this.expr)k.push(...C.keys());return k}negate(){if(!this.negated){let k=[];for(let C of this.expr)k.push(C.negate());for(;k.length>1;){const C=k.shift(),V=k.shift(),ne=[];for(const Ce of G(C))for(const We of G(V))ne.push(Z.create([Ce,We],null));const pe=k.length===0;k.unshift(q.create(ne,null,pe))}this.negated=k[0]}return this.negated}}class se extends c{constructor(k,C,V){super(k,null),this._defaultValue=C,typeof V=="object"?se._info.push(Object.assign(Object.assign({},V),{key:k})):V!==!0&&se._info.push({key:k,description:V,type:C!=null?typeof C:void 0})}static all(){return se._info.values()}bindTo(k){return k.createKey(this.key,this._defaultValue)}getValue(k){return k.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(k){return l.create(this.key,k)}}se._info=[];const ue=(0,K.yh)("contextKeyService"),J="setContext";function z(W,k){return W<k?-1:W>k?1:0}function X(W,k,C,V){return W<C?-1:W>C?1:k<V?-1:k>V?1:0}function B(W,k){if(k.type===6&&W.type!==9&&W.type!==6){for(const ne of k.expr)if(W.equals(ne))return!0}const C=W.negate(),V=G(C).concat(G(k));V.sort(s);for(let ne=0;ne<V.length;ne++){const Ce=V[ne].negate();for(let We=ne+1;We<V.length;We++){const me=V[We];if(Ce.equals(me))return!0}}return!1}function G(W){return W.type===9?W.expr:[W]}},16925:function(yt,ge,b){"use strict";b.d(ge,{I8:function(){return I},TG:function(){return P},jt:function(){return w},yh:function(){return D}});var I;(function(_){_.serviceIds=new Map,_.DI_TARGET="$di$target",_.DI_DEPENDENCIES="$di$dependencies";function F(v){return v[_.DI_DEPENDENCIES]||[]}_.getServiceDependencies=F})(I||(I={}));const P=D("instantiationService");function K(_,F,v,s){F[I.DI_TARGET]===F?F[I.DI_DEPENDENCIES].push({id:_,index:v,optional:s}):(F[I.DI_DEPENDENCIES]=[{id:_,index:v,optional:s}],F[I.DI_TARGET]=F)}function D(_){if(I.serviceIds.has(_))return I.serviceIds.get(_);const F=function(v,s,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");K(F,v,y,!1)};return F.toString=()=>_,I.serviceIds.set(_,F),F}function w(_){return function(F,v,s){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");K(_,F,s,!0)}}},44650:function(yt,ge,b){"use strict";b.d(ge,{B:function(){return D}});var I=b(76068),P=b(72999);class K{constructor(){this.data=new Map}add(_,F){I.ok(P.HD(_)),I.ok(P.Kn(F)),I.ok(!this.data.has(_),"There is already an extension with this id"),this.data.set(_,F)}as(_){return this.data.get(_)||null}}const D=new K},66213:function(yt,ge,b){"use strict";b.d(ge,{e:function(){return I}});var I;(function(P){P.DARK="dark",P.LIGHT="light",P.HIGH_CONTRAST="hc"})(I||(I={}))},49055:function(yt,ge,b){"use strict";b.d(ge,{EN:function(){return s},IP:function(){return c},Ic:function(){return d},XE:function(){return F},bB:function(){return E},kS:function(){return y},m6:function(){return f}});var I=b(52615),P=b(4348),K=b(69323),D=b(16925),w=b(44650),_=b(66213);const F=(0,D.yh)("themeService");var v;(function(T){function L(x){return x&&typeof x=="object"&&typeof x.id=="string"}T.isThemeColor=L})(v||(v={}));function s(T){return{id:T}}var y;(function(T){function L($){return $&&typeof $=="object"&&typeof $.id=="string"&&(typeof $.color=="undefined"||v.isThemeColor($.color))}T.isThemeIcon=L;const x=new RegExp(`^\\$\\((${I.dT.iconNameExpression}(?:${I.dT.iconModifierExpression})?)\\)$`);function A($){const M=x.exec($);if(!M)return;let[,Z]=M;return{id:Z}}T.fromString=A;function O($,M){let Z=$.id;const q=Z.lastIndexOf("~");return q!==-1&&(Z=Z.substring(0,q)),M&&(Z=`${Z}~${M}`),{id:Z}}T.modify=O;function U($,M){var Z,q;return $.id===M.id&&((Z=$.color)===null||Z===void 0?void 0:Z.id)===((q=M.color)===null||q===void 0?void 0:q.id)}T.isEqual=U;function N($,M){return{id:$.id,color:M?s(M):void 0}}T.asThemeIcon=N,T.asClassNameArray=I.dT.asClassNameArray,T.asClassName=I.dT.asClassName,T.asCSSSelector=I.dT.asCSSSelector})(y||(y={}));function f(T){switch(T){case _.e.DARK:return"vs-dark";case _.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const c={ThemingContribution:"base.contributions.theming"};class l{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new P.Q5}onColorThemeChange(L){return this.themingParticipants.push(L),this.onThemingParticipantAddedEmitter.fire(L),(0,K.OF)(()=>{const x=this.themingParticipants.indexOf(L);this.themingParticipants.splice(x,1)})}getThemingParticipants(){return this.themingParticipants}}let h=new l;w.B.add(c.ThemingContribution,h);function d(T){return h.onColorThemeChange(T)}class E extends K.JT{constructor(L){super(),this.themeService=L,this.theme=L.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(x=>this.onThemeChange(x)))}onThemeChange(L){this.theme=L,this.updateStyles()}updateStyles(){}}},66003:function(yt,ge,b){"use strict";b.d(ge,{Z:function(){return F}});var I=b(43079),P=b(27247),K=b(34666),D=b(59301),w=["show"];function _(v,s){if(!s.max)return!0;var y=s.strategy(v);return y<=s.max}function F(v,s){return D.useMemo(function(){var y={};s&&(y.show=(0,K.Z)(s)==="object"&&s.formatter?s.formatter:!!s),y=(0,P.Z)((0,P.Z)({},y),v);var f=y,c=f.show,l=(0,I.Z)(f,w);return(0,P.Z)((0,P.Z)({},l),{},{show:!!c,showFormatter:typeof c=="function"?c:void 0,strategy:l.strategy||function(h){return h.length}})},[v,s])}},36901:function(yt,ge,b){"use strict";b.r(ge),b.d(ge,{BaseInput:function(){return y},default:function(){return A}});var I=b(27247),P=b(32855),K=b(74430),D=b(34666),w=b(92310),_=b.n(w),F=b(59301),v=b(30292),s=F.forwardRef(function(O,U){var N,$,M,Z=O.inputElement,q=O.children,se=O.prefixCls,ue=O.prefix,J=O.suffix,z=O.addonBefore,X=O.addonAfter,B=O.className,G=O.style,W=O.disabled,k=O.readOnly,C=O.focused,V=O.triggerFocus,ne=O.allowClear,pe=O.value,Ce=O.handleReset,We=O.hidden,me=O.classes,Ne=O.classNames,Be=O.dataAttrs,Me=O.styles,wt=O.components,He=O.onClear,lt=q!=null?q:Z,Ue=(wt==null?void 0:wt.affixWrapper)||"span",bt=(wt==null?void 0:wt.groupWrapper)||"span",be=(wt==null?void 0:wt.wrapper)||"span",ye=(wt==null?void 0:wt.groupAddon)||"span",le=(0,F.useRef)(null),ke=function(rt){var Ze;(Ze=le.current)!==null&&Ze!==void 0&&Ze.contains(rt.target)&&(V==null||V())},Fe=(0,v.X3)(O),Ke=(0,F.cloneElement)(lt,{value:pe,className:_()((N=lt.props)===null||N===void 0?void 0:N.className,!Fe&&(Ne==null?void 0:Ne.variant))||null}),re=(0,F.useRef)(null);if(F.useImperativeHandle(U,function(){return{nativeElement:re.current||le.current}}),Fe){var fe=null;if(ne){var De=!W&&!k&&pe,Re="".concat(se,"-clear-icon"),Oe=(0,D.Z)(ne)==="object"&&ne!==null&&ne!==void 0&&ne.clearIcon?ne.clearIcon:"\u2716";fe=F.createElement("button",{type:"button",tabIndex:-1,onClick:function(rt){Ce==null||Ce(rt),He==null||He()},onMouseDown:function(rt){return rt.preventDefault()},className:_()(Re,(0,K.Z)((0,K.Z)({},"".concat(Re,"-hidden"),!De),"".concat(Re,"-has-suffix"),!!J))},Oe)}var Ye="".concat(se,"-affix-wrapper"),at=_()(Ye,(0,K.Z)((0,K.Z)((0,K.Z)((0,K.Z)((0,K.Z)({},"".concat(se,"-disabled"),W),"".concat(Ye,"-disabled"),W),"".concat(Ye,"-focused"),C),"".concat(Ye,"-readonly"),k),"".concat(Ye,"-input-with-clear-btn"),J&&ne&&pe),me==null?void 0:me.affixWrapper,Ne==null?void 0:Ne.affixWrapper,Ne==null?void 0:Ne.variant),Qe=(J||ne)&&F.createElement("span",{className:_()("".concat(se,"-suffix"),Ne==null?void 0:Ne.suffix),style:Me==null?void 0:Me.suffix},fe,J);Ke=F.createElement(Ue,(0,P.Z)({className:at,style:Me==null?void 0:Me.affixWrapper,onClick:ke},Be==null?void 0:Be.affixWrapper,{ref:le}),ue&&F.createElement("span",{className:_()("".concat(se,"-prefix"),Ne==null?void 0:Ne.prefix),style:Me==null?void 0:Me.prefix},ue),Ke,Qe)}if((0,v.He)(O)){var Xe="".concat(se,"-group"),Ge="".concat(Xe,"-addon"),ct="".concat(Xe,"-wrapper"),ot=_()("".concat(se,"-wrapper"),Xe,me==null?void 0:me.wrapper,Ne==null?void 0:Ne.wrapper),it=_()(ct,(0,K.Z)({},"".concat(ct,"-disabled"),W),me==null?void 0:me.group,Ne==null?void 0:Ne.groupWrapper);Ke=F.createElement(bt,{className:it,ref:re},F.createElement(be,{className:ot},z&&F.createElement(ye,{className:Ge},z),Ke,X&&F.createElement(ye,{className:Ge},X)))}return F.cloneElement(Ke,{className:_()(($=Ke.props)===null||$===void 0?void 0:$.className,B)||null,style:(0,I.Z)((0,I.Z)({},(M=Ke.props)===null||M===void 0?void 0:M.style),G),hidden:We})}),y=s,f=b(3300),c=b(11913),l=b(43079),h=b(18929),d=b(2738),E=b(66003),T=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],L=(0,F.forwardRef)(function(O,U){var N=O.autoComplete,$=O.onChange,M=O.onFocus,Z=O.onBlur,q=O.onPressEnter,se=O.onKeyDown,ue=O.onKeyUp,J=O.prefixCls,z=J===void 0?"rc-input":J,X=O.disabled,B=O.htmlSize,G=O.className,W=O.maxLength,k=O.suffix,C=O.showCount,V=O.count,ne=O.type,pe=ne===void 0?"text":ne,Ce=O.classes,We=O.classNames,me=O.styles,Ne=O.onCompositionStart,Be=O.onCompositionEnd,Me=(0,l.Z)(O,T),wt=(0,F.useState)(!1),He=(0,c.Z)(wt,2),lt=He[0],Ue=He[1],bt=(0,F.useRef)(!1),be=(0,F.useRef)(!1),ye=(0,F.useRef)(null),le=(0,F.useRef)(null),ke=function(Dt){ye.current&&(0,v.nH)(ye.current,Dt)},Fe=(0,h.Z)(O.defaultValue,{value:O.value}),Ke=(0,c.Z)(Fe,2),re=Ke[0],fe=Ke[1],De=re==null?"":String(re),Re=(0,F.useState)(null),Oe=(0,c.Z)(Re,2),Ye=Oe[0],at=Oe[1],Qe=(0,E.Z)(V,C),Xe=Qe.max||W,Ge=Qe.strategy(De),ct=!!Xe&&Ge>Xe;(0,F.useImperativeHandle)(U,function(){var nt;return{focus:ke,blur:function(){var Se;(Se=ye.current)===null||Se===void 0||Se.blur()},setSelectionRange:function(Se,_e,ve){var ee;(ee=ye.current)===null||ee===void 0||ee.setSelectionRange(Se,_e,ve)},select:function(){var Se;(Se=ye.current)===null||Se===void 0||Se.select()},input:ye.current,nativeElement:((nt=le.current)===null||nt===void 0?void 0:nt.nativeElement)||ye.current}}),(0,F.useEffect)(function(){be.current&&(be.current=!1),Ue(function(nt){return nt&&X?!1:nt})},[X]);var ot=function(Dt,Se,_e){var ve=Se;if(!bt.current&&Qe.exceedFormatter&&Qe.max&&Qe.strategy(Se)>Qe.max){if(ve=Qe.exceedFormatter(Se,{max:Qe.max}),Se!==ve){var ee,ie;at([((ee=ye.current)===null||ee===void 0?void 0:ee.selectionStart)||0,((ie=ye.current)===null||ie===void 0?void 0:ie.selectionEnd)||0])}}else if(_e.source==="compositionEnd")return;fe(ve),ye.current&&(0,v.rJ)(ye.current,Dt,$,ve)};(0,F.useEffect)(function(){if(Ye){var nt;(nt=ye.current)===null||nt===void 0||nt.setSelectionRange.apply(nt,(0,f.Z)(Ye))}},[Ye]);var it=function(Dt){ot(Dt,Dt.target.value,{source:"change"})},we=function(Dt){bt.current=!1,ot(Dt,Dt.currentTarget.value,{source:"compositionEnd"}),Be==null||Be(Dt)},rt=function(Dt){q&&Dt.key==="Enter"&&!be.current&&(be.current=!0,q(Dt)),se==null||se(Dt)},Ze=function(Dt){Dt.key==="Enter"&&(be.current=!1),ue==null||ue(Dt)},je=function(Dt){Ue(!0),M==null||M(Dt)},mt=function(Dt){be.current&&(be.current=!1),Ue(!1),Z==null||Z(Dt)},Et=function(Dt){fe(""),ke(),ye.current&&(0,v.rJ)(ye.current,Dt,$)},st=ct&&"".concat(z,"-out-of-range"),Rt=function(){var Dt=(0,d.Z)(O,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return F.createElement("input",(0,P.Z)({autoComplete:N},Dt,{onChange:it,onFocus:je,onBlur:mt,onKeyDown:rt,onKeyUp:Ze,className:_()(z,(0,K.Z)({},"".concat(z,"-disabled"),X),We==null?void 0:We.input),style:me==null?void 0:me.input,ref:ye,size:B,type:pe,onCompositionStart:function(_e){bt.current=!0,Ne==null||Ne(_e)},onCompositionEnd:we}))},Nt=function(){var Dt=Number(Xe)>0;if(k||Qe.show){var Se=Qe.showFormatter?Qe.showFormatter({value:De,count:Ge,maxLength:Xe}):"".concat(Ge).concat(Dt?" / ".concat(Xe):"");return F.createElement(F.Fragment,null,Qe.show&&F.createElement("span",{className:_()("".concat(z,"-show-count-suffix"),(0,K.Z)({},"".concat(z,"-show-count-has-suffix"),!!k),We==null?void 0:We.count),style:(0,I.Z)({},me==null?void 0:me.count)},Se),k)}return null};return F.createElement(y,(0,P.Z)({},Me,{prefixCls:z,className:_()(G,st),handleReset:Et,value:De,focused:lt,triggerFocus:ke,suffix:Nt(),disabled:X,classes:Ce,classNames:We,styles:me}),Rt())}),x=L,A=x},30292:function(yt,ge,b){"use strict";b.d(ge,{He:function(){return I},X3:function(){return P},nH:function(){return w},rJ:function(){return D}});function I(_){return!!(_.addonBefore||_.addonAfter)}function P(_){return!!(_.prefix||_.suffix||_.allowClear)}function K(_,F,v){var s=F.cloneNode(!0),y=Object.create(_,{target:{value:s},currentTarget:{value:s}});return s.value=v,typeof F.selectionStart=="number"&&typeof F.selectionEnd=="number"&&(s.selectionStart=F.selectionStart,s.selectionEnd=F.selectionEnd),s.setSelectionRange=function(){F.setSelectionRange.apply(F,arguments)},y}function D(_,F,v,s){if(v){var y=F;if(F.type==="click"){y=K(F,_,""),v(y);return}if(_.type!=="file"&&s!==void 0){y=K(F,_,s),v(y);return}v(y)}}function w(_,F){if(_){_.focus(F);var v=F||{},s=v.cursor;if(s){var y=_.value.length;switch(s){case"start":_.setSelectionRange(0,0);break;case"end":_.setSelectionRange(y,y);break;default:_.setSelectionRange(0,y)}}}}},29301:function(yt,ge,b){"use strict";b.d(ge,{Z:function(){return J}});var I=b(32855),P=b(59301),K=b(11592),D=b(48736),w=b(27247),_=b(34666),F=b(76846),v=b(8654),s=P.createContext(null);function y(z){var X=z.children,B=z.onBatchResize,G=P.useRef(0),W=P.useRef([]),k=P.useContext(s),C=P.useCallback(function(V,ne,pe){G.current+=1;var Ce=G.current;W.current.push({size:V,element:ne,data:pe}),Promise.resolve().then(function(){Ce===G.current&&(B==null||B(W.current),W.current=[])}),k==null||k(V,ne,pe)},[B,k]);return P.createElement(s.Provider,{value:C},X)}var f=b(76374),c=new Map;function l(z){z.forEach(function(X){var B,G=X.target;(B=c.get(G))===null||B===void 0||B.forEach(function(W){return W(G)})})}var h=new f.Z(l),d=null,E=null;function T(z,X){c.has(z)||(c.set(z,new Set),h.observe(z)),c.get(z).add(X)}function L(z,X){c.has(z)&&(c.get(z).delete(X),c.get(z).size||(h.unobserve(z),c.delete(z)))}var x=b(33377),A=b(93912),O=b(18881),U=b(85461),N=function(z){(0,O.Z)(B,z);var X=(0,U.Z)(B);function B(){return(0,x.Z)(this,B),X.apply(this,arguments)}return(0,A.Z)(B,[{key:"render",value:function(){return this.props.children}}]),B}(P.Component);function $(z,X){var B=z.children,G=z.disabled,W=P.useRef(null),k=P.useRef(null),C=P.useContext(s),V=typeof B=="function",ne=V?B(W):B,pe=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ce=!V&&P.isValidElement(ne)&&(0,v.Yr)(ne),We=Ce?(0,v.C4)(ne):null,me=(0,v.x1)(We,W),Ne=function(){var He;return(0,F.ZP)(W.current)||(W.current&&(0,_.Z)(W.current)==="object"?(0,F.ZP)((He=W.current)===null||He===void 0?void 0:He.nativeElement):null)||(0,F.ZP)(k.current)};P.useImperativeHandle(X,function(){return Ne()});var Be=P.useRef(z);Be.current=z;var Me=P.useCallback(function(wt){var He=Be.current,lt=He.onResize,Ue=He.data,bt=wt.getBoundingClientRect(),be=bt.width,ye=bt.height,le=wt.offsetWidth,ke=wt.offsetHeight,Fe=Math.floor(be),Ke=Math.floor(ye);if(pe.current.width!==Fe||pe.current.height!==Ke||pe.current.offsetWidth!==le||pe.current.offsetHeight!==ke){var re={width:Fe,height:Ke,offsetWidth:le,offsetHeight:ke};pe.current=re;var fe=le===Math.round(be)?be:le,De=ke===Math.round(ye)?ye:ke,Re=(0,w.Z)((0,w.Z)({},re),{},{offsetWidth:fe,offsetHeight:De});C==null||C(Re,wt,Ue),lt&&Promise.resolve().then(function(){lt(Re,wt)})}},[]);return P.useEffect(function(){var wt=Ne();return wt&&!G&&T(wt,Me),function(){return L(wt,Me)}},[W.current,G]),P.createElement(N,{ref:k},Ce?P.cloneElement(ne,{ref:me}):ne)}var M=P.forwardRef($),Z=M,q="rc-observer-key";function se(z,X){var B=z.children,G=typeof B=="function"?[B]:(0,K.Z)(B);return G.map(function(W,k){var C=(W==null?void 0:W.key)||"".concat(q,"-").concat(k);return P.createElement(Z,(0,I.Z)({},z,{key:C,ref:k===0?X:void 0}),W)})}var ue=P.forwardRef(se);ue.Collection=y;var J=ue},22711:function(yt,ge,b){"use strict";b.r(ge),b.d(ge,{ResizableTextArea:function(){return ue},default:function(){return B}});var I=b(32855),P=b(74430),K=b(27247),D=b(3300),w=b(11913),_=b(43079),F=b(92310),v=b.n(F),s=b(36901),y=b(66003),f=b(30292),c=b(18929),l=b(59301),h=b(34666),d=b(29301),E=b(34280),T=b(16089),L=`
|
|
|
min-height:0 !important;
|
|
|
max-height:none !important;
|
|
|
height:0 !important;
|
|
|
visibility:hidden !important;
|
|
|
overflow:hidden !important;
|
|
|
position:absolute !important;
|
|
|
z-index:-1000 !important;
|
|
|
top:0 !important;
|
|
|
right:0 !important;
|
|
|
pointer-events: none !important;
|
|
|
`,x=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],A={},O;function U(G){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,k=G.getAttribute("id")||G.getAttribute("data-reactid")||G.getAttribute("name");if(W&&A[k])return A[k];var C=window.getComputedStyle(G),V=C.getPropertyValue("box-sizing")||C.getPropertyValue("-moz-box-sizing")||C.getPropertyValue("-webkit-box-sizing"),ne=parseFloat(C.getPropertyValue("padding-bottom"))+parseFloat(C.getPropertyValue("padding-top")),pe=parseFloat(C.getPropertyValue("border-bottom-width"))+parseFloat(C.getPropertyValue("border-top-width")),Ce=x.map(function(me){return"".concat(me,":").concat(C.getPropertyValue(me))}).join(";"),We={sizingStyle:Ce,paddingSize:ne,borderSize:pe,boxSizing:V};return W&&k&&(A[k]=We),We}function N(G){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,C=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;O||(O=document.createElement("textarea"),O.setAttribute("tab-index","-1"),O.setAttribute("aria-hidden","true"),O.setAttribute("name","hiddenTextarea"),document.body.appendChild(O)),G.getAttribute("wrap")?O.setAttribute("wrap",G.getAttribute("wrap")):O.removeAttribute("wrap");var V=U(G,W),ne=V.paddingSize,pe=V.borderSize,Ce=V.boxSizing,We=V.sizingStyle;O.setAttribute("style","".concat(We,";").concat(L)),O.value=G.value||G.placeholder||"";var me=void 0,Ne=void 0,Be,Me=O.scrollHeight;if(Ce==="border-box"?Me+=pe:Ce==="content-box"&&(Me-=ne),k!==null||C!==null){O.value=" ";var wt=O.scrollHeight-ne;k!==null&&(me=wt*k,Ce==="border-box"&&(me=me+ne+pe),Me=Math.max(me,Me)),C!==null&&(Ne=wt*C,Ce==="border-box"&&(Ne=Ne+ne+pe),Be=Me>Ne?"":"hidden",Me=Math.min(Ne,Me))}var He={height:Me,overflowY:Be,resize:"none"};return me&&(He.minHeight=me),Ne&&(He.maxHeight=Ne),He}var $=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],M=0,Z=1,q=2,se=l.forwardRef(function(G,W){var k=G,C=k.prefixCls,V=k.defaultValue,ne=k.value,pe=k.autoSize,Ce=k.onResize,We=k.className,me=k.style,Ne=k.disabled,Be=k.onChange,Me=k.onInternalAutoSize,wt=(0,_.Z)(k,$),He=(0,c.Z)(V,{value:ne,postState:function(mt){return mt!=null?mt:""}}),lt=(0,w.Z)(He,2),Ue=lt[0],bt=lt[1],be=function(mt){bt(mt.target.value),Be==null||Be(mt)},ye=l.useRef();l.useImperativeHandle(W,function(){return{textArea:ye.current}});var le=l.useMemo(function(){return pe&&(0,h.Z)(pe)==="object"?[pe.minRows,pe.maxRows]:[]},[pe]),ke=(0,w.Z)(le,2),Fe=ke[0],Ke=ke[1],re=!!pe,fe=function(){try{if(document.activeElement===ye.current){var mt=ye.current,Et=mt.selectionStart,st=mt.selectionEnd,Rt=mt.scrollTop;ye.current.setSelectionRange(Et,st),ye.current.scrollTop=Rt}}catch(Nt){}},De=l.useState(q),Re=(0,w.Z)(De,2),Oe=Re[0],Ye=Re[1],at=l.useState(),Qe=(0,w.Z)(at,2),Xe=Qe[0],Ge=Qe[1],ct=function(){Ye(M)};(0,E.Z)(function(){re&&ct()},[ne,Fe,Ke,re]),(0,E.Z)(function(){if(Oe===M)Ye(Z);else if(Oe===Z){var je=N(ye.current,!1,Fe,Ke);Ye(q),Ge(je)}else fe()},[Oe]);var ot=l.useRef(),it=function(){T.Z.cancel(ot.current)},we=function(mt){Oe===q&&(Ce==null||Ce(mt),pe&&(it(),ot.current=(0,T.Z)(function(){ct()})))};l.useEffect(function(){return it},[]);var rt=re?Xe:null,Ze=(0,K.Z)((0,K.Z)({},me),rt);return(Oe===M||Oe===Z)&&(Ze.overflowY="hidden",Ze.overflowX="hidden"),l.createElement(d.Z,{onResize:we,disabled:!(pe||Ce)},l.createElement("textarea",(0,I.Z)({},wt,{ref:ye,style:Ze,className:v()(C,We,(0,P.Z)({},"".concat(C,"-disabled"),Ne)),disabled:Ne,value:Ue,onChange:be})))}),ue=se,J=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],z=l.forwardRef(function(G,W){var k,C=G.defaultValue,V=G.value,ne=G.onFocus,pe=G.onBlur,Ce=G.onChange,We=G.allowClear,me=G.maxLength,Ne=G.onCompositionStart,Be=G.onCompositionEnd,Me=G.suffix,wt=G.prefixCls,He=wt===void 0?"rc-textarea":wt,lt=G.showCount,Ue=G.count,bt=G.className,be=G.style,ye=G.disabled,le=G.hidden,ke=G.classNames,Fe=G.styles,Ke=G.onResize,re=G.onClear,fe=G.onPressEnter,De=G.readOnly,Re=G.autoSize,Oe=G.onKeyDown,Ye=(0,_.Z)(G,J),at=(0,c.Z)(C,{value:V,defaultValue:C}),Qe=(0,w.Z)(at,2),Xe=Qe[0],Ge=Qe[1],ct=Xe==null?"":String(Xe),ot=l.useState(!1),it=(0,w.Z)(ot,2),we=it[0],rt=it[1],Ze=l.useRef(!1),je=l.useState(null),mt=(0,w.Z)(je,2),Et=mt[0],st=mt[1],Rt=(0,l.useRef)(null),Nt=(0,l.useRef)(null),nt=function(){var pt;return(pt=Nt.current)===null||pt===void 0?void 0:pt.textArea},Dt=function(){nt().focus()};(0,l.useImperativeHandle)(W,function(){var Ve;return{resizableTextArea:Nt.current,focus:Dt,blur:function(){nt().blur()},nativeElement:((Ve=Rt.current)===null||Ve===void 0?void 0:Ve.nativeElement)||nt()}}),(0,l.useEffect)(function(){rt(function(Ve){return!ye&&Ve})},[ye]);var Se=l.useState(null),_e=(0,w.Z)(Se,2),ve=_e[0],ee=_e[1];l.useEffect(function(){if(ve){var Ve;(Ve=nt()).setSelectionRange.apply(Ve,(0,D.Z)(ve))}},[ve]);var ie=(0,y.Z)(Ue,lt),oe=(k=ie.max)!==null&&k!==void 0?k:me,he=Number(oe)>0,de=ie.strategy(ct),Je=!!oe&&de>oe,et=function(pt,Bt){var Wt=Bt;!Ze.current&&ie.exceedFormatter&&ie.max&&ie.strategy(Bt)>ie.max&&(Wt=ie.exceedFormatter(Bt,{max:ie.max}),Bt!==Wt&&ee([nt().selectionStart||0,nt().selectionEnd||0])),Ge(Wt),(0,f.rJ)(pt.currentTarget,pt,Ce,Wt)},ht=function(pt){Ze.current=!0,Ne==null||Ne(pt)},gt=function(pt){Ze.current=!1,et(pt,pt.currentTarget.value),Be==null||Be(pt)},Ot=function(pt){et(pt,pt.target.value)},qt=function(pt){pt.key==="Enter"&&fe&&fe(pt),Oe==null||Oe(pt)},Ut=function(pt){rt(!0),ne==null||ne(pt)},Lt=function(pt){rt(!1),pe==null||pe(pt)},oi=function(pt){Ge(""),Dt(),(0,f.rJ)(nt(),pt,Ce)},fi=Me,Qt;ie.show&&(ie.showFormatter?Qt=ie.showFormatter({value:ct,count:de,maxLength:oe}):Qt="".concat(de).concat(he?" / ".concat(oe):""),fi=l.createElement(l.Fragment,null,fi,l.createElement("span",{className:v()("".concat(He,"-data-count"),ke==null?void 0:ke.count),style:Fe==null?void 0:Fe.count},Qt)));var si=function(pt){var Bt;Ke==null||Ke(pt),(Bt=nt())!==null&&Bt!==void 0&&Bt.style.height&&st(!0)},tt=!Re&&!lt&&!We;return l.createElement(s.BaseInput,{ref:Rt,value:ct,allowClear:We,handleReset:oi,suffix:fi,prefixCls:He,classNames:(0,K.Z)((0,K.Z)({},ke),{},{affixWrapper:v()(ke==null?void 0:ke.affixWrapper,(0,P.Z)((0,P.Z)({},"".concat(He,"-show-count"),lt),"".concat(He,"-textarea-allow-clear"),We))}),disabled:ye,focused:we,className:v()(bt,Je&&"".concat(He,"-out-of-range")),style:(0,K.Z)((0,K.Z)({},be),Et&&!tt?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof Qt=="string"?Qt:void 0}},hidden:le,readOnly:De,onClear:re},l.createElement(ue,(0,I.Z)({},Ye,{autoSize:Re,maxLength:me,onKeyDown:qt,onChange:Ot,onFocus:Ut,onBlur:Lt,onCompositionStart:ht,onCompositionEnd:gt,className:v()(ke==null?void 0:ke.textarea),style:(0,K.Z)((0,K.Z)({},Fe==null?void 0:Fe.textarea),{},{resize:be==null?void 0:be.resize}),disabled:ye,prefixCls:He,onResize:si,ref:Nt,readOnly:De})))}),X=z,B=X},29125:function(yt,ge,b){"use strict";b.d(ge,{G:function(){return D},Z:function(){return L}});var I=b(92310),P=b.n(I),K=b(59301);function D(x){var A=x.children,O=x.prefixCls,U=x.id,N=x.overlayInnerStyle,$=x.bodyClassName,M=x.className,Z=x.style;return K.createElement("div",{className:P()("".concat(O,"-content"),M),style:Z},K.createElement("div",{className:P()("".concat(O,"-inner"),$),id:U,role:"tooltip",style:N},typeof A=="function"?A():A))}var w=b(32855),_=b(27247),F=b(43079),v=b(65030),s={shiftX:64,adjustY:1},y={adjustX:1,shiftY:!0},f=[0,0],c={left:{points:["cr","cl"],overflow:y,offset:[-4,0],targetOffset:f},right:{points:["cl","cr"],overflow:y,offset:[4,0],targetOffset:f},top:{points:["bc","tc"],overflow:s,offset:[0,-4],targetOffset:f},bottom:{points:["tc","bc"],overflow:s,offset:[0,4],targetOffset:f},topLeft:{points:["bl","tl"],overflow:s,offset:[0,-4],targetOffset:f},leftTop:{points:["tr","tl"],overflow:y,offset:[-4,0],targetOffset:f},topRight:{points:["br","tr"],overflow:s,offset:[0,-4],targetOffset:f},rightTop:{points:["tl","tr"],overflow:y,offset:[4,0],targetOffset:f},bottomRight:{points:["tr","br"],overflow:s,offset:[0,4],targetOffset:f},rightBottom:{points:["bl","br"],overflow:y,offset:[4,0],targetOffset:f},bottomLeft:{points:["tl","bl"],overflow:s,offset:[0,4],targetOffset:f},leftBottom:{points:["br","bl"],overflow:y,offset:[-4,0],targetOffset:f}},l=null,h=b(80402),d=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],E=function(A,O){var U=A.overlayClassName,N=A.trigger,$=N===void 0?["hover"]:N,M=A.mouseEnterDelay,Z=M===void 0?0:M,q=A.mouseLeaveDelay,se=q===void 0?.1:q,ue=A.overlayStyle,J=A.prefixCls,z=J===void 0?"rc-tooltip":J,X=A.children,B=A.onVisibleChange,G=A.afterVisibleChange,W=A.transitionName,k=A.animation,C=A.motion,V=A.placement,ne=V===void 0?"right":V,pe=A.align,Ce=pe===void 0?{}:pe,We=A.destroyTooltipOnHide,me=We===void 0?!1:We,Ne=A.defaultVisible,Be=A.getTooltipContainer,Me=A.overlayInnerStyle,wt=A.arrowContent,He=A.overlay,lt=A.id,Ue=A.showArrow,bt=Ue===void 0?!0:Ue,be=A.classNames,ye=A.styles,le=(0,F.Z)(A,d),ke=(0,h.Z)(lt),Fe=(0,K.useRef)(null);(0,K.useImperativeHandle)(O,function(){return Fe.current});var Ke=(0,_.Z)({},le);"visible"in A&&(Ke.popupVisible=A.visible);var re=function(){return K.createElement(D,{key:"content",prefixCls:z,id:ke,bodyClassName:be==null?void 0:be.body,overlayInnerStyle:(0,_.Z)((0,_.Z)({},Me),ye==null?void 0:ye.body)},He)},fe=function(){var Re=K.Children.only(X),Oe=(Re==null?void 0:Re.props)||{},Ye=(0,_.Z)((0,_.Z)({},Oe),{},{"aria-describedby":He?ke:null});return K.cloneElement(X,Ye)};return K.createElement(v.Z,(0,w.Z)({popupClassName:P()(U,be==null?void 0:be.root),prefixCls:z,popup:re,action:$,builtinPlacements:c,popupPlacement:ne,ref:Fe,popupAlign:Ce,getPopupContainer:Be,onPopupVisibleChange:B,afterPopupVisibleChange:G,popupTransitionName:W,popupAnimation:k,popupMotion:C,defaultPopupVisible:Ne,autoDestroy:me,mouseLeaveDelay:se,popupStyle:(0,_.Z)((0,_.Z)({},ue),ye==null?void 0:ye.root),mouseEnterDelay:Z,arrow:bt},Ke),fe())},T=(0,K.forwardRef)(E),L=T},49658:function(yt,ge){"use strict";ge.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var b=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(b)||/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(b==null?void 0:b.substr(0,4))}},83145:function(yt,ge,b){"use strict";Object.defineProperty(ge,"__esModule",{value:!0}),ge.CopyToClipboard=void 0;var I=K(b(59301)),P=K(b(25769));function K(x){return x&&x.__esModule?x:{default:x}}function D(x){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?D=function(O){return typeof O}:D=function(O){return O&&typeof Symbol=="function"&&O.constructor===Symbol&&O!==Symbol.prototype?"symbol":typeof O},D(x)}function w(x,A){var O=Object.keys(x);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(x);A&&(U=U.filter(function(N){return Object.getOwnPropertyDescriptor(x,N).enumerable})),O.push.apply(O,U)}return O}function _(x){for(var A=1;A<arguments.length;A++){var O=arguments[A]!=null?arguments[A]:{};A%2?w(O,!0).forEach(function(U){T(x,U,O[U])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(O)):w(O).forEach(function(U){Object.defineProperty(x,U,Object.getOwnPropertyDescriptor(O,U))})}return x}function F(x,A){if(x==null)return{};var O=v(x,A),U,N;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(x);for(N=0;N<$.length;N++)U=$[N],!(A.indexOf(U)>=0)&&Object.prototype.propertyIsEnumerable.call(x,U)&&(O[U]=x[U])}return O}function v(x,A){if(x==null)return{};var O={},U=Object.keys(x),N,$;for($=0;$<U.length;$++)N=U[$],!(A.indexOf(N)>=0)&&(O[N]=x[N]);return O}function s(x,A){if(!(x instanceof A))throw new TypeError("Cannot call a class as a function")}function y(x,A){for(var O=0;O<A.length;O++){var U=A[O];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(x,U.key,U)}}function f(x,A,O){return A&&y(x.prototype,A),O&&y(x,O),x}function c(x,A){return A&&(D(A)==="object"||typeof A=="function")?A:h(x)}function l(x){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(O){return O.__proto__||Object.getPrototypeOf(O)},l(x)}function h(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function d(x,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(A&&A.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),A&&E(x,A)}function E(x,A){return E=Object.setPrototypeOf||function(U,N){return U.__proto__=N,U},E(x,A)}function T(x,A,O){return A in x?Object.defineProperty(x,A,{value:O,enumerable:!0,configurable:!0,writable:!0}):x[A]=O,x}var L=function(x){d(A,x);function A(){var O,U;s(this,A);for(var N=arguments.length,$=new Array(N),M=0;M<N;M++)$[M]=arguments[M];return U=c(this,(O=l(A)).call.apply(O,[this].concat($))),T(h(U),"onClick",function(Z){var q=U.props,se=q.text,ue=q.onCopy,J=q.children,z=q.options,X=I.default.Children.only(J),B=(0,P.default)(se,z);ue&&ue(se,B),X&&X.props&&typeof X.props.onClick=="function"&&X.props.onClick(Z)}),U}return f(A,[{key:"render",value:function(){var U=this.props,N=U.text,$=U.onCopy,M=U.options,Z=U.children,q=F(U,["text","onCopy","options","children"]),se=I.default.Children.only(Z);return I.default.cloneElement(se,_({},q,{onClick:this.onClick}))}}]),A}(I.default.PureComponent);ge.CopyToClipboard=L,T(L,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(yt,ge,b){"use strict";var I=b(83145),P=I.CopyToClipboard;P.CopyToClipboard=P,yt.exports=P},76374:function(yt,ge,b){"use strict";var I=function(){if(typeof Map!="undefined")return Map;function J(z,X){var B=-1;return z.some(function(G,W){return G[0]===X?(B=W,!0):!1}),B}return function(){function z(){this.__entries__=[]}return Object.defineProperty(z.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),z.prototype.get=function(X){var B=J(this.__entries__,X),G=this.__entries__[B];return G&&G[1]},z.prototype.set=function(X,B){var G=J(this.__entries__,X);~G?this.__entries__[G][1]=B:this.__entries__.push([X,B])},z.prototype.delete=function(X){var B=this.__entries__,G=J(B,X);~G&&B.splice(G,1)},z.prototype.has=function(X){return!!~J(this.__entries__,X)},z.prototype.clear=function(){this.__entries__.splice(0)},z.prototype.forEach=function(X,B){B===void 0&&(B=null);for(var G=0,W=this.__entries__;G<W.length;G++){var k=W[G];X.call(B,k[1],k[0])}},z}()}(),P=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,K=function(){return typeof b.g!="undefined"&&b.g.Math===Math?b.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),D=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(K):function(J){return setTimeout(function(){return J(Date.now())},1e3/60)}}(),w=2;function _(J,z){var X=!1,B=!1,G=0;function W(){X&&(X=!1,J()),B&&C()}function k(){D(W)}function C(){var V=Date.now();if(X){if(V-G<w)return;B=!0}else X=!0,B=!1,setTimeout(k,z);G=V}return C}var F=20,v=["top","right","bottom","left","width","height","size","weight"],s=typeof MutationObserver!="undefined",y=function(){function J(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=_(this.refresh.bind(this),F)}return J.prototype.addObserver=function(z){~this.observers_.indexOf(z)||this.observers_.push(z),this.connected_||this.connect_()},J.prototype.removeObserver=function(z){var X=this.observers_,B=X.indexOf(z);~B&&X.splice(B,1),!X.length&&this.connected_&&this.disconnect_()},J.prototype.refresh=function(){var z=this.updateObservers_();z&&this.refresh()},J.prototype.updateObservers_=function(){var z=this.observers_.filter(function(X){return X.gatherActive(),X.hasActive()});return z.forEach(function(X){return X.broadcastActive()}),z.length>0},J.prototype.connect_=function(){!P||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),s?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},J.prototype.disconnect_=function(){!P||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},J.prototype.onTransitionEnd_=function(z){var X=z.propertyName,B=X===void 0?"":X,G=v.some(function(W){return!!~B.indexOf(W)});G&&this.refresh()},J.getInstance=function(){return this.instance_||(this.instance_=new J),this.instance_},J.instance_=null,J}(),f=function(J,z){for(var X=0,B=Object.keys(z);X<B.length;X++){var G=B[X];Object.defineProperty(J,G,{value:z[G],enumerable:!1,writable:!1,configurable:!0})}return J},c=function(J){var z=J&&J.ownerDocument&&J.ownerDocument.defaultView;return z||K},l=N(0,0,0,0);function h(J){return parseFloat(J)||0}function d(J){for(var z=[],X=1;X<arguments.length;X++)z[X-1]=arguments[X];return z.reduce(function(B,G){var W=J["border-"+G+"-width"];return B+h(W)},0)}function E(J){for(var z=["top","right","bottom","left"],X={},B=0,G=z;B<G.length;B++){var W=G[B],k=J["padding-"+W];X[W]=h(k)}return X}function T(J){var z=J.getBBox();return N(0,0,z.width,z.height)}function L(J){var z=J.clientWidth,X=J.clientHeight;if(!z&&!X)return l;var B=c(J).getComputedStyle(J),G=E(B),W=G.left+G.right,k=G.top+G.bottom,C=h(B.width),V=h(B.height);if(B.boxSizing==="border-box"&&(Math.round(C+W)!==z&&(C-=d(B,"left","right")+W),Math.round(V+k)!==X&&(V-=d(B,"top","bottom")+k)),!A(J)){var ne=Math.round(C+W)-z,pe=Math.round(V+k)-X;Math.abs(ne)!==1&&(C-=ne),Math.abs(pe)!==1&&(V-=pe)}return N(G.left,G.top,C,V)}var x=function(){return typeof SVGGraphicsElement!="undefined"?function(J){return J instanceof c(J).SVGGraphicsElement}:function(J){return J instanceof c(J).SVGElement&&typeof J.getBBox=="function"}}();function A(J){return J===c(J).document.documentElement}function O(J){return P?x(J)?T(J):L(J):l}function U(J){var z=J.x,X=J.y,B=J.width,G=J.height,W=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,k=Object.create(W.prototype);return f(k,{x:z,y:X,width:B,height:G,top:X,right:z+B,bottom:G+X,left:z}),k}function N(J,z,X,B){return{x:J,y:z,width:X,height:B}}var $=function(){function J(z){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=N(0,0,0,0),this.target=z}return J.prototype.isActive=function(){var z=O(this.target);return this.contentRect_=z,z.width!==this.broadcastWidth||z.height!==this.broadcastHeight},J.prototype.broadcastRect=function(){var z=this.contentRect_;return this.broadcastWidth=z.width,this.broadcastHeight=z.height,z},J}(),M=function(){function J(z,X){var B=U(X);f(this,{target:z,contentRect:B})}return J}(),Z=function(){function J(z,X,B){if(this.activeObservations_=[],this.observations_=new I,typeof z!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=z,this.controller_=X,this.callbackCtx_=B}return J.prototype.observe=function(z){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(z instanceof c(z).Element))throw new TypeError('parameter 1 is not of type "Element".');var X=this.observations_;X.has(z)||(X.set(z,new $(z)),this.controller_.addObserver(this),this.controller_.refresh())}},J.prototype.unobserve=function(z){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(z instanceof c(z).Element))throw new TypeError('parameter 1 is not of type "Element".');var X=this.observations_;X.has(z)&&(X.delete(z),X.size||this.controller_.removeObserver(this))}},J.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},J.prototype.gatherActive=function(){var z=this;this.clearActive(),this.observations_.forEach(function(X){X.isActive()&&z.activeObservations_.push(X)})},J.prototype.broadcastActive=function(){if(this.hasActive()){var z=this.callbackCtx_,X=this.activeObservations_.map(function(B){return new M(B.target,B.broadcastRect())});this.callback_.call(z,X,z),this.clearActive()}},J.prototype.clearActive=function(){this.activeObservations_.splice(0)},J.prototype.hasActive=function(){return this.activeObservations_.length>0},J}(),q=typeof WeakMap!="undefined"?new WeakMap:new I,se=function(){function J(z){if(!(this instanceof J))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var X=y.getInstance(),B=new Z(z,X,this);q.set(this,B)}return J}();["observe","unobserve","disconnect"].forEach(function(J){se.prototype[J]=function(){var z;return(z=q.get(this))[J].apply(z,arguments)}});var ue=function(){return typeof K.ResizeObserver!="undefined"?K.ResizeObserver:se}();ge.Z=ue},98040:function(yt){yt.exports=function(){var ge=document.getSelection();if(!ge.rangeCount)return function(){};for(var b=document.activeElement,I=[],P=0;P<ge.rangeCount;P++)I.push(ge.getRangeAt(P));switch(b.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":b.blur();break;default:b=null;break}return ge.removeAllRanges(),function(){ge.type==="Caret"&&ge.removeAllRanges(),ge.rangeCount||I.forEach(function(K){ge.addRange(K)}),b&&b.focus()}}},34376:function(yt){(function(ge,b){if(1)yt.exports=b();else var I,P})(window,function(){return function(ge){var b={};function I(P){if(b[P])return b[P].exports;var K=b[P]={i:P,l:!1,exports:{}};return ge[P].call(K.exports,K,K.exports,I),K.l=!0,K.exports}return I.m=ge,I.c=b,I.d=function(P,K,D){I.o(P,K)||Object.defineProperty(P,K,{enumerable:!0,get:D})},I.r=function(P){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(P,"__esModule",{value:!0})},I.t=function(P,K){if(1&K&&(P=I(P)),8&K||4&K&&typeof P=="object"&&P&&P.__esModule)return P;var D=Object.create(null);if(I.r(D),Object.defineProperty(D,"default",{enumerable:!0,value:P}),2&K&&typeof P!="string")for(var w in P)I.d(D,w,function(_){return P[_]}.bind(null,w));return D},I.n=function(P){var K=P&&P.__esModule?function(){return P.default}:function(){return P};return I.d(K,"a",K),K},I.o=function(P,K){return Object.prototype.hasOwnProperty.call(P,K)},I.p="",I(I.s=34)}([function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.forwardEvent=b.EventEmitter=void 0;var P=function(){function K(){this._listeners=[],this._disposed=!1}return Object.defineProperty(K.prototype,"event",{get:function(){var D=this;return this._event||(this._event=function(w){return D._listeners.push(w),{dispose:function(){if(!D._disposed){for(var _=0;_<D._listeners.length;_++)if(D._listeners[_]===w)return void D._listeners.splice(_,1)}}}}),this._event},enumerable:!1,configurable:!0}),K.prototype.fire=function(D,w){for(var _=[],F=0;F<this._listeners.length;F++)_.push(this._listeners[F]);for(F=0;F<_.length;F++)_[F].call(void 0,D,w)},K.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},K}();b.EventEmitter=P,b.forwardEvent=function(K,D){return K(function(w){return D.fire(w)})}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.IUnicodeService=b.IOptionsService=b.ILogService=b.IInstantiationService=b.IDirtyRowService=b.ICharsetService=b.ICoreService=b.ICoreMouseService=b.IBufferService=void 0;var P=I(14);b.IBufferService=P.createDecorator("BufferService"),b.ICoreMouseService=P.createDecorator("CoreMouseService"),b.ICoreService=P.createDecorator("CoreService"),b.ICharsetService=P.createDecorator("CharsetService"),b.IDirtyRowService=P.createDecorator("DirtyRowService"),b.IInstantiationService=P.createDecorator("InstantiationService"),b.ILogService=P.createDecorator("LogService"),b.IOptionsService=P.createDecorator("OptionsService"),b.IUnicodeService=P.createDecorator("UnicodeService")},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.getDisposeArrayDisposable=b.disposeArray=b.Disposable=void 0;var P=function(){function D(){this._disposables=[],this._isDisposed=!1}return D.prototype.dispose=function(){this._isDisposed=!0;for(var w=0,_=this._disposables;w<_.length;w++)_[w].dispose();this._disposables.length=0},D.prototype.register=function(w){return this._disposables.push(w),w},D.prototype.unregister=function(w){var _=this._disposables.indexOf(w);_!==-1&&this._disposables.splice(_,1)},D}();function K(D){for(var w=0,_=D;w<_.length;w++)_[w].dispose();D.length=0}b.Disposable=P,b.disposeArray=K,b.getDisposeArrayDisposable=function(D){return{dispose:function(){return K(D)}}}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.WHITESPACE_CELL_CODE=b.WHITESPACE_CELL_WIDTH=b.WHITESPACE_CELL_CHAR=b.NULL_CELL_CODE=b.NULL_CELL_WIDTH=b.NULL_CELL_CHAR=b.CHAR_DATA_CODE_INDEX=b.CHAR_DATA_WIDTH_INDEX=b.CHAR_DATA_CHAR_INDEX=b.CHAR_DATA_ATTR_INDEX=b.DEFAULT_ATTR=b.DEFAULT_COLOR=void 0,b.DEFAULT_COLOR=256,b.DEFAULT_ATTR=256|b.DEFAULT_COLOR<<9,b.CHAR_DATA_ATTR_INDEX=0,b.CHAR_DATA_CHAR_INDEX=1,b.CHAR_DATA_WIDTH_INDEX=2,b.CHAR_DATA_CODE_INDEX=3,b.NULL_CELL_CHAR="",b.NULL_CELL_WIDTH=1,b.NULL_CELL_CODE=0,b.WHITESPACE_CELL_CHAR=" ",b.WHITESPACE_CELL_WIDTH=1,b.WHITESPACE_CELL_CODE=32},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(v,s){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,f){y.__proto__=f}||function(y,f){for(var c in f)f.hasOwnProperty(c)&&(y[c]=f[c])})(v,s)},function(v,s){function y(){this.constructor=v}P(v,s),v.prototype=s===null?Object.create(s):(y.prototype=s.prototype,new y)});Object.defineProperty(b,"__esModule",{value:!0}),b.CellData=void 0;var D=I(8),w=I(3),_=I(6),F=function(v){function s(){var y=v!==null&&v.apply(this,arguments)||this;return y.content=0,y.fg=0,y.bg=0,y.extended=new _.ExtendedAttrs,y.combinedData="",y}return K(s,v),s.fromCharData=function(y){var f=new s;return f.setFromCharData(y),f},s.prototype.isCombined=function(){return 2097152&this.content},s.prototype.getWidth=function(){return this.content>>22},s.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?D.stringFromCodePoint(2097151&this.content):""},s.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},s.prototype.setFromCharData=function(y){this.fg=y[w.CHAR_DATA_ATTR_INDEX],this.bg=0;var f=!1;if(y[w.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(y[w.CHAR_DATA_CHAR_INDEX].length===2){var c=y[w.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){var l=y[w.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=l&&l<=57343?this.content=1024*(c-55296)+l-56320+65536|y[w.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=y[w.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[w.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=y[w.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[w.CHAR_DATA_WIDTH_INDEX]<<22)},s.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},s}(_.AttributeData);b.CellData=F},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ISoundService=b.ISelectionService=b.IRenderService=b.IMouseService=b.ICoreBrowserService=b.ICharSizeService=void 0;var P=I(14);b.ICharSizeService=P.createDecorator("CharSizeService"),b.ICoreBrowserService=P.createDecorator("CoreBrowserService"),b.IMouseService=P.createDecorator("MouseService"),b.IRenderService=P.createDecorator("RenderService"),b.ISelectionService=P.createDecorator("SelectionService"),b.ISoundService=P.createDecorator("SoundService")},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ExtendedAttrs=b.AttributeData=void 0;var P=function(){function D(){this.fg=0,this.bg=0,this.extended=new K}return D.toColorRGB=function(w){return[w>>>16&255,w>>>8&255,255&w]},D.fromColorRGB=function(w){return(255&w[0])<<16|(255&w[1])<<8|255&w[2]},D.prototype.clone=function(){var w=new D;return w.fg=this.fg,w.bg=this.bg,w.extended=this.extended.clone(),w},D.prototype.isInverse=function(){return 67108864&this.fg},D.prototype.isBold=function(){return 134217728&this.fg},D.prototype.isUnderline=function(){return 268435456&this.fg},D.prototype.isBlink=function(){return 536870912&this.fg},D.prototype.isInvisible=function(){return 1073741824&this.fg},D.prototype.isItalic=function(){return 67108864&this.bg},D.prototype.isDim=function(){return 134217728&this.bg},D.prototype.getFgColorMode=function(){return 50331648&this.fg},D.prototype.getBgColorMode=function(){return 50331648&this.bg},D.prototype.isFgRGB=function(){return(50331648&this.fg)==50331648},D.prototype.isBgRGB=function(){return(50331648&this.bg)==50331648},D.prototype.isFgPalette=function(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432},D.prototype.isBgPalette=function(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432},D.prototype.isFgDefault=function(){return(50331648&this.fg)==0},D.prototype.isBgDefault=function(){return(50331648&this.bg)==0},D.prototype.isAttributeDefault=function(){return this.fg===0&&this.bg===0},D.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},D.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},D.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},D.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},D.prototype.getUnderlineColor=function(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()},D.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},D.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()},D.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()},D.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()},D.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},D}();b.AttributeData=P;var K=function(){function D(w,_){w===void 0&&(w=0),_===void 0&&(_=-1),this.underlineStyle=w,this.underlineColor=_}return D.prototype.clone=function(){return new D(this.underlineStyle,this.underlineColor)},D.prototype.isEmpty=function(){return this.underlineStyle===0},D}();b.ExtendedAttrs=K},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.addDisposableDomListener=void 0,b.addDisposableDomListener=function(P,K,D,w){P.addEventListener(K,D,w);var _=!1;return{dispose:function(){_||(_=!0,P.removeEventListener(K,D,w))}}}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Utf8ToUtf32=b.StringToUtf32=b.utf32ToString=b.stringFromCodePoint=void 0,b.stringFromCodePoint=function(D){return D>65535?(D-=65536,String.fromCharCode(55296+(D>>10))+String.fromCharCode(D%1024+56320)):String.fromCharCode(D)},b.utf32ToString=function(D,w,_){w===void 0&&(w=0),_===void 0&&(_=D.length);for(var F="",v=w;v<_;++v){var s=D[v];s>65535?(s-=65536,F+=String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):F+=String.fromCharCode(s)}return F};var P=function(){function D(){this._interim=0}return D.prototype.clear=function(){this._interim=0},D.prototype.decode=function(w,_){var F=w.length;if(!F)return 0;var v=0,s=0;this._interim&&(56320<=(c=w.charCodeAt(s++))&&c<=57343?_[v++]=1024*(this._interim-55296)+c-56320+65536:(_[v++]=this._interim,_[v++]=c),this._interim=0);for(var y=s;y<F;++y){var f=w.charCodeAt(y);if(55296<=f&&f<=56319){if(++y>=F)return this._interim=f,v;var c;56320<=(c=w.charCodeAt(y))&&c<=57343?_[v++]=1024*(f-55296)+c-56320+65536:(_[v++]=f,_[v++]=c)}else _[v++]=f}return v},D}();b.StringToUtf32=P;var K=function(){function D(){this.interim=new Uint8Array(3)}return D.prototype.clear=function(){this.interim.fill(0)},D.prototype.decode=function(w,_){var F=w.length;if(!F)return 0;var v,s,y,f,c=0,l=0,h=0;if(this.interim[0]){var d=!1,E=this.interim[0];E&=(224&E)==192?31:(240&E)==224?15:7;for(var T=0,L=void 0;(L=63&this.interim[++T])&&T<4;)E<<=6,E|=L;for(var x=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,A=x-T;h<A;){if(h>=F)return 0;if((192&(L=w[h++]))!=128){h--,d=!0;break}this.interim[T++]=L,E<<=6,E|=63&L}d||(x===2?E<128?h--:_[c++]=E:x===3?E<2048||E>=55296&&E<=57343||(_[c++]=E):E<65536||E>1114111||(_[c++]=E)),this.interim.fill(0)}for(var O=F-4,U=h;U<F;){for(;!(!(U<O)||128&(v=w[U])||128&(s=w[U+1])||128&(y=w[U+2])||128&(f=w[U+3]));)_[c++]=v,_[c++]=s,_[c++]=y,_[c++]=f,U+=4;if((v=w[U++])<128)_[c++]=v;else if((224&v)==192){if(U>=F)return this.interim[0]=v,c;if((192&(s=w[U++]))!=128){U--;continue}if((l=(31&v)<<6|63&s)<128){U--;continue}_[c++]=l}else if((240&v)==224){if(U>=F)return this.interim[0]=v,c;if((192&(s=w[U++]))!=128){U--;continue}if(U>=F)return this.interim[0]=v,this.interim[1]=s,c;if((192&(y=w[U++]))!=128){U--;continue}if((l=(15&v)<<12|(63&s)<<6|63&y)<2048||l>=55296&&l<=57343)continue;_[c++]=l}else if((248&v)==240){if(U>=F)return this.interim[0]=v,c;if((192&(s=w[U++]))!=128){U--;continue}if(U>=F)return this.interim[0]=v,this.interim[1]=s,c;if((192&(y=w[U++]))!=128){U--;continue}if(U>=F)return this.interim[0]=v,this.interim[1]=s,this.interim[2]=y,c;if((192&(f=w[U++]))!=128){U--;continue}if((l=(7&v)<<18|(63&s)<<12|(63&y)<<6|63&f)<65536||l>1114111)continue;_[c++]=l}}return c},D}();b.Utf8ToUtf32=K},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CHAR_ATLAS_CELL_SPACING=b.DIM_OPACITY=b.INVERTED_DEFAULT_COLOR=void 0,b.INVERTED_DEFAULT_COLOR=257,b.DIM_OPACITY=.5,b.CHAR_ATLAS_CELL_SPACING=1},function(ge,b,I){"use strict";var P,K,D,w;function _(v){var s=v.toString(16);return s.length<2?"0"+s:s}function F(v,s){return v<s?(s+.05)/(v+.05):(v+.05)/(s+.05)}Object.defineProperty(b,"__esModule",{value:!0}),b.contrastRatio=b.toPaddedHex=b.rgba=b.rgb=b.css=b.color=b.channels=void 0,function(v){v.toCss=function(s,y,f,c){return c!==void 0?"#"+_(s)+_(y)+_(f)+_(c):"#"+_(s)+_(y)+_(f)},v.toRgba=function(s,y,f,c){return c===void 0&&(c=255),(s<<24|y<<16|f<<8|c)>>>0}}(P=b.channels||(b.channels={})),(K=b.color||(b.color={})).blend=function(v,s){var y=(255&s.rgba)/255;if(y===1)return{css:s.css,rgba:s.rgba};var f=s.rgba>>24&255,c=s.rgba>>16&255,l=s.rgba>>8&255,h=v.rgba>>24&255,d=v.rgba>>16&255,E=v.rgba>>8&255,T=h+Math.round((f-h)*y),L=d+Math.round((c-d)*y),x=E+Math.round((l-E)*y);return{css:P.toCss(T,L,x),rgba:P.toRgba(T,L,x)}},K.isOpaque=function(v){return(255&v.rgba)==255},K.ensureContrastRatio=function(v,s,y){var f=w.ensureContrastRatio(v.rgba,s.rgba,y);if(f)return w.toColor(f>>24&255,f>>16&255,f>>8&255)},K.opaque=function(v){var s=(255|v.rgba)>>>0,y=w.toChannels(s),f=y[0],c=y[1],l=y[2];return{css:P.toCss(f,c,l),rgba:s}},K.opacity=function(v,s){var y=Math.round(255*s),f=w.toChannels(v.rgba),c=f[0],l=f[1],h=f[2];return{css:P.toCss(c,l,h,y),rgba:P.toRgba(c,l,h,y)}},(b.css||(b.css={})).toColor=function(v){switch(v.length){case 7:return{css:v,rgba:(parseInt(v.slice(1),16)<<8|255)>>>0};case 9:return{css:v,rgba:parseInt(v.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(v){function s(y,f,c){var l=y/255,h=f/255,d=c/255;return .2126*(l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4))+.7152*(h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4))+.0722*(d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4))}v.relativeLuminance=function(y){return s(y>>16&255,y>>8&255,255&y)},v.relativeLuminance2=s}(D=b.rgb||(b.rgb={})),function(v){function s(f,c,l){for(var h=f>>24&255,d=f>>16&255,E=f>>8&255,T=c>>24&255,L=c>>16&255,x=c>>8&255,A=F(D.relativeLuminance2(T,x,L),D.relativeLuminance2(h,d,E));A<l&&(T>0||L>0||x>0);)T-=Math.max(0,Math.ceil(.1*T)),L-=Math.max(0,Math.ceil(.1*L)),x-=Math.max(0,Math.ceil(.1*x)),A=F(D.relativeLuminance2(T,x,L),D.relativeLuminance2(h,d,E));return(T<<24|L<<16|x<<8|255)>>>0}function y(f,c,l){for(var h=f>>24&255,d=f>>16&255,E=f>>8&255,T=c>>24&255,L=c>>16&255,x=c>>8&255,A=F(D.relativeLuminance2(T,x,L),D.relativeLuminance2(h,d,E));A<l&&(T<255||L<255||x<255);)T=Math.min(255,T+Math.ceil(.1*(255-T))),L=Math.min(255,L+Math.ceil(.1*(255-L))),x=Math.min(255,x+Math.ceil(.1*(255-x))),A=F(D.relativeLuminance2(T,x,L),D.relativeLuminance2(h,d,E));return(T<<24|L<<16|x<<8|255)>>>0}v.ensureContrastRatio=function(f,c,l){var h=D.relativeLuminance(f>>8),d=D.relativeLuminance(c>>8);if(F(h,d)<l)return d<h?s(f,c,l):y(f,c,l)},v.reduceLuminance=s,v.increaseLuminance=y,v.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]},v.toColor=function(f,c,l){return{css:P.toCss(f,c,l),rgba:P.toRgba(f,c,l)}}}(w=b.rgba||(b.rgba={})),b.toPaddedHex=_,b.contrastRatio=F},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.isLinux=b.isWindows=b.isIphone=b.isIpad=b.isMac=b.isSafari=b.isFirefox=void 0;var P=typeof navigator=="undefined",K=P?"node":navigator.userAgent,D=P?"node":navigator.platform;function w(_,F){return _.indexOf(F)>=0}b.isFirefox=!!~K.indexOf("Firefox"),b.isSafari=/^((?!chrome|android).)*safari/i.test(K),b.isMac=w(["Macintosh","MacIntel","MacPPC","Mac68K"],D),b.isIpad=D==="iPad",b.isIphone=D==="iPhone",b.isWindows=w(["Windows","Win16","Win32","WinCE"],D),b.isLinux=D.indexOf("Linux")>=0},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.C1=b.C0=void 0,function(P){P.NUL="\0",P.SOH="",P.STX="",P.ETX="",P.EOT="",P.ENQ="",P.ACK="",P.BEL="\x07",P.BS="\b",P.HT=" ",P.LF=`
|
|
|
`,P.VT="\v",P.FF="\f",P.CR="\r",P.SO="",P.SI="",P.DLE="",P.DC1="",P.DC2="",P.DC3="",P.DC4="",P.NAK="",P.SYN="",P.ETB="",P.CAN="",P.EM="",P.SUB="",P.ESC="\x1B",P.FS="",P.GS="",P.RS="",P.US="",P.SP=" ",P.DEL="\x7F"}(b.C0||(b.C0={})),function(P){P.PAD="\x80",P.HOP="\x81",P.BPH="\x82",P.NBH="\x83",P.IND="\x84",P.NEL="\x85",P.SSA="\x86",P.ESA="\x87",P.HTS="\x88",P.HTJ="\x89",P.VTS="\x8A",P.PLD="\x8B",P.PLU="\x8C",P.RI="\x8D",P.SS2="\x8E",P.SS3="\x8F",P.DCS="\x90",P.PU1="\x91",P.PU2="\x92",P.STS="\x93",P.CCH="\x94",P.MW="\x95",P.SPA="\x96",P.EPA="\x97",P.SOS="\x98",P.SGCI="\x99",P.SCI="\x9A",P.CSI="\x9B",P.ST="\x9C",P.OSC="\x9D",P.PM="\x9E",P.APC="\x9F"}(b.C1||(b.C1={}))},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BaseRenderLayer=void 0;var P=I(3),K=I(9),D=I(25),w=I(6),_=I(28),F=I(10),v=I(17),s=function(){function y(f,c,l,h,d,E,T,L){this._container=f,this._alpha=h,this._colors=d,this._rendererId=E,this._bufferService=T,this._optionsService=L,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+c+"-layer"),this._canvas.style.zIndex=l.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return y.prototype.dispose=function(){var f;v.removeElementFromParent(this._canvas),(f=this._charAtlas)===null||f===void 0||f.dispose()},y.prototype._initCanvas=function(){this._ctx=_.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},y.prototype.onOptionsChanged=function(){},y.prototype.onBlur=function(){},y.prototype.onFocus=function(){},y.prototype.onCursorMove=function(){},y.prototype.onGridChanged=function(f,c){},y.prototype.onSelectionChanged=function(f,c,l){l===void 0&&(l=!1)},y.prototype.setColors=function(f){this._refreshCharAtlas(f)},y.prototype._setTransparency=function(f){if(f!==this._alpha){var c=this._canvas;this._alpha=f,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,c),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},y.prototype._refreshCharAtlas=function(f){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=D.acquireCharAtlas(this._optionsService.options,this._rendererId,f,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},y.prototype.resize=function(f){this._scaledCellWidth=f.scaledCellWidth,this._scaledCellHeight=f.scaledCellHeight,this._scaledCharWidth=f.scaledCharWidth,this._scaledCharHeight=f.scaledCharHeight,this._scaledCharLeft=f.scaledCharLeft,this._scaledCharTop=f.scaledCharTop,this._canvas.width=f.scaledCanvasWidth,this._canvas.height=f.scaledCanvasHeight,this._canvas.style.width=f.canvasWidth+"px",this._canvas.style.height=f.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},y.prototype._fillCells=function(f,c,l,h){this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,h*this._scaledCellHeight)},y.prototype._fillBottomLineAtCells=function(f,c,l){l===void 0&&(l=1),this._ctx.fillRect(f*this._scaledCellWidth,(c+1)*this._scaledCellHeight-window.devicePixelRatio-1,l*this._scaledCellWidth,window.devicePixelRatio)},y.prototype._fillLeftLineAtCell=function(f,c,l){this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,window.devicePixelRatio*l,this._scaledCellHeight)},y.prototype._strokeRectAtCell=function(f,c,l,h){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(f*this._scaledCellWidth+window.devicePixelRatio/2,c*this._scaledCellHeight+window.devicePixelRatio/2,l*this._scaledCellWidth-window.devicePixelRatio,h*this._scaledCellHeight-window.devicePixelRatio)},y.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},y.prototype._clearCells=function(f,c,l,h){this._alpha?this._ctx.clearRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,h*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,h*this._scaledCellHeight))},y.prototype._fillCharTrueColor=function(f,c,l){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(l),this._ctx.fillText(f.getChars(),c*this._scaledCellWidth+this._scaledCharLeft,l*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},y.prototype._drawChars=function(f,c,l){var h,d,E=this._getContrastColor(f);E||f.isFgRGB()||f.isBgRGB()?this._drawUncachedChars(f,c,l,E):(f.isInverse()?(h=f.isBgDefault()?K.INVERTED_DEFAULT_COLOR:f.getBgColor(),d=f.isFgDefault()?K.INVERTED_DEFAULT_COLOR:f.getFgColor()):(d=f.isBgDefault()?P.DEFAULT_COLOR:f.getBgColor(),h=f.isFgDefault()?P.DEFAULT_COLOR:f.getFgColor()),h+=this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&h<8?8:0,this._currentGlyphIdentifier.chars=f.getChars()||P.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=f.getCode()||P.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=d,this._currentGlyphIdentifier.fg=h,this._currentGlyphIdentifier.bold=!!f.isBold(),this._currentGlyphIdentifier.dim=!!f.isDim(),this._currentGlyphIdentifier.italic=!!f.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,c*this._scaledCellWidth+this._scaledCharLeft,l*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(f,c,l))},y.prototype._drawUncachedChars=function(f,c,l,h){if(this._ctx.save(),this._ctx.font=this._getFont(!!f.isBold(),!!f.isItalic()),this._ctx.textBaseline="middle",f.isInverse())if(h)this._ctx.fillStyle=h.css;else if(f.isBgDefault())this._ctx.fillStyle=F.color.opaque(this._colors.background).css;else if(f.isBgRGB())this._ctx.fillStyle="rgb("+w.AttributeData.toColorRGB(f.getBgColor()).join(",")+")";else{var d=f.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&d<8&&(d+=8),this._ctx.fillStyle=this._colors.ansi[d].css}else if(h)this._ctx.fillStyle=h.css;else if(f.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(f.isFgRGB())this._ctx.fillStyle="rgb("+w.AttributeData.toColorRGB(f.getFgColor()).join(",")+")";else{var E=f.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&E<8&&(E+=8),this._ctx.fillStyle=this._colors.ansi[E].css}this._clipRow(l),f.isDim()&&(this._ctx.globalAlpha=K.DIM_OPACITY),this._ctx.fillText(f.getChars(),c*this._scaledCellWidth+this._scaledCharLeft,l*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},y.prototype._clipRow=function(f){this._ctx.beginPath(),this._ctx.rect(0,f*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},y.prototype._getFont=function(f,c){return(c?"italic":"")+" "+(f?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},y.prototype._getContrastColor=function(f){if(this._optionsService.options.minimumContrastRatio!==1){var c=this._colors.contrastCache.getColor(f.bg,f.fg);if(c!==void 0)return c||void 0;var l=f.getFgColor(),h=f.getFgColorMode(),d=f.getBgColor(),E=f.getBgColorMode(),T=!!f.isInverse(),L=!!f.isInverse();if(T){var x=l;l=d,d=x;var A=h;h=E,E=A}var O=this._resolveBackgroundRgba(E,d,T),U=this._resolveForegroundRgba(h,l,T,L),N=F.rgba.ensureContrastRatio(O,U,this._optionsService.options.minimumContrastRatio);if(N){var $={css:F.channels.toCss(N>>24&255,N>>16&255,N>>8&255),rgba:N};return this._colors.contrastCache.setColor(f.bg,f.fg,$),$}this._colors.contrastCache.setColor(f.bg,f.fg,null)}},y.prototype._resolveBackgroundRgba=function(f,c,l){switch(f){case 16777216:case 33554432:return this._colors.ansi[c].rgba;case 50331648:return c<<8;case 0:default:return l?this._colors.foreground.rgba:this._colors.background.rgba}},y.prototype._resolveForegroundRgba=function(f,c,l,h){switch(f){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&h&&c<8&&(c+=8),this._colors.ansi[c].rgba;case 50331648:return c<<8;case 0:default:return l?this._colors.background.rgba:this._colors.foreground.rgba}},y}();b.BaseRenderLayer=s},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.createDecorator=b.getServiceDependencies=b.serviceRegistry=void 0;function P(K,D,w){D.di$target===D?D.di$dependencies.push({id:K,index:w}):(D.di$dependencies=[{id:K,index:w}],D.di$target=D)}b.serviceRegistry=new Map,b.getServiceDependencies=function(K){return K.di$dependencies||[]},b.createDecorator=function(K){if(b.serviceRegistry.has(K))return b.serviceRegistry.get(K);var D=function(w,_,F){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");P(D,w,F)};return D.toString=function(){return K},b.serviceRegistry.set(K,D),D}},function(ge,b,I){"use strict";function P(K,D,w,_){if(w===void 0&&(w=0),_===void 0&&(_=K.length),w>=K.length)return K;w=(K.length+w)%K.length,_=_>=K.length?K.length:(K.length+_)%K.length;for(var F=w;F<_;++F)K[F]=D;return K}Object.defineProperty(b,"__esModule",{value:!0}),b.concat=b.fillFallback=b.fill=void 0,b.fill=function(K,D,w,_){return K.fill?K.fill(D,w,_):P(K,D,w,_)},b.fillFallback=P,b.concat=function(K,D){var w=new K.constructor(K.length+D.length);return w.set(K),w.set(D,K.length),w}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BufferLine=b.DEFAULT_ATTR_DATA=void 0;var P=I(8),K=I(3),D=I(4),w=I(6);b.DEFAULT_ATTR_DATA=Object.freeze(new w.AttributeData);var _=function(){function F(v,s,y){y===void 0&&(y=!1),this.isWrapped=y,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);for(var f=s||D.CellData.fromCharData([0,K.NULL_CELL_CHAR,K.NULL_CELL_WIDTH,K.NULL_CELL_CODE]),c=0;c<v;++c)this.setCell(c,f);this.length=v}return F.prototype.get=function(v){var s=this._data[3*v+0],y=2097151&s;return[this._data[3*v+1],2097152&s?this._combined[v]:y?P.stringFromCodePoint(y):"",s>>22,2097152&s?this._combined[v].charCodeAt(this._combined[v].length-1):y]},F.prototype.set=function(v,s){this._data[3*v+1]=s[K.CHAR_DATA_ATTR_INDEX],s[K.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=s[1],this._data[3*v+0]=2097152|v|s[K.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=s[K.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[K.CHAR_DATA_WIDTH_INDEX]<<22},F.prototype.getWidth=function(v){return this._data[3*v+0]>>22},F.prototype.hasWidth=function(v){return 12582912&this._data[3*v+0]},F.prototype.getFg=function(v){return this._data[3*v+1]},F.prototype.getBg=function(v){return this._data[3*v+2]},F.prototype.hasContent=function(v){return 4194303&this._data[3*v+0]},F.prototype.getCodePoint=function(v){var s=this._data[3*v+0];return 2097152&s?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&s},F.prototype.isCombined=function(v){return 2097152&this._data[3*v+0]},F.prototype.getString=function(v){var s=this._data[3*v+0];return 2097152&s?this._combined[v]:2097151&s?P.stringFromCodePoint(2097151&s):""},F.prototype.loadCell=function(v,s){var y=3*v;return s.content=this._data[y+0],s.fg=this._data[y+1],s.bg=this._data[y+2],2097152&s.content&&(s.combinedData=this._combined[v]),268435456&s.bg&&(s.extended=this._extendedAttrs[v]),s},F.prototype.setCell=function(v,s){2097152&s.content&&(this._combined[v]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[v]=s.extended),this._data[3*v+0]=s.content,this._data[3*v+1]=s.fg,this._data[3*v+2]=s.bg},F.prototype.setCellFromCodePoint=function(v,s,y,f,c,l){268435456&c&&(this._extendedAttrs[v]=l),this._data[3*v+0]=s|y<<22,this._data[3*v+1]=f,this._data[3*v+2]=c},F.prototype.addCodepointToCell=function(v,s){var y=this._data[3*v+0];2097152&y?this._combined[v]+=P.stringFromCodePoint(s):(2097151&y?(this._combined[v]=P.stringFromCodePoint(2097151&y)+P.stringFromCodePoint(s),y&=-2097152,y|=2097152):y=s|1<<22,this._data[3*v+0]=y)},F.prototype.insertCells=function(v,s,y,f){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodePoint(v-1,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs),s<this.length-v){for(var c=new D.CellData,l=this.length-v-s-1;l>=0;--l)this.setCell(v+s+l,this.loadCell(v+l,c));for(l=0;l<s;++l)this.setCell(v+l,y)}else for(l=v;l<this.length;++l)this.setCell(l,y);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs)},F.prototype.deleteCells=function(v,s,y,f){if(v%=this.length,s<this.length-v){for(var c=new D.CellData,l=0;l<this.length-v-s;++l)this.setCell(v+l,this.loadCell(v+s+l,c));for(l=this.length-s;l<this.length;++l)this.setCell(l,y)}else for(l=v;l<this.length;++l)this.setCell(l,y);v&&this.getWidth(v-1)===2&&this.setCellFromCodePoint(v-1,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodePoint(v,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs)},F.prototype.replaceCells=function(v,s,y,f){for(v&&this.getWidth(v-1)===2&&this.setCellFromCodePoint(v-1,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodePoint(s,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs);v<s&&v<this.length;)this.setCell(v++,y)},F.prototype.resize=function(v,s){if(v!==this.length){if(v>this.length){var y=new Uint32Array(3*v);this.length&&(3*v<this._data.length?y.set(this._data.subarray(0,3*v)):y.set(this._data)),this._data=y;for(var f=this.length;f<v;++f)this.setCell(f,s)}else if(v){(y=new Uint32Array(3*v)).set(this._data.subarray(0,3*v)),this._data=y;var c=Object.keys(this._combined);for(f=0;f<c.length;f++){var l=parseInt(c[f],10);l>=v&&delete this._combined[l]}}else this._data=new Uint32Array(0),this._combined={};this.length=v}},F.prototype.fill=function(v){this._combined={},this._extendedAttrs={};for(var s=0;s<this.length;++s)this.setCell(s,v)},F.prototype.copyFrom=function(v){for(var s in this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={},v._combined)this._combined[s]=v._combined[s];for(var s in this._extendedAttrs={},v._extendedAttrs)this._extendedAttrs[s]=v._extendedAttrs[s];this.isWrapped=v.isWrapped},F.prototype.clone=function(){var v=new F(0);for(var s in v._data=new Uint32Array(this._data),v.length=this.length,this._combined)v._combined[s]=this._combined[s];for(var s in this._extendedAttrs)v._extendedAttrs[s]=this._extendedAttrs[s];return v.isWrapped=this.isWrapped,v},F.prototype.getTrimmedLength=function(){for(var v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0},F.prototype.copyCellsFrom=function(v,s,y,f,c){var l=v._data;if(c)for(var h=f-1;h>=0;h--)for(var d=0;d<3;d++)this._data[3*(y+h)+d]=l[3*(s+h)+d];else for(h=0;h<f;h++)for(d=0;d<3;d++)this._data[3*(y+h)+d]=l[3*(s+h)+d];var E=Object.keys(v._combined);for(d=0;d<E.length;d++){var T=parseInt(E[d],10);T>=s&&(this._combined[T-s+y]=v._combined[T])}},F.prototype.translateToString=function(v,s,y){v===void 0&&(v=!1),s===void 0&&(s=0),y===void 0&&(y=this.length),v&&(y=Math.min(y,this.getTrimmedLength()));for(var f="";s<y;){var c=this._data[3*s+0],l=2097151&c;f+=2097152&c?this._combined[s]:l?P.stringFromCodePoint(l):K.WHITESPACE_CELL_CHAR,s+=c>>22||1}return f},F}();b.BufferLine=_},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.removeElementFromParent=void 0,b.removeElementFromParent=function(){for(var P,K=[],D=0;D<arguments.length;D++)K[D]=arguments[D];for(var w=0,_=K;w<_.length;w++){var F=_[w];(P=F==null?void 0:F.parentElement)===null||P===void 0||P.removeChild(F)}}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.tooMuchOutput=b.promptLabel=void 0,b.promptLabel="Terminal input",b.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(U,N){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function($,M){$.__proto__=M}||function($,M){for(var Z in M)M.hasOwnProperty(Z)&&($[Z]=M[Z])})(U,N)},function(U,N){function $(){this.constructor=U}P(U,N),U.prototype=N===null?Object.create(N):($.prototype=N.prototype,new $)});Object.defineProperty(b,"__esModule",{value:!0}),b.InputHandler=b.WindowsOptionsReportType=void 0;var D,w=I(12),_=I(20),F=I(39),v=I(2),s=I(15),y=I(8),f=I(16),c=I(0),l=I(3),h=I(4),d=I(6),E=I(22),T=I(24),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function x(U,N){if(U>24)return N.setWinLines||!1;switch(U){case 1:return!!N.restoreWin;case 2:return!!N.minimizeWin;case 3:return!!N.setWinPosition;case 4:return!!N.setWinSizePixels;case 5:return!!N.raiseWin;case 6:return!!N.lowerWin;case 7:return!!N.refreshWin;case 8:return!!N.setWinSizeChars;case 9:return!!N.maximizeWin;case 10:return!!N.fullscreenWin;case 11:return!!N.getWinState;case 13:return!!N.getWinPosition;case 14:return!!N.getWinSizePixels;case 15:return!!N.getScreenSizePixels;case 16:return!!N.getCellSizePixels;case 18:return!!N.getWinSizeChars;case 19:return!!N.getScreenSizeChars;case 20:return!!N.getIconTitle;case 21:return!!N.getWinTitle;case 22:return!!N.pushTitle;case 23:return!!N.popTitle;case 24:return!!N.setWinLines}return!1}(function(U){U[U.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",U[U.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D=b.WindowsOptionsReportType||(b.WindowsOptionsReportType={}));var A=function(){function U(N,$,M,Z){this._bufferService=N,this._coreService=$,this._logService=M,this._optionsService=Z,this._data=new Uint32Array(0)}return U.prototype.hook=function(N){this._data=new Uint32Array(0)},U.prototype.put=function(N,$,M){this._data=s.concat(this._data,N.subarray($,M))},U.prototype.unhook=function(N){if(N){var $=y.utf32ToString(this._data);switch(this._data=new Uint32Array(0),$){case'"q':return this._coreService.triggerDataEvent(w.C0.ESC+'P1$r0"q'+w.C0.ESC+"\\");case'"p':return this._coreService.triggerDataEvent(w.C0.ESC+'P1$r61;1"p'+w.C0.ESC+"\\");case"r":var M=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(w.C0.ESC+"P1$r"+M+w.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(w.C0.ESC+"P1$r0m"+w.C0.ESC+"\\");case" q":var Z={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return Z-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(w.C0.ESC+"P1$r"+Z+" q"+w.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",$),this._coreService.triggerDataEvent(w.C0.ESC+"P0$r"+w.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},U}(),O=function(U){function N($,M,Z,q,se,ue,J,z,X){X===void 0&&(X=new F.EscapeSequenceParser);var B=U.call(this)||this;B._bufferService=$,B._charsetService=M,B._coreService=Z,B._dirtyRowService=q,B._logService=se,B._optionsService=ue,B._coreMouseService=J,B._unicodeService=z,B._parser=X,B._parseBuffer=new Uint32Array(4096),B._stringDecoder=new y.StringToUtf32,B._utf8Decoder=new y.Utf8ToUtf32,B._workCell=new h.CellData,B._windowTitle="",B._iconName="",B._windowTitleStack=[],B._iconNameStack=[],B._curAttrData=f.DEFAULT_ATTR_DATA.clone(),B._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),B._onRequestBell=new c.EventEmitter,B._onRequestRefreshRows=new c.EventEmitter,B._onRequestReset=new c.EventEmitter,B._onRequestScroll=new c.EventEmitter,B._onRequestSyncScrollBar=new c.EventEmitter,B._onRequestWindowsOptionsReport=new c.EventEmitter,B._onA11yChar=new c.EventEmitter,B._onA11yTab=new c.EventEmitter,B._onCursorMove=new c.EventEmitter,B._onLineFeed=new c.EventEmitter,B._onScroll=new c.EventEmitter,B._onTitleChange=new c.EventEmitter,B.register(B._parser),B._parser.setCsiHandlerFallback(function(C,V){B._logService.debug("Unknown CSI code: ",{identifier:B._parser.identToString(C),params:V.toArray()})}),B._parser.setEscHandlerFallback(function(C){B._logService.debug("Unknown ESC code: ",{identifier:B._parser.identToString(C)})}),B._parser.setExecuteHandlerFallback(function(C){B._logService.debug("Unknown EXECUTE code: ",{code:C})}),B._parser.setOscHandlerFallback(function(C,V,ne){B._logService.debug("Unknown OSC code: ",{identifier:C,action:V,data:ne})}),B._parser.setDcsHandlerFallback(function(C,V,ne){V==="HOOK"&&(ne=ne.toArray()),B._logService.debug("Unknown DCS code: ",{identifier:B._parser.identToString(C),action:V,payload:ne})}),B._parser.setPrintHandler(function(C,V,ne){return B.print(C,V,ne)}),B._parser.setCsiHandler({final:"@"},function(C){return B.insertChars(C)}),B._parser.setCsiHandler({intermediates:" ",final:"@"},function(C){return B.scrollLeft(C)}),B._parser.setCsiHandler({final:"A"},function(C){return B.cursorUp(C)}),B._parser.setCsiHandler({intermediates:" ",final:"A"},function(C){return B.scrollRight(C)}),B._parser.setCsiHandler({final:"B"},function(C){return B.cursorDown(C)}),B._parser.setCsiHandler({final:"C"},function(C){return B.cursorForward(C)}),B._parser.setCsiHandler({final:"D"},function(C){return B.cursorBackward(C)}),B._parser.setCsiHandler({final:"E"},function(C){return B.cursorNextLine(C)}),B._parser.setCsiHandler({final:"F"},function(C){return B.cursorPrecedingLine(C)}),B._parser.setCsiHandler({final:"G"},function(C){return B.cursorCharAbsolute(C)}),B._parser.setCsiHandler({final:"H"},function(C){return B.cursorPosition(C)}),B._parser.setCsiHandler({final:"I"},function(C){return B.cursorForwardTab(C)}),B._parser.setCsiHandler({final:"J"},function(C){return B.eraseInDisplay(C)}),B._parser.setCsiHandler({prefix:"?",final:"J"},function(C){return B.eraseInDisplay(C)}),B._parser.setCsiHandler({final:"K"},function(C){return B.eraseInLine(C)}),B._parser.setCsiHandler({prefix:"?",final:"K"},function(C){return B.eraseInLine(C)}),B._parser.setCsiHandler({final:"L"},function(C){return B.insertLines(C)}),B._parser.setCsiHandler({final:"M"},function(C){return B.deleteLines(C)}),B._parser.setCsiHandler({final:"P"},function(C){return B.deleteChars(C)}),B._parser.setCsiHandler({final:"S"},function(C){return B.scrollUp(C)}),B._parser.setCsiHandler({final:"T"},function(C){return B.scrollDown(C)}),B._parser.setCsiHandler({final:"X"},function(C){return B.eraseChars(C)}),B._parser.setCsiHandler({final:"Z"},function(C){return B.cursorBackwardTab(C)}),B._parser.setCsiHandler({final:"`"},function(C){return B.charPosAbsolute(C)}),B._parser.setCsiHandler({final:"a"},function(C){return B.hPositionRelative(C)}),B._parser.setCsiHandler({final:"b"},function(C){return B.repeatPrecedingCharacter(C)}),B._parser.setCsiHandler({final:"c"},function(C){return B.sendDeviceAttributesPrimary(C)}),B._parser.setCsiHandler({prefix:">",final:"c"},function(C){return B.sendDeviceAttributesSecondary(C)}),B._parser.setCsiHandler({final:"d"},function(C){return B.linePosAbsolute(C)}),B._parser.setCsiHandler({final:"e"},function(C){return B.vPositionRelative(C)}),B._parser.setCsiHandler({final:"f"},function(C){return B.hVPosition(C)}),B._parser.setCsiHandler({final:"g"},function(C){return B.tabClear(C)}),B._parser.setCsiHandler({final:"h"},function(C){return B.setMode(C)}),B._parser.setCsiHandler({prefix:"?",final:"h"},function(C){return B.setModePrivate(C)}),B._parser.setCsiHandler({final:"l"},function(C){return B.resetMode(C)}),B._parser.setCsiHandler({prefix:"?",final:"l"},function(C){return B.resetModePrivate(C)}),B._parser.setCsiHandler({final:"m"},function(C){return B.charAttributes(C)}),B._parser.setCsiHandler({final:"n"},function(C){return B.deviceStatus(C)}),B._parser.setCsiHandler({prefix:"?",final:"n"},function(C){return B.deviceStatusPrivate(C)}),B._parser.setCsiHandler({intermediates:"!",final:"p"},function(C){return B.softReset(C)}),B._parser.setCsiHandler({intermediates:" ",final:"q"},function(C){return B.setCursorStyle(C)}),B._parser.setCsiHandler({final:"r"},function(C){return B.setScrollRegion(C)}),B._parser.setCsiHandler({final:"s"},function(C){return B.saveCursor(C)}),B._parser.setCsiHandler({final:"t"},function(C){return B.windowOptions(C)}),B._parser.setCsiHandler({final:"u"},function(C){return B.restoreCursor(C)}),B._parser.setCsiHandler({intermediates:"'",final:"}"},function(C){return B.insertColumns(C)}),B._parser.setCsiHandler({intermediates:"'",final:"~"},function(C){return B.deleteColumns(C)}),B._parser.setExecuteHandler(w.C0.BEL,function(){return B.bell()}),B._parser.setExecuteHandler(w.C0.LF,function(){return B.lineFeed()}),B._parser.setExecuteHandler(w.C0.VT,function(){return B.lineFeed()}),B._parser.setExecuteHandler(w.C0.FF,function(){return B.lineFeed()}),B._parser.setExecuteHandler(w.C0.CR,function(){return B.carriageReturn()}),B._parser.setExecuteHandler(w.C0.BS,function(){return B.backspace()}),B._parser.setExecuteHandler(w.C0.HT,function(){return B.tab()}),B._parser.setExecuteHandler(w.C0.SO,function(){return B.shiftOut()}),B._parser.setExecuteHandler(w.C0.SI,function(){return B.shiftIn()}),B._parser.setExecuteHandler(w.C1.IND,function(){return B.index()}),B._parser.setExecuteHandler(w.C1.NEL,function(){return B.nextLine()}),B._parser.setExecuteHandler(w.C1.HTS,function(){return B.tabSet()}),B._parser.setOscHandler(0,new E.OscHandler(function(C){B.setTitle(C),B.setIconName(C)})),B._parser.setOscHandler(1,new E.OscHandler(function(C){return B.setIconName(C)})),B._parser.setOscHandler(2,new E.OscHandler(function(C){return B.setTitle(C)})),B._parser.setEscHandler({final:"7"},function(){return B.saveCursor()}),B._parser.setEscHandler({final:"8"},function(){return B.restoreCursor()}),B._parser.setEscHandler({final:"D"},function(){return B.index()}),B._parser.setEscHandler({final:"E"},function(){return B.nextLine()}),B._parser.setEscHandler({final:"H"},function(){return B.tabSet()}),B._parser.setEscHandler({final:"M"},function(){return B.reverseIndex()}),B._parser.setEscHandler({final:"="},function(){return B.keypadApplicationMode()}),B._parser.setEscHandler({final:">"},function(){return B.keypadNumericMode()}),B._parser.setEscHandler({final:"c"},function(){return B.fullReset()}),B._parser.setEscHandler({final:"n"},function(){return B.setgLevel(2)}),B._parser.setEscHandler({final:"o"},function(){return B.setgLevel(3)}),B._parser.setEscHandler({final:"|"},function(){return B.setgLevel(3)}),B._parser.setEscHandler({final:"}"},function(){return B.setgLevel(2)}),B._parser.setEscHandler({final:"~"},function(){return B.setgLevel(1)}),B._parser.setEscHandler({intermediates:"%",final:"@"},function(){return B.selectDefaultCharset()}),B._parser.setEscHandler({intermediates:"%",final:"G"},function(){return B.selectDefaultCharset()});var G=function(C){W._parser.setEscHandler({intermediates:"(",final:C},function(){return B.selectCharset("("+C)}),W._parser.setEscHandler({intermediates:")",final:C},function(){return B.selectCharset(")"+C)}),W._parser.setEscHandler({intermediates:"*",final:C},function(){return B.selectCharset("*"+C)}),W._parser.setEscHandler({intermediates:"+",final:C},function(){return B.selectCharset("+"+C)}),W._parser.setEscHandler({intermediates:"-",final:C},function(){return B.selectCharset("-"+C)}),W._parser.setEscHandler({intermediates:".",final:C},function(){return B.selectCharset("."+C)}),W._parser.setEscHandler({intermediates:"/",final:C},function(){return B.selectCharset("/"+C)})},W=this;for(var k in _.CHARSETS)G(k);return B._parser.setEscHandler({intermediates:"#",final:"8"},function(){return B.screenAlignmentPattern()}),B._parser.setErrorHandler(function(C){return B._logService.error("Parsing error: ",C),C}),B._parser.setDcsHandler({intermediates:"$",final:"q"},new A(B._bufferService,B._coreService,B._logService,B._optionsService)),B}return K(N,U),Object.defineProperty(N.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),N.prototype.dispose=function(){U.prototype.dispose.call(this)},N.prototype.parse=function($){var M=this._bufferService.buffer,Z=M.x,q=M.y;if(this._logService.debug("parsing data",$),this._parseBuffer.length<$.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min($.length,131072))),this._dirtyRowService.clearRange(),$.length>131072)for(var se=0;se<$.length;se+=131072){var ue=se+131072<$.length?se+131072:$.length,J=typeof $=="string"?this._stringDecoder.decode($.substring(se,ue),this._parseBuffer):this._utf8Decoder.decode($.subarray(se,ue),this._parseBuffer);this._parser.parse(this._parseBuffer,J)}else J=typeof $=="string"?this._stringDecoder.decode($,this._parseBuffer):this._utf8Decoder.decode($,this._parseBuffer),this._parser.parse(this._parseBuffer,J);(M=this._bufferService.buffer).x===Z&&M.y===q||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},N.prototype.print=function($,M,Z){var q,se,ue=this._bufferService.buffer,J=this._charsetService.charset,z=this._optionsService.options.screenReaderMode,X=this._bufferService.cols,B=this._coreService.decPrivateModes.wraparound,G=this._coreService.modes.insertMode,W=this._curAttrData,k=ue.lines.get(ue.ybase+ue.y);this._dirtyRowService.markDirty(ue.y),ue.x&&Z-M>0&&k.getWidth(ue.x-1)===2&&k.setCellFromCodePoint(ue.x-1,0,1,W.fg,W.bg,W.extended);for(var C=M;C<Z;++C){if(q=$[C],se=this._unicodeService.wcwidth(q),q<127&&J){var V=J[String.fromCharCode(q)];V&&(q=V.charCodeAt(0))}if(z&&this._onA11yChar.fire(y.stringFromCodePoint(q)),se||!ue.x){if(ue.x+se-1>=X){if(B){for(;ue.x<X;)k.setCellFromCodePoint(ue.x++,0,1,W.fg,W.bg,W.extended);ue.x=0,ue.y++,ue.y===ue.scrollBottom+1?(ue.y--,this._onRequestScroll.fire(this._eraseAttrData(),!0)):(ue.y>=this._bufferService.rows&&(ue.y=this._bufferService.rows-1),ue.lines.get(ue.ybase+ue.y).isWrapped=!0),k=ue.lines.get(ue.ybase+ue.y)}else if(ue.x=X-1,se===2)continue}if(G&&(k.insertCells(ue.x,se,ue.getNullCell(W),W),k.getWidth(X-1)===2&&k.setCellFromCodePoint(X-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,W.fg,W.bg,W.extended)),k.setCellFromCodePoint(ue.x++,q,se,W.fg,W.bg,W.extended),se>0)for(;--se;)k.setCellFromCodePoint(ue.x++,0,0,W.fg,W.bg,W.extended)}else k.getWidth(ue.x-1)?k.addCodepointToCell(ue.x-1,q):k.addCodepointToCell(ue.x-2,q)}Z-M>0&&(k.loadCell(ue.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),ue.x<X&&Z-M>0&&k.getWidth(ue.x)===0&&!k.hasContent(ue.x)&&k.setCellFromCodePoint(ue.x,0,1,W.fg,W.bg,W.extended),this._dirtyRowService.markDirty(ue.y)},N.prototype.addCsiHandler=function($,M){var Z=this;return $.final!=="t"||$.prefix||$.intermediates?this._parser.addCsiHandler($,M):this._parser.addCsiHandler($,function(q){return!x(q.params[0],Z._optionsService.options.windowOptions)||M(q)})},N.prototype.addDcsHandler=function($,M){return this._parser.addDcsHandler($,new T.DcsHandler(M))},N.prototype.addEscHandler=function($,M){return this._parser.addEscHandler($,M)},N.prototype.addOscHandler=function($,M){return this._parser.addOscHandler($,new E.OscHandler(M))},N.prototype.bell=function(){this._onRequestBell.fire()},N.prototype.lineFeed=function(){var $=this._bufferService.buffer;this._dirtyRowService.markDirty($.y),this._optionsService.options.convertEol&&($.x=0),$.y++,$.y===$.scrollBottom+1?($.y--,this._onRequestScroll.fire(this._eraseAttrData())):$.y>=this._bufferService.rows&&($.y=this._bufferService.rows-1),$.x>=this._bufferService.cols&&$.x--,this._dirtyRowService.markDirty($.y),this._onLineFeed.fire()},N.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},N.prototype.backspace=function(){var $,M=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),void(M.x>0&&M.x--);if(this._restrictCursor(this._bufferService.cols),M.x>0)M.x--;else if(M.x===0&&M.y>M.scrollTop&&M.y<=M.scrollBottom&&(!(($=M.lines.get(M.ybase+M.y))===null||$===void 0)&&$.isWrapped)){M.lines.get(M.ybase+M.y).isWrapped=!1,M.y--,M.x=this._bufferService.cols-1;var Z=M.lines.get(M.ybase+M.y);Z.hasWidth(M.x)&&!Z.hasContent(M.x)&&M.x--}this._restrictCursor()},N.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var $=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-$)}},N.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},N.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},N.prototype._restrictCursor=function($){$===void 0&&($=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min($,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},N.prototype._setCursor=function($,M){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=$,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+M):(this._bufferService.buffer.x=$,this._bufferService.buffer.y=M),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},N.prototype._moveCursor=function($,M){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+$,this._bufferService.buffer.y+M)},N.prototype.cursorUp=function($){var M=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;M>=0?this._moveCursor(0,-Math.min(M,$.params[0]||1)):this._moveCursor(0,-($.params[0]||1))},N.prototype.cursorDown=function($){var M=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;M>=0?this._moveCursor(0,Math.min(M,$.params[0]||1)):this._moveCursor(0,$.params[0]||1)},N.prototype.cursorForward=function($){this._moveCursor($.params[0]||1,0)},N.prototype.cursorBackward=function($){this._moveCursor(-($.params[0]||1),0)},N.prototype.cursorNextLine=function($){this.cursorDown($),this._bufferService.buffer.x=0},N.prototype.cursorPrecedingLine=function($){this.cursorUp($),this._bufferService.buffer.x=0},N.prototype.cursorCharAbsolute=function($){this._setCursor(($.params[0]||1)-1,this._bufferService.buffer.y)},N.prototype.cursorPosition=function($){this._setCursor($.length>=2?($.params[1]||1)-1:0,($.params[0]||1)-1)},N.prototype.charPosAbsolute=function($){this._setCursor(($.params[0]||1)-1,this._bufferService.buffer.y)},N.prototype.hPositionRelative=function($){this._moveCursor($.params[0]||1,0)},N.prototype.linePosAbsolute=function($){this._setCursor(this._bufferService.buffer.x,($.params[0]||1)-1)},N.prototype.vPositionRelative=function($){this._moveCursor(0,$.params[0]||1)},N.prototype.hVPosition=function($){this.cursorPosition($)},N.prototype.tabClear=function($){var M=$.params[0];M===0?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:M===3&&(this._bufferService.buffer.tabs={})},N.prototype.cursorForwardTab=function($){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var M=$.params[0]||1;M--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},N.prototype.cursorBackwardTab=function($){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var M=$.params[0]||1,Z=this._bufferService.buffer;M--;)Z.x=Z.prevStop()},N.prototype._eraseInBufferLine=function($,M,Z,q){q===void 0&&(q=!1);var se=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+$);se.replaceCells(M,Z,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),q&&(se.isWrapped=!1)},N.prototype._resetBufferLine=function($){var M=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+$);M.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1},N.prototype.eraseInDisplay=function($){var M;switch(this._restrictCursor(),$.params[0]){case 0:for(M=this._bufferService.buffer.y,this._dirtyRowService.markDirty(M),this._eraseInBufferLine(M++,this._bufferService.buffer.x,this._bufferService.cols,this._bufferService.buffer.x===0);M<this._bufferService.rows;M++)this._resetBufferLine(M);this._dirtyRowService.markDirty(M);break;case 1:for(M=this._bufferService.buffer.y,this._dirtyRowService.markDirty(M),this._eraseInBufferLine(M,0,this._bufferService.buffer.x+1,!0),this._bufferService.buffer.x+1>=this._bufferService.cols&&(this._bufferService.buffer.lines.get(M+1).isWrapped=!1);M--;)this._resetBufferLine(M);this._dirtyRowService.markDirty(0);break;case 2:for(M=this._bufferService.rows,this._dirtyRowService.markDirty(M-1);M--;)this._resetBufferLine(M);this._dirtyRowService.markDirty(0);break;case 3:var Z=this._bufferService.buffer.lines.length-this._bufferService.rows;Z>0&&(this._bufferService.buffer.lines.trimStart(Z),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-Z,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-Z,0),this._onScroll.fire(0))}},N.prototype.eraseInLine=function($){switch(this._restrictCursor(),$.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}this._dirtyRowService.markDirty(this._bufferService.buffer.y)},N.prototype.insertLines=function($){this._restrictCursor();var M=$.params[0]||1,Z=this._bufferService.buffer;if(!(Z.y>Z.scrollBottom||Z.y<Z.scrollTop)){for(var q=Z.ybase+Z.y,se=this._bufferService.rows-1-Z.scrollBottom,ue=this._bufferService.rows-1+Z.ybase-se+1;M--;)Z.lines.splice(ue-1,1),Z.lines.splice(q,0,Z.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(Z.y,Z.scrollBottom),Z.x=0}},N.prototype.deleteLines=function($){this._restrictCursor();var M=$.params[0]||1,Z=this._bufferService.buffer;if(!(Z.y>Z.scrollBottom||Z.y<Z.scrollTop)){var q,se=Z.ybase+Z.y;for(q=this._bufferService.rows-1-Z.scrollBottom,q=this._bufferService.rows-1+Z.ybase-q;M--;)Z.lines.splice(se,1),Z.lines.splice(q,0,Z.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(Z.y,Z.scrollBottom),Z.x=0}},N.prototype.insertChars=function($){this._restrictCursor();var M=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);M&&(M.insertCells(this._bufferService.buffer.x,$.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},N.prototype.deleteChars=function($){this._restrictCursor();var M=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);M&&(M.deleteCells(this._bufferService.buffer.x,$.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},N.prototype.scrollUp=function($){for(var M=$.params[0]||1,Z=this._bufferService.buffer;M--;)Z.lines.splice(Z.ybase+Z.scrollTop,1),Z.lines.splice(Z.ybase+Z.scrollBottom,0,Z.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(Z.scrollTop,Z.scrollBottom)},N.prototype.scrollDown=function($){for(var M=$.params[0]||1,Z=this._bufferService.buffer;M--;)Z.lines.splice(Z.ybase+Z.scrollBottom,1),Z.lines.splice(Z.ybase+Z.scrollTop,0,Z.getBlankLine(f.DEFAULT_ATTR_DATA));this._dirtyRowService.markRangeDirty(Z.scrollTop,Z.scrollBottom)},N.prototype.scrollLeft=function($){var M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){for(var Z=$.params[0]||1,q=M.scrollTop;q<=M.scrollBottom;++q){var se=M.lines.get(M.ybase+q);se.deleteCells(0,Z,M.getNullCell(this._eraseAttrData()),this._eraseAttrData()),se.isWrapped=!1}this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)}},N.prototype.scrollRight=function($){var M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){for(var Z=$.params[0]||1,q=M.scrollTop;q<=M.scrollBottom;++q){var se=M.lines.get(M.ybase+q);se.insertCells(0,Z,M.getNullCell(this._eraseAttrData()),this._eraseAttrData()),se.isWrapped=!1}this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)}},N.prototype.insertColumns=function($){var M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){for(var Z=$.params[0]||1,q=M.scrollTop;q<=M.scrollBottom;++q){var se=this._bufferService.buffer.lines.get(M.ybase+q);se.insertCells(M.x,Z,M.getNullCell(this._eraseAttrData()),this._eraseAttrData()),se.isWrapped=!1}this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)}},N.prototype.deleteColumns=function($){var M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){for(var Z=$.params[0]||1,q=M.scrollTop;q<=M.scrollBottom;++q){var se=M.lines.get(M.ybase+q);se.deleteCells(M.x,Z,M.getNullCell(this._eraseAttrData()),this._eraseAttrData()),se.isWrapped=!1}this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)}},N.prototype.eraseChars=function($){this._restrictCursor();var M=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);M&&(M.replaceCells(this._bufferService.buffer.x,this._bufferService.buffer.x+($.params[0]||1),this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},N.prototype.repeatPrecedingCharacter=function($){if(this._parser.precedingCodepoint){for(var M=$.params[0]||1,Z=new Uint32Array(M),q=0;q<M;++q)Z[q]=this._parser.precedingCodepoint;this.print(Z,0,Z.length)}},N.prototype.sendDeviceAttributesPrimary=function($){$.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(w.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(w.C0.ESC+"[?6c"))},N.prototype.sendDeviceAttributesSecondary=function($){$.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(w.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(w.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent($.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(w.C0.ESC+"[>83;40003;0c"))},N.prototype._is=function($){return(this._optionsService.options.termName+"").indexOf($)===0},N.prototype.setMode=function($){for(var M=0;M<$.length;M++)switch($.params[M]){case 4:this._coreService.modes.insertMode=!0}},N.prototype.setModePrivate=function($){for(var M=0;M<$.length;M++)switch($.params[M]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0;break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}},N.prototype.resetMode=function($){for(var M=0;M<$.length;M++)switch($.params[M]){case 4:this._coreService.modes.insertMode=!1}},N.prototype.resetModePrivate=function($){for(var M=0;M<$.length;M++)switch($.params[M]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),$.params[M]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}},N.prototype._updateAttrColor=function($,M,Z,q,se){return M===2?($|=50331648,$&=-16777216,$|=d.AttributeData.fromColorRGB([Z,q,se])):M===5&&($&=-50331904,$|=33554432|255&Z),$},N.prototype._extractColor=function($,M,Z){var q=[0,0,-1,0,0,0],se=0,ue=0;do{if(q[ue+se]=$.params[M+ue],$.hasSubParams(M+ue)){var J=$.getSubParams(M+ue),z=0;do q[1]===5&&(se=1),q[ue+z+1+se]=J[z];while(++z<J.length&&z+ue+1+se<q.length);break}if(q[1]===5&&ue+se>=2||q[1]===2&&ue+se>=5)break;q[1]&&(se=1)}while(++ue+M<$.length&&ue+se<q.length);for(z=2;z<q.length;++z)q[z]===-1&&(q[z]=0);switch(q[0]){case 38:Z.fg=this._updateAttrColor(Z.fg,q[1],q[3],q[4],q[5]);break;case 48:Z.bg=this._updateAttrColor(Z.bg,q[1],q[3],q[4],q[5]);break;case 58:Z.extended=Z.extended.clone(),Z.extended.underlineColor=this._updateAttrColor(Z.extended.underlineColor,q[1],q[3],q[4],q[5])}return ue},N.prototype._processUnderline=function($,M){M.extended=M.extended.clone(),(!~$||$>5)&&($=1),M.extended.underlineStyle=$,M.fg|=268435456,$===0&&(M.fg&=-268435457),M.updateExtended()},N.prototype.charAttributes=function($){if($.length===1&&$.params[0]===0)return this._curAttrData.fg=f.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=f.DEFAULT_ATTR_DATA.bg);for(var M,Z=$.length,q=this._curAttrData,se=0;se<Z;se++)(M=$.params[se])>=30&&M<=37?(q.fg&=-50331904,q.fg|=16777216|M-30):M>=40&&M<=47?(q.bg&=-50331904,q.bg|=16777216|M-40):M>=90&&M<=97?(q.fg&=-50331904,q.fg|=16777224|M-90):M>=100&&M<=107?(q.bg&=-50331904,q.bg|=16777224|M-100):M===0?(q.fg=f.DEFAULT_ATTR_DATA.fg,q.bg=f.DEFAULT_ATTR_DATA.bg):M===1?q.fg|=134217728:M===3?q.bg|=67108864:M===4?(q.fg|=268435456,this._processUnderline($.hasSubParams(se)?$.getSubParams(se)[0]:1,q)):M===5?q.fg|=536870912:M===7?q.fg|=67108864:M===8?q.fg|=1073741824:M===2?q.bg|=134217728:M===21?this._processUnderline(2,q):M===22?(q.fg&=-134217729,q.bg&=-134217729):M===23?q.bg&=-67108865:M===24?q.fg&=-268435457:M===25?q.fg&=-536870913:M===27?q.fg&=-67108865:M===28?q.fg&=-1073741825:M===39?(q.fg&=-67108864,q.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):M===49?(q.bg&=-67108864,q.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):M===38||M===48||M===58?se+=this._extractColor($,se,q):M===59?(q.extended=q.extended.clone(),q.extended.underlineColor=-1,q.updateExtended()):M===100?(q.fg&=-67108864,q.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,q.bg&=-67108864,q.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",M)},N.prototype.deviceStatus=function($){switch($.params[0]){case 5:this._coreService.triggerDataEvent(w.C0.ESC+"[0n");break;case 6:var M=this._bufferService.buffer.y+1,Z=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(w.C0.ESC+"["+M+";"+Z+"R")}},N.prototype.deviceStatusPrivate=function($){switch($.params[0]){case 6:var M=this._bufferService.buffer.y+1,Z=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(w.C0.ESC+"[?"+M+";"+Z+"R")}},N.prototype.softReset=function($){this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1},N.prototype.setCursorStyle=function($){var M=$.params[0]||1;switch(M){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}var Z=M%2==1;this._optionsService.options.cursorBlink=Z},N.prototype.setScrollRegion=function($){var M,Z=$.params[0]||1;($.length<2||(M=$.params[1])>this._bufferService.rows||M===0)&&(M=this._bufferService.rows),M>Z&&(this._bufferService.buffer.scrollTop=Z-1,this._bufferService.buffer.scrollBottom=M-1,this._setCursor(0,0))},N.prototype.windowOptions=function($){if(x($.params[0],this._optionsService.options.windowOptions)){var M=$.length>1?$.params[1]:0;switch($.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(w.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},N.prototype.saveCursor=function($){this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset},N.prototype.restoreCursor=function($){this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor()},N.prototype.setTitle=function($){this._windowTitle=$,this._onTitleChange.fire($)},N.prototype.setIconName=function($){this._iconName=$},N.prototype.nextLine=function(){this._bufferService.buffer.x=0,this.index()},N.prototype.keypadApplicationMode=function(){this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire()},N.prototype.keypadNumericMode=function(){this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire()},N.prototype.selectDefaultCharset=function(){this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET)},N.prototype.selectCharset=function($){$.length===2?$[0]!=="/"&&this._charsetService.setgCharset(L[$[0]],_.CHARSETS[$[1]]||_.DEFAULT_CHARSET):this.selectDefaultCharset()},N.prototype.index=function(){this._restrictCursor();var $=this._bufferService.buffer;this._bufferService.buffer.y++,$.y===$.scrollBottom+1?($.y--,this._onRequestScroll.fire(this._eraseAttrData())):$.y>=this._bufferService.rows&&($.y=this._bufferService.rows-1),this._restrictCursor()},N.prototype.tabSet=function(){this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0},N.prototype.reverseIndex=function(){this._restrictCursor();var $=this._bufferService.buffer;if($.y===$.scrollTop){var M=$.scrollBottom-$.scrollTop;$.lines.shiftElements($.ybase+$.y,M,1),$.lines.set($.ybase+$.y,$.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty($.scrollTop,$.scrollBottom)}else $.y--,this._restrictCursor()},N.prototype.fullReset=function(){this._parser.reset(),this._onRequestReset.fire()},N.prototype.reset=function(){this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()},N.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},N.prototype.setgLevel=function($){this._charsetService.setgLevel($)},N.prototype.screenAlignmentPattern=function(){var $=new h.CellData;$.content=1<<22|69,$.fg=this._curAttrData.fg,$.bg=this._curAttrData.bg;var M=this._bufferService.buffer;this._setCursor(0,0);for(var Z=0;Z<this._bufferService.rows;++Z){var q=M.ybase+M.y+Z,se=M.lines.get(q);se&&(se.fill($),se.isWrapped=!1)}this._dirtyRowService.markAllDirty(),this._setCursor(0,0)},N}(v.Disposable);b.InputHandler=O},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.DEFAULT_CHARSET=b.CHARSETS=void 0,b.CHARSETS={},b.DEFAULT_CHARSET=b.CHARSETS.B,b.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},b.CHARSETS.A={"#":"\xA3"},b.CHARSETS.B=void 0,b.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},b.CHARSETS.C=b.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},b.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},b.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},b.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},b.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},b.CHARSETS.E=b.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},b.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},b.CHARSETS.H=b.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},b.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Params=void 0;var P=function(){function K(D,w){if(D===void 0&&(D=32),w===void 0&&(w=32),this.maxLength=D,this.maxSubParamsLength=w,w>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(D),this.length=0,this._subParams=new Int32Array(w),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(D),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return K.fromArray=function(D){var w=new K;if(!D.length)return w;for(var _=D[0]instanceof Array?1:0;_<D.length;++_){var F=D[_];if(F instanceof Array)for(var v=0;v<F.length;++v)w.addSubParam(F[v]);else w.addParam(F)}return w},K.prototype.clone=function(){var D=new K(this.maxLength,this.maxSubParamsLength);return D.params.set(this.params),D.length=this.length,D._subParams.set(this._subParams),D._subParamsLength=this._subParamsLength,D._subParamsIdx.set(this._subParamsIdx),D._rejectDigits=this._rejectDigits,D._rejectSubDigits=this._rejectSubDigits,D._digitIsSub=this._digitIsSub,D},K.prototype.toArray=function(){for(var D=[],w=0;w<this.length;++w){D.push(this.params[w]);var _=this._subParamsIdx[w]>>8,F=255&this._subParamsIdx[w];F-_>0&&D.push(Array.prototype.slice.call(this._subParams,_,F))}return D},K.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},K.prototype.addParam=function(D){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(D<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=D>2147483647?2147483647:D}},K.prototype.addSubParam=function(D){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(D<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=D>2147483647?2147483647:D,this._subParamsIdx[this.length-1]++}},K.prototype.hasSubParams=function(D){return(255&this._subParamsIdx[D])-(this._subParamsIdx[D]>>8)>0},K.prototype.getSubParams=function(D){var w=this._subParamsIdx[D]>>8,_=255&this._subParamsIdx[D];return _-w>0?this._subParams.subarray(w,_):null},K.prototype.getSubParamsAll=function(){for(var D={},w=0;w<this.length;++w){var _=this._subParamsIdx[w]>>8,F=255&this._subParamsIdx[w];F-_>0&&(D[w]=this._subParams.slice(_,F))}return D},K.prototype.addDigit=function(D){var w;if(!(this._rejectDigits||!(w=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var _=this._digitIsSub?this._subParams:this.params,F=_[w-1];_[w-1]=~F?Math.min(10*F+D,2147483647):D}},K}();b.Params=P},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.OscHandler=b.OscParser=void 0;var P=I(23),K=I(8),D=function(){function _(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return _.prototype.addHandler=function(F,v){this._handlers[F]===void 0&&(this._handlers[F]=[]);var s=this._handlers[F];return s.push(v),{dispose:function(){var y=s.indexOf(v);y!==-1&&s.splice(y,1)}}},_.prototype.setHandler=function(F,v){this._handlers[F]=[v]},_.prototype.clearHandler=function(F){this._handlers[F]&&delete this._handlers[F]},_.prototype.setHandlerFallback=function(F){this._handlerFb=F},_.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},_.prototype.reset=function(){this._state===2&&this.end(!1),this._id=-1,this._state=0},_.prototype._start=function(){var F=this._handlers[this._id];if(F)for(var v=F.length-1;v>=0;v--)F[v].start();else this._handlerFb(this._id,"START")},_.prototype._put=function(F,v,s){var y=this._handlers[this._id];if(y)for(var f=y.length-1;f>=0;f--)y[f].put(F,v,s);else this._handlerFb(this._id,"PUT",K.utf32ToString(F,v,s))},_.prototype._end=function(F){var v=this._handlers[this._id];if(v){for(var s=v.length-1;s>=0&&v[s].end(F)===!1;s--);for(s--;s>=0;s--)v[s].end(!1)}else this._handlerFb(this._id,"END",F)},_.prototype.start=function(){this.reset(),this._id=-1,this._state=1},_.prototype.put=function(F,v,s){if(this._state!==3){if(this._state===1)for(;v<s;){var y=F[v++];if(y===59){this._state=2,this._start();break}if(y<48||57<y)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+y-48}this._state===2&&s-v>0&&this._put(F,v,s)}},_.prototype.end=function(F){this._state!==0&&(this._state!==3&&(this._state===1&&this._start(),this._end(F)),this._id=-1,this._state=0)},_}();b.OscParser=D;var w=function(){function _(F){this._handler=F,this._data="",this._hitLimit=!1}return _.prototype.start=function(){this._data="",this._hitLimit=!1},_.prototype.put=function(F,v,s){this._hitLimit||(this._data+=K.utf32ToString(F,v,s),this._data.length>P.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},_.prototype.end=function(F){var v;return this._hitLimit?v=!1:F&&(v=this._handler(this._data)),this._data="",this._hitLimit=!1,v},_}();b.OscHandler=w},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.PAYLOAD_LIMIT=void 0,b.PAYLOAD_LIMIT=1e7},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.DcsHandler=b.DcsParser=void 0;var P=I(8),K=I(21),D=I(23),w=[],_=function(){function v(){this._handlers=Object.create(null),this._active=w,this._ident=0,this._handlerFb=function(){}}return v.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},v.prototype.addHandler=function(s,y){this._handlers[s]===void 0&&(this._handlers[s]=[]);var f=this._handlers[s];return f.push(y),{dispose:function(){var c=f.indexOf(y);c!==-1&&f.splice(c,1)}}},v.prototype.setHandler=function(s,y){this._handlers[s]=[y]},v.prototype.clearHandler=function(s){this._handlers[s]&&delete this._handlers[s]},v.prototype.setHandlerFallback=function(s){this._handlerFb=s},v.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=w,this._ident=0},v.prototype.hook=function(s,y){if(this.reset(),this._ident=s,this._active=this._handlers[s]||w,this._active.length)for(var f=this._active.length-1;f>=0;f--)this._active[f].hook(y);else this._handlerFb(this._ident,"HOOK",y)},v.prototype.put=function(s,y,f){if(this._active.length)for(var c=this._active.length-1;c>=0;c--)this._active[c].put(s,y,f);else this._handlerFb(this._ident,"PUT",P.utf32ToString(s,y,f))},v.prototype.unhook=function(s){if(this._active.length){for(var y=this._active.length-1;y>=0&&this._active[y].unhook(s)===!1;y--);for(y--;y>=0;y--)this._active[y].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",s);this._active=w,this._ident=0},v}();b.DcsParser=_;var F=function(){function v(s){this._handler=s,this._data="",this._hitLimit=!1}return v.prototype.hook=function(s){this._params=s.clone(),this._data="",this._hitLimit=!1},v.prototype.put=function(s,y,f){this._hitLimit||(this._data+=P.utf32ToString(s,y,f),this._data.length>D.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},v.prototype.unhook=function(s){var y;return this._hitLimit?y=!1:s&&(y=this._handler(this._data,this._params||new K.Params)),this._params=void 0,this._data="",this._hitLimit=!1,y},v}();b.DcsHandler=F},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.removeTerminalFromCache=b.acquireCharAtlas=void 0;var P=I(26),K=I(43),D=[];b.acquireCharAtlas=function(w,_,F,v,s){for(var y=P.generateConfig(v,s,w,F),f=0;f<D.length;f++){var c=(l=D[f]).ownedBy.indexOf(_);if(c>=0){if(P.configEquals(l.config,y))return l.atlas;l.ownedBy.length===1?(l.atlas.dispose(),D.splice(f,1)):l.ownedBy.splice(c,1);break}}for(f=0;f<D.length;f++){var l=D[f];if(P.configEquals(l.config,y))return l.ownedBy.push(_),l.atlas}var h={atlas:new K.DynamicCharAtlas(document,y),config:y,ownedBy:[_]};return D.push(h),h.atlas},b.removeTerminalFromCache=function(w){for(var _=0;_<D.length;_++){var F=D[_].ownedBy.indexOf(w);if(F!==-1){D[_].ownedBy.length===1?(D[_].atlas.dispose(),D.splice(_,1)):D[_].ownedBy.splice(F,1);break}}}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.is256Color=b.configEquals=b.generateConfig=void 0;var P=I(3);b.generateConfig=function(K,D,w,_){var F={foreground:_.foreground,background:_.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:_.ansi.slice(0,16)};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:K,scaledCharHeight:D,fontFamily:w.fontFamily,fontSize:w.fontSize,fontWeight:w.fontWeight,fontWeightBold:w.fontWeightBold,allowTransparency:w.allowTransparency,colors:F}},b.configEquals=function(K,D){for(var w=0;w<K.colors.ansi.length;w++)if(K.colors.ansi[w].rgba!==D.colors.ansi[w].rgba)return!1;return K.devicePixelRatio===D.devicePixelRatio&&K.fontFamily===D.fontFamily&&K.fontSize===D.fontSize&&K.fontWeight===D.fontWeight&&K.fontWeightBold===D.fontWeightBold&&K.allowTransparency===D.allowTransparency&&K.scaledCharWidth===D.scaledCharWidth&&K.scaledCharHeight===D.scaledCharHeight&&K.colors.foreground===D.colors.foreground&&K.colors.background===D.colors.background},b.is256Color=function(K){return K<P.DEFAULT_COLOR}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ColorManager=b.DEFAULT_ANSI_COLORS=void 0;var P=I(10),K=I(45),D=P.css.toColor("#ffffff"),w=P.css.toColor("#000000"),_=P.css.toColor("#ffffff"),F=P.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};b.DEFAULT_ANSI_COLORS=function(){for(var y=[P.css.toColor("#2e3436"),P.css.toColor("#cc0000"),P.css.toColor("#4e9a06"),P.css.toColor("#c4a000"),P.css.toColor("#3465a4"),P.css.toColor("#75507b"),P.css.toColor("#06989a"),P.css.toColor("#d3d7cf"),P.css.toColor("#555753"),P.css.toColor("#ef2929"),P.css.toColor("#8ae234"),P.css.toColor("#fce94f"),P.css.toColor("#729fcf"),P.css.toColor("#ad7fa8"),P.css.toColor("#34e2e2"),P.css.toColor("#eeeeec")],f=[0,95,135,175,215,255],c=0;c<216;c++){var l=f[c/36%6|0],h=f[c/6%6|0],d=f[c%6];y.push({css:P.channels.toCss(l,h,d),rgba:P.channels.toRgba(l,h,d)})}for(c=0;c<24;c++){var E=8+10*c;y.push({css:P.channels.toCss(E,E,E),rgba:P.channels.toRgba(E,E,E)})}return y}();var s=function(){function y(f,c){this.allowTransparency=c;var l=f.createElement("canvas");l.width=1,l.height=1;var h=l.getContext("2d");if(!h)throw new Error("Could not get rendering context");this._ctx=h,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new K.ColorContrastCache,this.colors={foreground:D,background:w,cursor:_,cursorAccent:F,selectionTransparent:v,selectionOpaque:P.color.blend(w,v),ansi:b.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return y.prototype.onOptionsChange=function(f){f==="minimumContrastRatio"&&this._contrastCache.clear()},y.prototype.setTheme=function(f){f===void 0&&(f={}),this.colors.foreground=this._parseColor(f.foreground,D),this.colors.background=this._parseColor(f.background,w),this.colors.cursor=this._parseColor(f.cursor,_,!0),this.colors.cursorAccent=this._parseColor(f.cursorAccent,F,!0),this.colors.selectionTransparent=this._parseColor(f.selection,v,!0),this.colors.selectionOpaque=P.color.blend(this.colors.background,this.colors.selectionTransparent),P.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=P.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(f.black,b.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(f.red,b.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(f.green,b.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(f.yellow,b.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(f.blue,b.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(f.magenta,b.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(f.cyan,b.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(f.white,b.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(f.brightBlack,b.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(f.brightRed,b.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(f.brightGreen,b.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(f.brightYellow,b.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(f.brightBlue,b.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(f.brightMagenta,b.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(f.brightCyan,b.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(f.brightWhite,b.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},y.prototype._parseColor=function(f,c,l){if(l===void 0&&(l=this.allowTransparency),f===void 0)return c;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=f,typeof this._ctx.fillStyle!="string")return console.warn("Color: "+f+" is invalid using fallback "+c.css),c;this._ctx.fillRect(0,0,1,1);var h=this._ctx.getImageData(0,0,1,1).data;if(h[3]!==255){if(!l)return console.warn("Color: "+f+" is using transparency, but allowTransparency is false. Using fallback "+c.css+"."),c;var d=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(function(O){return Number(O)}),E=d[0],T=d[1],L=d[2],x=d[3],A=Math.round(255*x);return{rgba:P.channels.toRgba(E,T,L,A),css:f}}return{css:this._ctx.fillStyle,rgba:P.channels.toRgba(h[0],h[1],h[2],h[3])}},y}();b.ColorManager=s},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.throwIfFalsy=void 0,b.throwIfFalsy=function(P){if(!P)throw new Error("value must not be falsy");return P}},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(s,y){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,c){f.__proto__=c}||function(f,c){for(var l in c)c.hasOwnProperty(l)&&(f[l]=c[l])})(s,y)},function(s,y){function f(){this.constructor=s}P(s,y),s.prototype=y===null?Object.create(y):(f.prototype=y.prototype,new f)});Object.defineProperty(b,"__esModule",{value:!0}),b.CharacterJoinerRegistry=b.JoinedCellData=void 0;var D=I(6),w=I(3),_=I(4),F=function(s){function y(f,c,l){var h=s.call(this)||this;return h.content=0,h.combinedData="",h.fg=f.fg,h.bg=f.bg,h.combinedData=c,h._width=l,h}return K(y,s),y.prototype.isCombined=function(){return 2097152},y.prototype.getWidth=function(){return this._width},y.prototype.getChars=function(){return this.combinedData},y.prototype.getCode=function(){return 2097151},y.prototype.setFromCharData=function(f){throw new Error("not implemented")},y.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},y}(D.AttributeData);b.JoinedCellData=F;var v=function(){function s(y){this._bufferService=y,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}return s.prototype.registerCharacterJoiner=function(y){var f={id:this._nextCharacterJoinerId++,handler:y};return this._characterJoiners.push(f),f.id},s.prototype.deregisterCharacterJoiner=function(y){for(var f=0;f<this._characterJoiners.length;f++)if(this._characterJoiners[f].id===y)return this._characterJoiners.splice(f,1),!0;return!1},s.prototype.getJoinedCharacters=function(y){if(this._characterJoiners.length===0)return[];var f=this._bufferService.buffer.lines.get(y);if(!f||f.length===0)return[];for(var c=[],l=f.translateToString(!0),h=0,d=0,E=0,T=f.getFg(0),L=f.getBg(0),x=0;x<f.getTrimmedLength();x++)if(f.loadCell(x,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==T||this._workCell.bg!==L){if(x-h>1)for(var A=this._getJoinedRanges(l,E,d,f,h),O=0;O<A.length;O++)c.push(A[O]);h=x,E=d,T=this._workCell.fg,L=this._workCell.bg}d+=this._workCell.getChars().length||w.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-h>1)for(A=this._getJoinedRanges(l,E,d,f,h),O=0;O<A.length;O++)c.push(A[O]);return c},s.prototype._getJoinedRanges=function(y,f,c,l,h){for(var d=y.substring(f,c),E=this._characterJoiners[0].handler(d),T=1;T<this._characterJoiners.length;T++)for(var L=this._characterJoiners[T].handler(d),x=0;x<L.length;x++)s._mergeRanges(E,L[x]);return this._stringRangesToCellRanges(E,l,h),E},s.prototype._stringRangesToCellRanges=function(y,f,c){var l=0,h=!1,d=0,E=y[l];if(E){for(var T=c;T<this._bufferService.cols;T++){var L=f.getWidth(T),x=f.getString(T).length||w.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!h&&E[0]<=d&&(E[0]=T,h=!0),E[1]<=d){if(E[1]=T,!(E=y[++l]))break;E[0]<=d?(E[0]=T,h=!0):h=!1}d+=x}}E&&(E[1]=this._bufferService.cols)}},s._mergeRanges=function(y,f){for(var c=!1,l=0;l<y.length;l++){var h=y[l];if(c){if(f[1]<=h[0])return y[l-1][1]=f[1],y;if(f[1]<=h[1])return y[l-1][1]=Math.max(f[1],h[1]),y.splice(l,1),y;y.splice(l,1),l--}else{if(f[1]<=h[0])return y.splice(l,0,f),y;if(f[1]<=h[1])return h[0]=Math.min(f[0],h[0]),y;f[0]<h[1]&&(h[0]=Math.min(f[0],h[0]),c=!0)}}return c?y[y.length-1][1]=f[1]:y.push(f),y},s}();b.CharacterJoinerRegistry=v},function(ge,b,I){"use strict";function P(K,D){var w=D.getBoundingClientRect();return[K.clientX-w.left,K.clientY-w.top]}Object.defineProperty(b,"__esModule",{value:!0}),b.getRawByteCoords=b.getCoords=b.getCoordsRelativeToElement=void 0,b.getCoordsRelativeToElement=P,b.getCoords=function(K,D,w,_,F,v,s,y){if(F){var f=P(K,D);if(f)return f[0]=Math.ceil((f[0]+(y?v/2:0))/v),f[1]=Math.ceil(f[1]/s),f[0]=Math.min(Math.max(f[0],1),w+(y?1:0)),f[1]=Math.min(Math.max(f[1],1),_),f}},b.getRawByteCoords=function(K){if(K)return{x:K[0]+32,y:K[1]+32}}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.RenderDebouncer=void 0;var P=function(){function K(D){this._renderCallback=D}return K.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},K.prototype.refresh=function(D,w,_){var F=this;this._rowCount=_,D=D!==void 0?D:0,w=w!==void 0?w:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,D):D,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,w):w,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){return F._innerRefresh()}))},K.prototype._innerRefresh=function(){if(this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0){var D=Math.max(this._rowStart,0),w=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(D,w)}},K}();b.RenderDebouncer=P},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(w,_){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,v){F.__proto__=v}||function(F,v){for(var s in v)v.hasOwnProperty(s)&&(F[s]=v[s])})(w,_)},function(w,_){function F(){this.constructor=w}P(w,_),w.prototype=_===null?Object.create(_):(F.prototype=_.prototype,new F)});Object.defineProperty(b,"__esModule",{value:!0}),b.ScreenDprMonitor=void 0;var D=function(w){function _(){var F=w!==null&&w.apply(this,arguments)||this;return F._currentDevicePixelRatio=window.devicePixelRatio,F}return K(_,w),_.prototype.setListener=function(F){var v=this;this._listener&&this.clearListener(),this._listener=F,this._outerListener=function(){v._listener&&(v._listener(window.devicePixelRatio,v._currentDevicePixelRatio),v._updateDpr())},this._updateDpr()},_.prototype.dispose=function(){w.prototype.dispose.call(this),this.clearListener()},_.prototype._updateDpr=function(){var F;this._outerListener&&((F=this._resolutionMediaMatchList)===null||F===void 0||F.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},_.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},_}(I(2).Disposable);b.ScreenDprMonitor=D},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.clone=void 0,b.clone=function P(K,D){if(D===void 0&&(D=5),typeof K!="object")return K;var w=Array.isArray(K)?[]:{};for(var _ in K)w[_]=D<=1?K[_]:K[_]?P(K[_],D-1):K[_];return w}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;var P=I(4),K=I(35),D=I(18),w=I(0),_=I(83),F=function(){function l(h){this._core=new K.Terminal(h),this._addonManager=new _.AddonManager}return l.prototype._checkProposedApi=function(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")},Object.defineProperty(l.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new f(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"unicode",{get:function(){return this._checkProposedApi(),new c(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this._checkProposedApi(),new s(this._core.buffers)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),l.prototype.blur=function(){this._core.blur()},l.prototype.focus=function(){this._core.focus()},l.prototype.resize=function(h,d){this._verifyIntegers(h,d),this._core.resize(h,d)},l.prototype.open=function(h){this._core.open(h)},l.prototype.attachCustomKeyEventHandler=function(h){this._core.attachCustomKeyEventHandler(h)},l.prototype.registerLinkMatcher=function(h,d,E){return this._checkProposedApi(),this._core.registerLinkMatcher(h,d,E)},l.prototype.deregisterLinkMatcher=function(h){this._checkProposedApi(),this._core.deregisterLinkMatcher(h)},l.prototype.registerLinkProvider=function(h){return this._checkProposedApi(),this._core.registerLinkProvider(h)},l.prototype.registerCharacterJoiner=function(h){return this._checkProposedApi(),this._core.registerCharacterJoiner(h)},l.prototype.deregisterCharacterJoiner=function(h){this._checkProposedApi(),this._core.deregisterCharacterJoiner(h)},l.prototype.registerMarker=function(h){return this._checkProposedApi(),this._verifyIntegers(h),this._core.addMarker(h)},l.prototype.addMarker=function(h){return this.registerMarker(h)},l.prototype.hasSelection=function(){return this._core.hasSelection()},l.prototype.select=function(h,d,E){this._verifyIntegers(h,d,E),this._core.select(h,d,E)},l.prototype.getSelection=function(){return this._core.getSelection()},l.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},l.prototype.clearSelection=function(){this._core.clearSelection()},l.prototype.selectAll=function(){this._core.selectAll()},l.prototype.selectLines=function(h,d){this._verifyIntegers(h,d),this._core.selectLines(h,d)},l.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},l.prototype.scrollLines=function(h){this._verifyIntegers(h),this._core.scrollLines(h)},l.prototype.scrollPages=function(h){this._verifyIntegers(h),this._core.scrollPages(h)},l.prototype.scrollToTop=function(){this._core.scrollToTop()},l.prototype.scrollToBottom=function(){this._core.scrollToBottom()},l.prototype.scrollToLine=function(h){this._verifyIntegers(h),this._core.scrollToLine(h)},l.prototype.clear=function(){this._core.clear()},l.prototype.write=function(h,d){this._core.write(h,d)},l.prototype.writeUtf8=function(h,d){this._core.write(h,d)},l.prototype.writeln=function(h,d){this._core.write(h),this._core.write(`\r
|
|
|
`,d)},l.prototype.paste=function(h){this._core.paste(h)},l.prototype.getOption=function(h){return this._core.optionsService.getOption(h)},l.prototype.setOption=function(h,d){this._core.optionsService.setOption(h,d)},l.prototype.refresh=function(h,d){this._verifyIntegers(h,d),this._core.refresh(h,d)},l.prototype.reset=function(){this._core.reset()},l.prototype.loadAddon=function(h){return this._addonManager.loadAddon(this,h)},Object.defineProperty(l,"strings",{get:function(){return D},enumerable:!1,configurable:!0}),l.prototype._verifyIntegers=function(){for(var h=[],d=0;d<arguments.length;d++)h[d]=arguments[d];for(var E=0,T=h;E<T.length;E++){var L=T[E];if(L===1/0||isNaN(L)||L%1!=0)throw new Error("This API only accepts integers")}},l}();b.Terminal=F;var v=function(){function l(h,d){this._buffer=h,this.type=d}return l.prototype.init=function(h){return this._buffer=h,this},Object.defineProperty(l.prototype,"cursorY",{get:function(){return this._buffer.y},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!1,configurable:!0}),l.prototype.getLine=function(h){var d=this._buffer.lines.get(h);if(d)return new y(d)},l.prototype.getNullCell=function(){return new P.CellData},l}(),s=function(){function l(h){var d=this;this._buffers=h,this._onBufferChange=new w.EventEmitter,this._normal=new v(this._buffers.normal,"normal"),this._alternate=new v(this._buffers.alt,"alternate"),this._buffers.onBufferActivate(function(){return d._onBufferChange.fire(d.active)})}return Object.defineProperty(l.prototype,"onBufferChange",{get:function(){return this._onBufferChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"active",{get:function(){if(this._buffers.active===this._buffers.normal)return this.normal;if(this._buffers.active===this._buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"normal",{get:function(){return this._normal.init(this._buffers.normal)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"alternate",{get:function(){return this._alternate.init(this._buffers.alt)},enumerable:!1,configurable:!0}),l}(),y=function(){function l(h){this._line=h}return Object.defineProperty(l.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"length",{get:function(){return this._line.length},enumerable:!1,configurable:!0}),l.prototype.getCell=function(h,d){if(!(h<0||h>=this._line.length))return d?(this._line.loadCell(h,d),d):this._line.loadCell(h,new P.CellData)},l.prototype.translateToString=function(h,d,E){return this._line.translateToString(h,d,E)},l}(),f=function(){function l(h){this._core=h}return l.prototype.registerCsiHandler=function(h,d){return this._core.addCsiHandler(h,function(E){return d(E.toArray())})},l.prototype.addCsiHandler=function(h,d){return this.registerCsiHandler(h,d)},l.prototype.registerDcsHandler=function(h,d){return this._core.addDcsHandler(h,function(E,T){return d(E,T.toArray())})},l.prototype.addDcsHandler=function(h,d){return this.registerDcsHandler(h,d)},l.prototype.registerEscHandler=function(h,d){return this._core.addEscHandler(h,d)},l.prototype.addEscHandler=function(h,d){return this.registerEscHandler(h,d)},l.prototype.registerOscHandler=function(h,d){return this._core.addOscHandler(h,d)},l.prototype.addOscHandler=function(h,d){return this.registerOscHandler(h,d)},l}(),c=function(){function l(h){this._core=h}return l.prototype.register=function(h){this._core.unicodeService.register(h)},Object.defineProperty(l.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(h){this._core.unicodeService.activeVersion=h},enumerable:!1,configurable:!0}),l}()},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(X,B){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(G,W){G.__proto__=W}||function(G,W){for(var k in W)W.hasOwnProperty(k)&&(G[k]=W[k])})(X,B)},function(X,B){function G(){this.constructor=X}P(X,B),X.prototype=B===null?Object.create(B):(G.prototype=B.prototype,new G)});Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;var D=I(36),w=I(37),_=I(38),F=I(12),v=I(19),s=I(40),y=I(50),f=I(51),c=I(11),l=I(7),h=I(18),d=I(54),E=I(55),T=I(56),L=I(57),x=I(59),A=I(0),O=I(16),U=I(27),N=I(60),$=I(5),M=I(61),Z=I(62),q=I(63),se=I(64),ue=I(65),J=typeof window!="undefined"?window.document:null,z=function(X){function B(G){G===void 0&&(G={});var W=X.call(this,G)||this;return W.browser=c,W._keyDownHandled=!1,W._onCursorMove=new A.EventEmitter,W._onKey=new A.EventEmitter,W._onRender=new A.EventEmitter,W._onSelectionChange=new A.EventEmitter,W._onTitleChange=new A.EventEmitter,W._onFocus=new A.EventEmitter,W._onBlur=new A.EventEmitter,W._onA11yCharEmitter=new A.EventEmitter,W._onA11yTabEmitter=new A.EventEmitter,W._setup(),W.linkifier=W._instantiationService.createInstance(y.Linkifier),W.linkifier2=W.register(W._instantiationService.createInstance(q.Linkifier2)),W.register(W._inputHandler.onRequestBell(function(){return W.bell()})),W.register(W._inputHandler.onRequestRefreshRows(function(k,C){return W.refresh(k,C)})),W.register(W._inputHandler.onRequestReset(function(){return W.reset()})),W.register(W._inputHandler.onRequestScroll(function(k,C){return W.scroll(k,C||void 0)})),W.register(W._inputHandler.onRequestWindowsOptionsReport(function(k){return W._reportWindowsOptions(k)})),W.register(A.forwardEvent(W._inputHandler.onCursorMove,W._onCursorMove)),W.register(A.forwardEvent(W._inputHandler.onTitleChange,W._onTitleChange)),W.register(A.forwardEvent(W._inputHandler.onA11yChar,W._onA11yCharEmitter)),W.register(A.forwardEvent(W._inputHandler.onA11yTab,W._onA11yTabEmitter)),W.register(W._bufferService.onResize(function(k){return W._afterResize(k.cols,k.rows)})),W}return K(B,X),Object.defineProperty(B.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),B.prototype.dispose=function(){var G,W,k;this._isDisposed||(X.prototype.dispose.call(this),(G=this._renderService)===null||G===void 0||G.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},(k=(W=this.element)===null||W===void 0?void 0:W.parentNode)===null||k===void 0||k.removeChild(this.element))},B.prototype._setup=function(){X.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(B.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),B.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},B.prototype._updateOptions=function(G){var W,k,C,V;switch(X.prototype._updateOptions.call(this,G),G){case"fontFamily":case"fontSize":(W=this._renderService)===null||W===void 0||W.clear(),(k=this._charSizeService)===null||k===void 0||k.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":(C=this.viewport)===null||C===void 0||C.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new T.AccessibilityManager(this,this._renderService)):((V=this._accessibilityManager)===null||V===void 0||V.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},B.prototype._onTextAreaFocus=function(G){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(F.C0.ESC+"[I"),this.updateCursorStyle(G),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},B.prototype.blur=function(){var G;return(G=this.textarea)===null||G===void 0?void 0:G.blur()},B.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(F.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},B.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var G=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),W=this._bufferService.buffer.y*G,k=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=k+"px",this.textarea.style.top=W+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=G+"px",this.textarea.style.lineHeight=G+"px",this.textarea.style.zIndex="-5"}},B.prototype._initGlobal=function(){var G=this;this._bindKeys(),this.register(l.addDisposableDomListener(this.element,"copy",function(k){G.hasSelection()&&_.copyHandler(k,G._selectionService)}));var W=function(k){return _.handlePasteEvent(k,G.textarea,G._coreService)};this.register(l.addDisposableDomListener(this.textarea,"paste",W)),this.register(l.addDisposableDomListener(this.element,"paste",W)),c.isFirefox?this.register(l.addDisposableDomListener(this.element,"mousedown",function(k){k.button===2&&_.rightClickHandler(k,G.textarea,G.screenElement,G._selectionService,G.options.rightClickSelectsWord)})):this.register(l.addDisposableDomListener(this.element,"contextmenu",function(k){_.rightClickHandler(k,G.textarea,G.screenElement,G._selectionService,G.options.rightClickSelectsWord)})),c.isLinux&&this.register(l.addDisposableDomListener(this.element,"auxclick",function(k){k.button===1&&_.moveTextAreaUnderMouseCursor(k,G.textarea,G.screenElement)}))},B.prototype._bindKeys=function(){var G=this;this.register(l.addDisposableDomListener(this.textarea,"keyup",function(W){return G._keyUp(W)},!0)),this.register(l.addDisposableDomListener(this.textarea,"keydown",function(W){return G._keyDown(W)},!0)),this.register(l.addDisposableDomListener(this.textarea,"keypress",function(W){return G._keyPress(W)},!0)),this.register(l.addDisposableDomListener(this.textarea,"compositionstart",function(){return G._compositionHelper.compositionstart()})),this.register(l.addDisposableDomListener(this.textarea,"compositionupdate",function(W){return G._compositionHelper.compositionupdate(W)})),this.register(l.addDisposableDomListener(this.textarea,"compositionend",function(){return G._compositionHelper.compositionend()})),this.register(this.onRender(function(){return G._compositionHelper.updateCompositionElements()})),this.register(this.onRender(function(W){return G._queueLinkification(W.start,W.end)}))},B.prototype.open=function(G){var W=this;if(!G)throw new Error("Terminal requires a parent element.");J.body.contains(G)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=G.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),G.appendChild(this.element);var k=J.createDocumentFragment();this._viewportElement=J.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.appendChild(this._viewportElement),this._viewportScrollArea=J.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=J.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=J.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=J.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",h.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register(l.addDisposableDomListener(this.textarea,"focus",function(ne){return W._onTextAreaFocus(ne)})),this.register(l.addDisposableDomListener(this.textarea,"blur",function(){return W._onTextAreaBlur()})),this._helperContainer.appendChild(this.textarea);var C=this._instantiationService.createInstance(se.CoreBrowserService,this.textarea);this._instantiationService.setService($.ICoreBrowserService,C),this._charSizeService=this._instantiationService.createInstance(M.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService($.ICharSizeService,this._charSizeService),this._compositionView=J.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(D.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(k),this._theme=this.options.theme||this._theme,this._colorManager=new U.ColorManager(J,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(function(ne){return W._colorManager.onOptionsChange(ne)})),this._colorManager.setTheme(this._theme);var V=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(N.RenderService,V,this.rows,this.screenElement)),this._instantiationService.setService($.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange(function(ne){return W._onRender.fire(ne)})),this.onResize(function(ne){return W._renderService.resize(ne.cols,ne.rows)}),this._soundService=this._instantiationService.createInstance(d.SoundService),this._instantiationService.setService($.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(Z.MouseService),this._instantiationService.setService($.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(w.Viewport,function(ne,pe){return W.scrollLines(ne,pe)},this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(function(){return W.viewport.syncScrollArea()})),this.register(this.viewport),this.register(this.onCursorMove(function(){W._renderService.onCursorMove(),W._syncTextArea()})),this.register(this.onResize(function(){return W._renderService.onResize(W.cols,W.rows)})),this.register(this.onBlur(function(){return W._renderService.onBlur()})),this.register(this.onFocus(function(){return W._renderService.onFocus()})),this.register(this._renderService.onDimensionsChange(function(){return W.viewport.syncScrollArea()})),this._selectionService=this.register(this._instantiationService.createInstance(f.SelectionService,this.element,this.screenElement)),this._instantiationService.setService($.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(function(ne){return W.scrollLines(ne.amount,ne.suppressScrollEvent)})),this.register(this._selectionService.onSelectionChange(function(){return W._onSelectionChange.fire()})),this.register(this._selectionService.onRequestRedraw(function(ne){return W._renderService.onSelectionChanged(ne.start,ne.end,ne.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(ne){W.textarea.value=ne,W.textarea.focus(),W.textarea.select()})),this.register(this.onScroll(function(){W.viewport.syncScrollArea(),W._selectionService.refresh()})),this.register(l.addDisposableDomListener(this._viewportElement,"scroll",function(){return W._selectionService.refresh()})),this._mouseZoneManager=this._instantiationService.createInstance(E.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll(function(){return W._mouseZoneManager.clearAll()})),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(l.addDisposableDomListener(this.element,"mousedown",function(ne){return W._selectionService.onMouseDown(ne)})),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new T.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},B.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(s.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(L.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},B.prototype._setTheme=function(G){var W,k,C;this._theme=G,(W=this._colorManager)===null||W===void 0||W.setTheme(G),(k=this._renderService)===null||k===void 0||k.setColors(this._colorManager.colors),(C=this.viewport)===null||C===void 0||C.onThemeChange(this._colorManager.colors)},B.prototype.bindMouse=function(){var G=this,W=this,k=this.element;function C(me){var Ne,Be,Me=W._mouseService.getRawByteCoords(me,W.screenElement,W.cols,W.rows);if(!Me)return!1;switch(me.overrideType||me.type){case"mousemove":Be=32,me.buttons===void 0?(Ne=3,me.button!==void 0&&(Ne=me.button<3?me.button:3)):Ne=1&me.buttons?0:4&me.buttons?1:2&me.buttons?2:3;break;case"mouseup":Be=0,Ne=me.button<3?me.button:3;break;case"mousedown":Be=1,Ne=me.button<3?me.button:3;break;case"wheel":me.deltaY!==0&&(Be=me.deltaY<0?0:1),Ne=4;break;default:return!1}return!(Be===void 0||Ne===void 0||Ne>4)&&W._coreMouseService.triggerMouseEvent({col:Me.x-33,row:Me.y-33,button:Ne,action:Be,ctrl:me.ctrlKey,alt:me.altKey,shift:me.shiftKey})}var V={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ne=function(me){return C(me),me.buttons||(G._document.removeEventListener("mouseup",V.mouseup),V.mousedrag&&G._document.removeEventListener("mousemove",V.mousedrag)),G.cancel(me)},pe=function(me){return C(me),me.preventDefault(),G.cancel(me)},Ce=function(me){me.buttons&&C(me)},We=function(me){me.buttons||C(me)};this.register(this._coreMouseService.onProtocolChange(function(me){me?(G.optionsService.options.logLevel==="debug"&&G._logService.debug("Binding to mouse events:",G._coreMouseService.explainEvents(me)),G.element.classList.add("enable-mouse-events"),G._selectionService.disable()):(G._logService.debug("Unbinding from mouse events."),G.element.classList.remove("enable-mouse-events"),G._selectionService.enable()),8&me?V.mousemove||(k.addEventListener("mousemove",We),V.mousemove=We):(k.removeEventListener("mousemove",V.mousemove),V.mousemove=null),16&me?V.wheel||(k.addEventListener("wheel",pe,{passive:!1}),V.wheel=pe):(k.removeEventListener("wheel",V.wheel),V.wheel=null),2&me?V.mouseup||(V.mouseup=ne):(G._document.removeEventListener("mouseup",V.mouseup),V.mouseup=null),4&me?V.mousedrag||(V.mousedrag=Ce):(G._document.removeEventListener("mousemove",V.mousedrag),V.mousedrag=null)})),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(l.addDisposableDomListener(k,"mousedown",function(me){if(me.preventDefault(),G.focus(),G._coreMouseService.areMouseEventsActive&&!G._selectionService.shouldForceSelection(me))return C(me),V.mouseup&&G._document.addEventListener("mouseup",V.mouseup),V.mousedrag&&G._document.addEventListener("mousemove",V.mousedrag),G.cancel(me)})),this.register(l.addDisposableDomListener(k,"wheel",function(me){if(!V.wheel){if(!G.buffer.hasScrollback){var Ne=G.viewport.getLinesScrolled(me);if(Ne===0)return;for(var Be=F.C0.ESC+(G._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(me.deltaY<0?"A":"B"),Me="",wt=0;wt<Math.abs(Ne);wt++)Me+=Be;G._coreService.triggerDataEvent(Me,!0)}}},{passive:!0})),this.register(l.addDisposableDomListener(k,"wheel",function(me){if(!V.wheel)return G.viewport.onWheel(me)?void 0:G.cancel(me)},{passive:!1})),this.register(l.addDisposableDomListener(k,"touchstart",function(me){if(!G._coreMouseService.areMouseEventsActive)return G.viewport.onTouchStart(me),G.cancel(me)},{passive:!0})),this.register(l.addDisposableDomListener(k,"touchmove",function(me){if(!G._coreMouseService.areMouseEventsActive)return G.viewport.onTouchMove(me)?void 0:G.cancel(me)},{passive:!1}))},B.prototype.refresh=function(G,W){var k;(k=this._renderService)===null||k===void 0||k.refreshRows(G,W)},B.prototype._queueLinkification=function(G,W){var k;(k=this.linkifier)===null||k===void 0||k.linkifyRows(G,W)},B.prototype.updateCursorStyle=function(G){this._selectionService&&this._selectionService.shouldColumnSelect(G)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},B.prototype._showCursor=function(){this._coreService.isCursorInitialized||(this._coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},B.prototype.scrollLines=function(G,W){X.prototype.scrollLines.call(this,G,W),this.refresh(0,this.rows-1)},B.prototype.paste=function(G){_.paste(G,this.textarea,this._coreService)},B.prototype.attachCustomKeyEventHandler=function(G){this._customKeyEventHandler=G},B.prototype.registerLinkMatcher=function(G,W,k){var C=this.linkifier.registerLinkMatcher(G,W,k);return this.refresh(0,this.rows-1),C},B.prototype.deregisterLinkMatcher=function(G){this.linkifier.deregisterLinkMatcher(G)&&this.refresh(0,this.rows-1)},B.prototype.registerLinkProvider=function(G){return this.linkifier2.registerLinkProvider(G)},B.prototype.registerCharacterJoiner=function(G){var W=this._renderService.registerCharacterJoiner(G);return this.refresh(0,this.rows-1),W},B.prototype.deregisterCharacterJoiner=function(G){this._renderService.deregisterCharacterJoiner(G)&&this.refresh(0,this.rows-1)},Object.defineProperty(B.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!1,configurable:!0}),B.prototype.addMarker=function(G){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+G)},B.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},B.prototype.select=function(G,W,k){this._selectionService.setSelection(G,W,k)},B.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},B.prototype.getSelectionPosition=function(){if(this._selectionService&&this._selectionService.hasSelection)return{startColumn:this._selectionService.selectionStart[0],startRow:this._selectionService.selectionStart[1],endColumn:this._selectionService.selectionEnd[0],endRow:this._selectionService.selectionEnd[1]}},B.prototype.clearSelection=function(){var G;(G=this._selectionService)===null||G===void 0||G.clearSelection()},B.prototype.selectAll=function(){var G;(G=this._selectionService)===null||G===void 0||G.selectAll()},B.prototype.selectLines=function(G,W){var k;(k=this._selectionService)===null||k===void 0||k.selectLines(G,W)},B.prototype._keyDown=function(G){if(this._keyDownHandled=!1,this._customKeyEventHandler&&this._customKeyEventHandler(G)===!1)return!1;if(!this._compositionHelper.keydown(G))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var W=x.evaluateKeyboardEvent(G,this._coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(G),W.type===3||W.type===2){var k=this.rows-1;return this.scrollLines(W.type===2?-k:k),this.cancel(G,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,G)||(W.cancel&&this.cancel(G,!0),!W.key||(W.key!==F.C0.ETX&&W.key!==F.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:G}),this._showCursor(),this._coreService.triggerDataEvent(W.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(G,!0)))},B.prototype._isThirdLevelShift=function(G,W){var k=G.isMac&&!this.options.macOptionIsMeta&&W.altKey&&!W.ctrlKey&&!W.metaKey||G.isWindows&&W.altKey&&W.ctrlKey&&!W.metaKey;return W.type==="keypress"?k:k&&(!W.keyCode||W.keyCode>47)},B.prototype._keyUp=function(G){this._customKeyEventHandler&&this._customKeyEventHandler(G)===!1||(function(W){return W.keyCode===16||W.keyCode===17||W.keyCode===18}(G)||this.focus(),this.updateCursorStyle(G))},B.prototype._keyPress=function(G){var W;if(this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(G)===!1)return!1;if(this.cancel(G),G.charCode)W=G.charCode;else if(G.which===null||G.which===void 0)W=G.keyCode;else{if(G.which===0||G.charCode===0)return!1;W=G.which}return!(!W||(G.altKey||G.ctrlKey||G.metaKey)&&!this._isThirdLevelShift(this.browser,G))&&(W=String.fromCharCode(W),this._onKey.fire({key:W,domEvent:G}),this._showCursor(),this._coreService.triggerDataEvent(W,!0),!0)},B.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},B.prototype.resize=function(G,W){G!==this.cols||W!==this.rows?X.prototype.resize.call(this,G,W):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},B.prototype._afterResize=function(G,W){var k,C;(k=this._charSizeService)===null||k===void 0||k.measure(),(C=this.viewport)===null||C===void 0||C.syncScrollArea(!0)},B.prototype.clear=function(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var G=1;G<this.rows;G++)this.buffer.lines.push(this.buffer.getBlankLine(O.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire(this.buffer.ydisp)}},B.prototype.reset=function(){var G,W;this.options.rows=this.rows,this.options.cols=this.cols;var k=this._customKeyEventHandler;this._setup(),X.prototype.reset.call(this),(G=this._selectionService)===null||G===void 0||G.reset(),this._customKeyEventHandler=k,this.refresh(0,this.rows-1),(W=this.viewport)===null||W===void 0||W.syncScrollArea()},B.prototype._reportWindowsOptions=function(G){if(this._renderService)switch(G){case v.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var W=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),k=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this._coreService.triggerDataEvent(F.C0.ESC+"[4;"+k+";"+W+"t");break;case v.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var C=this._renderService.dimensions.scaledCellWidth.toFixed(0),V=this._renderService.dimensions.scaledCellHeight.toFixed(0);this._coreService.triggerDataEvent(F.C0.ESC+"[6;"+V+";"+C+"t")}},B.prototype.cancel=function(G,W){if(this.options.cancelEvents||W)return G.preventDefault(),G.stopPropagation(),!1},B.prototype._visualBell=function(){return!1},B.prototype._soundBell=function(){return this.options.bellStyle==="sound"},B}(ue.CoreTerminal);b.Terminal=z},function(ge,b,I){"use strict";var P=this&&this.__decorate||function(F,v,s,y){var f,c=arguments.length,l=c<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,s):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(F,v,s,y);else for(var h=F.length-1;h>=0;h--)(f=F[h])&&(l=(c<3?f(l):c>3?f(v,s,l):f(v,s))||l);return c>3&&l&&Object.defineProperty(v,s,l),l},K=this&&this.__param||function(F,v){return function(s,y){v(s,y,F)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CompositionHelper=void 0;var D=I(5),w=I(1),_=function(){function F(v,s,y,f,c,l){this._textarea=v,this._compositionView=s,this._bufferService=y,this._optionsService=f,this._charSizeService=c,this._coreService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0}}return Object.defineProperty(F.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),F.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._compositionView.classList.add("active")},F.prototype.compositionupdate=function(v){var s=this;this._compositionView.textContent=v.data,this.updateCompositionElements(),setTimeout(function(){s._compositionPosition.end=s._textarea.value.length},0)},F.prototype.compositionend=function(){this._finalizeComposition(!0)},F.prototype.keydown=function(v){if(this._isComposing||this._isSendingComposition){if(v.keyCode===229||v.keyCode===16||v.keyCode===17||v.keyCode===18)return!1;this._finalizeComposition(!1)}return v.keyCode!==229||(this._handleAnyTextareaChanges(),!1)},F.prototype._finalizeComposition=function(v){var s=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,v){var y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(function(){if(s._isSendingComposition){s._isSendingComposition=!1;var c=void 0;c=s._isComposing?s._textarea.value.substring(y.start,y.end):s._textarea.value.substring(y.start),s._coreService.triggerDataEvent(c,!0)}},0)}else{this._isSendingComposition=!1;var f=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(f,!0)}},F.prototype._handleAnyTextareaChanges=function(){var v=this,s=this._textarea.value;setTimeout(function(){if(!v._isComposing){var y=v._textarea.value.replace(s,"");y.length>0&&v._coreService.triggerDataEvent(y,!0)}},0)},F.prototype.updateCompositionElements=function(v){var s=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var y=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),f=this._bufferService.buffer.y*y,c=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=c+"px",this._compositionView.style.top=f+"px",this._compositionView.style.height=y+"px",this._compositionView.style.lineHeight=y+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var l=this._compositionView.getBoundingClientRect();this._textarea.style.left=c+"px",this._textarea.style.top=f+"px",this._textarea.style.width=l.width+"px",this._textarea.style.height=l.height+"px",this._textarea.style.lineHeight=l.height+"px"}v||setTimeout(function(){return s.updateCompositionElements(!0)},0)}},F=P([K(2,w.IBufferService),K(3,w.IOptionsService),K(4,D.ICharSizeService),K(5,w.ICoreService)],F)}();b.CompositionHelper=_},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Viewport=void 0;var _=I(2),F=I(7),v=I(5),s=I(1),y=function(f){function c(l,h,d,E,T,L,x){var A=f.call(this)||this;return A._scrollLines=l,A._viewportElement=h,A._scrollArea=d,A._bufferService=E,A._optionsService=T,A._charSizeService=L,A._renderService=x,A.scrollBarWidth=0,A._currentRowHeight=0,A._lastRecordedBufferLength=0,A._lastRecordedViewportHeight=0,A._lastRecordedBufferHeight=0,A._lastTouchY=0,A._lastScrollTop=0,A._wheelPartialScroll=0,A._refreshAnimationFrame=null,A._ignoreNextScrollEvent=!1,A.scrollBarWidth=A._viewportElement.offsetWidth-A._scrollArea.offsetWidth||15,A.register(F.addDisposableDomListener(A._viewportElement,"scroll",A._onScroll.bind(A))),setTimeout(function(){return A.syncScrollArea()},0),A}return K(c,f),c.prototype.onThemeChange=function(l){this._viewportElement.style.backgroundColor=l.background.css},c.prototype._refresh=function(l){var h=this;if(l)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return h._innerRefresh()}))},c.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var h=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==h&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=h),this._refreshAnimationFrame=null},c.prototype.syncScrollArea=function(l){if(l===void 0&&(l=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(l);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var h=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===h&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(l)}else this._refresh(l)},c.prototype._onScroll=function(l){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var h=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(h,!0)}},c.prototype._bubbleScroll=function(l,h){var d=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&d<this._lastRecordedBufferHeight)||(l.cancelable&&l.preventDefault(),!1)},c.prototype.onWheel=function(l){var h=this._getPixelsScrolled(l);return h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(l,h))},c.prototype._getPixelsScrolled=function(l){if(l.deltaY===0)return 0;var h=this._applyScrollModifier(l.deltaY,l);return l.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:l.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h},c.prototype.getLinesScrolled=function(l){if(l.deltaY===0)return 0;var h=this._applyScrollModifier(l.deltaY,l);return l.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(h/=this._currentRowHeight+0,this._wheelPartialScroll+=h,h=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):l.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h},c.prototype._applyScrollModifier=function(l,h){var d=this._optionsService.options.fastScrollModifier;return d==="alt"&&h.altKey||d==="ctrl"&&h.ctrlKey||d==="shift"&&h.shiftKey?l*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:l*this._optionsService.options.scrollSensitivity},c.prototype.onTouchStart=function(l){this._lastTouchY=l.touches[0].pageY},c.prototype.onTouchMove=function(l){var h=this._lastTouchY-l.touches[0].pageY;return this._lastTouchY=l.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(l,h))},c=D([w(3,s.IBufferService),w(4,s.IOptionsService),w(5,v.ICharSizeService),w(6,v.IRenderService)],c)}(_.Disposable);b.Viewport=y},function(ge,b,I){"use strict";function P(_){return _.replace(/\r?\n/g,"\r")}function K(_,F){return F?"\x1B[200~"+_+"\x1B[201~":_}function D(_,F,v){_=K(_=P(_),v.decPrivateModes.bracketedPasteMode),v.triggerDataEvent(_,!0),F.value=""}function w(_,F,v){var s=v.getBoundingClientRect(),y=_.clientX-s.left-10,f=_.clientY-s.top-10;F.style.width="20px",F.style.height="20px",F.style.left=y+"px",F.style.top=f+"px",F.style.zIndex="1000",F.focus()}Object.defineProperty(b,"__esModule",{value:!0}),b.rightClickHandler=b.moveTextAreaUnderMouseCursor=b.paste=b.handlePasteEvent=b.copyHandler=b.bracketTextForPaste=b.prepareTextForTerminal=void 0,b.prepareTextForTerminal=P,b.bracketTextForPaste=K,b.copyHandler=function(_,F){_.clipboardData&&_.clipboardData.setData("text/plain",F.selectionText),_.preventDefault()},b.handlePasteEvent=function(_,F,v){_.stopPropagation(),_.clipboardData&&D(_.clipboardData.getData("text/plain"),F,v)},b.paste=D,b.moveTextAreaUnderMouseCursor=w,b.rightClickHandler=function(_,F,v,s,y){w(_,F,v),y&&!s.isClickInSelection(_)&&s.selectWordAtCursor(_),F.value=s.selectionText,F.select()}},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)});Object.defineProperty(b,"__esModule",{value:!0}),b.EscapeSequenceParser=b.VT500_TRANSITION_TABLE=b.TransitionTable=void 0;var D=I(2),w=I(15),_=I(21),F=I(22),v=I(24),s=function(){function f(c){this.table=new Uint8Array(c)}return f.prototype.setDefault=function(c,l){w.fill(this.table,c<<4|l)},f.prototype.add=function(c,l,h,d){this.table[l<<8|c]=h<<4|d},f.prototype.addMany=function(c,l,h,d){for(var E=0;E<c.length;E++)this.table[l<<8|c[E]]=h<<4|d},f}();b.TransitionTable=s,b.VT500_TRANSITION_TABLE=function(){var f=new s(4095),c=Array.apply(null,Array(256)).map(function(L,x){return x}),l=function(L,x){return c.slice(L,x)},h=l(32,127),d=l(0,24);d.push(25),d.push.apply(d,l(28,32));var E,T=l(0,14);for(E in f.setDefault(1,0),f.addMany(h,0,2,0),T)f.addMany([24,26,153,154],E,3,0),f.addMany(l(128,144),E,3,0),f.addMany(l(144,152),E,3,0),f.add(156,E,0,0),f.add(27,E,11,1),f.add(157,E,4,8),f.addMany([152,158,159],E,0,7),f.add(155,E,11,3),f.add(144,E,11,9);return f.addMany(d,0,3,0),f.addMany(d,1,3,1),f.add(127,1,0,1),f.addMany(d,8,0,8),f.addMany(d,3,3,3),f.add(127,3,0,3),f.addMany(d,4,3,4),f.add(127,4,0,4),f.addMany(d,6,3,6),f.addMany(d,5,3,5),f.add(127,5,0,5),f.addMany(d,2,3,2),f.add(127,2,0,2),f.add(93,1,4,8),f.addMany(h,8,5,8),f.add(127,8,5,8),f.addMany([156,27,24,26,7],8,6,0),f.addMany(l(28,32),8,0,8),f.addMany([88,94,95],1,0,7),f.addMany(h,7,0,7),f.addMany(d,7,0,7),f.add(156,7,0,0),f.add(127,7,0,7),f.add(91,1,11,3),f.addMany(l(64,127),3,7,0),f.addMany(l(48,60),3,8,4),f.addMany([60,61,62,63],3,9,4),f.addMany(l(48,60),4,8,4),f.addMany(l(64,127),4,7,0),f.addMany([60,61,62,63],4,0,6),f.addMany(l(32,64),6,0,6),f.add(127,6,0,6),f.addMany(l(64,127),6,0,0),f.addMany(l(32,48),3,9,5),f.addMany(l(32,48),5,9,5),f.addMany(l(48,64),5,0,6),f.addMany(l(64,127),5,7,0),f.addMany(l(32,48),4,9,5),f.addMany(l(32,48),1,9,2),f.addMany(l(32,48),2,9,2),f.addMany(l(48,127),2,10,0),f.addMany(l(48,80),1,10,0),f.addMany(l(81,88),1,10,0),f.addMany([89,90,92],1,10,0),f.addMany(l(96,127),1,10,0),f.add(80,1,11,9),f.addMany(d,9,0,9),f.add(127,9,0,9),f.addMany(l(28,32),9,0,9),f.addMany(l(32,48),9,9,12),f.addMany(l(48,60),9,8,10),f.addMany([60,61,62,63],9,9,10),f.addMany(d,11,0,11),f.addMany(l(32,128),11,0,11),f.addMany(l(28,32),11,0,11),f.addMany(d,10,0,10),f.add(127,10,0,10),f.addMany(l(28,32),10,0,10),f.addMany(l(48,60),10,8,10),f.addMany([60,61,62,63],10,0,11),f.addMany(l(32,48),10,9,12),f.addMany(d,12,0,12),f.add(127,12,0,12),f.addMany(l(28,32),12,0,12),f.addMany(l(32,48),12,9,12),f.addMany(l(48,64),12,0,11),f.addMany(l(64,127),12,12,13),f.addMany(l(64,127),10,12,13),f.addMany(l(64,127),9,12,13),f.addMany(d,13,13,13),f.addMany(h,13,13,13),f.add(127,13,0,13),f.addMany([27,156,24,26],13,14,0),f.add(160,0,2,0),f.add(160,8,5,8),f.add(160,6,0,6),f.add(160,11,0,11),f.add(160,13,13,13),f}();var y=function(f){function c(l){l===void 0&&(l=b.VT500_TRANSITION_TABLE);var h=f.call(this)||this;return h._transitions=l,h.initialState=0,h.currentState=h.initialState,h._params=new _.Params,h._params.addParam(0),h._collect=0,h.precedingCodepoint=0,h._printHandlerFb=function(d,E,T){},h._executeHandlerFb=function(d){},h._csiHandlerFb=function(d,E){},h._escHandlerFb=function(d){},h._errorHandlerFb=function(d){return d},h._printHandler=h._printHandlerFb,h._executeHandlers=Object.create(null),h._csiHandlers=Object.create(null),h._escHandlers=Object.create(null),h._oscParser=new F.OscParser,h._dcsParser=new v.DcsParser,h._errorHandler=h._errorHandlerFb,h.setEscHandler({final:"\\"},function(){}),h}return K(c,f),c.prototype._identifier=function(l,h){h===void 0&&(h=[64,126]);var d=0;if(l.prefix){if(l.prefix.length>1)throw new Error("only one byte as prefix supported");if((d=l.prefix.charCodeAt(0))&&60>d||d>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(l.intermediates){if(l.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var E=0;E<l.intermediates.length;++E){var T=l.intermediates.charCodeAt(E);if(32>T||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");d<<=8,d|=T}}if(l.final.length!==1)throw new Error("final must be a single byte");var L=l.final.charCodeAt(0);if(h[0]>L||L>h[1])throw new Error("final must be in range "+h[0]+" .. "+h[1]);return d<<=8,d|=L},c.prototype.identToString=function(l){for(var h=[];l;)h.push(String.fromCharCode(255&l)),l>>=8;return h.reverse().join("")},c.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},c.prototype.setPrintHandler=function(l){this._printHandler=l},c.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},c.prototype.addEscHandler=function(l,h){var d=this._identifier(l,[48,126]);this._escHandlers[d]===void 0&&(this._escHandlers[d]=[]);var E=this._escHandlers[d];return E.push(h),{dispose:function(){var T=E.indexOf(h);T!==-1&&E.splice(T,1)}}},c.prototype.setEscHandler=function(l,h){this._escHandlers[this._identifier(l,[48,126])]=[h]},c.prototype.clearEscHandler=function(l){this._escHandlers[this._identifier(l,[48,126])]&&delete this._escHandlers[this._identifier(l,[48,126])]},c.prototype.setEscHandlerFallback=function(l){this._escHandlerFb=l},c.prototype.setExecuteHandler=function(l,h){this._executeHandlers[l.charCodeAt(0)]=h},c.prototype.clearExecuteHandler=function(l){this._executeHandlers[l.charCodeAt(0)]&&delete this._executeHandlers[l.charCodeAt(0)]},c.prototype.setExecuteHandlerFallback=function(l){this._executeHandlerFb=l},c.prototype.addCsiHandler=function(l,h){var d=this._identifier(l);this._csiHandlers[d]===void 0&&(this._csiHandlers[d]=[]);var E=this._csiHandlers[d];return E.push(h),{dispose:function(){var T=E.indexOf(h);T!==-1&&E.splice(T,1)}}},c.prototype.setCsiHandler=function(l,h){this._csiHandlers[this._identifier(l)]=[h]},c.prototype.clearCsiHandler=function(l){this._csiHandlers[this._identifier(l)]&&delete this._csiHandlers[this._identifier(l)]},c.prototype.setCsiHandlerFallback=function(l){this._csiHandlerFb=l},c.prototype.addDcsHandler=function(l,h){return this._dcsParser.addHandler(this._identifier(l),h)},c.prototype.setDcsHandler=function(l,h){this._dcsParser.setHandler(this._identifier(l),h)},c.prototype.clearDcsHandler=function(l){this._dcsParser.clearHandler(this._identifier(l))},c.prototype.setDcsHandlerFallback=function(l){this._dcsParser.setHandlerFallback(l)},c.prototype.addOscHandler=function(l,h){return this._oscParser.addHandler(l,h)},c.prototype.setOscHandler=function(l,h){this._oscParser.setHandler(l,h)},c.prototype.clearOscHandler=function(l){this._oscParser.clearHandler(l)},c.prototype.setOscHandlerFallback=function(l){this._oscParser.setHandlerFallback(l)},c.prototype.setErrorHandler=function(l){this._errorHandler=l},c.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},c.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0},c.prototype.parse=function(l,h){for(var d=0,E=0,T=this.currentState,L=this._oscParser,x=this._dcsParser,A=this._collect,O=this._params,U=this._transitions.table,N=0;N<h;++N){switch((E=U[T<<8|((d=l[N])<160?d:160)])>>4){case 2:for(var $=N+1;;++$){if($>=h||(d=l[$])<32||d>126&&d<160){this._printHandler(l,N,$),N=$-1;break}if(++$>=h||(d=l[$])<32||d>126&&d<160){this._printHandler(l,N,$),N=$-1;break}if(++$>=h||(d=l[$])<32||d>126&&d<160){this._printHandler(l,N,$),N=$-1;break}if(++$>=h||(d=l[$])<32||d>126&&d<160){this._printHandler(l,N,$),N=$-1;break}}break;case 3:this._executeHandlers[d]?this._executeHandlers[d]():this._executeHandlerFb(d),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:N,code:d,currentState:T,collect:A,params:O,abort:!1}).abort)return;break;case 7:for(var M=this._csiHandlers[A<<8|d],Z=M?M.length-1:-1;Z>=0&&M[Z](O)===!1;Z--);Z<0&&this._csiHandlerFb(A<<8|d,O),this.precedingCodepoint=0;break;case 8:do switch(d){case 59:O.addParam(0);break;case 58:O.addSubParam(-1);break;default:O.addDigit(d-48)}while(++N<h&&(d=l[N])>47&&d<60);N--;break;case 9:A<<=8,A|=d;break;case 10:for(var q=this._escHandlers[A<<8|d],se=q?q.length-1:-1;se>=0&&q[se]()===!1;se--);se<0&&this._escHandlerFb(A<<8|d),this.precedingCodepoint=0;break;case 11:O.reset(),O.addParam(0),A=0;break;case 12:x.hook(A<<8|d,O);break;case 13:for(var ue=N+1;;++ue)if(ue>=h||(d=l[ue])===24||d===26||d===27||d>127&&d<160){x.put(l,N,ue),N=ue-1;break}break;case 14:x.unhook(d!==24&&d!==26),d===27&&(E|=1),O.reset(),O.addParam(0),A=0,this.precedingCodepoint=0;break;case 4:L.start();break;case 5:for(var J=N+1;;J++)if(J>=h||(d=l[J])<32||d>127&&d<=159){L.put(l,N,J),N=J-1;break}break;case 6:L.end(d!==24&&d!==26),d===27&&(E|=1),O.reset(),O.addParam(0),A=0,this.precedingCodepoint=0}T=15&E}this._collect=A,this.currentState=T},c}(D.Disposable);b.EscapeSequenceParser=y},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(L,x){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,O){A.__proto__=O}||function(A,O){for(var U in O)O.hasOwnProperty(U)&&(A[U]=O[U])})(L,x)},function(L,x){function A(){this.constructor=L}P(L,x),L.prototype=x===null?Object.create(x):(A.prototype=x.prototype,new A)}),D=this&&this.__decorate||function(L,x,A,O){var U,N=arguments.length,$=N<3?x:O===null?O=Object.getOwnPropertyDescriptor(x,A):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(L,x,A,O);else for(var M=L.length-1;M>=0;M--)(U=L[M])&&($=(N<3?U($):N>3?U(x,A,$):U(x,A))||$);return N>3&&$&&Object.defineProperty(x,A,$),$},w=this&&this.__param||function(L,x){return function(A,O){x(A,O,L)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Renderer=void 0;var _=I(41),F=I(47),v=I(48),s=I(49),y=I(29),f=I(2),c=I(5),l=I(1),h=I(25),d=I(0),E=1,T=function(L){function x(A,O,U,N,$,M,Z,q,se){var ue=L.call(this)||this;ue._colors=A,ue._screenElement=O,ue._bufferService=$,ue._charSizeService=M,ue._optionsService=Z,ue._id=E++,ue._onRequestRedraw=new d.EventEmitter;var J=ue._optionsService.options.allowTransparency;return ue._characterJoinerRegistry=new y.CharacterJoinerRegistry(ue._bufferService),ue._renderLayers=[new _.TextRenderLayer(ue._screenElement,0,ue._colors,ue._characterJoinerRegistry,J,ue._id,ue._bufferService,Z),new F.SelectionRenderLayer(ue._screenElement,1,ue._colors,ue._id,ue._bufferService,Z),new s.LinkRenderLayer(ue._screenElement,2,ue._colors,ue._id,U,N,ue._bufferService,Z),new v.CursorRenderLayer(ue._screenElement,3,ue._colors,ue._id,ue._onRequestRedraw,ue._bufferService,Z,q,se)],ue.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},ue._devicePixelRatio=window.devicePixelRatio,ue._updateDimensions(),ue.onOptionsChanged(),ue}return K(x,L),Object.defineProperty(x.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),x.prototype.dispose=function(){for(var A=0,O=this._renderLayers;A<O.length;A++)O[A].dispose();L.prototype.dispose.call(this),h.removeTerminalFromCache(this._id)},x.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},x.prototype.setColors=function(A){this._colors=A;for(var O=0,U=this._renderLayers;O<U.length;O++){var N=U[O];N.setColors(this._colors),N.reset()}},x.prototype.onResize=function(A,O){this._updateDimensions();for(var U=0,N=this._renderLayers;U<N.length;U++)N[U].resize(this.dimensions);this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},x.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},x.prototype.onBlur=function(){this._runOperation(function(A){return A.onBlur()})},x.prototype.onFocus=function(){this._runOperation(function(A){return A.onFocus()})},x.prototype.onSelectionChanged=function(A,O,U){U===void 0&&(U=!1),this._runOperation(function(N){return N.onSelectionChanged(A,O,U)})},x.prototype.onCursorMove=function(){this._runOperation(function(A){return A.onCursorMove()})},x.prototype.onOptionsChanged=function(){this._runOperation(function(A){return A.onOptionsChanged()})},x.prototype.clear=function(){this._runOperation(function(A){return A.reset()})},x.prototype._runOperation=function(A){for(var O=0,U=this._renderLayers;O<U.length;O++)A(U[O])},x.prototype.renderRows=function(A,O){for(var U=0,N=this._renderLayers;U<N.length;U++)N[U].onGridChanged(A,O)},x.prototype._updateDimensions=function(){this._charSizeService.hasValidSize&&(this.dimensions.scaledCharWidth=Math.floor(this._charSizeService.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharTop=this._optionsService.options.lineHeight===1?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._optionsService.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._bufferService.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._bufferService.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols)},x.prototype.registerCharacterJoiner=function(A){return this._characterJoinerRegistry.registerCharacterJoiner(A)},x.prototype.deregisterCharacterJoiner=function(A){return this._characterJoinerRegistry.deregisterCharacterJoiner(A)},x=D([w(4,l.IBufferService),w(5,c.ICharSizeService),w(6,l.IOptionsService),w(7,l.ICoreService),w(8,c.ICoreBrowserService)],x)}(f.Disposable);b.Renderer=T},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)});Object.defineProperty(b,"__esModule",{value:!0}),b.TextRenderLayer=void 0;var D=I(42),w=I(13),_=I(6),F=I(3),v=I(29),s=I(4),y=function(f){function c(l,h,d,E,T,L,x,A){var O=f.call(this,l,"text",h,T,d,L,x,A)||this;return O._characterWidth=0,O._characterFont="",O._characterOverlapCache={},O._workCell=new s.CellData,O._state=new D.GridCache,O._characterJoinerRegistry=E,O}return K(c,f),c.prototype.resize=function(l){f.prototype.resize.call(this,l);var h=this._getFont(!1,!1);this._characterWidth===l.scaledCharWidth&&this._characterFont===h||(this._characterWidth=l.scaledCharWidth,this._characterFont=h,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},c.prototype.reset=function(){this._state.clear(),this._clearAll()},c.prototype._forEachCell=function(l,h,d,E){for(var T=l;T<=h;T++)for(var L=T+this._bufferService.buffer.ydisp,x=this._bufferService.buffer.lines.get(L),A=d?d.getJoinedCharacters(L):[],O=0;O<this._bufferService.cols;O++){x.loadCell(O,this._workCell);var U=this._workCell,N=!1,$=O;if(U.getWidth()!==0){if(A.length>0&&O===A[0][0]){N=!0;var M=A.shift();U=new v.JoinedCellData(this._workCell,x.translateToString(!0,M[0],M[1]),M[1]-M[0]),$=M[1]-1}!N&&this._isOverlapping(U)&&$<x.length-1&&x.getCodePoint($+1)===F.NULL_CELL_CODE&&(U.content&=-12582913,U.content|=2<<22),E(U,O,T),O=$}}},c.prototype._drawBackground=function(l,h){var d=this,E=this._ctx,T=this._bufferService.cols,L=0,x=0,A=null;E.save(),this._forEachCell(l,h,null,function(O,U,N){var $=null;O.isInverse()?$=O.isFgDefault()?d._colors.foreground.css:O.isFgRGB()?"rgb("+_.AttributeData.toColorRGB(O.getFgColor()).join(",")+")":d._colors.ansi[O.getFgColor()].css:O.isBgRGB()?$="rgb("+_.AttributeData.toColorRGB(O.getBgColor()).join(",")+")":O.isBgPalette()&&($=d._colors.ansi[O.getBgColor()].css),A===null&&(L=U,x=N),N!==x?(E.fillStyle=A||"",d._fillCells(L,x,T-L,1),L=U,x=N):A!==$&&(E.fillStyle=A||"",d._fillCells(L,x,U-L,1),L=U,x=N),A=$}),A!==null&&(E.fillStyle=A,this._fillCells(L,x,T-L,1)),E.restore()},c.prototype._drawForeground=function(l,h){var d=this;this._forEachCell(l,h,this._characterJoinerRegistry,function(E,T,L){if(!E.isInvisible()&&(d._drawChars(E,T,L),E.isUnderline())){if(d._ctx.save(),E.isInverse())if(E.isBgDefault())d._ctx.fillStyle=d._colors.background.css;else if(E.isBgRGB())d._ctx.fillStyle="rgb("+_.AttributeData.toColorRGB(E.getBgColor()).join(",")+")";else{var x=E.getBgColor();d._optionsService.options.drawBoldTextInBrightColors&&E.isBold()&&x<8&&(x+=8),d._ctx.fillStyle=d._colors.ansi[x].css}else if(E.isFgDefault())d._ctx.fillStyle=d._colors.foreground.css;else if(E.isFgRGB())d._ctx.fillStyle="rgb("+_.AttributeData.toColorRGB(E.getFgColor()).join(",")+")";else{var A=E.getFgColor();d._optionsService.options.drawBoldTextInBrightColors&&E.isBold()&&A<8&&(A+=8),d._ctx.fillStyle=d._colors.ansi[A].css}d._fillBottomLineAtCells(T,L,E.getWidth()),d._ctx.restore()}})},c.prototype.onGridChanged=function(l,h){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,l,this._bufferService.cols,h-l+1),this._drawBackground(l,h),this._drawForeground(l,h))},c.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},c.prototype._isOverlapping=function(l){if(l.getWidth()!==1||l.getCode()<256)return!1;var h=l.getChars();if(this._characterOverlapCache.hasOwnProperty(h))return this._characterOverlapCache[h];this._ctx.save(),this._ctx.font=this._characterFont;var d=Math.floor(this._ctx.measureText(h).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[h]=d,d},c}(w.BaseRenderLayer);b.TextRenderLayer=y},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GridCache=void 0;var P=function(){function K(){this.cache=[]}return K.prototype.resize=function(D,w){for(var _=0;_<D;_++){this.cache.length<=_&&this.cache.push([]);for(var F=this.cache[_].length;F<w;F++)this.cache[_].push(void 0);this.cache[_].length=w}this.cache.length=D},K.prototype.clear=function(){for(var D=0;D<this.cache.length;D++)for(var w=0;w<this.cache[D].length;w++)this.cache[D][w]=void 0},K}();b.GridCache=P},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(d,E){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,L){T.__proto__=L}||function(T,L){for(var x in L)L.hasOwnProperty(x)&&(T[x]=L[x])})(d,E)},function(d,E){function T(){this.constructor=d}P(d,E),d.prototype=E===null?Object.create(E):(T.prototype=E.prototype,new T)});Object.defineProperty(b,"__esModule",{value:!0}),b.NoneCharAtlas=b.DynamicCharAtlas=b.getGlyphCacheKey=void 0;var D=I(9),w=I(44),_=I(27),F=I(46),v=I(11),s=I(28),y=I(10),f={css:"rgba(0, 0, 0, 0)",rgba:0};function c(d){return d.code<<21|d.bg<<12|d.fg<<3|(d.bold?0:4)+(d.dim?0:2)+(d.italic?0:1)}b.getGlyphCacheKey=c;var l=function(d){function E(T,L){var x=d.call(this)||this;x._config=L,x._drawToCacheCount=0,x._glyphsWaitingOnBitmap=[],x._bitmapCommitTimeout=null,x._bitmap=null,x._cacheCanvas=T.createElement("canvas"),x._cacheCanvas.width=1024,x._cacheCanvas.height=1024,x._cacheCtx=s.throwIfFalsy(x._cacheCanvas.getContext("2d",{alpha:!0}));var A=T.createElement("canvas");A.width=x._config.scaledCharWidth,A.height=x._config.scaledCharHeight,x._tmpCtx=s.throwIfFalsy(A.getContext("2d",{alpha:x._config.allowTransparency})),x._width=Math.floor(1024/x._config.scaledCharWidth),x._height=Math.floor(1024/x._config.scaledCharHeight);var O=x._width*x._height;return x._cacheMap=new F.LRUMap(O),x._cacheMap.prealloc(O),x}return K(E,d),E.prototype.dispose=function(){this._bitmapCommitTimeout!==null&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},E.prototype.beginFrame=function(){this._drawToCacheCount=0},E.prototype.draw=function(T,L,x,A){if(L.code===32)return!0;if(!this._canCache(L))return!1;var O=c(L),U=this._cacheMap.get(O);if(U!=null)return this._drawFromCache(T,U,x,A),!0;if(this._drawToCacheCount<100){var N=void 0;N=this._cacheMap.size<this._cacheMap.capacity?this._cacheMap.size:this._cacheMap.peek().index;var $=this._drawToCache(L,N);return this._cacheMap.set(O,$),this._drawFromCache(T,$,x,A),!0}return!1},E.prototype._canCache=function(T){return T.code<256},E.prototype._toCoordinateX=function(T){return T%this._width*this._config.scaledCharWidth},E.prototype._toCoordinateY=function(T){return Math.floor(T/this._width)*this._config.scaledCharHeight},E.prototype._drawFromCache=function(T,L,x,A){if(!L.isEmpty){var O=this._toCoordinateX(L.index),U=this._toCoordinateY(L.index);T.drawImage(L.inBitmap?this._bitmap:this._cacheCanvas,O,U,this._config.scaledCharWidth,this._config.scaledCharHeight,x,A,this._config.scaledCharWidth,this._config.scaledCharHeight)}},E.prototype._getColorFromAnsiIndex=function(T){return T<this._config.colors.ansi.length?this._config.colors.ansi[T]:_.DEFAULT_ANSI_COLORS[T]},E.prototype._getBackgroundColor=function(T){return this._config.allowTransparency?f:T.bg===D.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:T.bg<256?this._getColorFromAnsiIndex(T.bg):this._config.colors.background},E.prototype._getForegroundColor=function(T){return T.fg===D.INVERTED_DEFAULT_COLOR?y.color.opaque(this._config.colors.background):T.fg<256?this._getColorFromAnsiIndex(T.fg):this._config.colors.foreground},E.prototype._drawToCache=function(T,L){this._drawToCacheCount++,this._tmpCtx.save();var x=this._getBackgroundColor(T);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),this._tmpCtx.globalCompositeOperation="source-over";var A=T.bold?this._config.fontWeightBold:this._config.fontWeight,O=T.italic?"italic":"";this._tmpCtx.font=O+" "+A+" "+this._config.fontSize*this._config.devicePixelRatio+"px "+this._config.fontFamily,this._tmpCtx.textBaseline="middle",this._tmpCtx.fillStyle=this._getForegroundColor(T).css,T.dim&&(this._tmpCtx.globalAlpha=D.DIM_OPACITY),this._tmpCtx.fillText(T.chars,0,this._config.scaledCharHeight/2),this._tmpCtx.restore();var U=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),N=!1;this._config.allowTransparency||(N=function(q,se){for(var ue=!0,J=se.rgba>>>24,z=se.rgba>>>16&255,X=se.rgba>>>8&255,B=0;B<q.data.length;B+=4)q.data[B]===J&&q.data[B+1]===z&&q.data[B+2]===X?q.data[B+3]=0:ue=!1;return ue}(U,x));var $=this._toCoordinateX(L),M=this._toCoordinateY(L);this._cacheCtx.putImageData(U,$,M);var Z={index:L,isEmpty:N,inBitmap:!1};return this._addGlyphToBitmap(Z),Z},E.prototype._addGlyphToBitmap=function(T){var L=this;!("createImageBitmap"in window)||v.isFirefox||v.isSafari||(this._glyphsWaitingOnBitmap.push(T),this._bitmapCommitTimeout===null&&(this._bitmapCommitTimeout=window.setTimeout(function(){return L._generateBitmap()},100)))},E.prototype._generateBitmap=function(){var T=this,L=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then(function(x){T._bitmap=x;for(var A=0;A<L.length;A++)L[A].inBitmap=!0}),this._bitmapCommitTimeout=null},E}(w.BaseCharAtlas);b.DynamicCharAtlas=l;var h=function(d){function E(T,L){return d.call(this)||this}return K(E,d),E.prototype.draw=function(T,L,x,A){return!1},E}(w.BaseCharAtlas);b.NoneCharAtlas=h},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BaseCharAtlas=void 0;var P=function(){function K(){this._didWarmUp=!1}return K.prototype.dispose=function(){},K.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},K.prototype._doWarmUp=function(){},K.prototype.beginFrame=function(){},K}();b.BaseCharAtlas=P},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ColorContrastCache=void 0;var P=function(){function K(){this._color={},this._rgba={}}return K.prototype.clear=function(){this._color={},this._rgba={}},K.prototype.setCss=function(D,w,_){this._rgba[D]||(this._rgba[D]={}),this._rgba[D][w]=_},K.prototype.getCss=function(D,w){return this._rgba[D]?this._rgba[D][w]:void 0},K.prototype.setColor=function(D,w,_){this._color[D]||(this._color[D]={}),this._color[D][w]=_},K.prototype.getColor=function(D,w){return this._color[D]?this._color[D][w]:void 0},K}();b.ColorContrastCache=P},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.LRUMap=void 0;var P=function(){function K(D){this.capacity=D,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return K.prototype._unlinkNode=function(D){var w=D.prev,_=D.next;D===this._head&&(this._head=_),D===this._tail&&(this._tail=w),w!==null&&(w.next=_),_!==null&&(_.prev=w)},K.prototype._appendNode=function(D){var w=this._tail;w!==null&&(w.next=D),D.prev=w,D.next=null,this._tail=D,this._head===null&&(this._head=D)},K.prototype.prealloc=function(D){for(var w=this._nodePool,_=0;_<D;_++)w.push({prev:null,next:null,key:null,value:null})},K.prototype.get=function(D){var w=this._map[D];return w!==void 0?(this._unlinkNode(w),this._appendNode(w),w.value):null},K.prototype.peekValue=function(D){var w=this._map[D];return w!==void 0?w.value:null},K.prototype.peek=function(){var D=this._head;return D===null?null:D.value},K.prototype.set=function(D,w){var _=this._map[D];if(_!==void 0)_=this._map[D],this._unlinkNode(_),_.value=w;else if(this.size>=this.capacity)_=this._head,this._unlinkNode(_),delete this._map[_.key],_.key=D,_.value=w,this._map[D]=_;else{var F=this._nodePool;F.length>0?((_=F.pop()).key=D,_.value=w):_={prev:null,next:null,key:D,value:w},this._map[D]=_,this.size++}this._appendNode(_)},K}();b.LRUMap=P},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(w,_){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,v){F.__proto__=v}||function(F,v){for(var s in v)v.hasOwnProperty(s)&&(F[s]=v[s])})(w,_)},function(w,_){function F(){this.constructor=w}P(w,_),w.prototype=_===null?Object.create(_):(F.prototype=_.prototype,new F)});Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionRenderLayer=void 0;var D=function(w){function _(F,v,s,y,f,c){var l=w.call(this,F,"selection",v,!0,s,y,f,c)||this;return l._clearState(),l}return K(_,w),_.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},_.prototype.resize=function(F){w.prototype.resize.call(this,F),this._clearState()},_.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},_.prototype.onSelectionChanged=function(F,v,s){if(this._didStateChange(F,v,s,this._bufferService.buffer.ydisp))if(this._clearAll(),F&&v){var y=F[1]-this._bufferService.buffer.ydisp,f=v[1]-this._bufferService.buffer.ydisp,c=Math.max(y,0),l=Math.min(f,this._bufferService.rows-1);if(!(c>=this._bufferService.rows||l<0)){if(this._ctx.fillStyle=this._colors.selectionTransparent.css,s){var h=F[0],d=v[0]-h,E=l-c+1;this._fillCells(h,c,d,E)}else{h=y===c?F[0]:0;var T=c===l?v[0]:this._bufferService.cols;this._fillCells(h,c,T-h,1);var L=Math.max(l-c-1,0);if(this._fillCells(0,c+1,this._bufferService.cols,L),c!==l){var x=f===l?v[0]:this._bufferService.cols;this._fillCells(0,l,x,1)}}this._state.start=[F[0],F[1]],this._state.end=[v[0],v[1]],this._state.columnSelectMode=s,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},_.prototype._didStateChange=function(F,v,s,y){return!this._areCoordinatesEqual(F,this._state.start)||!this._areCoordinatesEqual(v,this._state.end)||s!==this._state.columnSelectMode||y!==this._state.ydisp},_.prototype._areCoordinatesEqual=function(F,v){return!(!F||!v)&&F[0]===v[0]&&F[1]===v[1]},_}(I(13).BaseRenderLayer);b.SelectionRenderLayer=D},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(v,s){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,f){y.__proto__=f}||function(y,f){for(var c in f)f.hasOwnProperty(c)&&(y[c]=f[c])})(v,s)},function(v,s){function y(){this.constructor=v}P(v,s),v.prototype=s===null?Object.create(s):(y.prototype=s.prototype,new y)});Object.defineProperty(b,"__esModule",{value:!0}),b.CursorRenderLayer=void 0;var D=I(13),w=I(4),_=function(v){function s(y,f,c,l,h,d,E,T,L){var x=v.call(this,y,"cursor",f,!0,c,l,d,E)||this;return x._onRequestRedraw=h,x._coreService=T,x._coreBrowserService=L,x._cell=new w.CellData,x._state={x:0,y:0,isFocused:!1,style:"",width:0},x._cursorRenderers={bar:x._renderBarCursor.bind(x),block:x._renderBlockCursor.bind(x),underline:x._renderUnderlineCursor.bind(x)},x}return K(s,v),s.prototype.resize=function(y){v.prototype.resize.call(this,y),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},s.prototype.reset=function(){this._clearCursor(),this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0,this.onOptionsChanged())},s.prototype.onBlur=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},s.prototype.onFocus=function(){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume():this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},s.prototype.onOptionsChanged=function(){var y,f=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new F(this._coreBrowserService.isFocused,function(){f._render(!0)})):((y=this._cursorBlinkStateManager)===null||y===void 0||y.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},s.prototype.onCursorMove=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation()},s.prototype.onGridChanged=function(y,f){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},s.prototype._render=function(y){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var f=this._bufferService.buffer.ybase+this._bufferService.buffer.y,c=f-this._bufferService.buffer.ydisp;if(c<0||c>=this._bufferService.rows)this._clearCursor();else{var l=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(f).loadCell(l,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var h=this._optionsService.options.cursorStyle;return h&&h!=="block"?this._cursorRenderers[h](l,c,this._cell):this._renderBlurCursor(l,c,this._cell),this._ctx.restore(),this._state.x=l,this._state.y=c,this._state.isFocused=!1,this._state.style=h,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===l&&this._state.y===c&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](l,c,this._cell),this._ctx.restore(),this._state.x=l,this._state.y=c,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},s.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},s.prototype._renderBarCursor=function(y,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(y,f,this._optionsService.options.cursorWidth),this._ctx.restore()},s.prototype._renderBlockCursor=function(y,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(y,f,c.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(c,y,f),this._ctx.restore()},s.prototype._renderUnderlineCursor=function(y,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(y,f),this._ctx.restore()},s.prototype._renderBlurCursor=function(y,f,c){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(y,f,c.getWidth(),1),this._ctx.restore()},s}(D.BaseRenderLayer);b.CursorRenderLayer=_;var F=function(){function v(s,y){this._renderCallback=y,this.isCursorVisible=!0,s&&this._restartInterval()}return Object.defineProperty(v.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),v.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},v.prototype.restartBlinkAnimation=function(){var s=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){s._renderCallback(),s._animationFrame=void 0})))},v.prototype._restartInterval=function(s){var y=this;s===void 0&&(s=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout(function(){if(y._animationTimeRestarted){var f=600-(Date.now()-y._animationTimeRestarted);if(y._animationTimeRestarted=void 0,f>0)return void y._restartInterval(f)}y.isCursorVisible=!1,y._animationFrame=window.requestAnimationFrame(function(){y._renderCallback(),y._animationFrame=void 0}),y._blinkInterval=window.setInterval(function(){if(y._animationTimeRestarted){var c=600-(Date.now()-y._animationTimeRestarted);return y._animationTimeRestarted=void 0,void y._restartInterval(c)}y.isCursorVisible=!y.isCursorVisible,y._animationFrame=window.requestAnimationFrame(function(){y._renderCallback(),y._animationFrame=void 0})},600)},s)},v.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},v.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},v}()},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(v,s){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,f){y.__proto__=f}||function(y,f){for(var c in f)f.hasOwnProperty(c)&&(y[c]=f[c])})(v,s)},function(v,s){function y(){this.constructor=v}P(v,s),v.prototype=s===null?Object.create(s):(y.prototype=s.prototype,new y)});Object.defineProperty(b,"__esModule",{value:!0}),b.LinkRenderLayer=void 0;var D=I(13),w=I(9),_=I(26),F=function(v){function s(y,f,c,l,h,d,E,T){var L=v.call(this,y,"link",f,!0,c,l,E,T)||this;return h.onShowLinkUnderline(function(x){return L._onShowLinkUnderline(x)}),h.onHideLinkUnderline(function(x){return L._onHideLinkUnderline(x)}),d.onShowLinkUnderline(function(x){return L._onShowLinkUnderline(x)}),d.onHideLinkUnderline(function(x){return L._onHideLinkUnderline(x)}),L}return K(s,v),s.prototype.resize=function(y){v.prototype.resize.call(this,y),this._state=void 0},s.prototype.reset=function(){this._clearCurrentLink()},s.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var y=this._state.y2-this._state.y1-1;y>0&&this._clearCells(0,this._state.y1+1,this._state.cols,y),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},s.prototype._onShowLinkUnderline=function(y){if(y.fg===w.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:y.fg&&_.is256Color(y.fg)?this._ctx.fillStyle=this._colors.ansi[y.fg].css:this._ctx.fillStyle=this._colors.foreground.css,y.y1===y.y2)this._fillBottomLineAtCells(y.x1,y.y1,y.x2-y.x1);else{this._fillBottomLineAtCells(y.x1,y.y1,y.cols-y.x1);for(var f=y.y1+1;f<y.y2;f++)this._fillBottomLineAtCells(0,f,y.cols);this._fillBottomLineAtCells(0,y.y2,y.x2)}this._state=y},s.prototype._onHideLinkUnderline=function(y){this._clearCurrentLink()},s}(D.BaseRenderLayer);b.LinkRenderLayer=F},function(ge,b,I){"use strict";var P=this&&this.__decorate||function(v,s,y,f){var c,l=arguments.length,h=l<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,y):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(v,s,y,f);else for(var d=v.length-1;d>=0;d--)(c=v[d])&&(h=(l<3?c(h):l>3?c(s,y,h):c(s,y))||h);return l>3&&h&&Object.defineProperty(s,y,h),h},K=this&&this.__param||function(v,s){return function(y,f){s(y,f,v)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseZone=b.Linkifier=void 0;var D=I(0),w=I(1),_=function(){function v(s,y,f){this._bufferService=s,this._logService=y,this._unicodeService=f,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new D.EventEmitter,this._onHideLinkUnderline=new D.EventEmitter,this._onLinkTooltip=new D.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(v.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),v.prototype.attachToDom=function(s,y){this._element=s,this._mouseZoneManager=y},v.prototype.linkifyRows=function(s,y){var f=this;this._mouseZoneManager&&(this._rowsToLinkify.start===void 0||this._rowsToLinkify.end===void 0?(this._rowsToLinkify.start=s,this._rowsToLinkify.end=y):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,s),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,y)),this._mouseZoneManager.clearAll(s,y),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return f._linkifyRows()},v._timeBeforeLatency))},v.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var s=this._bufferService.buffer;if(this._rowsToLinkify.start!==void 0&&this._rowsToLinkify.end!==void 0){var y=s.ydisp+this._rowsToLinkify.start;if(!(y>=s.lines.length)){for(var f=s.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,c=Math.ceil(2e3/this._bufferService.cols),l=this._bufferService.buffer.iterator(!1,y,f,c,c);l.hasNext();)for(var h=l.next(),d=0;d<this._linkMatchers.length;d++)this._doLinkifyRow(h.range.first,h.content,this._linkMatchers[d]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},v.prototype.registerLinkMatcher=function(s,y,f){if(f===void 0&&(f={}),!y)throw new Error("handler must be defined");var c={id:this._nextLinkMatcherId++,regex:s,handler:y,matchIndex:f.matchIndex,validationCallback:f.validationCallback,hoverTooltipCallback:f.tooltipCallback,hoverLeaveCallback:f.leaveCallback,willLinkActivate:f.willLinkActivate,priority:f.priority||0};return this._addLinkMatcherToList(c),c.id},v.prototype._addLinkMatcherToList=function(s){if(this._linkMatchers.length!==0){for(var y=this._linkMatchers.length-1;y>=0;y--)if(s.priority<=this._linkMatchers[y].priority)return void this._linkMatchers.splice(y+1,0,s);this._linkMatchers.splice(0,0,s)}else this._linkMatchers.push(s)},v.prototype.deregisterLinkMatcher=function(s){for(var y=0;y<this._linkMatchers.length;y++)if(this._linkMatchers[y].id===s)return this._linkMatchers.splice(y,1),!0;return!1},v.prototype._doLinkifyRow=function(s,y,f){for(var c,l=this,h=new RegExp(f.regex.source,(f.regex.flags||"")+"g"),d=-1,E=function(){var L=c[typeof f.matchIndex!="number"?0:f.matchIndex];if(!L)return T._logService.debug("match found without corresponding matchIndex",c,f),"break";if(d=y.indexOf(L,d+1),h.lastIndex=d+L.length,d<0)return"break";var x=T._bufferService.buffer.stringIndexToBufferIndex(s,d);if(x[0]<0)return"break";var A=T._bufferService.buffer.lines.get(x[0]);if(!A)return"break";var O=A.getFg(x[1]),U=O?O>>9&511:void 0;f.validationCallback?f.validationCallback(L,function(N){l._rowsTimeoutId||N&&l._addLink(x[1],x[0]-l._bufferService.buffer.ydisp,L,f,U)}):T._addLink(x[1],x[0]-T._bufferService.buffer.ydisp,L,f,U)},T=this;(c=h.exec(y))!==null&&E()!=="break";);},v.prototype._addLink=function(s,y,f,c,l){var h=this;if(this._mouseZoneManager&&this._element){var d=this._unicodeService.getStringCellWidth(f),E=s%this._bufferService.cols,T=y+Math.floor(s/this._bufferService.cols),L=(E+d)%this._bufferService.cols,x=T+Math.floor((E+d)/this._bufferService.cols);L===0&&(L=this._bufferService.cols,x--),this._mouseZoneManager.add(new F(E+1,T+1,L+1,x+1,function(A){if(c.handler)return c.handler(A,f);var O=window.open();O?(O.opener=null,O.location.href=f):console.warn("Opening link blocked as opener could not be cleared")},function(){h._onShowLinkUnderline.fire(h._createLinkHoverEvent(E,T,L,x,l)),h._element.classList.add("xterm-cursor-pointer")},function(A){h._onLinkTooltip.fire(h._createLinkHoverEvent(E,T,L,x,l)),c.hoverTooltipCallback&&c.hoverTooltipCallback(A,f,{start:{x:E,y:T},end:{x:L,y:x}})},function(){h._onHideLinkUnderline.fire(h._createLinkHoverEvent(E,T,L,x,l)),h._element.classList.remove("xterm-cursor-pointer"),c.hoverLeaveCallback&&c.hoverLeaveCallback()},function(A){return!c.willLinkActivate||c.willLinkActivate(A,f)}))}},v.prototype._createLinkHoverEvent=function(s,y,f,c,l){return{x1:s,y1:y,x2:f,y2:c,cols:this._bufferService.cols,fg:l}},v._timeBeforeLatency=200,v=P([K(0,w.IBufferService),K(1,w.ILogService),K(2,w.IUnicodeService)],v)}();b.Linkifier=_;var F=function(v,s,y,f,c,l,h,d,E){this.x1=v,this.y1=s,this.x2=y,this.y2=f,this.clickCallback=c,this.hoverCallback=l,this.tooltipCallback=h,this.leaveCallback=d,this.willLinkActivate=E};b.MouseZone=F},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(L,x){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,O){A.__proto__=O}||function(A,O){for(var U in O)O.hasOwnProperty(U)&&(A[U]=O[U])})(L,x)},function(L,x){function A(){this.constructor=L}P(L,x),L.prototype=x===null?Object.create(x):(A.prototype=x.prototype,new A)}),D=this&&this.__decorate||function(L,x,A,O){var U,N=arguments.length,$=N<3?x:O===null?O=Object.getOwnPropertyDescriptor(x,A):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(L,x,A,O);else for(var M=L.length-1;M>=0;M--)(U=L[M])&&($=(N<3?U($):N>3?U(x,A,$):U(x,A))||$);return N>3&&$&&Object.defineProperty(x,A,$),$},w=this&&this.__param||function(L,x){return function(A,O){x(A,O,L)}};Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionService=void 0;var _=I(11),F=I(52),v=I(4),s=I(0),y=I(5),f=I(1),c=I(30),l=I(53),h=I(2),d="\xA0",E=new RegExp(d,"g"),T=function(L){function x(A,O,U,N,$,M,Z){var q=L.call(this)||this;return q._element=A,q._screenElement=O,q._bufferService=U,q._coreService=N,q._mouseService=$,q._optionsService=M,q._renderService=Z,q._dragScrollAmount=0,q._enabled=!0,q._workCell=new v.CellData,q._mouseDownTimeStamp=0,q._onLinuxMouseSelection=q.register(new s.EventEmitter),q._onRedrawRequest=q.register(new s.EventEmitter),q._onSelectionChange=q.register(new s.EventEmitter),q._onRequestScrollLines=q.register(new s.EventEmitter),q._mouseMoveListener=function(se){return q._onMouseMove(se)},q._mouseUpListener=function(se){return q._onMouseUp(se)},q._coreService.onUserInput(function(){q.hasSelection&&q.clearSelection()}),q._trimListener=q._bufferService.buffer.lines.onTrim(function(se){return q._onTrim(se)}),q.register(q._bufferService.buffers.onBufferActivate(function(se){return q._onBufferActivate(se)})),q.enable(),q._model=new F.SelectionModel(q._bufferService),q._activeSelectionMode=0,q}return K(x,L),Object.defineProperty(x.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),x.prototype.dispose=function(){this._removeMouseDownListeners()},x.prototype.reset=function(){this.clearSelection()},x.prototype.disable=function(){this.clearSelection(),this._enabled=!1},x.prototype.enable=function(){this._enabled=!0},Object.defineProperty(x.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasSelection",{get:function(){var A=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!A||!O)&&(A[0]!==O[0]||A[1]!==O[1])},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"selectionText",{get:function(){var A=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;if(!A||!O)return"";var U=this._bufferService.buffer,N=[];if(this._activeSelectionMode===3){if(A[0]===O[0])return"";for(var $=A[1];$<=O[1];$++){var M=U.translateBufferLineToString($,!0,A[0],O[0]);N.push(M)}}else{var Z=A[1]===O[1]?O[0]:void 0;for(N.push(U.translateBufferLineToString(A[1],!0,A[0],Z)),$=A[1]+1;$<=O[1]-1;$++){var q=U.lines.get($);M=U.translateBufferLineToString($,!0),q&&q.isWrapped?N[N.length-1]+=M:N.push(M)}A[1]!==O[1]&&(q=U.lines.get(O[1]),M=U.translateBufferLineToString(O[1],!0,0,O[0]),q&&q.isWrapped?N[N.length-1]+=M:N.push(M))}return N.map(function(se){return se.replace(E," ")}).join(_.isWindows?`\r
|
|
|
`:`
|
|
|
`)},enumerable:!1,configurable:!0}),x.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},x.prototype.refresh=function(A){var O=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return O._refresh()})),_.isLinux&&A&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},x.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})},x.prototype.isClickInSelection=function(A){var O=this._getMouseBufferCoords(A),U=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!!(U&&N&&O)&&this._areCoordsInSelection(O,U,N)},x.prototype._areCoordsInSelection=function(A,O,U){return A[1]>O[1]&&A[1]<U[1]||O[1]===U[1]&&A[1]===O[1]&&A[0]>=O[0]&&A[0]<U[0]||O[1]<U[1]&&A[1]===U[1]&&A[0]<U[0]||O[1]<U[1]&&A[1]===O[1]&&A[0]>=O[0]},x.prototype.selectWordAtCursor=function(A){var O=this._getMouseBufferCoords(A);O&&(this._selectWordAt(O,!1),this._model.selectionEnd=void 0,this.refresh(!0))},x.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},x.prototype.selectLines=function(A,O){this._model.clearSelection(),A=Math.max(A,0),O=Math.min(O,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,O],this.refresh(),this._onSelectionChange.fire()},x.prototype._onTrim=function(A){this._model.onTrim(A)&&this.refresh()},x.prototype._getMouseBufferCoords=function(A){var O=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(O)return O[0]--,O[1]--,O[1]+=this._bufferService.buffer.ydisp,O},x.prototype._getMouseEventScrollAmount=function(A){var O=c.getCoordsRelativeToElement(A,this._screenElement)[1],U=this._renderService.dimensions.canvasHeight;return O>=0&&O<=U?0:(O>U&&(O-=U),O=Math.min(Math.max(O,-50),50),(O/=50)/Math.abs(O)+Math.round(14*O))},x.prototype.shouldForceSelection=function(A){return _.isMac?A.altKey&&this._optionsService.options.macOptionClickForcesSelection:A.shiftKey},x.prototype.onMouseDown=function(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._onIncrementalClick(A):A.detail===1?this._onSingleClick(A):A.detail===2?this._onDoubleClick(A):A.detail===3&&this._onTripleClick(A),this._addMouseDownListeners(),this.refresh(!0)}},x.prototype._addMouseDownListeners=function(){var A=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval(function(){return A._dragScroll()},50)},x.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},x.prototype._onIncrementalClick=function(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))},x.prototype._onSingleClick=function(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),this._model.selectionStart){this._model.selectionEnd=void 0;var O=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);O&&O.length!==this._model.selectionStart[0]&&O.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}},x.prototype._onDoubleClick=function(A){var O=this._getMouseBufferCoords(A);O&&(this._activeSelectionMode=1,this._selectWordAt(O,!0))},x.prototype._onTripleClick=function(A){var O=this._getMouseBufferCoords(A);O&&(this._activeSelectionMode=2,this._selectLineAt(O[1]))},x.prototype.shouldColumnSelect=function(A){return A.altKey&&!(_.isMac&&this._optionsService.options.macOptionClickForcesSelection)},x.prototype._onMouseMove=function(A){if(A.stopImmediatePropagation(),this._model.selectionStart){var O=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),this._model.selectionEnd){this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var U=this._bufferService.buffer;if(this._model.selectionEnd[1]<U.lines.length){var N=U.lines.get(this._model.selectionEnd[1]);N&&N.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}O&&O[0]===this._model.selectionEnd[0]&&O[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)}},x.prototype._dragScroll=function(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});var A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}},x.prototype._onMouseUp=function(A){var O=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&O<500&&A.altKey){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var U=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(U&&U[0]!==void 0&&U[1]!==void 0){var N=l.moveToCellSequence(U[0]-1,U[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(N,!0)}}}else this.hasSelection&&this._onSelectionChange.fire()},x.prototype._onBufferActivate=function(A){var O=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim(function(U){return O._onTrim(U)})},x.prototype._convertViewportColToCharacterIndex=function(A,O){for(var U=O[0],N=0;O[0]>=N;N++){var $=A.loadCell(N,this._workCell).getChars().length;this._workCell.getWidth()===0?U--:$>1&&O[0]!==N&&(U+=$-1)}return U},x.prototype.setSelection=function(A,O,U){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,O],this._model.selectionStartLength=U,this.refresh()},x.prototype._getWordAt=function(A,O,U,N){if(U===void 0&&(U=!0),N===void 0&&(N=!0),!(A[0]>=this._bufferService.cols)){var $=this._bufferService.buffer,M=$.lines.get(A[1]);if(M){var Z=$.translateBufferLineToString(A[1],!1),q=this._convertViewportColToCharacterIndex(M,A),se=q,ue=A[0]-q,J=0,z=0,X=0,B=0;if(Z.charAt(q)===" "){for(;q>0&&Z.charAt(q-1)===" ";)q--;for(;se<Z.length&&Z.charAt(se+1)===" ";)se++}else{var G=A[0],W=A[0];M.getWidth(G)===0&&(J++,G--),M.getWidth(W)===2&&(z++,W++);var k=M.getString(W).length;for(k>1&&(B+=k-1,se+=k-1);G>0&&q>0&&!this._isCharWordSeparator(M.loadCell(G-1,this._workCell));){M.loadCell(G-1,this._workCell);var C=this._workCell.getChars().length;this._workCell.getWidth()===0?(J++,G--):C>1&&(X+=C-1,q-=C-1),q--,G--}for(;W<M.length&&se+1<Z.length&&!this._isCharWordSeparator(M.loadCell(W+1,this._workCell));){M.loadCell(W+1,this._workCell);var V=this._workCell.getChars().length;this._workCell.getWidth()===2?(z++,W++):V>1&&(B+=V-1,se+=V-1),se++,W++}}se++;var ne=q+ue-J+X,pe=Math.min(this._bufferService.cols,se-q+J+z-X-B);if(O||Z.slice(q,se).trim()!==""){if(U&&ne===0&&M.getCodePoint(0)!==32){var Ce=$.lines.get(A[1]-1);if(Ce&&M.isWrapped&&Ce.getCodePoint(this._bufferService.cols-1)!==32){var We=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(We){var me=this._bufferService.cols-We.start;ne-=me,pe+=me}}}if(N&&ne+pe===this._bufferService.cols&&M.getCodePoint(this._bufferService.cols-1)!==32){var Ne=$.lines.get(A[1]+1);if(Ne&&Ne.isWrapped&&Ne.getCodePoint(0)!==32){var Be=this._getWordAt([0,A[1]+1],!1,!1,!0);Be&&(pe+=Be.length)}}return{start:ne,length:pe}}}}},x.prototype._selectWordAt=function(A,O){var U=this._getWordAt(A,O);if(U){for(;U.start<0;)U.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[U.start,A[1]],this._model.selectionStartLength=U.length}},x.prototype._selectToWordAt=function(A){var O=this._getWordAt(A,!0);if(O){for(var U=A[1];O.start<0;)O.start+=this._bufferService.cols,U--;if(!this._model.areSelectionValuesReversed())for(;O.start+O.length>this._bufferService.cols;)O.length-=this._bufferService.cols,U++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?O.start:O.start+O.length,U]}},x.prototype._isCharWordSeparator=function(A){return A.getWidth()!==0&&this._optionsService.options.wordSeparator.indexOf(A.getChars())>=0},x.prototype._selectLineAt=function(A){var O=this._bufferService.buffer.getWrappedRangeForLine(A);this._model.selectionStart=[0,O.first],this._model.selectionEnd=[this._bufferService.cols,O.last],this._model.selectionStartLength=0},x=D([w(2,f.IBufferService),w(3,f.ICoreService),w(4,y.IMouseService),w(5,f.IOptionsService),w(6,y.IRenderService)],x)}(h.Disposable);b.SelectionService=T},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionModel=void 0;var P=function(){function K(D){this._bufferService=D,this.isSelectAllActive=!1,this.selectionStartLength=0}return K.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(K.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var D=this.selectionStart[0]+this.selectionStartLength;return D>this._bufferService.cols?[D%this._bufferService.cols,this.selectionStart[1]+Math.floor(D/this._bufferService.cols)]:[D,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),K.prototype.areSelectionValuesReversed=function(){var D=this.selectionStart,w=this.selectionEnd;return!(!D||!w)&&(D[1]>w[1]||D[1]===w[1]&&D[0]>w[0])},K.prototype.onTrim=function(D){return this.selectionStart&&(this.selectionStart[1]-=D),this.selectionEnd&&(this.selectionEnd[1]-=D),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},K}();b.SelectionModel=P},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.moveToCellSequence=void 0;var P=I(12);function K(s,y,f,c){var l=s-D(f,s),h=y-D(f,y);return v(Math.abs(l-h)-function(d,E,T){for(var L=0,x=d-D(T,d),A=E-D(T,E),O=0;O<Math.abs(x-A);O++){var U=w(d,E)==="A"?-1:1,N=T.buffer.lines.get(x+U*O);N&&N.isWrapped&&L++}return L}(s,y,f),F(w(s,y),c))}function D(s,y){for(var f=0,c=s.buffer.lines.get(y),l=c&&c.isWrapped;l&&y>=0&&y<s.rows;)f++,l=(c=s.buffer.lines.get(--y))&&c.isWrapped;return f}function w(s,y){return s>y?"A":"B"}function _(s,y,f,c,l,h){for(var d=s,E=y,T="";d!==f||E!==c;)d+=l?1:-1,l&&d>h.cols-1?(T+=h.buffer.translateBufferLineToString(E,!1,s,d),d=0,s=0,E++):!l&&d<0&&(T+=h.buffer.translateBufferLineToString(E,!1,0,s+1),s=d=h.cols-1,E--);return T+h.buffer.translateBufferLineToString(E,!1,s,d)}function F(s,y){var f=y?"O":"[";return P.C0.ESC+f+s}function v(s,y){s=Math.floor(s);for(var f="",c=0;c<s;c++)f+=y;return f}b.moveToCellSequence=function(s,y,f,c){var l,h=f.buffer.x,d=f.buffer.y;if(!f.buffer.hasScrollback)return function(T,L,x,A,O,U){return K(L,A,O,U).length===0?"":v(_(T,L,T,L-D(O,L),!1,O).length,F("D",U))}(h,d,0,y,f,c)+K(d,y,f,c)+function(T,L,x,A,O,U){var N;N=K(L,A,O,U).length>0?A-D(O,A):L;var $=A,M=function(Z,q,se,ue,J,z){var X;return X=K(se,ue,J,z).length>0?ue-D(J,ue):q,Z<se&&X<=ue||Z>=se&&X<ue?"C":"D"}(T,L,x,A,O,U);return v(_(T,N,x,$,M==="C",O).length,F(M,U))}(h,d,s,y,f,c);if(d===y)return l=h>s?"D":"C",v(Math.abs(h-s),F(l,c));l=d>y?"D":"C";var E=Math.abs(d-y);return v(function(T,L){return L.cols-T}(d>y?s:h,f)+(E-1)*f.cols+1+((d>y?h:s)-1),F(l,c))}},function(ge,b,I){"use strict";var P=this&&this.__decorate||function(_,F,v,s){var y,f=arguments.length,c=f<3?F:s===null?s=Object.getOwnPropertyDescriptor(F,v):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(_,F,v,s);else for(var l=_.length-1;l>=0;l--)(y=_[l])&&(c=(f<3?y(c):f>3?y(F,v,c):y(F,v))||c);return f>3&&c&&Object.defineProperty(F,v,c),c},K=this&&this.__param||function(_,F){return function(v,s){F(v,s,_)}};Object.defineProperty(b,"__esModule",{value:!0}),b.SoundService=void 0;var D=I(1),w=function(){function _(F){this._optionsService=F}return Object.defineProperty(_,"audioContext",{get:function(){if(!_._audioContext){var F=window.AudioContext||window.webkitAudioContext;if(!F)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;_._audioContext=new F}return _._audioContext},enumerable:!1,configurable:!0}),_.prototype.playBellSound=function(){var F=_.audioContext;if(F){var v=F.createBufferSource();F.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(s){v.buffer=s,v.connect(F.destination),v.start(0)})}},_.prototype._base64ToArrayBuffer=function(F){for(var v=window.atob(F),s=v.length,y=new Uint8Array(s),f=0;f<s;f++)y[f]=v.charCodeAt(f);return y.buffer},_.prototype._removeMimeType=function(F){return F.split(",")[1]},_=P([K(0,D.IOptionsService)],_)}();b.SoundService=w},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseZoneManager=void 0;var _=I(2),F=I(7),v=I(5),s=I(1),y=function(f){function c(l,h,d,E,T,L){var x=f.call(this)||this;return x._element=l,x._screenElement=h,x._bufferService=d,x._mouseService=E,x._selectionService=T,x._optionsService=L,x._zones=[],x._areZonesActive=!1,x._lastHoverCoords=[void 0,void 0],x._initialSelectionLength=0,x.register(F.addDisposableDomListener(x._element,"mousedown",function(A){return x._onMouseDown(A)})),x._mouseMoveListener=function(A){return x._onMouseMove(A)},x._mouseLeaveListener=function(A){return x._onMouseLeave(A)},x._clickListener=function(A){return x._onClick(A)},x}return K(c,f),c.prototype.dispose=function(){f.prototype.dispose.call(this),this._deactivate()},c.prototype.add=function(l){this._zones.push(l),this._zones.length===1&&this._activate()},c.prototype.clearAll=function(l,h){if(this._zones.length!==0){l&&h||(l=0,h=this._bufferService.rows-1);for(var d=0;d<this._zones.length;d++){var E=this._zones[d];(E.y1>l&&E.y1<=h+1||E.y2>l&&E.y2<=h+1||E.y1<l&&E.y2>h+1)&&(this._currentZone&&this._currentZone===E&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(d--,1))}this._zones.length===0&&this._deactivate()}},c.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},c.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},c.prototype._onMouseMove=function(l){this._lastHoverCoords[0]===l.pageX&&this._lastHoverCoords[1]===l.pageY||(this._onHover(l),this._lastHoverCoords=[l.pageX,l.pageY])},c.prototype._onHover=function(l){var h=this,d=this._findZoneEventAt(l);d!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),d&&(this._currentZone=d,d.hoverCallback&&d.hoverCallback(l),this._tooltipTimeout=window.setTimeout(function(){return h._onTooltip(l)},this._optionsService.options.linkTooltipHoverDuration)))},c.prototype._onTooltip=function(l){this._tooltipTimeout=void 0;var h=this._findZoneEventAt(l);h&&h.tooltipCallback&&h.tooltipCallback(l)},c.prototype._onMouseDown=function(l){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var h=this._findZoneEventAt(l);h!=null&&h.willLinkActivate(l)&&(l.preventDefault(),l.stopImmediatePropagation())}},c.prototype._onMouseLeave=function(l){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},c.prototype._onClick=function(l){var h=this._findZoneEventAt(l),d=this._getSelectionLength();h&&d===this._initialSelectionLength&&(h.clickCallback(l),l.preventDefault(),l.stopImmediatePropagation())},c.prototype._getSelectionLength=function(){var l=this._selectionService.selectionText;return l?l.length:0},c.prototype._findZoneEventAt=function(l){var h=this._mouseService.getCoords(l,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(h)for(var d=h[0],E=h[1],T=0;T<this._zones.length;T++){var L=this._zones[T];if(L.y1===L.y2){if(E===L.y1&&d>=L.x1&&d<L.x2)return L}else if(E===L.y1&&d>=L.x1||E===L.y2&&d<L.x2||E>L.y1&&E<L.y2)return L}},c=D([w(2,s.IBufferService),w(3,v.IMouseService),w(4,v.ISelectionService),w(5,s.IOptionsService)],c)}(_.Disposable);b.MouseZoneManager=y},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(c,l){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,d){h.__proto__=d}||function(h,d){for(var E in d)d.hasOwnProperty(E)&&(h[E]=d[E])})(c,l)},function(c,l){function h(){this.constructor=c}P(c,l),c.prototype=l===null?Object.create(l):(h.prototype=l.prototype,new h)});Object.defineProperty(b,"__esModule",{value:!0}),b.AccessibilityManager=void 0;var D=I(18),w=I(11),_=I(31),F=I(7),v=I(2),s=I(32),y=I(17),f=function(c){function l(h,d){var E=c.call(this)||this;E._terminal=h,E._renderService=d,E._liveRegionLineCount=0,E._charsToConsume=[],E._charsToAnnounce="",E._accessibilityTreeRoot=document.createElement("div"),E._accessibilityTreeRoot.classList.add("xterm-accessibility"),E._rowContainer=document.createElement("div"),E._rowContainer.classList.add("xterm-accessibility-tree"),E._rowContainer.setAttribute("role","list"),E._rowElements=[];for(var T=0;T<E._terminal.rows;T++)E._rowElements[T]=E._createAccessibilityTreeNode(),E._rowContainer.appendChild(E._rowElements[T]);if(E._topBoundaryFocusListener=function(L){return E._onBoundaryFocus(L,0)},E._bottomBoundaryFocusListener=function(L){return E._onBoundaryFocus(L,1)},E._rowElements[0].addEventListener("focus",E._topBoundaryFocusListener),E._rowElements[E._rowElements.length-1].addEventListener("focus",E._bottomBoundaryFocusListener),E._refreshRowsDimensions(),E._accessibilityTreeRoot.appendChild(E._rowContainer),E._renderRowsDebouncer=new _.RenderDebouncer(E._renderRows.bind(E)),E._refreshRows(),E._liveRegion=document.createElement("div"),E._liveRegion.classList.add("live-region"),E._liveRegion.setAttribute("aria-live","assertive"),E._accessibilityTreeRoot.appendChild(E._liveRegion),!E._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");return E._terminal.element.insertAdjacentElement("afterbegin",E._accessibilityTreeRoot),E.register(E._renderRowsDebouncer),E.register(E._terminal.onResize(function(L){return E._onResize(L.rows)})),E.register(E._terminal.onRender(function(L){return E._refreshRows(L.start,L.end)})),E.register(E._terminal.onScroll(function(){return E._refreshRows()})),E.register(E._terminal.onA11yChar(function(L){return E._onChar(L)})),E.register(E._terminal.onLineFeed(function(){return E._onChar(`
|
|
|
`)})),E.register(E._terminal.onA11yTab(function(L){return E._onTab(L)})),E.register(E._terminal.onKey(function(L){return E._onKey(L.key)})),E.register(E._terminal.onBlur(function(){return E._clearLiveRegion()})),E.register(E._renderService.onDimensionsChange(function(){return E._refreshRowsDimensions()})),E._screenDprMonitor=new s.ScreenDprMonitor,E.register(E._screenDprMonitor),E._screenDprMonitor.setListener(function(){return E._refreshRowsDimensions()}),E.register(F.addDisposableDomListener(window,"resize",function(){return E._refreshRowsDimensions()})),E}return K(l,c),l.prototype.dispose=function(){c.prototype.dispose.call(this),y.removeElementFromParent(this._accessibilityTreeRoot),this._rowElements.length=0},l.prototype._onBoundaryFocus=function(h,d){var E=h.target,T=this._rowElements[d===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")!==(d===0?"1":""+this._terminal.buffer.lines.length)&&h.relatedTarget===T){var L,x;if(d===0?(L=E,x=this._rowElements.pop(),this._rowContainer.removeChild(x)):(L=this._rowElements.shift(),x=E,this._rowContainer.removeChild(L)),L.removeEventListener("focus",this._topBoundaryFocusListener),x.removeEventListener("focus",this._bottomBoundaryFocusListener),d===0){var A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else A=this._createAccessibilityTreeNode(),this._rowElements.push(A),this._rowContainer.appendChild(A);this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(d===0?-1:1),this._rowElements[d===0?1:this._rowElements.length-2].focus(),h.preventDefault(),h.stopImmediatePropagation()}},l.prototype._onResize=function(h){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var d=this._rowContainer.children.length;d<this._terminal.rows;d++)this._rowElements[d]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[d]);for(;this._rowElements.length>h;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},l.prototype._createAccessibilityTreeNode=function(){var h=document.createElement("div");return h.setAttribute("role","listitem"),h.tabIndex=-1,this._refreshRowDimensions(h),h},l.prototype._onTab=function(h){for(var d=0;d<h;d++)this._onChar(" ")},l.prototype._onChar=function(h){var d=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==h&&(this._charsToAnnounce+=h):this._charsToAnnounce+=h,h===`
|
|
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=D.tooMuchOutput)),w.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(function(){d._accessibilityTreeRoot.appendChild(d._liveRegion)},0))},l.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,w.isMac&&y.removeElementFromParent(this._liveRegion)},l.prototype._onKey=function(h){this._clearLiveRegion(),this._charsToConsume.push(h)},l.prototype._refreshRows=function(h,d){this._renderRowsDebouncer.refresh(h,d,this._terminal.rows)},l.prototype._renderRows=function(h,d){for(var E=this._terminal.buffer,T=E.lines.length.toString(),L=h;L<=d;L++){var x=E.translateBufferLineToString(E.ydisp+L,!0),A=(E.ydisp+L+1).toString(),O=this._rowElements[L];O&&(x.length===0?O.innerHTML=" ":O.textContent=x,O.setAttribute("aria-posinset",A),O.setAttribute("aria-setsize",T))}this._announceCharacters()},l.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var h=0;h<this._terminal.rows;h++)this._refreshRowDimensions(this._rowElements[h])}},l.prototype._refreshRowDimensions=function(h){h.style.height=this._renderService.dimensions.actualCellHeight+"px"},l.prototype._announceCharacters=function(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},l}(v.Disposable);b.AccessibilityManager=f},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(E,T){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,x){L.__proto__=x}||function(L,x){for(var A in x)x.hasOwnProperty(A)&&(L[A]=x[A])})(E,T)},function(E,T){function L(){this.constructor=E}P(E,T),E.prototype=T===null?Object.create(T):(L.prototype=T.prototype,new L)}),D=this&&this.__decorate||function(E,T,L,x){var A,O=arguments.length,U=O<3?T:x===null?x=Object.getOwnPropertyDescriptor(T,L):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(E,T,L,x);else for(var N=E.length-1;N>=0;N--)(A=E[N])&&(U=(O<3?A(U):O>3?A(T,L,U):A(T,L))||U);return O>3&&U&&Object.defineProperty(T,L,U),U},w=this&&this.__param||function(E,T){return function(L,x){T(L,x,E)}};Object.defineProperty(b,"__esModule",{value:!0}),b.DomRenderer=void 0;var _=I(58),F=I(9),v=I(2),s=I(5),y=I(1),f=I(0),c=I(10),l=I(17),h=1,d=function(E){function T(L,x,A,O,U,N,$,M,Z){var q=E.call(this)||this;return q._colors=L,q._element=x,q._screenElement=A,q._viewportElement=O,q._linkifier=U,q._linkifier2=N,q._charSizeService=$,q._optionsService=M,q._bufferService=Z,q._terminalClass=h++,q._rowElements=[],q._rowContainer=document.createElement("div"),q._rowContainer.classList.add("xterm-rows"),q._rowContainer.style.lineHeight="normal",q._rowContainer.setAttribute("aria-hidden","true"),q._refreshRowElements(q._bufferService.cols,q._bufferService.rows),q._selectionContainer=document.createElement("div"),q._selectionContainer.classList.add("xterm-selection"),q._selectionContainer.setAttribute("aria-hidden","true"),q.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},q._updateDimensions(),q._injectCss(),q._rowFactory=new _.DomRendererRowFactory(document,q._optionsService,q._colors),q._element.classList.add("xterm-dom-renderer-owner-"+q._terminalClass),q._screenElement.appendChild(q._rowContainer),q._screenElement.appendChild(q._selectionContainer),q._linkifier.onShowLinkUnderline(function(se){return q._onLinkHover(se)}),q._linkifier.onHideLinkUnderline(function(se){return q._onLinkLeave(se)}),q._linkifier2.onShowLinkUnderline(function(se){return q._onLinkHover(se)}),q._linkifier2.onHideLinkUnderline(function(se){return q._onLinkLeave(se)}),q}return K(T,E),Object.defineProperty(T.prototype,"onRequestRedraw",{get:function(){return new f.EventEmitter().event},enumerable:!1,configurable:!0}),T.prototype.dispose=function(){this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),l.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),E.prototype.dispose.call(this)},T.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var L=0,x=this._rowElements;L<x.length;L++){var A=x[L];A.style.width=this.dimensions.canvasWidth+"px",A.style.height=this.dimensions.actualCellHeight+"px",A.style.lineHeight=this.dimensions.actualCellHeight+"px",A.style.overflow="hidden"}this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));var O=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.innerHTML=O,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},T.prototype.setColors=function(L){this._colors=L,this._injectCss()},T.prototype._injectCss=function(){var L=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var x=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";x+=this._terminalSelector+" span:not(."+_.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+_.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+_.ITALIC_CLASS+" { font-style: italic;}",x+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",x+="@keyframes blink_block_"+this._terminalClass+" { 0% { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+"; } 50% { background-color: "+this._colors.cursorAccent.css+"; color: "+this._colors.cursor.css+"; }}",x+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+_.CURSOR_CLASS+"."+_.CURSOR_BLINK_CLASS+":not(."+_.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+_.CURSOR_CLASS+"."+_.CURSOR_BLINK_CLASS+"."+_.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",x+=this._terminalSelector+" .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}"+this._terminalSelector+" .xterm-selection div { position: absolute; background-color: "+this._colors.selectionTransparent.css+";}",this._colors.ansi.forEach(function(A,O){x+=L._terminalSelector+" .xterm-fg-"+O+" { color: "+A.css+"; }"+L._terminalSelector+" .xterm-bg-"+O+" { background-color: "+A.css+"; }"}),x+=this._terminalSelector+" .xterm-fg-"+F.INVERTED_DEFAULT_COLOR+" { color: "+c.color.opaque(this._colors.background).css+"; }"+this._terminalSelector+" .xterm-bg-"+F.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }",this._themeStyleElement.innerHTML=x},T.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},T.prototype._refreshRowElements=function(L,x){for(var A=this._rowElements.length;A<=x;A++){var O=document.createElement("div");this._rowContainer.appendChild(O),this._rowElements.push(O)}for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop())},T.prototype.onResize=function(L,x){this._refreshRowElements(L,x),this._updateDimensions()},T.prototype.onCharSizeChanged=function(){this._updateDimensions()},T.prototype.onBlur=function(){this._rowContainer.classList.remove("xterm-focus")},T.prototype.onFocus=function(){this._rowContainer.classList.add("xterm-focus")},T.prototype.onSelectionChanged=function(L,x,A){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(L&&x){var O=L[1]-this._bufferService.buffer.ydisp,U=x[1]-this._bufferService.buffer.ydisp,N=Math.max(O,0),$=Math.min(U,this._bufferService.rows-1);if(!(N>=this._bufferService.rows||$<0)){var M=document.createDocumentFragment();if(A)M.appendChild(this._createSelectionElement(N,L[0],x[0],$-N+1));else{var Z=O===N?L[0]:0,q=N===$?x[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(N,Z,q));var se=$-N-1;if(M.appendChild(this._createSelectionElement(N+1,0,this._bufferService.cols,se)),N!==$){var ue=U===$?x[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement($,0,ue))}}this._selectionContainer.appendChild(M)}}},T.prototype._createSelectionElement=function(L,x,A,O){O===void 0&&(O=1);var U=document.createElement("div");return U.style.height=O*this.dimensions.actualCellHeight+"px",U.style.top=L*this.dimensions.actualCellHeight+"px",U.style.left=x*this.dimensions.actualCellWidth+"px",U.style.width=this.dimensions.actualCellWidth*(A-x)+"px",U},T.prototype.onCursorMove=function(){},T.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},T.prototype.clear=function(){for(var L=0,x=this._rowElements;L<x.length;L++)x[L].innerHTML=""},T.prototype.renderRows=function(L,x){for(var A=this._bufferService.buffer.ybase+this._bufferService.buffer.y,O=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),U=this._optionsService.options.cursorBlink,N=L;N<=x;N++){var $=this._rowElements[N];$.innerHTML="";var M=N+this._bufferService.buffer.ydisp,Z=this._bufferService.buffer.lines.get(M),q=this._optionsService.options.cursorStyle;$.appendChild(this._rowFactory.createRow(Z,M===A,q,O,U,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(T.prototype,"_terminalSelector",{get:function(){return".xterm-dom-renderer-owner-"+this._terminalClass},enumerable:!1,configurable:!0}),T.prototype.registerCharacterJoiner=function(L){return-1},T.prototype.deregisterCharacterJoiner=function(L){return!1},T.prototype._onLinkHover=function(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!0)},T.prototype._onLinkLeave=function(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!1)},T.prototype._setCellUnderline=function(L,x,A,O,U,N){for(;L!==x||A!==O;){var $=this._rowElements[A];if(!$)return;var M=$.children[L];M&&(M.style.textDecoration=N?"underline":"none"),++L>=U&&(L=0,A++)}},T=D([w(6,s.ICharSizeService),w(7,y.IOptionsService),w(8,y.IBufferService)],T)}(v.Disposable);b.DomRenderer=d},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.DomRendererRowFactory=b.CURSOR_STYLE_UNDERLINE_CLASS=b.CURSOR_STYLE_BAR_CLASS=b.CURSOR_STYLE_BLOCK_CLASS=b.CURSOR_BLINK_CLASS=b.CURSOR_CLASS=b.UNDERLINE_CLASS=b.ITALIC_CLASS=b.DIM_CLASS=b.BOLD_CLASS=void 0;var P=I(9),K=I(3),D=I(4),w=I(10);b.BOLD_CLASS="xterm-bold",b.DIM_CLASS="xterm-dim",b.ITALIC_CLASS="xterm-italic",b.UNDERLINE_CLASS="xterm-underline",b.CURSOR_CLASS="xterm-cursor",b.CURSOR_BLINK_CLASS="xterm-cursor-blink",b.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",b.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",b.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var _=function(){function v(s,y,f){this._document=s,this._optionsService=y,this._colors=f,this._workCell=new D.CellData}return v.prototype.setColors=function(s){this._colors=s},v.prototype.createRow=function(s,y,f,c,l,h,d){for(var E=this._document.createDocumentFragment(),T=0,L=Math.min(s.length,d)-1;L>=0;L--)if(s.loadCell(L,this._workCell).getCode()!==K.NULL_CELL_CODE||y&&L===c){T=L+1;break}for(L=0;L<T;L++){s.loadCell(L,this._workCell);var x=this._workCell.getWidth();if(x!==0){var A=this._document.createElement("span");if(x>1&&(A.style.width=h*x+"px"),y&&L===c)switch(A.classList.add(b.CURSOR_CLASS),l&&A.classList.add(b.CURSOR_BLINK_CLASS),f){case"bar":A.classList.add(b.CURSOR_STYLE_BAR_CLASS);break;case"underline":A.classList.add(b.CURSOR_STYLE_UNDERLINE_CLASS);break;default:A.classList.add(b.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&A.classList.add(b.BOLD_CLASS),this._workCell.isItalic()&&A.classList.add(b.ITALIC_CLASS),this._workCell.isDim()&&A.classList.add(b.DIM_CLASS),this._workCell.isUnderline()&&A.classList.add(b.UNDERLINE_CLASS),this._workCell.isInvisible()?A.textContent=K.WHITESPACE_CELL_CHAR:A.textContent=this._workCell.getChars()||K.WHITESPACE_CELL_CHAR;var O=this._workCell.getFgColor(),U=this._workCell.getFgColorMode(),N=this._workCell.getBgColor(),$=this._workCell.getBgColorMode(),M=!!this._workCell.isInverse();if(M){var Z=O;O=N,N=Z;var q=U;U=$,$=q}switch(U){case 16777216:case 33554432:this._workCell.isBold()&&O<8&&this._optionsService.options.drawBoldTextInBrightColors&&(O+=8),this._applyMinimumContrast(A,this._colors.background,this._colors.ansi[O])||A.classList.add("xterm-fg-"+O);break;case 50331648:var se=w.rgba.toColor(O>>16&255,O>>8&255,255&O);this._applyMinimumContrast(A,this._colors.background,se)||this._addStyle(A,"color:#"+F(O.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(A,this._colors.background,this._colors.foreground)||M&&A.classList.add("xterm-fg-"+P.INVERTED_DEFAULT_COLOR)}switch($){case 16777216:case 33554432:A.classList.add("xterm-bg-"+N);break;case 50331648:this._addStyle(A,"background-color:#"+F(N.toString(16),"0",6));break;case 0:default:M&&A.classList.add("xterm-bg-"+P.INVERTED_DEFAULT_COLOR)}E.appendChild(A)}}return E},v.prototype._applyMinimumContrast=function(s,y,f){if(this._optionsService.options.minimumContrastRatio===1)return!1;var c=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return c===void 0&&(c=w.color.ensureContrastRatio(y,f,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,c!=null?c:null)),!!c&&(this._addStyle(s,"color:"+c.css),!0)},v.prototype._addStyle=function(s,y){s.setAttribute("style",""+(s.getAttribute("style")||"")+y+";")},v}();function F(v,s,y){for(;v.length<y;)v=s+v;return v}b.DomRendererRowFactory=_},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.evaluateKeyboardEvent=void 0;var P=I(12),K={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};b.evaluateKeyboardEvent=function(D,w,_,F){var v={type:0,cancel:!1,key:void 0},s=(D.shiftKey?1:0)|(D.altKey?2:0)|(D.ctrlKey?4:0)|(D.metaKey?8:0);switch(D.keyCode){case 0:D.key==="UIKeyInputUpArrow"?v.key=w?P.C0.ESC+"OA":P.C0.ESC+"[A":D.key==="UIKeyInputLeftArrow"?v.key=w?P.C0.ESC+"OD":P.C0.ESC+"[D":D.key==="UIKeyInputRightArrow"?v.key=w?P.C0.ESC+"OC":P.C0.ESC+"[C":D.key==="UIKeyInputDownArrow"&&(v.key=w?P.C0.ESC+"OB":P.C0.ESC+"[B");break;case 8:if(D.shiftKey){v.key=P.C0.BS;break}if(D.altKey){v.key=P.C0.ESC+P.C0.DEL;break}v.key=P.C0.DEL;break;case 9:if(D.shiftKey){v.key=P.C0.ESC+"[Z";break}v.key=P.C0.HT,v.cancel=!0;break;case 13:v.key=D.altKey?P.C0.ESC+P.C0.CR:P.C0.CR,v.cancel=!0;break;case 27:v.key=P.C0.ESC,D.altKey&&(v.key=P.C0.ESC+P.C0.ESC),v.cancel=!0;break;case 37:if(D.metaKey)break;s?(v.key=P.C0.ESC+"[1;"+(s+1)+"D",v.key===P.C0.ESC+"[1;3D"&&(v.key=P.C0.ESC+(_?"b":"[1;5D"))):v.key=w?P.C0.ESC+"OD":P.C0.ESC+"[D";break;case 39:if(D.metaKey)break;s?(v.key=P.C0.ESC+"[1;"+(s+1)+"C",v.key===P.C0.ESC+"[1;3C"&&(v.key=P.C0.ESC+(_?"f":"[1;5C"))):v.key=w?P.C0.ESC+"OC":P.C0.ESC+"[C";break;case 38:if(D.metaKey)break;s?(v.key=P.C0.ESC+"[1;"+(s+1)+"A",_||v.key!==P.C0.ESC+"[1;3A"||(v.key=P.C0.ESC+"[1;5A")):v.key=w?P.C0.ESC+"OA":P.C0.ESC+"[A";break;case 40:if(D.metaKey)break;s?(v.key=P.C0.ESC+"[1;"+(s+1)+"B",_||v.key!==P.C0.ESC+"[1;3B"||(v.key=P.C0.ESC+"[1;5B")):v.key=w?P.C0.ESC+"OB":P.C0.ESC+"[B";break;case 45:D.shiftKey||D.ctrlKey||(v.key=P.C0.ESC+"[2~");break;case 46:v.key=s?P.C0.ESC+"[3;"+(s+1)+"~":P.C0.ESC+"[3~";break;case 36:v.key=s?P.C0.ESC+"[1;"+(s+1)+"H":w?P.C0.ESC+"OH":P.C0.ESC+"[H";break;case 35:v.key=s?P.C0.ESC+"[1;"+(s+1)+"F":w?P.C0.ESC+"OF":P.C0.ESC+"[F";break;case 33:D.shiftKey?v.type=2:v.key=P.C0.ESC+"[5~";break;case 34:D.shiftKey?v.type=3:v.key=P.C0.ESC+"[6~";break;case 112:v.key=s?P.C0.ESC+"[1;"+(s+1)+"P":P.C0.ESC+"OP";break;case 113:v.key=s?P.C0.ESC+"[1;"+(s+1)+"Q":P.C0.ESC+"OQ";break;case 114:v.key=s?P.C0.ESC+"[1;"+(s+1)+"R":P.C0.ESC+"OR";break;case 115:v.key=s?P.C0.ESC+"[1;"+(s+1)+"S":P.C0.ESC+"OS";break;case 116:v.key=s?P.C0.ESC+"[15;"+(s+1)+"~":P.C0.ESC+"[15~";break;case 117:v.key=s?P.C0.ESC+"[17;"+(s+1)+"~":P.C0.ESC+"[17~";break;case 118:v.key=s?P.C0.ESC+"[18;"+(s+1)+"~":P.C0.ESC+"[18~";break;case 119:v.key=s?P.C0.ESC+"[19;"+(s+1)+"~":P.C0.ESC+"[19~";break;case 120:v.key=s?P.C0.ESC+"[20;"+(s+1)+"~":P.C0.ESC+"[20~";break;case 121:v.key=s?P.C0.ESC+"[21;"+(s+1)+"~":P.C0.ESC+"[21~";break;case 122:v.key=s?P.C0.ESC+"[23;"+(s+1)+"~":P.C0.ESC+"[23~";break;case 123:v.key=s?P.C0.ESC+"[24;"+(s+1)+"~":P.C0.ESC+"[24~";break;default:if(!D.ctrlKey||D.shiftKey||D.altKey||D.metaKey)if(_&&!F||!D.altKey||D.metaKey)_&&!D.altKey&&!D.ctrlKey&&D.metaKey?D.keyCode===65&&(v.type=1):D.key&&!D.ctrlKey&&!D.altKey&&!D.metaKey&&D.keyCode>=48&&D.key.length===1?v.key=D.key:D.key&&D.ctrlKey&&D.key==="_"&&(v.key=P.C0.US);else{var y=K[D.keyCode],f=y&&y[D.shiftKey?1:0];if(f)v.key=P.C0.ESC+f;else if(D.keyCode>=65&&D.keyCode<=90){var c=D.ctrlKey?D.keyCode-64:D.keyCode+32;v.key=P.C0.ESC+String.fromCharCode(c)}}else D.keyCode>=65&&D.keyCode<=90?v.key=String.fromCharCode(D.keyCode-64):D.keyCode===32?v.key=P.C0.NUL:D.keyCode>=51&&D.keyCode<=55?v.key=String.fromCharCode(D.keyCode-51+27):D.keyCode===56?v.key=P.C0.DEL:D.keyCode===219?v.key=P.C0.ESC:D.keyCode===220?v.key=P.C0.FS:D.keyCode===221&&(v.key=P.C0.GS)}return v}},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(h,d){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,T){E.__proto__=T}||function(E,T){for(var L in T)T.hasOwnProperty(L)&&(E[L]=T[L])})(h,d)},function(h,d){function E(){this.constructor=h}P(h,d),h.prototype=d===null?Object.create(d):(E.prototype=d.prototype,new E)}),D=this&&this.__decorate||function(h,d,E,T){var L,x=arguments.length,A=x<3?d:T===null?T=Object.getOwnPropertyDescriptor(d,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(h,d,E,T);else for(var O=h.length-1;O>=0;O--)(L=h[O])&&(A=(x<3?L(A):x>3?L(d,E,A):L(d,E))||A);return x>3&&A&&Object.defineProperty(d,E,A),A},w=this&&this.__param||function(h,d){return function(E,T){d(E,T,h)}};Object.defineProperty(b,"__esModule",{value:!0}),b.RenderService=void 0;var _=I(31),F=I(0),v=I(2),s=I(32),y=I(7),f=I(1),c=I(5),l=function(h){function d(E,T,L,x,A,O){var U=h.call(this)||this;if(U._renderer=E,U._rowCount=T,U._isPaused=!1,U._needsFullRefresh=!1,U._isNextRenderRedrawOnly=!0,U._needsSelectionRefresh=!1,U._canvasWidth=0,U._canvasHeight=0,U._selectionState={start:void 0,end:void 0,columnSelectMode:!1},U._onDimensionsChange=new F.EventEmitter,U._onRender=new F.EventEmitter,U._onRefreshRequest=new F.EventEmitter,U.register({dispose:function(){return U._renderer.dispose()}}),U._renderDebouncer=new _.RenderDebouncer(function($,M){return U._renderRows($,M)}),U.register(U._renderDebouncer),U._screenDprMonitor=new s.ScreenDprMonitor,U._screenDprMonitor.setListener(function(){return U.onDevicePixelRatioChange()}),U.register(U._screenDprMonitor),U.register(O.onResize(function($){return U._fullRefresh()})),U.register(x.onOptionChange(function(){return U._renderer.onOptionsChanged()})),U.register(A.onCharSizeChange(function(){return U.onCharSizeChanged()})),U._renderer.onRequestRedraw(function($){return U.refreshRows($.start,$.end,!0)}),U.register(y.addDisposableDomListener(window,"resize",function(){return U.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var N=new IntersectionObserver(function($){return U._onIntersectionChange($[$.length-1])},{threshold:0});N.observe(L),U.register({dispose:function(){return N.disconnect()}})}return U}return K(d,h),Object.defineProperty(d.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),d.prototype._onIntersectionChange=function(E){this._isPaused=E.intersectionRatio===0,!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},d.prototype.refreshRows=function(E,T,L){L===void 0&&(L=!1),this._isPaused?this._needsFullRefresh=!0:(L||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(E,T,this._rowCount))},d.prototype._renderRows=function(E,T){this._renderer.renderRows(E,T),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:E,end:T}),this._isNextRenderRedrawOnly=!0},d.prototype.resize=function(E,T){this._rowCount=T,this._fireOnCanvasResize()},d.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},d.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},d.prototype.dispose=function(){h.prototype.dispose.call(this)},d.prototype.setRenderer=function(E){var T=this;this._renderer.dispose(),this._renderer=E,this._renderer.onRequestRedraw(function(L){return T.refreshRows(L.start,L.end,!0)}),this._needsSelectionRefresh=!0,this._fullRefresh()},d.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},d.prototype.setColors=function(E){this._renderer.setColors(E),this._fullRefresh()},d.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},d.prototype.onResize=function(E,T){this._renderer.onResize(E,T),this._fullRefresh()},d.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},d.prototype.onBlur=function(){this._renderer.onBlur()},d.prototype.onFocus=function(){this._renderer.onFocus()},d.prototype.onSelectionChanged=function(E,T,L){this._selectionState.start=E,this._selectionState.end=T,this._selectionState.columnSelectMode=L,this._renderer.onSelectionChanged(E,T,L)},d.prototype.onCursorMove=function(){this._renderer.onCursorMove()},d.prototype.clear=function(){this._renderer.clear()},d.prototype.registerCharacterJoiner=function(E){return this._renderer.registerCharacterJoiner(E)},d.prototype.deregisterCharacterJoiner=function(E){return this._renderer.deregisterCharacterJoiner(E)},d=D([w(3,f.IOptionsService),w(4,c.ICharSizeService),w(5,f.IBufferService)],d)}(v.Disposable);b.RenderService=l},function(ge,b,I){"use strict";var P=this&&this.__decorate||function(v,s,y,f){var c,l=arguments.length,h=l<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,y):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(v,s,y,f);else for(var d=v.length-1;d>=0;d--)(c=v[d])&&(h=(l<3?c(h):l>3?c(s,y,h):c(s,y))||h);return l>3&&h&&Object.defineProperty(s,y,h),h},K=this&&this.__param||function(v,s){return function(y,f){s(y,f,v)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CharSizeService=void 0;var D=I(1),w=I(0),_=function(){function v(s,y,f){this._optionsService=f,this.width=0,this.height=0,this._onCharSizeChange=new w.EventEmitter,this._measureStrategy=new F(s,y,this._optionsService)}return Object.defineProperty(v.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),v.prototype.measure=function(){var s=this._measureStrategy.measure();s.width===this.width&&s.height===this.height||(this.width=s.width,this.height=s.height,this._onCharSizeChange.fire())},v=P([K(2,D.IOptionsService)],v)}();b.CharSizeService=_;var F=function(){function v(s,y,f){this._document=s,this._parentElement=y,this._optionsService=f,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return v.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var s=this._measureElement.getBoundingClientRect();return s.width!==0&&s.height!==0&&(this._result.width=s.width,this._result.height=Math.ceil(s.height)),this._result},v}()},function(ge,b,I){"use strict";var P=this&&this.__decorate||function(F,v,s,y){var f,c=arguments.length,l=c<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,s):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(F,v,s,y);else for(var h=F.length-1;h>=0;h--)(f=F[h])&&(l=(c<3?f(l):c>3?f(v,s,l):f(v,s))||l);return c>3&&l&&Object.defineProperty(v,s,l),l},K=this&&this.__param||function(F,v){return function(s,y){v(s,y,F)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseService=void 0;var D=I(5),w=I(30),_=function(){function F(v,s){this._renderService=v,this._charSizeService=s}return F.prototype.getCoords=function(v,s,y,f,c){return w.getCoords(v,s,y,f,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,c)},F.prototype.getRawByteCoords=function(v,s,y,f){var c=this.getCoords(v,s,y,f);return w.getRawByteCoords(c)},F=P([K(0,D.IRenderService),K(1,D.ICharSizeService)],F)}();b.MouseService=_},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Linkifier2=void 0;var _=I(1),F=I(0),v=I(2),s=I(7),y=function(f){function c(l){var h=f.call(this)||this;return h._bufferService=l,h._linkProviders=[],h._linkCacheDisposables=[],h._isMouseOut=!0,h._activeLine=-1,h._onShowLinkUnderline=h.register(new F.EventEmitter),h._onHideLinkUnderline=h.register(new F.EventEmitter),h.register(v.getDisposeArrayDisposable(h._linkCacheDisposables)),h}return K(c,f),Object.defineProperty(c.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),c.prototype.registerLinkProvider=function(l){var h=this;return this._linkProviders.push(l),{dispose:function(){var d=h._linkProviders.indexOf(l);d!==-1&&h._linkProviders.splice(d,1)}}},c.prototype.attachToDom=function(l,h,d){var E=this;this._element=l,this._mouseService=h,this._renderService=d,this.register(s.addDisposableDomListener(this._element,"mouseleave",function(){E._isMouseOut=!0,E._clearCurrentLink()})),this.register(s.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(s.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},c.prototype._onMouseMove=function(l){if(this._lastMouseEvent=l,this._element&&this._mouseService){var h=this._positionFromMouseEvent(l,this._element,this._mouseService);if(h){this._isMouseOut=!1;for(var d=l.composedPath(),E=0;E<d.length;E++){var T=d[E];if(T.classList.contains("xterm"))break;if(T.classList.contains("xterm-hover"))return}this._lastBufferCell&&h.x===this._lastBufferCell.x&&h.y===this._lastBufferCell.y||(this._onHover(h),this._lastBufferCell=h)}}},c.prototype._onHover=function(l){if(this._activeLine!==l.y)return this._clearCurrentLink(),void this._askForLink(l,!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,l)||(this._clearCurrentLink(),this._askForLink(l,!0))},c.prototype._askForLink=function(l,h){var d=this;this._activeProviderReplies&&h||(this._activeProviderReplies=new Map,this._activeLine=l.y);var E=!1;this._linkProviders.forEach(function(T,L){var x;h?!((x=d._activeProviderReplies)===null||x===void 0)&&x.get(L)&&(E=d._checkLinkProviderResult(L,l,E)):T.provideLinks(l.y,function(A){var O,U;if(!d._isMouseOut){var N=A==null?void 0:A.map(function($){return{link:$}});(O=d._activeProviderReplies)===null||O===void 0||O.set(L,N),E=d._checkLinkProviderResult(L,l,E),((U=d._activeProviderReplies)===null||U===void 0?void 0:U.size)===d._linkProviders.length&&d._removeIntersectingLinks(l.y,d._activeProviderReplies)}})})},c.prototype._removeIntersectingLinks=function(l,h){for(var d=new Set,E=0;E<h.size;E++){var T=h.get(E);if(T)for(var L=0;L<T.length;L++)for(var x=T[L],A=x.link.range.start.y<l?0:x.link.range.start.x,O=x.link.range.end.y>l?this._bufferService.cols:x.link.range.end.x,U=A;U<=O;U++){if(d.has(U)){T.splice(L--,1);break}d.add(U)}}},c.prototype._checkLinkProviderResult=function(l,h,d){var E,T=this;if(!this._activeProviderReplies)return d;for(var L=this._activeProviderReplies.get(l),x=!1,A=0;A<l;A++)this._activeProviderReplies.has(A)&&!this._activeProviderReplies.get(A)||(x=!0);if(!x&&L){var O=L.find(function(N){return T._linkAtPosition(N.link,h)});O&&(d=!0,this._handleNewLink(O))}if(this._activeProviderReplies.size===this._linkProviders.length&&!d)for(A=0;A<this._activeProviderReplies.size;A++){var U=(E=this._activeProviderReplies.get(A))===null||E===void 0?void 0:E.find(function(N){return T._linkAtPosition(N.link,h)});if(U){d=!0,this._handleNewLink(U);break}}return d},c.prototype._onClick=function(l){if(this._element&&this._mouseService&&this._currentLink){var h=this._positionFromMouseEvent(l,this._element,this._mouseService);h&&this._linkAtPosition(this._currentLink.link,h)&&this._currentLink.link.activate(l,this._currentLink.link.text)}},c.prototype._clearCurrentLink=function(l,h){this._element&&this._currentLink&&this._lastMouseEvent&&(!l||!h||this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=h)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,v.disposeArray(this._linkCacheDisposables))},c.prototype._handleNewLink=function(l){var h=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(l.link,d)&&(this._currentLink=l,this._currentLink.state={decorations:{underline:l.link.decorations===void 0||l.link.decorations.underline,pointerCursor:l.link.decorations===void 0||l.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,l.link,this._lastMouseEvent),l.link.decorations={},Object.defineProperties(l.link.decorations,{pointerCursor:{get:function(){var E,T;return(T=(E=h._currentLink)===null||E===void 0?void 0:E.state)===null||T===void 0?void 0:T.decorations.pointerCursor},set:function(E){var T,L;!((T=h._currentLink)===null||T===void 0)&&T.state&&h._currentLink.state.decorations.pointerCursor!==E&&(h._currentLink.state.decorations.pointerCursor=E,h._currentLink.state.isHovered&&((L=h._element)===null||L===void 0||L.classList.toggle("xterm-cursor-pointer",E)))}},underline:{get:function(){var E,T;return(T=(E=h._currentLink)===null||E===void 0?void 0:E.state)===null||T===void 0?void 0:T.decorations.underline},set:function(E){var T,L,x;!((T=h._currentLink)===null||T===void 0)&&T.state&&((x=(L=h._currentLink)===null||L===void 0?void 0:L.state)===null||x===void 0?void 0:x.decorations.underline)!==E&&(h._currentLink.state.decorations.underline=E,h._currentLink.state.isHovered&&h._fireUnderlineEvent(l.link,E))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange(function(E){var T=E.start===0?0:E.start+1+h._bufferService.buffer.ydisp;h._clearCurrentLink(T,E.end+1+h._bufferService.buffer.ydisp)})))}},c.prototype._linkHover=function(l,h,d){var E;!((E=this._currentLink)===null||E===void 0)&&E.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!0),this._currentLink.state.decorations.pointerCursor&&l.classList.add("xterm-cursor-pointer")),h.hover&&h.hover(d,h.text)},c.prototype._fireUnderlineEvent=function(l,h){var d=l.range,E=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(d.start.x-1,d.start.y-E-1,d.end.x,d.end.y-E-1,void 0);(h?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)},c.prototype._linkLeave=function(l,h,d){var E;!((E=this._currentLink)===null||E===void 0)&&E.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!1),this._currentLink.state.decorations.pointerCursor&&l.classList.remove("xterm-cursor-pointer")),h.leave&&h.leave(d,h.text)},c.prototype._linkAtPosition=function(l,h){var d=l.range.start.y===l.range.end.y,E=l.range.start.y<h.y,T=l.range.end.y>h.y;return(d&&l.range.start.x<=h.x&&l.range.end.x>=h.x||E&&l.range.end.x>=h.x||T&&l.range.start.x<=h.x||E&&T)&&l.range.start.y<=h.y&&l.range.end.y>=h.y},c.prototype._positionFromMouseEvent=function(l,h,d){var E=d.getCoords(l,h,this._bufferService.cols,this._bufferService.rows);if(E)return{x:E[0],y:E[1]+this._bufferService.buffer.ydisp}},c.prototype._createLinkUnderlineEvent=function(l,h,d,E,T){return{x1:l,y1:h,x2:d,y2:E,cols:this._bufferService.cols,fg:T}},c=D([w(0,_.IBufferService)],c)}(v.Disposable);b.Linkifier2=y},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CoreBrowserService=void 0;var P=function(){function K(D){this._textarea=D}return Object.defineProperty(K.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),K}();b.CoreBrowserService=P},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(A,O){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(U,N){U.__proto__=N}||function(U,N){for(var $ in N)N.hasOwnProperty($)&&(U[$]=N[$])})(A,O)},function(A,O){function U(){this.constructor=A}P(A,O),A.prototype=O===null?Object.create(O):(U.prototype=O.prototype,new U)});Object.defineProperty(b,"__esModule",{value:!0}),b.CoreTerminal=void 0;var D=I(2),w=I(1),_=I(66),F=I(67),v=I(68),s=I(74),y=I(75),f=I(0),c=I(76),l=I(77),h=I(78),d=I(80),E=I(81),T=I(19),L=I(82),x=function(A){function O(U){var N=A.call(this)||this;return N._onBinary=new f.EventEmitter,N._onData=new f.EventEmitter,N._onLineFeed=new f.EventEmitter,N._onResize=new f.EventEmitter,N._onScroll=new f.EventEmitter,N._instantiationService=new _.InstantiationService,N.optionsService=new s.OptionsService(U),N._instantiationService.setService(w.IOptionsService,N.optionsService),N._bufferService=N.register(N._instantiationService.createInstance(v.BufferService)),N._instantiationService.setService(w.IBufferService,N._bufferService),N._logService=N._instantiationService.createInstance(F.LogService),N._instantiationService.setService(w.ILogService,N._logService),N._coreService=N.register(N._instantiationService.createInstance(y.CoreService,function(){return N.scrollToBottom()})),N._instantiationService.setService(w.ICoreService,N._coreService),N._coreMouseService=N._instantiationService.createInstance(c.CoreMouseService),N._instantiationService.setService(w.ICoreMouseService,N._coreMouseService),N._dirtyRowService=N._instantiationService.createInstance(l.DirtyRowService),N._instantiationService.setService(w.IDirtyRowService,N._dirtyRowService),N.unicodeService=N._instantiationService.createInstance(h.UnicodeService),N._instantiationService.setService(w.IUnicodeService,N.unicodeService),N._charsetService=N._instantiationService.createInstance(d.CharsetService),N._instantiationService.setService(w.ICharsetService,N._charsetService),N._inputHandler=new T.InputHandler(N._bufferService,N._charsetService,N._coreService,N._dirtyRowService,N._logService,N.optionsService,N._coreMouseService,N.unicodeService),N.register(f.forwardEvent(N._inputHandler.onLineFeed,N._onLineFeed)),N.register(N._inputHandler),N.register(f.forwardEvent(N._bufferService.onResize,N._onResize)),N.register(f.forwardEvent(N._coreService.onData,N._onData)),N.register(f.forwardEvent(N._coreService.onBinary,N._onBinary)),N.register(N.optionsService.onOptionChange(function($){return N._updateOptions($)})),N._writeBuffer=new L.WriteBuffer(function($){return N._inputHandler.parse($)}),N}return K(O,A),Object.defineProperty(O.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),O.prototype.dispose=function(){var U;this._isDisposed||(A.prototype.dispose.call(this),(U=this._windowsMode)===null||U===void 0||U.dispose(),this._windowsMode=void 0)},O.prototype.write=function(U,N){this._writeBuffer.write(U,N)},O.prototype.writeSync=function(U){this._writeBuffer.writeSync(U)},O.prototype.resize=function(U,N){isNaN(U)||isNaN(N)||(U=Math.max(U,v.MINIMUM_COLS),N=Math.max(N,v.MINIMUM_ROWS),this._bufferService.resize(U,N))},O.prototype.scroll=function(U,N){N===void 0&&(N=!1);var $,M=this._bufferService.buffer;($=this._cachedBlankLine)&&$.length===this.cols&&$.getFg(0)===U.fg&&$.getBg(0)===U.bg||($=M.getBlankLine(U,N),this._cachedBlankLine=$),$.isWrapped=N;var Z=M.ybase+M.scrollTop,q=M.ybase+M.scrollBottom;if(M.scrollTop===0){var se=M.lines.isFull;q===M.lines.length-1?se?M.lines.recycle().copyFrom($):M.lines.push($.clone()):M.lines.splice(q+1,0,$.clone()),se?this._bufferService.isUserScrolling&&(M.ydisp=Math.max(M.ydisp-1,0)):(M.ybase++,this._bufferService.isUserScrolling||M.ydisp++)}else{var ue=q-Z+1;M.lines.shiftElements(Z+1,ue-1,-1),M.lines.set(q,$.clone())}this._bufferService.isUserScrolling||(M.ydisp=M.ybase),this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom),this._onScroll.fire(M.ydisp)},O.prototype.scrollLines=function(U,N){var $=this._bufferService.buffer;if(U<0){if($.ydisp===0)return;this._bufferService.isUserScrolling=!0}else U+$.ydisp>=$.ybase&&(this._bufferService.isUserScrolling=!1);var M=$.ydisp;$.ydisp=Math.max(Math.min($.ydisp+U,$.ybase),0),M!==$.ydisp&&(N||this._onScroll.fire($.ydisp))},O.prototype.scrollPages=function(U){this.scrollLines(U*(this.rows-1))},O.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},O.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},O.prototype.scrollToLine=function(U){var N=U-this._bufferService.buffer.ydisp;N!==0&&this.scrollLines(N)},O.prototype.addEscHandler=function(U,N){return this._inputHandler.addEscHandler(U,N)},O.prototype.addDcsHandler=function(U,N){return this._inputHandler.addDcsHandler(U,N)},O.prototype.addCsiHandler=function(U,N){return this._inputHandler.addCsiHandler(U,N)},O.prototype.addOscHandler=function(U,N){return this._inputHandler.addOscHandler(U,N)},O.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},O.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},O.prototype._updateOptions=function(U){var N;switch(U){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():((N=this._windowsMode)===null||N===void 0||N.dispose(),this._windowsMode=void 0)}},O.prototype._enableWindowsMode=function(){var U=this;if(!this._windowsMode){var N=[];N.push(this.onLineFeed(E.updateWindowsModeWrappedState.bind(null,this._bufferService))),N.push(this.addCsiHandler({final:"H"},function(){return E.updateWindowsModeWrappedState(U._bufferService),!1})),this._windowsMode={dispose:function(){for(var $=0,M=N;$<M.length;$++)M[$].dispose()}}}},O}(D.Disposable);b.CoreTerminal=x},function(ge,b,I){"use strict";var P=this&&this.__spreadArrays||function(){for(var F=0,v=0,s=arguments.length;v<s;v++)F+=arguments[v].length;var y=Array(F),f=0;for(v=0;v<s;v++)for(var c=arguments[v],l=0,h=c.length;l<h;l++,f++)y[f]=c[l];return y};Object.defineProperty(b,"__esModule",{value:!0}),b.InstantiationService=b.ServiceCollection=void 0;var K=I(1),D=I(14),w=function(){function F(){for(var v=[],s=0;s<arguments.length;s++)v[s]=arguments[s];this._entries=new Map;for(var y=0,f=v;y<f.length;y++){var c=f[y],l=c[0],h=c[1];this.set(l,h)}}return F.prototype.set=function(v,s){var y=this._entries.get(v);return this._entries.set(v,s),y},F.prototype.forEach=function(v){this._entries.forEach(function(s,y){return v(y,s)})},F.prototype.has=function(v){return this._entries.has(v)},F.prototype.get=function(v){return this._entries.get(v)},F}();b.ServiceCollection=w;var _=function(){function F(){this._services=new w,this._services.set(K.IInstantiationService,this)}return F.prototype.setService=function(v,s){this._services.set(v,s)},F.prototype.getService=function(v){return this._services.get(v)},F.prototype.createInstance=function(v){for(var s=[],y=1;y<arguments.length;y++)s[y-1]=arguments[y];for(var f=D.getServiceDependencies(v).sort(function(L,x){return L.index-x.index}),c=[],l=0,h=f;l<h.length;l++){var d=h[l],E=this._services.get(d.id);if(!E)throw new Error("[createInstance] "+v.name+" depends on UNKNOWN service "+d.id+".");c.push(E)}var T=f.length>0?f[0].index:s.length;if(s.length!==T)throw new Error("[createInstance] First service dependency of "+v.name+" at position "+(T+1)+" conflicts with "+s.length+" static arguments");return new(v.bind.apply(v,P([void 0],P(s,c))))},F}();b.InstantiationService=_},function(ge,b,I){"use strict";var P=this&&this.__decorate||function(s,y,f,c){var l,h=arguments.length,d=h<3?y:c===null?c=Object.getOwnPropertyDescriptor(y,f):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(s,y,f,c);else for(var E=s.length-1;E>=0;E--)(l=s[E])&&(d=(h<3?l(d):h>3?l(y,f,d):l(y,f))||d);return h>3&&d&&Object.defineProperty(y,f,d),d},K=this&&this.__param||function(s,y){return function(f,c){y(f,c,s)}},D=this&&this.__spreadArrays||function(){for(var s=0,y=0,f=arguments.length;y<f;y++)s+=arguments[y].length;var c=Array(s),l=0;for(y=0;y<f;y++)for(var h=arguments[y],d=0,E=h.length;d<E;d++,l++)c[l]=h[d];return c};Object.defineProperty(b,"__esModule",{value:!0}),b.LogService=b.LogLevel=void 0;var w,_=I(1);(function(s){s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.OFF=4]="OFF"})(w=b.LogLevel||(b.LogLevel={}));var F={debug:w.DEBUG,info:w.INFO,warn:w.WARN,error:w.ERROR,off:w.OFF},v=function(){function s(y){var f=this;this._optionsService=y,this._updateLogLevel(),this._optionsService.onOptionChange(function(c){c==="logLevel"&&f._updateLogLevel()})}return s.prototype._updateLogLevel=function(){this._logLevel=F[this._optionsService.options.logLevel]},s.prototype._evalLazyOptionalParams=function(y){for(var f=0;f<y.length;f++)typeof y[f]=="function"&&(y[f]=y[f]())},s.prototype._log=function(y,f,c){this._evalLazyOptionalParams(c),y.call.apply(y,D([console,"xterm.js: "+f],c))},s.prototype.debug=function(y){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=w.DEBUG&&this._log(console.log,y,f)},s.prototype.info=function(y){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=w.INFO&&this._log(console.info,y,f)},s.prototype.warn=function(y){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=w.WARN&&this._log(console.warn,y,f)},s.prototype.error=function(y){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=w.ERROR&&this._log(console.error,y,f)},s=P([K(0,_.IOptionsService)],s)}();b.LogService=v},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.BufferService=b.MINIMUM_ROWS=b.MINIMUM_COLS=void 0;var _=I(1),F=I(69),v=I(0),s=I(2);b.MINIMUM_COLS=2,b.MINIMUM_ROWS=1;var y=function(f){function c(l){var h=f.call(this)||this;return h._optionsService=l,h.isUserScrolling=!1,h._onResize=new v.EventEmitter,h.cols=Math.max(l.options.cols,b.MINIMUM_COLS),h.rows=Math.max(l.options.rows,b.MINIMUM_ROWS),h.buffers=new F.BufferSet(l,h),h}return K(c,f),Object.defineProperty(c.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),c.prototype.dispose=function(){f.prototype.dispose.call(this),this.buffers.dispose()},c.prototype.resize=function(l,h){this.cols=l,this.rows=h,this.buffers.resize(l,h),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:l,rows:h})},c.prototype.reset=function(){this.buffers.dispose(),this.buffers=new F.BufferSet(this._optionsService,this),this.isUserScrolling=!1},c=D([w(0,_.IOptionsService)],c)}(s.Disposable);b.BufferService=y},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(F,v){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,y){s.__proto__=y}||function(s,y){for(var f in y)y.hasOwnProperty(f)&&(s[f]=y[f])})(F,v)},function(F,v){function s(){this.constructor=F}P(F,v),F.prototype=v===null?Object.create(v):(s.prototype=v.prototype,new s)});Object.defineProperty(b,"__esModule",{value:!0}),b.BufferSet=void 0;var D=I(70),w=I(0),_=function(F){function v(s,y){var f=F.call(this)||this;return f._onBufferActivate=f.register(new w.EventEmitter),f._normal=new D.Buffer(!0,s,y),f._normal.fillViewportRows(),f._alt=new D.Buffer(!1,s,y),f._activeBuffer=f._normal,f.setupTabStops(),f}return K(v,F),Object.defineProperty(v.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),v.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},v.prototype.activateAltBuffer=function(s){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(s),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},v.prototype.resize=function(s,y){this._normal.resize(s,y),this._alt.resize(s,y)},v.prototype.setupTabStops=function(s){this._normal.setupTabStops(s),this._alt.setupTabStops(s)},v}(I(2).Disposable);b.BufferSet=_},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BufferStringIterator=b.Buffer=b.MAX_BUFFER_SIZE=void 0;var P=I(71),K=I(16),D=I(4),w=I(3),_=I(72),F=I(73),v=I(20),s=I(6);b.MAX_BUFFER_SIZE=4294967295;var y=function(){function c(l,h,d){this._hasScrollback=l,this._optionsService=h,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=K.DEFAULT_ATTR_DATA.clone(),this.savedCharset=v.DEFAULT_CHARSET,this.markers=[],this._nullCell=D.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=D.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new P.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return c.prototype.getNullCell=function(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new s.ExtendedAttrs),this._nullCell},c.prototype.getWhitespaceCell=function(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new s.ExtendedAttrs),this._whitespaceCell},c.prototype.getBlankLine=function(l,h){return new K.BufferLine(this._bufferService.cols,this.getNullCell(l),h)},Object.defineProperty(c.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isCursorInViewport",{get:function(){var l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows},enumerable:!1,configurable:!0}),c.prototype._getCorrectBufferLength=function(l){if(!this._hasScrollback)return l;var h=l+this._optionsService.options.scrollback;return h>b.MAX_BUFFER_SIZE?b.MAX_BUFFER_SIZE:h},c.prototype.fillViewportRows=function(l){if(this.lines.length===0){l===void 0&&(l=K.DEFAULT_ATTR_DATA);for(var h=this._rows;h--;)this.lines.push(this.getBlankLine(l))}},c.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new P.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},c.prototype.resize=function(l,h){var d=this.getNullCell(K.DEFAULT_ATTR_DATA),E=this._getCorrectBufferLength(h);if(E>this.lines.maxLength&&(this.lines.maxLength=E),this.lines.length>0){if(this._cols<l)for(var T=0;T<this.lines.length;T++)this.lines.get(T).resize(l,d);var L=0;if(this._rows<h)for(var x=this._rows;x<h;x++)this.lines.length<h+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new K.BufferLine(l,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+L+1?(this.ybase--,L++,this.ydisp>0&&this.ydisp--):this.lines.push(new K.BufferLine(l,d)));else for(x=this._rows;x>h;x--)this.lines.length>h+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(E<this.lines.maxLength){var A=this.lines.length-E;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=E}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,h-1),L&&(this.y+=L),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=h-1,this._isReflowEnabled&&(this._reflow(l,h),this._cols>l))for(T=0;T<this.lines.length;T++)this.lines.get(T).resize(l,d);this._cols=l,this._rows=h},Object.defineProperty(c.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!1,configurable:!0}),c.prototype._reflow=function(l,h){this._cols!==l&&(l>this._cols?this._reflowLarger(l,h):this._reflowSmaller(l,h))},c.prototype._reflowLarger=function(l,h){var d=_.reflowLargerGetLinesToRemove(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(K.DEFAULT_ATTR_DATA));if(d.length>0){var E=_.reflowLargerCreateNewLayout(this.lines,d);_.reflowLargerApplyNewLayout(this.lines,E.layout),this._reflowLargerAdjustViewport(l,h,E.countRemoved)}},c.prototype._reflowLargerAdjustViewport=function(l,h,d){for(var E=this.getNullCell(K.DEFAULT_ATTR_DATA),T=d;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<h&&this.lines.push(new K.BufferLine(l,E))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)},c.prototype._reflowSmaller=function(l,h){for(var d=this.getNullCell(K.DEFAULT_ATTR_DATA),E=[],T=0,L=this.lines.length-1;L>=0;L--){var x=this.lines.get(L);if(!(!x||!x.isWrapped&&x.getTrimmedLength()<=l)){for(var A=[x];x.isWrapped&&L>0;)x=this.lines.get(--L),A.unshift(x);var O=this.ybase+this.y;if(!(O>=L&&O<L+A.length)){var U=A[A.length-1].getTrimmedLength(),N=_.reflowSmallerGetNewLineLengths(A,this._cols,l),$=N.length-A.length,M=void 0;M=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+$):Math.max(0,this.lines.length-this.lines.maxLength+$);for(var Z=[],q=0;q<$;q++){var se=this.getBlankLine(K.DEFAULT_ATTR_DATA,!0);Z.push(se)}Z.length>0&&(E.push({start:L+A.length+T,newLines:Z}),T+=Z.length),A.push.apply(A,Z);var ue=N.length-1,J=N[ue];J===0&&(J=N[--ue]);for(var z=A.length-$-1,X=U;z>=0;){var B=Math.min(X,J);if(A[ue].copyCellsFrom(A[z],X-B,J-B,B,!0),(J-=B)===0&&(J=N[--ue]),(X-=B)===0){z--;var G=Math.max(z,0);X=_.getWrappedLineTrimmedLength(A,G,this._cols)}}for(q=0;q<A.length;q++)N[q]<l&&A[q].setCell(N[q],d);for(var W=$-M;W-- >0;)this.ybase===0?this.y<h-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-h&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+$,this.ybase+h-1)}}}if(E.length>0){var k=[],C=[];for(q=0;q<this.lines.length;q++)C.push(this.lines.get(q));var V=this.lines.length,ne=V-1,pe=0,Ce=E[pe];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);var We=0;for(q=Math.min(this.lines.maxLength-1,V+T-1);q>=0;q--)if(Ce&&Ce.start>ne+We){for(var me=Ce.newLines.length-1;me>=0;me--)this.lines.set(q--,Ce.newLines[me]);q++,k.push({index:ne+1,amount:Ce.newLines.length}),We+=Ce.newLines.length,Ce=E[++pe]}else this.lines.set(q,C[ne--]);var Ne=0;for(q=k.length-1;q>=0;q--)k[q].index+=Ne,this.lines.onInsertEmitter.fire(k[q]),Ne+=k[q].amount;var Be=Math.max(0,V+T-this.lines.maxLength);Be>0&&this.lines.onTrimEmitter.fire(Be)}},c.prototype.stringIndexToBufferIndex=function(l,h,d){for(d===void 0&&(d=!1);h;){var E=this.lines.get(l);if(!E)return[-1,-1];for(var T=d?E.getTrimmedLength():E.length,L=0;L<T;++L)if(E.get(L)[w.CHAR_DATA_WIDTH_INDEX]&&(h-=E.get(L)[w.CHAR_DATA_CHAR_INDEX].length||1),h<0)return[l,L];l++}return[l,0]},c.prototype.translateBufferLineToString=function(l,h,d,E){d===void 0&&(d=0);var T=this.lines.get(l);return T?T.translateToString(h,d,E):""},c.prototype.getWrappedRangeForLine=function(l){for(var h=l,d=l;h>0&&this.lines.get(h).isWrapped;)h--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:h,last:d}},c.prototype.setupTabStops=function(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.options.tabStopWidth)this.tabs[l]=!0},c.prototype.prevStop=function(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l},c.prototype.nextStop=function(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l},c.prototype.addMarker=function(l){var h=this,d=new F.Marker(l);return this.markers.push(d),d.register(this.lines.onTrim(function(E){d.line-=E,d.line<0&&d.dispose()})),d.register(this.lines.onInsert(function(E){d.line>=E.index&&(d.line+=E.amount)})),d.register(this.lines.onDelete(function(E){d.line>=E.index&&d.line<E.index+E.amount&&d.dispose(),d.line>E.index&&(d.line-=E.amount)})),d.register(d.onDispose(function(){return h._removeMarker(d)})),d},c.prototype._removeMarker=function(l){this.markers.splice(this.markers.indexOf(l),1)},c.prototype.iterator=function(l,h,d,E,T){return new f(this,l,h,d,E,T)},c}();b.Buffer=y;var f=function(){function c(l,h,d,E,T,L){d===void 0&&(d=0),E===void 0&&(E=l.lines.length),T===void 0&&(T=0),L===void 0&&(L=0),this._buffer=l,this._trimRight=h,this._startIndex=d,this._endIndex=E,this._startOverscan=T,this._endOverscan=L,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return c.prototype.hasNext=function(){return this._current<this._endIndex},c.prototype.next=function(){var l=this._buffer.getWrappedRangeForLine(this._current);l.first<this._startIndex-this._startOverscan&&(l.first=this._startIndex-this._startOverscan),l.last>this._endIndex+this._endOverscan&&(l.last=this._endIndex+this._endOverscan),l.first=Math.max(l.first,0),l.last=Math.min(l.last,this._buffer.lines.length);for(var h="",d=l.first;d<=l.last;++d)h+=this._buffer.translateBufferLineToString(d,this._trimRight);return this._current=l.last+1,{range:l,content:h}},c}();b.BufferStringIterator=f},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CircularList=void 0;var P=I(0),K=function(){function D(w){this._maxLength=w,this.onDeleteEmitter=new P.EventEmitter,this.onInsertEmitter=new P.EventEmitter,this.onTrimEmitter=new P.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(D.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"maxLength",{get:function(){return this._maxLength},set:function(w){if(this._maxLength!==w){for(var _=new Array(w),F=0;F<Math.min(w,this.length);F++)_[F]=this._array[this._getCyclicIndex(F)];this._array=_,this._maxLength=w,this._startIndex=0}},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"length",{get:function(){return this._length},set:function(w){if(w>this._length)for(var _=this._length;_<w;_++)this._array[_]=void 0;this._length=w},enumerable:!1,configurable:!0}),D.prototype.get=function(w){return this._array[this._getCyclicIndex(w)]},D.prototype.set=function(w,_){this._array[this._getCyclicIndex(w)]=_},D.prototype.push=function(w){this._array[this._getCyclicIndex(this._length)]=w,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},D.prototype.recycle=function(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]},Object.defineProperty(D.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!1,configurable:!0}),D.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},D.prototype.splice=function(w,_){for(var F=[],v=2;v<arguments.length;v++)F[v-2]=arguments[v];if(_){for(var s=w;s<this._length-_;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+_)];this._length-=_}for(s=this._length-1;s>=w;s--)this._array[this._getCyclicIndex(s+F.length)]=this._array[this._getCyclicIndex(s)];for(s=0;s<F.length;s++)this._array[this._getCyclicIndex(w+s)]=F[s];if(this._length+F.length>this._maxLength){var y=this._length+F.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=F.length},D.prototype.trimStart=function(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)},D.prototype.shiftElements=function(w,_,F){if(!(_<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+F<0)throw new Error("Cannot shift elements in list beyond index 0");if(F>0){for(var v=_-1;v>=0;v--)this.set(w+v+F,this.get(w+v));var s=w+_+F-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(v=0;v<_;v++)this.set(w+v+F,this.get(w+v))}},D.prototype._getCyclicIndex=function(w){return(this._startIndex+w)%this._maxLength},D}();b.CircularList=K},function(ge,b,I){"use strict";function P(K,D,w){if(D===K.length-1)return K[D].getTrimmedLength();var _=!K[D].hasContent(w-1)&&K[D].getWidth(w-1)===1,F=K[D+1].getWidth(0)===2;return _&&F?w-1:w}Object.defineProperty(b,"__esModule",{value:!0}),b.getWrappedLineTrimmedLength=b.reflowSmallerGetNewLineLengths=b.reflowLargerApplyNewLayout=b.reflowLargerCreateNewLayout=b.reflowLargerGetLinesToRemove=void 0,b.reflowLargerGetLinesToRemove=function(K,D,w,_,F){for(var v=[],s=0;s<K.length-1;s++){var y=s,f=K.get(++y);if(f.isWrapped){for(var c=[K.get(s)];y<K.length&&f.isWrapped;)c.push(f),f=K.get(++y);if(_>=s&&_<y)s+=c.length-1;else{for(var l=0,h=P(c,l,D),d=1,E=0;d<c.length;){var T=P(c,d,D),L=T-E,x=w-h,A=Math.min(L,x);c[l].copyCellsFrom(c[d],E,h,A,!1),(h+=A)===w&&(l++,h=0),(E+=A)===T&&(d++,E=0),h===0&&l!==0&&c[l-1].getWidth(w-1)===2&&(c[l].copyCellsFrom(c[l-1],w-1,h++,1,!1),c[l-1].setCell(w-1,F))}c[l].replaceCells(h,w,F);for(var O=0,U=c.length-1;U>0&&(U>l||c[U].getTrimmedLength()===0);U--)O++;O>0&&(v.push(s+c.length-O),v.push(O)),s+=c.length-1}}}return v},b.reflowLargerCreateNewLayout=function(K,D){for(var w=[],_=0,F=D[_],v=0,s=0;s<K.length;s++)if(F===s){var y=D[++_];K.onDeleteEmitter.fire({index:s-v,amount:y}),s+=y-1,v+=y,F=D[++_]}else w.push(s);return{layout:w,countRemoved:v}},b.reflowLargerApplyNewLayout=function(K,D){for(var w=[],_=0;_<D.length;_++)w.push(K.get(D[_]));for(_=0;_<w.length;_++)K.set(_,w[_]);K.length=D.length},b.reflowSmallerGetNewLineLengths=function(K,D,w){for(var _=[],F=K.map(function(h,d){return P(K,d,D)}).reduce(function(h,d){return h+d}),v=0,s=0,y=0;y<F;){if(F-y<w){_.push(F-y);break}v+=w;var f=P(K,s,D);v>f&&(v-=f,s++);var c=K[s].getWidth(v-1)===2;c&&v--;var l=c?w-1:w;_.push(l),y+=l}return _},b.getWrappedLineTrimmedLength=P},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(_,F){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,s){v.__proto__=s}||function(v,s){for(var y in s)s.hasOwnProperty(y)&&(v[y]=s[y])})(_,F)},function(_,F){function v(){this.constructor=_}P(_,F),_.prototype=F===null?Object.create(F):(v.prototype=F.prototype,new v)});Object.defineProperty(b,"__esModule",{value:!0}),b.Marker=void 0;var D=I(0),w=function(_){function F(v){var s=_.call(this)||this;return s.line=v,s._id=F._nextId++,s.isDisposed=!1,s._onDispose=new D.EventEmitter,s}return K(F,_),Object.defineProperty(F.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),F.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire())},F._nextId=1,F}(I(2).Disposable);b.Marker=w},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.OptionsService=b.DEFAULT_OPTIONS=b.DEFAULT_BELL_SOUND=void 0;var P=I(0),K=I(11),D=I(33);b.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",b.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:b.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:K.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",convertEol:!1,termName:"xterm",cancelEvents:!1});var w=["cols","rows"],_=function(){function F(v){this._onOptionChange=new P.EventEmitter,this.options=D.clone(b.DEFAULT_OPTIONS);for(var s=0,y=Object.keys(v);s<y.length;s++){var f=y[s];if(f in this.options){var c=v[f];this.options[f]=c}}}return Object.defineProperty(F.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},enumerable:!1,configurable:!0}),F.prototype.setOption=function(v,s){if(!(v in b.DEFAULT_OPTIONS))throw new Error('No option with key "'+v+'"');if(w.indexOf(v)!==-1)throw new Error('Option "'+v+'" can only be set in the constructor');this.options[v]!==s&&(s=this._sanitizeAndValidateOption(v,s),this.options[v]!==s&&(this.options[v]=s,this._onOptionChange.fire(v)))},F.prototype._sanitizeAndValidateOption=function(v,s){switch(v){case"bellStyle":case"cursorStyle":case"fontWeight":case"fontWeightBold":case"rendererType":case"wordSeparator":s||(s=b.DEFAULT_OPTIONS[v]);break;case"cursorWidth":s=Math.floor(s);case"lineHeight":case"tabStopWidth":if(s<1)throw new Error(v+" cannot be less than 1, value: "+s);break;case"minimumContrastRatio":s=Math.max(1,Math.min(21,Math.round(10*s)/10));break;case"scrollback":if((s=Math.min(s,4294967295))<0)throw new Error(v+" cannot be less than 0, value: "+s);break;case"fastScrollSensitivity":case"scrollSensitivity":if(s<=0)throw new Error(v+" cannot be less than or equal to 0, value: "+s)}return s},F.prototype.getOption=function(v){if(!(v in b.DEFAULT_OPTIONS))throw new Error('No option with key "'+v+'"');return this.options[v]},F}();b.OptionsService=_},function(ge,b,I){"use strict";var P,K=this&&this.__extends||(P=function(l,h){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,E){d.__proto__=E}||function(d,E){for(var T in E)E.hasOwnProperty(T)&&(d[T]=E[T])})(l,h)},function(l,h){function d(){this.constructor=l}P(l,h),l.prototype=h===null?Object.create(h):(d.prototype=h.prototype,new d)}),D=this&&this.__decorate||function(l,h,d,E){var T,L=arguments.length,x=L<3?h:E===null?E=Object.getOwnPropertyDescriptor(h,d):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(l,h,d,E);else for(var A=l.length-1;A>=0;A--)(T=l[A])&&(x=(L<3?T(x):L>3?T(h,d,x):T(h,d))||x);return L>3&&x&&Object.defineProperty(h,d,x),x},w=this&&this.__param||function(l,h){return function(d,E){h(d,E,l)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CoreService=void 0;var _=I(1),F=I(0),v=I(33),s=I(2),y=Object.freeze({insertMode:!1}),f=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),c=function(l){function h(d,E,T,L){var x=l.call(this)||this;return x._bufferService=E,x._logService=T,x._optionsService=L,x.isCursorInitialized=!1,x.isCursorHidden=!1,x._onData=x.register(new F.EventEmitter),x._onUserInput=x.register(new F.EventEmitter),x._onBinary=x.register(new F.EventEmitter),x._scrollToBottom=d,x.register({dispose:function(){return x._scrollToBottom=void 0}}),x.modes=v.clone(y),x.decPrivateModes=v.clone(f),x}return K(h,l),Object.defineProperty(h.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),h.prototype.reset=function(){this.modes=v.clone(y),this.decPrivateModes=v.clone(f)},h.prototype.triggerDataEvent=function(d,E){if(E===void 0&&(E=!1),!this._optionsService.options.disableStdin){var T=this._bufferService.buffer;T.ybase!==T.ydisp&&this._scrollToBottom(),E&&this._onUserInput.fire(),this._logService.debug('sending data "'+d+'"',function(){return d.split("").map(function(L){return L.charCodeAt(0)})}),this._onData.fire(d)}},h.prototype.triggerBinaryEvent=function(d){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+d+'"',function(){return d.split("").map(function(E){return E.charCodeAt(0)})}),this._onBinary.fire(d))},h=D([w(1,_.IBufferService),w(2,_.ILogService),w(3,_.IOptionsService)],h)}(s.Disposable);b.CoreService=c},function(ge,b,I){"use strict";var P=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},K=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CoreMouseService=void 0;var D=I(1),w=I(0),_={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(f){return f.button!==4&&f.action===1&&(f.ctrl=!1,f.alt=!1,f.shift=!1,!0)}},VT200:{events:19,restrict:function(f){return f.action!==32}},DRAG:{events:23,restrict:function(f){return f.action!==32||f.button!==3}},ANY:{events:31,restrict:function(f){return!0}}};function F(f,c){var l=(f.ctrl?16:0)|(f.shift?4:0)|(f.alt?8:0);return f.button===4?(l|=64,l|=f.action):(l|=3&f.button,4&f.button&&(l|=64),8&f.button&&(l|=128),f.action===32?l|=32:f.action!==0||c||(l|=3)),l}var v=String.fromCharCode,s={DEFAULT:function(f){var c=[F(f,!1)+32,f.col+32,f.row+32];return c[0]>255||c[1]>255||c[2]>255?"":"\x1B[M"+v(c[0])+v(c[1])+v(c[2])},SGR:function(f){var c=f.action===0&&f.button!==4?"m":"M";return"\x1B[<"+F(f,!0)+";"+f.col+";"+f.row+c}},y=function(){function f(c,l){this._bufferService=c,this._coreService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new w.EventEmitter,this._lastEvent=null;for(var h=0,d=Object.keys(_);h<d.length;h++){var E=d[h];this.addProtocol(E,_[E])}for(var T=0,L=Object.keys(s);T<L.length;T++){var x=L[T];this.addEncoding(x,s[x])}this.reset()}return f.prototype.addProtocol=function(c,l){this._protocols[c]=l},f.prototype.addEncoding=function(c,l){this._encodings[c]=l},Object.defineProperty(f.prototype,"activeProtocol",{get:function(){return this._activeProtocol},set:function(c){if(!this._protocols[c])throw new Error('unknown protocol "'+c+'"');this._activeProtocol=c,this._onProtocolChange.fire(this._protocols[c].events)},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"areMouseEventsActive",{get:function(){return this._protocols[this._activeProtocol].events!==0},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"activeEncoding",{get:function(){return this._activeEncoding},set:function(c){if(!this._encodings[c])throw new Error('unknown encoding "'+c+'"');this._activeEncoding=c},enumerable:!1,configurable:!0}),f.prototype.reset=function(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null},Object.defineProperty(f.prototype,"onProtocolChange",{get:function(){return this._onProtocolChange.event},enumerable:!1,configurable:!0}),f.prototype.triggerMouseEvent=function(c){if(c.col<0||c.col>=this._bufferService.cols||c.row<0||c.row>=this._bufferService.rows||c.button===4&&c.action===32||c.button===3&&c.action!==32||c.button!==4&&(c.action===2||c.action===3)||(c.col++,c.row++,c.action===32&&this._lastEvent&&this._compareEvents(this._lastEvent,c))||!this._protocols[this._activeProtocol].restrict(c))return!1;var l=this._encodings[this._activeEncoding](c);return l&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(l):this._coreService.triggerDataEvent(l,!0)),this._lastEvent=c,!0},f.prototype.explainEvents=function(c){return{down:!!(1&c),up:!!(2&c),drag:!!(4&c),move:!!(8&c),wheel:!!(16&c)}},f.prototype._compareEvents=function(c,l){return c.col===l.col&&c.row===l.row&&c.button===l.button&&c.action===l.action&&c.ctrl===l.ctrl&&c.alt===l.alt&&c.shift===l.shift},f=P([K(0,D.IBufferService),K(1,D.ICoreService)],f)}();b.CoreMouseService=y},function(ge,b,I){"use strict";var P=this&&this.__decorate||function(_,F,v,s){var y,f=arguments.length,c=f<3?F:s===null?s=Object.getOwnPropertyDescriptor(F,v):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(_,F,v,s);else for(var l=_.length-1;l>=0;l--)(y=_[l])&&(c=(f<3?y(c):f>3?y(F,v,c):y(F,v))||c);return f>3&&c&&Object.defineProperty(F,v,c),c},K=this&&this.__param||function(_,F){return function(v,s){F(v,s,_)}};Object.defineProperty(b,"__esModule",{value:!0}),b.DirtyRowService=void 0;var D=I(1),w=function(){function _(F){this._bufferService=F,this.clearRange()}return Object.defineProperty(_.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),_.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},_.prototype.markDirty=function(F){F<this._start?this._start=F:F>this._end&&(this._end=F)},_.prototype.markRangeDirty=function(F,v){if(F>v){var s=F;F=v,v=s}F<this._start&&(this._start=F),v>this._end&&(this._end=v)},_.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},_=P([K(0,D.IBufferService)],_)}();b.DirtyRowService=w},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UnicodeService=void 0;var P=I(0),K=I(79),D=function(){function w(){this._providers=Object.create(null),this._active="",this._onChange=new P.EventEmitter;var _=new K.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}return Object.defineProperty(w.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"activeVersion",{get:function(){return this._active},set:function(_){if(!this._providers[_])throw new Error('unknown Unicode version "'+_+'"');this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)},enumerable:!1,configurable:!0}),w.prototype.register=function(_){this._providers[_.version]=_},w.prototype.wcwidth=function(_){return this._activeProvider.wcwidth(_)},w.prototype.getStringCellWidth=function(_){for(var F=0,v=_.length,s=0;s<v;++s){var y=_.charCodeAt(s);if(55296<=y&&y<=56319){if(++s>=v)return F+this.wcwidth(y);var f=_.charCodeAt(s);56320<=f&&f<=57343?y=1024*(y-55296)+f-56320+65536:F+=this.wcwidth(f)}F+=this.wcwidth(y)}return F},w}();b.UnicodeService=D},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UnicodeV6=void 0;var P,K=I(15),D=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],w=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],_=function(){function F(){if(this.version="6",!P){P=new Uint8Array(65536),K.fill(P,1),P[0]=0,K.fill(P,0,1,32),K.fill(P,0,127,160),K.fill(P,2,4352,4448),P[9001]=2,P[9002]=2,K.fill(P,2,11904,42192),P[12351]=1,K.fill(P,2,44032,55204),K.fill(P,2,63744,64256),K.fill(P,2,65040,65050),K.fill(P,2,65072,65136),K.fill(P,2,65280,65377),K.fill(P,2,65504,65511);for(var v=0;v<D.length;++v)K.fill(P,0,D[v][0],D[v][1]+1)}}return F.prototype.wcwidth=function(v){return v<32?0:v<127?1:v<65536?P[v]:function(s,y){var f,c=0,l=y.length-1;if(s<y[0][0]||s>y[l][1])return!1;for(;l>=c;)if(s>y[f=c+l>>1][1])c=f+1;else{if(!(s<y[f][0]))return!0;l=f-1}return!1}(v,w)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1},F}();b.UnicodeV6=_},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CharsetService=void 0;var P=function(){function K(){this.glevel=0,this._charsets=[]}return K.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},K.prototype.setgLevel=function(D){this.glevel=D,this.charset=this._charsets[D]},K.prototype.setgCharset=function(D,w){this._charsets[D]=w,this.glevel===D&&(this.charset=w)},K}();b.CharsetService=P},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.updateWindowsModeWrappedState=void 0;var P=I(3);b.updateWindowsModeWrappedState=function(K){var D=K.buffer.lines.get(K.buffer.ybase+K.buffer.y-1),w=D==null?void 0:D.get(K.cols-1),_=K.buffer.lines.get(K.buffer.ybase+K.buffer.y);_&&w&&(_.isWrapped=w[P.CHAR_DATA_CODE_INDEX]!==P.NULL_CELL_CODE&&w[P.CHAR_DATA_CODE_INDEX]!==P.WHITESPACE_CELL_CODE)}},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.WriteBuffer=void 0;var P=function(){function K(D){this._action=D,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return K.prototype.writeSync=function(D){if(this._writeBuffer.length){for(var w=this._bufferOffset;w<this._writeBuffer.length;++w){var _=this._writeBuffer[w],F=this._callbacks[w];this._action(_),F&&F()}this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=2147483647}this._action(D)},K.prototype.write=function(D,w){var _=this;if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(function(){return _._innerWrite()})),this._pendingData+=D.length,this._writeBuffer.push(D),this._callbacks.push(w)},K.prototype._innerWrite=function(){for(var D=this,w=Date.now();this._writeBuffer.length>this._bufferOffset;){var _=this._writeBuffer[this._bufferOffset],F=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(_),this._pendingData-=_.length,F&&F(),Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(function(){return D._innerWrite()},0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},K}();b.WriteBuffer=P},function(ge,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.AddonManager=void 0;var P=function(){function K(){this._addons=[]}return K.prototype.dispose=function(){for(var D=this._addons.length-1;D>=0;D--)this._addons[D].instance.dispose()},K.prototype.loadAddon=function(D,w){var _=this,F={instance:w,dispose:w.dispose,isDisposed:!1};this._addons.push(F),w.dispose=function(){return _._wrappedAddonDispose(F)},w.activate(D)},K.prototype._wrappedAddonDispose=function(D){if(!D.isDisposed){for(var w=-1,_=0;_<this._addons.length;_++)if(this._addons[_]===D){w=_;break}if(w===-1)throw new Error("Could not dispose an addon that has not been loaded");D.isDisposed=!0,D.dispose.apply(D.instance),this._addons.splice(w,1)}},K}();b.AddonManager=P}])})},93314:function(yt){"use strict";yt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAACaCAYAAADl9acYAAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQd4U1Ubfs/NaJtO9kzLahFQEJkiUBBFUFFkCCjiAAVFERT5FREQQQXBBcpysWRP2RtkKRsEOphNodCZdDfjnv85CU2TZt2bhABNDw9PmtzvrO+c957xLQIP0pkz1yrQIEmwwcDzHhTj91klEo7jpcG5zetWUJdmRjmPvTM9GI9JgSGvadOoLE9KJJ5kPp2YXLtZdO1kT8ooz2vigCNelvPYezPEG7z0CDAn4pJqPvJA5A3vdcl/S3LEy3Iee29OeIOX5YDx3nh4VFI5YDxin6DM5YARxKb7g6gcMHd+nMoBc+d57LKGhCQ1ZURBCoVL2nKCO8sBZWW50x1TOWDuLP8FlV4OGEFs8glROWB8wmbPKikHjGf882bucsB4k5t3qKxywNwhxrpRbJkGTOx0ehlA3d9e5VEtzA3ulGe55zmg1QOfrCVo34BgQGvr5rLDRl4RRZG+5NjBESBc4FHw1LlrCAuPsCo0JjKi7J5hYqfTXADBq4byCJLf82Nf3kA3OfD9LgKdgeCzZ4CUTJ1VKQFyKQgpmeMSjiKvQC+oplspN/wOMDcBVFv0Bo+KwYJ4VE50H3Jg7j6CWzkEX74A3MrSgTfeKZpSaBCHcAVn/JunBHlFPDR5BkG9LMjPt7mZLOtbskQADea9wqOW9coqiGHlRPcHBxYcJriQQvB9P+v2cqCwWFxgoOJk6JeTNX4HmJMAHv6xP4/6VXw/+OxNx/bM/pIohdUE9VW/VxwjOHiJYO5A6xolpGSpYW3jIW4w/A8wM+h+UHSY2pvHgzV9NXymeor0wPc7Cf7XzWJ/4Nsm+Ly2LzZx+OwZ3yuVbzhNsPEMwcI3rM8wMikHiURi5gNbbQoKrc84zpjkj2eYzQC6f96DomUd305ctrp8tp5gSk/f1utzlFhUOHYthy9f8D1gdpwnWHiEYOVQ6zNM6QM/AY+CImHnF9YtfwTMCgB9P+5G0SHa9xP3bk2gT9cBU3r6Hjp95nBYNcz3gDlwkRhX843vlfS59PmFHfjFzgC/2pJ1nEEnEIpIAG+834Wia2Ox7PJ8wt0twLz7J8Gsl3zf316zCVYPsz5oe85F1yUcu0YwcQPBjlElZyjL8wsrQeyBn+XxK8DETqefgyACFCPe6kjxfDPfT6C7BpilBLMG+L6/A34h+P1VikCZ60nuTYpzN4AxqznjCqPOMZ1RSp9f2OVLYZH1lbOrNvjVlswIGEAKYOyrj1K82NL3E+huAWbEMnbFSn1+Qzd4AcE3fajPZV6X04D3lnHGM4xOawKFJwLLYiD5H2AoCkHwJQMLA42v090CzJjVBBN7UCh8rN3AgDrqCYq6lX3L6RQ1MGQRhwWvA7UrALbnFzCJjOhG+d2WjFCkUYKZPZpSDIv1PWDGrycY34NCahI0+yxN/Ivg3c4UlUN8VqWxok/XEfRrSdG0tm/rzcoHBv7KYc5AILqqLWDcOb/45RmGEFyhFL8/0Yga33y+Tl9uJhjxOEVIoG9rnrqVKSJSRFb0fb3tG1A81sC39TLRSu85HL57Eaii0Bm3oqEKqZXSJaUURUxTU0Tyuy0ZAc5SYCUbxE+6+x4w3+0kGNiWooqP3/Qz9xB0bUTRsLqI2eEFUlbvA9WBJxv5ltdMit9jFocpLwB1InQIkBEQTmLUHStOBoMBOr24K2+/AwwPHOKArS2iKCY9VzKIg34jyMgTv6f1wpwqL8JLHKgUTLHwjZIxZTKg0V2Bzg2tLzvYBYA75xe/25J1mkEnGAzYyXE40KQmMK23uLeLN8b1j0ME7epTxFTzRmnCy/jzXyCqIny+NVryDzFeKfd+xLcrDOMMO8MMfgx45iFrOZA7AstiTvvVoZ91usM3tClHcLpeZWDmAN8DZtlRgkY1KJr5+BC87hQQLAeebCwcZN6gXH6MgG2P+rfyDmD+WLoV8xZugkIRiNh2TTHghcfRoF4tFBZpkXgpGQ81rmdu9puLOLzwMPBYPR1Cgzw/v7CC/WpLxjrc/jtaT2LApRrhwC+DfA+Y9aeI0dKzbT3vTCChk3r7eaBABzzfTGgO79CtPUmM9b7U2jv9bf3kOyjSlihLcoSg93MdkZ2Th227j2Hoq8/inTeeNzZ+xFIOsTHAsw/pAeL5+cUvAdPuG1pVRnArQgEsGex7wGw7RxAgBTo19M4EEjqtD1wEkrPYm15oDu/QbfkPSM0hHsu8du0/gSnfLkFGVrbThjFLynULJ6FOZHUw2RNbyd/qUJLFHZV+ywr9aksWO4Ou0BK8KueRz/bVq++CUuD+RGbhB3R/0LeAOZEEnFIRvPGYb+vdGw+cvU7w3uOe1dv+mfeRk5svCMUfvz8AA3o9jgkbCJQVgPe7lGTz5MDvj4f+VXs/JH1ip1PmAkHy17u8z42bjl4lxjf9C809m0CCZo4FUVwKsDPOJLz0ZTp6Fdh6jtnWe1bvuCm/4q/tRwQ1/b03e2LIwGfw1RaCkADg425AOvPkYCHZd0cG43dbsk4zaDFgWHiHcG85wjBQoEhnMhAzf5r/Jihkf9/+fjXDtDXqGA108+Eqcy0DYAfwMU95NnEFzVgLovibwK8HCab19qze61s24Pf5K7A5KwB5vHM1CblMij9m/Q87rtc1jsek54CMPIBayGD0BgP0ImUw/gwYFiqjllhHGAcvAkuPcijU8cgv0KGgSGv8LNJqweu1MOh14A3ss+S78W+Dzuo3RsPoTy0YgIjQALFz0C36tBzg570EE3p4NnHFVn5TA0zaSPDzy57Vu2bIS6jF67BDHYBHgnVI0kow+6ZjLyZNm9RD+35jkZINfNO7ZIVhEn+e16NQ6157/OqWjJ1h9n1IXoydTi8AeGD+KzxqinCEsfkswfBJC2HQacXOG7v0B+e9CGXVUK+U5aoQdm5iE3eqh296R/XoDEBu0e3/hcz3FzF+Z292trI91Zgav7N2tKrDrrfFTdgTI4dAl61BipZDDXYINRCMvBrusNvBikAMHT8LTM3/pwElK4xMAuQV6uBuKK4yA5hEVfY8SvmmHCETGyjDtzqbQLHf0KMgaCnWEcaW/whGT1mAHHZP6oW09bueaFy3khdKcl0EO+y+v4xgphs2MWxbs+K46bLCDIoi6+9iVLKY4PbTp8UB5t8h/UB53qimz1aJA9lyLExz7H1vyMCnUa15L/x9EfhtkIk/nh74y9ShPz5JnUGA26qFZIdcTofWqR5xxd5Uip1O9wDoJNYRxs4LBB9PXYxUdaHrGSqAYuWUp9GmSQ0BlN4h8cTq8qVfOGgKStpBeAoJb4DEYPrPsU89b/5e/LvEYPubLCIQX06NEtWpfwa/yA4h0FEgqVCK71OCUeTARdLLfbpg9PAXsfGsBBtOA0uHmKpyV0PZsqFl5lo5QaXWgRqNw4pTHiEYGa2M+KX0yMROpxsA9BDrCGNvAsG4GcuQdMt45eJx+nXsk3iyNbOY9k161wOry8/GqZCr1t4GBA/O3T0Nm7gSDl/89IBRHiU0nRk3CgU3knEmT4pZN51rrjI5TN2oGmCOMP44BKx7B8jINemP8ZRCK2Y5LNXAMrMlS0hSpwKw9TRGME+XHf5ekybEfPCInU7/BDBArCOMw5cIPvt+JRJUGqHj7JRu2rsd0P+JGBuanELTTVpwwO3/cnjFxNcTwMz95hquxud5pd+skIEfR6NJA+F2y6o1S3Fj4xpj/X9lBmK7OsDuChMUKMf+v36AXC4Fc4QxYwew/X0gM8/k5VKvN0BvcF9gfc8CJuGWuh4twgoQnJSBzK+nDP+3eLTsBahJSNL8DdD29kaUAFsDSU4vpVJp3FTETqdzAbwl1hHGySSCCTPX41RimlcmzthBrTCsV1Obss5cJ2hWXQupTIoiHUW+1nRYZkcn5kRbTzlIOQq5hBmimfRu2RwoeU4gl5rAFiI3Odpmb/NRK0zXu+zgKzZtWZWK/VvTxWZzSP/EK5HoEivcxsFQWIBzk8caVxmWmMT+g6thNlfMg/p1xYfv9DXSMEcYEzYAu247wnBXQ9myE/fslixRpf6FUgw2N5bgDChmk6Lw33MMqkqlg8JeVKmn8hRjHI0QIdgbiJynGWhiZ9AZoPhgaEeK50Q4wmDCvwmzt+HwGe8EcH67V1N8MshWV4UBpnlNLQID3Lcn5nkKrZ6iUEex4azEqC08di0BW1XDgsTP+2NHsrH6F+/0m9Xetns1PN9b3IWHPi8XyetXIOPoEeg1WbhYKMGK9CCoiiSoWq0SnuvWzqhLVuyoz+wI411mmi3epZI9Lt2zgElIUht9INtpdDJPMUsSGf59NCFFxc8TknI6AoZ9LqbCmj+V4X33zMAEAOMHtaXoJ0KLVpUJjJuzD3v+vSh+xtnJ0ffxaMwY0dHuCtO8pg6BAcK3LI4axCTai/4hRsBM3kww5DGK6o5vYx32S52pw9QxbEi8k6o2DMeoj2q5VVhqNnB29JsI0TP5M6Dj5Gg7dwmkpVZOsyOMtyg4joDyBhRq3d+Osbru3S2ZSp0LCmf+9ZM5CUY3qBWx3LREUy5RpbkKQOl0FAimvrksPAME08Q6wmD74DGz/8H2A/+5NdClM8U2r4VFE7rZBcwjtXQIkHsOGLbSLP7XBJhvdxD0fJiinhs+pVk5n41IBM/UFryQSHggvpxRooovpsgdFwjoD8MQri3ZIso/XYzm9a2FwDfUAFPxX/AaRYSCeCR/KW7fvQuYJE0RQF3vSQh2UQn3bsOaYXEJSZrPADrJBfP5BceCVx+4LO0r1hGG3gC8//Np/LXrmJjxdUhbv1YE9vzU22eAmbOPBRmieNCNFzvP8/jhaxVSL3vn4M9zBJN/bgSZgJsyplZ0KQ24oSZgq8vmE4V4+9hrkNIS8O5uPhbNOz+CprWpWRhd7Ahj9svMYM871rT38pbM/q2XvelHoeU4bpxBgt+Jjr8MAqfi80NXZEW/H1UEuOMIY/zCRPyxZr9XABMSJMP5pbelahYlsjNMi1p6402Pp8lyhWEhIBpVp2hdV1yp6nwgPAhYvzQF/+zOEpfZCfXgz6LRIMrxKsq0B5YcKsL6UxRFvBygelBdLjhZGMCx/RfTKWMCUGZzbAClvJEmtiGH97oEGLdhzBHGjL4UDyvLOmBUmn9AaamAay7GimAXgdErzG1RlX36k9el+PlgsPFtK9YRxtwtNzBl7havTZoLywYhuJRbSCNgauvBlAg9TQYDjyVHOeOWbOVxoEoo0Mn2JttpNZvOcmhfn0KTXoTr8TlITSnCrRSt8TMvV7gj79KVPDskCo+1tb/rZkLScavzcTlTARBrZUu+MB1coHNHZ8rQXEzvH4T+8yWY9DzQrj6QptFDzzRlPUj37JbM5pZMeCfZK5CNgsPt3PlbEny3LwSlHWEIqWLzcTWGfbFaCKkgml0zeyNaaa3QdqcAs+msSa2k+4OCmmYm2nyWQ98W9idabo4eqSla3EopMn6m3mRgKkJ6KlM6dV5Plz418ES3CjZE7Ar9w2X5UGXbv3bmC1NBAiqBEOf34zFhKlzLq40PuxK0i8qFutBzRdd7FjDx1zSDCKELxA2tmZoyyztqqc9tUdDlDAm+2hUCdxxhHIwrwOAJy5EvIkSCsz78Nq4rnmhpfU/BANOytgEydwQmpSpjQro/b68we+JNArzej4jjKouz0q+luDwGAzWCxnI1Kr0qPfpEZTzXv6pVwUzf6+MVBTiX6vi+hxoKQfUF4AJswWZZGF+UCUN2IsYMaINnbcVd4jp0m/qePcNcvJlTldcaUm5vVN3qnKNM1zUcJm4LhTuOMP65qMWYGWtxJcU76jGT3nwUrz1j7ZnCCBilAbLS96RucIFJtv88ZpLD/HMZSEgFXmkrrqANp2yjEYsroYRar6f44I3zxh9qNwnH8FHWNxBLj2ix6F85SKltmGV9lBrAF6RConCuh8fotCn7MSC2Fob3ELkPddDBexYwrL2JSZqtFPQpdwfHUT7mf+zjTWFwxxHG8St6zPhtCw6cZXcSnqdhLzTF2FethZcMMK2UBki9DBgmbz18mYAJbMUk5shiYBsxORzT5ucZ8PHbcUaC4OpBGDe55AbiShqP9/40gHLOt058UZbxXMPJnQuUKK+DLi8DEs0R/PJBLIIVwjULHPXgnt2SsQbHq7JeIJSYFIi8mNgeeeT6cFRQAItFOsL4L5li0do9WLrLriK06FZ2e7QO5v3PwugcgDcBo9MbsPT2CnMxFcYwdiNFuMhlKjcs/J23AMMEoONHJhj5JA2T44tvS2TTo5cX4kKqY5X9YuYacq9CEhzlMngmr8uGQasFLUpDPcUV/DCiKwrcNBwrrvueBsyKFVTSvG32aQraRPRMdJKBWaa+vSrcqNAo1hEGsyD8Y/1R/LzmjFea1EBZAbtn9rIqywiYSB5Siecey3U6A5YeN23JmCCPORIcK8IWhV0ps1Wpj8hzjyPmsDPN5P+ZNCWInMOXPz9g/PtgohZfbpEZ3SE5TxSGXBUkIa61vPnCDLCzFEuGrOMY1q02Xunq2VS6p7dkrKOJ17N7UAPP1PG9moatCoOBJ9go0hEGe+P+vC4e3yw84JX2VAoLxMmFL9sApnUkD4kXAKPV6bHsuNQIGDb5p28nmCwixmZSJnA5jeCZh1x3NzfpKi7M/xlFGRmo0qoNqnfohPAG1mcH1dUCfDP+sqkwjuCreY2Mf478swiJGa6V3Az518EFVgHhXMu0DYUZ4G8Dhuqy0Sg0EfM+8myHf88DhjEzIUmzAaA9XA+ZcIqR60KRp+XgjiOM3Sdu4s0vtyAkSIrgQCmCg6QIYZ+BMuPf7Dfzs9vP2bPi34ICZTh2szJ6NM41HuyrV7f2G8tWmNZRPCSc5yuMJWCYGcjHawm+7Sv8DPPfdSBfS9C5oWveHhg+GFqNyfRBEhgIeWgY2kz7AZysRDh5KT4fP0y5vZ0lwBdzGoO9FwbOK4S6KMDpCkP1eaD6fCNghCSDNhe8zmTsVznrMD59XIGa7Wx194SUVUxzT2/JihuZmJJThWoNZ0HgNY/EH28MRUY+B7GOMFibcrJzkJuXB3Z1zXHc7U9ivNlh0mX2aXpm/7ekLA57E6R44zHm5slWAs0A0ybKpDDoaWLhHJafMK0wLIm1ujx0iYD56WgrQO3ryuplSN6xzajkqM83+RCr1aUrol95A5zUJIT971QO5n2bZPybXYRNntsYvx4guLJrL1qkbsD2moOQHP6wlUskRkt5PfiCm5AEC/exa9DmgNcVoVL2KQy59RsqhAQg6tPvwAU5U1F0zvH7AjCsC4mqnE6UGpitvsfSJ0IIHb8lmNzIlkCsIwxPJzDLf10NrDtJMNyBjzDvAkaH5SdkbgOGOf5oVAN4sKawnl+YOwspf+81EzPIh9VvgCbvfoDAKlVx9JAai+ZcNz4PVBBE9W+M07uPo9/laeBgknSeC22ObbVeQ06QCRzselivuQhZBNveCX+JGAoyEZEThyE3fkIYNa00yh69UPdF6y2wsJ6ZqO6LLZl5pUlW9wHFMkrh6mTokgdf7QzG5UwpxDrCcFmwAAImPPztIMHorva3RkbA1GEhGoRPDkfVMj/EVoARaabM2vliCxj9QQtJ1GDAtU3rcGPXDmjVWWDfWWJbtHp9BiCwRScU6KQICJRg4VEp4g8ex4tXvrFSpGT0JxXNsKraIEgVFaHLuQ5ZSE1wAeLsEioRFZ5PnAVlTok5hiQwCG1+mAupwr1V5r4CDGNkgkrzEij93Znqi5CB/XafAhduySDWEYaQsl3RFGiB6Tsce4NkgGlbx+WtqatqjM9ZlOAVJ0tWmPeWEvzYX3gYcOY9cuKzsLE1EVK5oagQJ7/4DDlXS67gZTVqI6dlXxwNaIXrJ06j75UZkFhoHbNyK7Zqh2E3usHAlCupDgFhtSAJEmdsxsqJqZSHevmJaHPoC6vm1nvpNdTu7t6R+L4DjAk06t7M+tKuDb+QkQTw00EFTl2XQawjDIHFOyVj6h+frSeY4uC2it1MRVXgIeUIpBLTWcjdxMJArDgpN2/JPlpF8PlzwoPDjl9v0vZ1N2k1apz+ehJyVaZzS3HimUMKIoWUWrusqtDqUTR46308/bUKekghU1QBkbq+PbPXPkNuEog8DAOS5+ABzVEzSWj9GDSf+JVbXbovAcNs+oODFYSjsp8oqCm2gcj06z9BOHJNbjTZ7RDt/oQQWa2ZXEw0ZWY1yYzYGdCYuj5L7AJNwgBlvHRgj3mjnfvtx0YlS/Zcp9dj6wU5nmpiysccdLMYm5UECr3HruHwQ3/P+KPLzcWZ6VOQfdG5xWbVzl0R9fJgEI7DjO0Eu85rQSTuH1lbV45HbmYSzl1OR+2im4g0ZEJpyETdAC26zpnv1tDdt4AptulPNJ1rplMKUY6uFh8PxL5LARDrCMMtLtvJJAYw3qqTlcOCw7JYLUoBwWHZWWvBIYJxz3jeAiZxv7R0AZJ3bIetdT1B7T4voebTPc0VMbe2G08Wur26sII+6JyD5x4JQU6+FkfOp+DA2es4fO4GsvO1qFk5BE3qVEaTupWNn9G1K0AmILT1fQ8YxhhKqfTi9ewBoPQjSiFAxAasOh2AbfGBRr0qMY4wPJ86phLuFmBm7ibo2oSioYAL+uPXgKvpBIMe9VavgctnE5C7fyuyz58Bc2oRVKMWaj7XBxVbWGuELjxMsOxIAYjUtaqMo9Z90CkHz7WwXkoNPMXZy2k4ePYGDvx3HVdSTHIjBqCVn7verJQJwBQzjKnzJyRlPcZJuJ6UxwsAHEoP/joXgA3nAiHWEYa3ps7dAgyTeTwSRdHcuecDYzdXHCN4oBrwaH3v9Fqr55GWmY2ICNe3XWtOEvyy17MVZmRsLnq2dH4bdv5qBt6Ytg3d29TDOAFvhjIFmNLDGp+c1UxCycs8xTu3jcrMJDvi5VhxOghiHWF4Z+rcvRXGGBy2EvCYABB8sZHggycpqoa6f+lgya/MXC20RUUIDXV9gGJueb/d5tkZ5r0OOejd2nldm/+5gkkLDuOzQe3QrY1r2+0yDZjiwbp4PUNJeelKSqlZSX3/ZRkWHVNArCMMbwFm/AaC8c9Qt65rPWkDCw7Lggw9YVLhcprWnCCoH5qKGmHUaC4tl8sgl0kgl7FPqWhdt6upuQiWc1AoXN96MSd849ez62/31YPeeSwHL7Z1DpixvxzA7hNJWP9lL1RmjgtcJL8ADOOBSkWDCqiGaQoYlYn+TZJh/hEF3HGE4YqpQp7/sC0PrzRPhYxPg9yQjmCkoTA/HUV5aZDq0wBZBQQ0my6kKFE028/BGODpOYHBYfPy8qDT6aDT6Y2flolpUxeDhznscAWkfxKzEFNDAbncteIk8xIzYinxSBj1VrtcvPSo4y0Zs0Z96qPVqFpBgcXjnhXEx/saMCZfZNmTQCjTmZCAEC0oUglPU3iOnDEYtCcb16nCrDaN6ZxKU1HK0xOEIOrMDSlmHnDPEYZLzhoKAW0aivLSQXRpCKRp4HTpKMxNAy1KN36XE+cRAHjKIb/pckhk7h967bXz70STao47wWHZ9bZebwJOMYDY38Zrb4vEtKwZeAKMq5IJSDKZFOuPpqFr8yqCNBjYDd3AXwwgnPu+2Qa3zccrjzleNY7G3cR7P+7G8+2jMWaAMH8r9zVg4pKynudA1jmawExnjKf8fwRkAwF+j46MuJSoyupEKdkdnyoh0/e65wjDUX1c3MdA3hUEEO+YL6fU+BwRNUQa07tAM7v5OpNM8LoXg8PqDXrotHrojUDSQafXgXmrKZ3i0uV4vKkwiT2TJ/WcqYWBBLp8PzkieK1NIV5r71iO8/2qE1i2O8542GeHfiHpvgbMRVX2RzzlpwnpKCGEOa76i5dynxCeTriaTvpP2RnqliMMhwC9MBaBBaeFNEcQTU7FvpDWeU0QrVCiCynA7jjHip9Cy3FFxxz/mVYi0//sPD2u5wWgXUOBSmkAXvtVj7R819s3R215ta0Orz/m2FVVnwkbkJyWa7xOZtfKQtJ9DZiEpKzXAfKbkI6W0JAiQrDyZjZ5adyWUM4dRxiO6qOqRVCkLRPXHCfUt2gjhLXw7jmGBYdl18Uf+Tg47K4LBCz0uZh6P1oJnL/p/qH/5dYGvNnBfv5rN7PRb9JGVAoLwoavrC1enQ3gfQ2YC1ey6kil3CV2lhE7S7MKuMIxf4UGuuMIw1FdhszjCLk6XmxTHNLrqRT5TVdAJnNfPaR04cbgsPsIJjzrmbqL2E4evgxsPy+uXubM7+Vfmbss9661X2lDMdhuABRgyc4LmLnmJGKbKfHlW8KNyu5rwLBBS0zSbKBuWGOyWCoj1rrnCMPRZNEX5SLk3ACmVih2PjmkV9WYiso1RHrec1I7i1HJ5Ct3Kjiso6rPXgeY9P6bPsKB2uSRWKSlZbjNy3FjhuOTD5kIzja9891OnEhMxVs9muHVbsL5e98DJu5ydkNOxh934enfhmPsUDl0ZRgCZUS0IwyHWzJmqPPfcATorrk9yKUzZld5DTKlKUCQNxLr98jlJhV/X6ZrmcBXmwnmDBReb2R0CxQWmiOaiG5uj+5dsOyPH23yMd2ybmNWg6nJfDv8cbRpLDzO6H0PGMaN2zYyi8Q6/Ru+Ogw6A8FfIh1hOBs5evE7KLJ3ih5cRxluSR5FWLNxXiuPFeRJ6D53G5KWC3y4gmDhG8IAw7Ssa9Vlpsrup8jaNXHh+A6bAnYcu4bPfjto/H3z1D4IZ5JcgalMAIb1NVGlHkwpmQ1QwRf3H6wPRU6Re44wHPHXcGMTQm7+LJD9rsnU+soIaO2ux1z75Yu163fdStcUuYXA6wsIVg4VBpjMLDUeaOrgAOK6OjNFcvwhVCiluzbh90PYdvQqqlcMxuovSjSkhRRbZgDDOnsxOaczpYaFlEKQp4Sxm0KQlidxyxGGI+Zqs+IRfuUDIbwXTJMWsxghIc79CAsu7C6Ndg0lAAAdVklEQVStMEws88Jsgg3DhQEmSXUdLdt55hLJuIKs/g2x7UvcdrJtWPcxq40q/h2bKfGViAM/K69MAYZ16NKlzHCDlHwBwr0FUKdr7efbQpCs8a4jjMKCfITHDQRH3d97l578qmqTUblWczGYcErLzjDT+/hej63HLA5r32YOCl135dyFeHTuahtsynVOa4qvPv8II4aVyLJOXUzFsG9NW+bXuz+EISK9lJc5wBSz69KNzEheLxlFQVnEIrvmUlN3B+NiuncdYWi1OsjjP0KQznvxIDVVh0Bem1kreCcZg8N2pwhzX4juVkN6zebwx+u8oHr/OXoCPXrZBpsSW/GAvj3wy6yvzdl+WnsKi3aYnKFPHtIBnZu79qBpWWeZBUxxJ69coYE6ae4zlOqfIyBPM59uxc++36/AuZvedYTBJNz6+OkIL3AVn1b40N8K6oawRu8Jz+CCcvImgiEdKKoLF7p7pe4B8zl8148XVO+uPQcwYNAwj+tt0iga/+4t0Z4a8MUms9HY0vE9ECnUHc7tlpR5wFhyfA+l0lqq7L4A/QlAhTmHgnA8We51Rxh5FxejcvZSjwe7uIAk/cOo0nqK18qbsYPghebUGO7Dl+n1Pzh89iwvqN71G7fhzbc/9Lh5LALCzr+PQVMkR2w0Na4u566m49J1tVElRqyDEb8CTDH3LyblPMhTw67fjwZVPXTV+44wspP2oVq6IBU3QRPiprYWwtvOE0QrhGj2PoKO0dSoR+fL9O5SDm/H8oLq/XP5Gowc7R2tic9/XIlNyU2wY5RH1gJGVvklYFjHL6k0Ty85EbhxV6KceNsRRuatS6h1fYTX5mK+IQR5TZcbDb+8kVhw2MY1KFrV8UZpwsv4ZC3BCw8LC0o7/7fF+HRCydnDWS1FOSmQh1S363aX5XtlxGTEBfbCxveAIMFCB/s1+i1gGDsGL9Cvvpgm6eVtRxgZGZmomTQYHNUKn01OKHlIcEG5AfWE+eB2WefKY0DVMCDWO0G5XNZXTMDOTu3qUzxuinDhNH0/cx6+nGYrpS+diflxLkhPgFRRGfIQ+wzq9OxA5DUei5VDgYruObw0V+vXgOn8LR3L85jibUcY6iw1KiV9CLnhpqt5Ieg5DxkOV16PRyKFyTBcFbrxDPNZJj44rKtyXT1nvsYaVqeC4k1OmfoDfpjl2ncYb9CiMOOS0edyUOVoEGM4cuvUuGkrBHdbgIVvALWs4++6arLNc78GTOx0yq6efvS2I4zs7ByEJY1HkNYUactZ4kkg9FwE9JIKMEgijH8bjN/Z36bftCQcudLaeKC6q9KEPd8dB2Tliw8OK6x0x1Q/7SWoGkrRt4XrksZN/Brzfl3skpB59S9IN13hy0KrQxZkK+ANCQ1Do7ePYO5AoIF1DFqX5Zcm8G/AfENfB8Fv3naEkZubi6CkbxCou2yc9CZARJgBwcCRVlgZV3KC0aSmAhwnQYBcYowHI5FIwIN9MjPfkt/shcUQPdq3Mxy5DLDwfQNFBod1t77ifMyxuVxCBdX7wZgJWLzUdXh3Zh7NtmSgPCQBIQgIt+8/qtmw3fj5zep4yDoGregu+TVgOk2nTNl8pbcdYeTnFyA9U2MMDhQYIIFcwoGTSGCgnHHLECTnIJVIMG2H1BjywtcCRBYc9shlgrdEBocVPbtKZVjyDwGLLyqk3mHvjsGa9ZtdV0k4FGZdBa/NM/JbUcX+wSy692z8PDoWAjwpOa3TvwEzjXajHLa0b0DxSXfvnA9cj3AJxfe7TG5bq4aKyeU5bWIqsOkswcguvu3zyuPE6IBDSL2DBr+Hrdv3uOxshVqNkZqwH7q8NCNtYKUG4CS2V2G1OozE7ClvoZOHFx3+DZjptD0F/m4RRTHpOd9OHja4c/cRdHuQGh3r+TKxScuMuXz9kmDRmM/dgKB6+wwYgv0HjrhkS6+Bb2PlbzNQpDbZILEtGdualU4VH3gaX0/92ii89HZSVpY7NQllzvOLfYG7W7d7Nqe3a/NGA1hR7WfQZhKKU0yAN62396wkhTKFyUPa1qVo6KXDvNB62YH/2x0EXzzv/cnjrA07zhPsT4SgepkeGdMnc5V++nE6Phz/PTITmEIlhSykOmQK24M/W3mmzV2Lpxp7f5z9BjCPT6P1DRwuetMRhqsBtnzOnFHEVAMeVvp24hbpmata4lHcFzH9LKZl8TJXn4Cgep98+kWcPmtSknSWVi/7BZNmrsc/G2eC1xVAqqgEeYjtVRjhpPji1wN49qE7x+uYyAi7C4E3XvA+XWFU6Vo1ABsP2MzJwvDlMnjTEYarAbZ8zrYoVUKBR+vduUF01J67YUR2OhmYs49g9suu+9uhy/OIT2DyFedpz/bVWLXtFL77/F3o8zMhCQxHQJh9nZ/RU5diYJc7p95QZgCTnKHLppTaHK3Zm3bwYhkqKIDFg72/VLsabLZFYbYhnRu6nkCuyhL7/G4AJuEWwKT9QsyUWz3WDdeSkl1268zR3ThwLgtDBzyFIo0KnDwYgRH2VfYrP/jCzKTdX3pPZ8ll60wE990Kk5yhi6OU2kSaZx5OBy2UIkDqPUcYAnloJDtwkSC7AHj6Dm4THK4wIoPDiumXI1pVJjBqBcGqYa5fEA+16IxbqaabL2cp+dJJ3MqRoGXL1si7cRKcNAiBFe2vIopqDZemn133kqsyvf38fgTMJkops4WxSUOWSFGoI9joRUcYQhl+SgUkZZK7EtBp3DpgsjhzdqHdckiXlQcMWcReTq4Bw+z5mV2/sxQcrMCVuH+NoQof7DwESf/+aTz4B1WyH8tDHl7zhDpxlwA9A4+7alXAfQcYVYb2V1C8YY8N7y6XQl1AsGoojyD3vZK6zWHm9siDmK9u13u3Mgrtb71GbZCbm+e0mbVq1cDJIyavMK99OAvrfp0IfVEOFJWj7earUKUG9mxZ45WuOzqv2Cv8vgNMcqZuCuXpWHudGb1GipvZxKuOMLwyIn5eSGSDR8AiQDtLDzZ+ALu3rTKSzPrzAMa//xK0OSlQVLHZfd8uhuDQ/p1QKDyPiFCmAaNK17KD3g/2mP/ZXxJcyeAw/xUeNT3UZPXzOe7V7tes2wx6vcFpme3btcaa5SbX2gfP56Dnk62NipiKqo7tB1at+BMPPdjE47a6kr1YVnD/rTAZ+r6U8ivscWnyVgnibnL4sT+P+l6yN/F4NMoLQLXIh2zizpRmy9PduuCP+ab3YE4h8OCjzyMzfrvDMwyjm/rVZPR8vofHHC7TgLmRpetoMFC7Ximm75TgVDJn1G96srHrw6jHnC4vQBAHqipd+zvu/2JP/Dhjsrm8zv0n4sSWHx3KYRjh0DcH44NRnt8sl2nApGTROnqD7oq9kZq1T4IjV0Q7/xc06OVE7nPg6DS2bXL+AqvW4hVEdvnEXEna2bW4uGY4pEGO99ZPPv4YZs3y3DNpmQYM42hyujaBAjbXJxvOcFhxggHGI+UD92dGeU67HDg6/SGAd36GqfHoMNTuULJaFGZexem5T4CTOL7ufCCmAf7dv0EQ11MyrWN6WmYq84C5lqEdyVF8J4hTlkQc+URZUSbMG4PowsVlSEhSO3zlBtm5+alR0UOPD+KaZ5fa0aQryM+3oi/d/ocfaYOCQudxQCeOHYUPRrxpLocZk8U0i8Wt1HSHLQ+Qy3Hj0jFjzE1Xya8Bw4IuJWfoFgJ42RWjip8TQlbVqijtbwz3dw8kfwJM23YdkaXWOOX6tMljMWzIQCuawW9/hJVrNznNt37Fr+jc8VGXI+rXgCnmjipT353w/Es80IIALDAIM56QMFBQSpmkLAUEJzmeX1qrSuBfLrnqQwJ/AkyXJ7sh+bo5ALZdLs+cPgmvDuxj9ezPFesxbETJucZexrfeeAnTv3QdQqTMAyY5TdeZEspcjdjXjfDm5Ka4REDerF1F5tos0Ev1+hNger7QGxfiLzrl3PyfpqJfb+sr4vSMTDR4qCOYy15HSVmrJs4ddx3Dp8wDRpWhvQQKYfGjvTGJCS4rK8nvPDhvt9WfADPwlUE4etx5ROpFv/6A55950mYkn+zxMv45etLpCB/esw5NGjm3Vy77gEnX+lyQIua2xFOM+hNghg8fjp17Djhl2aolc9C1i21A1x9//h3jJn3jNO+EsaPwocWFgT3isg+Y8hXGatzv51uyTz75GGvWb3E66Teu+h0dLYIlFRNfuapCs7bOgzG1a9MCW9ezKI+OU5kHTPkZxnrw72fAfP3VFPy+yK42k7mTOzf+idYt7cfB7PBkH6cmzsz/29ULhxAe5thlT5kHjOV0SUzKfp6CLwkMAnIjJjLcyo3bRZV6Kk8xxpyPIjsmqiQgYkKS5jpAzfauBFzP6Miw9Z5urdzN709bsjmzZ+K7mb84ZdWBnavR9MFGdmm+/XE+Jn7pXOy2cP536NnD8UrkX4BRaSZQSieauUnIphhl+LNWoFJpFlFKSy7yCYmLUYabRyBBpdkISp8pzkMImRitDP/c3QnvaT5/AsyyJQswYcq3Tll29O+NaBht/45HyLZs0Et9MOvbSQ7r8DfArKOUPm/BjSkxkRFWl++JKvUuSvF4CSCwO1oZ0aX4e0KSmmn2fWoBmPXRynAf2ymW9MCfALNt8zqMGD3BKWDOHt2BKKVj36+du/XD8VNnHZZRu2YNnD+xqxwwjAOJKvU1SlHiDYGgT4wywspZb8I19QUQlBhPULokJqqCecVJUKl7g8JkocS0zQiSopURUZ6uFO7m9yfA/HtoL14Z8r5TViWe2Y9qVR2HUftp7kJ84iLGjLNVqsysMKcTk2s3i67t0KXIheTsSlJK0yilJRqVFPVjoiIuW59z1Ew5q8T9EsE3McoI85km4Zq6HgjMvn4IIVRPSJVGtcMy3J30nuTzJ8AkXjiJZ3uXRD+2xzdV/BGEhzsO1JlyMxWNHnncqRDzmymfYuhg+9pS3gKMq/kqZE54pBp85sy1CjRIEmww2BfnKoKC23NEsrzk/IKc/PycRjzTzrudQoLCAi3BwH6mlH6eV5Bjjo3HEUIUitALoDBfpfDU0C+/IM+5gEAIB9ygCVGEXXeUrawpX2bcvIx2jzuPHJ167SQCA5yHZevR9w3s+9uxy9mnn+qMZQtYyFPb5Awwaek3BcUBkEg4jhQY8po2jcpyY8gtprAnuV3kTVCpPwKFOcgkIdgbrYzobJntokrTgKfUKjY4B/RvEBlRAjTT1m4Ppehk0fIxMcoI51KxO9Q3f1phaFEmHmhuNWQ2XNWknHMYpq+YePGytXhnpPkYalNGSEgwkuIOQyq11V721grjjeng0QrjqgGJKs0SSqmF/ynyfUxk+CjLfAlJWR0BYmWFKZVyHevVDPvbmk7zHUBHFv9GCPkzWhkuWOPZVVvFPPcnwFQI5lE1qrlD9jA1/bSkUy7Zl52TiwYPdkBhUZFD2u0blqBta9u6/AcwSZrzFNR8PcxR8mqDqHCm2m9O8Uma/gTUKjY4R0h0A2W4lcbfxWuaQTyhC8yAAbkQHRne2OVI3QECfwIME7pWr9sC+QUFdjkZFhqK5MR/BHH5taEfOtUa+GT0u/hk9Ds2ZfkFYG7coIo8gyabUpiDHUqItGl9ZYjV/WJikmYUBbW66A+RhgfXrEmsLJsuqXIfMlD9mZIVBoZgSXhYaTpBI+chkb8BpknLJ6BKvmGXa1WrVMbFs/sFcXT7rv3o8/Iwh7SO1GT8AjCJydmPUp4/ZMGdwmhleCghRG+11VKpp4HiI4vfNDGRETbG4JRSaaJKk8Ni9ZhBw3HtomuHHRY0Wl4kEgsYL1bt9aJcWVyyCnv1HYBz5+x78K9Zswb27NwqqF16gwGxnZ9Eerr9y01mffnv4QNQKIIElceIfKl0y+q7Y2eY+CTNOwS05NqDkKMxyvDWpTmRqNIsppRanEXIhRgHW60ElYb5I21VXAYFGd4wMtxzTwqCh8dE6G+AGfzW2zhwwPLdV8KwunXqYOtm4VpKX0+bjt//cKxs+cu8n9Gh/WOCR6TMACZRlT2PUr7E0Jtw82KUYUNLcyL+mno3ISi5hiFkV4wy/Al7HEtQZc8F5d8q2ZZx86OVYebvgrnsIaG/Aeaj/43Fhr/smxs3bBiDDWtXCubohbg49OzVzyH9kMGv46MPzXc7LsstO4BJ0hyloC3Nkxt4JzoyYnZpDiRcU8eBwOxTlFK6uGFUhVfscSoxSf02BcwrCgE5Fh0Zbl5xXHLXSwRiAXM/ayuztn88/mv8PM/qrsbMyRbNH8KeLVYSAJdcZnKd/87H26Vr3uxB7NtmrR1d5s8w7LxxUZWdQ0Etzhvk0eja4TaSq4Qko4cFs5iYI9y0Bsqw/9kFTLKmLeWp+cxCQAobKMNszkUuR8xDAn8DzLTv5mDy1B/tcq1d25bYus4+mByxedacBRg7cardxxzH4VrcYSt1/zIPmMuqzKZ6ylnatRpCpPlhNWvWtLr5unmTBmdrNbmWnCOUjIqOCv/eHjdv3LihyNUrspmzjOLnUsI3q6esaL498xALgrL7G2B+W7gcI8fYVw5/PPYxrFvO3DcIT2npGWj4cGfo9Vb3P+YCmMSfSf6LU5kHTPy17FcJ4f8o2Y6R89GR4Taepy+pNNEGShOsAYN+0VERDi2WEpM05yioWf5CKfdaw6gws3xG+LC5T+lvgNmwaQcGDravgNm9a2csX2hfpcUZh/u/+i42b9ttl2T40Ffx1eclm4wyD5jEJM131FoqvyRaGW7tuMqo7pIVSynZa8k1Cr5jw8iKVlJ+y+elb9UIyPfRpbQH3IeCsJz+BphDR46jW0+7x0qj4RczABObNm7ZhZdef89uNmaMxozS/GaFSVSp91KKWAtufBQTGTG9NHcuXtf05w3WUn4CNIiOjHAYhTQhST0agFmHjBDsi1ZGlOiYiR05N+j9DTDxiZfRqoOVzZ+Za/369MD8WfbPI85Yq9Pp0fDhTmDumEondo5hZssRtzWgy/QKw1T5L6o0WZbq+pTiiYZRETYWQolJ2R9Q8DMsGRakDFcoCbGvhwEg/pq6CyEwO7MigKaBMrwCU/l3Y+67lcXfAMNC9tVp1M4ur159uQ9mznBsLemMwWMnTMOsueaduxXp0j9m4ZluJpvCMg2YxCR1fQqY9cDYRA4MC6usDCc2r5KEJDVbKdiKUZzUMZERFZwxWaXSVCwE0i1tbFytSm6hwkkmR4Cxp9rPirnfr5WZM75KymYwGGw99Qr1XmmPnefjEtG2k6UxbgmV5TmmbAMmWd2H8jBLsgjBtWhlhN1wuglJmiWAlTbz+Rg7lwOlmZ2oUl+lFGaLS8Khb3TtCLNFprcBUro8fwMM6z/zYpmaZutc/L23X8eUCZaaTeK437l7Pxw/aWu+3Oyhxvh7h2lIyzZgktRTKGCOY0kI1kUrI+xaICUkqZl715LzB8WumKgIu1J+y2FIVKnXUgqzTT8BvoyOjHBsbCFuDF1SiwWMywLvIoEQXTLWvB49+yAhwcpsydjqYUOHYNT79g/vQrq1bPkqTPj8CxtSdo759/DfCA1lLrcdp/te0p+g0myCRWhx5jGmYVQFu5f4CSpNHCg1S/kJIYuileGDXDE6/lrWBOY5xkxHyOYYZbjZq4yr/J4+90fAvPbGWzh8xFaNf8S772D4OzYaT4JZnJubi/Ydu9gNqTF39kx0irX1qGlZuM8Bc+PGZa86k8jVVzwGwOwRQQLD4CCpxq5LkFxDxXOgCC5mAOEwO5jLdHnlUqAP72KA5FcLxqWHSDPNajiCR8tNwlx9xav2sjo6w9ymTeCobjTR3bpjQlaDvLbddjnrptAV5oPRH2PTZlsPmLVrVv1q7+bf57rJSmO2Zu36TM3LLzArmAVWqo+qD/dD96c6Y1T3CiASx/F1JNpku9t9T9rjLO8d01a+Uw0uL/fucCCoSqPvCYGN9JJS8n5B2nn7ejMCmxpUpUl7TsL9HRHdBVWbD0CYspXRNZA+Lz394IQq91SI4HLACBxUfydTVGs8FpROseUDHZafGufRCtNxOh1nyM+YKFVUMqs86fLSaW7y0U1n5j/teahlLw5eOWC8yMyyXJSiWqMhoLBRGiOUvpaXFueRalLsdPongAGMfwUZl6G4sARtcw4e/XrXNhv7qbvN43sCMGcSUyy1Asw8aRpdw+gcw9FzMcwrLktMnnLaEg4oqjV8DpSzsRSjPAYUpF9Y5gmvOs2gbXke069tm8A9l7enaYNQWXCAhKMNK4ZFdl6yxqHfO0/qdDfvPQEYdxtfns93HIj9xpBm0BVUpgYteH0ReL0W1FAEWXDl/w5+VvEhIS1JSbli98VYnLdGjbr7furWZVGYXDawYlAAgmTSMY8vXn1XXGk56k+ZBYw3ViV7TLvXVipXk1DIRHZGwyYxex47nf4LwJ6xXuK+0cR5CDERjdjzWs8IXsvdvJRTGDDt7HXt9QLtmIJbF34QUcQdJS2zgLmjXPPHwmu2UCj0+SxYr1XiCN8l91a8fT19kXwqBv9Xg975fuHZaw9reZN6YLWqlfYe2rGoRO4motxiwIvI4pS0HDDe4qSflDPrqS5aA6UyAtAR23dz3u52gyffH3vj9HYWrcE0Nyl0lCOjC255dnXtrXaWA8ZbnPSTcna/3PsyBa0LILPLkjWVvN3tyk2emp+fljTEVC5N43j0zU2Ps/KM6u06xZRXDhgx3Cqnxe6Xe12gYKFJSF6XJaudK3qJ5xdRVG3ETNvZJcI5nqPPFt6ME629IL5a4TnKNGAopfLkbIRIDAgBj2BQnUJPiUIqQRD7JNSgAIgCBIGUkkCOIIAHH0gIFwBKAkH5QEogJwRyUCKn4OWEcDJCIQeBnFLIACoFAfOgLQX7TnH7O5UCHAdQCQjhQKkEIKbvAGf8m4DAFAqEEGIcCnLbbMH4m3FDAtDbtj70dtADCmb7w/6B8gB4gBiMfxNiAGW/se8sogLRg0IPYvyvA2D6DqIn7DuFlhJoKeV1BJwWhGophZZQaEG4QhBaSClfxIEr/HbR1mZrli2unp/8X6tcHW92bhJdv/6cLRvW/AIiyweHPIMEubXDkEsI0QqfhibK4KqNXqEA86hxOF9X1B1Zl5mDlHsq3dOASU2lIQYZKuv0usrgSCUJIRUBvgLlSQVKEMGBhPOgEaB8OEDCKBBGYAyJEUKBEAI2ocuTOxw4dfoMzp0/j/j4RJw5+x/i4uJZGBKbotq0boWFf9jGwKSAjgDMwUkuBXIIkA3QbBBOw4GoeVANoVATjmYBXJaB0syWrR79SSaX33rhuef7zpr2P/u+ad3pjBfz3BXAUEq5lCzUNhj0dQmhUQBRArQWBalBCGoAtBqlqAZAuM9QLzKlvCjgzaHDceCgydslc+Eqk8nNoSiYIRn7r9PpUCEiAn/vMxvAepN1BYTgFkBuUYoUApoCEBYcWEUpuSaRSK/UqIBkQghbZX2W7jhgKKWylCx9WwOPdoTQhylIE0IRbemzzGe9La+oTHGA+aWjBIkE9Byl5JSEw6EaFaRHCCFs+3lH0h0FTHK6bjIFhoNtm8pTOQd8wgGiJsBPtSvLrAIPe6vqOw8YguGg5YDx1oCVl+OCA4SoCb1PAcO6Zt6SAe0IpQ9TigcBRANwHhSxfGaUc8A1B1g4s0RC8B8l5JQE9/mWzFF/iw/9hOjrGkCiYKDmQz9AaxKCqpSSagAtP/S7njRllIIUEELZgT+VgqZwIDeMh34JUUlAr1FaRg/9noxm8bUy1esq6+1cK5vORiS8/FrZEy7fmbzOrpUBqgGImhCoCUqulaU8zSBSWbpEh/SqVYmVz+0700rxpd7RM4z45ng3hz3BJSREoadQSDkSZKBQgPIKUAeCS8IHMiElE16aBZeAnICTWQouCYHUJMQ0Ci9vCy6JlIJKOJOAkqNMcGkrwCTMFJdYCCwtBZilBZbsO5NWwiQPoaUFlsQouGQSS8oTkzCzRHAJGIWVtLTgEryOAtpiwSUTWjJhJqi14JKnKCKEFoKgEITLlxDk63laICXIh4Hme0Nw6d3RvzOl/R8AdGoXzom1qQAAAABJRU5ErkJggg=="},68535:function(yt,ge,b){"use strict";b.d(ge,{ZP:function(){return Kr}});const I=Number.isFinite||function(o){return typeof o=="number"&&isFinite(o)},P=Number.isSafeInteger||function(o){return typeof o=="number"&&Math.abs(o)<=K},K=Number.MAX_SAFE_INTEGER||9007199254740991;let D=function(o){return o.NETWORK_ERROR="networkError",o.MEDIA_ERROR="mediaError",o.KEY_SYSTEM_ERROR="keySystemError",o.MUX_ERROR="muxError",o.OTHER_ERROR="otherError",o}({}),w=function(o){return o.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",o.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",o.KEY_SYSTEM_NO_SESSION="keySystemNoSession",o.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",o.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",o.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",o.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",o.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",o.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",o.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",o.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",o.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",o.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",o.MANIFEST_LOAD_ERROR="manifestLoadError",o.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",o.MANIFEST_PARSING_ERROR="manifestParsingError",o.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",o.LEVEL_EMPTY_ERROR="levelEmptyError",o.LEVEL_LOAD_ERROR="levelLoadError",o.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",o.LEVEL_PARSING_ERROR="levelParsingError",o.LEVEL_SWITCH_ERROR="levelSwitchError",o.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",o.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",o.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",o.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",o.FRAG_LOAD_ERROR="fragLoadError",o.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",o.FRAG_DECRYPT_ERROR="fragDecryptError",o.FRAG_PARSING_ERROR="fragParsingError",o.FRAG_GAP="fragGap",o.REMUX_ALLOC_ERROR="remuxAllocError",o.KEY_LOAD_ERROR="keyLoadError",o.KEY_LOAD_TIMEOUT="keyLoadTimeOut",o.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",o.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",o.BUFFER_APPEND_ERROR="bufferAppendError",o.BUFFER_APPENDING_ERROR="bufferAppendingError",o.BUFFER_STALLED_ERROR="bufferStalledError",o.BUFFER_FULL_ERROR="bufferFullError",o.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",o.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",o.ASSET_LIST_LOAD_ERROR="assetListLoadError",o.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",o.ASSET_LIST_PARSING_ERROR="assetListParsingError",o.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",o.INTERNAL_EXCEPTION="internalException",o.INTERNAL_ABORTED="aborted",o.ATTACH_MEDIA_ERROR="attachMediaError",o.UNKNOWN="unknown",o}({}),_=function(o){return o.MEDIA_ATTACHING="hlsMediaAttaching",o.MEDIA_ATTACHED="hlsMediaAttached",o.MEDIA_DETACHING="hlsMediaDetaching",o.MEDIA_DETACHED="hlsMediaDetached",o.MEDIA_ENDED="hlsMediaEnded",o.STALL_RESOLVED="hlsStallResolved",o.BUFFER_RESET="hlsBufferReset",o.BUFFER_CODECS="hlsBufferCodecs",o.BUFFER_CREATED="hlsBufferCreated",o.BUFFER_APPENDING="hlsBufferAppending",o.BUFFER_APPENDED="hlsBufferAppended",o.BUFFER_EOS="hlsBufferEos",o.BUFFERED_TO_END="hlsBufferedToEnd",o.BUFFER_FLUSHING="hlsBufferFlushing",o.BUFFER_FLUSHED="hlsBufferFlushed",o.MANIFEST_LOADING="hlsManifestLoading",o.MANIFEST_LOADED="hlsManifestLoaded",o.MANIFEST_PARSED="hlsManifestParsed",o.LEVEL_SWITCHING="hlsLevelSwitching",o.LEVEL_SWITCHED="hlsLevelSwitched",o.LEVEL_LOADING="hlsLevelLoading",o.LEVEL_LOADED="hlsLevelLoaded",o.LEVEL_UPDATED="hlsLevelUpdated",o.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",o.LEVELS_UPDATED="hlsLevelsUpdated",o.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",o.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",o.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",o.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",o.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",o.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",o.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",o.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",o.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",o.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",o.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",o.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",o.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",o.CUES_PARSED="hlsCuesParsed",o.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",o.INIT_PTS_FOUND="hlsInitPtsFound",o.FRAG_LOADING="hlsFragLoading",o.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",o.FRAG_LOADED="hlsFragLoaded",o.FRAG_DECRYPTED="hlsFragDecrypted",o.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",o.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",o.FRAG_PARSING_METADATA="hlsFragParsingMetadata",o.FRAG_PARSED="hlsFragParsed",o.FRAG_BUFFERED="hlsFragBuffered",o.FRAG_CHANGED="hlsFragChanged",o.FPS_DROP="hlsFpsDrop",o.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",o.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",o.ERROR="hlsError",o.DESTROYING="hlsDestroying",o.KEY_LOADING="hlsKeyLoading",o.KEY_LOADED="hlsKeyLoaded",o.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",o.BACK_BUFFER_REACHED="hlsBackBufferReached",o.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",o.ASSET_LIST_LOADING="hlsAssetListLoading",o.ASSET_LIST_LOADED="hlsAssetListLoaded",o.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",o.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",o.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",o.INTERSTITIAL_STARTED="hlsInterstitialStarted",o.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",o.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",o.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",o.INTERSTITIAL_ENDED="hlsInterstitialEnded",o.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",o.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",o.EVENT_CUE_ENTER="hlsEventCueEnter",o}({});var F={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},v={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class s{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 y{constructor(e,t,i,r=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 s(e),this.fast_=new s(t),this.defaultTTFB_=r,this.ttfb_=new s(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new s(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new s(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new s(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}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 f(o,e,t){return(e=E(e))in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function c(){return c=Object.assign?Object.assign.bind():function(o){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(o[i]=t[i])}return o},c.apply(null,arguments)}function l(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(o);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(o,r).enumerable})),t.push.apply(t,i)}return t}function h(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?l(Object(t),!0).forEach(function(i){f(o,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach(function(i){Object.defineProperty(o,i,Object.getOwnPropertyDescriptor(t,i))})}return o}function d(o,e){if(typeof o!="object"||!o)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var i=t.call(o,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}function E(o){var e=d(o,"string");return typeof e=="symbol"?e:e+""}class T{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=L,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 L=function(){},x={trace:L,debug:L,log:L,warn:L,info:L,error:L};function A(){return c({},x)}function O(o,e){const t=self.console[o];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${o}] >`):L}function U(o,e,t){return e[o]?e[o].bind(e):O(o,t)}const N=A();function $(o,e,t){const i=A();if(typeof console=="object"&&o===!0||typeof o=="object"){const r=["debug","log","info","warn","error"];r.forEach(n=>{i[n]=U(n,o,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.11`)}catch(n){return A()}r.forEach(n=>{N[n]=U(n,o)})}else c(N,i);return i}const M=N;function Z(o=!0){return typeof self=="undefined"?void 0:(o||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function q(o){return typeof self!="undefined"&&o===self.ManagedMediaSource}function se(o,e){const t=Object.keys(o),i=Object.keys(e),r=t.length,n=i.length;return!r||!n||r===n&&!t.some(a=>i.indexOf(a)===-1)}function ue(o,e=!1){if(typeof TextDecoder!="undefined"){const p=new TextDecoder("utf-8").decode(o);if(e){const m=p.indexOf("\0");return m!==-1?p.substring(0,m):p}return p.replace(/\0/g,"")}const t=o.length;let i,r,n,a="",u=0;for(;u<t;){if(i=o[u++],i===0&&e)return a;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:a+=String.fromCharCode(i);break;case 12:case 13:r=o[u++],a+=String.fromCharCode((i&31)<<6|r&63);break;case 14:r=o[u++],n=o[u++],a+=String.fromCharCode((i&15)<<12|(r&63)<<6|(n&63)<<0);break}}return a}function J(o){let e="";for(let t=0;t<o.length;t++){let i=o[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function z(o){return Uint8Array.from(o.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function X(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var B={exports:{}},G;function W(){return G||(G=1,function(o,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,u={buildAbsoluteURL:function(g,p,m){if(m=m||{},g=g.trim(),p=p.trim(),!p){if(!m.alwaysNormalize)return g;var S=u.parseURL(g);if(!S)throw new Error("Error trying to parse base URL.");return S.path=u.normalizePath(S.path),u.buildURLFromParts(S)}var R=u.parseURL(p);if(!R)throw new Error("Error trying to parse relative URL.");if(R.scheme)return m.alwaysNormalize?(R.path=u.normalizePath(R.path),u.buildURLFromParts(R)):p;var H=u.parseURL(g);if(!H)throw new Error("Error trying to parse base URL.");if(!H.netLoc&&H.path&&H.path[0]!=="/"){var j=r.exec(H.path);H.netLoc=j[1],H.path=j[2]}H.netLoc&&!H.path&&(H.path="/");var Q={scheme:H.scheme,netLoc:R.netLoc,path:null,params:R.params,query:R.query,fragment:R.fragment};if(!R.netLoc&&(Q.netLoc=H.netLoc,R.path[0]!=="/"))if(!R.path)Q.path=H.path,R.params||(Q.params=H.params,R.query||(Q.query=H.query));else{var Y=H.path,te=Y.substring(0,Y.lastIndexOf("/")+1)+R.path;Q.path=u.normalizePath(te)}return Q.path===null&&(Q.path=m.alwaysNormalize?u.normalizePath(R.path):R.path),u.buildURLFromParts(Q)},parseURL:function(g){var p=i.exec(g);return p?{scheme:p[1]||"",netLoc:p[2]||"",path:p[3]||"",params:p[4]||"",query:p[5]||"",fragment:p[6]||""}:null},normalizePath:function(g){for(g=g.split("").reverse().join("").replace(n,"");g.length!==(g=g.replace(a,"")).length;);return g.split("").reverse().join("")},buildURLFromParts:function(g){return g.scheme+g.netLoc+g.path+g.params+g.query+g.fragment}};o.exports=u})()}(B)),B.exports}var k=W();class C{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var V={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class ne{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 r;i.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[V.AUDIO]:null,[V.VIDEO]:null,[V.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new C),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=k.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[V.AUDIO]=null,e[V.VIDEO]=null,e[V.AUDIOVIDEO]=null}}function pe(o){return o.sn!=="initSegment"}class Ce extends ne{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.length){const e=this.byteRange[0],t=this.byteRange[1];if(I(e)&&I(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){const r=this._decryptdata=this.levelkeys[i[0]]||null;if(r)return r.getDecryptData(this.sn)}}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=I(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){var t;const i=Object.keys(this.levelkeys),r=i.length;if(r>1||r===1&&(t=this.levelkeys[i[0]])!=null&&t.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(!I(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return pe(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,r,n,a=!1){const{elementaryStreams:u}=this,g=u[e];if(!g){u[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:a};return}g.startPTS=Math.min(g.startPTS,t),g.endPTS=Math.max(g.endPTS,i),g.startDTS=Math.min(g.startDTS,r),g.endDTS=Math.max(g.endDTS,n)}}class We extends ne{constructor(e,t,i,r,n){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=r;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,n),n&&(this.fragOffset=n.fragOffset+n.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 me(o,e){const t=Object.getPrototypeOf(o);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||me(t,e)}}function Ne(o,e){const t=me(o,e);t&&(t.enumerable=!0,Object.defineProperty(o,e,t))}const Be=Math.pow(2,32)-1,Me=[].push,wt={video:1,audio:2,id3:3,text:4};function He(o){return String.fromCharCode.apply(null,o)}function lt(o,e){const t=o[e]<<8|o[e+1];return t<0?65536+t:t}function Ue(o,e){const t=be(o,e);return t<0?4294967296+t:t}function bt(o,e){let t=Ue(o,e);return t*=Math.pow(2,32),t+=Ue(o,e+4),t}function be(o,e){return o[e]<<24|o[e+1]<<16|o[e+2]<<8|o[e+3]}function ye(o){const e=o.byteLength;for(let t=0;t<e;){const i=Ue(o,t);if(i>8&&o[t+4]===109&&o[t+5]===111&&o[t+6]===111&&o[t+7]===102)return!0;t=i>1?t+i:e}return!1}function le(o,e){const t=[];if(!e.length)return t;const i=o.byteLength;for(let r=0;r<i;){const n=Ue(o,r),a=He(o.subarray(r+4,r+8)),u=n>1?r+n:i;if(a===e[0])if(e.length===1)t.push(o.subarray(r+8,u));else{const g=le(o.subarray(r+8,u),e.slice(1));g.length&&Me.apply(t,g)}r=u}return t}function ke(o){const e=[],t=o[0];let i=8;const r=Ue(o,i);i+=4;let n=0,a=0;t===0?(n=Ue(o,i),a=Ue(o,i+4),i+=8):(n=bt(o,i),a=bt(o,i+8),i+=16),i+=2;let u=o.length+a;const g=lt(o,i);i+=2;for(let p=0;p<g;p++){let m=i;const S=Ue(o,m);m+=4;const R=S&2147483647;if((S&2147483648)>>>31===1)return M.warn("SIDX has hierarchical references (not supported)"),null;const j=Ue(o,m);m+=4,e.push({referenceSize:R,subsegmentDuration:j,info:{duration:j/r,start:u,end:u+R-1}}),u+=R,m+=4,i=m}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:g,references:e}}function Fe(o){const e=[],t=le(o,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],a=le(n,["tkhd"])[0];if(a){let u=a[0];const g=Ue(a,u===0?12:20),p=le(n,["mdia","mdhd"])[0];if(p){u=p[0];const m=Ue(p,u===0?12:20),S=le(n,["mdia","hdlr"])[0];if(S){const R=He(S.subarray(8,12)),H={soun:V.AUDIO,vide:V.VIDEO}[R],j=le(n,["mdia","minf","stbl","stsd"])[0],Q=Ke(j);H?(e[g]={timescale:m,type:H,stsd:Q},e[H]=h({timescale:m,id:g},Q)):e[g]={timescale:m,type:R,stsd:Q}}}}}return le(o,["moov","mvex","trex"]).forEach(r=>{const n=Ue(r,4),a=e[n];a&&(a.default={duration:Ue(r,12),flags:Ue(r,20)})}),e}function Ke(o){const e=o.subarray(8),t=e.subarray(86),i=He(e.subarray(4,8));let r=i,n;const a=i==="enca"||i==="encv";if(a){const p=le(e,[i])[0].subarray(i==="enca"?28:78);le(p,["sinf"]).forEach(S=>{const R=le(S,["schm"])[0];if(R){const H=He(R.subarray(4,8));if(H==="cbcs"||H==="cenc"){const j=le(S,["frma"])[0];j&&(r=He(j))}}})}const u=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const g=le(t,["avcC"])[0];g&&g.length>3&&(r+="."+Re(g[1])+Re(g[2])+Re(g[3]),n=re(u==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const g=le(e,[i])[0],p=le(g.subarray(28),["esds"])[0];if(p&&p.length>7){let m=4;if(p[m++]!==3)break;m=De(p,m),m+=2;const S=p[m++];if(S&128&&(m+=2),S&64&&(m+=p[m++]),p[m++]!==4)break;m=De(p,m);const R=p[m++];if(R===64)r+="."+Re(R);else break;if(m+=12,p[m++]!==5)break;m=De(p,m);const H=p[m++];let j=(H&248)>>3;j===31&&(j+=1+((H&7)<<3)+((p[m]&224)>>5)),r+="."+j}break}case"hvc1":case"hev1":{const g=le(t,["hvcC"])[0];if(g&&g.length>12){const p=g[1],m=["","A","B","C"][p>>6],S=p&31,R=Ue(g,2),H=(p&32)>>5?"H":"L",j=g[12],Q=g.subarray(6,12);r+="."+m+S,r+="."+fe(R).toString(16).toUpperCase(),r+="."+H+j;let Y="";for(let te=Q.length;te--;){const ce=Q[te];(ce||Y)&&(Y="."+ce.toString(16).toUpperCase()+Y)}r+=Y}n=re(u=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=re(r,t)||r;break}case"vp09":{const g=le(t,["vpcC"])[0];if(g&&g.length>6){const p=g[4],m=g[5],S=g[6]>>4&15;r+="."+Oe(p)+"."+Oe(m)+"."+Oe(S)}break}case"av01":{const g=le(t,["av1C"])[0];if(g&&g.length>2){const p=g[1]>>>5,m=g[1]&31,S=g[2]>>>7?"H":"M",R=(g[2]&64)>>6,H=(g[2]&32)>>5,j=p===2&&R?H?12:10:R?10:8,Q=(g[2]&16)>>4,Y=(g[2]&8)>>3,te=(g[2]&4)>>2,ce=g[2]&3;r+="."+p+"."+Oe(m)+S+"."+Oe(j)+"."+Q+"."+Y+te+ce+"."+Oe(1)+"."+Oe(1)+"."+Oe(1)+"."+0,n=re("dav1",t)}break}}return{codec:r,encrypted:a,supplemental:n}}function re(o,e){const t=le(e,["dvvC"]),i=t.length?t[0]:le(e,["dvcC"])[0];if(i){const r=i[2]>>1&127,n=i[2]<<5&32|i[3]>>3&31;return o+"."+Oe(r)+"."+Oe(n)}}function fe(o){let e=0;for(let t=0;t<32;t++)e|=(o>>t&1)<<31-t;return e>>>0}function De(o,e){const t=e+5;for(;o[e++]&128&&e<t;);return e}function Re(o){return("0"+o.toString(16).toUpperCase()).slice(-2)}function Oe(o){return(o<10?"0":"")+o}function Ye(o,e){if(!o||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&le(o,["moov","trak"]).forEach(r=>{const a=le(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let u=le(a,["enca"]);const g=u.length>0;g||(u=le(a,["encv"])),u.forEach(p=>{const m=g?p.subarray(28):p.subarray(78);le(m,["sinf"]).forEach(R=>{const H=at(R);if(H){const j=H.subarray(8,24);j.some(Q=>Q!==0)||(M.log(`[eme] Patching keyId in 'enc${g?"a":"v"}>sinf>>tenc' box: ${J(j)} -> ${J(t)}`),H.set(t,8))}})})})}function at(o){const e=le(o,["schm"])[0];if(e){const t=He(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return le(o,["schi","tenc"])[0]}return null}function Qe(o,e,t){const i={},r=le(o,["moof","traf"]);for(let n=0;n<r.length;n++){const a=r[n],u=le(a,["tfhd"])[0],g=Ue(u,4),p=e[g];if(!p)continue;i[g]||(i[g]={start:NaN,duration:0,sampleCount:0,timescale:p.timescale,type:p.type});const m=i[g],S=le(a,["tfdt"])[0];if(S){const ae=S[0];let Ee=Ue(S,4);ae===1&&(Ee===Be?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(Ee*=Be+1,Ee+=Ue(S,8))),I(Ee)&&(!I(m.start)||Ee<m.start)&&(m.start=Ee)}const R=p.default,H=Ue(u,0)|(R==null?void 0:R.flags);let j=(R==null?void 0:R.duration)||0;H&8&&(H&2?j=Ue(u,12):j=Ue(u,8));const Q=le(a,["trun"]);let Y=m.start||0,te=0,ce=j;for(let ae=0;ae<Q.length;ae++){const Ee=Q[ae],Te=Ue(Ee,4),$e=m.sampleCount;m.sampleCount+=Te;const xe=Ee[3]&1,Ie=Ee[3]&4,Pe=Ee[2]&1,Ae=Ee[2]&2,ze=Ee[2]&4,_t=Ee[2]&8;let xt=8,kt=Te;for(xe&&(xt+=4),Ie&&Te&&(!(Ee[xt+1]&1)&&m.keyFrameIndex===void 0&&(m.keyFrameIndex=$e),xt+=4,Pe?(ce=Ue(Ee,xt),xt+=4):ce=j,Ae&&(xt+=4),_t&&(xt+=4),Y+=ce,te+=ce,kt--);kt--;)Pe?(ce=Ue(Ee,xt),xt+=4):ce=j,Ae&&(xt+=4),ze&&(Ee[xt+1]&1||m.keyFrameIndex===void 0&&(m.keyFrameIndex=m.sampleCount-(kt+1),m.keyFrameStart=Y),xt+=4),_t&&(xt+=4),Y+=ce,te+=ce;!te&&j&&(te+=j*Te)}m.duration+=te}if(!Object.keys(i).some(n=>i[n].duration)){let n=1/0,a=0;const u=le(o,["sidx"]);for(let g=0;g<u.length;g++){const p=ke(u[g]);if(p!=null&&p.references){n=Math.min(n,p.earliestPresentationTime/p.timescale);const m=p.references.reduce((S,R)=>S+R.info.duration||0,0);a=Math.max(a,m+p.earliestPresentationTime/p.timescale)}}a&&I(a)&&Object.keys(i).forEach(g=>{i[g].duration||(i[g].duration=a*i[g].timescale-i[g].start)})}return i}function Xe(o){const e={valid:null,remainder:null},t=le(o,["moof"]);if(t.length<2)return e.remainder=o,e;const i=t[t.length-1];return e.valid=o.slice(0,i.byteOffset-8),e.remainder=o.slice(i.byteOffset-8),e}function Ge(o,e){const t=new Uint8Array(o.length+e.length);return t.set(o),t.set(e,o.length),t}function ct(o,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let a=!1;return le(i,["moof"]).map(g=>{const p=g.byteOffset-8;le(g,["traf"]).map(S=>{const R=le(S,["tfdt"]).map(H=>{const j=H[0];let Q=Ue(H,4);return j===1&&(Q*=Math.pow(2,32),Q+=Ue(H,8)),Q/r})[0];return R!==void 0&&(o=R),le(S,["tfhd"]).map(H=>{const j=Ue(H,4),Q=Ue(H,0)&16777215,Y=(Q&1)!==0,te=(Q&2)!==0,ce=(Q&8)!==0;let ae=0;const Ee=(Q&16)!==0;let Te=0;const $e=(Q&32)!==0;let xe=8;j===n&&(Y&&(xe+=8),te&&(xe+=4),ce&&(ae=Ue(H,xe),xe+=4),Ee&&(Te=Ue(H,xe),xe+=4),$e&&(xe+=4),e.type==="video"&&(a=ot(e.codec)),le(S,["trun"]).map(Ie=>{const Pe=Ie[0],Ae=Ue(Ie,0)&16777215,ze=(Ae&1)!==0;let _t=0;const xt=(Ae&4)!==0,kt=(Ae&256)!==0;let At=0;const ut=(Ae&512)!==0;let Ct=0;const vt=(Ae&1024)!==0,Tt=(Ae&2048)!==0;let Mt=0;const ft=Ue(Ie,4);let dt=8;ze&&(_t=Ue(Ie,dt),dt+=4),xt&&(dt+=4);let $t=_t+p;for(let Zt=0;Zt<ft;Zt++){if(kt?(At=Ue(Ie,dt),dt+=4):At=ae,ut?(Ct=Ue(Ie,dt),dt+=4):Ct=Te,vt&&(dt+=4),Tt&&(Pe===0?Mt=Ue(Ie,dt):Mt=be(Ie,dt),dt+=4),e.type===V.VIDEO){let Ht=0;for(;Ht<Ct;){const Vt=Ue(i,$t);if($t+=4,it(a,i[$t])){const ki=i.subarray($t,$t+Vt);we(ki,a?2:1,o+Mt/r,t)}$t+=Vt,Ht+=Vt+4}}o+=At/r}}))})})}),t}function ot(o){if(!o)return!1;const e=o.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function it(o,e){if(o){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function we(o,e,t,i){const r=rt(o);let n=0;n+=e;let a=0,u=0,g=0;for(;n<r.length;){a=0;do{if(n>=r.length)break;g=r[n++],a+=g}while(g===255);u=0;do{if(n>=r.length)break;g=r[n++],u+=g}while(g===255);const p=r.length-n;let m=n;if(u<p)n+=u;else if(u>p){M.error(`Malformed SEI payload. ${u} is too small, only ${p} bytes left to parse.`);break}if(a===4){if(r[m++]===181){const R=lt(r,m);if(m+=2,R===49){const H=Ue(r,m);if(m+=4,H===1195456820){const j=r[m++];if(j===3){const Q=r[m++],Y=31&Q,te=64&Q,ce=te?2+Y*3:0,ae=new Uint8Array(ce);if(te){ae[0]=Q;for(let Ee=1;Ee<ce;Ee++)ae[Ee]=r[m++]}i.push({type:j,payloadType:a,pts:t,bytes:ae})}}}}}else if(a===5&&u>16){const S=[];for(let j=0;j<16;j++){const Q=r[m++].toString(16);S.push(Q.length==1?"0"+Q:Q),(j===3||j===5||j===7||j===9)&&S.push("-")}const R=u-16,H=new Uint8Array(R);for(let j=0;j<R;j++)H[j]=r[m++];i.push({payloadType:a,pts:t,uuid:S.join(""),userData:ue(H),userDataBytes:H})}}}function rt(o){const e=o.byteLength,t=[];let i=1;for(;i<e-2;)o[i]===0&&o[i+1]===0&&o[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return o;const r=e-t.length,n=new Uint8Array(r);let a=0;for(i=0;i<r;a++,i++)a===t[0]&&(a++,t.shift()),n[i]=o[a];return n}function Ze(o){const e=o[0];let t="",i="",r=0,n=0,a=0,u=0,g=0,p=0;if(e===0){for(;He(o.subarray(p,p+1))!=="\0";)t+=He(o.subarray(p,p+1)),p+=1;for(t+=He(o.subarray(p,p+1)),p+=1;He(o.subarray(p,p+1))!=="\0";)i+=He(o.subarray(p,p+1)),p+=1;i+=He(o.subarray(p,p+1)),p+=1,r=Ue(o,12),n=Ue(o,16),u=Ue(o,20),g=Ue(o,24),p=28}else if(e===1){p+=4,r=Ue(o,p),p+=4;const S=Ue(o,p);p+=4;const R=Ue(o,p);for(p+=4,a=el(2,32)*S+R,P(a)||(a=Number.MAX_SAFE_INTEGER,M.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),u=Ue(o,p),p+=4,g=Ue(o,p),p+=4;He(o.subarray(p,p+1))!=="\0";)t+=He(o.subarray(p,p+1)),p+=1;for(t+=He(o.subarray(p,p+1)),p+=1;He(o.subarray(p,p+1))!=="\0";)i+=He(o.subarray(p,p+1)),p+=1;i+=He(o.subarray(p,p+1)),p+=1}const m=o.subarray(p,o.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:a,presentationTimeDelta:n,eventDuration:u,id:g,payload:m}}function je(o,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=i&255,n.set(o,4),r=0,i=8;r<t;r++)n.set(e[r],i),i+=e[r].byteLength;return n}function mt(o,e,t){if(o.byteLength!==16)throw new RangeError("Invalid system id");let i,r;i=0,r=new Uint8Array;let n;i>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),je([112,115,115,104],new Uint8Array([i,0,0,0]),o,n,r,a,t)}const Et=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),st={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 Rt(o,e){const t=st[e];return!!t&&!!t[o.slice(0,4)]}function Nt(o,e,t=!0){return!o.split(",").some(i=>!nt(i,e,t))}function nt(o,e,t=!0){var i;const r=Z(t);return(i=r==null?void 0:r.isTypeSupported(Dt(o,e)))!=null?i:!1}function Dt(o,e){return`${e}/mp4;codecs=${o}`}function Se(o){if(o){const e=o.substring(0,4);return st.video[e]}return 2}function _e(o){const e=Et();return o.split(",").reduce((t,i)=>{const n=e&&ot(i)?9:st.video[i];return n?(n*2+t)/(t?3:2):(st.audio[i]+t)/(t?2:1)},0)}const ve={};function ee(o,e=!0){if(ve[o])return ve[o];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[o];for(let r=0;r<t.length;r++){var i;if(nt(t[r],"audio",e))return ve[o]=t[r],t[r];if(t[r]==="mp3"&&(i=Z(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return o}const ie=/flac|opus|mp4a\.40\.34/i;function oe(o,e=!0){return o.replace(ie,t=>ee(t.toLowerCase(),e))}function he(o,e){const t=[];if(o){const i=o.split(",");for(let r=0;r<i.length;r++)Rt(i[r],"video")||t.push(i[r])}return e&&t.push(e),t.join(",")}function de(o,e){if(o&&(o.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(o)!==-1)&&(Je(o,"audio")||Je(o,"video")))return o;if(e){const t=e.split(",");if(t.length>1){if(o){for(let i=t.length;i--;)if(t[i].substring(0,4)===o.substring(0,4))return t[i]}return t[0]}}return e||o}function Je(o,e){return Rt(o,e)&&nt(o,e)}function et(o){const e=o.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 ht(o){if(o.startsWith("av01.")){const e=o.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 o}function gt(o){const e=Z(o)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Ot(o){return o.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const qt={supported:!0,powerEfficient:!0,smooth:!0},Ut={supported:!1,smooth:!1,powerEfficient:!1},Lt={supported:!0,configurations:[],decodingInfoResults:[qt]};function oi(o,e){return{supported:!1,configurations:e,decodingInfoResults:[Ut],error:o}}function fi(o,e,t,i,r,n){const a=o.videoCodec,u=o.audioCodec?o.audioGroups:null,g=n==null?void 0:n.audioCodec,p=n==null?void 0:n.channels,m=p?parseInt(p):g?1/0:2;let S=null;if(u!=null&&u.length)try{u.length===1&&u[0]?S=e.groups[u[0]].channels:S=u.reduce((R,H)=>{if(H){const j=e.groups[H];if(!j)throw new Error(`Audio track group ${H} not found`);Object.keys(j.channels).forEach(Q=>{R[Q]=(R[Q]||0)+j.channels[Q]})}return R},{2:0})}catch(R){return!0}return a!==void 0&&(a.split(",").some(R=>ot(R))||o.width>1920&&o.height>1088||o.height>1920&&o.width>1088||o.frameRate>Math.max(i,30)||o.videoRange!=="SDR"&&o.videoRange!==t||o.bitrate>Math.max(r,8e6))||!!S&&I(m)&&Object.keys(S).some(R=>parseInt(R)>m)}function Qt(o,e,t,i={}){const r=o.videoCodec;if(!r&&!o.audioCodec||!t)return Promise.resolve(Lt);const n=[],a=si(o),u=a.length,g=tt(o,e,u>0),p=g.length;for(let m=u||1*p||1;m--;){const S={type:"media-source"};if(u&&(S.video=a[m%u]),p){S.audio=g[m%p];const R=S.audio.bitrate;S.video&&R&&(S.video.bitrate-=R)}n.push(S)}if(r){const m=navigator.userAgent;if(r.split(",").some(S=>ot(S))&&Et())return Promise.resolve(oi(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${m})`),n))}return Promise.all(n.map(m=>{const S=Bt(m);return i[S]||(i[S]=t.decodingInfo(m))})).then(m=>({supported:!m.some(S=>!S.supported),configurations:n,decodingInfoResults:m})).catch(m=>({supported:!1,configurations:n,decodingInfoResults:[],error:m}))}function si(o){var e;const t=(e=o.videoCodec)==null?void 0:e.split(","),i=pt(o),r=o.width||640,n=o.height||480,a=o.frameRate||30,u=o.videoRange.toLowerCase();return t?t.map(g=>{const p={contentType:Dt(ht(g),"video"),width:r,height:n,bitrate:i,framerate:a};return u!=="sdr"&&(p.transferFunction=u),p}):[]}function tt(o,e,t){var i;const r=(i=o.audioCodec)==null?void 0:i.split(","),n=pt(o);return r&&o.audioGroups?o.audioGroups.reduce((a,u)=>{var g;const p=u?(g=e.groups[u])==null?void 0:g.tracks:null;return p?p.reduce((m,S)=>{if(S.groupId===u){const R=parseFloat(S.channels||"");r.forEach(H=>{const j={contentType:Dt(H,"audio"),bitrate:t?Ve(H,n):n};R&&(j.channels=""+R),m.push(j)})}return m},a):a},[]):[]}function Ve(o,e){if(e<=1)return 1;let t=128e3;return o==="ec-3"?t=768e3:o==="ac-3"&&(t=64e4),Math.min(e/2,t)}function pt(o){return Math.ceil(Math.max(o.bitrate*.9,o.averageBitrate)/1e3)*1e3||1}function Bt(o){let e="";const{audio:t,video:i}=o;if(i){const r=Ot(i.contentType);e+=`${r}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){const r=Ot(t.contentType);e+=`${i?"_":""}${r}_c${t.channels}`}return e}const Wt=["NONE","TYPE-0","TYPE-1",null];function Xt(o){return Wt.indexOf(o)>-1}const bi=["SDR","PQ","HLG"];function vi(o){return!!o&&bi.indexOf(o)>-1}var ii={No:"",Yes:"YES",v2:"v2"};function Ei(o){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=o,r=i<e/2;return e&&r?t?ii.v2:ii.Yes:ii.No}class jt{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 Si{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 ri(this._audioGroups,e)}hasSubtitleGroup(e){return ri(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 ri(o,e){return!e||!o?!1:o.indexOf(e)!==-1}function br(){if(typeof matchMedia=="function"){const o=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(o.media!==e.media)return o.matches===!0}return!1}function Gt(o,e){let t=!1,i=[];if(o&&(t=o!=="SDR",i=[o]),e){i=e.allowedVideoRanges||bi.slice(0);const r=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&br(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Kt=o=>{const e=new WeakSet;return(t,i)=>{if(o&&(i=o(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},Ft=(o,e)=>JSON.stringify(o,Kt(e));function gi(o,e,t,i,r){const n=Object.keys(o),a=i==null?void 0:i.channels,u=i==null?void 0:i.audioCodec,g=r==null?void 0:r.videoCodec,p=a&&parseInt(a)===2;let m=!1,S=!1,R=1/0,H=1/0,j=1/0,Q=1/0,Y=0,te=[];const{preferHDR:ce,allowedVideoRanges:ae}=Gt(e,r);for(let Ie=n.length;Ie--;){const Pe=o[n[Ie]];m||(m=Pe.channels[2]>0),R=Math.min(R,Pe.minHeight),H=Math.min(H,Pe.minFramerate),j=Math.min(j,Pe.minBitrate),ae.filter(ze=>Pe.videoRanges[ze]>0).length>0&&(S=!0)}R=I(R)?R:0,H=I(H)?H:0;const Ee=Math.max(1080,R),Te=Math.max(30,H);j=I(j)?j:t,t=Math.max(j,t),S||(e=void 0);const $e=n.length>1;return{codecSet:n.reduce((Ie,Pe)=>{const Ae=o[Pe];if(Pe===Ie)return Ie;if(te=S?ae.filter(ze=>Ae.videoRanges[ze]>0):[],$e){if(Ae.minBitrate>t)return zt(Pe,`min bitrate of ${Ae.minBitrate} > current estimate of ${t}`),Ie;if(!Ae.hasDefaultAudio)return zt(Pe,"no renditions with default or auto-select sound found"),Ie;if(u&&Pe.indexOf(u.substring(0,4))%5!==0)return zt(Pe,`audio codec preference "${u}" not found`),Ie;if(a&&!p){if(!Ae.channels[a])return zt(Pe,`no renditions with ${a} channel sound found (channels options: ${Object.keys(Ae.channels)})`),Ie}else if((!u||p)&&m&&Ae.channels[2]===0)return zt(Pe,"no renditions with stereo sound found"),Ie;if(Ae.minHeight>Ee)return zt(Pe,`min resolution of ${Ae.minHeight} > maximum of ${Ee}`),Ie;if(Ae.minFramerate>Te)return zt(Pe,`min framerate of ${Ae.minFramerate} > maximum of ${Te}`),Ie;if(!te.some(ze=>Ae.videoRanges[ze]>0))return zt(Pe,`no variants with VIDEO-RANGE of ${Ft(te)} found`),Ie;if(g&&Pe.indexOf(g.substring(0,4))%5!==0)return zt(Pe,`video codec preference "${g}" not found`),Ie;if(Ae.maxScore<Y)return zt(Pe,`max score of ${Ae.maxScore} < selected max of ${Y}`),Ie}return Ie&&(_e(Pe)>=_e(Ie)||Ae.fragmentError>o[Ie].fragmentError)?Ie:(Q=Ae.minIndex,Y=Ae.maxScore,Pe)},void 0),videoRanges:te,preferHDR:ce,minFramerate:H,minBitrate:j,minIndex:Q}}function zt(o,e){M.log(`[abr] start candidates with "${o}" ignored because ${e}`)}function yi(o){return o.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 r=t.channels||"2";return i.channels[r]=(i.channels[r]||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 Bi(o,e,t,i){return o.slice(t,i+1).reduce((r,n,a)=>{if(!n.codecSet)return r;const u=n.audioGroups;let g=r[n.codecSet];g||(r[n.codecSet]=g={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!u,fragmentError:0}),g.minBitrate=Math.min(g.minBitrate,n.bitrate);const p=Math.min(n.height,n.width);return g.minHeight=Math.min(g.minHeight,p),g.minFramerate=Math.min(g.minFramerate,n.frameRate),g.minIndex=Math.min(g.minIndex,a),g.maxScore=Math.max(g.maxScore,n.score),g.fragmentError+=n.fragmentError,g.videoRanges[n.videoRange]=(g.videoRanges[n.videoRange]||0)+1,u&&u.forEach(m=>{if(!m)return;const S=e.groups[m];S&&(g.hasDefaultAudio=g.hasDefaultAudio||e.hasDefaultAudio?S.hasDefault:S.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(S.channels).forEach(R=>{g.channels[R]=(g.channels[R]||0)+S.channels[R]}))}),r},{})}function Ni(o){if(!o)return o;const{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:n}=o;return{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:n}}function Ci(o,e,t){if("attrs"in o){const i=e.indexOf(o);if(i!==-1)return i}for(let i=0;i<e.length;i++){const r=e[i];if(pi(o,r,t))return i}return-1}function pi(o,e,t){const{groupId:i,name:r,lang:n,assocLang:a,default:u}=o,g=o.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(n===void 0||lr(n,e.lang))&&(n===void 0||e.assocLang===a)&&(u===void 0||e.default===u)&&(g===void 0||e.forced===g)&&(!("characteristics"in o)||wn(o.characteristics||"",e.characteristics))&&(t===void 0||t(o,e))}function lr(o,e="--"){return o.length===e.length?o===e:o.startsWith(e)||e.startsWith(o)}function wn(o,e=""){const t=o.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function Ji(o,e){const{audioCodec:t,channels:i}=o;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function sn(o,e,t,i,r){const n=e[i],u=e.reduce((R,H,j)=>{const Q=H.uri;return(R[Q]||(R[Q]=[])).push(j),R},{})[n.uri];u.length>1&&(i=Math.max.apply(Math,u));const g=n.videoRange,p=n.frameRate,m=n.codecSet.substring(0,4),S=an(e,i,R=>{if(R.videoRange!==g||R.frameRate!==p||R.codecSet.substring(0,4)!==m)return!1;const H=R.audioGroups,j=t.filter(Q=>!H||H.indexOf(Q.groupId)!==-1);return Ci(o,j,r)>-1});return S>-1?S:an(e,i,R=>{const H=R.audioGroups,j=t.filter(Q=>!H||H.indexOf(Q.groupId)!==-1);return Ci(o,j,r)>-1})}function an(o,e,t){for(let i=e;i>-1;i--)if(t(o[i]))return i;for(let i=e+1;i<o.length;i++)if(t(o[i]))return i;return-1}function Er(o,e){var t;return!!o&&o!==((t=e.loadLevelObj)==null?void 0:t.uri)}class er extends T{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.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:r,partCurrent:n,hls:a}=this,{autoLevelEnabled:u,media:g}=a;if(!r||!g)return;const p=performance.now(),m=n?n.stats:r.stats,S=n?n.duration:r.duration,R=p-m.loading.start,H=a.minAutoLevel,j=r.level,Q=this._nextAutoLevel;if(m.aborted||m.loaded&&m.loaded===m.total||j<=H){this.clearTimer(),this._nextAutoLevel=-1;return}if(!u)return;const Y=Q>-1&&Q!==j,te=!!t||Y;if(!te&&(g.paused||!g.playbackRate||!g.readyState))return;const ce=a.mainForwardBufferInfo;if(!te&&ce===null)return;const ae=this.bwEstimator.getEstimateTTFB(),Ee=Math.abs(g.playbackRate);if(R<=Math.max(ae,1e3*(S/(Ee*2))))return;const Te=ce?ce.len/Ee:0,$e=m.loading.first?m.loading.first-m.loading.start:-1,xe=m.loaded&&$e>-1,Ie=this.getBwEstimate(),Pe=a.levels,Ae=Pe[j],ze=Math.max(m.loaded,Math.round(S*(r.bitrate||Ae.averageBitrate)/8));let _t=xe?R-$e:R;_t<1&&xe&&(_t=Math.min(R,m.loaded*8/Ie));const xt=xe?m.loaded*1e3/_t:0,kt=ae/1e3,At=xt?(ze-m.loaded)/xt:ze*8/Ie+kt;if(At<=Te)return;const ut=xt?xt*8:Ie,Ct=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,vt=this.hls.config.abrBandWidthUpFactor;let Tt=Number.POSITIVE_INFINITY,Mt;for(Mt=j-1;Mt>H;Mt--){const Zt=Pe[Mt].maxBitrate,Ht=!Pe[Mt].details||Ct;if(Tt=this.getTimeToLoadFrag(kt,ut,S*Zt,Ht),Tt<Math.min(Te,S+kt))break}if(Tt>=At||Tt>S*10)return;xe?this.bwEstimator.sample(R-Math.min(ae,$e),m.loaded):this.bwEstimator.sampleTTFB(R);const ft=Pe[Mt].maxBitrate;this.getBwEstimate()*vt>ft&&this.resetEstimator(ft);const dt=this.findBestLevel(ft,H,Mt,0,Te,1,1);dt>-1&&(Mt=dt),this.warn(`Fragment ${r.sn}${n?" part "+n.index:""} of level ${j} is loading too slowly;
|
|
|
Fragment duration: ${r.duration.toFixed(3)}
|
|
|
Time to underbuffer: ${Te.toFixed(3)} s
|
|
|
Estimated load time for current fragment: ${At.toFixed(3)} s
|
|
|
Estimated load time for down switch fragment: ${Tt.toFixed(3)} s
|
|
|
TTFB estimate: ${$e|0} ms
|
|
|
Current BW estimate: ${I(Ie)?Ie|0:"Unknown"} bps
|
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
|
Switching to level ${Mt} @ ${ft|0} bps`),a.nextLoadLevel=a.nextAutoLevel=Mt,this.clearTimer();const $t=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===Mt&&Mt>0){const Zt=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Mt>0?"and switching down":""}
|
|
|
Fragment duration: ${r.duration.toFixed(3)} s
|
|
|
Time to underbuffer: ${Zt.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,Mt>H){let Ht=this.findBestLevel(this.hls.levels[H].bitrate,H,Mt,0,Zt,1,1);Ht===-1&&(Ht=H),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Ht,this.resetEstimator(this.hls.levels[Ht].bitrate)}}};Y||At>Tt*2?$t():this.timer=self.setInterval($t,Tt*1e3),a.trigger(_.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:n,stats:m})},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 y(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(_.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},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 r;this.fragCurrent=i,this.partCurrent=(r=t.part)!=null?r: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 w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case w.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:r,partCurrent:n}=this;if(i&&r&&i.sn===r.sn&&i.level===r.level){const a=performance.now(),u=n?n.stats:i.stats,g=a-u.loading.start,p=u.loading.first?u.loading.first-u.loading.start:-1;if(u.loaded&&p>-1){const S=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(g-Math.min(S,p),u.loaded)}else this.bwEstimator.sampleTTFB(g)}break}}}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,a=r?e+this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,n=r.end-r.first;I(n)&&(this.lastLevelLoadSec=n/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 r=i?i.stats:t.stats;if(t.type===v.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,a=this.hls.levels[t.level],u=(a.loaded?a.loaded.bytes:0)+r.loaded,g=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:u,duration:g},a.realBitrate=Math.round(8*u/g)}if(t.bitrateTest){const n={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(_.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==v.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(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,t,e,0,r,1,1);if(n>-1)return n;const a=this.hls.firstLevel,u=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${u}`),u}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=i&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}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:r,config:n,minAutoLevel:a}=i,u=t?t.duration:e?e.duration:0,g=this.getBwEstimate(),p=this.getStarvationDelay();let m=n.abrBandWidthFactor,S=n.abrBandWidthUpFactor;if(p){const Y=this.findBestLevel(g,a,r,p,0,m,S);if(Y>=0)return this.rebufferNotice=-1,Y}let R=u?Math.min(u,n.maxStarvationDelay):n.maxStarvationDelay;if(!p){const Y=this.bitrateTestDelay;Y&&(R=(u?Math.min(u,n.maxLoadingDelay):n.maxLoadingDelay)-Y,this.info(`bitrate test took ${Math.round(1e3*Y)}ms, set first fragment max fetchDuration to ${Math.round(1e3*R)} ms`),m=S=1)}const H=this.findBestLevel(g,a,r,p,R,m,S);if(this.rebufferNotice!==H&&(this.rebufferNotice=H,this.info(`${p?"rebuffering expected":"buffer is empty"}, optimal quality level ${H}`)),H>-1)return H;const j=i.levels[a],Q=i.loadLevelObj;return Q&&(j==null?void 0:j.bitrate)<Q.bitrate?a: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,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,n,a,u){var g;const p=r+n,m=this.lastLoadedFragLevel,S=m===-1?this.hls.firstLevel:m,{fragCurrent:R,partCurrent:H}=this,{levels:j,allAudioTracks:Q,loadLevel:Y,config:te}=this.hls;if(j.length===1)return 0;const ce=j[S],ae=!!((g=this.hls.latestLevelDetails)!=null&&g.live),Ee=Y===-1||m===-1;let Te,$e="SDR",xe=(ce==null?void 0:ce.frameRate)||0;const{audioPreference:Ie,videoPreference:Pe}=te,Ae=this.audioTracksByGroup||(this.audioTracksByGroup=yi(Q));let ze=-1;if(Ee){if(this.firstSelection!==-1)return this.firstSelection;const ut=this.codecTiers||(this.codecTiers=Bi(j,Ae,t,i)),Ct=gi(ut,$e,e,Ie,Pe),{codecSet:vt,videoRanges:Tt,minFramerate:Mt,minBitrate:ft,minIndex:dt,preferHDR:$t}=Ct;ze=dt,Te=vt,$e=$t?Tt[Tt.length-1]:Tt[0],xe=Mt,e=Math.max(e,ft),this.log(`picked start tier ${Ft(Ct)}`)}else Te=ce==null?void 0:ce.codecSet,$e=ce==null?void 0:ce.videoRange;const _t=H?H.duration:R?R.duration:0,xt=this.bwEstimator.getEstimateTTFB()/1e3,kt=[];for(let ut=i;ut>=t;ut--){var At;const Ct=j[ut],vt=ut>S;if(!Ct)continue;if(te.useMediaCapabilities&&!Ct.supportedResult&&!Ct.supportedPromise){const Ht=navigator.mediaCapabilities;typeof(Ht==null?void 0:Ht.decodingInfo)=="function"&&fi(Ct,Ae,$e,xe,e,Ie)?(Ct.supportedPromise=Qt(Ct,Ae,Ht,this.supportedCache),Ct.supportedPromise.then(Vt=>{if(!this.hls)return;Ct.supportedResult=Vt;const ki=this.hls.levels,Di=ki.indexOf(Ct);Vt.error?this.warn(`MediaCapabilities decodingInfo error: "${Vt.error}" for level ${Di} ${Ft(Vt)}`):Vt.supported?Vt.decodingInfoResults.some(Xi=>Xi.smooth===!1||Xi.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Di} not smooth or powerEfficient: ${Ft(Vt)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Di} ${Ft(Vt)}`),Di>-1&&ki.length>1&&(this.log(`Removing unsupported level ${Di}`),this.hls.removeLevel(Di),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Vt=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Vt}`)})):Ct.supportedResult=Lt}if((Te&&Ct.codecSet!==Te||$e&&Ct.videoRange!==$e||vt&&xe>Ct.frameRate||!vt&&xe>0&&xe<Ct.frameRate||(At=Ct.supportedResult)!=null&&(At=At.decodingInfoResults)!=null&&At.some(Ht=>Ht.smooth===!1))&&(!Ee||ut!==ze)){kt.push(ut);continue}const Tt=Ct.details,Mt=(H?Tt==null?void 0:Tt.partTarget:Tt==null?void 0:Tt.averagetargetduration)||_t;let ft;vt?ft=u*e:ft=a*e;const dt=_t&&r>=_t*2&&n===0?Ct.averageBitrate:Ct.maxBitrate,$t=this.getTimeToLoadFrag(xt,ft,dt*Mt,Tt===void 0);if(ft>=dt&&(ut===m||Ct.loadError===0&&Ct.fragmentError===0)&&($t<=xt||!I($t)||ae&&!this.bitrateTestDelay||$t<p)){const Ht=this.forcedAutoLevel;return ut!==Y&&(Ht===-1||Ht!==Y)&&(kt.length&&this.trace(`Skipped level(s) ${kt.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${j[kt[0]].codecs}" ${j[kt[0]].videoRange}; not compatible with "${Te}" ${$e}`),this.info(`switch candidate:${S}->${ut} adjustedbw(${Math.round(ft)})-bitrate=${Math.round(ft-dt)} ttfb:${xt.toFixed(1)} avgDuration:${Mt.toFixed(1)} maxFetchDuration:${p.toFixed(1)} fetchDuration:${$t.toFixed(1)} firstSelection:${Ee} codecSet:${Ct.codecSet} videoRange:${Ct.videoRange} hls.loadLevel:${Y}`)),Ee&&(this.firstSelection=ut),ut}}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 Ti={search:function(o,e){let t=0,i=o.length-1,r=null,n=null;for(;t<=i;){r=(t+i)/2|0,n=o[r];const a=e(n);if(a>0)t=r+1;else if(a<0)i=r-1;else return n}return null}};function wi(o,e,t){if(e===null||!Array.isArray(o)||!o.length||!I(e))return null;const i=o[0].programDateTime;if(e<(i||0))return null;const r=o[o.length-1].endProgramDateTime;if(e>=(r||0))return null;for(let n=0;n<o.length;++n){const a=o[n];if(li(e,t,a))return a}return null}function zi(o,e,t=0,i=0,r=.005){let n=null;if(o){n=e[1+o.sn-e[0].sn]||null;const u=o.endDTS-t;u>0&&u<15e-7&&(t+=15e-7),n&&o.level!==n.level&&n.end<=o.end&&(n=e[2+o.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!o||o.level===n.level)&&Jt(t,i,n)===0||Ui(n,o,Math.min(r,i))))return n;const a=Ti.search(e,Jt.bind(null,t,i));return a&&(a!==o||!n)?a:n}function Ui(o,e,t){if(e&&e.start===0&&e.level<o.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((r,n)=>(n[0]==="INF"&&(r+=parseFloat(n[1])),r),t);return o.start<=i}return!1}function Jt(o=0,e=0,t){if(t.start<=o&&t.start+t.duration>o)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=o?1:t.start-i>o&&t.start?-1:0}function li(o,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>o}function $i(o,e,t){if(o&&o.startCC<=e&&o.endCC>=e){let i=o.fragments;const{fragmentHint:r}=o;r&&(i=i.concat(r));let n;return Ti.search(i,a=>a.cc<e?1:a.cc>e?-1:(n=a,a.end<=t?1:a.start>t?-1:0)),n||null}return null}function Vi(o){switch(o.details){case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_TIMEOUT:case w.LEVEL_LOAD_TIMEOUT:case w.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Pi(o,e){const t=Vi(e);return o.default[`${t?"timeout":"error"}Retry`]}function Or(o,e){const t=o.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*o.retryDelayMs,o.maxRetryDelayMs)}function Fr(o){return h(h({},o),{errorRetry:null,timeoutRetry:null})}function qi(o,e,t,i){if(!o)return!1;const r=i==null?void 0:i.code,n=e<o.maxNumRetry&&(Sr(r)||!!t);return o.shouldRetry?o.shouldRetry(o,e,t,i,n):n}function Sr(o){return zr(o)||!!o&&(o<400||o>499)}function zr(o){return o===0&&navigator.onLine===!1}var ci={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},mi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class Vr extends T{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(_.ERROR,this.onError,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.ERROR,this.onError,this),e.off(_.ERROR,this.onErrorOut,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===v.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||i===-1?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if((i=e.details)!=null&&i.hasKey(t))return!0;const r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(a=>r.indexOf(a.groupId)>=0).some(a=>{var u;return(u=a.details)==null?void 0:u.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const r=this.hls,n=t.context;switch(t.details){case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case w.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=tr();return}case w.FRAG_GAP:case w.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ci.SendAlternateToPenaltyBox;return}case w.LEVEL_EMPTY_ERROR:case w.LEVEL_PARSING_ERROR:{var a;const g=t.parent===v.MAIN?t.level:r.loadLevel;t.details===w.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,g):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,g))}return;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:typeof(n==null?void 0:n.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level));return;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.SUBTITLE_LOAD_ERROR:case w.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const g=r.loadLevelObj;if(g&&(n.type===F.AUDIO_TRACK&&g.hasAudioGroup(n.groupId)||n.type===F.SUBTITLE_TRACK&&g.hasSubtitleGroup(n.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=ci.SendAlternateToPenaltyBox,t.errorAction.flags=mi.MoveAllAlternatesMatchingHost;return}}return;case w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:ci.SendAlternateToPenaltyBox,flags:mi.MoveAllAlternatesMatchingHDCP};return;case w.KEY_SYSTEM_SESSION_UPDATE_FAILED:case w.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case w.KEY_SYSTEM_NO_SESSION:t.errorAction={action:ci.SendAlternateToPenaltyBox,flags:mi.MoveAllAlternatesMatchingKey};return;case w.BUFFER_ADD_CODEC_ERROR:case w.REMUX_ALLOC_ERROR:case w.BUFFER_APPEND_ERROR:if(!t.errorAction){var u;t.errorAction=this.getLevelSwitchAction(t,(u=t.level)!=null?u:r.loadLevel)}return;case w.INTERNAL_EXCEPTION:case w.BUFFER_APPENDING_ERROR:case w.BUFFER_FULL_ERROR:case w.LEVEL_SWITCH_ERROR:case w.BUFFER_STALLED_ERROR:case w.BUFFER_SEEK_OVER_HOLE:case w.BUFFER_NUDGE_ON_STALL:t.errorAction=tr();return}t.type===D.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=tr())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,r=Pi(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(qi(r,n,Vi(e),e.response))return{action:ci.RetryRequest,flags:mi.None,retryConfig:r,retryCount:n};const u=this.getLevelSwitchAction(e,t);return r&&(u.retryConfig=r,u.retryCount=n),u}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,u=Pi(e.details.startsWith("key")?a:n,e),g=t.levels.reduce((m,S)=>m+S.fragmentError,0);if(r&&(e.details!==w.FRAG_GAP&&r.fragmentError++,qi(u,g,Vi(e),e.response)))return{action:ci.RetryRequest,flags:mi.None,retryConfig:u,retryCount:g};const p=this.getLevelSwitchAction(e,i);return u&&(p.retryConfig=u,p.retryCount=g),p}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r){var n,a;const p=e.details;r.loadError++,p===w.BUFFER_APPEND_ERROR&&r.fragmentError++;let m=-1;const{levels:S,loadLevel:R,minAutoLevel:H,maxAutoLevel:j}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const Q=(n=e.frag)==null?void 0:n.type,te=(Q===v.AUDIO&&p===w.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(p===w.BUFFER_ADD_CODEC_ERROR||p===w.BUFFER_APPEND_ERROR))&&S.some(({audioCodec:$e})=>r.audioCodec!==$e),ae=e.sourceBufferName==="video"&&(p===w.BUFFER_ADD_CODEC_ERROR||p===w.BUFFER_APPEND_ERROR)&&S.some(({codecSet:$e,audioCodec:xe})=>r.codecSet!==$e&&r.audioCodec===xe),{type:Ee,groupId:Te}=(a=e.context)!=null?a:{};for(let $e=S.length;$e--;){const xe=($e+R)%S.length;if(xe!==R&&xe>=H&&xe<=j&&S[xe].loadError===0){var u,g;const Ie=S[xe];if(p===w.FRAG_GAP&&Q===v.MAIN&&e.frag){const Pe=S[xe].details;if(Pe){const Ae=zi(e.frag,Pe.fragments,e.frag.start);if(Ae!=null&&Ae.gap)continue}}else{if(Ee===F.AUDIO_TRACK&&Ie.hasAudioGroup(Te)||Ee===F.SUBTITLE_TRACK&&Ie.hasSubtitleGroup(Te))continue;if(Q===v.AUDIO&&(u=r.audioGroups)!=null&&u.some(Pe=>Ie.hasAudioGroup(Pe))||Q===v.SUBTITLE&&(g=r.subtitleGroups)!=null&&g.some(Pe=>Ie.hasSubtitleGroup(Pe))||te&&r.audioCodec===Ie.audioCodec||ae&&r.codecSet===Ie.codecSet||!te&&r.codecSet!==Ie.codecSet)continue}m=xe;break}}if(m>-1&&i.loadLevel!==m)return e.levelRetry=!0,this.playlistError=0,{action:ci.SendAlternateToPenaltyBox,flags:mi.None,nextAutoLevel:m}}return{action:ci.SendAlternateToPenaltyBox,flags:mi.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ci.DoNothing:break;case ci.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==w.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case ci.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r}=i,n=i.nextAutoLevel;switch(r){case mi.None:this.switchLevel(e,n);break;case mi.MoveAllAlternatesMatchingHDCP:{const g=this.getVariantLevelIndex(e.frag),p=t.levels[g],m=p==null?void 0:p.attrs["HDCP-LEVEL"];if(i.hdcpLevel=m,m){t.maxHdcpLevel=Wt[Wt.indexOf(m)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case mi.MoveAllAlternatesMatchingKey:{const g=e.decryptdata;if(g){const p=this.hls.levels;for(let m=p.length;m--;)if(this.variantHasKey(p[m],g)){var a,u;this.log(`Banned key found in level ${m} (${p[m].bitrate}bps) or audio group "${(a=p[m].audioGroups)==null?void 0:a.join(",")}" (${(u=e.frag)==null?void 0:u.type} fragment) ${J(g.keyId||[])}`),p[m].fragmentError++,p[m].loadError++,this.log(`Removing level ${m} with key error (${e.error})`),this.hls.removeLevel(m)}p.length&&(i.resolved=!0)}break}}i.resolved||this.switchLevel(e,n)}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===w.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=Ot(e.mimeType),r=this.hls.levels;for(let n=r.length;n--;)r[n][`${e.sourceBufferName}Codec`]===i&&(this.log(`Removing level ${n} for ${e.details} ("${i}" not supported)`),this.hls.removeLevel(n))}}}function tr(o){const e={action:ci.DoNothing,flags:mi.None};return o&&(e.resolved=!0),e}var ei={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class ur{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&&(e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.BUFFER_APPENDED,this.onBufferAppended,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.BUFFER_APPENDED,this.onBufferAppended,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const n=i[r];if(!n)break;if(n.start<=e&&e<=n.end&&n.loaded)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:r}=this,n=Object.keys(r);for(let a=n.length;a--;){const u=r[n[a]];if((u==null?void 0:u.body.type)===t&&(!i||u.buffered)){const g=u.body;if(g.start<=e&&e<=g.end)return g}}return null}detectEvictedFragments(e,t,i,r,n){this.timeRanges&&(this.timeRanges[e]=t);const a=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(u=>{const g=this.fragments[u];if(!g||a>=g.body.sn)return;if(!g.buffered&&(!g.loaded||n)){g.body.type===i&&this.removeFragment(g.body);return}const p=g.range[e];if(p){if(p.time.length===0){this.removeFragment(g.body);return}p.time.some(m=>{const S=!this.isTimeBuffered(m.startPTS,m.endPTS,t);return S&&this.removeFragment(g.body),S})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,r=Li(i),n=this.fragments[r];if(!n||n.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(u=>{const g=i.elementaryStreams[u];if(!g)return;const p=t[u],m=a||g.partial===!0;n.range[u]=this.getBufferedTimes(i,e.part,m,p)}),n.loaded=null,Object.keys(n.range).length?(n.buffered=!0,(n.body.endList=i.endList||n.body.endList)&&(this.endListFragments[n.body.type]=n),Yi(n)||this.removeParts(i.sn-1,i.type)):this.removeFragment(n.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=qr(i,r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=Li(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},a=e.start,u=e.end,g=e.minEndPTS||u,p=e.maxStartPTS||a;for(let m=0;m<r.length;m++){const S=r.start(m)-this.bufferPadding,R=r.end(m)+this.bufferPadding;if(p>=S&&g<=R){n.time.push({startPTS:Math.max(a,r.start(m)),endPTS:Math.min(u,r.end(m))});break}else if(a<R&&u>S){const H=Math.max(a,r.start(m)),j=Math.min(u,r.end(m));j>H&&(n.partial=!0,n.time.push({startPTS:H,endPTS:j}))}else if(u<=S)break}return n}getPartialFragment(e){let t=null,i,r,n,a=0;const{bufferPadding:u,fragments:g}=this;return Object.keys(g).forEach(p=>{const m=g[p];m&&Yi(m)&&(r=m.body.start-u,n=m.body.end+u,e>=r&&e<=n&&(i=Math.min(e-r,n-e),a<=i&&(t=m.body,a=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Yi(t))}getState(e){const t=Li(e),i=this.fragments[t];return i?i.buffered?Yi(i)?ei.PARTIAL:ei.OK:ei.APPENDING:ei.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let a=0;a<i.length;a++){if(r=i.start(a)-this.bufferPadding,n=i.end(a)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,r=t.part?null:t,n=Li(i);this.fragments[n]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n,type:a}=t;if(i.sn==="initSegment")return;const u=i.type;if(r){let p=this.activePartLists[u];p||(this.activePartLists[u]=p=[]),p.push(r)}this.timeRanges=n;const g=n[a];this.detectEvictedFragments(a,g,u,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Li(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let r=i.length;r--;){const n=t[i[r]];if((n==null?void 0:n.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const u=this.fragments[a];if(!u)return;const g=u.body;g.type!==i||r&&!g.gap||g.start<t&&g.end>e&&(u.buffered||n)&&this.removeFragment(g)})}removeFragment(e){const t=Li(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=qr(i,n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(i=>i.clearElementaryStreamInfo())}}function Yi(o){var e,t,i;return o.buffered&&!!(o.body.gap||(e=o.range.video)!=null&&e.partial||(t=o.range.audio)!=null&&t.partial||(i=o.range.audiovideo)!=null&&i.partial)}function Li(o){return`${o.type}_${o.level}_${o.sn}`}function qr(o,e){return o.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var hi={cbc:0,ctr:1};class wr{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 hi.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case hi.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 on(o){const e=o.byteLength,t=e&&new DataView(o.buffer).getUint8(e-1);return t?o.slice(0,e-t):o}class xn{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 r=0;r<4;r++)i[r]=t.getUint32(r*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],a=i[2],u=i[3],g=this.invSubMix,p=g[0],m=g[1],S=g[2],R=g[3],H=new Uint32Array(256);let j=0,Q=0,Y=0;for(Y=0;Y<256;Y++)Y<128?H[Y]=Y<<1:H[Y]=Y<<1^283;for(Y=0;Y<256;Y++){let te=Q^Q<<1^Q<<2^Q<<3^Q<<4;te=te>>>8^te&255^99,e[j]=te,t[te]=j;const ce=H[j],ae=H[ce],Ee=H[ae];let Te=H[te]*257^te*16843008;r[j]=Te<<24|Te>>>8,n[j]=Te<<16|Te>>>16,a[j]=Te<<8|Te>>>24,u[j]=Te,Te=Ee*16843009^ae*65537^ce*257^j*16843008,p[te]=Te<<24|Te>>>8,m[te]=Te<<16|Te>>>16,S[te]=Te<<8|Te>>>24,R[te]=Te,j?(j=ce^H[H[H[Ee^ce]]],Q^=H[H[Q]]):j=Q=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r<t.length&&i;)i=t[r]===this.key[r],r++;if(i)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const a=this.ksRows=(n+6+1)*4;let u,g;const p=this.keySchedule=new Uint32Array(a),m=this.invKeySchedule=new Uint32Array(a),S=this.sBox,R=this.rcon,H=this.invSubMix,j=H[0],Q=H[1],Y=H[2],te=H[3];let ce,ae;for(u=0;u<a;u++){if(u<n){ce=p[u]=t[u];continue}ae=ce,u%n===0?(ae=ae<<8|ae>>>24,ae=S[ae>>>24]<<24|S[ae>>>16&255]<<16|S[ae>>>8&255]<<8|S[ae&255],ae^=R[u/n|0]<<24):n>6&&u%n===4&&(ae=S[ae>>>24]<<24|S[ae>>>16&255]<<16|S[ae>>>8&255]<<8|S[ae&255]),p[u]=ce=(p[u-n]^ae)>>>0}for(g=0;g<a;g++)u=a-g,g&3?ae=p[u]:ae=p[u-4],g<4||u<=4?m[g]=ae:m[g]=j[S[ae>>>24]]^Q[S[ae>>>16&255]]^Y[S[ae>>>8&255]]^te[S[ae&255]],m[g]=m[g]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,u=this.invSubMix,g=u[0],p=u[1],m=u[2],S=u[3],R=this.uint8ArrayToUint32Array_(i);let H=R[0],j=R[1],Q=R[2],Y=R[3];const te=new Int32Array(e),ce=new Int32Array(te.length);let ae,Ee,Te,$e,xe,Ie,Pe,Ae,ze,_t,xt,kt,At,ut;const Ct=this.networkToHostOrderSwap;for(;t<te.length;){for(ze=Ct(te[t]),_t=Ct(te[t+1]),xt=Ct(te[t+2]),kt=Ct(te[t+3]),xe=ze^n[0],Ie=kt^n[1],Pe=xt^n[2],Ae=_t^n[3],At=4,ut=1;ut<r;ut++)ae=g[xe>>>24]^p[Ie>>16&255]^m[Pe>>8&255]^S[Ae&255]^n[At],Ee=g[Ie>>>24]^p[Pe>>16&255]^m[Ae>>8&255]^S[xe&255]^n[At+1],Te=g[Pe>>>24]^p[Ae>>16&255]^m[xe>>8&255]^S[Ie&255]^n[At+2],$e=g[Ae>>>24]^p[xe>>16&255]^m[Ie>>8&255]^S[Pe&255]^n[At+3],xe=ae,Ie=Ee,Pe=Te,Ae=$e,At=At+4;ae=a[xe>>>24]<<24^a[Ie>>16&255]<<16^a[Pe>>8&255]<<8^a[Ae&255]^n[At],Ee=a[Ie>>>24]<<24^a[Pe>>16&255]<<16^a[Ae>>8&255]<<8^a[xe&255]^n[At+1],Te=a[Pe>>>24]<<24^a[Ae>>16&255]<<16^a[xe>>8&255]<<8^a[Ie&255]^n[At+2],$e=a[Ae>>>24]<<24^a[xe>>16&255]<<16^a[Ie>>8&255]<<8^a[Pe&255]^n[At+3],ce[t]=Ct(ae^H),ce[t+1]=Ct($e^j),ce[t+2]=Ct(Te^Q),ce[t+3]=Ct(Ee^Y),H=ze,j=_t,Q=xt,Y=kt,t=t+4}return ce.buffer}}class xr{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=ln(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function ln(o){switch(o){case hi.cbc:return"AES-CBC";case hi.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${o}`)}}const An=16;class Mr{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?on(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,r){return this.useSoftware?new Promise((n,a)=>{const u=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(u,t,i,r);const g=this.flush();g?n(g.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,r)}softwareDecrypt(e,t,i,r){const{currentIV:n,currentResult:a,remainderData:u}=this;if(r!==hi.cbc||t.byteLength!==16)return M.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),u&&(e=Ge(u,e),this.remainderData=null);const g=this.getValidChunk(e);if(!g.length)return null;n&&(i=n);let p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new xn),p.expandKey(t);const m=a;return this.currentResult=p.decrypt(g.buffer,0,i),this.currentIV=g.slice(-16).buffer,m||null}webCryptoDecrypt(e,t,i,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,r));this.key=t,this.fastAesKey=new xr(this.subtle,t,r)}return this.fastAesKey.expandKey().then(n=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new wr(this.subtle,new Uint8Array(i),r).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(M.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,i,r)))}onWebCryptoError(e,t,i,r){const n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,r);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(n?" 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&&(M.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Yr=Math.pow(2,17);class Ar{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 Oi({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((u,g)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(j=>j[0]==="GAP")){g(Br(e));return}else e.gap=!1;const p=this.loader=n?new n(r):new a(r),m=cr(e);e.loader=p;const S=Fr(r.fragLoadPolicy.default),R={loadPolicy:S,timeout:S.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Yr};e.stats=p.stats;const H={onSuccess:(j,Q,Y,te)=>{this.resetLoader(e,p);let ce=j.data;Y.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(ce.slice(0,16)),ce=ce.slice(16)),u({frag:e,part:null,payload:ce,networkDetails:te})},onError:(j,Q,Y,te)=>{this.resetLoader(e,p),g(new Oi({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:h({url:i,data:void 0},j),error:new Error(`HTTP Error ${j.code} ${j.text}`),networkDetails:Y,stats:te}))},onAbort:(j,Q,Y)=>{this.resetLoader(e,p),g(new Oi({type:D.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:Y,stats:j}))},onTimeout:(j,Q,Y)=>{this.resetLoader(e,p),g(new Oi({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${R.timeout}ms`),networkDetails:Y,stats:j}))}};t&&(H.onProgress=(j,Q,Y,te)=>t({frag:e,part:null,payload:Y,networkDetails:te})),p.load(m,R,H)})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((u,g)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){g(Br(e,t));return}const p=this.loader=n?new n(r):new a(r),m=cr(e,t);e.loader=p;const S=Fr(r.fragLoadPolicy.default),R={loadPolicy:S,timeout:S.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Yr};t.stats=p.stats,p.load(m,R,{onSuccess:(H,j,Q,Y)=>{this.resetLoader(e,p),this.updateStatsFromPart(e,t);const te={frag:e,part:t,payload:H.data,networkDetails:Y};i(te),u(te)},onError:(H,j,Q,Y)=>{this.resetLoader(e,p),g(new Oi({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:h({url:m.url,data:void 0},H),error:new Error(`HTTP Error ${H.code} ${H.text}`),networkDetails:Q,stats:Y}))},onAbort:(H,j,Q)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,p),g(new Oi({type:D.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:Q,stats:H}))},onTimeout:(H,j,Q)=>{this.resetLoader(e,p),g(new Oi({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${R.timeout}ms`),networkDetails:Q,stats:H}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const g=Math.round(e.duration/t.duration),p=Math.min(Math.round(i.loaded/n),g),S=(g-p)*Math.round(i.loaded/p);i.total=i.loaded+S}else i.total=Math.max(i.loaded,i.total);const a=i.loading,u=r.loading;a.start?a.first+=u.first-u.start:(a.start=u.start,a.first=u.first),a.end=u.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function cr(o,e=null){const t=e||o,i={frag:o,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(I(r)&&I(n)){var a;let u=r,g=n;if(o.sn==="initSegment"&&Cr((a=o.decryptdata)==null?void 0:a.method)){const p=n-r;p%16&&(g=n+(16-p%16)),r!==0&&(i.resetIV=!0,u=r-16)}i.rangeStart=u,i.rangeEnd=g}return i}function Br(o,e){const t=new Error(`GAP ${o.gap?"tag":"attribute"} found`),i={type:D.MEDIA_ERROR,details:w.FRAG_GAP,fatal:!1,frag:o,error:t,networkDetails:null};return e&&(i.part=e),(e||o).stats.aborted=!0,new Oi(i)}function Cr(o){return o==="AES-128"||o==="AES-256"}class Oi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Tr extends T{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 Fi{constructor(e,t,i,r=0,n=-1,a=!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=Wi(),this.buffering={audio:Wi(),video:Wi(),audiovideo:Wi()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=a}}function Wi(){return{start:0,executeStart:0,executeEnd:0,end:0}}const ir={length:0,start:()=>0,end:()=>0};class It{static isBuffered(e,t){if(e){const i=It.getBuffered(e);for(let r=i.length;r--;)if(t>=i.start(r)&&t<=i.end(r))return!0}return!1}static bufferedRanges(e){if(e){const t=It.getBuffered(e);return It.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 r=It.bufferedRanges(e);if(r.length)return It.bufferedInfo(r,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((m,S)=>m.start-S.start||S.end-m.end);let r=-1,n=[];if(i)for(let m=0;m<e.length;m++){t>=e[m].start&&t<=e[m].end&&(r=m);const S=n.length;if(S){const R=n[S-1].end;e[m].start-R<i?e[m].end>R&&(n[S-1].end=e[m].end):n.push(e[m])}else n.push(e[m])}else n=e;let a=0,u,g=t,p=t;for(let m=0;m<n.length;m++){const S=n[m].start,R=n[m].end;if(r===-1&&t>=S&&t<=R&&(r=m),t+i>=S&&t<R)g=S,p=R,a=p-t;else if(t+i<S){u=S;break}}return{len:a,start:g||0,end:p||0,nextStart:u,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||ir}catch(t){return M.log("failed to get media.buffered",t),ir}}}const Nr=/\{\$([a-zA-Z0-9-_]+)\}/g;function un(o){return Nr.test(o)}function Ur(o,e){if(o.variableList!==null||o.hasVariableRefs){const t=o.variableList;return e.replace(Nr,i=>{const r=i.substring(2,i.length-1),n=t==null?void 0:t[r];return n===void 0?(o.playlistParsingError||(o.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):n})}return e}function Zr(o,e,t){let i=o.variableList;i||(o.variableList=i={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(r))n=a.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(a){o.playlistParsingError||(o.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else r=e.NAME,n=e.VALUE;r in i?o.playlistParsingError||(o.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=n||""}function cn(o,e,t){const i=e.IMPORT;if(t&&i in t){let r=o.variableList;r||(o.variableList=r={}),r[i]=t[i]}else o.playlistParsingError||(o.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const Cn=/^(\d+)x(\d+)$/,hn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ti{constructor(e,t){typeof e=="string"&&(e=ti.parseAttrList(e,t)),c(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 r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*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((r,n)=>(r[n.toLowerCase()]=!0,r),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Cn.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const r={},n='"';for(hn.lastIndex=0;(i=hn.exec(e))!==null;){const a=i[1].trim();let u=i[2];const g=u.indexOf(n)===0&&u.lastIndexOf(n)===u.length-1;let p=!1;if(g)u=u.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":p=!0}if(t&&(g||p))u=Ur(t,u);else if(!p&&!g)switch(a){case"CLOSED-CAPTIONS":if(u==="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":M.warn(`${e}: attribute ${a} is missing quotes`)}r[a]=u}return r}}const Tn="com.apple.hls.interstitial";function Dn(o){return o!=="ID"&&o!=="CLASS"&&o!=="CUE"&&o!=="START-DATE"&&o!=="DURATION"&&o!=="END-DATE"&&o!=="END-ON-NEXT"}function fn(o){return o==="SCTE35-OUT"||o==="SCTE35-IN"||o==="SCTE35-CMD"}class dn{constructor(e,t,i=0){var r;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=(r=t==null?void 0:t.tagOrder)!=null?r:i,t){const n=t.attr;for(const a in n)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==n[a]){M.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=c(new ti({}),n,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 n=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);I(n.getTime())&&(this._endDate=n)}}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?(M.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(I(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===Tn}get isValid(){return!!this.id&&!this._badValueForSameId&&I(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 Ln=10;class Rn{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}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return this.fragments.length?I(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Ln}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(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.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 Gi(o,e){return o.length===e.length?!o.some((t,i)=>t!==e[i]):!1}function $r(o,e){return!o&&!e?!0:!o||!e?!1:Gi(o,e)}function hr(o){return o==="AES-128"||o==="AES-256"||o==="AES-256-CTR"}function Ri(o){switch(o){case"AES-128":case"AES-256":return hi.cbc;case"AES-256-CTR":return hi.ctr;default:throw new Error(`invalid full segment method ${o}`)}}function fr(o){return Uint8Array.from(atob(o),e=>e.charCodeAt(0))}function Dr(o){return Uint8Array.from(unescape(encodeURIComponent(o)),e=>e.charCodeAt(0))}function rr(o){const e=Dr(o).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function dr(o){const e=function(i,r,n){const a=i[r];i[r]=i[n],i[n]=a};e(o,0,3),e(o,1,2),e(o,4,5),e(o,6,7)}function Xr(o){const e=o.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),r=i[i.length-1].split(",");if(r.length===2){const n=r[0]==="base64",a=r[1];n?(i.splice(-1,1),t=fr(a)):t=rr(a)}}return t}const Lr=typeof self!="undefined"?self:void 0;var ai={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},xi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Hr(o){switch(o){case xi.FAIRPLAY:return ai.FAIRPLAY;case xi.PLAYREADY:return ai.PLAYREADY;case xi.WIDEVINE:return ai.WIDEVINE;case xi.CLEARKEY:return ai.CLEARKEY}}function St(o){switch(o){case ai.FAIRPLAY:return xi.FAIRPLAY;case ai.PLAYREADY:return xi.PLAYREADY;case ai.WIDEVINE:return xi.WIDEVINE;case ai.CLEARKEY:return xi.CLEARKEY}}function Pt(o){const{drmSystems:e,widevineLicenseUrl:t}=o,i=e?[ai.FAIRPLAY,ai.WIDEVINE,ai.PLAYREADY,ai.CLEARKEY].filter(r=>!!e[r]):[];return!i[ai.WIDEVINE]&&t&&i.push(ai.WIDEVINE),i}const ni=function(o){return Lr!=null&&(o=Lr.navigator)!=null&&o.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function _i(o,e,t,i){let r;switch(o){case ai.FAIRPLAY:r=["cenc","sinf"];break;case ai.WIDEVINE:case ai.PLAYREADY:r=["cenc"];break;case ai.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${o}`)}return ui(r,e,t,i)}function ui(o,e,t,i){return[{initDataTypes:o,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs=${n}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs=${n}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function pn(o){var e;return!!o&&(o.sessionType==="persistent-license"||!!((e=o.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function kn(o){const e=new Uint16Array(o.buffer,o.byteOffset,o.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(a){const u=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(u){const g=fr(u).subarray(0,16);return dr(g),g}}return null}let Qr={};class Rr{static clearKeyUriToKeyIdMap(){Qr={}}constructor(e,t,i,r=[1],n=null,a){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=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!hr(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(z(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Gi(e.keyFormatVersions,this.keyFormatVersions)&&$r(e.iv,this.iv)&&$r(e.keyId,this.keyId)}isSupported(){if(this.method){if(hr(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case xi.FAIRPLAY:case xi.WIDEVINE:case xi.PLAYREADY:case xi.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(hr(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(M.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=rl(e);return new Rr(this.method,this.uri,"identity",this.keyFormatVersions,i)}if(this.pssh&&this.keyId)return this;const t=Xr(this.uri);if(t)switch(this.keyFormat){case xi.WIDEVINE:if(this.pssh=t,!this.keyId&&t.length>=22){const i=t.length-22;this.keyId=t.subarray(i,i+16)}break;case xi.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=mt(i,null,t),this.keyId=kn(t);break}default:{let i=t.subarray(0,16);if(i.length!==16){const r=new Uint8Array(16);r.set(i,16-i.length),i=r}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=Qr[this.uri];if(!i){const r=Object.keys(Qr).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),Qr[this.uri]=i}this.keyId=i}return this}}function rl(o){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=o>>8*(15-t)&255;return e}const ia=/#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,ra=/#EXT-X-MEDIA:(.*)/g,nl=/^#EXT(?:INF|-X-TARGETDURATION):/m,us=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),sl=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 pr{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static resolve(e,t){return k.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return nl.test(e)}static parseMasterPlaylist(e,t){const i=un(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];ia.lastIndex=0;let a;for(;(a=ia.exec(e))!=null;)if(a[1]){var u;const p=new ti(a[1],r),m=Ur(r,a[2]),S={attrs:p,bitrate:p.decimalInteger("BANDWIDTH")||p.decimalInteger("AVERAGE-BANDWIDTH"),name:p.NAME,url:pr.resolve(m,t)},R=p.decimalResolution("RESOLUTION");R&&(S.width=R.width,S.height=R.height),oa(p.CODECS,S);const H=p["SUPPLEMENTAL-CODECS"];H&&(S.supplemental={},oa(H,S.supplemental)),(u=S.unknownCodecs)!=null&&u.length||n.push(S),r.levels.push(S)}else if(a[3]){const p=a[3],m=a[4];switch(p){case"SESSION-DATA":{const S=new ti(m,r),R=S["DATA-ID"];R&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[R]=S);break}case"SESSION-KEY":{const S=sa(m,t,r);S.encrypted&&S.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(S)):M.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${m}"`);break}case"DEFINE":{{const S=new ti(m,r);Zr(r,S,t)}break}case"CONTENT-STEERING":{const S=new ti(m,r);r.contentSteering={uri:pr.resolve(S["SERVER-URI"],t),pathwayId:S["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=aa(m);break}}}const g=n.length>0&&n.length<r.levels.length;return r.levels=g?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const n={},a=i.levels,u={AUDIO:a.map(p=>({id:p.attrs.AUDIO,audioCodec:p.audioCodec})),SUBTITLES:a.map(p=>({id:p.attrs.SUBTITLES,textCodec:p.textCodec})),"CLOSED-CAPTIONS":[]};let g=0;for(ra.lastIndex=0;(r=ra.exec(e))!==null;){const p=new ti(r[1],i),m=p.TYPE;if(m){const S=u[m],R=n[m]||[];n[m]=R;const H=p.LANGUAGE,j=p["ASSOC-LANGUAGE"],Q=p.CHANNELS,Y=p.CHARACTERISTICS,te=p["INSTREAM-ID"],ce={attrs:p,bitrate:0,id:g++,groupId:p["GROUP-ID"]||"",name:p.NAME||H||"",type:m,default:p.bool("DEFAULT"),autoselect:p.bool("AUTOSELECT"),forced:p.bool("FORCED"),lang:H,url:p.URI?pr.resolve(p.URI,t):""};if(j&&(ce.assocLang=j),Q&&(ce.channels=Q),Y&&(ce.characteristics=Y),te&&(ce.instreamId=te),S!=null&&S.length){const ae=pr.findGroup(S,ce.groupId)||S[0];la(ce,ae,"audioCodec"),la(ce,ae,"textCodec")}R.push(ce)}}return n}static parseLevelPlaylist(e,t,i,r,n,a){var u;const g={url:t},p=new Rn(t),m=p.fragments,S=[];let R=null,H=0,j=0,Q=0,Y=0,te=0,ce=null,ae=new Ce(r,g),Ee,Te,$e,xe=-1,Ie=!1,Pe=null,Ae;if(us.lastIndex=0,p.m3u8=e,p.hasVariableRefs=un(e),((u=us.exec(e))==null?void 0:u[0])!=="#EXTM3U")return p.playlistParsingError=new Error("Missing format identifier #EXTM3U"),p;for(;(Ee=us.exec(e))!==null;){Ie&&(Ie=!1,ae=new Ce(r,g),ae.playlistOffset=Q,ae.setStart(Q),ae.sn=H,ae.cc=Y,te&&(ae.bitrate=te),ae.level=i,R&&(ae.initSegment=R,R.rawProgramDateTime&&(ae.rawProgramDateTime=R.rawProgramDateTime,R.rawProgramDateTime=null),Pe&&(ae.setByteRange(Pe),Pe=null)));const kt=Ee[1];if(kt){ae.duration=parseFloat(kt);const At=(" "+Ee[2]).slice(1);ae.title=At||null,ae.tagList.push(At?["INF",kt,At]:["INF",kt])}else if(Ee[3]){if(I(ae.duration)){ae.playlistOffset=Q,ae.setStart(Q),$e&&ca(ae,$e,p),ae.sn=H,ae.level=i,ae.cc=Y,m.push(ae);const At=(" "+Ee[3]).slice(1);ae.relurl=Ur(p,At),cs(ae,ce,S),ce=ae,Q+=ae.duration,H++,j=0,Ie=!0}}else{if(Ee=Ee[0].match(sl),!Ee){M.warn("No matches on slow regex match for level playlist!");continue}for(Te=1;Te<Ee.length&&Ee[Te]===void 0;Te++);const At=(" "+Ee[Te]).slice(1),ut=(" "+Ee[Te+1]).slice(1),Ct=Ee[Te+2]?(" "+Ee[Te+2]).slice(1):null;switch(At){case"BYTERANGE":ce?ae.setByteRange(ut,ce):ae.setByteRange(ut);break;case"PROGRAM-DATE-TIME":ae.rawProgramDateTime=ut,ae.tagList.push(["PROGRAM-DATE-TIME",ut]),xe===-1&&(xe=m.length);break;case"PLAYLIST-TYPE":p.type&&kr(p,At,Ee),p.type=ut.toUpperCase();break;case"MEDIA-SEQUENCE":p.startSN!==0?kr(p,At,Ee):m.length>0&&ha(p,At,Ee),H=p.startSN=parseInt(ut);break;case"SKIP":{p.skippedSegments&&kr(p,At,Ee);const vt=new ti(ut,p),Tt=vt.decimalInteger("SKIPPED-SEGMENTS");if(I(Tt)){p.skippedSegments+=Tt;for(let ft=Tt;ft--;)m.push(null);H+=Tt}const Mt=vt.enumeratedString("RECENTLY-REMOVED-DATERANGES");Mt&&(p.recentlyRemovedDateranges=(p.recentlyRemovedDateranges||[]).concat(Mt.split(" ")));break}case"TARGETDURATION":p.targetduration!==0&&kr(p,At,Ee),p.targetduration=Math.max(parseInt(ut),1);break;case"VERSION":p.version!==null&&kr(p,At,Ee),p.version=parseInt(ut);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":p.live||kr(p,At,Ee),p.live=!1;break;case"#":(ut||Ct)&&ae.tagList.push(Ct?[ut,Ct]:[ut]);break;case"DISCONTINUITY":Y++,ae.tagList.push(["DIS"]);break;case"GAP":ae.gap=!0,ae.tagList.push([At]);break;case"BITRATE":ae.tagList.push([At,ut]),te=parseInt(ut)*1e3,I(te)?ae.bitrate=te:te=0;break;case"DATERANGE":{const vt=new ti(ut,p),Tt=new dn(vt,p.dateRanges[vt.ID],p.dateRangeTagCount);p.dateRangeTagCount++,Tt.isValid||p.skippedSegments?p.dateRanges[Tt.id]=Tt:M.warn(`Ignoring invalid DATERANGE tag: "${ut}"`),ae.tagList.push(["EXT-X-DATERANGE",ut]);break}case"DEFINE":{{const vt=new ti(ut,p);"IMPORT"in vt?cn(p,vt,a):Zr(p,vt,t)}break}case"DISCONTINUITY-SEQUENCE":p.startCC!==0?kr(p,At,Ee):m.length>0&&ha(p,At,Ee),p.startCC=Y=parseInt(ut);break;case"KEY":{const vt=sa(ut,t,p);if(vt.isSupported()){if(vt.method==="NONE"){$e=void 0;break}$e||($e={});const Tt=$e[vt.keyFormat];Tt!=null&&Tt.matches(vt)||(Tt&&($e=c({},$e)),$e[vt.keyFormat]=vt)}else M.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${ut}"`);break}case"START":p.startTimeOffset=aa(ut);break;case"MAP":{const vt=new ti(ut,p);if(ae.duration){const Tt=new Ce(r,g);ua(Tt,vt,i,$e),R=Tt,ae.initSegment=R,R.rawProgramDateTime&&!ae.rawProgramDateTime&&(ae.rawProgramDateTime=R.rawProgramDateTime)}else{const Tt=ae.byteRangeEndOffset;if(Tt){const Mt=ae.byteRangeStartOffset;Pe=`${Tt-Mt}@${Mt}`}else Pe=null;ua(ae,vt,i,$e),R=ae,Ie=!0}R.cc=Y;break}case"SERVER-CONTROL":{Ae&&kr(p,At,Ee),Ae=new ti(ut),p.canBlockReload=Ae.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=Ae.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&Ae.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=Ae.optionalFloat("PART-HOLD-BACK",0),p.holdBack=Ae.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{p.partTarget&&kr(p,At,Ee);const vt=new ti(ut);p.partTarget=vt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let vt=p.partList;vt||(vt=p.partList=[]);const Tt=j>0?vt[vt.length-1]:void 0,Mt=j++,ft=new ti(ut,p),dt=new We(ft,ae,g,Mt,Tt);vt.push(dt),ae.duration+=dt.duration;break}case"PRELOAD-HINT":{const vt=new ti(ut,p);p.preloadHint=vt;break}case"RENDITION-REPORT":{const vt=new ti(ut,p);p.renditionReports=p.renditionReports||[],p.renditionReports.push(vt);break}default:M.warn(`line parsed but not handled: ${Ee}`);break}}}ce&&!ce.relurl?(m.pop(),Q-=ce.duration,p.partList&&(p.fragmentHint=ce)):p.partList&&(cs(ae,ce,S),ae.cc=Y,p.fragmentHint=ae,$e&&ca(ae,$e,p)),p.targetduration||(p.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const ze=m.length,_t=m[0],xt=m[ze-1];if(Q+=p.skippedSegments*p.targetduration,Q>0&&ze&&xt){p.averagetargetduration=Q/ze;const kt=xt.sn;p.endSN=kt!=="initSegment"?kt:0,p.live||(xt.endList=!0),xe>0&&(ol(m,xe),_t&&S.unshift(_t))}return p.fragmentHint&&(Q+=p.fragmentHint.duration),p.totalduration=Q,S.length&&p.dateRangeTagCount&&_t&&na(S,p),p.endCC=Y,p}}function na(o,e){let t=o.length;if(!t)if(e.hasProgramDateTime){const u=e.fragments[e.fragments.length-1];o.push(u),t++}else return;const i=o[t-1],r=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let u=n.length;u--;){const g=e.dateRanges[n[u]],p=g.startDate.getTime();g.tagAnchor=i.ref;for(let m=t;m--;){var a;if(((a=o[m])==null?void 0:a.sn)<e.startSN)break;const S=al(e,p,o,m,r);if(S!==-1){g.tagAnchor=e.fragments[S].ref;break}}}}function al(o,e,t,i,r){const n=t[i];if(n){const u=n.programDateTime;if(e>=u||i===0){var a;const g=(((a=t[i+1])==null?void 0:a.start)||r)-n.start;if(e<=u+g*1e3){const p=t[i].sn-o.startSN;if(p<0)return-1;const m=o.fragments;if(m.length>t.length){const R=(t[i+1]||m[m.length-1]).sn-o.startSN;for(let H=R;H>p;H--){const j=m[H].programDateTime;if(e>=j&&e<j+m[H].duration*1e3)return H}}return p}}}return-1}function sa(o,e,t){var i,r;const n=new ti(o,t),a=(i=n.METHOD)!=null?i:"",u=n.URI,g=n.hexadecimalInteger("IV"),p=n.KEYFORMATVERSIONS,m=(r=n.KEYFORMAT)!=null?r:"identity";u&&n.IV&&!g&&M.error(`Invalid IV: ${n.IV}`);const S=u?pr.resolve(u,e):"",R=(p||"1").split("/").map(Number).filter(Number.isFinite);return new Rr(a,S,m,R,g,n.KEYID)}function aa(o){const t=new ti(o).decimalFloatingPoint("TIME-OFFSET");return I(t)?t:null}function oa(o,e){let t=(o||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(n=>Rt(n,i));r.length&&(e[`${i}Codec`]=r.map(n=>n.split("/")[0]).join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function la(o,e,t){const i=e[t];i&&(o[t]=i)}function ol(o,e){let t=o[e];for(let i=e;i--;){const r=o[i];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function cs(o,e,t){o.rawProgramDateTime?t.push(o):e!=null&&e.programDateTime&&(o.programDateTime=e.endProgramDateTime)}function ua(o,e,t,i){o.relurl=e.URI,e.BYTERANGE&&o.setByteRange(e.BYTERANGE),o.level=t,o.sn="initSegment",i&&(o.levelkeys=i),o.initSegment=null}function ca(o,e,t){o.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&i.push(o)}function kr(o,e,t){o.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function ha(o,e,t){o.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function hs(o,e){const t=e.startPTS;if(I(t)){let i=0,r;e.sn>o.sn?(i=t-o.start,r=o):(i=o.start-t,r=e),r.duration!==i&&r.setDuration(i)}else e.sn>o.sn?o.cc===e.cc&&o.minEndPTS?e.setStart(o.start+(o.minEndPTS-o.start)):e.setStart(o.start+o.duration):e.setStart(Math.max(o.start-e.duration,0))}function fa(o,e,t,i,r,n,a){i-t<=0&&(a.warn("Fragment should have a positive duration",e),i=t+e.duration,n=r+e.duration);let g=t,p=i;const m=e.startPTS,S=e.endPTS;if(I(m)){const te=Math.abs(m-t);o&&te>o.totalduration?a.warn(`media timestamps and playlist times differ by ${te}s for level ${e.level} ${o.url}`):I(e.deltaPTS)?e.deltaPTS=Math.max(te,e.deltaPTS):e.deltaPTS=te,g=Math.max(t,m),t=Math.min(t,m),r=e.startDTS!==void 0?Math.min(r,e.startDTS):r,p=Math.min(i,S),i=Math.max(i,S),n=e.endDTS!==void 0?Math.max(n,e.endDTS):n}const R=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=g,e.startDTS=r,e.endPTS=i,e.minEndPTS=p,e.endDTS=n;const H=e.sn;if(!o||H<o.startSN||H>o.endSN)return 0;let j;const Q=H-o.startSN,Y=o.fragments;for(Y[Q]=e,j=Q;j>0;j--)hs(Y[j],Y[j-1]);for(j=Q;j<Y.length-1;j++)hs(Y[j],Y[j+1]);return o.fragmentHint&&hs(Y[Y.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,R}function ll(o,e,t){if(o===e)return;let i=null;const r=o.fragments;for(let m=r.length-1;m>=0;m--){const S=r[m].initSegment;if(S){i=S;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;let n;hl(o,e,(m,S,R,H)=>{if((!e.startCC||e.skippedSegments)&&S.cc!==m.cc){const j=m.cc-S.cc;for(let Q=R;Q<H.length;Q++)H[Q].cc+=j;e.endCC=H[H.length-1].cc}I(m.startPTS)&&I(m.endPTS)&&(S.setStart(S.startPTS=m.startPTS),S.startDTS=m.startDTS,S.maxStartPTS=m.maxStartPTS,S.endPTS=m.endPTS,S.endDTS=m.endDTS,S.minEndPTS=m.minEndPTS,S.setDuration(m.endPTS-m.startPTS),S.duration&&(n=S),e.PTSKnown=e.alignedSliding=!0),m.hasStreams&&(S.elementaryStreams=m.elementaryStreams),S.loader=m.loader,m.hasStats&&(S.stats=m.stats),m.initSegment&&(S.initSegment=m.initSegment,i=m.initSegment)});const a=e.fragments,u=e.fragmentHint?a.concat(e.fragmentHint):a;if(i&&u.forEach(m=>{var S;m&&(!m.initSegment||m.initSegment.relurl===((S=i)==null?void 0:S.relurl))&&(m.initSegment=i)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(m=>!m),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let m=e.skippedSegments;m--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=ul(o.dateRanges,e,t));const m=o.fragments.filter(S=>S.rawProgramDateTime);if(o.hasProgramDateTime&&!e.hasProgramDateTime)for(let S=1;S<u.length;S++)u[S].programDateTime===null&&cs(u[S],u[S-1],m);na(m,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var g;const m=ga(o,e.startSN-1);e.startCC=(g=m==null?void 0:m.cc)!=null?g:a[0].cc}cl(o.partList,e.partList,(m,S)=>{S.elementaryStreams=m.elementaryStreams,S.stats=m.stats}),n?fa(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS,t):pa(o,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=o.driftStartTime,e.driftStart=o.driftStart;const p=e.advancedDateTime;if(e.advanced&&p){const m=e.edge;e.driftStart||(e.driftStartTime=p,e.driftStart=m),e.driftEndTime=p,e.driftEnd=m}else e.driftEndTime=o.driftEndTime,e.driftEnd=o.driftEnd,e.advancedDateTime=o.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=o.requestScheduled)}function ul(o,e,t){const{dateRanges:i,recentlyRemovedDateranges:r}=e,n=c({},o);r&&r.forEach(g=>{delete n[g]});const u=Object.keys(n).length;return u?(Object.keys(i).forEach(g=>{const p=n[g],m=new dn(i[g].attr,p);m.isValid?(n[g]=m,p||(m.tagOrder+=u)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Ft(i[g].attr)}"`)}),n):i}function cl(o,e,t){if(o&&e){let i=0;for(let r=0,n=o.length;r<=n;r++){const a=o[r],u=e[r+i];a&&u&&a.index===u.index&&a.fragment.sn===u.fragment.sn?t(a,u):i--}}}function hl(o,e,t){const i=e.skippedSegments,r=Math.max(o.startSN,e.startSN)-e.startSN,n=(o.fragmentHint?1:0)+(i?e.endSN:Math.min(o.endSN,e.endSN))-e.startSN,a=e.startSN-o.startSN,u=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,g=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments;for(let p=r;p<=n;p++){const m=g[a+p];let S=u[p];if(i&&!S&&m&&(S=e.fragments[p]=m),m&&S){t(m,S,p,u);const R=m.relurl,H=S.relurl;if(R&&fl(R,H)){e.playlistParsingError=da(`media sequence mismatch ${S.sn}:`,o,e,m,S);return}else if(m.cc!==S.cc){e.playlistParsingError=da(`discontinuity sequence mismatch (${m.cc}!=${S.cc})`,o,e,m,S);return}}}}function da(o,e,t,i,r){return new Error(`${o} ${r.url}
|
|
|
Playlist starting @${e.startSN}
|
|
|
${e.m3u8}
|
|
|
|
|
|
Playlist starting @${t.startSN}
|
|
|
${t.m3u8}`)}function pa(o,e,t=!0){const i=e.startSN+e.skippedSegments-o.startSN,r=o.fragments,n=i>=0;let a=0;if(n&&i<r.length)a=r[i].start;else if(n&&e.startSN===o.endSN+1)a=o.fragmentEnd;else if(n&&t)a=o.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)a=o.fragmentStart;else return;fs(e,a)}function fs(o,e){if(e){const t=o.fragments;for(let i=o.skippedSegments;i<t.length;i++)t[i].addStart(e);o.fragmentHint&&o.fragmentHint.addStart(e)}}function _a(o,e=1/0){let t=1e3*o.targetduration;if(o.updated){const i=o.fragments;if(i.length&&t*4>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function ga(o,e,t){if(!o)return null;let i=o.fragments[e-o.startSN];return i||(i=o.fragmentHint,i&&i.sn===e)?i:e<o.startSN&&t&&t.sn===e?t:null}function ma(o,e,t){return o?va(o.partList,e,t):null}function va(o,e,t){if(o)for(let i=o.length;i--;){const r=o[i];if(r.index===t&&r.fragment.sn===e)return r}return null}function ya(o){o.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(r=>{r.level=t,r.initSegment&&(r.initSegment.level=t)})})}function fl(o,e){return o!==e&&e?ba(o)!==ba(e):!1}function ba(o){return o.replace(/\?[^?]*$/,"")}function In(o,e){for(let i=0,r=o.length;i<r;i++){var t;if(((t=o[i])==null?void 0:t.cc)===e)return o[i]}return null}function dl(o,e){return!!(o&&e.startCC<o.endCC&&e.endCC>o.startCC)}function Ea(o,e){const t=o.start+e;o.startPTS=t,o.setStart(t),o.endPTS=t+o.duration}function Sa(o,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)Ea(t[i],o);e.fragmentHint&&Ea(e.fragmentHint,o),e.alignedSliding=!0}function pl(o,e){o&&(wa(e,o),e.alignedSliding||jn(e,o),!e.alignedSliding&&!e.skippedSegments&&pa(o,e,!1))}function wa(o,e){if(!dl(e,o))return;const t=Math.min(e.endCC,o.endCC),i=In(e.fragments,t),r=In(o.fragments,t);if(!i||!r)return;M.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const n=i.start-r.start;Sa(n,o)}function jn(o,e){if(!o.hasProgramDateTime||!e.hasProgramDateTime)return;const t=o.fragments,i=e.fragments;if(!t.length||!i.length)return;let r,n;const a=Math.min(e.endCC,o.endCC);e.startCC<a&&o.startCC<a&&(r=In(i,a),n=In(t,a)),(!r||!n)&&(r=i[Math.floor(i.length/2)],n=In(t,r.cc)||t[Math.floor(t.length/2)]);const u=r.programDateTime,g=n.programDateTime;if(!u||!g)return;const p=(g-u)/1e3-(n.start-r.start);Sa(p,o)}function Mi(o,e,t){Hi(o,e,t),o.addEventListener(e,t)}function Hi(o,e,t){o.removeEventListener(e,t)}const _l={toString:function(o){let e="";const t=o.length;for(let i=0;i<t;i++)e+=`[${o.start(i).toFixed(3)}-${o.end(i).toFixed(3)}]`;return e}},qe={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 ds extends Tr{constructor(e,t,i,r,n){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=qe.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:a,fragCurrent:u,media:g,mediaBuffer:p,state:m}=this,S=g?g.currentTime:0,R=It.bufferInfo(p||g,S,a.maxBufferHole),H=!R.len;if(this.log(`Media seeking to ${I(S)?S.toFixed(3):S}, state: ${m}, ${H?"out of":"in"} buffer`),this.state===qe.ENDED)this.resetLoadingState();else if(u){const j=a.maxFragLookUpTolerance,Q=u.start-j,Y=u.start+u.duration+j;if(H||Y<R.start||Q>R.end){const te=S>Y;(S<Q||te)&&(te&&u.loader&&(this.log(`Cancelling fragment load for seek (sn: ${u.sn})`),u.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(g){this.fragmentTracker.removeFragmentsInRange(S,1/0,this.playlistType,!0);const j=this.lastCurrentTime;if(S>j&&(this.lastCurrentTime=S),!this.loadingParts){const Q=Math.max(R.end,S),Y=this.shouldLoadParts(this.getLevelDetails(),Q);Y&&(this.log(`LL-Part loading ON after seeking to ${S.toFixed(2)} with buffer @${Q.toFixed(2)}`),this.loadingParts=Y)}}this.hls.hasEnoughToStart||(this.log(`Setting ${H?"startPosition":"nextLoadPosition"} to ${S} for seek without enough to start`),this.nextLoadPosition=S,H&&(this.startPosition=S)),H&&this.state===qe.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=n,this.hls=e,this.fragmentLoader=new Ar(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Mr(e.config)}registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===qe.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=qe.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,r=this.config.timelineOffset||0;if(i<=r)return!1;const n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=It.bufferedInfo(n,e.start,0));const a=e.nextStart;if(a&&a>r&&a<t.edge||this.media.currentTime<e.start)return!1;const g=t.partList;if(g!=null&&g.length){const m=g[g.length-1];return It.isBuffered(this.media,m.start+m.duration/2)}const p=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(p)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.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;Mi(i,"seeking",this.onMediaSeeking),Mi(i,"ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===qe.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Hi(r,"seeking",this.onMediaSeeking),Hi(r,"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=qe.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 r=n=>{const a=n.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${n.part?" part: "+n.part.index:""} of ${this.fragInfo(a,!1,n.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,r).then(n=>{if(!n)return;const a=this.state,u=n.frag;if(this.fragContextChanged(u)){(a===qe.FRAG_LOADING||!this.fragCurrent&&a===qe.PARSING)&&(this.fragmentTracker.removeFragment(u),this.state=qe.IDLE);return}"payload"in n&&(this.log(`Loaded ${u.type} sn: ${u.sn} of ${this.playlistLabel()} ${u.level}`),this.hls.trigger(_.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===qe.STOPPED||this.state===qe.ERROR||(this.warn(`Frag error: ${(n==null?void 0:n.message)||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===ei.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),u=Math.max(e.duration,a?a.len:this.config.maxBufferLength),g=this.backtrackFragment;((g?e.sn-g.sn:0)===1||this.reduceMaxBufferLength(u,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 r={startOffset:e,endOffset:t,type:i};this.hls.trigger(_.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const r=i==null?void 0:i.frag;if(!r||this.fragContextChanged(r)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{frag:n,payload:a}=i,u=n.decryptdata;if(a&&a.byteLength>0&&u!=null&&u.key&&u.iv&&hr(u.method)){const g=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),u.key.buffer,u.iv.buffer,Ri(u.method)).catch(p=>{throw r.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:p,reason:p.message,frag:n}),p}).then(p=>{const m=self.performance.now();return r.trigger(_.FRAG_DECRYPTED,{frag:n,payload:p,stats:{tstart:g,tdecrypt:m}}),i.payload=p,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===qe.STOPPED||this.state===qe.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!==qe.STOPPED&&(this.state=qe.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()}unhandledEncryptionError(e,t){var i,r;const n=e.tracks;if(n&&!t.encrypted&&((i=n.audio)!=null&&i.encrypted||(r=n.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,u=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(u.message),!a||a.mediaKeys?!1:(this.hls.trigger(_.ERROR,{type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,fatal:!1,error:u,frag:t}),this.resetTransmuxer(),!0)}return!1}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?_l.toString(It.getBuffered(i)):"(detached)"})`),pe(e)){var r;if(e.type!==v.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(u=>!!a[u])){this.state=qe.IDLE;return}}const n=(r=this.levels)==null?void 0:r[e.level];n!=null&&n.fragmentError&&(this.log(`Resetting level fragment error count of ${n.fragmentError} on frag buffered`),n.fragmentError=0)}this.state=qe.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:n}=e,a=!n||n.length===0||n.some(g=>!g),u=new Fi(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(u)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var n;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let u=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=qe.KEY_LOADING,this.fragCurrent=e,u=this.keyLoader.load(e).then(R=>{if(!this.fragContextChanged(R.frag))return this.hls.trigger(_.KEY_LOADED,R),this.state===qe.KEY_LOADING&&(this.state=qe.IDLE),R}),this.hls.trigger(_.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(u=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),u&&this.log("[eme] blocking frag load until media-keys acquired"));const g=this.fragPrevious;if(pe(e)&&(!g||e.sn!==g.sn)){const R=this.shouldLoadParts(t.details,e.end);R!==this.loadingParts&&(this.log(`LL-Part loading ${R?"ON":"OFF"} loading sn ${g==null?void 0:g.sn}->${e.sn}`),this.loadingParts=R)}if(i=Math.max(e.start,i||0),this.loadingParts&&pe(e)){const R=a.partList;if(R&&r){i>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const H=this.getNextPart(R,e,i);if(H>-1){const j=R[H];e=this.fragCurrent=j.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${j.index} (${H}/${R.length-1}) of ${this.fragInfo(e,!1,j)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=j.start+j.duration,this.state=qe.FRAG_LOADING;let Q;return u?Q=u.then(Y=>!Y||this.fragContextChanged(Y.frag)?null:this.doFragPartsLoad(e,j,t,r)).catch(Y=>this.handleFragLoadError(Y)):Q=this.doFragPartsLoad(e,j,t,r).catch(Y=>this.handleFragLoadError(Y)),this.hls.trigger(_.FRAG_LOADING,{frag:e,part:j,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):Q}else if(!e.url||this.loadedEndOfParts(R,i))return Promise.resolve(null)}}if(pe(e)&&this.loadingParts){var p;this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(p=a.partList)==null?void 0:p.filter(R=>R.loaded).map(R=>`[${R.start}-${R.end}]`)}`),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} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),I(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=qe.FRAG_LOADING;const m=this.config.progressive;let S;return m&&u?S=u.then(R=>!R||this.fragContextChanged(R.frag)?null:this.fragmentLoader.load(e,r)).catch(R=>this.handleFragLoadError(R)):S=Promise.all([this.fragmentLoader.load(e,m?r:void 0),u]).then(([R])=>(!m&&r&&r(R),R)).catch(R=>this.handleFragLoadError(R)),this.hls.trigger(_.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):S}doFragPartsLoad(e,t,i,r){return new Promise((n,a)=>{var u;const g=[],p=(u=i.details)==null?void 0:u.partList,m=S=>{this.fragmentLoader.loadPart(e,S,r).then(R=>{g[S.index]=R;const H=R.part;this.hls.trigger(_.FRAG_LOADED,R);const j=ma(i.details,e.sn,S.index+1)||va(p,e.sn,S.index+1);if(j)m(j);else return n({frag:e,part:H,partsLoaded:g})}).catch(a)};m(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===w.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===D.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetFragmentLoading(t.frag)):this.hls.trigger(_.ERROR,t)}else this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==qe.PARSING){!this.fragCurrent&&this.state!==qe.STOPPED&&this.state!==qe.ERROR&&(this.state=qe.IDLE);return}const{frag:i,part:r,level:n}=t,a=self.performance.now();i.stats.parsing.end=a,r&&(r.stats.parsing.end=a);const u=this.getLevelDetails(),p=u&&i.sn>u.endSN||this.shouldLoadParts(u,i.end);p!==this.loadingParts&&(this.log(`LL-Part loading ${p?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=p),this.updateLevelTiming(i,r,n,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const n=e.partList[0];if(n.fragment.type===v.SUBTITLE)return!1;const a=n.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=a){var r;if((this.hls.hasEnoughToStart?((r=this.media)==null?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const u=t[r],g=u.details,p=a>-1?ma(g,n,a):null,m=p?p.fragment:ga(g,n,i);return m?(i&&i!==m&&(m.stats=i.stats),{frag:m,part:p,level:u}):null}bufferFragmentData(e,t,i,r,n){if(this.state!==qe.PARSING)return;const{data1:a,data2:u}=e;let g=a;if(u&&(g=Ge(a,u)),!g.length)return;const p=this.initPTS[t.cc],m=p?-p.baseTime/p.timescale:void 0,S={type:e.type,frag:t,part:i,chunkMeta:r,offset:m,parent:t.type,data:g};if(this.hls.trigger(_.BUFFER_APPENDING,S),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!It.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=It.bufferInfo(t,i,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),u=Math.max(Math.min(e.start-a,r.end-a),i+a);e.start-u>a&&this.flushMainBuffer(u,e.start)}getFwdBufferInfo(e,t){var i;const r=this.getLoadPosition();if(!I(r))return null;const a=this.lastCurrentTime>r||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,a)}getFwdBufferInfoAtPos(e,t,i,r){const n=It.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&(n.nextStart<=a.end||a.gap)){const u=Math.max(Math.min(n.nextStart,a.end)-t,r);return It.bufferInfo(e,t,u)}}return n}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,r=Math.max(Math.min(e-t,i.maxBufferLength),t),n=Math.max(e-t*3,i.maxMaxBufferLength/2,r);return n>=r?(i.maxMaxBufferLength=n,this.warn(`Reduce max buffer length to ${n}s`),!0):!1}getAppendedFrag(e,t=v.MAIN){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,a=i[0].start,u=n.lowLatencyMode&&!!t.partList;let g=null;if(t.live){const S=n.initialLiveManifestSize;if(r<S)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${S})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var p;u&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),g=this.getInitialLiveFragment(t);const R=this.hls.startPosition,H=this.hls.liveSyncPosition,j=g?(R!==-1&&R>=a?R:H)||g.start:e;this.log(`Setting startPosition to ${j} to match start frag at live edge. mainStart: ${R} liveSyncPosition: ${H} frag.start: ${(p=g)==null?void 0:p.start}`),this.startPosition=this.nextLoadPosition=j}}else e<=a&&(g=i[0]);if(!g){const S=this.loadingParts?t.partEnd:t.fragmentEnd;g=this.getFragmentAtPosition(e,S,t)}let m=this.filterReplacedPrimary(g,t);if(!m&&g){const S=g.sn-t.startSN;m=this.filterReplacedPrimary(i[S+1]||null,t)}return this.mapToInitFragWhenRequired(m)}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,r,n){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&i.nextStart)){const u=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r,0);if(u!==null&&i.len+u.len>=n){const g=a.sn;return this.loopSn!==g&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${g}`),this.loopSn=g),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(xa(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(xa(this.config)&&e.type!==v.SUBTITLE){const i=this.hls.interstitialsManager,r=i==null?void 0:i.bufferingItem;if(r){const a=r.event;if(a){if(a.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&(t==null?void 0:t.live)===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}const n=i==null?void 0:i.playerQueue;if(n)for(let a=n.length;a--;){const u=n[a].interstitial;if(u.appendInPlace&&e.start>=u.startTime&&e.end<=u.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let r=-1,n=!1,a=!0;for(let u=0,g=e.length;u<g;u++){const p=e[u];if(a=a&&!p.independent,r>-1&&i<p.start)break;const m=p.loaded;m?r=-1:(n||(p.independent||a)&&p.fragment===t)&&(p.fragment!==t&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${p.start}`),r=u),n=m}return r}loadedEndOfParts(e,t){let i;for(let r=e.length;r--;){if(i=e[r],!i.loaded)return!1;if(t>i.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=wi(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];i.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=$i(e,i.cc,i.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:a,endSN:u}=i;const{fragmentHint:g}=i,{maxFragLookUpTolerance:p}=r,m=i.partList,S=!!(this.loadingParts&&m!=null&&m.length&&g);S&&!this.bitrateTest&&m[m.length-1].fragment.sn===g.sn&&(a=a.concat(g),u=g.sn);let R;if(e<t){var H;const Q=e<this.lastCurrentTime||e>t-p||(H=this.media)!=null&&H.paused||!this.startFragRequested?0:p;R=zi(n,a,e,Q)}else R=a[a.length-1];if(R){const j=R.sn-i.startSN,Q=this.fragmentTracker.getState(R);if((Q===ei.OK||Q===ei.PARTIAL&&R.gap)&&(n=R),n&&R.sn===n.sn&&(!S||m[0].fragment.sn>R.sn||!i.live)&&R.level===n.level){const te=a[j+1];R.sn<u&&this.fragmentTracker.getState(te)!==ei.OK?R=te:R=null}}return R}alignPlaylists(e,t,i){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragmentStart,a=!t,u=e.alignedSliding&&I(n);if(a||!u&&!n){pl(i,e);const g=e.fragmentStart;return this.log(`Live playlist sliding: ${g.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),g}return n}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 r=this.timelineOffset;if(i===-1){const n=this.startTimeOffset!==null,a=n?this.startTimeOffset:e.startTimeOffset;a!==null&&I(a)?(i=t+a,a<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${a} found in ${n?"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+r}this.nextLoadPosition=i+r}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&&pe(e)&&e.stats.aborted&&(this.log(`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!==qe.FRAG_LOADING_WAITING_RETRY)&&(this.state=qe.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const te=this.getCurrentContext(t.chunkMeta);te&&(t.frag=te.frag)}const r=t.frag;if(!r||r.type!==e||!this.levels)return;if(this.fragContextChanged(r)){var n;this.warn(`Frag load error must match current frag to retry ${r.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const a=t.details===w.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(r,!0);const u=t.errorAction;if(!u){this.state=qe.ERROR;return}const{action:g,flags:p,retryCount:m=0,retryConfig:S}=u,R=!!S,H=R&&g===ci.RetryRequest,j=R&&!u.resolved&&p===mi.MoveAllAlternatesMatchingHost,Q=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!H&&j&&pe(r)&&!r.endList&&Q)this.resetFragmentErrors(e),this.treatAsGap(r),u.resolved=!0;else if((H||j)&&m<S.maxNumRetry){var Y;const te=zr((Y=t.response)==null?void 0:Y.code),ce=Or(S,m);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+ce,this.state=qe.FRAG_LOADING_WAITING_RETRY,u.resolved=!0,te){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${t.details}, retrying loading ${m+1}/${S.maxNumRetry} in ${ce}ms`)}else if(S)if(this.resetFragmentErrors(e),m<S.maxNumRetry)!a&&g!==ci.RemoveAlternatePermanently&&(u.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${m})`);return}else g===ci.SendAlternateToPenaltyBox?this.state=qe.WAITING_LEVEL:this.state=qe.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!zr(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=qe.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===qe.PARSING||this.state===qe.PARSED){const t=e.frag,i=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,i),n=r&&r.len>.5;n&&this.reduceMaxBufferLength(r.len,(t==null?void 0:t.duration)||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===v.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==qe.STOPPED&&(this.state=qe.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=It.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===qe.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==qe.STOPPED&&(this.state=qe.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,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.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){const n=i.details;if(!n){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((g,p)=>{const m=e.elementaryStreams[p];if(m){const S=m.endPTS-m.startPTS;if(S<=0)return this.warn(`Could not parse fragment ${e.sn} ${p} duration reliably (${S})`),g||!1;const R=r?0:fa(n,e,m.startPTS,m.endPTS,m.startDTS,m.endDTS,this);return this.hls.trigger(_.LEVEL_PTS_UPDATED,{details:n,level:i,drift:R,type:p,frag:e,start:m.startPTS,end:m.endPTS}),!0}return g},!1)){var u;if(i.fragmentError===0&&this.treatAsGap(e,i),((u=this.transmuxer)==null?void 0:u.error)===null){const g=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(g.message),this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:g,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=qe.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(_.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===v.MAIN?"level":"track"}fragInfo(e,t=!0,i){var r,n;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((r=t&&!i?e.startPTS:(i||e).start)!=null?r:NaN).toFixed(3)}-${((n=t&&!i?e.endPTS:(i||e).end)!=null?n: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.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function xa(o){return!!o.interstitialsController&&o.enableInterstitialPlayback!==!1}class Aa{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=gl(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function gl(o,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<o.length;r++){const n=o[r];t.set(n,i),i+=n.length}return t}var ps={exports:{}},Ca;function ml(){return Ca||(Ca=1,function(o){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(g,p,m){this.fn=g,this.context=p,this.once=m||!1}function n(g,p,m,S,R){if(typeof m!="function")throw new TypeError("The listener must be a function");var H=new r(m,S||g,R),j=t?t+p:p;return g._events[j]?g._events[j].fn?g._events[j]=[g._events[j],H]:g._events[j].push(H):(g._events[j]=H,g._eventsCount++),g}function a(g,p){--g._eventsCount===0?g._events=new i:delete g._events[p]}function u(){this._events=new i,this._eventsCount=0}u.prototype.eventNames=function(){var p=[],m,S;if(this._eventsCount===0)return p;for(S in m=this._events)e.call(m,S)&&p.push(t?S.slice(1):S);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(m)):p},u.prototype.listeners=function(p){var m=t?t+p:p,S=this._events[m];if(!S)return[];if(S.fn)return[S.fn];for(var R=0,H=S.length,j=new Array(H);R<H;R++)j[R]=S[R].fn;return j},u.prototype.listenerCount=function(p){var m=t?t+p:p,S=this._events[m];return S?S.fn?1:S.length:0},u.prototype.emit=function(p,m,S,R,H,j){var Q=t?t+p:p;if(!this._events[Q])return!1;var Y=this._events[Q],te=arguments.length,ce,ae;if(Y.fn){switch(Y.once&&this.removeListener(p,Y.fn,void 0,!0),te){case 1:return Y.fn.call(Y.context),!0;case 2:return Y.fn.call(Y.context,m),!0;case 3:return Y.fn.call(Y.context,m,S),!0;case 4:return Y.fn.call(Y.context,m,S,R),!0;case 5:return Y.fn.call(Y.context,m,S,R,H),!0;case 6:return Y.fn.call(Y.context,m,S,R,H,j),!0}for(ae=1,ce=new Array(te-1);ae<te;ae++)ce[ae-1]=arguments[ae];Y.fn.apply(Y.context,ce)}else{var Ee=Y.length,Te;for(ae=0;ae<Ee;ae++)switch(Y[ae].once&&this.removeListener(p,Y[ae].fn,void 0,!0),te){case 1:Y[ae].fn.call(Y[ae].context);break;case 2:Y[ae].fn.call(Y[ae].context,m);break;case 3:Y[ae].fn.call(Y[ae].context,m,S);break;case 4:Y[ae].fn.call(Y[ae].context,m,S,R);break;default:if(!ce)for(Te=1,ce=new Array(te-1);Te<te;Te++)ce[Te-1]=arguments[Te];Y[ae].fn.apply(Y[ae].context,ce)}}return!0},u.prototype.on=function(p,m,S){return n(this,p,m,S,!1)},u.prototype.once=function(p,m,S){return n(this,p,m,S,!0)},u.prototype.removeListener=function(p,m,S,R){var H=t?t+p:p;if(!this._events[H])return this;if(!m)return a(this,H),this;var j=this._events[H];if(j.fn)j.fn===m&&(!R||j.once)&&(!S||j.context===S)&&a(this,H);else{for(var Q=0,Y=[],te=j.length;Q<te;Q++)(j[Q].fn!==m||R&&!j[Q].once||S&&j[Q].context!==S)&&Y.push(j[Q]);Y.length?this._events[H]=Y.length===1?Y[0]:Y:a(this,H)}return this},u.prototype.removeAllListeners=function(p){var m;return p?(m=t?t+p:p,this._events[m]&&a(this,m)):(this._events=new i,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=t,u.EventEmitter=u,o.exports=u}(ps)),ps.exports}var vl=ml(),_s=X(vl);const Pn="1.6.11",_n={};function yl(){return typeof __HLS_WORKER_BUNDLE__=="function"}function bl(){const o=_n[Pn];if(o)return o.clientCount++,o;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),r={worker:new self.Worker(t),objectURL:t,clientCount:1};return _n[Pn]=r,r}function El(o){const e=_n[o];if(e)return e.clientCount++,e;const t=new self.URL(o,self.location.href).href,r={worker:new self.Worker(t),scriptURL:t,clientCount:1};return _n[o]=r,r}function Sl(o){const e=_n[o||Pn];if(e&&e.clientCount--===1){const{worker:i,objectURL:r}=e;delete _n[o||Pn],r&&self.URL.revokeObjectURL(r),i.terminate()}}function Ta(o,e){return e+10<=o.length&&o[e]===51&&o[e+1]===68&&o[e+2]===73&&o[e+3]<255&&o[e+4]<255&&o[e+6]<128&&o[e+7]<128&&o[e+8]<128&&o[e+9]<128}function gs(o,e){return e+10<=o.length&&o[e]===73&&o[e+1]===68&&o[e+2]===51&&o[e+3]<255&&o[e+4]<255&&o[e+6]<128&&o[e+7]<128&&o[e+8]<128&&o[e+9]<128}function Wn(o,e){let t=0;return t=(o[e]&127)<<21,t|=(o[e+1]&127)<<14,t|=(o[e+2]&127)<<7,t|=o[e+3]&127,t}function On(o,e){const t=e;let i=0;for(;gs(o,e);){i+=10;const r=Wn(o,e+6);i+=r,Ta(o,e+10)&&(i+=10),e+=i}if(i>0)return o.subarray(t,t+i)}function wl(o,e,t,i){const r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],n=e[t+2],a=n>>2&15;if(a>12){const H=new Error(`invalid ADTS sampling index:${a}`);o.emit(_.ERROR,_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!0,error:H,reason:H.message});return}const u=(n>>6&3)+1,g=e[t+3]>>6&3|(n&1)<<2,p="mp4a.40."+u,m=r[a];let S=a;(u===5||u===29)&&(S-=3);const R=[u<<3|(S&14)>>1,(S&1)<<7|g<<3];return M.log(`manifest codec:${i}, parsed codec:${p}, channels:${g}, rate:${m} (ADTS object type:${u} sampling index:${a})`),{config:R,samplerate:m,channelCount:g,codec:p,parsedCodec:p,manifestCodec:i}}function Da(o,e){return o[e]===255&&(o[e+1]&246)===240}function La(o,e){return o[e+1]&1?7:9}function ms(o,e){return(o[e+3]&3)<<11|o[e+4]<<3|(o[e+5]&224)>>>5}function xl(o,e){return e+5<o.length}function Gn(o,e){return e+1<o.length&&Da(o,e)}function Al(o,e){return xl(o,e)&&Da(o,e)&&ms(o,e)<=o.length-e}function Cl(o,e){if(Gn(o,e)){const t=La(o,e);if(e+t>=o.length)return!1;const i=ms(o,e);if(i<=t)return!1;const r=e+i;return r===o.length||Gn(o,r)}return!1}function Ra(o,e,t,i,r){if(!o.samplerate){const n=wl(e,t,i,r);if(!n)return;c(o,n)}}function ka(o){return 1024*9e4/o}function Tl(o,e){const t=La(o,e);if(e+t<=o.length){const i=ms(o,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ia(o,e,t,i,r){const n=ka(o.samplerate),a=i+r*n,u=Tl(e,t);let g;if(u){const{frameLength:S,headerLength:R}=u,H=R+S,j=Math.max(0,t+H-e.length);j?(g=new Uint8Array(H-R),g.set(e.subarray(t+R,e.length),0)):g=e.subarray(t+R,t+H);const Q={unit:g,pts:a};return j||o.samples.push(Q),{sample:Q,length:H,missing:j}}const p=e.length-t;return g=new Uint8Array(p),g.set(e.subarray(t,e.length),0),{sample:{unit:g,pts:a},length:p,missing:-1}}function Dl(o,e){return gs(o,e)&&Wn(o,e+6)+10<=o.length-e}function Ll(o){return o instanceof ArrayBuffer?o:o.byteOffset==0&&o.byteLength==o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer}function vs(o,e=0,t=1/0){return Rl(o,e,t,Uint8Array)}function Rl(o,e,t,i){const r=kl(o);let n=1;"BYTES_PER_ELEMENT"in i&&(n=i.BYTES_PER_ELEMENT);const a=Il(o)?o.byteOffset:0,u=(a+o.byteLength)/n,g=(a+e)/n,p=Math.floor(Math.max(0,Math.min(g,u))),m=Math.floor(Math.min(p+Math.max(t,0),u));return new i(r,p,m-p)}function kl(o){return o instanceof ArrayBuffer?o:o.buffer}function Il(o){return o&&o.buffer instanceof ArrayBuffer&&o.byteLength!==void 0&&o.byteOffset!==void 0}function Pl(o){const e={key:o.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(o.size<2)return;if(o.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=o.data.subarray(1).indexOf(0);if(i===-1)return;const r=ue(vs(o.data,1,i)),n=o.data[2+i],a=o.data.subarray(3+i).indexOf(0);if(a===-1)return;const u=ue(vs(o.data,3+i,a));let g;return r==="-->"?g=ue(vs(o.data,4+i+a)):g=Ll(o.data.subarray(4+i+a)),e.mimeType=r,e.pictureType=n,e.description=u,e.data=g,e}function Ol(o){if(o.size<2)return;const e=ue(o.data,!0),t=new Uint8Array(o.data.subarray(e.length+1));return{key:o.type,info:e,data:t.buffer}}function Fl(o){if(o.size<2)return;if(o.type==="TXXX"){let t=1;const i=ue(o.data.subarray(t),!0);t+=i.length+1;const r=ue(o.data.subarray(t));return{key:o.type,info:i,data:r}}const e=ue(o.data.subarray(1));return{key:o.type,info:"",data:e}}function Ml(o){if(o.type==="WXXX"){if(o.size<2)return;let t=1;const i=ue(o.data.subarray(t),!0);t+=i.length+1;const r=ue(o.data.subarray(t));return{key:o.type,info:i,data:r}}const e=ue(o.data);return{key:o.type,info:"",data:e}}function Bl(o){return o.type==="PRIV"?Ol(o):o.type[0]==="W"?Ml(o):o.type==="APIC"?Pl(o):Fl(o)}function Nl(o){const e=String.fromCharCode(o[0],o[1],o[2],o[3]),t=Wn(o,4),i=10;return{type:e,size:t,data:o.subarray(i,i+t)}}const Kn=10,Ul=10;function Pa(o){let e=0;const t=[];for(;gs(o,e);){const i=Wn(o,e+6);o[e+5]>>6&1&&(e+=Kn),e+=Kn;const r=e+i;for(;e+Ul<r;){const n=Nl(o.subarray(e)),a=Bl(n);a&&t.push(a),e+=n.size+Kn}Ta(o,e)&&(e+=Kn)}return t}function Oa(o){return o&&o.key==="PRIV"&&o.info==="com.apple.streaming.transportStreamTimestamp"}function $l(o){if(o.data.byteLength===8){const e=new Uint8Array(o.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 ys(o){const e=Pa(o);for(let t=0;t<e.length;t++){const i=e[t];if(Oa(i))return $l(i)}}let Ki=function(o){return o.audioId3="org.id3",o.dateRange="com.apple.quicktime.HLS",o.emsg="https://aomedia.org/emsg/ID3",o.misbklv="urn:misb:KLV:bin:1910.1",o}({});function _r(o="",e=9e4){return{type:o,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class bs{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,r){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=Ge(this.cachedData,e),this.cachedData=null);let i=On(e,0),r=i?i.length:0,n;const a=this._audioTrack,u=this._id3Track,g=i?ys(i):void 0,p=e.length;for((this.basePTS===null||this.frameIndex===0&&I(g))&&(this.basePTS=Hl(g,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&u.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ki.audioId3,duration:Number.POSITIVE_INFINITY});r<p;){if(this.canParse(e,r)){const m=this.appendFrame(a,e,r);m?(this.frameIndex++,this.lastPTS=m.sample.pts,r+=m.length,n=r):r=p}else Dl(e,r)?(i=On(e,r),u.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ki.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===p&&n!==p){const m=e.slice(n);this.cachedData?this.cachedData=Ge(this.cachedData,m):this.cachedData=m}}return{audioTrack:a,videoTrack:_r(),id3Track:u,textTrack:_r()}}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:_r(),id3Track:this._id3Track,textTrack:_r()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Hl=(o,e,t)=>{if(I(o))return o*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let zn=null;const jl=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Wl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Gl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Kl=[0,1,1,4];function Fa(o,e,t,i,r){if(t+24>e.length)return;const n=Ma(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,u=i+r*a,g={unit:e.subarray(t,t+n.frameLength),pts:u,dts:u};return o.config=[],o.channelCount=n.channelCount,o.samplerate=n.sampleRate,o.samples.push(g),{sample:g,length:n.frameLength,missing:0}}}function Ma(o,e){const t=o[e+1]>>3&3,i=o[e+1]>>1&3,r=o[e+2]>>4&15,n=o[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const a=o[e+2]>>1&1,u=o[e+3]>>6,g=t===3?3-i:i===3?3:4,p=jl[g*14+r-1]*1e3,S=Wl[(t===3?0:t===2?1:2)*3+n],R=u===3?1:2,H=Gl[t][i],j=Kl[i],Q=H*8*j,Y=Math.floor(H*p/S+a)*j;if(zn===null){const ae=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);zn=ae?parseInt(ae[1]):0}return!!zn&&zn<=87&&i===2&&p>=224e3&&u===0&&(o[e+3]=o[e+3]|128),{sampleRate:S,channelCount:R,frameLength:Y,samplesPerFrame:Q}}}function Es(o,e){return o[e]===255&&(o[e+1]&224)===224&&(o[e+1]&6)!==0}function Ba(o,e){return e+1<o.length&&Es(o,e)}function zl(o,e){return Es(o,e)&&4<=o.length-e}function Na(o,e){if(e+1<o.length&&Es(o,e)){const i=Ma(o,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===o.length||Ba(o,n)}return!1}class Vl extends bs{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=On(e,0);let r=(i==null?void 0:i.length)||0;if(Na(e,r))return!1;for(let n=e.length;r<n;r++)if(Cl(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Al(e,t)}appendFrame(e,t,i){Ra(e,this.observer,t,i,e.manifestCodec);const r=Ia(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Ua=(o,e)=>{let t=0,i=5;e+=i;const r=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=o[e];const u=Math.min(i,8),g=8-u;n[0]=4278190080>>>24+g<<g,r[0]=(a[0]&n[0])>>g,t=t?t<<u|r[0]:r[0],e+=1,i-=u}return t};class ql extends bs{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const r=$a(e,t,i,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=On(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&ys(t)!==void 0&&Ua(e,i)<16}}function $a(o,e,t,i,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const u=[48e3,44100,32e3][n],g=e[t+4]&63,m=[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][g*3+n]*2;if(t+m>e.length)return-1;const S=e[t+6]>>5;let R=0;S===2?R+=2:(S&1&&S!==1&&(R+=2),S&4&&(R+=2));const H=(e[t+6]<<8|e[t+7])>>12-R&1,Q=[2,1,2,3,3,4,4,5][S]+H,Y=e[t+5]>>3,te=e[t+5]&7,ce=new Uint8Array([n<<6|Y<<1|te>>2,(te&3)<<6|S<<3|H<<2|g>>4,g<<4&224]),ae=1536/u*9e4,Ee=i+r*ae,Te=e.subarray(t,t+m);return o.config=ce,o.channelCount=Q,o.samplerate=u,o.samples.push({unit:Te,pts:Ee}),m}class Yl extends bs{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=On(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&ys(t)!==void 0&&Ua(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(Na(e,i))return M.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return zl(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Fa(e,t,i,this.basePTS,this.frameIndex)}}const Zl=/\/emsg[-/]ID3/i;class Xl{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,r){const n=this.videoTrack=_r("video",1),a=this.audioTrack=_r("audio",1),u=this.txtTrack=_r("text",1);if(this.id3Track=_r("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const g=Fe(e);if(g.video){const{id:p,timescale:m,codec:S,supplemental:R}=g.video;n.id=p,n.timescale=u.timescale=m,n.codec=S,n.supplemental=R}if(g.audio){const{id:p,timescale:m,codec:S}=g.audio;a.id=p,a.timescale=m,a.codec=S}u.id=wt.text,n.sampleDuration=0,n.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return ye(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Ge(this.remainderData,e));const u=Xe(i);this.remainderData=u.remainder,r.samples=u.valid||new Uint8Array}else r.samples=i;const a=this.extractID3Track(r,t);return n.samples=ct(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=ct(e,t),{videoTrack:t,audioTrack:_r(),id3Track:r,textTrack:_r()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=le(e.samples,["emsg"]);r&&r.forEach(n=>{const a=Ze(n);if(Zl.test(a.schemeIdUri)){const u=Ha(a,t);let g=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;g<=.001&&(g=Number.POSITIVE_INFINITY);const p=a.payload;i.samples.push({data:p,len:p.byteLength,dts:u,pts:u,type:Ki.emsg,duration:g})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const u=Ha(a,t);i.samples.push({data:a.payload,len:a.payload.byteLength,dts:u,pts:u,type:Ki.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 Ha(o,e){return I(o.presentationTime)?o.presentationTime/o.timeScale:e+o.presentationTimeDelta/o.timeScale}class Ql{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Mr(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,hi.cbc)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(u=>{const g=new Uint8Array(u);r.set(g,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(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 r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const a=rt(n.data),u=this.getAvcEncryptedData(a);this.decryptBuffer(u.buffer).then(g=>{n.data=this.getAvcDecryptedUnit(a,g),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)}).catch(r)}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const a=n[i];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,i,r,a),!this.decrypter.isSync()))return}}}}class ja{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,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,r=i.length;if(r){const n=i[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const r=t.byteLength;let n=e.naluState||0;const a=n,u=[];let g=0,p,m,S,R=-1,H=0;for(n===-1&&(R=0,H=this.getNALuType(t,0),n=0,g=1);g<r;){if(p=t[g++],!n){n=p?0:1;continue}if(n===1){n=p?0:2;continue}if(!p)n=3;else if(p===1){if(m=g-n-1,R>=0){const j={data:t.subarray(R,m),type:H};u.push(j)}else{const j=this.getLastNalUnit(e.samples);j&&(a&&g<=4-a&&j.state&&(j.data=j.data.subarray(0,j.data.byteLength-a)),m>0&&(j.data=Ge(j.data,t.subarray(0,m)),j.state=0))}g<r?(S=this.getNALuType(t,g),R=g,H=S,n=0):n=-1}else n=0}if(R>=0&&n>=0){const j={data:t.subarray(R,r),type:H,state:n};u.push(j)}if(u.length===0){const j=this.getLastNalUnit(e.samples);j&&(j.data=Ge(j.data,t))}return e.naluState=n,u}}class Fn{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,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}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&&M.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 Jl extends ja{parsePES(e,t,i,r){const n=this.parseNALu(e,i.data,r);let a=this.VideoSample,u,g=!1;i.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),n.forEach(p=>{var m,S;switch(p.type){case 1:{let Q=!1;u=!0;const Y=p.data;if(g&&Y.length>4){const te=this.readSliceType(Y);(te===2||te===4||te===7||te===9)&&(Q=!0)}if(Q){var R;(R=a)!=null&&R.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.frame=!0,a.key=Q;break}case 5:u=!0,(m=a)!=null&&m.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 6:{u=!0,we(p.data,1,i.pts,t.samples);break}case 7:{var H,j;u=!0,g=!0;const Q=p.data,Y=this.readSPS(Q);if(!e.sps||e.width!==Y.width||e.height!==Y.height||((H=e.pixelRatio)==null?void 0:H[0])!==Y.pixelRatio[0]||((j=e.pixelRatio)==null?void 0:j[1])!==Y.pixelRatio[1]){e.width=Y.width,e.height=Y.height,e.pixelRatio=Y.pixelRatio,e.sps=[Q];const te=Q.subarray(1,4);let ce="avc1.";for(let ae=0;ae<3;ae++){let Ee=te[ae].toString(16);Ee.length<2&&(Ee="0"+Ee),ce+=Ee}e.codec=ce}break}case 8:u=!0,e.pps=[p.data];break;case 9:u=!0,e.audFound=!0,(S=a)!=null&&S.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:u=!0;break;default:u=!1;break}a&&u&&a.units.push(p)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Fn(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,r=8,n;for(let a=0;a<e;a++)r!==0&&(n=t.readEG(),r=(i+n+256)%256),i=r===0?i:r}readSPS(e){const t=new Fn(e);let i=0,r=0,n=0,a=0,u,g,p;const m=t.readUByte.bind(t),S=t.readBits.bind(t),R=t.readUEG.bind(t),H=t.readBoolean.bind(t),j=t.skipBits.bind(t),Q=t.skipEG.bind(t),Y=t.skipUEG.bind(t),te=this.skipScalingList.bind(this);m();const ce=m();if(S(5),j(3),m(),Y(),ce===100||ce===110||ce===122||ce===244||ce===44||ce===83||ce===86||ce===118||ce===128){const Ie=R();if(Ie===3&&j(1),Y(),Y(),j(1),H())for(g=Ie!==3?8:12,p=0;p<g;p++)H()&&(p<6?te(16,t):te(64,t))}Y();const ae=R();if(ae===0)R();else if(ae===1)for(j(1),Q(),Q(),u=R(),p=0;p<u;p++)Q();Y(),j(1);const Ee=R(),Te=R(),$e=S(1);$e===0&&j(1),j(1),H()&&(i=R(),r=R(),n=R(),a=R());let xe=[1,1];if(H()&&H())switch(m()){case 1:xe=[1,1];break;case 2:xe=[12,11];break;case 3:xe=[10,11];break;case 4:xe=[16,11];break;case 5:xe=[40,33];break;case 6:xe=[24,11];break;case 7:xe=[20,11];break;case 8:xe=[32,11];break;case 9:xe=[80,33];break;case 10:xe=[18,11];break;case 11:xe=[15,11];break;case 12:xe=[64,33];break;case 13:xe=[160,99];break;case 14:xe=[4,3];break;case 15:xe=[3,2];break;case 16:xe=[2,1];break;case 255:{xe=[m()<<8|m(),m()<<8|m()];break}}return{width:Math.ceil((Ee+1)*16-i*2-r*2),height:(2-$e)*(Te+1)*16-($e?2:4)*(n+a),pixelRatio:xe}}}class eu extends ja{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,r){const n=this.parseNALu(e,i.data,r);let a=this.VideoSample,u,g=!1;i.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),n.forEach(p=>{var m,S;switch(p.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),a.frame=!0,u=!0;break;case 16:case 17:case 18:case 21:if(u=!0,g){var R;(R=a)!=null&&R.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:u=!0,(m=a)!=null&&m.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 39:u=!0,we(p.data,2,i.pts,t.samples);break;case 32:u=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=c(e.params,this.readVPS(p.data)),this.initVPS=p.data),e.vps=[p.data];break;case 33:if(u=!0,g=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],p.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const H=this.readSPS(p.data);e.width=H.width,e.height=H.height,e.pixelRatio=H.pixelRatio,e.codec=H.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const j in H.params)e.params[j]=H.params[j]}this.pushParameterSet(e.sps,p.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(u=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const H=this.readPPS(p.data);for(const j in H)e.params[j]=H[j]}this.pushParameterSet(e.pps,p.data,e.vps)}break;case 35:u=!0,e.audFound=!0,(S=a)!=null&&S.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:u=!1;break}a&&u&&a.units.push(p)}),r&&a&&(this.pushAccessUnit(a,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 r=0;r<e.byteLength;r++)r>=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(t[i]=e[r],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 Fn(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),r=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:r}}readSPS(e){const t=new Fn(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const r=t.readBits(2),n=t.readBoolean(),a=t.readBits(5),u=t.readUByte(),g=t.readUByte(),p=t.readUByte(),m=t.readUByte(),S=t.readUByte(),R=t.readUByte(),H=t.readUByte(),j=t.readUByte(),Q=t.readUByte(),Y=t.readUByte(),te=t.readUByte(),ce=[],ae=[];for(let Yt=0;Yt<i;Yt++)ce.push(t.readBoolean()),ae.push(t.readBoolean());if(i>0)for(let Yt=i;Yt<8;Yt++)t.readBits(2);for(let Yt=0;Yt<i;Yt++)ce[Yt]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),ae[Yt]&&t.readUByte();t.readUEG();const Ee=t.readUEG();Ee==3&&t.skipBits(1);const Te=t.readUEG(),$e=t.readUEG(),xe=t.readBoolean();let Ie=0,Pe=0,Ae=0,ze=0;xe&&(Ie+=t.readUEG(),Pe+=t.readUEG(),Ae+=t.readUEG(),ze+=t.readUEG());const _t=t.readUEG(),xt=t.readUEG(),kt=t.readUEG(),At=t.readBoolean();for(let Yt=At?0:i;Yt<=i;Yt++)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 Ii=0;Ii<4;Ii++)for(let Qi=0;Qi<(Ii===3?2:6);Qi++)if(!t.readBoolean())t.readUEG();else{const or=Math.min(64,1<<4+(Ii<<1));Ii>1&&t.readEG();for(let Sn=0;Sn<or;Sn++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const vt=t.readUEG();let Tt=0;for(let Yt=0;Yt<vt;Yt++){let Ii=!1;if(Yt!==0&&(Ii=t.readBoolean()),Ii){Yt===vt&&t.readUEG(),t.readBoolean(),t.readUEG();let Qi=0;for(let rn=0;rn<=Tt;rn++){const or=t.readBoolean();let Sn=!1;or||(Sn=t.readBoolean()),(or||Sn)&&Qi++}Tt=Qi}else{const Qi=t.readUEG(),rn=t.readUEG();Tt=Qi+rn;for(let or=0;or<Qi;or++)t.readUEG(),t.readBoolean();for(let or=0;or<rn;or++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Yt=t.readUEG();for(let Ii=0;Ii<Yt;Ii++){for(let Qi=0;Qi<kt+4;Qi++)t.readBits(1);t.readBits(1)}}let ft=0,dt=1,$t=1,Zt=!0,Ht=1,Vt=0;t.readBoolean(),t.readBoolean();let ki=!1;if(t.readBoolean()){if(t.readBoolean()){const nn=t.readUByte(),Yo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],ls=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];nn>0&&nn<16?(dt=Yo[nn-1],$t=ls[nn-1]):nn===255&&(dt=t.readBits(16),$t=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(),ki=t.readBoolean(),ki&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(Ht=t.readBits(32),Vt=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const ls=t.readBoolean(),Zo=t.readBoolean();let $n=!1;(ls||Zo)&&($n=t.readBoolean(),$n&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),$n&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Xo=0;Xo<=i;Xo++){Zt=t.readBoolean();const Ph=Zt||t.readBoolean();let Qo=!1;Ph?t.readEG():Qo=t.readBoolean();const Jo=Qo?1:t.readUEG()+1;if(ls)for(let Hn=0;Hn<Jo;Hn++)t.readUEG(),t.readUEG(),$n&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Zo)for(let Hn=0;Hn<Jo;Hn++)t.readUEG(),t.readUEG(),$n&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),ft=t.readUEG())}let Xi=Te,yr=$e;if(xe){let Yt=1,Ii=1;Ee===1?Yt=Ii=2:Ee==2&&(Yt=2),Xi=Te-Yt*Pe-Yt*Ie,yr=$e-Ii*ze-Ii*Ae}const tn=r?["A","B","C"][r]:"",Ih=u<<24|g<<16|p<<8|m;let ea=0;for(let Yt=0;Yt<32;Yt++)ea=(ea|(Ih>>Yt&1)<<31-Yt)>>>0;let ta=ea.toString(16);return a===1&&ta==="2"&&(ta="6"),{codecString:`hvc1.${tn}${a}.${ta}.${n?"H":"L"}${te}.B0`,params:{general_tier_flag:n,general_profile_idc:a,general_profile_space:r,general_profile_compatibility_flags:[u,g,p,m],general_constraint_indicator_flags:[S,R,H,j,Q,Y],general_level_idc:te,bit_depth:_t+8,bit_depth_luma_minus8:_t,bit_depth_chroma_minus8:xt,min_spatial_segmentation_idc:ft,chroma_format_idc:Ee,frame_rate:{fixed:Zt,fps:Vt/Ht}},width:Xi,height:yr,pixelRatio:[dt,$t]}}readPPS(e){const t=new Fn(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 r=t.readBoolean(),n=t.readBoolean();let a=1;return n&&r?a=0:n?a=3:r&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Ai=188;class jr{constructor(e,t,i,r){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=r,this.videoParser=null}static probe(e,t){const i=jr.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(Ai*5,t-Ai)+1,r=0;for(;r<i;){let n=!1,a=-1,u=0;for(let g=r;g<t;g+=Ai)if(e[g]===71&&(t-g===Ai||e[g+Ai]===71)){if(u++,a===-1&&(a=g,a!==0&&(i=Math.min(a+Ai*99,e.length-Ai)+1)),n||(n=Ss(e,g)===0),n&&u>1&&(a===0&&u>2||g+Ai>i))return a}else{if(u)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:wt[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=jr.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=jr.createTrack("audio",r),this._id3Track=jr.createTrack("id3"),this._txtTrack=jr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,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,r=!1){i||(this.sampleAes=null);let n;const a=this._videoTrack,u=this._audioTrack,g=this._id3Track,p=this._txtTrack;let m=a.pid,S=a.pesData,R=u.pid,H=g.pid,j=u.pesData,Q=g.pesData,Y=null,te=this.pmtParsed,ce=this._pmtId,ae=e.length;if(this.remainderData&&(e=Ge(this.remainderData,e),ae=e.length,this.remainderData=null),ae<Ai&&!r)return this.remainderData=e,{audioTrack:u,videoTrack:a,id3Track:g,textTrack:p};const Ee=Math.max(0,jr.syncOffset(e));ae-=(ae-Ee)%Ai,ae<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,ae,e.buffer.byteLength-ae));let Te=0;for(let xe=Ee;xe<ae;xe+=Ai)if(e[xe]===71){const Ie=!!(e[xe+1]&64),Pe=Ss(e,xe),Ae=(e[xe+3]&48)>>4;let ze;if(Ae>1){if(ze=xe+5+e[xe+4],ze===xe+Ai)continue}else ze=xe+4;switch(Pe){case m:Ie&&(S&&(n=gn(S,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,p,n,!1)),S={data:[],size:0}),S&&(S.data.push(e.subarray(ze,xe+Ai)),S.size+=xe+Ai-ze);break;case R:if(Ie){if(j&&(n=gn(j,this.logger)))switch(u.segmentCodec){case"aac":this.parseAACPES(u,n);break;case"mp3":this.parseMPEGPES(u,n);break;case"ac3":this.parseAC3PES(u,n);break}j={data:[],size:0}}j&&(j.data.push(e.subarray(ze,xe+Ai)),j.size+=xe+Ai-ze);break;case H:Ie&&(Q&&(n=gn(Q,this.logger))&&this.parseID3PES(g,n),Q={data:[],size:0}),Q&&(Q.data.push(e.subarray(ze,xe+Ai)),Q.size+=xe+Ai-ze);break;case 0:Ie&&(ze+=e[ze]+1),ce=this._pmtId=tu(e,ze);break;case ce:{Ie&&(ze+=e[ze]+1);const _t=iu(e,ze,this.typeSupported,i,this.observer,this.logger);m=_t.videoPid,m>0&&(a.pid=m,a.segmentCodec=_t.segmentVideoCodec),R=_t.audioPid,R>0&&(u.pid=R,u.segmentCodec=_t.segmentAudioCodec),H=_t.id3Pid,H>0&&(g.pid=H),Y!==null&&!te&&(this.logger.warn(`MPEG-TS PMT found at ${xe} after unknown PID '${Y}'. Backtracking to sync byte @${Ee} to parse all TS packets.`),Y=null,xe=Ee-188),te=this.pmtParsed=!0;break}case 17:case 8191:break;default:Y=Pe;break}}else Te++;Te>0&&ws(this.observer,new Error(`Found ${Te} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=S,u.pesData=j,g.pesData=Q;const $e={audioTrack:u,videoTrack:a,id3Track:g,textTrack:p};return r&&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:r,textTrack:n}=e,a=i.pesData,u=t.pesData,g=r.pesData;let p;if(a&&(p=gn(a,this.logger))?(this.readyVideoParser(i.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(i,n,p,!0),i.pesData=null)):i.pesData=a,u&&(p=gn(u,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,p);break;case"mp3":this.parseMPEGPES(t,p);break;case"ac3":this.parseAC3PES(t,p);break}t.pesData=null}else u!=null&&u.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=u;g&&(p=gn(g,this.logger))?(this.parseID3PES(r,p),r.pesData=null):r.pesData=g}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new Ql(this.observer,this.config,t);return this.decrypt(r,n)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Jl:e==="hevc"&&(this.videoParser=new eu))}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.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 r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const S=r.missing,R=r.sample.unit.byteLength;if(S===-1)n=Ge(r.sample.unit,n);else{const H=R-S;r.sample.unit.set(n.subarray(0,S),H),e.samples.push(r.sample),i=r.missing}}let a,u;for(a=i,u=n.length;a<u-1&&!Gn(n,a);a++);if(a!==i){let S;const R=a<u-1;if(R?S=`AAC PES did not start with ADTS header,offset:${a}`:S="No ADTS header found in AAC PES",ws(this.observer,new Error(S),R,this.logger),!R)return}Ra(e,this.observer,n,a,this.audioCodec);let g;if(t.pts!==void 0)g=t.pts;else if(r){const S=ka(e.samplerate);g=r.sample.pts+S}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let p=0,m;for(;a<u;)if(m=Ia(e,n,a,g,p),a+=m.length,m.missing){this.aacOverFlow=m;break}else for(p++;a<u-1&&!Gn(n,a);a++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let n=0,a=0;const u=t.pts;if(u===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<r;)if(Ba(i,a)){const g=Fa(e,i,a,u,n);if(g)a+=g.length,n++;else break}else a++}parseAC3PES(e,t){{const i=t.data,r=t.pts;if(r===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=i.length;let a=0,u=0,g;for(;u<n&&(g=$a(e,i,u,r,a++))>0;)u+=g}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=c({},t,{type:this._videoTrack?Ki.emsg:Ki.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Ss(o,e){return((o[e+1]&31)<<8)+o[e+2]}function tu(o,e){return(o[e+10]&31)<<8|o[e+11]}function iu(o,e,t,i,r,n){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},u=(o[e+1]&15)<<8|o[e+2],g=e+3+u-4,p=(o[e+10]&15)<<8|o[e+11];for(e+=12+p;e<g;){const m=Ss(o,e),S=(o[e+3]&15)<<8|o[e+4];switch(o[e]){case 207:if(!i){xs("ADTS AAC",n);break}case 15:a.audioPid===-1&&(a.audioPid=m);break;case 21:a.id3Pid===-1&&(a.id3Pid=m);break;case 219:if(!i){xs("H.264",n);break}case 27:a.videoPid===-1&&(a.videoPid=m);break;case 3:case 4:!t.mpeg&&!t.mp3?n.log("MPEG audio found, not supported in this browser"):a.audioPid===-1&&(a.audioPid=m,a.segmentAudioCodec="mp3");break;case 193:if(!i){xs("AC-3",n);break}case 129:t.ac3?a.audioPid===-1&&(a.audioPid=m,a.segmentAudioCodec="ac3"):n.log("AC-3 audio found, not supported in this browser");break;case 6:if(a.audioPid===-1&&S>0){let R=e+5,H=S;for(;H>2;){switch(o[R]){case 106:t.ac3!==!0?n.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=m,a.segmentAudioCodec="ac3");break}const Q=o[R+1]+2;R+=Q,H-=Q}}break;case 194:case 135:return ws(r,new Error("Unsupported EC-3 in M2TS found"),void 0,n),a;case 36:a.videoPid===-1&&(a.videoPid=m,a.segmentVideoCodec="hevc",n.log("HEVC in M2TS found"));break}e+=S+5}return a}function ws(o,e,t,i){i.warn(`parsing error: ${e.message}`),o.emit(_.ERROR,_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function xs(o,e){e.log(`${o} with AES-128-CBC encryption found in unencrypted stream`)}function gn(o,e){let t=0,i,r,n,a,u;const g=o.data;if(!o||o.size===0)return null;for(;g[0].length<19&&g.length>1;)g[0]=Ge(g[0],g[1]),g.splice(1,1);if(i=g[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(r=(i[4]<<8)+i[5],r&&r>o.size-6)return null;const m=i[7];m&192&&(a=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,m&64?(u=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,a-u>60*9e4&&(e.warn(`${Math.round((a-u)/9e4)}s delta between PTS and DTS, align them`),a=u)):u=a),n=i[8];let S=n+9;if(o.size<=S)return null;o.size-=S;const R=new Uint8Array(o.size);for(let H=0,j=g.length;H<j;H++){i=g[H];let Q=i.byteLength;if(S)if(S>Q){S-=Q;continue}else i=i.subarray(S),Q-=S,S=0;R.set(i,t),t+=Q}return r&&(r-=n+3),{data:R,pts:a,dts:u,len:r}}return null}class ru{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 Wr=Math.pow(2,32)-1;class Le{static init(){Le.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 Le.types)Le.types.hasOwnProperty(e)&&(Le.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]);Le.HDLR_TYPES={video:t,audio:i};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);Le.STTS=Le.STSC=Le.STCO=n,Le.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Le.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Le.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Le.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),g=new Uint8Array([0,0,0,1]);Le.FTYP=Le.box(Le.types.ftyp,a,g,a,u),Le.DINF=Le.box(Le.types.dinf,Le.box(Le.types.dref,r))}static box(e,...t){let i=8,r=t.length;const n=r;for(;r--;)i+=t[r].byteLength;const a=new Uint8Array(i);for(a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=i&255,a.set(e,4),r=0,i=8;r<n;r++)a.set(t[r],i),i+=t[r].byteLength;return a}static hdlr(e){return Le.box(Le.types.hdlr,Le.HDLR_TYPES[e])}static mdat(e){return Le.box(Le.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Wr+1)),r=Math.floor(t%(Wr+1));return Le.box(Le.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,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return Le.box(Le.types.mdia,Le.mdhd(e.timescale||0,e.duration||0),Le.hdlr(e.type),Le.minf(e))}static mfhd(e){return Le.box(Le.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"?Le.box(Le.types.minf,Le.box(Le.types.smhd,Le.SMHD),Le.DINF,Le.stbl(e)):Le.box(Le.types.minf,Le.box(Le.types.vmhd,Le.VMHD),Le.DINF,Le.stbl(e))}static moof(e,t,i){return Le.box(Le.types.moof,Le.mfhd(e),Le.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Le.trak(e[t]);return Le.box.apply(null,[Le.types.moov,Le.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(Le.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Le.trex(e[t]);return Le.box.apply(null,[Le.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Wr+1)),r=Math.floor(t%(Wr+1)),n=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,r>>24,r>>16&255,r>>8&255,r&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 Le.box(Le.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return Le.box(Le.types.sdtp,i)}static stbl(e){return Le.box(Le.types.stbl,Le.stsd(e),Le.box(Le.types.stts,Le.STTS),Le.box(Le.types.stsc,Le.STSC),Le.box(Le.types.stsz,Le.STSZ),Le.box(Le.types.stco,Le.STCO))}static avc1(e){let t=[],i=[],r,n,a;for(r=0;r<e.sps.length;r++)n=e.sps[r],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],a=n.byteLength,i.push(a>>>8&255),i.push(a&255),i=i.concat(Array.prototype.slice.call(n));const u=Le.box(Le.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),g=e.width,p=e.height,m=e.pixelRatio[0],S=e.pixelRatio[1];return Le.box(Le.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,g>>8&255,g&255,p>>8&255,p&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,Le.box(Le.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Le.box(Le.types.pasp,new Uint8Array([m>>24,m>>16&255,m>>8&255,m&255,S>>24,S>>16&255,S>>8&255,S&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 Le.box(Le.types.mp4a,Le.audioStsd(e),Le.box(Le.types.esds,Le.esds(e)))}static mp3(e){return Le.box(Le.types[".mp3"],Le.audioStsd(e))}static ac3(e){return Le.box(Le.types["ac-3"],Le.audioStsd(e),Le.box(Le.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Le.box(Le.types.stsd,Le.STSD,Le.mp4a(e));if(t==="ac3"&&e.config)return Le.box(Le.types.stsd,Le.STSD,Le.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Le.box(Le.types.stsd,Le.STSD,Le.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Le.box(Le.types.stsd,Le.STSD,Le.avc1(e));if(t==="hevc"&&e.vps)return Le.box(Le.types.stsd,Le.STSD,Le.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),r=e.width||0,n=e.height||0,a=Math.floor(i/(Wr+1)),u=Math.floor(i%(Wr+1));return Le.box(Le.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,a>>24,a>>16&255,a>>8&255,a&255,u>>24,u>>16&255,u>>8&255,u&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,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=Le.sdtp(e),r=e.id,n=Math.floor(t/(Wr+1)),a=Math.floor(t%(Wr+1));return Le.box(Le.types.traf,Le.box(Le.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),Le.box(Le.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),Le.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Le.box(Le.types.trak,Le.tkhd(e),Le.mdia(e))}static trex(e){const t=e.id;return Le.box(Le.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||[],r=i.length,n=12+16*r,a=new Uint8Array(n);let u,g,p,m,S,R;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),u=0;u<r;u++)g=i[u],p=g.duration,m=g.size,S=g.flags,R=g.cts,a.set([p>>>24&255,p>>>16&255,p>>>8&255,p&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255,S.isLeading<<2|S.dependsOn,S.isDependedOn<<6|S.hasRedundancy<<4|S.paddingValue<<1|S.isNonSync,S.degradPrio&61440,S.degradPrio&15,R>>>24&255,R>>>16&255,R>>>8&255,R&255],12+16*u);return Le.box(Le.types.trun,a)}static initSegment(e){Le.types||Le.init();const t=Le.moov(e);return Ge(Le.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],r=4,n=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),r-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let a=n.length;for(let j=0;j<i.length;j+=1){a+=3;for(let Q=0;Q<i[j].length;Q+=1)a+=2+i[j][Q].length}const u=new Uint8Array(a);u.set(n,0),a=n.length;const g=i.length-1;for(let j=0;j<i.length;j+=1){u.set(new Uint8Array([32+j|(j===g?128:0),0,i[j].length]),a),a+=3;for(let Q=0;Q<i[j].length;Q+=1)u.set(new Uint8Array([i[j][Q].length>>8,i[j][Q].length&255]),a),a+=2,u.set(i[j][Q],a),a+=i[j][Q].length}const p=Le.box(Le.types.hvcC,u),m=e.width,S=e.height,R=e.pixelRatio[0],H=e.pixelRatio[1];return Le.box(Le.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,m>>8&255,m&255,S>>8&255,S&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]),p,Le.box(Le.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Le.box(Le.types.pasp,new Uint8Array([R>>24,R>>16&255,R>>8&255,R&255,H>>24,H>>16&255,H>>8&255,H&255])))}}Le.types=void 0,Le.HDLR_TYPES=void 0,Le.STTS=void 0,Le.STSC=void 0,Le.STCO=void 0,Le.STSZ=void 0,Le.VMHD=void 0,Le.SMHD=void 0,Le.STSD=void 0,Le.FTYP=void 0,Le.DINF=void 0;const Wa=9e4;function As(o,e,t=1,i=!1){const r=o*e*t;return i?Math.round(r):r}function nu(o,e,t=1,i=!1){return As(o,e,1/t,i)}function Mn(o,e=!1){return As(o,1e3,1/Wa,e)}function su(o,e=1){return As(o,Wa,1/e)}const au=10*1e3,ou=1024,lu=1152,uu=1536;let mn=null,Cs=null;function Ga(o,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:o?2:1,isNonSync:o?0:1}}}class Vn extends T{constructor(e,t,i,r){if(super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,mn===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);mn=a?parseInt(a[1]):0}if(Cs===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);Cs=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,r=e.reduce((n,a)=>{let u=a.pts,g=u-n;return g<-4294967296&&(t=!0,u=Zi(u,i),g=u-n),g>0?n:u},i);return t&&this.debug("PTS rollover detected"),r}remux(e,t,i,r,n,a,u,g){let p,m,S,R,H,j,Q=n,Y=n;const te=e.pid>-1,ce=t.pid>-1,ae=t.samples.length,Ee=e.samples.length>0,Te=u&&ae>0||ae>1;if((!te||Ee)&&(!ce||Te)||this.ISGenerated||u){if(this.ISGenerated){var xe,Ie,Pe,Ae;const kt=this.videoTrackConfig;(kt&&(t.width!==kt.width||t.height!==kt.height||((xe=t.pixelRatio)==null?void 0:xe[0])!==((Ie=kt.pixelRatio)==null?void 0:Ie[0])||((Pe=t.pixelRatio)==null?void 0:Pe[1])!==((Ae=kt.pixelRatio)==null?void 0:Ae[1]))||!kt&&Te||this.nextAudioTs===null&&Ee)&&this.resetInitSegment()}this.ISGenerated||(S=this.generateIS(e,t,n,a));const ze=this.isVideoContiguous;let _t=-1,xt;if(Te&&(_t=cu(t.samples),!ze&&this.config.forceKeyFrameOnDiscontinuity))if(j=!0,_t>0){this.warn(`Dropped ${_t} out of ${ae} video samples due to a missing keyframe`);const kt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(_t),t.dropped+=_t,Y+=(t.samples[0].pts-kt)/t.inputTimeScale,xt=Y}else _t===-1&&(this.warn(`No keyframe found out of ${ae} video samples`),j=!1);if(this.ISGenerated){if(Ee&&Te){const kt=this.getVideoStartPts(t.samples),ut=(Zi(e.samples[0].pts,kt)-kt)/t.inputTimeScale;Q+=Math.max(0,ut),Y+=Math.max(0,-ut)}if(Ee){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),S=this.generateIS(e,t,n,a)),m=this.remuxAudio(e,Q,this.isAudioContiguous,a,ce||Te||g===v.AUDIO?Y:void 0),Te){const kt=m?m.endPTS-m.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),S=this.generateIS(e,t,n,a)),p=this.remuxVideo(t,Y,ze,kt)}}else Te&&(p=this.remuxVideo(t,Y,ze,0));p&&(p.firstKeyFrame=_t,p.independent=_t!==-1,p.firstKeyFramePTS=xt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(H=Ka(i,n,this._initPTS,this._initDTS)),r.samples.length&&(R=za(r,n,this._initPTS))),{audio:m,video:p,initSegment:S,independent:j,text:R,id3:H}}generateIS(e,t,i,r){const n=e.samples,a=t.samples,u=this.typeSupported,g={},p=this._initPTS;let m=!p||r,S="audio/mp4",R,H,j,Q=-1;if(m&&(R=H=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":u.mpeg?(S="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}g.audio={id:"audio",container:S,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&u.mpeg?new Uint8Array(0):Le.initSegment([e]),metadata:{channelCount:e.channelCount}},m&&(Q=e.id,j=e.inputTimeScale,!p||j!==p.timescale?R=H=n[0].pts-Math.round(j*i):m=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,g.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Le.initSegment([t]),metadata:{width:t.width,height:t.height}},m)if(Q=t.id,j=t.inputTimeScale,!p||j!==p.timescale){const Y=this.getVideoStartPts(a),te=Math.round(j*i);H=Math.min(H,Zi(a[0].dts,Y)-te),R=Math.min(R,Y-te)}else m=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(g).length)return this.ISGenerated=!0,m?(p&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${i} ${R/j} != initPTS: ${p.baseTime/p.timescale} (${p.baseTime}/${p.timescale}) trackId: ${p.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${R/j} (${R}/${j}) trackId: ${Q}`),this._initPTS={baseTime:R,timescale:j,trackId:Q},this._initDTS={baseTime:H,timescale:j,trackId:Q}):R=j=void 0,{tracks:g,initPTS:R,timescale:j,trackId:Q}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,a=e.samples,u=[],g=a.length,p=this._initPTS,m=p.baseTime*n/p.timescale;let S=this.nextVideoTs,R=8,H=this.videoSampleDuration,j,Q,Y=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY,ce=!1;if(!i||S===null){const ft=m+t*n,dt=a[0].pts-Zi(a[0].dts,a[0].pts);mn&&S!==null&&Math.abs(ft-dt-(S+m))<15e3?i=!0:S=ft-dt-m}const ae=S+m;for(let ft=0;ft<g;ft++){const dt=a[ft];dt.pts=Zi(dt.pts,ae),dt.dts=Zi(dt.dts,ae),dt.dts<a[ft>0?ft-1:ft].dts&&(ce=!0)}ce&&a.sort(function(ft,dt){const $t=ft.dts-dt.dts,Zt=ft.pts-dt.pts;return $t||Zt}),j=a[0].dts,Q=a[a.length-1].dts;const Ee=Q-j,Te=Ee?Math.round(Ee/(g-1)):H||e.inputTimeScale/30;if(i){const ft=j-ae,dt=ft>Te,$t=ft<-1;if((dt||$t)&&(dt?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Mn(ft,!0)} ms (${ft}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Mn(-ft,!0)} ms (${ft}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!$t||ae>=a[0].pts||mn)){j=ae;const Zt=a[0].pts-ft;if(dt)a[0].dts=j,a[0].pts=Zt;else{let Ht=!0;for(let Vt=0;Vt<a.length&&!(a[Vt].dts>Zt&&Ht);Vt++){const ki=a[Vt].pts;if(a[Vt].dts-=ft,a[Vt].pts-=ft,Vt<a.length-1){const Di=a[Vt+1].pts,Xi=a[Vt].pts,yr=Di<=Xi,tn=Di<=ki;Ht=yr==tn}}}this.log(`Video: Initial PTS/DTS adjusted: ${Mn(Zt,!0)}/${Mn(j,!0)}, delta: ${Mn(ft,!0)} ms`)}}j=Math.max(0,j);let $e=0,xe=0,Ie=j;for(let ft=0;ft<g;ft++){const dt=a[ft],$t=dt.units,Zt=$t.length;let Ht=0;for(let Vt=0;Vt<Zt;Vt++)Ht+=$t[Vt].data.length;xe+=Ht,$e+=Zt,dt.length=Ht,dt.dts<Ie?(dt.dts=Ie,Ie+=Te/4|0||1):Ie=dt.dts,Y=Math.min(dt.pts,Y),te=Math.max(dt.pts,te)}Q=a[g-1].dts;const Pe=xe+4*$e+8;let Ae;try{Ae=new Uint8Array(Pe)}catch(ft){this.observer.emit(_.ERROR,_.ERROR,{type:D.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:ft,bytes:Pe,reason:`fail allocating video mdat ${Pe}`});return}const ze=new DataView(Ae.buffer);ze.setUint32(0,Pe),Ae.set(Le.types.mdat,4);let _t=!1,xt=Number.POSITIVE_INFINITY,kt=Number.POSITIVE_INFINITY,At=Number.NEGATIVE_INFINITY,ut=Number.NEGATIVE_INFINITY;for(let ft=0;ft<g;ft++){const dt=a[ft],$t=dt.units;let Zt=0;for(let ki=0,Di=$t.length;ki<Di;ki++){const Xi=$t[ki],yr=Xi.data,tn=Xi.data.byteLength;ze.setUint32(R,tn),R+=4,Ae.set(yr,R),R+=tn,Zt+=4+tn}let Ht;if(ft<g-1)H=a[ft+1].dts-dt.dts,Ht=a[ft+1].pts-dt.pts;else{const ki=this.config,Di=ft>0?dt.dts-a[ft-1].dts:Te;if(Ht=ft>0?dt.pts-a[ft-1].pts:Te,ki.stretchShortVideoTrack&&this.nextAudioTs!==null){const Xi=Math.floor(ki.maxBufferHole*n),yr=(r?Y+r*n:this.nextAudioTs+m)-dt.pts;yr>Xi?(H=yr-Di,H<0?H=Di:_t=!0,this.log(`It is approximately ${yr/90} ms to the next segment; using duration ${H/90} ms for the last video frame.`)):H=Di}else H=Di}const Vt=Math.round(dt.pts-dt.dts);xt=Math.min(xt,H),At=Math.max(At,H),kt=Math.min(kt,Ht),ut=Math.max(ut,Ht),u.push(Ga(dt.key,H,Zt,Vt))}if(u.length){if(mn){if(mn<70){const ft=u[0].flags;ft.dependsOn=2,ft.isNonSync=0}}else if(Cs&&ut-kt<At-xt&&Te/At<.025&&u[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let ft=j;for(let dt=0,$t=u.length;dt<$t;dt++){const Zt=ft+u[dt].duration,Ht=ft+u[dt].cts;if(dt<$t-1){const Vt=Zt+u[dt+1].cts;u[dt].duration=Vt-Ht}else u[dt].duration=dt?u[dt-1].duration:Te;u[dt].cts=0,ft=Zt}}}H=_t||!H?Te:H;const Ct=Q+H;this.nextVideoTs=S=Ct-m,this.videoSampleDuration=H,this.isVideoContiguous=!0;const Mt={data1:Le.moof(e.sequenceNumber++,j,c(e,{samples:u})),data2:Ae,startPTS:(Y-m)/n,endPTS:(te+H-m)/n,startDTS:(j-m)/n,endDTS:S/n,type:"video",hasAudio:!1,hasVideo:!0,nb:u.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Mt}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return lu;case"ac3":return uu;default:return ou}}remuxAudio(e,t,i,r,n){const a=e.inputTimeScale,u=e.samplerate?e.samplerate:a,g=a/u,p=this.getSamplesPerFrame(e),m=p*g,S=this._initPTS,R=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,H=[],j=n!==void 0;let Q=e.samples,Y=R?0:8,te=this.nextAudioTs||-1;const ce=S.baseTime*a/S.timescale,ae=ce+t*a;if(this.isAudioContiguous=i=i||Q.length&&te>0&&(r&&Math.abs(ae-(te+ce))<9e3||Math.abs(Zi(Q[0].pts,ae)-(te+ce))<20*m),Q.forEach(function(ut){ut.pts=Zi(ut.pts,ae)}),!i||te<0){if(Q=Q.filter(ut=>ut.pts>=0),!Q.length)return;n===0?te=0:r&&!j?te=Math.max(0,ae-ce):te=Q[0].pts-ce}if(e.segmentCodec==="aac"){const ut=this.config.maxAudioFramesDrift;for(let Ct=0,vt=te+ce;Ct<Q.length;Ct++){const Tt=Q[Ct],Mt=Tt.pts,ft=Mt-vt,dt=Math.abs(1e3*ft/a);if(ft<=-ut*m&&j)Ct===0&&(this.warn(`Audio frame @ ${(Mt/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*ft/a)} ms.`),this.nextAudioTs=te=Mt-ce,vt=Mt);else if(ft>=ut*m&&dt<au&&j){let $t=Math.round(ft/m);for(vt=Mt-$t*m;vt<0&&$t&&m;)$t--,vt+=m;Ct===0&&(this.nextAudioTs=te=vt-ce),this.warn(`Injecting ${$t} audio frames @ ${((vt-ce)/a).toFixed(3)}s due to ${Math.round(1e3*ft/a)} ms gap.`);for(let Zt=0;Zt<$t;Zt++){let Ht=ru.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Ht||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Ht=Tt.unit.subarray()),Q.splice(Ct,0,{unit:Ht,pts:vt}),vt+=m,Ct++}}Tt.pts=vt,vt+=m}}let Ee=null,Te=null,$e,xe=0,Ie=Q.length;for(;Ie--;)xe+=Q[Ie].unit.byteLength;for(let ut=0,Ct=Q.length;ut<Ct;ut++){const vt=Q[ut],Tt=vt.unit;let Mt=vt.pts;if(Te!==null){const dt=H[ut-1];dt.duration=Math.round((Mt-Te)/g)}else if(i&&e.segmentCodec==="aac"&&(Mt=te+ce),Ee=Mt,xe>0){xe+=Y;try{$e=new Uint8Array(xe)}catch(dt){this.observer.emit(_.ERROR,_.ERROR,{type:D.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:dt,bytes:xe,reason:`fail allocating audio mdat ${xe}`});return}R||(new DataView($e.buffer).setUint32(0,xe),$e.set(Le.types.mdat,4))}else return;$e.set(Tt,Y);const ft=Tt.byteLength;Y+=ft,H.push(Ga(!0,p,ft,0)),Te=Mt}const Pe=H.length;if(!Pe)return;const Ae=H[H.length-1];te=Te-ce,this.nextAudioTs=te+g*Ae.duration;const ze=R?new Uint8Array(0):Le.moof(e.sequenceNumber++,Ee/g,c({},e,{samples:H}));e.samples=[];const _t=(Ee-ce)/a,xt=te/a,At={data1:ze,data2:$e,startPTS:_t,endPTS:xt,startDTS:_t,endDTS:xt,type:"audio",hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,At}}function Zi(o,e){let t;if(e===null)return o;for(e<o?t=-8589934592:t=8589934592;Math.abs(o-e)>4294967296;)o+=t;return o}function cu(o){for(let e=0;e<o.length;e++)if(o[e].key)return e;return-1}function Ka(o,e,t,i){const r=o.samples.length;if(!r)return;const n=o.inputTimeScale;for(let u=0;u<r;u++){const g=o.samples[u];g.pts=Zi(g.pts-t.baseTime*n/t.timescale,e*n)/n,g.dts=Zi(g.dts-i.baseTime*n/i.timescale,e*n)/n}const a=o.samples;return o.samples=[],{samples:a}}function za(o,e,t){const i=o.samples.length;if(!i)return;const r=o.inputTimeScale;for(let a=0;a<i;a++){const u=o.samples[a];u.pts=Zi(u.pts-t.baseTime*r/t.timescale,e*r)/r}o.samples.sort((a,u)=>a.pts-u.pts);const n=o.samples;return o.samples=[],{samples:n}}class hu extends T{constructor(e,t,i,r){super("passthrough-remuxer",r),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}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:n,video:a}=this.initData=Fe(e);if(t)Ye(e,t);else{const g=n||a;g!=null&&g.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${g.codec}")!`)}n&&(i=Va(n,V.AUDIO,this)),a&&(r=Va(a,V.VIDEO,this));const u={};n&&a?u.audiovideo={container:"video/mp4",codec:i+","+r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:n?u.audio={container:"audio/mp4",codec:i,encrypted:n.encrypted,initSegment:e,id:"audio"}:a?u.video={container:"video/mp4",codec:r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=u}remux(e,t,i,r,n,a){var u,g;let{initPTS:p,lastEndTime:m}=this;const S={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};I(m)||(m=this.lastEndTime=n||0);const R=t.samples;if(!R.length)return S;const H={initPTS:void 0,timescale:void 0,trackId:void 0};let j=this.initData;if((u=j)!=null&&u.length||(this.generateInitSegment(R),j=this.initData),!((g=j)!=null&&g.length))return this.warn("Failed to generate initSegment."),S;this.emitInitSegment&&(H.tracks=this.initTracks,this.emitInitSegment=!1);const Q=Qe(R,j,this),Y=j.audio?Q[j.audio.id]:null,te=j.video?Q[j.video.id]:null,ce=qn(te,1/0),ae=qn(Y,1/0),Ee=qn(te,0,!0),Te=qn(Y,0,!0);let $e=n,xe=0;const Ie=Y&&(!te||!p&&ae<ce||p&&p.trackId===j.audio.id),Pe=Ie?Y:te;if(Pe){const vt=Pe.timescale,Tt=Pe.start-n*vt,Mt=Ie?j.audio.id:j.video.id;$e=Pe.start/vt,xe=Ie?Te-ae:Ee-ce,(a||!p)&&(fu(p,$e,n,xe)||vt!==p.timescale)&&(p&&this.warn(`Timestamps at playlist time: ${a?"":"~"}${n} ${Tt/vt} != initPTS: ${p.baseTime/p.timescale} (${p.baseTime}/${p.timescale}) trackId: ${p.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${$e-n} (${Tt}/${vt}) trackId: ${Mt}`),p=null,H.initPTS=Tt,H.timescale=vt,H.trackId=Mt)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${n}`);p?(H.initPTS=p.baseTime,H.timescale=p.timescale,H.trackId=p.trackId):((!H.timescale||H.trackId===void 0||H.initPTS===void 0)&&(this.warn("Could not set initPTS"),H.initPTS=$e,H.timescale=1,H.trackId=-1),this.initPTS=p={baseTime:H.initPTS,timescale:H.timescale,trackId:H.trackId});const Ae=$e-p.baseTime/p.timescale,ze=Ae+xe;xe>0?this.lastEndTime=ze:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const _t=!!j.audio,xt=!!j.video;let kt="";_t&&(kt+="audio"),xt&&(kt+="video");const At=(j.audio?j.audio.encrypted:!1)||(j.video?j.video.encrypted:!1),ut={data1:R,startPTS:Ae,startDTS:Ae,endPTS:ze,endDTS:ze,type:kt,hasAudio:_t,hasVideo:xt,nb:1,dropped:0,encrypted:At};S.audio=_t&&!xt?ut:void 0,S.video=xt?ut:void 0;const Ct=te==null?void 0:te.sampleCount;if(Ct){const vt=te.keyFrameIndex,Tt=vt!==-1;ut.nb=Ct,ut.dropped=vt===0||this.isVideoContiguous?0:Tt?vt:Ct,ut.independent=Tt,ut.firstKeyFrame=vt,Tt&&te.keyFrameStart&&(ut.firstKeyFramePTS=(te.keyFrameStart-p.baseTime)/p.timescale),this.isVideoContiguous||(S.independent=Tt),this.isVideoContiguous||(this.isVideoContiguous=Tt),ut.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${vt}/${Ct} dropped: ${ut.dropped} start: ${ut.firstKeyFramePTS||"NA"}`)}return S.initSegment=H,S.id3=Ka(i,n,p,p),r.samples.length&&(S.text=za(r,n,p)),S}}function qn(o,e,t=!1){return(o==null?void 0:o.start)!==void 0?(o.start+(t?o.duration:0))/o.timescale:e}function fu(o,e,t,i){if(o===null)return!0;const r=Math.max(i,1),n=e-o.baseTime/o.timescale;return Math.abs(n-t)>r}function Va(o,e,t){const i=o.codec;return i&&i.length>4?i:e===V.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?oe(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 Ir;try{Ir=self.performance.now.bind(self.performance)}catch(o){Ir=Date.now}const Yn=[{demux:Xl,remux:hu},{demux:jr,remux:Vn},{demux:Vl,remux:Vn},{demux:Yl,remux:Vn}];Yn.splice(2,0,{demux:ql,remux:Vn});class qa{constructor(e,t,i,r,n,a){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=n,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const n=i.transmuxing;n.executeStart=Ir();let a=new Uint8Array(e);const{currentTransmuxState:u,transmuxConfig:g}=this;r&&(this.currentTransmuxState=r);const{contiguous:p,discontinuity:m,trackSwitch:S,accurateTimeOffset:R,timeOffset:H,initSegmentChange:j}=r||u,{audioCodec:Q,videoCodec:Y,defaultInitPts:te,duration:ce,initSegmentData:ae}=g,Ee=du(a,t);if(Ee&&hr(Ee.method)){const Ie=this.getDecrypter(),Pe=Ri(Ee.method);if(Ie.isSync()){let Ae=Ie.softwareDecrypt(a,Ee.key.buffer,Ee.iv.buffer,Pe);if(i.part>-1){const _t=Ie.flush();Ae=_t&&_t.buffer}if(!Ae)return n.executeEnd=Ir(),Ts(i);a=new Uint8Array(Ae)}else return this.asyncResult=!0,this.decryptionPromise=Ie.webCryptoDecrypt(a,Ee.key.buffer,Ee.iv.buffer,Pe).then(Ae=>{const ze=this.push(Ae,null,i);return this.decryptionPromise=null,ze}),this.decryptionPromise}const Te=this.needsProbing(m,S);if(Te){const Ie=this.configureTransmuxer(a);if(Ie)return this.logger.warn(`[transmuxer] ${Ie.message}`),this.observer.emit(_.ERROR,_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:Ie,reason:Ie.message}),n.executeEnd=Ir(),Ts(i)}(m||S||j||Te)&&this.resetInitSegment(ae,Q,Y,ce,t),(m||j||Te)&&this.resetInitialTimestamp(te),p||this.resetContiguity();const $e=this.transmux(a,Ee,H,R,i);this.asyncResult=Bn($e);const xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,n.executeEnd=Ir(),$e}flush(e){const t=e.transmuxing;t.executeStart=Ir();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return this.asyncResult=!0,n.then(()=>this.flush(e));const a=[],{timeOffset:u}=r;if(i){const S=i.flush();S&&a.push(this.push(S.buffer,null,e))}const{demuxer:g,remuxer:p}=this;if(!g||!p){t.executeEnd=Ir();const S=[Ts(e)];return this.asyncResult?Promise.resolve(S):S}const m=g.flush(u);return Bn(m)?(this.asyncResult=!0,m.then(S=>(this.flushRemux(a,S,e),a))):(this.flushRemux(a,m,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:a,textTrack:u}=t,{accurateTimeOffset:g,timeOffset:p}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===v.MAIN?"level":"track"} ${i.level}`);const m=this.remuxer.remux(r,n,a,u,p,g,!0,this.id);e.push({remuxResult:m,chunkMeta:i}),i.transmuxing.executeEnd=Ir()}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,r,n){const{demuxer:a,remuxer:u}=this;!a||!u||(a.resetInitSegment(e,t,i,r),u.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,i,r,n):a=this.transmuxUnencrypted(e,i,r,n),a}transmuxUnencrypted(e,t,i,r){const{audioTrack:n,videoTrack:a,id3Track:u,textTrack:g}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,a,u,g,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r}=this;let n;for(let S=0,R=Yn.length;S<R;S++){var a;if((a=Yn[S].demux)!=null&&a.probe(e,this.logger)){n=Yn[S];break}}if(!n)return new Error("Failed to find demuxer by probing fragment data");const u=this.demuxer,g=this.remuxer,p=n.remux,m=n.demux;(!g||!(g instanceof p))&&(this.remuxer=new p(i,t,r,this.logger)),(!u||!(u instanceof m))&&(this.demuxer=new m(i,t,r,this.logger),this.probe=m.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Mr(this.config)),e}}function du(o,e){let t=null;return o.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Ts=o=>({remuxResult:{},chunkMeta:o});function Bn(o){return"then"in o&&o.then instanceof Function}class pu{constructor(e,t,i,r,n){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=r,this.defaultInitPts=n||null}}class _u{constructor(e,t,i,r,n,a){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=r,this.timeOffset=n,this.initSegmentChange=a}}let Ya=0;class Za{constructor(e,t,i,r){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=g=>{const p=g.data,m=this.hls;if(!(!m||!(p!=null&&p.event)||p.instanceNo!==this.instanceNo))switch(p.event){case"init":{var S;const R=(S=this.workerContext)==null?void 0:S.objectURL;R&&self.URL.revokeObjectURL(R);break}case"transmuxComplete":{this.handleTransmuxComplete(p.data);break}case"flush":{this.onFlush(p.data);break}case"workerLog":{m.logger[p.data.logType]&&m.logger[p.data.logType](p.data.message);break}default:{p.data=p.data||{},p.data.frag=this.frag,p.data.part=this.part,p.data.id=this.id,m.trigger(p.event,p.data);break}}},this.onWorkerError=g=>{if(!this.hls)return;const p=new Error(`${g.message} (${g.filename}:${g.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:p})};const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const a=(g,p)=>{p=p||{},p.frag=this.frag||void 0,g===_.ERROR&&(p=p,p.parent=this.id,p.part=this.part,this.error=p.error),this.hls.trigger(g,p)};this.observer=new _s,this.observer.on(_.FRAG_DECRYPTED,a),this.observer.on(_.ERROR,a);const u=gt(n.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const g=this.hls.logger;if(n.workerPath||yl()){try{n.workerPath?(g.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=El(n.workerPath)):(g.log(`injecting Web Worker for "${t}"`),this.workerContext=bl());const{worker:m}=this.workerContext;m.addEventListener("message",this.onWorkerMessage),m.addEventListener("error",this.onWorkerError),m.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:u,id:t,config:Ft(n)})}catch(m){g.warn(`Error setting up "${t}" Web Worker, fallback to inline`,m),this.terminateWorker(),this.error=null,this.transmuxer=new qa(this.observer,u,n,"",t,e.logger)}return}}this.transmuxer=new qa(this.observer,u,n,"",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=gt(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:Ft(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),Sl(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,r,n,a,u,g,p,m){var S,R;p.transmuxing.start=self.performance.now();const{instanceNo:H,transmuxer:j}=this,Q=a?a.start:n.start,Y=n.decryptdata,te=this.frag,ce=!(te&&n.cc===te.cc),ae=!(te&&p.level===te.level),Ee=te?p.sn-te.sn:-1,Te=this.part?p.part-this.part.index:-1,$e=Ee===0&&p.id>1&&p.id===(te==null?void 0:te.stats.chunkCount),xe=!ae&&(Ee===1||Ee===0&&(Te===1||$e&&Te<=0)),Ie=self.performance.now();(ae||Ee||n.stats.parsing.start===0)&&(n.stats.parsing.start=Ie),a&&(Te||!xe)&&(a.stats.parsing.start=Ie);const Pe=!(te&&((S=n.initSegment)==null?void 0:S.url)===((R=te.initSegment)==null?void 0:R.url)),Ae=new _u(ce,xe,g,ae,Q,Pe);if(!xe||ce||Pe){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${n.type} sn: ${p.sn}${p.part>-1?" part: "+p.part:""} ${this.id===v.MAIN?"level":"track"}: ${p.level} id: ${p.id}
|
|
|
discontinuity: ${ce}
|
|
|
trackSwitch: ${ae}
|
|
|
contiguous: ${xe}
|
|
|
accurateTimeOffset: ${g}
|
|
|
timeOffset: ${Q}
|
|
|
initSegmentChange: ${Pe}`);const ze=new pu(i,r,t,u,m);this.configureTransmuxer(ze)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:H,cmd:"demux",data:e,decryptdata:Y,chunkMeta:p,state:Ae},e instanceof ArrayBuffer?[e]:[]);else if(j){const ze=j.push(e,Y,p,Ae);Bn(ze)?ze.then(_t=>{this.handleTransmuxComplete(_t)}).catch(_t=>{this.transmuxerError(_t,p,"transmuxer-interface push error")}):this.handleTransmuxComplete(ze)}}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 r=i.flush(e);Bn(r)?r.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")}):this.handleFlushResult(r,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.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 gu extends ds{constructor(e,t,i){super(e,t,i,"audio-stream-controller",v.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(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n,trackId:a}){if(i===v.MAIN){const u=t.cc,g=this.fragCurrent;if(this.initPTS[u]={baseTime:r,timescale:n,trackId:a},this.log(`InitPTS for cc: ${u} found from main: ${r/n} (${r}/${n}) trackId: ${a}`),this.mainAnchor=t,this.state===qe.WAITING_INIT_PTS){const p=this.waitingData;(!p&&!this.loadingParts||p&&p.frag.cc!==u)&&this.syncWithAnchor(t,p==null?void 0:p.frag)}else!this.hls.hasEnoughToStart&&g&&g.cc!==u?(g.abortRequests(),this.syncWithAnchor(t,g)):this.state===qe.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const r=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&(r==null?void 0:r.cc)===t.cc)return;const n=(r||e).cc,a=this.getLevelDetails(),u=this.getLoadPosition(),g=$i(a,n,u);g&&(this.log(`Syncing with main frag at ${g.start} cc ${g.cc}`),this.startFragRequested=!1,this.nextLoadPosition=g.start,this.resetLoadingState(),this.state===qe.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=qe.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=qe.IDLE):this.state=qe.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case qe.IDLE:this.doTickIdle();break;case qe.WAITING_TRACK:{const{levels:e,trackId:t}=this,i=e==null?void 0:e[t],r=i==null?void 0:i.details;if(r&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(r))break;this.state=qe.WAITING_INIT_PTS}break}case qe.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case qe.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:r,complete:n}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=qe.FRAG_LOADING;const u=r.flush().buffer,g={frag:t,part:i,payload:u,networkDetails:null};this._handleFragmentLoadProgress(g),n&&super._handleFragmentLoadComplete(g)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=qe.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:r,trackId:n}=this,a=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(i!=null&&i[n]))return;const u=i[n],g=u.details;if(!g||this.waitForLive(u)||this.waitForCdnTuneIn(g)){this.state=qe.WAITING_TRACK,this.startFragRequested=!1;return}const p=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&p&&(this.bufferFlushed=!1,this.afterBufferFlushed(p,V.AUDIO,v.AUDIO));const m=this.getFwdBufferInfo(p,v.AUDIO);if(m===null)return;if(!this.switchingTrack&&this._streamEnded(m,g)){t.trigger(_.BUFFER_EOS,{type:"audio"}),this.state=qe.ENDED;return}const S=m.len,R=t.maxBufferLength,H=g.fragments,j=H[0].start,Q=this.getLoadPosition(),Y=this.flushing?Q:m.end;if(this.switchingTrack&&r){const ae=Q;g.PTSKnown&&ae<j&&(m.end>j||m.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=j+.05)}if(S>=R&&!this.switchingTrack&&Y<H[H.length-1].start)return;let te=this.getNextFragment(Y,g);if(te&&this.isLoopLoading(te,Y)&&(te=this.getNextFragmentLoopLoading(te,g,m,v.MAIN,R)),!te){this.bufferFlushed=!0;return}let ce=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&ce&&pe(te)&&!te.endList&&(!g.live||!this.loadingParts&&Y<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(ce)===ei.OK&&(this.mainFragLoading=ce=null),ce&&pe(ce))){if(te.start>ce.end){const Ee=this.fragmentTracker.getFragAtPos(Y,v.MAIN);Ee&&Ee.end>ce.end&&(ce=Ee,this.mainFragLoading={frag:Ee,targetBufferTime:null})}if(te.start>ce.end)return}this.loadFragment(te,u,Y)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new Si(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==qe.STOPPED&&(this.setInterval(Xa),this.state=qe.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(_.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:r}=this,{details:n,id:a,groupId:u,track:g}=t;if(!r){this.warn(`Audio tracks reset while loading track ${a} "${g.name}" of "${u}"`);return}const p=this.mainDetails;if(!p||n.endCC>p.endCC||p.expired){this.cachedTrackLoadedData=t,this.state!==qe.STOPPED&&(this.state=qe.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${g.name}" of "${u}" loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const m=r[a];let S=0;if(n.live||(i=m.details)!=null&&i.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;if(m.details){var R;S=this.alignPlaylists(n,m.details,(R=this.levelLastLoaded)==null?void 0:R.details)}n.alignedSliding||(wa(n,p),n.alignedSliding||jn(n,p),S=n.fragmentStart)}m.details=n,this.levelLastLoaded=m,this.startFragRequested||this.setStartPosition(p,S),this.hls.trigger(_.AUDIO_TRACK_UPDATED,{details:n,id:a,groupId:t.groupId}),this.state===qe.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=qe.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:r,payload:n}=e,{config:a,trackId:u,levels:g}=this;if(!g){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 p=g[u];if(!p){this.warn("Audio track is undefined on fragment load progress");return}const m=p.details;if(!m){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const S=a.defaultAudioCodec||p.audioCodec||"mp4a.40.2";let R=this.transmuxer;R||(R=this.transmuxer=new Za(this.hls,v.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const H=this.initPTS[i.cc],j=(t=i.initSegment)==null?void 0:t.data;if(H!==void 0){const Y=r?r.index:-1,te=Y!==-1,ce=new Fi(i.level,i.sn,i.stats.chunkCount,n.byteLength,Y,te);R.push(n,j,S,"",i,r,m.totalduration,!1,ce,H)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${m.startSN} ,${m.endSN}],track ${u}`);const{cache:Q}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new Aa,complete:!1};Q.push(new Uint8Array(n)),this.state!==qe.STOPPED&&(this.state=qe.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===v.MAIN&&pe(t.frag)&&(this.mainFragLoading=t,this.state===qe.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==v.AUDIO){!this.audioOnly&&i.type===v.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(pe(i)){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(_.AUDIO_TRACK_SWITCHED,h({},n)))}this.fragBufferedComplete(i,r),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=qe.ERROR;return}switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(v.AUDIO,t);break;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===qe.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===F.AUDIO_TRACK&&(this.state=qe.IDLE);break;case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case w.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==V.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==V.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===qe.ENDED&&(this.state=qe.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,v.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:a}=e,u=this.getCurrentContext(a);if(!u){this.resetWhenMissingContext(a);return}const{frag:g,part:p,level:m}=u,{details:S}=m,{audio:R,text:H,id3:j,initSegment:Q}=n;if(this.fragContextChanged(g)||!S){this.fragmentTracker.removeFragment(g);return}if(this.state=qe.PARSING,this.switchingTrack&&R&&this.completeAudioSwitch(this.switchingTrack),Q!=null&&Q.tracks){const Y=g.initSegment||g;if(this.unhandledEncryptionError(Q,g))return;this._bufferInitSegment(m,Q.tracks,Y,a),r.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:Y,id:i,tracks:Q.tracks})}if(R){const{startPTS:Y,endPTS:te,startDTS:ce,endDTS:ae}=R;p&&(p.elementaryStreams[V.AUDIO]={startPTS:Y,endPTS:te,startDTS:ce,endDTS:ae}),g.setElementaryStreamInfo(V.AUDIO,Y,te,ce,ae),this.bufferFragmentData(R,g,p,a)}if(j!=null&&(t=j.samples)!=null&&t.length){const Y=c({id:i,frag:g,details:S},j);r.trigger(_.FRAG_PARSING_METADATA,Y)}if(H){const Y=c({id:i,frag:g,details:S},H);r.trigger(_.FRAG_PARSING_USERDATA,Y)}}_bufferInitSegment(e,t,i,r){if(this.state!==qe.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const n=t.audio;n.id=v.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(_.BUFFER_CODECS,t);const u=n.initSegment;if(u!=null&&u.byteLength){const g={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:u};this.hls.trigger(_.BUFFER_APPENDING,g)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===ei.NOT_LOADED||r===ei.PARTIAL){var n;if(!pe(e))this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.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=qe.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&jn(t.details,a)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:r,characteristics:n,audioCodec:a,channels:u}=this.bufferedTrack;pi({name:t,lang:i,assocLang:r,characteristics:n,audioCodec:a,channels:u},e,Ji)||(Er(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(_.AUDIO_TRACK_SWITCHED,h({},e))}}class Ds extends T{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 r=t==null?void 0:t.renditionReports;if(r){let n=-1;for(let a=0;a<r.length;a++){const u=r[a];let g;try{g=new self.URL(u.URI,t.url).href}catch(p){this.warn(`Could not construct new URL for Rendition Report: ${p}`),g=u.URI||""}if(g===e){n=a;break}else g===e.substring(0,g.length)&&(n=a)}if(n!==-1){const a=r[n],u=parseInt(a["LAST-MSN"])||t.lastPartSn;let g=parseInt(a["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const m=Math.min(t.age-t.partTarget,t.targetduration);g>=0&&m>t.partTarget&&(g+=1)}const p=i&&Ei(i);return new jt(u,g>=0?g:void 0,p)}}}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:r,stats:n}=t,a=self.performance.now(),u=n.loading.first?Math.max(0,a-n.loading.first):0;r.advancedDateTime=Date.now()-u;const g=this.hls.config.timelineOffset;if(g!==r.appliedTimelineOffset){const m=Math.max(g||0,0);r.appliedTimelineOffset=m,r.fragments.forEach(S=>{S.setStart(S.playlistOffset+m)})}if(r.live||i!=null&&i.live){const m="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(i),i&&r.fragments.length>0){ll(i,r,this);const ce=r.playlistParsingError;if(ce){this.warn(ce);const ae=this.hls;if(!ae.config.ignorePlaylistParsingErrors){var p;const{networkDetails:Ee}=t;ae.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:ce,reason:ce.message,level:t.level||void 0,parent:(p=r.fragments[0])==null?void 0:p.type,networkDetails:Ee,stats:n});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=n.loading.start);const S=this.hls.mainForwardBufferInfo,R=S?S.end-S.len:0,H=(r.edge-R)*1e3,j=_a(r,H);if(r.requestScheduled+j<a?r.requestScheduled=a:r.requestScheduled+=j,this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),!this.canLoad||!r.live)return;let Q,Y,te;if(r.canBlockReload&&r.endSN&&r.advanced){const ce=this.hls.config.lowLatencyMode,ae=r.lastPartSn,Ee=r.endSN,Te=r.lastPartIndex,$e=Te!==-1,xe=ae===Ee;$e?xe?(Y=Ee+1,te=ce?0:Te):(Y=ae,te=ce?Te+1:r.maxPartIndex):Y=Ee+1;const Ie=r.age,Pe=Ie+r.ageHeader;let Ae=Math.min(Pe-r.partTarget,r.targetduration*1.5);if(Ae>0){if(Pe>r.targetduration*3)this.log(`Playlist last advanced ${Ie.toFixed(2)}s ago. Omitting segment and part directives.`),Y=void 0,te=void 0;else if(i!=null&&i.tuneInGoal&&Pe-r.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${Ae} with playlist age: ${r.age}`),Ae=0;else{const ze=Math.floor(Ae/r.targetduration);if(Y+=ze,te!==void 0){const _t=Math.round(Ae%r.targetduration/r.partTarget);te+=_t}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${Ie.toFixed(2)}s goal: ${Ae} skip sn ${ze} to part ${te}`)}r.tuneInGoal=Ae}if(Q=this.getDeliveryDirectives(r,t.deliveryDirectives,Y,te),ce||!xe){r.requestScheduled=a,this.loadingPlaylist(m,Q);return}}else(r.canBlockReload||r.canSkipUntil)&&(Q=this.getDeliveryDirectives(r,t.deliveryDirectives,Y,te));Q&&Y!==void 0&&r.canBlockReload&&(r.requestScheduled=n.loading.first+Math.max(j-u*2,j/2)),this.scheduleLoading(m,Q,r)}else this.clearTimer()}scheduleLoading(e,t,i){const r=i||e.details;if(!r){this.loadingPlaylist(e,t);return}const n=self.performance.now(),a=r.requestScheduled;if(n>=a){this.loadingPlaylist(e,t);return}const u=a-n;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(u)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),u)}getDeliveryDirectives(e,t,i,r){let n=Ei(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=ii.No),new jt(i,r,n)}checkRetry(e){const t=e.details,i=Vi(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:u}=r||{},g=!!r&&!!u&&(n===ci.RetryRequest||!r.resolved&&n===ci.SendAlternateToPenaltyBox);if(g){var p;if(a>=u.maxNumRetry)return!1;if(i&&(p=e.context)!=null&&p.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${u.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const m=Or(u,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),m),this.warn(`Retrying playlist loading ${a+1}/${u.maxNumRetry} after "${t}" in ${m}ms`)}e.levelRetry=!0,r.resolved=!0}return g}}function Qa(o,e){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(!Nn(o[t].attrs,e[t].attrs))return!1;return!0}function Nn(o,e,t){const i=o["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>o[r]!==e[r])}function Ls(o,e){return e.label.toLowerCase()===o.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(o.lang||"").toLowerCase())}class mu extends Ds{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.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:r,details:n}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==r){this.warn(`Audio track with id:${i} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const u=a.details;a.details=t.details,this.log(`Audio track ${i} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,u)}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,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(u=>(r==null?void 0:r.indexOf(u))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const u=this.tracks.filter(R=>!i||i.indexOf(R.groupId)!==-1);if(u.length)this.selectDefaultTrack&&!u.some(R=>R.default)&&(this.selectDefaultTrack=!1),u.forEach((R,H)=>{R.id=H});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=u;const g=this.hls.config.audioPreference;if(!n&&g){const R=Ci(g,u,Ji);if(R>-1)n=u[R];else{const H=Ci(g,this.tracks);n=this.tracks[H]}}let p=this.findTrackId(n);p===-1&&n&&(p=this.findTrackId(null));const m={audioTracks:u};this.log(`Updating audio tracks, ${u.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(_.AUDIO_TRACKS_UPDATED,m);const S=this.trackId;if(p!==-1&&S===-1)this.setAudioTrack(p);else if(u.length&&S===-1){var a;const R=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${u.length}`);this.warn(R.message),this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:R})}}}onError(e,t){t.fatal||!t.context||t.context.type===F.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 r=this.currentTrack;if(r&&pi(e,r,Ji))return r;const n=Ci(e,this.tracksInGroup,Ji);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(r){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const u=sn(e,t.levels,i,a,Ji);if(u===-1)return null;t.nextLoadLevel=u}if(e.channels||e.audioCodec){const a=Ci(e,i);if(a>-1)return i[a]}}}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,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===i&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(_.AUDIO_TRACK_SWITCHING,h({},r)),n))return;const a=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(!(this.selectDefaultTrack&&!r.default)&&(!e||pi(e,r,Ji)))return i}if(e){const{name:i,lang:r,assocLang:n,characteristics:a,audioCodec:u,channels:g}=e;for(let p=0;p<t.length;p++){const m=t[p];if(pi({name:i,lang:r,assocLang:n,characteristics:a,audioCodec:u,channels:g},m,Ji))return p}for(let p=0;p<t.length;p++){const m=t[p];if(Nn(e.attrs,m.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return p}for(let p=0;p<t.length;p++){const m=t[p];if(Nn(e.attrs,m.attrs,["LANGUAGE"]))return p}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Er(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,u=a==null?void 0:a.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${u&&a.live?" age "+u.toFixed(1)+(a.type?" "+a.type||0:""):""} ${n}`),this.hls.trigger(_.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:t||null,track:e})}}class vu{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 r=this.queues[t];r.push(e),r.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 r=t[0];try{r.execute()}catch(n){var i;if(r.onError(n),this.queues===null||this.tracks===null)return;const a=(i=this.tracks[e])==null?void 0:i.buffer;a!=null&&a.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],r=i==null?void 0:i.buffer;return r?`SourceBuffer${r.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 yu extends Error{constructor(e){super(e),this.name=eo}}class bu extends T{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 r;this.hls&&((r=this.mediaSource)==null?void 0:r.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:r,mediaSource:n}=this;i&&this.log("Media source opened"),!(!r||!n)&&(n.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(_.MEDIA_ATTACHED,{media:r,mediaSource:n}),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:r}=this;i!==r&&this.error(`Media element src was set while attaching MediaSource (${r} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=q(Z(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(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_APPENDING,this.onBufferAppending,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.BUFFER_EOS,this.onBufferEos,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.FRAG_PARSED,this.onFragParsed,this),e.on(_.FRAG_CHANGED,this.onFragChanged,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_APPENDING,this.onBufferAppending,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.BUFFER_EOS,this.onBufferEos,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.FRAG_PARSED,this.onFragParsed,this),e.off(_.FRAG_CHANGED,this.onFragChanged,this),e.off(_.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const n=this.isUpdating();n||this.operationQueue.removeBlockers();const a=this.isQueued();(n||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${n?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?c(i,r.tracks):this.sourceBuffers.forEach(n=>{const[a]=n;a&&(i[a]=c({},this.tracks[a]),this.removeBuffer(a)),n[0]=n[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 r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const r=Z(this.appendSource);if(r){const n=!!t.mediaSource;(n||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(a),n)this._objectUrl=i.src,this.attachTransferred();else{const u=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{i.removeAttribute("src");const g=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||g&&a instanceof g,to(i),Eu(i,u),i.load()}catch(g){i.src=u}else i.src=u}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,r=t.tracks,n=r?Object.keys(r):null,a=n?n.length:0,u=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&n&&a){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: ${Ft(i,(g,p)=>g==="initSegment"?void 0:p)};
|
|
|
transfer tracks: ${Ft(r,(g,p)=>g==="initSegment"?void 0:p)}}`),!se(r,i)){t.mediaSource=null,t.tracks=void 0;const g=e.currentTime,p=this.details,m=Math.max(g,(p==null?void 0:p.fragments[0].start)||0);if(m-g>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${g} -> ${m}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(i)}") start time: ${m} currentTime: ${g}`),this.onMediaDetaching(_.MEDIA_DETACHING,{}),this.onMediaAttaching(_.MEDIA_ATTACHING,t),e.currentTime=m;return}this.transferData=void 0,n.forEach(g=>{const p=g,m=r[p];if(m){const S=m.buffer;if(S){const R=this.fragmentTracker,H=m.id;if(R.hasFragments(H)||R.hasParts(H)){const Y=It.getBuffered(S);R.detectEvictedFragments(p,Y,H,null,!0)}const j=Rs(p),Q=[p,S];this.sourceBuffers[j]=Q,S.updating&&this.operationQueue&&this.operationQueue.prependBlocker(p),this.trackSourceBuffer(p,m)}}}),u(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),u()}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:r,mediaSource:n,_objectUrl:a}=this;if(n){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([u])=>{u&&this.removeBuffer(u)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const u=n.readyState==="open";try{const g=n.sourceBuffers;for(let p=g.length;p--;)u&&g[p].abort(),n.removeSourceBuffer(g[p]);u&&n.endOfStream()}catch(g){this.warn(`onMediaDetaching: ${g.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),i||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(r.removeAttribute("src"),this.appendSource&&to(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(_.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 r;(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(n){this.warn(`onBufferReset ${e}`,n)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Rs(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new vu(this.tracks)}onBufferCodecs(e,t){const i=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const n="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),a=!n&&this.sourceBufferCount&&this.media&&r.some(u=>!i[u]);if(n||a){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${r}" SourceBuffers`);return}r.forEach(u=>{var g,p;const m=t[u],{id:S,codec:R,levelCodec:H,container:j,metadata:Q,supplemental:Y}=m;let te=i[u];const ce=(g=this.transferData)==null||(g=g.tracks)==null?void 0:g[u],ae=ce!=null&&ce.buffer?ce:te,Ee=(ae==null?void 0:ae.pendingCodec)||(ae==null?void 0:ae.codec),Te=ae==null?void 0:ae.levelCodec;te||(te=i[u]={buffer:void 0,listeners:[],codec:R,supplemental:Y,container:j,levelCodec:H,metadata:Q,id:S});const $e=de(Ee,Te),xe=$e==null?void 0:$e.replace(Ja,"$1");let Ie=de(R,H);const Pe=(p=Ie)==null?void 0:p.replace(Ja,"$1");Ie&&$e&&xe!==Pe&&(u.slice(0,5)==="audio"&&(Ie=oe(Ie,this.appendSource)),this.log(`switching codec ${Ee} to ${Ie}`),Ie!==(te.pendingCodec||te.codec)&&(te.pendingCodec=Ie),te.container=j,this.appendChangeType(u,j,Ie))}),(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 r=`${t};codecs=${i}`,n={label:`change-type=${r}`,execute:()=>{const a=this.tracks[e];if(a){const u=a.buffer;u!=null&&u.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),u.changeType(r),a.codec=i,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(n,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,r=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,v.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var u;const g=this.tracks.video;(this.lastVideoAppendEnd>r||g!=null&&g.buffer&&It.isBuffered(g.buffer,r)||((u=this.fragmentTracker.getAppendedFrag(r,v.MAIN))==null?void 0:u.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:u=>{this.warn("Error executing block-audio operation",u)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"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:r,type:n,parent:a,frag:u,part:g,chunkMeta:p,offset:m}=t,S=p.buffering[n],{sn:R,cc:H}=u,j=self.performance.now();S.start=j;const Q=u.stats.buffering,Y=g?g.stats.buffering:null;Q.start===0&&(Q.start=j),Y&&Y.start===0&&(Y.start=j);const te=i.audio;let ce=!1;n==="audio"&&(te==null?void 0:te.container)==="audio/mpeg"&&(ce=!this.lastMpegAudioChunk||p.id===1||this.lastMpegAudioChunk.sn!==p.sn,this.lastMpegAudioChunk=p);const ae=i.video,Ee=ae==null?void 0:ae.buffer;if(Ee&&R!=="initSegment"){const xe=g||u,Ie=this.blockedAudioAppend;if(n==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(ae.ending||ae.ended)){const Ae=xe.start+xe.duration*.05,ze=Ee.buffered,_t=this.currentOp("video");!ze.length&&!_t?this.blockAudio(xe):!_t&&!It.isBuffered(Ee,Ae)&&this.lastVideoAppendEnd<Ae&&this.blockAudio(xe)}else if(n==="video"){const Pe=xe.end;if(Ie){const Ae=Ie.frag.start;(Pe>Ae||Pe<this.lastVideoAppendEnd||It.isBuffered(Ee,Ae))&&this.unblockAudio()}this.lastVideoAppendEnd=Pe}}const Te=(g||u).start,$e={label:`append-${n}`,execute:()=>{var xe;S.executeStart=self.performance.now();const Ie=(xe=this.tracks[n])==null?void 0:xe.buffer;Ie&&(ce?this.updateTimestampOffset(Ie,Te,.1,n,R,H):m!==void 0&&I(m)&&this.updateTimestampOffset(Ie,m,1e-6,n,R,H)),this.appendExecutor(r,n)},onStart:()=>{},onComplete:()=>{const xe=self.performance.now();S.executeEnd=S.end=xe,Q.first===0&&(Q.first=xe),Y&&Y.first===0&&(Y.first=xe);const Ie={};this.sourceBuffers.forEach(([Pe,Ae])=>{Pe&&(Ie[Pe]=It.getBuffered(Ae))}),this.appendErrors[n]=0,n==="audio"||n==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(_.BUFFER_APPENDED,{type:n,frag:u,part:g,chunkMeta:p,parent:u.type,timeRanges:Ie})},onError:xe=>{var Ie;const Pe={type:D.MEDIA_ERROR,parent:u.type,details:w.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:u,part:g,chunkMeta:p,error:xe,err:xe,fatal:!1},Ae=(Ie=this.media)==null?void 0:Ie.error;if(xe.code===DOMException.QUOTA_EXCEEDED_ERR||xe.name=="QuotaExceededError"||"quota"in xe)Pe.details=w.BUFFER_FULL_ERROR;else if(xe.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Ae)Pe.errorAction=tr(!0);else if(xe.name===eo&&this.sourceBufferCount===0)Pe.errorAction=tr(!0);else{const ze=++this.appendErrors[n];this.warn(`Failed ${ze}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer (${Ae||"no media error"})`),(ze>=this.hls.config.appendErrorMaxRetry||Ae)&&(Pe.fatal=!0)}this.hls.trigger(_.ERROR,Pe)}};this.append($e,n,this.isPending(this.tracks[n]))}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(_.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){const{type:i,startOffset:r,endOffset:n}=t;i?this.append(this.getFlushOp(i,r,n),i):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,r,n),a)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],a=r?r.elementaryStreams:i.elementaryStreams;a[V.AUDIOVIDEO]?n.push("audiovideo"):(a[V.AUDIO]&&n.push("audio"),a[V.VIDEO]&&n.push("video"));const u=()=>{const g=self.performance.now();i.stats.buffering.end=g,r&&(r.stats.buffering.end=g);const p=r?r.stats:i.stats;this.hls.trigger(_.FRAG_BUFFERED,{frag:i,part:r,stats:p,id:i.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(u,n).catch(g=>{this.warn(`Fragment buffered callback ${g}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([a])=>{if(a){const u=this.tracks[a];(!t.type||t.type===a)&&(u.ending=!0,u.ended||(u.ended=!0,this.log(`${a} buffer reached EOS`)))}});const r=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var u;return a&&!((u=this.tracks[a])!=null&&u.ended)})?r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(_.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(_.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}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(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===w.BUFFER_APPEND_ERROR&&t.frag){var i;const r=(i=t.errorAction)==null?void 0:i.nextAutoLevel;I(r)&&r!==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 r=e.config,n=i.currentTime,a=t.levelTargetDuration,u=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(I(u)&&u>=0){const p=Math.max(u,a),m=Math.floor(n/a)*a-p;this.flushBackBuffer(n,a,m)}const g=r.frontBufferFlushThreshold;if(I(g)&&g>0){const p=Math.max(r.maxBufferLength,g),m=Math.max(p,a),S=Math.floor(n/a)*a+m;this.flushFrontBuffer(n,a,S)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([r,n])=>{if(n){const u=It.getBuffered(n);if(u.length>0&&i>u.start(0)){var a;this.hls.trigger(_.BACK_BUFFER_REACHED,{bufferEnd:i});const g=this.tracks[r];if((a=this.details)!=null&&a.live)this.hls.trigger(_.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(g!=null&&g.ended){this.log(`Cannot flush ${r} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:r})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([r,n])=>{if(n){const a=It.getBuffered(n),u=a.length;if(u<2)return;const g=a.start(u-1),p=a.end(u-1);if(i>g||e>=g&&e<=p)return;this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:g,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||(i==null?void 0:i.readyState)!=="open")return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const p=Math.max(0,t.fragmentStart),m=Math.max(p,r);return{duration:1/0,start:p,end:m}}return{duration:1/0}}const n=(e=this.overrides)==null?void 0:e.duration;if(n)return I(n)?{duration:n}:null;const a=this.media.duration,u=I(i.duration)?i.duration:0;return r>u&&r>a||!I(a)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:i}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(I(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${i}.`),r.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}) ${Ft(i)}`),this.tracksReady){var r;const n=(r=this.transferData)==null?void 0:r.tracks;n&&Object.keys(n).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const r=this.tracks[t];e[t]={buffer:i,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(_.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(_.ERROR,{type:D.MEDIA_ERROR,details:w.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 n in e){const a=n,u=e[a];if(this.isPending(u)){const g=this.getTrackCodec(u,a),p=`${u.container};codecs=${g}`;u.codec=g,this.log(`creating sourceBuffer(${p})${this.currentOp(a)?" Queued":""} ${Ft(u)}`);try{const m=i.addSourceBuffer(p),S=Rs(a),R=[a,m];t[S]=R,u.buffer=m}catch(m){var r;this.error(`error while trying to add sourceBuffer: ${m.message}`),this.shiftAndExecuteNext(a),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[a],this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:m,sourceBufferName:a,mimeType:p,parent:u.id});return}this.trackSourceBuffer(a,u)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let r=e.codec;i&&(t==="video"||t==="audiovideo")&&Nt(i,"video")&&(r=he(r,i));const n=de(r,e.levelCodec);return n?t.slice(0,5)==="audio"?oe(n,this.appendSource):n:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const r=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:r,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",(n,a)=>{const u=a.removedRanges;u!=null&&u.length&&this.hls.trigger(_.BUFFER_FLUSHED,{type:n})})}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 r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${r}`,t),this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.currentOp(e);n&&n.onError(r)}updateTimestampOffset(e,t,i,r,n,a){const u=t-e.timestampOffset;Math.abs(u)>=i&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${n} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:r,mediaSource:n}=this,a=this.tracks[e],u=a==null?void 0:a.buffer;if(!r||!n||!u){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const g=I(r.duration)?r.duration:1/0,p=I(n.duration)?n.duration:1/0,m=Math.max(0,t),S=Math.min(i,g,p);S>m&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${m},${S}] from the ${e} SourceBuffer`),u.remove(m,S)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],r=i==null?void 0:i.buffer;if(!r)throw new yu(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,r.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,r=t.map(a=>this.appendBlocker(a));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(a=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const r=(i=this.tracks[t])==null?void 0:i.buffer;!r||r.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 r=this.tracks[e];if(!r)return;const n=r.buffer;if(!n)return;const a=i.bind(this,e);r.listeners.push({event:t,listener:a}),n.addEventListener(t,a)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(r=>{i.removeEventListener(r.event,r.listener)}),t.listeners.length=0)}}function to(o){const e=o.querySelectorAll("source");[].slice.call(e).forEach(t=>{o.removeChild(t)})}function Eu(o,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,o.appendChild(t)}function Rs(o){return o==="audio"?1:0}class ks{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(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.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&&I(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((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,ks.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 r=(u,g)=>g?u.width!==g.width||u.height!==g.height:!0;let n=e.length-1;const a=Math.max(t,i);for(let u=0;u<e.length;u+=1){const g=e[u];if((g.width>=a||g.height>=a)&&r(g,e[u+1])){n=u;break}}return n}}const ji={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Su={HLS:"h"};class gr{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof gr?i:new gr(i))),this.value=e,this.params=t}}const wu="Dict";function xu(o){return Array.isArray(o)?JSON.stringify(o):o instanceof Map?"Map{}":o instanceof Set?"Set{}":typeof o=="object"?JSON.stringify(o):String(o)}function Au(o,e,t,i){return new Error(`failed to ${o} "${xu(e)}" as ${t}`,{cause:i})}function mr(o,e,t){return Au("serialize",o,e,t)}class io{constructor(e){this.description=e}}const ro="Bare Item",Cu="Boolean";function Tu(o){if(typeof o!="boolean")throw mr(o,Cu);return o?"?1":"?0"}function Du(o){return btoa(String.fromCharCode(...o))}const Lu="Byte Sequence";function Ru(o){if(ArrayBuffer.isView(o)===!1)throw mr(o,Lu);return`:${Du(o)}:`}const ku="Integer";function Iu(o){return o<-999999999999999||999999999999999<o}function no(o){if(Iu(o))throw mr(o,ku);return o.toString()}function Pu(o){return`@${no(o.getTime()/1e3)}`}function so(o,e){if(o<0)return-so(-o,e);const t=Math.pow(10,e);if(Math.abs(o*t%1-.5)<Number.EPSILON){const r=Math.floor(o*t);return(r%2===0?r:r+1)/t}else return Math.round(o*t)/t}const Ou="Decimal";function Fu(o){const e=so(o,3);if(Math.floor(Math.abs(e)).toString().length>12)throw mr(o,Ou);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Mu="String",Bu=/[\x00-\x1f\x7f]+/;function Nu(o){if(Bu.test(o))throw mr(o,Mu);return`"${o.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Uu(o){return o.description||o.toString().slice(7,-1)}const $u="Token";function ao(o){const e=Uu(o);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw mr(e,$u);return e}function Is(o){switch(typeof o){case"number":if(!I(o))throw mr(o,ro);return Number.isInteger(o)?no(o):Fu(o);case"string":return Nu(o);case"symbol":return ao(o);case"boolean":return Tu(o);case"object":if(o instanceof Date)return Pu(o);if(o instanceof Uint8Array)return Ru(o);if(o instanceof io)return ao(o);default:throw mr(o,ro)}}const Hu="Key";function Ps(o){if(/^[a-z*][a-z0-9\-_.*]*$/.test(o)===!1)throw mr(o,Hu);return o}function Os(o){return o==null?"":Object.entries(o).map(([e,t])=>t===!0?`;${Ps(e)}`:`;${Ps(e)}=${Is(t)}`).join("")}function oo(o){return o instanceof gr?`${Is(o.value)}${Os(o.params)}`:Is(o)}function ju(o){return`(${o.value.map(oo).join(" ")})${Os(o.params)}`}function Wu(o,e={whitespace:!0}){if(typeof o!="object"||o==null)throw mr(o,wu);const t=o instanceof Map?o.entries():Object.entries(o),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof gr||(n=new gr(n));let a=Ps(r);return n.value===!0?a+=Os(n.params):(a+="=",Array.isArray(n.value)?a+=ju(n):a+=oo(n)),a}).join(`,${i}`)}function lo(o,e){return Wu(o,e)}const vr="CMCD-Object",di="CMCD-Request",Jr="CMCD-Session",Gr="CMCD-Status",Gu={br:vr,ab:vr,d:vr,ot:vr,tb:vr,tpb:vr,lb:vr,tab:vr,lab:vr,url:vr,pb:di,bl:di,tbl:di,dl:di,ltc:di,mtp:di,nor:di,nrr:di,rc:di,sn:di,sta:di,su:di,ttfb:di,ttfbb:di,ttlb:di,cmsdd:di,cmsds:di,smrt:di,df:di,cs:di,ts:di,cid:Jr,pr:Jr,sf:Jr,sid:Jr,st:Jr,v:Jr,msd:Jr,bs:Gr,bsd:Gr,cdn:Gr,rtp:Gr,bg:Gr,pt:Gr,ec:Gr,e:Gr},Ku={REQUEST:di};function zu(o){return Object.keys(o).reduce((e,t)=>{var i;return(i=o[t])===null||i===void 0||i.forEach(r=>e[r]=t),e},{})}function Vu(o,e){const t={};if(!o)return t;const i=Object.keys(o),r=e?zu(e):{};return i.reduce((n,a)=>{var u;const g=Gu[a]||r[a]||Ku.REQUEST,p=(u=n[g])!==null&&u!==void 0?u:n[g]={};return p[a]=o[a],n},t)}function qu(o){return["ot","sf","st","e","sta"].includes(o)}function Yu(o){return typeof o=="number"?I(o):o!=null&&o!==""&&o!==!1}const uo="event";function Zu(o,e){const t=new URL(o),i=new URL(e);if(t.origin!==i.origin)return o;const r=t.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")+t.search+t.hash}const Zn=o=>Math.round(o),Fs=(o,e)=>Array.isArray(o)?o.map(t=>Fs(t,e)):o instanceof gr&&typeof o.value=="string"?new gr(Fs(o.value,e),o.params):(e.baseUrl&&(o=Zu(o,e.baseUrl)),e.version===1?encodeURIComponent(o):o),Xn=o=>Zn(o/100)*100,Xu={br:Zn,d:Zn,bl:Xn,dl:Xn,mtp:Xn,nor:(o,e)=>{let t=o;return e.version>=2&&(o instanceof gr&&typeof o.value=="string"?t=new gr([o]):typeof o=="string"&&(t=[o])),Fs(t,e)},rtp:Xn,tb:Zn},co="request",ho="response",Ms=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Qu=["e"],Ju=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Qn(o){return Ju.test(o)}function ec(o){return Ms.includes(o)||Qu.includes(o)||Qn(o)}const fo=["d","dl","nor","ot","rtp","su"];function tc(o){return Ms.includes(o)||fo.includes(o)||Qn(o)}const ic=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function rc(o){return Ms.includes(o)||fo.includes(o)||ic.includes(o)||Qn(o)}const nc=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function sc(o){return nc.includes(o)||Qn(o)}const ac={[ho]:rc,[uo]:ec,[co]:tc};function po(o,e={}){const t={};if(o==null||typeof o!="object")return t;const i=e.version||o.v||1,r=e.reportingMode||co,n=i===1?sc:ac[r];let a=Object.keys(o).filter(n);const u=e.filter;typeof u=="function"&&(a=a.filter(u));const g=r===ho||r===uo;g&&!a.includes("ts")&&a.push("ts"),i>1&&!a.includes("v")&&a.push("v");const p=c({},Xu,e.formatters),m={version:i,reportingMode:r,baseUrl:e.baseUrl};return a.sort().forEach(S=>{let R=o[S];const H=p[S];if(typeof H=="function"&&(R=H(R,m)),S==="v"){if(i===1)return;R=i}S=="pr"&&R===1||(g&&S==="ts"&&!I(R)&&(R=Date.now()),Yu(R)&&(qu(S)&&typeof R=="string"&&(R=new io(R)),t[S]=R))}),t}function oc(o,e={}){const t={};if(!o)return t;const i=po(o,e),r=Vu(i,e==null?void 0:e.customHeaderMap);return Object.entries(r).reduce((n,[a,u])=>{const g=lo(u,{whitespace:!1});return g&&(n[a]=g),n},t)}function lc(o,e,t){return c(o,oc(e,t))}const uc="CMCD";function cc(o,e={}){return o?lo(po(o,e),{whitespace:!1}):""}function hc(o,e={}){if(!o)return"";const t=cc(o,e);return encodeURIComponent(t)}function fc(o,e={}){if(!o)return"";const t=hc(o,e);return`${uc}=${t}`}const _o=/CMCD=[^&#]+/;function dc(o,e,t){const i=fc(e,t);if(!i)return o;if(_o.test(o))return o.replace(_o,i);const r=o.includes("?")?"&":"?";return`${o}${r}${i}`}class pc{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=r=>{try{this.apply(r,{ot:ji.MANIFEST,su:!this.initialized})}catch(n){this.hls.logger.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const{frag:n,part:a}=r,u=this.hls.levels[n.level],g=this.getObjectType(n),p={d:(a||n).duration*1e3,ot:g};(g===ji.VIDEO||g===ji.AUDIO||g==ji.MUXED)&&(p.br=u.bitrate/1e3,p.tb=this.getTopBandwidth(g)/1e3,p.bl=this.getBufferLength(g));const m=a?this.getNextPart(a):this.getNextFrag(n);m!=null&&m.url&&m.url!==n.url&&(p.nor=m.url),this.apply(r,p)}catch(n){this.hls.logger.warn("Could not generate segment CMCD data.",n)}},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(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHED,this.onMediaDetached,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHED,this.onMediaDetached,this),e.off(_.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,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:Su.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){c(t,this.createData());const i=t.ot===ji.INIT||t.ot===ji.VIDEO||t.ot===ji.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((a,u)=>(r.includes(u)&&(a[u]=t[u]),a),{}));const n={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),lc(e.headers,t,n)):e.url=dc(e.url,t,n)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const r=e.sn-i.startSN;return i.fragments[r+1]}}getNextPart(e){var t;const{index:i,fragment:r}=e,n=(t=this.hls.levels[r.level])==null||(t=t.details)==null?void 0:t.partList;if(n){const{sn:a}=r;for(let u=n.length-1;u>=0;u--){const g=n[u];if(g.index===i&&g.fragment.sn===a)return n[u+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return ji.TIMED_TEXT;if(e.sn==="initSegment")return ji.INIT;if(t==="audio")return ji.AUDIO;if(t==="main")return this.hls.audioTracks.length?ji.VIDEO:ji.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===ji.AUDIO)i=r.audioTracks;else{const n=r.maxAutoLevel,a=n>-1?n+1:r.levels.length;i=r.levels.slice(0,a)}return i.forEach(n=>{n.bitrate>t&&(t=n.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===ji.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:It.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(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,u){t(n),this.loader.load(n,a,u)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,u){t(n),this.loader.load(n,a,u)}}}}const _c=3e5;class gc extends T{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===ci.SendAlternateToPenaltyBox&&i.flags===mi.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:u,pathwayId:g,type:p}=t.context;u&&r?a=this.getPathwayForGroupId(u,p,a):g&&(a=g)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&r&&(n=this.pathways()),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==a),t.details===w.BUFFER_APPEND_ERROR&&!t.fatal?i.resolved=!0:i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${r&&r.length} priorities: ${Ft(n)} penalized: ${Ft(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,r=performance.now();Object.keys(i).forEach(n=>{r-i[n]>_c&&delete i[n]});for(let n=0;n<e.length;n++){const a=e[n];if(a in i)continue;if(a===this.pathwayId)return;const u=this.hls.nextLoadLevel,g=this.hls.levels[u];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,ya(t),this.hls.trigger(_.LEVELS_UPDATED,{levels:t});const p=this.hls.levels[u];g&&p&&this.levels&&(p.attrs["STABLE-VARIANT-ID"]!==g.attrs["STABLE-VARIANT-ID"]&&p.bitrate!==g.bitrate&&this.log(`Unstable Pathways change from bitrate ${g.bitrate} to ${p.bitrate}`),this.hls.nextLoadLevel=u);break}}}getPathwayForGroupId(e,t,i){const r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===F.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===F.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(n=>{const{ID:a,"BASE-ID":u,"URI-REPLACEMENT":g}=n;if(t.some(m=>m.pathwayId===a))return;const p=this.getLevelsForPathway(u).map(m=>{const S=new ti(m.attrs);S["PATHWAY-ID"]=a;const R=S.AUDIO&&`${S.AUDIO}_clone_${a}`,H=S.SUBTITLES&&`${S.SUBTITLES}_clone_${a}`;R&&(i[S.AUDIO]=R,S.AUDIO=R),H&&(r[S.SUBTITLES]=H,S.SUBTITLES=H);const j=mo(m.uri,S["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",g),Q=new Si({attrs:S,audioCodec:m.audioCodec,bitrate:m.bitrate,height:m.height,name:m.name,url:j,videoCodec:m.videoCodec,width:m.width});if(m.audioGroups)for(let Y=1;Y<m.audioGroups.length;Y++)Q.addGroupId("audio",`${m.audioGroups[Y]}_clone_${a}`);if(m.subtitleGroups)for(let Y=1;Y<m.subtitleGroups.length;Y++)Q.addGroupId("text",`${m.subtitleGroups[Y]}_clone_${a}`);return Q});t.push(...p),go(this.audioTracks,i,g,a),go(this.subtitleTracks,r,g,a)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let r;try{r=new self.URL(e)}catch(m){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const m=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+m)}const n={responseType:"json",url:r.href},a=t.steeringManifestLoadPolicy.default,u=a.errorRetry||a.timeoutRetry||{},g={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:u.maxNumRetry||0,retryDelay:u.retryDelayMs||0,maxRetryDelay:u.maxRetryDelayMs||0},p={onSuccess:(m,S,R,H)=>{this.log(`Loaded steering manifest: "${r}"`);const j=m.data;if((j==null?void 0:j.VERSION)!==1){this.log(`Steering VERSION ${j.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=j.TTL;const{"RELOAD-URI":Q,"PATHWAY-CLONES":Y,"PATHWAY-PRIORITY":te}=j;if(Q)try{this.uri=new self.URL(Q,r).href}catch(ae){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${Q}`);return}this.scheduleRefresh(this.uri||R.url),Y&&this.clonePathways(Y);const ce={steeringManifest:j,url:r.toString()};this.hls.trigger(_.STEERING_MANIFEST_LOADED,ce),te&&this.updatePathwayPriority(te)},onError:(m,S,R,H)=>{if(this.log(`Error loading steering manifest: ${m.code} ${m.text} (${S.url})`),this.stopLoad(),m.code===410){this.enabled=!1,this.log(`Steering manifest ${S.url} no longer available`);return}let j=this.timeToLoad*1e3;if(m.code===429){const Q=this.loader;if(typeof(Q==null?void 0:Q.getResponseHeader)=="function"){const Y=Q.getResponseHeader("Retry-After");Y&&(j=parseFloat(Y)*1e3)}this.log(`Steering manifest ${S.url} rate limited`);return}this.scheduleRefresh(this.uri||S.url,j)},onTimeout:(m,S,R)=>{this.log(`Timeout loading steering manifest (${S.url})`),this.scheduleRefresh(this.uri||S.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,g,p)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const r=(i=this.hls)==null?void 0:i.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function go(o,e,t,i){o&&Object.keys(e).forEach(r=>{const n=o.filter(a=>a.groupId===r).map(a=>{const u=c({},a);return u.details=void 0,u.attrs=new ti(u.attrs),u.url=u.attrs.URI=mo(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),u.groupId=u.attrs["GROUP-ID"]=e[r],u.attrs["PATHWAY-ID"]=i,u});o.push(...n)})}function mo(o,e,t,i){const{HOST:r,PARAMS:n,[t]:a}=i;let u;e&&(u=a==null?void 0:a[e],u&&(o=u));const g=new self.URL(o);return r&&!u&&(g.host=r),n&&Object.keys(n).sort().forEach(p=>{p&&g.searchParams.set(p,n[p])}),g.href}class vn extends T{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=vn.CDMCleanupPromise?[vn.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:i,initData:r}=t,n=`"${t.type}" event: init data type: "${i}"`;if(this.debug(n),r!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=Pt(this.config));const u=a.map(St).filter(g=>!!g);this.keyFormatPromise=this.getKeyFormatPromise(u)}this.keyFormatPromise.then(a=>{const u=Hr(a);if(i!=="sinf"||u!==ai.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${u}`);return}let g;try{const H=He(new Uint8Array(r)),j=fr(JSON.parse(H).sinf),Q=at(j);if(!Q)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");g=new Uint8Array(Q.subarray(8,24))}catch(H){this.warn(`${n} Failed to parse sinf: ${H}`);return}const p=J(g),{keyIdToKeySessionPromise:m,mediaKeySessions:S}=this;let R=m[p];for(let H=0;H<S.length;H++){const j=S[H],Q=j.decryptdata;if(!Q.keyId)continue;const Y=J(Q.keyId);if(p===Y||Q.uri.replace(/-/g,"").indexOf(p)!==-1){if(R=m[Y],!R)continue;if(Q.pssh)break;delete m[Y],Q.pssh=new Uint8Array(r),Q.keyId=g,R=m[p]=R.then(()=>this.generateRequestWithPreferredKeySession(j,i,r,"encrypted-event-key-match")),R.catch(te=>this.handleError(te));break}}R||this.handleError(new Error(`Key ID ${p} not encountered in playlist. Key-system sessions ${S.length}.`))}).catch(a=>this.handleError(a))}},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(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(_.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(_.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t==null?void 0:t[e];if(r)return r.licenseUrl;if(e===ai.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==null?void 0:t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(a,u,g)=>!!a&&g.indexOf(a)===u,r=t.map(a=>a.audioCodec).filter(i),n=t.map(a=>a.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,u)=>{const g=p=>{const m=p.shift();this.getMediaKeysPromise(m,r,n).then(S=>a({keySystem:m,mediaKeys:S})).catch(S=>{p.length?g(p):S instanceof nr?u(S):u(new nr({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_ACCESS,error:S,fatal:!0},S.message))})};g(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return ni===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(e,t)}getMediaKeysPromise(e,t,i){var r;const n=_i(e,t,i,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],u=(r=a)==null?void 0:r.keySystemAccess;if(!u){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Ft(n)}`),u=this.requestMediaKeySystemAccess(e,n);const g=a=this.keySystemAccessPromises[e]={keySystemAccess:u};return u.catch(p=>{this.log(`Failed to obtain access to key-system "${e}": ${p}`)}),u.then(p=>{this.log(`Access for key-system "${p.keySystem}" obtained`);const m=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const S=g.mediaKeys=p.createMediaKeys().then(R=>(this.log(`Media-keys created for "${e}"`),g.hasMediaKeys=!0,m.then(H=>H?this.setMediaKeysServerCertificate(R,e,H):R)));return S.catch(R=>{this.error(`Failed to create media-keys for "${e}"}: ${R}`)}),S})}return u.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${J(e.keyId||[])}`);const r=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,n,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return J(e.keyId)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${J(e.decryptdata.keyId||[])}
|
|
|
} (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>St(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:r})=>{const n=St(r);n?t(n):i(new Error(`Unable to find format for key-system "${r}"`))}).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=Pt(this.config),i=e.map(Hr).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(i)}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=this.bannedKeyIds[i];if(r){const u=vo(r,t);return this.handleError(u,e.frag),Promise.reject(u)}const n=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);const a=this.keyIdToKeySessionPromise[i];if(!a){const u=this.getKeySystemForKeyPromise(t).then(({keySystem:g,mediaKeys:p})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(g,p).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:g,mediaKeys:p,decryptdata:t}))))).then(g=>{const p="cenc",m=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(g,p,m,"playlist-key")});return u.catch(g=>this.handleError(g,e.frag)),this.keyIdToKeySessionPromise[i]=u,u}return a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){this.hls&&(this.error(e.message),e instanceof nr?(t&&(e.data.frag=t),this.hls.trigger(_.ERROR,e.data)):this.hls.trigger(_.ERROR,{type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Hr(e.keyFormat),n=r?[r]:Pt(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Pt(this.config)),e.length===0)throw new nr({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Ft({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 r=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(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var n;const a=(n=this.config.drmSystems)==null||(n=n[e.keySystem])==null?void 0:n.generateRequest;if(a)try{const R=a.call(this.hls,t,i,e);if(!R)throw new Error("Invalid response from configured generateRequest filter");t=R.initDataType,i=R.initData?R.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(R){if(this.warn(R.message),this.hls&&this.hls.config.debug)throw R}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const u=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${u} (init data type: ${t} length: ${i.byteLength})`);const g=new _s,p=e._onmessage=R=>{const H=e.mediaKeysSession;if(!H){g.emit("error",new Error("invalid state"));return}const{messageType:j,message:Q}=R;this.log(`"${j}" message event for session "${H.sessionId}" message size: ${Q.byteLength}`),j==="license-request"||j==="license-renewal"?this.renewLicense(e,Q).catch(Y=>{g.eventNames().length?g.emit("error",Y):this.handleError(Y)}):j==="license-release"?e.keySystem===ai.FAIRPLAY&&(this.updateKeySession(e,Dr("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${j}"`)},m=e._onkeystatuseschange=R=>{if(!e.mediaKeysSession){g.emit("error",new Error("invalid state"));return}const j=e.keyStatus;this.onKeyStatusChange(e);const Q=e.keyStatus;Q!==j&&(g.emit("keyStatus",Q,e),Q==="expired"&&(this.log(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e)))};Mi(e.mediaKeysSession,"message",p),Mi(e.mediaKeysSession,"keystatuseschange",m);const S=new Promise((R,H)=>{g.on("error",H),g.on("keyStatus",(j,{decryptdata:Q})=>{j.startsWith("usable")?R():j==="internal-error"||j==="output-restricted"?H(vo(j,Q)):j==="expired"?H(new Error(`key expired while generating request (keyId: ${u})`)):this.warn(`unhandled key status change "${j}" (keyId: ${u})`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${u}`)}).catch(R=>{throw new nr({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_SESSION,error:R,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${R}`)}).then(()=>S).catch(R=>{throw g.removeAllListeners(),this.removeSession(e),R}).then(()=>(g.removeAllListeners(),e))}onKeyStatusChange(e){const t=J(new Uint8Array(e.decryptdata.keyId||[]));e.mediaKeysSession.keyStatuses.forEach((i,r)=>{if(typeof r=="string"&&typeof i=="object"){const u=r;r=i,i=u}const n=J("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r));i==="internal-error"&&(this.bannedKeyIds[n]=i);const a=n===t;this.log(`${a?"":"un"}matched key status change "${i}" for keyStatuses keyId: ${n} session keyId: ${t} uri: ${e.decryptdata.uri}`),a&&(e.keyStatus=i)})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,u)=>{const g={responseType:"arraybuffer",url:n},p=t.certLoadPolicy.default,m={loadPolicy:p,timeout:p.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(R,H,j,Q)=>{a(R.data)},onError:(R,H,j,Q)=>{u(new nr({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:j,response:h({url:g.url,data:void 0},R)},`"${e}" certificate request failed (${n}). Status: ${R.code} (${R.text})`))},onTimeout:(R,H,j)=>{u(new nr({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:j,response:{url:g.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(R,H,j)=>{u(new Error("aborted"))}};r.load(g,m,S)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),r(e)}).catch(a=>{n(new nr({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(r=>{throw new nr({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:r,fatal:!1},r.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 r=new DOMParser().parseFromString(i,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let m;for(let S=0,R=n.length;S<R;S++){var a,u;m=n[S];const H=(a=m.querySelector("name"))==null?void 0:a.textContent,j=(u=m.querySelector("value"))==null?void 0:u.textContent;H&&j&&e.setRequestHeader(H,j)}}const g=r.querySelector("Challenge"),p=g==null?void 0:g.textContent;if(!p)throw new Error("Cannot find <Challenge> in key message");return Dr(atob(p))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(u.readyState===4)if(u.status===200){this._requestLicenseFailureCount=0;let g=u.response;this.log(`License received ${g instanceof ArrayBuffer?g.byteLength:g}`);const p=this.config.licenseResponseCallback;if(p)try{g=p.call(this.hls,u,a,e)}catch(m){this.error(m)}r(g)}else{const g=i.errorRetry,p=g?g.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>p||u.status>=400&&u.status<500)n(new nr({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:u,response:{url:a,data:void 0,code:u.status,text:u.statusText}},`License Request XHR failed (${a}). Status: ${u.status} (${u.statusText})`));else{const m=p-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${m} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=u,this.setupLicenseXHR(u,a,e,t).then(({xhr:g,licenseChallenge:p})=>{e.keySystem==ai.PLAYREADY&&(p=this.unpackPlayReadyKeyMessage(g,p)),g.send(p)}).catch(n)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,Mi(i,"encrypted",this.onMediaEncrypted),Mi(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(Hi(e,"encrypted",this.onMediaEncrypted),Hi(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Rr.clearKeyUriToKeyIdMap();const r=i.length;vn.CDMCleanupPromise=Promise.all(i.map(n=>this.removeSession(n)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(n=>{this.log(`Could not clear media keys: ${n}`),this.hls&&this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${n}`)})}))).catch(n=>{this.log(`Could not close sessions and clear media keys: ${n}`),this.hls&&this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${n}`)})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null,this.bannedKeyIds={}}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:r}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${J((r==null?void 0:r.keyId)||[])}`),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:a}=this.config;return(pn(a)?new Promise((g,p)=>{self.setTimeout(()=>p(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(g).catch(p)}):Promise.resolve()).catch(g=>{this.log(`Could not remove session: ${g}`),this.hls&&this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${g}`)})}).then(()=>t.close()).catch(g=>{this.log(`Could not close session: ${g}`),this.hls&&this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${g}`)})})}}}vn.CDMCleanupPromise=void 0;class nr 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}}function vo(o,e){const t=o==="output-restricted",i=t?w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:w.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new nr({type:D.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${o}"`)}class mc{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(_.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(_.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(_.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 r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.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 r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,a=i-this.lastDroppedFrames,u=t-this.lastDecodedFrames,g=1e3*a/n,p=this.hls;if(p.trigger(_.FPS_DROP,{currentDropped:a,currentDecoded:u,totalDroppedFrames:i}),g>0&&a>p.config.fpsDroppedMonitoringThreshold*u){let m=p.currentLevel;p.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+m),m>0&&(p.autoLevelCapping===-1||p.autoLevelCapping>=m)&&(m=m-1,p.trigger(_.FPS_DROP_LEVEL_CAPPING,{level:m,droppedLevel:p.currentLevel}),p.autoLevelCapping=m,this.streamController.nextLevelSwitch())}}this.lastTime=r,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 yo(o,e){let t;try{t=new Event("addtrack")}catch(i){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=o,e.dispatchEvent(t)}function bo(o,e){const t=o.mode;if(t==="disabled"&&(o.mode="hidden"),o.cues&&!o.cues.getCueById(e.id))try{if(o.addCue(e),!o.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){M.debug(`[texttrack-utils]: ${i}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,o.addCue(r)}catch(r){M.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(o.mode=t)}function yn(o,e){const t=o.mode;if(t==="disabled"&&(o.mode="hidden"),o.cues)for(let i=o.cues.length;i--;)e&&o.cues[i].removeEventListener("enter",e),o.removeCue(o.cues[i]);t==="disabled"&&(o.mode=t)}function Bs(o,e,t,i){const r=o.mode;if(r==="disabled"&&(o.mode="hidden"),o.cues&&o.cues.length>0){const n=yc(o.cues,e,t);for(let a=0;a<n.length;a++)(!i||i(n[a]))&&o.removeCue(n[a])}r==="disabled"&&(o.mode=r)}function vc(o,e){if(e<=o[0].startTime)return 0;const t=o.length-1;if(e>o[t].endTime)return-1;let i=0,r=t,n;for(;i<=r;)if(n=Math.floor((r+i)/2),e<o[n].startTime)r=n-1;else if(e>o[n].startTime&&i<t)i=n+1;else return n;return o[i].startTime-e<e-o[r].startTime?i:r}function yc(o,e,t){const i=[],r=vc(o,e);if(r>-1)for(let n=r,a=o.length;n<a;n++){const u=o[n];if(u.startTime>=e&&u.endTime<=t)i.push(u);else if(u.startTime>t)return i}return i}function Jn(o){const e=[];for(let t=0;t<o.length;t++){const i=o[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(o[t])}return e}class bc extends Ds{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=Jn(this.media.textTracks);for(let n=0;n<i.length;n++)if(i[n].mode==="hidden")t=i[n];else if(i[n].mode==="showing"){t=i[n];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},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(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.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 r=!!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,r)return;Jn(i.textTracks).forEach(a=>{yn(a)})}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:r,details:n}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==r){this.warn(`Subtitle track with id:${i} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const u=a.details;a.details=t.details,this.log(`Subtitle track ${i} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,u)}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,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(a=>(r==null?void 0:r.indexOf(a))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(m=>!i||i.indexOf(m.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(m=>m.default)&&(this.selectDefaultTrack=!1),a.forEach((m,S)=>{m.id=S});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const u=this.hls.config.subtitlePreference;if(!n&&u){this.selectDefaultTrack=!1;const m=Ci(u,a);if(m>-1)n=a[m];else{const S=Ci(u,this.tracks);n=this.tracks[S]}}let g=this.findTrackId(n);g===-1&&n&&(g=this.findTrackId(null));const p={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(_.SUBTITLE_TRACKS_UPDATED,p),g!==-1&&this.trackId===-1&&this.setSubtitleTrack(g)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(i&&!n.default||!i&&!e)&&(!e||pi(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Nn(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Nn(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(Ls(r,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===F.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&&pi(e,i))return i;const r=Ci(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(i)return null;{const n=Ci(e,t);if(n>-1)return t[n]}}}}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,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,u=a==null?void 0:a.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${u&&a.live?" age "+u.toFixed(1)+(a.type?" "+a.type||0:""):""} ${n}`),this.hls.trigger(_.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Jn(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(n=>Ls(i,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!I(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:a,groupId:u="",name:g,type:p,url:m}=r;this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:a,groupId:u,name:g,type:p,url:m});const S=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(S)}}function Ec(){try{return crypto.randomUUID()}catch(o){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,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}function Un(o){let e=5381,t=o.length;for(;t;)e=e*33^o.charCodeAt(--t);return(e>>>0).toString()}const bn=.025;let es=function(o){return o[o.Point=0]="Point",o[o.Range=1]="Range",o}({});function Sc(o,e,t){return`${o.identifier}-${t+1}-${Un(e)}`}class wc{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 Ns(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=Ns(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=I(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 Ns(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)<bn))}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"?es.Range:es.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 xc(this)}}function Ns(o,e){return o-e.start<e.duration/2&&!(Math.abs(o-(e.start+e.duration))<bn)?e.start:e.start+e.duration}function Eo(o,e,t){const i=new self.URL(o,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function Us(o,e){for(;(t=o.assetList[++e])!=null&&t.error;)var t;return e}function xc(o){return`["${o.identifier}" ${o.cue.pre?"<pre>":o.cue.post?"<post>":""}${o.timelineStart.toFixed(2)}-${o.resumeTime.toFixed(2)}]`}function En(o){const e=o.timelineStart,t=o.duration||0;return`["${o.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Ac{constructor(e,t,i,r){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&&this.hls.trigger(_.PLAYOUT_LIMIT_REACHED,{})};const n=this.hls=new e(t);this.interstitial=i,this.assetItem=r;const a=()=>{this.hasDetails=!0};n.once(_.LEVEL_LOADED,a),n.once(_.AUDIO_TRACK_LOADED,a),n.once(_.SUBTITLE_TRACK_LOADED,a),n.on(_.MEDIA_ATTACHING,(u,{media:g})=>{this.removeMediaListeners(),this.mediaAttached=g,this.interstitial.playoutLimit&&(g.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(_.BUFFER_APPENDED,()=>{const m=this.bufferedEnd;this.reachedPlayout(m)&&(this._bufferedEosTime=m,n.trigger(_.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=Eo(t,e.config.primarySessionId||"").href}catch(i){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,n=It.bufferInfo(e,r,0);return this.getAssetTime(n.end)>=i-.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=It.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;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const i=t-this.startOffset;if(i>0&&i<e)return i}return e}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&&this.hls){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&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&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){var r;(r=this.hls)==null||r.on(e,t)}once(e,t,i){var r;(r=this.hls)==null||r.once(e,t)}off(e,t,i){var r;(r=this.hls)==null||r.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${En(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const So=.033;class Cc extends T{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,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.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 r=this.items;if(r)for(r[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(n=r[i])!=null&&n.event;){var n;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let r=0;r<i.length;r++){let n=i[r];if(t&&t!=="primary"&&(n=n[t]),e===n.start||e>n.start&&e<n.end)return r}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let r=e;r<=t&&i[r];r++){const n=i[r].event;if(n!=null&&n.restrictions.jump&&!n.appendInPlace)return r}return-1}findEventIndex(e){const t=this.items;if(t)for(let r=t.length;r--;){var i;if(((i=t[r].event)==null?void 0:i.identifier)===e)return r}return-1}findAssetIndex(e,t){const i=e.assetList,r=i.length;if(r>1)for(let n=0;n<r;n++){const a=i[n];if(!a.error){const u=a.timelineStart;if(t===u||t>u&&(t<u+(a.duration||0)||n===r-1))return n}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const i=t.assetList,r=i[i.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:r}=i,n=this.events,a=this.parseDateRanges(r,{url:i.url},t),u=Object.keys(r),g=n?n.filter(p=>!u.includes(p.identifier)):[];a.length&&a.sort((p,m)=>{const S=p.cue.pre,R=p.cue.post,H=m.cue.pre,j=m.cue.post;if(S&&!H)return-1;if(H&&!S||R&&!j)return 1;if(j&&!R)return-1;if(!S&&!H&&!R&&!j){const Q=p.startTime,Y=m.startTime;if(Q!==Y)return Q-Y}return p.dateRange.tagOrder-m.dateRange.tagOrder}),this.events=a,g.forEach(p=>{this.removeEvent(p)}),this.updateSchedule(e,g)}updateSchedule(e,t=[],i=!1){const r=this.events||[];if(r.length||t.length||this.length<2){const n=this.items,a=this.parseSchedule(r,e);(i||t.length||(n==null?void 0:n.length)!==a.length||a.some((g,p)=>Math.abs(g.playout.start-n[p].playout.start)>.005||Math.abs(g.playout.end-n[p].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,i){const r=[],n=Object.keys(e);for(let a=0;a<n.length;a++){const u=n[a],g=e[u];if(g.isInterstitial){let p=this.eventMap[u];p?p.setDateRange(g):(p=new wc(g,t),this.eventMap[u]=p,i===!1&&(p.appendInPlace=i)),r.push(p)}}return r}parseSchedule(e,t){const i=[],r=t.main.details,n=r.live?1/0:r.edge;let a=0;if(e=e.filter(g=>!g.error&&!(g.cue.once&&g.hasPlayed)),e.length){this.resolveOffsets(e,t);let g=0,p=0;if(e.forEach((m,S)=>{const R=m.cue.pre,H=m.cue.post,j=e[S-1]||null,Q=m.appendInPlace,Y=H?n:m.startOffset,te=m.duration,ce=m.timelineOccupancy===es.Range?te:0,ae=m.resumptionOffset,Ee=(j==null?void 0:j.startTime)===Y,Te=Y+m.cumulativeDuration;let $e=Q?Te+te:Y+ae;if(R||!H&&Y<=0){const Ie=p;p+=ce,m.timelineStart=Te;const Pe=a;a+=te,i.push({event:m,start:Te,end:$e,playout:{start:Pe,end:a},integrated:{start:Ie,end:p}})}else if(Y<=n){if(!Ee){const Ae=Y-g;if(Ae>So){const ze=g,_t=p;p+=Ae;const xt=a;a+=Ae;const kt={previousEvent:e[S-1]||null,nextEvent:m,start:ze,end:ze+Ae,playout:{start:xt,end:a},integrated:{start:_t,end:p}};i.push(kt)}else Ae>0&&j&&(j.cumulativeDuration+=Ae,i[i.length-1].end=Y)}H&&($e=Te),m.timelineStart=Te;const Ie=p;p+=ce;const Pe=a;a+=te,i.push({event:m,start:Te,end:$e,playout:{start:Pe,end:a},integrated:{start:Ie,end:p}})}else return;const xe=m.resumeTime;H||xe>n?g=n:g=xe}),g<n){var u;const m=g,S=p,R=n-g;p+=R;const H=a;a+=R,i.push({previousEvent:((u=i[i.length-1])==null?void 0:u.event)||null,nextEvent:null,start:g,end:m+R,playout:{start:H,end:a},integrated:{start:S,end:p}})}this.setDurations(n,a,p)}else i.push({previousEvent:null,nextEvent:null,start:0,end:n,playout:{start:0,end:n},integrated:{start:0,end:n}}),this.setDurations(n,n,n);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,r=i.live?1/0:i.edge;let n=0,a=-1;e.forEach((u,g)=>{const p=u.cue.pre,m=u.cue.post,S=p?0:m?r:u.startTime;this.updateAssetDurations(u),a===S?u.cumulativeDuration=n:(n=0,a=S),!m&&u.snapOptions.in&&(u.resumeAnchor=zi(null,i.fragments,u.startOffset+u.resumptionOffset,0,0)||void 0),u.appendInPlace&&!u.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(u,t)||(u.appendInPlace=!1)),!u.appendInPlace&&g+1<e.length&&e[g+1].startTime-e[g].resumeTime<So&&(e[g+1].appendInPlace=!1,e[g+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${u}`));const H=I(u.resumeOffset)?u.resumeOffset:u.duration;n+=H})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(i-r)>bn?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(a=>{const u=t[a].details,g=u.edge;if(i>=g)return this.log(`"${e.identifier}" resumption ${i} past ${a} playlist end ${g}`),!1;const p=zi(null,u.fragments,i);if(!p)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${a} playlist (${u.fragStart}-${u.fragmentEnd})`),!0;const m=a==="audio"?.175:0;return Math.abs(p.start-i)<bn+m||Math.abs(p.end-i)<bn+m?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${a} fragment bounds (${p.start}-${p.end} sn: ${p.sn} cc: ${p.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,r=!1,n=!1;for(let a=0;a<e.assetList.length;a++){const u=e.assetList[a],g=t+i;u.startOffset=i,u.timelineStart=g,r||(r=u.duration===null),n||(n=!!u.error);const p=u.error?0:u.duration||0;i+=p}r&&!n?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function sr(o){return`[${o.event?'"'+o.event.identifier+'"':"primary"}: ${o.start.toFixed(2)}-${o.end.toFixed(2)}]`}class Tc{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let r;try{r=Eo(i,this.hls.sessionId,e.baseUrl)}catch(R){const H=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,R,i);this.hls.trigger(_.ERROR,H);return}t&&r.protocol!=="data:"&&r.searchParams.set("_HLS_start_offset",""+t);const n=this.hls.config,a=n.loader,u=new a(n),g={responseType:"json",url:r.href},p=n.interstitialAssetListLoadPolicy.default,m={loadPolicy:p,timeout:p.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(R,H,j,Q)=>{const Y=R.data,te=Y==null?void 0:Y.ASSETS;if(!Array.isArray(te)){const ce=this.assignAssetListError(e,w.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),j.url,H,Q);this.hls.trigger(_.ERROR,ce);return}e.assetListResponse=Y,this.hls.trigger(_.ASSET_LIST_LOADED,{event:e,assetListResponse:Y,networkDetails:Q})},onError:(R,H,j,Q)=>{const Y=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${R.code} ${R.text} (${H.url})`),H.url,Q,j);this.hls.trigger(_.ERROR,Y)},onTimeout:(R,H,j)=>{const Q=this.assignAssetListError(e,w.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${H.url})`),H.url,R,j);this.hls.trigger(_.ERROR,Q)}};return u.load(g,m,S),this.hls.trigger(_.ASSET_LIST_LOADING,{event:e}),u}assignAssetListError(e,t,i,r,n,a){return e.error=i,{type:D.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:i,networkDetails:a,stats:n}}}function wo(o){o==null||o.play().catch(()=>{})}function ts(o,e){return`[${o}] Advancing timeline position to ${e}`}class Dc extends T{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||!this.schedule)return;const r=i-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const a=r<=-.01;this.timelinePos=i,this.bufferedPos=i;const u=this.playingItem;if(!u){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(i,i-r)&&this.updateSchedule(!0),this.checkBuffer(),a&&i<u.start||i>=u.end){var g;const H=this.findItemIndex(u);let j=this.schedule.findItemIndexAtTime(i);if(j===-1&&(j=H+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${i} (resolving from ${H} to ${j})`)),!this.isInterstitial(u)&&(g=this.media)!=null&&g.paused&&(this.shouldPlay=!1),!a&&j>H){const Q=this.schedule.findJumpRestrictedIndex(H+1,j);if(Q>H){this.setSchedulePosition(Q);return}}this.setSchedulePosition(j);return}const p=this.playingAsset;if(!p){if(this.playingLastItem&&this.isInterstitial(u)){const H=u.event.assetList[0];H&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,H))}return}const m=p.timelineStart,S=p.duration||0;if(a&&i<m||i>=m+S){var R;(R=u.event)!=null&&R.appendInPlace&&(this.clearInterstitial(u.event,u),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,p)}},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 r=this.playingItem;if(!r||this.playingLastItem)return;if(i>=r.end){this.timelinePos=r.end;const u=this.findItemIndex(r);this.setSchedulePosition(u+1)}const n=this.playingAsset;if(!n)return;const a=n.timelineStart+(n.duration||0);i>=a&&this.setScheduleToAssetAtTime(i,n)},this.onScheduleUpdate=(i,r)=>{const n=this.schedule;if(!n)return;const a=this.playingItem,u=n.events||[],g=n.items||[],p=n.durations,m=i.map(Q=>Q.identifier),S=!!(u.length||m.length);(S||r)&&this.log(`INTERSTITIALS_UPDATED (${u.length}): ${u}
|
|
|
Schedule: ${g.map(Q=>sr(Q))} pos: ${this.timelinePos}`),m.length&&this.log(`Removed events ${m}`);let R=null,H=null;a&&(R=this.updateItem(a,this.timelinePos),this.itemsMatch(a,R)?this.playingItem=R:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const j=this.bufferingItem;if(j&&(H=this.updateItem(j,this.bufferedPos),this.itemsMatch(j,H)?this.bufferingItem=H:j.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(j.event,null))),i.forEach(Q=>{Q.assetList.forEach(Y=>{this.clearAssetPlayer(Y.identifier,null)})}),this.playerQueue.forEach(Q=>{if(Q.interstitial.appendInPlace){const Y=Q.assetItem.timelineStart,te=Q.timelineOffset-Y;if(te)try{Q.timelineOffset=Y}catch(ce){Math.abs(te)>bn&&this.warn(`${ce} ("${Q.assetId}" ${Q.timelineOffset}->${Y})`)}}}),S||r){if(this.hls.trigger(_.INTERSTITIALS_UPDATED,{events:u.slice(0),schedule:g.slice(0),durations:p,removedIds:m}),this.isInterstitial(a)&&m.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(R,a),j&&H!==R&&this.trimInPlace(H,j),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Tc(e),this.schedule=new Cc(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(_.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(_.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(_.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(_.BUFFER_APPENDED,this.onBufferAppended,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(_.MEDIA_ENDED,this.onMediaEnded,this),e.on(_.ERROR,this.onError,this),e.on(_.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(_.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(_.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(_.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.BUFFER_APPENDED,this.onBufferAppended,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(_.MEDIA_ENDED,this.onMediaEnded,this),e.off(_.ERROR,this.onError,this),e.off(_.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.schedule=this.manager=null,this.hls=this.HlsPlayerClass=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){Hi(e,"play",this.onPlay),Hi(e,"pause",this.onPause),Hi(e,"seeking",this.onSeeking),Hi(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;Mi(i,"seeking",this.onSeeking),Mi(i,"timeupdate",this.onTimeupdate),Mi(i,"play",this.onPlay),Mi(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!r){this.clearScheduleState();const n=this.findItemIndex(i);this.setSchedulePosition(n)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,r=this.media;if(this.media=null,!i&&(r&&this.removeMediaListeners(r),this.detachedData)){const n=this.getBufferingPlayer();n&&(this.log(`Removing schedule state for detachedData and ${n}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,n.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=S=>S&&e.getAssetPlayer(S.identifier),r=(S,R,H,j,Q)=>{if(S){let Y=S[R].start;const te=S.event;if(te){if(R==="playout"||te.timelineOccupancy!==es.Point){const ce=i(H);(ce==null?void 0:ce.interstitial)===te&&(Y+=ce.assetItem.startOffset+ce[Q])}}else{const ce=j==="bufferedPos"?a():e[j];Y+=ce-S.start}return Y}return 0},n=(S,R)=>{var H;if(S!==0&&R!=="primary"&&(H=e.schedule)!=null&&H.length){var j;const Q=e.schedule.findItemIndexAtTime(S),Y=(j=e.schedule.items)==null?void 0:j[Q];if(Y){const te=Y[R].start-Y.start;return S+te}}return S},a=()=>{const S=e.bufferedPos;return S===Number.MAX_VALUE?u("primary"):Math.max(S,0)},u=S=>{var R,H;return(R=e.primaryDetails)!=null&&R.live?e.primaryDetails.edge:((H=e.schedule)==null?void 0:H.durations[S])||0},g=(S,R)=>{var H,j;const Q=e.effectivePlayingItem;if(Q!=null&&(H=Q.event)!=null&&H.restrictions.skip||!e.schedule)return;e.log(`seek to ${S} "${R}"`);const Y=e.effectivePlayingItem,te=e.schedule.findItemIndexAtTime(S,R),ce=(j=e.schedule.items)==null?void 0:j[te],ae=e.getBufferingPlayer(),Ee=ae==null?void 0:ae.interstitial,Te=Ee==null?void 0:Ee.appendInPlace,$e=Y&&e.itemsMatch(Y,ce);if(Y&&(Te||$e)){const xe=i(e.playingAsset),Ie=(xe==null?void 0:xe.media)||e.primaryMedia;if(Ie){const Pe=R==="primary"?Ie.currentTime:r(Y,R,e.playingAsset,"timelinePos","currentTime"),Ae=S-Pe,ze=(Te?Pe:Ie.currentTime)+Ae;if(ze>=0&&(!xe||Te||ze<=xe.duration)){Ie.currentTime=ze;return}}}if(ce){let xe=S;if(R!=="primary"){const Pe=ce[R].start,Ae=S-Pe;xe=ce.start+Ae}const Ie=!e.isInterstitial(ce);if((!e.isInterstitial(Y)||Y.event.appendInPlace)&&(Ie||ce.event.appendInPlace)){const Pe=e.media||(Te?ae==null?void 0:ae.media:null);Pe&&(Pe.currentTime=xe)}else if(Y){const Pe=e.findItemIndex(Y);if(te>Pe){const ze=e.schedule.findJumpRestrictedIndex(Pe+1,te);if(ze>Pe){e.setSchedulePosition(ze);return}}let Ae=0;if(Ie)e.timelinePos=xe,e.checkBuffer();else{const ze=ce.event.assetList,_t=S-(ce[R]||ce).start;for(let xt=ze.length;xt--;){const kt=ze[xt];if(kt.duration&&_t>=kt.startOffset&&_t<kt.startOffset+kt.duration){Ae=xt;break}}}e.setSchedulePosition(te,Ae)}}},p=()=>{const S=e.effectivePlayingItem;if(e.isInterstitial(S))return S;const R=t();return e.isInterstitial(R)?R:null},m={get bufferedEnd(){const S=t(),R=e.bufferingItem;if(R&&R===S){var H;return r(R,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-R.playout.start||((H=e.bufferingAsset)==null?void 0:H.startOffset)||0}return 0},get currentTime(){const S=p(),R=e.effectivePlayingItem;return R&&R===S?r(R,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-R.playout.start:0},set currentTime(S){const R=p(),H=e.effectivePlayingItem;H&&H===R&&g(S+H.playout.start,"playout")},get duration(){const S=p();return S?S.playout.end-S.playout.start:0},get assetPlayers(){var S;const R=(S=p())==null?void 0:S.event.assetList;return R?R.map(H=>e.getAssetPlayer(H.identifier)):[]},get playingIndex(){var S;const R=(S=p())==null?void 0:S.event;return R&&e.effectivePlayingAsset?R.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return p()}};return this.manager={get events(){var S;return((S=e.schedule)==null||(S=S.events)==null?void 0:S.slice(0))||[]},get schedule(){var S;return((S=e.schedule)==null||(S=S.items)==null?void 0:S.slice(0))||[]},get interstitialPlayer(){return p()?m:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const S=t();return e.findItemIndex(S)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const S=e.effectivePlayingItem;return e.findItemIndex(S)},primary:{get bufferedEnd(){return a()},get currentTime(){const S=e.timelinePos;return S>0?S:0},set currentTime(S){g(S,"primary")},get duration(){return u("primary")},get seekableStart(){var S;return((S=e.primaryDetails)==null?void 0:S.fragmentStart)||0}},integrated:{get bufferedEnd(){return r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(S){g(S,"integrated")},get duration(){return u("integrated")},get seekableStart(){var S;return n(((S=e.primaryDetails)==null?void 0:S.fragmentStart)||0,"integrated")}},skip:()=>{const S=e.effectivePlayingItem,R=S==null?void 0:S.event;if(R&&!R.restrictions.skip){const H=e.findItemIndex(S);if(R.appendInPlace){const j=S.playout.start+S.event.duration;g(j+.001,"playout")}else e.advanceAfterAssetEnded(R,H,1/0)}}}}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;if(this.mediaSelection===null)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(r=this.primaryMedia);const n=(t=r)==null?void 0:t.currentTime;if(!(n===void 0||!I(n)))return n}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,r=e.media;if(i&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}const n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Ft(n)}`),this.detachedData=n}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var i,r;if(e.media===t)return;let n=null;const a=this.hls,u=e!==a,g=u&&e.interstitial.appendInPlace,p=(i=this.detachedData)==null?void 0:i.mediaSource;let m;if(a.media)g&&(n=a.transferMedia(),this.detachedData=n),m="Primary";else if(p){const j=this.getBufferingPlayer();j?(n=j.transferMedia(),m=`${j}`):m="detached MediaSource"}else m="detached media";if(!n){if(p)n=this.detachedData,this.log(`using detachedData: MediaSource ${Ft(n)}`);else if(!this.detachedData||a.media===t){const j=this.playerQueue;j.length>1&&j.forEach(Q=>{if(u&&Q.interstitial.appendInPlace!==g){const Y=Q.interstitial;this.clearInterstitial(Q.interstitial,null),Y.appendInPlace=!1,Y.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${Y}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const S=n&&"mediaSource"in n&&((r=n.mediaSource)==null?void 0:r.readyState)!=="closed",R=S&&n?n:t;this.log(`${S?"transfering MediaSource":"attaching media"} to ${u?e:"Primary"} from ${m} (media.currentTime: ${t.currentTime})`);const H=this.schedule;if(R===n&&H){const j=u&&e.assetId===H.assetIdAtEnd;R.overrides={duration:H.duration,endOfStream:!u||j,cueRemoval:!u}}e.attachMedia(R)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e==null?void 0:e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,r=this.effectivePlayingItem;if(i===-1){const n=this.hls.startPosition;if(this.log(ts("checkStart",n)),this.timelinePos=n,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(n>=0||!this.primaryLive){const a=this.timelinePos=n>0?n:0,u=e.findItemIndexAtTime(a);this.setSchedulePosition(u)}}else if(r&&!this.playingItem){const n=e.findItemIndex(r);this.setSchedulePosition(n)}}advanceAssetBuffering(e,t){const i=e.event,r=i.findAssetIndex(t),n=Us(i,r);if(!i.isAssetPastPlayoutLimit(n))this.bufferedToEvent(e,n);else if(this.schedule){var a;const u=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];u&&this.bufferedToItem(u)}}advanceAfterAssetEnded(e,t,i){const r=Us(e,i);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){const n=this.schedule.items;if(n){const a=t+1,u=n.length;if(a>=u){this.setSchedulePosition(-1);return}const g=e.resumeTime;this.timelinePos<g&&(this.log(ts("advanceAfterAssetEnded",g)),this.timelinePos=g,e.appendInPlace&&this.advanceInPlace(g),this.checkBuffer(this.bufferedPos<g)),this.setSchedulePosition(a)}}}else{if(e.appendInPlace){const n=e.assetList[r];n&&this.advanceInPlace(n.timelineStart)}this.setSchedulePosition(t,r)}}setScheduleToAssetAtTime(e,t){const i=this.schedule;if(!i)return;const r=t.parentIdentifier,n=i.getEvent(r);if(n){const a=i.findEventIndex(r),u=i.findAssetIndex(n,e);this.advanceAfterAssetEnded(n,a,u-1)}}setSchedulePosition(e,t){var i;const r=(i=this.schedule)==null?void 0:i.items;if(!r||this.playbackDisabled)return;const n=e>=0?r[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${n&&sr(n)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,u=this.playingLastItem;if(this.isInterstitial(a)){const m=a.event,S=this.playingAsset,R=S==null?void 0:S.identifier,H=R?this.getAssetPlayer(R):null;if(H&&R&&(!this.eventItemsMatch(a,n)||t!==void 0&&R!==m.assetList[t].identifier)){var g;const j=m.findAssetIndex(S);if(this.log(`INTERSTITIAL_ASSET_ENDED ${j+1}/${m.assetList.length} ${En(S)}`),this.endedAsset=S,this.playingAsset=null,this.hls.trigger(_.INTERSTITIAL_ASSET_ENDED,{asset:S,assetListIndex:j,event:m,schedule:r.slice(0),scheduleIndex:e,player:H}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(m,this.findItemIndex(this.playingItem),j);return}this.retreiveMediaSource(R,n),H.media&&!((g=this.detachedData)!=null&&g.mediaSource)&&H.detachMedia()}if(!this.eventItemsMatch(a,n)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${m} ${sr(a)}`),m.hasPlayed=!0,this.hls.trigger(_.INTERSTITIAL_ENDED,{event:m,schedule:r.slice(0),scheduleIndex:e}),m.cue.once)){var p;this.updateSchedule();const j=(p=this.schedule)==null?void 0:p.items;if(n&&j){const Q=this.findItemIndex(n);this.advanceSchedule(Q,j,t,a,u)}return}}this.advanceSchedule(e,r,t,a,u)}advanceSchedule(e,t,i,r,n){const a=this.schedule;if(!a)return;const u=t[e]||null,g=this.primaryMedia,p=this.playerQueue;if(p.length&&p.forEach(m=>{const S=m.interstitial,R=a.findEventIndex(S.identifier);(R<e||R>e+1)&&this.clearInterstitial(S,u)}),this.isInterstitial(u)){this.timelinePos=Math.min(Math.max(this.timelinePos,u.start),u.end);const m=u.event;if(i===void 0){i=a.findAssetIndex(m,this.timelinePos);const j=Us(m,i-1);if(m.isAssetPastPlayoutLimit(j)||m.appendInPlace&&this.timelinePos===u.end){this.advanceAfterAssetEnded(m,e,i);return}i=j}const S=this.waitingItem;this.assetsBuffered(u,g)||this.setBufferingItem(u);let R=this.preloadAssets(m,i);if(this.eventItemsMatch(u,S||r)||(this.waitingItem=u,this.log(`INTERSTITIAL_STARTED ${sr(u)} ${m.appendInPlace?"append in place":""}`),this.hls.trigger(_.INTERSTITIAL_STARTED,{event:m,schedule:t.slice(0),scheduleIndex:e})),!m.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${m}`);return}if(m.assetListLoader&&(m.assetListLoader.destroy(),m.assetListLoader=void 0),!g){this.log(`Waiting for attachMedia to start Interstitial ${m}`);return}this.waitingItem=this.endedItem=null,this.playingItem=u;const H=m.assetList[i];if(!H){this.advanceAfterAssetEnded(m,e,i||0);return}if(R||(R=this.getAssetPlayer(H.identifier)),R===null||R.destroyed){const j=m.assetList.length;this.warn(`asset ${i+1}/${j} player destroyed ${m}`),R=this.createAssetPlayer(m,H,i),R.loadSource()}if(!this.eventItemsMatch(u,this.bufferingItem)&&m.appendInPlace&&this.isAssetBuffered(H))return;this.startAssetPlayer(R,i,t,e,g),this.shouldPlay&&wo(R.media)}else u?(this.resumePrimary(u,e,r),this.shouldPlay&&wo(this.hls.media)):n&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var r,n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${sr(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let u=this.timelinePos;(u<e.start||u>=e.end)&&(u=this.getPrimaryResumption(e,t),this.log(ts("resumePrimary",u)),this.timelinePos=u),this.attachPrimary(u,e)}if(!i)return;const a=(n=this.schedule)==null?void 0:n.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${sr(e)}`),this.hls.trigger(_.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const r=this.primaryDetails;if(t===0)return this.hls.startPosition;if(r&&(i<r.fragmentStart||i>r.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:It.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 r=this.primaryMedia;if(!r)return;const n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,r),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(ts("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const r=this.hls;!r.loadingEnabled||!r.media||Math.abs((((i=r.mainForwardBufferInfo)==null?void 0:i.start)||r.media.currentTime)-e)>.5?r.startLoad(e,t):r.bufferingEnabled||r.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.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(_.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(_.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const i=this.hls.levels[t.level],r=h(h({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=h(h({},this.altSelection),{},{audio:i});return}const n=h(h({},r),{},{audio:i});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=h(h({},this.altSelection),{},{subtitles:i});return}const n=h(h({},r),{},{subtitles:i});this.mediaSelection=n}onAudioTrackSwitching(e,t){const i=Ni(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setAudioOption(t)||r.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=Ni(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setSubtitleOption(t)||t.id!==-1&&r.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 r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let r=0;r<t.length;r++){const n=t[r];if(n.cue.post){var i;const a=this.schedule.findEventIndex(n.identifier),u=(i=this.schedule.items)==null?void 0:i[a];this.isInterstitial(u)&&this.eventItemsMatch(u,this.bufferingItem)&&this.bufferedToItem(u,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){var i;const r=(i=this.schedule)==null?void 0:i.items;if(e&&r){const n=this.findItemIndex(e,t);return r[n]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((n,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(n.identifier,null)});const i=e.end+.25,r=It.bufferInfo(this.primaryMedia,i,0);(r.end>i||(r.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${sr(e)} (was ${sr(t)})`),this.attachPrimary(i,null,!0),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?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&((t=this.schedule)==null||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=(t=this.schedule)==null?void 0:t.items;if(!i)return;const r=It.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,i,e)}updateBufferedPos(e,t,i){const r=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(t.length===1&&this.itemsMatch(t[0],n)){this.bufferedPos=e;return}const a=this.playingItem,u=this.findItemIndex(a);let g=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var p;const m=this.findItemIndex(n),S=Math.min(m+1,t.length-1),R=t[S];if((g===-1&&n&&e>=n.end||(p=R.event)!=null&&p.appendInPlace&&e+.01>=R.start)&&(g=S),this.isInterstitial(n)){const H=n.event;if(S-u>1&&H.appendInPlace===!1||H.assetList.length===0&&H.assetListLoader)return}if(this.bufferedPos=e,g>m&&g>u)this.bufferedToItem(R);else{const H=this.primaryDetails;this.primaryLive&&H&&e>H.edge-H.targetduration&&R.start<H.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(R)&&this.preloadAssets(R.event,0)}}else i&&a&&!this.itemsMatch(a,n)&&(g===u?this.bufferedToItem(a):g===u+1&&this.bufferedToItem(t[g]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(r=>{const n=this.getAssetPlayer(r.identifier);return!(n!=null&&n.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:r,events:n}=i;if(!r||!n)return t;const a=this.isInterstitial(e),u=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const g=u?u.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${sr(e)}`+(t?` (${g.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const p=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((m,S)=>{const R=this.getAssetPlayer(m.identifier);R&&(S===p&&R.loadSource(),R.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(p=>p.pauseBuffering());this.hls.trigger(_.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);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 r=this.detachedData;r?r.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,r=i.assetList.length===0&&!i.assetListLoader,n=i.cue.once;if(r||!n){const a=this.preloadAssets(i,t);if(a!=null&&a.interstitial.appendInPlace){const u=this.primaryMedia;u&&this.bufferAssetPlayer(a,u)}}}preloadAssets(e,t){const i=e.assetUrl,r=e.assetList.length,n=r===0&&!e.assetListLoader,a=e.cue.once;if(n){const g=e.timelineStart;if(e.appendInPlace){var u;const R=this.playingItem;!this.isInterstitial(R)&&(R==null||(u=R.nextEvent)==null?void 0:u.identifier)===e.identifier&&this.flushFrontBuffer(g+.25)}let p,m=0;if(!this.playingItem&&this.primaryLive&&(m=this.hls.startPosition,m===-1&&(m=this.hls.liveSyncPosition||0)),m&&!(e.cue.pre||e.cue.post)){const R=m-g;R>0&&(p=Math.round(R*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:r} ${e}${p?` live-start: ${m} start-offset: ${p}`:""}`),i)return this.createAsset(e,0,0,g,e.duration,i);const S=this.assetListLoader.loadAssetList(e,p);S&&(e.assetListLoader=S)}else if(!a&&r){for(let p=t;p<r;p++){const m=e.assetList[p],S=this.getAssetPlayerQueueIndex(m.identifier);(S===-1||this.playerQueue[S].destroyed)&&!m.error&&this.createAssetPlayer(e,m,p)}const g=e.assetList[t];if(g){const p=this.getAssetPlayer(g.identifier);return p&&p.loadSource(),p}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(r=>{this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:r})})}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,r,n,a){const u={parentIdentifier:e.identifier,identifier:Sc(e,a,t),duration:n,startOffset:i,timelineStart:r,uri:a};return this.createAssetPlayer(e,u,t)}createAssetPlayer(e,t,i){const r=this.hls,n=r.userConfig;let a=n.videoPreference;const u=r.loadLevelObj||r.levels[r.currentLevel];(a||u)&&(a=c({},a),u.videoCodec&&(a.videoCodec=u.videoCodec),u.videoRange&&(a.allowedVideoRanges=[u.videoRange]));const g=r.audioTracks[r.audioTrack],p=r.subtitleTracks[r.subtitleTrack];let m=0;if(this.primaryLive||e.appendInPlace){const Ee=this.timelinePos-t.timelineStart;if(Ee>1){const Te=t.duration;Te&&Ee<Te&&(m=Ee)}}const S=t.identifier,R=h(h({},n),{},{maxMaxBufferLength:Math.min(180,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:S,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:m,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:g||n.audioPreference,subtitlePreference:p||n.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(R.timelineOffset=t.timelineStart));const H=R.cmcd;H!=null&&H.sessionId&&H.contentId&&(R.cmcd=c({},H,{contentId:Un(t.uri)})),this.getAssetPlayer(S)&&this.warn(`Duplicate date range identifier ${e} and asset ${S}`);const j=new Ac(this.HlsPlayerClass,R,e,t);this.playerQueue.push(j),e.assetList[i]=t;let Q=!0;const Y=Ee=>{if(Ee.live){var Te;const Ie=new Error(`Interstitials MUST be VOD assets ${e}`),Pe={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ie},Ae=((Te=this.schedule)==null?void 0:Te.findEventIndex(e.identifier))||-1;this.handleAssetItemError(Pe,e,Ae,i,Ie.message);return}const $e=Ee.edge-Ee.fragmentStart,xe=t.duration;(Q||xe===null||$e>xe)&&(Q=!1,this.log(`Interstitial asset "${S}" duration change ${xe} > ${$e}`),t.duration=$e,this.updateSchedule())};j.on(_.LEVEL_UPDATED,(Ee,{details:Te})=>Y(Te)),j.on(_.LEVEL_PTS_UPDATED,(Ee,{details:Te})=>Y(Te)),j.on(_.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const te=(Ee,Te)=>{const $e=this.getAssetPlayer(S);if($e&&Te.tracks){$e.off(_.BUFFER_CODECS,te),$e.tracks=Te.tracks;const xe=this.primaryMedia;this.bufferingAsset===$e.assetItem&&xe&&!$e.media&&this.bufferAssetPlayer($e,xe)}};j.on(_.BUFFER_CODECS,te);const ce=()=>{var Ee;const Te=this.getAssetPlayer(S);if(this.log(`buffered to end of asset ${Te}`),!Te||!this.schedule)return;const $e=this.schedule.findEventIndex(e.identifier),xe=(Ee=this.schedule.items)==null?void 0:Ee[$e];this.isInterstitial(xe)&&this.advanceAssetBuffering(xe,t)};j.on(_.BUFFERED_TO_END,ce);const ae=Ee=>()=>{if(!this.getAssetPlayer(S)||!this.schedule)return;this.shouldPlay=!0;const $e=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,$e,Ee)};return j.once(_.MEDIA_ENDED,ae(i)),j.once(_.PLAYOUT_LIMIT_REACHED,ae(1/0)),j.on(_.ERROR,(Ee,Te)=>{if(!this.schedule)return;const $e=this.getAssetPlayer(S);if(Te.details===w.BUFFER_STALLED_ERROR){if($e!=null&&$e.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(Te,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${Te.error} ${e}`)}),j.on(_.DESTROYING,()=>{if(!this.getAssetPlayer(S)||!this.schedule)return;const Te=new Error(`Asset player destroyed unexpectedly ${S}`),$e={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:Te};this.handleAssetItemError($e,e,this.schedule.findEventIndex(e.identifier),i,Te.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${En(t)}`),this.hls.trigger(_.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:j}),j}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){const r=this.playerQueue[i];this.log(`clear ${r} toSegment: ${t&&sr(t)}`),this.transferMediaFromPlayer(r,t),this.playerQueue.splice(i,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,r,n){const{interstitial:a,assetItem:u,assetId:g}=e,p=a.assetList.length,m=this.playingAsset;this.endedAsset=null,this.playingAsset=u,(!m||m.identifier!==g)&&(m&&(this.clearAssetPlayer(m.identifier,i[r]),delete m.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${p} ${En(u)}`),this.hls.trigger(_.INTERSTITIAL_ASSET_STARTED,{asset:u,assetListIndex:t,event:a,schedule:i.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,n)}bufferAssetPlayer(e,t){var i,r;if(!this.schedule)return;const{interstitial:n,assetItem:a}=e,u=this.schedule.findEventIndex(n.identifier),g=(i=this.schedule.items)==null?void 0:i[u];if(!g)return;e.loadSource(),this.setBufferingItem(g),this.bufferingAsset=a;const p=this.getBufferingPlayer();if(p===e)return;const m=n.appendInPlace;if(m&&(p==null?void 0:p.interstitial.appendInPlace)===!1)return;const S=(p==null?void 0:p.tracks)||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(m&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(S&&!se(S,e.tracks)){const R=new Error(`Asset ${En(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(S)}')`),H={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:R},j=n.findAssetIndex(a);this.handleAssetItemError(H,n,u,j,R.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const r=i.currentTime,n=t.findAssetIndex(e,r),a=e.assetList[n];if(a){const u=this.getAssetPlayer(a.identifier);if(u){const g=u.currentTime||r-a.timelineStart,p=u.duration-g;if(this.warn(`Stalled at ${g} of ${g+p} in ${u} ${e} (media.currentTime: ${r})`),g&&(p/i.playbackRate<.5||u.bufferedInPlaceToEnd(i))&&u.hls){const m=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,m,n)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,i,r,n){if(e.details===w.BUFFER_STALLED_ERROR)return;const a=t.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&En(a)} ${e.error}`),!this.schedule)return;const u=(a==null?void 0:a.identifier)||"",g=this.getAssetPlayerQueueIndex(u),p=this.playerQueue[g]||null,m=this.schedule.items,S=c({},e,{fatal:!1,errorAction:tr(!0),asset:a,assetListIndex:r,event:t,schedule:m,scheduleIndex:i,player:p});if(this.hls.trigger(_.INTERSTITIAL_ASSET_ERROR,S),!e.fatal)return;const R=this.playingAsset,H=this.bufferingAsset,j=new Error(n);if(a&&(this.clearAssetPlayer(u,null),a.error=j),!t.assetList.some(Q=>!Q.error))t.error=j;else for(let Q=r;Q<t.assetList.length;Q++)this.resetAssetPlayer(t.assetList[Q].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):R&&R.identifier===u?this.advanceAfterAssetEnded(t,i,r):H&&H.identifier===u&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,H)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${sr(i)} error: ${e.error}`);let r=this.timelinePos;r===-1&&(r=this.hls.startPosition);const n=this.updateItem(i,r);if(this.itemsMatch(i,n)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t)),!this.schedule)return;const a=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(a)}else this.checkStart()}onAssetListLoaded(e,t){var i,r;const n=t.event,a=n.identifier,u=t.assetListResponse.ASSETS;if(!((i=this.schedule)!=null&&i.hasEvent(a)))return;const g=n.timelineStart,p=n.duration;let m=0;u.forEach((Q,Y)=>{const te=parseFloat(Q.DURATION);this.createAsset(n,Y,m,g+m,te,Q.URI),m+=te}),n.duration=m,this.log(`Loaded asset-list with duration: ${m} (was: ${p}) ${n}`);const S=this.waitingItem,R=(S==null?void 0:S.event.identifier)===a;this.updateSchedule();const H=(r=this.bufferingItem)==null?void 0:r.event;if(R){var j;const Q=this.schedule.findEventIndex(a),Y=(j=this.schedule.items)==null?void 0:j[Q];if(Y){if(!this.playingItem&&this.timelinePos>Y.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==Q){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.updateSchedule(!0),this.primaryFallback(n);return}this.setBufferingItem(Y)}this.setSchedulePosition(Q)}else if((H==null?void 0:H.identifier)===a){const Q=n.assetList[0];if(Q){const Y=this.getAssetPlayer(Q.identifier);if(H.appendInPlace){const te=this.primaryMedia;Y&&te&&this.bufferAssetPlayer(Y,te)}else Y&&Y.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case w.ASSET_LIST_PARSING_ERROR:case w.ASSET_LIST_LOAD_ERROR:case w.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&(this.updateSchedule(!0),this.primaryFallback(i));break}case w.BUFFER_STALLED_ERROR:{const i=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&i.event.appendInPlace){this.handleInPlaceStall(i.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const xo=500;class Lc extends ds{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",v.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(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=qe.IDLE,this.setInterval(xo),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:r}=t;if(this.fragContextChanged(i)||(pe(i)&&(this.fragPrevious=i),this.state=qe.IDLE),!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const u=i.start;for(let p=0;p<n.length;p++)if(u>=n[p].start&&u<=n[p].end){a=n[p];break}const g=i.start+i.duration;a?a.end=g:(a={start:u,end:g},n.push(a)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let u=0;u<a.length;){if(a[u].end<=n){a.shift();continue}else if(a[u].start<n)a[u].start=n;else break;u++}}),this.fragmentTracker.removeFragmentsInRange(i,n,v.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===v.SUBTITLE&&(t.details===w.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==qe.STOPPED&&(this.state=qe.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Qa(this.levels,t)){this.levels=t.map(i=>new Si(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new Si(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,v.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 r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==qe.STOPPED&&this.setInterval(xo)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:r,levels:n}=this,{details:a,id:u}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${u}`);return}const g=n[u];if(u>=n.length||!g)return;this.log(`Subtitle track ${u} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let p=0;if(a.live||(i=g.details)!=null&&i.live){if(a.deltaUpdateFailed)return;const S=this.mainDetails;if(!S){this.startFragRequested=!1;return}const R=S.fragments[0];if(!g.details)a.hasProgramDateTime&&S.hasProgramDateTime?(jn(a,S),p=a.fragmentStart):R&&(p=R.start,fs(a,p));else{var m;p=this.alignPlaylists(a,g.details,(m=this.levelLastLoaded)==null?void 0:m.details),p===0&&R&&(p=R.start,fs(a,p))}S&&!this.startFragRequested&&this.setStartPosition(S,p)}g.details=a,this.levelLastLoaded=g,u===r&&(this.hls.trigger(_.SUBTITLE_TRACK_UPDATED,{details:a,id:u,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===qe.IDLE&&(zi(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r!=null&&r.key&&r.iv&&hr(r.method)){const a=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer,Ri(r.method)).catch(u=>{throw n.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:t}),u}).then(u=>{const g=performance.now();n.trigger(_.FRAG_DECRYPTED,{frag:t,payload:u,stats:{tstart:a,tdecrypt:g}})}).catch(u=>{this.warn(`${u.name}: ${u.message}`),this.state=qe.IDLE})}}doTick(){if(!this.media){this.state=qe.IDLE;return}if(this.state===qe.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:r}=this,n=this.getLoadPosition(),a=It.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:u,len:g}=a,p=i.details,m=this.hls.maxBufferLength+p.levelTargetDuration;if(g>m)return;const S=p.fragments,R=S.length,H=p.edge;let j=null;const Q=this.fragPrevious;if(u<H){const ce=r.maxFragLookUpTolerance,ae=u>H-ce?0:ce;j=zi(Q,S,Math.max(S[0].start,u),ae),!j&&Q&&Q.start<S[0].start&&(j=S[0])}else j=S[R-1];if(j=this.filterReplacedPrimary(j,i.details),!j)return;const Y=j.sn-p.startSN,te=S[Y-1];if(te&&te.cc===j.cc&&this.fragmentTracker.getState(te)===ei.NOT_LOADED&&(j=te),this.fragmentTracker.getState(j)===ei.NOT_LOADED){const ce=this.mapToInitFragWhenRequired(j);ce&&this.loadFragment(ce,i,u)}}}loadFragment(e,t,i){pe(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Rc(this.tracksBuffered[this.currentTrackId]||[])}}class Rc{constructor(e){this.buffered=void 0;const t=(i,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][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 kc={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},Ao=o=>String.fromCharCode(kc[o]||o),ar=15,Pr=100,Ic={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Pc={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Oc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Fc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Mc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Bc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;M.log(`${this.time} [${e}] ${i}`)}}}const en=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Co{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 r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}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 Nc{constructor(){this.uchar=" ",this.penState=new Co}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 Uc{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Co,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Pr;t++)this.chars.push(new Nc);this.logger=e}equals(e){for(let t=0;t<Pr;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Pr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Pr;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>Pr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Pr)}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=Ao(e);if(this.pos>=Pr){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<Pr;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<Pr;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class $s{constructor(e){this.rows=[],this.currRow=ar-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<ar;t++)this.rows.push(new Uc(e));this.logger=e}reset(){for(let e=0;e<ar;e++)this.rows[e].clear();this.currRow=ar-1}equals(e){let t=!0;for(let i=0;i<ar;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<ar;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<ar;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 = "+Ft(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let u=0;u<ar;u++)this.rows[u].clear();const n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const u=a.rows[n].cueStartTime,g=this.logger.time;if(u!==null&&g!==null&&u<g)for(let p=0;p<this.nrRollUpRows;p++)this.rows[t-this.nrRollUpRows+p+1].copy(a.rows[n+p])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[a].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Ft(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="",r=-1;for(let n=0;n<ar;n++){const a=this.rows[n].getTextString();a&&(r=n+1,e?t.push("Row "+r+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
|
|
|
`)),i}getTextAndFormat(){return this.rows}}class To{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 $s(i),this.nonDisplayedMemory=new $s(i),this.lastOutputScreen=new $s(i),this.currRollUpRow=this.displayedMemory.rows[ar-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[ar-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,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}this.logger.log(2,"MIDROW: "+Ft(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 Do{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Hc(),this.logger=void 0;const r=this.logger=new Bc;this.channels=[null,new To(e,t,r),new To(e+1,i,r)]}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 r=t[i]&127,n=t[i+1]&127;let a=!1,u=null;if(r===0&&n===0)continue;this.logger.log(3,()=>"["+en([t[i],t[i+1]])+"] -> ("+en([r,n])+")");const g=this.cmdHistory;if(r>=16&&r<=31){if($c(r,n,g)){is(null,null,g),this.logger.log(3,()=>"Repeated command ("+en([r,n])+") is dropped");continue}is(r,n,this.cmdHistory),a=this.parseCmd(r,n),a||(a=this.parseMidrow(r,n)),a||(a=this.parsePAC(r,n)),a||(a=this.parseBackgroundAttributes(r,n))}else is(null,null,g);if(!a&&(u=this.parseChars(r,n),u)){const m=this.currentChannel;m&&m>0?this.channels[m].insertChars(u):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!u&&this.logger.log(2,()=>"Couldn't parse cleaned data "+en([r,n])+" orig: "+en([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(i||r))return!1;const n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=n,!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 r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+en([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(r||n))return!1;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?Ic[e]:Oc[e]:i=a===1?Pc[e]:Fc[e];const u=this.channels[a];return u?(u.setPAC(this.interpretPAC(i,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,r.underline=(i&1)===1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((i-16)/2)*4,r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let a;n===17?a=t+80:n===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+Ao(a)+"' in channel "+i),r=[a]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+en(r).join(",")),r}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(i||r))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=Mc[n],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const u=e<=23?1:2;return this.channels[u].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}is(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 is(o,e,t){t.a=o,t.b=e}function $c(o,e,t){return t.a===o&&t.b===e}function Hc(){return{a:null,b:null}}var Hs=function(){if(Lr!=null&&Lr.VTTCue)return self.VTTCue;const o=["","lr","rl"],e=["start","middle","end","left","right"];function t(u,g){if(typeof g!="string"||!Array.isArray(u))return!1;const p=g.toLowerCase();return~u.indexOf(p)?p:!1}function i(u){return t(o,u)}function r(u){return t(e,u)}function n(u,...g){let p=1;for(;p<arguments.length;p++){const m=arguments[p];for(const S in m)u[S]=m[S]}return u}function a(u,g,p){const m=this,S={enumerable:!0};m.hasBeenReset=!1;let R="",H=!1,j=u,Q=g,Y=p,te=null,ce="",ae=!0,Ee="auto",Te="start",$e=50,xe="middle",Ie=50,Pe="middle";Object.defineProperty(m,"id",n({},S,{get:function(){return R},set:function(Ae){R=""+Ae}})),Object.defineProperty(m,"pauseOnExit",n({},S,{get:function(){return H},set:function(Ae){H=!!Ae}})),Object.defineProperty(m,"startTime",n({},S,{get:function(){return j},set:function(Ae){if(typeof Ae!="number")throw new TypeError("Start time must be set to a number.");j=Ae,this.hasBeenReset=!0}})),Object.defineProperty(m,"endTime",n({},S,{get:function(){return Q},set:function(Ae){if(typeof Ae!="number")throw new TypeError("End time must be set to a number.");Q=Ae,this.hasBeenReset=!0}})),Object.defineProperty(m,"text",n({},S,{get:function(){return Y},set:function(Ae){Y=""+Ae,this.hasBeenReset=!0}})),Object.defineProperty(m,"region",n({},S,{get:function(){return te},set:function(Ae){te=Ae,this.hasBeenReset=!0}})),Object.defineProperty(m,"vertical",n({},S,{get:function(){return ce},set:function(Ae){const ze=i(Ae);if(ze===!1)throw new SyntaxError("An invalid or illegal string was specified.");ce=ze,this.hasBeenReset=!0}})),Object.defineProperty(m,"snapToLines",n({},S,{get:function(){return ae},set:function(Ae){ae=!!Ae,this.hasBeenReset=!0}})),Object.defineProperty(m,"line",n({},S,{get:function(){return Ee},set:function(Ae){if(typeof Ae!="number"&&Ae!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Ee=Ae,this.hasBeenReset=!0}})),Object.defineProperty(m,"lineAlign",n({},S,{get:function(){return Te},set:function(Ae){const ze=r(Ae);if(!ze)throw new SyntaxError("An invalid or illegal string was specified.");Te=ze,this.hasBeenReset=!0}})),Object.defineProperty(m,"position",n({},S,{get:function(){return $e},set:function(Ae){if(Ae<0||Ae>100)throw new Error("Position must be between 0 and 100.");$e=Ae,this.hasBeenReset=!0}})),Object.defineProperty(m,"positionAlign",n({},S,{get:function(){return xe},set:function(Ae){const ze=r(Ae);if(!ze)throw new SyntaxError("An invalid or illegal string was specified.");xe=ze,this.hasBeenReset=!0}})),Object.defineProperty(m,"size",n({},S,{get:function(){return Ie},set:function(Ae){if(Ae<0||Ae>100)throw new Error("Size must be between 0 and 100.");Ie=Ae,this.hasBeenReset=!0}})),Object.defineProperty(m,"align",n({},S,{get:function(){return Pe},set:function(Ae){const ze=r(Ae);if(!ze)throw new SyntaxError("An invalid or illegal string was specified.");Pe=ze,this.hasBeenReset=!0}})),m.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class jc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Lo(o){function e(i,r,n,a){return(i|0)*3600+(r|0)*60+(n|0)+parseFloat(a||0)}const t=o.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 Wc{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 r=0;r<i.length;++r)if(t===i[r]){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 Ro(o,e,t,i){const r=i?o.split(i):[o];for(const n in r){if(typeof r[n]!="string")continue;const a=r[n].split(t);if(a.length!==2)continue;const u=a[0],g=a[1];e(u,g)}}const js=new Hs(0,0,""),rs=js.align==="middle"?"middle":"center";function Gc(o,e,t){const i=o;function r(){const u=Lo(o);if(u===null)throw new Error("Malformed timestamp: "+i);return o=o.replace(/^[^\sa-zA-Z-]+/,""),u}function n(u,g){const p=new Wc;Ro(u,function(R,H){let j;switch(R){case"region":for(let Q=t.length-1;Q>=0;Q--)if(t[Q].id===H){p.set(R,t[Q].region);break}break;case"vertical":p.alt(R,H,["rl","lr"]);break;case"line":j=H.split(","),p.integer(R,j[0]),p.percent(R,j[0])&&p.set("snapToLines",!1),p.alt(R,j[0],["auto"]),j.length===2&&p.alt("lineAlign",j[1],["start",rs,"end"]);break;case"position":j=H.split(","),p.percent(R,j[0]),j.length===2&&p.alt("positionAlign",j[1],["start",rs,"end","line-left","line-right","auto"]);break;case"size":p.percent(R,H);break;case"align":p.alt(R,H,["start",rs,"end","left","right"]);break}},/:/,/\s/),g.region=p.get("region",null),g.vertical=p.get("vertical","");let m=p.get("line","auto");m==="auto"&&js.line===-1&&(m=-1),g.line=m,g.lineAlign=p.get("lineAlign","start"),g.snapToLines=p.get("snapToLines",!0),g.size=p.get("size",100),g.align=p.get("align",rs);let S=p.get("position","auto");S==="auto"&&js.position===50&&(S=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=S}function a(){o=o.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),o.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);o=o.slice(3),a(),e.endTime=r(),a(),n(o,e)}function ko(o){return o.replace(/<br(?: \/)?>/gi,`
|
|
|
`)}class Kc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new jc,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 n=t.buffer,a=0;for(n=ko(n);a<n.length&&n[a]!=="\r"&&n[a]!==`
|
|
|
`;)++a;const u=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===`
|
|
|
`&&++a,t.buffer=n.slice(a),u}function r(n){Ro(n,function(a,u){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();const u=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(u!=null&&u[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:n=i(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new Hs(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Gc(n,t.cue,t.regionList)}catch(u){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const u=n.indexOf("-->")!==-1;if(!n||u&&(a=!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+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch(n){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 zc=/\r\n|\n\r|\n|\r/g,Ws=function(e,t,i=0){return e.slice(i,i+t.length)===t},Vc=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!I(t)||!I(i)||!I(r)||!I(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t};function Gs(o,e,t){return Un(o.toString())+Un(e.toString())+Un(t)}const qc=function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(a=n)!=null&&a.new;){var a;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i};function Yc(o,e,t,i,r,n,a){const u=new Kc,g=ue(new Uint8Array(o)).trim().replace(zc,`
|
|
|
`).split(`
|
|
|
`),p=[],m=e?su(e.baseTime,e.timescale):0;let S="00:00.000",R=0,H=0,j,Q=!0;u.oncue=function(Y){const te=t[i];let ce=t.ccOffset;const ae=(R-m)/9e4;if(te!=null&&te.new&&(H!==void 0?ce=t.ccOffset=te.start:qc(t,i,ae)),ae){if(!e){j=new Error("Missing initPTS for VTT MPEGTS");return}ce=ae-t.presentationOffset}const Ee=Y.endTime-Y.startTime,Te=Zi((Y.startTime+ce-H)*9e4,r*9e4)/9e4;Y.startTime=Math.max(Te,0),Y.endTime=Math.max(Te+Ee,0);const $e=Y.text.trim();Y.text=decodeURIComponent(encodeURIComponent($e)),Y.id||(Y.id=Gs(Y.startTime,Y.endTime,$e)),Y.endTime>0&&p.push(Y)},u.onparsingerror=function(Y){j=Y},u.onflush=function(){if(j){a(j);return}n(p)},g.forEach(Y=>{if(Q)if(Ws(Y,"X-TIMESTAMP-MAP=")){Q=!1,Y.slice(16).split(",").forEach(te=>{Ws(te,"LOCAL:")?S=te.slice(6):Ws(te,"MPEGTS:")&&(R=parseInt(te.slice(7)))});try{H=Vc(S)/1e3}catch(te){j=te}return}else Y===""&&(Q=!1);u.parse(Y+`
|
|
|
`)}),u.flush()}const Ks="stpp.ttml.im1t",Io=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Po=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Zc={left:"start",center:"center",right:"end",start:"start",end:"end"};function Oo(o,e,t,i){const r=le(new Uint8Array(o),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(u=>ue(u)),a=nu(e.baseTime,1,e.timescale);try{n.forEach(u=>t(Xc(u,a)))}catch(u){i(u)}}function Xc(o,e){const r=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((S,R)=>(S[R]=r.getAttribute(`ttp:${R}`)||n[R],S),{}),u=r.getAttribute("xml:space")!=="preserve",g=Fo(zs(r,"styling","style")),p=Fo(zs(r,"layout","region")),m=zs(r,"body","[begin]");return[].map.call(m,S=>{const R=Mo(S,u);if(!R||!S.hasAttribute("begin"))return null;const H=qs(S.getAttribute("begin"),a),j=qs(S.getAttribute("dur"),a);let Q=qs(S.getAttribute("end"),a);if(H===null)throw Bo(S);if(Q===null){if(j===null)throw Bo(S);Q=H+j}const Y=new Hs(H-e,Q-e,R);Y.id=Gs(Y.startTime,Y.endTime,Y.text);const te=p[S.getAttribute("region")],ce=g[S.getAttribute("style")],ae=Qc(te,ce,g),{textAlign:Ee}=ae;if(Ee){const Te=Zc[Ee];Te&&(Y.lineAlign=Te),Y.align=Ee}return c(Y,ae),Y}).filter(S=>S!==null)}function zs(o,e,t){const i=o.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Fo(o){return o.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Mo(o,e){return[].slice.call(o.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+`
|
|
|
`:(n=i.childNodes)!=null&&n.length?Mo(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function Qc(o,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=o!=null&&o.hasAttribute("style")?o.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(r=t[a]),n.reduce((u,g)=>{const p=Vs(e,i,g)||Vs(o,i,g)||Vs(r,i,g);return p&&(u[g]=p),u},{})}function Vs(o,e,t){return o&&o.hasAttributeNS(e,t)?o.getAttributeNS(e,t):null}function Bo(o){return new Error(`Could not parse ttml timestamp ${o}`)}function qs(o,e){if(!o)return null;let t=Lo(o);return t===null&&(Io.test(o)?t=Jc(o,e):Po.test(o)&&(t=eh(o,e))),t}function Jc(o,e){const t=Io.exec(o),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 eh(o,e){const t=Po.exec(o),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 ns{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 th{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=$o(),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(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new ns(this,"textTrack1"),t=new ns(this,"textTrack2"),i=new ns(this,"textTrack3"),r=new ns(this,"textTrack4");this.cea608Parser1=new Do(1,e,t),this.cea608Parser2=new Do(3,i,r)}addCues(e,t,i,r,n){let a=!1;for(let u=n.length;u--;){const g=n[u],p=ih(g[0],g[1],t,i);if(p>=0&&(g[0]=Math.min(g[0],t),g[1]=Math.max(g[1],i),a=!0,p/(i-t)>.5))return}if(a||n.push([t,i]),this.config.renderTextTracksNatively){const u=this.captionsTracks[e];this.Cues.newCue(u,t,i,r)}else{const u=this.Cues.newCue(null,t,i,r);this.hls.trigger(_.CUES_PARSED,{type:"captions",cues:u,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n,trackId:a}){const{unparsedVttFrags:u}=this;i===v.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:n,trackId:a}),u.length&&(this.unparsedVttFrags=[],u.forEach(g=>{this.initPTS[g.frag.cc]?this.onFragLoaded(_.FRAG_LOADED,g):this.hls.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){const n=i.textTracks[r];if(Uo(n,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return n}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:r}=this,{label:n,languageCode:a}=t[e],u=this.getExistingTrack(n,a);if(u)i[e]=u,yn(i[e]),yo(i[e],r);else{const g=this.createTextTrack("captions",n,a);g&&(g[e]=!0,i[e]=g)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,r={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(_.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,i){const r=this.media;if(r)return r.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:r}=this;Object.keys(r).forEach(n=>{yn(r[n]),delete r[n]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=$o(),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++)yn(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===Ks);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(Qa(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const a=this.media,u=a?Jn(a.textTracks):null;if(this.tracks.forEach((g,p)=>{let m;if(u){let S=null;for(let R=0;R<u.length;R++)if(u[R]&&Uo(u[R],g)){S=u[R],u[R]=null;break}S&&(m=S)}if(m)yn(m);else{const S=No(g);m=this.createTextTrack(S,g.name,g.lang),m&&(m.mode="disabled")}m&&this.textTracks.push(m)}),u!=null&&u.length){const g=u.filter(p=>p!==null).map(p=>p.label);g.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${g.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(u=>({label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}));this.hls.trigger(_.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,a=this.captionsProperties[n];a&&(a.label=i.name,i.lang&&(a.languageCode=i.lang),a.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===v.MAIN){var i,r;const{cea608Parser1:n,cea608Parser2:a,lastSn:u}=this,{cc:g,sn:p}=t.frag,m=(i=(r=t.part)==null?void 0:r.index)!=null?i:-1;n&&a&&(p!==u+1||p===u&&m!==this.lastPartIndex+1||g!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=g,this.lastSn=p,this.lastPartIndex=m}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===v.SUBTITLE)if(r.byteLength){const n=i.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const u=this.tracks[i.level],g=this.vttCCs;g[i.cc]||(g[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),u&&u.textCodec===Ks?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Oo(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{i.logger.log(`Failed to parse IMSC1: ${r}`),i.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:a}=this,u=n.length-1;if(!n[i.cc]&&u===-1){a.push(e);return}const g=this.hls,p=(t=i.initSegment)!=null&&t.data?Ge(i.initSegment.data,new Uint8Array(r)).buffer:r;Yc(p,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,m=>{this._appendCues(m,i.level),g.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},m=>{const S=m.message==="Missing initPTS for VTT MPEGTS";S?a.push(e):this._fallbackToIMSC1(i,r),g.logger.log(`Failed to parse VTT cue: ${m}`),!(S&&u>i.cc)&&g.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:m})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Oo(t,this.initPTS[e.cc],()=>{i.textCodec=Ks,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>bo(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(_.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===v.SUBTITLE&&this.onFragLoaded(_.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:r}=t;if(!(i.type===v.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let n=0;n<r.length;n++){const a=r[n].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();const u=this.extractCea608Data(a);this.cea608Parser1.addData(r[n].pts,u[0]),this.cea608Parser2.addData(r[n].pts,u[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:n}){const{media:a}=this;if(!(!a||a.currentTime<i)){if(!n||n==="video"){const{captionsTracks:u}=this;Object.keys(u).forEach(g=>Bs(u[g],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:u}=this;Object.keys(u).forEach(g=>Bs(u[g],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let n=0;n<i;n++){const a=e[r++],u=127&e[r++],g=127&e[r++];if(u===0&&g===0)continue;if((4&a)!==0){const m=3&a;(m===0||m===1)&&(t[m].push(u),t[m].push(g))}}return t}}function No(o){return o.characteristics&&/transcribes-spoken-dialog/gi.test(o.characteristics)&&/describes-music-and-sound/gi.test(o.characteristics)?"captions":"subtitles"}function Uo(o,e){return!!o&&o.kind===No(e)&&Ls(e,o)}function ih(o,e,t,i){return Math.min(e,i)-Math.max(o,t)}function $o(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const rh=/\s/,nh={newCue(o,e,t,i){const r=[];let n,a,u,g,p;const m=self.VTTCue||self.TextTrackCue;for(let R=0;R<i.rows.length;R++)if(n=i.rows[R],u=!0,g=0,p="",!n.isEmpty()){var S;for(let Q=0;Q<n.chars.length;Q++)rh.test(n.chars[Q].uchar)&&u?g++:(p+=n.chars[Q].uchar,u=!1);n.cueStartTime=e,e===t&&(t+=1e-4),g>=16?g--:g++;const H=ko(p.trim()),j=Gs(e,t,H);o!=null&&(S=o.cues)!=null&&S.getCueById(j)||(a=new m(e,t,H),a.id=j,a.line=R+1,a.align="left",a.position=10+Math.min(80,Math.floor(g*8/32)*10),r.push(a))}return o&&r.length&&(r.sort((R,H)=>R.line==="auto"||H.line==="auto"?0:R.line>8&&H.line>8?H.line-R.line:R.line-H.line),r.forEach(R=>bo(o,R))),r}};function sh(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(o){}return!1}const ah=/(\d+)-(\d+)\/(\d+)/;class Ho{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||ch,this.controller=new self.AbortController,this.stats=new C}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 r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=oh(e,this.controller.signal),a=e.responseType==="arraybuffer",u=a?"byteLength":"length",{maxTimeToFirstByteMs:g,maxLoadTimeMs:p}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=g&&I(g)?g:p,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(Bn(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(S=>{var R;this.response=this.loader=S;const H=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=p,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},p-(H-r.loading.start)),!S.ok){const{status:Q,statusText:Y}=S;throw new hh(Y||"fetch, bad network response",Q,S)}r.loading.first=H,r.total=uh(S.headers)||r.total;const j=(R=this.callbacks)==null?void 0:R.onProgress;return j&&I(t.highWaterMark)?this.loadProgressively(S,r,e,t.highWaterMark,j):a?S.arrayBuffer():e.responseType==="json"?S.json():S.text()}).then(S=>{var R,H;const j=this.response;if(!j)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const Q=S[u];Q&&(r.loaded=r.total=Q);const Y={url:j.url,data:S,code:j.status},te=(R=this.callbacks)==null?void 0:R.onProgress;te&&!I(t.highWaterMark)&&te(r,e,S,j),(H=this.callbacks)==null||H.onSuccess(Y,r,e,j)}).catch(S=>{var R;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const H=S&&S.code||0,j=S?S.message:null;(R=this.callbacks)==null||R.onError({code:H,text:j},e,S?S.details:null,r)})}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,r=0,n){const a=new Aa,u=e.body.getReader(),g=()=>u.read().then(p=>{if(p.done)return a.dataLength&&n(t,i,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const m=p.value,S=m.length;return t.loaded+=S,S<r||a.dataLength?(a.push(m),a.dataLength>=r&&n(t,i,a.flush().buffer,e)):n(t,i,m.buffer,e),g()}).catch(()=>Promise.reject());return g()}}function oh(o,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(c({},o.headers))};return o.rangeEnd&&t.headers.set("Range","bytes="+o.rangeStart+"-"+String(o.rangeEnd-1)),t}function lh(o){const e=ah.exec(o);if(e)return parseInt(e[2])-parseInt(e[1])+1}function uh(o){const e=o.get("Content-Range");if(e){const i=lh(e);if(I(i))return i}const t=o.get("Content-Length");if(t)return parseInt(t)}function ch(o,e){return new self.Request(o.url,e)}class hh extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const fh=/^age:\s*[\d.]+\s*$/im;class jo{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 C,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,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return n(i,t.url)}).catch(a=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),n(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(a=>{var u;(u=this.callbacks)==null||u.onError({code:i.status,text:a.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=i.loadPolicy;if(r)for(const u in r)e.setRequestHeader(u,r[u]);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=n&&I(n)?n:a,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 r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const p=t.status,m=t.responseType==="text"?t.responseText:null;if(p>=200&&p<300){const j=m!=null?m:t.response;if(j!=null){var a,u;i.loading.end=Math.max(self.performance.now(),i.loading.first);const Q=t.responseType==="arraybuffer"?j.byteLength:j.length;i.loaded=i.total=Q,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const Y=(a=this.callbacks)==null?void 0:a.onProgress;Y&&Y(i,e,j,t);const te={url:t.responseURL,data:j,code:p};(u=this.callbacks)==null||u.onSuccess(te,i,e,t);return}}const S=n.loadPolicy.errorRetry,R=i.retry,H={url:e.url,data:void 0,code:p};if(qi(S,R,!1,H))this.retry(S);else{var g;M.error(`${p} while loading ${e.url}`),(g=this.callbacks)==null||g.onError({code:p,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(qi(e,t,!0))this.retry(e);else{var i;M.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Or(e,i.retry),i.retry++,M.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&&fh.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 dh={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},ph=h(h({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:jo,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:er,bufferController:bu,capLevelController:ks,errorController:Vr,fpsController:mc,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:ni,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:dh},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},_h()),{},{subtitleStreamController:Lc,subtitleTrackController:bc,timelineController:th,audioStreamController:gu,audioTrackController:mu,emeController:vn,cmcdController:pc,contentSteeringController:gc,interstitialsController:Dc});function _h(){return{cueHandler:nh,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 gh(o,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=Ys(o),r=["manifest","level","frag"],n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(a=>{const u=`${a==="level"?"playlist":a}LoadPolicy`,g=e[u]===void 0,p=[];n.forEach(m=>{const S=`${a}Loading${m}`,R=e[S];if(R!==void 0&&g){p.push(S);const H=i[u].default;switch(e[u]={default:H},m){case"TimeOut":H.maxLoadTimeMs=R,H.maxTimeToFirstByteMs=R;break;case"MaxRetry":H.errorRetry.maxNumRetry=R,H.timeoutRetry.maxNumRetry=R;break;case"RetryDelay":H.errorRetry.retryDelayMs=R,H.timeoutRetry.retryDelayMs=R;break;case"MaxRetryTimeout":H.errorRetry.maxRetryDelayMs=R,H.timeoutRetry.maxRetryDelayMs=R;break}}}),p.length&&t.warn(`hls.js config: "${p.join('", "')}" setting(s) are deprecated, use "${u}": ${Ft(e[u])}`)}),h(h({},i),e)}function Ys(o){return o&&typeof o=="object"?Array.isArray(o)?o.map(Ys):Object.keys(o).reduce((e,t)=>(e[t]=Ys(o[t]),e),{}):o}function mh(o,e){const t=o.loader;t!==Ho&&t!==jo?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),o.progressive=!1):sh()&&(o.loader=Ho,o.progressive=!0,o.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const ss=2,vh=.1,yh=.05,bh=100;class Eh extends Tr{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,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(_.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.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(bh),this.mediaSource=t.mediaSource;const i=this.media=t.media;Mi(i,"playing",this.onMediaPlaying),Mi(i,"waiting",this.onMediaWaiting),Mi(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(Hi(i,"playing",this.onMediaPlaying),Hi(i,"waiting",this.onMediaWaiting),Hi(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,r;const n=(i=this.hls)==null?void 0:i.config;if(!n)return;const a=this.media;if(!a)return;const{seeking:u}=a,g=this.seeking&&!u,p=!this.seeking&&u,m=a.paused&&!u||a.ended||a.playbackRate===0;if(this.seeking=u,e!==t){t&&(this.ended=0),this.moved=!0,u||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!m&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(p||g){g&&this.stallResolved(e);return}if(m){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(_.MEDIA_ENDED,{stalled:!1}));return}if(!It.getBuffered(a).length){this.nudgeRetry=0;return}const S=It.bufferInfo(a,e,0),R=S.nextStart||0,H=this.fragmentTracker;if(u&&H&&this.hls){const $e=Wo(this.hls.inFlightFragments,e),xe=S.len>ss,Ie=!R||$e||R-e>ss&&!H.getPartialFragment(e);if(xe||Ie)return;this.moved=!1}const j=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&H){if(!(S.len>0)&&!R)return;const xe=Math.max(R,S.start||0)-e,Pe=!!(j!=null&&j.live)?j.targetduration*2:ss,Ae=as(e,H);if(xe>0&&(xe<=Pe||Ae)){a.paused||this._trySkipBufferHole(Ae);return}}const Q=n.detectStallWithCurrentTimeMs,Y=self.performance.now(),te=this.waiting;let ce=this.stalled;if(ce===null)if(te>0&&Y-te<Q)ce=this.stalled=te;else{this.stalled=Y;return}const ae=Y-ce;if(!u&&(ae>=Q||te)&&this.hls){var Ee;if(((Ee=this.mediaSource)==null?void 0:Ee.readyState)==="ended"&&!(j!=null&&j.live)&&Math.abs(e-((j==null?void 0:j.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(_.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(S),!this.media||!this.hls)return}const Te=It.bufferInfo(a,e,n.maxBufferHole);this._tryFixBufferStall(Te,ae,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(_.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&r&&r.length>1&&e>r.end(0)){const n=It.bufferedInfo(It.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){const a=It.timeRangesToArray(r),u=It.bufferedInfo(a,t,0).bufferedIndex;if(u>-1&&u<a.length-1){const g=It.bufferedInfo(a,e,0).bufferedIndex,p=a[u].end,m=a[u+1].start;if((g===-1||g>u)&&m-p<1&&e-p<2){const S=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${p} -> ${m} buffered index: ${g}`);this.warn(S.message),this.media.currentTime+=1e-6;let R=as(e,this.fragmentTracker);R&&"fragment"in R?R=R.fragment:R||(R=void 0);const H=It.bufferInfo(this.media,e,0);this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:S,reason:S.message,frag:R,buffer:H.len,bufferInfo:H})}}}}}_tryFixBufferStall(e,t,i){var r,n;const{fragmentTracker:a,media:u}=this,g=(r=this.hls)==null?void 0:r.config;if(!u||!a||!g)return;const p=(n=this.hls)==null?void 0:n.latestLevelDetails,m=as(i,a);if((m||p!=null&&p.live&&i<p.fragmentStart)&&(this._trySkipBufferHole(m)||!this.media))return;const S=e.buffered,R=this.adjacentTraversal(e,i);(S&&S.length>1&&e.len>g.maxBufferHole||e.nextStart&&(e.nextStart-i<g.maxBufferHole||R))&&(t>g.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,r=e.nextStart;if(i&&r){const n=i.getFragAtPos(t,v.MAIN),a=i.getFragAtPos(r,v.MAIN);if(n&&a)return a.sn-n.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:r,stalled:n}=this;if(!r&&n!==null&&i&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${Ft(e)})`);this.warn(a.message),t.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:n}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:r}=this,n=(t=this.hls)==null?void 0:t.config;if(!r||!i||!n)return 0;const a=r.currentTime,u=It.bufferInfo(r,a,0),g=a<u.start?u.start:u.nextStart;if(g&&this.hls){const m=u.len<=n.maxBufferHole,S=u.len>0&&u.len<1&&r.readyState<3,R=g-a;if(R>0&&(m||S)){if(R>n.maxBufferHole){let j=!1;if(a===0){const Q=i.getAppendedFrag(0,v.MAIN);Q&&g<Q.end&&(j=!0)}if(!j&&e){var p;if(!((p=this.hls.loadLevelObj)!=null&&p.details)||Wo(this.hls.inFlightFragments,g))return 0;let Y=!1,te=e.end;for(;te<g;){const ce=as(te,i);if(ce)te+=ce.duration;else{Y=!0;break}}if(Y)return 0}}const H=Math.max(g+yh,a+vh);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${H}`),this.moved=!0,r.currentTime=H,!(e!=null&&e.gap)){const j=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${H}`),Q={type:D.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:j,reason:j.message,buffer:u.len,bufferInfo:u};e&&("fragment"in e?Q.part=e:Q.frag=e),this.hls.trigger(_.ERROR,Q)}return H}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:r}=this,n=t==null?void 0:t.config;if(!i||!n)return 0;const a=i.currentTime;if(this.nudgeRetry++,r<n.nudgeMaxRetry){const u=a+(r+1)*n.nudgeOffset,g=new Error(`Nudging 'currentTime' from ${a} to ${u}`);this.warn(g.message),i.currentTime=u,t.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_NUDGE_ON_STALL,error:g,fatal:!1,buffer:e.len,bufferInfo:e})}else{const u=new Error(`Playhead still not moving while enough data buffered @${a} after ${n.nudgeMaxRetry} nudges`);this.error(u.message),t.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,error:u,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Wo(o,e){const t=Go(o.main);if(t&&t.start<=e)return t;const i=Go(o.audio);return i&&i.start<=e?i:null}function Go(o){if(!o)return null;switch(o.state){case qe.IDLE:case qe.STOPPED:case qe.ENDED:case qe.ERROR:return null}return o.frag}function as(o,e){return e.getAppendedFrag(o,v.MAIN)||e.getPartialFragment(o)}const Sh=.25;function Zs(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Xs(o,e,t,i,r){let n=new o(e,t,"");try{n.value=i,r&&(n.type=r)}catch(a){n=new o(e,t,Ft(r?h({type:r},i):i))}return n}const os=(()=>{const o=Zs();try{o&&new o(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class wh{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(_.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&&(e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.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(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&yn(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 yo(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:r}=this.hls.config;if(!i&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=Zs();if(a)for(let u=0;u<n.length;u++){const g=n[u].type;if(g===Ki.emsg&&!i||!r)continue;const p=Pa(n[u].data),m=n[u].pts;let S=m+n[u].duration;S>os&&(S=os),S-m<=0&&(S=m+Sh);for(let H=0;H<p.length;H++){const j=p[H];if(!Oa(j)){this.updateId3CueEnds(m,g);const Q=Xs(a,m,S,j,g);Q&&this.id3Track.addCue(Q)}}}}updateId3CueEnds(e,t){var i;const r=(i=this.id3Track)==null?void 0:i.cues;if(r)for(let n=r.length;n--;){const a=r[n];a.type===t&&a.startTime<e&&a.endTime===os&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:u,enableID3MetadataCues:g}}=a;if(n&&(u||g)){let p;r==="audio"?p=m=>m.type===Ki.audioId3&&g:r==="video"?p=m=>m.type===Ki.emsg&&u:p=m=>m.type===Ki.audioId3&&g||m.type===Ki.emsg&&u,Bs(n,t,i,p)}}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.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:r,enableDateRangeMetadataCues:n,interstitialsController:a}=this.hls.config;if(!n)return;const u=Zs();if(i&&r&&!a){const{fragmentStart:Q,fragmentEnd:Y}=e;let te=this.assetCue;te?(te.startTime=Q,te.endTime=Y):u&&(te=this.assetCue=Xs(u,Q,Y,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),te&&(te.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(te),te.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:g}=this,{dateRanges:p}=e,m=Object.keys(p);let S=this.dateRangeCuesAppended;if(g&&t){var R;if((R=g.cues)!=null&&R.length){const Q=Object.keys(S).filter(Y=>!m.includes(Y));for(let Y=Q.length;Y--;){var H;const te=Q[Y],ce=(H=S[te])==null?void 0:H.cues;delete S[te],ce&&Object.keys(ce).forEach(ae=>{const Ee=ce[ae];if(Ee){Ee.removeEventListener("enter",this.onEventCueEnter);try{g.removeCue(Ee)}catch(Te){}}})}}else S=this.dateRangeCuesAppended={}}const j=e.fragments[e.fragments.length-1];if(!(m.length===0||!I(j==null?void 0:j.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let Q=0;Q<m.length;Q++){const Y=m[Q],te=p[Y],ce=te.startTime,ae=S[Y],Ee=(ae==null?void 0:ae.cues)||{};let Te=(ae==null?void 0:ae.durationKnown)||!1,$e=os;const{duration:xe,endDate:Ie}=te;if(Ie&&xe!==null)$e=ce+xe,Te=!0;else if(te.endOnNext&&!Te){const Ae=m.reduce((ze,_t)=>{if(_t!==te.id){const xt=p[_t];if(xt.class===te.class&&xt.startDate>te.startDate&&(!ze||te.startDate<ze.startDate))return xt}return ze},null);Ae&&($e=Ae.startTime,Te=!0)}const Pe=Object.keys(te.attr);for(let Ae=0;Ae<Pe.length;Ae++){const ze=Pe[Ae];if(!Dn(ze))continue;const _t=Ee[ze];if(_t)Te&&!(ae!=null&&ae.durationKnown)?_t.endTime=$e:Math.abs(_t.startTime-ce)>.01&&(_t.startTime=ce,_t.endTime=$e);else if(u){let xt=te.attr[ze];fn(ze)&&(xt=z(xt));const At=Xs(u,ce,$e,{key:ze,data:xt},Ki.dateRange);At&&(At.id=Y,this.id3Track.addCue(At),Ee[ze]=At,a&&(ze==="X-ASSET-LIST"||ze==="X-ASSET-URL")&&At.addEventListener("enter",this.onEventCueEnter))}}S[Y]={cues:Ee,dateRange:te,durationKnown:Te}}}}}class xh{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 r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:a}=this.config;if(!n||a===1||!i.live)return;const u=this.targetLatency;if(u===null)return;const g=r-u,p=Math.min(this.maxLatency,u+i.targetduration);if(g<p&&g>.05&&this.forwardBufferLength>1){const S=Math.min(2,Math.max(1,a)),R=Math.round(2/(1+Math.exp(-.75*g-this.edgeStalled))*20)/20,H=Math.min(S,Math.max(1,R));this.changeMediaPlaybackRate(t,H)}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:r}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:u}=this.config,g=this.hls.userConfig;let p=u&&i||t;(this._targetLatencyUpdated||g.liveSyncDuration||g.liveSyncDurationCount||p===0)&&(p=n!==void 0?n:a*r);const m=r;return p+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,m)}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 r=i.edge,n=e-t-this.edgeStalled,a=r-i.totalduration,u=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,n),u)}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(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.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===w.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,r;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(r=this.targetLatency)==null?void 0:r.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 Ah extends Ds{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.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,r=[],n={},a={};let u=!1,g=!1,p=!1;t.levels.forEach(m=>{const S=m.attrs;let{audioCodec:R,videoCodec:H}=m;R&&(m.audioCodec=R=oe(R,i)||void 0),H&&(H=m.videoCodec=et(H));const{width:j,height:Q,unknownCodecs:Y}=m;let te=Y?Y.length:0;if(Y)for(let Ae=te;Ae--;){const ze=Y[Ae];this.isAudioSupported(ze)?(m.audioCodec=R=R?`${R},${ze}`:ze,te--,st.audio[R.substring(0,4)]=2):this.isVideoSupported(ze)&&(m.videoCodec=H=H?`${H},${ze}`:ze,te--,st.video[H.substring(0,4)]=2)}if(u||(u=!!(j&&Q)),g||(g=!!H),p||(p=!!R),te||R&&!this.isAudioSupported(R)||H&&!this.isVideoSupported(H)){this.log(`Some or all CODECS not supported "${S.CODECS}"`);return}const{CODECS:ce,"FRAME-RATE":ae,"HDCP-LEVEL":Ee,"PATHWAY-ID":Te,RESOLUTION:$e,"VIDEO-RANGE":xe}=S,Pe=`${`${Te||"."}-`}${m.bitrate}-${$e}-${ae}-${ce}-${xe}-${Ee}`;if(n[Pe])if(n[Pe].uri!==m.url&&!m.attrs["PATHWAY-ID"]){const Ae=a[Pe]+=1;m.attrs["PATHWAY-ID"]=new Array(Ae+1).join(".");const ze=this.createLevel(m);n[Pe]=ze,r.push(ze)}else n[Pe].addGroupId("audio",S.AUDIO),n[Pe].addGroupId("text",S.SUBTITLES);else{const Ae=this.createLevel(m);n[Pe]=Ae,a[Pe]=1,r.push(Ae)}}),this.filterAndSortMediaOptions(r,t,u,g,p)}createLevel(e){const t=new Si(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const r=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(r.message),t.supportedResult=oi(r,[])}return t}isAudioSupported(e){return Nt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Nt(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,r,n){let a=[],u=[],g=e;if((i||r)&&n&&(g=g.filter(({videoCodec:Y,videoRange:te,width:ce,height:ae})=>(!!Y||!!(ce&&ae))&&vi(te))),g.length===0){Promise.resolve().then(()=>{if(this.hls){let Y="no level with compatible codecs found in manifest",te=Y;t.levels.length&&(te=`one or more CODECS in variant not supported: ${Ft(t.levels.map(ae=>ae.attrs.CODECS).filter((ae,Ee,Te)=>Te.indexOf(ae)===Ee))}`,this.warn(te),Y+=` (${te})`);const ce=new Error(Y);this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:ce,reason:te})}});return}t.audioTracks&&(a=t.audioTracks.filter(Y=>!Y.audioCodec||this.isAudioSupported(Y.audioCodec)),Ko(a)),t.subtitles&&(u=t.subtitles,Ko(u));const p=g.slice(0);g.sort((Y,te)=>{if(Y.attrs["HDCP-LEVEL"]!==te.attrs["HDCP-LEVEL"])return(Y.attrs["HDCP-LEVEL"]||"")>(te.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&Y.height!==te.height)return Y.height-te.height;if(Y.frameRate!==te.frameRate)return Y.frameRate-te.frameRate;if(Y.videoRange!==te.videoRange)return bi.indexOf(Y.videoRange)-bi.indexOf(te.videoRange);if(Y.videoCodec!==te.videoCodec){const ce=Se(Y.videoCodec),ae=Se(te.videoCodec);if(ce!==ae)return ae-ce}if(Y.uri===te.uri&&Y.codecSet!==te.codecSet){const ce=_e(Y.codecSet),ae=_e(te.codecSet);if(ce!==ae)return ae-ce}return Y.averageBitrate!==te.averageBitrate?Y.averageBitrate-te.averageBitrate:0});let m=p[0];if(this.steering&&(g=this.steering.filterParsedLevels(g),g.length!==p.length)){for(let Y=0;Y<p.length;Y++)if(p[Y].pathwayId===g[0].pathwayId){m=p[Y];break}}this._levels=g;for(let Y=0;Y<g.length;Y++)if(g[Y]===m){var S;this._firstLevel=Y;const te=m.bitrate,ce=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${g.length} level(s) found, first bitrate: ${te}`),((S=this.hls.userConfig)==null?void 0:S.abrEwmaDefaultEstimate)===void 0){const ae=Math.min(te,this.hls.config.abrEwmaDefaultEstimateMax);ae>ce&&ce===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=ae)}break}const R=n&&!r,H=this.hls.config,j=!!(H.audioStreamController&&H.audioTrackController),Q={levels:g,audioTracks:a,subtitleTracks:u,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:j&&!R&&a.some(Y=>!!Y.url)};this.hls.trigger(_.MANIFEST_PARSED,Q)}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 m=new Error("invalid level idx"),S=e<0;if(this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.LEVEL_SWITCH_ERROR,level:e,fatal:S,error:m,reason:m.message}),S)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],u=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&r&&n===u)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${u?" with Pathway "+u:""} from level ${i}${n?" with Pathway "+n:""}`);const g={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(_.LEVEL_SWITCHING,g);const p=a.details;if(!p||p.live){const m=this.switchParams(a.uri,r==null?void 0:r.details,p);this.loadPlaylist(m)}}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(r=>t.indexOf(r)!==-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===F.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===v.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(n=>!!i[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,a=t.levelInfo;if(!a){var u;this.warn(`Invalid level index ${r}`),(u=t.deliveryDirectives)!=null&&u.skip&&(n.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let g=a.details;g===t.details&&g.advanced&&(g=void 0),this.playlistLoaded(r,t,g)}else(i=t.deliveryDirectives)!=null&&i.skip&&(n.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),r=this.currentLevelIndex,n=e.attrs["PATHWAY-ID"],a=e.details,u=a==null?void 0:a.age;this.log(`Loading level index ${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${n?" Pathway "+n:""}${u&&a.live?" age "+u.toFixed(1)+(a.type?" "+a.type||0:""):""} ${i}`),this.hls.trigger(_.LEVEL_LOADING,{url:i,level:r,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((n,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(n),n===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,n.details&&n.details.fragments.forEach(u=>u.level=-1)),!1));ya(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 r=i.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(_.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(_.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Ko(o){const e={};o.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function zo(){return self.SourceBuffer||self.WebKitSourceBuffer}function Vo(){if(!Z())return!1;const e=zo();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Ch(){if(!Vo())return!1;const o=Z();return typeof(o==null?void 0:o.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>o.isTypeSupported(Dt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>o.isTypeSupported(Dt(e,"audio"))))}function Th(){var o;const e=zo();return typeof(e==null||(o=e.prototype)==null?void 0:o.changeType)=="function"}const Dh=100;class Lh extends ds{constructor(e,t,i){super(e,t,i,"stream-controller",v.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 r=this.media,n=r?r.currentTime:null;if(n===null||!I(n)||(this.log(`Media seeked to ${n.toFixed(3)}`),!this.getBufferedFrag(n)))return;const a=this.getFwdBufferInfoAtPos(r,n,v.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${n} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.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:r}=this;if(this.stopLoad(),this.setInterval(Dh),this.level=-1,!this.startFragRequested){let n=r.startLevel;n===-1&&(r.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=r.firstAutoLevel),r.nextLoadLevel=n,this.level=r.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=qe.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=qe.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case qe.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e==null?void 0:e[t],r=i==null?void 0:i.details;if(r&&(!r.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(r))break;this.state=qe.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=qe.IDLE;break}break}case qe.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===qe.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:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[n]))return;const a=i[n],u=this.getMainFwdBufferInfo();if(u===null)return;const g=this.getLevelDetails();if(g&&this._streamEnded(u,g)){const Q={};this.altAudio===2&&(Q.type="video"),this.hls.trigger(_.BUFFER_EOS,Q),this.state=qe.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const p=a.details;if(!p||this.state===qe.WAITING_LEVEL||this.waitForLive(a)){this.level=n,this.state=qe.WAITING_LEVEL,this.startFragRequested=!1;return}const m=u.len,S=this.getMaxBufferLength(a.maxBitrate);if(m>=S)return;this.backtrackFragment&&this.backtrackFragment.start>u.end&&(this.backtrackFragment=null);const R=this.backtrackFragment?this.backtrackFragment.start:u.end;let H=this.getNextFragment(R,p);if(this.couldBacktrack&&!this.fragPrevious&&H&&pe(H)&&this.fragmentTracker.getState(H)!==ei.OK){var j;const Y=((j=this.backtrackFragment)!=null?j:H).sn-p.startSN,te=p.fragments[Y-1];te&&H.cc===te.cc&&(H=te,this.fragmentTracker.removeFragment(te))}else this.backtrackFragment&&u.len&&(this.backtrackFragment=null);if(H&&this.isLoopLoading(H,R)){if(!H.gap){const Y=this.audioOnly&&!this.altAudio?V.AUDIO:V.VIDEO,te=(Y===V.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;te&&this.afterBufferFlushed(te,Y,v.MAIN)}H=this.getNextFragmentLoopLoading(H,p,u,v.MAIN,S)}H&&(H.initSegment&&!H.initSegment.data&&!this.bitrateTest&&(H=H.initSegment),this.loadFragment(H,a,R))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);r===ei.NOT_LOADED||r===ei.PARTIAL?pe(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,v.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 r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const u=this.getMainFwdBufferInfo();if(!u||u.len<n.targetduration*2)return}if(!t.paused&&e){const u=this.hls.nextLoadLevel,g=e[u],p=this.fragLastKbps;p&&this.fragCurrent?i=this.fragCurrent.duration*g.maxBitrate/(1e3*p)+1:i=0}else i=0;const a=this.getBufferedFrag(t.currentTime+i);if(a){const u=this.followingBufferedFrag(a);if(u){this.abortCurrentFrag();const g=u.maxStartPTS?u.maxStartPTS:u.start,p=u.duration,m=Math.max(a.end,g+Math.min(Math.max(p-this.config.maxFragLookUpTolerance,p*(this.couldBacktrack?.5:.125)),p*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(m,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 qe.KEY_LOADING:case qe.FRAG_LOADING:case qe.FRAG_LOADING_WAITING_RETRY:case qe.PARSING:case qe.PARSED:this.state=qe.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;Mi(i,"playing",this.onMediaPlaying),Mi(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(Hi(i,"playing",this.onMediaPlaying),Hi(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(_.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,r=!1;for(let n=0;n<t.levels.length;n++){const a=t.levels[n].audioCodec;a&&(i=i||a.indexOf("mp4a.40.2")!==-1,r=r||a.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=i&&r&&!Th(),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!==qe.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=qe.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r,startFragRequested:n}=this,a=t.level,u=t.details,g=u.totalduration;if(!r){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${u.startSN},${u.endSN}]${u.lastPartSn?`[part-${u.lastPartSn}-${u.lastPartIndex}]`:""}, cc [${u.startCC}, ${u.endCC}] duration:${g}`);const p=t.levelInfo,m=this.fragCurrent;m&&(this.state===qe.FRAG_LOADING||this.state===qe.FRAG_LOADING_WAITING_RETRY)&&m.level!==t.level&&m.loader&&this.abortCurrentFrag();let S=0;if(u.live||(i=p.details)!=null&&i.live){var R;if(this.checkLiveUpdate(u),u.deltaUpdateFailed)return;S=this.alignPlaylists(u,p.details,(R=this.levelLastLoaded)==null?void 0:R.details)}if(p.details=u,this.levelLastLoaded=p,n||this.setStartPosition(u,S),this.hls.trigger(_.LEVEL_UPDATED,{details:u,level:a}),this.state===qe.WAITING_LEVEL){if(this.waitForCdnTuneIn(u))return;this.state=qe.IDLE}n&&u.live&&this.synchronizeToLiveEdge(u),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=this.getLoadPosition(),a=e.fragmentStart,u=e.edge,g=n>=a-t.maxFragLookUpTolerance&&n<=u;if(r!==null&&i.duration>r&&(n<r||!g)){const m=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!g&&i.readyState<4||n<u-m)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),i.readyState))if(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${u}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var p;const S=It.bufferInfo(i,r,0);if(!((p=S.buffered)!=null&&p.length)){i.currentTime=r;return}if(S.start<=n){i.currentTime=r;return}const{nextStart:H}=It.bufferedInfo(S.buffered,n,0);H&&(i.currentTime=H)}else i.currentTime=r}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:r,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const u=a[i.level];if(!u){this.warn(`Level ${i.level} not found on progress`);return}const g=u.details;if(!g){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const p=u.videoCodec,m=g.PTSKnown||!g.live,S=(t=i.initSegment)==null?void 0:t.data,R=this._getAudioCodec(u),H=this.transmuxer=this.transmuxer||new Za(this.hls,v.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),j=r?r.index:-1,Q=j!==-1,Y=new Fi(i.level,i.sn,i.stats.chunkCount,n.byteLength,j,Q),te=this.initPTS[i.cc];H.push(n,S,R,p,i,r,g.totalduration,m,Y,te)}onAudioTrackSwitching(e,t){const i=this.hls,r=this.altAudio===2;if(Er(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 a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.fragmentTracker.removeAllFragments(),i.once(_.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(_.AUDIO_TRACK_SWITCHED,t)}),i.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(_.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=Er(t.url,this.hls);if(i){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,a=!1;for(const u in i){const g=i[u];if(g.id==="main"){if(n=u,r=g,u==="video"){const p=i[u];p&&(this.videoBuffer=p.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t,n=i.type===v.MAIN;if(n){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===qe.PARSED&&(this.state=qe.IDLE);return}const u=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*u.total/(u.buffering.end-u.loading.first)),pe(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}const a=this.media;a&&(!this._hasEnoughToStart&&It.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=qe.ERROR;return}switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(v.MAIN,t);break;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===qe.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===F.LEVEL&&(this.state=qe.IDLE);break;case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case w.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=qe.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==V.AUDIO||!this.altAudio){const i=(t===V.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,v.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 r=this.timelineOffset;r&&i&&(i+=r);const n=this.getLevelDetails(),a=It.getBuffered(e),u=a.length?a.start(0):0,g=u-i,p=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||g>0&&(g<p||this.loadingParts&&g<2*((n==null?void 0:n.partTarget)||0)))&&(this.log(`adjusting start position by ${g} to match buffer start`),i+=g,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${u}`),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:r}=this,n=i==null?void 0:i.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=qe.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=n.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),r.trigger(_.FRAG_LOADED,i),n.bitrateTest=!1}).catch(i=>{this.state===qe.STOPPED||this.state===qe.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:r,chunkMeta:n}=e,a=this.getCurrentContext(n);if(!a){this.resetWhenMissingContext(n);return}const{frag:u,part:g,level:p}=a,{video:m,text:S,id3:R,initSegment:H}=r,{details:j}=p,Q=this.altAudio?void 0:r.audio;if(this.fragContextChanged(u)){this.fragmentTracker.removeFragment(u);return}if(this.state=qe.PARSING,H){const Y=H.tracks;if(Y){const Ee=u.initSegment||u;if(this.unhandledEncryptionError(H,u))return;this._bufferInitSegment(p,Y,Ee,n),i.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:Ee,id:t,tracks:Y})}const te=H.initPTS,ce=H.timescale,ae=this.initPTS[u.cc];if(I(te)&&(!ae||ae.baseTime!==te||ae.timescale!==ce)){const Ee=H.trackId;this.initPTS[u.cc]={baseTime:te,timescale:ce,trackId:Ee},i.trigger(_.INIT_PTS_FOUND,{frag:u,id:t,initPTS:te,timescale:ce,trackId:Ee})}}if(m&&j){Q&&m.type==="audiovideo"&&this.logMuxedErr(u);const Y=j.fragments[u.sn-1-j.startSN],te=u.sn===j.startSN,ce=!Y||u.cc>Y.cc;if(r.independent!==!1){const{startPTS:ae,endPTS:Ee,startDTS:Te,endDTS:$e}=m;if(g)g.elementaryStreams[m.type]={startPTS:ae,endPTS:Ee,startDTS:Te,endDTS:$e};else if(m.firstKeyFrame&&m.independent&&n.id===1&&!ce&&(this.couldBacktrack=!0),m.dropped&&m.independent){const xe=this.getMainFwdBufferInfo(),Ie=(xe?xe.end:this.getLoadPosition())+this.config.maxBufferHole,Pe=m.firstKeyFramePTS?m.firstKeyFramePTS:ae;if(!te&&Ie<Pe-this.config.maxBufferHole&&!ce){this.backtrack(u);return}else ce&&(u.gap=!0);u.setElementaryStreamInfo(m.type,u.start,Ee,u.start,$e,!0)}else te&&ae-(j.appliedTimelineOffset||0)>ss&&(u.gap=!0);u.setElementaryStreamInfo(m.type,ae,Ee,Te,$e),this.backtrackFragment&&(this.backtrackFragment=u),this.bufferFragmentData(m,u,g,n,te||ce)}else if(te||ce)u.gap=!0;else{this.backtrack(u);return}}if(Q){const{startPTS:Y,endPTS:te,startDTS:ce,endDTS:ae}=Q;g&&(g.elementaryStreams[V.AUDIO]={startPTS:Y,endPTS:te,startDTS:ce,endDTS:ae}),u.setElementaryStreamInfo(V.AUDIO,Y,te,ce,ae),this.bufferFragmentData(Q,u,g,n)}if(j&&R!=null&&R.samples.length){const Y={id:t,frag:u,details:j,samples:R.samples};i.trigger(_.FRAG_PARSING_METADATA,Y)}if(j&&S){const Y={id:t,frag:u,details:j,samples:S.samples};i.trigger(_.FRAG_PARSING_USERDATA,Y)}}logMuxedErr(e){this.warn(`${pe(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,r){if(this.state!==qe.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:n,video:a,audiovideo:u}=t;if(n){const p=e.audioCodec;let m=de(n.codec,p);m==="mp4a"&&(m="mp4a.40.5");const S=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){m&&(m.indexOf("mp4a.40.5")!==-1?m="mp4a.40.2":m="mp4a.40.5");const R=n.metadata;R&&"channelCount"in R&&(R.channelCount||1)!==1&&S.indexOf("firefox")===-1&&(m="mp4a.40.5")}m&&m.indexOf("mp4a.40.5")!==-1&&S.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(m="mp4a.40.2",this.log(`Android: force audio codec to ${m}`)),p&&p!==m&&this.log(`Swapping manifest audio codec "${p}" for "${m}"`),n.levelCodec=m,n.id=v.MAIN,this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${m||""}/${p||""}/${n.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=v.MAIN;const p=a.codec;if((p==null?void 0:p.length)===4)switch(p){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${p}]${a.codec!==p?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}u&&(this.log(`Init audiovideo buffer, container:${u.container}, codecs[level/parsed]=[${e.codecs}/${u.codec}]`),delete t.video,delete t.audio);const g=Object.keys(t);if(g.length){if(this.hls.trigger(_.BUFFER_CODECS,t),!this.hls)return;g.forEach(p=>{const S=t[p].initSegment;S!=null&&S.byteLength&&this.hls.trigger(_.BUFFER_APPENDING,{type:p,data:S,frag:i,part:null,chunkMeta:r,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,v.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=qe.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(It.isBuffered(e,i)?t=this.getAppendedFrag(i):It.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(_.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(_.LEVEL_SWITCHED,{level:n}))}}}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 I(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(I(t)){const i=this.getLevelDetails(),r=this.currentFrag||(i?zi(null,i.fragments,t):null);if(r){const n=r.programDateTime;if(n!==null){const a=n+(t-r.start)*1e3;return new Date(a)}}}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 Rh extends T{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[i].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=w.KEY_LOAD_ERROR,i,r,n){return new Oi({type:D.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,n=t.length;r<n;r++){const a=t[r];if(e.cc<=a.cc&&(!pe(e)||!pe(a)||e.sn<a.sn)||!i&&r==n-1)return this.emeController.selectKeySystemFormat(a).then(u=>{if(!this.emeController)return;a.setKeyFormat(u);const g=Hr(u);if(g)return this.emeController.getKeySystemAccess([g])})}if(this.config.requireKeySystemAccessOnStart){const r=Pt(this.config);if(r.length)return this.emeController.getKeySystemAccess(r)}}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,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const m=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,w.KEY_LOAD_ERROR,m))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const u=Qs(n);let g=this.keyIdToKeyInfo[u];if((i=g)!=null&&i.decryptdata.key)return n.key=g.decryptdata.key,Promise.resolve({frag:e,keyInfo:g});if((r=g)!=null&&r.keyLoadPromise){var p;switch((p=g.mediaKeySessionContext)==null?void 0:p.keyStatus){case"usable":case"usable-in-future":return g.keyLoadPromise.then(S=>{const{keyInfo:R}=S;return n.key=R.decryptdata.key,{frag:e,keyInfo:R}})}}switch(this.log(`Loading key ${J(n.keyId||[])} from ${e.type} ${e.level}`),g=this.keyIdToKeyInfo[u]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(g,e):this.loadKeyEME(g,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(g,e);default:return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(i);return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,n.data&&(n.data.frag=t),n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,n=new r(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,u)=>{const g={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},p=i.keyLoadPolicy.default,m={loadPolicy:p,timeout:p.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(R,H,j,Q)=>{const{frag:Y,keyInfo:te,url:ce}=j,ae=Qs(te.decryptdata)||ce;if(!Y.decryptdata||te!==this.keyIdToKeyInfo[ae])return u(this.createKeyLoadError(Y,w.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),Q));te.decryptdata.key=Y.decryptdata.key=new Uint8Array(R.data),Y.keyLoader=null,te.loader=null,a({frag:Y,keyInfo:te})},onError:(R,H,j,Q)=>{this.resetLoader(H),u(this.createKeyLoadError(t,w.KEY_LOAD_ERROR,new Error(`HTTP Error ${R.code} loading key ${R.text}`),j,h({url:g.url,data:void 0},R)))},onTimeout:(R,H,j)=>{this.resetLoader(H),u(this.createKeyLoadError(t,w.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),j))},onAbort:(R,H,j)=>{this.resetLoader(H),u(this.createKeyLoadError(t,w.INTERNAL_ABORTED,new Error("key loading aborted"),j))}};n.load(g,m,S)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null);const a=Qs(i.decryptdata)||r;delete this.keyIdToKeyInfo[a],n&&n.destroy()}}function Qs(o){const e=o.keyId;return e?J(e):o.uri}function qo(o){const{type:e}=o;switch(e){case F.AUDIO_TRACK:return v.AUDIO;case F.SUBTITLE_TRACK:return v.SUBTITLE;default:return v.MAIN}}function Js(o,e){let t=o.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class kh{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=i||r,a=new n(t);return this.loaders[e.type]=a,a}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:F.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:r,pathwayId:n,url:a,deliveryDirectives:u,levelInfo:g}=t;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:F.LEVEL,url:a,deliveryDirectives:u,levelOrTrack:g})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:a,track:u}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:F.AUDIO_TRACK,url:n,deliveryDirectives:a,levelOrTrack:u})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:a,track:u}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:F.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:u})}onLevelsUpdated(e,t){const i=this.loaders[F.LEVEL];if(i){const r=i.context;r&&!t.levels.some(n=>n===r.levelOrTrack)&&(i.abort(),delete this.loaders[F.LEVEL])}}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const p=this.hls.logger,m=r.context;if(m&&m.levelOrTrack===e.levelOrTrack&&(m.url===e.url||m.deliveryDirectives&&!e.deliveryDirectives)){m.url===e.url?p.log(`[playlist-loader]: ignore ${e.url} ongoing request`):p.log(`[playlist-loader]: ignore ${e.url} in favor of ${m.url}`);return}p.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===F.MANIFEST?n=i.manifestLoadPolicy.default:n=c({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),I((t=e.deliveryDirectives)==null?void 0:t.part)){let p;if(e.type===F.LEVEL&&e.level!==null?p=this.hls.levels[e.level].details:e.type===F.AUDIO_TRACK&&e.id!==null?p=this.hls.audioTracks[e.id].details:e.type===F.SUBTITLE_TRACK&&e.id!==null&&(p=this.hls.subtitleTracks[e.id].details),p){const m=p.partTarget,S=p.targetduration;if(m&&S){const R=Math.max(m*3,S*.8)*1e3;n=c({},n,{maxTimeToFirstByteMs:Math.min(R,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(R,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},u={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},g={onSuccess:(p,m,S,R)=>{const H=this.getInternalLoader(S);this.resetInternalLoader(S.type);const j=p.data;if(j.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(p,S,new Error("no EXTM3U delimiter"),R||null,m);return}m.parsing.start=performance.now(),pr.isMediaPlaylist(j)||S.type!==F.MANIFEST?this.handleTrackOrLevelPlaylist(p,m,S,R||null,H):this.handleMasterPlaylist(p,m,S,R)},onError:(p,m,S,R)=>{this.handleNetworkError(m,S,!1,p,R)},onTimeout:(p,m,S)=>{this.handleNetworkError(m,S,!0,void 0,p)}};r.load(e,u,g)}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,r){const n=this.hls,a=e.data,u=Js(e,i),g=pr.parseMasterPlaylist(a,u);if(g.playlistParsingError){this.handleManifestParsingError(e,i,g.playlistParsingError,r,t);return}const{contentSteering:p,levels:m,sessionData:S,sessionKeys:R,startTimeOffset:H,variableList:j}=g;this.variableList=j;const{AUDIO:Q=[],SUBTITLES:Y,"CLOSED-CAPTIONS":te}=pr.parseMasterPlaylistMedia(a,u,g);Q.length&&!Q.some(ae=>!ae.url)&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),Q.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ti({}),bitrate:0,url:""})),n.trigger(_.MANIFEST_LOADED,{levels:m,audioTracks:Q,subtitles:Y,captions:te,contentSteering:p,url:u,stats:t,networkDetails:r,sessionData:S,sessionKeys:R,startTimeOffset:H,variableList:j})}handleTrackOrLevelPlaylist(e,t,i,r,n){const a=this.hls,{id:u,level:g,type:p}=i,m=Js(e,i),S=I(g)?g:I(u)?u:0,R=qo(i),H=pr.parseLevelPlaylist(e.data,m,S,R,0,this.variableList);if(p===F.MANIFEST){const j={attrs:new ti({}),bitrate:0,details:H,name:"",url:m};H.requestScheduled=t.loading.start+_a(H,0),a.trigger(_.MANIFEST_LOADED,{levels:[j],audioTracks:[],url:m,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=H,this.handlePlaylistLoaded(H,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.MANIFEST_PARSING_ERROR,fatal:t.type===F.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,i=!1,r,n){let a=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===F.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===F.AUDIO_TRACK||e.type===F.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const u=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let g=w.UNKNOWN,p=!1;const m=this.getInternalLoader(e);switch(e.type){case F.MANIFEST:g=i?w.MANIFEST_LOAD_TIMEOUT:w.MANIFEST_LOAD_ERROR,p=!0;break;case F.LEVEL:g=i?w.LEVEL_LOAD_TIMEOUT:w.LEVEL_LOAD_ERROR,p=!1;break;case F.AUDIO_TRACK:g=i?w.AUDIO_TRACK_LOAD_TIMEOUT:w.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case F.SUBTITLE_TRACK:g=i?w.SUBTITLE_TRACK_LOAD_TIMEOUT:w.SUBTITLE_LOAD_ERROR,p=!1;break}m&&this.resetInternalLoader(e.type);const S={type:D.NETWORK_ERROR,details:g,fatal:p,url:e.url,loader:m,context:e,error:u,networkDetails:t,stats:n};if(r){const R=(t==null?void 0:t.url)||e.url;S.response=h({url:R,data:void 0},r)}this.hls.trigger(_.ERROR,S)}handlePlaylistLoaded(e,t,i,r,n,a){const u=this.hls,{type:g,level:p,id:m,groupId:S,deliveryDirectives:R}=r,H=Js(t,r),j=qo(r),Q=typeof r.level=="number"&&j===v.MAIN?p:void 0;if(!e.fragments.length){const te=e.playlistParsingError=new Error("No Segments found in Playlist");u.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_EMPTY_ERROR,fatal:!1,url:H,error:te,reason:te.message,response:t,context:r,level:Q,parent:j,networkDetails:n,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const Y=e.playlistParsingError;if(Y){if(this.hls.logger.warn(`${Y} ${e.url}`),!u.config.ignorePlaylistParsingErrors){u.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:H,error:Y,reason:Y.message,response:t,context:r,level:Q,parent:j,networkDetails:n,stats:i});return}e.playlistParsingError=null}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),g){case F.MANIFEST:case F.LEVEL:u.trigger(_.LEVEL_LOADED,{details:e,levelInfo:r.levelOrTrack||u.levels[0],level:Q||0,id:m||0,stats:i,networkDetails:n,deliveryDirectives:R,withoutMultiVariant:g===F.MANIFEST});break;case F.AUDIO_TRACK:u.trigger(_.AUDIO_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:m||0,groupId:S||"",stats:i,networkDetails:n,deliveryDirectives:R});break;case F.SUBTITLE_TRACK:u.trigger(_.SUBTITLE_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:m||0,groupId:S||"",stats:i,networkDetails:n,deliveryDirectives:R});break}}}class Kr{static get version(){return Pn}static isMSESupported(){return Vo()}static isSupported(){return Ch()}static getMediaSource(){return Z()}static get Events(){return _}static get MetadataSchema(){return Ki}static get ErrorTypes(){return D}static get ErrorDetails(){return w}static get DefaultConfig(){return Kr.defaultConfig?Kr.defaultConfig:ph}static set DefaultConfig(e){Kr.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 _s,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=$(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=gh(Kr.DefaultConfig,e,t);this.userConfig=e,i.progressive&&mh(i,t);const{abrController:r,bufferController:n,capLevelController:a,errorController:u,fpsController:g}=i,p=new u(this),m=this.abrController=new r(this),S=new ur(this),R=i.interstitialsController,H=R?this.interstitialsController=new R(this,Kr):null,j=this.bufferController=new n(this,S),Q=this.capLevelController=new a(this),Y=new g(this),te=new kh(this),ce=i.contentSteeringController,ae=ce?new ce(this):null,Ee=this.levelController=new Ah(this,ae),Te=new wh(this),$e=new Rh(this.config,this.logger),xe=this.streamController=new Lh(this,S,$e),Ie=this.gapController=new Eh(this,S);Q.setStreamController(xe),Y.setStreamController(xe);const Pe=[te,Ee,xe];H&&Pe.splice(1,0,H),ae&&Pe.splice(1,0,ae),this.networkControllers=Pe;const Ae=[m,j,Ie,Q,Y,Te,S];this.audioTrackController=this.createController(i.audioTrackController,Pe);const ze=i.audioStreamController;ze&&Pe.push(this.audioStreamController=new ze(this,S,$e)),this.subtitleTrackController=this.createController(i.subtitleTrackController,Pe);const _t=i.subtitleStreamController;_t&&Pe.push(this.subtititleStreamController=new _t(this,S,$e)),this.createController(i.timelineController,Ae),$e.emeController=this.emeController=this.createController(i.emeController,Ae),this.cmcdController=this.createController(i.cmcdController,Ae),this.latencyController=this.createController(xh,Ae),this.coreComponents=Ae,Pe.push(p);const xt=p.onErrorOut;typeof xt=="function"&&this.on(_.ERROR,xt,p),this.on(_.MANIFEST_LOADED,te.onManifestLoaded,te)}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,r){this._emitter.off(e,t,i,r)}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 r=e===_.ERROR;this.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,fatal:r,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(_.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 n=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.ATTACH_MEDIA_ERROR,fatal:!0,error:n});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,r=t?e:{media:i};this._media=i,this.trigger(_.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(_.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(_.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,r=this._url=k.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(_.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={[v.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[v.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[v.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=Ec()),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){Xt(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 r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=i)return n}return r}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=yi(t);return Qt(e,i,navigator.mediaCapabilities)}}Kr.defaultConfig=void 0}}]);
|
|
|
}()); |