|
|
!(function(){var Mo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[9716],{65352:function(ft,me,b){"use strict";b.d(me,{Z:function(){return Ct}});var k=b(77321),I=b(52487),G=b(74416),T=b(43403),x=b(92310),g=b.n(x),O=b(29301),m=b(76846),n=b(96452),v=b(6089),f=b(80402),c=b(34280),l=b(49658),u=b(59301),p=b(72308),E=b(77900),D=b(8654);function L(Ce){var De=Ce.prefixCls,de=Ce.align,Pe=Ce.arrow,We=Ce.arrowPos,je=Pe||{},J=je.className,oe=je.content,pe=We.x,ue=pe===void 0?0:pe,ye=We.y,Se=ye===void 0?0:ye,Ne=u.useRef();if(!de||!de.points)return null;var Ie={position:"absolute"};if(de.autoArrow!==!1){var Ue=de.points[0],ke=de.points[1],it=Ue[0],Xe=Ue[1],Ye=ke[0],Qe=ke[1];it===Ye||!["t","b"].includes(it)?Ie.top=Se:it==="t"?Ie.top=0:Ie.bottom=0,Xe===Qe||!["l","r"].includes(Xe)?Ie.left=ue:Xe==="l"?Ie.left=0:Ie.right=0}return u.createElement("div",{ref:Ne,className:g()("".concat(De,"-arrow"),J),style:Ie},oe)}function w(Ce){var De=Ce.prefixCls,de=Ce.open,Pe=Ce.zIndex,We=Ce.mask,je=Ce.motion;return We?u.createElement(E.default,(0,p.Z)({},je,{motionAppear:!0,visible:de,removeOnLeave:!0}),function(J){var oe=J.className;return u.createElement("div",{style:{zIndex:Pe},className:g()("".concat(De,"-mask"),oe)})}):null}var A=u.memo(function(Ce){var De=Ce.children;return De},function(Ce,De){return De.cache}),P=A,U=u.forwardRef(function(Ce,De){var de=Ce.popup,Pe=Ce.className,We=Ce.prefixCls,je=Ce.style,J=Ce.target,oe=Ce.onVisibleChanged,pe=Ce.open,ue=Ce.keepDom,ye=Ce.fresh,Se=Ce.onClick,Ne=Ce.mask,Ie=Ce.arrow,Ue=Ce.arrowPos,ke=Ce.align,it=Ce.motion,Xe=Ce.maskMotion,Ye=Ce.forceRender,Qe=Ce.getPopupContainer,at=Ce.autoDestroy,ct=Ce.portal,Ze=Ce.zIndex,yt=Ce.onMouseEnter,Lt=Ce.onMouseLeave,Rt=Ce.onPointerEnter,It=Ce.onPointerDownCapture,Kt=Ce.ready,rt=Ce.offsetX,dt=Ce.offsetY,xe=Ce.offsetR,ge=Ce.offsetB,be=Ce.onAlign,te=Ce.onPrepare,re=Ce.stretch,ae=Ce.targetWidth,he=Ce.targetHeight,_e=typeof de=="function"?de():de,tt=pe||ue,Ke=(Qe==null?void 0:Qe.length)>0,qe=u.useState(!Qe||!Ke),ot=(0,I.Z)(qe,2),Pt=ot[0],Ft=ot[1];if((0,c.Z)(function(){!Pt&&Ke&&J&&Ft(!0)},[Pt,Ke,J]),!Pt)return null;var Bt="auto",vt={left:"-1000vw",top:"-1000vh",right:Bt,bottom:Bt};if(Kt||!pe){var si,_i=ke.points,zt=ke.dynamicInset||((si=ke._experimental)===null||si===void 0?void 0:si.dynamicInset),fi=zt&&_i[0][1]==="r",Nt=zt&&_i[0][0]==="b";fi?(vt.right=xe,vt.left=Bt):(vt.left=rt,vt.right=Bt),Nt?(vt.bottom=ge,vt.top=Bt):(vt.top=dt,vt.bottom=Bt)}var mt={};return re&&(re.includes("height")&&he?mt.height=he:re.includes("minHeight")&&he&&(mt.minHeight=he),re.includes("width")&&ae?mt.width=ae:re.includes("minWidth")&&ae&&(mt.minWidth=ae)),pe||(mt.pointerEvents="none"),u.createElement(ct,{open:Ye||tt,getContainer:Qe&&function(){return Qe(J)},autoDestroy:at},u.createElement(w,{prefixCls:We,open:pe,zIndex:Ze,mask:Ne,motion:Xe}),u.createElement(O.Z,{onResize:be,disabled:!pe},function(Ut){return u.createElement(E.default,(0,p.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Ye,leavedClassName:"".concat(We,"-hidden")},it,{onAppearPrepare:te,onEnterPrepare:te,visible:pe,onVisibleChanged:function(ai){var Ti;it==null||(Ti=it.onVisibleChanged)===null||Ti===void 0||Ti.call(it,ai),oe(ai)}}),function(ei,ai){var Ti=ei.className,Ki=ei.style,yi=g()(We,Ti,Pe);return u.createElement("div",{ref:(0,D.sQ)(Ut,De,ai),className:yi,style:(0,k.Z)((0,k.Z)((0,k.Z)((0,k.Z)({"--arrow-x":"".concat(Ue.x||0,"px"),"--arrow-y":"".concat(Ue.y||0,"px")},vt),mt),Ki),{},{boxSizing:"border-box",zIndex:Ze},je),onMouseEnter:yt,onMouseLeave:Lt,onPointerEnter:Rt,onClick:Se,onPointerDownCapture:It},Ie&&u.createElement(L,{prefixCls:We,arrow:Ie,arrowPos:Ue,align:ke}),u.createElement(P,{cache:!pe&&!ye},_e))})}))}),N=U,H=u.forwardRef(function(Ce,De){var de=Ce.children,Pe=Ce.getTriggerDOMNode,We=(0,D.Yr)(de),je=u.useCallback(function(oe){(0,D.mH)(De,Pe?Pe(oe):oe)},[Pe]),J=(0,D.x1)(je,(0,D.C4)(de));return We?u.cloneElement(de,{ref:J}):de}),F=H,q=u.createContext(null),V=q;function ne(Ce){return Ce?Array.isArray(Ce)?Ce:[Ce]:[]}function ce(Ce,De,de,Pe){return u.useMemo(function(){var We=ne(de!=null?de:De),je=ne(Pe!=null?Pe:De),J=new Set(We),oe=new Set(je);return Ce&&(J.has("hover")&&(J.delete("hover"),J.add("click")),oe.has("hover")&&(oe.delete("hover"),oe.add("click"))),[J,oe]},[Ce,De,de,Pe])}var ee=b(29194);function z(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],de=arguments.length>2?arguments[2]:void 0;return de?Ce[0]===De[0]:Ce[0]===De[0]&&Ce[1]===De[1]}function Z(Ce,De,de,Pe){for(var We=de.points,je=Object.keys(Ce),J=0;J<je.length;J+=1){var oe,pe=je[J];if(z((oe=Ce[pe])===null||oe===void 0?void 0:oe.points,We,Pe))return"".concat(De,"-placement-").concat(pe)}return""}function M(Ce,De,de,Pe){return De||(de?{motionName:"".concat(Ce,"-").concat(de)}:Pe?{motionName:Pe}:null)}function K(Ce){return Ce.ownerDocument.defaultView}function j(Ce){for(var De=[],de=Ce==null?void 0:Ce.parentElement,Pe=["hidden","scroll","clip","auto"];de;){var We=K(de).getComputedStyle(de),je=We.overflowX,J=We.overflowY,oe=We.overflow;[je,J,oe].some(function(pe){return Pe.includes(pe)})&&De.push(de),de=de.parentElement}return De}function R(Ce){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(Ce)?De:Ce}function C(Ce){return R(parseFloat(Ce),0)}function Y(Ce,De){var de=(0,k.Z)({},Ce);return(De||[]).forEach(function(Pe){if(!(Pe instanceof HTMLBodyElement||Pe instanceof HTMLHtmlElement)){var We=K(Pe).getComputedStyle(Pe),je=We.overflow,J=We.overflowClipMargin,oe=We.borderTopWidth,pe=We.borderBottomWidth,ue=We.borderLeftWidth,ye=We.borderRightWidth,Se=Pe.getBoundingClientRect(),Ne=Pe.offsetHeight,Ie=Pe.clientHeight,Ue=Pe.offsetWidth,ke=Pe.clientWidth,it=C(oe),Xe=C(pe),Ye=C(ue),Qe=C(ye),at=R(Math.round(Se.width/Ue*1e3)/1e3),ct=R(Math.round(Se.height/Ne*1e3)/1e3),Ze=(Ue-ke-Ye-Qe)*at,yt=(Ne-Ie-it-Xe)*ct,Lt=it*ct,Rt=Xe*ct,It=Ye*at,Kt=Qe*at,rt=0,dt=0;if(je==="clip"){var xe=C(J);rt=xe*at,dt=xe*ct}var ge=Se.x+It-rt,be=Se.y+Lt-dt,te=ge+Se.width+2*rt-It-Kt-Ze,re=be+Se.height+2*dt-Lt-Rt-yt;de.left=Math.max(de.left,ge),de.top=Math.max(de.top,be),de.right=Math.min(de.right,te),de.bottom=Math.min(de.bottom,re)}}),de}function ie(Ce){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,de="".concat(De),Pe=de.match(/^(.*)\%$/);return Pe?Ce*(parseFloat(Pe[1])/100):parseFloat(de)}function ve(Ce,De){var de=De||[],Pe=(0,I.Z)(de,2),We=Pe[0],je=Pe[1];return[ie(Ce.width,We),ie(Ce.height,je)]}function Me(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[Ce[0],Ce[1]]}function ze(Ce,De){var de=De[0],Pe=De[1],We,je;return de==="t"?je=Ce.y:de==="b"?je=Ce.y+Ce.height:je=Ce.y+Ce.height/2,Pe==="l"?We=Ce.x:Pe==="r"?We=Ce.x+Ce.width:We=Ce.x+Ce.width/2,{x:We,y:je}}function Ee(Ce,De){var de={t:"b",b:"t",l:"r",r:"l"};return Ce.map(function(Pe,We){return We===De?de[Pe]||"c":Pe}).join("")}function Ve(Ce,De,de,Pe,We,je,J){var oe=u.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:We[Pe]||{}}),pe=(0,I.Z)(oe,2),ue=pe[0],ye=pe[1],Se=u.useRef(0),Ne=u.useMemo(function(){return De?j(De):[]},[De]),Ie=u.useRef({}),Ue=function(){Ie.current={}};Ce||Ue();var ke=(0,v.Z)(function(){if(De&&de&&Ce){let ji=function(Dr,Yi){var jt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:gt,Ei=qe.x+Dr,Lr=qe.y+Yi,Rr=Ei+fi,qr=Lr+zt,Yr=Math.max(Ei,jt.left),pt=Math.max(Lr,jt.top),Tt=Math.min(Rr,jt.right),hi=Math.min(qr,jt.bottom);return Math.max(0,(Tt-Yr)*(hi-pt))},un=function(){gr=qe.y+ni,er=gr+zt,Pi=qe.x+ri,mr=Pi+fi};var Ye,Qe,at,ct,Ze=De,yt=Ze.ownerDocument,Lt=K(Ze),Rt=Lt.getComputedStyle(Ze),It=Rt.width,Kt=Rt.height,rt=Rt.position,dt=Ze.style.left,xe=Ze.style.top,ge=Ze.style.right,be=Ze.style.bottom,te=Ze.style.overflow,re=(0,k.Z)((0,k.Z)({},We[Pe]),je),ae=yt.createElement("div");(Ye=Ze.parentElement)===null||Ye===void 0||Ye.appendChild(ae),ae.style.left="".concat(Ze.offsetLeft,"px"),ae.style.top="".concat(Ze.offsetTop,"px"),ae.style.position=rt,ae.style.height="".concat(Ze.offsetHeight,"px"),ae.style.width="".concat(Ze.offsetWidth,"px"),Ze.style.left="0",Ze.style.top="0",Ze.style.right="auto",Ze.style.bottom="auto",Ze.style.overflow="hidden";var he;if(Array.isArray(de))he={x:de[0],y:de[1],width:0,height:0};else{var _e,tt,Ke=de.getBoundingClientRect();Ke.x=(_e=Ke.x)!==null&&_e!==void 0?_e:Ke.left,Ke.y=(tt=Ke.y)!==null&&tt!==void 0?tt:Ke.top,he={x:Ke.x,y:Ke.y,width:Ke.width,height:Ke.height}}var qe=Ze.getBoundingClientRect();qe.x=(Qe=qe.x)!==null&&Qe!==void 0?Qe:qe.left,qe.y=(at=qe.y)!==null&&at!==void 0?at:qe.top;var ot=yt.documentElement,Pt=ot.clientWidth,Ft=ot.clientHeight,Bt=ot.scrollWidth,vt=ot.scrollHeight,si=ot.scrollTop,_i=ot.scrollLeft,zt=qe.height,fi=qe.width,Nt=he.height,mt=he.width,Ut={left:0,top:0,right:Pt,bottom:Ft},ei={left:-_i,top:-si,right:Bt-_i,bottom:vt-si},ai=re.htmlRegion,Ti="visible",Ki="visibleFirst";ai!=="scroll"&&ai!==Ki&&(ai=Ti);var yi=ai===Ki,_r=Y(ei,Ne),Vt=Y(Ut,Ne),gt=ai===Ti?Vt:_r,ht=yi?Vt:gt;Ze.style.left="auto",Ze.style.top="auto",Ze.style.right="0",Ze.style.bottom="0";var wt=Ze.getBoundingClientRect();Ze.style.left=dt,Ze.style.top=xe,Ze.style.right=ge,Ze.style.bottom=be,Ze.style.overflow=te,(ct=Ze.parentElement)===null||ct===void 0||ct.removeChild(ae);var Zt=R(Math.round(fi/parseFloat(It)*1e3)/1e3),At=R(Math.round(zt/parseFloat(Kt)*1e3)/1e3);if(Zt===0||At===0||(0,m.Sh)(de)&&!(0,ee.Z)(de))return;var Ri=re.offset,bi=re.targetOffset,Xi=ve(qe,Ri),ii=(0,I.Z)(Xi,2),ui=ii[0],qt=ii[1],Ci=ve(he,bi),ki=(0,I.Z)(Ci,2),Di=ki[0],Ht=ki[1];he.x-=Di,he.y-=Ht;var Xt=re.points||[],Jt=(0,I.Z)(Xt,2),gi=Jt[0],Si=Jt[1],ci=Me(Si),Mi=Me(gi),zi=ze(he,ci),Li=ze(qe,Mi),nr=(0,k.Z)({},re),ri=zi.x-Li.x+ui,ni=zi.y-Li.y+qt,Vi=ji(ri,ni),Qi=ji(ri,ni,Vt),Cr=ze(he,["t","l"]),Ii=ze(qe,["t","l"]),Nr=ze(he,["b","r"]),or=ze(qe,["b","r"]),lr=re.overflow||{},mi=lr.adjustX,Bi=lr.adjustY,Ur=lr.shiftX,Ji=lr.shiftY,di=function(Yi){return typeof Yi=="boolean"?Yi:Yi>=0},gr,er,Pi,mr;un();var Oi=di(Bi),en=Mi[0]===ci[0];if(Oi&&Mi[0]==="t"&&(er>ht.bottom||Ie.current.bt)){var xi=ni;en?xi-=zt-Nt:xi=Cr.y-or.y-qt;var tn=ji(ri,xi),yn=ji(ri,xi,Vt);tn>Vi||tn===Vi&&(!yi||yn>=Qi)?(Ie.current.bt=!0,ni=xi,qt=-qt,nr.points=[Ee(Mi,0),Ee(ci,0)]):Ie.current.bt=!1}if(Oi&&Mi[0]==="b"&&(gr<ht.top||Ie.current.tb)){var vr=ni;en?vr+=zt-Nt:vr=Nr.y-Ii.y-qt;var rn=ji(ri,vr),Hr=ji(ri,vr,Vt);rn>Vi||rn===Vi&&(!yi||Hr>=Qi)?(Ie.current.tb=!0,ni=vr,qt=-qt,nr.points=[Ee(Mi,0),Ee(ci,0)]):Ie.current.tb=!1}var $r=di(mi),nn=Mi[1]===ci[1];if($r&&Mi[1]==="l"&&(mr>ht.right||Ie.current.rl)){var ur=ri;nn?ur-=fi-mt:ur=Cr.x-or.x-ui;var jr=ji(ur,ni),Ar=ji(ur,ni,Vt);jr>Vi||jr===Vi&&(!yi||Ar>=Qi)?(Ie.current.rl=!0,ri=ur,ui=-ui,nr.points=[Ee(Mi,1),Ee(ci,1)]):Ie.current.rl=!1}if($r&&Mi[1]==="r"&&(Pi<ht.left||Ie.current.lr)){var wi=ri;nn?wi+=fi-mt:wi=Nr.x-Ii.x-ui;var Wr=ji(wi,ni),Tr=ji(wi,ni,Vt);Wr>Vi||Wr===Vi&&(!yi||Tr>=Qi)?(Ie.current.lr=!0,ri=wi,ui=-ui,nr.points=[Ee(Mi,1),Ee(ci,1)]):Ie.current.lr=!1}un();var Ni=Ur===!0?0:Ur;typeof Ni=="number"&&(Pi<Vt.left&&(ri-=Pi-Vt.left-ui,he.x+mt<Vt.left+Ni&&(ri+=he.x-Vt.left+mt-Ni)),mr>Vt.right&&(ri-=mr-Vt.right-ui,he.x>Vt.right-Ni&&(ri+=he.x-Vt.right+Ni)));var Hi=Ji===!0?0:Ji;typeof Hi=="number"&&(gr<Vt.top&&(ni-=gr-Vt.top-qt,he.y+Nt<Vt.top+Hi&&(ni+=he.y-Vt.top+Nt-Hi)),er>Vt.bottom&&(ni-=er-Vt.bottom-qt,he.y>Vt.bottom-Hi&&(ni+=he.y-Vt.bottom+Hi)));var Ot=qe.x+ri,yr=Ot+fi,qi=qe.y+ni,Gr=qi+zt,Kr=he.x,bn=Kr+mt,zr=he.y,sn=zr+Nt,oi=Math.max(Ot,Kr),En=Math.min(yr,bn),an=(oi+En)/2,Sn=an-Ot,on=Math.max(qi,zr),ln=Math.min(Gr,sn),xn=(on+ln)/2,cr=xn-qi;J==null||J(De,nr);var br=wt.right-qe.x-(ri+qe.width),$i=wt.bottom-qe.y-(ni+qe.height);Zt===1&&(ri=Math.round(ri),br=Math.round(br)),At===1&&(ni=Math.round(ni),$i=Math.round($i));var Vr={ready:!0,offsetX:ri/Zt,offsetY:ni/At,offsetR:br/Zt,offsetB:$i/At,arrowX:Sn/Zt,arrowY:cr/At,scaleX:Zt,scaleY:At,align:nr};ye(Vr)}}),it=function(){Se.current+=1;var Qe=Se.current;Promise.resolve().then(function(){Se.current===Qe&&ke()})},Xe=function(){ye(function(Qe){return(0,k.Z)((0,k.Z)({},Qe),{},{ready:!1})})};return(0,c.Z)(Xe,[Pe]),(0,c.Z)(function(){Ce||Xe()},[Ce]),[ue.ready,ue.offsetX,ue.offsetY,ue.offsetR,ue.offsetB,ue.arrowX,ue.arrowY,ue.scaleX,ue.scaleY,ue.align,it]}var Oe=b(80702);function Be(Ce,De,de,Pe,We){(0,c.Z)(function(){if(Ce&&De&&de){let Se=function(){Pe(),We()};var je=De,J=de,oe=j(je),pe=j(J),ue=K(J),ye=new Set([ue].concat((0,Oe.Z)(oe),(0,Oe.Z)(pe)));return ye.forEach(function(Ne){Ne.addEventListener("scroll",Se,{passive:!0})}),ue.addEventListener("resize",Se,{passive:!0}),Pe(),function(){ye.forEach(function(Ne){Ne.removeEventListener("scroll",Se),ue.removeEventListener("resize",Se)})}}},[Ce,De,de])}var ut=b(48736);function xt(Ce,De,de,Pe,We,je,J,oe){var pe=u.useRef(Ce);pe.current=Ce;var ue=u.useRef(!1);u.useEffect(function(){if(De&&Pe&&(!We||je)){var Se=function(){ue.current=!1},Ne=function(at){var ct;pe.current&&!J(((ct=at.composedPath)===null||ct===void 0||(ct=ct.call(at))===null||ct===void 0?void 0:ct[0])||at.target)&&!ue.current&&oe(!1)},Ie=K(Pe);Ie.addEventListener("pointerdown",Se,!0),Ie.addEventListener("mousedown",Ne,!0),Ie.addEventListener("contextmenu",Ne,!0);var Ue=(0,n.A)(de);if(Ue&&(Ue.addEventListener("mousedown",Ne,!0),Ue.addEventListener("contextmenu",Ne,!0)),0)var ke,it,Xe,Ye;return function(){Ie.removeEventListener("pointerdown",Se,!0),Ie.removeEventListener("mousedown",Ne,!0),Ie.removeEventListener("contextmenu",Ne,!0),Ue&&(Ue.removeEventListener("mousedown",Ne,!0),Ue.removeEventListener("contextmenu",Ne,!0))}}},[De,de,Pe,We,je]);function ye(){ue.current=!0}return ye}var st=["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 $t(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T.Z,De=u.forwardRef(function(de,Pe){var We=de.prefixCls,je=We===void 0?"rc-trigger-popup":We,J=de.children,oe=de.action,pe=oe===void 0?"hover":oe,ue=de.showAction,ye=de.hideAction,Se=de.popupVisible,Ne=de.defaultPopupVisible,Ie=de.onPopupVisibleChange,Ue=de.afterPopupVisibleChange,ke=de.mouseEnterDelay,it=de.mouseLeaveDelay,Xe=it===void 0?.1:it,Ye=de.focusDelay,Qe=de.blurDelay,at=de.mask,ct=de.maskClosable,Ze=ct===void 0?!0:ct,yt=de.getPopupContainer,Lt=de.forceRender,Rt=de.autoDestroy,It=de.destroyPopupOnHide,Kt=de.popup,rt=de.popupClassName,dt=de.popupStyle,xe=de.popupPlacement,ge=de.builtinPlacements,be=ge===void 0?{}:ge,te=de.popupAlign,re=de.zIndex,ae=de.stretch,he=de.getPopupClassNameFromAlign,_e=de.fresh,tt=de.alignPoint,Ke=de.onPopupClick,qe=de.onPopupAlign,ot=de.arrow,Pt=de.popupMotion,Ft=de.maskMotion,Bt=de.popupTransitionName,vt=de.popupAnimation,si=de.maskTransitionName,_i=de.maskAnimation,zt=de.className,fi=de.getTriggerDOMNode,Nt=(0,G.Z)(de,st),mt=Rt||It||!1,Ut=u.useState(!1),ei=(0,I.Z)(Ut,2),ai=ei[0],Ti=ei[1];(0,c.Z)(function(){Ti((0,l.Z)())},[]);var Ki=u.useRef({}),yi=u.useContext(V),_r=u.useMemo(function(){return{registerSubPopup:function(Tt,hi){Ki.current[Tt]=hi,yi==null||yi.registerSubPopup(Tt,hi)}}},[yi]),Vt=(0,f.Z)(),gt=u.useState(null),ht=(0,I.Z)(gt,2),wt=ht[0],Zt=ht[1],At=u.useRef(null),Ri=(0,v.Z)(function(pt){At.current=pt,(0,m.Sh)(pt)&&wt!==pt&&Zt(pt),yi==null||yi.registerSubPopup(Vt,pt)}),bi=u.useState(null),Xi=(0,I.Z)(bi,2),ii=Xi[0],ui=Xi[1],qt=u.useRef(null),Ci=(0,v.Z)(function(pt){(0,m.Sh)(pt)&&ii!==pt&&(ui(pt),qt.current=pt)}),ki=u.Children.only(J),Di=(ki==null?void 0:ki.props)||{},Ht={},Xt=(0,v.Z)(function(pt){var Tt,hi,vi=ii;return(vi==null?void 0:vi.contains(pt))||((Tt=(0,n.A)(vi))===null||Tt===void 0?void 0:Tt.host)===pt||pt===vi||(wt==null?void 0:wt.contains(pt))||((hi=(0,n.A)(wt))===null||hi===void 0?void 0:hi.host)===pt||pt===wt||Object.values(Ki.current).some(function(pi){return(pi==null?void 0:pi.contains(pt))||pt===pi})}),Jt=M(je,Pt,vt,Bt),gi=M(je,Ft,_i,si),Si=u.useState(Ne||!1),ci=(0,I.Z)(Si,2),Mi=ci[0],zi=ci[1],Li=Se!=null?Se:Mi,nr=(0,v.Z)(function(pt){Se===void 0&&zi(pt)});(0,c.Z)(function(){zi(Se||!1)},[Se]);var ri=u.useRef(Li);ri.current=Li;var ni=u.useRef([]);ni.current=[];var Vi=(0,v.Z)(function(pt){var Tt;nr(pt),((Tt=ni.current[ni.current.length-1])!==null&&Tt!==void 0?Tt:Li)!==pt&&(ni.current.push(pt),Ie==null||Ie(pt))}),Qi=u.useRef(),Cr=function(){clearTimeout(Qi.current)},Ii=function(Tt){var hi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Cr(),hi===0?Vi(Tt):Qi.current=setTimeout(function(){Vi(Tt)},hi*1e3)};u.useEffect(function(){return Cr},[]);var Nr=u.useState(!1),or=(0,I.Z)(Nr,2),lr=or[0],mi=or[1];(0,c.Z)(function(pt){(!pt||Li)&&mi(!0)},[Li]);var Bi=u.useState(null),Ur=(0,I.Z)(Bi,2),Ji=Ur[0],di=Ur[1],gr=u.useState(null),er=(0,I.Z)(gr,2),Pi=er[0],mr=er[1],Oi=function(Tt){mr([Tt.clientX,Tt.clientY])},en=Ve(Li,wt,tt&&Pi!==null?Pi:ii,xe,be,te,qe),xi=(0,I.Z)(en,11),tn=xi[0],yn=xi[1],vr=xi[2],rn=xi[3],Hr=xi[4],$r=xi[5],nn=xi[6],ur=xi[7],jr=xi[8],Ar=xi[9],wi=xi[10],Wr=ce(ai,pe,ue,ye),Tr=(0,I.Z)(Wr,2),Ni=Tr[0],Hi=Tr[1],Ot=Ni.has("click"),yr=Hi.has("click")||Hi.has("contextMenu"),qi=(0,v.Z)(function(){lr||wi()}),Gr=function(){ri.current&&tt&&yr&&Ii(!1)};Be(Li,ii,wt,qi,Gr),(0,c.Z)(function(){qi()},[Pi,xe]),(0,c.Z)(function(){Li&&!(be!=null&&be[xe])&&qi()},[JSON.stringify(te)]);var Kr=u.useMemo(function(){var pt=Z(be,je,Ar,tt);return g()(pt,he==null?void 0:he(Ar))},[Ar,he,be,je,tt]);u.useImperativeHandle(Pe,function(){return{nativeElement:qt.current,popupElement:At.current,forceAlign:qi}});var bn=u.useState(0),zr=(0,I.Z)(bn,2),sn=zr[0],oi=zr[1],En=u.useState(0),an=(0,I.Z)(En,2),Sn=an[0],on=an[1],ln=function(){if(ae&&ii){var Tt=ii.getBoundingClientRect();oi(Tt.width),on(Tt.height)}},xn=function(){ln(),qi()},cr=function(Tt){mi(!1),wi(),Ue==null||Ue(Tt)},br=function(){return new Promise(function(Tt){ln(),di(function(){return Tt})})};(0,c.Z)(function(){Ji&&(wi(),Ji(),di(null))},[Ji]);function $i(pt,Tt,hi,vi){Ht[pt]=function(pi){var Zr;vi==null||vi(pi),Ii(Tt,hi);for(var kr=arguments.length,Ir=new Array(kr>1?kr-1:0),cn=1;cn<kr;cn++)Ir[cn-1]=arguments[cn];(Zr=Di[pt])===null||Zr===void 0||Zr.call.apply(Zr,[Di,pi].concat(Ir))}}(Ot||yr)&&(Ht.onClick=function(pt){var Tt;ri.current&&yr?Ii(!1):!ri.current&&Ot&&(Oi(pt),Ii(!0));for(var hi=arguments.length,vi=new Array(hi>1?hi-1:0),pi=1;pi<hi;pi++)vi[pi-1]=arguments[pi];(Tt=Di.onClick)===null||Tt===void 0||Tt.call.apply(Tt,[Di,pt].concat(vi))});var Vr=xt(Li,yr,ii,wt,at,Ze,Xt,Ii),ji=Ni.has("hover"),un=Hi.has("hover"),Dr,Yi;ji&&($i("onMouseEnter",!0,ke,function(pt){Oi(pt)}),$i("onPointerEnter",!0,ke,function(pt){Oi(pt)}),Dr=function(Tt){(Li||lr)&&wt!==null&&wt!==void 0&&wt.contains(Tt.target)&&Ii(!0,ke)},tt&&(Ht.onMouseMove=function(pt){var Tt;(Tt=Di.onMouseMove)===null||Tt===void 0||Tt.call(Di,pt)})),un&&($i("onMouseLeave",!1,Xe),$i("onPointerLeave",!1,Xe),Yi=function(){Ii(!1,Xe)}),Ni.has("focus")&&$i("onFocus",!0,Ye),Hi.has("focus")&&$i("onBlur",!1,Qe),Ni.has("contextMenu")&&(Ht.onContextMenu=function(pt){var Tt;ri.current&&Hi.has("contextMenu")?Ii(!1):(Oi(pt),Ii(!0)),pt.preventDefault();for(var hi=arguments.length,vi=new Array(hi>1?hi-1:0),pi=1;pi<hi;pi++)vi[pi-1]=arguments[pi];(Tt=Di.onContextMenu)===null||Tt===void 0||Tt.call.apply(Tt,[Di,pt].concat(vi))}),zt&&(Ht.className=g()(Di.className,zt));var jt=(0,k.Z)((0,k.Z)({},Di),Ht),Ei={},Lr=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Lr.forEach(function(pt){Nt[pt]&&(Ei[pt]=function(){for(var Tt,hi=arguments.length,vi=new Array(hi),pi=0;pi<hi;pi++)vi[pi]=arguments[pi];(Tt=jt[pt])===null||Tt===void 0||Tt.call.apply(Tt,[jt].concat(vi)),Nt[pt].apply(Nt,vi)})});var Rr=u.cloneElement(ki,(0,k.Z)((0,k.Z)({},jt),Ei)),qr={x:$r,y:nn},Yr=ot?(0,k.Z)({},ot!==!0?ot:{}):null;return u.createElement(u.Fragment,null,u.createElement(O.Z,{disabled:!Li,ref:Ci,onResize:xn},u.createElement(F,{getTriggerDOMNode:fi},Rr)),u.createElement(V.Provider,{value:_r},u.createElement(N,{portal:Ce,ref:Ri,prefixCls:je,popup:Kt,className:g()(rt,Kr),style:dt,target:ii,onMouseEnter:Dr,onMouseLeave:Yi,onPointerEnter:Dr,zIndex:re,open:Li,keepDom:lr,fresh:_e,onClick:Ke,onPointerDownCapture:Vr,mask:at,motion:Jt,maskMotion:gi,onVisibleChanged:cr,onPrepare:br,forceRender:Lt,autoDestroy:mt,getPopupContainer:yt,align:Ar,arrow:Yr,arrowPos:qr,ready:tn,offsetX:yn,offsetY:vr,offsetR:rn,offsetB:Hr,onAlign:qi,stretch:ae,targetWidth:sn/ur,targetHeight:Sn/jr})))});return De}var Ct=$t(T.Z)},36610:function(ft,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"}},12635:function(ft,me,b){"use strict";var k=b(59301),I=b(93314),G=b(99571),T=Object.defineProperty,x=Object.defineProperties,g=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,v=(u,p,E)=>p in u?T(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)&&v(u,E,p[E]);if(O)for(var E of O(p))n.call(p,E)&&v(u,E,p[E]);return u},c=(u,p)=>x(u,g(p));const l=({img:u,buttonProps:p={},styles:E={},customText:D,ButtonText:L,ButtonClick:w,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"},D||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),L&&k.createElement(G.ZP,f({className:A,onClick:w},p),L),P&&P);me.Z=l},6311:function(ft,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"},G=b(99571),T=b(70557),x=b(89081),g=b(25399),O=b(59895),m=b(76011),n=b(12635),v=b(12242),f=b(65789),c=b(59301),l=Object.defineProperty,u=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,D=(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)&&D(P,N,U[N]);if(u)for(var N of u(U))E.call(U,N)&&D(P,N,U[N]);return P},w=(P,U,N)=>new Promise((H,F)=>{var q=ce=>{try{ne(N.next(ce))}catch(ee){F(ee)}},V=ce=>{try{ne(N.throw(ce))}catch(ee){F(ee)}},ne=ce=>ce.done?H(ce.value):Promise.resolve(ce.value).then(q,V);ne((N=N.apply(P,U)).next())}),A=({editOffice:P="view",data:U,theme:N,type:H,filename:F,monacoEditor:q,className:V,style:ne,close:ce,onClose:ee,hasMask:z,disabledDownload:Z,onImgDimensions:M,showNodata:K,recordInfo:j})=>{const[R,C]=(0,k.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Y,ie]=(0,k.useState)(""),[ve,Me]=(0,k.useState)(),ze=window.ENV==="build"?"/react/build":"",Ee=location.host.startsWith("localhost")?v.Z.PROXY_SERVER:v.Z.API_SERVER,Oe=10*(1024*1024),Be=(0,k.useRef)();U!=null&&U.startsWith("/api")&&H!=="txt"&&(U=v.Z.API_SERVER+U);const ut=Ct=>Ct.substring(Ct.lastIndexOf("/")+1).split(".").pop();F&&q&&(q.filename=F),(0,k.useEffect)(()=>{var Ct,Ce;const De=(Ce=(Ct=document.cookie)==null?void 0:Ct.replace(/\s/g,""))==null?void 0:Ce.split(";");De==null||De.map(de=>{let Pe=de.split("=");Pe[0]==="_educoder_session"&&ie(Pe[1])})},[]),(0,k.useEffect)(()=>{H==="office"&&(U.indexOf("bigfilescdn.")>-1||U.indexOf("bigfiles1")>-1?Me({url:U,fileType:ut(U),model:U.indexOf("model=edit")?"edit":"view"}):xt())},[H,U]);const xt=()=>w(void 0,null,function*(){console.log("data:",U);let Ct=U;U.startsWith("http")||(Ct=location.origin+Ct);let Ce=new URL(Ct).pathname.split("/").pop();const De=yield(0,m.gJ)({attachment_id:Ce});De.url=Ee+De.url,Me(De)}),st=()=>{if(U.startsWith("http")||U.startsWith("blob:")){$t();return}(0,O.Sv)(F||"educoder",U,F)},$t=()=>{j&&(0,f.fc)({id:j==null?void 0:j.id,watch_type:1,course_id:j==null?void 0:j.course_id}),(0,O.Nd)(F||"educoder",decodeURIComponent(U))};return c.createElement("div",{style:L({},ne||{}),className:`${z&&I.bgBlack} ${H?I.wrp:"hide"}`},ce&&c.createElement("div",{className:I.close,ref:Be},!!M&&c.createElement(g.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>Be.current},c.createElement("span",{onClick:()=>{ee(),M()}},c.createElement("i",{className:"icon-yulanpizhu"}))),!Z&&c.createElement(g.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>Be.current},c.createElement("span",{onClick:$t},c.createElement("i",{className:"icon-quxiaozhiding"}))),c.createElement(g.Z,{title:"\u5173\u95ED",getPopupContainer:()=>Be.current},c.createElement("span",{className:"",onClick:ee},c.createElement("i",{className:"icon-guanbi1"})))),c.createElement("div",{className:`${I[V]} ${V} ${I.monaco} ${H==="txt"?"show":"hide"}`},H==="txt"&&c.createElement(c.Fragment,null,c.createElement(x.ZP,L({},q)))),H==="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}),H==="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})),H==="office"&&ve&&c.createElement("iframe",{src:`${ze}/office.html?key=${ve.key}&url=${btoa(ve.url)}&callbackUrl=${Ee+(ve.callbackUrl||"")}&fileType=${ve.fileType}&title=${ve.title||""}&model=${P}&officeServer=${v.Z.ONLYOFFICE}&disabledDownload=${!!Z}`}),H==="html"&&c.createElement("iframe",{src:U+"&disposition=inline"}),H==="pdf"&&c.createElement("iframe",{src:`${ze}/js/pdfview/index.html?filename=${F||"educoder.pdf"}&url=${encodeURIComponent(U)}&disabledDownload=${!!Z}`}),H==="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}`}),(H==="other"||H==="download")&&c.createElement(c.Fragment,null,K?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(G.ZP,{icon:c.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:st,disabled:Z},"\u4E0B\u8F7D")}):c.createElement(G.ZP,{type:"primary",size:"middle",onClick:st,disabled:Z},c.createElement(T.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")))}},79074:function(ft,me,b){"use strict";b.d(me,{z:function(){return H},Z:function(){return F}});var k=b(59301),I=b(53122),G=b(49405),T=b(64018),x=b(79710),g=b(12242),O=b(59895),m=b(15342),n=b(1012),v=b(6311),f=b(59301),l=({html:q})=>{const V=(0,k.useRef)(null),ne=(0,k.useRef)(null),ce=`.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 36px !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 ee=V.current.attachShadow({mode:"open"});ne.current=document.createElement("div"),ne.current.className="markdown-body",ne.current.innerHTML=q,ee.appendChild(ne.current);const z=document.createElement("style");return z.textContent=ce,ee.appendChild(z),()=>{ee.innerHTML=""}},[]),(0,k.useEffect)(()=>{ne.current&&(ne.current.innerHTML=q)},[q]),f.createElement("div",{ref:V})},u=Object.defineProperty,p=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,L=(q,V,ne)=>V in q?u(q,V,{enumerable:!0,configurable:!0,writable:!0,value:ne}):q[V]=ne,w=(q,V)=>{for(var ne in V||(V={}))E.call(V,ne)&&L(q,ne,V[ne]);if(p)for(var ne of p(V))D.call(V,ne)&&L(q,ne,V[ne]);return q};const A="@\u2581\u2581@",P="@\u2581@",U=/<pre[^>]*>/g;function N(q){let V=document.createElement("div");return V.innerHTML=q,V.childNodes.length===0?"":V.childNodes[0].nodeValue}const H=(q,V)=>{q=q||"";const ne=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,ce=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,ee=/\(\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 V?q.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(ne,(Z,M,K,j,R,C,Y)=>{const ie=M||j||C,ve=K||R||Y||"?";return g.Z.API_SERVER+"/api/attachments/"+ie+ve+"&t="+(0,O.Jn)(ie,Date.now())+(Z.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(q=q.replace(z,(Z,M,K,j,R,C,Y)=>{const ie=M||j||C,ve=K||R||Y||"?";return g.Z.API_SERVER+"/attachments/download/"+ie+ve+"&t="+(0,O.Jn)(ie,Date.now())+(Z.indexOf(")")>-1?")":"&")}).replace(ne,(Z,M,K,j,R,C,Y)=>{const ie=M||j||C,ve=K||R||Y||"?";return g.Z.API_SERVER+"/api/attachments/"+ie+ve+"&t="+(0,O.Jn)(ie,Date.now())+(Z.indexOf(")")>-1?")":"&")}).replace(ce,(Z,M,K,j,R)=>{const C=M||j,Y=K||R||"";return'"'+g.Z.API_SERVER+"/api/attachments/"+C+Y+C+Y+"&t="+(0,O.Jn)(C,Date.now())}).replace(ee,(Z,M,K,j,R)=>{const C=M||j,Y=K||R||"";return"("+g.Z.API_SERVER+"/files/uploads/"+C+Y+C+Y+"&t="+(0,O.Jn)(C,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,`
|
|
|
`),q)};var F=({value:q="",className:V,showTextOnly:ne,showLines:ce,style:ee={},stylesPrev:z={},highlightKeywords:Z,showProgramFill:M,isProgramFill:K,disabledFill:j=!1,programFillValue:R,onFillChange:C=ve=>{},onFillBlur:Y=()=>{},onFillFocus:ie=()=>{}})=>{let ve=String(q);const[Me,ze]=(0,k.useState)(""),[Ee,Ve]=(0,k.useState)("office"),[Oe,Be]=(0,k.useState)([]),ut=(0,k.useRef)("a"+(0,n.Z)()),xt={},st=(ue,ye,Se)=>{const Ne=document.createElement(ue===P?"input":"textarea");Ne.style.width="100%",Ne.style.height=ue===P?"40px":"151px",Ne.rows=5,Ne.spellcheck=!1,Ne.name="edu-program-fill",Ne.placeholder="\u8BF7\u8F93\u5165",Ne.dataset.id=ye;const Ie=Object.keys(xt).length;return xt[Ie]=Ne,`<span class="edu-program-fill-wrap ${ue===P?"":"show"}" style="width:${ue===P?"400px":"100%"}" title=${Se||""}><span>${Ne.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function $t(ue){return ue=ue.replace(/!\[.*?\]\(.*?\)/g,""),ue=ue.replace(/\[.*?\]\(.*?\)/g,""),ue=ue.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),ue=ue.replace(/<embed.*?>/g,""),ue=ue.replace(/<img.*?>/g,""),ue=ue.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),ue=ue.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),ue=ue.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),ue=ue.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),ue}const Ct=ue=>ue.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(ye,Se){let Ne=Se.replace(/(\n|\r)/g,"").split("}"),Ie=[];return Ne.map(Ue=>{Ue!=""&&Ie.push(`.${ut.current} ${Ue}`)}),`<style>${Ie.join("}")}</style>`}),Ce=(0,k.useMemo)(()=>{try{const Ne=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,Ie=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ue=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,ke=/\(\/attachments\/download\//g;ve=ve.replace(ke,"("+g.Z.API_SERVER+"/attachments/download/").replace(Ne,"("+g.Z.API_SERVER+"/api/attachments/").replace(Ie,'"'+g.Z.API_SERVER+"/api/attachments/").replace(Ue,'"'+g.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(M){let Ne=-1;return ve=ve.replaceAll("<","<").replaceAll(">",">").replace(/(@▁▁@|@▁@)/g,function(Ie,Ue,ke){var it;return++Ne,st(Ie,Ne,(it=R==null?void 0:R[Ne])==null?void 0:it.value.replaceAll("<","<").replaceAll(">",">"))}),`<pre style="background:#fff;padding:4px">${Ct(ve||"")}</pre>`}let ue=Ct(ve);ue=(0,G.ZP)(ue);const ye=(0,G.ez)();ve.match(/\[TOC\]/)&&(ue=ue.replace("<p>[TOC]</p>",(0,G.Qv)()),(0,G.Iy)()),ue=ue.replace(/(__special_katext_id_\d+__)/g,(Ne,Ie)=>{const{type:Ue,expression:ke}=ye[Ie];return(0,m.renderToString)(N(ke)||"",{displayMode:Ue==="block",throwOnError:!1,output:"html"})}),ue=ue.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,G.AL)();const Se=document.createElement("div");if(Se.innerHTML=ue,ne)return Se.innerText;if(Z){const Ne=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return We(Se,Ne),Se.innerHTML}return setTimeout(()=>oe(),500),Se.innerHTML},[ve,Z]);(0,k.useEffect)(()=>{je.current&&je.current.querySelectorAll(["input","textarea"]).forEach(ye=>{ye.oninput=De,ye.onblur=de,ye.onfocus=Pe})},[Oe]),(0,k.useEffect)(()=>{var ue,ye,Se,Ne,Ie;if(R!=null&&R.length)try{const Ue=je.current.querySelectorAll(".edu-program-fill-score"),ke=je.current.querySelectorAll('[name="edu-program-fill"]');for(const[it,Xe]of ke.entries())Xe.value=((ue=R==null?void 0:R[it])==null?void 0:ue.value)||"",((ye=R==null?void 0:R[it])==null?void 0:ye.type)==="warning"?Xe.className="program-fill-warning":((Se=R==null?void 0:R[it])==null?void 0:Se.type)==="success"?Xe.className="program-fill-success":Xe.className="";for(const[it,Xe]of Ue.entries())Xe.innerHTML=(Ne=R==null?void 0:R[it])!=null&&Ne.score?`${(Ie=R==null?void 0:R[it])==null?void 0:Ie.score}\u5206`:"";Be(R)}catch(Ue){console.log(Ue,"error")}},[R]);const De=ue=>{Oe[ue.target.dataset.id]=Oe[ue.target.dataset.id]||{},Oe[ue.target.dataset.id].value=ue.target.value,Be([...Oe]),C(Oe,ue.target.dataset.id)},de=ue=>{Oe[ue.target.dataset.id]=Oe[ue.target.dataset.id]||{},Oe[ue.target.dataset.id].value=ue.target.value,Be([...Oe]),Y(Oe,ue.target.dataset.id)},Pe=ue=>{Oe[ue.target.dataset.id]=Oe[ue.target.dataset.id]||{},Oe[ue.target.dataset.id].value=ue.target.value,Be([...Oe]),ie(Oe,ue.target.dataset.id)};function We(ue,ye){return ue.childNodes.forEach(Se=>{var Ne;if(Se.childNodes.length>0)We(Se,ye);else if(Se.nodeName!=="IMG")if(Se.innerHTML)Se.innerHTML=(Ne=Se.innerHTML)==null?void 0:Ne.replace(new RegExp(ye,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const Ie=document.createElement("span");Ie.innerHTML=Se.textContent.replace(new RegExp(ye,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),Se.replaceWith(Ie)}})}const je=(0,k.useRef)();G.jb.WebkitLineClamp=ce,ce&&(ee=w(w({},ee),G.jb));function J(ue){let ye=ue.target;if(ye.tagName.toUpperCase()==="A"){let Se=ye.getAttribute("href");if(Se.indexOf("office")>-1)ue.preventDefault(),ze(Se),Ve("office");else if(Se.indexOf("application/pdf")>-1)ue.preventDefault(),ze(Se),Ve("pdf");else if(Se.indexOf("text/html")>-1)ue.preventDefault(),ze(Se),Ve("html");else if(Se.startsWith("#")){ue.preventDefault();let Ne=document.getElementById(Se.replace("#",""));Ne&&Ne.scrollIntoView(!0)}}}const oe=()=>{var ue;const ye=(ue=je.current)==null?void 0:ue.querySelectorAll("video");ye==null||ye.forEach(Se=>{if(Se.oncontextmenu=()=>!1,Se.src.indexOf(".m3u8")>-1&&!Se.canPlayType("application/vnd.apple.mpegurl")){if(x.ZP.isSupported()){var Ne=new x.ZP;Ne.loadSource(Se.src),Ne.attachMedia(Se)}}})};(0,k.useEffect)(()=>{if(je.current&&Ce&&Ce.match(U)&&window.PR.prettyPrint(),je.current)return je.current.addEventListener("click",J),()=>{var ue;(ue=je.current)==null||ue.removeEventListener("click",J),(0,G.AL)(),(0,G.Iy)()}},[Ce,je.current,J]),(0,k.useEffect)(()=>{var ue;const ye=Se=>{Se.preventDefault(),Se.clipboardData.setData("text",window.getSelection().toString())};return(ue=je.current)==null||ue.addEventListener("copy",ye),()=>{var Se;(Se=je.current)==null||Se.removeEventListener("copy",ye)}},[je.current]);const pe=ue=>/<style[\s\S]*?>/i.test(ue||"");return k.createElement(k.Fragment,null,ne&&k.createElement("div",{ref:je},Ce),!ne&&!pe(Ce)&&k.createElement("div",{ref:je,style:w({},ee),className:`${V||""} ${j?"disabled-fill":""} markdown-body ${ut.current}`,dangerouslySetInnerHTML:{__html:Ce}}),!ne&&pe(Ce)&&k.createElement(l,{html:Ce}),k.createElement(v.Z,{close:!0,data:Me,type:Me!=null&&Me.length?Ee:"",style:w({},z),onClose:()=>ze("")}))}},32984:function(ft,me,b){"use strict";b.d(me,{Z:function(){return T}});var k=b(71570),I={ldsRing:"ldsRing___mpBZC",idsRingWrapper:"idsRingWrapper___Of9_n",ldsring:"ldsring___o0w2t"},G=b(59301),T=({message:x,className:g,children:O,style:m={}})=>G.createElement("div",{className:`custom-spinner ${I.idsRingWrapper} ${g}`},G.createElement("div",{className:I.ldsRing},G.createElement("div",null),G.createElement("div",null),G.createElement("div",null),G.createElement("div",null)),x?G.createElement("p",{style:m},x):null,O,G.createElement(k.Outlet,null))},87700:function(ft,me,b){"use strict";b.d(me,{Z:function(){return g}});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_"},G=b(92310),T=b.n(G),g=({className:O,style:m={},leftNode:n,leftTitle:v="\u81EA\u6D4B\u8F93\u5165",rightNode:f,rightTitle:c="\u8FD0\u884C\u7ED3\u679C"})=>k.createElement("div",{className:T()(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,v)),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)))},89081:function(ft,me,b){"use strict";b.d(me,{SV:function(){return je},ZP:function(){return We}});var k=b(59301),I=b(76374);const G={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"]},T={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"]},x={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(`
|
|
|
`)}]},g={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),v=Object.defineProperty,f=Object.defineProperties,c=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,E=(J,oe,pe)=>oe in J?v(J,oe,{enumerable:!0,configurable:!0,writable:!0,value:pe}):J[oe]=pe,D=(J,oe)=>{for(var pe in oe||(oe={}))u.call(oe,pe)&&E(J,pe,oe[pe]);if(l)for(var pe of l(oe))p.call(oe,pe)&&E(J,pe,oe[pe]);return J},L=(J,oe)=>f(J,c(oe)),w=(J,oe,pe)=>new Promise((ue,ye)=>{var Se=Ue=>{try{Ie(pe.next(Ue))}catch(ke){ye(ke)}},Ne=Ue=>{try{Ie(pe.throw(Ue))}catch(ke){ye(ke)}},Ie=Ue=>Ue.done?ue(Ue.value):Promise.resolve(Ue.value).then(Se,Ne);Ie((pe=pe.apply(J,oe)).next())});const A={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"]}},P=(J,oe)=>oe.map(pe=>({label:pe,kind:J.languages.CompletionItemKind.Keyword,insertText:pe})),U=J=>Object.keys(A.tables).map(oe=>({label:oe,kind:J.languages.CompletionItemKind.Variable,insertText:oe})),N=(J,oe)=>{const pe=A.tables[J];return pe?pe.map(ue=>({label:ue,kind:oe.languages.CompletionItemKind.Field,insertText:ue})):[]};function H(J,oe,pe,ue,ye){let Se=oe.getWordUntilPosition(pe),Ne={startLineNumber:pe.lineNumber,endLineNumber:pe.lineNumber,startColumn:Se.startColumn,endColumn:Se.endColumn},Ie=ue.map(Ue=>({label:Ue,kind:J.languages.CompletionItemKind.Keyword,insertText:Ue,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ne}));return ye.map(Ue=>{Ie.push(L(D({},Ue),{range:Ne}))}),Ie}var F=J=>{A.languages.map(ye=>(J.languages.registerDocumentFormattingEditProvider(ye,{provideDocumentFormattingEdits(Se,Ne,Ie){return w(this,null,function*(){const Ue=n()(Se.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:Se.getFullModelRange(),text:Ue}]})}}),ye));const oe=x.quickKey.map(ye=>({label:ye.label,kind:J.languages.CompletionItemKind.Method,insertText:ye.content,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet})),pe=g.quickKey.map(ye=>({label:ye.label,kind:J.languages.CompletionItemKind.Method,insertText:ye.content,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet})),ue=T.quickKey.map(ye=>({label:ye.label,kind:J.languages.CompletionItemKind.Method,insertText:ye.content,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet}));J.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(ye,Se){var Ne=ye.getWordUntilPosition(Se),Ie={startLineNumber:Se.lineNumber,endLineNumber:Se.lineNumber,startColumn:Ne.startColumn,endColumn:Ne.endColumn},Ue=ye.getLineContent(Se.lineNumber).substring(Ne.startColumn-2,Ne.endColumn);return{suggestions:[...x.keywords.map(ke=>({label:ke,kind:J.languages.CompletionItemKind.Function,documentation:ke,insertText:ke,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ie})),...x.quickKey.map(ke=>({label:ke.label,kind:J.languages.CompletionItemKind.Function,documentation:ke.content,insertText:Ue.startsWith("#")?ke.content.replace(/#/,""):ke.content,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ie}))]}}}),J.languages.registerCompletionItemProvider("c",{provideCompletionItems:function(ye,Se){var Ne=ye.getWordUntilPosition(Se),Ie={startLineNumber:Se.lineNumber,endLineNumber:Se.lineNumber,startColumn:Ne.startColumn,endColumn:Ne.endColumn};return{suggestions:[...G.keywords.map(Ue=>({label:Ue,kind:J.languages.CompletionItemKind.Function,documentation:Ue,insertText:Ue,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ie}))]}}}),J.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(ye,Se){var Ne=ye.getWordUntilPosition(Se),Ie={startLineNumber:Se.lineNumber,endLineNumber:Se.lineNumber,startColumn:Ne.startColumn,endColumn:Ne.endColumn},Ue=ye.getLineContent(Se.lineNumber).substring(Ne.startColumn-2,Ne.endColumn);return{suggestions:[...T.keywords.map(ke=>({label:ke,kind:J.languages.CompletionItemKind.Function,documentation:ke,insertText:ke,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ie})),...T.quickKey.map(ke=>({label:ke.label,kind:J.languages.CompletionItemKind.Function,documentation:ke.content,insertText:Ue.startsWith("#")?ke.content.replace(/#/,""):ke.content,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ie}))]}}}),J.languages.registerCompletionItemProvider("scala",{provideCompletionItems:function(ye,Se){var Ne=ye.getWordUntilPosition(Se),Ie={startLineNumber:Se.lineNumber,endLineNumber:Se.lineNumber,startColumn:Ne.startColumn,endColumn:Ne.endColumn},Ue=ye.getLineContent(Se.lineNumber).substring(Ne.startColumn-2,Ne.endColumn);return{suggestions:[...O.keywords.map(ke=>({label:ke,kind:J.languages.CompletionItemKind.Function,documentation:ke,insertText:ke,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ie})),...O.quickKey.map(ke=>({label:ke.label,kind:J.languages.CompletionItemKind.Function,documentation:ke.content,insertText:Ue.startsWith("#")?ke.content.replace(/#/,""):ke.content,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ie}))]}}}),J.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(ye,Se){var Ne=ye.getWordUntilPosition(Se),Ie={startLineNumber:Se.lineNumber,endLineNumber:Se.lineNumber,startColumn:Ne.startColumn,endColumn:Ne.endColumn},Ue=ye.getLineContent(Se.lineNumber).substring(Ne.startColumn-2,Ne.endColumn);return{suggestions:[...g.keywords.map(ke=>({label:ke,kind:J.languages.CompletionItemKind.Function,documentation:ke,insertText:ke,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ie})),...g.quickKey.map(ke=>({label:ke.label,kind:J.languages.CompletionItemKind.Function,documentation:ke.content,insertText:Ue.startsWith("#")?ke.content.replace(/#/,""):ke.content,insertTextRules:J.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ie}))]}}})};const q="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var V=Object.defineProperty,ne=(J,oe,pe)=>oe in J?V(J,oe,{enumerable:!0,configurable:!0,writable:!0,value:pe}):J[oe]=pe,ce=(J,oe,pe)=>ne(J,typeof oe!="symbol"?oe+"":oe,pe);const ee=class Bo{constructor(oe,pe,ue){this.placeholder=oe,this.editor=pe,this.monaco=ue,pe.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return Bo.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)}};ce(ee,"ID","editor.widget.placeholderHint");var Z=ee,M=b(96236),K=b(6767),j=b(25399),R=b(89392),C=b(16448),Y=b(56102),ie=Object.defineProperty,ve=Object.defineProperties,Me=Object.getOwnPropertyDescriptors,ze=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,Oe=(J,oe,pe)=>oe in J?ie(J,oe,{enumerable:!0,configurable:!0,writable:!0,value:pe}):J[oe]=pe,Be=(J,oe)=>{for(var pe in oe||(oe={}))Ee.call(oe,pe)&&Oe(J,pe,oe[pe]);if(ze)for(var pe of ze(oe))Ve.call(oe,pe)&&Oe(J,pe,oe[pe]);return J},ut=(J,oe)=>ve(J,Me(oe)),xt=(J,oe)=>{var pe={};for(var ue in J)Ee.call(J,ue)&&oe.indexOf(ue)<0&&(pe[ue]=J[ue]);if(J!=null&&ze)for(var ue of ze(J))oe.indexOf(ue)<0&&Ve.call(J,ue)&&(pe[ue]=J[ue]);return pe},st=(J,oe,pe)=>new Promise((ue,ye)=>{var Se=Ue=>{try{Ie(pe.next(Ue))}catch(ke){ye(ke)}},Ne=Ue=>{try{Ie(pe.throw(Ue))}catch(ke){ye(ke)}},Ie=Ue=>Ue.done?ue(Ue.value):Promise.resolve(Ue.value).then(Se,Ne);Ie((pe=pe.apply(J,oe)).next())});function $t(J){return/^\d+$/.test(J)?`${J}px`:J}function Ct(){}let Ce=!1;const De={"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 de(J=[]){let oe=J;if(Array.isArray(J)){for(let pe=0;pe<J.length;pe++){let ue=De[J[pe]];if(ue)return ue}return oe[0]}return De[oe]||oe}let Pe=null;var We=J=>{var oe=J,{width:pe="100%",height:ue="100%",value:ye,language:Se="javascript",style:Ne={},options:Ie={},overrideServices:Ue={},theme:ke="vs-dark",onEditBlur:it,isCopy:Xe=!1,onSave:Ye,autoHeight:Qe=!1,forbidCopy:at=!1,onChange:ct=Ct,editorDidMount:Ze=Ct,onFocus:yt=Ct,onBreakPoint:Lt=Ct,breakPointValue:Rt=[],filename:It="educoder.txt",errorLine:Kt,errorContent:rt="",highlightLine:dt,openBreakPoint:xe=!1,placeholder:ge="",showMiniMap:be=!0}=oe,te=xt(oe,["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 re=(0,k.useRef)(),ae=(0,k.useRef)({}),he=(0,k.useRef)(),_e=(0,k.useRef)(),tt=(0,k.useRef)([]),Ke=(0,k.useRef)(!1),qe=(0,k.useRef)(),ot=(0,k.useRef)(),Pt=(0,k.useRef)(!1),[Ft,Bt]=(0,k.useState)(!1);function vt(){let gt;return re.current&&(gt=new I.Z(ht=>{for(let wt of ht)(wt.target.offsetHeight>0||wt.target.offsetWidth>0)&&ae.current.instance.layout()}),gt.observe(re.current)),gt}function si(){K.ZP.warning({content:decodeURIComponent(q),key:"monaco-editor-tip"})}const _i=()=>{let gt=ae.current.instance;if(ye!=null&>&&Ft){const ht=gt.getModel();ht&&ye!==ht.getValue()&&(Ce=!0,ht.setValue(ye),gt.layout(),Ce=!1)}};(0,k.useEffect)(()=>{const gt=C.Z.subscribe("formatDocument",ht=>{var wt;let Zt=ae.current.instance;(wt=Zt==null?void 0:Zt.getAction)==null||wt.call(Zt,"editor.action.formatDocument").run()});return window.updateMonacoValue=ht=>{ct(ht)},gt},[]),(0,k.useEffect)(()=>{var gt;let ht=ae.current.instance;_e.current&&clearTimeout(_e.current),_e.current=setTimeout(()=>{_i()},500),ye&&(ye!=null&&ye.length)&&((gt=ht==null?void 0:ht.updateOptions)==null||gt.call(ht,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(ye.split(/\r\n|\r|\n/g).length))+3,5)}))},[ye,Ft,ae.current]),(0,k.useEffect)(()=>{if(Kt&&ae.current&&ae.current.instance){let ht=ae.current.instance;ht.changeViewZones(function(wt){var Zt=document.createElement("div");Zt.style.padding="10px 20px",Zt.style.width="calc(100% - 20px)",Zt.className="my-error-line-wrp",Zt.innerHTML=rt,wt.addZone({afterLineNumber:Kt||11,heightInLines:3,domNode:Zt})});var gt={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}};ht.addOverlayWidget(gt),ht.revealPositionInCenter({lineNumber:20,column:1})}},[Kt,ae.current,Ft]);const zt=(gt="",ht)=>{if(!gt||gt.trim()==="")return!0;const Zt=ae.current.instance.getModel().getLineTokens(ht);let At=!1;for(let Ri=0;Ri<2;Ri++)Zt.getStandardTokenType(Ri)===1&&(At=!0);return At};(0,k.useEffect)(()=>{var gt;const ht=(gt=ae.current)==null?void 0:gt.instance;if(ht&&Ft&&at){const wt=ht.onDidBlurEditorWidget(()=>{Pt.current=!1}),Zt=ht.onDidFocusEditorText(()=>{Pt.current=!0});return()=>{wt.dispose(),Zt.dispose()}}},[ae.current,Ft,at]),(0,k.useEffect)(()=>{var gt;if((gt=ae.current)!=null&>.instance&&Ft&&xe){let ht=ae.current.instance,wt=ht.getModel();if(!wt)return;(()=>{var Ht;let Xt=[],Jt=[];const gi=wt.getAllDecorations();for(let ci of gi)ci.options.className==="highlighted-line"&&(Xt.push((Ht=ci==null?void 0:ci.range)==null?void 0:Ht.startLineNumber),Jt.push(ci==null?void 0:ci.id));if(dt===Xt[0])return;wt.deltaDecorations(Jt,[]);const Si=wt.getLineCount();dt&&dt<=Si&&(ht.deltaDecorations([],[{range:new Pe.Range(dt,1,dt,wt.getLineMaxColumn(dt)),options:{isWholeLine:!0,className:"highlighted-line"}}]),ht.revealLineInCenter(dt))})();const At=(Ht=!1)=>{var Xt;let Jt=[],gi=[];const Si=wt.getAllDecorations();for(let ci of Si)ci.options.linesDecorationsClassName==="breakpoints-select"&&(Jt.push((Xt=ci==null?void 0:ci.range)==null?void 0:Xt.startLineNumber),gi.push(ci==null?void 0:ci.id));if(Ht)return{lines:Jt,ids:gi};Lt(Jt)},Ri=Ht=>st(void 0,null,function*(){let Xt={range:new Pe.Range(Ht,1,Ht,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield wt.deltaDecorations([],[Xt]),At()}),bi=Ht=>st(void 0,null,function*(){let Xt=[];const Jt=ht.getLineDecorations(Ht);for(let gi of Jt)gi.options.linesDecorationsClassName==="breakpoints-select"&&Xt.push(gi.id);yield wt.deltaDecorations(Xt,[]),At()}),Xi=Ht=>{let Xt=ht.getLineDecorations(Ht);for(let Jt of Xt)if(Jt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,R.isEqual)(Rt,At(!0).lines)){wt.deltaDecorations(At(!0).ids,[]);const Ht=Rt.map(Xt=>({range:new Pe.Range(Xt,1,Xt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));wt.deltaDecorations([],Ht)}const ii=ht.onDidChangeModelContent(Ht=>{let Xt=ht.getPosition();if(Xt){let Jt=Xt.lineNumber;clearTimeout(ot.current),ot.current=setTimeout(()=>{zt(wt.getLineContent(Jt),Jt)?bi(Jt):Xi(Jt)?(bi(Jt),Ri(Jt)):At()},100)}}),ui=ht.onMouseDown(Ht=>{var Xt,Jt,gi;if(Ht.target.detail&&((gi=(Jt=(Xt=Ht.target)==null?void 0:Xt.element)==null?void 0:Jt.className)!=null&&gi.includes("line-numbers"))){let Si=Ht.target.position.lineNumber;if(zt(wt.getLineContent(Si),Si))return;Xi(Si)?bi(Si):Ri(Si)}}),qt=Ht=>{let Xt={range:new Pe.Range(Ht,1,Ht,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};tt.current=ht.deltaDecorations(tt.current,[Xt])},Ci=()=>{tt.current=ht.deltaDecorations(tt.current,[])},ki=ht.onMouseMove(Ht=>{var Xt,Jt,gi;if(Ci(),Ht.target.detail&&((gi=(Jt=(Xt=Ht.target)==null?void 0:Xt.element)==null?void 0:Jt.className)!=null&&gi.includes("line-numbers"))){let Si=Ht.target.position.lineNumber;if(zt(wt.getLineContent(Si),Si))return;qt(Si)}}),Di=ht.onMouseLeave(()=>{Ci()});return()=>{ii.dispose(),ui.dispose(),ki.dispose(),Di.dispose()}}},[ae.current,Ft,Rt,dt,xe,Se]),(0,k.useEffect)(()=>{var gt;(gt=ae.current)!=null&>.instance&&xe&&ae.current.instance.setPosition({lineNumber:0,column:0})},[dt]);function fi(){let gt=ae.current.instance;if(gt){const ht=gt.getSelection(),wt=ae.current.pastePos||{},Zt=new Pe.Range(wt.startLineNumber||ht.endLineNumber,wt.startColumn||ht.endColumn,wt.endLineNumber||ht.endLineNumber,wt.endColumn||ht.endColumn);setTimeout(()=>{gt.executeEdits("",[{range:Zt,text:""}])},300)}}function Nt(gt){(window.navigator.platform.match("Mac")?gt.metaKey:gt.ctrlKey)&>.keyCode==83&&(gt.preventDefault(),Ye())}const mt=()=>{if(Qe&&ae.current.instance){const gt=ae.current.instance.getContentHeight();_r(gt<ue?ue:gt)}else _r(ue)};function Ut(gt){var ht=document.createEvent("MouseEvents");ht.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),gt.dispatchEvent(ht)}const ei=gt=>{if(!Pt.current)return;const{keyCode:ht,ctrlKey:wt,metaKey:Zt,target:At,type:Ri}=gt;return(Ri==="paste"||(ht===67||ht===86)&&(Zt||wt))&&At.nodeName==="TEXTAREA"&&(si(),gt.preventDefault()),!1};function ai(gt,ht){var wt=window.URL||window.webkitURL||window,Zt=new Blob([ht]),At=document.createElementNS("http://www.w3.org/1999/xhtml","a");At.href=wt.createObjectURL(Zt),At.download=gt,Ut(At)}(0,k.useEffect)(()=>{mt()},[mt]),(0,k.useEffect)(()=>{re.current&&!Ft&&Promise.all([b.e(8909),b.e(7960)]).then(b.bind(b,71448)).then(gt=>{try{Pe=gt,ae.current.instance=Pe.editor.create(re.current,{value:ye,language:de(Se),theme:ke,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:be||!1}},Ue);const ht=ae.current.instance;let At=[...M.BH._menuItems].find(ii=>ii[0]._debugName=="EditorContext")[1],Ri=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],bi=(ii,ui)=>{var qt,Ci;let ki=ii._first;do ui.includes((Ci=(qt=ki.element)==null?void 0:qt.command)==null?void 0:Ci.id)&&ii._remove(ki);while(ki=ki.next)};if(Ze(ht,Pe),setTimeout(()=>{mt(),ae.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{ai(It||"educoder.txt",ht.getValue())}})},500),ae.current.subscription=ht.onDidChangeModelContent(ii=>{Ke.current?clearTimeout(qe.current):(mt(),ct(ht.getValue(),ii)),qe.current=setTimeout(()=>{Ke.current=!1},500)}),window.Monaco||F(Pe,de(Se)),at&&(bi(At,Ri),re.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",ei),window.removeEventListener("paste",ei),window.addEventListener("keydown",ei),window.addEventListener("paste",ei)),window.Monaco=Pe,it&&ht.onDidBlurEditorWidget(()=>{it(ht.getValue())}),yt&&ht.onDidFocusEditorText(()=>{yt(ht.getValue())}),at)try{ht.onDidPaste(ii=>{const ui=ht.getSelection(),qt=ae.current.pastePos||{},Ci=new Pe.Range(qt.startLineNumber||ui.endLineNumber,qt.startColumn||ui.endColumn,qt.endLineNumber||ui.endLineNumber,qt.endColumn||ui.endColumn);ht.executeEdits("",[{range:ii.range,text:""}])})}catch(ii){}let Xi=vt();return ge&&typeof ge=="string"&&new Z(ge,ht,Pe),Bt(!0),()=>{const ii=ae.current.instance;ii.dispose();const ui=ii.getModel();ui&&ui.dispose(),ae.current.subscription&&ae.current.subscription.dispose(),Xi.unobserve(re.current)}}catch(ht){}})},[]),(0,k.useEffect)(()=>{if(ae.current.instance&&Ft)return document.addEventListener("keydown",Nt,!1),()=>{document.removeEventListener("keydown",Nt)}},[Ye,Ft]),(0,k.useEffect)(()=>{let gt=ae.current.instance;if(gt&&Ft){let ht=de(Se);Pe.editor.setModelLanguage(gt.getModel(),ht)}},[Se,Ft]),(0,k.useEffect)(()=>{ae.current.instance&&Ft&&Pe.editor.setTheme(ke)},[ke,Ft]),(0,k.useEffect)(()=>{let gt=ae.current.instance;he.current=Ie,gt&&Ft&&(gt.updateOptions(Be({},Ie)),setTimeout(()=>{gt.getModel().updateOptions(Be({},Ie))},200))},[JSON.stringify(Ie),Ft]),(0,k.useEffect)(()=>{let gt=ae.current.instance;gt&&Ft&>.layout()},[pe,ue,Ft]);const[Ti,Ki]=(0,k.useState)($t(pe)),[yi,_r]=(0,k.useState)($t(ue)),Vt=ut(Be({},Ne),{width:Ti,height:yi,position:"relative"});return k.createElement("div",{className:"my-monaco-editor",ref:re,style:Vt},Xe&&k.createElement(Y.CopyToClipboard,{text:ye,onCopy:()=>K.ZP.success("\u590D\u5236\u6210\u529F")},k.createElement(j.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 je({width:J="100%",height:oe="100%",original:pe,modified:ue,language:ye,options:Se={}}){const Ne=(0,k.useRef)(),[Ie,Ue]=(0,k.useState)(null);function ke(Qe){let at;return Ne.current&&(at=new I.Z(ct=>{for(let Ze of ct)(Ze.target.offsetHeight>0||Ze.target.offsetWidth>0)&&Qe.layout()}),at.observe(Ne.current)),at}(0,k.useEffect)(()=>(Ne.current&&Promise.all([b.e(8909),b.e(9404)]).then(b.bind(b,2550)).then(Qe=>{Pe=Qe;const at=Pe.editor.createDiffEditor(Ne.current,ut(Be({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},Se),{wordWrap:!0}));Ue(at);let ct=ke(at);return()=>{at.dispose();const Ze=at.getModel();Ze&&Ze.dispose(),ct.unobserve(Ne.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,k.useEffect)(()=>{Ie&&Ie.setModel({original:Pe.editor.createModel(pe,ye),modified:Pe.editor.createModel(ue,ye)})},[pe,ue,ye,Ie]);const it=$t(J),Xe=$t(oe),Ye={width:it,height:Xe};return k.createElement("div",{className:"my-diff-editor",ref:Ne,style:Ye})}},42063:function(ft,me,b){"use strict";b.r(me),b.d(me,{default:function(){return l}});var k=b(59301),I=b(36610),G=b(12242),T=b(71570),x=b(29787),g=b(51258),O=b(56431),m=b(89081),n=b(24334),v=b(61186),f=b.n(v),c=(u,p,E)=>new Promise((D,L)=>{var w=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?D(U.value):Promise.resolve(U.value).then(w,A);P((E=E.apply(u,p)).next())}),l=()=>{const{submitId:u,id:p}=(0,T.useParams)(),[E,D]=(0,k.useState)(void 0);console.log((0,T.useLocation)(),33);const L=(0,T.useLocation)();function w(){var Y;T.history.push(`/problems/${p}/oj/${(Y=L==null?void 0:L.query)==null?void 0:Y.backId}?tab=1`)}(0,k.useEffect)(()=>((0,T.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!1}),(0,T.getDvaApp)()._store.dispatch({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),()=>{(0,T.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!0}),(0,T.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 ie=yield(0,g.X6)(u);D(ie.data)})}()},[u]);const{status:A,created_at:P,code:U,name:N,language:H,pass_sets_count:F,set_count:q,error_msg:V,output:ne,input:ce,expected_output:ee,execute_memory:z,user:Z,execute_time:M,input_file_url:K,output_file_url:j,is_file:R,expected_output_file_url:C}=E||{};return k.createElement(x.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:`${G.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:w,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,M*1e3,"ms")," "),k.createElement("li",null," ",`${F} / ${q} \u4E2A\u901A\u8FC7\u7684\u6D4B\u8BD5\u7528\u4F8B`," ")),(0,O.gZ)({status:A,error_msg:V,execute_time:M,output:ne,input:ce,expected_output:ee,input_file_url:K,output_file_url:j,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))}},56431:function(ft,me,b){"use strict";b.d(me,{Im:function(){return V},ZP:function(){return M},gZ:function(){return z}});var k=b(59301),I=b(37568),G=b(99571),T=b(84105),x=b(87395),g=b(85195),O=b(24334),m=b(32984),n=b(79074),v=b(59895),f=b(87700),c=b(34376),l=b(92310),u=b.n(l),p=b(59301),E=Object.defineProperty,D=Object.defineProperties,L=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,U=(K,j,R)=>j in K?E(K,j,{enumerable:!0,configurable:!0,writable:!0,value:R}):K[j]=R,N=(K,j)=>{for(var R in j||(j={}))A.call(j,R)&&U(K,R,j[R]);if(w)for(var R of w(j))P.call(j,R)&&U(K,R,j[R]);return K},H=(K,j)=>D(K,L(j));const{TextArea:F}=I.default,q={visible:!1,tabIndex:"0"},V={[g.h.HIDE_COMPILE_STATUS]:"\u6682\u4E0D\u652F\u6301\u67E5\u770B",[g.h.NOMATCH]:"\u6D4B\u8BD5\u7528\u4F8B\u7ED3\u679C\u4E0D\u5339\u914D",[g.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=(K=>(K[K.SET_VISIBLE=0]="SET_VISIBLE",K[K.SET_TABINDEX=1]="SET_TABINDEX",K))(ne||{});function ce(K,j){switch(j.type){case 0:return H(N({},K),{visible:j.payload});case 1:return H(N({},K),{tabIndex:j.payload});default:throw new Error}}function ee({value:K,className:j}){const[R,C]=(0,k.useState)(!1),Y=(0,k.useRef)(),ie=(0,k.useRef)();return(0,k.useEffect)(()=>{R&&(ie.current.reset(),ie.current.write((0,v.pp)(K||"")))},[K,R]),(0,k.useEffect)(()=>{var ve,Me,ze,Ee;if(Y.current){ie.current=new c.Terminal({fontSize:14,disableStdin:!0}),ie.current.open(Y.current);const Ve=Y.current.offsetWidth-14,Oe=((Ee=(ze=(Me=(ve=ie.current)==null?void 0:ve._core)==null?void 0:Me._renderService)==null?void 0:ze.dimensions)==null?void 0:Ee.actualCellWidth)||9.5,Be=Math.ceil(Ve/Oe);ie.current.resize(Be,8),C(!0)}},[]),p.createElement("div",{ref:Y,className:u()("XtermText-valueRef",j)})}function z(K){const{status:j,error_msg:R,output:C,input:Y,expected_output:ie,is_file:ve,input_file_url:Me,output_file_url:ze,expected_output_file_url:Ee}=K;let Ve=null;const Oe={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch(j){case g.h.NOMATCH:Ve=p.createElement(p.Fragment,null,p.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),!ve&&p.createElement(ee,{className:"mb10",value:Y}),ve&&p.createElement("div",{style:Oe},p.createElement("a",{onClick:()=>(0,v.LR)(Me,Y)},Y)),p.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),!ve&&p.createElement(ee,{className:"mb10",value:C&&O.Base64.decode(C)||""}),ve&&p.createElement("div",{style:Oe},p.createElement("a",{onClick:()=>(0,v.LR)(ze,C)},C)),p.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),!ve&&p.createElement(ee,{className:"mb10",value:ie&&O.Base64.decode(ie)||""}),ve&&p.createElement("div",{style:Oe},p.createElement("a",{onClick:()=>(0,v.LR)(Ee,ie)},ie)));break;case g.h.EXECUTEFAILURE:Ve=p.createElement(p.Fragment,null,p.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!ve&&p.createElement(n.Z,{value:Y,style:Oe}),ve&&p.createElement("div",{style:Oe},p.createElement("a",{onClick:()=>(0,v.LR)(Me,Y)},Y)),p.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),p.createElement("pre",{className:"error"},O.Base64.decode(R)));break;case g.h.COMPILEFAILURE:Ve=p.createElement(p.Fragment,null,p.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!ve&&p.createElement(n.Z,{value:Y,style:Oe}),ve&&p.createElement("div",{style:Oe},p.createElement("a",{onClick:()=>(0,v.LR)(Me,Y)},Y)),p.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),p.createElement("pre",{className:"error"},O.Base64.decode(R)));break;case g.h.PODFAILURE:Ve=p.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case g.h.TIMEOUT:Ve=p.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return p.createElement(p.Fragment,null," ",Ve," ")}function Z(K){const{status:j,error_msg:R,execute_time:C,output:Y,input:ie,expected_output:ve,is_file:Me,input_file_url:ze,output_file_url:Ee,expected_output_file_url:Ve}=K;let Oe=null;switch(j){case g.h.OK:Oe=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(Y)));break;case g.h.NOMATCH:Oe=p.createElement(p.Fragment,null,p.createElement("p",null,"\u8F93\u5165\uFF1A",p.createElement("pre",null,ie)),p.createElement("p",null,"\u8F93\u51FA\uFF1A",Y&&O.Base64.decode(Y)),p.createElement("p",null,"\u9884\u671F\u8F93\u51FA\uFF1A",ve&&O.Base64.decode(ve)));break;case g.h.EXECUTEFAILURE:Oe=p.createElement(p.Fragment,null,p.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",p.createElement("pre",null,ie)),p.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),p.createElement("pre",{className:"error"},O.Base64.decode(R)));break;case g.h.COMPILEFAILURE:Oe=p.createElement(p.Fragment,null,p.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",p.createElement("pre",null,ie)),p.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),p.createElement("pre",{className:"error"},O.Base64.decode(R)));break;case g.h.PODFAILURE:Oe=p.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case g.h.TIMEOUT:Oe=p.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return p.createElement(p.Fragment,null," ",Oe," ")}var M=({id:K,is_file:j,input:R,debuging:C,submitting:Y,executingMessage:ie,debugResult:ve,onChangeInput:Me,onDebugCode:ze,onSubmitCode:Ee})=>{const[Ve,Oe]=(0,k.useReducer)(ce,q),{visible:Be,tabIndex:ut}=Ve;(0,k.useEffect)(()=>{Oe({type:0,payload:!1})},[K]);function xt(Ce){let De=Ce.target.id;Oe({type:1,payload:De})}function st(){Oe({type:0,payload:!Be})}const $t=(0,k.useMemo)(()=>{if(ve){const{status:Ce}=ve;return p.createElement(p.Fragment,null,Z(ve))}return null},[ve]);function Ct(){Oe({type:0,payload:!0}),Oe({type:1,payload:"1"}),ze()}return p.createElement("div",{className:"test-case-panel"},p.createElement("div",{className:`test-case-panel-body ${Be?"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:j?"":R,onChange:Me}),rightNode:C?p.createElement(m.Z,{message:"\u4EE3\u7801\u6267\u884C\u4E2D..."}):ve?$t: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 ${Be?"up":""}`,onClick:st},Be?p.createElement(T.Z,null):p.createElement(x.Z,null)),p.createElement("footer",{className:"footer"},p.createElement("span",{style:{visibility:"hidden"}},"\u63A7\u5236\u53F0"),p.createElement("div",{className:"flex-container"},p.createElement(G.ZP,{id:"oj-prev",className:"btn-blue",type:"ghost"},"\u4E0A\u4E00\u9898"),p.createElement(G.ZP,{id:"oj-next",className:"btn-blue",type:"ghost"},"\u4E0B\u4E00\u9898"),p.createElement(G.ZP,{className:"btn-green",type:"ghost",loading:C,onClick:Ct},"\u8C03\u8BD5\u4EE3\u7801"),p.createElement(G.ZP,{type:"primary",className:"custom-ant-disabled",loading:Y,disabled:Y,onClick:()=>{Oe({type:0,payload:!1}),Ee()}},"\u8BC4\u6D4B\u5E76\u63D0\u4EA4"))))}},85195:function(ft,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||{})},51258:function(ft,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 T},Rg:function(){return P},WH:function(){return p},X6:function(){return g},bM:function(){return G},bx:function(){return E},dd:function(){return c},de:function(){return N},fi:function(){return v},fu:function(){return I},gu:function(){return D},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 w},zO:function(){return x}});var k=b(24092);function I(F){return(0,k.U2)(`mypractices/${F}.json`,{hidePopLogin:!0})}function G(F,q){return(0,k.v_)(`mypractices/${F}/code_submit.json`,q)}function T(F,q){return(0,k.v_)(`mypractices/${F}/code_debug.json`,q)}function x(F,q){return q.language&&(q.language=encodeURIComponent(q.language)),(0,k.U2)(`mypractices/${F}/submit_records.json`,q)}function g(F){return(0,k.U2)("mypractices/record_detail.json",{id:F})}function O(F,q){return(0,k.U2)(`mypractices/${F}/result.json`,{mode:q})}function m(F,q){return(0,k.v_)(`mypractices/${F}/add_notes.json`,q)}function n(F,q){return(0,k.v_)(`mypractices/${F}/restore_initial_code.json`,q)}function v(F,q){return(0,k.v_)(`mypractices/${F}/sync_code.json`,q)}function f(F,q){return(0,k.v_)(`mypractices/${F}/update_code.json`,q)}function c(F){return(0,k.v_)(`mypractices/${F}/initial_codes.json`)}function l(F,q){return(0,k.v_)(`discusses/${F}/plus.json`,q)}function u(F){return(0,k.U2)("practices/practices_list.json",F)}function p(F,q){return(0,k.U2)(`practices/${F}/question_solution_articles`,q)}function E(F,q){return(0,k.v_)(`practices/${F}/question_solution_articles`,q)}function D(F,q){return(0,k.gz)(`practices/${F}/question_solution_articles/${q==null?void 0:q.active}`,q)}function L(F,q){return(0,k.U2)(`practices/${F}/question_solution_articles/${q==null?void 0:q.active}/edit`,q)}function w(F,q){return(0,k.U2)(`practices/${F}/question_solution_articles/${q==null?void 0:q.active}`,q)}function A(F,q){return(0,k.v_)(`practices/${F}/question_solution_articles/${q==null?void 0:q.active}/set_authority_or_excellent`,q)}function P(F,q){return(0,k.v_)(`practices/${F}/question_solution_articles/${q==null?void 0:q.active}/praise_or_treads`,q)}function U(F,q){return(0,k.v_)(`practices/${F}/question_solution_articles/${q==null?void 0:q.active}/hide`)}function N(F,q){return(0,k.IV)(`practices/${F}/question_solution_articles/${q==null?void 0:q.active}`,q)}function H(F,q){return(0,k.v_)(`mypractices/${F}/update_practice_time_sum`,q)}},49405:function(ft,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),G=b(11690),T=b.n(G);let x=1;function g(q,V){const ne=q.match(/^(\s+)(?:```)/);if(ne===null)return V;const ce=ne[1];return V.split(`
|
|
|
`).map(ee=>{const z=ee.match(/^\s+/);if(z===null)return ee;const[Z]=z;return Z.length>=ce.length?ee.slice(ce.length):ee}).join(`
|
|
|
`)}let O=[],m=["<ul>"];const n=new(I()).Renderer,v=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function f(){O.length=0,m=["<ul>"]}const c={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(q,V,ne,ce){if(V>=q.length||q[V].level<=ne)return V;var ee=q[V];ce.push("<li><a href='#"+x+ee.anchor+"'>"+ee.text+"</a>"),V++;var z=[];return V=l(q,V,ee.level,z),z.length>0&&(ce.push("<ul>"),z.forEach(function(Z){ce.push(Z)}),ce.push("</ul>")),ce.push("</li>"),V=l(q,V,ne,ce),V}function u(){return l(O,0,0,m),m.push("</ul>"),m.join("")}const p={heading(q){const V=v.exec(q);if(x+=1,V)return{type:"heading",raw:V[0],depth:V[1].length,text:V[2]}},fences(q){const V=this.rules.block.fences.exec(q);if(V){const ne=V[0];let ce=g(ne,V[3]||"");const ee=V[2]?V[2].trim():V[2];if(["latex","katex","math"].indexOf(ee)>=0){const z=L(),Z=ce;ce=z,w[z]={type:"block",expression:Z}}return{type:"code",raw:ne,lang:ee,text:ce}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let D=0;const L=()=>`__special_katext_id_${D++}__`;let w={};function A(){return w}function P(){D=0,w={}}function U(q){return q=q.replace(E,(V,ne)=>{const ce=L();return w[ce]={type:"inline",expression:ne},ce}),q}const N=n.listitem;n.listitem=function(q){return N(U(q))};const H=n.paragraph;n.paragraph=function(q){return H(U(q))};const F=n.tablecell;n.tablecell=function(q,V){return F(U(q),V)},n.code=function(q,V,ne){const ce=(V||"").match(/\S*/)[0];return ce?["latex","katex","math"].indexOf(ce)>=0?`<p class='editormd-tex'>${q}</p>`:`<pre class="prettyprint linenums"><code class="language-${V}">${ne?q:(0,G.escape)(q,!0)}</code></pre>
|
|
|
`:'<pre class="prettyprint linenums"><code>'+(ne?q:(0,G.escape)(q,!0))+"</code></pre>"},n.heading=function(q,V,ne){let ce=this.options.headerPrefix+ne.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return O.push({anchor:ce,level:V,text:q}),"<h"+V+' id="'+x+ce+'">'+q+"</h"+V+">"},I().setOptions({silent:!0,gfm:!0,pedantic:!1}),I().use({tokenizer:p,renderer:n}),me.ZP=I()},64018:function(){var ft,me,b,k=!1,I,G;window.PR_SHOULD_USE_CONTINUATION=!0;var T,x;(function(){var g=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"],v=[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"],D=[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"],w=[v,c,f,u,p,E,D,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",q="pun",V="pln",ne="tag",ce="dec",ee="src",z="atn",Z="atv",M="nocode",K="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function j(De){for(var de=0,Pe=!1,We=!1,je=0,J=De.length;je<J;++je){var oe=De[je];if(oe.ignoreCase)We=!0;else if(/[a-z]/i.test(oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Pe=!0,We=!1;break}}var pe={b:8,t:9,n:10,v:11,f:12,r:13};function ue(Ue){var ke=Ue.charCodeAt(0);if(ke!==92)return ke;var it=Ue.charAt(1);return ke=pe[it],ke||("0"<=it&&it<="7"?parseInt(Ue.substring(1),8):it==="u"||it==="x"?parseInt(Ue.substring(2),16):Ue.charCodeAt(1))}function ye(Ue){if(Ue<32)return(Ue<16?"\\x0":"\\x")+Ue.toString(16);var ke=String.fromCharCode(Ue);return ke==="\\"||ke==="-"||ke==="]"||ke==="^"?"\\"+ke:ke}function Se(Ue){var ke=Ue.substring(1,Ue.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")),it=[],Xe=ke[0]==="^",Ye=["["];Xe&&Ye.push("^");for(var Qe=Xe?1:0,at=ke.length;Qe<at;++Qe){var ct=ke[Qe];if(/\\[bdsw]/i.test(ct))Ye.push(ct);else{var Ze=ue(ct),yt;Qe+2<at&&ke[Qe+1]==="-"?(yt=ue(ke[Qe+2]),Qe+=2):yt=Ze,it.push([Ze,yt]),yt<65||Ze>122||(yt<65||Ze>90||it.push([Math.max(65,Ze)|32,Math.min(yt,90)|32]),yt<97||Ze>122||it.push([Math.max(97,Ze)&-33,Math.min(yt,122)&-33]))}}it.sort(function(Kt,rt){return Kt[0]-rt[0]||rt[1]-Kt[1]});for(var Lt=[],Rt=[],Qe=0;Qe<it.length;++Qe){var It=it[Qe];It[0]<=Rt[1]+1?Rt[1]=Math.max(Rt[1],It[1]):Lt.push(Rt=It)}for(var Qe=0;Qe<Lt.length;++Qe){var It=Lt[Qe];Ye.push(ye(It[0])),It[1]>It[0]&&(It[1]+1>It[0]&&Ye.push("-"),Ye.push(ye(It[1])))}return Ye.push("]"),Ye.join("")}function Ne(Ue){for(var ke=Ue.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")),it=ke.length,Xe=[],Ye=0,Qe=0;Ye<it;++Ye){var at=ke[Ye];if(at==="(")++Qe;else if(at.charAt(0)==="\\"){var ct=+at.substring(1);ct&&(ct<=Qe?Xe[ct]=-1:ke[Ye]=ye(ct))}}for(var Ye=1;Ye<Xe.length;++Ye)Xe[Ye]===-1&&(Xe[Ye]=++de);for(var Ye=0,Qe=0;Ye<it;++Ye){var at=ke[Ye];if(at==="(")++Qe,Xe[Qe]||(ke[Ye]="(?:");else if(at.charAt(0)==="\\"){var ct=+at.substring(1);ct&&ct<=Qe&&(ke[Ye]="\\"+Xe[ct])}}for(var Ye=0;Ye<it;++Ye)ke[Ye]==="^"&&ke[Ye+1]!=="^"&&(ke[Ye]="");if(Ue.ignoreCase&&Pe)for(var Ye=0;Ye<it;++Ye){var at=ke[Ye],Ze=at.charAt(0);at.length>=2&&Ze==="["?ke[Ye]=Se(at):Ze!=="\\"&&(ke[Ye]=at.replace(/[a-zA-Z]/g,function(Rt){var It=Rt.charCodeAt(0);return"["+String.fromCharCode(It&-33,It|32)+"]"}))}return ke.join("")}for(var Ie=[],je=0,J=De.length;je<J;++je){var oe=De[je];if(oe.global||oe.multiline)throw new Error(""+oe);Ie.push("(?:"+Ne(oe)+")")}return new RegExp(Ie.join("|"),We?"gi":"g")}function R(De,de){var Pe=/(?:^|\s)nocode(?:\s|$)/,We=[],je=0,J=[],oe=0;function pe(ue){var ye=ue.nodeType;if(ye==1){if(Pe.test(ue.className))return;for(var Se=ue.firstChild;Se;Se=Se.nextSibling)pe(Se);var Ne=ue.nodeName.toLowerCase();(Ne==="br"||Ne==="li")&&(We[oe]=`
|
|
|
`,J[oe<<1]=je++,J[oe++<<1|1]=ue)}else if(ye==3||ye==4){var Ie=ue.nodeValue;Ie.length&&(de?Ie=Ie.replace(/\r\n?/g,`
|
|
|
`):Ie=Ie.replace(/[ \t\r\n]+/g," "),We[oe]=Ie,J[oe<<1]=je,je+=Ie.length,J[oe++<<1|1]=ue)}}return pe(De),{sourceCode:We.join("").replace(/\n$/,""),spans:J}}function C(De,de,Pe,We,je){if(Pe){var J={sourceNode:De,pre:1,langExtension:null,numberLines:null,sourceCode:Pe,spans:null,basePos:de,decorations:null};We(J),je.push.apply(je,J.decorations)}}var Y=/\S/;function ie(De){for(var de=void 0,Pe=De.firstChild;Pe;Pe=Pe.nextSibling){var We=Pe.nodeType;de=We===1?de?De:Pe:We===3&&Y.test(Pe.nodeValue)?De:de}return de===De?void 0:de}function ve(De,de){var Pe={},We;(function(){for(var oe=De.concat(de),pe=[],ue={},ye=0,Se=oe.length;ye<Se;++ye){var Ne=oe[ye],Ie=Ne[3];if(Ie)for(var Ue=Ie.length;--Ue>=0;)Pe[Ie.charAt(Ue)]=Ne;var ke=Ne[1],it=""+ke;ue.hasOwnProperty(it)||(pe.push(ke),ue[it]=null)}pe.push(/[\0-\uffff]/),We=j(pe)})();var je=de.length,J=function(oe){for(var pe=oe.sourceCode,ue=oe.basePos,ye=oe.sourceNode,Se=[ue,V],Ne=0,Ie=pe.match(We)||[],Ue={},ke=0,it=Ie.length;ke<it;++ke){var Xe=Ie[ke],Ye=Ue[Xe],Qe=void 0,at;if(typeof Ye=="string")at=!1;else{var ct=Pe[Xe.charAt(0)];if(ct)Qe=Xe.match(ct[1]),Ye=ct[0];else{for(var Ze=0;Ze<je;++Ze)if(ct=de[Ze],Qe=Xe.match(ct[1]),Qe){Ye=ct[0];break}Qe||(Ye=V)}at=Ye.length>=5&&Ye.substring(0,5)==="lang-",at&&!(Qe&&typeof Qe[1]=="string")&&(at=!1,Ye=ee),at||(Ue[Xe]=Ye)}var yt=Ne;if(Ne+=Xe.length,!at)Se.push(ue+yt,Ye);else{var Lt=Qe[1],Rt=Xe.indexOf(Lt),It=Rt+Lt.length;Qe[2]&&(It=Xe.length-Qe[2].length,Rt=It-Lt.length);var Kt=Ye.substring(5);C(ye,ue+yt,Xe.substring(0,Rt),J,Se),C(ye,ue+yt+Rt,Lt,ut(Kt,Lt),Se),C(ye,ue+yt+It,Xe.substring(It),J,Se)}}oe.decorations=Se};return J}function Me(De){var de=[],Pe=[];De.tripleQuotedStrings?de.push([P,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):De.multiLineStrings?de.push([P,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):de.push([P,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),De.verbatimStrings&&Pe.push([P,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var We=De.hashComments;We&&(De.cStyleComments?(We>1?de.push([N,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):de.push([N,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([P,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):de.push([N,/^#[^\r\n]*/,null,"#"])),De.cStyleComments&&(Pe.push([N,/^\/\/[^\r\n]*/,null]),Pe.push([N,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=De.regexLiterals;if(je){var J=je>1?"":`
|
|
|
\r`,oe=J?".":"[\\S\\s]",pe="/(?=[^/*"+J+"])(?:[^/\\x5B\\x5C"+J+"]|\\x5C"+oe+"|\\x5B(?:[^\\x5C\\x5D"+J+"]|\\x5C"+oe+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+K+"("+pe+")")])}var ue=De.types;ue&&Pe.push([H,ue]);var ye=(""+De.keywords).replace(/^ | $/g,"");ye.length&&Pe.push([U,new RegExp("^(?:"+ye.replace(/[\s,]+/g,"|")+")\\b"),null]),de.push([V,/^\s+/,null,` \r
|
|
|
\xA0`]);var Se="^.[^\\s\\w.$@'\"`/\\\\]*";return De.regexLiterals&&(Se+="(?!s*/)"),Pe.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],[q,new RegExp(Se),null]),ve(de,Pe)}var ze=Me({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ee(De,de,Pe){for(var We=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,J=De.ownerDocument,oe=J.createElement("li");De.firstChild;)oe.appendChild(De.firstChild);var pe=[oe];function ue(ke){var it=ke.nodeType;if(it==1&&!We.test(ke.className))if(ke.nodeName==="br")ye(ke),ke.parentNode&&ke.parentNode.removeChild(ke);else for(var Xe=ke.firstChild;Xe;Xe=Xe.nextSibling)ue(Xe);else if((it==3||it==4)&&Pe){var Ye=ke.nodeValue,Qe=Ye.match(je);if(Qe){var at=Ye.substring(0,Qe.index);ke.nodeValue=at;var ct=Ye.substring(Qe.index+Qe[0].length);if(ct){var Ze=ke.parentNode;Ze.insertBefore(J.createTextNode(ct),ke.nextSibling)}ye(ke),at||ke.parentNode.removeChild(ke)}}}function ye(ke){for(;!ke.nextSibling;)if(ke=ke.parentNode,!ke)return;function it(Qe,at){var ct=at?Qe.cloneNode(!1):Qe,Ze=Qe.parentNode;if(Ze){var yt=it(Ze,1),Lt=Qe.nextSibling;yt.appendChild(ct);for(var Rt=Lt;Rt;Rt=Lt)Lt=Rt.nextSibling,yt.appendChild(Rt)}return ct}for(var Xe=it(ke.nextSibling,0),Ye;(Ye=Xe.parentNode)&&Ye.nodeType===1;)Xe=Ye;pe.push(Xe)}for(var Se=0;Se<pe.length;++Se)ue(pe[Se]);de===(de|0)&&pe[0].setAttribute("value",de);var Ne=J.createElement("ol");Ne.className="linenums";for(var Ie=Math.max(0,de-1|0)||0,Se=0,Ue=pe.length;Se<Ue;++Se)oe=pe[Se],oe.className="L"+(Se+Ie)%10,oe.firstChild||oe.appendChild(J.createTextNode("\xA0")),Ne.appendChild(oe);De.appendChild(Ne)}function Ve(De){var de=/\bMSIE\s(\d+)/.exec(navigator.userAgent);de=de&&+de[1]<=8;var Pe=/\n/g,We=De.sourceCode,je=We.length,J=0,oe=De.spans,pe=oe.length,ue=0,ye=De.decorations,Se=ye.length,Ne=0;ye[Se]=je;var Ie,Ue;for(Ue=Ie=0;Ue<Se;)ye[Ue]!==ye[Ue+2]?(ye[Ie++]=ye[Ue++],ye[Ie++]=ye[Ue++]):Ue+=2;for(Se=Ie,Ue=Ie=0;Ue<Se;){for(var ke=ye[Ue],it=ye[Ue+1],Xe=Ue+2;Xe+2<=Se&&ye[Xe+1]===it;)Xe+=2;ye[Ie++]=ke,ye[Ie++]=it,Ue=Xe}Se=ye.length=Ie;var Ye=De.sourceNode,Qe="";Ye&&(Qe=Ye.style.display,Ye.style.display="none");try{for(var at=null;ue<pe;){var ct=oe[ue],Ze=oe[ue+2]||je,yt=ye[Ne+2]||je,Xe=Math.min(Ze,yt),Lt=oe[ue+1],Rt;if(Lt.nodeType!==1&&(Rt=We.substring(J,Xe))){de&&(Rt=Rt.replace(Pe,"\r")),Lt.nodeValue=Rt;var It=Lt.ownerDocument,Kt=It.createElement("span");Kt.className=ye[Ne+1];var rt=Lt.parentNode;rt.replaceChild(Kt,Lt),Kt.appendChild(Lt),J<Ze&&(oe[ue+1]=Lt=It.createTextNode(We.substring(Xe,Ze)),rt.insertBefore(Lt,Kt.nextSibling))}J=Xe,J>=Ze&&(ue+=2),J>=yt&&(Ne+=2)}}finally{Ye&&(Ye.style.display=Qe)}}var Oe={};function Be(De,de){for(var Pe=de.length;--Pe>=0;){var We=de[Pe];Oe.hasOwnProperty(We)?g.console&&console.warn("cannot override language handler %s",We):Oe[We]=De}}function ut(De,de){return De&&Oe.hasOwnProperty(De)||(De=/^\s*</.test(de)?"default-markup":"default-code"),Oe[De]}Be(ze,["default-code"]),Be(ve([],[[V,/^[^<?]+/],[ce,/^<!\w[^>]*(?:>|$)/],[N,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[q,/^(?:<[%?]|[%?]>)/],["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"]),Be(ve([[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)))/],[q,/^[=<>\/]+/],["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"]),Be(ve([],[[Z,/^[\s\S]+/]]),["uq.val"]),Be(Me({keywords:v,hashComments:!0,cStyleComments:!0,types:A}),["c","cc","cpp","cxx","cyc","m"]),Be(Me({keywords:"null,true,false"}),["json"]),Be(Me({keywords:c,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:A}),["cs"]),Be(Me({keywords:f,cStyleComments:!0}),["java"]),Be(Me({keywords:L,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Be(Me({keywords:E,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Be(Me({keywords:p,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Be(Me({keywords:D,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Be(Me({keywords:u,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Be(Me({keywords:l,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Be(ve([],[[P,/^[\s\S]+/]]),["regex"]);function xt(De){var de=De.langExtension;try{var Pe=R(De.sourceNode,De.pre),We=Pe.sourceCode;De.sourceCode=We,De.spans=Pe.spans,De.basePos=0,ut(de,We)(De),Ve(De)}catch(je){g.console&&console.log(je&&je.stack||je)}}function st(De,de,Pe){var We=Pe||!1,je=de||null,J=document.createElement("div");J.innerHTML="<pre>"+De+"</pre>",J=J.firstChild,We&&Ee(J,We,!0);var oe={langExtension:je,numberLines:We,sourceNode:J,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return xt(oe),J.innerHTML}function $t(De,de){var Pe=de||document.body,We=Pe.ownerDocument||document;function je(ct){return Pe.getElementsByTagName(ct)}for(var J=[je("pre"),je("code"),je("xmp")],oe=[],pe=0;pe<J.length;++pe)for(var ue=0,ye=J[pe].length;ue<ye;++ue)oe.push(J[pe][ue]);J=null;var Se=Date;Se.now||(Se={now:function(){return+new Date}});var Ne=0,Ie=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ue=/\bprettyprint\b/,ke=/\bprettyprinted\b/,it=/pre|xmp/i,Xe=/^code$/i,Ye=/^(?:pre|code|xmp)$/i,Qe={};function at(){for(var ct=g.PR_SHOULD_USE_CONTINUATION?Se.now()+250:1/0;Ne<oe.length&&Se.now()<ct;Ne++){for(var Ze=oe[Ne],yt=Qe,Lt=Ze;Lt=Lt.previousSibling;){var Rt=Lt.nodeType,It=(Rt===7||Rt===8)&&Lt.nodeValue;if(It?!/^\??prettify\b/.test(It):Rt!==3||/\S/.test(Lt.nodeValue))break;if(It){yt={},It.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ke,qe,ot){yt[qe]=ot});break}}var Kt=Ze.className;if((yt!==Qe||Ue.test(Kt))&&!ke.test(Kt)){for(var rt=!1,dt=Ze.parentNode;dt;dt=dt.parentNode){var xe=dt.tagName;if(Ye.test(xe)&&dt.className&&Ue.test(dt.className)){rt=!0;break}}if(!rt){Ze.className+=" prettyprinted";var ge=yt.lang;if(!ge){ge=Kt.match(Ie);var be;!ge&&(be=ie(Ze))&&Xe.test(be.tagName)&&(ge=be.className.match(Ie)),ge&&(ge=ge[1])}var te;if(it.test(Ze.tagName))te=1;else{var re=Ze.currentStyle,ae=We.defaultView,he=re?re.whiteSpace:ae&&ae.getComputedStyle?ae.getComputedStyle(Ze,null).getPropertyValue("white-space"):0;te=he&&he.substring(0,3)==="pre"}var _e=yt.linenums;(_e=_e==="true"||+_e)||(_e=Kt.match(/\blinenums\b(?::(\d+))?/),_e=_e?_e[1]&&_e[1].length?+_e[1]:!0:!1),_e&&Ee(Ze,_e,te);var tt={langExtension:ge,sourceNode:Ze,numberLines:_e,pre:te,sourceCode:null,basePos:null,spans:null,decorations:null};xt(tt)}}}Ne<oe.length?g.setTimeout(at,250):typeof De=="function"&&De()}at()}var Ct=g.PR={createSimpleLexer:ve,registerLangHandler:Be,sourceDecorator:Me,PR_ATTRIB_NAME:z,PR_ATTRIB_VALUE:Z,PR_COMMENT:N,PR_DECLARATION:ce,PR_KEYWORD:U,PR_LITERAL:F,PR_NOCODE:M,PR_PLAIN:V,PR_PUNCTUATION:q,PR_SOURCE:ee,PR_STRING:P,PR_TAG:ne,PR_TYPE:H,prettyPrintOne:k?g.prettyPrintOne=st:T=st,prettyPrint:x=k?g.prettyPrint=$t:x=$t},Ce=g.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return Ct})})()},25769:function(ft,me,b){"use strict";var k=b(98040),I={"text/plain":"Text","text/html":"Url",default:"Text"},G="Copy to clipboard: #{key}, Enter";function T(g){var O=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return g.replace(/#{\s*key\s*}/g,O)}function x(g,O){var m,n,v,f,c,l,u=!1;O||(O={}),m=O.debug||!1;try{v=k(),f=document.createRange(),c=document.getSelection(),l=document.createElement("span"),l.textContent=g,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 D=I[O.format]||I.default;window.clipboardData.setData(D,g)}else E.clipboardData.clearData(),E.clipboardData.setData(O.format,g);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",g),O.onCopy&&O.onCopy(window.clipboardData),u=!0}catch(D){m&&console.error("unable to copy using clipboardData: ",D),m&&console.error("falling back to prompt"),n=T("message"in O?O.message:G),window.prompt(n,g)}}finally{c&&(typeof c.removeRange=="function"?c.removeRange(f):c.removeAllRanges()),l&&document.body.removeChild(l),v()}return u}ft.exports=x},24334:function(ft,me,b){var k,I;(function(G,T){ft.exports=T(G)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof b.g!="undefined"?b.g:this,function(G){"use strict";G=G||{};var T=G.Base64,x="2.6.4",g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",O=function(z){for(var Z={},M=0,K=z.length;M<K;M++)Z[z.charAt(M)]=M;return Z}(g),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)}},v=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,f=function(z){return z.replace(v,n)},c=function(z){var Z=[0,2,1][z.length%3],M=z.charCodeAt(0)<<16|(z.length>1?z.charCodeAt(1):0)<<8|(z.length>2?z.charCodeAt(2):0),K=[g.charAt(M>>>18),g.charAt(M>>>12&63),Z>=2?"=":g.charAt(M>>>6&63),Z>=1?"=":g.charAt(M&63)];return K.join("")},l=G.btoa&&typeof G.btoa=="function"?function(z){return G.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)},D=function(z){return E(z,!0)},L;G.Uint8Array&&(L=function(z,Z){for(var M="",K=0,j=z.length;K<j;K+=3){var R=z[K],C=z[K+1],Y=z[K+2],ie=R<<16|C<<8|Y;M+=g.charAt(ie>>>18)+g.charAt(ie>>>12&63)+(typeof C!="undefined"?g.charAt(ie>>>6&63):"=")+(typeof Y!="undefined"?g.charAt(ie&63):"=")}return Z?p(M):M});var w=/[\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),M=Z-65536;return m((M>>>10)+55296)+m((M&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(w,A)},U=function(z){var Z=z.length,M=Z%4,K=(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),j=[m(K>>>16),m(K>>>8&255),m(K&255)];return j.length-=[0,0,2,1][M],j.join("")},N=G.atob&&typeof G.atob=="function"?function(z){return G.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))},q=function(z){return String(z).replace(/[-_]/g,function(Z){return Z=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},V=function(z){return F(q(z))},ne;G.Uint8Array&&(ne=function(z){return Uint8Array.from(H(q(z)),function(Z){return Z.charCodeAt(0)})});var ce=function(){var z=G.Base64;return G.Base64=T,z};if(G.Base64={VERSION:x,atob:H,btoa:l,fromBase64:V,toBase64:E,utob:f,encode:E,encodeURI:D,btou:P,decode:V,noConflict:ce,fromUint8Array:L,toUint8Array:ne},typeof Object.defineProperty=="function"){var ee=function(z){return{value:z,enumerable:!1,writable:!0,configurable:!0}};G.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",ee(function(){return V(this)})),Object.defineProperty(String.prototype,"toBase64",ee(function(z){return E(this,z)})),Object.defineProperty(String.prototype,"toBase64URI",ee(function(){return E(this,!0)}))}}return G.Meteor&&(Base64=G.Base64),ft.exports?ft.exports.Base64=G.Base64:(k=[],I=function(){return G.Base64}.apply(me,k),I!==void 0&&(ft.exports=I)),{Base64:G.Base64}})},53184:function(ft,me,b){"use strict";var k,I;function G(T,x,g){var O=function(m,n){return T.js_beautify(m,n)};return O.js=T.js_beautify,O.css=x.css_beautify,O.html=g.html_beautify,O.js_beautify=T.js_beautify,O.css_beautify=x.css_beautify,O.html_beautify=g.html_beautify,O}k=[b(58553),b(87804),b(40998)],I=function(T,x,g){return G(T,x,g)}.apply(me,k),I!==void 0&&(ft.exports=I)},87804:function(ft,me){var b,k;(function(){var I;(function(){"use strict";var T=[,,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 v(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}v.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},v.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},v.prototype.__ensure_cache=function(c){for(;c>=this.__cache.length;)this.__add_column()},v.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 v(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=v(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 v(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=v},,function(m){var n=RegExp.prototype.hasOwnProperty("sticky");function v(f){this.__input=f||"",this.__input_length=this.__input.length,this.__position=0}v.prototype.restart=function(){this.__position=0},v.prototype.back=function(){this.__position>0&&(this.__position-=1)},v.prototype.hasNext=function(){return this.__position<this.__input_length},v.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__input.charAt(this.__position),this.__position+=1),f},v.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},v.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},v.prototype.test=function(f,c){return c=c||0,c+=this.__position,c>=0&&c<this.__input_length?!!this.__match(f,c):!1},v.prototype.testChar=function(f,c){var l=this.peek(c);return f.lastIndex=0,l!==null&&f.test(l)},v.prototype.match=function(f){var c=this.__match(f,this.__position);return c?this.__position+=c[0].length:c=null,c},v.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},v.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},v.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},v.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},v.prototype.get_literal_regexp=function(f){return RegExp(f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(f){var c=this.__position,l=this.readUntilAfter(f);return this.__position=c,l},v.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=v},,,,,function(m){function n(v,f){v=typeof v=="string"?v:v.source,f=typeof f=="string"?f:f.source,this.__directives_block_pattern=new RegExp(v+/ beautify( \w+[:]\w+)+ /.source+f,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(v+/\sbeautify\signore:end\s/.source+f,"g")}n.prototype.get_directives=function(v){if(!v.match(this.__directives_block_pattern))return null;var f={};this.__directive_pattern.lastIndex=0;for(var c=this.__directive_pattern.exec(v);c;)f[c[1]]=c[2],c=this.__directive_pattern.exec(v);return f},n.prototype.readIgnored=function(v){return v.readUntilAfter(this.__directives_end_ignore_pattern)},m.exports.Directives=n},,function(m,n,v){var f=v(16).Beautifier,c=v(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,v){var f=v(17).Options,c=v(2).Output,l=v(8).InputScanner,u=v(13).Directives,p=new u(/\/\*/,/\*\//),E=/\r\n|[\r\n]/,D=/\r\n|[\r\n]/g,L=/\s/,w=/(?:\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(D,`
|
|
|
`);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 q=0,V=!1,ne=!1,ce=!1,ee=!1,z=!1,Z=this._ch,M=!1,K,j,R;K=this._input.read(w),j=K!=="",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),Y=p.get_directives(C);Y&&Y.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(j),this.print_string(this._ch);var ie=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ie.match(/[ :]$/)&&(ie=this.eatString(": ").replace(/\s+$/,""),this.print_string(ie),this._output.space_before_token=!0),q===0&&ie.indexOf(":")!==-1&&(ne=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(j),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ve=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ve.match(/[ :]$/)&&(ve=this.eatString(": ").replace(/\s+$/,""),this.print_string(ve),this._output.space_before_token=!0),q===0&&ve.indexOf(":")!==-1?(ne=!0,this.indent()):ve in this.NESTED_AT_RULE?(this._nestedLevel+=1,ve in this.CONDITIONAL_GROUP_RULE&&(ce=!0)):q===0&&!ne&&(ee=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(j),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")ne&&(ne=!1,this.outdent()),ee=!1,ce?(ce=!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 Me=0;Me<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Me++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Me])){M=!0;break}(V||ce)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!ee&&q===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 ze=R==='"'||R==="'";this.preserveSingleSpace(ze||j),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")M=!1,q===0?(ne&&(this.outdent(),ne=!1),ee=!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(),q++,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(")")),q&&(q--,this.outdent()));else{var Ee=!1;this._input.lookBack("with")&&(Ee=!0),this.preserveSingleSpace(j||Ee),this.print_string(this._ch),ne&&R==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),z=!0):(this.eatWhitespace(),q++,this.indent())}else if(this._ch===")")q&&(q--,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)&&q===0&&!ee?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!ne&&q===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(j),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 Ve=R==='"'||R==="'";this.preserveSingleSpace(Ve||j),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
|
`&&M&&this._output.add_new_line()}var Oe=this._output.get_code(H);return Oe},m.exports.Beautifier=U},function(m,n,v){var f=v(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}],x={};function g(m){var n=x[m];if(n!==void 0)return n.exports;var v=x[m]={exports:{}};return T[m](v,v.exports,g),v.exports}var O=g(15);I=O})();var G=I;b=[],k=function(){return{css_beautify:G}}.apply(me,b),k!==void 0&&(ft.exports=k)})()},40998:function(ft,me,b){var k,I;(function(){var G;(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 D=this.__base_string_length;return E=E||0,p<0&&(D=0),D+=p*this.__indent_size,D+=E,D},l.prototype.get_indent_string=function(p,E){var D=this.__base_string;return E=E||0,p<0&&(p=0,D=""),E+=p*this.__indent_size,this.__ensure_cache(E),D+=this.__cache[E],D},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,D="";this.__indent_size&&p>=this.__indent_size&&(E=Math.floor(p/this.__indent_size),p-=E*this.__indent_size,D=new Array(E+1).join(this.__indent_string)),p&&(D+=new Array(p+1).join(" ")),this.__cache.push(D)};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 D=this.__lines.join(`
|
|
|
`);return p!==`
|
|
|
`&&(D=D.replace(/[\n]/g,p)),D},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 D=this.__lines.length-2;D>=0;){var L=this.__lines[D];if(L.is_empty())break;if(L.item(0).indexOf(p)!==0&&L.item(-1)!==E){this.__lines.splice(D+1,0,new c(this)),this.previous_line=this.__lines[this.__lines.length-2];break}D--}},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 D=this.raw_options[p],L=E||[];return typeof D=="object"?D!==null&&typeof D.concat=="function"&&(L=D.concat()):typeof D=="string"&&(L=D.split(/[^a-zA-Z0-9_\/\-]+/)),L},c.prototype._get_boolean=function(p,E){var D=this.raw_options[p],L=D===void 0?!!E:!!D;return L},c.prototype._get_characters=function(p,E){var D=this.raw_options[p],L=E||"";return typeof D=="string"&&(L=D.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),L},c.prototype._get_number=function(p,E){var D=this.raw_options[p];E=parseInt(E,10),isNaN(E)&&(E=0);var L=parseInt(D,10);return isNaN(L)&&(L=E),L},c.prototype._get_selection=function(p,E,D){var L=this._get_selection_list(p,E,D);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,D){if(!E||E.length===0)throw new Error("Selection list cannot be empty.");if(D=D||[E[0]],!this._is_valid_selection(D,E))throw new Error("Invalid Default Value!");var L=this._get_array(p,D);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(D){return E.indexOf(D)===-1})};function l(p,E){var D={};p=u(p);var L;for(L in p)L!==E&&(D[L]=p[L]);if(E&&p[E])for(L in p[E])D[L]=p[E][L];return D}function u(p){var E={},D;for(D in p){var L=D.replace(/-/g,"_");E[L]=p[D]}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 D="",L;return u&&(L=this.match(u),L&&(D+=L[0])),p&&(L||!u)&&(D+=this.readUntil(p,E)),D},l.prototype.readUntil=function(u,p){var E="",D=this.__position;u.lastIndex=this.__position;var L=u.exec(this.__input);return L?(D=L.index,p&&(D+=L[0].length)):D=this.__input_length,E=this.__input.substring(this.__position,D),this.__position=D,E},l.prototype.readUntilAfter=function(u){return this.readUntil(u,!0)},l.prototype.get_regexp=function(u,p){var E=null,D="g";return p&&c&&(D="y"),typeof u=="string"&&u!==""?E=new RegExp(u,D):u&&(E=new RegExp(u.source,D)),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,D=l(11).WhitespacePattern,L={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},w=function(A,P){this._input=new u(A),this._options=P||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new D(this._input)};w.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},w.prototype._is_first_token=function(){return this.__tokens.isEmpty()},w.prototype._reset=function(){},w.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,"")},w.prototype._is_comment=function(A){return!1},w.prototype._is_opening=function(A){return!1},w.prototype._is_closing=function(A,P){return!1},w.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},w.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},f.exports.Tokenizer=w,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,D){u.call(this,E,D),D?this._line_regexp=this._input.get_regexp(D._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,D){E+="\\t ",D+="\\n\\r",this._match_pattern=this._input.get_regexp("["+E+D+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+D+"]")},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 D=this.__split(this._newline_regexp,E);this.newline_count=D.length-1,this.whitespace_before_token=D[this.newline_count]}return E},p.prototype.matching=function(E,D){var L=this._create();return L.__set_whitespace_patterns(E,D),L._update(),L},p.prototype._create=function(){return new p(this._input,this)},p.prototype.__split=function(E,D){E.lastIndex=0;for(var L=0,w=[],A=E.exec(D);A;)w.push(D.substring(L,A.index)),L=A.index+A[0].length,A=E.exec(D);return L<D.length?w.push(D.substring(L,D.length)):w.push(""),w},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(D,L){u.call(this,D,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 w=new u(D);this.__patterns={handlebars_comment:w.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:w.starting_with(/{{{/).until_after(/}}}/),handlebars:w.starting_with(/{{/).until_after(/}}/),php:w.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:w.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:w.starting_with(/{%/).until_after(/%}/),django_value:w.starting_with(/{{/).until_after(/}}/),django_comment:w.starting_with(/{#/).until_after(/#}/),smarty:w.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:w.starting_with(/{\*/).until_after(/\*}/),smarty_literal:w.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(D){var L=this._create();return L._disabled[D]=!0,L._update(),L},E.prototype.read_options=function(D){var L=this._create();for(var w in p)L._disabled[w]=D.templating.indexOf(w)===-1;return L._update(),L},E.prototype.exclude=function(D){var L=this._create();return L._excluded[D]=!0,L._update(),L},E.prototype.read=function(){var D="";this._match_pattern?D=this._input.read(this._starting_pattern):D=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),D+=L,L=this._read_template();return this._until_after&&(D+=this._input.readUntilAfter(this._until_pattern)),D},E.prototype.__set_templated_pattern=function(){var D=[];this._disabled.php||D.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||D.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||D.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||D.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(D.push(this.__patterns.django._starting_pattern.source),D.push(this.__patterns.django_value._starting_pattern.source),D.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||D.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&D.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+D.join("|")+")")},E.prototype._read_template=function(){var D="",L=this._input.peek();if(L==="<"){var w=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&w==="?"&&(D=D||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&w==="%"&&(D=D||this.__patterns.erb.read())}else L==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(D=D||this.__patterns.handlebars_comment.read(),D=D||this.__patterns.handlebars_unescaped.read(),D=D||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(D=D||this.__patterns.django_value.read()),this._excluded.django||(D=D||this.__patterns.django_comment.read(),D=D||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(D=D||this.__patterns.smarty_comment.read(),D=D||this.__patterns.smarty_literal.read(),D=D||this.__patterns.smarty.read()));return D},f.exports.TemplatablePattern=E},,,,function(f,c,l){var u=l(19).Beautifier,p=l(20).Options;function E(D,L,w,A){var P=new u(D,L,w,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,D=l(21).TOKEN,L=/\r\n|[\r\n]/,w=/\r\n|[\r\n]/g,A=function(ee,z){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=ee.max_preserve_newlines,this.preserve_newlines=ee.preserve_newlines,this._output=new p(ee,z)};A.prototype.current_line_has_match=function(ee){return this._output.current_line.has_match(ee)},A.prototype.set_space_before_token=function(ee,z){this._output.space_before_token=ee,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(ee){this._output.add_raw_token(ee)},A.prototype.print_preserved_newlines=function(ee){var z=0;ee.type!==D.TEXT&&ee.previous.type!==D.TEXT&&(z=ee.newlines?1:0),this.preserve_newlines&&(z=ee.newlines<this.max_preserve_newlines+1?ee.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(ee){return ee.whitespace_before||ee.newlines?(this.print_preserved_newlines(ee)||(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(ee){this._output.add_new_line(ee)},A.prototype.print_token=function(ee){ee.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(ee.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(ee){return ee=this.indent_level+(ee||0),ee<1?"":this._output.get_indent_string(ee)};var P=function(ee){for(var z=null,Z=ee.next;Z.type!==D.EOF&&ee.closed!==Z;){if(Z.type===D.ATTRIBUTE&&Z.text==="type"){Z.next&&Z.next.type===D.EQUALS&&Z.next.next&&Z.next.next.type===D.VALUE&&(z=Z.next.next.text);break}Z=Z.next}return z},U=function(ee,z){var Z=null,M=null;return z.closed?(ee==="script"?Z="text/javascript":ee==="style"&&(Z="text/css"),Z=P(z)||Z,Z.search("text/css")>-1?M="css":Z.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?M="javascript":Z.search(/(text|application|dojo)\/(x-)?(html)/)>-1?M="html":Z.search(/test\/null/)>-1&&(M="null"),M):null};function N(ee,z){return z.indexOf(ee)!==-1}function H(ee,z,Z){this.parent=ee||null,this.tag=z?z.tag_name:"",this.indent_level=Z||0,this.parser_token=z||null}function F(ee){this._printer=ee,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(ee){var z=new H(this._current_frame,ee,this._printer.indent_level);this._current_frame=z},F.prototype._try_pop_frame=function(ee){var z=null;return ee&&(z=ee.parser_token,this._printer.indent_level=ee.indent_level,this._current_frame=ee.parent),z},F.prototype._get_frame=function(ee,z){for(var Z=this._current_frame;Z&&ee.indexOf(Z.tag)===-1;){if(z&&z.indexOf(Z.tag)!==-1){Z=null;break}Z=Z.parent}return Z},F.prototype.try_pop=function(ee,z){var Z=this._get_frame([ee],z);return this._try_pop_frame(Z)},F.prototype.indent_to_tag=function(ee){var z=this._get_frame(ee);z&&(this._printer.indent_level=z.indent_level)};function q(ee,z,Z,M){this._source_text=ee||"",z=z||{},this._js_beautify=Z,this._css_beautify=M,this._tag_stack=null;var K=new u(z,"html");this._options=K,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"}q.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var ee=this._source_text,z=this._options.eol;this._options.eol==="auto"&&(z=`
|
|
|
`,ee&&L.test(ee)&&(z=ee.match(L)[0])),ee=ee.replace(w,`
|
|
|
`);var Z=ee.match(/^[\t ]*/)[0],M={text:"",type:""},K=new V(this._options),j=new A(this._options,Z),R=new E(ee,this._options).tokenize();this._tag_stack=new F(j);for(var C=null,Y=R.next();Y.type!==D.EOF;)Y.type===D.TAG_OPEN||Y.type===D.COMMENT?(C=this._handle_tag_open(j,Y,K,M,R),K=C):Y.type===D.ATTRIBUTE||Y.type===D.EQUALS||Y.type===D.VALUE||Y.type===D.TEXT&&!K.tag_complete?C=this._handle_inside_tag(j,Y,K,M):Y.type===D.TAG_CLOSE?C=this._handle_tag_close(j,Y,K):Y.type===D.TEXT?C=this._handle_text(j,Y,K):Y.type===D.CONTROL_FLOW_OPEN?C=this._handle_control_flow_open(j,Y):Y.type===D.CONTROL_FLOW_CLOSE?C=this._handle_control_flow_close(j,Y):j.add_raw_token(Y),M=C,Y=R.next();var ie=j._output.get_code(z);return ie},q.prototype._handle_control_flow_open=function(ee,z){var Z={text:z.text,type:z.type};return ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),z.newlines?ee.print_preserved_newlines(z):ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),ee.print_token(z),ee.indent(),Z},q.prototype._handle_control_flow_close=function(ee,z){var Z={text:z.text,type:z.type};return ee.deindent(),z.newlines?ee.print_preserved_newlines(z):ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),ee.print_token(z),Z},q.prototype._handle_tag_close=function(ee,z,Z){var M={text:z.text,type:z.type};return ee.alignment_size=0,Z.tag_complete=!0,ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),Z.is_unformatted?ee.add_raw_token(z):(Z.tag_start_char==="<"&&(ee.set_space_before_token(z.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&Z.has_wrapped_attrs&&ee.print_newline(!1)),ee.print_token(z)),Z.indent_content&&!(Z.is_unformatted||Z.is_content_unformatted)&&(ee.indent(),Z.indent_content=!1),!Z.is_inline_element&&!(Z.is_unformatted||Z.is_content_unformatted)&&ee.set_wrap_point(),M},q.prototype._handle_inside_tag=function(ee,z,Z,M){var K=Z.has_wrapped_attrs,j={text:z.text,type:z.type};return ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),Z.is_unformatted?ee.add_raw_token(z):Z.tag_start_char==="{"&&z.type===D.TEXT?ee.print_preserved_newlines(z)?(z.newlines=0,ee.add_raw_token(z)):ee.print_token(z):(z.type===D.ATTRIBUTE?ee.set_space_before_token(!0):(z.type===D.EQUALS||z.type===D.VALUE&&z.previous.type===D.EQUALS)&&ee.set_space_before_token(!1),z.type===D.ATTRIBUTE&&Z.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(ee.traverse_whitespace(z),K=K||z.newlines!==0),this._is_wrap_attributes_force&&Z.attr_count>=this._options.wrap_attributes_min_attrs&&(M.type!==D.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(ee.print_newline(!1),K=!0)),ee.print_token(z),K=K||ee.previous_token_wrapped(),Z.has_wrapped_attrs=K),j},q.prototype._handle_text=function(ee,z,Z){var M={text:z.text,type:"TK_CONTENT"};return Z.custom_beautifier_name?this._print_custom_beatifier_text(ee,z,Z):Z.is_unformatted||Z.is_content_unformatted?ee.add_raw_token(z):(ee.traverse_whitespace(z),ee.print_token(z)),M},q.prototype._print_custom_beatifier_text=function(ee,z,Z){var M=this;if(z.text!==""){var K=z.text,j,R=1,C="",Y="";Z.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?j=this._js_beautify:Z.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?j=this._css_beautify:Z.custom_beautifier_name==="html"&&(j=function(Ve,Oe){var Be=new q(Ve,Oe,M._js_beautify,M._css_beautify);return Be.beautify()}),this._options.indent_scripts==="keep"?R=0:this._options.indent_scripts==="separate"&&(R=-ee.indent_level);var ie=ee.get_full_indent(R);if(K=K.replace(/\n[ \t]*$/,""),Z.custom_beautifier_name!=="html"&&K[0]==="<"&&K.match(/^(<!--|<!\[CDATA\[)/)){var ve=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(K);if(!ve){ee.add_raw_token(z);return}C=ie+ve[1]+`
|
|
|
`,K=ve[4],ve[5]&&(Y=ie+ve[5]),K=K.replace(/\n[ \t]*$/,""),(ve[2]||ve[3].indexOf(`
|
|
|
`)!==-1)&&(ve=ve[3].match(/[ \t]+$/),ve&&(z.whitespace_before=ve[0]))}if(K)if(j){var Me=function(){this.eol=`
|
|
|
`};Me.prototype=this._options.raw_options;var ze=new Me;K=j(ie+K,ze)}else{var Ee=z.whitespace_before;Ee&&(K=K.replace(new RegExp(`
|
|
|
(`+Ee+")?","g"),`
|
|
|
`)),K=ie+K.replace(/\n/g,`
|
|
|
`+ie)}C&&(K?K=C+K+`
|
|
|
`+Y:K=C+Y),ee.print_newline(!1),K&&(z.text=K,z.whitespace_before="",z.newlines=0,ee.add_raw_token(z),ee.print_newline(!0))}},q.prototype._handle_tag_open=function(ee,z,Z,M,K){var j=this._get_tag_open_token(z);if((Z.is_unformatted||Z.is_content_unformatted)&&!Z.is_empty_element&&z.type===D.TAG_OPEN&&!j.is_start_tag?(ee.add_raw_token(z),j.start_tag_token=this._tag_stack.try_pop(j.tag_name)):(ee.traverse_whitespace(z),this._set_tag_position(ee,z,j,Z,M),j.is_inline_element||ee.set_wrap_point(),ee.print_token(z)),j.is_start_tag&&this._is_wrap_attributes_force){var R=0,C;do C=K.peek(R),C.type===D.ATTRIBUTE&&(j.attr_count+=1),R+=1;while(C.type!==D.EOF&&C.type!==D.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(j.alignment_size=z.text.length+1),!j.tag_complete&&!j.is_unformatted&&(ee.alignment_size=j.alignment_size),j};var V=function(ee,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 M;this.tag_start_char=Z.text[0],this.text=Z.text,this.tag_start_char==="<"?(M=Z.text.match(/^<([^\s>]*)/),this.tag_check=M?M[1]:""):(M=Z.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=M?M[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===D.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 K=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(K=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!ee.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(K)))}};q.prototype._get_tag_open_token=function(ee){var z=new V(this._options,this._tag_stack.get_parser_token(),ee);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},q.prototype._set_tag_position=function(ee,z,Z,M,K){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||ee.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)&&(ee.print_newline(!1),ee._output.just_added_blankline()||ee.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 j=ee.current_line_has_match(/{{#if/);j||ee.print_newline(!1)}Z.tag_name==="!--"&&K.type===D.TAG_CLOSE&&M.is_end_tag&&Z.text.indexOf(`
|
|
|
`)===-1||(Z.is_inline_element||Z.is_unformatted||ee.print_newline(!1),this._calcluate_parent_multiline(ee,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&&!(M.is_inline_element||M.is_unformatted)&&!(K.type===D.TAG_CLOSE&&Z.start_tag_token===M)&&K.type!=="TK_CONTENT",(Z.is_content_unformatted||Z.is_unformatted)&&(R=!1),R&&ee.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)&&(K.type!=="TK_CONTENT"||Z.is_content_unformatted)&&ee.print_newline(!1),this._calcluate_parent_multiline(ee,Z)},q.prototype._calcluate_parent_multiline=function(ee,z){z.parent&&ee._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"],ce=["a","audio","del","ins","map","noscript","video"];q.prototype._do_optional_end_element=function(ee){var z=null;if(!(ee.is_empty_element||!ee.is_start_tag||!ee.parent)){if(ee.tag_name==="body")z=z||this._tag_stack.try_pop("head");else if(ee.tag_name==="li")z=z||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(ee.tag_name==="dd"||ee.tag_name==="dt")z=z||this._tag_stack.try_pop("dt",["dl"]),z=z||this._tag_stack.try_pop("dd",["dl"]);else if(ee.parent.tag_name==="p"&&ne.indexOf(ee.tag_name)!==-1){var Z=ee.parent.parent;(!Z||ce.indexOf(Z.tag_name)===-1)&&(z=z||this._tag_stack.try_pop("p"))}else ee.tag_name==="rp"||ee.tag_name==="rt"?(z=z||this._tag_stack.try_pop("rt",["ruby","rtc"]),z=z||this._tag_stack.try_pop("rp",["ruby","rtc"])):ee.tag_name==="optgroup"?z=z||this._tag_stack.try_pop("optgroup",["select"]):ee.tag_name==="option"?z=z||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):ee.tag_name==="colgroup"?z=z||this._tag_stack.try_pop("caption",["table"]):ee.tag_name==="thead"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"])):ee.tag_name==="tbody"||ee.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"])):ee.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"])):(ee.tag_name==="th"||ee.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 ee.parent=this._tag_stack.get_parser_token(),z}},f.exports.Beautifier=q},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,D=l(14).TemplatablePattern,L=l(12).Pattern,w={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 D(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 q=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=F.matching(q).until_after(q)}};P.prototype=new u,P.prototype._is_comment=function(U){return!1},P.prototype._is_opening=function(U){return U.type===w.TAG_OPEN||U.type===w.CONTROL_FLOW_OPEN},P.prototype._is_closing=function(U,N){return U.type===w.TAG_CLOSE&&N&&((U.text===">"||U.text==="/>")&&N.text[0]==="<"||U.text==="}}"&&N.text[0]==="{"&&N.text[1]==="{")||U.type===w.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(w.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(w.UNKNOWN,this._input.next()),H)},P.prototype._read_comment_or_cdata=function(U){var N=null,H=null,F=null;if(U==="<"){var q=this._input.peek(1);q==="!"&&(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(w.COMMENT,H),N.directives=F)}return N},P.prototype._read_processing=function(U){var N=null,H=null,F=null;if(U==="<"){var q=this._input.peek(1);(q==="!"||q==="?")&&(H=this.__patterns.conditional_comment.read(),H=H||this.__patterns.processing.read()),H&&(N=this._create_token(w.COMMENT,H),N.directives=F)}return N},P.prototype._read_open=function(U,N){var H=null,F=null;return(!N||N.type===w.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(w.TAG_OPEN,H)),F},P.prototype._read_open_handlebars=function(U,N){var H=null,F=null;return(!N||N.type===w.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(w.COMMENT,H)):(H=this.__patterns.handlebars_open.read(),F=this._create_token(w.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 q=H.endsWith("(")?1:0,V=0;!(H.endsWith("{")&&q===V);){var ne=this._input.next();if(ne===null)break;ne==="("?q++:ne===")"&&V++,H+=ne}F=this._create_token(w.CONTROL_FLOW_OPEN,H)}else U==="}"&&N&&N.type===w.CONTROL_FLOW_OPEN&&(H=this._input.next(),F=this._create_token(w.CONTROL_FLOW_CLOSE,H));return F},P.prototype._read_close=function(U,N){var H=null,F=null;return N&&N.type===w.TAG_OPEN&&(N.text[0]==="<"&&(U===">"||U==="/"&&this._input.peek(1)===">")?(H=this._input.next(),U==="/"&&(H+=this._input.next()),F=this._create_token(w.TAG_CLOSE,H)):N.text[0]==="{"&&U==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),F=this._create_token(w.TAG_CLOSE,"}}"))),F},P.prototype._read_attribute=function(U,N,H){var F=null,q="";if(H&&H.text[0]==="<")if(U==="=")F=this._create_token(w.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(w.VALUE,V)}else q=this.__patterns.attribute.read(),q&&(N.type===w.EQUALS?F=this._create_token(w.VALUE,q):F=this._create_token(w.ATTRIBUTE,q));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===w.TAG_CLOSE&&N.opened.text[0]==="<"&&N.text[0]!=="/"){var q=N.opened.text.substr(1).toLowerCase();this._is_content_unformatted(q)&&(F=this._input.readUntil(new RegExp("</"+q+"[\\n\\r\\t ]*?>","ig")))}return F?this._create_token(w.TEXT,F):null},P.prototype._read_script_and_style=function(U,N){if(N.type===w.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=w.TEXT,F;var q=this._input.readUntil(new RegExp("</"+H+"[\\n\\r\\t ]*?>","ig"));if(q)return this._create_token(w.TEXT,q)}}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===w.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),H?this._create_token(w.TEXT,H):null},f.exports.Tokenizer=P,f.exports.TOKEN=w}],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 v=n(18);G=v})();var T=G;if(1)k=[b,b(58553),b(87804)],I=function(O){var m=b(58553),n=b(87804);return{html_beautify:function(v,f){return T(v,f,m.js_beautify,n.css_beautify)}}}.apply(me,k),I!==void 0&&(ft.exports=I);else var x,g})()},58553:function(ft,me){var b,k;(function(){var I;(function(){"use strict";var T=[function(m,n,v){var f=v(1).Beautifier,c=v(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,v){var f=v(2).Output,c=v(3).Token,l=v(4),u=v(5).Options,p=v(7).Tokenizer,E=v(7).line_starters,D=v(7).positionable_operators,L=v(7).TOKEN;function w(C,Y){return Y.indexOf(C)!==-1}function A(C){return C.replace(/^\s+/g,"")}function P(C){for(var Y={},ie=0;ie<C.length;ie++)Y[C[ie].replace(/-/g,"_")]=C[ie];return Y}function U(C,Y){return C&&C.type===L.RESERVED&&C.text===Y}function N(C,Y){return C&&C.type===L.RESERVED&&w(C.text,Y)}var H=["case","return","do","if","throw","else","await","break","continue","async"],F=["before-newline","after-newline","preserve-newline"],q=P(F),V=[q.before_newline,q.preserve_newline],ne={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function ce(C,Y){Y.multiline_frame||Y.mode===ne.ForInitializer||Y.mode===ne.Conditional||C.remove_indent(Y.start_line_index)}function ee(C){C=C.replace(l.allLineBreaks,`
|
|
|
`);for(var Y=[],ie=C.indexOf(`
|
|
|
`);ie!==-1;)Y.push(C.substring(0,ie)),C=C.substring(ie+1),ie=C.indexOf(`
|
|
|
`);return C.length&&Y.push(C),Y}function z(C){return C===ne.ArrayLiteral}function Z(C){return w(C,[ne.Expression,ne.ForInitializer,ne.Conditional])}function M(C,Y){for(var ie=0;ie<C.length;ie++){var ve=C[ie].trim();if(ve.charAt(0)!==Y)return!1}return!0}function K(C,Y){for(var ie=0,ve=C.length,Me;ie<ve;ie++)if(Me=C[ie],Me&&Me.indexOf(Y)!==0)return!1;return!0}function j(C,Y){Y=Y||{},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(Y)}j.prototype.create_flags=function(C,Y){var ie=0;C&&(ie=C.indentation_level,!this._output.just_added_newline()&&C.line_indent_level>ie&&(ie=C.line_indent_level));var ve={mode:Y,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:ie,alignment:0,line_indent_level:C?C.line_indent_level:ie,start_line_index:this._output.get_line_number(),ternary_depth:0};return ve},j.prototype._reset=function(C){var Y=C.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new f(this._options,Y),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(ne.BlockStatement);var ie=new p(C,this._options);return this._tokens=ie.tokenize(),C},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var C,Y=this._reset(this._source_text),ie=this._options.eol;this._options.eol==="auto"&&(ie=`
|
|
|
`,Y&&l.lineBreak.test(Y||"")&&(ie=Y.match(l.lineBreak)[0]));for(var ve=this._tokens.next();ve;)this.handle_token(ve),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ve,ve=this._tokens.next();return C=this._output.get_code(ie),C},j.prototype.handle_token=function(C,Y){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,Y):C.type===L.COMMENT?this.handle_comment(C,Y):C.type===L.DOT?this.handle_dot(C):C.type===L.EOF?this.handle_eof(C):C.type===L.UNKNOWN?this.handle_unknown(C,Y):this.handle_unknown(C,Y)},j.prototype.handle_whitespace_and_comments=function(C,Y){var ie=C.newlines,ve=this._options.keep_array_indentation&&z(this._flags.mode);if(C.comments_before)for(var Me=C.comments_before.next();Me;)this.handle_whitespace_and_comments(Me,Y),this.handle_token(Me,Y),Me=C.comments_before.next();if(ve)for(var ze=0;ze<ie;ze+=1)this.print_newline(ze>0,Y);else if(this._options.max_preserve_newlines&&ie>this._options.max_preserve_newlines&&(ie=this._options.max_preserve_newlines),this._options.preserve_newlines&&ie>1){this.print_newline(!1,Y);for(var Ee=1;Ee<ie;Ee+=1)this.print_newline(!0,Y)}};var R=["async","break","continue","return","throw","yield"];j.prototype.allow_wrap_or_preserved_newline=function(C,Y){if(Y=Y===void 0?!1:Y,!this._output.just_added_newline()){var ie=this._options.preserve_newlines&&C.newlines||Y,ve=w(this._flags.last_token.text,D)||w(C.text,D);if(ve){var Me=w(this._flags.last_token.text,D)&&w(this._options.operator_position,V)||w(C.text,D);ie=ie&&Me}if(ie)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()}}},j.prototype.print_newline=function(C,Y){if(!Y&&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 ie=this._tokens.peek();this._flags.mode===ne.Statement&&!(this._flags.if_block&&U(ie,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(C)&&(this._flags.multiline_frame=!0)},j.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))},j.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 Y=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(Y),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(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)},j.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.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))},j.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)},j.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&&ce(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.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"]))},j.prototype.start_of_statement=function(C){var Y=!1;return Y=Y||N(this._flags.last_token,["var","let","const"])&&C.type===L.WORD,Y=Y||U(this._flags.last_token,"do"),Y=Y||!(this._flags.parent.mode===ne.ObjectLiteral&&this._flags.mode===ne.Statement)&&N(this._flags.last_token,R)&&!C.newlines,Y=Y||U(this._flags.last_token,"else")&&!(U(C,"if")&&!C.comments_before),Y=Y||this._flags.last_token.type===L.END_EXPR&&(this._previous_flags.mode===ne.ForInitializer||this._previous_flags.mode===ne.Conditional),Y=Y||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,Y=Y||this._flags.mode===ne.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||N(this._flags.last_token,["get","set"])),Y?(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},j.prototype.handle_start_expr=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C);var Y=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(Y),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}Y=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()),w(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,Y=ne.ForInitializer):w(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,Y=ne.Conditional):w(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:(w(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 ie=this._tokens.peek(-3);if(this._options.space_after_named_function&&ie){var ve=this._tokens.peek(-4);N(ie,["async","function"])||ie.text==="*"&&N(ve,["async","function"])?this._output.space_before_token=!0:this._flags.mode===ne.ObjectLiteral?(ie.text==="{"||ie.text===","||ie.text==="*"&&(ve.text==="{"||ve.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==="*"&&(w(this._last_last_text,["function","yield"])||this._flags.mode===ne.ObjectLiteral&&w(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(Y),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},j.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(),ce(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)},j.prototype.handle_start_block=function(C){this.handle_whitespace_and_comments(C);var Y=this._tokens.peek(),ie=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):ie&&(w(ie.text,[":",","])&&w(Y.type,[L.STRING,L.WORD,L.RESERVED])||w(Y.text,["get","set","..."])&&w(ie.type,[L.WORD,L.RESERVED]))?w(this._last_last_text,["class","interface"])&&!w(ie.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):w(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 ve=!Y.comments_before&&Y.text==="}",Me=ve&&this._flags.last_word==="function"&&this._flags.last_token.type===L.END_EXPR;if(this._options.brace_preserve_inline){var ze=0,Ee=null;this._flags.inline_frame=!0;do if(ze+=1,Ee=this._tokens.peek(ze-1),Ee.newlines){this._flags.inline_frame=!1;break}while(Ee.type!==L.EOF&&!(Ee.type===L.END_BLOCK&&Ee.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&&(Me||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&&(w(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(),!ve&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},j.prototype.handle_end_block=function(C){for(this.handle_whitespace_and_comments(C);this._flags.mode===ne.Statement;)this.restore_mode();var Y=this._flags.last_token.type===L.START_BLOCK;this._flags.inline_frame&&!Y?this._output.space_before_token=!0:this._options.brace_style==="expand"?Y||this.print_newline():Y||(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)},j.prototype.handle_word=function(C){if(C.type===L.RESERVED){if(w(C.text,["set","get"])&&this._flags.mode!==ne.ObjectLiteral)C.type=L.WORD;else if(C.text==="import"&&w(this._tokens.peek().text,["(","."]))C.type=L.WORD;else if(w(C.text,["as","from"])&&!this._flags.import_block)C.type=L.WORD;else if(this._flags.mode===ne.ObjectLiteral){var Y=this._tokens.peek();Y.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()&&!(w(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")){(w(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(w(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 ie="NONE";if(this._flags.last_token.type===L.END_BLOCK?this._previous_flags.inline_frame?ie="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?ie="NEWLINE":(ie="SPACE",this._output.space_before_token=!0):ie="NEWLINE":this._flags.last_token.type===L.SEMICOLON&&this._flags.mode===ne.BlockStatement?ie="NEWLINE":this._flags.last_token.type===L.SEMICOLON&&Z(this._flags.mode)?ie="SPACE":this._flags.last_token.type===L.STRING?ie="NEWLINE":this._flags.last_token.type===L.RESERVED||this._flags.last_token.type===L.WORD||this._flags.last_token.text==="*"&&(w(this._last_last_text,["function","yield"])||this._flags.mode===ne.ObjectLiteral&&w(this._last_last_text,["{",","]))?ie="SPACE":this._flags.last_token.type===L.START_BLOCK?this._flags.inline_frame?ie="SPACE":ie="NEWLINE":this._flags.last_token.type===L.END_EXPR&&(this._output.space_before_token=!0,ie="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"?ie="SPACE":ie="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 ve=this._output.current_line;ve.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else ie==="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():ie==="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))},j.prototype.handle_semicolon=function(C){this.start_of_statement(C)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(C);for(var Y=this._tokens.peek();this._flags.mode===ne.Statement&&!(this._flags.if_block&&U(Y,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(C)},j.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)},j.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},j.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)},j.prototype.handle_operator=function(C){var Y=C.text==="*"&&(N(this._flags.last_token,["function","yield"])||w(this._flags.last_token.type,[L.START_BLOCK,L.COMMA,L.END_BLOCK,L.SEMICOLON])),ie=w(C.text,["-","+"])&&(w(this._flags.last_token.type,[L.START_BLOCK,L.START_EXPR,L.EQUALS,L.OPERATOR])||w(this._flags.last_token.text,E)||this._flags.last_token.text===",");if(!this.start_of_statement(C)){var ve=!Y;this.handle_whitespace_and_comments(C,ve)}if(C.text==="*"&&this._flags.last_token.type===L.DOT){this.print_token(C);return}if(C.text==="::"){this.print_token(C);return}if(w(C.text,["-","+"])&&this.start_of_object_property()){this.print_token(C);return}if(this._flags.last_token.type===L.OPERATOR&&w(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 Me=!0,ze=!0,Ee=!1;if(C.text===":"?this._flags.ternary_depth===0?Me=!1:(this._flags.ternary_depth-=1,Ee=!0):C.text==="?"&&(this._flags.ternary_depth+=1),!ie&&!Y&&this._options.preserve_newlines&&w(C.text,D)){var Ve=C.text===":",Oe=Ve&&Ee,Be=Ve&&!Ee;switch(this._options.operator_position){case q.before_newline:this._output.space_before_token=!Be,this.print_token(C),(!Ve||Oe)&&this.allow_wrap_or_preserved_newline(C),this._output.space_before_token=!0;return;case q.after_newline:this._output.space_before_token=!0,!Ve||Oe?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 q.preserve_newline:Be||this.allow_wrap_or_preserved_newline(C),Me=!(this._output.just_added_newline()||Be),this._output.space_before_token=Me,this.print_token(C),this._output.space_before_token=!0;return}}if(Y){this.allow_wrap_or_preserved_newline(C),Me=!1;var ut=this._tokens.peek();ze=ut&&w(ut.type,[L.WORD,L.RESERVED])}else if(C.text==="...")this.allow_wrap_or_preserved_newline(C),Me=this._flags.last_token.type===L.START_BLOCK,ze=!1;else if(w(C.text,["--","++","!","~"])||ie){if((this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR)&&this.allow_wrap_or_preserved_newline(C),Me=!1,ze=!1,C.newlines&&(C.text==="--"||C.text==="++"||C.text==="~")){var xt=N(this._flags.last_token,H)&&C.newlines;xt&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(xt,!0)}this._flags.last_token.text===";"&&Z(this._flags.mode)&&(Me=!0),this._flags.last_token.type===L.RESERVED?Me=!0:this._flags.last_token.type===L.END_EXPR?Me=!(this._flags.last_token.text==="]"&&(C.text==="--"||C.text==="++")):this._flags.last_token.type===L.OPERATOR&&(Me=w(C.text,["--","-","++","+"])&&w(this._flags.last_token.text,["--","-","++","+"]),w(C.text,["+","-"])&&w(this._flags.last_token.text,["--","++"])&&(ze=!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||Me,this.print_token(C),this._output.space_before_token=ze},j.prototype.handle_block_comment=function(C,Y){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,Y),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,Y)},j.prototype.print_block_commment=function(C,Y){var ie=ee(C.text),ve,Me=!1,ze=!1,Ee=C.whitespace_before,Ve=Ee.length;if(this.print_newline(!1,Y),this.print_token_line_indentation(C),this._output.add_token(ie[0]),this.print_newline(!1,Y),ie.length>1){for(ie=ie.slice(1),Me=M(ie,"*"),ze=K(ie,Ee),Me&&(this._flags.alignment=1),ve=0;ve<ie.length;ve++)Me?(this.print_token_line_indentation(C),this._output.add_token(A(ie[ve]))):ze&&ie[ve]?(this.print_token_line_indentation(C),this._output.add_token(ie[ve].substring(Ve))):(this._output.current_line.set_indent(-1),this._output.add_token(ie[ve])),this.print_newline(!1,Y);this._flags.alignment=0}},j.prototype.handle_comment=function(C,Y){C.newlines?this.print_newline(!1,Y):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(C),this.print_newline(!1,Y)},j.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)},j.prototype.handle_unknown=function(C,Y){this.print_token(C),C.text[C.text.length-1]===`
|
|
|
`&&this.print_newline(!1,Y)},j.prototype.handle_eof=function(C){for(;this._flags.mode===ne.Statement;)this.restore_mode();this.handle_whitespace_and_comments(C)},m.exports.Beautifier=j},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 v(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}v.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},v.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},v.prototype.__ensure_cache=function(c){for(;c>=this.__cache.length;)this.__add_column()},v.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 v(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(v,f,c,l){this.type=v,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 v="\\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+"|["+v+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 D=/[\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,v){var f=v(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 D=0;D<E.length;D++)E[D]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=E[D];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=v(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 v(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=v},function(m,n,v){var f=v(8).InputScanner,c=v(9).Tokenizer,l=v(9).TOKEN,u=v(13).Directives,p=v(4),E=v(12).Pattern,D=v(14).TemplatablePattern;function L(M,K){return K.indexOf(M)!==-1}var w={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 q=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"]),ce=new RegExp("^(?:"+ne.join("|")+")$"),ee,z=function(M,K){c.call(this,M,K),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var j=new E(this._input),R=new D(this._input).read_options(this._options);this.__patterns={template:R,identifier:R.starting_with(p.identifier).matching(p.identifierMatch),number:j.matching(P),punct:j.matching(q),comment:j.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:j.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:j.matching(/<!--/),html_comment_end:j.matching(/-->/),include:j.starting_with(/#include/).until_after(p.lineBreak),shebang:j.starting_with(/#!/).until_after(p.lineBreak),xml:j.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(M){return M.type===w.COMMENT||M.type===w.BLOCK_COMMENT||M.type===w.UNKNOWN},z.prototype._is_opening=function(M){return M.type===w.START_BLOCK||M.type===w.START_EXPR},z.prototype._is_closing=function(M,K){return(M.type===w.END_BLOCK||M.type===w.END_EXPR)&&K&&(M.text==="]"&&K.text==="["||M.text===")"&&K.text==="("||M.text==="}"&&K.text==="{")},z.prototype._reset=function(){ee=!1},z.prototype._get_next_token=function(M,K){var j=null;this._readWhitespace();var R=this._input.peek();return R===null?this._create_token(w.EOF,""):(j=j||this._read_non_javascript(R),j=j||this._read_string(R),j=j||this._read_pair(R,this._input.peek(1)),j=j||this._read_word(M),j=j||this._read_singles(R),j=j||this._read_comment(R),j=j||this._read_regexp(R,M),j=j||this._read_xml(R,M),j=j||this._read_punctuation(),j=j||this._create_token(w.UNKNOWN,this._input.next()),j)},z.prototype._read_word=function(M){var K;if(K=this.__patterns.identifier.read(),K!=="")return K=K.replace(p.allLineBreaks,`
|
|
|
`),!(M.type===w.DOT||M.type===w.RESERVED&&(M.text==="set"||M.text==="get"))&&ce.test(K)?(K==="in"||K==="of")&&(M.type===w.WORD||M.type===w.STRING)?this._create_token(w.OPERATOR,K):this._create_token(w.RESERVED,K):this._create_token(w.WORD,K);if(K=this.__patterns.number.read(),K!=="")return this._create_token(w.WORD,K)},z.prototype._read_singles=function(M){var K=null;return M==="("||M==="["?K=this._create_token(w.START_EXPR,M):M===")"||M==="]"?K=this._create_token(w.END_EXPR,M):M==="{"?K=this._create_token(w.START_BLOCK,M):M==="}"?K=this._create_token(w.END_BLOCK,M):M===";"?K=this._create_token(w.SEMICOLON,M):M==="."&&N.test(this._input.peek(1))?K=this._create_token(w.DOT,M):M===","&&(K=this._create_token(w.COMMA,M)),K&&this._input.next(),K},z.prototype._read_pair=function(M,K){var j=null;return M==="#"&&K==="{"&&(j=this._create_token(w.START_BLOCK,M+K)),j&&(this._input.next(),this._input.next()),j},z.prototype._read_punctuation=function(){var M=this.__patterns.punct.read();if(M!=="")return M==="="?this._create_token(w.EQUALS,M):M==="?."?this._create_token(w.DOT,M):this._create_token(w.OPERATOR,M)},z.prototype._read_non_javascript=function(M){var K="";if(M==="#"){if(this._is_first_token()&&(K=this.__patterns.shebang.read(),K))return this._create_token(w.UNKNOWN,K.trim()+`
|
|
|
`);if(K=this.__patterns.include.read(),K)return this._create_token(w.UNKNOWN,K.trim()+`
|
|
|
`);M=this._input.next();var j="#";if(this._input.hasNext()&&this._input.testChar(U)){do M=this._input.next(),j+=M;while(this._input.hasNext()&&M!=="#"&&M!=="=");return M==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(j+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(j+="{}",this._input.next(),this._input.next())),this._create_token(w.WORD,j)}this._input.back()}else if(M==="<"&&this._is_first_token()){if(K=this.__patterns.html_comment_start.read(),K){for(;this._input.hasNext()&&!this._input.testChar(p.newline);)K+=this._input.next();return ee=!0,this._create_token(w.COMMENT,K)}}else if(ee&&M==="-"&&(K=this.__patterns.html_comment_end.read(),K))return ee=!1,this._create_token(w.COMMENT,K);return null},z.prototype._read_comment=function(M){var K=null;if(M==="/"){var j="";if(this._input.peek(1)==="*"){j=this.__patterns.block_comment.read();var R=A.get_directives(j);R&&R.ignore==="start"&&(j+=A.readIgnored(this._input)),j=j.replace(p.allLineBreaks,`
|
|
|
`),K=this._create_token(w.BLOCK_COMMENT,j),K.directives=R}else this._input.peek(1)==="/"&&(j=this.__patterns.comment.read(),K=this._create_token(w.COMMENT,j))}return K},z.prototype._read_string=function(M){if(M==="`"||M==="'"||M==='"'){var K=this._input.next();return this.has_char_escapes=!1,M==="`"?K+=this._read_string_recursive("`",!0,"${"):K+=this._read_string_recursive(M),this.has_char_escapes&&this._options.unescape_strings&&(K=Z(K)),this._input.peek()===M&&(K+=this._input.next()),K=K.replace(p.allLineBreaks,`
|
|
|
`),this._create_token(w.STRING,K)}return null},z.prototype._allow_regexp_or_xml=function(M){return M.type===w.RESERVED&&L(M.text,["return","case","throw","else","do","typeof","yield"])||M.type===w.END_EXPR&&M.text===")"&&M.opened.previous.type===w.RESERVED&&L(M.opened.previous.text,["if","while","for"])||L(M.type,[w.COMMENT,w.START_EXPR,w.START_BLOCK,w.START,w.END_BLOCK,w.OPERATOR,w.EQUALS,w.EOF,w.SEMICOLON,w.COMMA])},z.prototype._read_regexp=function(M,K){if(M==="/"&&this._allow_regexp_or_xml(K)){for(var j=this._input.next(),R=!1,C=!1;this._input.hasNext()&&(R||C||this._input.peek()!==M)&&!this._input.testChar(p.newline);)j+=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()===M&&(j+=this._input.next(),j+=this._input.read(p.identifier)),this._create_token(w.STRING,j)}return null},z.prototype._read_xml=function(M,K){if(this._options.e4x&&M==="<"&&this._allow_regexp_or_xml(K)){var j="",R=this.__patterns.xml.read_match();if(R){for(var C=R[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),Y=C.indexOf("{")===0,ie=0;R;){var ve=!!R[1],Me=R[2],ze=!!R[R.length-1]||Me.slice(0,8)==="![CDATA[";if(!ze&&(Me===C||Y&&Me.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ve?--ie:++ie),j+=R[0],ie<=0)break;R=this.__patterns.xml.read_match()}return R||(j+=this._input.match(/[\s\S]*/g)[0]),j=j.replace(p.allLineBreaks,`
|
|
|
`),this._create_token(w.STRING,j)}}return null};function Z(M){for(var K="",j=0,R=new f(M),C=null;R.hasNext();)if(C=R.match(/([\s]|[^\\]|\\\\)+/g),C&&(K+=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{K+="\\",R.hasNext()&&(K+=R.next());continue}if(!C||(j=parseInt(C[1],16),j>126&&j<=255&&C[0].indexOf("x")===0))return M;j>=0&&j<32||j>1114111?K+="\\"+C[0]:j===34||j===39||j===92?K+="\\"+String.fromCharCode(j):K+=String.fromCharCode(j)}return K}z.prototype._read_string_recursive=function(M,K,j){var R,C;M==="'"?C=this.__patterns.single_quote:M==='"'?C=this.__patterns.double_quote:M==="`"?C=this.__patterns.template_text:M==="}"&&(C=this.__patterns.template_expression);for(var Y=C.read(),ie="";this._input.hasNext();){if(ie=this._input.next(),ie===M||!K&&p.newline.test(ie)){this._input.back();break}else ie==="\\"&&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(),ie+=this._input.next()):j&&(j==="${"&&ie==="$"&&this._input.peek()==="{"&&(ie+=this._input.next()),j===ie&&(M==="`"?ie+=this._read_string_recursive("}",K,"`"):ie+=this._read_string_recursive("`",K,"${"),this._input.hasNext()&&(ie+=this._input.next())));ie+=C.read(),Y+=ie}return Y},m.exports.Tokenizer=z,m.exports.TOKEN=w,m.exports.positionable_operators=H.slice(),m.exports.line_starters=V.slice()},function(m){var n=RegExp.prototype.hasOwnProperty("sticky");function v(f){this.__input=f||"",this.__input_length=this.__input.length,this.__position=0}v.prototype.restart=function(){this.__position=0},v.prototype.back=function(){this.__position>0&&(this.__position-=1)},v.prototype.hasNext=function(){return this.__position<this.__input_length},v.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__input.charAt(this.__position),this.__position+=1),f},v.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},v.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},v.prototype.test=function(f,c){return c=c||0,c+=this.__position,c>=0&&c<this.__input_length?!!this.__match(f,c):!1},v.prototype.testChar=function(f,c){var l=this.peek(c);return f.lastIndex=0,l!==null&&f.test(l)},v.prototype.match=function(f){var c=this.__match(f,this.__position);return c?this.__position+=c[0].length:c=null,c},v.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},v.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},v.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},v.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},v.prototype.get_literal_regexp=function(f){return RegExp(f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(f){var c=this.__position,l=this.readUntilAfter(f);return this.__position=c,l},v.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=v},function(m,n,v){var f=v(8).InputScanner,c=v(3).Token,l=v(10).TokenStream,u=v(11).WhitespacePattern,p={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},E=function(D,L){this._input=new f(D),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 D,L=new c(p.START,""),w=null,A=[],P=new l;L.type!==p.EOF;){for(D=this._get_next_token(L,w);this._is_comment(D);)P.add(D),D=this._get_next_token(L,w);P.isEmpty()||(D.comments_before=P,P=new l),D.parent=w,this._is_opening(D)?(A.push(w),w=D):w&&this._is_closing(D,w)&&(D.opened=w,w.closed=D,w=A.pop(),D.parent=w),D.previous=L,L.next=D,this.__tokens.add(D),L=D}return this.__tokens},E.prototype._is_first_token=function(){return this.__tokens.isEmpty()},E.prototype._reset=function(){},E.prototype._get_next_token=function(D,L){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(p.RAW,w):this._create_token(p.EOF,"")},E.prototype._is_comment=function(D){return!1},E.prototype._is_opening=function(D){return!1},E.prototype._is_closing=function(D,L){return!1},E.prototype._create_token=function(D,L){var w=new c(D,L,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},E.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},m.exports.Tokenizer=E,m.exports.TOKEN=p},function(m){function n(v){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=v}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 v=null;return this.hasNext()&&(v=this.__tokens[this.__position],this.__position+=1),v},n.prototype.peek=function(v){var f=null;return v=v||0,v+=this.__position,v>=0&&v<this.__tokens_length&&(f=this.__tokens[v]),f},n.prototype.add=function(v){this.__parent_token&&(v.parent=this.__parent_token),this.__tokens.push(v),this.__tokens_length+=1},m.exports.TokenStream=n},function(m,n,v){var f=v(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=[],D=l.exec(u);D;)E.push(u.substring(p,D.index)),p=D.index+D[0].length,D=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(v,f){this._input=v,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 v=this._input.read(this._starting_pattern);return(!this._starting_pattern||v)&&(v+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),v},n.prototype.read_match=function(){return this._input.match(this._match_pattern)},n.prototype.until_after=function(v){var f=this._create();return f._until_after=!0,f._until_pattern=this._input.get_regexp(v),f._update(),f},n.prototype.until=function(v){var f=this._create();return f._until_after=!1,f._until_pattern=this._input.get_regexp(v),f._update(),f},n.prototype.starting_with=function(v){var f=this._create();return f._starting_pattern=this._input.get_regexp(v,!0),f._update(),f},n.prototype.matching=function(v){var f=this._create();return f._match_pattern=this._input.get_regexp(v,!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(v,f){v=typeof v=="string"?v:v.source,f=typeof f=="string"?f:f.source,this.__directives_block_pattern=new RegExp(v+/ beautify( \w+[:]\w+)+ /.source+f,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(v+/\sbeautify\signore:end\s/.source+f,"g")}n.prototype.get_directives=function(v){if(!v.match(this.__directives_block_pattern))return null;var f={};this.__directive_pattern.lastIndex=0;for(var c=this.__directive_pattern.exec(v);c;)f[c[1]]=c[2],c=this.__directive_pattern.exec(v);return f},n.prototype.readIgnored=function(v){return v.readUntilAfter(this.__directives_end_ignore_pattern)},m.exports.Directives=n},function(m,n,v){var f=v(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}],x={};function g(m){var n=x[m];if(n!==void 0)return n.exports;var v=x[m]={exports:{}};return T[m](v,v.exports,g),v.exports}var O=g(0);I=O})();var G=I;b=[],k=function(){return{js_beautify:G}}.apply(me,b),k!==void 0&&(ft.exports=k)})()},32834:function(ft){(function(me,b){ft.exports=b()})(this,function(){"use strict";function me(xe,ge){for(var be=0;be<ge.length;be++){var te=ge[be];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(xe,te.key,te)}}function b(xe,ge,be){return ge&&me(xe.prototype,ge),be&&me(xe,be),xe}function k(xe,ge){if(xe){if(typeof xe=="string")return I(xe,ge);var be=Object.prototype.toString.call(xe).slice(8,-1);if(be==="Object"&&xe.constructor&&(be=xe.constructor.name),be==="Map"||be==="Set")return Array.from(xe);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return I(xe,ge)}}function I(xe,ge){(ge==null||ge>xe.length)&&(ge=xe.length);for(var be=0,te=new Array(ge);be<ge;be++)te[be]=xe[be];return te}function G(xe,ge){var be=typeof Symbol!="undefined"&&xe[Symbol.iterator]||xe["@@iterator"];if(be)return(be=be.call(xe)).next.bind(be);if(Array.isArray(xe)||(be=k(xe))||ge&&xe&&typeof xe.length=="number"){be&&(xe=be);var te=0;return function(){return te>=xe.length?{done:!0}:{done:!1,value:xe[te++]}}}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 T={exports:{}};function x(){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 g(xe){T.exports.defaults=xe}T.exports={defaults:x(),getDefaults:x,changeDefaults:g};var O=/[&<>"']/,m=/[&<>"']/g,n=/[<>"']|&(?!#?\w+;)/,v=/[<>"']|&(?!#?\w+;)/g,f={"&":"&","<":"<",">":">",'"':""","'":"'"},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(v,c);return xe}var u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function p(xe){return xe.replace(u,function(ge,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var E=/(^|[^\[])\^/g;function D(xe,ge){xe=xe.source||xe,ge=ge||"";var be={replace:function(re,ae){return ae=ae.source||ae,ae=ae.replace(E,"$1"),xe=xe.replace(re,ae),be},getRegex:function(){return new RegExp(xe,ge)}};return be}var L=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(xe,ge,be){if(xe){var te;try{te=decodeURIComponent(p(be)).replace(L,"").toLowerCase()}catch(re){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ge&&!w.test(be)&&(be=F(ge,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(re){return null}return be}var P={},U=/^[^:]+:\/*[^/]*$/,N=/^([^:]+:)[\s\S]*$/,H=/^([^:]+:\/*[^/]*)[\s\S]*$/;function F(xe,ge){P[" "+xe]||(U.test(xe)?P[" "+xe]=xe+"/":P[" "+xe]=ce(xe,"/",!0)),xe=P[" "+xe];var be=xe.indexOf(":")===-1;return ge.substring(0,2)==="//"?be?ge:xe.replace(N,"$1")+ge:ge.charAt(0)==="/"?be?ge:xe.replace(H,"$1")+ge:xe+ge}var q={exec:function(){}};function V(xe){for(var ge=1,be,te;ge<arguments.length;ge++){be=arguments[ge];for(te in be)Object.prototype.hasOwnProperty.call(be,te)&&(xe[te]=be[te])}return xe}function ne(xe,ge){var be=xe.replace(/\|/g,function(ae,he,_e){for(var tt=!1,Ke=he;--Ke>=0&&_e[Ke]==="\\";)tt=!tt;return tt?"|":" |"}),te=be.split(/ \|/),re=0;if(te.length>ge)te.splice(ge);else for(;te.length<ge;)te.push("");for(;re<te.length;re++)te[re]=te[re].trim().replace(/\\\|/g,"|");return te}function ce(xe,ge,be){var te=xe.length;if(te===0)return"";for(var re=0;re<te;){var ae=xe.charAt(te-re-1);if(ae===ge&&!be)re++;else if(ae!==ge&&be)re++;else break}return xe.substr(0,te-re)}function ee(xe,ge){if(xe.indexOf(ge[1])===-1)return-1;for(var be=xe.length,te=0,re=0;re<be;re++)if(xe[re]==="\\")re++;else if(xe[re]===ge[0])te++;else if(xe[re]===ge[1]&&(te--,te<0))return re;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 be="";ge>1;)ge&1&&(be+=xe),ge>>=1,xe+=xe;return be+xe}var M={escape:l,unescape:p,edit:D,cleanUrl:A,resolveUrl:F,noopTest:q,merge:V,splitCells:ne,rtrim:ce,findClosingBracket:ee,checkSanitizeDeprecation:z,repeatString:Z},K=T.exports.defaults,j=M.rtrim,R=M.splitCells,C=M.escape,Y=M.findClosingBracket;function ie(xe,ge,be){var te=ge.href,re=ge.title?C(ge.title):null,ae=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:be,href:te,title:re,text:ae}:{type:"image",raw:be,href:te,title:re,text:C(ae)}}function ve(xe,ge){var be=xe.match(/^(\s+)(?:```)/);if(be===null)return ge;var te=be[1];return ge.split(`
|
|
|
`).map(function(re){var ae=re.match(/^\s+/);if(ae===null)return re;var he=ae[0];return he.length>=te.length?re.slice(te.length):re}).join(`
|
|
|
`)}var Me=function(){function xe(be){this.options=be||K}var ge=xe.prototype;return ge.space=function(te){var re=this.rules.block.newline.exec(te);if(re)return re[0].length>1?{type:"space",raw:re[0]}:{raw:`
|
|
|
`}},ge.code=function(te){var re=this.rules.block.code.exec(te);if(re){var ae=re[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?ae:j(ae,`
|
|
|
`)}}},ge.fences=function(te){var re=this.rules.block.fences.exec(te);if(re){var ae=re[0],he=ve(ae,re[3]||"");return{type:"code",raw:ae,lang:re[2]?re[2].trim():re[2],text:he}}},ge.heading=function(te){var re=this.rules.block.heading.exec(te);if(re){var ae=re[2].trim();if(/#$/.test(ae)){var he=j(ae,"#");(this.options.pedantic||!he||/ $/.test(he))&&(ae=he.trim())}return{type:"heading",raw:re[0],depth:re[1].length,text:ae}}},ge.nptable=function(te){var re=this.rules.block.nptable.exec(te);if(re){var ae={type:"table",header:R(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(`
|
|
|
`):[],raw:re[0]};if(ae.header.length===ae.align.length){var he=ae.align.length,_e;for(_e=0;_e<he;_e++)/^ *-+: *$/.test(ae.align[_e])?ae.align[_e]="right":/^ *:-+: *$/.test(ae.align[_e])?ae.align[_e]="center":/^ *:-+ *$/.test(ae.align[_e])?ae.align[_e]="left":ae.align[_e]=null;for(he=ae.cells.length,_e=0;_e<he;_e++)ae.cells[_e]=R(ae.cells[_e],ae.header.length);return ae}}},ge.hr=function(te){var re=this.rules.block.hr.exec(te);if(re)return{type:"hr",raw:re[0]}},ge.blockquote=function(te){var re=this.rules.block.blockquote.exec(te);if(re){var ae=re[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:re[0],text:ae}}},ge.list=function(te){var re=this.rules.block.list.exec(te);if(re){var ae=re[0],he=re[2],_e=he.length>1,tt={type:"list",raw:ae,ordered:_e,start:_e?+he.slice(0,-1):"",loose:!1,items:[]},Ke=re[0].match(this.rules.block.item),qe=!1,ot,Pt,Ft,Bt,vt,si,_i,zt,fi,Nt=Ke.length;Ft=this.rules.block.listItemStart.exec(Ke[0]);for(var mt=0;mt<Nt;mt++){if(ot=Ke[mt],ae=ot,this.options.pedantic||(fi=ot.match(new RegExp("\\n\\s*\\n {0,"+(Ft[0].length-1)+"}\\S")),fi&&(vt=ot.length-fi.index+Ke.slice(mt+1).join(`
|
|
|
`).length,tt.raw=tt.raw.substring(0,tt.raw.length-vt),ot=ot.substring(0,fi.index),ae=ot,Nt=mt+1)),mt!==Nt-1){if(Bt=this.rules.block.listItemStart.exec(Ke[mt+1]),this.options.pedantic?Bt[1].length>Ft[1].length:Bt[1].length>=Ft[0].length||Bt[1].length>3){Ke.splice(mt,2,Ke[mt]+(!this.options.pedantic&&Bt[1].length<Ft[0].length&&!Ke[mt].match(/\n$/)?"":`
|
|
|
`)+Ke[mt+1]),mt--,Nt--;continue}else(!this.options.pedantic||this.options.smartLists?Bt[2][Bt[2].length-1]!==he[he.length-1]:_e===(Bt[2].length===1))&&(vt=Ke.slice(mt+1).join(`
|
|
|
`).length,tt.raw=tt.raw.substring(0,tt.raw.length-vt),mt=Nt-1);Ft=Bt}Pt=ot.length,ot=ot.replace(/^ *([*+-]|\d+[.)]) ?/,""),~ot.indexOf(`
|
|
|
`)&&(Pt-=ot.length,ot=this.options.pedantic?ot.replace(/^ {1,4}/gm,""):ot.replace(new RegExp("^ {1,"+Pt+"}","gm"),"")),ot=j(ot,`
|
|
|
`),mt!==Nt-1&&(ae=ae+`
|
|
|
`),si=qe||/\n\n(?!\s*$)/.test(ae),mt!==Nt-1&&(qe=ae.slice(-2)===`
|
|
|
|
|
|
`,si||(si=qe)),si&&(tt.loose=!0),this.options.gfm&&(_i=/^\[[ xX]\] /.test(ot),zt=void 0,_i&&(zt=ot[1]!==" ",ot=ot.replace(/^\[[ xX]\] +/,""))),tt.items.push({type:"list_item",raw:ae,task:_i,checked:zt,loose:si,text:ot})}return tt}},ge.html=function(te){var re=this.rules.block.html.exec(te);if(re)return{type:this.options.sanitize?"paragraph":"html",raw:re[0],pre:!this.options.sanitizer&&(re[1]==="pre"||re[1]==="script"||re[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):C(re[0]):re[0]}},ge.def=function(te){var re=this.rules.block.def.exec(te);if(re){re[3]&&(re[3]=re[3].substring(1,re[3].length-1));var ae=re[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:ae,raw:re[0],href:re[2],title:re[3]}}},ge.table=function(te){var re=this.rules.block.table.exec(te);if(re){var ae={type:"table",header:R(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(`
|
|
|
`):[]};if(ae.header.length===ae.align.length){ae.raw=re[0];var he=ae.align.length,_e;for(_e=0;_e<he;_e++)/^ *-+: *$/.test(ae.align[_e])?ae.align[_e]="right":/^ *:-+: *$/.test(ae.align[_e])?ae.align[_e]="center":/^ *:-+ *$/.test(ae.align[_e])?ae.align[_e]="left":ae.align[_e]=null;for(he=ae.cells.length,_e=0;_e<he;_e++)ae.cells[_e]=R(ae.cells[_e].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},ge.lheading=function(te){var re=this.rules.block.lheading.exec(te);if(re)return{type:"heading",raw:re[0],depth:re[2].charAt(0)==="="?1:2,text:re[1]}},ge.paragraph=function(te){var re=this.rules.block.paragraph.exec(te);if(re)return{type:"paragraph",raw:re[0],text:re[1].charAt(re[1].length-1)===`
|
|
|
`?re[1].slice(0,-1):re[1]}},ge.text=function(te){var re=this.rules.block.text.exec(te);if(re)return{type:"text",raw:re[0],text:re[0]}},ge.escape=function(te){var re=this.rules.inline.escape.exec(te);if(re)return{type:"escape",raw:re[0],text:C(re[1])}},ge.tag=function(te,re,ae){var he=this.rules.inline.tag.exec(te);if(he)return!re&&/^<a /i.test(he[0])?re=!0:re&&/^<\/a>/i.test(he[0])&&(re=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:re,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):C(he[0]):he[0]}},ge.link=function(te){var re=this.rules.inline.link.exec(te);if(re){var ae=re[2].trim();if(!this.options.pedantic&&/^</.test(ae)){if(!/>$/.test(ae))return;var he=j(ae.slice(0,-1),"\\");if((ae.length-he.length)%2===0)return}else{var _e=Y(re[2],"()");if(_e>-1){var tt=re[0].indexOf("!")===0?5:4,Ke=tt+re[1].length+_e;re[2]=re[2].substring(0,_e),re[0]=re[0].substring(0,Ke).trim(),re[3]=""}}var qe=re[2],ot="";if(this.options.pedantic){var Pt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(qe);Pt&&(qe=Pt[1],ot=Pt[3])}else ot=re[3]?re[3].slice(1,-1):"";return qe=qe.trim(),/^</.test(qe)&&(this.options.pedantic&&!/>$/.test(ae)?qe=qe.slice(1):qe=qe.slice(1,-1)),ie(re,{href:qe&&qe.replace(this.rules.inline._escapes,"$1"),title:ot&&ot.replace(this.rules.inline._escapes,"$1")},re[0])}},ge.reflink=function(te,re){var ae;if((ae=this.rules.inline.reflink.exec(te))||(ae=this.rules.inline.nolink.exec(te))){var he=(ae[2]||ae[1]).replace(/\s+/g," ");if(he=re[he.toLowerCase()],!he||!he.href){var _e=ae[0].charAt(0);return{type:"text",raw:_e,text:_e}}return ie(ae,he,ae[0])}},ge.emStrong=function(te,re,ae){ae===void 0&&(ae="");var he=this.rules.inline.emStrong.lDelim.exec(te);if(he&&!(he[3]&&ae.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 _e=he[1]||he[2]||"";if(!_e||_e&&(ae===""||this.rules.inline.punctuation.exec(ae))){var tt=he[0].length-1,Ke,qe,ot=tt,Pt=0,Ft=he[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(Ft.lastIndex=0,re=re.slice(-1*te.length+tt);(he=Ft.exec(re))!=null;)if(Ke=he[1]||he[2]||he[3]||he[4]||he[5]||he[6],!!Ke){if(qe=Ke.length,he[3]||he[4]){ot+=qe;continue}else if((he[5]||he[6])&&tt%3&&!((tt+qe)%3)){Pt+=qe;continue}if(ot-=qe,!(ot>0))return qe=Math.min(qe,qe+ot+Pt),Math.min(tt,qe)%2?{type:"em",raw:te.slice(0,tt+he.index+qe+1),text:te.slice(1,tt+he.index+qe)}:{type:"strong",raw:te.slice(0,tt+he.index+qe+1),text:te.slice(2,tt+he.index+qe-1)}}}}},ge.codespan=function(te){var re=this.rules.inline.code.exec(te);if(re){var ae=re[2].replace(/\n/g," "),he=/[^ ]/.test(ae),_e=/^ /.test(ae)&&/ $/.test(ae);return he&&_e&&(ae=ae.substring(1,ae.length-1)),ae=C(ae,!0),{type:"codespan",raw:re[0],text:ae}}},ge.br=function(te){var re=this.rules.inline.br.exec(te);if(re)return{type:"br",raw:re[0]}},ge.del=function(te){var re=this.rules.inline.del.exec(te);if(re)return{type:"del",raw:re[0],text:re[2]}},ge.autolink=function(te,re){var ae=this.rules.inline.autolink.exec(te);if(ae){var he,_e;return ae[2]==="@"?(he=C(this.options.mangle?re(ae[1]):ae[1]),_e="mailto:"+he):(he=C(ae[1]),_e=he),{type:"link",raw:ae[0],text:he,href:_e,tokens:[{type:"text",raw:he,text:he}]}}},ge.url=function(te,re){var ae;if(ae=this.rules.inline.url.exec(te)){var he,_e;if(ae[2]==="@")he=C(this.options.mangle?re(ae[0]):ae[0]),_e="mailto:"+he;else{var tt;do tt=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(tt!==ae[0]);he=C(ae[0]),ae[1]==="www."?_e="http://"+he:_e=he}return{type:"link",raw:ae[0],text:he,href:_e,tokens:[{type:"text",raw:he,text:he}]}}},ge.inlineText=function(te,re,ae){var he=this.rules.inline.text.exec(te);if(he){var _e;return re?_e=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):C(he[0]):he[0]:_e=C(this.options.smartypants?ae(he[0]):he[0]),{type:"text",raw:he[0],text:_e}}},xe}(),ze=M.noopTest,Ee=M.edit,Ve=M.merge,Oe={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:ze,table:ze,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};Oe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Oe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Oe.def=Ee(Oe.def).replace("label",Oe._label).replace("title",Oe._title).getRegex(),Oe.bullet=/(?:[*+-]|\d{1,9}[.)])/,Oe.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Oe.item=Ee(Oe.item,"gm").replace(/bull/g,Oe.bullet).getRegex(),Oe.listItemStart=Ee(/^( *)(bull) */).replace("bull",Oe.bullet).getRegex(),Oe.list=Ee(Oe.list).replace(/bull/g,Oe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Oe.def.source+")").getRegex(),Oe._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",Oe._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Oe.html=Ee(Oe.html,"i").replace("comment",Oe._comment).replace("tag",Oe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Oe.paragraph=Ee(Oe._paragraph).replace("hr",Oe.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",Oe._tag).getRegex(),Oe.blockquote=Ee(Oe.blockquote).replace("paragraph",Oe.paragraph).getRegex(),Oe.normal=Ve({},Oe),Oe.gfm=Ve({},Oe.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*|$)"}),Oe.gfm.nptable=Ee(Oe.gfm.nptable).replace("hr",Oe.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",Oe._tag).getRegex(),Oe.gfm.table=Ee(Oe.gfm.table).replace("hr",Oe.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",Oe._tag).getRegex(),Oe.pedantic=Ve({},Oe.normal,{html:Ee(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Oe._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:ze,paragraph:Ee(Oe.normal._paragraph).replace("hr",Oe.hr).replace("heading",` *#{1,6} *[^
|
|
|
]`).replace("lheading",Oe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Be={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ze,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:ze,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};Be._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Be.punctuation=Ee(Be.punctuation).replace(/punctuation/g,Be._punctuation).getRegex(),Be.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,Be.escapedEmSt=/\\\*|\\_/g,Be._comment=Ee(Oe._comment).replace("(?:-->|$)","-->").getRegex(),Be.emStrong.lDelim=Ee(Be.emStrong.lDelim).replace(/punct/g,Be._punctuation).getRegex(),Be.emStrong.rDelimAst=Ee(Be.emStrong.rDelimAst,"g").replace(/punct/g,Be._punctuation).getRegex(),Be.emStrong.rDelimUnd=Ee(Be.emStrong.rDelimUnd,"g").replace(/punct/g,Be._punctuation).getRegex(),Be._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Be._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Be._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])?)+(?![-_])/,Be.autolink=Ee(Be.autolink).replace("scheme",Be._scheme).replace("email",Be._email).getRegex(),Be._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Be.tag=Ee(Be.tag).replace("comment",Be._comment).replace("attribute",Be._attribute).getRegex(),Be._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Be._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Be._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Be.link=Ee(Be.link).replace("label",Be._label).replace("href",Be._href).replace("title",Be._title).getRegex(),Be.reflink=Ee(Be.reflink).replace("label",Be._label).getRegex(),Be.reflinkSearch=Ee(Be.reflinkSearch,"g").replace("reflink",Be.reflink).replace("nolink",Be.nolink).getRegex(),Be.normal=Ve({},Be),Be.pedantic=Ve({},Be.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:Ee(/^!?\[(label)\]\((.*?)\)/).replace("label",Be._label).getRegex(),reflink:Ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Be._label).getRegex()}),Be.gfm=Ve({},Be.normal,{escape:Ee(Be.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Be.gfm.url=Ee(Be.gfm.url,"i").replace("email",Be.gfm._extended_email).getRegex(),Be.breaks=Ve({},Be.gfm,{br:Ee(Be.br).replace("{2,}","*").getRegex(),text:Ee(Be.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ut={block:Oe,inline:Be},xt=Me,st=T.exports.defaults,$t=ut.block,Ct=ut.inline,Ce=M.repeatString;function De(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 de(xe){var ge="",be,te,re=xe.length;for(be=0;be<re;be++)te=xe.charCodeAt(be),Math.random()>.5&&(te="x"+te.toString(16)),ge+="&#"+te+";";return ge}var Pe=function(){function xe(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||st,this.options.tokenizer=this.options.tokenizer||new xt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:$t.normal,inline:Ct.normal};this.options.pedantic?(te.block=$t.pedantic,te.inline=Ct.pedantic):this.options.gfm&&(te.block=$t.gfm,this.options.breaks?te.inline=Ct.breaks:te.inline=Ct.gfm),this.tokenizer.rules=te}xe.lex=function(te,re){var ae=new xe(re);return ae.lex(te)},xe.lexInline=function(te,re){var ae=new xe(re);return ae.inlineTokens(te)};var ge=xe.prototype;return ge.lex=function(te){return te=te.replace(/\r\n|\r/g,`
|
|
|
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},ge.blockTokens=function(te,re,ae){re===void 0&&(re=[]),ae===void 0&&(ae=!0),this.options.pedantic&&(te=te.replace(/^ +$/gm,""));for(var he,_e,tt,Ke;te;){if(he=this.tokenizer.space(te)){te=te.substring(he.raw.length),he.type&&re.push(he);continue}if(he=this.tokenizer.code(te)){te=te.substring(he.raw.length),Ke=re[re.length-1],Ke&&Ke.type==="paragraph"?(Ke.raw+=`
|
|
|
`+he.raw,Ke.text+=`
|
|
|
`+he.text):re.push(he);continue}if(he=this.tokenizer.fences(te)){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.heading(te)){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.nptable(te)){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.hr(te)){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.blockquote(te)){te=te.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],ae),re.push(he);continue}if(he=this.tokenizer.list(te)){for(te=te.substring(he.raw.length),tt=he.items.length,_e=0;_e<tt;_e++)he.items[_e].tokens=this.blockTokens(he.items[_e].text,[],!1);re.push(he);continue}if(he=this.tokenizer.html(te)){te=te.substring(he.raw.length),re.push(he);continue}if(ae&&(he=this.tokenizer.def(te))){te=te.substring(he.raw.length),this.tokens.links[he.tag]||(this.tokens.links[he.tag]={href:he.href,title:he.title});continue}if(he=this.tokenizer.table(te)){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.lheading(te)){te=te.substring(he.raw.length),re.push(he);continue}if(ae&&(he=this.tokenizer.paragraph(te))){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.text(te)){te=te.substring(he.raw.length),Ke=re[re.length-1],Ke&&Ke.type==="text"?(Ke.raw+=`
|
|
|
`+he.raw,Ke.text+=`
|
|
|
`+he.text):re.push(he);continue}if(te){var qe="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(qe);break}else throw new Error(qe)}}return re},ge.inline=function(te){var re,ae,he,_e,tt,Ke,qe=te.length;for(re=0;re<qe;re++)switch(Ke=te[re],Ke.type){case"paragraph":case"text":case"heading":{Ke.tokens=[],this.inlineTokens(Ke.text,Ke.tokens);break}case"table":{for(Ke.tokens={header:[],cells:[]},_e=Ke.header.length,ae=0;ae<_e;ae++)Ke.tokens.header[ae]=[],this.inlineTokens(Ke.header[ae],Ke.tokens.header[ae]);for(_e=Ke.cells.length,ae=0;ae<_e;ae++)for(tt=Ke.cells[ae],Ke.tokens.cells[ae]=[],he=0;he<tt.length;he++)Ke.tokens.cells[ae][he]=[],this.inlineTokens(tt[he],Ke.tokens.cells[ae][he]);break}case"blockquote":{this.inline(Ke.tokens);break}case"list":{for(_e=Ke.items.length,ae=0;ae<_e;ae++)this.inline(Ke.items[ae].tokens);break}}return te},ge.inlineTokens=function(te,re,ae,he){re===void 0&&(re=[]),ae===void 0&&(ae=!1),he===void 0&&(he=!1);var _e,tt,Ke=te,qe,ot,Pt;if(this.tokens.links){var Ft=Object.keys(this.tokens.links);if(Ft.length>0)for(;(qe=this.tokenizer.rules.inline.reflinkSearch.exec(Ke))!=null;)Ft.includes(qe[0].slice(qe[0].lastIndexOf("[")+1,-1))&&(Ke=Ke.slice(0,qe.index)+"["+Ce("a",qe[0].length-2)+"]"+Ke.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(qe=this.tokenizer.rules.inline.blockSkip.exec(Ke))!=null;)Ke=Ke.slice(0,qe.index)+"["+Ce("a",qe[0].length-2)+"]"+Ke.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(qe=this.tokenizer.rules.inline.escapedEmSt.exec(Ke))!=null;)Ke=Ke.slice(0,qe.index)+"++"+Ke.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;te;){if(ot||(Pt=""),ot=!1,_e=this.tokenizer.escape(te)){te=te.substring(_e.raw.length),re.push(_e);continue}if(_e=this.tokenizer.tag(te,ae,he)){te=te.substring(_e.raw.length),ae=_e.inLink,he=_e.inRawBlock;var Bt=re[re.length-1];Bt&&_e.type==="text"&&Bt.type==="text"?(Bt.raw+=_e.raw,Bt.text+=_e.text):re.push(_e);continue}if(_e=this.tokenizer.link(te)){te=te.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,he)),re.push(_e);continue}if(_e=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(_e.raw.length);var vt=re[re.length-1];_e.type==="link"?(_e.tokens=this.inlineTokens(_e.text,[],!0,he),re.push(_e)):vt&&_e.type==="text"&&vt.type==="text"?(vt.raw+=_e.raw,vt.text+=_e.text):re.push(_e);continue}if(_e=this.tokenizer.emStrong(te,Ke,Pt)){te=te.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ae,he),re.push(_e);continue}if(_e=this.tokenizer.codespan(te)){te=te.substring(_e.raw.length),re.push(_e);continue}if(_e=this.tokenizer.br(te)){te=te.substring(_e.raw.length),re.push(_e);continue}if(_e=this.tokenizer.del(te)){te=te.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ae,he),re.push(_e);continue}if(_e=this.tokenizer.autolink(te,de)){te=te.substring(_e.raw.length),re.push(_e);continue}if(!ae&&(_e=this.tokenizer.url(te,de))){te=te.substring(_e.raw.length),re.push(_e);continue}if(_e=this.tokenizer.inlineText(te,he,De)){te=te.substring(_e.raw.length),_e.raw.slice(-1)!=="_"&&(Pt=_e.raw.slice(-1)),ot=!0,tt=re[re.length-1],tt&&tt.type==="text"?(tt.raw+=_e.raw,tt.text+=_e.text):re.push(_e);continue}if(te){var si="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(si);break}else throw new Error(si)}}return re},b(xe,null,[{key:"rules",get:function(){return{block:$t,inline:Ct}}}]),xe}(),We=T.exports.defaults,je=M.cleanUrl,J=M.escape,oe=function(){function xe(be){this.options=be||We}var ge=xe.prototype;return ge.code=function(te,re,ae){var he=(re||"").match(/\S*/)[0];if(this.options.highlight){var _e=this.options.highlight(te,he);_e!=null&&_e!==te&&(ae=!0,te=_e)}return te=te.replace(/\n$/,"")+`
|
|
|
`,he?'<pre><code class="'+this.options.langPrefix+J(he,!0)+'">'+(ae?te:J(te,!0))+`</code></pre>
|
|
|
`:"<pre><code>"+(ae?te:J(te,!0))+`</code></pre>
|
|
|
`},ge.blockquote=function(te){return`<blockquote>
|
|
|
`+te+`</blockquote>
|
|
|
`},ge.html=function(te){return te},ge.heading=function(te,re,ae,he){return this.options.headerIds?"<h"+re+' id="'+this.options.headerPrefix+he.slug(ae)+'">'+te+"</h"+re+`>
|
|
|
`:"<h"+re+">"+te+"</h"+re+`>
|
|
|
`},ge.hr=function(){return this.options.xhtml?`<hr/>
|
|
|
`:`<hr>
|
|
|
`},ge.list=function(te,re,ae){var he=re?"ol":"ul",_e=re&&ae!==1?' start="'+ae+'"':"";return"<"+he+_e+`>
|
|
|
`+te+"</"+he+`>
|
|
|
`},ge.listitem=function(te){return"<li>"+te+`</li>
|
|
|
`},ge.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ge.paragraph=function(te){return"<p>"+te+`</p>
|
|
|
`},ge.table=function(te,re){return re&&(re="<tbody>"+re+"</tbody>"),`<table>
|
|
|
<thead>
|
|
|
`+te+`</thead>
|
|
|
`+re+`</table>
|
|
|
`},ge.tablerow=function(te){return`<tr>
|
|
|
`+te+`</tr>
|
|
|
`},ge.tablecell=function(te,re){var ae=re.header?"th":"td",he=re.align?"<"+ae+' align="'+re.align+'">':"<"+ae+">";return he+te+"</"+ae+`>
|
|
|
`},ge.strong=function(te){return"<strong>"+te+"</strong>"},ge.em=function(te){return"<em>"+te+"</em>"},ge.codespan=function(te){return"<code>"+te+"</code>"},ge.br=function(){return this.options.xhtml?"<br/>":"<br>"},ge.del=function(te){return"<del>"+te+"</del>"},ge.link=function(te,re,ae){if(te=je(this.options.sanitize,this.options.baseUrl,te),te===null)return ae;var he='<a href="'+J(te)+'"';return re&&(he+=' title="'+re+'"'),he+=">"+ae+"</a>",he},ge.image=function(te,re,ae){if(te=je(this.options.sanitize,this.options.baseUrl,te),te===null)return ae;var he='<img src="'+te+'" alt="'+ae+'"';return re&&(he+=' title="'+re+'"'),he+=this.options.xhtml?"/>":">",he},ge.text=function(te){return te},xe}(),pe=function(){function xe(){}var ge=xe.prototype;return ge.strong=function(te){return te},ge.em=function(te){return te},ge.codespan=function(te){return te},ge.del=function(te){return te},ge.html=function(te){return te},ge.text=function(te){return te},ge.link=function(te,re,ae){return""+ae},ge.image=function(te,re,ae){return""+ae},ge.br=function(){return""},xe}(),ue=function(){function xe(){this.seen={}}var ge=xe.prototype;return ge.serialize=function(te){return te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},ge.getNextSafeSlug=function(te,re){var ae=te,he=0;if(this.seen.hasOwnProperty(ae)){he=this.seen[te];do he++,ae=te+"-"+he;while(this.seen.hasOwnProperty(ae))}return re||(this.seen[te]=he,this.seen[ae]=0),ae},ge.slug=function(te,re){re===void 0&&(re={});var ae=this.serialize(te);return this.getNextSafeSlug(ae,re.dryrun)},xe}(),ye=oe,Se=pe,Ne=ue,Ie=T.exports.defaults,Ue=M.unescape,ke=function(){function xe(be){this.options=be||Ie,this.options.renderer=this.options.renderer||new ye,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Se,this.slugger=new Ne}xe.parse=function(te,re){var ae=new xe(re);return ae.parse(te)},xe.parseInline=function(te,re){var ae=new xe(re);return ae.parseInline(te)};var ge=xe.prototype;return ge.parse=function(te,re){re===void 0&&(re=!0);var ae="",he,_e,tt,Ke,qe,ot,Pt,Ft,Bt,vt,si,_i,zt,fi,Nt,mt,Ut,ei,ai=te.length;for(he=0;he<ai;he++)switch(vt=te[he],vt.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(vt.tokens),vt.depth,Ue(this.parseInline(vt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(vt.text,vt.lang,vt.escaped);continue}case"table":{for(Ft="",Pt="",Ke=vt.header.length,_e=0;_e<Ke;_e++)Pt+=this.renderer.tablecell(this.parseInline(vt.tokens.header[_e]),{header:!0,align:vt.align[_e]});for(Ft+=this.renderer.tablerow(Pt),Bt="",Ke=vt.cells.length,_e=0;_e<Ke;_e++){for(ot=vt.tokens.cells[_e],Pt="",qe=ot.length,tt=0;tt<qe;tt++)Pt+=this.renderer.tablecell(this.parseInline(ot[tt]),{header:!1,align:vt.align[tt]});Bt+=this.renderer.tablerow(Pt)}ae+=this.renderer.table(Ft,Bt);continue}case"blockquote":{Bt=this.parse(vt.tokens),ae+=this.renderer.blockquote(Bt);continue}case"list":{for(si=vt.ordered,_i=vt.start,zt=vt.loose,Ke=vt.items.length,Bt="",_e=0;_e<Ke;_e++)Nt=vt.items[_e],mt=Nt.checked,Ut=Nt.task,fi="",Nt.task&&(ei=this.renderer.checkbox(mt),zt?Nt.tokens.length>0&&Nt.tokens[0].type==="text"?(Nt.tokens[0].text=ei+" "+Nt.tokens[0].text,Nt.tokens[0].tokens&&Nt.tokens[0].tokens.length>0&&Nt.tokens[0].tokens[0].type==="text"&&(Nt.tokens[0].tokens[0].text=ei+" "+Nt.tokens[0].tokens[0].text)):Nt.tokens.unshift({type:"text",text:ei}):fi+=ei),fi+=this.parse(Nt.tokens,zt),Bt+=this.renderer.listitem(fi,Ut,mt);ae+=this.renderer.list(Bt,si,_i);continue}case"html":{ae+=this.renderer.html(vt.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(vt.tokens));continue}case"text":{for(Bt=vt.tokens?this.parseInline(vt.tokens):vt.text;he+1<ai&&te[he+1].type==="text";)vt=te[++he],Bt+=`
|
|
|
`+(vt.tokens?this.parseInline(vt.tokens):vt.text);ae+=re?this.renderer.paragraph(Bt):Bt;continue}default:{var Ti='Token with "'+vt.type+'" type was not found.';if(this.options.silent){console.error(Ti);return}else throw new Error(Ti)}}return ae},ge.parseInline=function(te,re){re=re||this.renderer;var ae="",he,_e,tt=te.length;for(he=0;he<tt;he++)switch(_e=te[he],_e.type){case"escape":{ae+=re.text(_e.text);break}case"html":{ae+=re.html(_e.text);break}case"link":{ae+=re.link(_e.href,_e.title,this.parseInline(_e.tokens,re));break}case"image":{ae+=re.image(_e.href,_e.title,_e.text);break}case"strong":{ae+=re.strong(this.parseInline(_e.tokens,re));break}case"em":{ae+=re.em(this.parseInline(_e.tokens,re));break}case"codespan":{ae+=re.codespan(_e.text);break}case"br":{ae+=re.br();break}case"del":{ae+=re.del(this.parseInline(_e.tokens,re));break}case"text":{ae+=re.text(_e.text);break}default:{var Ke='Token with "'+_e.type+'" type was not found.';if(this.options.silent){console.error(Ke);return}else throw new Error(Ke)}}return ae},xe}(),it=Pe,Xe=ke,Ye=Me,Qe=oe,at=pe,ct=ue,Ze=M.merge,yt=M.checkSanitizeDeprecation,Lt=M.escape,Rt=T.exports.getDefaults,It=T.exports.changeDefaults,Kt=T.exports.defaults;function rt(xe,ge,be){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"&&(be=ge,ge=null),ge=Ze({},rt.defaults,ge||{}),yt(ge),be){var te=ge.highlight,re;try{re=it.lex(xe,ge)}catch(tt){return be(tt)}var ae=function(Ke){var qe;if(!Ke)try{ge.walkTokens&&rt.walkTokens(re,ge.walkTokens),qe=Xe.parse(re,ge)}catch(ot){Ke=ot}return ge.highlight=te,Ke?be(Ke):be(null,qe)};if(!te||te.length<3||(delete ge.highlight,!re.length))return ae();var he=0;rt.walkTokens(re,function(tt){tt.type==="code"&&(he++,setTimeout(function(){te(tt.text,tt.lang,function(Ke,qe){if(Ke)return ae(Ke);qe!=null&&qe!==tt.text&&(tt.text=qe,tt.escaped=!0),he--,he===0&&ae()})},0))}),he===0&&ae();return}try{var _e=it.lex(xe,ge);return ge.walkTokens&&rt.walkTokens(_e,ge.walkTokens),Xe.parse(_e,ge)}catch(tt){if(tt.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+Lt(tt.message+"",!0)+"</pre>";throw tt}}rt.options=rt.setOptions=function(xe){return Ze(rt.defaults,xe),It(rt.defaults),rt},rt.getDefaults=Rt,rt.defaults=Kt,rt.use=function(xe){var ge=Ze({},xe);if(xe.renderer&&function(){var te=rt.defaults.renderer||new Qe,re=function(_e){var tt=te[_e];te[_e]=function(){for(var Ke=arguments.length,qe=new Array(Ke),ot=0;ot<Ke;ot++)qe[ot]=arguments[ot];var Pt=xe.renderer[_e].apply(te,qe);return Pt===!1&&(Pt=tt.apply(te,qe)),Pt}};for(var ae in xe.renderer)re(ae);ge.renderer=te}(),xe.tokenizer&&function(){var te=rt.defaults.tokenizer||new Ye,re=function(_e){var tt=te[_e];te[_e]=function(){for(var Ke=arguments.length,qe=new Array(Ke),ot=0;ot<Ke;ot++)qe[ot]=arguments[ot];var Pt=xe.tokenizer[_e].apply(te,qe);return Pt===!1&&(Pt=tt.apply(te,qe)),Pt}};for(var ae in xe.tokenizer)re(ae);ge.tokenizer=te}(),xe.walkTokens){var be=rt.defaults.walkTokens;ge.walkTokens=function(te){xe.walkTokens(te),be&&be(te)}}rt.setOptions(ge)},rt.walkTokens=function(xe,ge){for(var be=G(xe),te;!(te=be()).done;){var re=te.value;switch(ge(re),re.type){case"table":{for(var ae=G(re.tokens.header),he;!(he=ae()).done;){var _e=he.value;rt.walkTokens(_e,ge)}for(var tt=G(re.tokens.cells),Ke;!(Ke=tt()).done;)for(var qe=Ke.value,ot=G(qe),Pt;!(Pt=ot()).done;){var Ft=Pt.value;rt.walkTokens(Ft,ge)}break}case"list":{rt.walkTokens(re.items,ge);break}default:re.tokens&&rt.walkTokens(re.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=Ze({},rt.defaults,ge||{}),yt(ge);try{var be=it.lexInline(xe,ge);return ge.walkTokens&&rt.walkTokens(be,ge.walkTokens),Xe.parseInline(be,ge)}catch(te){if(te.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+Lt(te.message+"",!0)+"</pre>";throw te}},rt.Parser=Xe,rt.parser=Xe.parse,rt.Renderer=Qe,rt.TextRenderer=at,rt.Lexer=it,rt.lexer=it.lex,rt.Tokenizer=Ye,rt.Slugger=ct,rt.parse=rt;var dt=rt;return dt})},11690:function(ft){const me=/[&<>"']/,b=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,I=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},T=F=>G[F];function x(F,q){if(q){if(me.test(F))return F.replace(b,T)}else if(k.test(F))return F.replace(I,T);return F}const g=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function O(F){return F.replace(g,(q,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,q){F=F.source||F,q=q||"";const V={replace:(ne,ce)=>(ce=ce.source||ce,ce=ce.replace(m,"$1"),F=F.replace(ne,ce),V),getRegex:()=>new RegExp(F,q)};return V}const v=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function c(F,q,V){if(F){let ne;try{ne=decodeURIComponent(O(V)).replace(v,"").toLowerCase()}catch(ce){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}q&&!f.test(V)&&(V=D(q,V));try{V=encodeURI(V).replace(/%25/g,"%")}catch(ne){return null}return V}const l={},u=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,E=/^([^:]+:\/*[^/]*)[\s\S]*$/;function D(F,q){l[" "+F]||(u.test(F)?l[" "+F]=F+"/":l[" "+F]=P(F,"/",!0)),F=l[" "+F];const V=F.indexOf(":")===-1;return q.substring(0,2)==="//"?V?q:F.replace(p,"$1")+q:q.charAt(0)==="/"?V?q:F.replace(E,"$1")+q:F+q}const L={exec:function(){}};function w(F){let q=1,V,ne;for(;q<arguments.length;q++){V=arguments[q];for(ne in V)Object.prototype.hasOwnProperty.call(V,ne)&&(F[ne]=V[ne])}return F}function A(F,q){const V=F.replace(/\|/g,(ee,z,Z)=>{let M=!1,K=z;for(;--K>=0&&Z[K]==="\\";)M=!M;return M?"|":" |"}),ne=V.split(/ \|/);let ce=0;if(ne.length>q)ne.splice(q);else for(;ne.length<q;)ne.push("");for(;ce<ne.length;ce++)ne[ce]=ne[ce].trim().replace(/\\\|/g,"|");return ne}function P(F,q,V){const ne=F.length;if(ne===0)return"";let ce=0;for(;ce<ne;){const ee=F.charAt(ne-ce-1);if(ee===q&&!V)ce++;else if(ee!==q&&V)ce++;else break}return F.substr(0,ne-ce)}function U(F,q){if(F.indexOf(q[1])===-1)return-1;const V=F.length;let ne=0,ce=0;for(;ce<V;ce++)if(F[ce]==="\\")ce++;else if(F[ce]===q[0])ne++;else if(F[ce]===q[1]&&(ne--,ne<0))return ce;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,q){if(q<1)return"";let V="";for(;q>1;)q&1&&(V+=F),q>>=1,F+=F;return V+F}ft.exports={escape:x,unescape:O,edit:n,cleanUrl:c,resolveUrl:D,noopTest:L,merge:w,splitCells:A,rtrim:P,findClosingBracket:U,checkSanitizeDeprecation:N,repeatString:H}},75918:function(ft,me,b){"use strict";b.d(me,{Wi:function(){return g},Z0:function(){return O},aU:function(){return x},eZ:function(){return n},wY:function(){return m}});var k=b(4348),I=b(69323),G=b(13268),T=function(v,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 D(A){try{w(l.next(A))}catch(P){E(P)}}function L(A){try{w(l.throw(A))}catch(P){E(P)}}function w(A){A.done?p(A.value):u(A.value).then(D,L)}w((l=l.apply(v,f||[])).next())})};class x 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 T(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(f))})}}class g 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 T(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 T(this,void 0,void 0,function*(){yield f.run(c)})}}class O extends x{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 T(this,void 0,void 0,function*(){})}}class n extends x{constructor(){super(n.ID,G.N("submenu.empty","(empty)"),void 0,!1)}}n.ID="vs.actions.empty"},76068:function(ft,me,b){"use strict";b.d(me,{ok:function(){return k}});function k(I,G){if(!I)throw new Error(G?`Assertion failed (${G})`:"Assertion Failed")}},52615:function(ft,me,b){"use strict";b.d(me,{CM:function(){return x},JL:function(){return g},dT:function(){return m},fK:function(){return T},lA:function(){return O}});var k=b(4348);class I{constructor(){this._icons=new Map,this._onDidRegister=new k.Q5}add(v){const f=this._icons.get(v.id);f?v.description?f.description=v.description:console.error(`Duplicate registration of codicon ${v.id}`):(this._icons.set(v.id,v),this._onDidRegister.fire(v))}get(v){return this._icons.get(v)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const G=new I,T=G;function x(n,v){return new O(n,v)}function g(n){return n?n.replace(/\$\((.*?)\)/g,(v,f)=>` ${f} `).trim():""}class O{constructor(v,f,c){this.id=v,this.definition=f,this.description=c,G.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 v=new RegExp(`^(${n.iconNameExpression})(${n.iconModifierExpression})?$`);function f(u){if(u instanceof O)return["codicon","codicon-"+u.id];const p=v.exec(u.id);if(!p)return f(O.error);let[,E,D]=p;const L=["codicon","codicon-"+E];return D&&L.push("codicon-modifier-"+D.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(ft,me,b){"use strict";b.d(me,{B8:function(){return f},Cp:function(){return T},F0:function(){return m},L6:function(){return v},VV:function(){return O},b1:function(){return n},dL:function(){return G},ri:function(){return x}});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 G(c){O(c)||I.onUnexpectedError(c)}function T(c){O(c)||I.onUnexpectedExternalError(c)}function x(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 g="Canceled";function O(c){return c instanceof Error&&c.name===g&&c.message===g}function m(){const c=new Error(g);return c.name=c.message,c}function n(c){return c?new Error(`Illegal argument: ${c}`):new Error("Illegal argument")}function v(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(ft,me,b){"use strict";b.d(me,{D0:function(){return f},E7:function(){return c},K3:function(){return v},Q5:function(){return n},ZD:function(){return l},ju:function(){return x}});var k=b(79881),I=b(69323),G=b(34502),T=b(95830),x;(function(u){u.None=()=>I.JT.None;function p(Z){return(M,K=null,j)=>{let R=!1,C;return C=Z(Y=>{if(!R)return C?C.dispose():R=!0,M.call(K,Y)},null,j),R&&C.dispose(),C}}u.once=p;function E(Z,M){return U((K,j=null,R)=>Z(C=>K.call(j,M(C)),null,R))}u.map=E;function D(Z,M){return U((K,j=null,R)=>Z(C=>{M(C),K.call(j,C)},null,R))}u.forEach=D;function L(Z,M){return U((K,j=null,R)=>Z(C=>M(C)&&K.call(j,C),null,R))}u.filter=L;function w(Z){return Z}u.signal=w;function A(...Z){return(M,K=null,j)=>(0,I.F8)(...Z.map(R=>R(C=>M.call(K,C),null,j)))}u.any=A;function P(Z,M,K){let j=K;return E(Z,R=>(j=M(j,R),j))}u.reduce=P;function U(Z){let M;const K=new n({onFirstListenerAdd(){M=Z(K.fire,K)},onLastListenerRemove(){M.dispose()}});return K.event}function N(Z,M,K=100,j=!1,R){let C,Y,ie,ve=0;const Me=new n({leakWarningThreshold:R,onFirstListenerAdd(){C=Z(ze=>{ve++,Y=M(Y,ze),j&&!ie&&(Me.fire(Y),Y=void 0),clearTimeout(ie),ie=setTimeout(()=>{const Ee=Y;Y=void 0,ie=void 0,(!j||ve>1)&&Me.fire(Ee),ve=0},K)})},onLastListenerRemove(){C.dispose()}});return Me.event}u.debounce=N;function H(Z,M=(K,j)=>K===j){let K=!0,j;return L(Z,R=>{const C=K||!M(R,j);return K=!1,j=R,C})}u.latch=H;function F(Z,M){return[u.filter(Z,M),u.filter(Z,K=>!M(K))]}u.split=F;function q(Z,M=!1,K=[]){let j=K.slice(),R=Z(ie=>{j?j.push(ie):Y.fire(ie)});const C=()=>{j&&j.forEach(ie=>Y.fire(ie)),j=null},Y=new n({onFirstListenerAdd(){R||(R=Z(ie=>Y.fire(ie)))},onFirstListenerDidAdd(){j&&(M?setTimeout(C):C())},onLastListenerRemove(){R&&R.dispose(),R=null}});return Y.event}u.buffer=q;class V{constructor(M){this.event=M}map(M){return new V(E(this.event,M))}forEach(M){return new V(D(this.event,M))}filter(M){return new V(L(this.event,M))}reduce(M,K){return new V(P(this.event,M,K))}latch(){return new V(H(this.event))}debounce(M,K=100,j=!1,R){return new V(N(this.event,M,K,j,R))}on(M,K,j){return this.event(M,K,j)}once(M,K,j){return p(this.event)(M,K,j)}}function ne(Z){return new V(Z)}u.chain=ne;function ce(Z,M,K=j=>j){const j=(...ie)=>Y.fire(K(...ie)),R=()=>Z.on(M,j),C=()=>Z.removeListener(M,j),Y=new n({onFirstListenerAdd:R,onLastListenerRemove:C});return Y.event}u.fromNodeEventEmitter=ce;function ee(Z,M,K=j=>j){const j=(...ie)=>Y.fire(K(...ie)),R=()=>Z.addEventListener(M,j),C=()=>Z.removeEventListener(M,j),Y=new n({onFirstListenerAdd:R,onLastListenerRemove:C});return Y.event}u.fromDOMEventEmitter=ee;function z(Z){return new Promise(M=>p(Z)(M))}u.toPromise=z})(x||(x={}));class g{constructor(p){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${p}_${g._idPool++}`}start(p){this._stopWatch=new T.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}}}g._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 D=new Error().stack.split(`
|
|
|
`).slice(3).join(`
|
|
|
`),L=this._stacks.get(D)||0;if(this._stacks.set(D,L+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=E*.5;let w,A=0;for(const[P,U]of this._stacks)(!w||A<U)&&(w=P,A=U);console.warn(`[${this.name}] potential listener LEAK detected, having ${p} listeners already. MOST frequent listener (${A}):`),console.warn(w)}return()=>{const w=this._stacks.get(D)||0;this._stacks.set(D,w-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 g(this._options._profName):void 0}get event(){return this._event||(this._event=(p,E,D)=>{var L;this._listeners||(this._listeners=new G.S);const w=this._listeners.isEmpty();w&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const A=this._listeners.push(E?[p,E]:p);w&&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 D instanceof I.SL?D.add(U):Array.isArray(D)&&D.push(U),U}),this._event}fire(p){var E,D;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new G.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,w]=this._deliveryQueue.shift();try{typeof L=="function"?L.call(void 0,w):L[0].call(L[1],w)}catch(A){(0,k.dL)(A)}}(D=this._perfMon)===null||D===void 0||D.stop()}}dispose(){var p,E,D,L,w;this._disposed||(this._disposed=!0,(p=this._listeners)===null||p===void 0||p.clear(),(E=this._deliveryQueue)===null||E===void 0||E.clear(),(L=(D=this._options)===null||D===void 0?void 0:D.onLastListenerRemove)===null||L===void 0||L.call(D),(w=this._leakageMon)===null||w===void 0||w.dispose())}}class v extends n{constructor(p){super(p),this._isPaused=0,this._eventQueue=new G.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 v{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,D,L)=>p(w=>{const A=this.buffers[this.buffers.length-1];A?A.push(()=>E.call(D,w)):E.call(D,w)},void 0,L)}bufferEvents(p){const E=[];this.buffers.push(E);const D=p();return this.buffers.pop(),E.forEach(L=>L()),D}}class l{constructor(){this.listening=!1,this.inputEvent=x.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(ft,me,b){"use strict";b.d(me,{I:function(){return k}});function k(I){const G=this;let T=!1,x;return function(){return T||(T=!0,x=I.apply(G,arguments)),x}}},88226:function(ft,me,b){"use strict";b.d(me,{$:function(){return k}});var k;(function(I){function G(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}I.is=G;const T=Object.freeze([]);function x(){return T}I.empty=x;function*g(A){yield A}I.single=g;function O(A){return A||T}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 v(A,P){for(const U of A)if(P(U))return!0;return!1}I.some=v;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*D(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=D;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 w(A,P,U=(N,H)=>N===H){const N=A[Symbol.iterator](),H=P[Symbol.iterator]();for(;;){const F=N.next(),q=H.next();if(F.done!==q.done)return!1;if(F.done)return!0;if(!U(F.value,q.value))return!1}}I.equals=w})(k||(k={}))},69323:function(ft,me,b){"use strict";b.d(me,{B9:function(){return l},F8:function(){return u},JT:function(){return D},Jz:function(){return w},OF:function(){return p},SL:function(){return E},Wf:function(){return c},XK:function(){return L},dk:function(){return v}});var k=b(17845),I=b(88226);const G=!1;let T=null;function x(A){T=A}if(G){const A="__is_disposable_tracked__";x(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!==D.None)try{P[A]=!0}catch(N){}}markAsDisposed(P){if(P&&P!==D.None)try{P[A]=!0}catch(U){}}markAsSingleton(P){}})}function g(A){return T==null||T.trackDisposable(A),A}function O(A){T==null||T.markAsDisposed(A)}function m(A,P){T==null||T.setParent(A,P)}function n(A,P){if(T)for(const U of A)T.setParent(U,P)}function v(A){return T==null||T.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=g({dispose:(0,k.I)(()=>{O(P),A()})});return P}class E{constructor(){this._toDispose=new Set,this._isDisposed=!1,g(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 D{constructor(){this._store=new E,g(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)}}D.None=Object.freeze({dispose(){}});class L{constructor(){this._isDisposed=!1,g(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 w{constructor(P){this.object=P}dispose(){}}},34502:function(ft,me,b){"use strict";b.d(me,{S:function(){return I}});class k{constructor(T){this.element=T,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 T=this._first;for(;T!==k.Undefined;){const x=T.next;T.prev=k.Undefined,T.next=k.Undefined,T=x}this._first=k.Undefined,this._last=k.Undefined,this._size=0}unshift(T){return this._insert(T,!1)}push(T){return this._insert(T,!0)}_insert(T,x){const g=new k(T);if(this._first===k.Undefined)this._first=g,this._last=g;else if(x){const m=this._last;this._last=g,g.prev=m,m.next=g}else{const m=this._first;this._first=g,g.next=m,m.prev=g}this._size+=1;let O=!1;return()=>{O||(O=!0,this._remove(g))}}shift(){if(this._first!==k.Undefined){const T=this._first.element;return this._remove(this._first),T}}pop(){if(this._last!==k.Undefined){const T=this._last.element;return this._remove(this._last),T}}_remove(T){if(T.prev!==k.Undefined&&T.next!==k.Undefined){const x=T.prev;x.next=T.next,T.next.prev=x}else T.prev===k.Undefined&&T.next===k.Undefined?(this._first=k.Undefined,this._last=k.Undefined):T.next===k.Undefined?(this._last=this._last.prev,this._last.next=k.Undefined):T.prev===k.Undefined&&(this._first=this._first.next,this._first.prev=k.Undefined);this._size-=1}*[Symbol.iterator](){let T=this._first;for(;T!==k.Undefined;)yield T.element,T=T.next}}},23345:function(ft,me,b){"use strict";b.d(me,{$L:function(){return N},ED:function(){return w},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 ee},tY:function(){return U},xS:function(){return q}});var k=b(97671),I;const G="en";let T=!1,x=!1,g=!1,O=!1,m=!1,n=!1,v=!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 D=typeof((I=E==null?void 0:E.versions)===null||I===void 0?void 0:I.electron)=="string"&&E.type==="renderer";if(typeof navigator=="object"&&!D)u=navigator.userAgent,T=u.indexOf("Windows")>=0,x=u.indexOf("Macintosh")>=0,v=(u.indexOf("Macintosh")>=0||u.indexOf("iPad")>=0||u.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,g=u.indexOf("Linux")>=0,n=!0,f=navigator.language,c=f;else if(typeof E=="object"){T=E.platform==="win32",x=E.platform==="darwin",g=E.platform==="linux",O=g&&!!E.env.SNAP&&!!E.env.SNAP_REVISION,f=G,c=G;const z=E.env.VSCODE_NLS_CONFIG;if(z)try{const Z=JSON.parse(z),M=Z.availableLanguages["*"];f=Z.locale,c=M||G,l=Z._translationsConfigFile}catch(Z){}m=!0}else console.error("Unable to resolve platform.");let L=0;x?L=1:T?L=3:g&&(L=2);const w=T,A=x,P=g,U=m,N=n,H=v,F=u,q=function(){if(p.setImmediate)return p.setImmediate.bind(p);if(typeof p.postMessage=="function"&&!p.importScripts){let M=[];p.addEventListener("message",j=>{if(j.data&&j.data.vscodeSetImmediateId)for(let R=0,C=M.length;R<C;R++){const Y=M[R];if(Y.id===j.data.vscodeSetImmediateId){M.splice(R,1),Y.callback();return}}});let K=0;return j=>{const R=++K;M.push({id:R,callback:j}),p.postMessage({vscodeSetImmediateId:R},"*")}}if(typeof(E==null?void 0:E.nextTick)=="function")return E.nextTick.bind(E);const Z=Promise.resolve();return M=>Z.then(M)}(),V=x||v?2:T?1:3;let ne=!0,ce=!1;function ee(){if(!ce){ce=!0;const z=new Uint8Array(2);z[0]=1,z[1]=2,ne=new Uint16Array(z.buffer)[0]===513}return ne}},95830:function(ft,me,b){"use strict";b.d(me,{G:function(){return G}});var k=b(23345);const I=k.li.performance&&typeof k.li.performance.now=="function";class G{constructor(x){this._highResolution=I&&x,this._startTime=this._now(),this._stopTime=-1}static create(x=!0){return new G(x)}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(ft,me,b){"use strict";b.d(me,{$i:function(){return ve},C8:function(){return Oe},GF:function(){return f},HO:function(){return K},IO:function(){return c},K7:function(){return Ve},Kw:function(){return xt},LC:function(){return p},Mh:function(){return q},P1:function(){return V},PJ:function(){return st},Qe:function(){return Me},R1:function(){return v},RP:function(){return Y},S6:function(){return $t},TT:function(){return w},Ut:function(){return R},V8:function(){return E},WU:function(){return G},YK:function(){return ce},YU:function(){return T},ZG:function(){return ne},ZH:function(){return z},ab:function(){return ze},c1:function(){return Be},df:function(){return N},ec:function(){return x},fi:function(){return Ct},fy:function(){return g},j3:function(){return O},j_:function(){return P},m5:function(){return k},mK:function(){return U},mr:function(){return l},oH:function(){return de},oL:function(){return m},ok:function(){return F},ow:function(){return D},qq:function(){return H},qu:function(){return L},rL:function(){return ee},uS:function(){return ut},un:function(){return n},uq:function(){return u},vH:function(){return M},xe:function(){return Ee},zY:function(){return A}});function k(J){return!J||typeof J!="string"?!0:J.trim().length===0}const I=/{(\d+)}/g;function G(J,...oe){return oe.length===0?J:J.replace(I,function(pe,ue){const ye=parseInt(ue,10);return isNaN(ye)||ye<0||ye>=oe.length?pe:oe[ye]})}function T(J){return J.replace(/[<>&]/g,function(oe){switch(oe){case"<":return"<";case">":return">";case"&":return"&";default:return oe}})}function x(J){return J.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function g(J,oe=" "){const pe=O(J,oe);return m(pe,oe)}function O(J,oe){if(!J||!oe)return J;const pe=oe.length;if(pe===0||J.length===0)return J;let ue=0;for(;J.indexOf(oe,ue)===ue;)ue=ue+pe;return J.substring(ue)}function m(J,oe){if(!J||!oe)return J;const pe=oe.length,ue=J.length;if(pe===0||ue===0)return J;let ye=ue,Se=-1;for(;Se=J.lastIndexOf(oe,ye-1),!(Se===-1||Se+pe!==ye);){if(Se===0)return"";ye=Se}return J.substring(0,ye)}function n(J){return J.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function v(J){return J.replace(/\*/g,"")}function f(J,oe,pe={}){if(!J)throw new Error("Cannot create regex from empty string");oe||(J=x(J)),pe.wholeWord&&(/\B/.test(J.charAt(0))||(J="\\b"+J),/\B/.test(J.charAt(J.length-1))||(J=J+"\\b"));let ue="";return pe.global&&(ue+="g"),pe.matchCase||(ue+="i"),pe.multiline&&(ue+="m"),pe.unicode&&(ue+="u"),new RegExp(J,ue)}function c(J){return J.source==="^"||J.source==="^$"||J.source==="$"||J.source==="^\\s*$"?!1:!!(J.exec("")&&J.lastIndex===0)}function l(J){return(J.global?"g":"")+(J.ignoreCase?"i":"")+(J.multiline?"m":"")+(J.unicode?"u":"")}function u(J){return J.split(/\r\n|\r|\n/)}function p(J){for(let oe=0,pe=J.length;oe<pe;oe++){const ue=J.charCodeAt(oe);if(ue!==32&&ue!==9)return oe}return-1}function E(J,oe=0,pe=J.length){for(let ue=oe;ue<pe;ue++){const ye=J.charCodeAt(ue);if(ye!==32&&ye!==9)return J.substring(oe,ue)}return J.substring(oe,pe)}function D(J,oe=J.length-1){for(let pe=oe;pe>=0;pe--){const ue=J.charCodeAt(pe);if(ue!==32&&ue!==9)return pe}return-1}function L(J,oe){return J<oe?-1:J>oe?1:0}function w(J,oe,pe=0,ue=J.length,ye=0,Se=oe.length){for(;pe<ue&&ye<Se;pe++,ye++){let Ue=J.charCodeAt(pe),ke=oe.charCodeAt(ye);if(Ue<ke)return-1;if(Ue>ke)return 1}const Ne=ue-pe,Ie=Se-ye;return Ne<Ie?-1:Ne>Ie?1:0}function A(J,oe){return P(J,oe,0,J.length,0,oe.length)}function P(J,oe,pe=0,ue=J.length,ye=0,Se=oe.length){for(;pe<ue&&ye<Se;pe++,ye++){let Ue=J.charCodeAt(pe),ke=oe.charCodeAt(ye);if(Ue===ke)continue;if(Ue>=128||ke>=128)return w(J.toLowerCase(),oe.toLowerCase(),pe,ue,ye,Se);U(Ue)&&(Ue-=32),U(ke)&&(ke-=32);const it=Ue-ke;if(it!==0)return it}const Ne=ue-pe,Ie=Se-ye;return Ne<Ie?-1:Ne>Ie?1:0}function U(J){return J>=97&&J<=122}function N(J){return J>=65&&J<=90}function H(J,oe){return J.length===oe.length&&P(J,oe)===0}function F(J,oe){const pe=oe.length;return oe.length>J.length?!1:P(J,oe,0,pe)===0}function q(J,oe){let pe,ue=Math.min(J.length,oe.length);for(pe=0;pe<ue;pe++)if(J.charCodeAt(pe)!==oe.charCodeAt(pe))return pe;return ue}function V(J,oe){let pe,ue=Math.min(J.length,oe.length);const ye=J.length-1,Se=oe.length-1;for(pe=0;pe<ue;pe++)if(J.charCodeAt(ye-pe)!==oe.charCodeAt(Se-pe))return pe;return ue}function ne(J){return 55296<=J&&J<=56319}function ce(J){return 56320<=J&&J<=57343}function ee(J,oe){return(J-55296<<10)+(oe-56320)+65536}function z(J,oe,pe){const ue=J.charCodeAt(pe);if(ne(ue)&&pe+1<oe){const ye=J.charCodeAt(pe+1);if(ce(ye))return ee(ue,ye)}return ue}function Z(J,oe){const pe=J.charCodeAt(oe-1);if(ce(pe)&&oe>1){const ue=J.charCodeAt(oe-2);if(ne(ue))return ee(ue,pe)}return pe}function M(J,oe){const pe=Ce.getInstance(),ue=oe,ye=J.length,Se=z(J,ye,oe);oe+=Se>=65536?2:1;let Ne=pe.getGraphemeBreakType(Se);for(;oe<ye;){const Ie=z(J,ye,oe),Ue=pe.getGraphemeBreakType(Ie);if(Ct(Ne,Ue))break;oe+=Ie>=65536?2:1,Ne=Ue}return oe-ue}function K(J,oe){const pe=Ce.getInstance(),ue=oe,ye=Z(J,oe);oe-=ye>=65536?2:1;let Se=pe.getGraphemeBreakType(ye);for(;oe>0;){const Ne=Z(J,oe),Ie=pe.getGraphemeBreakType(Ne);if(Ct(Ie,Se))break;oe-=Ne>=65536?2:1,Se=Ie}return ue-oe}const j=/(?:[\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(J){return j.test(J)}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 Y(J){return C.test(J)}const ie=/^[\t\n\r\x20-\x7E]*$/;function ve(J){return ie.test(J)}const Me=/[\u2028\u2029]/;function ze(J){return Me.test(J)}function Ee(J){for(let oe=0,pe=J.length;oe<pe;oe++)if(Ve(J.charCodeAt(oe)))return!0;return!1}function Ve(J){return J=+J,J>=11904&&J<=55215||J>=63744&&J<=64255||J>=65281&&J<=65374}function Oe(J){return J>=127462&&J<=127487||J===8986||J===8987||J===9200||J===9203||J>=9728&&J<=10175||J===11088||J===11093||J>=127744&&J<=128591||J>=128640&&J<=128764||J>=128992&&J<=129003||J>=129280&&J<=129535||J>=129648&&J<=129750}const Be="\uFEFF";function ut(J){return!!(J&&J.length>0&&J.charCodeAt(0)===65279)}function xt(J,oe=!1){return J?(oe&&(J=J.replace(/\\./g,"")),J.toLowerCase()!==J):!1}function st(J){return J=J%(2*26),J<26?String.fromCharCode(97+J):String.fromCharCode(65+J-26)}function $t(J){return Ce.getInstance().getGraphemeBreakType(J)}function Ct(J,oe){return J===0?oe!==5&&oe!==7:J===2&&oe===3?!1:J===4||J===2||J===3||oe===4||oe===2||oe===3?!0:!(J===8&&(oe===8||oe===9||oe===11||oe===12)||(J===11||J===9)&&(oe===9||oe===10)||(J===12||J===10)&&oe===10||oe===5||oe===13||oe===7||J===1||J===13&&oe===14||J===6&&oe===6)}class Ce{constructor(){this._data=De()}static getInstance(){return Ce._INSTANCE||(Ce._INSTANCE=new Ce),Ce._INSTANCE}getGraphemeBreakType(oe){if(oe<32)return oe===10?3:oe===13?2:4;if(oe<127)return 0;const pe=this._data,ue=pe.length/3;let ye=1;for(;ye<=ue;)if(oe<pe[3*ye])ye=2*ye;else if(oe>pe[3*ye+1])ye=2*ye+1;else return pe[3*ye+2];return 0}}Ce._INSTANCE=null;function De(){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 de(J,oe){if(J===0)return 0;const pe=Pe(J,oe);if(pe!==void 0)return pe;const ue=Z(oe,J);return J-=We(ue),J}function Pe(J,oe){let pe=Z(oe,J);for(J-=We(pe);je(pe)||pe===65039||pe===8419;){if(J===0)return;pe=Z(oe,J),J-=We(pe)}if(Oe(pe)){if(J>=0){const ue=Z(oe,J);ue===8205&&(J-=We(ue))}return J}}function We(J){return J>=65536?2:1}function je(J){return 127995<=J&&J<=127999}},72999:function(ft,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 G},cW:function(){return v},f6:function(){return D},hj:function(){return T},jn:function(){return x},kJ:function(){return k},mf:function(){return f},o8:function(){return g},p_:function(){return n},vE:function(){return L}});function k(w){return Array.isArray(w)}function I(w){return typeof w=="string"}function G(w){return typeof w=="object"&&w!==null&&!Array.isArray(w)&&!(w instanceof RegExp)&&!(w instanceof Date)}function T(w){return typeof w=="number"&&!isNaN(w)}function x(w){return w===!0||w===!1}function g(w){return typeof w=="undefined"}function O(w){return!m(w)}function m(w){return g(w)||w===null}function n(w,A){if(!w)throw new Error(A?`Unexpected type, expected '${A}'`:"Unexpected type")}function v(w){if(m(w))throw new Error("Assertion Failed: argument is undefined or null");return w}function f(w){return typeof w=="function"}function c(w,A){const P=Math.min(w.length,A.length);for(let U=0;U<P;U++)l(w[U],A[U])}function l(w,A){if(I(A)){if(typeof w!==A)throw new Error(`argument does not match constraint: typeof ${A}`)}else if(f(A)){try{if(w instanceof A)return}catch(P){}if(!m(w)&&w.constructor===A||A.length===1&&A.call(void 0,w)===!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(w){let A=[],P=Object.getPrototypeOf(w);for(;Object.prototype!==P;)A=A.concat(Object.getOwnPropertyNames(P)),P=Object.getPrototypeOf(P);return A}function p(w){const A=[];for(const P of u(w))typeof w[P]=="function"&&A.push(P);return A}function E(w,A){const P=N=>function(){const H=Array.prototype.slice.call(arguments,0);return A(N,H)};let U={};for(const N of w)U[N]=P(N);return U}function D(w){return w===null?void 0:w}function L(w,A="Unreachable"){throw new Error(A)}},13268:function(ft,me,b){"use strict";b.d(me,{N:function(){return I}});function k(G,T){let x;return T.length===0?x=G:x=G.replace(/\{(\d+)\}/g,function(g,O){const m=O[0];return typeof T[m]!="undefined"?T[m]:g}),x}function I(G,T,...x){return k(T,x)}},96236:function(ft,me,b){"use strict";b.d(me,{BH:function(){return E},NZ:function(){return D},U8:function(){return L},co:function(){return p},eH:function(){return u},vr:function(){return l}});var k=b(75918),I=b(52615),G=b(4348),T=b(88226),x=b(69323),g=b(34502),O=b(35884),m=b(90689),n=b(16925),v=b(49055),f=function(w,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(w,A,P,U);else for(var q=w.length-1;q>=0;q--)(F=w[q])&&(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(w,A){return function(P,U){A(P,U,w)}};function l(w){return w.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 G.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:w=>w===u.CommandPalette}}addCommand(w){return this.addCommands(T.$.single(w))}addCommands(w){for(const A of w)this._commands.set(A.id,A);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,x.OF)(()=>{let A=!1;for(const P of w)A=this._commands.delete(P.id)||A;A&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(w){return this._commands.get(w)}getCommands(){const w=new Map;return this._commands.forEach((A,P)=>w.set(P,A)),w}appendMenuItem(w,A){return this.appendMenuItems(T.$.single({id:w,item:A}))}appendMenuItems(w){const A=new Set,P=new g.S;for(const{id:U,item:N}of w){let H=this._menuItems.get(U);H||(H=new g.S,this._menuItems.set(U,H)),P.push(H.push(N)),A.add(U)}return this._onDidChangeMenu.fire(A),(0,x.OF)(()=>{if(P.size>0){for(let U of P)U();this._onDidChangeMenu.fire(A),P.clear()}})}getMenuItems(w){let A;return this._menuItems.has(w)?A=[...this._menuItems.get(w)]:A=[],w===u.CommandPalette&&this._appendImplicitItems(A),A}_appendImplicitItems(w){const A=new Set;for(const P of w)l(P)&&(A.add(P.command.id),P.alt&&A.add(P.alt.id));this._commands.forEach((P,U)=>{A.has(U)||w.push({command:P})})}};class D 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 No{constructor(A,P,U,N,H){var F,q;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=(q=typeof A.tooltip=="string"?A.tooltip:(F=A.tooltip)===null||F===void 0?void 0:F.value)!==null&&q!==void 0?q:"",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 No(P,void 0,U,N,H):void 0,this._options=U,v.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(ft,me,b){"use strict";b.d(me,{H:function(){return O},P:function(){return m}});var k=b(4348),I=b(88226),G=b(69323),T=b(34502),x=b(72999),g=b(16925);const O=(0,g.yh)("commandService"),m=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new k.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(n,v){if(!n)throw new Error("invalid command");if(typeof n=="string"){if(!v)throw new Error("invalid command");return this.registerCommand({id:n,handler:v})}if(n.description){const p=[];for(let D of n.description.args)p.push(D.constraint);const E=n.handler;n.handler=function(D,...L){return(0,x.D8)(L,p),E(D,...L)}}const{id:f}=n;let c=this._commands.get(f);c||(c=new T.S,this._commands.set(f,c));let l=c.unshift(n),u=(0,G.OF)(()=>{l();const p=this._commands.get(f);p!=null&&p.isEmpty()&&this._commands.delete(f)});return this._onDidRegisterCommand.fire(f),u}registerCommandAlias(n,v){return m.registerCommand(n,(f,...c)=>f.get(O).executeCommand(v,...c))}getCommand(n){const v=this._commands.get(n);if(!(!v||v.isEmpty()))return I.$.first(v)}getCommands(){const n=new Map;for(const v of this._commands.keys()){const f=this.getCommand(v);f&&n.set(v,f)}return n}};m.registerCommand("noop",()=>{})},90689:function(ft,me,b){"use strict";b.d(me,{Ao:function(){return O},Eq:function(){return ee},Fb:function(){return m},K8:function(){return M},i6:function(){return ce},uy:function(){return ne}});var k=b(23345),I=b(82983),G=b(16925);let T=k.WE||"";const x=new Map;x.set("false",!1),x.set("true",!0),x.set("isMac",k.dz),x.set("isLinux",k.IJ),x.set("isWindows",k.ED),x.set("isWeb",k.$L),x.set("isMacNative",k.dz&&!k.$L),x.set("isEdge",T.indexOf("Edg/")>=0),x.set("isFirefox",T.indexOf("Firefox")>=0),x.set("isChrome",T.indexOf("Chrome")>=0),x.set("isSafari",T.indexOf("Safari")>=0);const g=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 D.create(R)}static and(...R){return q.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 Y=R.split("||");return V.create(Y.map(ie=>this._deserializeAndExpression(ie,C)),null,!0)}static _deserializeAndExpression(R,C){let Y=R.split("&&");return q.create(Y.map(ie=>this._deserializeOne(ie,C)),null)}static _deserializeOne(R,C){if(R=R.trim(),R.indexOf("!=")>=0){let Y=R.split("!=");return E.create(Y[0].trim(),this._deserializeValue(Y[1],C))}if(R.indexOf("==")>=0){let Y=R.split("==");return l.create(Y[0].trim(),this._deserializeValue(Y[1],C))}if(R.indexOf("=~")>=0){let Y=R.split("=~");return N.create(Y[0].trim(),this._deserializeRegexValue(Y[1],C))}if(R.indexOf(" in ")>=0){let Y=R.split(" in ");return u.create(Y[0].trim(),Y[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(R)){const Y=R.split(">=");return A.create(Y[0].trim(),Y[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(R)){const Y=R.split(">");return w.create(Y[0].trim(),Y[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(R)){const Y=R.split("<=");return U.create(Y[0].trim(),Y[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(R)){const Y=R.split("<");return P.create(Y[0].trim(),Y[1].trim())}return/^\!\s*/.test(R)?D.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 Y=/^'([^']*)'$/.exec(R);return Y?Y[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 Y=R.indexOf("/"),ie=R.lastIndexOf("/");if(Y===ie||Y<0){if(C)throw new Error(`bad regexp-value '${R}', missing /-enclosure`);return console.warn(`bad regexp-value '${R}', missing /-enclosure`),null}let ve=R.slice(Y+1,ie),Me=R[ie+1]==="i"?"i":"";try{return new RegExp(ve,Me)}catch(ze){if(C)throw new Error(`bad regexp-value '${R}', parse error: ${ze}`);return console.warn(`bad regexp-value '${R}', parse error: ${ze}`),null}}}function m(j,R){const C=j?j.substituteConstants():void 0,Y=R?R.substituteConstants():void 0;return!C&&!Y?!0:!C||!Y?!1:C.equals(Y)}function n(j,R){return j.cmp(R)}class v{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}}v.INSTANCE=new v;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 v.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 Y=x.get(R);return typeof Y=="boolean"?Y?f.INSTANCE:v.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=x.get(this.key);return typeof R=="boolean"?R?f.INSTANCE:v.INSTANCE:this}evaluate(R){return!!R.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=D.create(this.key,this)),this.negated}}class l{constructor(R,C,Y){this.key=R,this.value=C,this.negated=Y,this.type=4}static create(R,C,Y=null){if(typeof C=="boolean")return C?c.create(R,Y):D.create(R,Y);const ie=x.get(R);return typeof ie=="boolean"?C===(ie?"true":"false")?f.INSTANCE:v.INSTANCE:new l(R,C,Y)}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=x.get(this.key);if(typeof R=="boolean"){const C=R?"true":"false";return this.value===C?f.INSTANCE:v.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),Y=R.getValue(this.key);return Array.isArray(C)?C.indexOf(Y)>=0:typeof Y=="string"&&typeof C=="object"&&C!==null?g.call(C,Y):!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,Y){this.key=R,this.value=C,this.negated=Y,this.type=5}static create(R,C,Y=null){if(typeof C=="boolean")return C?D.create(R,Y):c.create(R,Y);const ie=x.get(R);return typeof ie=="boolean"?C===(ie?"true":"false")?v.INSTANCE:f.INSTANCE:new E(R,C,Y)}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=x.get(this.key);if(typeof R=="boolean"){const C=R?"true":"false";return this.value===C?v.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 D{constructor(R,C){this.key=R,this.negated=C,this.type=3}static create(R,C=null){const Y=x.get(R);return typeof Y=="boolean"?Y?v.INSTANCE:f.INSTANCE:new D(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=x.get(this.key);return typeof R=="boolean"?R?v.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(j,R){if(typeof j=="string"){const C=parseFloat(j);isNaN(C)||(j=C)}return typeof j=="string"||typeof j=="number"?R(j):v.INSTANCE}class w{constructor(R,C,Y){this.key=R,this.value=C,this.negated=Y,this.type=12}static create(R,C,Y=null){return L(C,ie=>new w(R,ie,Y))}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,Y){this.key=R,this.value=C,this.negated=Y,this.type=13}static create(R,C,Y=null){return L(C,ie=>new A(R,ie,Y))}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,Y){this.key=R,this.value=C,this.negated=Y,this.type=14}static create(R,C,Y=null){return L(C,ie=>new P(R,ie,Y))}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,Y){this.key=R,this.value=C,this.negated=Y,this.type=15}static create(R,C,Y=null){return L(C,ie=>new U(R,ie,Y))}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=w.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:"",Y=R.regexp?R.regexp.source:"";return C<Y?-1:C>Y?1:0}equals(R){if(R.type===this.type){const C=this.regexp?this.regexp.source:"",Y=R.regexp?R.regexp.source:"";return this.key===R.key&&C===Y}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(j){let R=null;for(let C=0,Y=j.length;C<Y;C++){const ie=j[C].substituteConstants();if(j[C]!==ie&&R===null){R=[];for(let ve=0;ve<C;ve++)R[ve]=j[ve]}R!==null&&(R[C]=ie)}return R===null?j:R}class q{constructor(R,C){this.expr=R,this.negated=C,this.type=6}static create(R,C){return q._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,Y=this.expr.length;C<Y;C++){const ie=n(this.expr[C],R.expr[C]);if(ie!==0)return ie}return 0}equals(R){if(R.type===this.type){if(this.expr.length!==R.expr.length)return!1;for(let C=0,Y=this.expr.length;C<Y;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:q.create(R,this.negated)}evaluate(R){for(let C=0,Y=this.expr.length;C<Y;C++)if(!this.expr[C].evaluate(R))return!1;return!0}static _normalizeArr(R,C){const Y=[];let ie=!1;for(const ve of R)if(ve){if(ve.type===1){ie=!0;continue}if(ve.type===0)return v.INSTANCE;if(ve.type===6){Y.push(...ve.expr);continue}Y.push(ve)}if(Y.length===0&&ie)return f.INSTANCE;if(Y.length!==0){if(Y.length===1)return Y[0];Y.sort(n);for(let ve=1;ve<Y.length;ve++)Y[ve-1].equals(Y[ve])&&(Y.splice(ve,1),ve--);if(Y.length===1)return Y[0];for(;Y.length>1;){const ve=Y[Y.length-1];if(ve.type!==9)break;Y.pop();const Me=Y.pop(),ze=Y.length===0,Ee=V.create(ve.expr.map(Ve=>q.create([Ve,Me],null)),null,ze);Ee&&(Y.push(Ee),Y.sort(n))}return Y.length===1?Y[0]:new q(Y,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,Y){return V._normalizeArr(R,C,Y)}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,Y=this.expr.length;C<Y;C++){const ie=n(this.expr[C],R.expr[C]);if(ie!==0)return ie}return 0}equals(R){if(R.type===this.type){if(this.expr.length!==R.expr.length)return!1;for(let C=0,Y=this.expr.length;C<Y;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,Y=this.expr.length;C<Y;C++)if(this.expr[C].evaluate(R))return!0;return!1}static _normalizeArr(R,C,Y){let ie=[],ve=!1;if(R){for(let Me=0,ze=R.length;Me<ze;Me++){const Ee=R[Me];if(Ee){if(Ee.type===0){ve=!0;continue}if(Ee.type===1)return f.INSTANCE;if(Ee.type===9){ie=ie.concat(Ee.expr);continue}ie.push(Ee)}}if(ie.length===0&&ve)return v.INSTANCE;ie.sort(n)}if(ie.length!==0){if(ie.length===1)return ie[0];for(let Me=1;Me<ie.length;Me++)ie[Me-1].equals(ie[Me])&&(ie.splice(Me,1),Me--);if(ie.length===1)return ie[0];if(Y){for(let Me=0;Me<ie.length;Me++)for(let ze=Me+1;ze<ie.length;ze++)M(ie[Me],ie[ze])&&(ie.splice(ze,1),ze--);if(ie.length===1)return ie[0]}return new V(ie,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(),Y=R.shift(),ie=[];for(const Me of K(C))for(const ze of K(Y))ie.push(q.create([Me,ze],null));const ve=R.length===0;R.unshift(V.create(ie,null,ve))}this.negated=R[0]}return this.negated}}class ne extends c{constructor(R,C,Y){super(R,null),this._defaultValue=C,typeof Y=="object"?ne._info.push(Object.assign(Object.assign({},Y),{key:R})):Y!==!0&&ne._info.push({key:R,description:Y,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 ce=(0,G.yh)("contextKeyService"),ee="setContext";function z(j,R){return j<R?-1:j>R?1:0}function Z(j,R,C,Y){return j<C?-1:j>C?1:R<Y?-1:R>Y?1:0}function M(j,R){if(R.type===6&&j.type!==9&&j.type!==6){for(const ie of R.expr)if(j.equals(ie))return!0}const C=j.negate(),Y=K(C).concat(K(R));Y.sort(n);for(let ie=0;ie<Y.length;ie++){const Me=Y[ie].negate();for(let ze=ie+1;ze<Y.length;ze++){const Ee=Y[ze];if(Me.equals(Ee))return!0}}return!1}function K(j){return j.type===9?j.expr:[j]}},16925:function(ft,me,b){"use strict";b.d(me,{I8:function(){return k},TG:function(){return I},jt:function(){return x},yh:function(){return T}});var k;(function(g){g.serviceIds=new Map,g.DI_TARGET="$di$target",g.DI_DEPENDENCIES="$di$dependencies";function O(m){return m[g.DI_DEPENDENCIES]||[]}g.getServiceDependencies=O})(k||(k={}));const I=T("instantiationService");function G(g,O,m,n){O[k.DI_TARGET]===O?O[k.DI_DEPENDENCIES].push({id:g,index:m,optional:n}):(O[k.DI_DEPENDENCIES]=[{id:g,index:m,optional:n}],O[k.DI_TARGET]=O)}function T(g){if(k.serviceIds.has(g))return k.serviceIds.get(g);const O=function(m,n,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");G(O,m,v,!1)};return O.toString=()=>g,k.serviceIds.set(g,O),O}function x(g){return function(O,m,n){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");G(g,O,n,!0)}}},44650:function(ft,me,b){"use strict";b.d(me,{B:function(){return T}});var k=b(76068),I=b(72999);class G{constructor(){this.data=new Map}add(g,O){k.ok(I.HD(g)),k.ok(I.Kn(O)),k.ok(!this.data.has(g),"There is already an extension with this id"),this.data.set(g,O)}as(g){return this.data.get(g)||null}}const T=new G},66213:function(ft,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(ft,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 v},m6:function(){return f}});var k=b(52615),I=b(4348),G=b(69323),T=b(16925),x=b(44650),g=b(66213);const O=(0,T.yh)("themeService");var m;(function(D){function L(w){return w&&typeof w=="object"&&typeof w.id=="string"}D.isThemeColor=L})(m||(m={}));function n(D){return{id:D}}var v;(function(D){function L(H){return H&&typeof H=="object"&&typeof H.id=="string"&&(typeof H.color=="undefined"||m.isThemeColor(H.color))}D.isThemeIcon=L;const w=new RegExp(`^\\$\\((${k.dT.iconNameExpression}(?:${k.dT.iconModifierExpression})?)\\)$`);function A(H){const F=w.exec(H);if(!F)return;let[,q]=F;return{id:q}}D.fromString=A;function P(H,F){let q=H.id;const V=q.lastIndexOf("~");return V!==-1&&(q=q.substring(0,V)),F&&(q=`${q}~${F}`),{id:q}}D.modify=P;function U(H,F){var q,V;return H.id===F.id&&((q=H.color)===null||q===void 0?void 0:q.id)===((V=F.color)===null||V===void 0?void 0:V.id)}D.isEqual=U;function N(H,F){return{id:H.id,color:F?n(F):void 0}}D.asThemeIcon=N,D.asClassNameArray=k.dT.asClassNameArray,D.asClassName=k.dT.asClassName,D.asCSSSelector=k.dT.asCSSSelector})(v||(v={}));function f(D){switch(D){case g.e.DARK:return"vs-dark";case g.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,G.OF)(()=>{const w=this.themingParticipants.indexOf(L);this.themingParticipants.splice(w,1)})}getThemingParticipants(){return this.themingParticipants}}let u=new l;x.B.add(c.ThemingContribution,u);function p(D){return u.onColorThemeChange(D)}class E extends G.JT{constructor(L){super(),this.themeService=L,this.theme=L.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(w=>this.onThemeChange(w)))}onThemeChange(L){this.theme=L,this.updateStyles()}updateStyles(){}}},66003:function(ft,me,b){"use strict";b.d(me,{Z:function(){return O}});var k=b(74416),I=b(77321),G=b(62853),T=b(59301),x=["show"];function g(m,n){if(!n.max)return!0;var v=n.strategy(m);return v<=n.max}function O(m,n){return T.useMemo(function(){var v={};n&&(v.show=(0,G.Z)(n)==="object"&&n.formatter?n.formatter:!!n),v=(0,I.Z)((0,I.Z)({},v),m);var f=v,c=f.show,l=(0,k.Z)(f,x);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(ft,me,b){"use strict";b.r(me),b.d(me,{BaseInput:function(){return v},default:function(){return A}});var k=b(77321),I=b(72308),G=b(49618),T=b(62853),x=b(92310),g=b.n(x),O=b(59301),m=b(30292),n=O.forwardRef(function(P,U){var N,H,F,q=P.inputElement,V=P.children,ne=P.prefixCls,ce=P.prefix,ee=P.suffix,z=P.addonBefore,Z=P.addonAfter,M=P.className,K=P.style,j=P.disabled,R=P.readOnly,C=P.focused,Y=P.triggerFocus,ie=P.allowClear,ve=P.value,Me=P.handleReset,ze=P.hidden,Ee=P.classes,Ve=P.classNames,Oe=P.dataAttrs,Be=P.styles,ut=P.components,xt=P.onClear,st=V!=null?V:q,$t=(ut==null?void 0:ut.affixWrapper)||"span",Ct=(ut==null?void 0:ut.groupWrapper)||"span",Ce=(ut==null?void 0:ut.wrapper)||"span",De=(ut==null?void 0:ut.groupAddon)||"span",de=(0,O.useRef)(null),Pe=function(at){var ct;(ct=de.current)!==null&&ct!==void 0&&ct.contains(at.target)&&(Y==null||Y())},We=(0,m.X3)(P),je=(0,O.cloneElement)(st,{value:ve,className:g()((N=st.props)===null||N===void 0?void 0:N.className,!We&&(Ve==null?void 0:Ve.variant))||null}),J=(0,O.useRef)(null);if(O.useImperativeHandle(U,function(){return{nativeElement:J.current||de.current}}),We){var oe=null;if(ie){var pe=!j&&!R&&ve,ue="".concat(ne,"-clear-icon"),ye=(0,T.Z)(ie)==="object"&&ie!==null&&ie!==void 0&&ie.clearIcon?ie.clearIcon:"\u2716";oe=O.createElement("button",{type:"button",tabIndex:-1,onClick:function(at){Me==null||Me(at),xt==null||xt()},onMouseDown:function(at){return at.preventDefault()},className:g()(ue,(0,G.Z)((0,G.Z)({},"".concat(ue,"-hidden"),!pe),"".concat(ue,"-has-suffix"),!!ee))},ye)}var Se="".concat(ne,"-affix-wrapper"),Ne=g()(Se,(0,G.Z)((0,G.Z)((0,G.Z)((0,G.Z)((0,G.Z)({},"".concat(ne,"-disabled"),j),"".concat(Se,"-disabled"),j),"".concat(Se,"-focused"),C),"".concat(Se,"-readonly"),R),"".concat(Se,"-input-with-clear-btn"),ee&&ie&&ve),Ee==null?void 0:Ee.affixWrapper,Ve==null?void 0:Ve.affixWrapper,Ve==null?void 0:Ve.variant),Ie=(ee||ie)&&O.createElement("span",{className:g()("".concat(ne,"-suffix"),Ve==null?void 0:Ve.suffix),style:Be==null?void 0:Be.suffix},oe,ee);je=O.createElement($t,(0,I.Z)({className:Ne,style:Be==null?void 0:Be.affixWrapper,onClick:Pe},Oe==null?void 0:Oe.affixWrapper,{ref:de}),ce&&O.createElement("span",{className:g()("".concat(ne,"-prefix"),Ve==null?void 0:Ve.prefix),style:Be==null?void 0:Be.prefix},ce),je,Ie)}if((0,m.He)(P)){var Ue="".concat(ne,"-group"),ke="".concat(Ue,"-addon"),it="".concat(Ue,"-wrapper"),Xe=g()("".concat(ne,"-wrapper"),Ue,Ee==null?void 0:Ee.wrapper,Ve==null?void 0:Ve.wrapper),Ye=g()(it,(0,G.Z)({},"".concat(it,"-disabled"),j),Ee==null?void 0:Ee.group,Ve==null?void 0:Ve.groupWrapper);je=O.createElement(Ct,{className:Ye,ref:J},O.createElement(Ce,{className:Xe},z&&O.createElement(De,{className:ke},z),je,Z&&O.createElement(De,{className:ke},Z)))}return O.cloneElement(je,{className:g()((H=je.props)===null||H===void 0?void 0:H.className,M)||null,style:(0,k.Z)((0,k.Z)({},(F=je.props)===null||F===void 0?void 0:F.style),K),hidden:ze})}),v=n,f=b(80702),c=b(52487),l=b(74416),u=b(18929),p=b(2738),E=b(66003),D=["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,q=P.onBlur,V=P.onPressEnter,ne=P.onKeyDown,ce=P.onKeyUp,ee=P.prefixCls,z=ee===void 0?"rc-input":ee,Z=P.disabled,M=P.htmlSize,K=P.className,j=P.maxLength,R=P.suffix,C=P.showCount,Y=P.count,ie=P.type,ve=ie===void 0?"text":ie,Me=P.classes,ze=P.classNames,Ee=P.styles,Ve=P.onCompositionStart,Oe=P.onCompositionEnd,Be=(0,l.Z)(P,D),ut=(0,O.useState)(!1),xt=(0,c.Z)(ut,2),st=xt[0],$t=xt[1],Ct=(0,O.useRef)(!1),Ce=(0,O.useRef)(!1),De=(0,O.useRef)(null),de=(0,O.useRef)(null),Pe=function(dt){De.current&&(0,m.nH)(De.current,dt)},We=(0,u.Z)(P.defaultValue,{value:P.value}),je=(0,c.Z)(We,2),J=je[0],oe=je[1],pe=J==null?"":String(J),ue=(0,O.useState)(null),ye=(0,c.Z)(ue,2),Se=ye[0],Ne=ye[1],Ie=(0,E.Z)(Y,C),Ue=Ie.max||j,ke=Ie.strategy(pe),it=!!Ue&&ke>Ue;(0,O.useImperativeHandle)(U,function(){var rt;return{focus:Pe,blur:function(){var xe;(xe=De.current)===null||xe===void 0||xe.blur()},setSelectionRange:function(xe,ge,be){var te;(te=De.current)===null||te===void 0||te.setSelectionRange(xe,ge,be)},select:function(){var xe;(xe=De.current)===null||xe===void 0||xe.select()},input:De.current,nativeElement:((rt=de.current)===null||rt===void 0?void 0:rt.nativeElement)||De.current}}),(0,O.useEffect)(function(){Ce.current&&(Ce.current=!1),$t(function(rt){return rt&&Z?!1:rt})},[Z]);var Xe=function(dt,xe,ge){var be=xe;if(!Ct.current&&Ie.exceedFormatter&&Ie.max&&Ie.strategy(xe)>Ie.max){if(be=Ie.exceedFormatter(xe,{max:Ie.max}),xe!==be){var te,re;Ne([((te=De.current)===null||te===void 0?void 0:te.selectionStart)||0,((re=De.current)===null||re===void 0?void 0:re.selectionEnd)||0])}}else if(ge.source==="compositionEnd")return;oe(be),De.current&&(0,m.rJ)(De.current,dt,H,be)};(0,O.useEffect)(function(){if(Se){var rt;(rt=De.current)===null||rt===void 0||rt.setSelectionRange.apply(rt,(0,f.Z)(Se))}},[Se]);var Ye=function(dt){Xe(dt,dt.target.value,{source:"change"})},Qe=function(dt){Ct.current=!1,Xe(dt,dt.currentTarget.value,{source:"compositionEnd"}),Oe==null||Oe(dt)},at=function(dt){V&&dt.key==="Enter"&&!Ce.current&&(Ce.current=!0,V(dt)),ne==null||ne(dt)},ct=function(dt){dt.key==="Enter"&&(Ce.current=!1),ce==null||ce(dt)},Ze=function(dt){$t(!0),F==null||F(dt)},yt=function(dt){Ce.current&&(Ce.current=!1),$t(!1),q==null||q(dt)},Lt=function(dt){oe(""),Pe(),De.current&&(0,m.rJ)(De.current,dt,H)},Rt=it&&"".concat(z,"-out-of-range"),It=function(){var dt=(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},dt,{onChange:Ye,onFocus:Ze,onBlur:yt,onKeyDown:at,onKeyUp:ct,className:g()(z,(0,G.Z)({},"".concat(z,"-disabled"),Z),ze==null?void 0:ze.input),style:Ee==null?void 0:Ee.input,ref:De,size:M,type:ve,onCompositionStart:function(ge){Ct.current=!0,Ve==null||Ve(ge)},onCompositionEnd:Qe}))},Kt=function(){var dt=Number(Ue)>0;if(R||Ie.show){var xe=Ie.showFormatter?Ie.showFormatter({value:pe,count:ke,maxLength:Ue}):"".concat(ke).concat(dt?" / ".concat(Ue):"");return O.createElement(O.Fragment,null,Ie.show&&O.createElement("span",{className:g()("".concat(z,"-show-count-suffix"),(0,G.Z)({},"".concat(z,"-show-count-has-suffix"),!!R),ze==null?void 0:ze.count),style:(0,k.Z)({},Ee==null?void 0:Ee.count)},xe),R)}return null};return O.createElement(v,(0,I.Z)({},Be,{prefixCls:z,className:g()(K,Rt),handleReset:Lt,value:pe,focused:st,triggerFocus:Pe,suffix:Kt(),disabled:Z,classes:Me,classNames:ze,styles:Ee}),It())}),w=L,A=w},30292:function(ft,me,b){"use strict";b.d(me,{He:function(){return k},X3:function(){return I},nH:function(){return x},rJ:function(){return T}});function k(g){return!!(g.addonBefore||g.addonAfter)}function I(g){return!!(g.prefix||g.suffix||g.allowClear)}function G(g,O,m){var n=O.cloneNode(!0),v=Object.create(g,{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)},v}function T(g,O,m,n){if(m){var v=O;if(O.type==="click"){v=G(O,g,""),m(v);return}if(g.type!=="file"&&n!==void 0){v=G(O,g,n),m(v);return}m(v)}}function x(g,O){if(g){g.focus(O);var m=O||{},n=m.cursor;if(n){var v=g.value.length;switch(n){case"start":g.setSelectionRange(0,0);break;case"end":g.setSelectionRange(v,v);break;default:g.setSelectionRange(0,v)}}}}},29301:function(ft,me,b){"use strict";b.d(me,{Z:function(){return ee}});var k=b(72308),I=b(59301),G=b(11592),T=b(48736),x=b(77321),g=b(62853),O=b(76846),m=b(8654),n=I.createContext(null);function v(z){var Z=z.children,M=z.onBatchResize,K=I.useRef(0),j=I.useRef([]),R=I.useContext(n),C=I.useCallback(function(Y,ie,ve){K.current+=1;var Me=K.current;j.current.push({size:Y,element:ie,data:ve}),Promise.resolve().then(function(){Me===K.current&&(M==null||M(j.current),j.current=[])}),R==null||R(Y,ie,ve)},[M,R]);return I.createElement(n.Provider,{value:C},Z)}var f=b(76374),c=new Map;function l(z){z.forEach(function(Z){var M,K=Z.target;(M=c.get(K))===null||M===void 0||M.forEach(function(j){return j(K)})})}var u=new f.Z(l),p=null,E=null;function D(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 w=b(96949),A=b(55090),P=b(77205),U=b(38793),N=function(z){(0,P.Z)(M,z);var Z=(0,U.Z)(M);function M(){return(0,w.Z)(this,M),Z.apply(this,arguments)}return(0,A.Z)(M,[{key:"render",value:function(){return this.props.children}}]),M}(I.Component);function H(z,Z){var M=z.children,K=z.disabled,j=I.useRef(null),R=I.useRef(null),C=I.useContext(n),Y=typeof M=="function",ie=Y?M(j):M,ve=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Me=!Y&&I.isValidElement(ie)&&(0,m.Yr)(ie),ze=Me?(0,m.C4)(ie):null,Ee=(0,m.x1)(ze,j),Ve=function(){var xt;return(0,O.ZP)(j.current)||(j.current&&(0,g.Z)(j.current)==="object"?(0,O.ZP)((xt=j.current)===null||xt===void 0?void 0:xt.nativeElement):null)||(0,O.ZP)(R.current)};I.useImperativeHandle(Z,function(){return Ve()});var Oe=I.useRef(z);Oe.current=z;var Be=I.useCallback(function(ut){var xt=Oe.current,st=xt.onResize,$t=xt.data,Ct=ut.getBoundingClientRect(),Ce=Ct.width,De=Ct.height,de=ut.offsetWidth,Pe=ut.offsetHeight,We=Math.floor(Ce),je=Math.floor(De);if(ve.current.width!==We||ve.current.height!==je||ve.current.offsetWidth!==de||ve.current.offsetHeight!==Pe){var J={width:We,height:je,offsetWidth:de,offsetHeight:Pe};ve.current=J;var oe=de===Math.round(Ce)?Ce:de,pe=Pe===Math.round(De)?De:Pe,ue=(0,x.Z)((0,x.Z)({},J),{},{offsetWidth:oe,offsetHeight:pe});C==null||C(ue,ut,$t),st&&Promise.resolve().then(function(){st(ue,ut)})}},[]);return I.useEffect(function(){var ut=Ve();return ut&&!K&&D(ut,Be),function(){return L(ut,Be)}},[j.current,K]),I.createElement(N,{ref:R},Me?I.cloneElement(ie,{ref:Ee}):ie)}var F=I.forwardRef(H),q=F,V="rc-observer-key";function ne(z,Z){var M=z.children,K=typeof M=="function"?[M]:(0,G.Z)(M);return K.map(function(j,R){var C=(j==null?void 0:j.key)||"".concat(V,"-").concat(R);return I.createElement(q,(0,k.Z)({},z,{key:C,ref:R===0?Z:void 0}),j)})}var ce=I.forwardRef(ne);ce.Collection=v;var ee=ce},22711:function(ft,me,b){"use strict";b.r(me),b.d(me,{ResizableTextArea:function(){return ce},default:function(){return M}});var k=b(72308),I=b(49618),G=b(77321),T=b(80702),x=b(52487),g=b(74416),O=b(92310),m=b.n(O),n=b(36901),v=b(66003),f=b(30292),c=b(18929),l=b(59301),u=b(62853),p=b(29301),E=b(34280),D=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;
|
|
|
`,w=["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(K){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,R=K.getAttribute("id")||K.getAttribute("data-reactid")||K.getAttribute("name");if(j&&A[R])return A[R];var C=window.getComputedStyle(K),Y=C.getPropertyValue("box-sizing")||C.getPropertyValue("-moz-box-sizing")||C.getPropertyValue("-webkit-box-sizing"),ie=parseFloat(C.getPropertyValue("padding-bottom"))+parseFloat(C.getPropertyValue("padding-top")),ve=parseFloat(C.getPropertyValue("border-bottom-width"))+parseFloat(C.getPropertyValue("border-top-width")),Me=w.map(function(Ee){return"".concat(Ee,":").concat(C.getPropertyValue(Ee))}).join(";"),ze={sizingStyle:Me,paddingSize:ie,borderSize:ve,boxSizing:Y};return j&&R&&(A[R]=ze),ze}function N(K){var j=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)),K.getAttribute("wrap")?P.setAttribute("wrap",K.getAttribute("wrap")):P.removeAttribute("wrap");var Y=U(K,j),ie=Y.paddingSize,ve=Y.borderSize,Me=Y.boxSizing,ze=Y.sizingStyle;P.setAttribute("style","".concat(ze,";").concat(L)),P.value=K.value||K.placeholder||"";var Ee=void 0,Ve=void 0,Oe,Be=P.scrollHeight;if(Me==="border-box"?Be+=ve:Me==="content-box"&&(Be-=ie),R!==null||C!==null){P.value=" ";var ut=P.scrollHeight-ie;R!==null&&(Ee=ut*R,Me==="border-box"&&(Ee=Ee+ie+ve),Be=Math.max(Ee,Be)),C!==null&&(Ve=ut*C,Me==="border-box"&&(Ve=Ve+ie+ve),Oe=Be>Ve?"":"hidden",Be=Math.min(Ve,Be))}var xt={height:Be,overflowY:Oe,resize:"none"};return Ee&&(xt.minHeight=Ee),Ve&&(xt.maxHeight=Ve),xt}var H=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],F=0,q=1,V=2,ne=l.forwardRef(function(K,j){var R=K,C=R.prefixCls,Y=R.defaultValue,ie=R.value,ve=R.autoSize,Me=R.onResize,ze=R.className,Ee=R.style,Ve=R.disabled,Oe=R.onChange,Be=R.onInternalAutoSize,ut=(0,g.Z)(R,H),xt=(0,c.Z)(Y,{value:ie,postState:function(yt){return yt!=null?yt:""}}),st=(0,x.Z)(xt,2),$t=st[0],Ct=st[1],Ce=function(yt){Ct(yt.target.value),Oe==null||Oe(yt)},De=l.useRef();l.useImperativeHandle(j,function(){return{textArea:De.current}});var de=l.useMemo(function(){return ve&&(0,u.Z)(ve)==="object"?[ve.minRows,ve.maxRows]:[]},[ve]),Pe=(0,x.Z)(de,2),We=Pe[0],je=Pe[1],J=!!ve,oe=function(){try{if(document.activeElement===De.current){var yt=De.current,Lt=yt.selectionStart,Rt=yt.selectionEnd,It=yt.scrollTop;De.current.setSelectionRange(Lt,Rt),De.current.scrollTop=It}}catch(Kt){}},pe=l.useState(V),ue=(0,x.Z)(pe,2),ye=ue[0],Se=ue[1],Ne=l.useState(),Ie=(0,x.Z)(Ne,2),Ue=Ie[0],ke=Ie[1],it=function(){Se(F)};(0,E.Z)(function(){J&&it()},[ie,We,je,J]),(0,E.Z)(function(){if(ye===F)Se(q);else if(ye===q){var Ze=N(De.current,!1,We,je);Se(V),ke(Ze)}else oe()},[ye]);var Xe=l.useRef(),Ye=function(){D.Z.cancel(Xe.current)},Qe=function(yt){ye===V&&(Me==null||Me(yt),ve&&(Ye(),Xe.current=(0,D.Z)(function(){it()})))};l.useEffect(function(){return Ye},[]);var at=J?Ue:null,ct=(0,G.Z)((0,G.Z)({},Ee),at);return(ye===F||ye===q)&&(ct.overflowY="hidden",ct.overflowX="hidden"),l.createElement(p.Z,{onResize:Qe,disabled:!(ve||Me)},l.createElement("textarea",(0,k.Z)({},ut,{ref:De,style:ct,className:m()(C,ze,(0,I.Z)({},"".concat(C,"-disabled"),Ve)),disabled:Ve,value:$t,onChange:Ce})))}),ce=ne,ee=["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(K,j){var R,C=K.defaultValue,Y=K.value,ie=K.onFocus,ve=K.onBlur,Me=K.onChange,ze=K.allowClear,Ee=K.maxLength,Ve=K.onCompositionStart,Oe=K.onCompositionEnd,Be=K.suffix,ut=K.prefixCls,xt=ut===void 0?"rc-textarea":ut,st=K.showCount,$t=K.count,Ct=K.className,Ce=K.style,De=K.disabled,de=K.hidden,Pe=K.classNames,We=K.styles,je=K.onResize,J=K.onClear,oe=K.onPressEnter,pe=K.readOnly,ue=K.autoSize,ye=K.onKeyDown,Se=(0,g.Z)(K,ee),Ne=(0,c.Z)(C,{value:Y,defaultValue:C}),Ie=(0,x.Z)(Ne,2),Ue=Ie[0],ke=Ie[1],it=Ue==null?"":String(Ue),Xe=l.useState(!1),Ye=(0,x.Z)(Xe,2),Qe=Ye[0],at=Ye[1],ct=l.useRef(!1),Ze=l.useState(null),yt=(0,x.Z)(Ze,2),Lt=yt[0],Rt=yt[1],It=(0,l.useRef)(null),Kt=(0,l.useRef)(null),rt=function(){var Ut;return(Ut=Kt.current)===null||Ut===void 0?void 0:Ut.textArea},dt=function(){rt().focus()};(0,l.useImperativeHandle)(j,function(){var mt;return{resizableTextArea:Kt.current,focus:dt,blur:function(){rt().blur()},nativeElement:((mt=It.current)===null||mt===void 0?void 0:mt.nativeElement)||rt()}}),(0,l.useEffect)(function(){at(function(mt){return!De&&mt})},[De]);var xe=l.useState(null),ge=(0,x.Z)(xe,2),be=ge[0],te=ge[1];l.useEffect(function(){if(be){var mt;(mt=rt()).setSelectionRange.apply(mt,(0,T.Z)(be))}},[be]);var re=(0,v.Z)($t,st),ae=(R=re.max)!==null&&R!==void 0?R:Ee,he=Number(ae)>0,_e=re.strategy(it),tt=!!ae&&_e>ae,Ke=function(Ut,ei){var ai=ei;!ct.current&&re.exceedFormatter&&re.max&&re.strategy(ei)>re.max&&(ai=re.exceedFormatter(ei,{max:re.max}),ei!==ai&&te([rt().selectionStart||0,rt().selectionEnd||0])),ke(ai),(0,f.rJ)(Ut.currentTarget,Ut,Me,ai)},qe=function(Ut){ct.current=!0,Ve==null||Ve(Ut)},ot=function(Ut){ct.current=!1,Ke(Ut,Ut.currentTarget.value),Oe==null||Oe(Ut)},Pt=function(Ut){Ke(Ut,Ut.target.value)},Ft=function(Ut){Ut.key==="Enter"&&oe&&oe(Ut),ye==null||ye(Ut)},Bt=function(Ut){at(!0),ie==null||ie(Ut)},vt=function(Ut){at(!1),ve==null||ve(Ut)},si=function(Ut){ke(""),dt(),(0,f.rJ)(rt(),Ut,Me)},_i=Be,zt;re.show&&(re.showFormatter?zt=re.showFormatter({value:it,count:_e,maxLength:ae}):zt="".concat(_e).concat(he?" / ".concat(ae):""),_i=l.createElement(l.Fragment,null,_i,l.createElement("span",{className:m()("".concat(xt,"-data-count"),Pe==null?void 0:Pe.count),style:We==null?void 0:We.count},zt)));var fi=function(Ut){var ei;je==null||je(Ut),(ei=rt())!==null&&ei!==void 0&&ei.style.height&&Rt(!0)},Nt=!ue&&!st&&!ze;return l.createElement(n.BaseInput,{ref:It,value:it,allowClear:ze,handleReset:si,suffix:_i,prefixCls:xt,classNames:(0,G.Z)((0,G.Z)({},Pe),{},{affixWrapper:m()(Pe==null?void 0:Pe.affixWrapper,(0,I.Z)((0,I.Z)({},"".concat(xt,"-show-count"),st),"".concat(xt,"-textarea-allow-clear"),ze))}),disabled:De,focused:Qe,className:m()(Ct,tt&&"".concat(xt,"-out-of-range")),style:(0,G.Z)((0,G.Z)({},Ce),Lt&&!Nt?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof zt=="string"?zt:void 0}},hidden:de,readOnly:pe,onClear:J},l.createElement(ce,(0,k.Z)({},Se,{autoSize:ue,maxLength:Ee,onKeyDown:Ft,onChange:Pt,onFocus:Bt,onBlur:vt,onCompositionStart:qe,onCompositionEnd:ot,className:m()(Pe==null?void 0:Pe.textarea),style:(0,G.Z)((0,G.Z)({},We==null?void 0:We.textarea),{},{resize:Ce==null?void 0:Ce.resize}),disabled:De,prefixCls:xt,onResize:fi,ref:Kt,readOnly:pe})))}),Z=z,M=Z},29125:function(ft,me,b){"use strict";b.d(me,{G:function(){return T},Z:function(){return L}});var k=b(92310),I=b.n(k),G=b(59301);function T(w){var A=w.children,P=w.prefixCls,U=w.id,N=w.overlayInnerStyle,H=w.bodyClassName,F=w.className,q=w.style;return G.createElement("div",{className:I()("".concat(P,"-content"),F),style:q},G.createElement("div",{className:I()("".concat(P,"-inner"),H),id:U,role:"tooltip",style:N},typeof A=="function"?A():A))}var x=b(72308),g=b(77321),O=b(74416),m=b(65352),n={shiftX:64,adjustY:1},v={adjustX:1,shiftY:!0},f=[0,0],c={left:{points:["cr","cl"],overflow:v,offset:[-4,0],targetOffset:f},right:{points:["cl","cr"],overflow:v,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:v,offset:[-4,0],targetOffset:f},topRight:{points:["br","tr"],overflow:n,offset:[0,-4],targetOffset:f},rightTop:{points:["tl","tr"],overflow:v,offset:[4,0],targetOffset:f},bottomRight:{points:["tr","br"],overflow:n,offset:[0,4],targetOffset:f},rightBottom:{points:["bl","br"],overflow:v,offset:[4,0],targetOffset:f},bottomLeft:{points:["tl","bl"],overflow:n,offset:[0,4],targetOffset:f},leftBottom:{points:["br","bl"],overflow:v,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,q=F===void 0?0:F,V=A.mouseLeaveDelay,ne=V===void 0?.1:V,ce=A.overlayStyle,ee=A.prefixCls,z=ee===void 0?"rc-tooltip":ee,Z=A.children,M=A.onVisibleChange,K=A.afterVisibleChange,j=A.transitionName,R=A.animation,C=A.motion,Y=A.placement,ie=Y===void 0?"right":Y,ve=A.align,Me=ve===void 0?{}:ve,ze=A.destroyTooltipOnHide,Ee=ze===void 0?!1:ze,Ve=A.defaultVisible,Oe=A.getTooltipContainer,Be=A.overlayInnerStyle,ut=A.arrowContent,xt=A.overlay,st=A.id,$t=A.showArrow,Ct=$t===void 0?!0:$t,Ce=A.classNames,De=A.styles,de=(0,O.Z)(A,p),Pe=(0,u.Z)(st),We=(0,G.useRef)(null);(0,G.useImperativeHandle)(P,function(){return We.current});var je=(0,g.Z)({},de);"visible"in A&&(je.popupVisible=A.visible);var J=function(){return G.createElement(T,{key:"content",prefixCls:z,id:Pe,bodyClassName:Ce==null?void 0:Ce.body,overlayInnerStyle:(0,g.Z)((0,g.Z)({},Be),De==null?void 0:De.body)},xt)},oe=function(){var ue=G.Children.only(Z),ye=(ue==null?void 0:ue.props)||{},Se=(0,g.Z)((0,g.Z)({},ye),{},{"aria-describedby":xt?Pe:null});return G.cloneElement(Z,Se)};return G.createElement(m.Z,(0,x.Z)({popupClassName:I()(U,Ce==null?void 0:Ce.root),prefixCls:z,popup:J,action:H,builtinPlacements:c,popupPlacement:ie,ref:We,popupAlign:Me,getPopupContainer:Oe,onPopupVisibleChange:M,afterPopupVisibleChange:K,popupTransitionName:j,popupAnimation:R,popupMotion:C,defaultPopupVisible:Ve,autoDestroy:Ee,mouseLeaveDelay:ne,popupStyle:(0,g.Z)((0,g.Z)({},ce),De==null?void 0:De.root),mouseEnterDelay:q,arrow:Ct},je),oe())},D=(0,G.forwardRef)(E),L=D},49658:function(ft,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(ft,me,b){"use strict";Object.defineProperty(me,"__esModule",{value:!0}),me.CopyToClipboard=void 0;var k=G(b(59301)),I=G(b(25769));function G(w){return w&&w.__esModule?w:{default:w}}function T(w){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?T=function(P){return typeof P}:T=function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},T(w)}function x(w,A){var P=Object.keys(w);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(w);A&&(U=U.filter(function(N){return Object.getOwnPropertyDescriptor(w,N).enumerable})),P.push.apply(P,U)}return P}function g(w){for(var A=1;A<arguments.length;A++){var P=arguments[A]!=null?arguments[A]:{};A%2?x(P,!0).forEach(function(U){D(w,U,P[U])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(P)):x(P).forEach(function(U){Object.defineProperty(w,U,Object.getOwnPropertyDescriptor(P,U))})}return w}function O(w,A){if(w==null)return{};var P=m(w,A),U,N;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(w);for(N=0;N<H.length;N++)U=H[N],!(A.indexOf(U)>=0)&&Object.prototype.propertyIsEnumerable.call(w,U)&&(P[U]=w[U])}return P}function m(w,A){if(w==null)return{};var P={},U=Object.keys(w),N,H;for(H=0;H<U.length;H++)N=U[H],!(A.indexOf(N)>=0)&&(P[N]=w[N]);return P}function n(w,A){if(!(w instanceof A))throw new TypeError("Cannot call a class as a function")}function v(w,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(w,U.key,U)}}function f(w,A,P){return A&&v(w.prototype,A),P&&v(w,P),w}function c(w,A){return A&&(T(A)==="object"||typeof A=="function")?A:u(w)}function l(w){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(P){return P.__proto__||Object.getPrototypeOf(P)},l(w)}function u(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function p(w,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function");w.prototype=Object.create(A&&A.prototype,{constructor:{value:w,writable:!0,configurable:!0}}),A&&E(w,A)}function E(w,A){return E=Object.setPrototypeOf||function(U,N){return U.__proto__=N,U},E(w,A)}function D(w,A,P){return A in w?Object.defineProperty(w,A,{value:P,enumerable:!0,configurable:!0,writable:!0}):w[A]=P,w}var L=function(w){p(A,w);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))),D(u(U),"onClick",function(q){var V=U.props,ne=V.text,ce=V.onCopy,ee=V.children,z=V.options,Z=k.default.Children.only(ee),M=(0,I.default)(ne,z);ce&&ce(ne,M),Z&&Z.props&&typeof Z.props.onClick=="function"&&Z.props.onClick(q)}),U}return f(A,[{key:"render",value:function(){var U=this.props,N=U.text,H=U.onCopy,F=U.options,q=U.children,V=O(U,["text","onCopy","options","children"]),ne=k.default.Children.only(q);return k.default.cloneElement(ne,g({},V,{onClick:this.onClick}))}}]),A}(k.default.PureComponent);me.CopyToClipboard=L,D(L,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(ft,me,b){"use strict";var k=b(83145),I=k.CopyToClipboard;I.CopyToClipboard=I,ft.exports=I},76374:function(ft,me,b){"use strict";var k=function(){if(typeof Map!="undefined")return Map;function ee(z,Z){var M=-1;return z.some(function(K,j){return K[0]===Z?(M=j,!0):!1}),M}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 M=ee(this.__entries__,Z),K=this.__entries__[M];return K&&K[1]},z.prototype.set=function(Z,M){var K=ee(this.__entries__,Z);~K?this.__entries__[K][1]=M:this.__entries__.push([Z,M])},z.prototype.delete=function(Z){var M=this.__entries__,K=ee(M,Z);~K&&M.splice(K,1)},z.prototype.has=function(Z){return!!~ee(this.__entries__,Z)},z.prototype.clear=function(){this.__entries__.splice(0)},z.prototype.forEach=function(Z,M){M===void 0&&(M=null);for(var K=0,j=this.__entries__;K<j.length;K++){var R=j[K];Z.call(M,R[1],R[0])}},z}()}(),I=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,G=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")()}(),T=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(G):function(ee){return setTimeout(function(){return ee(Date.now())},1e3/60)}}(),x=2;function g(ee,z){var Z=!1,M=!1,K=0;function j(){Z&&(Z=!1,ee()),M&&C()}function R(){T(j)}function C(){var Y=Date.now();if(Z){if(Y-K<x)return;M=!0}else Z=!0,M=!1,setTimeout(R,z);K=Y}return C}var O=20,m=["top","right","bottom","left","width","height","size","weight"],n=typeof MutationObserver!="undefined",v=function(){function ee(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=g(this.refresh.bind(this),O)}return ee.prototype.addObserver=function(z){~this.observers_.indexOf(z)||this.observers_.push(z),this.connected_||this.connect_()},ee.prototype.removeObserver=function(z){var Z=this.observers_,M=Z.indexOf(z);~M&&Z.splice(M,1),!Z.length&&this.connected_&&this.disconnect_()},ee.prototype.refresh=function(){var z=this.updateObservers_();z&&this.refresh()},ee.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},ee.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)},ee.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)},ee.prototype.onTransitionEnd_=function(z){var Z=z.propertyName,M=Z===void 0?"":Z,K=m.some(function(j){return!!~M.indexOf(j)});K&&this.refresh()},ee.getInstance=function(){return this.instance_||(this.instance_=new ee),this.instance_},ee.instance_=null,ee}(),f=function(ee,z){for(var Z=0,M=Object.keys(z);Z<M.length;Z++){var K=M[Z];Object.defineProperty(ee,K,{value:z[K],enumerable:!1,writable:!1,configurable:!0})}return ee},c=function(ee){var z=ee&&ee.ownerDocument&&ee.ownerDocument.defaultView;return z||G},l=N(0,0,0,0);function u(ee){return parseFloat(ee)||0}function p(ee){for(var z=[],Z=1;Z<arguments.length;Z++)z[Z-1]=arguments[Z];return z.reduce(function(M,K){var j=ee["border-"+K+"-width"];return M+u(j)},0)}function E(ee){for(var z=["top","right","bottom","left"],Z={},M=0,K=z;M<K.length;M++){var j=K[M],R=ee["padding-"+j];Z[j]=u(R)}return Z}function D(ee){var z=ee.getBBox();return N(0,0,z.width,z.height)}function L(ee){var z=ee.clientWidth,Z=ee.clientHeight;if(!z&&!Z)return l;var M=c(ee).getComputedStyle(ee),K=E(M),j=K.left+K.right,R=K.top+K.bottom,C=u(M.width),Y=u(M.height);if(M.boxSizing==="border-box"&&(Math.round(C+j)!==z&&(C-=p(M,"left","right")+j),Math.round(Y+R)!==Z&&(Y-=p(M,"top","bottom")+R)),!A(ee)){var ie=Math.round(C+j)-z,ve=Math.round(Y+R)-Z;Math.abs(ie)!==1&&(C-=ie),Math.abs(ve)!==1&&(Y-=ve)}return N(K.left,K.top,C,Y)}var w=function(){return typeof SVGGraphicsElement!="undefined"?function(ee){return ee instanceof c(ee).SVGGraphicsElement}:function(ee){return ee instanceof c(ee).SVGElement&&typeof ee.getBBox=="function"}}();function A(ee){return ee===c(ee).document.documentElement}function P(ee){return I?w(ee)?D(ee):L(ee):l}function U(ee){var z=ee.x,Z=ee.y,M=ee.width,K=ee.height,j=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,R=Object.create(j.prototype);return f(R,{x:z,y:Z,width:M,height:K,top:Z,right:z+M,bottom:K+Z,left:z}),R}function N(ee,z,Z,M){return{x:ee,y:z,width:Z,height:M}}var H=function(){function ee(z){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=N(0,0,0,0),this.target=z}return ee.prototype.isActive=function(){var z=P(this.target);return this.contentRect_=z,z.width!==this.broadcastWidth||z.height!==this.broadcastHeight},ee.prototype.broadcastRect=function(){var z=this.contentRect_;return this.broadcastWidth=z.width,this.broadcastHeight=z.height,z},ee}(),F=function(){function ee(z,Z){var M=U(Z);f(this,{target:z,contentRect:M})}return ee}(),q=function(){function ee(z,Z,M){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_=M}return ee.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())}},ee.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))}},ee.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},ee.prototype.gatherActive=function(){var z=this;this.clearActive(),this.observations_.forEach(function(Z){Z.isActive()&&z.activeObservations_.push(Z)})},ee.prototype.broadcastActive=function(){if(this.hasActive()){var z=this.callbackCtx_,Z=this.activeObservations_.map(function(M){return new F(M.target,M.broadcastRect())});this.callback_.call(z,Z,z),this.clearActive()}},ee.prototype.clearActive=function(){this.activeObservations_.splice(0)},ee.prototype.hasActive=function(){return this.activeObservations_.length>0},ee}(),V=typeof WeakMap!="undefined"?new WeakMap:new k,ne=function(){function ee(z){if(!(this instanceof ee))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=v.getInstance(),M=new q(z,Z,this);V.set(this,M)}return ee}();["observe","unobserve","disconnect"].forEach(function(ee){ne.prototype[ee]=function(){var z;return(z=V.get(this))[ee].apply(z,arguments)}});var ce=function(){return typeof G.ResizeObserver!="undefined"?G.ResizeObserver:ne}();me.Z=ce},98040:function(ft){ft.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(G){me.addRange(G)}),b&&b.focus()}}},34376:function(ft){(function(me,b){if(1)ft.exports=b();else var k,I})(window,function(){return function(me){var b={};function k(I){if(b[I])return b[I].exports;var G=b[I]={i:I,l:!1,exports:{}};return me[I].call(G.exports,G,G.exports,k),G.l=!0,G.exports}return k.m=me,k.c=b,k.d=function(I,G,T){k.o(I,G)||Object.defineProperty(I,G,{enumerable:!0,get:T})},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,G){if(1&G&&(I=k(I)),8&G||4&G&&typeof I=="object"&&I&&I.__esModule)return I;var T=Object.create(null);if(k.r(T),Object.defineProperty(T,"default",{enumerable:!0,value:I}),2&G&&typeof I!="string")for(var x in I)k.d(T,x,function(g){return I[g]}.bind(null,x));return T},k.n=function(I){var G=I&&I.__esModule?function(){return I.default}:function(){return I};return k.d(G,"a",G),G},k.o=function(I,G){return Object.prototype.hasOwnProperty.call(I,G)},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 G(){this._listeners=[],this._disposed=!1}return Object.defineProperty(G.prototype,"event",{get:function(){var T=this;return this._event||(this._event=function(x){return T._listeners.push(x),{dispose:function(){if(!T._disposed){for(var g=0;g<T._listeners.length;g++)if(T._listeners[g]===x)return void T._listeners.splice(g,1)}}}}),this._event},enumerable:!1,configurable:!0}),G.prototype.fire=function(T,x){for(var g=[],O=0;O<this._listeners.length;O++)g.push(this._listeners[O]);for(O=0;O<g.length;O++)g[O].call(void 0,T,x)},G.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},G}();b.EventEmitter=I,b.forwardEvent=function(G,T){return G(function(x){return T.fire(x)})}},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 T(){this._disposables=[],this._isDisposed=!1}return T.prototype.dispose=function(){this._isDisposed=!0;for(var x=0,g=this._disposables;x<g.length;x++)g[x].dispose();this._disposables.length=0},T.prototype.register=function(x){return this._disposables.push(x),x},T.prototype.unregister=function(x){var g=this._disposables.indexOf(x);g!==-1&&this._disposables.splice(g,1)},T}();function G(T){for(var x=0,g=T;x<g.length;x++)g[x].dispose();T.length=0}b.Disposable=I,b.disposeArray=G,b.getDisposeArrayDisposable=function(T){return{dispose:function(){return G(T)}}}},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,G=this&&this.__extends||(I=function(m,n){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,f){v.__proto__=f}||function(v,f){for(var c in f)f.hasOwnProperty(c)&&(v[c]=f[c])})(m,n)},function(m,n){function v(){this.constructor=m}I(m,n),m.prototype=n===null?Object.create(n):(v.prototype=n.prototype,new v)});Object.defineProperty(b,"__esModule",{value:!0}),b.CellData=void 0;var T=k(8),x=k(3),g=k(6),O=function(m){function n(){var v=m!==null&&m.apply(this,arguments)||this;return v.content=0,v.fg=0,v.bg=0,v.extended=new g.ExtendedAttrs,v.combinedData="",v}return G(n,m),n.fromCharData=function(v){var f=new n;return f.setFromCharData(v),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?T.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(v){this.fg=v[x.CHAR_DATA_ATTR_INDEX],this.bg=0;var f=!1;if(v[x.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(v[x.CHAR_DATA_CHAR_INDEX].length===2){var c=v[x.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){var l=v[x.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=l&&l<=57343?this.content=1024*(c-55296)+l-56320+65536|v[x.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=v[x.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[x.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=v[x.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[x.CHAR_DATA_WIDTH_INDEX]<<22)},n.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},n}(g.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 T(){this.fg=0,this.bg=0,this.extended=new G}return T.toColorRGB=function(x){return[x>>>16&255,x>>>8&255,255&x]},T.fromColorRGB=function(x){return(255&x[0])<<16|(255&x[1])<<8|255&x[2]},T.prototype.clone=function(){var x=new T;return x.fg=this.fg,x.bg=this.bg,x.extended=this.extended.clone(),x},T.prototype.isInverse=function(){return 67108864&this.fg},T.prototype.isBold=function(){return 134217728&this.fg},T.prototype.isUnderline=function(){return 268435456&this.fg},T.prototype.isBlink=function(){return 536870912&this.fg},T.prototype.isInvisible=function(){return 1073741824&this.fg},T.prototype.isItalic=function(){return 67108864&this.bg},T.prototype.isDim=function(){return 134217728&this.bg},T.prototype.getFgColorMode=function(){return 50331648&this.fg},T.prototype.getBgColorMode=function(){return 50331648&this.bg},T.prototype.isFgRGB=function(){return(50331648&this.fg)==50331648},T.prototype.isBgRGB=function(){return(50331648&this.bg)==50331648},T.prototype.isFgPalette=function(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432},T.prototype.isBgPalette=function(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432},T.prototype.isFgDefault=function(){return(50331648&this.fg)==0},T.prototype.isBgDefault=function(){return(50331648&this.bg)==0},T.prototype.isAttributeDefault=function(){return this.fg===0&&this.bg===0},T.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},T.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},T.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},T.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},T.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()},T.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},T.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()},T.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()},T.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()},T.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},T}();b.AttributeData=I;var G=function(){function T(x,g){x===void 0&&(x=0),g===void 0&&(g=-1),this.underlineStyle=x,this.underlineColor=g}return T.prototype.clone=function(){return new T(this.underlineStyle,this.underlineColor)},T.prototype.isEmpty=function(){return this.underlineStyle===0},T}();b.ExtendedAttrs=G},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.addDisposableDomListener=void 0,b.addDisposableDomListener=function(I,G,T,x){I.addEventListener(G,T,x);var g=!1;return{dispose:function(){g||(g=!0,I.removeEventListener(G,T,x))}}}},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(T){return T>65535?(T-=65536,String.fromCharCode(55296+(T>>10))+String.fromCharCode(T%1024+56320)):String.fromCharCode(T)},b.utf32ToString=function(T,x,g){x===void 0&&(x=0),g===void 0&&(g=T.length);for(var O="",m=x;m<g;++m){var n=T[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 T(){this._interim=0}return T.prototype.clear=function(){this._interim=0},T.prototype.decode=function(x,g){var O=x.length;if(!O)return 0;var m=0,n=0;this._interim&&(56320<=(c=x.charCodeAt(n++))&&c<=57343?g[m++]=1024*(this._interim-55296)+c-56320+65536:(g[m++]=this._interim,g[m++]=c),this._interim=0);for(var v=n;v<O;++v){var f=x.charCodeAt(v);if(55296<=f&&f<=56319){if(++v>=O)return this._interim=f,m;var c;56320<=(c=x.charCodeAt(v))&&c<=57343?g[m++]=1024*(f-55296)+c-56320+65536:(g[m++]=f,g[m++]=c)}else g[m++]=f}return m},T}();b.StringToUtf32=I;var G=function(){function T(){this.interim=new Uint8Array(3)}return T.prototype.clear=function(){this.interim.fill(0)},T.prototype.decode=function(x,g){var O=x.length;if(!O)return 0;var m,n,v,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 D=0,L=void 0;(L=63&this.interim[++D])&&D<4;)E<<=6,E|=L;for(var w=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,A=w-D;u<A;){if(u>=O)return 0;if((192&(L=x[u++]))!=128){u--,p=!0;break}this.interim[D++]=L,E<<=6,E|=63&L}p||(w===2?E<128?u--:g[c++]=E:w===3?E<2048||E>=55296&&E<=57343||(g[c++]=E):E<65536||E>1114111||(g[c++]=E)),this.interim.fill(0)}for(var P=O-4,U=u;U<O;){for(;!(!(U<P)||128&(m=x[U])||128&(n=x[U+1])||128&(v=x[U+2])||128&(f=x[U+3]));)g[c++]=m,g[c++]=n,g[c++]=v,g[c++]=f,U+=4;if((m=x[U++])<128)g[c++]=m;else if((224&m)==192){if(U>=O)return this.interim[0]=m,c;if((192&(n=x[U++]))!=128){U--;continue}if((l=(31&m)<<6|63&n)<128){U--;continue}g[c++]=l}else if((240&m)==224){if(U>=O)return this.interim[0]=m,c;if((192&(n=x[U++]))!=128){U--;continue}if(U>=O)return this.interim[0]=m,this.interim[1]=n,c;if((192&(v=x[U++]))!=128){U--;continue}if((l=(15&m)<<12|(63&n)<<6|63&v)<2048||l>=55296&&l<=57343)continue;g[c++]=l}else if((248&m)==240){if(U>=O)return this.interim[0]=m,c;if((192&(n=x[U++]))!=128){U--;continue}if(U>=O)return this.interim[0]=m,this.interim[1]=n,c;if((192&(v=x[U++]))!=128){U--;continue}if(U>=O)return this.interim[0]=m,this.interim[1]=n,this.interim[2]=v,c;if((192&(f=x[U++]))!=128){U--;continue}if((l=(7&m)<<18|(63&n)<<12|(63&v)<<6|63&f)<65536||l>1114111)continue;g[c++]=l}}return c},T}();b.Utf8ToUtf32=G},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,G,T,x;function g(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,v,f,c){return c!==void 0?"#"+g(n)+g(v)+g(f)+g(c):"#"+g(n)+g(v)+g(f)},m.toRgba=function(n,v,f,c){return c===void 0&&(c=255),(n<<24|v<<16|f<<8|c)>>>0}}(I=b.channels||(b.channels={})),(G=b.color||(b.color={})).blend=function(m,n){var v=(255&n.rgba)/255;if(v===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,D=u+Math.round((f-u)*v),L=p+Math.round((c-p)*v),w=E+Math.round((l-E)*v);return{css:I.toCss(D,L,w),rgba:I.toRgba(D,L,w)}},G.isOpaque=function(m){return(255&m.rgba)==255},G.ensureContrastRatio=function(m,n,v){var f=x.ensureContrastRatio(m.rgba,n.rgba,v);if(f)return x.toColor(f>>24&255,f>>16&255,f>>8&255)},G.opaque=function(m){var n=(255|m.rgba)>>>0,v=x.toChannels(n),f=v[0],c=v[1],l=v[2];return{css:I.toCss(f,c,l),rgba:n}},G.opacity=function(m,n){var v=Math.round(255*n),f=x.toChannels(m.rgba),c=f[0],l=f[1],u=f[2];return{css:I.toCss(c,l,u,v),rgba:I.toRgba(c,l,u,v)}},(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(v,f,c){var l=v/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(v){return n(v>>16&255,v>>8&255,255&v)},m.relativeLuminance2=n}(T=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,D=c>>24&255,L=c>>16&255,w=c>>8&255,A=O(T.relativeLuminance2(D,w,L),T.relativeLuminance2(u,p,E));A<l&&(D>0||L>0||w>0);)D-=Math.max(0,Math.ceil(.1*D)),L-=Math.max(0,Math.ceil(.1*L)),w-=Math.max(0,Math.ceil(.1*w)),A=O(T.relativeLuminance2(D,w,L),T.relativeLuminance2(u,p,E));return(D<<24|L<<16|w<<8|255)>>>0}function v(f,c,l){for(var u=f>>24&255,p=f>>16&255,E=f>>8&255,D=c>>24&255,L=c>>16&255,w=c>>8&255,A=O(T.relativeLuminance2(D,w,L),T.relativeLuminance2(u,p,E));A<l&&(D<255||L<255||w<255);)D=Math.min(255,D+Math.ceil(.1*(255-D))),L=Math.min(255,L+Math.ceil(.1*(255-L))),w=Math.min(255,w+Math.ceil(.1*(255-w))),A=O(T.relativeLuminance2(D,w,L),T.relativeLuminance2(u,p,E));return(D<<24|L<<16|w<<8|255)>>>0}m.ensureContrastRatio=function(f,c,l){var u=T.relativeLuminance(f>>8),p=T.relativeLuminance(c>>8);if(O(u,p)<l)return p<u?n(f,c,l):v(f,c,l)},m.reduceLuminance=n,m.increaseLuminance=v,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)}}}(x=b.rgba||(b.rgba={})),b.toPaddedHex=g,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",G=I?"node":navigator.userAgent,T=I?"node":navigator.platform;function x(g,O){return g.indexOf(O)>=0}b.isFirefox=!!~G.indexOf("Firefox"),b.isSafari=/^((?!chrome|android).)*safari/i.test(G),b.isMac=x(["Macintosh","MacIntel","MacPPC","Mac68K"],T),b.isIpad=T==="iPad",b.isIphone=T==="iPhone",b.isWindows=x(["Windows","Win16","Win32","WinCE"],T),b.isLinux=T.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),G=k(9),T=k(25),x=k(6),g=k(28),O=k(10),m=k(17),n=function(){function v(f,c,l,u,p,E,D,L){this._container=f,this._alpha=u,this._colors=p,this._rendererId=E,this._bufferService=D,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 v.prototype.dispose=function(){var f;m.removeElementFromParent(this._canvas),(f=this._charAtlas)===null||f===void 0||f.dispose()},v.prototype._initCanvas=function(){this._ctx=g.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},v.prototype.onOptionsChanged=function(){},v.prototype.onBlur=function(){},v.prototype.onFocus=function(){},v.prototype.onCursorMove=function(){},v.prototype.onGridChanged=function(f,c){},v.prototype.onSelectionChanged=function(f,c,l){l===void 0&&(l=!1)},v.prototype.setColors=function(f){this._refreshCharAtlas(f)},v.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)}},v.prototype._refreshCharAtlas=function(f){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=T.acquireCharAtlas(this._optionsService.options,this._rendererId,f,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},v.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)},v.prototype._fillCells=function(f,c,l,u){this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,u*this._scaledCellHeight)},v.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)},v.prototype._fillLeftLineAtCell=function(f,c,l){this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,window.devicePixelRatio*l,this._scaledCellHeight)},v.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)},v.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))},v.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))},v.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)},v.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()?G.INVERTED_DEFAULT_COLOR:f.getBgColor(),p=f.isFgDefault()?G.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))},v.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("+x.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("+x.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=G.DIM_OPACITY),this._ctx.fillText(f.getChars(),c*this._scaledCellWidth+this._scaledCharLeft,l*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},v.prototype._clipRow=function(f){this._ctx.beginPath(),this._ctx.rect(0,f*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},v.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},v.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(),D=!!f.isInverse(),L=!!f.isInverse();if(D){var w=l;l=p,p=w;var A=u;u=E,E=A}var P=this._resolveBackgroundRgba(E,p,D),U=this._resolveForegroundRgba(u,l,D,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)}},v.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}},v.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}},v}();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(G,T,x){T.di$target===T?T.di$dependencies.push({id:G,index:x}):(T.di$dependencies=[{id:G,index:x}],T.di$target=T)}b.serviceRegistry=new Map,b.getServiceDependencies=function(G){return G.di$dependencies||[]},b.createDecorator=function(G){if(b.serviceRegistry.has(G))return b.serviceRegistry.get(G);var T=function(x,g,O){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");I(T,x,O)};return T.toString=function(){return G},b.serviceRegistry.set(G,T),T}},function(me,b,k){"use strict";function I(G,T,x,g){if(x===void 0&&(x=0),g===void 0&&(g=G.length),x>=G.length)return G;x=(G.length+x)%G.length,g=g>=G.length?G.length:(G.length+g)%G.length;for(var O=x;O<g;++O)G[O]=T;return G}Object.defineProperty(b,"__esModule",{value:!0}),b.concat=b.fillFallback=b.fill=void 0,b.fill=function(G,T,x,g){return G.fill?G.fill(T,x,g):I(G,T,x,g)},b.fillFallback=I,b.concat=function(G,T){var x=new G.constructor(G.length+T.length);return x.set(G),x.set(T,G.length),x}},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BufferLine=b.DEFAULT_ATTR_DATA=void 0;var I=k(8),G=k(3),T=k(4),x=k(6);b.DEFAULT_ATTR_DATA=Object.freeze(new x.AttributeData);var g=function(){function O(m,n,v){v===void 0&&(v=!1),this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*m);for(var f=n||T.CellData.fromCharData([0,G.NULL_CELL_CHAR,G.NULL_CELL_WIDTH,G.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],v=2097151&n;return[this._data[3*m+1],2097152&n?this._combined[m]:v?I.stringFromCodePoint(v):"",n>>22,2097152&n?this._combined[m].charCodeAt(this._combined[m].length-1):v]},O.prototype.set=function(m,n){this._data[3*m+1]=n[G.CHAR_DATA_ATTR_INDEX],n[G.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[m]=n[1],this._data[3*m+0]=2097152|m|n[G.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*m+0]=n[G.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[G.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 v=3*m;return n.content=this._data[v+0],n.fg=this._data[v+1],n.bg=this._data[v+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,v,f,c,l){268435456&c&&(this._extendedAttrs[m]=l),this._data[3*m+0]=n|v<<22,this._data[3*m+1]=f,this._data[3*m+2]=c},O.prototype.addCodepointToCell=function(m,n){var v=this._data[3*m+0];2097152&v?this._combined[m]+=I.stringFromCodePoint(n):(2097151&v?(this._combined[m]=I.stringFromCodePoint(2097151&v)+I.stringFromCodePoint(n),v&=-2097152,v|=2097152):v=n|1<<22,this._data[3*m+0]=v)},O.prototype.insertCells=function(m,n,v,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 x.ExtendedAttrs),n<this.length-m){for(var c=new T.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,v)}else for(l=m;l<this.length;++l)this.setCell(l,v);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 x.ExtendedAttrs)},O.prototype.deleteCells=function(m,n,v,f){if(m%=this.length,n<this.length-m){for(var c=new T.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,v)}else for(l=m;l<this.length;++l)this.setCell(l,v);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 x.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 x.ExtendedAttrs)},O.prototype.replaceCells=function(m,n,v,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 x.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 x.ExtendedAttrs);m<n&&m<this.length;)this.setCell(m++,v)},O.prototype.resize=function(m,n){if(m!==this.length){if(m>this.length){var v=new Uint32Array(3*m);this.length&&(3*m<this._data.length?v.set(this._data.subarray(0,3*m)):v.set(this._data)),this._data=v;for(var f=this.length;f<m;++f)this.setCell(f,n)}else if(m){(v=new Uint32Array(3*m)).set(this._data.subarray(0,3*m)),this._data=v;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,v,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*(v+u)+p]=l[3*(n+u)+p];else for(u=0;u<f;u++)for(p=0;p<3;p++)this._data[3*(v+u)+p]=l[3*(n+u)+p];var E=Object.keys(m._combined);for(p=0;p<E.length;p++){var D=parseInt(E[p],10);D>=n&&(this._combined[D-n+v]=m._combined[D])}},O.prototype.translateToString=function(m,n,v){m===void 0&&(m=!1),n===void 0&&(n=0),v===void 0&&(v=this.length),m&&(v=Math.min(v,this.getTrimmedLength()));for(var f="";n<v;){var c=this._data[3*n+0],l=2097151&c;f+=2097152&c?this._combined[n]:l?I.stringFromCodePoint(l):G.WHITESPACE_CELL_CHAR,n+=c>>22||1}return f},O}();b.BufferLine=g},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.removeElementFromParent=void 0,b.removeElementFromParent=function(){for(var I,G=[],T=0;T<arguments.length;T++)G[T]=arguments[T];for(var x=0,g=G;x<g.length;x++){var O=g[x];(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,G=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 q in F)F.hasOwnProperty(q)&&(H[q]=F[q])})(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 T,x=k(12),g=k(20),O=k(39),m=k(2),n=k(15),v=k(8),f=k(16),c=k(0),l=k(3),u=k(4),p=k(6),E=k(22),D=k(24),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function w(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"})(T=b.WindowsOptionsReportType||(b.WindowsOptionsReportType={}));var A=function(){function U(N,H,F,q){this._bufferService=N,this._coreService=H,this._logService=F,this._optionsService=q,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=v.utf32ToString(this._data);switch(this._data=new Uint32Array(0),H){case'"q':return this._coreService.triggerDataEvent(x.C0.ESC+'P1$r0"q'+x.C0.ESC+"\\");case'"p':return this._coreService.triggerDataEvent(x.C0.ESC+'P1$r61;1"p'+x.C0.ESC+"\\");case"r":var F=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(x.C0.ESC+"P1$r"+F+x.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(x.C0.ESC+"P1$r0m"+x.C0.ESC+"\\");case" q":var q={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return q-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(x.C0.ESC+"P1$r"+q+" q"+x.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",H),this._coreService.triggerDataEvent(x.C0.ESC+"P0$r"+x.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},U}(),P=function(U){function N(H,F,q,V,ne,ce,ee,z,Z){Z===void 0&&(Z=new O.EscapeSequenceParser);var M=U.call(this)||this;M._bufferService=H,M._charsetService=F,M._coreService=q,M._dirtyRowService=V,M._logService=ne,M._optionsService=ce,M._coreMouseService=ee,M._unicodeService=z,M._parser=Z,M._parseBuffer=new Uint32Array(4096),M._stringDecoder=new v.StringToUtf32,M._utf8Decoder=new v.Utf8ToUtf32,M._workCell=new u.CellData,M._windowTitle="",M._iconName="",M._windowTitleStack=[],M._iconNameStack=[],M._curAttrData=f.DEFAULT_ATTR_DATA.clone(),M._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),M._onRequestBell=new c.EventEmitter,M._onRequestRefreshRows=new c.EventEmitter,M._onRequestReset=new c.EventEmitter,M._onRequestScroll=new c.EventEmitter,M._onRequestSyncScrollBar=new c.EventEmitter,M._onRequestWindowsOptionsReport=new c.EventEmitter,M._onA11yChar=new c.EventEmitter,M._onA11yTab=new c.EventEmitter,M._onCursorMove=new c.EventEmitter,M._onLineFeed=new c.EventEmitter,M._onScroll=new c.EventEmitter,M._onTitleChange=new c.EventEmitter,M.register(M._parser),M._parser.setCsiHandlerFallback(function(C,Y){M._logService.debug("Unknown CSI code: ",{identifier:M._parser.identToString(C),params:Y.toArray()})}),M._parser.setEscHandlerFallback(function(C){M._logService.debug("Unknown ESC code: ",{identifier:M._parser.identToString(C)})}),M._parser.setExecuteHandlerFallback(function(C){M._logService.debug("Unknown EXECUTE code: ",{code:C})}),M._parser.setOscHandlerFallback(function(C,Y,ie){M._logService.debug("Unknown OSC code: ",{identifier:C,action:Y,data:ie})}),M._parser.setDcsHandlerFallback(function(C,Y,ie){Y==="HOOK"&&(ie=ie.toArray()),M._logService.debug("Unknown DCS code: ",{identifier:M._parser.identToString(C),action:Y,payload:ie})}),M._parser.setPrintHandler(function(C,Y,ie){return M.print(C,Y,ie)}),M._parser.setCsiHandler({final:"@"},function(C){return M.insertChars(C)}),M._parser.setCsiHandler({intermediates:" ",final:"@"},function(C){return M.scrollLeft(C)}),M._parser.setCsiHandler({final:"A"},function(C){return M.cursorUp(C)}),M._parser.setCsiHandler({intermediates:" ",final:"A"},function(C){return M.scrollRight(C)}),M._parser.setCsiHandler({final:"B"},function(C){return M.cursorDown(C)}),M._parser.setCsiHandler({final:"C"},function(C){return M.cursorForward(C)}),M._parser.setCsiHandler({final:"D"},function(C){return M.cursorBackward(C)}),M._parser.setCsiHandler({final:"E"},function(C){return M.cursorNextLine(C)}),M._parser.setCsiHandler({final:"F"},function(C){return M.cursorPrecedingLine(C)}),M._parser.setCsiHandler({final:"G"},function(C){return M.cursorCharAbsolute(C)}),M._parser.setCsiHandler({final:"H"},function(C){return M.cursorPosition(C)}),M._parser.setCsiHandler({final:"I"},function(C){return M.cursorForwardTab(C)}),M._parser.setCsiHandler({final:"J"},function(C){return M.eraseInDisplay(C)}),M._parser.setCsiHandler({prefix:"?",final:"J"},function(C){return M.eraseInDisplay(C)}),M._parser.setCsiHandler({final:"K"},function(C){return M.eraseInLine(C)}),M._parser.setCsiHandler({prefix:"?",final:"K"},function(C){return M.eraseInLine(C)}),M._parser.setCsiHandler({final:"L"},function(C){return M.insertLines(C)}),M._parser.setCsiHandler({final:"M"},function(C){return M.deleteLines(C)}),M._parser.setCsiHandler({final:"P"},function(C){return M.deleteChars(C)}),M._parser.setCsiHandler({final:"S"},function(C){return M.scrollUp(C)}),M._parser.setCsiHandler({final:"T"},function(C){return M.scrollDown(C)}),M._parser.setCsiHandler({final:"X"},function(C){return M.eraseChars(C)}),M._parser.setCsiHandler({final:"Z"},function(C){return M.cursorBackwardTab(C)}),M._parser.setCsiHandler({final:"`"},function(C){return M.charPosAbsolute(C)}),M._parser.setCsiHandler({final:"a"},function(C){return M.hPositionRelative(C)}),M._parser.setCsiHandler({final:"b"},function(C){return M.repeatPrecedingCharacter(C)}),M._parser.setCsiHandler({final:"c"},function(C){return M.sendDeviceAttributesPrimary(C)}),M._parser.setCsiHandler({prefix:">",final:"c"},function(C){return M.sendDeviceAttributesSecondary(C)}),M._parser.setCsiHandler({final:"d"},function(C){return M.linePosAbsolute(C)}),M._parser.setCsiHandler({final:"e"},function(C){return M.vPositionRelative(C)}),M._parser.setCsiHandler({final:"f"},function(C){return M.hVPosition(C)}),M._parser.setCsiHandler({final:"g"},function(C){return M.tabClear(C)}),M._parser.setCsiHandler({final:"h"},function(C){return M.setMode(C)}),M._parser.setCsiHandler({prefix:"?",final:"h"},function(C){return M.setModePrivate(C)}),M._parser.setCsiHandler({final:"l"},function(C){return M.resetMode(C)}),M._parser.setCsiHandler({prefix:"?",final:"l"},function(C){return M.resetModePrivate(C)}),M._parser.setCsiHandler({final:"m"},function(C){return M.charAttributes(C)}),M._parser.setCsiHandler({final:"n"},function(C){return M.deviceStatus(C)}),M._parser.setCsiHandler({prefix:"?",final:"n"},function(C){return M.deviceStatusPrivate(C)}),M._parser.setCsiHandler({intermediates:"!",final:"p"},function(C){return M.softReset(C)}),M._parser.setCsiHandler({intermediates:" ",final:"q"},function(C){return M.setCursorStyle(C)}),M._parser.setCsiHandler({final:"r"},function(C){return M.setScrollRegion(C)}),M._parser.setCsiHandler({final:"s"},function(C){return M.saveCursor(C)}),M._parser.setCsiHandler({final:"t"},function(C){return M.windowOptions(C)}),M._parser.setCsiHandler({final:"u"},function(C){return M.restoreCursor(C)}),M._parser.setCsiHandler({intermediates:"'",final:"}"},function(C){return M.insertColumns(C)}),M._parser.setCsiHandler({intermediates:"'",final:"~"},function(C){return M.deleteColumns(C)}),M._parser.setExecuteHandler(x.C0.BEL,function(){return M.bell()}),M._parser.setExecuteHandler(x.C0.LF,function(){return M.lineFeed()}),M._parser.setExecuteHandler(x.C0.VT,function(){return M.lineFeed()}),M._parser.setExecuteHandler(x.C0.FF,function(){return M.lineFeed()}),M._parser.setExecuteHandler(x.C0.CR,function(){return M.carriageReturn()}),M._parser.setExecuteHandler(x.C0.BS,function(){return M.backspace()}),M._parser.setExecuteHandler(x.C0.HT,function(){return M.tab()}),M._parser.setExecuteHandler(x.C0.SO,function(){return M.shiftOut()}),M._parser.setExecuteHandler(x.C0.SI,function(){return M.shiftIn()}),M._parser.setExecuteHandler(x.C1.IND,function(){return M.index()}),M._parser.setExecuteHandler(x.C1.NEL,function(){return M.nextLine()}),M._parser.setExecuteHandler(x.C1.HTS,function(){return M.tabSet()}),M._parser.setOscHandler(0,new E.OscHandler(function(C){M.setTitle(C),M.setIconName(C)})),M._parser.setOscHandler(1,new E.OscHandler(function(C){return M.setIconName(C)})),M._parser.setOscHandler(2,new E.OscHandler(function(C){return M.setTitle(C)})),M._parser.setEscHandler({final:"7"},function(){return M.saveCursor()}),M._parser.setEscHandler({final:"8"},function(){return M.restoreCursor()}),M._parser.setEscHandler({final:"D"},function(){return M.index()}),M._parser.setEscHandler({final:"E"},function(){return M.nextLine()}),M._parser.setEscHandler({final:"H"},function(){return M.tabSet()}),M._parser.setEscHandler({final:"M"},function(){return M.reverseIndex()}),M._parser.setEscHandler({final:"="},function(){return M.keypadApplicationMode()}),M._parser.setEscHandler({final:">"},function(){return M.keypadNumericMode()}),M._parser.setEscHandler({final:"c"},function(){return M.fullReset()}),M._parser.setEscHandler({final:"n"},function(){return M.setgLevel(2)}),M._parser.setEscHandler({final:"o"},function(){return M.setgLevel(3)}),M._parser.setEscHandler({final:"|"},function(){return M.setgLevel(3)}),M._parser.setEscHandler({final:"}"},function(){return M.setgLevel(2)}),M._parser.setEscHandler({final:"~"},function(){return M.setgLevel(1)}),M._parser.setEscHandler({intermediates:"%",final:"@"},function(){return M.selectDefaultCharset()}),M._parser.setEscHandler({intermediates:"%",final:"G"},function(){return M.selectDefaultCharset()});var K=function(C){j._parser.setEscHandler({intermediates:"(",final:C},function(){return M.selectCharset("("+C)}),j._parser.setEscHandler({intermediates:")",final:C},function(){return M.selectCharset(")"+C)}),j._parser.setEscHandler({intermediates:"*",final:C},function(){return M.selectCharset("*"+C)}),j._parser.setEscHandler({intermediates:"+",final:C},function(){return M.selectCharset("+"+C)}),j._parser.setEscHandler({intermediates:"-",final:C},function(){return M.selectCharset("-"+C)}),j._parser.setEscHandler({intermediates:".",final:C},function(){return M.selectCharset("."+C)}),j._parser.setEscHandler({intermediates:"/",final:C},function(){return M.selectCharset("/"+C)})},j=this;for(var R in g.CHARSETS)K(R);return M._parser.setEscHandler({intermediates:"#",final:"8"},function(){return M.screenAlignmentPattern()}),M._parser.setErrorHandler(function(C){return M._logService.error("Parsing error: ",C),C}),M._parser.setDcsHandler({intermediates:"$",final:"q"},new A(M._bufferService,M._coreService,M._logService,M._optionsService)),M}return G(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,q=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 ce=ne+131072<H.length?ne+131072:H.length,ee=typeof H=="string"?this._stringDecoder.decode(H.substring(ne,ce),this._parseBuffer):this._utf8Decoder.decode(H.subarray(ne,ce),this._parseBuffer);this._parser.parse(this._parseBuffer,ee)}else ee=typeof H=="string"?this._stringDecoder.decode(H,this._parseBuffer):this._utf8Decoder.decode(H,this._parseBuffer),this._parser.parse(this._parseBuffer,ee);(F=this._bufferService.buffer).x===q&&F.y===V||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},N.prototype.print=function(H,F,q){var V,ne,ce=this._bufferService.buffer,ee=this._charsetService.charset,z=this._optionsService.options.screenReaderMode,Z=this._bufferService.cols,M=this._coreService.decPrivateModes.wraparound,K=this._coreService.modes.insertMode,j=this._curAttrData,R=ce.lines.get(ce.ybase+ce.y);this._dirtyRowService.markDirty(ce.y),ce.x&&q-F>0&&R.getWidth(ce.x-1)===2&&R.setCellFromCodePoint(ce.x-1,0,1,j.fg,j.bg,j.extended);for(var C=F;C<q;++C){if(V=H[C],ne=this._unicodeService.wcwidth(V),V<127&&ee){var Y=ee[String.fromCharCode(V)];Y&&(V=Y.charCodeAt(0))}if(z&&this._onA11yChar.fire(v.stringFromCodePoint(V)),ne||!ce.x){if(ce.x+ne-1>=Z){if(M){for(;ce.x<Z;)R.setCellFromCodePoint(ce.x++,0,1,j.fg,j.bg,j.extended);ce.x=0,ce.y++,ce.y===ce.scrollBottom+1?(ce.y--,this._onRequestScroll.fire(this._eraseAttrData(),!0)):(ce.y>=this._bufferService.rows&&(ce.y=this._bufferService.rows-1),ce.lines.get(ce.ybase+ce.y).isWrapped=!0),R=ce.lines.get(ce.ybase+ce.y)}else if(ce.x=Z-1,ne===2)continue}if(K&&(R.insertCells(ce.x,ne,ce.getNullCell(j),j),R.getWidth(Z-1)===2&&R.setCellFromCodePoint(Z-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,j.fg,j.bg,j.extended)),R.setCellFromCodePoint(ce.x++,V,ne,j.fg,j.bg,j.extended),ne>0)for(;--ne;)R.setCellFromCodePoint(ce.x++,0,0,j.fg,j.bg,j.extended)}else R.getWidth(ce.x-1)?R.addCodepointToCell(ce.x-1,V):R.addCodepointToCell(ce.x-2,V)}q-F>0&&(R.loadCell(ce.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),ce.x<Z&&q-F>0&&R.getWidth(ce.x)===0&&!R.hasContent(ce.x)&&R.setCellFromCodePoint(ce.x,0,1,j.fg,j.bg,j.extended),this._dirtyRowService.markDirty(ce.y)},N.prototype.addCsiHandler=function(H,F){var q=this;return H.final!=="t"||H.prefix||H.intermediates?this._parser.addCsiHandler(H,F):this._parser.addCsiHandler(H,function(V){return!w(V.params[0],q._optionsService.options.windowOptions)||F(V)})},N.prototype.addDcsHandler=function(H,F){return this._parser.addDcsHandler(H,new D.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 q=F.lines.get(F.ybase+F.y);q.hasWidth(F.x)&&!q.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,q=this._bufferService.buffer;F--;)q.x=q.prevStop()},N.prototype._eraseInBufferLine=function(H,F,q,V){V===void 0&&(V=!1);var ne=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+H);ne.replaceCells(F,q,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 q=this._bufferService.buffer.lines.length-this._bufferService.rows;q>0&&(this._bufferService.buffer.lines.trimStart(q),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-q,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-q,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,q=this._bufferService.buffer;if(!(q.y>q.scrollBottom||q.y<q.scrollTop)){for(var V=q.ybase+q.y,ne=this._bufferService.rows-1-q.scrollBottom,ce=this._bufferService.rows-1+q.ybase-ne+1;F--;)q.lines.splice(ce-1,1),q.lines.splice(V,0,q.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(q.y,q.scrollBottom),q.x=0}},N.prototype.deleteLines=function(H){this._restrictCursor();var F=H.params[0]||1,q=this._bufferService.buffer;if(!(q.y>q.scrollBottom||q.y<q.scrollTop)){var V,ne=q.ybase+q.y;for(V=this._bufferService.rows-1-q.scrollBottom,V=this._bufferService.rows-1+q.ybase-V;F--;)q.lines.splice(ne,1),q.lines.splice(V,0,q.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(q.y,q.scrollBottom),q.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,q=this._bufferService.buffer;F--;)q.lines.splice(q.ybase+q.scrollTop,1),q.lines.splice(q.ybase+q.scrollBottom,0,q.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(q.scrollTop,q.scrollBottom)},N.prototype.scrollDown=function(H){for(var F=H.params[0]||1,q=this._bufferService.buffer;F--;)q.lines.splice(q.ybase+q.scrollBottom,1),q.lines.splice(q.ybase+q.scrollTop,0,q.getBlankLine(f.DEFAULT_ATTR_DATA));this._dirtyRowService.markRangeDirty(q.scrollTop,q.scrollBottom)},N.prototype.scrollLeft=function(H){var F=this._bufferService.buffer;if(!(F.y>F.scrollBottom||F.y<F.scrollTop)){for(var q=H.params[0]||1,V=F.scrollTop;V<=F.scrollBottom;++V){var ne=F.lines.get(F.ybase+V);ne.deleteCells(0,q,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 q=H.params[0]||1,V=F.scrollTop;V<=F.scrollBottom;++V){var ne=F.lines.get(F.ybase+V);ne.insertCells(0,q,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 q=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,q,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 q=H.params[0]||1,V=F.scrollTop;V<=F.scrollBottom;++V){var ne=F.lines.get(F.ybase+V);ne.deleteCells(F.x,q,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,q=new Uint32Array(F),V=0;V<F;++V)q[V]=this._parser.precedingCodepoint;this.print(q,0,q.length)}},N.prototype.sendDeviceAttributesPrimary=function(H){H.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(x.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(x.C0.ESC+"[?6c"))},N.prototype.sendDeviceAttributesSecondary=function(H){H.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(x.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(x.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(H.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(x.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,g.DEFAULT_CHARSET),this._charsetService.setgCharset(1,g.DEFAULT_CHARSET),this._charsetService.setgCharset(2,g.DEFAULT_CHARSET),this._charsetService.setgCharset(3,g.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,q,V,ne){return F===2?(H|=50331648,H&=-16777216,H|=p.AttributeData.fromColorRGB([q,V,ne])):F===5&&(H&=-50331904,H|=33554432|255&q),H},N.prototype._extractColor=function(H,F,q){var V=[0,0,-1,0,0,0],ne=0,ce=0;do{if(V[ce+ne]=H.params[F+ce],H.hasSubParams(F+ce)){var ee=H.getSubParams(F+ce),z=0;do V[1]===5&&(ne=1),V[ce+z+1+ne]=ee[z];while(++z<ee.length&&z+ce+1+ne<V.length);break}if(V[1]===5&&ce+ne>=2||V[1]===2&&ce+ne>=5)break;V[1]&&(ne=1)}while(++ce+F<H.length&&ce+ne<V.length);for(z=2;z<V.length;++z)V[z]===-1&&(V[z]=0);switch(V[0]){case 38:q.fg=this._updateAttrColor(q.fg,V[1],V[3],V[4],V[5]);break;case 48:q.bg=this._updateAttrColor(q.bg,V[1],V[3],V[4],V[5]);break;case 58:q.extended=q.extended.clone(),q.extended.underlineColor=this._updateAttrColor(q.extended.underlineColor,V[1],V[3],V[4],V[5])}return ce},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,q=H.length,V=this._curAttrData,ne=0;ne<q;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(x.C0.ESC+"[0n");break;case 6:var F=this._bufferService.buffer.y+1,q=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(x.C0.ESC+"["+F+";"+q+"R")}},N.prototype.deviceStatusPrivate=function(H){switch(H.params[0]){case 6:var F=this._bufferService.buffer.y+1,q=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(x.C0.ESC+"[?"+F+";"+q+"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 q=F%2==1;this._optionsService.options.cursorBlink=q},N.prototype.setScrollRegion=function(H){var F,q=H.params[0]||1;(H.length<2||(F=H.params[1])>this._bufferService.rows||F===0)&&(F=this._bufferService.rows),F>q&&(this._bufferService.buffer.scrollTop=q-1,this._bufferService.buffer.scrollBottom=F-1,this._setCursor(0,0))},N.prototype.windowOptions=function(H){if(w(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(T.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(T.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(x.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,g.DEFAULT_CHARSET)},N.prototype.selectCharset=function(H){H.length===2?H[0]!=="/"&&this._charsetService.setgCharset(L[H[0]],g.CHARSETS[H[1]]||g.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 q=0;q<this._bufferService.rows;++q){var V=F.ybase+F.y+q,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 G(T,x){if(T===void 0&&(T=32),x===void 0&&(x=32),this.maxLength=T,this.maxSubParamsLength=x,x>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(T),this.length=0,this._subParams=new Int32Array(x),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(T),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return G.fromArray=function(T){var x=new G;if(!T.length)return x;for(var g=T[0]instanceof Array?1:0;g<T.length;++g){var O=T[g];if(O instanceof Array)for(var m=0;m<O.length;++m)x.addSubParam(O[m]);else x.addParam(O)}return x},G.prototype.clone=function(){var T=new G(this.maxLength,this.maxSubParamsLength);return T.params.set(this.params),T.length=this.length,T._subParams.set(this._subParams),T._subParamsLength=this._subParamsLength,T._subParamsIdx.set(this._subParamsIdx),T._rejectDigits=this._rejectDigits,T._rejectSubDigits=this._rejectSubDigits,T._digitIsSub=this._digitIsSub,T},G.prototype.toArray=function(){for(var T=[],x=0;x<this.length;++x){T.push(this.params[x]);var g=this._subParamsIdx[x]>>8,O=255&this._subParamsIdx[x];O-g>0&&T.push(Array.prototype.slice.call(this._subParams,g,O))}return T},G.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},G.prototype.addParam=function(T){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(T<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=T>2147483647?2147483647:T}},G.prototype.addSubParam=function(T){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(T<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=T>2147483647?2147483647:T,this._subParamsIdx[this.length-1]++}},G.prototype.hasSubParams=function(T){return(255&this._subParamsIdx[T])-(this._subParamsIdx[T]>>8)>0},G.prototype.getSubParams=function(T){var x=this._subParamsIdx[T]>>8,g=255&this._subParamsIdx[T];return g-x>0?this._subParams.subarray(x,g):null},G.prototype.getSubParamsAll=function(){for(var T={},x=0;x<this.length;++x){var g=this._subParamsIdx[x]>>8,O=255&this._subParamsIdx[x];O-g>0&&(T[x]=this._subParams.slice(g,O))}return T},G.prototype.addDigit=function(T){var x;if(!(this._rejectDigits||!(x=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var g=this._digitIsSub?this._subParams:this.params,O=g[x-1];g[x-1]=~O?Math.min(10*O+T,2147483647):T}},G}();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),G=k(8),T=function(){function g(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return g.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 v=n.indexOf(m);v!==-1&&n.splice(v,1)}}},g.prototype.setHandler=function(O,m){this._handlers[O]=[m]},g.prototype.clearHandler=function(O){this._handlers[O]&&delete this._handlers[O]},g.prototype.setHandlerFallback=function(O){this._handlerFb=O},g.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},g.prototype.reset=function(){this._state===2&&this.end(!1),this._id=-1,this._state=0},g.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")},g.prototype._put=function(O,m,n){var v=this._handlers[this._id];if(v)for(var f=v.length-1;f>=0;f--)v[f].put(O,m,n);else this._handlerFb(this._id,"PUT",G.utf32ToString(O,m,n))},g.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)},g.prototype.start=function(){this.reset(),this._id=-1,this._state=1},g.prototype.put=function(O,m,n){if(this._state!==3){if(this._state===1)for(;m<n;){var v=O[m++];if(v===59){this._state=2,this._start();break}if(v<48||57<v)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+v-48}this._state===2&&n-m>0&&this._put(O,m,n)}},g.prototype.end=function(O){this._state!==0&&(this._state!==3&&(this._state===1&&this._start(),this._end(O)),this._id=-1,this._state=0)},g}();b.OscParser=T;var x=function(){function g(O){this._handler=O,this._data="",this._hitLimit=!1}return g.prototype.start=function(){this._data="",this._hitLimit=!1},g.prototype.put=function(O,m,n){this._hitLimit||(this._data+=G.utf32ToString(O,m,n),this._data.length>I.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},g.prototype.end=function(O){var m;return this._hitLimit?m=!1:O&&(m=this._handler(this._data)),this._data="",this._hitLimit=!1,m},g}();b.OscHandler=x},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),G=k(21),T=k(23),x=[],g=function(){function m(){this._handlers=Object.create(null),this._active=x,this._ident=0,this._handlerFb=function(){}}return m.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},m.prototype.addHandler=function(n,v){this._handlers[n]===void 0&&(this._handlers[n]=[]);var f=this._handlers[n];return f.push(v),{dispose:function(){var c=f.indexOf(v);c!==-1&&f.splice(c,1)}}},m.prototype.setHandler=function(n,v){this._handlers[n]=[v]},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=x,this._ident=0},m.prototype.hook=function(n,v){if(this.reset(),this._ident=n,this._active=this._handlers[n]||x,this._active.length)for(var f=this._active.length-1;f>=0;f--)this._active[f].hook(v);else this._handlerFb(this._ident,"HOOK",v)},m.prototype.put=function(n,v,f){if(this._active.length)for(var c=this._active.length-1;c>=0;c--)this._active[c].put(n,v,f);else this._handlerFb(this._ident,"PUT",I.utf32ToString(n,v,f))},m.prototype.unhook=function(n){if(this._active.length){for(var v=this._active.length-1;v>=0&&this._active[v].unhook(n)===!1;v--);for(v--;v>=0;v--)this._active[v].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",n);this._active=x,this._ident=0},m}();b.DcsParser=g;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,v,f){this._hitLimit||(this._data+=I.utf32ToString(n,v,f),this._data.length>T.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},m.prototype.unhook=function(n){var v;return this._hitLimit?v=!1:n&&(v=this._handler(this._data,this._params||new G.Params)),this._params=void 0,this._data="",this._hitLimit=!1,v},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),G=k(43),T=[];b.acquireCharAtlas=function(x,g,O,m,n){for(var v=I.generateConfig(m,n,x,O),f=0;f<T.length;f++){var c=(l=T[f]).ownedBy.indexOf(g);if(c>=0){if(I.configEquals(l.config,v))return l.atlas;l.ownedBy.length===1?(l.atlas.dispose(),T.splice(f,1)):l.ownedBy.splice(c,1);break}}for(f=0;f<T.length;f++){var l=T[f];if(I.configEquals(l.config,v))return l.ownedBy.push(g),l.atlas}var u={atlas:new G.DynamicCharAtlas(document,v),config:v,ownedBy:[g]};return T.push(u),u.atlas},b.removeTerminalFromCache=function(x){for(var g=0;g<T.length;g++){var O=T[g].ownedBy.indexOf(x);if(O!==-1){T[g].ownedBy.length===1?(T[g].atlas.dispose(),T.splice(g,1)):T[g].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(G,T,x,g){var O={foreground:g.foreground,background:g.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:g.ansi.slice(0,16)};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:G,scaledCharHeight:T,fontFamily:x.fontFamily,fontSize:x.fontSize,fontWeight:x.fontWeight,fontWeightBold:x.fontWeightBold,allowTransparency:x.allowTransparency,colors:O}},b.configEquals=function(G,T){for(var x=0;x<G.colors.ansi.length;x++)if(G.colors.ansi[x].rgba!==T.colors.ansi[x].rgba)return!1;return G.devicePixelRatio===T.devicePixelRatio&&G.fontFamily===T.fontFamily&&G.fontSize===T.fontSize&&G.fontWeight===T.fontWeight&&G.fontWeightBold===T.fontWeightBold&&G.allowTransparency===T.allowTransparency&&G.scaledCharWidth===T.scaledCharWidth&&G.scaledCharHeight===T.scaledCharHeight&&G.colors.foreground===T.colors.foreground&&G.colors.background===T.colors.background},b.is256Color=function(G){return G<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),G=k(45),T=I.css.toColor("#ffffff"),x=I.css.toColor("#000000"),g=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 v=[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];v.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;v.push({css:I.channels.toCss(E,E,E),rgba:I.channels.toRgba(E,E,E)})}return v}();var n=function(){function v(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 G.ColorContrastCache,this.colors={foreground:T,background:x,cursor:g,cursorAccent:O,selectionTransparent:m,selectionOpaque:I.color.blend(x,m),ansi:b.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return v.prototype.onOptionsChange=function(f){f==="minimumContrastRatio"&&this._contrastCache.clear()},v.prototype.setTheme=function(f){f===void 0&&(f={}),this.colors.foreground=this._parseColor(f.foreground,T),this.colors.background=this._parseColor(f.background,x),this.colors.cursor=this._parseColor(f.cursor,g,!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()},v.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],D=p[1],L=p[2],w=p[3],A=Math.round(255*w);return{rgba:I.channels.toRgba(E,D,L,A),css:f}}return{css:this._ctx.fillStyle,rgba:I.channels.toRgba(u[0],u[1],u[2],u[3])}},v}();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,G=this&&this.__extends||(I=function(n,v){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,v)},function(n,v){function f(){this.constructor=n}I(n,v),n.prototype=v===null?Object.create(v):(f.prototype=v.prototype,new f)});Object.defineProperty(b,"__esModule",{value:!0}),b.CharacterJoinerRegistry=b.JoinedCellData=void 0;var T=k(6),x=k(3),g=k(4),O=function(n){function v(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 G(v,n),v.prototype.isCombined=function(){return 2097152},v.prototype.getWidth=function(){return this._width},v.prototype.getChars=function(){return this.combinedData},v.prototype.getCode=function(){return 2097151},v.prototype.setFromCharData=function(f){throw new Error("not implemented")},v.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},v}(T.AttributeData);b.JoinedCellData=O;var m=function(){function n(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}return n.prototype.registerCharacterJoiner=function(v){var f={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(f),f.id},n.prototype.deregisterCharacterJoiner=function(v){for(var f=0;f<this._characterJoiners.length;f++)if(this._characterJoiners[f].id===v)return this._characterJoiners.splice(f,1),!0;return!1},n.prototype.getJoinedCharacters=function(v){if(this._characterJoiners.length===0)return[];var f=this._bufferService.buffer.lines.get(v);if(!f||f.length===0)return[];for(var c=[],l=f.translateToString(!0),u=0,p=0,E=0,D=f.getFg(0),L=f.getBg(0),w=0;w<f.getTrimmedLength();w++)if(f.loadCell(w,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==D||this._workCell.bg!==L){if(w-u>1)for(var A=this._getJoinedRanges(l,E,p,f,u),P=0;P<A.length;P++)c.push(A[P]);u=w,E=p,D=this._workCell.fg,L=this._workCell.bg}p+=this._workCell.getChars().length||x.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(v,f,c,l,u){for(var p=v.substring(f,c),E=this._characterJoiners[0].handler(p),D=1;D<this._characterJoiners.length;D++)for(var L=this._characterJoiners[D].handler(p),w=0;w<L.length;w++)n._mergeRanges(E,L[w]);return this._stringRangesToCellRanges(E,l,u),E},n.prototype._stringRangesToCellRanges=function(v,f,c){var l=0,u=!1,p=0,E=v[l];if(E){for(var D=c;D<this._bufferService.cols;D++){var L=f.getWidth(D),w=f.getString(D).length||x.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!u&&E[0]<=p&&(E[0]=D,u=!0),E[1]<=p){if(E[1]=D,!(E=v[++l]))break;E[0]<=p?(E[0]=D,u=!0):u=!1}p+=w}}E&&(E[1]=this._bufferService.cols)}},n._mergeRanges=function(v,f){for(var c=!1,l=0;l<v.length;l++){var u=v[l];if(c){if(f[1]<=u[0])return v[l-1][1]=f[1],v;if(f[1]<=u[1])return v[l-1][1]=Math.max(f[1],u[1]),v.splice(l,1),v;v.splice(l,1),l--}else{if(f[1]<=u[0])return v.splice(l,0,f),v;if(f[1]<=u[1])return u[0]=Math.min(f[0],u[0]),v;f[0]<u[1]&&(u[0]=Math.min(f[0],u[0]),c=!0)}}return c?v[v.length-1][1]=f[1]:v.push(f),v},n}();b.CharacterJoinerRegistry=m},function(me,b,k){"use strict";function I(G,T){var x=T.getBoundingClientRect();return[G.clientX-x.left,G.clientY-x.top]}Object.defineProperty(b,"__esModule",{value:!0}),b.getRawByteCoords=b.getCoords=b.getCoordsRelativeToElement=void 0,b.getCoordsRelativeToElement=I,b.getCoords=function(G,T,x,g,O,m,n,v){if(O){var f=I(G,T);if(f)return f[0]=Math.ceil((f[0]+(v?m/2:0))/m),f[1]=Math.ceil(f[1]/n),f[0]=Math.min(Math.max(f[0],1),x+(v?1:0)),f[1]=Math.min(Math.max(f[1],1),g),f}},b.getRawByteCoords=function(G){if(G)return{x:G[0]+32,y:G[1]+32}}},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.RenderDebouncer=void 0;var I=function(){function G(T){this._renderCallback=T}return G.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},G.prototype.refresh=function(T,x,g){var O=this;this._rowCount=g,T=T!==void 0?T:0,x=x!==void 0?x:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,T):T,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,x):x,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){return O._innerRefresh()}))},G.prototype._innerRefresh=function(){if(this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0){var T=Math.max(this._rowStart,0),x=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(T,x)}},G}();b.RenderDebouncer=I},function(me,b,k){"use strict";var I,G=this&&this.__extends||(I=function(x,g){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])})(x,g)},function(x,g){function O(){this.constructor=x}I(x,g),x.prototype=g===null?Object.create(g):(O.prototype=g.prototype,new O)});Object.defineProperty(b,"__esModule",{value:!0}),b.ScreenDprMonitor=void 0;var T=function(x){function g(){var O=x!==null&&x.apply(this,arguments)||this;return O._currentDevicePixelRatio=window.devicePixelRatio,O}return G(g,x),g.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()},g.prototype.dispose=function(){x.prototype.dispose.call(this),this.clearListener()},g.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))},g.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)},g}(k(2).Disposable);b.ScreenDprMonitor=T},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.clone=void 0,b.clone=function I(G,T){if(T===void 0&&(T=5),typeof G!="object")return G;var x=Array.isArray(G)?[]:{};for(var g in G)x[g]=T<=1?G[g]:G[g]?I(G[g],T-1):G[g];return x}},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;var I=k(4),G=k(35),T=k(18),x=k(0),g=k(83),O=function(){function l(u){this._core=new G.Terminal(u),this._addonManager=new g.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 T},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,D=u;E<D.length;E++){var L=D[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 v(p)},l.prototype.getNullCell=function(){return new I.CellData},l}(),n=function(){function l(u){var p=this;this._buffers=u,this._onBufferChange=new x.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}(),v=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,D){return p(E,D.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,G=this&&this.__extends||(I=function(Z,M){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(K,j){K.__proto__=j}||function(K,j){for(var R in j)j.hasOwnProperty(R)&&(K[R]=j[R])})(Z,M)},function(Z,M){function K(){this.constructor=Z}I(Z,M),Z.prototype=M===null?Object.create(M):(K.prototype=M.prototype,new K)});Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;var T=k(36),x=k(37),g=k(38),O=k(12),m=k(19),n=k(40),v=k(50),f=k(51),c=k(11),l=k(7),u=k(18),p=k(54),E=k(55),D=k(56),L=k(57),w=k(59),A=k(0),P=k(16),U=k(27),N=k(60),H=k(5),F=k(61),q=k(62),V=k(63),ne=k(64),ce=k(65),ee=typeof window!="undefined"?window.document:null,z=function(Z){function M(K){K===void 0&&(K={});var j=Z.call(this,K)||this;return j.browser=c,j._keyDownHandled=!1,j._onCursorMove=new A.EventEmitter,j._onKey=new A.EventEmitter,j._onRender=new A.EventEmitter,j._onSelectionChange=new A.EventEmitter,j._onTitleChange=new A.EventEmitter,j._onFocus=new A.EventEmitter,j._onBlur=new A.EventEmitter,j._onA11yCharEmitter=new A.EventEmitter,j._onA11yTabEmitter=new A.EventEmitter,j._setup(),j.linkifier=j._instantiationService.createInstance(v.Linkifier),j.linkifier2=j.register(j._instantiationService.createInstance(V.Linkifier2)),j.register(j._inputHandler.onRequestBell(function(){return j.bell()})),j.register(j._inputHandler.onRequestRefreshRows(function(R,C){return j.refresh(R,C)})),j.register(j._inputHandler.onRequestReset(function(){return j.reset()})),j.register(j._inputHandler.onRequestScroll(function(R,C){return j.scroll(R,C||void 0)})),j.register(j._inputHandler.onRequestWindowsOptionsReport(function(R){return j._reportWindowsOptions(R)})),j.register(A.forwardEvent(j._inputHandler.onCursorMove,j._onCursorMove)),j.register(A.forwardEvent(j._inputHandler.onTitleChange,j._onTitleChange)),j.register(A.forwardEvent(j._inputHandler.onA11yChar,j._onA11yCharEmitter)),j.register(A.forwardEvent(j._inputHandler.onA11yTab,j._onA11yTabEmitter)),j.register(j._bufferService.onResize(function(R){return j._afterResize(R.cols,R.rows)})),j}return G(M,Z),Object.defineProperty(M.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),M.prototype.dispose=function(){var K,j,R;this._isDisposed||(Z.prototype.dispose.call(this),(K=this._renderService)===null||K===void 0||K.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},(R=(j=this.element)===null||j===void 0?void 0:j.parentNode)===null||R===void 0||R.removeChild(this.element))},M.prototype._setup=function(){Z.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(M.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),M.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},M.prototype._updateOptions=function(K){var j,R,C,Y;switch(Z.prototype._updateOptions.call(this,K),K){case"fontFamily":case"fontSize":(j=this._renderService)===null||j===void 0||j.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 D.AccessibilityManager(this,this._renderService)):((Y=this._accessibilityManager)===null||Y===void 0||Y.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},M.prototype._onTextAreaFocus=function(K){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(O.C0.ESC+"[I"),this.updateCursorStyle(K),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},M.prototype.blur=function(){var K;return(K=this.textarea)===null||K===void 0?void 0:K.blur()},M.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()},M.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var K=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),j=this._bufferService.buffer.y*K,R=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=R+"px",this.textarea.style.top=j+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=K+"px",this.textarea.style.lineHeight=K+"px",this.textarea.style.zIndex="-5"}},M.prototype._initGlobal=function(){var K=this;this._bindKeys(),this.register(l.addDisposableDomListener(this.element,"copy",function(R){K.hasSelection()&&g.copyHandler(R,K._selectionService)}));var j=function(R){return g.handlePasteEvent(R,K.textarea,K._coreService)};this.register(l.addDisposableDomListener(this.textarea,"paste",j)),this.register(l.addDisposableDomListener(this.element,"paste",j)),c.isFirefox?this.register(l.addDisposableDomListener(this.element,"mousedown",function(R){R.button===2&&g.rightClickHandler(R,K.textarea,K.screenElement,K._selectionService,K.options.rightClickSelectsWord)})):this.register(l.addDisposableDomListener(this.element,"contextmenu",function(R){g.rightClickHandler(R,K.textarea,K.screenElement,K._selectionService,K.options.rightClickSelectsWord)})),c.isLinux&&this.register(l.addDisposableDomListener(this.element,"auxclick",function(R){R.button===1&&g.moveTextAreaUnderMouseCursor(R,K.textarea,K.screenElement)}))},M.prototype._bindKeys=function(){var K=this;this.register(l.addDisposableDomListener(this.textarea,"keyup",function(j){return K._keyUp(j)},!0)),this.register(l.addDisposableDomListener(this.textarea,"keydown",function(j){return K._keyDown(j)},!0)),this.register(l.addDisposableDomListener(this.textarea,"keypress",function(j){return K._keyPress(j)},!0)),this.register(l.addDisposableDomListener(this.textarea,"compositionstart",function(){return K._compositionHelper.compositionstart()})),this.register(l.addDisposableDomListener(this.textarea,"compositionupdate",function(j){return K._compositionHelper.compositionupdate(j)})),this.register(l.addDisposableDomListener(this.textarea,"compositionend",function(){return K._compositionHelper.compositionend()})),this.register(this.onRender(function(){return K._compositionHelper.updateCompositionElements()})),this.register(this.onRender(function(j){return K._queueLinkification(j.start,j.end)}))},M.prototype.open=function(K){var j=this;if(!K)throw new Error("Terminal requires a parent element.");ee.body.contains(K)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=K.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"),K.appendChild(this.element);var R=ee.createDocumentFragment();this._viewportElement=ee.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),R.appendChild(this._viewportElement),this._viewportScrollArea=ee.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=ee.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=ee.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),R.appendChild(this.screenElement),this.textarea=ee.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(ie){return j._onTextAreaFocus(ie)})),this.register(l.addDisposableDomListener(this.textarea,"blur",function(){return j._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=ee.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(T.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(ee,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(function(ie){return j._colorManager.onOptionsChange(ie)})),this._colorManager.setTheme(this._theme);var Y=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(N.RenderService,Y,this.rows,this.screenElement)),this._instantiationService.setService(H.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange(function(ie){return j._onRender.fire(ie)})),this.onResize(function(ie){return j._renderService.resize(ie.cols,ie.rows)}),this._soundService=this._instantiationService.createInstance(p.SoundService),this._instantiationService.setService(H.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(q.MouseService),this._instantiationService.setService(H.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(x.Viewport,function(ie,ve){return j.scrollLines(ie,ve)},this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(function(){return j.viewport.syncScrollArea()})),this.register(this.viewport),this.register(this.onCursorMove(function(){j._renderService.onCursorMove(),j._syncTextArea()})),this.register(this.onResize(function(){return j._renderService.onResize(j.cols,j.rows)})),this.register(this.onBlur(function(){return j._renderService.onBlur()})),this.register(this.onFocus(function(){return j._renderService.onFocus()})),this.register(this._renderService.onDimensionsChange(function(){return j.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(ie){return j.scrollLines(ie.amount,ie.suppressScrollEvent)})),this.register(this._selectionService.onSelectionChange(function(){return j._onSelectionChange.fire()})),this.register(this._selectionService.onRequestRedraw(function(ie){return j._renderService.onSelectionChanged(ie.start,ie.end,ie.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(ie){j.textarea.value=ie,j.textarea.focus(),j.textarea.select()})),this.register(this.onScroll(function(){j.viewport.syncScrollArea(),j._selectionService.refresh()})),this.register(l.addDisposableDomListener(this._viewportElement,"scroll",function(){return j._selectionService.refresh()})),this._mouseZoneManager=this._instantiationService.createInstance(E.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll(function(){return j._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(ie){return j._selectionService.onMouseDown(ie)})),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new D.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},M.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+'"')}},M.prototype._setTheme=function(K){var j,R,C;this._theme=K,(j=this._colorManager)===null||j===void 0||j.setTheme(K),(R=this._renderService)===null||R===void 0||R.setColors(this._colorManager.colors),(C=this.viewport)===null||C===void 0||C.onThemeChange(this._colorManager.colors)},M.prototype.bindMouse=function(){var K=this,j=this,R=this.element;function C(Ee){var Ve,Oe,Be=j._mouseService.getRawByteCoords(Ee,j.screenElement,j.cols,j.rows);if(!Be)return!1;switch(Ee.overrideType||Ee.type){case"mousemove":Oe=32,Ee.buttons===void 0?(Ve=3,Ee.button!==void 0&&(Ve=Ee.button<3?Ee.button:3)):Ve=1&Ee.buttons?0:4&Ee.buttons?1:2&Ee.buttons?2:3;break;case"mouseup":Oe=0,Ve=Ee.button<3?Ee.button:3;break;case"mousedown":Oe=1,Ve=Ee.button<3?Ee.button:3;break;case"wheel":Ee.deltaY!==0&&(Oe=Ee.deltaY<0?0:1),Ve=4;break;default:return!1}return!(Oe===void 0||Ve===void 0||Ve>4)&&j._coreMouseService.triggerMouseEvent({col:Be.x-33,row:Be.y-33,button:Ve,action:Oe,ctrl:Ee.ctrlKey,alt:Ee.altKey,shift:Ee.shiftKey})}var Y={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ie=function(Ee){return C(Ee),Ee.buttons||(K._document.removeEventListener("mouseup",Y.mouseup),Y.mousedrag&&K._document.removeEventListener("mousemove",Y.mousedrag)),K.cancel(Ee)},ve=function(Ee){return C(Ee),Ee.preventDefault(),K.cancel(Ee)},Me=function(Ee){Ee.buttons&&C(Ee)},ze=function(Ee){Ee.buttons||C(Ee)};this.register(this._coreMouseService.onProtocolChange(function(Ee){Ee?(K.optionsService.options.logLevel==="debug"&&K._logService.debug("Binding to mouse events:",K._coreMouseService.explainEvents(Ee)),K.element.classList.add("enable-mouse-events"),K._selectionService.disable()):(K._logService.debug("Unbinding from mouse events."),K.element.classList.remove("enable-mouse-events"),K._selectionService.enable()),8&Ee?Y.mousemove||(R.addEventListener("mousemove",ze),Y.mousemove=ze):(R.removeEventListener("mousemove",Y.mousemove),Y.mousemove=null),16&Ee?Y.wheel||(R.addEventListener("wheel",ve,{passive:!1}),Y.wheel=ve):(R.removeEventListener("wheel",Y.wheel),Y.wheel=null),2&Ee?Y.mouseup||(Y.mouseup=ie):(K._document.removeEventListener("mouseup",Y.mouseup),Y.mouseup=null),4&Ee?Y.mousedrag||(Y.mousedrag=Me):(K._document.removeEventListener("mousemove",Y.mousedrag),Y.mousedrag=null)})),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(l.addDisposableDomListener(R,"mousedown",function(Ee){if(Ee.preventDefault(),K.focus(),K._coreMouseService.areMouseEventsActive&&!K._selectionService.shouldForceSelection(Ee))return C(Ee),Y.mouseup&&K._document.addEventListener("mouseup",Y.mouseup),Y.mousedrag&&K._document.addEventListener("mousemove",Y.mousedrag),K.cancel(Ee)})),this.register(l.addDisposableDomListener(R,"wheel",function(Ee){if(!Y.wheel){if(!K.buffer.hasScrollback){var Ve=K.viewport.getLinesScrolled(Ee);if(Ve===0)return;for(var Oe=O.C0.ESC+(K._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Ee.deltaY<0?"A":"B"),Be="",ut=0;ut<Math.abs(Ve);ut++)Be+=Oe;K._coreService.triggerDataEvent(Be,!0)}}},{passive:!0})),this.register(l.addDisposableDomListener(R,"wheel",function(Ee){if(!Y.wheel)return K.viewport.onWheel(Ee)?void 0:K.cancel(Ee)},{passive:!1})),this.register(l.addDisposableDomListener(R,"touchstart",function(Ee){if(!K._coreMouseService.areMouseEventsActive)return K.viewport.onTouchStart(Ee),K.cancel(Ee)},{passive:!0})),this.register(l.addDisposableDomListener(R,"touchmove",function(Ee){if(!K._coreMouseService.areMouseEventsActive)return K.viewport.onTouchMove(Ee)?void 0:K.cancel(Ee)},{passive:!1}))},M.prototype.refresh=function(K,j){var R;(R=this._renderService)===null||R===void 0||R.refreshRows(K,j)},M.prototype._queueLinkification=function(K,j){var R;(R=this.linkifier)===null||R===void 0||R.linkifyRows(K,j)},M.prototype.updateCursorStyle=function(K){this._selectionService&&this._selectionService.shouldColumnSelect(K)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},M.prototype._showCursor=function(){this._coreService.isCursorInitialized||(this._coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},M.prototype.scrollLines=function(K,j){Z.prototype.scrollLines.call(this,K,j),this.refresh(0,this.rows-1)},M.prototype.paste=function(K){g.paste(K,this.textarea,this._coreService)},M.prototype.attachCustomKeyEventHandler=function(K){this._customKeyEventHandler=K},M.prototype.registerLinkMatcher=function(K,j,R){var C=this.linkifier.registerLinkMatcher(K,j,R);return this.refresh(0,this.rows-1),C},M.prototype.deregisterLinkMatcher=function(K){this.linkifier.deregisterLinkMatcher(K)&&this.refresh(0,this.rows-1)},M.prototype.registerLinkProvider=function(K){return this.linkifier2.registerLinkProvider(K)},M.prototype.registerCharacterJoiner=function(K){var j=this._renderService.registerCharacterJoiner(K);return this.refresh(0,this.rows-1),j},M.prototype.deregisterCharacterJoiner=function(K){this._renderService.deregisterCharacterJoiner(K)&&this.refresh(0,this.rows-1)},Object.defineProperty(M.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!1,configurable:!0}),M.prototype.addMarker=function(K){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+K)},M.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},M.prototype.select=function(K,j,R){this._selectionService.setSelection(K,j,R)},M.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},M.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]}},M.prototype.clearSelection=function(){var K;(K=this._selectionService)===null||K===void 0||K.clearSelection()},M.prototype.selectAll=function(){var K;(K=this._selectionService)===null||K===void 0||K.selectAll()},M.prototype.selectLines=function(K,j){var R;(R=this._selectionService)===null||R===void 0||R.selectLines(K,j)},M.prototype._keyDown=function(K){if(this._keyDownHandled=!1,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;if(!this._compositionHelper.keydown(K))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var j=w.evaluateKeyboardEvent(K,this._coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(K),j.type===3||j.type===2){var R=this.rows-1;return this.scrollLines(j.type===2?-R:R),this.cancel(K,!0)}return j.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,K)||(j.cancel&&this.cancel(K,!0),!j.key||(j.key!==O.C0.ETX&&j.key!==O.C0.CR||(this.textarea.value=""),this._onKey.fire({key:j.key,domEvent:K}),this._showCursor(),this._coreService.triggerDataEvent(j.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(K,!0)))},M.prototype._isThirdLevelShift=function(K,j){var R=K.isMac&&!this.options.macOptionIsMeta&&j.altKey&&!j.ctrlKey&&!j.metaKey||K.isWindows&&j.altKey&&j.ctrlKey&&!j.metaKey;return j.type==="keypress"?R:R&&(!j.keyCode||j.keyCode>47)},M.prototype._keyUp=function(K){this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1||(function(j){return j.keyCode===16||j.keyCode===17||j.keyCode===18}(K)||this.focus(),this.updateCursorStyle(K))},M.prototype._keyPress=function(K){var j;if(this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;if(this.cancel(K),K.charCode)j=K.charCode;else if(K.which===null||K.which===void 0)j=K.keyCode;else{if(K.which===0||K.charCode===0)return!1;j=K.which}return!(!j||(K.altKey||K.ctrlKey||K.metaKey)&&!this._isThirdLevelShift(this.browser,K))&&(j=String.fromCharCode(j),this._onKey.fire({key:j,domEvent:K}),this._showCursor(),this._coreService.triggerDataEvent(j,!0),!0)},M.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},M.prototype.resize=function(K,j){K!==this.cols||j!==this.rows?Z.prototype.resize.call(this,K,j):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},M.prototype._afterResize=function(K,j){var R,C;(R=this._charSizeService)===null||R===void 0||R.measure(),(C=this.viewport)===null||C===void 0||C.syncScrollArea(!0)},M.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 K=1;K<this.rows;K++)this.buffer.lines.push(this.buffer.getBlankLine(P.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire(this.buffer.ydisp)}},M.prototype.reset=function(){var K,j;this.options.rows=this.rows,this.options.cols=this.cols;var R=this._customKeyEventHandler;this._setup(),Z.prototype.reset.call(this),(K=this._selectionService)===null||K===void 0||K.reset(),this._customKeyEventHandler=R,this.refresh(0,this.rows-1),(j=this.viewport)===null||j===void 0||j.syncScrollArea()},M.prototype._reportWindowsOptions=function(K){if(this._renderService)switch(K){case m.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var j=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),R=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this._coreService.triggerDataEvent(O.C0.ESC+"[4;"+R+";"+j+"t");break;case m.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var C=this._renderService.dimensions.scaledCellWidth.toFixed(0),Y=this._renderService.dimensions.scaledCellHeight.toFixed(0);this._coreService.triggerDataEvent(O.C0.ESC+"[6;"+Y+";"+C+"t")}},M.prototype.cancel=function(K,j){if(this.options.cancelEvents||j)return K.preventDefault(),K.stopPropagation(),!1},M.prototype._visualBell=function(){return!1},M.prototype._soundBell=function(){return this.options.bellStyle==="sound"},M}(ce.CoreTerminal);b.Terminal=z},function(me,b,k){"use strict";var I=this&&this.__decorate||function(O,m,n,v){var f,c=arguments.length,l=c<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,n):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(O,m,n,v);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},G=this&&this.__param||function(O,m){return function(n,v){m(n,v,O)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CompositionHelper=void 0;var T=k(5),x=k(1),g=function(){function O(m,n,v,f,c,l){this._textarea=m,this._compositionView=n,this._bufferService=v,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 v={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(v.start,v.end):n._textarea.value.substring(v.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 v=m._textarea.value.replace(n,"");v.length>0&&m._coreService.triggerDataEvent(v,!0)}},0)},O.prototype.updateCompositionElements=function(m){var n=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var v=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),f=this._bufferService.buffer.y*v,c=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=c+"px",this._compositionView.style.top=f+"px",this._compositionView.style.height=v+"px",this._compositionView.style.lineHeight=v+"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([G(2,x.IBufferService),G(3,x.IOptionsService),G(4,T.ICharSizeService),G(5,x.ICoreService)],O)}();b.CompositionHelper=g},function(me,b,k){"use strict";var I,G=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)}),T=this&&this.__decorate||function(f,c,l,u){var p,E=arguments.length,D=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(D=(E<3?p(D):E>3?p(c,l,D):p(c,l))||D);return E>3&&D&&Object.defineProperty(c,l,D),D},x=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 g=k(2),O=k(7),m=k(5),n=k(1),v=function(f){function c(l,u,p,E,D,L,w){var A=f.call(this)||this;return A._scrollLines=l,A._viewportElement=u,A._scrollArea=p,A._bufferService=E,A._optionsService=D,A._charSizeService=L,A._renderService=w,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 G(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=T([x(3,n.IBufferService),x(4,n.IOptionsService),x(5,m.ICharSizeService),x(6,m.IRenderService)],c)}(g.Disposable);b.Viewport=v},function(me,b,k){"use strict";function I(g){return g.replace(/\r?\n/g,"\r")}function G(g,O){return O?"\x1B[200~"+g+"\x1B[201~":g}function T(g,O,m){g=G(g=I(g),m.decPrivateModes.bracketedPasteMode),m.triggerDataEvent(g,!0),O.value=""}function x(g,O,m){var n=m.getBoundingClientRect(),v=g.clientX-n.left-10,f=g.clientY-n.top-10;O.style.width="20px",O.style.height="20px",O.style.left=v+"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=G,b.copyHandler=function(g,O){g.clipboardData&&g.clipboardData.setData("text/plain",O.selectionText),g.preventDefault()},b.handlePasteEvent=function(g,O,m){g.stopPropagation(),g.clipboardData&&T(g.clipboardData.getData("text/plain"),O,m)},b.paste=T,b.moveTextAreaUnderMouseCursor=x,b.rightClickHandler=function(g,O,m,n,v){x(g,O,m),v&&!n.isClickInSelection(g)&&n.selectWordAtCursor(g),O.value=n.selectionText,O.select()}},function(me,b,k){"use strict";var I,G=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 T=k(2),x=k(15),g=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){x.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,w){return w}),l=function(L,w){return c.slice(L,w)},u=l(32,127),p=l(0,24);p.push(25),p.push.apply(p,l(28,32));var E,D=l(0,14);for(E in f.setDefault(1,0),f.addMany(u,0,2,0),D)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 v=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 g.Params,u._params.addParam(0),u._collect=0,u.precedingCodepoint=0,u._printHandlerFb=function(p,E,D){},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 G(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 D=l.intermediates.charCodeAt(E);if(32>D||D>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");p<<=8,p|=D}}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 D=E.indexOf(u);D!==-1&&E.splice(D,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 D=E.indexOf(u);D!==-1&&E.splice(D,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,D=this.currentState,L=this._oscParser,w=this._dcsParser,A=this._collect,P=this._params,U=this._transitions.table,N=0;N<u;++N){switch((E=U[D<<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:D,collect:A,params:P,abort:!1}).abort)return;break;case 7:for(var F=this._csiHandlers[A<<8|p],q=F?F.length-1:-1;q>=0&&F[q](P)===!1;q--);q<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:w.hook(A<<8|p,P);break;case 13:for(var ce=N+1;;++ce)if(ce>=u||(p=l[ce])===24||p===26||p===27||p>127&&p<160){w.put(l,N,ce),N=ce-1;break}break;case 14:w.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 ee=N+1;;ee++)if(ee>=u||(p=l[ee])<32||p>127&&p<=159){L.put(l,N,ee),N=ee-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}D=15&E}this._collect=A,this.currentState=D},c}(T.Disposable);b.EscapeSequenceParser=v},function(me,b,k){"use strict";var I,G=this&&this.__extends||(I=function(L,w){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,w)},function(L,w){function A(){this.constructor=L}I(L,w),L.prototype=w===null?Object.create(w):(A.prototype=w.prototype,new A)}),T=this&&this.__decorate||function(L,w,A,P){var U,N=arguments.length,H=N<3?w:P===null?P=Object.getOwnPropertyDescriptor(w,A):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(L,w,A,P);else for(var F=L.length-1;F>=0;F--)(U=L[F])&&(H=(N<3?U(H):N>3?U(w,A,H):U(w,A))||H);return N>3&&H&&Object.defineProperty(w,A,H),H},x=this&&this.__param||function(L,w){return function(A,P){w(A,P,L)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Renderer=void 0;var g=k(41),O=k(47),m=k(48),n=k(49),v=k(29),f=k(2),c=k(5),l=k(1),u=k(25),p=k(0),E=1,D=function(L){function w(A,P,U,N,H,F,q,V,ne){var ce=L.call(this)||this;ce._colors=A,ce._screenElement=P,ce._bufferService=H,ce._charSizeService=F,ce._optionsService=q,ce._id=E++,ce._onRequestRedraw=new p.EventEmitter;var ee=ce._optionsService.options.allowTransparency;return ce._characterJoinerRegistry=new v.CharacterJoinerRegistry(ce._bufferService),ce._renderLayers=[new g.TextRenderLayer(ce._screenElement,0,ce._colors,ce._characterJoinerRegistry,ee,ce._id,ce._bufferService,q),new O.SelectionRenderLayer(ce._screenElement,1,ce._colors,ce._id,ce._bufferService,q),new n.LinkRenderLayer(ce._screenElement,2,ce._colors,ce._id,U,N,ce._bufferService,q),new m.CursorRenderLayer(ce._screenElement,3,ce._colors,ce._id,ce._onRequestRedraw,ce._bufferService,q,V,ne)],ce.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},ce._devicePixelRatio=window.devicePixelRatio,ce._updateDimensions(),ce.onOptionsChanged(),ce}return G(w,L),Object.defineProperty(w.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),w.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)},w.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},w.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()}},w.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"},w.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},w.prototype.onBlur=function(){this._runOperation(function(A){return A.onBlur()})},w.prototype.onFocus=function(){this._runOperation(function(A){return A.onFocus()})},w.prototype.onSelectionChanged=function(A,P,U){U===void 0&&(U=!1),this._runOperation(function(N){return N.onSelectionChanged(A,P,U)})},w.prototype.onCursorMove=function(){this._runOperation(function(A){return A.onCursorMove()})},w.prototype.onOptionsChanged=function(){this._runOperation(function(A){return A.onOptionsChanged()})},w.prototype.clear=function(){this._runOperation(function(A){return A.reset()})},w.prototype._runOperation=function(A){for(var P=0,U=this._renderLayers;P<U.length;P++)A(U[P])},w.prototype.renderRows=function(A,P){for(var U=0,N=this._renderLayers;U<N.length;U++)N[U].onGridChanged(A,P)},w.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)},w.prototype.registerCharacterJoiner=function(A){return this._characterJoinerRegistry.registerCharacterJoiner(A)},w.prototype.deregisterCharacterJoiner=function(A){return this._characterJoinerRegistry.deregisterCharacterJoiner(A)},w=T([x(4,l.IBufferService),x(5,c.ICharSizeService),x(6,l.IOptionsService),x(7,l.ICoreService),x(8,c.ICoreBrowserService)],w)}(f.Disposable);b.Renderer=D},function(me,b,k){"use strict";var I,G=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 T=k(42),x=k(13),g=k(6),O=k(3),m=k(29),n=k(4),v=function(f){function c(l,u,p,E,D,L,w,A){var P=f.call(this,l,"text",u,D,p,L,w,A)||this;return P._characterWidth=0,P._characterFont="",P._characterOverlapCache={},P._workCell=new n.CellData,P._state=new T.GridCache,P._characterJoinerRegistry=E,P}return G(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 D=l;D<=u;D++)for(var L=D+this._bufferService.buffer.ydisp,w=this._bufferService.buffer.lines.get(L),A=p?p.getJoinedCharacters(L):[],P=0;P<this._bufferService.cols;P++){w.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,w.translateToString(!0,F[0],F[1]),F[1]-F[0]),H=F[1]-1}!N&&this._isOverlapping(U)&&H<w.length-1&&w.getCodePoint(H+1)===O.NULL_CELL_CODE&&(U.content&=-12582913,U.content|=2<<22),E(U,P,D),P=H}}},c.prototype._drawBackground=function(l,u){var p=this,E=this._ctx,D=this._bufferService.cols,L=0,w=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("+g.AttributeData.toColorRGB(P.getFgColor()).join(",")+")":p._colors.ansi[P.getFgColor()].css:P.isBgRGB()?H="rgb("+g.AttributeData.toColorRGB(P.getBgColor()).join(",")+")":P.isBgPalette()&&(H=p._colors.ansi[P.getBgColor()].css),A===null&&(L=U,w=N),N!==w?(E.fillStyle=A||"",p._fillCells(L,w,D-L,1),L=U,w=N):A!==H&&(E.fillStyle=A||"",p._fillCells(L,w,U-L,1),L=U,w=N),A=H}),A!==null&&(E.fillStyle=A,this._fillCells(L,w,D-L,1)),E.restore()},c.prototype._drawForeground=function(l,u){var p=this;this._forEachCell(l,u,this._characterJoinerRegistry,function(E,D,L){if(!E.isInvisible()&&(p._drawChars(E,D,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("+g.AttributeData.toColorRGB(E.getBgColor()).join(",")+")";else{var w=E.getBgColor();p._optionsService.options.drawBoldTextInBrightColors&&E.isBold()&&w<8&&(w+=8),p._ctx.fillStyle=p._colors.ansi[w].css}else if(E.isFgDefault())p._ctx.fillStyle=p._colors.foreground.css;else if(E.isFgRGB())p._ctx.fillStyle="rgb("+g.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(D,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}(x.BaseRenderLayer);b.TextRenderLayer=v},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GridCache=void 0;var I=function(){function G(){this.cache=[]}return G.prototype.resize=function(T,x){for(var g=0;g<T;g++){this.cache.length<=g&&this.cache.push([]);for(var O=this.cache[g].length;O<x;O++)this.cache[g].push(void 0);this.cache[g].length=x}this.cache.length=T},G.prototype.clear=function(){for(var T=0;T<this.cache.length;T++)for(var x=0;x<this.cache[T].length;x++)this.cache[T][x]=void 0},G}();b.GridCache=I},function(me,b,k){"use strict";var I,G=this&&this.__extends||(I=function(p,E){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(D,L){D.__proto__=L}||function(D,L){for(var w in L)L.hasOwnProperty(w)&&(D[w]=L[w])})(p,E)},function(p,E){function D(){this.constructor=p}I(p,E),p.prototype=E===null?Object.create(E):(D.prototype=E.prototype,new D)});Object.defineProperty(b,"__esModule",{value:!0}),b.NoneCharAtlas=b.DynamicCharAtlas=b.getGlyphCacheKey=void 0;var T=k(9),x=k(44),g=k(27),O=k(46),m=k(11),n=k(28),v=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(D,L){var w=p.call(this)||this;w._config=L,w._drawToCacheCount=0,w._glyphsWaitingOnBitmap=[],w._bitmapCommitTimeout=null,w._bitmap=null,w._cacheCanvas=D.createElement("canvas"),w._cacheCanvas.width=1024,w._cacheCanvas.height=1024,w._cacheCtx=n.throwIfFalsy(w._cacheCanvas.getContext("2d",{alpha:!0}));var A=D.createElement("canvas");A.width=w._config.scaledCharWidth,A.height=w._config.scaledCharHeight,w._tmpCtx=n.throwIfFalsy(A.getContext("2d",{alpha:w._config.allowTransparency})),w._width=Math.floor(1024/w._config.scaledCharWidth),w._height=Math.floor(1024/w._config.scaledCharHeight);var P=w._width*w._height;return w._cacheMap=new O.LRUMap(P),w._cacheMap.prealloc(P),w}return G(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(D,L,w,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(D,U,w,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(D,H,w,A),!0}return!1},E.prototype._canCache=function(D){return D.code<256},E.prototype._toCoordinateX=function(D){return D%this._width*this._config.scaledCharWidth},E.prototype._toCoordinateY=function(D){return Math.floor(D/this._width)*this._config.scaledCharHeight},E.prototype._drawFromCache=function(D,L,w,A){if(!L.isEmpty){var P=this._toCoordinateX(L.index),U=this._toCoordinateY(L.index);D.drawImage(L.inBitmap?this._bitmap:this._cacheCanvas,P,U,this._config.scaledCharWidth,this._config.scaledCharHeight,w,A,this._config.scaledCharWidth,this._config.scaledCharHeight)}},E.prototype._getColorFromAnsiIndex=function(D){return D<this._config.colors.ansi.length?this._config.colors.ansi[D]:g.DEFAULT_ANSI_COLORS[D]},E.prototype._getBackgroundColor=function(D){return this._config.allowTransparency?f:D.bg===T.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:D.bg<256?this._getColorFromAnsiIndex(D.bg):this._config.colors.background},E.prototype._getForegroundColor=function(D){return D.fg===T.INVERTED_DEFAULT_COLOR?v.color.opaque(this._config.colors.background):D.fg<256?this._getColorFromAnsiIndex(D.fg):this._config.colors.foreground},E.prototype._drawToCache=function(D,L){this._drawToCacheCount++,this._tmpCtx.save();var w=this._getBackgroundColor(D);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=w.css,this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),this._tmpCtx.globalCompositeOperation="source-over";var A=D.bold?this._config.fontWeightBold:this._config.fontWeight,P=D.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(D).css,D.dim&&(this._tmpCtx.globalAlpha=T.DIM_OPACITY),this._tmpCtx.fillText(D.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 ce=!0,ee=ne.rgba>>>24,z=ne.rgba>>>16&255,Z=ne.rgba>>>8&255,M=0;M<V.data.length;M+=4)V.data[M]===ee&&V.data[M+1]===z&&V.data[M+2]===Z?V.data[M+3]=0:ce=!1;return ce}(U,w));var H=this._toCoordinateX(L),F=this._toCoordinateY(L);this._cacheCtx.putImageData(U,H,F);var q={index:L,isEmpty:N,inBitmap:!1};return this._addGlyphToBitmap(q),q},E.prototype._addGlyphToBitmap=function(D){var L=this;!("createImageBitmap"in window)||m.isFirefox||m.isSafari||(this._glyphsWaitingOnBitmap.push(D),this._bitmapCommitTimeout===null&&(this._bitmapCommitTimeout=window.setTimeout(function(){return L._generateBitmap()},100)))},E.prototype._generateBitmap=function(){var D=this,L=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then(function(w){D._bitmap=w;for(var A=0;A<L.length;A++)L[A].inBitmap=!0}),this._bitmapCommitTimeout=null},E}(x.BaseCharAtlas);b.DynamicCharAtlas=l;var u=function(p){function E(D,L){return p.call(this)||this}return G(E,p),E.prototype.draw=function(D,L,w,A){return!1},E}(x.BaseCharAtlas);b.NoneCharAtlas=u},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BaseCharAtlas=void 0;var I=function(){function G(){this._didWarmUp=!1}return G.prototype.dispose=function(){},G.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},G.prototype._doWarmUp=function(){},G.prototype.beginFrame=function(){},G}();b.BaseCharAtlas=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ColorContrastCache=void 0;var I=function(){function G(){this._color={},this._rgba={}}return G.prototype.clear=function(){this._color={},this._rgba={}},G.prototype.setCss=function(T,x,g){this._rgba[T]||(this._rgba[T]={}),this._rgba[T][x]=g},G.prototype.getCss=function(T,x){return this._rgba[T]?this._rgba[T][x]:void 0},G.prototype.setColor=function(T,x,g){this._color[T]||(this._color[T]={}),this._color[T][x]=g},G.prototype.getColor=function(T,x){return this._color[T]?this._color[T][x]:void 0},G}();b.ColorContrastCache=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.LRUMap=void 0;var I=function(){function G(T){this.capacity=T,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return G.prototype._unlinkNode=function(T){var x=T.prev,g=T.next;T===this._head&&(this._head=g),T===this._tail&&(this._tail=x),x!==null&&(x.next=g),g!==null&&(g.prev=x)},G.prototype._appendNode=function(T){var x=this._tail;x!==null&&(x.next=T),T.prev=x,T.next=null,this._tail=T,this._head===null&&(this._head=T)},G.prototype.prealloc=function(T){for(var x=this._nodePool,g=0;g<T;g++)x.push({prev:null,next:null,key:null,value:null})},G.prototype.get=function(T){var x=this._map[T];return x!==void 0?(this._unlinkNode(x),this._appendNode(x),x.value):null},G.prototype.peekValue=function(T){var x=this._map[T];return x!==void 0?x.value:null},G.prototype.peek=function(){var T=this._head;return T===null?null:T.value},G.prototype.set=function(T,x){var g=this._map[T];if(g!==void 0)g=this._map[T],this._unlinkNode(g),g.value=x;else if(this.size>=this.capacity)g=this._head,this._unlinkNode(g),delete this._map[g.key],g.key=T,g.value=x,this._map[T]=g;else{var O=this._nodePool;O.length>0?((g=O.pop()).key=T,g.value=x):g={prev:null,next:null,key:T,value:x},this._map[T]=g,this.size++}this._appendNode(g)},G}();b.LRUMap=I},function(me,b,k){"use strict";var I,G=this&&this.__extends||(I=function(x,g){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])})(x,g)},function(x,g){function O(){this.constructor=x}I(x,g),x.prototype=g===null?Object.create(g):(O.prototype=g.prototype,new O)});Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionRenderLayer=void 0;var T=function(x){function g(O,m,n,v,f,c){var l=x.call(this,O,"selection",m,!0,n,v,f,c)||this;return l._clearState(),l}return G(g,x),g.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},g.prototype.resize=function(O){x.prototype.resize.call(this,O),this._clearState()},g.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},g.prototype.onSelectionChanged=function(O,m,n){if(this._didStateChange(O,m,n,this._bufferService.buffer.ydisp))if(this._clearAll(),O&&m){var v=O[1]-this._bufferService.buffer.ydisp,f=m[1]-this._bufferService.buffer.ydisp,c=Math.max(v,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=v===c?O[0]:0;var D=c===l?m[0]:this._bufferService.cols;this._fillCells(u,c,D-u,1);var L=Math.max(l-c-1,0);if(this._fillCells(0,c+1,this._bufferService.cols,L),c!==l){var w=f===l?m[0]:this._bufferService.cols;this._fillCells(0,l,w,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()},g.prototype._didStateChange=function(O,m,n,v){return!this._areCoordinatesEqual(O,this._state.start)||!this._areCoordinatesEqual(m,this._state.end)||n!==this._state.columnSelectMode||v!==this._state.ydisp},g.prototype._areCoordinatesEqual=function(O,m){return!(!O||!m)&&O[0]===m[0]&&O[1]===m[1]},g}(k(13).BaseRenderLayer);b.SelectionRenderLayer=T},function(me,b,k){"use strict";var I,G=this&&this.__extends||(I=function(m,n){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,f){v.__proto__=f}||function(v,f){for(var c in f)f.hasOwnProperty(c)&&(v[c]=f[c])})(m,n)},function(m,n){function v(){this.constructor=m}I(m,n),m.prototype=n===null?Object.create(n):(v.prototype=n.prototype,new v)});Object.defineProperty(b,"__esModule",{value:!0}),b.CursorRenderLayer=void 0;var T=k(13),x=k(4),g=function(m){function n(v,f,c,l,u,p,E,D,L){var w=m.call(this,v,"cursor",f,!0,c,l,p,E)||this;return w._onRequestRedraw=u,w._coreService=D,w._coreBrowserService=L,w._cell=new x.CellData,w._state={x:0,y:0,isFocused:!1,style:"",width:0},w._cursorRenderers={bar:w._renderBarCursor.bind(w),block:w._renderBlockCursor.bind(w),underline:w._renderUnderlineCursor.bind(w)},w}return G(n,m),n.prototype.resize=function(v){m.prototype.resize.call(this,v),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 v,f=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new O(this._coreBrowserService.isFocused,function(){f._render(!0)})):((v=this._cursorBlinkStateManager)===null||v===void 0||v.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(v,f){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},n.prototype._render=function(v){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(v,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(v,f,this._optionsService.options.cursorWidth),this._ctx.restore()},n.prototype._renderBlockCursor=function(v,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(v,f,c.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(c,v,f),this._ctx.restore()},n.prototype._renderUnderlineCursor=function(v,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(v,f),this._ctx.restore()},n.prototype._renderBlurCursor=function(v,f,c){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(v,f,c.getWidth(),1),this._ctx.restore()},n}(T.BaseRenderLayer);b.CursorRenderLayer=g;var O=function(){function m(n,v){this._renderCallback=v,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 v=this;n===void 0&&(n=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout(function(){if(v._animationTimeRestarted){var f=600-(Date.now()-v._animationTimeRestarted);if(v._animationTimeRestarted=void 0,f>0)return void v._restartInterval(f)}v.isCursorVisible=!1,v._animationFrame=window.requestAnimationFrame(function(){v._renderCallback(),v._animationFrame=void 0}),v._blinkInterval=window.setInterval(function(){if(v._animationTimeRestarted){var c=600-(Date.now()-v._animationTimeRestarted);return v._animationTimeRestarted=void 0,void v._restartInterval(c)}v.isCursorVisible=!v.isCursorVisible,v._animationFrame=window.requestAnimationFrame(function(){v._renderCallback(),v._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,G=this&&this.__extends||(I=function(m,n){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,f){v.__proto__=f}||function(v,f){for(var c in f)f.hasOwnProperty(c)&&(v[c]=f[c])})(m,n)},function(m,n){function v(){this.constructor=m}I(m,n),m.prototype=n===null?Object.create(n):(v.prototype=n.prototype,new v)});Object.defineProperty(b,"__esModule",{value:!0}),b.LinkRenderLayer=void 0;var T=k(13),x=k(9),g=k(26),O=function(m){function n(v,f,c,l,u,p,E,D){var L=m.call(this,v,"link",f,!0,c,l,E,D)||this;return u.onShowLinkUnderline(function(w){return L._onShowLinkUnderline(w)}),u.onHideLinkUnderline(function(w){return L._onHideLinkUnderline(w)}),p.onShowLinkUnderline(function(w){return L._onShowLinkUnderline(w)}),p.onHideLinkUnderline(function(w){return L._onHideLinkUnderline(w)}),L}return G(n,m),n.prototype.resize=function(v){m.prototype.resize.call(this,v),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 v=this._state.y2-this._state.y1-1;v>0&&this._clearCells(0,this._state.y1+1,this._state.cols,v),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},n.prototype._onShowLinkUnderline=function(v){if(v.fg===x.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:v.fg&&g.is256Color(v.fg)?this._ctx.fillStyle=this._colors.ansi[v.fg].css:this._ctx.fillStyle=this._colors.foreground.css,v.y1===v.y2)this._fillBottomLineAtCells(v.x1,v.y1,v.x2-v.x1);else{this._fillBottomLineAtCells(v.x1,v.y1,v.cols-v.x1);for(var f=v.y1+1;f<v.y2;f++)this._fillBottomLineAtCells(0,f,v.cols);this._fillBottomLineAtCells(0,v.y2,v.x2)}this._state=v},n.prototype._onHideLinkUnderline=function(v){this._clearCurrentLink()},n}(T.BaseRenderLayer);b.LinkRenderLayer=O},function(me,b,k){"use strict";var I=this&&this.__decorate||function(m,n,v,f){var c,l=arguments.length,u=l<3?n:f===null?f=Object.getOwnPropertyDescriptor(n,v):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(m,n,v,f);else for(var p=m.length-1;p>=0;p--)(c=m[p])&&(u=(l<3?c(u):l>3?c(n,v,u):c(n,v))||u);return l>3&&u&&Object.defineProperty(n,v,u),u},G=this&&this.__param||function(m,n){return function(v,f){n(v,f,m)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseZone=b.Linkifier=void 0;var T=k(0),x=k(1),g=function(){function m(n,v,f){this._bufferService=n,this._logService=v,this._unicodeService=f,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new T.EventEmitter,this._onHideLinkUnderline=new T.EventEmitter,this._onLinkTooltip=new T.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,v){this._element=n,this._mouseZoneManager=v},m.prototype.linkifyRows=function(n,v){var f=this;this._mouseZoneManager&&(this._rowsToLinkify.start===void 0||this._rowsToLinkify.end===void 0?(this._rowsToLinkify.start=n,this._rowsToLinkify.end=v):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,n),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,v)),this._mouseZoneManager.clearAll(n,v),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 v=n.ydisp+this._rowsToLinkify.start;if(!(v>=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,v,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,v,f){if(f===void 0&&(f={}),!v)throw new Error("handler must be defined");var c={id:this._nextLinkMatcherId++,regex:n,handler:v,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 v=this._linkMatchers.length-1;v>=0;v--)if(n.priority<=this._linkMatchers[v].priority)return void this._linkMatchers.splice(v+1,0,n);this._linkMatchers.splice(0,0,n)}else this._linkMatchers.push(n)},m.prototype.deregisterLinkMatcher=function(n){for(var v=0;v<this._linkMatchers.length;v++)if(this._linkMatchers[v].id===n)return this._linkMatchers.splice(v,1),!0;return!1},m.prototype._doLinkifyRow=function(n,v,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 D._logService.debug("match found without corresponding matchIndex",c,f),"break";if(p=v.indexOf(L,p+1),u.lastIndex=p+L.length,p<0)return"break";var w=D._bufferService.buffer.stringIndexToBufferIndex(n,p);if(w[0]<0)return"break";var A=D._bufferService.buffer.lines.get(w[0]);if(!A)return"break";var P=A.getFg(w[1]),U=P?P>>9&511:void 0;f.validationCallback?f.validationCallback(L,function(N){l._rowsTimeoutId||N&&l._addLink(w[1],w[0]-l._bufferService.buffer.ydisp,L,f,U)}):D._addLink(w[1],w[0]-D._bufferService.buffer.ydisp,L,f,U)},D=this;(c=u.exec(v))!==null&&E()!=="break";);},m.prototype._addLink=function(n,v,f,c,l){var u=this;if(this._mouseZoneManager&&this._element){var p=this._unicodeService.getStringCellWidth(f),E=n%this._bufferService.cols,D=v+Math.floor(n/this._bufferService.cols),L=(E+p)%this._bufferService.cols,w=D+Math.floor((E+p)/this._bufferService.cols);L===0&&(L=this._bufferService.cols,w--),this._mouseZoneManager.add(new O(E+1,D+1,L+1,w+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,D,L,w,l)),u._element.classList.add("xterm-cursor-pointer")},function(A){u._onLinkTooltip.fire(u._createLinkHoverEvent(E,D,L,w,l)),c.hoverTooltipCallback&&c.hoverTooltipCallback(A,f,{start:{x:E,y:D},end:{x:L,y:w}})},function(){u._onHideLinkUnderline.fire(u._createLinkHoverEvent(E,D,L,w,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,v,f,c,l){return{x1:n,y1:v,x2:f,y2:c,cols:this._bufferService.cols,fg:l}},m._timeBeforeLatency=200,m=I([G(0,x.IBufferService),G(1,x.ILogService),G(2,x.IUnicodeService)],m)}();b.Linkifier=g;var O=function(m,n,v,f,c,l,u,p,E){this.x1=m,this.y1=n,this.x2=v,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,G=this&&this.__extends||(I=function(L,w){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,w)},function(L,w){function A(){this.constructor=L}I(L,w),L.prototype=w===null?Object.create(w):(A.prototype=w.prototype,new A)}),T=this&&this.__decorate||function(L,w,A,P){var U,N=arguments.length,H=N<3?w:P===null?P=Object.getOwnPropertyDescriptor(w,A):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(L,w,A,P);else for(var F=L.length-1;F>=0;F--)(U=L[F])&&(H=(N<3?U(H):N>3?U(w,A,H):U(w,A))||H);return N>3&&H&&Object.defineProperty(w,A,H),H},x=this&&this.__param||function(L,w){return function(A,P){w(A,P,L)}};Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionService=void 0;var g=k(11),O=k(52),m=k(4),n=k(0),v=k(5),f=k(1),c=k(30),l=k(53),u=k(2),p="\xA0",E=new RegExp(p,"g"),D=function(L){function w(A,P,U,N,H,F,q){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=q,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 G(w,L),Object.defineProperty(w.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),w.prototype.dispose=function(){this._removeMouseDownListeners()},w.prototype.reset=function(){this.clearSelection()},w.prototype.disable=function(){this.clearSelection(),this._enabled=!1},w.prototype.enable=function(){this._enabled=!0},Object.defineProperty(w.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(w.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(w.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 q=A[1]===P[1]?P[0]:void 0;for(N.push(U.translateBufferLineToString(A[1],!0,A[0],q)),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(g.isWindows?`\r
|
|
|
`:`
|
|
|
`)},enumerable:!1,configurable:!0}),w.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},w.prototype.refresh=function(A){var P=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return P._refresh()})),g.isLinux&&A&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},w.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})},w.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)},w.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]},w.prototype.selectWordAtCursor=function(A){var P=this._getMouseBufferCoords(A);P&&(this._selectWordAt(P,!1),this._model.selectionEnd=void 0,this.refresh(!0))},w.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},w.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()},w.prototype._onTrim=function(A){this._model.onTrim(A)&&this.refresh()},w.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},w.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))},w.prototype.shouldForceSelection=function(A){return g.isMac?A.altKey&&this._optionsService.options.macOptionClickForcesSelection:A.shiftKey},w.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)}},w.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)},w.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},w.prototype._onIncrementalClick=function(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))},w.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]++}},w.prototype._onDoubleClick=function(A){var P=this._getMouseBufferCoords(A);P&&(this._activeSelectionMode=1,this._selectWordAt(P,!0))},w.prototype._onTripleClick=function(A){var P=this._getMouseBufferCoords(A);P&&(this._activeSelectionMode=2,this._selectLineAt(P[1]))},w.prototype.shouldColumnSelect=function(A){return A.altKey&&!(g.isMac&&this._optionsService.options.macOptionClickForcesSelection)},w.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)}},w.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()}},w.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()},w.prototype._onBufferActivate=function(A){var P=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim(function(U){return P._onTrim(U)})},w.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},w.prototype.setSelection=function(A,P,U){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,P],this._model.selectionStartLength=U,this.refresh()},w.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 q=H.translateBufferLineToString(A[1],!1),V=this._convertViewportColToCharacterIndex(F,A),ne=V,ce=A[0]-V,ee=0,z=0,Z=0,M=0;if(q.charAt(V)===" "){for(;V>0&&q.charAt(V-1)===" ";)V--;for(;ne<q.length&&q.charAt(ne+1)===" ";)ne++}else{var K=A[0],j=A[0];F.getWidth(K)===0&&(ee++,K--),F.getWidth(j)===2&&(z++,j++);var R=F.getString(j).length;for(R>1&&(M+=R-1,ne+=R-1);K>0&&V>0&&!this._isCharWordSeparator(F.loadCell(K-1,this._workCell));){F.loadCell(K-1,this._workCell);var C=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,K--):C>1&&(Z+=C-1,V-=C-1),V--,K--}for(;j<F.length&&ne+1<q.length&&!this._isCharWordSeparator(F.loadCell(j+1,this._workCell));){F.loadCell(j+1,this._workCell);var Y=this._workCell.getChars().length;this._workCell.getWidth()===2?(z++,j++):Y>1&&(M+=Y-1,ne+=Y-1),ne++,j++}}ne++;var ie=V+ce-ee+Z,ve=Math.min(this._bufferService.cols,ne-V+ee+z-Z-M);if(P||q.slice(V,ne).trim()!==""){if(U&&ie===0&&F.getCodePoint(0)!==32){var Me=H.lines.get(A[1]-1);if(Me&&F.isWrapped&&Me.getCodePoint(this._bufferService.cols-1)!==32){var ze=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(ze){var Ee=this._bufferService.cols-ze.start;ie-=Ee,ve+=Ee}}}if(N&&ie+ve===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){var Ve=H.lines.get(A[1]+1);if(Ve&&Ve.isWrapped&&Ve.getCodePoint(0)!==32){var Oe=this._getWordAt([0,A[1]+1],!1,!1,!0);Oe&&(ve+=Oe.length)}}return{start:ie,length:ve}}}}},w.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}},w.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]}},w.prototype._isCharWordSeparator=function(A){return A.getWidth()!==0&&this._optionsService.options.wordSeparator.indexOf(A.getChars())>=0},w.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},w=T([x(2,f.IBufferService),x(3,f.ICoreService),x(4,v.IMouseService),x(5,f.IOptionsService),x(6,v.IRenderService)],w)}(u.Disposable);b.SelectionService=D},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionModel=void 0;var I=function(){function G(T){this._bufferService=T,this.isSelectAllActive=!1,this.selectionStartLength=0}return G.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(G.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(G.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 T=this.selectionStart[0]+this.selectionStartLength;return T>this._bufferService.cols?[T%this._bufferService.cols,this.selectionStart[1]+Math.floor(T/this._bufferService.cols)]:[T,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}),G.prototype.areSelectionValuesReversed=function(){var T=this.selectionStart,x=this.selectionEnd;return!(!T||!x)&&(T[1]>x[1]||T[1]===x[1]&&T[0]>x[0])},G.prototype.onTrim=function(T){return this.selectionStart&&(this.selectionStart[1]-=T),this.selectionEnd&&(this.selectionEnd[1]-=T),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},G}();b.SelectionModel=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.moveToCellSequence=void 0;var I=k(12);function G(n,v,f,c){var l=n-T(f,n),u=v-T(f,v);return m(Math.abs(l-u)-function(p,E,D){for(var L=0,w=p-T(D,p),A=E-T(D,E),P=0;P<Math.abs(w-A);P++){var U=x(p,E)==="A"?-1:1,N=D.buffer.lines.get(w+U*P);N&&N.isWrapped&&L++}return L}(n,v,f),O(x(n,v),c))}function T(n,v){for(var f=0,c=n.buffer.lines.get(v),l=c&&c.isWrapped;l&&v>=0&&v<n.rows;)f++,l=(c=n.buffer.lines.get(--v))&&c.isWrapped;return f}function x(n,v){return n>v?"A":"B"}function g(n,v,f,c,l,u){for(var p=n,E=v,D="";p!==f||E!==c;)p+=l?1:-1,l&&p>u.cols-1?(D+=u.buffer.translateBufferLineToString(E,!1,n,p),p=0,n=0,E++):!l&&p<0&&(D+=u.buffer.translateBufferLineToString(E,!1,0,n+1),n=p=u.cols-1,E--);return D+u.buffer.translateBufferLineToString(E,!1,n,p)}function O(n,v){var f=v?"O":"[";return I.C0.ESC+f+n}function m(n,v){n=Math.floor(n);for(var f="",c=0;c<n;c++)f+=v;return f}b.moveToCellSequence=function(n,v,f,c){var l,u=f.buffer.x,p=f.buffer.y;if(!f.buffer.hasScrollback)return function(D,L,w,A,P,U){return G(L,A,P,U).length===0?"":m(g(D,L,D,L-T(P,L),!1,P).length,O("D",U))}(u,p,0,v,f,c)+G(p,v,f,c)+function(D,L,w,A,P,U){var N;N=G(L,A,P,U).length>0?A-T(P,A):L;var H=A,F=function(q,V,ne,ce,ee,z){var Z;return Z=G(ne,ce,ee,z).length>0?ce-T(ee,ce):V,q<ne&&Z<=ce||q>=ne&&Z<ce?"C":"D"}(D,L,w,A,P,U);return m(g(D,N,w,H,F==="C",P).length,O(F,U))}(u,p,n,v,f,c);if(p===v)return l=u>n?"D":"C",m(Math.abs(u-n),O(l,c));l=p>v?"D":"C";var E=Math.abs(p-v);return m(function(D,L){return L.cols-D}(p>v?n:u,f)+(E-1)*f.cols+1+((p>v?u:n)-1),O(l,c))}},function(me,b,k){"use strict";var I=this&&this.__decorate||function(g,O,m,n){var v,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(g,O,m,n);else for(var l=g.length-1;l>=0;l--)(v=g[l])&&(c=(f<3?v(c):f>3?v(O,m,c):v(O,m))||c);return f>3&&c&&Object.defineProperty(O,m,c),c},G=this&&this.__param||function(g,O){return function(m,n){O(m,n,g)}};Object.defineProperty(b,"__esModule",{value:!0}),b.SoundService=void 0;var T=k(1),x=function(){function g(O){this._optionsService=O}return Object.defineProperty(g,"audioContext",{get:function(){if(!g._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;g._audioContext=new O}return g._audioContext},enumerable:!1,configurable:!0}),g.prototype.playBellSound=function(){var O=g.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)})}},g.prototype._base64ToArrayBuffer=function(O){for(var m=window.atob(O),n=m.length,v=new Uint8Array(n),f=0;f<n;f++)v[f]=m.charCodeAt(f);return v.buffer},g.prototype._removeMimeType=function(O){return O.split(",")[1]},g=I([G(0,T.IOptionsService)],g)}();b.SoundService=x},function(me,b,k){"use strict";var I,G=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)}),T=this&&this.__decorate||function(f,c,l,u){var p,E=arguments.length,D=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(D=(E<3?p(D):E>3?p(c,l,D):p(c,l))||D);return E>3&&D&&Object.defineProperty(c,l,D),D},x=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 g=k(2),O=k(7),m=k(5),n=k(1),v=function(f){function c(l,u,p,E,D,L){var w=f.call(this)||this;return w._element=l,w._screenElement=u,w._bufferService=p,w._mouseService=E,w._selectionService=D,w._optionsService=L,w._zones=[],w._areZonesActive=!1,w._lastHoverCoords=[void 0,void 0],w._initialSelectionLength=0,w.register(O.addDisposableDomListener(w._element,"mousedown",function(A){return w._onMouseDown(A)})),w._mouseMoveListener=function(A){return w._onMouseMove(A)},w._mouseLeaveListener=function(A){return w._onMouseLeave(A)},w._clickListener=function(A){return w._onClick(A)},w}return G(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],D=0;D<this._zones.length;D++){var L=this._zones[D];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=T([x(2,n.IBufferService),x(3,m.IMouseService),x(4,m.ISelectionService),x(5,n.IOptionsService)],c)}(g.Disposable);b.MouseZoneManager=v},function(me,b,k){"use strict";var I,G=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 T=k(18),x=k(11),g=k(31),O=k(7),m=k(2),n=k(32),v=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 D=0;D<E._terminal.rows;D++)E._rowElements[D]=E._createAccessibilityTreeNode(),E._rowContainer.appendChild(E._rowElements[D]);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 g.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 G(l,c),l.prototype.dispose=function(){c.prototype.dispose.call(this),v.removeElementFromParent(this._accessibilityTreeRoot),this._rowElements.length=0},l.prototype._onBoundaryFocus=function(u,p){var E=u.target,D=this._rowElements[p===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")!==(p===0?"1":""+this._terminal.buffer.lines.length)&&u.relatedTarget===D){var L,w;if(p===0?(L=E,w=this._rowElements.pop(),this._rowContainer.removeChild(w)):(L=this._rowElements.shift(),w=E,this._rowContainer.removeChild(L)),L.removeEventListener("focus",this._topBoundaryFocusListener),w.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+=T.tooMuchOutput)),x.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,x.isMac&&v.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,D=E.lines.length.toString(),L=u;L<=p;L++){var w=E.translateBufferLineToString(E.ydisp+L,!0),A=(E.ydisp+L+1).toString(),P=this._rowElements[L];P&&(w.length===0?P.innerHTML=" ":P.textContent=w,P.setAttribute("aria-posinset",A),P.setAttribute("aria-setsize",D))}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,G=this&&this.__extends||(I=function(E,D){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,w){L.__proto__=w}||function(L,w){for(var A in w)w.hasOwnProperty(A)&&(L[A]=w[A])})(E,D)},function(E,D){function L(){this.constructor=E}I(E,D),E.prototype=D===null?Object.create(D):(L.prototype=D.prototype,new L)}),T=this&&this.__decorate||function(E,D,L,w){var A,P=arguments.length,U=P<3?D:w===null?w=Object.getOwnPropertyDescriptor(D,L):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(E,D,L,w);else for(var N=E.length-1;N>=0;N--)(A=E[N])&&(U=(P<3?A(U):P>3?A(D,L,U):A(D,L))||U);return P>3&&U&&Object.defineProperty(D,L,U),U},x=this&&this.__param||function(E,D){return function(L,w){D(L,w,E)}};Object.defineProperty(b,"__esModule",{value:!0}),b.DomRenderer=void 0;var g=k(58),O=k(9),m=k(2),n=k(5),v=k(1),f=k(0),c=k(10),l=k(17),u=1,p=function(E){function D(L,w,A,P,U,N,H,F,q){var V=E.call(this)||this;return V._colors=L,V._element=w,V._screenElement=A,V._viewportElement=P,V._linkifier=U,V._linkifier2=N,V._charSizeService=H,V._optionsService=F,V._bufferService=q,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 g.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 G(D,E),Object.defineProperty(D.prototype,"onRequestRedraw",{get:function(){return new f.EventEmitter().event},enumerable:!1,configurable:!0}),D.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)},D.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,w=this._rowElements;L<w.length;L++){var A=w[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"},D.prototype.setColors=function(L){this._colors=L,this._injectCss()},D.prototype._injectCss=function(){var L=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var w=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";w+=this._terminalSelector+" span:not(."+g.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+g.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+g.ITALIC_CLASS+" { font-style: italic;}",w+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",w+="@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+"; }}",w+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+g.CURSOR_CLASS+"."+g.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+g.CURSOR_CLASS+"."+g.CURSOR_BLINK_CLASS+":not(."+g.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+g.CURSOR_CLASS+"."+g.CURSOR_BLINK_CLASS+"."+g.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+g.CURSOR_CLASS+"."+g.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+g.CURSOR_CLASS+"."+g.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+g.CURSOR_CLASS+"."+g.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",w+=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){w+=L._terminalSelector+" .xterm-fg-"+P+" { color: "+A.css+"; }"+L._terminalSelector+" .xterm-bg-"+P+" { background-color: "+A.css+"; }"}),w+=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=w},D.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},D.prototype._refreshRowElements=function(L,w){for(var A=this._rowElements.length;A<=w;A++){var P=document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}for(;this._rowElements.length>w;)this._rowContainer.removeChild(this._rowElements.pop())},D.prototype.onResize=function(L,w){this._refreshRowElements(L,w),this._updateDimensions()},D.prototype.onCharSizeChanged=function(){this._updateDimensions()},D.prototype.onBlur=function(){this._rowContainer.classList.remove("xterm-focus")},D.prototype.onFocus=function(){this._rowContainer.classList.add("xterm-focus")},D.prototype.onSelectionChanged=function(L,w,A){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(L&&w){var P=L[1]-this._bufferService.buffer.ydisp,U=w[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],w[0],H-N+1));else{var q=P===N?L[0]:0,V=N===H?w[0]:this._bufferService.cols;F.appendChild(this._createSelectionElement(N,q,V));var ne=H-N-1;if(F.appendChild(this._createSelectionElement(N+1,0,this._bufferService.cols,ne)),N!==H){var ce=U===H?w[0]:this._bufferService.cols;F.appendChild(this._createSelectionElement(H,0,ce))}}this._selectionContainer.appendChild(F)}}},D.prototype._createSelectionElement=function(L,w,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=w*this.dimensions.actualCellWidth+"px",U.style.width=this.dimensions.actualCellWidth*(A-w)+"px",U},D.prototype.onCursorMove=function(){},D.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},D.prototype.clear=function(){for(var L=0,w=this._rowElements;L<w.length;L++)w[L].innerHTML=""},D.prototype.renderRows=function(L,w){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<=w;N++){var H=this._rowElements[N];H.innerHTML="";var F=N+this._bufferService.buffer.ydisp,q=this._bufferService.buffer.lines.get(F),V=this._optionsService.options.cursorStyle;H.appendChild(this._rowFactory.createRow(q,F===A,V,P,U,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(D.prototype,"_terminalSelector",{get:function(){return".xterm-dom-renderer-owner-"+this._terminalClass},enumerable:!1,configurable:!0}),D.prototype.registerCharacterJoiner=function(L){return-1},D.prototype.deregisterCharacterJoiner=function(L){return!1},D.prototype._onLinkHover=function(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!0)},D.prototype._onLinkLeave=function(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!1)},D.prototype._setCellUnderline=function(L,w,A,P,U,N){for(;L!==w||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++)}},D=T([x(6,n.ICharSizeService),x(7,v.IOptionsService),x(8,v.IBufferService)],D)}(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),G=k(3),T=k(4),x=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 g=function(){function m(n,v,f){this._document=n,this._optionsService=v,this._colors=f,this._workCell=new T.CellData}return m.prototype.setColors=function(n){this._colors=n},m.prototype.createRow=function(n,v,f,c,l,u,p){for(var E=this._document.createDocumentFragment(),D=0,L=Math.min(n.length,p)-1;L>=0;L--)if(n.loadCell(L,this._workCell).getCode()!==G.NULL_CELL_CODE||v&&L===c){D=L+1;break}for(L=0;L<D;L++){n.loadCell(L,this._workCell);var w=this._workCell.getWidth();if(w!==0){var A=this._document.createElement("span");if(w>1&&(A.style.width=u*w+"px"),v&&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=G.WHITESPACE_CELL_CHAR:A.textContent=this._workCell.getChars()||G.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 q=P;P=N,N=q;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=x.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,v,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=x.color.ensureContrastRatio(v,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,v){n.setAttribute("style",""+(n.getAttribute("style")||"")+v+";")},m}();function O(m,n,v){for(;m.length<v;)m=n+m;return m}b.DomRendererRowFactory=g},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.evaluateKeyboardEvent=void 0;var I=k(12),G={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(T,x,g,O){var m={type:0,cancel:!1,key:void 0},n=(T.shiftKey?1:0)|(T.altKey?2:0)|(T.ctrlKey?4:0)|(T.metaKey?8:0);switch(T.keyCode){case 0:T.key==="UIKeyInputUpArrow"?m.key=x?I.C0.ESC+"OA":I.C0.ESC+"[A":T.key==="UIKeyInputLeftArrow"?m.key=x?I.C0.ESC+"OD":I.C0.ESC+"[D":T.key==="UIKeyInputRightArrow"?m.key=x?I.C0.ESC+"OC":I.C0.ESC+"[C":T.key==="UIKeyInputDownArrow"&&(m.key=x?I.C0.ESC+"OB":I.C0.ESC+"[B");break;case 8:if(T.shiftKey){m.key=I.C0.BS;break}if(T.altKey){m.key=I.C0.ESC+I.C0.DEL;break}m.key=I.C0.DEL;break;case 9:if(T.shiftKey){m.key=I.C0.ESC+"[Z";break}m.key=I.C0.HT,m.cancel=!0;break;case 13:m.key=T.altKey?I.C0.ESC+I.C0.CR:I.C0.CR,m.cancel=!0;break;case 27:m.key=I.C0.ESC,T.altKey&&(m.key=I.C0.ESC+I.C0.ESC),m.cancel=!0;break;case 37:if(T.metaKey)break;n?(m.key=I.C0.ESC+"[1;"+(n+1)+"D",m.key===I.C0.ESC+"[1;3D"&&(m.key=I.C0.ESC+(g?"b":"[1;5D"))):m.key=x?I.C0.ESC+"OD":I.C0.ESC+"[D";break;case 39:if(T.metaKey)break;n?(m.key=I.C0.ESC+"[1;"+(n+1)+"C",m.key===I.C0.ESC+"[1;3C"&&(m.key=I.C0.ESC+(g?"f":"[1;5C"))):m.key=x?I.C0.ESC+"OC":I.C0.ESC+"[C";break;case 38:if(T.metaKey)break;n?(m.key=I.C0.ESC+"[1;"+(n+1)+"A",g||m.key!==I.C0.ESC+"[1;3A"||(m.key=I.C0.ESC+"[1;5A")):m.key=x?I.C0.ESC+"OA":I.C0.ESC+"[A";break;case 40:if(T.metaKey)break;n?(m.key=I.C0.ESC+"[1;"+(n+1)+"B",g||m.key!==I.C0.ESC+"[1;3B"||(m.key=I.C0.ESC+"[1;5B")):m.key=x?I.C0.ESC+"OB":I.C0.ESC+"[B";break;case 45:T.shiftKey||T.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":x?I.C0.ESC+"OH":I.C0.ESC+"[H";break;case 35:m.key=n?I.C0.ESC+"[1;"+(n+1)+"F":x?I.C0.ESC+"OF":I.C0.ESC+"[F";break;case 33:T.shiftKey?m.type=2:m.key=I.C0.ESC+"[5~";break;case 34:T.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(!T.ctrlKey||T.shiftKey||T.altKey||T.metaKey)if(g&&!O||!T.altKey||T.metaKey)g&&!T.altKey&&!T.ctrlKey&&T.metaKey?T.keyCode===65&&(m.type=1):T.key&&!T.ctrlKey&&!T.altKey&&!T.metaKey&&T.keyCode>=48&&T.key.length===1?m.key=T.key:T.key&&T.ctrlKey&&T.key==="_"&&(m.key=I.C0.US);else{var v=G[T.keyCode],f=v&&v[T.shiftKey?1:0];if(f)m.key=I.C0.ESC+f;else if(T.keyCode>=65&&T.keyCode<=90){var c=T.ctrlKey?T.keyCode-64:T.keyCode+32;m.key=I.C0.ESC+String.fromCharCode(c)}}else T.keyCode>=65&&T.keyCode<=90?m.key=String.fromCharCode(T.keyCode-64):T.keyCode===32?m.key=I.C0.NUL:T.keyCode>=51&&T.keyCode<=55?m.key=String.fromCharCode(T.keyCode-51+27):T.keyCode===56?m.key=I.C0.DEL:T.keyCode===219?m.key=I.C0.ESC:T.keyCode===220?m.key=I.C0.FS:T.keyCode===221&&(m.key=I.C0.GS)}return m}},function(me,b,k){"use strict";var I,G=this&&this.__extends||(I=function(u,p){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,D){E.__proto__=D}||function(E,D){for(var L in D)D.hasOwnProperty(L)&&(E[L]=D[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)}),T=this&&this.__decorate||function(u,p,E,D){var L,w=arguments.length,A=w<3?p:D===null?D=Object.getOwnPropertyDescriptor(p,E):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,p,E,D);else for(var P=u.length-1;P>=0;P--)(L=u[P])&&(A=(w<3?L(A):w>3?L(p,E,A):L(p,E))||A);return w>3&&A&&Object.defineProperty(p,E,A),A},x=this&&this.__param||function(u,p){return function(E,D){p(E,D,u)}};Object.defineProperty(b,"__esModule",{value:!0}),b.RenderService=void 0;var g=k(31),O=k(0),m=k(2),n=k(32),v=k(7),f=k(1),c=k(5),l=function(u){function p(E,D,L,w,A,P){var U=u.call(this)||this;if(U._renderer=E,U._rowCount=D,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 g.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(w.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(v.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 G(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,D,L){L===void 0&&(L=!1),this._isPaused?this._needsFullRefresh=!0:(L||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(E,D,this._rowCount))},p.prototype._renderRows=function(E,D){this._renderer.renderRows(E,D),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:D}),this._isNextRenderRedrawOnly=!0},p.prototype.resize=function(E,D){this._rowCount=D,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 D=this;this._renderer.dispose(),this._renderer=E,this._renderer.onRequestRedraw(function(L){return D.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,D){this._renderer.onResize(E,D),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,D,L){this._selectionState.start=E,this._selectionState.end=D,this._selectionState.columnSelectMode=L,this._renderer.onSelectionChanged(E,D,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=T([x(3,f.IOptionsService),x(4,c.ICharSizeService),x(5,f.IBufferService)],p)}(m.Disposable);b.RenderService=l},function(me,b,k){"use strict";var I=this&&this.__decorate||function(m,n,v,f){var c,l=arguments.length,u=l<3?n:f===null?f=Object.getOwnPropertyDescriptor(n,v):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(m,n,v,f);else for(var p=m.length-1;p>=0;p--)(c=m[p])&&(u=(l<3?c(u):l>3?c(n,v,u):c(n,v))||u);return l>3&&u&&Object.defineProperty(n,v,u),u},G=this&&this.__param||function(m,n){return function(v,f){n(v,f,m)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CharSizeService=void 0;var T=k(1),x=k(0),g=function(){function m(n,v,f){this._optionsService=f,this.width=0,this.height=0,this._onCharSizeChange=new x.EventEmitter,this._measureStrategy=new O(n,v,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([G(2,T.IOptionsService)],m)}();b.CharSizeService=g;var O=function(){function m(n,v,f){this._document=n,this._parentElement=v,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,v){var f,c=arguments.length,l=c<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,n):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(O,m,n,v);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},G=this&&this.__param||function(O,m){return function(n,v){m(n,v,O)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseService=void 0;var T=k(5),x=k(30),g=function(){function O(m,n){this._renderService=m,this._charSizeService=n}return O.prototype.getCoords=function(m,n,v,f,c){return x.getCoords(m,n,v,f,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,c)},O.prototype.getRawByteCoords=function(m,n,v,f){var c=this.getCoords(m,n,v,f);return x.getRawByteCoords(c)},O=I([G(0,T.IRenderService),G(1,T.ICharSizeService)],O)}();b.MouseService=g},function(me,b,k){"use strict";var I,G=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)}),T=this&&this.__decorate||function(f,c,l,u){var p,E=arguments.length,D=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(D=(E<3?p(D):E>3?p(c,l,D):p(c,l))||D);return E>3&&D&&Object.defineProperty(c,l,D),D},x=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 g=k(1),O=k(0),m=k(2),n=k(7),v=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 G(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 D=p[E];if(D.classList.contains("xterm"))break;if(D.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(D,L){var w;u?!((w=p._activeProviderReplies)===null||w===void 0)&&w.get(L)&&(E=p._checkLinkProviderResult(L,l,E)):D.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 D=u.get(E);if(D)for(var L=0;L<D.length;L++)for(var w=D[L],A=w.link.range.start.y<l?0:w.link.range.start.x,P=w.link.range.end.y>l?this._bufferService.cols:w.link.range.end.x,U=A;U<=P;U++){if(p.has(U)){D.splice(L--,1);break}p.add(U)}}},c.prototype._checkLinkProviderResult=function(l,u,p){var E,D=this;if(!this._activeProviderReplies)return p;for(var L=this._activeProviderReplies.get(l),w=!1,A=0;A<l;A++)this._activeProviderReplies.has(A)&&!this._activeProviderReplies.get(A)||(w=!0);if(!w&&L){var P=L.find(function(N){return D._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 D._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,D;return(D=(E=u._currentLink)===null||E===void 0?void 0:E.state)===null||D===void 0?void 0:D.decorations.pointerCursor},set:function(E){var D,L;!((D=u._currentLink)===null||D===void 0)&&D.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,D;return(D=(E=u._currentLink)===null||E===void 0?void 0:E.state)===null||D===void 0?void 0:D.decorations.underline},set:function(E){var D,L,w;!((D=u._currentLink)===null||D===void 0)&&D.state&&((w=(L=u._currentLink)===null||L===void 0?void 0:L.state)===null||w===void 0?void 0:w.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 D=E.start===0?0:E.start+1+u._bufferService.buffer.ydisp;u._clearCurrentLink(D,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,D=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(D)},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,D=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||D&&l.range.start.x<=u.x||E&&D)&&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,D){return{x1:l,y1:u,x2:p,y2:E,cols:this._bufferService.cols,fg:D}},c=T([x(0,g.IBufferService)],c)}(m.Disposable);b.Linkifier2=v},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CoreBrowserService=void 0;var I=function(){function G(T){this._textarea=T}return Object.defineProperty(G.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),G}();b.CoreBrowserService=I},function(me,b,k){"use strict";var I,G=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 T=k(2),x=k(1),g=k(66),O=k(67),m=k(68),n=k(74),v=k(75),f=k(0),c=k(76),l=k(77),u=k(78),p=k(80),E=k(81),D=k(19),L=k(82),w=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 g.InstantiationService,N.optionsService=new n.OptionsService(U),N._instantiationService.setService(x.IOptionsService,N.optionsService),N._bufferService=N.register(N._instantiationService.createInstance(m.BufferService)),N._instantiationService.setService(x.IBufferService,N._bufferService),N._logService=N._instantiationService.createInstance(O.LogService),N._instantiationService.setService(x.ILogService,N._logService),N._coreService=N.register(N._instantiationService.createInstance(v.CoreService,function(){return N.scrollToBottom()})),N._instantiationService.setService(x.ICoreService,N._coreService),N._coreMouseService=N._instantiationService.createInstance(c.CoreMouseService),N._instantiationService.setService(x.ICoreMouseService,N._coreMouseService),N._dirtyRowService=N._instantiationService.createInstance(l.DirtyRowService),N._instantiationService.setService(x.IDirtyRowService,N._dirtyRowService),N.unicodeService=N._instantiationService.createInstance(u.UnicodeService),N._instantiationService.setService(x.IUnicodeService,N.unicodeService),N._charsetService=N._instantiationService.createInstance(p.CharsetService),N._instantiationService.setService(x.ICharsetService,N._charsetService),N._inputHandler=new D.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 G(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 q=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 ce=V-q+1;F.lines.shiftElements(q+1,ce-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}(T.Disposable);b.CoreTerminal=w},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 v=Array(O),f=0;for(m=0;m<n;m++)for(var c=arguments[m],l=0,u=c.length;l<u;l++,f++)v[f]=c[l];return v};Object.defineProperty(b,"__esModule",{value:!0}),b.InstantiationService=b.ServiceCollection=void 0;var G=k(1),T=k(14),x=function(){function O(){for(var m=[],n=0;n<arguments.length;n++)m[n]=arguments[n];this._entries=new Map;for(var v=0,f=m;v<f.length;v++){var c=f[v],l=c[0],u=c[1];this.set(l,u)}}return O.prototype.set=function(m,n){var v=this._entries.get(m);return this._entries.set(m,n),v},O.prototype.forEach=function(m){this._entries.forEach(function(n,v){return m(v,n)})},O.prototype.has=function(m){return this._entries.has(m)},O.prototype.get=function(m){return this._entries.get(m)},O}();b.ServiceCollection=x;var g=function(){function O(){this._services=new x,this._services.set(G.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=[],v=1;v<arguments.length;v++)n[v-1]=arguments[v];for(var f=T.getServiceDependencies(m).sort(function(L,w){return L.index-w.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 D=f.length>0?f[0].index:n.length;if(n.length!==D)throw new Error("[createInstance] First service dependency of "+m.name+" at position "+(D+1)+" conflicts with "+n.length+" static arguments");return new(m.bind.apply(m,I([void 0],I(n,c))))},O}();b.InstantiationService=g},function(me,b,k){"use strict";var I=this&&this.__decorate||function(n,v,f,c){var l,u=arguments.length,p=u<3?v:c===null?c=Object.getOwnPropertyDescriptor(v,f):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(n,v,f,c);else for(var E=n.length-1;E>=0;E--)(l=n[E])&&(p=(u<3?l(p):u>3?l(v,f,p):l(v,f))||p);return u>3&&p&&Object.defineProperty(v,f,p),p},G=this&&this.__param||function(n,v){return function(f,c){v(f,c,n)}},T=this&&this.__spreadArrays||function(){for(var n=0,v=0,f=arguments.length;v<f;v++)n+=arguments[v].length;var c=Array(n),l=0;for(v=0;v<f;v++)for(var u=arguments[v],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 x,g=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"})(x=b.LogLevel||(b.LogLevel={}));var O={debug:x.DEBUG,info:x.INFO,warn:x.WARN,error:x.ERROR,off:x.OFF},m=function(){function n(v){var f=this;this._optionsService=v,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(v){for(var f=0;f<v.length;f++)typeof v[f]=="function"&&(v[f]=v[f]())},n.prototype._log=function(v,f,c){this._evalLazyOptionalParams(c),v.call.apply(v,T([console,"xterm.js: "+f],c))},n.prototype.debug=function(v){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=x.DEBUG&&this._log(console.log,v,f)},n.prototype.info=function(v){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=x.INFO&&this._log(console.info,v,f)},n.prototype.warn=function(v){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=x.WARN&&this._log(console.warn,v,f)},n.prototype.error=function(v){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=x.ERROR&&this._log(console.error,v,f)},n=I([G(0,g.IOptionsService)],n)}();b.LogService=m},function(me,b,k){"use strict";var I,G=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)}),T=this&&this.__decorate||function(f,c,l,u){var p,E=arguments.length,D=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(D=(E<3?p(D):E>3?p(c,l,D):p(c,l))||D);return E>3&&D&&Object.defineProperty(c,l,D),D},x=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 g=k(1),O=k(69),m=k(0),n=k(2);b.MINIMUM_COLS=2,b.MINIMUM_ROWS=1;var v=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 G(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=T([x(0,g.IOptionsService)],c)}(n.Disposable);b.BufferService=v},function(me,b,k){"use strict";var I,G=this&&this.__extends||(I=function(O,m){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,v){n.__proto__=v}||function(n,v){for(var f in v)v.hasOwnProperty(f)&&(n[f]=v[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 T=k(70),x=k(0),g=function(O){function m(n,v){var f=O.call(this)||this;return f._onBufferActivate=f.register(new x.EventEmitter),f._normal=new T.Buffer(!0,n,v),f._normal.fillViewportRows(),f._alt=new T.Buffer(!1,n,v),f._activeBuffer=f._normal,f.setupTabStops(),f}return G(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,v){this._normal.resize(n,v),this._alt.resize(n,v)},m.prototype.setupTabStops=function(n){this._normal.setupTabStops(n),this._alt.setupTabStops(n)},m}(k(2).Disposable);b.BufferSet=g},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),G=k(16),T=k(4),x=k(3),g=k(72),O=k(73),m=k(20),n=k(6);b.MAX_BUFFER_SIZE=4294967295;var v=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=G.DEFAULT_ATTR_DATA.clone(),this.savedCharset=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=T.CellData.fromCharData([0,x.NULL_CELL_CHAR,x.NULL_CELL_WIDTH,x.NULL_CELL_CODE]),this._whitespaceCell=T.CellData.fromCharData([0,x.WHITESPACE_CELL_CHAR,x.WHITESPACE_CELL_WIDTH,x.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 G.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=G.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(G.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 D=0;D<this.lines.length;D++)this.lines.get(D).resize(l,p);var L=0;if(this._rows<u)for(var w=this._rows;w<u;w++)this.lines.length<u+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new G.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 G.BufferLine(l,p)));else for(w=this._rows;w>u;w--)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(D=0;D<this.lines.length;D++)this.lines.get(D).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=g.reflowLargerGetLinesToRemove(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(G.DEFAULT_ATTR_DATA));if(p.length>0){var E=g.reflowLargerCreateNewLayout(this.lines,p);g.reflowLargerApplyNewLayout(this.lines,E.layout),this._reflowLargerAdjustViewport(l,u,E.countRemoved)}},c.prototype._reflowLargerAdjustViewport=function(l,u,p){for(var E=this.getNullCell(G.DEFAULT_ATTR_DATA),D=p;D-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new G.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(G.DEFAULT_ATTR_DATA),E=[],D=0,L=this.lines.length-1;L>=0;L--){var w=this.lines.get(L);if(!(!w||!w.isWrapped&&w.getTrimmedLength()<=l)){for(var A=[w];w.isWrapped&&L>0;)w=this.lines.get(--L),A.unshift(w);var P=this.ybase+this.y;if(!(P>=L&&P<L+A.length)){var U=A[A.length-1].getTrimmedLength(),N=g.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 q=[],V=0;V<H;V++){var ne=this.getBlankLine(G.DEFAULT_ATTR_DATA,!0);q.push(ne)}q.length>0&&(E.push({start:L+A.length+D,newLines:q}),D+=q.length),A.push.apply(A,q);var ce=N.length-1,ee=N[ce];ee===0&&(ee=N[--ce]);for(var z=A.length-H-1,Z=U;z>=0;){var M=Math.min(Z,ee);if(A[ce].copyCellsFrom(A[z],Z-M,ee-M,M,!0),(ee-=M)===0&&(ee=N[--ce]),(Z-=M)===0){z--;var K=Math.max(z,0);Z=g.getWrappedLineTrimmedLength(A,K,this._cols)}}for(V=0;V<A.length;V++)N[V]<l&&A[V].setCell(N[V],p);for(var j=H-F;j-- >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+D)-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 Y=this.lines.length,ie=Y-1,ve=0,Me=E[ve];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+D);var ze=0;for(V=Math.min(this.lines.maxLength-1,Y+D-1);V>=0;V--)if(Me&&Me.start>ie+ze){for(var Ee=Me.newLines.length-1;Ee>=0;Ee--)this.lines.set(V--,Me.newLines[Ee]);V++,R.push({index:ie+1,amount:Me.newLines.length}),ze+=Me.newLines.length,Me=E[++ve]}else this.lines.set(V,C[ie--]);var Ve=0;for(V=R.length-1;V>=0;V--)R[V].index+=Ve,this.lines.onInsertEmitter.fire(R[V]),Ve+=R[V].amount;var Oe=Math.max(0,Y+D-this.lines.maxLength);Oe>0&&this.lines.onTrimEmitter.fire(Oe)}},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 D=p?E.getTrimmedLength():E.length,L=0;L<D;++L)if(E.get(L)[x.CHAR_DATA_WIDTH_INDEX]&&(u-=E.get(L)[x.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 D=this.lines.get(l);return D?D.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,D){return new f(this,l,u,p,E,D)},c}();b.Buffer=v;var f=function(){function c(l,u,p,E,D,L){p===void 0&&(p=0),E===void 0&&(E=l.lines.length),D===void 0&&(D=0),L===void 0&&(L=0),this._buffer=l,this._trimRight=u,this._startIndex=p,this._endIndex=E,this._startOverscan=D,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),G=function(){function T(x){this._maxLength=x,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(T.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"maxLength",{get:function(){return this._maxLength},set:function(x){if(this._maxLength!==x){for(var g=new Array(x),O=0;O<Math.min(x,this.length);O++)g[O]=this._array[this._getCyclicIndex(O)];this._array=g,this._maxLength=x,this._startIndex=0}},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"length",{get:function(){return this._length},set:function(x){if(x>this._length)for(var g=this._length;g<x;g++)this._array[g]=void 0;this._length=x},enumerable:!1,configurable:!0}),T.prototype.get=function(x){return this._array[this._getCyclicIndex(x)]},T.prototype.set=function(x,g){this._array[this._getCyclicIndex(x)]=g},T.prototype.push=function(x){this._array[this._getCyclicIndex(this._length)]=x,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},T.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(T.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!1,configurable:!0}),T.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},T.prototype.splice=function(x,g){for(var O=[],m=2;m<arguments.length;m++)O[m-2]=arguments[m];if(g){for(var n=x;n<this._length-g;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+g)];this._length-=g}for(n=this._length-1;n>=x;n--)this._array[this._getCyclicIndex(n+O.length)]=this._array[this._getCyclicIndex(n)];for(n=0;n<O.length;n++)this._array[this._getCyclicIndex(x+n)]=O[n];if(this._length+O.length>this._maxLength){var v=this._length+O.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=O.length},T.prototype.trimStart=function(x){x>this._length&&(x=this._length),this._startIndex+=x,this._length-=x,this.onTrimEmitter.fire(x)},T.prototype.shiftElements=function(x,g,O){if(!(g<=0)){if(x<0||x>=this._length)throw new Error("start argument out of range");if(x+O<0)throw new Error("Cannot shift elements in list beyond index 0");if(O>0){for(var m=g-1;m>=0;m--)this.set(x+m+O,this.get(x+m));var n=x+g+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<g;m++)this.set(x+m+O,this.get(x+m))}},T.prototype._getCyclicIndex=function(x){return(this._startIndex+x)%this._maxLength},T}();b.CircularList=G},function(me,b,k){"use strict";function I(G,T,x){if(T===G.length-1)return G[T].getTrimmedLength();var g=!G[T].hasContent(x-1)&&G[T].getWidth(x-1)===1,O=G[T+1].getWidth(0)===2;return g&&O?x-1:x}Object.defineProperty(b,"__esModule",{value:!0}),b.getWrappedLineTrimmedLength=b.reflowSmallerGetNewLineLengths=b.reflowLargerApplyNewLayout=b.reflowLargerCreateNewLayout=b.reflowLargerGetLinesToRemove=void 0,b.reflowLargerGetLinesToRemove=function(G,T,x,g,O){for(var m=[],n=0;n<G.length-1;n++){var v=n,f=G.get(++v);if(f.isWrapped){for(var c=[G.get(n)];v<G.length&&f.isWrapped;)c.push(f),f=G.get(++v);if(g>=n&&g<v)n+=c.length-1;else{for(var l=0,u=I(c,l,T),p=1,E=0;p<c.length;){var D=I(c,p,T),L=D-E,w=x-u,A=Math.min(L,w);c[l].copyCellsFrom(c[p],E,u,A,!1),(u+=A)===x&&(l++,u=0),(E+=A)===D&&(p++,E=0),u===0&&l!==0&&c[l-1].getWidth(x-1)===2&&(c[l].copyCellsFrom(c[l-1],x-1,u++,1,!1),c[l-1].setCell(x-1,O))}c[l].replaceCells(u,x,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(G,T){for(var x=[],g=0,O=T[g],m=0,n=0;n<G.length;n++)if(O===n){var v=T[++g];G.onDeleteEmitter.fire({index:n-m,amount:v}),n+=v-1,m+=v,O=T[++g]}else x.push(n);return{layout:x,countRemoved:m}},b.reflowLargerApplyNewLayout=function(G,T){for(var x=[],g=0;g<T.length;g++)x.push(G.get(T[g]));for(g=0;g<x.length;g++)G.set(g,x[g]);G.length=T.length},b.reflowSmallerGetNewLineLengths=function(G,T,x){for(var g=[],O=G.map(function(u,p){return I(G,p,T)}).reduce(function(u,p){return u+p}),m=0,n=0,v=0;v<O;){if(O-v<x){g.push(O-v);break}m+=x;var f=I(G,n,T);m>f&&(m-=f,n++);var c=G[n].getWidth(m-1)===2;c&&m--;var l=c?x-1:x;g.push(l),v+=l}return g},b.getWrappedLineTrimmedLength=I},function(me,b,k){"use strict";var I,G=this&&this.__extends||(I=function(g,O){return(I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,n){m.__proto__=n}||function(m,n){for(var v in n)n.hasOwnProperty(v)&&(m[v]=n[v])})(g,O)},function(g,O){function m(){this.constructor=g}I(g,O),g.prototype=O===null?Object.create(O):(m.prototype=O.prototype,new m)});Object.defineProperty(b,"__esModule",{value:!0}),b.Marker=void 0;var T=k(0),x=function(g){function O(m){var n=g.call(this)||this;return n.line=m,n._id=O._nextId++,n.isDisposed=!1,n._onDispose=new T.EventEmitter,n}return G(O,g),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=x},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),G=k(11),T=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:G.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",convertEol:!1,termName:"xterm",cancelEvents:!1});var x=["cols","rows"],g=function(){function O(m){this._onOptionChange=new I.EventEmitter,this.options=T.clone(b.DEFAULT_OPTIONS);for(var n=0,v=Object.keys(m);n<v.length;n++){var f=v[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(x.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=g},function(me,b,k){"use strict";var I,G=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 D in E)E.hasOwnProperty(D)&&(p[D]=E[D])})(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)}),T=this&&this.__decorate||function(l,u,p,E){var D,L=arguments.length,w=L<3?u:E===null?E=Object.getOwnPropertyDescriptor(u,p):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(l,u,p,E);else for(var A=l.length-1;A>=0;A--)(D=l[A])&&(w=(L<3?D(w):L>3?D(u,p,w):D(u,p))||w);return L>3&&w&&Object.defineProperty(u,p,w),w},x=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 g=k(1),O=k(0),m=k(33),n=k(2),v=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,D,L){var w=l.call(this)||this;return w._bufferService=E,w._logService=D,w._optionsService=L,w.isCursorInitialized=!1,w.isCursorHidden=!1,w._onData=w.register(new O.EventEmitter),w._onUserInput=w.register(new O.EventEmitter),w._onBinary=w.register(new O.EventEmitter),w._scrollToBottom=p,w.register({dispose:function(){return w._scrollToBottom=void 0}}),w.modes=m.clone(v),w.decPrivateModes=m.clone(f),w}return G(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(v),this.decPrivateModes=m.clone(f)},u.prototype.triggerDataEvent=function(p,E){if(E===void 0&&(E=!1),!this._optionsService.options.disableStdin){var D=this._bufferService.buffer;D.ybase!==D.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=T([x(1,g.IBufferService),x(2,g.ILogService),x(3,g.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,D=E<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,c,l,u);else for(var L=f.length-1;L>=0;L--)(p=f[L])&&(D=(E<3?p(D):E>3?p(c,l,D):p(c,l))||D);return E>3&&D&&Object.defineProperty(c,l,D),D},G=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 T=k(1),x=k(0),g={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}},v=function(){function f(c,l){this._bufferService=c,this._coreService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new x.EventEmitter,this._lastEvent=null;for(var u=0,p=Object.keys(g);u<p.length;u++){var E=p[u];this.addProtocol(E,g[E])}for(var D=0,L=Object.keys(n);D<L.length;D++){var w=L[D];this.addEncoding(w,n[w])}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([G(0,T.IBufferService),G(1,T.ICoreService)],f)}();b.CoreMouseService=v},function(me,b,k){"use strict";var I=this&&this.__decorate||function(g,O,m,n){var v,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(g,O,m,n);else for(var l=g.length-1;l>=0;l--)(v=g[l])&&(c=(f<3?v(c):f>3?v(O,m,c):v(O,m))||c);return f>3&&c&&Object.defineProperty(O,m,c),c},G=this&&this.__param||function(g,O){return function(m,n){O(m,n,g)}};Object.defineProperty(b,"__esModule",{value:!0}),b.DirtyRowService=void 0;var T=k(1),x=function(){function g(O){this._bufferService=O,this.clearRange()}return Object.defineProperty(g.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),g.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},g.prototype.markDirty=function(O){O<this._start?this._start=O:O>this._end&&(this._end=O)},g.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)},g.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},g=I([G(0,T.IBufferService)],g)}();b.DirtyRowService=x},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UnicodeService=void 0;var I=k(0),G=k(79),T=function(){function x(){this._providers=Object.create(null),this._active="",this._onChange=new I.EventEmitter;var g=new G.UnicodeV6;this.register(g),this._active=g.version,this._activeProvider=g}return Object.defineProperty(x.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"activeVersion",{get:function(){return this._active},set:function(g){if(!this._providers[g])throw new Error('unknown Unicode version "'+g+'"');this._active=g,this._activeProvider=this._providers[g],this._onChange.fire(g)},enumerable:!1,configurable:!0}),x.prototype.register=function(g){this._providers[g.version]=g},x.prototype.wcwidth=function(g){return this._activeProvider.wcwidth(g)},x.prototype.getStringCellWidth=function(g){for(var O=0,m=g.length,n=0;n<m;++n){var v=g.charCodeAt(n);if(55296<=v&&v<=56319){if(++n>=m)return O+this.wcwidth(v);var f=g.charCodeAt(n);56320<=f&&f<=57343?v=1024*(v-55296)+f-56320+65536:O+=this.wcwidth(f)}O+=this.wcwidth(v)}return O},x}();b.UnicodeService=T},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UnicodeV6=void 0;var I,G=k(15),T=[[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]],x=[[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]],g=function(){function O(){if(this.version="6",!I){I=new Uint8Array(65536),G.fill(I,1),I[0]=0,G.fill(I,0,1,32),G.fill(I,0,127,160),G.fill(I,2,4352,4448),I[9001]=2,I[9002]=2,G.fill(I,2,11904,42192),I[12351]=1,G.fill(I,2,44032,55204),G.fill(I,2,63744,64256),G.fill(I,2,65040,65050),G.fill(I,2,65072,65136),G.fill(I,2,65280,65377),G.fill(I,2,65504,65511);for(var m=0;m<T.length;++m)G.fill(I,0,T[m][0],T[m][1]+1)}}return O.prototype.wcwidth=function(m){return m<32?0:m<127?1:m<65536?I[m]:function(n,v){var f,c=0,l=v.length-1;if(n<v[0][0]||n>v[l][1])return!1;for(;l>=c;)if(n>v[f=c+l>>1][1])c=f+1;else{if(!(n<v[f][0]))return!0;l=f-1}return!1}(m,x)?0:m>=131072&&m<=196605||m>=196608&&m<=262141?2:1},O}();b.UnicodeV6=g},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CharsetService=void 0;var I=function(){function G(){this.glevel=0,this._charsets=[]}return G.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},G.prototype.setgLevel=function(T){this.glevel=T,this.charset=this._charsets[T]},G.prototype.setgCharset=function(T,x){this._charsets[T]=x,this.glevel===T&&(this.charset=x)},G}();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(G){var T=G.buffer.lines.get(G.buffer.ybase+G.buffer.y-1),x=T==null?void 0:T.get(G.cols-1),g=G.buffer.lines.get(G.buffer.ybase+G.buffer.y);g&&x&&(g.isWrapped=x[I.CHAR_DATA_CODE_INDEX]!==I.NULL_CELL_CODE&&x[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 G(T){this._action=T,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return G.prototype.writeSync=function(T){if(this._writeBuffer.length){for(var x=this._bufferOffset;x<this._writeBuffer.length;++x){var g=this._writeBuffer[x],O=this._callbacks[x];this._action(g),O&&O()}this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=2147483647}this._action(T)},G.prototype.write=function(T,x){var g=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 g._innerWrite()})),this._pendingData+=T.length,this._writeBuffer.push(T),this._callbacks.push(x)},G.prototype._innerWrite=function(){for(var T=this,x=Date.now();this._writeBuffer.length>this._bufferOffset;){var g=this._writeBuffer[this._bufferOffset],O=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(g),this._pendingData-=g.length,O&&O(),Date.now()-x>=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 T._innerWrite()},0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},G}();b.WriteBuffer=I},function(me,b,k){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.AddonManager=void 0;var I=function(){function G(){this._addons=[]}return G.prototype.dispose=function(){for(var T=this._addons.length-1;T>=0;T--)this._addons[T].instance.dispose()},G.prototype.loadAddon=function(T,x){var g=this,O={instance:x,dispose:x.dispose,isDisposed:!1};this._addons.push(O),x.dispose=function(){return g._wrappedAddonDispose(O)},x.activate(T)},G.prototype._wrappedAddonDispose=function(T){if(!T.isDisposed){for(var x=-1,g=0;g<this._addons.length;g++)if(this._addons[g]===T){x=g;break}if(x===-1)throw new Error("Could not dispose an addon that has not been loaded");T.isDisposed=!0,T.dispose.apply(T.instance),this._addons.splice(x,1)}},G}();b.AddonManager=I}])})},93314:function(ft){"use strict";ft.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAACaCAYAAADl9acYAAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQd4U1Ubfs/NaJtO9kzLahFQEJkiUBBFUFFkCCjiAAVFERT5FREQQQXBBcpysWRP2RtkKRsEOphNodCZdDfjnv85CU2TZt2bhABNDw9PmtzvrO+c957xLQIP0pkz1yrQIEmwwcDzHhTj91klEo7jpcG5zetWUJdmRjmPvTM9GI9JgSGvadOoLE9KJJ5kPp2YXLtZdO1kT8ooz2vigCNelvPYezPEG7z0CDAn4pJqPvJA5A3vdcl/S3LEy3Iee29OeIOX5YDx3nh4VFI5YDxin6DM5YARxKb7g6gcMHd+nMoBc+d57LKGhCQ1ZURBCoVL2nKCO8sBZWW50x1TOWDuLP8FlV4OGEFs8glROWB8wmbPKikHjGf882bucsB4k5t3qKxywNwhxrpRbJkGTOx0ehlA3d9e5VEtzA3ulGe55zmg1QOfrCVo34BgQGvr5rLDRl4RRZG+5NjBESBc4FHw1LlrCAuPsCo0JjKi7J5hYqfTXADBq4byCJLf82Nf3kA3OfD9LgKdgeCzZ4CUTJ1VKQFyKQgpmeMSjiKvQC+oplspN/wOMDcBVFv0Bo+KwYJ4VE50H3Jg7j6CWzkEX74A3MrSgTfeKZpSaBCHcAVn/JunBHlFPDR5BkG9LMjPt7mZLOtbskQADea9wqOW9coqiGHlRPcHBxYcJriQQvB9P+v2cqCwWFxgoOJk6JeTNX4HmJMAHv6xP4/6VXw/+OxNx/bM/pIohdUE9VW/VxwjOHiJYO5A6xolpGSpYW3jIW4w/A8wM+h+UHSY2pvHgzV9NXymeor0wPc7Cf7XzWJ/4Nsm+Ly2LzZx+OwZ3yuVbzhNsPEMwcI3rM8wMikHiURi5gNbbQoKrc84zpjkj2eYzQC6f96DomUd305ctrp8tp5gSk/f1utzlFhUOHYthy9f8D1gdpwnWHiEYOVQ6zNM6QM/AY+CImHnF9YtfwTMCgB9P+5G0SHa9xP3bk2gT9cBU3r6Hjp95nBYNcz3gDlwkRhX843vlfS59PmFHfjFzgC/2pJ1nEEnEIpIAG+834Wia2Ox7PJ8wt0twLz7J8Gsl3zf316zCVYPsz5oe85F1yUcu0YwcQPBjlElZyjL8wsrQeyBn+XxK8DETqefgyACFCPe6kjxfDPfT6C7BpilBLMG+L6/A34h+P1VikCZ60nuTYpzN4AxqznjCqPOMZ1RSp9f2OVLYZH1lbOrNvjVlswIGEAKYOyrj1K82NL3E+huAWbEMnbFSn1+Qzd4AcE3fajPZV6X04D3lnHGM4xOawKFJwLLYiD5H2AoCkHwJQMLA42v090CzJjVBBN7UCh8rN3AgDrqCYq6lX3L6RQ1MGQRhwWvA7UrALbnFzCJjOhG+d2WjFCkUYKZPZpSDIv1PWDGrycY34NCahI0+yxN/Ivg3c4UlUN8VqWxok/XEfRrSdG0tm/rzcoHBv7KYc5AILqqLWDcOb/45RmGEFyhFL8/0Yga33y+Tl9uJhjxOEVIoG9rnrqVKSJSRFb0fb3tG1A81sC39TLRSu85HL57Eaii0Bm3oqEKqZXSJaUURUxTU0Tyuy0ZAc5SYCUbxE+6+x4w3+0kGNiWooqP3/Qz9xB0bUTRsLqI2eEFUlbvA9WBJxv5ltdMit9jFocpLwB1InQIkBEQTmLUHStOBoMBOr24K2+/AwwPHOKArS2iKCY9VzKIg34jyMgTv6f1wpwqL8JLHKgUTLHwjZIxZTKg0V2Bzg2tLzvYBYA75xe/25J1mkEnGAzYyXE40KQmMK23uLeLN8b1j0ME7epTxFTzRmnCy/jzXyCqIny+NVryDzFeKfd+xLcrDOMMO8MMfgx45iFrOZA7AstiTvvVoZ91usM3tClHcLpeZWDmAN8DZtlRgkY1KJr5+BC87hQQLAeebCwcZN6gXH6MgG2P+rfyDmD+WLoV8xZugkIRiNh2TTHghcfRoF4tFBZpkXgpGQ81rmdu9puLOLzwMPBYPR1Cgzw/v7CC/WpLxjrc/jtaT2LApRrhwC+DfA+Y9aeI0dKzbT3vTCChk3r7eaBABzzfTGgO79CtPUmM9b7U2jv9bf3kOyjSlihLcoSg93MdkZ2Th227j2Hoq8/inTeeNzZ+xFIOsTHAsw/pAeL5+cUvAdPuG1pVRnArQgEsGex7wGw7RxAgBTo19M4EEjqtD1wEkrPYm15oDu/QbfkPSM0hHsu8du0/gSnfLkFGVrbThjFLynULJ6FOZHUw2RNbyd/qUJLFHZV+ywr9aksWO4Ou0BK8KueRz/bVq++CUuD+RGbhB3R/0LeAOZEEnFIRvPGYb+vdGw+cvU7w3uOe1dv+mfeRk5svCMUfvz8AA3o9jgkbCJQVgPe7lGTz5MDvj4f+VXs/JH1ip1PmAkHy17u8z42bjl4lxjf9C809m0CCZo4FUVwKsDPOJLz0ZTp6Fdh6jtnWe1bvuCm/4q/tRwQ1/b03e2LIwGfw1RaCkADg425AOvPkYCHZd0cG43dbsk4zaDFgWHiHcG85wjBQoEhnMhAzf5r/Jihkf9/+fjXDtDXqGA108+Eqcy0DYAfwMU95NnEFzVgLovibwK8HCab19qze61s24Pf5K7A5KwB5vHM1CblMij9m/Q87rtc1jsek54CMPIBayGD0BgP0ImUw/gwYFiqjllhHGAcvAkuPcijU8cgv0KGgSGv8LNJqweu1MOh14A3ss+S78W+Dzuo3RsPoTy0YgIjQALFz0C36tBzg570EE3p4NnHFVn5TA0zaSPDzy57Vu2bIS6jF67BDHYBHgnVI0kow+6ZjLyZNm9RD+35jkZINfNO7ZIVhEn+e16NQ6157/OqWjJ1h9n1IXoydTi8AeGD+KzxqinCEsfkswfBJC2HQacXOG7v0B+e9CGXVUK+U5aoQdm5iE3eqh296R/XoDEBu0e3/hcz3FzF+Z292trI91Zgav7N2tKrDrrfFTdgTI4dAl61BipZDDXYINRCMvBrusNvBikAMHT8LTM3/pwElK4xMAuQV6uBuKK4yA5hEVfY8SvmmHCETGyjDtzqbQLHf0KMgaCnWEcaW/whGT1mAHHZP6oW09bueaFy3khdKcl0EO+y+v4xgphs2MWxbs+K46bLCDIoi6+9iVLKY4PbTp8UB5t8h/UB53qimz1aJA9lyLExz7H1vyMCnUa15L/x9EfhtkIk/nh74y9ShPz5JnUGA26qFZIdcTofWqR5xxd5Uip1O9wDoJNYRxs4LBB9PXYxUdaHrGSqAYuWUp9GmSQ0BlN4h8cTq8qVfOGgKStpBeAoJb4DEYPrPsU89b/5e/LvEYPubLCIQX06NEtWpfwa/yA4h0FEgqVCK71OCUeTARdLLfbpg9PAXsfGsBBtOA0uHmKpyV0PZsqFl5lo5QaXWgRqNw4pTHiEYGa2M+KX0yMROpxsA9BDrCGNvAsG4GcuQdMt45eJx+nXsk3iyNbOY9k161wOry8/GqZCr1t4GBA/O3T0Nm7gSDl/89IBRHiU0nRk3CgU3knEmT4pZN51rrjI5TN2oGmCOMP44BKx7B8jINemP8ZRCK2Y5LNXAMrMlS0hSpwKw9TRGME+XHf5ekybEfPCInU7/BDBArCOMw5cIPvt+JRJUGqHj7JRu2rsd0P+JGBuanELTTVpwwO3/cnjFxNcTwMz95hquxud5pd+skIEfR6NJA+F2y6o1S3Fj4xpj/X9lBmK7OsDuChMUKMf+v36AXC4Fc4QxYwew/X0gM8/k5VKvN0BvcF9gfc8CJuGWuh4twgoQnJSBzK+nDP+3eLTsBahJSNL8DdD29kaUAFsDSU4vpVJp3FTETqdzAbwl1hHGySSCCTPX41RimlcmzthBrTCsV1Obss5cJ2hWXQupTIoiHUW+1nRYZkcn5kRbTzlIOQq5hBmimfRu2RwoeU4gl5rAFiI3Odpmb/NRK0zXu+zgKzZtWZWK/VvTxWZzSP/EK5HoEivcxsFQWIBzk8caVxmWmMT+g6thNlfMg/p1xYfv9DXSMEcYEzYAu247wnBXQ9myE/fslixRpf6FUgw2N5bgDChmk6Lw33MMqkqlg8JeVKmn8hRjHI0QIdgbiJynGWhiZ9AZoPhgaEeK50Q4wmDCvwmzt+HwGe8EcH67V1N8MshWV4UBpnlNLQID3Lcn5nkKrZ6iUEex4azEqC08di0BW1XDgsTP+2NHsrH6F+/0m9Xetns1PN9b3IWHPi8XyetXIOPoEeg1WbhYKMGK9CCoiiSoWq0SnuvWzqhLVuyoz+wI411mmi3epZI9Lt2zgElIUht9INtpdDJPMUsSGf59NCFFxc8TknI6AoZ9LqbCmj+V4X33zMAEAOMHtaXoJ0KLVpUJjJuzD3v+vSh+xtnJ0ffxaMwY0dHuCtO8pg6BAcK3LI4axCTai/4hRsBM3kww5DGK6o5vYx32S52pw9QxbEi8k6o2DMeoj2q5VVhqNnB29JsI0TP5M6Dj5Gg7dwmkpVZOsyOMtyg4joDyBhRq3d+Osbru3S2ZSp0LCmf+9ZM5CUY3qBWx3LREUy5RpbkKQOl0FAimvrksPAME08Q6wmD74DGz/8H2A/+5NdClM8U2r4VFE7rZBcwjtXQIkHsOGLbSLP7XBJhvdxD0fJiinhs+pVk5n41IBM/UFryQSHggvpxRooovpsgdFwjoD8MQri3ZIso/XYzm9a2FwDfUAFPxX/AaRYSCeCR/KW7fvQuYJE0RQF3vSQh2UQn3bsOaYXEJSZrPADrJBfP5BceCVx+4LO0r1hGG3gC8//Np/LXrmJjxdUhbv1YE9vzU22eAmbOPBRmieNCNFzvP8/jhaxVSL3vn4M9zBJN/bgSZgJsyplZ0KQ24oSZgq8vmE4V4+9hrkNIS8O5uPhbNOz+CprWpWRhd7Ahj9svMYM871rT38pbM/q2XvelHoeU4bpxBgt+Jjr8MAqfi80NXZEW/H1UEuOMIY/zCRPyxZr9XABMSJMP5pbelahYlsjNMi1p6402Pp8lyhWEhIBpVp2hdV1yp6nwgPAhYvzQF/+zOEpfZCfXgz6LRIMrxKsq0B5YcKsL6UxRFvBygelBdLjhZGMCx/RfTKWMCUGZzbAClvJEmtiGH97oEGLdhzBHGjL4UDyvLOmBUmn9AaamAay7GimAXgdErzG1RlX36k9el+PlgsPFtK9YRxtwtNzBl7havTZoLywYhuJRbSCNgauvBlAg9TQYDjyVHOeOWbOVxoEoo0Mn2JttpNZvOcmhfn0KTXoTr8TlITSnCrRSt8TMvV7gj79KVPDskCo+1tb/rZkLScavzcTlTARBrZUu+MB1coHNHZ8rQXEzvH4T+8yWY9DzQrj6QptFDzzRlPUj37JbM5pZMeCfZK5CNgsPt3PlbEny3LwSlHWEIqWLzcTWGfbFaCKkgml0zeyNaaa3QdqcAs+msSa2k+4OCmmYm2nyWQ98W9idabo4eqSla3EopMn6m3mRgKkJ6KlM6dV5Plz418ES3CjZE7Ar9w2X5UGXbv3bmC1NBAiqBEOf34zFhKlzLq40PuxK0i8qFutBzRdd7FjDx1zSDCKELxA2tmZoyyztqqc9tUdDlDAm+2hUCdxxhHIwrwOAJy5EvIkSCsz78Nq4rnmhpfU/BANOytgEydwQmpSpjQro/b68we+JNArzej4jjKouz0q+luDwGAzWCxnI1Kr0qPfpEZTzXv6pVwUzf6+MVBTiX6vi+hxoKQfUF4AJswWZZGF+UCUN2IsYMaINnbcVd4jp0m/qePcNcvJlTldcaUm5vVN3qnKNM1zUcJm4LhTuOMP65qMWYGWtxJcU76jGT3nwUrz1j7ZnCCBilAbLS96RucIFJtv88ZpLD/HMZSEgFXmkrrqANp2yjEYsroYRar6f44I3zxh9qNwnH8FHWNxBLj2ix6F85SKltmGV9lBrAF6RConCuh8fotCn7MSC2Fob3ELkPddDBexYwrL2JSZqtFPQpdwfHUT7mf+zjTWFwxxHG8St6zPhtCw6cZXcSnqdhLzTF2FethZcMMK2UBki9DBgmbz18mYAJbMUk5shiYBsxORzT5ucZ8PHbcUaC4OpBGDe55AbiShqP9/40gHLOt058UZbxXMPJnQuUKK+DLi8DEs0R/PJBLIIVwjULHPXgnt2SsQbHq7JeIJSYFIi8mNgeeeT6cFRQAItFOsL4L5li0do9WLrLriK06FZ2e7QO5v3PwugcgDcBo9MbsPT2CnMxFcYwdiNFuMhlKjcs/J23AMMEoONHJhj5JA2T44tvS2TTo5cX4kKqY5X9YuYacq9CEhzlMngmr8uGQasFLUpDPcUV/DCiKwrcNBwrrvueBsyKFVTSvG32aQraRPRMdJKBWaa+vSrcqNAo1hEGsyD8Y/1R/LzmjFea1EBZAbtn9rIqywiYSB5Siecey3U6A5YeN23JmCCPORIcK8IWhV0ps1Wpj8hzjyPmsDPN5P+ZNCWInMOXPz9g/PtgohZfbpEZ3SE5TxSGXBUkIa61vPnCDLCzFEuGrOMY1q02Xunq2VS6p7dkrKOJ17N7UAPP1PG9moatCoOBJ9go0hEGe+P+vC4e3yw84JX2VAoLxMmFL9sApnUkD4kXAKPV6bHsuNQIGDb5p28nmCwixmZSJnA5jeCZh1x3NzfpKi7M/xlFGRmo0qoNqnfohPAG1mcH1dUCfDP+sqkwjuCreY2Mf478swiJGa6V3Az518EFVgHhXMu0DYUZ4G8Dhuqy0Sg0EfM+8myHf88DhjEzIUmzAaA9XA+ZcIqR60KRp+XgjiOM3Sdu4s0vtyAkSIrgQCmCg6QIYZ+BMuPf7Dfzs9vP2bPi34ICZTh2szJ6NM41HuyrV7f2G8tWmNZRPCSc5yuMJWCYGcjHawm+7Sv8DPPfdSBfS9C5oWveHhg+GFqNyfRBEhgIeWgY2kz7AZysRDh5KT4fP0y5vZ0lwBdzGoO9FwbOK4S6KMDpCkP1eaD6fCNghCSDNhe8zmTsVznrMD59XIGa7Wx194SUVUxzT2/JihuZmJJThWoNZ0HgNY/EH28MRUY+B7GOMFibcrJzkJuXB3Z1zXHc7U9ivNlh0mX2aXpm/7ekLA57E6R44zHm5slWAs0A0ybKpDDoaWLhHJafMK0wLIm1ujx0iYD56WgrQO3ryuplSN6xzajkqM83+RCr1aUrol95A5zUJIT971QO5n2bZPybXYRNntsYvx4guLJrL1qkbsD2moOQHP6wlUskRkt5PfiCm5AEC/exa9DmgNcVoVL2KQy59RsqhAQg6tPvwAU5U1F0zvH7AjCsC4mqnE6UGpitvsfSJ0IIHb8lmNzIlkCsIwxPJzDLf10NrDtJMNyBjzDvAkaH5SdkbgOGOf5oVAN4sKawnl+YOwspf+81EzPIh9VvgCbvfoDAKlVx9JAai+ZcNz4PVBBE9W+M07uPo9/laeBgknSeC22ObbVeQ06QCRzselivuQhZBNveCX+JGAoyEZEThyE3fkIYNa00yh69UPdF6y2wsJ6ZqO6LLZl5pUlW9wHFMkrh6mTokgdf7QzG5UwpxDrCcFmwAAImPPztIMHorva3RkbA1GEhGoRPDkfVMj/EVoARaabM2vliCxj9QQtJ1GDAtU3rcGPXDmjVWWDfWWJbtHp9BiCwRScU6KQICJRg4VEp4g8ex4tXvrFSpGT0JxXNsKraIEgVFaHLuQ5ZSE1wAeLsEioRFZ5PnAVlTok5hiQwCG1+mAupwr1V5r4CDGNkgkrzEij93Znqi5CB/XafAhduySDWEYaQsl3RFGiB6Tsce4NkgGlbx+WtqatqjM9ZlOAVJ0tWmPeWEvzYX3gYcOY9cuKzsLE1EVK5oagQJ7/4DDlXS67gZTVqI6dlXxwNaIXrJ06j75UZkFhoHbNyK7Zqh2E3usHAlCupDgFhtSAJEmdsxsqJqZSHevmJaHPoC6vm1nvpNdTu7t6R+L4DjAk06t7M+tKuDb+QkQTw00EFTl2XQawjDIHFOyVj6h+frSeY4uC2it1MRVXgIeUIpBLTWcjdxMJArDgpN2/JPlpF8PlzwoPDjl9v0vZ1N2k1apz+ehJyVaZzS3HimUMKIoWUWrusqtDqUTR46308/bUKekghU1QBkbq+PbPXPkNuEog8DAOS5+ABzVEzSWj9GDSf+JVbXbovAcNs+oODFYSjsp8oqCm2gcj06z9BOHJNbjTZ7RDt/oQQWa2ZXEw0ZWY1yYzYGdCYuj5L7AJNwgBlvHRgj3mjnfvtx0YlS/Zcp9dj6wU5nmpiysccdLMYm5UECr3HruHwQ3/P+KPLzcWZ6VOQfdG5xWbVzl0R9fJgEI7DjO0Eu85rQSTuH1lbV45HbmYSzl1OR+2im4g0ZEJpyETdAC26zpnv1tDdt4AptulPNJ1rplMKUY6uFh8PxL5LARDrCMMtLtvJJAYw3qqTlcOCw7JYLUoBwWHZWWvBIYJxz3jeAiZxv7R0AZJ3bIetdT1B7T4voebTPc0VMbe2G08Wur26sII+6JyD5x4JQU6+FkfOp+DA2es4fO4GsvO1qFk5BE3qVEaTupWNn9G1K0AmILT1fQ8YxhhKqfTi9ewBoPQjSiFAxAasOh2AbfGBRr0qMY4wPJ86phLuFmBm7ibo2oSioYAL+uPXgKvpBIMe9VavgctnE5C7fyuyz58Bc2oRVKMWaj7XBxVbWGuELjxMsOxIAYjUtaqMo9Z90CkHz7WwXkoNPMXZy2k4ePYGDvx3HVdSTHIjBqCVn7verJQJwBQzjKnzJyRlPcZJuJ6UxwsAHEoP/joXgA3nAiHWEYa3ps7dAgyTeTwSRdHcuecDYzdXHCN4oBrwaH3v9Fqr55GWmY2ICNe3XWtOEvyy17MVZmRsLnq2dH4bdv5qBt6Ytg3d29TDOAFvhjIFmNLDGp+c1UxCycs8xTu3jcrMJDvi5VhxOghiHWF4Z+rcvRXGGBy2EvCYABB8sZHggycpqoa6f+lgya/MXC20RUUIDXV9gGJueb/d5tkZ5r0OOejd2nldm/+5gkkLDuOzQe3QrY1r2+0yDZjiwbp4PUNJeelKSqlZSX3/ZRkWHVNArCMMbwFm/AaC8c9Qt65rPWkDCw7Lggw9YVLhcprWnCCoH5qKGmHUaC4tl8sgl0kgl7FPqWhdt6upuQiWc1AoXN96MSd849ez62/31YPeeSwHL7Z1DpixvxzA7hNJWP9lL1RmjgtcJL8ADOOBSkWDCqiGaQoYlYn+TZJh/hEF3HGE4YqpQp7/sC0PrzRPhYxPg9yQjmCkoTA/HUV5aZDq0wBZBQQ0my6kKFE028/BGODpOYHBYfPy8qDT6aDT6Y2flolpUxeDhznscAWkfxKzEFNDAbncteIk8xIzYinxSBj1VrtcvPSo4y0Zs0Z96qPVqFpBgcXjnhXEx/saMCZfZNmTQCjTmZCAEC0oUglPU3iOnDEYtCcb16nCrDaN6ZxKU1HK0xOEIOrMDSlmHnDPEYZLzhoKAW0aivLSQXRpCKRp4HTpKMxNAy1KN36XE+cRAHjKIb/pckhk7h967bXz70STao47wWHZ9bZebwJOMYDY38Zrb4vEtKwZeAKMq5IJSDKZFOuPpqFr8yqCNBjYDd3AXwwgnPu+2Qa3zccrjzleNY7G3cR7P+7G8+2jMWaAMH8r9zVg4pKynudA1jmawExnjKf8fwRkAwF+j46MuJSoyupEKdkdnyoh0/e65wjDUX1c3MdA3hUEEO+YL6fU+BwRNUQa07tAM7v5OpNM8LoXg8PqDXrotHrojUDSQafXgXmrKZ3i0uV4vKkwiT2TJ/WcqYWBBLp8PzkieK1NIV5r71iO8/2qE1i2O8542GeHfiHpvgbMRVX2RzzlpwnpKCGEOa76i5dynxCeTriaTvpP2RnqliMMhwC9MBaBBaeFNEcQTU7FvpDWeU0QrVCiCynA7jjHip9Cy3FFxxz/mVYi0//sPD2u5wWgXUOBSmkAXvtVj7R819s3R215ta0Orz/m2FVVnwkbkJyWa7xOZtfKQtJ9DZiEpKzXAfKbkI6W0JAiQrDyZjZ5adyWUM4dRxiO6qOqRVCkLRPXHCfUt2gjhLXw7jmGBYdl18Uf+Tg47K4LBCz0uZh6P1oJnL/p/qH/5dYGvNnBfv5rN7PRb9JGVAoLwoavrC1enQ3gfQ2YC1ey6kil3CV2lhE7S7MKuMIxf4UGuuMIw1FdhszjCLk6XmxTHNLrqRT5TVdAJnNfPaR04cbgsPsIJjzrmbqL2E4evgxsPy+uXubM7+Vfmbss9661X2lDMdhuABRgyc4LmLnmJGKbKfHlW8KNyu5rwLBBS0zSbKBuWGOyWCoj1rrnCMPRZNEX5SLk3ACmVih2PjmkV9WYiso1RHrec1I7i1HJ5Ct3Kjiso6rPXgeY9P6bPsKB2uSRWKSlZbjNy3FjhuOTD5kIzja9891OnEhMxVs9muHVbsL5e98DJu5ydkNOxh934enfhmPsUDl0ZRgCZUS0IwyHWzJmqPPfcATorrk9yKUzZld5DTKlKUCQNxLr98jlJhV/X6ZrmcBXmwnmDBReb2R0CxQWmiOaiG5uj+5dsOyPH23yMd2ybmNWg6nJfDv8cbRpLDzO6H0PGMaN2zYyi8Q6/Ru+Ogw6A8FfIh1hOBs5evE7KLJ3ih5cRxluSR5FWLNxXiuPFeRJ6D53G5KWC3y4gmDhG8IAw7Ssa9Vlpsrup8jaNXHh+A6bAnYcu4bPfjto/H3z1D4IZ5JcgalMAIb1NVGlHkwpmQ1QwRf3H6wPRU6Re44wHPHXcGMTQm7+LJD9rsnU+soIaO2ux1z75Yu163fdStcUuYXA6wsIVg4VBpjMLDUeaOrgAOK6OjNFcvwhVCiluzbh90PYdvQqqlcMxuovSjSkhRRbZgDDOnsxOaczpYaFlEKQp4Sxm0KQlidxyxGGI+Zqs+IRfuUDIbwXTJMWsxghIc79CAsu7C6Ndg0lAAAdVklEQVStMEws88Jsgg3DhQEmSXUdLdt55hLJuIKs/g2x7UvcdrJtWPcxq40q/h2bKfGViAM/K69MAYZ16NKlzHCDlHwBwr0FUKdr7efbQpCs8a4jjMKCfITHDQRH3d97l578qmqTUblWczGYcErLzjDT+/hej63HLA5r32YOCl135dyFeHTuahtsynVOa4qvPv8II4aVyLJOXUzFsG9NW+bXuz+EISK9lJc5wBSz69KNzEheLxlFQVnEIrvmUlN3B+NiuncdYWi1OsjjP0KQznvxIDVVh0Bem1kreCcZg8N2pwhzX4juVkN6zebwx+u8oHr/OXoCPXrZBpsSW/GAvj3wy6yvzdl+WnsKi3aYnKFPHtIBnZu79qBpWWeZBUxxJ69coYE6ae4zlOqfIyBPM59uxc++36/AuZvedYTBJNz6+OkIL3AVn1b40N8K6oawRu8Jz+CCcvImgiEdKKoLF7p7pe4B8zl8148XVO+uPQcwYNAwj+tt0iga/+4t0Z4a8MUms9HY0vE9ECnUHc7tlpR5wFhyfA+l0lqq7L4A/QlAhTmHgnA8We51Rxh5FxejcvZSjwe7uIAk/cOo0nqK18qbsYPghebUGO7Dl+n1Pzh89iwvqN71G7fhzbc/9Lh5LALCzr+PQVMkR2w0Na4u566m49J1tVElRqyDEb8CTDH3LyblPMhTw67fjwZVPXTV+44wspP2oVq6IBU3QRPiprYWwtvOE0QrhGj2PoKO0dSoR+fL9O5SDm/H8oLq/XP5Gowc7R2tic9/XIlNyU2wY5RH1gJGVvklYFjHL6k0Ty85EbhxV6KceNsRRuatS6h1fYTX5mK+IQR5TZcbDb+8kVhw2MY1KFrV8UZpwsv4ZC3BCw8LC0o7/7fF+HRCydnDWS1FOSmQh1S363aX5XtlxGTEBfbCxveAIMFCB/s1+i1gGDsGL9Cvvpgm6eVtRxgZGZmomTQYHNUKn01OKHlIcEG5AfWE+eB2WefKY0DVMCDWO0G5XNZXTMDOTu3qUzxuinDhNH0/cx6+nGYrpS+diflxLkhPgFRRGfIQ+wzq9OxA5DUei5VDgYruObw0V+vXgOn8LR3L85jibUcY6iw1KiV9CLnhpqt5Ieg5DxkOV16PRyKFyTBcFbrxDPNZJj44rKtyXT1nvsYaVqeC4k1OmfoDfpjl2ncYb9CiMOOS0edyUOVoEGM4cuvUuGkrBHdbgIVvALWs4++6arLNc78GTOx0yq6efvS2I4zs7ByEJY1HkNYUactZ4kkg9FwE9JIKMEgijH8bjN/Z36bftCQcudLaeKC6q9KEPd8dB2Tliw8OK6x0x1Q/7SWoGkrRt4XrksZN/Brzfl3skpB59S9IN13hy0KrQxZkK+ANCQ1Do7ePYO5AoIF1DFqX5Zcm8G/AfENfB8Fv3naEkZubi6CkbxCou2yc9CZARJgBwcCRVlgZV3KC0aSmAhwnQYBcYowHI5FIwIN9MjPfkt/shcUQPdq3Mxy5DLDwfQNFBod1t77ifMyxuVxCBdX7wZgJWLzUdXh3Zh7NtmSgPCQBIQgIt+8/qtmw3fj5zep4yDoGregu+TVgOk2nTNl8pbcdYeTnFyA9U2MMDhQYIIFcwoGTSGCgnHHLECTnIJVIMG2H1BjywtcCRBYc9shlgrdEBocVPbtKZVjyDwGLLyqk3mHvjsGa9ZtdV0k4FGZdBa/NM/JbUcX+wSy692z8PDoWAjwpOa3TvwEzjXajHLa0b0DxSXfvnA9cj3AJxfe7TG5bq4aKyeU5bWIqsOkswcguvu3zyuPE6IBDSL2DBr+Hrdv3uOxshVqNkZqwH7q8NCNtYKUG4CS2V2G1OozE7ClvoZOHFx3+DZjptD0F/m4RRTHpOd9OHja4c/cRdHuQGh3r+TKxScuMuXz9kmDRmM/dgKB6+wwYgv0HjrhkS6+Bb2PlbzNQpDbZILEtGdualU4VH3gaX0/92ii89HZSVpY7NQllzvOLfYG7W7d7Nqe3a/NGA1hR7WfQZhKKU0yAN62396wkhTKFyUPa1qVo6KXDvNB62YH/2x0EXzzv/cnjrA07zhPsT4SgepkeGdMnc5V++nE6Phz/PTITmEIlhSykOmQK24M/W3mmzV2Lpxp7f5z9BjCPT6P1DRwuetMRhqsBtnzOnFHEVAMeVvp24hbpmata4lHcFzH9LKZl8TJXn4Cgep98+kWcPmtSknSWVi/7BZNmrsc/G2eC1xVAqqgEeYjtVRjhpPji1wN49qE7x+uYyAi7C4E3XvA+XWFU6Vo1ABsP2MzJwvDlMnjTEYarAbZ8zrYoVUKBR+vduUF01J67YUR2OhmYs49g9suu+9uhy/OIT2DyFedpz/bVWLXtFL77/F3o8zMhCQxHQJh9nZ/RU5diYJc7p95QZgCTnKHLppTaHK3Zm3bwYhkqKIDFg72/VLsabLZFYbYhnRu6nkCuyhL7/G4AJuEWwKT9QsyUWz3WDdeSkl1268zR3ThwLgtDBzyFIo0KnDwYgRH2VfYrP/jCzKTdX3pPZ8ll60wE990Kk5yhi6OU2kSaZx5OBy2UIkDqPUcYAnloJDtwkSC7AHj6Dm4THK4wIoPDiumXI1pVJjBqBcGqYa5fEA+16IxbqaabL2cp+dJJ3MqRoGXL1si7cRKcNAiBFe2vIopqDZemn133kqsyvf38fgTMJkops4WxSUOWSFGoI9joRUcYQhl+SgUkZZK7EtBp3DpgsjhzdqHdckiXlQcMWcReTq4Bw+z5mV2/sxQcrMCVuH+NoQof7DwESf/+aTz4B1WyH8tDHl7zhDpxlwA9A4+7alXAfQcYVYb2V1C8YY8N7y6XQl1AsGoojyD3vZK6zWHm9siDmK9u13u3Mgrtb71GbZCbm+e0mbVq1cDJIyavMK99OAvrfp0IfVEOFJWj7earUKUG9mxZ45WuOzqv2Cv8vgNMcqZuCuXpWHudGb1GipvZxKuOMLwyIn5eSGSDR8AiQDtLDzZ+ALu3rTKSzPrzAMa//xK0OSlQVLHZfd8uhuDQ/p1QKDyPiFCmAaNK17KD3g/2mP/ZXxJcyeAw/xUeNT3UZPXzOe7V7tes2wx6vcFpme3btcaa5SbX2gfP56Dnk62NipiKqo7tB1at+BMPPdjE47a6kr1YVnD/rTAZ+r6U8ivscWnyVgnibnL4sT+P+l6yN/F4NMoLQLXIh2zizpRmy9PduuCP+ab3YE4h8OCjzyMzfrvDMwyjm/rVZPR8vofHHC7TgLmRpetoMFC7Ximm75TgVDJn1G96srHrw6jHnC4vQBAHqipd+zvu/2JP/Dhjsrm8zv0n4sSWHx3KYRjh0DcH44NRnt8sl2nApGTROnqD7oq9kZq1T4IjV0Q7/xc06OVE7nPg6DS2bXL+AqvW4hVEdvnEXEna2bW4uGY4pEGO99ZPPv4YZs3y3DNpmQYM42hyujaBAjbXJxvOcFhxggHGI+UD92dGeU67HDg6/SGAd36GqfHoMNTuULJaFGZexem5T4CTOL7ufCCmAf7dv0EQ11MyrWN6WmYq84C5lqEdyVF8J4hTlkQc+URZUSbMG4PowsVlSEhSO3zlBtm5+alR0UOPD+KaZ5fa0aQryM+3oi/d/ocfaYOCQudxQCeOHYUPRrxpLocZk8U0i8Wt1HSHLQ+Qy3Hj0jFjzE1Xya8Bw4IuJWfoFgJ42RWjip8TQlbVqijtbwz3dw8kfwJM23YdkaXWOOX6tMljMWzIQCuawW9/hJVrNznNt37Fr+jc8VGXI+rXgCnmjipT353w/Es80IIALDAIM56QMFBQSpmkLAUEJzmeX1qrSuBfLrnqQwJ/AkyXJ7sh+bo5ALZdLs+cPgmvDuxj9ezPFesxbETJucZexrfeeAnTv3QdQqTMAyY5TdeZEspcjdjXjfDm5Ka4REDerF1F5tos0Ev1+hNger7QGxfiLzrl3PyfpqJfb+sr4vSMTDR4qCOYy15HSVmrJs4ddx3Dp8wDRpWhvQQKYfGjvTGJCS4rK8nvPDhvt9WfADPwlUE4etx5ROpFv/6A55950mYkn+zxMv45etLpCB/esw5NGjm3Vy77gEnX+lyQIua2xFOM+hNghg8fjp17Djhl2aolc9C1i21A1x9//h3jJn3jNO+EsaPwocWFgT3isg+Y8hXGatzv51uyTz75GGvWb3E66Teu+h0dLYIlFRNfuapCs7bOgzG1a9MCW9ezKI+OU5kHTPkZxnrw72fAfP3VFPy+yK42k7mTOzf+idYt7cfB7PBkH6cmzsz/29ULhxAe5thlT5kHjOV0SUzKfp6CLwkMAnIjJjLcyo3bRZV6Kk8xxpyPIjsmqiQgYkKS5jpAzfauBFzP6Miw9Z5urdzN709bsjmzZ+K7mb84ZdWBnavR9MFGdmm+/XE+Jn7pXOy2cP536NnD8UrkX4BRaSZQSieauUnIphhl+LNWoFJpFlFKSy7yCYmLUYabRyBBpdkISp8pzkMImRitDP/c3QnvaT5/AsyyJQswYcq3Tll29O+NaBht/45HyLZs0Et9MOvbSQ7r8DfArKOUPm/BjSkxkRFWl++JKvUuSvF4CSCwO1oZ0aX4e0KSmmn2fWoBmPXRynAf2ymW9MCfALNt8zqMGD3BKWDOHt2BKKVj36+du/XD8VNnHZZRu2YNnD+xqxwwjAOJKvU1SlHiDYGgT4wywspZb8I19QUQlBhPULokJqqCecVJUKl7g8JkocS0zQiSopURUZ6uFO7m9yfA/HtoL14Z8r5TViWe2Y9qVR2HUftp7kJ84iLGjLNVqsysMKcTk2s3i67t0KXIheTsSlJK0yilJRqVFPVjoiIuW59z1Ew5q8T9EsE3McoI85km4Zq6HgjMvn4IIVRPSJVGtcMy3J30nuTzJ8AkXjiJZ3uXRD+2xzdV/BGEhzsO1JlyMxWNHnncqRDzmymfYuhg+9pS3gKMq/kqZE54pBp85sy1CjRIEmww2BfnKoKC23NEsrzk/IKc/PycRjzTzrudQoLCAi3BwH6mlH6eV5Bjjo3HEUIUitALoDBfpfDU0C+/IM+5gEAIB9ygCVGEXXeUrawpX2bcvIx2jzuPHJ167SQCA5yHZevR9w3s+9uxy9mnn+qMZQtYyFPb5Awwaek3BcUBkEg4jhQY8po2jcpyY8gtprAnuV3kTVCpPwKFOcgkIdgbrYzobJntokrTgKfUKjY4B/RvEBlRAjTT1m4Ppehk0fIxMcoI51KxO9Q3f1phaFEmHmhuNWQ2XNWknHMYpq+YePGytXhnpPkYalNGSEgwkuIOQyq11V721grjjeng0QrjqgGJKs0SSqmF/ynyfUxk+CjLfAlJWR0BYmWFKZVyHevVDPvbmk7zHUBHFv9GCPkzWhkuWOPZVVvFPPcnwFQI5lE1qrlD9jA1/bSkUy7Zl52TiwYPdkBhUZFD2u0blqBta9u6/AcwSZrzFNR8PcxR8mqDqHCm2m9O8Uma/gTUKjY4R0h0A2W4lcbfxWuaQTyhC8yAAbkQHRne2OVI3QECfwIME7pWr9sC+QUFdjkZFhqK5MR/BHH5taEfOtUa+GT0u/hk9Ds2ZfkFYG7coIo8gyabUpiDHUqItGl9ZYjV/WJikmYUBbW66A+RhgfXrEmsLJsuqXIfMlD9mZIVBoZgSXhYaTpBI+chkb8BpknLJ6BKvmGXa1WrVMbFs/sFcXT7rv3o8/Iwh7SO1GT8AjCJydmPUp4/ZMGdwmhleCghRG+11VKpp4HiI4vfNDGRETbG4JRSaaJKk8Ni9ZhBw3HtomuHHRY0Wl4kEgsYL1bt9aJcWVyyCnv1HYBz5+x78K9Zswb27NwqqF16gwGxnZ9Eerr9y01mffnv4QNQKIIElceIfKl0y+q7Y2eY+CTNOwS05NqDkKMxyvDWpTmRqNIsppRanEXIhRgHW60ElYb5I21VXAYFGd4wMtxzTwqCh8dE6G+AGfzW2zhwwPLdV8KwunXqYOtm4VpKX0+bjt//cKxs+cu8n9Gh/WOCR6TMACZRlT2PUr7E0Jtw82KUYUNLcyL+mno3ISi5hiFkV4wy/Al7HEtQZc8F5d8q2ZZx86OVYebvgrnsIaG/Aeaj/43Fhr/smxs3bBiDDWtXCubohbg49OzVzyH9kMGv46MPzXc7LsstO4BJ0hyloC3Nkxt4JzoyYnZpDiRcU8eBwOxTlFK6uGFUhVfscSoxSf02BcwrCgE5Fh0Zbl5xXHLXSwRiAXM/ayuztn88/mv8PM/qrsbMyRbNH8KeLVYSAJdcZnKd/87H26Vr3uxB7NtmrR1d5s8w7LxxUZWdQ0Etzhvk0eja4TaSq4Qko4cFs5iYI9y0Bsqw/9kFTLKmLeWp+cxCQAobKMNszkUuR8xDAn8DzLTv5mDy1B/tcq1d25bYus4+mByxedacBRg7cardxxzH4VrcYSt1/zIPmMuqzKZ6ylnatRpCpPlhNWvWtLr5unmTBmdrNbmWnCOUjIqOCv/eHjdv3LihyNUrspmzjOLnUsI3q6esaL498xALgrL7G2B+W7gcI8fYVw5/PPYxrFvO3DcIT2npGWj4cGfo9Vb3P+YCmMSfSf6LU5kHTPy17FcJ4f8o2Y6R89GR4Taepy+pNNEGShOsAYN+0VERDi2WEpM05yioWf5CKfdaw6gws3xG+LC5T+lvgNmwaQcGDravgNm9a2csX2hfpcUZh/u/+i42b9ttl2T40Ffx1eclm4wyD5jEJM131FoqvyRaGW7tuMqo7pIVSynZa8k1Cr5jw8iKVlJ+y+elb9UIyPfRpbQH3IeCsJz+BphDR46jW0+7x0qj4RczABObNm7ZhZdef89uNmaMxozS/GaFSVSp91KKWAtufBQTGTG9NHcuXtf05w3WUn4CNIiOjHAYhTQhST0agFmHjBDsi1ZGlOiYiR05N+j9DTDxiZfRqoOVzZ+Za/369MD8WfbPI85Yq9Pp0fDhTmDumEondo5hZssRtzWgy/QKw1T5L6o0WZbq+pTiiYZRETYWQolJ2R9Q8DMsGRakDFcoCbGvhwEg/pq6CyEwO7MigKaBMrwCU/l3Y+67lcXfAMNC9tVp1M4ur159uQ9mznBsLemMwWMnTMOsueaduxXp0j9m4ZluJpvCMg2YxCR1fQqY9cDYRA4MC6usDCc2r5KEJDVbKdiKUZzUMZERFZwxWaXSVCwE0i1tbFytSm6hwkkmR4Cxp9rPirnfr5WZM75KymYwGGw99Qr1XmmPnefjEtG2k6UxbgmV5TmmbAMmWd2H8jBLsgjBtWhlhN1wuglJmiWAlTbz+Rg7lwOlmZ2oUl+lFGaLS8Khb3TtCLNFprcBUro8fwMM6z/zYpmaZutc/L23X8eUCZaaTeK437l7Pxw/aWu+3Oyhxvh7h2lIyzZgktRTKGCOY0kI1kUrI+xaICUkqZl715LzB8WumKgIu1J+y2FIVKnXUgqzTT8BvoyOjHBsbCFuDF1SiwWMywLvIoEQXTLWvB49+yAhwcpsydjqYUOHYNT79g/vQrq1bPkqTPj8CxtSdo759/DfCA1lLrcdp/te0p+g0myCRWhx5jGmYVQFu5f4CSpNHCg1S/kJIYuileGDXDE6/lrWBOY5xkxHyOYYZbjZq4yr/J4+90fAvPbGWzh8xFaNf8S772D4OzYaT4JZnJubi/Ydu9gNqTF39kx0irX1qGlZuM8Bc+PGZa86k8jVVzwGwOwRQQLD4CCpxq5LkFxDxXOgCC5mAOEwO5jLdHnlUqAP72KA5FcLxqWHSDPNajiCR8tNwlx9xav2sjo6w9ymTeCobjTR3bpjQlaDvLbddjnrptAV5oPRH2PTZlsPmLVrVv1q7+bf57rJSmO2Zu36TM3LLzArmAVWqo+qD/dD96c6Y1T3CiASx/F1JNpku9t9T9rjLO8d01a+Uw0uL/fucCCoSqPvCYGN9JJS8n5B2nn7ejMCmxpUpUl7TsL9HRHdBVWbD0CYspXRNZA+Lz394IQq91SI4HLACBxUfydTVGs8FpROseUDHZafGufRCtNxOh1nyM+YKFVUMqs86fLSaW7y0U1n5j/teahlLw5eOWC8yMyyXJSiWqMhoLBRGiOUvpaXFueRalLsdPongAGMfwUZl6G4sARtcw4e/XrXNhv7qbvN43sCMGcSUyy1Asw8aRpdw+gcw9FzMcwrLktMnnLaEg4oqjV8DpSzsRSjPAYUpF9Y5gmvOs2gbXke069tm8A9l7enaYNQWXCAhKMNK4ZFdl6yxqHfO0/qdDfvPQEYdxtfns93HIj9xpBm0BVUpgYteH0ReL0W1FAEWXDl/w5+VvEhIS1JSbli98VYnLdGjbr7furWZVGYXDawYlAAgmTSMY8vXn1XXGk56k+ZBYw3ViV7TLvXVipXk1DIRHZGwyYxex47nf4LwJ6xXuK+0cR5CDERjdjzWs8IXsvdvJRTGDDt7HXt9QLtmIJbF34QUcQdJS2zgLmjXPPHwmu2UCj0+SxYr1XiCN8l91a8fT19kXwqBv9Xg975fuHZaw9reZN6YLWqlfYe2rGoRO4motxiwIvI4pS0HDDe4qSflDPrqS5aA6UyAtAR23dz3u52gyffH3vj9HYWrcE0Nyl0lCOjC255dnXtrXaWA8ZbnPSTcna/3PsyBa0LILPLkjWVvN3tyk2emp+fljTEVC5N43j0zU2Ps/KM6u06xZRXDhgx3Cqnxe6Xe12gYKFJSF6XJaudK3qJ5xdRVG3ETNvZJcI5nqPPFt6ME629IL5a4TnKNGAopfLkbIRIDAgBj2BQnUJPiUIqQRD7JNSgAIgCBIGUkkCOIIAHH0gIFwBKAkH5QEogJwRyUCKn4OWEcDJCIQeBnFLIACoFAfOgLQX7TnH7O5UCHAdQCQjhQKkEIKbvAGf8m4DAFAqEEGIcCnLbbMH4m3FDAtDbtj70dtADCmb7w/6B8gB4gBiMfxNiAGW/se8sogLRg0IPYvyvA2D6DqIn7DuFlhJoKeV1BJwWhGophZZQaEG4QhBaSClfxIEr/HbR1mZrli2unp/8X6tcHW92bhJdv/6cLRvW/AIiyweHPIMEubXDkEsI0QqfhibK4KqNXqEA86hxOF9X1B1Zl5mDlHsq3dOASU2lIQYZKuv0usrgSCUJIRUBvgLlSQVKEMGBhPOgEaB8OEDCKBBGYAyJEUKBEAI2ocuTOxw4dfoMzp0/j/j4RJw5+x/i4uJZGBKbotq0boWFf9jGwKSAjgDMwUkuBXIIkA3QbBBOw4GoeVANoVATjmYBXJaB0syWrR79SSaX33rhuef7zpr2P/u+ad3pjBfz3BXAUEq5lCzUNhj0dQmhUQBRArQWBalBCGoAtBqlqAZAuM9QLzKlvCjgzaHDceCgydslc+Eqk8nNoSiYIRn7r9PpUCEiAn/vMxvAepN1BYTgFkBuUYoUApoCEBYcWEUpuSaRSK/UqIBkQghbZX2W7jhgKKWylCx9WwOPdoTQhylIE0IRbemzzGe9La+oTHGA+aWjBIkE9Byl5JSEw6EaFaRHCCFs+3lH0h0FTHK6bjIFhoNtm8pTOQd8wgGiJsBPtSvLrAIPe6vqOw8YguGg5YDx1oCVl+OCA4SoCb1PAcO6Zt6SAe0IpQ9TigcBRANwHhSxfGaUc8A1B1g4s0RC8B8l5JQE9/mWzFF/iw/9hOjrGkCiYKDmQz9AaxKCqpSSagAtP/S7njRllIIUEELZgT+VgqZwIDeMh34JUUlAr1FaRg/9noxm8bUy1esq6+1cK5vORiS8/FrZEy7fmbzOrpUBqgGImhCoCUqulaU8zSBSWbpEh/SqVYmVz+0700rxpd7RM4z45ng3hz3BJSREoadQSDkSZKBQgPIKUAeCS8IHMiElE16aBZeAnICTWQouCYHUJMQ0Ci9vCy6JlIJKOJOAkqNMcGkrwCTMFJdYCCwtBZilBZbsO5NWwiQPoaUFlsQouGQSS8oTkzCzRHAJGIWVtLTgEryOAtpiwSUTWjJhJqi14JKnKCKEFoKgEITLlxDk63laICXIh4Hme0Nw6d3RvzOl/R8AdGoXzom1qQAAAABJRU5ErkJggg=="},79710:function(ft,me,b){"use strict";b.d(me,{ZP:function(){return Mr}});const k=Number.isFinite||function(o){return typeof o=="number"&&isFinite(o)},I=Number.isSafeInteger||function(o){return typeof o=="number"&&Math.abs(o)<=G},G=Number.MAX_SAFE_INTEGER||9007199254740991;let T=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}({}),x=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}({}),g=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 v{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 D{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(){},w={trace:L,debug:L,log:L,warn:L,info:L,error:L};function A(){return c({},w)}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.2`)}catch(s){return A()}r.forEach(s=>{N[s]=U(s,o)})}else c(N,i);return i}const F=N;function q(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 ce(o,e=!1){if(typeof TextDecoder!="undefined"){const d=new TextDecoder("utf-8").decode(o);if(e){const y=d.indexOf("\0");return y!==-1?d.substring(0,y):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 ee={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 o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Z={exports:{}},M;function K(){return M||(M=1,function(o,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,h={buildAbsoluteURL:function(_,d,y){if(y=y||{},_=_.trim(),d=d.trim(),!d){if(!y.alwaysNormalize)return _;var S=h.parseURL(_);if(!S)throw new Error("Error trying to parse base URL.");return S.path=h.normalizePath(S.path),h.buildURLFromParts(S)}var B=h.parseURL(d);if(!B)throw new Error("Error trying to parse relative URL.");if(B.scheme)return y.alwaysNormalize?(B.path=h.normalizePath(B.path),h.buildURLFromParts(B)):d;var $=h.parseURL(_);if(!$)throw new Error("Error trying to parse base URL.");if(!$.netLoc&&$.path&&$.path[0]!=="/"){var W=r.exec($.path);$.netLoc=W[1],$.path=W[2]}$.netLoc&&!$.path&&($.path="/");var Q={scheme:$.scheme,netLoc:B.netLoc,path:null,params:B.params,query:B.query,fragment:B.fragment};if(!B.netLoc&&(Q.netLoc=$.netLoc,B.path[0]!=="/"))if(!B.path)Q.path=$.path,B.params||(Q.params=$.params,B.query||(Q.query=$.query));else{var X=$.path,se=X.substring(0,X.lastIndexOf("/")+1)+B.path;Q.path=h.normalizePath(se)}return Q.path===null&&(Q.path=y.alwaysNormalize?h.normalizePath(B.path):B.path),h.buildURLFromParts(Q)},parseURL:function(_){var d=i.exec(_);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(s,"");_.length!==(_=_.replace(a,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};o.exports=h})()}(Z)),Z.exports}var j=K();class R{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 C={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Y{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,Ee(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={[C.AUDIO]:null,[C.VIDEO]:null,[C.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 R),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=j.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[C.AUDIO]=null,e[C.VIDEO]=null,e[C.AUDIOVIDEO]=null}}function ie(o){return o.sn!=="initSegment"}class ve extends Y{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange){const e=this.byteRange[0],t=this.byteRange[1];if(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 ie(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,_=h[e];if(!_){h[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:s,partial:a};return}_.startPTS=Math.min(_.startPTS,t),_.endPTS=Math.max(_.endPTS,i),_.startDTS=Math.min(_.startDTS,r),_.endDTS=Math.max(_.endDTS,s)}}class Me extends Y{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 ze(o,e){const t=Object.getPrototypeOf(o);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||ze(t,e)}}function Ee(o,e){const t=ze(o,e);t&&(t.enumerable=!0,Object.defineProperty(o,e,t))}const Ve=Math.pow(2,32)-1,Oe=[].push,Be={video:1,audio:2,id3:3,text:4};function ut(o){return String.fromCharCode.apply(null,o)}function xt(o,e){const t=o[e]<<8|o[e+1];return t<0?65536+t:t}function st(o,e){const t=Ct(o,e);return t<0?4294967296+t:t}function $t(o,e){let t=st(o,e);return t*=Math.pow(2,32),t+=st(o,e+4),t}function Ct(o,e){return o[e]<<24|o[e+1]<<16|o[e+2]<<8|o[e+3]}function Ce(o,e,t){o[e]=t>>24,o[e+1]=t>>16&255,o[e+2]=t>>8&255,o[e+3]=t&255}function De(o){const e=o.byteLength;for(let t=0;t<e;){const i=st(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 de(o,e){const t=[];if(!e.length)return t;const i=o.byteLength;for(let r=0;r<i;){const s=st(o,r),a=ut(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 _=de(o.subarray(r+8,h),e.slice(1));_.length&&Oe.apply(t,_)}r=h}return t}function Pe(o){const e=[],t=o[0];let i=8;const r=st(o,i);i+=4;let s=0,a=0;t===0?(s=st(o,i),a=st(o,i+4),i+=8):(s=$t(o,i),a=$t(o,i+8),i+=16),i+=2;let h=o.length+a;const _=xt(o,i);i+=2;for(let d=0;d<_;d++){let y=i;const S=st(o,y);y+=4;const B=S&2147483647;if((S&2147483648)>>>31===1)return F.warn("SIDX has hierarchical references (not supported)"),null;const W=st(o,y);y+=4,e.push({referenceSize:B,subsegmentDuration:W,info:{duration:W/r,start:h,end:h+B-1}}),h+=B,y+=4,i=y}return{earliestPresentationTime:s,timescale:r,version:t,referencesCount:_,references:e}}function We(o){const e=[],t=de(o,["moov","trak"]);for(let r=0;r<t.length;r++){const s=t[r],a=de(s,["tkhd"])[0];if(a){let h=a[0];const _=st(a,h===0?12:20),d=de(s,["mdia","mdhd"])[0];if(d){h=d[0];const y=st(d,h===0?12:20),S=de(s,["mdia","hdlr"])[0];if(S){const B=ut(S.subarray(8,12)),$={soun:C.AUDIO,vide:C.VIDEO}[B],W=de(s,["mdia","minf","stbl","stsd"])[0],Q=je(W);$?(e[_]={timescale:y,type:$,stsd:Q},e[$]=u({timescale:y,id:_},Q)):e[_]={timescale:y,type:B,stsd:Q}}}}}return de(o,["moov","mvex","trex"]).forEach(r=>{const s=st(r,4),a=e[s];a&&(a.default={duration:st(r,12),flags:st(r,20)})}),e}function je(o){const e=o.subarray(8),t=e.subarray(86),i=ut(e.subarray(4,8));let r=i,s;const a=i==="enca"||i==="encv";if(a){const d=de(e,[i])[0].subarray(i==="enca"?28:78);de(d,["sinf"]).forEach(S=>{const B=de(S,["schm"])[0];if(B){const $=ut(B.subarray(4,8));if($==="cbcs"||$==="cenc"){const W=de(S,["frma"])[0];W&&(r=ut(W))}}})}const h=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const _=de(t,["avcC"])[0];_&&_.length>3&&(r+="."+pe(_[1])+pe(_[2])+pe(_[3]),s=J(h==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const _=de(e,[i])[0],d=de(_.subarray(28),["esds"])[0];if(d&&d.length>7){let y=4;if(d[y++]!==3)break;y=oe(d,y),y+=2;const S=d[y++];if(S&128&&(y+=2),S&64&&(y+=d[y++]),d[y++]!==4)break;y=oe(d,y);const B=d[y++];if(B===64)r+="."+pe(B);else break;if(y+=12,d[y++]!==5)break;y=oe(d,y);const $=d[y++];let W=($&248)>>3;W===31&&(W+=1+(($&7)<<3)+((d[y]&224)>>5)),r+="."+W}break}case"hvc1":case"hev1":{const _=de(t,["hvcC"])[0];if(_&&_.length>12){const d=_[1],y=["","A","B","C"][d>>6],S=d&31,B=st(_,2),$=(d&32)>>5?"H":"L",W=_[12],Q=_.subarray(6,12);r+="."+y+S,r+="."+B.toString(16).toUpperCase(),r+="."+$+W;let X="";for(let se=Q.length;se--;){const fe=Q[se];(fe||X)&&(X="."+fe.toString(16).toUpperCase()+X)}r+=X}s=J(h=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=J(r,t)||r;break}case"vp09":{const _=de(t,["vpcC"])[0];if(_&&_.length>6){const d=_[4],y=_[5],S=_[6]>>4&15;r+="."+ue(d)+"."+ue(y)+"."+ue(S)}break}case"av01":{const _=de(t,["av1C"])[0];if(_&&_.length>2){const d=_[1]>>>5,y=_[1]&31,S=_[2]>>>7?"H":"M",B=(_[2]&64)>>6,$=(_[2]&32)>>5,W=d===2&&B?$?12:10:B?10:8,Q=(_[2]&16)>>4,X=(_[2]&8)>>3,se=(_[2]&4)>>2,fe=_[2]&3;r+="."+d+"."+ue(y)+S+"."+ue(W)+"."+Q+"."+X+se+fe+"."+ue(1)+"."+ue(1)+"."+ue(1)+"."+0,s=J("dav1",t)}break}}return{codec:r,encrypted:a,supplemental:s}}function J(o,e){const t=de(e,["dvvC"]),i=t.length?t[0]:de(e,["dvcC"])[0];if(i){const r=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return o+"."+ue(r)+"."+ue(s)}}function oe(o,e){const t=e+5;for(;o[e++]&128&&e<t;);return e}function pe(o){return("0"+o.toString(16).toUpperCase()).slice(-2)}function ue(o){return(o<10?"0":"")+o}function ye(o,e){if(!o||!e)return o;const t=e.keyId;return t&&e.isCommonEncryption&&de(o,["moov","trak"]).forEach(r=>{const a=de(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let h=de(a,["enca"]);const _=h.length>0;_||(h=de(a,["encv"])),h.forEach(d=>{const y=_?d.subarray(28):d.subarray(78);de(y,["sinf"]).forEach(B=>{const $=Se(B);if($){const W=$.subarray(8,24);W.some(Q=>Q!==0)||(F.log(`[eme] Patching keyId in 'enc${_?"a":"v"}>sinf>>tenc' box: ${ee.hexDump(W)} -> ${ee.hexDump(t)}`),$.set(t,8))}})})}),o}function Se(o){const e=de(o,["schm"])[0];if(e){const t=ut(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return de(o,["schi","tenc"])[0]}return null}function Ne(o,e){return de(e,["moof","traf"]).reduce((t,i)=>{const r=de(i,["tfdt"])[0],s=r[0],a=de(i,["tfhd"]).reduce((h,_)=>{const d=st(_,4),y=o[d];if(y){let S=st(r,4);if(s===1){if(S===Ve)return F.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),h;S*=Ve+1,S+=st(r,8)}const B=y.timescale||9e4,$=S/B;if(k($)&&(h===null||$<h))return $}return h},null);return a!==null&&k(a)&&(t===null||a<t)?a:t},null)}function Ie(o,e){let t=0,i=0,r=0;const s=de(o,["moof","traf"]);for(let a=0;a<s.length;a++){const h=s[a],_=de(h,["tfhd"])[0],d=st(_,4),y=e[d];if(!y)continue;const S=y.default,B=st(_,0)|(S==null?void 0:S.flags);let $=S==null?void 0:S.duration;B&8&&(B&2?$=st(_,12):$=st(_,8));const W=y.timescale||9e4,Q=de(h,["trun"]);for(let X=0;X<Q.length;X++){if(t=Ue(Q[X]),!t&&$){const se=st(Q[X],4);t=$*se}y.type===C.VIDEO?i+=t/W:y.type===C.AUDIO&&(r+=t/W)}}if(i===0&&r===0){let a=1/0,h=0,_=0;const d=de(o,["sidx"]);for(let y=0;y<d.length;y++){const S=Pe(d[y]);if(S!=null&&S.references){a=Math.min(a,S.earliestPresentationTime/S.timescale);const B=S.references.reduce(($,W)=>$+W.info.duration||0,0);h=Math.max(h,B+S.earliestPresentationTime/S.timescale),_=h-a}}if(_&&k(_))return _}return i||r}function Ue(o){const e=st(o,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=st(o,4);for(let s=0;s<r;s++){if(e&256){const a=st(o,t);i+=a,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function ke(o,e,t){de(e,["moof","traf"]).forEach(i=>{de(i,["tfhd"]).forEach(r=>{const s=st(r,4),a=o[s];if(!a)return;const h=a.timescale||9e4;de(i,["tfdt"]).forEach(_=>{const d=_[0],y=t*h;if(y){let S=st(_,4);if(d===0)S-=y,S=Math.max(S,0),Ce(_,4,S);else{S*=Math.pow(2,32),S+=st(_,8),S-=y,S=Math.max(S,0);const B=Math.floor(S/(Ve+1)),$=Math.floor(S%(Ve+1));Ce(_,4,B),Ce(_,8,$)}}})})})}function it(o){const e={valid:null,remainder:null},t=de(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 Xe(o,e){const t=new Uint8Array(o.length+e.length);return t.set(o),t.set(e,o.length),t}function Ye(o,e){const t=[],i=e.samples,r=e.timescale,s=e.id;let a=!1;return de(i,["moof"]).map(_=>{const d=_.byteOffset-8;de(_,["traf"]).map(S=>{const B=de(S,["tfdt"]).map($=>{const W=$[0];let Q=st($,4);return W===1&&(Q*=Math.pow(2,32),Q+=st($,8)),Q/r})[0];return B!==void 0&&(o=B),de(S,["tfhd"]).map($=>{const W=st($,4),Q=st($,0)&16777215,X=(Q&1)!==0,se=(Q&2)!==0,fe=(Q&8)!==0;let le=0;const we=(Q&16)!==0;let Ae=0;const He=(Q&32)!==0;let Te=8;W===s&&(X&&(Te+=8),se&&(Te+=4),fe&&(le=st($,Te),Te+=4),we&&(Ae=st($,Te),Te+=4),He&&(Te+=4),e.type==="video"&&(a=Qe(e.codec)),de(S,["trun"]).map(Fe=>{const $e=Fe[0],Le=st(Fe,0)&16777215,Je=(Le&1)!==0;let lt=0;const Gt=(Le&4)!==0,Dt=(Le&256)!==0;let Et=0;const _t=(Le&512)!==0;let St=0;const bt=(Le&1024)!==0,et=(Le&2048)!==0;let nt=0;const Mt=st(Fe,4);let kt=8;Je&&(lt=st(Fe,kt),kt+=4),Gt&&(kt+=4);let Wt=lt+d;for(let Yt=0;Yt<Mt;Yt++){if(Dt?(Et=st(Fe,kt),kt+=4):Et=le,_t?(St=st(Fe,kt),kt+=4):St=Ae,bt&&(kt+=4),et&&($e===0?nt=st(Fe,kt):nt=Ct(Fe,kt),kt+=4),e.type===C.VIDEO){let ti=0;for(;ti<St;){const li=st(i,Wt);if(Wt+=4,at(a,i[Wt])){const Ui=i.subarray(Wt,Wt+li);ct(Ui,a?2:1,o+nt/r,t)}Wt+=li,ti+=li+4}}o+=Et/r}}))})})}),t}function Qe(o){if(!o)return!1;const e=o.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function at(o,e){if(o){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function ct(o,e,t,i){const r=Ze(o);let s=0;s+=e;let a=0,h=0,_=0;for(;s<r.length;){a=0;do{if(s>=r.length)break;_=r[s++],a+=_}while(_===255);h=0;do{if(s>=r.length)break;_=r[s++],h+=_}while(_===255);const d=r.length-s;let y=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[y++]===181){const B=xt(r,y);if(y+=2,B===49){const $=st(r,y);if(y+=4,$===1195456820){const W=r[y++];if(W===3){const Q=r[y++],X=31&Q,se=64&Q,fe=se?2+X*3:0,le=new Uint8Array(fe);if(se){le[0]=Q;for(let we=1;we<fe;we++)le[we]=r[y++]}i.push({type:W,payloadType:a,pts:t,bytes:le})}}}}}else if(a===5&&h>16){const S=[];for(let W=0;W<16;W++){const Q=r[y++].toString(16);S.push(Q.length==1?"0"+Q:Q),(W===3||W===5||W===7||W===9)&&S.push("-")}const B=h-16,$=new Uint8Array(B);for(let W=0;W<B;W++)$[W]=r[y++];i.push({payloadType:a,pts:t,uuid:S.join(""),userData:ce($),userDataBytes:$})}}}function Ze(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 yt(o){const e=o[0];let t="",i="",r=0,s=0,a=0,h=0,_=0,d=0;if(e===0){for(;ut(o.subarray(d,d+1))!=="\0";)t+=ut(o.subarray(d,d+1)),d+=1;for(t+=ut(o.subarray(d,d+1)),d+=1;ut(o.subarray(d,d+1))!=="\0";)i+=ut(o.subarray(d,d+1)),d+=1;i+=ut(o.subarray(d,d+1)),d+=1,r=st(o,12),s=st(o,16),h=st(o,20),_=st(o,24),d=28}else if(e===1){d+=4,r=st(o,d),d+=4;const S=st(o,d);d+=4;const B=st(o,d);for(d+=4,a=Mo(2,32)*S+B,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=st(o,d),d+=4,_=st(o,d),d+=4;ut(o.subarray(d,d+1))!=="\0";)t+=ut(o.subarray(d,d+1)),d+=1;for(t+=ut(o.subarray(d,d+1)),d+=1;ut(o.subarray(d,d+1))!=="\0";)i+=ut(o.subarray(d,d+1)),d+=1;i+=ut(o.subarray(d,d+1)),d+=1}const y=o.subarray(d,o.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:a,presentationTimeDelta:s,eventDuration:h,id:_,payload:y}}function Lt(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 Rt(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),Lt([112,115,115,104],new Uint8Array([i,0,0,0]),o,s,r,a,t||new Uint8Array)}function It(o){const e=[];if(o instanceof ArrayBuffer){const t=o.byteLength;let i=0;for(;i+32<t;){const r=new DataView(o,i),s=Kt(r);e.push(s),i+=s.size}}return e}function Kt(o){const e=o.getUint32(0),t=o.byteOffset,i=o.byteLength;if(i<e)return{offset:t,size:i};if(o.getUint32(4)!==1886614376)return{offset:t,size:e};const s=o.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};const a=o.buffer,h=ee.hexDump(new Uint8Array(a,t+12,16)),_=o.getUint32(28);let d=null,y=null;if(s===0){if(e-32<_||_<22)return{offset:t,size:e};y=new Uint8Array(a,t+32,_)}else if(s===1){if(!_||i<t+32+_*16+16)return{offset:t,size:e};d=[];for(let S=0;S<_;S++)d.push(new Uint8Array(a,t+32+S*16,16))}return{version:s,systemId:h,kids:d,data:y,offset:t,size:e}}const rt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),dt={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 xe(o,e){const t=dt[e];return!!t&&!!t[o.slice(0,4)]}function ge(o,e,t=!0){return!o.split(",").some(i=>!be(i,e,t))}function be(o,e,t=!0){var i;const r=q(t);return(i=r==null?void 0:r.isTypeSupported(te(o,e)))!=null?i:!1}function te(o,e){return`${e}/mp4;codecs=${o}`}function re(o){if(o){const e=o.substring(0,4);return dt.video[e]}return 2}function ae(o){const e=rt();return o.split(",").reduce((t,i)=>{const s=e&&Qe(i)?9:dt.video[i];return s?(s*2+t)/(t?3:2):(dt.audio[i]+t)/(t?2:1)},0)}const he={};function _e(o,e=!0){if(he[o])return he[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(be(t[r],"audio",e))return he[o]=t[r],t[r];if(t[r]==="mp3"&&(i=q(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return o}const tt=/flac|opus|mp4a\.40\.34/i;function Ke(o,e=!0){return o.replace(tt,t=>_e(t.toLowerCase(),e))}function qe(o,e){const t=[];if(o){const i=o.split(",");for(let r=0;r<i.length;r++)xe(i[r],"video")||t.push(i[r])}return e&&t.push(e),t.join(",")}function ot(o,e){if(o&&(o.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(o)!==-1))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 Pt(o){const e=o.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");if(i.length>2){let r=i.shift()+".";r+=parseInt(i.shift()).toString(16),r+=("000"+parseInt(i.shift()).toString(16)).slice(-4),e[t]=r}}return e.join(",")}function Ft(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 Bt(o){const e=q(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 vt(o){return o.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const si={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function _i(o,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:o}}const zt={};function fi(o,e,t,i,r,s){const a=o.audioCodec?o.audioGroups:null,h=s==null?void 0:s.audioCodec,_=s==null?void 0:s.channels,d=_?parseInt(_):h?1/0:2;let y=null;if(a!=null&&a.length)try{a.length===1&&a[0]?y=e.groups[a[0]].channels:y=a.reduce((S,B)=>{if(B){const $=e.groups[B];if(!$)throw new Error(`Audio track group ${B} not found`);Object.keys($.channels).forEach(W=>{S[W]=(S[W]||0)+$.channels[W]})}return S},{2:0})}catch(S){return!0}return o.videoCodec!==void 0&&(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))||!!y&&k(d)&&Object.keys(y).some(S=>parseInt(S)>d)}function Nt(o,e,t){const i=o.videoCodec,r=o.audioCodec;if(!i&&!r||!t)return Promise.resolve(si);const s=[];if(i){const a={width:o.width,height:o.height,bitrate:Math.ceil(Math.max(o.bitrate*.9,o.averageBitrate)),framerate:o.frameRate||30},h=o.videoRange;h!=="SDR"&&(a.transferFunction=h.toLowerCase());const _=i.split(","),d=navigator.userAgent;if(_.some(y=>Qe(y))&&rt())return Promise.resolve(_i(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${d})`),s));s.push.apply(s,_.map(y=>({type:"media-source",video:u(u({},a),{},{contentType:te(Ft(y),"video")})})))}return r&&o.audioGroups&&o.audioGroups.forEach(a=>{var h;a&&((h=e.groups[a])==null||h.tracks.forEach(_=>{if(_.groupId===a){const d=_.channels||"",y=parseFloat(d);k(y)&&y>2&&s.push.apply(s,r.split(",").map(S=>({type:"media-source",audio:{contentType:te(S,"audio"),channels:""+y}})))}}))}),Promise.all(s.map(a=>{const h=mt(a);return zt[h]||(zt[h]=t.decodingInfo(a))})).then(a=>({supported:!a.some(h=>!h.supported),configurations:s,decodingInfoResults:a})).catch(a=>({supported:!1,configurations:s,decodingInfoResults:[],error:a}))}function mt(o){const{audio:e,video:t}=o,i=t||e;if(i){const r=vt(i.contentType);if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${r}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${r}`}return""}const Ut=["NONE","TYPE-0","TYPE-1",null];function ei(o){return Ut.indexOf(o)>-1}const ai=["SDR","PQ","HLG"];function Ti(o){return!!o&&ai.indexOf(o)>-1}var Ki={No:"",Yes:"YES",v2:"v2"};function yi(o){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=o,r=i<e/2;return e&&r?t?Ki.v2:Ki.Yes:Ki.No}class _r{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 Vt{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 gt(this._audioGroups,e)}hasSubtitleGroup(e){return gt(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 gt(o,e){return!e||!o?!1:o.indexOf(e)!==-1}function ht(){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 wt(o,e){let t=!1,i=[];if(o&&(t=o!=="SDR",i=[o]),e){i=e.allowedVideoRanges||ai.slice(0);const r=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&ht(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Zt=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,Zt(e));function Ri(o,e,t,i,r){const s=Object.keys(o),a=i==null?void 0:i.channels,h=i==null?void 0:i.audioCodec,_=r==null?void 0:r.videoCodec,d=a&&parseInt(a)===2;let y=!1,S=!1,B=1/0,$=1/0,W=1/0,Q=1/0,X=0,se=[];const{preferHDR:fe,allowedVideoRanges:le}=wt(e,r);for(let Fe=s.length;Fe--;){const $e=o[s[Fe]];y||(y=$e.channels[2]>0),B=Math.min(B,$e.minHeight),$=Math.min($,$e.minFramerate),W=Math.min(W,$e.minBitrate),le.filter(Je=>$e.videoRanges[Je]>0).length>0&&(S=!0)}B=k(B)?B:0,$=k($)?$:0;const we=Math.max(1080,B),Ae=Math.max(30,$);W=k(W)?W:t,t=Math.max(W,t),S||(e=void 0);const He=s.length>1;return{codecSet:s.reduce((Fe,$e)=>{const Le=o[$e];if($e===Fe)return Fe;if(se=S?le.filter(Je=>Le.videoRanges[Je]>0):[],He){if(Le.minBitrate>t)return bi($e,`min bitrate of ${Le.minBitrate} > current estimate of ${t}`),Fe;if(!Le.hasDefaultAudio)return bi($e,"no renditions with default or auto-select sound found"),Fe;if(h&&$e.indexOf(h.substring(0,4))%5!==0)return bi($e,`audio codec preference "${h}" not found`),Fe;if(a&&!d){if(!Le.channels[a])return bi($e,`no renditions with ${a} channel sound found (channels options: ${Object.keys(Le.channels)})`),Fe}else if((!h||d)&&y&&Le.channels[2]===0)return bi($e,"no renditions with stereo sound found"),Fe;if(Le.minHeight>we)return bi($e,`min resolution of ${Le.minHeight} > maximum of ${we}`),Fe;if(Le.minFramerate>Ae)return bi($e,`min framerate of ${Le.minFramerate} > maximum of ${Ae}`),Fe;if(!se.some(Je=>Le.videoRanges[Je]>0))return bi($e,`no variants with VIDEO-RANGE of ${At(se)} found`),Fe;if(_&&$e.indexOf(_.substring(0,4))%5!==0)return bi($e,`video codec preference "${_}" not found`),Fe;if(Le.maxScore<X)return bi($e,`max score of ${Le.maxScore} < selected max of ${X}`),Fe}return Fe&&(ae($e)>=ae(Fe)||Le.fragmentError>o[Fe].fragmentError)?Fe:(Q=Le.minIndex,X=Le.maxScore,$e)},void 0),videoRanges:se,preferHDR:fe,minFramerate:$,minBitrate:W,minIndex:Q}}function bi(o,e){F.log(`[abr] start candidates with "${o}" ignored because ${e}`)}function Xi(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 ii(o,e,t,i){return o.slice(t,i+1).reduce((r,s,a)=>{if(!s.codecSet)return r;const h=s.audioGroups;let _=r[s.codecSet];_||(r[s.codecSet]=_={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!h,fragmentError:0}),_.minBitrate=Math.min(_.minBitrate,s.bitrate);const d=Math.min(s.height,s.width);return _.minHeight=Math.min(_.minHeight,d),_.minFramerate=Math.min(_.minFramerate,s.frameRate),_.minIndex=Math.min(_.minIndex,a),_.maxScore=Math.max(_.maxScore,s.score),_.fragmentError+=s.fragmentError,_.videoRanges[s.videoRange]=(_.videoRanges[s.videoRange]||0)+1,h&&h.forEach(y=>{if(!y)return;const S=e.groups[y];S&&(_.hasDefaultAudio=_.hasDefaultAudio||e.hasDefaultAudio?S.hasDefault:S.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(S.channels).forEach(B=>{_.channels[B]=(_.channels[B]||0)+S.channels[B]}))}),r},{})}function ui(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 qt(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(Ci(o,r,t))return i}return-1}function Ci(o,e,t){const{groupId:i,name:r,lang:s,assocLang:a,default:h}=o,_=o.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(s===void 0||ki(s,e.lang))&&(s===void 0||e.assocLang===a)&&(h===void 0||e.default===h)&&(_===void 0||e.forced===_)&&(!("characteristics"in o)||Di(o.characteristics||"",e.characteristics))&&(t===void 0||t(o,e))}function ki(o,e="--"){return o.length===e.length?o===e:o.startsWith(e)||e.startsWith(o)}function Di(o,e=""){const t=o.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function Ht(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 Xt(o,e,t,i,r){const s=e[i],h=e.reduce((B,$,W)=>{const Q=$.uri;return(B[Q]||(B[Q]=[])).push(W),B},{})[s.uri];h.length>1&&(i=Math.max.apply(Math,h));const _=s.videoRange,d=s.frameRate,y=s.codecSet.substring(0,4),S=Jt(e,i,B=>{if(B.videoRange!==_||B.frameRate!==d||B.codecSet.substring(0,4)!==y)return!1;const $=B.audioGroups,W=t.filter(Q=>!$||$.indexOf(Q.groupId)!==-1);return qt(o,W,r)>-1});return S>-1?S:Jt(e,i,B=>{const $=B.audioGroups,W=t.filter(Q=>!$||$.indexOf(Q.groupId)!==-1);return qt(o,W,r)>-1})}function Jt(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 gi(o,e){var t;return!!o&&o!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Si extends D{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:r,partCurrent:s,hls:a}=this,{autoLevelEnabled:h,media:_}=a;if(!r||!_)return;const d=performance.now(),y=s?s.stats:r.stats,S=s?s.duration:r.duration,B=d-y.loading.start,$=a.minAutoLevel,W=r.level,Q=this._nextAutoLevel;if(y.aborted||y.loaded&&y.loaded===y.total||W<=$){this.clearTimer(),this._nextAutoLevel=-1;return}if(!h)return;const X=Q>-1&&Q!==W,se=!!t||X;if(!se&&(_.paused||!_.playbackRate||!_.readyState))return;const fe=a.mainForwardBufferInfo;if(!se&&fe===null)return;const le=this.bwEstimator.getEstimateTTFB(),we=Math.abs(_.playbackRate);if(B<=Math.max(le,1e3*(S/(we*2))))return;const Ae=fe?fe.len/we:0,He=y.loading.first?y.loading.first-y.loading.start:-1,Te=y.loaded&&He>-1,Fe=this.getBwEstimate(),$e=a.levels,Le=$e[W],Je=Math.max(y.loaded,Math.round(S*(r.bitrate||Le.averageBitrate)/8));let lt=Te?B-He:B;lt<1&&Te&&(lt=Math.min(B,y.loaded*8/Fe));const Gt=Te?y.loaded*1e3/lt:0,Dt=le/1e3,Et=Gt?(Je-y.loaded)/Gt:Je*8/Fe+Dt;if(Et<=Ae)return;const _t=Gt?Gt*8:Fe,St=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,bt=this.hls.config.abrBandWidthUpFactor;let et=Number.POSITIVE_INFINITY,nt;for(nt=W-1;nt>$;nt--){const Yt=$e[nt].maxBitrate,ti=!$e[nt].details||St;if(et=this.getTimeToLoadFrag(Dt,_t,S*Yt,ti),et<Math.min(Ae,S+Dt))break}if(et>=Et||et>S*10)return;Te?this.bwEstimator.sample(B-Math.min(le,He),y.loaded):this.bwEstimator.sampleTTFB(B);const Mt=$e[nt].maxBitrate;this.getBwEstimate()*bt>Mt&&this.resetEstimator(Mt);const kt=this.findBestLevel(Mt,$,nt,0,Ae,1,1);kt>-1&&(nt=kt),this.warn(`Fragment ${r.sn}${s?" part "+s.index:""} of level ${W} is loading too slowly;
|
|
|
Fragment duration: ${r.duration.toFixed(3)}
|
|
|
Time to underbuffer: ${Ae.toFixed(3)} s
|
|
|
Estimated load time for current fragment: ${Et.toFixed(3)} s
|
|
|
Estimated load time for down switch fragment: ${et.toFixed(3)} s
|
|
|
TTFB estimate: ${He|0} ms
|
|
|
Current BW estimate: ${k(Fe)?Fe|0:"Unknown"} bps
|
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
|
Switching to level ${nt} @ ${Mt|0} bps`),a.nextLoadLevel=a.nextAutoLevel=nt,this.clearTimer();const Wt=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===nt&&nt>0){const Yt=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${nt>0?"and switching down":""}
|
|
|
Fragment duration: ${r.duration.toFixed(3)} s
|
|
|
Time to underbuffer: ${Yt.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,nt>$){let ti=this.findBestLevel(this.hls.levels[$].bitrate,$,nt,0,Yt,1,1);ti===-1&&(ti=$),this.hls.nextLoadLevel=this.hls.nextAutoLevel=ti,this.resetEstimator(this.hls.levels[ti].bitrate)}}};X||Et>et*2?Wt():this.timer=self.setInterval(Wt,et*1e3),a.trigger(g.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:s,stats:y})},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 v(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(g.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var 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 x.BUFFER_ADD_CODEC_ERROR:case x.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case x.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,_=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(_-Math.min(S,d),h.loaded)}else this.bwEstimator.sampleTTFB(_)}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,_=(a.loaded?a.loaded.duration:0)+s;a.loaded={bytes:h,duration:_},a.realBitrate=Math.round(8*h/_)}if(t.bitrateTest){const s={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(g.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,_=this.getBwEstimate(),d=this.getStarvationDelay();let y=s.abrBandWidthFactor,S=s.abrBandWidthUpFactor;if(d){const X=this.findBestLevel(_,a,r,d,0,y,S);if(X>=0)return this.rebufferNotice=-1,X}let B=h?Math.min(h,s.maxStarvationDelay):s.maxStarvationDelay;if(!d){const X=this.bitrateTestDelay;X&&(B=(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*B)} ms`),y=S=1)}const $=this.findBestLevel(_,a,r,d,B,y,S);if(this.rebufferNotice!==$&&(this.rebufferNotice=$,this.info(`${d?"rebuffering expected":"buffer is empty"}, optimal quality level ${$}`)),$>-1)return $;const W=i.levels[a],Q=i.loadLevelObj;return Q&&(W==null?void 0:W.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 _;const d=r+s,y=this.lastLoadedFragLevel,S=y===-1?this.hls.firstLevel:y,{fragCurrent:B,partCurrent:$}=this,{levels:W,allAudioTracks:Q,loadLevel:X,config:se}=this.hls;if(W.length===1)return 0;const fe=W[S],le=!!((_=this.hls.latestLevelDetails)!=null&&_.live),we=X===-1||y===-1;let Ae,He="SDR",Te=(fe==null?void 0:fe.frameRate)||0;const{audioPreference:Fe,videoPreference:$e}=se,Le=this.audioTracksByGroup||(this.audioTracksByGroup=Xi(Q));let Je=-1;if(we){if(this.firstSelection!==-1)return this.firstSelection;const _t=this.codecTiers||(this.codecTiers=ii(W,Le,t,i)),St=Ri(_t,He,e,Fe,$e),{codecSet:bt,videoRanges:et,minFramerate:nt,minBitrate:Mt,minIndex:kt,preferHDR:Wt}=St;Je=kt,Ae=bt,He=Wt?et[et.length-1]:et[0],Te=nt,e=Math.max(e,Mt),this.log(`picked start tier ${At(St)}`)}else Ae=fe==null?void 0:fe.codecSet,He=fe==null?void 0:fe.videoRange;const lt=$?$.duration:B?B.duration:0,Gt=this.bwEstimator.getEstimateTTFB()/1e3,Dt=[];for(let _t=i;_t>=t;_t--){var Et;const St=W[_t],bt=_t>S;if(!St)continue;if(se.useMediaCapabilities&&!St.supportedResult&&!St.supportedPromise){const ti=navigator.mediaCapabilities;typeof(ti==null?void 0:ti.decodingInfo)=="function"&&(fi(St,Le,He,Te,e,Fe)||Qe(St.videoCodec))?(St.supportedPromise=Nt(St,Le,ti),St.supportedPromise.then(li=>{if(!this.hls)return;St.supportedResult=li;const Ui=this.hls.levels,Gi=Ui.indexOf(St);li.error?this.warn(`MediaCapabilities decodingInfo error: "${li.error}" for level ${Gi} ${At(li)}`):li.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Gi} ${At(li)}`),Gi>-1&&Ui.length>1&&(this.log(`Removing unsupported level ${Gi}`),this.hls.removeLevel(Gi),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):St.supportedResult=si}if((Ae&&St.codecSet!==Ae||He&&St.videoRange!==He||bt&&Te>St.frameRate||!bt&&Te>0&&Te<St.frameRate||St.supportedResult&&!((Et=St.supportedResult.decodingInfoResults)!=null&&Et[0].smooth))&&(!we||_t!==Je)){Dt.push(_t);continue}const et=St.details,nt=($?et==null?void 0:et.partTarget:et==null?void 0:et.averagetargetduration)||lt;let Mt;bt?Mt=h*e:Mt=a*e;const kt=lt&&r>=lt*2&&s===0?St.averageBitrate:St.maxBitrate,Wt=this.getTimeToLoadFrag(Gt,Mt,kt*nt,et===void 0);if(Mt>=kt&&(_t===y||St.loadError===0&&St.fragmentError===0)&&(Wt<=Gt||!k(Wt)||le&&!this.bitrateTestDelay||Wt<d)){const ti=this.forcedAutoLevel;return _t!==X&&(ti===-1||ti!==X)&&(Dt.length&&this.trace(`Skipped level(s) ${Dt.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${W[Dt[0]].codecs}" ${W[Dt[0]].videoRange}; not compatible with "${Ae}" ${He}`),this.info(`switch candidate:${S}->${_t} adjustedbw(${Math.round(Mt)})-bitrate=${Math.round(Mt-kt)} ttfb:${Gt.toFixed(1)} avgDuration:${nt.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${Wt.toFixed(1)} firstSelection:${we} codecSet:${St.codecSet} videoRange:${St.videoRange} hls.loadLevel:${X}`)),we&&(this.firstSelection=_t),_t}}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 ci={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 Mi(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;t=t||0;for(let s=0;s<o.length;++s){const a=o[s];if(ri(e,t,a))return a}return null}function zi(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)&&nr(t,i,s)===0||Li(s,o,Math.min(r,i))))return s;const a=ci.search(e,nr.bind(null,t,i));return a&&(a!==o||!s)?a:s}function Li(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 nr(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 ri(o,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>o}function ni(o,e){return ci.search(o,t=>t.cc<e?1:t.cc>e?-1:0)}function Vi(o,e,t){if(o&&o.startCC<=e&&o.endCC>=e){const i=t.start,r=t.end;let s=o.fragments;if(!t.relurl){const{fragmentHint:a}=o;a&&(s=s.concat(a))}return ci.search(s,a=>a.cc<e||a.end<=i?1:a.cc>e||a.start>=r?-1:0)}return null}function Qi(o){switch(o.details){case x.FRAG_LOAD_TIMEOUT:case x.KEY_LOAD_TIMEOUT:case x.LEVEL_LOAD_TIMEOUT:case x.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Cr(o,e){const t=Qi(e);return o.default[`${t?"timeout":"error"}Retry`]}function Ii(o,e){const t=o.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*o.retryDelayMs,o.maxRetryDelayMs)}function Nr(o){return u(u({},o),{errorRetry:null,timeoutRetry:null})}function or(o,e,t,i){if(!o)return!1;const r=i==null?void 0:i.code,s=e<o.maxNumRetry&&(lr(r)||!!t);return o.shouldRetry?o.shouldRetry(o,e,t,i,s):s}function lr(o){return o===0&&navigator.onLine===!1||!!o&&(o<400||o>499)}var mi={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Bi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Ur extends D{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(g.ERROR,this.onError,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.ERROR,this.onError,this),e.off(g.ERROR,this.onErrorOut,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.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 x.FRAG_LOAD_ERROR:case x.FRAG_LOAD_TIMEOUT:case x.KEY_LOAD_ERROR:case x.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case x.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Ji();return}case x.FRAG_GAP:case x.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=mi.SendAlternateToPenaltyBox;return}case x.LEVEL_EMPTY_ERROR:case x.LEVEL_PARSING_ERROR:{var a,h;const d=t.parent===m.MAIN?t.level:r.loadLevel;t.details===x.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 x.LEVEL_LOAD_ERROR:case x.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case x.AUDIO_TRACK_LOAD_ERROR:case x.AUDIO_TRACK_LOAD_TIMEOUT:case x.SUBTITLE_LOAD_ERROR:case x.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=mi.SendAlternateToPenaltyBox,t.errorAction.flags=Bi.MoveAllAlternatesMatchingHost;return}}return;case x.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const d=r.loadLevelObj,y=d==null?void 0:d.attrs["HDCP-LEVEL"];y?t.errorAction={action:mi.SendAlternateToPenaltyBox,flags:Bi.MoveAllAlternatesMatchingHDCP,hdcpLevel:y}:this.keySystemError(t)}return;case x.BUFFER_ADD_CODEC_ERROR:case x.REMUX_ALLOC_ERROR:case x.BUFFER_APPEND_ERROR:if(!t.errorAction){var _;t.errorAction=this.getLevelSwitchAction(t,(_=t.level)!=null?_:r.loadLevel)}return;case x.INTERNAL_EXCEPTION:case x.BUFFER_APPENDING_ERROR:case x.BUFFER_FULL_ERROR:case x.LEVEL_SWITCH_ERROR:case x.BUFFER_STALLED_ERROR:case x.BUFFER_SEEK_OVER_HOLE:case x.BUFFER_NUDGE_ON_STALL:t.errorAction=Ji();return}t.type===T.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=Cr(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(or(r,s,Qi(e),e.response))return{action:mi.RetryRequest,flags:Bi.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=Cr(e.details.startsWith("key")?a:s,e),_=t.levels.reduce((y,S)=>y+S.fragmentError,0);if(r&&(e.details!==x.FRAG_GAP&&r.fragmentError++,or(h,_,Qi(e),e.response)))return{action:mi.RetryRequest,flags:Bi.None,retryConfig:h,retryCount:_};const d=this.getLevelSwitchAction(e,i);return h&&(d.retryConfig=h,d.retryCount=_),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===x.BUFFER_APPEND_ERROR&&r.fragmentError++;let y=-1;const{levels:S,loadLevel:B,minAutoLevel:$,maxAutoLevel:W}=i;i.autoLevelEnabled||(i.loadLevel=-1);const Q=(s=e.frag)==null?void 0:s.type,se=(Q===m.AUDIO&&d===x.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(d===x.BUFFER_ADD_CODEC_ERROR||d===x.BUFFER_APPEND_ERROR))&&S.some(({audioCodec:He})=>r.audioCodec!==He),le=e.sourceBufferName==="video"&&(d===x.BUFFER_ADD_CODEC_ERROR||d===x.BUFFER_APPEND_ERROR)&&S.some(({codecSet:He,audioCodec:Te})=>r.codecSet!==He&&r.audioCodec===Te),{type:we,groupId:Ae}=(a=e.context)!=null?a:{};for(let He=S.length;He--;){const Te=(He+B)%S.length;if(Te!==B&&Te>=$&&Te<=W&&S[Te].loadError===0){var h,_;const Fe=S[Te];if(d===x.FRAG_GAP&&Q===m.MAIN&&e.frag){const $e=S[Te].details;if($e){const Le=zi(e.frag,$e.fragments,e.frag.start);if(Le!=null&&Le.gap)continue}}else{if(we===O.AUDIO_TRACK&&Fe.hasAudioGroup(Ae)||we===O.SUBTITLE_TRACK&&Fe.hasSubtitleGroup(Ae))continue;if(Q===m.AUDIO&&(h=r.audioGroups)!=null&&h.some($e=>Fe.hasAudioGroup($e))||Q===m.SUBTITLE&&(_=r.subtitleGroups)!=null&&_.some($e=>Fe.hasSubtitleGroup($e))||se&&r.audioCodec===Fe.audioCodec||!se&&r.audioCodec!==Fe.audioCodec||le&&r.codecSet===Fe.codecSet)continue}y=Te;break}}if(y>-1&&i.loadLevel!==y)return e.levelRetry=!0,this.playlistError=0,{action:mi.SendAlternateToPenaltyBox,flags:Bi.None,nextAutoLevel:y}}return{action:mi.SendAlternateToPenaltyBox,flags:Bi.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case mi.DoNothing:break;case mi.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==x.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 mi.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 Bi.None:this.switchLevel(e,a);break;case Bi.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=Ut[Ut.indexOf(s)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,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===x.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=vt(e.mimeType),r=this.hls.levels;for(let s=r.length;s--;)r[s][`${e.sourceBufferName}Codec`]===i&&this.hls.removeLevel(s)}}}function Ji(o){const e={action:mi.DoNothing,flags:Bi.None};return o&&(e.resolved=!0),e}var di={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class gr{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(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.BUFFER_APPENDED,this.onBufferAppended,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.BUFFER_APPENDED,this.onBufferAppended,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.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 _=h.body;if(_.start<=e&&e<=_.end)return _}}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 _=this.fragments[h];if(!_||a>=_.body.sn)return;if(!_.buffered&&(!_.loaded||s)){_.body.type===i&&this.removeFragment(_.body);return}const d=_.range[e];if(d){if(d.time.length===0){this.removeFragment(_.body);return}d.time.some(y=>{const S=!this.isTimeBuffered(y.startPTS,y.endPTS,t);return S&&this.removeFragment(_.body),S})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,r=Pi(i),s=this.fragments[r];if(!s||s.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(h=>{const _=i.elementaryStreams[h];if(!_)return;const d=t[h],y=a||_.partial===!0;s.range[h]=this.getBufferedTimes(i,e.part,y,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),er(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=mr(i,r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=Pi(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,_=e.minEndPTS||h,d=e.maxStartPTS||a;for(let y=0;y<r.length;y++){const S=r.start(y)-this.bufferPadding,B=r.end(y)+this.bufferPadding;if(d>=S&&_<=B){s.time.push({startPTS:Math.max(a,r.start(y)),endPTS:Math.min(h,r.end(y))});break}else if(a<B&&h>S){const $=Math.max(a,r.start(y)),W=Math.min(h,r.end(y));W>$&&(s.partial=!0,s.time.push({startPTS:$,endPTS:W}))}else if(h<=S)break}return s}getPartialFragment(e){let t=null,i,r,s,a=0;const{bufferPadding:h,fragments:_}=this;return Object.keys(_).forEach(d=>{const y=_[d];y&&er(y)&&(r=y.body.start-h,s=y.body.end+h,e>=r&&e<=s&&(i=Math.min(e-r,s-e),a<=i&&(t=y.body,a=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||er(t))}getState(e){const t=Pi(e),i=this.fragments[t];return i?i.buffered?er(i)?di.PARTIAL:di.OK:di.APPENDING:di.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=Pi(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 _=s[a];this.detectEvictedFragments(a,_,h,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Pi(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 _=h.body;_.type!==i||r&&!_.gap||_.start<t&&_.end>e&&(h.buffered||s)&&this.removeFragment(_)})}removeFragment(e){const t=Pi(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=mr(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 er(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 Pi(o){return`${o.type}_${o.level}_${o.sn}`}function mr(o,e){return o.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Oi={cbc:0,ctr:1};class en{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 Oi.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Oi.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 xi(o){const e=o.byteLength,t=e&&new DataView(o.buffer).getUint8(e-1);return t?o.slice(0,e-t):o}class tn{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],_=this.invSubMix,d=_[0],y=_[1],S=_[2],B=_[3],$=new Uint32Array(256);let W=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[W]=se,t[se]=W;const fe=$[W],le=$[fe],we=$[le];let Ae=$[se]*257^se*16843008;r[W]=Ae<<24|Ae>>>8,s[W]=Ae<<16|Ae>>>16,a[W]=Ae<<8|Ae>>>24,h[W]=Ae,Ae=we*16843009^le*65537^fe*257^W*16843008,d[se]=Ae<<24|Ae>>>8,y[se]=Ae<<16|Ae>>>16,S[se]=Ae<<8|Ae>>>24,B[se]=Ae,W?(W=fe^$[$[$[we^fe]]],Q^=$[$[Q]]):W=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,_;const d=this.keySchedule=new Uint32Array(a),y=this.invKeySchedule=new Uint32Array(a),S=this.sBox,B=this.rcon,$=this.invSubMix,W=$[0],Q=$[1],X=$[2],se=$[3];let fe,le;for(h=0;h<a;h++){if(h<s){fe=d[h]=t[h];continue}le=fe,h%s===0?(le=le<<8|le>>>24,le=S[le>>>24]<<24|S[le>>>16&255]<<16|S[le>>>8&255]<<8|S[le&255],le^=B[h/s|0]<<24):s>6&&h%s===4&&(le=S[le>>>24]<<24|S[le>>>16&255]<<16|S[le>>>8&255]<<8|S[le&255]),d[h]=fe=(d[h-s]^le)>>>0}for(_=0;_<a;_++)h=a-_,_&3?le=d[h]:le=d[h-4],_<4||h<=4?y[_]=le:y[_]=W[S[le>>>24]]^Q[S[le>>>16&255]]^X[S[le>>>8&255]]^se[S[le&255]],y[_]=y[_]>>>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,_=h[0],d=h[1],y=h[2],S=h[3],B=this.uint8ArrayToUint32Array_(i);let $=B[0],W=B[1],Q=B[2],X=B[3];const se=new Int32Array(e),fe=new Int32Array(se.length);let le,we,Ae,He,Te,Fe,$e,Le,Je,lt,Gt,Dt,Et,_t;const St=this.networkToHostOrderSwap;for(;t<se.length;){for(Je=St(se[t]),lt=St(se[t+1]),Gt=St(se[t+2]),Dt=St(se[t+3]),Te=Je^s[0],Fe=Dt^s[1],$e=Gt^s[2],Le=lt^s[3],Et=4,_t=1;_t<r;_t++)le=_[Te>>>24]^d[Fe>>16&255]^y[$e>>8&255]^S[Le&255]^s[Et],we=_[Fe>>>24]^d[$e>>16&255]^y[Le>>8&255]^S[Te&255]^s[Et+1],Ae=_[$e>>>24]^d[Le>>16&255]^y[Te>>8&255]^S[Fe&255]^s[Et+2],He=_[Le>>>24]^d[Te>>16&255]^y[Fe>>8&255]^S[$e&255]^s[Et+3],Te=le,Fe=we,$e=Ae,Le=He,Et=Et+4;le=a[Te>>>24]<<24^a[Fe>>16&255]<<16^a[$e>>8&255]<<8^a[Le&255]^s[Et],we=a[Fe>>>24]<<24^a[$e>>16&255]<<16^a[Le>>8&255]<<8^a[Te&255]^s[Et+1],Ae=a[$e>>>24]<<24^a[Le>>16&255]<<16^a[Te>>8&255]<<8^a[Fe&255]^s[Et+2],He=a[Le>>>24]<<24^a[Te>>16&255]<<16^a[Fe>>8&255]<<8^a[$e&255]^s[Et+3],fe[t]=St(le^$),fe[t+1]=St(He^W),fe[t+2]=St(Ae^Q),fe[t+3]=St(we^X),$=Je,W=lt,Q=Gt,X=Dt,t=t+4}return fe.buffer}}class yn{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=vr(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function vr(o){switch(o){case Oi.cbc:return"AES-CBC";case Oi.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${o}`)}}const rn=16;class Hr{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?xi(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 _=this.flush();_?s(_.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!==Oi.cbc||t.byteLength!==16)return F.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),h&&(e=Xe(h,e),this.remainderData=null);const _=this.getValidChunk(e);if(!_.length)return null;s&&(i=s);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new tn),d.expandKey(t);const y=a;return this.currentResult=d.decrypt(_.buffer,0,i),this.currentIV=_.slice(-16).buffer,y||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 yn(this.subtle,t,r)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new en(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%rn;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 $r=Math.pow(2,17);class nn{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 wi({type:T.NETWORK_ERROR,details:x.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,_)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(W=>W[0]==="GAP")){_(jr(e));return}else e.gap=!1;const d=this.loader=s?new s(r):new a(r),y=ur(e);e.loader=d;const S=Nr(r.fragLoadPolicy.default),B={loadPolicy:S,timeout:S.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:$r};e.stats=d.stats;const $={onSuccess:(W,Q,X,se)=>{this.resetLoader(e,d);let fe=W.data;X.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(fe.slice(0,16)),fe=fe.slice(16)),h({frag:e,part:null,payload:fe,networkDetails:se})},onError:(W,Q,X,se)=>{this.resetLoader(e,d),_(new wi({type:T.NETWORK_ERROR,details:x.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:u({url:i,data:void 0},W),error:new Error(`HTTP Error ${W.code} ${W.text}`),networkDetails:X,stats:se}))},onAbort:(W,Q,X)=>{this.resetLoader(e,d),_(new wi({type:T.NETWORK_ERROR,details:x.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:X,stats:W}))},onTimeout:(W,Q,X)=>{this.resetLoader(e,d),_(new wi({type:T.NETWORK_ERROR,details:x.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${B.timeout}ms`),networkDetails:X,stats:W}))}};t&&($.onProgress=(W,Q,X,se)=>t({frag:e,part:null,payload:X,networkDetails:se})),d.load(y,B,$)})}loadPart(e,t,i){this.abort();const r=this.config,s=r.fLoader,a=r.loader;return new Promise((h,_)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){_(jr(e,t));return}const d=this.loader=s?new s(r):new a(r),y=ur(e,t);e.loader=d;const S=Nr(r.fragLoadPolicy.default),B={loadPolicy:S,timeout:S.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:$r};t.stats=d.stats,d.load(y,B,{onSuccess:($,W,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:($,W,Q,X)=>{this.resetLoader(e,d),_(new wi({type:T.NETWORK_ERROR,details:x.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:u({url:y.url,data:void 0},$),error:new Error(`HTTP Error ${$.code} ${$.text}`),networkDetails:Q,stats:X}))},onAbort:($,W,Q)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,d),_(new wi({type:T.NETWORK_ERROR,details:x.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:Q,stats:$}))},onTimeout:($,W,Q)=>{this.resetLoader(e,d),_(new wi({type:T.NETWORK_ERROR,details:x.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${B.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 _=Math.round(e.duration/t.duration),d=Math.min(Math.round(i.loaded/s),_),S=(_-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,_=s;if(o.sn==="initSegment"&&Ar((a=o.decryptdata)==null?void 0:a.method)){const d=s-r;d%16&&(_=s+(16-d%16)),r!==0&&(i.resetIV=!0,h=r-16)}i.rangeStart=h,i.rangeEnd=_}return i}function jr(o,e){const t=new Error(`GAP ${o.gap?"tag":"attribute"} found`),i={type:T.MEDIA_ERROR,details:x.FRAG_GAP,fatal:!1,frag:o,error:t,networkDetails:null};return e&&(i.part=e),(e||o).stats.aborted=!0,new wi(i)}function Ar(o){return o==="AES-128"||o==="AES-256"}class wi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Wr extends D{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=Ni(),this.buffering={audio:Ni(),video:Ni(),audiovideo:Ni()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=s,this.partial=a}}function Ni(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Hi={length:0,start:()=>0,end:()=>0};class Ot{static isBuffered(e,t){if(e){const i=Ot.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=Ot.getBuffered(e);return Ot.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=Ot.bufferedRanges(e);if(r.length)return Ot.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((y,S)=>y.start-S.start||S.end-y.end);let r=-1,s=[];if(i)for(let y=0;y<e.length;y++){t>=e[y].start&&t<=e[y].end&&(r=y);const S=s.length;if(S){const B=s[S-1].end;e[y].start-B<i?e[y].end>B&&(s[S-1].end=e[y].end):s.push(e[y])}else s.push(e[y])}else s=e;let a=0,h,_=t,d=t;for(let y=0;y<s.length;y++){const S=s[y].start,B=s[y].end;if(r===-1&&t>=S&&t<=B&&(r=y),t+i>=S&&t<B)_=S,d=B,a=d-t;else if(t+i<S){h=S;break}}return{len:a,start:_||0,end:d||0,nextStart:h,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||Hi}catch(t){return F.log("failed to get media.buffered",t),Hi}}}const yr=/\{\$([a-zA-Z0-9-_]+)\}/g;function qi(o){return yr.test(o)}function Gr(o,e){if(o.variableList!==null||o.hasVariableRefs){const t=o.variableList;return e.replace(yr,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 Kr(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 zr=/^(\d+)x(\d+)$/,sn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class oi{constructor(e,t){typeof e=="string"&&(e=oi.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=zr.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(sn.lastIndex=0;(i=sn.exec(e))!==null;){const a=i[1].trim();let h=i[2];const _=h.indexOf(s)===0&&h.lastIndexOf(s)===h.length-1;let d=!1;if(_)h=h.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":d=!0}if(t&&(_||d))h=Gr(t,h);else if(!d&&!_)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 an(o){return o!=="ID"&&o!=="CLASS"&&o!=="CUE"&&o!=="START-DATE"&&o!=="DURATION"&&o!=="END-DATE"&&o!=="END-ON-NEXT"}function Sn(o){return o==="SCTE35-OUT"||o==="SCTE35-IN"||o==="SCTE35-CMD"}class on{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 oi({}),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 ln=10;class xn{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||ln}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){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 br(o){switch(o){case"AES-128":case"AES-256":return Oi.cbc;case"AES-256-CTR":return Oi.ctr;default:throw new Error(`invalid full segment method ${o}`)}}function $i(o){return Uint8Array.from(atob(o),e=>e.charCodeAt(0))}function Vr(o){return Uint8Array.from(unescape(encodeURIComponent(o)),e=>e.charCodeAt(0))}function ji(o){const e=Vr(o).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function un(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 Dr(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=$i(a)):t=ji(a)}}return t}const Yi=typeof self!="undefined"?self:void 0;var jt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ei={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Lr(o){switch(o){case Ei.FAIRPLAY:return jt.FAIRPLAY;case Ei.PLAYREADY:return jt.PLAYREADY;case Ei.WIDEVINE:return jt.WIDEVINE;case Ei.CLEARKEY:return jt.CLEARKEY}}var Rr={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function qr(o){if(o===Rr.WIDEVINE)return jt.WIDEVINE;if(o===Rr.PLAYREADY)return jt.PLAYREADY;if(o===Rr.CENC||o===Rr.CLEARKEY)return jt.CLEARKEY}function Yr(o){switch(o){case jt.FAIRPLAY:return Ei.FAIRPLAY;case jt.PLAYREADY:return Ei.PLAYREADY;case jt.WIDEVINE:return Ei.WIDEVINE;case jt.CLEARKEY:return Ei.CLEARKEY}}function pt(o){const{drmSystems:e,widevineLicenseUrl:t}=o,i=e?[jt.FAIRPLAY,jt.WIDEVINE,jt.PLAYREADY,jt.CLEARKEY].filter(r=>!!e[r]):[];return!i[jt.WIDEVINE]&&t&&i.push(jt.WIDEVINE),i}const Tt=function(o){return Yi!=null&&(o=Yi.navigator)!=null&&o.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function hi(o,e,t,i){let r;switch(o){case jt.FAIRPLAY:r=["cenc","sinf"];break;case jt.WIDEVINE:case jt.PLAYREADY:r=["cenc"];break;case jt.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${o}`)}return vi(r,e,t,i)}function vi(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 pi(o){var e;return o.sessionType==="persistent-license"||!!((e=o.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function Zr(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 _=$i(h).subarray(0,16);return un(_),_}}return null}let kr={};class Ir{static clearKeyUriToKeyIdMap(){kr={}}constructor(e,t,i,r=[1],s=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!cr(e)}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 Ei.FAIRPLAY:case Ei.WIDEVINE:case Ei.PLAYREADY:case Ei.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=cn(e);return new Ir(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=Dr(this.uri);if(t)switch(this.keyFormat){case Ei.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Ei.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Rt(i,null,t),this.keyId=Zr(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=kr[this.uri];if(!i){const r=Object.keys(kr).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),kr[this.uri]=i}this.keyId=i}return this}}function cn(o){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=o>>8*(15-t)&255;return e}const $s=/#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,js=/#EXT-X-MEDIA:(.*)/g,Uo=/^#EXT(?:INF|-X-TARGETDURATION):/m,Qn=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 j.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Uo.test(e)}static parseMasterPlaylist(e,t){const i=qi(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];$s.lastIndex=0;let a;for(;(a=$s.exec(e))!=null;)if(a[1]){var h;const d=new oi(a[1],r),y=Gr(r,a[2]),S={attrs:d,bitrate:d.decimalInteger("BANDWIDTH")||d.decimalInteger("AVERAGE-BANDWIDTH"),name:d.NAME,url:hr.resolve(y,t)},B=d.decimalResolution("RESOLUTION");B&&(S.width=B.width,S.height=B.height),zs(d.CODECS,S);const $=d["SUPPLEMENTAL-CODECS"];$&&(S.supplemental={},zs($,S.supplemental)),(h=S.unknownCodecs)!=null&&h.length||s.push(S),r.levels.push(S)}else if(a[3]){const d=a[3],y=a[4];switch(d){case"SESSION-DATA":{const S=new oi(y,r),B=S["DATA-ID"];B&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[B]=S);break}case"SESSION-KEY":{const S=Gs(y,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: "${y}"`);break}case"DEFINE":{{const S=new oi(y,r);Kr(r,S,t)}break}case"CONTENT-STEERING":{const S=new oi(y,r);r.contentSteering={uri:hr.resolve(S["SERVER-URI"],t),pathwayId:S["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=Ks(y);break}}}const _=s.length>0&&s.length<r.levels.length;return r.levels=_?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 _=0;for(js.lastIndex=0;(r=js.exec(e))!==null;){const d=new oi(r[1],i),y=d.TYPE;if(y){const S=h[y],B=s[y]||[];s[y]=B;const $=d.LANGUAGE,W=d["ASSOC-LANGUAGE"],Q=d.CHANNELS,X=d.CHARACTERISTICS,se=d["INSTREAM-ID"],fe={attrs:d,bitrate:0,id:_++,groupId:d["GROUP-ID"]||"",name:d.NAME||$||"",type:y,default:d.bool("DEFAULT"),autoselect:d.bool("AUTOSELECT"),forced:d.bool("FORCED"),lang:$,url:d.URI?hr.resolve(d.URI,t):""};if(W&&(fe.assocLang=W),Q&&(fe.channels=Q),X&&(fe.characteristics=X),se&&(fe.instreamId=se),S!=null&&S.length){const le=hr.findGroup(S,fe.groupId)||S[0];Vs(fe,le,"audioCodec"),Vs(fe,le,"textCodec")}B.push(fe)}}return s}static parseLevelPlaylist(e,t,i,r,s,a){var h;const _={url:t},d=new xn(t),y=d.fragments,S=[];let B=null,$=0,W=0,Q=0,X=0,se=0,fe=null,le=new ve(r,_),we,Ae,He,Te=-1,Fe=!1,$e=null,Le;if(Qn.lastIndex=0,d.m3u8=e,d.hasVariableRefs=qi(e),((h=Qn.exec(e))==null?void 0:h[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(we=Qn.exec(e))!==null;){Fe&&(Fe=!1,le=new ve(r,_),le.playlistOffset=Q,le.start=Q,le.sn=$,le.cc=X,se&&(le.bitrate=se),le.level=i,B&&(le.initSegment=B,B.rawProgramDateTime&&(le.rawProgramDateTime=B.rawProgramDateTime,B.rawProgramDateTime=null),$e&&(le.setByteRange($e),$e=null)));const Dt=we[1];if(Dt){le.duration=parseFloat(Dt);const Et=(" "+we[2]).slice(1);le.title=Et||null,le.tagList.push(Et?["INF",Dt,Et]:["INF",Dt])}else if(we[3]){if(k(le.duration)){le.playlistOffset=Q,le.start=Q,He&&Ys(le,He,d),le.sn=$,le.level=i,le.cc=X,y.push(le);const Et=(" "+we[3]).slice(1);le.relurl=Gr(d,Et),Jn(le,fe,S),fe=le,Q+=le.duration,$++,W=0,Fe=!0}}else{if(we=we[0].match(Ho),!we){F.warn("No matches on slow regex match for level playlist!");continue}for(Ae=1;Ae<we.length&&we[Ae]===void 0;Ae++);const Et=(" "+we[Ae]).slice(1),_t=(" "+we[Ae+1]).slice(1),St=we[Ae+2]?(" "+we[Ae+2]).slice(1):null;switch(Et){case"BYTERANGE":fe?le.setByteRange(_t,fe):le.setByteRange(_t);break;case"PROGRAM-DATE-TIME":le.rawProgramDateTime=_t,le.tagList.push(["PROGRAM-DATE-TIME",_t]),Te===-1&&(Te=y.length);break;case"PLAYLIST-TYPE":d.type&&Er(d,Et,we),d.type=_t.toUpperCase();break;case"MEDIA-SEQUENCE":d.startSN!==0?Er(d,Et,we):y.length>0&&Zs(d,Et,we),$=d.startSN=parseInt(_t);break;case"SKIP":{d.skippedSegments&&Er(d,Et,we);const bt=new oi(_t,d),et=bt.decimalInteger("SKIPPED-SEGMENTS");if(k(et)){d.skippedSegments+=et;for(let Mt=et;Mt--;)y.push(null);$+=et}const nt=bt.enumeratedString("RECENTLY-REMOVED-DATERANGES");nt&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(nt.split(" ")));break}case"TARGETDURATION":d.targetduration!==0&&Er(d,Et,we),d.targetduration=Math.max(parseInt(_t),1);break;case"VERSION":d.version!==null&&Er(d,Et,we),d.version=parseInt(_t);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":d.live||Er(d,Et,we),d.live=!1;break;case"#":(_t||St)&&le.tagList.push(St?[_t,St]:[_t]);break;case"DISCONTINUITY":X++,le.tagList.push(["DIS"]);break;case"GAP":le.gap=!0,le.tagList.push([Et]);break;case"BITRATE":le.tagList.push([Et,_t]),se=parseInt(_t)*1e3,k(se)?le.bitrate=se:se=0;break;case"DATERANGE":{const bt=new oi(_t,d),et=new on(bt,d.dateRanges[bt.ID],d.dateRangeTagCount);d.dateRangeTagCount++,et.isValid||d.skippedSegments?d.dateRanges[et.id]=et:F.warn(`Ignoring invalid DATERANGE tag: "${_t}"`),le.tagList.push(["EXT-X-DATERANGE",_t]);break}case"DEFINE":{{const bt=new oi(_t,d);"IMPORT"in bt?bn(d,bt,a):Kr(d,bt,t)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0?Er(d,Et,we):y.length>0&&Zs(d,Et,we),d.startCC=X=parseInt(_t);break;case"KEY":{const bt=Gs(_t,t,d);if(bt.isSupported()){if(bt.method==="NONE"){He=void 0;break}He||(He={}),He[bt.keyFormat]&&(He=c({},He)),He[bt.keyFormat]=bt}else F.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${_t}"`);break}case"START":d.startTimeOffset=Ks(_t);break;case"MAP":{const bt=new oi(_t,d);if(le.duration){const et=new ve(r,_);qs(et,bt,i,He),B=et,le.initSegment=B,B.rawProgramDateTime&&!le.rawProgramDateTime&&(le.rawProgramDateTime=B.rawProgramDateTime)}else{const et=le.byteRangeEndOffset;if(et){const nt=le.byteRangeStartOffset;$e=`${et-nt}@${nt}`}else $e=null;qs(le,bt,i,He),B=le,Fe=!0}B.cc=X;break}case"SERVER-CONTROL":{Le&&Er(d,Et,we),Le=new oi(_t),d.canBlockReload=Le.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=Le.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&Le.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=Le.optionalFloat("PART-HOLD-BACK",0),d.holdBack=Le.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&Er(d,Et,we);const bt=new oi(_t);d.partTarget=bt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let bt=d.partList;bt||(bt=d.partList=[]);const et=W>0?bt[bt.length-1]:void 0,nt=W++,Mt=new oi(_t,d),kt=new Me(Mt,le,_,nt,et);bt.push(kt),le.duration+=kt.duration;break}case"PRELOAD-HINT":{const bt=new oi(_t,d);d.preloadHint=bt;break}case"RENDITION-REPORT":{const bt=new oi(_t,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(bt);break}default:F.warn(`line parsed but not handled: ${we}`);break}}}fe&&!fe.relurl?(y.pop(),Q-=fe.duration,d.partList&&(d.fragmentHint=fe)):d.partList&&(Jn(le,fe,S),le.cc=X,d.fragmentHint=le,He&&Ys(le,He,d)),d.targetduration||(d.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const Je=y.length,lt=y[0],Gt=y[Je-1];if(Q+=d.skippedSegments*d.targetduration,Q>0&&Je&&Gt){d.averagetargetduration=Q/Je;const Dt=Gt.sn;d.endSN=Dt!=="initSegment"?Dt:0,d.live||(Gt.endList=!0),lt&&d.startCC===void 0&&(d.startCC=lt.cc),Te>0&&(jo(y,Te),lt&&S.unshift(lt))}else d.endSN=0,d.startCC=0;return d.fragmentHint&&(Q+=d.fragmentHint.duration),d.totalduration=Q,S.length&&d.dateRangeTagCount&<&&Ws(S,d),d.endCC=X,d}}function Ws(o,e){const t=o.length,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]],_=h.startDate.getTime();h.tagAnchor=i.ref;for(let d=t;d--;){const y=$o(e,_,o,d,r);if(y!==-1){h.tagAnchor=e.fragments[y].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 _=(((a=t[i+1])==null?void 0:a.start)||r)-s.start;if(e<=h+_*1e3){const d=t[i].sn-o.startSN,y=o.fragments;if(y.length>t.length){const B=(t[i+1]||y[y.length-1]).sn-o.startSN;for(let $=B;$>d;$--){const W=y[$].programDateTime;if(e>=W&&e<W+y[$].duration*1e3)return $}}return d}}}return-1}function Gs(o,e,t){var i,r;const s=new oi(o,t),a=(i=s.METHOD)!=null?i:"",h=s.URI,_=s.hexadecimalInteger("IV"),d=s.KEYFORMATVERSIONS,y=(r=s.KEYFORMAT)!=null?r:"identity";h&&s.IV&&!_&&F.error(`Invalid IV: ${s.IV}`);const S=h?hr.resolve(h,e):"",B=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Ir(a,S,y,B,_)}function Ks(o){const t=new oi(o).decimalFloatingPoint("TIME-OFFSET");return k(t)?t:null}function zs(o,e){let t=(o||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(s=>xe(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 Vs(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 Jn(o,e,t){o.rawProgramDateTime?t.push(o):e!=null&&e.programDateTime&&(o.programDateTime=e.endProgramDateTime)}function qs(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 Ys(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 Er(o,e,t){o.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Zs(o,e,t){o.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function es(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 Xs(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,_=i;const d=e.startPTS,y=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),_=Math.min(i,y),i=Math.max(i,y),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=_,e.endDTS=s;const B=e.sn;if(!o||B<o.startSN||B>o.endSN)return 0;let $;const W=B-o.startSN,Q=o.fragments;for(Q[W]=e,$=W;$>0;$--)es(Q[$],Q[$-1]);for($=W;$<Q.length-1;$++)es(Q[$],Q[$+1]);return o.fragmentHint&&es(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 _=i.length-1;_>=0;_--){const d=i[_].initSegment;if(d){t=d;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;let r;zo(o,e,(_,d,y,S)=>{if(!e.startCC&&d.cc!==_.cc){var B,$;const W=_.cc-d.cc;for(let Q=y;Q<S.length;Q++)S[Q].cc+=W;e.startCC=(B=($=ta(o,e.startSN-1))==null?void 0:$.cc)!=null?B:S[0].cc,e.endCC=S[S.length-1].cc}k(_.startPTS)&&k(_.endPTS)&&(d.setStart(d.startPTS=_.startPTS),d.startDTS=_.startDTS,d.maxStartPTS=_.maxStartPTS,d.endPTS=_.endPTS,d.endDTS=_.endDTS,d.minEndPTS=_.minEndPTS,d.setDuration(_.endPTS-_.startPTS),d.duration&&(r=d),e.PTSKnown=e.alignedSliding=!0),_.hasStreams&&(d.elementaryStreams=_.elementaryStreams),d.loader=_.loader,_.hasStats&&(d.stats=_.stats),_.initSegment&&(d.initSegment=_.initSegment,t=_.initSegment)});const s=e.fragments,a=e.fragmentHint?s.concat(e.fragmentHint):s;if(t&&a.forEach(_=>{var d;_&&(!_.initSegment||_.initSegment.relurl===((d=t)==null?void 0:d.relurl))&&(_.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=s.some(_=>!_),e.deltaUpdateFailed){F.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let _=e.skippedSegments;_--;)s.shift();e.startSN=s[0].sn}else{e.endCC=s[s.length-1].cc,e.canSkipDateRanges&&(e.dateRanges=Go(o.dateRanges,e));const _=o.fragments.filter(d=>d.rawProgramDateTime);if(o.hasProgramDateTime&&!e.hasProgramDateTime)for(let d=1;d<a.length;d++)a[d].programDateTime===null&&Jn(a[d],a[d-1],_);Ws(_,e)}Ko(o.partList,e.partList,(_,d)=>{d.elementaryStreams=_.elementaryStreams,d.stats=_.stats}),r?Xs(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):Js(o,e),s.length&&(e.totalduration=e.edge-s[0].start),e.driftStartTime=o.driftStartTime,e.driftStart=o.driftStart;const h=e.advancedDateTime;if(e.advanced&&h){const _=e.edge;e.driftStart||(e.driftStartTime=h,e.driftStart=_),e.driftEndTime=h,e.driftEnd=_}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 _=r[h],d=new on(t[h].attr,_);d.isValid?(r[h]=d,_||(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,_=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments;for(let d=r;d<=s;d++){const y=_[a+d];let S=h[d];if(i&&!S&&y&&(S=e.fragments[d]=y),y&&S){if(t(y,S,d,h),y.url&&y.url!==S.url){e.playlistParsingError=Qs(`media sequence mismatch ${S.sn}:`,o,e,y,S);return}else if(y.cc!==S.cc){e.playlistParsingError=Qs(`discontinuity sequence mismatch (${y.cc}!=${S.cc})`,o,e,y,S);return}}}}function Qs(o,e,t,i,r){return new Error(`${o} ${r.url}
|
|
|
Playlist starting @${e.startSN}
|
|
|
${e.m3u8}
|
|
|
|
|
|
Playlist starting @${t.startSN}
|
|
|
${t.m3u8}`)}function Js(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;ts(e,a)}function ts(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 ea(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 ta(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 ia(o,e,t){return o?ra(o.partList,e,t):null}function ra(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 na(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 wn(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 sa(o,e){if(o){const t=o.start+e;o.start=o.startPTS=t,o.endPTS=t+o.duration}}function aa(o,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)sa(t[i],o);e.fragmentHint&&sa(e.fragmentHint,o),e.alignedSliding=!0}function qo(o,e){o&&(oa(e,o),!e.alignedSliding&&o&&Fn(e,o),!e.alignedSliding&&o&&!e.skippedSegments&&Js(o,e,!1))}function oa(o,e){if(!Vo(e,o))return;const t=Math.min(e.endCC,o.endCC),i=wn(e.fragments,t),r=wn(o.fragments,t);if(!i||!r)return;F.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-r.start;aa(s,o)}function Fn(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=wn(i,a),s=wn(t,a)),(!r||!s)&&(r=i[Math.floor(i.length/2)],s=wn(t,r.cc)||t[Math.floor(t.length/2)]);const h=r.programDateTime,_=s.programDateTime;if(!h||!_)return;const d=(_-h)/1e3-(s.start-r.start);aa(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}},Ge={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 is extends Wr{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=Ge.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:_,mediaBuffer:d,state:y}=this,S=_?_.currentTime:0,B=Ot.bufferInfo(d||_,S,a.maxBufferHole);if(this.log(`media seeking to ${k(S)?S.toFixed(3):S}, state: ${y}`),this.state===Ge.ENDED)this.resetLoadingState();else if(h){const $=a.maxFragLookUpTolerance,W=h.start-$,Q=h.start+h.duration+$;if(!B.len||Q<B.start||W>B.end){const X=S>Q;(S<W||X)&&(X&&h.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),h.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(_){this.fragmentTracker.removeFragmentsInRange(S,1/0,this.playlistType,!0);const $=this.lastCurrentTime;if(S>$&&(this.lastCurrentTime=S),!this.loadingParts){const W=Math.max(B.end,S),Q=this.shouldLoadParts(this.getLevelDetails(),W);Q&&(this.log(`LL-Part loading ON after seeking to ${S.toFixed(2)} with buffer @${W.toFixed(2)}`),this.loadingParts=Q)}}!this.hls.hasEnoughToStart&&!B.len&&(this.log(`setting startPosition to ${S} because of seek before start`),this.nextLoadPosition=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 nn(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Hr(e.config)}registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Ge.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=Ge.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.nextStart;if(s&&s>r&&s<t.edge||this.media.currentTime<e.start)return!1;const h=t.partList;if(h!=null&&h.length){const d=h[h.length-1];return Ot.isBuffered(this.media,d.start+d.duration/2)}const _=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(_)}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===Ge.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=Ge.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===Ge.FRAG_LOADING||!this.fragCurrent&&a===Ge.PARSING)&&(this.fragmentTracker.removeFragment(h),this.state=Ge.IDLE);return}"payload"in s&&(this.log(`Loaded ${h.type} sn: ${h.sn} of ${this.playlistLabel()} ${h.level}`),this.hls.trigger(g.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===Ge.STOPPED||this.state===Ge.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)===di.APPENDING){const s=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,s),h=Math.max(e.duration,a?a.len:this.config.maxBufferLength),_=this.backtrackFragment;((_?e.sn-_.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)===di.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(g.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 _=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),h.key.buffer,h.iv.buffer,br(h.method)).catch(d=>{throw r.trigger(g.ERROR,{type:T.MEDIA_ERROR,details:x.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:s}),d}).then(d=>{const y=self.performance.now();return r.trigger(g.FRAG_DECRYPTED,{frag:s,payload:d,stats:{tstart:_,tdecrypt:y}}),i.payload=d,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===Ge.STOPPED||this.state===Ge.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!==Ge.STOPPED&&(this.state=Ge.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(Ot.getBuffered(i)):"(detached)"})`),ie(e)){var r;if(e.type!==m.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(h=>!!a[h])){this.state=Ge.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=Ge.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(_=>!_),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=Ge.KEY_LOADING,this.fragCurrent=e,h=this.keyLoader.load(e).then(S=>{if(!this.fragContextChanged(S.frag))return this.hls.trigger(g.KEY_LOADED,S),this.state===Ge.KEY_LOADING&&(this.state=Ge.IDLE),S}),this.hls.trigger(g.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(h=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&a.encryptedFragments.length&&this.keyLoader.loadClear(e,a.encryptedFragments);const _=this.fragPrevious;if(ie(e)&&(!_||e.sn!==_.sn)){const S=this.shouldLoadParts(t.details,e.end);S!==this.loadingParts&&(this.log(`LL-Part loading ${S?"ON":"OFF"} loading sn ${_==null?void 0:_.sn}->${e.sn}`),this.loadingParts=S)}if(i=Math.max(e.start,i||0),this.loadingParts&&ie(e)){const S=a.partList;if(S&&r){i>e.end&&a.fragmentHint&&(e=a.fragmentHint);const B=this.getNextPart(S,e,i);if(B>-1){const $=S[B];e=this.fragCurrent=$.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${$.index} (${B}/${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=Ge.FRAG_LOADING;let W;return h?W=h.then(Q=>!Q||this.fragContextChanged(Q.frag)?null:this.doFragPartsLoad(e,$,t,r)).catch(Q=>this.handleFragLoadError(Q)):W=this.doFragPartsLoad(e,$,t,r).catch(Q=>this.handleFragLoadError(Q)),this.hls.trigger(g.FRAG_LOADING,{frag:e,part:$,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):W}else if(!e.url||this.loadedEndOfParts(S,i))return Promise.resolve(null)}}if(ie(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=Ge.FRAG_LOADING;const d=this.config.progressive;let y;return d&&h?y=h.then(S=>!S||this.fragContextChanged(S==null?void 0:S.frag)?null:this.fragmentLoader.load(e,r)).catch(S=>this.handleFragLoadError(S)):y=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(g.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):y}doFragPartsLoad(e,t,i,r){return new Promise((s,a)=>{var h;const _=[],d=(h=i.details)==null?void 0:h.partList,y=S=>{this.fragmentLoader.loadPart(e,S,r).then(B=>{_[S.index]=B;const $=B.part;this.hls.trigger(g.FRAG_LOADED,B);const W=ia(i.details,e.sn,S.index+1)||ra(d,e.sn,S.index+1);if(W)y(W);else return s({frag:e,part:$,partsLoaded:_})}).catch(a)};y(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===x.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(g.ERROR,t)}else this.hls.trigger(g.ERROR,{type:T.OTHER_ERROR,details:x.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Ge.PARSING){!this.fragCurrent&&this.state!==Ge.STOPPED&&this.state!==Ge.ERROR&&(this.state=Ge.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],_=h.details,d=a>-1?ia(_,s,a):null,y=d?d.fragment:ta(_,s,i);return y?(i&&i!==y&&(y.stats=i.stats),{frag:y,part:d,level:h}):null}bufferFragmentData(e,t,i,r,s){var a;if(!e||this.state!==Ge.PARSING)return;const{data1:h,data2:_}=e;let d=h;if(h&&_&&(d=Xe(h,_)),!((a=d)!=null&&a.length))return;const y={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:d};if(this.hls.trigger(g.BUFFER_APPENDING,y),e.dropped&&e.independent&&!i){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ot.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=Ot.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=Ot.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 Ot.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 _=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),_=this.getInitialLiveFragment(t,i);const B=this.hls.startPosition,$=this.hls.liveSyncPosition,W=_?(B!==-1&&B>=a?B:$)||_.start:e;this.log(`Setting startPosition to ${W} to match start frag at live edge. mainStart: ${B} liveSyncPosition: ${$} frag.start: ${(d=_)==null?void 0:d.start}`),this.startPosition=this.nextLoadPosition=W}}else e<=a&&(_=i[0]);if(!_){const S=this.loadingParts?t.partEnd:t.fragmentEnd;_=this.getFragmentAtPosition(e,S,t)}let y=this.filterReplacedPrimary(_,t);if(!y&&_){const S=_.sn-t.startSN;y=this.filterReplacedPrimary(i[S+1]||null,t)}return this.mapToInitFragWhenRequired(y)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===di.OK||i===di.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 _=a.sn;return this.loopSn!==_&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${_}`),this.loopSn=_),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(la(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(la(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,_=e.length;h<_;h++){const d=e[h];if(a=a&&!d.independent,r>-1&&i<d.start)break;const y=d.loaded;y?r=-1:(s||d.independent||a)&&d.fragment===t&&(r=h),s=y}return r}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const 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=Mi(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=ni(t,i.cc),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:_}=i,{maxFragLookUpTolerance:d}=r,y=i.partList,S=!!(this.loadingParts&&y!=null&&y.length&&_);S&&_&&!this.bitrateTest&&y[y.length-1].fragment.sn===_.sn&&(a=a.concat(_),h=_.sn);let B;if(e<t){var $;const Q=e<this.lastCurrentTime||e>t-d||($=this.media)!=null&&$.paused||!this.startFragRequested?0:d;B=zi(s,a,e,Q)}else B=a[a.length-1];if(B){const W=B.sn-i.startSN,Q=this.fragmentTracker.getState(B);if((Q===di.OK||Q===di.PARTIAL&&B.gap)&&(s=B),s&&B.sn===s.sn&&(!S||y[0].fragment.sn>B.sn||!i.live&&!S)&&s&&B.level===s.level){const se=a[W+1];B.sn<h&&this.fragmentTracker.getState(se)!==di.OK?B=se:B=null}}return B}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 _=e.fragmentStart;return this.log(`Live playlist sliding: ${_.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),_}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&&ie(e)&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==Ge.FRAG_LOADING_WAITING_RETRY)&&(this.state=Ge.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const W=this.getCurrentContext(t.chunkMeta);W&&(t.frag=W.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===x.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const a=t.errorAction,{action:h,flags:_,retryCount:d=0,retryConfig:y}=a||{},S=!!a&&!!y,B=S&&h===mi.RetryRequest,$=S&&!a.resolved&&_===Bi.MoveAllAlternatesMatchingHost;if(!B&&$&&ie(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),a.resolved=!0;else if((B||$)&&d<y.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const W=Ii(y,d);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${d+1}/${y.maxNumRetry} in ${W}ms`),a.resolved=!0,this.retryDate=self.performance.now()+W,this.state=Ge.FRAG_LOADING_WAITING_RETRY}else if(y&&a)if(this.resetFragmentErrors(e),d<y.maxNumRetry)!s&&h!==mi.RemoveAlternatePermanently&&(a.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${d})`);return}else h===mi.SendAlternateToPenaltyBox?this.state=Ge.WAITING_LEVEL:this.state=Ge.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===Ge.PARSING||this.state===Ge.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!==Ge.STOPPED&&(this.state=Ge.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=Ot.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===Ge.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Ge.STOPPED&&(this.state=Ge.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((_,d)=>{const y=e.elementaryStreams[d];if(y){const S=y.endPTS-y.startPTS;if(S<=0)return this.warn(`Could not parse fragment ${e.sn} ${d} duration reliably (${S})`),_||!1;const B=r?0:Xs(s,e,y.startPTS,y.endPTS,y.startDTS,y.endDTS);return this.hls.trigger(g.LEVEL_PTS_UPDATED,{details:s,level:i,drift:B,type:d,frag:e,start:y.startPTS,end:y.endPTS}),!0}return _},!1)){var h;if(i.fragmentError===0&&this.treatAsGap(e,i),((h=this.transmuxer)==null?void 0:h.error)===null){const _=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(_.message),this.hls.trigger(g.ERROR,{type:T.MEDIA_ERROR,details:x.FRAG_PARSING_ERROR,fatal:!1,error:_,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Ge.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(g.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 la(o){return!!o.interstitialsController&&o.enableInterstitialPlayback!==!1}class ua{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 rs={exports:{}},ca;function Xo(){return ca||(ca=1,function(o){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(_,d,y){this.fn=_,this.context=d,this.once=y||!1}function s(_,d,y,S,B){if(typeof y!="function")throw new TypeError("The listener must be a function");var $=new r(y,S||_,B),W=t?t+d:d;return _._events[W]?_._events[W].fn?_._events[W]=[_._events[W],$]:_._events[W].push($):(_._events[W]=$,_._eventsCount++),_}function a(_,d){--_._eventsCount===0?_._events=new i:delete _._events[d]}function h(){this._events=new i,this._eventsCount=0}h.prototype.eventNames=function(){var d=[],y,S;if(this._eventsCount===0)return d;for(S in y=this._events)e.call(y,S)&&d.push(t?S.slice(1):S);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(y)):d},h.prototype.listeners=function(d){var y=t?t+d:d,S=this._events[y];if(!S)return[];if(S.fn)return[S.fn];for(var B=0,$=S.length,W=new Array($);B<$;B++)W[B]=S[B].fn;return W},h.prototype.listenerCount=function(d){var y=t?t+d:d,S=this._events[y];return S?S.fn?1:S.length:0},h.prototype.emit=function(d,y,S,B,$,W){var Q=t?t+d:d;if(!this._events[Q])return!1;var X=this._events[Q],se=arguments.length,fe,le;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,y),!0;case 3:return X.fn.call(X.context,y,S),!0;case 4:return X.fn.call(X.context,y,S,B),!0;case 5:return X.fn.call(X.context,y,S,B,$),!0;case 6:return X.fn.call(X.context,y,S,B,$,W),!0}for(le=1,fe=new Array(se-1);le<se;le++)fe[le-1]=arguments[le];X.fn.apply(X.context,fe)}else{var we=X.length,Ae;for(le=0;le<we;le++)switch(X[le].once&&this.removeListener(d,X[le].fn,void 0,!0),se){case 1:X[le].fn.call(X[le].context);break;case 2:X[le].fn.call(X[le].context,y);break;case 3:X[le].fn.call(X[le].context,y,S);break;case 4:X[le].fn.call(X[le].context,y,S,B);break;default:if(!fe)for(Ae=1,fe=new Array(se-1);Ae<se;Ae++)fe[Ae-1]=arguments[Ae];X[le].fn.apply(X[le].context,fe)}}return!0},h.prototype.on=function(d,y,S){return s(this,d,y,S,!1)},h.prototype.once=function(d,y,S){return s(this,d,y,S,!0)},h.prototype.removeListener=function(d,y,S,B){var $=t?t+d:d;if(!this._events[$])return this;if(!y)return a(this,$),this;var W=this._events[$];if(W.fn)W.fn===y&&(!B||W.once)&&(!S||W.context===S)&&a(this,$);else{for(var Q=0,X=[],se=W.length;Q<se;Q++)(W[Q].fn!==y||B&&!W[Q].once||S&&W[Q].context!==S)&&X.push(W[Q]);X.length?this._events[$]=X.length===1?X[0]:X:a(this,$)}return this},h.prototype.removeAllListeners=function(d){var y;return d?(y=t?t+d:d,this._events[y]&&a(this,y)):(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}(rs)),rs.exports}var Qo=Xo(),ns=z(Qo);const Cn="1.6.2",hn={};function Jo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function el(){const o=hn[Cn];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 hn[Cn]=r,r}function tl(o){const e=hn[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 hn[o]=r,r}function il(o){const e=hn[o||Cn];if(e&&e.clientCount--===1){const{worker:i,objectURL:r}=e;delete hn[o||Cn],r&&self.URL.revokeObjectURL(r),i.terminate()}}function ha(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 ss(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 Mn(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 An(o,e){const t=e;let i=0;for(;ss(o,e);){i+=10;const r=Mn(o,e+6);i+=r,ha(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(g.ERROR,g.ERROR,{type:T.MEDIA_ERROR,details:x.FRAG_PARSING_ERROR,fatal:!0,error:$,reason:$.message});return}const h=(s>>6&3)+1,_=e[t+3]>>6&3|(s&1)<<2,d="mp4a.40."+h,y=r[a];let S=a;(h===5||h===29)&&(S-=3);const B=[h<<3|(S&14)>>1,(S&1)<<7|_<<3];return F.log(`manifest codec:${i}, parsed codec:${d}, channels:${_}, rate:${y} (ADTS object type:${h} sampling index:${a})`),{config:B,samplerate:y,channelCount:_,codec:d,parsedCodec:d,manifestCodec:i}}function fa(o,e){return o[e]===255&&(o[e+1]&246)===240}function da(o,e){return o[e+1]&1?7:9}function as(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 Bn(o,e){return e+1<o.length&&fa(o,e)}function sl(o,e){return nl(o,e)&&fa(o,e)&&as(o,e)<=o.length-e}function al(o,e){if(Bn(o,e)){const t=da(o,e);if(e+t>=o.length)return!1;const i=as(o,e);if(i<=t)return!1;const r=e+i;return r===o.length||Bn(o,r)}return!1}function pa(o,e,t,i,r){if(!o.samplerate){const s=rl(e,t,i,r);if(!s)return;c(o,s)}}function _a(o){return 1024*9e4/o}function ol(o,e){const t=da(o,e);if(e+t<=o.length){const i=as(o,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function ga(o,e,t,i,r){const s=_a(o.samplerate),a=i+r*s,h=ol(e,t);let _;if(h){const{frameLength:S,headerLength:B}=h,$=B+S,W=Math.max(0,t+$-e.length);W?(_=new Uint8Array($-B),_.set(e.subarray(t+B,e.length),0)):_=e.subarray(t+B,t+$);const Q={unit:_,pts:a};return W||o.samples.push(Q),{sample:Q,length:$,missing:W}}const d=e.length-t;return _=new Uint8Array(d),_.set(e.subarray(t,e.length),0),{sample:{unit:_,pts:a},length:d,missing:-1}}function ll(o,e){return ss(o,e)&&Mn(o,e+6)+10<=o.length-e}function ul(o){if(o.size<2)return;const e=ce(o.data,!0),t=new Uint8Array(o.data.subarray(e.length+1));return{key:o.type,info:e,data:t.buffer}}function cl(o){if(o.size<2)return;if(o.type==="TXXX"){let t=1;const i=ce(o.data.subarray(t),!0);t+=i.length+1;const r=ce(o.data.subarray(t));return{key:o.type,info:i,data:r}}const e=ce(o.data.subarray(1));return{key:o.type,info:"",data:e}}function hl(o){if(o.type==="WXXX"){if(o.size<2)return;let t=1;const i=ce(o.data.subarray(t),!0);t+=i.length+1;const r=ce(o.data.subarray(t));return{key:o.type,info:i,data:r}}const e=ce(o.data);return{key:o.type,info:"",data:e}}function fl(o){return btoa(String.fromCharCode(...o))}function ma(o,e){if(o<0)return-ma(-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}function dl(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("/")}function pl(){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 _l(o){return o instanceof ArrayBuffer?o:o.byteOffset==0&&o.byteLength==o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer}function os(o,e=0,t=1/0){return gl(o,e,t,Uint8Array)}function gl(o,e,t,i){const r=ml(o);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const a=vl(o)?o.byteOffset:0,h=(a+o.byteLength)/s,_=(a+e)/s,d=Math.floor(Math.max(0,Math.min(_,h))),y=Math.floor(Math.min(d+Math.max(t,0),h));return new i(r,d,y-d)}function ml(o){return o instanceof ArrayBuffer?o:o.buffer}function vl(o){return o&&o.buffer instanceof ArrayBuffer&&o.byteLength!==void 0&&o.byteOffset!==void 0}function yl(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=ce(os(o.data,1,i)),s=o.data[2+i],a=o.data.subarray(3+i).indexOf(0);if(a===-1)return;const h=ce(os(o.data,3+i,a));let _;return r==="-->"?_=ce(os(o.data,4+i+a)):_=_l(o.data.subarray(4+i+a)),e.mimeType=r,e.pictureType=s,e.description=h,e.data=_,e}function bl(o){return o.type==="PRIV"?ul(o):o.type[0]==="W"?hl(o):o.type==="APIC"?yl(o):cl(o)}function El(o){const e=String.fromCharCode(o[0],o[1],o[2],o[3]),t=Mn(o,4),i=10;return{type:e,size:t,data:o.subarray(i,i+t)}}const Nn=10,Sl=10;function va(o){let e=0;const t=[];for(;ss(o,e);){const i=Mn(o,e+6);o[e+5]>>6&1&&(e+=Nn),e+=Nn;const r=e+i;for(;e+Sl<r;){const s=El(o.subarray(e)),a=bl(s);a&&t.push(a),e+=s.size+Nn}ha(o,e)&&(e+=Nn)}return t}function ya(o){return o&&o.key==="PRIV"&&o.info==="com.apple.streaming.transportStreamTimestamp"}function xl(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 ls(o){const e=va(o);for(let t=0;t<e.length;t++){const i=e[t];if(ya(i))return xl(i)}}let Zi=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 us{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=Xe(this.cachedData,e),this.cachedData=null);let i=An(e,0),r=i?i.length:0,s;const a=this._audioTrack,h=this._id3Track,_=i?ls(i):void 0,d=e.length;for((this.basePTS===null||this.frameIndex===0&&k(_))&&(this.basePTS=wl(_,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:Zi.audioId3,duration:Number.POSITIVE_INFINITY});r<d;){if(this.canParse(e,r)){const y=this.appendFrame(a,e,r);y?(this.frameIndex++,this.lastPTS=y.sample.pts,r+=y.length,s=r):r=d}else ll(e,r)?(i=An(e,r),h.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Zi.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,s=r):r++;if(r===d&&s!==d){const y=e.slice(s);this.cachedData?this.cachedData=Xe(this.cachedData,y):this.cachedData=y}}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 wl=(o,e,t)=>{if(k(o))return o*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Un=null;const Cl=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Al=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Tl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Dl=[0,1,1,4];function ba(o,e,t,i,r){if(t+24>e.length)return;const s=Ea(e,t);if(s&&t+s.frameLength<=e.length){const a=s.samplesPerFrame*9e4/s.sampleRate,h=i+r*a,_={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(_),{sample:_,length:s.frameLength,missing:0}}}function Ea(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,_=t===3?3-i:i===3?3:4,d=Cl[_*14+r-1]*1e3,S=Al[(t===3?0:t===2?1:2)*3+s],B=h===3?1:2,$=Tl[t][i],W=Dl[i],Q=$*8*W,X=Math.floor($*d/S+a)*W;if(Un===null){const le=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Un=le?parseInt(le[1]):0}return!!Un&&Un<=87&&i===2&&d>=224e3&&h===0&&(o[e+3]=o[e+3]|128),{sampleRate:S,channelCount:B,frameLength:X,samplesPerFrame:Q}}}function cs(o,e){return o[e]===255&&(o[e+1]&224)===224&&(o[e+1]&6)!==0}function Sa(o,e){return e+1<o.length&&cs(o,e)}function Ll(o,e){return cs(o,e)&&4<=o.length-e}function xa(o,e){if(e+1<o.length&&cs(o,e)){const i=Ea(o,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const s=e+r;return s===o.length||Sa(o,s)}return!1}class Rl extends us{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=An(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){pa(e,this.observer,t,i,e.manifestCodec);const r=ga(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const wa=(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),_=8-h;s[0]=4278190080>>>24+_<<_,r[0]=(a[0]&s[0])>>_,t=t?t<<h|r[0]:r[0],e+=1,i-=h}return t};class kl extends us{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=An(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&ls(t)!==void 0&&wa(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],_=e[t+4]&63,y=[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][_*3+s]*2;if(t+y>e.length)return-1;const S=e[t+6]>>5;let B=0;S===2?B+=2:(S&1&&S!==1&&(B+=2),S&4&&(B+=2));const $=(e[t+6]<<8|e[t+7])>>12-B&1,Q=[2,1,2,3,3,4,4,5][S]+$,X=e[t+5]>>3,se=e[t+5]&7,fe=new Uint8Array([s<<6|X<<1|se>>2,(se&3)<<6|S<<3|$<<2|_>>4,_<<4&224]),le=1536/h*9e4,we=i+r*le,Ae=e.subarray(t,t+y);return o.config=fe,o.channelCount=Q,o.samplerate=h,o.samples.push({unit:Ae,pts:we}),y}class Il extends us{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=An(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&ls(t)!==void 0&&wa(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 Ll(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return ba(e,t,i,this.basePTS,this.frameIndex)}}const Pl=/\/emsg[-/]ID3/i;class Ol{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,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 _=We(e);if(_.video){const{id:d,timescale:y,codec:S,supplemental:B}=_.video;s.id=d,s.timescale=h.timescale=y,s.codec=S,s.supplemental=B}if(_.audio){const{id:d,timescale:y,codec:S}=_.audio;a.id=d,a.timescale=y,a.codec=S}h.id=Be.text,s.sampleDuration=0,s.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return De(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Xe(this.remainderData,e));const h=it(i);this.remainderData=h.remainder,r.samples=h.valid||new Uint8Array}else r.samples=i;const a=this.extractID3Track(r,t);return s.samples=Ye(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=Ye(e,t),{videoTrack:t,audioTrack:fr(),id3Track:r,textTrack:fr()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=de(e.samples,["emsg"]);r&&r.forEach(s=>{const a=yt(s);if(Pl.test(a.schemeIdUri)){const h=Aa(a,t);let _=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;_<=.001&&(_=Number.POSITIVE_INFINITY);const d=a.payload;i.samples.push({data:d,len:d.byteLength,dts:h,pts:h,type:Zi.emsg,duration:_})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const h=Aa(a,t);i.samples.push({data:a.payload,len:a.payload.byteLength,dts:h,pts:h,type:Zi.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 Aa(o,e){return k(o.presentationTime)?o.presentationTime/o.timeScale:e+o.presentationTimeDelta/o.timeScale}class Fl{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Hr(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Oi.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 _=new Uint8Array(h);r.set(_,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=Ze(s.data),h=this.getAvcEncryptedData(a);this.decryptBuffer(h.buffer).then(_=>{s.data=this.getAvcDecryptedUnit(a,_),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 Ta{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 _=0,d,y,S,B=-1,$=0;for(s===-1&&(B=0,$=this.getNALuType(t,0),s=0,_=1);_<r;){if(d=t[_++],!s){s=d?0:1;continue}if(s===1){s=d?0:2;continue}if(!d)s=3;else if(d===1){if(y=_-s-1,B>=0){const W={data:t.subarray(B,y),type:$};h.push(W)}else{const W=this.getLastNalUnit(e.samples);W&&(a&&_<=4-a&&W.state&&(W.data=W.data.subarray(0,W.data.byteLength-a)),y>0&&(W.data=Xe(W.data,t.subarray(0,y)),W.state=0))}_<r?(S=this.getNALuType(t,_),B=_,$=S,s=0):s=-1}else s=0}if(B>=0&&s>=0){const W={data:t.subarray(B,r),type:$,state:s};h.push(W)}if(h.length===0){const W=this.getLastNalUnit(e.samples);W&&(W.data=Xe(W.data,t))}return e.naluState=s,h}}class Tn{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 Da extends Ta{parsePES(e,t,i,r){const s=this.parseNALu(e,i.data,r);let a=this.VideoSample,h,_=!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 y,S;switch(d.type){case 1:{let Q=!1;h=!0;const X=d.data;if(_&&X.length>4){const se=this.readSliceType(X);(se===2||se===4||se===7||se===9)&&(Q=!0)}if(Q){var B;(B=a)!=null&&B.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,(y=a)!=null&&y.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,ct(d.data,1,i.pts,t.samples);break}case 7:{var $,W;h=!0,_=!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]||((W=e.pixelRatio)==null?void 0:W[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 fe="avc1.";for(let le=0;le<3;le++){let we=se[le].toString(16);we.length<2&&(we="0"+we),fe+=we}e.codec=fe}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 Tn(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 Tn(e);let i=0,r=0,s=0,a=0,h,_,d;const y=t.readUByte.bind(t),S=t.readBits.bind(t),B=t.readUEG.bind(t),$=t.readBoolean.bind(t),W=t.skipBits.bind(t),Q=t.skipEG.bind(t),X=t.skipUEG.bind(t),se=this.skipScalingList.bind(this);y();const fe=y();if(S(5),W(3),y(),X(),fe===100||fe===110||fe===122||fe===244||fe===44||fe===83||fe===86||fe===118||fe===128){const Fe=B();if(Fe===3&&W(1),X(),X(),W(1),$())for(_=Fe!==3?8:12,d=0;d<_;d++)$()&&(d<6?se(16,t):se(64,t))}X();const le=B();if(le===0)B();else if(le===1)for(W(1),Q(),Q(),h=B(),d=0;d<h;d++)Q();X(),W(1);const we=B(),Ae=B(),He=S(1);He===0&&W(1),W(1),$()&&(i=B(),r=B(),s=B(),a=B());let Te=[1,1];if($()&&$())switch(y()){case 1:Te=[1,1];break;case 2:Te=[12,11];break;case 3:Te=[10,11];break;case 4:Te=[16,11];break;case 5:Te=[40,33];break;case 6:Te=[24,11];break;case 7:Te=[20,11];break;case 8:Te=[32,11];break;case 9:Te=[80,33];break;case 10:Te=[18,11];break;case 11:Te=[15,11];break;case 12:Te=[64,33];break;case 13:Te=[160,99];break;case 14:Te=[4,3];break;case 15:Te=[3,2];break;case 16:Te=[2,1];break;case 255:{Te=[y()<<8|y(),y()<<8|y()];break}}return{width:Math.ceil((we+1)*16-i*2-r*2),height:(2-He)*(Ae+1)*16-(He?2:4)*(s+a),pixelRatio:Te}}}class La extends Ta{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,_=!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 y,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,_){var B;(B=a)!=null&&B.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,(y=a)!=null&&y.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,ct(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,_=!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 W in $.params)e.params[W]=$.params[W]}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 W in $)e.params[W]=$[W]}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 Tn(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 Tn(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(),_=t.readUByte(),d=t.readUByte(),y=t.readUByte(),S=t.readUByte(),B=t.readUByte(),$=t.readUByte(),W=t.readUByte(),Q=t.readUByte(),X=t.readUByte(),se=t.readUByte(),fe=[],le=[];for(let Qt=0;Qt<i;Qt++)fe.push(t.readBoolean()),le.push(t.readBoolean());if(i>0)for(let Qt=i;Qt<8;Qt++)t.readBits(2);for(let Qt=0;Qt<i;Qt++)fe[Qt]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),le[Qt]&&t.readUByte();t.readUEG();const we=t.readUEG();we==3&&t.skipBits(1);const Ae=t.readUEG(),He=t.readUEG(),Te=t.readBoolean();let Fe=0,$e=0,Le=0,Je=0;Te&&(Fe+=t.readUEG(),$e+=t.readUEG(),Le+=t.readUEG(),Je+=t.readUEG());const lt=t.readUEG(),Gt=t.readUEG(),Dt=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 Fi=0;Fi<4;Fi++)for(let rr=0;rr<(Fi===3?2:6);rr++)if(!t.readBoolean())t.readUEG();else{const ar=Math.min(64,1<<4+(Fi<<1));Fi>1&&t.readEG();for(let vn=0;vn<ar;vn++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const bt=t.readUEG();let et=0;for(let Qt=0;Qt<bt;Qt++){let Fi=!1;if(Qt!==0&&(Fi=t.readBoolean()),Fi){Qt===bt&&t.readUEG(),t.readBoolean(),t.readUEG();let rr=0;for(let Qr=0;Qr<=et;Qr++){const ar=t.readBoolean();let vn=!1;ar||(vn=t.readBoolean()),(ar||vn)&&rr++}et=rr}else{const rr=t.readUEG(),Qr=t.readUEG();et=rr+Qr;for(let ar=0;ar<rr;ar++)t.readUEG(),t.readBoolean();for(let ar=0;ar<Qr;ar++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Qt=t.readUEG();for(let Fi=0;Fi<Qt;Fi++){for(let rr=0;rr<Dt+4;rr++)t.readBits(1);t.readBits(1)}}let Mt=0,kt=1,Wt=1,Yt=!0,ti=1,li=0;t.readBoolean(),t.readBoolean();let Ui=!1;if(t.readBoolean()){if(t.readBoolean()){const Jr=t.readUByte(),ko=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Xn=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Jr>0&&Jr<16?(kt=ko[Jr-1],Wt=Xn[Jr-1]):Jr===255&&(kt=t.readBits(16),Wt=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(),Ui=t.readBoolean(),Ui&&(Fe+=t.readUEG(),$e+=t.readUEG(),Le+=t.readUEG(),Je+=t.readUEG()),t.readBoolean()&&(ti=t.readBits(32),li=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Xn=t.readBoolean(),Io=t.readBoolean();let Pn=!1;(Xn||Io)&&(Pn=t.readBoolean(),Pn&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),Pn&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Po=0;Po<=i;Po++){Yt=t.readBoolean();const ih=Yt||t.readBoolean();let Oo=!1;ih?t.readEG():Oo=t.readBoolean();const Fo=Oo?1:t.readUEG()+1;if(Xn)for(let On=0;On<Fo;On++)t.readUEG(),t.readUEG(),Pn&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Io)for(let On=0;On<Fo;On++)t.readUEG(),t.readUEG(),Pn&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Mt=t.readUEG())}let Br=Ae,Ro=He;if(Te||Ui){let Qt=1,Fi=1;we===1?Qt=Fi=2:we==2&&(Qt=2),Br=Ae-Qt*$e-Qt*Fe,Ro=He-Fi*Je-Fi*Le}const eh=r?["A","B","C"][r]:"",th=h<<24|_<<16|d<<8|y;let Us=0;for(let Qt=0;Qt<32;Qt++)Us=(Us|(th>>Qt&1)<<31-Qt)>>>0;let Hs=Us.toString(16);return a===1&&Hs==="2"&&(Hs="6"),{codecString:`hvc1.${eh}${a}.${Hs}.${s?"H":"L"}${se}.B0`,params:{general_tier_flag:s,general_profile_idc:a,general_profile_space:r,general_profile_compatibility_flags:[h,_,d,y],general_constraint_indicator_flags:[S,B,$,W,Q,X],general_level_idc:se,bit_depth:lt+8,bit_depth_luma_minus8:lt,bit_depth_chroma_minus8:Gt,min_spatial_segmentation_idc:Mt,chroma_format_idc:we,frame_rate:{fixed:Yt,fps:li/ti}},width:Br,height:Ro,pixelRatio:[kt,Wt]}}readPPS(e){const t=new Tn(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 Pr{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=Pr.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 _=r;_<t;_+=Ai)if(e[_]===71&&(t-_===Ai||e[_+Ai]===71)){if(h++,a===-1&&(a=_,a!==0&&(i=Math.min(a+Ai*99,e.length-Ai)+1)),s||(s=hs(e,_)===0),s&&h>1&&(a===0&&h>2||_+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:Be[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=Pr.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Pr.createTrack("audio",r),this._id3Track=Pr.createTrack("id3"),this._txtTrack=Pr.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,_=this._id3Track,d=this._txtTrack;let y=a.pid,S=a.pesData,B=h.pid,$=_.pid,W=h.pesData,Q=_.pesData,X=null,se=this.pmtParsed,fe=this._pmtId,le=e.length;if(this.remainderData&&(e=Xe(this.remainderData,e),le=e.length,this.remainderData=null),le<Ai&&!r)return this.remainderData=e,{audioTrack:h,videoTrack:a,id3Track:_,textTrack:d};const we=Math.max(0,Pr.syncOffset(e));le-=(le-we)%Ai,le<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,le,e.buffer.byteLength-le));let Ae=0;for(let Te=we;Te<le;Te+=Ai)if(e[Te]===71){const Fe=!!(e[Te+1]&64),$e=hs(e,Te),Le=(e[Te+3]&48)>>4;let Je;if(Le>1){if(Je=Te+5+e[Te+4],Je===Te+Ai)continue}else Je=Te+4;switch($e){case y:if(Fe){if(S&&(s=fn(S,this.logger))){if(this.videoParser===null)switch(a.segmentCodec){case"avc":this.videoParser=new Da;break;case"hevc":this.videoParser=new La;break}this.videoParser!==null&&this.videoParser.parsePES(a,d,s,!1)}S={data:[],size:0}}S&&(S.data.push(e.subarray(Je,Te+Ai)),S.size+=Te+Ai-Je);break;case B:if(Fe){if(W&&(s=fn(W,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}W={data:[],size:0}}W&&(W.data.push(e.subarray(Je,Te+Ai)),W.size+=Te+Ai-Je);break;case $:Fe&&(Q&&(s=fn(Q,this.logger))&&this.parseID3PES(_,s),Q={data:[],size:0}),Q&&(Q.data.push(e.subarray(Je,Te+Ai)),Q.size+=Te+Ai-Je);break;case 0:Fe&&(Je+=e[Je]+1),fe=this._pmtId=Ml(e,Je);break;case fe:{Fe&&(Je+=e[Je]+1);const lt=Bl(e,Je,this.typeSupported,i,this.observer,this.logger);y=lt.videoPid,y>0&&(a.pid=y,a.segmentCodec=lt.segmentVideoCodec),B=lt.audioPid,B>0&&(h.pid=B,h.segmentCodec=lt.segmentAudioCodec),$=lt.id3Pid,$>0&&(_.pid=$),X!==null&&!se&&(this.logger.warn(`MPEG-TS PMT found at ${Te} after unknown PID '${X}'. Backtracking to sync byte @${we} to parse all TS packets.`),X=null,Te=we-188),se=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=$e;break}}else Ae++;Ae>0&&fs(this.observer,new Error(`Found ${Ae} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=S,h.pesData=W,_.pesData=Q;const He={audioTrack:h,videoTrack:a,id3Track:_,textTrack:d};return r&&this.extractRemainingSamples(He),He}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,_=r.pesData;let d;if(a&&(d=fn(a,this.logger))){if(this.videoParser===null)switch(i.segmentCodec){case"avc":this.videoParser=new Da;break;case"hevc":this.videoParser=new La;break}this.videoParser!==null&&(this.videoParser.parsePES(i,s,d,!0),i.pesData=null)}else i.pesData=a;if(h&&(d=fn(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;_&&(d=fn(_,this.logger))?(this.parseID3PES(r,d),r.pesData=null):r.pesData=_}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new Fl(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,B=r.sample.unit.byteLength;if(S===-1)s=Xe(r.sample.unit,s);else{const $=B-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&&!Bn(s,a);a++);if(a!==i){let S;const B=a<h-1;if(B?S=`AAC PES did not start with ADTS header,offset:${a}`:S="No ADTS header found in AAC PES",fs(this.observer,new Error(S),B,this.logger),!B)return}pa(e,this.observer,s,a,this.audioCodec);let _;if(t.pts!==void 0)_=t.pts;else if(r){const S=_a(e.samplerate);_=r.sample.pts+S}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let d=0,y;for(;a<h;)if(y=ga(e,s,a,_,d),a+=y.length,y.missing){this.aacOverFlow=y;break}else for(d++;a<h-1&&!Bn(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(Sa(i,a)){const _=ba(e,i,a,h,s);if(_)a+=_.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,_;for(;h<s&&(_=Ca(e,i,h,r,a++))>0;)h+=_}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=c({},t,{type:this._videoTrack?Zi.emsg:Zi.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function hs(o,e){return((o[e+1]&31)<<8)+o[e+2]}function Ml(o,e){return(o[e+10]&31)<<8|o[e+11]}function Bl(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],_=e+3+h-4,d=(o[e+10]&15)<<8|o[e+11];for(e+=12+d;e<_;){const y=hs(o,e),S=(o[e+3]&15)<<8|o[e+4];switch(o[e]){case 207:if(!i){ds("ADTS AAC",s);break}case 15:a.audioPid===-1&&(a.audioPid=y);break;case 21:a.id3Pid===-1&&(a.id3Pid=y);break;case 219:if(!i){ds("H.264",s);break}case 27:a.videoPid===-1&&(a.videoPid=y);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):a.audioPid===-1&&(a.audioPid=y,a.segmentAudioCodec="mp3");break;case 193:if(!i){ds("AC-3",s);break}case 129:t.ac3?a.audioPid===-1&&(a.audioPid=y,a.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(a.audioPid===-1&&S>0){let B=e+5,$=S;for(;$>2;){switch(o[B]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=y,a.segmentAudioCodec="ac3");break}const Q=o[B+1]+2;B+=Q,$-=Q}}break;case 194:case 135:return fs(r,new Error("Unsupported EC-3 in M2TS found"),void 0,s),a;case 36:a.videoPid===-1&&(a.videoPid=y,a.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=S+5}return a}function fs(o,e,t,i){i.warn(`parsing error: ${e.message}`),o.emit(g.ERROR,g.ERROR,{type:T.MEDIA_ERROR,details:x.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function ds(o,e){e.log(`${o} with AES-128-CBC encryption found in unencrypted stream`)}function fn(o,e){let t=0,i,r,s,a,h;const _=o.data;if(!o||o.size===0)return null;for(;_[0].length<19&&_.length>1;)_[0]=Xe(_[0],_[1]),_.splice(1,1);if(i=_[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 y=i[7];y&192&&(a=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,y&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 B=new Uint8Array(o.size);for(let $=0,W=_.length;$<W;$++){i=_[$];let Q=i.byteLength;if(S)if(S>Q){S-=Q;continue}else i=i.subarray(S),Q-=S,S=0;B.set(i,t),t+=Q}return r&&(r-=s+3),{data:B,pts:a,dts:h,len:r}}return null}class Nl{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 Or=Math.pow(2,32)-1;class Re{static init(){Re.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 Re.types)Re.types.hasOwnProperty(e)&&(Re.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]);Re.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]);Re.STTS=Re.STSC=Re.STCO=s,Re.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Re.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Re.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Re.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]),_=new Uint8Array([0,0,0,1]);Re.FTYP=Re.box(Re.types.ftyp,a,_,a,h),Re.DINF=Re.box(Re.types.dinf,Re.box(Re.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 Re.box(Re.types.hdlr,Re.HDLR_TYPES[e])}static mdat(e){return Re.box(Re.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Or+1)),r=Math.floor(t%(Or+1));return Re.box(Re.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 Re.box(Re.types.mdia,Re.mdhd(e.timescale||0,e.duration||0),Re.hdlr(e.type),Re.minf(e))}static mfhd(e){return Re.box(Re.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"?Re.box(Re.types.minf,Re.box(Re.types.smhd,Re.SMHD),Re.DINF,Re.stbl(e)):Re.box(Re.types.minf,Re.box(Re.types.vmhd,Re.VMHD),Re.DINF,Re.stbl(e))}static moof(e,t,i){return Re.box(Re.types.moof,Re.mfhd(e),Re.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Re.trak(e[t]);return Re.box.apply(null,[Re.types.moov,Re.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(Re.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Re.trex(e[t]);return Re.box.apply(null,[Re.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Or+1)),r=Math.floor(t%(Or+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 Re.box(Re.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 Re.box(Re.types.sdtp,i)}static stbl(e){return Re.box(Re.types.stbl,Re.stsd(e),Re.box(Re.types.stts,Re.STTS),Re.box(Re.types.stsc,Re.STSC),Re.box(Re.types.stsz,Re.STSZ),Re.box(Re.types.stco,Re.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=Re.box(Re.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),_=e.width,d=e.height,y=e.pixelRatio[0],S=e.pixelRatio[1];return Re.box(Re.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,_>>8&255,_&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,Re.box(Re.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Re.box(Re.types.pasp,new Uint8Array([y>>24,y>>16&255,y>>8&255,y&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 Re.box(Re.types.mp4a,Re.audioStsd(e),Re.box(Re.types.esds,Re.esds(e)))}static mp3(e){return Re.box(Re.types[".mp3"],Re.audioStsd(e))}static ac3(e){return Re.box(Re.types["ac-3"],Re.audioStsd(e),Re.box(Re.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Re.box(Re.types.stsd,Re.STSD,Re.mp4a(e));if(t==="ac3"&&e.config)return Re.box(Re.types.stsd,Re.STSD,Re.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Re.box(Re.types.stsd,Re.STSD,Re.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Re.box(Re.types.stsd,Re.STSD,Re.avc1(e));if(t==="hevc"&&e.vps)return Re.box(Re.types.stsd,Re.STSD,Re.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/(Or+1)),h=Math.floor(i%(Or+1));return Re.box(Re.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=Re.sdtp(e),r=e.id,s=Math.floor(t/(Or+1)),a=Math.floor(t%(Or+1));return Re.box(Re.types.traf,Re.box(Re.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),Re.box(Re.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])),Re.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Re.box(Re.types.trak,Re.tkhd(e),Re.mdia(e))}static trex(e){const t=e.id;return Re.box(Re.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,_,d,y,S,B;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++)_=i[h],d=_.duration,y=_.size,S=_.flags,B=_.cts,a.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,y>>>24&255,y>>>16&255,y>>>8&255,y&255,S.isLeading<<2|S.dependsOn,S.isDependedOn<<6|S.hasRedundancy<<4|S.paddingValue<<1|S.isNonSync,S.degradPrio&61440,S.degradPrio&15,B>>>24&255,B>>>16&255,B>>>8&255,B&255],12+16*h);return Re.box(Re.types.trun,a)}static initSegment(e){Re.types||Re.init();const t=Re.moov(e);return Xe(Re.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 W=0;W<i.length;W+=1){a+=3;for(let Q=0;Q<i[W].length;Q+=1)a+=2+i[W][Q].length}const h=new Uint8Array(a);h.set(s,0),a=s.length;const _=i.length-1;for(let W=0;W<i.length;W+=1){h.set(new Uint8Array([32+W|(W===_?128:0),0,i[W].length]),a),a+=3;for(let Q=0;Q<i[W].length;Q+=1)h.set(new Uint8Array([i[W][Q].length>>8,i[W][Q].length&255]),a),a+=2,h.set(i[W][Q],a),a+=i[W][Q].length}const d=Re.box(Re.types.hvcC,h),y=e.width,S=e.height,B=e.pixelRatio[0],$=e.pixelRatio[1];return Re.box(Re.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,y>>8&255,y&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,Re.box(Re.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Re.box(Re.types.pasp,new Uint8Array([B>>24,B>>16&255,B>>8&255,B&255,$>>24,$>>16&255,$>>8&255,$&255])))}}Re.types=void 0,Re.HDLR_TYPES=void 0,Re.STTS=void 0,Re.STSC=void 0,Re.STCO=void 0,Re.STSZ=void 0,Re.VMHD=void 0,Re.SMHD=void 0,Re.STSD=void 0,Re.FTYP=void 0,Re.DINF=void 0;const Ra=9e4;function ps(o,e,t=1,i=!1){const r=o*e*t;return i?Math.round(r):r}function Ul(o,e,t=1,i=!1){return ps(o,e,1/t,i)}function Dn(o,e=!1){return ps(o,1e3,1/Ra,e)}function Hl(o,e=1){return ps(o,Ra,1/e)}const $l=10*1e3,jl=1024,Wl=1152,Gl=1536;let dn=null,_s=null;function ka(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 Hn{constructor(e,t,i,r){if(this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=r,this.ISGenerated=!1,dn===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);dn=a?parseInt(a[1]):0}if(_s===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);_s=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,r=e.reduce((s,a)=>{let h=a.pts,_=h-s;return _<-4294967296&&(t=!0,h=tr(h,i),_=h-s),_>0?s:h},i);return t&&this.logger.debug("PTS rollover detected"),r}remux(e,t,i,r,s,a,h,_){let d,y,S,B,$,W,Q=s,X=s;const se=e.pid>-1,fe=t.pid>-1,le=t.samples.length,we=e.samples.length>0,Ae=h&&le>0||le>1;if((!se||we)&&(!fe||Ae)||this.ISGenerated||h){if(this.ISGenerated){var Te,Fe,$e,Le;const Dt=this.videoTrackConfig;(Dt&&(t.width!==Dt.width||t.height!==Dt.height||((Te=t.pixelRatio)==null?void 0:Te[0])!==((Fe=Dt.pixelRatio)==null?void 0:Fe[0])||(($e=t.pixelRatio)==null?void 0:$e[1])!==((Le=Dt.pixelRatio)==null?void 0:Le[1]))||!Dt&&Ae||this.nextAudioPts===null&&we)&&this.resetInitSegment()}this.ISGenerated||(S=this.generateIS(e,t,s,a));const Je=this.isVideoContiguous;let lt=-1,Gt;if(Ae&&(lt=Kl(t.samples),!Je&&this.config.forceKeyFrameOnDiscontinuity))if(W=!0,lt>0){this.logger.warn(`[mp4-remuxer]: Dropped ${lt} out of ${le} video samples due to a missing keyframe`);const Dt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(lt),t.dropped+=lt,X+=(t.samples[0].pts-Dt)/t.inputTimeScale,Gt=X}else lt===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${le} video samples`),W=!1);if(this.ISGenerated){if(we&&Ae){const Dt=this.getVideoStartPts(t.samples),_t=(tr(e.samples[0].pts,Dt)-Dt)/t.inputTimeScale;Q+=Math.max(0,_t),X+=Math.max(0,-_t)}if(we){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),S=this.generateIS(e,t,s,a)),y=this.remuxAudio(e,Q,this.isAudioContiguous,a,fe||Ae||_===m.AUDIO?X:void 0),Ae){const Dt=y?y.endPTS-y.startPTS:0;t.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),S=this.generateIS(e,t,s,a)),d=this.remuxVideo(t,X,Je,Dt)}}else Ae&&(d=this.remuxVideo(t,X,Je,0));d&&(d.firstKeyFrame=lt,d.independent=lt!==-1,d.firstKeyFramePTS=Gt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&($=Ia(i,s,this._initPTS,this._initDTS)),r.samples.length&&(B=Pa(r,s,this._initPTS))),{audio:y,video:d,initSegment:S,independent:W,text:B,id3:$}}generateIS(e,t,i,r){const s=e.samples,a=t.samples,h=this.typeSupported,_={},d=this._initPTS;let y=!d||r,S="audio/mp4",B,$,W;if(y&&(B=$=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}_.audio={id:"audio",container:S,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&h.mpeg?new Uint8Array(0):Re.initSegment([e]),metadata:{channelCount:e.channelCount}},y&&(W=e.inputTimeScale,!d||W!==d.timescale?B=$=s[0].pts-Math.round(W*i):y=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,_.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Re.initSegment([t]),metadata:{width:t.width,height:t.height}},y)if(W=t.inputTimeScale,!d||W!==d.timescale){const Q=this.getVideoStartPts(a),X=Math.round(W*i);$=Math.min($,tr(a[0].dts,Q)-X),B=Math.min(B,Q-X)}else y=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(_).length)return this.ISGenerated=!0,y?(this._initPTS={baseTime:B,timescale:W},this._initDTS={baseTime:$,timescale:W}):B=W=void 0,{tracks:_,initPTS:B,timescale:W}}remuxVideo(e,t,i,r){const s=e.inputTimeScale,a=e.samples,h=[],_=a.length,d=this._initPTS;let y=this.nextAvcDts,S=8,B=this.videoSampleDuration,$,W,Q=Number.POSITIVE_INFINITY,X=Number.NEGATIVE_INFINITY,se=!1;if(!i||y===null){const et=t*s,nt=a[0].pts-tr(a[0].dts,a[0].pts);dn&&y!==null&&Math.abs(et-nt-y)<15e3?i=!0:y=et-nt}const fe=d.baseTime*s/d.timescale;for(let et=0;et<_;et++){const nt=a[et];nt.pts=tr(nt.pts-fe,y),nt.dts=tr(nt.dts-fe,y),nt.dts<a[et>0?et-1:et].dts&&(se=!0)}se&&a.sort(function(et,nt){const Mt=et.dts-nt.dts,kt=et.pts-nt.pts;return Mt||kt}),$=a[0].dts,W=a[a.length-1].dts;const le=W-$,we=le?Math.round(le/(_-1)):B||e.inputTimeScale/30;if(i){const et=$-y,nt=et>we,Mt=et<-1;if((nt||Mt)&&(nt?this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Dn(et,!0)} ms (${et}dts) hole between fragments detected at ${t.toFixed(3)}`):this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Dn(-et,!0)} ms (${et}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Mt||y>=a[0].pts||dn)){$=y;const kt=a[0].pts-et;if(nt)a[0].dts=$,a[0].pts=kt;else{let Wt=!0;for(let Yt=0;Yt<a.length&&!(a[Yt].dts>kt&&Wt);Yt++){const ti=a[Yt].pts;if(a[Yt].dts-=et,a[Yt].pts-=et,Yt<a.length-1){const li=a[Yt+1].pts,Ui=a[Yt].pts,Gi=li<=Ui,Br=li<=ti;Wt=Gi==Br}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${Dn(kt,!0)}/${Dn($,!0)}, delta: ${Dn(et,!0)} ms`)}}$=Math.max(0,$);let Ae=0,He=0,Te=$;for(let et=0;et<_;et++){const nt=a[et],Mt=nt.units,kt=Mt.length;let Wt=0;for(let Yt=0;Yt<kt;Yt++)Wt+=Mt[Yt].data.length;He+=Wt,Ae+=kt,nt.length=Wt,nt.dts<Te?(nt.dts=Te,Te+=we/4|0||1):Te=nt.dts,Q=Math.min(nt.pts,Q),X=Math.max(nt.pts,X)}W=a[_-1].dts;const Fe=He+4*Ae+8;let $e;try{$e=new Uint8Array(Fe)}catch(et){this.observer.emit(g.ERROR,g.ERROR,{type:T.MUX_ERROR,details:x.REMUX_ALLOC_ERROR,fatal:!1,error:et,bytes:Fe,reason:`fail allocating video mdat ${Fe}`});return}const Le=new DataView($e.buffer);Le.setUint32(0,Fe),$e.set(Re.types.mdat,4);let Je=!1,lt=Number.POSITIVE_INFINITY,Gt=Number.POSITIVE_INFINITY,Dt=Number.NEGATIVE_INFINITY,Et=Number.NEGATIVE_INFINITY;for(let et=0;et<_;et++){const nt=a[et],Mt=nt.units;let kt=0;for(let ti=0,li=Mt.length;ti<li;ti++){const Ui=Mt[ti],Gi=Ui.data,Br=Ui.data.byteLength;Le.setUint32(S,Br),S+=4,$e.set(Gi,S),S+=Br,kt+=4+Br}let Wt;if(et<_-1)B=a[et+1].dts-nt.dts,Wt=a[et+1].pts-nt.pts;else{const ti=this.config,li=et>0?nt.dts-a[et-1].dts:we;if(Wt=et>0?nt.pts-a[et-1].pts:we,ti.stretchShortVideoTrack&&this.nextAudioPts!==null){const Ui=Math.floor(ti.maxBufferHole*s),Gi=(r?Q+r*s:this.nextAudioPts)-nt.pts;Gi>Ui?(B=Gi-li,B<0?B=li:Je=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${Gi/90} ms to the next segment; using duration ${B/90} ms for the last video frame.`)):B=li}else B=li}const Yt=Math.round(nt.pts-nt.dts);lt=Math.min(lt,B),Dt=Math.max(Dt,B),Gt=Math.min(Gt,Wt),Et=Math.max(Et,Wt),h.push(ka(nt.key,B,kt,Yt))}if(h.length){if(dn){if(dn<70){const et=h[0].flags;et.dependsOn=2,et.isNonSync=0}}else if(_s&&Et-Gt<Dt-lt&&we/Dt<.025&&h[0].cts===0){this.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let et=$;for(let nt=0,Mt=h.length;nt<Mt;nt++){const kt=et+h[nt].duration,Wt=et+h[nt].cts;if(nt<Mt-1){const Yt=kt+h[nt+1].cts;h[nt].duration=Yt-Wt}else h[nt].duration=nt?h[nt-1].duration:we;h[nt].cts=0,et=kt}}}B=Je||!B?we:B,this.nextAvcDts=y=W+B,this.videoSampleDuration=B,this.isVideoContiguous=!0;const bt={data1:Re.moof(e.sequenceNumber++,$,c(e,{samples:h})),data2:$e,startPTS:Q/s,endPTS:(X+B)/s,startDTS:$/s,endDTS:y/s,type:"video",hasAudio:!1,hasVideo:!0,nb:h.length,dropped:e.dropped};return e.samples=[],e.dropped=0,bt}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Wl;case"ac3":return Gl;default:return jl}}remuxAudio(e,t,i,r,s){const a=e.inputTimeScale,h=e.samplerate?e.samplerate:a,_=a/h,d=this.getSamplesPerFrame(e),y=d*_,S=this._initPTS,B=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,$=[],W=s!==void 0;let Q=e.samples,X=B?0:8,se=this.nextAudioPts||-1;const fe=t*a,le=S.baseTime*a/S.timescale;if(this.isAudioContiguous=i=i||Q.length&&se>0&&(r&&Math.abs(fe-se)<9e3||Math.abs(tr(Q[0].pts-le,fe)-se)<20*y),Q.forEach(function(_t){_t.pts=tr(_t.pts-le,fe)}),!i||se<0){if(Q=Q.filter(_t=>_t.pts>=0),!Q.length)return;s===0?se=0:r&&!W?se=Math.max(0,fe):se=Q[0].pts}if(e.segmentCodec==="aac"){const _t=this.config.maxAudioFramesDrift;for(let St=0,bt=se;St<Q.length;St++){const et=Q[St],nt=et.pts,Mt=nt-bt,kt=Math.abs(1e3*Mt/a);if(Mt<=-_t*y&&W)St===0&&(this.logger.warn(`Audio frame @ ${(nt/a).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*Mt/a)} ms.`),this.nextAudioPts=se=bt=nt);else if(Mt>=_t*y&&kt<$l&&W){let Wt=Math.round(Mt/y);bt=nt-Wt*y,bt<0&&(Wt--,bt+=y),St===0&&(this.nextAudioPts=se=bt),this.logger.warn(`[mp4-remuxer]: Injecting ${Wt} audio frame @ ${(bt/a).toFixed(3)}s due to ${Math.round(1e3*Mt/a)} ms gap.`);for(let Yt=0;Yt<Wt;Yt++){const ti=Math.max(bt,0);let li=Nl.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);li||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),li=et.unit.subarray()),Q.splice(St,0,{unit:li,pts:ti}),bt+=y,St++}}et.pts=bt,bt+=y}}let we=null,Ae=null,He,Te=0,Fe=Q.length;for(;Fe--;)Te+=Q[Fe].unit.byteLength;for(let _t=0,St=Q.length;_t<St;_t++){const bt=Q[_t],et=bt.unit;let nt=bt.pts;if(Ae!==null){const kt=$[_t-1];kt.duration=Math.round((nt-Ae)/_)}else if(i&&e.segmentCodec==="aac"&&(nt=se),we=nt,Te>0){Te+=X;try{He=new Uint8Array(Te)}catch(kt){this.observer.emit(g.ERROR,g.ERROR,{type:T.MUX_ERROR,details:x.REMUX_ALLOC_ERROR,fatal:!1,error:kt,bytes:Te,reason:`fail allocating audio mdat ${Te}`});return}B||(new DataView(He.buffer).setUint32(0,Te),He.set(Re.types.mdat,4))}else return;He.set(et,X);const Mt=et.byteLength;X+=Mt,$.push(ka(!0,d,Mt,0)),Ae=nt}const $e=$.length;if(!$e)return;const Le=$[$.length-1];this.nextAudioPts=se=Ae+_*Le.duration;const Je=B?new Uint8Array(0):Re.moof(e.sequenceNumber++,we/_,c({},e,{samples:$}));e.samples=[];const lt=we/a,Gt=se/a,Et={data1:Je,data2:He,startPTS:lt,endPTS:Gt,startDTS:lt,endDTS:Gt,type:"audio",hasAudio:!0,hasVideo:!1,nb:$e};return this.isAudioContiguous=!0,Et}}function tr(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 Kl(o){for(let e=0;e<o.length;e++)if(o[e].key)return e;return-1}function Ia(o,e,t,i){const r=o.samples.length;if(!r)return;const s=o.inputTimeScale;for(let h=0;h<r;h++){const _=o.samples[h];_.pts=tr(_.pts-t.baseTime*s/t.timescale,e*s)/s,_.dts=tr(_.dts-i.baseTime*s/i.timescale,e*s)/s}const a=o.samples;return o.samples=[],{samples:a}}function Pa(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=tr(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 zl{constructor(e,t,i,r){this.logger=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.logger=r}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(ye(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=We(e);r.audio&&(t=Oa(r.audio,C.AUDIO)),r.video&&(i=Oa(r.video,C.VIDEO));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.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,i,r,s,a){var h,_;let{initPTS:d,lastEndTime:y}=this;const S={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};k(y)||(y=this.lastEndTime=s||0);const B=t.samples;if(!(B!=null&&B.length))return S;const $={initPTS:void 0,timescale:1};let W=this.initData;if((h=W)!=null&&h.length||(this.generateInitSegment(B),W=this.initData),!((_=W)!=null&&_.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&($.tracks=this.initTracks,this.emitInitSegment=!1);const Q=Ie(B,W),X=Ne(W,B),se=X===null?s:X;(a||!d)&&(Vl(d,se,s,Q)||$.timescale!==d.timescale)&&($.initPTS=se-s,d&&d.timescale===1&&this.logger.warn(`Adjusting initPTS @${s} from ${d.baseTime/d.timescale} to ${$.initPTS}`),this.initPTS=d={baseTime:$.initPTS,timescale:1});const fe=e?se-d.baseTime/d.timescale:y,le=fe+Q;ke(W,B,d.baseTime/d.timescale),Q>0?this.lastEndTime=le:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const we=!!W.audio,Ae=!!W.video;let He="";we&&(He+="audio"),Ae&&(He+="video");const Te={data1:B,startPTS:fe,startDTS:fe,endPTS:le,endDTS:le,type:He,hasAudio:we,hasVideo:Ae,nb:1,dropped:0};return S.audio=Te.type==="audio"?Te:void 0,S.video=Te.type!=="audio"?Te:void 0,S.initSegment=$,S.id3=Ia(i,s,d,d),r.samples.length&&(S.text=Pa(r,s,d)),S}}function Vl(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 Oa(o,e){const t=o==null?void 0:o.codec;return t&&t.length>4?t:e===C.AUDIO?t==="ec-3"||t==="ac-3"||t==="alac"?t:t==="fLaC"||t==="Opus"?Ke(t,!1):(F.warn(`Unhandled audio codec "${t}" in mp4 MAP`),t||"mp4a"):(F.warn(`Unhandled video codec "${t}" in mp4 MAP`),t||"avc1")}let Sr;try{Sr=self.performance.now.bind(self.performance)}catch(o){Sr=Date.now}const $n=[{demux:Ol,remux:zl},{demux:Pr,remux:Hn},{demux:Rl,remux:Hn},{demux:Il,remux:Hn}];$n.splice(2,0,{demux:kl,remux:Hn});class Fa{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=Sr();let a=new Uint8Array(e);const{currentTransmuxState:h,transmuxConfig:_}=this;r&&(this.currentTransmuxState=r);const{contiguous:d,discontinuity:y,trackSwitch:S,accurateTimeOffset:B,timeOffset:$,initSegmentChange:W}=r||h,{audioCodec:Q,videoCodec:X,defaultInitPts:se,duration:fe,initSegmentData:le}=_,we=ql(a,t);if(we&&cr(we.method)){const Fe=this.getDecrypter(),$e=br(we.method);if(Fe.isSync()){let Le=Fe.softwareDecrypt(a,we.key.buffer,we.iv.buffer,$e);if(i.part>-1){const lt=Fe.flush();Le=lt&<.buffer}if(!Le)return s.executeEnd=Sr(),gs(i);a=new Uint8Array(Le)}else return this.asyncResult=!0,this.decryptionPromise=Fe.webCryptoDecrypt(a,we.key.buffer,we.iv.buffer,$e).then(Le=>{const Je=this.push(Le,null,i);return this.decryptionPromise=null,Je}),this.decryptionPromise}const Ae=this.needsProbing(y,S);if(Ae){const Fe=this.configureTransmuxer(a);if(Fe)return this.logger.warn(`[transmuxer] ${Fe.message}`),this.observer.emit(g.ERROR,g.ERROR,{type:T.MEDIA_ERROR,details:x.FRAG_PARSING_ERROR,fatal:!1,error:Fe,reason:Fe.message}),s.executeEnd=Sr(),gs(i)}(y||S||W||Ae)&&this.resetInitSegment(le,Q,X,fe,t),(y||W||Ae)&&this.resetInitialTimestamp(se),d||this.resetContiguity();const He=this.transmux(a,we,$,B,i);this.asyncResult=Ln(He);const Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,s.executeEnd=Sr(),He}flush(e){const t=e.transmuxing;t.executeStart=Sr();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:_,remuxer:d}=this;if(!_||!d){t.executeEnd=Sr();const S=[gs(e)];return this.asyncResult?Promise.resolve(S):S}const y=_.flush(h);return Ln(y)?(this.asyncResult=!0,y.then(S=>(this.flushRemux(a,S,e),a))):(this.flushRemux(a,y,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:s,id3Track:a,textTrack:h}=t,{accurateTimeOffset:_,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 y=this.remuxer.remux(r,s,a,h,d,_,!0,this.id);e.push({remuxResult:y,chunkMeta:i}),i.transmuxing.executeEnd=Sr()}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:_}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,a,h,_,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,B=$n.length;S<B;S++){var a;if((a=$n[S].demux)!=null&&a.probe(e,this.logger)){s=$n[S];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const h=this.demuxer,_=this.remuxer,d=s.remux,y=s.demux;(!_||!(_ instanceof d))&&(this.remuxer=new d(i,t,r,this.logger)),(!h||!(h instanceof y))&&(this.demuxer=new y(i,t,r,this.logger),this.probe=y.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Hr(this.config)),e}}function ql(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 gs=o=>({remuxResult:{},chunkMeta:o});function Ln(o){return"then"in o&&o.then instanceof Function}class Yl{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 Zl{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 Ma=0;class Ba{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Ma++,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=_=>{const d=_.data,y=this.hls;if(!(!y||!(d!=null&&d.event)||d.instanceNo!==this.instanceNo))switch(d.event){case"init":{var S;const B=(S=this.workerContext)==null?void 0:S.objectURL;B&&self.URL.revokeObjectURL(B);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}case"workerLog":{y.logger[d.data.logType]&&y.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,y.trigger(d.event,d.data);break}}},this.onWorkerError=_=>{if(!this.hls)return;const d=new Error(`${_.message} (${_.filename}:${_.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(g.ERROR,{type:T.OTHER_ERROR,details:x.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=(_,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(_,d)};this.observer=new ns,this.observer.on(g.FRAG_DECRYPTED,a),this.observer.on(g.ERROR,a);const h=Bt(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const _=this.hls.logger;if(s.workerPath||Jo()){try{s.workerPath?(_.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=tl(s.workerPath)):(_.log(`injecting Web Worker for "${t}"`),this.workerContext=el());const{worker:y}=this.workerContext;y.addEventListener("message",this.onWorkerMessage),y.addEventListener("error",this.onWorkerError),y.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:h,id:t,config:At(s)})}catch(y){_.warn(`Error setting up "${t}" Web Worker, fallback to inline`,y),this.terminateWorker(),this.error=null,this.transmuxer=new Fa(this.observer,h,s,"",t,e.logger)}return}}this.transmuxer=new Fa(this.observer,h,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Ma++;const t=this.hls.config,i=Bt(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,_,d,y){var S,B;d.transmuxing.start=self.performance.now();const{instanceNo:$,transmuxer:W}=this,Q=a?a.start:s.start,X=s.decryptdata,se=this.frag,fe=!(se&&s.cc===se.cc),le=!(se&&d.level===se.level),we=se?d.sn-se.sn:-1,Ae=this.part?d.part-this.part.index:-1,He=we===0&&d.id>1&&d.id===(se==null?void 0:se.stats.chunkCount),Te=!le&&(we===1||we===0&&(Ae===1||He&&Ae<=0)),Fe=self.performance.now();(le||we||s.stats.parsing.start===0)&&(s.stats.parsing.start=Fe),a&&(Ae||!Te)&&(a.stats.parsing.start=Fe);const $e=!(se&&((S=s.initSegment)==null?void 0:S.url)===((B=se.initSegment)==null?void 0:B.url)),Le=new Zl(fe,Te,_,le,Q,$e);if(!Te||fe||$e){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: ${fe}
|
|
|
trackSwitch: ${le}
|
|
|
contiguous: ${Te}
|
|
|
accurateTimeOffset: ${_}
|
|
|
timeOffset: ${Q}
|
|
|
initSegmentChange: ${$e}`);const Je=new Yl(i,r,t,h,y);this.configureTransmuxer(Je)}if(this.frag=s,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:$,cmd:"demux",data:e,decryptdata:X,chunkMeta:d,state:Le},e instanceof ArrayBuffer?[e]:[]);else if(W){const Je=W.push(e,X,d,Le);Ln(Je)?Je.then(lt=>{this.handleTransmuxComplete(lt)}).catch(lt=>{this.transmuxerError(lt,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(Je)}}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);Ln(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(g.ERROR,{type:T.MEDIA_ERROR,details:x.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 Na=100;class Xl extends is{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(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(g.BUFFER_RESET,this.onBufferReset,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(g.BUFFER_RESET,this.onBufferReset,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.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===Ge.WAITING_INIT_PTS){const _=this.waitingData;(!_&&!this.loadingParts||_&&_.frag.cc!==a)&&(this.nextLoadPosition=this.findSyncFrag(t).start),this.tick()}else!this.hls.hasEnoughToStart&&h&&h.cc!==a?(this.startFragRequested=!1,this.nextLoadPosition=this.findSyncFrag(t).start,h.abortRequests(),this.resetLoadingState()):this.state===Ge.IDLE&&this.tick()}}findSyncFrag(e){const t=this.getLevelDetails(),i=e.cc;return Vi(t,i,e)||t&&ni(t.fragments,i)||e}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=Ge.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Na),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=Ge.IDLE):this.state=Ge.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case Ge.IDLE:this.doTickIdle();break;case Ge.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=Ge.WAITING_INIT_PTS}break}case Ge.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=Ge.IDLE}break}case Ge.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=Ge.FRAG_LOADING;const _=s.flush().buffer,d={frag:i,part:r,payload:_,networkDetails:null};this._handleFragmentLoadProgress(d),a&&super._handleFragmentLoadComplete(d)}else h&&h.cc!==t.frag.cc&&(this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${h.cc}`),this.nextLoadPosition=this.findSyncFrag(h).start,this.clearWaitingFragment())}else this.state=Ge.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.state!==Ge.STOPPED&&(this.state=Ge.IDLE))}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media: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],_=h.details;if(!_||this.waitForLive(h)||this.waitForCdnTuneIn(_)){this.state=Ge.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,C.AUDIO,m.AUDIO));const y=this.getFwdBufferInfo(d,m.AUDIO);if(y===null)return;if(!this.switchingTrack&&this._streamEnded(y,_)){t.trigger(g.BUFFER_EOS,{type:"audio"}),this.state=Ge.ENDED;return}const S=y.len,B=t.maxBufferLength,$=_.fragments,W=$[0].start,Q=this.getLoadPosition(),X=this.flushing?Q:y.end;if(this.switchingTrack&&r){const le=Q;_.PTSKnown&&le<W&&(y.end>W||y.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=W+.05)}if(S>=B&&!this.switchingTrack&&X<$[$.length-1].start)return;let se=this.getNextFragment(X,_);if(se&&this.isLoopLoading(se,X)&&(se=this.getNextFragmentLoopLoading(se,_,y,m.MAIN,B)),!se){this.bufferFlushed=!0;return}let fe=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&fe&&ie(se)&&!se.endList&&(!_.live||!this.loadingParts&&X<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(fe)===di.OK&&(this.mainFragLoading=fe=null),fe&&ie(fe))){if(se.start>fe.end){const we=this.fragmentTracker.getFragAtPos(X,m.MAIN);we&&we.end>fe.end&&(fe=we,this.mainFragLoading={frag:we,targetBufferTime:null})}if(se.start>fe.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 Vt(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!==Ge.STOPPED&&(this.setInterval(Na),this.state=Ge.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(g.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:r}=this,{details:s,id:a,groupId:h,track:_}=t;if(!r){this.warn(`Audio tracks reset while loading track ${a} "${_.name}" of "${h}"`);return}const d=this.mainDetails;if(!d||s.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=t,this.state!==Ge.STOPPED&&(this.state=Ge.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${_.name}" of "${h}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const y=r[a];let S=0;if(s.live||(i=y.details)!=null&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(y.details){var B;S=this.alignPlaylists(s,y.details,(B=this.levelLastLoaded)==null?void 0:B.details)}s.alignedSliding||(oa(s,d),s.alignedSliding||Fn(s,d),S=s.fragmentStart)}y.details=s,this.levelLastLoaded=y,this.startFragRequested||this.setStartPosition(d,S),this.hls.trigger(g.AUDIO_TRACK_UPDATED,{details:s,id:a,groupId:t.groupId}),this.state===Ge.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=Ge.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:r,payload:s}=e,{config:a,trackId:h,levels:_}=this;if(!_){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=_[h];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const y=d.details;if(!y){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 B=this.transmuxer;B||(B=this.transmuxer=new Ba(this.hls,m.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const $=this.initPTS[i.cc],W=(t=i.initSegment)==null?void 0:t.data;if($!==void 0){const X=r?r.index:-1,se=X!==-1,fe=new Tr(i.level,i.sn,i.stats.chunkCount,s.byteLength,X,se);B.push(s,W,S,"",i,r,y.totalduration,!1,fe,$)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${y.startSN} ,${y.endSN}],track ${h}`);const{cache:Q}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new ua,complete:!1};Q.push(new Uint8Array(s)),this.state!==Ge.STOPPED&&(this.state=Ge.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&&ie(t.frag)&&(this.mainFragLoading=t,this.state===Ge.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(ie(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(g.AUDIO_TRACK_SWITCHED,u({},s)))}this.fragBufferedComplete(i,r),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=Ge.ERROR;return}switch(t.details){case x.FRAG_GAP:case x.FRAG_PARSING_ERROR:case x.FRAG_DECRYPT_ERROR:case x.FRAG_LOAD_ERROR:case x.FRAG_LOAD_TIMEOUT:case x.KEY_LOAD_ERROR:case x.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(m.AUDIO,t);break;case x.AUDIO_TRACK_LOAD_ERROR:case x.AUDIO_TRACK_LOAD_TIMEOUT:case x.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ge.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===O.AUDIO_TRACK&&(this.state=Ge.IDLE);break;case x.BUFFER_ADD_CODEC_ERROR:case x.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case x.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case x.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==C.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==C.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Ge.ENDED&&(this.state=Ge.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:_,part:d,level:y}=h,{details:S}=y,{audio:B,text:$,id3:W,initSegment:Q}=s;if(this.fragContextChanged(_)||!S){this.fragmentTracker.removeFragment(_);return}if(this.state=Ge.PARSING,this.switchingTrack&&B&&this.completeAudioSwitch(this.switchingTrack),Q!=null&&Q.tracks){const X=_.initSegment||_;this._bufferInitSegment(y,Q.tracks,X,a),r.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:X,id:i,tracks:Q.tracks})}if(B){const{startPTS:X,endPTS:se,startDTS:fe,endDTS:le}=B;d&&(d.elementaryStreams[C.AUDIO]={startPTS:X,endPTS:se,startDTS:fe,endDTS:le}),_.setElementaryStreamInfo(C.AUDIO,X,se,fe,le),this.bufferFragmentData(B,_,d,a)}if(W!=null&&(t=W.samples)!=null&&t.length){const X=c({id:i,frag:_,details:S},W);r.trigger(g.FRAG_PARSING_METADATA,X)}if($){const X=c({id:i,frag:_,details:S},$);r.trigger(g.FRAG_PARSING_USERDATA,X)}}_bufferInitSegment(e,t,i,r){if(this.state!==Ge.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(g.BUFFER_CODECS,t);const h=s.initSegment;if(h!=null&&h.byteLength){const _={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:h};this.hls.trigger(g.BUFFER_APPENDING,_)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===di.NOT_LOADED||r===di.PARTIAL){var s;if(!ie(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=Ge.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&Fn(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;Ci({name:t,lang:i,assocLang:r,characteristics:s,audioCodec:a,channels:h},e,Ht)||(gi(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(g.AUDIO_TRACK_SWITCHED,u({},e))}}class ms extends D{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 _;try{_=new self.URL(h.URI,t.url).href}catch(d){this.warn(`Could not construct new URL for Rendition Report: ${d}`),_=h.URI||""}if(_===e){s=a;break}else _===e.substring(0,_.length)&&(s=a)}if(s!==-1){const a=r[s],h=parseInt(a["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let _=parseInt(a["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const y=Math.min(t.age-t.partTarget,t.targetduration);_>=0&&y>t.partTarget&&(_+=1)}const d=i&&yi(i);return new _r(h,_>=0?_: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 _=this.hls.config.timelineOffset;if(_!==r.appliedTimelineOffset){const y=Math.max(_||0,0);r.appliedTimelineOffset=y,r.fragments.forEach(S=>{S.start=S.playlistOffset+y})}if(r.live||i!=null&&i.live){const y="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(i),i&&r.fragments.length>0){Wo(i,r);const fe=r.playlistParsingError;if(fe){this.warn(fe);const le=this.hls;if(!le.config.ignorePlaylistParsingErrors){var d;const{networkDetails:we}=t;le.trigger(g.ERROR,{type:T.NETWORK_ERROR,details:x.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:fe,reason:fe.message,level:t.level||void 0,parent:(d=r.fragments[0])==null?void 0:d.type,networkDetails:we,stats:s});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=s.loading.start);const S=this.hls.mainForwardBufferInfo,B=S?S.end-S.len:0,$=(r.edge-B)*1e3,W=ea(r,$);if(r.requestScheduled+W<a?r.requestScheduled=a:r.requestScheduled+=W,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 fe=this.hls.config.lowLatencyMode,le=r.lastPartSn,we=r.endSN,Ae=r.lastPartIndex,He=Ae!==-1,Te=le===we;He?Te?(X=we+1,se=fe?0:Ae):(X=le,se=fe?Ae+1:r.maxPartIndex):X=we+1;const Fe=r.age,$e=Fe+r.ageHeader;let Le=Math.min($e-r.partTarget,r.targetduration*1.5);if(Le>0){if($e>r.targetduration*3)this.log(`Playlist last advanced ${Fe.toFixed(2)}s ago. Omitting segment and part directives.`),X=void 0,se=void 0;else if(i!=null&&i.tuneInGoal&&$e-r.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${Le} with playlist age: ${r.age}`),Le=0;else{const Je=Math.floor(Le/r.targetduration);if(X+=Je,se!==void 0){const lt=Math.round(Le%r.targetduration/r.partTarget);se+=lt}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${Fe.toFixed(2)}s goal: ${Le} skip sn ${Je} to part ${se}`)}r.tuneInGoal=Le}if(Q=this.getDeliveryDirectives(r,t.deliveryDirectives,X,se),fe||!Te){r.requestScheduled=a,this.loadingPlaylist(y,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(W-h*2,W/2)),this.scheduleLoading(y,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=Ki.No),new _r(i,r,s)}checkRetry(e){const t=e.details,i=Qi(e),r=e.errorAction,{action:s,retryCount:a=0,retryConfig:h}=r||{},_=!!r&&!!h&&(s===mi.RetryRequest||!r.resolved&&s===mi.SendAlternateToPenaltyBox);if(_){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 y=Ii(h,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),y),this.warn(`Retrying playlist loading ${a+1}/${h.maxNumRetry} after "${t}" in ${y}ms`)}e.levelRetry=!0,r.resolved=!0}return _}}function Ua(o,e){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(!Rn(o[t].attrs,e[t].attrs))return!1;return!0}function Rn(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 vs(o,e){return e.label.toLowerCase()===o.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(o.lang||"").toLowerCase())}class Ql extends ms{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(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(g.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(B=>!i||i.indexOf(B.groupId)!==-1);if(h.length)this.selectDefaultTrack&&!h.some(B=>B.default)&&(this.selectDefaultTrack=!1),h.forEach((B,$)=>{B.id=$});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=h;const _=this.hls.config.audioPreference;if(!s&&_){const B=qt(_,h,Ht);if(B>-1)s=h[B];else{const $=qt(_,this.tracks);s=this.tracks[$]}}let d=this.findTrackId(s);d===-1&&s&&(d=this.findTrackId(null));const y={audioTracks:h};this.log(`Updating audio tracks, ${h.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(g.AUDIO_TRACKS_UPDATED,y);const S=this.trackId;if(d!==-1&&S===-1)this.setAudioTrack(d);else if(h.length&&S===-1){var a;const B=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(B.message),this.hls.trigger(g.ERROR,{type:T.MEDIA_ERROR,details:x.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:B})}}}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&&Ci(e,r,Ht))return r;const s=qt(e,this.tracksInGroup,Ht);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=Xt(e,t.levels,i,a,Ht);if(h===-1)return null;t.nextLoadLevel=h}if(e.channels||e.audioCodec){const a=qt(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(g.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||Ci(e,r,Ht)))return i}if(e){const{name:i,lang:r,assocLang:s,characteristics:a,audioCodec:h,channels:_}=e;for(let d=0;d<t.length;d++){const y=t[d];if(Ci({name:i,lang:r,assocLang:s,characteristics:a,audioCodec:h,channels:_},y,Ht))return d}for(let d=0;d<t.length;d++){const y=t[d];if(Rn(e.attrs,y.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return d}for(let d=0;d<t.length;d++){const y=t[d];if(Rn(e.attrs,y.attrs,["LANGUAGE"]))return d}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&gi(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(g.AUDIO_TRACK_LOADING,{url:s,id:i,groupId:r,deliveryDirectives:t||null,track:e})}}class Jl{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const 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 Ha=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,$a="HlsJsTrackRemovedError";class eu extends Error{constructor(e){super(e),this.name=$a}}class tu extends D{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(g.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(q(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(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.BUFFER_RESET,this.onBufferReset,this),e.on(g.BUFFER_APPENDING,this.onBufferAppending,this),e.on(g.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.BUFFER_EOS,this.onBufferEos,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.FRAG_PARSED,this.onFragParsed,this),e.on(g.FRAG_CHANGED,this.onFragChanged,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.BUFFER_RESET,this.onBufferReset,this),e.off(g.BUFFER_APPENDING,this.onBufferAppending,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.BUFFER_EOS,this.onBufferEos,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.FRAG_PARSED,this.onFragParsed,this),e.off(g.FRAG_CHANGED,this.onFragChanged,this),e.off(g.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=q(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 _=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||_&&a instanceof _,ja(i),iu(i,h),i.load()}catch(_){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,(_,d)=>_==="initSegment"?void 0:d)};
|
|
|
transfer tracks: ${At(r,(_,d)=>_==="initSegment"?void 0:d)}}`),!ne(r,i)){t.mediaSource=null,t.tracks=void 0;const _=e.currentTime,d=this.details,y=Math.max(_,(d==null?void 0:d.fragments[0].start)||0);if(y-_>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${_} -> ${y}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(i)}") start time: ${y} currentTime: ${_}`),this.onMediaDetaching(g.MEDIA_DETACHING,{}),this.onMediaAttaching(g.MEDIA_ATTACHING,t),e.currentTime=y;return}this.transferData=void 0,s.forEach(_=>{const d=_,y=r[d];if(y){const S=y.buffer;if(S){const B=this.fragmentTracker,$=y.id;if(B.hasFragments($)||B.hasParts($)){const X=Ot.getBuffered(S);B.detectEvictedFragments(d,X,$,null,!0)}const W=ys(d),Q=[d,S];this.sourceBuffers[W]=Q,S.updating&&this.operationQueue&&this.operationQueue.prependBlocker(d),this.trackSourceBuffer(d,y)}}}),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 _=s.sourceBuffers;for(let d=_.length;d--;)h&&_[d].abort(),s.removeSourceBuffer(_[d]);h&&s.endOfStream()}catch(_){this.warn(`onMediaDetaching: ${_.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&&ja(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(g.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[ys(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Jl(this.tracks)}onBufferCodecs(e,t){const i=this.tracks,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 _,d,y;const S=t[h],{id:B,codec:$,levelCodec:W,container:Q,metadata:X,supplemental:se}=S;let fe=i[h];const le=(_=this.transferData)==null||(d=_.tracks)==null?void 0:d[h],we=le!=null&&le.buffer?le:fe,Ae=(we==null?void 0:we.pendingCodec)||(we==null?void 0:we.codec),He=we==null?void 0:we.levelCodec;fe||(fe=i[h]={buffer:void 0,listeners:[],codec:$,supplemental:se,container:Q,levelCodec:W,metadata:X,id:B});const Te=ot(Ae,He),Fe=Te==null?void 0:Te.replace(Ha,"$1");let $e=ot($,W);const Le=(y=$e)==null?void 0:y.replace(Ha,"$1");$e&&Te&&Fe!==Le&&(h.slice(0,5)==="audio"&&($e=Ke($e,this.appendSource)),this.log(`switching codec ${Ae} to ${$e}`),$e!==(fe.pendingCodec||fe.codec)&&(fe.pendingCodec=$e),fe.container=Q,this.appendChangeType(h,Q,$e))}),(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 _=this.tracks.video;(this.lastVideoAppendEnd>r||_!=null&&_.buffer&&Ot.isBuffered(_.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:_,chunkMeta:d}=t,y=d.buffering[s],S=h.sn,B=self.performance.now();y.start=B;const $=h.stats.buffering,W=_?_.stats.buffering:null;$.start===0&&($.start=B),W&&W.start===0&&(W.start=B);const Q=i.audio;let X=!1;s==="audio"&&(Q==null?void 0:Q.container)==="audio/mpeg"&&(X=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const se=this.tracks.video,fe=se==null?void 0:se.buffer;if(fe&&S!=="initSegment"){const Ae=_||h,He=this.blockedAudioAppend;if(s==="audio"&&a!=="main"&&!this.blockedAudioAppend){const Fe=Ae.start+Ae.duration*.05,$e=fe.buffered,Le=this.currentOp("video");!$e.length&&!Le?this.blockAudio(Ae):!Le&&!Ot.isBuffered(fe,Fe)&&this.lastVideoAppendEnd<Fe&&this.blockAudio(Ae)}else if(s==="video"){const Te=Ae.end;if(He){const Fe=He.frag.start;(Te>Fe||Te<this.lastVideoAppendEnd||Ot.isBuffered(fe,Fe))&&this.unblockAudio()}this.lastVideoAppendEnd=Te}}const le=(_||h).start,we={label:`append-${s}`,execute:()=>{if(y.executeStart=self.performance.now(),X){const Ae=this.tracks[s];if(Ae){const He=Ae.buffer;if(He){const Te=le-He.timestampOffset;Math.abs(Te)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${le} (delta: ${Te}) sn: ${S})`),He.timestampOffset=le)}}}this.appendExecutor(r,s)},onStart:()=>{},onComplete:()=>{const Ae=self.performance.now();y.executeEnd=y.end=Ae,$.first===0&&($.first=Ae),W&&W.first===0&&(W.first=Ae);const He={};this.sourceBuffers.forEach(([Te,Fe])=>{Te&&(He[Te]=Ot.getBuffered(Fe))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(g.BUFFER_APPENDED,{type:s,frag:h,part:_,chunkMeta:d,parent:h.type,timeRanges:He})},onError:Ae=>{var He;const Te={type:T.MEDIA_ERROR,parent:h.type,details:x.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:h,part:_,chunkMeta:d,error:Ae,err:Ae,fatal:!1},Fe=(He=this.media)==null?void 0:He.error;if(Ae.code===DOMException.QUOTA_EXCEEDED_ERR)Te.details=x.BUFFER_FULL_ERROR;else if(Ae.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Fe)Te.errorAction=Ji(!0);else if(Ae.name===$a&&this.sourceBufferCount===0)Te.errorAction=Ji(!0);else{const $e=++this.appendErrors[s];this.warn(`Failed ${$e}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${Fe||"no media error"})`),($e>=this.hls.config.appendErrorMaxRetry||Fe)&&(Te.fatal=!0)}this.hls.trigger(g.ERROR,Te)}};this.append(we,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(g.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[C.AUDIOVIDEO]?s.push("audiovideo"):(a[C.AUDIO]&&s.push("audio"),a[C.VIDEO]&&s.push("video"));const h=()=>{const _=self.performance.now();i.stats.buffering.end=_,r&&(r.stats.buffering.end=_);const d=r?r.stats:i.stats;this.hls.trigger(g.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(_=>{this.warn(`Fragment buffered callback ${_}`),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(g.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(g.BUFFERED_TO_END,void 0)))}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){const e=this.getDurationAndRange();e&&this.blockUntilOpen(()=>this.updateMediaSource(e))}onError(e,t){if(t.details===x.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 _=Math.max(h,a),d=Math.floor(s/a)*a-_;this.flushBackBuffer(s,a,d)}if(k(r.frontBufferFlushThreshold)&&r.frontBufferFlushThreshold>0){const _=Math.max(r.maxBufferLength,r.frontBufferFlushThreshold),d=Math.max(_,a),y=Math.floor(s/a)*a+d;this.flushFrontBuffer(s,a,y)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([r,s])=>{if(s){const h=Ot.getBuffered(s);if(h.length>0&&i>h.start(0)){var a;this.hls.trigger(g.BACK_BUFFER_REACHED,{bufferEnd:i});const _=this.tracks[r];if((a=this.details)!=null&&a.live)this.hls.trigger(g.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(_!=null&&_.ended){this.log(`Cannot flush ${r} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(g.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:r})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([r,s])=>{if(s){const a=Ot.getBuffered(s),h=a.length;if(h<2)return;const _=a.start(h-1),d=a.end(h-1);if(i>_||e>=_&&e<=d)return;this.hls.trigger(g.BUFFER_FLUSHING,{startOffset:_,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),y=Math.max(d,r);return{duration:1/0,start:d,end:y}}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(g.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(g.ERROR,{type:T.MEDIA_ERROR,details:x.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 _=this.getTrackCodec(h,a),d=`${h.container};codecs=${_}`;h.codec=_,this.log(`creating sourceBuffer(${d})${this.currentOp(a)?" Queued":""} ${At(h)}`);try{const y=i.addSourceBuffer(d),S=ys(a),B=[a,y];t[S]=B,h.buffer=y}catch(y){var r;this.error(`error while trying to add sourceBuffer: ${y.message}`),this.shiftAndExecuteNext(a),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[a],this.hls.trigger(g.ERROR,{type:T.MEDIA_ERROR,details:x.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:y,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")&&ge(i,"video")&&(r=qe(r,i));const s=ot(r,e.levelCodec);return s?t.slice(0,5)==="audio"?Ke(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(g.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(g.ERROR,{type:T.MEDIA_ERROR,details:x.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const s=this.currentOp(e);s&&s.onError(r)}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 _=k(r.duration)?r.duration:1/0,d=k(s.duration)?s.duration:1/0,y=Math.max(0,t),S=Math.min(i,_,d);S>y&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${y},${S}] from the ${e} SourceBuffer`),h.remove(y,S)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],r=i==null?void 0:i.buffer;if(!r)throw new eu(`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 ja(o){const e=o.querySelectorAll("source");[].slice.call(e).forEach(t=>{o.removeChild(t)})}function iu(o,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,o.appendChild(t)}function ys(o){return o==="audio"?1:0}class bs{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(g.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(g.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.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,bs.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,_)=>_?h.width!==_.width||h.height!==_.height:!0;let s=e.length-1;const a=Math.max(t,i);for(let h=0;h<e.length;h+=1){const _=e[h];if((_.width>=a||_.height>=a)&&r(_,e[h+1])){s=h;break}}return s}}const Wi={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},ru={HLS:"h"},kn={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},nu={[kn.OBJECT]:["br","d","ot","tb"],[kn.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[kn.SESSION]:["cid","pr","sf","sid","st","v"],[kn.STATUS]:["bs","rtp"]};class pn{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof pn?i:new pn(i))),this.value=e,this.params=t}}const su="Dict";function au(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 ou(o,e,t,i){return new Error(`failed to ${o} "${au(e)}" as ${t}`,{cause:i})}function dr(o,e,t){return ou("serialize",o,e,t)}class Wa{constructor(e){this.description=e}}const Ga="Bare Item",lu="Boolean";function uu(o){if(typeof o!="boolean")throw dr(o,lu);return o?"?1":"?0"}const cu="Byte Sequence";function hu(o){if(ArrayBuffer.isView(o)===!1)throw dr(o,cu);return`:${fl(o)}:`}const fu="Integer";function du(o){return o<-999999999999999||999999999999999<o}function Ka(o){if(du(o))throw dr(o,fu);return o.toString()}function pu(o){return`@${Ka(o.getTime()/1e3)}`}const _u="Decimal";function gu(o){const e=ma(o,3);if(Math.floor(Math.abs(e)).toString().length>12)throw dr(o,_u);const t=e.toString();return t.includes(".")?t:`${t}.0`}const mu="String",vu=/[\x00-\x1f\x7f]+/;function yu(o){if(vu.test(o))throw dr(o,mu);return`"${o.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function bu(o){return o.description||o.toString().slice(7,-1)}const Eu="Token";function za(o){const e=bu(o);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw dr(e,Eu);return e}function Es(o){switch(typeof o){case"number":if(!k(o))throw dr(o,Ga);return Number.isInteger(o)?Ka(o):gu(o);case"string":return yu(o);case"symbol":return za(o);case"boolean":return uu(o);case"object":if(o instanceof Date)return pu(o);if(o instanceof Uint8Array)return hu(o);if(o instanceof Wa)return za(o);default:throw dr(o,Ga)}}const Su="Key";function Ss(o){if(/^[a-z*][a-z0-9\-_.*]*$/.test(o)===!1)throw dr(o,Su);return o}function xs(o){return o==null?"":Object.entries(o).map(([e,t])=>t===!0?`;${Ss(e)}`:`;${Ss(e)}=${Es(t)}`).join("")}function Va(o){return o instanceof pn?`${Es(o.value)}${xs(o.params)}`:Es(o)}function xu(o){return`(${o.value.map(Va).join(" ")})${xs(o.params)}`}function wu(o,e={whitespace:!0}){if(typeof o!="object")throw dr(o,su);const t=o instanceof Map?o.entries():Object.entries(o),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,s])=>{s instanceof pn||(s=new pn(s));let a=Ss(r);return s.value===!0?a+=xs(s.params):(a+="=",Array.isArray(s.value)?a+=xu(s):a+=Va(s)),a}).join(`,${i}`)}function Cu(o,e){return wu(o,e)}function Au(o){return o==="ot"||o==="sf"||o==="st"}function Tu(o){return typeof o=="number"?k(o):o!=null&&o!==""&&o!==!1}const jn=o=>Math.round(o),Du=(o,e)=>(e!=null&&e.baseUrl&&(o=dl(o,e.baseUrl)),encodeURIComponent(o)),Wn=o=>jn(o/100)*100,Lu={br:jn,d:jn,bl:Wn,dl:Wn,mtp:Wn,nor:Du,rtp:Wn,tb:jn};function Ru(o,e){const t={};if(o==null||typeof o!="object")return t;const i=Object.keys(o).sort(),r=c({},Lu,e==null?void 0:e.formatters),s=e==null?void 0:e.filter;return i.forEach(a=>{if(s!=null&&s(a))return;let h=o[a];const _=r[a];_&&(h=_(h,e)),!(a==="v"&&h===1)&&(a=="pr"&&h===1||Tu(h)&&(Au(a)&&typeof h=="string"&&(h=new Wa(h)),t[a]=h))}),t}function qa(o,e={}){return o?Cu(Ru(o,e),c({whitespace:!1},e)):""}function ku(o,e={}){const t={};if(!o)return t;const i=Object.entries(o),r=Object.entries(nu).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=i.reduce((a,h)=>{var _,d;const[y,S]=h,B=((_=r.find($=>$[1].includes(y)))===null||_===void 0?void 0:_[0])||kn.REQUEST;return(d=a[B])!==null&&d!==void 0||(a[B]={}),a[B][y]=S,a},{});return Object.entries(s).reduce((a,[h,_])=>(a[h]=qa(_,e),a),t)}function Iu(o,e,t){return c(o,ku(e,t))}const Pu="CMCD";function Ou(o,e={}){if(!o)return"";const t=qa(o,e);return`${Pu}=${encodeURIComponent(t)}`}const Ya=/CMCD=[^&#]+/;function Fu(o,e,t){const i=Ou(e,t);if(!i)return o;if(Ya.test(o))return o.replace(Ya,i);const r=o.includes("?")?"&":"?";return`${o}${r}${i}`}class Mu{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=r=>{try{this.apply(r,{ot:Wi.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],_=this.getObjectType(s),d={d:(a||s).duration*1e3,ot:_};(_===Wi.VIDEO||_===Wi.AUDIO||_==Wi.MUXED)&&(d.br=h.bitrate/1e3,d.tb=this.getTopBandwidth(_)/1e3,d.bl=this.getBufferLength(_));const y=a?this.getNextPart(a):this.getNextFrag(s);y!=null&&y.url&&y.url!==s.url&&(d.nor=y.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(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHED,this.onMediaDetached,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHED,this.onMediaDetached,this),e.off(g.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:ru.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===Wi.INIT||t.ot===Wi.VIDEO||t.ot===Wi.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={}),Iu(e.headers,t,s)):e.url=Fu(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 _=a.length-1;_>=0;_--){const d=a[_];if(d.index===r&&d.fragment.sn===h)return a[_+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Wi.TIMED_TEXT;if(e.sn==="initSegment")return Wi.INIT;if(t==="audio")return Wi.AUDIO;if(t==="main")return this.hls.audioTracks.length?Wi.VIDEO:Wi.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===Wi.AUDIO)i=r.audioTracks;else{const s=r.maxAutoLevel,a=s>-1?s+1:r.levels.length;i=r.levels.slice(0,a)}for(const s of i)s.bitrate>t&&(t=s.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===Wi.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Ot.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 Bu=3e5;class Nu extends D{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(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.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)===mi.SendAlternateToPenaltyBox&&i.flags===Bi.MoveAllAlternatesMatchingHost){const r=this.levels;let s=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:h,pathwayId:_,type:d}=t.context;h&&r?a=this.getPathwayForGroupId(h,d,a):_&&(a=_)}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),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]>Bu&&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,_=this.hls.levels[h];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,na(t),this.hls.trigger(g.LEVELS_UPDATED,{levels:t});const d=this.hls.levels[h];_&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==_.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==_.bitrate&&this.log(`Unstable Pathways change from bitrate ${_.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":_}=s;if(t.some(y=>y.pathwayId===a))return;const d=this.getLevelsForPathway(h).map(y=>{const S=new oi(y.attrs);S["PATHWAY-ID"]=a;const B=S.AUDIO&&`${S.AUDIO}_clone_${a}`,$=S.SUBTITLES&&`${S.SUBTITLES}_clone_${a}`;B&&(i[S.AUDIO]=B,S.AUDIO=B),$&&(r[S.SUBTITLES]=$,S.SUBTITLES=$);const W=Xa(y.uri,S["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",_),Q=new Vt({attrs:S,audioCodec:y.audioCodec,bitrate:y.bitrate,height:y.height,name:y.name,url:W,videoCodec:y.videoCodec,width:y.width});if(y.audioGroups)for(let X=1;X<y.audioGroups.length;X++)Q.addGroupId("audio",`${y.audioGroups[X]}_clone_${a}`);if(y.subtitleGroups)for(let X=1;X<y.subtitleGroups.length;X++)Q.addGroupId("text",`${y.subtitleGroups[X]}_clone_${a}`);return Q});t.push(...d),Za(this.audioTracks,i,_,a),Za(this.subtitleTracks,r,_,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(y){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const y=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+y)}const s={responseType:"json",url:r.href},a=t.steeringManifestLoadPolicy.default,h=a.errorRetry||a.timeoutRetry||{},_={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:h.maxNumRetry||0,retryDelay:h.retryDelayMs||0,maxRetryDelay:h.maxRetryDelayMs||0},d={onSuccess:(y,S,B,$)=>{this.log(`Loaded steering manifest: "${r}"`);const W=y.data;if((W==null?void 0:W.VERSION)!==1){this.log(`Steering VERSION ${W.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=W.TTL;const{"RELOAD-URI":Q,"PATHWAY-CLONES":X,"PATHWAY-PRIORITY":se}=W;if(Q)try{this.uri=new self.URL(Q,r).href}catch(le){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${Q}`);return}this.scheduleRefresh(this.uri||B.url),X&&this.clonePathways(X);const fe={steeringManifest:W,url:r.toString()};this.hls.trigger(g.STEERING_MANIFEST_LOADED,fe),se&&this.updatePathwayPriority(se)},onError:(y,S,B,$)=>{if(this.log(`Error loading steering manifest: ${y.code} ${y.text} (${S.url})`),this.stopLoad(),y.code===410){this.enabled=!1,this.log(`Steering manifest ${S.url} no longer available`);return}let W=this.timeToLoad*1e3;if(y.code===429){const Q=this.loader;if(typeof(Q==null?void 0:Q.getResponseHeader)=="function"){const X=Q.getResponseHeader("Retry-After");X&&(W=parseFloat(X)*1e3)}this.log(`Steering manifest ${S.url} rate limited`);return}this.scheduleRefresh(this.uri||S.url,W)},onTimeout:(y,S,B)=>{this.log(`Timeout loading steering manifest (${S.url})`),this.scheduleRefresh(this.uri||S.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(s,_,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 Za(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 oi(h.attrs),h.url=h.attrs.URI=Xa(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 Xa(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 _=new self.URL(o);return r&&!h&&(_.host=r),s&&Object.keys(s).sort().forEach(d=>{d&&_.searchParams.set(d,s[d])}),_.href}class _n extends D{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=_n.CDMCleanupPromise?[_n.CDMCleanupPromise]:[],this.onMediaEncrypted=t=>{const{initDataType:i,initData:r}=t,s=`"${t.type}" event: init data type: "${i}"`;if(this.debug(s),r!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=pt(this.config));const h=a.map(Yr).filter(_=>!!_);this.keyFormatPromise=this.getKeyFormatPromise(h)}this.keyFormatPromise.then(a=>{const h=Lr(a);let _,d;if(i==="sinf"){if(h!==jt.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${h}`);return}const W=ut(new Uint8Array(r));try{const Q=$i(JSON.parse(W).sinf),X=Se(Q);if(!X)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");_=new Uint8Array(X.subarray(8,24)),d=jt.FAIRPLAY}catch(Q){this.warn(`${s} Failed to parse sinf: ${Q}`);return}}else{if(h!==jt.WIDEVINE&&h!==jt.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${h}`);return}const W=It(r),Q=W.filter(se=>!!se.systemId&&qr(se.systemId)===h);Q.length>1&&this.warn(`${s} Using first of ${Q.length} pssh found for selected key-system ${h}`);const X=Q[0];if(!X){W.length===0||W.some(se=>!se.systemId)?this.warn(`${s} contains incomplete or invalid pssh data`):this.log(`ignoring ${s} for ${W.map(se=>qr(se.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(d=qr(X.systemId),X.version===0&&X.data)if(d===jt.WIDEVINE){const se=X.data.length-22;_=new Uint8Array(X.data.subarray(se,se+16))}else d===jt.PLAYREADY&&(_=Zr(X.data))}if(!d||!_)return;const y=ee.hexDump(_),{keyIdToKeySessionPromise:S,mediaKeySessions:B}=this;let $=S[y];for(let W=0;W<B.length;W++){const Q=B[W],X=Q.decryptdata;if(!X.keyId)continue;const se=ee.hexDump(X.keyId);if(y===se||X.uri.replace(/-/g,"").indexOf(y)!==-1){if($=S[se],X.pssh)break;delete S[se],X.pssh=new Uint8Array(r),X.keyId=_,$=S[y]=$.then(()=>this.generateRequestWithPreferredKeySession(Q,i,r,"encrypted-event-key-match")),$.catch(fe=>this.handleError(fe));break}}if(!$){if(d!==h){this.log(`Ignoring "${t.type}" event with ${d} init data for selected key-system ${h}`);return}$=S[y]=this.getKeySystemSelectionPromise([d]).then(({keySystem:W,mediaKeys:Q})=>{var X;this.throwIfDestroyed();const se=new Ir("ISO-23001-7",y,(X=Yr(W))!=null?X:"");return se.pssh=new Uint8Array(r),se.keyId=_,this.attemptSetMediaKeys(W,Q).then(()=>{this.throwIfDestroyed();const fe=this.createMediaKeySessionContext({decryptdata:se,keySystem:W,mediaKeys:Q});return this.generateRequestWithPreferredKeySession(fe,i,r,"encrypted-event-no-match")})}),$.catch(W=>this.handleError(W))}})}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){const e=this.media;this.unregisterListeners(),this.onMediaDetached(),this._clear(e);const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(g.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(g.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(g.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(g.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(g.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===jt.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,_)=>!!a&&_.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 _=d=>{const y=d.shift();this.getMediaKeysPromise(y,r,s).then(S=>a({keySystem:y,mediaKeys:S})).catch(S=>{d.length?_(d):S instanceof ir?h(S):h(new ir({type:T.KEY_SYSTEM_ERROR,details:x.KEY_SYSTEM_NO_ACCESS,error:S,fatal:!0},S.message))})};_(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return Tt===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=hi(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(_=>{this.log(`Failed to obtain access to key-system "${e}": ${_}`)}),a.then(_=>{this.log(`Access for key-system "${_.keySystem}" obtained`);const d=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),h.mediaKeys=_.createMediaKeys().then(y=>(this.log(`Media-keys created for "${e}"`),d.then(S=>S?this.setMediaKeysServerCertificate(y,e,S):y))),h.mediaKeys.catch(y=>{this.error(`Failed to create media-keys for "${e}"}: ${y}`)}),h.mediaKeys})}return a.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${ee.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 ee.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${ee.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
|
|
|
} (data length: ${t&&t.byteLength})`),r.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const r=pt(this.config),s=e.map(Lr).filter(a=>!!a&&r.indexOf(a)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:a})=>{const h=Yr(a);h?t(h):i(new Error(`Unable to find format for key-system "${a}"`))}).catch(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:_})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(h,_).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:h,mediaKeys:_,decryptdata:t}))))),(this.keyIdToKeySessionPromise[i]=s.then(h=>{const _="cenc",d=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(h,_,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 ir?this.hls.trigger(g.ERROR,e.data):this.hls.trigger(g.ERROR,{type:T.KEY_SYSTEM_ERROR,details:x.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Lr(e.keyFormat),s=r?[r]:pt(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=pt(this.config)),e.length===0)throw new ir({type:T.KEY_SYSTEM_ERROR,details:x.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){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(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 W=h.call(this.hls,t,i,e);if(!W)throw new Error("Invalid response from configured generateRequest filter");t=W.initDataType,i=W.initData?W.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(W){var _;if(this.warn(W.message),(_=this.hls)!=null&&_.config.debug)throw W}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 y=new ns,S=e._onmessage=W=>{const Q=e.mediaKeysSession;if(!Q){y.emit("error",new Error("invalid state"));return}const{messageType:X,message:se}=W;this.log(`"${X}" message event for session "${Q.sessionId}" message size: ${se.byteLength}`),X==="license-request"||X==="license-renewal"?this.renewLicense(e,se).catch(fe=>{y.eventNames().length?y.emit("error",fe):this.handleError(fe)}):X==="license-release"?e.keySystem===jt.FAIRPLAY&&(this.updateKeySession(e,Vr("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${X}"`)},B=e._onkeystatuseschange=W=>{if(!e.mediaKeysSession){y.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const X=e.keyStatus;y.emit("keyStatus",X),X==="expired"&&(this.warn(`${e.keySystem} expired for key ${d}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",S),e.mediaKeysSession.addEventListener("keystatuseschange",B);const $=new Promise((W,Q)=>{y.on("error",Q),y.on("keyStatus",X=>{X.startsWith("usable")?W():X==="output-restricted"?Q(new ir({type:T.KEY_SYSTEM_ERROR,details:x.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):X==="internal-error"?Q(new ir({type:T.KEY_SYSTEM_ERROR,details:x.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 W;this.log(`Request generated for key-session "${(W=e.mediaKeysSession)==null?void 0:W.sessionId}" keyId: ${d}`)}).catch(W=>{throw new ir({type:T.KEY_SYSTEM_ERROR,details:x.KEY_SYSTEM_NO_SESSION,error:W,fatal:!1},`Error generating key-session request: ${W}`)}).then(()=>$).catch(W=>{throw y.removeAllListeners(),this.removeSession(e),W}).then(()=>(y.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: ${ee.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${ee.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 _={responseType:"arraybuffer",url:s},d=t.certLoadPolicy.default,y={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(B,$,W,Q)=>{a(B.data)},onError:(B,$,W,Q)=>{h(new ir({type:T.KEY_SYSTEM_ERROR,details:x.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:W,response:u({url:_.url,data:void 0},B)},`"${e}" certificate request failed (${s}). Status: ${B.code} (${B.text})`))},onTimeout:(B,$,W)=>{h(new ir({type:T.KEY_SYSTEM_ERROR,details:x.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:W,response:{url:_.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(B,$,W)=>{h(new Error("aborted"))}};r.load(_,y,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 ir({type:T.KEY_SYSTEM_ERROR,details:x.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 ir({type:T.KEY_SYSTEM_ERROR,details:x.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 y;for(let S=0,B=s.length;S<B;S++){var a,h;y=s[S];const $=(a=y.querySelector("name"))==null?void 0:a.textContent,W=(h=y.querySelector("value"))==null?void 0:h.textContent;$&&W&&e.setRequestHeader($,W)}}const _=r.querySelector("Challenge"),d=_==null?void 0:_.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return Vr(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 _=h.response;this.log(`License received ${_ instanceof ArrayBuffer?_.byteLength:_}`);const d=this.config.licenseResponseCallback;if(d)try{_=d.call(this.hls,h,a,e)}catch(y){this.error(y)}r(_)}else{const _=i.errorRetry,d=_?_.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||h.status>=400&&h.status<500)s(new ir({type:T.KEY_SYSTEM_ERROR,details:x.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 y=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${y} 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:_,licenseChallenge:d})=>{e.keySystem==jt.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(_,d)),_.send(d)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null)}_clear(e){var t;const i=this.mediaKeySessions;this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ir.clearKeyUriToKeyIdMap();const r=i.length;_n.CDMCleanupPromise=Promise.all(i.map(s=>this.removeSession(s)).concat(e==null||(t=e.setMediaKeys(null))==null?void 0:t.catch(s=>{var a;this.log(`Could not clear media keys: ${s}`),(a=this.hls)==null||a.trigger(g.ERROR,{type:T.OTHER_ERROR,details:x.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).then(()=>{r&&(this.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(s=>{var a;this.log(`Could not close sessions and clear media keys: ${s}`),(a=this.hls)==null||a.trigger(g.ERROR,{type:T.OTHER_ERROR,details:x.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((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(pi(s)?new Promise((h,_)=>{self.setTimeout(()=>_(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(h)}):Promise.resolve()).catch(h=>{var _;this.log(`Could not remove session: ${h}`),(_=this.hls)==null||_.trigger(g.ERROR,{type:T.OTHER_ERROR,details:x.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${h}`)})}).then(()=>t.close()).catch(h=>{var _;this.log(`Could not close session: ${h}`),(_=this.hls)==null||_.trigger(g.ERROR,{type:T.OTHER_ERROR,details:x.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${h}`)})})}}}_n.CDMCleanupPromise=void 0;class ir extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}class Uu{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(g.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(g.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,_=1e3*a/s,d=this.hls;if(d.trigger(g.FPS_DROP,{currentDropped:a,currentDecoded:h,totalDroppedFrames:i}),_>0&&a>d.config.fpsDroppedMonitoringThreshold*h){let y=d.currentLevel;d.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+y),y>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=y)&&(y=y-1,d.trigger(g.FPS_DROP_LEVEL_CAPPING,{level:y,droppedLevel:d.currentLevel}),d.autoLevelCapping=y,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 Qa(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 Ja(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 gn(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 ws(o,e,t,i){const r=o.mode;if(r==="disabled"&&(o.mode="hidden"),o.cues&&o.cues.length>0){const s=$u(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 Hu(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 $u(o,e,t){const i=[],r=Hu(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 Gn(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 ju extends ms{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=Gn(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(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(g.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;Gn(i.textTracks).forEach(a=>{gn(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(y=>!i||i.indexOf(y.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(y=>y.default)&&(this.selectDefaultTrack=!1),a.forEach((y,S)=>{y.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 y=qt(h,a);if(y>-1)s=a[y];else{const S=qt(h,this.tracks);s=this.tracks[S]}}let _=this.findTrackId(s);_===-1&&s&&(_=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(g.SUBTITLE_TRACKS_UPDATED,d),_!==-1&&this.trackId===-1&&this.setSubtitleTrack(_)}}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||Ci(s,e)))return r}if(e){for(let r=0;r<t.length;r++){const s=t[r];if(Rn(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const s=t[r];if(Rn(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(vs(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&&Ci(e,i))return i;const r=qt(e,this.tracksInGroup);if(r>-1){const s=this.tracksInGroup[r];return this.setSubtitleTrack(r),s}else{if(i)return null;{const s=qt(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(g.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Gn(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(s=>vs(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(g.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:_,type:d,url:y}=r;this.hls.trigger(g.SUBTITLE_TRACK_SWITCH,{id:a,groupId:h,name:_,type:d,url:y});const S=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(S)}}function In(o){let e=5381,t=o.length;for(;t;)e=e*33^o.charCodeAt(--t);return(e>>>0).toString()}const mn=.025;let Kn=function(o){return o[o.Point=0]="Point",o[o.Range=1]="Range",o}({});function Wu(o,e,t){return`${o.identifier}-${t+1}-${In(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){if(e>=this.assetList.length)return!0;const t=this.playoutLimit;return e<=0||isNaN(t)?!1:this.assetList[e].startOffset>t}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Cs(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=Cs(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 Cs(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)<mn))}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"?Kn.Range:Kn.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 Cs(o,e){return o-e.start<e.duration/2&&!(Math.abs(o-(e.start+e.duration))<mn)?e.start:e.start+e.duration}function eo(o,e,t){const i=new self.URL(o,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function Ku(o){return`["${o.identifier}" ${o.cue.pre?"<pre>":o.cue.post?"<post>":""}${o.timelineStart.toFixed(2)}-${o.resumeTime.toFixed(2)}]`}function As(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=()=>{const d=this.interstitial.playoutLimit,y=this.currentTime;this.startOffset+y>=d&&this.hls.trigger(g.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=i,this.assetItem=r;let a=r.uri;try{a=eo(a,s.sessionId).href}catch(_){}s.loadSource(a);const h=()=>{this.hasDetails=!0};s.once(g.LEVEL_LOADED,h),s.once(g.AUDIO_TRACK_LOADED,h),s.once(g.SUBTITLE_TRACK_LOADED,h),s.on(g.MEDIA_ATTACHING,(_,{media:d})=>{this.removeMediaListeners(),this.mediaAttached=d,this.interstitial.playoutLimit&&d.addEventListener("timeupdate",this.checkPlayout)})}bufferedInPlaceToEnd(e){var t;if(!this.interstitial.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const i=this.timelineOffset,r=Ot.bufferInfo(e,i,0);return this.getAssetTime(r.end)>=this._bufferedEosTime-.02}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=Ot.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;return e||0}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}on(e,t,i){this.hls.on(e,t)}once(e,t,i){this.hls.once(e,t)}off(e,t,i){this.hls.off(e,t)}toString(){var e,t;return`HlsAssetPlayer: ${As(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${(t=this.interstitial)!=null&&t.appendInPlace?"append-in-place":""}`}}const to=.033;class Vu extends D{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),_=s?s.filter(d=>!h.includes(d.identifier)):[];a.length&&a.sort((d,y)=>{const S=d.cue.pre,B=d.cue.post,$=y.cue.pre,W=y.cue.post;if(S&&!$)return-1;if($&&!S||B&&!W)return 1;if(W&&!B)return-1;if(!S&&!$&&!B&&!W){const Q=d.startTime,X=y.startTime;if(Q!==X)return Q-X}return d.dateRange.tagOrder-y.dateRange.tagOrder}),this.events=a,_.forEach(d=>{this.removeEvent(d)}),this.updateSchedule(e,_)}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,_)=>Math.abs(h.playout.start-r[_].playout.start)>.005||Math.abs(h.playout.end-r[_].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],_=e[h];if(_.isInterstitial){let d=this.eventMap[h];d?d.setDateRange(_):(d=new Gu(_,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(_=>!_.error&&!(_.cue.once&&_.hasPlayed)),e.length){this.resolveOffsets(e,t);let _=0,d=0;if(e.forEach((y,S)=>{const B=y.cue.pre,$=y.cue.post,W=e[S-1]||null,Q=y.appendInPlace,X=$?s:y.startOffset,se=y.duration,fe=y.timelineOccupancy===Kn.Range?se:0,le=y.resumptionOffset,we=(W==null?void 0:W.startTime)===X,Ae=X+y.cumulativeDuration;let He=Q?Ae+se:X+le;if(B||!$&&X<=0){const Fe=d;d+=fe,y.timelineStart=Ae;const $e=a;a+=se,i.push({event:y,start:Ae,end:He,playout:{start:$e,end:a},integrated:{start:Fe,end:d}})}else if(X<=s){if(!we){const Le=X-_;if(Le>to){const Je=_,lt=d;d+=Le;const Gt=a;a+=Le;const Dt={previousEvent:e[S-1]||null,nextEvent:y,start:Je,end:Je+Le,playout:{start:Gt,end:a},integrated:{start:lt,end:d}};i.push(Dt)}else Le>0&&W&&(W.cumulativeDuration+=Le,i[i.length-1].end=X)}$&&(He=Ae),y.timelineStart=Ae;const Fe=d;d+=fe;const $e=a;a+=se,i.push({event:y,start:Ae,end:He,playout:{start:$e,end:a},integrated:{start:Fe,end:d}})}else return;const Te=y.resumeTime;$||Te>s?_=s:_=Te}),_<s){var h;const y=_,S=d,B=s-_;d+=B;const $=a;a+=B,i.push({previousEvent:((h=i[i.length-1])==null?void 0:h.event)||null,nextEvent:null,start:_,end:y+B,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,_)=>{const d=h.cue.pre,y=h.cue.post,S=d?0:y?r:h.startTime;this.updateAssetDurations(h),a===S?h.cumulativeDuration=s:(s=0,a=S),!y&&h.snapOptions.in&&(h.resumeAnchor=zi(null,i.fragments,h.startOffset+h.resumptionOffset,0,0)||void 0),h.appendInPlace&&!h.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(h,t)||(h.appendInPlace=!1)),!h.appendInPlace&&_+1<e.length&&e[_+1].startTime-e[_].resumeTime<to&&(e[_+1].appendInPlace=!1,e[_+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)>mn?(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,_=h.edge;if(i>=_)return this.log(`"${e.identifier}" resumption ${i} past ${a} playlist end ${_}`),!1;const d=zi(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 y=a==="audio"?.175:0;return Math.abs(d.start-i)<mn+y||Math.abs(d.end-i)<mn+y?!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 _=t+i;a.startOffset=i,a.timelineStart=_,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 Fr(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=eo(i,this.hls.sessionId,e.baseUrl)}catch(B){const $=this.assignAssetListError(e,x.ASSET_LIST_LOAD_ERROR,B,i);this.hls.trigger(g.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),_={responseType:"json",url:r.href},d=s.interstitialAssetListLoadPolicy.default,y={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(B,$,W,Q)=>{const X=B.data,se=X==null?void 0:X.ASSETS;if(!Array.isArray(se)){const fe=this.assignAssetListError(e,x.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),W.url,$,Q);this.hls.trigger(g.ERROR,fe);return}e.assetListResponse=X,this.hls.trigger(g.ASSET_LIST_LOADED,{event:e,assetListResponse:X,networkDetails:Q})},onError:(B,$,W,Q)=>{const X=this.assignAssetListError(e,x.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${B.code} ${B.text} (${$.url})`),$.url,Q,W);this.hls.trigger(g.ERROR,X)},onTimeout:(B,$,W)=>{const Q=this.assignAssetListError(e,x.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${$.url})`),$.url,B,W);this.hls.trigger(g.ERROR,Q)}};return h.load(_,y,S),this.hls.trigger(g.ASSET_LIST_LOADING,{event:e}),h}assignAssetListError(e,t,i,r,s,a){return e.error=i,{type:T.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:i,networkDetails:a,stats:s}}}function xr(o,e,t){pr(o,e,t),o.addEventListener(e,t)}function pr(o,e,t){o.removeEventListener(e,t)}function io(o){o==null||o.play().catch(()=>{})}class Yu extends D{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 _;const B=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(h)&&(_=this.media)!=null&&_.paused&&(this.shouldPlay=!1),!a){const $=this.findItemIndex(h);if(B>$){const W=this.schedule.findJumpRestrictedIndex($+1,B);if(W>$){this.setSchedulePosition(W);return}}}this.setSchedulePosition(B);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(h)){const B=h.event.assetList[0];B&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,B))}return}const y=d.timelineStart,S=d.duration||0;(a&&i<y||i>=y+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||[],_=s.items||[],d=s.durations,y=i.map($=>$.identifier),S=!!(h.length||y.length);if(S&&this.log(`INTERSTITIALS_UPDATED (${h.length}): ${h}
|
|
|
Schedule: ${_.map($=>Fr($))}`),y.length&&this.log(`Removed events ${y}`),this.playerQueue.forEach($=>{if($.interstitial.appendInPlace){const W=$.assetItem.timelineStart,Q=$.timelineOffset-W;if(Q)try{$.timelineOffset=W}catch(X){Math.abs(Q)>mn&&this.warn(`${X} ("${$.assetId}" ${$.timelineOffset}->${W})`)}}}),a){const $=this.updateItem(a,this.timelinePos);this.itemsMatch(a,$)&&(this.playingItem=$,this.waitingItem=this.endedItem=null)}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const B=this.bufferingItem;if(B){const $=this.updateItem(B,this.bufferedPos);this.itemsMatch(B,$)?this.bufferingItem=$:B.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(B.event,null))}if(i.forEach($=>{$.assetList.forEach(W=>{this.clearAssetPlayer(W.identifier,null)})}),S||r){if(this.hls.trigger(g.INTERSTITIALS_UPDATED,{events:h.slice(0),schedule:_.slice(0),durations:d,removedIds:y}),this.isInterstitial(a)&&y.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}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(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(g.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(g.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(g.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(g.BUFFER_APPENDED,this.onBufferAppended,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(g.MEDIA_ENDED,this.onMediaEnded,this),e.on(g.ERROR,this.onError,this),e.on(g.DESTROYING,this.onDestroying,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(g.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(g.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(g.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.BUFFER_APPENDED,this.onBufferAppended,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(g.MEDIA_ENDED,this.onMediaEnded,this),e.off(g.ERROR,this.onError,this),e.off(g.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){pr(e,"play",this.onPlay),pr(e,"pause",this.onPause),pr(e,"seeking",this.onSeeking),pr(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;xr(i,"seeking",this.onSeeking),xr(i,"timeupdate",this.onTimeupdate),xr(i,"play",this.onPlay),xr(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,B,$,W,Q)=>{if(S){let X=S[B].start;const se=S.event;if(se){if(B==="playout"||se.timelineOccupancy!==Kn.Point){const fe=i($);(fe==null?void 0:fe.interstitial)===se&&(X+=fe.assetItem.startOffset+fe[Q])}}else{const fe=W==="bufferedPos"?a():e[W];X+=fe-S.start}return X}return 0},s=(S,B)=>{if(S!==0&&B!=="primary"&&e.schedule.length){var $;const W=e.schedule.findItemIndexAtTime(S),Q=($=e.schedule.items)==null?void 0:$[W];if(Q){const X=Q[B].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 B;return(B=e.primaryDetails)!=null&&B.live?e.primaryDetails.edge:e.schedule.durations[S]},_=(S,B)=>{var $,W;const Q=e.effectivePlayingItem;if(Q!=null&&($=Q.event)!=null&&$.restrictions.skip)return;e.log(`seek to ${S} "${B}"`);const X=e.effectivePlayingItem,se=e.schedule.findItemIndexAtTime(S,B),fe=(W=e.schedule.items)==null?void 0:W[se],le=e.getBufferingPlayer(),we=le==null?void 0:le.interstitial,Ae=we==null?void 0:we.appendInPlace,He=X&&e.itemsMatch(X,fe);if(X&&(Ae||He)){const Fe=i(e.playingAsset),$e=(Fe==null?void 0:Fe.media)||e.primaryMedia;if($e){const Le=B==="primary"?$e.currentTime:r(X,B,e.playingAsset,"timelinePos","currentTime"),Je=S-Le,lt=(Ae?Le:$e.currentTime)+Je;if(lt>=0&&(!Fe||Ae||lt<=Fe.duration)){$e.currentTime=lt;return}}}if(fe){let Fe=S;if(B!=="primary"){const Le=fe[B].start,Je=S-Le;Fe=fe.start+Je}const $e=!e.isInterstitial(fe);if((!e.isInterstitial(X)||X.event.appendInPlace)&&($e||fe.event.appendInPlace)){const Le=e.media||(Ae?le==null?void 0:le.media:null);Le&&(Le.currentTime=Fe)}else if(X){const Le=e.findItemIndex(X);if(se>Le){const lt=e.schedule.findJumpRestrictedIndex(Le+1,se);if(lt>Le){e.setSchedulePosition(lt);return}}let Je=0;if($e)e.timelinePos=Fe,e.checkBuffer();else{var Te;const lt=fe==null||(Te=fe.event)==null?void 0:Te.assetList;if(lt){const Gt=S-(fe[B]||fe).start;for(let Dt=lt.length;Dt--;){const Et=lt[Dt];if(Et.duration&&Gt>=Et.startOffset&&Gt<Et.startOffset+Et.duration){Je=Dt;break}}}}e.setSchedulePosition(se,Je)}}},d=()=>{const S=e.effectivePlayingItem;if(e.isInterstitial(S))return S;const B=t();return e.isInterstitial(B)?B:null},y={get currentTime(){const S=d(),B=e.effectivePlayingItem;return B&&B===S?r(B,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-B.playout.start:0},set currentTime(S){const B=d(),$=e.effectivePlayingItem;$&&$===B&&_(S+$.playout.start,"playout")},get duration(){const S=d();return S?S.playout.end-S.playout.start:0},get assetPlayers(){var S;const B=(S=d())==null?void 0:S.event.assetList;return B?B.map($=>e.getAssetPlayer($.identifier)):[]},get playingIndex(){var S;const B=(S=d())==null?void 0:S.event;return B&&e.effectivePlayingAsset?B.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return d()}};this.manager={get events(){var S,B;return((S=e.schedule)==null||(B=S.events)==null?void 0:B.slice(0))||[]},get schedule(){var S,B;return((S=e.schedule)==null||(B=S.items)==null?void 0:B.slice(0))||[]},get interstitialPlayer(){return d()?y: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){_(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){_(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,B=S==null?void 0:S.event;if(B&&!B.restrictions.skip){const $=e.findItemIndex(S);if(B.appendInPlace){const W=S.playout.start+S.event.duration;_(W+.001,"playout")}else e.advanceAfterAssetEnded(B,$,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,_=h&&e.interstitial.appendInPlace,d=(i=this.detachedData)==null?void 0:i.mediaSource;let y;if(a.media)_&&(s=a.transferMedia(),this.detachedData=s),y="Primary";else if(d){const $=this.getBufferingPlayer();$?(s=$.transferMedia(),y=`${$}`):y="detached MediaSource"}else y="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(W=>{if(h&&W.interstitial.appendInPlace!==_){const Q=W.interstitial;this.clearInterstitial(W.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",B=S&&s?s:t;if(this.log(`${S?"transfering MediaSource":"attaching media"} to ${h?e:"Primary"} from ${y}`),B===s){const $=h&&e.assetId===this.schedule.assetIdAtEnd;B.overrides={duration:this.schedule.duration,endOfStream:!h||$,cueRemoval:!h}}e.attachMedia(B)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,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=i+1;if(!e.isAssetPastPlayoutLimit(r)&&!e.assetList[r].error)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 _=e.resumeTime;this.timelinePos<_&&(this.timelinePos=_,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.setSchedulePosition(a,h)}}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,y=this.playingAsset,S=y==null?void 0:y.identifier,B=S?this.getAssetPlayer(S):null;if(B&&S&&(!this.eventItemsMatch(s,r)||t!==void 0&&S!==((h=d.assetList)==null?void 0:h[t].identifier))){var _;const $=d.findAssetIndex(y);this.log(`INTERSTITIAL_ASSET_ENDED ${$+1}/${d.assetList.length} ${As(y)}`),this.endedAsset=y,this.playingAsset=null,this.hls.trigger(g.INTERSTITIAL_ASSET_ENDED,{asset:y,assetListIndex:$,event:d,schedule:i.slice(0),scheduleIndex:e,player:B}),this.retreiveMediaSource(S,r),B.media&&!((_=this.detachedData)!=null&&_.mediaSource)&&B.detachMedia()}if(!this.eventItemsMatch(s,r)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${d} ${Fr(s)}`),d.hasPlayed=!0,this.hls.trigger(g.INTERSTITIAL_ENDED,{event:d,schedule:i.slice(0),scheduleIndex:e}),d.cue.once)){this.updateSchedule();const $=this.schedule.items;if(r&&$){const W=this.schedule.findItemIndex(r);this.advanceSchedule(W,$,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,_=this.playerQueue;if(_.length&&_.forEach(d=>{const y=d.interstitial,S=this.schedule.findEventIndex(y.identifier);(S<e||S>e+1)&&this.clearInterstitial(y,a)}),this.isInterstitial(a)){this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);const d=a.event;i===void 0&&(i=this.schedule.findAssetIndex(d,this.timelinePos));const y=this.waitingItem;this.assetsBuffered(a,h)||this.setBufferingItem(a);let S=this.preloadAssets(d,i);if(this.eventItemsMatch(a,y||r)||(this.waitingItem=a,this.log(`INTERSTITIAL_STARTED ${Fr(a)} ${d.appendInPlace?"append in place":""}`),this.hls.trigger(g.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 B=d.assetList[i];if(!B){const $=t[e+1],W=this.media;$&&W&&!this.isInterstitial($)&&W.currentTime<$.start&&(W.currentTime=this.timelinePos=$.start),this.advanceAfterAssetEnded(d,e,i||0);return}if(S||(S=this.getAssetPlayer(B.identifier)),S===null||S.destroyed){const $=d.assetList.length;this.warn(`asset ${i+1}/${$} player destroyed ${d}`),S=this.createAssetPlayer(d,B,i)}if(!this.eventItemsMatch(a,this.bufferingItem)&&d.appendInPlace&&this.isAssetBuffered(B))return;this.startAssetPlayer(S,i,t,e,h),this.shouldPlay&&io(S.media)}else a!==null?(this.resumePrimary(a,e,r),this.shouldPlay&&io(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 ${Fr(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(`resumed ${Fr(e)}`),this.hls.trigger(g.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:Ot.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(g.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(g.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=ui(t);this.playerQueue.forEach(r=>r.hls.setAudioOption(t)||r.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,t){const i=ui(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}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=Ot.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 _=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var d,y;const S=this.findItemIndex(s),B=Math.min(S+1,t.length-1),$=t[B];if((_===-1&&s&&e>=s.end||(d=$.event)!=null&&d.appendInPlace&&e+.01>=$.start)&&(_=B),B-h>1&&(s==null||(y=s.event)==null?void 0:y.appendInPlace)===!1)return;if(this.bufferedPos=e,_>S&&_>h)this.bufferedToItem($);else{const W=this.primaryDetails;this.primaryLive&&W&&e>W.edge-W.targetduration&&$.start<W.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial($)&&this.preloadAssets($.event,0)}}else i&&a&&!this.itemsMatch(a,s)&&(_===h?this.bufferedToItem(a):_===h+1&&this.bufferedToItem(t[_]))}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();if(this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos)),!this.playbackDisabled){const _=h?h.remaining:t?t.end-this.timelinePos:0;this.log(`buffered to boundary ${Fr(e)}`+(t?` (${_.toFixed(2)} remaining)`:"")),a?e.event.assetList.forEach(d=>{const y=this.getAssetPlayer(d.identifier);y&&y.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering()))}this.hls.trigger(g.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],_=this.primaryMedia;h&&_&&this.bufferAssetPlayer(a,_)}}}preloadAssets(e,t){const i=e.assetUrl,r=e.assetList.length,s=r===0&&!e.assetListLoader,a=e.cue.once;if(s){const _=e.timelineStart;if(e.appendInPlace){var h;const B=this.playingItem;!this.isInterstitial(B)&&(B==null||(h=B.nextEvent)==null?void 0:h.identifier)===e.identifier&&this.flushFrontBuffer(_+.25)}let d,y=0;if(!this.playingItem&&this.primaryLive&&(y=this.hls.startPosition,y===-1&&(y=this.hls.liveSyncPosition||0)),y&&!(e.cue.pre||e.cue.post)){const B=y-_;B>0&&(d=Math.round(B*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:r} ${e}${d?` live-start: ${y} start-offset: ${d}`:""}`),i)return this.createAsset(e,0,0,_,e.duration,i);const S=this.assetListLoader.loadAssetList(e,d);S&&(e.assetListLoader=S)}else if(!a&&r){for(let _=t;_<r;_++){const d=e.assetList[_],y=this.getAssetPlayerQueueIndex(d.identifier);(y===-1||this.playerQueue[y].destroyed)&&!d.error&&this.createAssetPlayer(e,d,_)}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(g.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){this.log(`create HLSAssetPlayer for ${As(t)}`);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 _=r.audioTracks[r.audioTrack],d=r.subtitleTracks[r.subtitleTrack];let y=0;if(this.primaryLive||e.appendInPlace){const le=this.timelinePos-t.timelineStart;if(le>1){const we=t.duration;we&&le<we&&(y=le)}}const S=t.identifier,B=u(u({},s),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:S,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:y,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:_||s.audioPreference,subtitlePreference:d||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(B.timelineOffset=t.timelineStart));const $=B.cmcd;$!=null&&$.sessionId&&$.contentId&&(B.cmcd=c({},$,{contentId:In(t.uri)})),this.getAssetPlayer(S)&&this.warn(`Duplicate date range identifier ${e} and asset ${S}`);const W=new zu(this.HlsPlayerClass,B,e,t);this.playerQueue.push(W),e.assetList[i]=t;const Q=le=>{if(le.live){const He=new Error(`Interstitials MUST be VOD assets ${e}`),Te={fatal:!0,type:T.OTHER_ERROR,details:x.INTERSTITIAL_ASSET_ITEM_ERROR,error:He};this.handleAssetItemError(Te,e,this.schedule.findEventIndex(e.identifier),i,He.message);return}const we=le.edge-le.fragmentStart,Ae=t.duration;(Ae===null||we>Ae)&&(this.log(`Interstitial asset "${S}" duration change ${Ae} > ${we}`),t.duration=we,this.updateSchedule())};W.on(g.LEVEL_UPDATED,(le,{details:we})=>Q(we)),W.on(g.LEVEL_PTS_UPDATED,(le,{details:we})=>Q(we));const X=(le,we)=>{const Ae=this.getAssetPlayer(S);if(Ae&&we.tracks){Ae.off(g.BUFFER_CODECS,X),Ae.tracks=we.tracks;const He=this.primaryMedia;this.bufferingAsset===Ae.assetItem&&He&&!Ae.media&&this.bufferAssetPlayer(Ae,He)}};W.on(g.BUFFER_CODECS,X);const se=()=>{var le;const we=this.getAssetPlayer(S);if(this.log(`buffered to end of asset ${we}`),!we)return;const Ae=this.schedule.findEventIndex(e.identifier),He=e.findAssetIndex(t),Te=He+1,Fe=(le=this.schedule.items)==null?void 0:le[Ae];if(this.isInterstitial(Fe))if(He!==-1&&!e.isAssetPastPlayoutLimit(Te)&&!e.assetList[Te].error)this.bufferedToItem(Fe,Te);else{var $e;const Le=($e=this.schedule.items)==null?void 0:$e[Ae+1];Le&&this.bufferedToItem(Le)}};W.on(g.BUFFERED_TO_END,se);const fe=le=>()=>{if(!this.getAssetPlayer(S))return;this.shouldPlay=!0;const Ae=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,Ae,le)};return W.once(g.MEDIA_ENDED,fe(i)),W.once(g.PLAYOUT_LIMIT_REACHED,fe(1/0)),W.on(g.ERROR,(le,we)=>{const Ae=this.getAssetPlayer(S);if(we.details===x.BUFFER_STALLED_ERROR){if(Ae!=null&&Ae.media){const He=Ae.currentTime,Te=Ae.duration-He;He&&e.appendInPlace&&Te/Ae.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${S} ${e} at ${Ae.media.currentTime}`),se()):(this.warn(`Stalled at ${He} of ${He+Te} in asset ${S} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(we,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${we.error} ${e}`)}),W.on(g.DESTROYING,()=>{if(!this.getAssetPlayer(S))return;const we=new Error(`Asset player destroyed unexpectedly ${S}`),Ae={fatal:!0,type:T.OTHER_ERROR,details:x.INTERSTITIAL_ASSET_ITEM_ERROR,error:we};this.handleAssetItemError(Ae,e,this.schedule.findEventIndex(e.identifier),i,we.message)}),this.hls.trigger(g.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:W}),W}clearInterstitial(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)}),e.reset()}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){this.log(`clearAssetPlayer "${e}" toSegment: ${t&&Fr(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:_}=e,d=a.assetList.length,y=this.playingAsset;this.endedAsset=null,this.playingAsset=h,(!y||y.identifier!==_)&&(y&&(this.clearAssetPlayer(y.identifier,i[r]),delete y.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${d} ${e}`),this.hls.trigger(g.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,assetId:h}=e,_=this.schedule.findEventIndex(s.identifier),d=(i=this.schedule.items)==null?void 0:i[_];if(!d)return;this.setBufferingItem(d),this.bufferingAsset=a;const y=this.getBufferingPlayer();if(y===e)return;const S=s.appendInPlace;if(S&&(y==null?void 0:y.interstitial.appendInPlace)===!1)return;const B=(y==null?void 0:y.tracks)||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(S&&a!==this.playingAsset){if(!e.tracks)return;if(B&&!ne(B,e.tracks)){const $=new Error(`Asset "${h}" SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(B)}')`),W={fatal:!0,type:T.OTHER_ERROR,details:x.INTERSTITIAL_ASSET_ITEM_ERROR,error:$},Q=s.findAssetIndex(a);this.handleAssetItemError(W,s,_,Q,$.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,r,s){if(e.details===x.BUFFER_STALLED_ERROR)return;const a=t.assetList[r]||null;let h=null;if(a){const S=this.getAssetPlayerQueueIndex(a.identifier);h=this.playerQueue[S]||null}const _=this.schedule.items,d=c({},e,{fatal:!1,errorAction:Ji(!0),asset:a,assetListIndex:r,event:t,schedule:_,scheduleIndex:i,player:h});if(this.warn(`Asset item error: ${e.error}`),this.hls.trigger(g.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const y=new Error(s);a&&(this.playingAsset!==a&&this.clearAssetPlayer(a.identifier,null),a.error=y),t.assetList.some(S=>!S.error)?t.appendInPlace&&(t.error=y):t.error=y,this.primaryFallback(t)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(this.updateSchedule(),i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${i?Fr(i):"<none>"} error: ${e.error}`),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));let r=this.timelinePos;r===-1&&(r=this.hls.startPosition);const s=this.updateItem(i,r);if(this.itemsMatch(i,s))this.clearInterstitial(e,null);else{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,_=r.duration;let d=0;a.forEach((W,Q)=>{const X=parseFloat(W.DURATION);this.createAsset(r,Q,d,h+d,X,W.URI),d+=X}),r.duration=d,this.log(`Loaded asset-list with duration: ${d} (was: ${_}) ${r}`);const y=this.waitingItem,S=(y==null?void 0:y.event.identifier)===s;this.updateSchedule();const B=(i=this.bufferingItem)==null?void 0:i.event;if(S){var $;const W=this.schedule.findEventIndex(s),Q=($=this.schedule.items)==null?void 0:$[W];if(Q){if(!this.playingItem&&this.timelinePos>Q.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==W){r.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${r}`),this.primaryFallback(r);return}this.setBufferingItem(Q)}this.setSchedulePosition(W)}else if((B==null?void 0:B.identifier)===s&&B.appendInPlace){const W=r.assetList[0],Q=this.getAssetPlayer(W.identifier),X=this.primaryMedia;W&&Q&&X&&this.bufferAssetPlayer(Q,X)}}onError(e,t){switch(t.details){case x.ASSET_LIST_PARSING_ERROR:case x.ASSET_LIST_LOAD_ERROR:case x.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&this.primaryFallback(i);break}case x.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const ro=500;class Zu extends is{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(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(g.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(g.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=Ge.IDLE,this.setInterval(ro),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(ie(i)&&(this.fragPrevious=i),this.state=Ge.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 _=i.start+i.duration;a?a.end=_:(a={start:h,end:_},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===x.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ge.STOPPED&&(this.state=Ge.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Ua(this.levels,t)){this.levels=t.map(i=>new Vt(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new Vt(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!==Ge.STOPPED&&this.setInterval(ro)}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 _=s[h];if(h>=s.length||!_)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=_.details)!=null&&i.live){const S=this.mainDetails;if(a.deltaUpdateFailed||!S)return;const B=S.fragments[0];if(!_.details)a.hasProgramDateTime&&S.hasProgramDateTime?(Fn(a,S),d=a.fragmentStart):B&&(d=B.start,ts(a,d));else{var y;d=this.alignPlaylists(a,_.details,(y=this.levelLastLoaded)==null?void 0:y.details),d===0&&B&&(d=B.start,ts(a,d))}}_.details=a,this.levelLastLoaded=_,h===r&&(this.hls.trigger(g.SUBTITLE_TRACK_UPDATED,{details:a,id:h,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===Ge.IDLE&&(zi(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),_.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,br(r.method)).catch(h=>{throw s.trigger(g.ERROR,{type:T.MEDIA_ERROR,details:x.FRAG_DECRYPT_ERROR,fatal:!1,error:h,reason:h.message,frag:t}),h}).then(h=>{const _=performance.now();s.trigger(g.FRAG_DECRYPTED,{frag:t,payload:h,stats:{tstart:a,tdecrypt:_}})}).catch(h=>{this.warn(`${h.name}: ${h.message}`),this.state=Ge.IDLE})}}doTick(){if(!this.media){this.state=Ge.IDLE;return}if(this.state===Ge.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=Ot.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,r.maxBufferHole),{end:h,len:_}=a,d=i.details,y=this.hls.maxBufferLength+d.levelTargetDuration;if(_>y)return;const S=d.fragments,B=S.length,$=d.edge;let W=null;const Q=this.fragPrevious;if(h<$){const fe=r.maxFragLookUpTolerance,le=h>$-fe?0:fe;W=zi(Q,S,Math.max(S[0].start,h),le),!W&&Q&&Q.start<S[0].start&&(W=S[0])}else W=S[B-1];if(W=this.filterReplacedPrimary(W,i.details),!W)return;const X=W.sn-d.startSN,se=S[X-1];if(se&&se.cc===W.cc&&this.fragmentTracker.getState(se)===di.NOT_LOADED&&(W=se),this.fragmentTracker.getState(W)===di.NOT_LOADED){const fe=this.mapToInitFragWhenRequired(W);fe&&this.loadFragment(fe,i,h)}}}loadFragment(e,t,i){ie(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},no=o=>String.fromCharCode(Qu[o]||o),sr=15,wr=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 Xr=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class so{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 so}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 so,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<wr;t++)this.chars.push(new sc);this.logger=e}equals(e){for(let t=0;t<wr;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<wr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<wr;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>wr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=wr)}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=no(e);if(this.pos>=wr){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<wr;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<wr;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 Ts{constructor(e){this.rows=[],this.currRow=sr-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<sr;t++)this.rows.push(new ac(e));this.logger=e}reset(){for(let e=0;e<sr;e++)this.rows[e].clear();this.currRow=sr-1}equals(e){let t=!0;for(let i=0;i<sr;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<sr;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<sr;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<sr;h++)this.rows[h].clear();const s=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const h=a.rows[s].cueStartTime,_=this.logger.time;if(h!==null&&_!==null&&h<_)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<sr;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 ao{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 Ts(i),this.nonDisplayedMemory=new Ts(i),this.lastOutputScreen=new Ts(i),this.currRollUpRow=this.displayedMemory.rows[sr-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[sr-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 oo{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 ao(e,t,r),new ao(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,()=>"["+Xr([t[i],t[i+1]])+"] -> ("+Xr([r,s])+")");const _=this.cmdHistory;if(r>=16&&r<=31){if(oc(r,s,_)){zn(null,null,_),this.logger.log(3,()=>"Repeated command ("+Xr([r,s])+") is dropped");continue}zn(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 zn(null,null,_);if(!a&&(h=this.parseChars(r,s),h)){const y=this.currentChannel;y&&y>0?this.channels[y].insertChars(h):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!h&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Xr([r,s])+" orig: "+Xr([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 ("+Xr([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 '"+no(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 = "+Xr(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()}zn(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 zn(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 Ds=function(){if(Yi!=null&&Yi.VTTCue)return self.VTTCue;const o=["","lr","rl"],e=["start","middle","end","left","right"];function t(h,_){if(typeof _!="string"||!Array.isArray(h))return!1;const d=_.toLowerCase();return~h.indexOf(d)?d:!1}function i(h){return t(o,h)}function r(h){return t(e,h)}function s(h,..._){let d=1;for(;d<arguments.length;d++){const y=arguments[d];for(const S in y)h[S]=y[S]}return h}function a(h,_,d){const y=this,S={enumerable:!0};y.hasBeenReset=!1;let B="",$=!1,W=h,Q=_,X=d,se=null,fe="",le=!0,we="auto",Ae="start",He=50,Te="middle",Fe=50,$e="middle";Object.defineProperty(y,"id",s({},S,{get:function(){return B},set:function(Le){B=""+Le}})),Object.defineProperty(y,"pauseOnExit",s({},S,{get:function(){return $},set:function(Le){$=!!Le}})),Object.defineProperty(y,"startTime",s({},S,{get:function(){return W},set:function(Le){if(typeof Le!="number")throw new TypeError("Start time must be set to a number.");W=Le,this.hasBeenReset=!0}})),Object.defineProperty(y,"endTime",s({},S,{get:function(){return Q},set:function(Le){if(typeof Le!="number")throw new TypeError("End time must be set to a number.");Q=Le,this.hasBeenReset=!0}})),Object.defineProperty(y,"text",s({},S,{get:function(){return X},set:function(Le){X=""+Le,this.hasBeenReset=!0}})),Object.defineProperty(y,"region",s({},S,{get:function(){return se},set:function(Le){se=Le,this.hasBeenReset=!0}})),Object.defineProperty(y,"vertical",s({},S,{get:function(){return fe},set:function(Le){const Je=i(Le);if(Je===!1)throw new SyntaxError("An invalid or illegal string was specified.");fe=Je,this.hasBeenReset=!0}})),Object.defineProperty(y,"snapToLines",s({},S,{get:function(){return le},set:function(Le){le=!!Le,this.hasBeenReset=!0}})),Object.defineProperty(y,"line",s({},S,{get:function(){return we},set:function(Le){if(typeof Le!="number"&&Le!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");we=Le,this.hasBeenReset=!0}})),Object.defineProperty(y,"lineAlign",s({},S,{get:function(){return Ae},set:function(Le){const Je=r(Le);if(!Je)throw new SyntaxError("An invalid or illegal string was specified.");Ae=Je,this.hasBeenReset=!0}})),Object.defineProperty(y,"position",s({},S,{get:function(){return He},set:function(Le){if(Le<0||Le>100)throw new Error("Position must be between 0 and 100.");He=Le,this.hasBeenReset=!0}})),Object.defineProperty(y,"positionAlign",s({},S,{get:function(){return Te},set:function(Le){const Je=r(Le);if(!Je)throw new SyntaxError("An invalid or illegal string was specified.");Te=Je,this.hasBeenReset=!0}})),Object.defineProperty(y,"size",s({},S,{get:function(){return Fe},set:function(Le){if(Le<0||Le>100)throw new Error("Size must be between 0 and 100.");Fe=Le,this.hasBeenReset=!0}})),Object.defineProperty(y,"align",s({},S,{get:function(){return $e},set:function(Le){const Je=r(Le);if(!Je)throw new SyntaxError("An invalid or illegal string was specified.");$e=Je,this.hasBeenReset=!0}})),y.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 lo(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 uo(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],_=a[1];e(h,_)}}const Ls=new Ds(0,0,""),Vn=Ls.align==="middle"?"middle":"center";function hc(o,e,t){const i=o;function r(){const h=lo(o);if(h===null)throw new Error("Malformed timestamp: "+i);return o=o.replace(/^[^\sa-zA-Z-]+/,""),h}function s(h,_){const d=new cc;uo(h,function(B,$){let W;switch(B){case"region":for(let Q=t.length-1;Q>=0;Q--)if(t[Q].id===$){d.set(B,t[Q].region);break}break;case"vertical":d.alt(B,$,["rl","lr"]);break;case"line":W=$.split(","),d.integer(B,W[0]),d.percent(B,W[0])&&d.set("snapToLines",!1),d.alt(B,W[0],["auto"]),W.length===2&&d.alt("lineAlign",W[1],["start",Vn,"end"]);break;case"position":W=$.split(","),d.percent(B,W[0]),W.length===2&&d.alt("positionAlign",W[1],["start",Vn,"end","line-left","line-right","auto"]);break;case"size":d.percent(B,$);break;case"align":d.alt(B,$,["start",Vn,"end","left","right"]);break}},/:/,/\s/),_.region=d.get("region",null),_.vertical=d.get("vertical","");let y=d.get("line","auto");y==="auto"&&Ls.line===-1&&(y=-1),_.line=y,_.lineAlign=d.get("lineAlign","start"),_.snapToLines=d.get("snapToLines",!0),_.size=d.get("size",100),_.align=d.get("align",Vn);let S=d.get("position","auto");S==="auto"&&Ls.position===50&&(S=_.align==="start"||_.align==="left"?0:_.align==="end"||_.align==="right"?100:50),_.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 co(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=co(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){uo(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 Ds(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,Rs=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 ks(o,e,t){return In(o.toString())+In(e.toString())+In(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,_=ce(new Uint8Array(o)).trim().replace(dc,`
|
|
|
`).split(`
|
|
|
`),d=[],y=e?Hl(e.baseTime,e.timescale):0;let S="00:00.000",B=0,$=0,W,Q=!0;h.oncue=function(X){const se=t[i];let fe=t.ccOffset;const le=(B-y)/9e4;if(se!=null&&se.new&&($!==void 0?fe=t.ccOffset=se.start:_c(t,i,le)),le){if(!e){W=new Error("Missing initPTS for VTT MPEGTS");return}fe=le-t.presentationOffset}const we=X.endTime-X.startTime,Ae=tr((X.startTime+fe-$)*9e4,r*9e4)/9e4;X.startTime=Math.max(Ae,0),X.endTime=Math.max(Ae+we,0);const He=X.text.trim();X.text=decodeURIComponent(encodeURIComponent(He)),X.id||(X.id=ks(X.startTime,X.endTime,He)),X.endTime>0&&d.push(X)},h.onparsingerror=function(X){W=X},h.onflush=function(){if(W){a(W);return}s(d)},_.forEach(X=>{if(Q)if(Rs(X,"X-TIMESTAMP-MAP=")){Q=!1,X.slice(16).split(",").forEach(se=>{Rs(se,"LOCAL:")?S=se.slice(6):Rs(se,"MPEGTS:")&&(B=parseInt(se.slice(7)))});try{$=pc(S)/1e3}catch(se){W=se}return}else X===""&&(Q=!1);h.parse(X+`
|
|
|
`)}),h.flush()}const Is="stpp.ttml.im1t",ho=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,fo=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,mc={left:"start",center:"center",right:"end",start:"start",end:"end"};function po(o,e,t,i){const r=de(new Uint8Array(o),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const s=r.map(h=>ce(h)),a=Ul(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,B)=>(S[B]=r.getAttribute(`ttp:${B}`)||s[B],S),{}),h=r.getAttribute("xml:space")!=="preserve",_=_o(Ps(r,"styling","style")),d=_o(Ps(r,"layout","region")),y=Ps(r,"body","[begin]");return[].map.call(y,S=>{const B=go(S,h);if(!B||!S.hasAttribute("begin"))return null;const $=Fs(S.getAttribute("begin"),a),W=Fs(S.getAttribute("dur"),a);let Q=Fs(S.getAttribute("end"),a);if($===null)throw mo(S);if(Q===null){if(W===null)throw mo(S);Q=$+W}const X=new Ds($-e,Q-e,B);X.id=ks(X.startTime,X.endTime,X.text);const se=d[S.getAttribute("region")],fe=_[S.getAttribute("style")],le=yc(se,fe,_),{textAlign:we}=le;if(we){const Ae=mc[we];Ae&&(X.lineAlign=Ae),X.align=we}return c(X,le),X}).filter(S=>S!==null)}function Ps(o,e,t){const i=o.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function _o(o){return o.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function go(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?go(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,_)=>{const d=Os(e,i,_)||Os(o,i,_)||Os(r,i,_);return d&&(h[_]=d),h},{})}function Os(o,e,t){return o&&o.hasAttributeNS(e,t)?o.getAttributeNS(e,t):null}function mo(o){return new Error(`Could not parse ttml timestamp ${o}`)}function Fs(o,e){if(!o)return null;let t=lo(o);return t===null&&(ho.test(o)?t=bc(o,e):fo.test(o)&&(t=Ec(o,e))),t}function bc(o,e){const t=ho.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=fo.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 qn{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=bo(),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(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this),e.on(g.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(g.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(g.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this),e.off(g.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(g.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(g.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new qn(this,"textTrack1"),t=new qn(this,"textTrack2"),i=new qn(this,"textTrack3"),r=new qn(this,"textTrack4");this.cea608Parser1=new oo(1,e,t),this.cea608Parser2=new oo(3,i,r)}addCues(e,t,i,r,s){let a=!1;for(let h=s.length;h--;){const _=s[h],d=xc(_[0],_[1],t,i);if(d>=0&&(_[0]=Math.min(_[0],t),_[1]=Math.max(_[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(g.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.onFragLoaded(g.FRAG_LOADED,h)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){const s=i.textTracks[r];if(yo(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,gn(i[e]),Qa(i[e],r);else{const _=this.createTextTrack("captions",s,a);_&&(_[e]=!0,i[e]=_)}}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(g.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=>{gn(r[s]),delete r[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=bo(),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++)gn(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(s=>s.textCodec===Is);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(Ua(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const a=this.media,h=a?Gn(a.textTracks):null;if(this.tracks.forEach((_,d)=>{let y;if(h){let S=null;for(let B=0;B<h.length;B++)if(h[B]&&yo(h[B],_)){S=h[B],h[B]=null;break}S&&(y=S)}if(y)gn(y);else{const S=vo(_);y=this.createTextTrack(S,_.name,_.lang),y&&(y.mode="disabled")}y&&this.textTracks.push(y)}),h!=null&&h.length){const _=h.filter(d=>d!==null).map(d=>d.label);_.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${_.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(g.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:_,sn:d}=t.frag,y=(i=(r=t.part)==null?void 0:r.index)!=null?i:-1;s&&a&&(d!==h+1||d===h&&y!==this.lastPartIndex+1||_!==this.lastCc)&&(s.reset(),a.reset()),this.lastCc=_,this.lastSn=d,this.lastPartIndex=y}}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],_=this.vttCCs;_[i.cc]||(_[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),h&&h.textCodec===Is?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;po(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{i.logger.log(`Failed to parse IMSC1: ${r}`),i.trigger(g.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 _=this.hls,d=(t=i.initSegment)!=null&&t.data?Xe(i.initSegment.data,new Uint8Array(r)).buffer:r;gc(d,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,y=>{this._appendCues(y,i.level),_.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},y=>{const S=y.message==="Missing initPTS for VTT MPEGTS";S?a.push(e):this._fallbackToIMSC1(i,r),_.logger.log(`Failed to parse VTT cue: ${y}`),!(S&&h>i.cc)&&_.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:y})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||po(t,this.initPTS[e.cc],()=>{i.textCodec=Is,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=>Ja(r,s))}else{const r=this.tracks[t];if(!r)return;const s=r.default?"default":"subtitles"+t;i.trigger(g.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===m.SUBTITLE&&this.onFragLoaded(g.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(_=>ws(h[_],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:h}=this;Object.keys(h).forEach(_=>ws(h[_],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++],_=127&e[r++];if(h===0&&_===0)continue;if((4&a)!==0){const y=3&a;(y===0||y===1)&&(t[y].push(h),t[y].push(_))}}return t}}function vo(o){return o.characteristics&&/transcribes-spoken-dialog/gi.test(o.characteristics)&&/describes-music-and-sound/gi.test(o.characteristics)?"captions":"subtitles"}function yo(o,e){return!!o&&o.kind===vo(e)&&vs(e,o)}function xc(o,e,t,i){return Math.min(e,i)-Math.max(o,t)}function bo(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const wc=/\s/,Cc={newCue(o,e,t,i){const r=[];let s,a,h,_,d;const y=self.VTTCue||self.TextTrackCue;for(let B=0;B<i.rows.length;B++)if(s=i.rows[B],h=!0,_=0,d="",!s.isEmpty()){var S;for(let Q=0;Q<s.chars.length;Q++)wc.test(s.chars[Q].uchar)&&h?_++:(d+=s.chars[Q].uchar,h=!1);s.cueStartTime=e,e===t&&(t+=1e-4),_>=16?_--:_++;const $=co(d.trim()),W=ks(e,t,$);o!=null&&(S=o.cues)!=null&&S.getCueById(W)||(a=new y(e,t,$),a.id=W,a.line=B+1,a.align="left",a.position=10+Math.min(80,Math.floor(_*8/32)*10),r.push(a))}return o&&r.length&&(r.sort((B,$)=>B.line==="auto"||$.line==="auto"?0:B.line>8&&$.line>8?$.line-B.line:B.line-$.line),r.forEach(B=>Ja(o,B))),r}};function Ac(){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 Eo{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 R}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:_,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=_&&k(_)?_:d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(Ln(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(S=>{var B;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 W=(B=this.callbacks)==null?void 0:B.onProgress;return W&&k(t.highWaterMark)?this.loadProgressively(S,r,e,t.highWaterMark,W):a?S.arrayBuffer():e.responseType==="json"?S.json():S.text()}).then(S=>{var B,$;const W=this.response;if(!W)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:W.url,data:S,code:W.status},se=(B=this.callbacks)==null?void 0:B.onProgress;se&&!k(t.highWaterMark)&&se(r,e,S,W),($=this.callbacks)==null||$.onSuccess(X,r,e,W)}).catch(S=>{var B;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const $=S&&S.code||0,W=S?S.message:null;(B=this.callbacks)==null||B.onError({code:$,text:W},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 ua,h=e.body.getReader(),_=()=>h.read().then(d=>{if(d.done)return a.dataLength&&s(t,i,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const y=d.value,S=y.length;return t.loaded+=S,S<r||a.dataLength?(a.push(y),a.dataLength>=r&&s(t,i,a.flush().buffer,e)):s(t,i,y.buffer,e),_()}).catch(()=>Promise.reject());return _()}}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 So{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 R,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,y=t.responseType==="text"?t.responseText:null;if(d>=200&&d<300){const W=y!=null?y:t.response;if(W!=null){var a,h;i.loading.end=Math.max(self.performance.now(),i.loading.first);const Q=t.responseType==="arraybuffer"?W.byteLength:W.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,W,t);const se={url:t.responseURL,data:W,code:d};(h=this.callbacks)==null||h.onSuccess(se,i,e,t);return}}const S=s.loadPolicy.errorRetry,B=i.retry,$={url:e.url,data:void 0,code:d};if(or(S,B,!1,$))this.retry(S);else{var _;F.error(`${d} while loading ${e.url}`),(_=this.callbacks)==null||_.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(or(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=Ii(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,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:So,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Si,bufferController:tu,capLevelController:bs,errorController:Ur,fpsController:Uu,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Tt,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,certLoadPolicy:{default:Oc},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Mc()),{},{subtitleStreamController:Zu,subtitleTrackController:ju,timelineController:Sc,audioStreamController:Xl,audioTrackController:Ql,emeController:_n,cmcdController:Mu,contentSteeringController:Nu,interstitialsController:Yu});function Mc(){return{cueHandler:Cc,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=Ms(o),r=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(a=>{const h=`${a==="level"?"playlist":a}LoadPolicy`,_=e[h]===void 0,d=[];s.forEach(y=>{const S=`${a}Loading${y}`,B=e[S];if(B!==void 0&&_){d.push(S);const $=i[h].default;switch(e[h]={default:$},y){case"TimeOut":$.maxLoadTimeMs=B,$.maxTimeToFirstByteMs=B;break;case"MaxRetry":$.errorRetry.maxNumRetry=B,$.timeoutRetry.maxNumRetry=B;break;case"RetryDelay":$.errorRetry.retryDelayMs=B,$.timeoutRetry.retryDelayMs=B;break;case"MaxRetryTimeout":$.errorRetry.maxRetryDelayMs=B,$.timeoutRetry.maxRetryDelayMs=B;break}}}),d.length&&t.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${h}": ${At(e[h])}`)}),u(u({},i),e)}function Ms(o){return o&&typeof o=="object"?Array.isArray(o)?o.map(Ms):Object.keys(o).reduce((e,t)=>(e[t]=Ms(o[t]),e),{}):o}function Nc(o,e){const t=o.loader;t!==Eo&&t!==So?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),o.progressive=!1):Ac()&&(o.loader=Eo,o.progressive=!0,o.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Yn=2,Uc=.1,Hc=.05,$c=100;class jc extends Wr{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(g.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.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;xr(i,"playing",this.onMediaPlaying),xr(i,"waiting",this.onMediaWaiting),xr(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(pr(i,"playing",this.onMediaPlaying),pr(i,"waiting",this.onMediaWaiting),pr(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{media:a,stalled:h}=this;if(!a)return;const{seeking:_}=a,d=this.seeking&&!_,y=!this.seeking&&_,S=a.paused&&!_||a.ended||a.playbackRate===0;if(this.seeking=_,e!==t){t&&(this.ended=0),this.moved=!0,_||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!S&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(y||d){d&&this.stallResolved(e);return}if(S){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(g.MEDIA_ENDED,{stalled:!1}));return}if(!Ot.getBuffered(a).length){this.nudgeRetry=0;return}const B=Ot.bufferInfo(a,e,0),$=B.nextStart||0,W=this.fragmentTracker;if(_&&W&&this.hls){const He=xo(this.hls.inFlightFragments,e),Te=B.len>Yn,Fe=!$||He||$-e>Yn&&!W.getPartialFragment(e);if(Te||Fe)return;this.moved=!1}const Q=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&W){if(!(B.len>0)&&!$)return;const Te=Math.max($,B.start||0)-e,$e=!!(Q!=null&&Q.live)?Q.targetduration*2:Yn,Le=W.getPartialFragment(e);if(Te>0&&(Te<=$e||Le)){a.paused||this._trySkipBufferHole(Le);return}}const X=s.detectStallWithCurrentTimeMs,se=self.performance.now(),fe=this.waiting;if(h===null){fe>0&&se-fe<X?this.stalled=fe:this.stalled=se;return}const le=se-h;if(!_&&(le>=X||fe)&&this.hls){var we;if(((we=this.mediaSource)==null?void 0:we.readyState)==="ended"&&!(Q!=null&&Q.live)&&Math.abs(e-((Q==null?void 0:Q.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(g.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(B),!this.media||!this.hls)return}const Ae=Ot.bufferInfo(a,e,s.maxBufferHole);this._tryFixBufferStall(Ae,le)}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(g.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=Ot.bufferedInfo(Ot.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const a=Ot.timeRangesToArray(r),h=Ot.bufferedInfo(a,t,0).bufferedIndex;if(h>-1&&h<a.length-1){const _=Ot.bufferedInfo(a,e,0).bufferedIndex,d=a[h].end,y=a[h+1].start;if((_===-1||_>h)&&y-d<1&&e-d<2){const S=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${y} buffered index: ${_}`);this.warn(S.message),this.media.currentTime+=1e-6;const B=this.fragmentTracker.getPartialFragment(e)||void 0,$=Ot.bufferInfo(this.media,e,0);this.hls.trigger(g.ERROR,{type:T.MEDIA_ERROR,details:x.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:S,reason:S.message,frag:B,buffer:$.len,bufferInfo:$})}}}}}_tryFixBufferStall(e,t){var i,r;const{fragmentTracker:s,media:a}=this,h=(i=this.hls)==null?void 0:i.config;if(!a||!s||!h)return;const _=a.currentTime,d=(r=this.hls)==null?void 0:r.latestLevelDetails,y=s.getPartialFragment(_);if((y||d!=null&&d.live&&_<d.fragmentStart)&&(this._trySkipBufferHole(y)||!this.media))return;const S=e.buffered;(S&&S.length>1&&e.len>h.maxBufferHole||e.nextStart&&e.nextStart-_<h.maxBufferHole)&&(t>h.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}_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(g.ERROR,{type:T.MEDIA_ERROR,details:x.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=Ot.bufferInfo(r,a,0),_=a<h.start?h.start:h.nextStart;if(_&&this.hls){const y=h.len<=s.maxBufferHole,S=h.len>0&&h.len<1&&r.readyState<3,B=_-a;if(B>0&&(y||S)){if(B>s.maxBufferHole){let W=!1;if(a===0){const Q=i.getAppendedFrag(0,m.MAIN);Q&&_<Q.end&&(W=!0)}if(!W){const Q=e||i.getAppendedFrag(a,m.MAIN);if(Q){var d;if(!((d=this.hls.loadLevelObj)!=null&&d.details)||xo(this.hls.inFlightFragments,_))return 0;let se=!1,fe=Q.end;for(;fe<_;){const le=i.getPartialFragment(fe);if(le)fe+=le.duration;else{se=!0;break}}if(se)return 0}}}const $=Math.max(_+Hc,a+Uc);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${$}`),this.moved=!0,r.currentTime=$,!(e!=null&&e.gap)){const W=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${$}`);this.hls.trigger(g.ERROR,{type:T.MEDIA_ERROR,details:x.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:W,reason:W.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,_=new Error(`Nudging 'currentTime' from ${a} to ${h}`);this.warn(_.message),i.currentTime=h,t.trigger(g.ERROR,{type:T.MEDIA_ERROR,details:x.BUFFER_NUDGE_ON_STALL,error:_,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(g.ERROR,{type:T.MEDIA_ERROR,details:x.BUFFER_STALLED_ERROR,error:h,fatal:!0,buffer:e.len,bufferInfo:e})}}}function xo(o,e){const t=wo(o.main);if(t&&t.start<=e)return t;const i=wo(o.audio);return i&&i.start<=e?i:null}function wo(o){if(!o)return null;switch(o.state){case Ge.IDLE:case Ge.STOPPED:case Ge.ENDED:case Ge.ERROR:return null}return o.frag}const Wc=.25;function Bs(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Co(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 Zn=(()=>{const o=Bs();try{o&&new o(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Gc(o){return Uint8Array.from(o.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Kc{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(g.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(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.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&&gn(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 Qa(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=Bs();if(a)for(let h=0;h<s.length;h++){const _=s[h].type;if(_===Zi.emsg&&!i||!r)continue;const d=va(s[h].data);if(d){const y=s[h].pts;let S=y+s[h].duration;S>Zn&&(S=Zn),S-y<=0&&(S=y+Wc);for(let $=0;$<d.length;$++){const W=d[$];if(!ya(W)){this.updateId3CueEnds(y,_);const Q=Co(a,y,S,W,_);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===Zn&&(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:_}}=a;if(s&&(h||_)){let d;r==="audio"?d=y=>y.type===Zi.audioId3&&_:r==="video"?d=y=>y.type===Zi.emsg&&h:d=y=>y.type===Zi.audioId3&&_||y.type===Zi.emsg&&h,ws(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 y=Object.keys(a).filter(S=>!s.includes(S));for(let S=y.length;S--;){const B=y[S],$=a[B].cues;delete a[B],Object.keys($).forEach(W=>{try{const Q=$[W];Q.removeEventListener("enter",this.onEventCueEnter),i.removeCue(Q)}catch(Q){}})}}else a=this.dateRangeCuesAppended={}}const _=e.fragments[e.fragments.length-1];if(s.length===0||!k(_==null?void 0:_.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const d=Bs();for(let y=0;y<s.length;y++){const S=s[y],B=r[S],$=B.startTime,W=a[S],Q=(W==null?void 0:W.cues)||{};let X=(W==null?void 0:W.durationKnown)||!1,se=Zn;const{duration:fe,endDate:le}=B;if(le&&fe!==null)se=$+fe,X=!0;else if(B.endOnNext&&!X){const Ae=s.reduce((He,Te)=>{if(Te!==B.id){const Fe=r[Te];if(Fe.class===B.class&&Fe.startDate>B.startDate&&(!He||B.startDate<He.startDate))return Fe}return He},null);Ae&&(se=Ae.startTime,X=!0)}const we=Object.keys(B.attr);for(let Ae=0;Ae<we.length;Ae++){const He=we[Ae];if(!an(He))continue;const Te=Q[He];if(Te)X&&!W.durationKnown?Te.endTime=se:Math.abs(Te.startTime-$)>.01&&(Te.startTime=$,Te.endTime=se);else if(d){let Fe=B.attr[He];Sn(He)&&(Fe=Gc(Fe));const Le=Co(d,$,se,{key:He,data:Fe},Zi.dateRange);Le&&(Le.id=S,this.id3Track.addCue(Le),Q[He]=Le,this.hls.config.interstitialsController&&(He==="X-ASSET-LIST"||He==="X-ASSET-URL")&&Le.addEventListener("enter",this.onEventCueEnter))}}a[S]={cues:Q,dateRange:B,durationKnown:X}}}}class zc{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 _=r-h,d=Math.min(this.maxLatency,h+i.targetduration);if(_<d&&_>.05&&this.forwardBufferLength>1){const S=Math.min(2,Math.max(1,a)),B=Math.round(2/(1+Math.exp(-.75*_-this.edgeStalled))*20)/20,$=Math.min(S,Math.max(1,B));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,_=this.hls.userConfig;let d=h&&i||t;(this._targetLatencyUpdated||_.liveSyncDuration||_.liveSyncDurationCount||d===0)&&(d=s!==void 0?s:a*r);const y=r;return d+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,y)}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(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.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===x.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 Vc extends ms{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(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.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,_=!1,d=!1;t.levels.forEach(y=>{var S;const B=y.attrs;let{audioCodec:$,videoCodec:W}=y;$&&(y.audioCodec=$=Ke($,i)||void 0),((S=W)==null?void 0:S.indexOf("avc1"))===0&&(W=y.videoCodec=Pt(W));const{width:Q,height:X,unknownCodecs:se}=y;let fe=se?se.length:0;if(se)for(let Je=fe;Je--;){const lt=se[Je];this.isAudioSupported(lt)?(y.audioCodec=$=$?`${$},${lt}`:lt,fe--,dt.audio[$.substring(0,4)]=2):this.isVideoSupported(lt)&&(y.videoCodec=W=W?`${W},${lt}`:lt,fe--,dt.video[W.substring(0,4)]=2)}if(h||(h=!!(Q&&X)),_||(_=!!W),d||(d=!!$),fe||$&&!this.isAudioSupported($)||W&&!this.isVideoSupported(W)){this.log(`Some or all CODECS not supported "${B.CODECS}"`);return}const{CODECS:le,"FRAME-RATE":we,"HDCP-LEVEL":Ae,"PATHWAY-ID":He,RESOLUTION:Te,"VIDEO-RANGE":Fe}=B,Le=`${`${He||"."}-`}${y.bitrate}-${Te}-${we}-${le}-${Fe}-${Ae}`;if(s[Le])if(s[Le].uri!==y.url&&!y.attrs["PATHWAY-ID"]){const Je=a[Le]+=1;y.attrs["PATHWAY-ID"]=new Array(Je+1).join(".");const lt=this.createLevel(y);s[Le]=lt,r.push(lt)}else s[Le].addGroupId("audio",B.AUDIO),s[Le].addGroupId("text",B.SUBTITLES);else{const Je=this.createLevel(y);s[Le]=Je,a[Le]=1,r.push(Je)}}),this.filterAndSortMediaOptions(r,t,h,_,d)}createLevel(e){const t=new Vt(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=_i(r,[])}return t}isAudioSupported(e){return ge(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return ge(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,r,s){let a=[],h=[],_=e;if((i||r)&&s&&(_=_.filter(({videoCodec:X,videoRange:se,width:fe,height:le})=>(!!X||!!(fe&&le))&&Ti(se))),_.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(le=>le.attrs.CODECS).filter((le,we,Ae)=>Ae.indexOf(le)===we))}`,this.warn(se),X+=` (${se})`);const fe=new Error(X);this.hls.trigger(g.ERROR,{type:T.MEDIA_ERROR,details:x.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:fe,reason:se})}});return}t.audioTracks&&(a=t.audioTracks.filter(X=>!X.audioCodec||this.isAudioSupported(X.audioCodec)),Ao(a)),t.subtitles&&(h=t.subtitles,Ao(h));const d=_.slice(0);_.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 ai.indexOf(X.videoRange)-ai.indexOf(se.videoRange);if(X.videoCodec!==se.videoCodec){const fe=re(X.videoCodec),le=re(se.videoCodec);if(fe!==le)return le-fe}if(X.uri===se.uri&&X.codecSet!==se.codecSet){const fe=ae(X.codecSet),le=ae(se.codecSet);if(fe!==le)return le-fe}return X.averageBitrate!==se.averageBitrate?X.averageBitrate-se.averageBitrate:0});let y=d[0];if(this.steering&&(_=this.steering.filterParsedLevels(_),_.length!==d.length)){for(let X=0;X<d.length;X++)if(d[X].pathwayId===_[0].pathwayId){y=d[X];break}}this._levels=_;for(let X=0;X<_.length;X++)if(_[X]===y){var S;this._firstLevel=X;const se=y.bitrate,fe=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${_.length} level(s) found, first bitrate: ${se}`),((S=this.hls.userConfig)==null?void 0:S.abrEwmaDefaultEstimate)===void 0){const le=Math.min(se,this.hls.config.abrEwmaDefaultEstimateMax);le>fe&&fe===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=le)}break}const B=s&&!r,$=this.hls.config,W=!!($.audioStreamController&&$.audioTrackController),Q={levels:_,audioTracks:a,subtitleTracks:h,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:r,altAudio:W&&!B&&a.some(X=>!!X.url)};this.hls.trigger(g.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 y=new Error("invalid level idx"),S=e<0;if(this.hls.trigger(g.ERROR,{type:T.OTHER_ERROR,details:x.LEVEL_SWITCH_ERROR,level:e,fatal:S,error:y,reason:y.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 _={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(g.LEVEL_SWITCHING,_);const d=a.details;if(!d||d.live){const y=this.switchParams(a.uri,r==null?void 0:r.details,d);this.loadPlaylist(y)}}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 _=a.details;_===t.details&&_.advanced&&(_=void 0),this.playlistLoaded(r,t,_)}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(g.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));na(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(g.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(g.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Ao(o){const e={};o.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function To(){return self.SourceBuffer||self.WebKitSourceBuffer}function Do(){if(!q())return!1;const e=To();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function qc(){if(!Do())return!1;const o=q();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(te(e,"video")))||["mp4a.40.2","fLaC"].some(e=>o.isTypeSupported(te(e,"audio"))))}function Yc(){var o;const e=To();return typeof(e==null||(o=e.prototype)==null?void 0:o.changeType)=="function"}const Zc=100;class Xc extends is{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(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.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(Zc),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=Ge.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Ge.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Ge.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=Ge.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Ge.IDLE;break}break}case Ge.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=Ge.IDLE}}break}this.state===Ge.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 _=this.getLevelDetails();if(_&&this._streamEnded(h,_)){const Q={};this.altAudio===2&&(Q.type="video"),this.hls.trigger(g.BUFFER_EOS,Q),this.state=Ge.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===Ge.WAITING_LEVEL||this.waitForLive(a)){this.level=s,this.state=Ge.WAITING_LEVEL,this.startFragRequested=!1;return}const y=h.len,S=this.getMaxBufferLength(a.maxBitrate);if(y>=S)return;this.backtrackFragment&&this.backtrackFragment.start>h.end&&(this.backtrackFragment=null);const B=this.backtrackFragment?this.backtrackFragment.start:h.end;let $=this.getNextFragment(B,d);if(this.couldBacktrack&&!this.fragPrevious&&$&&ie($)&&this.fragmentTracker.getState($)!==di.OK){var W;const X=((W=this.backtrackFragment)!=null?W:$).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($,B)){if(!$.gap){const X=this.audioOnly&&!this.altAudio?C.AUDIO:C.VIDEO,se=(X===C.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,B))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);r===di.NOT_LOADED||r===di.PARTIAL?ie(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,_=e[h],d=this.fragLastKbps;d&&this.fragCurrent?i=this.fragCurrent.duration*_.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 _=h.maxStartPTS?h.maxStartPTS:h.start,d=h.duration,y=Math.max(a.end,_+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,d*(this.couldBacktrack?.5:.125)),d*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(y,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 Ge.KEY_LOADING:case Ge.FRAG_LOADING:case Ge.FRAG_LOADING_WAITING_RETRY:case Ge.PARSING:case Ge.PARSED:this.state=Ge.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;xr(i,"playing",this.onMediaPlaying),xr(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(pr(i,"playing",this.onMediaPlaying),pr(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(g.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&&!Yc(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==Ge.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=Ge.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r,startFragRequested:s}=this,a=t.level,h=t.details,_=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:${_}`);const d=t.levelInfo,y=this.fragCurrent;y&&(this.state===Ge.FRAG_LOADING||this.state===Ge.FRAG_LOADING_WAITING_RETRY)&&y.level!==t.level&&y.loader&&this.abortCurrentFrag();let S=0;if(h.live||(i=d.details)!=null&&i.live){var B;if(this.checkLiveUpdate(h),h.deltaUpdateFailed)return;S=this.alignPlaylists(h,d.details,(B=this.levelLastLoaded)==null?void 0:B.details)}if(d.details=h,this.levelLastLoaded=d,s||this.setStartPosition(h,S),this.hls.trigger(g.LEVEL_UPDATED,{details:h,level:a}),this.state===Ge.WAITING_LEVEL){if(this.waitForCdnTuneIn(h))return;this.state=Ge.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,_=s>=a-t.maxFragLookUpTolerance&&s<=h;if(r!==null&&i.duration>r&&(s<r||!_)){const d=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!_&&i.readyState<4||s<h-d)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${h}, reset currentTime to : ${r.toFixed(3)}`),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 _=h.details;if(!_){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const d=h.videoCodec,y=_.PTSKnown||!_.live,S=(t=i.initSegment)==null?void 0:t.data,B=this._getAudioCodec(h),$=this.transmuxer=this.transmuxer||new Ba(this.hls,m.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),W=r?r.index:-1,Q=W!==-1,X=new Tr(i.level,i.sn,i.stats.chunkCount,s.byteLength,W,Q),se=this.initPTS[i.cc];$.push(s,S,B,d,i,r,_.totalduration,y,X,se)}onAudioTrackSwitching(e,t){const i=this.hls,r=this.altAudio===2;if(gi(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(g.BUFFER_FLUSHED,()=>{var a;(a=this.hls)==null||a.trigger(g.AUDIO_TRACK_SWITCHED,t)}),i.trigger(g.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(g.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=gi(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 _=i[h];if(_.id==="main"){if(s=h,r=_,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===Ge.PARSED&&(this.state=Ge.IDLE);return}const h=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*h.total/(h.buffering.end-h.loading.first)),ie(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}const a=this.media;a&&(!this._hasEnoughToStart&&Ot.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=Ge.ERROR;return}switch(t.details){case x.FRAG_GAP:case x.FRAG_PARSING_ERROR:case x.FRAG_DECRYPT_ERROR:case x.FRAG_LOAD_ERROR:case x.FRAG_LOAD_TIMEOUT:case x.KEY_LOAD_ERROR:case x.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(m.MAIN,t);break;case x.LEVEL_LOAD_ERROR:case x.LEVEL_LOAD_TIMEOUT:case x.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ge.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===O.LEVEL&&(this.state=Ge.IDLE);break;case x.BUFFER_ADD_CODEC_ERROR:case x.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.resetLoadingState();break;case x.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case x.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=Ge.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==C.AUDIO||!this.altAudio){const i=(t===C.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=Ot.getBuffered(e),h=a.length?a.start(0):0,_=h-i,d=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);_>0&&(_<d||this.loadingParts&&_<2*((s==null?void 0:s.partTarget)||0))&&(this.log(`adjusting start position by ${_} to match buffer start`),i+=_,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=Ge.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(g.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:_,part:d,level:y}=h,{video:S,text:B,id3:$,initSegment:W}=s,{details:Q}=y,X=this.altAudio?void 0:s.audio;if(this.fragContextChanged(_)){this.fragmentTracker.removeFragment(_);return}if(this.state=Ge.PARSING,W){if(W!=null&&W.tracks){const le=_.initSegment||_;this._bufferInitSegment(y,W.tracks,le,a),r.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:le,id:i,tracks:W.tracks})}const se=W.initPTS,fe=W.timescale;k(se)&&(this.initPTS[_.cc]={baseTime:se,timescale:fe},r.trigger(g.INIT_PTS_FOUND,{frag:_,id:i,initPTS:se,timescale:fe}))}if(S&&Q){X&&S.type==="audiovideo"&&this.logMuxedErr(_);const se=Q.fragments[_.sn-1-Q.startSN],fe=_.sn===Q.startSN,le=!se||_.cc>se.cc;if(s.independent!==!1){const{startPTS:we,endPTS:Ae,startDTS:He,endDTS:Te}=S;if(d)d.elementaryStreams[S.type]={startPTS:we,endPTS:Ae,startDTS:He,endDTS:Te};else if(S.firstKeyFrame&&S.independent&&a.id===1&&!le&&(this.couldBacktrack=!0),S.dropped&&S.independent){const Fe=this.getMainFwdBufferInfo(),$e=(Fe?Fe.end:this.getLoadPosition())+this.config.maxBufferHole,Le=S.firstKeyFramePTS?S.firstKeyFramePTS:we;if(!fe&&$e<Le-this.config.maxBufferHole&&!le){this.backtrack(_);return}else le&&(_.gap=!0);_.setElementaryStreamInfo(S.type,_.start,Ae,_.start,Te,!0)}else fe&&we-(Q.appliedTimelineOffset||0)>Yn&&(_.gap=!0);_.setElementaryStreamInfo(S.type,we,Ae,He,Te),this.backtrackFragment&&(this.backtrackFragment=_),this.bufferFragmentData(S,_,d,a,fe||le)}else if(fe||le)_.gap=!0;else{this.backtrack(_);return}}if(X){const{startPTS:se,endPTS:fe,startDTS:le,endDTS:we}=X;d&&(d.elementaryStreams[C.AUDIO]={startPTS:se,endPTS:fe,startDTS:le,endDTS:we}),_.setElementaryStreamInfo(C.AUDIO,se,fe,le,we),this.bufferFragmentData(X,_,d,a)}if(Q&&$!=null&&(t=$.samples)!=null&&t.length){const se={id:i,frag:_,details:Q,samples:$.samples};r.trigger(g.FRAG_PARSING_METADATA,se)}if(Q&&B){const se={id:i,frag:_,details:Q,samples:B.samples};r.trigger(g.FRAG_PARSING_USERDATA,se)}}logMuxedErr(e){this.warn(`${ie(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,r){if(this.state!==Ge.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){let d=ot(s.codec,e.audioCodec);d==="mp4a"&&(d="mp4a.40.5");const y=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){d&&(d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5");const S=s.metadata;S&&"channelCount"in S&&(S.channelCount||1)!==1&&y.indexOf("firefox")===-1&&(d="mp4a.40.5")}d&&d.indexOf("mp4a.40.5")!==-1&&y.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(d="mp4a.40.2",this.log(`Android: force audio codec to ${d}`)),e.audioCodec&&e.audioCodec!==d&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${d}"`),s.levelCodec=d,s.id=m.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${d||""}/${e.audioCodec||""}/${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 _=Object.keys(t);if(_.length){if(this.hls.trigger(g.BUFFER_CODECS,t),!this.hls)return;_.forEach(d=>{const S=t[d].initSegment;S!=null&&S.byteLength&&this.hls.trigger(g.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=Ge.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Ot.isBuffered(e,i)?t=this.getAppendedFrag(i):Ot.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(g.FRAG_CHANGED,{frag:t}),(!r||r.level!==s)&&this.hls.trigger(g.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?zi(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 Qc{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=x.KEY_LOAD_ERROR,i,r,s){return new wi({type:T.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:r}=e;for(let s=0;s<t.length;s++){const a=t[s];if(r<=a.cc&&(i==="initSegment"||a.sn==="initSegment"||i<a.sn)){this.emeController.selectKeySystemFormat(a).then(h=>{a.setKeyFormat(h)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,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,x.KEY_LOAD_ERROR,d))}const a=s.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,x.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 _;switch((_=h.mediaKeySessionContext)==null?void 0:_.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,x.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 _={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=i.keyLoadPolicy.default,y={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(B,$,W,Q)=>{const{frag:X,keyInfo:se,url:fe}=W;if(!X.decryptdata||se!==this.keyUriToKeyInfo[fe])return h(this.createKeyLoadError(X,x.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),Q));se.decryptdata.key=X.decryptdata.key=new Uint8Array(B.data),X.keyLoader=null,se.loader=null,a({frag:X,keyInfo:se})},onError:(B,$,W,Q)=>{this.resetLoader($),h(this.createKeyLoadError(t,x.KEY_LOAD_ERROR,new Error(`HTTP Error ${B.code} loading key ${B.text}`),W,u({url:_.url,data:void 0},B)))},onTimeout:(B,$,W)=>{this.resetLoader($),h(this.createKeyLoadError(t,x.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),W))},onAbort:(B,$,W)=>{this.resetLoader($),h(this.createKeyLoadError(t,x.INTERNAL_ABORTED,new Error("key loading aborted"),W))}};s.load(_,y,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 Lo(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 Ns(o,e){let t=o.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Jc{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(g.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(g.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(g.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:_}=t;this.load({id:i,level:r,pathwayId:s,responseType:"text",type:O.LEVEL,url:a,deliveryDirectives:h,levelOrTrack:_})}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,y=r.context;if(y&&y.levelOrTrack===e.levelOrTrack&&(y.url===e.url||y.deliveryDirectives&&!e.deliveryDirectives)){y.url===e.url?d.log(`[playlist-loader]: ignore ${e.url} ongoing request`):d.log(`[playlist-loader]: ignore ${e.url} in favor of ${y.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 y=d.partTarget,S=d.targetduration;if(y&&S){const B=Math.max(y*3,S*.8)*1e3;s=c({},s,{maxTimeToFirstByteMs:Math.min(B,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(B,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},_={onSuccess:(d,y,S,B)=>{const $=this.getInternalLoader(S);this.resetInternalLoader(S.type);const W=d.data;if(W.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(d,S,new Error("no EXTM3U delimiter"),B||null,y);return}y.parsing.start=performance.now(),hr.isMediaPlaylist(W)||S.type!==O.MANIFEST?this.handleTrackOrLevelPlaylist(d,y,S,B||null,$):this.handleMasterPlaylist(d,y,S,B)},onError:(d,y,S,B)=>{this.handleNetworkError(y,S,!1,d,B)},onTimeout:(d,y,S)=>{this.handleNetworkError(y,S,!0,void 0,d)}};r.load(e,h,_)}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=Ns(e,i),_=hr.parseMasterPlaylist(a,h);if(_.playlistParsingError){this.handleManifestParsingError(e,i,_.playlistParsingError,r,t);return}const{contentSteering:d,levels:y,sessionData:S,sessionKeys:B,startTimeOffset:$,variableList:W}=_;this.variableList=W;const{AUDIO:Q=[],SUBTITLES:X,"CLOSED-CAPTIONS":se}=hr.parseMasterPlaylistMedia(a,h,_);Q.length&&!Q.some(le=>!le.url)&&y[0].audioCodec&&!y[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 oi({}),bitrate:0,url:""})),s.trigger(g.MANIFEST_LOADED,{levels:y,audioTracks:Q,subtitles:X,captions:se,contentSteering:d,url:h,stats:t,networkDetails:r,sessionData:S,sessionKeys:B,startTimeOffset:$,variableList:W})}handleTrackOrLevelPlaylist(e,t,i,r,s){const a=this.hls,{id:h,level:_,type:d}=i,y=Ns(e,i),S=k(_)?_:k(h)?h:0,B=Lo(i),$=hr.parseLevelPlaylist(e.data,y,S,B,0,this.variableList);if(d===O.MANIFEST){const W={attrs:new oi({}),bitrate:0,details:$,name:"",url:y};$.requestScheduled=t.loading.start+ea($,0),a.trigger(g.MANIFEST_LOADED,{levels:[W],audioTracks:[],url:y,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(g.ERROR,{type:T.NETWORK_ERROR,details:x.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 _=x.UNKNOWN,d=!1;const y=this.getInternalLoader(e);switch(e.type){case O.MANIFEST:_=i?x.MANIFEST_LOAD_TIMEOUT:x.MANIFEST_LOAD_ERROR,d=!0;break;case O.LEVEL:_=i?x.LEVEL_LOAD_TIMEOUT:x.LEVEL_LOAD_ERROR,d=!1;break;case O.AUDIO_TRACK:_=i?x.AUDIO_TRACK_LOAD_TIMEOUT:x.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case O.SUBTITLE_TRACK:_=i?x.SUBTITLE_TRACK_LOAD_TIMEOUT:x.SUBTITLE_LOAD_ERROR,d=!1;break}y&&this.resetInternalLoader(e.type);const S={type:T.NETWORK_ERROR,details:_,fatal:d,url:e.url,loader:y,context:e,error:h,networkDetails:t,stats:s};if(r){const B=(t==null?void 0:t.url)||e.url;S.response=u({url:B,data:void 0},r)}this.hls.trigger(g.ERROR,S)}handlePlaylistLoaded(e,t,i,r,s,a){const h=this.hls,{type:_,level:d,id:y,groupId:S,deliveryDirectives:B}=r,$=Ns(t,r),W=Lo(r),Q=typeof r.level=="number"&&W===m.MAIN?d:void 0;if(!e.fragments.length){const se=e.playlistParsingError=new Error("No Segments found in Playlist");h.trigger(g.ERROR,{type:T.NETWORK_ERROR,details:x.LEVEL_EMPTY_ERROR,fatal:!1,url:$,error:se,reason:se.message,response:t,context:r,level:Q,parent:W,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(g.ERROR,{type:T.NETWORK_ERROR,details:x.LEVEL_PARSING_ERROR,fatal:!1,url:$,error:X,reason:X.message,response:t,context:r,level:Q,parent:W,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)),_){case O.MANIFEST:case O.LEVEL:h.trigger(g.LEVEL_LOADED,{details:e,levelInfo:r.levelOrTrack||h.levels[0],level:Q||0,id:y||0,stats:i,networkDetails:s,deliveryDirectives:B,withoutMultiVariant:_===O.MANIFEST});break;case O.AUDIO_TRACK:h.trigger(g.AUDIO_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:y||0,groupId:S||"",stats:i,networkDetails:s,deliveryDirectives:B});break;case O.SUBTITLE_TRACK:h.trigger(g.SUBTITLE_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:y||0,groupId:S||"",stats:i,networkDetails:s,deliveryDirectives:B});break}}}class Mr{static get version(){return Cn}static isMSESupported(){return Do()}static isSupported(){return qc()}static getMediaSource(){return q()}static get Events(){return g}static get MetadataSchema(){return Zi}static get ErrorTypes(){return T}static get ErrorDetails(){return x}static get DefaultConfig(){return Mr.defaultConfig?Mr.defaultConfig:Fc}static set DefaultConfig(e){Mr.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 ns,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(Mr.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Nc(i,t);const{abrController:r,bufferController:s,capLevelController:a,errorController:h,fpsController:_}=i,d=new h(this),y=this.abrController=new r(this),S=new gr(this),B=i.interstitialsController,$=B?this.interstitialsController=new B(this,Mr):null,W=this.bufferController=new s(this,S),Q=this.capLevelController=new a(this),X=new _(this),se=new Jc(this),fe=i.contentSteeringController,le=fe?new fe(this):null,we=this.levelController=new Vc(this,le),Ae=new Kc(this),He=new Qc(this.config),Te=this.streamController=new Xc(this,S,He),Fe=this.gapController=new jc(this,S);Q.setStreamController(Te),X.setStreamController(Te);const $e=[se,we,Te];$&&$e.splice(1,0,$),le&&$e.splice(1,0,le),this.networkControllers=$e;const Le=[y,W,Fe,Q,X,Ae,S];this.audioTrackController=this.createController(i.audioTrackController,$e);const Je=i.audioStreamController;Je&&$e.push(this.audioStreamController=new Je(this,S,He)),this.subtitleTrackController=this.createController(i.subtitleTrackController,$e);const lt=i.subtitleStreamController;lt&&$e.push(this.subtititleStreamController=new lt(this,S,He)),this.createController(i.timelineController,Le),He.emeController=this.emeController=this.createController(i.emeController,Le),this.cmcdController=this.createController(i.cmcdController,Le),this.latencyController=this.createController(zc,Le),this.coreComponents=Le,$e.push(d);const Gt=d.onErrorOut;typeof Gt=="function"&&this.on(g.ERROR,Gt,d),this.on(g.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===g.ERROR;this.trigger(g.ERROR,{type:T.OTHER_ERROR,details:x.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(g.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(g.ERROR,{type:T.OTHER_ERROR,details:x.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(g.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(g.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(g.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,r=this._url=j.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(g.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=pl()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){ei(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=Xi(t);return Nt(e,i,navigator.mediaCapabilities)}}Mr.defaultConfig=void 0}}]);
|
|
|
}()); |