You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Question__OjProblem__Rec...

1039 lines
1.2 MiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

!(function(){var Bo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[9716],{65030:function(mt,me,b){"use strict";b.d(me,{Z:function(){return vt}});var k=b(98506),I=b(16886),K=b(33346),D=b(43403),w=b(92310),_=b.n(w),O=b(29301),m=b(76846),n=b(96452),y=b(6089),f=b(80402),c=b(34280),l=b(49658),u=b(59301),p=b(67711),E=b(77900),T=b(8654);function L(Ee){var we=Ee.prefixCls,le=Ee.align,Re=Ee.arrow,Fe=Ee.arrowPos,Ke=Re||{},ie=Ke.className,he=Ke.content,Te=Fe.x,Ie=Te===void 0?0:Te,de=Fe.y,Be=de===void 0?0:de,Ge=u.useRef();if(!le||!le.points)return null;var Ne={position:"absolute"};if(le.autoArrow!==!1){var Ye=le.points[0],$e=le.points[1],st=Ye[0],nt=Ye[1],Je=$e[0],tt=$e[1];st===Je||!["t","b"].includes(st)?Ne.top=Be:st==="t"?Ne.top=0:Ne.bottom=0,nt===tt||!["l","r"].includes(nt)?Ne.left=Ie:nt==="l"?Ne.left=0:Ne.right=0}return u.createElement("div",{ref:Ge,className:_()("".concat(we,"-arrow"),ie),style:Ne},he)}function x(Ee){var we=Ee.prefixCls,le=Ee.open,Re=Ee.zIndex,Fe=Ee.mask,Ke=Ee.motion;return Fe?u.createElement(E.default,(0,p.Z)({},Ke,{motionAppear:!0,visible:le,removeOnLeave:!0}),function(ie){var he=ie.className;return u.createElement("div",{style:{zIndex:Re},className:_()("".concat(we,"-mask"),he)})}):null}var A=u.memo(function(Ee){var we=Ee.children;return we},function(Ee,we){return we.cache}),P=A,U=u.forwardRef(function(Ee,we){var le=Ee.popup,Re=Ee.className,Fe=Ee.prefixCls,Ke=Ee.style,ie=Ee.target,he=Ee.onVisibleChanged,Te=Ee.open,Ie=Ee.keepDom,de=Ee.fresh,Be=Ee.onClick,Ge=Ee.mask,Ne=Ee.arrow,Ye=Ee.arrowPos,$e=Ee.align,st=Ee.motion,nt=Ee.maskMotion,Je=Ee.forceRender,tt=Ee.getPopupContainer,gt=Ee.autoDestroy,_t=Ee.portal,it=Ee.zIndex,Dt=Ee.onMouseEnter,Tt=Ee.onMouseLeave,at=Ee.onPointerEnter,Ot=Ee.onPointerDownCapture,Ut=Ee.ready,rt=Ee.offsetX,xt=Ee.offsetY,xe=Ee.offsetR,ge=Ee.offsetB,ye=Ee.onAlign,ee=Ee.onPrepare,te=Ee.stretch,ue=Ee.targetWidth,fe=Ee.targetHeight,pe=typeof le=="function"?le():le,Ze=Te||Ie,Qe=(tt==null?void 0:tt.length)>0,ut=u.useState(!tt||!Qe),dt=(0,I.Z)(ut,2),kt=dt[0],zt=dt[1];if((0,c.Z)(function(){!kt&&Qe&&ie&&zt(!0)},[kt,Qe,ie]),!kt)return null;var Nt="auto",Ct={left:"-1000vw",top:"-1000vh",right:Nt,bottom:Nt};if(Ut||!Te){var oi,_i=$e.points,ti=$e.dynamicInset||((oi=$e._experimental)===null||oi===void 0?void 0:oi.dynamicInset),ri=ti&&_i[0][1]==="r",et=ti&&_i[0][0]==="b";ri?(Ct.right=xe,Ct.left=Nt):(Ct.left=rt,Ct.right=Nt),et?(Ct.bottom=ge,Ct.top=Nt):(Ct.top=xt,Ct.bottom=Nt)}var ze={};return te&&(te.includes("height")&&fe?ze.height=fe:te.includes("minHeight")&&fe&&(ze.minHeight=fe),te.includes("width")&&ue?ze.width=ue:te.includes("minWidth")&&ue&&(ze.minWidth=ue)),Te||(ze.pointerEvents="none"),u.createElement(_t,{open:Je||Ze,getContainer:tt&&function(){return tt(ie)},autoDestroy:gt},u.createElement(x,{prefixCls:Fe,open:Te,zIndex:it,mask:Ge,motion:nt}),u.createElement(O.Z,{onResize:ye,disabled:!Te},function(ht){return u.createElement(E.default,(0,p.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Je,leavedClassName:"".concat(Fe,"-hidden")},st,{onAppearPrepare:ee,onEnterPrepare:ee,visible:Te,onVisibleChanged:function($t){var Zt;st==null||(Zt=st.onVisibleChanged)===null||Zt===void 0||Zt.call(st,$t),he($t)}}),function(Bt,$t){var Zt=Bt.className,wi=Bt.style,yi=_()(Fe,Zt,Re);return u.createElement("div",{ref:(0,T.sQ)(ht,we,$t),className:yi,style:(0,k.Z)((0,k.Z)((0,k.Z)((0,k.Z)({"--arrow-x":"".concat(Ye.x||0,"px"),"--arrow-y":"".concat(Ye.y||0,"px")},Ct),ze),wi),{},{boxSizing:"border-box",zIndex:it},Ke),onMouseEnter:Dt,onMouseLeave:Tt,onPointerEnter:at,onClick:Be,onPointerDownCapture:Ot},Ne&&u.createElement(L,{prefixCls:Fe,arrow:Ne,arrowPos:Ye,align:$e}),u.createElement(P,{cache:!Te&&!de},pe))})}))}),N=U,H=u.forwardRef(function(Ee,we){var le=Ee.children,Re=Ee.getTriggerDOMNode,Fe=(0,T.Yr)(le),Ke=u.useCallback(function(he){(0,T.mH)(we,Re?Re(he):he)},[Re]),ie=(0,T.x1)(Ke,(0,T.C4)(le));return Fe?u.cloneElement(le,{ref:ie}):le}),F=H,Y=u.createContext(null),V=Y;function ne(Ee){return Ee?Array.isArray(Ee)?Ee:[Ee]:[]}function ae(Ee,we,le,Re){return u.useMemo(function(){var Fe=ne(le!=null?le:we),Ke=ne(Re!=null?Re:we),ie=new Set(Fe),he=new Set(Ke);return Ee&&(ie.has("hover")&&(ie.delete("hover"),ie.add("click")),he.has("hover")&&(he.delete("hover"),he.add("click"))),[ie,he]},[Ee,we,le,Re])}var J=b(29194);function z(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],le=arguments.length>2?arguments[2]:void 0;return le?Ee[0]===we[0]:Ee[0]===we[0]&&Ee[1]===we[1]}function Z(Ee,we,le,Re){for(var Fe=le.points,Ke=Object.keys(Ee),ie=0;ie<Ke.length;ie+=1){var he,Te=Ke[ie];if(z((he=Ee[Te])===null||he===void 0?void 0:he.points,Fe,Re))return"".concat(we,"-placement-").concat(Te)}return""}function B(Ee,we,le,Re){return we||(le?{motionName:"".concat(Ee,"-").concat(le)}:Re?{motionName:Re}:null)}function G(Ee){return Ee.ownerDocument.defaultView}function W(Ee){for(var we=[],le=Ee==null?void 0:Ee.parentElement,Re=["hidden","scroll","clip","auto"];le;){var Fe=G(le).getComputedStyle(le),Ke=Fe.overflowX,ie=Fe.overflowY,he=Fe.overflow;[Ke,ie,he].some(function(Te){return Re.includes(Te)})&&we.push(le),le=le.parentElement}return we}function R(Ee){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(Ee)?we:Ee}function C(Ee){return R(parseFloat(Ee),0)}function q(Ee,we){var le=(0,k.Z)({},Ee);return(we||[]).forEach(function(Re){if(!(Re instanceof HTMLBodyElement||Re instanceof HTMLHtmlElement)){var Fe=G(Re).getComputedStyle(Re),Ke=Fe.overflow,ie=Fe.overflowClipMargin,he=Fe.borderTopWidth,Te=Fe.borderBottomWidth,Ie=Fe.borderLeftWidth,de=Fe.borderRightWidth,Be=Re.getBoundingClientRect(),Ge=Re.offsetHeight,Ne=Re.clientHeight,Ye=Re.offsetWidth,$e=Re.clientWidth,st=C(he),nt=C(Te),Je=C(Ie),tt=C(de),gt=R(Math.round(Be.width/Ye*1e3)/1e3),_t=R(Math.round(Be.height/Ge*1e3)/1e3),it=(Ye-$e-Je-tt)*gt,Dt=(Ge-Ne-st-nt)*_t,Tt=st*_t,at=nt*_t,Ot=Je*gt,Ut=tt*gt,rt=0,xt=0;if(Ke==="clip"){var xe=C(ie);rt=xe*gt,xt=xe*_t}var ge=Be.x+Ot-rt,ye=Be.y+Tt-xt,ee=ge+Be.width+2*rt-Ot-Ut-it,te=ye+Be.height+2*xt-Tt-at-Dt;le.left=Math.max(le.left,ge),le.top=Math.max(le.top,ye),le.right=Math.min(le.right,ee),le.bottom=Math.min(le.bottom,te)}}),le}function re(Ee){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,le="".concat(we),Re=le.match(/^(.*)\%$/);return Re?Ee*(parseFloat(Re[1])/100):parseFloat(le)}function _e(Ee,we){var le=we||[],Re=(0,I.Z)(le,2),Fe=Re[0],Ke=Re[1];return[re(Ee.width,Fe),re(Ee.height,Ke)]}function Le(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[Ee[0],Ee[1]]}function qe(Ee,we){var le=we[0],Re=we[1],Fe,Ke;return le==="t"?Ke=Ee.y:le==="b"?Ke=Ee.y+Ee.height:Ke=Ee.y+Ee.height/2,Re==="l"?Fe=Ee.x:Re==="r"?Fe=Ee.x+Ee.width:Fe=Ee.x+Ee.width/2,{x:Fe,y:Ke}}function be(Ee,we){var le={t:"b",b:"t",l:"r",r:"l"};return Ee.map(function(Re,Fe){return Fe===we?le[Re]||"c":Re}).join("")}function je(Ee,we,le,Re,Fe,Ke,ie){var he=u.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Fe[Re]||{}}),Te=(0,I.Z)(he,2),Ie=Te[0],de=Te[1],Be=u.useRef(0),Ge=u.useMemo(function(){return we?W(we):[]},[we]),Ne=u.useRef({}),Ye=function(){Ne.current={}};Ee||Ye();var $e=(0,y.Z)(function(){if(we&&le&&Ee){let Ui=function(ii,ci){var Ki=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fi,Dr=Ze.x+ii,Er=Ze.y+ci,nn=Dr+et,An=Er+ri,Cn=Math.max(Dr,Ki.left),bt=Math.max(Er,Ki.top),Ft=Math.min(nn,Ki.right),Xt=Math.min(An,Ki.bottom);return Math.max(0,(Ft-Cn)*(Xt-bt))},nr=function(){Oi=Ze.y+Jt,Qi=Oi+ri,Di=Ze.x+Qt,Ji=Di+et};var Je,tt,gt,_t,it=we,Dt=it.ownerDocument,Tt=G(it),at=Tt.getComputedStyle(it),Ot=at.position,Ut=it.style.left,rt=it.style.top,xt=it.style.right,xe=it.style.bottom,ge=it.style.overflow,ye=(0,k.Z)((0,k.Z)({},Fe[Re]),Ke),ee=Dt.createElement("div");(Je=it.parentElement)===null||Je===void 0||Je.appendChild(ee),ee.style.left="".concat(it.offsetLeft,"px"),ee.style.top="".concat(it.offsetTop,"px"),ee.style.position=Ot,ee.style.height="".concat(it.offsetHeight,"px"),ee.style.width="".concat(it.offsetWidth,"px"),it.style.left="0",it.style.top="0",it.style.right="auto",it.style.bottom="auto",it.style.overflow="hidden";var te;if(Array.isArray(le))te={x:le[0],y:le[1],width:0,height:0};else{var ue,fe,pe=le.getBoundingClientRect();pe.x=(ue=pe.x)!==null&&ue!==void 0?ue:pe.left,pe.y=(fe=pe.y)!==null&&fe!==void 0?fe:pe.top,te={x:pe.x,y:pe.y,width:pe.width,height:pe.height}}var Ze=it.getBoundingClientRect(),Qe=Tt.getComputedStyle(it),ut=Qe.height,dt=Qe.width;Ze.x=(tt=Ze.x)!==null&&tt!==void 0?tt:Ze.left,Ze.y=(gt=Ze.y)!==null&&gt!==void 0?gt:Ze.top;var kt=Dt.documentElement,zt=kt.clientWidth,Nt=kt.clientHeight,Ct=kt.scrollWidth,oi=kt.scrollHeight,_i=kt.scrollTop,ti=kt.scrollLeft,ri=Ze.height,et=Ze.width,ze=te.height,ht=te.width,Bt={left:0,top:0,right:zt,bottom:Nt},$t={left:-ti,top:-_i,right:Ct-ti,bottom:oi-_i},Zt=ye.htmlRegion,wi="visible",yi="visibleFirst";Zt!=="scroll"&&Zt!==yi&&(Zt=wi);var li=Zt===yi,mi=q($t,Ge),jt=q(Bt,Ge),Fi=Zt===wi?jt:mi,ni=li?jt:Fi;it.style.left="auto",it.style.top="auto",it.style.right="0",it.style.bottom="0";var pr=it.getBoundingClientRect();it.style.left=Ut,it.style.top=rt,it.style.right=xt,it.style.bottom=xe,it.style.overflow=ge,(_t=it.parentElement)===null||_t===void 0||_t.removeChild(ee);var At=R(Math.round(et/parseFloat(dt)*1e3)/1e3),Gt=R(Math.round(ri/parseFloat(ut)*1e3)/1e3);if(At===0||Gt===0||(0,m.Sh)(le)&&!(0,J.Z)(le))return;var Wt=ye.offset,vi=ye.targetOffset,si=_e(Ze,Wt),bi=(0,I.Z)(si,2),di=bi[0],Ei=bi[1],Ar=_e(te,vi),Ii=(0,I.Z)(Ar,2),Ti=Ii[0],_n=Ii[1];te.x-=Ti,te.y-=_n;var Yr=ye.points||[],_r=(0,I.Z)(Yr,2),gn=_r[0],Or=_r[1],Zi=Le(Or),gi=Le(gn),xi=qe(te,Zi),Fr=qe(Ze,gi),Mi=(0,k.Z)({},ye),Qt=xi.x-Fr.x+di,Jt=xi.y-Fr.y+Ei,Bi=Ui(Qt,Jt),Xi=Ui(Qt,Jt,jt),Pi=qe(te,["t","l"]),gr=qe(Ze,["t","l"]),Mr=qe(te,["b","r"]),ui=qe(Ze,["b","r"]),Si=ye.overflow||{},mn=Si.adjustX,lr=Si.adjustY,ai=Si.shiftX,Br=Si.shiftY,mr=function(ci){return typeof ci=="boolean"?ci:ci>=0},Oi,Qi,Di,Ji;nr();var Zr=mr(lr),Li=gi[0]===Zi[0];if(Zr&&gi[0]==="t"&&(Qi>ni.bottom||Ne.current.bt)){var vr=Jt;Li?vr-=ri-ze:vr=Pi.y-ui.y-Ei;var Xr=Ui(Qt,vr),vn=Ui(Qt,vr,jt);Xr>Bi||Xr===Bi&&(!li||vn>=Xi)?(Ne.current.bt=!0,Jt=vr,Ei=-Ei,Mi.points=[be(gi,0),be(Zi,0)]):Ne.current.bt=!1}if(Zr&&gi[0]==="b"&&(Oi<ni.top||Ne.current.tb)){var er=Jt;Li?er+=ri-ze:er=Mr.y-gr.y-Ei;var Nr=Ui(Qt,er),yn=Ui(Qt,er,jt);Nr>Bi||Nr===Bi&&(!li||yn>=Xi)?(Ne.current.tb=!0,Jt=er,Ei=-Ei,Mi.points=[be(gi,0),be(Zi,0)]):Ne.current.tb=!1}var Ur=mr(mn),Hr=gi[1]===Zi[1];if(Ur&&gi[1]==="l"&&(Ji>ni.right||Ne.current.rl)){var yr=Qt;Hr?yr-=et-ht:yr=Pi.x-ui.x-di;var Ci=Ui(yr,Jt),Cr=Ui(yr,Jt,jt);Ci>Bi||Ci===Bi&&(!li||Cr>=Xi)?(Ne.current.rl=!0,Qt=yr,di=-di,Mi.points=[be(gi,1),be(Zi,1)]):Ne.current.rl=!1}if(Ur&&gi[1]==="r"&&(Di<ni.left||Ne.current.lr)){var tr=Qt;Hr?tr+=et-ht:tr=Mr.x-gr.x-di;var ur=Ui(tr,Jt),br=Ui(tr,Jt,jt);ur>Bi||ur===Bi&&(!li||br>=Xi)?(Ne.current.lr=!0,Qt=tr,di=-di,Mi.points=[be(gi,1),be(Zi,1)]):Ne.current.lr=!1}nr();var Lt=ai===!0?0:ai;typeof Lt=="number"&&(Di<jt.left&&(Qt-=Di-jt.left-di,te.x+ht<jt.left+Lt&&(Qt+=te.x-jt.left+ht-Lt)),Ji>jt.right&&(Qt-=Ji-jt.right-di,te.x>jt.right-Lt&&(Qt+=te.x-jt.right+Lt)));var ir=Br===!0?0:Br;typeof ir=="number"&&(Oi<jt.top&&(Jt-=Oi-jt.top-Ei,te.y+ze<jt.top+ir&&(Jt+=te.y-jt.top+ze-ir)),Qi>jt.bottom&&(Jt-=Qi-jt.bottom-Ei,te.y>jt.bottom-ir&&(Jt+=te.y-jt.bottom+ir)));var rr=Ze.x+Qt,Gi=rr+et,Tr=Ze.y+Jt,bn=Tr+ri,Qr=te.x,$r=Qr+ht,ei=te.y,En=ei+ze,Sn=Math.max(rr,Qr),Jr=Math.min(Gi,$r),en=(Sn+Jr)/2,wn=en-rr,tn=Math.max(Tr,ei),cr=Math.min(bn,En),jr=(tn+cr)/2,rn=jr-Tr;ie==null||ie(we,Mi);var Ni=pr.right-Ze.x-(Qt+Ze.width),Wr=pr.bottom-Ze.y-(Jt+Ze.height);At===1&&(Qt=Math.round(Qt),Ni=Math.round(Ni)),Gt===1&&(Jt=Math.round(Jt),Wr=Math.round(Wr));var xn={ready:!0,offsetX:Qt/At,offsetY:Jt/Gt,offsetR:Ni/At,offsetB:Wr/Gt,arrowX:wn/At,arrowY:rn/Gt,scaleX:At,scaleY:Gt,align:Mi};de(xn)}}),st=function(){Be.current+=1;var tt=Be.current;Promise.resolve().then(function(){Be.current===tt&&$e()})},nt=function(){de(function(tt){return(0,k.Z)((0,k.Z)({},tt),{},{ready:!1})})};return(0,c.Z)(nt,[Re]),(0,c.Z)(function(){Ee||nt()},[Ee]),[Ie.ready,Ie.offsetX,Ie.offsetY,Ie.offsetR,Ie.offsetB,Ie.arrowX,Ie.arrowY,Ie.scaleX,Ie.scaleY,Ie.align,st]}var Me=b(15142);function Oe(Ee,we,le,Re,Fe){(0,c.Z)(function(){if(Ee&&we&&le){let Be=function(){Re(),Fe()};var Ke=we,ie=le,he=W(Ke),Te=W(ie),Ie=G(ie),de=new Set([Ie].concat((0,Me.Z)(he),(0,Me.Z)(Te)));return de.forEach(function(Ge){Ge.addEventListener("scroll",Be,{passive:!0})}),Ie.addEventListener("resize",Be,{passive:!0}),Re(),function(){de.forEach(function(Ge){Ge.removeEventListener("scroll",Be),Ie.removeEventListener("resize",Be)})}}},[Ee,we,le])}var wt=b(48736);function We(Ee,we,le,Re,Fe,Ke,ie,he){var Te=u.useRef(Ee);Te.current=Ee;var Ie=u.useRef(!1);u.useEffect(function(){if(we&&Re&&(!Fe||Ke)){var Be=function(){Ie.current=!1},Ge=function(gt){var _t;Te.current&&!ie(((_t=gt.composedPath)===null||_t===void 0||(_t=_t.call(gt))===null||_t===void 0?void 0:_t[0])||gt.target)&&!Ie.current&&he(!1)},Ne=G(Re);Ne.addEventListener("pointerdown",Be,!0),Ne.addEventListener("mousedown",Ge,!0),Ne.addEventListener("contextmenu",Ge,!0);var Ye=(0,n.A)(le);if(Ye&&(Ye.addEventListener("mousedown",Ge,!0),Ye.addEventListener("contextmenu",Ge,!0)),0)var $e,st,nt,Je;return function(){Ne.removeEventListener("pointerdown",Be,!0),Ne.removeEventListener("mousedown",Ge,!0),Ne.removeEventListener("contextmenu",Ge,!0),Ye&&(Ye.removeEventListener("mousedown",Ge,!0),Ye.removeEventListener("contextmenu",Ge,!0))}}},[we,le,Re,Fe,Ke]);function de(){Ie.current=!0}return de}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 He(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D.Z,we=u.forwardRef(function(le,Re){var Fe=le.prefixCls,Ke=Fe===void 0?"rc-trigger-popup":Fe,ie=le.children,he=le.action,Te=he===void 0?"hover":he,Ie=le.showAction,de=le.hideAction,Be=le.popupVisible,Ge=le.defaultPopupVisible,Ne=le.onPopupVisibleChange,Ye=le.afterPopupVisibleChange,$e=le.mouseEnterDelay,st=le.mouseLeaveDelay,nt=st===void 0?.1:st,Je=le.focusDelay,tt=le.blurDelay,gt=le.mask,_t=le.maskClosable,it=_t===void 0?!0:_t,Dt=le.getPopupContainer,Tt=le.forceRender,at=le.autoDestroy,Ot=le.destroyPopupOnHide,Ut=le.popup,rt=le.popupClassName,xt=le.popupStyle,xe=le.popupPlacement,ge=le.builtinPlacements,ye=ge===void 0?{}:ge,ee=le.popupAlign,te=le.zIndex,ue=le.stretch,fe=le.getPopupClassNameFromAlign,pe=le.fresh,Ze=le.alignPoint,Qe=le.onPopupClick,ut=le.onPopupAlign,dt=le.arrow,kt=le.popupMotion,zt=le.maskMotion,Nt=le.popupTransitionName,Ct=le.popupAnimation,oi=le.maskTransitionName,_i=le.maskAnimation,ti=le.className,ri=le.getTriggerDOMNode,et=(0,K.Z)(le,lt),ze=at||Ot||!1,ht=u.useState(!1),Bt=(0,I.Z)(ht,2),$t=Bt[0],Zt=Bt[1];(0,c.Z)(function(){Zt((0,l.Z)())},[]);var wi=u.useRef({}),yi=u.useContext(V),li=u.useMemo(function(){return{registerSubPopup:function(Ft,Xt){wi.current[Ft]=Xt,yi==null||yi.registerSubPopup(Ft,Xt)}}},[yi]),mi=(0,f.Z)(),jt=u.useState(null),Fi=(0,I.Z)(jt,2),ni=Fi[0],pr=Fi[1],At=u.useRef(null),Gt=(0,y.Z)(function(bt){At.current=bt,(0,m.Sh)(bt)&&ni!==bt&&pr(bt),yi==null||yi.registerSubPopup(mi,bt)}),Wt=u.useState(null),vi=(0,I.Z)(Wt,2),si=vi[0],bi=vi[1],di=u.useRef(null),Ei=(0,y.Z)(function(bt){(0,m.Sh)(bt)&&si!==bt&&(bi(bt),di.current=bt)}),Ar=u.Children.only(ie),Ii=(Ar==null?void 0:Ar.props)||{},Ti={},_n=(0,y.Z)(function(bt){var Ft,Xt,hi=si;return(hi==null?void 0:hi.contains(bt))||((Ft=(0,n.A)(hi))===null||Ft===void 0?void 0:Ft.host)===bt||bt===hi||(ni==null?void 0:ni.contains(bt))||((Xt=(0,n.A)(ni))===null||Xt===void 0?void 0:Xt.host)===bt||bt===ni||Object.values(wi.current).some(function(fi){return(fi==null?void 0:fi.contains(bt))||bt===fi})}),Yr=B(Ke,kt,Ct,Nt),_r=B(Ke,zt,_i,oi),gn=u.useState(Ge||!1),Or=(0,I.Z)(gn,2),Zi=Or[0],gi=Or[1],xi=Be!=null?Be:Zi,Fr=(0,y.Z)(function(bt){Be===void 0&&gi(bt)});(0,c.Z)(function(){gi(Be||!1)},[Be]);var Mi=u.useRef(xi);Mi.current=xi;var Qt=u.useRef([]);Qt.current=[];var Jt=(0,y.Z)(function(bt){var Ft;Fr(bt),((Ft=Qt.current[Qt.current.length-1])!==null&&Ft!==void 0?Ft:xi)!==bt&&(Qt.current.push(bt),Ne==null||Ne(bt))}),Bi=u.useRef(),Xi=function(){clearTimeout(Bi.current)},Pi=function(Ft){var Xt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Xi(),Xt===0?Jt(Ft):Bi.current=setTimeout(function(){Jt(Ft)},Xt*1e3)};u.useEffect(function(){return Xi},[]);var gr=u.useState(!1),Mr=(0,I.Z)(gr,2),ui=Mr[0],Si=Mr[1];(0,c.Z)(function(bt){(!bt||xi)&&Si(!0)},[xi]);var mn=u.useState(null),lr=(0,I.Z)(mn,2),ai=lr[0],Br=lr[1],mr=u.useState(null),Oi=(0,I.Z)(mr,2),Qi=Oi[0],Di=Oi[1],Ji=function(Ft){Di([Ft.clientX,Ft.clientY])},Zr=je(xi,ni,Ze&&Qi!==null?Qi:si,xe,ye,ee,ut),Li=(0,I.Z)(Zr,11),vr=Li[0],Xr=Li[1],vn=Li[2],er=Li[3],Nr=Li[4],yn=Li[5],Ur=Li[6],Hr=Li[7],yr=Li[8],Ci=Li[9],Cr=Li[10],tr=ae($t,Te,Ie,de),ur=(0,I.Z)(tr,2),br=ur[0],Lt=ur[1],ir=br.has("click"),rr=Lt.has("click")||Lt.has("contextMenu"),Gi=(0,y.Z)(function(){ui||Cr()}),Tr=function(){Mi.current&&Ze&&rr&&Pi(!1)};Oe(xi,si,ni,Gi,Tr),(0,c.Z)(function(){Gi()},[Qi,xe]),(0,c.Z)(function(){xi&&!(ye!=null&&ye[xe])&&Gi()},[JSON.stringify(ee)]);var bn=u.useMemo(function(){var bt=Z(ye,Ke,Ci,Ze);return _()(bt,fe==null?void 0:fe(Ci))},[Ci,fe,ye,Ke,Ze]);u.useImperativeHandle(Re,function(){return{nativeElement:di.current,popupElement:At.current,forceAlign:Gi}});var Qr=u.useState(0),$r=(0,I.Z)(Qr,2),ei=$r[0],En=$r[1],Sn=u.useState(0),Jr=(0,I.Z)(Sn,2),en=Jr[0],wn=Jr[1],tn=function(){if(ue&&si){var Ft=si.getBoundingClientRect();En(Ft.width),wn(Ft.height)}},cr=function(){tn(),Gi()},jr=function(Ft){Si(!1),Cr(),Ye==null||Ye(Ft)},rn=function(){return new Promise(function(Ft){tn(),Br(function(){return Ft})})};(0,c.Z)(function(){ai&&(Cr(),ai(),Br(null))},[ai]);function Ni(bt,Ft,Xt,hi){Ti[bt]=function(fi){var Gr;hi==null||hi(fi),Pi(Ft,Xt);for(var sn=arguments.length,Nn=new Array(sn>1?sn-1:0),Lr=1;Lr<sn;Lr++)Nn[Lr-1]=arguments[Lr];(Gr=Ii[bt])===null||Gr===void 0||Gr.call.apply(Gr,[Ii,fi].concat(Nn))}}(ir||rr)&&(Ti.onClick=function(bt){var Ft;Mi.current&&rr?Pi(!1):!Mi.current&&ir&&(Ji(bt),Pi(!0));for(var Xt=arguments.length,hi=new Array(Xt>1?Xt-1:0),fi=1;fi<Xt;fi++)hi[fi-1]=arguments[fi];(Ft=Ii.onClick)===null||Ft===void 0||Ft.call.apply(Ft,[Ii,bt].concat(hi))});var Wr=We(xi,rr,si,ni,gt,it,_n,Pi),xn=br.has("hover"),Ui=Lt.has("hover"),nr,ii;xn&&(Ni("onMouseEnter",!0,$e,function(bt){Ji(bt)}),Ni("onPointerEnter",!0,$e,function(bt){Ji(bt)}),nr=function(Ft){(xi||ui)&&ni!==null&&ni!==void 0&&ni.contains(Ft.target)&&Pi(!0,$e)},Ze&&(Ti.onMouseMove=function(bt){var Ft;(Ft=Ii.onMouseMove)===null||Ft===void 0||Ft.call(Ii,bt)})),Ui&&(Ni("onMouseLeave",!1,nt),Ni("onPointerLeave",!1,nt),ii=function(){Pi(!1,nt)}),br.has("focus")&&Ni("onFocus",!0,Je),Lt.has("focus")&&Ni("onBlur",!1,tt),br.has("contextMenu")&&(Ti.onContextMenu=function(bt){var Ft;Mi.current&&Lt.has("contextMenu")?Pi(!1):(Ji(bt),Pi(!0)),bt.preventDefault();for(var Xt=arguments.length,hi=new Array(Xt>1?Xt-1:0),fi=1;fi<Xt;fi++)hi[fi-1]=arguments[fi];(Ft=Ii.onContextMenu)===null||Ft===void 0||Ft.call.apply(Ft,[Ii,bt].concat(hi))}),ti&&(Ti.className=_()(Ii.className,ti));var ci=u.useRef(!1);ci.current||(ci.current=Tt||xi||ui);var Ki=(0,k.Z)((0,k.Z)({},Ii),Ti),Dr={},Er=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Er.forEach(function(bt){et[bt]&&(Dr[bt]=function(){for(var Ft,Xt=arguments.length,hi=new Array(Xt),fi=0;fi<Xt;fi++)hi[fi]=arguments[fi];(Ft=Ki[bt])===null||Ft===void 0||Ft.call.apply(Ft,[Ki].concat(hi)),et[bt].apply(et,hi)})});var nn=u.cloneElement(Ar,(0,k.Z)((0,k.Z)({},Ki),Dr)),An={x:yn,y:Ur},Cn=dt?(0,k.Z)({},dt!==!0?dt:{}):null;return u.createElement(u.Fragment,null,u.createElement(O.Z,{disabled:!xi,ref:Ei,onResize:cr},u.createElement(F,{getTriggerDOMNode:ri},nn)),ci.current&&u.createElement(V.Provider,{value:li},u.createElement(N,{portal:Ee,ref:Gt,prefixCls:Ke,popup:Ut,className:_()(rt,bn),style:xt,target:si,onMouseEnter:nr,onMouseLeave:ii,onPointerEnter:nr,zIndex:te,open:xi,keepDom:ui,fresh:pe,onClick:Qe,onPointerDownCapture:Wr,mask:gt,motion:Yr,maskMotion:_r,onVisibleChanged:jr,onPrepare:rn,forceRender:Tt,autoDestroy:ze,getPopupContainer:Dt,align:Ci,arrow:Cn,arrowPos:An,ready:vr,offsetX:Xr,offsetY:vn,offsetR:er,offsetB:Nr,onAlign:Gi,stretch:ue,targetWidth:ei/Hr,targetHeight:en/yr})))});return we}var vt=He(D.Z)},42909:function(mt,me){"use strict";me.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"}},28426:function(mt,me,b){"use strict";var k=b(59301),I=b(93314),K=b(99571),D=Object.defineProperty,w=Object.defineProperties,_=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,y=(u,p,E)=>p in u?D(u,p,{enumerable:!0,configurable:!0,writable:!0,value:E}):u[p]=E,f=(u,p)=>{for(var E in p||(p={}))m.call(p,E)&&y(u,E,p[E]);if(O)for(var E of O(p))n.call(p,E)&&y(u,E,p[E]);return u},c=(u,p)=>w(u,_(p));const l=({img:u,buttonProps:p={},styles:E={},customText:T,ButtonText:L,ButtonClick:x,Buttonclass:A,ButtonTwo:P,imgStyles:U,loading:N=!1,className:H=""})=>k.createElement("section",{className:`tc animated fadeIn ${H}`,style:f({color:"#999",margin:"100px auto",visibility:N?"hidden":"visible"},E)},k.createElement("img",{src:u||I,style:c(f({},U),{pointerEvents:"none",userSelect:"none"})}),k.createElement("p",{className:"mt20 font14"},T||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),L&&k.createElement(K.ZP,f({className:A,onClick:x},p),L),P&&P);me.Z=l},45677:function(mt,me,b){"use strict";b.d(me,{Z:function(){return A}});var k=b(59301),I={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(75975),_=b(25399),O=b(51257),m=b(81722),n=b(28426),y=b(346),f=b(44203),c=b(59301),l=Object.defineProperty,u=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,T=(P,U,N)=>U in P?l(P,U,{enumerable:!0,configurable:!0,writable:!0,value:N}):P[U]=N,L=(P,U)=>{for(var N in U||(U={}))p.call(U,N)&&T(P,N,U[N]);if(u)for(var N of u(U))E.call(U,N)&&T(P,N,U[N]);return P},x=(P,U,N)=>new Promise((H,F)=>{var Y=ae=>{try{ne(N.next(ae))}catch(J){F(J)}},V=ae=>{try{ne(N.throw(ae))}catch(J){F(J)}},ne=ae=>ae.done?H(ae.value):Promise.resolve(ae.value).then(Y,V);ne((N=N.apply(P,U)).next())}),A=({editOffice:P="view",data:U,issaver:N,onSaver:H,theme:F,type:Y,filename:V,monacoEditor:ne,className:ae,style:J,close:z,onClose:Z,hasMask:B,disabledDownload:G,onImgDimensions:W,showNodata:R,recordInfo:C})=>{const[q,re]=(0,k.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[_e,Le]=(0,k.useState)(""),[qe,be]=(0,k.useState)(),je=window.ENV==="build"?"/react/build":"",Me=location.host.startsWith("localhost")?y.Z.PROXY_SERVER:y.Z.API_SERVER,wt=10*(1024*1024),We=(0,k.useRef)();U!=null&&U.startsWith("/api")&&Y!=="txt"&&(U=y.Z.API_SERVER+U);const lt=le=>le.substring(le.lastIndexOf("/")+1).split(".").pop();V&&ne&&(ne.filename=V),(0,k.useEffect)(()=>{var le,Re;const Fe=(Re=(le=document.cookie)==null?void 0:le.replace(/\s/g,""))==null?void 0:Re.split(";");Fe==null||Fe.map(Ke=>{let ie=Ke.split("=");ie[0]==="_educoder_session"&&Le(ie[1])})},[]),(0,k.useEffect)(()=>{Y==="office"&&(U.indexOf("bigfilescdn.")>-1||U.indexOf("bigfiles1")>-1?be({url:U,fileType:lt(U),model:U.indexOf("model=edit")?"edit":"view"}):vt())},[Y,U]);function He(le){return x(this,null,function*(){le.data.type==="pdfdata"&&(H(le.data.data),window.removeEventListener("message",He,!1)),console.log("mess---:",le.data)})}const vt=()=>x(void 0,null,function*(){console.log("data:",U);let le=U;U.startsWith("http")||(le=location.origin+le);let Re=new URL(le).pathname.split("/").pop();const Fe=yield(0,m.gJ)({attachment_id:Re});Fe.url=Me+Fe.url,be(Fe)}),Ee=()=>{if(U.startsWith("http")||U.startsWith("blob:")){we();return}(0,O.Sv)(V||"educoder",U,V)},we=()=>{C&&(0,f.fc)({id:C==null?void 0:C.id,watch_type:1,course_id:C==null?void 0:C.course_id}),(0,O.Nd)(V||"educoder",decodeURIComponent(U))};return c.createElement("div",{style:L({},J||{}),className:`${B&&I.bgBlack} ${Y?I.wrp:"hide"}`},z&&c.createElement("div",{className:I.close,ref:We},!!W&&c.createElement(_.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>We.current},c.createElement("span",{onClick:()=>{Z(),W()}},c.createElement("i",{className:"icon-yulanpizhu"}))),!G&&c.createElement(_.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>We.current},c.createElement("span",{onClick:we},c.createElement("i",{className:"icon-quxiaozhiding"}))),N&&c.createElement(_.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>We.current},c.createElement("span",{className:"",onClick:()=>{const le=document.getElementById("pdfiframe");window.addEventListener("message",He,!1),setTimeout(()=>{le.contentWindow.postMessage("getData","*")},300)}},c.createElement("i",{className:"icon-baocun"}))),c.createElement(_.Z,{title:"\u5173\u95ED",getPopupContainer:()=>We.current},c.createElement("span",{className:"",onClick:()=>{Z()}},c.createElement("i",{className:"icon-guanbi1"})))),c.createElement("div",{className:`${I[ae]} ${ae} ${I.monaco} ${Y==="txt"?"show":"hide"}`},Y==="txt"&&c.createElement(c.Fragment,null,c.createElement(w.ZP,L({},ne)))),Y==="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}),Y==="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})),Y==="office"&&qe&&c.createElement("iframe",{src:`${je}/office.html?key=${qe.key}&url=${btoa(qe.url)}&callbackUrl=${Me+(qe.callbackUrl||"")}&fileType=${qe.fileType}&title=${qe.title||""}&model=${P}&officeServer=${y.Z.ONLYOFFICE}&disabledDownload=${!!G}`}),Y==="html"&&c.createElement("iframe",{src:U+"&disposition=inline"}),Y==="pdf"&&c.createElement("iframe",{id:"pdfiframe",src:`${je}/js/pdfview/index.html?filename=${V||"educoder.pdf"}&url=${encodeURIComponent(U)}&disabledDownload=${!!G}&model=${P}`}),Y==="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}`}),(Y==="other"||Y==="download")&&c.createElement(c.Fragment,null,R?c.createElement(n.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:Ee,disabled:G},"\u4E0B\u8F7D")}):c.createElement(K.ZP,{type:"primary",size:"middle",onClick:Ee,disabled:G},c.createElement(D.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")))}},76902:function(mt,me,b){"use strict";b.d(me,{z:function(){return F},Z:function(){return Y}});var k=b(59301),I=b(8944),K=b(81428),D=b(64018),w=b(81168),_=b(346),O=b(51257),m=b(15342),n=b(1012),y=b(45677),f=b(59301),l=({html:V})=>{const ne=(0,k.useRef)(null),ae=(0,k.useRef)(null),J=`.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,k.useEffect)(()=>{const z=ne.current.attachShadow({mode:"open"});ae.current=document.createElement("div"),ae.current.className="markdown-body",ae.current.innerHTML=V,z.appendChild(ae.current);const Z=document.createElement("style");return Z.textContent=J,z.appendChild(Z),()=>{z.innerHTML=""}},[]),(0,k.useEffect)(()=>{ae.current&&(ae.current.innerHTML=V)},[V]),f.createElement("div",{ref:ne})};function u(V){const ne=["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"],ae=new RegExp(`\\b(${ne.join("|")})\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]*)`,"gi");return V.replace(ae,"").trim()}var p=Object.defineProperty,E=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,x=(V,ne,ae)=>ne in V?p(V,ne,{enumerable:!0,configurable:!0,writable:!0,value:ae}):V[ne]=ae,A=(V,ne)=>{for(var ae in ne||(ne={}))T.call(ne,ae)&&x(V,ae,ne[ae]);if(E)for(var ae of E(ne))L.call(ne,ae)&&x(V,ae,ne[ae]);return V};const P="@\u2581\u2581@",U="@\u2581@",N=/<pre[^>]*>/g;function H(V){let ne=document.createElement("div");return ne.innerHTML=V,ne.childNodes.length===0?"":ne.childNodes[0].nodeValue}const F=(V,ne)=>{V=V||"";const ae=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,J=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,z=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,Z=/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return ne?V.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(ae,(B,G,W,R,C,q,re)=>{const _e=G||R||q,Le=W||C||re||"?";return _.Z.API_SERVER+"/api/attachments/"+_e+Le+"&t="+(0,O.Jn)(_e,Date.now())+(B.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(V=V.replace(Z,(B,G,W,R,C,q,re)=>{const _e=G||R||q,Le=W||C||re||"?";return _.Z.API_SERVER+"/attachments/download/"+_e+Le+"&t="+(0,O.Jn)(_e,Date.now())+(B.indexOf(")")>-1?")":"&")}).replace(ae,(B,G,W,R,C,q,re)=>{const _e=G||R||q,Le=W||C||re||"?";return _.Z.API_SERVER+"/api/attachments/"+_e+Le+"&t="+(0,O.Jn)(_e,Date.now())+(B.indexOf(")")>-1?")":"&")}).replace(J,(B,G,W,R,C)=>{const q=G||R,re=W||C||"";return'"'+_.Z.API_SERVER+"/api/attachments/"+q+re+q+re+"&t="+(0,O.Jn)(q,Date.now())}).replace(z,(B,G,W,R,C)=>{const q=G||R,re=W||C||"";return"("+_.Z.API_SERVER+"/files/uploads/"+q+re+q+re+"&t="+(0,O.Jn)(q,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,`
`),V)};var Y=({value:V="",className:ne,showTextOnly:ae,showLines:J,style:z={},stylesPrev:Z={},highlightKeywords:B,showProgramFill:G,isProgramFill:W,disabledFill:R=!1,programFillValue:C,onFillChange:q=Le=>{},onFillBlur:re=()=>{},onFillFocus:_e=()=>{}})=>{let Le=u(String(V||""));const[qe,be]=(0,k.useState)(""),[je,Me]=(0,k.useState)("office"),[Oe,wt]=(0,k.useState)([]),We=(0,k.useRef)("a"+(0,n.Z)()),lt={},He=de=>/<style[\s\S]*?>/i.test(de||""),vt=(de,Be,Ge)=>{const Ne=document.createElement(de===U?"input":"textarea");Ne.style.width="100%",Ne.style.height=de===U?"40px":"151px",Ne.rows=5,Ne.spellcheck=!1,Ne.name="edu-program-fill",Ne.placeholder="\u8BF7\u8F93\u5165",Ne.dataset.id=Be;const Ye=Object.keys(lt).length;return lt[Ye]=Ne,`<span class="edu-program-fill-wrap ${de===U?"":"show"}" style="width:${de===U?"600px":"100%"}" title=${Ge||""}><span>${Ne.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function Ee(de){return de=de.replace(/!\[.*?\]\(.*?\)/g,""),de=de.replace(/\[.*?\]\(.*?\)/g,""),de=de.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),de=de.replace(/<embed.*?>/g,""),de=de.replace(/<img.*?>/g,""),de=de.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),de=de.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),de=de.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),de=de.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),de}const we=de=>!ae&&He(Le)?de:de.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(Be,Ge){let Ne=Ge.replace(/(\n|\r)/g,"").split("}"),Ye=[];return Ne.map($e=>{$e!=""&&Ye.push(`.${We.current} ${$e}`)}),`<style>${Ye.join("}")}</style>`}),le=(0,k.useMemo)(()=>{try{const Ne=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,Ye=/\"\/api\/attachments\/|\"\/attachments\/download\//g,$e=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,st=/\(\/attachments\/download\//g;Le=Le.replace(st,"("+_.Z.API_SERVER+"/attachments/download/").replace(Ne,"("+_.Z.API_SERVER+"/api/attachments/").replace(Ye,'"'+_.Z.API_SERVER+"/api/attachments/").replace($e,'"'+_.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,`
`)}catch(Ne){}if(G){let Ne=-1;return Le=Le.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,function(Ye,$e,st){var nt;return++Ne,vt(Ye,Ne,(nt=C==null?void 0:C[Ne])==null?void 0:nt.value.replaceAll("<","&lt;").replaceAll(">","&gt;"))}),`<pre style="background:#fff;padding:4px">${we(Le||"")}</pre>`}let de=we(Le);de=(0,K.ZP)(de);const Be=(0,K.ez)();Le.match(/\[TOC\]/)&&(de=de.replace("<p>[TOC]</p>",(0,K.Qv)()),(0,K.Iy)()),de=de.replace(/(__special_katext_id_\d+__)/g,(Ne,Ye)=>{const{type:$e,expression:st}=Be[Ye];return(0,m.renderToString)(H(st)||"",{displayMode:$e==="block",throwOnError:!1,output:"html"})}),de=de.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,K.AL)();const Ge=document.createElement("div");if(Ge.innerHTML=de,ae)return Ge.innerText;if(B){const Ne=B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return ie(Ge,Ne),Ge.innerHTML}return setTimeout(()=>Ie(),500),Ge.innerHTML},[Le,B]);(0,k.useEffect)(()=>{he.current&&he.current.querySelectorAll(["input","textarea"]).forEach(Be=>{Be.oninput=Re,Be.onblur=Fe,Be.onfocus=Ke})},[Oe]),(0,k.useEffect)(()=>{var de,Be,Ge,Ne,Ye;if(C!=null&&C.length)try{const $e=he.current.querySelectorAll(".edu-program-fill-score"),st=he.current.querySelectorAll('[name="edu-program-fill"]');for(const[nt,Je]of st.entries())Je.value=((de=C==null?void 0:C[nt])==null?void 0:de.value)||"",((Be=C==null?void 0:C[nt])==null?void 0:Be.type)==="warning"?Je.className="program-fill-warning":((Ge=C==null?void 0:C[nt])==null?void 0:Ge.type)==="success"?Je.className="program-fill-success":Je.className="";for(const[nt,Je]of $e.entries())Je.innerHTML=(Ne=C==null?void 0:C[nt])!=null&&Ne.score?`${(Ye=C==null?void 0:C[nt])==null?void 0:Ye.score}\u5206`:"";wt(C)}catch($e){console.log($e,"error")}},[C]);const Re=de=>{Oe[de.target.dataset.id]=Oe[de.target.dataset.id]||{},Oe[de.target.dataset.id].value=de.target.value,wt([...Oe]),q(Oe,de.target.dataset.id)},Fe=de=>{Oe[de.target.dataset.id]=Oe[de.target.dataset.id]||{},Oe[de.target.dataset.id].value=de.target.value,wt([...Oe]),re(Oe,de.target.dataset.id)},Ke=de=>{Oe[de.target.dataset.id]=Oe[de.target.dataset.id]||{},Oe[de.target.dataset.id].value=de.target.value,wt([...Oe]),_e(Oe,de.target.dataset.id)};function ie(de,Be){return de.childNodes.forEach(Ge=>{var Ne;if(Ge.childNodes.length>0)ie(Ge,Be);else if(Ge.nodeName!=="IMG")if(Ge.innerHTML)Ge.innerHTML=(Ne=Ge.innerHTML)==null?void 0:Ne.replace(new RegExp(Be,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const Ye=document.createElement("span");Ye.innerHTML=Ge.textContent.replace(new RegExp(Be,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),Ge.replaceWith(Ye)}})}const he=(0,k.useRef)();K.jb.WebkitLineClamp=J,J&&(z=A(A({},z),K.jb));function Te(de){let Be=de.target;if(Be.tagName.toUpperCase()==="A"){let Ge=Be.getAttribute("href");if(Ge.indexOf("office")>-1)de.preventDefault(),be(Ge),Me("office");else if(Ge.indexOf("application/pdf")>-1)de.preventDefault(),be(Ge),Me("pdf");else if(Ge.indexOf("text/html")>-1)de.preventDefault(),be(Ge),Me("html");else if(Ge.startsWith("#")){de.preventDefault();let Ne=document.getElementById(Ge.replace("#",""));Ne&&Ne.scrollIntoView(!0)}}}const Ie=()=>{var de;const Be=(de=he.current)==null?void 0:de.querySelectorAll("video");Be==null||Be.forEach(Ge=>{if(Ge.oncontextmenu=()=>!1,Ge.src.indexOf(".m3u8")>-1&&!Ge.canPlayType("application/vnd.apple.mpegurl")){if(w.ZP.isSupported()){var Ne=new w.ZP;Ne.loadSource(Ge.src),Ne.attachMedia(Ge)}}})};return(0,k.useEffect)(()=>{if(he.current&&le&&le.match(N)&&window.PR.prettyPrint(),he.current)return he.current.addEventListener("click",Te),()=>{var de;(de=he.current)==null||de.removeEventListener("click",Te),(0,K.AL)(),(0,K.Iy)()}},[le,he.current,Te]),(0,k.useEffect)(()=>{var de;const Be=Ge=>{Ge.preventDefault(),Ge.clipboardData.setData("text",window.getSelection().toString())};return(de=he.current)==null||de.addEventListener("copy",Be),()=>{var Ge;(Ge=he.current)==null||Ge.removeEventListener("copy",Be)}},[he.current]),k.createElement(k.Fragment,null,ae&&k.createElement("div",{ref:he},le),!ae&&!He(le)&&k.createElement("div",{ref:he,style:A({},z),className:`${ne||""} ${R?"disabled-fill":""} markdown-body ${We.current}`,dangerouslySetInnerHTML:{__html:le}}),!ae&&He(le)&&k.createElement(l,{html:le}),k.createElement(y.Z,{close:!0,data:qe,type:qe!=null&&qe.length?je:"",style:A({},Z),onClose:()=>be("")}))}},86074:function(mt,me,b){"use strict";b.d(me,{Z:function(){return D}});var k=b(25690),I={ldsRing:"ldsRing___mpBZC",idsRingWrapper:"idsRingWrapper___Of9_n",ldsring:"ldsring___o0w2t"},K=b(59301),D=({message:w,className:_,children:O,style:m={}})=>K.createElement("div",{className:`custom-spinner ${I.idsRingWrapper} ${_}`},K.createElement("div",{className:I.ldsRing},K.createElement("div",null),K.createElement("div",null),K.createElement("div",null),K.createElement("div",null)),w?K.createElement("p",{style:m},w):null,O,K.createElement(k.Outlet,null))},94268:function(mt,me,b){"use strict";b.d(me,{Z:function(){return _}});var k=b(59301),I={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:O,style:m={},leftNode:n,leftTitle:y="\u81EA\u6D4B\u8F93\u5165",rightNode:f,rightTitle:c="\u8FD0\u884C\u7ED3\u679C"})=>k.createElement("div",{className:D()(I.result,O),style:m},k.createElement("div",{className:I.left},k.createElement("div",{className:I.title},k.createElement("i",{style:{color:"#08CF76"},className:"iconfont iconfont icon-zidingyiceshiyongli font14 mr5"}),k.createElement("span",null,y)),k.createElement("div",{className:I.leftNode},n)),k.createElement("div",{className:I.right},k.createElement("div",{className:I.title},k.createElement("i",{style:{color:"#00DFFF"},className:"iconfont iconfont icon-daimazhihangjieguo font14 mr5"}),k.createElement("span",null,c)),k.createElement("div",{className:I.rightNode},f)))},75975:function(mt,me,b){"use strict";b.d(me,{SV:function(){return wt},ZP:function(){return Oe}});var k=b(59301),I=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(`
`)}]},O={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 m=b(53184),n=b.n(m),y=(We,lt,He)=>new Promise((vt,Ee)=>{var we=Fe=>{try{Re(He.next(Fe))}catch(Ke){Ee(Ke)}},le=Fe=>{try{Re(He.throw(Fe))}catch(Ke){Ee(Ke)}},Re=Fe=>Fe.done?vt(Fe.value):Promise.resolve(Fe.value).then(we,le);Re((He=He.apply(We,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=(We,lt,He,vt)=>{const Ee=lt.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:He.lineNumber,endColumn:He.column});return Array.from(new Set(Ee.match(/\b\w{2,}\b/g)||[])).map(le=>({label:le,kind:We.languages.CompletionItemKind.Text,insertText:le,range:vt}))},l=(We,lt,He,vt)=>{We.languages.registerCompletionItemProvider(lt,{provideCompletionItems(Ee,we){const le=Ee.getWordUntilPosition(we),Re={startLineNumber:we.lineNumber,endLineNumber:we.lineNumber,startColumn:le.startColumn,endColumn:le.endColumn},Fe=Ee.getLineContent(we.lineNumber).substring(le.startColumn-2,le.endColumn);return{suggestions:[...c(We,Ee,we,Re),...He.map(ie=>({label:ie,kind:We.languages.CompletionItemKind.Keyword,documentation:ie,insertText:ie,insertTextRules:We.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re})),...vt.map(ie=>({label:ie.label,kind:We.languages.CompletionItemKind.Snippet,documentation:ie.content,insertText:Fe.startsWith("#")?ie.content.replace(/#/,""):ie.content,insertTextRules:We.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re}))]}}})};var u=We=>{f.languages.forEach(lt=>{We.languages.registerDocumentFormattingEditProvider(lt,{provideDocumentFormattingEdits(He){return y(this,null,function*(){const vt=n()(He.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:He.getFullModelRange(),text:vt}]})}})}),l(We,"java",D.keywords,D.quickKey),l(We,"cpp",w.keywords,w.quickKey),l(We,"c",K.keywords,[]),l(We,"python",_.keywords,_.quickKey),l(We,"scala",O.keywords,O.quickKey)};const p="\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=(We,lt,He)=>lt in We?E(We,lt,{enumerable:!0,configurable:!0,writable:!0,value:He}):We[lt]=He,L=(We,lt,He)=>T(We,typeof lt!="symbol"?lt+"":lt,He);const x=class No{constructor(lt,He,vt){this.placeholder=lt,this.editor=He,this.monaco=vt,He.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return No.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 P=x,U=b(96236),N=b(6767),H=b(25399),F=b(89392),Y=b(49535),V=b(56102),ne=Object.defineProperty,ae=Object.defineProperties,J=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,G=(We,lt,He)=>lt in We?ne(We,lt,{enumerable:!0,configurable:!0,writable:!0,value:He}):We[lt]=He,W=(We,lt)=>{for(var He in lt||(lt={}))Z.call(lt,He)&&G(We,He,lt[He]);if(z)for(var He of z(lt))B.call(lt,He)&&G(We,He,lt[He]);return We},R=(We,lt)=>ae(We,J(lt)),C=(We,lt)=>{var He={};for(var vt in We)Z.call(We,vt)&&lt.indexOf(vt)<0&&(He[vt]=We[vt]);if(We!=null&&z)for(var vt of z(We))lt.indexOf(vt)<0&&B.call(We,vt)&&(He[vt]=We[vt]);return He},q=(We,lt,He)=>new Promise((vt,Ee)=>{var we=Fe=>{try{Re(He.next(Fe))}catch(Ke){Ee(Ke)}},le=Fe=>{try{Re(He.throw(Fe))}catch(Ke){Ee(Ke)}},Re=Fe=>Fe.done?vt(Fe.value):Promise.resolve(Fe.value).then(we,le);Re((He=He.apply(We,lt)).next())});function re(We){return/^\d+$/.test(We)?`${We}px`:We}function _e(){}let Le=!1;const qe={"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 be(We=[]){let lt=We;if(Array.isArray(We)){for(let He=0;He<We.length;He++){let vt=qe[We[He]];if(vt)return vt}return lt[0]}return qe[lt]||lt}let je=null;const Me=()=>q(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch(We){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",We)}});var Oe=We=>{var lt=We,{width:He="100%",height:vt="100%",value:Ee,language:we="javascript",style:le={},options:Re={},overrideServices:Fe={},theme:Ke="vs-dark",onEditBlur:ie,isCopy:he=!1,onSave:Te,autoHeight:Ie=!1,forbidCopy:de=!1,onChange:Be=_e,editorDidMount:Ge=_e,onFocus:Ne=_e,onBreakPoint:Ye=_e,breakPointValue:$e=[],filename:st="educoder.txt",errorLine:nt,errorContent:Je="",highlightLine:tt,openBreakPoint:gt=!1,placeholder:_t="",showMiniMap:it=!0}=lt,Dt=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 Tt=(0,k.useRef)(),at=(0,k.useRef)({}),Ot=(0,k.useRef)(),Ut=(0,k.useRef)(),rt=(0,k.useRef)([]),xt=(0,k.useRef)(!1),xe=(0,k.useRef)(),ge=(0,k.useRef)(),ye=(0,k.useRef)(!1),[ee,te]=(0,k.useState)(!1);function ue(){let et;return Tt.current&&(et=new I.Z(ze=>{for(let ht of ze)(ht.target.offsetHeight>0||ht.target.offsetWidth>0)&&at.current.instance.layout()}),et.observe(Tt.current)),et}function fe(){N.ZP.warning({content:decodeURIComponent(p),key:"monaco-editor-tip"})}const pe=()=>{let et=at.current.instance;if(Ee!=null&&et&&ee){const ze=et.getModel();ze&&Ee!==ze.getValue()&&(Le=!0,ze.setValue(Ee),et.layout(),Le=!1)}};(0,k.useEffect)(()=>{const et=Y.Z.subscribe("formatDocument",ze=>{var ht;let Bt=at.current.instance;(ht=Bt==null?void 0:Bt.getAction)==null||ht.call(Bt,"editor.action.formatDocument").run()});return window.updateMonacoValue=ze=>{Be(ze)},et},[]),(0,k.useEffect)(()=>{var et;let ze=at.current.instance;Ut.current&&clearTimeout(Ut.current),Ut.current=setTimeout(()=>{pe()},500),Ee&&(Ee!=null&&Ee.length)&&((et=ze==null?void 0:ze.updateOptions)==null||et.call(ze,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(Ee.split(/\r\n|\r|\n/g).length))+3,5)}))},[Ee,ee,at.current]),(0,k.useEffect)(()=>{if(nt&&at.current&&at.current.instance){let ze=at.current.instance;ze.changeViewZones(function(ht){var Bt=document.createElement("div");Bt.style.padding="10px 20px",Bt.style.width="calc(100% - 20px)",Bt.className="my-error-line-wrp",Bt.innerHTML=Je,ht.addZone({afterLineNumber:nt||11,heightInLines:3,domNode:Bt})});var et={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}};ze.addOverlayWidget(et),ze.revealPositionInCenter({lineNumber:20,column:1})}},[nt,at.current,ee]);const Ze=(et="",ze)=>{if(!et||et.trim()==="")return!0;const Bt=at.current.instance.getModel().getLineTokens(ze);let $t=!1;for(let Zt=0;Zt<2;Zt++)Bt.getStandardTokenType(Zt)===1&&($t=!0);return $t};(0,k.useEffect)(()=>{var et;const ze=(et=at.current)==null?void 0:et.instance;if(ze&&ee&&de){const ht=ze.onDidBlurEditorWidget(()=>{ye.current=!1}),Bt=ze.onDidFocusEditorText(()=>{ye.current=!0});return()=>{ht.dispose(),Bt.dispose()}}},[at.current,ee,de]),(0,k.useEffect)(()=>{var et;if((et=at.current)!=null&&et.instance&&ee&&gt){let ze=at.current.instance,ht=ze.getModel();if(!ht)return;(()=>{var At;let Gt=[],Wt=[];const vi=ht.getAllDecorations();for(let bi of vi)bi.options.className==="highlighted-line"&&(Gt.push((At=bi==null?void 0:bi.range)==null?void 0:At.startLineNumber),Wt.push(bi==null?void 0:bi.id));if(tt===Gt[0])return;ht.deltaDecorations(Wt,[]);const si=ht.getLineCount();tt&&tt<=si&&(ze.deltaDecorations([],[{range:new je.Range(tt,1,tt,ht.getLineMaxColumn(tt)),options:{isWholeLine:!0,className:"highlighted-line"}}]),ze.revealLineInCenter(tt))})();const $t=(At=!1)=>{var Gt;let Wt=[],vi=[];const si=ht.getAllDecorations();for(let bi of si)bi.options.linesDecorationsClassName==="breakpoints-select"&&(Wt.push((Gt=bi==null?void 0:bi.range)==null?void 0:Gt.startLineNumber),vi.push(bi==null?void 0:bi.id));if(At)return{lines:Wt,ids:vi};Ye(Wt)},Zt=At=>q(void 0,null,function*(){let Gt={range:new je.Range(At,1,At,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield ht.deltaDecorations([],[Gt]),$t()}),wi=At=>q(void 0,null,function*(){let Gt=[];const Wt=ze.getLineDecorations(At);for(let vi of Wt)vi.options.linesDecorationsClassName==="breakpoints-select"&&Gt.push(vi.id);yield ht.deltaDecorations(Gt,[]),$t()}),yi=At=>{let Gt=ze.getLineDecorations(At);for(let Wt of Gt)if(Wt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,F.isEqual)($e,$t(!0).lines)){ht.deltaDecorations($t(!0).ids,[]);const At=$e.map(Gt=>({range:new je.Range(Gt,1,Gt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));ht.deltaDecorations([],At)}const li=ze.onDidChangeModelContent(At=>{let Gt=ze.getPosition();if(Gt){let Wt=Gt.lineNumber;clearTimeout(ge.current),ge.current=setTimeout(()=>{Ze(ht.getLineContent(Wt),Wt)?wi(Wt):yi(Wt)?(wi(Wt),Zt(Wt)):$t()},100)}}),mi=ze.onMouseDown(At=>{var Gt,Wt,vi;if(At.target.detail&&((vi=(Wt=(Gt=At.target)==null?void 0:Gt.element)==null?void 0:Wt.className)!=null&&vi.includes("line-numbers"))){let si=At.target.position.lineNumber;if(Ze(ht.getLineContent(si),si))return;yi(si)?wi(si):Zt(si)}}),jt=At=>{let Gt={range:new je.Range(At,1,At,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};rt.current=ze.deltaDecorations(rt.current,[Gt])},Fi=()=>{rt.current=ze.deltaDecorations(rt.current,[])},ni=ze.onMouseMove(At=>{var Gt,Wt,vi;if(Fi(),At.target.detail&&((vi=(Wt=(Gt=At.target)==null?void 0:Gt.element)==null?void 0:Wt.className)!=null&&vi.includes("line-numbers"))){let si=At.target.position.lineNumber;if(Ze(ht.getLineContent(si),si))return;jt(si)}}),pr=ze.onMouseLeave(()=>{Fi()});return()=>{li.dispose(),mi.dispose(),ni.dispose(),pr.dispose()}}},[at.current,ee,$e,tt,gt,we]),(0,k.useEffect)(()=>{var et;(et=at.current)!=null&&et.instance&&gt&&at.current.instance.setPosition({lineNumber:0,column:0})},[tt]);function Qe(){let et=at.current.instance;if(et){const ze=et.getSelection(),ht=at.current.pastePos||{},Bt=new je.Range(ht.startLineNumber||ze.endLineNumber,ht.startColumn||ze.endColumn,ht.endLineNumber||ze.endLineNumber,ht.endColumn||ze.endColumn);setTimeout(()=>{et.executeEdits("",[{range:Bt,text:""}])},300)}}function ut(et){(window.navigator.platform.match("Mac")?et.metaKey:et.ctrlKey)&&et.keyCode==83&&(et.preventDefault(),Te())}const dt=()=>{if(Ie&&at.current.instance){const et=at.current.instance.getContentHeight();ti(et<vt?vt:et)}else ti(vt)};function kt(et){var ze=document.createEvent("MouseEvents");ze.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),et.dispatchEvent(ze)}const zt=et=>{if(!ye.current)return;const{keyCode:ze,ctrlKey:ht,metaKey:Bt,target:$t,type:Zt}=et;return(Zt==="paste"||(ze===67||ze===86)&&(Bt||ht))&&$t.nodeName==="TEXTAREA"&&(fe(),et.preventDefault()),!1};function Nt(et,ze){var ht=window.URL||window.webkitURL||window,Bt=new Blob([ze]),$t=document.createElementNS("http://www.w3.org/1999/xhtml","a");$t.href=ht.createObjectURL(Bt),$t.download=et,kt($t)}(0,k.useEffect)(()=>{dt()},[dt]),(0,k.useEffect)(()=>{Tt.current&&!ee&&Promise.all([b.e(8909),b.e(6656)]).then(b.bind(b,71448)).then(et=>{try{je=et,at.current.instance=je.editor.create(Tt.current,{value:Ee,language:be(we),theme:Ke,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:it||!1}},Fe);const ze=at.current.instance;let $t=[...U.BH._menuItems].find(li=>li[0]._debugName=="EditorContext")[1],Zt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],wi=(li,mi)=>{var jt,Fi;let ni=li._first;do mi.includes((Fi=(jt=ni.element)==null?void 0:jt.command)==null?void 0:Fi.id)&&li._remove(ni);while(ni=ni.next)};if(Ge(ze,je),setTimeout(()=>{dt(),at.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{Nt(st||"educoder.txt",ze.getValue())}})},500),at.current.subscription=ze.onDidChangeModelContent(li=>{xt.current?clearTimeout(xe.current):(dt(),Be(ze.getValue(),li)),xe.current=setTimeout(()=>{xt.current=!1},500)}),window.Monaco||u(je,be(we)),de&&(wi($t,Zt),Tt.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",zt),window.removeEventListener("paste",zt),window.addEventListener("keydown",zt),window.addEventListener("paste",zt)),window.Monaco=je,ie&&ze.onDidBlurEditorWidget(()=>{ie(ze.getValue())}),Ne&&ze.onDidFocusEditorText(()=>{de&&Me(),Ne(ze.getValue())}),de){Me();try{ze.onDidPaste(li=>{const mi=ze.getSelection(),jt=at.current.pastePos||{},Fi=new je.Range(jt.startLineNumber||mi.endLineNumber,jt.startColumn||mi.endColumn,jt.endLineNumber||mi.endLineNumber,jt.endColumn||mi.endColumn);ze.executeEdits("",[{range:li.range,text:""}])})}catch(li){}}let yi=ue();return _t&&typeof _t=="string"&&new P(_t,ze,je),te(!0),()=>{const li=at.current.instance;li.dispose();const mi=li.getModel();mi&&mi.dispose(),at.current.subscription&&at.current.subscription.dispose(),yi.unobserve(Tt.current)}}catch(ze){}})},[]),(0,k.useEffect)(()=>{if(at.current.instance&&ee)return document.addEventListener("keydown",ut,!1),()=>{document.removeEventListener("keydown",ut)}},[Te,ee]),(0,k.useEffect)(()=>{let et=at.current.instance;if(et&&ee){let ze=be(we);je.editor.setModelLanguage(et.getModel(),ze)}},[we,ee]),(0,k.useEffect)(()=>{at.current.instance&&ee&&je.editor.setTheme(Ke)},[Ke,ee]),(0,k.useEffect)(()=>{let et=at.current.instance;Ot.current=Re,et&&ee&&(et.updateOptions(W({},Re)),setTimeout(()=>{et.getModel().updateOptions(W({},Re))},200))},[JSON.stringify(Re),ee]),(0,k.useEffect)(()=>{let et=at.current.instance;et&&ee&&et.layout()},[He,vt,ee]);const[Ct,oi]=(0,k.useState)(re(He)),[_i,ti]=(0,k.useState)(re(vt)),ri=R(W({},le),{width:Ct,height:_i,position:"relative"});return k.createElement("div",{className:"my-monaco-editor",ref:Tt,style:ri},he&&k.createElement(V.CopyToClipboard,{text:Ee,onCopy:()=>N.ZP.success("\u590D\u5236\u6210\u529F")},k.createElement(H.Z,{title:"\u590D\u5236\u4EE3\u7801"},k.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},k.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function wt({width:We="100%",height:lt="100%",original:He,modified:vt,language:Ee,options:we={}}){const le=(0,k.useRef)(),[Re,Fe]=(0,k.useState)(null);function Ke(Ie){let de;return le.current&&(de=new I.Z(Be=>{for(let Ge of Be)(Ge.target.offsetHeight>0||Ge.target.offsetWidth>0)&&Ie.layout()}),de.observe(le.current)),de}(0,k.useEffect)(()=>(le.current&&Promise.all([b.e(8909),b.e(9404)]).then(b.bind(b,2550)).then(Ie=>{je=Ie;const de=je.editor.createDiffEditor(le.current,R(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},we),{wordWrap:!0}));Fe(de);let Be=Ke(de);return()=>{de.dispose();const Ge=de.getModel();Ge&&Ge.dispose(),Be.unobserve(le.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,k.useEffect)(()=>{Re&&Re.setModel({original:je.editor.createModel(He,Ee),modified:je.editor.createModel(vt,Ee)})},[He,vt,Ee,Re]);const ie=re(We),he=re(lt),Te={width:ie,height:he};return k.createElement("div",{className:"my-diff-editor",ref:le,style:Te})}},84958:function(mt,me,b){"use strict";b.r(me),b.d(me,{default:function(){return l}});var k=b(59301),I=b(42909),K=b(346),D=b(25690),w=b(29787),_=b(94881),O=b(10866),m=b(75975),n=b(24334),y=b(61186),f=b.n(y),c=(u,p,E)=>new Promise((T,L)=>{var x=U=>{try{P(E.next(U))}catch(N){L(N)}},A=U=>{try{P(E.throw(U))}catch(N){L(N)}},P=U=>U.done?T(U.value):Promise.resolve(U.value).then(x,A);P((E=E.apply(u,p)).next())}),l=()=>{const{submitId:u,id:p}=(0,D.useParams)(),[E,T]=(0,k.useState)(void 0);console.log((0,D.useLocation)(),33);const L=(0,D.useLocation)();function x(){var q;D.history.push(`/problems/${p}/oj/${(q=L==null?void 0:L.query)==null?void 0:q.backId}?tab=1`)}(0,k.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,k.useEffect)(()=>{document.title="\u5728\u7EBF\u5237\u9898"}),(0,k.useEffect)(()=>{u&&function(){return c(this,null,function*(){const re=yield(0,_.X6)(u);T(re.data)})}()},[u]);const{status:A,created_at:P,code:U,name:N,language:H,pass_sets_count:F,set_count:Y,error_msg:V,output:ne,input:ae,expected_output:J,execute_memory:z,user:Z,execute_time:B,input_file_url:G,output_file_url:W,is_file:R,expected_output_file_url:C}=E||{};return k.createElement(w.Z,{spinning:!E,delay:500},k.createElement("div",{className:"record-detail-info"},E?k.createElement(k.Fragment,null,k.createElement("header",{className:I.Z.header},k.createElement("div",null,k.createElement("img",{src:`${K.Z.IMG_SERVER}/images/${Z.image_url}`,alt:"user",width:30}),k.createElement("span",null,Z.name)),k.createElement("h2",null," ",N," "),k.createElement("button",{className:"ant-btn",onClick:x,style:{border:"1px solid #bacffe",color:"#3061d0"}},"\u8FD4\u56DE\u8BE5\u9898")),k.createElement("div",{className:"record-detail-body"},k.createElement("h2",null," \u63D0\u4EA4\u8BB0\u5F55 "),k.createElement("ul",{className:"record-info"},k.createElement("li",null," \u72B6\u6001\uFF1A",k.createElement("span",{className:A===0?"c-green":"c-red"},O.Im[A])," "),k.createElement("li",null," \u63D0\u4EA4\u65F6\u95F4\uFF1A",k.createElement("span",null,f()(P).format("YYYY-MM-DD HH:mm:ss"))," "),k.createElement("li",null," \u8BED\u8A00\uFF1A",k.createElement("span",null,H)," "),k.createElement("li",null," \u6267\u884C\u7528\u65F6\uFF1A",k.createElement("span",null,B*1e3,"ms")," "),k.createElement("li",null," ",`${F} / ${Y} \u4E2A\u901A\u8FC7\u7684\u6D4B\u8BD5\u7528\u4F8B`," ")),(0,O.gZ)({status:A,error_msg:V,execute_time:B,output:ne,input:ae,expected_output:J,input_file_url:G,output_file_url:W,is_file:R,expected_output_file_url:C}),k.createElement("h2",null," \u63D0\u4EA4\u7684\u5185\u5BB9 "),k.createElement(m.ZP,{height:"200px",width:"100%",language:H==null?void 0:H.toLocaleLowerCase(),value:n.Base64.decode(U),options:{readOnly:!0}}))):null))}},10866:function(mt,me,b){"use strict";b.d(me,{Im:function(){return V},ZP:function(){return B},gZ:function(){return z}});var k=b(59301),I=b(37568),K=b(99571),D=b(84105),w=b(87395),_=b(24363),O=b(24334),m=b(86074),n=b(76902),y=b(51257),f=b(94268),c=b(34376),l=b(92310),u=b.n(l),p=b(59301),E=Object.defineProperty,T=Object.defineProperties,L=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,U=(G,W,R)=>W in G?E(G,W,{enumerable:!0,configurable:!0,writable:!0,value:R}):G[W]=R,N=(G,W)=>{for(var R in W||(W={}))A.call(W,R)&&U(G,R,W[R]);if(x)for(var R of x(W))P.call(W,R)&&U(G,R,W[R]);return G},H=(G,W)=>T(G,L(W));const{TextArea:F}=I.default,Y={visible:!1,tabIndex:"0"},V={[_.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 ne=(G=>(G[G.SET_VISIBLE=0]="SET_VISIBLE",G[G.SET_TABINDEX=1]="SET_TABINDEX",G))(ne||{});function ae(G,W){switch(W.type){case 0:return H(N({},G),{visible:W.payload});case 1:return H(N({},G),{tabIndex:W.payload});default:throw new Error}}function J({value:G,className:W}){const[R,C]=(0,k.useState)(!1),q=(0,k.useRef)(),re=(0,k.useRef)();return(0,k.useEffect)(()=>{R&&(re.current.reset(),re.current.write((0,y.pp)(G||"")))},[G,R]),(0,k.useEffect)(()=>{var _e,Le,qe,be;if(q.current){re.current=new c.Terminal({fontSize:14,disableStdin:!0}),re.current.open(q.current);const je=q.current.offsetWidth-14,Me=((be=(qe=(Le=(_e=re.current)==null?void 0:_e._core)==null?void 0:Le._renderService)==null?void 0:qe.dimensions)==null?void 0:be.actualCellWidth)||9.5,Oe=Math.ceil(je/Me);re.current.resize(Oe,8),C(!0)}},[]),p.createElement("div",{ref:q,className:u()("XtermText-valueRef",W)})}function z(G){const{status:W,error_msg:R,output:C,input:q,expected_output:re,is_file:_e,input_file_url:Le,output_file_url:qe,expected_output_file_url:be}=G;let je=null;const Me={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch(W){case _.h.NOMATCH:je=p.createElement(p.Fragment,null,p.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),!_e&&p.createElement(J,{className:"mb10",value:q}),_e&&p.createElement("div",{style:Me},p.createElement("a",{onClick:()=>(0,y.LR)(Le,q)},q)),p.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),!_e&&p.createElement(J,{className:"mb10",value:C&&O.Base64.decode(C)||""}),_e&&p.createElement("div",{style:Me},p.createElement("a",{onClick:()=>(0,y.LR)(qe,C)},C)),p.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),!_e&&p.createElement(J,{className:"mb10",value:re&&O.Base64.decode(re)||""}),_e&&p.createElement("div",{style:Me},p.createElement("a",{onClick:()=>(0,y.LR)(be,re)},re)));break;case _.h.EXECUTEFAILURE:je=p.createElement(p.Fragment,null,p.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!_e&&p.createElement(n.Z,{value:q,style:Me}),_e&&p.createElement("div",{style:Me},p.createElement("a",{onClick:()=>(0,y.LR)(Le,q)},q)),p.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),p.createElement("pre",{className:"error"},O.Base64.decode(R)));break;case _.h.COMPILEFAILURE:je=p.createElement(p.Fragment,null,p.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!_e&&p.createElement(n.Z,{value:q,style:Me}),_e&&p.createElement("div",{style:Me},p.createElement("a",{onClick:()=>(0,y.LR)(Le,q)},q)),p.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),p.createElement("pre",{className:"error"},O.Base64.decode(R)));break;case _.h.PODFAILURE:je=p.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case _.h.TIMEOUT:je=p.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return p.createElement(p.Fragment,null," ",je," ")}function Z(G){const{status:W,error_msg:R,execute_time:C,output:q,input:re,expected_output:_e,is_file:Le,input_file_url:qe,output_file_url:be,expected_output_file_url:je}=G;let Me=null;switch(W){case _.h.OK:Me=p.createElement(p.Fragment,null,p.createElement("p",null,"\u6267\u884C\u7528\u65F6\uFF1A",C,"\u79D2"),p.createElement("p",null,"\u6267\u884C\u7ED3\u679C\uFF1A"),p.createElement("pre",null,O.Base64.decode(q)));break;case _.h.NOMATCH:Me=p.createElement(p.Fragment,null,p.createElement("p",null,"\u8F93\u5165\uFF1A",p.createElement("pre",null,re)),p.createElement("p",null,"\u8F93\u51FA\uFF1A",q&&O.Base64.decode(q)),p.createElement("p",null,"\u9884\u671F\u8F93\u51FA\uFF1A",_e&&O.Base64.decode(_e)));break;case _.h.EXECUTEFAILURE:Me=p.createElement(p.Fragment,null,p.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",p.createElement("pre",null,re)),p.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),p.createElement("pre",{className:"error"},O.Base64.decode(R)));break;case _.h.COMPILEFAILURE:Me=p.createElement(p.Fragment,null,p.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",p.createElement("pre",null,re)),p.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),p.createElement("pre",{className:"error"},O.Base64.decode(R)));break;case _.h.PODFAILURE:Me=p.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case _.h.TIMEOUT:Me=p.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return p.createElement(p.Fragment,null," ",Me," ")}var B=({id:G,is_file:W,input:R,debuging:C,submitting:q,executingMessage:re,debugResult:_e,onChangeInput:Le,onDebugCode:qe,onSubmitCode:be})=>{const[je,Me]=(0,k.useReducer)(ae,Y),{visible:Oe,tabIndex:wt}=je;(0,k.useEffect)(()=>{Me({type:0,payload:!1})},[G]);function We(Ee){let we=Ee.target.id;Me({type:1,payload:we})}function lt(){Me({type:0,payload:!Oe})}const He=(0,k.useMemo)(()=>{if(_e){const{status:Ee}=_e;return p.createElement(p.Fragment,null,Z(_e))}return null},[_e]);function vt(){Me({type:0,payload:!0}),Me({type:1,payload:"1"}),qe()}return p.createElement("div",{className:"test-case-panel"},p.createElement("div",{className:`test-case-panel-body ${Oe?"active":""}`},p.createElement("ul",{className:"s-navs"},p.createElement("li",null,p.createElement("a",{className:"active"},"\u8C03\u8BD5\u4EE3\u7801\u7ED3\u679C"))),p.createElement(f.Z,{leftTitle:"\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B",rightTitle:"\u4EE3\u7801\u6267\u884C\u7ED3\u679C",style:{height:240},leftNode:p.createElement(F,{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?"":R,onChange:Le}),rightNode:C?p.createElement(m.Z,{message:"\u4EE3\u7801\u6267\u884C\u4E2D..."}):_e?He:p.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")})),p.createElement("a",{className:`btn-collapse ${Oe?"up":""}`,onClick:lt},Oe?p.createElement(D.Z,null):p.createElement(w.Z,null)),p.createElement("footer",{className:"footer"},p.createElement("span",{style:{visibility:"hidden"}},"\u63A7\u5236\u53F0"),p.createElement("div",{className:"flex-container"},p.createElement(K.ZP,{id:"oj-prev",className:"btn-blue",type:"ghost"},"\u4E0A\u4E00\u9898"),p.createElement(K.ZP,{id:"oj-next",className:"btn-blue",type:"ghost"},"\u4E0B\u4E00\u9898"),p.createElement(K.ZP,{className:"btn-green",type:"ghost",loading:C,onClick:vt},"\u8C03\u8BD5\u4EE3\u7801"),p.createElement(K.ZP,{type:"primary",className:"custom-ant-disabled",loading:q,disabled:q,onClick:()=>{Me({type:0,payload:!1}),be()}},"\u8BC4\u6D4B\u5E76\u63D0\u4EA4"))))}},24363:function(mt,me,b){"use strict";b.d(me,{h:function(){return k}});var k=(I=>(I[I.NOMATCH=-1]="NOMATCH",I[I.OK=0]="OK",I[I.TIMEOUT=2]="TIMEOUT",I[I.PODFAILURE=3]="PODFAILURE",I[I.COMPILEFAILURE=4]="COMPILEFAILURE",I[I.EXECUTEFAILURE=5]="EXECUTEFAILURE",I[I.HIDE_COMPILE_STATUS=11]="HIDE_COMPILE_STATUS",I))(k||{})},94881:function(mt,me,b){"use strict";b.d(me,{H7:function(){return n},KC:function(){return u},M3:function(){return L},MK:function(){return m},MU:function(){return D},Rg:function(){return P},WH:function(){return p},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 I},gu:function(){return T},n4:function(){return f},qe:function(){return A},rL:function(){return U},rX:function(){return O},uc:function(){return H},vl:function(){return l},wO:function(){return x},zO:function(){return w}});var k=b(38986);function I(F){return(0,k.U2)(`mypractices/${F}.json`,{hidePopLogin:!0})}function K(F,Y){return(0,k.v_)(`mypractices/${F}/code_submit.json`,Y)}function D(F,Y){return(0,k.v_)(`mypractices/${F}/code_debug.json`,Y)}function w(F,Y){return Y.language&&(Y.language=encodeURIComponent(Y.language)),(0,k.U2)(`mypractices/${F}/submit_records.json`,Y)}function _(F){return(0,k.U2)("mypractices/record_detail.json",{id:F})}function O(F,Y){return(0,k.U2)(`mypractices/${F}/result.json`,{mode:Y})}function m(F,Y){return(0,k.v_)(`mypractices/${F}/add_notes.json`,Y)}function n(F,Y){return(0,k.v_)(`mypractices/${F}/restore_initial_code.json`,Y)}function y(F,Y){return(0,k.v_)(`mypractices/${F}/sync_code.json`,Y)}function f(F,Y){return(0,k.v_)(`mypractices/${F}/update_code.json`,Y)}function c(F){return(0,k.v_)(`mypractices/${F}/initial_codes.json`)}function l(F,Y){return(0,k.v_)(`discusses/${F}/plus.json`,Y)}function u(F){return(0,k.U2)("practices/practices_list.json",F)}function p(F,Y){return(0,k.U2)(`practices/${F}/question_solution_articles`,Y)}function E(F,Y){return(0,k.v_)(`practices/${F}/question_solution_articles`,Y)}function T(F,Y){return(0,k.gz)(`practices/${F}/question_solution_articles/${Y==null?void 0:Y.active}`,Y)}function L(F,Y){return(0,k.U2)(`practices/${F}/question_solution_articles/${Y==null?void 0:Y.active}/edit`,Y)}function x(F,Y){return(0,k.U2)(`practices/${F}/question_solution_articles/${Y==null?void 0:Y.active}`,Y)}function A(F,Y){return(0,k.v_)(`practices/${F}/question_solution_articles/${Y==null?void 0:Y.active}/set_authority_or_excellent`,Y)}function P(F,Y){return(0,k.v_)(`practices/${F}/question_solution_articles/${Y==null?void 0:Y.active}/praise_or_treads`,Y)}function U(F,Y){return(0,k.v_)(`practices/${F}/question_solution_articles/${Y==null?void 0:Y.active}/hide`)}function N(F,Y){return(0,k.IV)(`practices/${F}/question_solution_articles/${Y==null?void 0:Y.active}`,Y)}function H(F,Y){return(0,k.v_)(`mypractices/${F}/update_practice_time_sum`,Y)}},81428:function(mt,me,b){"use strict";b.d(me,{AL:function(){return P},Iy:function(){return f},Qv:function(){return u},ez:function(){return A},jb:function(){return c}});var k=b(32834),I=b.n(k),K=b(11690),D=b.n(K);let w=1;function _(Y,V){const ne=Y.match(/^(\s+)(?:```)/);if(ne===null)return V;const ae=ne[1];return V.split(`
`).map(J=>{const z=J.match(/^\s+/);if(z===null)return J;const[Z]=z;return Z.length>=ae.length?J.slice(ae.length):J}).join(`
`)}let O=[],m=["<ul>"];const n=new(I()).Renderer,y=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function f(){O.length=0,m=["<ul>"]}const c={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(Y,V,ne,ae){if(V>=Y.length||Y[V].level<=ne)return V;var J=Y[V];ae.push("<li><a href='#"+w+J.anchor+"'>"+J.text+"</a>"),V++;var z=[];return V=l(Y,V,J.level,z),z.length>0&&(ae.push("<ul>"),z.forEach(function(Z){ae.push(Z)}),ae.push("</ul>")),ae.push("</li>"),V=l(Y,V,ne,ae),V}function u(){return l(O,0,0,m),m.push("</ul>"),m.join("")}const p={heading(Y){const V=y.exec(Y);if(w+=1,V)return{type:"heading",raw:V[0],depth:V[1].length,text:V[2]}},fences(Y){const V=this.rules.block.fences.exec(Y);if(V){const ne=V[0];let ae=_(ne,V[3]||"");const J=V[2]?V[2].trim():V[2];if(["latex","katex","math"].indexOf(J)>=0){const z=L(),Z=ae;ae=z,x[z]={type:"block",expression:Z}}return{type:"code",raw:ne,lang:J,text:ae}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let T=0;const L=()=>`__special_katext_id_${T++}__`;let x={};function A(){return x}function P(){T=0,x={}}function U(Y){return Y=Y.replace(E,(V,ne)=>{const ae=L();return x[ae]={type:"inline",expression:ne},ae}),Y}const N=n.listitem;n.listitem=function(Y){return N(U(Y))};const H=n.paragraph;n.paragraph=function(Y){return H(U(Y))};const F=n.tablecell;n.tablecell=function(Y,V){return F(U(Y),V)},n.code=function(Y,V,ne){const ae=(V||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?`<p class='editormd-tex'>${Y}</p>`:`<pre class="prettyprint linenums"><code class="language-${V}">${ne?Y:(0,K.escape)(Y,!0)}</code></pre>
`:'<pre class="prettyprint linenums"><code>'+(ne?Y:(0,K.escape)(Y,!0))+"</code></pre>"},n.heading=function(Y,V,ne){let ae=this.options.headerPrefix+ne.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return O.push({anchor:ae,level:V,text:Y}),"<h"+V+' id="'+w+ae+'">'+Y+"</h"+V+">"},I().setOptions({silent:!0,gfm:!0,pedantic:!1}),I().use({tokenizer:p,renderer:n}),me.ZP=I()},64018:function(){var mt,me,b,k=!1,I,K;window.PR_SHOULD_USE_CONTINUATION=!0;var D,w;(function(){var _=window,O=["break,continue,do,else,for,if,return,while"],m=[O,"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"],n=[m,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],y=[n,"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=[n,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],c=[n,"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",u=[n,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],p="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=[O,"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=[O,"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=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],x=[y,c,f,u,p,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/,P="str",U="kwd",N="com",H="typ",F="lit",Y="pun",V="pln",ne="tag",ae="dec",J="src",z="atn",Z="atv",B="nocode",G="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function W(we){for(var le=0,Re=!1,Fe=!1,Ke=0,ie=we.length;Ke<ie;++Ke){var he=we[Ke];if(he.ignoreCase)Fe=!0;else if(/[a-z]/i.test(he.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,Fe=!1;break}}var Te={b:8,t:9,n:10,v:11,f:12,r:13};function Ie(Ye){var $e=Ye.charCodeAt(0);if($e!==92)return $e;var st=Ye.charAt(1);return $e=Te[st],$e||("0"<=st&&st<="7"?parseInt(Ye.substring(1),8):st==="u"||st==="x"?parseInt(Ye.substring(2),16):Ye.charCodeAt(1))}function de(Ye){if(Ye<32)return(Ye<16?"\\x0":"\\x")+Ye.toString(16);var $e=String.fromCharCode(Ye);return $e==="\\"||$e==="-"||$e==="]"||$e==="^"?"\\"+$e:$e}function Be(Ye){var $e=Ye.substring(1,Ye.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")),st=[],nt=$e[0]==="^",Je=["["];nt&&Je.push("^");for(var tt=nt?1:0,gt=$e.length;tt<gt;++tt){var _t=$e[tt];if(/\\[bdsw]/i.test(_t))Je.push(_t);else{var it=Ie(_t),Dt;tt+2<gt&&$e[tt+1]==="-"?(Dt=Ie($e[tt+2]),tt+=2):Dt=it,st.push([it,Dt]),Dt<65||it>122||(Dt<65||it>90||st.push([Math.max(65,it)|32,Math.min(Dt,90)|32]),Dt<97||it>122||st.push([Math.max(97,it)&-33,Math.min(Dt,122)&-33]))}}st.sort(function(Ut,rt){return Ut[0]-rt[0]||rt[1]-Ut[1]});for(var Tt=[],at=[],tt=0;tt<st.length;++tt){var Ot=st[tt];Ot[0]<=at[1]+1?at[1]=Math.max(at[1],Ot[1]):Tt.push(at=Ot)}for(var tt=0;tt<Tt.length;++tt){var Ot=Tt[tt];Je.push(de(Ot[0])),Ot[1]>Ot[0]&&(Ot[1]+1>Ot[0]&&Je.push("-"),Je.push(de(Ot[1])))}return Je.push("]"),Je.join("")}function Ge(Ye){for(var $e=Ye.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")),st=$e.length,nt=[],Je=0,tt=0;Je<st;++Je){var gt=$e[Je];if(gt==="(")++tt;else if(gt.charAt(0)==="\\"){var _t=+gt.substring(1);_t&&(_t<=tt?nt[_t]=-1:$e[Je]=de(_t))}}for(var Je=1;Je<nt.length;++Je)nt[Je]===-1&&(nt[Je]=++le);for(var Je=0,tt=0;Je<st;++Je){var gt=$e[Je];if(gt==="(")++tt,nt[tt]||($e[Je]="(?:");else if(gt.charAt(0)==="\\"){var _t=+gt.substring(1);_t&&_t<=tt&&($e[Je]="\\"+nt[_t])}}for(var Je=0;Je<st;++Je)$e[Je]==="^"&&$e[Je+1]!=="^"&&($e[Je]="");if(Ye.ignoreCase&&Re)for(var Je=0;Je<st;++Je){var gt=$e[Je],it=gt.charAt(0);gt.length>=2&&it==="["?$e[Je]=Be(gt):it!=="\\"&&($e[Je]=gt.replace(/[a-zA-Z]/g,function(at){var Ot=at.charCodeAt(0);return"["+String.fromCharCode(Ot&-33,Ot|32)+"]"}))}return $e.join("")}for(var Ne=[],Ke=0,ie=we.length;Ke<ie;++Ke){var he=we[Ke];if(he.global||he.multiline)throw new Error(""+he);Ne.push("(?:"+Ge(he)+")")}return new RegExp(Ne.join("|"),Fe?"gi":"g")}function R(we,le){var Re=/(?:^|\s)nocode(?:\s|$)/,Fe=[],Ke=0,ie=[],he=0;function Te(Ie){var de=Ie.nodeType;if(de==1){if(Re.test(Ie.className))return;for(var Be=Ie.firstChild;Be;Be=Be.nextSibling)Te(Be);var Ge=Ie.nodeName.toLowerCase();(Ge==="br"||Ge==="li")&&(Fe[he]=`
`,ie[he<<1]=Ke++,ie[he++<<1|1]=Ie)}else if(de==3||de==4){var Ne=Ie.nodeValue;Ne.length&&(le?Ne=Ne.replace(/\r\n?/g,`
`):Ne=Ne.replace(/[ \t\r\n]+/g," "),Fe[he]=Ne,ie[he<<1]=Ke,Ke+=Ne.length,ie[he++<<1|1]=Ie)}}return Te(we),{sourceCode:Fe.join("").replace(/\n$/,""),spans:ie}}function C(we,le,Re,Fe,Ke){if(Re){var ie={sourceNode:we,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:le,decorations:null};Fe(ie),Ke.push.apply(Ke,ie.decorations)}}var q=/\S/;function re(we){for(var le=void 0,Re=we.firstChild;Re;Re=Re.nextSibling){var Fe=Re.nodeType;le=Fe===1?le?we:Re:Fe===3&&q.test(Re.nodeValue)?we:le}return le===we?void 0:le}function _e(we,le){var Re={},Fe;(function(){for(var he=we.concat(le),Te=[],Ie={},de=0,Be=he.length;de<Be;++de){var Ge=he[de],Ne=Ge[3];if(Ne)for(var Ye=Ne.length;--Ye>=0;)Re[Ne.charAt(Ye)]=Ge;var $e=Ge[1],st=""+$e;Ie.hasOwnProperty(st)||(Te.push($e),Ie[st]=null)}Te.push(/[\0-\uffff]/),Fe=W(Te)})();var Ke=le.length,ie=function(he){for(var Te=he.sourceCode,Ie=he.basePos,de=he.sourceNode,Be=[Ie,V],Ge=0,Ne=Te.match(Fe)||[],Ye={},$e=0,st=Ne.length;$e<st;++$e){var nt=Ne[$e],Je=Ye[nt],tt=void 0,gt;if(typeof Je=="string")gt=!1;else{var _t=Re[nt.charAt(0)];if(_t)tt=nt.match(_t[1]),Je=_t[0];else{for(var it=0;it<Ke;++it)if(_t=le[it],tt=nt.match(_t[1]),tt){Je=_t[0];break}tt||(Je=V)}gt=Je.length>=5&&Je.substring(0,5)==="lang-",gt&&!(tt&&typeof tt[1]=="string")&&(gt=!1,Je=J),gt||(Ye[nt]=Je)}var Dt=Ge;if(Ge+=nt.length,!gt)Be.push(Ie+Dt,Je);else{var Tt=tt[1],at=nt.indexOf(Tt),Ot=at+Tt.length;tt[2]&&(Ot=nt.length-tt[2].length,at=Ot-Tt.length);var Ut=Je.substring(5);C(de,Ie+Dt,nt.substring(0,at),ie,Be),C(de,Ie+Dt+at,Tt,wt(Ut,Tt),Be),C(de,Ie+Dt+Ot,nt.substring(Ot),ie,Be)}}he.decorations=Be};return ie}function Le(we){var le=[],Re=[];we.tripleQuotedStrings?le.push([P,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):we.multiLineStrings?le.push([P,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):le.push([P,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),we.verbatimStrings&&Re.push([P,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Fe=we.hashComments;Fe&&(we.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,"#"]),Re.push([P,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):le.push([N,/^#[^\r\n]*/,null,"#"])),we.cStyleComments&&(Re.push([N,/^\/\/[^\r\n]*/,null]),Re.push([N,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ke=we.regexLiterals;if(Ke){var ie=Ke>1?"":`
\r`,he=ie?".":"[\\S\\s]",Te="/(?=[^/*"+ie+"])(?:[^/\\x5B\\x5C"+ie+"]|\\x5C"+he+"|\\x5B(?:[^\\x5C\\x5D"+ie+"]|\\x5C"+he+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+G+"("+Te+")")])}var Ie=we.types;Ie&&Re.push([H,Ie]);var de=(""+we.keywords).replace(/^ | $/g,"");de.length&&Re.push([U,new RegExp("^(?:"+de.replace(/[\s,]+/g,"|")+")\\b"),null]),le.push([V,/^\s+/,null,` \r
\xA0`]);var Be="^.[^\\s\\w.$@'\"`/\\\\]*";return we.regexLiterals&&(Be+="(?!s*/)"),Re.push([F,/^@[a-z_$][a-z_$@0-9]*/i,null],[H,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[V,/^[a-z_$][a-z_$@0-9]*/i,null],[F,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[V,/^\\[\s\S]?/,null],[Y,new RegExp(Be),null]),_e(le,Re)}var qe=Le({keywords:x,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function be(we,le,Re){for(var Fe=/(?:^|\s)nocode(?:\s|$)/,Ke=/\r\n?|\n/,ie=we.ownerDocument,he=ie.createElement("li");we.firstChild;)he.appendChild(we.firstChild);var Te=[he];function Ie($e){var st=$e.nodeType;if(st==1&&!Fe.test($e.className))if($e.nodeName==="br")de($e),$e.parentNode&&$e.parentNode.removeChild($e);else for(var nt=$e.firstChild;nt;nt=nt.nextSibling)Ie(nt);else if((st==3||st==4)&&Re){var Je=$e.nodeValue,tt=Je.match(Ke);if(tt){var gt=Je.substring(0,tt.index);$e.nodeValue=gt;var _t=Je.substring(tt.index+tt[0].length);if(_t){var it=$e.parentNode;it.insertBefore(ie.createTextNode(_t),$e.nextSibling)}de($e),gt||$e.parentNode.removeChild($e)}}}function de($e){for(;!$e.nextSibling;)if($e=$e.parentNode,!$e)return;function st(tt,gt){var _t=gt?tt.cloneNode(!1):tt,it=tt.parentNode;if(it){var Dt=st(it,1),Tt=tt.nextSibling;Dt.appendChild(_t);for(var at=Tt;at;at=Tt)Tt=at.nextSibling,Dt.appendChild(at)}return _t}for(var nt=st($e.nextSibling,0),Je;(Je=nt.parentNode)&&Je.nodeType===1;)nt=Je;Te.push(nt)}for(var Be=0;Be<Te.length;++Be)Ie(Te[Be]);le===(le|0)&&Te[0].setAttribute("value",le);var Ge=ie.createElement("ol");Ge.className="linenums";for(var Ne=Math.max(0,le-1|0)||0,Be=0,Ye=Te.length;Be<Ye;++Be)he=Te[Be],he.className="L"+(Be+Ne)%10,he.firstChild||he.appendChild(ie.createTextNode("\xA0")),Ge.appendChild(he);we.appendChild(Ge)}function je(we){var le=/\bMSIE\s(\d+)/.exec(navigator.userAgent);le=le&&+le[1]<=8;var Re=/\n/g,Fe=we.sourceCode,Ke=Fe.length,ie=0,he=we.spans,Te=he.length,Ie=0,de=we.decorations,Be=de.length,Ge=0;de[Be]=Ke;var Ne,Ye;for(Ye=Ne=0;Ye<Be;)de[Ye]!==de[Ye+2]?(de[Ne++]=de[Ye++],de[Ne++]=de[Ye++]):Ye+=2;for(Be=Ne,Ye=Ne=0;Ye<Be;){for(var $e=de[Ye],st=de[Ye+1],nt=Ye+2;nt+2<=Be&&de[nt+1]===st;)nt+=2;de[Ne++]=$e,de[Ne++]=st,Ye=nt}Be=de.length=Ne;var Je=we.sourceNode,tt="";Je&&(tt=Je.style.display,Je.style.display="none");try{for(var gt=null;Ie<Te;){var _t=he[Ie],it=he[Ie+2]||Ke,Dt=de[Ge+2]||Ke,nt=Math.min(it,Dt),Tt=he[Ie+1],at;if(Tt.nodeType!==1&&(at=Fe.substring(ie,nt))){le&&(at=at.replace(Re,"\r")),Tt.nodeValue=at;var Ot=Tt.ownerDocument,Ut=Ot.createElement("span");Ut.className=de[Ge+1];var rt=Tt.parentNode;rt.replaceChild(Ut,Tt),Ut.appendChild(Tt),ie<it&&(he[Ie+1]=Tt=Ot.createTextNode(Fe.substring(nt,it)),rt.insertBefore(Tt,Ut.nextSibling))}ie=nt,ie>=it&&(Ie+=2),ie>=Dt&&(Ge+=2)}}finally{Je&&(Je.style.display=tt)}}var Me={};function Oe(we,le){for(var Re=le.length;--Re>=0;){var Fe=le[Re];Me.hasOwnProperty(Fe)?_.console&&console.warn("cannot override language handler %s",Fe):Me[Fe]=we}}function wt(we,le){return we&&Me.hasOwnProperty(we)||(we=/^\s*</.test(le)?"default-markup":"default-code"),Me[we]}Oe(qe,["default-code"]),Oe(_e([],[[V,/^[^<?]+/],[ae,/^<!\w[^>]*(?:>|$)/],[N,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[Y,/^(?:<[%?]|[%?]>)/],["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"]),Oe(_e([[V,/^[\s]+/,null,` \r
`],[Z,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[ne,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[z,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[Y,/^[=<>\/]+/],["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"]),Oe(_e([],[[Z,/^[\s\S]+/]]),["uq.val"]),Oe(Le({keywords:y,hashComments:!0,cStyleComments:!0,types:A}),["c","cc","cpp","cxx","cyc","m"]),Oe(Le({keywords:"null,true,false"}),["json"]),Oe(Le({keywords:c,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:A}),["cs"]),Oe(Le({keywords:f,cStyleComments:!0}),["java"]),Oe(Le({keywords:L,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Oe(Le({keywords:E,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Oe(Le({keywords:p,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Oe(Le({keywords:T,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Oe(Le({keywords:u,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Oe(Le({keywords:l,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Oe(_e([],[[P,/^[\s\S]+/]]),["regex"]);function We(we){var le=we.langExtension;try{var Re=R(we.sourceNode,we.pre),Fe=Re.sourceCode;we.sourceCode=Fe,we.spans=Re.spans,we.basePos=0,wt(le,Fe)(we),je(we)}catch(Ke){_.console&&console.log(Ke&&Ke.stack||Ke)}}function lt(we,le,Re){var Fe=Re||!1,Ke=le||null,ie=document.createElement("div");ie.innerHTML="<pre>"+we+"</pre>",ie=ie.firstChild,Fe&&be(ie,Fe,!0);var he={langExtension:Ke,numberLines:Fe,sourceNode:ie,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return We(he),ie.innerHTML}function He(we,le){var Re=le||document.body,Fe=Re.ownerDocument||document;function Ke(_t){return Re.getElementsByTagName(_t)}for(var ie=[Ke("pre"),Ke("code"),Ke("xmp")],he=[],Te=0;Te<ie.length;++Te)for(var Ie=0,de=ie[Te].length;Ie<de;++Ie)he.push(ie[Te][Ie]);ie=null;var Be=Date;Be.now||(Be={now:function(){return+new Date}});var Ge=0,Ne=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ye=/\bprettyprint\b/,$e=/\bprettyprinted\b/,st=/pre|xmp/i,nt=/^code$/i,Je=/^(?:pre|code|xmp)$/i,tt={};function gt(){for(var _t=_.PR_SHOULD_USE_CONTINUATION?Be.now()+250:1/0;Ge<he.length&&Be.now()<_t;Ge++){for(var it=he[Ge],Dt=tt,Tt=it;Tt=Tt.previousSibling;){var at=Tt.nodeType,Ot=(at===7||at===8)&&Tt.nodeValue;if(Ot?!/^\??prettify\b/.test(Ot):at!==3||/\S/.test(Tt.nodeValue))break;if(Ot){Dt={},Ot.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Qe,ut,dt){Dt[ut]=dt});break}}var Ut=it.className;if((Dt!==tt||Ye.test(Ut))&&!$e.test(Ut)){for(var rt=!1,xt=it.parentNode;xt;xt=xt.parentNode){var xe=xt.tagName;if(Je.test(xe)&&xt.className&&Ye.test(xt.className)){rt=!0;break}}if(!rt){it.className+=" prettyprinted";var ge=Dt.lang;if(!ge){ge=Ut.match(Ne);var ye;!ge&&(ye=re(it))&&nt.test(ye.tagName)&&(ge=ye.className.match(Ne)),ge&&(ge=ge[1])}var ee;if(st.test(it.tagName))ee=1;else{var te=it.currentStyle,ue=Fe.defaultView,fe=te?te.whiteSpace:ue&&ue.getComputedStyle?ue.getComputedStyle(it,null).getPropertyValue("white-space"):0;ee=fe&&fe.substring(0,3)==="pre"}var pe=Dt.linenums;(pe=pe==="true"||+pe)||(pe=Ut.match(/\blinenums\b(?::(\d+))?/),pe=pe?pe[1]&&pe[1].length?+pe[1]:!0:!1),pe&&be(it,pe,ee);var Ze={langExtension:ge,sourceNode:it,numberLines:pe,pre:ee,sourceCode:null,basePos:null,spans:null,decorations:null};We(Ze)}}}Ge<he.length?_.setTimeout(gt,250):typeof we=="function"&&we()}gt()}var vt=_.PR={createSimpleLexer:_e,registerLangHandler:Oe,sourceDecorator:Le,PR_ATTRIB_NAME:z,PR_ATTRIB_VALUE:Z,PR_COMMENT:N,PR_DECLARATION:ae,PR_KEYWORD:U,PR_LITERAL:F,PR_NOCODE:B,PR_PLAIN:V,PR_PUNCTUATION:Y,PR_SOURCE:J,PR_STRING:P,PR_TAG:ne,PR_TYPE:H,prettyPrintOne:k?_.prettyPrintOne=lt:D=lt,prettyPrint:w=k?_.prettyPrint=He:w=He},Ee=_.define;typeof Ee=="function"&&Ee.amd&&Ee("google-code-prettify",[],function(){return vt})})()},25769:function(mt,me,b){"use strict";var k=b(98040),I={"text/plain":"Text","text/html":"Url",default:"Text"},K="Copy to clipboard: #{key}, Enter";function D(_){var O=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return _.replace(/#{\s*key\s*}/g,O)}function w(_,O){var m,n,y,f,c,l,u=!1;O||(O={}),m=O.debug||!1;try{y=k(),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(),O.format)if(E.preventDefault(),typeof E.clipboardData=="undefined"){m&&console.warn("unable to use e.clipboardData"),m&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var T=I[O.format]||I.default;window.clipboardData.setData(T,_)}else E.clipboardData.clearData(),E.clipboardData.setData(O.format,_);O.onCopy&&(E.preventDefault(),O.onCopy(E.clipboardData))}),document.body.appendChild(l),f.selectNodeContents(l),c.addRange(f);var p=document.execCommand("copy");if(!p)throw new Error("copy command was unsuccessful");u=!0}catch(E){m&&console.error("unable to copy using execCommand: ",E),m&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(O.format||"text",_),O.onCopy&&O.onCopy(window.clipboardData),u=!0}catch(T){m&&console.error("unable to copy using clipboardData: ",T),m&&console.error("falling back to prompt"),n=D("message"in O?O.message:K),window.prompt(n,_)}}finally{c&&(typeof c.removeRange=="function"?c.removeRange(f):c.removeAllRanges()),l&&document.body.removeChild(l),y()}return u}mt.exports=w},24334:function(mt,me,b){var k,I;(function(K,D){mt.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+/",O=function(z){for(var Z={},B=0,G=z.length;B<G;B++)Z[z.charAt(B)]=B;return Z}(_),m=String.fromCharCode,n=function(z){if(z.length<2){var Z=z.charCodeAt(0);return Z<128?z:Z<2048?m(192|Z>>>6)+m(128|Z&63):m(224|Z>>>12&15)+m(128|Z>>>6&63)+m(128|Z&63)}else{var Z=65536+(z.charCodeAt(0)-55296)*1024+(z.charCodeAt(1)-56320);return m(240|Z>>>18&7)+m(128|Z>>>12&63)+m(128|Z>>>6&63)+m(128|Z&63)}},y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,f=function(z){return z.replace(y,n)},c=function(z){var Z=[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),Z>=2?"=":_.charAt(B>>>6&63),Z>=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)},u=function(z){return l(f(String(z)))},p=function(z){return z.replace(/[+\/]/g,function(Z){return Z=="+"?"-":"_"}).replace(/=/g,"")},E=function(z,Z){return Z?p(u(z)):u(z)},T=function(z){return E(z,!0)},L;K.Uint8Array&&(L=function(z,Z){for(var B="",G=0,W=z.length;G<W;G+=3){var R=z[G],C=z[G+1],q=z[G+2],re=R<<16|C<<8|q;B+=_.charAt(re>>>18)+_.charAt(re>>>12&63)+(typeof C!="undefined"?_.charAt(re>>>6&63):"=")+(typeof q!="undefined"?_.charAt(re&63):"=")}return Z?p(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 Z=(7&z.charCodeAt(0))<<18|(63&z.charCodeAt(1))<<12|(63&z.charCodeAt(2))<<6|63&z.charCodeAt(3),B=Z-65536;return m((B>>>10)+55296)+m((B&1023)+56320);case 3:return m((15&z.charCodeAt(0))<<12|(63&z.charCodeAt(1))<<6|63&z.charCodeAt(2));default:return m((31&z.charCodeAt(0))<<6|63&z.charCodeAt(1))}},P=function(z){return z.replace(x,A)},U=function(z){var Z=z.length,B=Z%4,G=(Z>0?O[z.charAt(0)]<<18:0)|(Z>1?O[z.charAt(1)]<<12:0)|(Z>2?O[z.charAt(2)]<<6:0)|(Z>3?O[z.charAt(3)]:0),W=[m(G>>>16),m(G>>>8&255),m(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)},H=function(z){return N(String(z).replace(/[^A-Za-z0-9\+\/]/g,""))},F=function(z){return P(N(z))},Y=function(z){return String(z).replace(/[-_]/g,function(Z){return Z=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},V=function(z){return F(Y(z))},ne;K.Uint8Array&&(ne=function(z){return Uint8Array.from(H(Y(z)),function(Z){return Z.charCodeAt(0)})});var ae=function(){var z=K.Base64;return K.Base64=D,z};if(K.Base64={VERSION:w,atob:H,btoa:l,fromBase64:V,toBase64:E,utob:f,encode:E,encodeURI:T,btou:P,decode:V,noConflict:ae,fromUint8Array:L,toUint8Array:ne},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 V(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),mt.exports?mt.exports.Base64=K.Base64:(k=[],I=function(){return K.Base64}.apply(me,k),I!==void 0&&(mt.exports=I)),{Base64:K.Base64}})},53184:function(mt,me,b){"use strict";var k,I;function K(D,w,_){var O=function(m,n){return D.js_beautify(m,n)};return O.js=D.js_beautify,O.css=w.css_beautify,O.html=_.html_beautify,O.js_beautify=D.js_beautify,O.css_beautify=w.css_beautify,O.html_beautify=_.html_beautify,O}k=[b(58553),b(87804),b(40998)],I=function(D,w,_){return K(D,w,_)}.apply(me,k),I!==void 0&&(mt.exports=I)},87804:function(mt,me){var b,k;(function(){var I;(function(){"use strict";var D=[,,function(m){function n(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=[]}n.prototype.clone_empty=function(){var c=new n(this.__parent);return c.set_indent(this.__indent_count,this.__alignment_count),c},n.prototype.item=function(c){return c<0?this.__items[this.__items.length+c]:this.__items[c]},n.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},n.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))},n.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)},n.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},n.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},n.prototype.is_empty=function(){return this.__items.length===0},n.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},n.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},n.prototype.pop=function(){var c=null;return this.is_empty()||(c=this.__items.pop(),this.__character_count-=c.length),c},n.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},n.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},n.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},n.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 u=this.__base_string_length;return l=l||0,c<0&&(u=0),u+=c*this.__indent_size,u+=l,u},y.prototype.get_indent_string=function(c,l){var u=this.__base_string;return l=l||0,c<0&&(c=0,u=""),l+=c*this.__indent_size,this.__ensure_cache(l),u+=this.__cache[l],u},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,u="";this.__indent_size&&c>=this.__indent_size&&(l=Math.floor(c/this.__indent_size),c-=l*this.__indent_size,u=new Array(l+1).join(this.__indent_string)),c&&(u+=new Array(c+1).join(" ")),this.__cache.push(u)};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 n(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 u=this.__lines.join(`
`);return c!==`
`&&(u=u.replace(/[\n]/g,c)),u},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 u=this.__lines.length-2;u>=0;){var p=this.__lines[u];if(p.is_empty())break;if(p.item(0).indexOf(c)!==0&&p.item(-1)!==l){this.__lines.splice(u+1,0,new n(this)),this.previous_line=this.__lines[this.__lines.length-2];break}u--}},m.exports.Output=f},,,,function(m){function n(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"])}n.prototype._get_array=function(c,l){var u=this.raw_options[c],p=l||[];return typeof u=="object"?u!==null&&typeof u.concat=="function"&&(p=u.concat()):typeof u=="string"&&(p=u.split(/[^a-zA-Z0-9_\/\-]+/)),p},n.prototype._get_boolean=function(c,l){var u=this.raw_options[c],p=u===void 0?!!l:!!u;return p},n.prototype._get_characters=function(c,l){var u=this.raw_options[c],p=l||"";return typeof u=="string"&&(p=u.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),p},n.prototype._get_number=function(c,l){var u=this.raw_options[c];l=parseInt(l,10),isNaN(l)&&(l=0);var p=parseInt(u,10);return isNaN(p)&&(p=l),p},n.prototype._get_selection=function(c,l,u){var p=this._get_selection_list(c,l,u);if(p.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 p[0]},n.prototype._get_selection_list=function(c,l,u){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(u=u||[l[0]],!this._is_valid_selection(u,l))throw new Error("Invalid Default Value!");var p=this._get_array(c,u);if(!this._is_valid_selection(p,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 p},n.prototype._is_valid_selection=function(c,l){return c.length&&l.length&&!c.some(function(u){return l.indexOf(u)===-1})};function y(c,l){var u={};c=f(c);var p;for(p in c)p!==l&&(u[p]=c[p]);if(l&&c[l])for(p in c[l])u[p]=c[l][p];return u}function f(c){var l={},u;for(u in c){var p=u.replace(/-/g,"_");l[p]=c[u]}return l}m.exports.Options=n,m.exports.normalizeOpts=f,m.exports.mergeOpts=y},,function(m){var n=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&&!(n&&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 u="",p;return f&&(p=this.match(f),p&&(u+=p[0])),c&&(p||!f)&&(u+=this.readUntil(c,l)),u},y.prototype.readUntil=function(f,c){var l="",u=this.__position;f.lastIndex=this.__position;var p=f.exec(this.__input);return p?(u=p.index,c&&(u+=p[0].length)):u=this.__input_length,l=this.__input.substring(this.__position,u),this.__position=u,l},y.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},y.prototype.get_regexp=function(f,c){var l=null,u="g";return c&&n&&(u="y"),typeof f=="string"&&f!==""?l=new RegExp(f,u):f&&(l=new RegExp(f.source,u)),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},m.exports.InputScanner=y},,,,,function(m){function n(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")}n.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},n.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},m.exports.Directives=n},,function(m,n,y){var f=y(16).Beautifier,c=y(17).Options;function l(u,p){var E=new f(u,p);return E.beautify()}m.exports=l,m.exports.defaultOptions=function(){return new c}},function(m,n,y){var f=y(17).Options,c=y(2).Output,l=y(8).InputScanner,u=y(13).Directives,p=new u(/\/\*/,/\*\//),E=/\r\n|[\r\n]/,T=/\r\n|[\r\n]/g,L=/\s/,x=/(?:\s|\n)+/g,A=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,P=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function U(N,H){this._source_text=N||"",this._options=new f(H),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 H="";for(this._ch=this._input.next();this._ch;){if(H+=this._ch,this._ch==="\\")H+=this._input.next();else if(N.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return H},U.prototype.eatWhitespace=function(N){for(var H=L.test(this._input.peek()),F=0;L.test(this._input.peek());)this._ch=this._input.next(),N&&this._ch===`
`&&(F===0||F<this._options.max_preserve_newlines)&&(F++,this._output.add_new_line(!0));return H},U.prototype.foundNestedPseudoClass=function(){for(var N=0,H=1,F=this._input.peek(H);F;){if(F==="{")return!0;if(F==="(")N+=1;else if(F===")"){if(N===0)return!1;N-=1}else if(F===";"||F==="}")return!1;H++,F=this._input.peek(H)}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,H=this._options.eol;H==="auto"&&(H=`
`,N&&E.test(N||"")&&(H=N.match(E)[0])),N=N.replace(T,`
`);var F=N.match(/^[\t ]*/)[0];this._output=new c(this._options,F),this._input=new l(N),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var Y=0,V=!1,ne=!1,ae=!1,J=!1,z=!1,Z=this._ch,B=!1,G,W,R;G=this._input.read(x),W=G!=="",R=Z,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),Z=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var C=this._input.read(A),q=p.get_directives(C);q&&q.ignore==="start"&&(C+=p.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(P)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(W),this.print_string(this._ch);var re=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);re.match(/[ :]$/)&&(re=this.eatString(": ").replace(/\s+$/,""),this.print_string(re),this._output.space_before_token=!0),Y===0&&re.indexOf(":")!==-1&&(ne=!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 _e=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);_e.match(/[ :]$/)&&(_e=this.eatString(": ").replace(/\s+$/,""),this.print_string(_e),this._output.space_before_token=!0),Y===0&&_e.indexOf(":")!==-1?(ne=!0,this.indent()):_e in this.NESTED_AT_RULE?(this._nestedLevel+=1,_e in this.CONDITIONAL_GROUP_RULE&&(ae=!0)):Y===0&&!ne&&(J=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(W),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")ne&&(ne=!1,this.outdent()),J=!1,ae?(ae=!1,V=this._indentLevel>=this._nestedLevel):V=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&V&&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)):(R==="("?this._output.space_before_token=!1:R!==","&&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(),R==="{"&&this._output.trim(!0),ne&&(this.outdent(),ne=!1),this.print_string(this._ch),V=!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 Le=0;Le<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Le++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Le])){B=!0;break}(V||ae)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!J&&Y===0?(this.print_string(":"),ne||(ne=!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 qe=R==='"'||R==="'";this.preserveSingleSpace(qe||W),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")B=!1,Y===0?(ne&&(this.outdent(),ne=!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(),Y++,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(")")),Y&&(Y--,this.outdent()));else{var be=!1;this._input.lookBack("with")&&(be=!0),this.preserveSingleSpace(W||be),this.print_string(this._ch),ne&&R==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),z=!0):(this.eatWhitespace(),Y++,this.indent())}else if(this._ch===")")Y&&(Y--,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&&(!ne||z)&&Y===0&&!J?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!ne&&Y===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 je=R==='"'||R==="'";this.preserveSingleSpace(je||W),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&B&&this._output.add_new_line()}var Me=this._output.get_code(H);return Me},m.exports.Beautifier=U},function(m,n,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 u=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||u;var p=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var E=0;E<p.length;E++)p[E]!=="expand"?this.brace_style="collapse":this.brace_style=p[E]}c.prototype=new f,m.exports.Options=c}],w={};function _(m){var n=w[m];if(n!==void 0)return n.exports;var y=w[m]={exports:{}};return D[m](y,y.exports,_),y.exports}var O=_(15);I=O})();var K=I;b=[],k=function(){return{css_beautify:K}}.apply(me,b),k!==void 0&&(mt.exports=k)})()},40998:function(mt,me,b){var k,I;(function(){var K;(function(){"use strict";var O=[,,function(f){function c(p){this.__parent=p,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 p=new c(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},c.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},c.prototype.has_match=function(p){for(var E=this.__items.length-1;E>=0;E--)if(this.__items[E].match(p))return!0;return!1},c.prototype.set_indent=function(p,E){this.is_empty()&&(this.__indent_count=p||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 p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__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(p){this.__items.push(p);var E=p.lastIndexOf(`
`);E!==-1?this.__character_count=p.length-E:this.__character_count+=p.length},c.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},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 p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function l(p,E){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),E=E||"",p.indent_level>0&&(E=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=E,this.__base_string_length=E.length}l.prototype.get_indent_size=function(p,E){var T=this.__base_string_length;return E=E||0,p<0&&(T=0),T+=p*this.__indent_size,T+=E,T},l.prototype.get_indent_string=function(p,E){var T=this.__base_string;return E=E||0,p<0&&(p=0,T=""),E+=p*this.__indent_size,this.__ensure_cache(E),T+=this.__cache[E],T},l.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},l.prototype.__add_column=function(){var p=this.__cache.length,E=0,T="";this.__indent_size&&p>=this.__indent_size&&(E=Math.floor(p/this.__indent_size),p-=E*this.__indent_size,T=new Array(E+1).join(this.__indent_string)),p&&(T+=new Array(p+1).join(" ")),this.__cache.push(T)};function u(p,E){this.__indent_cache=new l(p,E),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.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()}u.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},u.prototype.get_line_number=function(){return this.__lines.length},u.prototype.get_indent_string=function(p,E){return this.__indent_cache.get_indent_string(p,E)},u.prototype.get_indent_size=function(p,E){return this.__indent_cache.get_indent_size(p,E)},u.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},u.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},u.prototype.get_code=function(p){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 p!==`
`&&(T=T.replace(/[\n]/g,p)),T},u.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},u.prototype.set_indent=function(p,E){return p=p||0,E=E||0,this.next_line.set_indent(p,E),this.__lines.length>1?(this.current_line.set_indent(p,E),!0):(this.current_line.set_indent(),!1)},u.prototype.add_raw_token=function(p){for(var E=0;E<p.newlines;E++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},u.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},u.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(" "))},u.prototype.remove_indent=function(p){for(var E=this.__lines.length;p<E;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},u.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&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},u.prototype.just_added_newline=function(){return this.current_line.is_empty()},u.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},u.prototype.ensure_empty_line_above=function(p,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(p)!==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=u},function(f){function c(l,u,p,E){this.type=l,this.text=u,this.comments_before=null,this.newlines=p||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(p,E){this.raw_options=l(p,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(p,E){var T=this.raw_options[p],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(p,E){var T=this.raw_options[p],L=T===void 0?!!E:!!T;return L},c.prototype._get_characters=function(p,E){var T=this.raw_options[p],L=E||"";return typeof T=="string"&&(L=T.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),L},c.prototype._get_number=function(p,E){var T=this.raw_options[p];E=parseInt(E,10),isNaN(E)&&(E=0);var L=parseInt(T,10);return isNaN(L)&&(L=E),L},c.prototype._get_selection=function(p,E,T){var L=this._get_selection_list(p,E,T);if(L.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
`+E+`
You passed in: '`+this.raw_options[p]+"'");return L[0]},c.prototype._get_selection_list=function(p,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(p,T);if(!this._is_valid_selection(L,E))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
`+E+`
You passed in: '`+this.raw_options[p]+"'");return L},c.prototype._is_valid_selection=function(p,E){return p.length&&E.length&&!p.some(function(T){return E.indexOf(T)===-1})};function l(p,E){var T={};p=u(p);var L;for(L in p)L!==E&&(T[L]=p[L]);if(E&&p[E])for(L in p[E])T[L]=p[E][L];return T}function u(p){var E={},T;for(T in p){var L=T.replace(/-/g,"_");E[L]=p[T]}return E}f.exports.Options=c,f.exports.normalizeOpts=u,f.exports.mergeOpts=l},,function(f){var c=RegExp.prototype.hasOwnProperty("sticky");function l(u){this.__input=u||"",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 u=null;return this.hasNext()&&(u=this.__input.charAt(this.__position),this.__position+=1),u},l.prototype.peek=function(u){var p=null;return u=u||0,u+=this.__position,u>=0&&u<this.__input_length&&(p=this.__input.charAt(u)),p},l.prototype.__match=function(u,p){u.lastIndex=p;var E=u.exec(this.__input);return E&&!(c&&u.sticky)&&E.index!==p&&(E=null),E},l.prototype.test=function(u,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(u,p):!1},l.prototype.testChar=function(u,p){var E=this.peek(p);return u.lastIndex=0,E!==null&&u.test(E)},l.prototype.match=function(u){var p=this.__match(u,this.__position);return p?this.__position+=p[0].length:p=null,p},l.prototype.read=function(u,p,E){var T="",L;return u&&(L=this.match(u),L&&(T+=L[0])),p&&(L||!u)&&(T+=this.readUntil(p,E)),T},l.prototype.readUntil=function(u,p){var E="",T=this.__position;u.lastIndex=this.__position;var L=u.exec(this.__input);return L?(T=L.index,p&&(T+=L[0].length)):T=this.__input_length,E=this.__input.substring(this.__position,T),this.__position=T,E},l.prototype.readUntilAfter=function(u){return this.readUntil(u,!0)},l.prototype.get_regexp=function(u,p){var E=null,T="g";return p&&c&&(T="y"),typeof u=="string"&&u!==""?E=new RegExp(u,T):u&&(E=new RegExp(u.source,T)),E},l.prototype.get_literal_regexp=function(u){return RegExp(u.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},l.prototype.peekUntilAfter=function(u){var p=this.__position,E=this.readUntilAfter(u);return this.__position=p,E},l.prototype.lookBack=function(u){var p=this.__position-1;return p>=u.length&&this.__input.substring(p-u.length,p).toLowerCase()===u},f.exports.InputScanner=l},function(f,c,l){var u=l(8).InputScanner,p=l(3).Token,E=l(10).TokenStream,T=l(11).WhitespacePattern,L={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},x=function(A,P){this._input=new u(A),this._options=P||{},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,P=new p(L.START,""),U=null,N=[],H=new E;P.type!==L.EOF;){for(A=this._get_next_token(P,U);this._is_comment(A);)H.add(A),A=this._get_next_token(P,U);H.isEmpty()||(A.comments_before=H,H=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=P,P.next=A,this.__tokens.add(A),P=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,P){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,P){return!1},x.prototype._create_token=function(A,P){var U=new p(A,P,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 u=null;return l=l||0,l+=this.__position,l>=0&&l<this.__tokens_length&&(u=this.__tokens[l]),u},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 u=l(12).Pattern;function p(E,T){u.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=""}p.prototype=new u,p.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+"]")},p.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},p.prototype.matching=function(E,T){var L=this._create();return L.__set_whitespace_patterns(E,T),L._update(),L},p.prototype._create=function(){return new p(this._input,this)},p.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=p},function(f){function c(l,u){this._input=l,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,u&&(this._starting_pattern=this._input.get_regexp(u._starting_pattern,!0),this._match_pattern=this._input.get_regexp(u._match_pattern,!0),this._until_pattern=this._input.get_regexp(u._until_pattern),this._until_after=u._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 u=this._create();return u._until_after=!0,u._until_pattern=this._input.get_regexp(l),u._update(),u},c.prototype.until=function(l){var u=this._create();return u._until_after=!1,u._until_pattern=this._input.get_regexp(l),u._update(),u},c.prototype.starting_with=function(l){var u=this._create();return u._starting_pattern=this._input.get_regexp(l,!0),u._update(),u},c.prototype.matching=function(l){var u=this._create();return u._match_pattern=this._input.get_regexp(l,!0),u._update(),u},c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){},f.exports.Pattern=c},function(f){function c(l,u){l=typeof l=="string"?l:l.source,u=typeof u=="string"?u:u.source,this.__directives_block_pattern=new RegExp(l+/ beautify( \w+[:]\w+)+ /.source+u,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(l+/\sbeautify\signore:end\s/.source+u,"g")}c.prototype.get_directives=function(l){if(!l.match(this.__directives_block_pattern))return null;var u={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(l);p;)u[p[1]]=p[2],p=this.__directive_pattern.exec(l);return u},c.prototype.readIgnored=function(l){return l.readUntilAfter(this.__directives_end_ignore_pattern)},f.exports.Directives=c},function(f,c,l){var u=l(12).Pattern,p={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function E(T,L){u.call(this,T,L),this.__template_pattern=null,this._disabled=Object.assign({},p),this._excluded=Object.assign({},p),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 u(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 u,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 p)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 u=l(19).Beautifier,p=l(20).Options;function E(T,L,x,A){var P=new u(T,L,x,A);return P.beautify()}f.exports=E,f.exports.defaultOptions=function(){return new p}},function(f,c,l){var u=l(20).Options,p=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 p(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 Z=0;Z<z;Z++)this.print_newline(Z>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 P=function(J){for(var z=null,Z=J.next;Z.type!==T.EOF&&J.closed!==Z;){if(Z.type===T.ATTRIBUTE&&Z.text==="type"){Z.next&&Z.next.type===T.EQUALS&&Z.next.next&&Z.next.next.type===T.VALUE&&(z=Z.next.next.text);break}Z=Z.next}return z},U=function(J,z){var Z=null,B=null;return z.closed?(J==="script"?Z="text/javascript":J==="style"&&(Z="text/css"),Z=P(z)||Z,Z.search("text/css")>-1?B="css":Z.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?B="javascript":Z.search(/(text|application|dojo)\/(x-)?(html)/)>-1?B="html":Z.search(/test\/null/)>-1&&(B="null"),B):null};function N(J,z){return z.indexOf(J)!==-1}function H(J,z,Z){this.parent=J||null,this.tag=z?z.tag_name:"",this.indent_level=Z||0,this.parser_token=z||null}function F(J){this._printer=J,this._current_frame=null}F.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},F.prototype.record_tag=function(J){var z=new H(this._current_frame,J,this._printer.indent_level);this._current_frame=z},F.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},F.prototype._get_frame=function(J,z){for(var Z=this._current_frame;Z&&J.indexOf(Z.tag)===-1;){if(z&&z.indexOf(Z.tag)!==-1){Z=null;break}Z=Z.parent}return Z},F.prototype.try_pop=function(J,z){var Z=this._get_frame([J],z);return this._try_pop_frame(Z)},F.prototype.indent_to_tag=function(J){var z=this._get_frame(J);z&&(this._printer.indent_level=z.indent_level)};function Y(J,z,Z,B){this._source_text=J||"",z=z||{},this._js_beautify=Z,this._css_beautify=B,this._tag_stack=null;var G=new u(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"}Y.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 Z=J.match(/^[\t ]*/)[0],B={text:"",type:""},G=new V(this._options),W=new A(this._options,Z),R=new E(J,this._options).tokenize();this._tag_stack=new F(W);for(var C=null,q=R.next();q.type!==T.EOF;)q.type===T.TAG_OPEN||q.type===T.COMMENT?(C=this._handle_tag_open(W,q,G,B,R),G=C):q.type===T.ATTRIBUTE||q.type===T.EQUALS||q.type===T.VALUE||q.type===T.TEXT&&!G.tag_complete?C=this._handle_inside_tag(W,q,G,B):q.type===T.TAG_CLOSE?C=this._handle_tag_close(W,q,G):q.type===T.TEXT?C=this._handle_text(W,q,G):q.type===T.CONTROL_FLOW_OPEN?C=this._handle_control_flow_open(W,q):q.type===T.CONTROL_FLOW_CLOSE?C=this._handle_control_flow_close(W,q):W.add_raw_token(q),B=C,q=R.next();var re=W._output.get_code(z);return re},Y.prototype._handle_control_flow_open=function(J,z){var Z={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(),Z},Y.prototype._handle_control_flow_close=function(J,z){var Z={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),Z},Y.prototype._handle_tag_close=function(J,z,Z){var B={text:z.text,type:z.type};return J.alignment_size=0,Z.tag_complete=!0,J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),Z.is_unformatted?J.add_raw_token(z):(Z.tag_start_char==="<"&&(J.set_space_before_token(z.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&Z.has_wrapped_attrs&&J.print_newline(!1)),J.print_token(z)),Z.indent_content&&!(Z.is_unformatted||Z.is_content_unformatted)&&(J.indent(),Z.indent_content=!1),!Z.is_inline_element&&!(Z.is_unformatted||Z.is_content_unformatted)&&J.set_wrap_point(),B},Y.prototype._handle_inside_tag=function(J,z,Z,B){var G=Z.has_wrapped_attrs,W={text:z.text,type:z.type};return J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),Z.is_unformatted?J.add_raw_token(z):Z.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&&Z.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&&Z.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(),Z.has_wrapped_attrs=G),W},Y.prototype._handle_text=function(J,z,Z){var B={text:z.text,type:"TK_CONTENT"};return Z.custom_beautifier_name?this._print_custom_beatifier_text(J,z,Z):Z.is_unformatted||Z.is_content_unformatted?J.add_raw_token(z):(J.traverse_whitespace(z),J.print_token(z)),B},Y.prototype._print_custom_beatifier_text=function(J,z,Z){var B=this;if(z.text!==""){var G=z.text,W,R=1,C="",q="";Z.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?W=this._js_beautify:Z.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?W=this._css_beautify:Z.custom_beautifier_name==="html"&&(W=function(je,Me){var Oe=new Y(je,Me,B._js_beautify,B._css_beautify);return Oe.beautify()}),this._options.indent_scripts==="keep"?R=0:this._options.indent_scripts==="separate"&&(R=-J.indent_level);var re=J.get_full_indent(R);if(G=G.replace(/\n[ \t]*$/,""),Z.custom_beautifier_name!=="html"&&G[0]==="<"&&G.match(/^(<!--|<!\[CDATA\[)/)){var _e=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(G);if(!_e){J.add_raw_token(z);return}C=re+_e[1]+`
`,G=_e[4],_e[5]&&(q=re+_e[5]),G=G.replace(/\n[ \t]*$/,""),(_e[2]||_e[3].indexOf(`
`)!==-1)&&(_e=_e[3].match(/[ \t]+$/),_e&&(z.whitespace_before=_e[0]))}if(G)if(W){var Le=function(){this.eol=`
`};Le.prototype=this._options.raw_options;var qe=new Le;G=W(re+G,qe)}else{var be=z.whitespace_before;be&&(G=G.replace(new RegExp(`
(`+be+")?","g"),`
`)),G=re+G.replace(/\n/g,`
`+re)}C&&(G?G=C+G+`
`+q:G=C+q),J.print_newline(!1),G&&(z.text=G,z.whitespace_before="",z.newlines=0,J.add_raw_token(z),J.print_newline(!0))}},Y.prototype._handle_tag_open=function(J,z,Z,B,G){var W=this._get_tag_open_token(z);if((Z.is_unformatted||Z.is_content_unformatted)&&!Z.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,Z,B),W.is_inline_element||J.set_wrap_point(),J.print_token(z)),W.is_start_tag&&this._is_wrap_attributes_force){var R=0,C;do C=G.peek(R),C.type===T.ATTRIBUTE&&(W.attr_count+=1),R+=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 V=function(J,z,Z){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="",!Z)this.tag_complete=!0;else{var B;this.tag_start_char=Z.text[0],this.text=Z.text,this.tag_start_char==="<"?(B=Z.text.match(/^<([^\s>]*)/),this.tag_check=B?B[1]:""):(B=Z.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=B?B[1]:"",(Z.text.startsWith("{{#>")||Z.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&Z.next!==null?this.tag_check=Z.next.text.split(" ")[0]:this.tag_check=Z.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),Z.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||Z.closed&&Z.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)))}};Y.prototype._get_tag_open_token=function(J){var z=new V(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},Y.prototype._set_tag_position=function(J,z,Z,B,G){if(Z.is_empty_element||(Z.is_end_tag?Z.start_tag_token=this._tag_stack.try_pop(Z.tag_name):(this._do_optional_end_element(Z)&&(Z.is_inline_element||J.print_newline(!1)),this._tag_stack.record_tag(Z),(Z.tag_name==="script"||Z.tag_name==="style")&&!(Z.is_unformatted||Z.is_content_unformatted)&&(Z.custom_beautifier_name=U(Z.tag_check,z)))),N(Z.tag_check,this._options.extra_liners)&&(J.print_newline(!1),J._output.just_added_blankline()||J.print_newline(!0)),Z.is_empty_element){if(Z.tag_start_char==="{"&&Z.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),Z.indent_content=!0;var W=J.current_line_has_match(/{{#if/);W||J.print_newline(!1)}Z.tag_name==="!--"&&G.type===T.TAG_CLOSE&&B.is_end_tag&&Z.text.indexOf(`
`)===-1||(Z.is_inline_element||Z.is_unformatted||J.print_newline(!1),this._calcluate_parent_multiline(J,Z))}else if(Z.is_end_tag){var R=!1;R=Z.start_tag_token&&Z.start_tag_token.multiline_content,R=R||!Z.is_inline_element&&!(B.is_inline_element||B.is_unformatted)&&!(G.type===T.TAG_CLOSE&&Z.start_tag_token===B)&&G.type!=="TK_CONTENT",(Z.is_content_unformatted||Z.is_unformatted)&&(R=!1),R&&J.print_newline(!1)}else Z.indent_content=!Z.custom_beautifier_name,Z.tag_start_char==="<"&&(Z.tag_name==="html"?Z.indent_content=this._options.indent_inner_html:Z.tag_name==="head"?Z.indent_content=this._options.indent_head_inner_html:Z.tag_name==="body"&&(Z.indent_content=this._options.indent_body_inner_html)),!(Z.is_inline_element||Z.is_unformatted)&&(G.type!=="TK_CONTENT"||Z.is_content_unformatted)&&J.print_newline(!1),this._calcluate_parent_multiline(J,Z)},Y.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 ne=["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"],ae=["a","audio","del","ins","map","noscript","video"];Y.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"&&ne.indexOf(J.tag_name)!==-1){var Z=J.parent.parent;(!Z||ae.indexOf(Z.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=Y},function(f,c,l){var u=l(6).Options;function p(E){u.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"])}p.prototype=new u,f.exports.Options=p},function(f,c,l){var u=l(9).Tokenizer,p=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:p.START,RAW:p.RAW,EOF:p.EOF},A=new E(/<\!--/,/-->/),P=function(U,N){u.call(this,U,N),this._current_tag_name="";var H=new T(this._input).read_options(this._options),F=new L(this._input);if(this.__patterns={word:H.until(/[\n\r\t <]/),word_control_flow_close_excluded:H.until(/[\n\r\t <}]/),single_quote:H.until_after(/'/),double_quote:H.until_after(/"/),attribute:H.until(/[\n\r\t =>]|\/>/),element_name:H.until(/[\n\r\t >\/]/),angular_control_flow_start:F.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:F.starting_with(/{{!--/).until_after(/--}}/),handlebars:F.starting_with(/{{/).until_after(/}}/),handlebars_open:F.until(/[\n\r\t }]/),handlebars_raw_close:F.until(/}}/),comment:F.starting_with(/<!--/).until_after(/-->/),cdata:F.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:F.starting_with(/<!\[/).until_after(/]>/),processing:F.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 Y=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=F.matching(Y).until_after(Y)}};P.prototype=new u,P.prototype._is_comment=function(U){return!1},P.prototype._is_opening=function(U){return U.type===x.TAG_OPEN||U.type===x.CONTROL_FLOW_OPEN},P.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("{")},P.prototype._reset=function(){this._current_tag_name=""},P.prototype._get_next_token=function(U,N){var H=null;this._readWhitespace();var F=this._input.peek();return F===null?this._create_token(x.EOF,""):(H=H||this._read_open_handlebars(F,N),H=H||this._read_attribute(F,U,N),H=H||this._read_close(F,N),H=H||this._read_script_and_style(F,U),H=H||this._read_control_flows(F,N),H=H||this._read_raw_content(F,U,N),H=H||this._read_content_word(F,N),H=H||this._read_comment_or_cdata(F),H=H||this._read_processing(F),H=H||this._read_open(F,N),H=H||this._create_token(x.UNKNOWN,this._input.next()),H)},P.prototype._read_comment_or_cdata=function(U){var N=null,H=null,F=null;if(U==="<"){var Y=this._input.peek(1);Y==="!"&&(H=this.__patterns.comment.read(),H?(F=A.get_directives(H),F&&F.ignore==="start"&&(H+=A.readIgnored(this._input))):H=this.__patterns.cdata.read()),H&&(N=this._create_token(x.COMMENT,H),N.directives=F)}return N},P.prototype._read_processing=function(U){var N=null,H=null,F=null;if(U==="<"){var Y=this._input.peek(1);(Y==="!"||Y==="?")&&(H=this.__patterns.conditional_comment.read(),H=H||this.__patterns.processing.read()),H&&(N=this._create_token(x.COMMENT,H),N.directives=F)}return N},P.prototype._read_open=function(U,N){var H=null,F=null;return(!N||N.type===x.CONTROL_FLOW_OPEN)&&U==="<"&&(H=this._input.next(),this._input.peek()==="/"&&(H+=this._input.next()),H+=this.__patterns.element_name.read(),F=this._create_token(x.TAG_OPEN,H)),F},P.prototype._read_open_handlebars=function(U,N){var H=null,F=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)==="!"?(H=this.__patterns.handlebars_comment.read(),H=H||this.__patterns.handlebars.read(),F=this._create_token(x.COMMENT,H)):(H=this.__patterns.handlebars_open.read(),F=this._create_token(x.TAG_OPEN,H))),F},P.prototype._read_control_flows=function(U,N){var H="",F=null;if(!this._options.templating.includes("angular"))return F;if(U==="@"){if(H=this.__patterns.angular_control_flow_start.read(),H==="")return F;for(var Y=H.endsWith("(")?1:0,V=0;!(H.endsWith("{")&&Y===V);){var ne=this._input.next();if(ne===null)break;ne==="("?Y++:ne===")"&&V++,H+=ne}F=this._create_token(x.CONTROL_FLOW_OPEN,H)}else U==="}"&&N&&N.type===x.CONTROL_FLOW_OPEN&&(H=this._input.next(),F=this._create_token(x.CONTROL_FLOW_CLOSE,H));return F},P.prototype._read_close=function(U,N){var H=null,F=null;return N&&N.type===x.TAG_OPEN&&(N.text[0]==="<"&&(U===">"||U==="/"&&this._input.peek(1)===">")?(H=this._input.next(),U==="/"&&(H+=this._input.next()),F=this._create_token(x.TAG_CLOSE,H)):N.text[0]==="{"&&U==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),F=this._create_token(x.TAG_CLOSE,"}}"))),F},P.prototype._read_attribute=function(U,N,H){var F=null,Y="";if(H&&H.text[0]==="<")if(U==="=")F=this._create_token(x.EQUALS,this._input.next());else if(U==='"'||U==="'"){var V=this._input.next();U==='"'?V+=this.__patterns.double_quote.read():V+=this.__patterns.single_quote.read(),F=this._create_token(x.VALUE,V)}else Y=this.__patterns.attribute.read(),Y&&(N.type===x.EQUALS?F=this._create_token(x.VALUE,Y):F=this._create_token(x.ATTRIBUTE,Y));return F},P.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)},P.prototype._read_raw_content=function(U,N,H){var F="";if(H&&H.text[0]==="{")F=this.__patterns.handlebars_raw_close.read();else if(N.type===x.TAG_CLOSE&&N.opened.text[0]==="<"&&N.text[0]!=="/"){var Y=N.opened.text.substr(1).toLowerCase();this._is_content_unformatted(Y)&&(F=this._input.readUntil(new RegExp("</"+Y+"[\\n\\r\\t ]*?>","ig")))}return F?this._create_token(x.TEXT,F):null},P.prototype._read_script_and_style=function(U,N){if(N.type===x.TAG_CLOSE&&N.opened.text[0]==="<"&&N.text[0]!=="/"){var H=N.opened.text.substr(1).toLowerCase();if(H==="script"||H==="style"){var F=this._read_comment_or_cdata(U);if(F)return F.type=x.TEXT,F;var Y=this._input.readUntil(new RegExp("</"+H+"[\\n\\r\\t ]*?>","ig"));if(Y)return this._create_token(x.TEXT,Y)}}return null},P.prototype._read_content_word=function(U,N){var H="";return this._options.unformatted_content_delimiter&&U===this._options.unformatted_content_delimiter[0]&&(H=this.__patterns.unformatted_content_delimiter.read()),H||(H=N&&N.type===x.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),H?this._create_token(x.TEXT,H):null},f.exports.Tokenizer=P,f.exports.TOKEN=x}],m={};function n(f){var c=m[f];if(c!==void 0)return c.exports;var l=m[f]={exports:{}};return O[f](l,l.exports,n),l.exports}var y=n(18);K=y})();var D=K;if(1)k=[b,b(58553),b(87804)],I=function(O){var m=b(58553),n=b(87804);return{html_beautify:function(y,f){return D(y,f,m.js_beautify,n.css_beautify)}}}.apply(me,k),I!==void 0&&(mt.exports=I);else var w,_})()},58553:function(mt,me){var b,k;(function(){var I;(function(){"use strict";var D=[function(m,n,y){var f=y(1).Beautifier,c=y(5).Options;function l(u,p){var E=new f(u,p);return E.beautify()}m.exports=l,m.exports.defaultOptions=function(){return new c}},function(m,n,y){var f=y(2).Output,c=y(3).Token,l=y(4),u=y(5).Options,p=y(7).Tokenizer,E=y(7).line_starters,T=y(7).positionable_operators,L=y(7).TOKEN;function x(C,q){return q.indexOf(C)!==-1}function A(C){return C.replace(/^\s+/g,"")}function P(C){for(var q={},re=0;re<C.length;re++)q[C[re].replace(/-/g,"_")]=C[re];return q}function U(C,q){return C&&C.type===L.RESERVED&&C.text===q}function N(C,q){return C&&C.type===L.RESERVED&&x(C.text,q)}var H=["case","return","do","if","throw","else","await","break","continue","async"],F=["before-newline","after-newline","preserve-newline"],Y=P(F),V=[Y.before_newline,Y.preserve_newline],ne={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function ae(C,q){q.multiline_frame||q.mode===ne.ForInitializer||q.mode===ne.Conditional||C.remove_indent(q.start_line_index)}function J(C){C=C.replace(l.allLineBreaks,`
`);for(var q=[],re=C.indexOf(`
`);re!==-1;)q.push(C.substring(0,re)),C=C.substring(re+1),re=C.indexOf(`
`);return C.length&&q.push(C),q}function z(C){return C===ne.ArrayLiteral}function Z(C){return x(C,[ne.Expression,ne.ForInitializer,ne.Conditional])}function B(C,q){for(var re=0;re<C.length;re++){var _e=C[re].trim();if(_e.charAt(0)!==q)return!1}return!0}function G(C,q){for(var re=0,_e=C.length,Le;re<_e;re++)if(Le=C[re],Le&&Le.indexOf(q)!==0)return!1;return!0}function W(C,q){q=q||{},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 u(q)}W.prototype.create_flags=function(C,q){var re=0;C&&(re=C.indentation_level,!this._output.just_added_newline()&&C.line_indent_level>re&&(re=C.line_indent_level));var _e={mode:q,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:re,alignment:0,line_indent_level:C?C.line_indent_level:re,start_line_index:this._output.get_line_number(),ternary_depth:0};return _e},W.prototype._reset=function(C){var q=C.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new f(this._options,q),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(ne.BlockStatement);var re=new p(C,this._options);return this._tokens=re.tokenize(),C},W.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var C,q=this._reset(this._source_text),re=this._options.eol;this._options.eol==="auto"&&(re=`
`,q&&l.lineBreak.test(q||"")&&(re=q.match(l.lineBreak)[0]));for(var _e=this._tokens.next();_e;)this.handle_token(_e),this._last_last_text=this._flags.last_token.text,this._flags.last_token=_e,_e=this._tokens.next();return C=this._output.get_code(re),C},W.prototype.handle_token=function(C,q){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,q):C.type===L.COMMENT?this.handle_comment(C,q):C.type===L.DOT?this.handle_dot(C):C.type===L.EOF?this.handle_eof(C):C.type===L.UNKNOWN?this.handle_unknown(C,q):this.handle_unknown(C,q)},W.prototype.handle_whitespace_and_comments=function(C,q){var re=C.newlines,_e=this._options.keep_array_indentation&&z(this._flags.mode);if(C.comments_before)for(var Le=C.comments_before.next();Le;)this.handle_whitespace_and_comments(Le,q),this.handle_token(Le,q),Le=C.comments_before.next();if(_e)for(var qe=0;qe<re;qe+=1)this.print_newline(qe>0,q);else if(this._options.max_preserve_newlines&&re>this._options.max_preserve_newlines&&(re=this._options.max_preserve_newlines),this._options.preserve_newlines&&re>1){this.print_newline(!1,q);for(var be=1;be<re;be+=1)this.print_newline(!0,q)}};var R=["async","break","continue","return","throw","yield"];W.prototype.allow_wrap_or_preserved_newline=function(C,q){if(q=q===void 0?!1:q,!this._output.just_added_newline()){var re=this._options.preserve_newlines&&C.newlines||q,_e=x(this._flags.last_token.text,T)||x(C.text,T);if(_e){var Le=x(this._flags.last_token.text,T)&&x(this._options.operator_position,V)||x(C.text,T);re=re&&Le}if(re)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(N(this._flags.last_token,R))return;this._output.set_wrap_point()}}},W.prototype.print_newline=function(C,q){if(!q&&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 re=this._tokens.peek();this._flags.mode===ne.Statement&&!(this._flags.if_block&&U(re,"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 q=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(q),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===ne.Statement&&ae(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===ne.ObjectLiteral&&this._flags.mode===ne.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 q=!1;return q=q||N(this._flags.last_token,["var","let","const"])&&C.type===L.WORD,q=q||U(this._flags.last_token,"do"),q=q||!(this._flags.parent.mode===ne.ObjectLiteral&&this._flags.mode===ne.Statement)&&N(this._flags.last_token,R)&&!C.newlines,q=q||U(this._flags.last_token,"else")&&!(U(C,"if")&&!C.comments_before),q=q||this._flags.last_token.type===L.END_EXPR&&(this._previous_flags.mode===ne.ForInitializer||this._previous_flags.mode===ne.Conditional),q=q||this._flags.last_token.type===L.WORD&&this._flags.mode===ne.BlockStatement&&!this._flags.in_case&&!(C.text==="--"||C.text==="++")&&this._last_last_text!=="function"&&C.type!==L.WORD&&C.type!==L.RESERVED,q=q||this._flags.mode===ne.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||N(this._flags.last_token,["get","set"])),q?(this.set_mode(ne.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 q=ne.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(q),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}q=ne.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,q=ne.ForInitializer):x(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,q=ne.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 re=this._tokens.peek(-3);if(this._options.space_after_named_function&&re){var _e=this._tokens.peek(-4);N(re,["async","function"])||re.text==="*"&&N(_e,["async","function"])?this._output.space_before_token=!0:this._flags.mode===ne.ObjectLiteral?(re.text==="{"||re.text===","||re.text==="*"&&(_e.text==="{"||_e.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===ne.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(q),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},W.prototype.handle_end_expr=function(C){for(;this._flags.mode===ne.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(),ae(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===ne.Conditional&&(this._previous_flags.mode=ne.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 q=this._tokens.peek(),re=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===L.END_EXPR?(this.set_mode(ne.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(ne.BlockStatement):re&&(x(re.text,[":",","])&&x(q.type,[L.STRING,L.WORD,L.RESERVED])||x(q.text,["get","set","..."])&&x(re.type,[L.WORD,L.RESERVED]))?x(this._last_last_text,["class","interface"])&&!x(re.text,[":",","])?this.set_mode(ne.BlockStatement):this.set_mode(ne.ObjectLiteral):this._flags.last_token.type===L.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(ne.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(ne.ObjectLiteral):this.set_mode(ne.BlockStatement),this._flags.last_token&&N(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var _e=!q.comments_before&&q.text==="}",Le=_e&&this._flags.last_word==="function"&&this._flags.last_token.type===L.END_EXPR;if(this._options.brace_preserve_inline){var qe=0,be=null;this._flags.inline_frame=!0;do if(qe+=1,be=this._tokens.peek(qe-1),be.newlines){this._flags.inline_frame=!1;break}while(be.type!==L.EOF&&!(be.type===L.END_BLOCK&&be.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&&(Le||this._flags.last_token.type===L.EQUALS||N(this._flags.last_token,H)&&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(),!_e&&!(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===ne.Statement;)this.restore_mode();var q=this._flags.last_token.type===L.START_BLOCK;this._flags.inline_frame&&!q?this._output.space_before_token=!0:this._options.brace_style==="expand"?q||this.print_newline():q||(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!==ne.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===ne.ObjectLiteral){var q=this._tokens.peek();q.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&&!Z(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===ne.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===ne.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,R)?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&&(Z(this._flags.mode)||z(this._flags.mode))||this.print_newline(),this.print_token(C),this._flags.last_word=C.text;return}var re="NONE";if(this._flags.last_token.type===L.END_BLOCK?this._previous_flags.inline_frame?re="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?re="NEWLINE":(re="SPACE",this._output.space_before_token=!0):re="NEWLINE":this._flags.last_token.type===L.SEMICOLON&&this._flags.mode===ne.BlockStatement?re="NEWLINE":this._flags.last_token.type===L.SEMICOLON&&Z(this._flags.mode)?re="SPACE":this._flags.last_token.type===L.STRING?re="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===ne.ObjectLiteral&&x(this._last_last_text,["{",","]))?re="SPACE":this._flags.last_token.type===L.START_BLOCK?this._flags.inline_frame?re="SPACE":re="NEWLINE":this._flags.last_token.type===L.END_EXPR&&(this._output.space_before_token=!0,re="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"?re="SPACE":re="NEWLINE"),N(C,["else","catch","finally"]))if((!(this._flags.last_token.type===L.END_BLOCK&&this._previous_flags.mode===ne.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 _e=this._output.current_line;_e.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else re==="NEWLINE"?N(this._flags.last_token,H)?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():re==="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 q=this._tokens.peek();this._flags.mode===ne.Statement&&!(this._flags.if_block&&U(q,"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?(Z(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===ne.ObjectLiteral||this._flags.mode===ne.Statement&&this._flags.parent.mode===ne.ObjectLiteral?(this._flags.mode===ne.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 q=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])),re=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 _e=!q;this.handle_whitespace_and_comments(C,_e)}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,V)&&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 Le=!0,qe=!0,be=!1;if(C.text===":"?this._flags.ternary_depth===0?Le=!1:(this._flags.ternary_depth-=1,be=!0):C.text==="?"&&(this._flags.ternary_depth+=1),!re&&!q&&this._options.preserve_newlines&&x(C.text,T)){var je=C.text===":",Me=je&&be,Oe=je&&!be;switch(this._options.operator_position){case Y.before_newline:this._output.space_before_token=!Oe,this.print_token(C),(!je||Me)&&this.allow_wrap_or_preserved_newline(C),this._output.space_before_token=!0;return;case Y.after_newline:this._output.space_before_token=!0,!je||Me?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 Y.preserve_newline:Oe||this.allow_wrap_or_preserved_newline(C),Le=!(this._output.just_added_newline()||Oe),this._output.space_before_token=Le,this.print_token(C),this._output.space_before_token=!0;return}}if(q){this.allow_wrap_or_preserved_newline(C),Le=!1;var wt=this._tokens.peek();qe=wt&&x(wt.type,[L.WORD,L.RESERVED])}else if(C.text==="...")this.allow_wrap_or_preserved_newline(C),Le=this._flags.last_token.type===L.START_BLOCK,qe=!1;else if(x(C.text,["--","++","!","~"])||re){if((this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR)&&this.allow_wrap_or_preserved_newline(C),Le=!1,qe=!1,C.newlines&&(C.text==="--"||C.text==="++"||C.text==="~")){var We=N(this._flags.last_token,H)&&C.newlines;We&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(We,!0)}this._flags.last_token.text===";"&&Z(this._flags.mode)&&(Le=!0),this._flags.last_token.type===L.RESERVED?Le=!0:this._flags.last_token.type===L.END_EXPR?Le=!(this._flags.last_token.text==="]"&&(C.text==="--"||C.text==="++")):this._flags.last_token.type===L.OPERATOR&&(Le=x(C.text,["--","-","++","+"])&&x(this._flags.last_token.text,["--","-","++","+"]),x(C.text,["+","-"])&&x(this._flags.last_token.text,["--","++"])&&(qe=!0)),(this._flags.mode===ne.BlockStatement&&!this._flags.inline_frame||this._flags.mode===ne.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Le,this.print_token(C),this._output.space_before_token=qe},W.prototype.handle_block_comment=function(C,q){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,q),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,q)},W.prototype.print_block_commment=function(C,q){var re=J(C.text),_e,Le=!1,qe=!1,be=C.whitespace_before,je=be.length;if(this.print_newline(!1,q),this.print_token_line_indentation(C),this._output.add_token(re[0]),this.print_newline(!1,q),re.length>1){for(re=re.slice(1),Le=B(re,"*"),qe=G(re,be),Le&&(this._flags.alignment=1),_e=0;_e<re.length;_e++)Le?(this.print_token_line_indentation(C),this._output.add_token(A(re[_e]))):qe&&re[_e]?(this.print_token_line_indentation(C),this._output.add_token(re[_e].substring(je))):(this._output.current_line.set_indent(-1),this._output.add_token(re[_e])),this.print_newline(!1,q);this._flags.alignment=0}},W.prototype.handle_comment=function(C,q){C.newlines?this.print_newline(!1,q):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(C),this.print_newline(!1,q)},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,H)?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,q){this.print_token(C),C.text[C.text.length-1]===`
`&&this.print_newline(!1,q)},W.prototype.handle_eof=function(C){for(;this._flags.mode===ne.Statement;)this.restore_mode();this.handle_whitespace_and_comments(C)},m.exports.Beautifier=W},function(m){function n(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=[]}n.prototype.clone_empty=function(){var c=new n(this.__parent);return c.set_indent(this.__indent_count,this.__alignment_count),c},n.prototype.item=function(c){return c<0?this.__items[this.__items.length+c]:this.__items[c]},n.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},n.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))},n.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)},n.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},n.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},n.prototype.is_empty=function(){return this.__items.length===0},n.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},n.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},n.prototype.pop=function(){var c=null;return this.is_empty()||(c=this.__items.pop(),this.__character_count-=c.length),c},n.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},n.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},n.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},n.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 u=this.__base_string_length;return l=l||0,c<0&&(u=0),u+=c*this.__indent_size,u+=l,u},y.prototype.get_indent_string=function(c,l){var u=this.__base_string;return l=l||0,c<0&&(c=0,u=""),l+=c*this.__indent_size,this.__ensure_cache(l),u+=this.__cache[l],u},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,u="";this.__indent_size&&c>=this.__indent_size&&(l=Math.floor(c/this.__indent_size),c-=l*this.__indent_size,u=new Array(l+1).join(this.__indent_string)),c&&(u+=new Array(c+1).join(" ")),this.__cache.push(u)};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 n(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 u=this.__lines.join(`
`);return c!==`
`&&(u=u.replace(/[\n]/g,c)),u},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 u=this.__lines.length-2;u>=0;){var p=this.__lines[u];if(p.is_empty())break;if(p.item(0).indexOf(c)!==0&&p.item(-1)!==l){this.__lines.splice(u+1,0,new n(this)),this.previous_line=this.__lines[this.__lines.length-2];break}u--}},m.exports.Output=f},function(m){function n(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}m.exports.Token=n},function(m,n){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",u="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",p="(?:"+u+"|["+y+c+"])",E="(?:"+u+"|["+f+c+l+"])*";n.identifier=new RegExp(p+E,"g"),n.identifierStart=new RegExp(p),n.identifierMatch=new RegExp("(?:"+u+"|["+f+c+l+"])+");var T=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;n.newline=/[\n\r\u2028\u2029]/,n.lineBreak=new RegExp(`\r
|`+n.newline.source),n.allLineBreaks=new RegExp(n.lineBreak.source,"g")},function(m,n,y){var f=y(6).Options,c=["before-newline","after-newline","preserve-newline"];function l(u){f.call(this,u,"js");var p=this.raw_options.brace_style||null;p==="expand-strict"?this.raw_options.brace_style="expand":p==="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,m.exports.Options=l},function(m){function n(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"])}n.prototype._get_array=function(c,l){var u=this.raw_options[c],p=l||[];return typeof u=="object"?u!==null&&typeof u.concat=="function"&&(p=u.concat()):typeof u=="string"&&(p=u.split(/[^a-zA-Z0-9_\/\-]+/)),p},n.prototype._get_boolean=function(c,l){var u=this.raw_options[c],p=u===void 0?!!l:!!u;return p},n.prototype._get_characters=function(c,l){var u=this.raw_options[c],p=l||"";return typeof u=="string"&&(p=u.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),p},n.prototype._get_number=function(c,l){var u=this.raw_options[c];l=parseInt(l,10),isNaN(l)&&(l=0);var p=parseInt(u,10);return isNaN(p)&&(p=l),p},n.prototype._get_selection=function(c,l,u){var p=this._get_selection_list(c,l,u);if(p.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 p[0]},n.prototype._get_selection_list=function(c,l,u){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(u=u||[l[0]],!this._is_valid_selection(u,l))throw new Error("Invalid Default Value!");var p=this._get_array(c,u);if(!this._is_valid_selection(p,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 p},n.prototype._is_valid_selection=function(c,l){return c.length&&l.length&&!c.some(function(u){return l.indexOf(u)===-1})};function y(c,l){var u={};c=f(c);var p;for(p in c)p!==l&&(u[p]=c[p]);if(l&&c[l])for(p in c[l])u[p]=c[l][p];return u}function f(c){var l={},u;for(u in c){var p=u.replace(/-/g,"_");l[p]=c[u]}return l}m.exports.Options=n,m.exports.normalizeOpts=f,m.exports.mergeOpts=y},function(m,n,y){var f=y(8).InputScanner,c=y(9).Tokenizer,l=y(9).TOKEN,u=y(13).Directives,p=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 u(/\/\*/,/\*\//),P=/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\.]/,H=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),F=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";F=F.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),F="\\?\\.(?!\\d) "+F,F=F.replace(/ /g,"|");var Y=new RegExp(F),V="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),ne=V.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),ae=new RegExp("^(?:"+ne.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),R=new T(this._input).read_options(this._options);this.__patterns={template:R,identifier:R.starting_with(p.identifier).matching(p.identifierMatch),number:W.matching(P),punct:W.matching(Y),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(p.lineBreak),shebang:W.starting_with(/#!/).until_after(p.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:R.until(/['\\\n\r\u2028\u2029]/),double_quote:R.until(/["\\\n\r\u2028\u2029]/),template_text:R.until(/[`\\$]/),template_expression:R.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 R=this._input.peek();return R===null?this._create_token(x.EOF,""):(W=W||this._read_non_javascript(R),W=W||this._read_string(R),W=W||this._read_pair(R,this._input.peek(1)),W=W||this._read_word(B),W=W||this._read_singles(R),W=W||this._read_comment(R),W=W||this._read_regexp(R,B),W=W||this._read_xml(R,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(p.allLineBreaks,`
`),!(B.type===x.DOT||B.type===x.RESERVED&&(B.text==="set"||B.text==="get"))&&ae.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(p.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 R=A.get_directives(W);R&&R.ignore==="start"&&(W+=A.readIgnored(this._input)),W=W.replace(p.allLineBreaks,`
`),G=this._create_token(x.BLOCK_COMMENT,W),G.directives=R}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=Z(G)),this._input.peek()===B&&(G+=this._input.next()),G=G.replace(p.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(),R=!1,C=!1;this._input.hasNext()&&(R||C||this._input.peek()!==B)&&!this._input.testChar(p.newline);)W+=this._input.peek(),R?R=!1:(R=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(p.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="",R=this.__patterns.xml.read_match();if(R){for(var C=R[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),q=C.indexOf("{")===0,re=0;R;){var _e=!!R[1],Le=R[2],qe=!!R[R.length-1]||Le.slice(0,8)==="![CDATA[";if(!qe&&(Le===C||q&&Le.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(_e?--re:++re),W+=R[0],re<=0)break;R=this.__patterns.xml.read_match()}return R||(W+=this._input.match(/[\s\S]*/g)[0]),W=W.replace(p.allLineBreaks,`
`),this._create_token(x.STRING,W)}}return null};function Z(B){for(var G="",W=0,R=new f(B),C=null;R.hasNext();)if(C=R.match(/([\s]|[^\\]|\\\\)+/g),C&&(G+=C[0]),R.peek()==="\\"){if(R.next(),R.peek()==="x")C=R.match(/x([0-9A-Fa-f]{2})/g);else if(R.peek()==="u")C=R.match(/u([0-9A-Fa-f]{4})/g),C||(C=R.match(/u\{([0-9A-Fa-f]+)\}/g));else{G+="\\",R.hasNext()&&(G+=R.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 R,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 q=C.read(),re="";this._input.hasNext();){if(re=this._input.next(),re===B||!G&&p.newline.test(re)){this._input.back();break}else re==="\\"&&this._input.hasNext()?(R=this._input.peek(),R==="x"||R==="u"?this.has_char_escapes=!0:R==="\r"&&this._input.peek(1)===`
`&&this._input.next(),re+=this._input.next()):W&&(W==="${"&&re==="$"&&this._input.peek()==="{"&&(re+=this._input.next()),W===re&&(B==="`"?re+=this._read_string_recursive("}",G,"`"):re+=this._read_string_recursive("`",G,"${"),this._input.hasNext()&&(re+=this._input.next())));re+=C.read(),q+=re}return q},m.exports.Tokenizer=z,m.exports.TOKEN=x,m.exports.positionable_operators=H.slice(),m.exports.line_starters=V.slice()},function(m){var n=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&&!(n&&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 u="",p;return f&&(p=this.match(f),p&&(u+=p[0])),c&&(p||!f)&&(u+=this.readUntil(c,l)),u},y.prototype.readUntil=function(f,c){var l="",u=this.__position;f.lastIndex=this.__position;var p=f.exec(this.__input);return p?(u=p.index,c&&(u+=p[0].length)):u=this.__input_length,l=this.__input.substring(this.__position,u),this.__position=u,l},y.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},y.prototype.get_regexp=function(f,c){var l=null,u="g";return c&&n&&(u="y"),typeof f=="string"&&f!==""?l=new RegExp(f,u):f&&(l=new RegExp(f.source,u)),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},m.exports.InputScanner=y},function(m,n,y){var f=y(8).InputScanner,c=y(3).Token,l=y(10).TokenStream,u=y(11).WhitespacePattern,p={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 u(this._input)};E.prototype.tokenize=function(){this._input.restart(),this.__tokens=new l,this._reset();for(var T,L=new c(p.START,""),x=null,A=[],P=new l;L.type!==p.EOF;){for(T=this._get_next_token(L,x);this._is_comment(T);)P.add(T),T=this._get_next_token(L,x);P.isEmpty()||(T.comments_before=P,P=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(p.RAW,x):this._create_token(p.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()},m.exports.Tokenizer=E,m.exports.TOKEN=p},function(m){function n(y){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=y}n.prototype.restart=function(){this.__position=0},n.prototype.isEmpty=function(){return this.__tokens_length===0},n.prototype.hasNext=function(){return this.__position<this.__tokens_length},n.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__tokens[this.__position],this.__position+=1),y},n.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},n.prototype.add=function(y){this.__parent_token&&(y.parent=this.__parent_token),this.__tokens.push(y),this.__tokens_length+=1},m.exports.TokenStream=n},function(m,n,y){var f=y(12).Pattern;function c(l,u){f.call(this,l,u),u?this._line_regexp=this._input.get_regexp(u._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,u){l+="\\t ",u+="\\n\\r",this._match_pattern=this._input.get_regexp("["+l+u+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+u+"]")},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 u=this.__split(this._newline_regexp,l);this.newline_count=u.length-1,this.whitespace_before_token=u[this.newline_count]}return l},c.prototype.matching=function(l,u){var p=this._create();return p.__set_whitespace_patterns(l,u),p._update(),p},c.prototype._create=function(){return new c(this._input,this)},c.prototype.__split=function(l,u){l.lastIndex=0;for(var p=0,E=[],T=l.exec(u);T;)E.push(u.substring(p,T.index)),p=T.index+T[0].length,T=l.exec(u);return p<u.length?E.push(u.substring(p,u.length)):E.push(""),E},m.exports.WhitespacePattern=c},function(m){function n(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)}n.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},n.prototype.read_match=function(){return this._input.match(this._match_pattern)},n.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},n.prototype.until=function(y){var f=this._create();return f._until_after=!1,f._until_pattern=this._input.get_regexp(y),f._update(),f},n.prototype.starting_with=function(y){var f=this._create();return f._starting_pattern=this._input.get_regexp(y,!0),f._update(),f},n.prototype.matching=function(y){var f=this._create();return f._match_pattern=this._input.get_regexp(y,!0),f._update(),f},n.prototype._create=function(){return new n(this._input,this)},n.prototype._update=function(){},m.exports.Pattern=n},function(m){function n(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")}n.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},n.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},m.exports.Directives=n},function(m,n,y){var f=y(12).Pattern,c={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function l(u,p){f.call(this,u,p),this.__template_pattern=null,this._disabled=Object.assign({},c),this._excluded=Object.assign({},c),p&&(this.__template_pattern=this._input.get_regexp(p.__template_pattern),this._excluded=Object.assign(this._excluded,p._excluded),this._disabled=Object.assign(this._disabled,p._disabled));var E=new f(u);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(u){var p=this._create();return p._disabled[u]=!0,p._update(),p},l.prototype.read_options=function(u){var p=this._create();for(var E in c)p._disabled[E]=u.templating.indexOf(E)===-1;return p._update(),p},l.prototype.exclude=function(u){var p=this._create();return p._excluded[u]=!0,p._update(),p},l.prototype.read=function(){var u="";this._match_pattern?u=this._input.read(this._starting_pattern):u=this._input.read(this._starting_pattern,this.__template_pattern);for(var p=this._read_template();p;)this._match_pattern?p+=this._input.read(this._match_pattern):p+=this._input.readUntil(this.__template_pattern),u+=p,p=this._read_template();return this._until_after&&(u+=this._input.readUntilAfter(this._until_pattern)),u},l.prototype.__set_templated_pattern=function(){var u=[];this._disabled.php||u.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||u.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||u.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||u.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(u.push(this.__patterns.django._starting_pattern.source),u.push(this.__patterns.django_value._starting_pattern.source),u.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||u.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&u.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+u.join("|")+")")},l.prototype._read_template=function(){var u="",p=this._input.peek();if(p==="<"){var E=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&E==="?"&&(u=u||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&E==="%"&&(u=u||this.__patterns.erb.read())}else p==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(u=u||this.__patterns.handlebars_comment.read(),u=u||this.__patterns.handlebars_unescaped.read(),u=u||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(u=u||this.__patterns.django_value.read()),this._excluded.django||(u=u||this.__patterns.django_comment.read(),u=u||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(u=u||this.__patterns.smarty_comment.read(),u=u||this.__patterns.smarty_literal.read(),u=u||this.__patterns.smarty.read()));return u},m.exports.TemplatablePattern=l}],w={};function _(m){var n=w[m];if(n!==void 0)return n.exports;var y=w[m]={exports:{}};return D[m](y,y.exports,_),y.exports}var O=_(0);I=O})();var K=I;b=[],k=function(){return{js_beautify:K}}.apply(me,b),k!==void 0&&(mt.exports=k)})()},32834:function(mt){(function(me,b){mt.exports=b()})(this,function(){"use strict";function me(xe,ge){for(var ye=0;ye<ge.length;ye++){var ee=ge[ye];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(xe,ee.key,ee)}}function b(xe,ge,ye){return ge&&me(xe.prototype,ge),ye&&me(xe,ye),xe}function k(xe,ge){if(xe){if(typeof xe=="string")return I(xe,ge);var ye=Object.prototype.toString.call(xe).slice(8,-1);if(ye==="Object"&&xe.constructor&&(ye=xe.constructor.name),ye==="Map"||ye==="Set")return Array.from(xe);if(ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ye))return I(xe,ge)}}function I(xe,ge){(ge==null||ge>xe.length)&&(ge=xe.length);for(var ye=0,ee=new Array(ge);ye<ge;ye++)ee[ye]=xe[ye];return ee}function K(xe,ge){var ye=typeof Symbol!="undefined"&&xe[Symbol.iterator]||xe["@@iterator"];if(ye)return(ye=ye.call(xe)).next.bind(ye);if(Array.isArray(xe)||(ye=k(xe))||ge&&xe&&typeof xe.length=="number"){ye&&(xe=ye);var ee=0;return function(){return ee>=xe.length?{done:!0}:{done:!1,value:xe[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 _(xe){D.exports.defaults=xe}D.exports={defaults:w(),getDefaults:w,changeDefaults:_};var O=/[&<>"']/,m=/[&<>"']/g,n=/[<>"']|&(?!#?\w+;)/,y=/[<>"']|&(?!#?\w+;)/g,f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},c=function(ge){return f[ge]};function l(xe,ge){if(ge){if(O.test(xe))return xe.replace(m,c)}else if(n.test(xe))return xe.replace(y,c);return xe}var u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function p(xe){return xe.replace(u,function(ge,ye){return ye=ye.toLowerCase(),ye==="colon"?":":ye.charAt(0)==="#"?ye.charAt(1)==="x"?String.fromCharCode(parseInt(ye.substring(2),16)):String.fromCharCode(+ye.substring(1)):""})}var E=/(^|[^\[])\^/g;function T(xe,ge){xe=xe.source||xe,ge=ge||"";var ye={replace:function(te,ue){return ue=ue.source||ue,ue=ue.replace(E,"$1"),xe=xe.replace(te,ue),ye},getRegex:function(){return new RegExp(xe,ge)}};return ye}var L=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(xe,ge,ye){if(xe){var ee;try{ee=decodeURIComponent(p(ye)).replace(L,"").toLowerCase()}catch(te){return null}if(ee.indexOf("javascript:")===0||ee.indexOf("vbscript:")===0||ee.indexOf("data:")===0)return null}ge&&!x.test(ye)&&(ye=F(ge,ye));try{ye=encodeURI(ye).replace(/%25/g,"%")}catch(te){return null}return ye}var P={},U=/^[^:]+:\/*[^/]*$/,N=/^([^:]+:)[\s\S]*$/,H=/^([^:]+:\/*[^/]*)[\s\S]*$/;function F(xe,ge){P[" "+xe]||(U.test(xe)?P[" "+xe]=xe+"/":P[" "+xe]=ae(xe,"/",!0)),xe=P[" "+xe];var ye=xe.indexOf(":")===-1;return ge.substring(0,2)==="//"?ye?ge:xe.replace(N,"$1")+ge:ge.charAt(0)==="/"?ye?ge:xe.replace(H,"$1")+ge:xe+ge}var Y={exec:function(){}};function V(xe){for(var ge=1,ye,ee;ge<arguments.length;ge++){ye=arguments[ge];for(ee in ye)Object.prototype.hasOwnProperty.call(ye,ee)&&(xe[ee]=ye[ee])}return xe}function ne(xe,ge){var ye=xe.replace(/\|/g,function(ue,fe,pe){for(var Ze=!1,Qe=fe;--Qe>=0&&pe[Qe]==="\\";)Ze=!Ze;return Ze?"|":" |"}),ee=ye.split(/ \|/),te=0;if(ee.length>ge)ee.splice(ge);else for(;ee.length<ge;)ee.push("");for(;te<ee.length;te++)ee[te]=ee[te].trim().replace(/\\\|/g,"|");return ee}function ae(xe,ge,ye){var ee=xe.length;if(ee===0)return"";for(var te=0;te<ee;){var ue=xe.charAt(ee-te-1);if(ue===ge&&!ye)te++;else if(ue!==ge&&ye)te++;else break}return xe.substr(0,ee-te)}function J(xe,ge){if(xe.indexOf(ge[1])===-1)return-1;for(var ye=xe.length,ee=0,te=0;te<ye;te++)if(xe[te]==="\\")te++;else if(xe[te]===ge[0])ee++;else if(xe[te]===ge[1]&&(ee--,ee<0))return te;return-1}function z(xe){xe&&xe.sanitize&&!xe.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 Z(xe,ge){if(ge<1)return"";for(var ye="";ge>1;)ge&1&&(ye+=xe),ge>>=1,xe+=xe;return ye+xe}var B={escape:l,unescape:p,edit:T,cleanUrl:A,resolveUrl:F,noopTest:Y,merge:V,splitCells:ne,rtrim:ae,findClosingBracket:J,checkSanitizeDeprecation:z,repeatString:Z},G=D.exports.defaults,W=B.rtrim,R=B.splitCells,C=B.escape,q=B.findClosingBracket;function re(xe,ge,ye){var ee=ge.href,te=ge.title?C(ge.title):null,ue=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:ye,href:ee,title:te,text:ue}:{type:"image",raw:ye,href:ee,title:te,text:C(ue)}}function _e(xe,ge){var ye=xe.match(/^(\s+)(?:```)/);if(ye===null)return ge;var ee=ye[1];return ge.split(`
`).map(function(te){var ue=te.match(/^\s+/);if(ue===null)return te;var fe=ue[0];return fe.length>=ee.length?te.slice(ee.length):te}).join(`
`)}var Le=function(){function xe(ye){this.options=ye||G}var ge=xe.prototype;return ge.space=function(ee){var te=this.rules.block.newline.exec(ee);if(te)return te[0].length>1?{type:"space",raw:te[0]}:{raw:`
`}},ge.code=function(ee){var te=this.rules.block.code.exec(ee);if(te){var ue=te[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?ue:W(ue,`
`)}}},ge.fences=function(ee){var te=this.rules.block.fences.exec(ee);if(te){var ue=te[0],fe=_e(ue,te[3]||"");return{type:"code",raw:ue,lang:te[2]?te[2].trim():te[2],text:fe}}},ge.heading=function(ee){var te=this.rules.block.heading.exec(ee);if(te){var ue=te[2].trim();if(/#$/.test(ue)){var fe=W(ue,"#");(this.options.pedantic||!fe||/ $/.test(fe))&&(ue=fe.trim())}return{type:"heading",raw:te[0],depth:te[1].length,text:ue}}},ge.nptable=function(ee){var te=this.rules.block.nptable.exec(ee);if(te){var ue={type:"table",header:R(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
`):[],raw:te[0]};if(ue.header.length===ue.align.length){var fe=ue.align.length,pe;for(pe=0;pe<fe;pe++)/^ *-+: *$/.test(ue.align[pe])?ue.align[pe]="right":/^ *:-+: *$/.test(ue.align[pe])?ue.align[pe]="center":/^ *:-+ *$/.test(ue.align[pe])?ue.align[pe]="left":ue.align[pe]=null;for(fe=ue.cells.length,pe=0;pe<fe;pe++)ue.cells[pe]=R(ue.cells[pe],ue.header.length);return ue}}},ge.hr=function(ee){var te=this.rules.block.hr.exec(ee);if(te)return{type:"hr",raw:te[0]}},ge.blockquote=function(ee){var te=this.rules.block.blockquote.exec(ee);if(te){var ue=te[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:te[0],text:ue}}},ge.list=function(ee){var te=this.rules.block.list.exec(ee);if(te){var ue=te[0],fe=te[2],pe=fe.length>1,Ze={type:"list",raw:ue,ordered:pe,start:pe?+fe.slice(0,-1):"",loose:!1,items:[]},Qe=te[0].match(this.rules.block.item),ut=!1,dt,kt,zt,Nt,Ct,oi,_i,ti,ri,et=Qe.length;zt=this.rules.block.listItemStart.exec(Qe[0]);for(var ze=0;ze<et;ze++){if(dt=Qe[ze],ue=dt,this.options.pedantic||(ri=dt.match(new RegExp("\\n\\s*\\n {0,"+(zt[0].length-1)+"}\\S")),ri&&(Ct=dt.length-ri.index+Qe.slice(ze+1).join(`
`).length,Ze.raw=Ze.raw.substring(0,Ze.raw.length-Ct),dt=dt.substring(0,ri.index),ue=dt,et=ze+1)),ze!==et-1){if(Nt=this.rules.block.listItemStart.exec(Qe[ze+1]),this.options.pedantic?Nt[1].length>zt[1].length:Nt[1].length>=zt[0].length||Nt[1].length>3){Qe.splice(ze,2,Qe[ze]+(!this.options.pedantic&&Nt[1].length<zt[0].length&&!Qe[ze].match(/\n$/)?"":`
`)+Qe[ze+1]),ze--,et--;continue}else(!this.options.pedantic||this.options.smartLists?Nt[2][Nt[2].length-1]!==fe[fe.length-1]:pe===(Nt[2].length===1))&&(Ct=Qe.slice(ze+1).join(`
`).length,Ze.raw=Ze.raw.substring(0,Ze.raw.length-Ct),ze=et-1);zt=Nt}kt=dt.length,dt=dt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~dt.indexOf(`
`)&&(kt-=dt.length,dt=this.options.pedantic?dt.replace(/^ {1,4}/gm,""):dt.replace(new RegExp("^ {1,"+kt+"}","gm"),"")),dt=W(dt,`
`),ze!==et-1&&(ue=ue+`
`),oi=ut||/\n\n(?!\s*$)/.test(ue),ze!==et-1&&(ut=ue.slice(-2)===`
`,oi||(oi=ut)),oi&&(Ze.loose=!0),this.options.gfm&&(_i=/^\[[ xX]\] /.test(dt),ti=void 0,_i&&(ti=dt[1]!==" ",dt=dt.replace(/^\[[ xX]\] +/,""))),Ze.items.push({type:"list_item",raw:ue,task:_i,checked:ti,loose:oi,text:dt})}return Ze}},ge.html=function(ee){var te=this.rules.block.html.exec(ee);if(te)return{type:this.options.sanitize?"paragraph":"html",raw:te[0],pre:!this.options.sanitizer&&(te[1]==="pre"||te[1]==="script"||te[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):C(te[0]):te[0]}},ge.def=function(ee){var te=this.rules.block.def.exec(ee);if(te){te[3]&&(te[3]=te[3].substring(1,te[3].length-1));var ue=te[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:ue,raw:te[0],href:te[2],title:te[3]}}},ge.table=function(ee){var te=this.rules.block.table.exec(ee);if(te){var ue={type:"table",header:R(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
`):[]};if(ue.header.length===ue.align.length){ue.raw=te[0];var fe=ue.align.length,pe;for(pe=0;pe<fe;pe++)/^ *-+: *$/.test(ue.align[pe])?ue.align[pe]="right":/^ *:-+: *$/.test(ue.align[pe])?ue.align[pe]="center":/^ *:-+ *$/.test(ue.align[pe])?ue.align[pe]="left":ue.align[pe]=null;for(fe=ue.cells.length,pe=0;pe<fe;pe++)ue.cells[pe]=R(ue.cells[pe].replace(/^ *\| *| *\| *$/g,""),ue.header.length);return ue}}},ge.lheading=function(ee){var te=this.rules.block.lheading.exec(ee);if(te)return{type:"heading",raw:te[0],depth:te[2].charAt(0)==="="?1:2,text:te[1]}},ge.paragraph=function(ee){var te=this.rules.block.paragraph.exec(ee);if(te)return{type:"paragraph",raw:te[0],text:te[1].charAt(te[1].length-1)===`
`?te[1].slice(0,-1):te[1]}},ge.text=function(ee){var te=this.rules.block.text.exec(ee);if(te)return{type:"text",raw:te[0],text:te[0]}},ge.escape=function(ee){var te=this.rules.inline.escape.exec(ee);if(te)return{type:"escape",raw:te[0],text:C(te[1])}},ge.tag=function(ee,te,ue){var fe=this.rules.inline.tag.exec(ee);if(fe)return!te&&/^<a /i.test(fe[0])?te=!0:te&&/^<\/a>/i.test(fe[0])&&(te=!1),!ue&&/^<(pre|code|kbd|script)(\s|>)/i.test(fe[0])?ue=!0:ue&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(fe[0])&&(ue=!1),{type:this.options.sanitize?"text":"html",raw:fe[0],inLink:te,inRawBlock:ue,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):C(fe[0]):fe[0]}},ge.link=function(ee){var te=this.rules.inline.link.exec(ee);if(te){var ue=te[2].trim();if(!this.options.pedantic&&/^</.test(ue)){if(!/>$/.test(ue))return;var fe=W(ue.slice(0,-1),"\\");if((ue.length-fe.length)%2===0)return}else{var pe=q(te[2],"()");if(pe>-1){var Ze=te[0].indexOf("!")===0?5:4,Qe=Ze+te[1].length+pe;te[2]=te[2].substring(0,pe),te[0]=te[0].substring(0,Qe).trim(),te[3]=""}}var ut=te[2],dt="";if(this.options.pedantic){var kt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ut);kt&&(ut=kt[1],dt=kt[3])}else dt=te[3]?te[3].slice(1,-1):"";return ut=ut.trim(),/^</.test(ut)&&(this.options.pedantic&&!/>$/.test(ue)?ut=ut.slice(1):ut=ut.slice(1,-1)),re(te,{href:ut&&ut.replace(this.rules.inline._escapes,"$1"),title:dt&&dt.replace(this.rules.inline._escapes,"$1")},te[0])}},ge.reflink=function(ee,te){var ue;if((ue=this.rules.inline.reflink.exec(ee))||(ue=this.rules.inline.nolink.exec(ee))){var fe=(ue[2]||ue[1]).replace(/\s+/g," ");if(fe=te[fe.toLowerCase()],!fe||!fe.href){var pe=ue[0].charAt(0);return{type:"text",raw:pe,text:pe}}return re(ue,fe,ue[0])}},ge.emStrong=function(ee,te,ue){ue===void 0&&(ue="");var fe=this.rules.inline.emStrong.lDelim.exec(ee);if(fe&&!(fe[3]&&ue.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 pe=fe[1]||fe[2]||"";if(!pe||pe&&(ue===""||this.rules.inline.punctuation.exec(ue))){var Ze=fe[0].length-1,Qe,ut,dt=Ze,kt=0,zt=fe[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(zt.lastIndex=0,te=te.slice(-1*ee.length+Ze);(fe=zt.exec(te))!=null;)if(Qe=fe[1]||fe[2]||fe[3]||fe[4]||fe[5]||fe[6],!!Qe){if(ut=Qe.length,fe[3]||fe[4]){dt+=ut;continue}else if((fe[5]||fe[6])&&Ze%3&&!((Ze+ut)%3)){kt+=ut;continue}if(dt-=ut,!(dt>0))return ut=Math.min(ut,ut+dt+kt),Math.min(Ze,ut)%2?{type:"em",raw:ee.slice(0,Ze+fe.index+ut+1),text:ee.slice(1,Ze+fe.index+ut)}:{type:"strong",raw:ee.slice(0,Ze+fe.index+ut+1),text:ee.slice(2,Ze+fe.index+ut-1)}}}}},ge.codespan=function(ee){var te=this.rules.inline.code.exec(ee);if(te){var ue=te[2].replace(/\n/g," "),fe=/[^ ]/.test(ue),pe=/^ /.test(ue)&&/ $/.test(ue);return fe&&pe&&(ue=ue.substring(1,ue.length-1)),ue=C(ue,!0),{type:"codespan",raw:te[0],text:ue}}},ge.br=function(ee){var te=this.rules.inline.br.exec(ee);if(te)return{type:"br",raw:te[0]}},ge.del=function(ee){var te=this.rules.inline.del.exec(ee);if(te)return{type:"del",raw:te[0],text:te[2]}},ge.autolink=function(ee,te){var ue=this.rules.inline.autolink.exec(ee);if(ue){var fe,pe;return ue[2]==="@"?(fe=C(this.options.mangle?te(ue[1]):ue[1]),pe="mailto:"+fe):(fe=C(ue[1]),pe=fe),{type:"link",raw:ue[0],text:fe,href:pe,tokens:[{type:"text",raw:fe,text:fe}]}}},ge.url=function(ee,te){var ue;if(ue=this.rules.inline.url.exec(ee)){var fe,pe;if(ue[2]==="@")fe=C(this.options.mangle?te(ue[0]):ue[0]),pe="mailto:"+fe;else{var Ze;do Ze=ue[0],ue[0]=this.rules.inline._backpedal.exec(ue[0])[0];while(Ze!==ue[0]);fe=C(ue[0]),ue[1]==="www."?pe="http://"+fe:pe=fe}return{type:"link",raw:ue[0],text:fe,href:pe,tokens:[{type:"text",raw:fe,text:fe}]}}},ge.inlineText=function(ee,te,ue){var fe=this.rules.inline.text.exec(ee);if(fe){var pe;return te?pe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):C(fe[0]):fe[0]:pe=C(this.options.smartypants?ue(fe[0]):fe[0]),{type:"text",raw:fe[0],text:pe}}},xe}(),qe=B.noopTest,be=B.edit,je=B.merge,Me={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:qe,table:qe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};Me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Me.def=be(Me.def).replace("label",Me._label).replace("title",Me._title).getRegex(),Me.bullet=/(?:[*+-]|\d{1,9}[.)])/,Me.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Me.item=be(Me.item,"gm").replace(/bull/g,Me.bullet).getRegex(),Me.listItemStart=be(/^( *)(bull) */).replace("bull",Me.bullet).getRegex(),Me.list=be(Me.list).replace(/bull/g,Me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Me.def.source+")").getRegex(),Me._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",Me._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Me.html=be(Me.html,"i").replace("comment",Me._comment).replace("tag",Me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Me.paragraph=be(Me._paragraph).replace("hr",Me.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",Me._tag).getRegex(),Me.blockquote=be(Me.blockquote).replace("paragraph",Me.paragraph).getRegex(),Me.normal=je({},Me),Me.gfm=je({},Me.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*|$)"}),Me.gfm.nptable=be(Me.gfm.nptable).replace("hr",Me.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",Me._tag).getRegex(),Me.gfm.table=be(Me.gfm.table).replace("hr",Me.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",Me._tag).getRegex(),Me.pedantic=je({},Me.normal,{html:be(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Me._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:qe,paragraph:be(Me.normal._paragraph).replace("hr",Me.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:qe,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:qe,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};Oe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Oe.punctuation=be(Oe.punctuation).replace(/punctuation/g,Oe._punctuation).getRegex(),Oe.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,Oe.escapedEmSt=/\\\*|\\_/g,Oe._comment=be(Me._comment).replace("(?:-->|$)","-->").getRegex(),Oe.emStrong.lDelim=be(Oe.emStrong.lDelim).replace(/punct/g,Oe._punctuation).getRegex(),Oe.emStrong.rDelimAst=be(Oe.emStrong.rDelimAst,"g").replace(/punct/g,Oe._punctuation).getRegex(),Oe.emStrong.rDelimUnd=be(Oe.emStrong.rDelimUnd,"g").replace(/punct/g,Oe._punctuation).getRegex(),Oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Oe._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])?)+(?![-_])/,Oe.autolink=be(Oe.autolink).replace("scheme",Oe._scheme).replace("email",Oe._email).getRegex(),Oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Oe.tag=be(Oe.tag).replace("comment",Oe._comment).replace("attribute",Oe._attribute).getRegex(),Oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Oe._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Oe.link=be(Oe.link).replace("label",Oe._label).replace("href",Oe._href).replace("title",Oe._title).getRegex(),Oe.reflink=be(Oe.reflink).replace("label",Oe._label).getRegex(),Oe.reflinkSearch=be(Oe.reflinkSearch,"g").replace("reflink",Oe.reflink).replace("nolink",Oe.nolink).getRegex(),Oe.normal=je({},Oe),Oe.pedantic=je({},Oe.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:be(/^!?\[(label)\]\((.*?)\)/).replace("label",Oe._label).getRegex(),reflink:be(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Oe._label).getRegex()}),Oe.gfm=je({},Oe.normal,{escape:be(Oe.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Oe.gfm.url=be(Oe.gfm.url,"i").replace("email",Oe.gfm._extended_email).getRegex(),Oe.breaks=je({},Oe.gfm,{br:be(Oe.br).replace("{2,}","*").getRegex(),text:be(Oe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var wt={block:Me,inline:Oe},We=Le,lt=D.exports.defaults,He=wt.block,vt=wt.inline,Ee=B.repeatString;function we(xe){return xe.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(xe){var ge="",ye,ee,te=xe.length;for(ye=0;ye<te;ye++)ee=xe.charCodeAt(ye),Math.random()>.5&&(ee="x"+ee.toString(16)),ge+="&#"+ee+";";return ge}var Re=function(){function xe(ye){this.tokens=[],this.tokens.links=Object.create(null),this.options=ye||lt,this.options.tokenizer=this.options.tokenizer||new We,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ee={block:He.normal,inline:vt.normal};this.options.pedantic?(ee.block=He.pedantic,ee.inline=vt.pedantic):this.options.gfm&&(ee.block=He.gfm,this.options.breaks?ee.inline=vt.breaks:ee.inline=vt.gfm),this.tokenizer.rules=ee}xe.lex=function(ee,te){var ue=new xe(te);return ue.lex(ee)},xe.lexInline=function(ee,te){var ue=new xe(te);return ue.inlineTokens(ee)};var ge=xe.prototype;return ge.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},ge.blockTokens=function(ee,te,ue){te===void 0&&(te=[]),ue===void 0&&(ue=!0),this.options.pedantic&&(ee=ee.replace(/^ +$/gm,""));for(var fe,pe,Ze,Qe;ee;){if(fe=this.tokenizer.space(ee)){ee=ee.substring(fe.raw.length),fe.type&&te.push(fe);continue}if(fe=this.tokenizer.code(ee)){ee=ee.substring(fe.raw.length),Qe=te[te.length-1],Qe&&Qe.type==="paragraph"?(Qe.raw+=`
`+fe.raw,Qe.text+=`
`+fe.text):te.push(fe);continue}if(fe=this.tokenizer.fences(ee)){ee=ee.substring(fe.raw.length),te.push(fe);continue}if(fe=this.tokenizer.heading(ee)){ee=ee.substring(fe.raw.length),te.push(fe);continue}if(fe=this.tokenizer.nptable(ee)){ee=ee.substring(fe.raw.length),te.push(fe);continue}if(fe=this.tokenizer.hr(ee)){ee=ee.substring(fe.raw.length),te.push(fe);continue}if(fe=this.tokenizer.blockquote(ee)){ee=ee.substring(fe.raw.length),fe.tokens=this.blockTokens(fe.text,[],ue),te.push(fe);continue}if(fe=this.tokenizer.list(ee)){for(ee=ee.substring(fe.raw.length),Ze=fe.items.length,pe=0;pe<Ze;pe++)fe.items[pe].tokens=this.blockTokens(fe.items[pe].text,[],!1);te.push(fe);continue}if(fe=this.tokenizer.html(ee)){ee=ee.substring(fe.raw.length),te.push(fe);continue}if(ue&&(fe=this.tokenizer.def(ee))){ee=ee.substring(fe.raw.length),this.tokens.links[fe.tag]||(this.tokens.links[fe.tag]={href:fe.href,title:fe.title});continue}if(fe=this.tokenizer.table(ee)){ee=ee.substring(fe.raw.length),te.push(fe);continue}if(fe=this.tokenizer.lheading(ee)){ee=ee.substring(fe.raw.length),te.push(fe);continue}if(ue&&(fe=this.tokenizer.paragraph(ee))){ee=ee.substring(fe.raw.length),te.push(fe);continue}if(fe=this.tokenizer.text(ee)){ee=ee.substring(fe.raw.length),Qe=te[te.length-1],Qe&&Qe.type==="text"?(Qe.raw+=`
`+fe.raw,Qe.text+=`
`+fe.text):te.push(fe);continue}if(ee){var ut="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(ut);break}else throw new Error(ut)}}return te},ge.inline=function(ee){var te,ue,fe,pe,Ze,Qe,ut=ee.length;for(te=0;te<ut;te++)switch(Qe=ee[te],Qe.type){case"paragraph":case"text":case"heading":{Qe.tokens=[],this.inlineTokens(Qe.text,Qe.tokens);break}case"table":{for(Qe.tokens={header:[],cells:[]},pe=Qe.header.length,ue=0;ue<pe;ue++)Qe.tokens.header[ue]=[],this.inlineTokens(Qe.header[ue],Qe.tokens.header[ue]);for(pe=Qe.cells.length,ue=0;ue<pe;ue++)for(Ze=Qe.cells[ue],Qe.tokens.cells[ue]=[],fe=0;fe<Ze.length;fe++)Qe.tokens.cells[ue][fe]=[],this.inlineTokens(Ze[fe],Qe.tokens.cells[ue][fe]);break}case"blockquote":{this.inline(Qe.tokens);break}case"list":{for(pe=Qe.items.length,ue=0;ue<pe;ue++)this.inline(Qe.items[ue].tokens);break}}return ee},ge.inlineTokens=function(ee,te,ue,fe){te===void 0&&(te=[]),ue===void 0&&(ue=!1),fe===void 0&&(fe=!1);var pe,Ze,Qe=ee,ut,dt,kt;if(this.tokens.links){var zt=Object.keys(this.tokens.links);if(zt.length>0)for(;(ut=this.tokenizer.rules.inline.reflinkSearch.exec(Qe))!=null;)zt.includes(ut[0].slice(ut[0].lastIndexOf("[")+1,-1))&&(Qe=Qe.slice(0,ut.index)+"["+Ee("a",ut[0].length-2)+"]"+Qe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ut=this.tokenizer.rules.inline.blockSkip.exec(Qe))!=null;)Qe=Qe.slice(0,ut.index)+"["+Ee("a",ut[0].length-2)+"]"+Qe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(ut=this.tokenizer.rules.inline.escapedEmSt.exec(Qe))!=null;)Qe=Qe.slice(0,ut.index)+"++"+Qe.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;ee;){if(dt||(kt=""),dt=!1,pe=this.tokenizer.escape(ee)){ee=ee.substring(pe.raw.length),te.push(pe);continue}if(pe=this.tokenizer.tag(ee,ue,fe)){ee=ee.substring(pe.raw.length),ue=pe.inLink,fe=pe.inRawBlock;var Nt=te[te.length-1];Nt&&pe.type==="text"&&Nt.type==="text"?(Nt.raw+=pe.raw,Nt.text+=pe.text):te.push(pe);continue}if(pe=this.tokenizer.link(ee)){ee=ee.substring(pe.raw.length),pe.type==="link"&&(pe.tokens=this.inlineTokens(pe.text,[],!0,fe)),te.push(pe);continue}if(pe=this.tokenizer.reflink(ee,this.tokens.links)){ee=ee.substring(pe.raw.length);var Ct=te[te.length-1];pe.type==="link"?(pe.tokens=this.inlineTokens(pe.text,[],!0,fe),te.push(pe)):Ct&&pe.type==="text"&&Ct.type==="text"?(Ct.raw+=pe.raw,Ct.text+=pe.text):te.push(pe);continue}if(pe=this.tokenizer.emStrong(ee,Qe,kt)){ee=ee.substring(pe.raw.length),pe.tokens=this.inlineTokens(pe.text,[],ue,fe),te.push(pe);continue}if(pe=this.tokenizer.codespan(ee)){ee=ee.substring(pe.raw.length),te.push(pe);continue}if(pe=this.tokenizer.br(ee)){ee=ee.substring(pe.raw.length),te.push(pe);continue}if(pe=this.tokenizer.del(ee)){ee=ee.substring(pe.raw.length),pe.tokens=this.inlineTokens(pe.text,[],ue,fe),te.push(pe);continue}if(pe=this.tokenizer.autolink(ee,le)){ee=ee.substring(pe.raw.length),te.push(pe);continue}if(!ue&&(pe=this.tokenizer.url(ee,le))){ee=ee.substring(pe.raw.length),te.push(pe);continue}if(pe=this.tokenizer.inlineText(ee,fe,we)){ee=ee.substring(pe.raw.length),pe.raw.slice(-1)!=="_"&&(kt=pe.raw.slice(-1)),dt=!0,Ze=te[te.length-1],Ze&&Ze.type==="text"?(Ze.raw+=pe.raw,Ze.text+=pe.text):te.push(pe);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 te},b(xe,null,[{key:"rules",get:function(){return{block:He,inline:vt}}}]),xe}(),Fe=D.exports.defaults,Ke=B.cleanUrl,ie=B.escape,he=function(){function xe(ye){this.options=ye||Fe}var ge=xe.prototype;return ge.code=function(ee,te,ue){var fe=(te||"").match(/\S*/)[0];if(this.options.highlight){var pe=this.options.highlight(ee,fe);pe!=null&&pe!==ee&&(ue=!0,ee=pe)}return ee=ee.replace(/\n$/,"")+`
`,fe?'<pre><code class="'+this.options.langPrefix+ie(fe,!0)+'">'+(ue?ee:ie(ee,!0))+`</code></pre>
`:"<pre><code>"+(ue?ee:ie(ee,!0))+`</code></pre>
`},ge.blockquote=function(ee){return`<blockquote>
`+ee+`</blockquote>
`},ge.html=function(ee){return ee},ge.heading=function(ee,te,ue,fe){return this.options.headerIds?"<h"+te+' id="'+this.options.headerPrefix+fe.slug(ue)+'">'+ee+"</h"+te+`>
`:"<h"+te+">"+ee+"</h"+te+`>
`},ge.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ge.list=function(ee,te,ue){var fe=te?"ol":"ul",pe=te&&ue!==1?' start="'+ue+'"':"";return"<"+fe+pe+`>
`+ee+"</"+fe+`>
`},ge.listitem=function(ee){return"<li>"+ee+`</li>
`},ge.checkbox=function(ee){return"<input "+(ee?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ge.paragraph=function(ee){return"<p>"+ee+`</p>
`},ge.table=function(ee,te){return te&&(te="<tbody>"+te+"</tbody>"),`<table>
<thead>
`+ee+`</thead>
`+te+`</table>
`},ge.tablerow=function(ee){return`<tr>
`+ee+`</tr>
`},ge.tablecell=function(ee,te){var ue=te.header?"th":"td",fe=te.align?"<"+ue+' align="'+te.align+'">':"<"+ue+">";return fe+ee+"</"+ue+`>
`},ge.strong=function(ee){return"<strong>"+ee+"</strong>"},ge.em=function(ee){return"<em>"+ee+"</em>"},ge.codespan=function(ee){return"<code>"+ee+"</code>"},ge.br=function(){return this.options.xhtml?"<br/>":"<br>"},ge.del=function(ee){return"<del>"+ee+"</del>"},ge.link=function(ee,te,ue){if(ee=Ke(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ue;var fe='<a href="'+ie(ee)+'"';return te&&(fe+=' title="'+te+'"'),fe+=">"+ue+"</a>",fe},ge.image=function(ee,te,ue){if(ee=Ke(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ue;var fe='<img src="'+ee+'" alt="'+ue+'"';return te&&(fe+=' title="'+te+'"'),fe+=this.options.xhtml?"/>":">",fe},ge.text=function(ee){return ee},xe}(),Te=function(){function xe(){}var ge=xe.prototype;return ge.strong=function(ee){return ee},ge.em=function(ee){return ee},ge.codespan=function(ee){return ee},ge.del=function(ee){return ee},ge.html=function(ee){return ee},ge.text=function(ee){return ee},ge.link=function(ee,te,ue){return""+ue},ge.image=function(ee,te,ue){return""+ue},ge.br=function(){return""},xe}(),Ie=function(){function xe(){this.seen={}}var ge=xe.prototype;return ge.serialize=function(ee){return ee.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},ge.getNextSafeSlug=function(ee,te){var ue=ee,fe=0;if(this.seen.hasOwnProperty(ue)){fe=this.seen[ee];do fe++,ue=ee+"-"+fe;while(this.seen.hasOwnProperty(ue))}return te||(this.seen[ee]=fe,this.seen[ue]=0),ue},ge.slug=function(ee,te){te===void 0&&(te={});var ue=this.serialize(ee);return this.getNextSafeSlug(ue,te.dryrun)},xe}(),de=he,Be=Te,Ge=Ie,Ne=D.exports.defaults,Ye=B.unescape,$e=function(){function xe(ye){this.options=ye||Ne,this.options.renderer=this.options.renderer||new de,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Be,this.slugger=new Ge}xe.parse=function(ee,te){var ue=new xe(te);return ue.parse(ee)},xe.parseInline=function(ee,te){var ue=new xe(te);return ue.parseInline(ee)};var ge=xe.prototype;return ge.parse=function(ee,te){te===void 0&&(te=!0);var ue="",fe,pe,Ze,Qe,ut,dt,kt,zt,Nt,Ct,oi,_i,ti,ri,et,ze,ht,Bt,$t=ee.length;for(fe=0;fe<$t;fe++)switch(Ct=ee[fe],Ct.type){case"space":continue;case"hr":{ue+=this.renderer.hr();continue}case"heading":{ue+=this.renderer.heading(this.parseInline(Ct.tokens),Ct.depth,Ye(this.parseInline(Ct.tokens,this.textRenderer)),this.slugger);continue}case"code":{ue+=this.renderer.code(Ct.text,Ct.lang,Ct.escaped);continue}case"table":{for(zt="",kt="",Qe=Ct.header.length,pe=0;pe<Qe;pe++)kt+=this.renderer.tablecell(this.parseInline(Ct.tokens.header[pe]),{header:!0,align:Ct.align[pe]});for(zt+=this.renderer.tablerow(kt),Nt="",Qe=Ct.cells.length,pe=0;pe<Qe;pe++){for(dt=Ct.tokens.cells[pe],kt="",ut=dt.length,Ze=0;Ze<ut;Ze++)kt+=this.renderer.tablecell(this.parseInline(dt[Ze]),{header:!1,align:Ct.align[Ze]});Nt+=this.renderer.tablerow(kt)}ue+=this.renderer.table(zt,Nt);continue}case"blockquote":{Nt=this.parse(Ct.tokens),ue+=this.renderer.blockquote(Nt);continue}case"list":{for(oi=Ct.ordered,_i=Ct.start,ti=Ct.loose,Qe=Ct.items.length,Nt="",pe=0;pe<Qe;pe++)et=Ct.items[pe],ze=et.checked,ht=et.task,ri="",et.task&&(Bt=this.renderer.checkbox(ze),ti?et.tokens.length>0&&et.tokens[0].type==="text"?(et.tokens[0].text=Bt+" "+et.tokens[0].text,et.tokens[0].tokens&&et.tokens[0].tokens.length>0&&et.tokens[0].tokens[0].type==="text"&&(et.tokens[0].tokens[0].text=Bt+" "+et.tokens[0].tokens[0].text)):et.tokens.unshift({type:"text",text:Bt}):ri+=Bt),ri+=this.parse(et.tokens,ti),Nt+=this.renderer.listitem(ri,ht,ze);ue+=this.renderer.list(Nt,oi,_i);continue}case"html":{ue+=this.renderer.html(Ct.text);continue}case"paragraph":{ue+=this.renderer.paragraph(this.parseInline(Ct.tokens));continue}case"text":{for(Nt=Ct.tokens?this.parseInline(Ct.tokens):Ct.text;fe+1<$t&&ee[fe+1].type==="text";)Ct=ee[++fe],Nt+=`
`+(Ct.tokens?this.parseInline(Ct.tokens):Ct.text);ue+=te?this.renderer.paragraph(Nt):Nt;continue}default:{var Zt='Token with "'+Ct.type+'" type was not found.';if(this.options.silent){console.error(Zt);return}else throw new Error(Zt)}}return ue},ge.parseInline=function(ee,te){te=te||this.renderer;var ue="",fe,pe,Ze=ee.length;for(fe=0;fe<Ze;fe++)switch(pe=ee[fe],pe.type){case"escape":{ue+=te.text(pe.text);break}case"html":{ue+=te.html(pe.text);break}case"link":{ue+=te.link(pe.href,pe.title,this.parseInline(pe.tokens,te));break}case"image":{ue+=te.image(pe.href,pe.title,pe.text);break}case"strong":{ue+=te.strong(this.parseInline(pe.tokens,te));break}case"em":{ue+=te.em(this.parseInline(pe.tokens,te));break}case"codespan":{ue+=te.codespan(pe.text);break}case"br":{ue+=te.br();break}case"del":{ue+=te.del(this.parseInline(pe.tokens,te));break}case"text":{ue+=te.text(pe.text);break}default:{var Qe='Token with "'+pe.type+'" type was not found.';if(this.options.silent){console.error(Qe);return}else throw new Error(Qe)}}return ue},xe}(),st=Re,nt=$e,Je=Le,tt=he,gt=Te,_t=Ie,it=B.merge,Dt=B.checkSanitizeDeprecation,Tt=B.escape,at=D.exports.getDefaults,Ot=D.exports.changeDefaults,Ut=D.exports.defaults;function rt(xe,ge,ye){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof ge=="function"&&(ye=ge,ge=null),ge=it({},rt.defaults,ge||{}),Dt(ge),ye){var ee=ge.highlight,te;try{te=st.lex(xe,ge)}catch(Ze){return ye(Ze)}var ue=function(Qe){var ut;if(!Qe)try{ge.walkTokens&&rt.walkTokens(te,ge.walkTokens),ut=nt.parse(te,ge)}catch(dt){Qe=dt}return ge.highlight=ee,Qe?ye(Qe):ye(null,ut)};if(!ee||ee.length<3||(delete ge.highlight,!te.length))return ue();var fe=0;rt.walkTokens(te,function(Ze){Ze.type==="code"&&(fe++,setTimeout(function(){ee(Ze.text,Ze.lang,function(Qe,ut){if(Qe)return ue(Qe);ut!=null&&ut!==Ze.text&&(Ze.text=ut,Ze.escaped=!0),fe--,fe===0&&ue()})},0))}),fe===0&&ue();return}try{var pe=st.lex(xe,ge);return ge.walkTokens&&rt.walkTokens(pe,ge.walkTokens),nt.parse(pe,ge)}catch(Ze){if(Ze.message+=`
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+Tt(Ze.message+"",!0)+"</pre>";throw Ze}}rt.options=rt.setOptions=function(xe){return it(rt.defaults,xe),Ot(rt.defaults),rt},rt.getDefaults=at,rt.defaults=Ut,rt.use=function(xe){var ge=it({},xe);if(xe.renderer&&function(){var ee=rt.defaults.renderer||new tt,te=function(pe){var Ze=ee[pe];ee[pe]=function(){for(var Qe=arguments.length,ut=new Array(Qe),dt=0;dt<Qe;dt++)ut[dt]=arguments[dt];var kt=xe.renderer[pe].apply(ee,ut);return kt===!1&&(kt=Ze.apply(ee,ut)),kt}};for(var ue in xe.renderer)te(ue);ge.renderer=ee}(),xe.tokenizer&&function(){var ee=rt.defaults.tokenizer||new Je,te=function(pe){var Ze=ee[pe];ee[pe]=function(){for(var Qe=arguments.length,ut=new Array(Qe),dt=0;dt<Qe;dt++)ut[dt]=arguments[dt];var kt=xe.tokenizer[pe].apply(ee,ut);return kt===!1&&(kt=Ze.apply(ee,ut)),kt}};for(var ue in xe.tokenizer)te(ue);ge.tokenizer=ee}(),xe.walkTokens){var ye=rt.defaults.walkTokens;ge.walkTokens=function(ee){xe.walkTokens(ee),ye&&ye(ee)}}rt.setOptions(ge)},rt.walkTokens=function(xe,ge){for(var ye=K(xe),ee;!(ee=ye()).done;){var te=ee.value;switch(ge(te),te.type){case"table":{for(var ue=K(te.tokens.header),fe;!(fe=ue()).done;){var pe=fe.value;rt.walkTokens(pe,ge)}for(var Ze=K(te.tokens.cells),Qe;!(Qe=Ze()).done;)for(var ut=Qe.value,dt=K(ut),kt;!(kt=dt()).done;){var zt=kt.value;rt.walkTokens(zt,ge)}break}case"list":{rt.walkTokens(te.items,ge);break}default:te.tokens&&rt.walkTokens(te.tokens,ge)}}},rt.parseInline=function(xe,ge){if(typeof xe=="undefined"||xe===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");ge=it({},rt.defaults,ge||{}),Dt(ge);try{var ye=st.lexInline(xe,ge);return ge.walkTokens&&rt.walkTokens(ye,ge.walkTokens),nt.parseInline(ye,ge)}catch(ee){if(ee.message+=`
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+Tt(ee.message+"",!0)+"</pre>";throw ee}},rt.Parser=nt,rt.parser=nt.parse,rt.Renderer=tt,rt.TextRenderer=gt,rt.Lexer=st,rt.lexer=st.lex,rt.Tokenizer=Je,rt.Slugger=_t,rt.parse=rt;var xt=rt;return xt})},11690:function(mt){const me=/[&<>"']/,b=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,I=/[<>"']|&(?!#?\w+;)/g,K={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},D=F=>K[F];function w(F,Y){if(Y){if(me.test(F))return F.replace(b,D)}else if(k.test(F))return F.replace(I,D);return F}const _=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function O(F){return F.replace(_,(Y,V)=>(V=V.toLowerCase(),V==="colon"?":":V.charAt(0)==="#"?V.charAt(1)==="x"?String.fromCharCode(parseInt(V.substring(2),16)):String.fromCharCode(+V.substring(1)):""))}const m=/(^|[^\[])\^/g;function n(F,Y){F=F.source||F,Y=Y||"";const V={replace:(ne,ae)=>(ae=ae.source||ae,ae=ae.replace(m,"$1"),F=F.replace(ne,ae),V),getRegex:()=>new RegExp(F,Y)};return V}const y=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function c(F,Y,V){if(F){let ne;try{ne=decodeURIComponent(O(V)).replace(y,"").toLowerCase()}catch(ae){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}Y&&!f.test(V)&&(V=T(Y,V));try{V=encodeURI(V).replace(/%25/g,"%")}catch(ne){return null}return V}const l={},u=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,E=/^([^:]+:\/*[^/]*)[\s\S]*$/;function T(F,Y){l[" "+F]||(u.test(F)?l[" "+F]=F+"/":l[" "+F]=P(F,"/",!0)),F=l[" "+F];const V=F.indexOf(":")===-1;return Y.substring(0,2)==="//"?V?Y:F.replace(p,"$1")+Y:Y.charAt(0)==="/"?V?Y:F.replace(E,"$1")+Y:F+Y}const L={exec:function(){}};function x(F){let Y=1,V,ne;for(;Y<arguments.length;Y++){V=arguments[Y];for(ne in V)Object.prototype.hasOwnProperty.call(V,ne)&&(F[ne]=V[ne])}return F}function A(F,Y){const V=F.replace(/\|/g,(J,z,Z)=>{let B=!1,G=z;for(;--G>=0&&Z[G]==="\\";)B=!B;return B?"|":" |"}),ne=V.split(/ \|/);let ae=0;if(ne.length>Y)ne.splice(Y);else for(;ne.length<Y;)ne.push("");for(;ae<ne.length;ae++)ne[ae]=ne[ae].trim().replace(/\\\|/g,"|");return ne}function P(F,Y,V){const ne=F.length;if(ne===0)return"";let ae=0;for(;ae<ne;){const J=F.charAt(ne-ae-1);if(J===Y&&!V)ae++;else if(J!==Y&&V)ae++;else break}return F.substr(0,ne-ae)}function U(F,Y){if(F.indexOf(Y[1])===-1)return-1;const V=F.length;let ne=0,ae=0;for(;ae<V;ae++)if(F[ae]==="\\")ae++;else if(F[ae]===Y[0])ne++;else if(F[ae]===Y[1]&&(ne--,ne<0))return ae;return-1}function N(F){F&&F.sanitize&&!F.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 H(F,Y){if(Y<1)return"";let V="";for(;Y>1;)Y&1&&(V+=F),Y>>=1,F+=F;return V+F}mt.exports={escape:w,unescape:O,edit:n,cleanUrl:c,resolveUrl:T,noopTest:L,merge:x,splitCells:A,rtrim:P,findClosingBracket:U,checkSanitizeDeprecation:N,repeatString:H}},75918:function(mt,me,b){"use strict";b.d(me,{Wi:function(){return _},Z0:function(){return O},aU:function(){return w},eZ:function(){return n},wY:function(){return m}});var k=b(4348),I=b(69323),K=b(13268),D=function(y,f,c,l){function u(p){return p instanceof c?p:new c(function(E){E(p)})}return new(c||(c=Promise))(function(p,E){function T(A){try{x(l.next(A))}catch(P){E(P)}}function L(A){try{x(l.throw(A))}catch(P){E(P)}}function x(A){A.done?p(A.value):u(A.value).then(T,L)}x((l=l.apply(y,f||[])).next())})};class w extends I.JT{constructor(f,c="",l="",u=!0,p){super(),this._onDidChange=this._register(new k.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=f,this._label=c,this._cssClass=l,this._enabled=u,this._actionCallback=p}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 I.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new k.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new k.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(u){l=u}this._onDidRun.fire({action:f,error:l})})}runAction(f,c){return D(this,void 0,void 0,function*(){yield f.run(c)})}}class O extends w{constructor(f){super(O.ID,f,f?"separator text":"separator"),this.checked=!1,this.enabled=!1}}O.ID="vs.actions.separator";class m{constructor(f,c,l,u){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=f,this.label=c,this.class=u,this._actions=l}get actions(){return this._actions}dispose(){}run(){return D(this,void 0,void 0,function*(){})}}class n extends w{constructor(){super(n.ID,K.N("submenu.empty","(empty)"),void 0,!1)}}n.ID="vs.actions.empty"},76068:function(mt,me,b){"use strict";b.d(me,{ok:function(){return k}});function k(I,K){if(!I)throw new Error(K?`Assertion failed (${K})`:"Assertion Failed")}},52615:function(mt,me,b){"use strict";b.d(me,{CM:function(){return w},JL:function(){return _},dT:function(){return m},fK:function(){return D},lA:function(){return O}});var k=b(4348);class I{constructor(){this._icons=new Map,this._onDidRegister=new k.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 I,D=K;function w(n,y){return new O(n,y)}function _(n){return n?n.replace(/\$\((.*?)\)/g,(y,f)=>` ${f} `).trim():""}class O{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 m;(function(n){n.iconNameSegment="[A-Za-z0-9]+",n.iconNameExpression="[A-Za-z0-9\\-]+",n.iconModifierExpression="~[A-Za-z]+";const y=new RegExp(`^(${n.iconNameExpression})(${n.iconModifierExpression})?$`);function f(u){if(u instanceof O)return["codicon","codicon-"+u.id];const p=y.exec(u.id);if(!p)return f(O.error);let[,E,T]=p;const L=["codicon","codicon-"+E];return T&&L.push("codicon-modifier-"+T.substr(1)),L}n.asClassNameArray=f;function c(u){return f(u).join(" ")}n.asClassName=c;function l(u){return"."+f(u).join(".")}n.asCSSSelector=l})(m||(m={})),function(n){n.add=new n("add",{fontCharacter:"\\ea60"}),n.plus=new n("plus",n.add.definition),n.gistNew=new n("gist-new",n.add.definition),n.repoCreate=new n("repo-create",n.add.definition),n.lightbulb=new n("lightbulb",{fontCharacter:"\\ea61"}),n.lightBulb=new n("light-bulb",{fontCharacter:"\\ea61"}),n.repo=new n("repo",{fontCharacter:"\\ea62"}),n.repoDelete=new n("repo-delete",{fontCharacter:"\\ea62"}),n.gistFork=new n("gist-fork",{fontCharacter:"\\ea63"}),n.repoForked=new n("repo-forked",{fontCharacter:"\\ea63"}),n.gitPullRequest=new n("git-pull-request",{fontCharacter:"\\ea64"}),n.gitPullRequestAbandoned=new n("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),n.recordKeys=new n("record-keys",{fontCharacter:"\\ea65"}),n.keyboard=new n("keyboard",{fontCharacter:"\\ea65"}),n.tag=new n("tag",{fontCharacter:"\\ea66"}),n.tagAdd=new n("tag-add",{fontCharacter:"\\ea66"}),n.tagRemove=new n("tag-remove",{fontCharacter:"\\ea66"}),n.person=new n("person",{fontCharacter:"\\ea67"}),n.personFollow=new n("person-follow",{fontCharacter:"\\ea67"}),n.personOutline=new n("person-outline",{fontCharacter:"\\ea67"}),n.personFilled=new n("person-filled",{fontCharacter:"\\ea67"}),n.gitBranch=new n("git-branch",{fontCharacter:"\\ea68"}),n.gitBranchCreate=new n("git-branch-create",{fontCharacter:"\\ea68"}),n.gitBranchDelete=new n("git-branch-delete",{fontCharacter:"\\ea68"}),n.sourceControl=new n("source-control",{fontCharacter:"\\ea68"}),n.mirror=new n("mirror",{fontCharacter:"\\ea69"}),n.mirrorPublic=new n("mirror-public",{fontCharacter:"\\ea69"}),n.star=new n("star",{fontCharacter:"\\ea6a"}),n.starAdd=new n("star-add",{fontCharacter:"\\ea6a"}),n.starDelete=new n("star-delete",{fontCharacter:"\\ea6a"}),n.starEmpty=new n("star-empty",{fontCharacter:"\\ea6a"}),n.comment=new n("comment",{fontCharacter:"\\ea6b"}),n.commentAdd=new n("comment-add",{fontCharacter:"\\ea6b"}),n.alert=new n("alert",{fontCharacter:"\\ea6c"}),n.warning=new n("warning",{fontCharacter:"\\ea6c"}),n.search=new n("search",{fontCharacter:"\\ea6d"}),n.searchSave=new n("search-save",{fontCharacter:"\\ea6d"}),n.logOut=new n("log-out",{fontCharacter:"\\ea6e"}),n.signOut=new n("sign-out",{fontCharacter:"\\ea6e"}),n.logIn=new n("log-in",{fontCharacter:"\\ea6f"}),n.signIn=new n("sign-in",{fontCharacter:"\\ea6f"}),n.eye=new n("eye",{fontCharacter:"\\ea70"}),n.eyeUnwatch=new n("eye-unwatch",{fontCharacter:"\\ea70"}),n.eyeWatch=new n("eye-watch",{fontCharacter:"\\ea70"}),n.circleFilled=new n("circle-filled",{fontCharacter:"\\ea71"}),n.primitiveDot=new n("primitive-dot",{fontCharacter:"\\ea71"}),n.closeDirty=new n("close-dirty",{fontCharacter:"\\ea71"}),n.debugBreakpoint=new n("debug-breakpoint",{fontCharacter:"\\ea71"}),n.debugBreakpointDisabled=new n("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),n.debugHint=new n("debug-hint",{fontCharacter:"\\ea71"}),n.primitiveSquare=new n("primitive-square",{fontCharacter:"\\ea72"}),n.edit=new n("edit",{fontCharacter:"\\ea73"}),n.pencil=new n("pencil",{fontCharacter:"\\ea73"}),n.info=new n("info",{fontCharacter:"\\ea74"}),n.issueOpened=new n("issue-opened",{fontCharacter:"\\ea74"}),n.gistPrivate=new n("gist-private",{fontCharacter:"\\ea75"}),n.gitForkPrivate=new n("git-fork-private",{fontCharacter:"\\ea75"}),n.lock=new n("lock",{fontCharacter:"\\ea75"}),n.mirrorPrivate=new n("mirror-private",{fontCharacter:"\\ea75"}),n.close=new n("close",{fontCharacter:"\\ea76"}),n.removeClose=new n("remove-close",{fontCharacter:"\\ea76"}),n.x=new n("x",{fontCharacter:"\\ea76"}),n.repoSync=new n("repo-sync",{fontCharacter:"\\ea77"}),n.sync=new n("sync",{fontCharacter:"\\ea77"}),n.clone=new n("clone",{fontCharacter:"\\ea78"}),n.desktopDownload=new n("desktop-download",{fontCharacter:"\\ea78"}),n.beaker=new n("beaker",{fontCharacter:"\\ea79"}),n.microscope=new n("microscope",{fontCharacter:"\\ea79"}),n.vm=new n("vm",{fontCharacter:"\\ea7a"}),n.deviceDesktop=new n("device-desktop",{fontCharacter:"\\ea7a"}),n.file=new n("file",{fontCharacter:"\\ea7b"}),n.fileText=new n("file-text",{fontCharacter:"\\ea7b"}),n.more=new n("more",{fontCharacter:"\\ea7c"}),n.ellipsis=new n("ellipsis",{fontCharacter:"\\ea7c"}),n.kebabHorizontal=new n("kebab-horizontal",{fontCharacter:"\\ea7c"}),n.mailReply=new n("mail-reply",{fontCharacter:"\\ea7d"}),n.reply=new n("reply",{fontCharacter:"\\ea7d"}),n.organization=new n("organization",{fontCharacter:"\\ea7e"}),n.organizationFilled=new n("organization-filled",{fontCharacter:"\\ea7e"}),n.organizationOutline=new n("organization-outline",{fontCharacter:"\\ea7e"}),n.newFile=new n("new-file",{fontCharacter:"\\ea7f"}),n.fileAdd=new n("file-add",{fontCharacter:"\\ea7f"}),n.newFolder=new n("new-folder",{fontCharacter:"\\ea80"}),n.fileDirectoryCreate=new n("file-directory-create",{fontCharacter:"\\ea80"}),n.trash=new n("trash",{fontCharacter:"\\ea81"}),n.trashcan=new n("trashcan",{fontCharacter:"\\ea81"}),n.history=new n("history",{fontCharacter:"\\ea82"}),n.clock=new n("clock",{fontCharacter:"\\ea82"}),n.folder=new n("folder",{fontCharacter:"\\ea83"}),n.fileDirectory=new n("file-directory",{fontCharacter:"\\ea83"}),n.symbolFolder=new n("symbol-folder",{fontCharacter:"\\ea83"}),n.logoGithub=new n("logo-github",{fontCharacter:"\\ea84"}),n.markGithub=new n("mark-github",{fontCharacter:"\\ea84"}),n.github=new n("github",{fontCharacter:"\\ea84"}),n.terminal=new n("terminal",{fontCharacter:"\\ea85"}),n.console=new n("console",{fontCharacter:"\\ea85"}),n.repl=new n("repl",{fontCharacter:"\\ea85"}),n.zap=new n("zap",{fontCharacter:"\\ea86"}),n.symbolEvent=new n("symbol-event",{fontCharacter:"\\ea86"}),n.error=new n("error",{fontCharacter:"\\ea87"}),n.stop=new n("stop",{fontCharacter:"\\ea87"}),n.variable=new n("variable",{fontCharacter:"\\ea88"}),n.symbolVariable=new n("symbol-variable",{fontCharacter:"\\ea88"}),n.array=new n("array",{fontCharacter:"\\ea8a"}),n.symbolArray=new n("symbol-array",{fontCharacter:"\\ea8a"}),n.symbolModule=new n("symbol-module",{fontCharacter:"\\ea8b"}),n.symbolPackage=new n("symbol-package",{fontCharacter:"\\ea8b"}),n.symbolNamespace=new n("symbol-namespace",{fontCharacter:"\\ea8b"}),n.symbolObject=new n("symbol-object",{fontCharacter:"\\ea8b"}),n.symbolMethod=new n("symbol-method",{fontCharacter:"\\ea8c"}),n.symbolFunction=new n("symbol-function",{fontCharacter:"\\ea8c"}),n.symbolConstructor=new n("symbol-constructor",{fontCharacter:"\\ea8c"}),n.symbolBoolean=new n("symbol-boolean",{fontCharacter:"\\ea8f"}),n.symbolNull=new n("symbol-null",{fontCharacter:"\\ea8f"}),n.symbolNumeric=new n("symbol-numeric",{fontCharacter:"\\ea90"}),n.symbolNumber=new n("symbol-number",{fontCharacter:"\\ea90"}),n.symbolStructure=new n("symbol-structure",{fontCharacter:"\\ea91"}),n.symbolStruct=new n("symbol-struct",{fontCharacter:"\\ea91"}),n.symbolParameter=new n("symbol-parameter",{fontCharacter:"\\ea92"}),n.symbolTypeParameter=new n("symbol-type-parameter",{fontCharacter:"\\ea92"}),n.symbolKey=new n("symbol-key",{fontCharacter:"\\ea93"}),n.symbolText=new n("symbol-text",{fontCharacter:"\\ea93"}),n.symbolReference=new n("symbol-reference",{fontCharacter:"\\ea94"}),n.goToFile=new n("go-to-file",{fontCharacter:"\\ea94"}),n.symbolEnum=new n("symbol-enum",{fontCharacter:"\\ea95"}),n.symbolValue=new n("symbol-value",{fontCharacter:"\\ea95"}),n.symbolRuler=new n("symbol-ruler",{fontCharacter:"\\ea96"}),n.symbolUnit=new n("symbol-unit",{fontCharacter:"\\ea96"}),n.activateBreakpoints=new n("activate-breakpoints",{fontCharacter:"\\ea97"}),n.archive=new n("archive",{fontCharacter:"\\ea98"}),n.arrowBoth=new n("arrow-both",{fontCharacter:"\\ea99"}),n.arrowDown=new n("arrow-down",{fontCharacter:"\\ea9a"}),n.arrowLeft=new n("arrow-left",{fontCharacter:"\\ea9b"}),n.arrowRight=new n("arrow-right",{fontCharacter:"\\ea9c"}),n.arrowSmallDown=new n("arrow-small-down",{fontCharacter:"\\ea9d"}),n.arrowSmallLeft=new n("arrow-small-left",{fontCharacter:"\\ea9e"}),n.arrowSmallRight=new n("arrow-small-right",{fontCharacter:"\\ea9f"}),n.arrowSmallUp=new n("arrow-small-up",{fontCharacter:"\\eaa0"}),n.arrowUp=new n("arrow-up",{fontCharacter:"\\eaa1"}),n.bell=new n("bell",{fontCharacter:"\\eaa2"}),n.bold=new n("bold",{fontCharacter:"\\eaa3"}),n.book=new n("book",{fontCharacter:"\\eaa4"}),n.bookmark=new n("bookmark",{fontCharacter:"\\eaa5"}),n.debugBreakpointConditionalUnverified=new n("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),n.debugBreakpointConditional=new n("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),n.debugBreakpointConditionalDisabled=new n("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),n.debugBreakpointDataUnverified=new n("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),n.debugBreakpointData=new n("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),n.debugBreakpointDataDisabled=new n("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),n.debugBreakpointLogUnverified=new n("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),n.debugBreakpointLog=new n("debug-breakpoint-log",{fontCharacter:"\\eaab"}),n.debugBreakpointLogDisabled=new n("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),n.briefcase=new n("briefcase",{fontCharacter:"\\eaac"}),n.broadcast=new n("broadcast",{fontCharacter:"\\eaad"}),n.browser=new n("browser",{fontCharacter:"\\eaae"}),n.bug=new n("bug",{fontCharacter:"\\eaaf"}),n.calendar=new n("calendar",{fontCharacter:"\\eab0"}),n.caseSensitive=new n("case-sensitive",{fontCharacter:"\\eab1"}),n.check=new n("check",{fontCharacter:"\\eab2"}),n.checklist=new n("checklist",{fontCharacter:"\\eab3"}),n.chevronDown=new n("chevron-down",{fontCharacter:"\\eab4"}),n.dropDownButton=new n("drop-down-button",n.chevronDown.definition),n.chevronLeft=new n("chevron-left",{fontCharacter:"\\eab5"}),n.chevronRight=new n("chevron-right",{fontCharacter:"\\eab6"}),n.chevronUp=new n("chevron-up",{fontCharacter:"\\eab7"}),n.chromeClose=new n("chrome-close",{fontCharacter:"\\eab8"}),n.chromeMaximize=new n("chrome-maximize",{fontCharacter:"\\eab9"}),n.chromeMinimize=new n("chrome-minimize",{fontCharacter:"\\eaba"}),n.chromeRestore=new n("chrome-restore",{fontCharacter:"\\eabb"}),n.circleOutline=new n("circle-outline",{fontCharacter:"\\eabc"}),n.debugBreakpointUnverified=new n("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),n.circleSlash=new n("circle-slash",{fontCharacter:"\\eabd"}),n.circuitBoard=new n("circuit-board",{fontCharacter:"\\eabe"}),n.clearAll=new n("clear-all",{fontCharacter:"\\eabf"}),n.clippy=new n("clippy",{fontCharacter:"\\eac0"}),n.closeAll=new n("close-all",{fontCharacter:"\\eac1"}),n.cloudDownload=new n("cloud-download",{fontCharacter:"\\eac2"}),n.cloudUpload=new n("cloud-upload",{fontCharacter:"\\eac3"}),n.code=new n("code",{fontCharacter:"\\eac4"}),n.collapseAll=new n("collapse-all",{fontCharacter:"\\eac5"}),n.colorMode=new n("color-mode",{fontCharacter:"\\eac6"}),n.commentDiscussion=new n("comment-discussion",{fontCharacter:"\\eac7"}),n.compareChanges=new n("compare-changes",{fontCharacter:"\\eafd"}),n.creditCard=new n("credit-card",{fontCharacter:"\\eac9"}),n.dash=new n("dash",{fontCharacter:"\\eacc"}),n.dashboard=new n("dashboard",{fontCharacter:"\\eacd"}),n.database=new n("database",{fontCharacter:"\\eace"}),n.debugContinue=new n("debug-continue",{fontCharacter:"\\eacf"}),n.debugDisconnect=new n("debug-disconnect",{fontCharacter:"\\ead0"}),n.debugPause=new n("debug-pause",{fontCharacter:"\\ead1"}),n.debugRestart=new n("debug-restart",{fontCharacter:"\\ead2"}),n.debugStart=new n("debug-start",{fontCharacter:"\\ead3"}),n.debugStepInto=new n("debug-step-into",{fontCharacter:"\\ead4"}),n.debugStepOut=new n("debug-step-out",{fontCharacter:"\\ead5"}),n.debugStepOver=new n("debug-step-over",{fontCharacter:"\\ead6"}),n.debugStop=new n("debug-stop",{fontCharacter:"\\ead7"}),n.debug=new n("debug",{fontCharacter:"\\ead8"}),n.deviceCameraVideo=new n("device-camera-video",{fontCharacter:"\\ead9"}),n.deviceCamera=new n("device-camera",{fontCharacter:"\\eada"}),n.deviceMobile=new n("device-mobile",{fontCharacter:"\\eadb"}),n.diffAdded=new n("diff-added",{fontCharacter:"\\eadc"}),n.diffIgnored=new n("diff-ignored",{fontCharacter:"\\eadd"}),n.diffModified=new n("diff-modified",{fontCharacter:"\\eade"}),n.diffRemoved=new n("diff-removed",{fontCharacter:"\\eadf"}),n.diffRenamed=new n("diff-renamed",{fontCharacter:"\\eae0"}),n.diff=new n("diff",{fontCharacter:"\\eae1"}),n.discard=new n("discard",{fontCharacter:"\\eae2"}),n.editorLayout=new n("editor-layout",{fontCharacter:"\\eae3"}),n.emptyWindow=new n("empty-window",{fontCharacter:"\\eae4"}),n.exclude=new n("exclude",{fontCharacter:"\\eae5"}),n.extensions=new n("extensions",{fontCharacter:"\\eae6"}),n.eyeClosed=new n("eye-closed",{fontCharacter:"\\eae7"}),n.fileBinary=new n("file-binary",{fontCharacter:"\\eae8"}),n.fileCode=new n("file-code",{fontCharacter:"\\eae9"}),n.fileMedia=new n("file-media",{fontCharacter:"\\eaea"}),n.filePdf=new n("file-pdf",{fontCharacter:"\\eaeb"}),n.fileSubmodule=new n("file-submodule",{fontCharacter:"\\eaec"}),n.fileSymlinkDirectory=new n("file-symlink-directory",{fontCharacter:"\\eaed"}),n.fileSymlinkFile=new n("file-symlink-file",{fontCharacter:"\\eaee"}),n.fileZip=new n("file-zip",{fontCharacter:"\\eaef"}),n.files=new n("files",{fontCharacter:"\\eaf0"}),n.filter=new n("filter",{fontCharacter:"\\eaf1"}),n.flame=new n("flame",{fontCharacter:"\\eaf2"}),n.foldDown=new n("fold-down",{fontCharacter:"\\eaf3"}),n.foldUp=new n("fold-up",{fontCharacter:"\\eaf4"}),n.fold=new n("fold",{fontCharacter:"\\eaf5"}),n.folderActive=new n("folder-active",{fontCharacter:"\\eaf6"}),n.folderOpened=new n("folder-opened",{fontCharacter:"\\eaf7"}),n.gear=new n("gear",{fontCharacter:"\\eaf8"}),n.gift=new n("gift",{fontCharacter:"\\eaf9"}),n.gistSecret=new n("gist-secret",{fontCharacter:"\\eafa"}),n.gist=new n("gist",{fontCharacter:"\\eafb"}),n.gitCommit=new n("git-commit",{fontCharacter:"\\eafc"}),n.gitCompare=new n("git-compare",{fontCharacter:"\\eafd"}),n.gitMerge=new n("git-merge",{fontCharacter:"\\eafe"}),n.githubAction=new n("github-action",{fontCharacter:"\\eaff"}),n.githubAlt=new n("github-alt",{fontCharacter:"\\eb00"}),n.globe=new n("globe",{fontCharacter:"\\eb01"}),n.grabber=new n("grabber",{fontCharacter:"\\eb02"}),n.graph=new n("graph",{fontCharacter:"\\eb03"}),n.gripper=new n("gripper",{fontCharacter:"\\eb04"}),n.heart=new n("heart",{fontCharacter:"\\eb05"}),n.home=new n("home",{fontCharacter:"\\eb06"}),n.horizontalRule=new n("horizontal-rule",{fontCharacter:"\\eb07"}),n.hubot=new n("hubot",{fontCharacter:"\\eb08"}),n.inbox=new n("inbox",{fontCharacter:"\\eb09"}),n.issueClosed=new n("issue-closed",{fontCharacter:"\\eba4"}),n.issueReopened=new n("issue-reopened",{fontCharacter:"\\eb0b"}),n.issues=new n("issues",{fontCharacter:"\\eb0c"}),n.italic=new n("italic",{fontCharacter:"\\eb0d"}),n.jersey=new n("jersey",{fontCharacter:"\\eb0e"}),n.json=new n("json",{fontCharacter:"\\eb0f"}),n.kebabVertical=new n("kebab-vertical",{fontCharacter:"\\eb10"}),n.key=new n("key",{fontCharacter:"\\eb11"}),n.law=new n("law",{fontCharacter:"\\eb12"}),n.lightbulbAutofix=new n("lightbulb-autofix",{fontCharacter:"\\eb13"}),n.linkExternal=new n("link-external",{fontCharacter:"\\eb14"}),n.link=new n("link",{fontCharacter:"\\eb15"}),n.listOrdered=new n("list-ordered",{fontCharacter:"\\eb16"}),n.listUnordered=new n("list-unordered",{fontCharacter:"\\eb17"}),n.liveShare=new n("live-share",{fontCharacter:"\\eb18"}),n.loading=new n("loading",{fontCharacter:"\\eb19"}),n.location=new n("location",{fontCharacter:"\\eb1a"}),n.mailRead=new n("mail-read",{fontCharacter:"\\eb1b"}),n.mail=new n("mail",{fontCharacter:"\\eb1c"}),n.markdown=new n("markdown",{fontCharacter:"\\eb1d"}),n.megaphone=new n("megaphone",{fontCharacter:"\\eb1e"}),n.mention=new n("mention",{fontCharacter:"\\eb1f"}),n.milestone=new n("milestone",{fontCharacter:"\\eb20"}),n.mortarBoard=new n("mortar-board",{fontCharacter:"\\eb21"}),n.move=new n("move",{fontCharacter:"\\eb22"}),n.multipleWindows=new n("multiple-windows",{fontCharacter:"\\eb23"}),n.mute=new n("mute",{fontCharacter:"\\eb24"}),n.noNewline=new n("no-newline",{fontCharacter:"\\eb25"}),n.note=new n("note",{fontCharacter:"\\eb26"}),n.octoface=new n("octoface",{fontCharacter:"\\eb27"}),n.openPreview=new n("open-preview",{fontCharacter:"\\eb28"}),n.package_=new n("package",{fontCharacter:"\\eb29"}),n.paintcan=new n("paintcan",{fontCharacter:"\\eb2a"}),n.pin=new n("pin",{fontCharacter:"\\eb2b"}),n.play=new n("play",{fontCharacter:"\\eb2c"}),n.run=new n("run",{fontCharacter:"\\eb2c"}),n.plug=new n("plug",{fontCharacter:"\\eb2d"}),n.preserveCase=new n("preserve-case",{fontCharacter:"\\eb2e"}),n.preview=new n("preview",{fontCharacter:"\\eb2f"}),n.project=new n("project",{fontCharacter:"\\eb30"}),n.pulse=new n("pulse",{fontCharacter:"\\eb31"}),n.question=new n("question",{fontCharacter:"\\eb32"}),n.quote=new n("quote",{fontCharacter:"\\eb33"}),n.radioTower=new n("radio-tower",{fontCharacter:"\\eb34"}),n.reactions=new n("reactions",{fontCharacter:"\\eb35"}),n.references=new n("references",{fontCharacter:"\\eb36"}),n.refresh=new n("refresh",{fontCharacter:"\\eb37"}),n.regex=new n("regex",{fontCharacter:"\\eb38"}),n.remoteExplorer=new n("remote-explorer",{fontCharacter:"\\eb39"}),n.remote=new n("remote",{fontCharacter:"\\eb3a"}),n.remove=new n("remove",{fontCharacter:"\\eb3b"}),n.replaceAll=new n("replace-all",{fontCharacter:"\\eb3c"}),n.replace=new n("replace",{fontCharacter:"\\eb3d"}),n.repoClone=new n("repo-clone",{fontCharacter:"\\eb3e"}),n.repoForcePush=new n("repo-force-push",{fontCharacter:"\\eb3f"}),n.repoPull=new n("repo-pull",{fontCharacter:"\\eb40"}),n.repoPush=new n("repo-push",{fontCharacter:"\\eb41"}),n.report=new n("report",{fontCharacter:"\\eb42"}),n.requestChanges=new n("request-changes",{fontCharacter:"\\eb43"}),n.rocket=new n("rocket",{fontCharacter:"\\eb44"}),n.rootFolderOpened=new n("root-folder-opened",{fontCharacter:"\\eb45"}),n.rootFolder=new n("root-folder",{fontCharacter:"\\eb46"}),n.rss=new n("rss",{fontCharacter:"\\eb47"}),n.ruby=new n("ruby",{fontCharacter:"\\eb48"}),n.saveAll=new n("save-all",{fontCharacter:"\\eb49"}),n.saveAs=new n("save-as",{fontCharacter:"\\eb4a"}),n.save=new n("save",{fontCharacter:"\\eb4b"}),n.screenFull=new n("screen-full",{fontCharacter:"\\eb4c"}),n.screenNormal=new n("screen-normal",{fontCharacter:"\\eb4d"}),n.searchStop=new n("search-stop",{fontCharacter:"\\eb4e"}),n.server=new n("server",{fontCharacter:"\\eb50"}),n.settingsGear=new n("settings-gear",{fontCharacter:"\\eb51"}),n.settings=new n("settings",{fontCharacter:"\\eb52"}),n.shield=new n("shield",{fontCharacter:"\\eb53"}),n.smiley=new n("smiley",{fontCharacter:"\\eb54"}),n.sortPrecedence=new n("sort-precedence",{fontCharacter:"\\eb55"}),n.splitHorizontal=new n("split-horizontal",{fontCharacter:"\\eb56"}),n.splitVertical=new n("split-vertical",{fontCharacter:"\\eb57"}),n.squirrel=new n("squirrel",{fontCharacter:"\\eb58"}),n.starFull=new n("star-full",{fontCharacter:"\\eb59"}),n.starHalf=new n("star-half",{fontCharacter:"\\eb5a"}),n.symbolClass=new n("symbol-class",{fontCharacter:"\\eb5b"}),n.symbolColor=new n("symbol-color",{fontCharacter:"\\eb5c"}),n.symbolConstant=new n("symbol-constant",{fontCharacter:"\\eb5d"}),n.symbolEnumMember=new n("symbol-enum-member",{fontCharacter:"\\eb5e"}),n.symbolField=new n("symbol-field",{fontCharacter:"\\eb5f"}),n.symbolFile=new n("symbol-file",{fontCharacter:"\\eb60"}),n.symbolInterface=new n("symbol-interface",{fontCharacter:"\\eb61"}),n.symbolKeyword=new n("symbol-keyword",{fontCharacter:"\\eb62"}),n.symbolMisc=new n("symbol-misc",{fontCharacter:"\\eb63"}),n.symbolOperator=new n("symbol-operator",{fontCharacter:"\\eb64"}),n.symbolProperty=new n("symbol-property",{fontCharacter:"\\eb65"}),n.wrench=new n("wrench",{fontCharacter:"\\eb65"}),n.wrenchSubaction=new n("wrench-subaction",{fontCharacter:"\\eb65"}),n.symbolSnippet=new n("symbol-snippet",{fontCharacter:"\\eb66"}),n.tasklist=new n("tasklist",{fontCharacter:"\\eb67"}),n.telescope=new n("telescope",{fontCharacter:"\\eb68"}),n.textSize=new n("text-size",{fontCharacter:"\\eb69"}),n.threeBars=new n("three-bars",{fontCharacter:"\\eb6a"}),n.thumbsdown=new n("thumbsdown",{fontCharacter:"\\eb6b"}),n.thumbsup=new n("thumbsup",{fontCharacter:"\\eb6c"}),n.tools=new n("tools",{fontCharacter:"\\eb6d"}),n.triangleDown=new n("triangle-down",{fontCharacter:"\\eb6e"}),n.triangleLeft=new n("triangle-left",{fontCharacter:"\\eb6f"}),n.triangleRight=new n("triangle-right",{fontCharacter:"\\eb70"}),n.triangleUp=new n("triangle-up",{fontCharacter:"\\eb71"}),n.twitter=new n("twitter",{fontCharacter:"\\eb72"}),n.unfold=new n("unfold",{fontCharacter:"\\eb73"}),n.unlock=new n("unlock",{fontCharacter:"\\eb74"}),n.unmute=new n("unmute",{fontCharacter:"\\eb75"}),n.unverified=new n("unverified",{fontCharacter:"\\eb76"}),n.verified=new n("verified",{fontCharacter:"\\eb77"}),n.versions=new n("versions",{fontCharacter:"\\eb78"}),n.vmActive=new n("vm-active",{fontCharacter:"\\eb79"}),n.vmOutline=new n("vm-outline",{fontCharacter:"\\eb7a"}),n.vmRunning=new n("vm-running",{fontCharacter:"\\eb7b"}),n.watch=new n("watch",{fontCharacter:"\\eb7c"}),n.whitespace=new n("whitespace",{fontCharacter:"\\eb7d"}),n.wholeWord=new n("whole-word",{fontCharacter:"\\eb7e"}),n.window=new n("window",{fontCharacter:"\\eb7f"}),n.wordWrap=new n("word-wrap",{fontCharacter:"\\eb80"}),n.zoomIn=new n("zoom-in",{fontCharacter:"\\eb81"}),n.zoomOut=new n("zoom-out",{fontCharacter:"\\eb82"}),n.listFilter=new n("list-filter",{fontCharacter:"\\eb83"}),n.listFlat=new n("list-flat",{fontCharacter:"\\eb84"}),n.listSelection=new n("list-selection",{fontCharacter:"\\eb85"}),n.selection=new n("selection",{fontCharacter:"\\eb85"}),n.listTree=new n("list-tree",{fontCharacter:"\\eb86"}),n.debugBreakpointFunctionUnverified=new n("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),n.debugBreakpointFunction=new n("debug-breakpoint-function",{fontCharacter:"\\eb88"}),n.debugBreakpointFunctionDisabled=new n("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),n.debugStackframeActive=new n("debug-stackframe-active",{fontCharacter:"\\eb89"}),n.debugStackframeDot=new n("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),n.debugStackframe=new n("debug-stackframe",{fontCharacter:"\\eb8b"}),n.debugStackframeFocused=new n("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),n.debugBreakpointUnsupported=new n("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),n.symbolString=new n("symbol-string",{fontCharacter:"\\eb8d"}),n.debugReverseContinue=new n("debug-reverse-continue",{fontCharacter:"\\eb8e"}),n.debugStepBack=new n("debug-step-back",{fontCharacter:"\\eb8f"}),n.debugRestartFrame=new n("debug-restart-frame",{fontCharacter:"\\eb90"}),n.callIncoming=new n("call-incoming",{fontCharacter:"\\eb92"}),n.callOutgoing=new n("call-outgoing",{fontCharacter:"\\eb93"}),n.menu=new n("menu",{fontCharacter:"\\eb94"}),n.expandAll=new n("expand-all",{fontCharacter:"\\eb95"}),n.feedback=new n("feedback",{fontCharacter:"\\eb96"}),n.groupByRefType=new n("group-by-ref-type",{fontCharacter:"\\eb97"}),n.ungroupByRefType=new n("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),n.account=new n("account",{fontCharacter:"\\eb99"}),n.bellDot=new n("bell-dot",{fontCharacter:"\\eb9a"}),n.debugConsole=new n("debug-console",{fontCharacter:"\\eb9b"}),n.library=new n("library",{fontCharacter:"\\eb9c"}),n.output=new n("output",{fontCharacter:"\\eb9d"}),n.runAll=new n("run-all",{fontCharacter:"\\eb9e"}),n.syncIgnored=new n("sync-ignored",{fontCharacter:"\\eb9f"}),n.pinned=new n("pinned",{fontCharacter:"\\eba0"}),n.githubInverted=new n("github-inverted",{fontCharacter:"\\eba1"}),n.debugAlt=new n("debug-alt",{fontCharacter:"\\eb91"}),n.serverProcess=new n("server-process",{fontCharacter:"\\eba2"}),n.serverEnvironment=new n("server-environment",{fontCharacter:"\\eba3"}),n.pass=new n("pass",{fontCharacter:"\\eba4"}),n.stopCircle=new n("stop-circle",{fontCharacter:"\\eba5"}),n.playCircle=new n("play-circle",{fontCharacter:"\\eba6"}),n.record=new n("record",{fontCharacter:"\\eba7"}),n.debugAltSmall=new n("debug-alt-small",{fontCharacter:"\\eba8"}),n.vmConnect=new n("vm-connect",{fontCharacter:"\\eba9"}),n.cloud=new n("cloud",{fontCharacter:"\\ebaa"}),n.merge=new n("merge",{fontCharacter:"\\ebab"}),n.exportIcon=new n("export",{fontCharacter:"\\ebac"}),n.graphLeft=new n("graph-left",{fontCharacter:"\\ebad"}),n.magnet=new n("magnet",{fontCharacter:"\\ebae"}),n.notebook=new n("notebook",{fontCharacter:"\\ebaf"}),n.redo=new n("redo",{fontCharacter:"\\ebb0"}),n.checkAll=new n("check-all",{fontCharacter:"\\ebb1"}),n.pinnedDirty=new n("pinned-dirty",{fontCharacter:"\\ebb2"}),n.passFilled=new n("pass-filled",{fontCharacter:"\\ebb3"}),n.circleLargeFilled=new n("circle-large-filled",{fontCharacter:"\\ebb4"}),n.circleLargeOutline=new n("circle-large-outline",{fontCharacter:"\\ebb5"}),n.combine=new n("combine",{fontCharacter:"\\ebb6"}),n.gather=new n("gather",{fontCharacter:"\\ebb6"}),n.table=new n("table",{fontCharacter:"\\ebb7"}),n.variableGroup=new n("variable-group",{fontCharacter:"\\ebb8"}),n.typeHierarchy=new n("type-hierarchy",{fontCharacter:"\\ebb9"}),n.typeHierarchySub=new n("type-hierarchy-sub",{fontCharacter:"\\ebba"}),n.typeHierarchySuper=new n("type-hierarchy-super",{fontCharacter:"\\ebbb"}),n.gitPullRequestCreate=new n("git-pull-request-create",{fontCharacter:"\\ebbc"}),n.runAbove=new n("run-above",{fontCharacter:"\\ebbd"}),n.runBelow=new n("run-below",{fontCharacter:"\\ebbe"}),n.notebookTemplate=new n("notebook-template",{fontCharacter:"\\ebbf"}),n.debugRerun=new n("debug-rerun",{fontCharacter:"\\ebc0"}),n.workspaceTrusted=new n("workspace-trusted",{fontCharacter:"\\ebc1"}),n.workspaceUntrusted=new n("workspace-untrusted",{fontCharacter:"\\ebc2"}),n.workspaceUnspecified=new n("workspace-unspecified",{fontCharacter:"\\ebc3"}),n.terminalCmd=new n("terminal-cmd",{fontCharacter:"\\ebc4"}),n.terminalDebian=new n("terminal-debian",{fontCharacter:"\\ebc5"}),n.terminalLinux=new n("terminal-linux",{fontCharacter:"\\ebc6"}),n.terminalPowershell=new n("terminal-powershell",{fontCharacter:"\\ebc7"}),n.terminalTmux=new n("terminal-tmux",{fontCharacter:"\\ebc8"}),n.terminalUbuntu=new n("terminal-ubuntu",{fontCharacter:"\\ebc9"}),n.terminalBash=new n("terminal-bash",{fontCharacter:"\\ebca"}),n.arrowSwap=new n("arrow-swap",{fontCharacter:"\\ebcb"}),n.copy=new n("copy",{fontCharacter:"\\ebcc"}),n.personAdd=new n("person-add",{fontCharacter:"\\ebcd"}),n.filterFilled=new n("filter-filled",{fontCharacter:"\\ebce"}),n.wand=new n("wand",{fontCharacter:"\\ebcf"}),n.debugLineByLine=new n("debug-line-by-line",{fontCharacter:"\\ebd0"}),n.inspect=new n("inspect",{fontCharacter:"\\ebd1"}),n.layers=new n("layers",{fontCharacter:"\\ebd2"}),n.layersDot=new n("layers-dot",{fontCharacter:"\\ebd3"}),n.layersActive=new n("layers-active",{fontCharacter:"\\ebd4"}),n.compass=new n("compass",{fontCharacter:"\\ebd5"}),n.compassDot=new n("compass-dot",{fontCharacter:"\\ebd6"}),n.compassActive=new n("compass-active",{fontCharacter:"\\ebd7"}),n.azure=new n("azure",{fontCharacter:"\\ebd8"}),n.issueDraft=new n("issue-draft",{fontCharacter:"\\ebd9"}),n.gitPullRequestClosed=new n("git-pull-request-closed",{fontCharacter:"\\ebda"}),n.gitPullRequestDraft=new n("git-pull-request-draft",{fontCharacter:"\\ebdb"}),n.debugAll=new n("debug-all",{fontCharacter:"\\ebdc"}),n.debugCoverage=new n("debug-coverage",{fontCharacter:"\\ebdd"}),n.runErrors=new n("run-errors",{fontCharacter:"\\ebde"}),n.folderLibrary=new n("folder-library",{fontCharacter:"\\ebdf"}),n.debugContinueSmall=new n("debug-continue-small",{fontCharacter:"\\ebe0"}),n.beakerStop=new n("beaker-stop",{fontCharacter:"\\ebe1"}),n.graphLine=new n("graph-line",{fontCharacter:"\\ebe2"}),n.graphScatter=new n("graph-scatter",{fontCharacter:"\\ebe3"}),n.pieChart=new n("pie-chart",{fontCharacter:"\\ebe4"}),n.bracket=new n("bracket",n.json.definition),n.bracketDot=new n("bracket-dot",{fontCharacter:"\\ebe5"}),n.bracketError=new n("bracket-error",{fontCharacter:"\\ebe6"}),n.lockSmall=new n("lock-small",{fontCharacter:"\\ebe7"}),n.azureDevops=new n("azure-devops",{fontCharacter:"\\ebe8"}),n.verifiedFilled=new n("verified-filled",{fontCharacter:"\\ebe9"})}(O||(O={}))},79881:function(mt,me,b){"use strict";b.d(me,{B8:function(){return f},Cp:function(){return D},F0:function(){return m},L6:function(){return y},VV:function(){return O},b1:function(){return n},dL:function(){return K},ri:function(){return w}});class k{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(l){setTimeout(()=>{throw l.stack?new Error(l.message+`
`+l.stack):l},0)}}emit(l){this.listeners.forEach(u=>{u(l)})}onUnexpectedError(l){this.unexpectedErrorHandler(l),this.emit(l)}onUnexpectedExternalError(l){this.unexpectedErrorHandler(l)}}const I=new k;function K(c){O(c)||I.onUnexpectedError(c)}function D(c){O(c)||I.onUnexpectedExternalError(c)}function w(c){if(c instanceof Error){let{name:l,message:u}=c;const p=c.stacktrace||c.stack;return{$isError:!0,name:l,message:u,stack:p}}return c}const _="Canceled";function O(c){return c instanceof Error&&c.name===_&&c.message===_}function m(){const c=new Error(_);return c.name=c.message,c}function n(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(mt,me,b){"use strict";b.d(me,{D0:function(){return f},E7:function(){return c},K3:function(){return y},Q5:function(){return n},ZD:function(){return l},ju:function(){return w}});var k=b(79881),I=b(69323),K=b(34502),D=b(95830),w;(function(u){u.None=()=>I.JT.None;function p(Z){return(B,G=null,W)=>{let R=!1,C;return C=Z(q=>{if(!R)return C?C.dispose():R=!0,B.call(G,q)},null,W),R&&C.dispose(),C}}u.once=p;function E(Z,B){return U((G,W=null,R)=>Z(C=>G.call(W,B(C)),null,R))}u.map=E;function T(Z,B){return U((G,W=null,R)=>Z(C=>{B(C),G.call(W,C)},null,R))}u.forEach=T;function L(Z,B){return U((G,W=null,R)=>Z(C=>B(C)&&G.call(W,C),null,R))}u.filter=L;function x(Z){return Z}u.signal=x;function A(...Z){return(B,G=null,W)=>(0,I.F8)(...Z.map(R=>R(C=>B.call(G,C),null,W)))}u.any=A;function P(Z,B,G){let W=G;return E(Z,R=>(W=B(W,R),W))}u.reduce=P;function U(Z){let B;const G=new n({onFirstListenerAdd(){B=Z(G.fire,G)},onLastListenerRemove(){B.dispose()}});return G.event}function N(Z,B,G=100,W=!1,R){let C,q,re,_e=0;const Le=new n({leakWarningThreshold:R,onFirstListenerAdd(){C=Z(qe=>{_e++,q=B(q,qe),W&&!re&&(Le.fire(q),q=void 0),clearTimeout(re),re=setTimeout(()=>{const be=q;q=void 0,re=void 0,(!W||_e>1)&&Le.fire(be),_e=0},G)})},onLastListenerRemove(){C.dispose()}});return Le.event}u.debounce=N;function H(Z,B=(G,W)=>G===W){let G=!0,W;return L(Z,R=>{const C=G||!B(R,W);return G=!1,W=R,C})}u.latch=H;function F(Z,B){return[u.filter(Z,B),u.filter(Z,G=>!B(G))]}u.split=F;function Y(Z,B=!1,G=[]){let W=G.slice(),R=Z(re=>{W?W.push(re):q.fire(re)});const C=()=>{W&&W.forEach(re=>q.fire(re)),W=null},q=new n({onFirstListenerAdd(){R||(R=Z(re=>q.fire(re)))},onFirstListenerDidAdd(){W&&(B?setTimeout(C):C())},onLastListenerRemove(){R&&R.dispose(),R=null}});return q.event}u.buffer=Y;class V{constructor(B){this.event=B}map(B){return new V(E(this.event,B))}forEach(B){return new V(T(this.event,B))}filter(B){return new V(L(this.event,B))}reduce(B,G){return new V(P(this.event,B,G))}latch(){return new V(H(this.event))}debounce(B,G=100,W=!1,R){return new V(N(this.event,B,G,W,R))}on(B,G,W){return this.event(B,G,W)}once(B,G,W){return p(this.event)(B,G,W)}}function ne(Z){return new V(Z)}u.chain=ne;function ae(Z,B,G=W=>W){const W=(...re)=>q.fire(G(...re)),R=()=>Z.on(B,W),C=()=>Z.removeListener(B,W),q=new n({onFirstListenerAdd:R,onLastListenerRemove:C});return q.event}u.fromNodeEventEmitter=ae;function J(Z,B,G=W=>W){const W=(...re)=>q.fire(G(...re)),R=()=>Z.addEventListener(B,W),C=()=>Z.removeEventListener(B,W),q=new n({onFirstListenerAdd:R,onLastListenerRemove:C});return q.event}u.fromDOMEventEmitter=J;function z(Z){return new Promise(B=>p(Z)(B))}u.toPromise=z})(w||(w={}));class _{constructor(p){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${p}_${_._idPool++}`}start(p){this._stopWatch=new D.G(!0),this._listenerCount=p}stop(){if(this._stopWatch){const p=this._stopWatch.elapsed();this._elapsedOverall+=p,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${p.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}_._idPool=0;let O=-1;class m{constructor(p,E=Math.random().toString(18).slice(2,5)){this.customThreshold=p,this.name=E,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(p){let E=O;if(typeof this.customThreshold=="number"&&(E=this.customThreshold),E<=0||p<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[P,U]of this._stacks)(!x||A<U)&&(x=P,A=U);console.warn(`[${this.name}] potential listener LEAK detected, having ${p} listeners already. MOST frequent listener (${A}):`),console.warn(x)}return()=>{const x=this._stacks.get(T)||0;this._stacks.set(T,x-1)}}}class n{constructor(p){var E;this._disposed=!1,this._options=p,this._leakageMon=O>0?new m(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=(p,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?[p,E]:p);x&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,p,E);const P=(L=this._leakageMon)===null||L===void 0?void 0:L.check(this._listeners.size),U=(0,I.OF)(()=>{P&&P(),this._disposed||(A(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return T instanceof I.SL?T.add(U):Array.isArray(T)&&T.push(U),U}),this._event}fire(p){var E,T;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new K.S);for(let L of this._listeners)this._deliveryQueue.push([L,p]);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,k.dL)(A)}}(T=this._perfMon)===null||T===void 0||T.stop()}}dispose(){var p,E,T,L,x;this._disposed||(this._disposed=!0,(p=this._listeners)===null||p===void 0||p.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 n{constructor(p){super(p),this._isPaused=0,this._eventQueue=new K.S,this._mergeFn=p==null?void 0:p.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const p=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(p))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(p){this._listeners&&(this._isPaused!==0?this._eventQueue.push(p):super.fire(p))}}class f extends y{constructor(p){var E;super(p),this._delay=(E=p.delay)!==null&&E!==void 0?E:100}fire(p){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(p)}}class c{constructor(){this.buffers=[]}wrapEvent(p){return(E,T,L)=>p(x=>{const A=this.buffers[this.buffers.length-1];A?A.push(()=>E.call(T,x)):E.call(T,x)},void 0,L)}bufferEvents(p){const E=[];this.buffers.push(E);const T=p();return this.buffers.pop(),E.forEach(L=>L()),T}}class l{constructor(){this.listening=!1,this.inputEvent=w.None,this.inputEventListener=I.JT.None,this.emitter=new n({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(p){this.inputEvent=p,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=p(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(mt,me,b){"use strict";b.d(me,{I:function(){return k}});function k(I){const K=this;let D=!1,w;return function(){return D||(D=!0,w=I.apply(K,arguments)),w}}},88226:function(mt,me,b){"use strict";b.d(me,{$:function(){return k}});var k;(function(I){function K(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}I.is=K;const D=Object.freeze([]);function w(){return D}I.empty=w;function*_(A){yield A}I.single=_;function O(A){return A||D}I.from=O;function m(A){return!A||A[Symbol.iterator]().next().done===!0}I.isEmpty=m;function n(A){return A[Symbol.iterator]().next().value}I.first=n;function y(A,P){for(const U of A)if(P(U))return!0;return!1}I.some=y;function f(A,P){for(const U of A)if(P(U))return U}I.find=f;function*c(A,P){for(const U of A)P(U)&&(yield U)}I.filter=c;function*l(A,P){let U=0;for(const N of A)yield P(N,U++)}I.map=l;function*u(...A){for(const P of A)for(const U of P)yield U}I.concat=u;function*p(A){for(const P of A)for(const U of P)yield U}I.concatNested=p;function E(A,P,U){let N=U;for(const H of A)N=P(N,H);return N}I.reduce=E;function*T(A,P,U=A.length){for(P<0&&(P+=A.length),U<0?U+=A.length:U>A.length&&(U=A.length);P<U;P++)yield A[P]}I.slice=T;function L(A,P=Number.POSITIVE_INFINITY){const U=[];if(P===0)return[U,A];const N=A[Symbol.iterator]();for(let H=0;H<P;H++){const F=N.next();if(F.done)return[U,I.empty()];U.push(F.value)}return[U,{[Symbol.iterator](){return N}}]}I.consume=L;function x(A,P,U=(N,H)=>N===H){const N=A[Symbol.iterator](),H=P[Symbol.iterator]();for(;;){const F=N.next(),Y=H.next();if(F.done!==Y.done)return!1;if(F.done)return!0;if(!U(F.value,Y.value))return!1}}I.equals=x})(k||(k={}))},69323:function(mt,me,b){"use strict";b.d(me,{B9:function(){return l},F8:function(){return u},JT:function(){return T},Jz:function(){return x},OF:function(){return p},SL:function(){return E},Wf:function(){return c},XK:function(){return L},dk:function(){return y}});var k=b(17845),I=b(88226);const K=!1;let D=null;function w(A){D=A}if(K){const A="__is_disposable_tracked__";w(new class{trackDisposable(P){const U=new Error("Potentially leaked disposable").stack;setTimeout(()=>{P[A]||console.log(U)},3e3)}setParent(P,U){if(P&&P!==T.None)try{P[A]=!0}catch(N){}}markAsDisposed(P){if(P&&P!==T.None)try{P[A]=!0}catch(U){}}markAsSingleton(P){}})}function _(A){return D==null||D.trackDisposable(A),A}function O(A){D==null||D.markAsDisposed(A)}function m(A,P){D==null||D.setParent(A,P)}function n(A,P){if(D)for(const U of A)D.setParent(U,P)}function y(A){return D==null||D.markAsSingleton(A),A}class f extends Error{constructor(P){super(`Encountered errors while disposing of store. Errors: [${P.join(", ")}]`),this.errors=P}}function c(A){return typeof A.dispose=="function"&&A.dispose.length===0}function l(A){if(I.$.is(A)){let P=[];for(const U of A)if(U)try{U.dispose()}catch(N){P.push(N)}if(P.length===1)throw P[0];if(P.length>1)throw new f(P);return Array.isArray(A)?[]:A}else if(A)return A.dispose(),A}function u(...A){const P=p(()=>l(A));return n(A,P),P}function p(A){const P=_({dispose:(0,k.I)(()=>{O(P),A()})});return P}class E{constructor(){this._toDispose=new Set,this._isDisposed=!1,_(this)}dispose(){this._isDisposed||(O(this),this._isDisposed=!0,this.clear())}clear(){try{l(this._toDispose.values())}finally{this._toDispose.clear()}}add(P){if(!P)return P;if(P===this)throw new Error("Cannot register a disposable on itself!");return m(P,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(P),P}}E.DISABLE_DISPOSED_WARNING=!1;class T{constructor(){this._store=new E,_(this),m(this._store,this)}dispose(){O(this),this._store.dispose()}_register(P){if(P===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(P)}}T.None=Object.freeze({dispose(){}});class L{constructor(){this._isDisposed=!1,_(this)}get value(){return this._isDisposed?void 0:this._value}set value(P){var U;this._isDisposed||P===this._value||((U=this._value)===null||U===void 0||U.dispose(),P&&m(P,this),this._value=P)}clear(){this.value=void 0}dispose(){var P;this._isDisposed=!0,O(this),(P=this._value)===null||P===void 0||P.dispose(),this._value=void 0}clearAndLeak(){const P=this._value;return this._value=void 0,P&&m(P,null),P}}class x{constructor(P){this.object=P}dispose(){}}},34502:function(mt,me,b){"use strict";b.d(me,{S:function(){return I}});class k{constructor(D){this.element=D,this.next=k.Undefined,this.prev=k.Undefined}}k.Undefined=new k(void 0);class I{constructor(){this._first=k.Undefined,this._last=k.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===k.Undefined}clear(){let D=this._first;for(;D!==k.Undefined;){const w=D.next;D.prev=k.Undefined,D.next=k.Undefined,D=w}this._first=k.Undefined,this._last=k.Undefined,this._size=0}unshift(D){return this._insert(D,!1)}push(D){return this._insert(D,!0)}_insert(D,w){const _=new k(D);if(this._first===k.Undefined)this._first=_,this._last=_;else if(w){const m=this._last;this._last=_,_.prev=m,m.next=_}else{const m=this._first;this._first=_,_.next=m,m.prev=_}this._size+=1;let O=!1;return()=>{O||(O=!0,this._remove(_))}}shift(){if(this._first!==k.Undefined){const D=this._first.element;return this._remove(this._first),D}}pop(){if(this._last!==k.Undefined){const D=this._last.element;return this._remove(this._last),D}}_remove(D){if(D.prev!==k.Undefined&&D.next!==k.Undefined){const w=D.prev;w.next=D.next,D.next.prev=w}else D.prev===k.Undefined&&D.next===k.Undefined?(this._first=k.Undefined,this._last=k.Undefined):D.next===k.Undefined?(this._last=this._last.prev,this._last.next=k.Undefined):D.prev===k.Undefined&&(this._first=this._first.next,this._first.prev=k.Undefined);this._size-=1}*[Symbol.iterator](){let D=this._first;for(;D!==k.Undefined;)yield D.element,D=D.next}}},23345:function(mt,me,b){"use strict";b.d(me,{$L:function(){return N},ED:function(){return x},IJ:function(){return P},OS:function(){return V},WE:function(){return F},dz:function(){return A},gn:function(){return H},li:function(){return p},r:function(){return J},tY:function(){return U},xS:function(){return Y}});var k=b(97671),I;const K="en";let D=!1,w=!1,_=!1,O=!1,m=!1,n=!1,y=!1,f,c=null,l=null,u;const p=typeof self=="object"?self:typeof b.g=="object"?b.g:{};let E;typeof p.vscode!="undefined"&&typeof p.vscode.process!="undefined"?E=p.vscode.process:typeof k!="undefined"&&(E=k);const T=typeof((I=E==null?void 0:E.versions)===null||I===void 0?void 0:I.electron)=="string"&&E.type==="renderer";if(typeof navigator=="object"&&!T)u=navigator.userAgent,D=u.indexOf("Windows")>=0,w=u.indexOf("Macintosh")>=0,y=(u.indexOf("Macintosh")>=0||u.indexOf("iPad")>=0||u.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_=u.indexOf("Linux")>=0,n=!0,f=navigator.language,c=f;else if(typeof E=="object"){D=E.platform==="win32",w=E.platform==="darwin",_=E.platform==="linux",O=_&&!!E.env.SNAP&&!!E.env.SNAP_REVISION,f=K,c=K;const z=E.env.VSCODE_NLS_CONFIG;if(z)try{const Z=JSON.parse(z),B=Z.availableLanguages["*"];f=Z.locale,c=B||K,l=Z._translationsConfigFile}catch(Z){}m=!0}else console.error("Unable to resolve platform.");let L=0;w?L=1:D?L=3:_&&(L=2);const x=D,A=w,P=_,U=m,N=n,H=y,F=u,Y=function(){if(p.setImmediate)return p.setImmediate.bind(p);if(typeof p.postMessage=="function"&&!p.importScripts){let B=[];p.addEventListener("message",W=>{if(W.data&&W.data.vscodeSetImmediateId)for(let R=0,C=B.length;R<C;R++){const q=B[R];if(q.id===W.data.vscodeSetImmediateId){B.splice(R,1),q.callback();return}}});let G=0;return W=>{const R=++G;B.push({id:R,callback:W}),p.postMessage({vscodeSetImmediateId:R},"*")}}if(typeof(E==null?void 0:E.nextTick)=="function")return E.nextTick.bind(E);const Z=Promise.resolve();return B=>Z.then(B)}(),V=w||y?2:D?1:3;let ne=!0,ae=!1;function J(){if(!ae){ae=!0;const z=new Uint8Array(2);z[0]=1,z[1]=2,ne=new Uint16Array(z.buffer)[0]===513}return ne}},95830:function(mt,me,b){"use strict";b.d(me,{G:function(){return K}});var k=b(23345);const I=k.li.performance&&typeof k.li.performance.now=="function";class K{constructor(w){this._highResolution=I&&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?k.li.performance.now():Date.now()}}},82983:function(mt,me,b){"use strict";b.d(me,{$i:function(){return _e},C8:function(){return Me},GF:function(){return f},HO:function(){return G},IO:function(){return c},K7:function(){return je},Kw:function(){return We},LC:function(){return p},Mh:function(){return Y},P1:function(){return V},PJ:function(){return lt},Qe:function(){return Le},R1:function(){return y},RP:function(){return q},S6:function(){return He},TT:function(){return x},Ut:function(){return R},V8:function(){return E},WU:function(){return K},YK:function(){return ae},YU:function(){return D},ZG:function(){return ne},ZH:function(){return z},ab:function(){return qe},c1:function(){return Oe},df:function(){return N},ec:function(){return w},fi:function(){return vt},fy:function(){return _},j3:function(){return O},j_:function(){return P},m5:function(){return k},mK:function(){return U},mr:function(){return l},oH:function(){return le},oL:function(){return m},ok:function(){return F},ow:function(){return T},qq:function(){return H},qu:function(){return L},rL:function(){return J},uS:function(){return wt},un:function(){return n},uq:function(){return u},vH:function(){return B},xe:function(){return be},zY:function(){return A}});function k(ie){return!ie||typeof ie!="string"?!0:ie.trim().length===0}const I=/{(\d+)}/g;function K(ie,...he){return he.length===0?ie:ie.replace(I,function(Te,Ie){const de=parseInt(Ie,10);return isNaN(de)||de<0||de>=he.length?Te:he[de]})}function D(ie){return ie.replace(/[<>&]/g,function(he){switch(he){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return he}})}function w(ie){return ie.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function _(ie,he=" "){const Te=O(ie,he);return m(Te,he)}function O(ie,he){if(!ie||!he)return ie;const Te=he.length;if(Te===0||ie.length===0)return ie;let Ie=0;for(;ie.indexOf(he,Ie)===Ie;)Ie=Ie+Te;return ie.substring(Ie)}function m(ie,he){if(!ie||!he)return ie;const Te=he.length,Ie=ie.length;if(Te===0||Ie===0)return ie;let de=Ie,Be=-1;for(;Be=ie.lastIndexOf(he,de-1),!(Be===-1||Be+Te!==de);){if(Be===0)return"";de=Be}return ie.substring(0,de)}function n(ie){return ie.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function y(ie){return ie.replace(/\*/g,"")}function f(ie,he,Te={}){if(!ie)throw new Error("Cannot create regex from empty string");he||(ie=w(ie)),Te.wholeWord&&(/\B/.test(ie.charAt(0))||(ie="\\b"+ie),/\B/.test(ie.charAt(ie.length-1))||(ie=ie+"\\b"));let Ie="";return Te.global&&(Ie+="g"),Te.matchCase||(Ie+="i"),Te.multiline&&(Ie+="m"),Te.unicode&&(Ie+="u"),new RegExp(ie,Ie)}function c(ie){return ie.source==="^"||ie.source==="^$"||ie.source==="$"||ie.source==="^\\s*$"?!1:!!(ie.exec("")&&ie.lastIndex===0)}function l(ie){return(ie.global?"g":"")+(ie.ignoreCase?"i":"")+(ie.multiline?"m":"")+(ie.unicode?"u":"")}function u(ie){return ie.split(/\r\n|\r|\n/)}function p(ie){for(let he=0,Te=ie.length;he<Te;he++){const Ie=ie.charCodeAt(he);if(Ie!==32&&Ie!==9)return he}return-1}function E(ie,he=0,Te=ie.length){for(let Ie=he;Ie<Te;Ie++){const de=ie.charCodeAt(Ie);if(de!==32&&de!==9)return ie.substring(he,Ie)}return ie.substring(he,Te)}function T(ie,he=ie.length-1){for(let Te=he;Te>=0;Te--){const Ie=ie.charCodeAt(Te);if(Ie!==32&&Ie!==9)return Te}return-1}function L(ie,he){return ie<he?-1:ie>he?1:0}function x(ie,he,Te=0,Ie=ie.length,de=0,Be=he.length){for(;Te<Ie&&de<Be;Te++,de++){let Ye=ie.charCodeAt(Te),$e=he.charCodeAt(de);if(Ye<$e)return-1;if(Ye>$e)return 1}const Ge=Ie-Te,Ne=Be-de;return Ge<Ne?-1:Ge>Ne?1:0}function A(ie,he){return P(ie,he,0,ie.length,0,he.length)}function P(ie,he,Te=0,Ie=ie.length,de=0,Be=he.length){for(;Te<Ie&&de<Be;Te++,de++){let Ye=ie.charCodeAt(Te),$e=he.charCodeAt(de);if(Ye===$e)continue;if(Ye>=128||$e>=128)return x(ie.toLowerCase(),he.toLowerCase(),Te,Ie,de,Be);U(Ye)&&(Ye-=32),U($e)&&($e-=32);const st=Ye-$e;if(st!==0)return st}const Ge=Ie-Te,Ne=Be-de;return Ge<Ne?-1:Ge>Ne?1:0}function U(ie){return ie>=97&&ie<=122}function N(ie){return ie>=65&&ie<=90}function H(ie,he){return ie.length===he.length&&P(ie,he)===0}function F(ie,he){const Te=he.length;return he.length>ie.length?!1:P(ie,he,0,Te)===0}function Y(ie,he){let Te,Ie=Math.min(ie.length,he.length);for(Te=0;Te<Ie;Te++)if(ie.charCodeAt(Te)!==he.charCodeAt(Te))return Te;return Ie}function V(ie,he){let Te,Ie=Math.min(ie.length,he.length);const de=ie.length-1,Be=he.length-1;for(Te=0;Te<Ie;Te++)if(ie.charCodeAt(de-Te)!==he.charCodeAt(Be-Te))return Te;return Ie}function ne(ie){return 55296<=ie&&ie<=56319}function ae(ie){return 56320<=ie&&ie<=57343}function J(ie,he){return(ie-55296<<10)+(he-56320)+65536}function z(ie,he,Te){const Ie=ie.charCodeAt(Te);if(ne(Ie)&&Te+1<he){const de=ie.charCodeAt(Te+1);if(ae(de))return J(Ie,de)}return Ie}function Z(ie,he){const Te=ie.charCodeAt(he-1);if(ae(Te)&&he>1){const Ie=ie.charCodeAt(he-2);if(ne(Ie))return J(Ie,Te)}return Te}function B(ie,he){const Te=Ee.getInstance(),Ie=he,de=ie.length,Be=z(ie,de,he);he+=Be>=65536?2:1;let Ge=Te.getGraphemeBreakType(Be);for(;he<de;){const Ne=z(ie,de,he),Ye=Te.getGraphemeBreakType(Ne);if(vt(Ge,Ye))break;he+=Ne>=65536?2:1,Ge=Ye}return he-Ie}function G(ie,he){const Te=Ee.getInstance(),Ie=he,de=Z(ie,he);he-=de>=65536?2:1;let Be=Te.getGraphemeBreakType(de);for(;he>0;){const Ge=Z(ie,he),Ne=Te.getGraphemeBreakType(Ge);if(vt(Ne,Be))break;he-=Ge>=65536?2:1,Be=Ne}return Ie-he}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 R(ie){return W.test(ie)}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 q(ie){return C.test(ie)}const re=/^[\t\n\r\x20-\x7E]*$/;function _e(ie){return re.test(ie)}const Le=/[\u2028\u2029]/;function qe(ie){return Le.test(ie)}function be(ie){for(let he=0,Te=ie.length;he<Te;he++)if(je(ie.charCodeAt(he)))return!0;return!1}function je(ie){return ie=+ie,ie>=11904&&ie<=55215||ie>=63744&&ie<=64255||ie>=65281&&ie<=65374}function Me(ie){return ie>=127462&&ie<=127487||ie===8986||ie===8987||ie===9200||ie===9203||ie>=9728&&ie<=10175||ie===11088||ie===11093||ie>=127744&&ie<=128591||ie>=128640&&ie<=128764||ie>=128992&&ie<=129003||ie>=129280&&ie<=129535||ie>=129648&&ie<=129750}const Oe="\uFEFF";function wt(ie){return!!(ie&&ie.length>0&&ie.charCodeAt(0)===65279)}function We(ie,he=!1){return ie?(he&&(ie=ie.replace(/\\./g,"")),ie.toLowerCase()!==ie):!1}function lt(ie){return ie=ie%(2*26),ie<26?String.fromCharCode(97+ie):String.fromCharCode(65+ie-26)}function He(ie){return Ee.getInstance().getGraphemeBreakType(ie)}function vt(ie,he){return ie===0?he!==5&&he!==7:ie===2&&he===3?!1:ie===4||ie===2||ie===3||he===4||he===2||he===3?!0:!(ie===8&&(he===8||he===9||he===11||he===12)||(ie===11||ie===9)&&(he===9||he===10)||(ie===12||ie===10)&&he===10||he===5||he===13||he===7||ie===1||ie===13&&he===14||ie===6&&he===6)}class Ee{constructor(){this._data=we()}static getInstance(){return Ee._INSTANCE||(Ee._INSTANCE=new Ee),Ee._INSTANCE}getGraphemeBreakType(he){if(he<32)return he===10?3:he===13?2:4;if(he<127)return 0;const Te=this._data,Ie=Te.length/3;let de=1;for(;de<=Ie;)if(he<Te[3*de])de=2*de;else if(he>Te[3*de+1])de=2*de+1;else return Te[3*de+2];return 0}}Ee._INSTANCE=null;function we(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function le(ie,he){if(ie===0)return 0;const Te=Re(ie,he);if(Te!==void 0)return Te;const Ie=Z(he,ie);return ie-=Fe(Ie),ie}function Re(ie,he){let Te=Z(he,ie);for(ie-=Fe(Te);Ke(Te)||Te===65039||Te===8419;){if(ie===0)return;Te=Z(he,ie),ie-=Fe(Te)}if(Me(Te)){if(ie>=0){const Ie=Z(he,ie);Ie===8205&&(ie-=Fe(Ie))}return ie}}function Fe(ie){return ie>=65536?2:1}function Ke(ie){return 127995<=ie&&ie<=127999}},72999:function(mt,me,b){"use strict";b.d(me,{$E:function(){return p},$K:function(){return O},D8:function(){return c},HD:function(){return I},IU:function(){return E},Jp:function(){return m},Kn:function(){return K},cW:function(){return y},f6:function(){return T},hj:function(){return D},jn:function(){return w},kJ:function(){return k},mf:function(){return f},o8:function(){return _},p_:function(){return n},vE:function(){return L}});function k(x){return Array.isArray(x)}function I(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 O(x){return!m(x)}function m(x){return _(x)||x===null}function n(x,A){if(!x)throw new Error(A?`Unexpected type, expected '${A}'`:"Unexpected type")}function y(x){if(m(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 P=Math.min(x.length,A.length);for(let U=0;U<P;U++)l(x[U],A[U])}function l(x,A){if(I(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(P){}if(!m(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 u(x){let A=[],P=Object.getPrototypeOf(x);for(;Object.prototype!==P;)A=A.concat(Object.getOwnPropertyNames(P)),P=Object.getPrototypeOf(P);return A}function p(x){const A=[];for(const P of u(x))typeof x[P]=="function"&&A.push(P);return A}function E(x,A){const P=N=>function(){const H=Array.prototype.slice.call(arguments,0);return A(N,H)};let U={};for(const N of x)U[N]=P(N);return U}function T(x){return x===null?void 0:x}function L(x,A="Unreachable"){throw new Error(A)}},13268:function(mt,me,b){"use strict";b.d(me,{N:function(){return I}});function k(K,D){let w;return D.length===0?w=K:w=K.replace(/\{(\d+)\}/g,function(_,O){const m=O[0];return typeof D[m]!="undefined"?D[m]:_}),w}function I(K,D,...w){return k(D,w)}},96236:function(mt,me,b){"use strict";b.d(me,{BH:function(){return E},NZ:function(){return T},U8:function(){return L},co:function(){return p},eH:function(){return u},vr:function(){return l}});var k=b(75918),I=b(52615),K=b(4348),D=b(88226),w=b(69323),_=b(34502),O=b(35884),m=b(90689),n=b(16925),y=b(49055),f=function(x,A,P,U){var N=arguments.length,H=N<3?A:U===null?U=Object.getOwnPropertyDescriptor(A,P):U,F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(x,A,P,U);else for(var Y=x.length-1;Y>=0;Y--)(F=x[Y])&&(H=(N<3?F(H):N>3?F(A,P,H):F(A,P))||H);return N>3&&H&&Object.defineProperty(A,P,H),H},c=function(x,A){return function(P,U){A(P,U,x)}};function l(x){return x.command!==void 0}class u{constructor(A){this.id=u._idPool++,this._debugName=A}}u._idPool=0,u.CommandPalette=new u("CommandPalette"),u.EditorContext=new u("EditorContext"),u.SimpleEditorContext=new u("SimpleEditorContext"),u.EditorContextCopy=new u("EditorContextCopy"),u.EditorContextPeek=new u("EditorContextPeek"),u.MenubarEditMenu=new u("MenubarEditMenu"),u.MenubarCopy=new u("MenubarCopy"),u.MenubarGoMenu=new u("MenubarGoMenu"),u.MenubarSelectionMenu=new u("MenubarSelectionMenu"),u.InlineCompletionsActions=new u("InlineCompletionsActions");const p=(0,n.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===u.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 P of x)A=this._commands.delete(P.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,P)=>x.set(P,A)),x}appendMenuItem(x,A){return this.appendMenuItems(D.$.single({id:x,item:A}))}appendMenuItems(x){const A=new Set,P=new _.S;for(const{id:U,item:N}of x){let H=this._menuItems.get(U);H||(H=new _.S,this._menuItems.set(U,H)),P.push(H.push(N)),A.add(U)}return this._onDidChangeMenu.fire(A),(0,w.OF)(()=>{if(P.size>0){for(let U of P)U();this._onDidChangeMenu.fire(A),P.clear()}})}getMenuItems(x){let A;return this._menuItems.has(x)?A=[...this._menuItems.get(x)]:A=[],x===u.CommandPalette&&this._appendImplicitItems(A),A}_appendImplicitItems(x){const A=new Set;for(const P of x)l(P)&&(A.add(P.command.id),P.alt&&A.add(P.alt.id));this._commands.forEach((P,U)=>{A.has(U)||x.push({command:P})})}};class T extends k.wY{constructor(A,P,U,N){super(`submenuitem.${A.submenu.id}`,typeof A.title=="string"?A.title:A.title.value,[],"submenu"),this.item=A,this._menuService=P,this._contextKeyService=U,this._options=N}get actions(){const A=[],P=this._menuService.createMenu(this.item.submenu,this._contextKeyService),U=P.getActions(this._options);P.dispose();for(const[,N]of U)N.length>0&&(A.push(...N),A.push(new k.Z0));return A.length&&A.pop(),A}}let L=class Uo{constructor(A,P,U,N,H){var F,Y;if(this._commandService=H,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=(Y=typeof A.tooltip=="string"?A.tooltip:(F=A.tooltip)===null||F===void 0?void 0:F.value)!==null&&Y!==void 0?Y:"",this.enabled=!A.precondition||N.contextMatchesRules(A.precondition),this.checked=void 0,A.toggled){const V=A.toggled.condition?A.toggled:{condition:A.toggled};this.checked=N.contextMatchesRules(V.condition),this.checked&&V.tooltip&&(this.tooltip=typeof V.tooltip=="string"?V.tooltip:V.tooltip.value),V.title&&(this.label=typeof V.title=="string"?V.title:V.title.value)}this.item=A,this.alt=P?new Uo(P,void 0,U,N,H):void 0,this._options=U,y.kS.isThemeIcon(A.icon)&&(this.class=I.dT.asClassName(A.icon))}dispose(){}run(...A){var P,U;let N=[];return!((P=this._options)===null||P===void 0)&&P.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,m.i6),c(4,O.H)],L)},35884:function(mt,me,b){"use strict";b.d(me,{H:function(){return O},P:function(){return m}});var k=b(4348),I=b(88226),K=b(69323),D=b(34502),w=b(72999),_=b(16925);const O=(0,_.yh)("commandService"),m=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new k.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(n,y){if(!n)throw new Error("invalid command");if(typeof n=="string"){if(!y)throw new Error("invalid command");return this.registerCommand({id:n,handler:y})}if(n.description){const p=[];for(let T of n.description.args)p.push(T.constraint);const E=n.handler;n.handler=function(T,...L){return(0,w.D8)(L,p),E(T,...L)}}const{id:f}=n;let c=this._commands.get(f);c||(c=new D.S,this._commands.set(f,c));let l=c.unshift(n),u=(0,K.OF)(()=>{l();const p=this._commands.get(f);p!=null&&p.isEmpty()&&this._commands.delete(f)});return this._onDidRegisterCommand.fire(f),u}registerCommandAlias(n,y){return m.registerCommand(n,(f,...c)=>f.get(O).executeCommand(y,...c))}getCommand(n){const y=this._commands.get(n);if(!(!y||y.isEmpty()))return I.$.first(y)}getCommands(){const n=new Map;for(const y of this._commands.keys()){const f=this.getCommand(y);f&&n.set(y,f)}return n}};m.registerCommand("noop",()=>{})},90689:function(mt,me,b){"use strict";b.d(me,{Ao:function(){return O},Eq:function(){return J},Fb:function(){return m},K8:function(){return B},i6:function(){return ae},uy:function(){return ne}});var k=b(23345),I=b(82983),K=b(16925);let D=k.WE||"";const w=new Map;w.set("false",!1),w.set("true",!0),w.set("isMac",k.dz),w.set("isLinux",k.IJ),w.set("isWindows",k.ED),w.set("isWeb",k.$L),w.set("isMacNative",k.dz&&!k.$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 O{static has(R){return c.create(R)}static equals(R,C){return l.create(R,C)}static regex(R,C){return N.create(R,C)}static not(R){return T.create(R)}static and(...R){return Y.create(R,null)}static or(...R){return V.create(R,null,!0)}static deserialize(R,C=!1){if(R)return this._deserializeOrExpression(R,C)}static _deserializeOrExpression(R,C){let q=R.split("||");return V.create(q.map(re=>this._deserializeAndExpression(re,C)),null,!0)}static _deserializeAndExpression(R,C){let q=R.split("&&");return Y.create(q.map(re=>this._deserializeOne(re,C)),null)}static _deserializeOne(R,C){if(R=R.trim(),R.indexOf("!=")>=0){let q=R.split("!=");return E.create(q[0].trim(),this._deserializeValue(q[1],C))}if(R.indexOf("==")>=0){let q=R.split("==");return l.create(q[0].trim(),this._deserializeValue(q[1],C))}if(R.indexOf("=~")>=0){let q=R.split("=~");return N.create(q[0].trim(),this._deserializeRegexValue(q[1],C))}if(R.indexOf(" in ")>=0){let q=R.split(" in ");return u.create(q[0].trim(),q[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(R)){const q=R.split(">=");return A.create(q[0].trim(),q[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(R)){const q=R.split(">");return x.create(q[0].trim(),q[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(R)){const q=R.split("<=");return U.create(q[0].trim(),q[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(R)){const q=R.split("<");return P.create(q[0].trim(),q[1].trim())}return/^\!\s*/.test(R)?T.create(R.substr(1).trim()):c.create(R)}static _deserializeValue(R,C){if(R=R.trim(),R==="true")return!0;if(R==="false")return!1;let q=/^'([^']*)'$/.exec(R);return q?q[1].trim():R}static _deserializeRegexValue(R,C){if((0,I.m5)(R)){if(C)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let q=R.indexOf("/"),re=R.lastIndexOf("/");if(q===re||q<0){if(C)throw new Error(`bad regexp-value '${R}', missing /-enclosure`);return console.warn(`bad regexp-value '${R}', missing /-enclosure`),null}let _e=R.slice(q+1,re),Le=R[re+1]==="i"?"i":"";try{return new RegExp(_e,Le)}catch(qe){if(C)throw new Error(`bad regexp-value '${R}', parse error: ${qe}`);return console.warn(`bad regexp-value '${R}', parse error: ${qe}`),null}}}function m(W,R){const C=W?W.substituteConstants():void 0,q=R?R.substituteConstants():void 0;return!C&&!q?!0:!C||!q?!1:C.equals(q)}function n(W,R){return W.cmp(R)}class y{constructor(){this.type=0}cmp(R){return this.type-R.type}equals(R){return R.type===this.type}substituteConstants(){return this}evaluate(R){return!1}serialize(){return"false"}keys(){return[]}negate(){return f.INSTANCE}}y.INSTANCE=new y;class f{constructor(){this.type=1}cmp(R){return this.type-R.type}equals(R){return R.type===this.type}substituteConstants(){return this}evaluate(R){return!0}serialize(){return"true"}keys(){return[]}negate(){return y.INSTANCE}}f.INSTANCE=new f;class c{constructor(R,C){this.key=R,this.negated=C,this.type=2}static create(R,C=null){const q=w.get(R);return typeof q=="boolean"?q?f.INSTANCE:y.INSTANCE:new c(R,C)}cmp(R){return R.type!==this.type?this.type-R.type:z(this.key,R.key)}equals(R){return R.type===this.type?this.key===R.key:!1}substituteConstants(){const R=w.get(this.key);return typeof R=="boolean"?R?f.INSTANCE:y.INSTANCE:this}evaluate(R){return!!R.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(R,C,q){this.key=R,this.value=C,this.negated=q,this.type=4}static create(R,C,q=null){if(typeof C=="boolean")return C?c.create(R,q):T.create(R,q);const re=w.get(R);return typeof re=="boolean"?C===(re?"true":"false")?f.INSTANCE:y.INSTANCE:new l(R,C,q)}cmp(R){return R.type!==this.type?this.type-R.type:Z(this.key,this.value,R.key,R.value)}equals(R){return R.type===this.type?this.key===R.key&&this.value===R.value:!1}substituteConstants(){const R=w.get(this.key);if(typeof R=="boolean"){const C=R?"true":"false";return this.value===C?f.INSTANCE:y.INSTANCE}return this}evaluate(R){return R.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 u{constructor(R,C){this.key=R,this.valueKey=C,this.type=10,this.negated=null}static create(R,C){return new u(R,C)}cmp(R){return R.type!==this.type?this.type-R.type:Z(this.key,this.valueKey,R.key,R.valueKey)}equals(R){return R.type===this.type?this.key===R.key&&this.valueKey===R.valueKey:!1}substituteConstants(){return this}evaluate(R){const C=R.getValue(this.valueKey),q=R.getValue(this.key);return Array.isArray(C)?C.indexOf(q)>=0:typeof q=="string"&&typeof C=="object"&&C!==null?_.call(C,q):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=p.create(this)),this.negated}}class p{constructor(R){this._actual=R,this.type=11}static create(R){return new p(R)}cmp(R){return R.type!==this.type?this.type-R.type:this._actual.cmp(R._actual)}equals(R){return R.type===this.type?this._actual.equals(R._actual):!1}substituteConstants(){return this}evaluate(R){return!this._actual.evaluate(R)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class E{constructor(R,C,q){this.key=R,this.value=C,this.negated=q,this.type=5}static create(R,C,q=null){if(typeof C=="boolean")return C?T.create(R,q):c.create(R,q);const re=w.get(R);return typeof re=="boolean"?C===(re?"true":"false")?y.INSTANCE:f.INSTANCE:new E(R,C,q)}cmp(R){return R.type!==this.type?this.type-R.type:Z(this.key,this.value,R.key,R.value)}equals(R){return R.type===this.type?this.key===R.key&&this.value===R.value:!1}substituteConstants(){const R=w.get(this.key);if(typeof R=="boolean"){const C=R?"true":"false";return this.value===C?y.INSTANCE:f.INSTANCE}return this}evaluate(R){return R.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(R,C){this.key=R,this.negated=C,this.type=3}static create(R,C=null){const q=w.get(R);return typeof q=="boolean"?q?y.INSTANCE:f.INSTANCE:new T(R,C)}cmp(R){return R.type!==this.type?this.type-R.type:z(this.key,R.key)}equals(R){return R.type===this.type?this.key===R.key:!1}substituteConstants(){const R=w.get(this.key);return typeof R=="boolean"?R?y.INSTANCE:f.INSTANCE:this}evaluate(R){return!R.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,R){if(typeof W=="string"){const C=parseFloat(W);isNaN(C)||(W=C)}return typeof W=="string"||typeof W=="number"?R(W):y.INSTANCE}class x{constructor(R,C,q){this.key=R,this.value=C,this.negated=q,this.type=12}static create(R,C,q=null){return L(C,re=>new x(R,re,q))}cmp(R){return R.type!==this.type?this.type-R.type:Z(this.key,this.value,R.key,R.value)}equals(R){return R.type===this.type?this.key===R.key&&this.value===R.value:!1}substituteConstants(){return this}evaluate(R){return typeof this.value=="string"?!1:parseFloat(R.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(R,C,q){this.key=R,this.value=C,this.negated=q,this.type=13}static create(R,C,q=null){return L(C,re=>new A(R,re,q))}cmp(R){return R.type!==this.type?this.type-R.type:Z(this.key,this.value,R.key,R.value)}equals(R){return R.type===this.type?this.key===R.key&&this.value===R.value:!1}substituteConstants(){return this}evaluate(R){return typeof this.value=="string"?!1:parseFloat(R.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=P.create(this.key,this.value,this)),this.negated}}class P{constructor(R,C,q){this.key=R,this.value=C,this.negated=q,this.type=14}static create(R,C,q=null){return L(C,re=>new P(R,re,q))}cmp(R){return R.type!==this.type?this.type-R.type:Z(this.key,this.value,R.key,R.value)}equals(R){return R.type===this.type?this.key===R.key&&this.value===R.value:!1}substituteConstants(){return this}evaluate(R){return typeof this.value=="string"?!1:parseFloat(R.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(R,C,q){this.key=R,this.value=C,this.negated=q,this.type=15}static create(R,C,q=null){return L(C,re=>new U(R,re,q))}cmp(R){return R.type!==this.type?this.type-R.type:Z(this.key,this.value,R.key,R.value)}equals(R){return R.type===this.type?this.key===R.key&&this.value===R.value:!1}substituteConstants(){return this}evaluate(R){return typeof this.value=="string"?!1:parseFloat(R.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(R,C){this.key=R,this.regexp=C,this.type=7,this.negated=null}static create(R,C){return new N(R,C)}cmp(R){if(R.type!==this.type)return this.type-R.type;if(this.key<R.key)return-1;if(this.key>R.key)return 1;const C=this.regexp?this.regexp.source:"",q=R.regexp?R.regexp.source:"";return C<q?-1:C>q?1:0}equals(R){if(R.type===this.type){const C=this.regexp?this.regexp.source:"",q=R.regexp?R.regexp.source:"";return this.key===R.key&&C===q}return!1}substituteConstants(){return this}evaluate(R){let C=R.getValue(this.key);return this.regexp?this.regexp.test(C):!1}serialize(){const R=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${R}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=H.create(this)),this.negated}}class H{constructor(R){this._actual=R,this.type=8}static create(R){return new H(R)}cmp(R){return R.type!==this.type?this.type-R.type:this._actual.cmp(R._actual)}equals(R){return R.type===this.type?this._actual.equals(R._actual):!1}substituteConstants(){return this}evaluate(R){return!this._actual.evaluate(R)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function F(W){let R=null;for(let C=0,q=W.length;C<q;C++){const re=W[C].substituteConstants();if(W[C]!==re&&R===null){R=[];for(let _e=0;_e<C;_e++)R[_e]=W[_e]}R!==null&&(R[C]=re)}return R===null?W:R}class Y{constructor(R,C){this.expr=R,this.negated=C,this.type=6}static create(R,C){return Y._normalizeArr(R,C)}cmp(R){if(R.type!==this.type)return this.type-R.type;if(this.expr.length<R.expr.length)return-1;if(this.expr.length>R.expr.length)return 1;for(let C=0,q=this.expr.length;C<q;C++){const re=n(this.expr[C],R.expr[C]);if(re!==0)return re}return 0}equals(R){if(R.type===this.type){if(this.expr.length!==R.expr.length)return!1;for(let C=0,q=this.expr.length;C<q;C++)if(!this.expr[C].equals(R.expr[C]))return!1;return!0}return!1}substituteConstants(){const R=F(this.expr);return R===this.expr?this:Y.create(R,this.negated)}evaluate(R){for(let C=0,q=this.expr.length;C<q;C++)if(!this.expr[C].evaluate(R))return!1;return!0}static _normalizeArr(R,C){const q=[];let re=!1;for(const _e of R)if(_e){if(_e.type===1){re=!0;continue}if(_e.type===0)return y.INSTANCE;if(_e.type===6){q.push(..._e.expr);continue}q.push(_e)}if(q.length===0&&re)return f.INSTANCE;if(q.length!==0){if(q.length===1)return q[0];q.sort(n);for(let _e=1;_e<q.length;_e++)q[_e-1].equals(q[_e])&&(q.splice(_e,1),_e--);if(q.length===1)return q[0];for(;q.length>1;){const _e=q[q.length-1];if(_e.type!==9)break;q.pop();const Le=q.pop(),qe=q.length===0,be=V.create(_e.expr.map(je=>Y.create([je,Le],null)),null,qe);be&&(q.push(be),q.sort(n))}return q.length===1?q[0]:new Y(q,C)}}serialize(){return this.expr.map(R=>R.serialize()).join(" && ")}keys(){const R=[];for(let C of this.expr)R.push(...C.keys());return R}negate(){if(!this.negated){const R=[];for(let C of this.expr)R.push(C.negate());this.negated=V.create(R,this,!0)}return this.negated}}class V{constructor(R,C){this.expr=R,this.negated=C,this.type=9}static create(R,C,q){return V._normalizeArr(R,C,q)}cmp(R){if(R.type!==this.type)return this.type-R.type;if(this.expr.length<R.expr.length)return-1;if(this.expr.length>R.expr.length)return 1;for(let C=0,q=this.expr.length;C<q;C++){const re=n(this.expr[C],R.expr[C]);if(re!==0)return re}return 0}equals(R){if(R.type===this.type){if(this.expr.length!==R.expr.length)return!1;for(let C=0,q=this.expr.length;C<q;C++)if(!this.expr[C].equals(R.expr[C]))return!1;return!0}return!1}substituteConstants(){const R=F(this.expr);return R===this.expr?this:V.create(R,this.negated,!1)}evaluate(R){for(let C=0,q=this.expr.length;C<q;C++)if(this.expr[C].evaluate(R))return!0;return!1}static _normalizeArr(R,C,q){let re=[],_e=!1;if(R){for(let Le=0,qe=R.length;Le<qe;Le++){const be=R[Le];if(be){if(be.type===0){_e=!0;continue}if(be.type===1)return f.INSTANCE;if(be.type===9){re=re.concat(be.expr);continue}re.push(be)}}if(re.length===0&&_e)return y.INSTANCE;re.sort(n)}if(re.length!==0){if(re.length===1)return re[0];for(let Le=1;Le<re.length;Le++)re[Le-1].equals(re[Le])&&(re.splice(Le,1),Le--);if(re.length===1)return re[0];if(q){for(let Le=0;Le<re.length;Le++)for(let qe=Le+1;qe<re.length;qe++)B(re[Le],re[qe])&&(re.splice(qe,1),qe--);if(re.length===1)return re[0]}return new V(re,C)}}serialize(){return this.expr.map(R=>R.serialize()).join(" || ")}keys(){const R=[];for(let C of this.expr)R.push(...C.keys());return R}negate(){if(!this.negated){let R=[];for(let C of this.expr)R.push(C.negate());for(;R.length>1;){const C=R.shift(),q=R.shift(),re=[];for(const Le of G(C))for(const qe of G(q))re.push(Y.create([Le,qe],null));const _e=R.length===0;R.unshift(V.create(re,null,_e))}this.negated=R[0]}return this.negated}}class ne extends c{constructor(R,C,q){super(R,null),this._defaultValue=C,typeof q=="object"?ne._info.push(Object.assign(Object.assign({},q),{key:R})):q!==!0&&ne._info.push({key:R,description:q,type:C!=null?typeof C:void 0})}static all(){return ne._info.values()}bindTo(R){return R.createKey(this.key,this._defaultValue)}getValue(R){return R.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(R){return l.create(this.key,R)}}ne._info=[];const ae=(0,K.yh)("contextKeyService"),J="setContext";function z(W,R){return W<R?-1:W>R?1:0}function Z(W,R,C,q){return W<C?-1:W>C?1:R<q?-1:R>q?1:0}function B(W,R){if(R.type===6&&W.type!==9&&W.type!==6){for(const re of R.expr)if(W.equals(re))return!0}const C=W.negate(),q=G(C).concat(G(R));q.sort(n);for(let re=0;re<q.length;re++){const Le=q[re].negate();for(let qe=re+1;qe<q.length;qe++){const be=q[qe];if(Le.equals(be))return!0}}return!1}function G(W){return W.type===9?W.expr:[W]}},16925:function(mt,me,b){"use strict";b.d(me,{I8:function(){return k},TG:function(){return I},jt:function(){return w},yh:function(){return D}});var k;(function(_){_.serviceIds=new Map,_.DI_TARGET="$di$target",_.DI_DEPENDENCIES="$di$dependencies";function O(m){return m[_.DI_DEPENDENCIES]||[]}_.getServiceDependencies=O})(k||(k={}));const I=D("instantiationService");function K(_,O,m,n){O[k.DI_TARGET]===O?O[k.DI_DEPENDENCIES].push({id:_,index:m,optional:n}):(O[k.DI_DEPENDENCIES]=[{id:_,index:m,optional:n}],O[k.DI_TARGET]=O)}function D(_){if(k.serviceIds.has(_))return k.serviceIds.get(_);const O=function(m,n,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");K(O,m,y,!1)};return O.toString=()=>_,k.serviceIds.set(_,O),O}function w(_){return function(O,m,n){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");K(_,O,n,!0)}}},44650:function(mt,me,b){"use strict";b.d(me,{B:function(){return D}});var k=b(76068),I=b(72999);class K{constructor(){this.data=new Map}add(_,O){k.ok(I.HD(_)),k.ok(I.Kn(O)),k.ok(!this.data.has(_),"There is already an extension with this id"),this.data.set(_,O)}as(_){return this.data.get(_)||null}}const D=new K},66213:function(mt,me,b){"use strict";b.d(me,{e:function(){return k}});var k;(function(I){I.DARK="dark",I.LIGHT="light",I.HIGH_CONTRAST="hc"})(k||(k={}))},49055:function(mt,me,b){"use strict";b.d(me,{EN:function(){return n},IP:function(){return c},Ic:function(){return p},XE:function(){return O},bB:function(){return E},kS:function(){return y},m6:function(){return f}});var k=b(52615),I=b(4348),K=b(69323),D=b(16925),w=b(44650),_=b(66213);const O=(0,D.yh)("themeService");var m;(function(T){function L(x){return x&&typeof x=="object"&&typeof x.id=="string"}T.isThemeColor=L})(m||(m={}));function n(T){return{id:T}}var y;(function(T){function L(H){return H&&typeof H=="object"&&typeof H.id=="string"&&(typeof H.color=="undefined"||m.isThemeColor(H.color))}T.isThemeIcon=L;const x=new RegExp(`^\\$\\((${k.dT.iconNameExpression}(?:${k.dT.iconModifierExpression})?)\\)$`);function A(H){const F=x.exec(H);if(!F)return;let[,Y]=F;return{id:Y}}T.fromString=A;function P(H,F){let Y=H.id;const V=Y.lastIndexOf("~");return V!==-1&&(Y=Y.substring(0,V)),F&&(Y=`${Y}~${F}`),{id:Y}}T.modify=P;function U(H,F){var Y,V;return H.id===F.id&&((Y=H.color)===null||Y===void 0?void 0:Y.id)===((V=F.color)===null||V===void 0?void 0:V.id)}T.isEqual=U;function N(H,F){return{id:H.id,color:F?n(F):void 0}}T.asThemeIcon=N,T.asClassNameArray=k.dT.asClassNameArray,T.asClassName=k.dT.asClassName,T.asCSSSelector=k.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 I.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 u=new l;w.B.add(c.ThemingContribution,u);function p(T){return u.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(mt,me,b){"use strict";b.d(me,{Z:function(){return O}});var k=b(33346),I=b(98506),K=b(26420),D=b(59301),w=["show"];function _(m,n){if(!n.max)return!0;var y=n.strategy(m);return y<=n.max}function O(m,n){return D.useMemo(function(){var y={};n&&(y.show=(0,K.Z)(n)==="object"&&n.formatter?n.formatter:!!n),y=(0,I.Z)((0,I.Z)({},y),m);var f=y,c=f.show,l=(0,k.Z)(f,w);return(0,I.Z)((0,I.Z)({},l),{},{show:!!c,showFormatter:typeof c=="function"?c:void 0,strategy:l.strategy||function(u){return u.length}})},[m,n])}},36901:function(mt,me,b){"use strict";b.r(me),b.d(me,{BaseInput:function(){return y},default:function(){return A}});var k=b(98506),I=b(67711),K=b(52873),D=b(26420),w=b(92310),_=b.n(w),O=b(59301),m=b(30292),n=O.forwardRef(function(P,U){var N,H,F,Y=P.inputElement,V=P.children,ne=P.prefixCls,ae=P.prefix,J=P.suffix,z=P.addonBefore,Z=P.addonAfter,B=P.className,G=P.style,W=P.disabled,R=P.readOnly,C=P.focused,q=P.triggerFocus,re=P.allowClear,_e=P.value,Le=P.handleReset,qe=P.hidden,be=P.classes,je=P.classNames,Me=P.dataAttrs,Oe=P.styles,wt=P.components,We=P.onClear,lt=V!=null?V:Y,He=(wt==null?void 0:wt.affixWrapper)||"span",vt=(wt==null?void 0:wt.groupWrapper)||"span",Ee=(wt==null?void 0:wt.wrapper)||"span",we=(wt==null?void 0:wt.groupAddon)||"span",le=(0,O.useRef)(null),Re=function(gt){var _t;(_t=le.current)!==null&&_t!==void 0&&_t.contains(gt.target)&&(q==null||q())},Fe=(0,m.X3)(P),Ke=(0,O.cloneElement)(lt,{value:_e,className:_()((N=lt.props)===null||N===void 0?void 0:N.className,!Fe&&(je==null?void 0:je.variant))||null}),ie=(0,O.useRef)(null);if(O.useImperativeHandle(U,function(){return{nativeElement:ie.current||le.current}}),Fe){var he=null;if(re){var Te=!W&&!R&&_e,Ie="".concat(ne,"-clear-icon"),de=(0,D.Z)(re)==="object"&&re!==null&&re!==void 0&&re.clearIcon?re.clearIcon:"\u2716";he=O.createElement("button",{type:"button",tabIndex:-1,onClick:function(gt){Le==null||Le(gt),We==null||We()},onMouseDown:function(gt){return gt.preventDefault()},className:_()(Ie,(0,K.Z)((0,K.Z)({},"".concat(Ie,"-hidden"),!Te),"".concat(Ie,"-has-suffix"),!!J))},de)}var Be="".concat(ne,"-affix-wrapper"),Ge=_()(Be,(0,K.Z)((0,K.Z)((0,K.Z)((0,K.Z)((0,K.Z)({},"".concat(ne,"-disabled"),W),"".concat(Be,"-disabled"),W),"".concat(Be,"-focused"),C),"".concat(Be,"-readonly"),R),"".concat(Be,"-input-with-clear-btn"),J&&re&&_e),be==null?void 0:be.affixWrapper,je==null?void 0:je.affixWrapper,je==null?void 0:je.variant),Ne=(J||re)&&O.createElement("span",{className:_()("".concat(ne,"-suffix"),je==null?void 0:je.suffix),style:Oe==null?void 0:Oe.suffix},he,J);Ke=O.createElement(He,(0,I.Z)({className:Ge,style:Oe==null?void 0:Oe.affixWrapper,onClick:Re},Me==null?void 0:Me.affixWrapper,{ref:le}),ae&&O.createElement("span",{className:_()("".concat(ne,"-prefix"),je==null?void 0:je.prefix),style:Oe==null?void 0:Oe.prefix},ae),Ke,Ne)}if((0,m.He)(P)){var Ye="".concat(ne,"-group"),$e="".concat(Ye,"-addon"),st="".concat(Ye,"-wrapper"),nt=_()("".concat(ne,"-wrapper"),Ye,be==null?void 0:be.wrapper,je==null?void 0:je.wrapper),Je=_()(st,(0,K.Z)({},"".concat(st,"-disabled"),W),be==null?void 0:be.group,je==null?void 0:je.groupWrapper);Ke=O.createElement(vt,{className:Je,ref:ie},O.createElement(Ee,{className:nt},z&&O.createElement(we,{className:$e},z),Ke,Z&&O.createElement(we,{className:$e},Z)))}return O.cloneElement(Ke,{className:_()((H=Ke.props)===null||H===void 0?void 0:H.className,B)||null,style:(0,k.Z)((0,k.Z)({},(F=Ke.props)===null||F===void 0?void 0:F.style),G),hidden:qe})}),y=n,f=b(15142),c=b(16886),l=b(33346),u=b(18929),p=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,O.forwardRef)(function(P,U){var N=P.autoComplete,H=P.onChange,F=P.onFocus,Y=P.onBlur,V=P.onPressEnter,ne=P.onKeyDown,ae=P.onKeyUp,J=P.prefixCls,z=J===void 0?"rc-input":J,Z=P.disabled,B=P.htmlSize,G=P.className,W=P.maxLength,R=P.suffix,C=P.showCount,q=P.count,re=P.type,_e=re===void 0?"text":re,Le=P.classes,qe=P.classNames,be=P.styles,je=P.onCompositionStart,Me=P.onCompositionEnd,Oe=(0,l.Z)(P,T),wt=(0,O.useState)(!1),We=(0,c.Z)(wt,2),lt=We[0],He=We[1],vt=(0,O.useRef)(!1),Ee=(0,O.useRef)(!1),we=(0,O.useRef)(null),le=(0,O.useRef)(null),Re=function(xt){we.current&&(0,m.nH)(we.current,xt)},Fe=(0,u.Z)(P.defaultValue,{value:P.value}),Ke=(0,c.Z)(Fe,2),ie=Ke[0],he=Ke[1],Te=ie==null?"":String(ie),Ie=(0,O.useState)(null),de=(0,c.Z)(Ie,2),Be=de[0],Ge=de[1],Ne=(0,E.Z)(q,C),Ye=Ne.max||W,$e=Ne.strategy(Te),st=!!Ye&&$e>Ye;(0,O.useImperativeHandle)(U,function(){var rt;return{focus:Re,blur:function(){var xe;(xe=we.current)===null||xe===void 0||xe.blur()},setSelectionRange:function(xe,ge,ye){var ee;(ee=we.current)===null||ee===void 0||ee.setSelectionRange(xe,ge,ye)},select:function(){var xe;(xe=we.current)===null||xe===void 0||xe.select()},input:we.current,nativeElement:((rt=le.current)===null||rt===void 0?void 0:rt.nativeElement)||we.current}}),(0,O.useEffect)(function(){Ee.current&&(Ee.current=!1),He(function(rt){return rt&&Z?!1:rt})},[Z]);var nt=function(xt,xe,ge){var ye=xe;if(!vt.current&&Ne.exceedFormatter&&Ne.max&&Ne.strategy(xe)>Ne.max){if(ye=Ne.exceedFormatter(xe,{max:Ne.max}),xe!==ye){var ee,te;Ge([((ee=we.current)===null||ee===void 0?void 0:ee.selectionStart)||0,((te=we.current)===null||te===void 0?void 0:te.selectionEnd)||0])}}else if(ge.source==="compositionEnd")return;he(ye),we.current&&(0,m.rJ)(we.current,xt,H,ye)};(0,O.useEffect)(function(){if(Be){var rt;(rt=we.current)===null||rt===void 0||rt.setSelectionRange.apply(rt,(0,f.Z)(Be))}},[Be]);var Je=function(xt){nt(xt,xt.target.value,{source:"change"})},tt=function(xt){vt.current=!1,nt(xt,xt.currentTarget.value,{source:"compositionEnd"}),Me==null||Me(xt)},gt=function(xt){V&&xt.key==="Enter"&&!Ee.current&&(Ee.current=!0,V(xt)),ne==null||ne(xt)},_t=function(xt){xt.key==="Enter"&&(Ee.current=!1),ae==null||ae(xt)},it=function(xt){He(!0),F==null||F(xt)},Dt=function(xt){Ee.current&&(Ee.current=!1),He(!1),Y==null||Y(xt)},Tt=function(xt){he(""),Re(),we.current&&(0,m.rJ)(we.current,xt,H)},at=st&&"".concat(z,"-out-of-range"),Ot=function(){var xt=(0,p.Z)(P,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return O.createElement("input",(0,I.Z)({autoComplete:N},xt,{onChange:Je,onFocus:it,onBlur:Dt,onKeyDown:gt,onKeyUp:_t,className:_()(z,(0,K.Z)({},"".concat(z,"-disabled"),Z),qe==null?void 0:qe.input),style:be==null?void 0:be.input,ref:we,size:B,type:_e,onCompositionStart:function(ge){vt.current=!0,je==null||je(ge)},onCompositionEnd:tt}))},Ut=function(){var xt=Number(Ye)>0;if(R||Ne.show){var xe=Ne.showFormatter?Ne.showFormatter({value:Te,count:$e,maxLength:Ye}):"".concat($e).concat(xt?" / ".concat(Ye):"");return O.createElement(O.Fragment,null,Ne.show&&O.createElement("span",{className:_()("".concat(z,"-show-count-suffix"),(0,K.Z)({},"".concat(z,"-show-count-has-suffix"),!!R),qe==null?void 0:qe.count),style:(0,k.Z)({},be==null?void 0:be.count)},xe),R)}return null};return O.createElement(y,(0,I.Z)({},Oe,{prefixCls:z,className:_()(G,at),handleReset:Tt,value:Te,focused:lt,triggerFocus:Re,suffix:Ut(),disabled:Z,classes:Le,classNames:qe,styles:be}),Ot())}),x=L,A=x},30292:function(mt,me,b){"use strict";b.d(me,{He:function(){return k},X3:function(){return I},nH:function(){return w},rJ:function(){return D}});function k(_){return!!(_.addonBefore||_.addonAfter)}function I(_){return!!(_.prefix||_.suffix||_.allowClear)}function K(_,O,m){var n=O.cloneNode(!0),y=Object.create(_,{target:{value:n},currentTarget:{value:n}});return n.value=m,typeof O.selectionStart=="number"&&typeof O.selectionEnd=="number"&&(n.selectionStart=O.selectionStart,n.selectionEnd=O.selectionEnd),n.setSelectionRange=function(){O.setSelectionRange.apply(O,arguments)},y}function D(_,O,m,n){if(m){var y=O;if(O.type==="click"){y=K(O,_,""),m(y);return}if(_.type!=="file"&&n!==void 0){y=K(O,_,n),m(y);return}m(y)}}function w(_,O){if(_){_.focus(O);var m=O||{},n=m.cursor;if(n){var y=_.value.length;switch(n){case"start":_.setSelectionRange(0,0);break;case"end":_.setSelectionRange(y,y);break;default:_.setSelectionRange(0,y)}}}}},29301:function(mt,me,b){"use strict";b.d(me,{Z:function(){return J}});var k=b(67711),I=b(59301),K=b(11592),D=b(48736),w=b(98506),_=b(26420),O=b(76846),m=b(8654),n=I.createContext(null);function y(z){var Z=z.children,B=z.onBatchResize,G=I.useRef(0),W=I.useRef([]),R=I.useContext(n),C=I.useCallback(function(q,re,_e){G.current+=1;var Le=G.current;W.current.push({size:q,element:re,data:_e}),Promise.resolve().then(function(){Le===G.current&&(B==null||B(W.current),W.current=[])}),R==null||R(q,re,_e)},[B,R]);return I.createElement(n.Provider,{value:C},Z)}var f=b(76374),c=new Map;function l(z){z.forEach(function(Z){var B,G=Z.target;(B=c.get(G))===null||B===void 0||B.forEach(function(W){return W(G)})})}var u=new f.Z(l),p=null,E=null;function T(z,Z){c.has(z)||(c.set(z,new Set),u.observe(z)),c.get(z).add(Z)}function L(z,Z){c.has(z)&&(c.get(z).delete(Z),c.get(z).size||(u.unobserve(z),c.delete(z)))}var x=b(42573),A=b(58698),P=b(74700),U=b(45080),N=function(z){(0,P.Z)(B,z);var Z=(0,U.Z)(B);function B(){return(0,x.Z)(this,B),Z.apply(this,arguments)}return(0,A.Z)(B,[{key:"render",value:function(){return this.props.children}}]),B}(I.Component);function H(z,Z){var B=z.children,G=z.disabled,W=I.useRef(null),R=I.useRef(null),C=I.useContext(n),q=typeof B=="function",re=q?B(W):B,_e=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Le=!q&&I.isValidElement(re)&&(0,m.Yr)(re),qe=Le?(0,m.C4)(re):null,be=(0,m.x1)(qe,W),je=function(){var We;return(0,O.ZP)(W.current)||(W.current&&(0,_.Z)(W.current)==="object"?(0,O.ZP)((We=W.current)===null||We===void 0?void 0:We.nativeElement):null)||(0,O.ZP)(R.current)};I.useImperativeHandle(Z,function(){return je()});var Me=I.useRef(z);Me.current=z;var Oe=I.useCallback(function(wt){var We=Me.current,lt=We.onResize,He=We.data,vt=wt.getBoundingClientRect(),Ee=vt.width,we=vt.height,le=wt.offsetWidth,Re=wt.offsetHeight,Fe=Math.floor(Ee),Ke=Math.floor(we);if(_e.current.width!==Fe||_e.current.height!==Ke||_e.current.offsetWidth!==le||_e.current.offsetHeight!==Re){var ie={width:Fe,height:Ke,offsetWidth:le,offsetHeight:Re};_e.current=ie;var he=le===Math.round(Ee)?Ee:le,Te=Re===Math.round(we)?we:Re,Ie=(0,w.Z)((0,w.Z)({},ie),{},{offsetWidth:he,offsetHeight:Te});C==null||C(Ie,wt,He),lt&&Promise.resolve().then(function(){lt(Ie,wt)})}},[]);return I.useEffect(function(){var wt=je();return wt&&!G&&T(wt,Oe),function(){return L(wt,Oe)}},[W.current,G]),I.createElement(N,{ref:R},Le?I.cloneElement(re,{ref:be}):re)}var F=I.forwardRef(H),Y=F,V="rc-observer-key";function ne(z,Z){var B=z.children,G=typeof B=="function"?[B]:(0,K.Z)(B);return G.map(function(W,R){var C=(W==null?void 0:W.key)||"".concat(V,"-").concat(R);return I.createElement(Y,(0,k.Z)({},z,{key:C,ref:R===0?Z:void 0}),W)})}var ae=I.forwardRef(ne);ae.Collection=y;var J=ae},22711:function(mt,me,b){"use strict";b.r(me),b.d(me,{ResizableTextArea:function(){return ae},default:function(){return B}});var k=b(67711),I=b(52873),K=b(98506),D=b(15142),w=b(16886),_=b(33346),O=b(92310),m=b.n(O),n=b(36901),y=b(66003),f=b(30292),c=b(18929),l=b(59301),u=b(26420),p=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={},P;function U(G){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,R=G.getAttribute("id")||G.getAttribute("data-reactid")||G.getAttribute("name");if(W&&A[R])return A[R];var C=window.getComputedStyle(G),q=C.getPropertyValue("box-sizing")||C.getPropertyValue("-moz-box-sizing")||C.getPropertyValue("-webkit-box-sizing"),re=parseFloat(C.getPropertyValue("padding-bottom"))+parseFloat(C.getPropertyValue("padding-top")),_e=parseFloat(C.getPropertyValue("border-bottom-width"))+parseFloat(C.getPropertyValue("border-top-width")),Le=x.map(function(be){return"".concat(be,":").concat(C.getPropertyValue(be))}).join(";"),qe={sizingStyle:Le,paddingSize:re,borderSize:_e,boxSizing:q};return W&&R&&(A[R]=qe),qe}function N(G){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,C=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;P||(P=document.createElement("textarea"),P.setAttribute("tab-index","-1"),P.setAttribute("aria-hidden","true"),P.setAttribute("name","hiddenTextarea"),document.body.appendChild(P)),G.getAttribute("wrap")?P.setAttribute("wrap",G.getAttribute("wrap")):P.removeAttribute("wrap");var q=U(G,W),re=q.paddingSize,_e=q.borderSize,Le=q.boxSizing,qe=q.sizingStyle;P.setAttribute("style","".concat(qe,";").concat(L)),P.value=G.value||G.placeholder||"";var be=void 0,je=void 0,Me,Oe=P.scrollHeight;if(Le==="border-box"?Oe+=_e:Le==="content-box"&&(Oe-=re),R!==null||C!==null){P.value=" ";var wt=P.scrollHeight-re;R!==null&&(be=wt*R,Le==="border-box"&&(be=be+re+_e),Oe=Math.max(be,Oe)),C!==null&&(je=wt*C,Le==="border-box"&&(je=je+re+_e),Me=Oe>je?"":"hidden",Oe=Math.min(je,Oe))}var We={height:Oe,overflowY:Me,resize:"none"};return be&&(We.minHeight=be),je&&(We.maxHeight=je),We}var H=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],F=0,Y=1,V=2,ne=l.forwardRef(function(G,W){var R=G,C=R.prefixCls,q=R.defaultValue,re=R.value,_e=R.autoSize,Le=R.onResize,qe=R.className,be=R.style,je=R.disabled,Me=R.onChange,Oe=R.onInternalAutoSize,wt=(0,_.Z)(R,H),We=(0,c.Z)(q,{value:re,postState:function(Dt){return Dt!=null?Dt:""}}),lt=(0,w.Z)(We,2),He=lt[0],vt=lt[1],Ee=function(Dt){vt(Dt.target.value),Me==null||Me(Dt)},we=l.useRef();l.useImperativeHandle(W,function(){return{textArea:we.current}});var le=l.useMemo(function(){return _e&&(0,u.Z)(_e)==="object"?[_e.minRows,_e.maxRows]:[]},[_e]),Re=(0,w.Z)(le,2),Fe=Re[0],Ke=Re[1],ie=!!_e,he=function(){try{if(document.activeElement===we.current){var Dt=we.current,Tt=Dt.selectionStart,at=Dt.selectionEnd,Ot=Dt.scrollTop;we.current.setSelectionRange(Tt,at),we.current.scrollTop=Ot}}catch(Ut){}},Te=l.useState(V),Ie=(0,w.Z)(Te,2),de=Ie[0],Be=Ie[1],Ge=l.useState(),Ne=(0,w.Z)(Ge,2),Ye=Ne[0],$e=Ne[1],st=function(){Be(F)};(0,E.Z)(function(){ie&&st()},[re,Fe,Ke,ie]),(0,E.Z)(function(){if(de===F)Be(Y);else if(de===Y){var it=N(we.current,!1,Fe,Ke);Be(V),$e(it)}else he()},[de]);var nt=l.useRef(),Je=function(){T.Z.cancel(nt.current)},tt=function(Dt){de===V&&(Le==null||Le(Dt),_e&&(Je(),nt.current=(0,T.Z)(function(){st()})))};l.useEffect(function(){return Je},[]);var gt=ie?Ye:null,_t=(0,K.Z)((0,K.Z)({},be),gt);return(de===F||de===Y)&&(_t.overflowY="hidden",_t.overflowX="hidden"),l.createElement(p.Z,{onResize:tt,disabled:!(_e||Le)},l.createElement("textarea",(0,k.Z)({},wt,{ref:we,style:_t,className:m()(C,qe,(0,I.Z)({},"".concat(C,"-disabled"),je)),disabled:je,value:He,onChange:Ee})))}),ae=ne,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 R,C=G.defaultValue,q=G.value,re=G.onFocus,_e=G.onBlur,Le=G.onChange,qe=G.allowClear,be=G.maxLength,je=G.onCompositionStart,Me=G.onCompositionEnd,Oe=G.suffix,wt=G.prefixCls,We=wt===void 0?"rc-textarea":wt,lt=G.showCount,He=G.count,vt=G.className,Ee=G.style,we=G.disabled,le=G.hidden,Re=G.classNames,Fe=G.styles,Ke=G.onResize,ie=G.onClear,he=G.onPressEnter,Te=G.readOnly,Ie=G.autoSize,de=G.onKeyDown,Be=(0,_.Z)(G,J),Ge=(0,c.Z)(C,{value:q,defaultValue:C}),Ne=(0,w.Z)(Ge,2),Ye=Ne[0],$e=Ne[1],st=Ye==null?"":String(Ye),nt=l.useState(!1),Je=(0,w.Z)(nt,2),tt=Je[0],gt=Je[1],_t=l.useRef(!1),it=l.useState(null),Dt=(0,w.Z)(it,2),Tt=Dt[0],at=Dt[1],Ot=(0,l.useRef)(null),Ut=(0,l.useRef)(null),rt=function(){var ht;return(ht=Ut.current)===null||ht===void 0?void 0:ht.textArea},xt=function(){rt().focus()};(0,l.useImperativeHandle)(W,function(){var ze;return{resizableTextArea:Ut.current,focus:xt,blur:function(){rt().blur()},nativeElement:((ze=Ot.current)===null||ze===void 0?void 0:ze.nativeElement)||rt()}}),(0,l.useEffect)(function(){gt(function(ze){return!we&&ze})},[we]);var xe=l.useState(null),ge=(0,w.Z)(xe,2),ye=ge[0],ee=ge[1];l.useEffect(function(){if(ye){var ze;(ze=rt()).setSelectionRange.apply(ze,(0,D.Z)(ye))}},[ye]);var te=(0,y.Z)(He,lt),ue=(R=te.max)!==null&&R!==void 0?R:be,fe=Number(ue)>0,pe=te.strategy(st),Ze=!!ue&&pe>ue,Qe=function(ht,Bt){var $t=Bt;!_t.current&&te.exceedFormatter&&te.max&&te.strategy(Bt)>te.max&&($t=te.exceedFormatter(Bt,{max:te.max}),Bt!==$t&&ee([rt().selectionStart||0,rt().selectionEnd||0])),$e($t),(0,f.rJ)(ht.currentTarget,ht,Le,$t)},ut=function(ht){_t.current=!0,je==null||je(ht)},dt=function(ht){_t.current=!1,Qe(ht,ht.currentTarget.value),Me==null||Me(ht)},kt=function(ht){Qe(ht,ht.target.value)},zt=function(ht){ht.key==="Enter"&&he&&he(ht),de==null||de(ht)},Nt=function(ht){gt(!0),re==null||re(ht)},Ct=function(ht){gt(!1),_e==null||_e(ht)},oi=function(ht){$e(""),xt(),(0,f.rJ)(rt(),ht,Le)},_i=Oe,ti;te.show&&(te.showFormatter?ti=te.showFormatter({value:st,count:pe,maxLength:ue}):ti="".concat(pe).concat(fe?" / ".concat(ue):""),_i=l.createElement(l.Fragment,null,_i,l.createElement("span",{className:m()("".concat(We,"-data-count"),Re==null?void 0:Re.count),style:Fe==null?void 0:Fe.count},ti)));var ri=function(ht){var Bt;Ke==null||Ke(ht),(Bt=rt())!==null&&Bt!==void 0&&Bt.style.height&&at(!0)},et=!Ie&&!lt&&!qe;return l.createElement(n.BaseInput,{ref:Ot,value:st,allowClear:qe,handleReset:oi,suffix:_i,prefixCls:We,classNames:(0,K.Z)((0,K.Z)({},Re),{},{affixWrapper:m()(Re==null?void 0:Re.affixWrapper,(0,I.Z)((0,I.Z)({},"".concat(We,"-show-count"),lt),"".concat(We,"-textarea-allow-clear"),qe))}),disabled:we,focused:tt,className:m()(vt,Ze&&"".concat(We,"-out-of-range")),style:(0,K.Z)((0,K.Z)({},Ee),Tt&&!et?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof ti=="string"?ti:void 0}},hidden:le,readOnly:Te,onClear:ie},l.createElement(ae,(0,k.Z)({},Be,{autoSize:Ie,maxLength:be,onKeyDown:zt,onChange:kt,onFocus:Nt,onBlur:Ct,onCompositionStart:ut,onCompositionEnd:dt,className:m()(Re==null?void 0:Re.textarea),style:(0,K.Z)((0,K.Z)({},Fe==null?void 0:Fe.textarea),{},{resize:Ee==null?void 0:Ee.resize}),disabled:we,prefixCls:We,onResize:ri,ref:Ut,readOnly:Te})))}),Z=z,B=Z},29125:function(mt,me,b){"use strict";b.d(me,{G:function(){return D},Z:function(){return L}});var k=b(92310),I=b.n(k),K=b(59301);function D(x){var A=x.children,P=x.prefixCls,U=x.id,N=x.overlayInnerStyle,H=x.bodyClassName,F=x.className,Y=x.style;return K.createElement("div",{className:I()("".concat(P,"-content"),F),style:Y},K.createElement("div",{className:I()("".concat(P,"-inner"),H),id:U,role:"tooltip",style:N},typeof A=="function"?A():A))}var w=b(67711),_=b(98506),O=b(33346),m=b(65030),n={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:n,offset:[0,-4],targetOffset:f},bottom:{points:["tc","bc"],overflow:n,offset:[0,4],targetOffset:f},topLeft:{points:["bl","tl"],overflow:n,offset:[0,-4],targetOffset:f},leftTop:{points:["tr","tl"],overflow:y,offset:[-4,0],targetOffset:f},topRight:{points:["br","tr"],overflow:n,offset:[0,-4],targetOffset:f},rightTop:{points:["tl","tr"],overflow:y,offset:[4,0],targetOffset:f},bottomRight:{points:["tr","br"],overflow:n,offset:[0,4],targetOffset:f},rightBottom:{points:["bl","br"],overflow:y,offset:[4,0],targetOffset:f},bottomLeft:{points:["tl","bl"],overflow:n,offset:[0,4],targetOffset:f},leftBottom:{points:["br","bl"],overflow:y,offset:[-4,0],targetOffset:f}},l=null,u=b(80402),p=["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,P){var U=A.overlayClassName,N=A.trigger,H=N===void 0?["hover"]:N,F=A.mouseEnterDelay,Y=F===void 0?0:F,V=A.mouseLeaveDelay,ne=V===void 0?.1:V,ae=A.overlayStyle,J=A.prefixCls,z=J===void 0?"rc-tooltip":J,Z=A.children,B=A.onVisibleChange,G=A.afterVisibleChange,W=A.transitionName,R=A.animation,C=A.motion,q=A.placement,re=q===void 0?"right":q,_e=A.align,Le=_e===void 0?{}:_e,qe=A.destroyTooltipOnHide,be=qe===void 0?!1:qe,je=A.defaultVisible,Me=A.getTooltipContainer,Oe=A.overlayInnerStyle,wt=A.arrowContent,We=A.overlay,lt=A.id,He=A.showArrow,vt=He===void 0?!0:He,Ee=A.classNames,we=A.styles,le=(0,O.Z)(A,p),Re=(0,u.Z)(lt),Fe=(0,K.useRef)(null);(0,K.useImperativeHandle)(P,function(){return Fe.current});var Ke=(0,_.Z)({},le);"visible"in A&&(Ke.popupVisible=A.visible);var ie=function(){return K.createElement(D,{key:"content",prefixCls:z,id:Re,bodyClassName:Ee==null?void 0:Ee.body,overlayInnerStyle:(0,_.Z)((0,_.Z)({},Oe),we==null?void 0:we.body)},We)},he=function(){var Ie=K.Children.only(Z),de=(Ie==null?void 0:Ie.props)||{},Be=(0,_.Z)((0,_.Z)({},de),{},{"aria-describedby":We?Re:null});return K.cloneElement(Z,Be)};return K.createElement(m.Z,(0,w.Z)({popupClassName:I()(U,Ee==null?void 0:Ee.root),prefixCls:z,popup:ie,action:H,builtinPlacements:c,popupPlacement:re,ref:Fe,popupAlign:Le,getPopupContainer:Me,onPopupVisibleChange:B,afterPopupVisibleChange:G,popupTransitionName:W,popupAnimation:R,popupMotion:C,defaultPopupVisible:je,autoDestroy:be,mouseLeaveDelay:ne,popupStyle:(0,_.Z)((0,_.Z)({},ae),we==null?void 0:we.root),mouseEnterDelay:Y,arrow:vt},Ke),he())},T=(0,K.forwardRef)(E),L=T},49658:function(mt,me){"use strict";me.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(mt,me,b){"use strict";Object.defineProperty(me,"__esModule",{value:!0}),me.CopyToClipboard=void 0;var k=K(b(59301)),I=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(P){return typeof P}:D=function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},D(x)}function w(x,A){var P=Object.keys(x);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(x);A&&(U=U.filter(function(N){return Object.getOwnPropertyDescriptor(x,N).enumerable})),P.push.apply(P,U)}return P}function _(x){for(var A=1;A<arguments.length;A++){var P=arguments[A]!=null?arguments[A]:{};A%2?w(P,!0).forEach(function(U){T(x,U,P[U])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(P)):w(P).forEach(function(U){Object.defineProperty(x,U,Object.getOwnPropertyDescriptor(P,U))})}return x}function O(x,A){if(x==null)return{};var P=m(x,A),U,N;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(x);for(N=0;N<H.length;N++)U=H[N],!(A.indexOf(U)>=0)&&Object.prototype.propertyIsEnumerable.call(x,U)&&(P[U]=x[U])}return P}function m(x,A){if(x==null)return{};var P={},U=Object.keys(x),N,H;for(H=0;H<U.length;H++)N=U[H],!(A.indexOf(N)>=0)&&(P[N]=x[N]);return P}function n(x,A){if(!(x instanceof A))throw new TypeError("Cannot call a class as a function")}function y(x,A){for(var P=0;P<A.length;P++){var U=A[P];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(x,U.key,U)}}function f(x,A,P){return A&&y(x.prototype,A),P&&y(x,P),x}function c(x,A){return A&&(D(A)==="object"||typeof A=="function")?A:u(x)}function l(x){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(P){return P.__proto__||Object.getPrototypeOf(P)},l(x)}function u(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function p(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,P){return A in x?Object.defineProperty(x,A,{value:P,enumerable:!0,configurable:!0,writable:!0}):x[A]=P,x}var L=function(x){p(A,x);function A(){var P,U;n(this,A);for(var N=arguments.length,H=new Array(N),F=0;F<N;F++)H[F]=arguments[F];return U=c(this,(P=l(A)).call.apply(P,[this].concat(H))),T(u(U),"onClick",function(Y){var V=U.props,ne=V.text,ae=V.onCopy,J=V.children,z=V.options,Z=k.default.Children.only(J),B=(0,I.default)(ne,z);ae&&ae(ne,B),Z&&Z.props&&typeof Z.props.onClick=="function"&&Z.props.onClick(Y)}),U}return f(A,[{key:"render",value:function(){var U=this.props,N=U.text,H=U.onCopy,F=U.options,Y=U.children,V=O(U,["text","onCopy","options","children"]),ne=k.default.Children.only(Y);return k.default.cloneElement(ne,_({},V,{onClick:this.onClick}))}}]),A}(k.default.PureComponent);me.CopyToClipboard=L,T(L,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(mt,me,b){"use strict";var k=b(83145),I=k.CopyToClipboard;I.CopyToClipboard=I,mt.exports=I},76374:function(mt,me,b){"use strict";var k=function(){if(typeof Map!="undefined")return Map;function J(z,Z){var B=-1;return z.some(function(G,W){return G[0]===Z?(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(Z){var B=J(this.__entries__,Z),G=this.__entries__[B];return G&&G[1]},z.prototype.set=function(Z,B){var G=J(this.__entries__,Z);~G?this.__entries__[G][1]=B:this.__entries__.push([Z,B])},z.prototype.delete=function(Z){var B=this.__entries__,G=J(B,Z);~G&&B.splice(G,1)},z.prototype.has=function(Z){return!!~J(this.__entries__,Z)},z.prototype.clear=function(){this.__entries__.splice(0)},z.prototype.forEach=function(Z,B){B===void 0&&(B=null);for(var G=0,W=this.__entries__;G<W.length;G++){var R=W[G];Z.call(B,R[1],R[0])}},z}()}(),I=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 Z=!1,B=!1,G=0;function W(){Z&&(Z=!1,J()),B&&C()}function R(){D(W)}function C(){var q=Date.now();if(Z){if(q-G<w)return;B=!0}else Z=!0,B=!1,setTimeout(R,z);G=q}return C}var O=20,m=["top","right","bottom","left","width","height","size","weight"],n=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),O)}return J.prototype.addObserver=function(z){~this.observers_.indexOf(z)||this.observers_.push(z),this.connected_||this.connect_()},J.prototype.removeObserver=function(z){var Z=this.observers_,B=Z.indexOf(z);~B&&Z.splice(B,1),!Z.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(Z){return Z.gatherActive(),Z.hasActive()});return z.forEach(function(Z){return Z.broadcastActive()}),z.length>0},J.prototype.connect_=function(){!I||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),n?(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(){!I||!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 Z=z.propertyName,B=Z===void 0?"":Z,G=m.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 Z=0,B=Object.keys(z);Z<B.length;Z++){var G=B[Z];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 u(J){return parseFloat(J)||0}function p(J){for(var z=[],Z=1;Z<arguments.length;Z++)z[Z-1]=arguments[Z];return z.reduce(function(B,G){var W=J["border-"+G+"-width"];return B+u(W)},0)}function E(J){for(var z=["top","right","bottom","left"],Z={},B=0,G=z;B<G.length;B++){var W=G[B],R=J["padding-"+W];Z[W]=u(R)}return Z}function T(J){var z=J.getBBox();return N(0,0,z.width,z.height)}function L(J){var z=J.clientWidth,Z=J.clientHeight;if(!z&&!Z)return l;var B=c(J).getComputedStyle(J),G=E(B),W=G.left+G.right,R=G.top+G.bottom,C=u(B.width),q=u(B.height);if(B.boxSizing==="border-box"&&(Math.round(C+W)!==z&&(C-=p(B,"left","right")+W),Math.round(q+R)!==Z&&(q-=p(B,"top","bottom")+R)),!A(J)){var re=Math.round(C+W)-z,_e=Math.round(q+R)-Z;Math.abs(re)!==1&&(C-=re),Math.abs(_e)!==1&&(q-=_e)}return N(G.left,G.top,C,q)}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 P(J){return I?x(J)?T(J):L(J):l}function U(J){var z=J.x,Z=J.y,B=J.width,G=J.height,W=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,R=Object.create(W.prototype);return f(R,{x:z,y:Z,width:B,height:G,top:Z,right:z+B,bottom:G+Z,left:z}),R}function N(J,z,Z,B){return{x:J,y:z,width:Z,height:B}}var H=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=P(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}(),F=function(){function J(z,Z){var B=U(Z);f(this,{target:z,contentRect:B})}return J}(),Y=function(){function J(z,Z,B){if(this.activeObservations_=[],this.observations_=new k,typeof z!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=z,this.controller_=Z,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 Z=this.observations_;Z.has(z)||(Z.set(z,new H(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 Z=this.observations_;Z.has(z)&&(Z.delete(z),Z.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(Z){Z.isActive()&&z.activeObservations_.push(Z)})},J.prototype.broadcastActive=function(){if(this.hasActive()){var z=this.callbackCtx_,Z=this.activeObservations_.map(function(B){return new F(B.target,B.broadcastRect())});this.callback_.call(z,Z,z),this.clearActive()}},J.prototype.clearActive=function(){this.activeObservations_.splice(0)},J.prototype.hasActive=function(){return this.activeObservations_.length>0},J}(),V=typeof WeakMap!="undefined"?new WeakMap:new k,ne=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 Z=y.getInstance(),B=new Y(z,Z,this);V.set(this,B)}return J}();["observe","unobserve","disconnect"].forEach(function(J){ne.prototype[J]=function(){var z;return(z=V.get(this))[J].apply(z,arguments)}});var ae=function(){return typeof K.ResizeObserver!="undefined"?K.ResizeObserver:ne}();me.Z=ae},98040:function(mt){mt.exports=function(){var me=document.getSelection();if(!me.rangeCount)return function(){};for(var b=document.activeElement,k=[],I=0;I<me.rangeCount;I++)k.push(me.getRangeAt(I));switch(b.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":b.blur();break;default:b=null;break}return me.removeAllRanges(),function(){me.type==="Caret"&&me.removeAllRanges(),me.rangeCount||k.forEach(function(K){me.addRange(K)}),b&&b.focus()}}},34376:function(mt){(function(me,b){if(1)mt.exports=b();else var k,I})(window,function(){return function(me){var b={};function k(I){if(b[I])return b[I].exports;var K=b[I]={i:I,l:!1,exports:{}};return me[I].call(K.exports,K,K.exports,k),K.l=!0,K.exports}return k.m=me,k.c=b,k.d=function(I,K,D){k.o(I,K)||Object.defineProperty(I,K,{enumerable:!0,get:D})},k.r=function(I){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(I,"__esModule",{value:!0})},k.t=function(I,K){if(1&K&&(I=k(I)),8&K||4&K&&typeof I=="object"&&I&&I.__esModule)return I;var D=Object.create(null);if(k.r(D),Object.defineProperty(D,"default",{enumerable:!0,value:I}),2&K&&typeof I!="string")for(var w in I)k.d(D,w,function(_){return I[_]}.bind(null,w));return D},k.n=function(I){var K=I&&I.__esModule?function(){return I.default}:function(){return I};return k.d(K,"a",K),K},k.o=function(I,K){return Object.prototype.hasOwnProperty.call(I,K)},k.p="",k(k.s=34)}([function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.forwardEvent=b.EventEmitter=void 0;var I=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 _=[],O=0;O<this._listeners.length;O++)_.push(this._listeners[O]);for(O=0;O<_.length;O++)_[O].call(void 0,D,w)},K.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},K}();b.EventEmitter=I,b.forwardEvent=function(K,D){return K(function(w){return D.fire(w)})}},function(me,b,k){"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 I=k(14);b.IBufferService=I.createDecorator("BufferService"),b.ICoreMouseService=I.createDecorator("CoreMouseService"),b.ICoreService=I.createDecorator("CoreService"),b.ICharsetService=I.createDecorator("CharsetService"),b.IDirtyRowService=I.createDecorator("DirtyRowService"),b.IInstantiationService=I.createDecorator("InstantiationService"),b.ILogService=I.createDecorator("LogService"),b.IOptionsService=I.createDecorator("OptionsService"),b.IUnicodeService=I.createDecorator("UnicodeService")},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.getDisposeArrayDisposable=b.disposeArray=b.Disposable=void 0;var I=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=I,b.disposeArray=K,b.getDisposeArrayDisposable=function(D){return{dispose:function(){return K(D)}}}},function(me,b,k){"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(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(m,n){return(I=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])})(m,n)},function(m,n){function y(){this.constructor=m}I(m,n),m.prototype=n===null?Object.create(n):(y.prototype=n.prototype,new y)});Object.defineProperty(b,"__esModule",{value:!0}),b.CellData=void 0;var D=k(8),w=k(3),_=k(6),O=function(m){function n(){var y=m!==null&&m.apply(this,arguments)||this;return y.content=0,y.fg=0,y.bg=0,y.extended=new _.ExtendedAttrs,y.combinedData="",y}return K(n,m),n.fromCharData=function(y){var f=new n;return f.setFromCharData(y),f},n.prototype.isCombined=function(){return 2097152&this.content},n.prototype.getWidth=function(){return this.content>>22},n.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?D.stringFromCodePoint(2097151&this.content):""},n.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},n.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)},n.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},n}(_.AttributeData);b.CellData=O},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ISoundService=b.ISelectionService=b.IRenderService=b.IMouseService=b.ICoreBrowserService=b.ICharSizeService=void 0;var I=k(14);b.ICharSizeService=I.createDecorator("CharSizeService"),b.ICoreBrowserService=I.createDecorator("CoreBrowserService"),b.IMouseService=I.createDecorator("MouseService"),b.IRenderService=I.createDecorator("RenderService"),b.ISelectionService=I.createDecorator("SelectionService"),b.ISoundService=I.createDecorator("SoundService")},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ExtendedAttrs=b.AttributeData=void 0;var I=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=I;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(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.addDisposableDomListener=void 0,b.addDisposableDomListener=function(I,K,D,w){I.addEventListener(K,D,w);var _=!1;return{dispose:function(){_||(_=!0,I.removeEventListener(K,D,w))}}}},function(me,b,k){"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 O="",m=w;m<_;++m){var n=D[m];n>65535?(n-=65536,O+=String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):O+=String.fromCharCode(n)}return O};var I=function(){function D(){this._interim=0}return D.prototype.clear=function(){this._interim=0},D.prototype.decode=function(w,_){var O=w.length;if(!O)return 0;var m=0,n=0;this._interim&&(56320<=(c=w.charCodeAt(n++))&&c<=57343?_[m++]=1024*(this._interim-55296)+c-56320+65536:(_[m++]=this._interim,_[m++]=c),this._interim=0);for(var y=n;y<O;++y){var f=w.charCodeAt(y);if(55296<=f&&f<=56319){if(++y>=O)return this._interim=f,m;var c;56320<=(c=w.charCodeAt(y))&&c<=57343?_[m++]=1024*(f-55296)+c-56320+65536:(_[m++]=f,_[m++]=c)}else _[m++]=f}return m},D}();b.StringToUtf32=I;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 O=w.length;if(!O)return 0;var m,n,y,f,c=0,l=0,u=0;if(this.interim[0]){var p=!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;u<A;){if(u>=O)return 0;if((192&(L=w[u++]))!=128){u--,p=!0;break}this.interim[T++]=L,E<<=6,E|=63&L}p||(x===2?E<128?u--:_[c++]=E:x===3?E<2048||E>=55296&&E<=57343||(_[c++]=E):E<65536||E>1114111||(_[c++]=E)),this.interim.fill(0)}for(var P=O-4,U=u;U<O;){for(;!(!(U<P)||128&(m=w[U])||128&(n=w[U+1])||128&(y=w[U+2])||128&(f=w[U+3]));)_[c++]=m,_[c++]=n,_[c++]=y,_[c++]=f,U+=4;if((m=w[U++])<128)_[c++]=m;else if((224&m)==192){if(U>=O)return this.interim[0]=m,c;if((192&(n=w[U++]))!=128){U--;continue}if((l=(31&m)<<6|63&n)<128){U--;continue}_[c++]=l}else if((240&m)==224){if(U>=O)return this.interim[0]=m,c;if((192&(n=w[U++]))!=128){U--;continue}if(U>=O)return this.interim[0]=m,this.interim[1]=n,c;if((192&(y=w[U++]))!=128){U--;continue}if((l=(15&m)<<12|(63&n)<<6|63&y)<2048||l>=55296&&l<=57343)continue;_[c++]=l}else if((248&m)==240){if(U>=O)return this.interim[0]=m,c;if((192&(n=w[U++]))!=128){U--;continue}if(U>=O)return this.interim[0]=m,this.interim[1]=n,c;if((192&(y=w[U++]))!=128){U--;continue}if(U>=O)return this.interim[0]=m,this.interim[1]=n,this.interim[2]=y,c;if((192&(f=w[U++]))!=128){U--;continue}if((l=(7&m)<<18|(63&n)<<12|(63&y)<<6|63&f)<65536||l>1114111)continue;_[c++]=l}}return c},D}();b.Utf8ToUtf32=K},function(me,b,k){"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(me,b,k){"use strict";var I,K,D,w;function _(m){var n=m.toString(16);return n.length<2?"0"+n:n}function O(m,n){return m<n?(n+.05)/(m+.05):(m+.05)/(n+.05)}Object.defineProperty(b,"__esModule",{value:!0}),b.contrastRatio=b.toPaddedHex=b.rgba=b.rgb=b.css=b.color=b.channels=void 0,function(m){m.toCss=function(n,y,f,c){return c!==void 0?"#"+_(n)+_(y)+_(f)+_(c):"#"+_(n)+_(y)+_(f)},m.toRgba=function(n,y,f,c){return c===void 0&&(c=255),(n<<24|y<<16|f<<8|c)>>>0}}(I=b.channels||(b.channels={})),(K=b.color||(b.color={})).blend=function(m,n){var y=(255&n.rgba)/255;if(y===1)return{css:n.css,rgba:n.rgba};var f=n.rgba>>24&255,c=n.rgba>>16&255,l=n.rgba>>8&255,u=m.rgba>>24&255,p=m.rgba>>16&255,E=m.rgba>>8&255,T=u+Math.round((f-u)*y),L=p+Math.round((c-p)*y),x=E+Math.round((l-E)*y);return{css:I.toCss(T,L,x),rgba:I.toRgba(T,L,x)}},K.isOpaque=function(m){return(255&m.rgba)==255},K.ensureContrastRatio=function(m,n,y){var f=w.ensureContrastRatio(m.rgba,n.rgba,y);if(f)return w.toColor(f>>24&255,f>>16&255,f>>8&255)},K.opaque=function(m){var n=(255|m.rgba)>>>0,y=w.toChannels(n),f=y[0],c=y[1],l=y[2];return{css:I.toCss(f,c,l),rgba:n}},K.opacity=function(m,n){var y=Math.round(255*n),f=w.toChannels(m.rgba),c=f[0],l=f[1],u=f[2];return{css:I.toCss(c,l,u,y),rgba:I.toRgba(c,l,u,y)}},(b.css||(b.css={})).toColor=function(m){switch(m.length){case 7:return{css:m,rgba:(parseInt(m.slice(1),16)<<8|255)>>>0};case 9:return{css:m,rgba:parseInt(m.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(m){function n(y,f,c){var l=y/255,u=f/255,p=c/255;return .2126*(l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4))+.7152*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.0722*(p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4))}m.relativeLuminance=function(y){return n(y>>16&255,y>>8&255,255&y)},m.relativeLuminance2=n}(D=b.rgb||(b.rgb={})),function(m){function n(f,c,l){for(var u=f>>24&255,p=f>>16&255,E=f>>8&255,T=c>>24&255,L=c>>16&255,x=c>>8&255,A=O(D.relativeLuminance2(T,x,L),D.relativeLuminance2(u,p,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=O(D.relativeLuminance2(T,x,L),D.relativeLuminance2(u,p,E));return(T<<24|L<<16|x<<8|255)>>>0}function y(f,c,l){for(var u=f>>24&255,p=f>>16&255,E=f>>8&255,T=c>>24&255,L=c>>16&255,x=c>>8&255,A=O(D.relativeLuminance2(T,x,L),D.relativeLuminance2(u,p,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=O(D.relativeLuminance2(T,x,L),D.relativeLuminance2(u,p,E));return(T<<24|L<<16|x<<8|255)>>>0}m.ensureContrastRatio=function(f,c,l){var u=D.relativeLuminance(f>>8),p=D.relativeLuminance(c>>8);if(O(u,p)<l)return p<u?n(f,c,l):y(f,c,l)},m.reduceLuminance=n,m.increaseLuminance=y,m.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]},m.toColor=function(f,c,l){return{css:I.toCss(f,c,l),rgba:I.toRgba(f,c,l)}}}(w=b.rgba||(b.rgba={})),b.toPaddedHex=_,b.contrastRatio=O},function(me,b,k){"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 I=typeof navigator=="undefined",K=I?"node":navigator.userAgent,D=I?"node":navigator.platform;function w(_,O){return _.indexOf(O)>=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(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.C1=b.C0=void 0,function(I){I.NUL="\0",I.SOH="",I.STX="",I.ETX="",I.EOT="",I.ENQ="",I.ACK="",I.BEL="\x07",I.BS="\b",I.HT=" ",I.LF=`
`,I.VT="\v",I.FF="\f",I.CR="\r",I.SO="",I.SI="",I.DLE="",I.DC1="",I.DC2="",I.DC3="",I.DC4="",I.NAK="",I.SYN="",I.ETB="",I.CAN="",I.EM="",I.SUB="",I.ESC="\x1B",I.FS="",I.GS="",I.RS="",I.US="",I.SP=" ",I.DEL="\x7F"}(b.C0||(b.C0={})),function(I){I.PAD="\x80",I.HOP="\x81",I.BPH="\x82",I.NBH="\x83",I.IND="\x84",I.NEL="\x85",I.SSA="\x86",I.ESA="\x87",I.HTS="\x88",I.HTJ="\x89",I.VTS="\x8A",I.PLD="\x8B",I.PLU="\x8C",I.RI="\x8D",I.SS2="\x8E",I.SS3="\x8F",I.DCS="\x90",I.PU1="\x91",I.PU2="\x92",I.STS="\x93",I.CCH="\x94",I.MW="\x95",I.SPA="\x96",I.EPA="\x97",I.SOS="\x98",I.SGCI="\x99",I.SCI="\x9A",I.CSI="\x9B",I.ST="\x9C",I.OSC="\x9D",I.PM="\x9E",I.APC="\x9F"}(b.C1||(b.C1={}))},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BaseRenderLayer=void 0;var I=k(3),K=k(9),D=k(25),w=k(6),_=k(28),O=k(10),m=k(17),n=function(){function y(f,c,l,u,p,E,T,L){this._container=f,this._alpha=u,this._colors=p,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;m.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,u){this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,u*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,u){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,u*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,u){this._alpha?this._ctx.clearRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,u*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,u*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 u,p,E=this._getContrastColor(f);E||f.isFgRGB()||f.isBgRGB()?this._drawUncachedChars(f,c,l,E):(f.isInverse()?(u=f.isBgDefault()?K.INVERTED_DEFAULT_COLOR:f.getBgColor(),p=f.isFgDefault()?K.INVERTED_DEFAULT_COLOR:f.getFgColor()):(p=f.isBgDefault()?I.DEFAULT_COLOR:f.getBgColor(),u=f.isFgDefault()?I.DEFAULT_COLOR:f.getFgColor()),u+=this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&u<8?8:0,this._currentGlyphIdentifier.chars=f.getChars()||I.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=f.getCode()||I.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=p,this._currentGlyphIdentifier.fg=u,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,u){if(this._ctx.save(),this._ctx.font=this._getFont(!!f.isBold(),!!f.isItalic()),this._ctx.textBaseline="middle",f.isInverse())if(u)this._ctx.fillStyle=u.css;else if(f.isBgDefault())this._ctx.fillStyle=O.color.opaque(this._colors.background).css;else if(f.isBgRGB())this._ctx.fillStyle="rgb("+w.AttributeData.toColorRGB(f.getBgColor()).join(",")+")";else{var p=f.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&p<8&&(p+=8),this._ctx.fillStyle=this._colors.ansi[p].css}else if(u)this._ctx.fillStyle=u.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(),u=f.getFgColorMode(),p=f.getBgColor(),E=f.getBgColorMode(),T=!!f.isInverse(),L=!!f.isInverse();if(T){var x=l;l=p,p=x;var A=u;u=E,E=A}var P=this._resolveBackgroundRgba(E,p,T),U=this._resolveForegroundRgba(u,l,T,L),N=O.rgba.ensureContrastRatio(P,U,this._optionsService.options.minimumContrastRatio);if(N){var H={css:O.channels.toCss(N>>24&255,N>>16&255,N>>8&255),rgba:N};return this._colors.contrastCache.setColor(f.bg,f.fg,H),H}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,u){switch(f){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&u&&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=n},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.createDecorator=b.getServiceDependencies=b.serviceRegistry=void 0;function I(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,_,O){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");I(D,w,O)};return D.toString=function(){return K},b.serviceRegistry.set(K,D),D}},function(me,b,k){"use strict";function I(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 O=w;O<_;++O)K[O]=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,_):I(K,D,w,_)},b.fillFallback=I,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(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BufferLine=b.DEFAULT_ATTR_DATA=void 0;var I=k(8),K=k(3),D=k(4),w=k(6);b.DEFAULT_ATTR_DATA=Object.freeze(new w.AttributeData);var _=function(){function O(m,n,y){y===void 0&&(y=!1),this.isWrapped=y,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*m);for(var f=n||D.CellData.fromCharData([0,K.NULL_CELL_CHAR,K.NULL_CELL_WIDTH,K.NULL_CELL_CODE]),c=0;c<m;++c)this.setCell(c,f);this.length=m}return O.prototype.get=function(m){var n=this._data[3*m+0],y=2097151&n;return[this._data[3*m+1],2097152&n?this._combined[m]:y?I.stringFromCodePoint(y):"",n>>22,2097152&n?this._combined[m].charCodeAt(this._combined[m].length-1):y]},O.prototype.set=function(m,n){this._data[3*m+1]=n[K.CHAR_DATA_ATTR_INDEX],n[K.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[m]=n[1],this._data[3*m+0]=2097152|m|n[K.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*m+0]=n[K.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[K.CHAR_DATA_WIDTH_INDEX]<<22},O.prototype.getWidth=function(m){return this._data[3*m+0]>>22},O.prototype.hasWidth=function(m){return 12582912&this._data[3*m+0]},O.prototype.getFg=function(m){return this._data[3*m+1]},O.prototype.getBg=function(m){return this._data[3*m+2]},O.prototype.hasContent=function(m){return 4194303&this._data[3*m+0]},O.prototype.getCodePoint=function(m){var n=this._data[3*m+0];return 2097152&n?this._combined[m].charCodeAt(this._combined[m].length-1):2097151&n},O.prototype.isCombined=function(m){return 2097152&this._data[3*m+0]},O.prototype.getString=function(m){var n=this._data[3*m+0];return 2097152&n?this._combined[m]:2097151&n?I.stringFromCodePoint(2097151&n):""},O.prototype.loadCell=function(m,n){var y=3*m;return n.content=this._data[y+0],n.fg=this._data[y+1],n.bg=this._data[y+2],2097152&n.content&&(n.combinedData=this._combined[m]),268435456&n.bg&&(n.extended=this._extendedAttrs[m]),n},O.prototype.setCell=function(m,n){2097152&n.content&&(this._combined[m]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[m]=n.extended),this._data[3*m+0]=n.content,this._data[3*m+1]=n.fg,this._data[3*m+2]=n.bg},O.prototype.setCellFromCodePoint=function(m,n,y,f,c,l){268435456&c&&(this._extendedAttrs[m]=l),this._data[3*m+0]=n|y<<22,this._data[3*m+1]=f,this._data[3*m+2]=c},O.prototype.addCodepointToCell=function(m,n){var y=this._data[3*m+0];2097152&y?this._combined[m]+=I.stringFromCodePoint(n):(2097151&y?(this._combined[m]=I.stringFromCodePoint(2097151&y)+I.stringFromCodePoint(n),y&=-2097152,y|=2097152):y=n|1<<22,this._data[3*m+0]=y)},O.prototype.insertCells=function(m,n,y,f){if((m%=this.length)&&this.getWidth(m-1)===2&&this.setCellFromCodePoint(m-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),n<this.length-m){for(var c=new D.CellData,l=this.length-m-n-1;l>=0;--l)this.setCell(m+n+l,this.loadCell(m+l,c));for(l=0;l<n;++l)this.setCell(m+l,y)}else for(l=m;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)},O.prototype.deleteCells=function(m,n,y,f){if(m%=this.length,n<this.length-m){for(var c=new D.CellData,l=0;l<this.length-m-n;++l)this.setCell(m+l,this.loadCell(m+n+l,c));for(l=this.length-n;l<this.length;++l)this.setCell(l,y)}else for(l=m;l<this.length;++l)this.setCell(l,y);m&&this.getWidth(m-1)===2&&this.setCellFromCodePoint(m-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(m)!==0||this.hasContent(m)||this.setCellFromCodePoint(m,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)},O.prototype.replaceCells=function(m,n,y,f){for(m&&this.getWidth(m-1)===2&&this.setCellFromCodePoint(m-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),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n,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);m<n&&m<this.length;)this.setCell(m++,y)},O.prototype.resize=function(m,n){if(m!==this.length){if(m>this.length){var y=new Uint32Array(3*m);this.length&&(3*m<this._data.length?y.set(this._data.subarray(0,3*m)):y.set(this._data)),this._data=y;for(var f=this.length;f<m;++f)this.setCell(f,n)}else if(m){(y=new Uint32Array(3*m)).set(this._data.subarray(0,3*m)),this._data=y;var c=Object.keys(this._combined);for(f=0;f<c.length;f++){var l=parseInt(c[f],10);l>=m&&delete this._combined[l]}}else this._data=new Uint32Array(0),this._combined={};this.length=m}},O.prototype.fill=function(m){this._combined={},this._extendedAttrs={};for(var n=0;n<this.length;++n)this.setCell(n,m)},O.prototype.copyFrom=function(m){for(var n in this.length!==m.length?this._data=new Uint32Array(m._data):this._data.set(m._data),this.length=m.length,this._combined={},m._combined)this._combined[n]=m._combined[n];for(var n in this._extendedAttrs={},m._extendedAttrs)this._extendedAttrs[n]=m._extendedAttrs[n];this.isWrapped=m.isWrapped},O.prototype.clone=function(){var m=new O(0);for(var n in m._data=new Uint32Array(this._data),m.length=this.length,this._combined)m._combined[n]=this._combined[n];for(var n in this._extendedAttrs)m._extendedAttrs[n]=this._extendedAttrs[n];return m.isWrapped=this.isWrapped,m},O.prototype.getTrimmedLength=function(){for(var m=this.length-1;m>=0;--m)if(4194303&this._data[3*m+0])return m+(this._data[3*m+0]>>22);return 0},O.prototype.copyCellsFrom=function(m,n,y,f,c){var l=m._data;if(c)for(var u=f-1;u>=0;u--)for(var p=0;p<3;p++)this._data[3*(y+u)+p]=l[3*(n+u)+p];else for(u=0;u<f;u++)for(p=0;p<3;p++)this._data[3*(y+u)+p]=l[3*(n+u)+p];var E=Object.keys(m._combined);for(p=0;p<E.length;p++){var T=parseInt(E[p],10);T>=n&&(this._combined[T-n+y]=m._combined[T])}},O.prototype.translateToString=function(m,n,y){m===void 0&&(m=!1),n===void 0&&(n=0),y===void 0&&(y=this.length),m&&(y=Math.min(y,this.getTrimmedLength()));for(var f="";n<y;){var c=this._data[3*n+0],l=2097151&c;f+=2097152&c?this._combined[n]:l?I.stringFromCodePoint(l):K.WHITESPACE_CELL_CHAR,n+=c>>22||1}return f},O}();b.BufferLine=_},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.removeElementFromParent=void 0,b.removeElementFromParent=function(){for(var I,K=[],D=0;D<arguments.length;D++)K[D]=arguments[D];for(var w=0,_=K;w<_.length;w++){var O=_[w];(I=O==null?void 0:O.parentElement)===null||I===void 0||I.removeChild(O)}}},function(me,b,k){"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(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(U,N){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(H,F){H.__proto__=F}||function(H,F){for(var Y in F)F.hasOwnProperty(Y)&&(H[Y]=F[Y])})(U,N)},function(U,N){function H(){this.constructor=U}I(U,N),U.prototype=N===null?Object.create(N):(H.prototype=N.prototype,new H)});Object.defineProperty(b,"__esModule",{value:!0}),b.InputHandler=b.WindowsOptionsReportType=void 0;var D,w=k(12),_=k(20),O=k(39),m=k(2),n=k(15),y=k(8),f=k(16),c=k(0),l=k(3),u=k(4),p=k(6),E=k(22),T=k(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,H,F,Y){this._bufferService=N,this._coreService=H,this._logService=F,this._optionsService=Y,this._data=new Uint32Array(0)}return U.prototype.hook=function(N){this._data=new Uint32Array(0)},U.prototype.put=function(N,H,F){this._data=n.concat(this._data,N.subarray(H,F))},U.prototype.unhook=function(N){if(N){var H=y.utf32ToString(this._data);switch(this._data=new Uint32Array(0),H){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 F=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(w.C0.ESC+"P1$r"+F+w.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(w.C0.ESC+"P1$r0m"+w.C0.ESC+"\\");case" q":var Y={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return Y-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(w.C0.ESC+"P1$r"+Y+" q"+w.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",H),this._coreService.triggerDataEvent(w.C0.ESC+"P0$r"+w.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},U}(),P=function(U){function N(H,F,Y,V,ne,ae,J,z,Z){Z===void 0&&(Z=new O.EscapeSequenceParser);var B=U.call(this)||this;B._bufferService=H,B._charsetService=F,B._coreService=Y,B._dirtyRowService=V,B._logService=ne,B._optionsService=ae,B._coreMouseService=J,B._unicodeService=z,B._parser=Z,B._parseBuffer=new Uint32Array(4096),B._stringDecoder=new y.StringToUtf32,B._utf8Decoder=new y.Utf8ToUtf32,B._workCell=new u.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,q){B._logService.debug("Unknown CSI code: ",{identifier:B._parser.identToString(C),params:q.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,q,re){B._logService.debug("Unknown OSC code: ",{identifier:C,action:q,data:re})}),B._parser.setDcsHandlerFallback(function(C,q,re){q==="HOOK"&&(re=re.toArray()),B._logService.debug("Unknown DCS code: ",{identifier:B._parser.identToString(C),action:q,payload:re})}),B._parser.setPrintHandler(function(C,q,re){return B.print(C,q,re)}),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 R in _.CHARSETS)G(R);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(H){var F=this._bufferService.buffer,Y=F.x,V=F.y;if(this._logService.debug("parsing data",H),this._parseBuffer.length<H.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(H.length,131072))),this._dirtyRowService.clearRange(),H.length>131072)for(var ne=0;ne<H.length;ne+=131072){var ae=ne+131072<H.length?ne+131072:H.length,J=typeof H=="string"?this._stringDecoder.decode(H.substring(ne,ae),this._parseBuffer):this._utf8Decoder.decode(H.subarray(ne,ae),this._parseBuffer);this._parser.parse(this._parseBuffer,J)}else J=typeof H=="string"?this._stringDecoder.decode(H,this._parseBuffer):this._utf8Decoder.decode(H,this._parseBuffer),this._parser.parse(this._parseBuffer,J);(F=this._bufferService.buffer).x===Y&&F.y===V||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},N.prototype.print=function(H,F,Y){var V,ne,ae=this._bufferService.buffer,J=this._charsetService.charset,z=this._optionsService.options.screenReaderMode,Z=this._bufferService.cols,B=this._coreService.decPrivateModes.wraparound,G=this._coreService.modes.insertMode,W=this._curAttrData,R=ae.lines.get(ae.ybase+ae.y);this._dirtyRowService.markDirty(ae.y),ae.x&&Y-F>0&&R.getWidth(ae.x-1)===2&&R.setCellFromCodePoint(ae.x-1,0,1,W.fg,W.bg,W.extended);for(var C=F;C<Y;++C){if(V=H[C],ne=this._unicodeService.wcwidth(V),V<127&&J){var q=J[String.fromCharCode(V)];q&&(V=q.charCodeAt(0))}if(z&&this._onA11yChar.fire(y.stringFromCodePoint(V)),ne||!ae.x){if(ae.x+ne-1>=Z){if(B){for(;ae.x<Z;)R.setCellFromCodePoint(ae.x++,0,1,W.fg,W.bg,W.extended);ae.x=0,ae.y++,ae.y===ae.scrollBottom+1?(ae.y--,this._onRequestScroll.fire(this._eraseAttrData(),!0)):(ae.y>=this._bufferService.rows&&(ae.y=this._bufferService.rows-1),ae.lines.get(ae.ybase+ae.y).isWrapped=!0),R=ae.lines.get(ae.ybase+ae.y)}else if(ae.x=Z-1,ne===2)continue}if(G&&(R.insertCells(ae.x,ne,ae.getNullCell(W),W),R.getWidth(Z-1)===2&&R.setCellFromCodePoint(Z-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,W.fg,W.bg,W.extended)),R.setCellFromCodePoint(ae.x++,V,ne,W.fg,W.bg,W.extended),ne>0)for(;--ne;)R.setCellFromCodePoint(ae.x++,0,0,W.fg,W.bg,W.extended)}else R.getWidth(ae.x-1)?R.addCodepointToCell(ae.x-1,V):R.addCodepointToCell(ae.x-2,V)}Y-F>0&&(R.loadCell(ae.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),ae.x<Z&&Y-F>0&&R.getWidth(ae.x)===0&&!R.hasContent(ae.x)&&R.setCellFromCodePoint(ae.x,0,1,W.fg,W.bg,W.extended),this._dirtyRowService.markDirty(ae.y)},N.prototype.addCsiHandler=function(H,F){var Y=this;return H.final!=="t"||H.prefix||H.intermediates?this._parser.addCsiHandler(H,F):this._parser.addCsiHandler(H,function(V){return!x(V.params[0],Y._optionsService.options.windowOptions)||F(V)})},N.prototype.addDcsHandler=function(H,F){return this._parser.addDcsHandler(H,new T.DcsHandler(F))},N.prototype.addEscHandler=function(H,F){return this._parser.addEscHandler(H,F)},N.prototype.addOscHandler=function(H,F){return this._parser.addOscHandler(H,new E.OscHandler(F))},N.prototype.bell=function(){this._onRequestBell.fire()},N.prototype.lineFeed=function(){var H=this._bufferService.buffer;this._dirtyRowService.markDirty(H.y),this._optionsService.options.convertEol&&(H.x=0),H.y++,H.y===H.scrollBottom+1?(H.y--,this._onRequestScroll.fire(this._eraseAttrData())):H.y>=this._bufferService.rows&&(H.y=this._bufferService.rows-1),H.x>=this._bufferService.cols&&H.x--,this._dirtyRowService.markDirty(H.y),this._onLineFeed.fire()},N.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},N.prototype.backspace=function(){var H,F=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),void(F.x>0&&F.x--);if(this._restrictCursor(this._bufferService.cols),F.x>0)F.x--;else if(F.x===0&&F.y>F.scrollTop&&F.y<=F.scrollBottom&&(!((H=F.lines.get(F.ybase+F.y))===null||H===void 0)&&H.isWrapped)){F.lines.get(F.ybase+F.y).isWrapped=!1,F.y--,F.x=this._bufferService.cols-1;var Y=F.lines.get(F.ybase+F.y);Y.hasWidth(F.x)&&!Y.hasContent(F.x)&&F.x--}this._restrictCursor()},N.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var H=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-H)}},N.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},N.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},N.prototype._restrictCursor=function(H){H===void 0&&(H=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(H,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(H,F){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=H,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+F):(this._bufferService.buffer.x=H,this._bufferService.buffer.y=F),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},N.prototype._moveCursor=function(H,F){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+H,this._bufferService.buffer.y+F)},N.prototype.cursorUp=function(H){var F=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;F>=0?this._moveCursor(0,-Math.min(F,H.params[0]||1)):this._moveCursor(0,-(H.params[0]||1))},N.prototype.cursorDown=function(H){var F=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;F>=0?this._moveCursor(0,Math.min(F,H.params[0]||1)):this._moveCursor(0,H.params[0]||1)},N.prototype.cursorForward=function(H){this._moveCursor(H.params[0]||1,0)},N.prototype.cursorBackward=function(H){this._moveCursor(-(H.params[0]||1),0)},N.prototype.cursorNextLine=function(H){this.cursorDown(H),this._bufferService.buffer.x=0},N.prototype.cursorPrecedingLine=function(H){this.cursorUp(H),this._bufferService.buffer.x=0},N.prototype.cursorCharAbsolute=function(H){this._setCursor((H.params[0]||1)-1,this._bufferService.buffer.y)},N.prototype.cursorPosition=function(H){this._setCursor(H.length>=2?(H.params[1]||1)-1:0,(H.params[0]||1)-1)},N.prototype.charPosAbsolute=function(H){this._setCursor((H.params[0]||1)-1,this._bufferService.buffer.y)},N.prototype.hPositionRelative=function(H){this._moveCursor(H.params[0]||1,0)},N.prototype.linePosAbsolute=function(H){this._setCursor(this._bufferService.buffer.x,(H.params[0]||1)-1)},N.prototype.vPositionRelative=function(H){this._moveCursor(0,H.params[0]||1)},N.prototype.hVPosition=function(H){this.cursorPosition(H)},N.prototype.tabClear=function(H){var F=H.params[0];F===0?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:F===3&&(this._bufferService.buffer.tabs={})},N.prototype.cursorForwardTab=function(H){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var F=H.params[0]||1;F--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},N.prototype.cursorBackwardTab=function(H){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var F=H.params[0]||1,Y=this._bufferService.buffer;F--;)Y.x=Y.prevStop()},N.prototype._eraseInBufferLine=function(H,F,Y,V){V===void 0&&(V=!1);var ne=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+H);ne.replaceCells(F,Y,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),V&&(ne.isWrapped=!1)},N.prototype._resetBufferLine=function(H){var F=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+H);F.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1},N.prototype.eraseInDisplay=function(H){var F;switch(this._restrictCursor(),H.params[0]){case 0:for(F=this._bufferService.buffer.y,this._dirtyRowService.markDirty(F),this._eraseInBufferLine(F++,this._bufferService.buffer.x,this._bufferService.cols,this._bufferService.buffer.x===0);F<this._bufferService.rows;F++)this._resetBufferLine(F);this._dirtyRowService.markDirty(F);break;case 1:for(F=this._bufferService.buffer.y,this._dirtyRowService.markDirty(F),this._eraseInBufferLine(F,0,this._bufferService.buffer.x+1,!0),this._bufferService.buffer.x+1>=this._bufferService.cols&&(this._bufferService.buffer.lines.get(F+1).isWrapped=!1);F--;)this._resetBufferLine(F);this._dirtyRowService.markDirty(0);break;case 2:for(F=this._bufferService.rows,this._dirtyRowService.markDirty(F-1);F--;)this._resetBufferLine(F);this._dirtyRowService.markDirty(0);break;case 3:var Y=this._bufferService.buffer.lines.length-this._bufferService.rows;Y>0&&(this._bufferService.buffer.lines.trimStart(Y),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-Y,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-Y,0),this._onScroll.fire(0))}},N.prototype.eraseInLine=function(H){switch(this._restrictCursor(),H.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(H){this._restrictCursor();var F=H.params[0]||1,Y=this._bufferService.buffer;if(!(Y.y>Y.scrollBottom||Y.y<Y.scrollTop)){for(var V=Y.ybase+Y.y,ne=this._bufferService.rows-1-Y.scrollBottom,ae=this._bufferService.rows-1+Y.ybase-ne+1;F--;)Y.lines.splice(ae-1,1),Y.lines.splice(V,0,Y.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(Y.y,Y.scrollBottom),Y.x=0}},N.prototype.deleteLines=function(H){this._restrictCursor();var F=H.params[0]||1,Y=this._bufferService.buffer;if(!(Y.y>Y.scrollBottom||Y.y<Y.scrollTop)){var V,ne=Y.ybase+Y.y;for(V=this._bufferService.rows-1-Y.scrollBottom,V=this._bufferService.rows-1+Y.ybase-V;F--;)Y.lines.splice(ne,1),Y.lines.splice(V,0,Y.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(Y.y,Y.scrollBottom),Y.x=0}},N.prototype.insertChars=function(H){this._restrictCursor();var F=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);F&&(F.insertCells(this._bufferService.buffer.x,H.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},N.prototype.deleteChars=function(H){this._restrictCursor();var F=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);F&&(F.deleteCells(this._bufferService.buffer.x,H.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},N.prototype.scrollUp=function(H){for(var F=H.params[0]||1,Y=this._bufferService.buffer;F--;)Y.lines.splice(Y.ybase+Y.scrollTop,1),Y.lines.splice(Y.ybase+Y.scrollBottom,0,Y.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(Y.scrollTop,Y.scrollBottom)},N.prototype.scrollDown=function(H){for(var F=H.params[0]||1,Y=this._bufferService.buffer;F--;)Y.lines.splice(Y.ybase+Y.scrollBottom,1),Y.lines.splice(Y.ybase+Y.scrollTop,0,Y.getBlankLine(f.DEFAULT_ATTR_DATA));this._dirtyRowService.markRangeDirty(Y.scrollTop,Y.scrollBottom)},N.prototype.scrollLeft=function(H){var F=this._bufferService.buffer;if(!(F.y>F.scrollBottom||F.y<F.scrollTop)){for(var Y=H.params[0]||1,V=F.scrollTop;V<=F.scrollBottom;++V){var ne=F.lines.get(F.ybase+V);ne.deleteCells(0,Y,F.getNullCell(this._eraseAttrData()),this._eraseAttrData()),ne.isWrapped=!1}this._dirtyRowService.markRangeDirty(F.scrollTop,F.scrollBottom)}},N.prototype.scrollRight=function(H){var F=this._bufferService.buffer;if(!(F.y>F.scrollBottom||F.y<F.scrollTop)){for(var Y=H.params[0]||1,V=F.scrollTop;V<=F.scrollBottom;++V){var ne=F.lines.get(F.ybase+V);ne.insertCells(0,Y,F.getNullCell(this._eraseAttrData()),this._eraseAttrData()),ne.isWrapped=!1}this._dirtyRowService.markRangeDirty(F.scrollTop,F.scrollBottom)}},N.prototype.insertColumns=function(H){var F=this._bufferService.buffer;if(!(F.y>F.scrollBottom||F.y<F.scrollTop)){for(var Y=H.params[0]||1,V=F.scrollTop;V<=F.scrollBottom;++V){var ne=this._bufferService.buffer.lines.get(F.ybase+V);ne.insertCells(F.x,Y,F.getNullCell(this._eraseAttrData()),this._eraseAttrData()),ne.isWrapped=!1}this._dirtyRowService.markRangeDirty(F.scrollTop,F.scrollBottom)}},N.prototype.deleteColumns=function(H){var F=this._bufferService.buffer;if(!(F.y>F.scrollBottom||F.y<F.scrollTop)){for(var Y=H.params[0]||1,V=F.scrollTop;V<=F.scrollBottom;++V){var ne=F.lines.get(F.ybase+V);ne.deleteCells(F.x,Y,F.getNullCell(this._eraseAttrData()),this._eraseAttrData()),ne.isWrapped=!1}this._dirtyRowService.markRangeDirty(F.scrollTop,F.scrollBottom)}},N.prototype.eraseChars=function(H){this._restrictCursor();var F=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);F&&(F.replaceCells(this._bufferService.buffer.x,this._bufferService.buffer.x+(H.params[0]||1),this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},N.prototype.repeatPrecedingCharacter=function(H){if(this._parser.precedingCodepoint){for(var F=H.params[0]||1,Y=new Uint32Array(F),V=0;V<F;++V)Y[V]=this._parser.precedingCodepoint;this.print(Y,0,Y.length)}},N.prototype.sendDeviceAttributesPrimary=function(H){H.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(H){H.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(H.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(w.C0.ESC+"[>83;40003;0c"))},N.prototype._is=function(H){return(this._optionsService.options.termName+"").indexOf(H)===0},N.prototype.setMode=function(H){for(var F=0;F<H.length;F++)switch(H.params[F]){case 4:this._coreService.modes.insertMode=!0}},N.prototype.setModePrivate=function(H){for(var F=0;F<H.length;F++)switch(H.params[F]){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(H){for(var F=0;F<H.length;F++)switch(H.params[F]){case 4:this._coreService.modes.insertMode=!1}},N.prototype.resetModePrivate=function(H){for(var F=0;F<H.length;F++)switch(H.params[F]){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(),H.params[F]===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(H,F,Y,V,ne){return F===2?(H|=50331648,H&=-16777216,H|=p.AttributeData.fromColorRGB([Y,V,ne])):F===5&&(H&=-50331904,H|=33554432|255&Y),H},N.prototype._extractColor=function(H,F,Y){var V=[0,0,-1,0,0,0],ne=0,ae=0;do{if(V[ae+ne]=H.params[F+ae],H.hasSubParams(F+ae)){var J=H.getSubParams(F+ae),z=0;do V[1]===5&&(ne=1),V[ae+z+1+ne]=J[z];while(++z<J.length&&z+ae+1+ne<V.length);break}if(V[1]===5&&ae+ne>=2||V[1]===2&&ae+ne>=5)break;V[1]&&(ne=1)}while(++ae+F<H.length&&ae+ne<V.length);for(z=2;z<V.length;++z)V[z]===-1&&(V[z]=0);switch(V[0]){case 38:Y.fg=this._updateAttrColor(Y.fg,V[1],V[3],V[4],V[5]);break;case 48:Y.bg=this._updateAttrColor(Y.bg,V[1],V[3],V[4],V[5]);break;case 58:Y.extended=Y.extended.clone(),Y.extended.underlineColor=this._updateAttrColor(Y.extended.underlineColor,V[1],V[3],V[4],V[5])}return ae},N.prototype._processUnderline=function(H,F){F.extended=F.extended.clone(),(!~H||H>5)&&(H=1),F.extended.underlineStyle=H,F.fg|=268435456,H===0&&(F.fg&=-268435457),F.updateExtended()},N.prototype.charAttributes=function(H){if(H.length===1&&H.params[0]===0)return this._curAttrData.fg=f.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=f.DEFAULT_ATTR_DATA.bg);for(var F,Y=H.length,V=this._curAttrData,ne=0;ne<Y;ne++)(F=H.params[ne])>=30&&F<=37?(V.fg&=-50331904,V.fg|=16777216|F-30):F>=40&&F<=47?(V.bg&=-50331904,V.bg|=16777216|F-40):F>=90&&F<=97?(V.fg&=-50331904,V.fg|=16777224|F-90):F>=100&&F<=107?(V.bg&=-50331904,V.bg|=16777224|F-100):F===0?(V.fg=f.DEFAULT_ATTR_DATA.fg,V.bg=f.DEFAULT_ATTR_DATA.bg):F===1?V.fg|=134217728:F===3?V.bg|=67108864:F===4?(V.fg|=268435456,this._processUnderline(H.hasSubParams(ne)?H.getSubParams(ne)[0]:1,V)):F===5?V.fg|=536870912:F===7?V.fg|=67108864:F===8?V.fg|=1073741824:F===2?V.bg|=134217728:F===21?this._processUnderline(2,V):F===22?(V.fg&=-134217729,V.bg&=-134217729):F===23?V.bg&=-67108865:F===24?V.fg&=-268435457:F===25?V.fg&=-536870913:F===27?V.fg&=-67108865:F===28?V.fg&=-1073741825:F===39?(V.fg&=-67108864,V.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):F===49?(V.bg&=-67108864,V.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):F===38||F===48||F===58?ne+=this._extractColor(H,ne,V):F===59?(V.extended=V.extended.clone(),V.extended.underlineColor=-1,V.updateExtended()):F===100?(V.fg&=-67108864,V.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,V.bg&=-67108864,V.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",F)},N.prototype.deviceStatus=function(H){switch(H.params[0]){case 5:this._coreService.triggerDataEvent(w.C0.ESC+"[0n");break;case 6:var F=this._bufferService.buffer.y+1,Y=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(w.C0.ESC+"["+F+";"+Y+"R")}},N.prototype.deviceStatusPrivate=function(H){switch(H.params[0]){case 6:var F=this._bufferService.buffer.y+1,Y=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(w.C0.ESC+"[?"+F+";"+Y+"R")}},N.prototype.softReset=function(H){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(H){var F=H.params[0]||1;switch(F){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 Y=F%2==1;this._optionsService.options.cursorBlink=Y},N.prototype.setScrollRegion=function(H){var F,Y=H.params[0]||1;(H.length<2||(F=H.params[1])>this._bufferService.rows||F===0)&&(F=this._bufferService.rows),F>Y&&(this._bufferService.buffer.scrollTop=Y-1,this._bufferService.buffer.scrollBottom=F-1,this._setCursor(0,0))},N.prototype.windowOptions=function(H){if(x(H.params[0],this._optionsService.options.windowOptions)){var F=H.length>1?H.params[1]:0;switch(H.params[0]){case 14:F!==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:F!==0&&F!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),F!==0&&F!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:F!==0&&F!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),F!==0&&F!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},N.prototype.saveCursor=function(H){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(H){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(H){this._windowTitle=H,this._onTitleChange.fire(H)},N.prototype.setIconName=function(H){this._iconName=H},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(H){H.length===2?H[0]!=="/"&&this._charsetService.setgCharset(L[H[0]],_.CHARSETS[H[1]]||_.DEFAULT_CHARSET):this.selectDefaultCharset()},N.prototype.index=function(){this._restrictCursor();var H=this._bufferService.buffer;this._bufferService.buffer.y++,H.y===H.scrollBottom+1?(H.y--,this._onRequestScroll.fire(this._eraseAttrData())):H.y>=this._bufferService.rows&&(H.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 H=this._bufferService.buffer;if(H.y===H.scrollTop){var F=H.scrollBottom-H.scrollTop;H.lines.shiftElements(H.ybase+H.y,F,1),H.lines.set(H.ybase+H.y,H.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(H.scrollTop,H.scrollBottom)}else H.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(H){this._charsetService.setgLevel(H)},N.prototype.screenAlignmentPattern=function(){var H=new u.CellData;H.content=1<<22|69,H.fg=this._curAttrData.fg,H.bg=this._curAttrData.bg;var F=this._bufferService.buffer;this._setCursor(0,0);for(var Y=0;Y<this._bufferService.rows;++Y){var V=F.ybase+F.y+Y,ne=F.lines.get(V);ne&&(ne.fill(H),ne.isWrapped=!1)}this._dirtyRowService.markAllDirty(),this._setCursor(0,0)},N}(m.Disposable);b.InputHandler=P},function(me,b,k){"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(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Params=void 0;var I=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 O=D[_];if(O instanceof Array)for(var m=0;m<O.length;++m)w.addSubParam(O[m]);else w.addParam(O)}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,O=255&this._subParamsIdx[w];O-_>0&&D.push(Array.prototype.slice.call(this._subParams,_,O))}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,O=255&this._subParamsIdx[w];O-_>0&&(D[w]=this._subParams.slice(_,O))}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,O=_[w-1];_[w-1]=~O?Math.min(10*O+D,2147483647):D}},K}();b.Params=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.OscHandler=b.OscParser=void 0;var I=k(23),K=k(8),D=function(){function _(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return _.prototype.addHandler=function(O,m){this._handlers[O]===void 0&&(this._handlers[O]=[]);var n=this._handlers[O];return n.push(m),{dispose:function(){var y=n.indexOf(m);y!==-1&&n.splice(y,1)}}},_.prototype.setHandler=function(O,m){this._handlers[O]=[m]},_.prototype.clearHandler=function(O){this._handlers[O]&&delete this._handlers[O]},_.prototype.setHandlerFallback=function(O){this._handlerFb=O},_.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 O=this._handlers[this._id];if(O)for(var m=O.length-1;m>=0;m--)O[m].start();else this._handlerFb(this._id,"START")},_.prototype._put=function(O,m,n){var y=this._handlers[this._id];if(y)for(var f=y.length-1;f>=0;f--)y[f].put(O,m,n);else this._handlerFb(this._id,"PUT",K.utf32ToString(O,m,n))},_.prototype._end=function(O){var m=this._handlers[this._id];if(m){for(var n=m.length-1;n>=0&&m[n].end(O)===!1;n--);for(n--;n>=0;n--)m[n].end(!1)}else this._handlerFb(this._id,"END",O)},_.prototype.start=function(){this.reset(),this._id=-1,this._state=1},_.prototype.put=function(O,m,n){if(this._state!==3){if(this._state===1)for(;m<n;){var y=O[m++];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&&n-m>0&&this._put(O,m,n)}},_.prototype.end=function(O){this._state!==0&&(this._state!==3&&(this._state===1&&this._start(),this._end(O)),this._id=-1,this._state=0)},_}();b.OscParser=D;var w=function(){function _(O){this._handler=O,this._data="",this._hitLimit=!1}return _.prototype.start=function(){this._data="",this._hitLimit=!1},_.prototype.put=function(O,m,n){this._hitLimit||(this._data+=K.utf32ToString(O,m,n),this._data.length>I.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},_.prototype.end=function(O){var m;return this._hitLimit?m=!1:O&&(m=this._handler(this._data)),this._data="",this._hitLimit=!1,m},_}();b.OscHandler=w},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.PAYLOAD_LIMIT=void 0,b.PAYLOAD_LIMIT=1e7},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.DcsHandler=b.DcsParser=void 0;var I=k(8),K=k(21),D=k(23),w=[],_=function(){function m(){this._handlers=Object.create(null),this._active=w,this._ident=0,this._handlerFb=function(){}}return m.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},m.prototype.addHandler=function(n,y){this._handlers[n]===void 0&&(this._handlers[n]=[]);var f=this._handlers[n];return f.push(y),{dispose:function(){var c=f.indexOf(y);c!==-1&&f.splice(c,1)}}},m.prototype.setHandler=function(n,y){this._handlers[n]=[y]},m.prototype.clearHandler=function(n){this._handlers[n]&&delete this._handlers[n]},m.prototype.setHandlerFallback=function(n){this._handlerFb=n},m.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=w,this._ident=0},m.prototype.hook=function(n,y){if(this.reset(),this._ident=n,this._active=this._handlers[n]||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)},m.prototype.put=function(n,y,f){if(this._active.length)for(var c=this._active.length-1;c>=0;c--)this._active[c].put(n,y,f);else this._handlerFb(this._ident,"PUT",I.utf32ToString(n,y,f))},m.prototype.unhook=function(n){if(this._active.length){for(var y=this._active.length-1;y>=0&&this._active[y].unhook(n)===!1;y--);for(y--;y>=0;y--)this._active[y].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",n);this._active=w,this._ident=0},m}();b.DcsParser=_;var O=function(){function m(n){this._handler=n,this._data="",this._hitLimit=!1}return m.prototype.hook=function(n){this._params=n.clone(),this._data="",this._hitLimit=!1},m.prototype.put=function(n,y,f){this._hitLimit||(this._data+=I.utf32ToString(n,y,f),this._data.length>D.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},m.prototype.unhook=function(n){var y;return this._hitLimit?y=!1:n&&(y=this._handler(this._data,this._params||new K.Params)),this._params=void 0,this._data="",this._hitLimit=!1,y},m}();b.DcsHandler=O},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.removeTerminalFromCache=b.acquireCharAtlas=void 0;var I=k(26),K=k(43),D=[];b.acquireCharAtlas=function(w,_,O,m,n){for(var y=I.generateConfig(m,n,w,O),f=0;f<D.length;f++){var c=(l=D[f]).ownedBy.indexOf(_);if(c>=0){if(I.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(I.configEquals(l.config,y))return l.ownedBy.push(_),l.atlas}var u={atlas:new K.DynamicCharAtlas(document,y),config:y,ownedBy:[_]};return D.push(u),u.atlas},b.removeTerminalFromCache=function(w){for(var _=0;_<D.length;_++){var O=D[_].ownedBy.indexOf(w);if(O!==-1){D[_].ownedBy.length===1?(D[_].atlas.dispose(),D.splice(_,1)):D[_].ownedBy.splice(O,1);break}}}},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.is256Color=b.configEquals=b.generateConfig=void 0;var I=k(3);b.generateConfig=function(K,D,w,_){var O={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:O}},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<I.DEFAULT_COLOR}},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ColorManager=b.DEFAULT_ANSI_COLORS=void 0;var I=k(10),K=k(45),D=I.css.toColor("#ffffff"),w=I.css.toColor("#000000"),_=I.css.toColor("#ffffff"),O=I.css.toColor("#000000"),m={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};b.DEFAULT_ANSI_COLORS=function(){for(var y=[I.css.toColor("#2e3436"),I.css.toColor("#cc0000"),I.css.toColor("#4e9a06"),I.css.toColor("#c4a000"),I.css.toColor("#3465a4"),I.css.toColor("#75507b"),I.css.toColor("#06989a"),I.css.toColor("#d3d7cf"),I.css.toColor("#555753"),I.css.toColor("#ef2929"),I.css.toColor("#8ae234"),I.css.toColor("#fce94f"),I.css.toColor("#729fcf"),I.css.toColor("#ad7fa8"),I.css.toColor("#34e2e2"),I.css.toColor("#eeeeec")],f=[0,95,135,175,215,255],c=0;c<216;c++){var l=f[c/36%6|0],u=f[c/6%6|0],p=f[c%6];y.push({css:I.channels.toCss(l,u,p),rgba:I.channels.toRgba(l,u,p)})}for(c=0;c<24;c++){var E=8+10*c;y.push({css:I.channels.toCss(E,E,E),rgba:I.channels.toRgba(E,E,E)})}return y}();var n=function(){function y(f,c){this.allowTransparency=c;var l=f.createElement("canvas");l.width=1,l.height=1;var u=l.getContext("2d");if(!u)throw new Error("Could not get rendering context");this._ctx=u,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:O,selectionTransparent:m,selectionOpaque:I.color.blend(w,m),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,O,!0),this.colors.selectionTransparent=this._parseColor(f.selection,m,!0),this.colors.selectionOpaque=I.color.blend(this.colors.background,this.colors.selectionTransparent),I.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=I.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 u=this._ctx.getImageData(0,0,1,1).data;if(u[3]!==255){if(!l)return console.warn("Color: "+f+" is using transparency, but allowTransparency is false. Using fallback "+c.css+"."),c;var p=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(function(P){return Number(P)}),E=p[0],T=p[1],L=p[2],x=p[3],A=Math.round(255*x);return{rgba:I.channels.toRgba(E,T,L,A),css:f}}return{css:this._ctx.fillStyle,rgba:I.channels.toRgba(u[0],u[1],u[2],u[3])}},y}();b.ColorManager=n},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.throwIfFalsy=void 0,b.throwIfFalsy=function(I){if(!I)throw new Error("value must not be falsy");return I}},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(n,y){return(I=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])})(n,y)},function(n,y){function f(){this.constructor=n}I(n,y),n.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=k(6),w=k(3),_=k(4),O=function(n){function y(f,c,l){var u=n.call(this)||this;return u.content=0,u.combinedData="",u.fg=f.fg,u.bg=f.bg,u.combinedData=c,u._width=l,u}return K(y,n),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=O;var m=function(){function n(y){this._bufferService=y,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}return n.prototype.registerCharacterJoiner=function(y){var f={id:this._nextCharacterJoinerId++,handler:y};return this._characterJoiners.push(f),f.id},n.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},n.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),u=0,p=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-u>1)for(var A=this._getJoinedRanges(l,E,p,f,u),P=0;P<A.length;P++)c.push(A[P]);u=x,E=p,T=this._workCell.fg,L=this._workCell.bg}p+=this._workCell.getChars().length||w.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-u>1)for(A=this._getJoinedRanges(l,E,p,f,u),P=0;P<A.length;P++)c.push(A[P]);return c},n.prototype._getJoinedRanges=function(y,f,c,l,u){for(var p=y.substring(f,c),E=this._characterJoiners[0].handler(p),T=1;T<this._characterJoiners.length;T++)for(var L=this._characterJoiners[T].handler(p),x=0;x<L.length;x++)n._mergeRanges(E,L[x]);return this._stringRangesToCellRanges(E,l,u),E},n.prototype._stringRangesToCellRanges=function(y,f,c){var l=0,u=!1,p=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(!u&&E[0]<=p&&(E[0]=T,u=!0),E[1]<=p){if(E[1]=T,!(E=y[++l]))break;E[0]<=p?(E[0]=T,u=!0):u=!1}p+=x}}E&&(E[1]=this._bufferService.cols)}},n._mergeRanges=function(y,f){for(var c=!1,l=0;l<y.length;l++){var u=y[l];if(c){if(f[1]<=u[0])return y[l-1][1]=f[1],y;if(f[1]<=u[1])return y[l-1][1]=Math.max(f[1],u[1]),y.splice(l,1),y;y.splice(l,1),l--}else{if(f[1]<=u[0])return y.splice(l,0,f),y;if(f[1]<=u[1])return u[0]=Math.min(f[0],u[0]),y;f[0]<u[1]&&(u[0]=Math.min(f[0],u[0]),c=!0)}}return c?y[y.length-1][1]=f[1]:y.push(f),y},n}();b.CharacterJoinerRegistry=m},function(me,b,k){"use strict";function I(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=I,b.getCoords=function(K,D,w,_,O,m,n,y){if(O){var f=I(K,D);if(f)return f[0]=Math.ceil((f[0]+(y?m/2:0))/m),f[1]=Math.ceil(f[1]/n),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(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.RenderDebouncer=void 0;var I=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 O=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 O._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=I},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(w,_){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(O,m){O.__proto__=m}||function(O,m){for(var n in m)m.hasOwnProperty(n)&&(O[n]=m[n])})(w,_)},function(w,_){function O(){this.constructor=w}I(w,_),w.prototype=_===null?Object.create(_):(O.prototype=_.prototype,new O)});Object.defineProperty(b,"__esModule",{value:!0}),b.ScreenDprMonitor=void 0;var D=function(w){function _(){var O=w!==null&&w.apply(this,arguments)||this;return O._currentDevicePixelRatio=window.devicePixelRatio,O}return K(_,w),_.prototype.setListener=function(O){var m=this;this._listener&&this.clearListener(),this._listener=O,this._outerListener=function(){m._listener&&(m._listener(window.devicePixelRatio,m._currentDevicePixelRatio),m._updateDpr())},this._updateDpr()},_.prototype.dispose=function(){w.prototype.dispose.call(this),this.clearListener()},_.prototype._updateDpr=function(){var O;this._outerListener&&((O=this._resolutionMediaMatchList)===null||O===void 0||O.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)},_}(k(2).Disposable);b.ScreenDprMonitor=D},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.clone=void 0,b.clone=function I(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[_]?I(K[_],D-1):K[_];return w}},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;var I=k(4),K=k(35),D=k(18),w=k(0),_=k(83),O=function(){function l(u){this._core=new K.Terminal(u),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 n(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(u,p){this._verifyIntegers(u,p),this._core.resize(u,p)},l.prototype.open=function(u){this._core.open(u)},l.prototype.attachCustomKeyEventHandler=function(u){this._core.attachCustomKeyEventHandler(u)},l.prototype.registerLinkMatcher=function(u,p,E){return this._checkProposedApi(),this._core.registerLinkMatcher(u,p,E)},l.prototype.deregisterLinkMatcher=function(u){this._checkProposedApi(),this._core.deregisterLinkMatcher(u)},l.prototype.registerLinkProvider=function(u){return this._checkProposedApi(),this._core.registerLinkProvider(u)},l.prototype.registerCharacterJoiner=function(u){return this._checkProposedApi(),this._core.registerCharacterJoiner(u)},l.prototype.deregisterCharacterJoiner=function(u){this._checkProposedApi(),this._core.deregisterCharacterJoiner(u)},l.prototype.registerMarker=function(u){return this._checkProposedApi(),this._verifyIntegers(u),this._core.addMarker(u)},l.prototype.addMarker=function(u){return this.registerMarker(u)},l.prototype.hasSelection=function(){return this._core.hasSelection()},l.prototype.select=function(u,p,E){this._verifyIntegers(u,p,E),this._core.select(u,p,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(u,p){this._verifyIntegers(u,p),this._core.selectLines(u,p)},l.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},l.prototype.scrollLines=function(u){this._verifyIntegers(u),this._core.scrollLines(u)},l.prototype.scrollPages=function(u){this._verifyIntegers(u),this._core.scrollPages(u)},l.prototype.scrollToTop=function(){this._core.scrollToTop()},l.prototype.scrollToBottom=function(){this._core.scrollToBottom()},l.prototype.scrollToLine=function(u){this._verifyIntegers(u),this._core.scrollToLine(u)},l.prototype.clear=function(){this._core.clear()},l.prototype.write=function(u,p){this._core.write(u,p)},l.prototype.writeUtf8=function(u,p){this._core.write(u,p)},l.prototype.writeln=function(u,p){this._core.write(u),this._core.write(`\r
`,p)},l.prototype.paste=function(u){this._core.paste(u)},l.prototype.getOption=function(u){return this._core.optionsService.getOption(u)},l.prototype.setOption=function(u,p){this._core.optionsService.setOption(u,p)},l.prototype.refresh=function(u,p){this._verifyIntegers(u,p),this._core.refresh(u,p)},l.prototype.reset=function(){this._core.reset()},l.prototype.loadAddon=function(u){return this._addonManager.loadAddon(this,u)},Object.defineProperty(l,"strings",{get:function(){return D},enumerable:!1,configurable:!0}),l.prototype._verifyIntegers=function(){for(var u=[],p=0;p<arguments.length;p++)u[p]=arguments[p];for(var E=0,T=u;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=O;var m=function(){function l(u,p){this._buffer=u,this.type=p}return l.prototype.init=function(u){return this._buffer=u,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(u){var p=this._buffer.lines.get(u);if(p)return new y(p)},l.prototype.getNullCell=function(){return new I.CellData},l}(),n=function(){function l(u){var p=this;this._buffers=u,this._onBufferChange=new w.EventEmitter,this._normal=new m(this._buffers.normal,"normal"),this._alternate=new m(this._buffers.alt,"alternate"),this._buffers.onBufferActivate(function(){return p._onBufferChange.fire(p.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(u){this._line=u}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(u,p){if(!(u<0||u>=this._line.length))return p?(this._line.loadCell(u,p),p):this._line.loadCell(u,new I.CellData)},l.prototype.translateToString=function(u,p,E){return this._line.translateToString(u,p,E)},l}(),f=function(){function l(u){this._core=u}return l.prototype.registerCsiHandler=function(u,p){return this._core.addCsiHandler(u,function(E){return p(E.toArray())})},l.prototype.addCsiHandler=function(u,p){return this.registerCsiHandler(u,p)},l.prototype.registerDcsHandler=function(u,p){return this._core.addDcsHandler(u,function(E,T){return p(E,T.toArray())})},l.prototype.addDcsHandler=function(u,p){return this.registerDcsHandler(u,p)},l.prototype.registerEscHandler=function(u,p){return this._core.addEscHandler(u,p)},l.prototype.addEscHandler=function(u,p){return this.registerEscHandler(u,p)},l.prototype.registerOscHandler=function(u,p){return this._core.addOscHandler(u,p)},l.prototype.addOscHandler=function(u,p){return this.registerOscHandler(u,p)},l}(),c=function(){function l(u){this._core=u}return l.prototype.register=function(u){this._core.unicodeService.register(u)},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(u){this._core.unicodeService.activeVersion=u},enumerable:!1,configurable:!0}),l}()},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(Z,B){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(G,W){G.__proto__=W}||function(G,W){for(var R in W)W.hasOwnProperty(R)&&(G[R]=W[R])})(Z,B)},function(Z,B){function G(){this.constructor=Z}I(Z,B),Z.prototype=B===null?Object.create(B):(G.prototype=B.prototype,new G)});Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;var D=k(36),w=k(37),_=k(38),O=k(12),m=k(19),n=k(40),y=k(50),f=k(51),c=k(11),l=k(7),u=k(18),p=k(54),E=k(55),T=k(56),L=k(57),x=k(59),A=k(0),P=k(16),U=k(27),N=k(60),H=k(5),F=k(61),Y=k(62),V=k(63),ne=k(64),ae=k(65),J=typeof window!="undefined"?window.document:null,z=function(Z){function B(G){G===void 0&&(G={});var W=Z.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(V.Linkifier2)),W.register(W._inputHandler.onRequestBell(function(){return W.bell()})),W.register(W._inputHandler.onRequestRefreshRows(function(R,C){return W.refresh(R,C)})),W.register(W._inputHandler.onRequestReset(function(){return W.reset()})),W.register(W._inputHandler.onRequestScroll(function(R,C){return W.scroll(R,C||void 0)})),W.register(W._inputHandler.onRequestWindowsOptionsReport(function(R){return W._reportWindowsOptions(R)})),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(R){return W._afterResize(R.cols,R.rows)})),W}return K(B,Z),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,R;this._isDisposed||(Z.prototype.dispose.call(this),(G=this._renderService)===null||G===void 0||G.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},(R=(W=this.element)===null||W===void 0?void 0:W.parentNode)===null||R===void 0||R.removeChild(this.element))},B.prototype._setup=function(){Z.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,R,C,q;switch(Z.prototype._updateOptions.call(this,G),G){case"fontFamily":case"fontSize":(W=this._renderService)===null||W===void 0||W.clear(),(R=this._charSizeService)===null||R===void 0||R.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)):((q=this._accessibilityManager)===null||q===void 0||q.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(O.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(O.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,R=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=R+"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(R){G.hasSelection()&&_.copyHandler(R,G._selectionService)}));var W=function(R){return _.handlePasteEvent(R,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(R){R.button===2&&_.rightClickHandler(R,G.textarea,G.screenElement,G._selectionService,G.options.rightClickSelectsWord)})):this.register(l.addDisposableDomListener(this.element,"contextmenu",function(R){_.rightClickHandler(R,G.textarea,G.screenElement,G._selectionService,G.options.rightClickSelectsWord)})),c.isLinux&&this.register(l.addDisposableDomListener(this.element,"auxclick",function(R){R.button===1&&_.moveTextAreaUnderMouseCursor(R,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 R=J.createDocumentFragment();this._viewportElement=J.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),R.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),R.appendChild(this.screenElement),this.textarea=J.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",u.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(re){return W._onTextAreaFocus(re)})),this.register(l.addDisposableDomListener(this.textarea,"blur",function(){return W._onTextAreaBlur()})),this._helperContainer.appendChild(this.textarea);var C=this._instantiationService.createInstance(ne.CoreBrowserService,this.textarea);this._instantiationService.setService(H.ICoreBrowserService,C),this._charSizeService=this._instantiationService.createInstance(F.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(H.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(R),this._theme=this.options.theme||this._theme,this._colorManager=new U.ColorManager(J,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(function(re){return W._colorManager.onOptionsChange(re)})),this._colorManager.setTheme(this._theme);var q=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(N.RenderService,q,this.rows,this.screenElement)),this._instantiationService.setService(H.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange(function(re){return W._onRender.fire(re)})),this.onResize(function(re){return W._renderService.resize(re.cols,re.rows)}),this._soundService=this._instantiationService.createInstance(p.SoundService),this._instantiationService.setService(H.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(Y.MouseService),this._instantiationService.setService(H.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(w.Viewport,function(re,_e){return W.scrollLines(re,_e)},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(H.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(function(re){return W.scrollLines(re.amount,re.suppressScrollEvent)})),this.register(this._selectionService.onSelectionChange(function(){return W._onSelectionChange.fire()})),this.register(this._selectionService.onRequestRedraw(function(re){return W._renderService.onSelectionChanged(re.start,re.end,re.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(re){W.textarea.value=re,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(re){return W._selectionService.onMouseDown(re)})),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(n.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,R,C;this._theme=G,(W=this._colorManager)===null||W===void 0||W.setTheme(G),(R=this._renderService)===null||R===void 0||R.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,R=this.element;function C(be){var je,Me,Oe=W._mouseService.getRawByteCoords(be,W.screenElement,W.cols,W.rows);if(!Oe)return!1;switch(be.overrideType||be.type){case"mousemove":Me=32,be.buttons===void 0?(je=3,be.button!==void 0&&(je=be.button<3?be.button:3)):je=1&be.buttons?0:4&be.buttons?1:2&be.buttons?2:3;break;case"mouseup":Me=0,je=be.button<3?be.button:3;break;case"mousedown":Me=1,je=be.button<3?be.button:3;break;case"wheel":be.deltaY!==0&&(Me=be.deltaY<0?0:1),je=4;break;default:return!1}return!(Me===void 0||je===void 0||je>4)&&W._coreMouseService.triggerMouseEvent({col:Oe.x-33,row:Oe.y-33,button:je,action:Me,ctrl:be.ctrlKey,alt:be.altKey,shift:be.shiftKey})}var q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},re=function(be){return C(be),be.buttons||(G._document.removeEventListener("mouseup",q.mouseup),q.mousedrag&&G._document.removeEventListener("mousemove",q.mousedrag)),G.cancel(be)},_e=function(be){return C(be),be.preventDefault(),G.cancel(be)},Le=function(be){be.buttons&&C(be)},qe=function(be){be.buttons||C(be)};this.register(this._coreMouseService.onProtocolChange(function(be){be?(G.optionsService.options.logLevel==="debug"&&G._logService.debug("Binding to mouse events:",G._coreMouseService.explainEvents(be)),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&be?q.mousemove||(R.addEventListener("mousemove",qe),q.mousemove=qe):(R.removeEventListener("mousemove",q.mousemove),q.mousemove=null),16&be?q.wheel||(R.addEventListener("wheel",_e,{passive:!1}),q.wheel=_e):(R.removeEventListener("wheel",q.wheel),q.wheel=null),2&be?q.mouseup||(q.mouseup=re):(G._document.removeEventListener("mouseup",q.mouseup),q.mouseup=null),4&be?q.mousedrag||(q.mousedrag=Le):(G._document.removeEventListener("mousemove",q.mousedrag),q.mousedrag=null)})),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(l.addDisposableDomListener(R,"mousedown",function(be){if(be.preventDefault(),G.focus(),G._coreMouseService.areMouseEventsActive&&!G._selectionService.shouldForceSelection(be))return C(be),q.mouseup&&G._document.addEventListener("mouseup",q.mouseup),q.mousedrag&&G._document.addEventListener("mousemove",q.mousedrag),G.cancel(be)})),this.register(l.addDisposableDomListener(R,"wheel",function(be){if(!q.wheel){if(!G.buffer.hasScrollback){var je=G.viewport.getLinesScrolled(be);if(je===0)return;for(var Me=O.C0.ESC+(G._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(be.deltaY<0?"A":"B"),Oe="",wt=0;wt<Math.abs(je);wt++)Oe+=Me;G._coreService.triggerDataEvent(Oe,!0)}}},{passive:!0})),this.register(l.addDisposableDomListener(R,"wheel",function(be){if(!q.wheel)return G.viewport.onWheel(be)?void 0:G.cancel(be)},{passive:!1})),this.register(l.addDisposableDomListener(R,"touchstart",function(be){if(!G._coreMouseService.areMouseEventsActive)return G.viewport.onTouchStart(be),G.cancel(be)},{passive:!0})),this.register(l.addDisposableDomListener(R,"touchmove",function(be){if(!G._coreMouseService.areMouseEventsActive)return G.viewport.onTouchMove(be)?void 0:G.cancel(be)},{passive:!1}))},B.prototype.refresh=function(G,W){var R;(R=this._renderService)===null||R===void 0||R.refreshRows(G,W)},B.prototype._queueLinkification=function(G,W){var R;(R=this.linkifier)===null||R===void 0||R.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){Z.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,R){var C=this.linkifier.registerLinkMatcher(G,W,R);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,R){this._selectionService.setSelection(G,W,R)},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 R;(R=this._selectionService)===null||R===void 0||R.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 R=this.rows-1;return this.scrollLines(W.type===2?-R:R),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!==O.C0.ETX&&W.key!==O.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 R=G.isMac&&!this.options.macOptionIsMeta&&W.altKey&&!W.ctrlKey&&!W.metaKey||G.isWindows&&W.altKey&&W.ctrlKey&&!W.metaKey;return W.type==="keypress"?R:R&&(!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?Z.prototype.resize.call(this,G,W):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},B.prototype._afterResize=function(G,W){var R,C;(R=this._charSizeService)===null||R===void 0||R.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(P.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 R=this._customKeyEventHandler;this._setup(),Z.prototype.reset.call(this),(G=this._selectionService)===null||G===void 0||G.reset(),this._customKeyEventHandler=R,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 m.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var W=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),R=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this._coreService.triggerDataEvent(O.C0.ESC+"[4;"+R+";"+W+"t");break;case m.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var C=this._renderService.dimensions.scaledCellWidth.toFixed(0),q=this._renderService.dimensions.scaledCellHeight.toFixed(0);this._coreService.triggerDataEvent(O.C0.ESC+"[6;"+q+";"+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}(ae.CoreTerminal);b.Terminal=z},function(me,b,k){"use strict";var I=this&&this.__decorate||function(O,m,n,y){var f,c=arguments.length,l=c<3?m:y===null?y=Object.getOwnPropertyDescriptor(m,n):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(O,m,n,y);else for(var u=O.length-1;u>=0;u--)(f=O[u])&&(l=(c<3?f(l):c>3?f(m,n,l):f(m,n))||l);return c>3&&l&&Object.defineProperty(m,n,l),l},K=this&&this.__param||function(O,m){return function(n,y){m(n,y,O)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CompositionHelper=void 0;var D=k(5),w=k(1),_=function(){function O(m,n,y,f,c,l){this._textarea=m,this._compositionView=n,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(O.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),O.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._compositionView.classList.add("active")},O.prototype.compositionupdate=function(m){var n=this;this._compositionView.textContent=m.data,this.updateCompositionElements(),setTimeout(function(){n._compositionPosition.end=n._textarea.value.length},0)},O.prototype.compositionend=function(){this._finalizeComposition(!0)},O.prototype.keydown=function(m){if(this._isComposing||this._isSendingComposition){if(m.keyCode===229||m.keyCode===16||m.keyCode===17||m.keyCode===18)return!1;this._finalizeComposition(!1)}return m.keyCode!==229||(this._handleAnyTextareaChanges(),!1)},O.prototype._finalizeComposition=function(m){var n=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,m){var y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(function(){if(n._isSendingComposition){n._isSendingComposition=!1;var c=void 0;c=n._isComposing?n._textarea.value.substring(y.start,y.end):n._textarea.value.substring(y.start),n._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)}},O.prototype._handleAnyTextareaChanges=function(){var m=this,n=this._textarea.value;setTimeout(function(){if(!m._isComposing){var y=m._textarea.value.replace(n,"");y.length>0&&m._coreService.triggerDataEvent(y,!0)}},0)},O.prototype.updateCompositionElements=function(m){var n=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"}m||setTimeout(function(){return n.updateCompositionElements(!0)},0)}},O=I([K(2,w.IBufferService),K(3,w.IOptionsService),K(4,D.ICharSizeService),K(5,w.ICoreService)],O)}();b.CompositionHelper=_},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(f,c){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var p in u)u.hasOwnProperty(p)&&(l[p]=u[p])})(f,c)},function(f,c){function l(){this.constructor=f}I(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,u){var p,E=arguments.length,T=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(T=(E<3?p(T):E>3?p(c,l,T):p(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,u){c(l,u,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Viewport=void 0;var _=k(2),O=k(7),m=k(5),n=k(1),y=function(f){function c(l,u,p,E,T,L,x){var A=f.call(this)||this;return A._scrollLines=l,A._viewportElement=u,A._scrollArea=p,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(O.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 u=this;if(l)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return u._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 u=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==u&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=u),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 u=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===u&&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 u=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(u,!0)}},c.prototype._bubbleScroll=function(l,u){var p=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(u<0&&this._viewportElement.scrollTop!==0||u>0&&p<this._lastRecordedBufferHeight)||(l.cancelable&&l.preventDefault(),!1)},c.prototype.onWheel=function(l){var u=this._getPixelsScrolled(l);return u!==0&&(this._viewportElement.scrollTop+=u,this._bubbleScroll(l,u))},c.prototype._getPixelsScrolled=function(l){if(l.deltaY===0)return 0;var u=this._applyScrollModifier(l.deltaY,l);return l.deltaMode===WheelEvent.DOM_DELTA_LINE?u*=this._currentRowHeight:l.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(u*=this._currentRowHeight*this._bufferService.rows),u},c.prototype.getLinesScrolled=function(l){if(l.deltaY===0)return 0;var u=this._applyScrollModifier(l.deltaY,l);return l.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(u/=this._currentRowHeight+0,this._wheelPartialScroll+=u,u=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):l.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(u*=this._bufferService.rows),u},c.prototype._applyScrollModifier=function(l,u){var p=this._optionsService.options.fastScrollModifier;return p==="alt"&&u.altKey||p==="ctrl"&&u.ctrlKey||p==="shift"&&u.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 u=this._lastTouchY-l.touches[0].pageY;return this._lastTouchY=l.touches[0].pageY,u!==0&&(this._viewportElement.scrollTop+=u,this._bubbleScroll(l,u))},c=D([w(3,n.IBufferService),w(4,n.IOptionsService),w(5,m.ICharSizeService),w(6,m.IRenderService)],c)}(_.Disposable);b.Viewport=y},function(me,b,k){"use strict";function I(_){return _.replace(/\r?\n/g,"\r")}function K(_,O){return O?"\x1B[200~"+_+"\x1B[201~":_}function D(_,O,m){_=K(_=I(_),m.decPrivateModes.bracketedPasteMode),m.triggerDataEvent(_,!0),O.value=""}function w(_,O,m){var n=m.getBoundingClientRect(),y=_.clientX-n.left-10,f=_.clientY-n.top-10;O.style.width="20px",O.style.height="20px",O.style.left=y+"px",O.style.top=f+"px",O.style.zIndex="1000",O.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=I,b.bracketTextForPaste=K,b.copyHandler=function(_,O){_.clipboardData&&_.clipboardData.setData("text/plain",O.selectionText),_.preventDefault()},b.handlePasteEvent=function(_,O,m){_.stopPropagation(),_.clipboardData&&D(_.clipboardData.getData("text/plain"),O,m)},b.paste=D,b.moveTextAreaUnderMouseCursor=w,b.rightClickHandler=function(_,O,m,n,y){w(_,O,m),y&&!n.isClickInSelection(_)&&n.selectWordAtCursor(_),O.value=n.selectionText,O.select()}},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(f,c){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var p in u)u.hasOwnProperty(p)&&(l[p]=u[p])})(f,c)},function(f,c){function l(){this.constructor=f}I(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=k(2),w=k(15),_=k(21),O=k(22),m=k(24),n=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,u,p){this.table[l<<8|c]=u<<4|p},f.prototype.addMany=function(c,l,u,p){for(var E=0;E<c.length;E++)this.table[l<<8|c[E]]=u<<4|p},f}();b.TransitionTable=n,b.VT500_TRANSITION_TABLE=function(){var f=new n(4095),c=Array.apply(null,Array(256)).map(function(L,x){return x}),l=function(L,x){return c.slice(L,x)},u=l(32,127),p=l(0,24);p.push(25),p.push.apply(p,l(28,32));var E,T=l(0,14);for(E in f.setDefault(1,0),f.addMany(u,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(p,0,3,0),f.addMany(p,1,3,1),f.add(127,1,0,1),f.addMany(p,8,0,8),f.addMany(p,3,3,3),f.add(127,3,0,3),f.addMany(p,4,3,4),f.add(127,4,0,4),f.addMany(p,6,3,6),f.addMany(p,5,3,5),f.add(127,5,0,5),f.addMany(p,2,3,2),f.add(127,2,0,2),f.add(93,1,4,8),f.addMany(u,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(u,7,0,7),f.addMany(p,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(p,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(p,11,0,11),f.addMany(l(32,128),11,0,11),f.addMany(l(28,32),11,0,11),f.addMany(p,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(p,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(p,13,13,13),f.addMany(u,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 u=f.call(this)||this;return u._transitions=l,u.initialState=0,u.currentState=u.initialState,u._params=new _.Params,u._params.addParam(0),u._collect=0,u.precedingCodepoint=0,u._printHandlerFb=function(p,E,T){},u._executeHandlerFb=function(p){},u._csiHandlerFb=function(p,E){},u._escHandlerFb=function(p){},u._errorHandlerFb=function(p){return p},u._printHandler=u._printHandlerFb,u._executeHandlers=Object.create(null),u._csiHandlers=Object.create(null),u._escHandlers=Object.create(null),u._oscParser=new O.OscParser,u._dcsParser=new m.DcsParser,u._errorHandler=u._errorHandlerFb,u.setEscHandler({final:"\\"},function(){}),u}return K(c,f),c.prototype._identifier=function(l,u){u===void 0&&(u=[64,126]);var p=0;if(l.prefix){if(l.prefix.length>1)throw new Error("only one byte as prefix supported");if((p=l.prefix.charCodeAt(0))&&60>p||p>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");p<<=8,p|=T}}if(l.final.length!==1)throw new Error("final must be a single byte");var L=l.final.charCodeAt(0);if(u[0]>L||L>u[1])throw new Error("final must be in range "+u[0]+" .. "+u[1]);return p<<=8,p|=L},c.prototype.identToString=function(l){for(var u=[];l;)u.push(String.fromCharCode(255&l)),l>>=8;return u.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,u){var p=this._identifier(l,[48,126]);this._escHandlers[p]===void 0&&(this._escHandlers[p]=[]);var E=this._escHandlers[p];return E.push(u),{dispose:function(){var T=E.indexOf(u);T!==-1&&E.splice(T,1)}}},c.prototype.setEscHandler=function(l,u){this._escHandlers[this._identifier(l,[48,126])]=[u]},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,u){this._executeHandlers[l.charCodeAt(0)]=u},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,u){var p=this._identifier(l);this._csiHandlers[p]===void 0&&(this._csiHandlers[p]=[]);var E=this._csiHandlers[p];return E.push(u),{dispose:function(){var T=E.indexOf(u);T!==-1&&E.splice(T,1)}}},c.prototype.setCsiHandler=function(l,u){this._csiHandlers[this._identifier(l)]=[u]},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,u){return this._dcsParser.addHandler(this._identifier(l),u)},c.prototype.setDcsHandler=function(l,u){this._dcsParser.setHandler(this._identifier(l),u)},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,u){return this._oscParser.addHandler(l,u)},c.prototype.setOscHandler=function(l,u){this._oscParser.setHandler(l,u)},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,u){for(var p=0,E=0,T=this.currentState,L=this._oscParser,x=this._dcsParser,A=this._collect,P=this._params,U=this._transitions.table,N=0;N<u;++N){switch((E=U[T<<8|((p=l[N])<160?p:160)])>>4){case 2:for(var H=N+1;;++H){if(H>=u||(p=l[H])<32||p>126&&p<160){this._printHandler(l,N,H),N=H-1;break}if(++H>=u||(p=l[H])<32||p>126&&p<160){this._printHandler(l,N,H),N=H-1;break}if(++H>=u||(p=l[H])<32||p>126&&p<160){this._printHandler(l,N,H),N=H-1;break}if(++H>=u||(p=l[H])<32||p>126&&p<160){this._printHandler(l,N,H),N=H-1;break}}break;case 3:this._executeHandlers[p]?this._executeHandlers[p]():this._executeHandlerFb(p),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:N,code:p,currentState:T,collect:A,params:P,abort:!1}).abort)return;break;case 7:for(var F=this._csiHandlers[A<<8|p],Y=F?F.length-1:-1;Y>=0&&F[Y](P)===!1;Y--);Y<0&&this._csiHandlerFb(A<<8|p,P),this.precedingCodepoint=0;break;case 8:do switch(p){case 59:P.addParam(0);break;case 58:P.addSubParam(-1);break;default:P.addDigit(p-48)}while(++N<u&&(p=l[N])>47&&p<60);N--;break;case 9:A<<=8,A|=p;break;case 10:for(var V=this._escHandlers[A<<8|p],ne=V?V.length-1:-1;ne>=0&&V[ne]()===!1;ne--);ne<0&&this._escHandlerFb(A<<8|p),this.precedingCodepoint=0;break;case 11:P.reset(),P.addParam(0),A=0;break;case 12:x.hook(A<<8|p,P);break;case 13:for(var ae=N+1;;++ae)if(ae>=u||(p=l[ae])===24||p===26||p===27||p>127&&p<160){x.put(l,N,ae),N=ae-1;break}break;case 14:x.unhook(p!==24&&p!==26),p===27&&(E|=1),P.reset(),P.addParam(0),A=0,this.precedingCodepoint=0;break;case 4:L.start();break;case 5:for(var J=N+1;;J++)if(J>=u||(p=l[J])<32||p>127&&p<=159){L.put(l,N,J),N=J-1;break}break;case 6:L.end(p!==24&&p!==26),p===27&&(E|=1),P.reset(),P.addParam(0),A=0,this.precedingCodepoint=0}T=15&E}this._collect=A,this.currentState=T},c}(D.Disposable);b.EscapeSequenceParser=y},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(L,x){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,P){A.__proto__=P}||function(A,P){for(var U in P)P.hasOwnProperty(U)&&(A[U]=P[U])})(L,x)},function(L,x){function A(){this.constructor=L}I(L,x),L.prototype=x===null?Object.create(x):(A.prototype=x.prototype,new A)}),D=this&&this.__decorate||function(L,x,A,P){var U,N=arguments.length,H=N<3?x:P===null?P=Object.getOwnPropertyDescriptor(x,A):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(L,x,A,P);else for(var F=L.length-1;F>=0;F--)(U=L[F])&&(H=(N<3?U(H):N>3?U(x,A,H):U(x,A))||H);return N>3&&H&&Object.defineProperty(x,A,H),H},w=this&&this.__param||function(L,x){return function(A,P){x(A,P,L)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Renderer=void 0;var _=k(41),O=k(47),m=k(48),n=k(49),y=k(29),f=k(2),c=k(5),l=k(1),u=k(25),p=k(0),E=1,T=function(L){function x(A,P,U,N,H,F,Y,V,ne){var ae=L.call(this)||this;ae._colors=A,ae._screenElement=P,ae._bufferService=H,ae._charSizeService=F,ae._optionsService=Y,ae._id=E++,ae._onRequestRedraw=new p.EventEmitter;var J=ae._optionsService.options.allowTransparency;return ae._characterJoinerRegistry=new y.CharacterJoinerRegistry(ae._bufferService),ae._renderLayers=[new _.TextRenderLayer(ae._screenElement,0,ae._colors,ae._characterJoinerRegistry,J,ae._id,ae._bufferService,Y),new O.SelectionRenderLayer(ae._screenElement,1,ae._colors,ae._id,ae._bufferService,Y),new n.LinkRenderLayer(ae._screenElement,2,ae._colors,ae._id,U,N,ae._bufferService,Y),new m.CursorRenderLayer(ae._screenElement,3,ae._colors,ae._id,ae._onRequestRedraw,ae._bufferService,Y,V,ne)],ae.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},ae._devicePixelRatio=window.devicePixelRatio,ae._updateDimensions(),ae.onOptionsChanged(),ae}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,P=this._renderLayers;A<P.length;A++)P[A].dispose();L.prototype.dispose.call(this),u.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 P=0,U=this._renderLayers;P<U.length;P++){var N=U[P];N.setColors(this._colors),N.reset()}},x.prototype.onResize=function(A,P){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,P,U){U===void 0&&(U=!1),this._runOperation(function(N){return N.onSelectionChanged(A,P,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 P=0,U=this._renderLayers;P<U.length;P++)A(U[P])},x.prototype.renderRows=function(A,P){for(var U=0,N=this._renderLayers;U<N.length;U++)N[U].onGridChanged(A,P)},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(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(f,c){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var p in u)u.hasOwnProperty(p)&&(l[p]=u[p])})(f,c)},function(f,c){function l(){this.constructor=f}I(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=k(42),w=k(13),_=k(6),O=k(3),m=k(29),n=k(4),y=function(f){function c(l,u,p,E,T,L,x,A){var P=f.call(this,l,"text",u,T,p,L,x,A)||this;return P._characterWidth=0,P._characterFont="",P._characterOverlapCache={},P._workCell=new n.CellData,P._state=new D.GridCache,P._characterJoinerRegistry=E,P}return K(c,f),c.prototype.resize=function(l){f.prototype.resize.call(this,l);var u=this._getFont(!1,!1);this._characterWidth===l.scaledCharWidth&&this._characterFont===u||(this._characterWidth=l.scaledCharWidth,this._characterFont=u,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,u,p,E){for(var T=l;T<=u;T++)for(var L=T+this._bufferService.buffer.ydisp,x=this._bufferService.buffer.lines.get(L),A=p?p.getJoinedCharacters(L):[],P=0;P<this._bufferService.cols;P++){x.loadCell(P,this._workCell);var U=this._workCell,N=!1,H=P;if(U.getWidth()!==0){if(A.length>0&&P===A[0][0]){N=!0;var F=A.shift();U=new m.JoinedCellData(this._workCell,x.translateToString(!0,F[0],F[1]),F[1]-F[0]),H=F[1]-1}!N&&this._isOverlapping(U)&&H<x.length-1&&x.getCodePoint(H+1)===O.NULL_CELL_CODE&&(U.content&=-12582913,U.content|=2<<22),E(U,P,T),P=H}}},c.prototype._drawBackground=function(l,u){var p=this,E=this._ctx,T=this._bufferService.cols,L=0,x=0,A=null;E.save(),this._forEachCell(l,u,null,function(P,U,N){var H=null;P.isInverse()?H=P.isFgDefault()?p._colors.foreground.css:P.isFgRGB()?"rgb("+_.AttributeData.toColorRGB(P.getFgColor()).join(",")+")":p._colors.ansi[P.getFgColor()].css:P.isBgRGB()?H="rgb("+_.AttributeData.toColorRGB(P.getBgColor()).join(",")+")":P.isBgPalette()&&(H=p._colors.ansi[P.getBgColor()].css),A===null&&(L=U,x=N),N!==x?(E.fillStyle=A||"",p._fillCells(L,x,T-L,1),L=U,x=N):A!==H&&(E.fillStyle=A||"",p._fillCells(L,x,U-L,1),L=U,x=N),A=H}),A!==null&&(E.fillStyle=A,this._fillCells(L,x,T-L,1)),E.restore()},c.prototype._drawForeground=function(l,u){var p=this;this._forEachCell(l,u,this._characterJoinerRegistry,function(E,T,L){if(!E.isInvisible()&&(p._drawChars(E,T,L),E.isUnderline())){if(p._ctx.save(),E.isInverse())if(E.isBgDefault())p._ctx.fillStyle=p._colors.background.css;else if(E.isBgRGB())p._ctx.fillStyle="rgb("+_.AttributeData.toColorRGB(E.getBgColor()).join(",")+")";else{var x=E.getBgColor();p._optionsService.options.drawBoldTextInBrightColors&&E.isBold()&&x<8&&(x+=8),p._ctx.fillStyle=p._colors.ansi[x].css}else if(E.isFgDefault())p._ctx.fillStyle=p._colors.foreground.css;else if(E.isFgRGB())p._ctx.fillStyle="rgb("+_.AttributeData.toColorRGB(E.getFgColor()).join(",")+")";else{var A=E.getFgColor();p._optionsService.options.drawBoldTextInBrightColors&&E.isBold()&&A<8&&(A+=8),p._ctx.fillStyle=p._colors.ansi[A].css}p._fillBottomLineAtCells(T,L,E.getWidth()),p._ctx.restore()}})},c.prototype.onGridChanged=function(l,u){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,l,this._bufferService.cols,u-l+1),this._drawBackground(l,u),this._drawForeground(l,u))},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 u=l.getChars();if(this._characterOverlapCache.hasOwnProperty(u))return this._characterOverlapCache[u];this._ctx.save(),this._ctx.font=this._characterFont;var p=Math.floor(this._ctx.measureText(u).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[u]=p,p},c}(w.BaseRenderLayer);b.TextRenderLayer=y},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GridCache=void 0;var I=function(){function K(){this.cache=[]}return K.prototype.resize=function(D,w){for(var _=0;_<D;_++){this.cache.length<=_&&this.cache.push([]);for(var O=this.cache[_].length;O<w;O++)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=I},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(p,E){return(I=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])})(p,E)},function(p,E){function T(){this.constructor=p}I(p,E),p.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=k(9),w=k(44),_=k(27),O=k(46),m=k(11),n=k(28),y=k(10),f={css:"rgba(0, 0, 0, 0)",rgba:0};function c(p){return p.code<<21|p.bg<<12|p.fg<<3|(p.bold?0:4)+(p.dim?0:2)+(p.italic?0:1)}b.getGlyphCacheKey=c;var l=function(p){function E(T,L){var x=p.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=n.throwIfFalsy(x._cacheCanvas.getContext("2d",{alpha:!0}));var A=T.createElement("canvas");A.width=x._config.scaledCharWidth,A.height=x._config.scaledCharHeight,x._tmpCtx=n.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 P=x._width*x._height;return x._cacheMap=new O.LRUMap(P),x._cacheMap.prealloc(P),x}return K(E,p),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 P=c(L),U=this._cacheMap.get(P);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 H=this._drawToCache(L,N);return this._cacheMap.set(P,H),this._drawFromCache(T,H,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 P=this._toCoordinateX(L.index),U=this._toCoordinateY(L.index);T.drawImage(L.inBitmap?this._bitmap:this._cacheCanvas,P,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,P=T.italic?"italic":"";this._tmpCtx.font=P+" "+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(V,ne){for(var ae=!0,J=ne.rgba>>>24,z=ne.rgba>>>16&255,Z=ne.rgba>>>8&255,B=0;B<V.data.length;B+=4)V.data[B]===J&&V.data[B+1]===z&&V.data[B+2]===Z?V.data[B+3]=0:ae=!1;return ae}(U,x));var H=this._toCoordinateX(L),F=this._toCoordinateY(L);this._cacheCtx.putImageData(U,H,F);var Y={index:L,isEmpty:N,inBitmap:!1};return this._addGlyphToBitmap(Y),Y},E.prototype._addGlyphToBitmap=function(T){var L=this;!("createImageBitmap"in window)||m.isFirefox||m.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 u=function(p){function E(T,L){return p.call(this)||this}return K(E,p),E.prototype.draw=function(T,L,x,A){return!1},E}(w.BaseCharAtlas);b.NoneCharAtlas=u},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BaseCharAtlas=void 0;var I=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=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ColorContrastCache=void 0;var I=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=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.LRUMap=void 0;var I=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 O=this._nodePool;O.length>0?((_=O.pop()).key=D,_.value=w):_={prev:null,next:null,key:D,value:w},this._map[D]=_,this.size++}this._appendNode(_)},K}();b.LRUMap=I},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(w,_){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(O,m){O.__proto__=m}||function(O,m){for(var n in m)m.hasOwnProperty(n)&&(O[n]=m[n])})(w,_)},function(w,_){function O(){this.constructor=w}I(w,_),w.prototype=_===null?Object.create(_):(O.prototype=_.prototype,new O)});Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionRenderLayer=void 0;var D=function(w){function _(O,m,n,y,f,c){var l=w.call(this,O,"selection",m,!0,n,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(O){w.prototype.resize.call(this,O),this._clearState()},_.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},_.prototype.onSelectionChanged=function(O,m,n){if(this._didStateChange(O,m,n,this._bufferService.buffer.ydisp))if(this._clearAll(),O&&m){var y=O[1]-this._bufferService.buffer.ydisp,f=m[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,n){var u=O[0],p=m[0]-u,E=l-c+1;this._fillCells(u,c,p,E)}else{u=y===c?O[0]:0;var T=c===l?m[0]:this._bufferService.cols;this._fillCells(u,c,T-u,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?m[0]:this._bufferService.cols;this._fillCells(0,l,x,1)}}this._state.start=[O[0],O[1]],this._state.end=[m[0],m[1]],this._state.columnSelectMode=n,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},_.prototype._didStateChange=function(O,m,n,y){return!this._areCoordinatesEqual(O,this._state.start)||!this._areCoordinatesEqual(m,this._state.end)||n!==this._state.columnSelectMode||y!==this._state.ydisp},_.prototype._areCoordinatesEqual=function(O,m){return!(!O||!m)&&O[0]===m[0]&&O[1]===m[1]},_}(k(13).BaseRenderLayer);b.SelectionRenderLayer=D},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(m,n){return(I=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])})(m,n)},function(m,n){function y(){this.constructor=m}I(m,n),m.prototype=n===null?Object.create(n):(y.prototype=n.prototype,new y)});Object.defineProperty(b,"__esModule",{value:!0}),b.CursorRenderLayer=void 0;var D=k(13),w=k(4),_=function(m){function n(y,f,c,l,u,p,E,T,L){var x=m.call(this,y,"cursor",f,!0,c,l,p,E)||this;return x._onRequestRedraw=u,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(n,m),n.prototype.resize=function(y){m.prototype.resize.call(this,y),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},n.prototype.reset=function(){this._clearCursor(),this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0,this.onOptionsChanged())},n.prototype.onBlur=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},n.prototype.onFocus=function(){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume():this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},n.prototype.onOptionsChanged=function(){var y,f=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new O(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})},n.prototype.onCursorMove=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation()},n.prototype.onGridChanged=function(y,f){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},n.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 u=this._optionsService.options.cursorStyle;return u&&u!=="block"?this._cursorRenderers[u](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=u,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()},n.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})},n.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()},n.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()},n.prototype._renderUnderlineCursor=function(y,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(y,f),this._ctx.restore()},n.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()},n}(D.BaseRenderLayer);b.CursorRenderLayer=_;var O=function(){function m(n,y){this._renderCallback=y,this.isCursorVisible=!0,n&&this._restartInterval()}return Object.defineProperty(m.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),m.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)},m.prototype.restartBlinkAnimation=function(){var n=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){n._renderCallback(),n._animationFrame=void 0})))},m.prototype._restartInterval=function(n){var y=this;n===void 0&&(n=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)},n)},m.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)},m.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},m}()},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(m,n){return(I=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])})(m,n)},function(m,n){function y(){this.constructor=m}I(m,n),m.prototype=n===null?Object.create(n):(y.prototype=n.prototype,new y)});Object.defineProperty(b,"__esModule",{value:!0}),b.LinkRenderLayer=void 0;var D=k(13),w=k(9),_=k(26),O=function(m){function n(y,f,c,l,u,p,E,T){var L=m.call(this,y,"link",f,!0,c,l,E,T)||this;return u.onShowLinkUnderline(function(x){return L._onShowLinkUnderline(x)}),u.onHideLinkUnderline(function(x){return L._onHideLinkUnderline(x)}),p.onShowLinkUnderline(function(x){return L._onShowLinkUnderline(x)}),p.onHideLinkUnderline(function(x){return L._onHideLinkUnderline(x)}),L}return K(n,m),n.prototype.resize=function(y){m.prototype.resize.call(this,y),this._state=void 0},n.prototype.reset=function(){this._clearCurrentLink()},n.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}},n.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},n.prototype._onHideLinkUnderline=function(y){this._clearCurrentLink()},n}(D.BaseRenderLayer);b.LinkRenderLayer=O},function(me,b,k){"use strict";var I=this&&this.__decorate||function(m,n,y,f){var c,l=arguments.length,u=l<3?n:f===null?f=Object.getOwnPropertyDescriptor(n,y):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(m,n,y,f);else for(var p=m.length-1;p>=0;p--)(c=m[p])&&(u=(l<3?c(u):l>3?c(n,y,u):c(n,y))||u);return l>3&&u&&Object.defineProperty(n,y,u),u},K=this&&this.__param||function(m,n){return function(y,f){n(y,f,m)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseZone=b.Linkifier=void 0;var D=k(0),w=k(1),_=function(){function m(n,y,f){this._bufferService=n,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(m.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),m.prototype.attachToDom=function(n,y){this._element=n,this._mouseZoneManager=y},m.prototype.linkifyRows=function(n,y){var f=this;this._mouseZoneManager&&(this._rowsToLinkify.start===void 0||this._rowsToLinkify.end===void 0?(this._rowsToLinkify.start=n,this._rowsToLinkify.end=y):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,n),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,y)),this._mouseZoneManager.clearAll(n,y),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return f._linkifyRows()},m._timeBeforeLatency))},m.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var n=this._bufferService.buffer;if(this._rowsToLinkify.start!==void 0&&this._rowsToLinkify.end!==void 0){var y=n.ydisp+this._rowsToLinkify.start;if(!(y>=n.lines.length)){for(var f=n.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 u=l.next(),p=0;p<this._linkMatchers.length;p++)this._doLinkifyRow(u.range.first,u.content,this._linkMatchers[p]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},m.prototype.registerLinkMatcher=function(n,y,f){if(f===void 0&&(f={}),!y)throw new Error("handler must be defined");var c={id:this._nextLinkMatcherId++,regex:n,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},m.prototype._addLinkMatcherToList=function(n){if(this._linkMatchers.length!==0){for(var y=this._linkMatchers.length-1;y>=0;y--)if(n.priority<=this._linkMatchers[y].priority)return void this._linkMatchers.splice(y+1,0,n);this._linkMatchers.splice(0,0,n)}else this._linkMatchers.push(n)},m.prototype.deregisterLinkMatcher=function(n){for(var y=0;y<this._linkMatchers.length;y++)if(this._linkMatchers[y].id===n)return this._linkMatchers.splice(y,1),!0;return!1},m.prototype._doLinkifyRow=function(n,y,f){for(var c,l=this,u=new RegExp(f.regex.source,(f.regex.flags||"")+"g"),p=-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(p=y.indexOf(L,p+1),u.lastIndex=p+L.length,p<0)return"break";var x=T._bufferService.buffer.stringIndexToBufferIndex(n,p);if(x[0]<0)return"break";var A=T._bufferService.buffer.lines.get(x[0]);if(!A)return"break";var P=A.getFg(x[1]),U=P?P>>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=u.exec(y))!==null&&E()!=="break";);},m.prototype._addLink=function(n,y,f,c,l){var u=this;if(this._mouseZoneManager&&this._element){var p=this._unicodeService.getStringCellWidth(f),E=n%this._bufferService.cols,T=y+Math.floor(n/this._bufferService.cols),L=(E+p)%this._bufferService.cols,x=T+Math.floor((E+p)/this._bufferService.cols);L===0&&(L=this._bufferService.cols,x--),this._mouseZoneManager.add(new O(E+1,T+1,L+1,x+1,function(A){if(c.handler)return c.handler(A,f);var P=window.open();P?(P.opener=null,P.location.href=f):console.warn("Opening link blocked as opener could not be cleared")},function(){u._onShowLinkUnderline.fire(u._createLinkHoverEvent(E,T,L,x,l)),u._element.classList.add("xterm-cursor-pointer")},function(A){u._onLinkTooltip.fire(u._createLinkHoverEvent(E,T,L,x,l)),c.hoverTooltipCallback&&c.hoverTooltipCallback(A,f,{start:{x:E,y:T},end:{x:L,y:x}})},function(){u._onHideLinkUnderline.fire(u._createLinkHoverEvent(E,T,L,x,l)),u._element.classList.remove("xterm-cursor-pointer"),c.hoverLeaveCallback&&c.hoverLeaveCallback()},function(A){return!c.willLinkActivate||c.willLinkActivate(A,f)}))}},m.prototype._createLinkHoverEvent=function(n,y,f,c,l){return{x1:n,y1:y,x2:f,y2:c,cols:this._bufferService.cols,fg:l}},m._timeBeforeLatency=200,m=I([K(0,w.IBufferService),K(1,w.ILogService),K(2,w.IUnicodeService)],m)}();b.Linkifier=_;var O=function(m,n,y,f,c,l,u,p,E){this.x1=m,this.y1=n,this.x2=y,this.y2=f,this.clickCallback=c,this.hoverCallback=l,this.tooltipCallback=u,this.leaveCallback=p,this.willLinkActivate=E};b.MouseZone=O},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(L,x){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,P){A.__proto__=P}||function(A,P){for(var U in P)P.hasOwnProperty(U)&&(A[U]=P[U])})(L,x)},function(L,x){function A(){this.constructor=L}I(L,x),L.prototype=x===null?Object.create(x):(A.prototype=x.prototype,new A)}),D=this&&this.__decorate||function(L,x,A,P){var U,N=arguments.length,H=N<3?x:P===null?P=Object.getOwnPropertyDescriptor(x,A):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(L,x,A,P);else for(var F=L.length-1;F>=0;F--)(U=L[F])&&(H=(N<3?U(H):N>3?U(x,A,H):U(x,A))||H);return N>3&&H&&Object.defineProperty(x,A,H),H},w=this&&this.__param||function(L,x){return function(A,P){x(A,P,L)}};Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionService=void 0;var _=k(11),O=k(52),m=k(4),n=k(0),y=k(5),f=k(1),c=k(30),l=k(53),u=k(2),p="\xA0",E=new RegExp(p,"g"),T=function(L){function x(A,P,U,N,H,F,Y){var V=L.call(this)||this;return V._element=A,V._screenElement=P,V._bufferService=U,V._coreService=N,V._mouseService=H,V._optionsService=F,V._renderService=Y,V._dragScrollAmount=0,V._enabled=!0,V._workCell=new m.CellData,V._mouseDownTimeStamp=0,V._onLinuxMouseSelection=V.register(new n.EventEmitter),V._onRedrawRequest=V.register(new n.EventEmitter),V._onSelectionChange=V.register(new n.EventEmitter),V._onRequestScrollLines=V.register(new n.EventEmitter),V._mouseMoveListener=function(ne){return V._onMouseMove(ne)},V._mouseUpListener=function(ne){return V._onMouseUp(ne)},V._coreService.onUserInput(function(){V.hasSelection&&V.clearSelection()}),V._trimListener=V._bufferService.buffer.lines.onTrim(function(ne){return V._onTrim(ne)}),V.register(V._bufferService.buffers.onBufferActivate(function(ne){return V._onBufferActivate(ne)})),V.enable(),V._model=new O.SelectionModel(V._bufferService),V._activeSelectionMode=0,V}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,P=this._model.finalSelectionEnd;return!(!A||!P)&&(A[0]!==P[0]||A[1]!==P[1])},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"selectionText",{get:function(){var A=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;if(!A||!P)return"";var U=this._bufferService.buffer,N=[];if(this._activeSelectionMode===3){if(A[0]===P[0])return"";for(var H=A[1];H<=P[1];H++){var F=U.translateBufferLineToString(H,!0,A[0],P[0]);N.push(F)}}else{var Y=A[1]===P[1]?P[0]:void 0;for(N.push(U.translateBufferLineToString(A[1],!0,A[0],Y)),H=A[1]+1;H<=P[1]-1;H++){var V=U.lines.get(H);F=U.translateBufferLineToString(H,!0),V&&V.isWrapped?N[N.length-1]+=F:N.push(F)}A[1]!==P[1]&&(V=U.lines.get(P[1]),F=U.translateBufferLineToString(P[1],!0,0,P[0]),V&&V.isWrapped?N[N.length-1]+=F:N.push(F))}return N.map(function(ne){return ne.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 P=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return P._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 P=this._getMouseBufferCoords(A),U=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!!(U&&N&&P)&&this._areCoordsInSelection(P,U,N)},x.prototype._areCoordsInSelection=function(A,P,U){return A[1]>P[1]&&A[1]<U[1]||P[1]===U[1]&&A[1]===P[1]&&A[0]>=P[0]&&A[0]<U[0]||P[1]<U[1]&&A[1]===U[1]&&A[0]<U[0]||P[1]<U[1]&&A[1]===P[1]&&A[0]>=P[0]},x.prototype.selectWordAtCursor=function(A){var P=this._getMouseBufferCoords(A);P&&(this._selectWordAt(P,!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,P){this._model.clearSelection(),A=Math.max(A,0),P=Math.min(P,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,P],this.refresh(),this._onSelectionChange.fire()},x.prototype._onTrim=function(A){this._model.onTrim(A)&&this.refresh()},x.prototype._getMouseBufferCoords=function(A){var P=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(P)return P[0]--,P[1]--,P[1]+=this._bufferService.buffer.ydisp,P},x.prototype._getMouseEventScrollAmount=function(A){var P=c.getCoordsRelativeToElement(A,this._screenElement)[1],U=this._renderService.dimensions.canvasHeight;return P>=0&&P<=U?0:(P>U&&(P-=U),P=Math.min(Math.max(P,-50),50),(P/=50)/Math.abs(P)+Math.round(14*P))},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 P=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);P&&P.length!==this._model.selectionStart[0]&&P.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}},x.prototype._onDoubleClick=function(A){var P=this._getMouseBufferCoords(A);P&&(this._activeSelectionMode=1,this._selectWordAt(P,!0))},x.prototype._onTripleClick=function(A){var P=this._getMouseBufferCoords(A);P&&(this._activeSelectionMode=2,this._selectLineAt(P[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 P=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]++}P&&P[0]===this._model.selectionEnd[0]&&P[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 P=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&P<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 P=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim(function(U){return P._onTrim(U)})},x.prototype._convertViewportColToCharacterIndex=function(A,P){for(var U=P[0],N=0;P[0]>=N;N++){var H=A.loadCell(N,this._workCell).getChars().length;this._workCell.getWidth()===0?U--:H>1&&P[0]!==N&&(U+=H-1)}return U},x.prototype.setSelection=function(A,P,U){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,P],this._model.selectionStartLength=U,this.refresh()},x.prototype._getWordAt=function(A,P,U,N){if(U===void 0&&(U=!0),N===void 0&&(N=!0),!(A[0]>=this._bufferService.cols)){var H=this._bufferService.buffer,F=H.lines.get(A[1]);if(F){var Y=H.translateBufferLineToString(A[1],!1),V=this._convertViewportColToCharacterIndex(F,A),ne=V,ae=A[0]-V,J=0,z=0,Z=0,B=0;if(Y.charAt(V)===" "){for(;V>0&&Y.charAt(V-1)===" ";)V--;for(;ne<Y.length&&Y.charAt(ne+1)===" ";)ne++}else{var G=A[0],W=A[0];F.getWidth(G)===0&&(J++,G--),F.getWidth(W)===2&&(z++,W++);var R=F.getString(W).length;for(R>1&&(B+=R-1,ne+=R-1);G>0&&V>0&&!this._isCharWordSeparator(F.loadCell(G-1,this._workCell));){F.loadCell(G-1,this._workCell);var C=this._workCell.getChars().length;this._workCell.getWidth()===0?(J++,G--):C>1&&(Z+=C-1,V-=C-1),V--,G--}for(;W<F.length&&ne+1<Y.length&&!this._isCharWordSeparator(F.loadCell(W+1,this._workCell));){F.loadCell(W+1,this._workCell);var q=this._workCell.getChars().length;this._workCell.getWidth()===2?(z++,W++):q>1&&(B+=q-1,ne+=q-1),ne++,W++}}ne++;var re=V+ae-J+Z,_e=Math.min(this._bufferService.cols,ne-V+J+z-Z-B);if(P||Y.slice(V,ne).trim()!==""){if(U&&re===0&&F.getCodePoint(0)!==32){var Le=H.lines.get(A[1]-1);if(Le&&F.isWrapped&&Le.getCodePoint(this._bufferService.cols-1)!==32){var qe=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(qe){var be=this._bufferService.cols-qe.start;re-=be,_e+=be}}}if(N&&re+_e===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){var je=H.lines.get(A[1]+1);if(je&&je.isWrapped&&je.getCodePoint(0)!==32){var Me=this._getWordAt([0,A[1]+1],!1,!1,!0);Me&&(_e+=Me.length)}}return{start:re,length:_e}}}}},x.prototype._selectWordAt=function(A,P){var U=this._getWordAt(A,P);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 P=this._getWordAt(A,!0);if(P){for(var U=A[1];P.start<0;)P.start+=this._bufferService.cols,U--;if(!this._model.areSelectionValuesReversed())for(;P.start+P.length>this._bufferService.cols;)P.length-=this._bufferService.cols,U++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?P.start:P.start+P.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 P=this._bufferService.buffer.getWrappedRangeForLine(A);this._model.selectionStart=[0,P.first],this._model.selectionEnd=[this._bufferService.cols,P.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)}(u.Disposable);b.SelectionService=T},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionModel=void 0;var I=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=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.moveToCellSequence=void 0;var I=k(12);function K(n,y,f,c){var l=n-D(f,n),u=y-D(f,y);return m(Math.abs(l-u)-function(p,E,T){for(var L=0,x=p-D(T,p),A=E-D(T,E),P=0;P<Math.abs(x-A);P++){var U=w(p,E)==="A"?-1:1,N=T.buffer.lines.get(x+U*P);N&&N.isWrapped&&L++}return L}(n,y,f),O(w(n,y),c))}function D(n,y){for(var f=0,c=n.buffer.lines.get(y),l=c&&c.isWrapped;l&&y>=0&&y<n.rows;)f++,l=(c=n.buffer.lines.get(--y))&&c.isWrapped;return f}function w(n,y){return n>y?"A":"B"}function _(n,y,f,c,l,u){for(var p=n,E=y,T="";p!==f||E!==c;)p+=l?1:-1,l&&p>u.cols-1?(T+=u.buffer.translateBufferLineToString(E,!1,n,p),p=0,n=0,E++):!l&&p<0&&(T+=u.buffer.translateBufferLineToString(E,!1,0,n+1),n=p=u.cols-1,E--);return T+u.buffer.translateBufferLineToString(E,!1,n,p)}function O(n,y){var f=y?"O":"[";return I.C0.ESC+f+n}function m(n,y){n=Math.floor(n);for(var f="",c=0;c<n;c++)f+=y;return f}b.moveToCellSequence=function(n,y,f,c){var l,u=f.buffer.x,p=f.buffer.y;if(!f.buffer.hasScrollback)return function(T,L,x,A,P,U){return K(L,A,P,U).length===0?"":m(_(T,L,T,L-D(P,L),!1,P).length,O("D",U))}(u,p,0,y,f,c)+K(p,y,f,c)+function(T,L,x,A,P,U){var N;N=K(L,A,P,U).length>0?A-D(P,A):L;var H=A,F=function(Y,V,ne,ae,J,z){var Z;return Z=K(ne,ae,J,z).length>0?ae-D(J,ae):V,Y<ne&&Z<=ae||Y>=ne&&Z<ae?"C":"D"}(T,L,x,A,P,U);return m(_(T,N,x,H,F==="C",P).length,O(F,U))}(u,p,n,y,f,c);if(p===y)return l=u>n?"D":"C",m(Math.abs(u-n),O(l,c));l=p>y?"D":"C";var E=Math.abs(p-y);return m(function(T,L){return L.cols-T}(p>y?n:u,f)+(E-1)*f.cols+1+((p>y?u:n)-1),O(l,c))}},function(me,b,k){"use strict";var I=this&&this.__decorate||function(_,O,m,n){var y,f=arguments.length,c=f<3?O:n===null?n=Object.getOwnPropertyDescriptor(O,m):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(_,O,m,n);else for(var l=_.length-1;l>=0;l--)(y=_[l])&&(c=(f<3?y(c):f>3?y(O,m,c):y(O,m))||c);return f>3&&c&&Object.defineProperty(O,m,c),c},K=this&&this.__param||function(_,O){return function(m,n){O(m,n,_)}};Object.defineProperty(b,"__esModule",{value:!0}),b.SoundService=void 0;var D=k(1),w=function(){function _(O){this._optionsService=O}return Object.defineProperty(_,"audioContext",{get:function(){if(!_._audioContext){var O=window.AudioContext||window.webkitAudioContext;if(!O)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;_._audioContext=new O}return _._audioContext},enumerable:!1,configurable:!0}),_.prototype.playBellSound=function(){var O=_.audioContext;if(O){var m=O.createBufferSource();O.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(n){m.buffer=n,m.connect(O.destination),m.start(0)})}},_.prototype._base64ToArrayBuffer=function(O){for(var m=window.atob(O),n=m.length,y=new Uint8Array(n),f=0;f<n;f++)y[f]=m.charCodeAt(f);return y.buffer},_.prototype._removeMimeType=function(O){return O.split(",")[1]},_=I([K(0,D.IOptionsService)],_)}();b.SoundService=w},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(f,c){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var p in u)u.hasOwnProperty(p)&&(l[p]=u[p])})(f,c)},function(f,c){function l(){this.constructor=f}I(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,u){var p,E=arguments.length,T=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(T=(E<3?p(T):E>3?p(c,l,T):p(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,u){c(l,u,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseZoneManager=void 0;var _=k(2),O=k(7),m=k(5),n=k(1),y=function(f){function c(l,u,p,E,T,L){var x=f.call(this)||this;return x._element=l,x._screenElement=u,x._bufferService=p,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(O.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,u){if(this._zones.length!==0){l&&u||(l=0,u=this._bufferService.rows-1);for(var p=0;p<this._zones.length;p++){var E=this._zones[p];(E.y1>l&&E.y1<=u+1||E.y2>l&&E.y2<=u+1||E.y1<l&&E.y2>u+1)&&(this._currentZone&&this._currentZone===E&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(p--,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 u=this,p=this._findZoneEventAt(l);p!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),p&&(this._currentZone=p,p.hoverCallback&&p.hoverCallback(l),this._tooltipTimeout=window.setTimeout(function(){return u._onTooltip(l)},this._optionsService.options.linkTooltipHoverDuration)))},c.prototype._onTooltip=function(l){this._tooltipTimeout=void 0;var u=this._findZoneEventAt(l);u&&u.tooltipCallback&&u.tooltipCallback(l)},c.prototype._onMouseDown=function(l){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var u=this._findZoneEventAt(l);u!=null&&u.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 u=this._findZoneEventAt(l),p=this._getSelectionLength();u&&p===this._initialSelectionLength&&(u.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 u=this._mouseService.getCoords(l,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(u)for(var p=u[0],E=u[1],T=0;T<this._zones.length;T++){var L=this._zones[T];if(L.y1===L.y2){if(E===L.y1&&p>=L.x1&&p<L.x2)return L}else if(E===L.y1&&p>=L.x1||E===L.y2&&p<L.x2||E>L.y1&&E<L.y2)return L}},c=D([w(2,n.IBufferService),w(3,m.IMouseService),w(4,m.ISelectionService),w(5,n.IOptionsService)],c)}(_.Disposable);b.MouseZoneManager=y},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(c,l){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,p){u.__proto__=p}||function(u,p){for(var E in p)p.hasOwnProperty(E)&&(u[E]=p[E])})(c,l)},function(c,l){function u(){this.constructor=c}I(c,l),c.prototype=l===null?Object.create(l):(u.prototype=l.prototype,new u)});Object.defineProperty(b,"__esModule",{value:!0}),b.AccessibilityManager=void 0;var D=k(18),w=k(11),_=k(31),O=k(7),m=k(2),n=k(32),y=k(17),f=function(c){function l(u,p){var E=c.call(this)||this;E._terminal=u,E._renderService=p,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 n.ScreenDprMonitor,E.register(E._screenDprMonitor),E._screenDprMonitor.setListener(function(){return E._refreshRowsDimensions()}),E.register(O.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(u,p){var E=u.target,T=this._rowElements[p===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")!==(p===0?"1":""+this._terminal.buffer.lines.length)&&u.relatedTarget===T){var L,x;if(p===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),p===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(p===0?-1:1),this._rowElements[p===0?1:this._rowElements.length-2].focus(),u.preventDefault(),u.stopImmediatePropagation()}},l.prototype._onResize=function(u){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var p=this._rowContainer.children.length;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);for(;this._rowElements.length>u;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},l.prototype._createAccessibilityTreeNode=function(){var u=document.createElement("div");return u.setAttribute("role","listitem"),u.tabIndex=-1,this._refreshRowDimensions(u),u},l.prototype._onTab=function(u){for(var p=0;p<u;p++)this._onChar(" ")},l.prototype._onChar=function(u){var p=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==u&&(this._charsToAnnounce+=u):this._charsToAnnounce+=u,u===`
`&&(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(){p._accessibilityTreeRoot.appendChild(p._liveRegion)},0))},l.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,w.isMac&&y.removeElementFromParent(this._liveRegion)},l.prototype._onKey=function(u){this._clearLiveRegion(),this._charsToConsume.push(u)},l.prototype._refreshRows=function(u,p){this._renderRowsDebouncer.refresh(u,p,this._terminal.rows)},l.prototype._renderRows=function(u,p){for(var E=this._terminal.buffer,T=E.lines.length.toString(),L=u;L<=p;L++){var x=E.translateBufferLineToString(E.ydisp+L,!0),A=(E.ydisp+L+1).toString(),P=this._rowElements[L];P&&(x.length===0?P.innerHTML="&nbsp;":P.textContent=x,P.setAttribute("aria-posinset",A),P.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 u=0;u<this._terminal.rows;u++)this._refreshRowDimensions(this._rowElements[u])}},l.prototype._refreshRowDimensions=function(u){u.style.height=this._renderService.dimensions.actualCellHeight+"px"},l.prototype._announceCharacters=function(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},l}(m.Disposable);b.AccessibilityManager=f},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(E,T){return(I=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}I(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,P=arguments.length,U=P<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=(P<3?A(U):P>3?A(T,L,U):A(T,L))||U);return P>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 _=k(58),O=k(9),m=k(2),n=k(5),y=k(1),f=k(0),c=k(10),l=k(17),u=1,p=function(E){function T(L,x,A,P,U,N,H,F,Y){var V=E.call(this)||this;return V._colors=L,V._element=x,V._screenElement=A,V._viewportElement=P,V._linkifier=U,V._linkifier2=N,V._charSizeService=H,V._optionsService=F,V._bufferService=Y,V._terminalClass=u++,V._rowElements=[],V._rowContainer=document.createElement("div"),V._rowContainer.classList.add("xterm-rows"),V._rowContainer.style.lineHeight="normal",V._rowContainer.setAttribute("aria-hidden","true"),V._refreshRowElements(V._bufferService.cols,V._bufferService.rows),V._selectionContainer=document.createElement("div"),V._selectionContainer.classList.add("xterm-selection"),V._selectionContainer.setAttribute("aria-hidden","true"),V.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},V._updateDimensions(),V._injectCss(),V._rowFactory=new _.DomRendererRowFactory(document,V._optionsService,V._colors),V._element.classList.add("xterm-dom-renderer-owner-"+V._terminalClass),V._screenElement.appendChild(V._rowContainer),V._screenElement.appendChild(V._selectionContainer),V._linkifier.onShowLinkUnderline(function(ne){return V._onLinkHover(ne)}),V._linkifier.onHideLinkUnderline(function(ne){return V._onLinkLeave(ne)}),V._linkifier2.onShowLinkUnderline(function(ne){return V._onLinkHover(ne)}),V._linkifier2.onHideLinkUnderline(function(ne){return V._onLinkLeave(ne)}),V}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 P=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.innerHTML=P,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,P){x+=L._terminalSelector+" .xterm-fg-"+P+" { color: "+A.css+"; }"+L._terminalSelector+" .xterm-bg-"+P+" { background-color: "+A.css+"; }"}),x+=this._terminalSelector+" .xterm-fg-"+O.INVERTED_DEFAULT_COLOR+" { color: "+c.color.opaque(this._colors.background).css+"; }"+this._terminalSelector+" .xterm-bg-"+O.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 P=document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}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 P=L[1]-this._bufferService.buffer.ydisp,U=x[1]-this._bufferService.buffer.ydisp,N=Math.max(P,0),H=Math.min(U,this._bufferService.rows-1);if(!(N>=this._bufferService.rows||H<0)){var F=document.createDocumentFragment();if(A)F.appendChild(this._createSelectionElement(N,L[0],x[0],H-N+1));else{var Y=P===N?L[0]:0,V=N===H?x[0]:this._bufferService.cols;F.appendChild(this._createSelectionElement(N,Y,V));var ne=H-N-1;if(F.appendChild(this._createSelectionElement(N+1,0,this._bufferService.cols,ne)),N!==H){var ae=U===H?x[0]:this._bufferService.cols;F.appendChild(this._createSelectionElement(H,0,ae))}}this._selectionContainer.appendChild(F)}}},T.prototype._createSelectionElement=function(L,x,A,P){P===void 0&&(P=1);var U=document.createElement("div");return U.style.height=P*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,P=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),U=this._optionsService.options.cursorBlink,N=L;N<=x;N++){var H=this._rowElements[N];H.innerHTML="";var F=N+this._bufferService.buffer.ydisp,Y=this._bufferService.buffer.lines.get(F),V=this._optionsService.options.cursorStyle;H.appendChild(this._rowFactory.createRow(Y,F===A,V,P,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,P,U,N){for(;L!==x||A!==P;){var H=this._rowElements[A];if(!H)return;var F=H.children[L];F&&(F.style.textDecoration=N?"underline":"none"),++L>=U&&(L=0,A++)}},T=D([w(6,n.ICharSizeService),w(7,y.IOptionsService),w(8,y.IBufferService)],T)}(m.Disposable);b.DomRenderer=p},function(me,b,k){"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 I=k(9),K=k(3),D=k(4),w=k(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 m(n,y,f){this._document=n,this._optionsService=y,this._colors=f,this._workCell=new D.CellData}return m.prototype.setColors=function(n){this._colors=n},m.prototype.createRow=function(n,y,f,c,l,u,p){for(var E=this._document.createDocumentFragment(),T=0,L=Math.min(n.length,p)-1;L>=0;L--)if(n.loadCell(L,this._workCell).getCode()!==K.NULL_CELL_CODE||y&&L===c){T=L+1;break}for(L=0;L<T;L++){n.loadCell(L,this._workCell);var x=this._workCell.getWidth();if(x!==0){var A=this._document.createElement("span");if(x>1&&(A.style.width=u*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 P=this._workCell.getFgColor(),U=this._workCell.getFgColorMode(),N=this._workCell.getBgColor(),H=this._workCell.getBgColorMode(),F=!!this._workCell.isInverse();if(F){var Y=P;P=N,N=Y;var V=U;U=H,H=V}switch(U){case 16777216:case 33554432:this._workCell.isBold()&&P<8&&this._optionsService.options.drawBoldTextInBrightColors&&(P+=8),this._applyMinimumContrast(A,this._colors.background,this._colors.ansi[P])||A.classList.add("xterm-fg-"+P);break;case 50331648:var ne=w.rgba.toColor(P>>16&255,P>>8&255,255&P);this._applyMinimumContrast(A,this._colors.background,ne)||this._addStyle(A,"color:#"+O(P.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(A,this._colors.background,this._colors.foreground)||F&&A.classList.add("xterm-fg-"+I.INVERTED_DEFAULT_COLOR)}switch(H){case 16777216:case 33554432:A.classList.add("xterm-bg-"+N);break;case 50331648:this._addStyle(A,"background-color:#"+O(N.toString(16),"0",6));break;case 0:default:F&&A.classList.add("xterm-bg-"+I.INVERTED_DEFAULT_COLOR)}E.appendChild(A)}}return E},m.prototype._applyMinimumContrast=function(n,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(n,"color:"+c.css),!0)},m.prototype._addStyle=function(n,y){n.setAttribute("style",""+(n.getAttribute("style")||"")+y+";")},m}();function O(m,n,y){for(;m.length<y;)m=n+m;return m}b.DomRendererRowFactory=_},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.evaluateKeyboardEvent=void 0;var I=k(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,_,O){var m={type:0,cancel:!1,key:void 0},n=(D.shiftKey?1:0)|(D.altKey?2:0)|(D.ctrlKey?4:0)|(D.metaKey?8:0);switch(D.keyCode){case 0:D.key==="UIKeyInputUpArrow"?m.key=w?I.C0.ESC+"OA":I.C0.ESC+"[A":D.key==="UIKeyInputLeftArrow"?m.key=w?I.C0.ESC+"OD":I.C0.ESC+"[D":D.key==="UIKeyInputRightArrow"?m.key=w?I.C0.ESC+"OC":I.C0.ESC+"[C":D.key==="UIKeyInputDownArrow"&&(m.key=w?I.C0.ESC+"OB":I.C0.ESC+"[B");break;case 8:if(D.shiftKey){m.key=I.C0.BS;break}if(D.altKey){m.key=I.C0.ESC+I.C0.DEL;break}m.key=I.C0.DEL;break;case 9:if(D.shiftKey){m.key=I.C0.ESC+"[Z";break}m.key=I.C0.HT,m.cancel=!0;break;case 13:m.key=D.altKey?I.C0.ESC+I.C0.CR:I.C0.CR,m.cancel=!0;break;case 27:m.key=I.C0.ESC,D.altKey&&(m.key=I.C0.ESC+I.C0.ESC),m.cancel=!0;break;case 37:if(D.metaKey)break;n?(m.key=I.C0.ESC+"[1;"+(n+1)+"D",m.key===I.C0.ESC+"[1;3D"&&(m.key=I.C0.ESC+(_?"b":"[1;5D"))):m.key=w?I.C0.ESC+"OD":I.C0.ESC+"[D";break;case 39:if(D.metaKey)break;n?(m.key=I.C0.ESC+"[1;"+(n+1)+"C",m.key===I.C0.ESC+"[1;3C"&&(m.key=I.C0.ESC+(_?"f":"[1;5C"))):m.key=w?I.C0.ESC+"OC":I.C0.ESC+"[C";break;case 38:if(D.metaKey)break;n?(m.key=I.C0.ESC+"[1;"+(n+1)+"A",_||m.key!==I.C0.ESC+"[1;3A"||(m.key=I.C0.ESC+"[1;5A")):m.key=w?I.C0.ESC+"OA":I.C0.ESC+"[A";break;case 40:if(D.metaKey)break;n?(m.key=I.C0.ESC+"[1;"+(n+1)+"B",_||m.key!==I.C0.ESC+"[1;3B"||(m.key=I.C0.ESC+"[1;5B")):m.key=w?I.C0.ESC+"OB":I.C0.ESC+"[B";break;case 45:D.shiftKey||D.ctrlKey||(m.key=I.C0.ESC+"[2~");break;case 46:m.key=n?I.C0.ESC+"[3;"+(n+1)+"~":I.C0.ESC+"[3~";break;case 36:m.key=n?I.C0.ESC+"[1;"+(n+1)+"H":w?I.C0.ESC+"OH":I.C0.ESC+"[H";break;case 35:m.key=n?I.C0.ESC+"[1;"+(n+1)+"F":w?I.C0.ESC+"OF":I.C0.ESC+"[F";break;case 33:D.shiftKey?m.type=2:m.key=I.C0.ESC+"[5~";break;case 34:D.shiftKey?m.type=3:m.key=I.C0.ESC+"[6~";break;case 112:m.key=n?I.C0.ESC+"[1;"+(n+1)+"P":I.C0.ESC+"OP";break;case 113:m.key=n?I.C0.ESC+"[1;"+(n+1)+"Q":I.C0.ESC+"OQ";break;case 114:m.key=n?I.C0.ESC+"[1;"+(n+1)+"R":I.C0.ESC+"OR";break;case 115:m.key=n?I.C0.ESC+"[1;"+(n+1)+"S":I.C0.ESC+"OS";break;case 116:m.key=n?I.C0.ESC+"[15;"+(n+1)+"~":I.C0.ESC+"[15~";break;case 117:m.key=n?I.C0.ESC+"[17;"+(n+1)+"~":I.C0.ESC+"[17~";break;case 118:m.key=n?I.C0.ESC+"[18;"+(n+1)+"~":I.C0.ESC+"[18~";break;case 119:m.key=n?I.C0.ESC+"[19;"+(n+1)+"~":I.C0.ESC+"[19~";break;case 120:m.key=n?I.C0.ESC+"[20;"+(n+1)+"~":I.C0.ESC+"[20~";break;case 121:m.key=n?I.C0.ESC+"[21;"+(n+1)+"~":I.C0.ESC+"[21~";break;case 122:m.key=n?I.C0.ESC+"[23;"+(n+1)+"~":I.C0.ESC+"[23~";break;case 123:m.key=n?I.C0.ESC+"[24;"+(n+1)+"~":I.C0.ESC+"[24~";break;default:if(!D.ctrlKey||D.shiftKey||D.altKey||D.metaKey)if(_&&!O||!D.altKey||D.metaKey)_&&!D.altKey&&!D.ctrlKey&&D.metaKey?D.keyCode===65&&(m.type=1):D.key&&!D.ctrlKey&&!D.altKey&&!D.metaKey&&D.keyCode>=48&&D.key.length===1?m.key=D.key:D.key&&D.ctrlKey&&D.key==="_"&&(m.key=I.C0.US);else{var y=K[D.keyCode],f=y&&y[D.shiftKey?1:0];if(f)m.key=I.C0.ESC+f;else if(D.keyCode>=65&&D.keyCode<=90){var c=D.ctrlKey?D.keyCode-64:D.keyCode+32;m.key=I.C0.ESC+String.fromCharCode(c)}}else D.keyCode>=65&&D.keyCode<=90?m.key=String.fromCharCode(D.keyCode-64):D.keyCode===32?m.key=I.C0.NUL:D.keyCode>=51&&D.keyCode<=55?m.key=String.fromCharCode(D.keyCode-51+27):D.keyCode===56?m.key=I.C0.DEL:D.keyCode===219?m.key=I.C0.ESC:D.keyCode===220?m.key=I.C0.FS:D.keyCode===221&&(m.key=I.C0.GS)}return m}},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(u,p){return(I=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])})(u,p)},function(u,p){function E(){this.constructor=u}I(u,p),u.prototype=p===null?Object.create(p):(E.prototype=p.prototype,new E)}),D=this&&this.__decorate||function(u,p,E,T){var L,x=arguments.length,A=x<3?p:T===null?T=Object.getOwnPropertyDescriptor(p,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,p,E,T);else for(var P=u.length-1;P>=0;P--)(L=u[P])&&(A=(x<3?L(A):x>3?L(p,E,A):L(p,E))||A);return x>3&&A&&Object.defineProperty(p,E,A),A},w=this&&this.__param||function(u,p){return function(E,T){p(E,T,u)}};Object.defineProperty(b,"__esModule",{value:!0}),b.RenderService=void 0;var _=k(31),O=k(0),m=k(2),n=k(32),y=k(7),f=k(1),c=k(5),l=function(u){function p(E,T,L,x,A,P){var U=u.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 O.EventEmitter,U._onRender=new O.EventEmitter,U._onRefreshRequest=new O.EventEmitter,U.register({dispose:function(){return U._renderer.dispose()}}),U._renderDebouncer=new _.RenderDebouncer(function(H,F){return U._renderRows(H,F)}),U.register(U._renderDebouncer),U._screenDprMonitor=new n.ScreenDprMonitor,U._screenDprMonitor.setListener(function(){return U.onDevicePixelRatioChange()}),U.register(U._screenDprMonitor),U.register(P.onResize(function(H){return U._fullRefresh()})),U.register(x.onOptionChange(function(){return U._renderer.onOptionsChanged()})),U.register(A.onCharSizeChange(function(){return U.onCharSizeChanged()})),U._renderer.onRequestRedraw(function(H){return U.refreshRows(H.start,H.end,!0)}),U.register(y.addDisposableDomListener(window,"resize",function(){return U.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var N=new IntersectionObserver(function(H){return U._onIntersectionChange(H[H.length-1])},{threshold:0});N.observe(L),U.register({dispose:function(){return N.disconnect()}})}return U}return K(p,u),Object.defineProperty(p.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),p.prototype._onIntersectionChange=function(E){this._isPaused=E.intersectionRatio===0,!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},p.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))},p.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},p.prototype.resize=function(E,T){this._rowCount=T,this._fireOnCanvasResize()},p.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},p.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},p.prototype.dispose=function(){u.prototype.dispose.call(this)},p.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()},p.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},p.prototype.setColors=function(E){this._renderer.setColors(E),this._fullRefresh()},p.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},p.prototype.onResize=function(E,T){this._renderer.onResize(E,T),this._fullRefresh()},p.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},p.prototype.onBlur=function(){this._renderer.onBlur()},p.prototype.onFocus=function(){this._renderer.onFocus()},p.prototype.onSelectionChanged=function(E,T,L){this._selectionState.start=E,this._selectionState.end=T,this._selectionState.columnSelectMode=L,this._renderer.onSelectionChanged(E,T,L)},p.prototype.onCursorMove=function(){this._renderer.onCursorMove()},p.prototype.clear=function(){this._renderer.clear()},p.prototype.registerCharacterJoiner=function(E){return this._renderer.registerCharacterJoiner(E)},p.prototype.deregisterCharacterJoiner=function(E){return this._renderer.deregisterCharacterJoiner(E)},p=D([w(3,f.IOptionsService),w(4,c.ICharSizeService),w(5,f.IBufferService)],p)}(m.Disposable);b.RenderService=l},function(me,b,k){"use strict";var I=this&&this.__decorate||function(m,n,y,f){var c,l=arguments.length,u=l<3?n:f===null?f=Object.getOwnPropertyDescriptor(n,y):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(m,n,y,f);else for(var p=m.length-1;p>=0;p--)(c=m[p])&&(u=(l<3?c(u):l>3?c(n,y,u):c(n,y))||u);return l>3&&u&&Object.defineProperty(n,y,u),u},K=this&&this.__param||function(m,n){return function(y,f){n(y,f,m)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CharSizeService=void 0;var D=k(1),w=k(0),_=function(){function m(n,y,f){this._optionsService=f,this.width=0,this.height=0,this._onCharSizeChange=new w.EventEmitter,this._measureStrategy=new O(n,y,this._optionsService)}return Object.defineProperty(m.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),m.prototype.measure=function(){var n=this._measureStrategy.measure();n.width===this.width&&n.height===this.height||(this.width=n.width,this.height=n.height,this._onCharSizeChange.fire())},m=I([K(2,D.IOptionsService)],m)}();b.CharSizeService=_;var O=function(){function m(n,y,f){this._document=n,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 m.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var n=this._measureElement.getBoundingClientRect();return n.width!==0&&n.height!==0&&(this._result.width=n.width,this._result.height=Math.ceil(n.height)),this._result},m}()},function(me,b,k){"use strict";var I=this&&this.__decorate||function(O,m,n,y){var f,c=arguments.length,l=c<3?m:y===null?y=Object.getOwnPropertyDescriptor(m,n):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(O,m,n,y);else for(var u=O.length-1;u>=0;u--)(f=O[u])&&(l=(c<3?f(l):c>3?f(m,n,l):f(m,n))||l);return c>3&&l&&Object.defineProperty(m,n,l),l},K=this&&this.__param||function(O,m){return function(n,y){m(n,y,O)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseService=void 0;var D=k(5),w=k(30),_=function(){function O(m,n){this._renderService=m,this._charSizeService=n}return O.prototype.getCoords=function(m,n,y,f,c){return w.getCoords(m,n,y,f,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,c)},O.prototype.getRawByteCoords=function(m,n,y,f){var c=this.getCoords(m,n,y,f);return w.getRawByteCoords(c)},O=I([K(0,D.IRenderService),K(1,D.ICharSizeService)],O)}();b.MouseService=_},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(f,c){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var p in u)u.hasOwnProperty(p)&&(l[p]=u[p])})(f,c)},function(f,c){function l(){this.constructor=f}I(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,u){var p,E=arguments.length,T=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(T=(E<3?p(T):E>3?p(c,l,T):p(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,u){c(l,u,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Linkifier2=void 0;var _=k(1),O=k(0),m=k(2),n=k(7),y=function(f){function c(l){var u=f.call(this)||this;return u._bufferService=l,u._linkProviders=[],u._linkCacheDisposables=[],u._isMouseOut=!0,u._activeLine=-1,u._onShowLinkUnderline=u.register(new O.EventEmitter),u._onHideLinkUnderline=u.register(new O.EventEmitter),u.register(m.getDisposeArrayDisposable(u._linkCacheDisposables)),u}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 u=this;return this._linkProviders.push(l),{dispose:function(){var p=u._linkProviders.indexOf(l);p!==-1&&u._linkProviders.splice(p,1)}}},c.prototype.attachToDom=function(l,u,p){var E=this;this._element=l,this._mouseService=u,this._renderService=p,this.register(n.addDisposableDomListener(this._element,"mouseleave",function(){E._isMouseOut=!0,E._clearCurrentLink()})),this.register(n.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(n.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},c.prototype._onMouseMove=function(l){if(this._lastMouseEvent=l,this._element&&this._mouseService){var u=this._positionFromMouseEvent(l,this._element,this._mouseService);if(u){this._isMouseOut=!1;for(var p=l.composedPath(),E=0;E<p.length;E++){var T=p[E];if(T.classList.contains("xterm"))break;if(T.classList.contains("xterm-hover"))return}this._lastBufferCell&&u.x===this._lastBufferCell.x&&u.y===this._lastBufferCell.y||(this._onHover(u),this._lastBufferCell=u)}}},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,u){var p=this;this._activeProviderReplies&&u||(this._activeProviderReplies=new Map,this._activeLine=l.y);var E=!1;this._linkProviders.forEach(function(T,L){var x;u?!((x=p._activeProviderReplies)===null||x===void 0)&&x.get(L)&&(E=p._checkLinkProviderResult(L,l,E)):T.provideLinks(l.y,function(A){var P,U;if(!p._isMouseOut){var N=A==null?void 0:A.map(function(H){return{link:H}});(P=p._activeProviderReplies)===null||P===void 0||P.set(L,N),E=p._checkLinkProviderResult(L,l,E),((U=p._activeProviderReplies)===null||U===void 0?void 0:U.size)===p._linkProviders.length&&p._removeIntersectingLinks(l.y,p._activeProviderReplies)}})})},c.prototype._removeIntersectingLinks=function(l,u){for(var p=new Set,E=0;E<u.size;E++){var T=u.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,P=x.link.range.end.y>l?this._bufferService.cols:x.link.range.end.x,U=A;U<=P;U++){if(p.has(U)){T.splice(L--,1);break}p.add(U)}}},c.prototype._checkLinkProviderResult=function(l,u,p){var E,T=this;if(!this._activeProviderReplies)return p;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 P=L.find(function(N){return T._linkAtPosition(N.link,u)});P&&(p=!0,this._handleNewLink(P))}if(this._activeProviderReplies.size===this._linkProviders.length&&!p)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,u)});if(U){p=!0,this._handleNewLink(U);break}}return p},c.prototype._onClick=function(l){if(this._element&&this._mouseService&&this._currentLink){var u=this._positionFromMouseEvent(l,this._element,this._mouseService);u&&this._linkAtPosition(this._currentLink.link,u)&&this._currentLink.link.activate(l,this._currentLink.link.text)}},c.prototype._clearCurrentLink=function(l,u){this._element&&this._currentLink&&this._lastMouseEvent&&(!l||!u||this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=u)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,m.disposeArray(this._linkCacheDisposables))},c.prototype._handleNewLink=function(l){var u=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._linkAtPosition(l.link,p)&&(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=u._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=u._currentLink)===null||T===void 0)&&T.state&&u._currentLink.state.decorations.pointerCursor!==E&&(u._currentLink.state.decorations.pointerCursor=E,u._currentLink.state.isHovered&&((L=u._element)===null||L===void 0||L.classList.toggle("xterm-cursor-pointer",E)))}},underline:{get:function(){var E,T;return(T=(E=u._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=u._currentLink)===null||T===void 0)&&T.state&&((x=(L=u._currentLink)===null||L===void 0?void 0:L.state)===null||x===void 0?void 0:x.decorations.underline)!==E&&(u._currentLink.state.decorations.underline=E,u._currentLink.state.isHovered&&u._fireUnderlineEvent(l.link,E))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange(function(E){var T=E.start===0?0:E.start+1+u._bufferService.buffer.ydisp;u._clearCurrentLink(T,E.end+1+u._bufferService.buffer.ydisp)})))}},c.prototype._linkHover=function(l,u,p){var E;!((E=this._currentLink)===null||E===void 0)&&E.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(u,!0),this._currentLink.state.decorations.pointerCursor&&l.classList.add("xterm-cursor-pointer")),u.hover&&u.hover(p,u.text)},c.prototype._fireUnderlineEvent=function(l,u){var p=l.range,E=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(p.start.x-1,p.start.y-E-1,p.end.x,p.end.y-E-1,void 0);(u?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)},c.prototype._linkLeave=function(l,u,p){var E;!((E=this._currentLink)===null||E===void 0)&&E.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(u,!1),this._currentLink.state.decorations.pointerCursor&&l.classList.remove("xterm-cursor-pointer")),u.leave&&u.leave(p,u.text)},c.prototype._linkAtPosition=function(l,u){var p=l.range.start.y===l.range.end.y,E=l.range.start.y<u.y,T=l.range.end.y>u.y;return(p&&l.range.start.x<=u.x&&l.range.end.x>=u.x||E&&l.range.end.x>=u.x||T&&l.range.start.x<=u.x||E&&T)&&l.range.start.y<=u.y&&l.range.end.y>=u.y},c.prototype._positionFromMouseEvent=function(l,u,p){var E=p.getCoords(l,u,this._bufferService.cols,this._bufferService.rows);if(E)return{x:E[0],y:E[1]+this._bufferService.buffer.ydisp}},c.prototype._createLinkUnderlineEvent=function(l,u,p,E,T){return{x1:l,y1:u,x2:p,y2:E,cols:this._bufferService.cols,fg:T}},c=D([w(0,_.IBufferService)],c)}(m.Disposable);b.Linkifier2=y},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CoreBrowserService=void 0;var I=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=I},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(A,P){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(U,N){U.__proto__=N}||function(U,N){for(var H in N)N.hasOwnProperty(H)&&(U[H]=N[H])})(A,P)},function(A,P){function U(){this.constructor=A}I(A,P),A.prototype=P===null?Object.create(P):(U.prototype=P.prototype,new U)});Object.defineProperty(b,"__esModule",{value:!0}),b.CoreTerminal=void 0;var D=k(2),w=k(1),_=k(66),O=k(67),m=k(68),n=k(74),y=k(75),f=k(0),c=k(76),l=k(77),u=k(78),p=k(80),E=k(81),T=k(19),L=k(82),x=function(A){function P(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 n.OptionsService(U),N._instantiationService.setService(w.IOptionsService,N.optionsService),N._bufferService=N.register(N._instantiationService.createInstance(m.BufferService)),N._instantiationService.setService(w.IBufferService,N._bufferService),N._logService=N._instantiationService.createInstance(O.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(u.UnicodeService),N._instantiationService.setService(w.IUnicodeService,N.unicodeService),N._charsetService=N._instantiationService.createInstance(p.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(H){return N._updateOptions(H)})),N._writeBuffer=new L.WriteBuffer(function(H){return N._inputHandler.parse(H)}),N}return K(P,A),Object.defineProperty(P.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),P.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)},P.prototype.write=function(U,N){this._writeBuffer.write(U,N)},P.prototype.writeSync=function(U){this._writeBuffer.writeSync(U)},P.prototype.resize=function(U,N){isNaN(U)||isNaN(N)||(U=Math.max(U,m.MINIMUM_COLS),N=Math.max(N,m.MINIMUM_ROWS),this._bufferService.resize(U,N))},P.prototype.scroll=function(U,N){N===void 0&&(N=!1);var H,F=this._bufferService.buffer;(H=this._cachedBlankLine)&&H.length===this.cols&&H.getFg(0)===U.fg&&H.getBg(0)===U.bg||(H=F.getBlankLine(U,N),this._cachedBlankLine=H),H.isWrapped=N;var Y=F.ybase+F.scrollTop,V=F.ybase+F.scrollBottom;if(F.scrollTop===0){var ne=F.lines.isFull;V===F.lines.length-1?ne?F.lines.recycle().copyFrom(H):F.lines.push(H.clone()):F.lines.splice(V+1,0,H.clone()),ne?this._bufferService.isUserScrolling&&(F.ydisp=Math.max(F.ydisp-1,0)):(F.ybase++,this._bufferService.isUserScrolling||F.ydisp++)}else{var ae=V-Y+1;F.lines.shiftElements(Y+1,ae-1,-1),F.lines.set(V,H.clone())}this._bufferService.isUserScrolling||(F.ydisp=F.ybase),this._dirtyRowService.markRangeDirty(F.scrollTop,F.scrollBottom),this._onScroll.fire(F.ydisp)},P.prototype.scrollLines=function(U,N){var H=this._bufferService.buffer;if(U<0){if(H.ydisp===0)return;this._bufferService.isUserScrolling=!0}else U+H.ydisp>=H.ybase&&(this._bufferService.isUserScrolling=!1);var F=H.ydisp;H.ydisp=Math.max(Math.min(H.ydisp+U,H.ybase),0),F!==H.ydisp&&(N||this._onScroll.fire(H.ydisp))},P.prototype.scrollPages=function(U){this.scrollLines(U*(this.rows-1))},P.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},P.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},P.prototype.scrollToLine=function(U){var N=U-this._bufferService.buffer.ydisp;N!==0&&this.scrollLines(N)},P.prototype.addEscHandler=function(U,N){return this._inputHandler.addEscHandler(U,N)},P.prototype.addDcsHandler=function(U,N){return this._inputHandler.addDcsHandler(U,N)},P.prototype.addCsiHandler=function(U,N){return this._inputHandler.addCsiHandler(U,N)},P.prototype.addOscHandler=function(U,N){return this._inputHandler.addOscHandler(U,N)},P.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},P.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},P.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)}},P.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 H=0,F=N;H<F.length;H++)F[H].dispose()}}}},P}(D.Disposable);b.CoreTerminal=x},function(me,b,k){"use strict";var I=this&&this.__spreadArrays||function(){for(var O=0,m=0,n=arguments.length;m<n;m++)O+=arguments[m].length;var y=Array(O),f=0;for(m=0;m<n;m++)for(var c=arguments[m],l=0,u=c.length;l<u;l++,f++)y[f]=c[l];return y};Object.defineProperty(b,"__esModule",{value:!0}),b.InstantiationService=b.ServiceCollection=void 0;var K=k(1),D=k(14),w=function(){function O(){for(var m=[],n=0;n<arguments.length;n++)m[n]=arguments[n];this._entries=new Map;for(var y=0,f=m;y<f.length;y++){var c=f[y],l=c[0],u=c[1];this.set(l,u)}}return O.prototype.set=function(m,n){var y=this._entries.get(m);return this._entries.set(m,n),y},O.prototype.forEach=function(m){this._entries.forEach(function(n,y){return m(y,n)})},O.prototype.has=function(m){return this._entries.has(m)},O.prototype.get=function(m){return this._entries.get(m)},O}();b.ServiceCollection=w;var _=function(){function O(){this._services=new w,this._services.set(K.IInstantiationService,this)}return O.prototype.setService=function(m,n){this._services.set(m,n)},O.prototype.getService=function(m){return this._services.get(m)},O.prototype.createInstance=function(m){for(var n=[],y=1;y<arguments.length;y++)n[y-1]=arguments[y];for(var f=D.getServiceDependencies(m).sort(function(L,x){return L.index-x.index}),c=[],l=0,u=f;l<u.length;l++){var p=u[l],E=this._services.get(p.id);if(!E)throw new Error("[createInstance] "+m.name+" depends on UNKNOWN service "+p.id+".");c.push(E)}var T=f.length>0?f[0].index:n.length;if(n.length!==T)throw new Error("[createInstance] First service dependency of "+m.name+" at position "+(T+1)+" conflicts with "+n.length+" static arguments");return new(m.bind.apply(m,I([void 0],I(n,c))))},O}();b.InstantiationService=_},function(me,b,k){"use strict";var I=this&&this.__decorate||function(n,y,f,c){var l,u=arguments.length,p=u<3?y:c===null?c=Object.getOwnPropertyDescriptor(y,f):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(n,y,f,c);else for(var E=n.length-1;E>=0;E--)(l=n[E])&&(p=(u<3?l(p):u>3?l(y,f,p):l(y,f))||p);return u>3&&p&&Object.defineProperty(y,f,p),p},K=this&&this.__param||function(n,y){return function(f,c){y(f,c,n)}},D=this&&this.__spreadArrays||function(){for(var n=0,y=0,f=arguments.length;y<f;y++)n+=arguments[y].length;var c=Array(n),l=0;for(y=0;y<f;y++)for(var u=arguments[y],p=0,E=u.length;p<E;p++,l++)c[l]=u[p];return c};Object.defineProperty(b,"__esModule",{value:!0}),b.LogService=b.LogLevel=void 0;var w,_=k(1);(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.OFF=4]="OFF"})(w=b.LogLevel||(b.LogLevel={}));var O={debug:w.DEBUG,info:w.INFO,warn:w.WARN,error:w.ERROR,off:w.OFF},m=function(){function n(y){var f=this;this._optionsService=y,this._updateLogLevel(),this._optionsService.onOptionChange(function(c){c==="logLevel"&&f._updateLogLevel()})}return n.prototype._updateLogLevel=function(){this._logLevel=O[this._optionsService.options.logLevel]},n.prototype._evalLazyOptionalParams=function(y){for(var f=0;f<y.length;f++)typeof y[f]=="function"&&(y[f]=y[f]())},n.prototype._log=function(y,f,c){this._evalLazyOptionalParams(c),y.call.apply(y,D([console,"xterm.js: "+f],c))},n.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)},n.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)},n.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)},n.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)},n=I([K(0,_.IOptionsService)],n)}();b.LogService=m},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(f,c){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var p in u)u.hasOwnProperty(p)&&(l[p]=u[p])})(f,c)},function(f,c){function l(){this.constructor=f}I(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,u){var p,E=arguments.length,T=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(T=(E<3?p(T):E>3?p(c,l,T):p(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,u){c(l,u,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.BufferService=b.MINIMUM_ROWS=b.MINIMUM_COLS=void 0;var _=k(1),O=k(69),m=k(0),n=k(2);b.MINIMUM_COLS=2,b.MINIMUM_ROWS=1;var y=function(f){function c(l){var u=f.call(this)||this;return u._optionsService=l,u.isUserScrolling=!1,u._onResize=new m.EventEmitter,u.cols=Math.max(l.options.cols,b.MINIMUM_COLS),u.rows=Math.max(l.options.rows,b.MINIMUM_ROWS),u.buffers=new O.BufferSet(l,u),u}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,u){this.cols=l,this.rows=u,this.buffers.resize(l,u),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:l,rows:u})},c.prototype.reset=function(){this.buffers.dispose(),this.buffers=new O.BufferSet(this._optionsService,this),this.isUserScrolling=!1},c=D([w(0,_.IOptionsService)],c)}(n.Disposable);b.BufferService=y},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(O,m){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,y){n.__proto__=y}||function(n,y){for(var f in y)y.hasOwnProperty(f)&&(n[f]=y[f])})(O,m)},function(O,m){function n(){this.constructor=O}I(O,m),O.prototype=m===null?Object.create(m):(n.prototype=m.prototype,new n)});Object.defineProperty(b,"__esModule",{value:!0}),b.BufferSet=void 0;var D=k(70),w=k(0),_=function(O){function m(n,y){var f=O.call(this)||this;return f._onBufferActivate=f.register(new w.EventEmitter),f._normal=new D.Buffer(!0,n,y),f._normal.fillViewportRows(),f._alt=new D.Buffer(!1,n,y),f._activeBuffer=f._normal,f.setupTabStops(),f}return K(m,O),Object.defineProperty(m.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),m.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}))},m.prototype.activateAltBuffer=function(n){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(n),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}))},m.prototype.resize=function(n,y){this._normal.resize(n,y),this._alt.resize(n,y)},m.prototype.setupTabStops=function(n){this._normal.setupTabStops(n),this._alt.setupTabStops(n)},m}(k(2).Disposable);b.BufferSet=_},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BufferStringIterator=b.Buffer=b.MAX_BUFFER_SIZE=void 0;var I=k(71),K=k(16),D=k(4),w=k(3),_=k(72),O=k(73),m=k(20),n=k(6);b.MAX_BUFFER_SIZE=4294967295;var y=function(){function c(l,u,p){this._hasScrollback=l,this._optionsService=u,this._bufferService=p,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=m.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 I.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 n.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 n.ExtendedAttrs),this._whitespaceCell},c.prototype.getBlankLine=function(l,u){return new K.BufferLine(this._bufferService.cols,this.getNullCell(l),u)},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 u=l+this._optionsService.options.scrollback;return u>b.MAX_BUFFER_SIZE?b.MAX_BUFFER_SIZE:u},c.prototype.fillViewportRows=function(l){if(this.lines.length===0){l===void 0&&(l=K.DEFAULT_ATTR_DATA);for(var u=this._rows;u--;)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 I.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},c.prototype.resize=function(l,u){var p=this.getNullCell(K.DEFAULT_ATTR_DATA),E=this._getCorrectBufferLength(u);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,p);var L=0;if(this._rows<u)for(var x=this._rows;x<u;x++)this.lines.length<u+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new K.BufferLine(l,p)):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,p)));else for(x=this._rows;x>u;x--)this.lines.length>u+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,u-1),L&&(this.y+=L),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(l,u),this._cols>l))for(T=0;T<this.lines.length;T++)this.lines.get(T).resize(l,p);this._cols=l,this._rows=u},Object.defineProperty(c.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!1,configurable:!0}),c.prototype._reflow=function(l,u){this._cols!==l&&(l>this._cols?this._reflowLarger(l,u):this._reflowSmaller(l,u))},c.prototype._reflowLarger=function(l,u){var p=_.reflowLargerGetLinesToRemove(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(K.DEFAULT_ATTR_DATA));if(p.length>0){var E=_.reflowLargerCreateNewLayout(this.lines,p);_.reflowLargerApplyNewLayout(this.lines,E.layout),this._reflowLargerAdjustViewport(l,u,E.countRemoved)}},c.prototype._reflowLargerAdjustViewport=function(l,u,p){for(var E=this.getNullCell(K.DEFAULT_ATTR_DATA),T=p;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new K.BufferLine(l,E))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-p,0)},c.prototype._reflowSmaller=function(l,u){for(var p=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 P=this.ybase+this.y;if(!(P>=L&&P<L+A.length)){var U=A[A.length-1].getTrimmedLength(),N=_.reflowSmallerGetNewLineLengths(A,this._cols,l),H=N.length-A.length,F=void 0;F=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+H):Math.max(0,this.lines.length-this.lines.maxLength+H);for(var Y=[],V=0;V<H;V++){var ne=this.getBlankLine(K.DEFAULT_ATTR_DATA,!0);Y.push(ne)}Y.length>0&&(E.push({start:L+A.length+T,newLines:Y}),T+=Y.length),A.push.apply(A,Y);var ae=N.length-1,J=N[ae];J===0&&(J=N[--ae]);for(var z=A.length-H-1,Z=U;z>=0;){var B=Math.min(Z,J);if(A[ae].copyCellsFrom(A[z],Z-B,J-B,B,!0),(J-=B)===0&&(J=N[--ae]),(Z-=B)===0){z--;var G=Math.max(z,0);Z=_.getWrappedLineTrimmedLength(A,G,this._cols)}}for(V=0;V<A.length;V++)N[V]<l&&A[V].setCell(N[V],p);for(var W=H-F;W-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+H,this.ybase+u-1)}}}if(E.length>0){var R=[],C=[];for(V=0;V<this.lines.length;V++)C.push(this.lines.get(V));var q=this.lines.length,re=q-1,_e=0,Le=E[_e];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);var qe=0;for(V=Math.min(this.lines.maxLength-1,q+T-1);V>=0;V--)if(Le&&Le.start>re+qe){for(var be=Le.newLines.length-1;be>=0;be--)this.lines.set(V--,Le.newLines[be]);V++,R.push({index:re+1,amount:Le.newLines.length}),qe+=Le.newLines.length,Le=E[++_e]}else this.lines.set(V,C[re--]);var je=0;for(V=R.length-1;V>=0;V--)R[V].index+=je,this.lines.onInsertEmitter.fire(R[V]),je+=R[V].amount;var Me=Math.max(0,q+T-this.lines.maxLength);Me>0&&this.lines.onTrimEmitter.fire(Me)}},c.prototype.stringIndexToBufferIndex=function(l,u,p){for(p===void 0&&(p=!1);u;){var E=this.lines.get(l);if(!E)return[-1,-1];for(var T=p?E.getTrimmedLength():E.length,L=0;L<T;++L)if(E.get(L)[w.CHAR_DATA_WIDTH_INDEX]&&(u-=E.get(L)[w.CHAR_DATA_CHAR_INDEX].length||1),u<0)return[l,L];l++}return[l,0]},c.prototype.translateBufferLineToString=function(l,u,p,E){p===void 0&&(p=0);var T=this.lines.get(l);return T?T.translateToString(u,p,E):""},c.prototype.getWrappedRangeForLine=function(l){for(var u=l,p=l;u>0&&this.lines.get(u).isWrapped;)u--;for(;p+1<this.lines.length&&this.lines.get(p+1).isWrapped;)p++;return{first:u,last:p}},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 u=this,p=new O.Marker(l);return this.markers.push(p),p.register(this.lines.onTrim(function(E){p.line-=E,p.line<0&&p.dispose()})),p.register(this.lines.onInsert(function(E){p.line>=E.index&&(p.line+=E.amount)})),p.register(this.lines.onDelete(function(E){p.line>=E.index&&p.line<E.index+E.amount&&p.dispose(),p.line>E.index&&(p.line-=E.amount)})),p.register(p.onDispose(function(){return u._removeMarker(p)})),p},c.prototype._removeMarker=function(l){this.markers.splice(this.markers.indexOf(l),1)},c.prototype.iterator=function(l,u,p,E,T){return new f(this,l,u,p,E,T)},c}();b.Buffer=y;var f=function(){function c(l,u,p,E,T,L){p===void 0&&(p=0),E===void 0&&(E=l.lines.length),T===void 0&&(T=0),L===void 0&&(L=0),this._buffer=l,this._trimRight=u,this._startIndex=p,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 u="",p=l.first;p<=l.last;++p)u+=this._buffer.translateBufferLineToString(p,this._trimRight);return this._current=l.last+1,{range:l,content:u}},c}();b.BufferStringIterator=f},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CircularList=void 0;var I=k(0),K=function(){function D(w){this._maxLength=w,this.onDeleteEmitter=new I.EventEmitter,this.onInsertEmitter=new I.EventEmitter,this.onTrimEmitter=new I.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),O=0;O<Math.min(w,this.length);O++)_[O]=this._array[this._getCyclicIndex(O)];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 O=[],m=2;m<arguments.length;m++)O[m-2]=arguments[m];if(_){for(var n=w;n<this._length-_;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+_)];this._length-=_}for(n=this._length-1;n>=w;n--)this._array[this._getCyclicIndex(n+O.length)]=this._array[this._getCyclicIndex(n)];for(n=0;n<O.length;n++)this._array[this._getCyclicIndex(w+n)]=O[n];if(this._length+O.length>this._maxLength){var y=this._length+O.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=O.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,_,O){if(!(_<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+O<0)throw new Error("Cannot shift elements in list beyond index 0");if(O>0){for(var m=_-1;m>=0;m--)this.set(w+m+O,this.get(w+m));var n=w+_+O-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(m=0;m<_;m++)this.set(w+m+O,this.get(w+m))}},D.prototype._getCyclicIndex=function(w){return(this._startIndex+w)%this._maxLength},D}();b.CircularList=K},function(me,b,k){"use strict";function I(K,D,w){if(D===K.length-1)return K[D].getTrimmedLength();var _=!K[D].hasContent(w-1)&&K[D].getWidth(w-1)===1,O=K[D+1].getWidth(0)===2;return _&&O?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,_,O){for(var m=[],n=0;n<K.length-1;n++){var y=n,f=K.get(++y);if(f.isWrapped){for(var c=[K.get(n)];y<K.length&&f.isWrapped;)c.push(f),f=K.get(++y);if(_>=n&&_<y)n+=c.length-1;else{for(var l=0,u=I(c,l,D),p=1,E=0;p<c.length;){var T=I(c,p,D),L=T-E,x=w-u,A=Math.min(L,x);c[l].copyCellsFrom(c[p],E,u,A,!1),(u+=A)===w&&(l++,u=0),(E+=A)===T&&(p++,E=0),u===0&&l!==0&&c[l-1].getWidth(w-1)===2&&(c[l].copyCellsFrom(c[l-1],w-1,u++,1,!1),c[l-1].setCell(w-1,O))}c[l].replaceCells(u,w,O);for(var P=0,U=c.length-1;U>0&&(U>l||c[U].getTrimmedLength()===0);U--)P++;P>0&&(m.push(n+c.length-P),m.push(P)),n+=c.length-1}}}return m},b.reflowLargerCreateNewLayout=function(K,D){for(var w=[],_=0,O=D[_],m=0,n=0;n<K.length;n++)if(O===n){var y=D[++_];K.onDeleteEmitter.fire({index:n-m,amount:y}),n+=y-1,m+=y,O=D[++_]}else w.push(n);return{layout:w,countRemoved:m}},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 _=[],O=K.map(function(u,p){return I(K,p,D)}).reduce(function(u,p){return u+p}),m=0,n=0,y=0;y<O;){if(O-y<w){_.push(O-y);break}m+=w;var f=I(K,n,D);m>f&&(m-=f,n++);var c=K[n].getWidth(m-1)===2;c&&m--;var l=c?w-1:w;_.push(l),y+=l}return _},b.getWrappedLineTrimmedLength=I},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(_,O){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,n){m.__proto__=n}||function(m,n){for(var y in n)n.hasOwnProperty(y)&&(m[y]=n[y])})(_,O)},function(_,O){function m(){this.constructor=_}I(_,O),_.prototype=O===null?Object.create(O):(m.prototype=O.prototype,new m)});Object.defineProperty(b,"__esModule",{value:!0}),b.Marker=void 0;var D=k(0),w=function(_){function O(m){var n=_.call(this)||this;return n.line=m,n._id=O._nextId++,n.isDisposed=!1,n._onDispose=new D.EventEmitter,n}return K(O,_),Object.defineProperty(O.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),O.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire())},O._nextId=1,O}(k(2).Disposable);b.Marker=w},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.OptionsService=b.DEFAULT_OPTIONS=b.DEFAULT_BELL_SOUND=void 0;var I=k(0),K=k(11),D=k(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 O(m){this._onOptionChange=new I.EventEmitter,this.options=D.clone(b.DEFAULT_OPTIONS);for(var n=0,y=Object.keys(m);n<y.length;n++){var f=y[n];if(f in this.options){var c=m[f];this.options[f]=c}}}return Object.defineProperty(O.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},enumerable:!1,configurable:!0}),O.prototype.setOption=function(m,n){if(!(m in b.DEFAULT_OPTIONS))throw new Error('No option with key "'+m+'"');if(w.indexOf(m)!==-1)throw new Error('Option "'+m+'" can only be set in the constructor');this.options[m]!==n&&(n=this._sanitizeAndValidateOption(m,n),this.options[m]!==n&&(this.options[m]=n,this._onOptionChange.fire(m)))},O.prototype._sanitizeAndValidateOption=function(m,n){switch(m){case"bellStyle":case"cursorStyle":case"fontWeight":case"fontWeightBold":case"rendererType":case"wordSeparator":n||(n=b.DEFAULT_OPTIONS[m]);break;case"cursorWidth":n=Math.floor(n);case"lineHeight":case"tabStopWidth":if(n<1)throw new Error(m+" cannot be less than 1, value: "+n);break;case"minimumContrastRatio":n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case"scrollback":if((n=Math.min(n,4294967295))<0)throw new Error(m+" cannot be less than 0, value: "+n);break;case"fastScrollSensitivity":case"scrollSensitivity":if(n<=0)throw new Error(m+" cannot be less than or equal to 0, value: "+n)}return n},O.prototype.getOption=function(m){if(!(m in b.DEFAULT_OPTIONS))throw new Error('No option with key "'+m+'"');return this.options[m]},O}();b.OptionsService=_},function(me,b,k){"use strict";var I,K=this&&this.__extends||(I=function(l,u){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,E){p.__proto__=E}||function(p,E){for(var T in E)E.hasOwnProperty(T)&&(p[T]=E[T])})(l,u)},function(l,u){function p(){this.constructor=l}I(l,u),l.prototype=u===null?Object.create(u):(p.prototype=u.prototype,new p)}),D=this&&this.__decorate||function(l,u,p,E){var T,L=arguments.length,x=L<3?u:E===null?E=Object.getOwnPropertyDescriptor(u,p):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(l,u,p,E);else for(var A=l.length-1;A>=0;A--)(T=l[A])&&(x=(L<3?T(x):L>3?T(u,p,x):T(u,p))||x);return L>3&&x&&Object.defineProperty(u,p,x),x},w=this&&this.__param||function(l,u){return function(p,E){u(p,E,l)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CoreService=void 0;var _=k(1),O=k(0),m=k(33),n=k(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 u(p,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 O.EventEmitter),x._onUserInput=x.register(new O.EventEmitter),x._onBinary=x.register(new O.EventEmitter),x._scrollToBottom=p,x.register({dispose:function(){return x._scrollToBottom=void 0}}),x.modes=m.clone(y),x.decPrivateModes=m.clone(f),x}return K(u,l),Object.defineProperty(u.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),u.prototype.reset=function(){this.modes=m.clone(y),this.decPrivateModes=m.clone(f)},u.prototype.triggerDataEvent=function(p,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 "'+p+'"',function(){return p.split("").map(function(L){return L.charCodeAt(0)})}),this._onData.fire(p)}},u.prototype.triggerBinaryEvent=function(p){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+p+'"',function(){return p.split("").map(function(E){return E.charCodeAt(0)})}),this._onBinary.fire(p))},u=D([w(1,_.IBufferService),w(2,_.ILogService),w(3,_.IOptionsService)],u)}(n.Disposable);b.CoreService=c},function(me,b,k){"use strict";var I=this&&this.__decorate||function(f,c,l,u){var p,E=arguments.length,T=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(T=(E<3?p(T):E>3?p(c,l,T):p(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},K=this&&this.__param||function(f,c){return function(l,u){c(l,u,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CoreMouseService=void 0;var D=k(1),w=k(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 O(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 m=String.fromCharCode,n={DEFAULT:function(f){var c=[O(f,!1)+32,f.col+32,f.row+32];return c[0]>255||c[1]>255||c[2]>255?"":"\x1B[M"+m(c[0])+m(c[1])+m(c[2])},SGR:function(f){var c=f.action===0&&f.button!==4?"m":"M";return"\x1B[<"+O(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 u=0,p=Object.keys(_);u<p.length;u++){var E=p[u];this.addProtocol(E,_[E])}for(var T=0,L=Object.keys(n);T<L.length;T++){var x=L[T];this.addEncoding(x,n[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=I([K(0,D.IBufferService),K(1,D.ICoreService)],f)}();b.CoreMouseService=y},function(me,b,k){"use strict";var I=this&&this.__decorate||function(_,O,m,n){var y,f=arguments.length,c=f<3?O:n===null?n=Object.getOwnPropertyDescriptor(O,m):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(_,O,m,n);else for(var l=_.length-1;l>=0;l--)(y=_[l])&&(c=(f<3?y(c):f>3?y(O,m,c):y(O,m))||c);return f>3&&c&&Object.defineProperty(O,m,c),c},K=this&&this.__param||function(_,O){return function(m,n){O(m,n,_)}};Object.defineProperty(b,"__esModule",{value:!0}),b.DirtyRowService=void 0;var D=k(1),w=function(){function _(O){this._bufferService=O,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(O){O<this._start?this._start=O:O>this._end&&(this._end=O)},_.prototype.markRangeDirty=function(O,m){if(O>m){var n=O;O=m,m=n}O<this._start&&(this._start=O),m>this._end&&(this._end=m)},_.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},_=I([K(0,D.IBufferService)],_)}();b.DirtyRowService=w},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UnicodeService=void 0;var I=k(0),K=k(79),D=function(){function w(){this._providers=Object.create(null),this._active="",this._onChange=new I.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 O=0,m=_.length,n=0;n<m;++n){var y=_.charCodeAt(n);if(55296<=y&&y<=56319){if(++n>=m)return O+this.wcwidth(y);var f=_.charCodeAt(n);56320<=f&&f<=57343?y=1024*(y-55296)+f-56320+65536:O+=this.wcwidth(f)}O+=this.wcwidth(y)}return O},w}();b.UnicodeService=D},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UnicodeV6=void 0;var I,K=k(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 O(){if(this.version="6",!I){I=new Uint8Array(65536),K.fill(I,1),I[0]=0,K.fill(I,0,1,32),K.fill(I,0,127,160),K.fill(I,2,4352,4448),I[9001]=2,I[9002]=2,K.fill(I,2,11904,42192),I[12351]=1,K.fill(I,2,44032,55204),K.fill(I,2,63744,64256),K.fill(I,2,65040,65050),K.fill(I,2,65072,65136),K.fill(I,2,65280,65377),K.fill(I,2,65504,65511);for(var m=0;m<D.length;++m)K.fill(I,0,D[m][0],D[m][1]+1)}}return O.prototype.wcwidth=function(m){return m<32?0:m<127?1:m<65536?I[m]:function(n,y){var f,c=0,l=y.length-1;if(n<y[0][0]||n>y[l][1])return!1;for(;l>=c;)if(n>y[f=c+l>>1][1])c=f+1;else{if(!(n<y[f][0]))return!0;l=f-1}return!1}(m,w)?0:m>=131072&&m<=196605||m>=196608&&m<=262141?2:1},O}();b.UnicodeV6=_},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CharsetService=void 0;var I=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=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.updateWindowsModeWrappedState=void 0;var I=k(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[I.CHAR_DATA_CODE_INDEX]!==I.NULL_CELL_CODE&&w[I.CHAR_DATA_CODE_INDEX]!==I.WHITESPACE_CELL_CODE)}},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.WriteBuffer=void 0;var I=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],O=this._callbacks[w];this._action(_),O&&O()}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],O=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(_),this._pendingData-=_.length,O&&O(),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=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.AddonManager=void 0;var I=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,O={instance:w,dispose:w.dispose,isDisposed:!1};this._addons.push(O),w.dispose=function(){return _._wrappedAddonDispose(O)},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=I}])})},93314:function(mt){"use strict";mt.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=="},81168:function(mt,me,b){"use strict";b.d(me,{ZP:function(){return Pr}});const k=Number.isFinite||function(o){return typeof o=="number"&&isFinite(o)},I=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 O={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},m={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class n{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 n(e),this.fast_=new n(t),this.defaultTTFB_=r,this.ttfb_=new n(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new n(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new n(t,r.getEstimate(),r.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new n(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,s=i/r;this.fast_.sample(r,s),this.slow_.sample(r,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function 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 u(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 p(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=p(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 P(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):P(o,t)}const N=A();function H(o,e,t){const i=A();if(typeof console=="object"&&o===!0||typeof o=="object"){const r=["debug","log","info","warn","error"];r.forEach(s=>{i[s]=U(s,o,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.7`)}catch(s){return A()}r.forEach(s=>{N[s]=U(s,o)})}else c(N,i);return i}const F=N;function Y(o=!0){return typeof self=="undefined"?void 0:(o||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function V(o){return typeof self!="undefined"&&o===self.ManagedMediaSource}function ne(o,e){const t=Object.keys(o),i=Object.keys(e),r=t.length,s=i.length;return!r||!s||r===s&&!t.some(a=>i.indexOf(a)===-1)}function ae(o,e=!1){if(typeof TextDecoder!="undefined"){const d=new TextDecoder("utf-8").decode(o);if(e){const v=d.indexOf("\0");return v!==-1?d.substring(0,v):d}return d.replace(/\0/g,"")}const t=o.length;let i,r,s,a="",h=0;for(;h<t;){if(i=o[h++],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[h++],a+=String.fromCharCode((i&31)<<6|r&63);break;case 14:r=o[h++],s=o[h++],a+=String.fromCharCode((i&15)<<12|(r&63)<<6|(s&63)<<0);break}}return a}const J={hexDump:function(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 Z(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([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,h={buildAbsoluteURL:function(g,d,v){if(v=v||{},g=g.trim(),d=d.trim(),!d){if(!v.alwaysNormalize)return g;var S=h.parseURL(g);if(!S)throw new Error("Error trying to parse base URL.");return S.path=h.normalizePath(S.path),h.buildURLFromParts(S)}var M=h.parseURL(d);if(!M)throw new Error("Error trying to parse relative URL.");if(M.scheme)return v.alwaysNormalize?(M.path=h.normalizePath(M.path),h.buildURLFromParts(M)):d;var $=h.parseURL(g);if(!$)throw new Error("Error trying to parse base URL.");if(!$.netLoc&&$.path&&$.path[0]!=="/"){var j=r.exec($.path);$.netLoc=j[1],$.path=j[2]}$.netLoc&&!$.path&&($.path="/");var Q={scheme:$.scheme,netLoc:M.netLoc,path:null,params:M.params,query:M.query,fragment:M.fragment};if(!M.netLoc&&(Q.netLoc=$.netLoc,M.path[0]!=="/"))if(!M.path)Q.path=$.path,M.params||(Q.params=$.params,M.query||(Q.query=$.query));else{var X=$.path,se=X.substring(0,X.lastIndexOf("/")+1)+M.path;Q.path=h.normalizePath(se)}return Q.path===null&&(Q.path=v.alwaysNormalize?h.normalizePath(M.path):M.path),h.buildURLFromParts(Q)},parseURL:function(g){var d=i.exec(g);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(g){for(g=g.split("").reverse().join("").replace(s,"");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=h})()}(B)),B.exports}var R=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 q={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class re{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,je(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={[q.AUDIO]:null,[q.VIDEO]:null,[q.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=R.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[q.AUDIO]=null,e[q.VIDEO]=null,e[q.AUDIOVIDEO]=null}}function _e(o){return o.sn!=="initSegment"}class Le extends re{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange){const e=this.byteRange[0],t=this.byteRange[1];if(k(e)&&k(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=k(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!k(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return _e(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,s,a=!1){const{elementaryStreams:h}=this,g=h[e];if(!g){h[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:s,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,s)}}class qe extends re{constructor(e,t,i,r,s){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function be(o,e){const t=Object.getPrototypeOf(o);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||be(t,e)}}function je(o,e){const t=be(o,e);t&&(t.enumerable=!0,Object.defineProperty(o,e,t))}const Me=Math.pow(2,32)-1,Oe=[].push,wt={video:1,audio:2,id3:3,text:4};function We(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 He(o,e){const t=Ee(o,e);return t<0?4294967296+t:t}function vt(o,e){let t=He(o,e);return t*=Math.pow(2,32),t+=He(o,e+4),t}function Ee(o,e){return o[e]<<24|o[e+1]<<16|o[e+2]<<8|o[e+3]}function we(o){const e=o.byteLength;for(let t=0;t<e;){const i=He(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 s=He(o,r),a=We(o.subarray(r+4,r+8)),h=s>1?r+s:i;if(a===e[0])if(e.length===1)t.push(o.subarray(r+8,h));else{const g=le(o.subarray(r+8,h),e.slice(1));g.length&&Oe.apply(t,g)}r=h}return t}function Re(o){const e=[],t=o[0];let i=8;const r=He(o,i);i+=4;let s=0,a=0;t===0?(s=He(o,i),a=He(o,i+4),i+=8):(s=vt(o,i),a=vt(o,i+8),i+=16),i+=2;let h=o.length+a;const g=lt(o,i);i+=2;for(let d=0;d<g;d++){let v=i;const S=He(o,v);v+=4;const M=S&2147483647;if((S&2147483648)>>>31===1)return F.warn("SIDX has hierarchical references (not supported)"),null;const j=He(o,v);v+=4,e.push({referenceSize:M,subsegmentDuration:j,info:{duration:j/r,start:h,end:h+M-1}}),h+=M,v+=4,i=v}return{earliestPresentationTime:s,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 s=t[r],a=le(s,["tkhd"])[0];if(a){let h=a[0];const g=He(a,h===0?12:20),d=le(s,["mdia","mdhd"])[0];if(d){h=d[0];const v=He(d,h===0?12:20),S=le(s,["mdia","hdlr"])[0];if(S){const M=We(S.subarray(8,12)),$={soun:q.AUDIO,vide:q.VIDEO}[M],j=le(s,["mdia","minf","stbl","stsd"])[0],Q=Ke(j);$?(e[g]={timescale:v,type:$,stsd:Q},e[$]=u({timescale:v,id:g},Q)):e[g]={timescale:v,type:M,stsd:Q}}}}}return le(o,["moov","mvex","trex"]).forEach(r=>{const s=He(r,4),a=e[s];a&&(a.default={duration:He(r,12),flags:He(r,20)})}),e}function Ke(o){const e=o.subarray(8),t=e.subarray(86),i=We(e.subarray(4,8));let r=i,s;const a=i==="enca"||i==="encv";if(a){const d=le(e,[i])[0].subarray(i==="enca"?28:78);le(d,["sinf"]).forEach(S=>{const M=le(S,["schm"])[0];if(M){const $=We(M.subarray(4,8));if($==="cbcs"||$==="cenc"){const j=le(S,["frma"])[0];j&&(r=We(j))}}})}const h=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const g=le(t,["avcC"])[0];g&&g.length>3&&(r+="."+Ie(g[1])+Ie(g[2])+Ie(g[3]),s=ie(h==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const g=le(e,[i])[0],d=le(g.subarray(28),["esds"])[0];if(d&&d.length>7){let v=4;if(d[v++]!==3)break;v=Te(d,v),v+=2;const S=d[v++];if(S&128&&(v+=2),S&64&&(v+=d[v++]),d[v++]!==4)break;v=Te(d,v);const M=d[v++];if(M===64)r+="."+Ie(M);else break;if(v+=12,d[v++]!==5)break;v=Te(d,v);const $=d[v++];let j=($&248)>>3;j===31&&(j+=1+(($&7)<<3)+((d[v]&224)>>5)),r+="."+j}break}case"hvc1":case"hev1":{const g=le(t,["hvcC"])[0];if(g&&g.length>12){const d=g[1],v=["","A","B","C"][d>>6],S=d&31,M=He(g,2),$=(d&32)>>5?"H":"L",j=g[12],Q=g.subarray(6,12);r+="."+v+S,r+="."+he(M).toString(16).toUpperCase(),r+="."+$+j;let X="";for(let se=Q.length;se--;){const ce=Q[se];(ce||X)&&(X="."+ce.toString(16).toUpperCase()+X)}r+=X}s=ie(h=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=ie(r,t)||r;break}case"vp09":{const g=le(t,["vpcC"])[0];if(g&&g.length>6){const d=g[4],v=g[5],S=g[6]>>4&15;r+="."+de(d)+"."+de(v)+"."+de(S)}break}case"av01":{const g=le(t,["av1C"])[0];if(g&&g.length>2){const d=g[1]>>>5,v=g[1]&31,S=g[2]>>>7?"H":"M",M=(g[2]&64)>>6,$=(g[2]&32)>>5,j=d===2&&M?$?12:10:M?10:8,Q=(g[2]&16)>>4,X=(g[2]&8)>>3,se=(g[2]&4)>>2,ce=g[2]&3;r+="."+d+"."+de(v)+S+"."+de(j)+"."+Q+"."+X+se+ce+"."+de(1)+"."+de(1)+"."+de(1)+"."+0,s=ie("dav1",t)}break}}return{codec:r,encrypted:a,supplemental:s}}function ie(o,e){const t=le(e,["dvvC"]),i=t.length?t[0]:le(e,["dvcC"])[0];if(i){const r=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return o+"."+de(r)+"."+de(s)}}function he(o){let e=0;for(let t=0;t<32;t++)e|=(o>>t&1)<<31-t;return e>>>0}function Te(o,e){const t=e+5;for(;o[e++]&128&&e<t;);return e}function Ie(o){return("0"+o.toString(16).toUpperCase()).slice(-2)}function de(o){return(o<10?"0":"")+o}function Be(o,e){if(!o||!e)return o;const t=e.keyId;return t&&e.isCommonEncryption&&le(o,["moov","trak"]).forEach(r=>{const a=le(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let h=le(a,["enca"]);const g=h.length>0;g||(h=le(a,["encv"])),h.forEach(d=>{const v=g?d.subarray(28):d.subarray(78);le(v,["sinf"]).forEach(M=>{const $=Ge(M);if($){const j=$.subarray(8,24);j.some(Q=>Q!==0)||(F.log(`[eme] Patching keyId in 'enc${g?"a":"v"}>sinf>>tenc' box: ${J.hexDump(j)} -> ${J.hexDump(t)}`),$.set(t,8))}})})}),o}function Ge(o){const e=le(o,["schm"])[0];if(e){const t=We(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return le(o,["schi","tenc"])[0]}return null}function Ne(o,e,t){const i={},r=le(o,["moof","traf"]);for(let s=0;s<r.length;s++){const a=r[s],h=le(a,["tfhd"])[0],g=He(h,4),d=e[g];if(!d)continue;const v=i[g]||(i[g]={start:NaN,duration:0,sampleCount:0,timescale:d.timescale,type:d.type}),S=le(a,["tfdt"])[0];if(S){const oe=S[0];let ve=He(S,4);oe===1&&(ve===Me?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(ve*=Me+1,ve+=He(S,8))),k(ve)&&(!k(v.start)||ve<v.start)&&(v.start=ve)}const M=d.default,$=He(h,0)|(M==null?void 0:M.flags);let j=(M==null?void 0:M.duration)||0;$&8&&($&2?j=He(h,12):j=He(h,8));const Q=le(a,["trun"]);let X=v.start||0,se=0,ce=j;for(let oe=0;oe<Q.length;oe++){const ve=Q[oe],Ce=He(ve,4),Ue=v.sampleCount;v.sampleCount+=Ce;const Ae=ve[3]&1,ke=ve[3]&4,Pe=ve[2]&1,Se=ve[2]&2,Xe=ve[2]&4,ct=ve[2]&8;let Rt=8,St=Ce;for(Ae&&(Rt+=4),ke&&Ce&&(!(ve[Rt+1]&1)&&v.keyFrameIndex===void 0&&(v.keyFrameIndex=Ue),Rt+=4,Pe?(ce=He(ve,Rt),Rt+=4):ce=j,Se&&(Rt+=4),ct&&(Rt+=4),X+=ce,se+=ce,St--);St--;)Pe?(ce=He(ve,Rt),Rt+=4):ce=j,Se&&(Rt+=4),Xe&&(ve[Rt+1]&1||v.keyFrameIndex===void 0&&(v.keyFrameIndex=v.sampleCount-(St+1),v.keyFrameStart=X),Rt+=4),ct&&(Rt+=4),X+=ce,se+=ce;!se&&j&&(se+=j*Ce)}v.duration+=se}if(!Object.keys(i).some(s=>i[s].duration)){let s=1/0,a=0;const h=le(o,["sidx"]);for(let g=0;g<h.length;g++){const d=Re(h[g]);if(d!=null&&d.references){s=Math.min(s,d.earliestPresentationTime/d.timescale);const v=d.references.reduce((S,M)=>S+M.info.duration||0,0);a=Math.max(a,v+d.earliestPresentationTime/d.timescale)}}a&&k(a)&&Object.keys(i).forEach(g=>{i[g].duration||(i[g].duration=a*i[g].timescale-i[g].start)})}return i}function Ye(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 $e(o,e){const t=new Uint8Array(o.length+e.length);return t.set(o),t.set(e,o.length),t}function st(o,e){const t=[],i=e.samples,r=e.timescale,s=e.id;let a=!1;return le(i,["moof"]).map(g=>{const d=g.byteOffset-8;le(g,["traf"]).map(S=>{const M=le(S,["tfdt"]).map($=>{const j=$[0];let Q=He($,4);return j===1&&(Q*=Math.pow(2,32),Q+=He($,8)),Q/r})[0];return M!==void 0&&(o=M),le(S,["tfhd"]).map($=>{const j=He($,4),Q=He($,0)&16777215,X=(Q&1)!==0,se=(Q&2)!==0,ce=(Q&8)!==0;let oe=0;const ve=(Q&16)!==0;let Ce=0;const Ue=(Q&32)!==0;let Ae=8;j===s&&(X&&(Ae+=8),se&&(Ae+=4),ce&&(oe=He($,Ae),Ae+=4),ve&&(Ce=He($,Ae),Ae+=4),Ue&&(Ae+=4),e.type==="video"&&(a=nt(e.codec)),le(S,["trun"]).map(ke=>{const Pe=ke[0],Se=He(ke,0)&16777215,Xe=(Se&1)!==0;let ct=0;const Rt=(Se&4)!==0,St=(Se&256)!==0;let Et=0;const yt=(Se&512)!==0;let It=0;const ft=(Se&1024)!==0,Mt=(Se&2048)!==0;let Pt=0;const pt=He(ke,4);let ot=8;Xe&&(ct=He(ke,ot),ot+=4),Rt&&(ot+=4);let Ht=ct+d;for(let Kt=0;Kt<pt;Kt++){if(St?(Et=He(ke,ot),ot+=4):Et=oe,yt?(It=He(ke,ot),ot+=4):It=Ce,ft&&(ot+=4),Mt&&(Pe===0?Pt=He(ke,ot):Pt=Ee(ke,ot),ot+=4),e.type===q.VIDEO){let Yt=0;for(;Yt<It;){const Vt=He(i,Ht);if(Ht+=4,Je(a,i[Ht])){const pi=i.subarray(Ht,Ht+Vt);tt(pi,a?2:1,o+Pt/r,t)}Ht+=Vt,Yt+=Vt+4}}o+=Et/r}}))})})}),t}function nt(o){if(!o)return!1;const e=o.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function Je(o,e){if(o){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function tt(o,e,t,i){const r=gt(o);let s=0;s+=e;let a=0,h=0,g=0;for(;s<r.length;){a=0;do{if(s>=r.length)break;g=r[s++],a+=g}while(g===255);h=0;do{if(s>=r.length)break;g=r[s++],h+=g}while(g===255);const d=r.length-s;let v=s;if(h<d)s+=h;else if(h>d){F.error(`Malformed SEI payload. ${h} is too small, only ${d} bytes left to parse.`);break}if(a===4){if(r[v++]===181){const M=lt(r,v);if(v+=2,M===49){const $=He(r,v);if(v+=4,$===1195456820){const j=r[v++];if(j===3){const Q=r[v++],X=31&Q,se=64&Q,ce=se?2+X*3:0,oe=new Uint8Array(ce);if(se){oe[0]=Q;for(let ve=1;ve<ce;ve++)oe[ve]=r[v++]}i.push({type:j,payloadType:a,pts:t,bytes:oe})}}}}}else if(a===5&&h>16){const S=[];for(let j=0;j<16;j++){const Q=r[v++].toString(16);S.push(Q.length==1?"0"+Q:Q),(j===3||j===5||j===7||j===9)&&S.push("-")}const M=h-16,$=new Uint8Array(M);for(let j=0;j<M;j++)$[j]=r[v++];i.push({payloadType:a,pts:t,uuid:S.join(""),userData:ae($),userDataBytes:$})}}}function gt(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,s=new Uint8Array(r);let a=0;for(i=0;i<r;a++,i++)a===t[0]&&(a++,t.shift()),s[i]=o[a];return s}function _t(o){const e=o[0];let t="",i="",r=0,s=0,a=0,h=0,g=0,d=0;if(e===0){for(;We(o.subarray(d,d+1))!=="\0";)t+=We(o.subarray(d,d+1)),d+=1;for(t+=We(o.subarray(d,d+1)),d+=1;We(o.subarray(d,d+1))!=="\0";)i+=We(o.subarray(d,d+1)),d+=1;i+=We(o.subarray(d,d+1)),d+=1,r=He(o,12),s=He(o,16),h=He(o,20),g=He(o,24),d=28}else if(e===1){d+=4,r=He(o,d),d+=4;const S=He(o,d);d+=4;const M=He(o,d);for(d+=4,a=Bo(2,32)*S+M,I(a)||(a=Number.MAX_SAFE_INTEGER,F.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),h=He(o,d),d+=4,g=He(o,d),d+=4;We(o.subarray(d,d+1))!=="\0";)t+=We(o.subarray(d,d+1)),d+=1;for(t+=We(o.subarray(d,d+1)),d+=1;We(o.subarray(d,d+1))!=="\0";)i+=We(o.subarray(d,d+1)),d+=1;i+=We(o.subarray(d,d+1)),d+=1}const v=o.subarray(d,o.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:a,presentationTimeDelta:s,eventDuration:h,id:g,payload:v}}function it(o,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=i&255,s.set(o,4),r=0,i=8;r<t;r++)s.set(e[r],i),i+=e[r].byteLength;return s}function Dt(o,e,t){if(o.byteLength!==16)throw new RangeError("Invalid system id");let i,r;i=0,r=new Uint8Array;let s;i>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const a=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),it([112,115,115,104],new Uint8Array([i,0,0,0]),o,s,r,a,t||new Uint8Array)}const Tt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),at={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 Ot(o,e){const t=at[e];return!!t&&!!t[o.slice(0,4)]}function Ut(o,e,t=!0){return!o.split(",").some(i=>!rt(i,e,t))}function rt(o,e,t=!0){var i;const r=Y(t);return(i=r==null?void 0:r.isTypeSupported(xt(o,e)))!=null?i:!1}function xt(o,e){return`${e}/mp4;codecs=${o}`}function xe(o){if(o){const e=o.substring(0,4);return at.video[e]}return 2}function ge(o){const e=Tt();return o.split(",").reduce((t,i)=>{const s=e&&nt(i)?9:at.video[i];return s?(s*2+t)/(t?3:2):(at.audio[i]+t)/(t?2:1)},0)}const ye={};function ee(o,e=!0){if(ye[o])return ye[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(rt(t[r],"audio",e))return ye[o]=t[r],t[r];if(t[r]==="mp3"&&(i=Y(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return o}const te=/flac|opus|mp4a\.40\.34/i;function ue(o,e=!0){return o.replace(te,t=>ee(t.toLowerCase(),e))}function fe(o,e){const t=[];if(o){const i=o.split(",");for(let r=0;r<i.length;r++)Ot(i[r],"video")||t.push(i[r])}return e&&t.push(e),t.join(",")}function pe(o,e){if(o&&(o.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(o)!==-1)&&(Ze(o,"audio")||Ze(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 Ze(o,e){return Ot(o,e)&&rt(o,e)}function Qe(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 ut(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 dt(o){const e=Y(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 kt(o){return o.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const zt={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Nt(o,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:o}}function Ct(o,e,t,i,r,s){const a=o.videoCodec,h=o.audioCodec?o.audioGroups:null,g=s==null?void 0:s.audioCodec,d=s==null?void 0:s.channels,v=d?parseInt(d):g?1/0:2;let S=null;if(h!=null&&h.length)try{h.length===1&&h[0]?S=e.groups[h[0]].channels:S=h.reduce((M,$)=>{if($){const j=e.groups[$];if(!j)throw new Error(`Audio track group ${$} not found`);Object.keys(j.channels).forEach(Q=>{M[Q]=(M[Q]||0)+j.channels[Q]})}return M},{2:0})}catch(M){return!0}return a!==void 0&&(a.split(",").some(M=>nt(M))||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&&k(v)&&Object.keys(S).some(M=>parseInt(M)>v)}function oi(o,e,t,i={}){const r=o.videoCodec;if(!r&&!o.audioCodec||!t)return Promise.resolve(zt);const s=[],a=_i(o),h=a.length,g=ti(o,e,h>0),d=g.length;for(let v=h||1*d||1;v--;){const S={type:"media-source"};if(h&&(S.video=a[v%h]),d){S.audio=g[v%d];const M=S.audio.bitrate;S.video&&M&&(S.video.bitrate-=M)}s.push(S)}if(r){const v=navigator.userAgent;if(r.split(",").some(S=>nt(S))&&Tt())return Promise.resolve(Nt(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${v})`),s))}return Promise.all(s.map(v=>{const S=ze(v);return i[S]||(i[S]=t.decodingInfo(v))})).then(v=>({supported:!v.some(S=>!S.supported),configurations:s,decodingInfoResults:v})).catch(v=>({supported:!1,configurations:s,decodingInfoResults:[],error:v}))}function _i(o){var e;const t=(e=o.videoCodec)==null?void 0:e.split(","),i=et(o),r=o.width||640,s=o.height||480,a=o.frameRate||30,h=o.videoRange.toLowerCase();return t?t.map(g=>{const d={contentType:xt(ut(g),"video"),width:r,height:s,bitrate:i,framerate:a};return h!=="sdr"&&(d.transferFunction=h),d}):[]}function ti(o,e,t){var i;const r=(i=o.audioCodec)==null?void 0:i.split(","),s=et(o);return r&&o.audioGroups?o.audioGroups.reduce((a,h)=>{var g;const d=h?(g=e.groups[h])==null?void 0:g.tracks:null;return d?d.reduce((v,S)=>{if(S.groupId===h){const M=parseFloat(S.channels||"");r.forEach($=>{const j={contentType:xt($,"audio"),bitrate:t?ri($,s):s};M&&(j.channels=""+M),v.push(j)})}return v},a):a},[]):[]}function ri(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 et(o){return Math.ceil(Math.max(o.bitrate*.9,o.averageBitrate)/1e3)*1e3||1}function ze(o){let e="";const{audio:t,video:i}=o;if(i){const r=kt(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=kt(t.contentType);e+=`${i?"_":""}${r}_c${t.channels}`}return e}const ht=["NONE","TYPE-0","TYPE-1",null];function Bt(o){return ht.indexOf(o)>-1}const $t=["SDR","PQ","HLG"];function Zt(o){return!!o&&$t.indexOf(o)>-1}var wi={No:"",Yes:"YES",v2:"v2"};function yi(o){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=o,r=i<e/2;return e&&r?t?wi.v2:wi.Yes:wi.No}class li{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 mi{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 jt(this._audioGroups,e)}hasSubtitleGroup(e){return jt(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 jt(o,e){return!e||!o?!1:o.indexOf(e)!==-1}function Fi(){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 ni(o,e){let t=!1,i=[];if(o&&(t=o!=="SDR",i=[o]),e){i=e.allowedVideoRanges||$t.slice(0);const r=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&Fi(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const pr=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}},At=(o,e)=>JSON.stringify(o,pr(e));function Gt(o,e,t,i,r){const s=Object.keys(o),a=i==null?void 0:i.channels,h=i==null?void 0:i.audioCodec,g=r==null?void 0:r.videoCodec,d=a&&parseInt(a)===2;let v=!1,S=!1,M=1/0,$=1/0,j=1/0,Q=1/0,X=0,se=[];const{preferHDR:ce,allowedVideoRanges:oe}=ni(e,r);for(let ke=s.length;ke--;){const Pe=o[s[ke]];v||(v=Pe.channels[2]>0),M=Math.min(M,Pe.minHeight),$=Math.min($,Pe.minFramerate),j=Math.min(j,Pe.minBitrate),oe.filter(Xe=>Pe.videoRanges[Xe]>0).length>0&&(S=!0)}M=k(M)?M:0,$=k($)?$:0;const ve=Math.max(1080,M),Ce=Math.max(30,$);j=k(j)?j:t,t=Math.max(j,t),S||(e=void 0);const Ue=s.length>1;return{codecSet:s.reduce((ke,Pe)=>{const Se=o[Pe];if(Pe===ke)return ke;if(se=S?oe.filter(Xe=>Se.videoRanges[Xe]>0):[],Ue){if(Se.minBitrate>t)return Wt(Pe,`min bitrate of ${Se.minBitrate} > current estimate of ${t}`),ke;if(!Se.hasDefaultAudio)return Wt(Pe,"no renditions with default or auto-select sound found"),ke;if(h&&Pe.indexOf(h.substring(0,4))%5!==0)return Wt(Pe,`audio codec preference "${h}" not found`),ke;if(a&&!d){if(!Se.channels[a])return Wt(Pe,`no renditions with ${a} channel sound found (channels options: ${Object.keys(Se.channels)})`),ke}else if((!h||d)&&v&&Se.channels[2]===0)return Wt(Pe,"no renditions with stereo sound found"),ke;if(Se.minHeight>ve)return Wt(Pe,`min resolution of ${Se.minHeight} > maximum of ${ve}`),ke;if(Se.minFramerate>Ce)return Wt(Pe,`min framerate of ${Se.minFramerate} > maximum of ${Ce}`),ke;if(!se.some(Xe=>Se.videoRanges[Xe]>0))return Wt(Pe,`no variants with VIDEO-RANGE of ${At(se)} found`),ke;if(g&&Pe.indexOf(g.substring(0,4))%5!==0)return Wt(Pe,`video codec preference "${g}" not found`),ke;if(Se.maxScore<X)return Wt(Pe,`max score of ${Se.maxScore} < selected max of ${X}`),ke}return ke&&(ge(Pe)>=ge(ke)||Se.fragmentError>o[ke].fragmentError)?ke:(Q=Se.minIndex,X=Se.maxScore,Pe)},void 0),videoRanges:se,preferHDR:ce,minFramerate:$,minBitrate:j,minIndex:Q}}function Wt(o,e){F.log(`[abr] start candidates with "${o}" ignored because ${e}`)}function vi(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 si(o,e,t,i){return o.slice(t,i+1).reduce((r,s,a)=>{if(!s.codecSet)return r;const h=s.audioGroups;let g=r[s.codecSet];g||(r[s.codecSet]=g={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!h,fragmentError:0}),g.minBitrate=Math.min(g.minBitrate,s.bitrate);const d=Math.min(s.height,s.width);return g.minHeight=Math.min(g.minHeight,d),g.minFramerate=Math.min(g.minFramerate,s.frameRate),g.minIndex=Math.min(g.minIndex,a),g.maxScore=Math.max(g.maxScore,s.score),g.fragmentError+=s.fragmentError,g.videoRanges[s.videoRange]=(g.videoRanges[s.videoRange]||0)+1,h&&h.forEach(v=>{if(!v)return;const S=e.groups[v];S&&(g.hasDefaultAudio=g.hasDefaultAudio||e.hasDefaultAudio?S.hasDefault:S.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(S.channels).forEach(M=>{g.channels[M]=(g.channels[M]||0)+S.channels[M]}))}),r},{})}function bi(o){if(!o)return o;const{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:s}=o;return{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:s}}function di(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(Ei(o,r,t))return i}return-1}function Ei(o,e,t){const{groupId:i,name:r,lang:s,assocLang:a,default:h}=o,g=o.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(s===void 0||Ar(s,e.lang))&&(s===void 0||e.assocLang===a)&&(h===void 0||e.default===h)&&(g===void 0||e.forced===g)&&(!("characteristics"in o)||Ii(o.characteristics||"",e.characteristics))&&(t===void 0||t(o,e))}function Ar(o,e="--"){return o.length===e.length?o===e:o.startsWith(e)||e.startsWith(o)}function Ii(o,e=""){const t=o.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function Ti(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 _n(o,e,t,i,r){const s=e[i],h=e.reduce((M,$,j)=>{const Q=$.uri;return(M[Q]||(M[Q]=[])).push(j),M},{})[s.uri];h.length>1&&(i=Math.max.apply(Math,h));const g=s.videoRange,d=s.frameRate,v=s.codecSet.substring(0,4),S=Yr(e,i,M=>{if(M.videoRange!==g||M.frameRate!==d||M.codecSet.substring(0,4)!==v)return!1;const $=M.audioGroups,j=t.filter(Q=>!$||$.indexOf(Q.groupId)!==-1);return di(o,j,r)>-1});return S>-1?S:Yr(e,i,M=>{const $=M.audioGroups,j=t.filter(Q=>!$||$.indexOf(Q.groupId)!==-1);return di(o,j,r)>-1})}function Yr(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 _r(o,e){var t;return!!o&&o!==((t=e.loadLevelObj)==null?void 0:t.uri)}class gn 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:s,hls:a}=this,{autoLevelEnabled:h,media:g}=a;if(!r||!g)return;const d=performance.now(),v=s?s.stats:r.stats,S=s?s.duration:r.duration,M=d-v.loading.start,$=a.minAutoLevel,j=r.level,Q=this._nextAutoLevel;if(v.aborted||v.loaded&&v.loaded===v.total||j<=$){this.clearTimer(),this._nextAutoLevel=-1;return}if(!h)return;const X=Q>-1&&Q!==j,se=!!t||X;if(!se&&(g.paused||!g.playbackRate||!g.readyState))return;const ce=a.mainForwardBufferInfo;if(!se&&ce===null)return;const oe=this.bwEstimator.getEstimateTTFB(),ve=Math.abs(g.playbackRate);if(M<=Math.max(oe,1e3*(S/(ve*2))))return;const Ce=ce?ce.len/ve:0,Ue=v.loading.first?v.loading.first-v.loading.start:-1,Ae=v.loaded&&Ue>-1,ke=this.getBwEstimate(),Pe=a.levels,Se=Pe[j],Xe=Math.max(v.loaded,Math.round(S*(r.bitrate||Se.averageBitrate)/8));let ct=Ae?M-Ue:M;ct<1&&Ae&&(ct=Math.min(M,v.loaded*8/ke));const Rt=Ae?v.loaded*1e3/ct:0,St=oe/1e3,Et=Rt?(Xe-v.loaded)/Rt:Xe*8/ke+St;if(Et<=Ce)return;const yt=Rt?Rt*8:ke,It=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,ft=this.hls.config.abrBandWidthUpFactor;let Mt=Number.POSITIVE_INFINITY,Pt;for(Pt=j-1;Pt>$;Pt--){const Kt=Pe[Pt].maxBitrate,Yt=!Pe[Pt].details||It;if(Mt=this.getTimeToLoadFrag(St,yt,S*Kt,Yt),Mt<Math.min(Ce,S+St))break}if(Mt>=Et||Mt>S*10)return;Ae?this.bwEstimator.sample(M-Math.min(oe,Ue),v.loaded):this.bwEstimator.sampleTTFB(M);const pt=Pe[Pt].maxBitrate;this.getBwEstimate()*ft>pt&&this.resetEstimator(pt);const ot=this.findBestLevel(pt,$,Pt,0,Ce,1,1);ot>-1&&(Pt=ot),this.warn(`Fragment ${r.sn}${s?" part "+s.index:""} of level ${j} is loading too slowly;
Fragment duration: ${r.duration.toFixed(3)}
Time to underbuffer: ${Ce.toFixed(3)} s
Estimated load time for current fragment: ${Et.toFixed(3)} s
Estimated load time for down switch fragment: ${Mt.toFixed(3)} s
TTFB estimate: ${Ue|0} ms
Current BW estimate: ${k(ke)?ke|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${Pt} @ ${pt|0} bps`),a.nextLoadLevel=a.nextAutoLevel=Pt,this.clearTimer();const Ht=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===Pt&&Pt>0){const Kt=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Pt>0?"and switching down":""}
Fragment duration: ${r.duration.toFixed(3)} s
Time to underbuffer: ${Kt.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,Pt>$){let Yt=this.findBestLevel(this.hls.levels[$].bitrate,$,Pt,0,Kt,1,1);Yt===-1&&(Yt=$),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Yt,this.resetEstimator(this.hls.levels[Yt].bitrate)}}};X||Et>Mt*2?Ht():this.timer=self.setInterval(Ht,Mt*1e3),a.trigger(_.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:s,stats:v})},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:s}=this;if(i&&r&&i.sn===r.sn&&i.level===r.level){const a=performance.now(),h=s?s.stats:i.stats,g=a-h.loading.start,d=h.loading.first?h.loading.first-h.loading.start:-1;if(h.loaded&&d>-1){const S=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(g-Math.min(S,d),h.loaded)}else this.bwEstimator.sampleTTFB(g)}break}}}getTimeToLoadFrag(e,t,i,r){const s=e+i/t,a=r?e+this.lastLevelLoadSec:0;return s+a}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,s=r.end-r.first;k(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const r=i?i.stats:t.stats;if(t.type===m.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 s=i?i.duration:t.duration,a=this.hls.levels[t.level],h=(a.loaded?a.loaded.bytes:0)+r.loaded,g=(a.loaded?a.loaded.duration:0)+s;a.loaded={bytes:h,duration:g},a.realBitrate=Math.round(8*h/g)}if(t.bitrateTest){const s={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(_.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:r}=t,s=r!=null&&r.stats.loaded?r.stats:i.stats;if(s.aborted||this.ignoreFragment(i))return;const a=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,s.loaded),s.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==m.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,s=this.findBestLevel(i,t,e,0,r,1,1);if(s>-1)return s;const a=this.hls.firstLevel,h=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 ${h}`),h}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 s=i&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,s)&&a[e].loadError<=a[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:r,config:s,minAutoLevel:a}=i,h=t?t.duration:e?e.duration:0,g=this.getBwEstimate(),d=this.getStarvationDelay();let v=s.abrBandWidthFactor,S=s.abrBandWidthUpFactor;if(d){const X=this.findBestLevel(g,a,r,d,0,v,S);if(X>=0)return this.rebufferNotice=-1,X}let M=h?Math.min(h,s.maxStarvationDelay):s.maxStarvationDelay;if(!d){const X=this.bitrateTestDelay;X&&(M=(h?Math.min(h,s.maxLoadingDelay):s.maxLoadingDelay)-X,this.info(`bitrate test took ${Math.round(1e3*X)}ms, set first fragment max fetchDuration to ${Math.round(1e3*M)} ms`),v=S=1)}const $=this.findBestLevel(g,a,r,d,M,v,S);if(this.rebufferNotice!==$&&(this.rebufferNotice=$,this.info(`${d?"rebuffering expected":"buffer is empty"}, optimal quality level ${$}`)),$>-1)return $;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,s,a,h){var g;const d=r+s,v=this.lastLoadedFragLevel,S=v===-1?this.hls.firstLevel:v,{fragCurrent:M,partCurrent:$}=this,{levels:j,allAudioTracks:Q,loadLevel:X,config:se}=this.hls;if(j.length===1)return 0;const ce=j[S],oe=!!((g=this.hls.latestLevelDetails)!=null&&g.live),ve=X===-1||v===-1;let Ce,Ue="SDR",Ae=(ce==null?void 0:ce.frameRate)||0;const{audioPreference:ke,videoPreference:Pe}=se,Se=this.audioTracksByGroup||(this.audioTracksByGroup=vi(Q));let Xe=-1;if(ve){if(this.firstSelection!==-1)return this.firstSelection;const It=this.codecTiers||(this.codecTiers=si(j,Se,t,i)),ft=Gt(It,Ue,e,ke,Pe),{codecSet:Mt,videoRanges:Pt,minFramerate:pt,minBitrate:ot,minIndex:Ht,preferHDR:Kt}=ft;Xe=Ht,Ce=Mt,Ue=Kt?Pt[Pt.length-1]:Pt[0],Ae=pt,e=Math.max(e,ot),this.log(`picked start tier ${At(ft)}`)}else Ce=ce==null?void 0:ce.codecSet,Ue=ce==null?void 0:ce.videoRange;const ct=$?$.duration:M?M.duration:0,Rt=this.bwEstimator.getEstimateTTFB()/1e3,St=[];for(let It=i;It>=t;It--){var Et,yt;const ft=j[It],Mt=It>S;if(!ft)continue;if(se.useMediaCapabilities&&!ft.supportedResult&&!ft.supportedPromise){const Vt=navigator.mediaCapabilities;typeof(Vt==null?void 0:Vt.decodingInfo)=="function"&&Ct(ft,Se,Ue,Ae,e,ke)?(ft.supportedPromise=oi(ft,Se,Vt,this.supportedCache),ft.supportedPromise.then(pi=>{if(!this.hls)return;ft.supportedResult=pi;const ji=this.hls.levels,Ri=ji.indexOf(ft);pi.error?this.warn(`MediaCapabilities decodingInfo error: "${pi.error}" for level ${Ri} ${At(pi)}`):pi.supported?pi.decodingInfoResults.some(Wi=>Wi.smooth===!1||Wi.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Ri} not smooth or powerEfficient: ${At(pi)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Ri} ${At(pi)}`),Ri>-1&&ji.length>1&&(this.log(`Removing unsupported level ${Ri}`),this.hls.removeLevel(Ri),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):ft.supportedResult=zt}if((Ce&&ft.codecSet!==Ce||Ue&&ft.videoRange!==Ue||Mt&&Ae>ft.frameRate||!Mt&&Ae>0&&Ae<ft.frameRate||(Et=ft.supportedResult)!=null&&(yt=Et.decodingInfoResults)!=null&&yt.some(Vt=>Vt.smooth===!1))&&(!ve||It!==Xe)){St.push(It);continue}const Pt=ft.details,pt=($?Pt==null?void 0:Pt.partTarget:Pt==null?void 0:Pt.averagetargetduration)||ct;let ot;Mt?ot=h*e:ot=a*e;const Ht=ct&&r>=ct*2&&s===0?ft.averageBitrate:ft.maxBitrate,Kt=this.getTimeToLoadFrag(Rt,ot,Ht*pt,Pt===void 0);if(ot>=Ht&&(It===v||ft.loadError===0&&ft.fragmentError===0)&&(Kt<=Rt||!k(Kt)||oe&&!this.bitrateTestDelay||Kt<d)){const Vt=this.forcedAutoLevel;return It!==X&&(Vt===-1||Vt!==X)&&(St.length&&this.trace(`Skipped level(s) ${St.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${j[St[0]].codecs}" ${j[St[0]].videoRange}; not compatible with "${Ce}" ${Ue}`),this.info(`switch candidate:${S}->${It} adjustedbw(${Math.round(ot)})-bitrate=${Math.round(ot-Ht)} ttfb:${Rt.toFixed(1)} avgDuration:${pt.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${Kt.toFixed(1)} firstSelection:${ve} codecSet:${ft.codecSet} videoRange:${ft.videoRange} hls.loadLevel:${X}`)),ve&&(this.firstSelection=It),It}}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 Or={search:function(o,e){let t=0,i=o.length-1,r=null,s=null;for(;t<=i;){r=(t+i)/2|0,s=o[r];const a=e(s);if(a>0)t=r+1;else if(a<0)i=r-1;else return s}return null}};function Zi(o,e,t){if(e===null||!Array.isArray(o)||!o.length||!k(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 s=0;s<o.length;++s){const a=o[s];if(Mi(e,t,a))return a}return null}function gi(o,e,t=0,i=0,r=.005){let s=null;if(o){s=e[1+o.sn-e[0].sn]||null;const h=o.endDTS-t;h>0&&h<15e-7&&(t+=15e-7),s&&o.level!==s.level&&s.end<=o.end&&(s=e[2+o.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!o||o.level===s.level)&&Fr(t,i,s)===0||xi(s,o,Math.min(r,i))))return s;const a=Or.search(e,Fr.bind(null,t,i));return a&&(a!==o||!s)?a:s}function xi(o,e,t){if(e&&e.start===0&&e.level<o.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((r,s)=>(s[0]==="INF"&&(r+=parseFloat(s[1])),r),t);return o.start<=i}return!1}function Fr(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 Mi(o,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>o}function Qt(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 s;return Or.search(i,a=>a.cc<e?1:a.cc>e?-1:(s=a,a.end<=t?1:a.start>t?-1:0)),s||null}return null}function Jt(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 Bi(o,e){const t=Jt(e);return o.default[`${t?"timeout":"error"}Retry`]}function Xi(o,e){const t=o.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*o.retryDelayMs,o.maxRetryDelayMs)}function Pi(o){return u(u({},o),{errorRetry:null,timeoutRetry:null})}function gr(o,e,t,i){if(!o)return!1;const r=i==null?void 0:i.code,s=e<o.maxNumRetry&&(Mr(r)||!!t);return o.shouldRetry?o.shouldRetry(o,e,t,i,s):s}function Mr(o){return o===0&&navigator.onLine===!1||!!o&&(o<400||o>499)}var ui={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Si={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class mn extends T{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(_.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,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===m.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const r=this.hls,s=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=lr();return}case w.FRAG_GAP:case w.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ui.SendAlternateToPenaltyBox;return}case w.LEVEL_EMPTY_ERROR:case w.LEVEL_PARSING_ERROR:{var a,h;const d=t.parent===m.MAIN?t.level:r.loadLevel;t.details===w.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(h=a.levelDetails)!=null&&h.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,d):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,d))}return;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.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(s){const d=r.loadLevelObj;if(d&&(s.type===O.AUDIO_TRACK&&d.hasAudioGroup(s.groupId)||s.type===O.SUBTITLE_TRACK&&d.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=ui.SendAlternateToPenaltyBox,t.errorAction.flags=Si.MoveAllAlternatesMatchingHost;return}}return;case w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const d=r.loadLevelObj,v=d==null?void 0:d.attrs["HDCP-LEVEL"];v?t.errorAction={action:ui.SendAlternateToPenaltyBox,flags:Si.MoveAllAlternatesMatchingHDCP,hdcpLevel:v}:this.keySystemError(t)}return;case w.BUFFER_ADD_CODEC_ERROR:case w.REMUX_ALLOC_ERROR:case w.BUFFER_APPEND_ERROR:if(!t.errorAction){var g;t.errorAction=this.getLevelSwitchAction(t,(g=t.level)!=null?g: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=lr();return}t.type===D.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,r=Bi(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(gr(r,s,Jt(e),e.response))return{action:ui.RetryRequest,flags:Si.None,retryConfig:r,retryCount:s};const h=this.getLevelSwitchAction(e,t);return r&&(h.retryConfig=r,h.retryCount=s),h}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:s,keyLoadPolicy:a}=t.config,h=Bi(e.details.startsWith("key")?a:s,e),g=t.levels.reduce((v,S)=>v+S.fragmentError,0);if(r&&(e.details!==w.FRAG_GAP&&r.fragmentError++,gr(h,g,Jt(e),e.response)))return{action:ui.RetryRequest,flags:Si.None,retryConfig:h,retryCount:g};const d=this.getLevelSwitchAction(e,i);return h&&(d.retryConfig=h,d.retryCount=g),d}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r){var s,a;const d=e.details;r.loadError++,d===w.BUFFER_APPEND_ERROR&&r.fragmentError++;let v=-1;const{levels:S,loadLevel:M,minAutoLevel:$,maxAutoLevel:j}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const Q=(s=e.frag)==null?void 0:s.type,se=(Q===m.AUDIO&&d===w.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(d===w.BUFFER_ADD_CODEC_ERROR||d===w.BUFFER_APPEND_ERROR))&&S.some(({audioCodec:Ue})=>r.audioCodec!==Ue),oe=e.sourceBufferName==="video"&&(d===w.BUFFER_ADD_CODEC_ERROR||d===w.BUFFER_APPEND_ERROR)&&S.some(({codecSet:Ue,audioCodec:Ae})=>r.codecSet!==Ue&&r.audioCodec===Ae),{type:ve,groupId:Ce}=(a=e.context)!=null?a:{};for(let Ue=S.length;Ue--;){const Ae=(Ue+M)%S.length;if(Ae!==M&&Ae>=$&&Ae<=j&&S[Ae].loadError===0){var h,g;const ke=S[Ae];if(d===w.FRAG_GAP&&Q===m.MAIN&&e.frag){const Pe=S[Ae].details;if(Pe){const Se=gi(e.frag,Pe.fragments,e.frag.start);if(Se!=null&&Se.gap)continue}}else{if(ve===O.AUDIO_TRACK&&ke.hasAudioGroup(Ce)||ve===O.SUBTITLE_TRACK&&ke.hasSubtitleGroup(Ce))continue;if(Q===m.AUDIO&&(h=r.audioGroups)!=null&&h.some(Pe=>ke.hasAudioGroup(Pe))||Q===m.SUBTITLE&&(g=r.subtitleGroups)!=null&&g.some(Pe=>ke.hasSubtitleGroup(Pe))||se&&r.audioCodec===ke.audioCodec||!se&&r.audioCodec!==ke.audioCodec||oe&&r.codecSet===ke.codecSet)continue}v=Ae;break}}if(v>-1&&i.loadLevel!==v)return e.levelRetry=!0,this.playlistError=0,{action:ui.SendAlternateToPenaltyBox,flags:Si.None,nextAutoLevel:v}}return{action:ui.SendAlternateToPenaltyBox,flags:Si.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ui.DoNothing:break;case ui.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 ui.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:s,nextAutoLevel:a}=i;switch(r){case Si.None:this.switchLevel(e,a);break;case Si.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=ht[ht.indexOf(s)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,a)}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=kt(e.mimeType),r=this.hls.levels;for(let s=r.length;s--;)r[s][`${e.sourceBufferName}Codec`]===i&&this.hls.removeLevel(s)}}}function lr(o){const e={action:ui.DoNothing,flags:Si.None};return o&&(e.resolved=!0),e}var ai={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Br{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(_.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.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.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 s=i[r];if(!s)break;const a=s.end;if(s.start<=e&&a!==null&&e<=a)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:r}=this,s=Object.keys(r);for(let a=s.length;a--;){const h=r[s[a]];if((h==null?void 0:h.body.type)===t&&(!i||h.buffered)){const g=h.body;if(g.start<=e&&e<=g.end)return g}}return null}detectEvictedFragments(e,t,i,r,s){this.timeRanges&&(this.timeRanges[e]=t);const a=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(h=>{const g=this.fragments[h];if(!g||a>=g.body.sn)return;if(!g.buffered&&(!g.loaded||s)){g.body.type===i&&this.removeFragment(g.body);return}const d=g.range[e];if(d){if(d.time.length===0){this.removeFragment(g.body);return}d.time.some(v=>{const S=!this.isTimeBuffered(v.startPTS,v.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=Oi(i),s=this.fragments[r];if(!s||s.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(h=>{const g=i.elementaryStreams[h];if(!g)return;const d=t[h],v=a||g.partial===!0;s.range[h]=this.getBufferedTimes(i,e.part,v,d)}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=i.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),mr(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=Qi(i,r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=Oi(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 s={time:[],partial:i},a=e.start,h=e.end,g=e.minEndPTS||h,d=e.maxStartPTS||a;for(let v=0;v<r.length;v++){const S=r.start(v)-this.bufferPadding,M=r.end(v)+this.bufferPadding;if(d>=S&&g<=M){s.time.push({startPTS:Math.max(a,r.start(v)),endPTS:Math.min(h,r.end(v))});break}else if(a<M&&h>S){const $=Math.max(a,r.start(v)),j=Math.min(h,r.end(v));j>$&&(s.partial=!0,s.time.push({startPTS:$,endPTS:j}))}else if(h<=S)break}return s}getPartialFragment(e){let t=null,i,r,s,a=0;const{bufferPadding:h,fragments:g}=this;return Object.keys(g).forEach(d=>{const v=g[d];v&&mr(v)&&(r=v.body.start-h,s=v.body.end+h,e>=r&&e<=s&&(i=Math.min(e-r,s-e),a<=i&&(t=v.body,a=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||mr(t))}getState(e){const t=Oi(e),i=this.fragments[t];return i?i.buffered?mr(i)?ai.PARTIAL:ai.OK:ai.APPENDING:ai.NOT_LOADED}isTimeBuffered(e,t,i){let r,s;for(let a=0;a<i.length;a++){if(r=i.start(a)-this.bufferPadding,s=i.end(a)+this.bufferPadding,e>=r&&t<=s)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,s=Oi(i);this.fragments[s]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:s,type:a}=t;if(i.sn==="initSegment")return;const h=i.type;if(r){let d=this.activePartLists[h];d||(this.activePartLists[h]=d=[]),d.push(r)}this.timeRanges=s;const g=s[a];this.detectEvictedFragments(a,g,h,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Oi(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 s=t[i[r]];if((s==null?void 0:s.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,s){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const h=this.fragments[a];if(!h)return;const g=h.body;g.type!==i||r&&!g.gap||g.start<t&&g.end>e&&(h.buffered||s)&&this.removeFragment(g)})}removeFragment(e){const t=Oi(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=Qi(i,s=>s.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e,t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const i=(e=this.hls)==null||(t=e.latestLevelDetails)==null?void 0:t.partList;i&&i.forEach(r=>r.clearElementaryStreamInfo())}}function mr(o){var e,t,i;return o.buffered&&(o.body.gap||((e=o.range.video)==null?void 0:e.partial)||((t=o.range.audio)==null?void 0:t.partial)||((i=o.range.audiovideo)==null?void 0:i.partial))}function Oi(o){return`${o.type}_${o.level}_${o.sn}`}function Qi(o,e){return o.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Di={cbc:0,ctr:1};class Ji{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 Di.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Di.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 Zr(o){const e=o.byteLength,t=e&&new DataView(o.buffer).getUint8(e-1);return t?o.slice(0,e-t):o}class Li{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],s=i[1],a=i[2],h=i[3],g=this.invSubMix,d=g[0],v=g[1],S=g[2],M=g[3],$=new Uint32Array(256);let j=0,Q=0,X=0;for(X=0;X<256;X++)X<128?$[X]=X<<1:$[X]=X<<1^283;for(X=0;X<256;X++){let se=Q^Q<<1^Q<<2^Q<<3^Q<<4;se=se>>>8^se&255^99,e[j]=se,t[se]=j;const ce=$[j],oe=$[ce],ve=$[oe];let Ce=$[se]*257^se*16843008;r[j]=Ce<<24|Ce>>>8,s[j]=Ce<<16|Ce>>>16,a[j]=Ce<<8|Ce>>>24,h[j]=Ce,Ce=ve*16843009^oe*65537^ce*257^j*16843008,d[se]=Ce<<24|Ce>>>8,v[se]=Ce<<16|Ce>>>16,S[se]=Ce<<8|Ce>>>24,M[se]=Ce,j?(j=ce^$[$[$[ve^ce]]],Q^=$[$[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 s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const a=this.ksRows=(s+6+1)*4;let h,g;const d=this.keySchedule=new Uint32Array(a),v=this.invKeySchedule=new Uint32Array(a),S=this.sBox,M=this.rcon,$=this.invSubMix,j=$[0],Q=$[1],X=$[2],se=$[3];let ce,oe;for(h=0;h<a;h++){if(h<s){ce=d[h]=t[h];continue}oe=ce,h%s===0?(oe=oe<<8|oe>>>24,oe=S[oe>>>24]<<24|S[oe>>>16&255]<<16|S[oe>>>8&255]<<8|S[oe&255],oe^=M[h/s|0]<<24):s>6&&h%s===4&&(oe=S[oe>>>24]<<24|S[oe>>>16&255]<<16|S[oe>>>8&255]<<8|S[oe&255]),d[h]=ce=(d[h-s]^oe)>>>0}for(g=0;g<a;g++)h=a-g,g&3?oe=d[h]:oe=d[h-4],g<4||h<=4?v[g]=oe:v[g]=j[S[oe>>>24]]^Q[S[oe>>>16&255]]^X[S[oe>>>8&255]]^se[S[oe&255]],v[g]=v[g]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,s=this.invKeySchedule,a=this.invSBox,h=this.invSubMix,g=h[0],d=h[1],v=h[2],S=h[3],M=this.uint8ArrayToUint32Array_(i);let $=M[0],j=M[1],Q=M[2],X=M[3];const se=new Int32Array(e),ce=new Int32Array(se.length);let oe,ve,Ce,Ue,Ae,ke,Pe,Se,Xe,ct,Rt,St,Et,yt;const It=this.networkToHostOrderSwap;for(;t<se.length;){for(Xe=It(se[t]),ct=It(se[t+1]),Rt=It(se[t+2]),St=It(se[t+3]),Ae=Xe^s[0],ke=St^s[1],Pe=Rt^s[2],Se=ct^s[3],Et=4,yt=1;yt<r;yt++)oe=g[Ae>>>24]^d[ke>>16&255]^v[Pe>>8&255]^S[Se&255]^s[Et],ve=g[ke>>>24]^d[Pe>>16&255]^v[Se>>8&255]^S[Ae&255]^s[Et+1],Ce=g[Pe>>>24]^d[Se>>16&255]^v[Ae>>8&255]^S[ke&255]^s[Et+2],Ue=g[Se>>>24]^d[Ae>>16&255]^v[ke>>8&255]^S[Pe&255]^s[Et+3],Ae=oe,ke=ve,Pe=Ce,Se=Ue,Et=Et+4;oe=a[Ae>>>24]<<24^a[ke>>16&255]<<16^a[Pe>>8&255]<<8^a[Se&255]^s[Et],ve=a[ke>>>24]<<24^a[Pe>>16&255]<<16^a[Se>>8&255]<<8^a[Ae&255]^s[Et+1],Ce=a[Pe>>>24]<<24^a[Se>>16&255]<<16^a[Ae>>8&255]<<8^a[ke&255]^s[Et+2],Ue=a[Se>>>24]<<24^a[Ae>>16&255]<<16^a[ke>>8&255]<<8^a[Pe&255]^s[Et+3],ce[t]=It(oe^$),ce[t+1]=It(Ue^j),ce[t+2]=It(Ce^Q),ce[t+3]=It(ve^X),$=Xe,j=ct,Q=Rt,X=St,t=t+4}return ce.buffer}}class vr{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=Xr(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function Xr(o){switch(o){case Di.cbc:return"AES-CBC";case Di.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${o}`)}}const vn=16;class er{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?Zr(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((s,a)=>{const h=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(h,t,i,r);const g=this.flush();g?s(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:s,currentResult:a,remainderData:h}=this;if(r!==Di.cbc||t.byteLength!==16)return F.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),h&&(e=$e(h,e),this.remainderData=null);const g=this.getValidChunk(e);if(!g.length)return null;s&&(i=s);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new Li),d.expandKey(t);const v=a;return this.currentResult=d.decrypt(g.buffer,0,i),this.currentIV=g.slice(-16).buffer,v||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 vr(this.subtle,t,r)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Ji(this.subtle,new Uint8Array(i),r).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(F.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i,r)))}onWebCryptoError(e,t,i,r){const s=this.enableSoftwareAES;if(s){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"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%vn;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(F.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Nr=Math.pow(2,17);class yn{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 Ci({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,s=r.fLoader,a=r.loader;return new Promise((h,g)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(j=>j[0]==="GAP")){g(Hr(e));return}else e.gap=!1;const d=this.loader=s?new s(r):new a(r),v=Ur(e);e.loader=d;const S=Pi(r.fragLoadPolicy.default),M={loadPolicy:S,timeout:S.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Nr};e.stats=d.stats;const $={onSuccess:(j,Q,X,se)=>{this.resetLoader(e,d);let ce=j.data;X.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(ce.slice(0,16)),ce=ce.slice(16)),h({frag:e,part:null,payload:ce,networkDetails:se})},onError:(j,Q,X,se)=>{this.resetLoader(e,d),g(new Ci({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:u({url:i,data:void 0},j),error:new Error(`HTTP Error ${j.code} ${j.text}`),networkDetails:X,stats:se}))},onAbort:(j,Q,X)=>{this.resetLoader(e,d),g(new Ci({type:D.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:X,stats:j}))},onTimeout:(j,Q,X)=>{this.resetLoader(e,d),g(new Ci({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${M.timeout}ms`),networkDetails:X,stats:j}))}};t&&($.onProgress=(j,Q,X,se)=>t({frag:e,part:null,payload:X,networkDetails:se})),d.load(v,M,$)})}loadPart(e,t,i){this.abort();const r=this.config,s=r.fLoader,a=r.loader;return new Promise((h,g)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){g(Hr(e,t));return}const d=this.loader=s?new s(r):new a(r),v=Ur(e,t);e.loader=d;const S=Pi(r.fragLoadPolicy.default),M={loadPolicy:S,timeout:S.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Nr};t.stats=d.stats,d.load(v,M,{onSuccess:($,j,Q,X)=>{this.resetLoader(e,d),this.updateStatsFromPart(e,t);const se={frag:e,part:t,payload:$.data,networkDetails:X};i(se),h(se)},onError:($,j,Q,X)=>{this.resetLoader(e,d),g(new Ci({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:u({url:v.url,data:void 0},$),error:new Error(`HTTP Error ${$.code} ${$.text}`),networkDetails:Q,stats:X}))},onAbort:($,j,Q)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,d),g(new Ci({type:D.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:Q,stats:$}))},onTimeout:($,j,Q)=>{this.resetLoader(e,d),g(new Ci({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${M.timeout}ms`),networkDetails:Q,stats:$}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,s=r.total;if(i.loaded+=r.loaded,s){const g=Math.round(e.duration/t.duration),d=Math.min(Math.round(i.loaded/s),g),S=(g-d)*Math.round(i.loaded/d);i.total=i.loaded+S}else i.total=Math.max(i.loaded,i.total);const a=i.loading,h=r.loading;a.start?a.first+=h.first-h.start:(a.start=h.start,a.first=h.first),a.end=h.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Ur(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,s=t.byteRangeEndOffset;if(k(r)&&k(s)){var a;let h=r,g=s;if(o.sn==="initSegment"&&yr((a=o.decryptdata)==null?void 0:a.method)){const d=s-r;d%16&&(g=s+(16-d%16)),r!==0&&(i.resetIV=!0,h=r-16)}i.rangeStart=h,i.rangeEnd=g}return i}function Hr(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 Ci(i)}function yr(o){return o==="AES-128"||o==="AES-256"}class Ci extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Cr 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 tr{constructor(e,t,i,r=0,s=-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=ur(),this.buffering={audio:ur(),video:ur(),audiovideo:ur()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=s,this.partial=a}}function ur(){return{start:0,executeStart:0,executeEnd:0,end:0}}const br={length:0,start:()=>0,end:()=>0};class Lt{static isBuffered(e,t){if(e){const i=Lt.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=Lt.getBuffered(e);return Lt.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=Lt.bufferedRanges(e);if(r.length)return Lt.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((v,S)=>v.start-S.start||S.end-v.end);let r=-1,s=[];if(i)for(let v=0;v<e.length;v++){t>=e[v].start&&t<=e[v].end&&(r=v);const S=s.length;if(S){const M=s[S-1].end;e[v].start-M<i?e[v].end>M&&(s[S-1].end=e[v].end):s.push(e[v])}else s.push(e[v])}else s=e;let a=0,h,g=t,d=t;for(let v=0;v<s.length;v++){const S=s[v].start,M=s[v].end;if(r===-1&&t>=S&&t<=M&&(r=v),t+i>=S&&t<M)g=S,d=M,a=d-t;else if(t+i<S){h=S;break}}return{len:a,start:g||0,end:d||0,nextStart:h,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||br}catch(t){return F.log("failed to get media.buffered",t),br}}}const ir=/\{\$([a-zA-Z0-9-_]+)\}/g;function rr(o){return ir.test(o)}function Gi(o,e){if(o.variableList!==null||o.hasVariableRefs){const t=o.variableList;return e.replace(ir,i=>{const r=i.substring(2,i.length-1),s=t==null?void 0:t[r];return s===void 0?(o.playlistParsingError||(o.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):s})}return e}function Tr(o,e,t){let i=o.variableList;i||(o.variableList=i={});let r,s;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(r))s=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,s=e.VALUE;r in i?o.playlistParsingError||(o.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=s||""}function bn(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 Qr=/^(\d+)x(\d+)$/,$r=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ei{constructor(e,t){typeof e=="string"&&(e=ei.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,s)=>(r[s.toLowerCase()]=!0,r),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Qr.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={},s='"';for($r.lastIndex=0;(i=$r.exec(e))!==null;){const a=i[1].trim();let h=i[2];const g=h.indexOf(s)===0&&h.lastIndexOf(s)===h.length-1;let d=!1;if(g)h=h.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":d=!0}if(t&&(g||d))h=Gi(t,h);else if(!d&&!g)switch(a){case"CLOSED-CAPTIONS":if(h==="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":F.warn(`${e}: attribute ${a} is missing quotes`)}r[a]=h}return r}}const En="com.apple.hls.interstitial";function Sn(o){return o!=="ID"&&o!=="CLASS"&&o!=="CUE"&&o!=="START-DATE"&&o!=="DURATION"&&o!=="END-DATE"&&o!=="END-ON-NEXT"}function Jr(o){return o==="SCTE35-OUT"||o==="SCTE35-IN"||o==="SCTE35-CMD"}class en{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 s=t.attr;for(const a in s)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==s[a]){F.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=c(new ei({}),s,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);k(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(F.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(k(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===En}get isValid(){return!!this.id&&!this._badValueForSameId&&k(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const wn=10;class tn{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}get hasProgramDateTime(){return this.fragments.length?k(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||wn}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function cr(o){return o==="AES-128"||o==="AES-256"||o==="AES-256-CTR"}function jr(o){switch(o){case"AES-128":case"AES-256":return Di.cbc;case"AES-256-CTR":return Di.ctr;default:throw new Error(`invalid full segment method ${o}`)}}function rn(o){return Uint8Array.from(atob(o),e=>e.charCodeAt(0))}function Ni(o){return Uint8Array.from(unescape(encodeURIComponent(o)),e=>e.charCodeAt(0))}function Wr(o){const e=Ni(o).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function xn(o){const e=function(i,r,s){const a=i[r];i[r]=i[s],i[s]=a};e(o,0,3),e(o,1,2),e(o,4,5),e(o,6,7)}function Ui(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 s=r[0]==="base64",a=r[1];s?(i.splice(-1,1),t=rn(a)):t=Wr(a)}}return t}const nr=typeof self!="undefined"?self:void 0;var ii={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ci={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Ki(o){switch(o){case ci.FAIRPLAY:return ii.FAIRPLAY;case ci.PLAYREADY:return ii.PLAYREADY;case ci.WIDEVINE:return ii.WIDEVINE;case ci.CLEARKEY:return ii.CLEARKEY}}function Dr(o){switch(o){case ii.FAIRPLAY:return ci.FAIRPLAY;case ii.PLAYREADY:return ci.PLAYREADY;case ii.WIDEVINE:return ci.WIDEVINE;case ii.CLEARKEY:return ci.CLEARKEY}}function Er(o){const{drmSystems:e,widevineLicenseUrl:t}=o,i=e?[ii.FAIRPLAY,ii.WIDEVINE,ii.PLAYREADY,ii.CLEARKEY].filter(r=>!!e[r]):[];return!i[ii.WIDEVINE]&&t&&i.push(ii.WIDEVINE),i}const nn=function(o){return nr!=null&&(o=nr.navigator)!=null&&o.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function An(o,e,t,i){let r;switch(o){case ii.FAIRPLAY:r=["cenc","sinf"];break;case ii.WIDEVINE:case ii.PLAYREADY:r=["cenc"];break;case ii.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${o}`)}return Cn(r,e,t,i)}function Cn(o,e,t,i){return[{initDataTypes:o,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function bt(o){var e;return o.sessionType==="persistent-license"||!!((e=o.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function Ft(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 h=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(h){const g=rn(h).subarray(0,16);return xn(g),g}}return null}let Xt={};class hi{static clearKeyUriToKeyIdMap(){Xt={}}constructor(e,t,i,r=[1],s=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=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!cr(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(z(a)))}matches(e){var t,i;return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&e.keyFormatVersions.join(",")===this.keyFormatVersions.join(",")&&((t=e.iv)==null?void 0:t.join(","))===((i=this.iv)==null?void 0:i.join(","))}isSupported(){if(this.method){if(cr(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case ci.FAIRPLAY:case ci.WIDEVINE:case ci.PLAYREADY:case ci.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(cr(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(F.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=fi(e);return new hi(this.method,this.uri,"identity",this.keyFormatVersions,i)}if(this.pssh&&this.keyId)return this;const t=Ui(this.uri);if(t)switch(this.keyFormat){case ci.WIDEVINE:if(this.pssh=t,!this.keyId&&t.length>=22){const i=t.length-22;this.keyId=t.subarray(i,i+16)}break;case ci.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Dt(i,null,t),this.keyId=Ft(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=Xt[this.uri];if(!i){const r=Object.keys(Xt).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),Xt[this.uri]=i}this.keyId=i}return this}}function fi(o){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=o>>8*(15-t)&255;return e}const Gr=/#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,sn=/#EXT-X-MEDIA:(.*)/g,Nn=/^#EXT(?:INF|-X-TARGETDURATION):/m,Lr=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Ho=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 hr{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 R.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Nn.test(e)}static parseMasterPlaylist(e,t){const i=rr(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];Gr.lastIndex=0;let a;for(;(a=Gr.exec(e))!=null;)if(a[1]){var h;const d=new ei(a[1],r),v=Gi(r,a[2]),S={attrs:d,bitrate:d.decimalInteger("BANDWIDTH")||d.decimalInteger("AVERAGE-BANDWIDTH"),name:d.NAME,url:hr.resolve(v,t)},M=d.decimalResolution("RESOLUTION");M&&(S.width=M.width,S.height=M.height),qs(d.CODECS,S);const $=d["SUPPLEMENTAL-CODECS"];$&&(S.supplemental={},qs($,S.supplemental)),(h=S.unknownCodecs)!=null&&h.length||s.push(S),r.levels.push(S)}else if(a[3]){const d=a[3],v=a[4];switch(d){case"SESSION-DATA":{const S=new ei(v,r),M=S["DATA-ID"];M&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[M]=S);break}case"SESSION-KEY":{const S=zs(v,t,r);S.encrypted&&S.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(S)):F.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${v}"`);break}case"DEFINE":{{const S=new ei(v,r);Tr(r,S,t)}break}case"CONTENT-STEERING":{const S=new ei(v,r);r.contentSteering={uri:hr.resolve(S["SERVER-URI"],t),pathwayId:S["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=Vs(v);break}}}const g=s.length>0&&s.length<r.levels.length;return r.levels=g?s:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const s={},a=i.levels,h={AUDIO:a.map(d=>({id:d.attrs.AUDIO,audioCodec:d.audioCodec})),SUBTITLES:a.map(d=>({id:d.attrs.SUBTITLES,textCodec:d.textCodec})),"CLOSED-CAPTIONS":[]};let g=0;for(sn.lastIndex=0;(r=sn.exec(e))!==null;){const d=new ei(r[1],i),v=d.TYPE;if(v){const S=h[v],M=s[v]||[];s[v]=M;const $=d.LANGUAGE,j=d["ASSOC-LANGUAGE"],Q=d.CHANNELS,X=d.CHARACTERISTICS,se=d["INSTREAM-ID"],ce={attrs:d,bitrate:0,id:g++,groupId:d["GROUP-ID"]||"",name:d.NAME||$||"",type:v,default:d.bool("DEFAULT"),autoselect:d.bool("AUTOSELECT"),forced:d.bool("FORCED"),lang:$,url:d.URI?hr.resolve(d.URI,t):""};if(j&&(ce.assocLang=j),Q&&(ce.channels=Q),X&&(ce.characteristics=X),se&&(ce.instreamId=se),S!=null&&S.length){const oe=hr.findGroup(S,ce.groupId)||S[0];Ys(ce,oe,"audioCodec"),Ys(ce,oe,"textCodec")}M.push(ce)}}return s}static parseLevelPlaylist(e,t,i,r,s,a){var h;const g={url:t},d=new tn(t),v=d.fragments,S=[];let M=null,$=0,j=0,Q=0,X=0,se=0,ce=null,oe=new Le(r,g),ve,Ce,Ue,Ae=-1,ke=!1,Pe=null,Se;if(Lr.lastIndex=0,d.m3u8=e,d.hasVariableRefs=rr(e),((h=Lr.exec(e))==null?void 0:h[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(ve=Lr.exec(e))!==null;){ke&&(ke=!1,oe=new Le(r,g),oe.playlistOffset=Q,oe.start=Q,oe.sn=$,oe.cc=X,se&&(oe.bitrate=se),oe.level=i,M&&(oe.initSegment=M,M.rawProgramDateTime&&(oe.rawProgramDateTime=M.rawProgramDateTime,M.rawProgramDateTime=null),Pe&&(oe.setByteRange(Pe),Pe=null)));const St=ve[1];if(St){oe.duration=parseFloat(St);const Et=(" "+ve[2]).slice(1);oe.title=Et||null,oe.tagList.push(Et?["INF",St,Et]:["INF",St])}else if(ve[3]){if(k(oe.duration)){oe.playlistOffset=Q,oe.start=Q,Ue&&Xs(oe,Ue,d),oe.sn=$,oe.level=i,oe.cc=X,v.push(oe);const Et=(" "+ve[3]).slice(1);oe.relurl=Gi(d,Et),rs(oe,ce,S),ce=oe,Q+=oe.duration,$++,j=0,ke=!0}}else{if(ve=ve[0].match(Ho),!ve){F.warn("No matches on slow regex match for level playlist!");continue}for(Ce=1;Ce<ve.length&&ve[Ce]===void 0;Ce++);const Et=(" "+ve[Ce]).slice(1),yt=(" "+ve[Ce+1]).slice(1),It=ve[Ce+2]?(" "+ve[Ce+2]).slice(1):null;switch(Et){case"BYTERANGE":ce?oe.setByteRange(yt,ce):oe.setByteRange(yt);break;case"PROGRAM-DATE-TIME":oe.rawProgramDateTime=yt,oe.tagList.push(["PROGRAM-DATE-TIME",yt]),Ae===-1&&(Ae=v.length);break;case"PLAYLIST-TYPE":d.type&&Sr(d,Et,ve),d.type=yt.toUpperCase();break;case"MEDIA-SEQUENCE":d.startSN!==0?Sr(d,Et,ve):v.length>0&&Qs(d,Et,ve),$=d.startSN=parseInt(yt);break;case"SKIP":{d.skippedSegments&&Sr(d,Et,ve);const ft=new ei(yt,d),Mt=ft.decimalInteger("SKIPPED-SEGMENTS");if(k(Mt)){d.skippedSegments+=Mt;for(let pt=Mt;pt--;)v.push(null);$+=Mt}const Pt=ft.enumeratedString("RECENTLY-REMOVED-DATERANGES");Pt&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(Pt.split(" ")));break}case"TARGETDURATION":d.targetduration!==0&&Sr(d,Et,ve),d.targetduration=Math.max(parseInt(yt),1);break;case"VERSION":d.version!==null&&Sr(d,Et,ve),d.version=parseInt(yt);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":d.live||Sr(d,Et,ve),d.live=!1;break;case"#":(yt||It)&&oe.tagList.push(It?[yt,It]:[yt]);break;case"DISCONTINUITY":X++,oe.tagList.push(["DIS"]);break;case"GAP":oe.gap=!0,oe.tagList.push([Et]);break;case"BITRATE":oe.tagList.push([Et,yt]),se=parseInt(yt)*1e3,k(se)?oe.bitrate=se:se=0;break;case"DATERANGE":{const ft=new ei(yt,d),Mt=new en(ft,d.dateRanges[ft.ID],d.dateRangeTagCount);d.dateRangeTagCount++,Mt.isValid||d.skippedSegments?d.dateRanges[Mt.id]=Mt:F.warn(`Ignoring invalid DATERANGE tag: "${yt}"`),oe.tagList.push(["EXT-X-DATERANGE",yt]);break}case"DEFINE":{{const ft=new ei(yt,d);"IMPORT"in ft?bn(d,ft,a):Tr(d,ft,t)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0?Sr(d,Et,ve):v.length>0&&Qs(d,Et,ve),d.startCC=X=parseInt(yt);break;case"KEY":{const ft=zs(yt,t,d);if(ft.isSupported()){if(ft.method==="NONE"){Ue=void 0;break}Ue||(Ue={});const Mt=Ue[ft.keyFormat];Mt!=null&&Mt.matches(ft)||(Mt&&(Ue=c({},Ue)),Ue[ft.keyFormat]=ft)}else F.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${yt}"`);break}case"START":d.startTimeOffset=Vs(yt);break;case"MAP":{const ft=new ei(yt,d);if(oe.duration){const Mt=new Le(r,g);Zs(Mt,ft,i,Ue),M=Mt,oe.initSegment=M,M.rawProgramDateTime&&!oe.rawProgramDateTime&&(oe.rawProgramDateTime=M.rawProgramDateTime)}else{const Mt=oe.byteRangeEndOffset;if(Mt){const Pt=oe.byteRangeStartOffset;Pe=`${Mt-Pt}@${Pt}`}else Pe=null;Zs(oe,ft,i,Ue),M=oe,ke=!0}M.cc=X;break}case"SERVER-CONTROL":{Se&&Sr(d,Et,ve),Se=new ei(yt),d.canBlockReload=Se.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=Se.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&Se.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=Se.optionalFloat("PART-HOLD-BACK",0),d.holdBack=Se.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&Sr(d,Et,ve);const ft=new ei(yt);d.partTarget=ft.decimalFloatingPoint("PART-TARGET");break}case"PART":{let ft=d.partList;ft||(ft=d.partList=[]);const Mt=j>0?ft[ft.length-1]:void 0,Pt=j++,pt=new ei(yt,d),ot=new qe(pt,oe,g,Pt,Mt);ft.push(ot),oe.duration+=ot.duration;break}case"PRELOAD-HINT":{const ft=new ei(yt,d);d.preloadHint=ft;break}case"RENDITION-REPORT":{const ft=new ei(yt,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(ft);break}default:F.warn(`line parsed but not handled: ${ve}`);break}}}ce&&!ce.relurl?(v.pop(),Q-=ce.duration,d.partList&&(d.fragmentHint=ce)):d.partList&&(rs(oe,ce,S),oe.cc=X,d.fragmentHint=oe,Ue&&Xs(oe,Ue,d)),d.targetduration||(d.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const Xe=v.length,ct=v[0],Rt=v[Xe-1];if(Q+=d.skippedSegments*d.targetduration,Q>0&&Xe&&Rt){d.averagetargetduration=Q/Xe;const St=Rt.sn;d.endSN=St!=="initSegment"?St:0,d.live||(Rt.endList=!0),ct&&d.startCC===void 0&&(d.startCC=ct.cc),Ae>0&&(jo(v,Ae),ct&&S.unshift(ct))}else d.endSN=0,d.startCC=0;return d.fragmentHint&&(Q+=d.fragmentHint.duration),d.totalduration=Q,S.length&&d.dateRangeTagCount&&ct&&Ks(S,d),d.endCC=X,d}}function Ks(o,e){const t=o.length;if(!t)return;const i=o[t-1],r=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let a=s.length;a--;){const h=e.dateRanges[s[a]],g=h.startDate.getTime();h.tagAnchor=i.ref;for(let d=t;d--;){const v=$o(e,g,o,d,r);if(v!==-1){h.tagAnchor=e.fragments[v].ref;break}}}}function $o(o,e,t,i,r){const s=t[i];if(s){const h=s.programDateTime;if(e>=h||i===0){var a;const g=(((a=t[i+1])==null?void 0:a.start)||r)-s.start;if(e<=h+g*1e3){const d=t[i].sn-o.startSN,v=o.fragments;if(v.length>t.length){const M=(t[i+1]||v[v.length-1]).sn-o.startSN;for(let $=M;$>d;$--){const j=v[$].programDateTime;if(e>=j&&e<j+v[$].duration*1e3)return $}}return d}}}return-1}function zs(o,e,t){var i,r;const s=new ei(o,t),a=(i=s.METHOD)!=null?i:"",h=s.URI,g=s.hexadecimalInteger("IV"),d=s.KEYFORMATVERSIONS,v=(r=s.KEYFORMAT)!=null?r:"identity";h&&s.IV&&!g&&F.error(`Invalid IV: ${s.IV}`);const S=h?hr.resolve(h,e):"",M=(d||"1").split("/").map(Number).filter(Number.isFinite);return new hi(a,S,v,M,g,s.KEYID)}function Vs(o){const t=new ei(o).decimalFloatingPoint("TIME-OFFSET");return k(t)?t:null}function qs(o,e){let t=(o||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(s=>Ot(s,i));r.length&&(e[`${i}Codec`]=r.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>r.indexOf(s)===-1))}),e.unknownCodecs=t}function Ys(o,e,t){const i=e[t];i&&(o[t]=i)}function jo(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 rs(o,e,t){o.rawProgramDateTime?t.push(o):e!=null&&e.programDateTime&&(o.programDateTime=e.endProgramDateTime)}function Zs(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 Xs(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 Sr(o,e,t){o.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Qs(o,e,t){o.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function ns(o,e){const t=e.startPTS;if(k(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 Js(o,e,t,i,r,s){i-t<=0&&(F.warn("Fragment should have a positive duration",e),i=t+e.duration,s=r+e.duration);let h=t,g=i;const d=e.startPTS,v=e.endPTS;if(k(d)){const X=Math.abs(d-t);k(e.deltaPTS)?e.deltaPTS=Math.max(X,e.deltaPTS):e.deltaPTS=X,h=Math.max(t,d),t=Math.min(t,d),r=Math.min(r,e.startDTS),g=Math.min(i,v),i=Math.max(i,v),s=Math.max(s,e.endDTS)}const S=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=h,e.startDTS=r,e.endPTS=i,e.minEndPTS=g,e.endDTS=s;const M=e.sn;if(!o||M<o.startSN||M>o.endSN)return 0;let $;const j=M-o.startSN,Q=o.fragments;for(Q[j]=e,$=j;$>0;$--)ns(Q[$],Q[$-1]);for($=j;$<Q.length-1;$++)ns(Q[$],Q[$+1]);return o.fragmentHint&&ns(Q[Q.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,S}function Wo(o,e){if(o===e)return;let t=null;const i=o.fragments;for(let d=i.length-1;d>=0;d--){const v=i[d].initSegment;if(v){t=v;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;let r;zo(o,e,(d,v,S,M)=>{if((!e.startCC||e.skippedSegments)&&v.cc!==d.cc){const $=d.cc-v.cc;for(let j=S;j<M.length;j++)M[j].cc+=$;e.endCC=M[M.length-1].cc}k(d.startPTS)&&k(d.endPTS)&&(v.setStart(v.startPTS=d.startPTS),v.startDTS=d.startDTS,v.maxStartPTS=d.maxStartPTS,v.endPTS=d.endPTS,v.endDTS=d.endDTS,v.minEndPTS=d.minEndPTS,v.setDuration(d.endPTS-d.startPTS),v.duration&&(r=v),e.PTSKnown=e.alignedSliding=!0),d.hasStreams&&(v.elementaryStreams=d.elementaryStreams),v.loader=d.loader,d.hasStats&&(v.stats=d.stats),d.initSegment&&(v.initSegment=d.initSegment,t=d.initSegment)});const s=e.fragments,a=e.fragmentHint?s.concat(e.fragmentHint):s;if(t&&a.forEach(d=>{var v;d&&(!d.initSegment||d.initSegment.relurl===((v=t)==null?void 0:v.relurl))&&(d.initSegment=t)}),e.skippedSegments){if(e.deltaUpdateFailed=s.some(d=>!d),e.deltaUpdateFailed){F.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let d=e.skippedSegments;d--;)s.shift();e.startSN=s[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=Go(o.dateRanges,e));const d=o.fragments.filter(v=>v.rawProgramDateTime);if(o.hasProgramDateTime&&!e.hasProgramDateTime)for(let v=1;v<a.length;v++)a[v].programDateTime===null&&rs(a[v],a[v-1],d);Ks(d,e)}e.endCC=s[s.length-1].cc}if(!e.startCC){var h;const d=ra(o,e.startSN-1);e.startCC=(h=d==null?void 0:d.cc)!=null?h:s[0].cc}Ko(o.partList,e.partList,(d,v)=>{v.elementaryStreams=d.elementaryStreams,v.stats=d.stats}),r?Js(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):ta(o,e),s.length&&(e.totalduration=e.edge-s[0].start),e.driftStartTime=o.driftStartTime,e.driftStart=o.driftStart;const g=e.advancedDateTime;if(e.advanced&&g){const d=e.edge;e.driftStart||(e.driftStartTime=g,e.driftStart=d),e.driftEndTime=g,e.driftEnd=d}else e.driftEndTime=o.driftEndTime,e.driftEnd=o.driftEnd,e.advancedDateTime=o.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=o.requestScheduled)}function Go(o,e){const{dateRanges:t,recentlyRemovedDateranges:i}=e,r=c({},o);i&&i.forEach(h=>{delete r[h]});const a=Object.keys(r).length;return a&&Object.keys(t).forEach(h=>{const g=r[h],d=new en(t[h].attr,g);d.isValid?(r[h]=d,g||(d.tagOrder+=a)):F.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${At(t[h].attr)}"`)}),r}function Ko(o,e,t){if(o&&e){let i=0;for(let r=0,s=o.length;r<=s;r++){const a=o[r],h=e[r+i];a&&h&&a.index===h.index&&a.fragment.sn===h.fragment.sn?t(a,h):i--}}}function zo(o,e,t){const i=e.skippedSegments,r=Math.max(o.startSN,e.startSN)-e.startSN,s=(o.fragmentHint?1:0)+(i?e.endSN:Math.min(o.endSN,e.endSN))-e.startSN,a=e.startSN-o.startSN,h=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,g=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments;for(let d=r;d<=s;d++){const v=g[a+d];let S=h[d];if(i&&!S&&v&&(S=e.fragments[d]=v),v&&S){if(t(v,S,d,h),v.url&&v.url!==S.url){e.playlistParsingError=ea(`media sequence mismatch ${S.sn}:`,o,e,v,S);return}else if(v.cc!==S.cc){e.playlistParsingError=ea(`discontinuity sequence mismatch (${v.cc}!=${S.cc})`,o,e,v,S);return}}}}function ea(o,e,t,i,r){return new Error(`${o} ${r.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function ta(o,e,t=!0){const i=e.startSN+e.skippedSegments-o.startSN,r=o.fragments,s=i>=0;let a=0;if(s&&i<r.length)a=r[i].start;else if(s&&e.startSN===o.endSN+1)a=o.fragmentEnd;else if(s&&t)a=o.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)a=o.fragmentStart;else return;ss(e,a)}function ss(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 ia(o,e=1/0){let t=1e3*o.targetduration;if(o.updated){const i=o.fragments;if(i.length&&t*4>e){const s=i[i.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function ra(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 na(o,e,t){return o?sa(o.partList,e,t):null}function sa(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 aa(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 Tn(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 Vo(o,e){return!!(o&&e.startCC<o.endCC&&e.endCC>o.startCC)}function oa(o,e){if(o){const t=o.start+e;o.start=o.startPTS=t,o.endPTS=t+o.duration}}function la(o,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)oa(t[i],o);e.fragmentHint&&oa(e.fragmentHint,o),e.alignedSliding=!0}function qo(o,e){o&&(ua(e,o),!e.alignedSliding&&o&&Un(e,o),!e.alignedSliding&&o&&!e.skippedSegments&&ta(o,e,!1))}function ua(o,e){if(!Vo(e,o))return;const t=Math.min(e.endCC,o.endCC),i=Tn(e.fragments,t),r=Tn(o.fragments,t);if(!i||!r)return;F.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-r.start;la(s,o)}function Un(o,e){if(!o.hasProgramDateTime||!e.hasProgramDateTime)return;const t=o.fragments,i=e.fragments;if(!t.length||!i.length)return;let r,s;const a=Math.min(e.endCC,o.endCC);e.startCC<a&&o.startCC<a&&(r=Tn(i,a),s=Tn(t,a)),(!r||!s)&&(r=i[Math.floor(i.length/2)],s=Tn(t,r.cc)||t[Math.floor(t.length/2)]);const h=r.programDateTime,g=s.programDateTime;if(!h||!g)return;const d=(g-h)/1e3-(s.start-r.start);la(d,o)}const Yo={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}},Ve={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 as extends Cr{constructor(e,t,i,r,s){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Ve.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:h,media:g,mediaBuffer:d,state:v}=this,S=g?g.currentTime:0,M=Lt.bufferInfo(d||g,S,a.maxBufferHole),$=!M.len;if(this.log(`Media seeking to ${k(S)?S.toFixed(3):S}, state: ${v}, ${$?"out of":"in"} buffer`),this.state===Ve.ENDED)this.resetLoadingState();else if(h){const j=a.maxFragLookUpTolerance,Q=h.start-j,X=h.start+h.duration+j;if($||X<M.start||Q>M.end){const se=S>X;(S<Q||se)&&(se&&h.loader&&(this.log(`Cancelling fragment load for seek (sn: ${h.sn})`),h.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(M.end,S),X=this.shouldLoadParts(this.getLevelDetails(),Q);X&&(this.log(`LL-Part loading ON after seeking to ${S.toFixed(2)} with buffer @${Q.toFixed(2)}`),this.loadingParts=X)}}this.hls.hasEnoughToStart||(this.log(`Setting ${$?"startPosition":"nextLoadPosition"} to ${S} for seek without enough to start`),this.nextLoadPosition=S,$&&(this.startPosition=S)),this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new yn(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new er(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===Ve.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=Ve.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 s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=Lt.bufferedInfo(s,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 v=g[g.length-1];return Lt.isBuffered(this.media,v.start+v.duration/2)}const d=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(d)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;i.removeEventListener("seeking",this.onMediaSeeking),i.removeEventListener("ended",this.onMediaEnded),i.addEventListener("seeking",this.onMediaSeeking),i.addEventListener("ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===Ve.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),r.removeEventListener("seeking",this.onMediaSeeking),r.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=Ve.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=s=>{const a=s.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(a,!1,s.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,i,r).then(s=>{if(!s)return;const a=this.state,h=s.frag;if(this.fragContextChanged(h)){(a===Ve.FRAG_LOADING||!this.fragCurrent&&a===Ve.PARSING)&&(this.fragmentTracker.removeFragment(h),this.state=Ve.IDLE);return}"payload"in s&&(this.log(`Loaded ${h.type} sn: ${h.sn} of ${this.playlistLabel()} ${h.level}`),this.hls.trigger(_.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===Ve.STOPPED||this.state===Ve.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===ai.APPENDING){const s=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,s),h=Math.max(e.duration,a?a.len:this.config.maxBufferLength),g=this.backtrackFragment;((g?e.sn-g.sn:0)===1||this.reduceMaxBufferLength(h,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===ai.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const 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:s,payload:a}=i,h=s.decryptdata;if(a&&a.byteLength>0&&h!=null&&h.key&&h.iv&&cr(h.method)){const g=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),h.key.buffer,h.iv.buffer,jr(h.method)).catch(d=>{throw r.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:s}),d}).then(d=>{const v=self.performance.now();return r.trigger(_.FRAG_DECRYPTED,{frag:s,payload:d,stats:{tstart:g,tdecrypt:v}}),i.payload=d,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===Ve.STOPPED||this.state===Ve.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!==Ve.STOPPED&&(this.state=Ve.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?Yo.toString(Lt.getBuffered(i)):"(detached)"})`),_e(e)){var r;if(e.type!==m.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(h=>!!a[h])){this.state=Ve.IDLE;return}}const s=(r=this.levels)==null?void 0:r[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=Ve.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:s}=e,a=!s||s.length===0||s.some(g=>!g),h=new tr(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(h)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var s;this.fragCurrent=e;const a=t==null?void 0:t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let h=null;e.encrypted&&!((s=e.decryptdata)!=null&&s.key)?(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Ve.KEY_LOADING,this.fragCurrent=e,h=this.keyLoader.load(e).then(S=>{if(!this.fragContextChanged(S.frag))return this.hls.trigger(_.KEY_LOADED,S),this.state===Ve.KEY_LOADING&&(this.state=Ve.IDLE),S}),this.hls.trigger(_.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(h=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):e.encrypted||(h=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),h&&this.log("[eme] blocking frag load until media-keys acquired"));const g=this.fragPrevious;if(_e(e)&&(!g||e.sn!==g.sn)){const S=this.shouldLoadParts(t.details,e.end);S!==this.loadingParts&&(this.log(`LL-Part loading ${S?"ON":"OFF"} loading sn ${g==null?void 0:g.sn}->${e.sn}`),this.loadingParts=S)}if(i=Math.max(e.start,i||0),this.loadingParts&&_e(e)){const S=a.partList;if(S&&r){i>e.end&&a.fragmentHint&&(e=a.fragmentHint);const M=this.getNextPart(S,e,i);if(M>-1){const $=S[M];e=this.fragCurrent=$.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${$.index} (${M}/${S.length-1}) of ${this.fragInfo(e,!1,$)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=$.start+$.duration,this.state=Ve.FRAG_LOADING;let j;return h?j=h.then(Q=>!Q||this.fragContextChanged(Q.frag)?null:this.doFragPartsLoad(e,$,t,r)).catch(Q=>this.handleFragLoadError(Q)):j=this.doFragPartsLoad(e,$,t,r).catch(Q=>this.handleFragLoadError(Q)),this.hls.trigger(_.FRAG_LOADING,{frag:e,part:$,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):j}else if(!e.url||this.loadedEndOfParts(S,i))return Promise.resolve(null)}}if(_e(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${a?"["+a.startSN+"-"+a.endSN+"]":""}, target: ${parseFloat(i.toFixed(3))}`),k(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Ve.FRAG_LOADING;const d=this.config.progressive;let v;return d&&h?v=h.then(S=>!S||this.fragContextChanged(S==null?void 0:S.frag)?null:this.fragmentLoader.load(e,r)).catch(S=>this.handleFragLoadError(S)):v=Promise.all([this.fragmentLoader.load(e,d?r:void 0),h]).then(([S])=>(!d&&S&&r&&r(S),S)).catch(S=>this.handleFragLoadError(S)),this.hls.trigger(_.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):v}doFragPartsLoad(e,t,i,r){return new Promise((s,a)=>{var h;const g=[],d=(h=i.details)==null?void 0:h.partList,v=S=>{this.fragmentLoader.loadPart(e,S,r).then(M=>{g[S.index]=M;const $=M.part;this.hls.trigger(_.FRAG_LOADED,M);const j=na(i.details,e.sn,S.index+1)||sa(d,e.sn,S.index+1);if(j)v(j);else return s({frag:e,part:$,partsLoaded:g})}).catch(a)};v(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===w.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):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!==Ve.PARSING){!this.fragCurrent&&this.state!==Ve.STOPPED&&this.state!==Ve.ERROR&&(this.state=Ve.IDLE);return}const{frag:i,part:r,level:s}=t,a=self.performance.now();i.stats.parsing.end=a,r&&(r.stats.parsing.end=a);const h=this.getLevelDetails(),d=h&&i.sn>h.endSN||this.shouldLoadParts(h,i.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=d),this.updateLevelTiming(i,r,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e!=null&&e.partList){var i;const s=e.partList[0],a=s.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())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:s,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const h=t[r],g=h.details,d=a>-1?na(g,s,a):null,v=d?d.fragment:ra(g,s,i);return v?(i&&i!==v&&(v.stats=i.stats),{frag:v,part:d,level:h}):null}bufferFragmentData(e,t,i,r,s){var a;if(!e||this.state!==Ve.PARSING)return;const{data1:h,data2:g}=e;let d=h;if(h&&g&&(d=$e(h,g)),!((a=d)!=null&&a.length))return;const v=this.initPTS[t.cc],S=v?-v.baseTime/v.timescale:void 0,M={type:e.type,frag:t,part:i,chunkMeta:r,offset:S,parent:t.type,data:d};if(this.hls.trigger(_.BUFFER_APPENDING,M),e.dropped&&e.independent&&!i){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Lt.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=Lt.bufferInfo(t,i,0),s=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),h=Math.max(Math.min(e.start-a,r.end-a),i+a);e.start-h>a&&this.flushMainBuffer(h,e.start)}getFwdBufferInfo(e,t){var i;const r=this.getLoadPosition();if(!k(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 s=Lt.bufferInfo(e,t,r);if(s.len===0&&s.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&(s.nextStart<=a.end||a.gap)){const h=Math.max(Math.min(s.nextStart,a.end)-t,r);return Lt.bufferInfo(e,t,h)}}return s}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,r=Math.max(Math.min(e-t,i.maxBufferLength),t),s=Math.max(e-t*3,i.maxMaxBufferLength/2,r);return s>=r?(i.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=m.MAIN){var i;const r=(i=this.fragmentTracker)==null?void 0:i.getAppendedFrag(e,t);return r&&"fragment"in r?r.fragment:r}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:s}=this,a=i[0].start,h=s.lowLatencyMode&&!!t.partList;let g=null;if(t.live){const S=s.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 d;h&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),g=this.getInitialLiveFragment(t);const M=this.hls.startPosition,$=this.hls.liveSyncPosition,j=g?(M!==-1&&M>=a?M:$)||g.start:e;this.log(`Setting startPosition to ${j} to match start frag at live edge. mainStart: ${M} liveSyncPosition: ${$} frag.start: ${(d=g)==null?void 0:d.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 v=this.filterReplacedPrimary(g,t);if(!v&&g){const S=g.sn-t.startSN;v=this.filterReplacedPrimary(i[S+1]||null,t)}return this.mapToInitFragWhenRequired(v)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===ai.OK||i===ai.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,s){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&i.nextStart)){const h=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r,0);if(h!==null&&i.len+h.len>=s){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(ca(this.hls.config)){var e,t;if((e=this.hls.interstitialsManager)==null||(t=e.playingItem)==null?void 0:t.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(ca(this.hls.config)&&e.type!==m.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 s=i==null?void 0:i.playerQueue;if(s)for(let a=s.length;a--;){const h=s[a].interstitial;if(h.appendInPlace&&e.start>=h.startTime&&e.end<=h.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let r=-1,s=!1,a=!0;for(let h=0,g=e.length;h<g;h++){const d=e[h];if(a=a&&!d.independent,r>-1&&i<d.start)break;const v=d.loaded;v?r=-1:(s||d.independent||a)&&d.fragment===t&&(r=h),s=v}return r}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=Zi(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const s=i.sn+1;if(s>=e.startSN&&s<=e.endSN){const a=t[s-e.startSN];i.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=Qt(e,i.cc,i.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(r=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:s}=this,{fragments:a,endSN:h}=i;const{fragmentHint:g}=i,{maxFragLookUpTolerance:d}=r,v=i.partList,S=!!(this.loadingParts&&v!=null&&v.length&&g);S&&g&&!this.bitrateTest&&v[v.length-1].fragment.sn===g.sn&&(a=a.concat(g),h=g.sn);let M;if(e<t){var $;const Q=e<this.lastCurrentTime||e>t-d||($=this.media)!=null&&$.paused||!this.startFragRequested?0:d;M=gi(s,a,e,Q)}else M=a[a.length-1];if(M){const j=M.sn-i.startSN,Q=this.fragmentTracker.getState(M);if((Q===ai.OK||Q===ai.PARTIAL&&M.gap)&&(s=M),s&&M.sn===s.sn&&(!S||v[0].fragment.sn>M.sn||!i.live&&!S)&&s&&M.level===s.level){const se=a[j+1];M.sn<h&&this.fragmentTracker.getState(se)!==ai.OK?M=se:M=null}}return M}alignPlaylists(e,t,i){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,a=!t,h=e.alignedSliding&&k(s);if(a||!h&&!s){qo(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 s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const r=this.timelineOffset;if(i===-1){const s=this.startTimeOffset!==null,a=s?this.startTimeOffset:e.startTimeOffset;a!==null&&k(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 ${s?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+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&&_e(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!==Ve.FRAG_LOADING_WAITING_RETRY)&&(this.state=Ve.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const j=this.getCurrentContext(t.chunkMeta);j&&(t.frag=j.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const s=t.details===w.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const a=t.errorAction,{action:h,flags:g,retryCount:d=0,retryConfig:v}=a||{},S=!!a&&!!v,M=S&&h===ui.RetryRequest,$=S&&!a.resolved&&g===Si.MoveAllAlternatesMatchingHost;if(!M&&$&&_e(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),a.resolved=!0;else if((M||$)&&d<v.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const j=Xi(v,d);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${d+1}/${v.maxNumRetry} in ${j}ms`),a.resolved=!0,this.retryDate=self.performance.now()+j,this.state=Ve.FRAG_LOADING_WAITING_RETRY}else if(v&&a)if(this.resetFragmentErrors(e),d<v.maxNumRetry)!s&&h!==ui.RemoveAlternatePermanently&&(a.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${d})`);return}else h===ui.SendAlternateToPenaltyBox?this.state=Ve.WAITING_LEVEL:this.state=Ve.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===Ve.PARSING||this.state===Ve.PARSED){const t=e.frag,i=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,i),s=r&&r.len>.5;s&&this.reduceMaxBufferLength(r.len,(t==null?void 0:t.duration)||10);const a=!s;return a&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===m.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Ve.STOPPED&&(this.state=Ve.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=Lt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===Ve.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Ve.STOPPED&&(this.state=Ve.IDLE)}resetStartWhenNotLoaded(e){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of ${this.playlistLabel()} ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){const s=i.details;if(!s){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((g,d)=>{const v=e.elementaryStreams[d];if(v){const S=v.endPTS-v.startPTS;if(S<=0)return this.warn(`Could not parse fragment ${e.sn} ${d} duration reliably (${S})`),g||!1;const M=r?0:Js(s,e,v.startPTS,v.endPTS,v.startDTS,v.endDTS);return this.hls.trigger(_.LEVEL_PTS_UPDATED,{details:s,level:i,drift:M,type:d,frag:e,start:v.startPTS,end:v.endPTS}),!0}return g},!1)){var h;if(i.fragmentError===0&&this.treatAsGap(e,i),((h=this.transmuxer)==null?void 0:h.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=Ve.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===m.MAIN?"level":"track"}fragInfo(e,t=!0,i){var r,s;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((r=t&&!i?e.startPTS:(i||e).start)!=null?r:NaN).toFixed(3)}-${((s=t&&!i?e.endPTS:(i||e).end)!=null?s:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function ca(o){return!!o.interstitialsController&&o.enableInterstitialPlayback!==!1}class ha{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=Zo(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Zo(o,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<o.length;r++){const s=o[r];t.set(s,i),i+=s.length}return t}var os={exports:{}},fa;function Xo(){return fa||(fa=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,d,v){this.fn=g,this.context=d,this.once=v||!1}function s(g,d,v,S,M){if(typeof v!="function")throw new TypeError("The listener must be a function");var $=new r(v,S||g,M),j=t?t+d:d;return g._events[j]?g._events[j].fn?g._events[j]=[g._events[j],$]:g._events[j].push($):(g._events[j]=$,g._eventsCount++),g}function a(g,d){--g._eventsCount===0?g._events=new i:delete g._events[d]}function h(){this._events=new i,this._eventsCount=0}h.prototype.eventNames=function(){var d=[],v,S;if(this._eventsCount===0)return d;for(S in v=this._events)e.call(v,S)&&d.push(t?S.slice(1):S);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(v)):d},h.prototype.listeners=function(d){var v=t?t+d:d,S=this._events[v];if(!S)return[];if(S.fn)return[S.fn];for(var M=0,$=S.length,j=new Array($);M<$;M++)j[M]=S[M].fn;return j},h.prototype.listenerCount=function(d){var v=t?t+d:d,S=this._events[v];return S?S.fn?1:S.length:0},h.prototype.emit=function(d,v,S,M,$,j){var Q=t?t+d:d;if(!this._events[Q])return!1;var X=this._events[Q],se=arguments.length,ce,oe;if(X.fn){switch(X.once&&this.removeListener(d,X.fn,void 0,!0),se){case 1:return X.fn.call(X.context),!0;case 2:return X.fn.call(X.context,v),!0;case 3:return X.fn.call(X.context,v,S),!0;case 4:return X.fn.call(X.context,v,S,M),!0;case 5:return X.fn.call(X.context,v,S,M,$),!0;case 6:return X.fn.call(X.context,v,S,M,$,j),!0}for(oe=1,ce=new Array(se-1);oe<se;oe++)ce[oe-1]=arguments[oe];X.fn.apply(X.context,ce)}else{var ve=X.length,Ce;for(oe=0;oe<ve;oe++)switch(X[oe].once&&this.removeListener(d,X[oe].fn,void 0,!0),se){case 1:X[oe].fn.call(X[oe].context);break;case 2:X[oe].fn.call(X[oe].context,v);break;case 3:X[oe].fn.call(X[oe].context,v,S);break;case 4:X[oe].fn.call(X[oe].context,v,S,M);break;default:if(!ce)for(Ce=1,ce=new Array(se-1);Ce<se;Ce++)ce[Ce-1]=arguments[Ce];X[oe].fn.apply(X[oe].context,ce)}}return!0},h.prototype.on=function(d,v,S){return s(this,d,v,S,!1)},h.prototype.once=function(d,v,S){return s(this,d,v,S,!0)},h.prototype.removeListener=function(d,v,S,M){var $=t?t+d:d;if(!this._events[$])return this;if(!v)return a(this,$),this;var j=this._events[$];if(j.fn)j.fn===v&&(!M||j.once)&&(!S||j.context===S)&&a(this,$);else{for(var Q=0,X=[],se=j.length;Q<se;Q++)(j[Q].fn!==v||M&&!j[Q].once||S&&j[Q].context!==S)&&X.push(j[Q]);X.length?this._events[$]=X.length===1?X[0]:X:a(this,$)}return this},h.prototype.removeAllListeners=function(d){var v;return d?(v=t?t+d:d,this._events[v]&&a(this,v)):(this._events=new i,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=t,h.EventEmitter=h,o.exports=h}(os)),os.exports}var Qo=Xo(),ls=Z(Qo);const Dn="1.6.7",an={};function Jo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function el(){const o=an[Dn];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 an[Dn]=r,r}function tl(o){const e=an[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 an[o]=r,r}function il(o){const e=an[o||Dn];if(e&&e.clientCount--===1){const{worker:i,objectURL:r}=e;delete an[o||Dn],r&&self.URL.revokeObjectURL(r),i.terminate()}}function da(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 us(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 Hn(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 Ln(o,e){const t=e;let i=0;for(;us(o,e);){i+=10;const r=Hn(o,e+6);i+=r,da(o,e+10)&&(i+=10),e+=i}if(i>0)return o.subarray(t,t+i)}function rl(o,e,t,i){const r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],s=e[t+2],a=s>>2&15;if(a>12){const $=new Error(`invalid ADTS sampling index:${a}`);o.emit(_.ERROR,_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!0,error:$,reason:$.message});return}const h=(s>>6&3)+1,g=e[t+3]>>6&3|(s&1)<<2,d="mp4a.40."+h,v=r[a];let S=a;(h===5||h===29)&&(S-=3);const M=[h<<3|(S&14)>>1,(S&1)<<7|g<<3];return F.log(`manifest codec:${i}, parsed codec:${d}, channels:${g}, rate:${v} (ADTS object type:${h} sampling index:${a})`),{config:M,samplerate:v,channelCount:g,codec:d,parsedCodec:d,manifestCodec:i}}function pa(o,e){return o[e]===255&&(o[e+1]&246)===240}function _a(o,e){return o[e+1]&1?7:9}function cs(o,e){return(o[e+3]&3)<<11|o[e+4]<<3|(o[e+5]&224)>>>5}function nl(o,e){return e+5<o.length}function $n(o,e){return e+1<o.length&&pa(o,e)}function sl(o,e){return nl(o,e)&&pa(o,e)&&cs(o,e)<=o.length-e}function al(o,e){if($n(o,e)){const t=_a(o,e);if(e+t>=o.length)return!1;const i=cs(o,e);if(i<=t)return!1;const r=e+i;return r===o.length||$n(o,r)}return!1}function ga(o,e,t,i,r){if(!o.samplerate){const s=rl(e,t,i,r);if(!s)return;c(o,s)}}function ma(o){return 1024*9e4/o}function ol(o,e){const t=_a(o,e);if(e+t<=o.length){const i=cs(o,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function va(o,e,t,i,r){const s=ma(o.samplerate),a=i+r*s,h=ol(e,t);let g;if(h){const{frameLength:S,headerLength:M}=h,$=M+S,j=Math.max(0,t+$-e.length);j?(g=new Uint8Array($-M),g.set(e.subarray(t+M,e.length),0)):g=e.subarray(t+M,t+$);const Q={unit:g,pts:a};return j||o.samples.push(Q),{sample:Q,length:$,missing:j}}const d=e.length-t;return g=new Uint8Array(d),g.set(e.subarray(t,e.length),0),{sample:{unit:g,pts:a},length:d,missing:-1}}function ll(o,e){return us(o,e)&&Hn(o,e+6)+10<=o.length-e}function ul(o){return o instanceof ArrayBuffer?o:o.byteOffset==0&&o.byteLength==o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer}function hs(o,e=0,t=1/0){return cl(o,e,t,Uint8Array)}function cl(o,e,t,i){const r=hl(o);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const a=fl(o)?o.byteOffset:0,h=(a+o.byteLength)/s,g=(a+e)/s,d=Math.floor(Math.max(0,Math.min(g,h))),v=Math.floor(Math.min(d+Math.max(t,0),h));return new i(r,d,v-d)}function hl(o){return o instanceof ArrayBuffer?o:o.buffer}function fl(o){return o&&o.buffer instanceof ArrayBuffer&&o.byteLength!==void 0&&o.byteOffset!==void 0}function dl(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=ae(hs(o.data,1,i)),s=o.data[2+i],a=o.data.subarray(3+i).indexOf(0);if(a===-1)return;const h=ae(hs(o.data,3+i,a));let g;return r==="-->"?g=ae(hs(o.data,4+i+a)):g=ul(o.data.subarray(4+i+a)),e.mimeType=r,e.pictureType=s,e.description=h,e.data=g,e}function pl(o){if(o.size<2)return;const e=ae(o.data,!0),t=new Uint8Array(o.data.subarray(e.length+1));return{key:o.type,info:e,data:t.buffer}}function _l(o){if(o.size<2)return;if(o.type==="TXXX"){let t=1;const i=ae(o.data.subarray(t),!0);t+=i.length+1;const r=ae(o.data.subarray(t));return{key:o.type,info:i,data:r}}const e=ae(o.data.subarray(1));return{key:o.type,info:"",data:e}}function gl(o){if(o.type==="WXXX"){if(o.size<2)return;let t=1;const i=ae(o.data.subarray(t),!0);t+=i.length+1;const r=ae(o.data.subarray(t));return{key:o.type,info:i,data:r}}const e=ae(o.data);return{key:o.type,info:"",data:e}}function ml(o){return o.type==="PRIV"?pl(o):o.type[0]==="W"?gl(o):o.type==="APIC"?dl(o):_l(o)}function vl(o){const e=String.fromCharCode(o[0],o[1],o[2],o[3]),t=Hn(o,4),i=10;return{type:e,size:t,data:o.subarray(i,i+t)}}const jn=10,yl=10;function ya(o){let e=0;const t=[];for(;us(o,e);){const i=Hn(o,e+6);o[e+5]>>6&1&&(e+=jn),e+=jn;const r=e+i;for(;e+yl<r;){const s=vl(o.subarray(e)),a=ml(s);a&&t.push(a),e+=s.size+jn}da(o,e)&&(e+=jn)}return t}function ba(o){return o&&o.key==="PRIV"&&o.info==="com.apple.streaming.transportStreamTimestamp"}function bl(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 fs(o){const e=ya(o);for(let t=0;t<e.length;t++){const i=e[t];if(ba(i))return bl(i)}}let $i=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 fr(o="",e=9e4){return{type:o,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ds{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=$e(this.cachedData,e),this.cachedData=null);let i=Ln(e,0),r=i?i.length:0,s;const a=this._audioTrack,h=this._id3Track,g=i?fs(i):void 0,d=e.length;for((this.basePTS===null||this.frameIndex===0&&k(g))&&(this.basePTS=El(g,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&h.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:$i.audioId3,duration:Number.POSITIVE_INFINITY});r<d;){if(this.canParse(e,r)){const v=this.appendFrame(a,e,r);v?(this.frameIndex++,this.lastPTS=v.sample.pts,r+=v.length,s=r):r=d}else ll(e,r)?(i=Ln(e,r),h.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:$i.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,s=r):r++;if(r===d&&s!==d){const v=e.slice(s);this.cachedData?this.cachedData=$e(this.cachedData,v):this.cachedData=v}}return{audioTrack:a,videoTrack:fr(),id3Track:h,textTrack:fr()}}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:fr(),id3Track:this._id3Track,textTrack:fr()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const El=(o,e,t)=>{if(k(o))return o*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Wn=null;const Sl=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],wl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],xl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Al=[0,1,1,4];function Ea(o,e,t,i,r){if(t+24>e.length)return;const s=Sa(e,t);if(s&&t+s.frameLength<=e.length){const a=s.samplesPerFrame*9e4/s.sampleRate,h=i+r*a,g={unit:e.subarray(t,t+s.frameLength),pts:h,dts:h};return o.config=[],o.channelCount=s.channelCount,o.samplerate=s.sampleRate,o.samples.push(g),{sample:g,length:s.frameLength,missing:0}}}function Sa(o,e){const t=o[e+1]>>3&3,i=o[e+1]>>1&3,r=o[e+2]>>4&15,s=o[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&s!==3){const a=o[e+2]>>1&1,h=o[e+3]>>6,g=t===3?3-i:i===3?3:4,d=Sl[g*14+r-1]*1e3,S=wl[(t===3?0:t===2?1:2)*3+s],M=h===3?1:2,$=xl[t][i],j=Al[i],Q=$*8*j,X=Math.floor($*d/S+a)*j;if(Wn===null){const oe=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Wn=oe?parseInt(oe[1]):0}return!!Wn&&Wn<=87&&i===2&&d>=224e3&&h===0&&(o[e+3]=o[e+3]|128),{sampleRate:S,channelCount:M,frameLength:X,samplesPerFrame:Q}}}function ps(o,e){return o[e]===255&&(o[e+1]&224)===224&&(o[e+1]&6)!==0}function wa(o,e){return e+1<o.length&&ps(o,e)}function Cl(o,e){return ps(o,e)&&4<=o.length-e}function xa(o,e){if(e+1<o.length&&ps(o,e)){const i=Sa(o,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const s=e+r;return s===o.length||wa(o,s)}return!1}class Tl extends ds{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=Ln(e,0);let r=(i==null?void 0:i.length)||0;if(xa(e,r))return!1;for(let s=e.length;r<s;r++)if(al(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return sl(e,t)}appendFrame(e,t,i){ga(e,this.observer,t,i,e.manifestCodec);const r=va(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Aa=(o,e)=>{let t=0,i=5;e+=i;const r=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=o[e];const h=Math.min(i,8),g=8-h;s[0]=4278190080>>>24+g<<g,r[0]=(a[0]&s[0])>>g,t=t?t<<h|r[0]:r[0],e+=1,i-=h}return t};class Dl extends ds{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=Ca(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=Ln(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&fs(t)!==void 0&&Aa(e,i)<16}}function Ca(o,e,t,i,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const h=[48e3,44100,32e3][s],g=e[t+4]&63,v=[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+s]*2;if(t+v>e.length)return-1;const S=e[t+6]>>5;let M=0;S===2?M+=2:(S&1&&S!==1&&(M+=2),S&4&&(M+=2));const $=(e[t+6]<<8|e[t+7])>>12-M&1,Q=[2,1,2,3,3,4,4,5][S]+$,X=e[t+5]>>3,se=e[t+5]&7,ce=new Uint8Array([s<<6|X<<1|se>>2,(se&3)<<6|S<<3|$<<2|g>>4,g<<4&224]),oe=1536/h*9e4,ve=i+r*oe,Ce=e.subarray(t,t+v);return o.config=ce,o.channelCount=Q,o.samplerate=h,o.samples.push({unit:Ce,pts:ve}),v}class Ll extends ds{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=Ln(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&fs(t)!==void 0&&Aa(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(xa(e,i))return F.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Cl(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Ea(e,t,i,this.basePTS,this.frameIndex)}}const Rl=/\/emsg[-/]ID3/i;class kl{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 s=this.videoTrack=fr("video",1),a=this.audioTrack=fr("audio",1),h=this.txtTrack=fr("text",1);if(this.id3Track=fr("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const g=Fe(e);if(g.video){const{id:d,timescale:v,codec:S,supplemental:M}=g.video;s.id=d,s.timescale=h.timescale=v,s.codec=S,s.supplemental=M}if(g.audio){const{id:d,timescale:v,codec:S}=g.audio;a.id=d,a.timescale=v,a.codec=S}h.id=wt.text,s.sampleDuration=0,s.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return we(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=$e(this.remainderData,e));const h=Ye(i);this.remainderData=h.remainder,r.samples=h.valid||new Uint8Array}else r.samples=i;const a=this.extractID3Track(r,t);return s.samples=st(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=st(e,t),{videoTrack:t,audioTrack:fr(),id3Track:r,textTrack:fr()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=le(e.samples,["emsg"]);r&&r.forEach(s=>{const a=_t(s);if(Rl.test(a.schemeIdUri)){const h=Ta(a,t);let g=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;g<=.001&&(g=Number.POSITIVE_INFINITY);const d=a.payload;i.samples.push({data:d,len:d.byteLength,dts:h,pts:h,type:$i.emsg,duration:g})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const h=Ta(a,t);i.samples.push({data:a.payload,len:a.payload.byteLength,dts:h,pts:h,type:$i.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 Ta(o,e){return k(o.presentationTime)?o.presentationTime/o.timeScale:e+o.presentationTimeDelta/o.timeScale}class Il{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new er(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Di.cbc)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const s=r.subarray(16,r.length-r.length%16),a=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(a).then(h=>{const g=new Uint8Array(h);r.set(g,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let r=0;for(let s=32;s<e.length-16;s+=160,r+=16)i.set(e.subarray(s,s+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let s=32;s<e.length-16;s+=160,r+=16)e.set(i.subarray(r,r+16),s);return e}decryptAvcSample(e,t,i,r,s){const a=gt(s.data),h=this.getAvcEncryptedData(a);this.decryptBuffer(h.buffer).then(g=>{s.data=this.getAvcDecryptedUnit(a,g),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,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 s=e[t].units;for(;!(i>=s.length);i++){const a=s[i];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,i,r,a),!this.decrypter.isSync()))return}}}}class Da{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 s=i.units;r=s[s.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 s=i[r-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const r=t.byteLength;let s=e.naluState||0;const a=s,h=[];let g=0,d,v,S,M=-1,$=0;for(s===-1&&(M=0,$=this.getNALuType(t,0),s=0,g=1);g<r;){if(d=t[g++],!s){s=d?0:1;continue}if(s===1){s=d?0:2;continue}if(!d)s=3;else if(d===1){if(v=g-s-1,M>=0){const j={data:t.subarray(M,v),type:$};h.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)),v>0&&(j.data=$e(j.data,t.subarray(0,v)),j.state=0))}g<r?(S=this.getNALuType(t,g),M=g,$=S,s=0):s=-1}else s=0}if(M>=0&&s>=0){const j={data:t.subarray(M,r),type:$,state:s};h.push(j)}if(h.length===0){const j=this.getLastNalUnit(e.samples);j&&(j.data=$e(j.data,t))}return e.naluState=s,h}}class Rn{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),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");r.set(e.subarray(i,i+s)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&F.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 La extends Da{parsePES(e,t,i,r){const s=this.parseNALu(e,i.data,r);let a=this.VideoSample,h,g=!1;i.data=null,a&&s.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(d=>{var v,S;switch(d.type){case 1:{let Q=!1;h=!0;const X=d.data;if(g&&X.length>4){const se=this.readSliceType(X);(se===2||se===4||se===7||se===9)&&(Q=!0)}if(Q){var M;(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.frame=!0,a.key=Q;break}case 5:h=!0,(v=a)!=null&&v.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:{h=!0,tt(d.data,1,i.pts,t.samples);break}case 7:{var $,j;h=!0,g=!0;const Q=d.data,X=this.readSPS(Q);if(!e.sps||e.width!==X.width||e.height!==X.height||(($=e.pixelRatio)==null?void 0:$[0])!==X.pixelRatio[0]||((j=e.pixelRatio)==null?void 0:j[1])!==X.pixelRatio[1]){e.width=X.width,e.height=X.height,e.pixelRatio=X.pixelRatio,e.sps=[Q];const se=Q.subarray(1,4);let ce="avc1.";for(let oe=0;oe<3;oe++){let ve=se[oe].toString(16);ve.length<2&&(ve="0"+ve),ce+=ve}e.codec=ce}break}case 8:h=!0,e.pps=[d.data];break;case 9:h=!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:h=!0;break;default:h=!1;break}a&&h&&a.units.push(d)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Rn(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,r=8,s;for(let a=0;a<e;a++)r!==0&&(s=t.readEG(),r=(i+s+256)%256),i=r===0?i:r}readSPS(e){const t=new Rn(e);let i=0,r=0,s=0,a=0,h,g,d;const v=t.readUByte.bind(t),S=t.readBits.bind(t),M=t.readUEG.bind(t),$=t.readBoolean.bind(t),j=t.skipBits.bind(t),Q=t.skipEG.bind(t),X=t.skipUEG.bind(t),se=this.skipScalingList.bind(this);v();const ce=v();if(S(5),j(3),v(),X(),ce===100||ce===110||ce===122||ce===244||ce===44||ce===83||ce===86||ce===118||ce===128){const ke=M();if(ke===3&&j(1),X(),X(),j(1),$())for(g=ke!==3?8:12,d=0;d<g;d++)$()&&(d<6?se(16,t):se(64,t))}X();const oe=M();if(oe===0)M();else if(oe===1)for(j(1),Q(),Q(),h=M(),d=0;d<h;d++)Q();X(),j(1);const ve=M(),Ce=M(),Ue=S(1);Ue===0&&j(1),j(1),$()&&(i=M(),r=M(),s=M(),a=M());let Ae=[1,1];if($()&&$())switch(v()){case 1:Ae=[1,1];break;case 2:Ae=[12,11];break;case 3:Ae=[10,11];break;case 4:Ae=[16,11];break;case 5:Ae=[40,33];break;case 6:Ae=[24,11];break;case 7:Ae=[20,11];break;case 8:Ae=[32,11];break;case 9:Ae=[80,33];break;case 10:Ae=[18,11];break;case 11:Ae=[15,11];break;case 12:Ae=[64,33];break;case 13:Ae=[160,99];break;case 14:Ae=[4,3];break;case 15:Ae=[3,2];break;case 16:Ae=[2,1];break;case 255:{Ae=[v()<<8|v(),v()<<8|v()];break}}return{width:Math.ceil((ve+1)*16-i*2-r*2),height:(2-Ue)*(Ce+1)*16-(Ue?2:4)*(s+a),pixelRatio:Ae}}}class Ra extends Da{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,r){const s=this.parseNALu(e,i.data,r);let a=this.VideoSample,h,g=!1;i.data=null,a&&s.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(d=>{var v,S;switch(d.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,h=!0;break;case 16:case 17:case 18:case 21:if(h=!0,g){var M;(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 19:case 20:h=!0,(v=a)!=null&&v.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:h=!0,tt(d.data,2,i.pts,t.samples);break;case 32:h=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=c(e.params,this.readVPS(d.data)),this.initVPS=d.data),e.vps=[d.data];break;case 33:if(h=!0,g=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],d.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const $=this.readSPS(d.data);e.width=$.width,e.height=$.height,e.pixelRatio=$.pixelRatio,e.codec=$.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const j in $.params)e.params[j]=$.params[j]}this.pushParameterSet(e.sps,d.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(h=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const $=this.readPPS(d.data);for(const j in $)e.params[j]=$[j]}this.pushParameterSet(e.pps,d.data,e.vps)}break;case 35:h=!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:h=!1;break}a&&h&&a.units.push(d)}),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 Rn(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 Rn(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const r=t.readBits(2),s=t.readBoolean(),a=t.readBits(5),h=t.readUByte(),g=t.readUByte(),d=t.readUByte(),v=t.readUByte(),S=t.readUByte(),M=t.readUByte(),$=t.readUByte(),j=t.readUByte(),Q=t.readUByte(),X=t.readUByte(),se=t.readUByte(),ce=[],oe=[];for(let qt=0;qt<i;qt++)ce.push(t.readBoolean()),oe.push(t.readBoolean());if(i>0)for(let qt=i;qt<8;qt++)t.readBits(2);for(let qt=0;qt<i;qt++)ce[qt]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),oe[qt]&&t.readUByte();t.readUEG();const ve=t.readUEG();ve==3&&t.skipBits(1);const Ce=t.readUEG(),Ue=t.readUEG(),Ae=t.readBoolean();let ke=0,Pe=0,Se=0,Xe=0;Ae&&(ke+=t.readUEG(),Pe+=t.readUEG(),Se+=t.readUEG(),Xe+=t.readUEG());const ct=t.readUEG(),Rt=t.readUEG(),St=t.readUEG(),Et=t.readBoolean();for(let qt=Et?0:i;qt<=i;qt++)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 ki=0;ki<4;ki++)for(let Yi=0;Yi<(ki===3?2:6);Yi++)if(!t.readBoolean())t.readUEG();else{const or=Math.min(64,1<<4+(ki<<1));ki>1&&t.readEG();for(let pn=0;pn<or;pn++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const ft=t.readUEG();let Mt=0;for(let qt=0;qt<ft;qt++){let ki=!1;if(qt!==0&&(ki=t.readBoolean()),ki){qt===ft&&t.readUEG(),t.readBoolean(),t.readUEG();let Yi=0;for(let Vr=0;Vr<=Mt;Vr++){const or=t.readBoolean();let pn=!1;or||(pn=t.readBoolean()),(or||pn)&&Yi++}Mt=Yi}else{const Yi=t.readUEG(),Vr=t.readUEG();Mt=Yi+Vr;for(let or=0;or<Yi;or++)t.readUEG(),t.readBoolean();for(let or=0;or<Vr;or++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const qt=t.readUEG();for(let ki=0;ki<qt;ki++){for(let Yi=0;Yi<St+4;Yi++)t.readBits(1);t.readBits(1)}}let pt=0,ot=1,Ht=1,Kt=!0,Yt=1,Vt=0;t.readBoolean(),t.readBoolean();let pi=!1;if(t.readBoolean()){if(t.readBoolean()){const qr=t.readUByte(),Io=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],is=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];qr>0&&qr<16?(ot=Io[qr-1],Ht=is[qr-1]):qr===255&&(ot=t.readBits(16),Ht=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(),pi=t.readBoolean(),pi&&(ke+=t.readUEG(),Pe+=t.readUEG(),Se+=t.readUEG(),Xe+=t.readUEG()),t.readBoolean()&&(Yt=t.readBits(32),Vt=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const is=t.readBoolean(),Po=t.readBoolean();let Mn=!1;(is||Po)&&(Mn=t.readBoolean(),Mn&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),Mn&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Oo=0;Oo<=i;Oo++){Kt=t.readBoolean();const eh=Kt||t.readBoolean();let Fo=!1;eh?t.readEG():Fo=t.readBoolean();const Mo=Fo?1:t.readUEG()+1;if(is)for(let Bn=0;Bn<Mo;Bn++)t.readUEG(),t.readUEG(),Mn&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Po)for(let Bn=0;Bn<Mo;Bn++)t.readUEG(),t.readUEG(),Mn&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),pt=t.readUEG())}let Ri=Ce,Wi=Ue;if(Ae||pi){let qt=1,ki=1;ve===1?qt=ki=2:ve==2&&(qt=2),Ri=Ce-qt*Pe-qt*ke,Wi=Ue-ki*Xe-ki*Se}const zr=r?["A","B","C"][r]:"",Jc=h<<24|g<<16|d<<8|v;let Ws=0;for(let qt=0;qt<32;qt++)Ws=(Ws|(Jc>>qt&1)<<31-qt)>>>0;let Gs=Ws.toString(16);return a===1&&Gs==="2"&&(Gs="6"),{codecString:`hvc1.${zr}${a}.${Gs}.${s?"H":"L"}${se}.B0`,params:{general_tier_flag:s,general_profile_idc:a,general_profile_space:r,general_profile_compatibility_flags:[h,g,d,v],general_constraint_indicator_flags:[S,M,$,j,Q,X],general_level_idc:se,bit_depth:ct+8,bit_depth_luma_minus8:ct,bit_depth_chroma_minus8:Rt,min_spatial_segmentation_idc:pt,chroma_format_idc:ve,frame_rate:{fixed:Kt,fps:Vt/Yt}},width:Ri,height:Wi,pixelRatio:[ot,Ht]}}readPPS(e){const t=new Rn(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(),s=t.readBoolean();let a=1;return s&&r?a=0:s?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 Rr{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=Rr.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 s=!1,a=-1,h=0;for(let g=r;g<t;g+=Ai)if(e[g]===71&&(t-g===Ai||e[g+Ai]===71)){if(h++,a===-1&&(a=g,a!==0&&(i=Math.min(a+Ai*99,e.length-Ai)+1)),s||(s=_s(e,g)===0),s&&h>1&&(a===0&&h>2||g+Ai>i))return a}else{if(h)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=Rr.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Rr.createTrack("audio",r),this._id3Track=Rr.createTrack("id3"),this._txtTrack=Rr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,r=!1){i||(this.sampleAes=null);let s;const a=this._videoTrack,h=this._audioTrack,g=this._id3Track,d=this._txtTrack;let v=a.pid,S=a.pesData,M=h.pid,$=g.pid,j=h.pesData,Q=g.pesData,X=null,se=this.pmtParsed,ce=this._pmtId,oe=e.length;if(this.remainderData&&(e=$e(this.remainderData,e),oe=e.length,this.remainderData=null),oe<Ai&&!r)return this.remainderData=e,{audioTrack:h,videoTrack:a,id3Track:g,textTrack:d};const ve=Math.max(0,Rr.syncOffset(e));oe-=(oe-ve)%Ai,oe<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,oe,e.buffer.byteLength-oe));let Ce=0;for(let Ae=ve;Ae<oe;Ae+=Ai)if(e[Ae]===71){const ke=!!(e[Ae+1]&64),Pe=_s(e,Ae),Se=(e[Ae+3]&48)>>4;let Xe;if(Se>1){if(Xe=Ae+5+e[Ae+4],Xe===Ae+Ai)continue}else Xe=Ae+4;switch(Pe){case v:if(ke){if(S&&(s=on(S,this.logger))){if(this.videoParser===null)switch(a.segmentCodec){case"avc":this.videoParser=new La;break;case"hevc":this.videoParser=new Ra;break}this.videoParser!==null&&this.videoParser.parsePES(a,d,s,!1)}S={data:[],size:0}}S&&(S.data.push(e.subarray(Xe,Ae+Ai)),S.size+=Ae+Ai-Xe);break;case M:if(ke){if(j&&(s=on(j,this.logger)))switch(h.segmentCodec){case"aac":this.parseAACPES(h,s);break;case"mp3":this.parseMPEGPES(h,s);break;case"ac3":this.parseAC3PES(h,s);break}j={data:[],size:0}}j&&(j.data.push(e.subarray(Xe,Ae+Ai)),j.size+=Ae+Ai-Xe);break;case $:ke&&(Q&&(s=on(Q,this.logger))&&this.parseID3PES(g,s),Q={data:[],size:0}),Q&&(Q.data.push(e.subarray(Xe,Ae+Ai)),Q.size+=Ae+Ai-Xe);break;case 0:ke&&(Xe+=e[Xe]+1),ce=this._pmtId=Pl(e,Xe);break;case ce:{ke&&(Xe+=e[Xe]+1);const ct=Ol(e,Xe,this.typeSupported,i,this.observer,this.logger);v=ct.videoPid,v>0&&(a.pid=v,a.segmentCodec=ct.segmentVideoCodec),M=ct.audioPid,M>0&&(h.pid=M,h.segmentCodec=ct.segmentAudioCodec),$=ct.id3Pid,$>0&&(g.pid=$),X!==null&&!se&&(this.logger.warn(`MPEG-TS PMT found at ${Ae} after unknown PID '${X}'. Backtracking to sync byte @${ve} to parse all TS packets.`),X=null,Ae=ve-188),se=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=Pe;break}}else Ce++;Ce>0&&gs(this.observer,new Error(`Found ${Ce} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=S,h.pesData=j,g.pesData=Q;const Ue={audioTrack:h,videoTrack:a,id3Track:g,textTrack:d};return r&&this.extractRemainingSamples(Ue),Ue}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:s}=e,a=i.pesData,h=t.pesData,g=r.pesData;let d;if(a&&(d=on(a,this.logger))){if(this.videoParser===null)switch(i.segmentCodec){case"avc":this.videoParser=new La;break;case"hevc":this.videoParser=new Ra;break}this.videoParser!==null&&(this.videoParser.parsePES(i,s,d,!0),i.pesData=null)}else i.pesData=a;if(h&&(d=on(h,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,d);break;case"mp3":this.parseMPEGPES(t,d);break;case"ac3":this.parseAC3PES(t,d);break}t.pesData=null}else h!=null&&h.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=h;g&&(d=on(g,this.logger))?(this.parseID3PES(r,d),r.pesData=null):r.pesData=g}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new Il(this.observer,this.config,t);return this.decrypt(r,s)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:s}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{i(e)}):i(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let s=t.data;if(r){this.aacOverFlow=null;const S=r.missing,M=r.sample.unit.byteLength;if(S===-1)s=$e(r.sample.unit,s);else{const $=M-S;r.sample.unit.set(s.subarray(0,S),$),e.samples.push(r.sample),i=r.missing}}let a,h;for(a=i,h=s.length;a<h-1&&!$n(s,a);a++);if(a!==i){let S;const M=a<h-1;if(M?S=`AAC PES did not start with ADTS header,offset:${a}`:S="No ADTS header found in AAC PES",gs(this.observer,new Error(S),M,this.logger),!M)return}ga(e,this.observer,s,a,this.audioCodec);let g;if(t.pts!==void 0)g=t.pts;else if(r){const S=ma(e.samplerate);g=r.sample.pts+S}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let d=0,v;for(;a<h;)if(v=va(e,s,a,g,d),a+=v.length,v.missing){this.aacOverFlow=v;break}else for(d++;a<h-1&&!$n(s,a);a++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let s=0,a=0;const h=t.pts;if(h===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<r;)if(wa(i,a)){const g=Ea(e,i,a,h,s);if(g)a+=g.length,s++;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 s=i.length;let a=0,h=0,g;for(;h<s&&(g=Ca(e,i,h,r,a++))>0;)h+=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?$i.emsg:$i.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function _s(o,e){return((o[e+1]&31)<<8)+o[e+2]}function Pl(o,e){return(o[e+10]&31)<<8|o[e+11]}function Ol(o,e,t,i,r,s){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},h=(o[e+1]&15)<<8|o[e+2],g=e+3+h-4,d=(o[e+10]&15)<<8|o[e+11];for(e+=12+d;e<g;){const v=_s(o,e),S=(o[e+3]&15)<<8|o[e+4];switch(o[e]){case 207:if(!i){ms("ADTS AAC",s);break}case 15:a.audioPid===-1&&(a.audioPid=v);break;case 21:a.id3Pid===-1&&(a.id3Pid=v);break;case 219:if(!i){ms("H.264",s);break}case 27:a.videoPid===-1&&(a.videoPid=v);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):a.audioPid===-1&&(a.audioPid=v,a.segmentAudioCodec="mp3");break;case 193:if(!i){ms("AC-3",s);break}case 129:t.ac3?a.audioPid===-1&&(a.audioPid=v,a.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(a.audioPid===-1&&S>0){let M=e+5,$=S;for(;$>2;){switch(o[M]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=v,a.segmentAudioCodec="ac3");break}const Q=o[M+1]+2;M+=Q,$-=Q}}break;case 194:case 135:return gs(r,new Error("Unsupported EC-3 in M2TS found"),void 0,s),a;case 36:a.videoPid===-1&&(a.videoPid=v,a.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=S+5}return a}function gs(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 ms(o,e){e.log(`${o} with AES-128-CBC encryption found in unencrypted stream`)}function on(o,e){let t=0,i,r,s,a,h;const g=o.data;if(!o||o.size===0)return null;for(;g[0].length<19&&g.length>1;)g[0]=$e(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 v=i[7];v&192&&(a=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,v&64?(h=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,a-h>60*9e4&&(e.warn(`${Math.round((a-h)/9e4)}s delta between PTS and DTS, align them`),a=h)):h=a),s=i[8];let S=s+9;if(o.size<=S)return null;o.size-=S;const M=new Uint8Array(o.size);for(let $=0,j=g.length;$<j;$++){i=g[$];let Q=i.byteLength;if(S)if(S>Q){S-=Q;continue}else i=i.subarray(S),Q-=S,S=0;M.set(i,t),t+=Q}return r&&(r-=s+3),{data:M,pts:a,dts:h,len:r}}return null}class Fl{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const kr=Math.pow(2,32)-1;class De{static init(){De.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 De.types)De.types.hasOwnProperty(e)&&(De.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]);De.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]),s=new Uint8Array([0,0,0,0,0,0,0,0]);De.STTS=De.STSC=De.STCO=s,De.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),De.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),De.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),De.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),h=new Uint8Array([97,118,99,49]),g=new Uint8Array([0,0,0,1]);De.FTYP=De.box(De.types.ftyp,a,g,a,h),De.DINF=De.box(De.types.dinf,De.box(De.types.dref,r))}static box(e,...t){let i=8,r=t.length;const s=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<s;r++)a.set(t[r],i),i+=t[r].byteLength;return a}static hdlr(e){return De.box(De.types.hdlr,De.HDLR_TYPES[e])}static mdat(e){return De.box(De.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(kr+1)),r=Math.floor(t%(kr+1));return De.box(De.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 De.box(De.types.mdia,De.mdhd(e.timescale||0,e.duration||0),De.hdlr(e.type),De.minf(e))}static mfhd(e){return De.box(De.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"?De.box(De.types.minf,De.box(De.types.smhd,De.SMHD),De.DINF,De.stbl(e)):De.box(De.types.minf,De.box(De.types.vmhd,De.VMHD),De.DINF,De.stbl(e))}static moof(e,t,i){return De.box(De.types.moof,De.mfhd(e),De.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=De.trak(e[t]);return De.box.apply(null,[De.types.moov,De.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(De.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=De.trex(e[t]);return De.box.apply(null,[De.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(kr+1)),r=Math.floor(t%(kr+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,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 De.box(De.types.mvhd,s)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,s;for(r=0;r<t.length;r++)s=t[r].flags,i[r+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return De.box(De.types.sdtp,i)}static stbl(e){return De.box(De.types.stbl,De.stsd(e),De.box(De.types.stts,De.STTS),De.box(De.types.stsc,De.STSC),De.box(De.types.stsz,De.STSZ),De.box(De.types.stco,De.STCO))}static avc1(e){let t=[],i=[],r,s,a;for(r=0;r<e.sps.length;r++)s=e.sps[r],a=s.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(s));for(r=0;r<e.pps.length;r++)s=e.pps[r],a=s.byteLength,i.push(a>>>8&255),i.push(a&255),i=i.concat(Array.prototype.slice.call(s));const h=De.box(De.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,d=e.height,v=e.pixelRatio[0],S=e.pixelRatio[1];return De.box(De.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,d>>8&255,d&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]),h,De.box(De.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),De.box(De.types.pasp,new Uint8Array([v>>24,v>>16&255,v>>8&255,v&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 De.box(De.types.mp4a,De.audioStsd(e),De.box(De.types.esds,De.esds(e)))}static mp3(e){return De.box(De.types[".mp3"],De.audioStsd(e))}static ac3(e){return De.box(De.types["ac-3"],De.audioStsd(e),De.box(De.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return De.box(De.types.stsd,De.STSD,De.mp4a(e));if(t==="ac3"&&e.config)return De.box(De.types.stsd,De.STSD,De.ac3(e));if(t==="mp3"&&e.codec==="mp3")return De.box(De.types.stsd,De.STSD,De.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return De.box(De.types.stsd,De.STSD,De.avc1(e));if(t==="hevc"&&e.vps)return De.box(De.types.stsd,De.STSD,De.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,s=e.height||0,a=Math.floor(i/(kr+1)),h=Math.floor(i%(kr+1));return De.box(De.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,h>>24,h>>16&255,h>>8&255,h&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,s>>8&255,s&255,0,0]))}static traf(e,t){const i=De.sdtp(e),r=e.id,s=Math.floor(t/(kr+1)),a=Math.floor(t%(kr+1));return De.box(De.types.traf,De.box(De.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),De.box(De.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&255])),De.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,De.box(De.types.trak,De.tkhd(e),De.mdia(e))}static trex(e){const t=e.id;return De.box(De.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,s=12+16*r,a=new Uint8Array(s);let h,g,d,v,S,M;for(t+=8+s,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),h=0;h<r;h++)g=i[h],d=g.duration,v=g.size,S=g.flags,M=g.cts,a.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,S.isLeading<<2|S.dependsOn,S.isDependedOn<<6|S.hasRedundancy<<4|S.paddingValue<<1|S.isNonSync,S.degradPrio&61440,S.degradPrio&15,M>>>24&255,M>>>16&255,M>>>8&255,M&255],12+16*h);return De.box(De.types.trun,a)}static initSegment(e){De.types||De.init();const t=De.moov(e);return $e(De.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],r=4,s=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),r-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let a=s.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 h=new Uint8Array(a);h.set(s,0),a=s.length;const g=i.length-1;for(let j=0;j<i.length;j+=1){h.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)h.set(new Uint8Array([i[j][Q].length>>8,i[j][Q].length&255]),a),a+=2,h.set(i[j][Q],a),a+=i[j][Q].length}const d=De.box(De.types.hvcC,h),v=e.width,S=e.height,M=e.pixelRatio[0],$=e.pixelRatio[1];return De.box(De.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,v>>8&255,v&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]),d,De.box(De.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),De.box(De.types.pasp,new Uint8Array([M>>24,M>>16&255,M>>8&255,M&255,$>>24,$>>16&255,$>>8&255,$&255])))}}De.types=void 0,De.HDLR_TYPES=void 0,De.STTS=void 0,De.STSC=void 0,De.STCO=void 0,De.STSZ=void 0,De.VMHD=void 0,De.SMHD=void 0,De.STSD=void 0,De.FTYP=void 0,De.DINF=void 0;const ka=9e4;function vs(o,e,t=1,i=!1){const r=o*e*t;return i?Math.round(r):r}function Ml(o,e,t=1,i=!1){return vs(o,e,1/t,i)}function kn(o,e=!1){return vs(o,1e3,1/ka,e)}function Bl(o,e=1){return vs(o,ka,1/e)}const Nl=10*1e3,Ul=1024,Hl=1152,$l=1536;let ln=null,ys=null;function Ia(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 Gn 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,ln===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ln=a?parseInt(a[1]):0}if(ys===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);ys=s?parseInt(s[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((s,a)=>{let h=a.pts,g=h-s;return g<-4294967296&&(t=!0,h=zi(h,i),g=h-s),g>0?s:h},i);return t&&this.debug("PTS rollover detected"),r}remux(e,t,i,r,s,a,h,g){let d,v,S,M,$,j,Q=s,X=s;const se=e.pid>-1,ce=t.pid>-1,oe=t.samples.length,ve=e.samples.length>0,Ce=h&&oe>0||oe>1;if((!se||ve)&&(!ce||Ce)||this.ISGenerated||h){if(this.ISGenerated){var Ae,ke,Pe,Se;const St=this.videoTrackConfig;(St&&(t.width!==St.width||t.height!==St.height||((Ae=t.pixelRatio)==null?void 0:Ae[0])!==((ke=St.pixelRatio)==null?void 0:ke[0])||((Pe=t.pixelRatio)==null?void 0:Pe[1])!==((Se=St.pixelRatio)==null?void 0:Se[1]))||!St&&Ce||this.nextAudioTs===null&&ve)&&this.resetInitSegment()}this.ISGenerated||(S=this.generateIS(e,t,s,a));const Xe=this.isVideoContiguous;let ct=-1,Rt;if(Ce&&(ct=jl(t.samples),!Xe&&this.config.forceKeyFrameOnDiscontinuity))if(j=!0,ct>0){this.warn(`Dropped ${ct} out of ${oe} video samples due to a missing keyframe`);const St=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(ct),t.dropped+=ct,X+=(t.samples[0].pts-St)/t.inputTimeScale,Rt=X}else ct===-1&&(this.warn(`No keyframe found out of ${oe} video samples`),j=!1);if(this.ISGenerated){if(ve&&Ce){const St=this.getVideoStartPts(t.samples),yt=(zi(e.samples[0].pts,St)-St)/t.inputTimeScale;Q+=Math.max(0,yt),X+=Math.max(0,-yt)}if(ve){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),S=this.generateIS(e,t,s,a)),v=this.remuxAudio(e,Q,this.isAudioContiguous,a,ce||Ce||g===m.AUDIO?X:void 0),Ce){const St=v?v.endPTS-v.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),S=this.generateIS(e,t,s,a)),d=this.remuxVideo(t,X,Xe,St)}}else Ce&&(d=this.remuxVideo(t,X,Xe,0));d&&(d.firstKeyFrame=ct,d.independent=ct!==-1,d.firstKeyFramePTS=Rt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&($=Pa(i,s,this._initPTS,this._initDTS)),r.samples.length&&(M=Oa(r,s,this._initPTS))),{audio:v,video:d,initSegment:S,independent:j,text:M,id3:$}}generateIS(e,t,i,r){const s=e.samples,a=t.samples,h=this.typeSupported,g={},d=this._initPTS;let v=!d||r,S="audio/mp4",M,$,j,Q;if(v&&(M=$=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":h.mpeg?(S="audio/mpeg",e.codec=""):h.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"&&h.mpeg?new Uint8Array(0):De.initSegment([e]),metadata:{channelCount:e.channelCount}},v&&(Q=e.id,j=e.inputTimeScale,!d||j!==d.timescale?M=$=s[0].pts-Math.round(j*i):v=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,g.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:De.initSegment([t]),metadata:{width:t.width,height:t.height}},v)if(Q=t.id,j=t.inputTimeScale,!d||j!==d.timescale){const X=this.getVideoStartPts(a),se=Math.round(j*i);$=Math.min($,zi(a[0].dts,X)-se),M=Math.min(M,X-se)}else v=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(g).length)return this.ISGenerated=!0,v?(this._initPTS={baseTime:M,timescale:j},this._initDTS={baseTime:$,timescale:j}):M=j=void 0,{tracks:g,initPTS:M,timescale:j,trackId:Q}}remuxVideo(e,t,i,r){const s=e.inputTimeScale,a=e.samples,h=[],g=a.length,d=this._initPTS,v=d.baseTime*s/d.timescale;let S=this.nextVideoTs,M=8,$=this.videoSampleDuration,j,Q,X=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY,ce=!1;if(!i||S===null){const pt=v+t*s,ot=a[0].pts-zi(a[0].dts,a[0].pts);ln&&S!==null&&Math.abs(pt-ot-(S+v))<15e3?i=!0:S=pt-ot-v}const oe=S+v;for(let pt=0;pt<g;pt++){const ot=a[pt];ot.pts=zi(ot.pts,oe),ot.dts=zi(ot.dts,oe),ot.dts<a[pt>0?pt-1:pt].dts&&(ce=!0)}ce&&a.sort(function(pt,ot){const Ht=pt.dts-ot.dts,Kt=pt.pts-ot.pts;return Ht||Kt}),j=a[0].dts,Q=a[a.length-1].dts;const ve=Q-j,Ce=ve?Math.round(ve/(g-1)):$||e.inputTimeScale/30;if(i){const pt=j-oe,ot=pt>Ce,Ht=pt<-1;if((ot||Ht)&&(ot?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${kn(pt,!0)} ms (${pt}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${kn(-pt,!0)} ms (${pt}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Ht||oe>=a[0].pts||ln)){j=oe;const Kt=a[0].pts-pt;if(ot)a[0].dts=j,a[0].pts=Kt;else{let Yt=!0;for(let Vt=0;Vt<a.length&&!(a[Vt].dts>Kt&&Yt);Vt++){const pi=a[Vt].pts;if(a[Vt].dts-=pt,a[Vt].pts-=pt,Vt<a.length-1){const ji=a[Vt+1].pts,Ri=a[Vt].pts,Wi=ji<=Ri,zr=ji<=pi;Yt=Wi==zr}}}this.log(`Video: Initial PTS/DTS adjusted: ${kn(Kt,!0)}/${kn(j,!0)}, delta: ${kn(pt,!0)} ms`)}}j=Math.max(0,j);let Ue=0,Ae=0,ke=j;for(let pt=0;pt<g;pt++){const ot=a[pt],Ht=ot.units,Kt=Ht.length;let Yt=0;for(let Vt=0;Vt<Kt;Vt++)Yt+=Ht[Vt].data.length;Ae+=Yt,Ue+=Kt,ot.length=Yt,ot.dts<ke?(ot.dts=ke,ke+=Ce/4|0||1):ke=ot.dts,X=Math.min(ot.pts,X),se=Math.max(ot.pts,se)}Q=a[g-1].dts;const Pe=Ae+4*Ue+8;let Se;try{Se=new Uint8Array(Pe)}catch(pt){this.observer.emit(_.ERROR,_.ERROR,{type:D.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:pt,bytes:Pe,reason:`fail allocating video mdat ${Pe}`});return}const Xe=new DataView(Se.buffer);Xe.setUint32(0,Pe),Se.set(De.types.mdat,4);let ct=!1,Rt=Number.POSITIVE_INFINITY,St=Number.POSITIVE_INFINITY,Et=Number.NEGATIVE_INFINITY,yt=Number.NEGATIVE_INFINITY;for(let pt=0;pt<g;pt++){const ot=a[pt],Ht=ot.units;let Kt=0;for(let pi=0,ji=Ht.length;pi<ji;pi++){const Ri=Ht[pi],Wi=Ri.data,zr=Ri.data.byteLength;Xe.setUint32(M,zr),M+=4,Se.set(Wi,M),M+=zr,Kt+=4+zr}let Yt;if(pt<g-1)$=a[pt+1].dts-ot.dts,Yt=a[pt+1].pts-ot.pts;else{const pi=this.config,ji=pt>0?ot.dts-a[pt-1].dts:Ce;if(Yt=pt>0?ot.pts-a[pt-1].pts:Ce,pi.stretchShortVideoTrack&&this.nextAudioTs!==null){const Ri=Math.floor(pi.maxBufferHole*s),Wi=(r?X+r*s:this.nextAudioTs+v)-ot.pts;Wi>Ri?($=Wi-ji,$<0?$=ji:ct=!0,this.log(`It is approximately ${Wi/90} ms to the next segment; using duration ${$/90} ms for the last video frame.`)):$=ji}else $=ji}const Vt=Math.round(ot.pts-ot.dts);Rt=Math.min(Rt,$),Et=Math.max(Et,$),St=Math.min(St,Yt),yt=Math.max(yt,Yt),h.push(Ia(ot.key,$,Kt,Vt))}if(h.length){if(ln){if(ln<70){const pt=h[0].flags;pt.dependsOn=2,pt.isNonSync=0}}else if(ys&&yt-St<Et-Rt&&Ce/Et<.025&&h[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let pt=j;for(let ot=0,Ht=h.length;ot<Ht;ot++){const Kt=pt+h[ot].duration,Yt=pt+h[ot].cts;if(ot<Ht-1){const Vt=Kt+h[ot+1].cts;h[ot].duration=Vt-Yt}else h[ot].duration=ot?h[ot-1].duration:Ce;h[ot].cts=0,pt=Kt}}}$=ct||!$?Ce:$;const It=Q+$;this.nextVideoTs=S=It-v,this.videoSampleDuration=$,this.isVideoContiguous=!0;const Pt={data1:De.moof(e.sequenceNumber++,j,c(e,{samples:h})),data2:Se,startPTS:(X-v)/s,endPTS:(se+$-v)/s,startDTS:(j-v)/s,endDTS:S/s,type:"video",hasAudio:!1,hasVideo:!0,nb:h.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Pt}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Hl;case"ac3":return $l;default:return Ul}}remuxAudio(e,t,i,r,s){const a=e.inputTimeScale,h=e.samplerate?e.samplerate:a,g=a/h,d=this.getSamplesPerFrame(e),v=d*g,S=this._initPTS,M=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,$=[],j=s!==void 0;let Q=e.samples,X=M?0:8,se=this.nextAudioTs||-1;const ce=S.baseTime*a/S.timescale,oe=ce+t*a;if(this.isAudioContiguous=i=i||Q.length&&se>0&&(r&&Math.abs(oe-(se+ce))<9e3||Math.abs(zi(Q[0].pts,oe)-(se+ce))<20*v),Q.forEach(function(yt){yt.pts=zi(yt.pts,oe)}),!i||se<0){if(Q=Q.filter(yt=>yt.pts>=0),!Q.length)return;s===0?se=0:r&&!j?se=Math.max(0,oe-ce):se=Q[0].pts-ce}if(e.segmentCodec==="aac"){const yt=this.config.maxAudioFramesDrift;for(let It=0,ft=se+ce;It<Q.length;It++){const Mt=Q[It],Pt=Mt.pts,pt=Pt-ft,ot=Math.abs(1e3*pt/a);if(pt<=-yt*v&&j)It===0&&(this.warn(`Audio frame @ ${(Pt/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*pt/a)} ms.`),this.nextAudioTs=se=Pt-ce,ft=Pt);else if(pt>=yt*v&&ot<Nl&&j){let Ht=Math.round(pt/v);for(ft=Pt-Ht*v;ft<0&&Ht&&v;)Ht--,ft+=v;It===0&&(this.nextAudioTs=se=ft-ce),this.warn(`Injecting ${Ht} audio frames @ ${((ft-ce)/a).toFixed(3)}s due to ${Math.round(1e3*pt/a)} ms gap.`);for(let Kt=0;Kt<Ht;Kt++){let Yt=Fl.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Yt||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Yt=Mt.unit.subarray()),Q.splice(It,0,{unit:Yt,pts:ft}),ft+=v,It++}}Mt.pts=ft,ft+=v}}let ve=null,Ce=null,Ue,Ae=0,ke=Q.length;for(;ke--;)Ae+=Q[ke].unit.byteLength;for(let yt=0,It=Q.length;yt<It;yt++){const ft=Q[yt],Mt=ft.unit;let Pt=ft.pts;if(Ce!==null){const ot=$[yt-1];ot.duration=Math.round((Pt-Ce)/g)}else if(i&&e.segmentCodec==="aac"&&(Pt=se+ce),ve=Pt,Ae>0){Ae+=X;try{Ue=new Uint8Array(Ae)}catch(ot){this.observer.emit(_.ERROR,_.ERROR,{type:D.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:ot,bytes:Ae,reason:`fail allocating audio mdat ${Ae}`});return}M||(new DataView(Ue.buffer).setUint32(0,Ae),Ue.set(De.types.mdat,4))}else return;Ue.set(Mt,X);const pt=Mt.byteLength;X+=pt,$.push(Ia(!0,d,pt,0)),Ce=Pt}const Pe=$.length;if(!Pe)return;const Se=$[$.length-1];se=Ce-ce,this.nextAudioTs=se+g*Se.duration;const Xe=M?new Uint8Array(0):De.moof(e.sequenceNumber++,ve/g,c({},e,{samples:$}));e.samples=[];const ct=(ve-ce)/a,Rt=se/a,Et={data1:Xe,data2:Ue,startPTS:ct,endPTS:Rt,startDTS:ct,endDTS:Rt,type:"audio",hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,Et}}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 jl(o){for(let e=0;e<o.length;e++)if(o[e].key)return e;return-1}function Pa(o,e,t,i){const r=o.samples.length;if(!r)return;const s=o.inputTimeScale;for(let h=0;h<r;h++){const g=o.samples[h];g.pts=zi(g.pts-t.baseTime*s/t.timescale,e*s)/s,g.dts=zi(g.dts-i.baseTime*s/i.timescale,e*s)/s}const a=o.samples;return o.samples=[],{samples:a}}function Oa(o,e,t){const i=o.samples.length;if(!i)return;const r=o.inputTimeScale;for(let a=0;a<i;a++){const h=o.samples[a];h.pts=zi(h.pts-t.baseTime*r/t.timescale,e*r)/r}o.samples.sort((a,h)=>a.pts-h.pts);const s=o.samples;return o.samples=[],{samples:s}}class Wl 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(Be(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=Fe(e);r.audio&&(t=Fa(r.audio,q.AUDIO,this)),r.video&&(i=Fa(r.video,q.VIDEO,this));const s={};r.audio&&r.video?s.audiovideo={container:"video/mp4",codec:t+","+i,supplemental:r.video.supplemental,initSegment:e,id:"main"}:r.audio?s.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?s.video={container:"video/mp4",codec:i,supplemental:r.video.supplemental,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,i,r,s,a){var h,g;let{initPTS:d,lastEndTime:v}=this;const S={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};k(v)||(v=this.lastEndTime=s||0);const M=t.samples;if(!(M!=null&&M.length))return S;const $={initPTS:void 0,timescale:void 0,trackId:void 0};let j=this.initData;if((h=j)!=null&&h.length||(this.generateInitSegment(M),j=this.initData),!((g=j)!=null&&g.length))return this.warn("Failed to generate initSegment."),S;this.emitInitSegment&&($.tracks=this.initTracks,this.emitInitSegment=!1);const Q=Ne(M,j,this),X=j.audio?Q[j.audio.id]:null,se=j.video?Q[j.video.id]:null,ce=Kn(se,1/0),oe=Kn(X,1/0),ve=Kn(se,0,!0),Ce=Kn(X,0,!0);let Ue,Ae=s,ke=0;if(X&&(!se||!d&&oe<ce||d&&d.trackId===j.audio.id)?($.trackId=j.audio.id,Ue=X,ke=Ce-oe):se&&($.trackId=j.video.id,Ue=se,ke=ve-ce),Ue){const yt=Ue.timescale;Ae=Ue.start/yt,$.initPTS=Ue.start-s*yt,$.timescale=yt,d||(this.initPTS=d={baseTime:$.initPTS,timescale:yt,trackId:$.trackId})}(a||!d)&&(Gl(d,Ae,s,ke)||$.timescale!==d.timescale)&&($.initPTS=Ae-s,$.timescale=1,d&&d.timescale===1&&this.warn(`Adjusting initPTS @${s} from ${d.baseTime/d.timescale} to ${$.initPTS}`),this.initPTS=d={baseTime:$.initPTS,timescale:1});const Pe=e?Ae-d.baseTime/d.timescale:v,Se=Pe+ke;ke>0?this.lastEndTime=Se:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Xe=!!j.audio,ct=!!j.video;let Rt="";Xe&&(Rt+="audio"),ct&&(Rt+="video");const St={data1:M,startPTS:Pe,startDTS:Pe,endPTS:Se,endDTS:Se,type:Rt,hasAudio:Xe,hasVideo:ct,nb:1,dropped:0};S.audio=Xe&&!ct?St:void 0,S.video=ct?St:void 0;const Et=se==null?void 0:se.sampleCount;if(Et){const yt=se.keyFrameIndex,It=yt!==-1;St.nb=Et,St.dropped=yt===0||this.isVideoContiguous?0:It?yt:Et,St.independent=It,St.firstKeyFrame=yt,It&&se.keyFrameStart&&(St.firstKeyFramePTS=(se.keyFrameStart-d.baseTime)/d.timescale),this.isVideoContiguous||(S.independent=It),this.isVideoContiguous||(this.isVideoContiguous=It),St.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${yt}/${Et} dropped: ${St.dropped} start: ${St.firstKeyFramePTS||"NA"}`)}return S.initSegment=$,S.id3=Pa(i,s,d,d),r.samples.length&&(S.text=Oa(r,s,d)),S}}function Kn(o,e,t=!1){return(o==null?void 0:o.start)!==void 0?(o.start+(t?o.duration:0))/o.timescale:e}function Gl(o,e,t,i){if(o===null)return!0;const r=Math.max(i,1),s=e-o.baseTime/o.timescale;return Math.abs(s-t)>r}function Fa(o,e,t){const i=o==null?void 0:o.codec;return i&&i.length>4?i:e===q.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?ue(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 wr;try{wr=self.performance.now.bind(self.performance)}catch(o){wr=Date.now}const zn=[{demux:kl,remux:Wl},{demux:Rr,remux:Gn},{demux:Tl,remux:Gn},{demux:Ll,remux:Gn}];zn.splice(2,0,{demux:Dl,remux:Gn});class Ma{constructor(e,t,i,r,s,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=s,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const s=i.transmuxing;s.executeStart=wr();let a=new Uint8Array(e);const{currentTransmuxState:h,transmuxConfig:g}=this;r&&(this.currentTransmuxState=r);const{contiguous:d,discontinuity:v,trackSwitch:S,accurateTimeOffset:M,timeOffset:$,initSegmentChange:j}=r||h,{audioCodec:Q,videoCodec:X,defaultInitPts:se,duration:ce,initSegmentData:oe}=g,ve=Kl(a,t);if(ve&&cr(ve.method)){const ke=this.getDecrypter(),Pe=jr(ve.method);if(ke.isSync()){let Se=ke.softwareDecrypt(a,ve.key.buffer,ve.iv.buffer,Pe);if(i.part>-1){const ct=ke.flush();Se=ct&&ct.buffer}if(!Se)return s.executeEnd=wr(),bs(i);a=new Uint8Array(Se)}else return this.asyncResult=!0,this.decryptionPromise=ke.webCryptoDecrypt(a,ve.key.buffer,ve.iv.buffer,Pe).then(Se=>{const Xe=this.push(Se,null,i);return this.decryptionPromise=null,Xe}),this.decryptionPromise}const Ce=this.needsProbing(v,S);if(Ce){const ke=this.configureTransmuxer(a);if(ke)return this.logger.warn(`[transmuxer] ${ke.message}`),this.observer.emit(_.ERROR,_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:ke,reason:ke.message}),s.executeEnd=wr(),bs(i)}(v||S||j||Ce)&&this.resetInitSegment(oe,Q,X,ce,t),(v||j||Ce)&&this.resetInitialTimestamp(se),d||this.resetContiguity();const Ue=this.transmux(a,ve,$,M,i);this.asyncResult=In(Ue);const Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,s.executeEnd=wr(),Ue}flush(e){const t=e.transmuxing;t.executeStart=wr();const{decrypter:i,currentTransmuxState:r,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const a=[],{timeOffset:h}=r;if(i){const S=i.flush();S&&a.push(this.push(S.buffer,null,e))}const{demuxer:g,remuxer:d}=this;if(!g||!d){t.executeEnd=wr();const S=[bs(e)];return this.asyncResult?Promise.resolve(S):S}const v=g.flush(h);return In(v)?(this.asyncResult=!0,v.then(S=>(this.flushRemux(a,S,e),a))):(this.flushRemux(a,v,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:s,id3Track:a,textTrack:h}=t,{accurateTimeOffset:g,timeOffset:d}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===m.MAIN?"level":"track"} ${i.level}`);const v=this.remuxer.remux(r,s,a,h,d,g,!0,this.id);e.push({remuxResult:v,chunkMeta:i}),i.transmuxing.executeEnd=wr()}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,s){const{demuxer:a,remuxer:h}=this;!a||!h||(a.resetInitSegment(e,t,i,r),h.resetInitSegment(e,t,i,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,s){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,i,r,s):a=this.transmuxUnencrypted(e,i,r,s),a}transmuxUnencrypted(e,t,i,r){const{audioTrack:s,videoTrack:a,id3Track:h,textTrack:g}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,a,h,g,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,s){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:s}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r}=this;let s;for(let S=0,M=zn.length;S<M;S++){var a;if((a=zn[S].demux)!=null&&a.probe(e,this.logger)){s=zn[S];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const h=this.demuxer,g=this.remuxer,d=s.remux,v=s.demux;(!g||!(g instanceof d))&&(this.remuxer=new d(i,t,r,this.logger)),(!h||!(h instanceof v))&&(this.demuxer=new v(i,t,r,this.logger),this.probe=v.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new er(this.config)),e}}function Kl(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 bs=o=>({remuxResult:{},chunkMeta:o});function In(o){return"then"in o&&o.then instanceof Function}class zl{constructor(e,t,i,r,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=s||null}}class Vl{constructor(e,t,i,r,s,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=s,this.initSegmentChange=a}}let Ba=0;class Na{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Ba++,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 d=g.data,v=this.hls;if(!(!v||!(d!=null&&d.event)||d.instanceNo!==this.instanceNo))switch(d.event){case"init":{var S;const M=(S=this.workerContext)==null?void 0:S.objectURL;M&&self.URL.revokeObjectURL(M);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}case"workerLog":{v.logger[d.data.logType]&&v.logger[d.data.logType](d.data.message);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.part=this.part,d.data.id=this.id,v.trigger(d.event,d.data);break}}},this.onWorkerError=g=>{if(!this.hls)return;const d=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:d})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const a=(g,d)=>{d=d||{},d.frag=this.frag||void 0,g===_.ERROR&&(d=d,d.parent=this.id,d.part=this.part,this.error=d.error),this.hls.trigger(g,d)};this.observer=new ls,this.observer.on(_.FRAG_DECRYPTED,a),this.observer.on(_.ERROR,a);const h=dt(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const g=this.hls.logger;if(s.workerPath||Jo()){try{s.workerPath?(g.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=tl(s.workerPath)):(g.log(`injecting Web Worker for "${t}"`),this.workerContext=el());const{worker:v}=this.workerContext;v.addEventListener("message",this.onWorkerMessage),v.addEventListener("error",this.onWorkerError),v.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:h,id:t,config:At(s)})}catch(v){g.warn(`Error setting up "${t}" Web Worker, fallback to inline`,v),this.terminateWorker(),this.error=null,this.transmuxer=new Ma(this.observer,h,s,"",t,e.logger)}return}}this.transmuxer=new Ma(this.observer,h,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Ba++;const t=this.hls.config,i=dt(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:At(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),il(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,r,s,a,h,g,d,v){var S,M;d.transmuxing.start=self.performance.now();const{instanceNo:$,transmuxer:j}=this,Q=a?a.start:s.start,X=s.decryptdata,se=this.frag,ce=!(se&&s.cc===se.cc),oe=!(se&&d.level===se.level),ve=se?d.sn-se.sn:-1,Ce=this.part?d.part-this.part.index:-1,Ue=ve===0&&d.id>1&&d.id===(se==null?void 0:se.stats.chunkCount),Ae=!oe&&(ve===1||ve===0&&(Ce===1||Ue&&Ce<=0)),ke=self.performance.now();(oe||ve||s.stats.parsing.start===0)&&(s.stats.parsing.start=ke),a&&(Ce||!Ae)&&(a.stats.parsing.start=ke);const Pe=!(se&&((S=s.initSegment)==null?void 0:S.url)===((M=se.initSegment)==null?void 0:M.url)),Se=new Vl(ce,Ae,g,oe,Q,Pe);if(!Ae||ce||Pe){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${d.sn}${d.part>-1?" part: "+d.part:""} ${this.id===m.MAIN?"level":"track"}: ${d.level} id: ${d.id}
discontinuity: ${ce}
trackSwitch: ${oe}
contiguous: ${Ae}
accurateTimeOffset: ${g}
timeOffset: ${Q}
initSegmentChange: ${Pe}`);const Xe=new zl(i,r,t,h,v);this.configureTransmuxer(Xe)}if(this.frag=s,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:$,cmd:"demux",data:e,decryptdata:X,chunkMeta:d,state:Se},e instanceof ArrayBuffer?[e]:[]);else if(j){const Xe=j.push(e,X,d,Se);In(Xe)?Xe.then(ct=>{this.handleTransmuxComplete(ct)}).catch(ct=>{this.transmuxerError(ct,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(Xe)}}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);In(r)?r.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,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 Ua=100;class ql extends as{constructor(e,t,i){super(e,t,i,"audio-stream-controller",m.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:s}){if(i===m.MAIN){const a=t.cc,h=this.fragCurrent;if(this.initPTS[a]={baseTime:r,timescale:s},this.log(`InitPTS for cc: ${a} found from main: ${r}/${s}`),this.mainAnchor=t,this.state===Ve.WAITING_INIT_PTS){const g=this.waitingData;(!g&&!this.loadingParts||g&&g.frag.cc!==a)&&this.syncWithAnchor(t,g==null?void 0:g.frag)}else!this.hls.hasEnoughToStart&&h&&h.cc!==a?(h.abortRequests(),this.syncWithAnchor(t,h)):this.state===Ve.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 s=(r||e).cc,a=this.getLevelDetails(),h=this.getLoadPosition(),g=Qt(a,s,h);g&&(this.log(`Syncing with main frag at ${g.start} cc ${g.cc}`),this.startFragRequested=!1,this.nextLoadPosition=g.start,this.resetLoadingState(),this.state===Ve.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=Ve.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Ua),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=Ve.IDLE):this.state=Ve.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case Ve.IDLE:this.doTickIdle();break;case Ve.WAITING_TRACK:{const{levels:t,trackId:i}=this,r=t==null?void 0:t[i],s=r==null?void 0:r.details;if(s&&!this.waitForLive(r)){if(this.waitForCdnTuneIn(s))break;this.state=Ve.WAITING_INIT_PTS}break}case Ve.FRAG_LOADING_WAITING_RETRY:{var e;const t=performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:r,trackId:s}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((r==null?void 0:r[s])||null),this.state=Ve.IDLE}break}case Ve.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:i,part:r,cache:s,complete:a}=t,h=this.mainAnchor;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.state=Ve.FRAG_LOADING;const g=s.flush().buffer,d={frag:i,part:r,payload:g,networkDetails:null};this._handleFragmentLoadProgress(d),a&&super._handleFragmentLoadComplete(d)}else h&&h.cc!==t.frag.cc&&this.syncWithAnchor(h,t.frag)}else this.state=Ve.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:s}=this,a=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(i!=null&&i[s]))return;const h=i[s],g=h.details;if(!g||this.waitForLive(h)||this.waitForCdnTuneIn(g)){this.state=Ve.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,q.AUDIO,m.AUDIO));const v=this.getFwdBufferInfo(d,m.AUDIO);if(v===null)return;if(!this.switchingTrack&&this._streamEnded(v,g)){t.trigger(_.BUFFER_EOS,{type:"audio"}),this.state=Ve.ENDED;return}const S=v.len,M=t.maxBufferLength,$=g.fragments,j=$[0].start,Q=this.getLoadPosition(),X=this.flushing?Q:v.end;if(this.switchingTrack&&r){const oe=Q;g.PTSKnown&&oe<j&&(v.end>j||v.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=j+.05)}if(S>=M&&!this.switchingTrack&&X<$[$.length-1].start)return;let se=this.getNextFragment(X,g);if(se&&this.isLoopLoading(se,X)&&(se=this.getNextFragmentLoopLoading(se,g,v,m.MAIN,M)),!se){this.bufferFlushed=!0;return}let ce=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&ce&&_e(se)&&!se.endList&&(!g.live||!this.loadingParts&&X<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(ce)===ai.OK&&(this.mainFragLoading=ce=null),ce&&_e(ce))){if(se.start>ce.end){const ve=this.fragmentTracker.getFragAtPos(X,m.MAIN);ve&&ve.end>ce.end&&(ce=ve,this.mainFragLoading={frag:ve,targetBufferTime:null})}if(se.start>ce.end)return}this.loadFragment(se,h,X)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new mi(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!==Ve.STOPPED&&(this.setInterval(Ua),this.state=Ve.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:s,id:a,groupId:h,track:g}=t;if(!r){this.warn(`Audio tracks reset while loading track ${a} "${g.name}" of "${h}"`);return}const d=this.mainDetails;if(!d||s.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=t,this.state!==Ve.STOPPED&&(this.state=Ve.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${g.name}" of "${h}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const v=r[a];let S=0;if(s.live||(i=v.details)!=null&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(v.details){var M;S=this.alignPlaylists(s,v.details,(M=this.levelLastLoaded)==null?void 0:M.details)}s.alignedSliding||(ua(s,d),s.alignedSliding||Un(s,d),S=s.fragmentStart)}v.details=s,this.levelLastLoaded=v,this.startFragRequested||this.setStartPosition(d,S),this.hls.trigger(_.AUDIO_TRACK_UPDATED,{details:s,id:a,groupId:t.groupId}),this.state===Ve.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=Ve.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:r,payload:s}=e,{config:a,trackId:h,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 d=g[h];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const v=d.details;if(!v){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const S=a.defaultAudioCodec||d.audioCodec||"mp4a.40.2";let M=this.transmuxer;M||(M=this.transmuxer=new Na(this.hls,m.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const $=this.initPTS[i.cc],j=(t=i.initSegment)==null?void 0:t.data;if($!==void 0){const X=r?r.index:-1,se=X!==-1,ce=new tr(i.level,i.sn,i.stats.chunkCount,s.byteLength,X,se);M.push(s,j,S,"",i,r,v.totalduration,!1,ce,$)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${v.startSN} ,${v.endSN}],track ${h}`);const{cache:Q}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new ha,complete:!1};Q.push(new Uint8Array(s)),this.state!==Ve.STOPPED&&(this.state=Ve.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===m.MAIN&&_e(t.frag)&&(this.mainFragLoading=t,this.state===Ve.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==m.AUDIO){!this.audioOnly&&i.type===m.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(_e(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(_.AUDIO_TRACK_SWITCHED,u({},s)))}this.fragBufferedComplete(i,r),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=Ve.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(m.AUDIO,t);break;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ve.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===O.AUDIO_TRACK&&(this.state=Ve.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!==q.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==q.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Ve.ENDED&&(this.state=Ve.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,m.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:s,chunkMeta:a}=e,h=this.getCurrentContext(a);if(!h){this.resetWhenMissingContext(a);return}const{frag:g,part:d,level:v}=h,{details:S}=v,{audio:M,text:$,id3:j,initSegment:Q}=s;if(this.fragContextChanged(g)||!S){this.fragmentTracker.removeFragment(g);return}if(this.state=Ve.PARSING,this.switchingTrack&&M&&this.completeAudioSwitch(this.switchingTrack),Q!=null&&Q.tracks){const X=g.initSegment||g;this._bufferInitSegment(v,Q.tracks,X,a),r.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:X,id:i,tracks:Q.tracks})}if(M){const{startPTS:X,endPTS:se,startDTS:ce,endDTS:oe}=M;d&&(d.elementaryStreams[q.AUDIO]={startPTS:X,endPTS:se,startDTS:ce,endDTS:oe}),g.setElementaryStreamInfo(q.AUDIO,X,se,ce,oe),this.bufferFragmentData(M,g,d,a)}if(j!=null&&(t=j.samples)!=null&&t.length){const X=c({id:i,frag:g,details:S},j);r.trigger(_.FRAG_PARSING_METADATA,X)}if($){const X=c({id:i,frag:g,details:S},$);r.trigger(_.FRAG_PARSING_USERDATA,X)}}_bufferInitSegment(e,t,i,r){if(this.state!==Ve.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=m.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${a}/${s.codec}]`),a&&a.split(",").length===1&&(s.levelCodec=a),this.hls.trigger(_.BUFFER_CODECS,t);const h=s.initSegment;if(h!=null&&h.byteLength){const g={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:h};this.hls.trigger(_.BUFFER_APPENDING,g)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===ai.NOT_LOADED||r===ai.PARTIAL){var s;if(!_e(e))this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Ve.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&Un(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:s,audioCodec:a,channels:h}=this.bufferedTrack;Ei({name:t,lang:i,assocLang:r,characteristics:s,audioCodec:a,channels:h},e,Ti)||(_r(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,u({},e))}}class Es 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 s=-1;for(let a=0;a<r.length;a++){const h=r[a];let g;try{g=new self.URL(h.URI,t.url).href}catch(d){this.warn(`Could not construct new URL for Rendition Report: ${d}`),g=h.URI||""}if(g===e){s=a;break}else g===e.substring(0,g.length)&&(s=a)}if(s!==-1){const a=r[s],h=parseInt(a["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let g=parseInt(a["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const v=Math.min(t.age-t.partTarget,t.targetduration);g>=0&&v>t.partTarget&&(g+=1)}const d=i&&yi(i);return new li(h,g>=0?g:void 0,d)}}}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:s}=t,a=self.performance.now(),h=s.loading.first?Math.max(0,a-s.loading.first):0;r.advancedDateTime=Date.now()-h;const g=this.hls.config.timelineOffset;if(g!==r.appliedTimelineOffset){const v=Math.max(g||0,0);r.appliedTimelineOffset=v,r.fragments.forEach(S=>{S.start=S.playlistOffset+v})}if(r.live||i!=null&&i.live){const v="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(i),i&&r.fragments.length>0){Wo(i,r);const ce=r.playlistParsingError;if(ce){this.warn(ce);const oe=this.hls;if(!oe.config.ignorePlaylistParsingErrors){var d;const{networkDetails:ve}=t;oe.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:(d=r.fragments[0])==null?void 0:d.type,networkDetails:ve,stats:s});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=s.loading.start);const S=this.hls.mainForwardBufferInfo,M=S?S.end-S.len:0,$=(r.edge-M)*1e3,j=ia(r,$);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,X,se;if(r.canBlockReload&&r.endSN&&r.advanced){const ce=this.hls.config.lowLatencyMode,oe=r.lastPartSn,ve=r.endSN,Ce=r.lastPartIndex,Ue=Ce!==-1,Ae=oe===ve;Ue?Ae?(X=ve+1,se=ce?0:Ce):(X=oe,se=ce?Ce+1:r.maxPartIndex):X=ve+1;const ke=r.age,Pe=ke+r.ageHeader;let Se=Math.min(Pe-r.partTarget,r.targetduration*1.5);if(Se>0){if(Pe>r.targetduration*3)this.log(`Playlist last advanced ${ke.toFixed(2)}s ago. Omitting segment and part directives.`),X=void 0,se=void 0;else if(i!=null&&i.tuneInGoal&&Pe-r.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${Se} with playlist age: ${r.age}`),Se=0;else{const Xe=Math.floor(Se/r.targetduration);if(X+=Xe,se!==void 0){const ct=Math.round(Se%r.targetduration/r.partTarget);se+=ct}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${ke.toFixed(2)}s goal: ${Se} skip sn ${Xe} to part ${se}`)}r.tuneInGoal=Se}if(Q=this.getDeliveryDirectives(r,t.deliveryDirectives,X,se),ce||!Ae){r.requestScheduled=a,this.loadingPlaylist(v,Q);return}}else(r.canBlockReload||r.canSkipUntil)&&(Q=this.getDeliveryDirectives(r,t.deliveryDirectives,X,se));Q&&X!==void 0&&r.canBlockReload&&(r.requestScheduled=s.loading.first+Math.max(j-h*2,j/2)),this.scheduleLoading(v,Q,r)}else this.clearTimer()}scheduleLoading(e,t,i){const r=i||e.details;if(!r){this.loadingPlaylist(e,t);return}const s=self.performance.now(),a=r.requestScheduled;if(s>=a){this.loadingPlaylist(e,t);return}const h=a-s;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(h)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),h)}getDeliveryDirectives(e,t,i,r){let s=yi(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,s=wi.No),new li(i,r,s)}checkRetry(e){const t=e.details,i=Jt(e),r=e.errorAction,{action:s,retryCount:a=0,retryConfig:h}=r||{},g=!!r&&!!h&&(s===ui.RetryRequest||!r.resolved&&s===ui.SendAlternateToPenaltyBox);if(g){var d;if(a>=h.maxNumRetry)return!1;if(i&&(d=e.context)!=null&&d.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${h.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const v=Xi(h,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),v),this.warn(`Retrying playlist loading ${a+1}/${h.maxNumRetry} after "${t}" in ${v}ms`)}e.levelRetry=!0,r.resolved=!0}return g}}function Ha(o,e){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(!Pn(o[t].attrs,e[t].attrs))return!1;return!0}function Pn(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 Ss(o,e){return e.label.toLowerCase()===o.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(o.lang||"").toLowerCase())}class Yl extends Es{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:s}=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 h=a.details;a.details=t.details,this.log(`Audio track ${i} "${a.name}" lang:${a.lang} group:${r} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,h)}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 s=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(h=>(r==null?void 0:r.indexOf(h))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const h=this.tracks.filter(M=>!i||i.indexOf(M.groupId)!==-1);if(h.length)this.selectDefaultTrack&&!h.some(M=>M.default)&&(this.selectDefaultTrack=!1),h.forEach((M,$)=>{M.id=$});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=h;const g=this.hls.config.audioPreference;if(!s&&g){const M=di(g,h,Ti);if(M>-1)s=h[M];else{const $=di(g,this.tracks);s=this.tracks[$]}}let d=this.findTrackId(s);d===-1&&s&&(d=this.findTrackId(null));const v={audioTracks:h};this.log(`Updating audio tracks, ${h.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(_.AUDIO_TRACKS_UPDATED,v);const S=this.trackId;if(d!==-1&&S===-1)this.setAudioTrack(d);else if(h.length&&S===-1){var a;const M=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${h.length}`);this.warn(M.message),this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:M})}}}onError(e,t){t.fatal||!t.context||t.context.type===O.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&&Ei(e,r,Ti))return r;const s=di(e,this.tracksInGroup,Ti);if(s>-1){const a=this.tracksInGroup[s];return this.setAudioTrack(s),a}else if(r){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const h=_n(e,t.levels,i,a,Ti);if(h===-1)return null;t.nextLoadLevel=h}if(e.channels||e.audioCodec){const a=di(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],s=r.details&&!r.details.live;if(e===this.trackId&&r===i&&s||(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,u({},r)),s))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||Ei(e,r,Ti)))return i}if(e){const{name:i,lang:r,assocLang:s,characteristics:a,audioCodec:h,channels:g}=e;for(let d=0;d<t.length;d++){const v=t[d];if(Ei({name:i,lang:r,assocLang:s,characteristics:a,audioCodec:h,channels:g},v,Ti))return d}for(let d=0;d<t.length;d++){const v=t[d];if(Pn(e.attrs,v.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return d}for(let d=0;d<t.length;d++){const v=t[d];if(Pn(e.attrs,v.attrs,["LANGUAGE"]))return d}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&_r(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,r=e.groupId,s=this.getUrlWithDirectives(e.url,t),a=e.details,h=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:""}${h&&a.live?" age "+h.toFixed(1)+(a.type?" "+a.type||0:""):""} ${s}`),this.hls.trigger(_.AUDIO_TRACK_LOADING,{url:s,id:i,groupId:r,deliveryDirectives:t||null,track:e})}}class Zl{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(s){var i;if(r.onError(s),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 $a=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,ja="HlsJsTrackRemovedError";class Xl extends Error{constructor(e){super(e),this.name=ja}}class Ql 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:s}=this;i&&this.log("Media source opened"),!(!r||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(_.MEDIA_ATTACHED,{media:r,mediaSource:s}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:r}=this;i!==r&&this.error(`Media element src was set while attaching MediaSource (${r} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=V(Y(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 s=this.isUpdating();s||this.operationQueue.removeBlockers();const a=this.isQueued();(s||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${s?" 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(s=>{const[a]=s;a&&(i[a]=c({},this.tracks[a]),this.removeBuffer(a)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let 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,r=Y(this.appendSource);if(this.transferData=this.overrides=void 0,i&&r){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(a),s)this._objectUrl=i.src,this.attachTransferred();else{const h=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,Wa(i),Jl(i,h),i.load()}catch(g){i.src=h}else i.src=h}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,s=r?Object.keys(r):null,a=s?s.length:0,h=()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()};if(r&&s&&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: ${At(i,(g,d)=>g==="initSegment"?void 0:d)};
transfer tracks: ${At(r,(g,d)=>g==="initSegment"?void 0:d)}}`),!ne(r,i)){t.mediaSource=null,t.tracks=void 0;const g=e.currentTime,d=this.details,v=Math.max(g,(d==null?void 0:d.fragments[0].start)||0);if(v-g>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${g} -> ${v}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(i)}") start time: ${v} currentTime: ${g}`),this.onMediaDetaching(_.MEDIA_DETACHING,{}),this.onMediaAttaching(_.MEDIA_ATTACHING,t),e.currentTime=v;return}this.transferData=void 0,s.forEach(g=>{const d=g,v=r[d];if(v){const S=v.buffer;if(S){const M=this.fragmentTracker,$=v.id;if(M.hasFragments($)||M.hasParts($)){const X=Lt.getBuffered(S);M.detectEvictedFragments(d,X,$,null,!0)}const j=ws(d),Q=[d,S];this.sourceBuffers[j]=Q,S.updating&&this.operationQueue&&this.operationQueue.prependBlocker(d),this.trackSourceBuffer(d,v)}}}),h(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),h()}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:s,_objectUrl:a}=this;if(s){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([h])=>{h&&this.removeBuffer(h)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const h=s.readyState==="open";try{const g=s.sourceBuffers;for(let d=g.length;d--;)h&&g[d].abort(),s.removeSourceBuffer(g[d]);h&&s.endOfStream()}catch(g){this.warn(`onMediaDetaching: ${g.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),i||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(r.removeAttribute("src"),this.appendSource&&Wa(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(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[ws(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Zl(this.tracks)}onBufferCodecs(e,t){const i=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),a=!s&&this.sourceBufferCount&&this.media&&r.some(h=>!i[h]);if(s||a){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${r}" SourceBuffers`);return}r.forEach(h=>{var g,d,v;const S=t[h],{id:M,codec:$,levelCodec:j,container:Q,metadata:X,supplemental:se}=S;let ce=i[h];const oe=(g=this.transferData)==null||(d=g.tracks)==null?void 0:d[h],ve=oe!=null&&oe.buffer?oe:ce,Ce=(ve==null?void 0:ve.pendingCodec)||(ve==null?void 0:ve.codec),Ue=ve==null?void 0:ve.levelCodec;ce||(ce=i[h]={buffer:void 0,listeners:[],codec:$,supplemental:se,container:Q,levelCodec:j,metadata:X,id:M});const Ae=pe(Ce,Ue),ke=Ae==null?void 0:Ae.replace($a,"$1");let Pe=pe($,j);const Se=(v=Pe)==null?void 0:v.replace($a,"$1");Pe&&Ae&&ke!==Se&&(h.slice(0,5)==="audio"&&(Pe=ue(Pe,this.appendSource)),this.log(`switching codec ${Ce} to ${Pe}`),Pe!==(ce.pendingCodec||ce.codec)&&(ce.pendingCodec=Pe),ce.container=Q,this.appendChangeType(h,Q,Pe))}),(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}`,s={label:`change-type=${r}`,execute:()=>{const a=this.tracks[e];if(a){const h=a.buffer;h!=null&&h.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),h.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(s,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,m.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var h;const g=this.tracks.video;(this.lastVideoAppendEnd>r||g!=null&&g.buffer&&Lt.isBuffered(g.buffer,r)||((h=this.fragmentTracker.getAppendedFrag(r,m.MAIN))==null?void 0:h.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:h=>{this.warn("Error executing block-audio operation",h)}};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:s,parent:a,frag:h,part:g,chunkMeta:d,offset:v}=t,S=d.buffering[s],{sn:M,cc:$}=h,j=self.performance.now();S.start=j;const Q=h.stats.buffering,X=g?g.stats.buffering:null;Q.start===0&&(Q.start=j),X&&X.start===0&&(X.start=j);const se=i.audio;let ce=!1;s==="audio"&&(se==null?void 0:se.container)==="audio/mpeg"&&(ce=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const oe=i.video,ve=oe==null?void 0:oe.buffer;if(ve&&M!=="initSegment"){const Ae=g||h,ke=this.blockedAudioAppend;if(s==="audio"&&a!=="main"&&!this.blockedAudioAppend){const Se=Ae.start+Ae.duration*.05,Xe=ve.buffered,ct=this.currentOp("video");!Xe.length&&!ct?this.blockAudio(Ae):!ct&&!Lt.isBuffered(ve,Se)&&this.lastVideoAppendEnd<Se&&this.blockAudio(Ae)}else if(s==="video"){const Pe=Ae.end;if(ke){const Se=ke.frag.start;(Pe>Se||Pe<this.lastVideoAppendEnd||Lt.isBuffered(ve,Se))&&this.unblockAudio()}this.lastVideoAppendEnd=Pe}}const Ce=(g||h).start,Ue={label:`append-${s}`,execute:()=>{var Ae;S.executeStart=self.performance.now();const ke=(Ae=this.tracks[s])==null?void 0:Ae.buffer;ke&&(ce?this.updateTimestampOffset(ke,Ce,.1,s,M,$):v!==void 0&&k(v)&&this.updateTimestampOffset(ke,v,1e-6,s,M,$)),this.appendExecutor(r,s)},onStart:()=>{},onComplete:()=>{const Ae=self.performance.now();S.executeEnd=S.end=Ae,Q.first===0&&(Q.first=Ae),X&&X.first===0&&(X.first=Ae);const ke={};this.sourceBuffers.forEach(([Pe,Se])=>{Pe&&(ke[Pe]=Lt.getBuffered(Se))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(_.BUFFER_APPENDED,{type:s,frag:h,part:g,chunkMeta:d,parent:h.type,timeRanges:ke})},onError:Ae=>{var ke;const Pe={type:D.MEDIA_ERROR,parent:h.type,details:w.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:h,part:g,chunkMeta:d,error:Ae,err:Ae,fatal:!1},Se=(ke=this.media)==null?void 0:ke.error;if(Ae.code===DOMException.QUOTA_EXCEEDED_ERR||Ae.name=="QuotaExceededError"||"quota"in Ae)Pe.details=w.BUFFER_FULL_ERROR;else if(Ae.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Se)Pe.errorAction=lr(!0);else if(Ae.name===ja&&this.sourceBufferCount===0)Pe.errorAction=lr(!0);else{const Xe=++this.appendErrors[s];this.warn(`Failed ${Xe}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${Se||"no media error"})`),(Xe>=this.hls.config.appendErrorMaxRetry||Se)&&(Pe.fatal=!0)}this.hls.trigger(_.ERROR,Pe)}};this.append(Ue,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(_.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:s}=t;i?this.append(this.getFlushOp(i,r,s),i):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,r,s),a)})}onFragParsed(e,t){const{frag:i,part:r}=t,s=[],a=r?r.elementaryStreams:i.elementaryStreams;a[q.AUDIOVIDEO]?s.push("audiovideo"):(a[q.AUDIO]&&s.push("audio"),a[q.VIDEO]&&s.push("video"));const h=()=>{const g=self.performance.now();i.stats.buffering.end=g,r&&(r.stats.buffering.end=g);const d=r?r.stats:i.stats;this.hls.trigger(_.FRAG_BUFFERED,{frag:i,part:r,stats:d,id:i.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(h,s).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])=>{var t,i;return e&&(!((t=this.tracks[e])!=null&&t.ended)||((i=this.tracks[e])==null?void 0:i.ending))})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([a])=>{if(a){const h=this.tracks[a];(!t.type||t.type===a)&&(h.ending=!0,h.ended||(h.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 h;return a&&!((h=this.tracks[a])!=null&&h.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)))}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;k(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,s=i.currentTime,a=t.levelTargetDuration,h=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(k(h)&&h>=0){const g=Math.max(h,a),d=Math.floor(s/a)*a-g;this.flushBackBuffer(s,a,d)}if(k(r.frontBufferFlushThreshold)&&r.frontBufferFlushThreshold>0){const g=Math.max(r.maxBufferLength,r.frontBufferFlushThreshold),d=Math.max(g,a),v=Math.floor(s/a)*a+d;this.flushFrontBuffer(s,a,v)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([r,s])=>{if(s){const h=Lt.getBuffered(s);if(h.length>0&&i>h.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,s])=>{if(s){const a=Lt.getBuffered(s),h=a.length;if(h<2)return;const g=a.start(h-1),d=a.end(h-1);if(i>g||e>=g&&e<=d)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&&t.live&&i.setLiveSeekableRange){const d=Math.max(0,t.fragmentStart),v=Math.max(d,r);return{duration:1/0,start:d,end:v}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return k(s)?{duration:s}:null;const a=this.media.duration,h=k(i.duration)?i.duration:0;return r>h&&r>a||!k(a)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:i}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(k(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}) ${At(i)}`),this.tracksReady){var r;const s=(r=this.transferData)==null?void 0:r.tracks;s&&Object.keys(s).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 s in e){const a=s,h=e[a];if(this.isPending(h)){const g=this.getTrackCodec(h,a),d=`${h.container};codecs=${g}`;h.codec=g,this.log(`creating sourceBuffer(${d})${this.currentOp(a)?" Queued":""} ${At(h)}`);try{const v=i.addSourceBuffer(d),S=ws(a),M=[a,v];t[S]=M,h.buffer=v}catch(v){var r;this.error(`error while trying to add sourceBuffer: ${v.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:v,sourceBufferName:a,mimeType:d,parent:h.id});return}this.trackSourceBuffer(a,h)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let r=e.codec;i&&(t==="video"||t==="audiovideo")&&Ut(i,"video")&&(r=fe(r,i));const s=pe(r,e.levelCodec);return s?t.slice(0,5)==="audio"?ue(s,this.appendSource):s:""}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",(s,a)=>{const h=a.removedRanges;h!=null&&h.length&&this.hls.trigger(_.BUFFER_FLUSHED,{type:s})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i==null?void 0:i.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const 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 s=this.currentOp(e);s&&s.onError(r)}updateTimestampOffset(e,t,i,r,s,a){const h=t-e.timestampOffset;Math.abs(h)>=i&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${s} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:r,mediaSource:s}=this,a=this.tracks[e],h=a==null?void 0:a.buffer;if(!r||!s||!h){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const g=k(r.duration)?r.duration:1/0,d=k(s.duration)?s.duration:1/0,v=Math.max(0,t),S=Math.min(i,g,d);S>v&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${v},${S}] from the ${e} SourceBuffer`),h.remove(v,S)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],r=i==null?void 0:i.buffer;if(!r)throw new Xl(`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 s=r.buffer;if(!s)return;const a=i.bind(this,e);r.listeners.push({event:t,listener:a}),s.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 Wa(o){const e=o.querySelectorAll("source");[].slice.call(e).forEach(t=>{o.removeChild(t)})}function Jl(o,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,o.appendChild(t)}function ws(o){return o==="audio"?1:0}class xs{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&&k(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,s)=>this.isLevelAllowed(r)&&s<=e);return this.clientRect=null,xs.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=(h,g)=>g?h.width!==g.width||h.height!==g.height:!0;let s=e.length-1;const a=Math.max(t,i);for(let h=0;h<e.length;h+=1){const g=e[h];if((g.width>=a||g.height>=a)&&r(g,e[h+1])){s=h;break}}return s}}const Hi={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},eu={HLS:"h"},On={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},tu={[On.OBJECT]:["br","ab","d","ot","tb","tpb","lb","tab","lab","url"],[On.REQUEST]:["pb","bl","tbl","dl","ltc","mtp","nor","nrr","rc","sn","sta","su","ttfb","ttfbb","ttlb","cmsdd","cmsds","smrt","df","cs"],[On.SESSION]:["cid","pr","sf","sid","st","v","msd"],[On.STATUS]:["bs","bsd","cdn","rtp","bg","pt","ec","e"]};class un{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof un?i:new un(i))),this.value=e,this.params=t}}const iu="Dict";function ru(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 nu(o,e,t,i){return new Error(`failed to ${o} "${ru(e)}" as ${t}`,{cause:i})}function dr(o,e,t){return nu("serialize",o,e,t)}class Ga{constructor(e){this.description=e}}const Ka="Bare Item",su="Boolean";function au(o){if(typeof o!="boolean")throw dr(o,su);return o?"?1":"?0"}function ou(o){return btoa(String.fromCharCode(...o))}const lu="Byte Sequence";function uu(o){if(ArrayBuffer.isView(o)===!1)throw dr(o,lu);return`:${ou(o)}:`}const cu="Integer";function hu(o){return o<-999999999999999||999999999999999<o}function za(o){if(hu(o))throw dr(o,cu);return o.toString()}function fu(o){return`@${za(o.getTime()/1e3)}`}function Va(o,e){if(o<0)return-Va(-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 du="Decimal";function pu(o){const e=Va(o,3);if(Math.floor(Math.abs(e)).toString().length>12)throw dr(o,du);const t=e.toString();return t.includes(".")?t:`${t}.0`}const _u="String",gu=/[\x00-\x1f\x7f]+/;function mu(o){if(gu.test(o))throw dr(o,_u);return`"${o.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function vu(o){return o.description||o.toString().slice(7,-1)}const yu="Token";function qa(o){const e=vu(o);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw dr(e,yu);return e}function As(o){switch(typeof o){case"number":if(!k(o))throw dr(o,Ka);return Number.isInteger(o)?za(o):pu(o);case"string":return mu(o);case"symbol":return qa(o);case"boolean":return au(o);case"object":if(o instanceof Date)return fu(o);if(o instanceof Uint8Array)return uu(o);if(o instanceof Ga)return qa(o);default:throw dr(o,Ka)}}const bu="Key";function Cs(o){if(/^[a-z*][a-z0-9\-_.*]*$/.test(o)===!1)throw dr(o,bu);return o}function Ts(o){return o==null?"":Object.entries(o).map(([e,t])=>t===!0?`;${Cs(e)}`:`;${Cs(e)}=${As(t)}`).join("")}function Ya(o){return o instanceof un?`${As(o.value)}${Ts(o.params)}`:As(o)}function Eu(o){return`(${o.value.map(Ya).join(" ")})${Ts(o.params)}`}function Su(o,e={whitespace:!0}){if(typeof o!="object")throw dr(o,iu);const t=o instanceof Map?o.entries():Object.entries(o),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,s])=>{s instanceof un||(s=new un(s));let a=Cs(r);return s.value===!0?a+=Ts(s.params):(a+="=",Array.isArray(s.value)?a+=Eu(s):a+=Ya(s)),a}).join(`,${i}`)}function wu(o,e){return Su(o,e)}function xu(o){return["ot","sf","st","e","sta"].includes(o)}function Au(o){return typeof o=="number"?k(o):o!=null&&o!==""&&o!==!1}function Cu(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),s=i.pathname.split("/").slice(1,-1);for(;r[0]===s[0];)r.shift(),s.shift();for(;s.length;)s.shift(),r.unshift("..");return r.join("/")}const Vn=o=>Math.round(o),Tu=(o,e)=>(e!=null&&e.baseUrl&&(o=Cu(o,e.baseUrl)),encodeURIComponent(o)),qn=o=>Vn(o/100)*100,Du={br:Vn,d:Vn,bl:qn,dl:qn,mtp:qn,nor:Tu,rtp:qn,tb:Vn};function Lu(o,e){const t={};if(o==null||typeof o!="object")return t;const i=Object.keys(o).sort(),r=c({},Du,e==null?void 0:e.formatters),s=e==null?void 0:e.filter;return i.forEach(a=>{if((s==null?void 0:s(a))===!1)return;let h=o[a];const g=r[a];g&&(h=g(h,e)),!(a==="v"&&h===1)&&(a=="pr"&&h===1||Au(h)&&(xu(a)&&typeof h=="string"&&(h=new Ga(h)),t[a]=h))}),t}function Za(o,e={}){return o?wu(Lu(o,e),c({whitespace:!1},e)):""}function Ru(o,e={}){const t={};if(!o)return t;const i=Object.entries(o),r=Object.entries(tu).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=i.reduce((a,h)=>{var g,d;const[v,S]=h,M=((g=r.find($=>$[1].includes(v)))===null||g===void 0?void 0:g[0])||On.REQUEST;return(d=a[M])!==null&&d!==void 0||(a[M]={}),a[M][v]=S,a},{});return Object.entries(s).reduce((a,[h,g])=>(a[h]=Za(g,e),a),t)}function ku(o,e,t){return c(o,Ru(e,t))}const Iu="CMCD";function Pu(o,e={}){if(!o)return"";const t=Za(o,e);return`${Iu}=${encodeURIComponent(t)}`}const Xa=/CMCD=[^&#]+/;function Ou(o,e,t){const i=Pu(e,t);if(!i)return o;if(Xa.test(o))return o.replace(Xa,i);const r=o.includes("?")?"&":"?";return`${o}${r}${i}`}class Fu{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:Hi.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=r=>{try{const{frag:s,part:a}=r,h=this.hls.levels[s.level],g=this.getObjectType(s),d={d:(a||s).duration*1e3,ot:g};(g===Hi.VIDEO||g===Hi.AUDIO||g==Hi.MUXED)&&(d.br=h.bitrate/1e3,d.tb=this.getTopBandwidth(g)/1e3,d.bl=this.getBufferLength(g));const v=a?this.getNextPart(a):this.getNextFrag(s);v!=null&&v.url&&v.url!==s.url&&(d.nor=v.url),this.apply(r,d)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(_.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:eu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){c(t,this.createData());const i=t.ot===Hi.INIT||t.ot===Hi.VIDEO||t.ot===Hi.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,h)=>(r.includes(h)&&(a[h]=t[h]),a),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),ku(e.headers,t,s)):e.url=Ou(e.url,t,s)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const r=e.sn-i.startSN;return i.fragments[r+1]}}getNextPart(e){var t,i;const{index:r,fragment:s}=e,a=(t=this.hls.levels[s.level])==null||(i=t.details)==null?void 0:i.partList;if(a){const{sn:h}=s;for(let g=a.length-1;g>=0;g--){const d=a[g];if(d.index===r&&d.fragment.sn===h)return a[g+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Hi.TIMED_TEXT;if(e.sn==="initSegment")return Hi.INIT;if(t==="audio")return Hi.AUDIO;if(t==="main")return this.hls.audioTracks.length?Hi.VIDEO:Hi.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===Hi.AUDIO)i=r.audioTracks;else{const s=r.maxAutoLevel,a=s>-1?s+1:r.levels.length;i=r.levels.slice(0,a)}return i.forEach(s=>{s.bitrate>t&&(t=s.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===Hi.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Lt.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,a,h){t(s),this.loader.load(s,a,h)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,a,h){t(s),this.loader.load(s,a,h)}}}}const Mu=3e5;class Bu 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)===ui.SendAlternateToPenaltyBox&&i.flags===Si.MoveAllAlternatesMatchingHost){const r=this.levels;let s=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:h,pathwayId:g,type:d}=t.context;h&&r?a=this.getPathwayForGroupId(h,d,a):g&&(a=g)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!s&&r&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),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: ${At(s)} penalized: ${At(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(s=>{r-i[s]>Mu&&delete i[s]});for(let s=0;s<e.length;s++){const a=e[s];if(a in i)continue;if(a===this.pathwayId)return;const h=this.hls.nextLoadLevel,g=this.hls.levels[h];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,aa(t),this.hls.trigger(_.LEVELS_UPDATED,{levels:t});const d=this.hls.levels[h];g&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==g.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==g.bitrate&&this.log(`Unstable Pathways change from bitrate ${g.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=h);break}}}getPathwayForGroupId(e,t,i){const r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let s=0;s<r.length;s++)if(t===O.AUDIO_TRACK&&r[s].hasAudioGroup(e)||t===O.SUBTITLE_TRACK&&r[s].hasSubtitleGroup(e))return r[s].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(s=>{const{ID:a,"BASE-ID":h,"URI-REPLACEMENT":g}=s;if(t.some(v=>v.pathwayId===a))return;const d=this.getLevelsForPathway(h).map(v=>{const S=new ei(v.attrs);S["PATHWAY-ID"]=a;const M=S.AUDIO&&`${S.AUDIO}_clone_${a}`,$=S.SUBTITLES&&`${S.SUBTITLES}_clone_${a}`;M&&(i[S.AUDIO]=M,S.AUDIO=M),$&&(r[S.SUBTITLES]=$,S.SUBTITLES=$);const j=Ja(v.uri,S["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",g),Q=new mi({attrs:S,audioCodec:v.audioCodec,bitrate:v.bitrate,height:v.height,name:v.name,url:j,videoCodec:v.videoCodec,width:v.width});if(v.audioGroups)for(let X=1;X<v.audioGroups.length;X++)Q.addGroupId("audio",`${v.audioGroups[X]}_clone_${a}`);if(v.subtitleGroups)for(let X=1;X<v.subtitleGroups.length;X++)Q.addGroupId("text",`${v.subtitleGroups[X]}_clone_${a}`);return Q});t.push(...d),Qa(this.audioTracks,i,g,a),Qa(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(v){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const v=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+v)}const s={responseType:"json",url:r.href},a=t.steeringManifestLoadPolicy.default,h=a.errorRetry||a.timeoutRetry||{},g={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:h.maxNumRetry||0,retryDelay:h.retryDelayMs||0,maxRetryDelay:h.maxRetryDelayMs||0},d={onSuccess:(v,S,M,$)=>{this.log(`Loaded steering manifest: "${r}"`);const j=v.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":X,"PATHWAY-PRIORITY":se}=j;if(Q)try{this.uri=new self.URL(Q,r).href}catch(oe){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${Q}`);return}this.scheduleRefresh(this.uri||M.url),X&&this.clonePathways(X);const ce={steeringManifest:j,url:r.toString()};this.hls.trigger(_.STEERING_MANIFEST_LOADED,ce),se&&this.updatePathwayPriority(se)},onError:(v,S,M,$)=>{if(this.log(`Error loading steering manifest: ${v.code} ${v.text} (${S.url})`),this.stopLoad(),v.code===410){this.enabled=!1,this.log(`Steering manifest ${S.url} no longer available`);return}let j=this.timeToLoad*1e3;if(v.code===429){const Q=this.loader;if(typeof(Q==null?void 0:Q.getResponseHeader)=="function"){const X=Q.getResponseHeader("Retry-After");X&&(j=parseFloat(X)*1e3)}this.log(`Steering manifest ${S.url} rate limited`);return}this.scheduleRefresh(this.uri||S.url,j)},onTimeout:(v,S,M)=>{this.log(`Timeout loading steering manifest (${S.url})`),this.scheduleRefresh(this.uri||S.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(s,g,d)}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 Qa(o,e,t,i){o&&Object.keys(e).forEach(r=>{const s=o.filter(a=>a.groupId===r).map(a=>{const h=c({},a);return h.details=void 0,h.attrs=new ei(h.attrs),h.url=h.attrs.URI=Ja(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),h.groupId=h.attrs["GROUP-ID"]=e[r],h.attrs["PATHWAY-ID"]=i,h});o.push(...s)})}function Ja(o,e,t,i){const{HOST:r,PARAMS:s,[t]:a}=i;let h;e&&(h=a==null?void 0:a[e],h&&(o=h));const g=new self.URL(o);return r&&!h&&(g.host=r),s&&Object.keys(s).sort().forEach(d=>{d&&g.searchParams.set(d,s[d])}),g.href}function Vi(o,e,t){sr(o,e,t),o.addEventListener(e,t)}function sr(o,e,t){o.removeEventListener(e,t)}class cn 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=cn.CDMCleanupPromise?[cn.CDMCleanupPromise]:[],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.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[e];if(r)return r.licenseUrl;if(e===ii.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(a,h,g)=>!!a&&g.indexOf(a)===h,r=t.map(a=>a.audioCodec).filter(i),s=t.map(a=>a.videoCodec).filter(i);return r.length+s.length===0&&s.push("avc1.42e01e"),new Promise((a,h)=>{const g=d=>{const v=d.shift();this.getMediaKeysPromise(v,r,s).then(S=>a({keySystem:v,mediaKeys:S})).catch(S=>{d.length?g(d):S instanceof qi?h(S):h(new qi({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 nn===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){const r=An(e,t,i,this.config.drmSystemOptions),s=this.keySystemAccessPromises[e];let a=s==null?void 0:s.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${At(r)}`),a=this.requestMediaKeySystemAccess(e,r);const h=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(g=>{this.log(`Failed to obtain access to key-system "${e}": ${g}`)}),a.then(g=>{this.log(`Access for key-system "${g.keySystem}" obtained`);const d=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),h.mediaKeys=g.createMediaKeys().then(v=>(this.log(`Media-keys created for "${e}"`),h.hasMediaKeys=!0,d.then(S=>S?this.setMediaKeysServerCertificate(v,e,S):v))),h.mediaKeys.catch(v=>{this.error(`Failed to create media-keys for "${e}"}: ${v}`)}),h.mediaKeys})}return a.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${J.hexDump(e.keyId||[])}`);const r=i.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,s,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return J.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${J.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
} (data length: ${t&&t.byteLength})`),r.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Dr(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 s=Dr(r);s?t(s):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=Er(this.config),i=e.map(Ki).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(i)}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let s=this.keyIdToKeySessionPromise[i];return s||(s=this.getKeySystemForKeyPromise(t).then(({keySystem:h,mediaKeys:g})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(h,g).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:h,mediaKeys:g,decryptdata:t}))))),(this.keyIdToKeySessionPromise[i]=s.then(h=>{const g="cenc",d=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(h,g,d,"playlist-key")})).catch(h=>this.handleError(h))),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof qi?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=Ki(e.keyFormat),s=r?[r]:Er(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Er(this.config)),e.length===0)throw new qi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${At({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(s=>i.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var s,a;const h=(s=this.config.drmSystems)==null||(a=s[e.keySystem])==null?void 0:a.generateRequest;if(h)try{const j=h.call(this.hls,t,i,e);if(!j)throw new Error("Invalid response from configured generateRequest filter");t=j.initDataType,i=j.initData?j.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(j){var g;if(this.warn(j.message),(g=this.hls)!=null&&g.config.debug)throw j}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const d=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${d} (init data type: ${t} length: ${i?i.byteLength:null})`);const v=new ls,S=e._onmessage=j=>{const Q=e.mediaKeysSession;if(!Q){v.emit("error",new Error("invalid state"));return}const{messageType:X,message:se}=j;this.log(`"${X}" message event for session "${Q.sessionId}" message size: ${se.byteLength}`),X==="license-request"||X==="license-renewal"?this.renewLicense(e,se).catch(ce=>{v.eventNames().length?v.emit("error",ce):this.handleError(ce)}):X==="license-release"?e.keySystem===ii.FAIRPLAY&&(this.updateKeySession(e,Ni("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${X}"`)},M=e._onkeystatuseschange=j=>{if(!e.mediaKeysSession){v.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const X=e.keyStatus;v.emit("keyStatus",X),X==="expired"&&(this.warn(`${e.keySystem} expired for key ${d}`),this.renewKeySession(e))};Vi(e.mediaKeysSession,"message",S),Vi(e.mediaKeysSession,"keystatuseschange",M);const $=new Promise((j,Q)=>{v.on("error",Q),v.on("keyStatus",X=>{X.startsWith("usable")?j():X==="output-restricted"?Q(new qi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):X==="internal-error"?Q(new qi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${X}"`)):X==="expired"?Q(new Error("key expired while generating request")):this.warn(`unhandled key status change "${X}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var j;this.log(`Request generated for key-session "${(j=e.mediaKeysSession)==null?void 0:j.sessionId}" keyId: ${d}`)}).catch(j=>{throw new qi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_SESSION,error:j,fatal:!1},`Error generating key-session request: ${j}`)}).then(()=>$).catch(j=>{throw v.removeAllListeners(),this.removeSession(e),j}).then(()=>(v.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{if(typeof i=="string"&&typeof t=="object"){const r=i;i=t,t=r}this.log(`key status change "${t}" for keyStatuses keyId: ${J.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${J.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,h)=>{const g={responseType:"arraybuffer",url:s},d=t.certLoadPolicy.default,v={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(M,$,j,Q)=>{a(M.data)},onError:(M,$,j,Q)=>{h(new qi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:j,response:u({url:g.url,data:void 0},M)},`"${e}" certificate request failed (${s}). Status: ${M.code} (${M.text})`))},onTimeout:(M,$,j)=>{h(new qi({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 (${s})`))},onAbort:(M,$,j)=>{h(new Error("aborted"))}};r.load(g,v,S)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,s)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),r(e)}).catch(a=>{s(new qi({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 qi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},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"),s=r.querySelectorAll("HttpHeader");if(s.length>0){let v;for(let S=0,M=s.length;S<M;S++){var a,h;v=s[S];const $=(a=v.querySelector("name"))==null?void 0:a.textContent,j=(h=v.querySelector("value"))==null?void 0:h.textContent;$&&j&&e.setRequestHeader($,j)}}const g=r.querySelector("Challenge"),d=g==null?void 0:g.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return Ni(atob(d))}setupLicenseXHR(e,t,i,r){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,i,r)}).catch(a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),s.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,s)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(h.readyState===4)if(h.status===200){this._requestLicenseFailureCount=0;let g=h.response;this.log(`License received ${g instanceof ArrayBuffer?g.byteLength:g}`);const d=this.config.licenseResponseCallback;if(d)try{g=d.call(this.hls,h,a,e)}catch(v){this.error(v)}r(g)}else{const g=i.errorRetry,d=g?g.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||h.status>=400&&h.status<500)s(new qi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:h,response:{url:a,data:void 0,code:h.status,text:h.statusText}},`License Request XHR failed (${a}). Status: ${h.status} (${h.statusText})`));else{const v=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${v} attempts left`),this.requestLicense(e,t).then(r,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=h,this.setupLicenseXHR(h,a,e,t).then(({xhr:g,licenseChallenge:d})=>{e.keySystem==ii.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(g,d)),g.send(d)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,Vi(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(sr(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,hi.clearKeyUriToKeyIdMap();const r=i.length;cn.CDMCleanupPromise=Promise.all(i.map(s=>this.removeSession(s)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(s=>{var a;this.log(`Could not clear media keys: ${s}`),(a=this.hls)==null||a.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).catch(s=>{var a;this.log(`Could not close sessions and clear media keys: ${s}`),(a=this.hls)==null||a.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: ${s}`)})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,s)=>(r.indexOf(s.keyFormat)===-1&&r.push(s.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{drmSystemOptions:s}=this.config;return(bt(s)?new Promise((h,g)=>{self.setTimeout(()=>g(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(h)}):Promise.resolve()).catch(h=>{var g;this.log(`Could not remove session: ${h}`),(g=this.hls)==null||g.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${h}`)})}).then(()=>t.close()).catch(h=>{var g;this.log(`Could not close session: ${h}`),(g=this.hls)==null||g.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${h}`)})})}}}cn.CDMCleanupPromise=void 0;class qi extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}class Nu{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 s=r-this.lastTime,a=i-this.lastDroppedFrames,h=t-this.lastDecodedFrames,g=1e3*a/s,d=this.hls;if(d.trigger(_.FPS_DROP,{currentDropped:a,currentDecoded:h,totalDroppedFrames:i}),g>0&&a>d.config.fpsDroppedMonitoringThreshold*h){let v=d.currentLevel;d.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+v),v>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=v)&&(v=v-1,d.trigger(_.FPS_DROP_LEVEL_CAPPING,{level:v,droppedLevel:d.currentLevel}),d.autoLevelCapping=v,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 eo(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 to(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){F.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){F.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(o.mode=t)}function hn(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 Ds(o,e,t,i){const r=o.mode;if(r==="disabled"&&(o.mode="hidden"),o.cues&&o.cues.length>0){const s=Hu(o.cues,e,t);for(let a=0;a<s.length;a++)(!i||i(s[a]))&&o.removeCue(s[a])}r==="disabled"&&(o.mode=r)}function Uu(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,s;for(;i<=r;)if(s=Math.floor((r+i)/2),e<o[s].startTime)r=s-1;else if(e>o[s].startTime&&i<t)i=s+1;else return s;return o[i].startTime-e<e-o[r].startTime?i:r}function Hu(o,e,t){const i=[],r=Uu(o,e);if(r>-1)for(let s=r,a=o.length;s<a;s++){const h=o[s];if(h.startTime>=e&&h.endTime<=t)i.push(h);else if(h.startTime>t)return i}return i}function Yn(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 $u extends Es{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=Yn(this.media.textTracks);for(let s=0;s<i.length;s++)if(i[s].mode==="hidden")t=i[s];else if(i[s].mode==="showing"){t=i[s];break}const 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;Yn(i.textTracks).forEach(a=>{hn(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:s}=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 h=a.details;a.details=t.details,this.log(`Subtitle track ${i} "${a.name}" lang:${a.lang} group:${r} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,h)}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 s=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(v=>!i||i.indexOf(v.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(v=>v.default)&&(this.selectDefaultTrack=!1),a.forEach((v,S)=>{v.id=S});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const h=this.hls.config.subtitlePreference;if(!s&&h){this.selectDefaultTrack=!1;const v=di(h,a);if(v>-1)s=a[v];else{const S=di(h,this.tracks);s=this.tracks[S]}}let g=this.findTrackId(s);g===-1&&s&&(g=this.findTrackId(null));const d={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,d),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 s=t[r];if(!(i&&!s.default||!i&&!e)&&(!e||Ei(s,e)))return r}if(e){for(let r=0;r<t.length;r++){const s=t[r];if(Pn(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const s=t[r];if(Pn(e.attrs,s.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(Ss(r,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===O.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&&Ei(e,i))return i;const r=di(e,this.tracksInGroup);if(r>-1){const s=this.tracksInGroup[r];return this.setSubtitleTrack(r),s}else{if(i)return null;{const s=di(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,r=e.groupId,s=this.getUrlWithDirectives(e.url,t),a=e.details,h=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:""}${h&&a.live?" age "+h.toFixed(1)+(a.type?" "+a.type||0:""):""} ${s}`),this.hls.trigger(_.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Yn(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(s=>Ss(i,s))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==r&&(s.mode="disabled")}),r){const s=this.subtitleDisplay?"showing":"hidden";r.mode!==s&&(r.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!k(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 s=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&s)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:a,groupId:h="",name:g,type:d,url:v}=r;this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:a,groupId:h,name:g,type:d,url:v});const S=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(S)}}function ju(){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 s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?s:s&3|8).toString(16)})}}}function Fn(o){let e=5381,t=o.length;for(;t;)e=e*33^o.charCodeAt(--t);return(e>>>0).toString()}const fn=.025;let Zn=function(o){return o[o.Point=0]="Point",o[o.Range=1]="Range",o}({});function Wu(o,e,t){return`${o.identifier}-${t+1}-${Fn(e)}`}class Gu{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 Ls(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=Ls(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=k(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 Ls(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)<fn))}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"?Zn.Range:Zn.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 Ku(this)}}function Ls(o,e){return o-e.start<e.duration/2&&!(Math.abs(o-(e.start+e.duration))<fn)?e.start:e.start+e.duration}function io(o,e,t){const i=new self.URL(o,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function Rs(o,e){for(;(t=o.assetList[++e])!=null&&t.error;)var t;return e}function Ku(o){return`["${o.identifier}" ${o.cue.pre?"<pre>":o.cue.post?"<post>":""}${o.timelineStart.toFixed(2)}-${o.resumeTime.toFixed(2)}]`}function dn(o){const e=o.timelineStart,t=o.duration||0;return`["${o.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class zu{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.trigger(_.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=i,this.assetItem=r;let a=r.uri;try{a=io(a,t.primarySessionId).href}catch(g){}s.loadSource(a);const h=()=>{this.hasDetails=!0};s.once(_.LEVEL_LOADED,h),s.once(_.AUDIO_TRACK_LOADED,h),s.once(_.SUBTITLE_TRACK_LOADED,h),s.on(_.MEDIA_ATTACHING,(g,{media:d})=>{this.removeMediaListeners(),this.mediaAttached=d,this.interstitial.playoutLimit&&(d.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(_.BUFFER_APPENDED,()=>{const S=this.bufferedEnd;this.reachedPlayout(S)&&(this._bufferedEosTime=S,s.trigger(_.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){var e;return((e=this.interstitial)==null?void 0:e.appendInPlace)||!1}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const i=this.timelineOffset,r=Lt.bufferInfo(e,i,0);return this.getAssetTime(r.end)>=this._bufferedEosTime-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=Lt.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;return e||0}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}resetDetails(){const e=this.hls;if(this.hasDetails){e.stopLoad();const t=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){this.hls.on(e,t)}once(e,t,i){this.hls.once(e,t)}off(e,t,i){this.hls.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${dn(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const ro=.033;class Vu 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&&(s=r[i])!=null&&s.event;){var s;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let r=0;r<i.length;r++){let s=i[r];if(t&&t!=="primary"&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return r}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let r=e;r<=t&&i[r];r++){const s=i[r].event;if(s!=null&&s.restrictions.jump&&!s.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 s=0;s<r;s++){const a=i[s];if(!a.error){const h=a.timelineStart;if(t===h||t>h&&t<h+(a.duration||0))return s}}return 0}get assetIdAtEnd(){var e,t;const i=(e=this.items)==null||(t=e[this.length-1])==null?void 0:t.event;if(i){const r=i.assetList,s=r[r.length-1];if(s)return s.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:r}=i,s=this.events,a=this.parseDateRanges(r,{url:i.url},t),h=Object.keys(r),g=s?s.filter(d=>!h.includes(d.identifier)):[];a.length&&a.sort((d,v)=>{const S=d.cue.pre,M=d.cue.post,$=v.cue.pre,j=v.cue.post;if(S&&!$)return-1;if($&&!S||M&&!j)return 1;if(j&&!M)return-1;if(!S&&!$&&!M&&!j){const Q=d.startTime,X=v.startTime;if(Q!==X)return Q-X}return d.dateRange.tagOrder-v.dateRange.tagOrder}),this.events=a,g.forEach(d=>{this.removeEvent(d)}),this.updateSchedule(e,g)}updateSchedule(e,t=[]){const i=this.events||[];if(i.length||t.length||this.length<2){const r=this.items,s=this.parseSchedule(i,e);(t.length||(r==null?void 0:r.length)!==s.length||s.some((h,g)=>Math.abs(h.playout.start-r[g].playout.start)>.005||Math.abs(h.playout.end-r[g].playout.end)>.005))&&(this.items=s,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,i){const r=[],s=Object.keys(e);for(let a=0;a<s.length;a++){const h=s[a],g=e[h];if(g.isInterstitial){let d=this.eventMap[h];d?d.setDateRange(g):(d=new Gu(g,t),this.eventMap[h]=d,i===!1&&(d.appendInPlace=i)),r.push(d)}}return r}parseSchedule(e,t){const i=[],r=t.main.details,s=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,d=0;if(e.forEach((v,S)=>{const M=v.cue.pre,$=v.cue.post,j=e[S-1]||null,Q=v.appendInPlace,X=$?s:v.startOffset,se=v.duration,ce=v.timelineOccupancy===Zn.Range?se:0,oe=v.resumptionOffset,ve=(j==null?void 0:j.startTime)===X,Ce=X+v.cumulativeDuration;let Ue=Q?Ce+se:X+oe;if(M||!$&&X<=0){const ke=d;d+=ce,v.timelineStart=Ce;const Pe=a;a+=se,i.push({event:v,start:Ce,end:Ue,playout:{start:Pe,end:a},integrated:{start:ke,end:d}})}else if(X<=s){if(!ve){const Se=X-g;if(Se>ro){const Xe=g,ct=d;d+=Se;const Rt=a;a+=Se;const St={previousEvent:e[S-1]||null,nextEvent:v,start:Xe,end:Xe+Se,playout:{start:Rt,end:a},integrated:{start:ct,end:d}};i.push(St)}else Se>0&&j&&(j.cumulativeDuration+=Se,i[i.length-1].end=X)}$&&(Ue=Ce),v.timelineStart=Ce;const ke=d;d+=ce;const Pe=a;a+=se,i.push({event:v,start:Ce,end:Ue,playout:{start:Pe,end:a},integrated:{start:ke,end:d}})}else return;const Ae=v.resumeTime;$||Ae>s?g=s:g=Ae}),g<s){var h;const v=g,S=d,M=s-g;d+=M;const $=a;a+=M,i.push({previousEvent:((h=i[i.length-1])==null?void 0:h.event)||null,nextEvent:null,start:g,end:v+M,playout:{start:$,end:a},integrated:{start:S,end:d}})}this.setDurations(s,a,d)}else i.push({previousEvent:null,nextEvent:null,start:0,end:s,playout:{start:0,end:s},integrated:{start:0,end:s}}),this.setDurations(s,s,s);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,r=i.live?1/0:i.edge;let s=0,a=-1;e.forEach((h,g)=>{const d=h.cue.pre,v=h.cue.post,S=d?0:v?r:h.startTime;this.updateAssetDurations(h),a===S?h.cumulativeDuration=s:(s=0,a=S),!v&&h.snapOptions.in&&(h.resumeAnchor=gi(null,i.fragments,h.startOffset+h.resumptionOffset,0,0)||void 0),h.appendInPlace&&!h.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(h,t)||(h.appendInPlace=!1)),!h.appendInPlace&&g+1<e.length&&e[g+1].startTime-e[g].resumeTime<ro&&(e[g+1].appendInPlace=!1,e[g+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${h}`));const $=k(h.resumeOffset)?h.resumeOffset:h.duration;s+=$})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(i-r)>fn?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${r}`),!1):t?!Object.keys(t).some(a=>{const h=t[a].details,g=h.edge;if(i>=g)return this.log(`"${e.identifier}" resumption ${i} past ${a} playlist end ${g}`),!1;const d=gi(null,h.fragments,i);if(!d)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${a} playlist (${h.fragStart}-${h.fragmentEnd})`),!0;const v=a==="audio"?.175:0;return Math.abs(d.start-i)<fn+v||Math.abs(d.end-i)<fn+v?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${a} fragment bounds (${d.start}-${d.end} sn: ${d.sn} cc: ${d.cc})`),!0)}):(this.log(`"${e.identifier}" resumption ${i} can not be aligned with media (none selected)`),!1)}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,r=!1,s=!1;e.assetList.forEach((a,h)=>{const g=t+i;a.startOffset=i,a.timelineStart=g,r||(r=a.duration===null),s||(s=!!a.error);const d=a.error?0:a.duration||0;i+=d}),r&&!s?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function Ir(o){return`[${o.event?'"'+o.event.identifier+'"':"primary"}: ${o.start.toFixed(2)}-${o.end.toFixed(2)}]`}class qu{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let r;try{r=io(i,this.hls.sessionId,e.baseUrl)}catch(M){const $=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,M,i);this.hls.trigger(_.ERROR,$);return}t&&r.protocol!=="data:"&&r.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,a=s.loader,h=new a(s),g={responseType:"json",url:r.href},d=s.interstitialAssetListLoadPolicy.default,v={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(M,$,j,Q)=>{const X=M.data,se=X==null?void 0:X.ASSETS;if(!Array.isArray(se)){const ce=this.assignAssetListError(e,w.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),j.url,$,Q);this.hls.trigger(_.ERROR,ce);return}e.assetListResponse=X,this.hls.trigger(_.ASSET_LIST_LOADED,{event:e,assetListResponse:X,networkDetails:Q})},onError:(M,$,j,Q)=>{const X=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${M.code} ${M.text} (${$.url})`),$.url,Q,j);this.hls.trigger(_.ERROR,X)},onTimeout:(M,$,j)=>{const Q=this.assignAssetListError(e,w.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${$.url})`),$.url,M,j);this.hls.trigger(_.ERROR,Q)}};return h.load(g,v,S),this.hls.trigger(_.ASSET_LIST_LOADING,{event:e}),h}assignAssetListError(e,t,i,r,s,a){return e.error=i,{type:D.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:i,networkDetails:a,stats:s}}}function no(o){o==null||o.play().catch(()=>{})}class Yu 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)return;const r=i-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const a=r<=-.01;this.timelinePos=i,this.bufferedPos=i;const h=this.playingItem;if(!h){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(i,i-r)&&this.updateSchedule(),this.checkBuffer(),a&&i<h.start||i>=h.end){var g;const M=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(h)&&(g=this.media)!=null&&g.paused&&(this.shouldPlay=!1),!a){const $=this.findItemIndex(h);if(M>$){const j=this.schedule.findJumpRestrictedIndex($+1,M);if(j>$){this.setSchedulePosition(j);return}}}this.setSchedulePosition(M);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(h)){const M=h.event.assetList[0];M&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,M))}return}const v=d.timelineStart,S=d.duration||0;(a&&i<v||i>=v+S)&&this.setScheduleToAssetAtTime(i,d)},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 h=this.findItemIndex(r);this.setSchedulePosition(h+1)}const s=this.playingAsset;if(!s)return;const a=s.timelineStart+(s.duration||0);i>=a&&this.setScheduleToAssetAtTime(i,s)},this.onScheduleUpdate=(i,r)=>{const s=this.schedule,a=this.playingItem,h=s.events||[],g=s.items||[],d=s.durations,v=i.map(j=>j.identifier),S=!!(h.length||v.length);(S||r)&&this.log(`INTERSTITIALS_UPDATED (${h.length}): ${h}
Schedule: ${g.map(j=>Ir(j))} pos: ${this.timelinePos}`),v.length&&this.log(`Removed events ${v}`),this.playerQueue.forEach(j=>{if(j.interstitial.appendInPlace){const Q=j.assetItem.timelineStart,X=j.timelineOffset-Q;if(X)try{j.timelineOffset=Q}catch(se){Math.abs(X)>fn&&this.warn(`${se} ("${j.assetId}" ${j.timelineOffset}->${Q})`)}}});let M=null;if(a){const j=this.updateItem(a,this.timelinePos);this.itemsMatch(a,j)&&(this.playingItem=j,this.waitingItem=this.endedItem=null,M=()=>this.trimInPlace(j,a))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const $=this.bufferingItem;if($){const j=this.updateItem($,this.bufferedPos);this.itemsMatch($,j)?(this.bufferingItem=j,M||(M=()=>this.trimInPlace(j,$))):$.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial($.event,null))}if(i.forEach(j=>{j.assetList.forEach(Q=>{this.clearAssetPlayer(Q.identifier,null)})}),S||r){if(this.hls.trigger(_.INTERSTITIALS_UPDATED,{events:h.slice(0),schedule:g.slice(0),durations:d,removedIds:v}),this.isInterstitial(a)&&v.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}M&&M(),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new qu(e),this.schedule=new Vu(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;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.manager=null,this.hls=this.HlsPlayerClass=this.schedule=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){sr(e,"play",this.onPlay),sr(e,"pause",this.onPause),sr(e,"seeking",this.onSeeking),sr(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;Vi(i,"seeking",this.onSeeking),Vi(i,"timeupdate",this.onTimeupdate),Vi(i,"play",this.onPlay),Vi(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 s=this.findItemIndex(i);this.setSchedulePosition(s)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,r=this.media;if(this.media=null,!i&&(r&&this.removeMediaListeners(r),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=S=>S&&e.getAssetPlayer(S.identifier),r=(S,M,$,j,Q)=>{if(S){let X=S[M].start;const se=S.event;if(se){if(M==="playout"||se.timelineOccupancy!==Zn.Point){const ce=i($);(ce==null?void 0:ce.interstitial)===se&&(X+=ce.assetItem.startOffset+ce[Q])}}else{const ce=j==="bufferedPos"?a():e[j];X+=ce-S.start}return X}return 0},s=(S,M)=>{if(S!==0&&M!=="primary"&&e.schedule.length){var $;const j=e.schedule.findItemIndexAtTime(S),Q=($=e.schedule.items)==null?void 0:$[j];if(Q){const X=Q[M].start-Q.start;return S+X}}return S},a=()=>{const S=e.bufferedPos;return S===Number.MAX_VALUE?h("primary"):Math.max(S,0)},h=S=>{var M;return(M=e.primaryDetails)!=null&&M.live?e.primaryDetails.edge:e.schedule.durations[S]},g=(S,M)=>{var $,j;const Q=e.effectivePlayingItem;if(Q!=null&&($=Q.event)!=null&&$.restrictions.skip)return;e.log(`seek to ${S} "${M}"`);const X=e.effectivePlayingItem,se=e.schedule.findItemIndexAtTime(S,M),ce=(j=e.schedule.items)==null?void 0:j[se],oe=e.getBufferingPlayer(),ve=oe==null?void 0:oe.interstitial,Ce=ve==null?void 0:ve.appendInPlace,Ue=X&&e.itemsMatch(X,ce);if(X&&(Ce||Ue)){const ke=i(e.playingAsset),Pe=(ke==null?void 0:ke.media)||e.primaryMedia;if(Pe){const Se=M==="primary"?Pe.currentTime:r(X,M,e.playingAsset,"timelinePos","currentTime"),Xe=S-Se,ct=(Ce?Se:Pe.currentTime)+Xe;if(ct>=0&&(!ke||Ce||ct<=ke.duration)){Pe.currentTime=ct;return}}}if(ce){let ke=S;if(M!=="primary"){const Se=ce[M].start,Xe=S-Se;ke=ce.start+Xe}const Pe=!e.isInterstitial(ce);if((!e.isInterstitial(X)||X.event.appendInPlace)&&(Pe||ce.event.appendInPlace)){const Se=e.media||(Ce?oe==null?void 0:oe.media:null);Se&&(Se.currentTime=ke)}else if(X){const Se=e.findItemIndex(X);if(se>Se){const ct=e.schedule.findJumpRestrictedIndex(Se+1,se);if(ct>Se){e.setSchedulePosition(ct);return}}let Xe=0;if(Pe)e.timelinePos=ke,e.checkBuffer();else{var Ae;const ct=ce==null||(Ae=ce.event)==null?void 0:Ae.assetList;if(ct){const Rt=S-(ce[M]||ce).start;for(let St=ct.length;St--;){const Et=ct[St];if(Et.duration&&Rt>=Et.startOffset&&Rt<Et.startOffset+Et.duration){Xe=St;break}}}}e.setSchedulePosition(se,Xe)}}},d=()=>{const S=e.effectivePlayingItem;if(e.isInterstitial(S))return S;const M=t();return e.isInterstitial(M)?M:null},v={get currentTime(){const S=d(),M=e.effectivePlayingItem;return M&&M===S?r(M,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-M.playout.start:0},set currentTime(S){const M=d(),$=e.effectivePlayingItem;$&&$===M&&g(S+$.playout.start,"playout")},get duration(){const S=d();return S?S.playout.end-S.playout.start:0},get assetPlayers(){var S;const M=(S=d())==null?void 0:S.event.assetList;return M?M.map($=>e.getAssetPlayer($.identifier)):[]},get playingIndex(){var S;const M=(S=d())==null?void 0:S.event;return M&&e.effectivePlayingAsset?M.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return d()}};this.manager={get events(){var S,M;return((S=e.schedule)==null||(M=S.events)==null?void 0:M.slice(0))||[]},get schedule(){var S,M;return((S=e.schedule)==null||(M=S.items)==null?void 0:M.slice(0))||[]},get interstitialPlayer(){return d()?v: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 h("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 h("integrated")},get seekableStart(){var S;return s(((S=e.primaryDetails)==null?void 0:S.fragmentStart)||0,"integrated")}},skip:()=>{const S=e.effectivePlayingItem,M=S==null?void 0:S.event;if(M&&!M.restrictions.skip){const $=e.findItemIndex(S);if(M.appendInPlace){const j=S.playout.start+S.event.duration;g(j+.001,"playout")}else e.advanceAfterAssetEnded(M,$,1/0)}}}}return this.manager}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t,i;if(this.mediaSelection===null)return;const r=this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&!r.event.appendInPlace)return;let s=this.media;!s&&(e=this.bufferingItem)!=null&&(t=e.event)!=null&&t.appendInPlace&&(s=this.primaryMedia);const a=(i=s)==null?void 0:i.currentTime;if(!(a===void 0||!k(a)))return a}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 s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${At(s)}`),this.detachedData=s}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var i,r;if(e.media===t)return;let s=null;const a=this.hls,h=e!==a,g=h&&e.interstitial.appendInPlace,d=(i=this.detachedData)==null?void 0:i.mediaSource;let v;if(a.media)g&&(s=a.transferMedia(),this.detachedData=s),v="Primary";else if(d){const $=this.getBufferingPlayer();$?(s=$.transferMedia(),v=`${$}`):v="detached MediaSource"}else v="detached media";if(!s){if(d)s=this.detachedData,this.log(`using detachedData: MediaSource ${At(s)}`);else if(!this.detachedData||a.media===t){const $=this.playerQueue;$.length>1&&$.forEach(j=>{if(h&&j.interstitial.appendInPlace!==g){const Q=j.interstitial;this.clearInterstitial(j.interstitial,null),Q.appendInPlace=!1,Q.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${Q}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const S=s&&"mediaSource"in s&&((r=s.mediaSource)==null?void 0:r.readyState)!=="closed",M=S&&s?s:t;if(this.log(`${S?"transfering MediaSource":"attaching media"} to ${h?e:"Primary"} from ${v}`),M===s){const $=h&&e.assetId===this.schedule.assetIdAtEnd;M.overrides={duration:this.schedule.duration,endOfStream:!h||$,cueRemoval:!h}}e.attachMedia(M)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,r=this.effectivePlayingItem;if(i===-1){const s=this.hls.startPosition;if(this.timelinePos=s,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(s>=0||!this.primaryLive){const a=this.timelinePos=s>0?s:0,h=e.findItemIndexAtTime(a);this.setSchedulePosition(h)}}else if(r&&!this.playingItem){const s=e.findItemIndex(r);this.setSchedulePosition(s)}}advanceAfterAssetEnded(e,t,i){const r=Rs(e,i);if(!e.isAssetPastPlayoutLimit(r))this.setSchedulePosition(t,r);else{const s=this.schedule.items;if(s){const a=t+1,h=s.length;if(a>=h){this.setSchedulePosition(-1);return}const g=e.resumeTime;this.timelinePos<g&&(this.timelinePos=g,this.checkBuffer()),this.setSchedulePosition(a)}}}setScheduleToAssetAtTime(e,t){const i=this.schedule,r=t.parentIdentifier,s=i.getEvent(r);if(s){const a=i.findEventIndex(r),h=i.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,a,h-1)}}setSchedulePosition(e,t){const i=this.schedule.items;if(!i||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${t}`);const r=e>=0?i[e]:null,s=this.playingItem,a=this.playingLastItem;if(this.isInterstitial(s)){var h;const d=s.event,v=this.playingAsset,S=v==null?void 0:v.identifier,M=S?this.getAssetPlayer(S):null;if(M&&S&&(!this.eventItemsMatch(s,r)||t!==void 0&&S!==((h=d.assetList)==null?void 0:h[t].identifier))){var g;const $=d.findAssetIndex(v);if(this.log(`INTERSTITIAL_ASSET_ENDED ${$+1}/${d.assetList.length} ${dn(v)}`),this.endedAsset=v,this.playingAsset=null,this.hls.trigger(_.INTERSTITIAL_ASSET_ENDED,{asset:v,assetListIndex:$,event:d,schedule:i.slice(0),scheduleIndex:e,player:M}),s!==this.playingItem){this.itemsMatch(s,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(d,this.findItemIndex(this.playingItem),$);return}this.retreiveMediaSource(S,r),M.media&&!((g=this.detachedData)!=null&&g.mediaSource)&&M.detachMedia()}if(!this.eventItemsMatch(s,r)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${d} ${Ir(s)}`),d.hasPlayed=!0,this.hls.trigger(_.INTERSTITIAL_ENDED,{event:d,schedule:i.slice(0),scheduleIndex:e}),d.cue.once)){this.updateSchedule();const $=this.schedule.items;if(r&&$){const j=this.findItemIndex(r);this.advanceSchedule(j,$,t,s,a)}return}}this.advanceSchedule(e,i,t,s,a)}advanceSchedule(e,t,i,r,s){const a=e>=0?t[e]:null,h=this.primaryMedia,g=this.playerQueue;if(g.length&&g.forEach(d=>{const v=d.interstitial,S=this.schedule.findEventIndex(v.identifier);(S<e||S>e+1)&&this.clearInterstitial(v,a)}),this.isInterstitial(a)){this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);const d=a.event;if(i===void 0){i=this.schedule.findAssetIndex(d,this.timelinePos);const $=Rs(d,i-1);if(d.isAssetPastPlayoutLimit($)){this.advanceAfterAssetEnded(d,e,i);return}i=$}const v=this.waitingItem;this.assetsBuffered(a,h)||this.setBufferingItem(a);let S=this.preloadAssets(d,i);if(this.eventItemsMatch(a,v||r)||(this.waitingItem=a,this.log(`INTERSTITIAL_STARTED ${Ir(a)} ${d.appendInPlace?"append in place":""}`),this.hls.trigger(_.INTERSTITIAL_STARTED,{event:d,schedule:t.slice(0),scheduleIndex:e})),!d.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${d}`);return}if(d.assetListLoader&&(d.assetListLoader.destroy(),d.assetListLoader=void 0),!h){this.log(`Waiting for attachMedia to start Interstitial ${d}`);return}this.waitingItem=this.endedItem=null,this.playingItem=a;const M=d.assetList[i];if(!M){const $=t[e+1],j=this.media;$&&j&&!this.isInterstitial($)&&j.currentTime<$.start&&(j.currentTime=this.timelinePos=$.start),this.advanceAfterAssetEnded(d,e,i||0);return}if(S||(S=this.getAssetPlayer(M.identifier)),S===null||S.destroyed){const $=d.assetList.length;this.warn(`asset ${i+1}/${$} player destroyed ${d}`),S=this.createAssetPlayer(d,M,i)}if(!this.eventItemsMatch(a,this.bufferingItem)&&d.appendInPlace&&this.isAssetBuffered(M))return;this.startAssetPlayer(S,i,t,e,h),this.shouldPlay&&no(S.media)}else a!==null?(this.resumePrimary(a,e,r),this.shouldPlay&&no(this.hls.media)):s&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e,t;return(e=this.mediaSelection)==null||(t=e.main)==null?void 0:t.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Ir(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let a=this.timelinePos;(a<e.start||a>=e.end)&&(a=this.getPrimaryResumption(e,t),this.timelinePos=a),this.attachPrimary(a,e)}if(!i)return;const s=this.schedule.items;s&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Ir(e)}`),this.hls.trigger(_.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.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:Lt.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 s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,r),i&&this.startLoadingPrimaryAt(e,i)),i||(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(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(_.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(_.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1)return;const i=this.hls.levels[t.level],r=u(u({},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=u(u({},this.altSelection),{},{audio:i});return}const s=u(u({},r),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=u(u({},this.altSelection),{},{subtitles:i});return}const s=u(u({},r),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=bi(t);this.playerQueue.forEach(r=>r.hls.setAudioOption(t)||r.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,t){const i=bi(t);this.playerQueue.forEach(r=>r.hls.setSubtitleOption(t)||t.id!==-1&&r.hls.setSubtitleOption(i))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let r=0;r<t.length;r++){const s=t[r];if(s.cue.post){var i;const a=this.schedule.findEventIndex(s.identifier),h=(i=this.schedule.items)==null?void 0:i[a];this.isInterstitial(h)&&this.eventItemsMatch(h,this.bufferingItem)&&this.bufferedToItem(h,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){const i=this.schedule.items;if(e&&i){const r=this.findItemIndex(e,t);return i[r]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((s,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(s.identifier,null)});const i=e.end+.25,r=Lt.bufferInfo(this.primaryMedia,i,0);(r.end>i||(r.nextStart||0)>i)&&(this.attachPrimary(i,null),this.flushFrontBuffer(i))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e?this.schedule.findItemIndex(e,t):-1}updateSchedule(){const e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}checkBuffer(e){const t=this.schedule.items;if(!t)return;const i=Lt.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,t,e)}updateBufferedPos(e,t,i){const r=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const a=this.playingItem,h=this.findItemIndex(a);let g=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var d,v;const S=this.findItemIndex(s),M=Math.min(S+1,t.length-1),$=t[M];if((g===-1&&s&&e>=s.end||(d=$.event)!=null&&d.appendInPlace&&e+.01>=$.start)&&(g=M),M-h>1&&(s==null||(v=s.event)==null?void 0:v.appendInPlace)===!1)return;if(this.bufferedPos=e,g>S&&g>h)this.bufferedToItem($);else{const j=this.primaryDetails;this.primaryLive&&j&&e>j.edge-j.targetduration&&$.start<j.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial($)&&this.preloadAssets($.event,0)}}else i&&a&&!this.itemsMatch(a,s)&&(g===h?this.bufferedToItem(a):g===h+1&&this.bufferedToItem(t[g]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(r=>{const s=this.getAssetPlayer(r.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(this.itemsMatch(e,t))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:r,events:s}=i;if(!r||!s)return t;const a=this.isInterstitial(e),h=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const g=h?h.remaining:t?t.end-this.timelinePos:0;this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Ir(e)}`+(t?` (${g.toFixed(2)} remaining)`:"")),this.playbackDisabled||(a?e.event.assetList.forEach(d=>{const v=this.getAssetPlayer(d.identifier);v&&v.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering()))),this.hls.trigger(_.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const 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,s=i.cue.once;if(r||!s){const a=this.preloadAssets(i,t);if(a!=null&&a.interstitial.appendInPlace){const h=i.assetList[t],g=this.primaryMedia;h&&g&&this.bufferAssetPlayer(a,g)}}}preloadAssets(e,t){const i=e.assetUrl,r=e.assetList.length,s=r===0&&!e.assetListLoader,a=e.cue.once;if(s){const g=e.timelineStart;if(e.appendInPlace){var h;const M=this.playingItem;!this.isInterstitial(M)&&(M==null||(h=M.nextEvent)==null?void 0:h.identifier)===e.identifier&&this.flushFrontBuffer(g+.25)}let d,v=0;if(!this.playingItem&&this.primaryLive&&(v=this.hls.startPosition,v===-1&&(v=this.hls.liveSyncPosition||0)),v&&!(e.cue.pre||e.cue.post)){const M=v-g;M>0&&(d=Math.round(M*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:r} ${e}${d?` live-start: ${v} start-offset: ${d}`:""}`),i)return this.createAsset(e,0,0,g,e.duration,i);const S=this.assetListLoader.loadAssetList(e,d);S&&(e.assetListLoader=S)}else if(!a&&r){for(let g=t;g<r;g++){const d=e.assetList[g],v=this.getAssetPlayerQueueIndex(d.identifier);(v===-1||this.playerQueue[v].destroyed)&&!d.error&&this.createAssetPlayer(e,d,g)}return this.getAssetPlayer(e.assetList[t].identifier)}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(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,s,a){const h={parentIdentifier:e.identifier,identifier:Wu(e,a,t),duration:s,startOffset:i,timelineStart:r,uri:a};return this.createAssetPlayer(e,h,t)}createAssetPlayer(e,t,i){const r=this.hls,s=r.userConfig;let a=s.videoPreference;const h=r.loadLevelObj||r.levels[r.currentLevel];(a||h)&&(a=c({},a),h.videoCodec&&(a.videoCodec=h.videoCodec),h.videoRange&&(a.allowedVideoRanges=[h.videoRange]));const g=r.audioTracks[r.audioTrack],d=r.subtitleTracks[r.subtitleTrack];let v=0;if(this.primaryLive||e.appendInPlace){const oe=this.timelinePos-t.timelineStart;if(oe>1){const ve=t.duration;ve&&oe<ve&&(v=oe)}}const S=t.identifier,M=u(u({},s),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:S,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:v,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:g||s.audioPreference,subtitlePreference:d||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(M.timelineOffset=t.timelineStart));const $=M.cmcd;$!=null&&$.sessionId&&$.contentId&&(M.cmcd=c({},$,{contentId:Fn(t.uri)})),this.getAssetPlayer(S)&&this.warn(`Duplicate date range identifier ${e} and asset ${S}`);const j=new zu(this.HlsPlayerClass,M,e,t);this.playerQueue.push(j),e.assetList[i]=t;const Q=oe=>{if(oe.live){const Ue=new Error(`Interstitials MUST be VOD assets ${e}`),Ae={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ue};this.handleAssetItemError(Ae,e,this.schedule.findEventIndex(e.identifier),i,Ue.message);return}const ve=oe.edge-oe.fragmentStart,Ce=t.duration;(Ce===null||ve>Ce)&&(this.log(`Interstitial asset "${S}" duration change ${Ce} > ${ve}`),t.duration=ve,this.updateSchedule())};j.on(_.LEVEL_UPDATED,(oe,{details:ve})=>Q(ve)),j.on(_.LEVEL_PTS_UPDATED,(oe,{details:ve})=>Q(ve));const X=(oe,ve)=>{const Ce=this.getAssetPlayer(S);if(Ce&&ve.tracks){Ce.off(_.BUFFER_CODECS,X),Ce.tracks=ve.tracks;const Ue=this.primaryMedia;this.bufferingAsset===Ce.assetItem&&Ue&&!Ce.media&&this.bufferAssetPlayer(Ce,Ue)}};j.on(_.BUFFER_CODECS,X);const se=()=>{var oe;const ve=this.getAssetPlayer(S);if(this.log(`buffered to end of asset ${ve}`),!ve)return;const Ce=this.schedule.findEventIndex(e.identifier),Ue=(oe=this.schedule.items)==null?void 0:oe[Ce];if(this.isInterstitial(Ue)){const ke=e.findAssetIndex(t),Pe=Rs(e,ke);if(!e.isAssetPastPlayoutLimit(Pe))this.bufferedToItem(Ue,Pe);else{var Ae;const Se=(Ae=this.schedule.items)==null?void 0:Ae[Ce+1];Se&&this.bufferedToItem(Se)}}};j.on(_.BUFFERED_TO_END,se);const ce=oe=>()=>{if(!this.getAssetPlayer(S))return;this.shouldPlay=!0;const Ce=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,Ce,oe)};return j.once(_.MEDIA_ENDED,ce(i)),j.once(_.PLAYOUT_LIMIT_REACHED,ce(1/0)),j.on(_.ERROR,(oe,ve)=>{const Ce=this.getAssetPlayer(S);if(ve.details===w.BUFFER_STALLED_ERROR){if(Ce!=null&&Ce.media){const Ue=Ce.currentTime,Ae=Ce.duration-Ue;Ue&&e.appendInPlace&&Ae/Ce.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${S} ${e} at ${Ce.media.currentTime}`),se()):(this.warn(`Stalled at ${Ue} of ${Ue+Ae} in asset ${S} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(ve,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${ve.error} ${e}`)}),j.on(_.DESTROYING,()=>{if(!this.getAssetPlayer(S))return;const ve=new Error(`Asset player destroyed unexpectedly ${S}`),Ce={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:ve};this.handleAssetItemError(Ce,e,this.schedule.findEventIndex(e.identifier),i,ve.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${dn(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){this.log(`clear asset player "${e}" toSegment: ${t&&Ir(t)}`);const r=this.playerQueue[i];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,s){const{interstitial:a,assetItem:h,assetId:g}=e,d=a.assetList.length,v=this.playingAsset;this.endedAsset=null,this.playingAsset=h,(!v||v.identifier!==g)&&(v&&(this.clearAssetPlayer(v.identifier,i[r]),delete v.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${d} ${dn(h)}`),this.hls.trigger(_.INTERSTITIAL_ASSET_STARTED,{asset:h,assetListIndex:t,event:a,schedule:i.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var i,r;const{interstitial:s,assetItem:a}=e,h=this.schedule.findEventIndex(s.identifier),g=(i=this.schedule.items)==null?void 0:i[h];if(!g)return;this.setBufferingItem(g),this.bufferingAsset=a;const d=this.getBufferingPlayer();if(d===e)return;const v=s.appendInPlace;if(v&&(d==null?void 0:d.interstitial.appendInPlace)===!1)return;const S=(d==null?void 0:d.tracks)||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(v&&a!==this.playingAsset){if(!e.tracks)return;if(S&&!ne(S,e.tracks)){const M=new Error(`Asset ${dn(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(S)}')`),$={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:M},j=s.findAssetIndex(a);this.handleAssetItemError($,s,h,j,M.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,r,s){if(e.details===w.BUFFER_STALLED_ERROR)return;const a=t.assetList[r];this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&dn(a)} ${e.error}`);const h=a==null?void 0:a.identifier,g=this.getAssetPlayerQueueIndex(h),d=this.playerQueue[g]||null,v=this.schedule.items,S=c({},e,{fatal:!1,errorAction:lr(!0),asset:a,assetListIndex:r,event:t,schedule:v,scheduleIndex:i,player:d});if(this.hls.trigger(_.INTERSTITIAL_ASSET_ERROR,S),!e.fatal)return;const M=this.playingAsset,$=new Error(s);if(a&&(this.clearAssetPlayer(h,null),a.error=$),!t.assetList.some(j=>!j.error))t.error=$;else{for(let j=r;j<t.assetList.length;j++)this.resetAssetPlayer(t.assetList[j].identifier);this.updateSchedule()}t.error?this.primaryFallback(t):M&&M.identifier===h&&this.advanceAfterAssetEnded(t,i,r)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(this.updateSchedule(),i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${i?Ir(i):"<none>"} error: ${e.error}`);let r=this.timelinePos;r===-1&&(r=this.hls.startPosition);const s=this.updateItem(i,r);this.itemsMatch(i,s)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));const a=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(a)}else this.checkStart()}onAssetListLoaded(e,t){var i;const r=t.event,s=r.identifier,a=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(s))return;const h=r.timelineStart,g=r.duration;let d=0;a.forEach((j,Q)=>{const X=parseFloat(j.DURATION);this.createAsset(r,Q,d,h+d,X,j.URI),d+=X}),r.duration=d,this.log(`Loaded asset-list with duration: ${d} (was: ${g}) ${r}`);const v=this.waitingItem,S=(v==null?void 0:v.event.identifier)===s;this.updateSchedule();const M=(i=this.bufferingItem)==null?void 0:i.event;if(S){var $;const j=this.schedule.findEventIndex(s),Q=($=this.schedule.items)==null?void 0:$[j];if(Q){if(!this.playingItem&&this.timelinePos>Q.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==j){r.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${r}`),this.primaryFallback(r);return}this.setBufferingItem(Q)}this.setSchedulePosition(j)}else if((M==null?void 0:M.identifier)===s&&M.appendInPlace){const j=r.assetList[0],Q=this.getAssetPlayer(j.identifier),X=this.primaryMedia;j&&Q&&X&&this.bufferAssetPlayer(Q,X)}}onError(e,t){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.primaryFallback(i);break}case w.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const so=500;class Zu extends as{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",m.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=Ve.IDLE,this.setInterval(so),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)||(_e(i)&&(this.fragPrevious=i),this.state=Ve.IDLE),!r)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let a;const h=i.start;for(let d=0;d<s.length;d++)if(h>=s[d].start&&h<=s[d].end){a=s[d];break}const g=i.start+i.duration;a?a.end=g:(a={start:h,end:g},s.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 s=r-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(a=>{for(let h=0;h<a.length;){if(a[h].end<=s){a.shift();continue}else if(a[h].start<s)a[h].start=s;else break;h++}}),this.fragmentTracker.removeFragmentsInRange(i,s,m.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===m.SUBTITLE&&(t.details===w.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ve.STOPPED&&(this.state=Ve.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Ha(this.levels,t)){this.levels=t.map(i=>new mi(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new mi(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,m.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!==Ve.STOPPED&&this.setInterval(so)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:r,levels:s}=this,{details:a,id:h}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${h}`);return}const g=s[h];if(h>=s.length||!g)return;this.log(`Subtitle track ${h} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let d=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 M=S.fragments[0];if(!g.details)a.hasProgramDateTime&&S.hasProgramDateTime?(Un(a,S),d=a.fragmentStart):M&&(d=M.start,ss(a,d));else{var v;d=this.alignPlaylists(a,g.details,(v=this.levelLastLoaded)==null?void 0:v.details),d===0&&M&&(d=M.start,ss(a,d))}S&&!this.startFragRequested&&this.setStartPosition(S,d)}g.details=a,this.levelLastLoaded=g,h===r&&(this.hls.trigger(_.SUBTITLE_TRACK_UPDATED,{details:a,id:h,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===Ve.IDLE&&(gi(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,s=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r!=null&&r.key&&r.iv&&cr(r.method)){const a=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer,jr(r.method)).catch(h=>{throw s.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:h,reason:h.message,frag:t}),h}).then(h=>{const g=performance.now();s.trigger(_.FRAG_DECRYPTED,{frag:t,payload:h,stats:{tstart:a,tdecrypt:g}})}).catch(h=>{this.warn(`${h.name}: ${h.message}`),this.state=Ve.IDLE})}}doTick(){if(!this.media){this.state=Ve.IDLE;return}if(this.state===Ve.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,s=this.getLoadPosition(),a=Lt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,r.maxBufferHole),{end:h,len:g}=a,d=i.details,v=this.hls.maxBufferLength+d.levelTargetDuration;if(g>v)return;const S=d.fragments,M=S.length,$=d.edge;let j=null;const Q=this.fragPrevious;if(h<$){const ce=r.maxFragLookUpTolerance,oe=h>$-ce?0:ce;j=gi(Q,S,Math.max(S[0].start,h),oe),!j&&Q&&Q.start<S[0].start&&(j=S[0])}else j=S[M-1];if(j=this.filterReplacedPrimary(j,i.details),!j)return;const X=j.sn-d.startSN,se=S[X-1];if(se&&se.cc===j.cc&&this.fragmentTracker.getState(se)===ai.NOT_LOADED&&(j=se),this.fragmentTracker.getState(j)===ai.NOT_LOADED){const ce=this.mapToInitFragWhenRequired(j);ce&&this.loadFragment(ce,i,h)}}}loadFragment(e,t,i){_e(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Xu(this.tracksBuffered[this.currentTrackId]||[])}}class Xu{constructor(e){this.buffered=void 0;const t=(i,r,s)=>{if(r=r>>>0,r>s-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${s})`);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 Qu={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},ao=o=>String.fromCharCode(Qu[o]||o),ar=15,xr=100,Ju={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},ec={17:2,18:4,21:6,22:8,23:10,19:13,20:15},tc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ic={25:2,26:4,29:6,30:8,31:10,27:13,28:15},rc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class nc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;F.log(`${this.time} [${e}] ${i}`)}}}const Kr=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class oo{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 sc{constructor(){this.uchar=" ",this.penState=new oo}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class ac{constructor(e){this.chars=[],this.pos=0,this.currPenState=new oo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<xr;t++)this.chars.push(new sc);this.logger=e}equals(e){for(let t=0;t<xr;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<xr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<xr;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>xr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=xr)}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>=xr){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<xr;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<xr;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 ks{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 ac(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 = "+At(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let h=0;h<ar;h++)this.rows[h].clear();const s=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const h=a.rows[s].cueStartTime,g=this.logger.time;if(h!==null&&g!==null&&h<g)for(let d=0;d<this.nrRollUpRows;d++)this.rows[t-this.nrRollUpRows+d+1].copy(a.rows[s+d])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,a=Math.max(s-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 = "+At(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 s=0;s<ar;s++){const a=this.rows[s].getTextString();a&&(r=s+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 lo{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 ks(i),this.nonDisplayedMemory=new ks(i),this.lastOutputScreen=new ks(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: "+At(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 uo{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=lc(),this.logger=void 0;const r=this.logger=new nc;this.channels=[null,new lo(e,t,r),new lo(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,s=t[i+1]&127;let a=!1,h=null;if(r===0&&s===0)continue;this.logger.log(3,()=>"["+Kr([t[i],t[i+1]])+"] -> ("+Kr([r,s])+")");const g=this.cmdHistory;if(r>=16&&r<=31){if(oc(r,s,g)){Xn(null,null,g),this.logger.log(3,()=>"Repeated command ("+Kr([r,s])+") is dropped");continue}Xn(r,s,this.cmdHistory),a=this.parseCmd(r,s),a||(a=this.parseMidrow(r,s)),a||(a=this.parsePAC(r,s)),a||(a=this.parseBackgroundAttributes(r,s))}else Xn(null,null,g);if(!a&&(h=this.parseChars(r,s),h)){const v=this.currentChannel;v&&v>0?this.channels[v].insertChars(h):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!h&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Kr([r,s])+" orig: "+Kr([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 s=e===20||e===21||e===23?1:2,a=this.channels[s];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=s,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Kr([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,s=(e===16||e===24)&&t>=64&&t<=95;if(!(r||s))return!1;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?Ju[e]:tc[e]:i=a===1?ec[e]:ic[e];const h=this.channels[a];return h?(h.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,s=null;if(e>=25?(i=2,s=e-8):(i=1,s=e),s>=17&&s<=19){let a;s===17?a=t+80:s===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 = "+Kr(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 s;const a={};e===16||e===24?(s=Math.floor((t-32)/2),a.background=rc[s],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const h=e<=23?1:2;return this.channels[h].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Xn(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 Xn(o,e,t){t.a=o,t.b=e}function oc(o,e,t){return t.a===o&&t.b===e}function lc(){return{a:null,b:null}}var Is=function(){if(nr!=null&&nr.VTTCue)return self.VTTCue;const o=["","lr","rl"],e=["start","middle","end","left","right"];function t(h,g){if(typeof g!="string"||!Array.isArray(h))return!1;const d=g.toLowerCase();return~h.indexOf(d)?d:!1}function i(h){return t(o,h)}function r(h){return t(e,h)}function s(h,...g){let d=1;for(;d<arguments.length;d++){const v=arguments[d];for(const S in v)h[S]=v[S]}return h}function a(h,g,d){const v=this,S={enumerable:!0};v.hasBeenReset=!1;let M="",$=!1,j=h,Q=g,X=d,se=null,ce="",oe=!0,ve="auto",Ce="start",Ue=50,Ae="middle",ke=50,Pe="middle";Object.defineProperty(v,"id",s({},S,{get:function(){return M},set:function(Se){M=""+Se}})),Object.defineProperty(v,"pauseOnExit",s({},S,{get:function(){return $},set:function(Se){$=!!Se}})),Object.defineProperty(v,"startTime",s({},S,{get:function(){return j},set:function(Se){if(typeof Se!="number")throw new TypeError("Start time must be set to a number.");j=Se,this.hasBeenReset=!0}})),Object.defineProperty(v,"endTime",s({},S,{get:function(){return Q},set:function(Se){if(typeof Se!="number")throw new TypeError("End time must be set to a number.");Q=Se,this.hasBeenReset=!0}})),Object.defineProperty(v,"text",s({},S,{get:function(){return X},set:function(Se){X=""+Se,this.hasBeenReset=!0}})),Object.defineProperty(v,"region",s({},S,{get:function(){return se},set:function(Se){se=Se,this.hasBeenReset=!0}})),Object.defineProperty(v,"vertical",s({},S,{get:function(){return ce},set:function(Se){const Xe=i(Se);if(Xe===!1)throw new SyntaxError("An invalid or illegal string was specified.");ce=Xe,this.hasBeenReset=!0}})),Object.defineProperty(v,"snapToLines",s({},S,{get:function(){return oe},set:function(Se){oe=!!Se,this.hasBeenReset=!0}})),Object.defineProperty(v,"line",s({},S,{get:function(){return ve},set:function(Se){if(typeof Se!="number"&&Se!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");ve=Se,this.hasBeenReset=!0}})),Object.defineProperty(v,"lineAlign",s({},S,{get:function(){return Ce},set:function(Se){const Xe=r(Se);if(!Xe)throw new SyntaxError("An invalid or illegal string was specified.");Ce=Xe,this.hasBeenReset=!0}})),Object.defineProperty(v,"position",s({},S,{get:function(){return Ue},set:function(Se){if(Se<0||Se>100)throw new Error("Position must be between 0 and 100.");Ue=Se,this.hasBeenReset=!0}})),Object.defineProperty(v,"positionAlign",s({},S,{get:function(){return Ae},set:function(Se){const Xe=r(Se);if(!Xe)throw new SyntaxError("An invalid or illegal string was specified.");Ae=Xe,this.hasBeenReset=!0}})),Object.defineProperty(v,"size",s({},S,{get:function(){return ke},set:function(Se){if(Se<0||Se>100)throw new Error("Size must be between 0 and 100.");ke=Se,this.hasBeenReset=!0}})),Object.defineProperty(v,"align",s({},S,{get:function(){return Pe},set:function(Se){const Xe=r(Se);if(!Xe)throw new SyntaxError("An invalid or illegal string was specified.");Pe=Xe,this.hasBeenReset=!0}})),v.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class uc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function co(o){function e(i,r,s,a){return(i|0)*3600+(r|0)*60+(s|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 cc{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let 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 ho(o,e,t,i){const r=i?o.split(i):[o];for(const s in r){if(typeof r[s]!="string")continue;const a=r[s].split(t);if(a.length!==2)continue;const h=a[0],g=a[1];e(h,g)}}const Ps=new Is(0,0,""),Qn=Ps.align==="middle"?"middle":"center";function hc(o,e,t){const i=o;function r(){const h=co(o);if(h===null)throw new Error("Malformed timestamp: "+i);return o=o.replace(/^[^\sa-zA-Z-]+/,""),h}function s(h,g){const d=new cc;ho(h,function(M,$){let j;switch(M){case"region":for(let Q=t.length-1;Q>=0;Q--)if(t[Q].id===$){d.set(M,t[Q].region);break}break;case"vertical":d.alt(M,$,["rl","lr"]);break;case"line":j=$.split(","),d.integer(M,j[0]),d.percent(M,j[0])&&d.set("snapToLines",!1),d.alt(M,j[0],["auto"]),j.length===2&&d.alt("lineAlign",j[1],["start",Qn,"end"]);break;case"position":j=$.split(","),d.percent(M,j[0]),j.length===2&&d.alt("positionAlign",j[1],["start",Qn,"end","line-left","line-right","auto"]);break;case"size":d.percent(M,$);break;case"align":d.alt(M,$,["start",Qn,"end","left","right"]);break}},/:/,/\s/),g.region=d.get("region",null),g.vertical=d.get("vertical","");let v=d.get("line","auto");v==="auto"&&Ps.line===-1&&(v=-1),g.line=v,g.lineAlign=d.get("lineAlign","start"),g.snapToLines=d.get("snapToLines",!0),g.size=d.get("size",100),g.align=d.get("align",Qn);let S=d.get("position","auto");S==="auto"&&Ps.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(),s(o,e)}function fo(o){return o.replace(/<br(?: \/)?>/gi,`
`)}class fc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new uc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let s=t.buffer,a=0;for(s=fo(s);a<s.length&&s[a]!=="\r"&&s[a]!==`
`;)++a;const h=s.slice(0,a);return s[a]==="\r"&&++a,s[a]===`
`&&++a,t.buffer=s.slice(a),h}function r(s){ho(s,function(a,h){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=i();const h=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(h!=null&&h[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:s=i(),t.state){case"HEADER":/:/.test(s)?r(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new Is(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{hc(s,t.cue,t.regionList)}catch(h){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const h=s.indexOf("-->")!==-1;if(!s||h&&(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+=s}continue;case"BADCUE":s||(t.state="ID")}}}catch(s){t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const dc=/\r\n|\n\r|\n|\r/g,Os=function(e,t,i=0){return e.slice(i,i+t.length)===t},pc=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!k(t)||!k(i)||!k(r)||!k(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*s,t};function Fs(o,e,t){return Fn(o.toString())+Fn(e.toString())+Fn(t)}const _c=function(e,t,i){let r=e[t],s=e[r.prevCC];if(!s||!s.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(a=s)!=null&&a.new;){var a;e.ccOffset+=r.start-s.start,r.new=!1,r=s,s=e[r.prevCC]}e.presentationOffset=i};function gc(o,e,t,i,r,s,a){const h=new fc,g=ae(new Uint8Array(o)).trim().replace(dc,`
`).split(`
`),d=[],v=e?Bl(e.baseTime,e.timescale):0;let S="00:00.000",M=0,$=0,j,Q=!0;h.oncue=function(X){const se=t[i];let ce=t.ccOffset;const oe=(M-v)/9e4;if(se!=null&&se.new&&($!==void 0?ce=t.ccOffset=se.start:_c(t,i,oe)),oe){if(!e){j=new Error("Missing initPTS for VTT MPEGTS");return}ce=oe-t.presentationOffset}const ve=X.endTime-X.startTime,Ce=zi((X.startTime+ce-$)*9e4,r*9e4)/9e4;X.startTime=Math.max(Ce,0),X.endTime=Math.max(Ce+ve,0);const Ue=X.text.trim();X.text=decodeURIComponent(encodeURIComponent(Ue)),X.id||(X.id=Fs(X.startTime,X.endTime,Ue)),X.endTime>0&&d.push(X)},h.onparsingerror=function(X){j=X},h.onflush=function(){if(j){a(j);return}s(d)},g.forEach(X=>{if(Q)if(Os(X,"X-TIMESTAMP-MAP=")){Q=!1,X.slice(16).split(",").forEach(se=>{Os(se,"LOCAL:")?S=se.slice(6):Os(se,"MPEGTS:")&&(M=parseInt(se.slice(7)))});try{$=pc(S)/1e3}catch(se){j=se}return}else X===""&&(Q=!1);h.parse(X+`
`)}),h.flush()}const Ms="stpp.ttml.im1t",po=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_o=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,mc={left:"start",center:"center",right:"end",start:"start",end:"end"};function go(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 s=r.map(h=>ae(h)),a=Ml(e.baseTime,1,e.timescale);try{s.forEach(h=>t(vc(h,a)))}catch(h){i(h)}}function vc(o,e){const r=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(s).reduce((S,M)=>(S[M]=r.getAttribute(`ttp:${M}`)||s[M],S),{}),h=r.getAttribute("xml:space")!=="preserve",g=mo(Bs(r,"styling","style")),d=mo(Bs(r,"layout","region")),v=Bs(r,"body","[begin]");return[].map.call(v,S=>{const M=vo(S,h);if(!M||!S.hasAttribute("begin"))return null;const $=Us(S.getAttribute("begin"),a),j=Us(S.getAttribute("dur"),a);let Q=Us(S.getAttribute("end"),a);if($===null)throw yo(S);if(Q===null){if(j===null)throw yo(S);Q=$+j}const X=new Is($-e,Q-e,M);X.id=Fs(X.startTime,X.endTime,X.text);const se=d[S.getAttribute("region")],ce=g[S.getAttribute("style")],oe=yc(se,ce,g),{textAlign:ve}=oe;if(ve){const Ce=mc[ve];Ce&&(X.lineAlign=Ce),X.align=ve}return c(X,oe),X}).filter(S=>S!==null)}function Bs(o,e,t){const i=o.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function mo(o){return o.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function vo(o,e){return[].slice.call(o.childNodes).reduce((t,i,r)=>{var s;return i.nodeName==="br"&&r?t+`
`:(s=i.childNodes)!=null&&s.length?vo(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function yc(o,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=o!=null&&o.hasAttribute("style")?o.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(r=t[a]),s.reduce((h,g)=>{const d=Ns(e,i,g)||Ns(o,i,g)||Ns(r,i,g);return d&&(h[g]=d),h},{})}function Ns(o,e,t){return o&&o.hasAttributeNS(e,t)?o.getAttributeNS(e,t):null}function yo(o){return new Error(`Could not parse ttml timestamp ${o}`)}function Us(o,e){if(!o)return null;let t=co(o);return t===null&&(po.test(o)?t=bc(o,e):_o.test(o)&&(t=Ec(o,e))),t}function bc(o,e){const t=po.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 Ec(o,e){const t=_o.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 Jn{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class Sc{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=So(),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 Jn(this,"textTrack1"),t=new Jn(this,"textTrack2"),i=new Jn(this,"textTrack3"),r=new Jn(this,"textTrack4");this.cea608Parser1=new uo(1,e,t),this.cea608Parser2=new uo(3,i,r)}addCues(e,t,i,r,s){let a=!1;for(let h=s.length;h--;){const g=s[h],d=wc(g[0],g[1],t,i);if(d>=0&&(g[0]=Math.min(g[0],t),g[1]=Math.max(g[1],i),a=!0,d/(i-t)>.5))return}if(a||s.push([t,i]),this.config.renderTextTracksNatively){const h=this.captionsTracks[e];this.Cues.newCue(h,t,i,r)}else{const h=this.Cues.newCue(null,t,i,r);this.hls.trigger(_.CUES_PARSED,{type:"captions",cues:h,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:s}){const{unparsedVttFrags:a}=this;i===m.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:s}),a.length&&(this.unparsedVttFrags=[],a.forEach(h=>{this.initPTS[h.frag.cc]?this.onFragLoaded(_.FRAG_LOADED,h):this.hls.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h.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 s=i.textTracks[r];if(Eo(s,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:r}=this,{label:s,languageCode:a}=t[e],h=this.getExistingTrack(s,a);if(h)i[e]=h,hn(i[e]),eo(i[e],r);else{const g=this.createTextTrack("captions",s,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(s=>{hn(r[s]),delete r[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=So(),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++)hn(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(s=>s.textCodec===Ms);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(Ha(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const a=this.media,h=a?Yn(a.textTracks):null;if(this.tracks.forEach((g,d)=>{let v;if(h){let S=null;for(let M=0;M<h.length;M++)if(h[M]&&Eo(h[M],g)){S=h[M],h[M]=null;break}S&&(v=S)}if(v)hn(v);else{const S=bo(g);v=this.createTextTrack(S,g.name,g.lang),v&&(v.mode="disabled")}v&&this.textTracks.push(v)}),h!=null&&h.length){const g=h.filter(d=>d!==null).map(d=>d.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(h=>({label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}));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 s=`textTrack${r[1]}`,a=this.captionsProperties[s];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===m.MAIN){var i,r;const{cea608Parser1:s,cea608Parser2:a,lastSn:h}=this,{cc:g,sn:d}=t.frag,v=(i=(r=t.part)==null?void 0:r.index)!=null?i:-1;s&&a&&(d!==h+1||d===h&&v!==this.lastPartIndex+1||g!==this.lastCc)&&(s.reset(),a.reset()),this.lastCc=g,this.lastSn=d,this.lastPartIndex=v}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===m.SUBTITLE)if(r.byteLength){const s=i.decryptdata,a="stats"in t;if(s==null||!s.encrypted||a){const h=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),h&&h.textCodec===Ms?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;go(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:s,unparsedVttFrags:a}=this,h=s.length-1;if(!s[i.cc]&&h===-1){a.push(e);return}const g=this.hls,d=(t=i.initSegment)!=null&&t.data?$e(i.initSegment.data,new Uint8Array(r)).buffer:r;gc(d,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,v=>{this._appendCues(v,i.level),g.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},v=>{const S=v.message==="Missing initPTS for VTT MPEGTS";S?a.push(e):this._fallbackToIMSC1(i,r),g.logger.log(`Failed to parse VTT cue: ${v}`),!(S&&h>i.cc)&&g.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:v})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||go(t,this.initPTS[e.cc],()=>{i.textCodec=Ms,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(s=>to(r,s))}else{const r=this.tracks[t];if(!r)return;const s=r.default?"default":"subtitles"+t;i.trigger(_.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===m.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===m.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let s=0;s<r.length;s++){const a=r[s].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();const h=this.extractCea608Data(a);this.cea608Parser1.addData(r[s].pts,h[0]),this.cea608Parser2.addData(r[s].pts,h[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:s}){const{media:a}=this;if(!(!a||a.currentTime<i)){if(!s||s==="video"){const{captionsTracks:h}=this;Object.keys(h).forEach(g=>Ds(h[g],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:h}=this;Object.keys(h).forEach(g=>Ds(h[g],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let s=0;s<i;s++){const a=e[r++],h=127&e[r++],g=127&e[r++];if(h===0&&g===0)continue;if((4&a)!==0){const v=3&a;(v===0||v===1)&&(t[v].push(h),t[v].push(g))}}return t}}function bo(o){return o.characteristics&&/transcribes-spoken-dialog/gi.test(o.characteristics)&&/describes-music-and-sound/gi.test(o.characteristics)?"captions":"subtitles"}function Eo(o,e){return!!o&&o.kind===bo(e)&&Ss(e,o)}function wc(o,e,t,i){return Math.min(e,i)-Math.max(o,t)}function So(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const xc=/\s/,Ac={newCue(o,e,t,i){const r=[];let s,a,h,g,d;const v=self.VTTCue||self.TextTrackCue;for(let M=0;M<i.rows.length;M++)if(s=i.rows[M],h=!0,g=0,d="",!s.isEmpty()){var S;for(let Q=0;Q<s.chars.length;Q++)xc.test(s.chars[Q].uchar)&&h?g++:(d+=s.chars[Q].uchar,h=!1);s.cueStartTime=e,e===t&&(t+=1e-4),g>=16?g--:g++;const $=fo(d.trim()),j=Fs(e,t,$);o!=null&&(S=o.cues)!=null&&S.getCueById(j)||(a=new v(e,t,$),a.id=j,a.line=M+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((M,$)=>M.line==="auto"||$.line==="auto"?0:M.line>8&&$.line>8?$.line-M.line:M.line-$.line),r.forEach(M=>to(o,M))),r}};function Cc(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(o){}return!1}const Tc=/(\d+)-(\d+)\/(\d+)/;class wo{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||kc,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 s=Dc(e,this.controller.signal),a=e.responseType==="arraybuffer",h=a?"byteLength":"length",{maxTimeToFirstByteMs:g,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=g&&k(g)?g:d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(In(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(S=>{var M;this.response=this.loader=S;const $=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},d-($-r.loading.start)),!S.ok){const{status:Q,statusText:X}=S;throw new Ic(X||"fetch, bad network response",Q,S)}r.loading.first=$,r.total=Rc(S.headers)||r.total;const j=(M=this.callbacks)==null?void 0:M.onProgress;return j&&k(t.highWaterMark)?this.loadProgressively(S,r,e,t.highWaterMark,j):a?S.arrayBuffer():e.responseType==="json"?S.json():S.text()}).then(S=>{var M,$;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[h];Q&&(r.loaded=r.total=Q);const X={url:j.url,data:S,code:j.status},se=(M=this.callbacks)==null?void 0:M.onProgress;se&&!k(t.highWaterMark)&&se(r,e,S,j),($=this.callbacks)==null||$.onSuccess(X,r,e,j)}).catch(S=>{var M;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const $=S&&S.code||0,j=S?S.message:null;(M=this.callbacks)==null||M.onError({code:$,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,s){const a=new ha,h=e.body.getReader(),g=()=>h.read().then(d=>{if(d.done)return a.dataLength&&s(t,i,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const v=d.value,S=v.length;return t.loaded+=S,S<r||a.dataLength?(a.push(v),a.dataLength>=r&&s(t,i,a.flush().buffer,e)):s(t,i,v.buffer,e),g()}).catch(()=>Promise.reject());return g()}}function Dc(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 Lc(o){const e=Tc.exec(o);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Rc(o){const e=o.get("Content-Range");if(e){const i=Lc(e);if(k(i))return i}const t=o.get("Content-Length");if(t)return parseInt(t)}function kc(o,e){return new self.Request(o.url,e)}class Ic extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const Pc=/^age:\s*[\d.]+\s*$/im;class xo{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 s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return s(i,t.url)}).catch(a=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),s(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(a=>{var h;(h=this.callbacks)==null||h.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:s,maxLoadTimeMs:a}=i.loadPolicy;if(r)for(const h in r)e.setRequestHeader(h,r[h]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=s&&k(s)?s: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,s=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const d=t.status,v=t.responseType==="text"?t.responseText:null;if(d>=200&&d<300){const j=v!=null?v:t.response;if(j!=null){var a,h;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 X=(a=this.callbacks)==null?void 0:a.onProgress;X&&X(i,e,j,t);const se={url:t.responseURL,data:j,code:d};(h=this.callbacks)==null||h.onSuccess(se,i,e,t);return}}const S=s.loadPolicy.errorRetry,M=i.retry,$={url:e.url,data:void 0,code:d};if(gr(S,M,!1,$))this.retry(S);else{var g;F.error(`${d} while loading ${e.url}`),(g=this.callbacks)==null||g.onError({code:d,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(gr(e,t,!0))this.retry(e);else{var i;F.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=Xi(e,i.retry),i.retry++,F.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Pc.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Oc={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Fc=u(u({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:xo,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:gn,bufferController:Ql,capLevelController:xs,errorController:mn,fpsController:Nu,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:nn,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:Oc},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Mc()),{},{subtitleStreamController:Zu,subtitleTrackController:$u,timelineController:Sc,audioStreamController:ql,audioTrackController:Yl,emeController:cn,cmcdController:Fu,contentSteeringController:Bu,interstitialsController:Yu});function Mc(){return{cueHandler:Ac,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Bc(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=Hs(o),r=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(a=>{const h=`${a==="level"?"playlist":a}LoadPolicy`,g=e[h]===void 0,d=[];s.forEach(v=>{const S=`${a}Loading${v}`,M=e[S];if(M!==void 0&&g){d.push(S);const $=i[h].default;switch(e[h]={default:$},v){case"TimeOut":$.maxLoadTimeMs=M,$.maxTimeToFirstByteMs=M;break;case"MaxRetry":$.errorRetry.maxNumRetry=M,$.timeoutRetry.maxNumRetry=M;break;case"RetryDelay":$.errorRetry.retryDelayMs=M,$.timeoutRetry.retryDelayMs=M;break;case"MaxRetryTimeout":$.errorRetry.maxRetryDelayMs=M,$.timeoutRetry.maxRetryDelayMs=M;break}}}),d.length&&t.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${h}": ${At(e[h])}`)}),u(u({},i),e)}function Hs(o){return o&&typeof o=="object"?Array.isArray(o)?o.map(Hs):Object.keys(o).reduce((e,t)=>(e[t]=Hs(o[t]),e),{}):o}function Nc(o,e){const t=o.loader;t!==wo&&t!==xo?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),o.progressive=!1):Cc()&&(o.loader=wo,o.progressive=!0,o.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const es=2,Uc=.1,Hc=.05,$c=100;class jc extends Cr{constructor(e,t){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(_.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($c),this.mediaSource=t.mediaSource;const i=this.media=t.media;Vi(i,"playing",this.onMediaPlaying),Vi(i,"waiting",this.onMediaWaiting),Vi(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(sr(i,"playing",this.onMediaPlaying),sr(i,"waiting",this.onMediaWaiting),sr(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 s=(i=this.hls)==null?void 0:i.config;if(!s)return;const a=this.media;if(!a)return;const{seeking:h}=a,g=this.seeking&&!h,d=!this.seeking&&h,v=a.paused&&!h||a.ended||a.playbackRate===0;if(this.seeking=h,e!==t){t&&(this.ended=0),this.moved=!0,h||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!v&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(d||g){g&&this.stallResolved(e);return}if(v){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(!Lt.getBuffered(a).length){this.nudgeRetry=0;return}const S=Lt.bufferInfo(a,e,0),M=S.nextStart||0,$=this.fragmentTracker;if(h&&$&&this.hls){const Ue=Ao(this.hls.inFlightFragments,e),Ae=S.len>es,ke=!M||Ue||M-e>es&&!$.getPartialFragment(e);if(Ae||ke)return;this.moved=!1}const j=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&$){if(!(S.len>0)&&!M)return;const Ae=Math.max(M,S.start||0)-e,Pe=!!(j!=null&&j.live)?j.targetduration*2:es,Se=$.getPartialFragment(e);if(Ae>0&&(Ae<=Pe||Se)){a.paused||this._trySkipBufferHole(Se);return}}const Q=s.detectStallWithCurrentTimeMs,X=self.performance.now(),se=this.waiting;let ce=this.stalled;if(ce===null)if(se>0&&X-se<Q)ce=this.stalled=se;else{this.stalled=X;return}const oe=X-ce;if(!h&&(oe>=Q||se)&&this.hls){var ve;if(((ve=this.mediaSource)==null?void 0:ve.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 Ce=Lt.bufferInfo(a,e,s.maxBufferHole);this._tryFixBufferStall(Ce,oe,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 s=Lt.bufferedInfo(Lt.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const a=Lt.timeRangesToArray(r),h=Lt.bufferedInfo(a,t,0).bufferedIndex;if(h>-1&&h<a.length-1){const g=Lt.bufferedInfo(a,e,0).bufferedIndex,d=a[h].end,v=a[h+1].start;if((g===-1||g>h)&&v-d<1&&e-d<2){const S=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${v} buffered index: ${g}`);this.warn(S.message),this.media.currentTime+=1e-6;const M=this.fragmentTracker.getPartialFragment(e)||void 0,$=Lt.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:M,buffer:$.len,bufferInfo:$})}}}}}_tryFixBufferStall(e,t,i){var r,s;const{fragmentTracker:a,media:h}=this,g=(r=this.hls)==null?void 0:r.config;if(!h||!a||!g)return;const d=(s=this.hls)==null?void 0:s.latestLevelDetails,v=a.getPartialFragment(i);if((v||d!=null&&d.live&&i<d.fragmentStart)&&(this._trySkipBufferHole(v)||!this.media))return;const S=e.buffered,M=this.adjacentTraversal(e,i);(S&&S.length>1&&e.len>g.maxBufferHole||e.nextStart&&(e.nextStart-i<g.maxBufferHole||M))&&(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 s=i.getFragAtPos(t,m.MAIN),a=i.getFragAtPos(r,m.MAIN);if(s&&a)return a.sn-s.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:r,stalled:s}=this;if(!r&&s!==null&&i&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${At(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:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:r}=this,s=(t=this.hls)==null?void 0:t.config;if(!r||!i||!s)return 0;const a=r.currentTime,h=Lt.bufferInfo(r,a,0),g=a<h.start?h.start:h.nextStart;if(g&&this.hls){const v=h.len<=s.maxBufferHole,S=h.len>0&&h.len<1&&r.readyState<3,M=g-a;if(M>0&&(v||S)){if(M>s.maxBufferHole){let j=!1;if(a===0){const Q=i.getAppendedFrag(0,m.MAIN);Q&&g<Q.end&&(j=!0)}if(!j){const Q=e||i.getAppendedFrag(a,m.MAIN);if(Q){var d;if(!((d=this.hls.loadLevelObj)!=null&&d.details)||Ao(this.hls.inFlightFragments,g))return 0;let se=!1,ce=Q.end;for(;ce<g;){const oe=i.getAppendedFrag(ce,m.MAIN)||i.getPartialFragment(ce);if(oe)ce+=oe.duration;else{se=!0;break}}if(se)return 0}}}const $=Math.max(g+Hc,a+Uc);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${$}`),this.moved=!0,r.currentTime=$,!(e!=null&&e.gap)){const j=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${$}`);this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:j,reason:j.message,frag:e||void 0,buffer:h.len,bufferInfo:h})}return $}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:r}=this,s=t==null?void 0:t.config;if(!i||!s)return 0;const a=i.currentTime;if(this.nudgeRetry++,r<s.nudgeMaxRetry){const h=a+(r+1)*s.nudgeOffset,g=new Error(`Nudging 'currentTime' from ${a} to ${h}`);this.warn(g.message),i.currentTime=h,t.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_NUDGE_ON_STALL,error:g,fatal:!1,buffer:e.len,bufferInfo:e})}else{const h=new Error(`Playhead still not moving while enough data buffered @${a} after ${s.nudgeMaxRetry} nudges`);this.error(h.message),t.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,error:h,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Ao(o,e){const t=Co(o.main);if(t&&t.start<=e)return t;const i=Co(o.audio);return i&&i.start<=e?i:null}function Co(o){if(!o)return null;switch(o.state){case Ve.IDLE:case Ve.STOPPED:case Ve.ENDED:case Ve.ERROR:return null}return o.frag}const Wc=.25;function $s(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function To(o,e,t,i,r){let s=new o(e,t,"");try{s.value=i,r&&(s.type=r)}catch(a){s=new o(e,t,At(r?u({type:r},i):i))}return s}const ts=(()=>{const o=$s();try{o&&new o(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Gc{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!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.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.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(){const e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&hn(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 eo(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:r}}}=this;if(!i&&!r)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=$s();if(a)for(let h=0;h<s.length;h++){const g=s[h].type;if(g===$i.emsg&&!i||!r)continue;const d=ya(s[h].data);if(d){const v=s[h].pts;let S=v+s[h].duration;S>ts&&(S=ts),S-v<=0&&(S=v+Wc);for(let $=0;$<d.length;$++){const j=d[$];if(!ba(j)){this.updateId3CueEnds(v,g);const Q=To(a,v,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 s=r.length;s--;){const a=r[s];a.type===t&&a.startTime<e&&a.endTime===ts&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:s,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:h,enableID3MetadataCues:g}}=a;if(s&&(h||g)){let d;r==="audio"?d=v=>v.type===$i.audioId3&&g:r==="video"?d=v=>v.type===$i.emsg&&h:d=v=>v.type===$i.audioId3&&g||v.type===$i.emsg&&h,Ds(s,t,i,d)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:i}=this,{dateRanges:r}=e,s=Object.keys(r);let a=this.dateRangeCuesAppended;if(i&&t){var h;if((h=i.cues)!=null&&h.length){const v=Object.keys(a).filter(S=>!s.includes(S));for(let S=v.length;S--;){const M=v[S],$=a[M].cues;delete a[M],Object.keys($).forEach(j=>{try{const Q=$[j];Q.removeEventListener("enter",this.onEventCueEnter),i.removeCue(Q)}catch(Q){}})}}else a=this.dateRangeCuesAppended={}}const g=e.fragments[e.fragments.length-1];if(s.length===0||!k(g==null?void 0:g.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const d=$s();for(let v=0;v<s.length;v++){const S=s[v],M=r[S],$=M.startTime,j=a[S],Q=(j==null?void 0:j.cues)||{};let X=(j==null?void 0:j.durationKnown)||!1,se=ts;const{duration:ce,endDate:oe}=M;if(oe&&ce!==null)se=$+ce,X=!0;else if(M.endOnNext&&!X){const Ce=s.reduce((Ue,Ae)=>{if(Ae!==M.id){const ke=r[Ae];if(ke.class===M.class&&ke.startDate>M.startDate&&(!Ue||M.startDate<Ue.startDate))return ke}return Ue},null);Ce&&(se=Ce.startTime,X=!0)}const ve=Object.keys(M.attr);for(let Ce=0;Ce<ve.length;Ce++){const Ue=ve[Ce];if(!Sn(Ue))continue;const Ae=Q[Ue];if(Ae)X&&!j.durationKnown?Ae.endTime=se:Math.abs(Ae.startTime-$)>.01&&(Ae.startTime=$,Ae.endTime=se);else if(d){let ke=M.attr[Ue];Jr(Ue)&&(ke=z(ke));const Se=To(d,$,se,{key:Ue,data:ke},$i.dateRange);Se&&(Se.id=S,this.id3Track.addCue(Se),Q[Ue]=Se,this.hls.config.interstitialsController&&(Ue==="X-ASSET-LIST"||Ue==="X-ASSET-URL")&&Se.addEventListener("enter",this.onEventCueEnter))}}a[S]={cues:Q,dateRange:M,durationKnown:X}}}}class Kc{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:s,maxLiveSyncPlaybackRate:a}=this.config;if(!s||a===1||!i.live)return;const h=this.targetLatency;if(h===null)return;const g=r-h,d=Math.min(this.maxLatency,h+i.targetduration);if(g<d&&g>.05&&this.forwardBufferLength>1){const S=Math.min(2,Math.max(1,a)),M=Math.round(2/(1+Math.exp(-.75*g-this.edgeStalled))*20)/20,$=Math.min(S,Math.max(1,M));this.changeMediaPlaybackRate(t,$)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:s,liveSyncDurationCount:a,lowLatencyMode:h}=this.config,g=this.hls.userConfig;let d=h&&i||t;(this._targetLatencyUpdated||g.liveSyncDuration||g.liveSyncDurationCount||d===0)&&(d=s!==void 0?s:a*r);const v=r;return d+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,v)}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,s=e-t-this.edgeStalled,a=r-i.totalduration,h=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,s),h)}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 zc extends Es{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=[],s={},a={};let h=!1,g=!1,d=!1;t.levels.forEach(v=>{const S=v.attrs;let{audioCodec:M,videoCodec:$}=v;M&&(v.audioCodec=M=ue(M,i)||void 0),$&&($=v.videoCodec=Qe($));const{width:j,height:Q,unknownCodecs:X}=v;let se=X?X.length:0;if(X)for(let Se=se;Se--;){const Xe=X[Se];this.isAudioSupported(Xe)?(v.audioCodec=M=M?`${M},${Xe}`:Xe,se--,at.audio[M.substring(0,4)]=2):this.isVideoSupported(Xe)&&(v.videoCodec=$=$?`${$},${Xe}`:Xe,se--,at.video[$.substring(0,4)]=2)}if(h||(h=!!(j&&Q)),g||(g=!!$),d||(d=!!M),se||M&&!this.isAudioSupported(M)||$&&!this.isVideoSupported($)){this.log(`Some or all CODECS not supported "${S.CODECS}"`);return}const{CODECS:ce,"FRAME-RATE":oe,"HDCP-LEVEL":ve,"PATHWAY-ID":Ce,RESOLUTION:Ue,"VIDEO-RANGE":Ae}=S,Pe=`${`${Ce||"."}-`}${v.bitrate}-${Ue}-${oe}-${ce}-${Ae}-${ve}`;if(s[Pe])if(s[Pe].uri!==v.url&&!v.attrs["PATHWAY-ID"]){const Se=a[Pe]+=1;v.attrs["PATHWAY-ID"]=new Array(Se+1).join(".");const Xe=this.createLevel(v);s[Pe]=Xe,r.push(Xe)}else s[Pe].addGroupId("audio",S.AUDIO),s[Pe].addGroupId("text",S.SUBTITLES);else{const Se=this.createLevel(v);s[Pe]=Se,a[Pe]=1,r.push(Se)}}),this.filterAndSortMediaOptions(r,t,h,g,d)}createLevel(e){const t=new mi(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=Nt(r,[])}return t}isAudioSupported(e){return Ut(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Ut(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,r,s){let a=[],h=[],g=e;if((i||r)&&s&&(g=g.filter(({videoCodec:X,videoRange:se,width:ce,height:oe})=>(!!X||!!(ce&&oe))&&Zt(se))),g.length===0){Promise.resolve().then(()=>{if(this.hls){let X="no level with compatible codecs found in manifest",se=X;t.levels.length&&(se=`one or more CODECS in variant not supported: ${At(t.levels.map(oe=>oe.attrs.CODECS).filter((oe,ve,Ce)=>Ce.indexOf(oe)===ve))}`,this.warn(se),X+=` (${se})`);const ce=new Error(X);this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:ce,reason:se})}});return}t.audioTracks&&(a=t.audioTracks.filter(X=>!X.audioCodec||this.isAudioSupported(X.audioCodec)),Do(a)),t.subtitles&&(h=t.subtitles,Do(h));const d=g.slice(0);g.sort((X,se)=>{if(X.attrs["HDCP-LEVEL"]!==se.attrs["HDCP-LEVEL"])return(X.attrs["HDCP-LEVEL"]||"")>(se.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&X.height!==se.height)return X.height-se.height;if(X.frameRate!==se.frameRate)return X.frameRate-se.frameRate;if(X.videoRange!==se.videoRange)return $t.indexOf(X.videoRange)-$t.indexOf(se.videoRange);if(X.videoCodec!==se.videoCodec){const ce=xe(X.videoCodec),oe=xe(se.videoCodec);if(ce!==oe)return oe-ce}if(X.uri===se.uri&&X.codecSet!==se.codecSet){const ce=ge(X.codecSet),oe=ge(se.codecSet);if(ce!==oe)return oe-ce}return X.averageBitrate!==se.averageBitrate?X.averageBitrate-se.averageBitrate:0});let v=d[0];if(this.steering&&(g=this.steering.filterParsedLevels(g),g.length!==d.length)){for(let X=0;X<d.length;X++)if(d[X].pathwayId===g[0].pathwayId){v=d[X];break}}this._levels=g;for(let X=0;X<g.length;X++)if(g[X]===v){var S;this._firstLevel=X;const se=v.bitrate,ce=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${g.length} level(s) found, first bitrate: ${se}`),((S=this.hls.userConfig)==null?void 0:S.abrEwmaDefaultEstimate)===void 0){const oe=Math.min(se,this.hls.config.abrEwmaDefaultEstimateMax);oe>ce&&ce===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=oe)}break}const M=s&&!r,$=this.hls.config,j=!!($.audioStreamController&&$.audioTrackController),Q={levels:g,audioTracks:a,subtitleTracks:h,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:r,altAudio:j&&!M&&a.some(X=>!!X.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 v=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:v,reason:v.message}),S)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,s=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],h=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&r&&s===h)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${h?" with Pathway "+h:""} from level ${i}${s?" with Pathway "+s:""}`);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 d=a.details;if(!d||d.live){const v=this.switchParams(a.uri,r==null?void 0:r.details,d);this.loadPlaylist(v)}}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===O.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===m.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(s=>!!i[s]))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:s}=t,a=t.levelInfo;if(!a){var h;this.warn(`Invalid level index ${r}`),(h=t.deliveryDirectives)!=null&&h.skip&&(s.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&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],a=e.details,h=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:""}${s?" Pathway "+s:""}${h&&a.live?" age "+h.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((s,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(h=>h.level=-1)),!1));aa(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 Do(o){const e={};o.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function Lo(){return self.SourceBuffer||self.WebKitSourceBuffer}function Ro(){if(!Y())return!1;const e=Lo();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Vc(){if(!Ro())return!1;const o=Y();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(xt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>o.isTypeSupported(xt(e,"audio"))))}function qc(){var o;const e=Lo();return typeof(e==null||(o=e.prototype)==null?void 0:o.changeType)=="function"}const Yc=100;class Zc extends as{constructor(e,t,i){super(e,t,i,"stream-controller",m.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,s=r?r.currentTime:null;if(s===null||!k(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const a=this.getFwdBufferInfoAtPos(r,s,m.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${s} 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(Yc),this.level=-1,!this.startFragRequested){let s=r.startLevel;s===-1&&(r.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=r.firstAutoLevel),r.nextLoadLevel=s,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=Ve.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Ve.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Ve.WAITING_LEVEL:{const{levels:t,level:i}=this,r=t==null?void 0:t[i],s=r==null?void 0:r.details;if(s&&(!s.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(s))break;this.state=Ve.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Ve.IDLE;break}break}case Ve.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:r,level:s}=this,a=r==null?void 0:r[s];this.resetStartWhenNotLoaded(a||null),this.state=Ve.IDLE}}break}this.state===Ve.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 s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[s]))return;const a=i[s],h=this.getMainFwdBufferInfo();if(h===null)return;const g=this.getLevelDetails();if(g&&this._streamEnded(h,g)){const Q={};this.altAudio===2&&(Q.type="video"),this.hls.trigger(_.BUFFER_EOS,Q),this.state=Ve.ENDED;return}if(!this.buffering)return;e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const d=a.details;if(!d||this.state===Ve.WAITING_LEVEL||this.waitForLive(a)){this.level=s,this.state=Ve.WAITING_LEVEL,this.startFragRequested=!1;return}const v=h.len,S=this.getMaxBufferLength(a.maxBitrate);if(v>=S)return;this.backtrackFragment&&this.backtrackFragment.start>h.end&&(this.backtrackFragment=null);const M=this.backtrackFragment?this.backtrackFragment.start:h.end;let $=this.getNextFragment(M,d);if(this.couldBacktrack&&!this.fragPrevious&&$&&_e($)&&this.fragmentTracker.getState($)!==ai.OK){var j;const X=((j=this.backtrackFragment)!=null?j:$).sn-d.startSN,se=d.fragments[X-1];se&&$.cc===se.cc&&($=se,this.fragmentTracker.removeFragment(se))}else this.backtrackFragment&&h.len&&(this.backtrackFragment=null);if($&&this.isLoopLoading($,M)){if(!$.gap){const X=this.audioOnly&&!this.altAudio?q.AUDIO:q.VIDEO,se=(X===q.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;se&&this.afterBufferFlushed(se,X,m.MAIN)}$=this.getNextFragmentLoopLoading($,d,h,m.MAIN,S)}$&&($.initSegment&&!$.initSegment.data&&!this.bitrateTest&&($=$.initSegment),this.loadFragment($,a,M))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);r===ai.NOT_LOADED||r===ai.PARTIAL?_e(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,m.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 s=this.getLevelDetails();if(s!=null&&s.live){const h=this.getMainFwdBufferInfo();if(!h||h.len<s.targetduration*2)return}if(!t.paused&&e){const h=this.hls.nextLoadLevel,g=e[h],d=this.fragLastKbps;d&&this.fragCurrent?i=this.fragCurrent.duration*g.maxBitrate/(1e3*d)+1:i=0}else i=0;const a=this.getBufferedFrag(t.currentTime+i);if(a){const h=this.followingBufferedFrag(a);if(h){this.abortCurrentFrag();const g=h.maxStartPTS?h.maxStartPTS:h.start,d=h.duration,v=Math.max(a.end,g+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,d*(this.couldBacktrack?.5:.125)),d*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(v,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 Ve.KEY_LOADING:case Ve.FRAG_LOADING:case Ve.FRAG_LOADING_WAITING_RETRY:case Ve.PARSING:case Ve.PARSED:this.state=Ve.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;Vi(i,"playing",this.onMediaPlaying),Vi(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(sr(i,"playing",this.onMediaPlaying),sr(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;t.levels.forEach(s=>{const a=s.audioCodec;a&&(i=i||a.indexOf("mp4a.40.2")!==-1,r=r||a.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&r&&!qc(),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!==Ve.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=Ve.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r,startFragRequested:s}=this,a=t.level,h=t.details,g=h.totalduration;if(!r){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${h.startSN},${h.endSN}]${h.lastPartSn?`[part-${h.lastPartSn}-${h.lastPartIndex}]`:""}, cc [${h.startCC}, ${h.endCC}] duration:${g}`);const d=t.levelInfo,v=this.fragCurrent;v&&(this.state===Ve.FRAG_LOADING||this.state===Ve.FRAG_LOADING_WAITING_RETRY)&&v.level!==t.level&&v.loader&&this.abortCurrentFrag();let S=0;if(h.live||(i=d.details)!=null&&i.live){var M;if(this.checkLiveUpdate(h),h.deltaUpdateFailed)return;S=this.alignPlaylists(h,d.details,(M=this.levelLastLoaded)==null?void 0:M.details)}if(d.details=h,this.levelLastLoaded=d,s||this.setStartPosition(h,S),this.hls.trigger(_.LEVEL_UPDATED,{details:h,level:a}),this.state===Ve.WAITING_LEVEL){if(this.waitForCdnTuneIn(h))return;this.state=Ve.IDLE}s&&h.live&&this.synchronizeToLiveEdge(h),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,s=this.getLoadPosition(),a=e.fragmentStart,h=e.edge,g=s>=a-t.maxFragLookUpTolerance&&s<=h;if(r!==null&&i.duration>r&&(s<r||!g)){const v=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!g&&i.readyState<4||s<h-v)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),i.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${h}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var d;const S=Lt.bufferInfo(i,r,0);if(!(S!=null&&(d=S.buffered)!=null&&d.length)){i.currentTime=r;return}if(S.start<=s){i.currentTime=r;return}const{nextStart:$}=Lt.bufferedInfo(S.buffered,s,0);$&&(i.currentTime=$)}else i.currentTime=r}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:r,payload:s}=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 h=a[i.level];if(!h){this.warn(`Level ${i.level} not found on progress`);return}const g=h.details;if(!g){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const d=h.videoCodec,v=g.PTSKnown||!g.live,S=(t=i.initSegment)==null?void 0:t.data,M=this._getAudioCodec(h),$=this.transmuxer=this.transmuxer||new Na(this.hls,m.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),j=r?r.index:-1,Q=j!==-1,X=new tr(i.level,i.sn,i.stats.chunkCount,s.byteLength,j,Q),se=this.initPTS[i.cc];$.push(s,S,M,d,i,r,g.totalduration,v,X,se)}onAudioTrackSwitching(e,t){const i=this.hls,r=this.altAudio===2;if(_r(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,()=>{var a;(a=this.hls)==null||a.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=_r(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,s,a=!1;for(const h in i){const g=i[h];if(g.id==="main"){if(s=h,r=g,h==="video"){const d=i[h];d&&(this.videoBuffer=d.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t,s=i.type===m.MAIN;if(s){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===Ve.PARSED&&(this.state=Ve.IDLE);return}const h=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*h.total/(h.buffering.end-h.loading.first)),_e(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}const a=this.media;a&&(!this._hasEnoughToStart&&Lt.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=Ve.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(m.MAIN,t);break;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ve.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===O.LEVEL&&(this.state=Ve.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.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=Ve.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==q.AUDIO||!this.altAudio){const i=(t===q.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,m.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 s=this.getLevelDetails(),a=Lt.getBuffered(e),h=a.length?a.start(0):0,g=h-i,d=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||g>0&&(g<d||this.loadingParts&&g<2*((s==null?void 0:s.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 ${h}`),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,s=i==null?void 0:i.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=Ve.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=s.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),r.trigger(_.FRAG_LOADED,i),s.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i=this.playlistType,{hls:r}=this,{remuxResult:s,chunkMeta:a}=e,h=this.getCurrentContext(a);if(!h){this.resetWhenMissingContext(a);return}const{frag:g,part:d,level:v}=h,{video:S,text:M,id3:$,initSegment:j}=s,{details:Q}=v,X=this.altAudio?void 0:s.audio;if(this.fragContextChanged(g)){this.fragmentTracker.removeFragment(g);return}if(this.state=Ve.PARSING,j){if(j!=null&&j.tracks){const ve=g.initSegment||g;this._bufferInitSegment(v,j.tracks,ve,a),r.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:ve,id:i,tracks:j.tracks})}const se=j.initPTS,ce=j.timescale,oe=this.initPTS[g.cc];k(se)&&(!oe||oe.baseTime!==se||oe.timescale!==ce)&&(this.initPTS[g.cc]={baseTime:se,timescale:ce},r.trigger(_.INIT_PTS_FOUND,{frag:g,id:i,initPTS:se,timescale:ce}))}if(S&&Q){X&&S.type==="audiovideo"&&this.logMuxedErr(g);const se=Q.fragments[g.sn-1-Q.startSN],ce=g.sn===Q.startSN,oe=!se||g.cc>se.cc;if(s.independent!==!1){const{startPTS:ve,endPTS:Ce,startDTS:Ue,endDTS:Ae}=S;if(d)d.elementaryStreams[S.type]={startPTS:ve,endPTS:Ce,startDTS:Ue,endDTS:Ae};else if(S.firstKeyFrame&&S.independent&&a.id===1&&!oe&&(this.couldBacktrack=!0),S.dropped&&S.independent){const ke=this.getMainFwdBufferInfo(),Pe=(ke?ke.end:this.getLoadPosition())+this.config.maxBufferHole,Se=S.firstKeyFramePTS?S.firstKeyFramePTS:ve;if(!ce&&Pe<Se-this.config.maxBufferHole&&!oe){this.backtrack(g);return}else oe&&(g.gap=!0);g.setElementaryStreamInfo(S.type,g.start,Ce,g.start,Ae,!0)}else ce&&ve-(Q.appliedTimelineOffset||0)>es&&(g.gap=!0);g.setElementaryStreamInfo(S.type,ve,Ce,Ue,Ae),this.backtrackFragment&&(this.backtrackFragment=g),this.bufferFragmentData(S,g,d,a,ce||oe)}else if(ce||oe)g.gap=!0;else{this.backtrack(g);return}}if(X){const{startPTS:se,endPTS:ce,startDTS:oe,endDTS:ve}=X;d&&(d.elementaryStreams[q.AUDIO]={startPTS:se,endPTS:ce,startDTS:oe,endDTS:ve}),g.setElementaryStreamInfo(q.AUDIO,se,ce,oe,ve),this.bufferFragmentData(X,g,d,a)}if(Q&&$!=null&&(t=$.samples)!=null&&t.length){const se={id:i,frag:g,details:Q,samples:$.samples};r.trigger(_.FRAG_PARSING_METADATA,se)}if(Q&&M){const se={id:i,frag:g,details:Q,samples:M.samples};r.trigger(_.FRAG_PARSING_USERDATA,se)}}logMuxedErr(e){this.warn(`${_e(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,r){if(this.state!==Ve.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:s,video:a,audiovideo:h}=t;if(s){const d=e.audioCodec;let v=pe(s.codec,d);v==="mp4a"&&(v="mp4a.40.5");const S=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){v&&(v.indexOf("mp4a.40.5")!==-1?v="mp4a.40.2":v="mp4a.40.5");const M=s.metadata;M&&"channelCount"in M&&(M.channelCount||1)!==1&&S.indexOf("firefox")===-1&&(v="mp4a.40.5")}v&&v.indexOf("mp4a.40.5")!==-1&&S.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(v="mp4a.40.2",this.log(`Android: force audio codec to ${v}`)),d&&d!==v&&this.log(`Swapping manifest audio codec "${d}" for "${v}"`),s.levelCodec=v,s.id=m.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${v||""}/${d||""}/${s.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=m.MAIN;const d=a.codec;if((d==null?void 0:d.length)===4)switch(d){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||""}/${d}]${a.codec!==d?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}h&&(this.log(`Init audiovideo buffer, container:${h.container}, codecs[level/parsed]=[${e.codecs}/${h.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(d=>{const S=t[d].initSegment;S!=null&&S.byteLength&&this.hls.trigger(_.BUFFER_APPENDING,{type:d,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,m.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=Ve.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Lt.isBuffered(e,i)?t=this.getAppendedFrag(i):Lt.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,s=t.level;(!r||t.sn!==r.sn||r.level!==s)&&(this.fragPlaying=t,this.hls.trigger(_.FRAG_CHANGED,{frag:t}),(!r||r.level!==s)&&this.hls.trigger(_.LEVEL_SWITCHED,{level:s}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return k(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(k(t)){const i=this.getLevelDetails(),r=this.currentFrag||(i?gi(null,i.fragments,t):null);if(r){const s=r.programDateTime;if(s!==null){const a=s+(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 Xc{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[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.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=w.KEY_LOAD_ERROR,i,r,s){return new Ci({type:D.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,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,s=t.length;r<s;r++){const a=t[r];if(e.cc<=a.cc&&(!_e(e)||!_e(a)||e.sn<a.sn)||!i&&r==s-1)return this.emeController.selectKeySystemFormat(a).then(h=>{if(!this.emeController)return;a.setKeyFormat(h);const g=Ki(h);if(g)return this.emeController.getKeySystemAccess([g])})}if(this.config.requireKeySystemAccessOnStart){const r=Er(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 s=e.decryptdata;if(!s){const d=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,d))}const a=s.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let h=this.keyUriToKeyInfo[a];if((i=h)!=null&&i.decryptdata.key)return s.key=h.decryptdata.key,Promise.resolve({frag:e,keyInfo:h});if((r=h)!=null&&r.keyLoadPromise){var g;switch((g=h.mediaKeySessionContext)==null?void 0:g.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return h.keyLoadPromise.then(d=>(s.key=d.keyInfo.decryptdata.key,{frag:e,keyInfo:h}))}}switch(h=this.keyUriToKeyInfo[a]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(h,e):this.loadKeyEME(h,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(h,e);default:return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(s=>(e.mediaKeySessionContext=s,i))).catch(s=>{throw e.keyLoadPromise=null,s})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,s=new r(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((a,h)=>{const g={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=i.keyLoadPolicy.default,v={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(M,$,j,Q)=>{const{frag:X,keyInfo:se,url:ce}=j;if(!X.decryptdata||se!==this.keyUriToKeyInfo[ce])return h(this.createKeyLoadError(X,w.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),Q));se.decryptdata.key=X.decryptdata.key=new Uint8Array(M.data),X.keyLoader=null,se.loader=null,a({frag:X,keyInfo:se})},onError:(M,$,j,Q)=>{this.resetLoader($),h(this.createKeyLoadError(t,w.KEY_LOAD_ERROR,new Error(`HTTP Error ${M.code} loading key ${M.text}`),j,u({url:g.url,data:void 0},M)))},onTimeout:(M,$,j)=>{this.resetLoader($),h(this.createKeyLoadError(t,w.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),j))},onAbort:(M,$,j)=>{this.resetLoader($),h(this.createKeyLoadError(t,w.INTERNAL_ABORTED,new Error("key loading aborted"),j))}};s.load(g,v,S)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,s=i.loader;t.keyLoader===s&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],s&&s.destroy()}}function ko(o){const{type:e}=o;switch(e){case O.AUDIO_TRACK:return m.AUDIO;case O.SUBTITLE_TRACK:return m.SUBTITLE;default:return m.MAIN}}function js(o,e){let t=o.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Qc{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(_.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,s=i||r,a=new s(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:O.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:r,pathwayId:s,url:a,deliveryDirectives:h,levelInfo:g}=t;this.load({id:i,level:r,pathwayId:s,responseType:"text",type:O.LEVEL,url:a,deliveryDirectives:h,levelOrTrack:g})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:s,deliveryDirectives:a,track:h}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:O.AUDIO_TRACK,url:s,deliveryDirectives:a,levelOrTrack:h})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:s,deliveryDirectives:a,track:h}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:O.SUBTITLE_TRACK,url:s,deliveryDirectives:a,levelOrTrack:h})}onLevelsUpdated(e,t){const i=this.loaders[O.LEVEL];if(i){const r=i.context;r&&!t.levels.some(s=>s===r.levelOrTrack)&&(i.abort(),delete this.loaders[O.LEVEL])}}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const d=this.hls.logger,v=r.context;if(v&&v.levelOrTrack===e.levelOrTrack&&(v.url===e.url||v.deliveryDirectives&&!e.deliveryDirectives)){v.url===e.url?d.log(`[playlist-loader]: ignore ${e.url} ongoing request`):d.log(`[playlist-loader]: ignore ${e.url} in favor of ${v.url}`);return}d.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let s;if(e.type===O.MANIFEST?s=i.manifestLoadPolicy.default:s=c({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),k((t=e.deliveryDirectives)==null?void 0:t.part)){let d;if(e.type===O.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===O.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===O.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){const v=d.partTarget,S=d.targetduration;if(v&&S){const M=Math.max(v*3,S*.8)*1e3;s=c({},s,{maxTimeToFirstByteMs:Math.min(M,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(M,s.maxTimeToFirstByteMs)})}}}const a=s.errorRetry||s.timeoutRetry||{},h={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},g={onSuccess:(d,v,S,M)=>{const $=this.getInternalLoader(S);this.resetInternalLoader(S.type);const j=d.data;if(j.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(d,S,new Error("no EXTM3U delimiter"),M||null,v);return}v.parsing.start=performance.now(),hr.isMediaPlaylist(j)||S.type!==O.MANIFEST?this.handleTrackOrLevelPlaylist(d,v,S,M||null,$):this.handleMasterPlaylist(d,v,S,M)},onError:(d,v,S,M)=>{this.handleNetworkError(v,S,!1,d,M)},onTimeout:(d,v,S)=>{this.handleNetworkError(v,S,!0,void 0,d)}};r.load(e,h,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 s=this.hls,a=e.data,h=js(e,i),g=hr.parseMasterPlaylist(a,h);if(g.playlistParsingError){this.handleManifestParsingError(e,i,g.playlistParsingError,r,t);return}const{contentSteering:d,levels:v,sessionData:S,sessionKeys:M,startTimeOffset:$,variableList:j}=g;this.variableList=j;const{AUDIO:Q=[],SUBTITLES:X,"CLOSED-CAPTIONS":se}=hr.parseMasterPlaylistMedia(a,h,g);Q.length&&!Q.some(oe=>!oe.url)&&v[0].audioCodec&&!v[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 ei({}),bitrate:0,url:""})),s.trigger(_.MANIFEST_LOADED,{levels:v,audioTracks:Q,subtitles:X,captions:se,contentSteering:d,url:h,stats:t,networkDetails:r,sessionData:S,sessionKeys:M,startTimeOffset:$,variableList:j})}handleTrackOrLevelPlaylist(e,t,i,r,s){const a=this.hls,{id:h,level:g,type:d}=i,v=js(e,i),S=k(g)?g:k(h)?h:0,M=ko(i),$=hr.parseLevelPlaylist(e.data,v,S,M,0,this.variableList);if(d===O.MANIFEST){const j={attrs:new ei({}),bitrate:0,details:$,name:"",url:v};$.requestScheduled=t.loading.start+ia($,0),a.trigger(_.MANIFEST_LOADED,{levels:[j],audioTracks:[],url:v,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=$,this.handlePlaylistLoaded($,e,t,i,r,s)}handleManifestParsingError(e,t,i,r,s){this.hls.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.MANIFEST_PARSING_ERROR,fatal:t.type===O.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:s})}handleNetworkError(e,t,i=!1,r,s){let a=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===O.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===O.AUDIO_TRACK||e.type===O.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const h=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let g=w.UNKNOWN,d=!1;const v=this.getInternalLoader(e);switch(e.type){case O.MANIFEST:g=i?w.MANIFEST_LOAD_TIMEOUT:w.MANIFEST_LOAD_ERROR,d=!0;break;case O.LEVEL:g=i?w.LEVEL_LOAD_TIMEOUT:w.LEVEL_LOAD_ERROR,d=!1;break;case O.AUDIO_TRACK:g=i?w.AUDIO_TRACK_LOAD_TIMEOUT:w.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case O.SUBTITLE_TRACK:g=i?w.SUBTITLE_TRACK_LOAD_TIMEOUT:w.SUBTITLE_LOAD_ERROR,d=!1;break}v&&this.resetInternalLoader(e.type);const S={type:D.NETWORK_ERROR,details:g,fatal:d,url:e.url,loader:v,context:e,error:h,networkDetails:t,stats:s};if(r){const M=(t==null?void 0:t.url)||e.url;S.response=u({url:M,data:void 0},r)}this.hls.trigger(_.ERROR,S)}handlePlaylistLoaded(e,t,i,r,s,a){const h=this.hls,{type:g,level:d,id:v,groupId:S,deliveryDirectives:M}=r,$=js(t,r),j=ko(r),Q=typeof r.level=="number"&&j===m.MAIN?d:void 0;if(!e.fragments.length){const se=e.playlistParsingError=new Error("No Segments found in Playlist");h.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_EMPTY_ERROR,fatal:!1,url:$,error:se,reason:se.message,response:t,context:r,level:Q,parent:j,networkDetails:s,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const X=e.playlistParsingError;if(X){if(this.hls.logger.warn(X),!h.config.ignorePlaylistParsingErrors){h.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:$,error:X,reason:X.message,response:t,context:r,level:Q,parent:j,networkDetails:s,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 O.MANIFEST:case O.LEVEL:h.trigger(_.LEVEL_LOADED,{details:e,levelInfo:r.levelOrTrack||h.levels[0],level:Q||0,id:v||0,stats:i,networkDetails:s,deliveryDirectives:M,withoutMultiVariant:g===O.MANIFEST});break;case O.AUDIO_TRACK:h.trigger(_.AUDIO_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:v||0,groupId:S||"",stats:i,networkDetails:s,deliveryDirectives:M});break;case O.SUBTITLE_TRACK:h.trigger(_.SUBTITLE_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:v||0,groupId:S||"",stats:i,networkDetails:s,deliveryDirectives:M});break}}}class Pr{static get version(){return Dn}static isMSESupported(){return Ro()}static isSupported(){return Vc()}static getMediaSource(){return Y()}static get Events(){return _}static get MetadataSchema(){return $i}static get ErrorTypes(){return D}static get ErrorDetails(){return w}static get DefaultConfig(){return Pr.defaultConfig?Pr.defaultConfig:Fc}static set DefaultConfig(e){Pr.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 ls,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=H(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=Bc(Pr.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Nc(i,t);const{abrController:r,bufferController:s,capLevelController:a,errorController:h,fpsController:g}=i,d=new h(this),v=this.abrController=new r(this),S=new Br(this),M=i.interstitialsController,$=M?this.interstitialsController=new M(this,Pr):null,j=this.bufferController=new s(this,S),Q=this.capLevelController=new a(this),X=new g(this),se=new Qc(this),ce=i.contentSteeringController,oe=ce?new ce(this):null,ve=this.levelController=new zc(this,oe),Ce=new Gc(this),Ue=new Xc(this.config),Ae=this.streamController=new Zc(this,S,Ue),ke=this.gapController=new jc(this,S);Q.setStreamController(Ae),X.setStreamController(Ae);const Pe=[se,ve,Ae];$&&Pe.splice(1,0,$),oe&&Pe.splice(1,0,oe),this.networkControllers=Pe;const Se=[v,j,ke,Q,X,Ce,S];this.audioTrackController=this.createController(i.audioTrackController,Pe);const Xe=i.audioStreamController;Xe&&Pe.push(this.audioStreamController=new Xe(this,S,Ue)),this.subtitleTrackController=this.createController(i.subtitleTrackController,Pe);const ct=i.subtitleStreamController;ct&&Pe.push(this.subtititleStreamController=new ct(this,S,Ue)),this.createController(i.timelineController,Se),Ue.emeController=this.emeController=this.createController(i.emeController,Se),this.cmcdController=this.createController(i.cmcdController,Se),this.latencyController=this.createController(Kc,Se),this.coreComponents=Se,Pe.push(d);const Rt=d.onErrorOut;typeof Rt=="function"&&this.on(_.ERROR,Rt,d),this.on(_.MANIFEST_LOADED,se.onManifestLoaded,se)}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 s=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,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=R.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={[m.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[m.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[m.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=ju()),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){Bt(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 s=r;s--;){const a=e[s].attrs["HDCP-LEVEL"];if(a&&a<=i)return s}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=vi(t);return oi(e,i,navigator.mediaCapabilities)}}Pr.defaultConfig=void 0}}]);
}());