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

1 line
1.2 MiB

This file contains invisible Unicode characters!

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

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(self.webpackChunk=self.webpackChunk||[]).push([[9716],{65030:function(e,t,i){"use strict";i.d(t,{Z:function(){return q}});var n=i(33885),r=i(42978),s=i(75931),o=i(43403),a=i(92310),l=i.n(a),c=i(29301),u=i(76846),h=i(96452),d=i(6089),f=i(80402),p=i(34280),_=i(49658),g=i(59301),m=i(54476),v=i(77900),y=i(8654);function b(e){var t=e.prefixCls,i=e.align,n=e.arrow,r=e.arrowPos,s=n||{},o=s.className,a=s.content,c=r.x,u=void 0===c?0:c,h=r.y,d=void 0===h?0:h,f=g.useRef();if(!i||!i.points)return null;var p={position:"absolute"};if(!1!==i.autoArrow){var _=i.points[0],m=i.points[1],v=_[0],y=_[1],b=m[0],S=m[1];v!==b&&["t","b"].includes(v)?"t"===v?p.top=0:p.bottom=0:p.top=d,y!==S&&["l","r"].includes(y)?"l"===y?p.left=0:p.right=0:p.left=u}return g.createElement("div",{ref:f,className:l()("".concat(t,"-arrow"),o),style:p},a)}function S(e){var t=e.prefixCls,i=e.open,n=e.zIndex,r=e.mask,s=e.motion;return r?g.createElement(v.default,(0,m.Z)({},s,{motionAppear:!0,visible:i,removeOnLeave:!0}),(function(e){var i=e.className;return g.createElement("div",{style:{zIndex:n},className:l()("".concat(t,"-mask"),i)})})):null}var E=g.memo((function(e){return e.children}),(function(e,t){return t.cache}));var w=g.forwardRef((function(e,t){var i=e.popup,s=e.className,o=e.prefixCls,a=e.style,u=e.target,h=e.onVisibleChanged,d=e.open,f=e.keepDom,_=e.fresh,w=e.onClick,C=e.mask,k=e.arrow,T=e.arrowPos,A=e.align,x=e.motion,D=e.maskMotion,L=e.forceRender,R=e.getPopupContainer,I=e.autoDestroy,P=e.portal,O=e.zIndex,M=e.onMouseEnter,F=e.onMouseLeave,B=e.onPointerEnter,N=e.onPointerDownCapture,U=e.ready,H=e.offsetX,j=e.offsetY,$=e.offsetR,G=e.offsetB,z=e.onAlign,K=e.onPrepare,W=e.stretch,q=e.targetWidth,V=e.targetHeight,Y="function"==typeof i?i():i,Z=d||f,X=(null==R?void 0:R.length)>0,Q=g.useState(!R||!X),J=(0,r.Z)(Q,2),ee=J[0],te=J[1];if((0,p.Z)((function(){!ee&&X&&u&&te(!0)}),[ee,X,u]),!ee)return null;var ie="auto",ne={left:"-1000vw",top:"-1000vh",right:ie,bottom:ie};if(U||!d){var re,se=A.points,oe=A.dynamicInset||(null===(re=A._experimental)||void 0===re?void 0:re.dynamicInset),ae=oe&&"r"===se[0][1],le=oe&&"b"===se[0][0];ae?(ne.right=$,ne.left=ie):(ne.left=H,ne.right=ie),le?(ne.bottom=G,ne.top=ie):(ne.top=j,ne.bottom=ie)}var ce={};return W&&(W.includes("height")&&V?ce.height=V:W.includes("minHeight")&&V&&(ce.minHeight=V),W.includes("width")&&q?ce.width=q:W.includes("minWidth")&&q&&(ce.minWidth=q)),d||(ce.pointerEvents="none"),g.createElement(P,{open:L||Z,getContainer:R&&function(){return R(u)},autoDestroy:I},g.createElement(S,{prefixCls:o,open:d,zIndex:O,mask:C,motion:D}),g.createElement(c.Z,{onResize:z,disabled:!d},(function(e){return g.createElement(v.default,(0,m.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:L,leavedClassName:"".concat(o,"-hidden")},x,{onAppearPrepare:K,onEnterPrepare:K,visible:d,onVisibleChanged:function(e){var t;null==x||null===(t=x.onVisibleChanged)||void 0===t||t.call(x,e),h(e)}}),(function(i,r){var c=i.className,u=i.style,h=l()(o,c,s);return g.createElement("div",{ref:(0,y.sQ)(e,t,r),className:h,style:(0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)({"--arrow-x":"".concat(T.x||0,"px"),"--arrow-y":"".concat(T.y||0,"px")},ne),ce),u),{},{boxSizing:"border-box",zIndex:O},a),onMouseEnter:M,onMouseLeave:F,onPointerEnter:B,onClick:w,onPointerDownCapture:N},k&&g.createElement(b,{prefixCls:o,arrow:k,arrowPos:T,align:A}),g.createElement(E,{cache:!d&&!_},Y))}))})))}));var C=g.forwardRef((function(e,t){var i=e.children,n=e.getTriggerDOMNode,r=(0,y.Yr)(i),s=g.useCallback((function(e){(0,y.mH)(t,n?n(e):e)}),[n]),o=(0,y.x1)(s,(0,y.C4)(i));return r?g.cloneElement(i,{ref:o}):i})),k=g.createContext(null);function T(e){return e?Array.isArray(e)?e:[e]:[]}function A(e,t,i,n){return g.useMemo((function(){var r=T(null!=i?i:t),s=T(null!=n?n:t),o=new Set(r),a=new Set(s);return e&&(o.has("hover")&&(o.delete("hover"),o.add("click")),a.has("hover")&&(a.delete("hover"),a.add("click"))),[o,a]}),[e,t,i,n])}var x=i(29194);function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return i?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}function L(e,t,i,n){for(var r=i.points,s=Object.keys(e),o=0;o<s.length;o+=1){var a,l=s[o];if(D(null===(a=e[l])||void 0===a?void 0:a.points,r,n))return"".concat(t,"-placement-").concat(l)}return""}function R(e,t,i,n){return t||(i?{motionName:"".concat(e,"-").concat(i)}:n?{motionName:n}:null)}function I(e){return e.ownerDocument.defaultView}function P(e){for(var t=[],i=null==e?void 0:e.parentElement,n=["hidden","scroll","clip","auto"];i;){var r=I(i).getComputedStyle(i);[r.overflowX,r.overflowY,r.overflow].some((function(e){return n.includes(e)}))&&t.push(i),i=i.parentElement}return t}function O(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isNaN(e)?t:e}function M(e){return O(parseFloat(e),0)}function F(e,t){var i=(0,n.Z)({},e);return(t||[]).forEach((function(e){if(!(e instanceof HTMLBodyElement||e instanceof HTMLHtmlElement)){var t=I(e).getComputedStyle(e),n=t.overflow,r=t.overflowClipMargin,s=t.borderTopWidth,o=t.borderBottomWidth,a=t.borderLeftWidth,l=t.borderRightWidth,c=e.getBoundingClientRect(),u=e.offsetHeight,h=e.clientHeight,d=e.offsetWidth,f=e.clientWidth,p=M(s),_=M(o),g=M(a),m=M(l),v=O(Math.round(c.width/d*1e3)/1e3),y=O(Math.round(c.height/u*1e3)/1e3),b=(d-f-g-m)*v,S=(u-h-p-_)*y,E=p*y,w=_*y,C=g*v,k=m*v,T=0,A=0;if("clip"===n){var x=M(r);T=x*v,A=x*y}var D=c.x+C-T,L=c.y+E-A,R=D+c.width+2*T-C-k-b,P=L+c.height+2*A-E-w-S;i.left=Math.max(i.left,D),i.top=Math.max(i.top,L),i.right=Math.min(i.right,R),i.bottom=Math.min(i.bottom,P)}})),i}function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i="".concat(t),n=i.match(/^(.*)\%$/);return n?e*(parseFloat(n[1])/100):parseFloat(i)}function N(e,t){var i=t||[],n=(0,r.Z)(i,2),s=n[0],o=n[1];return[B(e.width,s),B(e.height,o)]}function U(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return[e[0],e[1]]}function H(e,t){var i,n=t[0],r=t[1];return i="t"===n?e.y:"b"===n?e.y+e.height:e.y+e.height/2,{x:"l"===r?e.x:"r"===r?e.x+e.width:e.x+e.width/2,y:i}}function j(e,t){var i={t:"b",b:"t",l:"r",r:"l"};return e.map((function(e,n){return n===t?i[e]||"c":e})).join("")}function $(e,t,i,s,o,a,l){var c=g.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:o[s]||{}}),h=(0,r.Z)(c,2),f=h[0],_=h[1],m=g.useRef(0),v=g.useMemo((function(){return t?P(t):[]}),[t]),y=g.useRef({});e||(y.current={});var b=(0,d.Z)((function(){if(t&&i&&e){var c,h,d,f,p,g=t,m=g.ownerDocument,b=I(g),S=b.getComputedStyle(g).position,E=g.style.left,w=g.style.top,C=g.style.right,k=g.style.bottom,T=g.style.overflow,A=(0,n.Z)((0,n.Z)({},o[s]),a),D=m.createElement("div");if(null===(c=g.parentElement)||void 0===c||c.appendChild(D),D.style.left="".concat(g.offsetLeft,"px"),D.style.top="".concat(g.offsetTop,"px"),D.style.position=S,D.style.height="".concat(g.offsetHeight,"px"),D.style.width="".concat(g.offsetWidth,"px"),g.style.left="0",g.style.top="0",g.style.right="auto",g.style.bottom="auto",g.style.overflow="hidden",Array.isArray(i))p={x:i[0],y:i[1],width:0,height:0};else{var L,R,P=i.getBoundingClientRect();P.x=null!==(L=P.x)&&void 0!==L?L:P.left,P.y=null!==(R=P.y)&&void 0!==R?R:P.top,p={x:P.x,y:P.y,width:P.width,height:P.height}}var M=g.getBoundingClientRect(),B=b.getComputedStyle(g),$=B.height,G=B.width;M.x=null!==(h=M.x)&&void 0!==h?h:M.left,M.y=null!==(d=M.y)&&void 0!==d?d:M.top;var z=m.documentElement,K=z.clientWidth,W=z.clientHeight,q=z.scrollWidth,V=z.scrollHeight,Y=z.scrollTop,Z=z.scrollLeft,X=M.height,Q=M.width,J=p.height,ee=p.width,te={left:0,top:0,right:K,bottom:W},ie={left:-Z,top:-Y,right:q-Z,bottom:V-Y},ne=A.htmlRegion,re="visible",se="visibleFirst";"scroll"!==ne&&ne!==se&&(ne=re);var oe=ne===se,ae=F(ie,v),le=F(te,v),ce=ne===re?le:ae,ue=oe?le:ce;g.style.left="auto",g.style.top="auto",g.style.right="0",g.style.bottom="0";var he=g.getBoundingClientRect();g.style.left=E,g.style.top=w,g.style.right=C,g.style.bottom=k,g.style.overflow=T,null===(f=g.parentElement)||void 0===f||f.removeChild(D);var de=O(Math.round(Q/parseFloat(G)*1e3)/1e3),fe=O(Math.round(X/parseFloat($)*1e3)/1e3);if(0===de||0===fe||(0,u.Sh)(i)&&!(0,x.Z)(i))return;var pe=A.offset,_e=A.targetOffset,ge=N(M,pe),me=(0,r.Z)(ge,2),ve=me[0],ye=me[1],be=N(p,_e),Se=(0,r.Z)(be,2),Ee=Se[0],we=Se[1];p.x-=Ee,p.y-=we;var Ce=A.points||[],ke=(0,r.Z)(Ce,2),Te=ke[0],Ae=U(ke[1]),xe=U(Te),De=H(p,Ae),Le=H(M,xe),Re=(0,n.Z)({},A),Ie=De.x-Le.x+ve,Pe=De.y-Le.y+ye;function Tt(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ce,n=M.x+e,r=M.y+t,s=n+Q,o=r+X,a=Math.max(n,i.left),l=Math.max(r,i.top),c=Math.min(s,i.right),u=Math.min(o,i.bottom);return Math.max(0,(c-a)*(u-l))}var Oe,Me,Fe,Be,Ne=Tt(Ie,Pe),Ue=Tt(Ie,Pe,le),He=H(p,["t","l"]),je=H(M,["t","l"]),$e=H(p,["b","r"]),Ge=H(M,["b","r"]),ze=A.overflow||{},Ke=ze.adjustX,We=ze.adjustY,qe=ze.shiftX,Ve=ze.shiftY,Ye=function(e){return"boolean"==typeof e?e:e>=0};function At(){Oe=M.y+Pe,Me=Oe+X,Fe=M.x+Ie,Be=Fe+Q}At();var Ze=Ye(We),Xe=xe[0]===Ae[0];if(Ze&&"t"===xe[0]&&(Me>ue.bottom||y.current.bt)){var Qe=Pe;Xe?Qe-=X-J:Qe=He.y-Ge.y-ye;var Je=Tt(Ie,Qe),et=Tt(Ie,Qe,le);Je>Ne||Je===Ne&&(!oe||et>=Ue)?(y.current.bt=!0,Pe=Qe,ye=-ye,Re.points=[j(xe,0),j(Ae,0)]):y.current.bt=!1}if(Ze&&"b"===xe[0]&&(Oe<ue.top||y.current.tb)){var tt=Pe;Xe?tt+=X-J:tt=$e.y-je.y-ye;var it=Tt(Ie,tt),nt=Tt(Ie,tt,le);it>Ne||it===Ne&&(!oe||nt>=Ue)?(y.current.tb=!0,Pe=tt,ye=-ye,Re.points=[j(xe,0),j(Ae,0)]):y.current.tb=!1}var rt=Ye(Ke),st=xe[1]===Ae[1];if(rt&&"l"===xe[1]&&(Be>ue.right||y.current.rl)){var ot=Ie;st?ot-=Q-ee:ot=He.x-Ge.x-ve;var at=Tt(ot,Pe),lt=Tt(ot,Pe,le);at>Ne||at===Ne&&(!oe||lt>=Ue)?(y.current.rl=!0,Ie=ot,ve=-ve,Re.points=[j(xe,1),j(Ae,1)]):y.current.rl=!1}if(rt&&"r"===xe[1]&&(Fe<ue.left||y.current.lr)){var ct=Ie;st?ct+=Q-ee:ct=$e.x-je.x-ve;var ut=Tt(ct,Pe),ht=Tt(ct,Pe,le);ut>Ne||ut===Ne&&(!oe||ht>=Ue)?(y.current.lr=!0,Ie=ct,ve=-ve,Re.points=[j(xe,1),j(Ae,1)]):y.current.lr=!1}At();var dt=!0===qe?0:qe;"number"==typeof dt&&(Fe<le.left&&(Ie-=Fe-le.left-ve,p.x+ee<le.left+dt&&(Ie+=p.x-le.left+ee-dt)),Be>le.right&&(Ie-=Be-le.right-ve,p.x>le.right-dt&&(Ie+=p.x-le.right+dt)));var ft=!0===Ve?0:Ve;"number"==typeof ft&&(Oe<le.top&&(Pe-=Oe-le.top-ye,p.y+J<le.top+ft&&(Pe+=p.y-le.top+J-ft)),Me>le.bottom&&(Pe-=Me-le.bottom-ye,p.y>le.bottom-ft&&(Pe+=p.y-le.bottom+ft)));var pt=M.x+Ie,_t=pt+Q,gt=M.y+Pe,mt=gt+X,vt=p.x,yt=vt+ee,bt=p.y,St=bt+J,Et=(Math.max(pt,vt)+Math.min(_t,yt))/2-pt,wt=(Math.max(gt,bt)+Math.min(mt,St))/2-gt;null==l||l(t,Re);var Ct=he.right-M.x-(Ie+M.width),kt=he.bottom-M.y-(Pe+M.height);1===de&&(Ie=Math.round(Ie),Ct=Math.round(Ct)),1===fe&&(Pe=Math.round(Pe),kt=Math.round(kt)),_({ready:!0,offsetX:Ie/de,offsetY:Pe/fe,offsetR:Ct/de,offsetB:kt/fe,arrowX:Et/de,arrowY:wt/fe,scaleX:de,scaleY:fe,align:Re})}})),S=function(){_((function(e){return(0,n.Z)((0,n.Z)({},e),{},{ready:!1})}))};return(0,p.Z)(S,[s]),(0,p.Z)((function(){e||S()}),[e]),[f.ready,f.offsetX,f.offsetY,f.offsetR,f.offsetB,f.arrowX,f.arrowY,f.scaleX,f.scaleY,f.align,function(){m.current+=1;var e=m.current;Promise.resolve().then((function(){m.current===e&&b()}))}]}var G=i(94480);function z(e,t,i,n,r){(0,p.Z)((function(){if(e&&t&&i){var s=i,o=P(t),a=P(s),l=I(s),c=new Set([l].concat((0,G.Z)(o),(0,G.Z)(a)));function u(){n(),r()}return c.forEach((function(e){e.addEventListener("scroll",u,{passive:!0})})),l.addEventListener("resize",u,{passive:!0}),n(),function(){c.forEach((function(e){e.removeEventListener("scroll",u),l.removeEventListener("resize",u)}))}}}),[e,t,i])}i(48736);function K(e,t,i,n,r,s,o,a){var l=g.useRef(e);l.current=e;var c=g.useRef(!1);return g.useEffect((function(){if(t&&n&&(!r||s)){var e=function(){c.current=!1},u=function(e){var t;!l.current||o((null===(t=e.composedPath)||void 0===t||null===(t=t.call(e))||void 0===t?void 0:t[0])||e.target)||c.current||a(!1)},d=I(n);d.addEventListener("pointerdown",e,!0),d.addEventListener("mousedown",u,!0),d.addEventListener("contextmenu",u,!0);var f=(0,h.A)(i);return f&&(f.addEventListener("mousedown",u,!0),f.addEventListener("contextmenu",u,!0)),function(){d.removeEventListener("pointerdown",e,!0),d.removeEventListener("mousedown",u,!0),d.removeEventListener("contextmenu",u,!0),f&&(f.removeEventListener("mousedown",u,!0),f.removeEventListener("contextmenu",u,!0))}}}),[t,i,n,r,s]),function(){c.current=!0}}var W=["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"];var q=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.Z,t=g.forwardRef((function(t,i){var o=t.prefixCls,a=void 0===o?"rc-trigger-popup":o,m=t.children,v=t.action,y=void 0===v?"hover":v,b=t.showAction,S=t.hideAction,E=t.popupVisible,T=t.defaultPopupVisible,x=t.onPopupVisibleChange,D=t.afterPopupVisibleChange,I=t.mouseEnterDelay,P=t.mouseLeaveDelay,O=void 0===P?.1:P,M=t.focusDelay,F=t.blurDelay,B=t.mask,N=t.maskClosable,U=void 0===N||N,H=t.getPopupContainer,j=t.forceRender,G=t.autoDestroy,q=t.destroyPopupOnHide,V=t.popup,Y=t.popupClassName,Z=t.popupStyle,X=t.popupPlacement,Q=t.builtinPlacements,J=void 0===Q?{}:Q,ee=t.popupAlign,te=t.zIndex,ie=t.stretch,ne=t.getPopupClassNameFromAlign,re=t.fresh,se=t.alignPoint,oe=t.onPopupClick,ae=t.onPopupAlign,le=t.arrow,ce=t.popupMotion,ue=t.maskMotion,he=t.popupTransitionName,de=t.popupAnimation,fe=t.maskTransitionName,pe=t.maskAnimation,_e=t.className,ge=t.getTriggerDOMNode,me=(0,s.Z)(t,W),ve=G||q||!1,ye=g.useState(!1),be=(0,r.Z)(ye,2),Se=be[0],Ee=be[1];(0,p.Z)((function(){Ee((0,_.Z)())}),[]);var we=g.useRef({}),Ce=g.useContext(k),ke=g.useMemo((function(){return{registerSubPopup:function(e,t){we.current[e]=t,null==Ce||Ce.registerSubPopup(e,t)}}}),[Ce]),Te=(0,f.Z)(),Ae=g.useState(null),xe=(0,r.Z)(Ae,2),De=xe[0],Le=xe[1],Re=g.useRef(null),Ie=(0,d.Z)((function(e){Re.current=e,(0,u.Sh)(e)&&De!==e&&Le(e),null==Ce||Ce.registerSubPopup(Te,e)})),Pe=g.useState(null),Oe=(0,r.Z)(Pe,2),Me=Oe[0],Fe=Oe[1],Be=g.useRef(null),Ne=(0,d.Z)((function(e){(0,u.Sh)(e)&&Me!==e&&(Fe(e),Be.current=e)})),Ue=g.Children.only(m),He=(null==Ue?void 0:Ue.props)||{},je={},$e=(0,d.Z)((function(e){var t,i,n=Me;return(null==n?void 0:n.contains(e))||(null===(t=(0,h.A)(n))||void 0===t?void 0:t.host)===e||e===n||(null==De?void 0:De.contains(e))||(null===(i=(0,h.A)(De))||void 0===i?void 0:i.host)===e||e===De||Object.values(we.current).some((function(t){return(null==t?void 0:t.contains(e))||e===t}))})),Ge=R(a,ce,de,he),ze=R(a,ue,pe,fe),Ke=g.useState(T||!1),We=(0,r.Z)(Ke,2),qe=We[0],Ve=We[1],Ye=null!=E?E:qe,Ze=(0,d.Z)((function(e){void 0===E&&Ve(e)}));(0,p.Z)((function(){Ve(E||!1)}),[E]);var Xe=g.useRef(Ye);Xe.current=Ye;var Qe=g.useRef([]);Qe.current=[];var Je=(0,d.Z)((function(e){var t;Ze(e),(null!==(t=Qe.current[Qe.current.length-1])&&void 0!==t?t:Ye)!==e&&(Qe.current.push(e),null==x||x(e))})),et=g.useRef(),tt=function(){clearTimeout(et.current)},it=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;tt(),0===t?Je(e):et.current=setTimeout((function(){Je(e)}),1e3*t)};g.useEffect((function(){return tt}),[]);var nt=g.useState(!1),rt=(0,r.Z)(nt,2),st=rt[0],ot=rt[1];(0,p.Z)((function(e){e&&!Ye||ot(!0)}),[Ye]);var at=g.useState(null),lt=(0,r.Z)(at,2),ct=lt[0],ut=lt[1],ht=g.useState(null),dt=(0,r.Z)(ht,2),ft=dt[0],pt=dt[1],_t=function(e){pt([e.clientX,e.clientY])},gt=$(Ye,De,se&&null!==ft?ft:Me,X,J,ee,ae),mt=(0,r.Z)(gt,11),vt=mt[0],yt=mt[1],bt=mt[2],St=mt[3],Et=mt[4],wt=mt[5],Ct=mt[6],kt=mt[7],Tt=mt[8],At=mt[9],xt=mt[10],Dt=A(Se,y,b,S),Lt=(0,r.Z)(Dt,2),Rt=Lt[0],It=Lt[1],Pt=Rt.has("click"),Ot=It.has("click")||It.has("contextMenu"),Mt=(0,d.Z)((function(){st||xt()}));z(Ye,Me,De,Mt,(function(){Xe.current&&se&&Ot&&it(!1)})),(0,p.Z)((function(){Mt()}),[ft,X]),(0,p.Z)((function(){!Ye||null!=J&&J[X]||Mt()}),[JSON.stringify(ee)]);var Ft=g.useMemo((function(){var e=L(J,a,At,se);return l()(e,null==ne?void 0:ne(At))}),[At,ne,J,a,se]);g.useImperativeHandle(i,(function(){return{nativeElement:Be.current,popupElement:Re.current,forceAlign:Mt}}));var Bt=g.useState(0),Nt=(0,r.Z)(Bt,2),Ut=Nt[0],Ht=Nt[1],jt=g.useState(0),$t=(0,r.Z)(jt,2),Gt=$t[0],zt=$t[1],Kt=function(){if(ie&&Me){var e=Me.getBoundingClientRect();Ht(e.width),zt(e.height)}};function Wt(e,t,i,n){je[e]=function(r){var s;null==n||n(r),it(t,i);for(var o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];null===(s=He[e])||void 0===s||s.call.apply(s,[He,r].concat(a))}}(0,p.Z)((function(){ct&&(xt(),ct(),ut(null))}),[ct]),(Pt||Ot)&&(je.onClick=function(e){var t;Xe.current&&Ot?it(!1):!Xe.current&&Pt&&(_t(e),it(!0));for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];null===(t=He.onClick)||void 0===t||t.call.apply(t,[He,e].concat(n))});var qt,Vt,Yt=K(Ye,Ot,Me,De,B,U,$e,it),Zt=Rt.has("hover"),Xt=It.has("hover");Zt&&(Wt("onMouseEnter",!0,I,(function(e){_t(e)})),Wt("onPointerEnter",!0,I,(function(e){_t(e)})),qt=function(e){(Ye||st)&&null!=De&&De.contains(e.target)&&it(!0,I)},se&&(je.onMouseMove=function(e){var t;null===(t=He.onMouseMove)||void 0===t||t.call(He,e)})),Xt&&(Wt("onMouseLeave",!1,O),Wt("onPointerLeave",!1,O),Vt=function(){it(!1,O)}),Rt.has("focus")&&Wt("onFocus",!0,M),It.has("focus")&&Wt("onBlur",!1,F),Rt.has("contextMenu")&&(je.onContextMenu=function(e){var t;Xe.current&&It.has("contextMenu")?it(!1):(_t(e),it(!0)),e.preventDefault();for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];null===(t=He.onContextMenu)||void 0===t||t.call.apply(t,[He,e].concat(n))}),_e&&(je.className=l()(He.className,_e));var Qt=g.useRef(!1);Qt.current||(Qt.current=j||Ye||st);var Jt=(0,n.Z)((0,n.Z)({},He),je),ei={};["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"].forEach((function(e){me[e]&&(ei[e]=function(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];null===(t=Jt[e])||void 0===t||t.call.apply(t,[Jt].concat(n)),me[e].apply(me,n)})}));var ti=g.cloneElement(Ue,(0,n.Z)((0,n.Z)({},Jt),ei)),ii={x:wt,y:Ct},ni=le?(0,n.Z)({},!0!==le?le:{}):null;return g.createElement(g.Fragment,null,g.createElement(c.Z,{disabled:!Ye,ref:Ne,onResize:function(){Kt(),Mt()}},g.createElement(C,{getTriggerDOMNode:ge},ti)),Qt.current&&g.createElement(k.Provider,{value:ke},g.createElement(w,{portal:e,ref:Ie,prefixCls:a,popup:V,className:l()(Y,Ft),style:Z,target:Me,onMouseEnter:qt,onMouseLeave:Vt,onPointerEnter:qt,zIndex:te,open:Ye,keepDom:st,fresh:re,onClick:oe,onPointerDownCapture:Yt,mask:B,motion:Ge,maskMotion:ze,onVisibleChanged:function(e){ot(!1),xt(),null==D||D(e)},onPrepare:function(){return new Promise((function(e){Kt(),ut((function(){return e}))}))},forceRender:j,autoDestroy:ve,getPopupContainer:H,align:At,arrow:ni,arrowPos:ii,ready:vt,offsetX:yt,offsetY:bt,offsetR:St,offsetB:Et,onAlign:Mt,stretch:ie,targetWidth:Ut/kt,targetHeight:Gt/Tt})))}));return t}(o.Z)},13767:function(e,t,i){"use strict";var n=i(82242),r=i.n(n),s=(i(59301),i(93314)),o=i(99571),a=i(37712);t.Z=function(e){var t=e.img,i=e.buttonProps,n=void 0===i?{}:i,l=e.styles,c=void 0===l?{}:l,u=e.customText,h=e.ButtonText,d=e.ButtonClick,f=e.Buttonclass,p=e.ButtonTwo,_=e.imgStyles,g=e.loading,m=void 0!==g&&g,v=e.className,y=void 0===v?"":v;return(0,a.jsxs)("section",{className:"tc animated fadeIn ".concat(y),style:r()({color:"#999",margin:"100px auto",visibility:m?"hidden":"visible"},c),children:[(0,a.jsx)("img",{src:t||s,style:r()(r()({},_),{},{pointerEvents:"none",userSelect:"none"})}),(0,a.jsx)("p",{className:"mt20 font14",children:u||"暂时还没有相关数据哦!"}),h&&(0,a.jsx)(o.ZP,r()(r()({className:f,onClick:d},n),{},{children:h})),p&&p]})}},32831:function(e,t,i){"use strict";i.d(t,{Z:function(){return w}});var n=i(82242),r=i.n(n),s=i(7557),o=i.n(s),a=i(41498),l=i.n(a),c=i(79800),u=i.n(c),h=i(59301),d={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},f=i(99571),p=i(70557),_=i(92068),g=i(25399),m=i(83287),v=i(94280),y=i(13767),b=i(91689),S=i(8814),E=i(37712),w=function(e){var t,i,n,s,a,c,w=e.editOffice,C=void 0===w?"view":w,k=e.data,T=e.issaver,A=e.onSaver,x=(e.theme,e.type),D=e.filename,L=e.monacoEditor,R=e.className,I=e.style,P=e.close,O=e.onClose,M=e.hasMask,F=e.disabledDownload,B=e.onImgDimensions,N=e.showNodata,U=e.recordInfo,H=(0,h.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),j=u()(H,2),$=(j[0],j[1],(0,h.useState)("")),G=u()($,2),z=(G[0],G[1]),K=(0,h.useState)(),W=u()(K,2),q=W[0],V=W[1],Y="build"===window.ENV?"/react/build":"",Z=location.host.startsWith("localhost")?b.Z.PROXY_SERVER:b.Z.API_SERVER,X=(0,h.useRef)();null!==(t=k)&&void 0!==t&&t.startsWith("/api")&&"txt"!==x&&(k=b.Z.API_SERVER+k);function Q(e){return J.apply(this,arguments)}function J(){return(J=l()(o()().mark((function e(t){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"pdfdata"===t.data.type&&(A(t.data.data),window.removeEventListener("message",Q,!1)),console.log("mess---:",t.data);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}D&&L&&(L.filename=D),(0,h.useEffect)((function(){var e,t=null===(e=document.cookie)||void 0===e||null===(e=e.replace(/\s/g,""))||void 0===e?void 0:e.split(";");null==t||t.map((function(e){var t=e.split("=");"_educoder_session"===t[0]&&z(t[1])}))}),[]),(0,h.useEffect)((function(){var e;"office"===x&&(k.indexOf("bigfilescdn.")>-1||k.indexOf("bigfiles1")>-1?V({url:k,fileType:(e=k,e.substring(e.lastIndexOf("/")+1).split(".").pop()),model:k.indexOf("model=edit")?"edit":"view"}):ee())}),[x,k]);var ee=function(){var e=l()(o()().mark((function e(){var t,i,n;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data:",k),t=k,k.startsWith("http")||(t=location.origin+t),i=new URL(t).pathname.split("/").pop(),e.next=6,(0,v.gJ)({attachment_id:i});case 6:(n=e.sent).url=Z+n.url,V(n);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),te=function(){k.startsWith("http")||k.startsWith("blob:")?ie():(0,m.Sv)(D||"educoder",k,D)},ie=function(){U&&(0,S.fc)({id:null==U?void 0:U.id,watch_type:1,course_id:null==U?void 0:U.course_id}),(0,m.Nd)(D||"educoder",decodeURIComponent(k))};return(0,E.jsxs)("div",{style:r()({},I||{}),className:"".concat(M&&d.bgBlack," ").concat(x?d.wrp:"hide"),children:[P&&(0,E.jsxs)("div",{className:d.close,ref:X,children:[!!B&&(0,E.jsx)(g.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return X.current},children:(0,E.jsx)("span",{onClick:function(){O(),B()},children:(0,E.jsx)("i",{className:"icon-yulanpizhu"})})}),!F&&(0,E.jsx)(g.Z,{title:"点击下载此文件",getPopupContainer:function(){return X.current},children:(0,E.jsx)("span",{onClick:ie,children:(0,E.jsx)("i",{className:"icon-quxiaozhiding"})})}),T&&(0,E.jsx)(g.Z,{title:"保存pdf并退出",getPopupContainer:function(){return X.current},children:(0,E.jsx)("span",{className:"",onClick:function(){var e=document.getElementById("pdfiframe");window.addEventListener("message",Q,!1),setTimeout((function(){e.contentWindow.postMessage("getData","*")}),300)},children:(0,E.jsx)("i",{className:"icon-baocun"})})}),(0,E.jsx)(g.Z,{title:"关闭",getPopupContainer:function(){return X.current},children:(0,E.jsx)("span",{className:"",onClick:function(){O()},children:(0,E.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,E.jsx)("div",{className:"".concat(d[R]," ").concat(R," ").concat(d.monaco," ").concat("txt"===x?"show":"hide"),children:"txt"===x&&(0,E.jsx)(E.Fragment,{children:(0,E.jsx)(_.ZP,r()({},L))})}),"audio"===x&&(0,E.jsx)("audio",{src:"".concat((null===(i=k)||void 0===i?void 0:i.indexOf("http://"))>-1||(null===(n=k)||void 0===n?void 0:n.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(k),autoPlay:!0}),"video"===x&&(0,E.jsx)(E.Fragment,{children:(null===(s=k)||void 0===s?void 0:s.indexOf("http"))>-1?(0,E.jsx)("video",{controls:!0,src:"".concat(k),autoPlay:!0}):(0,E.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(k),autoPlay:!0})}),"office"===x&&q&&(0,E.jsx)("iframe",{src:"".concat(Y,"/office.html?key=").concat(q.key,"&url=").concat(btoa(q.url),"&callbackUrl=").concat(Z+(q.callbackUrl||""),"&fileType=").concat(q.fileType,"&title=").concat(q.title||"","&model=").concat(C,"&officeServer=").concat(b.Z.ONLYOFFICE,"&disabledDownload=").concat(!!F)}),"html"===x&&(0,E.jsx)("iframe",{src:k+"&disposition=inline"}),"pdf"===x&&(0,E.jsx)("iframe",{id:"pdfiframe",src:"".concat(Y,"/js/pdfview/index.html?filename=").concat(D||"educoder.pdf","&url=").concat(encodeURIComponent(k),"&disabledDownload=").concat(!!F,"&model=").concat(C)}),"image"===x&&(0,E.jsx)("img",{src:"".concat((null===(a=k)||void 0===a?void 0:a.indexOf("http://"))>-1||(null===(c=k)||void 0===c?void 0:c.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(k)}),("other"===x||"download"===x)&&(0,E.jsx)(E.Fragment,{children:N?(0,E.jsx)(y.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,E.jsx)(f.ZP,{icon:(0,E.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:te,disabled:F,children:"下载"})}):(0,E.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:te,disabled:F,children:[(0,E.jsx)(p.Z,{}),"点击下载"]})}),"flowChart"===x&&(0,E.jsx)("div",{className:"embed",children:(0,E.jsx)("iframe",{src:"/drawio/src/main/webapp/viewer.html?id=".concat(k||"","&gapi=0&od=0&db=0&gh=0&gl=0"),width:"100%",height:"100%",frameBorder:"0"})})]})}},74889:function(e,t,i){"use strict";i.d(t,{z:function(){return x},Z:function(){return D}});var n=i(82242),r=i.n(n),s=i(37205),o=i.n(s),a=i(91232),l=i.n(a),c=i(79800),u=i.n(c),h=i(59301),d=(i(88831),i(75359)),f=(i(64018),i(44523)),p=i(91689),_=i(83287),g=i(15342),m=i(77736),v=i(99571),y=i(1012),b=i(32831),S=i(37712),E=function(e){var t=e.html,i=(0,h.useRef)(null),n=(0,h.useRef)(null);return(0,h.useEffect)((function(){var e=i.current.attachShadow({mode:"open"});n.current=document.createElement("div"),n.current.className="markdown-body",n.current.innerHTML=t,e.appendChild(n.current);var r=document.createElement("style");return r.textContent='.markdown-body p {\n margin: 0 0 16px 0 !important;\n line-height: 28px;\n white-space: pre-wrap;\n }\n\n ol,\n ul,\n li {\n list-style-type: none\n }\n\n ol,\n ul,\n dl {\n margin-bottom: 0px;\n }\n\n .markdown-body {\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n color: #333;\n overflow: hidden;\n font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", "Monaco", monospace, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;\n word-break: break-word;\n font-size: 16px;\n line-height: 1.6;\n white-space: normal;\n word-wrap: break-word;\n position: relative;\n }\n\n .markdown-body ul>li {\n list-style-type: disc;\n }\n\n .markdown-body ol>li {\n list-style-type: decimal;\n }\n\n .markdown-body a {\n background: transparent;\n }\n\n .markdown-body a:active,\n .markdown-body a:hover {\n outline: 0;\n }\n\n .markdown-body strong {\n font-weight: bold;\n }\n\n .markdown-body h1 {\n font-size: 2em;\n margin: 0.67em 0;\n }\n\n .markdown-body img {\n border: 0;\n }\n\n .markdown-body hr {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n height: 0;\n }\n\n .markdown-body pre {\n overflow: auto;\n }\n\n .markdown-body code,\n .markdown-body kbd,\n .markdown-body pre {\n font-family: "Meiryo UI", "YaHei Consolas Hybrid", Consolas, "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace;\n font-size: 1em;\n }\n\n .markdown-body input {\n color: inherit;\n font: inherit;\n margin: 0;\n }\n\n .markdown-body html input[disabled] {\n cursor: default;\n }\n\n .markdown-body input {\n line-height: normal;\n }\n\n .markdown-body input[type="checkbox"] {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n padding: 0;\n }\n\n .markdown-body table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n .markdown-body td,\n .markdown-body th {\n padding: 0;\n }\n\n .markdown-body * {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n\n .markdown-body input {\n font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";\n }\n\n .markdown-body a {\n color: #4183c4;\n text-decoration: none;\n }\n\n .markdown-body a:hover,\n .markdown-body a:active {\n text-decoration: underline;\n }\n\n .markdown-body hr {\n height: 0;\n margin: 15px 0;\n overflow: hidden;\n background: transparent;\n border: 0;\n border-bottom: 1px solid #ddd;\n }\n\n .markdown-body hr:before {\n display: table;\n content: "";\n }\n\n .markdown-body hr:after {\n display: table;\n clear: both;\n content: "";\n }\n\n .markdown-body h1,\n .markdown-body h2,\n .markdown-body h3,\n .markdown-body h4,\n .markdown-body h5,\n .markdown-body h6 {\n margin-top: 15px;\n margin-bottom: 15px;\n line-height: 1.1;\n }\n\n .markdown-body h1 {\n font-size: 30px;\n }\n\n .markdown-body h2 {\n font-size: 21px;\n }\n\n .markdown-body h3 {\n font-size: 16px;\n }\n\n .markdown-body h4 {\n font-size: 14px;\n }\n\n .markdown-body h5 {\n font-size: 12px;\n }\n\n .markdown-body h6 {\n font-size: 11px;\n }\n\n .markdown-body blockquote {\n margin: 0;\n }\n\n .markdown-body ul,\n .markdown-body ol {\n padding: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n\n ul.linenums,\n ol.linenums {\n padding: 16px 0 0 56px !important;\n }\n\n .markdown-body ul,\n .markdown-body ol {\n padding-left: 2em;\n }\n\n\n .markdown-body ol ol,\n .markdown-body ul ol {\n list-style-type: lower-roman;\n }\n\n .markdown-body ul ul ol,\n .markdown-body ul ol ol,\n .markdown-body ol ul ol,\n .markdown-body ol ol ol {\n list-style-type: lower-alpha;\n }\n\n .markdown-body dd {\n margin-left: 0;\n }\n\n .markdown-body code {\n font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;\n font-size: 12px;\n }\n\n .markdown-body pre {\n margin-top: 0;\n margin-bottom: 0;\n font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;\n }\n\n .markdown-body .octicon {\n font: normal normal 16px octicons-anchor;\n line-height: 1;\n display: inline-block;\n text-decoration: none;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n .markdown-body .octicon-link:before {\n content: \'\f05c\';\n }\n\n .markdown-body>*:first-child {\n margin-top: 0 !important;\n }\n\n .markdown-body>*:last-child {\n margin-bottom: 0 !important;\n }\n\n .markdown-body .anchor {\n position: absolute;\n top: 0;\n left: 0;\n display: block;\n padding-right: 6px;\n padding-left: 30px;\n margin-left: -30px;\n }\n\n .markdown-body .anchor:focus {\n outline: none;\n }\n\n .markdown-body h1,\n .markdown-body h2,\n .markdown-body h3,\n .markdown-body h4,\n .markdown-body h5,\n .markdown-body h6 {\n position: relative;\n margin-top: 1em;\n margin-bottom: 16px;\n font-weight: bold;\n line-height: 1.4;\n }\n\n .markdown-body h1 .octicon-link,\n .markdown-body h2 .octicon-link,\n .markdown-body h3 .octicon-link,\n .markdown-body h4 .octicon-link,\n .markdown-body h5 .octicon-link,\n .markdown-body h6 .octicon-link {\n display: none;\n color: #000;\n vertical-align: middle;\n }\n\n .markdown-body h1:hover .anchor,\n .markdown-body h2:hover .anchor,\n .markdown-body h3:hover .anchor,\n .markdown-body h4:hover .anchor,\n .markdown-body h5:hover .anchor,\n .markdown-body h6:hover .anchor {\n padding-left: 8px;\n margin-left: -30px;\n text-decoration: none;\n }\n\n .markdown-body h1:hover .anchor .octicon-link,\n .markdown-body h2:hover .anchor .octicon-link,\n .markdown-body h3:hover .anchor .octicon-link,\n .markdown-body h4:hover .anchor .octicon-link,\n .markdown-body h5:hover .anchor .octicon-link,\n .markdown-body h6:hover .anchor .octicon-link {\n display: inline-block;\n }\n\n .markdown-body h1 {\n padding-bottom: 0.3em;\n font-size: 2.25em;\n line-height: 1.2;\n border-bottom: 1px solid #eee;\n }\n\n .markdown-body h1 .anchor {\n line-height: 1;\n }\n\n .markdown-body h2 {\n padding-bottom: 0.3em;\n font-size: 1.75em;\n line-height: 1.225;\n border-bottom: 1px solid #eee;\n }\n\n .markdown-body h2 .anchor {\n line-height: 1;\n }\n\n .markdown-body h3 {\n font-size: 1.5em;\n line-height: 1.43;\n }\n\n .markdown-body h3 .anchor {\n line-height: 1.2;\n }\n\n .markdown-body h4 {\n font-size: 1.25em;\n }\n\n .markdown-body h4 .anchor {\n line-height: 1.2;\n }\n\n .markdown-body h5 {\n font-size: 1em;\n }\n\n .markdown-body h5 .anchor {\n line-height: 1.1;\n }\n\n .markdown-body h6 {\n font-size: 1em;\n color: #777;\n }\n\n .markdown-body h6 .anchor {\n line-height: 1.1;\n }\n\n .markdown-body p,\n .markdown-body blockquote,\n .markdown-body ul,\n .markdown-body ol,\n .markdown-body dl,\n .markdown-body table,\n .markdown-body pre {\n margin-top: 0;\n margin-bottom: 16px;\n }\n\n .markdown-body ul ul,\n .markdown-body ul ol,\n .markdown-body ol ol,\n .markdown-body ol ul {\n margin-top: 0;\n margin-bottom: 0;\n }\n\n .markdown-body li>p {\n margin-top: 16px;\n }\n\n .markdown-body dl {\n padding: 0;\n }\n\n .markdown-body dl dt {\n padding: 0;\n margin-top: 16px;\n font-size: 1em;\n font-style: italic;\n font-weight: bold;\n }\n\n .markdown-body dl dd {\n padding: 0 16px;\n margin-bottom: 16px;\n }\n\n .markdown-body blockquote {\n padding: 0 15px;\n color: #777;\n border-left: 4px solid #ddd;\n }\n\n .markdown-body blockquote> :first-child {\n margin-top: 0;\n }\n\n .markdown-body blockquote> :last-child {\n margin-bottom: 0;\n }\n\n .markdown-body table {\n display: block;\n width: 100%;\n overflow: auto;\n word-break: normal;\n word-break: keep-all;\n }\n\n .markdown-body table th {\n font-weight: bold;\n text-align: revert;\n }\n\n .markdown-body table th,\n .markdown-body table td {\n padding: 6px 13px;\n border: 1px solid #ddd;\n }\n\n .markdown-body table tr {\n background-color: #fff;\n border-top: 1px solid #ccc;\n }\n\n .markdown-body table tr:nth-child(2n) {\n background-color: #f8f8f8;\n }\n\n .markdown-body img {\n max-width: 100%;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n\n .markdown-body code {\n padding: 0;\n padding-top: 0.2em;\n padding-bottom: 0.2em;\n margin: 0;\n font-size: 85%;\n background-color: rgba(0, 0, 0, 0.04);\n border-radius: 3px;\n }\n\n .markdown-body code:has(.katex) {\n background-color: transparent;\n }\n\n .markdown-body code:before,\n .markdown-body code:after {\n letter-spacing: -0.2em;\n content: "\\00a0";\n }\n\n .markdown-body pre>code {\n padding: 0;\n margin: 0;\n font-size: 100%;\n word-break: normal;\n white-space: pre;\n background: transparent;\n border: 0;\n }\n\n .markdown-body .highlight {\n margin-bottom: 16px;\n }\n\n .markdown-body .highlight pre,\n .markdown-body pre {\n padding: 16px;\n overflow: auto;\n font-size: 85%;\n line-height: 1.45;\n background-color: #f7f7f7;\n border-radius: 3px;\n }\n\n .markdown-body .highlight pre {\n margin-bottom: 0;\n word-break: normal;\n }\n\n .markdown-body pre {\n word-wrap: normal;\n }\n\n .markdown-body pre code {\n display: inline;\n max-width: initial;\n padding: 0;\n margin: 0;\n overflow: initial;\n line-height: inherit;\n word-wrap: normal;\n background-color: transparent;\n border: 0;\n }\n\n .markdown-body pre code:before,\n .markdown-body pre code:after {\n content: normal;\n }\n\n .markdown-body kbd {\n display: inline-block;\n padding: 3px 5px;\n font-size: 11px;\n line-height: 10px;\n color: #555;\n vertical-align: middle;\n background-color: #fcfcfc;\n border: solid 1px #ccc;\n border-bottom-color: #bbb;\n border-radius: 3px;\n box-shadow: inset 0 -1px 0 #bbb;\n }\n\n .markdown-body .pl-c {\n color: #969896;\n }\n\n .markdown-body .pl-c1,\n .markdown-body .pl-mdh,\n .markdown-body .pl-mm,\n .markdown-body .pl-mp,\n .markdown-body .pl-mr,\n .markdown-body .pl-s1 .pl-v,\n .markdown-body .pl-s3,\n .markdown-body .pl-sc,\n .markdown-body .pl-sv {\n color: #0086b3;\n }\n\n .markdown-body .pl-e,\n .markdown-body .pl-en {\n color: #795da3;\n }\n\n .markdown-body .pl-s1 .pl-s2,\n .markdown-body .pl-smi,\n .markdown-body .pl-smp,\n .markdown-body .pl-stj,\n .markdown-body .pl-vo,\n .markdown-body .pl-vpf {\n color: #333;\n }\n\n .markdown-body .pl-ent {\n color: #63a35c;\n }\n\n .markdown-body .pl-k,\n .markdown-body .pl-s,\n .markdown-body .pl-st {\n color: #a71d5d;\n }\n\n .markdown-body .pl-pds,\n .markdown-body .pl-s1,\n .markdown-body .pl-s1 .pl-pse .pl-s2,\n .markdown-body .pl-sr,\n .markdown-body .pl-sr .pl-cce,\n .markdown-body .pl-sr .pl-sra,\n .markdown-body .pl-sr .pl-sre,\n .markdown-body .pl-src {\n color: #df5000;\n }\n\n .markdown-body .pl-mo,\n .markdown-body .pl-v {\n color: #1d3e81;\n }\n\n .markdown-body .pl-id {\n color: #b52a1d;\n }\n\n .markdown-body .pl-ii {\n background-color: #b52a1d;\n color: #f8f8f8;\n }\n\n .markdown-body .pl-sr .pl-cce {\n color: #63a35c;\n font-weight: bold;\n }\n\n .markdown-body .pl-ml {\n color: #693a17;\n }\n\n .markdown-body .pl-mh,\n .markdown-body .pl-mh .pl-en,\n .markdown-body .pl-ms {\n color: #1d3e81;\n font-weight: bold;\n }\n\n .markdown-body .pl-mq {\n color: #008080;\n }\n\n .markdown-body .pl-mi {\n color: #333;\n font-style: italic;\n }\n\n .markdown-body .pl-mb {\n color: #333;\n font-weight: bold;\n }\n\n .markdown-body .pl-md,\n .markdown-body .pl-mdhf {\n background-color: #ffecec;\n color: #bd2c00;\n }\n\n .markdown-body .pl-mdht,\n .markdown-body .pl-mi1 {\n background-color: #eaffea;\n color: #55a532;\n }\n\n .markdown-body .pl-mdr {\n color: #795da3;\n font-weight: bold;\n }\n\n .markdown-body kbd {\n display: inline-block;\n padding: 3px 5px;\n font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;\n line-height: 10px;\n color: #555;\n vertical-align: middle;\n background-color: #fcfcfc;\n border: solid 1px #ccc;\n border-bottom-color: #bbb;\n border-radius: 3px;\n box-shadow: inset 0 -1px 0 #bbb;\n }\n\n .markdown-body .task-list-item {\n list-style-type: none;\n }\n\n .markdown-body .task-list-item+.task-list-item {\n margin-top: 3px;\n }\n\n .markdown-body .task-list-item input {\n float: left;\n margin: 0.3em 0 0.25em -1.6em;\n vertical-align: middle;\n }\n\n .markdown-body :checked+.radio-label {\n z-index: 1;\n position: relative;\n border-color: #4183c4;\n }\n\n\n /*! Pretty printing styles. Used with prettify.js. */\n /* SPAN elements with the classes below are added by prettyprint. */\n .pln {\n color: #000\n }\n\n /* plain text */\n\n @media screen {\n .str {\n color: #080\n }\n\n /* string content */\n .kwd {\n color: #008\n }\n\n /* a keyword */\n .com {\n color: #800\n }\n\n /* a comment */\n .typ {\n color: #606\n }\n\n /* a type name */\n .lit {\n color: #066\n }\n\n /* a literal value */\n /* punctuation, lisp open bracket, lisp close bracket */\n .pun,\n .opn,\n .clo {\n color: #660\n }\n\n .tag {\n color: #008\n }\n\n /* a markup tag name */\n .atn {\n color: #606\n }\n\n /* a markup attribute name */\n .atv {\n color: #080\n }\n\n /* a markup attribute value */\n .dec,\n .var {\n color: #606\n }\n\n /* a declaration; a variable name */\n .fun {\n color: red\n }\n\n /* a function name */\n }\n\n /* Use higher contrast and text-weight for printable form. */\n @media print,\n projection {\n .str {\n color: #060\n }\n\n .kwd {\n color: #006;\n font-weight: bold\n }\n\n .com {\n color: #600;\n font-style: italic\n }\n\n .typ {\n color: #404;\n font-weight: bold\n }\n\n .lit {\n color: #044\n }\n\n .pun,\n .opn,\n .clo {\n color: #440\n }\n\n .tag {\n color: #006;\n font-weight: bold\n }\n\n .atn {\n color: #404\n }\n\n .atv {\n color: #060\n }\n }\n\n /* Put a border around prettyprinted code snippets. */\n pre.prettyprint {\n padding: 2px;\n /* border: 1px solid #888 */\n }\n\n /* Specify class=linenums on a pre to get line numbering */\n ol.linenums {\n margin-top: 0;\n margin-bottom: 0\n }\n\n /* IE indents via margin-left */\n li.L0,\n li.L1,\n li.L2,\n li.L3,\n li.L5,\n li.L6,\n li.L7,\n li.L8 {\n list-style-type: none\n }\n\n /* Alternate shading for lines */\n li.L1,\n li.L3,\n li.L5,\n li.L7,\n li.L9 {\n background: #eee\n }\n\n .markdown-body p,\n .markdown-body blockquote,\n .markdown-body ul,\n .markdown-body ol,\n .markdown-body dl,\n .markdown-body table,\n .markdown-body pre {\n margin-top: 0;\n margin-bottom: 16px;\n }',e.appendChild(r),function(){e.innerHTML=""}}),[]),(0,h.useEffect)((function(){n.current&&(n.current.innerHTML=t)}),[t]),(0,S.jsx)("div",{ref:i})};var w="mdBody___raKXb",C="button___Ch5Pc",k="previewFlowChart___vY1dq",T="@▁@",A=/<pre[^>]*>/g;var x=function(e,t){e=e||"";var i=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return t?e.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(i,(function(e,t,i,n,r,s,o){var a=t||n||s,l=i||r||o||"?";return p.Z.API_SERVER+"/api/attachments/"+a+l+"&t="+(0,_.Jn)(a,Date.now())+(e.indexOf(")")>-1?")":"&")})).replaceAll('src="(','src="').replaceAll("src='(",'src="'):e=e.replace(/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,(function(e,t,i,n,r,s,o){var a=t||n||s,l=i||r||o||"?";return p.Z.API_SERVER+"/attachments/download/"+a+l+"&t="+(0,_.Jn)(a,Date.now())+(e.indexOf(")")>-1?")":"&")})).replace(i,(function(e,t,i,n,r,s,o){var a=t||n||s,l=i||r||o||"?";return p.Z.API_SERVER+"/api/attachments/"+a+l+"&t="+(0,_.Jn)(a,Date.now())+(e.indexOf(")")>-1?")":"&")})).replace(/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,(function(e,t,i,n,r){var s=t||n,o=i||r||"";return'"'+p.Z.API_SERVER+"/api/attachments/"+s+o+s+o+"&t="+(0,_.Jn)(s,Date.now())})).replace(/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,(function(e,t,i,n,r){var s=t||n,o=i||r||"";return"("+p.Z.API_SERVER+"/files/uploads/"+s+o+s+o+"&t="+(0,_.Jn)(s,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,"\n")},D=function(e){var t=e.value,i=void 0===t?"":t,n=e.edit,s=void 0!==n&&n,a=e.className,c=e.showTextOnly,_=e.showLines,x=e.style,D=void 0===x?{}:x,L=e.stylesPrev,R=void 0===L?{}:L,I=e.highlightKeywords,P=e.showProgramFill,O=(e.isProgramFill,e.disabledFill),M=void 0!==O&&O,F=e.programFillValue,B=e.openEditor,N=void 0===B?function(){}:B,U=e.onFillChange,H=void 0===U?function(e){}:U,j=e.onFillBlur,$=void 0===j?function(){}:j,G=e.onFillFocus,z=void 0===G?function(){}:G,K=function(e){var t=new RegExp("\\b(".concat(["onabort","onanimationend","onanimationiteration","onanimationstart","onauxclick","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncopy","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitionend","onvolumechange","onwaiting","onwheel"].join("|"),")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s>]*)"),"gi");return e.replace(t,"").trim()}(String(i||"")),W=(0,h.useRef)(),q=(0,h.useRef)(),V=(0,h.useState)(""),Y=u()(V,2),Z=Y[0],X=Y[1],Q=(0,h.useState)("office"),J=u()(Q,2),ee=J[0],te=J[1],ie=(0,h.useState)([]),ne=u()(ie,2),re=ne[0],se=ne[1],oe=(0,h.useRef)("a"+(0,y.Z)()),ae={},le=function(e){return/<style[\s\S]*?>/i.test(e||"")};var ce=function(e){return!c&&le(K)?e:e.replace(/<style.*?>([\s\S]+?)<\/style>/gim,(function(e,t){var i=t.replace(/(\n|\r)/g,"").split("}"),n=[];return i.map((function(e){""!=e&&n.push(".".concat(oe.current," ").concat(e))})),"<style>".concat(n.join("}"),"</style>")}))},ue=(0,h.useMemo)((function(){try{K=K.replace(/\(\/attachments\/download\//g,"("+p.Z.API_SERVER+"/attachments/download/").replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,"("+p.Z.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+p.Z.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+p.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,"\n"),W.current.style.display="none"}catch(e){}if(P){var e=-1;return K=K.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,(function(t,i,n){var r;return function(e,t,i){var n=document.createElement(e===T?"input":"textarea");n.style.width="100%",n.style.height=e===T?"40px":"151px",n.rows=5,n.spellcheck=!1,n.name="edu-program-fill",n.placeholder="请输入",n.dataset.id=t;var r=Object.keys(ae).length;return ae[r]=n,'<span class="edu-program-fill-wrap '.concat(e===T?"":"show",'" style="width:').concat(e===T?"600px":"100%",'" title=').concat(i||"","><span>").concat(n.outerHTML,'<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>')}(t,++e,null==F||null===(r=F[e])||void 0===r?void 0:r.value.replaceAll("<","&lt;").replaceAll(">","&gt;"))})),'<pre style="background:#fff;padding:4px">'.concat(ce(K||""),"</pre>")}var t=ce(K);t=(0,d.ZP)(t);var i=(0,d.ez)();K.match(/\[TOC\]/)&&(t=t.replace("<p>[TOC]</p>",(0,d.Qv)()),(0,d.Iy)()),t=t.replace(/(__special_katext_id_\d+__)/g,(function(e,t){var n=i[t],r=n.type,s=n.expression;return(0,g.renderToString)(function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue}(s)||"",{displayMode:"block"===r,throwOnError:!1,output:"html"})})),t=t.replace(/▁/g,"▁▁▁▁▁"),(0,d.AL)();var n=document.createElement("div");return n.innerHTML=t,c?n.innerText:I?(pe(n,I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n.innerHTML):(setTimeout((function(){return me()}),500),n.innerHTML)}),[K,I]);(0,h.useEffect)((function(){_e.current&&_e.current.querySelectorAll(["input","textarea"]).forEach((function(e){e.oninput=he,e.onblur=de,e.onfocus=fe}))}),[re]),(0,h.useEffect)((function(){if(null!=F&&F.length)try{var e,t=_e.current.querySelectorAll(".edu-program-fill-score"),i=_e.current.querySelectorAll('[name="edu-program-fill"]'),n=l()(i.entries());try{for(n.s();!(e=n.n()).done;){var r,s,o,a=u()(e.value,2),c=a[0],h=a[1];h.value=(null==F||null===(r=F[c])||void 0===r?void 0:r.value)||"","warning"===(null==F||null===(s=F[c])||void 0===s?void 0:s.type)?h.className="program-fill-warning":"success"===(null==F||null===(o=F[c])||void 0===o?void 0:o.type)?h.className="program-fill-success":h.className=""}}catch(e){n.e(e)}finally{n.f()}var d,f=l()(t.entries());try{for(f.s();!(d=f.n()).done;){var p,_,g=u()(d.value,2),m=g[0];g[1].innerHTML=null!=F&&null!==(p=F[m])&&void 0!==p&&p.score?"".concat(null==F||null===(_=F[m])||void 0===_?void 0:_.score,"分"):""}}catch(e){f.e(e)}finally{f.f()}se(F)}catch(e){console.log(e,"error")}}),[F]);var he=function(e){re[e.target.dataset.id]=re[e.target.dataset.id]||{},re[e.target.dataset.id].value=e.target.value,se(o()(re)),H(re,e.target.dataset.id)},de=function(e){re[e.target.dataset.id]=re[e.target.dataset.id]||{},re[e.target.dataset.id].value=e.target.value,se(o()(re)),$(re,e.target.dataset.id)},fe=function(e){re[e.target.dataset.id]=re[e.target.dataset.id]||{},re[e.target.dataset.id].value=e.target.value,se(o()(re)),z(re,e.target.dataset.id)};function pe(e,t){return e.childNodes.forEach((function(e){if(e.childNodes.length>0)pe(e,t);else if("IMG"!==e.nodeName)if(e.innerHTML){var i;e.innerHTML=null===(i=e.innerHTML)||void 0===i?void 0:i.replace(new RegExp(t,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>')}else{var n=document.createElement("span");n.innerHTML=e.textContent.replace(new RegExp(t,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),e.replaceWith(n)}}))}var _e=(0,h.useRef)();function ge(e){var t=e.target;if("A"===t.tagName.toUpperCase()){var i=t.getAttribute("href");if(i.indexOf("office")>-1)e.preventDefault(),X(i),te("office");else if(i.indexOf("application/pdf")>-1)e.preventDefault(),X(i),te("pdf");else if(i.indexOf("text/html")>-1)e.preventDefault(),X(i),te("html");else if(i.startsWith("#")){e.preventDefault();var n=document.getElementById(i.replace("#",""));n&&n.scrollIntoView(!0)}}}d.jb.WebkitLineClamp=_,_&&(D=r()(r()({},D),d.jb));var me=function(){var e,t=null===(e=_e.current)||void 0===e?void 0:e.querySelectorAll("video");null==t||t.forEach((function(e){if(e.oncontextmenu=function(){return!1},e.src.indexOf(".m3u8")>-1)if(e.canPlayType("application/vnd.apple.mpegurl"));else if(f.ZP.isSupported()){var t=new f.ZP;t.loadSource(e.src),t.attachMedia(e)}}))};(0,h.useEffect)((function(){if(_e.current&&ue&&ue.match(A)&&window.PR.prettyPrint(),_e.current)return _e.current.addEventListener("click",ge),function(){var e;null===(e=_e.current)||void 0===e||e.removeEventListener("click",ge),(0,d.AL)(),(0,d.Iy)()}}),[ue,_e.current,ge]);return(0,h.useEffect)((function(){var e,t=function(e){e.preventDefault(),e.clipboardData.setData("text",window.getSelection().toString())};return null===(e=_e.current)||void 0===e||e.addEventListener("copy",t),function(){var e;null===(e=_e.current)||void 0===e||e.removeEventListener("copy",t)}}),[_e.current]),(0,S.jsxs)("div",{style:{position:"relative"},onMouseLeave:function(){W.current.style.display="none"},children:[c&&(0,S.jsx)("div",{ref:_e,className:"".concat(w," "),children:ue}),!c&&!le(ue)&&(0,S.jsx)("div",{ref:_e,style:r()({},D),onMouseOver:function(e){"IMG"===e.target.nodeName&&e.target.className.indexOf("draw-flowchart")>-1?(W.current.style.zIndex=1,W.current.style.display="flex",W.current.style.width=e.target.clientWidth+"px",W.current.style.height=e.target.clientHeight+"px",W.current.style.top=e.target.offsetTop+"px",W.current.style.left=e.target.offsetLeft+"px",e.target.id&&(q.current=e.target.id)):W.current.style.display="none"},className:"".concat(a||""," ").concat(M?"disabled-fill":""," markdown-body ").concat(w," ").concat(oe.current),dangerouslySetInnerHTML:{__html:ue}}),!c&&le(ue)&&(0,S.jsx)(E,{html:ue}),(0,S.jsx)("div",{ref:W,className:"".concat(C," ").concat(s?"":k),children:(0,S.jsx)(m.Z,{children:(0,S.jsx)(v.ZP,{onClick:function(){s?N(q.current):(X(q.current),te("flowChart"))},children:s?"编辑":"预览"})})}),(0,S.jsx)(b.Z,{close:!0,data:Z,type:null!=Z&&Z.length?ee:"",style:r()({},R),onClose:function(){return X("")}})]})}},48049:function(e,t,i){"use strict";i.d(t,{Z:function(){return a}});var n=i(53260),r="ldsRing___mpBZC",s="idsRingWrapper___Of9_n",o=i(37712),a=function(e){var t=e.message,i=e.className,a=e.children,l=e.style,c=void 0===l?{}:l;return(0,o.jsxs)("div",{className:"custom-spinner ".concat(s," ").concat(i),children:[(0,o.jsxs)("div",{className:r,children:[(0,o.jsx)("div",{}),(0,o.jsx)("div",{}),(0,o.jsx)("div",{}),(0,o.jsx)("div",{})]}),t?(0,o.jsx)("p",{style:c,children:t}):null,a,(0,o.jsx)(n.Outlet,{})]})}},96454:function(e,t,i){"use strict";i.d(t,{Z:function(){return d}});i(59301);var n="result___gu5zt",r="title___xrnx2",s="left___IAxp9",o="leftNode___HL8fG",a="right___ZXYmw",l="rightNode___jYL5_",c=i(92310),u=i.n(c),h=i(37712),d=function(e){var t=e.className,i=e.style,c=void 0===i?{}:i,d=e.leftNode,f=e.leftTitle,p=void 0===f?"自测输入":f,_=e.rightNode,g=e.rightTitle,m=void 0===g?"运行结果":g;return(0,h.jsxs)("div",{className:u()(n,t),style:c,children:[(0,h.jsxs)("div",{className:s,children:[(0,h.jsxs)("div",{className:r,children:[(0,h.jsx)("i",{style:{color:"#08CF76"},className:"iconfont iconfont icon-zidingyiceshiyongli font14 mr5"}),(0,h.jsx)("span",{children:p})]}),(0,h.jsx)("div",{className:o,children:d})]}),(0,h.jsxs)("div",{className:a,children:[(0,h.jsxs)("div",{className:r,children:[(0,h.jsx)("i",{style:{color:"#00DFFF"},className:"iconfont iconfont icon-daimazhihangjieguo font14 mr5"}),(0,h.jsx)("span",{children:m})]}),(0,h.jsx)("div",{className:l,children:_})]})]})}},92068:function(e,t,i){"use strict";i.d(t,{SV:function(){return X},ZP:function(){return Z}});var n=i(82242),r=i.n(n),s=i(37205),o=i.n(s),a=i(91232),l=i.n(a),c=i(79800),u=i.n(c),h=i(39647),d=i.n(h),f=i(7557),p=i.n(f),_=i(41498),g=i.n(_),m=i(59301),v=i(76374),y=["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"],b={quickKey:[{label:"main",content:["public static void main(String[] args) {","\t$0","}"].join("\n")},{label:"System.out.println",content:["System.out.println($0)"].join("\n")},{label:"System.out.print",content:["System.out.print($0)"].join("\n")}],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"]},S={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}) {","\t$0","} else {","\t","}"].join("\n")},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {","\t$0","}"].join("\n")},{label:"if",content:["if () {","\t$0","}"].join("\n")},{label:"for",content:["for(int j=0 ; j<10; j++){","\t$0","}"].join("\n")},{label:"trycatch",content:["try{","\t$0","}catch(ExceptionName e){","}"].join("\n")},{label:"using namespace std;",content:["using namespace std;"].join("\n")},{label:"include <iostream>",content:["#include <iostream>"].join("\n")},{label:"include <vector>",content:["#include <vector>"].join("\n")},{label:"include <cstdio>",content:["#include <cstdio>"].join("\n")},{label:"include <cstring>",content:["#include <cstring>"].join("\n")},{label:"include <sstream>",content:["#include <sstream>"].join("\n")},{label:"include <fstream>",content:["#include <fstream>"].join("\n")},{label:"include <map>",content:["#include <map>"].join("\n")},{label:"include <string>",content:["#include <string>"].join("\n")},{label:"include <cmath>",content:["#include <cmath>"].join("\n")}]},E={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("\n")}]},w={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("\n")}]},C=i(53184),k=i.n(C),T={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"]}},A=function(e,t,i,n){e.languages.registerCompletionItemProvider(t,{provideCompletionItems:function(t,r){var s=t.getWordUntilPosition(r),a={startLineNumber:r.lineNumber,endLineNumber:r.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},l=t.getLineContent(r.lineNumber).substring(s.startColumn-2,s.endColumn),c=function(e,t,i,n){var r=t.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:i.lineNumber,endColumn:i.column});return Array.from(new Set(r.match(/\b\w{2,}\b/g)||[])).map((function(t){return{label:t,kind:e.languages.CompletionItemKind.Text,insertText:t,range:n}}))}(e,t,r,a);return{suggestions:[].concat(o()(c),o()(i.map((function(t){return{label:t,kind:e.languages.CompletionItemKind.Keyword,documentation:t,insertText:t,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}}))),o()(n.map((function(t){return{label:t.label,kind:e.languages.CompletionItemKind.Snippet,documentation:t.content,insertText:l.startsWith("#")?t.content.replace(/#/,""):t.content,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}}))))}}})},x=i(82100),D=i.n(x),L=i(29186),R=i.n(L),I=i(85573),P=i.n(I),O=function(){function e(t,i,n){var r=this;D()(this,e),this.placeholder=t,this.editor=i,this.monaco=n,i.onDidChangeModelContent((function(){return r.onDidChangeModelContent()})),this.onDidChangeModelContent()}return R()(e,[{key:"onDidChangeModelContent",value:function(){""===this.editor.getValue()?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}},{key:"getId",value:function(){return e.ID}},{key:"getDomNode",value:function(){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}},{key:"getPosition",value:function(){return{position:{lineNumber:1,column:1},preference:[this.monaco.editor.ContentWidgetPositionPreference.EXACT]}}},{key:"dispose",value:function(){this.editor.removeContentWidget(this)}}]),e}();P()(O,"ID","editor.widget.placeholderHint");var M=O,F=i(96236),B=i(6767),N=i(25399),U=i(89392),H=i(70717),j=i(56102),$=i(37712),G=["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"];function z(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}function K(){}var W={"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 q(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e;if(Array.isArray(e)){for(var i=0;i<e.length;i++){var n=W[e[i]];if(n)return n}return t[0]}return W[t]||t}var V=null,Y=function(){var e=g()(p()().mark((function e(){return p()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.clipboard.writeText(" ");case 3:console.log("内容已自动复制到剪贴板:"),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.error("自动复制失败:",e.t0);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(){return e.apply(this,arguments)}}(),Z=function(e){var t=e.width,n=void 0===t?"100%":t,s=e.height,a=void 0===s?"100%":s,c=e.value,h=e.language,f=void 0===h?"javascript":h,_=e.style,C=void 0===_?{}:_,x=e.options,D=void 0===x?{}:x,L=e.overrideServices,R=void 0===L?{}:L,I=e.theme,P=void 0===I?"vs-dark":I,O=e.onEditBlur,W=e.isCopy,Z=void 0!==W&&W,X=e.onSave,Q=e.autoHeight,J=void 0!==Q&&Q,ee=e.forbidCopy,te=void 0!==ee&&ee,ie=e.onChange,ne=void 0===ie?K:ie,re=e.editorDidMount,se=void 0===re?K:re,oe=e.onFocus,ae=void 0===oe?K:oe,le=e.onBreakPoint,ce=void 0===le?K:le,ue=e.breakPointValue,he=void 0===ue?[]:ue,de=e.filename,fe=void 0===de?"educoder.txt":de,pe=e.errorLine,_e=e.errorContent,ge=void 0===_e?"":_e,me=e.highlightLine,ve=e.openBreakPoint,ye=void 0!==ve&&ve,be=e.placeholder,Se=void 0===be?"":be,Ee=e.showMiniMap,we=void 0===Ee||Ee,Ce=(d()(e,G),(0,m.useRef)()),ke=(0,m.useRef)({}),Te=(0,m.useRef)(),Ae=(0,m.useRef)(),xe=(0,m.useRef)([]),De=(0,m.useRef)(!1),Le=(0,m.useRef)(),Re=(0,m.useRef)(),Ie=(0,m.useRef)(!1),Pe=(0,m.useState)(!1),Oe=u()(Pe,2),Me=Oe[0],Fe=Oe[1];(0,m.useEffect)((function(){var e=H.Z.subscribe("formatDocument",(function(e){var t,i=ke.current.instance;null==i||null===(t=i.getAction)||void 0===t||t.call(i,"editor.action.formatDocument").run()}));return window.updateMonacoValue=function(e){ne(e)},e}),[]),(0,m.useEffect)((function(){var e,t=ke.current.instance;(Ae.current&&clearTimeout(Ae.current),Ae.current=setTimeout((function(){!function(){var e=ke.current.instance;if(null!=c&&e&&Me){var t=e.getModel();t&&c!==t.getValue()&&(!0,t.setValue(c),e.layout(),!1)}}()}),500),c&&null!=c&&c.length)&&(null==t||null===(e=t.updateOptions)||void 0===e||e.call(t,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(c.split(/\r\n|\r|\n/g).length))+3,5)}))}),[c,Me,ke.current]),(0,m.useEffect)((function(){if(pe&&ke.current&&ke.current.instance){var e=ke.current.instance;e.changeViewZones((function(e){var t=document.createElement("div");t.style.padding="10px 20px",t.style.width="calc(100% - 20px)",t.className="my-error-line-wrp",t.innerHTML=ge,e.addZone({afterLineNumber:pe||11,heightInLines:3,domNode:t})}));var t={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}};e.addOverlayWidget(t),e.revealPositionInCenter({lineNumber:20,column:1})}}),[pe,ke.current,Me]);var Be=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e||""===e.trim())return!0;for(var i=ke.current.instance.getModel(),n=i.getLineTokens(t),r=!1,s=0;s<2;s++)1===n.getStandardTokenType(s)&&(r=!0);return r};function Ne(e){(window.navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&83==e.keyCode&&(e.preventDefault(),X())}(0,m.useEffect)((function(){var e,t=null===(e=ke.current)||void 0===e?void 0:e.instance;if(t&&Me&&te){var i=t.onDidBlurEditorWidget((function(){Ie.current=!1})),n=t.onDidFocusEditorText((function(){Ie.current=!0}));return function(){i.dispose(),n.dispose()}}}),[ke.current,Me,te]),(0,m.useEffect)((function(){var e;if(null!==(e=ke.current)&&void 0!==e&&e.instance&&Me&&ye){var t=ke.current.instance,i=t.getModel();if(!i)return;!function(){var e,n=[],r=[],s=i.getAllDecorations(),o=l()(s);try{for(o.s();!(e=o.n()).done;){var a,c=e.value;if("highlighted-line"===c.options.className)n.push(null==c||null===(a=c.range)||void 0===a?void 0:a.startLineNumber),r.push(null==c?void 0:c.id)}}catch(e){o.e(e)}finally{o.f()}if(me!==n[0]){i.deltaDecorations(r,[]);var u=i.getLineCount();me&&me<=u&&(t.deltaDecorations([],[{range:new V.Range(me,1,me,i.getLineMaxColumn(me)),options:{isWholeLine:!0,className:"highlighted-line"}}]),t.revealLineInCenter(me))}}();var n=function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=[],r=[],s=i.getAllDecorations(),o=l()(s);try{for(o.s();!(e=o.n()).done;){var a,c=e.value;if("breakpoints-select"===c.options.linesDecorationsClassName)n.push(null==c||null===(a=c.range)||void 0===a?void 0:a.startLineNumber),r.push(null==c?void 0:c.id)}}catch(e){o.e(e)}finally{o.f()}if(t)return{lines:n,ids:r};ce(n)},r=function(){var e=g()(p()().mark((function e(t){var r;return p()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={range:new V.Range(t,1,t,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}},e.next=3,i.deltaDecorations([],[r]);case 3:n();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),s=function(){var e=g()(p()().mark((function e(r){var s,o,a,c,u;return p()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=[],o=t.getLineDecorations(r),a=l()(o);try{for(a.s();!(c=a.n()).done;)"breakpoints-select"===(u=c.value).options.linesDecorationsClassName&&s.push(u.id)}catch(e){a.e(e)}finally{a.f()}return e.next=6,i.deltaDecorations(s,[]);case 6:n();case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o=function(e){var i,n=t.getLineDecorations(e),r=l()(n);try{for(r.s();!(i=r.n()).done;){if("breakpoints-select"===i.value.options.linesDecorationsClassName)return!0}}catch(e){r.e(e)}finally{r.f()}return!1};if(!(0,U.isEqual)(he,n(!0).lines)){i.deltaDecorations(n(!0).ids,[]);var a=he.map((function(e){return{range:new V.Range(e,1,e,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}}));i.deltaDecorations([],a)}var c=t.onDidChangeModelContent((function(e){var a=t.getPosition();if(a){var l=a.lineNumber;clearTimeout(Re.current),Re.current=setTimeout((function(){Be(i.getLineContent(l),l)?s(l):o(l)?(s(l),r(l)):n()}),100)}})),u=t.onMouseDown((function(e){var t;if(e.target.detail&&null!==(t=e.target)&&void 0!==t&&null!==(t=t.element)&&void 0!==t&&null!==(t=t.className)&&void 0!==t&&t.includes("line-numbers")){var n=e.target.position.lineNumber;if(Be(i.getLineContent(n),n))return;o(n)?s(n):r(n)}})),h=function(){xe.current=t.deltaDecorations(xe.current,[])},d=t.onMouseMove((function(e){var n;if(h(),e.target.detail&&null!==(n=e.target)&&void 0!==n&&null!==(n=n.element)&&void 0!==n&&null!==(n=n.className)&&void 0!==n&&n.includes("line-numbers")){var r=e.target.position.lineNumber;if(Be(i.getLineContent(r),r))return;!function(e){var i={range:new V.Range(e,1,e,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};xe.current=t.deltaDecorations(xe.current,[i])}(r)}})),f=t.onMouseLeave((function(){h()}));return function(){c.dispose(),u.dispose(),d.dispose(),f.dispose()}}}),[ke.current,Me,he,me,ye,f]),(0,m.useEffect)((function(){var e;null!==(e=ke.current)&&void 0!==e&&e.instance&&ye&&ke.current.instance.setPosition({lineNumber:0,column:0})}),[me]);var Ue=function(){if(J&&ke.current.instance){var e=ke.current.instance.getContentHeight();Ve(e<a?a:e)}else Ve(a)};var He=function(e){if(Ie.current){var t=e.keyCode,i=e.ctrlKey,n=e.metaKey,r=e.target;return"paste"!==e.type&&(67!==t&&86!==t||!n&&!i)||"TEXTAREA"!==r.nodeName||(B.ZP.warning({content:decodeURIComponent("该任务关卡设置了禁止复制粘贴,请手动输入代码。"),key:"monaco-editor-tip"}),e.preventDefault()),!1}};function je(e,t){var i,n,r=window.URL||window.webkitURL||window,s=new Blob([t]),o=document.createElementNS("http://www.w3.org/1999/xhtml","a");o.href=r.createObjectURL(s),o.download=e,i=o,(n=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(n)}(0,m.useEffect)((function(){Ue()}),[Ue]),(0,m.useEffect)((function(){Ce.current&&!Me&&Promise.all([i.e(8909),i.e(5028)]).then(i.bind(i,71448)).then((function(e){try{V=e,ke.current.instance=V.editor.create(Ce.current,{value:c,language:q(f),theme:P,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:we||!1}},R);var t=ke.current.instance,i=F.BH._menuItems,n=o()(i).find((function(e){return"EditorContext"==e[0]._debugName}))[1];if(se(t,V),setTimeout((function(){Ue(),ke.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){je(fe||"educoder.txt",t.getValue())}})}),500),ke.current.subscription=t.onDidChangeModelContent((function(e){De.current?clearTimeout(Le.current):(Ue(),ne(t.getValue(),e)),Le.current=setTimeout((function(){De.current=!1}),500)})),window.Monaco||function(e){T.languages.forEach((function(t){e.languages.registerDocumentFormattingEditProvider(t,{provideDocumentFormattingEdits:function(e){return g()(p()().mark((function t(){var i;return p()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=k()(e.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}),t.abrupt("return",[{range:e.getFullModelRange(),text:i}]);case 2:case"end":return t.stop()}}),t)})))()}})})),A(e,"java",b.keywords,b.quickKey),A(e,"cpp",S.keywords,S.quickKey),A(e,"c",y,[]),A(e,"python",E.keywords,E.quickKey),A(e,"scala",w.keywords,w.quickKey)}(V,q(f)),te&&(!function(e,t){var i=e._first;do{var n;t.includes(null===(n=i.element)||void 0===n||null===(n=n.command)||void 0===n?void 0:n.id)&&e._remove(i)}while(i=i.next)}(n,["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"]),Ce.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",He),window.removeEventListener("paste",He),window.addEventListener("keydown",He),window.addEventListener("paste",He)),window.Monaco=V,O&&t.onDidBlurEditorWidget((function(){O(t.getValue())})),ae&&t.onDidFocusEditorText((function(){te&&Y(),ae(t.getValue())})),te){Y();try{t.onDidPaste((function(e){var i=t.getSelection(),n=ke.current.pastePos||{};new V.Range(n.startLineNumber||i.endLineNumber,n.startColumn||i.endColumn,n.endLineNumber||i.endLineNumber,n.endColumn||i.endColumn);t.executeEdits("",[{range:e.range,text:""}])}))}catch(e){}}var r=function(){var e;return Ce.current&&(e=new v.Z((function(e){var t,i=l()(e);try{for(i.s();!(t=i.n()).done;){var n=t.value;(n.target.offsetHeight>0||n.target.offsetWidth>0)&&ke.current.instance.layout()}}catch(e){i.e(e)}finally{i.f()}}))).observe(Ce.current),e}();return Se&&"string"==typeof Se&&new M(Se,t,V),Fe(!0),function(){var e=ke.current.instance;e.dispose();var t=e.getModel();t&&t.dispose(),ke.current.subscription&&ke.current.subscription.dispose(),r.unobserve(Ce.current)}}catch(e){}}))}),[]),(0,m.useEffect)((function(){if(ke.current.instance&&Me)return document.addEventListener("keydown",Ne,!1),function(){document.removeEventListener("keydown",Ne)}}),[X,Me]),(0,m.useEffect)((function(){var e=ke.current.instance;if(e&&Me){var t=q(f);V.editor.setModelLanguage(e.getModel(),t)}}),[f,Me]),(0,m.useEffect)((function(){ke.current.instance&&Me&&V.editor.setTheme(P)}),[P,Me]),(0,m.useEffect)((function(){var e=ke.current.instance;Te.current=D,e&&Me&&(e.updateOptions(r()({},D)),setTimeout((function(){e.getModel().updateOptions(r()({},D))}),200))}),[JSON.stringify(D),Me]),(0,m.useEffect)((function(){var e=ke.current.instance;e&&Me&&e.layout()}),[n,a,Me]);var $e=(0,m.useState)(z(n)),Ge=u()($e,2),ze=Ge[0],Ke=(Ge[1],(0,m.useState)(z(a))),We=u()(Ke,2),qe=We[0],Ve=We[1],Ye=r()(r()({},C),{},{width:ze,height:qe,position:"relative"});return(0,$.jsx)("div",{className:"my-monaco-editor",ref:Ce,style:Ye,children:Z&&(0,$.jsx)(j.CopyToClipboard,{text:c,onCopy:function(){return B.ZP.success("复制成功")},children:(0,$.jsx)(N.Z,{title:"复制代码",children:(0,$.jsxs)("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"},children:[(0,$.jsx)("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," 复制代码"]})})})})};function X(e){var t=e.width,n=void 0===t?"100%":t,s=e.height,o=void 0===s?"100%":s,a=e.original,c=e.modified,h=e.language,d=e.options,f=void 0===d?{}:d,p=(0,m.useRef)(),_=(0,m.useState)(null),g=u()(_,2),y=g[0],b=g[1];(0,m.useEffect)((function(){return p.current&&Promise.all([i.e(8909),i.e(9404)]).then(i.bind(i,2550)).then((function(e){var t=(V=e).editor.createDiffEditor(p.current,r()(r()({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},f),{},{wordWrap:!0}));b(t);var i=function(e){var t;return p.current&&(t=new v.Z((function(t){var i,n=l()(t);try{for(n.s();!(i=n.n()).done;){var r=i.value;(r.target.offsetHeight>0||r.target.offsetWidth>0)&&e.layout()}}catch(e){n.e(e)}finally{n.f()}}))).observe(p.current),t}(t);return function(){t.dispose();var e=t.getModel();e&&e.dispose(),i.unobserve(p.current)}})),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}}),[]),(0,m.useEffect)((function(){y&&y.setModel({original:V.editor.createModel(a,h),modified:V.editor.createModel(c,h)})}),[a,c,h,y]);var S={width:z(n),height:z(o)};return(0,$.jsx)("div",{className:"my-diff-editor",ref:p,style:S})}},97140:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return S}});var n=i(7557),r=i.n(n),s=i(41498),o=i.n(s),a=i(79800),l=i.n(a),c=i(59301),u=i(12085),h=i(91689),d=i(53260),f=i(29787),p=i(28953),_=i(86009),g=i(92068),m=i(24334),v=i(56656),y=i.n(v),b=i(37712),S=function(){var e=(0,d.useParams)(),t=e.submitId,i=e.id,n=(0,c.useState)(void 0),s=l()(n,2),a=s[0],v=s[1];console.log((0,d.useLocation)(),33);var S=(0,d.useLocation)();(0,c.useEffect)((function(){return(0,d.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!1}),(0,d.getDvaApp)()._store.dispatch({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),function(){(0,d.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!0}),(0,d.getDvaApp)()._store.dispatch({type:"globalSetting/onlyShowBackTopToggle",payload:!1})}}),[]),(0,c.useEffect)((function(){document.title="在线刷题"})),(0,c.useEffect)((function(){if(t){var e=function(){var e=o()(r()().mark((function e(){var i;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,p.X6)(t);case 2:i=e.sent,v(i.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}}),[t]);var E=a||{},w=E.status,C=E.created_at,k=E.code,T=E.name,A=E.language,x=E.pass_sets_count,D=E.set_count,L=E.error_msg,R=E.output,I=E.input,P=E.expected_output,O=(E.execute_memory,E.user),M=E.execute_time,F=E.input_file_url,B=E.output_file_url,N=E.is_file,U=E.expected_output_file_url;return(0,b.jsx)(f.Z,{spinning:!a,delay:500,children:(0,b.jsx)("div",{className:"record-detail-info",children:a?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("header",{className:u.Z.header,children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("img",{src:"".concat(h.Z.IMG_SERVER,"/images/").concat(O.image_url),alt:"user",width:30}),(0,b.jsx)("span",{children:O.name})]}),(0,b.jsxs)("h2",{children:[" ",T," "]}),(0,b.jsx)("button",{className:"ant-btn",onClick:function(){var e;d.history.push("/problems/".concat(i,"/oj/").concat(null==S||null===(e=S.query)||void 0===e?void 0:e.backId,"?tab=1"))},style:{border:"1px solid #bacffe",color:"#3061d0"},children:"返回该题"})]}),(0,b.jsxs)("div",{className:"record-detail-body",children:[(0,b.jsx)("h2",{children:" 提交记录 "}),(0,b.jsxs)("ul",{className:"record-info",children:[(0,b.jsxs)("li",{children:[" 状态:",(0,b.jsx)("span",{className:0===w?"c-green":"c-red",children:_.Im[w]})," "]}),(0,b.jsxs)("li",{children:[" 提交时间:",(0,b.jsx)("span",{children:y()(C).format("YYYY-MM-DD HH:mm:ss")})," "]}),(0,b.jsxs)("li",{children:[" 语言:",(0,b.jsx)("span",{children:A})," "]}),(0,b.jsxs)("li",{children:[" 执行用时:",(0,b.jsxs)("span",{children:[1e3*M,"ms"]})," "]}),(0,b.jsxs)("li",{children:[" ","".concat(x," / ").concat(D," 个通过的测试用例")," "]})]}),(0,_.gZ)({status:w,error_msg:L,execute_time:M,output:R,input:I,expected_output:P,input_file_url:F,output_file_url:B,is_file:N,expected_output_file_url:U}),(0,b.jsx)("h2",{children:" 提交的内容 "}),(0,b.jsx)(g.ZP,{height:"200px",width:"100%",language:null==A?void 0:A.toLocaleLowerCase(),value:m.Base64.decode(k),options:{readOnly:!0}})]})]}):null})})}},86009:function(e,t,i){"use strict";i.d(t,{Im:function(){return T},ZP:function(){return I},gZ:function(){return L}});var n=i(79800),r=i.n(n),s=i(82242),o=i.n(s),a=i(85573),l=i.n(a),c=i(59301),u=i(37568),h=i(99571),d=i(84105),f=i(87395),p=i(42826),_=i(24334),g=i(48049),m=i(74889),v=i(83287),y=i(96454),b=i(34376),S=i(92310),E=i.n(S),w=i(37712),C=u.Z.TextArea,k={visible:!1,tabIndex:"0"},T=l()(l()(l()(l()(l()(l()(l()({},p.h.HIDE_COMPILE_STATUS,"暂不支持查看"),p.h.NOMATCH,"测试用例结果不匹配"),p.h.OK,"调试通过"),2,"调试超时"),3,"调试pod失败"),4,"编译失败"),5,"执行失败"),A=function(e){return e[e.SET_VISIBLE=0]="SET_VISIBLE",e[e.SET_TABINDEX=1]="SET_TABINDEX",e}(A||{});function x(e,t){switch(t.type){case A.SET_VISIBLE:return o()(o()({},e),{},{visible:t.payload});case A.SET_TABINDEX:return o()(o()({},e),{},{tabIndex:t.payload});default:throw new Error}}function D(e){var t=e.value,i=e.className,n=(0,c.useState)(!1),s=r()(n,2),o=s[0],a=s[1],l=(0,c.useRef)(),u=(0,c.useRef)();return(0,c.useEffect)((function(){o&&(u.current.reset(),u.current.write((0,v.pp)(t||"")))}),[t,o]),(0,c.useEffect)((function(){if(l.current){var e;u.current=new b.Terminal({fontSize:14,disableStdin:!0}),u.current.open(l.current);var t=l.current.offsetWidth-14,i=(null===(e=u.current)||void 0===e||null===(e=e._core)||void 0===e||null===(e=e._renderService)||void 0===e||null===(e=e.dimensions)||void 0===e?void 0:e.actualCellWidth)||9.5,n=Math.ceil(t/i);u.current.resize(n,8),a(!0)}}),[]),(0,w.jsx)("div",{ref:l,className:E()("XtermText-valueRef",i)})}function L(e){var t=e.status,i=e.error_msg,n=e.output,r=e.input,s=e.expected_output,o=e.is_file,a=e.input_file_url,l=e.output_file_url,c=e.expected_output_file_url,u=null,h={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch(t){case p.h.NOMATCH:u=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("p",{className:"c-red",children:"实际输入:"}),!o&&(0,w.jsx)(D,{className:"mb10",value:r}),o&&(0,w.jsx)("div",{style:h,children:(0,w.jsx)("a",{onClick:function(){return(0,v.LR)(a,r)},children:r})}),(0,w.jsx)("p",{className:"c-red",children:"实际输出:"}),!o&&(0,w.jsx)(D,{className:"mb10",value:n&&_.Base64.decode(n)||""}),o&&(0,w.jsx)("div",{style:h,children:(0,w.jsx)("a",{onClick:function(){return(0,v.LR)(l,n)},children:n})}),(0,w.jsx)("p",{className:"c-red",children:"预期输出:"}),!o&&(0,w.jsx)(D,{className:"mb10",value:s&&_.Base64.decode(s)||""}),o&&(0,w.jsx)("div",{style:h,children:(0,w.jsx)("a",{onClick:function(){return(0,v.LR)(c,s)},children:s})})]});break;case p.h.EXECUTEFAILURE:case p.h.COMPILEFAILURE:u=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("p",{children:"最后执行的输入:"}),!o&&(0,w.jsx)(m.Z,{value:r,style:h}),o&&(0,w.jsx)("div",{style:h,children:(0,w.jsx)("a",{onClick:function(){return(0,v.LR)(a,r)},children:r})}),(0,w.jsx)("p",{children:"执行出错信息:"}),(0,w.jsx)("pre",{className:"error",children:_.Base64.decode(i)})]});break;case p.h.PODFAILURE:u=(0,w.jsx)("p",{children:"创建pod失败请稍后重试"});break;case p.h.TIMEOUT:u=(0,w.jsx)("p",{children:"评测超时,请稍后重试"})}return(0,w.jsxs)(w.Fragment,{children:[" ",u," "]})}function R(e){var t=e.status,i=e.error_msg,n=e.execute_time,r=e.output,s=e.input,o=e.expected_output,a=(e.is_file,e.input_file_url,e.output_file_url,e.expected_output_file_url,null);switch(t){case p.h.OK:a=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("p",{children:["执行用时:",n,"秒"]}),(0,w.jsx)("p",{children:"执行结果:"}),(0,w.jsx)("pre",{children:_.Base64.decode(r)})]});break;case p.h.NOMATCH:a=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("p",{children:["输入:",(0,w.jsx)("pre",{children:s})]}),(0,w.jsxs)("p",{children:["输出:",r&&_.Base64.decode(r)]}),(0,w.jsxs)("p",{children:["预期输出:",o&&_.Base64.decode(o)]})]});break;case p.h.EXECUTEFAILURE:case p.h.COMPILEFAILURE:a=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("p",{children:["最后执行的输入:",(0,w.jsx)("pre",{children:s})]}),(0,w.jsx)("p",{children:"执行出错信息:"}),(0,w.jsx)("pre",{className:"error",children:_.Base64.decode(i)})]});break;case p.h.PODFAILURE:a=(0,w.jsx)("p",{children:"创建pod失败请稍后重试"});break;case p.h.TIMEOUT:a=(0,w.jsx)("p",{children:"评测超时,请稍后重试"})}return(0,w.jsxs)(w.Fragment,{children:[" ",a," "]})}var I=function(e){var t=e.id,i=e.is_file,n=e.input,s=e.debuging,o=e.submitting,a=(e.executingMessage,e.debugResult),l=e.onChangeInput,u=e.onDebugCode,p=e.onSubmitCode,_=(0,c.useReducer)(x,k),m=r()(_,2),v=m[0],b=m[1],S=v.visible;v.tabIndex;(0,c.useEffect)((function(){b({type:A.SET_VISIBLE,payload:!1})}),[t]);var E=(0,c.useMemo)((function(){if(a){a.status;return(0,w.jsx)(w.Fragment,{children:R(a)})}return null}),[a]);return(0,w.jsxs)("div",{className:"test-case-panel",children:[(0,w.jsxs)("div",{className:"test-case-panel-body ".concat(S?"active":""),children:[(0,w.jsx)("ul",{className:"s-navs",children:(0,w.jsx)("li",{children:(0,w.jsx)("a",{className:"active",children:"调试代码结果"})})}),(0,w.jsx)(y.Z,{leftTitle:"自定义测试用例",rightTitle:"代码执行结果",style:{height:240},leftNode:(0,w.jsx)(C,{placeholder:"请输入自测用例(如果未填写,首次自测运行时,系统会自动填充第一个非隐藏的文本类型的测试用例)",value:i?"":n,onChange:l}),rightNode:s?(0,w.jsx)(g.Z,{message:"代码执行中..."}):a?E:(0,w.jsx)("p",{style:{color:"#536879"},children:"请填写测试用例的输入值,点击“调试代码”"})})]}),(0,w.jsx)("a",{className:"btn-collapse ".concat(S?"up":""),onClick:function(){b({type:A.SET_VISIBLE,payload:!S})},children:S?(0,w.jsx)(d.Z,{}):(0,w.jsx)(f.Z,{})}),(0,w.jsxs)("footer",{className:"footer",children:[(0,w.jsx)("span",{style:{visibility:"hidden"},children:"控制台"}),(0,w.jsxs)("div",{className:"flex-container",children:[(0,w.jsx)(h.ZP,{id:"oj-prev",className:"btn-blue",type:"ghost",children:"上一题"}),(0,w.jsx)(h.ZP,{id:"oj-next",className:"btn-blue",type:"ghost",children:"下一题"}),(0,w.jsx)(h.ZP,{className:"btn-green",type:"ghost",loading:s,onClick:function(){b({type:A.SET_VISIBLE,payload:!0}),b({type:A.SET_TABINDEX,payload:"1"}),u()},children:"调试代码"}),(0,w.jsx)(h.ZP,{type:"primary",className:"custom-ant-disabled",loading:o,disabled:o,onClick:function(){b({type:A.SET_VISIBLE,payload:!1}),p()},children:"评测并提交"})]})]})]})}},42826:function(e,t,i){"use strict";i.d(t,{h:function(){return n}});var n=function(e){return e[e.NOMATCH=-1]="NOMATCH",e[e.OK=0]="OK",e[e.TIMEOUT=2]="TIMEOUT",e[e.PODFAILURE=3]="PODFAILURE",e[e.COMPILEFAILURE=4]="COMPILEFAILURE",e[e.EXECUTEFAILURE=5]="EXECUTEFAILURE",e[e.HIDE_COMPILE_STATUS=11]="HIDE_COMPILE_STATUS",e}({})},28953:function(e,t,i){"use strict";i.d(t,{H7:function(){return h},KC:function(){return g},M3:function(){return b},MK:function(){return u},MU:function(){return o},Rg:function(){return w},WH:function(){return m},X6:function(){return l},bM:function(){return s},bx:function(){return v},dd:function(){return p},de:function(){return k},fi:function(){return d},fu:function(){return r},gu:function(){return y},n4:function(){return f},qe:function(){return E},rL:function(){return C},rX:function(){return c},uc:function(){return T},vl:function(){return _},wO:function(){return S},zO:function(){return a}});var n=i(94171);function r(e){return(0,n.U2)("mypractices/".concat(e,".json"),{hidePopLogin:!0})}function s(e,t){return(0,n.v_)("mypractices/".concat(e,"/code_submit.json"),t)}function o(e,t){return(0,n.v_)("mypractices/".concat(e,"/code_debug.json"),t)}function a(e,t){return t.language&&(t.language=encodeURIComponent(t.language)),(0,n.U2)("mypractices/".concat(e,"/submit_records.json"),t)}function l(e){return(0,n.U2)("mypractices/record_detail.json",{id:e})}function c(e,t){return(0,n.U2)("mypractices/".concat(e,"/result.json"),{mode:t})}function u(e,t){return(0,n.v_)("mypractices/".concat(e,"/add_notes.json"),t)}function h(e,t){return(0,n.v_)("mypractices/".concat(e,"/restore_initial_code.json"),t)}function d(e,t){return(0,n.v_)("mypractices/".concat(e,"/sync_code.json"),t)}function f(e,t){return(0,n.v_)("mypractices/".concat(e,"/update_code.json"),t)}function p(e){return(0,n.v_)("mypractices/".concat(e,"/initial_codes.json"))}function _(e,t){return(0,n.v_)("discusses/".concat(e,"/plus.json"),t)}function g(e){return(0,n.U2)("practices/practices_list.json",e)}function m(e,t){return(0,n.U2)("practices/".concat(e,"/question_solution_articles"),t)}function v(e,t){return(0,n.v_)("practices/".concat(e,"/question_solution_articles"),t)}function y(e,t){return(0,n.gz)("practices/".concat(e,"/question_solution_articles/").concat(null==t?void 0:t.active),t)}function b(e,t){return(0,n.U2)("practices/".concat(e,"/question_solution_articles/").concat(null==t?void 0:t.active,"/edit"),t)}function S(e,t){return(0,n.U2)("practices/".concat(e,"/question_solution_articles/").concat(null==t?void 0:t.active),t)}function E(e,t){return(0,n.v_)("practices/".concat(e,"/question_solution_articles/").concat(null==t?void 0:t.active,"/set_authority_or_excellent"),t)}function w(e,t){return(0,n.v_)("practices/".concat(e,"/question_solution_articles/").concat(null==t?void 0:t.active,"/praise_or_treads"),t)}function C(e,t){return(0,n.v_)("practices/".concat(e,"/question_solution_articles/").concat(null==t?void 0:t.active,"/hide"))}function k(e,t){return(0,n.IV)("practices/".concat(e,"/question_solution_articles/").concat(null==t?void 0:t.active),t)}function T(e,t){return(0,n.v_)("mypractices/".concat(e,"/update_practice_time_sum"),t)}},75359:function(e,t,i){"use strict";i.d(t,{AL:function(){return w},Iy:function(){return f},Qv:function(){return g},ez:function(){return E},jb:function(){return p}});var n=i(79800),r=i.n(n),s=i(32834),o=i.n(s),a=i(11690),l=1;var c=[],u=["<ul>"],h=new(o().Renderer),d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function f(){c.length=0,u=["<ul>"]}var p={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function _(e,t,i,n){if(t>=e.length||e[t].level<=i)return t;var r=e[t];n.push("<li><a href='#"+l+r.anchor+"'>"+r.text+"</a>");var s=[];return t=_(e,++t,r.level,s),s.length>0&&(n.push("<ul>"),s.forEach((function(e){n.push(e)})),n.push("</ul>")),n.push("</li>"),t=_(e,t,i,n)}function g(){return _(c,0,0,u),u.push("</ul>"),u.join("")}var m={heading:function(e){var t=d.exec(e);if(l+=1,t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}},fences:function(e){var t=this.rules.block.fences.exec(e);if(t){var i=t[0],n=function(e,t){var i=e.match(/^(\s+)(?:```)/);if(null===i)return t;var n=i[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:r()(t,1)[0].length>=n.length?e.slice(n.length):e})).join("\n")}(i,t[3]||""),s=t[2]?t[2].trim():t[2];if(["latex","katex","math"].indexOf(s)>=0){var o=b(),a=n;n=o,S[o]={type:"block",expression:a}}return{type:"code",raw:i,lang:s,text:n}}}},v=/(?:\${2})([^\n`]+?)(?:\${2})/gi,y=0,b=function(){return"__special_katext_id_".concat(y++,"__")},S={};function E(){return S}function w(){y=0,S={}}function C(e){return e=e.replace(v,(function(e,t){var i=b();return S[i]={type:"inline",expression:t},i}))}var k=h.listitem;h.listitem=function(e){return k(C(e))};var T=h.paragraph;h.paragraph=function(e){return T(C(e))};var A=h.tablecell;h.tablecell=function(e,t){return A(C(e),t)},h.code=function(e,t,i){var n=(t||"").match(/\S*/)[0];return n?["latex","katex","math"].indexOf(n)>=0?"<p class='editormd-tex'>".concat(e,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(t,'">').concat(i?e:(0,a.escape)(e,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(i?e:(0,a.escape)(e,!0))+"</code></pre>"},h.heading=function(e,t,i){var n=this.options.headerPrefix+i.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return c.push({anchor:n,level:t,text:e}),"<h"+t+' id="'+l+n+'">'+e+"</h"+t+">"},o().setOptions({silent:!0,gfm:!0,pedantic:!1}),o().use({tokenizer:m,renderer:h}),t.ZP=o()},12085:function(e,t){"use strict";t.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"}},64018:function(){window.PR_SHOULD_USE_CONTINUATION=!0,function(){var e=window,t=["break,continue,do,else,for,if,return,while"],i=[[t,"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"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],n=[i,"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"],r=[i,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],s=[i,"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"],o=[i,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],a="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",l=[t,"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"],c=[t,"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"],u=[t,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],h=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,d="str",f="com",p="typ",_="lit",g="pun",m="pln",v="atv";function y(e,t,i,n,r){if(i){var s={sourceNode:e,pre:1,langExtension:null,numberLines:null,sourceCode:i,spans:null,basePos:t,decorations:null};n(s),r.push.apply(r,s.decorations)}}var b=/\S/;function S(e){for(var t=void 0,i=e.firstChild;i;i=i.nextSibling){var n=i.nodeType;t=1===n?t?e:i:3===n&&b.test(i.nodeValue)?e:t}return t===e?void 0:t}function E(e,t){var i,n={};!function(){for(var r=e.concat(t),s=[],o={},a=0,l=r.length;a<l;++a){var c=r[a],u=c[3];if(u)for(var h=u.length;--h>=0;)n[u.charAt(h)]=c;var d=c[1],f=""+d;o.hasOwnProperty(f)||(s.push(d),o[f]=null)}s.push(/[\0-\uffff]/),i=function(e){for(var t=0,i=!1,n=!1,r=0,s=e.length;r<s;++r)if((d=e[r]).ignoreCase)n=!0;else if(/[a-z]/i.test(d.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){i=!0,n=!1;break}var o={b:8,t:9,n:10,v:11,f:12,r:13};function a(e){var t=e.charCodeAt(0);if(92!==t)return t;var i=e.charAt(1);return(t=o[i])||("0"<=i&&i<="7"?parseInt(e.substring(1),8):"u"===i||"x"===i?parseInt(e.substring(2),16):e.charCodeAt(1))}function l(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);var t=String.fromCharCode(e);return"\\"===t||"-"===t||"]"===t||"^"===t?"\\"+t:t}function c(e){var t=e.substring(1,e.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")),i=[],n="^"===t[0],r=["["];n&&r.push("^");for(var s=n?1:0,o=t.length;s<o;++s){var c=t[s];if(/\\[bdsw]/i.test(c))r.push(c);else{var u,h=a(c);s+2<o&&"-"===t[s+1]?(u=a(t[s+2]),s+=2):u=h,i.push([h,u]),u<65||h>122||(u<65||h>90||i.push([32|Math.max(65,h),32|Math.min(u,90)]),u<97||h>122||i.push([-33&Math.max(97,h),-33&Math.min(u,122)]))}}i.sort((function(e,t){return e[0]-t[0]||t[1]-e[1]}));var d=[],f=[];for(s=0;s<i.length;++s)(p=i[s])[0]<=f[1]+1?f[1]=Math.max(f[1],p[1]):d.push(f=p);for(s=0;s<d.length;++s){var p=d[s];r.push(l(p[0])),p[1]>p[0]&&(p[1]+1>p[0]&&r.push("-"),r.push(l(p[1])))}return r.push("]"),r.join("")}function u(e){for(var n=e.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")),r=n.length,s=[],o=0,a=0;o<r;++o)"("===(h=n[o])?++a:"\\"===h.charAt(0)&&(u=+h.substring(1))&&(u<=a?s[u]=-1:n[o]=l(u));for(o=1;o<s.length;++o)-1===s[o]&&(s[o]=++t);for(o=0,a=0;o<r;++o)if("("===(h=n[o]))s[++a]||(n[o]="(?:");else if("\\"===h.charAt(0)){var u;(u=+h.substring(1))&&u<=a&&(n[o]="\\"+s[u])}for(o=0;o<r;++o)"^"===n[o]&&"^"!==n[o+1]&&(n[o]="");if(e.ignoreCase&&i)for(o=0;o<r;++o){var h,d=(h=n[o]).charAt(0);h.length>=2&&"["===d?n[o]=c(h):"\\"!==d&&(n[o]=h.replace(/[a-zA-Z]/g,(function(e){var t=e.charCodeAt(0);return"["+String.fromCharCode(-33&t,32|t)+"]"})))}return n.join("")}var h=[];for(r=0,s=e.length;r<s;++r){var d;if((d=e[r]).global||d.multiline)throw new Error(""+d);h.push("(?:"+u(d)+")")}return new RegExp(h.join("|"),n?"gi":"g")}(s)}();var r=t.length,s=function(e){for(var o=e.sourceCode,a=e.basePos,l=e.sourceNode,c=[a,m],u=0,h=o.match(i)||[],d={},f=0,p=h.length;f<p;++f){var _,g=h[f],v=d[g],b=void 0;if("string"==typeof v)_=!1;else{var S=n[g.charAt(0)];if(S)b=g.match(S[1]),v=S[0];else{for(var E=0;E<r;++E)if(S=t[E],b=g.match(S[1])){v=S[0];break}b||(v=m)}!(_=v.length>=5&&"lang-"===v.substring(0,5))||b&&"string"==typeof b[1]||(_=!1,v="src"),_||(d[g]=v)}var w=u;if(u+=g.length,_){var C=b[1],k=g.indexOf(C),T=k+C.length;b[2]&&(k=(T=g.length-b[2].length)-C.length);var A=v.substring(5);y(l,a+w,g.substring(0,k),s,c),y(l,a+w+k,C,x(A,C),c),y(l,a+w+T,g.substring(T),s,c)}else c.push(a+w,v)}e.decorations=c};return s}function w(e){var t=[],i=[];e.tripleQuotedStrings?t.push([d,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):e.multiLineStrings?t.push([d,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):t.push([d,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),e.verbatimStrings&&i.push([d,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var n=e.hashComments;n&&(e.cStyleComments?(n>1?t.push([f,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):t.push([f,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),i.push([d,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):t.push([f,/^#[^\r\n]*/,null,"#"])),e.cStyleComments&&(i.push([f,/^\/\/[^\r\n]*/,null]),i.push([f,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var r=e.regexLiterals;if(r){var s=r>1?"":"\n\r",o=s?".":"[\\S\\s]",a="/(?=[^/*"+s+"])(?:[^/\\x5B\\x5C"+s+"]|\\x5C"+o+"|\\x5B(?:[^\\x5C\\x5D"+s+"]|\\x5C"+o+")*(?:\\x5D|$))+/";i.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+a+")")])}var l=e.types;l&&i.push([p,l]);var c=(""+e.keywords).replace(/^ | $/g,"");c.length&&i.push(["kwd",new RegExp("^(?:"+c.replace(/[\s,]+/g,"|")+")\\b"),null]),t.push([m,/^\s+/,null," \r\n\t "]);var u="^.[^\\s\\w.$@'\"`/\\\\]*";return e.regexLiterals&&(u+="(?!s*/)"),i.push([_,/^@[a-z_$][a-z_$@0-9]*/i,null],[p,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[m,/^[a-z_$][a-z_$@0-9]*/i,null],[_,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[m,/^\\[\s\S]?/,null],[g,new RegExp(u),null]),E(t,i)}var C=w({keywords:[n,s,r,o,a,l,c,u],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function k(e,t,i){for(var n=/(?:^|\s)nocode(?:\s|$)/,r=/\r\n?|\n/,s=e.ownerDocument,o=s.createElement("li");e.firstChild;)o.appendChild(e.firstChild);var a=[o];function l(e){var t=e.nodeType;if(1!=t||n.test(e.className)){if((3==t||4==t)&&i){var o=e.nodeValue,a=o.match(r);if(a){var u=o.substring(0,a.index);e.nodeValue=u;var h=o.substring(a.index+a[0].length);if(h)e.parentNode.insertBefore(s.createTextNode(h),e.nextSibling);c(e),u||e.parentNode.removeChild(e)}}}else if("br"===e.nodeName)c(e),e.parentNode&&e.parentNode.removeChild(e);else for(var d=e.firstChild;d;d=d.nextSibling)l(d)}function c(e){for(;!e.nextSibling;)if(!(e=e.parentNode))return;for(var t,i=function e(t,i){var n=i?t.cloneNode(!1):t,r=t.parentNode;if(r){var s=e(r,1),o=t.nextSibling;s.appendChild(n);for(var a=o;a;a=o)o=a.nextSibling,s.appendChild(a)}return n}(e.nextSibling,0);(t=i.parentNode)&&1===t.nodeType;)i=t;a.push(i)}for(var u=0;u<a.length;++u)l(a[u]);t===(0|t)&&a[0].setAttribute("value",t);var h=s.createElement("ol");h.className="linenums";for(var d=Math.max(0,t-1|0)||0,f=(u=0,a.length);u<f;++u)(o=a[u]).className="L"+(u+d)%10,o.firstChild||o.appendChild(s.createTextNode(" ")),h.appendChild(o);e.appendChild(h)}var T={};function A(t,i){for(var n=i.length;--n>=0;){var r=i[n];T.hasOwnProperty(r)?e.console&&console.warn("cannot override language handler %s",r):T[r]=t}}function x(e,t){return e&&T.hasOwnProperty(e)||(e=/^\s*</.test(t)?"default-markup":"default-code"),T[e]}function D(t){var i,n,r,s,o,a,l,c=t.langExtension;try{var u=(i=t.sourceNode,n=t.pre,r=/(?:^|\s)nocode(?:\s|$)/,s=[],o=0,a=[],l=0,function e(t){var i=t.nodeType;if(1==i){if(r.test(t.className))return;for(var c=t.firstChild;c;c=c.nextSibling)e(c);var u=t.nodeName.toLowerCase();"br"!==u&&"li"!==u||(s[l]="\n",a[l<<1]=o++,a[l++<<1|1]=t)}else if(3==i||4==i){var h=t.nodeValue;h.length&&(h=n?h.replace(/\r\n?/g,"\n"):h.replace(/[ \t\r\n]+/g," "),s[l]=h,a[l<<1]=o,o+=h.length,a[l++<<1|1]=t)}}(i),{sourceCode:s.join("").replace(/\n$/,""),spans:a}),h=u.sourceCode;t.sourceCode=h,t.spans=u.spans,t.basePos=0,x(c,h)(t),function(e){var t=/\bMSIE\s(\d+)/.exec(navigator.userAgent);t=t&&+t[1]<=8;var i,n,r=/\n/g,s=e.sourceCode,o=s.length,a=0,l=e.spans,c=l.length,u=0,h=e.decorations,d=h.length,f=0;for(h[d]=o,n=i=0;n<d;)h[n]!==h[n+2]?(h[i++]=h[n++],h[i++]=h[n++]):n+=2;for(d=i,n=i=0;n<d;){for(var p=h[n],_=h[n+1],g=n+2;g+2<=d&&h[g+1]===_;)g+=2;h[i++]=p,h[i++]=_,n=g}d=h.length=i;var m=e.sourceNode,v="";m&&(v=m.style.display,m.style.display="none");try{for(;u<c;){l[u];var y,b=l[u+2]||o,S=h[f+2]||o,E=(g=Math.min(b,S),l[u+1]);if(1!==E.nodeType&&(y=s.substring(a,g))){t&&(y=y.replace(r,"\r")),E.nodeValue=y;var w=E.ownerDocument,C=w.createElement("span");C.className=h[f+1];var k=E.parentNode;k.replaceChild(C,E),C.appendChild(E),a<b&&(l[u+1]=E=w.createTextNode(s.substring(g,b)),k.insertBefore(E,C.nextSibling))}(a=g)>=b&&(u+=2),a>=S&&(f+=2)}}finally{m&&(m.style.display=v)}}(t)}catch(t){e.console&&console.log(t&&t.stack||t)}}function L(e,t,i){var n=i||!1,r=t||null,s=document.createElement("div");return s.innerHTML="<pre>"+e+"</pre>",s=s.firstChild,n&&k(s,n,!0),D({langExtension:r,numberLines:n,sourceNode:s,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null}),s.innerHTML}function R(t,i){var n=i||document.body,r=n.ownerDocument||document;function s(e){return n.getElementsByTagName(e)}for(var o=[s("pre"),s("code"),s("xmp")],a=[],l=0;l<o.length;++l)for(var c=0,u=o[l].length;c<u;++c)a.push(o[l][c]);o=null;var h=Date;h.now||(h={now:function(){return+new Date}});var d=0,f=/\blang(?:uage)?-([\w.]+)(?!\S)/,p=/\bprettyprint\b/,_=/\bprettyprinted\b/,g=/pre|xmp/i,m=/^code$/i,v=/^(?:pre|code|xmp)$/i,y={};!function i(){for(var n=e.PR_SHOULD_USE_CONTINUATION?h.now()+250:1/0;d<a.length&&h.now()<n;d++){for(var s=a[d],o=y,l=s;l=l.previousSibling;){var c=l.nodeType,u=(7===c||8===c)&&l.nodeValue;if(u?!/^\??prettify\b/.test(u):3!==c||/\S/.test(l.nodeValue))break;if(u){o={},u.replace(/\b(\w+)=([\w:.%+-]+)/g,(function(e,t,i){o[t]=i}));break}}var b=s.className;if((o!==y||p.test(b))&&!_.test(b)){for(var E=!1,w=s.parentNode;w;w=w.parentNode){var C=w.tagName;if(v.test(C)&&w.className&&p.test(w.className)){E=!0;break}}if(!E){s.className+=" prettyprinted";var T,A,x=o.lang;if(!x)!(x=b.match(f))&&(T=S(s))&&m.test(T.tagName)&&(x=T.className.match(f)),x&&(x=x[1]);if(g.test(s.tagName))A=1;else{var L=s.currentStyle,R=r.defaultView,I=L?L.whiteSpace:R&&R.getComputedStyle?R.getComputedStyle(s,null).getPropertyValue("white-space"):0;A=I&&"pre"===I.substring(0,3)}var P=o.linenums;(P="true"===P||+P)||(P=!!(P=b.match(/\blinenums\b(?::(\d+))?/))&&(!P[1]||!P[1].length||+P[1])),P&&k(s,P,A),D({langExtension:x,sourceNode:s,numberLines:P,pre:A,sourceCode:null,basePos:null,spans:null,decorations:null})}}}d<a.length?e.setTimeout(i,250):"function"==typeof t&&t()}()}A(C,["default-code"]),A(E([],[[m,/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],[f,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[g,/^(?:<[%?]|[%?]>)/],["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"]),A(E([[m,/^[\s]+/,null," \t\r\n"],[v,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[g,/^[=<>\/]+/],["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"]),A(E([],[[v,/^[\s\S]+/]]),["uq.val"]),A(w({keywords:n,hashComments:!0,cStyleComments:!0,types:h}),["c","cc","cpp","cxx","cyc","m"]),A(w({keywords:"null,true,false"}),["json"]),A(w({keywords:s,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:h}),["cs"]),A(w({keywords:r,cStyleComments:!0}),["java"]),A(w({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),A(w({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),A(w({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),A(w({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),A(w({keywords:o,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),A(w({keywords:"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",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),A(E([],[[d,/^[\s\S]+/]]),["regex"]);var I=e.PR={createSimpleLexer:E,registerLangHandler:A,sourceDecorator:w,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:v,PR_COMMENT:f,PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:_,PR_NOCODE:"nocode",PR_PLAIN:m,PR_PUNCTUATION:g,PR_SOURCE:"src",PR_STRING:d,PR_TAG:"tag",PR_TYPE:p,prettyPrintOne:L,prettyPrint:R},P=e.define;"function"==typeof P&&P.amd&&P("google-code-prettify",[],(function(){return I}))}()},25769:function(e,t,i){"use strict";var n=i(98040),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var i,s,o,a,l,c,u=!1;t||(t={}),i=t.debug||!1;try{if(o=n(),a=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var s=r[t.format]||r.default;window.clipboardData.setData(s,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(c),a.selectNodeContents(c),l.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(n){i&&console.error("unable to copy using execCommand: ",n),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(n){i&&console.error("unable to copy using clipboardData: ",n),i&&console.error("falling back to prompt"),s=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(s,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(a):l.removeAllRanges()),c&&document.body.removeChild(c),o()}return u}},24334:function(e,t,i){var n,r;r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i.g?i.g:this,e.exports=function(i){"use strict";var r,s=(i=i||{}).Base64,o="2.6.4",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=function(e){for(var t={},i=0,n=e.length;i<n;i++)t[e.charAt(i)]=i;return t}(a),c=String.fromCharCode,u=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?c(192|t>>>6)+c(128|63&t):c(224|t>>>12&15)+c(128|t>>>6&63)+c(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return c(240|t>>>18&7)+c(128|t>>>12&63)+c(128|t>>>6&63)+c(128|63&t)},h=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,d=function(e){return e.replace(h,u)},f=function(e){var t=[0,2,1][e.length%3],i=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[a.charAt(i>>>18),a.charAt(i>>>12&63),t>=2?"=":a.charAt(i>>>6&63),t>=1?"=":a.charAt(63&i)].join("")},p=i.btoa&&"function"==typeof i.btoa?function(e){return i.btoa(e)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,f)},_=function(e){return p(d(String(e)))},g=function(e){return e.replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,"")},m=function(e,t){return t?g(_(e)):_(e)},v=function(e){return m(e,!0)};i.Uint8Array&&(r=function(e,t){for(var i="",n=0,r=e.length;n<r;n+=3){var s=e[n],o=e[n+1],l=e[n+2],c=s<<16|o<<8|l;i+=a.charAt(c>>>18)+a.charAt(c>>>12&63)+(void 0!==o?a.charAt(c>>>6&63):"=")+(void 0!==l?a.charAt(63&c):"=")}return t?g(i):i});var y,b=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,S=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return c(55296+(t>>>10))+c(56320+(1023&t));case 3:return c((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return c((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},E=function(e){return e.replace(b,S)},w=function(e){var t=e.length,i=t%4,n=(t>0?l[e.charAt(0)]<<18:0)|(t>1?l[e.charAt(1)]<<12:0)|(t>2?l[e.charAt(2)]<<6:0)|(t>3?l[e.charAt(3)]:0),r=[c(n>>>16),c(n>>>8&255),c(255&n)];return r.length-=[0,0,2,1][i],r.join("")},C=i.atob&&"function"==typeof i.atob?function(e){return i.atob(e)}:function(e){return e.replace(/\S{1,4}/g,w)},k=function(e){return C(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},T=function(e){return E(C(e))},A=function(e){return String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},x=function(e){return T(A(e))};i.Uint8Array&&(y=function(e){return Uint8Array.from(k(A(e)),(function(e){return e.charCodeAt(0)}))});var D=function(){var e=i.Base64;return i.Base64=s,e};if(i.Base64={VERSION:o,atob:k,btoa:p,fromBase64:x,toBase64:m,utob:d,encode:m,encodeURI:v,btou:E,decode:x,noConflict:D,fromUint8Array:r,toUint8Array:y},"function"==typeof Object.defineProperty){var L=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};i.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",L((function(){return x(this)}))),Object.defineProperty(String.prototype,"toBase64",L((function(e){return m(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",L((function(){return m(this,!0)})))}}return i.Meteor&&(Base64=i.Base64),e.exports?e.exports.Base64=i.Base64:void 0===(n=function(){return i.Base64}.apply(t,[]))||(e.exports=n),{Base64:i.Base64}}(r)},53184:function(e,t,i){"use strict";var n,r;n=[i(58553),i(87804),i(40998)],void 0===(r=function(e,t,i){return function(e,t,i){var n=function(t,i){return e.js_beautify(t,i)};return n.js=e.js_beautify,n.css=t.css_beautify,n.html=i.html_beautify,n.js_beautify=e.js_beautify,n.css_beautify=t.css_beautify,n.html_beautify=i.html_beautify,n}(e,t,i)}.apply(t,n))||(e.exports=r)},87804:function(e,t){var i;!function(){var n;!function(){"use strict";var e=[,,function(e){function t(e){this.__parent=e,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=[]}function i(e,t){this.__cache=[""],this.__indent_size=e.indent_size,this.__indent_string=e.indent_char,e.indent_with_tabs||(this.__indent_string=new Array(e.indent_size+1).join(e.indent_char)),t=t||"",e.indent_level>0&&(t=new Array(e.indent_level+1).join(this.__indent_string)),this.__base_string=t,this.__base_string_length=t.length}function n(e,n){this.__indent_cache=new i(e,n),this.raw=!1,this._end_with_newline=e.end_with_newline,this.indent_size=e.indent_size,this.wrap_line_length=e.wrap_line_length,this.indent_empty_lines=e.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new t(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}t.prototype.clone_empty=function(){var e=new t(this.__parent);return e.set_indent(this.__indent_count,this.__alignment_count),e},t.prototype.item=function(e){return e<0?this.__items[this.__items.length+e]:this.__items[e]},t.prototype.has_match=function(e){for(var t=this.__items.length-1;t>=0;t--)if(this.__items[t].match(e))return!0;return!1},t.prototype.set_indent=function(e,t){this.is_empty()&&(this.__indent_count=e||0,this.__alignment_count=t||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},t.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)},t.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},t.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var e=this.__parent.current_line;return e.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),e.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),e.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===e.__items[0]&&(e.__items.splice(0,1),e.__character_count-=1),!0}return!1},t.prototype.is_empty=function(){return 0===this.__items.length},t.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},t.prototype.push=function(e){this.__items.push(e);var t=e.lastIndexOf("\n");-1!==t?this.__character_count=e.length-t:this.__character_count+=e.length},t.prototype.pop=function(){var e=null;return this.is_empty()||(e=this.__items.pop(),this.__character_count-=e.length),e},t.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},t.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},t.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},t.prototype.toString=function(){var e="";return this.is_empty()?this.__parent.indent_empty_lines&&(e=this.__parent.get_indent_string(this.__indent_count)):(e=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),e+=this.__items.join("")),e},i.prototype.get_indent_size=function(e,t){var i=this.__base_string_length;return t=t||0,e<0&&(i=0),i+=e*this.__indent_size,i+=t},i.prototype.get_indent_string=function(e,t){var i=this.__base_string;return t=t||0,e<0&&(e=0,i=""),t+=e*this.__indent_size,this.__ensure_cache(t),i+=this.__cache[t]},i.prototype.__ensure_cache=function(e){for(;e>=this.__cache.length;)this.__add_column()},i.prototype.__add_column=function(){var e=this.__cache.length,t=0,i="";this.__indent_size&&e>=this.__indent_size&&(e-=(t=Math.floor(e/this.__indent_size))*this.__indent_size,i=new Array(t+1).join(this.__indent_string)),e&&(i+=new Array(e+1).join(" ")),this.__cache.push(i)},n.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},n.prototype.get_line_number=function(){return this.__lines.length},n.prototype.get_indent_string=function(e,t){return this.__indent_cache.get_indent_string(e,t)},n.prototype.get_indent_size=function(e,t){return this.__indent_cache.get_indent_size(e,t)},n.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},n.prototype.add_new_line=function(e){return!(this.is_empty()||!e&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},n.prototype.get_code=function(e){this.trim(!0);var t=this.current_line.pop();t&&("\n"===t[t.length-1]&&(t=t.replace(/\n+$/g,"")),this.current_line.push(t)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join("\n");return"\n"!==e&&(i=i.replace(/[\n]/g,e)),i},n.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},n.prototype.set_indent=function(e,t){return e=e||0,t=t||0,this.next_line.set_indent(e,t),this.__lines.length>1?(this.current_line.set_indent(e,t),!0):(this.current_line.set_indent(),!1)},n.prototype.add_raw_token=function(e){for(var t=0;t<e.newlines;t++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(e.whitespace_before),this.current_line.push(e.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},n.prototype.add_token=function(e){this.__add_space_before_token(),this.current_line.push(e),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},n.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(" "))},n.prototype.remove_indent=function(e){for(var t=this.__lines.length;e<t;)this.__lines[e]._remove_indent(),e++;this.current_line._remove_wrap_indent()},n.prototype.trim=function(e){for(e=void 0!==e&&e,this.current_line.trim();e&&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},n.prototype.just_added_newline=function(){return this.current_line.is_empty()},n.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},n.prototype.ensure_empty_line_above=function(e,i){for(var n=this.__lines.length-2;n>=0;){var r=this.__lines[n];if(r.is_empty())break;if(0!==r.item(0).indexOf(e)&&r.item(-1)!==i){this.__lines.splice(n+1,0,new t(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},e.exports.Output=n},,,,function(e){function t(e,t){this.raw_options=i(e,t),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","\t"===this.indent_char),this.indent_with_tabs&&(this.indent_char="\t",1===this.indent_size&&(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"])}function i(e,t){var i,r={};for(i in e=n(e))i!==t&&(r[i]=e[i]);if(t&&e[t])for(i in e[t])r[i]=e[t][i];return r}function n(e){var t,i={};for(t in e){i[t.replace(/-/g,"_")]=e[t]}return i}t.prototype._get_array=function(e,t){var i=this.raw_options[e],n=t||[];return"object"==typeof i?null!==i&&"function"==typeof i.concat&&(n=i.concat()):"string"==typeof i&&(n=i.split(/[^a-zA-Z0-9_\/\-]+/)),n},t.prototype._get_boolean=function(e,t){var i=this.raw_options[e];return void 0===i?!!t:!!i},t.prototype._get_characters=function(e,t){var i=this.raw_options[e],n=t||"";return"string"==typeof i&&(n=i.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),n},t.prototype._get_number=function(e,t){var i=this.raw_options[e];t=parseInt(t,10),isNaN(t)&&(t=0);var n=parseInt(i,10);return isNaN(n)&&(n=t),n},t.prototype._get_selection=function(e,t,i){var n=this._get_selection_list(e,t,i);if(1!==n.length)throw new Error("Invalid Option Value: The option '"+e+"' can only be one of the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return n[0]},t.prototype._get_selection_list=function(e,t,i){if(!t||0===t.length)throw new Error("Selection list cannot be empty.");if(i=i||[t[0]],!this._is_valid_selection(i,t))throw new Error("Invalid Default Value!");var n=this._get_array(e,i);if(!this._is_valid_selection(n,t))throw new Error("Invalid Option Value: The option '"+e+"' can contain only the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return n},t.prototype._is_valid_selection=function(e,t){return e.length&&t.length&&!e.some((function(e){return-1===t.indexOf(e)}))},e.exports.Options=t,e.exports.normalizeOpts=n,e.exports.mergeOpts=i},,function(e){var t=RegExp.prototype.hasOwnProperty("sticky");function i(e){this.__input=e||"",this.__input_length=this.__input.length,this.__position=0}i.prototype.restart=function(){this.__position=0},i.prototype.back=function(){this.__position>0&&(this.__position-=1)},i.prototype.hasNext=function(){return this.__position<this.__input_length},i.prototype.next=function(){var e=null;return this.hasNext()&&(e=this.__input.charAt(this.__position),this.__position+=1),e},i.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&(t=this.__input.charAt(e)),t},i.prototype.__match=function(e,i){e.lastIndex=i;var n=e.exec(this.__input);return!n||t&&e.sticky||n.index!==i&&(n=null),n},i.prototype.test=function(e,t){return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&!!this.__match(e,t)},i.prototype.testChar=function(e,t){var i=this.peek(t);return e.lastIndex=0,null!==i&&e.test(i)},i.prototype.match=function(e){var t=this.__match(e,this.__position);return t?this.__position+=t[0].length:t=null,t},i.prototype.read=function(e,t,i){var n,r="";return e&&(n=this.match(e))&&(r+=n[0]),!t||!n&&e||(r+=this.readUntil(t,i)),r},i.prototype.readUntil=function(e,t){var i,n=this.__position;e.lastIndex=this.__position;var r=e.exec(this.__input);return r?(n=r.index,t&&(n+=r[0].length)):n=this.__input_length,i=this.__input.substring(this.__position,n),this.__position=n,i},i.prototype.readUntilAfter=function(e){return this.readUntil(e,!0)},i.prototype.get_regexp=function(e,i){var n=null,r="g";return i&&t&&(r="y"),"string"==typeof e&&""!==e?n=new RegExp(e,r):e&&(n=new RegExp(e.source,r)),n},i.prototype.get_literal_regexp=function(e){return RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},i.prototype.peekUntilAfter=function(e){var t=this.__position,i=this.readUntilAfter(e);return this.__position=t,i},i.prototype.lookBack=function(e){var t=this.__position-1;return t>=e.length&&this.__input.substring(t-e.length,t).toLowerCase()===e},e.exports.InputScanner=i},,,,,function(e){function t(e,t){e="string"==typeof e?e:e.source,t="string"==typeof t?t:t.source,this.__directives_block_pattern=new RegExp(e+/ beautify( \w+[:]\w+)+ /.source+t,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(e+/\sbeautify\signore:end\s/.source+t,"g")}t.prototype.get_directives=function(e){if(!e.match(this.__directives_block_pattern))return null;var t={};this.__directive_pattern.lastIndex=0;for(var i=this.__directive_pattern.exec(e);i;)t[i[1]]=i[2],i=this.__directive_pattern.exec(e);return t},t.prototype.readIgnored=function(e){return e.readUntilAfter(this.__directives_end_ignore_pattern)},e.exports.Directives=t},,function(e,t,i){var n=i(16).Beautifier,r=i(17).Options;e.exports=function(e,t){return new n(e,t).beautify()},e.exports.defaultOptions=function(){return new r}},function(e,t,i){var n=i(17).Options,r=i(2).Output,s=i(8).InputScanner,o=new(0,i(13).Directives)(/\/\*/,/\*\//),a=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,c=/\s/,u=/(?:\s|\n)+/g,h=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,d=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function f(e,t){this._source_text=e||"",this._options=new n(t),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"]}f.prototype.eatString=function(e){var t="";for(this._ch=this._input.next();this._ch;){if(t+=this._ch,"\\"===this._ch)t+=this._input.next();else if(-1!==e.indexOf(this._ch)||"\n"===this._ch)break;this._ch=this._input.next()}return t},f.prototype.eatWhitespace=function(e){for(var t=c.test(this._input.peek()),i=0;c.test(this._input.peek());)this._ch=this._input.next(),e&&"\n"===this._ch&&(0===i||i<this._options.max_preserve_newlines)&&(i++,this._output.add_new_line(!0));return t},f.prototype.foundNestedPseudoClass=function(){for(var e=0,t=1,i=this._input.peek(t);i;){if("{"===i)return!0;if("("===i)e+=1;else if(")"===i){if(0===e)return!1;e-=1}else if(";"===i||"}"===i)return!1;t++,i=this._input.peek(t)}return!1},f.prototype.print_string=function(e){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(e)},f.prototype.preserveSingleSpace=function(e){e&&(this._output.space_before_token=!0)},f.prototype.indent=function(){this._indentLevel++},f.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},f.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var e=this._source_text,t=this._options.eol;"auto"===t&&(t="\n",e&&a.test(e||"")&&(t=e.match(a)[0]));var i=(e=e.replace(l,"\n")).match(/^[\t ]*/)[0];this._output=new r(this._options,i),this._input=new s(e),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var n,f,p=0,_=!1,g=!1,m=!1,v=!1,y=!1,b=this._ch,S=!1;n=""!==this._input.read(u),f=b,this._ch=this._input.next(),"\\"===this._ch&&this._input.hasNext()&&(this._ch+=this._input.next()),b=this._ch,this._ch;)if("/"===this._ch&&"*"===this._input.peek()){this._output.add_new_line(),this._input.back();var E=this._input.read(h),w=o.get_directives(E);w&&"start"===w.ignore&&(E+=o.readIgnored(this._input)),this.print_string(E),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(d)),this.eatWhitespace(!0);else if("$"===this._ch){this.preserveSingleSpace(n),this.print_string(this._ch);var C=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);C.match(/[ :]$/)&&(C=this.eatString(": ").replace(/\s+$/,""),this.print_string(C),this._output.space_before_token=!0),0===p&&-1!==C.indexOf(":")&&(g=!0,this.indent())}else if("@"===this._ch)if(this.preserveSingleSpace(n),"{"===this._input.peek())this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var k=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);k.match(/[ :]$/)&&(k=this.eatString(": ").replace(/\s+$/,""),this.print_string(k),this._output.space_before_token=!0),0===p&&-1!==k.indexOf(":")?(g=!0,this.indent()):k in this.NESTED_AT_RULE?(this._nestedLevel+=1,k in this.CONDITIONAL_GROUP_RULE&&(m=!0)):0!==p||g||(v=!0)}else if("#"===this._ch&&"{"===this._input.peek())this.preserveSingleSpace(n),this.print_string(this._ch+this.eatString("}"));else if("{"===this._ch)g&&(g=!1,this.outdent()),v=!1,m?(m=!1,_=this._indentLevel>=this._nestedLevel):_=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&_&&this._output.previous_line&&"{"!==this._output.previous_line.item(-1)&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,"expand"===this._options.brace_style?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):("("===f?this._output.space_before_token=!1:","!==f&&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(),"{"===f&&this._output.trim(!0),g&&(this.outdent(),g=!1),this.print_string(this._ch),_=!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),"expand"===this._options.brace_style&&this._output.add_new_line(!0));else if(":"===this._ch){for(var T=0;T<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;T++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[T])){S=!0;break}!_&&!m||this._input.lookBack("&")||this.foundNestedPseudoClass()||this._input.lookBack("(")||v||0!==p?(this._input.lookBack(" ")&&(this._output.space_before_token=!0),":"===this._input.peek()?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":")):(this.print_string(":"),g||(g=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent()))}else if('"'===this._ch||"'"===this._ch){var A='"'===f||"'"===f;this.preserveSingleSpace(A||n),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(";"===this._ch)S=!1,0===p?(g&&(this.outdent(),g=!1),v=!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(),p++,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(")")),p&&(p--,this.outdent()));else{var x=!1;this._input.lookBack("with")&&(x=!0),this.preserveSingleSpace(n||x),this.print_string(this._ch),g&&"$"===f&&this._options.selector_separator_newline?(this._output.add_new_line(),y=!0):(this.eatWhitespace(),p++,this.indent())}else if(")"===this._ch)p&&(p--,this.outdent()),y&&";"===this._input.peek()&&this._options.selector_separator_newline&&(y=!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||g&&!y||0!==p||v?this._output.space_before_token=!0:this._output.add_new_line();else if(">"!==this._ch&&"+"!==this._ch&&"~"!==this._ch||g||0!==p)if("]"===this._ch)this.print_string(this._ch);else if("["===this._ch)this.preserveSingleSpace(n),this.print_string(this._ch);else if("="===this._ch)this.eatWhitespace(),this.print_string("="),c.test(this._ch)&&(this._ch="");else if("!"!==this._ch||this._input.lookBack("\\")){var D='"'===f||"'"===f;this.preserveSingleSpace(D||n),this.print_string(this._ch),!this._output.just_added_newline()&&"\n"===this._input.peek()&&S&&this._output.add_new_line()}else this._output.space_before_token=!0,this.print_string(this._ch);else 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&&c.test(this._ch)&&(this._ch=""));return this._output.get_code(t)},e.exports.Beautifier=f},function(e,t,i){var n=i(6).Options;function r(e){n.call(this,e,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var t=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||t;var i=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var r=0;r<i.length;r++)"expand"!==i[r]?this.brace_style="collapse":this.brace_style=i[r]}r.prototype=new n,e.exports.Options=r}],t={};var i=function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,i),s.exports}(15);n=i}();var r=n;void 0===(i=function(){return{css_beautify:r}}.apply(t,[]))||(e.exports=i)}()},40998:function(e,t,i){var n,r;!function(){var s;!function(){"use strict";var e=[,,function(e){function t(e){this.__parent=e,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=[]}function i(e,t){this.__cache=[""],this.__indent_size=e.indent_size,this.__indent_string=e.indent_char,e.indent_with_tabs||(this.__indent_string=new Array(e.indent_size+1).join(e.indent_char)),t=t||"",e.indent_level>0&&(t=new Array(e.indent_level+1).join(this.__indent_string)),this.__base_string=t,this.__base_string_length=t.length}function n(e,n){this.__indent_cache=new i(e,n),this.raw=!1,this._end_with_newline=e.end_with_newline,this.indent_size=e.indent_size,this.wrap_line_length=e.wrap_line_length,this.indent_empty_lines=e.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new t(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}t.prototype.clone_empty=function(){var e=new t(this.__parent);return e.set_indent(this.__indent_count,this.__alignment_count),e},t.prototype.item=function(e){return e<0?this.__items[this.__items.length+e]:this.__items[e]},t.prototype.has_match=function(e){for(var t=this.__items.length-1;t>=0;t--)if(this.__items[t].match(e))return!0;return!1},t.prototype.set_indent=function(e,t){this.is_empty()&&(this.__indent_count=e||0,this.__alignment_count=t||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},t.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)},t.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},t.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var e=this.__parent.current_line;return e.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),e.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),e.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===e.__items[0]&&(e.__items.splice(0,1),e.__character_count-=1),!0}return!1},t.prototype.is_empty=function(){return 0===this.__items.length},t.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},t.prototype.push=function(e){this.__items.push(e);var t=e.lastIndexOf("\n");-1!==t?this.__character_count=e.length-t:this.__character_count+=e.length},t.prototype.pop=function(){var e=null;return this.is_empty()||(e=this.__items.pop(),this.__character_count-=e.length),e},t.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},t.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},t.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},t.prototype.toString=function(){var e="";return this.is_empty()?this.__parent.indent_empty_lines&&(e=this.__parent.get_indent_string(this.__indent_count)):(e=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),e+=this.__items.join("")),e},i.prototype.get_indent_size=function(e,t){var i=this.__base_string_length;return t=t||0,e<0&&(i=0),i+=e*this.__indent_size,i+=t},i.prototype.get_indent_string=function(e,t){var i=this.__base_string;return t=t||0,e<0&&(e=0,i=""),t+=e*this.__indent_size,this.__ensure_cache(t),i+=this.__cache[t]},i.prototype.__ensure_cache=function(e){for(;e>=this.__cache.length;)this.__add_column()},i.prototype.__add_column=function(){var e=this.__cache.length,t=0,i="";this.__indent_size&&e>=this.__indent_size&&(e-=(t=Math.floor(e/this.__indent_size))*this.__indent_size,i=new Array(t+1).join(this.__indent_string)),e&&(i+=new Array(e+1).join(" ")),this.__cache.push(i)},n.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},n.prototype.get_line_number=function(){return this.__lines.length},n.prototype.get_indent_string=function(e,t){return this.__indent_cache.get_indent_string(e,t)},n.prototype.get_indent_size=function(e,t){return this.__indent_cache.get_indent_size(e,t)},n.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},n.prototype.add_new_line=function(e){return!(this.is_empty()||!e&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},n.prototype.get_code=function(e){this.trim(!0);var t=this.current_line.pop();t&&("\n"===t[t.length-1]&&(t=t.replace(/\n+$/g,"")),this.current_line.push(t)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join("\n");return"\n"!==e&&(i=i.replace(/[\n]/g,e)),i},n.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},n.prototype.set_indent=function(e,t){return e=e||0,t=t||0,this.next_line.set_indent(e,t),this.__lines.length>1?(this.current_line.set_indent(e,t),!0):(this.current_line.set_indent(),!1)},n.prototype.add_raw_token=function(e){for(var t=0;t<e.newlines;t++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(e.whitespace_before),this.current_line.push(e.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},n.prototype.add_token=function(e){this.__add_space_before_token(),this.current_line.push(e),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},n.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(" "))},n.prototype.remove_indent=function(e){for(var t=this.__lines.length;e<t;)this.__lines[e]._remove_indent(),e++;this.current_line._remove_wrap_indent()},n.prototype.trim=function(e){for(e=void 0!==e&&e,this.current_line.trim();e&&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},n.prototype.just_added_newline=function(){return this.current_line.is_empty()},n.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},n.prototype.ensure_empty_line_above=function(e,i){for(var n=this.__lines.length-2;n>=0;){var r=this.__lines[n];if(r.is_empty())break;if(0!==r.item(0).indexOf(e)&&r.item(-1)!==i){this.__lines.splice(n+1,0,new t(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},e.exports.Output=n},function(e){e.exports.Token=function(e,t,i,n){this.type=e,this.text=t,this.comments_before=null,this.newlines=i||0,this.whitespace_before=n||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}},,,function(e){function t(e,t){this.raw_options=i(e,t),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","\t"===this.indent_char),this.indent_with_tabs&&(this.indent_char="\t",1===this.indent_size&&(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"])}function i(e,t){var i,r={};for(i in e=n(e))i!==t&&(r[i]=e[i]);if(t&&e[t])for(i in e[t])r[i]=e[t][i];return r}function n(e){var t,i={};for(t in e){i[t.replace(/-/g,"_")]=e[t]}return i}t.prototype._get_array=function(e,t){var i=this.raw_options[e],n=t||[];return"object"==typeof i?null!==i&&"function"==typeof i.concat&&(n=i.concat()):"string"==typeof i&&(n=i.split(/[^a-zA-Z0-9_\/\-]+/)),n},t.prototype._get_boolean=function(e,t){var i=this.raw_options[e];return void 0===i?!!t:!!i},t.prototype._get_characters=function(e,t){var i=this.raw_options[e],n=t||"";return"string"==typeof i&&(n=i.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),n},t.prototype._get_number=function(e,t){var i=this.raw_options[e];t=parseInt(t,10),isNaN(t)&&(t=0);var n=parseInt(i,10);return isNaN(n)&&(n=t),n},t.prototype._get_selection=function(e,t,i){var n=this._get_selection_list(e,t,i);if(1!==n.length)throw new Error("Invalid Option Value: The option '"+e+"' can only be one of the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return n[0]},t.prototype._get_selection_list=function(e,t,i){if(!t||0===t.length)throw new Error("Selection list cannot be empty.");if(i=i||[t[0]],!this._is_valid_selection(i,t))throw new Error("Invalid Default Value!");var n=this._get_array(e,i);if(!this._is_valid_selection(n,t))throw new Error("Invalid Option Value: The option '"+e+"' can contain only the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return n},t.prototype._is_valid_selection=function(e,t){return e.length&&t.length&&!e.some((function(e){return-1===t.indexOf(e)}))},e.exports.Options=t,e.exports.normalizeOpts=n,e.exports.mergeOpts=i},,function(e){var t=RegExp.prototype.hasOwnProperty("sticky");function i(e){this.__input=e||"",this.__input_length=this.__input.length,this.__position=0}i.prototype.restart=function(){this.__position=0},i.prototype.back=function(){this.__position>0&&(this.__position-=1)},i.prototype.hasNext=function(){return this.__position<this.__input_length},i.prototype.next=function(){var e=null;return this.hasNext()&&(e=this.__input.charAt(this.__position),this.__position+=1),e},i.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&(t=this.__input.charAt(e)),t},i.prototype.__match=function(e,i){e.lastIndex=i;var n=e.exec(this.__input);return!n||t&&e.sticky||n.index!==i&&(n=null),n},i.prototype.test=function(e,t){return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&!!this.__match(e,t)},i.prototype.testChar=function(e,t){var i=this.peek(t);return e.lastIndex=0,null!==i&&e.test(i)},i.prototype.match=function(e){var t=this.__match(e,this.__position);return t?this.__position+=t[0].length:t=null,t},i.prototype.read=function(e,t,i){var n,r="";return e&&(n=this.match(e))&&(r+=n[0]),!t||!n&&e||(r+=this.readUntil(t,i)),r},i.prototype.readUntil=function(e,t){var i,n=this.__position;e.lastIndex=this.__position;var r=e.exec(this.__input);return r?(n=r.index,t&&(n+=r[0].length)):n=this.__input_length,i=this.__input.substring(this.__position,n),this.__position=n,i},i.prototype.readUntilAfter=function(e){return this.readUntil(e,!0)},i.prototype.get_regexp=function(e,i){var n=null,r="g";return i&&t&&(r="y"),"string"==typeof e&&""!==e?n=new RegExp(e,r):e&&(n=new RegExp(e.source,r)),n},i.prototype.get_literal_regexp=function(e){return RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},i.prototype.peekUntilAfter=function(e){var t=this.__position,i=this.readUntilAfter(e);return this.__position=t,i},i.prototype.lookBack=function(e){var t=this.__position-1;return t>=e.length&&this.__input.substring(t-e.length,t).toLowerCase()===e},e.exports.InputScanner=i},function(e,t,i){var n=i(8).InputScanner,r=i(3).Token,s=i(10).TokenStream,o=i(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(e,t){this._input=new n(e),this._options=t||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};l.prototype.tokenize=function(){var e;this._input.restart(),this.__tokens=new s,this._reset();for(var t=new r(a.START,""),i=null,n=[],o=new s;t.type!==a.EOF;){for(e=this._get_next_token(t,i);this._is_comment(e);)o.add(e),e=this._get_next_token(t,i);o.isEmpty()||(e.comments_before=o,o=new s),e.parent=i,this._is_opening(e)?(n.push(i),i=e):i&&this._is_closing(e,i)&&(e.opened=i,i.closed=e,i=n.pop(),e.parent=i),e.previous=t,t.next=e,this.__tokens.add(e),t=e}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(e,t){this._readWhitespace();var i=this._input.read(/.+/g);return i?this._create_token(a.RAW,i):this._create_token(a.EOF,"")},l.prototype._is_comment=function(e){return!1},l.prototype._is_opening=function(e){return!1},l.prototype._is_closing=function(e,t){return!1},l.prototype._create_token=function(e,t){return new r(e,t,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},e.exports.Tokenizer=l,e.exports.TOKEN=a},function(e){function t(e){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=e}t.prototype.restart=function(){this.__position=0},t.prototype.isEmpty=function(){return 0===this.__tokens_length},t.prototype.hasNext=function(){return this.__position<this.__tokens_length},t.prototype.next=function(){var e=null;return this.hasNext()&&(e=this.__tokens[this.__position],this.__position+=1),e},t.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__tokens_length&&(t=this.__tokens[e]),t},t.prototype.add=function(e){this.__parent_token&&(e.parent=this.__parent_token),this.__tokens.push(e),this.__tokens_length+=1},e.exports.TokenStream=t},function(e,t,i){var n=i(12).Pattern;function r(e,t){n.call(this,e,t),t?this._line_regexp=this._input.get_regexp(t._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}r.prototype=new n,r.prototype.__set_whitespace_patterns=function(e,t){e+="\\t ",t+="\\n\\r",this._match_pattern=this._input.get_regexp("["+e+t+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+t+"]")},r.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var e=this._input.read(this._match_pattern);if(" "===e)this.whitespace_before_token=" ";else if(e){var t=this.__split(this._newline_regexp,e);this.newline_count=t.length-1,this.whitespace_before_token=t[this.newline_count]}return e},r.prototype.matching=function(e,t){var i=this._create();return i.__set_whitespace_patterns(e,t),i._update(),i},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(e,t){e.lastIndex=0;for(var i=0,n=[],r=e.exec(t);r;)n.push(t.substring(i,r.index)),i=r.index+r[0].length,r=e.exec(t);return i<t.length?n.push(t.substring(i,t.length)):n.push(""),n},e.exports.WhitespacePattern=r},function(e){function t(e,t){this._input=e,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,t&&(this._starting_pattern=this._input.get_regexp(t._starting_pattern,!0),this._match_pattern=this._input.get_regexp(t._match_pattern,!0),this._until_pattern=this._input.get_regexp(t._until_pattern),this._until_after=t._until_after)}t.prototype.read=function(){var e=this._input.read(this._starting_pattern);return this._starting_pattern&&!e||(e+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),e},t.prototype.read_match=function(){return this._input.match(this._match_pattern)},t.prototype.until_after=function(e){var t=this._create();return t._until_after=!0,t._until_pattern=this._input.get_regexp(e),t._update(),t},t.prototype.until=function(e){var t=this._create();return t._until_after=!1,t._until_pattern=this._input.get_regexp(e),t._update(),t},t.prototype.starting_with=function(e){var t=this._create();return t._starting_pattern=this._input.get_regexp(e,!0),t._update(),t},t.prototype.matching=function(e){var t=this._create();return t._match_pattern=this._input.get_regexp(e,!0),t._update(),t},t.prototype._create=function(){return new t(this._input,this)},t.prototype._update=function(){},e.exports.Pattern=t},function(e){function t(e,t){e="string"==typeof e?e:e.source,t="string"==typeof t?t:t.source,this.__directives_block_pattern=new RegExp(e+/ beautify( \w+[:]\w+)+ /.source+t,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(e+/\sbeautify\signore:end\s/.source+t,"g")}t.prototype.get_directives=function(e){if(!e.match(this.__directives_block_pattern))return null;var t={};this.__directive_pattern.lastIndex=0;for(var i=this.__directive_pattern.exec(e);i;)t[i[1]]=i[2],i=this.__directive_pattern.exec(e);return t},t.prototype.readIgnored=function(e){return e.readUntilAfter(this.__directives_end_ignore_pattern)},e.exports.Directives=t},function(e,t,i){var n=i(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function s(e,t){n.call(this,e,t),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),t&&(this.__template_pattern=this._input.get_regexp(t.__template_pattern),this._excluded=Object.assign(this._excluded,t._excluded),this._disabled=Object.assign(this._disabled,t._disabled));var i=new n(e);this.__patterns={handlebars_comment:i.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:i.starting_with(/{{{/).until_after(/}}}/),handlebars:i.starting_with(/{{/).until_after(/}}/),php:i.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:i.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:i.starting_with(/{%/).until_after(/%}/),django_value:i.starting_with(/{{/).until_after(/}}/),django_comment:i.starting_with(/{#/).until_after(/#}/),smarty:i.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:i.starting_with(/{\*/).until_after(/\*}/),smarty_literal:i.starting_with(/{literal}/).until_after(/{\/literal}/)}}s.prototype=new n,s.prototype._create=function(){return new s(this._input,this)},s.prototype._update=function(){this.__set_templated_pattern()},s.prototype.disable=function(e){var t=this._create();return t._disabled[e]=!0,t._update(),t},s.prototype.read_options=function(e){var t=this._create();for(var i in r)t._disabled[i]=-1===e.templating.indexOf(i);return t._update(),t},s.prototype.exclude=function(e){var t=this._create();return t._excluded[e]=!0,t._update(),t},s.prototype.read=function(){var e="";e=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern);for(var t=this._read_template();t;)this._match_pattern?t+=this._input.read(this._match_pattern):t+=this._input.readUntil(this.__template_pattern),e+=t,t=this._read_template();return this._until_after&&(e+=this._input.readUntilAfter(this._until_pattern)),e},s.prototype.__set_templated_pattern=function(){var e=[];this._disabled.php||e.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||e.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||e.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||e.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(e.push(this.__patterns.django._starting_pattern.source),e.push(this.__patterns.django_value._starting_pattern.source),e.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||e.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&e.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+e.join("|")+")")},s.prototype._read_template=function(){var e="",t=this._input.peek();if("<"===t){var i=this._input.peek(1);this._disabled.php||this._excluded.php||"?"!==i||(e=e||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==i||(e=e||this.__patterns.erb.read())}else"{"===t&&(this._disabled.handlebars||this._excluded.handlebars||(e=(e=(e=e||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(e=e||this.__patterns.django_value.read()),this._excluded.django||(e=(e=e||this.__patterns.django_comment.read())||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(e=(e=(e=e||this.__patterns.smarty_comment.read())||this.__patterns.smarty_literal.read())||this.__patterns.smarty.read()));return e},e.exports.TemplatablePattern=s},,,,function(e,t,i){var n=i(19).Beautifier,r=i(20).Options;e.exports=function(e,t,i,r){return new n(e,t,i,r).beautify()},e.exports.defaultOptions=function(){return new r}},function(e,t,i){var n=i(20).Options,r=i(2).Output,s=i(21).Tokenizer,o=i(21).TOKEN,a=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,c=function(e,t){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=e.max_preserve_newlines,this.preserve_newlines=e.preserve_newlines,this._output=new r(e,t)};c.prototype.current_line_has_match=function(e){return this._output.current_line.has_match(e)},c.prototype.set_space_before_token=function(e,t){this._output.space_before_token=e,this._output.non_breaking_space=t},c.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},c.prototype.add_raw_token=function(e){this._output.add_raw_token(e)},c.prototype.print_preserved_newlines=function(e){var t=0;e.type!==o.TEXT&&e.previous.type!==o.TEXT&&(t=e.newlines?1:0),this.preserve_newlines&&(t=e.newlines<this.max_preserve_newlines+1?e.newlines:this.max_preserve_newlines+1);for(var i=0;i<t;i++)this.print_newline(i>0);return 0!==t},c.prototype.traverse_whitespace=function(e){return!(!e.whitespace_before&&!e.newlines)&&(this.print_preserved_newlines(e)||(this._output.space_before_token=!0),!0)},c.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},c.prototype.print_newline=function(e){this._output.add_new_line(e)},c.prototype.print_token=function(e){e.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(e.text))},c.prototype.indent=function(){this.indent_level++},c.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},c.prototype.get_full_indent=function(e){return(e=this.indent_level+(e||0))<1?"":this._output.get_indent_string(e)};var u=function(e,t){var i=null,n=null;return t.closed?("script"===e?i="text/javascript":"style"===e&&(i="text/css"),i=function(e){for(var t=null,i=e.next;i.type!==o.EOF&&e.closed!==i;){if(i.type===o.ATTRIBUTE&&"type"===i.text){i.next&&i.next.type===o.EQUALS&&i.next.next&&i.next.next.type===o.VALUE&&(t=i.next.next.text);break}i=i.next}return t}(t)||i,i.search("text/css")>-1?n="css":i.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?n="javascript":i.search(/(text|application|dojo)\/(x-)?(html)/)>-1?n="html":i.search(/test\/null/)>-1&&(n="null"),n):null};function h(e,t){return-1!==t.indexOf(e)}function d(e,t,i){this.parent=e||null,this.tag=t?t.tag_name:"",this.indent_level=i||0,this.parser_token=t||null}function f(e){this._printer=e,this._current_frame=null}function p(e,t,i,r){this._source_text=e||"",t=t||{},this._js_beautify=i,this._css_beautify=r,this._tag_stack=null;var s=new n(t,"html");this._options=s,this._is_wrap_attributes_force="force"===this._options.wrap_attributes.substr(0,"force".length),this._is_wrap_attributes_force_expand_multiline="force-expand-multiline"===this._options.wrap_attributes,this._is_wrap_attributes_force_aligned="force-aligned"===this._options.wrap_attributes,this._is_wrap_attributes_aligned_multiple="aligned-multiple"===this._options.wrap_attributes,this._is_wrap_attributes_preserve="preserve"===this._options.wrap_attributes.substr(0,"preserve".length),this._is_wrap_attributes_preserve_aligned="preserve-aligned"===this._options.wrap_attributes}f.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},f.prototype.record_tag=function(e){var t=new d(this._current_frame,e,this._printer.indent_level);this._current_frame=t},f.prototype._try_pop_frame=function(e){var t=null;return e&&(t=e.parser_token,this._printer.indent_level=e.indent_level,this._current_frame=e.parent),t},f.prototype._get_frame=function(e,t){for(var i=this._current_frame;i&&-1===e.indexOf(i.tag);){if(t&&-1!==t.indexOf(i.tag)){i=null;break}i=i.parent}return i},f.prototype.try_pop=function(e,t){var i=this._get_frame([e],t);return this._try_pop_frame(i)},f.prototype.indent_to_tag=function(e){var t=this._get_frame(e);t&&(this._printer.indent_level=t.indent_level)},p.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var e=this._source_text,t=this._options.eol;"auto"===this._options.eol&&(t="\n",e&&a.test(e)&&(t=e.match(a)[0]));var i=(e=e.replace(l,"\n")).match(/^[\t ]*/)[0],n={text:"",type:""},r=new _(this._options),u=new c(this._options,i),h=new s(e,this._options).tokenize();this._tag_stack=new f(u);for(var d=null,p=h.next();p.type!==o.EOF;)p.type===o.TAG_OPEN||p.type===o.COMMENT?r=d=this._handle_tag_open(u,p,r,n,h):p.type===o.ATTRIBUTE||p.type===o.EQUALS||p.type===o.VALUE||p.type===o.TEXT&&!r.tag_complete?d=this._handle_inside_tag(u,p,r,n):p.type===o.TAG_CLOSE?d=this._handle_tag_close(u,p,r):p.type===o.TEXT?d=this._handle_text(u,p,r):p.type===o.CONTROL_FLOW_OPEN?d=this._handle_control_flow_open(u,p):p.type===o.CONTROL_FLOW_CLOSE?d=this._handle_control_flow_close(u,p):u.add_raw_token(p),n=d,p=h.next();return u._output.get_code(t)},p.prototype._handle_control_flow_open=function(e,t){var i={text:t.text,type:t.type};return e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),t.newlines?e.print_preserved_newlines(t):e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),e.print_token(t),e.indent(),i},p.prototype._handle_control_flow_close=function(e,t){var i={text:t.text,type:t.type};return e.deindent(),t.newlines?e.print_preserved_newlines(t):e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),e.print_token(t),i},p.prototype._handle_tag_close=function(e,t,i){var n={text:t.text,type:t.type};return e.alignment_size=0,i.tag_complete=!0,e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),i.is_unformatted?e.add_raw_token(t):("<"===i.tag_start_char&&(e.set_space_before_token("/"===t.text[0],!0),this._is_wrap_attributes_force_expand_multiline&&i.has_wrapped_attrs&&e.print_newline(!1)),e.print_token(t)),!i.indent_content||i.is_unformatted||i.is_content_unformatted||(e.indent(),i.indent_content=!1),i.is_inline_element||i.is_unformatted||i.is_content_unformatted||e.set_wrap_point(),n},p.prototype._handle_inside_tag=function(e,t,i,n){var r=i.has_wrapped_attrs,s={text:t.text,type:t.type};return e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),i.is_unformatted?e.add_raw_token(t):"{"===i.tag_start_char&&t.type===o.TEXT?e.print_preserved_newlines(t)?(t.newlines=0,e.add_raw_token(t)):e.print_token(t):(t.type===o.ATTRIBUTE?e.set_space_before_token(!0):(t.type===o.EQUALS||t.type===o.VALUE&&t.previous.type===o.EQUALS)&&e.set_space_before_token(!1),t.type===o.ATTRIBUTE&&"<"===i.tag_start_char&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(e.traverse_whitespace(t),r=r||0!==t.newlines),this._is_wrap_attributes_force&&i.attr_count>=this._options.wrap_attributes_min_attrs&&(n.type!==o.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(e.print_newline(!1),r=!0)),e.print_token(t),r=r||e.previous_token_wrapped(),i.has_wrapped_attrs=r),s},p.prototype._handle_text=function(e,t,i){var n={text:t.text,type:"TK_CONTENT"};return i.custom_beautifier_name?this._print_custom_beatifier_text(e,t,i):i.is_unformatted||i.is_content_unformatted?e.add_raw_token(t):(e.traverse_whitespace(t),e.print_token(t)),n},p.prototype._print_custom_beatifier_text=function(e,t,i){var n=this;if(""!==t.text){var r,s=t.text,o=1,a="",l="";"javascript"===i.custom_beautifier_name&&"function"==typeof this._js_beautify?r=this._js_beautify:"css"===i.custom_beautifier_name&&"function"==typeof this._css_beautify?r=this._css_beautify:"html"===i.custom_beautifier_name&&(r=function(e,t){return new p(e,t,n._js_beautify,n._css_beautify).beautify()}),"keep"===this._options.indent_scripts?o=0:"separate"===this._options.indent_scripts&&(o=-e.indent_level);var c=e.get_full_indent(o);if(s=s.replace(/\n[ \t]*$/,""),"html"!==i.custom_beautifier_name&&"<"===s[0]&&s.match(/^(<!--|<!\[CDATA\[)/)){var u=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(s);if(!u)return void e.add_raw_token(t);a=c+u[1]+"\n",s=u[4],u[5]&&(l=c+u[5]),s=s.replace(/\n[ \t]*$/,""),(u[2]||-1!==u[3].indexOf("\n"))&&(u=u[3].match(/[ \t]+$/))&&(t.whitespace_before=u[0])}if(s)if(r){var h=function(){this.eol="\n"};h.prototype=this._options.raw_options,s=r(c+s,new h)}else{var d=t.whitespace_before;d&&(s=s.replace(new RegExp("\n("+d+")?","g"),"\n")),s=c+s.replace(/\n/g,"\n"+c)}a&&(s=s?a+s+"\n"+l:a+l),e.print_newline(!1),s&&(t.text=s,t.whitespace_before="",t.newlines=0,e.add_raw_token(t),e.print_newline(!0))}},p.prototype._handle_tag_open=function(e,t,i,n,r){var s=this._get_tag_open_token(t);if(!i.is_unformatted&&!i.is_content_unformatted||i.is_empty_element||t.type!==o.TAG_OPEN||s.is_start_tag?(e.traverse_whitespace(t),this._set_tag_position(e,t,s,i,n),s.is_inline_element||e.set_wrap_point(),e.print_token(t)):(e.add_raw_token(t),s.start_tag_token=this._tag_stack.try_pop(s.tag_name)),s.is_start_tag&&this._is_wrap_attributes_force){var a,l=0;do{(a=r.peek(l)).type===o.ATTRIBUTE&&(s.attr_count+=1),l+=1}while(a.type!==o.EOF&&a.type!==o.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(s.alignment_size=t.text.length+1),s.tag_complete||s.is_unformatted||(e.alignment_size=s.alignment_size),s};var _=function(e,t,i){if(this.parent=t||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="",i){var n;this.tag_start_char=i.text[0],this.text=i.text,"<"===this.tag_start_char?(n=i.text.match(/^<([^\s>]*)/),this.tag_check=n?n[1]:""):(n=i.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=n?n[1]:"",(i.text.startsWith("{{#>")||i.text.startsWith("{{~#>"))&&">"===this.tag_check[0]&&(">"===this.tag_check&&null!==i.next?this.tag_check=i.next.text.split(" ")[0]:this.tag_check=i.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),i.type===o.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||i.closed&&"/>"===i.closed.text;var r=2;"{"===this.tag_start_char&&this.text.length>=3&&"~"===this.text.charAt(2)&&(r=3),this.is_end_tag=this.is_end_tag||"{"===this.tag_start_char&&(!e.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(r)))}else this.tag_complete=!0};p.prototype._get_tag_open_token=function(e){var t=new _(this._options,this._tag_stack.get_parser_token(),e);return t.alignment_size=this._options.wrap_attributes_indent_size,t.is_end_tag=t.is_end_tag||h(t.tag_check,this._options.void_elements),t.is_empty_element=t.tag_complete||t.is_start_tag&&t.is_end_tag,t.is_unformatted=!t.tag_complete&&h(t.tag_check,this._options.unformatted),t.is_content_unformatted=!t.is_empty_element&&h(t.tag_check,this._options.content_unformatted),t.is_inline_element=h(t.tag_name,this._options.inline)||this._options.inline_custom_elements&&t.tag_name.includes("-")||"{"===t.tag_start_char,t},p.prototype._set_tag_position=function(e,t,i,n,r){if(i.is_empty_element||(i.is_end_tag?i.start_tag_token=this._tag_stack.try_pop(i.tag_name):(this._do_optional_end_element(i)&&(i.is_inline_element||e.print_newline(!1)),this._tag_stack.record_tag(i),"script"!==i.tag_name&&"style"!==i.tag_name||i.is_unformatted||i.is_content_unformatted||(i.custom_beautifier_name=u(i.tag_check,t)))),h(i.tag_check,this._options.extra_liners)&&(e.print_newline(!1),e._output.just_added_blankline()||e.print_newline(!0)),i.is_empty_element){if("{"===i.tag_start_char&&"else"===i.tag_check)this._tag_stack.indent_to_tag(["if","unless","each"]),i.indent_content=!0,e.current_line_has_match(/{{#if/)||e.print_newline(!1);"!--"===i.tag_name&&r.type===o.TAG_CLOSE&&n.is_end_tag&&-1===i.text.indexOf("\n")||(i.is_inline_element||i.is_unformatted||e.print_newline(!1),this._calcluate_parent_multiline(e,i))}else if(i.is_end_tag){var s=!1;s=(s=i.start_tag_token&&i.start_tag_token.multiline_content)||!i.is_inline_element&&!(n.is_inline_element||n.is_unformatted)&&!(r.type===o.TAG_CLOSE&&i.start_tag_token===n)&&"TK_CONTENT"!==r.type,(i.is_content_unformatted||i.is_unformatted)&&(s=!1),s&&e.print_newline(!1)}else i.indent_content=!i.custom_beautifier_name,"<"===i.tag_start_char&&("html"===i.tag_name?i.indent_content=this._options.indent_inner_html:"head"===i.tag_name?i.indent_content=this._options.indent_head_inner_html:"body"===i.tag_name&&(i.indent_content=this._options.indent_body_inner_html)),i.is_inline_element||i.is_unformatted||"TK_CONTENT"===r.type&&!i.is_content_unformatted||e.print_newline(!1),this._calcluate_parent_multiline(e,i)},p.prototype._calcluate_parent_multiline=function(e,t){!t.parent||!e._output.just_added_newline()||(t.is_inline_element||t.is_unformatted)&&t.parent.is_inline_element||(t.parent.multiline_content=!0)};var g=["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"],m=["a","audio","del","ins","map","noscript","video"];p.prototype._do_optional_end_element=function(e){var t=null;if(!e.is_empty_element&&e.is_start_tag&&e.parent){if("body"===e.tag_name)t=t||this._tag_stack.try_pop("head");else if("li"===e.tag_name)t=t||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if("dd"===e.tag_name||"dt"===e.tag_name)t=(t=t||this._tag_stack.try_pop("dt",["dl"]))||this._tag_stack.try_pop("dd",["dl"]);else if("p"===e.parent.tag_name&&-1!==g.indexOf(e.tag_name)){var i=e.parent.parent;i&&-1!==m.indexOf(i.tag_name)||(t=t||this._tag_stack.try_pop("p"))}else"rp"===e.tag_name||"rt"===e.tag_name?t=(t=t||this._tag_stack.try_pop("rt",["ruby","rtc"]))||this._tag_stack.try_pop("rp",["ruby","rtc"]):"optgroup"===e.tag_name?t=t||this._tag_stack.try_pop("optgroup",["select"]):"option"===e.tag_name?t=t||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):"colgroup"===e.tag_name?t=t||this._tag_stack.try_pop("caption",["table"]):"thead"===e.tag_name?t=(t=t||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]):"tbody"===e.tag_name||"tfoot"===e.tag_name?t=(t=(t=(t=t||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("thead",["table"]))||this._tag_stack.try_pop("tbody",["table"]):"tr"===e.tag_name?t=(t=(t=t||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"]):"th"!==e.tag_name&&"td"!==e.tag_name||(t=(t=t||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]))||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return e.parent=this._tag_stack.get_parser_token(),t}},e.exports.Beautifier=p},function(e,t,i){var n=i(6).Options;function r(e){n.call(this,e,"html"),1===this.templating.length&&"auto"===this.templating[0]&&(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"])}r.prototype=new n,e.exports.Options=r},function(e,t,i){var n=i(9).Tokenizer,r=i(9).TOKEN,s=i(13).Directives,o=i(14).TemplatablePattern,a=i(12).Pattern,l={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:r.START,RAW:r.RAW,EOF:r.EOF},c=new s(/<\!--/,/-->/),u=function(e,t){n.call(this,e,t),this._current_tag_name="";var i=new o(this._input).read_options(this._options),r=new a(this._input);if(this.__patterns={word:i.until(/[\n\r\t <]/),word_control_flow_close_excluded:i.until(/[\n\r\t <}]/),single_quote:i.until_after(/'/),double_quote:i.until_after(/"/),attribute:i.until(/[\n\r\t =>]|\/>/),element_name:i.until(/[\n\r\t >\/]/),angular_control_flow_start:r.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:r.starting_with(/{{!--/).until_after(/--}}/),handlebars:r.starting_with(/{{/).until_after(/}}/),handlebars_open:r.until(/[\n\r\t }]/),handlebars_raw_close:r.until(/}}/),comment:r.starting_with(/<!--/).until_after(/-->/),cdata:r.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:r.starting_with(/<!\[/).until_after(/]>/),processing:r.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 s=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=r.matching(s).until_after(s)}};(u.prototype=new n)._is_comment=function(e){return!1},u.prototype._is_opening=function(e){return e.type===l.TAG_OPEN||e.type===l.CONTROL_FLOW_OPEN},u.prototype._is_closing=function(e,t){return e.type===l.TAG_CLOSE&&t&&((">"===e.text||"/>"===e.text)&&"<"===t.text[0]||"}}"===e.text&&"{"===t.text[0]&&"{"===t.text[1])||e.type===l.CONTROL_FLOW_CLOSE&&"}"===e.text&&t.text.endsWith("{")},u.prototype._reset=function(){this._current_tag_name=""},u.prototype._get_next_token=function(e,t){var i=null;this._readWhitespace();var n=this._input.peek();return null===n?this._create_token(l.EOF,""):i=(i=(i=(i=(i=(i=(i=(i=(i=(i=(i=i||this._read_open_handlebars(n,t))||this._read_attribute(n,e,t))||this._read_close(n,t))||this._read_script_and_style(n,e))||this._read_control_flows(n,t))||this._read_raw_content(n,e,t))||this._read_content_word(n,t))||this._read_comment_or_cdata(n))||this._read_processing(n))||this._read_open(n,t))||this._create_token(l.UNKNOWN,this._input.next())},u.prototype._read_comment_or_cdata=function(e){var t=null,i=null,n=null;"<"===e&&("!"===this._input.peek(1)&&((i=this.__patterns.comment.read())?(n=c.get_directives(i))&&"start"===n.ignore&&(i+=c.readIgnored(this._input)):i=this.__patterns.cdata.read()),i&&((t=this._create_token(l.COMMENT,i)).directives=n));return t},u.prototype._read_processing=function(e){var t=null,i=null;if("<"===e){var n=this._input.peek(1);"!"!==n&&"?"!==n||(i=(i=this.__patterns.conditional_comment.read())||this.__patterns.processing.read()),i&&((t=this._create_token(l.COMMENT,i)).directives=null)}return t},u.prototype._read_open=function(e,t){var i=null,n=null;return t&&t.type!==l.CONTROL_FLOW_OPEN||"<"===e&&(i=this._input.next(),"/"===this._input.peek()&&(i+=this._input.next()),i+=this.__patterns.element_name.read(),n=this._create_token(l.TAG_OPEN,i)),n},u.prototype._read_open_handlebars=function(e,t){var i=null,n=null;return t&&t.type!==l.CONTROL_FLOW_OPEN||(this._options.templating.includes("angular")||this._options.indent_handlebars)&&"{"===e&&"{"===this._input.peek(1)&&(this._options.indent_handlebars&&"!"===this._input.peek(2)?(i=(i=this.__patterns.handlebars_comment.read())||this.__patterns.handlebars.read(),n=this._create_token(l.COMMENT,i)):(i=this.__patterns.handlebars_open.read(),n=this._create_token(l.TAG_OPEN,i))),n},u.prototype._read_control_flows=function(e,t){var i="",n=null;if(!this._options.templating.includes("angular"))return n;if("@"===e){if(""===(i=this.__patterns.angular_control_flow_start.read()))return n;for(var r=i.endsWith("(")?1:0,s=0;!i.endsWith("{")||r!==s;){var o=this._input.next();if(null===o)break;"("===o?r++:")"===o&&s++,i+=o}n=this._create_token(l.CONTROL_FLOW_OPEN,i)}else"}"===e&&t&&t.type===l.CONTROL_FLOW_OPEN&&(i=this._input.next(),n=this._create_token(l.CONTROL_FLOW_CLOSE,i));return n},u.prototype._read_close=function(e,t){var i=null,n=null;return t&&t.type===l.TAG_OPEN&&("<"===t.text[0]&&(">"===e||"/"===e&&">"===this._input.peek(1))?(i=this._input.next(),"/"===e&&(i+=this._input.next()),n=this._create_token(l.TAG_CLOSE,i)):"{"===t.text[0]&&"}"===e&&"}"===this._input.peek(1)&&(this._input.next(),this._input.next(),n=this._create_token(l.TAG_CLOSE,"}}"))),n},u.prototype._read_attribute=function(e,t,i){var n=null,r="";if(i&&"<"===i.text[0])if("="===e)n=this._create_token(l.EQUALS,this._input.next());else if('"'===e||"'"===e){var s=this._input.next();s+='"'===e?this.__patterns.double_quote.read():this.__patterns.single_quote.read(),n=this._create_token(l.VALUE,s)}else(r=this.__patterns.attribute.read())&&(n=t.type===l.EQUALS?this._create_token(l.VALUE,r):this._create_token(l.ATTRIBUTE,r));return n},u.prototype._is_content_unformatted=function(e){return-1===this._options.void_elements.indexOf(e)&&(-1!==this._options.content_unformatted.indexOf(e)||-1!==this._options.unformatted.indexOf(e))},u.prototype._read_raw_content=function(e,t,i){var n="";if(i&&"{"===i.text[0])n=this.__patterns.handlebars_raw_close.read();else if(t.type===l.TAG_CLOSE&&"<"===t.opened.text[0]&&"/"!==t.text[0]){var r=t.opened.text.substr(1).toLowerCase();this._is_content_unformatted(r)&&(n=this._input.readUntil(new RegExp("</"+r+"[\\n\\r\\t ]*?>","ig")))}return n?this._create_token(l.TEXT,n):null},u.prototype._read_script_and_style=function(e,t){if(t.type===l.TAG_CLOSE&&"<"===t.opened.text[0]&&"/"!==t.text[0]){var i=t.opened.text.substr(1).toLowerCase();if("script"===i||"style"===i){var n=this._read_comment_or_cdata(e);if(n)return n.type=l.TEXT,n;var r=this._input.readUntil(new RegExp("</"+i+"[\\n\\r\\t ]*?>","ig"));if(r)return this._create_token(l.TEXT,r)}}return null},u.prototype._read_content_word=function(e,t){var i="";return this._options.unformatted_content_delimiter&&e===this._options.unformatted_content_delimiter[0]&&(i=this.__patterns.unformatted_content_delimiter.read()),i||(i=t&&t.type===l.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),i?this._create_token(l.TEXT,i):null},e.exports.Tokenizer=u,e.exports.TOKEN=l}],t={};var i=function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,i),s.exports}(18);s=i}();var o=s;n=[i,i(58553),i(87804)],r=function(e){var t=i(58553),n=i(87804);return{html_beautify:function(e,i){return o(e,i,t.js_beautify,n.css_beautify)}}}.apply(t,n),void 0===r||(e.exports=r)}()},58553:function(e,t){var i;!function(){var n;!function(){"use strict";var e=[function(e,t,i){var n=i(1).Beautifier,r=i(5).Options;e.exports=function(e,t){return new n(e,t).beautify()},e.exports.defaultOptions=function(){return new r}},function(e,t,i){var n=i(2).Output,r=i(3).Token,s=i(4),o=i(5).Options,a=i(7).Tokenizer,l=i(7).line_starters,c=i(7).positionable_operators,u=i(7).TOKEN;function h(e,t){return-1!==t.indexOf(e)}function d(e,t){return e&&e.type===u.RESERVED&&e.text===t}function f(e,t){return e&&e.type===u.RESERVED&&h(e.text,t)}var p=["case","return","do","if","throw","else","await","break","continue","async"],_=function(e){for(var t={},i=0;i<e.length;i++)t[e[i].replace(/-/g,"_")]=e[i];return t}(["before-newline","after-newline","preserve-newline"]),g=[_.before_newline,_.preserve_newline],m="BlockStatement",v="Statement",y="ObjectLiteral",b="ArrayLiteral",S="ForInitializer",E="Conditional",w="Expression";function C(e,t){t.multiline_frame||t.mode===S||t.mode===E||e.remove_indent(t.start_line_index)}function k(e){return e===b}function T(e){return h(e,[w,S,E])}function A(e,t){t=t||{},this._source_text=e||"",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 o(t)}A.prototype.create_flags=function(e,t){var i=0;return e&&(i=e.indentation_level,!this._output.just_added_newline()&&e.line_indent_level>i&&(i=e.line_indent_level)),{mode:t,parent:e,last_token:e?e.last_token:new r(u.START_BLOCK,""),last_word:e?e.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:i,alignment:0,line_indent_level:e?e.line_indent_level:i,start_line_index:this._output.get_line_number(),ternary_depth:0}},A.prototype._reset=function(e){var t=e.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new n(this._options,t),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(m);var i=new a(e,this._options);return this._tokens=i.tokenize(),e},A.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var e=this._reset(this._source_text),t=this._options.eol;"auto"===this._options.eol&&(t="\n",e&&s.lineBreak.test(e||"")&&(t=e.match(s.lineBreak)[0]));for(var i=this._tokens.next();i;)this.handle_token(i),this._last_last_text=this._flags.last_token.text,this._flags.last_token=i,i=this._tokens.next();return this._output.get_code(t)},A.prototype.handle_token=function(e,t){e.type===u.START_EXPR?this.handle_start_expr(e):e.type===u.END_EXPR?this.handle_end_expr(e):e.type===u.START_BLOCK?this.handle_start_block(e):e.type===u.END_BLOCK?this.handle_end_block(e):e.type===u.WORD||e.type===u.RESERVED?this.handle_word(e):e.type===u.SEMICOLON?this.handle_semicolon(e):e.type===u.STRING?this.handle_string(e):e.type===u.EQUALS?this.handle_equals(e):e.type===u.OPERATOR?this.handle_operator(e):e.type===u.COMMA?this.handle_comma(e):e.type===u.BLOCK_COMMENT?this.handle_block_comment(e,t):e.type===u.COMMENT?this.handle_comment(e,t):e.type===u.DOT?this.handle_dot(e):e.type===u.EOF?this.handle_eof(e):(e.type,u.UNKNOWN,this.handle_unknown(e,t))},A.prototype.handle_whitespace_and_comments=function(e,t){var i=e.newlines,n=this._options.keep_array_indentation&&k(this._flags.mode);if(e.comments_before)for(var r=e.comments_before.next();r;)this.handle_whitespace_and_comments(r,t),this.handle_token(r,t),r=e.comments_before.next();if(n)for(var s=0;s<i;s+=1)this.print_newline(s>0,t);else if(this._options.max_preserve_newlines&&i>this._options.max_preserve_newlines&&(i=this._options.max_preserve_newlines),this._options.preserve_newlines&&i>1){this.print_newline(!1,t);for(var o=1;o<i;o+=1)this.print_newline(!0,t)}};var x=["async","break","continue","return","throw","yield"];A.prototype.allow_wrap_or_preserved_newline=function(e,t){if(t=void 0!==t&&t,!this._output.just_added_newline()){var i=this._options.preserve_newlines&&e.newlines||t;if(h(this._flags.last_token.text,c)||h(e.text,c)){var n=h(this._flags.last_token.text,c)&&h(this._options.operator_position,g)||h(e.text,c);i=i&&n}if(i)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(f(this._flags.last_token,x))return;this._output.set_wrap_point()}}},A.prototype.print_newline=function(e,t){if(!t&&";"!==this._flags.last_token.text&&","!==this._flags.last_token.text&&"="!==this._flags.last_token.text&&(this._flags.last_token.type!==u.OPERATOR||"--"===this._flags.last_token.text||"++"===this._flags.last_token.text))for(var i=this._tokens.peek();!(this._flags.mode!==v||this._flags.if_block&&d(i,"else")||this._flags.do_block);)this.restore_mode();this._output.add_new_line(e)&&(this._flags.multiline_frame=!0)},A.prototype.print_token_line_indentation=function(e){this._output.just_added_newline()&&(this._options.keep_array_indentation&&e.newlines&&("["===e.text||k(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(e.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))},A.prototype.print_token=function(e){if(this._output.raw)this._output.add_raw_token(e);else{if(this._options.comma_first&&e.previous&&e.previous.type===u.COMMA&&this._output.just_added_newline()&&","===this._output.previous_line.last()){var t=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(t),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(e),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(e),this._output.non_breaking_space=!0,this._output.add_token(e.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)}},A.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},A.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))},A.prototype.set_mode=function(e){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,e),this._flags=this.create_flags(this._previous_flags,e),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},A.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===v&&C(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},A.prototype.start_of_object_property=function(){return this._flags.parent.mode===y&&this._flags.mode===v&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||f(this._flags.last_token,["get","set"]))},A.prototype.start_of_statement=function(e){var t=!1;return!!(t=(t=(t=(t=(t=(t=(t=t||f(this._flags.last_token,["var","let","const"])&&e.type===u.WORD)||d(this._flags.last_token,"do"))||!(this._flags.parent.mode===y&&this._flags.mode===v)&&f(this._flags.last_token,x)&&!e.newlines)||d(this._flags.last_token,"else")&&!(d(e,"if")&&!e.comments_before))||this._flags.last_token.type===u.END_EXPR&&(this._previous_flags.mode===S||this._previous_flags.mode===E))||this._flags.last_token.type===u.WORD&&this._flags.mode===m&&!this._flags.in_case&&!("--"===e.text||"++"===e.text)&&"function"!==this._last_last_text&&e.type!==u.WORD&&e.type!==u.RESERVED)||this._flags.mode===y&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||f(this._flags.last_token,["get","set"])))&&(this.set_mode(v),this.indent(),this.handle_whitespace_and_comments(e,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(e,f(e,["do","for","if","while"])),!0)},A.prototype.handle_start_expr=function(e){this.start_of_statement(e)||this.handle_whitespace_and_comments(e);var t=w;if("["===e.text){if(this._flags.last_token.type===u.WORD||")"===this._flags.last_token.text)return f(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(e),this.set_mode(t),this.indent(),void(this._options.space_in_paren&&(this._output.space_before_token=!0));t=b,k(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()),h(this._flags.last_token.type,[u.START_EXPR,u.END_EXPR,u.WORD,u.OPERATOR,u.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===u.RESERVED)"for"===this._flags.last_token.text?(this._output.space_before_token=this._options.space_before_conditional,t=S):h(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,t=E):h(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:"import"===this._flags.last_token.text&&""===e.whitespace_before?this._output.space_before_token=!1:(h(this._flags.last_token.text,l)||"catch"===this._flags.last_token.text)&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(e);else if(this._flags.last_token.type===u.WORD){this._output.space_before_token=!1;var i=this._tokens.peek(-3);if(this._options.space_after_named_function&&i){var n=this._tokens.peek(-4);f(i,["async","function"])||"*"===i.text&&f(n,["async","function"])?this._output.space_before_token=!0:this._flags.mode===y?"{"!==i.text&&","!==i.text&&("*"!==i.text||"{"!==n.text&&","!==n.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(e);(this._flags.last_token.type===u.RESERVED&&("function"===this._flags.last_word||"typeof"===this._flags.last_word)||"*"===this._flags.last_token.text&&(h(this._last_last_text,["function","yield"])||this._flags.mode===y&&h(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===u.START_BLOCK?this.print_newline():this._flags.last_token.type!==u.END_EXPR&&this._flags.last_token.type!==u.START_EXPR&&this._flags.last_token.type!==u.END_BLOCK&&"."!==this._flags.last_token.text&&this._flags.last_token.type!==u.COMMA||this.allow_wrap_or_preserved_newline(e,e.newlines),this.print_token(e),this.set_mode(t),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},A.prototype.handle_end_expr=function(e){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(e),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(e,"]"===e.text&&k(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type!==u.START_EXPR||this._options.space_in_empty_paren?this._output.space_before_token=!0:(this._output.trim(),this._output.space_before_token=!1)),this.deindent(),this.print_token(e),this.restore_mode(),C(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===E&&(this._previous_flags.mode=w,this._flags.do_block=!1,this._flags.do_while=!1)},A.prototype.handle_start_block=function(e){this.handle_whitespace_and_comments(e);var t=this._tokens.peek(),i=this._tokens.peek(1);"switch"===this._flags.last_word&&this._flags.last_token.type===u.END_EXPR?(this.set_mode(m),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(m):i&&(h(i.text,[":",","])&&h(t.type,[u.STRING,u.WORD,u.RESERVED])||h(t.text,["get","set","..."])&&h(i.type,[u.WORD,u.RESERVED]))?h(this._last_last_text,["class","interface"])&&!h(i.text,[":",","])?this.set_mode(m):this.set_mode(y):this._flags.last_token.type===u.OPERATOR&&"=>"===this._flags.last_token.text?this.set_mode(m):h(this._flags.last_token.type,[u.EQUALS,u.START_EXPR,u.COMMA,u.OPERATOR])||f(this._flags.last_token,["return","throw","import","default"])?this.set_mode(y):this.set_mode(m),this._flags.last_token&&f(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var n=!t.comments_before&&"}"===t.text,r=n&&"function"===this._flags.last_word&&this._flags.last_token.type===u.END_EXPR;if(this._options.brace_preserve_inline){var s=0,o=null;this._flags.inline_frame=!0;do{if(s+=1,(o=this._tokens.peek(s-1)).newlines){this._flags.inline_frame=!1;break}}while(o.type!==u.EOF&&(o.type!==u.END_BLOCK||o.opened!==e))}("expand"===this._options.brace_style||"none"===this._options.brace_style&&e.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==u.OPERATOR&&(r||this._flags.last_token.type===u.EQUALS||f(this._flags.last_token,p)&&"else"!==this._flags.last_token.text)?this._output.space_before_token=!0:this.print_newline(!1,!0):(!k(this._previous_flags.mode)||this._flags.last_token.type!==u.START_EXPR&&this._flags.last_token.type!==u.COMMA||((this._flags.last_token.type===u.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(e),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==u.OPERATOR&&this._flags.last_token.type!==u.START_EXPR&&(h(this._flags.last_token.type,[u.START_BLOCK,u.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(e),this.indent(),n||this._options.brace_preserve_inline&&this._flags.inline_frame||this.print_newline()},A.prototype.handle_end_block=function(e){for(this.handle_whitespace_and_comments(e);this._flags.mode===v;)this.restore_mode();var t=this._flags.last_token.type===u.START_BLOCK;this._flags.inline_frame&&!t?this._output.space_before_token=!0:"expand"===this._options.brace_style?t||this.print_newline():t||(k(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(e)},A.prototype.handle_word=function(e){if(e.type===u.RESERVED)if(h(e.text,["set","get"])&&this._flags.mode!==y)e.type=u.WORD;else if("import"===e.text&&h(this._tokens.peek().text,["(","."]))e.type=u.WORD;else if(h(e.text,["as","from"])&&!this._flags.import_block)e.type=u.WORD;else if(this._flags.mode===y){":"===this._tokens.peek().text&&(e.type=u.WORD)}if(this.start_of_statement(e)?f(this._flags.last_token,["var","let","const"])&&e.type===u.WORD&&(this._flags.declaration_statement=!0):!e.newlines||T(this._flags.mode)||this._flags.last_token.type===u.OPERATOR&&"--"!==this._flags.last_token.text&&"++"!==this._flags.last_token.text||this._flags.last_token.type===u.EQUALS||!this._options.preserve_newlines&&f(this._flags.last_token,["var","let","const","set","get"])?this.handle_whitespace_and_comments(e):(this.handle_whitespace_and_comments(e),this.print_newline()),this._flags.do_block&&!this._flags.do_while){if(d(e,"while"))return this._output.space_before_token=!0,this.print_token(e),this._output.space_before_token=!0,void(this._flags.do_while=!0);this.print_newline(),this._flags.do_block=!1}if(this._flags.if_block)if(!this._flags.else_block&&d(e,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===v;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&f(e,["case","default"]))return 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(e),void(this._flags.in_case=!0);if(this._flags.last_token.type!==u.COMMA&&this._flags.last_token.type!==u.START_EXPR&&this._flags.last_token.type!==u.EQUALS&&this._flags.last_token.type!==u.OPERATOR||this.start_of_object_property()||h(this._flags.last_token.text,["+","-"])&&":"===this._last_last_text&&this._flags.parent.mode===y||this.allow_wrap_or_preserved_newline(e),d(e,"function"))return(h(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!h(this._flags.last_token.text,["(","[","{",":","=",","])&&this._flags.last_token.type!==u.OPERATOR)&&(this._output.just_added_blankline()||e.comments_before||(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD?f(this._flags.last_token,["get","set","new","export"])||f(this._flags.last_token,x)||d(this._flags.last_token,"default")&&"export"===this._last_last_text||"declare"===this._flags.last_token.text?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===u.OPERATOR||"="===this._flags.last_token.text?this._output.space_before_token=!0:(this._flags.multiline_frame||!T(this._flags.mode)&&!k(this._flags.mode))&&this.print_newline(),this.print_token(e),void(this._flags.last_word=e.text);var t="NONE";(this._flags.last_token.type===u.END_BLOCK?this._previous_flags.inline_frame?t="SPACE":f(e,["else","catch","finally","from"])?"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&e.newlines?t="NEWLINE":(t="SPACE",this._output.space_before_token=!0):t="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&this._flags.mode===m?t="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&T(this._flags.mode)?t="SPACE":this._flags.last_token.type===u.STRING?t="NEWLINE":this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||"*"===this._flags.last_token.text&&(h(this._last_last_text,["function","yield"])||this._flags.mode===y&&h(this._last_last_text,["{",","]))?t="SPACE":this._flags.last_token.type===u.START_BLOCK?t=this._flags.inline_frame?"SPACE":"NEWLINE":this._flags.last_token.type===u.END_EXPR&&(this._output.space_before_token=!0,t="NEWLINE"),f(e,l)&&")"!==this._flags.last_token.text&&(t=this._flags.inline_frame||"else"===this._flags.last_token.text||"export"===this._flags.last_token.text?"SPACE":"NEWLINE"),f(e,["else","catch","finally"]))?(this._flags.last_token.type!==u.END_BLOCK||this._previous_flags.mode!==m||"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&e.newlines)&&!this._flags.inline_frame?this.print_newline():(this._output.trim(!0),"}"!==this._output.current_line.last()&&this.print_newline(),this._output.space_before_token=!0):"NEWLINE"===t?f(this._flags.last_token,p)||"declare"===this._flags.last_token.text&&f(e,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==u.END_EXPR?this._flags.last_token.type===u.START_EXPR&&f(e,["var","let","const"])||":"===this._flags.last_token.text||(d(e,"if")&&d(e.previous,"else")?this._output.space_before_token=!0:this.print_newline()):f(e,l)&&")"!==this._flags.last_token.text&&this.print_newline():this._flags.multiline_frame&&k(this._flags.mode)&&","===this._flags.last_token.text&&"}"===this._last_last_text?this.print_newline():"SPACE"===t&&(this._output.space_before_token=!0);!e.previous||e.previous.type!==u.WORD&&e.previous.type!==u.RESERVED||(this._output.space_before_token=!0),this.print_token(e),this._flags.last_word=e.text,e.type===u.RESERVED&&("do"===e.text?this._flags.do_block=!0:"if"===e.text?this._flags.if_block=!0:"import"===e.text?this._flags.import_block=!0:this._flags.import_block&&d(e,"from")&&(this._flags.import_block=!1))},A.prototype.handle_semicolon=function(e){this.start_of_statement(e)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(e);for(var t=this._tokens.peek();!(this._flags.mode!==v||this._flags.if_block&&d(t,"else")||this._flags.do_block);)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(e)},A.prototype.handle_string=function(e){(!e.text.startsWith("`")||0!==e.newlines||""!==e.whitespace_before||")"!==e.previous.text&&this._flags.last_token.type!==u.WORD)&&(this.start_of_statement(e)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(e),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(e):!e.text.startsWith("`")||this._flags.last_token.type!==u.END_EXPR||"]"!==e.previous.text&&")"!==e.previous.text||0!==e.newlines?this.print_newline():this._output.space_before_token=!0)),this.print_token(e)},A.prototype.handle_equals=function(e){this.start_of_statement(e)||this.handle_whitespace_and_comments(e),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(e),this._output.space_before_token=!0},A.prototype.handle_comma=function(e){this.handle_whitespace_and_comments(e,!0),this.print_token(e),this._output.space_before_token=!0,this._flags.declaration_statement?(T(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(e)):this._flags.mode===y||this._flags.mode===v&&this._flags.parent.mode===y?(this._flags.mode===v&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(e)},A.prototype.handle_operator=function(e){var t="*"===e.text&&(f(this._flags.last_token,["function","yield"])||h(this._flags.last_token.type,[u.START_BLOCK,u.COMMA,u.END_BLOCK,u.SEMICOLON])),i=h(e.text,["-","+"])&&(h(this._flags.last_token.type,[u.START_BLOCK,u.START_EXPR,u.EQUALS,u.OPERATOR])||h(this._flags.last_token.text,l)||","===this._flags.last_token.text);if(this.start_of_statement(e));else{var n=!t;this.handle_whitespace_and_comments(e,n)}if("*"!==e.text||this._flags.last_token.type!==u.DOT)if("::"!==e.text)if(h(e.text,["-","+"])&&this.start_of_object_property())this.print_token(e);else{if(this._flags.last_token.type===u.OPERATOR&&h(this._options.operator_position,g)&&this.allow_wrap_or_preserved_newline(e),":"===e.text&&this._flags.in_case)return this.print_token(e),this._flags.in_case=!1,this._flags.case_body=!0,void(this._tokens.peek().type!==u.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0));var r=!0,s=!0,o=!1;if(":"===e.text?0===this._flags.ternary_depth?r=!1:(this._flags.ternary_depth-=1,o=!0):"?"===e.text&&(this._flags.ternary_depth+=1),!i&&!t&&this._options.preserve_newlines&&h(e.text,c)){var a=":"===e.text,d=a&&o,y=a&&!o;switch(this._options.operator_position){case _.before_newline:return this._output.space_before_token=!y,this.print_token(e),a&&!d||this.allow_wrap_or_preserved_newline(e),void(this._output.space_before_token=!0);case _.after_newline:return this._output.space_before_token=!0,!a||d?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(e):this._output.space_before_token=!1,this.print_token(e),void(this._output.space_before_token=!0);case _.preserve_newline:return y||this.allow_wrap_or_preserved_newline(e),r=!(this._output.just_added_newline()||y),this._output.space_before_token=r,this.print_token(e),void(this._output.space_before_token=!0)}}if(t){this.allow_wrap_or_preserved_newline(e),r=!1;var b=this._tokens.peek();s=b&&h(b.type,[u.WORD,u.RESERVED])}else if("..."===e.text)this.allow_wrap_or_preserved_newline(e),r=this._flags.last_token.type===u.START_BLOCK,s=!1;else if(h(e.text,["--","++","!","~"])||i){if(this._flags.last_token.type!==u.COMMA&&this._flags.last_token.type!==u.START_EXPR||this.allow_wrap_or_preserved_newline(e),r=!1,s=!1,e.newlines&&("--"===e.text||"++"===e.text||"~"===e.text)){var S=f(this._flags.last_token,p)&&e.newlines;S&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(S,!0)}";"===this._flags.last_token.text&&T(this._flags.mode)&&(r=!0),this._flags.last_token.type===u.RESERVED?r=!0:this._flags.last_token.type===u.END_EXPR?r=!("]"===this._flags.last_token.text&&("--"===e.text||"++"===e.text)):this._flags.last_token.type===u.OPERATOR&&(r=h(e.text,["--","-","++","+"])&&h(this._flags.last_token.text,["--","-","++","+"]),h(e.text,["+","-"])&&h(this._flags.last_token.text,["--","++"])&&(s=!0)),(this._flags.mode!==m||this._flags.inline_frame)&&this._flags.mode!==v||"{"!==this._flags.last_token.text&&";"!==this._flags.last_token.text||this.print_newline()}this._output.space_before_token=this._output.space_before_token||r,this.print_token(e),this._output.space_before_token=s}else this.print_token(e);else this.print_token(e)},A.prototype.handle_block_comment=function(e,t){return this._output.raw?(this._output.add_raw_token(e),void(e.directives&&"end"===e.directives.preserve&&(this._output.raw=this._options.test_output_raw))):e.directives?(this.print_newline(!1,t),this.print_token(e),"start"===e.directives.preserve&&(this._output.raw=!0),void this.print_newline(!1,!0)):s.newline.test(e.text)||e.newlines?void this.print_block_commment(e,t):(this._output.space_before_token=!0,this.print_token(e),void(this._output.space_before_token=!0))},A.prototype.print_block_commment=function(e,t){var i,n=function(e){for(var t=[],i=(e=e.replace(s.allLineBreaks,"\n")).indexOf("\n");-1!==i;)t.push(e.substring(0,i)),i=(e=e.substring(i+1)).indexOf("\n");return e.length&&t.push(e),t}(e.text),r=!1,o=!1,a=e.whitespace_before,l=a.length;if(this.print_newline(!1,t),this.print_token_line_indentation(e),this._output.add_token(n[0]),this.print_newline(!1,t),n.length>1){for(r=function(e,t){for(var i=0;i<e.length;i++)if(e[i].trim().charAt(0)!==t)return!1;return!0}(n=n.slice(1),"*"),o=function(e,t){for(var i,n=0,r=e.length;n<r;n++)if((i=e[n])&&0!==i.indexOf(t))return!1;return!0}(n,a),r&&(this._flags.alignment=1),i=0;i<n.length;i++)r?(this.print_token_line_indentation(e),this._output.add_token(n[i].replace(/^\s+/g,""))):o&&n[i]?(this.print_token_line_indentation(e),this._output.add_token(n[i].substring(l))):(this._output.current_line.set_indent(-1),this._output.add_token(n[i])),this.print_newline(!1,t);this._flags.alignment=0}},A.prototype.handle_comment=function(e,t){e.newlines?this.print_newline(!1,t):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(e),this.print_newline(!1,t)},A.prototype.handle_dot=function(e){this.start_of_statement(e)||this.handle_whitespace_and_comments(e,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),f(this._flags.last_token,p)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(e,")"===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(e)},A.prototype.handle_unknown=function(e,t){this.print_token(e),"\n"===e.text[e.text.length-1]&&this.print_newline(!1,t)},A.prototype.handle_eof=function(e){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(e)},e.exports.Beautifier=A},function(e){function t(e){this.__parent=e,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=[]}function i(e,t){this.__cache=[""],this.__indent_size=e.indent_size,this.__indent_string=e.indent_char,e.indent_with_tabs||(this.__indent_string=new Array(e.indent_size+1).join(e.indent_char)),t=t||"",e.indent_level>0&&(t=new Array(e.indent_level+1).join(this.__indent_string)),this.__base_string=t,this.__base_string_length=t.length}function n(e,n){this.__indent_cache=new i(e,n),this.raw=!1,this._end_with_newline=e.end_with_newline,this.indent_size=e.indent_size,this.wrap_line_length=e.wrap_line_length,this.indent_empty_lines=e.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new t(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}t.prototype.clone_empty=function(){var e=new t(this.__parent);return e.set_indent(this.__indent_count,this.__alignment_count),e},t.prototype.item=function(e){return e<0?this.__items[this.__items.length+e]:this.__items[e]},t.prototype.has_match=function(e){for(var t=this.__items.length-1;t>=0;t--)if(this.__items[t].match(e))return!0;return!1},t.prototype.set_indent=function(e,t){this.is_empty()&&(this.__indent_count=e||0,this.__alignment_count=t||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},t.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)},t.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},t.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var e=this.__parent.current_line;return e.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),e.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),e.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===e.__items[0]&&(e.__items.splice(0,1),e.__character_count-=1),!0}return!1},t.prototype.is_empty=function(){return 0===this.__items.length},t.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},t.prototype.push=function(e){this.__items.push(e);var t=e.lastIndexOf("\n");-1!==t?this.__character_count=e.length-t:this.__character_count+=e.length},t.prototype.pop=function(){var e=null;return this.is_empty()||(e=this.__items.pop(),this.__character_count-=e.length),e},t.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},t.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},t.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},t.prototype.toString=function(){var e="";return this.is_empty()?this.__parent.indent_empty_lines&&(e=this.__parent.get_indent_string(this.__indent_count)):(e=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),e+=this.__items.join("")),e},i.prototype.get_indent_size=function(e,t){var i=this.__base_string_length;return t=t||0,e<0&&(i=0),i+=e*this.__indent_size,i+=t},i.prototype.get_indent_string=function(e,t){var i=this.__base_string;return t=t||0,e<0&&(e=0,i=""),t+=e*this.__indent_size,this.__ensure_cache(t),i+=this.__cache[t]},i.prototype.__ensure_cache=function(e){for(;e>=this.__cache.length;)this.__add_column()},i.prototype.__add_column=function(){var e=this.__cache.length,t=0,i="";this.__indent_size&&e>=this.__indent_size&&(e-=(t=Math.floor(e/this.__indent_size))*this.__indent_size,i=new Array(t+1).join(this.__indent_string)),e&&(i+=new Array(e+1).join(" ")),this.__cache.push(i)},n.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},n.prototype.get_line_number=function(){return this.__lines.length},n.prototype.get_indent_string=function(e,t){return this.__indent_cache.get_indent_string(e,t)},n.prototype.get_indent_size=function(e,t){return this.__indent_cache.get_indent_size(e,t)},n.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},n.prototype.add_new_line=function(e){return!(this.is_empty()||!e&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},n.prototype.get_code=function(e){this.trim(!0);var t=this.current_line.pop();t&&("\n"===t[t.length-1]&&(t=t.replace(/\n+$/g,"")),this.current_line.push(t)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join("\n");return"\n"!==e&&(i=i.replace(/[\n]/g,e)),i},n.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},n.prototype.set_indent=function(e,t){return e=e||0,t=t||0,this.next_line.set_indent(e,t),this.__lines.length>1?(this.current_line.set_indent(e,t),!0):(this.current_line.set_indent(),!1)},n.prototype.add_raw_token=function(e){for(var t=0;t<e.newlines;t++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(e.whitespace_before),this.current_line.push(e.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},n.prototype.add_token=function(e){this.__add_space_before_token(),this.current_line.push(e),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},n.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(" "))},n.prototype.remove_indent=function(e){for(var t=this.__lines.length;e<t;)this.__lines[e]._remove_indent(),e++;this.current_line._remove_wrap_indent()},n.prototype.trim=function(e){for(e=void 0!==e&&e,this.current_line.trim();e&&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},n.prototype.just_added_newline=function(){return this.current_line.is_empty()},n.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},n.prototype.ensure_empty_line_above=function(e,i){for(var n=this.__lines.length-2;n>=0;){var r=this.__lines[n];if(r.is_empty())break;if(0!==r.item(0).indexOf(e)&&r.item(-1)!==i){this.__lines.splice(n+1,0,new t(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},e.exports.Output=n},function(e){e.exports.Token=function(e,t,i,n){this.type=e,this.text=t,this.comments_before=null,this.newlines=i||0,this.whitespace_before=n||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}},function(e,t){var i="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",n="\\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",r="\\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",s="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",o="(?:"+s+"|[\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a"+n+"])",a="(?:"+s+"|["+i+n+r+"])*";t.identifier=new RegExp(o+a,"g"),t.identifierStart=new RegExp(o),t.identifierMatch=new RegExp("(?:"+s+"|["+i+n+r+"])+");t.newline=/[\n\r\u2028\u2029]/,t.lineBreak=new RegExp("\r\n|"+t.newline.source),t.allLineBreaks=new RegExp(t.lineBreak.source,"g")},function(e,t,i){var n=i(6).Options,r=["before-newline","after-newline","preserve-newline"];function s(e){n.call(this,e,"js");var t=this.raw_options.brace_style||null;"expand-strict"===t?this.raw_options.brace_style="expand":"collapse-preserve-inline"===t?this.raw_options.brace_style="collapse,preserve-inline":void 0!==this.raw_options.braces_on_own_line&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var i=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var s=0;s<i.length;s++)"preserve-inline"===i[s]?this.brace_preserve_inline=!0:this.brace_style=i[s];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",r),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}s.prototype=new n,e.exports.Options=s},function(e){function t(e,t){this.raw_options=i(e,t),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","\t"===this.indent_char),this.indent_with_tabs&&(this.indent_char="\t",1===this.indent_size&&(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"])}function i(e,t){var i,r={};for(i in e=n(e))i!==t&&(r[i]=e[i]);if(t&&e[t])for(i in e[t])r[i]=e[t][i];return r}function n(e){var t,i={};for(t in e){i[t.replace(/-/g,"_")]=e[t]}return i}t.prototype._get_array=function(e,t){var i=this.raw_options[e],n=t||[];return"object"==typeof i?null!==i&&"function"==typeof i.concat&&(n=i.concat()):"string"==typeof i&&(n=i.split(/[^a-zA-Z0-9_\/\-]+/)),n},t.prototype._get_boolean=function(e,t){var i=this.raw_options[e];return void 0===i?!!t:!!i},t.prototype._get_characters=function(e,t){var i=this.raw_options[e],n=t||"";return"string"==typeof i&&(n=i.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),n},t.prototype._get_number=function(e,t){var i=this.raw_options[e];t=parseInt(t,10),isNaN(t)&&(t=0);var n=parseInt(i,10);return isNaN(n)&&(n=t),n},t.prototype._get_selection=function(e,t,i){var n=this._get_selection_list(e,t,i);if(1!==n.length)throw new Error("Invalid Option Value: The option '"+e+"' can only be one of the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return n[0]},t.prototype._get_selection_list=function(e,t,i){if(!t||0===t.length)throw new Error("Selection list cannot be empty.");if(i=i||[t[0]],!this._is_valid_selection(i,t))throw new Error("Invalid Default Value!");var n=this._get_array(e,i);if(!this._is_valid_selection(n,t))throw new Error("Invalid Option Value: The option '"+e+"' can contain only the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return n},t.prototype._is_valid_selection=function(e,t){return e.length&&t.length&&!e.some((function(e){return-1===t.indexOf(e)}))},e.exports.Options=t,e.exports.normalizeOpts=n,e.exports.mergeOpts=i},function(e,t,i){var n=i(8).InputScanner,r=i(9).Tokenizer,s=i(9).TOKEN,o=i(13).Directives,a=i(4),l=i(12).Pattern,c=i(14).TemplatablePattern;function u(e,t){return-1!==t.indexOf(e)}var h={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:s.START,RAW:s.RAW,EOF:s.EOF},d=new o(/\/\*/,/\*\//),f=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,p=/[0-9]/,_=/[^\d\.]/,g=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),m=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";m=(m="\\?\\.(?!\\d) "+(m=m.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"))).replace(/ /g,"|");var v,y=new RegExp(m),b="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),S=b.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),E=new RegExp("^(?:"+S.join("|")+")$"),w=function(e,t){r.call(this,e,t),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var i=new l(this._input),n=new c(this._input).read_options(this._options);this.__patterns={template:n,identifier:n.starting_with(a.identifier).matching(a.identifierMatch),number:i.matching(f),punct:i.matching(y),comment:i.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:i.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:i.matching(/<!--/),html_comment_end:i.matching(/-->/),include:i.starting_with(/#include/).until_after(a.lineBreak),shebang:i.starting_with(/#!/).until_after(a.lineBreak),xml:i.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:n.until(/['\\\n\r\u2028\u2029]/),double_quote:n.until(/["\\\n\r\u2028\u2029]/),template_text:n.until(/[`\\$]/),template_expression:n.until(/[`}\\]/)}};(w.prototype=new r)._is_comment=function(e){return e.type===h.COMMENT||e.type===h.BLOCK_COMMENT||e.type===h.UNKNOWN},w.prototype._is_opening=function(e){return e.type===h.START_BLOCK||e.type===h.START_EXPR},w.prototype._is_closing=function(e,t){return(e.type===h.END_BLOCK||e.type===h.END_EXPR)&&t&&("]"===e.text&&"["===t.text||")"===e.text&&"("===t.text||"}"===e.text&&"{"===t.text)},w.prototype._reset=function(){v=!1},w.prototype._get_next_token=function(e,t){var i=null;this._readWhitespace();var n=this._input.peek();return null===n?this._create_token(h.EOF,""):i=(i=(i=(i=(i=(i=(i=(i=(i=(i=i||this._read_non_javascript(n))||this._read_string(n))||this._read_pair(n,this._input.peek(1)))||this._read_word(e))||this._read_singles(n))||this._read_comment(n))||this._read_regexp(n,e))||this._read_xml(n,e))||this._read_punctuation())||this._create_token(h.UNKNOWN,this._input.next())},w.prototype._read_word=function(e){var t;return""!==(t=this.__patterns.identifier.read())?(t=t.replace(a.allLineBreaks,"\n"),e.type!==h.DOT&&(e.type!==h.RESERVED||"set"!==e.text&&"get"!==e.text)&&E.test(t)?"in"!==t&&"of"!==t||e.type!==h.WORD&&e.type!==h.STRING?this._create_token(h.RESERVED,t):this._create_token(h.OPERATOR,t):this._create_token(h.WORD,t)):""!==(t=this.__patterns.number.read())?this._create_token(h.WORD,t):void 0},w.prototype._read_singles=function(e){var t=null;return"("===e||"["===e?t=this._create_token(h.START_EXPR,e):")"===e||"]"===e?t=this._create_token(h.END_EXPR,e):"{"===e?t=this._create_token(h.START_BLOCK,e):"}"===e?t=this._create_token(h.END_BLOCK,e):";"===e?t=this._create_token(h.SEMICOLON,e):"."===e&&_.test(this._input.peek(1))?t=this._create_token(h.DOT,e):","===e&&(t=this._create_token(h.COMMA,e)),t&&this._input.next(),t},w.prototype._read_pair=function(e,t){var i=null;return"#"===e&&"{"===t&&(i=this._create_token(h.START_BLOCK,e+t)),i&&(this._input.next(),this._input.next()),i},w.prototype._read_punctuation=function(){var e=this.__patterns.punct.read();if(""!==e)return"="===e?this._create_token(h.EQUALS,e):"?."===e?this._create_token(h.DOT,e):this._create_token(h.OPERATOR,e)},w.prototype._read_non_javascript=function(e){var t="";if("#"===e){if(this._is_first_token()&&(t=this.__patterns.shebang.read()))return this._create_token(h.UNKNOWN,t.trim()+"\n");if(t=this.__patterns.include.read())return this._create_token(h.UNKNOWN,t.trim()+"\n");e=this._input.next();var i="#";if(this._input.hasNext()&&this._input.testChar(p)){do{i+=e=this._input.next()}while(this._input.hasNext()&&"#"!==e&&"="!==e);return"#"===e||("["===this._input.peek()&&"]"===this._input.peek(1)?(i+="[]",this._input.next(),this._input.next()):"{"===this._input.peek()&&"}"===this._input.peek(1)&&(i+="{}",this._input.next(),this._input.next())),this._create_token(h.WORD,i)}this._input.back()}else if("<"===e&&this._is_first_token()){if(t=this.__patterns.html_comment_start.read()){for(;this._input.hasNext()&&!this._input.testChar(a.newline);)t+=this._input.next();return v=!0,this._create_token(h.COMMENT,t)}}else if(v&&"-"===e&&(t=this.__patterns.html_comment_end.read()))return v=!1,this._create_token(h.COMMENT,t);return null},w.prototype._read_comment=function(e){var t=null;if("/"===e){var i="";if("*"===this._input.peek(1)){i=this.__patterns.block_comment.read();var n=d.get_directives(i);n&&"start"===n.ignore&&(i+=d.readIgnored(this._input)),i=i.replace(a.allLineBreaks,"\n"),(t=this._create_token(h.BLOCK_COMMENT,i)).directives=n}else"/"===this._input.peek(1)&&(i=this.__patterns.comment.read(),t=this._create_token(h.COMMENT,i))}return t},w.prototype._read_string=function(e){if("`"===e||"'"===e||'"'===e){var t=this._input.next();return this.has_char_escapes=!1,t+="`"===e?this._read_string_recursive("`",!0,"${"):this._read_string_recursive(e),this.has_char_escapes&&this._options.unescape_strings&&(t=function(e){var t="",i=0,r=new n(e),s=null;for(;r.hasNext();)if((s=r.match(/([\s]|[^\\]|\\\\)+/g))&&(t+=s[0]),"\\"===r.peek()){if(r.next(),"x"===r.peek())s=r.match(/x([0-9A-Fa-f]{2})/g);else{if("u"!==r.peek()){t+="\\",r.hasNext()&&(t+=r.next());continue}(s=r.match(/u([0-9A-Fa-f]{4})/g))||(s=r.match(/u\{([0-9A-Fa-f]+)\}/g))}if(!s)return e;if((i=parseInt(s[1],16))>126&&i<=255&&0===s[0].indexOf("x"))return e;t+=i>=0&&i<32||i>1114111?"\\"+s[0]:34===i||39===i||92===i?"\\"+String.fromCharCode(i):String.fromCharCode(i)}return t}(t)),this._input.peek()===e&&(t+=this._input.next()),t=t.replace(a.allLineBreaks,"\n"),this._create_token(h.STRING,t)}return null},w.prototype._allow_regexp_or_xml=function(e){return e.type===h.RESERVED&&u(e.text,["return","case","throw","else","do","typeof","yield"])||e.type===h.END_EXPR&&")"===e.text&&e.opened.previous.type===h.RESERVED&&u(e.opened.previous.text,["if","while","for"])||u(e.type,[h.COMMENT,h.START_EXPR,h.START_BLOCK,h.START,h.END_BLOCK,h.OPERATOR,h.EQUALS,h.EOF,h.SEMICOLON,h.COMMA])},w.prototype._read_regexp=function(e,t){if("/"===e&&this._allow_regexp_or_xml(t)){for(var i=this._input.next(),n=!1,r=!1;this._input.hasNext()&&(n||r||this._input.peek()!==e)&&!this._input.testChar(a.newline);)i+=this._input.peek(),n?n=!1:(n="\\"===this._input.peek(),"["===this._input.peek()?r=!0:"]"===this._input.peek()&&(r=!1)),this._input.next();return this._input.peek()===e&&(i+=this._input.next(),i+=this._input.read(a.identifier)),this._create_token(h.STRING,i)}return null},w.prototype._read_xml=function(e,t){if(this._options.e4x&&"<"===e&&this._allow_regexp_or_xml(t)){var i="",n=this.__patterns.xml.read_match();if(n){for(var r=n[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),s=0===r.indexOf("{"),o=0;n;){var l=!!n[1],c=n[2];if(!(!!n[n.length-1]||"![CDATA["===c.slice(0,8))&&(c===r||s&&c.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(l?--o:++o),i+=n[0],o<=0)break;n=this.__patterns.xml.read_match()}return n||(i+=this._input.match(/[\s\S]*/g)[0]),i=i.replace(a.allLineBreaks,"\n"),this._create_token(h.STRING,i)}}return null},w.prototype._read_string_recursive=function(e,t,i){var n,r;"'"===e?r=this.__patterns.single_quote:'"'===e?r=this.__patterns.double_quote:"`"===e?r=this.__patterns.template_text:"}"===e&&(r=this.__patterns.template_expression);for(var s=r.read(),o="";this._input.hasNext();){if((o=this._input.next())===e||!t&&a.newline.test(o)){this._input.back();break}"\\"===o&&this._input.hasNext()?("x"===(n=this._input.peek())||"u"===n?this.has_char_escapes=!0:"\r"===n&&"\n"===this._input.peek(1)&&this._input.next(),o+=this._input.next()):i&&("${"===i&&"$"===o&&"{"===this._input.peek()&&(o+=this._input.next()),i===o&&(o+="`"===e?this._read_string_recursive("}",t,"`"):this._read_string_recursive("`",t,"${"),this._input.hasNext()&&(o+=this._input.next()))),s+=o+=r.read()}return s},e.exports.Tokenizer=w,e.exports.TOKEN=h,e.exports.positionable_operators=g.slice(),e.exports.line_starters=b.slice()},function(e){var t=RegExp.prototype.hasOwnProperty("sticky");function i(e){this.__input=e||"",this.__input_length=this.__input.length,this.__position=0}i.prototype.restart=function(){this.__position=0},i.prototype.back=function(){this.__position>0&&(this.__position-=1)},i.prototype.hasNext=function(){return this.__position<this.__input_length},i.prototype.next=function(){var e=null;return this.hasNext()&&(e=this.__input.charAt(this.__position),this.__position+=1),e},i.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&(t=this.__input.charAt(e)),t},i.prototype.__match=function(e,i){e.lastIndex=i;var n=e.exec(this.__input);return!n||t&&e.sticky||n.index!==i&&(n=null),n},i.prototype.test=function(e,t){return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&!!this.__match(e,t)},i.prototype.testChar=function(e,t){var i=this.peek(t);return e.lastIndex=0,null!==i&&e.test(i)},i.prototype.match=function(e){var t=this.__match(e,this.__position);return t?this.__position+=t[0].length:t=null,t},i.prototype.read=function(e,t,i){var n,r="";return e&&(n=this.match(e))&&(r+=n[0]),!t||!n&&e||(r+=this.readUntil(t,i)),r},i.prototype.readUntil=function(e,t){var i,n=this.__position;e.lastIndex=this.__position;var r=e.exec(this.__input);return r?(n=r.index,t&&(n+=r[0].length)):n=this.__input_length,i=this.__input.substring(this.__position,n),this.__position=n,i},i.prototype.readUntilAfter=function(e){return this.readUntil(e,!0)},i.prototype.get_regexp=function(e,i){var n=null,r="g";return i&&t&&(r="y"),"string"==typeof e&&""!==e?n=new RegExp(e,r):e&&(n=new RegExp(e.source,r)),n},i.prototype.get_literal_regexp=function(e){return RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},i.prototype.peekUntilAfter=function(e){var t=this.__position,i=this.readUntilAfter(e);return this.__position=t,i},i.prototype.lookBack=function(e){var t=this.__position-1;return t>=e.length&&this.__input.substring(t-e.length,t).toLowerCase()===e},e.exports.InputScanner=i},function(e,t,i){var n=i(8).InputScanner,r=i(3).Token,s=i(10).TokenStream,o=i(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(e,t){this._input=new n(e),this._options=t||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};l.prototype.tokenize=function(){var e;this._input.restart(),this.__tokens=new s,this._reset();for(var t=new r(a.START,""),i=null,n=[],o=new s;t.type!==a.EOF;){for(e=this._get_next_token(t,i);this._is_comment(e);)o.add(e),e=this._get_next_token(t,i);o.isEmpty()||(e.comments_before=o,o=new s),e.parent=i,this._is_opening(e)?(n.push(i),i=e):i&&this._is_closing(e,i)&&(e.opened=i,i.closed=e,i=n.pop(),e.parent=i),e.previous=t,t.next=e,this.__tokens.add(e),t=e}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(e,t){this._readWhitespace();var i=this._input.read(/.+/g);return i?this._create_token(a.RAW,i):this._create_token(a.EOF,"")},l.prototype._is_comment=function(e){return!1},l.prototype._is_opening=function(e){return!1},l.prototype._is_closing=function(e,t){return!1},l.prototype._create_token=function(e,t){return new r(e,t,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},e.exports.Tokenizer=l,e.exports.TOKEN=a},function(e){function t(e){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=e}t.prototype.restart=function(){this.__position=0},t.prototype.isEmpty=function(){return 0===this.__tokens_length},t.prototype.hasNext=function(){return this.__position<this.__tokens_length},t.prototype.next=function(){var e=null;return this.hasNext()&&(e=this.__tokens[this.__position],this.__position+=1),e},t.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__tokens_length&&(t=this.__tokens[e]),t},t.prototype.add=function(e){this.__parent_token&&(e.parent=this.__parent_token),this.__tokens.push(e),this.__tokens_length+=1},e.exports.TokenStream=t},function(e,t,i){var n=i(12).Pattern;function r(e,t){n.call(this,e,t),t?this._line_regexp=this._input.get_regexp(t._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}r.prototype=new n,r.prototype.__set_whitespace_patterns=function(e,t){e+="\\t ",t+="\\n\\r",this._match_pattern=this._input.get_regexp("["+e+t+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+t+"]")},r.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var e=this._input.read(this._match_pattern);if(" "===e)this.whitespace_before_token=" ";else if(e){var t=this.__split(this._newline_regexp,e);this.newline_count=t.length-1,this.whitespace_before_token=t[this.newline_count]}return e},r.prototype.matching=function(e,t){var i=this._create();return i.__set_whitespace_patterns(e,t),i._update(),i},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(e,t){e.lastIndex=0;for(var i=0,n=[],r=e.exec(t);r;)n.push(t.substring(i,r.index)),i=r.index+r[0].length,r=e.exec(t);return i<t.length?n.push(t.substring(i,t.length)):n.push(""),n},e.exports.WhitespacePattern=r},function(e){function t(e,t){this._input=e,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,t&&(this._starting_pattern=this._input.get_regexp(t._starting_pattern,!0),this._match_pattern=this._input.get_regexp(t._match_pattern,!0),this._until_pattern=this._input.get_regexp(t._until_pattern),this._until_after=t._until_after)}t.prototype.read=function(){var e=this._input.read(this._starting_pattern);return this._starting_pattern&&!e||(e+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),e},t.prototype.read_match=function(){return this._input.match(this._match_pattern)},t.prototype.until_after=function(e){var t=this._create();return t._until_after=!0,t._until_pattern=this._input.get_regexp(e),t._update(),t},t.prototype.until=function(e){var t=this._create();return t._until_after=!1,t._until_pattern=this._input.get_regexp(e),t._update(),t},t.prototype.starting_with=function(e){var t=this._create();return t._starting_pattern=this._input.get_regexp(e,!0),t._update(),t},t.prototype.matching=function(e){var t=this._create();return t._match_pattern=this._input.get_regexp(e,!0),t._update(),t},t.prototype._create=function(){return new t(this._input,this)},t.prototype._update=function(){},e.exports.Pattern=t},function(e){function t(e,t){e="string"==typeof e?e:e.source,t="string"==typeof t?t:t.source,this.__directives_block_pattern=new RegExp(e+/ beautify( \w+[:]\w+)+ /.source+t,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(e+/\sbeautify\signore:end\s/.source+t,"g")}t.prototype.get_directives=function(e){if(!e.match(this.__directives_block_pattern))return null;var t={};this.__directive_pattern.lastIndex=0;for(var i=this.__directive_pattern.exec(e);i;)t[i[1]]=i[2],i=this.__directive_pattern.exec(e);return t},t.prototype.readIgnored=function(e){return e.readUntilAfter(this.__directives_end_ignore_pattern)},e.exports.Directives=t},function(e,t,i){var n=i(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function s(e,t){n.call(this,e,t),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),t&&(this.__template_pattern=this._input.get_regexp(t.__template_pattern),this._excluded=Object.assign(this._excluded,t._excluded),this._disabled=Object.assign(this._disabled,t._disabled));var i=new n(e);this.__patterns={handlebars_comment:i.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:i.starting_with(/{{{/).until_after(/}}}/),handlebars:i.starting_with(/{{/).until_after(/}}/),php:i.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:i.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:i.starting_with(/{%/).until_after(/%}/),django_value:i.starting_with(/{{/).until_after(/}}/),django_comment:i.starting_with(/{#/).until_after(/#}/),smarty:i.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:i.starting_with(/{\*/).until_after(/\*}/),smarty_literal:i.starting_with(/{literal}/).until_after(/{\/literal}/)}}s.prototype=new n,s.prototype._create=function(){return new s(this._input,this)},s.prototype._update=function(){this.__set_templated_pattern()},s.prototype.disable=function(e){var t=this._create();return t._disabled[e]=!0,t._update(),t},s.prototype.read_options=function(e){var t=this._create();for(var i in r)t._disabled[i]=-1===e.templating.indexOf(i);return t._update(),t},s.prototype.exclude=function(e){var t=this._create();return t._excluded[e]=!0,t._update(),t},s.prototype.read=function(){var e="";e=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern);for(var t=this._read_template();t;)this._match_pattern?t+=this._input.read(this._match_pattern):t+=this._input.readUntil(this.__template_pattern),e+=t,t=this._read_template();return this._until_after&&(e+=this._input.readUntilAfter(this._until_pattern)),e},s.prototype.__set_templated_pattern=function(){var e=[];this._disabled.php||e.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||e.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||e.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||e.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(e.push(this.__patterns.django._starting_pattern.source),e.push(this.__patterns.django_value._starting_pattern.source),e.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||e.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&e.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+e.join("|")+")")},s.prototype._read_template=function(){var e="",t=this._input.peek();if("<"===t){var i=this._input.peek(1);this._disabled.php||this._excluded.php||"?"!==i||(e=e||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==i||(e=e||this.__patterns.erb.read())}else"{"===t&&(this._disabled.handlebars||this._excluded.handlebars||(e=(e=(e=e||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(e=e||this.__patterns.django_value.read()),this._excluded.django||(e=(e=e||this.__patterns.django_comment.read())||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(e=(e=(e=e||this.__patterns.smarty_comment.read())||this.__patterns.smarty_literal.read())||this.__patterns.smarty.read()));return e},e.exports.TemplatablePattern=s}],t={};var i=function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,i),s.exports}(0);n=i}();var r=n;void 0===(i=function(){return{js_beautify:r}}.apply(t,[]))||(e.exports=i)}()},32834:function(e){e.exports=function(){"use strict";function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}function i(e,t){if(e){if("string"==typeof e)return n(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s={exports:{}};function o(){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 a(e){s.exports.defaults=e}s.exports={defaults:o(),getDefaults:o,changeDefaults:a};var l=/[&<>"']/,c=/[&<>"']/g,u=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,d={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},f=function(e){return d[e]};function p(e,t){if(t){if(l.test(e))return e.replace(c,f)}else if(u.test(e))return e.replace(h,f);return e}var _=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function g(e){return e.replace(_,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var m=/(^|[^\[])\^/g;function v(e,t){e=e.source||e,t=t||"";var i={replace:function(t,n){return n=(n=n.source||n).replace(m,"$1"),e=e.replace(t,n),i},getRegex:function(){return new RegExp(e,t)}};return i}var y=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function S(e,t,i){if(e){var n;try{n=decodeURIComponent(g(i)).replace(y,"").toLowerCase()}catch(e){return null}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:")||0===n.indexOf("data:"))return null}t&&!b.test(i)&&(i=T(t,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(e){return null}return i}var E={},w=/^[^:]+:\/*[^/]*$/,C=/^([^:]+:)[\s\S]*$/,k=/^([^:]+:\/*[^/]*)[\s\S]*$/;function T(e,t){E[" "+e]||(w.test(e)?E[" "+e]=e+"/":E[" "+e]=D(e,"/",!0));var i=-1===(e=E[" "+e]).indexOf(":");return"//"===t.substring(0,2)?i?t:e.replace(C,"$1")+t:"/"===t.charAt(0)?i?t:e.replace(k,"$1")+t:e+t}function A(e){for(var t,i,n=1;n<arguments.length;n++)for(i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}function x(e,t){var i=e.replace(/\|/g,(function(e,t,i){for(var n=!1,r=t;--r>=0&&"\\"===i[r];)n=!n;return n?"|":" |"})).split(/ \|/),n=0;if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function D(e,t,i){var n=e.length;if(0===n)return"";for(var r=0;r<n;){var s=e.charAt(n-r-1);if(s!==t||i){if(s===t||!i)break;r++}else r++}return e.substr(0,n-r)}function L(e,t){if(-1===e.indexOf(t[1]))return-1;for(var i=e.length,n=0,r=0;r<i;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&--n<0)return r;return-1}function R(e){e&&e.sanitize&&!e.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 I(e,t){if(t<1)return"";for(var i="";t>1;)1&t&&(i+=e),t>>=1,e+=e;return i+e}var P={escape:p,unescape:g,edit:v,cleanUrl:S,resolveUrl:T,noopTest:{exec:function(){}},merge:A,splitCells:x,rtrim:D,findClosingBracket:L,checkSanitizeDeprecation:R,repeatString:I},O=s.exports.defaults,M=P.rtrim,F=P.splitCells,B=P.escape,N=P.findClosingBracket;function U(e,t,i){var n=t.href,r=t.title?B(t.title):null,s=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:i,href:n,title:r,text:s}:{type:"image",raw:i,href:n,title:r,text:B(s)}}function H(e,t){var i=e.match(/^(\s+)(?:```)/);if(null===i)return t;var n=i[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=n.length?e.slice(n.length):e})).join("\n")}var j=function(){function e(e){this.options=e||O}var t=e.prototype;return t.space=function(e){var t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e){var t=this.rules.block.code.exec(e);if(t){var i=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:M(i,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var i=t[0],n=H(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim():t[2],text:n}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t){var i=t[2].trim();if(/#$/.test(i)){var n=M(i,"#");this.options.pedantic?i=n.trim():n&&!/ $/.test(n)||(i=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i}}},t.nptable=function(e){var t=this.rules.block.nptable.exec(e);if(t){var i={type:"table",header:F(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[],raw:t[0]};if(i.header.length===i.align.length){var n,r=i.align.length;for(n=0;n<r;n++)/^ *-+: *$/.test(i.align[n])?i.align[n]="right":/^ *:-+: *$/.test(i.align[n])?i.align[n]="center":/^ *:-+ *$/.test(i.align[n])?i.align[n]="left":i.align[n]=null;for(r=i.cells.length,n=0;n<r;n++)i.cells[n]=F(i.cells[n],i.header.length);return i}}},t.hr=function(e){var t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}},t.blockquote=function(e){var t=this.rules.block.blockquote.exec(e);if(t){var i=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],text:i}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){var i,n,r,s,o,a,l,c,u,h=t[0],d=t[2],f=d.length>1,p={type:"list",raw:h,ordered:f,start:f?+d.slice(0,-1):"",loose:!1,items:[]},_=t[0].match(this.rules.block.item),g=!1,m=_.length;r=this.rules.block.listItemStart.exec(_[0]);for(var v=0;v<m;v++){if(h=i=_[v],this.options.pedantic||(u=i.match(new RegExp("\\n\\s*\\n {0,"+(r[0].length-1)+"}\\S")))&&(o=i.length-u.index+_.slice(v+1).join("\n").length,p.raw=p.raw.substring(0,p.raw.length-o),h=i=i.substring(0,u.index),m=v+1),v!==m-1){if(s=this.rules.block.listItemStart.exec(_[v+1]),this.options.pedantic?s[1].length>r[1].length:s[1].length>=r[0].length||s[1].length>3){_.splice(v,2,_[v]+(!this.options.pedantic&&s[1].length<r[0].length&&!_[v].match(/\n$/)?"":"\n")+_[v+1]),v--,m--;continue}(!this.options.pedantic||this.options.smartLists?s[2][s[2].length-1]!==d[d.length-1]:f===(1===s[2].length))&&(o=_.slice(v+1).join("\n").length,p.raw=p.raw.substring(0,p.raw.length-o),v=m-1),r=s}n=i.length,~(i=i.replace(/^ *([*+-]|\d+[.)]) ?/,"")).indexOf("\n ")&&(n-=i.length,i=this.options.pedantic?i.replace(/^ {1,4}/gm,""):i.replace(new RegExp("^ {1,"+n+"}","gm"),"")),i=M(i,"\n"),v!==m-1&&(h+="\n"),a=g||/\n\n(?!\s*$)/.test(h),v!==m-1&&(g="\n\n"===h.slice(-2),a||(a=g)),a&&(p.loose=!0),this.options.gfm&&(c=void 0,(l=/^\[[ xX]\] /.test(i))&&(c=" "!==i[1],i=i.replace(/^\[[ xX]\] +/,""))),p.items.push({type:"list_item",raw:h,task:l,checked:c,loose:a,text:i})}return p}},t.html=function(e){var t=this.rules.block.html.exec(e);if(t)return{type:this.options.sanitize?"paragraph":"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):B(t[0]):t[0]}},t.def=function(e){var t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{type:"def",tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}},t.table=function(e){var t=this.rules.block.table.exec(e);if(t){var i={type:"table",header:F(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(i.header.length===i.align.length){i.raw=t[0];var n,r=i.align.length;for(n=0;n<r;n++)/^ *-+: *$/.test(i.align[n])?i.align[n]="right":/^ *:-+: *$/.test(i.align[n])?i.align[n]="center":/^ *:-+ *$/.test(i.align[n])?i.align[n]="left":i.align[n]=null;for(r=i.cells.length,n=0;n<r;n++)i.cells[n]=F(i.cells[n].replace(/^ *\| *| *\| *$/g,""),i.header.length);return i}}},t.lheading=function(e){var t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1]}},t.paragraph=function(e){var t=this.rules.block.paragraph.exec(e);if(t)return{type:"paragraph",raw:t[0],text:"\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1]}},t.text=function(e){var t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0]}},t.escape=function(e){var t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:B(t[1])}},t.tag=function(e,t,i){var n=this.rules.inline.tag.exec(e);if(n)return!t&&/^<a /i.test(n[0])?t=!0:t&&/^<\/a>/i.test(n[0])&&(t=!1),!i&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?i=!0:i&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(i=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:t,inRawBlock:i,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):B(n[0]):n[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var i=t[2].trim();if(!this.options.pedantic&&/^</.test(i)){if(!/>$/.test(i))return;var n=M(i.slice(0,-1),"\\");if((i.length-n.length)%2==0)return}else{var r=N(t[2],"()");if(r>-1){var s=(0===t[0].indexOf("!")?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,s).trim(),t[3]=""}}var o=t[2],a="";if(this.options.pedantic){var l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);l&&(o=l[1],a=l[3])}else a=t[3]?t[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(o=this.options.pedantic&&!/>$/.test(i)?o.slice(1):o.slice(1,-1)),U(t,{href:o?o.replace(this.rules.inline._escapes,"$1"):o,title:a?a.replace(this.rules.inline._escapes,"$1"):a},t[0])}},t.reflink=function(e,t){var i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){var n=(i[2]||i[1]).replace(/\s+/g," ");if(!(n=t[n.toLowerCase()])||!n.href){var r=i[0].charAt(0);return{type:"text",raw:r,text:r}}return U(i,n,i[0])}},t.emStrong=function(e,t,i){void 0===i&&(i="");var n=this.rules.inline.emStrong.lDelim.exec(e);if(n&&(!n[3]||!i.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 r=n[1]||n[2]||"";if(!r||r&&(""===i||this.rules.inline.punctuation.exec(i))){var s,o,a=n[0].length-1,l=a,c=0,u="*"===n[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+a);null!=(n=u.exec(t));)if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6])if(o=s.length,n[3]||n[4])l+=o;else if(!((n[5]||n[6])&&a%3)||(a+o)%3){if(!((l-=o)>0))return o=Math.min(o,o+l+c),Math.min(a,o)%2?{type:"em",raw:e.slice(0,a+n.index+o+1),text:e.slice(1,a+n.index+o)}:{type:"strong",raw:e.slice(0,a+n.index+o+1),text:e.slice(2,a+n.index+o-1)}}else c+=o}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var i=t[2].replace(/\n/g," "),n=/[^ ]/.test(i),r=/^ /.test(i)&&/ $/.test(i);return n&&r&&(i=i.substring(1,i.length-1)),i=B(i,!0),{type:"codespan",raw:t[0],text:i}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2]}},t.autolink=function(e,t){var i,n,r=this.rules.inline.autolink.exec(e);if(r)return n="@"===r[2]?"mailto:"+(i=B(this.options.mangle?t(r[1]):r[1])):i=B(r[1]),{type:"link",raw:r[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}},t.url=function(e,t){var i;if(i=this.rules.inline.url.exec(e)){var n,r;if("@"===i[2])r="mailto:"+(n=B(this.options.mangle?t(i[0]):i[0]));else{var s;do{s=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0]}while(s!==i[0]);n=B(i[0]),r="www."===i[1]?"http://"+n:n}return{type:"link",raw:i[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}},t.inlineText=function(e,t,i){var n,r=this.rules.inline.text.exec(e);if(r)return n=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):B(r[0]):r[0]:B(this.options.smartypants?i(r[0]):r[0]),{type:"text",raw:r[0],text:n}},e}(),$=P.noopTest,G=P.edit,z=P.merge,K={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:$,table:$,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};K.def=G(K.def).replace("label",K._label).replace("title",K._title).getRegex(),K.bullet=/(?:[*+-]|\d{1,9}[.)])/,K.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,K.item=G(K.item,"gm").replace(/bull/g,K.bullet).getRegex(),K.listItemStart=G(/^( *)(bull) */).replace("bull",K.bullet).getRegex(),K.list=G(K.list).replace(/bull/g,K.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+K.def.source+")").getRegex(),K._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",K._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,K.html=G(K.html,"i").replace("comment",K._comment).replace("tag",K._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),K.paragraph=G(K._paragraph).replace("hr",K.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",K._tag).getRegex(),K.blockquote=G(K.blockquote).replace("paragraph",K.paragraph).getRegex(),K.normal=z({},K),K.gfm=z({},K.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*|$)"}),K.gfm.nptable=G(K.gfm.nptable).replace("hr",K.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",K._tag).getRegex(),K.gfm.table=G(K.gfm.table).replace("hr",K.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",K._tag).getRegex(),K.pedantic=z({},K.normal,{html:G("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",K._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:$,paragraph:G(K.normal._paragraph).replace("hr",K.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",K.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var W={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:$,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:$,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};W.punctuation=G(W.punctuation).replace(/punctuation/g,W._punctuation).getRegex(),W.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,W.escapedEmSt=/\\\*|\\_/g,W._comment=G(K._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),W.emStrong.lDelim=G(W.emStrong.lDelim).replace(/punct/g,W._punctuation).getRegex(),W.emStrong.rDelimAst=G(W.emStrong.rDelimAst,"g").replace(/punct/g,W._punctuation).getRegex(),W.emStrong.rDelimUnd=G(W.emStrong.rDelimUnd,"g").replace(/punct/g,W._punctuation).getRegex(),W._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,W._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,W._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])?)+(?![-_])/,W.autolink=G(W.autolink).replace("scheme",W._scheme).replace("email",W._email).getRegex(),W._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,W.tag=G(W.tag).replace("comment",W._comment).replace("attribute",W._attribute).getRegex(),W._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,W._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,W._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,W.link=G(W.link).replace("label",W._label).replace("href",W._href).replace("title",W._title).getRegex(),W.reflink=G(W.reflink).replace("label",W._label).getRegex(),W.reflinkSearch=G(W.reflinkSearch,"g").replace("reflink",W.reflink).replace("nolink",W.nolink).getRegex(),W.normal=z({},W),W.pedantic=z({},W.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:G(/^!?\[(label)\]\((.*?)\)/).replace("label",W._label).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",W._label).getRegex()}),W.gfm=z({},W.normal,{escape:G(W.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),W.gfm.url=G(W.gfm.url,"i").replace("email",W.gfm._extended_email).getRegex(),W.breaks=z({},W.gfm,{br:G(W.br).replace("{2,}","*").getRegex(),text:G(W.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var q={block:K,inline:W},V=j,Y=s.exports.defaults,Z=q.block,X=q.inline,Q=P.repeatString;function J(e){return e.replace(/---/g,"—").replace(/--/g,"").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1").replace(/'/g,"").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function ee(e){var t,i,n="",r=e.length;for(t=0;t<r;t++)i=e.charCodeAt(t),Math.random()>.5&&(i="x"+i.toString(16)),n+="&#"+i+";";return n}var te=function(){function e(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Y,this.options.tokenizer=this.options.tokenizer||new V,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:Z.normal,inline:X.normal};this.options.pedantic?(t.block=Z.pedantic,t.inline=X.pedantic):this.options.gfm&&(t.block=Z.gfm,this.options.breaks?t.inline=X.breaks:t.inline=X.gfm),this.tokenizer.rules=t}e.lex=function(t,i){return new e(i).lex(t)},e.lexInline=function(t,i){return new e(i).inlineTokens(t)};var i=e.prototype;return i.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},i.blockTokens=function(e,t,i){var n,r,s,o;for(void 0===t&&(t=[]),void 0===i&&(i=!0),this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),n.type&&t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),(o=t[t.length-1])&&"paragraph"===o.type?(o.raw+="\n"+n.raw,o.text+="\n"+n.text):t.push(n);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.nptable(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),n.tokens=this.blockTokens(n.text,[],i),t.push(n);else if(n=this.tokenizer.list(e)){for(e=e.substring(n.raw.length),s=n.items.length,r=0;r<s;r++)n.items[r].tokens=this.blockTokens(n.items[r].text,[],!1);t.push(n)}else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(i&&(n=this.tokenizer.def(e)))e=e.substring(n.raw.length),this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else if(i&&(n=this.tokenizer.paragraph(e)))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),(o=t[t.length-1])&&"text"===o.type?(o.raw+="\n"+n.raw,o.text+="\n"+n.text):t.push(n);else if(e){var a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}throw new Error(a)}return t},i.inline=function(e){var t,i,n,r,s,o,a=e.length;for(t=0;t<a;t++)switch((o=e[t]).type){case"paragraph":case"text":case"heading":o.tokens=[],this.inlineTokens(o.text,o.tokens);break;case"table":for(o.tokens={header:[],cells:[]},r=o.header.length,i=0;i<r;i++)o.tokens.header[i]=[],this.inlineTokens(o.header[i],o.tokens.header[i]);for(r=o.cells.length,i=0;i<r;i++)for(s=o.cells[i],o.tokens.cells[i]=[],n=0;n<s.length;n++)o.tokens.cells[i][n]=[],this.inlineTokens(s[n],o.tokens.cells[i][n]);break;case"blockquote":this.inline(o.tokens);break;case"list":for(r=o.items.length,i=0;i<r;i++)this.inline(o.items[i].tokens)}return e},i.inlineTokens=function(e,t,i,n){var r,s;void 0===t&&(t=[]),void 0===i&&(i=!1),void 0===n&&(n=!1);var o,a,l,c=e;if(this.tokens.links){var u=Object.keys(this.tokens.links);if(u.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(c));)u.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,o.index)+"["+Q("a",o[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(c));)c=c.slice(0,o.index)+"["+Q("a",o[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(o=this.tokenizer.rules.inline.escapedEmSt.exec(c));)c=c.slice(0,o.index)+"++"+c.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(a||(l=""),a=!1,r=this.tokenizer.escape(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.tag(e,i,n)){e=e.substring(r.raw.length),i=r.inLink,n=r.inRawBlock;var h=t[t.length-1];h&&"text"===r.type&&"text"===h.type?(h.raw+=r.raw,h.text+=r.text):t.push(r)}else if(r=this.tokenizer.link(e))e=e.substring(r.raw.length),"link"===r.type&&(r.tokens=this.inlineTokens(r.text,[],!0,n)),t.push(r);else if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);var d=t[t.length-1];"link"===r.type?(r.tokens=this.inlineTokens(r.text,[],!0,n),t.push(r)):d&&"text"===r.type&&"text"===d.type?(d.raw+=r.raw,d.text+=r.text):t.push(r)}else if(r=this.tokenizer.emStrong(e,c,l))e=e.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],i,n),t.push(r);else if(r=this.tokenizer.codespan(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.br(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.del(e))e=e.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],i,n),t.push(r);else if(r=this.tokenizer.autolink(e,ee))e=e.substring(r.raw.length),t.push(r);else if(i||!(r=this.tokenizer.url(e,ee))){if(r=this.tokenizer.inlineText(e,n,J))e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(l=r.raw.slice(-1)),a=!0,(s=t[t.length-1])&&"text"===s.type?(s.raw+=r.raw,s.text+=r.text):t.push(r);else if(e){var f="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(f);break}throw new Error(f)}}else e=e.substring(r.raw.length),t.push(r);return t},t(e,null,[{key:"rules",get:function(){return{block:Z,inline:X}}}]),e}(),ie=s.exports.defaults,ne=P.cleanUrl,re=P.escape,se=function(){function e(e){this.options=e||ie}var t=e.prototype;return t.code=function(e,t,i){var n=(t||"").match(/\S*/)[0];if(this.options.highlight){var r=this.options.highlight(e,n);null!=r&&r!==e&&(i=!0,e=r)}return e=e.replace(/\n$/,"")+"\n",n?'<pre><code class="'+this.options.langPrefix+re(n,!0)+'">'+(i?e:re(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:re(e,!0))+"</code></pre>\n"},t.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},t.html=function(e){return e},t.heading=function(e,t,i,n){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+n.slug(i)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},t.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},t.list=function(e,t,i){var n=t?"ol":"ul";return"<"+n+(t&&1!==i?' start="'+i+'"':"")+">\n"+e+"</"+n+">\n"},t.listitem=function(e){return"<li>"+e+"</li>\n"},t.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},t.paragraph=function(e){return"<p>"+e+"</p>\n"},t.table=function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"},t.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},t.tablecell=function(e,t){var i=t.header?"th":"td";return(t.align?"<"+i+' align="'+t.align+'">':"<"+i+">")+e+"</"+i+">\n"},t.strong=function(e){return"<strong>"+e+"</strong>"},t.em=function(e){return"<em>"+e+"</em>"},t.codespan=function(e){return"<code>"+e+"</code>"},t.br=function(){return this.options.xhtml?"<br/>":"<br>"},t.del=function(e){return"<del>"+e+"</del>"},t.link=function(e,t,i){if(null===(e=ne(this.options.sanitize,this.options.baseUrl,e)))return i;var n='<a href="'+re(e)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+i+"</a>"},t.image=function(e,t,i){if(null===(e=ne(this.options.sanitize,this.options.baseUrl,e)))return i;var n='<img src="'+e+'" alt="'+i+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">"},t.text=function(e){return e},e}(),oe=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,i){return""+i},t.image=function(e,t,i){return""+i},t.br=function(){return""},e}(),ae=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var i=e,n=0;if(this.seen.hasOwnProperty(i)){n=this.seen[e];do{i=e+"-"+ ++n}while(this.seen.hasOwnProperty(i))}return t||(this.seen[e]=n,this.seen[i]=0),i},t.slug=function(e,t){void 0===t&&(t={});var i=this.serialize(e);return this.getNextSafeSlug(i,t.dryrun)},e}(),le=se,ce=oe,ue=ae,he=s.exports.defaults,de=P.unescape,fe=te,pe=function(){function e(e){this.options=e||he,this.options.renderer=this.options.renderer||new le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ce,this.slugger=new ue}e.parse=function(t,i){return new e(i).parse(t)},e.parseInline=function(t,i){return new e(i).parseInline(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var i,n,r,s,o,a,l,c,u,h,d,f,p,_,g,m,v,y,b="",S=e.length;for(i=0;i<S;i++)switch((h=e[i]).type){case"space":continue;case"hr":b+=this.renderer.hr();continue;case"heading":b+=this.renderer.heading(this.parseInline(h.tokens),h.depth,de(this.parseInline(h.tokens,this.textRenderer)),this.slugger);continue;case"code":b+=this.renderer.code(h.text,h.lang,h.escaped);continue;case"table":for(c="",l="",s=h.header.length,n=0;n<s;n++)l+=this.renderer.tablecell(this.parseInline(h.tokens.header[n]),{header:!0,align:h.align[n]});for(c+=this.renderer.tablerow(l),u="",s=h.cells.length,n=0;n<s;n++){for(l="",o=(a=h.tokens.cells[n]).length,r=0;r<o;r++)l+=this.renderer.tablecell(this.parseInline(a[r]),{header:!1,align:h.align[r]});u+=this.renderer.tablerow(l)}b+=this.renderer.table(c,u);continue;case"blockquote":u=this.parse(h.tokens),b+=this.renderer.blockquote(u);continue;case"list":for(d=h.ordered,f=h.start,p=h.loose,s=h.items.length,u="",n=0;n<s;n++)m=(g=h.items[n]).checked,v=g.task,_="",g.task&&(y=this.renderer.checkbox(m),p?g.tokens.length>0&&"text"===g.tokens[0].type?(g.tokens[0].text=y+" "+g.tokens[0].text,g.tokens[0].tokens&&g.tokens[0].tokens.length>0&&"text"===g.tokens[0].tokens[0].type&&(g.tokens[0].tokens[0].text=y+" "+g.tokens[0].tokens[0].text)):g.tokens.unshift({type:"text",text:y}):_+=y),_+=this.parse(g.tokens,p),u+=this.renderer.listitem(_,v,m);b+=this.renderer.list(u,d,f);continue;case"html":b+=this.renderer.html(h.text);continue;case"paragraph":b+=this.renderer.paragraph(this.parseInline(h.tokens));continue;case"text":for(u=h.tokens?this.parseInline(h.tokens):h.text;i+1<S&&"text"===e[i+1].type;)u+="\n"+((h=e[++i]).tokens?this.parseInline(h.tokens):h.text);b+=t?this.renderer.paragraph(u):u;continue;default:var E='Token with "'+h.type+'" type was not found.';if(this.options.silent)return void console.error(E);throw new Error(E)}return b},t.parseInline=function(e,t){t=t||this.renderer;var i,n,r="",s=e.length;for(i=0;i<s;i++)switch((n=e[i]).type){case"escape":case"text":r+=t.text(n.text);break;case"html":r+=t.html(n.text);break;case"link":r+=t.link(n.href,n.title,this.parseInline(n.tokens,t));break;case"image":r+=t.image(n.href,n.title,n.text);break;case"strong":r+=t.strong(this.parseInline(n.tokens,t));break;case"em":r+=t.em(this.parseInline(n.tokens,t));break;case"codespan":r+=t.codespan(n.text);break;case"br":r+=t.br();break;case"del":r+=t.del(this.parseInline(n.tokens,t));break;default:var o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return void console.error(o);throw new Error(o)}return r},e}(),_e=j,ge=se,me=oe,ve=ae,ye=P.merge,be=P.checkSanitizeDeprecation,Se=P.escape,Ee=s.exports.getDefaults,we=s.exports.changeDefaults,Ce=s.exports.defaults;function ke(e,t,i){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof t&&(i=t,t=null),t=ye({},ke.defaults,t||{}),be(t),i){var n,r=t.highlight;try{n=fe.lex(e,t)}catch(e){return i(e)}var s=function(e){var s;if(!e)try{t.walkTokens&&ke.walkTokens(n,t.walkTokens),s=pe.parse(n,t)}catch(t){e=t}return t.highlight=r,e?i(e):i(null,s)};if(!r||r.length<3)return s();if(delete t.highlight,!n.length)return s();var o=0;return ke.walkTokens(n,(function(e){"code"===e.type&&(o++,setTimeout((function(){r(e.text,e.lang,(function(t,i){if(t)return s(t);null!=i&&i!==e.text&&(e.text=i,e.escaped=!0),0==--o&&s()}))}),0))})),void(0===o&&s())}try{var a=fe.lex(e,t);return t.walkTokens&&ke.walkTokens(a,t.walkTokens),pe.parse(a,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+Se(e.message+"",!0)+"</pre>";throw e}}return ke.options=ke.setOptions=function(e){return ye(ke.defaults,e),we(ke.defaults),ke},ke.getDefaults=Ee,ke.defaults=Ce,ke.use=function(e){var t=ye({},e);if(e.renderer&&function(){var i=ke.defaults.renderer||new ge,n=function(t){var n=i[t];i[t]=function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var a=e.renderer[t].apply(i,s);return!1===a&&(a=n.apply(i,s)),a}};for(var r in e.renderer)n(r);t.renderer=i}(),e.tokenizer&&function(){var i=ke.defaults.tokenizer||new _e,n=function(t){var n=i[t];i[t]=function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var a=e.tokenizer[t].apply(i,s);return!1===a&&(a=n.apply(i,s)),a}};for(var r in e.tokenizer)n(r);t.tokenizer=i}(),e.walkTokens){var i=ke.defaults.walkTokens;t.walkTokens=function(t){e.walkTokens(t),i&&i(t)}}ke.setOptions(t)},ke.walkTokens=function(e,t){for(var i,n=r(e);!(i=n()).done;){var s=i.value;switch(t(s),s.type){case"table":for(var o,a=r(s.tokens.header);!(o=a()).done;){var l=o.value;ke.walkTokens(l,t)}for(var c,u=r(s.tokens.cells);!(c=u()).done;)for(var h,d=r(c.value);!(h=d()).done;){var f=h.value;ke.walkTokens(f,t)}break;case"list":ke.walkTokens(s.items,t);break;default:s.tokens&&ke.walkTokens(s.tokens,t)}}},ke.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");t=ye({},ke.defaults,t||{}),be(t);try{var i=fe.lexInline(e,t);return t.walkTokens&&ke.walkTokens(i,t.walkTokens),pe.parseInline(i,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+Se(e.message+"",!0)+"</pre>";throw e}},ke.Parser=pe,ke.parser=pe.parse,ke.Renderer=ge,ke.TextRenderer=me,ke.Lexer=fe,ke.lexer=fe.lex,ke.Tokenizer=_e,ke.Slugger=ve,ke.parse=ke,ke}()},11690:function(e){const t=/[&<>"']/,i=/[&<>"']/g,n=/[<>"']|&(?!#?\w+;)/,r=/[<>"']|&(?!#?\w+;)/g,s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},o=e=>s[e];const a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function l(e){return e.replace(a,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const c=/(^|[^\[])\^/g;const u=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;const d={},f=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,_=/^([^:]+:\/*[^/]*)[\s\S]*$/;function g(e,t){d[" "+e]||(f.test(e)?d[" "+e]=e+"/":d[" "+e]=m(e,"/",!0));const i=-1===(e=d[" "+e]).indexOf(":");return"//"===t.substring(0,2)?i?t:e.replace(p,"$1")+t:"/"===t.charAt(0)?i?t:e.replace(_,"$1")+t:e+t}function m(e,t,i){const n=e.length;if(0===n)return"";let r=0;for(;r<n;){const s=e.charAt(n-r-1);if(s!==t||i){if(s===t||!i)break;r++}else r++}return e.substr(0,n-r)}e.exports={escape:function(e,s){if(s){if(t.test(e))return e.replace(i,o)}else if(n.test(e))return e.replace(r,o);return e},unescape:l,edit:function(e,t){e=e.source||e,t=t||"";const i={replace:(t,n)=>(n=(n=n.source||n).replace(c,"$1"),e=e.replace(t,n),i),getRegex:()=>new RegExp(e,t)};return i},cleanUrl:function(e,t,i){if(e){let e;try{e=decodeURIComponent(l(i)).replace(u,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!h.test(i)&&(i=g(t,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(e){return null}return i},resolveUrl:g,noopTest:{exec:function(){}},merge:function(e){let t,i,n=1;for(;n<arguments.length;n++)for(i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},splitCells:function(e,t){const i=e.replace(/\|/g,((e,t,i)=>{let n=!1,r=t;for(;--r>=0&&"\\"===i[r];)n=!n;return n?"|":" |"})).split(/ \|/);let n=0;if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i},rtrim:m,findClosingBracket:function(e,t){if(-1===e.indexOf(t[1]))return-1;const i=e.length;let n=0,r=0;for(;r<i;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return-1},checkSanitizeDeprecation:function(e){e&&e.sanitize&&!e.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")},repeatString:function(e,t){if(t<1)return"";let i="";for(;t>1;)1&t&&(i+=e),t>>=1,e+=e;return i+e}}},75918:function(e,t,i){"use strict";i.d(t,{Wi:function(){return l},Z0:function(){return c},aU:function(){return a},eZ:function(){return h},wY:function(){return u}});var n=i(4348),r=i(69323),s=i(13268),o=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))};class a extends r.JT{constructor(e,t="",i="",r=!0,s){super(),this._onDidChange=this._register(new n.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=e,this._label=t,this._cssClass=i,this._enabled=r,this._actionCallback=s}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}run(e,t){return o(this,void 0,void 0,(function*(){this._actionCallback&&(yield this._actionCallback(e))}))}}class l extends r.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new n.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new n.Q5),this.onDidRun=this._onDidRun.event}run(e,t){return o(this,void 0,void 0,(function*(){if(!e.enabled)return;let i;this._onBeforeRun.fire({action:e});try{yield this.runAction(e,t)}catch(e){i=e}this._onDidRun.fire({action:e,error:i})}))}runAction(e,t){return o(this,void 0,void 0,(function*(){yield e.run(t)}))}}class c extends a{constructor(e){super(c.ID,e,e?"separator text":"separator"),this.checked=!1,this.enabled=!1}}c.ID="vs.actions.separator";class u{constructor(e,t,i,n){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=e,this.label=t,this.class=n,this._actions=i}get actions(){return this._actions}dispose(){}run(){return o(this,void 0,void 0,(function*(){}))}}class h extends a{constructor(){super(h.ID,s.N("submenu.empty","(empty)"),void 0,!1)}}h.ID="vs.actions.empty"},76068:function(e,t,i){"use strict";function n(e,t){if(!e)throw new Error(t?`Assertion failed (${t})`:"Assertion Failed")}i.d(t,{ok:function(){return n}})},52615:function(e,t,i){"use strict";i.d(t,{CM:function(){return o},JL:function(){return a},dT:function(){return c},fK:function(){return s},lA:function(){return l}});var n=i(4348);const r=new class{constructor(){this._icons=new Map,this._onDidRegister=new n.Q5}add(e){const t=this._icons.get(e.id);t?e.description?t.description=e.description:console.error(`Duplicate registration of codicon ${e.id}`):(this._icons.set(e.id,e),this._onDidRegister.fire(e))}get(e){return this._icons.get(e)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}},s=r;function o(e,t){return new l(e,t)}function a(e){return e?e.replace(/\$\((.*?)\)/g,((e,t)=>` ${t} `)).trim():""}class l{constructor(e,t,i){this.id=e,this.definition=t,this.description=i,r.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var c;!function(e){e.iconNameSegment="[A-Za-z0-9]+",e.iconNameExpression="[A-Za-z0-9\\-]+",e.iconModifierExpression="~[A-Za-z]+";const t=new RegExp(`^(${e.iconNameExpression})(${e.iconModifierExpression})?$`);function i(e){if(e instanceof l)return["codicon","codicon-"+e.id];const n=t.exec(e.id);if(!n)return i(l.error);let[,r,s]=n;const o=["codicon","codicon-"+r];return s&&o.push("codicon-modifier-"+s.substr(1)),o}e.asClassNameArray=i,e.asClassName=function(e){return i(e).join(" ")},e.asCSSSelector=function(e){return"."+i(e).join(".")}}(c||(c={})),function(e){e.add=new e("add",{fontCharacter:"\\ea60"}),e.plus=new e("plus",e.add.definition),e.gistNew=new e("gist-new",e.add.definition),e.repoCreate=new e("repo-create",e.add.definition),e.lightbulb=new e("lightbulb",{fontCharacter:"\\ea61"}),e.lightBulb=new e("light-bulb",{fontCharacter:"\\ea61"}),e.repo=new e("repo",{fontCharacter:"\\ea62"}),e.repoDelete=new e("repo-delete",{fontCharacter:"\\ea62"}),e.gistFork=new e("gist-fork",{fontCharacter:"\\ea63"}),e.repoForked=new e("repo-forked",{fontCharacter:"\\ea63"}),e.gitPullRequest=new e("git-pull-request",{fontCharacter:"\\ea64"}),e.gitPullRequestAbandoned=new e("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),e.recordKeys=new e("record-keys",{fontCharacter:"\\ea65"}),e.keyboard=new e("keyboard",{fontCharacter:"\\ea65"}),e.tag=new e("tag",{fontCharacter:"\\ea66"}),e.tagAdd=new e("tag-add",{fontCharacter:"\\ea66"}),e.tagRemove=new e("tag-remove",{fontCharacter:"\\ea66"}),e.person=new e("person",{fontCharacter:"\\ea67"}),e.personFollow=new e("person-follow",{fontCharacter:"\\ea67"}),e.personOutline=new e("person-outline",{fontCharacter:"\\ea67"}),e.personFilled=new e("person-filled",{fontCharacter:"\\ea67"}),e.gitBranch=new e("git-branch",{fontCharacter:"\\ea68"}),e.gitBranchCreate=new e("git-branch-create",{fontCharacter:"\\ea68"}),e.gitBranchDelete=new e("git-branch-delete",{fontCharacter:"\\ea68"}),e.sourceControl=new e("source-control",{fontCharacter:"\\ea68"}),e.mirror=new e("mirror",{fontCharacter:"\\ea69"}),e.mirrorPublic=new e("mirror-public",{fontCharacter:"\\ea69"}),e.star=new e("star",{fontCharacter:"\\ea6a"}),e.starAdd=new e("star-add",{fontCharacter:"\\ea6a"}),e.starDelete=new e("star-delete",{fontCharacter:"\\ea6a"}),e.starEmpty=new e("star-empty",{fontCharacter:"\\ea6a"}),e.comment=new e("comment",{fontCharacter:"\\ea6b"}),e.commentAdd=new e("comment-add",{fontCharacter:"\\ea6b"}),e.alert=new e("alert",{fontCharacter:"\\ea6c"}),e.warning=new e("warning",{fontCharacter:"\\ea6c"}),e.search=new e("search",{fontCharacter:"\\ea6d"}),e.searchSave=new e("search-save",{fontCharacter:"\\ea6d"}),e.logOut=new e("log-out",{fontCharacter:"\\ea6e"}),e.signOut=new e("sign-out",{fontCharacter:"\\ea6e"}),e.logIn=new e("log-in",{fontCharacter:"\\ea6f"}),e.signIn=new e("sign-in",{fontCharacter:"\\ea6f"}),e.eye=new e("eye",{fontCharacter:"\\ea70"}),e.eyeUnwatch=new e("eye-unwatch",{fontCharacter:"\\ea70"}),e.eyeWatch=new e("eye-watch",{fontCharacter:"\\ea70"}),e.circleFilled=new e("circle-filled",{fontCharacter:"\\ea71"}),e.primitiveDot=new e("primitive-dot",{fontCharacter:"\\ea71"}),e.closeDirty=new e("close-dirty",{fontCharacter:"\\ea71"}),e.debugBreakpoint=new e("debug-breakpoint",{fontCharacter:"\\ea71"}),e.debugBreakpointDisabled=new e("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),e.debugHint=new e("debug-hint",{fontCharacter:"\\ea71"}),e.primitiveSquare=new e("primitive-square",{fontCharacter:"\\ea72"}),e.edit=new e("edit",{fontCharacter:"\\ea73"}),e.pencil=new e("pencil",{fontCharacter:"\\ea73"}),e.info=new e("info",{fontCharacter:"\\ea74"}),e.issueOpened=new e("issue-opened",{fontCharacter:"\\ea74"}),e.gistPrivate=new e("gist-private",{fontCharacter:"\\ea75"}),e.gitForkPrivate=new e("git-fork-private",{fontCharacter:"\\ea75"}),e.lock=new e("lock",{fontCharacter:"\\ea75"}),e.mirrorPrivate=new e("mirror-private",{fontCharacter:"\\ea75"}),e.close=new e("close",{fontCharacter:"\\ea76"}),e.removeClose=new e("remove-close",{fontCharacter:"\\ea76"}),e.x=new e("x",{fontCharacter:"\\ea76"}),e.repoSync=new e("repo-sync",{fontCharacter:"\\ea77"}),e.sync=new e("sync",{fontCharacter:"\\ea77"}),e.clone=new e("clone",{fontCharacter:"\\ea78"}),e.desktopDownload=new e("desktop-download",{fontCharacter:"\\ea78"}),e.beaker=new e("beaker",{fontCharacter:"\\ea79"}),e.microscope=new e("microscope",{fontCharacter:"\\ea79"}),e.vm=new e("vm",{fontCharacter:"\\ea7a"}),e.deviceDesktop=new e("device-desktop",{fontCharacter:"\\ea7a"}),e.file=new e("file",{fontCharacter:"\\ea7b"}),e.fileText=new e("file-text",{fontCharacter:"\\ea7b"}),e.more=new e("more",{fontCharacter:"\\ea7c"}),e.ellipsis=new e("ellipsis",{fontCharacter:"\\ea7c"}),e.kebabHorizontal=new e("kebab-horizontal",{fontCharacter:"\\ea7c"}),e.mailReply=new e("mail-reply",{fontCharacter:"\\ea7d"}),e.reply=new e("reply",{fontCharacter:"\\ea7d"}),e.organization=new e("organization",{fontCharacter:"\\ea7e"}),e.organizationFilled=new e("organization-filled",{fontCharacter:"\\ea7e"}),e.organizationOutline=new e("organization-outline",{fontCharacter:"\\ea7e"}),e.newFile=new e("new-file",{fontCharacter:"\\ea7f"}),e.fileAdd=new e("file-add",{fontCharacter:"\\ea7f"}),e.newFolder=new e("new-folder",{fontCharacter:"\\ea80"}),e.fileDirectoryCreate=new e("file-directory-create",{fontCharacter:"\\ea80"}),e.trash=new e("trash",{fontCharacter:"\\ea81"}),e.trashcan=new e("trashcan",{fontCharacter:"\\ea81"}),e.history=new e("history",{fontCharacter:"\\ea82"}),e.clock=new e("clock",{fontCharacter:"\\ea82"}),e.folder=new e("folder",{fontCharacter:"\\ea83"}),e.fileDirectory=new e("file-directory",{fontCharacter:"\\ea83"}),e.symbolFolder=new e("symbol-folder",{fontCharacter:"\\ea83"}),e.logoGithub=new e("logo-github",{fontCharacter:"\\ea84"}),e.markGithub=new e("mark-github",{fontCharacter:"\\ea84"}),e.github=new e("github",{fontCharacter:"\\ea84"}),e.terminal=new e("terminal",{fontCharacter:"\\ea85"}),e.console=new e("console",{fontCharacter:"\\ea85"}),e.repl=new e("repl",{fontCharacter:"\\ea85"}),e.zap=new e("zap",{fontCharacter:"\\ea86"}),e.symbolEvent=new e("symbol-event",{fontCharacter:"\\ea86"}),e.error=new e("error",{fontCharacter:"\\ea87"}),e.stop=new e("stop",{fontCharacter:"\\ea87"}),e.variable=new e("variable",{fontCharacter:"\\ea88"}),e.symbolVariable=new e("symbol-variable",{fontCharacter:"\\ea88"}),e.array=new e("array",{fontCharacter:"\\ea8a"}),e.symbolArray=new e("symbol-array",{fontCharacter:"\\ea8a"}),e.symbolModule=new e("symbol-module",{fontCharacter:"\\ea8b"}),e.symbolPackage=new e("symbol-package",{fontCharacter:"\\ea8b"}),e.symbolNamespace=new e("symbol-namespace",{fontCharacter:"\\ea8b"}),e.symbolObject=new e("symbol-object",{fontCharacter:"\\ea8b"}),e.symbolMethod=new e("symbol-method",{fontCharacter:"\\ea8c"}),e.symbolFunction=new e("symbol-function",{fontCharacter:"\\ea8c"}),e.symbolConstructor=new e("symbol-constructor",{fontCharacter:"\\ea8c"}),e.symbolBoolean=new e("symbol-boolean",{fontCharacter:"\\ea8f"}),e.symbolNull=new e("symbol-null",{fontCharacter:"\\ea8f"}),e.symbolNumeric=new e("symbol-numeric",{fontCharacter:"\\ea90"}),e.symbolNumber=new e("symbol-number",{fontCharacter:"\\ea90"}),e.symbolStructure=new e("symbol-structure",{fontCharacter:"\\ea91"}),e.symbolStruct=new e("symbol-struct",{fontCharacter:"\\ea91"}),e.symbolParameter=new e("symbol-parameter",{fontCharacter:"\\ea92"}),e.symbolTypeParameter=new e("symbol-type-parameter",{fontCharacter:"\\ea92"}),e.symbolKey=new e("symbol-key",{fontCharacter:"\\ea93"}),e.symbolText=new e("symbol-text",{fontCharacter:"\\ea93"}),e.symbolReference=new e("symbol-reference",{fontCharacter:"\\ea94"}),e.goToFile=new e("go-to-file",{fontCharacter:"\\ea94"}),e.symbolEnum=new e("symbol-enum",{fontCharacter:"\\ea95"}),e.symbolValue=new e("symbol-value",{fontCharacter:"\\ea95"}),e.symbolRuler=new e("symbol-ruler",{fontCharacter:"\\ea96"}),e.symbolUnit=new e("symbol-unit",{fontCharacter:"\\ea96"}),e.activateBreakpoints=new e("activate-breakpoints",{fontCharacter:"\\ea97"}),e.archive=new e("archive",{fontCharacter:"\\ea98"}),e.arrowBoth=new e("arrow-both",{fontCharacter:"\\ea99"}),e.arrowDown=new e("arrow-down",{fontCharacter:"\\ea9a"}),e.arrowLeft=new e("arrow-left",{fontCharacter:"\\ea9b"}),e.arrowRight=new e("arrow-right",{fontCharacter:"\\ea9c"}),e.arrowSmallDown=new e("arrow-small-down",{fontCharacter:"\\ea9d"}),e.arrowSmallLeft=new e("arrow-small-left",{fontCharacter:"\\ea9e"}),e.arrowSmallRight=new e("arrow-small-right",{fontCharacter:"\\ea9f"}),e.arrowSmallUp=new e("arrow-small-up",{fontCharacter:"\\eaa0"}),e.arrowUp=new e("arrow-up",{fontCharacter:"\\eaa1"}),e.bell=new e("bell",{fontCharacter:"\\eaa2"}),e.bold=new e("bold",{fontCharacter:"\\eaa3"}),e.book=new e("book",{fontCharacter:"\\eaa4"}),e.bookmark=new e("bookmark",{fontCharacter:"\\eaa5"}),e.debugBreakpointConditionalUnverified=new e("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),e.debugBreakpointConditional=new e("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),e.debugBreakpointConditionalDisabled=new e("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),e.debugBreakpointDataUnverified=new e("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),e.debugBreakpointData=new e("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),e.debugBreakpointDataDisabled=new e("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),e.debugBreakpointLogUnverified=new e("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),e.debugBreakpointLog=new e("debug-breakpoint-log",{fontCharacter:"\\eaab"}),e.debugBreakpointLogDisabled=new e("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),e.briefcase=new e("briefcase",{fontCharacter:"\\eaac"}),e.broadcast=new e("broadcast",{fontCharacter:"\\eaad"}),e.browser=new e("browser",{fontCharacter:"\\eaae"}),e.bug=new e("bug",{fontCharacter:"\\eaaf"}),e.calendar=new e("calendar",{fontCharacter:"\\eab0"}),e.caseSensitive=new e("case-sensitive",{fontCharacter:"\\eab1"}),e.check=new e("check",{fontCharacter:"\\eab2"}),e.checklist=new e("checklist",{fontCharacter:"\\eab3"}),e.chevronDown=new e("chevron-down",{fontCharacter:"\\eab4"}),e.dropDownButton=new e("drop-down-button",e.chevronDown.definition),e.chevronLeft=new e("chevron-left",{fontCharacter:"\\eab5"}),e.chevronRight=new e("chevron-right",{fontCharacter:"\\eab6"}),e.chevronUp=new e("chevron-up",{fontCharacter:"\\eab7"}),e.chromeClose=new e("chrome-close",{fontCharacter:"\\eab8"}),e.chromeMaximize=new e("chrome-maximize",{fontCharacter:"\\eab9"}),e.chromeMinimize=new e("chrome-minimize",{fontCharacter:"\\eaba"}),e.chromeRestore=new e("chrome-restore",{fontCharacter:"\\eabb"}),e.circleOutline=new e("circle-outline",{fontCharacter:"\\eabc"}),e.debugBreakpointUnverified=new e("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),e.circleSlash=new e("circle-slash",{fontCharacter:"\\eabd"}),e.circuitBoard=new e("circuit-board",{fontCharacter:"\\eabe"}),e.clearAll=new e("clear-all",{fontCharacter:"\\eabf"}),e.clippy=new e("clippy",{fontCharacter:"\\eac0"}),e.closeAll=new e("close-all",{fontCharacter:"\\eac1"}),e.cloudDownload=new e("cloud-download",{fontCharacter:"\\eac2"}),e.cloudUpload=new e("cloud-upload",{fontCharacter:"\\eac3"}),e.code=new e("code",{fontCharacter:"\\eac4"}),e.collapseAll=new e("collapse-all",{fontCharacter:"\\eac5"}),e.colorMode=new e("color-mode",{fontCharacter:"\\eac6"}),e.commentDiscussion=new e("comment-discussion",{fontCharacter:"\\eac7"}),e.compareChanges=new e("compare-changes",{fontCharacter:"\\eafd"}),e.creditCard=new e("credit-card",{fontCharacter:"\\eac9"}),e.dash=new e("dash",{fontCharacter:"\\eacc"}),e.dashboard=new e("dashboard",{fontCharacter:"\\eacd"}),e.database=new e("database",{fontCharacter:"\\eace"}),e.debugContinue=new e("debug-continue",{fontCharacter:"\\eacf"}),e.debugDisconnect=new e("debug-disconnect",{fontCharacter:"\\ead0"}),e.debugPause=new e("debug-pause",{fontCharacter:"\\ead1"}),e.debugRestart=new e("debug-restart",{fontCharacter:"\\ead2"}),e.debugStart=new e("debug-start",{fontCharacter:"\\ead3"}),e.debugStepInto=new e("debug-step-into",{fontCharacter:"\\ead4"}),e.debugStepOut=new e("debug-step-out",{fontCharacter:"\\ead5"}),e.debugStepOver=new e("debug-step-over",{fontCharacter:"\\ead6"}),e.debugStop=new e("debug-stop",{fontCharacter:"\\ead7"}),e.debug=new e("debug",{fontCharacter:"\\ead8"}),e.deviceCameraVideo=new e("device-camera-video",{fontCharacter:"\\ead9"}),e.deviceCamera=new e("device-camera",{fontCharacter:"\\eada"}),e.deviceMobile=new e("device-mobile",{fontCharacter:"\\eadb"}),e.diffAdded=new e("diff-added",{fontCharacter:"\\eadc"}),e.diffIgnored=new e("diff-ignored",{fontCharacter:"\\eadd"}),e.diffModified=new e("diff-modified",{fontCharacter:"\\eade"}),e.diffRemoved=new e("diff-removed",{fontCharacter:"\\eadf"}),e.diffRenamed=new e("diff-renamed",{fontCharacter:"\\eae0"}),e.diff=new e("diff",{fontCharacter:"\\eae1"}),e.discard=new e("discard",{fontCharacter:"\\eae2"}),e.editorLayout=new e("editor-layout",{fontCharacter:"\\eae3"}),e.emptyWindow=new e("empty-window",{fontCharacter:"\\eae4"}),e.exclude=new e("exclude",{fontCharacter:"\\eae5"}),e.extensions=new e("extensions",{fontCharacter:"\\eae6"}),e.eyeClosed=new e("eye-closed",{fontCharacter:"\\eae7"}),e.fileBinary=new e("file-binary",{fontCharacter:"\\eae8"}),e.fileCode=new e("file-code",{fontCharacter:"\\eae9"}),e.fileMedia=new e("file-media",{fontCharacter:"\\eaea"}),e.filePdf=new e("file-pdf",{fontCharacter:"\\eaeb"}),e.fileSubmodule=new e("file-submodule",{fontCharacter:"\\eaec"}),e.fileSymlinkDirectory=new e("file-symlink-directory",{fontCharacter:"\\eaed"}),e.fileSymlinkFile=new e("file-symlink-file",{fontCharacter:"\\eaee"}),e.fileZip=new e("file-zip",{fontCharacter:"\\eaef"}),e.files=new e("files",{fontCharacter:"\\eaf0"}),e.filter=new e("filter",{fontCharacter:"\\eaf1"}),e.flame=new e("flame",{fontCharacter:"\\eaf2"}),e.foldDown=new e("fold-down",{fontCharacter:"\\eaf3"}),e.foldUp=new e("fold-up",{fontCharacter:"\\eaf4"}),e.fold=new e("fold",{fontCharacter:"\\eaf5"}),e.folderActive=new e("folder-active",{fontCharacter:"\\eaf6"}),e.folderOpened=new e("folder-opened",{fontCharacter:"\\eaf7"}),e.gear=new e("gear",{fontCharacter:"\\eaf8"}),e.gift=new e("gift",{fontCharacter:"\\eaf9"}),e.gistSecret=new e("gist-secret",{fontCharacter:"\\eafa"}),e.gist=new e("gist",{fontCharacter:"\\eafb"}),e.gitCommit=new e("git-commit",{fontCharacter:"\\eafc"}),e.gitCompare=new e("git-compare",{fontCharacter:"\\eafd"}),e.gitMerge=new e("git-merge",{fontCharacter:"\\eafe"}),e.githubAction=new e("github-action",{fontCharacter:"\\eaff"}),e.githubAlt=new e("github-alt",{fontCharacter:"\\eb00"}),e.globe=new e("globe",{fontCharacter:"\\eb01"}),e.grabber=new e("grabber",{fontCharacter:"\\eb02"}),e.graph=new e("graph",{fontCharacter:"\\eb03"}),e.gripper=new e("gripper",{fontCharacter:"\\eb04"}),e.heart=new e("heart",{fontCharacter:"\\eb05"}),e.home=new e("home",{fontCharacter:"\\eb06"}),e.horizontalRule=new e("horizontal-rule",{fontCharacter:"\\eb07"}),e.hubot=new e("hubot",{fontCharacter:"\\eb08"}),e.inbox=new e("inbox",{fontCharacter:"\\eb09"}),e.issueClosed=new e("issue-closed",{fontCharacter:"\\eba4"}),e.issueReopened=new e("issue-reopened",{fontCharacter:"\\eb0b"}),e.issues=new e("issues",{fontCharacter:"\\eb0c"}),e.italic=new e("italic",{fontCharacter:"\\eb0d"}),e.jersey=new e("jersey",{fontCharacter:"\\eb0e"}),e.json=new e("json",{fontCharacter:"\\eb0f"}),e.kebabVertical=new e("kebab-vertical",{fontCharacter:"\\eb10"}),e.key=new e("key",{fontCharacter:"\\eb11"}),e.law=new e("law",{fontCharacter:"\\eb12"}),e.lightbulbAutofix=new e("lightbulb-autofix",{fontCharacter:"\\eb13"}),e.linkExternal=new e("link-external",{fontCharacter:"\\eb14"}),e.link=new e("link",{fontCharacter:"\\eb15"}),e.listOrdered=new e("list-ordered",{fontCharacter:"\\eb16"}),e.listUnordered=new e("list-unordered",{fontCharacter:"\\eb17"}),e.liveShare=new e("live-share",{fontCharacter:"\\eb18"}),e.loading=new e("loading",{fontCharacter:"\\eb19"}),e.location=new e("location",{fontCharacter:"\\eb1a"}),e.mailRead=new e("mail-read",{fontCharacter:"\\eb1b"}),e.mail=new e("mail",{fontCharacter:"\\eb1c"}),e.markdown=new e("markdown",{fontCharacter:"\\eb1d"}),e.megaphone=new e("megaphone",{fontCharacter:"\\eb1e"}),e.mention=new e("mention",{fontCharacter:"\\eb1f"}),e.milestone=new e("milestone",{fontCharacter:"\\eb20"}),e.mortarBoard=new e("mortar-board",{fontCharacter:"\\eb21"}),e.move=new e("move",{fontCharacter:"\\eb22"}),e.multipleWindows=new e("multiple-windows",{fontCharacter:"\\eb23"}),e.mute=new e("mute",{fontCharacter:"\\eb24"}),e.noNewline=new e("no-newline",{fontCharacter:"\\eb25"}),e.note=new e("note",{fontCharacter:"\\eb26"}),e.octoface=new e("octoface",{fontCharacter:"\\eb27"}),e.openPreview=new e("open-preview",{fontCharacter:"\\eb28"}),e.package_=new e("package",{fontCharacter:"\\eb29"}),e.paintcan=new e("paintcan",{fontCharacter:"\\eb2a"}),e.pin=new e("pin",{fontCharacter:"\\eb2b"}),e.play=new e("play",{fontCharacter:"\\eb2c"}),e.run=new e("run",{fontCharacter:"\\eb2c"}),e.plug=new e("plug",{fontCharacter:"\\eb2d"}),e.preserveCase=new e("preserve-case",{fontCharacter:"\\eb2e"}),e.preview=new e("preview",{fontCharacter:"\\eb2f"}),e.project=new e("project",{fontCharacter:"\\eb30"}),e.pulse=new e("pulse",{fontCharacter:"\\eb31"}),e.question=new e("question",{fontCharacter:"\\eb32"}),e.quote=new e("quote",{fontCharacter:"\\eb33"}),e.radioTower=new e("radio-tower",{fontCharacter:"\\eb34"}),e.reactions=new e("reactions",{fontCharacter:"\\eb35"}),e.references=new e("references",{fontCharacter:"\\eb36"}),e.refresh=new e("refresh",{fontCharacter:"\\eb37"}),e.regex=new e("regex",{fontCharacter:"\\eb38"}),e.remoteExplorer=new e("remote-explorer",{fontCharacter:"\\eb39"}),e.remote=new e("remote",{fontCharacter:"\\eb3a"}),e.remove=new e("remove",{fontCharacter:"\\eb3b"}),e.replaceAll=new e("replace-all",{fontCharacter:"\\eb3c"}),e.replace=new e("replace",{fontCharacter:"\\eb3d"}),e.repoClone=new e("repo-clone",{fontCharacter:"\\eb3e"}),e.repoForcePush=new e("repo-force-push",{fontCharacter:"\\eb3f"}),e.repoPull=new e("repo-pull",{fontCharacter:"\\eb40"}),e.repoPush=new e("repo-push",{fontCharacter:"\\eb41"}),e.report=new e("report",{fontCharacter:"\\eb42"}),e.requestChanges=new e("request-changes",{fontCharacter:"\\eb43"}),e.rocket=new e("rocket",{fontCharacter:"\\eb44"}),e.rootFolderOpened=new e("root-folder-opened",{fontCharacter:"\\eb45"}),e.rootFolder=new e("root-folder",{fontCharacter:"\\eb46"}),e.rss=new e("rss",{fontCharacter:"\\eb47"}),e.ruby=new e("ruby",{fontCharacter:"\\eb48"}),e.saveAll=new e("save-all",{fontCharacter:"\\eb49"}),e.saveAs=new e("save-as",{fontCharacter:"\\eb4a"}),e.save=new e("save",{fontCharacter:"\\eb4b"}),e.screenFull=new e("screen-full",{fontCharacter:"\\eb4c"}),e.screenNormal=new e("screen-normal",{fontCharacter:"\\eb4d"}),e.searchStop=new e("search-stop",{fontCharacter:"\\eb4e"}),e.server=new e("server",{fontCharacter:"\\eb50"}),e.settingsGear=new e("settings-gear",{fontCharacter:"\\eb51"}),e.settings=new e("settings",{fontCharacter:"\\eb52"}),e.shield=new e("shield",{fontCharacter:"\\eb53"}),e.smiley=new e("smiley",{fontCharacter:"\\eb54"}),e.sortPrecedence=new e("sort-precedence",{fontCharacter:"\\eb55"}),e.splitHorizontal=new e("split-horizontal",{fontCharacter:"\\eb56"}),e.splitVertical=new e("split-vertical",{fontCharacter:"\\eb57"}),e.squirrel=new e("squirrel",{fontCharacter:"\\eb58"}),e.starFull=new e("star-full",{fontCharacter:"\\eb59"}),e.starHalf=new e("star-half",{fontCharacter:"\\eb5a"}),e.symbolClass=new e("symbol-class",{fontCharacter:"\\eb5b"}),e.symbolColor=new e("symbol-color",{fontCharacter:"\\eb5c"}),e.symbolConstant=new e("symbol-constant",{fontCharacter:"\\eb5d"}),e.symbolEnumMember=new e("symbol-enum-member",{fontCharacter:"\\eb5e"}),e.symbolField=new e("symbol-field",{fontCharacter:"\\eb5f"}),e.symbolFile=new e("symbol-file",{fontCharacter:"\\eb60"}),e.symbolInterface=new e("symbol-interface",{fontCharacter:"\\eb61"}),e.symbolKeyword=new e("symbol-keyword",{fontCharacter:"\\eb62"}),e.symbolMisc=new e("symbol-misc",{fontCharacter:"\\eb63"}),e.symbolOperator=new e("symbol-operator",{fontCharacter:"\\eb64"}),e.symbolProperty=new e("symbol-property",{fontCharacter:"\\eb65"}),e.wrench=new e("wrench",{fontCharacter:"\\eb65"}),e.wrenchSubaction=new e("wrench-subaction",{fontCharacter:"\\eb65"}),e.symbolSnippet=new e("symbol-snippet",{fontCharacter:"\\eb66"}),e.tasklist=new e("tasklist",{fontCharacter:"\\eb67"}),e.telescope=new e("telescope",{fontCharacter:"\\eb68"}),e.textSize=new e("text-size",{fontCharacter:"\\eb69"}),e.threeBars=new e("three-bars",{fontCharacter:"\\eb6a"}),e.thumbsdown=new e("thumbsdown",{fontCharacter:"\\eb6b"}),e.thumbsup=new e("thumbsup",{fontCharacter:"\\eb6c"}),e.tools=new e("tools",{fontCharacter:"\\eb6d"}),e.triangleDown=new e("triangle-down",{fontCharacter:"\\eb6e"}),e.triangleLeft=new e("triangle-left",{fontCharacter:"\\eb6f"}),e.triangleRight=new e("triangle-right",{fontCharacter:"\\eb70"}),e.triangleUp=new e("triangle-up",{fontCharacter:"\\eb71"}),e.twitter=new e("twitter",{fontCharacter:"\\eb72"}),e.unfold=new e("unfold",{fontCharacter:"\\eb73"}),e.unlock=new e("unlock",{fontCharacter:"\\eb74"}),e.unmute=new e("unmute",{fontCharacter:"\\eb75"}),e.unverified=new e("unverified",{fontCharacter:"\\eb76"}),e.verified=new e("verified",{fontCharacter:"\\eb77"}),e.versions=new e("versions",{fontCharacter:"\\eb78"}),e.vmActive=new e("vm-active",{fontCharacter:"\\eb79"}),e.vmOutline=new e("vm-outline",{fontCharacter:"\\eb7a"}),e.vmRunning=new e("vm-running",{fontCharacter:"\\eb7b"}),e.watch=new e("watch",{fontCharacter:"\\eb7c"}),e.whitespace=new e("whitespace",{fontCharacter:"\\eb7d"}),e.wholeWord=new e("whole-word",{fontCharacter:"\\eb7e"}),e.window=new e("window",{fontCharacter:"\\eb7f"}),e.wordWrap=new e("word-wrap",{fontCharacter:"\\eb80"}),e.zoomIn=new e("zoom-in",{fontCharacter:"\\eb81"}),e.zoomOut=new e("zoom-out",{fontCharacter:"\\eb82"}),e.listFilter=new e("list-filter",{fontCharacter:"\\eb83"}),e.listFlat=new e("list-flat",{fontCharacter:"\\eb84"}),e.listSelection=new e("list-selection",{fontCharacter:"\\eb85"}),e.selection=new e("selection",{fontCharacter:"\\eb85"}),e.listTree=new e("list-tree",{fontCharacter:"\\eb86"}),e.debugBreakpointFunctionUnverified=new e("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),e.debugBreakpointFunction=new e("debug-breakpoint-function",{fontCharacter:"\\eb88"}),e.debugBreakpointFunctionDisabled=new e("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),e.debugStackframeActive=new e("debug-stackframe-active",{fontCharacter:"\\eb89"}),e.debugStackframeDot=new e("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),e.debugStackframe=new e("debug-stackframe",{fontCharacter:"\\eb8b"}),e.debugStackframeFocused=new e("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),e.debugBreakpointUnsupported=new e("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),e.symbolString=new e("symbol-string",{fontCharacter:"\\eb8d"}),e.debugReverseContinue=new e("debug-reverse-continue",{fontCharacter:"\\eb8e"}),e.debugStepBack=new e("debug-step-back",{fontCharacter:"\\eb8f"}),e.debugRestartFrame=new e("debug-restart-frame",{fontCharacter:"\\eb90"}),e.callIncoming=new e("call-incoming",{fontCharacter:"\\eb92"}),e.callOutgoing=new e("call-outgoing",{fontCharacter:"\\eb93"}),e.menu=new e("menu",{fontCharacter:"\\eb94"}),e.expandAll=new e("expand-all",{fontCharacter:"\\eb95"}),e.feedback=new e("feedback",{fontCharacter:"\\eb96"}),e.groupByRefType=new e("group-by-ref-type",{fontCharacter:"\\eb97"}),e.ungroupByRefType=new e("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),e.account=new e("account",{fontCharacter:"\\eb99"}),e.bellDot=new e("bell-dot",{fontCharacter:"\\eb9a"}),e.debugConsole=new e("debug-console",{fontCharacter:"\\eb9b"}),e.library=new e("library",{fontCharacter:"\\eb9c"}),e.output=new e("output",{fontCharacter:"\\eb9d"}),e.runAll=new e("run-all",{fontCharacter:"\\eb9e"}),e.syncIgnored=new e("sync-ignored",{fontCharacter:"\\eb9f"}),e.pinned=new e("pinned",{fontCharacter:"\\eba0"}),e.githubInverted=new e("github-inverted",{fontCharacter:"\\eba1"}),e.debugAlt=new e("debug-alt",{fontCharacter:"\\eb91"}),e.serverProcess=new e("server-process",{fontCharacter:"\\eba2"}),e.serverEnvironment=new e("server-environment",{fontCharacter:"\\eba3"}),e.pass=new e("pass",{fontCharacter:"\\eba4"}),e.stopCircle=new e("stop-circle",{fontCharacter:"\\eba5"}),e.playCircle=new e("play-circle",{fontCharacter:"\\eba6"}),e.record=new e("record",{fontCharacter:"\\eba7"}),e.debugAltSmall=new e("debug-alt-small",{fontCharacter:"\\eba8"}),e.vmConnect=new e("vm-connect",{fontCharacter:"\\eba9"}),e.cloud=new e("cloud",{fontCharacter:"\\ebaa"}),e.merge=new e("merge",{fontCharacter:"\\ebab"}),e.exportIcon=new e("export",{fontCharacter:"\\ebac"}),e.graphLeft=new e("graph-left",{fontCharacter:"\\ebad"}),e.magnet=new e("magnet",{fontCharacter:"\\ebae"}),e.notebook=new e("notebook",{fontCharacter:"\\ebaf"}),e.redo=new e("redo",{fontCharacter:"\\ebb0"}),e.checkAll=new e("check-all",{fontCharacter:"\\ebb1"}),e.pinnedDirty=new e("pinned-dirty",{fontCharacter:"\\ebb2"}),e.passFilled=new e("pass-filled",{fontCharacter:"\\ebb3"}),e.circleLargeFilled=new e("circle-large-filled",{fontCharacter:"\\ebb4"}),e.circleLargeOutline=new e("circle-large-outline",{fontCharacter:"\\ebb5"}),e.combine=new e("combine",{fontCharacter:"\\ebb6"}),e.gather=new e("gather",{fontCharacter:"\\ebb6"}),e.table=new e("table",{fontCharacter:"\\ebb7"}),e.variableGroup=new e("variable-group",{fontCharacter:"\\ebb8"}),e.typeHierarchy=new e("type-hierarchy",{fontCharacter:"\\ebb9"}),e.typeHierarchySub=new e("type-hierarchy-sub",{fontCharacter:"\\ebba"}),e.typeHierarchySuper=new e("type-hierarchy-super",{fontCharacter:"\\ebbb"}),e.gitPullRequestCreate=new e("git-pull-request-create",{fontCharacter:"\\ebbc"}),e.runAbove=new e("run-above",{fontCharacter:"\\ebbd"}),e.runBelow=new e("run-below",{fontCharacter:"\\ebbe"}),e.notebookTemplate=new e("notebook-template",{fontCharacter:"\\ebbf"}),e.debugRerun=new e("debug-rerun",{fontCharacter:"\\ebc0"}),e.workspaceTrusted=new e("workspace-trusted",{fontCharacter:"\\ebc1"}),e.workspaceUntrusted=new e("workspace-untrusted",{fontCharacter:"\\ebc2"}),e.workspaceUnspecified=new e("workspace-unspecified",{fontCharacter:"\\ebc3"}),e.terminalCmd=new e("terminal-cmd",{fontCharacter:"\\ebc4"}),e.terminalDebian=new e("terminal-debian",{fontCharacter:"\\ebc5"}),e.terminalLinux=new e("terminal-linux",{fontCharacter:"\\ebc6"}),e.terminalPowershell=new e("terminal-powershell",{fontCharacter:"\\ebc7"}),e.terminalTmux=new e("terminal-tmux",{fontCharacter:"\\ebc8"}),e.terminalUbuntu=new e("terminal-ubuntu",{fontCharacter:"\\ebc9"}),e.terminalBash=new e("terminal-bash",{fontCharacter:"\\ebca"}),e.arrowSwap=new e("arrow-swap",{fontCharacter:"\\ebcb"}),e.copy=new e("copy",{fontCharacter:"\\ebcc"}),e.personAdd=new e("person-add",{fontCharacter:"\\ebcd"}),e.filterFilled=new e("filter-filled",{fontCharacter:"\\ebce"}),e.wand=new e("wand",{fontCharacter:"\\ebcf"}),e.debugLineByLine=new e("debug-line-by-line",{fontCharacter:"\\ebd0"}),e.inspect=new e("inspect",{fontCharacter:"\\ebd1"}),e.layers=new e("layers",{fontCharacter:"\\ebd2"}),e.layersDot=new e("layers-dot",{fontCharacter:"\\ebd3"}),e.layersActive=new e("layers-active",{fontCharacter:"\\ebd4"}),e.compass=new e("compass",{fontCharacter:"\\ebd5"}),e.compassDot=new e("compass-dot",{fontCharacter:"\\ebd6"}),e.compassActive=new e("compass-active",{fontCharacter:"\\ebd7"}),e.azure=new e("azure",{fontCharacter:"\\ebd8"}),e.issueDraft=new e("issue-draft",{fontCharacter:"\\ebd9"}),e.gitPullRequestClosed=new e("git-pull-request-closed",{fontCharacter:"\\ebda"}),e.gitPullRequestDraft=new e("git-pull-request-draft",{fontCharacter:"\\ebdb"}),e.debugAll=new e("debug-all",{fontCharacter:"\\ebdc"}),e.debugCoverage=new e("debug-coverage",{fontCharacter:"\\ebdd"}),e.runErrors=new e("run-errors",{fontCharacter:"\\ebde"}),e.folderLibrary=new e("folder-library",{fontCharacter:"\\ebdf"}),e.debugContinueSmall=new e("debug-continue-small",{fontCharacter:"\\ebe0"}),e.beakerStop=new e("beaker-stop",{fontCharacter:"\\ebe1"}),e.graphLine=new e("graph-line",{fontCharacter:"\\ebe2"}),e.graphScatter=new e("graph-scatter",{fontCharacter:"\\ebe3"}),e.pieChart=new e("pie-chart",{fontCharacter:"\\ebe4"}),e.bracket=new e("bracket",e.json.definition),e.bracketDot=new e("bracket-dot",{fontCharacter:"\\ebe5"}),e.bracketError=new e("bracket-error",{fontCharacter:"\\ebe6"}),e.lockSmall=new e("lock-small",{fontCharacter:"\\ebe7"}),e.azureDevops=new e("azure-devops",{fontCharacter:"\\ebe8"}),e.verifiedFilled=new e("verified-filled",{fontCharacter:"\\ebe9"})}(l||(l={}))},79881:function(e,t,i){"use strict";i.d(t,{B8:function(){return d},Cp:function(){return s},F0:function(){return c},L6:function(){return h},VV:function(){return l},b1:function(){return u},dL:function(){return r},ri:function(){return o}});const n=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout((()=>{if(e.stack)throw new Error(e.message+"\n\n"+e.stack);throw e}),0)}}emit(e){this.listeners.forEach((t=>{t(e)}))}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function r(e){l(e)||n.onUnexpectedError(e)}function s(e){l(e)||n.onUnexpectedExternalError(e)}function o(e){if(e instanceof Error){let{name:t,message:i}=e;return{$isError:!0,name:t,message:i,stack:e.stacktrace||e.stack}}return e}const a="Canceled";function l(e){return e instanceof Error&&e.name===a&&e.message===a}function c(){const e=new Error(a);return e.name=e.message,e}function u(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")}function h(e){return e?new Error(`Illegal state: ${e}`):new Error("Illegal state")}class d extends Error{constructor(e){super("NotSupported"),e&&(this.message=e)}}},4348:function(e,t,i){"use strict";i.d(t,{D0:function(){return h},E7:function(){return d},K3:function(){return u},Q5:function(){return c},ZD:function(){return f},ju:function(){return n}});var n,r=i(79881),s=i(69323),o=i(34502),a=i(95830);!function(e){function t(e){return(t,i=null,n)=>{let r,s=!1;return r=e((e=>{if(!s)return r?r.dispose():s=!0,t.call(i,e)}),null,n),s&&r.dispose(),r}}function i(e,t){return a(((i,n=null,r)=>e((e=>i.call(n,t(e))),null,r)))}function n(e,t){return a(((i,n=null,r)=>e((e=>{t(e),i.call(n,e)}),null,r)))}function r(e,t){return a(((i,n=null,r)=>e((e=>t(e)&&i.call(n,e)),null,r)))}function o(e,t,n){let r=n;return i(e,(e=>(r=t(r,e),r)))}function a(e){let t;const i=new c({onFirstListenerAdd(){t=e(i.fire,i)},onLastListenerRemove(){t.dispose()}});return i.event}function l(e,t,i=100,n=!1,r){let s,o,a,l=0;const u=new c({leakWarningThreshold:r,onFirstListenerAdd(){s=e((e=>{l++,o=t(o,e),n&&!a&&(u.fire(o),o=void 0),clearTimeout(a),a=setTimeout((()=>{const e=o;o=void 0,a=void 0,(!n||l>1)&&u.fire(e),l=0}),i)}))},onLastListenerRemove(){s.dispose()}});return u.event}function u(e,t=((e,t)=>e===t)){let i,n=!0;return r(e,(e=>{const r=n||!t(e,i);return n=!1,i=e,r}))}e.None=()=>s.JT.None,e.once=t,e.map=i,e.forEach=n,e.filter=r,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,n)=>(0,s.F8)(...e.map((e=>e((e=>t.call(i,e)),null,n))))},e.reduce=o,e.debounce=l,e.latch=u,e.split=function(t,i){return[e.filter(t,i),e.filter(t,(e=>!i(e)))]},e.buffer=function(e,t=!1,i=[]){let n=i.slice(),r=e((e=>{n?n.push(e):o.fire(e)}));const s=()=>{n&&n.forEach((e=>o.fire(e))),n=null},o=new c({onFirstListenerAdd(){r||(r=e((e=>o.fire(e))))},onFirstListenerDidAdd(){n&&(t?setTimeout(s):s())},onLastListenerRemove(){r&&r.dispose(),r=null}});return o.event};class h{constructor(e){this.event=e}map(e){return new h(i(this.event,e))}forEach(e){return new h(n(this.event,e))}filter(e){return new h(r(this.event,e))}reduce(e,t){return new h(o(this.event,e,t))}latch(){return new h(u(this.event))}debounce(e,t=100,i=!1,n){return new h(l(this.event,e,t,i,n))}on(e,t,i){return this.event(e,t,i)}once(e,i,n){return t(this.event)(e,i,n)}}e.chain=function(e){return new h(e)},e.fromNodeEventEmitter=function(e,t,i=(e=>e)){const n=(...e)=>r.fire(i(...e)),r=new c({onFirstListenerAdd:()=>e.on(t,n),onLastListenerRemove:()=>e.removeListener(t,n)});return r.event},e.fromDOMEventEmitter=function(e,t,i=(e=>e)){const n=(...e)=>r.fire(i(...e)),r=new c({onFirstListenerAdd:()=>e.addEventListener(t,n),onLastListenerRemove:()=>e.removeEventListener(t,n)});return r.event},e.toPromise=function(e){return new Promise((i=>t(e)(i)))}}(n||(n={}));class l{constructor(e){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${e}_${l._idPool++}`}start(e){this._stopWatch=new a.G(!0),this._listenerCount=e}stop(){if(this._stopWatch){const e=this._stopWatch.elapsed();this._elapsedOverall+=e,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${e.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}l._idPool=0;class c{constructor(e){var t;this._disposed=!1,this._options=e,this._leakageMon=void 0,this._perfMon=(null===(t=this._options)||void 0===t?void 0:t._profName)?new l(this._options._profName):void 0}get event(){return this._event||(this._event=(e,t,i)=>{var n;this._listeners||(this._listeners=new o.S);const r=this._listeners.isEmpty();r&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const a=this._listeners.push(t?[e,t]:e);r&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,e,t);const l=null===(n=this._leakageMon)||void 0===n?void 0:n.check(this._listeners.size),c=(0,s.OF)((()=>{if(l&&l(),!this._disposed&&(a(),this._options&&this._options.onLastListenerRemove)){this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)}}));return i instanceof s.SL?i.add(c):Array.isArray(i)&&i.push(c),c}),this._event}fire(e){var t,i;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new o.S);for(let t of this._listeners)this._deliveryQueue.push([t,e]);for(null===(t=this._perfMon)||void 0===t||t.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[e,t]=this._deliveryQueue.shift();try{"function"==typeof e?e.call(void 0,t):e[0].call(e[1],t)}catch(e){(0,r.dL)(e)}}null===(i=this._perfMon)||void 0===i||i.stop()}}dispose(){var e,t,i,n,r;this._disposed||(this._disposed=!0,null===(e=this._listeners)||void 0===e||e.clear(),null===(t=this._deliveryQueue)||void 0===t||t.clear(),null===(n=null===(i=this._options)||void 0===i?void 0:i.onLastListenerRemove)||void 0===n||n.call(i),null===(r=this._leakageMon)||void 0===r||r.dispose())}}class u extends c{constructor(e){super(e),this._isPaused=0,this._eventQueue=new o.S,this._mergeFn=null==e?void 0:e.merge}pause(){this._isPaused++}resume(){if(0!==this._isPaused&&0==--this._isPaused)if(this._mergeFn){const e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}else for(;!this._isPaused&&0!==this._eventQueue.size;)super.fire(this._eventQueue.shift())}fire(e){this._listeners&&(0!==this._isPaused?this._eventQueue.push(e):super.fire(e))}}class h extends u{constructor(e){var t;super(e),this._delay=null!==(t=e.delay)&&void 0!==t?t:100}fire(e){this._handle||(this.pause(),this._handle=setTimeout((()=>{this._handle=void 0,this.resume()}),this._delay)),super.fire(e)}}class d{constructor(){this.buffers=[]}wrapEvent(e){return(t,i,n)=>e((e=>{const n=this.buffers[this.buffers.length-1];n?n.push((()=>t.call(i,e))):t.call(i,e)}),void 0,n)}bufferEvents(e){const t=[];this.buffers.push(t);const i=e();return this.buffers.pop(),t.forEach((e=>e())),i}}class f{constructor(){this.listening=!1,this.inputEvent=n.None,this.inputEventListener=s.JT.None,this.emitter=new c({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(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(e,t,i){"use strict";function n(e){const t=this;let i,n=!1;return function(){return n||(n=!0,i=e.apply(t,arguments)),i}}i.d(t,{I:function(){return n}})},88226:function(e,t,i){"use strict";var n;i.d(t,{$:function(){return n}}),function(e){e.is=function(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]};const t=Object.freeze([]);e.empty=function(){return t},e.single=function*(e){yield e},e.from=function(e){return e||t},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){for(const i of e)if(t(i))return!0;return!1},e.find=function(e,t){for(const i of e)if(t(i))return i},e.filter=function*(e,t){for(const i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(const n of e)yield t(n,i++)},e.concat=function*(...e){for(const t of e)for(const e of t)yield e},e.concatNested=function*(e){for(const t of e)for(const e of t)yield e},e.reduce=function(e,t,i){let n=i;for(const i of e)n=t(n,i);return n},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);t<i;t++)yield e[t]},e.consume=function(t,i=Number.POSITIVE_INFINITY){const n=[];if(0===i)return[n,t];const r=t[Symbol.iterator]();for(let t=0;t<i;t++){const t=r.next();if(t.done)return[n,e.empty()];n.push(t.value)}return[n,{[Symbol.iterator](){return r}}]},e.equals=function(e,t,i=((e,t)=>e===t)){const n=e[Symbol.iterator](),r=t[Symbol.iterator]();for(;;){const e=n.next(),t=r.next();if(e.done!==t.done)return!1;if(e.done)return!0;if(!i(e.value,t.value))return!1}}}(n||(n={}))},69323:function(e,t,i){"use strict";i.d(t,{B9:function(){return d},F8:function(){return f},JT:function(){return g},Jz:function(){return v},OF:function(){return p},SL:function(){return _},Wf:function(){return h},XK:function(){return m},dk:function(){return c}});var n=i(17845),r=i(88226);let s=null;function o(e){return null==s||s.trackDisposable(e),e}function a(e){null==s||s.markAsDisposed(e)}function l(e,t){null==s||s.setParent(e,t)}function c(e){return null==s||s.markAsSingleton(e),e}class u extends Error{constructor(e){super(`Encountered errors while disposing of store. Errors: [${e.join(", ")}]`),this.errors=e}}function h(e){return"function"==typeof e.dispose&&0===e.dispose.length}function d(e){if(r.$.is(e)){let t=[];for(const i of e)if(i)try{i.dispose()}catch(e){t.push(e)}if(1===t.length)throw t[0];if(t.length>1)throw new u(t);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function f(...e){const t=p((()=>d(e)));return function(e,t){if(s)for(const i of e)s.setParent(i,t)}(e,t),t}function p(e){const t=o({dispose:(0,n.I)((()=>{a(t),e()}))});return t}class _{constructor(){this._toDispose=new Set,this._isDisposed=!1,o(this)}dispose(){this._isDisposed||(a(this),this._isDisposed=!0,this.clear())}clear(){try{d(this._toDispose.values())}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return l(e,this),this._isDisposed?_.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(e),e}}_.DISABLE_DISPOSED_WARNING=!1;class g{constructor(){this._store=new _,o(this),l(this._store,this)}dispose(){a(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}}g.None=Object.freeze({dispose(){}});class m{constructor(){this._isDisposed=!1,o(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null===(t=this._value)||void 0===t||t.dispose(),e&&l(e,this),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,a(this),null===(e=this._value)||void 0===e||e.dispose(),this._value=void 0}clearAndLeak(){const e=this._value;return this._value=void 0,e&&l(e,null),e}}class v{constructor(e){this.object=e}dispose(){}}},34502:function(e,t,i){"use strict";i.d(t,{S:function(){return r}});class n{constructor(e){this.element=e,this.next=n.Undefined,this.prev=n.Undefined}}n.Undefined=new n(void 0);class r{constructor(){this._first=n.Undefined,this._last=n.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===n.Undefined}clear(){let e=this._first;for(;e!==n.Undefined;){const t=e.next;e.prev=n.Undefined,e.next=n.Undefined,e=t}this._first=n.Undefined,this._last=n.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const i=new n(e);if(this._first===n.Undefined)this._first=i,this._last=i;else if(t){const e=this._last;this._last=i,i.prev=e,e.next=i}else{const e=this._first;this._first=i,i.next=e,e.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==n.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==n.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==n.Undefined&&e.next!==n.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===n.Undefined&&e.next===n.Undefined?(this._first=n.Undefined,this._last=n.Undefined):e.next===n.Undefined?(this._last=this._last.prev,this._last.next=n.Undefined):e.prev===n.Undefined&&(this._first=this._first.next,this._first.prev=n.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==n.Undefined;)yield e.element,e=e.next}}},23345:function(e,t,i){"use strict";i.d(t,{$L:function(){return k},ED:function(){return S},IJ:function(){return w},OS:function(){return D},WE:function(){return A},dz:function(){return E},gn:function(){return T},li:function(){return m},r:function(){return I},tY:function(){return C},xS:function(){return x}});var n,r=i(97671);const s="en";let o,a,l=!1,c=!1,u=!1,h=!1,d=!1,f=!1,p=!1,_=null,g=null;const m="object"==typeof self?self:"object"==typeof i.g?i.g:{};let v;void 0!==m.vscode&&void 0!==m.vscode.process?v=m.vscode.process:void 0!==r&&(v=r);const y="string"==typeof(null===(n=null==v?void 0:v.versions)||void 0===n?void 0:n.electron)&&"renderer"===v.type;if("object"!=typeof navigator||y)if("object"==typeof v){l="win32"===v.platform,c="darwin"===v.platform,u="linux"===v.platform,h=u&&!!v.env.SNAP&&!!v.env.SNAP_REVISION,o=s,_=s;const e=v.env.VSCODE_NLS_CONFIG;if(e)try{const t=JSON.parse(e),i=t.availableLanguages["*"];o=t.locale,_=i||s,g=t._translationsConfigFile}catch(e){}d=!0}else console.error("Unable to resolve platform.");else a=navigator.userAgent,l=a.indexOf("Windows")>=0,c=a.indexOf("Macintosh")>=0,p=(a.indexOf("Macintosh")>=0||a.indexOf("iPad")>=0||a.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,u=a.indexOf("Linux")>=0,f=!0,o=navigator.language,_=o;let b=0;c?b=1:l?b=3:u&&(b=2);const S=l,E=c,w=u,C=d,k=f,T=p,A=a,x=function(){if(m.setImmediate)return m.setImmediate.bind(m);if("function"==typeof m.postMessage&&!m.importScripts){let e=[];m.addEventListener("message",(t=>{if(t.data&&t.data.vscodeSetImmediateId)for(let i=0,n=e.length;i<n;i++){const n=e[i];if(n.id===t.data.vscodeSetImmediateId)return e.splice(i,1),void n.callback()}}));let t=0;return i=>{const n=++t;e.push({id:n,callback:i}),m.postMessage({vscodeSetImmediateId:n},"*")}}if("function"==typeof(null==v?void 0:v.nextTick))return v.nextTick.bind(v);const e=Promise.resolve();return t=>e.then(t)}(),D=c||p?2:l?1:3;let L=!0,R=!1;function I(){if(!R){R=!0;const e=new Uint8Array(2);e[0]=1,e[1]=2;const t=new Uint16Array(e.buffer);L=513===t[0]}return L}},95830:function(e,t,i){"use strict";i.d(t,{G:function(){return s}});var n=i(23345);const r=n.li.performance&&"function"==typeof n.li.performance.now;class s{constructor(e){this._highResolution=r&&e,this._startTime=this._now(),this._stopTime=-1}static create(e=!0){return new s(e)}stop(){this._stopTime=this._now()}elapsed(){return-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?n.li.performance.now():Date.now()}}},82983:function(e,t,i){"use strict";function n(e){return!e||"string"!=typeof e||0===e.trim().length}i.d(t,{$i:function(){return $},C8:function(){return q},GF:function(){return f},HO:function(){return F},IO:function(){return p},K7:function(){return W},Kw:function(){return Z},LC:function(){return m},Mh:function(){return x},P1:function(){return D},PJ:function(){return X},Qe:function(){return G},R1:function(){return d},RP:function(){return H},S6:function(){return Q},TT:function(){return S},Ut:function(){return N},V8:function(){return v},WU:function(){return s},YK:function(){return R},YU:function(){return o},ZG:function(){return L},ZH:function(){return P},ab:function(){return z},c1:function(){return V},df:function(){return k},ec:function(){return a},fi:function(){return J},fy:function(){return l},j3:function(){return c},j_:function(){return w},m5:function(){return n},mK:function(){return C},mr:function(){return _},oH:function(){return te},oL:function(){return u},ok:function(){return A},ow:function(){return y},qq:function(){return T},qu:function(){return b},rL:function(){return I},uS:function(){return Y},un:function(){return h},uq:function(){return g},vH:function(){return M},xe:function(){return K},zY:function(){return E}});const r=/{(\d+)}/g;function s(e,...t){return 0===t.length?e:e.replace(r,(function(e,i){const n=parseInt(i,10);return isNaN(n)||n<0||n>=t.length?e:t[n]}))}function o(e){return e.replace(/[<>&]/g,(function(e){switch(e){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return e}}))}function a(e){return e.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function l(e,t=" "){return u(c(e,t),t)}function c(e,t){if(!e||!t)return e;const i=t.length;if(0===i||0===e.length)return e;let n=0;for(;e.indexOf(t,n)===n;)n+=i;return e.substring(n)}function u(e,t){if(!e||!t)return e;const i=t.length,n=e.length;if(0===i||0===n)return e;let r=n,s=-1;for(;s=e.lastIndexOf(t,r-1),-1!==s&&s+i===r;){if(0===s)return"";r=s}return e.substring(0,r)}function h(e){return e.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(e){return e.replace(/\*/g,"")}function f(e,t,i={}){if(!e)throw new Error("Cannot create regex from empty string");t||(e=a(e)),i.wholeWord&&(/\B/.test(e.charAt(0))||(e="\\b"+e),/\B/.test(e.charAt(e.length-1))||(e+="\\b"));let n="";return i.global&&(n+="g"),i.matchCase||(n+="i"),i.multiline&&(n+="m"),i.unicode&&(n+="u"),new RegExp(e,n)}function p(e){if("^"===e.source||"^$"===e.source||"$"===e.source||"^\\s*$"===e.source)return!1;return!(!e.exec("")||0!==e.lastIndex)}function _(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")}function g(e){return e.split(/\r\n|\r|\n/)}function m(e){for(let t=0,i=e.length;t<i;t++){const i=e.charCodeAt(t);if(32!==i&&9!==i)return t}return-1}function v(e,t=0,i=e.length){for(let n=t;n<i;n++){const i=e.charCodeAt(n);if(32!==i&&9!==i)return e.substring(t,n)}return e.substring(t,i)}function y(e,t=e.length-1){for(let i=t;i>=0;i--){const t=e.charCodeAt(i);if(32!==t&&9!==t)return i}return-1}function b(e,t){return e<t?-1:e>t?1:0}function S(e,t,i=0,n=e.length,r=0,s=t.length){for(;i<n&&r<s;i++,r++){let n=e.charCodeAt(i),s=t.charCodeAt(r);if(n<s)return-1;if(n>s)return 1}const o=n-i,a=s-r;return o<a?-1:o>a?1:0}function E(e,t){return w(e,t,0,e.length,0,t.length)}function w(e,t,i=0,n=e.length,r=0,s=t.length){for(;i<n&&r<s;i++,r++){let o=e.charCodeAt(i),a=t.charCodeAt(r);if(o===a)continue;if(o>=128||a>=128)return S(e.toLowerCase(),t.toLowerCase(),i,n,r,s);C(o)&&(o-=32),C(a)&&(a-=32);const l=o-a;if(0!==l)return l}const o=n-i,a=s-r;return o<a?-1:o>a?1:0}function C(e){return e>=97&&e<=122}function k(e){return e>=65&&e<=90}function T(e,t){return e.length===t.length&&0===w(e,t)}function A(e,t){const i=t.length;return!(t.length>e.length)&&0===w(e,t,0,i)}function x(e,t){let i,n=Math.min(e.length,t.length);for(i=0;i<n;i++)if(e.charCodeAt(i)!==t.charCodeAt(i))return i;return n}function D(e,t){let i,n=Math.min(e.length,t.length);const r=e.length-1,s=t.length-1;for(i=0;i<n;i++)if(e.charCodeAt(r-i)!==t.charCodeAt(s-i))return i;return n}function L(e){return 55296<=e&&e<=56319}function R(e){return 56320<=e&&e<=57343}function I(e,t){return t-56320+(e-55296<<10)+65536}function P(e,t,i){const n=e.charCodeAt(i);if(L(n)&&i+1<t){const t=e.charCodeAt(i+1);if(R(t))return I(n,t)}return n}function O(e,t){const i=e.charCodeAt(t-1);if(R(i)&&t>1){const n=e.charCodeAt(t-2);if(L(n))return I(n,i)}return i}function M(e,t){const i=ee.getInstance(),n=t,r=e.length,s=P(e,r,t);t+=s>=65536?2:1;let o=i.getGraphemeBreakType(s);for(;t<r;){const n=P(e,r,t),s=i.getGraphemeBreakType(n);if(J(o,s))break;t+=n>=65536?2:1,o=s}return t-n}function F(e,t){const i=ee.getInstance(),n=t,r=O(e,t);t-=r>=65536?2:1;let s=i.getGraphemeBreakType(r);for(;t>0;){const n=O(e,t),r=i.getGraphemeBreakType(n);if(J(r,s))break;t-=n>=65536?2:1,s=r}return n-t}const B=/(?:[\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 N(e){return B.test(e)}const U=/(?:[\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 H(e){return U.test(e)}const j=/^[\t\n\r\x20-\x7E]*$/;function $(e){return j.test(e)}const G=/[\u2028\u2029]/;function z(e){return G.test(e)}function K(e){for(let t=0,i=e.length;t<i;t++)if(W(e.charCodeAt(t)))return!0;return!1}function W(e){return(e=+e)>=11904&&e<=55215||e>=63744&&e<=64255||e>=65281&&e<=65374}function q(e){return e>=127462&&e<=127487||8986===e||8987===e||9200===e||9203===e||e>=9728&&e<=10175||11088===e||11093===e||e>=127744&&e<=128591||e>=128640&&e<=128764||e>=128992&&e<=129003||e>=129280&&e<=129535||e>=129648&&e<=129750}const V=String.fromCharCode(65279);function Y(e){return!!(e&&e.length>0&&65279===e.charCodeAt(0))}function Z(e,t=!1){return!!e&&(t&&(e=e.replace(/\\./g,"")),e.toLowerCase()!==e)}function X(e){return(e%=52)<26?String.fromCharCode(97+e):String.fromCharCode(65+e-26)}function Q(e){return ee.getInstance().getGraphemeBreakType(e)}function J(e,t){return 0===e?5!==t&&7!==t:(2!==e||3!==t)&&(4===e||2===e||3===e||(4===t||2===t||3===t||(8!==e||8!==t&&9!==t&&11!==t&&12!==t)&&((11!==e&&9!==e||9!==t&&10!==t)&&((12!==e&&10!==e||10!==t)&&(5!==t&&13!==t&&(7!==t&&(1!==e&&((13!==e||14!==t)&&(6!==e||6!==t)))))))))}class ee{constructor(){this._data=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]")}static getInstance(){return ee._INSTANCE||(ee._INSTANCE=new ee),ee._INSTANCE}getGraphemeBreakType(e){if(e<32)return 10===e?3:13===e?2:4;if(e<127)return 0;const t=this._data,i=t.length/3;let n=1;for(;n<=i;)if(e<t[3*n])n*=2;else{if(!(e>t[3*n+1]))return t[3*n+2];n=2*n+1}return 0}}function te(e,t){if(0===e)return 0;const i=function(e,t){let i=O(t,e);e-=ie(i);for(;ne(i)||65039===i||8419===i;){if(0===e)return;i=O(t,e),e-=ie(i)}if(!q(i))return;if(e>=0){const i=O(t,e);8205===i&&(e-=ie(i))}return e}(e,t);if(void 0!==i)return i;return e-=ie(O(t,e))}function ie(e){return e>=65536?2:1}function ne(e){return 127995<=e&&e<=127999}ee._INSTANCE=null},72999:function(e,t,i){"use strict";function n(e){return Array.isArray(e)}function r(e){return"string"==typeof e}function s(e){return!("object"!=typeof e||null===e||Array.isArray(e)||e instanceof RegExp||e instanceof Date)}function o(e){return"number"==typeof e&&!isNaN(e)}function a(e){return!0===e||!1===e}function l(e){return void 0===e}function c(e){return!u(e)}function u(e){return l(e)||null===e}function h(e,t){if(!e)throw new Error(t?`Unexpected type, expected '${t}'`:"Unexpected type")}function d(e){if(u(e))throw new Error("Assertion Failed: argument is undefined or null");return e}function f(e){return"function"==typeof e}function p(e,t){const i=Math.min(e.length,t.length);for(let n=0;n<i;n++)_(e[n],t[n])}function _(e,t){if(r(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(f(t)){try{if(e instanceof t)return}catch(e){}if(!u(e)&&e.constructor===t)return;if(1===t.length&&!0===t.call(void 0,e))return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function g(e){const t=[];for(const i of function(e){let t=[],i=Object.getPrototypeOf(e);for(;Object.prototype!==i;)t=t.concat(Object.getOwnPropertyNames(i)),i=Object.getPrototypeOf(i);return t}(e))"function"==typeof e[i]&&t.push(i);return t}function m(e,t){const i=e=>function(){const i=Array.prototype.slice.call(arguments,0);return t(e,i)};let n={};for(const t of e)n[t]=i(t);return n}function v(e){return null===e?void 0:e}function y(e,t="Unreachable"){throw new Error(t)}i.d(t,{$E:function(){return g},$K:function(){return c},D8:function(){return p},HD:function(){return r},IU:function(){return m},Jp:function(){return u},Kn:function(){return s},cW:function(){return d},f6:function(){return v},hj:function(){return o},jn:function(){return a},kJ:function(){return n},mf:function(){return f},o8:function(){return l},p_:function(){return h},vE:function(){return y}})},13268:function(e,t,i){"use strict";function n(e,t,...i){return function(e,t){let i;return i=0===t.length?e:e.replace(/\{(\d+)\}/g,(function(e,i){const n=i[0];return void 0!==t[n]?t[n]:e})),i}(t,i)}i.d(t,{N:function(){return n}})},96236:function(e,t,i){"use strict";i.d(t,{BH:function(){return v},NZ:function(){return y},U8:function(){return b},co:function(){return m},eH:function(){return g},vr:function(){return _}});var n=i(75918),r=i(52615),s=i(4348),o=i(88226),a=i(69323),l=i(34502),c=i(35884),u=i(90689),h=i(16925),d=i(49055),f=function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},p=function(e,t){return function(i,n){t(i,n,e)}};function _(e){return void 0!==e.command}class g{constructor(e){this.id=g._idPool++,this._debugName=e}}g._idPool=0,g.CommandPalette=new g("CommandPalette"),g.EditorContext=new g("EditorContext"),g.SimpleEditorContext=new g("SimpleEditorContext"),g.EditorContextCopy=new g("EditorContextCopy"),g.EditorContextPeek=new g("EditorContextPeek"),g.MenubarEditMenu=new g("MenubarEditMenu"),g.MenubarCopy=new g("MenubarCopy"),g.MenubarGoMenu=new g("MenubarGoMenu"),g.MenubarSelectionMenu=new g("MenubarSelectionMenu"),g.InlineCompletionsActions=new g("InlineCompletionsActions");const m=(0,h.yh)("menuService"),v=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new s.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:e=>e===g.CommandPalette}}addCommand(e){return this.addCommands(o.$.single(e))}addCommands(e){for(const t of e)this._commands.set(t.id,t);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,a.OF)((()=>{let t=!1;for(const i of e)t=this._commands.delete(i.id)||t;t&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)}))}getCommand(e){return this._commands.get(e)}getCommands(){const e=new Map;return this._commands.forEach(((t,i)=>e.set(i,t))),e}appendMenuItem(e,t){return this.appendMenuItems(o.$.single({id:e,item:t}))}appendMenuItems(e){const t=new Set,i=new l.S;for(const{id:n,item:r}of e){let e=this._menuItems.get(n);e||(e=new l.S,this._menuItems.set(n,e)),i.push(e.push(r)),t.add(n)}return this._onDidChangeMenu.fire(t),(0,a.OF)((()=>{if(i.size>0){for(let e of i)e();this._onDidChangeMenu.fire(t),i.clear()}}))}getMenuItems(e){let t;return t=this._menuItems.has(e)?[...this._menuItems.get(e)]:[],e===g.CommandPalette&&this._appendImplicitItems(t),t}_appendImplicitItems(e){const t=new Set;for(const i of e)_(i)&&(t.add(i.command.id),i.alt&&t.add(i.alt.id));this._commands.forEach(((i,n)=>{t.has(n)||e.push({command:i})}))}};class y extends n.wY{constructor(e,t,i,n){super(`submenuitem.${e.submenu.id}`,"string"==typeof e.title?e.title:e.title.value,[],"submenu"),this.item=e,this._menuService=t,this._contextKeyService=i,this._options=n}get actions(){const e=[],t=this._menuService.createMenu(this.item.submenu,this._contextKeyService),i=t.getActions(this._options);t.dispose();for(const[,t]of i)t.length>0&&(e.push(...t),e.push(new n.Z0));return e.length&&e.pop(),e}}let b=class e{constructor(t,i,n,s,o){var a,l;if(this._commandService=o,this.id=t.id,this.label=(null==n?void 0:n.renderShortTitle)&&t.shortTitle?"string"==typeof t.shortTitle?t.shortTitle:t.shortTitle.value:"string"==typeof t.title?t.title:t.title.value,this.tooltip=null!==(l="string"==typeof t.tooltip?t.tooltip:null===(a=t.tooltip)||void 0===a?void 0:a.value)&&void 0!==l?l:"",this.enabled=!t.precondition||s.contextMatchesRules(t.precondition),this.checked=void 0,t.toggled){const e=t.toggled.condition?t.toggled:{condition:t.toggled};this.checked=s.contextMatchesRules(e.condition),this.checked&&e.tooltip&&(this.tooltip="string"==typeof e.tooltip?e.tooltip:e.tooltip.value),e.title&&(this.label="string"==typeof e.title?e.title:e.title.value)}this.item=t,this.alt=i?new e(i,void 0,n,s,o):void 0,this._options=n,d.kS.isThemeIcon(t.icon)&&(this.class=r.dT.asClassName(t.icon))}dispose(){}run(...e){var t,i;let n=[];return(null===(t=this._options)||void 0===t?void 0:t.arg)&&(n=[...n,this._options.arg]),(null===(i=this._options)||void 0===i?void 0:i.shouldForwardArgs)&&(n=[...n,...e]),this._commandService.executeCommand(this.id,...n)}};b=f([p(3,u.i6),p(4,c.H)],b)},35884:function(e,t,i){"use strict";i.d(t,{H:function(){return l},P:function(){return c}});var n=i(4348),r=i(88226),s=i(69323),o=i(34502),a=i(72999);const l=(0,i(16925).yh)("commandService"),c=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new n.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(e,t){if(!e)throw new Error("invalid command");if("string"==typeof e){if(!t)throw new Error("invalid command");return this.registerCommand({id:e,handler:t})}if(e.description){const t=[];for(let i of e.description.args)t.push(i.constraint);const i=e.handler;e.handler=function(e,...n){return(0,a.D8)(n,t),i(e,...n)}}const{id:i}=e;let n=this._commands.get(i);n||(n=new o.S,this._commands.set(i,n));let r=n.unshift(e),l=(0,s.OF)((()=>{r();const e=this._commands.get(i);(null==e?void 0:e.isEmpty())&&this._commands.delete(i)}));return this._onDidRegisterCommand.fire(i),l}registerCommandAlias(e,t){return c.registerCommand(e,((e,...i)=>e.get(l).executeCommand(t,...i)))}getCommand(e){const t=this._commands.get(e);if(t&&!t.isEmpty())return r.$.first(t)}getCommands(){const e=new Map;for(const t of this._commands.keys()){const i=this.getCommand(t);i&&e.set(t,i)}return e}};c.registerCommand("noop",(()=>{}))},90689:function(e,t,i){"use strict";i.d(t,{Ao:function(){return c},Eq:function(){return I},Fb:function(){return u},K8:function(){return M},i6:function(){return R},uy:function(){return L}});var n=i(23345),r=i(82983),s=i(16925);let o=n.WE||"";const a=new Map;a.set("false",!1),a.set("true",!0),a.set("isMac",n.dz),a.set("isLinux",n.IJ),a.set("isWindows",n.ED),a.set("isWeb",n.$L),a.set("isMacNative",n.dz&&!n.$L),a.set("isEdge",o.indexOf("Edg/")>=0),a.set("isFirefox",o.indexOf("Firefox")>=0),a.set("isChrome",o.indexOf("Chrome")>=0),a.set("isSafari",o.indexOf("Safari")>=0);const l=Object.prototype.hasOwnProperty;class c{static has(e){return p.create(e)}static equals(e,t){return _.create(e,t)}static regex(e,t){return k.create(e,t)}static not(e){return y.create(e)}static and(...e){return x.create(e,null)}static or(...e){return D.create(e,null,!0)}static deserialize(e,t=!1){if(e)return this._deserializeOrExpression(e,t)}static _deserializeOrExpression(e,t){let i=e.split("||");return D.create(i.map((e=>this._deserializeAndExpression(e,t))),null,!0)}static _deserializeAndExpression(e,t){let i=e.split("&&");return x.create(i.map((e=>this._deserializeOne(e,t))),null)}static _deserializeOne(e,t){if((e=e.trim()).indexOf("!=")>=0){let i=e.split("!=");return v.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("==")>=0){let i=e.split("==");return _.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("=~")>=0){let i=e.split("=~");return k.create(i[0].trim(),this._deserializeRegexValue(i[1],t))}if(e.indexOf(" in ")>=0){let t=e.split(" in ");return g.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(e)){const t=e.split(">=");return E.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(e)){const t=e.split(">");return S.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(e)){const t=e.split("<=");return C.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(e)){const t=e.split("<");return w.create(t[0].trim(),t[1].trim())}return/^\!\s*/.test(e)?y.create(e.substr(1).trim()):p.create(e)}static _deserializeValue(e,t){if("true"===(e=e.trim()))return!0;if("false"===e)return!1;let i=/^'([^']*)'$/.exec(e);return i?i[1].trim():e}static _deserializeRegexValue(e,t){if((0,r.m5)(e)){if(t)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let i=e.indexOf("/"),n=e.lastIndexOf("/");if(i===n||i<0){if(t)throw new Error(`bad regexp-value '${e}', missing /-enclosure`);return console.warn(`bad regexp-value '${e}', missing /-enclosure`),null}let s=e.slice(i+1,n),o="i"===e[n+1]?"i":"";try{return new RegExp(s,o)}catch(i){if(t)throw new Error(`bad regexp-value '${e}', parse error: ${i}`);return console.warn(`bad regexp-value '${e}', parse error: ${i}`),null}}}function u(e,t){const i=e?e.substituteConstants():void 0,n=t?t.substituteConstants():void 0;return!i&&!n||!(!i||!n)&&i.equals(n)}function h(e,t){return e.cmp(t)}class d{constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}negate(){return f.INSTANCE}}d.INSTANCE=new d;class f{constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}negate(){return d.INSTANCE}}f.INSTANCE=new f;class p{constructor(e,t){this.key=e,this.negated=t,this.type=2}static create(e,t=null){const i=a.get(e);return"boolean"==typeof i?i?f.INSTANCE:d.INSTANCE:new p(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:P(this.key,e.key)}equals(e){return e.type===this.type&&this.key===e.key}substituteConstants(){const e=a.get(this.key);return"boolean"==typeof e?e?f.INSTANCE:d.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=y.create(this.key,this)),this.negated}}class _{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=4}static create(e,t,i=null){if("boolean"==typeof t)return t?p.create(e,i):y.create(e,i);const n=a.get(e);if("boolean"==typeof n){return t===(n?"true":"false")?f.INSTANCE:d.INSTANCE}return new _(e,t,i)}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){const e=a.get(this.key);if("boolean"==typeof e){const t=e?"true":"false";return this.value===t?f.INSTANCE:d.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=v.create(this.key,this.value,this)),this.negated}}class g{constructor(e,t){this.key=e,this.valueKey=t,this.type=10,this.negated=null}static create(e,t){return new g(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type&&(this.key===e.key&&this.valueKey===e.valueKey)}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.valueKey),i=e.getValue(this.key);return Array.isArray(t)?t.indexOf(i)>=0:"string"==typeof i&&"object"==typeof t&&null!==t&&l.call(t,i)}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=m.create(this)),this.negated}}class m{constructor(e){this._actual=e,this.type=11}static create(e){return new m(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type&&this._actual.equals(e._actual)}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class v{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=5}static create(e,t,i=null){if("boolean"==typeof t)return t?y.create(e,i):p.create(e,i);const n=a.get(e);if("boolean"==typeof n){return t===(n?"true":"false")?d.INSTANCE:f.INSTANCE}return new v(e,t,i)}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){const e=a.get(this.key);if("boolean"==typeof e){const t=e?"true":"false";return this.value===t?d.INSTANCE:f.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=_.create(this.key,this.value,this)),this.negated}}class y{constructor(e,t){this.key=e,this.negated=t,this.type=3}static create(e,t=null){const i=a.get(e);return"boolean"==typeof i?i?d.INSTANCE:f.INSTANCE:new y(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:P(this.key,e.key)}equals(e){return e.type===this.type&&this.key===e.key}substituteConstants(){const e=a.get(this.key);return"boolean"==typeof e?e?d.INSTANCE:f.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=p.create(this.key,this)),this.negated}}function b(e,t){if("string"==typeof e){const t=parseFloat(e);isNaN(t)||(e=t)}return"string"==typeof e||"number"==typeof e?t(e):d.INSTANCE}class S{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=12}static create(e,t,i=null){return b(t,(t=>new S(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=C.create(this.key,this.value,this)),this.negated}}class E{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=13}static create(e,t,i=null){return b(t,(t=>new E(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.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 w{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=14}static create(e,t,i=null){return b(t,(t=>new w(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.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 C{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=15}static create(e,t,i=null){return b(t,(t=>new C(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=S.create(this.key,this.value,this)),this.negated}}class k{constructor(e,t){this.key=e,this.regexp=t,this.type=7,this.negated=null}static create(e,t){return new k(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.key<e.key)return-1;if(this.key>e.key)return 1;const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return t<i?-1:t>i?1:0}equals(e){if(e.type===this.type){const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return this.key===e.key&&t===i}return!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.key);return!!this.regexp&&this.regexp.test(t)}serialize(){const e=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=T.create(this)),this.negated}}class T{constructor(e){this._actual=e,this.type=8}static create(e){return new T(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type&&this._actual.equals(e._actual)}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function A(e){let t=null;for(let i=0,n=e.length;i<n;i++){const n=e[i].substituteConstants();if(e[i]!==n&&null===t){t=[];for(let n=0;n<i;n++)t[n]=e[n]}null!==t&&(t[i]=n)}return null===t?e:t}class x{constructor(e,t){this.expr=e,this.negated=t,this.type=6}static create(e,t){return x._normalizeArr(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,i=this.expr.length;t<i;t++){const i=h(this.expr[t],e.expr[t]);if(0!==i)return i}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=A(this.expr);return e===this.expr?this:x.create(e,this.negated)}evaluate(e){for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].evaluate(e))return!1;return!0}static _normalizeArr(e,t){const i=[];let n=!1;for(const t of e)if(t)if(1!==t.type){if(0===t.type)return d.INSTANCE;6!==t.type?i.push(t):i.push(...t.expr)}else n=!0;if(0===i.length&&n)return f.INSTANCE;if(0!==i.length){if(1===i.length)return i[0];i.sort(h);for(let e=1;e<i.length;e++)i[e-1].equals(i[e])&&(i.splice(e,1),e--);if(1===i.length)return i[0];for(;i.length>1;){const e=i[i.length-1];if(9!==e.type)break;i.pop();const t=i.pop(),n=0===i.length,r=D.create(e.expr.map((e=>x.create([e,t],null))),null,n);r&&(i.push(r),i.sort(h))}return 1===i.length?i[0]:new x(i,t)}}serialize(){return this.expr.map((e=>e.serialize())).join(" && ")}keys(){const e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(let t of this.expr)e.push(t.negate());this.negated=D.create(e,this,!0)}return this.negated}}class D{constructor(e,t){this.expr=e,this.negated=t,this.type=9}static create(e,t,i){return D._normalizeArr(e,t,i)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,i=this.expr.length;t<i;t++){const i=h(this.expr[t],e.expr[t]);if(0!==i)return i}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=A(this.expr);return e===this.expr?this:D.create(e,this.negated,!1)}evaluate(e){for(let t=0,i=this.expr.length;t<i;t++)if(this.expr[t].evaluate(e))return!0;return!1}static _normalizeArr(e,t,i){let n=[],r=!1;if(e){for(let t=0,i=e.length;t<i;t++){const i=e[t];if(i)if(0!==i.type){if(1===i.type)return f.INSTANCE;9!==i.type?n.push(i):n=n.concat(i.expr)}else r=!0}if(0===n.length&&r)return d.INSTANCE;n.sort(h)}if(0!==n.length){if(1===n.length)return n[0];for(let e=1;e<n.length;e++)n[e-1].equals(n[e])&&(n.splice(e,1),e--);if(1===n.length)return n[0];if(i){for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++)M(n[e],n[t])&&(n.splice(t,1),t--);if(1===n.length)return n[0]}return new D(n,t)}}serialize(){return this.expr.map((e=>e.serialize())).join(" || ")}keys(){const e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());for(;e.length>1;){const t=e.shift(),i=e.shift(),n=[];for(const e of F(t))for(const t of F(i))n.push(x.create([e,t],null));const r=0===e.length;e.unshift(D.create(n,null,r))}this.negated=e[0]}return this.negated}}class L extends p{constructor(e,t,i){super(e,null),this._defaultValue=t,"object"==typeof i?L._info.push(Object.assign(Object.assign({},i),{key:e})):!0!==i&&L._info.push({key:e,description:i,type:null!=t?typeof t:void 0})}static all(){return L._info.values()}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return _.create(this.key,e)}}L._info=[];const R=(0,s.yh)("contextKeyService"),I="setContext";function P(e,t){return e<t?-1:e>t?1:0}function O(e,t,i,n){return e<i?-1:e>i?1:t<n?-1:t>n?1:0}function M(e,t){if(6===t.type&&9!==e.type&&6!==e.type)for(const i of t.expr)if(e.equals(i))return!0;const i=F(e.negate()).concat(F(t));i.sort(h);for(let e=0;e<i.length;e++){const t=i[e].negate();for(let n=e+1;n<i.length;n++){const e=i[n];if(t.equals(e))return!0}}return!1}function F(e){return 9===e.type?e.expr:[e]}},16925:function(e,t,i){"use strict";var n;i.d(t,{I8:function(){return n},TG:function(){return r},jt:function(){return a},yh:function(){return o}}),function(e){e.serviceIds=new Map,e.DI_TARGET="$di$target",e.DI_DEPENDENCIES="$di$dependencies",e.getServiceDependencies=function(t){return t[e.DI_DEPENDENCIES]||[]}}(n||(n={}));const r=o("instantiationService");function s(e,t,i,r){t[n.DI_TARGET]===t?t[n.DI_DEPENDENCIES].push({id:e,index:i,optional:r}):(t[n.DI_DEPENDENCIES]=[{id:e,index:i,optional:r}],t[n.DI_TARGET]=t)}function o(e){if(n.serviceIds.has(e))return n.serviceIds.get(e);const t=function(e,i,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");s(t,e,n,!1)};return t.toString=()=>e,n.serviceIds.set(e,t),t}function a(e){return function(t,i,n){if(3!==arguments.length)throw new Error("@optional-decorator can only be used to decorate a parameter");s(e,t,n,!0)}}},44650:function(e,t,i){"use strict";i.d(t,{B:function(){return s}});var n=i(76068),r=i(72999);const s=new class{constructor(){this.data=new Map}add(e,t){n.ok(r.HD(e)),n.ok(r.Kn(t)),n.ok(!this.data.has(e),"There is already an extension with this id"),this.data.set(e,t)}as(e){return this.data.get(e)||null}}},66213:function(e,t,i){"use strict";var n;i.d(t,{e:function(){return n}}),function(e){e.DARK="dark",e.LIGHT="light",e.HIGH_CONTRAST="hc"}(n||(n={}))},49055:function(e,t,i){"use strict";i.d(t,{EN:function(){return d},IP:function(){return p},Ic:function(){return g},XE:function(){return c},bB:function(){return m},kS:function(){return h},m6:function(){return f}});var n=i(52615),r=i(4348),s=i(69323),o=i(16925),a=i(44650),l=i(66213);const c=(0,o.yh)("themeService");var u,h;function d(e){return{id:e}}function f(e){switch(e){case l.e.DARK:return"vs-dark";case l.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}!function(e){e.isThemeColor=function(e){return e&&"object"==typeof e&&"string"==typeof e.id}}(u||(u={})),function(e){e.isThemeIcon=function(e){return e&&"object"==typeof e&&"string"==typeof e.id&&(void 0===e.color||u.isThemeColor(e.color))};const t=new RegExp(`^\\$\\((${n.dT.iconNameExpression}(?:${n.dT.iconModifierExpression})?)\\)$`);e.fromString=function(e){const i=t.exec(e);if(!i)return;let[,n]=i;return{id:n}},e.modify=function(e,t){let i=e.id;const n=i.lastIndexOf("~");return-1!==n&&(i=i.substring(0,n)),t&&(i=`${i}~${t}`),{id:i}},e.isEqual=function(e,t){var i,n;return e.id===t.id&&(null===(i=e.color)||void 0===i?void 0:i.id)===(null===(n=t.color)||void 0===n?void 0:n.id)},e.asThemeIcon=function(e,t){return{id:e.id,color:t?d(t):void 0}},e.asClassNameArray=n.dT.asClassNameArray,e.asClassName=n.dT.asClassName,e.asCSSSelector=n.dT.asCSSSelector}(h||(h={}));const p={ThemingContribution:"base.contributions.theming"};let _=new class{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new r.Q5}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),(0,s.OF)((()=>{const t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)}))}getThemingParticipants(){return this.themingParticipants}};function g(e){return _.onColorThemeChange(e)}a.B.add(p.ThemingContribution,_);class m extends s.JT{constructor(e){super(),this.themeService=e,this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange((e=>this.onThemeChange(e))))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}}},66003:function(e,t,i){"use strict";i.d(t,{Z:function(){return l}});var n=i(75931),r=i(33885),s=i(76190),o=i(59301),a=["show"];function l(e,t){return o.useMemo((function(){var i={};t&&(i.show="object"===(0,s.Z)(t)&&t.formatter?t.formatter:!!t);var o=i=(0,r.Z)((0,r.Z)({},i),e),l=o.show,c=(0,n.Z)(o,a);return(0,r.Z)((0,r.Z)({},c),{},{show:!!l,showFormatter:"function"==typeof l?l:void 0,strategy:c.strategy||function(e){return e.length}})}),[e,t])}},36901:function(e,t,i){"use strict";i.r(t),i.d(t,{BaseInput:function(){return h},default:function(){return y}});var n=i(33885),r=i(54476),s=i(20068),o=i(76190),a=i(92310),l=i.n(a),c=i(59301),u=i(30292),h=c.forwardRef((function(e,t){var i,a,h,d=e.inputElement,f=e.children,p=e.prefixCls,_=e.prefix,g=e.suffix,m=e.addonBefore,v=e.addonAfter,y=e.className,b=e.style,S=e.disabled,E=e.readOnly,w=e.focused,C=e.triggerFocus,k=e.allowClear,T=e.value,A=e.handleReset,x=e.hidden,D=e.classes,L=e.classNames,R=e.dataAttrs,I=e.styles,P=e.components,O=e.onClear,M=null!=f?f:d,F=(null==P?void 0:P.affixWrapper)||"span",B=(null==P?void 0:P.groupWrapper)||"span",N=(null==P?void 0:P.wrapper)||"span",U=(null==P?void 0:P.groupAddon)||"span",H=(0,c.useRef)(null),j=(0,u.X3)(e),$=(0,c.cloneElement)(M,{value:T,className:l()(null===(i=M.props)||void 0===i?void 0:i.className,!j&&(null==L?void 0:L.variant))||null}),G=(0,c.useRef)(null);if(c.useImperativeHandle(t,(function(){return{nativeElement:G.current||H.current}})),j){var z=null;if(k){var K=!S&&!E&&T,W="".concat(p,"-clear-icon"),q="object"===(0,o.Z)(k)&&null!=k&&k.clearIcon?k.clearIcon:"✖";z=c.createElement("button",{type:"button",tabIndex:-1,onClick:function(e){null==A||A(e),null==O||O()},onMouseDown:function(e){return e.preventDefault()},className:l()(W,(0,s.Z)((0,s.Z)({},"".concat(W,"-hidden"),!K),"".concat(W,"-has-suffix"),!!g))},q)}var V="".concat(p,"-affix-wrapper"),Y=l()(V,(0,s.Z)((0,s.Z)((0,s.Z)((0,s.Z)((0,s.Z)({},"".concat(p,"-disabled"),S),"".concat(V,"-disabled"),S),"".concat(V,"-focused"),w),"".concat(V,"-readonly"),E),"".concat(V,"-input-with-clear-btn"),g&&k&&T),null==D?void 0:D.affixWrapper,null==L?void 0:L.affixWrapper,null==L?void 0:L.variant),Z=(g||k)&&c.createElement("span",{className:l()("".concat(p,"-suffix"),null==L?void 0:L.suffix),style:null==I?void 0:I.suffix},z,g);$=c.createElement(F,(0,r.Z)({className:Y,style:null==I?void 0:I.affixWrapper,onClick:function(e){var t;null!==(t=H.current)&&void 0!==t&&t.contains(e.target)&&(null==C||C())}},null==R?void 0:R.affixWrapper,{ref:H}),_&&c.createElement("span",{className:l()("".concat(p,"-prefix"),null==L?void 0:L.prefix),style:null==I?void 0:I.prefix},_),$,Z)}if((0,u.He)(e)){var X="".concat(p,"-group"),Q="".concat(X,"-addon"),J="".concat(X,"-wrapper"),ee=l()("".concat(p,"-wrapper"),X,null==D?void 0:D.wrapper,null==L?void 0:L.wrapper),te=l()(J,(0,s.Z)({},"".concat(J,"-disabled"),S),null==D?void 0:D.group,null==L?void 0:L.groupWrapper);$=c.createElement(B,{className:te,ref:G},c.createElement(N,{className:ee},m&&c.createElement(U,{className:Q},m),$,v&&c.createElement(U,{className:Q},v)))}return c.cloneElement($,{className:l()(null===(a=$.props)||void 0===a?void 0:a.className,y)||null,style:(0,n.Z)((0,n.Z)({},null===(h=$.props)||void 0===h?void 0:h.style),b),hidden:x})})),d=i(94480),f=i(42978),p=i(75931),_=i(18929),g=i(2738),m=i(66003),v=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],y=(0,c.forwardRef)((function(e,t){var i=e.autoComplete,o=e.onChange,a=e.onFocus,y=e.onBlur,b=e.onPressEnter,S=e.onKeyDown,E=e.onKeyUp,w=e.prefixCls,C=void 0===w?"rc-input":w,k=e.disabled,T=e.htmlSize,A=e.className,x=e.maxLength,D=e.suffix,L=e.showCount,R=e.count,I=e.type,P=void 0===I?"text":I,O=e.classes,M=e.classNames,F=e.styles,B=e.onCompositionStart,N=e.onCompositionEnd,U=(0,p.Z)(e,v),H=(0,c.useState)(!1),j=(0,f.Z)(H,2),$=j[0],G=j[1],z=(0,c.useRef)(!1),K=(0,c.useRef)(!1),W=(0,c.useRef)(null),q=(0,c.useRef)(null),V=function(e){W.current&&(0,u.nH)(W.current,e)},Y=(0,_.Z)(e.defaultValue,{value:e.value}),Z=(0,f.Z)(Y,2),X=Z[0],Q=Z[1],J=null==X?"":String(X),ee=(0,c.useState)(null),te=(0,f.Z)(ee,2),ie=te[0],ne=te[1],re=(0,m.Z)(R,L),se=re.max||x,oe=re.strategy(J),ae=!!se&&oe>se;(0,c.useImperativeHandle)(t,(function(){var e;return{focus:V,blur:function(){var e;null===(e=W.current)||void 0===e||e.blur()},setSelectionRange:function(e,t,i){var n;null===(n=W.current)||void 0===n||n.setSelectionRange(e,t,i)},select:function(){var e;null===(e=W.current)||void 0===e||e.select()},input:W.current,nativeElement:(null===(e=q.current)||void 0===e?void 0:e.nativeElement)||W.current}})),(0,c.useEffect)((function(){K.current&&(K.current=!1),G((function(e){return(!e||!k)&&e}))}),[k]);var le=function(e,t,i){var n,r,s=t;if(!z.current&&re.exceedFormatter&&re.max&&re.strategy(t)>re.max)t!==(s=re.exceedFormatter(t,{max:re.max}))&&ne([(null===(n=W.current)||void 0===n?void 0:n.selectionStart)||0,(null===(r=W.current)||void 0===r?void 0:r.selectionEnd)||0]);else if("compositionEnd"===i.source)return;Q(s),W.current&&(0,u.rJ)(W.current,e,o,s)};(0,c.useEffect)((function(){var e;ie&&(null===(e=W.current)||void 0===e||e.setSelectionRange.apply(e,(0,d.Z)(ie)))}),[ie]);var ce,ue=function(e){le(e,e.target.value,{source:"change"})},he=function(e){z.current=!1,le(e,e.currentTarget.value,{source:"compositionEnd"}),null==N||N(e)},de=function(e){b&&"Enter"===e.key&&!K.current&&(K.current=!0,b(e)),null==S||S(e)},fe=function(e){"Enter"===e.key&&(K.current=!1),null==E||E(e)},pe=function(e){G(!0),null==a||a(e)},_e=function(e){K.current&&(K.current=!1),G(!1),null==y||y(e)},ge=ae&&"".concat(C,"-out-of-range");return c.createElement(h,(0,r.Z)({},U,{prefixCls:C,className:l()(A,ge),handleReset:function(e){Q(""),V(),W.current&&(0,u.rJ)(W.current,e,o)},value:J,focused:$,triggerFocus:V,suffix:function(){var e=Number(se)>0;if(D||re.show){var t=re.showFormatter?re.showFormatter({value:J,count:oe,maxLength:se}):"".concat(oe).concat(e?" / ".concat(se):"");return c.createElement(c.Fragment,null,re.show&&c.createElement("span",{className:l()("".concat(C,"-show-count-suffix"),(0,s.Z)({},"".concat(C,"-show-count-has-suffix"),!!D),null==M?void 0:M.count),style:(0,n.Z)({},null==F?void 0:F.count)},t),D)}return null}(),disabled:k,classes:O,classNames:M,styles:F}),(ce=(0,g.Z)(e,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]),c.createElement("input",(0,r.Z)({autoComplete:i},ce,{onChange:ue,onFocus:pe,onBlur:_e,onKeyDown:de,onKeyUp:fe,className:l()(C,(0,s.Z)({},"".concat(C,"-disabled"),k),null==M?void 0:M.input),style:null==F?void 0:F.input,ref:W,size:T,type:P,onCompositionStart:function(e){z.current=!0,null==B||B(e)},onCompositionEnd:he}))))}))},30292:function(e,t,i){"use strict";function n(e){return!(!e.addonBefore&&!e.addonAfter)}function r(e){return!!(e.prefix||e.suffix||e.allowClear)}function s(e,t,i){var n=t.cloneNode(!0),r=Object.create(e,{target:{value:n},currentTarget:{value:n}});return n.value=i,"number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd&&(n.selectionStart=t.selectionStart,n.selectionEnd=t.selectionEnd),n.setSelectionRange=function(){t.setSelectionRange.apply(t,arguments)},r}function o(e,t,i,n){if(i){var r=t;"click"!==t.type?"file"===e.type||void 0===n?i(r):i(r=s(t,e,n)):i(r=s(t,e,""))}}function a(e,t){if(e){e.focus(t);var i=(t||{}).cursor;if(i){var n=e.value.length;switch(i){case"start":e.setSelectionRange(0,0);break;case"end":e.setSelectionRange(n,n);break;default:e.setSelectionRange(0,n)}}}}i.d(t,{He:function(){return n},X3:function(){return r},nH:function(){return a},rJ:function(){return o}})},29301:function(e,t,i){"use strict";i.d(t,{Z:function(){return w}});var n=i(54476),r=i(59301),s=i(11592),o=(i(48736),i(33885)),a=i(76190),l=i(76846),c=i(8654),u=r.createContext(null);var h=i(76374),d=new Map;var f=new h.Z((function(e){e.forEach((function(e){var t,i=e.target;null===(t=d.get(i))||void 0===t||t.forEach((function(e){return e(i)}))}))}));var p=i(67732),_=i(83652),g=i(42403),m=i(158),v=function(e){(0,g.Z)(i,e);var t=(0,m.Z)(i);function i(){return(0,p.Z)(this,i),t.apply(this,arguments)}return(0,_.Z)(i,[{key:"render",value:function(){return this.props.children}}]),i}(r.Component);function y(e,t){var i=e.children,n=e.disabled,s=r.useRef(null),h=r.useRef(null),p=r.useContext(u),_="function"==typeof i,g=_?i(s):i,m=r.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),y=!_&&r.isValidElement(g)&&(0,c.Yr)(g),b=y?(0,c.C4)(g):null,S=(0,c.x1)(b,s),E=function(){var e;return(0,l.ZP)(s.current)||(s.current&&"object"===(0,a.Z)(s.current)?(0,l.ZP)(null===(e=s.current)||void 0===e?void 0:e.nativeElement):null)||(0,l.ZP)(h.current)};r.useImperativeHandle(t,(function(){return E()}));var w=r.useRef(e);w.current=e;var C=r.useCallback((function(e){var t=w.current,i=t.onResize,n=t.data,r=e.getBoundingClientRect(),s=r.width,a=r.height,l=e.offsetWidth,c=e.offsetHeight,u=Math.floor(s),h=Math.floor(a);if(m.current.width!==u||m.current.height!==h||m.current.offsetWidth!==l||m.current.offsetHeight!==c){var d={width:u,height:h,offsetWidth:l,offsetHeight:c};m.current=d;var f=l===Math.round(s)?s:l,_=c===Math.round(a)?a:c,g=(0,o.Z)((0,o.Z)({},d),{},{offsetWidth:f,offsetHeight:_});null==p||p(g,e,n),i&&Promise.resolve().then((function(){i(g,e)}))}}),[]);return r.useEffect((function(){var e,t,i=E();return i&&!n&&(e=i,t=C,d.has(e)||(d.set(e,new Set),f.observe(e)),d.get(e).add(t)),function(){return function(e,t){d.has(e)&&(d.get(e).delete(t),d.get(e).size||(f.unobserve(e),d.delete(e)))}(i,C)}}),[s.current,n]),r.createElement(v,{ref:h},y?r.cloneElement(g,{ref:S}):g)}var b=r.forwardRef(y);function S(e,t){var i=e.children;return("function"==typeof i?[i]:(0,s.Z)(i)).map((function(i,s){var o=(null==i?void 0:i.key)||"".concat("rc-observer-key","-").concat(s);return r.createElement(b,(0,n.Z)({},e,{key:o,ref:0===s?t:void 0}),i)}))}var E=r.forwardRef(S);E.Collection=function(e){var t=e.children,i=e.onBatchResize,n=r.useRef(0),s=r.useRef([]),o=r.useContext(u),a=r.useCallback((function(e,t,r){n.current+=1;var a=n.current;s.current.push({size:e,element:t,data:r}),Promise.resolve().then((function(){a===n.current&&(null==i||i(s.current),s.current=[])})),null==o||o(e,t,r)}),[i,o]);return r.createElement(u.Provider,{value:a},t)};var w=E},22711:function(e,t,i){"use strict";i.r(t),i.d(t,{ResizableTextArea:function(){return A},default:function(){return D}});var n,r=i(54476),s=i(20068),o=i(33885),a=i(94480),l=i(42978),c=i(75931),u=i(92310),h=i.n(u),d=i(36901),f=i(66003),p=i(30292),_=i(18929),g=i(59301),m=i(76190),v=i(29301),y=i(34280),b=i(16089),S="\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important;\n pointer-events: none !important;\n",E=["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"],w={};function C(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&w[i])return w[i];var n=window.getComputedStyle(e),r=n.getPropertyValue("box-sizing")||n.getPropertyValue("-moz-box-sizing")||n.getPropertyValue("-webkit-box-sizing"),s=parseFloat(n.getPropertyValue("padding-bottom"))+parseFloat(n.getPropertyValue("padding-top")),o=parseFloat(n.getPropertyValue("border-bottom-width"))+parseFloat(n.getPropertyValue("border-top-width")),a=E.map((function(e){return"".concat(e,":").concat(n.getPropertyValue(e))})).join(";"),l={sizingStyle:a,paddingSize:s,borderSize:o,boxSizing:r};return t&&i&&(w[i]=l),l}var k=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],T=g.forwardRef((function(e,t){var i=e,a=i.prefixCls,u=i.defaultValue,d=i.value,f=i.autoSize,p=i.onResize,E=i.className,w=i.style,T=i.disabled,A=i.onChange,x=(i.onInternalAutoSize,(0,c.Z)(i,k)),D=(0,_.Z)(u,{value:d,postState:function(e){return null!=e?e:""}}),L=(0,l.Z)(D,2),R=L[0],I=L[1],P=g.useRef();g.useImperativeHandle(t,(function(){return{textArea:P.current}}));var O=g.useMemo((function(){return f&&"object"===(0,m.Z)(f)?[f.minRows,f.maxRows]:[]}),[f]),M=(0,l.Z)(O,2),F=M[0],B=M[1],N=!!f,U=g.useState(2),H=(0,l.Z)(U,2),j=H[0],$=H[1],G=g.useState(),z=(0,l.Z)(G,2),K=z[0],W=z[1],q=function(){$(0)};(0,y.Z)((function(){N&&q()}),[d,F,B,N]),(0,y.Z)((function(){if(0===j)$(1);else if(1===j){var e=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;n||((n=document.createElement("textarea")).setAttribute("tab-index","-1"),n.setAttribute("aria-hidden","true"),n.setAttribute("name","hiddenTextarea"),document.body.appendChild(n)),e.getAttribute("wrap")?n.setAttribute("wrap",e.getAttribute("wrap")):n.removeAttribute("wrap");var s=C(e,t),o=s.paddingSize,a=s.borderSize,l=s.boxSizing,c=s.sizingStyle;n.setAttribute("style","".concat(c,";").concat(S)),n.value=e.value||e.placeholder||"";var u,h=void 0,d=void 0,f=n.scrollHeight;if("border-box"===l?f+=a:"content-box"===l&&(f-=o),null!==i||null!==r){n.value=" ";var p=n.scrollHeight-o;null!==i&&(h=p*i,"border-box"===l&&(h=h+o+a),f=Math.max(h,f)),null!==r&&(d=p*r,"border-box"===l&&(d=d+o+a),u=f>d?"":"hidden",f=Math.min(d,f))}var _={height:f,overflowY:u,resize:"none"};return h&&(_.minHeight=h),d&&(_.maxHeight=d),_}(P.current,!1,F,B);$(2),W(e)}else!function(){try{if(document.activeElement===P.current){var e=P.current,t=e.selectionStart,i=e.selectionEnd,n=e.scrollTop;P.current.setSelectionRange(t,i),P.current.scrollTop=n}}catch(e){}}()}),[j]);var V=g.useRef(),Y=function(){b.Z.cancel(V.current)};g.useEffect((function(){return Y}),[]);var Z=N?K:null,X=(0,o.Z)((0,o.Z)({},w),Z);return 0!==j&&1!==j||(X.overflowY="hidden",X.overflowX="hidden"),g.createElement(v.Z,{onResize:function(e){2===j&&(null==p||p(e),f&&(Y(),V.current=(0,b.Z)((function(){q()}))))},disabled:!(f||p)},g.createElement("textarea",(0,r.Z)({},x,{ref:P,style:X,className:h()(a,E,(0,s.Z)({},"".concat(a,"-disabled"),T)),disabled:T,value:R,onChange:function(e){I(e.target.value),null==A||A(e)}})))})),A=T,x=["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"],D=g.forwardRef((function(e,t){var i,n=e.defaultValue,u=e.value,m=e.onFocus,v=e.onBlur,y=e.onChange,b=e.allowClear,S=e.maxLength,E=e.onCompositionStart,w=e.onCompositionEnd,C=e.suffix,k=e.prefixCls,T=void 0===k?"rc-textarea":k,D=e.showCount,L=e.count,R=e.className,I=e.style,P=e.disabled,O=e.hidden,M=e.classNames,F=e.styles,B=e.onResize,N=e.onClear,U=e.onPressEnter,H=e.readOnly,j=e.autoSize,$=e.onKeyDown,G=(0,c.Z)(e,x),z=(0,_.Z)(n,{value:u,defaultValue:n}),K=(0,l.Z)(z,2),W=K[0],q=K[1],V=null==W?"":String(W),Y=g.useState(!1),Z=(0,l.Z)(Y,2),X=Z[0],Q=Z[1],J=g.useRef(!1),ee=g.useState(null),te=(0,l.Z)(ee,2),ie=te[0],ne=te[1],re=(0,g.useRef)(null),se=(0,g.useRef)(null),oe=function(){var e;return null===(e=se.current)||void 0===e?void 0:e.textArea},ae=function(){oe().focus()};(0,g.useImperativeHandle)(t,(function(){var e;return{resizableTextArea:se.current,focus:ae,blur:function(){oe().blur()},nativeElement:(null===(e=re.current)||void 0===e?void 0:e.nativeElement)||oe()}})),(0,g.useEffect)((function(){Q((function(e){return!P&&e}))}),[P]);var le=g.useState(null),ce=(0,l.Z)(le,2),ue=ce[0],he=ce[1];g.useEffect((function(){var e;ue&&(e=oe()).setSelectionRange.apply(e,(0,a.Z)(ue))}),[ue]);var de,fe=(0,f.Z)(L,D),pe=null!==(i=fe.max)&&void 0!==i?i:S,_e=Number(pe)>0,ge=fe.strategy(V),me=!!pe&&ge>pe,ve=function(e,t){var i=t;!J.current&&fe.exceedFormatter&&fe.max&&fe.strategy(t)>fe.max&&t!==(i=fe.exceedFormatter(t,{max:fe.max}))&&he([oe().selectionStart||0,oe().selectionEnd||0]),q(i),(0,p.rJ)(e.currentTarget,e,y,i)},ye=C;fe.show&&(de=fe.showFormatter?fe.showFormatter({value:V,count:ge,maxLength:pe}):"".concat(ge).concat(_e?" / ".concat(pe):""),ye=g.createElement(g.Fragment,null,ye,g.createElement("span",{className:h()("".concat(T,"-data-count"),null==M?void 0:M.count),style:null==F?void 0:F.count},de)));var be=!j&&!D&&!b;return g.createElement(d.BaseInput,{ref:re,value:V,allowClear:b,handleReset:function(e){q(""),ae(),(0,p.rJ)(oe(),e,y)},suffix:ye,prefixCls:T,classNames:(0,o.Z)((0,o.Z)({},M),{},{affixWrapper:h()(null==M?void 0:M.affixWrapper,(0,s.Z)((0,s.Z)({},"".concat(T,"-show-count"),D),"".concat(T,"-textarea-allow-clear"),b))}),disabled:P,focused:X,className:h()(R,me&&"".concat(T,"-out-of-range")),style:(0,o.Z)((0,o.Z)({},I),ie&&!be?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":"string"==typeof de?de:void 0}},hidden:O,readOnly:H,onClear:N},g.createElement(A,(0,r.Z)({},G,{autoSize:j,maxLength:S,onKeyDown:function(e){"Enter"===e.key&&U&&U(e),null==$||$(e)},onChange:function(e){ve(e,e.target.value)},onFocus:function(e){Q(!0),null==m||m(e)},onBlur:function(e){Q(!1),null==v||v(e)},onCompositionStart:function(e){J.current=!0,null==E||E(e)},onCompositionEnd:function(e){J.current=!1,ve(e,e.currentTarget.value),null==w||w(e)},className:h()(null==M?void 0:M.textarea),style:(0,o.Z)((0,o.Z)({},null==F?void 0:F.textarea),{},{resize:null==I?void 0:I.resize}),disabled:P,prefixCls:T,onResize:function(e){var t;null==B||B(e),null!==(t=oe())&&void 0!==t&&t.style.height&&ne(!0)},ref:se,readOnly:H})))}))},29125:function(e,t,i){"use strict";i.d(t,{G:function(){return o},Z:function(){return v}});var n=i(92310),r=i.n(n),s=i(59301);function o(e){var t=e.children,i=e.prefixCls,n=e.id,o=e.overlayInnerStyle,a=e.bodyClassName,l=e.className,c=e.style;return s.createElement("div",{className:r()("".concat(i,"-content"),l),style:c},s.createElement("div",{className:r()("".concat(i,"-inner"),a),id:n,role:"tooltip",style:o},"function"==typeof t?t():t))}var a=i(54476),l=i(33885),c=i(75931),u=i(65030),h={shiftX:64,adjustY:1},d={adjustX:1,shiftY:!0},f=[0,0],p={left:{points:["cr","cl"],overflow:d,offset:[-4,0],targetOffset:f},right:{points:["cl","cr"],overflow:d,offset:[4,0],targetOffset:f},top:{points:["bc","tc"],overflow:h,offset:[0,-4],targetOffset:f},bottom:{points:["tc","bc"],overflow:h,offset:[0,4],targetOffset:f},topLeft:{points:["bl","tl"],overflow:h,offset:[0,-4],targetOffset:f},leftTop:{points:["tr","tl"],overflow:d,offset:[-4,0],targetOffset:f},topRight:{points:["br","tr"],overflow:h,offset:[0,-4],targetOffset:f},rightTop:{points:["tl","tr"],overflow:d,offset:[4,0],targetOffset:f},bottomRight:{points:["tr","br"],overflow:h,offset:[0,4],targetOffset:f},rightBottom:{points:["bl","br"],overflow:d,offset:[4,0],targetOffset:f},bottomLeft:{points:["tl","bl"],overflow:h,offset:[0,4],targetOffset:f},leftBottom:{points:["br","bl"],overflow:d,offset:[-4,0],targetOffset:f}},_=i(80402),g=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],m=function(e,t){var i=e.overlayClassName,n=e.trigger,h=void 0===n?["hover"]:n,d=e.mouseEnterDelay,f=void 0===d?0:d,m=e.mouseLeaveDelay,v=void 0===m?.1:m,y=e.overlayStyle,b=e.prefixCls,S=void 0===b?"rc-tooltip":b,E=e.children,w=e.onVisibleChange,C=e.afterVisibleChange,k=e.transitionName,T=e.animation,A=e.motion,x=e.placement,D=void 0===x?"right":x,L=e.align,R=void 0===L?{}:L,I=e.destroyTooltipOnHide,P=void 0!==I&&I,O=e.defaultVisible,M=e.getTooltipContainer,F=e.overlayInnerStyle,B=(e.arrowContent,e.overlay),N=e.id,U=e.showArrow,H=void 0===U||U,j=e.classNames,$=e.styles,G=(0,c.Z)(e,g),z=(0,_.Z)(N),K=(0,s.useRef)(null);(0,s.useImperativeHandle)(t,(function(){return K.current}));var W=(0,l.Z)({},G);"visible"in e&&(W.popupVisible=e.visible);var q,V,Y;return s.createElement(u.Z,(0,a.Z)({popupClassName:r()(i,null==j?void 0:j.root),prefixCls:S,popup:function(){return s.createElement(o,{key:"content",prefixCls:S,id:z,bodyClassName:null==j?void 0:j.body,overlayInnerStyle:(0,l.Z)((0,l.Z)({},F),null==$?void 0:$.body)},B)},action:h,builtinPlacements:p,popupPlacement:D,ref:K,popupAlign:R,getPopupContainer:M,onPopupVisibleChange:w,afterPopupVisibleChange:C,popupTransitionName:k,popupAnimation:T,popupMotion:A,defaultPopupVisible:O,autoDestroy:P,mouseLeaveDelay:v,popupStyle:(0,l.Z)((0,l.Z)({},y),null==$?void 0:$.root),mouseEnterDelay:f,arrow:H},W),(q=s.Children.only(E),V=(null==q?void 0:q.props)||{},Y=(0,l.Z)((0,l.Z)({},V),{},{"aria-describedby":B?z:null}),s.cloneElement(E,Y)))},v=(0,s.forwardRef)(m)},49658:function(e,t){"use strict";t.Z=function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var e=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(e)||/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(null==e?void 0:e.substr(0,4))}},83145:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CopyToClipboard=void 0;var n=s(i(59301)),r=s(i(25769));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function l(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?f(e):t}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function _(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var g=function(e){function t(){var e,i;c(this,t);for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];return _(f(i=h(this,(e=d(t)).call.apply(e,[this].concat(o)))),"onClick",(function(e){var t=i.props,s=t.text,o=t.onCopy,a=t.children,l=t.options,c=n.default.Children.only(a),u=(0,r.default)(s,l);o&&o(s,u),c&&c.props&&"function"==typeof c.props.onClick&&c.props.onClick(e)})),i}var i,s,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(t,e),i=t,s=[{key:"render",value:function(){var e=this.props,t=(e.text,e.onCopy,e.options,e.children),i=l(e,["text","onCopy","options","children"]),r=n.default.Children.only(t);return n.default.cloneElement(r,function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a(i,!0).forEach((function(t){_(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a(i).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},i,{onClick:this.onClick}))}}],s&&u(i.prototype,s),o&&u(i,o),t}(n.default.PureComponent);t.CopyToClipboard=g,_(g,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(e,t,i){"use strict";var n=i(83145).CopyToClipboard;n.CopyToClipboard=n,e.exports=n},76374:function(e,t,i){"use strict";var n=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var i=-1;return e.some((function(e,n){return e[0]===t&&(i=n,!0)})),i}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var i=e(this.__entries__,t),n=this.__entries__[i];return n&&n[1]},t.prototype.set=function(t,i){var n=e(this.__entries__,t);~n?this.__entries__[n][1]=i:this.__entries__.push([t,i])},t.prototype.delete=function(t){var i=this.__entries__,n=e(i,t);~n&&i.splice(n,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var i=0,n=this.__entries__;i<n.length;i++){var r=n[i];e.call(t,r[1],r[0])}},t}()}(),r="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,s=void 0!==i.g&&i.g.Math===Math?i.g:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),o="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(s):function(e){return setTimeout((function(){return e(Date.now())}),1e3/60)};var a=["top","right","bottom","left","width","height","size","weight"],l="undefined"!=typeof MutationObserver,c=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var i=!1,n=!1,r=0;function s(){i&&(i=!1,e()),n&&l()}function a(){o(s)}function l(){var e=Date.now();if(i){if(e-r<2)return;n=!0}else i=!0,n=!1,setTimeout(a,t);r=e}return l}(this.refresh.bind(this),20)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,i=t.indexOf(e);~i&&t.splice(i,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter((function(e){return e.gatherActive(),e.hasActive()}));return e.forEach((function(e){return e.broadcastActive()})),e.length>0},e.prototype.connect_=function(){r&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),l?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){r&&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)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,i=void 0===t?"":t;a.some((function(e){return!!~i.indexOf(e)}))&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),u=function(e,t){for(var i=0,n=Object.keys(t);i<n.length;i++){var r=n[i];Object.defineProperty(e,r,{value:t[r],enumerable:!1,writable:!1,configurable:!0})}return e},h=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||s},d=v(0,0,0,0);function f(e){return parseFloat(e)||0}function p(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return t.reduce((function(t,i){return t+f(e["border-"+i+"-width"])}),0)}function _(e){var t=e.clientWidth,i=e.clientHeight;if(!t&&!i)return d;var n=h(e).getComputedStyle(e),r=function(e){for(var t={},i=0,n=["top","right","bottom","left"];i<n.length;i++){var r=n[i],s=e["padding-"+r];t[r]=f(s)}return t}(n),s=r.left+r.right,o=r.top+r.bottom,a=f(n.width),l=f(n.height);if("border-box"===n.boxSizing&&(Math.round(a+s)!==t&&(a-=p(n,"left","right")+s),Math.round(l+o)!==i&&(l-=p(n,"top","bottom")+o)),!function(e){return e===h(e).document.documentElement}(e)){var c=Math.round(a+s)-t,u=Math.round(l+o)-i;1!==Math.abs(c)&&(a-=c),1!==Math.abs(u)&&(l-=u)}return v(r.left,r.top,a,l)}var g="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof h(e).SVGGraphicsElement}:function(e){return e instanceof h(e).SVGElement&&"function"==typeof e.getBBox};function m(e){return r?g(e)?function(e){var t=e.getBBox();return v(0,0,t.width,t.height)}(e):_(e):d}function v(e,t,i,n){return{x:e,y:t,width:i,height:n}}var y=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=v(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=m(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),b=function(e,t){var i,n,r,s,o,a,l,c=(n=(i=t).x,r=i.y,s=i.width,o=i.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(a.prototype),u(l,{x:n,y:r,width:s,height:o,top:r,right:n+s,bottom:o+r,left:n}),l);u(this,{target:e,contentRect:c})},S=function(){function e(e,t,i){if(this.activeObservations_=[],this.observations_=new n,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=i}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof h(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new y(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof h(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach((function(t){t.isActive()&&e.activeObservations_.push(t)}))},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map((function(e){return new b(e.target,e.broadcastRect())}));this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),E="undefined"!=typeof WeakMap?new WeakMap:new n,w=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=c.getInstance(),n=new S(t,i,this);E.set(this,n)};["observe","unobserve","disconnect"].forEach((function(e){w.prototype[e]=function(){var t;return(t=E.get(this))[e].apply(t,arguments)}}));var C=void 0!==s.ResizeObserver?s.ResizeObserver:w;t.Z=C},98040:function(e){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,i=[],n=0;n<e.rangeCount;n++)i.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||i.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},34376:function(e){window,e.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=34)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0;var n=function(){function e(){this._listeners=[],this._disposed=!1}return Object.defineProperty(e.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(t){return e._listeners.push(t),{dispose:function(){if(!e._disposed)for(var i=0;i<e._listeners.length;i++)if(e._listeners[i]===t)return void e._listeners.splice(i,1)}}}),this._event},enumerable:!1,configurable:!0}),e.prototype.fire=function(e,t){for(var i=[],n=0;n<this._listeners.length;n++)i.push(this._listeners[n]);for(n=0;n<i.length;n++)i[n].call(void 0,e,t)},e.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},e}();t.EventEmitter=n,t.forwardEvent=function(e,t){return e((function(e){return t.fire(e)}))}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IUnicodeService=t.IOptionsService=t.ILogService=t.IInstantiationService=t.IDirtyRowService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;var n=i(14);t.IBufferService=n.createDecorator("BufferService"),t.ICoreMouseService=n.createDecorator("CoreMouseService"),t.ICoreService=n.createDecorator("CoreService"),t.ICharsetService=n.createDecorator("CharsetService"),t.IDirtyRowService=n.createDecorator("DirtyRowService"),t.IInstantiationService=n.createDecorator("InstantiationService"),t.ILogService=n.createDecorator("LogService"),t.IOptionsService=n.createDecorator("OptionsService"),t.IUnicodeService=n.createDecorator("UnicodeService")},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.Disposable=void 0;var n=function(){function e(){this._disposables=[],this._isDisposed=!1}return e.prototype.dispose=function(){this._isDisposed=!0;for(var e=0,t=this._disposables;e<t.length;e++)t[e].dispose();this._disposables.length=0},e.prototype.register=function(e){return this._disposables.push(e),e},e.prototype.unregister=function(e){var t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)},e}();function r(e){for(var t=0,i=e;t<i.length;t++)i[t].dispose();e.length=0}t.Disposable=n,t.disposeArray=r,t.getDisposeArrayDisposable=function(e){return{dispose:function(){return r(e)}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=256,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;var s=i(8),o=i(3),a=i(6),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.content=0,t.fg=0,t.bg=0,t.extended=new a.ExtendedAttrs,t.combinedData="",t}return r(t,e),t.fromCharData=function(e){var i=new t;return i.setFromCharData(e),i},t.prototype.isCombined=function(){return 2097152&this.content},t.prototype.getWidth=function(){return this.content>>22},t.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?s.stringFromCodePoint(2097151&this.content):""},t.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},t.prototype.setFromCharData=function(e){this.fg=e[o.CHAR_DATA_ATTR_INDEX],this.bg=0;var t=!1;if(e[o.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[o.CHAR_DATA_CHAR_INDEX].length){var i=e[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){var n=e[o.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(i-55296)+n-56320+65536|e[o.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[o.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[o.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[o.CHAR_DATA_WIDTH_INDEX]<<22)},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(a.AttributeData);t.CellData=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ISoundService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;var n=i(14);t.ICharSizeService=n.createDecorator("CharSizeService"),t.ICoreBrowserService=n.createDecorator("CoreBrowserService"),t.IMouseService=n.createDecorator("MouseService"),t.IRenderService=n.createDecorator("RenderService"),t.ISelectionService=n.createDecorator("SelectionService"),t.ISoundService=n.createDecorator("SoundService")},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;var n=function(){function e(){this.fg=0,this.bg=0,this.extended=new r}return e.toColorRGB=function(e){return[e>>>16&255,e>>>8&255,255&e]},e.fromColorRGB=function(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},e.prototype.clone=function(){var t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t},e.prototype.isInverse=function(){return 67108864&this.fg},e.prototype.isBold=function(){return 134217728&this.fg},e.prototype.isUnderline=function(){return 268435456&this.fg},e.prototype.isBlink=function(){return 536870912&this.fg},e.prototype.isInvisible=function(){return 1073741824&this.fg},e.prototype.isItalic=function(){return 67108864&this.bg},e.prototype.isDim=function(){return 134217728&this.bg},e.prototype.getFgColorMode=function(){return 50331648&this.fg},e.prototype.getBgColorMode=function(){return 50331648&this.bg},e.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},e.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},e.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},e.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},e.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},e.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},e.prototype.isAttributeDefault=function(){return 0===this.fg&&0===this.bg},e.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},e.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},e.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},e.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},e.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()},e.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},e.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()},e.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()},e.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()},e.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},e}();t.AttributeData=n;var r=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=-1),this.underlineStyle=e,this.underlineColor=t}return e.prototype.clone=function(){return new e(this.underlineStyle,this.underlineColor)},e.prototype.isEmpty=function(){return 0===this.underlineStyle},e}();t.ExtendedAttrs=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,i,n){e.addEventListener(t,i,n);var r=!1;return{dispose:function(){r||(r=!0,e.removeEventListener(t,i,n))}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=e.length);for(var n="",r=t;r<i;++r){var s=e[r];s>65535?(s-=65536,n+=String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):n+=String.fromCharCode(s)}return n};var n=function(){function e(){this._interim=0}return e.prototype.clear=function(){this._interim=0},e.prototype.decode=function(e,t){var i=e.length;if(!i)return 0;var n=0,r=0;this._interim&&(56320<=(a=e.charCodeAt(r++))&&a<=57343?t[n++]=1024*(this._interim-55296)+a-56320+65536:(t[n++]=this._interim,t[n++]=a),this._interim=0);for(var s=r;s<i;++s){var o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return this._interim=o,n;var a;56320<=(a=e.charCodeAt(s))&&a<=57343?t[n++]=1024*(o-55296)+a-56320+65536:(t[n++]=o,t[n++]=a)}else t[n++]=o}return n},e}();t.StringToUtf32=n;var r=function(){function e(){this.interim=new Uint8Array(3)}return e.prototype.clear=function(){this.interim.fill(0)},e.prototype.decode=function(e,t){var i=e.length;if(!i)return 0;var n,r,s,o,a=0,l=0,c=0;if(this.interim[0]){var u=!1,h=this.interim[0];h&=192==(224&h)?31:224==(240&h)?15:7;for(var d=0,f=void 0;(f=63&this.interim[++d])&&d<4;)h<<=6,h|=f;for(var p=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,_=p-d;c<_;){if(c>=i)return 0;if(128!=(192&(f=e[c++]))){c--,u=!0;break}this.interim[d++]=f,h<<=6,h|=63&f}u||(2===p?h<128?c--:t[a++]=h:3===p?h<2048||h>=55296&&h<=57343||(t[a++]=h):h<65536||h>1114111||(t[a++]=h)),this.interim.fill(0)}for(var g=i-4,m=c;m<i;){for(;!(!(m<g)||128&(n=e[m])||128&(r=e[m+1])||128&(s=e[m+2])||128&(o=e[m+3]));)t[a++]=n,t[a++]=r,t[a++]=s,t[a++]=o,m+=4;if((n=e[m++])<128)t[a++]=n;else if(192==(224&n)){if(m>=i)return this.interim[0]=n,a;if(128!=(192&(r=e[m++]))){m--;continue}if((l=(31&n)<<6|63&r)<128){m--;continue}t[a++]=l}else if(224==(240&n)){if(m>=i)return this.interim[0]=n,a;if(128!=(192&(r=e[m++]))){m--;continue}if(m>=i)return this.interim[0]=n,this.interim[1]=r,a;if(128!=(192&(s=e[m++]))){m--;continue}if((l=(15&n)<<12|(63&r)<<6|63&s)<2048||l>=55296&&l<=57343)continue;t[a++]=l}else if(240==(248&n)){if(m>=i)return this.interim[0]=n,a;if(128!=(192&(r=e[m++]))){m--;continue}if(m>=i)return this.interim[0]=n,this.interim[1]=r,a;if(128!=(192&(s=e[m++]))){m--;continue}if(m>=i)return this.interim[0]=n,this.interim[1]=r,this.interim[2]=s,a;if(128!=(192&(o=e[m++]))){m--;continue}if((l=(7&n)<<18|(63&r)<<12|(63&s)<<6|63&o)<65536||l>1114111)continue;t[a++]=l}}return a},e}();t.Utf8ToUtf32=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR_ATLAS_CELL_SPACING=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0,t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.CHAR_ATLAS_CELL_SPACING=1},function(e,t,i){"use strict";var n,r,s,o;function a(e){var t=e.toString(16);return t.length<2?"0"+t:t}function l(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=void 0,function(e){e.toCss=function(e,t,i,n){return void 0!==n?"#"+a(e)+a(t)+a(i)+a(n):"#"+a(e)+a(t)+a(i)},e.toRgba=function(e,t,i,n){return void 0===n&&(n=255),(e<<24|t<<16|i<<8|n)>>>0}}(n=t.channels||(t.channels={})),(r=t.color||(t.color={})).blend=function(e,t){var i=(255&t.rgba)/255;if(1===i)return{css:t.css,rgba:t.rgba};var r=t.rgba>>24&255,s=t.rgba>>16&255,o=t.rgba>>8&255,a=e.rgba>>24&255,l=e.rgba>>16&255,c=e.rgba>>8&255,u=a+Math.round((r-a)*i),h=l+Math.round((s-l)*i),d=c+Math.round((o-c)*i);return{css:n.toCss(u,h,d),rgba:n.toRgba(u,h,d)}},r.isOpaque=function(e){return 255==(255&e.rgba)},r.ensureContrastRatio=function(e,t,i){var n=o.ensureContrastRatio(e.rgba,t.rgba,i);if(n)return o.toColor(n>>24&255,n>>16&255,n>>8&255)},r.opaque=function(e){var t=(255|e.rgba)>>>0,i=o.toChannels(t),r=i[0],s=i[1],a=i[2];return{css:n.toCss(r,s,a),rgba:t}},r.opacity=function(e,t){var i=Math.round(255*t),r=o.toChannels(e.rgba),s=r[0],a=r[1],l=r[2];return{css:n.toCss(s,a,l,i),rgba:n.toRgba(s,a,l,i)}},(t.css||(t.css={})).toColor=function(e){switch(e.length){case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(e){function t(e,t,i){var n=e/255,r=t/255,s=i/255;return.2126*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(s=t.rgb||(t.rgb={})),function(e){function t(e,t,i){for(var n=e>>24&255,r=e>>16&255,o=e>>8&255,a=t>>24&255,c=t>>16&255,u=t>>8&255,h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(n,r,o));h<i&&(a>0||c>0||u>0);)a-=Math.max(0,Math.ceil(.1*a)),c-=Math.max(0,Math.ceil(.1*c)),u-=Math.max(0,Math.ceil(.1*u)),h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(n,r,o));return(a<<24|c<<16|u<<8|255)>>>0}function i(e,t,i){for(var n=e>>24&255,r=e>>16&255,o=e>>8&255,a=t>>24&255,c=t>>16&255,u=t>>8&255,h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(n,r,o));h<i&&(a<255||c<255||u<255);)a=Math.min(255,a+Math.ceil(.1*(255-a))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=Math.min(255,u+Math.ceil(.1*(255-u))),h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(n,r,o));return(a<<24|c<<16|u<<8|255)>>>0}e.ensureContrastRatio=function(e,n,r){var o=s.relativeLuminance(e>>8),a=s.relativeLuminance(n>>8);if(l(o,a)<r)return a<o?t(e,n,r):i(e,n,r)},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,i){return{css:n.toCss(e,t,i),rgba:n.toRgba(e,t,i)}}}(o=t.rgba||(t.rgba={})),t.toPaddedHex=a,t.contrastRatio=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.isSafari=t.isFirefox=void 0;var n="undefined"==typeof navigator,r=n?"node":navigator.userAgent,s=n?"node":navigator.platform;function o(e,t){return e.indexOf(t)>=0}t.isFirefox=!!~r.indexOf("Firefox"),t.isSafari=/^((?!chrome|android).)*safari/i.test(r),t.isMac=o(["Macintosh","MacIntel","MacPPC","Mac68K"],s),t.isIpad="iPad"===s,t.isIphone="iPhone"===s,t.isWindows=o(["Windows","Win16","Win32","WinCE"],s),t.isLinux=s.indexOf("Linux")>=0},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.C1=t.C0=void 0,function(e){e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="",e.BS="\b",e.HT="\t",e.LF="\n",e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""}(t.C0||(t.C0={})),function(e){e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"}(t.C1||(t.C1={}))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;var n=i(3),r=i(9),s=i(25),o=i(6),a=i(28),l=i(10),c=i(17),u=function(){function e(e,t,i,n,r,s,o,a){this._container=e,this._alpha=n,this._colors=r,this._rendererId=s,this._bufferService=o,this._optionsService=a,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-"+t+"-layer"),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return e.prototype.dispose=function(){var e;c.removeElementFromParent(this._canvas),null===(e=this._charAtlas)||void 0===e||e.dispose()},e.prototype._initCanvas=function(){this._ctx=a.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},e.prototype.onOptionsChanged=function(){},e.prototype.onBlur=function(){},e.prototype.onFocus=function(){},e.prototype.onCursorMove=function(){},e.prototype.onGridChanged=function(e,t){},e.prototype.onSelectionChanged=function(e,t,i){void 0===i&&(i=!1)},e.prototype.setColors=function(e){this._refreshCharAtlas(e)},e.prototype._setTransparency=function(e){if(e!==this._alpha){var t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},e.prototype._refreshCharAtlas=function(e){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=s.acquireCharAtlas(this._optionsService.options,this._rendererId,e,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},e.prototype.resize=function(e){this._scaledCellWidth=e.scaledCellWidth,this._scaledCellHeight=e.scaledCellHeight,this._scaledCharWidth=e.scaledCharWidth,this._scaledCharHeight=e.scaledCharHeight,this._scaledCharLeft=e.scaledCharLeft,this._scaledCharTop=e.scaledCharTop,this._canvas.width=e.scaledCanvasWidth,this._canvas.height=e.scaledCanvasHeight,this._canvas.style.width=e.canvasWidth+"px",this._canvas.style.height=e.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},e.prototype._fillCells=function(e,t,i,n){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,i*this._scaledCellWidth,n*this._scaledCellHeight)},e.prototype._fillBottomLineAtCells=function(e,t,i){void 0===i&&(i=1),this._ctx.fillRect(e*this._scaledCellWidth,(t+1)*this._scaledCellHeight-window.devicePixelRatio-1,i*this._scaledCellWidth,window.devicePixelRatio)},e.prototype._fillLeftLineAtCell=function(e,t,i){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,window.devicePixelRatio*i,this._scaledCellHeight)},e.prototype._strokeRectAtCell=function(e,t,i,n){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(e*this._scaledCellWidth+window.devicePixelRatio/2,t*this._scaledCellHeight+window.devicePixelRatio/2,i*this._scaledCellWidth-window.devicePixelRatio,n*this._scaledCellHeight-window.devicePixelRatio)},e.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))},e.prototype._clearCells=function(e,t,i,n){this._alpha?this._ctx.clearRect(e*this._scaledCellWidth,t*this._scaledCellHeight,i*this._scaledCellWidth,n*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,i*this._scaledCellWidth,n*this._scaledCellHeight))},e.prototype._fillCharTrueColor=function(e,t,i){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(i),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},e.prototype._drawChars=function(e,t,i){var s,o,a=this._getContrastColor(e);a||e.isFgRGB()||e.isBgRGB()?this._drawUncachedChars(e,t,i,a):(e.isInverse()?(s=e.isBgDefault()?r.INVERTED_DEFAULT_COLOR:e.getBgColor(),o=e.isFgDefault()?r.INVERTED_DEFAULT_COLOR:e.getFgColor()):(o=e.isBgDefault()?n.DEFAULT_COLOR:e.getBgColor(),s=e.isFgDefault()?n.DEFAULT_COLOR:e.getFgColor()),s+=this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&s<8?8:0,this._currentGlyphIdentifier.chars=e.getChars()||n.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||n.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=o,this._currentGlyphIdentifier.fg=s,this._currentGlyphIdentifier.bold=!!e.isBold(),this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,t*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(e,t,i))},e.prototype._drawUncachedChars=function(e,t,i,n){if(this._ctx.save(),this._ctx.font=this._getFont(!!e.isBold(),!!e.isItalic()),this._ctx.textBaseline="middle",e.isInverse())if(n)this._ctx.fillStyle=n.css;else if(e.isBgDefault())this._ctx.fillStyle=l.color.opaque(this._colors.background).css;else if(e.isBgRGB())this._ctx.fillStyle="rgb("+o.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var s=e.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&s<8&&(s+=8),this._ctx.fillStyle=this._colors.ansi[s].css}else if(n)this._ctx.fillStyle=n.css;else if(e.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(e.isFgRGB())this._ctx.fillStyle="rgb("+o.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var a=e.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&a<8&&(a+=8),this._ctx.fillStyle=this._colors.ansi[a].css}this._clipRow(i),e.isDim()&&(this._ctx.globalAlpha=r.DIM_OPACITY),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},e.prototype._clipRow=function(e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},e.prototype._getFont=function(e,t){return(t?"italic":"")+" "+(e?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},e.prototype._getContrastColor=function(e){if(1!==this._optionsService.options.minimumContrastRatio){var t=this._colors.contrastCache.getColor(e.bg,e.fg);if(void 0!==t)return t||void 0;var i=e.getFgColor(),n=e.getFgColorMode(),r=e.getBgColor(),s=e.getBgColorMode(),o=!!e.isInverse(),a=!!e.isInverse();if(o){var c=i;i=r,r=c;var u=n;n=s,s=u}var h=this._resolveBackgroundRgba(s,r,o),d=this._resolveForegroundRgba(n,i,o,a),f=l.rgba.ensureContrastRatio(h,d,this._optionsService.options.minimumContrastRatio);if(f){var p={css:l.channels.toCss(f>>24&255,f>>16&255,f>>8&255),rgba:f};return this._colors.contrastCache.setColor(e.bg,e.fg,p),p}this._colors.contrastCache.setColor(e.bg,e.fg,null)}},e.prototype._resolveBackgroundRgba=function(e,t,i){switch(e){case 16777216:case 33554432:return this._colors.ansi[t].rgba;case 50331648:return t<<8;default:return i?this._colors.foreground.rgba:this._colors.background.rgba}},e.prototype._resolveForegroundRgba=function(e,t,i,n){switch(e){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&n&&t<8&&(t+=8),this._colors.ansi[t].rgba;case 50331648:return t<<8;default:return i?this._colors.background.rgba:this._colors.foreground.rgba}},e}();t.BaseRenderLayer=u},function(e,t,i){"use strict";function n(e,t,i){t.di$target===t?t.di$dependencies.push({id:e,index:i}):(t.di$dependencies=[{id:e,index:i}],t.di$target=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0,t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e.di$dependencies||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);var i=function(e,t,r){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");n(i,e,r)};return i.toString=function(){return e},t.serviceRegistry.set(e,i),i}},function(e,t,i){"use strict";function n(e,t,i,n){if(void 0===i&&(i=0),void 0===n&&(n=e.length),i>=e.length)return e;i=(e.length+i)%e.length,n=n>=e.length?e.length:(e.length+n)%e.length;for(var r=i;r<n;++r)e[r]=t;return e}Object.defineProperty(t,"__esModule",{value:!0}),t.concat=t.fillFallback=t.fill=void 0,t.fill=function(e,t,i,r){return e.fill?e.fill(t,i,r):n(e,t,i,r)},t.fillFallback=n,t.concat=function(e,t){var i=new e.constructor(e.length+t.length);return i.set(e),i.set(t,e.length),i}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;var n=i(8),r=i(3),s=i(4),o=i(6);t.DEFAULT_ATTR_DATA=Object.freeze(new o.AttributeData);var a=function(){function e(e,t,i){void 0===i&&(i=!1),this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);for(var n=t||s.CellData.fromCharData([0,r.NULL_CELL_CHAR,r.NULL_CELL_WIDTH,r.NULL_CELL_CODE]),o=0;o<e;++o)this.setCell(o,n);this.length=e}return e.prototype.get=function(e){var t=this._data[3*e+0],i=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:i?n.stringFromCodePoint(i):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]},e.prototype.set=function(e,t){this._data[3*e+1]=t[r.CHAR_DATA_ATTR_INDEX],t[r.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[r.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[r.CHAR_DATA_WIDTH_INDEX]<<22},e.prototype.getWidth=function(e){return this._data[3*e+0]>>22},e.prototype.hasWidth=function(e){return 12582912&this._data[3*e+0]},e.prototype.getFg=function(e){return this._data[3*e+1]},e.prototype.getBg=function(e){return this._data[3*e+2]},e.prototype.hasContent=function(e){return 4194303&this._data[3*e+0]},e.prototype.getCodePoint=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t},e.prototype.isCombined=function(e){return 2097152&this._data[3*e+0]},e.prototype.getString=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?n.stringFromCodePoint(2097151&t):""},e.prototype.loadCell=function(e,t){var i=3*e;return t.content=this._data[i+0],t.fg=this._data[i+1],t.bg=this._data[i+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t},e.prototype.setCell=function(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg},e.prototype.setCellFromCodePoint=function(e,t,i,n,r,s){268435456&r&&(this._extendedAttrs[e]=s),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=n,this._data[3*e+2]=r},e.prototype.addCodepointToCell=function(e,t){var i=this._data[3*e+0];2097152&i?this._combined[e]+=n.stringFromCodePoint(t):(2097151&i?(this._combined[e]=n.stringFromCodePoint(2097151&i)+n.stringFromCodePoint(t),i&=-2097152,i|=2097152):i=t|1<<22,this._data[3*e+0]=i)},e.prototype.insertCells=function(e,t,i,n){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new o.ExtendedAttrs),t<this.length-e){for(var r=new s.CellData,a=this.length-e-t-1;a>=0;--a)this.setCell(e+t+a,this.loadCell(e+a,r));for(a=0;a<t;++a)this.setCell(e+a,i)}else for(a=e;a<this.length;++a)this.setCell(a,i);2===this.getWidth(this.length-1)&&this.setCellFromCodePoint(this.length-1,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new o.ExtendedAttrs)},e.prototype.deleteCells=function(e,t,i,n){if(e%=this.length,t<this.length-e){for(var r=new s.CellData,a=0;a<this.length-e-t;++a)this.setCell(e+a,this.loadCell(e+t+a,r));for(a=this.length-t;a<this.length;++a)this.setCell(a,i)}else for(a=e;a<this.length;++a)this.setCell(a,i);e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new o.ExtendedAttrs),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new o.ExtendedAttrs)},e.prototype.replaceCells=function(e,t,i,n){for(e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new o.ExtendedAttrs),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodePoint(t,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new o.ExtendedAttrs);e<t&&e<this.length;)this.setCell(e++,i)},e.prototype.resize=function(e,t){if(e!==this.length){if(e>this.length){var i=new Uint32Array(3*e);this.length&&(3*e<this._data.length?i.set(this._data.subarray(0,3*e)):i.set(this._data)),this._data=i;for(var n=this.length;n<e;++n)this.setCell(n,t)}else if(e){(i=new Uint32Array(3*e)).set(this._data.subarray(0,3*e)),this._data=i;var r=Object.keys(this._combined);for(n=0;n<r.length;n++){var s=parseInt(r[n],10);s>=e&&delete this._combined[s]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}},e.prototype.fill=function(e){this._combined={},this._extendedAttrs={};for(var t=0;t<this.length;++t)this.setCell(t,e)},e.prototype.copyFrom=function(e){for(var t in this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={},e._combined)this._combined[t]=e._combined[t];for(var t in this._extendedAttrs={},e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped},e.prototype.clone=function(){var t=new e(0);for(var i in t._data=new Uint32Array(this._data),t.length=this.length,this._combined)t._combined[i]=this._combined[i];for(var i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t},e.prototype.getTrimmedLength=function(){for(var e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0},e.prototype.copyCellsFrom=function(e,t,i,n,r){var s=e._data;if(r)for(var o=n-1;o>=0;o--)for(var a=0;a<3;a++)this._data[3*(i+o)+a]=s[3*(t+o)+a];else for(o=0;o<n;o++)for(a=0;a<3;a++)this._data[3*(i+o)+a]=s[3*(t+o)+a];var l=Object.keys(e._combined);for(a=0;a<l.length;a++){var c=parseInt(l[a],10);c>=t&&(this._combined[c-t+i]=e._combined[c])}},e.prototype.translateToString=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=0),void 0===i&&(i=this.length),e&&(i=Math.min(i,this.getTrimmedLength()));for(var s="";t<i;){var o=this._data[3*t+0],a=2097151&o;s+=2097152&o?this._combined[t]:a?n.stringFromCodePoint(a):r.WHITESPACE_CELL_CHAR,t+=o>>22||1}return s},e}();t.BufferLine=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];for(var n=0,r=t;n<r.length;n++){var s=r[n];null===(e=null==s?void 0:s.parentElement)||void 0===e||e.removeChild(s)}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;var s,o=i(12),a=i(20),l=i(39),c=i(2),u=i(15),h=i(8),d=i(16),f=i(0),p=i(3),_=i(4),g=i(6),m=i(22),v=i(24),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function b(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(s=t.WindowsOptionsReportType||(t.WindowsOptionsReportType={}));var S=function(){function e(e,t,i,n){this._bufferService=e,this._coreService=t,this._logService=i,this._optionsService=n,this._data=new Uint32Array(0)}return e.prototype.hook=function(e){this._data=new Uint32Array(0)},e.prototype.put=function(e,t,i){this._data=u.concat(this._data,e.subarray(t,i))},e.prototype.unhook=function(e){if(e){var t=h.utf32ToString(this._data);switch(this._data=new Uint32Array(0),t){case'"q':return this._coreService.triggerDataEvent(o.C0.ESC+'P1$r0"q'+o.C0.ESC+"\\");case'"p':return this._coreService.triggerDataEvent(o.C0.ESC+'P1$r61;1"p'+o.C0.ESC+"\\");case"r":var i=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(o.C0.ESC+"P1$r"+i+o.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(o.C0.ESC+"P1$r0m"+o.C0.ESC+"\\");case" q":var n={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return n-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(o.C0.ESC+"P1$r"+n+" q"+o.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",t),this._coreService.triggerDataEvent(o.C0.ESC+"P0$r"+o.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},e}(),E=function(e){function t(t,i,n,r,s,c,u,p,g){void 0===g&&(g=new l.EscapeSequenceParser);var v=e.call(this)||this;v._bufferService=t,v._charsetService=i,v._coreService=n,v._dirtyRowService=r,v._logService=s,v._optionsService=c,v._coreMouseService=u,v._unicodeService=p,v._parser=g,v._parseBuffer=new Uint32Array(4096),v._stringDecoder=new h.StringToUtf32,v._utf8Decoder=new h.Utf8ToUtf32,v._workCell=new _.CellData,v._windowTitle="",v._iconName="",v._windowTitleStack=[],v._iconNameStack=[],v._curAttrData=d.DEFAULT_ATTR_DATA.clone(),v._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),v._onRequestBell=new f.EventEmitter,v._onRequestRefreshRows=new f.EventEmitter,v._onRequestReset=new f.EventEmitter,v._onRequestScroll=new f.EventEmitter,v._onRequestSyncScrollBar=new f.EventEmitter,v._onRequestWindowsOptionsReport=new f.EventEmitter,v._onA11yChar=new f.EventEmitter,v._onA11yTab=new f.EventEmitter,v._onCursorMove=new f.EventEmitter,v._onLineFeed=new f.EventEmitter,v._onScroll=new f.EventEmitter,v._onTitleChange=new f.EventEmitter,v.register(v._parser),v._parser.setCsiHandlerFallback((function(e,t){v._logService.debug("Unknown CSI code: ",{identifier:v._parser.identToString(e),params:t.toArray()})})),v._parser.setEscHandlerFallback((function(e){v._logService.debug("Unknown ESC code: ",{identifier:v._parser.identToString(e)})})),v._parser.setExecuteHandlerFallback((function(e){v._logService.debug("Unknown EXECUTE code: ",{code:e})})),v._parser.setOscHandlerFallback((function(e,t,i){v._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})})),v._parser.setDcsHandlerFallback((function(e,t,i){"HOOK"===t&&(i=i.toArray()),v._logService.debug("Unknown DCS code: ",{identifier:v._parser.identToString(e),action:t,payload:i})})),v._parser.setPrintHandler((function(e,t,i){return v.print(e,t,i)})),v._parser.setCsiHandler({final:"@"},(function(e){return v.insertChars(e)})),v._parser.setCsiHandler({intermediates:" ",final:"@"},(function(e){return v.scrollLeft(e)})),v._parser.setCsiHandler({final:"A"},(function(e){return v.cursorUp(e)})),v._parser.setCsiHandler({intermediates:" ",final:"A"},(function(e){return v.scrollRight(e)})),v._parser.setCsiHandler({final:"B"},(function(e){return v.cursorDown(e)})),v._parser.setCsiHandler({final:"C"},(function(e){return v.cursorForward(e)})),v._parser.setCsiHandler({final:"D"},(function(e){return v.cursorBackward(e)})),v._parser.setCsiHandler({final:"E"},(function(e){return v.cursorNextLine(e)})),v._parser.setCsiHandler({final:"F"},(function(e){return v.cursorPrecedingLine(e)})),v._parser.setCsiHandler({final:"G"},(function(e){return v.cursorCharAbsolute(e)})),v._parser.setCsiHandler({final:"H"},(function(e){return v.cursorPosition(e)})),v._parser.setCsiHandler({final:"I"},(function(e){return v.cursorForwardTab(e)})),v._parser.setCsiHandler({final:"J"},(function(e){return v.eraseInDisplay(e)})),v._parser.setCsiHandler({prefix:"?",final:"J"},(function(e){return v.eraseInDisplay(e)})),v._parser.setCsiHandler({final:"K"},(function(e){return v.eraseInLine(e)})),v._parser.setCsiHandler({prefix:"?",final:"K"},(function(e){return v.eraseInLine(e)})),v._parser.setCsiHandler({final:"L"},(function(e){return v.insertLines(e)})),v._parser.setCsiHandler({final:"M"},(function(e){return v.deleteLines(e)})),v._parser.setCsiHandler({final:"P"},(function(e){return v.deleteChars(e)})),v._parser.setCsiHandler({final:"S"},(function(e){return v.scrollUp(e)})),v._parser.setCsiHandler({final:"T"},(function(e){return v.scrollDown(e)})),v._parser.setCsiHandler({final:"X"},(function(e){return v.eraseChars(e)})),v._parser.setCsiHandler({final:"Z"},(function(e){return v.cursorBackwardTab(e)})),v._parser.setCsiHandler({final:"`"},(function(e){return v.charPosAbsolute(e)})),v._parser.setCsiHandler({final:"a"},(function(e){return v.hPositionRelative(e)})),v._parser.setCsiHandler({final:"b"},(function(e){return v.repeatPrecedingCharacter(e)})),v._parser.setCsiHandler({final:"c"},(function(e){return v.sendDeviceAttributesPrimary(e)})),v._parser.setCsiHandler({prefix:">",final:"c"},(function(e){return v.sendDeviceAttributesSecondary(e)})),v._parser.setCsiHandler({final:"d"},(function(e){return v.linePosAbsolute(e)})),v._parser.setCsiHandler({final:"e"},(function(e){return v.vPositionRelative(e)})),v._parser.setCsiHandler({final:"f"},(function(e){return v.hVPosition(e)})),v._parser.setCsiHandler({final:"g"},(function(e){return v.tabClear(e)})),v._parser.setCsiHandler({final:"h"},(function(e){return v.setMode(e)})),v._parser.setCsiHandler({prefix:"?",final:"h"},(function(e){return v.setModePrivate(e)})),v._parser.setCsiHandler({final:"l"},(function(e){return v.resetMode(e)})),v._parser.setCsiHandler({prefix:"?",final:"l"},(function(e){return v.resetModePrivate(e)})),v._parser.setCsiHandler({final:"m"},(function(e){return v.charAttributes(e)})),v._parser.setCsiHandler({final:"n"},(function(e){return v.deviceStatus(e)})),v._parser.setCsiHandler({prefix:"?",final:"n"},(function(e){return v.deviceStatusPrivate(e)})),v._parser.setCsiHandler({intermediates:"!",final:"p"},(function(e){return v.softReset(e)})),v._parser.setCsiHandler({intermediates:" ",final:"q"},(function(e){return v.setCursorStyle(e)})),v._parser.setCsiHandler({final:"r"},(function(e){return v.setScrollRegion(e)})),v._parser.setCsiHandler({final:"s"},(function(e){return v.saveCursor(e)})),v._parser.setCsiHandler({final:"t"},(function(e){return v.windowOptions(e)})),v._parser.setCsiHandler({final:"u"},(function(e){return v.restoreCursor(e)})),v._parser.setCsiHandler({intermediates:"'",final:"}"},(function(e){return v.insertColumns(e)})),v._parser.setCsiHandler({intermediates:"'",final:"~"},(function(e){return v.deleteColumns(e)})),v._parser.setExecuteHandler(o.C0.BEL,(function(){return v.bell()})),v._parser.setExecuteHandler(o.C0.LF,(function(){return v.lineFeed()})),v._parser.setExecuteHandler(o.C0.VT,(function(){return v.lineFeed()})),v._parser.setExecuteHandler(o.C0.FF,(function(){return v.lineFeed()})),v._parser.setExecuteHandler(o.C0.CR,(function(){return v.carriageReturn()})),v._parser.setExecuteHandler(o.C0.BS,(function(){return v.backspace()})),v._parser.setExecuteHandler(o.C0.HT,(function(){return v.tab()})),v._parser.setExecuteHandler(o.C0.SO,(function(){return v.shiftOut()})),v._parser.setExecuteHandler(o.C0.SI,(function(){return v.shiftIn()})),v._parser.setExecuteHandler(o.C1.IND,(function(){return v.index()})),v._parser.setExecuteHandler(o.C1.NEL,(function(){return v.nextLine()})),v._parser.setExecuteHandler(o.C1.HTS,(function(){return v.tabSet()})),v._parser.setOscHandler(0,new m.OscHandler((function(e){v.setTitle(e),v.setIconName(e)}))),v._parser.setOscHandler(1,new m.OscHandler((function(e){return v.setIconName(e)}))),v._parser.setOscHandler(2,new m.OscHandler((function(e){return v.setTitle(e)}))),v._parser.setEscHandler({final:"7"},(function(){return v.saveCursor()})),v._parser.setEscHandler({final:"8"},(function(){return v.restoreCursor()})),v._parser.setEscHandler({final:"D"},(function(){return v.index()})),v._parser.setEscHandler({final:"E"},(function(){return v.nextLine()})),v._parser.setEscHandler({final:"H"},(function(){return v.tabSet()})),v._parser.setEscHandler({final:"M"},(function(){return v.reverseIndex()})),v._parser.setEscHandler({final:"="},(function(){return v.keypadApplicationMode()})),v._parser.setEscHandler({final:">"},(function(){return v.keypadNumericMode()})),v._parser.setEscHandler({final:"c"},(function(){return v.fullReset()})),v._parser.setEscHandler({final:"n"},(function(){return v.setgLevel(2)})),v._parser.setEscHandler({final:"o"},(function(){return v.setgLevel(3)})),v._parser.setEscHandler({final:"|"},(function(){return v.setgLevel(3)})),v._parser.setEscHandler({final:"}"},(function(){return v.setgLevel(2)})),v._parser.setEscHandler({final:"~"},(function(){return v.setgLevel(1)})),v._parser.setEscHandler({intermediates:"%",final:"@"},(function(){return v.selectDefaultCharset()})),v._parser.setEscHandler({intermediates:"%",final:"G"},(function(){return v.selectDefaultCharset()}));var y=function(e){b._parser.setEscHandler({intermediates:"(",final:e},(function(){return v.selectCharset("("+e)})),b._parser.setEscHandler({intermediates:")",final:e},(function(){return v.selectCharset(")"+e)})),b._parser.setEscHandler({intermediates:"*",final:e},(function(){return v.selectCharset("*"+e)})),b._parser.setEscHandler({intermediates:"+",final:e},(function(){return v.selectCharset("+"+e)})),b._parser.setEscHandler({intermediates:"-",final:e},(function(){return v.selectCharset("-"+e)})),b._parser.setEscHandler({intermediates:".",final:e},(function(){return v.selectCharset("."+e)})),b._parser.setEscHandler({intermediates:"/",final:e},(function(){return v.selectCharset("/"+e)}))},b=this;for(var E in a.CHARSETS)y(E);return v._parser.setEscHandler({intermediates:"#",final:"8"},(function(){return v.screenAlignmentPattern()})),v._parser.setErrorHandler((function(e){return v._logService.error("Parsing error: ",e),e})),v._parser.setDcsHandler({intermediates:"$",final:"q"},new S(v._bufferService,v._coreService,v._logService,v._optionsService)),v}return r(t,e),Object.defineProperty(t.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.parse=function(e){var t=this._bufferService.buffer,i=t.x,n=t.y;if(this._logService.debug("parsing data",e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),this._dirtyRowService.clearRange(),e.length>131072)for(var r=0;r<e.length;r+=131072){var s=r+131072<e.length?r+131072:e.length,o="string"==typeof e?this._stringDecoder.decode(e.substring(r,s),this._parseBuffer):this._utf8Decoder.decode(e.subarray(r,s),this._parseBuffer);this._parser.parse(this._parseBuffer,o)}else o="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer),this._parser.parse(this._parseBuffer,o);(t=this._bufferService.buffer).x===i&&t.y===n||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},t.prototype.print=function(e,t,i){var n,r,s=this._bufferService.buffer,o=this._charsetService.charset,a=this._optionsService.options.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,d=this._curAttrData,f=s.lines.get(s.ybase+s.y);this._dirtyRowService.markDirty(s.y),s.x&&i-t>0&&2===f.getWidth(s.x-1)&&f.setCellFromCodePoint(s.x-1,0,1,d.fg,d.bg,d.extended);for(var _=t;_<i;++_){if(n=e[_],r=this._unicodeService.wcwidth(n),n<127&&o){var g=o[String.fromCharCode(n)];g&&(n=g.charCodeAt(0))}if(a&&this._onA11yChar.fire(h.stringFromCodePoint(n)),r||!s.x){if(s.x+r-1>=l)if(c){for(;s.x<l;)f.setCellFromCodePoint(s.x++,0,1,d.fg,d.bg,d.extended);s.x=0,s.y++,s.y===s.scrollBottom+1?(s.y--,this._onRequestScroll.fire(this._eraseAttrData(),!0)):(s.y>=this._bufferService.rows&&(s.y=this._bufferService.rows-1),s.lines.get(s.ybase+s.y).isWrapped=!0),f=s.lines.get(s.ybase+s.y)}else if(s.x=l-1,2===r)continue;if(u&&(f.insertCells(s.x,r,s.getNullCell(d),d),2===f.getWidth(l-1)&&f.setCellFromCodePoint(l-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,d.fg,d.bg,d.extended)),f.setCellFromCodePoint(s.x++,n,r,d.fg,d.bg,d.extended),r>0)for(;--r;)f.setCellFromCodePoint(s.x++,0,0,d.fg,d.bg,d.extended)}else f.getWidth(s.x-1)?f.addCodepointToCell(s.x-1,n):f.addCodepointToCell(s.x-2,n)}i-t>0&&(f.loadCell(s.x-1,this._workCell),2===this._workCell.getWidth()||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),s.x<l&&i-t>0&&0===f.getWidth(s.x)&&!f.hasContent(s.x)&&f.setCellFromCodePoint(s.x,0,1,d.fg,d.bg,d.extended),this._dirtyRowService.markDirty(s.y)},t.prototype.addCsiHandler=function(e,t){var i=this;return"t"!==e.final||e.prefix||e.intermediates?this._parser.addCsiHandler(e,t):this._parser.addCsiHandler(e,(function(e){return!b(e.params[0],i._optionsService.options.windowOptions)||t(e)}))},t.prototype.addDcsHandler=function(e,t){return this._parser.addDcsHandler(e,new v.DcsHandler(t))},t.prototype.addEscHandler=function(e,t){return this._parser.addEscHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._parser.addOscHandler(e,new m.OscHandler(t))},t.prototype.bell=function(){this._onRequestBell.fire()},t.prototype.lineFeed=function(){var e=this._bufferService.buffer;this._dirtyRowService.markDirty(e.y),this._optionsService.options.convertEol&&(e.x=0),e.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),e.x>=this._bufferService.cols&&e.x--,this._dirtyRowService.markDirty(e.y),this._onLineFeed.fire()},t.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},t.prototype.backspace=function(){var e,t=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),void(t.x>0&&t.x--);if(this._restrictCursor(this._bufferService.cols),t.x>0)t.x--;else if(0===t.x&&t.y>t.scrollTop&&t.y<=t.scrollBottom&&(null===(e=t.lines.get(t.ybase+t.y))||void 0===e?void 0:e.isWrapped)){t.lines.get(t.ybase+t.y).isWrapped=!1,t.y--,t.x=this._bufferService.cols-1;var i=t.lines.get(t.ybase+t.y);i.hasWidth(t.x)&&!i.hasContent(t.x)&&t.x--}this._restrictCursor()},t.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var e=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-e)}},t.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},t.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},t.prototype._restrictCursor=function(e){void 0===e&&(e=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(e,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)},t.prototype._setCursor=function(e,t){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=e,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+t):(this._bufferService.buffer.x=e,this._bufferService.buffer.y=t),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._moveCursor=function(e,t){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+e,this._bufferService.buffer.y+t)},t.prototype.cursorUp=function(e){var t=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1))},t.prototype.cursorDown=function(e){var t=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1)},t.prototype.cursorForward=function(e){this._moveCursor(e.params[0]||1,0)},t.prototype.cursorBackward=function(e){this._moveCursor(-(e.params[0]||1),0)},t.prototype.cursorNextLine=function(e){this.cursorDown(e),this._bufferService.buffer.x=0},t.prototype.cursorPrecedingLine=function(e){this.cursorUp(e),this._bufferService.buffer.x=0},t.prototype.cursorCharAbsolute=function(e){this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y)},t.prototype.cursorPosition=function(e){this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1)},t.prototype.charPosAbsolute=function(e){this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y)},t.prototype.hPositionRelative=function(e){this._moveCursor(e.params[0]||1,0)},t.prototype.linePosAbsolute=function(e){this._setCursor(this._bufferService.buffer.x,(e.params[0]||1)-1)},t.prototype.vPositionRelative=function(e){this._moveCursor(0,e.params[0]||1)},t.prototype.hVPosition=function(e){this.cursorPosition(e)},t.prototype.tabClear=function(e){var t=e.params[0];0===t?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:3===t&&(this._bufferService.buffer.tabs={})},t.prototype.cursorForwardTab=function(e){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var t=e.params[0]||1;t--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},t.prototype.cursorBackwardTab=function(e){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var t=e.params[0]||1,i=this._bufferService.buffer;t--;)i.x=i.prevStop()},t.prototype._eraseInBufferLine=function(e,t,i,n){void 0===n&&(n=!1);var r=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);r.replaceCells(t,i,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),n&&(r.isWrapped=!1)},t.prototype._resetBufferLine=function(e){var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);t.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),t.isWrapped=!1},t.prototype.eraseInDisplay=function(e){var t;switch(this._restrictCursor(),e.params[0]){case 0:for(t=this._bufferService.buffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t++,this._bufferService.buffer.x,this._bufferService.cols,0===this._bufferService.buffer.x);t<this._bufferService.rows;t++)this._resetBufferLine(t);this._dirtyRowService.markDirty(t);break;case 1:for(t=this._bufferService.buffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t,0,this._bufferService.buffer.x+1,!0),this._bufferService.buffer.x+1>=this._bufferService.cols&&(this._bufferService.buffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 2:for(t=this._bufferService.rows,this._dirtyRowService.markDirty(t-1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 3:var i=this._bufferService.buffer.lines.length-this._bufferService.rows;i>0&&(this._bufferService.buffer.lines.trimStart(i),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-i,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-i,0),this._onScroll.fire(0))}},t.prototype.eraseInLine=function(e){switch(this._restrictCursor(),e.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)},t.prototype.insertLines=function(e){this._restrictCursor();var t=e.params[0]||1,i=this._bufferService.buffer;if(!(i.y>i.scrollBottom||i.y<i.scrollTop)){for(var n=i.ybase+i.y,r=this._bufferService.rows-1-i.scrollBottom,s=this._bufferService.rows-1+i.ybase-r+1;t--;)i.lines.splice(s-1,1),i.lines.splice(n,0,i.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(i.y,i.scrollBottom),i.x=0}},t.prototype.deleteLines=function(e){this._restrictCursor();var t=e.params[0]||1,i=this._bufferService.buffer;if(!(i.y>i.scrollBottom||i.y<i.scrollTop)){var n,r=i.ybase+i.y;for(n=this._bufferService.rows-1-i.scrollBottom,n=this._bufferService.rows-1+i.ybase-n;t--;)i.lines.splice(r,1),i.lines.splice(n,0,i.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(i.y,i.scrollBottom),i.x=0}},t.prototype.insertChars=function(e){this._restrictCursor();var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);t&&(t.insertCells(this._bufferService.buffer.x,e.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},t.prototype.deleteChars=function(e){this._restrictCursor();var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);t&&(t.deleteCells(this._bufferService.buffer.x,e.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},t.prototype.scrollUp=function(e){for(var t=e.params[0]||1,i=this._bufferService.buffer;t--;)i.lines.splice(i.ybase+i.scrollTop,1),i.lines.splice(i.ybase+i.scrollBottom,0,i.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(i.scrollTop,i.scrollBottom)},t.prototype.scrollDown=function(e){for(var t=e.params[0]||1,i=this._bufferService.buffer;t--;)i.lines.splice(i.ybase+i.scrollBottom,1),i.lines.splice(i.ybase+i.scrollTop,0,i.getBlankLine(d.DEFAULT_ATTR_DATA));this._dirtyRowService.markRangeDirty(i.scrollTop,i.scrollBottom)},t.prototype.scrollLeft=function(e){var t=this._bufferService.buffer;if(!(t.y>t.scrollBottom||t.y<t.scrollTop)){for(var i=e.params[0]||1,n=t.scrollTop;n<=t.scrollBottom;++n){var r=t.lines.get(t.ybase+n);r.deleteCells(0,i,t.getNullCell(this._eraseAttrData()),this._eraseAttrData()),r.isWrapped=!1}this._dirtyRowService.markRangeDirty(t.scrollTop,t.scrollBottom)}},t.prototype.scrollRight=function(e){var t=this._bufferService.buffer;if(!(t.y>t.scrollBottom||t.y<t.scrollTop)){for(var i=e.params[0]||1,n=t.scrollTop;n<=t.scrollBottom;++n){var r=t.lines.get(t.ybase+n);r.insertCells(0,i,t.getNullCell(this._eraseAttrData()),this._eraseAttrData()),r.isWrapped=!1}this._dirtyRowService.markRangeDirty(t.scrollTop,t.scrollBottom)}},t.prototype.insertColumns=function(e){var t=this._bufferService.buffer;if(!(t.y>t.scrollBottom||t.y<t.scrollTop)){for(var i=e.params[0]||1,n=t.scrollTop;n<=t.scrollBottom;++n){var r=this._bufferService.buffer.lines.get(t.ybase+n);r.insertCells(t.x,i,t.getNullCell(this._eraseAttrData()),this._eraseAttrData()),r.isWrapped=!1}this._dirtyRowService.markRangeDirty(t.scrollTop,t.scrollBottom)}},t.prototype.deleteColumns=function(e){var t=this._bufferService.buffer;if(!(t.y>t.scrollBottom||t.y<t.scrollTop)){for(var i=e.params[0]||1,n=t.scrollTop;n<=t.scrollBottom;++n){var r=t.lines.get(t.ybase+n);r.deleteCells(t.x,i,t.getNullCell(this._eraseAttrData()),this._eraseAttrData()),r.isWrapped=!1}this._dirtyRowService.markRangeDirty(t.scrollTop,t.scrollBottom)}},t.prototype.eraseChars=function(e){this._restrictCursor();var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);t&&(t.replaceCells(this._bufferService.buffer.x,this._bufferService.buffer.x+(e.params[0]||1),this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},t.prototype.repeatPrecedingCharacter=function(e){if(this._parser.precedingCodepoint){for(var t=e.params[0]||1,i=new Uint32Array(t),n=0;n<t;++n)i[n]=this._parser.precedingCodepoint;this.print(i,0,i.length)}},t.prototype.sendDeviceAttributesPrimary=function(e){e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c"))},t.prototype.sendDeviceAttributesSecondary=function(e){e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c"))},t.prototype._is=function(e){return 0===(this._optionsService.options.termName+"").indexOf(e)},t.prototype.setMode=function(e){for(var t=0;t<e.length;t++)4===e.params[t]&&(this._coreService.modes.insertMode=!0)},t.prototype.setModePrivate=function(e){for(var t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),this._charsetService.setgCharset(1,a.DEFAULT_CHARSET),this._charsetService.setgCharset(2,a.DEFAULT_CHARSET),this._charsetService.setgCharset(3,a.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}},t.prototype.resetMode=function(e){for(var t=0;t<e.length;t++)4===e.params[t]&&(this._coreService.modes.insertMode=!1)},t.prototype.resetModePrivate=function(e){for(var t=0;t<e.length;t++)switch(e.params[t]){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(),1049===e.params[t]&&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}},t.prototype._updateAttrColor=function(e,t,i,n,r){return 2===t?(e|=50331648,e&=-16777216,e|=g.AttributeData.fromColorRGB([i,n,r])):5===t&&(e&=-50331904,e|=33554432|255&i),e},t.prototype._extractColor=function(e,t,i){var n=[0,0,-1,0,0,0],r=0,s=0;do{if(n[s+r]=e.params[t+s],e.hasSubParams(t+s)){var o=e.getSubParams(t+s),a=0;do{5===n[1]&&(r=1),n[s+a+1+r]=o[a]}while(++a<o.length&&a+s+1+r<n.length);break}if(5===n[1]&&s+r>=2||2===n[1]&&s+r>=5)break;n[1]&&(r=1)}while(++s+t<e.length&&s+r<n.length);for(a=2;a<n.length;++a)-1===n[a]&&(n[a]=0);switch(n[0]){case 38:i.fg=this._updateAttrColor(i.fg,n[1],n[3],n[4],n[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,n[1],n[3],n[4],n[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,n[1],n[3],n[4],n[5])}return s},t.prototype._processUnderline=function(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()},t.prototype.charAttributes=function(e){if(1===e.length&&0===e.params[0])return this._curAttrData.fg=d.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=d.DEFAULT_ATTR_DATA.bg);for(var t,i=e.length,n=this._curAttrData,r=0;r<i;r++)(t=e.params[r])>=30&&t<=37?(n.fg&=-50331904,n.fg|=16777216|t-30):t>=40&&t<=47?(n.bg&=-50331904,n.bg|=16777216|t-40):t>=90&&t<=97?(n.fg&=-50331904,n.fg|=16777224|t-90):t>=100&&t<=107?(n.bg&=-50331904,n.bg|=16777224|t-100):0===t?(n.fg=d.DEFAULT_ATTR_DATA.fg,n.bg=d.DEFAULT_ATTR_DATA.bg):1===t?n.fg|=134217728:3===t?n.bg|=67108864:4===t?(n.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,n)):5===t?n.fg|=536870912:7===t?n.fg|=67108864:8===t?n.fg|=1073741824:2===t?n.bg|=134217728:21===t?this._processUnderline(2,n):22===t?(n.fg&=-134217729,n.bg&=-134217729):23===t?n.bg&=-67108865:24===t?n.fg&=-268435457:25===t?n.fg&=-536870913:27===t?n.fg&=-67108865:28===t?n.fg&=-1073741825:39===t?(n.fg&=-67108864,n.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):49===t?(n.bg&=-67108864,n.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):38===t||48===t||58===t?r+=this._extractColor(e,r,n):59===t?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):100===t?(n.fg&=-67108864,n.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,n.bg&=-67108864,n.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",t)},t.prototype.deviceStatus=function(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(o.C0.ESC+"[0n");break;case 6:var t=this._bufferService.buffer.y+1,i=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(o.C0.ESC+"["+t+";"+i+"R")}},t.prototype.deviceStatusPrivate=function(e){if(6===e.params[0]){var t=this._bufferService.buffer.y+1,i=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(o.C0.ESC+"[?"+t+";"+i+"R")}},t.prototype.softReset=function(e){this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.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},t.prototype.setCursorStyle=function(e){var t=e.params[0]||1;switch(t){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 i=t%2==1;this._optionsService.options.cursorBlink=i},t.prototype.setScrollRegion=function(e){var t,i=e.params[0]||1;(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>i&&(this._bufferService.buffer.scrollTop=i-1,this._bufferService.buffer.scrollBottom=t-1,this._setCursor(0,0))},t.prototype.windowOptions=function(e){if(b(e.params[0],this._optionsService.options.windowOptions)){var t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(s.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(s.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(o.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},t.prototype.saveCursor=function(e){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},t.prototype.restoreCursor=function(e){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()},t.prototype.setTitle=function(e){this._windowTitle=e,this._onTitleChange.fire(e)},t.prototype.setIconName=function(e){this._iconName=e},t.prototype.nextLine=function(){this._bufferService.buffer.x=0,this.index()},t.prototype.keypadApplicationMode=function(){this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire()},t.prototype.keypadNumericMode=function(){this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire()},t.prototype.selectDefaultCharset=function(){this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,a.DEFAULT_CHARSET)},t.prototype.selectCharset=function(e){2===e.length?"/"!==e[0]&&this._charsetService.setgCharset(y[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET):this.selectDefaultCharset()},t.prototype.index=function(){this._restrictCursor();var e=this._bufferService.buffer;this._bufferService.buffer.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),this._restrictCursor()},t.prototype.tabSet=function(){this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0},t.prototype.reverseIndex=function(){this._restrictCursor();var e=this._bufferService.buffer;if(e.y===e.scrollTop){var t=e.scrollBottom-e.scrollTop;e.lines.shiftElements(e.ybase+e.y,t,1),e.lines.set(e.ybase+e.y,e.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(e.scrollTop,e.scrollBottom)}else e.y--,this._restrictCursor()},t.prototype.fullReset=function(){this._parser.reset(),this._onRequestReset.fire()},t.prototype.reset=function(){this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()},t.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},t.prototype.setgLevel=function(e){this._charsetService.setgLevel(e)},t.prototype.screenAlignmentPattern=function(){var e=new _.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg;var t=this._bufferService.buffer;this._setCursor(0,0);for(var i=0;i<this._bufferService.rows;++i){var n=t.ybase+t.y+i,r=t.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}this._dirtyRowService.markAllDirty(),this._setCursor(0,0)},t}(c.Disposable);t.InputHandler=E},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;var n=function(){function e(e,t){if(void 0===e&&(e=32),void 0===t&&(t=32),this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return e.fromArray=function(t){var i=new e;if(!t.length)return i;for(var n=t[0]instanceof Array?1:0;n<t.length;++n){var r=t[n];if(r instanceof Array)for(var s=0;s<r.length;++s)i.addSubParam(r[s]);else i.addParam(r)}return i},e.prototype.clone=function(){var t=new e(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},e.prototype.toArray=function(){for(var e=[],t=0;t<this.length;++t){e.push(this.params[t]);var i=this._subParamsIdx[t]>>8,n=255&this._subParamsIdx[t];n-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,n))}return e},e.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},e.prototype.addParam=function(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>2147483647?2147483647:e}},e.prototype.addSubParam=function(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>2147483647?2147483647:e,this._subParamsIdx[this.length-1]++}},e.prototype.hasSubParams=function(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0},e.prototype.getSubParams=function(e){var t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null},e.prototype.getSubParamsAll=function(){for(var e={},t=0;t<this.length;++t){var i=this._subParamsIdx[t]>>8,n=255&this._subParamsIdx[t];n-i>0&&(e[t]=this._subParams.slice(i,n))}return e},e.prototype.addDigit=function(e){var t;if(!(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var i=this._digitIsSub?this._subParams:this.params,n=i[t-1];i[t-1]=~n?Math.min(10*n+e,2147483647):e}},e}();t.Params=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;var n=i(23),r=i(8),s=function(){function e(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return e.prototype.addHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var i=this._handlers[e];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},e.prototype.setHandler=function(e,t){this._handlers[e]=[t]},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},e.prototype.reset=function(){2===this._state&&this.end(!1),this._id=-1,this._state=0},e.prototype._start=function(){var e=this._handlers[this._id];if(e)for(var t=e.length-1;t>=0;t--)e[t].start();else this._handlerFb(this._id,"START")},e.prototype._put=function(e,t,i){var n=this._handlers[this._id];if(n)for(var s=n.length-1;s>=0;s--)n[s].put(e,t,i);else this._handlerFb(this._id,"PUT",r.utf32ToString(e,t,i))},e.prototype._end=function(e){var t=this._handlers[this._id];if(t){for(var i=t.length-1;i>=0&&!1===t[i].end(e);i--);for(i--;i>=0;i--)t[i].end(!1)}else this._handlerFb(this._id,"END",e)},e.prototype.start=function(){this.reset(),this._id=-1,this._state=1},e.prototype.put=function(e,t,i){if(3!==this._state){if(1===this._state)for(;t<i;){var n=e[t++];if(59===n){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+n-48}2===this._state&&i-t>0&&this._put(e,t,i)}},e.prototype.end=function(e){0!==this._state&&(3!==this._state&&(1===this._state&&this._start(),this._end(e)),this._id=-1,this._state=0)},e}();t.OscParser=s;var o=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.start=function(){this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,i){this._hitLimit||(this._data+=r.utf32ToString(e,t,i),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.end=function(e){var t;return this._hitLimit?t=!1:e&&(t=this._handler(this._data)),this._data="",this._hitLimit=!1,t},e}();t.OscHandler=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;var n=i(8),r=i(21),s=i(23),o=[],a=function(){function e(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=function(){}}return e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},e.prototype.addHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var i=this._handlers[e];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},e.prototype.setHandler=function(e,t){this._handlers[e]=[t]},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=o,this._ident=0},e.prototype.hook=function(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(var i=this._active.length-1;i>=0;i--)this._active[i].hook(t);else this._handlerFb(this._ident,"HOOK",t)},e.prototype.put=function(e,t,i){if(this._active.length)for(var r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i);else this._handlerFb(this._ident,"PUT",n.utf32ToString(e,t,i))},e.prototype.unhook=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!1===this._active[t].unhook(e);t--);for(t--;t>=0;t--)this._active[t].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",e);this._active=o,this._ident=0},e}();t.DcsParser=a;var l=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.hook=function(e){this._params=e.clone(),this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,i){this._hitLimit||(this._data+=n.utf32ToString(e,t,i),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.unhook=function(e){var t;return this._hitLimit?t=!1:e&&(t=this._handler(this._data,this._params||new r.Params)),this._params=void 0,this._data="",this._hitLimit=!1,t},e}();t.DcsHandler=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireCharAtlas=void 0;var n=i(26),r=i(43),s=[];t.acquireCharAtlas=function(e,t,i,o,a){for(var l=n.generateConfig(o,a,e,i),c=0;c<s.length;c++){var u=(h=s[c]).ownedBy.indexOf(t);if(u>=0){if(n.configEquals(h.config,l))return h.atlas;1===h.ownedBy.length?(h.atlas.dispose(),s.splice(c,1)):h.ownedBy.splice(u,1);break}}for(c=0;c<s.length;c++){var h=s[c];if(n.configEquals(h.config,l))return h.ownedBy.push(t),h.atlas}var d={atlas:new r.DynamicCharAtlas(document,l),config:l,ownedBy:[t]};return s.push(d),d.atlas},t.removeTerminalFromCache=function(e){for(var t=0;t<s.length;t++){var i=s[t].ownedBy.indexOf(e);if(-1!==i){1===s[t].ownedBy.length?(s[t].atlas.dispose(),s.splice(t,1)):s[t].ownedBy.splice(i,1);break}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;var n=i(3);t.generateConfig=function(e,t,i,n){var r={foreground:n.foreground,background:n.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:n.ansi.slice(0,16)};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:e,scaledCharHeight:t,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,colors:r}},t.configEquals=function(e,t){for(var i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.scaledCharWidth===t.scaledCharWidth&&e.scaledCharHeight===t.scaledCharHeight&&e.colors.foreground===t.colors.foreground&&e.colors.background===t.colors.background},t.is256Color=function(e){return e<n.DEFAULT_COLOR}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorManager=t.DEFAULT_ANSI_COLORS=void 0;var n=i(10),r=i(45),s=n.css.toColor("#ffffff"),o=n.css.toColor("#000000"),a=n.css.toColor("#ffffff"),l=n.css.toColor("#000000"),c={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=function(){for(var e=[n.css.toColor("#2e3436"),n.css.toColor("#cc0000"),n.css.toColor("#4e9a06"),n.css.toColor("#c4a000"),n.css.toColor("#3465a4"),n.css.toColor("#75507b"),n.css.toColor("#06989a"),n.css.toColor("#d3d7cf"),n.css.toColor("#555753"),n.css.toColor("#ef2929"),n.css.toColor("#8ae234"),n.css.toColor("#fce94f"),n.css.toColor("#729fcf"),n.css.toColor("#ad7fa8"),n.css.toColor("#34e2e2"),n.css.toColor("#eeeeec")],t=[0,95,135,175,215,255],i=0;i<216;i++){var r=t[i/36%6|0],s=t[i/6%6|0],o=t[i%6];e.push({css:n.channels.toCss(r,s,o),rgba:n.channels.toRgba(r,s,o)})}for(i=0;i<24;i++){var a=8+10*i;e.push({css:n.channels.toCss(a,a,a),rgba:n.channels.toRgba(a,a,a)})}return e}();var u=function(){function e(e,i){this.allowTransparency=i;var u=e.createElement("canvas");u.width=1,u.height=1;var h=u.getContext("2d");if(!h)throw new Error("Could not get rendering context");this._ctx=h,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new r.ColorContrastCache,this.colors={foreground:s,background:o,cursor:a,cursorAccent:l,selectionTransparent:c,selectionOpaque:n.color.blend(o,c),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return e.prototype.onOptionsChange=function(e){"minimumContrastRatio"===e&&this._contrastCache.clear()},e.prototype.setTheme=function(e){void 0===e&&(e={}),this.colors.foreground=this._parseColor(e.foreground,s),this.colors.background=this._parseColor(e.background,o),this.colors.cursor=this._parseColor(e.cursor,a,!0),this.colors.cursorAccent=this._parseColor(e.cursorAccent,l,!0),this.colors.selectionTransparent=this._parseColor(e.selection,c,!0),this.colors.selectionOpaque=n.color.blend(this.colors.background,this.colors.selectionTransparent),n.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=n.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(e.black,t.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(e.red,t.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(e.green,t.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(e.yellow,t.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(e.blue,t.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(e.magenta,t.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(e.cyan,t.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(e.white,t.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},e.prototype._parseColor=function(e,t,i){if(void 0===i&&(i=this.allowTransparency),void 0===e)return t;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=e,"string"!=typeof this._ctx.fillStyle)return console.warn("Color: "+e+" is invalid using fallback "+t.css),t;this._ctx.fillRect(0,0,1,1);var r=this._ctx.getImageData(0,0,1,1).data;if(255!==r[3]){if(!i)return console.warn("Color: "+e+" is using transparency, but allowTransparency is false. Using fallback "+t.css+"."),t;var s=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map((function(e){return Number(e)})),o=s[0],a=s[1],l=s[2],c=s[3],u=Math.round(255*c);return{rgba:n.channels.toRgba(o,a,l,u),css:e}}return{css:this._ctx.fillStyle,rgba:n.channels.toRgba(r[0],r[1],r[2],r[3])}},e}();t.ColorManager=u},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e}},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerRegistry=t.JoinedCellData=void 0;var s=i(6),o=i(3),a=i(4),l=function(e){function t(t,i,n){var r=e.call(this)||this;return r.content=0,r.combinedData="",r.fg=t.fg,r.bg=t.bg,r.combinedData=i,r._width=n,r}return r(t,e),t.prototype.isCombined=function(){return 2097152},t.prototype.getWidth=function(){return this._width},t.prototype.getChars=function(){return this.combinedData},t.prototype.getCode=function(){return 2097151},t.prototype.setFromCharData=function(e){throw new Error("not implemented")},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(s.AttributeData);t.JoinedCellData=l;var c=function(){function e(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}return e.prototype.registerCharacterJoiner=function(e){var t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id},e.prototype.deregisterCharacterJoiner=function(e){for(var t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1},e.prototype.getJoinedCharacters=function(e){if(0===this._characterJoiners.length)return[];var t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];for(var i=[],n=t.translateToString(!0),r=0,s=0,a=0,l=t.getFg(0),c=t.getBg(0),u=0;u<t.getTrimmedLength();u++)if(t.loadCell(u,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(u-r>1)for(var h=this._getJoinedRanges(n,a,s,t,r),d=0;d<h.length;d++)i.push(h[d]);r=u,a=s,l=this._workCell.fg,c=this._workCell.bg}s+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-r>1)for(h=this._getJoinedRanges(n,a,s,t,r),d=0;d<h.length;d++)i.push(h[d]);return i},e.prototype._getJoinedRanges=function(t,i,n,r,s){for(var o=t.substring(i,n),a=this._characterJoiners[0].handler(o),l=1;l<this._characterJoiners.length;l++)for(var c=this._characterJoiners[l].handler(o),u=0;u<c.length;u++)e._mergeRanges(a,c[u]);return this._stringRangesToCellRanges(a,r,s),a},e.prototype._stringRangesToCellRanges=function(e,t,i){var n=0,r=!1,s=0,a=e[n];if(a){for(var l=i;l<this._bufferService.cols;l++){var c=t.getWidth(l),u=t.getString(l).length||o.WHITESPACE_CELL_CHAR.length;if(0!==c){if(!r&&a[0]<=s&&(a[0]=l,r=!0),a[1]<=s){if(a[1]=l,!(a=e[++n]))break;a[0]<=s?(a[0]=l,r=!0):r=!1}s+=u}}a&&(a[1]=this._bufferService.cols)}},e._mergeRanges=function(e,t){for(var i=!1,n=0;n<e.length;n++){var r=e[n];if(i){if(t[1]<=r[0])return e[n-1][1]=t[1],e;if(t[1]<=r[1])return e[n-1][1]=Math.max(t[1],r[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=r[0])return e.splice(n,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0)}}return i?e[e.length-1][1]=t[1]:e.push(t),e},e}();t.CharacterJoinerRegistry=c},function(e,t,i){"use strict";function n(e,t){var i=t.getBoundingClientRect();return[e.clientX-i.left,e.clientY-i.top]}Object.defineProperty(t,"__esModule",{value:!0}),t.getRawByteCoords=t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,i,r,s,o,a,l){if(s){var c=n(e,t);if(c)return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),i+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),r),c}},t.getRawByteCoords=function(e){if(e)return{x:e[0]+32,y:e[1]+32}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0;var n=function(){function e(e){this._renderCallback=e}return e.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.refresh=function(e,t,i){var n=this;this._rowCount=i,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){return n._innerRefresh()})))},e.prototype._innerRefresh=function(){if(void 0!==this._rowStart&&void 0!==this._rowEnd&&void 0!==this._rowCount){var e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(e,t)}},e}();t.RenderDebouncer=n},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.ScreenDprMonitor=void 0;var s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._currentDevicePixelRatio=window.devicePixelRatio,t}return r(t,e),t.prototype.setListener=function(e){var t=this;this._listener&&this.clearListener(),this._listener=e,this._outerListener=function(){t._listener&&(t._listener(window.devicePixelRatio,t._currentDevicePixelRatio),t._updateDpr())},this._updateDpr()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.clearListener()},t.prototype._updateDpr=function(){var e;this._outerListener&&(null===(e=this._resolutionMediaMatchList)||void 0===e||e.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},t.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)},t}(i(2).Disposable);t.ScreenDprMonitor=s},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,i){if(void 0===i&&(i=5),"object"!=typeof t)return t;var n=Array.isArray(t)?[]:{};for(var r in t)n[r]=i<=1?t[r]:t[r]?e(t[r],i-1):t[r];return n}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var n=i(4),r=i(35),s=i(18),o=i(0),a=i(83),l=function(){function e(e){this._core=new r.Terminal(e),this._addonManager=new a.AddonManager}return e.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(e.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new d(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unicode",{get:function(){return this._checkProposedApi(),new f(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._checkProposedApi(),new u(this._core.buffers)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),e.prototype.blur=function(){this._core.blur()},e.prototype.focus=function(){this._core.focus()},e.prototype.resize=function(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)},e.prototype.open=function(e){this._core.open(e)},e.prototype.attachCustomKeyEventHandler=function(e){this._core.attachCustomKeyEventHandler(e)},e.prototype.registerLinkMatcher=function(e,t,i){return this._checkProposedApi(),this._core.registerLinkMatcher(e,t,i)},e.prototype.deregisterLinkMatcher=function(e){this._checkProposedApi(),this._core.deregisterLinkMatcher(e)},e.prototype.registerLinkProvider=function(e){return this._checkProposedApi(),this._core.registerLinkProvider(e)},e.prototype.registerCharacterJoiner=function(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)},e.prototype.deregisterCharacterJoiner=function(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)},e.prototype.registerMarker=function(e){return this._checkProposedApi(),this._verifyIntegers(e),this._core.addMarker(e)},e.prototype.addMarker=function(e){return this.registerMarker(e)},e.prototype.hasSelection=function(){return this._core.hasSelection()},e.prototype.select=function(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)},e.prototype.getSelection=function(){return this._core.getSelection()},e.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},e.prototype.clearSelection=function(){this._core.clearSelection()},e.prototype.selectAll=function(){this._core.selectAll()},e.prototype.selectLines=function(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)},e.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},e.prototype.scrollLines=function(e){this._verifyIntegers(e),this._core.scrollLines(e)},e.prototype.scrollPages=function(e){this._verifyIntegers(e),this._core.scrollPages(e)},e.prototype.scrollToTop=function(){this._core.scrollToTop()},e.prototype.scrollToBottom=function(){this._core.scrollToBottom()},e.prototype.scrollToLine=function(e){this._verifyIntegers(e),this._core.scrollToLine(e)},e.prototype.clear=function(){this._core.clear()},e.prototype.write=function(e,t){this._core.write(e,t)},e.prototype.writeUtf8=function(e,t){this._core.write(e,t)},e.prototype.writeln=function(e,t){this._core.write(e),this._core.write("\r\n",t)},e.prototype.paste=function(e){this._core.paste(e)},e.prototype.getOption=function(e){return this._core.optionsService.getOption(e)},e.prototype.setOption=function(e,t){this._core.optionsService.setOption(e,t)},e.prototype.refresh=function(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)},e.prototype.reset=function(){this._core.reset()},e.prototype.loadAddon=function(e){return this._addonManager.loadAddon(this,e)},Object.defineProperty(e,"strings",{get:function(){return s},enumerable:!1,configurable:!0}),e.prototype._verifyIntegers=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=0,n=e;i<n.length;i++){var r=n[i];if(r===1/0||isNaN(r)||r%1!=0)throw new Error("This API only accepts integers")}},e}();t.Terminal=l;var c=function(){function e(e,t){this._buffer=e,this.type=t}return e.prototype.init=function(e){return this._buffer=e,this},Object.defineProperty(e.prototype,"cursorY",{get:function(){return this._buffer.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!1,configurable:!0}),e.prototype.getLine=function(e){var t=this._buffer.lines.get(e);if(t)return new h(t)},e.prototype.getNullCell=function(){return new n.CellData},e}(),u=function(){function e(e){var t=this;this._buffers=e,this._onBufferChange=new o.EventEmitter,this._normal=new c(this._buffers.normal,"normal"),this._alternate=new c(this._buffers.alt,"alternate"),this._buffers.onBufferActivate((function(){return t._onBufferChange.fire(t.active)}))}return Object.defineProperty(e.prototype,"onBufferChange",{get:function(){return this._onBufferChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.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(e.prototype,"normal",{get:function(){return this._normal.init(this._buffers.normal)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alternate",{get:function(){return this._alternate.init(this._buffers.alt)},enumerable:!1,configurable:!0}),e}(),h=function(){function e(e){this._line=e}return Object.defineProperty(e.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._line.length},enumerable:!1,configurable:!0}),e.prototype.getCell=function(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new n.CellData)},e.prototype.translateToString=function(e,t,i){return this._line.translateToString(e,t,i)},e}(),d=function(){function e(e){this._core=e}return e.prototype.registerCsiHandler=function(e,t){return this._core.addCsiHandler(e,(function(e){return t(e.toArray())}))},e.prototype.addCsiHandler=function(e,t){return this.registerCsiHandler(e,t)},e.prototype.registerDcsHandler=function(e,t){return this._core.addDcsHandler(e,(function(e,i){return t(e,i.toArray())}))},e.prototype.addDcsHandler=function(e,t){return this.registerDcsHandler(e,t)},e.prototype.registerEscHandler=function(e,t){return this._core.addEscHandler(e,t)},e.prototype.addEscHandler=function(e,t){return this.registerEscHandler(e,t)},e.prototype.registerOscHandler=function(e,t){return this._core.addOscHandler(e,t)},e.prototype.addOscHandler=function(e,t){return this.registerOscHandler(e,t)},e}(),f=function(){function e(e){this._core=e}return e.prototype.register=function(e){this._core.unicodeService.register(e)},Object.defineProperty(e.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(e){this._core.unicodeService.activeVersion=e},enumerable:!1,configurable:!0}),e}()},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var s=i(36),o=i(37),a=i(38),l=i(12),c=i(19),u=i(40),h=i(50),d=i(51),f=i(11),p=i(7),_=i(18),g=i(54),m=i(55),v=i(56),y=i(57),b=i(59),S=i(0),E=i(16),w=i(27),C=i(60),k=i(5),T=i(61),A=i(62),x=i(63),D=i(64),L=i(65),R="undefined"!=typeof window?window.document:null,I=function(e){function t(t){void 0===t&&(t={});var i=e.call(this,t)||this;return i.browser=f,i._keyDownHandled=!1,i._onCursorMove=new S.EventEmitter,i._onKey=new S.EventEmitter,i._onRender=new S.EventEmitter,i._onSelectionChange=new S.EventEmitter,i._onTitleChange=new S.EventEmitter,i._onFocus=new S.EventEmitter,i._onBlur=new S.EventEmitter,i._onA11yCharEmitter=new S.EventEmitter,i._onA11yTabEmitter=new S.EventEmitter,i._setup(),i.linkifier=i._instantiationService.createInstance(h.Linkifier),i.linkifier2=i.register(i._instantiationService.createInstance(x.Linkifier2)),i.register(i._inputHandler.onRequestBell((function(){return i.bell()}))),i.register(i._inputHandler.onRequestRefreshRows((function(e,t){return i.refresh(e,t)}))),i.register(i._inputHandler.onRequestReset((function(){return i.reset()}))),i.register(i._inputHandler.onRequestScroll((function(e,t){return i.scroll(e,t||void 0)}))),i.register(i._inputHandler.onRequestWindowsOptionsReport((function(e){return i._reportWindowsOptions(e)}))),i.register(S.forwardEvent(i._inputHandler.onCursorMove,i._onCursorMove)),i.register(S.forwardEvent(i._inputHandler.onTitleChange,i._onTitleChange)),i.register(S.forwardEvent(i._inputHandler.onA11yChar,i._onA11yCharEmitter)),i.register(S.forwardEvent(i._inputHandler.onA11yTab,i._onA11yTabEmitter)),i.register(i._bufferService.onResize((function(e){return i._afterResize(e.cols,e.rows)}))),i}return r(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t,i,n;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._renderService)||void 0===t||t.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},null===(n=null===(i=this.element)||void 0===i?void 0:i.parentNode)||void 0===n||n.removeChild(this.element))},t.prototype._setup=function(){e.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(t.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),t.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},t.prototype._updateOptions=function(t){var i,n,r,s;switch(e.prototype._updateOptions.call(this,t),t){case"fontFamily":case"fontSize":null===(i=this._renderService)||void 0===i||i.clear(),null===(n=this._charSizeService)||void 0===n||n.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":null===(r=this.viewport)||void 0===r||r.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new v.AccessibilityManager(this,this._renderService)):(null===(s=this._accessibilityManager)||void 0===s||s.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},t.prototype._onTextAreaFocus=function(e){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(l.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},t.prototype.blur=function(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()},t.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(l.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},t.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var e=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),t=this._bufferService.buffer.y*e,i=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=i+"px",this.textarea.style.top=t+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=e+"px",this.textarea.style.lineHeight=e+"px",this.textarea.style.zIndex="-5"}},t.prototype._initGlobal=function(){var e=this;this._bindKeys(),this.register(p.addDisposableDomListener(this.element,"copy",(function(t){e.hasSelection()&&a.copyHandler(t,e._selectionService)})));var t=function(t){return a.handlePasteEvent(t,e.textarea,e._coreService)};this.register(p.addDisposableDomListener(this.textarea,"paste",t)),this.register(p.addDisposableDomListener(this.element,"paste",t)),f.isFirefox?this.register(p.addDisposableDomListener(this.element,"mousedown",(function(t){2===t.button&&a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))):this.register(p.addDisposableDomListener(this.element,"contextmenu",(function(t){a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))),f.isLinux&&this.register(p.addDisposableDomListener(this.element,"auxclick",(function(t){1===t.button&&a.moveTextAreaUnderMouseCursor(t,e.textarea,e.screenElement)})))},t.prototype._bindKeys=function(){var e=this;this.register(p.addDisposableDomListener(this.textarea,"keyup",(function(t){return e._keyUp(t)}),!0)),this.register(p.addDisposableDomListener(this.textarea,"keydown",(function(t){return e._keyDown(t)}),!0)),this.register(p.addDisposableDomListener(this.textarea,"keypress",(function(t){return e._keyPress(t)}),!0)),this.register(p.addDisposableDomListener(this.textarea,"compositionstart",(function(){return e._compositionHelper.compositionstart()}))),this.register(p.addDisposableDomListener(this.textarea,"compositionupdate",(function(t){return e._compositionHelper.compositionupdate(t)}))),this.register(p.addDisposableDomListener(this.textarea,"compositionend",(function(){return e._compositionHelper.compositionend()}))),this.register(this.onRender((function(){return e._compositionHelper.updateCompositionElements()}))),this.register(this.onRender((function(t){return e._queueLinkification(t.start,t.end)})))},t.prototype.open=function(e){var t=this;if(!e)throw new Error("Terminal requires a parent element.");R.body.contains(e)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.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"),e.appendChild(this.element);var i=R.createDocumentFragment();this._viewportElement=R.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this._viewportScrollArea=R.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=R.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=R.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement),this.textarea=R.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.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(p.addDisposableDomListener(this.textarea,"focus",(function(e){return t._onTextAreaFocus(e)}))),this.register(p.addDisposableDomListener(this.textarea,"blur",(function(){return t._onTextAreaBlur()}))),this._helperContainer.appendChild(this.textarea);var n=this._instantiationService.createInstance(D.CoreBrowserService,this.textarea);this._instantiationService.setService(k.ICoreBrowserService,n),this._charSizeService=this._instantiationService.createInstance(T.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(k.ICharSizeService,this._charSizeService),this._compositionView=R.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(i),this._theme=this.options.theme||this._theme,this._colorManager=new w.ColorManager(R,this.options.allowTransparency),this.register(this.optionsService.onOptionChange((function(e){return t._colorManager.onOptionsChange(e)}))),this._colorManager.setTheme(this._theme);var r=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,r,this.rows,this.screenElement)),this._instantiationService.setService(k.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange((function(e){return t._onRender.fire(e)}))),this.onResize((function(e){return t._renderService.resize(e.cols,e.rows)})),this._soundService=this._instantiationService.createInstance(g.SoundService),this._instantiationService.setService(k.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(A.MouseService),this._instantiationService.setService(k.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(o.Viewport,(function(e,i){return t.scrollLines(e,i)}),this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar((function(){return t.viewport.syncScrollArea()}))),this.register(this.viewport),this.register(this.onCursorMove((function(){t._renderService.onCursorMove(),t._syncTextArea()}))),this.register(this.onResize((function(){return t._renderService.onResize(t.cols,t.rows)}))),this.register(this.onBlur((function(){return t._renderService.onBlur()}))),this.register(this.onFocus((function(){return t._renderService.onFocus()}))),this.register(this._renderService.onDimensionsChange((function(){return t.viewport.syncScrollArea()}))),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement)),this._instantiationService.setService(k.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((function(e){return t.scrollLines(e.amount,e.suppressScrollEvent)}))),this.register(this._selectionService.onSelectionChange((function(){return t._onSelectionChange.fire()}))),this.register(this._selectionService.onRequestRedraw((function(e){return t._renderService.onSelectionChanged(e.start,e.end,e.columnSelectMode)}))),this.register(this._selectionService.onLinuxMouseSelection((function(e){t.textarea.value=e,t.textarea.focus(),t.textarea.select()}))),this.register(this.onScroll((function(){t.viewport.syncScrollArea(),t._selectionService.refresh()}))),this.register(p.addDisposableDomListener(this._viewportElement,"scroll",(function(){return t._selectionService.refresh()}))),this._mouseZoneManager=this._instantiationService.createInstance(m.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll((function(){return t._mouseZoneManager.clearAll()}))),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(p.addDisposableDomListener(this.element,"mousedown",(function(e){return t._selectionService.onMouseDown(e)}))),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new v.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},t.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(u.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(y.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},t.prototype._setTheme=function(e){var t,i,n;this._theme=e,null===(t=this._colorManager)||void 0===t||t.setTheme(e),null===(i=this._renderService)||void 0===i||i.setColors(this._colorManager.colors),null===(n=this.viewport)||void 0===n||n.onThemeChange(this._colorManager.colors)},t.prototype.bindMouse=function(){var e=this,t=this,i=this.element;function n(e){var i,n,r=t._mouseService.getRawByteCoords(e,t.screenElement,t.cols,t.rows);if(!r)return!1;switch(e.overrideType||e.type){case"mousemove":n=32,void 0===e.buttons?(i=3,void 0!==e.button&&(i=e.button<3?e.button:3)):i=1&e.buttons?0:4&e.buttons?1:2&e.buttons?2:3;break;case"mouseup":n=0,i=e.button<3?e.button:3;break;case"mousedown":n=1,i=e.button<3?e.button:3;break;case"wheel":0!==e.deltaY&&(n=e.deltaY<0?0:1),i=4;break;default:return!1}return!(void 0===n||void 0===i||i>4)&&t._coreMouseService.triggerMouseEvent({col:r.x-33,row:r.y-33,button:i,action:n,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})}var r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s=function(t){return n(t),t.buttons||(e._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&e._document.removeEventListener("mousemove",r.mousedrag)),e.cancel(t)},o=function(t){return n(t),t.preventDefault(),e.cancel(t)},a=function(e){e.buttons&&n(e)},c=function(e){e.buttons||n(e)};this.register(this._coreMouseService.onProtocolChange((function(t){t?("debug"===e.optionsService.options.logLevel&&e._logService.debug("Binding to mouse events:",e._coreMouseService.explainEvents(t)),e.element.classList.add("enable-mouse-events"),e._selectionService.disable()):(e._logService.debug("Unbinding from mouse events."),e.element.classList.remove("enable-mouse-events"),e._selectionService.enable()),8&t?r.mousemove||(i.addEventListener("mousemove",c),r.mousemove=c):(i.removeEventListener("mousemove",r.mousemove),r.mousemove=null),16&t?r.wheel||(i.addEventListener("wheel",o,{passive:!1}),r.wheel=o):(i.removeEventListener("wheel",r.wheel),r.wheel=null),2&t?r.mouseup||(r.mouseup=s):(e._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),4&t?r.mousedrag||(r.mousedrag=a):(e._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)}))),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(p.addDisposableDomListener(i,"mousedown",(function(t){if(t.preventDefault(),e.focus(),e._coreMouseService.areMouseEventsActive&&!e._selectionService.shouldForceSelection(t))return n(t),r.mouseup&&e._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&e._document.addEventListener("mousemove",r.mousedrag),e.cancel(t)}))),this.register(p.addDisposableDomListener(i,"wheel",(function(t){if(r.wheel);else if(!e.buffer.hasScrollback){var i=e.viewport.getLinesScrolled(t);if(0===i)return;for(var n=l.C0.ESC+(e._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B"),s="",o=0;o<Math.abs(i);o++)s+=n;e._coreService.triggerDataEvent(s,!0)}}),{passive:!0})),this.register(p.addDisposableDomListener(i,"wheel",(function(t){if(!r.wheel)return e.viewport.onWheel(t)?void 0:e.cancel(t)}),{passive:!1})),this.register(p.addDisposableDomListener(i,"touchstart",(function(t){if(!e._coreMouseService.areMouseEventsActive)return e.viewport.onTouchStart(t),e.cancel(t)}),{passive:!0})),this.register(p.addDisposableDomListener(i,"touchmove",(function(t){if(!e._coreMouseService.areMouseEventsActive)return e.viewport.onTouchMove(t)?void 0:e.cancel(t)}),{passive:!1}))},t.prototype.refresh=function(e,t){var i;null===(i=this._renderService)||void 0===i||i.refreshRows(e,t)},t.prototype._queueLinkification=function(e,t){var i;null===(i=this.linkifier)||void 0===i||i.linkifyRows(e,t)},t.prototype.updateCursorStyle=function(e){this._selectionService&&this._selectionService.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},t.prototype._showCursor=function(){this._coreService.isCursorInitialized||(this._coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},t.prototype.scrollLines=function(t,i){e.prototype.scrollLines.call(this,t,i),this.refresh(0,this.rows-1)},t.prototype.paste=function(e){a.paste(e,this.textarea,this._coreService)},t.prototype.attachCustomKeyEventHandler=function(e){this._customKeyEventHandler=e},t.prototype.registerLinkMatcher=function(e,t,i){var n=this.linkifier.registerLinkMatcher(e,t,i);return this.refresh(0,this.rows-1),n},t.prototype.deregisterLinkMatcher=function(e){this.linkifier.deregisterLinkMatcher(e)&&this.refresh(0,this.rows-1)},t.prototype.registerLinkProvider=function(e){return this.linkifier2.registerLinkProvider(e)},t.prototype.registerCharacterJoiner=function(e){var t=this._renderService.registerCharacterJoiner(e);return this.refresh(0,this.rows-1),t},t.prototype.deregisterCharacterJoiner=function(e){this._renderService.deregisterCharacterJoiner(e)&&this.refresh(0,this.rows-1)},Object.defineProperty(t.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!1,configurable:!0}),t.prototype.addMarker=function(e){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)},t.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},t.prototype.select=function(e,t,i){this._selectionService.setSelection(e,t,i)},t.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},t.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]}},t.prototype.clearSelection=function(){var e;null===(e=this._selectionService)||void 0===e||e.clearSelection()},t.prototype.selectAll=function(){var e;null===(e=this._selectionService)||void 0===e||e.selectAll()},t.prototype.selectLines=function(e,t){var i;null===(i=this._selectionService)||void 0===i||i.selectLines(e,t)},t.prototype._keyDown=function(e){if(this._keyDownHandled=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(!this._compositionHelper.keydown(e))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var t=b.evaluateKeyboardEvent(e,this._coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===t.type||2===t.type){var i=this.rows-1;return this.scrollLines(2===t.type?-i:i),this.cancel(e,!0)}return 1===t.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(t.cancel&&this.cancel(e,!0),!t.key||(t.key!==l.C0.ETX&&t.key!==l.C0.CR||(this.textarea.value=""),this._onKey.fire({key:t.key,domEvent:e}),this._showCursor(),this._coreService.triggerDataEvent(t.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(e,!0)))},t.prototype._isThirdLevelShift=function(e,t){var i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey;return"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)},t.prototype._keyUp=function(e){this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e))},t.prototype._keyPress=function(e){var t;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this._coreService.triggerDataEvent(t,!0),0))},t.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},t.prototype.resize=function(t,i){t!==this.cols||i!==this.rows?e.prototype.resize.call(this,t,i):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},t.prototype._afterResize=function(e,t){var i,n;null===(i=this._charSizeService)||void 0===i||i.measure(),null===(n=this.viewport)||void 0===n||n.syncScrollArea(!0)},t.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire(this.buffer.ydisp)}},t.prototype.reset=function(){var t,i;this.options.rows=this.rows,this.options.cols=this.cols;var n=this._customKeyEventHandler;this._setup(),e.prototype.reset.call(this),null===(t=this._selectionService)||void 0===t||t.reset(),this._customKeyEventHandler=n,this.refresh(0,this.rows-1),null===(i=this.viewport)||void 0===i||i.syncScrollArea()},t.prototype._reportWindowsOptions=function(e){if(this._renderService)switch(e){case c.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var t=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),i=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this._coreService.triggerDataEvent(l.C0.ESC+"[4;"+i+";"+t+"t");break;case c.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var n=this._renderService.dimensions.scaledCellWidth.toFixed(0),r=this._renderService.dimensions.scaledCellHeight.toFixed(0);this._coreService.triggerDataEvent(l.C0.ESC+"[6;"+r+";"+n+"t")}},t.prototype.cancel=function(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1},t.prototype._visualBell=function(){return!1},t.prototype._soundBell=function(){return"sound"===this.options.bellStyle},t}(L.CoreTerminal);t.Terminal=I},function(e,t,i){"use strict";var n=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;var s=i(5),o=i(1),a=function(){function e(e,t,i,n,r,s){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=n,this._charSizeService=r,this._coreService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0}}return Object.defineProperty(e.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),e.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._compositionView.classList.add("active")},e.prototype.compositionupdate=function(e){var t=this;this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((function(){t._compositionPosition.end=t._textarea.value.length}),0)},e.prototype.compositionend=function(){this._finalizeComposition(!0)},e.prototype.keydown=function(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)},e.prototype._finalizeComposition=function(e){var t=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){var i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((function(){if(t._isSendingComposition){t._isSendingComposition=!1;var e=void 0;e=t._isComposing?t._textarea.value.substring(i.start,i.end):t._textarea.value.substring(i.start),t._coreService.triggerDataEvent(e,!0)}}),0)}else{this._isSendingComposition=!1;var n=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(n,!0)}},e.prototype._handleAnyTextareaChanges=function(){var e=this,t=this._textarea.value;setTimeout((function(){if(!e._isComposing){var i=e._textarea.value.replace(t,"");i.length>0&&e._coreService.triggerDataEvent(i,!0)}}),0)},e.prototype.updateCompositionElements=function(e){var t=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var i=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),n=this._bufferService.buffer.y*i,r=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var s=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=n+"px",this._textarea.style.width=s.width+"px",this._textarea.style.height=s.height+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout((function(){return t.updateCompositionElements(!0)}),0)}},n([r(2,o.IBufferService),r(3,o.IOptionsService),r(4,s.ICharSizeService),r(5,o.ICoreService)],e)}();t.CompositionHelper=a},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;var a=i(2),l=i(7),c=i(5),u=i(1),h=function(e){function t(t,i,n,r,s,o,a){var c=e.call(this)||this;return c._scrollLines=t,c._viewportElement=i,c._scrollArea=n,c._bufferService=r,c._optionsService=s,c._charSizeService=o,c._renderService=a,c.scrollBarWidth=0,c._currentRowHeight=0,c._lastRecordedBufferLength=0,c._lastRecordedViewportHeight=0,c._lastRecordedBufferHeight=0,c._lastTouchY=0,c._lastScrollTop=0,c._wheelPartialScroll=0,c._refreshAnimationFrame=null,c._ignoreNextScrollEvent=!1,c.scrollBarWidth=c._viewportElement.offsetWidth-c._scrollArea.offsetWidth||15,c.register(l.addDisposableDomListener(c._viewportElement,"scroll",c._onScroll.bind(c))),setTimeout((function(){return c.syncScrollArea()}),0),c}return r(t,e),t.prototype.onThemeChange=function(e){this._viewportElement.style.backgroundColor=e.background.css},t.prototype._refresh=function(e){var t=this;if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame((function(){return t._innerRefresh()})))},t.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null},t.prototype.syncScrollArea=function(e){if(void 0===e&&(e=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===t&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(e)}else this._refresh(e)},t.prototype._onScroll=function(e){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t,!0)}},t.prototype._bubbleScroll=function(e,t){var i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&i<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)},t.prototype.onWheel=function(e){var t=this._getPixelsScrolled(e);return 0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},t.prototype._getPixelsScrolled=function(e){if(0===e.deltaY)return 0;var t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t},t.prototype.getLinesScrolled=function(e){if(0===e.deltaY)return 0;var t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t},t.prototype._applyScrollModifier=function(e,t){var i=this._optionsService.options.fastScrollModifier;return"alt"===i&&t.altKey||"ctrl"===i&&t.ctrlKey||"shift"===i&&t.shiftKey?e*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:e*this._optionsService.options.scrollSensitivity},t.prototype.onTouchStart=function(e){this._lastTouchY=e.touches[0].pageY},t.prototype.onTouchMove=function(e){var t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},s([o(3,u.IBufferService),o(4,u.IOptionsService),o(5,c.ICharSizeService),o(6,c.IRenderService)],t)}(a.Disposable);t.Viewport=h},function(e,t,i){"use strict";function n(e){return e.replace(/\r?\n/g,"\r")}function r(e,t){return t?"[200~"+e+"[201~":e}function s(e,t,i){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function o(e,t,i){var n=i.getBoundingClientRect(),r=e.clientX-n.left-10,s=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=r+"px",t.style.top=s+"px",t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,i){e.stopPropagation(),e.clipboardData&&s(e.clipboardData.getData("text/plain"),t,i)},t.paste=s,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,i,n,r){o(e,t,i),r&&!n.isClickInSelection(e)&&n.selectWordAtCursor(e),t.value=n.selectionText,t.select()}},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;var s=i(2),o=i(15),a=i(21),l=i(22),c=i(24),u=function(){function e(e){this.table=new Uint8Array(e)}return e.prototype.setDefault=function(e,t){o.fill(this.table,e<<4|t)},e.prototype.add=function(e,t,i,n){this.table[t<<8|e]=i<<4|n},e.prototype.addMany=function(e,t,i,n){for(var r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|n},e}();t.TransitionTable=u,t.VT500_TRANSITION_TABLE=function(){var e=new u(4095),t=Array.apply(null,Array(256)).map((function(e,t){return t})),i=function(e,i){return t.slice(e,i)},n=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));var s,o=i(0,14);for(s in e.setDefault(1,0),e.addMany(n,0,2,0),o)e.addMany([24,26,153,154],s,3,0),e.addMany(i(128,144),s,3,0),e.addMany(i(144,152),s,3,0),e.add(156,s,0,0),e.add(27,s,11,1),e.add(157,s,4,8),e.addMany([152,158,159],s,0,7),e.add(155,s,11,3),e.add(144,s,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();var h=function(e){function i(i){void 0===i&&(i=t.VT500_TRANSITION_TABLE);var n=e.call(this)||this;return n._transitions=i,n.initialState=0,n.currentState=n.initialState,n._params=new a.Params,n._params.addParam(0),n._collect=0,n.precedingCodepoint=0,n._printHandlerFb=function(e,t,i){},n._executeHandlerFb=function(e){},n._csiHandlerFb=function(e,t){},n._escHandlerFb=function(e){},n._errorHandlerFb=function(e){return e},n._printHandler=n._printHandlerFb,n._executeHandlers=Object.create(null),n._csiHandlers=Object.create(null),n._escHandlers=Object.create(null),n._oscParser=new l.OscParser,n._dcsParser=new c.DcsParser,n._errorHandler=n._errorHandlerFb,n.setEscHandler({final:"\\"},(function(){})),n}return r(i,e),i.prototype._identifier=function(e,t){void 0===t&&(t=[64,126]);var i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if((i=e.prefix.charCodeAt(0))&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var n=0;n<e.intermediates.length;++n){var r=e.intermediates.charCodeAt(n);if(32>r||r>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=r}}if(1!==e.final.length)throw new Error("final must be a single byte");var s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error("final must be in range "+t[0]+" .. "+t[1]);return(i<<=8)|s},i.prototype.identToString=function(e){for(var t=[];e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")},i.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},i.prototype.setPrintHandler=function(e){this._printHandler=e},i.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},i.prototype.addEscHandler=function(e,t){var i=this._identifier(e,[48,126]);void 0===this._escHandlers[i]&&(this._escHandlers[i]=[]);var n=this._escHandlers[i];return n.push(t),{dispose:function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}}},i.prototype.setEscHandler=function(e,t){this._escHandlers[this._identifier(e,[48,126])]=[t]},i.prototype.clearEscHandler=function(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]},i.prototype.setEscHandlerFallback=function(e){this._escHandlerFb=e},i.prototype.setExecuteHandler=function(e,t){this._executeHandlers[e.charCodeAt(0)]=t},i.prototype.clearExecuteHandler=function(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]},i.prototype.setExecuteHandlerFallback=function(e){this._executeHandlerFb=e},i.prototype.addCsiHandler=function(e,t){var i=this._identifier(e);void 0===this._csiHandlers[i]&&(this._csiHandlers[i]=[]);var n=this._csiHandlers[i];return n.push(t),{dispose:function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}}},i.prototype.setCsiHandler=function(e,t){this._csiHandlers[this._identifier(e)]=[t]},i.prototype.clearCsiHandler=function(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]},i.prototype.setCsiHandlerFallback=function(e){this._csiHandlerFb=e},i.prototype.addDcsHandler=function(e,t){return this._dcsParser.addHandler(this._identifier(e),t)},i.prototype.setDcsHandler=function(e,t){this._dcsParser.setHandler(this._identifier(e),t)},i.prototype.clearDcsHandler=function(e){this._dcsParser.clearHandler(this._identifier(e))},i.prototype.setDcsHandlerFallback=function(e){this._dcsParser.setHandlerFallback(e)},i.prototype.addOscHandler=function(e,t){return this._oscParser.addHandler(e,t)},i.prototype.setOscHandler=function(e,t){this._oscParser.setHandler(e,t)},i.prototype.clearOscHandler=function(e){this._oscParser.clearHandler(e)},i.prototype.setOscHandlerFallback=function(e){this._oscParser.setHandlerFallback(e)},i.prototype.setErrorHandler=function(e){this._errorHandler=e},i.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},i.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},i.prototype.parse=function(e,t){for(var i=0,n=0,r=this.currentState,s=this._oscParser,o=this._dcsParser,a=this._collect,l=this._params,c=this._transitions.table,u=0;u<t;++u){switch((n=c[r<<8|((i=e[u])<160?i:160)])>>4){case 2:for(var h=u+1;;++h){if(h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}if(++h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}if(++h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}if(++h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:i,currentState:r,collect:a,params:l,abort:!1}).abort)return;break;case 7:for(var d=this._csiHandlers[a<<8|i],f=d?d.length-1:-1;f>=0&&!1===d[f](l);f--);f<0&&this._csiHandlerFb(a<<8|i,l),this.precedingCodepoint=0;break;case 8:do{switch(i){case 59:l.addParam(0);break;case 58:l.addSubParam(-1);break;default:l.addDigit(i-48)}}while(++u<t&&(i=e[u])>47&&i<60);u--;break;case 9:a<<=8,a|=i;break;case 10:for(var p=this._escHandlers[a<<8|i],_=p?p.length-1:-1;_>=0&&!1===p[_]();_--);_<0&&this._escHandlerFb(a<<8|i),this.precedingCodepoint=0;break;case 11:l.reset(),l.addParam(0),a=0;break;case 12:o.hook(a<<8|i,l);break;case 13:for(var g=u+1;;++g)if(g>=t||24===(i=e[g])||26===i||27===i||i>127&&i<160){o.put(e,u,g),u=g-1;break}break;case 14:o.unhook(24!==i&&26!==i),27===i&&(n|=1),l.reset(),l.addParam(0),a=0,this.precedingCodepoint=0;break;case 4:s.start();break;case 5:for(var m=u+1;;m++)if(m>=t||(i=e[m])<32||i>127&&i<=159){s.put(e,u,m),u=m-1;break}break;case 6:s.end(24!==i&&26!==i),27===i&&(n|=1),l.reset(),l.addParam(0),a=0,this.precedingCodepoint=0}r=15&n}this._collect=a,this.currentState=r},i}(s.Disposable);t.EscapeSequenceParser=h},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;var a=i(41),l=i(47),c=i(48),u=i(49),h=i(29),d=i(2),f=i(5),p=i(1),_=i(25),g=i(0),m=1,v=function(e){function t(t,i,n,r,s,o,d,f,p){var _=e.call(this)||this;_._colors=t,_._screenElement=i,_._bufferService=s,_._charSizeService=o,_._optionsService=d,_._id=m++,_._onRequestRedraw=new g.EventEmitter;var v=_._optionsService.options.allowTransparency;return _._characterJoinerRegistry=new h.CharacterJoinerRegistry(_._bufferService),_._renderLayers=[new a.TextRenderLayer(_._screenElement,0,_._colors,_._characterJoinerRegistry,v,_._id,_._bufferService,d),new l.SelectionRenderLayer(_._screenElement,1,_._colors,_._id,_._bufferService,d),new u.LinkRenderLayer(_._screenElement,2,_._colors,_._id,n,r,_._bufferService,d),new c.CursorRenderLayer(_._screenElement,3,_._colors,_._id,_._onRequestRedraw,_._bufferService,d,f,p)],_.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},_._devicePixelRatio=window.devicePixelRatio,_._updateDimensions(),_.onOptionsChanged(),_}return r(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){for(var t=0,i=this._renderLayers;t<i.length;t++)i[t].dispose();e.prototype.dispose.call(this),_.removeTerminalFromCache(this._id)},t.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},t.prototype.setColors=function(e){this._colors=e;for(var t=0,i=this._renderLayers;t<i.length;t++){var n=i[t];n.setColors(this._colors),n.reset()}},t.prototype.onResize=function(e,t){this._updateDimensions();for(var i=0,n=this._renderLayers;i<n.length;i++)n[i].resize(this.dimensions);this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},t.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},t.prototype.onBlur=function(){this._runOperation((function(e){return e.onBlur()}))},t.prototype.onFocus=function(){this._runOperation((function(e){return e.onFocus()}))},t.prototype.onSelectionChanged=function(e,t,i){void 0===i&&(i=!1),this._runOperation((function(n){return n.onSelectionChanged(e,t,i)}))},t.prototype.onCursorMove=function(){this._runOperation((function(e){return e.onCursorMove()}))},t.prototype.onOptionsChanged=function(){this._runOperation((function(e){return e.onOptionsChanged()}))},t.prototype.clear=function(){this._runOperation((function(e){return e.reset()}))},t.prototype._runOperation=function(e){for(var t=0,i=this._renderLayers;t<i.length;t++)e(i[t])},t.prototype.renderRows=function(e,t){for(var i=0,n=this._renderLayers;i<n.length;i++)n[i].onGridChanged(e,t)},t.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=1===this._optionsService.options.lineHeight?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)},t.prototype.registerCharacterJoiner=function(e){return this._characterJoinerRegistry.registerCharacterJoiner(e)},t.prototype.deregisterCharacterJoiner=function(e){return this._characterJoinerRegistry.deregisterCharacterJoiner(e)},s([o(4,p.IBufferService),o(5,f.ICharSizeService),o(6,p.IOptionsService),o(7,p.ICoreService),o(8,f.ICoreBrowserService)],t)}(d.Disposable);t.Renderer=v},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.TextRenderLayer=void 0;var s=i(42),o=i(13),a=i(6),l=i(3),c=i(29),u=i(4),h=function(e){function t(t,i,n,r,o,a,l,c){var h=e.call(this,t,"text",i,o,n,a,l,c)||this;return h._characterWidth=0,h._characterFont="",h._characterOverlapCache={},h._workCell=new u.CellData,h._state=new s.GridCache,h._characterJoinerRegistry=r,h}return r(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t);var i=this._getFont(!1,!1);this._characterWidth===t.scaledCharWidth&&this._characterFont===i||(this._characterWidth=t.scaledCharWidth,this._characterFont=i,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},t.prototype.reset=function(){this._state.clear(),this._clearAll()},t.prototype._forEachCell=function(e,t,i,n){for(var r=e;r<=t;r++)for(var s=r+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.lines.get(s),a=i?i.getJoinedCharacters(s):[],u=0;u<this._bufferService.cols;u++){o.loadCell(u,this._workCell);var h=this._workCell,d=!1,f=u;if(0!==h.getWidth()){if(a.length>0&&u===a[0][0]){d=!0;var p=a.shift();h=new c.JoinedCellData(this._workCell,o.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1}!d&&this._isOverlapping(h)&&f<o.length-1&&o.getCodePoint(f+1)===l.NULL_CELL_CODE&&(h.content&=-12582913,h.content|=2<<22),n(h,u,r),u=f}}},t.prototype._drawBackground=function(e,t){var i=this,n=this._ctx,r=this._bufferService.cols,s=0,o=0,l=null;n.save(),this._forEachCell(e,t,null,(function(e,t,c){var u=null;e.isInverse()?u=e.isFgDefault()?i._colors.foreground.css:e.isFgRGB()?"rgb("+a.AttributeData.toColorRGB(e.getFgColor()).join(",")+")":i._colors.ansi[e.getFgColor()].css:e.isBgRGB()?u="rgb("+a.AttributeData.toColorRGB(e.getBgColor()).join(",")+")":e.isBgPalette()&&(u=i._colors.ansi[e.getBgColor()].css),null===l&&(s=t,o=c),c!==o?(n.fillStyle=l||"",i._fillCells(s,o,r-s,1),s=t,o=c):l!==u&&(n.fillStyle=l||"",i._fillCells(s,o,t-s,1),s=t,o=c),l=u})),null!==l&&(n.fillStyle=l,this._fillCells(s,o,r-s,1)),n.restore()},t.prototype._drawForeground=function(e,t){var i=this;this._forEachCell(e,t,this._characterJoinerRegistry,(function(e,t,n){if(!e.isInvisible()&&(i._drawChars(e,t,n),e.isUnderline())){if(i._ctx.save(),e.isInverse())if(e.isBgDefault())i._ctx.fillStyle=i._colors.background.css;else if(e.isBgRGB())i._ctx.fillStyle="rgb("+a.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var r=e.getBgColor();i._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&r<8&&(r+=8),i._ctx.fillStyle=i._colors.ansi[r].css}else if(e.isFgDefault())i._ctx.fillStyle=i._colors.foreground.css;else if(e.isFgRGB())i._ctx.fillStyle="rgb("+a.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var s=e.getFgColor();i._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&s<8&&(s+=8),i._ctx.fillStyle=i._colors.ansi[s].css}i._fillBottomLineAtCells(t,n,e.getWidth()),i._ctx.restore()}}))},t.prototype.onGridChanged=function(e,t){0!==this._state.cache.length&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,e,this._bufferService.cols,t-e+1),this._drawBackground(e,t),this._drawForeground(e,t))},t.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},t.prototype._isOverlapping=function(e){if(1!==e.getWidth())return!1;if(e.getCode()<256)return!1;var t=e.getChars();if(this._characterOverlapCache.hasOwnProperty(t))return this._characterOverlapCache[t];this._ctx.save(),this._ctx.font=this._characterFont;var i=Math.floor(this._ctx.measureText(t).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=i,i},t}(o.BaseRenderLayer);t.TextRenderLayer=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GridCache=void 0;var n=function(){function e(){this.cache=[]}return e.prototype.resize=function(e,t){for(var i=0;i<e;i++){this.cache.length<=i&&this.cache.push([]);for(var n=this.cache[i].length;n<t;n++)this.cache[i].push(void 0);this.cache[i].length=t}this.cache.length=e},e.prototype.clear=function(){for(var e=0;e<this.cache.length;e++)for(var t=0;t<this.cache[e].length;t++)this.cache[e][t]=void 0},e}();t.GridCache=n},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.NoneCharAtlas=t.DynamicCharAtlas=t.getGlyphCacheKey=void 0;var s=i(9),o=i(44),a=i(27),l=i(46),c=i(11),u=i(28),h=i(10),d={css:"rgba(0, 0, 0, 0)",rgba:0};function f(e){return e.code<<21|e.bg<<12|e.fg<<3|(e.bold?0:4)+(e.dim?0:2)+(e.italic?0:1)}t.getGlyphCacheKey=f;var p=function(e){function t(t,i){var n=e.call(this)||this;n._config=i,n._drawToCacheCount=0,n._glyphsWaitingOnBitmap=[],n._bitmapCommitTimeout=null,n._bitmap=null,n._cacheCanvas=t.createElement("canvas"),n._cacheCanvas.width=1024,n._cacheCanvas.height=1024,n._cacheCtx=u.throwIfFalsy(n._cacheCanvas.getContext("2d",{alpha:!0}));var r=t.createElement("canvas");r.width=n._config.scaledCharWidth,r.height=n._config.scaledCharHeight,n._tmpCtx=u.throwIfFalsy(r.getContext("2d",{alpha:n._config.allowTransparency})),n._width=Math.floor(1024/n._config.scaledCharWidth),n._height=Math.floor(1024/n._config.scaledCharHeight);var s=n._width*n._height;return n._cacheMap=new l.LRUMap(s),n._cacheMap.prealloc(s),n}return r(t,e),t.prototype.dispose=function(){null!==this._bitmapCommitTimeout&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},t.prototype.beginFrame=function(){this._drawToCacheCount=0},t.prototype.draw=function(e,t,i,n){if(32===t.code)return!0;if(!this._canCache(t))return!1;var r=f(t),s=this._cacheMap.get(r);if(null!=s)return this._drawFromCache(e,s,i,n),!0;if(this._drawToCacheCount<100){var o=void 0;o=this._cacheMap.size<this._cacheMap.capacity?this._cacheMap.size:this._cacheMap.peek().index;var a=this._drawToCache(t,o);return this._cacheMap.set(r,a),this._drawFromCache(e,a,i,n),!0}return!1},t.prototype._canCache=function(e){return e.code<256},t.prototype._toCoordinateX=function(e){return e%this._width*this._config.scaledCharWidth},t.prototype._toCoordinateY=function(e){return Math.floor(e/this._width)*this._config.scaledCharHeight},t.prototype._drawFromCache=function(e,t,i,n){if(!t.isEmpty){var r=this._toCoordinateX(t.index),s=this._toCoordinateY(t.index);e.drawImage(t.inBitmap?this._bitmap:this._cacheCanvas,r,s,this._config.scaledCharWidth,this._config.scaledCharHeight,i,n,this._config.scaledCharWidth,this._config.scaledCharHeight)}},t.prototype._getColorFromAnsiIndex=function(e){return e<this._config.colors.ansi.length?this._config.colors.ansi[e]:a.DEFAULT_ANSI_COLORS[e]},t.prototype._getBackgroundColor=function(e){return this._config.allowTransparency?d:e.bg===s.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:e.bg<256?this._getColorFromAnsiIndex(e.bg):this._config.colors.background},t.prototype._getForegroundColor=function(e){return e.fg===s.INVERTED_DEFAULT_COLOR?h.color.opaque(this._config.colors.background):e.fg<256?this._getColorFromAnsiIndex(e.fg):this._config.colors.foreground},t.prototype._drawToCache=function(e,t){this._drawToCacheCount++,this._tmpCtx.save();var i=this._getBackgroundColor(e);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=i.css,this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),this._tmpCtx.globalCompositeOperation="source-over";var n=e.bold?this._config.fontWeightBold:this._config.fontWeight,r=e.italic?"italic":"";this._tmpCtx.font=r+" "+n+" "+this._config.fontSize*this._config.devicePixelRatio+"px "+this._config.fontFamily,this._tmpCtx.textBaseline="middle",this._tmpCtx.fillStyle=this._getForegroundColor(e).css,e.dim&&(this._tmpCtx.globalAlpha=s.DIM_OPACITY),this._tmpCtx.fillText(e.chars,0,this._config.scaledCharHeight/2),this._tmpCtx.restore();var o=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),a=!1;this._config.allowTransparency||(a=function(e,t){for(var i=!0,n=t.rgba>>>24,r=t.rgba>>>16&255,s=t.rgba>>>8&255,o=0;o<e.data.length;o+=4)e.data[o]===n&&e.data[o+1]===r&&e.data[o+2]===s?e.data[o+3]=0:i=!1;return i}(o,i));var l=this._toCoordinateX(t),c=this._toCoordinateY(t);this._cacheCtx.putImageData(o,l,c);var u={index:t,isEmpty:a,inBitmap:!1};return this._addGlyphToBitmap(u),u},t.prototype._addGlyphToBitmap=function(e){var t=this;!("createImageBitmap"in window)||c.isFirefox||c.isSafari||(this._glyphsWaitingOnBitmap.push(e),null===this._bitmapCommitTimeout&&(this._bitmapCommitTimeout=window.setTimeout((function(){return t._generateBitmap()}),100)))},t.prototype._generateBitmap=function(){var e=this,t=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then((function(i){e._bitmap=i;for(var n=0;n<t.length;n++)t[n].inBitmap=!0})),this._bitmapCommitTimeout=null},t}(o.BaseCharAtlas);t.DynamicCharAtlas=p;var _=function(e){function t(t,i){return e.call(this)||this}return r(t,e),t.prototype.draw=function(e,t,i,n){return!1},t}(o.BaseCharAtlas);t.NoneCharAtlas=_},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseCharAtlas=void 0;var n=function(){function e(){this._didWarmUp=!1}return e.prototype.dispose=function(){},e.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},e.prototype._doWarmUp=function(){},e.prototype.beginFrame=function(){},e}();t.BaseCharAtlas=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;var n=function(){function e(){this._color={},this._rgba={}}return e.prototype.clear=function(){this._color={},this._rgba={}},e.prototype.setCss=function(e,t,i){this._rgba[e]||(this._rgba[e]={}),this._rgba[e][t]=i},e.prototype.getCss=function(e,t){return this._rgba[e]?this._rgba[e][t]:void 0},e.prototype.setColor=function(e,t,i){this._color[e]||(this._color[e]={}),this._color[e][t]=i},e.prototype.getColor=function(e,t){return this._color[e]?this._color[e][t]:void 0},e}();t.ColorContrastCache=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LRUMap=void 0;var n=function(){function e(e){this.capacity=e,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return e.prototype._unlinkNode=function(e){var t=e.prev,i=e.next;e===this._head&&(this._head=i),e===this._tail&&(this._tail=t),null!==t&&(t.next=i),null!==i&&(i.prev=t)},e.prototype._appendNode=function(e){var t=this._tail;null!==t&&(t.next=e),e.prev=t,e.next=null,this._tail=e,null===this._head&&(this._head=e)},e.prototype.prealloc=function(e){for(var t=this._nodePool,i=0;i<e;i++)t.push({prev:null,next:null,key:null,value:null})},e.prototype.get=function(e){var t=this._map[e];return void 0!==t?(this._unlinkNode(t),this._appendNode(t),t.value):null},e.prototype.peekValue=function(e){var t=this._map[e];return void 0!==t?t.value:null},e.prototype.peek=function(){var e=this._head;return null===e?null:e.value},e.prototype.set=function(e,t){var i=this._map[e];if(void 0!==i)i=this._map[e],this._unlinkNode(i),i.value=t;else if(this.size>=this.capacity)i=this._head,this._unlinkNode(i),delete this._map[i.key],i.key=e,i.value=t,this._map[e]=i;else{var n=this._nodePool;n.length>0?((i=n.pop()).key=e,i.value=t):i={prev:null,next:null,key:e,value:t},this._map[e]=i,this.size++}this._appendNode(i)},e}();t.LRUMap=n},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionRenderLayer=void 0;var s=function(e){function t(t,i,n,r,s,o){var a=e.call(this,t,"selection",i,!0,n,r,s,o)||this;return a._clearState(),a}return r(t,e),t.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._clearState()},t.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},t.prototype.onSelectionChanged=function(e,t,i){if(this._didStateChange(e,t,i,this._bufferService.buffer.ydisp))if(this._clearAll(),e&&t){var n=e[1]-this._bufferService.buffer.ydisp,r=t[1]-this._bufferService.buffer.ydisp,s=Math.max(n,0),o=Math.min(r,this._bufferService.rows-1);if(!(s>=this._bufferService.rows||o<0)){if(this._ctx.fillStyle=this._colors.selectionTransparent.css,i){var a=e[0],l=t[0]-a,c=o-s+1;this._fillCells(a,s,l,c)}else{a=n===s?e[0]:0;var u=s===o?t[0]:this._bufferService.cols;this._fillCells(a,s,u-a,1);var h=Math.max(o-s-1,0);if(this._fillCells(0,s+1,this._bufferService.cols,h),s!==o){var d=r===o?t[0]:this._bufferService.cols;this._fillCells(0,o,d,1)}}this._state.start=[e[0],e[1]],this._state.end=[t[0],t[1]],this._state.columnSelectMode=i,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},t.prototype._didStateChange=function(e,t,i,n){return!this._areCoordinatesEqual(e,this._state.start)||!this._areCoordinatesEqual(t,this._state.end)||i!==this._state.columnSelectMode||n!==this._state.ydisp},t.prototype._areCoordinatesEqual=function(e,t){return!(!e||!t)&&e[0]===t[0]&&e[1]===t[1]},t}(i(13).BaseRenderLayer);t.SelectionRenderLayer=s},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.CursorRenderLayer=void 0;var s=i(13),o=i(4),a=function(e){function t(t,i,n,r,s,a,l,c,u){var h=e.call(this,t,"cursor",i,!0,n,r,a,l)||this;return h._onRequestRedraw=s,h._coreService=c,h._coreBrowserService=u,h._cell=new o.CellData,h._state={x:0,y:0,isFocused:!1,style:"",width:0},h._cursorRenderers={bar:h._renderBarCursor.bind(h),block:h._renderBlockCursor.bind(h),underline:h._renderUnderlineCursor.bind(h)},h}return r(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},t.prototype.reset=function(){this._clearCursor(),this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0,this.onOptionsChanged())},t.prototype.onBlur=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onFocus=function(){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume():this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onOptionsChanged=function(){var e,t=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new l(this._coreBrowserService.isFocused,(function(){t._render(!0)}))):(null===(e=this._cursorBlinkStateManager)||void 0===e||e.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onCursorMove=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation()},t.prototype.onGridChanged=function(e,t){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},t.prototype._render=function(e){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var t=this._bufferService.buffer.ybase+this._bufferService.buffer.y,i=t-this._bufferService.buffer.ydisp;if(i<0||i>=this._bufferService.rows)this._clearCursor();else{var n=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(t).loadCell(n,this._cell),void 0!==this._cell.content){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var r=this._optionsService.options.cursorStyle;return r&&"block"!==r?this._cursorRenderers[r](n,i,this._cell):this._renderBlurCursor(n,i,this._cell),this._ctx.restore(),this._state.x=n,this._state.y=i,this._state.isFocused=!1,this._state.style=r,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===n&&this._state.y===i&&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"](n,i,this._cell),this._ctx.restore(),this._state.x=n,this._state.y=i,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},t.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})},t.prototype._renderBarCursor=function(e,t,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(e,t,this._optionsService.options.cursorWidth),this._ctx.restore()},t.prototype._renderBlockCursor=function(e,t,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(e,t,i.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(i,e,t),this._ctx.restore()},t.prototype._renderUnderlineCursor=function(e,t,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(e,t),this._ctx.restore()},t.prototype._renderBlurCursor=function(e,t,i){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(e,t,i.getWidth(),1),this._ctx.restore()},t}(s.BaseRenderLayer);t.CursorRenderLayer=a;var l=function(){function e(e,t){this._renderCallback=t,this.isCursorVisible=!0,e&&this._restartInterval()}return Object.defineProperty(e.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),e.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)},e.prototype.restartBlinkAnimation=function(){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){e._renderCallback(),e._animationFrame=void 0}))))},e.prototype._restartInterval=function(e){var t=this;void 0===e&&(e=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout((function(){if(t._animationTimeRestarted){var e=600-(Date.now()-t._animationTimeRestarted);if(t._animationTimeRestarted=void 0,e>0)return void t._restartInterval(e)}t.isCursorVisible=!1,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0})),t._blinkInterval=window.setInterval((function(){if(t._animationTimeRestarted){var e=600-(Date.now()-t._animationTimeRestarted);return t._animationTimeRestarted=void 0,void t._restartInterval(e)}t.isCursorVisible=!t.isCursorVisible,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0}))}),600)}),e)},e.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)},e.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},e}()},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;var s=i(13),o=i(9),a=i(26),l=function(e){function t(t,i,n,r,s,o,a,l){var c=e.call(this,t,"link",i,!0,n,r,a,l)||this;return s.onShowLinkUnderline((function(e){return c._onShowLinkUnderline(e)})),s.onHideLinkUnderline((function(e){return c._onHideLinkUnderline(e)})),o.onShowLinkUnderline((function(e){return c._onShowLinkUnderline(e)})),o.onHideLinkUnderline((function(e){return c._onHideLinkUnderline(e)})),c}return r(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._state=void 0},t.prototype.reset=function(){this._clearCurrentLink()},t.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},t.prototype._onShowLinkUnderline=function(e){if(e.fg===o.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:e.fg&&a.is256Color(e.fg)?this._ctx.fillStyle=this._colors.ansi[e.fg].css:this._ctx.fillStyle=this._colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(var t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e},t.prototype._onHideLinkUnderline=function(e){this._clearCurrentLink()},t}(s.BaseRenderLayer);t.LinkRenderLayer=l},function(e,t,i){"use strict";var n=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZone=t.Linkifier=void 0;var s=i(0),o=i(1),a=function(){function e(e,t,i){this._bufferService=e,this._logService=t,this._unicodeService=i,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new s.EventEmitter,this._onHideLinkUnderline=new s.EventEmitter,this._onLinkTooltip=new s.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(e.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),e.prototype.attachToDom=function(e,t){this._element=e,this._mouseZoneManager=t},e.prototype.linkifyRows=function(t,i){var n=this;this._mouseZoneManager&&(void 0===this._rowsToLinkify.start||void 0===this._rowsToLinkify.end?(this._rowsToLinkify.start=t,this._rowsToLinkify.end=i):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,t),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,i)),this._mouseZoneManager.clearAll(t,i),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout((function(){return n._linkifyRows()}),e._timeBeforeLatency))},e.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var e=this._bufferService.buffer;if(void 0!==this._rowsToLinkify.start&&void 0!==this._rowsToLinkify.end){var t=e.ydisp+this._rowsToLinkify.start;if(!(t>=e.lines.length)){for(var i=e.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,n=Math.ceil(2e3/this._bufferService.cols),r=this._bufferService.buffer.iterator(!1,t,i,n,n);r.hasNext();)for(var s=r.next(),o=0;o<this._linkMatchers.length;o++)this._doLinkifyRow(s.range.first,s.content,this._linkMatchers[o]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},e.prototype.registerLinkMatcher=function(e,t,i){if(void 0===i&&(i={}),!t)throw new Error("handler must be defined");var n={id:this._nextLinkMatcherId++,regex:e,handler:t,matchIndex:i.matchIndex,validationCallback:i.validationCallback,hoverTooltipCallback:i.tooltipCallback,hoverLeaveCallback:i.leaveCallback,willLinkActivate:i.willLinkActivate,priority:i.priority||0};return this._addLinkMatcherToList(n),n.id},e.prototype._addLinkMatcherToList=function(e){if(0!==this._linkMatchers.length){for(var t=this._linkMatchers.length-1;t>=0;t--)if(e.priority<=this._linkMatchers[t].priority)return void this._linkMatchers.splice(t+1,0,e);this._linkMatchers.splice(0,0,e)}else this._linkMatchers.push(e)},e.prototype.deregisterLinkMatcher=function(e){for(var t=0;t<this._linkMatchers.length;t++)if(this._linkMatchers[t].id===e)return this._linkMatchers.splice(t,1),!0;return!1},e.prototype._doLinkifyRow=function(e,t,i){for(var n,r=this,s=new RegExp(i.regex.source,(i.regex.flags||"")+"g"),o=-1,a=function(){var a=n["number"!=typeof i.matchIndex?0:i.matchIndex];if(!a)return l._logService.debug("match found without corresponding matchIndex",n,i),"break";if(o=t.indexOf(a,o+1),s.lastIndex=o+a.length,o<0)return"break";var c=l._bufferService.buffer.stringIndexToBufferIndex(e,o);if(c[0]<0)return"break";var u=l._bufferService.buffer.lines.get(c[0]);if(!u)return"break";var h=u.getFg(c[1]),d=h?h>>9&511:void 0;i.validationCallback?i.validationCallback(a,(function(e){r._rowsTimeoutId||e&&r._addLink(c[1],c[0]-r._bufferService.buffer.ydisp,a,i,d)})):l._addLink(c[1],c[0]-l._bufferService.buffer.ydisp,a,i,d)},l=this;null!==(n=s.exec(t))&&"break"!==a(););},e.prototype._addLink=function(e,t,i,n,r){var s=this;if(this._mouseZoneManager&&this._element){var o=this._unicodeService.getStringCellWidth(i),a=e%this._bufferService.cols,c=t+Math.floor(e/this._bufferService.cols),u=(a+o)%this._bufferService.cols,h=c+Math.floor((a+o)/this._bufferService.cols);0===u&&(u=this._bufferService.cols,h--),this._mouseZoneManager.add(new l(a+1,c+1,u+1,h+1,(function(e){if(n.handler)return n.handler(e,i);var t=window.open();t?(t.opener=null,t.location.href=i):console.warn("Opening link blocked as opener could not be cleared")}),(function(){s._onShowLinkUnderline.fire(s._createLinkHoverEvent(a,c,u,h,r)),s._element.classList.add("xterm-cursor-pointer")}),(function(e){s._onLinkTooltip.fire(s._createLinkHoverEvent(a,c,u,h,r)),n.hoverTooltipCallback&&n.hoverTooltipCallback(e,i,{start:{x:a,y:c},end:{x:u,y:h}})}),(function(){s._onHideLinkUnderline.fire(s._createLinkHoverEvent(a,c,u,h,r)),s._element.classList.remove("xterm-cursor-pointer"),n.hoverLeaveCallback&&n.hoverLeaveCallback()}),(function(e){return!n.willLinkActivate||n.willLinkActivate(e,i)})))}},e.prototype._createLinkHoverEvent=function(e,t,i,n,r){return{x1:e,y1:t,x2:i,y2:n,cols:this._bufferService.cols,fg:r}},e._timeBeforeLatency=200,e=n([r(0,o.IBufferService),r(1,o.ILogService),r(2,o.IUnicodeService)],e)}();t.Linkifier=a;var l=function(e,t,i,n,r,s,o,a,l){this.x1=e,this.y1=t,this.x2=i,this.y2=n,this.clickCallback=r,this.hoverCallback=s,this.tooltipCallback=o,this.leaveCallback=a,this.willLinkActivate=l};t.MouseZone=l},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;var a=i(11),l=i(52),c=i(4),u=i(0),h=i(5),d=i(1),f=i(30),p=i(53),_=i(2),g=String.fromCharCode(160),m=new RegExp(g,"g"),v=function(e){function t(t,i,n,r,s,o,a){var h=e.call(this)||this;return h._element=t,h._screenElement=i,h._bufferService=n,h._coreService=r,h._mouseService=s,h._optionsService=o,h._renderService=a,h._dragScrollAmount=0,h._enabled=!0,h._workCell=new c.CellData,h._mouseDownTimeStamp=0,h._onLinuxMouseSelection=h.register(new u.EventEmitter),h._onRedrawRequest=h.register(new u.EventEmitter),h._onSelectionChange=h.register(new u.EventEmitter),h._onRequestScrollLines=h.register(new u.EventEmitter),h._mouseMoveListener=function(e){return h._onMouseMove(e)},h._mouseUpListener=function(e){return h._onMouseUp(e)},h._coreService.onUserInput((function(){h.hasSelection&&h.clearSelection()})),h._trimListener=h._bufferService.buffer.lines.onTrim((function(e){return h._onTrim(e)})),h.register(h._bufferService.buffers.onBufferActivate((function(e){return h._onBufferActivate(e)}))),h.enable(),h._model=new l.SelectionModel(h._bufferService),h._activeSelectionMode=0,h}return r(t,e),Object.defineProperty(t.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._removeMouseDownListeners()},t.prototype.reset=function(){this.clearSelection()},t.prototype.disable=function(){this.clearSelection(),this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSelection",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";var i=this._bufferService.buffer,n=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";for(var r=e[1];r<=t[1];r++){var s=i.translateBufferLineToString(r,!0,e[0],t[0]);n.push(s)}}else{var o=e[1]===t[1]?t[0]:void 0;for(n.push(i.translateBufferLineToString(e[1],!0,e[0],o)),r=e[1]+1;r<=t[1]-1;r++){var l=i.lines.get(r);s=i.translateBufferLineToString(r,!0),l&&l.isWrapped?n[n.length-1]+=s:n.push(s)}e[1]!==t[1]&&(l=i.lines.get(t[1]),s=i.translateBufferLineToString(t[1],!0,0,t[0]),l&&l.isWrapped?n[n.length-1]+=s:n.push(s))}return n.map((function(e){return e.replace(m," ")})).join(a.isWindows?"\r\n":"\n")},enumerable:!1,configurable:!0}),t.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},t.prototype.refresh=function(e){var t=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame((function(){return t._refresh()}))),a.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},t.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})},t.prototype.isClickInSelection=function(e){var t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!!(i&&n&&t)&&this._areCoordsInSelection(t,i,n)},t.prototype._areCoordsInSelection=function(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]},t.prototype.selectWordAtCursor=function(e){var t=this._getMouseBufferCoords(e);t&&(this._selectWordAt(t,!1),this._model.selectionEnd=void 0,this.refresh(!0))},t.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},t.prototype.selectLines=function(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()},t.prototype._onTrim=function(e){this._model.onTrim(e)&&this.refresh()},t.prototype._getMouseBufferCoords=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t},t.prototype._getMouseEventScrollAmount=function(e){var t=f.getCoordsRelativeToElement(e,this._screenElement)[1],i=this._renderService.dimensions.canvasHeight;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),(t/=50)/Math.abs(t)+Math.round(14*t))},t.prototype.shouldForceSelection=function(e){return a.isMac?e.altKey&&this._optionsService.options.macOptionClickForcesSelection:e.shiftKey},t.prototype.onMouseDown=function(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._onIncrementalClick(e):1===e.detail?this._onSingleClick(e):2===e.detail?this._onDoubleClick(e):3===e.detail&&this._onTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}},t.prototype._addMouseDownListeners=function(){var e=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval((function(){return e._dragScroll()}),50)},t.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},t.prototype._onIncrementalClick=function(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))},t.prototype._onSingleClick=function(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),this._model.selectionStart){this._model.selectionEnd=void 0;var t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}},t.prototype._onDoubleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=1,this._selectWordAt(t,!0))},t.prototype._onTripleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))},t.prototype.shouldColumnSelect=function(e){return e.altKey&&!(a.isMac&&this._optionsService.options.macOptionClickForcesSelection)},t.prototype._onMouseMove=function(e){if(e.stopImmediatePropagation(),this._model.selectionStart){var t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),this._model.selectionEnd){2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){var n=i.lines.get(this._model.selectionEnd[1]);n&&0===n.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)}},t.prototype._dragScroll=function(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});var e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}},t.prototype._onMouseUp=function(e){var t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&void 0!==i[0]&&void 0!==i[1]){var n=p.moveToCellSequence(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this.hasSelection&&this._onSelectionChange.fire()},t.prototype._onBufferActivate=function(e){var t=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((function(e){return t._onTrim(e)}))},t.prototype._convertViewportColToCharacterIndex=function(e,t){for(var i=t[0],n=0;t[0]>=n;n++){var r=e.loadCell(n,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:r>1&&t[0]!==n&&(i+=r-1)}return i},t.prototype.setSelection=function(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh()},t.prototype._getWordAt=function(e,t,i,n){if(void 0===i&&(i=!0),void 0===n&&(n=!0),!(e[0]>=this._bufferService.cols)){var r=this._bufferService.buffer,s=r.lines.get(e[1]);if(s){var o=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(s,e),l=a,c=e[0]-a,u=0,h=0,d=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l<o.length&&" "===o.charAt(l+1);)l++}else{var p=e[0],_=e[0];0===s.getWidth(p)&&(u++,p--),2===s.getWidth(_)&&(h++,_++);var g=s.getString(_).length;for(g>1&&(f+=g-1,l+=g-1);p>0&&a>0&&!this._isCharWordSeparator(s.loadCell(p-1,this._workCell));){s.loadCell(p-1,this._workCell);var m=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,p--):m>1&&(d+=m-1,a-=m-1),a--,p--}for(;_<s.length&&l+1<o.length&&!this._isCharWordSeparator(s.loadCell(_+1,this._workCell));){s.loadCell(_+1,this._workCell);var v=this._workCell.getChars().length;2===this._workCell.getWidth()?(h++,_++):v>1&&(f+=v-1,l+=v-1),l++,_++}}l++;var y=a+c-u+d,b=Math.min(this._bufferService.cols,l-a+u+h-d-f);if(t||""!==o.slice(a,l).trim()){if(i&&0===y&&32!==s.getCodePoint(0)){var S=r.lines.get(e[1]-1);if(S&&s.isWrapped&&32!==S.getCodePoint(this._bufferService.cols-1)){var E=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(E){var w=this._bufferService.cols-E.start;y-=w,b+=w}}}if(n&&y+b===this._bufferService.cols&&32!==s.getCodePoint(this._bufferService.cols-1)){var C=r.lines.get(e[1]+1);if(C&&C.isWrapped&&32!==C.getCodePoint(0)){var k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(b+=k.length)}}return{start:y,length:b}}}}},t.prototype._selectWordAt=function(e,t){var i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}},t.prototype._selectToWordAt=function(e){var t=this._getWordAt(e,!0);if(t){for(var i=e[1];t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}},t.prototype._isCharWordSeparator=function(e){return 0!==e.getWidth()&&this._optionsService.options.wordSeparator.indexOf(e.getChars())>=0},t.prototype._selectLineAt=function(e){var t=this._bufferService.buffer.getWrappedRangeForLine(e);this._model.selectionStart=[0,t.first],this._model.selectionEnd=[this._bufferService.cols,t.last],this._model.selectionStartLength=0},s([o(2,d.IBufferService),o(3,d.ICoreService),o(4,h.IMouseService),o(5,d.IOptionsService),o(6,h.IRenderService)],t)}(_.Disposable);t.SelectionService=v},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0;var n=function(){function e(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}return e.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(e.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(e.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 e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,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}),e.prototype.areSelectionValuesReversed=function(){var e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])},e.prototype.onTrim=function(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},e}();t.SelectionModel=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;var n=i(12);function r(e,t,i,n){var r=e-s(i,e),a=t-s(i,t);return c(Math.abs(r-a)-function(e,t,i){for(var n=0,r=e-s(i,e),a=t-s(i,t),l=0;l<Math.abs(r-a);l++){var c="A"===o(e,t)?-1:1,u=i.buffer.lines.get(r+c*l);u&&u.isWrapped&&n++}return n}(e,t,i),l(o(e,t),n))}function s(e,t){for(var i=0,n=e.buffer.lines.get(t),r=n&&n.isWrapped;r&&t>=0&&t<e.rows;)i++,r=(n=e.buffer.lines.get(--t))&&n.isWrapped;return i}function o(e,t){return e>t?"A":"B"}function a(e,t,i,n,r,s){for(var o=e,a=t,l="";o!==i||a!==n;)o+=r?1:-1,r&&o>s.cols-1?(l+=s.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(l+=s.buffer.translateBufferLineToString(a,!1,0,e+1),e=o=s.cols-1,a--);return l+s.buffer.translateBufferLineToString(a,!1,e,o)}function l(e,t){var i=t?"O":"[";return n.C0.ESC+i+e}function c(e,t){e=Math.floor(e);for(var i="",n=0;n<e;n++)i+=t;return i}t.moveToCellSequence=function(e,t,i,n){var o,u=i.buffer.x,h=i.buffer.y;if(!i.buffer.hasScrollback)return function(e,t,i,n,o,u){return 0===r(t,n,o,u).length?"":c(a(e,t,e,t-s(o,t),!1,o).length,l("D",u))}(u,h,0,t,i,n)+r(h,t,i,n)+function(e,t,i,n,o,u){var h;h=r(t,n,o,u).length>0?n-s(o,n):t;var d=n,f=function(e,t,i,n,o,a){var l;return l=r(i,n,o,a).length>0?n-s(o,n):t,e<i&&l<=n||e>=i&&l<n?"C":"D"}(e,t,i,n,o,u);return c(a(e,h,i,d,"C"===f,o).length,l(f,u))}(u,h,e,t,i,n);if(h===t)return o=u>e?"D":"C",c(Math.abs(u-e),l(o,n));o=h>t?"D":"C";var d=Math.abs(h-t);return c(function(e,t){return t.cols-e}(h>t?e:u,i)+(d-1)*i.cols+1+((h>t?u:e)-1),l(o,n))}},function(e,t,i){"use strict";var n=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SoundService=void 0;var s=i(1),o=function(){function e(e){this._optionsService=e}return Object.defineProperty(e,"audioContext",{get:function(){if(!e._audioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;e._audioContext=new t}return e._audioContext},enumerable:!1,configurable:!0}),e.prototype.playBellSound=function(){var t=e.audioContext;if(t){var i=t.createBufferSource();t.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),(function(e){i.buffer=e,i.connect(t.destination),i.start(0)}))}},e.prototype._base64ToArrayBuffer=function(e){for(var t=window.atob(e),i=t.length,n=new Uint8Array(i),r=0;r<i;r++)n[r]=t.charCodeAt(r);return n.buffer},e.prototype._removeMimeType=function(e){return e.split(",")[1]},e=n([r(0,s.IOptionsService)],e)}();t.SoundService=o},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZoneManager=void 0;var a=i(2),l=i(7),c=i(5),u=i(1),h=function(e){function t(t,i,n,r,s,o){var a=e.call(this)||this;return a._element=t,a._screenElement=i,a._bufferService=n,a._mouseService=r,a._selectionService=s,a._optionsService=o,a._zones=[],a._areZonesActive=!1,a._lastHoverCoords=[void 0,void 0],a._initialSelectionLength=0,a.register(l.addDisposableDomListener(a._element,"mousedown",(function(e){return a._onMouseDown(e)}))),a._mouseMoveListener=function(e){return a._onMouseMove(e)},a._mouseLeaveListener=function(e){return a._onMouseLeave(e)},a._clickListener=function(e){return a._onClick(e)},a}return r(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._deactivate()},t.prototype.add=function(e){this._zones.push(e),1===this._zones.length&&this._activate()},t.prototype.clearAll=function(e,t){if(0!==this._zones.length){e&&t||(e=0,t=this._bufferService.rows-1);for(var i=0;i<this._zones.length;i++){var n=this._zones[i];(n.y1>e&&n.y1<=t+1||n.y2>e&&n.y2<=t+1||n.y1<e&&n.y2>t+1)&&(this._currentZone&&this._currentZone===n&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(i--,1))}0===this._zones.length&&this._deactivate()}},t.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))},t.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))},t.prototype._onMouseMove=function(e){this._lastHoverCoords[0]===e.pageX&&this._lastHoverCoords[1]===e.pageY||(this._onHover(e),this._lastHoverCoords=[e.pageX,e.pageY])},t.prototype._onHover=function(e){var t=this,i=this._findZoneEventAt(e);i!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),i&&(this._currentZone=i,i.hoverCallback&&i.hoverCallback(e),this._tooltipTimeout=window.setTimeout((function(){return t._onTooltip(e)}),this._optionsService.options.linkTooltipHoverDuration)))},t.prototype._onTooltip=function(e){this._tooltipTimeout=void 0;var t=this._findZoneEventAt(e);t&&t.tooltipCallback&&t.tooltipCallback(e)},t.prototype._onMouseDown=function(e){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var t=this._findZoneEventAt(e);(null==t?void 0:t.willLinkActivate(e))&&(e.preventDefault(),e.stopImmediatePropagation())}},t.prototype._onMouseLeave=function(e){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},t.prototype._onClick=function(e){var t=this._findZoneEventAt(e),i=this._getSelectionLength();t&&i===this._initialSelectionLength&&(t.clickCallback(e),e.preventDefault(),e.stopImmediatePropagation())},t.prototype._getSelectionLength=function(){var e=this._selectionService.selectionText;return e?e.length:0},t.prototype._findZoneEventAt=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(t)for(var i=t[0],n=t[1],r=0;r<this._zones.length;r++){var s=this._zones[r];if(s.y1===s.y2){if(n===s.y1&&i>=s.x1&&i<s.x2)return s}else if(n===s.y1&&i>=s.x1||n===s.y2&&i<s.x2||n>s.y1&&n<s.y2)return s}},s([o(2,u.IBufferService),o(3,c.IMouseService),o(4,c.ISelectionService),o(5,u.IOptionsService)],t)}(a.Disposable);t.MouseZoneManager=h},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;var s=i(18),o=i(11),a=i(31),l=i(7),c=i(2),u=i(32),h=i(17),d=function(e){function t(t,i){var n=e.call(this)||this;n._terminal=t,n._renderService=i,n._liveRegionLineCount=0,n._charsToConsume=[],n._charsToAnnounce="",n._accessibilityTreeRoot=document.createElement("div"),n._accessibilityTreeRoot.classList.add("xterm-accessibility"),n._rowContainer=document.createElement("div"),n._rowContainer.classList.add("xterm-accessibility-tree"),n._rowContainer.setAttribute("role","list"),n._rowElements=[];for(var r=0;r<n._terminal.rows;r++)n._rowElements[r]=n._createAccessibilityTreeNode(),n._rowContainer.appendChild(n._rowElements[r]);if(n._topBoundaryFocusListener=function(e){return n._onBoundaryFocus(e,0)},n._bottomBoundaryFocusListener=function(e){return n._onBoundaryFocus(e,1)},n._rowElements[0].addEventListener("focus",n._topBoundaryFocusListener),n._rowElements[n._rowElements.length-1].addEventListener("focus",n._bottomBoundaryFocusListener),n._refreshRowsDimensions(),n._accessibilityTreeRoot.appendChild(n._rowContainer),n._renderRowsDebouncer=new a.RenderDebouncer(n._renderRows.bind(n)),n._refreshRows(),n._liveRegion=document.createElement("div"),n._liveRegion.classList.add("live-region"),n._liveRegion.setAttribute("aria-live","assertive"),n._accessibilityTreeRoot.appendChild(n._liveRegion),!n._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");return n._terminal.element.insertAdjacentElement("afterbegin",n._accessibilityTreeRoot),n.register(n._renderRowsDebouncer),n.register(n._terminal.onResize((function(e){return n._onResize(e.rows)}))),n.register(n._terminal.onRender((function(e){return n._refreshRows(e.start,e.end)}))),n.register(n._terminal.onScroll((function(){return n._refreshRows()}))),n.register(n._terminal.onA11yChar((function(e){return n._onChar(e)}))),n.register(n._terminal.onLineFeed((function(){return n._onChar("\n")}))),n.register(n._terminal.onA11yTab((function(e){return n._onTab(e)}))),n.register(n._terminal.onKey((function(e){return n._onKey(e.key)}))),n.register(n._terminal.onBlur((function(){return n._clearLiveRegion()}))),n.register(n._renderService.onDimensionsChange((function(){return n._refreshRowsDimensions()}))),n._screenDprMonitor=new u.ScreenDprMonitor,n.register(n._screenDprMonitor),n._screenDprMonitor.setListener((function(){return n._refreshRowsDimensions()})),n.register(l.addDisposableDomListener(window,"resize",(function(){return n._refreshRowsDimensions()}))),n}return r(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),h.removeElementFromParent(this._accessibilityTreeRoot),this._rowElements.length=0},t.prototype._onBoundaryFocus=function(e,t){var i=e.target,n=this._rowElements[0===t?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")!==(0===t?"1":""+this._terminal.buffer.lines.length)&&e.relatedTarget===n){var r,s;if(0===t?(r=i,s=this._rowElements.pop(),this._rowContainer.removeChild(s)):(r=this._rowElements.shift(),s=i,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),s.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){var o=this._createAccessibilityTreeNode();this._rowElements.unshift(o),this._rowContainer.insertAdjacentElement("afterbegin",o)}else o=this._createAccessibilityTreeNode(),this._rowElements.push(o),this._rowContainer.appendChild(o);this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}},t.prototype._onResize=function(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},t.prototype._createAccessibilityTreeNode=function(){var e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e},t.prototype._onTab=function(e){for(var t=0;t<e;t++)this._onChar(" ")},t.prototype._onChar=function(e){var t=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=s.tooMuchOutput)),o.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((function(){t._accessibilityTreeRoot.appendChild(t._liveRegion)}),0))},t.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,o.isMac&&h.removeElementFromParent(this._liveRegion)},t.prototype._onKey=function(e){this._clearLiveRegion(),this._charsToConsume.push(e)},t.prototype._refreshRows=function(e,t){this._renderRowsDebouncer.refresh(e,t,this._terminal.rows)},t.prototype._renderRows=function(e,t){for(var i=this._terminal.buffer,n=i.lines.length.toString(),r=e;r<=t;r++){var s=i.translateBufferLineToString(i.ydisp+r,!0),o=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(0===s.length?a.innerHTML="&nbsp;":a.textContent=s,a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",n))}this._announceCharacters()},t.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}},t.prototype._refreshRowDimensions=function(e){e.style.height=this._renderService.dimensions.actualCellHeight+"px"},t.prototype._announceCharacters=function(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},t}(c.Disposable);t.AccessibilityManager=d},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;var a=i(58),l=i(9),c=i(2),u=i(5),h=i(1),d=i(0),f=i(10),p=i(17),_=1,g=function(e){function t(t,i,n,r,s,o,l,c,u){var h=e.call(this)||this;return h._colors=t,h._element=i,h._screenElement=n,h._viewportElement=r,h._linkifier=s,h._linkifier2=o,h._charSizeService=l,h._optionsService=c,h._bufferService=u,h._terminalClass=_++,h._rowElements=[],h._rowContainer=document.createElement("div"),h._rowContainer.classList.add("xterm-rows"),h._rowContainer.style.lineHeight="normal",h._rowContainer.setAttribute("aria-hidden","true"),h._refreshRowElements(h._bufferService.cols,h._bufferService.rows),h._selectionContainer=document.createElement("div"),h._selectionContainer.classList.add("xterm-selection"),h._selectionContainer.setAttribute("aria-hidden","true"),h.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},h._updateDimensions(),h._injectCss(),h._rowFactory=new a.DomRendererRowFactory(document,h._optionsService,h._colors),h._element.classList.add("xterm-dom-renderer-owner-"+h._terminalClass),h._screenElement.appendChild(h._rowContainer),h._screenElement.appendChild(h._selectionContainer),h._linkifier.onShowLinkUnderline((function(e){return h._onLinkHover(e)})),h._linkifier.onHideLinkUnderline((function(e){return h._onLinkLeave(e)})),h._linkifier2.onShowLinkUnderline((function(e){return h._onLinkHover(e)})),h._linkifier2.onHideLinkUnderline((function(e){return h._onLinkLeave(e)})),h}return r(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return(new d.EventEmitter).event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),p.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),e.prototype.dispose.call(this)},t.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var e=0,t=this._rowElements;e<t.length;e++){var i=t[e];i.style.width=this.dimensions.canvasWidth+"px",i.style.height=this.dimensions.actualCellHeight+"px",i.style.lineHeight=this.dimensions.actualCellHeight+"px",i.style.overflow="hidden"}this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));var n=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.innerHTML=n,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},t.prototype.setColors=function(e){this._colors=e,this._injectCss()},t.prototype._injectCss=function(){var e=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var t=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";t+=this._terminalSelector+" span:not(."+a.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+a.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+a.ITALIC_CLASS+" { font-style: italic;}",t+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",t+="@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+"; }}",t+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+a.CURSOR_CLASS+"."+a.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+a.CURSOR_CLASS+"."+a.CURSOR_BLINK_CLASS+":not(."+a.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+a.CURSOR_CLASS+"."+a.CURSOR_BLINK_CLASS+"."+a.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+a.CURSOR_CLASS+"."+a.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+a.CURSOR_CLASS+"."+a.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+a.CURSOR_CLASS+"."+a.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",t+=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(i,n){t+=e._terminalSelector+" .xterm-fg-"+n+" { color: "+i.css+"; }"+e._terminalSelector+" .xterm-bg-"+n+" { background-color: "+i.css+"; }"})),t+=this._terminalSelector+" .xterm-fg-"+l.INVERTED_DEFAULT_COLOR+" { color: "+f.color.opaque(this._colors.background).css+"; }"+this._terminalSelector+" .xterm-bg-"+l.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }",this._themeStyleElement.innerHTML=t},t.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},t.prototype._refreshRowElements=function(e,t){for(var i=this._rowElements.length;i<=t;i++){var n=document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())},t.prototype.onResize=function(e,t){this._refreshRowElements(e,t),this._updateDimensions()},t.prototype.onCharSizeChanged=function(){this._updateDimensions()},t.prototype.onBlur=function(){this._rowContainer.classList.remove("xterm-focus")},t.prototype.onFocus=function(){this._rowContainer.classList.add("xterm-focus")},t.prototype.onSelectionChanged=function(e,t,i){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(e&&t){var n=e[1]-this._bufferService.buffer.ydisp,r=t[1]-this._bufferService.buffer.ydisp,s=Math.max(n,0),o=Math.min(r,this._bufferService.rows-1);if(!(s>=this._bufferService.rows||o<0)){var a=document.createDocumentFragment();if(i)a.appendChild(this._createSelectionElement(s,e[0],t[0],o-s+1));else{var l=n===s?e[0]:0,c=s===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,l,c));var u=o-s-1;if(a.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,u)),s!==o){var h=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(a)}}},t.prototype._createSelectionElement=function(e,t,i,n){void 0===n&&(n=1);var r=document.createElement("div");return r.style.height=n*this.dimensions.actualCellHeight+"px",r.style.top=e*this.dimensions.actualCellHeight+"px",r.style.left=t*this.dimensions.actualCellWidth+"px",r.style.width=this.dimensions.actualCellWidth*(i-t)+"px",r},t.prototype.onCursorMove=function(){},t.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},t.prototype.clear=function(){for(var e=0,t=this._rowElements;e<t.length;e++)t[e].innerHTML=""},t.prototype.renderRows=function(e,t){for(var i=this._bufferService.buffer.ybase+this._bufferService.buffer.y,n=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._optionsService.options.cursorBlink,s=e;s<=t;s++){var o=this._rowElements[s];o.innerHTML="";var a=s+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.lines.get(a),c=this._optionsService.options.cursorStyle;o.appendChild(this._rowFactory.createRow(l,a===i,c,n,r,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(t.prototype,"_terminalSelector",{get:function(){return".xterm-dom-renderer-owner-"+this._terminalClass},enumerable:!1,configurable:!0}),t.prototype.registerCharacterJoiner=function(e){return-1},t.prototype.deregisterCharacterJoiner=function(e){return!1},t.prototype._onLinkHover=function(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)},t.prototype._onLinkLeave=function(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)},t.prototype._setCellUnderline=function(e,t,i,n,r,s){for(;e!==t||i!==n;){var o=this._rowElements[i];if(!o)return;var a=o.children[e];a&&(a.style.textDecoration=s?"underline":"none"),++e>=r&&(e=0,i++)}},s([o(6,u.ICharSizeService),o(7,h.IOptionsService),o(8,h.IBufferService)],t)}(c.Disposable);t.DomRenderer=g},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=t.CURSOR_STYLE_UNDERLINE_CLASS=t.CURSOR_STYLE_BAR_CLASS=t.CURSOR_STYLE_BLOCK_CLASS=t.CURSOR_BLINK_CLASS=t.CURSOR_CLASS=t.UNDERLINE_CLASS=t.ITALIC_CLASS=t.DIM_CLASS=t.BOLD_CLASS=void 0;var n=i(9),r=i(3),s=i(4),o=i(10);t.BOLD_CLASS="xterm-bold",t.DIM_CLASS="xterm-dim",t.ITALIC_CLASS="xterm-italic",t.UNDERLINE_CLASS="xterm-underline",t.CURSOR_CLASS="xterm-cursor",t.CURSOR_BLINK_CLASS="xterm-cursor-blink",t.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",t.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",t.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var a=function(){function e(e,t,i){this._document=e,this._optionsService=t,this._colors=i,this._workCell=new s.CellData}return e.prototype.setColors=function(e){this._colors=e},e.prototype.createRow=function(e,i,s,a,c,u,h){for(var d=this._document.createDocumentFragment(),f=0,p=Math.min(e.length,h)-1;p>=0;p--)if(e.loadCell(p,this._workCell).getCode()!==r.NULL_CELL_CODE||i&&p===a){f=p+1;break}for(p=0;p<f;p++){e.loadCell(p,this._workCell);var _=this._workCell.getWidth();if(0!==_){var g=this._document.createElement("span");if(_>1&&(g.style.width=u*_+"px"),i&&p===a)switch(g.classList.add(t.CURSOR_CLASS),c&&g.classList.add(t.CURSOR_BLINK_CLASS),s){case"bar":g.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":g.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:g.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&g.classList.add(t.BOLD_CLASS),this._workCell.isItalic()&&g.classList.add(t.ITALIC_CLASS),this._workCell.isDim()&&g.classList.add(t.DIM_CLASS),this._workCell.isUnderline()&&g.classList.add(t.UNDERLINE_CLASS),this._workCell.isInvisible()?g.textContent=r.WHITESPACE_CELL_CHAR:g.textContent=this._workCell.getChars()||r.WHITESPACE_CELL_CHAR;var m=this._workCell.getFgColor(),v=this._workCell.getFgColorMode(),y=this._workCell.getBgColor(),b=this._workCell.getBgColorMode(),S=!!this._workCell.isInverse();if(S){var E=m;m=y,y=E;var w=v;v=b,b=w}switch(v){case 16777216:case 33554432:this._workCell.isBold()&&m<8&&this._optionsService.options.drawBoldTextInBrightColors&&(m+=8),this._applyMinimumContrast(g,this._colors.background,this._colors.ansi[m])||g.classList.add("xterm-fg-"+m);break;case 50331648:var C=o.rgba.toColor(m>>16&255,m>>8&255,255&m);this._applyMinimumContrast(g,this._colors.background,C)||this._addStyle(g,"color:#"+l(m.toString(16),"0",6));break;default:this._applyMinimumContrast(g,this._colors.background,this._colors.foreground)||S&&g.classList.add("xterm-fg-"+n.INVERTED_DEFAULT_COLOR)}switch(b){case 16777216:case 33554432:g.classList.add("xterm-bg-"+y);break;case 50331648:this._addStyle(g,"background-color:#"+l(y.toString(16),"0",6));break;default:S&&g.classList.add("xterm-bg-"+n.INVERTED_DEFAULT_COLOR)}d.appendChild(g)}}return d},e.prototype._applyMinimumContrast=function(e,t,i){if(1===this._optionsService.options.minimumContrastRatio)return!1;var n=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return void 0===n&&(n=o.color.ensureContrastRatio(t,i,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,null!=n?n:null)),!!n&&(this._addStyle(e,"color:"+n.css),!0)},e.prototype._addStyle=function(e,t){e.setAttribute("style",""+(e.getAttribute("style")||"")+t+";")},e}();function l(e,t,i){for(;e.length<i;)e=t+e;return e}t.DomRendererRowFactory=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;var n=i(12),r={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:["'",'"']};t.evaluateKeyboardEvent=function(e,t,i,s){var o={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?o.key=t?n.C0.ESC+"OA":n.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?o.key=t?n.C0.ESC+"OD":n.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?o.key=t?n.C0.ESC+"OC":n.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(o.key=t?n.C0.ESC+"OB":n.C0.ESC+"[B");break;case 8:if(e.shiftKey){o.key=n.C0.BS;break}if(e.altKey){o.key=n.C0.ESC+n.C0.DEL;break}o.key=n.C0.DEL;break;case 9:if(e.shiftKey){o.key=n.C0.ESC+"[Z";break}o.key=n.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?n.C0.ESC+n.C0.CR:n.C0.CR,o.cancel=!0;break;case 27:o.key=n.C0.ESC,e.altKey&&(o.key=n.C0.ESC+n.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;a?(o.key=n.C0.ESC+"[1;"+(a+1)+"D",o.key===n.C0.ESC+"[1;3D"&&(o.key=n.C0.ESC+(i?"b":"[1;5D"))):o.key=t?n.C0.ESC+"OD":n.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(o.key=n.C0.ESC+"[1;"+(a+1)+"C",o.key===n.C0.ESC+"[1;3C"&&(o.key=n.C0.ESC+(i?"f":"[1;5C"))):o.key=t?n.C0.ESC+"OC":n.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(o.key=n.C0.ESC+"[1;"+(a+1)+"A",i||o.key!==n.C0.ESC+"[1;3A"||(o.key=n.C0.ESC+"[1;5A")):o.key=t?n.C0.ESC+"OA":n.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(o.key=n.C0.ESC+"[1;"+(a+1)+"B",i||o.key!==n.C0.ESC+"[1;3B"||(o.key=n.C0.ESC+"[1;5B")):o.key=t?n.C0.ESC+"OB":n.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(o.key=n.C0.ESC+"[2~");break;case 46:o.key=a?n.C0.ESC+"[3;"+(a+1)+"~":n.C0.ESC+"[3~";break;case 36:o.key=a?n.C0.ESC+"[1;"+(a+1)+"H":t?n.C0.ESC+"OH":n.C0.ESC+"[H";break;case 35:o.key=a?n.C0.ESC+"[1;"+(a+1)+"F":t?n.C0.ESC+"OF":n.C0.ESC+"[F";break;case 33:e.shiftKey?o.type=2:o.key=n.C0.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:o.key=n.C0.ESC+"[6~";break;case 112:o.key=a?n.C0.ESC+"[1;"+(a+1)+"P":n.C0.ESC+"OP";break;case 113:o.key=a?n.C0.ESC+"[1;"+(a+1)+"Q":n.C0.ESC+"OQ";break;case 114:o.key=a?n.C0.ESC+"[1;"+(a+1)+"R":n.C0.ESC+"OR";break;case 115:o.key=a?n.C0.ESC+"[1;"+(a+1)+"S":n.C0.ESC+"OS";break;case 116:o.key=a?n.C0.ESC+"[15;"+(a+1)+"~":n.C0.ESC+"[15~";break;case 117:o.key=a?n.C0.ESC+"[17;"+(a+1)+"~":n.C0.ESC+"[17~";break;case 118:o.key=a?n.C0.ESC+"[18;"+(a+1)+"~":n.C0.ESC+"[18~";break;case 119:o.key=a?n.C0.ESC+"[19;"+(a+1)+"~":n.C0.ESC+"[19~";break;case 120:o.key=a?n.C0.ESC+"[20;"+(a+1)+"~":n.C0.ESC+"[20~";break;case 121:o.key=a?n.C0.ESC+"[21;"+(a+1)+"~":n.C0.ESC+"[21~";break;case 122:o.key=a?n.C0.ESC+"[23;"+(a+1)+"~":n.C0.ESC+"[23~";break;case 123:o.key=a?n.C0.ESC+"[24;"+(a+1)+"~":n.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!s||!e.altKey||e.metaKey)i&&!e.altKey&&!e.ctrlKey&&e.metaKey?65===e.keyCode&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?o.key=e.key:e.key&&e.ctrlKey&&"_"===e.key&&(o.key=n.C0.US);else{var l=r[e.keyCode],c=l&&l[e.shiftKey?1:0];if(c)o.key=n.C0.ESC+c;else if(e.keyCode>=65&&e.keyCode<=90){var u=e.ctrlKey?e.keyCode-64:e.keyCode+32;o.key=n.C0.ESC+String.fromCharCode(u)}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?o.key=n.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?o.key=n.C0.DEL:219===e.keyCode?o.key=n.C0.ESC:220===e.keyCode?o.key=n.C0.FS:221===e.keyCode&&(o.key=n.C0.GS)}return o}},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;var a=i(31),l=i(0),c=i(2),u=i(32),h=i(7),d=i(1),f=i(5),p=function(e){function t(t,i,n,r,s,o){var c=e.call(this)||this;if(c._renderer=t,c._rowCount=i,c._isPaused=!1,c._needsFullRefresh=!1,c._isNextRenderRedrawOnly=!0,c._needsSelectionRefresh=!1,c._canvasWidth=0,c._canvasHeight=0,c._selectionState={start:void 0,end:void 0,columnSelectMode:!1},c._onDimensionsChange=new l.EventEmitter,c._onRender=new l.EventEmitter,c._onRefreshRequest=new l.EventEmitter,c.register({dispose:function(){return c._renderer.dispose()}}),c._renderDebouncer=new a.RenderDebouncer((function(e,t){return c._renderRows(e,t)})),c.register(c._renderDebouncer),c._screenDprMonitor=new u.ScreenDprMonitor,c._screenDprMonitor.setListener((function(){return c.onDevicePixelRatioChange()})),c.register(c._screenDprMonitor),c.register(o.onResize((function(e){return c._fullRefresh()}))),c.register(r.onOptionChange((function(){return c._renderer.onOptionsChanged()}))),c.register(s.onCharSizeChange((function(){return c.onCharSizeChanged()}))),c._renderer.onRequestRedraw((function(e){return c.refreshRows(e.start,e.end,!0)})),c.register(h.addDisposableDomListener(window,"resize",(function(){return c.onDevicePixelRatioChange()}))),"IntersectionObserver"in window){var d=new IntersectionObserver((function(e){return c._onIntersectionChange(e[e.length-1])}),{threshold:0});d.observe(n),c.register({dispose:function(){return d.disconnect()}})}return c}return r(t,e),Object.defineProperty(t.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),t.prototype._onIntersectionChange=function(e){this._isPaused=0===e.intersectionRatio,!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},t.prototype.refreshRows=function(e,t,i){void 0===i&&(i=!1),this._isPaused?this._needsFullRefresh=!0:(i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))},t.prototype._renderRows=function(e,t){this._renderer.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0},t.prototype.resize=function(e,t){this._rowCount=t,this._fireOnCanvasResize()},t.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},t.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.setRenderer=function(e){var t=this;this._renderer.dispose(),this._renderer=e,this._renderer.onRequestRedraw((function(e){return t.refreshRows(e.start,e.end,!0)})),this._needsSelectionRefresh=!0,this._fullRefresh()},t.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},t.prototype.setColors=function(e){this._renderer.setColors(e),this._fullRefresh()},t.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},t.prototype.onResize=function(e,t){this._renderer.onResize(e,t),this._fullRefresh()},t.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},t.prototype.onBlur=function(){this._renderer.onBlur()},t.prototype.onFocus=function(){this._renderer.onFocus()},t.prototype.onSelectionChanged=function(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.onSelectionChanged(e,t,i)},t.prototype.onCursorMove=function(){this._renderer.onCursorMove()},t.prototype.clear=function(){this._renderer.clear()},t.prototype.registerCharacterJoiner=function(e){return this._renderer.registerCharacterJoiner(e)},t.prototype.deregisterCharacterJoiner=function(e){return this._renderer.deregisterCharacterJoiner(e)},s([o(3,d.IOptionsService),o(4,f.ICharSizeService),o(5,d.IBufferService)],t)}(c.Disposable);t.RenderService=p},function(e,t,i){"use strict";var n=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;var s=i(1),o=i(0),a=function(){function e(e,t,i){this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=new o.EventEmitter,this._measureStrategy=new l(e,t,this._optionsService)}return Object.defineProperty(e.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),e.prototype.measure=function(){var e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())},n([r(2,s.IOptionsService)],e)}();t.CharSizeService=a;var l=function(){function e(e,t,i){this._document=e,this._parentElement=t,this._optionsService=i,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 e.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var e=this._measureElement.getBoundingClientRect();return 0!==e.width&&0!==e.height&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result},e}()},function(e,t,i){"use strict";var n=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;var s=i(5),o=i(30),a=function(){function e(e,t){this._renderService=e,this._charSizeService=t}return e.prototype.getCoords=function(e,t,i,n,r){return o.getCoords(e,t,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,r)},e.prototype.getRawByteCoords=function(e,t,i,n){var r=this.getCoords(e,t,i,n);return o.getRawByteCoords(r)},n([r(0,s.IRenderService),r(1,s.ICharSizeService)],e)}();t.MouseService=a},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;var a=i(1),l=i(0),c=i(2),u=i(7),h=function(e){function t(t){var i=e.call(this)||this;return i._bufferService=t,i._linkProviders=[],i._linkCacheDisposables=[],i._isMouseOut=!0,i._activeLine=-1,i._onShowLinkUnderline=i.register(new l.EventEmitter),i._onHideLinkUnderline=i.register(new l.EventEmitter),i.register(c.getDisposeArrayDisposable(i._linkCacheDisposables)),i}return r(t,e),Object.defineProperty(t.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),t.prototype.registerLinkProvider=function(e){var t=this;return this._linkProviders.push(e),{dispose:function(){var i=t._linkProviders.indexOf(e);-1!==i&&t._linkProviders.splice(i,1)}}},t.prototype.attachToDom=function(e,t,i){var n=this;this._element=e,this._mouseService=t,this._renderService=i,this.register(u.addDisposableDomListener(this._element,"mouseleave",(function(){n._isMouseOut=!0,n._clearCurrentLink()}))),this.register(u.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(u.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},t.prototype._onMouseMove=function(e){if(this._lastMouseEvent=e,this._element&&this._mouseService){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(t){this._isMouseOut=!1;for(var i=e.composedPath(),n=0;n<i.length;n++){var r=i[n];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._onHover(t),this._lastBufferCell=t)}}},t.prototype._onHover=function(e){if(this._activeLine!==e.y)return this._clearCurrentLink(),void this._askForLink(e,!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))},t.prototype._askForLink=function(e,t){var i=this;this._activeProviderReplies&&t||(this._activeProviderReplies=new Map,this._activeLine=e.y);var n=!1;this._linkProviders.forEach((function(r,s){var o;t?(null===(o=i._activeProviderReplies)||void 0===o?void 0:o.get(s))&&(n=i._checkLinkProviderResult(s,e,n)):r.provideLinks(e.y,(function(t){var r,o;if(!i._isMouseOut){var a=null==t?void 0:t.map((function(e){return{link:e}}));null===(r=i._activeProviderReplies)||void 0===r||r.set(s,a),n=i._checkLinkProviderResult(s,e,n),(null===(o=i._activeProviderReplies)||void 0===o?void 0:o.size)===i._linkProviders.length&&i._removeIntersectingLinks(e.y,i._activeProviderReplies)}}))}))},t.prototype._removeIntersectingLinks=function(e,t){for(var i=new Set,n=0;n<t.size;n++){var r=t.get(n);if(r)for(var s=0;s<r.length;s++)for(var o=r[s],a=o.link.range.start.y<e?0:o.link.range.start.x,l=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x,c=a;c<=l;c++){if(i.has(c)){r.splice(s--,1);break}i.add(c)}}},t.prototype._checkLinkProviderResult=function(e,t,i){var n,r=this;if(!this._activeProviderReplies)return i;for(var s=this._activeProviderReplies.get(e),o=!1,a=0;a<e;a++)this._activeProviderReplies.has(a)&&!this._activeProviderReplies.get(a)||(o=!0);if(!o&&s){var l=s.find((function(e){return r._linkAtPosition(e.link,t)}));l&&(i=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviders.length&&!i)for(a=0;a<this._activeProviderReplies.size;a++){var c=null===(n=this._activeProviderReplies.get(a))||void 0===n?void 0:n.find((function(e){return r._linkAtPosition(e.link,t)}));if(c){i=!0,this._handleNewLink(c);break}}return i},t.prototype._onClick=function(e){if(this._element&&this._mouseService&&this._currentLink){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}},t.prototype._clearCurrentLink=function(e,t){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,c.disposeArray(this._linkCacheDisposables))},t.prototype._handleNewLink=function(e){var t=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:function(){var e,i;return null===(i=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===i?void 0:i.decorations.pointerCursor},set:function(e){var i,n;(null===(i=t._currentLink)||void 0===i?void 0:i.state)&&t._currentLink.state.decorations.pointerCursor!==e&&(t._currentLink.state.decorations.pointerCursor=e,t._currentLink.state.isHovered&&(null===(n=t._element)||void 0===n||n.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:function(){var e,i;return null===(i=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===i?void 0:i.decorations.underline},set:function(i){var n,r,s;(null===(n=t._currentLink)||void 0===n?void 0:n.state)&&(null===(s=null===(r=t._currentLink)||void 0===r?void 0:r.state)||void 0===s?void 0:s.decorations.underline)!==i&&(t._currentLink.state.decorations.underline=i,t._currentLink.state.isHovered&&t._fireUnderlineEvent(e.link,i))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange((function(e){var i=0===e.start?0:e.start+1+t._bufferService.buffer.ydisp;t._clearCurrentLink(i,e.end+1+t._bufferService.buffer.ydisp)}))))}},t.prototype._linkHover=function(e,t,i){var n;(null===(n=this._currentLink)||void 0===n?void 0:n.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)},t.prototype._fireUnderlineEvent=function(e,t){var i=e.range,n=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-n-1,i.end.x,i.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)},t.prototype._linkLeave=function(e,t,i){var n;(null===(n=this._currentLink)||void 0===n?void 0:n.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)},t.prototype._linkAtPosition=function(e,t){var i=e.range.start.y===e.range.end.y,n=e.range.start.y<t.y,r=e.range.end.y>t.y;return(i&&e.range.start.x<=t.x&&e.range.end.x>=t.x||n&&e.range.end.x>=t.x||r&&e.range.start.x<=t.x||n&&r)&&e.range.start.y<=t.y&&e.range.end.y>=t.y},t.prototype._positionFromMouseEvent=function(e,t,i){var n=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}},t.prototype._createLinkUnderlineEvent=function(e,t,i,n,r){return{x1:e,y1:t,x2:i,y2:n,cols:this._bufferService.cols,fg:r}},s([o(0,a.IBufferService)],t)}(c.Disposable);t.Linkifier2=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;var n=function(){function e(e){this._textarea=e}return Object.defineProperty(e.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),e}();t.CoreBrowserService=n},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;var s=i(2),o=i(1),a=i(66),l=i(67),c=i(68),u=i(74),h=i(75),d=i(0),f=i(76),p=i(77),_=i(78),g=i(80),m=i(81),v=i(19),y=i(82),b=function(e){function t(t){var i=e.call(this)||this;return i._onBinary=new d.EventEmitter,i._onData=new d.EventEmitter,i._onLineFeed=new d.EventEmitter,i._onResize=new d.EventEmitter,i._onScroll=new d.EventEmitter,i._instantiationService=new a.InstantiationService,i.optionsService=new u.OptionsService(t),i._instantiationService.setService(o.IOptionsService,i.optionsService),i._bufferService=i.register(i._instantiationService.createInstance(c.BufferService)),i._instantiationService.setService(o.IBufferService,i._bufferService),i._logService=i._instantiationService.createInstance(l.LogService),i._instantiationService.setService(o.ILogService,i._logService),i._coreService=i.register(i._instantiationService.createInstance(h.CoreService,(function(){return i.scrollToBottom()}))),i._instantiationService.setService(o.ICoreService,i._coreService),i._coreMouseService=i._instantiationService.createInstance(f.CoreMouseService),i._instantiationService.setService(o.ICoreMouseService,i._coreMouseService),i._dirtyRowService=i._instantiationService.createInstance(p.DirtyRowService),i._instantiationService.setService(o.IDirtyRowService,i._dirtyRowService),i.unicodeService=i._instantiationService.createInstance(_.UnicodeService),i._instantiationService.setService(o.IUnicodeService,i.unicodeService),i._charsetService=i._instantiationService.createInstance(g.CharsetService),i._instantiationService.setService(o.ICharsetService,i._charsetService),i._inputHandler=new v.InputHandler(i._bufferService,i._charsetService,i._coreService,i._dirtyRowService,i._logService,i.optionsService,i._coreMouseService,i.unicodeService),i.register(d.forwardEvent(i._inputHandler.onLineFeed,i._onLineFeed)),i.register(i._inputHandler),i.register(d.forwardEvent(i._bufferService.onResize,i._onResize)),i.register(d.forwardEvent(i._coreService.onData,i._onData)),i.register(d.forwardEvent(i._coreService.onBinary,i._onBinary)),i.register(i.optionsService.onOptionChange((function(e){return i._updateOptions(e)}))),i._writeBuffer=new y.WriteBuffer((function(e){return i._inputHandler.parse(e)})),i}return r(t,e),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)},t.prototype.write=function(e,t){this._writeBuffer.write(e,t)},t.prototype.writeSync=function(e){this._writeBuffer.writeSync(e)},t.prototype.resize=function(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,c.MINIMUM_COLS),t=Math.max(t,c.MINIMUM_ROWS),this._bufferService.resize(e,t))},t.prototype.scroll=function(e,t){void 0===t&&(t=!1);var i,n=this._bufferService.buffer;(i=this._cachedBlankLine)&&i.length===this.cols&&i.getFg(0)===e.fg&&i.getBg(0)===e.bg||(i=n.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;var r=n.ybase+n.scrollTop,s=n.ybase+n.scrollBottom;if(0===n.scrollTop){var o=n.lines.isFull;s===n.lines.length-1?o?n.lines.recycle().copyFrom(i):n.lines.push(i.clone()):n.lines.splice(s+1,0,i.clone()),o?this._bufferService.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this._bufferService.isUserScrolling||n.ydisp++)}else{var a=s-r+1;n.lines.shiftElements(r+1,a-1,-1),n.lines.set(s,i.clone())}this._bufferService.isUserScrolling||(n.ydisp=n.ybase),this._dirtyRowService.markRangeDirty(n.scrollTop,n.scrollBottom),this._onScroll.fire(n.ydisp)},t.prototype.scrollLines=function(e,t){var i=this._bufferService.buffer;if(e<0){if(0===i.ydisp)return;this._bufferService.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this._bufferService.isUserScrolling=!1);var n=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),n!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))},t.prototype.scrollPages=function(e){this.scrollLines(e*(this.rows-1))},t.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},t.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},t.prototype.scrollToLine=function(e){var t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)},t.prototype.addEscHandler=function(e,t){return this._inputHandler.addEscHandler(e,t)},t.prototype.addDcsHandler=function(e,t){return this._inputHandler.addDcsHandler(e,t)},t.prototype.addCsiHandler=function(e,t){return this._inputHandler.addCsiHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._inputHandler.addOscHandler(e,t)},t.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},t.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},t.prototype._updateOptions=function(e){var t;switch(e){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():(null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)}},t.prototype._enableWindowsMode=function(){var e=this;if(!this._windowsMode){var t=[];t.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),t.push(this.addCsiHandler({final:"H"},(function(){return m.updateWindowsModeWrappedState(e._bufferService),!1}))),this._windowsMode={dispose:function(){for(var e=0,i=t;e<i.length;e++)i[e].dispose()}}}},t}(s.Disposable);t.CoreTerminal=b},function(e,t,i){"use strict";var n=this&&this.__spreadArrays||function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<i;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)n[r]=s[o];return n};Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;var r=i(1),s=i(14),o=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._entries=new Map;for(var i=0,n=e;i<n.length;i++){var r=n[i],s=r[0],o=r[1];this.set(s,o)}}return e.prototype.set=function(e,t){var i=this._entries.get(e);return this._entries.set(e,t),i},e.prototype.forEach=function(e){this._entries.forEach((function(t,i){return e(i,t)}))},e.prototype.has=function(e){return this._entries.has(e)},e.prototype.get=function(e){return this._entries.get(e)},e}();t.ServiceCollection=o;var a=function(){function e(){this._services=new o,this._services.set(r.IInstantiationService,this)}return e.prototype.setService=function(e,t){this._services.set(e,t)},e.prototype.getService=function(e){return this._services.get(e)},e.prototype.createInstance=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var r=s.getServiceDependencies(e).sort((function(e,t){return e.index-t.index})),o=[],a=0,l=r;a<l.length;a++){var c=l[a],u=this._services.get(c.id);if(!u)throw new Error("[createInstance] "+e.name+" depends on UNKNOWN service "+c.id+".");o.push(u)}var h=r.length>0?r[0].index:t.length;if(t.length!==h)throw new Error("[createInstance] First service dependency of "+e.name+" at position "+(h+1)+" conflicts with "+t.length+" static arguments");return new(e.bind.apply(e,n([void 0],n(t,o))))},e}();t.InstantiationService=a},function(e,t,i){"use strict";var n=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<i;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)n[r]=s[o];return n};Object.defineProperty(t,"__esModule",{value:!0}),t.LogService=t.LogLevel=void 0;var o,a=i(1);!function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.OFF=4]="OFF"}(o=t.LogLevel||(t.LogLevel={}));var l={debug:o.DEBUG,info:o.INFO,warn:o.WARN,error:o.ERROR,off:o.OFF},c=function(){function e(e){var t=this;this._optionsService=e,this._updateLogLevel(),this._optionsService.onOptionChange((function(e){"logLevel"===e&&t._updateLogLevel()}))}return e.prototype._updateLogLevel=function(){this._logLevel=l[this._optionsService.options.logLevel]},e.prototype._evalLazyOptionalParams=function(e){for(var t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())},e.prototype._log=function(e,t,i){this._evalLazyOptionalParams(i),e.call.apply(e,s([console,"xterm.js: "+t],i))},e.prototype.debug=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];this._logLevel<=o.DEBUG&&this._log(console.log,e,t)},e.prototype.info=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];this._logLevel<=o.INFO&&this._log(console.info,e,t)},e.prototype.warn=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];this._logLevel<=o.WARN&&this._log(console.warn,e,t)},e.prototype.error=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];this._logLevel<=o.ERROR&&this._log(console.error,e,t)},n([r(0,a.IOptionsService)],e)}();t.LogService=c},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;var a=i(1),l=i(69),c=i(0),u=i(2);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;var h=function(e){function i(i){var n=e.call(this)||this;return n._optionsService=i,n.isUserScrolling=!1,n._onResize=new c.EventEmitter,n.cols=Math.max(i.options.cols,t.MINIMUM_COLS),n.rows=Math.max(i.options.rows,t.MINIMUM_ROWS),n.buffers=new l.BufferSet(i,n),n}return r(i,e),Object.defineProperty(i.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),i.prototype.dispose=function(){e.prototype.dispose.call(this),this.buffers.dispose()},i.prototype.resize=function(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:t})},i.prototype.reset=function(){this.buffers.dispose(),this.buffers=new l.BufferSet(this._optionsService,this),this.isUserScrolling=!1},s([o(0,a.IOptionsService)],i)}(u.Disposable);t.BufferService=h},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;var s=i(70),o=i(0),a=function(e){function t(t,i){var n=e.call(this)||this;return n._onBufferActivate=n.register(new o.EventEmitter),n._normal=new s.Buffer(!0,t,i),n._normal.fillViewportRows(),n._alt=new s.Buffer(!1,t,i),n._activeBuffer=n._normal,n.setupTabStops(),n}return r(t,e),Object.defineProperty(t.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),t.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}))},t.prototype.activateAltBuffer=function(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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}))},t.prototype.resize=function(e,t){this._normal.resize(e,t),this._alt.resize(e,t)},t.prototype.setupTabStops=function(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)},t}(i(2).Disposable);t.BufferSet=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStringIterator=t.Buffer=t.MAX_BUFFER_SIZE=void 0;var n=i(71),r=i(16),s=i(4),o=i(3),a=i(72),l=i(73),c=i(20),u=i(6);t.MAX_BUFFER_SIZE=4294967295;var h=function(){function e(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=r.DEFAULT_ATTR_DATA.clone(),this.savedCharset=c.DEFAULT_CHARSET,this.markers=[],this._nullCell=s.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=s.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return e.prototype.getNullCell=function(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell},e.prototype.getWhitespaceCell=function(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell},e.prototype.getBlankLine=function(e,t){return new r.BufferLine(this._bufferService.cols,this.getNullCell(e),t)},Object.defineProperty(e.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCursorInViewport",{get:function(){var e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows},enumerable:!1,configurable:!0}),e.prototype._getCorrectBufferLength=function(e){if(!this._hasScrollback)return e;var i=e+this._optionsService.options.scrollback;return i>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i},e.prototype.fillViewportRows=function(e){if(0===this.lines.length){void 0===e&&(e=r.DEFAULT_ATTR_DATA);for(var t=this._rows;t--;)this.lines.push(this.getBlankLine(e))}},e.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},e.prototype.resize=function(e,t){var i=this.getNullCell(r.DEFAULT_ATTR_DATA),n=this._getCorrectBufferLength(t);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(var s=0;s<this.lines.length;s++)this.lines.get(s).resize(e,i);var o=0;if(this._rows<t)for(var a=this._rows;a<t;a++)this.lines.length<t+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new r.BufferLine(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new r.BufferLine(e,i)));else for(a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n<this.lines.maxLength){var l=this.lines.length-n;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(s=0;s<this.lines.length;s++)this.lines.get(s).resize(e,i);this._cols=e,this._rows=t},Object.defineProperty(e.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!1,configurable:!0}),e.prototype._reflow=function(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))},e.prototype._reflowLarger=function(e,t){var i=a.reflowLargerGetLinesToRemove(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(r.DEFAULT_ATTR_DATA));if(i.length>0){var n=a.reflowLargerCreateNewLayout(this.lines,i);a.reflowLargerApplyNewLayout(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}},e.prototype._reflowLargerAdjustViewport=function(e,t,i){for(var n=this.getNullCell(r.DEFAULT_ATTR_DATA),s=i;s-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new r.BufferLine(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)},e.prototype._reflowSmaller=function(e,t){for(var i=this.getNullCell(r.DEFAULT_ATTR_DATA),n=[],s=0,o=this.lines.length-1;o>=0;o--){var l=this.lines.get(o);if(!(!l||!l.isWrapped&&l.getTrimmedLength()<=e)){for(var c=[l];l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);var u=this.ybase+this.y;if(!(u>=o&&u<o+c.length)){var h=c[c.length-1].getTrimmedLength(),d=a.reflowSmallerGetNewLineLengths(c,this._cols,e),f=d.length-c.length,p=void 0;p=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+f):Math.max(0,this.lines.length-this.lines.maxLength+f);for(var _=[],g=0;g<f;g++){var m=this.getBlankLine(r.DEFAULT_ATTR_DATA,!0);_.push(m)}_.length>0&&(n.push({start:o+c.length+s,newLines:_}),s+=_.length),c.push.apply(c,_);var v=d.length-1,y=d[v];0===y&&(y=d[--v]);for(var b=c.length-f-1,S=h;b>=0;){var E=Math.min(S,y);if(c[v].copyCellsFrom(c[b],S-E,y-E,E,!0),0==(y-=E)&&(y=d[--v]),0==(S-=E)){b--;var w=Math.max(b,0);S=a.getWrappedLineTrimmedLength(c,w,this._cols)}}for(g=0;g<c.length;g++)d[g]<e&&c[g].setCell(d[g],i);for(var C=f-p;C-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+f,this.ybase+t-1)}}}if(n.length>0){var k=[],T=[];for(g=0;g<this.lines.length;g++)T.push(this.lines.get(g));var A=this.lines.length,x=A-1,D=0,L=n[D];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);var R=0;for(g=Math.min(this.lines.maxLength-1,A+s-1);g>=0;g--)if(L&&L.start>x+R){for(var I=L.newLines.length-1;I>=0;I--)this.lines.set(g--,L.newLines[I]);g++,k.push({index:x+1,amount:L.newLines.length}),R+=L.newLines.length,L=n[++D]}else this.lines.set(g,T[x--]);var P=0;for(g=k.length-1;g>=0;g--)k[g].index+=P,this.lines.onInsertEmitter.fire(k[g]),P+=k[g].amount;var O=Math.max(0,A+s-this.lines.maxLength);O>0&&this.lines.onTrimEmitter.fire(O)}},e.prototype.stringIndexToBufferIndex=function(e,t,i){for(void 0===i&&(i=!1);t;){var n=this.lines.get(e);if(!n)return[-1,-1];for(var r=i?n.getTrimmedLength():n.length,s=0;s<r;++s)if(n.get(s)[o.CHAR_DATA_WIDTH_INDEX]&&(t-=n.get(s)[o.CHAR_DATA_CHAR_INDEX].length||1),t<0)return[e,s];e++}return[e,0]},e.prototype.translateBufferLineToString=function(e,t,i,n){void 0===i&&(i=0);var r=this.lines.get(e);return r?r.translateToString(t,i,n):""},e.prototype.getWrappedRangeForLine=function(e){for(var t=e,i=e;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}},e.prototype.setupTabStops=function(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.options.tabStopWidth)this.tabs[e]=!0},e.prototype.prevStop=function(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e},e.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e},e.prototype.addMarker=function(e){var t=this,i=new l.Marker(e);return this.markers.push(i),i.register(this.lines.onTrim((function(e){i.line-=e,i.line<0&&i.dispose()}))),i.register(this.lines.onInsert((function(e){i.line>=e.index&&(i.line+=e.amount)}))),i.register(this.lines.onDelete((function(e){i.line>=e.index&&i.line<e.index+e.amount&&i.dispose(),i.line>e.index&&(i.line-=e.amount)}))),i.register(i.onDispose((function(){return t._removeMarker(i)}))),i},e.prototype._removeMarker=function(e){this.markers.splice(this.markers.indexOf(e),1)},e.prototype.iterator=function(e,t,i,n,r){return new d(this,e,t,i,n,r)},e}();t.Buffer=h;var d=function(){function e(e,t,i,n,r,s){void 0===i&&(i=0),void 0===n&&(n=e.lines.length),void 0===r&&(r=0),void 0===s&&(s=0),this._buffer=e,this._trimRight=t,this._startIndex=i,this._endIndex=n,this._startOverscan=r,this._endOverscan=s,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return e.prototype.hasNext=function(){return this._current<this._endIndex},e.prototype.next=function(){var e=this._buffer.getWrappedRangeForLine(this._current);e.first<this._startIndex-this._startOverscan&&(e.first=this._startIndex-this._startOverscan),e.last>this._endIndex+this._endOverscan&&(e.last=this._endIndex+this._endOverscan),e.first=Math.max(e.first,0),e.last=Math.min(e.last,this._buffer.lines.length);for(var t="",i=e.first;i<=e.last;++i)t+=this._buffer.translateBufferLineToString(i,this._trimRight);return this._current=e.last+1,{range:e,content:t}},e}();t.BufferStringIterator=d},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;var n=i(0),r=function(){function e(e){this._maxLength=e,this.onDeleteEmitter=new n.EventEmitter,this.onInsertEmitter=new n.EventEmitter,this.onTrimEmitter=new n.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(e.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLength",{get:function(){return this._maxLength},set:function(e){if(this._maxLength!==e){for(var t=new Array(e),i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},set:function(e){if(e>this._length)for(var t=this._length;t<e;t++)this._array[t]=void 0;this._length=e},enumerable:!1,configurable:!0}),e.prototype.get=function(e){return this._array[this._getCyclicIndex(e)]},e.prototype.set=function(e,t){this._array[this._getCyclicIndex(e)]=t},e.prototype.push=function(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},e.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(e.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!1,configurable:!0}),e.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},e.prototype.splice=function(e,t){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];if(t){for(var r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t}for(r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(r=0;r<i.length;r++)this._array[this._getCyclicIndex(e+r)]=i[r];if(this._length+i.length>this._maxLength){var s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length},e.prototype.trimStart=function(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)},e.prototype.shiftElements=function(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(var n=t-1;n>=0;n--)this.set(e+n+i,this.get(e+n));var r=e+t+i-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(n=0;n<t;n++)this.set(e+n+i,this.get(e+n))}},e.prototype._getCyclicIndex=function(e){return(this._startIndex+e)%this._maxLength},e}();t.CircularList=r},function(e,t,i){"use strict";function n(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();var n=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),r=2===e[t+1].getWidth(0);return n&&r?i-1:i}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,i,r,s){for(var o=[],a=0;a<e.length-1;a++){var l=a,c=e.get(++l);if(c.isWrapped){for(var u=[e.get(a)];l<e.length&&c.isWrapped;)u.push(c),c=e.get(++l);if(r>=a&&r<l)a+=u.length-1;else{for(var h=0,d=n(u,h,t),f=1,p=0;f<u.length;){var _=n(u,f,t),g=_-p,m=i-d,v=Math.min(g,m);u[h].copyCellsFrom(u[f],p,d,v,!1),(d+=v)===i&&(h++,d=0),(p+=v)===_&&(f++,p=0),0===d&&0!==h&&2===u[h-1].getWidth(i-1)&&(u[h].copyCellsFrom(u[h-1],i-1,d++,1,!1),u[h-1].setCell(i-1,s))}u[h].replaceCells(d,i,s);for(var y=0,b=u.length-1;b>0&&(b>h||0===u[b].getTrimmedLength());b--)y++;y>0&&(o.push(a+u.length-y),o.push(y)),a+=u.length-1}}}return o},t.reflowLargerCreateNewLayout=function(e,t){for(var i=[],n=0,r=t[n],s=0,o=0;o<e.length;o++)if(r===o){var a=t[++n];e.onDeleteEmitter.fire({index:o-s,amount:a}),o+=a-1,s+=a,r=t[++n]}else i.push(o);return{layout:i,countRemoved:s}},t.reflowLargerApplyNewLayout=function(e,t){for(var i=[],n=0;n<t.length;n++)i.push(e.get(t[n]));for(n=0;n<i.length;n++)e.set(n,i[n]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,i){for(var r=[],s=e.map((function(i,r){return n(e,r,t)})).reduce((function(e,t){return e+t})),o=0,a=0,l=0;l<s;){if(s-l<i){r.push(s-l);break}o+=i;var c=n(e,a,t);o>c&&(o-=c,a++);var u=2===e[a].getWidth(o-1);u&&o--;var h=u?i-1:i;r.push(h),l+=h}return r},t.getWrappedLineTrimmedLength=n},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;var s=i(0),o=function(e){function t(i){var n=e.call(this)||this;return n.line=i,n._id=t._nextId++,n.isDisposed=!1,n._onDispose=new s.EventEmitter,n}return r(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire())},t._nextId=1,t}(i(2).Disposable);t.Marker=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=t.DEFAULT_BELL_SOUND=void 0;var n=i(0),r=i(11),s=i(33);t.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",t.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:t.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:r.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",convertEol:!1,termName:"xterm",cancelEvents:!1});var o=["cols","rows"],a=function(){function e(e){this._onOptionChange=new n.EventEmitter,this.options=s.clone(t.DEFAULT_OPTIONS);for(var i=0,r=Object.keys(e);i<r.length;i++){var o=r[i];if(o in this.options){var a=e[o];this.options[o]=a}}}return Object.defineProperty(e.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},enumerable:!1,configurable:!0}),e.prototype.setOption=function(e,i){if(!(e in t.DEFAULT_OPTIONS))throw new Error('No option with key "'+e+'"');if(-1!==o.indexOf(e))throw new Error('Option "'+e+'" can only be set in the constructor');this.options[e]!==i&&(i=this._sanitizeAndValidateOption(e,i),this.options[e]!==i&&(this.options[e]=i,this._onOptionChange.fire(e)))},e.prototype._sanitizeAndValidateOption=function(e,i){switch(e){case"bellStyle":case"cursorStyle":case"fontWeight":case"fontWeightBold":case"rendererType":case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[e]);break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(e+" cannot be less than 1, value: "+i);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(e+" cannot be less than 0, value: "+i);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(e+" cannot be less than or equal to 0, value: "+i)}return i},e.prototype.getOption=function(e){if(!(e in t.DEFAULT_OPTIONS))throw new Error('No option with key "'+e+'"');return this.options[e]},e}();t.OptionsService=a},function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;var a=i(1),l=i(0),c=i(33),u=i(2),h=Object.freeze({insertMode:!1}),d=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),f=function(e){function t(t,i,n,r){var s=e.call(this)||this;return s._bufferService=i,s._logService=n,s._optionsService=r,s.isCursorInitialized=!1,s.isCursorHidden=!1,s._onData=s.register(new l.EventEmitter),s._onUserInput=s.register(new l.EventEmitter),s._onBinary=s.register(new l.EventEmitter),s._scrollToBottom=t,s.register({dispose:function(){return s._scrollToBottom=void 0}}),s.modes=c.clone(h),s.decPrivateModes=c.clone(d),s}return r(t,e),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.modes=c.clone(h),this.decPrivateModes=c.clone(d)},t.prototype.triggerDataEvent=function(e,t){if(void 0===t&&(t=!1),!this._optionsService.options.disableStdin){var i=this._bufferService.buffer;i.ybase!==i.ydisp&&this._scrollToBottom(),t&&this._onUserInput.fire(),this._logService.debug('sending data "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onData.fire(e)}},t.prototype.triggerBinaryEvent=function(e){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onBinary.fire(e))},s([o(1,a.IBufferService),o(2,a.ILogService),o(3,a.IOptionsService)],t)}(u.Disposable);t.CoreService=f},function(e,t,i){"use strict";var n=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;var s=i(1),o=i(0),a={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(e){return 4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)}},VT200:{events:19,restrict:function(e){return 32!==e.action}},DRAG:{events:23,restrict:function(e){return 32!==e.action||3!==e.button}},ANY:{events:31,restrict:function(e){return!0}}};function l(e,t){var i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0!==e.action||t||(i|=3)),i}var c=String.fromCharCode,u={DEFAULT:function(e){var t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":""+c(t[0])+c(t[1])+c(t[2])},SGR:function(e){var t=0===e.action&&4!==e.button?"m":"M";return"[<"+l(e,!0)+";"+e.col+";"+e.row+t}},h=function(){function e(e,t){this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new o.EventEmitter,this._lastEvent=null;for(var i=0,n=Object.keys(a);i<n.length;i++){var r=n[i];this.addProtocol(r,a[r])}for(var s=0,l=Object.keys(u);s<l.length;s++){var c=l[s];this.addEncoding(c,u[c])}this.reset()}return e.prototype.addProtocol=function(e,t){this._protocols[e]=t},e.prototype.addEncoding=function(e,t){this._encodings[e]=t},Object.defineProperty(e.prototype,"activeProtocol",{get:function(){return this._activeProtocol},set:function(e){if(!this._protocols[e])throw new Error('unknown protocol "'+e+'"');this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"areMouseEventsActive",{get:function(){return 0!==this._protocols[this._activeProtocol].events},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeEncoding",{get:function(){return this._activeEncoding},set:function(e){if(!this._encodings[e])throw new Error('unknown encoding "'+e+'"');this._activeEncoding=e},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null},Object.defineProperty(e.prototype,"onProtocolChange",{get:function(){return this._onProtocolChange.event},enumerable:!1,configurable:!0}),e.prototype.triggerMouseEvent=function(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._compareEvents(this._lastEvent,e))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;var t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0},e.prototype.explainEvents=function(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}},e.prototype._compareEvents=function(e,t){return e.col===t.col&&e.row===t.row&&e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift},n([r(0,s.IBufferService),r(1,s.ICoreService)],e)}();t.CoreMouseService=h},function(e,t,i){"use strict";var n=this&&this.__decorate||function(e,t,i,n){var r,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,n){t(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DirtyRowService=void 0;var s=i(1),o=function(){function e(e){this._bufferService=e,this.clearRange()}return Object.defineProperty(e.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),e.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},e.prototype.markDirty=function(e){e<this._start?this._start=e:e>this._end&&(this._end=e)},e.prototype.markRangeDirty=function(e,t){if(e>t){var i=e;e=t,t=i}e<this._start&&(this._start=e),t>this._end&&(this._end=t)},e.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},n([r(0,s.IBufferService)],e)}();t.DirtyRowService=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;var n=i(0),r=i(79),s=function(){function e(){this._providers=Object.create(null),this._active="",this._onChange=new n.EventEmitter;var e=new r.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}return Object.defineProperty(e.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._active},set:function(e){if(!this._providers[e])throw new Error('unknown Unicode version "'+e+'"');this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)},enumerable:!1,configurable:!0}),e.prototype.register=function(e){this._providers[e.version]=e},e.prototype.wcwidth=function(e){return this._activeProvider.wcwidth(e)},e.prototype.getStringCellWidth=function(e){for(var t=0,i=e.length,n=0;n<i;++n){var r=e.charCodeAt(n);if(55296<=r&&r<=56319){if(++n>=i)return t+this.wcwidth(r);var s=e.charCodeAt(n);56320<=s&&s<=57343?r=1024*(r-55296)+s-56320+65536:t+=this.wcwidth(s)}t+=this.wcwidth(r)}return t},e}();t.UnicodeService=s},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;var n,r=i(15),s=[[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]],o=[[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]],a=function(){function e(){if(this.version="6",!n){n=new Uint8Array(65536),r.fill(n,1),n[0]=0,r.fill(n,0,1,32),r.fill(n,0,127,160),r.fill(n,2,4352,4448),n[9001]=2,n[9002]=2,r.fill(n,2,11904,42192),n[12351]=1,r.fill(n,2,44032,55204),r.fill(n,2,63744,64256),r.fill(n,2,65040,65050),r.fill(n,2,65072,65136),r.fill(n,2,65280,65377),r.fill(n,2,65504,65511);for(var e=0;e<s.length;++e)r.fill(n,0,s[e][0],s[e][1]+1)}}return e.prototype.wcwidth=function(e){return e<32?0:e<127?1:e<65536?n[e]:function(e,t){var i,n=0,r=t.length-1;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(e>t[i=n+r>>1][1])n=i+1;else{if(!(e<t[i][0]))return!0;r=i-1}return!1}(e,o)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1},e}();t.UnicodeV6=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0;var n=function(){function e(){this.glevel=0,this._charsets=[]}return e.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},e.prototype.setgLevel=function(e){this.glevel=e,this.charset=this._charsets[e]},e.prototype.setgCharset=function(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)},e}();t.CharsetService=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;var n=i(3);t.updateWindowsModeWrappedState=function(e){var t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),i=null==t?void 0:t.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=i[n.CHAR_DATA_CODE_INDEX]!==n.NULL_CELL_CODE&&i[n.CHAR_DATA_CODE_INDEX]!==n.WHITESPACE_CELL_CODE)}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;var n=function(){function e(e){this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return e.prototype.writeSync=function(e){if(this._writeBuffer.length){for(var t=this._bufferOffset;t<this._writeBuffer.length;++t){var i=this._writeBuffer[t],n=this._callbacks[t];this._action(i),n&&n()}this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=2147483647}this._action(e)},e.prototype.write=function(e,t){var i=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 i._innerWrite()}))),this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)},e.prototype._innerWrite=function(){for(var e=this,t=Date.now();this._writeBuffer.length>this._bufferOffset;){var i=this._writeBuffer[this._bufferOffset],n=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(i),this._pendingData-=i.length,n&&n(),Date.now()-t>=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 e._innerWrite()}),0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},e}();t.WriteBuffer=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0;var n=function(){function e(){this._addons=[]}return e.prototype.dispose=function(){for(var e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()},e.prototype.loadAddon=function(e,t){var i=this,n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=function(){return i._wrappedAddonDispose(n)},t.activate(e)},e.prototype._wrappedAddonDispose=function(e){if(!e.isDisposed){for(var t=-1,i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(-1===t)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},e}();t.AddonManager=n}])},93314:function(e){"use strict";e.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=="},44523:function(e,t,i){"use strict";i.d(t,{ZP:function(){return ul}});const n=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},r=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=s},s=Number.MAX_SAFE_INTEGER||9007199254740991;let o=function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),a=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.ASSET_LIST_LOAD_ERROR="assetListLoadError",e.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",e.ASSET_LIST_PARSING_ERROR="assetListParsingError",e.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.ATTACH_MEDIA_ERROR="attachMediaError",e.UNKNOWN="unknown",e}({}),l=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.STALL_RESOLVED="hlsStallResolved",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFERED_TO_END="hlsBufferedToEnd",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e.ASSET_LIST_LOADING="hlsAssetListLoading",e.ASSET_LIST_LOADED="hlsAssetListLoaded",e.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",e.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",e.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",e.INTERSTITIAL_STARTED="hlsInterstitialStarted",e.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",e.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",e.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",e.INTERSTITIAL_ENDED="hlsInterstitialEnded",e.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",e.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",e.EVENT_CUE_ENTER="hlsEventCueEnter",e}({});var c="manifest",u="level",h="audioTrack",d="subtitleTrack",f="main",p="audio",_="subtitle";class g{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 m{constructor(e,t,i,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new g(e),this.fast_=new g(t),this.defaultTTFB_=n,this.ttfb_=new g(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new g(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new g(t,n.getEstimate(),n.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new g(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){const i=(e=Math.max(e,this.minDelayMs_))/1e3,n=8*t/i;this.fast_.sample(i,n),this.slow_.sample(i,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function v(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},y.apply(null,arguments)}function b(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function S(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?b(Object(i),!0).forEach((function(t){v(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):b(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}class E{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=w,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 w=function(){},C={trace:w,debug:w,log:w,warn:w,info:w,error:w};function k(){return y({},C)}function T(e,t,i){return t[e]?t[e].bind(t):function(e,t){const i=self.console[e];return i?i.bind(self.console,`${t?"["+t+"] ":""}[${e}] >`):w}(e,i)}const A=k();const x=A;function D(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function L(e,t){const i=Object.keys(e),n=Object.keys(t),r=i.length,s=n.length;return!r||!s||r===s&&!i.some((e=>-1===n.indexOf(e)))}function R(e,t=!1){if("undefined"!=typeof TextDecoder){const i=new TextDecoder("utf-8").decode(e);if(t){const e=i.indexOf("\0");return-1!==e?i.substring(0,e):i}return i.replace(/\0/g,"")}const i=e.length;let n,r,s,o="",a=0;for(;a<i;){if(n=e[a++],0===n&&t)return o;if(0!==n&&3!==n)switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(n);break;case 12:case 13:r=e[a++],o+=String.fromCharCode((31&n)<<6|63&r);break;case 14:r=e[a++],s=e[a++],o+=String.fromCharCode((15&n)<<12|(63&r)<<6|(63&s)<<0)}}return o}function I(e){let t="";for(let i=0;i<e.length;i++){let n=e[i].toString(16);n.length<2&&(n="0"+n),t+=n}return t}function P(e){return Uint8Array.from(e.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,F={exports:{}};var B,N,U,H,j,$=(M||(M=1,B=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,N=/^(?=([^\/?#]*))\1([^]*)$/,U=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,F.exports=j={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var n=j.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=j.normalizePath(n.path),j.buildURLFromParts(n)}var r=j.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=j.normalizePath(r.path),j.buildURLFromParts(r)):t;var s=j.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var o=N.exec(s.path);s.netLoc=o[1],s.path=o[2]}s.netLoc&&!s.path&&(s.path="/");var a={scheme:s.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(a.netLoc=s.netLoc,"/"!==r.path[0]))if(r.path){var l=s.path,c=l.substring(0,l.lastIndexOf("/")+1)+r.path;a.path=j.normalizePath(c)}else a.path=s.path,r.params||(a.params=s.params,r.query||(a.query=s.query));return null===a.path&&(a.path=i.alwaysNormalize?j.normalizePath(r.path):r.path),j.buildURLFromParts(a)},parseURL:function(e){var t=B.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(U,"");e.length!==(e=e.replace(H,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}}),F.exports);class G{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 z="audio",K="video",W="audiovideo";class q{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof e&&(e={url:e}),this.base=e,function(e,t){const i=X(e,t);i&&(i.enumerable=!0,Object.defineProperty(e,t,i))}(this,"stats")}setByteRange(e,t){const i=e.split("@",2);let n;n=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[n,parseInt(i[0])+n]}get baseurl(){return this.base.url}get byteRange(){return null===this._byteRange?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return null===this._streams&&(this._streams={[z]:null,[K]:null,[W]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return null!==this._stats}get hasStreams(){return null!==this._streams}get stats(){return null===this._stats&&(this._stats=new G),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=$.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[z]=null,e[K]=null,e[W]=null}}function V(e){return"initSegment"!==e.sn}class Y extends q{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(n(e)&&n(t))return t-e}return null}get bitrate(){return this.byteLength?8*this.byteLength/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 e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{const e=Object.keys(this.levelkeys);if(1===e.length){const t=this._decryptdata=this.levelkeys[e[0]]||null;if(t)return t.getDecryptData(this.sn)}}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;const e=n(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t;const e=Object.keys(this.levelkeys),i=e.length;if(i>1||1===i&&null!=(t=this.levelkeys[e[0]])&&t.encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){n(e)?this._programDateTime=e:this._programDateTime=this.rawProgramDateTime=null}get ref(){return V(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,n,r,s=!1){const{elementaryStreams:o}=this,a=o[e];a?(a.startPTS=Math.min(a.startPTS,t),a.endPTS=Math.max(a.endPTS,i),a.startDTS=Math.min(a.startDTS,n),a.endDTS=Math.max(a.endDTS,r)):o[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:r,partial:s}}}class Z extends q{constructor(e,t,i,n,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;const s=e.enumeratedString("BYTERANGE");s&&this.setByteRange(s,r),r&&(this.fragOffset=r.fragOffset+r.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 X(e,t){const i=Object.getPrototypeOf(e);if(i){const e=Object.getOwnPropertyDescriptor(i,t);return e||X(i,t)}}const Q=Math.pow(2,32)-1,J=[].push,ee={video:1,audio:2,id3:3,text:4};function te(e){return String.fromCharCode.apply(null,e)}function ie(e,t){const i=e[t]<<8|e[t+1];return i<0?65536+i:i}function ne(e,t){const i=se(e,t);return i<0?4294967296+i:i}function re(e,t){let i=ne(e,t);return i*=Math.pow(2,32),i+=ne(e,t+4),i}function se(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function oe(e,t){const i=[];if(!t.length)return i;const n=e.byteLength;for(let r=0;r<n;){const s=ne(e,r),o=s>1?r+s:n;if(te(e.subarray(r+4,r+8))===t[0])if(1===t.length)i.push(e.subarray(r+8,o));else{const n=oe(e.subarray(r+8,o),t.slice(1));n.length&&J.apply(i,n)}r=o}return i}function ae(e){const t=[],i=e[0];let n=8;const r=ne(e,n);n+=4;let s=0,o=0;0===i?(s=ne(e,n),o=ne(e,n+4),n+=8):(s=re(e,n),o=re(e,n+8),n+=16),n+=2;let a=e.length+o;const l=ie(e,n);n+=2;for(let i=0;i<l;i++){let i=n;const s=ne(e,i);i+=4;const o=2147483647&s;if(1===(2147483648&s)>>>31)return x.warn("SIDX has hierarchical references (not supported)"),null;const l=ne(e,i);i+=4,t.push({referenceSize:o,subsegmentDuration:l,info:{duration:l/r,start:a,end:a+o-1}}),a+=o,i+=4,n=i}return{earliestPresentationTime:s,timescale:r,version:i,referencesCount:l,references:t}}function le(e){const t=[],i=oe(e,["moov","trak"]);for(let e=0;e<i.length;e++){const n=i[e],r=oe(n,["tkhd"])[0];if(r){let e=r[0];const i=ne(r,0===e?12:20),s=oe(n,["mdia","mdhd"])[0];if(s){e=s[0];const r=ne(s,0===e?12:20),o=oe(n,["mdia","hdlr"])[0];if(o){const e=te(o.subarray(8,12)),s={soun:z,vide:K}[e],a=ce(oe(n,["mdia","minf","stbl","stsd"])[0]);s?(t[i]={timescale:r,type:s,stsd:a},t[s]=S({timescale:r,id:i},a)):t[i]={timescale:r,type:e,stsd:a}}}}}return oe(e,["moov","mvex","trex"]).forEach((e=>{const i=ne(e,4),n=t[i];n&&(n.default={duration:ne(e,12),flags:ne(e,20)})})),t}function ce(e){const t=e.subarray(8),i=t.subarray(86),n=te(t.subarray(4,8));let r,s=n;const o="enca"===n||"encv"===n;if(o){const e=oe(t,[n])[0];oe(e.subarray("enca"===n?28:78),["sinf"]).forEach((e=>{const t=oe(e,["schm"])[0];if(t){const i=te(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=oe(e,["frma"])[0];t&&(s=te(t))}}}))}const a=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const e=oe(i,["avcC"])[0];e&&e.length>3&&(s+="."+de(e[1])+de(e[2])+de(e[3]),r=ue("avc1"===a?"dva1":"dvav",i));break}case"mp4a":{const e=oe(t,[n])[0],i=oe(e.subarray(28),["esds"])[0];if(i&&i.length>7){let e=4;if(3!==i[e++])break;e=he(i,e),e+=2;const t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=he(i,e);const n=i[e++];if(64!==n)break;if(s+="."+de(n),e+=12,5!==i[e++])break;e=he(i,e);const r=i[e++];let o=(248&r)>>3;31===o&&(o+=1+((7&r)<<3)+((224&i[e])>>5)),s+="."+o}break}case"hvc1":case"hev1":{const e=oe(i,["hvcC"])[0];if(e&&e.length>12){const t=e[1],i=["","A","B","C"][t>>6],n=31&t,r=ne(e,2),o=(32&t)>>5?"H":"L",a=e[12],l=e.subarray(6,12);s+="."+i+n,s+="."+function(e){let t=0;for(let i=0;i<32;i++)t|=(e>>i&1)<<31-i;return t>>>0}(r).toString(16).toUpperCase(),s+="."+o+a;let c="";for(let e=l.length;e--;){const t=l[e];if(t||c){c="."+t.toString(16).toUpperCase()+c}}s+=c}r=ue("hev1"==a?"dvhe":"dvh1",i);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":s=ue(s,i)||s;break;case"vp09":{const e=oe(i,["vpcC"])[0];if(e&&e.length>6){const t=e[4],i=e[5],n=e[6]>>4&15;s+="."+fe(t)+"."+fe(i)+"."+fe(n)}break}case"av01":{const e=oe(i,["av1C"])[0];if(e&&e.length>2){const t=e[1]>>>5,n=31&e[1],o=e[2]>>>7?"H":"M",a=(64&e[2])>>6,l=(32&e[2])>>5,c=2===t&&a?l?12:10:a?10:8,u=(16&e[2])>>4,h=(8&e[2])>>3,d=(4&e[2])>>2,f=3&e[2],p=1,_=1,g=1,m=0;s+="."+t+"."+fe(n)+o+"."+fe(c)+"."+u+"."+h+d+f+"."+fe(p)+"."+fe(_)+"."+fe(g)+"."+m,r=ue("dav1",i)}break}}return{codec:s,encrypted:o,supplemental:r}}function ue(e,t){const i=oe(t,["dvvC"]),n=i.length?i[0]:oe(t,["dvcC"])[0];if(n){const t=n[2]>>1&127,i=n[2]<<5&32|n[3]>>3&31;return e+"."+fe(t)+"."+fe(i)}}function he(e,t){const i=t+5;for(;128&e[t++]&&t<i;);return t}function de(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function fe(e){return(e<10?"0":"")+e}function pe(e){const t=oe(e,["schm"])[0];if(t){const i=te(t.subarray(4,8));if("cbcs"===i||"cenc"===i)return oe(e,["schi","tenc"])[0]}return null}function _e(e,t){const i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}function ge(e,t){const i=[],n=t.samples,r=t.timescale,s=t.id;let o=!1;return oe(n,["moof"]).map((a=>{const l=a.byteOffset-8;oe(a,["traf"]).map((a=>{const c=oe(a,["tfdt"]).map((e=>{const t=e[0];let i=ne(e,4);return 1===t&&(i*=Math.pow(2,32),i+=ne(e,8)),i/r}))[0];return void 0!==c&&(e=c),oe(a,["tfhd"]).map((c=>{const u=ne(c,4),h=16777215&ne(c,0);let d=0;const f=0!=(16&h);let p=0;const _=0!=(32&h);let g=8;u===s&&(0!=(1&h)&&(g+=8),0!=(2&h)&&(g+=4),0!=(8&h)&&(d=ne(c,g),g+=4),f&&(p=ne(c,g),g+=4),_&&(g+=4),"video"===t.type&&(o=me(t.codec)),oe(a,["trun"]).map((s=>{const a=s[0],c=16777215&ne(s,0),u=0!=(1&c);let h=0;const f=0!=(4&c),_=0!=(256&c);let g=0;const m=0!=(512&c);let v=0;const y=0!=(1024&c),b=0!=(2048&c);let S=0;const E=ne(s,4);let w=8;u&&(h=ne(s,w),w+=4),f&&(w+=4);let C=h+l;for(let l=0;l<E;l++){if(_?(g=ne(s,w),w+=4):g=d,m?(v=ne(s,w),w+=4):v=p,y&&(w+=4),b&&(S=0===a?ne(s,w):se(s,w),w+=4),t.type===K){let t=0;for(;t<v;){const s=ne(n,C);if(C+=4,ve(o,n[C])){ye(n.subarray(C,C+s),o?2:1,e+S/r,i)}C+=s,t+=s+4}}e+=g/r}})))}))}))})),i}function me(e){if(!e)return!1;const t=e.substring(0,4);return"hvc1"===t||"hev1"===t||"dvh1"===t||"dvhe"===t}function ve(e,t){if(e){const e=t>>1&63;return 39===e||40===e}return 6===(31&t)}function ye(e,t,i,n){const r=be(e);let s=0;s+=t;let o=0,a=0,l=0;for(;s<r.length;){o=0;do{if(s>=r.length)break;l=r[s++],o+=l}while(255===l);a=0;do{if(s>=r.length)break;l=r[s++],a+=l}while(255===l);const e=r.length-s;let t=s;if(a<e)s+=a;else if(a>e){x.error(`Malformed SEI payload. ${a} is too small, only ${e} bytes left to parse.`);break}if(4===o){if(181===r[t++]){const e=ie(r,t);if(t+=2,49===e){const e=ne(r,t);if(t+=4,1195456820===e){const e=r[t++];if(3===e){const s=r[t++],a=64&s,l=a?2+3*(31&s):0,c=new Uint8Array(l);if(a){c[0]=s;for(let e=1;e<l;e++)c[e]=r[t++]}n.push({type:e,payloadType:o,pts:i,bytes:c})}}}}}else if(5===o&&a>16){const e=[];for(let i=0;i<16;i++){const n=r[t++].toString(16);e.push(1==n.length?"0"+n:n),3!==i&&5!==i&&7!==i&&9!==i||e.push("-")}const s=a-16,l=new Uint8Array(s);for(let e=0;e<s;e++)l[e]=r[t++];n.push({payloadType:o,pts:i,uuid:e.join(""),userData:R(l),userDataBytes:l})}}}function be(e){const t=e.byteLength,i=[];let n=1;for(;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return e;const r=t-i.length,s=new Uint8Array(r);let o=0;for(n=0;n<r;o++,n++)o===i[0]&&(o++,i.shift()),s[n]=e[o];return s}function Se(e,t,i){if(16!==e.byteLength)throw new RangeError("Invalid system id");let n,r,s;n=0,r=new Uint8Array,s=new Uint8Array;const o=new Uint8Array(4);return i.byteLength>0&&new DataView(o.buffer).setUint32(0,i.byteLength,!1),function(e,...t){const i=t.length;let n=8,r=i;for(;r--;)n+=t[r].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=255&n,s.set(e,4),r=0,n=8;r<i;r++)s.set(t[r],n),n+=t[r].byteLength;return s}([112,115,115,104],new Uint8Array([0,0,0,0]),e,s,r,o,i)}function Ee(e){const t=e.getUint32(0),i=e.byteOffset,n=e.byteLength;if(n<t)return{offset:i,size:n};if(1886614376!==e.getUint32(4))return{offset:i,size:t};const r=e.getUint32(8)>>>24;if(0!==r&&1!==r)return{offset:i,size:t};const s=e.buffer,o=I(new Uint8Array(s,i+12,16));let a=null,l=null,c=0;if(0===r)c=28;else{const r=e.getUint32(28);if(!r||n<32+16*r)return{offset:i,size:t};a=[];for(let e=0;e<r;e++)a.push(new Uint8Array(s,i+32+16*e,16));c=32+16*r}if(!c)return{offset:i,size:t};const u=e.getUint32(c);return t-32<u?{offset:i,size:t}:(l=new Uint8Array(s,i+c+4,u),{version:r,systemId:o,kids:a,data:l,offset:i,size:t})}const we=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ce={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 ke(e,t){const i=Ce[t];return!!i&&!!i[e.slice(0,4)]}function Te(e,t,i=!0){return!e.split(",").some((e=>!Ae(e,t,i)))}function Ae(e,t,i=!0){var n;const r=D(i);return null!=(n=null==r?void 0:r.isTypeSupported(xe(e,t)))&&n}function xe(e,t){return`${t}/mp4;codecs=${e}`}function De(e){if(e){const t=e.substring(0,4);return Ce.video[t]}return 2}function Le(e){const t=we();return e.split(",").reduce(((e,i)=>{const n=t&&me(i)?9:Ce.video[i];return n?(2*n+e)/(e?3:2):(Ce.audio[i]+e)/(e?2:1)}),0)}const Re={};const Ie=/flac|opus|mp4a\.40\.34/i;function Pe(e,t=!0){return e.replace(Ie,(e=>function(e,t=!0){if(Re[e])return Re[e];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e];for(let r=0;r<i.length;r++){var n;if(Ae(i[r],"audio",t))return Re[e]=i[r],i[r];if("mp3"===i[r]&&null!=(n=D(t))&&n.isTypeSupported("audio/mpeg"))return""}return e}(e.toLowerCase(),t)))}function Oe(e,t){if(e&&(e.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(e))&&(Me(e,"audio")||Me(e,"video")))return e;if(t){const i=t.split(",");if(i.length>1){if(e)for(let t=i.length;t--;)if(i[t].substring(0,4)===e.substring(0,4))return i[t];return i[0]}}return t||e}function Me(e,t){return ke(e,t)&&Ae(e,t)}function Fe(e){if(e.startsWith("av01.")){const t=e.split("."),i=["0","111","01","01","01","0"];for(let e=t.length;e>4&&e<10;e++)t[e]=i[e-4];return t.join(".")}return e}function Be(e){const t=D(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Ne(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Ue={supported:!1,smooth:!1,powerEfficient:!1},He={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function je(e,t){return{supported:!1,configurations:t,decodingInfoResults:[Ue],error:e}}function $e(e,t,i,r,s,o){const a=e.videoCodec,l=e.audioCodec?e.audioGroups:null,c=null==o?void 0:o.audioCodec,u=null==o?void 0:o.channels,h=u?parseInt(u):c?1/0:2;let d=null;if(null!=l&&l.length)try{d=1===l.length&&l[0]?t.groups[l[0]].channels:l.reduce(((e,i)=>{if(i){const n=t.groups[i];if(!n)throw new Error(`Audio track group ${i} not found`);Object.keys(n.channels).forEach((t=>{e[t]=(e[t]||0)+n.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==a&&(a.split(",").some((e=>me(e)))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(s,8e6))||!!d&&n(h)&&Object.keys(d).some((e=>parseInt(e)>h))}function Ge(e,t,i,n={}){const r=e.videoCodec;if(!r&&!e.audioCodec||!i)return Promise.resolve(He);const s=[],o=function(e){var t;const i=null==(t=e.videoCodec)?void 0:t.split(","),n=Ke(e),r=e.width||640,s=e.height||480,o=e.frameRate||30,a=e.videoRange.toLowerCase();return i?i.map((e=>{const t={contentType:xe(Fe(e),"video"),width:r,height:s,bitrate:n,framerate:o};return"sdr"!==a&&(t.transferFunction=a),t})):[]}(e),a=o.length,l=function(e,t,i){var n;const r=null==(n=e.audioCodec)?void 0:n.split(","),s=Ke(e);if(r&&e.audioGroups)return e.audioGroups.reduce(((e,n)=>{var o;const a=n?null==(o=t.groups[n])?void 0:o.tracks:null;return a?a.reduce(((e,t)=>{if(t.groupId===n){const n=parseFloat(t.channels||"");r.forEach((t=>{const r={contentType:xe(t,"audio"),bitrate:i?ze(t,s):s};n&&(r.channels=""+n),e.push(r)}))}return e}),e):e}),[]);return[]}(e,t,a>0),c=l.length;for(let e=a||1*c||1;e--;){const t={type:"media-source"};if(a&&(t.video=o[e%a]),c){t.audio=l[e%c];const i=t.audio.bitrate;t.video&&i&&(t.video.bitrate-=i)}s.push(t)}if(r){const e=navigator.userAgent;if(r.split(",").some((e=>me(e)))&&we())return Promise.resolve(je(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),s))}return Promise.all(s.map((e=>{const t=function(e){let t="";const{audio:i,video:n}=e;if(n){t+=`${Ne(n.contentType)}_r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${Math.ceil(n.bitrate/1e5)}`}if(i){t+=`${n?"_":""}${Ne(i.contentType)}_c${i.channels}`}return t}(e);return n[t]||(n[t]=i.decodingInfo(e))}))).then((e=>({supported:!e.some((e=>!e.supported)),configurations:s,decodingInfoResults:e}))).catch((e=>({supported:!1,configurations:s,decodingInfoResults:[],error:e})))}function ze(e,t){if(t<=1)return 1;let i=128e3;return"ec-3"===e?i=768e3:"ac-3"===e&&(i=64e4),Math.min(t/2,i)}function Ke(e){return 1e3*Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)/1e3)||1}const We=["NONE","TYPE-0","TYPE-1",null];const qe=["SDR","PQ","HLG"];var Ve="",Ye="YES",Ze="v2";function Xe(e){const{canSkipUntil:t,canSkipDateRanges:i,age:n}=e;return t&&n<t/2?i?Ze:Ye:Ve}class Qe{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 void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Je{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((e=>!!e)).map((e=>e.substring(0,4))).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=null==(t=e.supplemental)?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 et(this._audioGroups,e)}hasSubtitleGroup(e){return et(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.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 null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function et(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function tt(e,t){let i=!1,n=[];if(e&&(i="SDR"!==e,n=[e]),t){n=t.allowedVideoRanges||qe.slice(0);const e="SDR"!==n.join("")&&!t.videoCodec;i=void 0!==t.preferHDR?t.preferHDR:e&&function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),i||(n=["SDR"])}return{preferHDR:i,allowedVideoRanges:n}}const it=(e,t)=>JSON.stringify(e,(e=>{const t=new WeakSet;return(i,n)=>{if(e&&(n=e(i,n)),"object"==typeof n&&null!==n){if(t.has(n))return;t.add(n)}return n}})(t));function nt(e,t){x.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function rt(e){return e.reduce(((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const n=t.channels||"2";return i.channels[n]=(i.channels[n]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function st(e){if(!e)return e;const{lang:t,assocLang:i,characteristics:n,channels:r,audioCodec:s}=e;return{lang:t,assocLang:i,characteristics:n,channels:r,audioCodec:s}}function ot(e,t,i){if("attrs"in e){const i=t.indexOf(e);if(-1!==i)return i}for(let n=0;n<t.length;n++){if(at(e,t[n],i))return n}return-1}function at(e,t,i){const{groupId:n,name:r,lang:s,assocLang:o,default:a}=e,l=e.forced;return(void 0===n||t.groupId===n)&&(void 0===r||t.name===r)&&(void 0===s||function(e,t="--"){if(e.length===t.length)return e===t;return e.startsWith(t)||t.startsWith(e)}(s,t.lang))&&(void 0===s||t.assocLang===o)&&(void 0===a||t.default===a)&&(void 0===l||t.forced===l)&&(!("characteristics"in e)||function(e,t=""){const i=e.split(","),n=t.split(",");return i.length===n.length&&!i.some((e=>-1===n.indexOf(e)))}(e.characteristics||"",t.characteristics))&&(void 0===i||i(e,t))}function lt(e,t){const{audioCodec:i,channels:n}=e;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==n&&n!==(t.channels||"2"))}function ct(e,t,i){for(let n=t;n>-1;n--)if(i(e[n]))return n;for(let n=t+1;n<e.length;n++)if(i(e[n]))return n;return-1}function ut(e,t){var i;return!!e&&e!==(null==(i=t.loadLevelObj)?void 0:i.uri)}const ht=function(e,t){let i=0,n=e.length-1,r=null,s=null;for(;i<=n;){r=(i+n)/2|0,s=e[r];const o=t(s);if(o>0)i=r+1;else{if(!(o<0))return s;n=r-1}}return null};function dt(e,t,i=0,n=0,r=.005){let s=null;if(e){s=t[1+e.sn-t[0].sn]||null;const n=e.endDTS-i;n>0&&n<15e-7&&(i+=15e-7),s&&e.level!==s.level&&s.end<=e.end&&(s=t[2+e.sn-t[0].sn]||null)}else 0===i&&0===t[0].start&&(s=t[0]);if(s&&((!e||e.level===s.level)&&0===ft(i,n,s)||function(e,t,i){if(t&&0===t.start&&t.level<e.level&&(t.endPTS||0)>0){const n=t.tagList.reduce(((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e)),i);return e.start<=n}return!1}(s,e,Math.min(r,n))))return s;const o=ht(t,ft.bind(null,i,n));return!o||o===e&&s?s:o}function ft(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;const n=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-n<=e?1:i.start-n>e&&i.start?-1:0}function pt(e,t,i){const n=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-n>e}function _t(e,t,i){if(e&&e.startCC<=t&&e.endCC>=t){let n=e.fragments;const{fragmentHint:r}=e;let s;return r&&(n=n.concat(r)),ht(n,(e=>e.cc<t?1:e.cc>t?-1:(s=e,e.end<=i?1:e.start>i?-1:0))),s||null}return null}function gt(e){switch(e.details){case a.FRAG_LOAD_TIMEOUT:case a.KEY_LOAD_TIMEOUT:case a.LEVEL_LOAD_TIMEOUT:case a.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function mt(e){return e.details.startsWith("key")}function vt(e){return mt(e)&&!!e.frag&&!e.frag.decryptdata}function yt(e,t){const i=gt(t);return e.default[(i?"timeout":"error")+"Retry"]}function bt(e,t){const i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function St(e){return S(S({},e),{errorRetry:null,timeoutRetry:null})}function Et(e,t,i,n){if(!e)return!1;const r=null==n?void 0:n.code,s=t<e.maxNumRetry&&(function(e){return wt(e)||!!e&&(e<400||e>499)}(r)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,n,s):s}function wt(e){return 0===e&&!1===navigator.onLine}var Ct=0,kt=2,Tt=3,At=5,xt=0,Dt=1,Lt=2,Rt=4;function It(e){const t={action:Ct,flags:xt};return e&&(t.resolved=!0),t}var Pt="NOT_LOADED",Ot="APPENDING",Mt="PARTIAL",Ft="OK";class Bt{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.BUFFER_APPENDED,this.onBufferAppended,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this),e.on(l.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.BUFFER_APPENDED,this.onBufferAppended,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this),e.off(l.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let t=i.length;t--;){const n=i[t];if(!n)break;if(n.start<=e&&e<=n.end&&n.loaded)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:n}=this,r=Object.keys(n);for(let s=r.length;s--;){const o=n[r[s]];if((null==o?void 0:o.body.type)===t&&(!i||o.buffered)){const t=o.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,i,n,r){this.timeRanges&&(this.timeRanges[e]=t);const s=(null==n?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach((n=>{const o=this.fragments[n];if(!o)return;if(s>=o.body.sn)return;if(!o.buffered&&(!o.loaded||r))return void(o.body.type===i&&this.removeFragment(o.body));const a=o.range[e];a&&(0!==a.time.length?a.time.some((e=>{const i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(o.body),i})):this.removeFragment(o.body))}))}detectPartialFragments(e){const t=this.timeRanges;if(!t||"initSegment"===e.frag.sn)return;const i=e.frag,n=Ut(i),r=this.fragments[n];if(!r||r.buffered&&i.gap)return;const s=!i.relurl;if(Object.keys(t).forEach((n=>{const o=i.elementaryStreams[n];if(!o)return;const a=t[n],l=s||!0===o.partial;r.range[n]=this.getBufferedTimes(i,e.part,l,a)})),r.loaded=null,Object.keys(r.range).length){r.buffered=!0;(r.body.endList=i.endList||r.body.endList)&&(this.endListFragments[r.body.type]=r),Nt(r)||this.removeParts(i.sn-1,i.type)}else this.removeFragment(r.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=Ht(i,(t=>t.fragment.sn>=e)))}fragBuffered(e,t){const i=Ut(e);let n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(e,t,i,n){const r={time:[],partial:i},s=e.start,o=e.end,a=e.minEndPTS||o,l=e.maxStartPTS||s;for(let e=0;e<n.length;e++){const t=n.start(e)-this.bufferPadding,i=n.end(e)+this.bufferPadding;if(l>=t&&a<=i){r.time.push({startPTS:Math.max(s,n.start(e)),endPTS:Math.min(o,n.end(e))});break}if(s<i&&o>t){const t=Math.max(s,n.start(e)),i=Math.min(o,n.end(e));i>t&&(r.partial=!0,r.time.push({startPTS:t,endPTS:i}))}else if(o<=t)break}return r}getPartialFragment(e){let t,i,n,r=null,s=0;const{bufferPadding:o,fragments:a}=this;return Object.keys(a).forEach((l=>{const c=a[l];c&&Nt(c)&&(i=c.body.start-o,n=c.body.end+o,e>=i&&e<=n&&(t=Math.min(e-i,n-e),s<=t&&(r=c.body,s=t)))})),r}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||Nt(t))}getState(e){const t=Ut(e),i=this.fragments[t];return i?i.buffered?Nt(i)?Mt:Ft:Ot:Pt}isTimeBuffered(e,t,i){let n,r;for(let s=0;s<i.length;s++){if(n=i.start(s)-this.bufferPadding,r=i.end(s)+this.bufferPadding,e>=n&&t<=r)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if("initSegment"===t.frag.sn||t.frag.bitrateTest)return;const i=t.frag,n=t.part?null:t,r=Ut(i);this.fragments[r]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:r,type:s}=t;if("initSegment"===i.sn)return;const o=i.type;if(n){let e=this.activePartLists[o];e||(this.activePartLists[o]=e=[]),e.push(n)}this.timeRanges=r;const a=r[s];this.detectEvictedFragments(s,a,o,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Ut(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let n=i.length;n--;){const r=t[i[n]];if((null==r?void 0:r.body.type)===e)return!0}return!1}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,i,n,r){n&&!this.hasGaps||Object.keys(this.fragments).forEach((s=>{const o=this.fragments[s];if(!o)return;const a=o.body;a.type!==i||n&&!a.gap||a.start<t&&a.end>e&&(o.buffered||r)&&this.removeFragment(a)}))}removeFragment(e){const t=Ut(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const t=e.sn;this.activePartLists[e.type]=Ht(i,(e=>e.fragment.sn!==t))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=null==(e=this.hls)||null==(e=e.latestLevelDetails)?void 0:e.partList;t&&t.forEach((e=>e.clearElementaryStreamInfo()))}}function Nt(e){var t,i,n;return e.buffered&&!!(e.body.gap||null!=(t=e.range.video)&&t.partial||null!=(i=e.range.audio)&&i.partial||null!=(n=e.range.audiovideo)&&n.partial)}function Ut(e){return`${e.type}_${e.level}_${e.sn}`}function Ht(e,t){return e.filter((e=>{const i=t(e);return i||e.clearElementaryStreamInfo(),i}))}var jt=0,$t=1;class Gt{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 jt:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case $t:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}class zt{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 e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],r=i[1],s=i[2],o=i[3],a=this.invSubMix,l=a[0],c=a[1],u=a[2],h=a[3],d=new Uint32Array(256);let f=0,p=0,_=0;for(_=0;_<256;_++)d[_]=_<128?_<<1:_<<1^283;for(_=0;_<256;_++){let i=p^p<<1^p<<2^p<<3^p<<4;i=i>>>8^255&i^99,e[f]=i,t[i]=f;const a=d[f],_=d[a],g=d[_];let m=257*d[i]^16843008*i;n[f]=m<<24|m>>>8,r[f]=m<<16|m>>>16,s[f]=m<<8|m>>>24,o[f]=m,m=16843009*g^65537*_^257*a^16843008*f,l[i]=m<<24|m>>>8,c[i]=m<<16|m>>>16,u[i]=m<<8|m>>>24,h[i]=m,f?(f=a^d[d[d[g^a]]],p^=d[d[p]]):f=p=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,n=0;for(;n<t.length&&i;)i=t[n]===this.key[n],n++;if(i)return;this.key=t;const r=this.keySize=t.length;if(4!==r&&6!==r&&8!==r)throw new Error("Invalid aes key size="+r);const s=this.ksRows=4*(r+6+1);let o,a;const l=this.keySchedule=new Uint32Array(s),c=this.invKeySchedule=new Uint32Array(s),u=this.sBox,h=this.rcon,d=this.invSubMix,f=d[0],p=d[1],_=d[2],g=d[3];let m,v;for(o=0;o<s;o++)o<r?m=l[o]=t[o]:(v=m,o%r==0?(v=v<<8|v>>>24,v=u[v>>>24]<<24|u[v>>>16&255]<<16|u[v>>>8&255]<<8|u[255&v],v^=h[o/r|0]<<24):r>6&&o%r==4&&(v=u[v>>>24]<<24|u[v>>>16&255]<<16|u[v>>>8&255]<<8|u[255&v]),l[o]=m=(l[o-r]^v)>>>0);for(a=0;a<s;a++)o=s-a,v=3&a?l[o]:l[o-4],c[a]=a<4||o<=4?v:f[u[v>>>24]]^p[u[v>>>16&255]]^_[u[v>>>8&255]]^g[u[255&v]],c[a]=c[a]>>>0}networkToHostOrderSwap(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}decrypt(e,t,i){const n=this.keySize+6,r=this.invKeySchedule,s=this.invSBox,o=this.invSubMix,a=o[0],l=o[1],c=o[2],u=o[3],h=this.uint8ArrayToUint32Array_(i);let d=h[0],f=h[1],p=h[2],_=h[3];const g=new Int32Array(e),m=new Int32Array(g.length);let v,y,b,S,E,w,C,k,T,A,x,D,L,R;const I=this.networkToHostOrderSwap;for(;t<g.length;){for(T=I(g[t]),A=I(g[t+1]),x=I(g[t+2]),D=I(g[t+3]),E=T^r[0],w=D^r[1],C=x^r[2],k=A^r[3],L=4,R=1;R<n;R++)v=a[E>>>24]^l[w>>16&255]^c[C>>8&255]^u[255&k]^r[L],y=a[w>>>24]^l[C>>16&255]^c[k>>8&255]^u[255&E]^r[L+1],b=a[C>>>24]^l[k>>16&255]^c[E>>8&255]^u[255&w]^r[L+2],S=a[k>>>24]^l[E>>16&255]^c[w>>8&255]^u[255&C]^r[L+3],E=v,w=y,C=b,k=S,L+=4;v=s[E>>>24]<<24^s[w>>16&255]<<16^s[C>>8&255]<<8^s[255&k]^r[L],y=s[w>>>24]<<24^s[C>>16&255]<<16^s[k>>8&255]<<8^s[255&E]^r[L+1],b=s[C>>>24]<<24^s[k>>16&255]<<16^s[E>>8&255]<<8^s[255&w]^r[L+2],S=s[k>>>24]<<24^s[E>>16&255]<<16^s[w>>8&255]<<8^s[255&C]^r[L+3],m[t]=I(v^d),m[t+1]=I(S^f),m[t+2]=I(b^p),m[t+3]=I(y^_),d=T,f=A,p=x,_=D,t+=4}return m.buffer}}class Kt{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=function(e){switch(e){case jt:return"AES-CBC";case $t:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${e}`)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}class Wt{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 e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch(e){}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?function(e){const t=e.byteLength,i=t&&new DataView(e.buffer).getUint8(t-1);return i?e.slice(0,t-i):e}(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,n){return this.useSoftware?new Promise(((r,s)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,i,n);const a=this.flush();a?r(a.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}softwareDecrypt(e,t,i,n){const{currentIV:r,currentResult:s,remainderData:o}=this;if(n!==jt||16!==t.byteLength)return x.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=_e(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;r&&(i=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new zt),l.expandKey(t);const c=s;return this.currentResult=l.decrypt(a.buffer,0,i),this.currentIV=a.slice(-16).buffer,c||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new Kt(this.subtle,t,n)}return this.fastAesKey.expandKey().then((t=>{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new Gt(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,t)})).catch((r=>(x.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,i,n))))}onWebCryptoError(e,t,i,n){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%16;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(x.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const qt=Math.pow(2,17);class Vt{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 Xt({type:o.NETWORK_ERROR,details:a.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(i?"part list":"url")),networkDetails:null}));this.abort();const n=this.config,r=n.fLoader,s=n.loader;return new Promise(((l,c)=>{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some((e=>"GAP"===e[0])))return void c(Zt(e));e.gap=!1}const u=this.loader=r?new r(n):new s(n),h=Yt(e);e.loader=u;const d=St(n.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:qt};e.stats=u.stats;const p={onSuccess:(t,i,n,r)=>{this.resetLoader(e,u);let s=t.data;n.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),l({frag:e,part:null,payload:s,networkDetails:r})},onError:(t,n,r,s)=>{this.resetLoader(e,u),c(new Xt({type:o.NETWORK_ERROR,details:a.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:S({url:i,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:r,stats:s}))},onAbort:(t,i,n)=>{this.resetLoader(e,u),c(new Xt({type:o.NETWORK_ERROR,details:a.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:n,stats:t}))},onTimeout:(t,i,n)=>{this.resetLoader(e,u),c(new Xt({type:o.NETWORK_ERROR,details:a.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:n,stats:t}))}};t&&(p.onProgress=(i,n,r,s)=>t({frag:e,part:null,payload:r,networkDetails:s})),u.load(h,f,p)}))}loadPart(e,t,i){this.abort();const n=this.config,r=n.fLoader,s=n.loader;return new Promise(((l,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void c(Zt(e,t));const u=this.loader=r?new r(n):new s(n),h=Yt(e,t);e.loader=u;const d=St(n.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:qt};t.stats=u.stats,u.load(h,f,{onSuccess:(n,r,s,o)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const a={frag:e,part:t,payload:n.data,networkDetails:o};i(a),l(a)},onError:(i,n,r,s)=>{this.resetLoader(e,u),c(new Xt({type:o.NETWORK_ERROR,details:a.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:S({url:h.url,data:void 0},i),error:new Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:r,stats:s}))},onAbort:(i,n,r)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new Xt({type:o.NETWORK_ERROR,details:a.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:r,stats:i}))},onTimeout:(i,n,r)=>{this.resetLoader(e,u),c(new Xt({type:o.NETWORK_ERROR,details:a.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:r,stats:i}))}})}))}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,r=n.total;if(i.loaded+=n.loaded,r){const n=Math.round(e.duration/t.duration),s=Math.min(Math.round(i.loaded/r),n),o=(n-s)*Math.round(i.loaded/s);i.total=i.loaded+o}else i.total=Math.max(i.loaded,i.total);const s=i.loading,o=n.loading;s.start?s.first+=o.first-o.start:(s.start=o.start,s.first=o.first),s.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Yt(e,t=null){const i=t||e,r={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},s=i.byteRangeStartOffset,o=i.byteRangeEndOffset;if(n(s)&&n(o)){var a;let t=s,i=o;if("initSegment"===e.sn&&("AES-128"===(l=null==(a=e.decryptdata)?void 0:a.method)||"AES-256"===l)){const e=o-s;e%16&&(i=o+(16-e%16)),0!==s&&(r.resetIV=!0,t=s-16)}r.rangeStart=t,r.rangeEnd=i}var l;return r}function Zt(e,t){const i=new Error(`GAP ${e.gap?"tag":"attribute"} found`),n={type:o.MEDIA_ERROR,details:a.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(n.part=t),(t||e).stats.aborted=!0,new Xt(n)}class Xt extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Qt extends E{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&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class Jt{constructor(e,t,i,n=0,r=-1,s=!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={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=r,this.partial=s}}const ei={length:0,start:()=>0,end:()=>0};class ti{static isBuffered(e,t){if(e){const i=ti.getBuffered(e);for(let e=i.length;e--;)if(t>=i.start(e)&&t<=i.end(e))return!0}return!1}static bufferedRanges(e){if(e){const t=ti.getBuffered(e);return ti.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const n=ti.bufferedRanges(e);if(n.length)return ti.bufferedInfo(n,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort(((e,t)=>e.start-t.start||t.end-e.end));let n=-1,r=[];if(i)for(let s=0;s<e.length;s++){t>=e[s].start&&t<=e[s].end&&(n=s);const o=r.length;if(o){const t=r[o-1].end;e[s].start-t<i?e[s].end>t&&(r[o-1].end=e[s].end):r.push(e[s])}else r.push(e[s])}else r=e;let s,o=0,a=t,l=t;for(let e=0;e<r.length;e++){const c=r[e].start,u=r[e].end;if(-1===n&&t>=c&&t<=u&&(n=e),t+i>=c&&t<u)a=c,l=u,o=l-t;else if(t+i<c){s=c;break}}return{len:o,start:a||0,end:l||0,nextStart:s,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||ei}catch(e){return x.log("failed to get media.buffered",e),ei}}}const ii=/\{\$([a-zA-Z0-9-_]+)\}/g;function ni(e){return ii.test(e)}function ri(e,t){if(null!==e.variableList||e.hasVariableRefs){const i=e.variableList;return t.replace(ii,(t=>{const n=t.substring(2,t.length-1),r=null==i?void 0:i[n];return void 0===r?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),t):r}))}return t}function si(e,t,i){let n,r,s=e.variableList;if(s||(e.variableList=s={}),"QUERYPARAM"in t){n=t.QUERYPARAM;try{const e=new self.URL(i).searchParams;if(!e.has(n))throw new Error(`"${n}" does not match any query parameter in URI: "${i}"`);r=e.get(n)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else n=t.NAME,r=t.VALUE;n in s?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):s[n]=r||""}function oi(e,t,i){const n=t.IMPORT;if(i&&n in i){let t=e.variableList;t||(e.variableList=t={}),t[n]=i[n]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}const ai=/^(\d+)x(\d+)$/,li=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ci{constructor(e,t){"string"==typeof e&&(e=ci.parseAttrList(e,t)),y(this,e)}get clientAttrs(){return Object.keys(this).filter((e=>"X-"===e.substring(0,2)))}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=(1&t.length?"0":"")+t;const i=new Uint8Array(t.length/2);for(let e=0;e<t.length/2;e++)i[e]=parseInt(t.slice(2*e,2*e+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(((e,t)=>(e[t.toLowerCase()]=!0,e)),t)}bool(e){return"YES"===this[e]}decimalResolution(e){const t=ai.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={};for(li.lastIndex=0;null!==(i=li.exec(e));){const r=i[1].trim();let s=i[2];const o=0===s.indexOf('"')&&s.lastIndexOf('"')===s.length-1;let a=!1;if(o)s=s.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":a=!0}if(t&&(o||a))s=ri(t,s);else if(!a&&!o)switch(r){case"CLOSED-CAPTIONS":if("NONE"===s)break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":x.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=s}return n}}function ui(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e||"SCTE35-CMD"===e}class hi{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=(null==t?void 0:t.tagAnchor)||null,this.tagOrder=null!=(r=null==t?void 0:t.tagOrder)?r:i,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){x.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=y(new ci({}),i,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 e=(null==t?void 0:t.endDate)||new Date(this.attr["END-DATE"]);n(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return void 0===e?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 null===e||null===e.programDateTime?(x.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return null!==t?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(n(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"com.apple.hls.interstitial"===this.class}get isValid(){return!!this.id&&!this._badValueForSameId&&n(this.startDate.getTime())&&(null===this.duration||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)}}class di{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)return this.advanced=!0,void(this.updated=!0);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||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some((t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)}))}get hasProgramDateTime(){return!!this.fragments.length&&n(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(-1!==t){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return null!=(e=this.partList)&&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 fi(e,t){return e.length===t.length&&!e.some(((e,i)=>e!==t[i]))}function pi(e,t){return!e&&!t||!(!e||!t)&&fi(e,t)}function _i(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function gi(e){switch(e){case"AES-128":case"AES-256":return jt;case"AES-256-CTR":return $t;default:throw new Error(`invalid full segment method ${e}`)}}function mi(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}function vi(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(e=>e.charCodeAt(0)))}function yi(e){const t=function(e,t,i){const n=e[t];e[t]=e[i],e[i]=n};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function bi(e){const t=e.split(":");let i=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),n=e[e.length-1].split(",");if(2===n.length){const t="base64"===n[0],r=n[1];t?(e.splice(-1,1),i=mi(r)):i=function(e){const t=vi(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(r)}}return i}const Si="undefined"!=typeof self?self:void 0;var Ei={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},wi="org.w3.clearkey",Ci="com.apple.streamingkeydelivery",ki="com.microsoft.playready",Ti="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Ai(e){switch(e){case Ci:return Ei.FAIRPLAY;case ki:return Ei.PLAYREADY;case Ti:return Ei.WIDEVINE;case wi:return Ei.CLEARKEY}}function xi(e){switch(e){case Ei.FAIRPLAY:return Ci;case Ei.PLAYREADY:return ki;case Ei.WIDEVINE:return Ti;case Ei.CLEARKEY:return wi}}function Di(e){const{drmSystems:t,widevineLicenseUrl:i}=e,n=t?[Ei.FAIRPLAY,Ei.WIDEVINE,Ei.PLAYREADY,Ei.CLEARKEY].filter((e=>!!t[e])):[];return!n[Ei.WIDEVINE]&&i&&n.push(Ei.WIDEVINE),n}const Li=null!=Si&&null!=(Ri=Si.navigator)&&Ri.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var Ri;let Ii={};class Pi{static clearKeyUriToKeyIdMap(){Ii={}}static setKeyIdForUri(e,t){Ii[e]=t}constructor(e,t,i,n=[1],r=null,s){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=r,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&!_i(e),null!=s&&s.startsWith("0x")&&(this.keyId=new Uint8Array(P(s)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&fi(e.keyFormatVersions,this.keyFormatVersions)&&pi(e.iv,this.iv)&&pi(e.keyId,this.keyId)}isSupported(){if(this.method){if(_i(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case Ci:case Ti:case ki:case wi:return-1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(_i(this.method)){let t=this.iv;t||("number"!=typeof e&&(x.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),t=function(e){const t=new Uint8Array(16);for(let i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t}(e));return new Pi(this.method,this.uri,"identity",this.keyFormatVersions,t)}if(this.pssh&&this.keyId)return this;const t=bi(this.uri);if(t)switch(this.keyFormat){case Ti:if(this.pssh=t,!this.keyId){const e=function(e){const t=[];if(e instanceof ArrayBuffer){const i=e.byteLength;let n=0;for(;n+32<i;){const i=Ee(new DataView(e,n));t.push(i),n+=i.size}}return t}(t.buffer);if(e.length){var i;const t=e[0];this.keyId=null!=(i=t.kids)&&i.length?t.kids[0]:null}}if(!this.keyId){const e=t.length-22;this.keyId=t.subarray(e,e+16)}break;case ki:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Se(e,0,t),this.keyId=function(e){const t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=String.fromCharCode.apply(null,Array.from(t)),n=i.substring(i.indexOf("<"),i.length),r=(new DOMParser).parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(r){const e=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(e){const t=mi(e).subarray(0,16);return yi(t),t}}return null}(t);break}default:{let e=t.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e=Ii[this.uri];if(!e){const t=Object.keys(Ii).length%Number.MAX_SAFE_INTEGER;e=new Uint8Array(16);new DataView(e.buffer,12,4).setUint32(0,t),Pi.setKeyIdForUri(this.uri,e)}this.keyId=e}return this}}const Oi=/#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,Mi=/#EXT-X-MEDIA:(.*)/g,Fi=/^#EXT(?:INF|-X-TARGETDURATION):/m,Bi=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Ni=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 Ui{static findGroup(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(n.id===t)return n}}static resolve(e,t){return $.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Fi.test(e)}static parseMasterPlaylist(e,t){const i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:ni(e)},n=[];if(Oi.lastIndex=0,!e.startsWith("#EXTM3U"))return i.playlistParsingError=new Error("no EXTM3U delimiter"),i;let r;for(;null!=(r=Oi.exec(e));)if(r[1]){var s;const e=new ci(r[1],i),o=ri(i,r[2]),a={attrs:e,bitrate:e.decimalInteger("BANDWIDTH")||e.decimalInteger("AVERAGE-BANDWIDTH"),name:e.NAME,url:Ui.resolve(o,t)},l=e.decimalResolution("RESOLUTION");l&&(a.width=l.width,a.height=l.height),zi(e.CODECS,a);const c=e["SUPPLEMENTAL-CODECS"];c&&(a.supplemental={},zi(c,a.supplemental)),null!=(s=a.unknownCodecs)&&s.length||n.push(a),i.levels.push(a)}else if(r[3]){const e=r[3],n=r[4];switch(e){case"SESSION-DATA":{const e=new ci(n,i),t=e["DATA-ID"];t&&(null===i.sessionData&&(i.sessionData={}),i.sessionData[t]=e);break}case"SESSION-KEY":{const e=$i(n,t,i);e.encrypted&&e.isSupported()?(null===i.sessionKeys&&(i.sessionKeys=[]),i.sessionKeys.push(e)):x.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${n}"`);break}case"DEFINE":si(i,new ci(n,i),t);break;case"CONTENT-STEERING":{const e=new ci(n,i);i.contentSteering={uri:Ui.resolve(e["SERVER-URI"],t),pathwayId:e["PATHWAY-ID"]||"."};break}case"START":i.startTimeOffset=Gi(n)}}const o=n.length>0&&n.length<i.levels.length;return i.levels=o?n:i.levels,0===i.levels.length&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,i){let n;const r={},s=i.levels,o={AUDIO:s.map((e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec}))),SUBTITLES:s.map((e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec}))),"CLOSED-CAPTIONS":[]};let a=0;for(Mi.lastIndex=0;null!==(n=Mi.exec(e));){const e=new ci(n[1],i),s=e.TYPE;if(s){const i=o[s],n=r[s]||[];r[s]=n;const l=e.LANGUAGE,c=e["ASSOC-LANGUAGE"],u=e.CHANNELS,h=e.CHARACTERISTICS,d=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:a++,groupId:e["GROUP-ID"]||"",name:e.NAME||l||"",type:s,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:l,url:e.URI?Ui.resolve(e.URI,t):""};if(c&&(f.assocLang=c),u&&(f.channels=u),h&&(f.characteristics=h),d&&(f.instreamId=d),null!=i&&i.length){const e=Ui.findGroup(i,f.groupId)||i[0];Ki(f,e,"audioCodec"),Ki(f,e,"textCodec")}n.push(f)}}return r}static parseLevelPlaylist(e,t,i,r,s,o){var a;const l={url:t},c=new di(t),u=c.fragments,h=[];let d,f,p,_,g=null,m=0,v=0,b=0,S=0,E=0,w=null,C=new Y(r,l),k=-1,T=!1,A=null;if(Bi.lastIndex=0,c.m3u8=e,c.hasVariableRefs=ni(e),"#EXTM3U"!==(null==(a=Bi.exec(e))?void 0:a[0]))return c.playlistParsingError=new Error("Missing format identifier #EXTM3U"),c;for(;null!==(d=Bi.exec(e));){T&&(T=!1,C=new Y(r,l),C.playlistOffset=b,C.setStart(b),C.sn=m,C.cc=S,E&&(C.bitrate=E),C.level=i,g&&(C.initSegment=g,g.rawProgramDateTime&&(C.rawProgramDateTime=g.rawProgramDateTime,g.rawProgramDateTime=null),A&&(C.setByteRange(A),A=null)));const e=d[1];if(e){C.duration=parseFloat(e);const t=(" "+d[2]).slice(1);C.title=t||null,C.tagList.push(t?["INF",e,t]:["INF",e])}else if(d[3]){if(n(C.duration)){C.playlistOffset=b,C.setStart(b),p&&Vi(C,p,c),C.sn=m,C.level=i,C.cc=S,u.push(C);const e=(" "+d[3]).slice(1);C.relurl=ri(c,e),Wi(C,w,h),w=C,b+=C.duration,m++,v=0,T=!0}}else{if(d=d[0].match(Ni),!d){x.warn("No matches on slow regex match for level playlist!");continue}for(f=1;f<d.length&&void 0===d[f];f++);const e=(" "+d[f]).slice(1),s=(" "+d[f+1]).slice(1),a=d[f+2]?(" "+d[f+2]).slice(1):null;switch(e){case"BYTERANGE":w?C.setByteRange(s,w):C.setByteRange(s);break;case"PROGRAM-DATE-TIME":C.rawProgramDateTime=s,C.tagList.push(["PROGRAM-DATE-TIME",s]),-1===k&&(k=u.length);break;case"PLAYLIST-TYPE":c.type&&Yi(c,e,d),c.type=s.toUpperCase();break;case"MEDIA-SEQUENCE":0!==c.startSN?Yi(c,e,d):u.length>0&&Zi(c,e,d),m=c.startSN=parseInt(s);break;case"SKIP":{c.skippedSegments&&Yi(c,e,d);const t=new ci(s,c),i=t.decimalInteger("SKIPPED-SEGMENTS");if(n(i)){c.skippedSegments+=i;for(let e=i;e--;)u.push(null);m+=i}const r=t.enumeratedString("RECENTLY-REMOVED-DATERANGES");r&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(r.split("\t")));break}case"TARGETDURATION":0!==c.targetduration&&Yi(c,e,d),c.targetduration=Math.max(parseInt(s),1);break;case"VERSION":null!==c.version&&Yi(c,e,d),c.version=parseInt(s);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":c.live||Yi(c,e,d),c.live=!1;break;case"#":(s||a)&&C.tagList.push(a?[s,a]:[s]);break;case"DISCONTINUITY":S++,C.tagList.push(["DIS"]);break;case"GAP":C.gap=!0,C.tagList.push([e]);break;case"BITRATE":C.tagList.push([e,s]),E=1e3*parseInt(s),n(E)?C.bitrate=E:E=0;break;case"DATERANGE":{const e=new ci(s,c),t=new hi(e,c.dateRanges[e.ID],c.dateRangeTagCount);c.dateRangeTagCount++,t.isValid||c.skippedSegments?c.dateRanges[t.id]=t:x.warn(`Ignoring invalid DATERANGE tag: "${s}"`),C.tagList.push(["EXT-X-DATERANGE",s]);break}case"DEFINE":{const e=new ci(s,c);"IMPORT"in e?oi(c,e,o):si(c,e,t)}break;case"DISCONTINUITY-SEQUENCE":0!==c.startCC?Yi(c,e,d):u.length>0&&Zi(c,e,d),c.startCC=S=parseInt(s);break;case"KEY":{const e=$i(s,t,c);if(e.isSupported()){if("NONE"===e.method){p=void 0;break}p||(p={});const t=p[e.keyFormat];null!=t&&t.matches(e)||(t&&(p=y({},p)),p[e.keyFormat]=e)}else x.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${s}"`);break}case"START":c.startTimeOffset=Gi(s);break;case"MAP":{const e=new ci(s,c);if(C.duration){const t=new Y(r,l);qi(t,e,i,p),g=t,C.initSegment=g,g.rawProgramDateTime&&!C.rawProgramDateTime&&(C.rawProgramDateTime=g.rawProgramDateTime)}else{const t=C.byteRangeEndOffset;if(t){const e=C.byteRangeStartOffset;A=`${t-e}@${e}`}else A=null;qi(C,e,i,p),g=C,T=!0}g.cc=S;break}case"SERVER-CONTROL":_&&Yi(c,e,d),_=new ci(s),c.canBlockReload=_.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=_.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&_.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=_.optionalFloat("PART-HOLD-BACK",0),c.holdBack=_.optionalFloat("HOLD-BACK",0);break;case"PART-INF":{c.partTarget&&Yi(c,e,d);const t=new ci(s);c.partTarget=t.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=c.partList;e||(e=c.partList=[]);const t=v>0?e[e.length-1]:void 0,i=v++,n=new ci(s,c),r=new Z(n,C,l,i,t);e.push(r),C.duration+=r.duration;break}case"PRELOAD-HINT":{const e=new ci(s,c);c.preloadHint=e;break}case"RENDITION-REPORT":{const e=new ci(s,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(e);break}default:x.warn(`line parsed but not handled: ${d}`)}}}w&&!w.relurl?(u.pop(),b-=w.duration,c.partList&&(c.fragmentHint=w)):c.partList&&(Wi(C,w,h),C.cc=S,c.fragmentHint=C,p&&Vi(C,p,c)),c.targetduration||(c.playlistParsingError=new Error("Missing Target Duration"));const D=u.length,L=u[0],R=u[D-1];if(b+=c.skippedSegments*c.targetduration,b>0&&D&&R){c.averagetargetduration=b/D;const e=R.sn;c.endSN="initSegment"!==e?e:0,c.live||(R.endList=!0),k>0&&(!function(e,t){let i=e[t];for(let n=t;n--;){const t=e[n];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(u,k),L&&h.unshift(L))}return c.fragmentHint&&(b+=c.fragmentHint.duration),c.totalduration=b,h.length&&c.dateRangeTagCount&&L&&Hi(h,c),c.endCC=S,c}}function Hi(e,t){let i=e.length;if(!i){if(!t.hasProgramDateTime)return;{const n=t.fragments[t.fragments.length-1];e.push(n),i++}}const n=e[i-1],r=t.live?1/0:t.totalduration,s=Object.keys(t.dateRanges);for(let a=s.length;a--;){const l=t.dateRanges[s[a]],c=l.startDate.getTime();l.tagAnchor=n.ref;for(let n=i;n--;){var o;if((null==(o=e[n])?void 0:o.sn)<t.startSN)break;const i=ji(t,c,e,n,r);if(-1!==i){l.tagAnchor=t.fragments[i].ref;break}}}}function ji(e,t,i,n,r){const s=i[n];if(s){const a=s.programDateTime;if(t>=a||0===n){var o;if(t<=a+1e3*(((null==(o=i[n+1])?void 0:o.start)||r)-s.start)){const r=i[n].sn-e.startSN;if(r<0)return-1;const s=e.fragments;if(s.length>i.length){for(let o=(i[n+1]||s[s.length-1]).sn-e.startSN;o>r;o--){const e=s[o].programDateTime;if(t>=e&&t<e+1e3*s[o].duration)return o}}return r}}}return-1}function $i(e,t,i){var n,r;const s=new ci(e,i),o=null!=(n=s.METHOD)?n:"",a=s.URI,l=s.hexadecimalInteger("IV"),c=s.KEYFORMATVERSIONS,u=null!=(r=s.KEYFORMAT)?r:"identity";a&&s.IV&&!l&&x.error(`Invalid IV: ${s.IV}`);const h=a?Ui.resolve(a,t):"",d=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Pi(o,h,u,d,l,s.KEYID)}function Gi(e){const t=new ci(e).decimalFloatingPoint("TIME-OFFSET");return n(t)?t:null}function zi(e,t){let i=(e||"").split(/[ ,]+/).filter((e=>e));["video","audio","text"].forEach((e=>{const n=i.filter((t=>ke(t,e)));n.length&&(t[`${e}Codec`]=n.map((e=>e.split("/")[0])).join(","),i=i.filter((e=>-1===n.indexOf(e))))})),t.unknownCodecs=i}function Ki(e,t,i){const n=t[i];n&&(e[i]=n)}function Wi(e,t,i){e.rawProgramDateTime?i.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function qi(e,t,i,n){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",n&&(e.levelkeys=n),e.initSegment=null}function Vi(e,t,i){e.levelkeys=t;const{encryptedFragments:n}=i;n.length&&n[n.length-1].levelkeys===t||!Object.keys(t).some((e=>t[e].isCommonEncryption))||n.push(e)}function Yi(e,t,i){e.playlistParsingError=new Error(`#EXT-X-${t} must not appear more than once (${i[0]})`)}function Zi(e,t,i){e.playlistParsingError=new Error(`#EXT-X-${t} must appear before the first Media Segment (${i[0]})`)}function Xi(e,t){const i=t.startPTS;if(n(i)){let n,r=0;t.sn>e.sn?(r=i-e.start,n=e):(r=e.start-i,n=t),n.duration!==r&&n.setDuration(r)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration)}else t.setStart(Math.max(e.start-t.duration,0))}function Qi(e,t,i,r,s,o,a){r-i<=0&&(a.warn("Fragment should have a positive duration",t),r=i+t.duration,o=s+t.duration);let l=i,c=r;const u=t.startPTS,h=t.endPTS;if(n(u)){const d=Math.abs(u-i);e&&d>e.totalduration?a.warn(`media timestamps and playlist times differ by ${d}s for level ${t.level} ${e.url}`):n(t.deltaPTS)?t.deltaPTS=Math.max(d,t.deltaPTS):t.deltaPTS=d,l=Math.max(i,u),i=Math.min(i,u),s=void 0!==t.startDTS?Math.min(s,t.startDTS):s,c=Math.min(r,h),r=Math.max(r,h),o=void 0!==t.endDTS?Math.max(o,t.endDTS):o}const d=i-t.start;0!==t.start&&t.setStart(i),t.setDuration(r-t.start),t.startPTS=i,t.maxStartPTS=l,t.startDTS=s,t.endPTS=r,t.minEndPTS=c,t.endDTS=o;const f=t.sn;if(!e||f<e.startSN||f>e.endSN)return 0;let p;const _=f-e.startSN,g=e.fragments;for(g[_]=t,p=_;p>0;p--)Xi(g[p],g[p-1]);for(p=_;p<g.length-1;p++)Xi(g[p],g[p+1]);return e.fragmentHint&&Xi(g[g.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,d}function Ji(e,t,i){if(e===t)return;let r=null;const s=e.fragments;for(let e=s.length-1;e>=0;e--){const t=s[e].initSegment;if(t){r=t;break}}let o;e.fragmentHint&&delete e.fragmentHint.endPTS,function(e,t,i){const n=t.skippedSegments,r=Math.max(e.startSN,t.startSN)-t.startSN,s=(e.fragmentHint?1:0)+(n?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,o=t.startSN-e.startSN,a=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let c=r;c<=s;c++){const r=l[o+c];let s=a[c];if(n&&!s&&r&&(s=t.fragments[c]=r),r&&s){i(r,s,c,a);const n=r.relurl,o=s.relurl;if(n&&cn(n,o))return void(t.playlistParsingError=en(`media sequence mismatch ${s.sn}:`,e,t,r,s));if(r.cc!==s.cc)return void(t.playlistParsingError=en(`discontinuity sequence mismatch (${r.cc}!=${s.cc})`,e,t,r,s))}}}(e,t,((e,i,s,a)=>{if((!t.startCC||t.skippedSegments)&&i.cc!==e.cc){const n=e.cc-i.cc;for(let e=s;e<a.length;e++)a[e].cc+=n;t.endCC=a[a.length-1].cc}n(e.startPTS)&&n(e.endPTS)&&(i.setStart(i.startPTS=e.startPTS),i.startDTS=e.startDTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.setDuration(e.endPTS-e.startPTS),i.duration&&(o=i),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(i.elementaryStreams=e.elementaryStreams),i.loader=e.loader,e.hasStats&&(i.stats=e.stats),e.initSegment&&(i.initSegment=e.initSegment,r=e.initSegment)}));const a=t.fragments,l=t.fragmentHint?a.concat(t.fragmentHint):a;if(r&&l.forEach((e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=r)?void 0:t.relurl)||(e.initSegment=r)})),t.skippedSegments){if(t.deltaUpdateFailed=a.some((e=>!e)),t.deltaUpdateFailed){i.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)a.shift();t.startSN=a[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){const{dateRanges:n,recentlyRemovedDateranges:r}=t,s=y({},e);r&&r.forEach((e=>{delete s[e]}));const o=Object.keys(s).length;if(!o)return n;return Object.keys(n).forEach((e=>{const t=s[e],r=new hi(n[e].attr,t);r.isValid?(s[e]=r,t||(r.tagOrder+=o)):i.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${it(n[e].attr)}"`)})),s}(e.dateRanges,t,i));const n=e.fragments.filter((e=>e.rawProgramDateTime));if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e<l.length;e++)null===l[e].programDateTime&&Wi(l[e],l[e-1],n);Hi(n,t)}t.endCC=a[a.length-1].cc}if(!t.startCC){var c;const i=sn(e,t.startSN-1);t.startCC=null!=(c=null==i?void 0:i.cc)?c:a[0].cc}!function(e,t,i){if(e&&t){let n=0;for(let r=0,s=e.length;r<=s;r++){const s=e[r],o=t[r+n];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?i(s,o):n--}}}(e.partList,t.partList,((e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),o?Qi(t,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS,i):tn(e,t),a.length&&(t.totalduration=t.edge-a[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const u=t.advancedDateTime;if(t.advanced&&u){const e=t.edge;t.driftStart||(t.driftStartTime=u,t.driftStart=e),t.driftEndTime=u,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}function en(e,t,i,n,r){return new Error(`${e} ${r.url}\nPlaylist starting @${t.startSN}\n${t.m3u8}\n\nPlaylist starting @${i.startSN}\n${i.m3u8}`)}function tn(e,t,i=!0){const n=t.startSN+t.skippedSegments-e.startSN,r=e.fragments,s=n>=0;let o=0;if(s&&n<r.length)o=r[n].start;else if(s&&t.startSN===e.endSN+1)o=e.fragmentEnd;else if(s&&i)o=e.fragmentStart+n*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return;o=e.fragmentStart}nn(t,o)}function nn(e,t){if(t){const i=e.fragments;for(let n=e.skippedSegments;n<i.length;n++)i[n].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function rn(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){const n=e.fragments,r=4;if(n.length&&i*r>t){const e=1e3*n[n.length-1].duration;e<i&&(i=e)}}else i/=2;return Math.round(i)}function sn(e,t,i){if(!e)return null;let n=e.fragments[t-e.startSN];return n||(n=e.fragmentHint,n&&n.sn===t?n:t<e.startSN&&i&&i.sn===t?i:null)}function on(e,t,i){return e?an(e.partList,t,i):null}function an(e,t,i){if(e)for(let n=e.length;n--;){const r=e[n];if(r.index===i&&r.fragment.sn===t)return r}return null}function ln(e){e.forEach(((e,t)=>{var i;null==(i=e.details)||i.fragments.forEach((e=>{e.level=t,e.initSegment&&(e.initSegment.level=t)}))}))}function cn(e,t){return!(e===t||!t)&&un(e)!==un(t)}function un(e){return e.replace(/\?[^?]*$/,"")}function hn(e,t){for(let n=0,r=e.length;n<r;n++){var i;if((null==(i=e[n])?void 0:i.cc)===t)return e[n]}return null}function dn(e,t){const i=e.start+t;e.startPTS=i,e.setStart(i),e.endPTS=i+e.duration}function fn(e,t){const i=t.fragments;for(let t=0,n=i.length;t<n;t++)dn(i[t],e);t.fragmentHint&&dn(t.fragmentHint,e),t.alignedSliding=!0}function pn(e,t){if(!function(e,t){return!!(e&&t.startCC<e.endCC&&t.endCC>e.startCC)}(t,e))return;const i=Math.min(t.endCC,e.endCC),n=hn(t.fragments,i),r=hn(e.fragments,i);if(!n||!r)return;x.log(`Aligning playlist at start of dicontinuity sequence ${i}`);fn(n.start-r.start,e)}function _n(e,t){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;const i=e.fragments,n=t.fragments;if(!i.length||!n.length)return;let r,s;const o=Math.min(t.endCC,e.endCC);t.startCC<o&&e.startCC<o&&(r=hn(n,o),s=hn(i,o)),r&&s||(r=n[Math.floor(n.length/2)],s=hn(i,r.cc)||i[Math.floor(i.length/2)]);const a=r.programDateTime,l=s.programDateTime;if(!a||!l)return;fn((l-a)/1e3-(s.start-r.start),e)}function gn(e,t,i){mn(e,t,i),e.addEventListener(t,i)}function mn(e,t,i){e.removeEventListener(t,i)}const vn=function(e){let t="";const i=e.length;for(let n=0;n<i;n++)t+=`[${e.start(n).toFixed(3)}-${e.end(n).toFixed(3)}]`;return t},yn="STOPPED",bn="IDLE",Sn="KEY_LOADING",En="FRAG_LOADING",wn="FRAG_LOADING_WAITING_RETRY",Cn="WAITING_TRACK",kn="PARSING",Tn="PARSED",An="ENDED",xn="ERROR",Dn="WAITING_INIT_PTS",Ln="WAITING_LEVEL";class Rn extends Qt{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=yn,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:e,fragCurrent:t,media:i,mediaBuffer:r,state:s}=this,o=i?i.currentTime:0,a=ti.bufferInfo(r||i,o,e.maxBufferHole),l=!a.len;if(this.log(`Media seeking to ${n(o)?o.toFixed(3):o}, state: ${s}, ${l?"out of":"in"} buffer`),this.state===An)this.resetLoadingState();else if(t){const i=e.maxFragLookUpTolerance,n=t.start-i,r=t.start+t.duration+i;if(l||r<a.start||n>a.end){const e=o>r;(o<n||e)&&(e&&t.loader&&(this.log(`Cancelling fragment load for seek (sn: ${t.sn})`),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(i){this.fragmentTracker.removeFragmentsInRange(o,1/0,this.playlistType,!0);if(o>this.lastCurrentTime&&(this.lastCurrentTime=o),!this.loadingParts){const e=Math.max(a.end,o),t=this.shouldLoadParts(this.getLevelDetails(),e);t&&(this.log(`LL-Part loading ON after seeking to ${o.toFixed(2)} with buffer @${e.toFixed(2)}`),this.loadingParts=t)}}this.hls.hasEnoughToStart||(this.log(`Setting ${l?"startPosition":"nextLoadPosition"} to ${o} for seek without enough to start`),this.nextLoadPosition=o,l&&(this.startPosition=o)),l&&this.state===bn&&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 Vt(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Wt(e.config)}registerListeners(){const{hls:e}=this;e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(l.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===yn)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=yn}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return-1===t&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=ti.bufferedInfo(r,e.start,0));const s=e.nextStart;if(s&&s>n&&s<t.edge)return!1;if(this.media.currentTime<e.start)return!1;const o=t.partList;if(null!=o&&o.length){const e=o[o.length-1];return ti.isBuffered(this.media,e.start+e.duration/2)}const a=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(a)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;var t;return e?(null==(t=this.getLevelDetails())?void 0:t.appliedTimelineOffset)||e:0}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;gn(i,"seeking",this.onMediaSeeking),gn(i,"ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===yn&&this.startLoad(n.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(null!==n){if(n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),mn(n,"seeking",this.onMediaSeeking),mn(n,"ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i)return this.resetLoadingState(),void this.resetTransmuxer();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=yn,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){this._doFragLoad(e,t,i,(e=>{const t=e.frag;if(this.fragContextChanged(t))return this.warn(`${t.type} sn: ${t.sn}${e.part?" part: "+e.part.index:""} of ${this.fragInfo(t,!1,e.part)}) was dropped during download.`),void this.fragmentTracker.removeFragment(t);t.stats.chunkCount++,this._handleFragmentLoadProgress(e)})).then((e=>{if(!e)return;const t=this.state,i=e.frag;this.fragContextChanged(i)?(t===En||!this.fragCurrent&&t===kn)&&(this.fragmentTracker.removeFragment(i),this.state=bn):("payload"in e&&(this.log(`Loaded ${i.type} sn: ${i.sn} of ${this.playlistLabel()} ${i.level}`),this.hls.trigger(l.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e))})).catch((t=>{this.state!==yn&&this.state!==xn&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))}))}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Ot){const t=e.type,n=this.getFwdBufferInfo(this.mediaBuffer,t),r=Math.max(e.duration,n?n.len:this.config.maxBufferLength),s=this.backtrackFragment;(1===(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(r,e.duration))&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Mt&&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(null==t?void 0:t.live)&&"EVENT"!==t.type&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger(l.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then((e=>{const t=null==e?void 0:e.frag;if(!t||this.fragContextChanged(t)||!this.levels)throw new Error("init load aborted");return e})).then((e=>{const{hls:t}=this,{frag:i,payload:n}=e,r=i.decryptdata;if(n&&n.byteLength>0&&null!=r&&r.key&&r.iv&&_i(r.method)){const s=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),r.key.buffer,r.iv.buffer,gi(r.method)).catch((e=>{throw t.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:i}),e})).then((n=>{const r=self.performance.now();return t.trigger(l.FRAG_DECRYPTED,{frag:i,payload:n,stats:{tstart:s,tdecrypt:r}}),e.payload=n,this.completeInitSegmentLoad(e)}))}return this.completeInitSegmentLoad(e)})).catch((t=>{this.state!==yn&&this.state!==xn&&(this.warn(t),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!==yn&&(this.state=bn),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var i,n;const r=e.tracks;if(r&&!t.encrypted&&(null!=(i=r.audio)&&i.encrypted||null!=(n=r.video)&&n.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const e=this.media,i=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${e?"attached mediaKeys: "+e.mediaKeys:"detached"})`);return this.warn(i.message),!e||e.mediaKeys?!1:(this.hls.trigger(l.ERROR,{type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_NO_KEYS,fatal:!1,error:i,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?vn(ti.getBuffered(i)):"(detached)"})`),V(e)){var n;if(e.type!==_){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return void(this.state=bn)}const t=null==(n=this.levels)?void 0:n[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=bn}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:r}=e,s=!r||0===r.length||r.some((e=>!e)),o=new Jt(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!s);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var s;this.fragCurrent=e;const o=t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(!e.encrypted||null!=(s=e.decryptdata)&&s.key)e.encrypted||(a=this.keyLoader.loadClear(e,o.encryptedFragments,this.startFragRequested),a&&this.log("[eme] blocking frag load until media-keys acquired"));else if(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Sn,this.fragCurrent=e,a=this.keyLoader.load(e).then((e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(l.KEY_LOADED,e),this.state===Sn&&(this.state=bn),e})),this.hls.trigger(l.KEY_LOADING,{frag:e}),null===this.fragCurrent)return this.log("context changed in KEY_LOADING"),Promise.resolve(null);const c=this.fragPrevious;if(V(e)&&(!c||e.sn!==c.sn)){const i=this.shouldLoadParts(t.details,e.end);i!==this.loadingParts&&(this.log(`LL-Part loading ${i?"ON":"OFF"} loading sn ${null==c?void 0:c.sn}->${e.sn}`),this.loadingParts=i)}if(i=Math.max(e.start,i||0),this.loadingParts&&V(e)){const n=o.partList;if(n&&r){i>o.fragmentEnd&&o.fragmentHint&&(e=o.fragmentHint);const s=this.getNextPart(n,e,i);if(s>-1){const c=n[s];let u;return e=this.fragCurrent=c.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${c.index} (${s}/${n.length-1}) of ${this.fragInfo(e,!1,c)}) cc: ${e.cc} [${o.startSN}-${o.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=c.start+c.duration,this.state=En,u=a?a.then((i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,c,t,r))).catch((e=>this.handleFragLoadError(e))):this.doFragPartsLoad(e,c,t,r).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(l.FRAG_LOADING,{frag:e,part:c,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):u}if(!e.url||this.loadedEndOfParts(n,i))return Promise.resolve(null)}}var u;if(V(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${null==(u=o.partList)?void 0:u.filter((e=>e.loaded)).map((e=>`[${e.start}-${e.end}]`))}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+o.startSN+"-"+o.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),n(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=En;const h=this.config.progressive;let d;return d=h&&a?a.then((t=>!t||this.fragContextChanged(t.frag)?null:this.fragmentLoader.load(e,r))).catch((e=>this.handleFragLoadError(e))):Promise.all([this.fragmentLoader.load(e,h?r:void 0),a]).then((([e])=>(!h&&r&&r(e),e))).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(l.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,i,n){return new Promise(((r,s)=>{var o;const a=[],c=null==(o=i.details)?void 0:o.partList,u=t=>{this.fragmentLoader.loadPart(e,t,n).then((n=>{a[t.index]=n;const s=n.part;this.hls.trigger(l.FRAG_LOADED,n);const o=on(i.details,e.sn,t.index+1)||an(c,e.sn,t.index+1);if(!o)return r({frag:e,part:s,partsLoaded:a});u(o)})).catch(s)};u(t)}))}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===a.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===o.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(l.ERROR,t)}else this.hls.trigger(l.ERROR,{type:o.OTHER_ERROR,details:a.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==kn)return void(this.fragCurrent||this.state===yn||this.state===xn||(this.state=bn));const{frag:i,part:n,level:r}=t,s=self.performance.now();i.stats.parsing.end=s,n&&(n.stats.parsing.end=s);const o=this.getLevelDetails(),a=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);a!==this.loadingParts&&(this.log(`LL-Part loading ${a?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=a),this.updateLevelTiming(i,n,r,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const r=e.partList[0];if(r.fragment.type===_)return!1;if(t>=r.end+((null==(i=e.fragmentHint)?void 0:i.duration)||0)){var n;if((this.hls.hasEnoughToStart?(null==(n=this.media)?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:r,part:s}=e;if(null==t||!t[n])return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const o=t[n],a=o.details,l=s>-1?on(a,r,s):null,c=l?l.fragment:sn(a,r,i);return c?(i&&i!==c&&(c.stats=i.stats),{frag:c,part:l,level:o}):null}bufferFragmentData(e,t,i,n,r){if(this.state!==kn)return;const{data1:s,data2:o}=e;let a=s;if(o&&(a=_e(s,o)),!a.length)return;const c=this.initPTS[t.cc],u=c?-c.baseTime/c.timescale:void 0,h={type:e.type,frag:t,part:i,chunkMeta:n,offset:u,parent:t.type,data:a};if(this.hls.trigger(l.BUFFER_APPENDING,h),e.dropped&&e.independent&&!i){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!ti.isBuffered(t,t.currentTime))return void this.flushMainBuffer(0,e.start);const i=t.currentTime,n=ti.bufferInfo(t,i,0),r=e.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*r),o=Math.max(Math.min(e.start-s,n.end-s),i+s);e.start-o>s&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var i;const r=this.getLoadPosition();if(!n(r))return null;const s=this.lastCurrentTime>r||null!=(i=this.media)&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,s)}getFwdBufferInfoAtPos(e,t,i,n){const r=ti.bufferInfo(e,t,n);if(0===r.len&&void 0!==r.nextStart){const s=this.fragmentTracker.getBufferedFrag(t,i);if(s&&(r.nextStart<=s.end||s.gap)){const i=Math.max(Math.min(r.nextStart,s.end)-t,n);return ti.bufferInfo(e,t,i)}}return r}getMaxBufferLength(e){const{config:t}=this;let i;return i=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),r=Math.max(e-3*t,i.maxMaxBufferLength/2,n);return r>=n&&(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0)}getAppendedFrag(e,t=f){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:r}=this,s=i[0].start,o=r.lowLatencyMode&&!!t.partList;let a=null;if(t.live){const i=r.initialLiveManifestSize;if(n<i)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${i})`),null;if(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<s){var l;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),a=this.getInitialLiveFragment(t);const i=this.hls.startPosition,n=this.hls.liveSyncPosition,r=a?(-1!==i&&i>=s?i:n)||a.start:e;this.log(`Setting startPosition to ${r} to match start frag at live edge. mainStart: ${i} liveSyncPosition: ${n} frag.start: ${null==(l=a)?void 0:l.start}`),this.startPosition=this.nextLoadPosition=r}}else e<=s&&(a=i[0]);if(!a){const i=this.loadingParts?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,i,t)}let c=this.filterReplacedPrimary(a,t);if(!c&&a){const e=a.sn-t.startSN;c=this.filterReplacedPrimary(i[e+1]||null,t)}return this.mapToInitFragWhenRequired(c)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===Ft||i===Mt&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,r){let s=null;if(e.gap&&(s=this.getNextFragment(this.nextLoadPosition,t),s&&!s.gap&&i.nextStart)){const e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(null!==e&&i.len+e.len>=r){const e=s.sn;return this.loopSn!==e&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${e}`),this.loopSn=e),null}}return this.loopSn=void 0,s}get primaryPrefetch(){if(In(this.config)){var e;if(null==(e=this.hls.interstitialsManager)||null==(e=e.playingItem)?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(In(this.config)&&e.type!==_){const i=this.hls.interstitialsManager,n=null==i?void 0:i.bufferingItem;if(n){const i=n.event;if(i){if(i.appendInPlace||Math.abs(e.start-n.start)>1||0===n.start)return null}else{if(e.end<=n.start&&!1===(null==t?void 0:t.live))return null;if(e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}}const r=null==i?void 0:i.playerQueue;if(r)for(let t=r.length;t--;){const i=r[t].interstitial;if(i.appendInPlace&&e.start>=i.startTime&&e.end<=i.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let n=-1,r=!1,s=!0;for(let o=0,a=e.length;o<a;o++){const a=e[o];if(s=s&&!a.independent,n>-1&&i<a.start)break;const l=a.loaded;l?n=-1:(r||(a.independent||s)&&a.fragment===t)&&(a.fragment!==t&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${a.start}`),n=o),r=l}return n}loadedEndOfParts(e,t){let i;for(let n=e.length;n--;){if(i=e[n],!i.loaded)return!1;if(t>i.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!n(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;for(let n=0;n<e.length;++n){const r=e[n];if(pt(t,i,r))return r}return null}(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const s=t[n-e.startSN];i.cc===s.cc&&(r=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=_t(e,i.cc,i.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(r=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:r}=this,{fragments:s,endSN:o}=i;const{fragmentHint:a}=i,{maxFragLookUpTolerance:l}=n,c=i.partList,u=!!(this.loadingParts&&null!=c&&c.length&&a);let h;if(u&&!this.bitrateTest&&c[c.length-1].fragment.sn===a.sn&&(s=s.concat(a),o=a.sn),e<t){var d;h=dt(r,s,e,e<this.lastCurrentTime||e>t-l||null!=(d=this.media)&&d.paused||!this.startFragRequested?0:l)}else h=s[s.length-1];if(h){const e=h.sn-i.startSN,t=this.fragmentTracker.getState(h);if((t===Ft||t===Mt&&h.gap)&&(r=h),r&&h.sn===r.sn&&(!u||c[0].fragment.sn>h.sn||!i.live)){if(h.level===r.level){const t=s[e+1];h=h.sn<o&&this.fragmentTracker.getState(t)!==Ft?t:null}}}return h}alignPlaylists(e,t,i){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,o=!t,a=e.alignedSliding&&n(s);if(o||!a&&!s){!function(e,t){e&&(pn(t,e),t.alignedSliding||_n(t,e),t.alignedSliding||t.skippedSegments||tn(e,t,!1))}(i,e);const n=e.fragmentStart;return this.log(`Live playlist sliding: ${n.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),n}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const r=this.timelineOffset;if(-1===i){const s=null!==this.startTimeOffset,o=s?this.startTimeOffset:e.startTimeOffset;null!==o&&n(o)?(i=t+o,o<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${o} 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 null!=(e=this.hls)&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&V(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===wn)||(this.state=bn)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;var r;if(this.fragContextChanged(n))return void this.warn(`Frag load error must match current frag to retry ${n.url} > ${null==(r=this.fragCurrent)?void 0:r.url}`);const s=t.details===a.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(n,!0);const o=t.errorAction;if(!o)return void(this.state=xn);const{action:l,flags:c,retryCount:u=0,retryConfig:h}=o,d=!!h,f=d&&l===At,p=d&&!o.resolved&&c===Dt,_=null==(i=this.hls.latestLevelDetails)?void 0:i.live;if(!f&&p&&V(n)&&!n.endList&&_&&!vt(t))this.resetFragmentErrors(e),this.treatAsGap(n),o.resolved=!0;else if((f||p)&&u<h.maxNumRetry){var g;const i=wt(null==(g=t.response)?void 0:g.code),r=bt(h,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+r,this.state=wn,o.resolved=!0,i)return this.log("Waiting for connection (offline)"),this.retryDate=1/0,void(t.reason="offline");this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${u+1}/${h.maxNumRetry} in ${r}ms`)}else if(h){if(this.resetFragmentErrors(e),!(u<h.maxNumRetry))return void this.warn(`${t.details} reached or exceeded max retry (${u})`);s||l===Tt||(o.resolved=!0)}else this.state=l===kt?Ln:xn;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!wt(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=bn)}reduceLengthAndFlushBuffer(e){if(this.state===kn||this.state===Tn){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),r=n&&n.len>.5;r&&this.reduceMaxBufferLength(n.len,(null==t?void 0:t.duration)||10);const s=!r;return s&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(e){e===p&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==yn&&(this.state=bn)}afterBufferFlushed(e,t,i){if(!e)return;const n=ti.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===An&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==yn&&(this.state=bn)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;null!=t&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${-1===e.level?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,n){const r=i.details;if(!r)return void this.warn("level.details undefined");var s;if(!Object.keys(e.elementaryStreams).reduce(((t,s)=>{const o=e.elementaryStreams[s];if(o){const a=o.endPTS-o.startPTS;if(a<=0)return this.warn(`Could not parse fragment ${e.sn} ${s} duration reliably (${a})`),t||!1;const c=n?0:Qi(r,e,o.startPTS,o.endPTS,o.startDTS,o.endDTS,this);return this.hls.trigger(l.LEVEL_PTS_UPDATED,{details:r,level:i,drift:c,type:s,frag:e,start:o.startPTS,end:o.endPTS}),!0}return t}),!1)&&(0===i.fragmentError&&this.treatAsGap(e,i),null===(null==(s=this.transmuxer)?void 0:s.error))){const t=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(t.message),this.hls.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Tn,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(l.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===f?"level":"track"}fragInfo(e,t=!0,i){var n,r;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${(null!=(n=t&&!i?e.startPTS:(i||e).start)?n:NaN).toFixed(3)}-${(null!=(r=t&&!i?e.endPTS:(i||e).end)?r:NaN).toFixed(3)}]${i&&"main"===e.type?"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;null==(e=this.transmuxer)||e.reset()}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function In(e){return!!e.interstitialsController&&!1!==e.enableInterstitialPlayback}class Pn{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;return e.length?(i=1===e.length?e[0]:function(e,t){const i=new Uint8Array(t);let n=0;for(let t=0;t<e.length;t++){const r=e[t];i.set(r,n),n+=r.length}return i}(e,t),this.reset(),i):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}var On,Mn={exports:{}};var Fn=(On||(On=1,function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function s(e,t,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||e,o),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,n,r=[];if(0===this._eventsCount)return r;for(n in e=this._events)t.call(e,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,s=n.length,o=new Array(s);r<s;r++)o[r]=n[r].fn;return o},a.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,r,s,o){var a=i?i+e:e;if(!this._events[a])return!1;var l,c,u=this._events[a],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,r),!0;case 5:return u.fn.call(u.context,t,n,r,s),!0;case 6:return u.fn.call(u.context,t,n,r,s,o),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,r);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(e,t,i){return s(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return s(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,n,r){var s=i?i+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||o(this,s);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==t||r&&!a[l].once||n&&a[l].context!==n)&&c.push(a[l]);c.length?this._events[s]=1===c.length?c[0]:c:o(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,e.exports=a}(Mn)),Mn.exports),Bn=O(Fn);const Nn="1.6.12",Un={};function Hn(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function jn(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function $n(e,t){let i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3],i}function Gn(e,t){const i=t;let n=0;for(;jn(e,t);){n+=10;n+=$n(e,t+6),Hn(e,t+10)&&(n+=10),t+=n}if(n>0)return e.subarray(i,i+n)}function zn(e,t){return 255===e[t]&&240==(246&e[t+1])}function Kn(e,t){return 1&e[t+1]?7:9}function Wn(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function qn(e,t){return t+1<e.length&&zn(e,t)}function Vn(e,t){if(qn(e,t)){const i=Kn(e,t);if(t+i>=e.length)return!1;const n=Wn(e,t);if(n<=i)return!1;const r=t+n;return r===e.length||qn(e,r)}return!1}function Yn(e,t,i,n,r){if(!e.samplerate){const s=function(e,t,i,n){const r=t[i+2],s=r>>2&15;if(s>12){const t=new Error(`invalid ADTS sampling index:${s}`);return void e.emit(l.ERROR,l.ERROR,{type:o.MEDIA_ERROR,details:a.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}const c=1+(r>>6&3),u=t[i+3]>>6&3|(1&r)<<2,h="mp4a.40."+c,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][s];let f=s;5!==c&&29!==c||(f-=3);const p=[c<<3|(14&f)>>1,(1&f)<<7|u<<3];return x.log(`manifest codec:${n}, parsed codec:${h}, channels:${u}, rate:${d} (ADTS object type:${c} sampling index:${s})`),{config:p,samplerate:d,channelCount:u,codec:h,parsedCodec:h,manifestCodec:n}}(t,i,n,r);if(!s)return;y(e,s)}}function Zn(e){return 9216e4/e}function Xn(e,t,i,n,r){const s=n+r*Zn(e.samplerate),o=function(e,t){const i=Kn(e,t);if(t+i<=e.length){const n=Wn(e,t)-i;if(n>0)return{headerLength:i,frameLength:n}}}(t,i);let a;if(o){const{frameLength:n,headerLength:r}=o,l=r+n,c=Math.max(0,i+l-t.length);c?(a=new Uint8Array(l-r),a.set(t.subarray(i+r,t.length),0)):a=t.subarray(i+r,i+l);const u={unit:a,pts:s};return c||e.samples.push(u),{sample:u,length:l,missing:c}}const l=t.length-i;a=new Uint8Array(l),a.set(t.subarray(i,t.length),0);return{sample:{unit:a,pts:s},length:l,missing:-1}}function Qn(e,t){return jn(e,t)&&$n(e,t+6)+10<=e.length-t}function Jn(e,t=0,i=1/0){return function(e,t,i,n){const r=function(e){return e instanceof ArrayBuffer?e:e.buffer}(e);let s=1;"BYTES_PER_ELEMENT"in n&&(s=n.BYTES_PER_ELEMENT);const o=(h=e,h&&h.buffer instanceof ArrayBuffer&&void 0!==h.byteLength&&void 0!==h.byteOffset?e.byteOffset:0),a=(o+e.byteLength)/s,l=(o+t)/s,c=Math.floor(Math.max(0,Math.min(l,a))),u=Math.floor(Math.min(c+Math.max(i,0),a));var h;return new n(r,c,u-c)}(e,t,i,Uint8Array)}function er(e){const t={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(e.size<2)return;if(3!==e.data[0])return void console.log("Ignore frame with unrecognized character encoding");const i=e.data.subarray(1).indexOf(0);if(-1===i)return;const n=R(Jn(e.data,1,i)),r=e.data[2+i],s=e.data.subarray(3+i).indexOf(0);if(-1===s)return;const o=R(Jn(e.data,3+i,s));let a;return a="--\x3e"===n?R(Jn(e.data,4+i+s)):function(e){return e instanceof ArrayBuffer?e:0==e.byteOffset&&e.byteLength==e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}(e.data.subarray(4+i+s)),t.mimeType=n,t.pictureType=r,t.description=o,t.data=a,t}function tr(e){return"PRIV"===e.type?function(e){if(e.size<2)return;const t=R(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}}(e):"W"===e.type[0]?function(e){if("WXXX"===e.type){if(e.size<2)return;let t=1;const i=R(e.data.subarray(t),!0);t+=i.length+1;const n=R(e.data.subarray(t));return{key:e.type,info:i,data:n}}const t=R(e.data);return{key:e.type,info:"",data:t}}(e):"APIC"===e.type?er(e):function(e){if(e.size<2)return;if("TXXX"===e.type){let t=1;const i=R(e.data.subarray(t),!0);t+=i.length+1;const n=R(e.data.subarray(t));return{key:e.type,info:i,data:n}}const t=R(e.data.subarray(1));return{key:e.type,info:"",data:t}}(e)}function ir(e){const t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=$n(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}}function nr(e){let t=0;const i=[];for(;jn(e,t);){const n=$n(e,t+6);e[t+5]>>6&1&&(t+=10),t+=10;const r=t+n;for(;t+10<r;){const n=ir(e.subarray(t)),r=tr(n);r&&i.push(r),t+=n.size+10}Hn(e,t)&&(t+=10)}return i}function rr(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function sr(e){if(8===e.data.byteLength){const t=new Uint8Array(e.data),i=1&t[3];let n=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return n/=45,i&&(n+=47721858.84),Math.round(n)}}function or(e){const t=nr(e);for(let e=0;e<t.length;e++){const i=t[e];if(rr(i))return sr(i)}}let ar=function(e){return e.audioId3="org.id3",e.dateRange="com.apple.quicktime.HLS",e.emsg="https://aomedia.org/emsg/ID3",e.misbklv="urn:misb:KLV:bin:1910.1",e}({});function lr(e="",t=9e4){return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class cr{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=_e(this.cachedData,e),this.cachedData=null);let i,r=Gn(e,0),s=r?r.length:0;const o=this._audioTrack,a=this._id3Track,l=r?or(r):void 0,c=e.length;for((null===this.basePTS||0===this.frameIndex&&n(l))&&(this.basePTS=ur(l,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),r&&r.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:ar.audioId3,duration:Number.POSITIVE_INFINITY});s<c;){if(this.canParse(e,s)){const t=this.appendFrame(o,e,s);t?(this.frameIndex++,this.lastPTS=t.sample.pts,s+=t.length,i=s):s=c}else Qn(e,s)?(r=Gn(e,s),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:ar.audioId3,duration:Number.POSITIVE_INFINITY}),s+=r.length,i=s):s++;if(s===c&&i!==c){const t=e.slice(i);this.cachedData?this.cachedData=_e(this.cachedData,t):this.cachedData=t}}return{audioTrack:o,videoTrack:lr(),id3Track:a,textTrack:lr()}}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:lr(),id3Track:this._id3Track,textTrack:lr()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const ur=(e,t,i)=>{if(n(e))return 90*e;return 9e4*t+(i?9e4*i.baseTime/i.timescale:0)};let hr=null;const dr=[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],fr=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],pr=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],_r=[0,1,1,4];function gr(e,t,i,n,r){if(i+24>t.length)return;const s=mr(t,i);if(s&&i+s.frameLength<=t.length){const o=n+r*(9e4*s.samplesPerFrame/s.sampleRate),a={unit:t.subarray(i,i+s.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=s.channelCount,e.samplerate=s.sampleRate,e.samples.push(a),{sample:a,length:s.frameLength,missing:0}}}function mr(e,t){const i=e[t+1]>>3&3,n=e[t+1]>>1&3,r=e[t+2]>>4&15,s=e[t+2]>>2&3;if(1!==i&&0!==r&&15!==r&&3!==s){const o=e[t+2]>>1&1,a=e[t+3]>>6,l=1e3*dr[14*(3===i?3-n:3===n?3:4)+r-1],c=fr[3*(3===i?0:2===i?1:2)+s],u=3===a?1:2,h=pr[i][n],d=_r[n],f=8*h*d,p=Math.floor(h*l/c+o)*d;if(null===hr){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);hr=e?parseInt(e[1]):0}return!!hr&&hr<=87&&2===n&&l>=224e3&&0===a&&(e[t+3]=128|e[t+3]),{sampleRate:c,channelCount:u,frameLength:p,samplesPerFrame:f}}}function vr(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function yr(e,t){return t+1<e.length&&vr(e,t)}function br(e,t){if(t+1<e.length&&vr(e,t)){const i=4,n=mr(e,t);let r=i;null!=n&&n.frameLength&&(r=n.frameLength);const s=t+r;return s===e.length||yr(e,s)}return!1}const Sr=(e,t)=>{let i=0,n=5;t+=n;const r=new Uint32Array(1),s=new Uint32Array(1),o=new Uint8Array(1);for(;n>0;){o[0]=e[t];const a=Math.min(n,8),l=8-a;s[0]=4278190080>>>24+l<<l,r[0]=(o[0]&s[0])>>l,i=i?i<<a|r[0]:r[0],t+=1,n-=a}return i};class Er extends cr{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const n=wr(e,t,i,this.basePTS,this.frameIndex);if(-1!==n){return{sample:e.samples[e.samples.length-1],length:n,missing:0}}}static probe(e){if(!e)return!1;const t=Gn(e,0);if(!t)return!1;const i=t.length;return 11===e[i]&&119===e[i+1]&&void 0!==or(t)&&Sr(e,i)<16}}function wr(e,t,i,n,r){if(i+8>t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;const s=t[i+4]>>6;if(s>=3)return-1;const o=[48e3,44100,32e3][s],a=63&t[i+4],l=2*[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*a+s];if(i+l>t.length)return-1;const c=t[i+6]>>5;let u=0;2===c?u+=2:(1&c&&1!==c&&(u+=2),4&c&&(u+=2));const h=(t[i+6]<<8|t[i+7])>>12-u&1,d=[2,1,2,3,3,4,4,5][c]+h,f=t[i+5]>>3,p=7&t[i+5],_=new Uint8Array([s<<6|f<<1|p>>2,(3&p)<<6|c<<3|h<<2|a>>4,a<<4&224]),g=n+r*(1536/o*9e4),m=t.subarray(i,i+l);return e.config=_,e.channelCount=d,e.samplerate=o,e.samples.push({unit:m,pts:g}),l}const Cr=/\/emsg[-/]ID3/i;function kr(e,t){return n(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}class Tr{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Wt(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,jt)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const r=n.subarray(16,n.length-n.length%16),s=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(s).then((r=>{const s=new Uint8Array(r);n.set(s,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t);let n=0;for(let t=32;t<e.length-16;t+=160,n+=16)i.set(e.subarray(t,t+16),n);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let n=0;for(let t=32;t<e.length-16;t+=160,n+=16)e.set(i.subarray(n,n+16),t);return e}decryptAvcSample(e,t,i,n,r){const s=be(r.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then((o=>{r.data=this.getAvcDecryptedUnit(s,o),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)})).catch(n)}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void n();const r=e[t].units;for(;!(i>=r.length);i++){const s=r[i];if(!(s.data.length<=48||1!==s.type&&5!==s.type||(this.decryptAvcSample(e,t,i,n,s),this.decrypter.isSync())))return}}}}class Ar{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,n=this.VideoSample;if(n&&0!==n.units.length||(n=e[e.length-1]),null!=(t=n)&&t.units){const e=n.units;i=e[e.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){const i=t.samples,n=i.length;if(!n)return void t.dropped++;{const t=i[n-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let r=e.naluState||0;const s=r,o=[];let a,l,c,u=0,h=-1,d=0;for(-1===r&&(h=0,d=this.getNALuType(t,0),r=0,u=1);u<n;)if(a=t[u++],r)if(1!==r)if(a)if(1===a){if(l=u-r-1,h>=0){const e={data:t.subarray(h,l),type:d};o.push(e)}else{const i=this.getLastNalUnit(e.samples);i&&(s&&u<=4-s&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-s)),l>0&&(i.data=_e(i.data,t.subarray(0,l)),i.state=0))}u<n?(c=this.getNALuType(t,u),h=u,d=c,r=0):r=-1}else r=0;else r=3;else r=a?0:2;else r=a?0:1;if(h>=0&&r>=0){const e={data:t.subarray(h,n),type:d,state:r};o.push(e)}if(0===o.length){const i=this.getLastNalUnit(e.samples);i&&(i.data=_e(i.data,t))}return e.naluState=r,o}}class xr{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");n.set(e.subarray(i,i+r)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&x.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}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(0!=(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 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Dr extends Ar{parsePES(e,t,i,n){const r=this.parseNALu(e,i.data,n);let s,o=this.VideoSample,a=!1;i.data=null,o&&r.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach((n=>{var r,l;switch(n.type){case 1:{let t=!1;s=!0;const r=n.data;if(a&&r.length>4){const e=this.readSliceType(r);2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var c;if(t)null!=(c=o)&&c.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null);o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.frame=!0,o.key=t;break}case 5:s=!0,null!=(r=o)&&r.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.key=!0,o.frame=!0;break;case 6:s=!0,ye(n.data,1,i.pts,t.samples);break;case 7:{var u,h;s=!0,a=!0;const t=n.data,i=this.readSPS(t);if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(u=e.pixelRatio)?void 0:u[0])!==i.pixelRatio[0]||(null==(h=e.pixelRatio)?void 0:h[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t];const n=t.subarray(1,4);let r="avc1.";for(let e=0;e<3;e++){let t=n[e].toString(16);t.length<2&&(t="0"+t),r+=t}e.codec=r}break}case 8:s=!0,e.pps=[n.data];break;case 9:s=!0,e.audFound=!0,null!=(l=o)&&l.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:s=!0;break;default:s=!1}if(o&&s){o.units.push(n)}})),n&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}getNALuType(e,t){return 31&e[t]}readSliceType(e){const t=new xr(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i,n=8,r=8;for(let s=0;s<e;s++)0!==r&&(i=t.readEG(),r=(n+i+256)%256),n=0===r?n:r}readSPS(e){const t=new xr(e);let i,n,r,s=0,o=0,a=0,l=0;const c=t.readUByte.bind(t),u=t.readBits.bind(t),h=t.readUEG.bind(t),d=t.readBoolean.bind(t),f=t.skipBits.bind(t),p=t.skipEG.bind(t),_=t.skipUEG.bind(t),g=this.skipScalingList.bind(this);c();const m=c();if(u(5),f(3),c(),_(),100===m||110===m||122===m||244===m||44===m||83===m||86===m||118===m||128===m){const e=h();if(3===e&&f(1),_(),_(),f(1),d())for(n=3!==e?8:12,r=0;r<n;r++)d()&&g(r<6?16:64,t)}_();const v=h();if(0===v)h();else if(1===v)for(f(1),p(),p(),i=h(),r=0;r<i;r++)p();_(),f(1);const y=h(),b=h(),S=u(1);0===S&&f(1),f(1),d()&&(s=h(),o=h(),a=h(),l=h());let E=[1,1];if(d()&&d()){switch(c()){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:E=[c()<<8|c(),c()<<8|c()]}}return{width:Math.ceil(16*(y+1)-2*s-2*o),height:(2-S)*(b+1)*16-(S?2:4)*(a+l),pixelRatio:E}}}class Lr extends Ar{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,n){const r=this.parseNALu(e,i.data,n);let s,o=this.VideoSample,a=!1;i.data=null,o&&r.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach((n=>{var r,l;switch(n.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||(o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),o.frame=!0,s=!0;break;case 16:case 17:case 18:case 21:var c;if(s=!0,a)null!=(c=o)&&c.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null);o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.key=!0,o.frame=!0;break;case 19:case 20:s=!0,null!=(r=o)&&r.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.key=!0,o.frame=!0;break;case 39:s=!0,ye(n.data,2,i.pts,t.samples);break;case 32:s=!0,e.vps||("object"!=typeof e.params&&(e.params={}),e.params=y(e.params,this.readVPS(n.data)),this.initVPS=n.data),e.vps=[n.data];break;case 33:if(s=!0,a=!0,void 0===e.vps||e.vps[0]===this.initVPS||void 0===e.sps||this.matchSPS(e.sps[0],n.data)||(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const t=this.readSPS(n.data);e.width=t.width,e.height=t.height,e.pixelRatio=t.pixelRatio,e.codec=t.codecString,e.sps=[],"object"!=typeof e.params&&(e.params={});for(const i in t.params)e.params[i]=t.params[i]}this.pushParameterSet(e.sps,n.data,e.vps),o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.key=!0;break;case 34:if(s=!0,"object"==typeof e.params){if(!e.pps){e.pps=[];const t=this.readPPS(n.data);for(const i in t)e.params[i]=t[i]}this.pushParameterSet(e.pps,n.data,e.vps)}break;case 35:s=!0,e.audFound=!0,null!=(l=o)&&l.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:s=!1}if(o&&s){o.units.push(n)}})),n&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(126&e[t])>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n<e.byteLength;n++)n>=2&&3===e[n]&&0===e[n-1]&&0===e[n-2]||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new xr(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);return{numTemporalLayers:t.readBits(3)+1,temporalIdNested:t.readBoolean()}}readSPS(e){const t=new xr(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=t.readBits(2),r=t.readBoolean(),s=t.readBits(5),o=t.readUByte(),a=t.readUByte(),l=t.readUByte(),c=t.readUByte(),u=t.readUByte(),h=t.readUByte(),d=t.readUByte(),f=t.readUByte(),p=t.readUByte(),_=t.readUByte(),g=t.readUByte(),m=[],v=[];for(let e=0;e<i;e++)m.push(t.readBoolean()),v.push(t.readBoolean());if(i>0)for(let e=i;e<8;e++)t.readBits(2);for(let e=0;e<i;e++)m[e]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),v[e]&&t.readUByte();t.readUEG();const y=t.readUEG();3==y&&t.skipBits(1);const b=t.readUEG(),S=t.readUEG(),E=t.readBoolean();let w=0,C=0,k=0,T=0;E&&(w+=t.readUEG(),C+=t.readUEG(),k+=t.readUEG(),T+=t.readUEG());const A=t.readUEG(),x=t.readUEG(),D=t.readUEG();for(let e=t.readBoolean()?0:i;e<=i;e++)t.skipUEG(),t.skipUEG(),t.skipUEG();t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.readBoolean()){if(t.readBoolean())for(let e=0;e<4;e++)for(let i=0;i<(3===e?2:6);i++){if(t.readBoolean()){const i=Math.min(64,1<<4+(e<<1));e>1&&t.readEG();for(let e=0;e<i;e++)t.readEG()}else t.readUEG()}}t.readBoolean(),t.readBoolean();t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const L=t.readUEG();let R=0;for(let e=0;e<L;e++){let i=!1;if(0!==e&&(i=t.readBoolean()),i){e===L&&t.readUEG(),t.readBoolean(),t.readUEG();let i=0;for(let e=0;e<=R;e++){const e=t.readBoolean();let n=!1;e||(n=t.readBoolean()),(e||n)&&i++}R=i}else{const e=t.readUEG(),i=t.readUEG();R=e+i;for(let i=0;i<e;i++)t.readUEG(),t.readBoolean();for(let e=0;e<i;e++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const e=t.readUEG();for(let i=0;i<e;i++){for(let e=0;e<D+4;e++)t.readBits(1);t.readBits(1)}}let I=0,P=1,O=1,M=!0,F=1,B=0;t.readBoolean(),t.readBoolean();let N=!1;if(t.readBoolean()){if(t.readBoolean()){const e=t.readUByte();e>0&&e<16?(P=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],O=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):255===e&&(P=t.readBits(16),O=t.readBits(16))}t.readBoolean()&&t.readBoolean();if(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(),N=t.readBoolean(),N&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG());if(t.readBoolean()){F=t.readBits(32),B=t.readBits(32);t.readBoolean()&&t.readUEG();if(t.readBoolean()){const e=t.readBoolean(),n=t.readBoolean();let r=!1;(e||n)&&(r=t.readBoolean(),r&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),r&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let s=0;s<=i;s++){M=t.readBoolean();let i=!1;M||t.readBoolean()?t.readEG():i=t.readBoolean();const s=i?1:t.readUEG()+1;if(e)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),r&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(n)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),r&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),I=t.readUEG())}let U=b,H=S;if(E){let e=1,t=1;1===y?e=t=2:2==y&&(e=2),U=b-e*C-e*w,H=S-t*T-t*k}const j=n?["A","B","C"][n]:"",$=o<<24|a<<16|l<<8|c;let G=0;for(let e=0;e<32;e++)G=(G|($>>e&1)<<31-e)>>>0;let z=G.toString(16);1===s&&"2"===z&&(z="6");return{codecString:`hvc1.${j}${s}.${z}.${r?"H":"L"}${g}.B0`,params:{general_tier_flag:r,general_profile_idc:s,general_profile_space:n,general_profile_compatibility_flags:[o,a,l,c],general_constraint_indicator_flags:[u,h,d,f,p,_],general_level_idc:g,bit_depth:A+8,bit_depth_luma_minus8:A,bit_depth_chroma_minus8:x,min_spatial_segmentation_idc:I,chroma_format_idc:y,frame_rate:{fixed:M,fps:B/F}},width:U,height:H,pixelRatio:[P,O]}}readPPS(e){const t=new xr(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 i=t.readBoolean(),n=t.readBoolean();let r=1;return n&&i?r=0:n?r=3:i&&(r=2),{parallelismType:r}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Rr=188;class Ir{constructor(e,t,i,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.videoParser=null}static probe(e,t){const i=Ir.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),-1!==i}static syncOffset(e){const t=e.length;let i=Math.min(940,t-Rr)+1,n=0;for(;n<i;){let r=!1,s=-1,o=0;for(let a=n;a<t;a+=Rr){if(71!==e[a]||t-a!==Rr&&71!==e[a+Rr]){if(o)return-1;break}if(o++,-1===s&&(s=a,0!==s&&(i=Math.min(s+18612,e.length-Rr)+1)),r||(r=0===Pr(e,a)),r&&o>1&&(0===s&&o>2||a+Rr>i))return s}n++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:ee[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Ir.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=Ir.createTrack("audio",n),this._id3Track=Ir.createTrack("id3"),this._txtTrack=Ir.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,n=!1){let r;i||(this.sampleAes=null);const s=this._videoTrack,o=this._audioTrack,a=this._id3Track,l=this._txtTrack;let c=s.pid,u=s.pesData,h=o.pid,d=a.pid,f=o.pesData,p=a.pesData,_=null,g=this.pmtParsed,m=this._pmtId,v=e.length;if(this.remainderData&&(v=(e=_e(this.remainderData,e)).length,this.remainderData=null),v<Rr&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:s,id3Track:a,textTrack:l};const y=Math.max(0,Ir.syncOffset(e));v-=(v-y)%Rr,v<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,v,e.buffer.byteLength-v));let b=0;for(let t=y;t<v;t+=Rr)if(71===e[t]){const n=!!(64&e[t+1]),v=Pr(e,t);let b;if((48&e[t+3])>>4>1){if(b=t+5+e[t+4],b===t+Rr)continue}else b=t+4;switch(v){case c:n&&(u&&(r=Nr(u,this.logger))&&(this.readyVideoParser(s.segmentCodec),null!==this.videoParser&&this.videoParser.parsePES(s,l,r,!1)),u={data:[],size:0}),u&&(u.data.push(e.subarray(b,t+Rr)),u.size+=t+Rr-b);break;case h:if(n){if(f&&(r=Nr(f,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,r);break;case"mp3":this.parseMPEGPES(o,r);break;case"ac3":this.parseAC3PES(o,r)}f={data:[],size:0}}f&&(f.data.push(e.subarray(b,t+Rr)),f.size+=t+Rr-b);break;case d:n&&(p&&(r=Nr(p,this.logger))&&this.parseID3PES(a,r),p={data:[],size:0}),p&&(p.data.push(e.subarray(b,t+Rr)),p.size+=t+Rr-b);break;case 0:n&&(b+=e[b]+1),m=this._pmtId=Or(e,b);break;case m:{n&&(b+=e[b]+1);const r=Mr(e,b,this.typeSupported,i,this.observer,this.logger);c=r.videoPid,c>0&&(s.pid=c,s.segmentCodec=r.segmentVideoCodec),h=r.audioPid,h>0&&(o.pid=h,o.segmentCodec=r.segmentAudioCodec),d=r.id3Pid,d>0&&(a.pid=d),null===_||g||(this.logger.warn(`MPEG-TS PMT found at ${t} after unknown PID '${_}'. Backtracking to sync byte @${y} to parse all TS packets.`),_=null,t=y-188),g=this.pmtParsed=!0;break}case 17:case 8191:break;default:_=v}}else b++;b>0&&Fr(this.observer,new Error(`Found ${b} TS packet/s that do not start with 0x47`),void 0,this.logger),s.pesData=u,o.pesData=f,a.pesData=p;const S={audioTrack:o,videoTrack:s,id3Track:a,textTrack:l};return n&&this.extractRemainingSamples(S),S}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:n,textTrack:r}=e,s=i.pesData,o=t.pesData,a=n.pesData;let l;if(s&&(l=Nr(s,this.logger))?(this.readyVideoParser(i.segmentCodec),null!==this.videoParser&&(this.videoParser.parsePES(i,r,l,!0),i.pesData=null)):i.pesData=s,o&&(l=Nr(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=o&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;a&&(l=Nr(a,this.logger))?(this.parseID3PES(n,l),n.pesData=null):n.pesData=a}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new Tr(this.observer,this.config,t);return this.decrypt(n,r)}readyVideoParser(e){null===this.videoParser&&("avc"===e?this.videoParser=new Dr:"hevc"===e&&(this.videoParser=new Lr))}decrypt(e,t){return new Promise((i=>{const{audioTrack:n,videoTrack:r}=e;n.samples&&"aac"===n.segmentCodec?t.decryptAacSamples(n.samples,0,(()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)})):i(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)}))}))}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const n=this.aacOverFlow;let r,s,o,a=t.data;if(n){this.aacOverFlow=null;const t=n.missing,r=n.sample.unit.byteLength;if(-1===t)a=_e(n.sample.unit,a);else{const s=r-t;n.sample.unit.set(a.subarray(0,t),s),e.samples.push(n.sample),i=n.missing}}for(r=i,s=a.length;r<s-1&&!qn(a,r);r++);if(r!==i){let e;const t=r<s-1;if(e=t?`AAC PES did not start with ADTS header,offset:${r}`:"No ADTS header found in AAC PES",Fr(this.observer,new Error(e),t,this.logger),!t)return}if(Yn(e,this.observer,a,r,this.audioCodec),void 0!==t.pts)o=t.pts;else{if(!n)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");{const t=Zn(e.samplerate);o=n.sample.pts+t}}let l,c=0;for(;r<s;){if(l=Xn(e,a,r,o,c),r+=l.length,l.missing){this.aacOverFlow=l;break}for(c++;r<s-1&&!qn(a,r);r++);}}parseMPEGPES(e,t){const i=t.data,n=i.length;let r=0,s=0;const o=t.pts;if(void 0!==o)for(;s<n;)if(yr(i,s)){const t=gr(e,i,s,o,r);if(!t)break;s+=t.length,r++}else s++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseAC3PES(e,t){{const i=t.data,n=t.pts;if(void 0===n)return void this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");const r=i.length;let s,o=0,a=0;for(;a<r&&(s=wr(e,i,a,n,o++))>0;)a+=s}}parseID3PES(e,t){if(void 0===t.pts)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=y({},t,{type:this._videoTrack?ar.emsg:ar.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Pr(e,t){return((31&e[t+1])<<8)+e[t+2]}function Or(e,t){return(31&e[t+10])<<8|e[t+11]}function Mr(e,t,i,n,r,s){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<a;){const a=Pr(e,t),l=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!n){Br("ADTS AAC",s);break}case 15:-1===o.audioPid&&(o.audioPid=a);break;case 21:-1===o.id3Pid&&(o.id3Pid=a);break;case 219:if(!n){Br("H.264",s);break}case 27:-1===o.videoPid&&(o.videoPid=a);break;case 3:case 4:i.mpeg||i.mp3?-1===o.audioPid&&(o.audioPid=a,o.segmentAudioCodec="mp3"):s.log("MPEG audio found, not supported in this browser");break;case 193:if(!n){Br("AC-3",s);break}case 129:i.ac3?-1===o.audioPid&&(o.audioPid=a,o.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===o.audioPid&&l>0){let n=t+5,r=l;for(;r>2;){if(106===e[n])!0!==i.ac3?s.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=a,o.segmentAudioCodec="ac3");const t=e[n+1]+2;n+=t,r-=t}}break;case 194:case 135:return Fr(r,new Error("Unsupported EC-3 in M2TS found"),void 0,s),o;case 36:-1===o.videoPid&&(o.videoPid=a,o.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"))}t+=l+5}return o}function Fr(e,t,i,n){n.warn(`parsing error: ${t.message}`),e.emit(l.ERROR,l.ERROR,{type:o.MEDIA_ERROR,details:a.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function Br(e,t){t.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function Nr(e,t){let i,n,r,s,o,a=0;const l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=_e(l[0],l[1]),l.splice(1,1);i=l[0];if(1===(i[0]<<16)+(i[1]<<8)+i[2]){if(n=(i[4]<<8)+i[5],n&&n>e.size-6)return null;const c=i[7];192&c&&(s=536870912*(14&i[9])+4194304*(255&i[10])+16384*(254&i[11])+128*(255&i[12])+(254&i[13])/2,64&c?(o=536870912*(14&i[14])+4194304*(255&i[15])+16384*(254&i[16])+128*(255&i[17])+(254&i[18])/2,s-o>54e5&&(t.warn(`${Math.round((s-o)/9e4)}s delta between PTS and DTS, align them`),s=o)):o=s),r=i[8];let u=r+9;if(e.size<=u)return null;e.size-=u;const h=new Uint8Array(e.size);for(let e=0,t=l.length;e<t;e++){i=l[e];let t=i.byteLength;if(u){if(u>t){u-=t;continue}i=i.subarray(u),t-=u,u=0}h.set(i,a),a+=t}return n&&(n-=r+3),{data:h,pts:s,dts:o,len:n}}return null}class Ur{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)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(6===t)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])}else{if(1===t)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(2===t)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(3===t)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])}}}const Hr=Math.pow(2,32)-1;class jr{static init(){let e;for(e in jr.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:[]},jr.types)jr.types.hasOwnProperty(e)&&(jr.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]);jr.HDLR_TYPES={video:t,audio:i};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);jr.STTS=jr.STSC=jr.STCO=r,jr.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),jr.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),jr.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),jr.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);jr.FTYP=jr.box(jr.types.ftyp,s,a,s,o),jr.DINF=jr.box(jr.types.dinf,jr.box(jr.types.dref,n))}static box(e,...t){let i=8,n=t.length;const r=n;for(;n--;)i+=t[n].byteLength;const s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=255&i,s.set(e,4),n=0,i=8;n<r;n++)s.set(t[n],i),i+=t[n].byteLength;return s}static hdlr(e){return jr.box(jr.types.hdlr,jr.HDLR_TYPES[e])}static mdat(e){return jr.box(jr.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Hr+1)),n=Math.floor(t%(Hr+1));return jr.box(jr.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,255&e,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))}static mdia(e){return jr.box(jr.types.mdia,jr.mdhd(e.timescale||0,e.duration||0),jr.hdlr(e.type),jr.minf(e))}static mfhd(e){return jr.box(jr.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?jr.box(jr.types.minf,jr.box(jr.types.smhd,jr.SMHD),jr.DINF,jr.stbl(e)):jr.box(jr.types.minf,jr.box(jr.types.vmhd,jr.VMHD),jr.DINF,jr.stbl(e))}static moof(e,t,i){return jr.box(jr.types.moof,jr.mfhd(e),jr.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=jr.trak(e[t]);return jr.box.apply(null,[jr.types.moov,jr.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(jr.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=jr.trex(e[t]);return jr.box.apply(null,[jr.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Hr+1)),n=Math.floor(t%(Hr+1)),r=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,255&e,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,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 jr.box(jr.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let n,r;for(n=0;n<t.length;n++)r=t[n].flags,i[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return jr.box(jr.types.sdtp,i)}static stbl(e){return jr.box(jr.types.stbl,jr.stsd(e),jr.box(jr.types.stts,jr.STTS),jr.box(jr.types.stsc,jr.STSC),jr.box(jr.types.stsz,jr.STSZ),jr.box(jr.types.stco,jr.STCO))}static avc1(e){let t,i,n,r=[],s=[];for(t=0;t<e.sps.length;t++)i=e.sps[t],n=i.byteLength,r.push(n>>>8&255),r.push(255&n),r=r.concat(Array.prototype.slice.call(i));for(t=0;t<e.pps.length;t++)i=e.pps[t],n=i.byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(i));const o=jr.box(jr.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(s))),a=e.width,l=e.height,c=e.pixelRatio[0],u=e.pixelRatio[1];return jr.box(jr.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,a>>8&255,255&a,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,jr.box(jr.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),jr.box(jr.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,u>>24,u>>16&255,u>>8&255,255&u])))}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,255&t,0,0])}static mp4a(e){return jr.box(jr.types.mp4a,jr.audioStsd(e),jr.box(jr.types.esds,jr.esds(e)))}static mp3(e){return jr.box(jr.types[".mp3"],jr.audioStsd(e))}static ac3(e){return jr.box(jr.types["ac-3"],jr.audioStsd(e),jr.box(jr.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if("audio"===e.type){if("aac"===t)return jr.box(jr.types.stsd,jr.STSD,jr.mp4a(e));if("ac3"===t&&e.config)return jr.box(jr.types.stsd,jr.STSD,jr.ac3(e));if("mp3"===t&&"mp3"===e.codec)return jr.box(jr.types.stsd,jr.STSD,jr.mp3(e))}else{if(!e.pps||!e.sps)throw new Error("video track missing pps or sps");if("avc"===t)return jr.box(jr.types.stsd,jr.STSD,jr.avc1(e));if("hevc"===t&&e.vps)return jr.box(jr.types.stsd,jr.STSD,jr.hvc1(e))}throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),n=e.width||0,r=e.height||0,s=Math.floor(i/(Hr+1)),o=Math.floor(i%(Hr+1));return jr.box(jr.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,255&t,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,r>>8&255,255&r,0,0]))}static traf(e,t){const i=jr.sdtp(e),n=e.id,r=Math.floor(t/(Hr+1)),s=Math.floor(t%(Hr+1));return jr.box(jr.types.traf,jr.box(jr.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),jr.box(jr.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,s>>24,s>>16&255,s>>8&255,255&s])),jr.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,jr.box(jr.types.trak,jr.tkhd(e),jr.mdia(e))}static trex(e){const t=e.id;return jr.box(jr.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],n=i.length,r=12+16*n,s=new Uint8Array(r);let o,a,l,c,u,h;for(t+=8+r,s.set(["video"===e.type?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),o=0;o<n;o++)a=i[o],l=a.duration,c=a.size,u=a.flags,h=a.cts,s.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,c>>>24&255,c>>>16&255,c>>>8&255,255&c,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,61440&u.degradPrio,15&u.degradPrio,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*o);return jr.box(jr.types.trun,s)}static initSegment(e){jr.types||jr.init();const t=jr.moov(e);return _e(jr.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],n=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),3|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let r=n.length;for(let e=0;e<i.length;e+=1){r+=3;for(let t=0;t<i[e].length;t+=1)r+=2+i[e][t].length}const s=new Uint8Array(r);s.set(n,0),r=n.length;const o=i.length-1;for(let e=0;e<i.length;e+=1){s.set(new Uint8Array([32+e|(e===o?128:0),0,i[e].length]),r),r+=3;for(let t=0;t<i[e].length;t+=1)s.set(new Uint8Array([i[e][t].length>>8,255&i[e][t].length]),r),r+=2,s.set(i[e][t],r),r+=i[e][t].length}const a=jr.box(jr.types.hvcC,s),l=e.width,c=e.height,u=e.pixelRatio[0],h=e.pixelRatio[1];return jr.box(jr.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,l>>8&255,255&l,c>>8&255,255&c,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]),a,jr.box(jr.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),jr.box(jr.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,h>>24,h>>16&255,h>>8&255,255&h])))}}jr.types=void 0,jr.HDLR_TYPES=void 0,jr.STTS=void 0,jr.STSC=void 0,jr.STCO=void 0,jr.STSZ=void 0,jr.VMHD=void 0,jr.SMHD=void 0,jr.STSD=void 0,jr.FTYP=void 0,jr.DINF=void 0;function $r(e,t,i=1,n=!1){const r=e*t*i;return n?Math.round(r):r}function Gr(e,t=!1){return $r(e,1e3,1/9e4,t)}let zr,Kr=null,Wr=null;function qr(e,t,i,n){return{duration:t,size:i,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class Vr extends E{constructor(e,t,i,n){if(super("mp4-remuxer",n),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===Kr){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Kr=e?parseInt(e[1]):0}if(null===Wr){const e=navigator.userAgent.match(/Safari\/(\d+)/i);Wr=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce(((e,n)=>{let r=n.pts,s=r-e;return s<-4294967296&&(t=!0,r=Yr(r,i),s=r-e),s>0?e:r}),i);return t&&this.debug("PTS rollover detected"),n}remux(e,t,i,n,r,s,o,a){let l,c,u,h,d,f,_=r,g=r;const m=e.pid>-1,v=t.pid>-1,y=t.samples.length,b=e.samples.length>0,S=o&&y>0||y>1;if((!m||b)&&(!v||S)||this.ISGenerated||o){if(this.ISGenerated){var E,w,C,k;const e=this.videoTrackConfig;(e&&(t.width!==e.width||t.height!==e.height||(null==(E=t.pixelRatio)?void 0:E[0])!==(null==(w=e.pixelRatio)?void 0:w[0])||(null==(C=t.pixelRatio)?void 0:C[1])!==(null==(k=e.pixelRatio)?void 0:k[1]))||!e&&S||null===this.nextAudioTs&&b)&&this.resetInitSegment()}this.ISGenerated||(u=this.generateIS(e,t,r,s));const i=this.isVideoContiguous;let n,o=-1;if(S&&(o=function(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!i&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,o>0){this.warn(`Dropped ${o} out of ${y} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(o),t.dropped+=o,g+=(t.samples[0].pts-e)/t.inputTimeScale,n=g}else-1===o&&(this.warn(`No keyframe found out of ${y} video samples`),f=!1);if(this.ISGenerated){if(b&&S){const i=this.getVideoStartPts(t.samples),n=(Yr(e.samples[0].pts,i)-i)/t.inputTimeScale;_+=Math.max(0,n),g+=Math.max(0,-n)}if(b){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),u=this.generateIS(e,t,r,s)),c=this.remuxAudio(e,_,this.isAudioContiguous,s,v||S||a===p?g:void 0),S){const n=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),u=this.generateIS(e,t,r,s)),l=this.remuxVideo(t,g,i,n)}}else S&&(l=this.remuxVideo(t,g,i,0));l&&(l.firstKeyFrame=o,l.independent=-1!==o,l.firstKeyFramePTS=n)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=Zr(i,r,this._initPTS,this._initDTS)),n.samples.length&&(h=Xr(n,r,this._initPTS))),{audio:c,video:l,initSegment:u,independent:f,text:h,id3:d}}generateIS(e,t,i,n){const r=e.samples,s=t.samples,o=this.typeSupported,a={},l=this._initPTS;let c,u,h,d=!l||n,f="audio/mp4",p=-1;if(d&&(c=u=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(f="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}a.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&o.mpeg?new Uint8Array(0):jr.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(p=e.id,h=e.inputTimeScale,l&&h===l.timescale?d=!1:c=u=r[0].pts-Math.round(h*i))}if(t.sps&&t.pps&&s.length){if(t.timescale=t.inputTimeScale,a.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:jr.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(p=t.id,h=t.inputTimeScale,l&&h===l.timescale)d=!1;else{const e=this.getVideoStartPts(s),t=Math.round(h*i);u=Math.min(u,Yr(s[0].dts,e)-t),c=Math.min(c,e-t)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(a).length)return this.ISGenerated=!0,d?(l&&this.warn(`Timestamps at playlist time: ${n?"":"~"}${i} ${c/h} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${c/h} (${c}/${h}) trackId: ${p}`),this._initPTS={baseTime:c,timescale:h,trackId:p},this._initDTS={baseTime:u,timescale:h,trackId:p}):c=h=void 0,{tracks:a,initPTS:c,timescale:h,trackId:p}}remuxVideo(e,t,i,n){const r=e.inputTimeScale,s=e.samples,c=[],u=s.length,h=this._initPTS,d=h.baseTime*r/h.timescale;let f,p,_=this.nextVideoTs,g=8,m=this.videoSampleDuration,v=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,S=!1;if(!i||null===_){const e=d+t*r,n=s[0].pts-Yr(s[0].dts,s[0].pts);Kr&&null!==_&&Math.abs(e-n-(_+d))<15e3?i=!0:_=e-n-d}const E=_+d;for(let e=0;e<u;e++){const t=s[e];t.pts=Yr(t.pts,E),t.dts=Yr(t.dts,E),t.dts<s[e>0?e-1:e].dts&&(S=!0)}S&&s.sort((function(e,t){const i=e.dts-t.dts,n=e.pts-t.pts;return i||n})),f=s[0].dts,p=s[s.length-1].dts;const w=p-f,C=w?Math.round(w/(u-1)):m||e.inputTimeScale/30;if(i){const i=f-E,n=i>C,r=i<-1;if((n||r)&&(n?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Gr(i,!0)} ms (${i}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Gr(-i,!0)} ms (${i}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!r||E>=s[0].pts||Kr)){f=E;const e=s[0].pts-i;if(n)s[0].dts=f,s[0].pts=e;else{let t=!0;for(let n=0;n<s.length&&!(s[n].dts>e&&t);n++){const e=s[n].pts;if(s[n].dts-=i,s[n].pts-=i,n<s.length-1){const i=s[n+1].pts;t=i<=s[n].pts==i<=e}}}this.log(`Video: Initial PTS/DTS adjusted: ${Gr(e,!0)}/${Gr(f,!0)}, delta: ${Gr(i,!0)} ms`)}}f=Math.max(0,f);let k=0,T=0,A=f;for(let e=0;e<u;e++){const t=s[e],i=t.units,n=i.length;let r=0;for(let e=0;e<n;e++)r+=i[e].data.length;T+=r,k+=n,t.length=r,t.dts<A?(t.dts=A,A+=C/4|0||1):A=t.dts,v=Math.min(t.pts,v),b=Math.max(t.pts,b)}p=s[u-1].dts;const x=T+4*k+8;let D;try{D=new Uint8Array(x)}catch(e){return void this.observer.emit(l.ERROR,l.ERROR,{type:o.MUX_ERROR,details:a.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:x,reason:`fail allocating video mdat ${x}`})}const L=new DataView(D.buffer);L.setUint32(0,x),D.set(jr.types.mdat,4);let R=!1,I=Number.POSITIVE_INFINITY,P=Number.POSITIVE_INFINITY,O=Number.NEGATIVE_INFINITY,M=Number.NEGATIVE_INFINITY;for(let e=0;e<u;e++){const t=s[e],i=t.units;let o,a=0;for(let e=0,t=i.length;e<t;e++){const t=i[e],n=t.data,r=t.data.byteLength;L.setUint32(g,r),g+=4,D.set(n,g),g+=r,a+=4+r}if(e<u-1)m=s[e+1].dts-t.dts,o=s[e+1].pts-t.pts;else{const i=this.config,a=e>0?t.dts-s[e-1].dts:C;if(o=e>0?t.pts-s[e-1].pts:C,i.stretchShortVideoTrack&&null!==this.nextAudioTs){const e=Math.floor(i.maxBufferHole*r),s=(n?v+n*r:this.nextAudioTs+d)-t.pts;s>e?(m=s-a,m<0?m=a:R=!0,this.log(`It is approximately ${s/90} ms to the next segment; using duration ${m/90} ms for the last video frame.`)):m=a}else m=a}const l=Math.round(t.pts-t.dts);I=Math.min(I,m),O=Math.max(O,m),P=Math.min(P,o),M=Math.max(M,o),c.push(qr(t.key,m,a,l))}if(c.length)if(Kr){if(Kr<70){const e=c[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(Wr&&M-P<O-I&&C/O<.025&&0===c[0].cts){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let e=f;for(let t=0,i=c.length;t<i;t++){const n=e+c[t].duration,r=e+c[t].cts;if(t<i-1){const e=n+c[t+1].cts;c[t].duration=e-r}else c[t].duration=t?c[t-1].duration:C;c[t].cts=0,e=n}}m=R||!m?C:m;const F=p+m;this.nextVideoTs=_=F-d,this.videoSampleDuration=m,this.isVideoContiguous=!0;const B={data1:jr.moof(e.sequenceNumber++,f,y(e,{samples:c})),data2:D,startPTS:(v-d)/r,endPTS:(b+m-d)/r,startDTS:(f-d)/r,endDTS:_/r,type:"video",hasAudio:!1,hasVideo:!0,nb:c.length,dropped:e.dropped};return e.samples=[],e.dropped=0,B}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(e,t,i,n,r){const s=e.inputTimeScale,c=s/(e.samplerate?e.samplerate:s),u=this.getSamplesPerFrame(e),h=u*c,d=this._initPTS,f="mp3"===e.segmentCodec&&this.typeSupported.mpeg,p=[],_=void 0!==r;let g=e.samples,m=f?0:8,v=this.nextAudioTs||-1;const b=d.baseTime*s/d.timescale,S=b+t*s;if(this.isAudioContiguous=i=i||g.length&&v>0&&(n&&Math.abs(S-(v+b))<9e3||Math.abs(Yr(g[0].pts,S)-(v+b))<20*h),g.forEach((function(e){e.pts=Yr(e.pts,S)})),!i||v<0){if(g=g.filter((e=>e.pts>=0)),!g.length)return;v=0===r?0:n&&!_?Math.max(0,S-b):g[0].pts-b}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let i=0,n=v+b;i<g.length;i++){const r=g[i],o=r.pts,a=o-n,l=Math.abs(1e3*a/s);if(a<=-t*h&&_)0===i&&(this.warn(`Audio frame @ ${(o/s).toFixed(3)}s overlaps marker by ${Math.round(1e3*a/s)} ms.`),this.nextAudioTs=v=o-b,n=o);else if(a>=t*h&&l<1e4&&_){let t=Math.round(a/h);for(n=o-t*h;n<0&&t&&h;)t--,n+=h;0===i&&(this.nextAudioTs=v=n-b),this.warn(`Injecting ${t} audio frames @ ${((n-b)/s).toFixed(3)}s due to ${Math.round(1e3*a/s)} ms gap.`);for(let s=0;s<t;s++){let t=Ur.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);t||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),t=r.unit.subarray()),g.splice(i,0,{unit:t,pts:n}),n+=h,i++}}r.pts=n,n+=h}}let E,w=null,C=null,k=0,T=g.length;for(;T--;)k+=g[T].unit.byteLength;for(let t=0,n=g.length;t<n;t++){const n=g[t],r=n.unit;let s=n.pts;if(null!==C){p[t-1].duration=Math.round((s-C)/c)}else{if(i&&"aac"===e.segmentCodec&&(s=v+b),w=s,!(k>0))return;k+=m;try{E=new Uint8Array(k)}catch(e){return void this.observer.emit(l.ERROR,l.ERROR,{type:o.MUX_ERROR,details:a.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:k,reason:`fail allocating audio mdat ${k}`})}if(!f){new DataView(E.buffer).setUint32(0,k),E.set(jr.types.mdat,4)}}E.set(r,m);const h=r.byteLength;m+=h,p.push(qr(!0,u,h,0)),C=s}const A=p.length;if(!A)return;const x=p[p.length-1];v=C-b,this.nextAudioTs=v+c*x.duration;const D=f?new Uint8Array(0):jr.moof(e.sequenceNumber++,w/c,y({},e,{samples:p}));e.samples=[];const L=(w-b)/s,R=v/s,I={data1:D,data2:E,startPTS:L,endPTS:R,startDTS:L,endDTS:R,type:"audio",hasAudio:!0,hasVideo:!1,nb:A};return this.isAudioContiguous=!0,I}}function Yr(e,t){let i;if(null===t)return e;for(i=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=i;return e}function Zr(e,t,i,n){const r=e.samples.length;if(!r)return;const s=e.inputTimeScale;for(let o=0;o<r;o++){const r=e.samples[o];r.pts=Yr(r.pts-i.baseTime*s/i.timescale,t*s)/s,r.dts=Yr(r.dts-n.baseTime*s/n.timescale,t*s)/s}const o=e.samples;return e.samples=[],{samples:o}}function Xr(e,t,i){const n=e.samples.length;if(!n)return;const r=e.inputTimeScale;for(let s=0;s<n;s++){const n=e.samples[s];n.pts=Yr(n.pts-i.baseTime*r/i.timescale,t*r)/r}e.samples.sort(((e,t)=>e.pts-t.pts));const s=e.samples;return e.samples=[],{samples:s}}function Qr(e,t,i=!1){return void 0!==(null==e?void 0:e.start)?(e.start+(i?e.duration:0))/e.timescale:t}function Jr(e,t,i){const n=e.codec;if(n&&n.length>4)return n;if(t===z){if("ec-3"===n||"ac-3"===n||"alac"===n)return n;if("fLaC"===n||"Opus"===n){return Pe(n,!1)}return i.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"}return i.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1"}try{zr=self.performance.now.bind(self.performance)}catch(e){zr=Date.now}const es=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,n){const r=this.videoTrack=lr("video",1),s=this.audioTrack=lr("audio",1),o=this.txtTrack=lr("text",1);if(this.id3Track=lr("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const a=le(e);if(a.video){const{id:e,timescale:t,codec:i,supplemental:n}=a.video;r.id=e,r.timescale=o.timescale=t,r.codec=i,r.supplemental=n}if(a.audio){const{id:e,timescale:t,codec:i}=a.audio;s.id=e,s.timescale=t,s.codec=i}o.id=ee.text,r.sampleDuration=0,r.duration=s.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let i=0;i<t;){const n=ne(e,i);if(n>8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=n>1?i+n:t}return!1}(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=_e(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},i=oe(e,["moof"]);if(i.length<2)return t.remainder=e,t;const n=i[i.length-1];return t.valid=e.slice(0,n.byteOffset-8),t.remainder=e.slice(n.byteOffset-8),t}(i);this.remainderData=t.remainder,n.samples=t.valid||new Uint8Array}else n.samples=i;const s=this.extractID3Track(n,t);return r.samples=ge(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(t,this.timeOffset);return i.samples=ge(e,t),{videoTrack:t,audioTrack:lr(),id3Track:n,textTrack:lr()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=oe(e.samples,["emsg"]);n&&n.forEach((e=>{const n=function(e){const t=e[0];let i="",n="",s=0,o=0,a=0,l=0,c=0,u=0;if(0===t){for(;"\0"!==te(e.subarray(u,u+1));)i+=te(e.subarray(u,u+1)),u+=1;for(i+=te(e.subarray(u,u+1)),u+=1;"\0"!==te(e.subarray(u,u+1));)n+=te(e.subarray(u,u+1)),u+=1;n+=te(e.subarray(u,u+1)),u+=1,s=ne(e,12),o=ne(e,16),l=ne(e,20),c=ne(e,24),u=28}else if(1===t){u+=4,s=ne(e,u),u+=4;const t=ne(e,u);u+=4;const o=ne(e,u);for(u+=4,a=2**32*t+o,r(a)||(a=Number.MAX_SAFE_INTEGER,x.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=ne(e,u),u+=4,c=ne(e,u),u+=4;"\0"!==te(e.subarray(u,u+1));)i+=te(e.subarray(u,u+1)),u+=1;for(i+=te(e.subarray(u,u+1)),u+=1;"\0"!==te(e.subarray(u,u+1));)n+=te(e.subarray(u,u+1)),u+=1;n+=te(e.subarray(u,u+1)),u+=1}return{schemeIdUri:i,value:n,timeScale:s,presentationTime:a,presentationTimeDelta:o,eventDuration:l,id:c,payload:e.subarray(u,e.byteLength)}}(e);if(Cr.test(n.schemeIdUri)){const e=kr(n,t);let r=4294967295===n.eventDuration?Number.POSITIVE_INFINITY:n.eventDuration/n.timeScale;r<=.001&&(r=Number.POSITIVE_INFINITY);const s=n.payload;i.samples.push({data:s,len:s.byteLength,dts:e,pts:e,type:ar.emsg,duration:r})}else if(this.config.enableEmsgKLVMetadata&&n.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const e=kr(n,t);i.samples.push({data:n.payload,len:n.payload.byteLength,dts:e,pts:e,type:ar.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}},remux:class extends E{constructor(e,t,i,n){super("passthrough-remuxer",n),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,n),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:n}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const{audio:r,video:s}=this.initData=le(e);if(t)!function(e,t){if(!e||!t)return;const i=t.keyId;i&&t.isCommonEncryption&&oe(e,["moov","trak"]).forEach((e=>{const t=oe(e,["mdia","minf","stbl","stsd"])[0].subarray(8);let n=oe(t,["enca"]);const r=n.length>0;r||(n=oe(t,["encv"])),n.forEach((e=>{oe(r?e.subarray(28):e.subarray(78),["sinf"]).forEach((e=>{const t=pe(e);if(t){const e=t.subarray(8,24);e.some((e=>0!==e))||(x.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${I(e)} -> ${I(i)}`),t.set(i,8))}}))}))}))}(e,t);else{const e=r||s;null!=e&&e.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${e.codec}")!`)}r&&(i=Jr(r,z,this)),s&&(n=Jr(s,K,this));const o={};r&&s?o.audiovideo={container:"video/mp4",codec:i+","+n,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:r?o.audio={container:"audio/mp4",codec:i,encrypted:r.encrypted,initSegment:e,id:"audio"}:s?o.video={container:"video/mp4",codec:n,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,i,r,s,o){var a,l;let{initPTS:c,lastEndTime:u}=this;const h={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};n(u)||(u=this.lastEndTime=s||0);const d=t.samples;if(!d.length)return h;const f={initPTS:void 0,timescale:void 0,trackId:void 0};let p=this.initData;if(null!=(a=p)&&a.length||(this.generateInitSegment(d),p=this.initData),null==(l=p)||!l.length)return this.warn("Failed to generate initSegment."),h;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const _=function(e,t,i){const r={},s=oe(e,["moof","traf"]);for(let e=0;e<s.length;e++){const o=s[e],a=oe(o,["tfhd"])[0],l=ne(a,4),c=t[l];if(!c)continue;r[l]||(r[l]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type});const u=r[l],h=oe(o,["tfdt"])[0];if(h){const e=h[0];let t=ne(h,4);1===e&&(t===Q?i.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(t*=Q+1,t+=ne(h,8))),n(t)&&(!n(u.start)||t<u.start)&&(u.start=t)}const d=c.default,f=ne(a,0)|(null==d?void 0:d.flags);let p=(null==d?void 0:d.duration)||0;8&f&&(p=ne(a,2&f?12:8));const _=oe(o,["trun"]);let g=u.start||0,m=0,v=p;for(let e=0;e<_.length;e++){const t=_[e],i=ne(t,4),n=u.sampleCount;u.sampleCount+=i;const r=1&t[3],s=4&t[3],o=1&t[2],a=2&t[2],l=4&t[2],c=8&t[2];let h=8,d=i;for(r&&(h+=4),s&&i&&(1&t[h+1]||void 0!==u.keyFrameIndex||(u.keyFrameIndex=n),h+=4,o?(v=ne(t,h),h+=4):v=p,a&&(h+=4),c&&(h+=4),g+=v,m+=v,d--);d--;)o?(v=ne(t,h),h+=4):v=p,a&&(h+=4),l&&(1&t[h+1]||void 0===u.keyFrameIndex&&(u.keyFrameIndex=u.sampleCount-(d+1),u.keyFrameStart=g),h+=4),c&&(h+=4),g+=v,m+=v;!m&&p&&(m+=p*i)}u.duration+=m}if(!Object.keys(r).some((e=>r[e].duration))){let t=1/0,i=0;const s=oe(e,["sidx"]);for(let e=0;e<s.length;e++){const n=ae(s[e]);if(null!=n&&n.references){t=Math.min(t,n.earliestPresentationTime/n.timescale);const e=n.references.reduce(((e,t)=>e+t.info.duration||0),0);i=Math.max(i,e+n.earliestPresentationTime/n.timescale)}}i&&n(i)&&Object.keys(r).forEach((e=>{r[e].duration||(r[e].duration=i*r[e].timescale-r[e].start)}))}return r}(d,p,this),g=p.audio?_[p.audio.id]:null,m=p.video?_[p.video.id]:null,v=Qr(m,1/0),y=Qr(g,1/0),b=Qr(m,0,!0),S=Qr(g,0,!0);let E=s,w=0;const C=g&&(!m||!c&&y<v||c&&c.trackId===p.audio.id),k=C?g:m;if(k){const e=k.timescale,t=k.start-s*e,i=C?p.audio.id:p.video.id;E=k.start/e,w=C?S-y:b-v,!o&&c||!function(e,t,i,n){if(null===e)return!0;const r=Math.max(n,1),s=t-e.baseTime/e.timescale;return Math.abs(s-i)>r}(c,E,s,w)&&e===c.timescale||(c&&this.warn(`Timestamps at playlist time: ${o?"":"~"}${s} ${t/e} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${E-s} (${t}/${e}) trackId: ${i}`),c=null,f.initPTS=t,f.timescale=e,f.trackId=i)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);c?(f.initPTS=c.baseTime,f.timescale=c.timescale,f.trackId=c.trackId):(f.timescale&&void 0!==f.trackId&&void 0!==f.initPTS||(this.warn("Could not set initPTS"),f.initPTS=E,f.timescale=1,f.trackId=-1),this.initPTS=c={baseTime:f.initPTS,timescale:f.timescale,trackId:f.trackId});const T=E-c.baseTime/c.timescale,A=T+w;w>0?this.lastEndTime=A:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const x=!!p.audio,D=!!p.video;let L="";x&&(L+="audio"),D&&(L+="video");const R={data1:d,startPTS:T,startDTS:T,endPTS:A,endDTS:A,type:L,hasAudio:x,hasVideo:D,nb:1,dropped:0,encrypted:!!p.audio&&p.audio.encrypted||!!p.video&&p.video.encrypted};h.audio=x&&!D?R:void 0,h.video=D?R:void 0;const I=null==m?void 0:m.sampleCount;if(I){const e=m.keyFrameIndex,t=-1!==e;R.nb=I,R.dropped=0===e||this.isVideoContiguous?0:t?e:I,R.independent=t,R.firstKeyFrame=e,t&&m.keyFrameStart&&(R.firstKeyFramePTS=(m.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(h.independent=t),this.isVideoContiguous||(this.isVideoContiguous=t),R.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${e}/${I} dropped: ${R.dropped} start: ${R.firstKeyFramePTS||"NA"}`)}return h.initSegment=f,h.id3=Zr(i,s,c,c),r.samples.length&&(h.text=Xr(r,s,c)),h}}},{demux:Ir,remux:Vr},{demux:class extends cr{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=Gn(e,0);let n=(null==i?void 0:i.length)||0;if(br(e,n))return!1;for(let i=e.length;n<i;n++)if(Vn(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return function(e,t){return t+5<e.length}(e,t)&&zn(e,t)&&Wn(e,t)<=e.length-t}(e,t)}appendFrame(e,t,i){Yn(e,this.observer,t,i,e.manifestCodec);const n=Xn(e,t,i,this.basePTS,this.frameIndex);if(n&&0===n.missing)return n}},remux:Vr},{demux:class extends cr{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Gn(e,0);let i=(null==t?void 0:t.length)||0;if(t&&11===e[i]&&119===e[i+1]&&void 0!==or(t)&&Sr(e,i)<=16)return!1;for(let t=e.length;i<t;i++)if(br(e,i))return x.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return vr(e,t)&&4<=e.length-t}(e,t)}appendFrame(e,t,i){if(null!==this.basePTS)return gr(e,t,i,this.basePTS,this.frameIndex)}},remux:Vr}];es.splice(2,0,{demux:Er,remux:Vr});class ts{constructor(e,t,i,n,r,s){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=r,this.logger=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const r=i.transmuxing;r.executeStart=zr();let s=new Uint8Array(e);const{currentTransmuxState:c,transmuxConfig:u}=this;n&&(this.currentTransmuxState=n);const{contiguous:h,discontinuity:d,trackSwitch:f,accurateTimeOffset:p,timeOffset:_,initSegmentChange:g}=n||c,{audioCodec:m,videoCodec:v,defaultInitPts:y,duration:b,initSegmentData:S}=u,E=function(e,t){let i=null;e.byteLength>0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t);return i}(s,t);if(E&&_i(E.method)){const e=this.getDecrypter(),t=gi(E.method);if(!e.isSync())return this.asyncResult=!0,this.decryptionPromise=e.webCryptoDecrypt(s,E.key.buffer,E.iv.buffer,t).then((e=>{const t=this.push(e,null,i);return this.decryptionPromise=null,t})),this.decryptionPromise;{let n=e.softwareDecrypt(s,E.key.buffer,E.iv.buffer,t);if(i.part>-1){const t=e.flush();n=t?t.buffer:t}if(!n)return r.executeEnd=zr(),is(i);s=new Uint8Array(n)}}const w=this.needsProbing(d,f);if(w){const e=this.configureTransmuxer(s);if(e)return this.logger.warn(`[transmuxer] ${e.message}`),this.observer.emit(l.ERROR,l.ERROR,{type:o.MEDIA_ERROR,details:a.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),r.executeEnd=zr(),is(i)}(d||f||g||w)&&this.resetInitSegment(S,m,v,b,t),(d||g||w)&&this.resetInitialTimestamp(y),h||this.resetContiguity();const C=this.transmux(s,E,_,p,i);this.asyncResult=ns(C);const k=this.currentTransmuxState;return k.contiguous=!0,k.discontinuity=!1,k.trackSwitch=!1,r.executeEnd=zr(),C}flush(e){const t=e.transmuxing;t.executeStart=zr();const{decrypter:i,currentTransmuxState:n,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then((()=>this.flush(e)));const s=[],{timeOffset:o}=n;if(i){const t=i.flush();t&&s.push(this.push(t.buffer,null,e))}const{demuxer:a,remuxer:l}=this;if(!a||!l){t.executeEnd=zr();const i=[is(e)];return this.asyncResult?Promise.resolve(i):i}const c=a.flush(o);return ns(c)?(this.asyncResult=!0,c.then((t=>(this.flushRemux(s,t,e),s)))):(this.flushRemux(s,c,e),this.asyncResult?Promise.resolve(s):s)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:r,id3Track:s,textTrack:o}=t,{accurateTimeOffset:a,timeOffset:l}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===f?"level":"track"} ${i.level}`);const c=this.remuxer.remux(n,r,s,o,l,a,!0,this.id);e.push({remuxResult:c,chunkMeta:i}),i.transmuxing.executeEnd=zr()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,n,r){const{demuxer:s,remuxer:o}=this;s&&o&&(s.resetInitSegment(e,t,i,n),o.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,r){let s;return s=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,n,r):this.transmuxUnencrypted(e,i,n,r),s}transmuxUnencrypted(e,t,i,n){const{audioTrack:r,videoTrack:s,id3Track:o,textTrack:a}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,s,o,a,t,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,r){return this.demuxer.demuxSampleAes(e,t,i).then((e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,n,!1,this.id),chunkMeta:r})))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n}=this;let r;for(let t=0,i=es.length;t<i;t++){var s;if(null!=(s=es[t].demux)&&s.probe(e,this.logger)){r=es[t];break}}if(!r)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,a=this.remuxer,l=r.remux,c=r.demux;a&&a instanceof l||(this.remuxer=new l(i,t,n,this.logger)),o&&o instanceof c||(this.demuxer=new c(i,t,n,this.logger),this.probe=c.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Wt(this.config)),e}}const is=e=>({remuxResult:{},chunkMeta:e});function ns(e){return"then"in e&&e.then instanceof Function}class rs{constructor(e,t,i,n,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=n,this.defaultInitPts=r||null}}class ss{constructor(e,t,i,n,r,s){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=n,this.timeOffset=r,this.initSegmentChange=s}}let os=0;class as{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=os++,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=e=>{const t=e.data,i=this.hls;if(i&&null!=t&&t.event&&t.instanceNo===this.instanceNo)switch(t.event){case"init":{var n;const e=null==(n=this.workerContext)?void 0:n.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":i.logger[t.data.logType]&&i.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.part=this.part,t.data.id=this.id,i.trigger(t.event,t.data)}},this.onWorkerError=e=>{if(!this.hls)return;const t=new Error(`${e.message} (${e.filename}:${e.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(l.ERROR,{type:o.OTHER_ERROR,details:a.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:t})};const r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const s=(e,t)=>{(t=t||{}).frag=this.frag||void 0,e===l.ERROR&&(t.parent=this.id,t.part=this.part,this.error=t.error),this.hls.trigger(e,t)};this.observer=new Bn,this.observer.on(l.FRAG_DECRYPTED,s),this.observer.on(l.ERROR,s);const c=Be(r.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){const i=this.hls.logger;if(r.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{r.workerPath?(i.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=function(e){const t=Un[e];if(t)return t.clientCount++,t;const i=new self.URL(e,self.location.href).href,n={worker:new self.Worker(i),scriptURL:i,clientCount:1};return Un[e]=n,n}(r.workerPath)):(i.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=Un[Nn];if(e)return e.clientCount++,e;const t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),i=self.URL.createObjectURL(t),n={worker:new self.Worker(i),objectURL:i,clientCount:1};return Un[Nn]=n,n}());const{worker:e}=this.workerContext;e.addEventListener("message",this.onWorkerMessage),e.addEventListener("error",this.onWorkerError),e.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:c,id:t,config:it(r)})}catch(n){i.warn(`Error setting up "${t}" Web Worker, fallback to inline`,n),this.terminateWorker(),this.error=null,this.transmuxer=new ts(this.observer,c,r,"",t,e.logger)}return}}this.transmuxer=new ts(this.observer,c,r,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=os++;const t=this.hls.config,i=Be(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:it(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),function(e){const t=Un[e||Nn];if(t&&1==t.clientCount--){const{worker:i,objectURL:n}=t;delete Un[e||Nn],n&&self.URL.revokeObjectURL(n),i.terminate()}}(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,n,r,s,o,a,l,c){var u,h;l.transmuxing.start=self.performance.now();const{instanceNo:d,transmuxer:p}=this,_=s?s.start:r.start,g=r.decryptdata,m=this.frag,v=!(m&&r.cc===m.cc),y=!(m&&l.level===m.level),b=m?l.sn-m.sn:-1,S=this.part?l.part-this.part.index:-1,E=0===b&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),w=!y&&(1===b||0===b&&(1===S||E&&S<=0)),C=self.performance.now();(y||b||0===r.stats.parsing.start)&&(r.stats.parsing.start=C),!s||!S&&w||(s.stats.parsing.start=C);const k=!(m&&(null==(u=r.initSegment)?void 0:u.url)===(null==(h=m.initSegment)?void 0:h.url)),T=new ss(v,w,a,y,_,k);if(!w||v||k){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${l.sn}${l.part>-1?" part: "+l.part:""} ${this.id===f?"level":"track"}: ${l.level} id: ${l.id}\n discontinuity: ${v}\n trackSwitch: ${y}\n contiguous: ${w}\n accurateTimeOffset: ${a}\n timeOffset: ${_}\n initSegmentChange: ${k}`);const e=new rs(i,n,t,o,c);this.configureTransmuxer(e)}if(this.frag=r,this.part=s,this.workerContext)this.workerContext.worker.postMessage({instanceNo:d,cmd:"demux",data:e,decryptdata:g,chunkMeta:l,state:T},e instanceof ArrayBuffer?[e]:[]);else if(p){const t=p.push(e,g,l,T);ns(t)?t.then((e=>{this.handleTransmuxComplete(e)})).catch((e=>{this.transmuxerError(e,l,"transmuxer-interface push error")})):this.handleTransmuxComplete(t)}}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 t=i.flush(e);ns(t)?t.then((t=>{this.handleFlushResult(t,e)})).catch((t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")})):this.handleFlushResult(t,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.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((e=>{this.handleTransmuxComplete(e)})),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)}}class ls extends E{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(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const n=null==t?void 0:t.renditionReports;if(n){let r=-1;for(let i=0;i<n.length;i++){const s=n[i];let o;try{o=new self.URL(s.URI,t.url).href}catch(e){this.warn(`Could not construct new URL for Rendition Report: ${e}`),o=s.URI||""}if(o===e){r=i;break}o===e.substring(0,o.length)&&(r=i)}if(-1!==r){const e=n[r],s=parseInt(e["LAST-MSN"])||t.lastPartSn;let o=parseInt(e["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const e=Math.min(t.age-t.partTarget,t.targetduration);o>=0&&e>t.partTarget&&(o+=1)}const a=i&&Xe(i);return new Qe(s,o>=0?o:void 0,a)}}}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(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}return e}playlistLoaded(e,t,i){const{details:n,stats:r}=t,s=self.performance.now(),c=r.loading.first?Math.max(0,s-r.loading.first):0;n.advancedDateTime=Date.now()-c;const u=this.hls.config.timelineOffset;if(u!==n.appliedTimelineOffset){const e=Math.max(u||0,0);n.appliedTimelineOffset=e,n.fragments.forEach((t=>{t.setStart(t.playlistOffset+e)}))}if(n.live||null!=i&&i.live){const u="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){Ji(i,n,this);const e=n.playlistParsingError;if(e){this.warn(e);const i=this.hls;if(!i.config.ignorePlaylistParsingErrors){var h;const{networkDetails:s}=t;return void i.trigger(l.ERROR,{type:o.NETWORK_ERROR,details:a.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:e,reason:e.message,level:t.level||void 0,parent:null==(h=n.fragments[0])?void 0:h.type,networkDetails:s,stats:r})}n.playlistParsingError=null}}-1===n.requestScheduled&&(n.requestScheduled=r.loading.start);const d=this.hls.mainForwardBufferInfo,f=d?d.end-d.len:0,p=rn(n,1e3*(n.edge-f));if(n.requestScheduled+p<s?n.requestScheduled=s:n.requestScheduled+=p,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let _,g,m;if(n.canBlockReload&&n.endSN&&n.advanced){const e=this.hls.config.lowLatencyMode,r=n.lastPartSn,o=n.endSN,a=n.lastPartIndex,l=r===o;-1!==a?l?(g=o+1,m=e?0:a):(g=r,m=e?a+1:n.maxPartIndex):g=o+1;const c=n.age,h=c+n.ageHeader;let d=Math.min(h-n.partTarget,1.5*n.targetduration);if(d>0){if(h>3*n.targetduration)this.log(`Playlist last advanced ${c.toFixed(2)}s ago. Omitting segment and part directives.`),g=void 0,m=void 0;else if(null!=i&&i.tuneInGoal&&h-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${d} with playlist age: ${n.age}`),d=0;else{const e=Math.floor(d/n.targetduration);if(g+=e,void 0!==m){m+=Math.round(d%n.targetduration/n.partTarget)}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${c.toFixed(2)}s goal: ${d} skip sn ${e} to part ${m}`)}n.tuneInGoal=d}if(_=this.getDeliveryDirectives(n,t.deliveryDirectives,g,m),e||!l)return n.requestScheduled=s,void this.loadingPlaylist(u,_)}else(n.canBlockReload||n.canSkipUntil)&&(_=this.getDeliveryDirectives(n,t.deliveryDirectives,g,m));_&&void 0!==g&&n.canBlockReload&&(n.requestScheduled=r.loading.first+Math.max(p-2*c,p/2)),this.scheduleLoading(u,_,n)}else this.clearTimer()}scheduleLoading(e,t,i){const n=i||e.details;if(!n)return void this.loadingPlaylist(e,t);const r=self.performance.now(),s=n.requestScheduled;if(r>=s)return void this.loadingPlaylist(e,t);const o=s-r;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout((()=>this.loadingPlaylist(e,t)),o)}getDeliveryDirectives(e,t,i,n){let r=Xe(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,r=Ve),new Qe(i,n,r)}checkRetry(e){const t=e.details,i=gt(e),n=e.errorAction,{action:r,retryCount:s=0,retryConfig:o}=n||{},a=!!n&&!!o&&(r===At||!n.resolved&&r===kt);if(a){var l;if(s>=o.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=bt(o,s);this.clearTimer(),this.timer=self.setTimeout((()=>this.loadPlaylist()),e),this.warn(`Retrying playlist loading ${s+1}/${o.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,n.resolved=!0}return a}}function cs(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!us(e[i].attrs,t[i].attrs))return!1;return!0}function us(e,t,i){const n=e["STABLE-RENDITION-ID"];return n&&!i?n===t["STABLE-RENDITION-ID"]:!(i||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some((i=>e[i]!==t[i]))}function hs(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class ds{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(null===this.queues||null===this.tracks)return;const n=this.queues[t];n.push(e),1!==n.length||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(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach((e=>{var t;const i=null==(t=e[0])?void 0:t.label;"async-blocker"!==i&&"async-blocker-prepend"!==i||(e[0].execute(),e.splice(0,1))}))}unblockAudio(e){if(null===this.queues)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(null===this.queues||null===this.tracks)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(t){var i;if(n.onError(t),null===this.queues||null===this.tracks)return;const r=null==(i=this.tracks[e])?void 0:i.buffer;null!=r&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){null!==this.queues&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return(null==(t=this.queues)?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return null===e||null===t?"<destroyed>":`\n${this.list("video")}\n${this.list("audio")}\n${this.list("audiovideo")}}`}list(e){var t,i;return null!=(t=this.queues)&&t[e]||null!=(i=this.tracks)&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=null==(t=this.tracks)?void 0:t[e],n=null==i?void 0:i.buffer;return n?`SourceBuffer${n.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return(null==(t=this.queues)?void 0:t[e].map((e=>e.label)).join(", "))||""}}const fs=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,ps="HlsJsTrackRemovedError";class _s extends Error{constructor(e){super(e),this.name=ps}}function gs(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach((t=>{e.removeChild(t)}))}function ms(e){return"audio"===e?1:0}class vs{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(l.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(l.BUFFER_CODECS,this.onBufferCodecs,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(l.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(l.BUFFER_CODECS,this.onBufferCodecs,this),e.off(l.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&&n(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)return void(this.clientRect=null);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(((t,i)=>this.isLevelAllowed(t)&&i<=e));return this.clientRect=null,vs.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(e){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some((t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height))}static getMaxLevelByMediaSize(e,t,i){if(null==e||!e.length)return-1;let n=e.length-1;const r=Math.max(t,i);for(let t=0;t<e.length;t+=1){const i=e[t];if((i.width>=r||i.height>=r)&&(s=i,!(o=e[t+1])||s.width!==o.width||s.height!==o.height)){n=t;break}}var s,o;return n}}const ys={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},bs={HLS:"h"};class Ss{constructor(e,t){Array.isArray(e)&&(e=e.map((e=>e instanceof Ss?e:new Ss(e)))),this.value=e,this.params=t}}function Es(e,t,i,n){return new Error(`failed to ${e} "${r=t,Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":"object"==typeof r?JSON.stringify(r):String(r)}" as ${i}`,{cause:n});var r}function ws(e,t,i){return Es("serialize",e,t,i)}class Cs{constructor(e){this.description=e}}const ks="Bare Item";function Ts(e){if(!1===ArrayBuffer.isView(e))throw ws(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function As(e){if(function(e){return e<-999999999999999||999999999999999<e}(e))throw ws(e,"Integer");return e.toString()}function xs(e,t){if(e<0)return-xs(-e,t);const i=Math.pow(10,t);if(Math.abs(e*i%1-.5)<Number.EPSILON){const t=Math.floor(e*i);return(t%2==0?t:t+1)/i}return Math.round(e*i)/i}function Ds(e){const t=xs(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw ws(e,"Decimal");const i=t.toString();return i.includes(".")?i:`${i}.0`}const Ls=/[\x00-\x1f\x7f]+/;function Rs(e){const t=(i=e).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw ws(t,"Token");return t}function Is(e){switch(typeof e){case"number":if(!n(e))throw ws(e,ks);return Number.isInteger(e)?As(e):Ds(e);case"string":return function(e){if(Ls.test(e))throw ws(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return Rs(e);case"boolean":return function(e){if("boolean"!=typeof e)throw ws(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${As(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return Ts(e);if(e instanceof Cs)return Rs(e);default:throw ws(e,ks)}}function Ps(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw ws(e,"Key");return e}function Os(e){return null==e?"":Object.entries(e).map((([e,t])=>!0===t?`;${Ps(e)}`:`;${Ps(e)}=${Is(t)}`)).join("")}function Ms(e){return e instanceof Ss?`${Is(e.value)}${Os(e.params)}`:Is(e)}function Fs(e,t={whitespace:!0}){if("object"!=typeof e||null==e)throw ws(e,"Dict");const i=e instanceof Map?e.entries():Object.entries(e),n=(null==t?void 0:t.whitespace)?" ":"";return Array.from(i).map((([e,t])=>{t instanceof Ss==!1&&(t=new Ss(t));let i=Ps(e);var n;return!0===t.value?i+=Os(t.params):(i+="=",Array.isArray(t.value)?i+=`(${(n=t).value.map(Ms).join(" ")})${Os(n.params)}`:i+=Ms(t)),i})).join(`,${n}`)}function Bs(e,t){return Fs(e,t)}const Ns="CMCD-Object",Us="CMCD-Request",Hs="CMCD-Session",js="CMCD-Status",$s={br:Ns,ab:Ns,d:Ns,ot:Ns,tb:Ns,tpb:Ns,lb:Ns,tab:Ns,lab:Ns,url:Ns,pb:Us,bl:Us,tbl:Us,dl:Us,ltc:Us,mtp:Us,nor:Us,nrr:Us,rc:Us,sn:Us,sta:Us,su:Us,ttfb:Us,ttfbb:Us,ttlb:Us,cmsdd:Us,cmsds:Us,smrt:Us,df:Us,cs:Us,ts:Us,cid:Hs,pr:Hs,sf:Hs,sid:Hs,st:Hs,v:Hs,msd:Hs,bs:js,bsd:js,cdn:js,rtp:js,bg:js,pt:js,ec:js,e:js},Gs=Us;function zs(e,t){const i={};if(!e)return i;const n=Object.keys(e),r=t?(s=t,Object.keys(s).reduce(((e,t)=>{var i;return null===(i=s[t])||void 0===i||i.forEach((i=>e[i]=t)),e}),{})):{};var s;return n.reduce(((t,i)=>{var n;const s=$s[i]||r[i]||Gs;return(null!==(n=t[s])&&void 0!==n?n:t[s]={})[i]=e[i],t}),i)}const Ks="event";const Ws=e=>Math.round(e),qs=(e,t)=>Array.isArray(e)?e.map((e=>qs(e,t))):e instanceof Ss&&"string"==typeof e.value?new Ss(qs(e.value,t),e.params):(t.baseUrl&&(e=function(e,t){const i=new URL(e),n=new URL(t);if(i.origin!==n.origin)return e;const r=i.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;r[0]===s[0];)r.shift(),s.shift();for(;s.length;)s.shift(),r.unshift("..");return r.join("/")+i.search+i.hash}(e,t.baseUrl)),1===t.version?encodeURIComponent(e):e),Vs=e=>100*Ws(e/100),Ys={br:Ws,d:Ws,bl:Vs,dl:Vs,mtp:Vs,nor:(e,t)=>{let i=e;return t.version>=2&&(e instanceof Ss&&"string"==typeof e.value?i=new Ss([e]):"string"==typeof e&&(i=[e])),qs(i,t)},rtp:Vs,tb:Ws},Zs="request",Xs="response",Qs=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Js=["e"],eo=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function to(e){return eo.test(e)}const io=["d","dl","nor","ot","rtp","su"];const no=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];const ro=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function so(e){return ro.includes(e)||to(e)}const oo={[Xs]:function(e){return Qs.includes(e)||io.includes(e)||no.includes(e)||to(e)},[Ks]:function(e){return Qs.includes(e)||Js.includes(e)||to(e)},[Zs]:function(e){return Qs.includes(e)||io.includes(e)||to(e)}};function ao(e,t={}){const i={};if(null==e||"object"!=typeof e)return i;const r=t.version||e.v||1,s=t.reportingMode||Zs,o=1===r?so:oo[s];let a=Object.keys(e).filter(o);const l=t.filter;"function"==typeof l&&(a=a.filter(l));const c=s===Xs||s===Ks;c&&!a.includes("ts")&&a.push("ts"),r>1&&!a.includes("v")&&a.push("v");const u=y({},Ys,t.formatters),h={version:r,reportingMode:s,baseUrl:t.baseUrl};return a.sort().forEach((t=>{let s=e[t];const o=u[t];if("function"==typeof o&&(s=o(s,h)),"v"===t){if(1===r)return;s=r}"pr"==t&&1===s||(c&&"ts"===t&&!n(s)&&(s=Date.now()),function(e){return"number"==typeof e?n(e):null!=e&&""!==e&&!1!==e}(s)&&(function(e){return["ot","sf","st","e","sta"].includes(e)}(t)&&"string"==typeof s&&(s=new Cs(s)),i[t]=s))})),i}function lo(e,t,i){return y(e,function(e,t={}){const i={};if(!e)return i;const n=zs(ao(e,t),null==t?void 0:t.customHeaderMap);return Object.entries(n).reduce(((e,[t,i])=>{const n=Bs(i,{whitespace:!1});return n&&(e[t]=n),e}),i)}(t,i))}function co(e,t={}){if(!e)return"";const i=function(e,t={}){return e?Bs(ao(e,t),{whitespace:!1}):""}(e,t);return encodeURIComponent(i)}const uo=/CMCD=[^&#]+/;function ho(e,t,i){const n=function(e,t={}){return e?`CMCD=${co(e,t)}`:""}(t,i);if(!n)return e;if(uo.test(e))return e.replace(uo,n);const r=e.includes("?")?"&":"?";return`${e}${r}${n}`}function fo(e,t,i,n){e&&Object.keys(t).forEach((r=>{const s=e.filter((e=>e.groupId===r)).map((e=>{const s=y({},e);return s.details=void 0,s.attrs=new ci(s.attrs),s.url=s.attrs.URI=po(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),s.groupId=s.attrs["GROUP-ID"]=t[r],s.attrs["PATHWAY-ID"]=n,s}));e.push(...s)}))}function po(e,t,i,n){const{HOST:r,PARAMS:s,[i]:o}=n;let a;t&&(a=null==o?void 0:o[t],a&&(e=a));const l=new self.URL(e);return r&&!a&&(l.host=r),s&&Object.keys(s).sort().forEach((e=>{e&&l.searchParams.set(e,s[e])})),l.href}class _o extends E{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=_o.CDMCleanupPromise?[_o.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=e=>{const{initDataType:t,initData:i}=e,n=`"${e.type}" event: init data type: "${t}"`;if(this.debug(n),null!==i){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=Di(this.config));const t=e.map(xi).filter((e=>!!e));this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then((r=>{const s=Ai(r);if("sinf"!==t||s!==Ei.FAIRPLAY)return void this.log(`Ignoring "${e.type}" event with init data type: "${t}" for selected key-system ${s}`);let o;try{const e=te(new Uint8Array(i)),t=pe(mi(JSON.parse(e).sinf));if(!t)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");o=new Uint8Array(t.subarray(8,24))}catch(e){return void this.warn(`${n} Failed to parse sinf: ${e}`)}const a=I(o),{keyIdToKeySessionPromise:l,mediaKeySessions:c}=this;let u=l[a];for(let e=0;e<c.length;e++){const n=c[e],r=n.decryptdata;if(!r.keyId)continue;const s=I(r.keyId);if(fi(o,r.keyId)||-1!==r.uri.replace(/-/g,"").indexOf(a)){if(u=l[s],!u)continue;if(r.pssh)break;delete l[s],r.pssh=new Uint8Array(i),r.keyId=o,u=l[a]=u.then((()=>this.generateRequestWithPreferredKeySession(n,t,i,"encrypted-event-key-match"))),u.catch((e=>this.handleError(e)));break}}u||this.handleError(new Error(`Key ID ${a} not encountered in playlist. Key-system sessions ${c.length}.`))})).catch((e=>this.handleError(e)))}},this.onWaitingForKey=e=>{this.log(`"${e.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(l.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(l.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(l.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(l.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(l.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(l.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=null==t?void 0:t[e];return n?n.licenseUrl:e===Ei.WIDEVINE&&i?i:void 0}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(void 0===t)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=null==t?void 0:t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,n=t.map((e=>e.audioCodec)).filter(i),r=t.map((e=>e.videoCodec)).filter(i);return n.length+r.length===0&&r.push("avc1.42e01e"),new Promise(((t,i)=>{const s=e=>{const l=e.shift();this.getMediaKeysPromise(l,n,r).then((e=>t({keySystem:l,mediaKeys:e}))).catch((t=>{e.length?s(e):i(t instanceof vo?t:new vo({type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};s(e)}))}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===Li&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){var n;const r=function(e,t,i,n){let r;switch(e){case Ei.FAIRPLAY:r=["cenc","sinf"];break;case Ei.WIDEVINE:case Ei.PLAYREADY:r=["cenc"];break;case Ei.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,i,n){return[{initDataTypes:e,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:t.map((e=>({contentType:`audio/mp4; codecs=${e}`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null}))),videoCapabilities:i.map((e=>({contentType:`video/mp4; codecs=${e}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null})))}]}(r,t,i,n)}(e,t,i,this.config.drmSystemOptions||{});let s=this.keySystemAccessPromises[e],o=null==(n=s)?void 0:n.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${it(r)}`),o=this.requestMediaKeySystemAccess(e,r);const t=s=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch((t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)})),o.then((i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);const n=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const r=t.mediaKeys=i.createMediaKeys().then((i=>(this.log(`Media-keys created for "${e}"`),t.hasMediaKeys=!0,n.then((t=>t?this.setMediaKeysServerCertificate(i,e,t):i)))));return r.catch((t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)})),r}))}return o.then((()=>s.mediaKeys))}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${I(e.keyId||[])} keyUri: ${e.uri}`);const n=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=go(t),r="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,r,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${I(e.decryptdata.keyId||[])}\n } (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map((e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys}))).filter((({hasMediaKeys:e})=>!!e)).map((({keySystem:e})=>xi(e))).filter((e=>!!e))}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then((({keySystem:e,mediaKeys:t})=>this.attemptSetMediaKeys(e,t)))}selectKeySystem(e){return new Promise(((t,i)=>{this.getKeySystemSelectionPromise(e).then((({keySystem:e})=>{const n=xi(e);n?t(n):i(new Error(`Unable to find format for key-system "${e}"`))})).catch(i)}))}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=Di(this.config),i=e.map(Ai).filter((e=>!!e&&-1!==t.indexOf(e)));return this.selectKeySystem(i)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let i=0;i<t.length;i++){const n=mo(e,t[i]);if(n)return n}}loadKey(e){const t=e.keyInfo.decryptdata,i=go(t),n=this.bannedKeyIds[i];if(n||"internal-error"===this.getKeyStatus(t)){const i=yo(n||"internal-error",t);return this.handleError(i,e.frag),Promise.reject(i)}const r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);const s=this.keyIdToKeySessionPromise[i];if(!s){const n=this.getKeySystemForKeyPromise(t).then((({keySystem:i,mediaKeys:n})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(i,n).then((()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:i,mediaKeys:n,decryptdata:t}))))))).then((e=>{const i=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(e,"cenc",i,"playlist-key")}));return n.catch((t=>this.handleError(t,e.frag))),this.keyIdToKeySessionPromise[i]=n,n}return s.catch((i=>{if(i instanceof vo){const n=S({},i.data);"internal-error"===this.getKeyStatus(t)&&(n.decryptdata=t);const r=new vo(n,i.message);this.handleError(r,e.frag)}})),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof vo){t&&(e.data.frag=t);const i=e.data.decryptdata;this.error(`${e.message}${i?` (${I(i.keyId||[])})`:""}`),this.hls.trigger(l.ERROR,e.data)}else this.error(e.message),this.hls.trigger(l.ERROR,{type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=go(e),i=this.keyIdToKeySessionPromise[t];if(!i){const t=Ai(e.keyFormat),i=t?[t]:Di(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Di(this.config)),0===e.length)throw new vo({type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${it({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then((()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)}));return this.mediaKeys=t,this.setMediaKeysQueue.push(n),n.then((()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((e=>-1===i.indexOf(e)))}))}generateRequestWithPreferredKeySession(e,t,i,n){var r;const s=null==(r=this.config.drmSystems)||null==(r=r[e.keySystem])?void 0:r.generateRequest;if(s)try{const n=s.call(this.hls,t,i,e);if(!n)throw new Error("Invalid response from configured generateRequest filter");t=n.initDataType,i=n.initData?n.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(e){if(this.warn(e.message),this.hls&&this.hls.config.debug)throw e}if(null===i)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const l=go(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${n}" keyId: ${l} URI: ${c} (init data type: ${t} length: ${i.byteLength})`);const u=new Bn,h=e._onmessage=t=>{const i=e.mediaKeysSession;if(!i)return void u.emit("error",new Error("invalid state"));const{messageType:n,message:r}=t;this.log(`"${n}" message event for session "${i.sessionId}" message size: ${r.byteLength}`),"license-request"===n||"license-renewal"===n?this.renewLicense(e,r).catch((e=>{u.eventNames().length?u.emit("error",e):this.handleError(e)})):"license-release"===n?e.keySystem===Ei.FAIRPLAY&&this.updateKeySession(e,vi("acknowledged")).then((()=>this.removeSession(e))).catch((e=>this.handleError(e))):this.warn(`unhandled media key message type "${n}"`)},d=(e,t)=>{let i;t.keyStatus=e,e.startsWith("usable")?u.emit("resolved"):"internal-error"===e||"output-restricted"===e||"output-downscaled"===e?i=yo(e,t.decryptdata):"expired"===e?i=new Error(`key expired (keyId: ${l})`):"released"===e?i=new Error("key released"):"status-pending"===e||this.warn(`unhandled key status change "${e}" (keyId: ${l})`),i&&(u.eventNames().length?u.emit("error",i):this.handleError(i))},f=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void u.emit("error",new Error("invalid state"));const i=this.getKeyStatuses(e);if(!Object.keys(i).some((e=>"status-pending"!==i[e])))return;if("expired"===i[l])return this.log(`Expired key ${it(i)} in key-session "${e.mediaKeysSession.sessionId}"`),void this.renewKeySession(e);let n=i[l];if(n)d(n,e);else{var r;const t=0;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(r=e.keyStatusTimeouts)[l]||(r[l]=self.setTimeout((()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const i=this.getKeyStatus(e.decryptdata);if(i&&"status-pending"!==i)return this.log(`No status for keyId ${l} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${i} from other session.`),d(i,e);this.log(`key status for ${l} in key-session "${e.mediaKeysSession.sessionId}" timed out after ${t}ms`),n="internal-error",d(n,e)}),t)),this.log(`No status for keyId ${l} (${it(i)}).`)}};gn(e.mediaKeysSession,"message",h),gn(e.mediaKeysSession,"keystatuseschange",f);const p=new Promise(((e,t)=>{u.on("error",t),u.on("resolved",e)}));return e.mediaKeysSession.generateRequest(t,i).then((()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${l} URI: ${c}`)})).catch((t=>{throw new vo({type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_NO_SESSION,error:t,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${t}`)})).then((()=>p)).catch((t=>(u.removeAllListeners(),this.removeSession(e).then((()=>{throw t}))))).then((()=>(u.removeAllListeners(),e)))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach(((i,n)=>{if("string"==typeof n&&"object"==typeof i){const e=n;n=i,i=e}const r="buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n);e.keySystem===Ei.PLAYREADY&&16===r.length&&yi(r);const s=I(r);"internal-error"===i&&(this.bannedKeyIds[s]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${s} key-session "${e.mediaKeysSession.sessionId}"`),t[s]=i})),t}fetchServerCertificate(e){const t=this.config,i=new(0,t.loader)(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise(((r,s)=>{const l={responseType:"arraybuffer",url:n},c=t.certLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(e,t,i,n)=>{r(e.data)},onError:(t,i,r,c)=>{s(new vo({type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:S({url:l.url,data:void 0},t)},`"${e}" certificate request failed (${n}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,r)=>{s(new vo({type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(e,t,i)=>{s(new Error("aborted"))}};i.load(l,u,h)}))):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise(((n,r)=>{e.setServerCertificate(i).then((r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),n(e)})).catch((e=>{r(new vo({type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then((t=>this.updateKeySession(e,new Uint8Array(t)).catch((t=>{throw new vo({type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:t,fatal:!1},t.message)}))))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=(new DOMParser).parseFromString(i,"application/xml"),r=n.querySelectorAll("HttpHeader");if(r.length>0){let t;for(let i=0,n=r.length;i<n;i++){var s,o;t=r[i];const n=null==(s=t.querySelector("name"))?void 0:s.textContent,a=null==(o=t.querySelector("value"))?void 0:o.textContent;n&&a&&e.setRequestHeader(n,a)}}const a=n.querySelector("Challenge"),l=null==a?void 0:a.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return vi(atob(l))}setupLicenseXHR(e,t,i,n){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then((()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,n)})).catch((s=>{if(!i.decryptdata)throw s;return e.open("POST",t,!0),r.call(this.hls,e,t,i,n)})).then((i=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:i||n}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise(((n,r)=>{const s=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${s}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(4===l.readyState)if(200===l.status){this._requestLicenseFailureCount=0;let t=l.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,l,s,e)}catch(e){this.error(e)}n(t)}else{const c=i.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||l.status>=400&&l.status<500)r(new vo({type:o.KEY_SYSTEM_ERROR,details:a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:l,response:{url:s,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${s}). Status: ${l.status} (${l.statusText})`));else{const i=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(n,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,s,e,t).then((({xhr:t,licenseChallenge:i})=>{e.keySystem==Ei.PLAYREADY&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)})).catch(r)}))}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,gn(i,"encrypted",this.onMediaEncrypted),gn(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(mn(e,"encrypted",this.onMediaEncrypted),mn(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Pi.clearKeyUriToKeyIdMap();const n=i.length;_o.CDMCleanupPromise=Promise.all(i.map((e=>this.removeSession(e))).concat((null==t||null==(e=t.setMediaKeys(null))?void 0:e.catch((e=>{this.log(`Could not clear media keys: ${e}`),this.hls&&this.hls.trigger(l.ERROR,{type:o.OTHER_ERROR,details:a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${e}`)})})))||Promise.resolve())).catch((e=>{this.log(`Could not close sessions and clear media keys: ${e}`),this.hls&&this.hls.trigger(l.ERROR,{type:o.OTHER_ERROR,details:a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${e}`)})})).then((()=>{n&&this.log("finished closing key sessions and clearing media keys")}))}onManifestLoading(){this.keyFormatPromise=null,this.bannedKeyIds={}}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce(((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e)),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:n}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${I((null==n?void 0:n.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:s}=e;s&&Object.keys(s).forEach((e=>self.clearTimeout(s[e])));const{drmSystemOptions:c}=this.config,u=function(e){var t;return!(!e||"persistent-license"!==e.sessionType&&(null==(t=e.sessionTypes)||!t.some((e=>"persistent-license"===e))))}(c)?new Promise(((e,i)=>{self.setTimeout((()=>i(new Error("MediaKeySession.remove() timeout"))),8e3),t.remove().then(e).catch(i)})):Promise.resolve();return u.catch((e=>{this.log(`Could not remove session: ${e}`),this.hls&&this.hls.trigger(l.ERROR,{type:o.OTHER_ERROR,details:a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${e}`)})})).then((()=>t.close())).catch((e=>{this.log(`Could not close session: ${e}`),this.hls&&this.hls.trigger(l.ERROR,{type:o.OTHER_ERROR,details:a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${e}`)})}))}return Promise.resolve()}}function go(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return I(e.keyId)}function mo(e,t){return e.keyId&&t.mediaKeysSession.keyStatuses.has(e.keyId)?t.mediaKeysSession.keyStatuses.get(e.keyId):e.matches(t.decryptdata)?t.keyStatus:void 0}_o.CDMCleanupPromise=void 0;class vo extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function yo(e,t){const i="output-restricted"===e,n=i?a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:a.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new vo({type:o.KEY_SYSTEM_ERROR,details:n,fatal:!1,decryptdata:t},i?"HDCP level output restricted":`key status changed to "${e}"`)}function bo(e,t){let i;try{i=new Event("addtrack")}catch(e){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function So(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(i){x.debug(`[texttrack-utils]: ${i}`);try{const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){x.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===i&&(e.mode=i)}function Eo(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues)for(let i=e.cues.length;i--;)t&&e.cues[i].removeEventListener("enter",t),e.removeCue(e.cues[i]);"disabled"===i&&(e.mode=i)}function wo(e,t,i,n){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0){const r=function(e,t,i){const n=[],r=function(e,t){if(t<=e[0].startTime)return 0;const i=e.length-1;if(t>e[i].endTime)return-1;let n,r=0,s=i;for(;r<=s;)if(n=Math.floor((s+r)/2),t<e[n].startTime)s=n-1;else{if(!(t>e[n].startTime&&r<i))return n;r=n+1}return e[r].startTime-t<t-e[s].startTime?r:s}(e,t);if(r>-1)for(let s=r,o=e.length;s<o;s++){const r=e[s];if(r.startTime>=t&&r.endTime<=i)n.push(r);else if(r.startTime>i)return n}return n}(e.cues,t,i);for(let t=0;t<r.length;t++)n&&!n(r[t])||e.removeCue(r[t])}"disabled"===r&&(e.mode=r)}function Co(e){const t=[];for(let i=0;i<e.length;i++){const n=e[i];"subtitles"!==n.kind&&"captions"!==n.kind||!n.label||t.push(e[i])}return t}function ko(e){let t=5381,i=e.length;for(;i;)t=33*t^e.charCodeAt(--i);return(t>>>0).toString()}const To=.025;let Ao=function(e){return e[e.Point=0]="Point",e[e.Range=1]="Range",e}({});function xo(e,t,i){return`${e.identifier}-${i+1}-${ko(t)}`}class Do{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,null==(e=this.assetListLoader)||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;if(e<=0||isNaN(i))return!1;if(0===i)return!0;return((null==(t=this.assetList[e])?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Lo(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(0===this.startTime||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime;return t-Lo(t,e)<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=n(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 Lo(e,t)}return e}get appendInPlace(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!(this.cue.once||this.cue.pre||!this.startIsAligned||!(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<To))}set appendInPlace(e){this.appendInPlaceStarted?this.resetOnResume=!e:this.appendInPlaceDisabled=!e}get timelineStart(){return null!==this._timelineStart?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return t=null!==this._duration?this._duration:this.dateRange.duration?this.dateRange.duration: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"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?Ao.Range:Ao.Point}get supplementsPrimary(){return"PRIMARY"===this.dateRange.attr["X-TIMELINE-STYLE"]}get contentMayVary(){return"NO"!==this.dateRange.attr["X-CONTENT-MAY-VARY"]}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||null!==this.assetListResponse}toString(){return`["${(e=this).identifier}" ${e.cue.pre?"<pre>":e.cue.post?"<post>":""}${e.timelineStart.toFixed(2)}-${e.resumeTime.toFixed(2)}]`;var e}}function Lo(e,t){return e-t.start<t.duration/2&&!(Math.abs(e-(t.start+t.duration))<To)?t.start:t.start+t.duration}function Ro(e,t,i){const n=new self.URL(e,i);return"data:"!==n.protocol&&n.searchParams.set("_HLS_primary_id",t),n}function Io(e,t){for(;null!=(i=e.assetList[++t])&&i.error;)var i;return t}function Po(e){const t=e.timelineStart,i=e.duration||0;return`["${e.identifier}" ${t.toFixed(2)}-${(t+i).toFixed(2)}]`}class Oo{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(l.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new e(t);this.interstitial=i,this.assetItem=n;const s=()=>{this.hasDetails=!0};r.once(l.LEVEL_LOADED,s),r.once(l.AUDIO_TRACK_LOADED,s),r.once(l.SUBTITLE_TRACK_LOADED,s),r.on(l.MEDIA_ATTACHING,((e,{media:t})=>{this.removeMediaListeners(),this.mediaAttached=t;this.interstitial.playoutLimit&&(t.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on(l.BUFFER_APPENDED,(()=>{const e=this.bufferedEnd;this.reachedPlayout(e)&&(this._bufferedEosTime=e,r.trigger(l.BUFFERED_TO_END,void 0))})))}))}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=Ro(t,e.config.primarySessionId||"").href}catch(e){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if(null!=(t=this.hls)&&t.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),n=this.timelineOffset,r=ti.bufferInfo(e,n,0);return this.getAssetTime(r.end)>=i-.02}reachedPlayout(e){const t=this.interstitial.playoutLimit;return this.startOffset+e>=t}get destroyed(){var e;return!(null!=(e=this.hls)&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return(null==(e=this.hls)?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=ti.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const i=t-this.startOffset;if(i>0&&i<e)return i}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return(null==(e=this.hls)?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){var e;this.mediaAttached&&(null!=(e=this.hls)&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd))}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),null==(t=this.hls)||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,null==(e=this.hls)||e.detachMedia()}resumeBuffering(){var e;null==(e=this.hls)||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.hls)||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),(null==(e=this.hls)?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=e=>delete e.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var n;null==(n=this.hls)||n.on(e,t)}once(e,t,i){var n;null==(n=this.hls)||n.once(e,t)}off(e,t,i){var n;null==(n=this.hls)||n.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Po(this.assetItem)} ${null==(e=this.hls)?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}class Mo extends E{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach((e=>e.reset())),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce(((i,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,i+1):i),0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[i]||(void 0===t&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&null!=(r=n[i])&&r.event;){var r;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let n=0;n<i.length;n++){let r=i[n];if(t&&"primary"!==t&&(r=r[t]),e===r.start||e>r.start&&e<r.end)return n}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let n=e;n<=t&&i[n];n++){const e=i[n].event;if(null!=e&&e.restrictions.jump&&!e.appendInPlace)return n}return-1}findEventIndex(e){const t=this.items;if(t)for(let n=t.length;n--;){var i;if((null==(i=t[n].event)?void 0:i.identifier)===e)return n}return-1}findAssetIndex(e,t){const i=e.assetList,n=i.length;if(n>1)for(let e=0;e<n;e++){const r=i[e];if(!r.error){const i=r.timelineStart;if(t===i||t>i&&(t<i+(r.duration||0)||e===n-1))return e}}return 0}get assetIdAtEnd(){var e;const t=null==(e=this.items)||null==(e=e[this.length-1])?void 0:e.event;if(t){const e=t.assetList,i=e[e.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:n}=i,r=this.events,s=this.parseDateRanges(n,{url:i.url},t),o=Object.keys(n),a=r?r.filter((e=>!o.includes(e.identifier))):[];s.length&&s.sort(((e,t)=>{const i=e.cue.pre,n=e.cue.post,r=t.cue.pre,s=t.cue.post;if(i&&!r)return-1;if(r&&!i)return 1;if(n&&!s)return 1;if(s&&!n)return-1;if(!(i||r||n||s)){const i=e.startTime,n=t.startTime;if(i!==n)return i-n}return e.dateRange.tagOrder-t.dateRange.tagOrder})),this.events=s,a.forEach((e=>{this.removeEvent(e)})),this.updateSchedule(e,a)}updateSchedule(e,t=[],i=!1){const n=this.events||[];if(n.length||t.length||this.length<2){const r=this.items,s=this.parseSchedule(n,e);(i||t.length||(null==r?void 0:r.length)!==s.length||s.some(((e,t)=>Math.abs(e.playout.start-r[t].playout.start)>.005||Math.abs(e.playout.end-r[t].playout.end)>.005)))&&(this.items=s,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,i){const n=[],r=Object.keys(e);for(let s=0;s<r.length;s++){const o=r[s],a=e[o];if(a.isInterstitial){let e=this.eventMap[o];e?e.setDateRange(a):(e=new Do(a,t),this.eventMap[o]=e,!1===i&&(e.appendInPlace=i)),n.push(e)}}return n}parseSchedule(e,t){const i=[],n=t.main.details,r=n.live?1/0:n.edge;let s=0;if((e=e.filter((e=>!(e.error||e.cue.once&&e.hasPlayed)))).length){this.resolveOffsets(e,t);let n=0,a=0;if(e.forEach(((t,o)=>{const l=t.cue.pre,c=t.cue.post,u=e[o-1]||null,h=t.appendInPlace,d=c?r:t.startOffset,f=t.duration,p=t.timelineOccupancy===Ao.Range?f:0,_=t.resumptionOffset,g=(null==u?void 0:u.startTime)===d,m=d+t.cumulativeDuration;let v=h?m+f:d+_;if(l||!c&&d<=0){const e=a;a+=p,t.timelineStart=m;const n=s;s+=f,i.push({event:t,start:m,end:v,playout:{start:n,end:s},integrated:{start:e,end:a}})}else{if(!(d<=r))return;{if(!g){const r=d-n;if(r>.033){const l=n,c=a;a+=r;const u=s;s+=r;const h={previousEvent:e[o-1]||null,nextEvent:t,start:l,end:l+r,playout:{start:u,end:s},integrated:{start:c,end:a}};i.push(h)}else r>0&&u&&(u.cumulativeDuration+=r,i[i.length-1].end=d)}c&&(v=m),t.timelineStart=m;const r=a;a+=p;const l=s;s+=f,i.push({event:t,start:m,end:v,playout:{start:l,end:s},integrated:{start:r,end:a}})}}const y=t.resumeTime;n=c||y>r?r:y})),n<r){var o;const e=n,t=a,l=r-n;a+=l;const c=s;s+=l,i.push({previousEvent:(null==(o=i[i.length-1])?void 0:o.event)||null,nextEvent:null,start:n,end:e+l,playout:{start:c,end:s},integrated:{start:t,end:a}})}this.setDurations(r,s,a)}else{const e=0;i.push({previousEvent:null,nextEvent:null,start:e,end:r,playout:{start:e,end:r},integrated:{start:e,end:r}}),this.setDurations(r,r,r)}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,o=-1;e.forEach(((a,l)=>{const c=a.cue.pre,u=a.cue.post,h=c?0:u?r:a.startTime;this.updateAssetDurations(a);if(o===h?a.cumulativeDuration=s:(s=0,o=h),!u&&a.snapOptions.in&&(a.resumeAnchor=dt(null,i.fragments,a.startOffset+a.resumptionOffset,0,0)||void 0),a.appendInPlace&&!a.appendInPlaceStarted){this.primaryCanResumeInPlaceAt(a,t)||(a.appendInPlace=!1)}if(!a.appendInPlace&&l+1<e.length){e[l+1].startTime-e[l].resumeTime<.033&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${a}`))}const d=n(a.resumeOffset)?a.resumeOffset:a.duration;s+=d}))}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;if(Math.abs(i-n)>To)return this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1;return!Object.keys(t).some((n=>{const r=t[n].details,s=r.edge;if(i>=s)return this.log(`"${e.identifier}" resumption ${i} past ${n} playlist end ${s}`),!1;const o=dt(null,r.fragments,i);if(!o)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${n} playlist (${r.fragStart}-${r.fragmentEnd})`),!0;const a="audio"===n?.175:0;return!(Math.abs(o.start-i)<To+a||Math.abs(o.end-i)<To+a)&&(this.log(`"${e.identifier}" resumption ${i} not aligned with ${n} fragment bounds (${o.start}-${o.end} sn: ${o.sn} cc: ${o.cc})`),!0)}))}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,n=!1,r=!1;for(let s=0;s<e.assetList.length;s++){const o=e.assetList[s],a=t+i;o.startOffset=i,o.timelineStart=a,n||(n=null===o.duration),r||(r=!!o.error);i+=o.error?0:o.duration||0}e.duration=n&&!r?Math.max(i,e.duration):i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function Fo(e){return`[${e.event?'"'+e.event.identifier+'"':"primary"}: ${e.start.toFixed(2)}-${e.end.toFixed(2)}]`}class Bo{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=Ro(i,this.hls.sessionId,e.baseUrl)}catch(t){const n=this.assignAssetListError(e,a.ASSET_LIST_LOAD_ERROR,t,i);return void this.hls.trigger(l.ERROR,n)}t&&"data:"!==n.protocol&&n.searchParams.set("_HLS_start_offset",""+t);const r=this.hls.config,s=new(0,r.loader)(r),o={responseType:"json",url:n.href},c=r.interstitialAssetListLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(t,i,n,r)=>{const s=t.data,o=null==s?void 0:s.ASSETS;if(Array.isArray(o))e.assetListResponse=s,this.hls.trigger(l.ASSET_LIST_LOADED,{event:e,assetListResponse:s,networkDetails:r});else{const t=this.assignAssetListError(e,a.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),n.url,i,r);this.hls.trigger(l.ERROR,t)}},onError:(t,i,n,r)=>{const s=this.assignAssetListError(e,a.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${t.code} ${t.text} (${i.url})`),i.url,r,n);this.hls.trigger(l.ERROR,s)},onTimeout:(t,i,n)=>{const r=this.assignAssetListError(e,a.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${i.url})`),i.url,t,n);this.hls.trigger(l.ERROR,r)}};return s.load(o,u,h),this.hls.trigger(l.ASSET_LIST_LOADING,{event:e}),s}assignAssetListError(e,t,i,n,r,s){return e.error=i,{type:o.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:s,stats:r}}}function No(e){null==e||e.play().catch((()=>{}))}function Uo(e,t){return`[${e}] Advancing timeline position to ${t}`}class Ho{constructor(e){this.buffered=void 0;const t=(t,i,n)=>{if((i>>>=0)>n-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${n})`);return e[i][t]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const jo={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},$o=e=>String.fromCharCode(jo[e]||e),Go=15,zo=100,Ko={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Wo={17:2,18:4,21:6,22:8,23:10,19:13,20:15},qo={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Vo={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Yo=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Zo{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i="function"==typeof t?t():t;x.log(`${this.time} [${e}] ${i}`)}}}const Xo=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Qo{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!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 Jo{constructor(){this.uchar=" ",this.penState=new Qo}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 ea{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Qo,this.cueStartTime=null,this.logger=void 0;for(let e=0;e<zo;e++)this.chars.push(new Jo);this.logger=e}equals(e){for(let t=0;t<zo;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<zo;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<zo;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>zo&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=zo)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e<t+1;e++)this.chars[e].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=$o(e);this.pos>=zo?this.logger.log(0,(()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t<zo;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<zo;i++){const n=this.chars[i].uchar;" "!==n&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e);this.chars[this.pos].setPenState(this.currPenState)}}class ta{constructor(e){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Go;t++)this.rows.push(new ea(e));this.logger=e}reset(){for(let e=0;e<Go;e++)this.rows[e].clear();this.currRow=14}equals(e){let t=!0;for(let i=0;i<Go;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Go;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Go;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 = "+it(e)));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<Go;e++)this.rows[e].clear();const e=this.currRow+1-this.nrRollUpRows,i=this.lastOutputScreen;if(i){const n=i.rows[e].cueStartTime,r=this.logger.time;if(null!==n&&null!==r&&n<r)for(let n=0;n<this.nrRollUpRows;n++)this.rows[t-this.nrRollUpRows+n+1].copy(i.rows[e+n])}}this.currRow=t;const i=this.rows[this.currRow];if(null!==e.indent){const t=e.indent,n=Math.max(t-1,0);i.setCursor(e.indent),e.color=i.chars[n].penState.foreground}const n={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(e){this.logger.log(2,(()=>"bkgData = "+it(e))),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",n=-1;for(let i=0;i<Go;i++){const r=this.rows[i].getTextString();r&&(n=i+1,e?t.push("Row "+n+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class ia{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 ta(i),this.nonDisplayedMemory=new ta(i),this.lastOutputScreen=new ta(i),this.currRollUpRow=this.displayedMemory.rows[14],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[14],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)),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(()=>t+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(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"),"MODE_TEXT"!==this.mode&&(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"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+it(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?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.cueStartTime=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 na{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const n=this.logger=new Zo;this.channels=[null,new ia(e,t,n),new ia(e+1,i,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e<t.length;e+=2){const i=127&t[e],n=127&t[e+1];let r=!1,s=null;if(0===i&&0===n)continue;this.logger.log(3,(()=>"["+Xo([t[e],t[e+1]])+"] -> ("+Xo([i,n])+")"));const o=this.cmdHistory;if(i>=16&&i<=31){if(sa(i,n,o)){ra(null,null,o),this.logger.log(3,(()=>"Repeated command ("+Xo([i,n])+") is dropped"));continue}ra(i,n,this.cmdHistory),r=this.parseCmd(i,n),r||(r=this.parseMidrow(i,n)),r||(r=this.parsePAC(i,n)),r||(r=this.parseBackgroundAttributes(i,n))}else ra(null,null,o);if(!r&&(s=this.parseChars(i,n),s)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(s)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||s||this.logger.log(2,(()=>"Couldn't parse cleaned data "+Xo([i,n])+" orig: "+Xo([t[e],t[e+1]])))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;const i=20===e||21===e||23===e?1:2,n=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?n.ccRCL():33===t?n.ccBS():34===t?n.ccAOF():35===t?n.ccAON():36===t?n.ccDER():37===t?n.ccRU(2):38===t?n.ccRU(3):39===t?n.ccRU(4):40===t?n.ccFON():41===t?n.ccRDC():42===t?n.ccTR():43===t?n.ccRTD():44===t?n.ccEDM():45===t?n.ccCR():46===t?n.ccENM():47===t&&n.ccEOC():n.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if(i=17===e?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return!!n&&(n.ccMIDROW(t),this.logger.log(3,(()=>"MIDROW ("+Xo([e,t])+")")),!0)}return!1}parsePAC(e,t){let i;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;const n=e<=23?1:2;i=t>=64&&t<=95?1===n?Ko[e]:qo[e]:1===n?Wo[e]:Vo[e];const r=this.channels[n];return!!r&&(r.setPAC(this.interpretPAC(i,t)),this.currentChannel=n,!0)}interpretPAC(e,t){let i;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,n.underline=1==(1&i),i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((i-16)/2),n}parseChars(e,t){let i,n=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let e;e=17===r?t+80:18===r?t+112:t+144,this.logger.log(2,(()=>"Special char '"+$o(e)+"' in channel "+i)),n=[e]}else e>=32&&e<=127&&(n=0===t?[e]:[e,t]);return n&&this.logger.log(3,(()=>"Char codes = "+Xo(n).join(","))),n}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let i;const n={};16===e||24===e?(i=Math.floor((t-32)/2),n.background=Yo[i],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0));const r=e<=23?1:2;return this.channels[r].setBkgData(n),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}ra(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 ra(e,t,i){i.a=e,i.b=t}function sa(e,t,i){return i.a===e&&i.b===t}var oa=function(){if(null!=Si&&Si.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const i=t.toLowerCase();return!!~e.indexOf(i)&&i}function n(e){return i(t,e)}function r(e,...t){let i=1;for(;i<arguments.length;i++){const t=arguments[i];for(const i in t)e[i]=t[i]}return e}function s(t,s,o){const a=this,l={enumerable:!0};a.hasBeenReset=!1;let c="",u=!1,h=t,d=s,f=o,p=null,_="",g=!0,m="auto",v="start",y=50,b="middle",S=50,E="middle";Object.defineProperty(a,"id",r({},l,{get:function(){return c},set:function(e){c=""+e}})),Object.defineProperty(a,"pauseOnExit",r({},l,{get:function(){return u},set:function(e){u=!!e}})),Object.defineProperty(a,"startTime",r({},l,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(a,"endTime",r({},l,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(a,"text",r({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(a,"region",r({},l,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),Object.defineProperty(a,"vertical",r({},l,{get:function(){return _},set:function(t){const n=function(t){return i(e,t)}(t);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");_=n,this.hasBeenReset=!0}})),Object.defineProperty(a,"snapToLines",r({},l,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),Object.defineProperty(a,"line",r({},l,{get:function(){return m},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");m=e,this.hasBeenReset=!0}})),Object.defineProperty(a,"lineAlign",r({},l,{get:function(){return v},set:function(e){const t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(a,"position",r({},l,{get:function(){return y},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(a,"positionAlign",r({},l,{get:function(){return b},set:function(e){const t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(a,"size",r({},l,{get:function(){return S},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");S=e,this.hasBeenReset=!0}})),Object.defineProperty(a,"align",r({},l,{get:function(){return E},set:function(e){const t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");E=t,this.hasBeenReset=!0}})),a.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class aa{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function la(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(n||0)}const i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class ca{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function ua(e,t,i,n){const r=n?e.split(n):[e];for(const e in r){if("string"!=typeof r[e])continue;const n=r[e].split(i);if(2!==n.length)continue;t(n[0],n[1])}}const ha=new oa(0,0,""),da="middle"===ha.align?"middle":"center";function fa(e,t,i){const n=e;function r(){const t=la(e);if(null===t)throw new Error("Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function s(){e=e.replace(/^\s+/,"")}if(s(),t.startTime=r(),s(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.slice(3),s(),t.endTime=r(),s(),function(e,t){const n=new ca;ua(e,(function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),n.integer(e,r[0]),n.percent(e,r[0])&&n.set("snapToLines",!1),n.alt(e,r[0],["auto"]),2===r.length&&n.alt("lineAlign",r[1],["start",da,"end"]);break;case"position":r=t.split(","),n.percent(e,r[0]),2===r.length&&n.alt("positionAlign",r[1],["start",da,"end","line-left","line-right","auto"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start",da,"end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");let r=n.get("line","auto");"auto"===r&&-1===ha.line&&(r=-1),t.line=r,t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align",da);let s=n.get("position","auto");"auto"===s&&50===ha.position&&(s="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=s}(e,t)}function pa(e){return e.replace(/<br(?: \/)?>/gi,"\n")}class _a{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new aa,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function i(){let e=t.buffer,i=0;for(e=pa(e);i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;const n=e.slice(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.slice(i),n}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{let e="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;e=i();const n=e.match(/^()?WEBVTT([ \t].*)?$/);if(null==n||!n[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let n=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(n?n=!1:e=i(),t.state){case"HEADER":/:/.test(e)?ua(e,(function(e,t){}),/:/):e||(t.state="ID");continue;case"NOTE":e||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(e)){t.state="NOTE";break}if(!e)continue;if(t.cue=new oa(0,0,""),t.state="CUE",-1===e.indexOf("--\x3e")){t.cue.id=e;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{fa(e,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const i=-1!==e.indexOf("--\x3e");if(!e||i&&(n=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=e}continue;case"BADCUE":e||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state||"BADWEBVTT"===e.state)throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const ga=/\r\n|\n\r|\n|\r/g,ma=function(e,t,i=0){return e.slice(i,i+t.length)===t};function va(e,t,i){return ko(e.toString())+ko(t.toString())+ko(i)}function ya(e,t,i,r,s,o,a){const l=new _a,c=R(new Uint8Array(e)).trim().replace(ga,"\n").split("\n"),u=[],h=t?function(e,t=1){return $r(e,9e4,1/t)}(t.baseTime,t.timescale):0;let d,f="00:00.000",p=0,_=0,g=!0;l.oncue=function(e){const n=i[r];let o=i.ccOffset;const a=(p-h)/9e4;if(null!=n&&n.new&&(void 0!==_?o=i.ccOffset=n.start:function(e,t,i){let n=e[t],r=e[n.prevCC];if(!r||!r.new&&n.new)return e.ccOffset=e.presentationOffset=n.start,void(n.new=!1);for(;null!=(s=r)&&s.new;){var s;e.ccOffset+=n.start-r.start,n.new=!1,n=r,r=e[n.prevCC]}e.presentationOffset=i}(i,r,a)),a){if(!t)return void(d=new Error("Missing initPTS for VTT MPEGTS"));o=a-i.presentationOffset}const l=e.endTime-e.startTime,c=Yr(9e4*(e.startTime+o-_),9e4*s)/9e4;e.startTime=Math.max(c,0),e.endTime=Math.max(c+l,0);const f=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(f)),e.id||(e.id=va(e.startTime,e.endTime,f)),e.endTime>0&&u.push(e)},l.onparsingerror=function(e){d=e},l.onflush=function(){d?a(d):o(u)},c.forEach((e=>{if(g){if(ma(e,"X-TIMESTAMP-MAP=")){g=!1,e.slice(16).split(",").forEach((e=>{ma(e,"LOCAL:")?f=e.slice(6):ma(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))}));try{_=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(!(n(t)&&n(i)&&n(r)&&n(s)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*r,t+=36e5*s,t}(f)/1e3}catch(e){d=e}return}""===e&&(g=!1)}l.parse(e+"\n")})),l.flush()}const ba="stpp.ttml.im1t",Sa=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ea=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,wa={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ca(e,t,i,n){const r=oe(new Uint8Array(e),["mdat"]);if(0===r.length)return void n(new Error("Could not parse IMSC1 mdat"));const s=r.map((e=>R(e))),o=function(e,t,i=1,n=!1){return $r(e,t,1/i,n)}(t.baseTime,1,t.timescale);try{s.forEach((e=>i(function(e,t){const i=(new DOMParser).parseFromString(e,"text/xml"),n=i.getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=Object.keys(r).reduce(((e,t)=>(e[t]=n.getAttribute(`ttp:${t}`)||r[t],e)),{}),o="preserve"!==n.getAttribute("xml:space"),a=Ta(ka(n,"styling","style")),l=Ta(ka(n,"layout","region")),c=ka(n,"body","[begin]");return[].map.call(c,(e=>{const i=Aa(e,o);if(!i||!e.hasAttribute("begin"))return null;const n=La(e.getAttribute("begin"),s),r=La(e.getAttribute("dur"),s);let c=La(e.getAttribute("end"),s);if(null===n)throw Da(e);if(null===c){if(null===r)throw Da(e);c=n+r}const u=new oa(n-t,c-t,i);u.id=va(u.startTime,u.endTime,u.text);const h=function(e,t,i){const n="http://www.w3.org/ns/ttml#styling";let r=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;o&&i.hasOwnProperty(o)&&(r=i[o]);return s.reduce(((i,s)=>{const o=xa(t,n,s)||xa(e,n,s)||xa(r,n,s);return o&&(i[s]=o),i}),{})}(l[e.getAttribute("region")],a[e.getAttribute("style")],a),{textAlign:d}=h;if(d){const e=wa[d];e&&(u.lineAlign=e),u.align=d}return y(u,h),u})).filter((e=>null!==e))}(e,o))))}catch(e){n(e)}}function ka(e,t,i){const n=e.getElementsByTagName(t)[0];return n?[].slice.call(n.querySelectorAll(i)):[]}function Ta(e){return e.reduce(((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e}),{})}function Aa(e,t){return[].slice.call(e.childNodes).reduce(((e,i,n)=>{var r;return"br"===i.nodeName&&n?e+"\n":null!=(r=i.childNodes)&&r.length?Aa(i,t):t?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent}),"")}function xa(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function Da(e){return new Error(`Could not parse ttml timestamp ${e}`)}function La(e,t){if(!e)return null;let i=la(e);return null===i&&(Sa.test(e)?i=function(e,t){const i=Sa.exec(e),n=(0|i[4])+(0|i[5])/t.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+n/t.frameRate}(e,t):Ea.test(e)&&(i=function(e,t){const i=Ea.exec(e),n=Number(i[1]);switch(i[2]){case"h":return 3600*n;case"m":return 60*n;case"ms":return 1e3*n;case"f":return n/t.frameRate;case"t":return n/t.tickRate}return n}(e,t))),i}class Ra{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(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}function Ia(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function Pa(e,t){return!!e&&e.kind===Ia(t)&&hs(t,e)}const Oa=/\s/,Ma={newCue(e,t,i,n){const r=[];let s,o,a,l,c;const u=self.VTTCue||self.TextTrackCue;for(let d=0;d<n.rows.length;d++)if(s=n.rows[d],a=!0,l=0,c="",!s.isEmpty()){var h;for(let e=0;e<s.chars.length;e++)Oa.test(s.chars[e].uchar)&&a?l++:(c+=s.chars[e].uchar,a=!1);s.cueStartTime=t,t===i&&(i+=1e-4),l>=16?l--:l++;const n=pa(c.trim()),f=va(t,i,n);null!=e&&null!=(h=e.cues)&&h.getCueById(f)||(o=new u(t,i,n),o.id=f,o.line=d+1,o.align="left",o.position=10+Math.min(80,10*Math.floor(8*l/32)),r.push(o))}return e&&r.length&&(r.sort(((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line)),r.forEach((t=>So(e,t)))),r}};const Fa=/(\d+)-(\d+)\/(\d+)/;class Ba{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||Na,this.controller=new self.AbortController,this.stats=new G}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(),null!=(e=this.callbacks)&&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=function(e,t){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(y({},e.headers))};e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return i}(e,this.controller.signal),o="arraybuffer"===e.responseType,a=o?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=l&&n(l)?l:c,this.requestTimeout=self.setTimeout((()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))}),t.timeout);(ns(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then((i=>{var s;this.response=this.loader=i;const a=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout((()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))}),c-(a-r.loading.start)),!i.ok){const{status:e,statusText:t}=i;throw new Ua(t||"fetch, bad network response",e,i)}r.loading.first=a,r.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=Fa.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(n(e))return e}const i=e.get("Content-Length");if(i)return parseInt(i)}(i.headers)||r.total;const l=null==(s=this.callbacks)?void 0:s.onProgress;return l&&n(t.highWaterMark)?this.loadProgressively(i,r,e,t.highWaterMark,l):o?i.arrayBuffer():"json"===e.responseType?i.json():i.text()})).then((i=>{var s,o;const l=this.response;if(!l)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const c=i[a];c&&(r.loaded=r.total=c);const u={url:l.url,data:i,code:l.status},h=null==(s=this.callbacks)?void 0:s.onProgress;h&&!n(t.highWaterMark)&&h(r,e,i,l),null==(o=this.callbacks)||o.onSuccess(u,r,e,l)})).catch((t=>{var i;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const n=t&&t.code||0,s=t?t.message:null;null==(i=this.callbacks)||i.onError({code:n,text:s},e,t?t.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,n=0,r){const s=new Pn,o=e.body.getReader(),a=()=>o.read().then((o=>{if(o.done)return s.dataLength&&r(t,i,s.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const l=o.value,c=l.length;return t.loaded+=c,c<n||s.dataLength?(s.push(l),s.dataLength>=n&&r(t,i,s.flush().buffer,e)):r(t,i,l.buffer,e),a()})).catch((()=>Promise.reject()));return a()}}function Na(e,t){return new self.Request(e.url,t)}class Ua extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const Ha=/^age:\s*[\d.]+\s*$/im;class ja{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 G,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,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then((()=>{if(this.loader===i&&!this.stats.aborted)return r(i,t.url)})).catch((e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),r(i,t.url)})).then((()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)})).catch((e=>{var r;null==(r=this.callbacks)||r.onError({code:i.status,text:e.message},t,i,n)})):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:o}=i.loadPolicy;if(r)for(const t in r)e.setRequestHeader(t,r[t]);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&&n(s)?s:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const n=t.readyState,r=this.config;if(!i.aborted&&n>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===n)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const n=t.status,l="text"===t.responseType?t.responseText:null;if(n>=200&&n<300){const r=null!=l?l:t.response;if(null!=r){var s,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const a="arraybuffer"===t.responseType?r.byteLength:r.length;i.loaded=i.total=a,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first);const l=null==(s=this.callbacks)?void 0:s.onProgress;l&&l(i,e,r,t);const c={url:t.responseURL,data:r,code:n};return void(null==(o=this.callbacks)||o.onSuccess(c,i,e,t))}}const c=r.loadPolicy.errorRetry;var a;if(Et(c,i.retry,!1,{url:e.url,data:void 0,code:n}))this.retry(c);else x.error(`${n} while loading ${e.url}`),null==(a=this.callbacks)||a.onError({code:n,text:t.statusText},e,t,i)}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry;if(Et(e,this.stats.retry,!0))this.retry(e);else{var t;x.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=bt(e,i.retry),i.retry++,x.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?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&&Ha.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 $a=S(S({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:6e7,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:ja,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class extends E{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{var t;const{fragCurrent:i,partCurrent:r,hls:s}=this,{autoLevelEnabled:o,media:a}=s;if(!i||!a)return;const c=performance.now(),u=r?r.stats:i.stats,h=r?r.duration:i.duration,d=c-u.loading.start,f=s.minAutoLevel,p=i.level,_=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||p<=f)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!o)return;const g=_>-1&&_!==p,m=!!e||g;if(!m&&(a.paused||!a.playbackRate||!a.readyState))return;const v=s.mainForwardBufferInfo;if(!m&&null===v)return;const y=this.bwEstimator.getEstimateTTFB(),b=Math.abs(a.playbackRate);if(d<=Math.max(y,h/(2*b)*1e3))return;const S=v?v.len/b:0,E=u.loading.first?u.loading.first-u.loading.start:-1,w=u.loaded&&E>-1,C=this.getBwEstimate(),k=s.levels,T=k[p],A=Math.max(u.loaded,Math.round(h*(i.bitrate||T.averageBitrate)/8));let x=w?d-E:d;x<1&&w&&(x=Math.min(d,8*u.loaded/C));const D=w?1e3*u.loaded/x:0,L=y/1e3,R=D?(A-u.loaded)/D:8*A/C+L;if(R<=S)return;const I=D?8*D:C,P=!0===(null==(t=(null==e?void 0:e.details)||this.hls.latestLevelDetails)?void 0:t.live),O=this.hls.config.abrBandWidthUpFactor;let M,F=Number.POSITIVE_INFINITY;for(M=p-1;M>f;M--){const e=k[M].maxBitrate,t=!k[M].details||P;if(F=this.getTimeToLoadFrag(L,I,h*e,t),F<Math.min(S,h+L))break}if(F>=R)return;if(F>10*h)return;w?this.bwEstimator.sample(d-Math.min(y,E),u.loaded):this.bwEstimator.sampleTTFB(d);const B=k[M].maxBitrate;this.getBwEstimate()*O>B&&this.resetEstimator(B);const N=this.findBestLevel(B,f,M,0,S,1,1);N>-1&&(M=N),this.warn(`Fragment ${i.sn}${r?" part "+r.index:""} of level ${p} is loading too slowly;\n Fragment duration: ${i.duration.toFixed(3)}\n Time to underbuffer: ${S.toFixed(3)} s\n Estimated load time for current fragment: ${R.toFixed(3)} s\n Estimated load time for down switch fragment: ${F.toFixed(3)} s\n TTFB estimate: ${0|E} ms\n Current BW estimate: ${n(C)?0|C:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${M} @ ${0|B} bps`),s.nextLoadLevel=s.nextAutoLevel=M,this.clearTimer();const U=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===M&&M>0){const e=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${M>0?"and switching down":""}\n Fragment duration: ${i.duration.toFixed(3)} s\n Time to underbuffer: ${e.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,M>f){let t=this.findBestLevel(this.hls.levels[f].bitrate,f,M,0,e,1,1);-1===t&&(t=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=t,this.resetEstimator(this.hls.levels[t].bitrate)}}};g||R>2*F?U():this.timer=self.setInterval(U,1e3*F),s.trigger(l.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:r,stats:u})},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 m(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.FRAG_LOADING,this.onFragLoading,this),e.on(l.FRAG_LOADED,this.onFragLoaded,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this),e.on(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(l.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.FRAG_LOADING,this.onFragLoading,this),e.off(l.FRAG_LOADED,this.onFragLoaded,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this),e.off(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(l.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(l.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){var n;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(n=t.part)?n:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case a.BUFFER_ADD_CODEC_ERROR:case a.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case a.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:i,partCurrent:n}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){const t=performance.now(),i=n?n.stats:e.stats,r=t-i.loading.start,s=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&s>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(e,s),i.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(e,t,i,n){return e+i/t+(n?e+this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,s=r.end-r.first;n(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===f&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=i?i.duration:t.duration,r=this.hls.levels[t.level],s=(r.loaded?r.loaded.bytes:0)+n.loaded,o=(r.loaded?r.loaded.duration:0)+e;r.loaded={bytes:s,duration:o},r.realBitrate=Math.round(8*s/o)}if(t.bitrateTest){const e={stats:n,frag:t,part:i,id:t.type};this.onFragBuffered(l.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,r=null!=n&&n.stats.loaded?n.stats:i.stats;if(r.aborted)return;if(this.ignoreFragment(i))return;const s=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==f||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,n,1,1);if(r>-1)return r;const s=this.hls.firstLevel,o=Math.min(Math.max(s,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const n=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,n)&&t[e].loadError<=t[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:n,config:r,minAutoLevel:s}=i,o=t?t.duration:e?e.duration:0,a=this.getBwEstimate(),l=this.getStarvationDelay();let c=r.abrBandWidthFactor,u=r.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(a,s,n,l,0,c,u);if(e>=0)return this.rebufferNotice=-1,e}let h=o?Math.min(o,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){h=(o?Math.min(o,r.maxLoadingDelay):r.maxLoadingDelay)-e,this.info(`bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),c=u=1}}const d=this.findBestLevel(a,s,n,l,h,c,u);if(this.rebufferNotice!==d&&(this.rebufferNotice=d,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`)),d>-1)return d;const f=i.levels[s],p=i.loadLevelObj;return p&&(null==f?void 0:f.bitrate)<p.bitrate?s:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,s,o,a){var l;const c=r+s,u=this.lastLoadedFragLevel,h=-1===u?this.hls.firstLevel:u,{fragCurrent:d,partCurrent:f}=this,{levels:p,allAudioTracks:_,loadLevel:g,config:m}=this.hls;if(1===p.length)return 0;const v=p[h],y=!(null==(l=this.hls.latestLevelDetails)||!l.live),b=-1===g||-1===u;let S,E="SDR",w=(null==v?void 0:v.frameRate)||0;const{audioPreference:C,videoPreference:k}=m,T=this.audioTracksByGroup||(this.audioTracksByGroup=rt(_));let A=-1;if(b){if(-1!==this.firstSelection)return this.firstSelection;const r=this.codecTiers||(this.codecTiers=function(e,t,i,n){return e.slice(i,n+1).reduce(((e,i,n)=>{if(!i.codecSet)return e;const r=i.audioGroups;let s=e[i.codecSet];s||(e[i.codecSet]=s={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:n,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!r,fragmentError:0}),s.minBitrate=Math.min(s.minBitrate,i.bitrate);const o=Math.min(i.height,i.width);return s.minHeight=Math.min(s.minHeight,o),s.minFramerate=Math.min(s.minFramerate,i.frameRate),s.minIndex=Math.min(s.minIndex,n),s.maxScore=Math.max(s.maxScore,i.score),s.fragmentError+=i.fragmentError,s.videoRanges[i.videoRange]=(s.videoRanges[i.videoRange]||0)+1,r&&r.forEach((e=>{if(!e)return;const i=t.groups[e];i&&(s.hasDefaultAudio=s.hasDefaultAudio||t.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(i.channels).forEach((e=>{s.channels[e]=(s.channels[e]||0)+i.channels[e]})))})),e}),{})}(p,T,t,i)),s=function(e,t,i,r,s){const o=Object.keys(e),a=null==r?void 0:r.channels,l=null==r?void 0:r.audioCodec,c=null==s?void 0:s.videoCodec,u=a&&2===parseInt(a);let h=!1,d=!1,f=1/0,p=1/0,_=1/0,g=1/0,m=0,v=[];const{preferHDR:y,allowedVideoRanges:b}=tt(t,s);for(let t=o.length;t--;){const i=e[o[t]];h||(h=i.channels[2]>0),f=Math.min(f,i.minHeight),p=Math.min(p,i.minFramerate),_=Math.min(_,i.minBitrate),b.filter((e=>i.videoRanges[e]>0)).length>0&&(d=!0)}f=n(f)?f:0,p=n(p)?p:0;const S=Math.max(1080,f),E=Math.max(30,p);_=n(_)?_:i,i=Math.max(_,i),d||(t=void 0);const w=o.length>1;return{codecSet:o.reduce(((t,n)=>{const r=e[n];if(n===t)return t;if(v=d?b.filter((e=>r.videoRanges[e]>0)):[],w){if(r.minBitrate>i)return nt(n,`min bitrate of ${r.minBitrate} > current estimate of ${i}`),t;if(!r.hasDefaultAudio)return nt(n,"no renditions with default or auto-select sound found"),t;if(l&&n.indexOf(l.substring(0,4))%5!=0)return nt(n,`audio codec preference "${l}" not found`),t;if(a&&!u){if(!r.channels[a])return nt(n,`no renditions with ${a} channel sound found (channels options: ${Object.keys(r.channels)})`),t}else if((!l||u)&&h&&0===r.channels[2])return nt(n,"no renditions with stereo sound found"),t;if(r.minHeight>S)return nt(n,`min resolution of ${r.minHeight} > maximum of ${S}`),t;if(r.minFramerate>E)return nt(n,`min framerate of ${r.minFramerate} > maximum of ${E}`),t;if(!v.some((e=>r.videoRanges[e]>0)))return nt(n,`no variants with VIDEO-RANGE of ${it(v)} found`),t;if(c&&n.indexOf(c.substring(0,4))%5!=0)return nt(n,`video codec preference "${c}" not found`),t;if(r.maxScore<m)return nt(n,`max score of ${r.maxScore} < selected max of ${m}`),t}return t&&(Le(n)>=Le(t)||r.fragmentError>e[t].fragmentError)?t:(g=r.minIndex,m=r.maxScore,n)}),void 0),videoRanges:v,preferHDR:y,minFramerate:p,minBitrate:_,minIndex:g}}(r,E,e,C,k),{codecSet:o,videoRanges:a,minFramerate:l,minBitrate:c,minIndex:u,preferHDR:h}=s;A=u,S=o,E=h?a[a.length-1]:a[0],w=l,e=Math.max(e,c),this.log(`picked start tier ${it(s)}`)}else S=null==v?void 0:v.codecSet,E=null==v?void 0:v.videoRange;const x=f?f.duration:d?d.duration:0,D=this.bwEstimator.getEstimateTTFB()/1e3,L=[];for(let l=i;l>=t;l--){var R;const t=p[l],d=l>h;if(!t)continue;if(m.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const i=navigator.mediaCapabilities;"function"==typeof(null==i?void 0:i.decodingInfo)&&$e(t,T,E,w,e,C)?(t.supportedPromise=Ge(t,T,i,this.supportedCache),t.supportedPromise.then((e=>{if(!this.hls)return;t.supportedResult=e;const i=this.hls.levels,n=i.indexOf(t);e.error?this.warn(`MediaCapabilities decodingInfo error: "${e.error}" for level ${n} ${it(e)}`):e.supported?e.decodingInfoResults.some((e=>!1===e.smooth||!1===e.powerEfficient))&&this.log(`MediaCapabilities decodingInfo for level ${n} not smooth or powerEfficient: ${it(e)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${n} ${it(e)}`),n>-1&&i.length>1&&(this.log(`Removing unsupported level ${n}`),this.hls.removeLevel(n),-1===this.hls.loadLevel&&(this.hls.nextLoadLevel=0)))})).catch((e=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${e}`)}))):t.supportedResult=He}if((S&&t.codecSet!==S||E&&t.videoRange!==E||d&&w>t.frameRate||!d&&w>0&&w<t.frameRate||null!=(R=t.supportedResult)&&null!=(R=R.decodingInfoResults)&&R.some((e=>!1===e.smooth)))&&(!b||l!==A)){L.push(l);continue}const _=t.details,v=(f?null==_?void 0:_.partTarget:null==_?void 0:_.averagetargetduration)||x;let k;k=d?a*e:o*e;const I=x&&r>=2*x&&0===s?t.averageBitrate:t.maxBitrate,P=this.getTimeToLoadFrag(D,k,I*v,void 0===_);if(k>=I&&(l===u||0===t.loadError&&0===t.fragmentError)&&(P<=D||!n(P)||y&&!this.bitrateTestDelay||P<c)){const e=this.forcedAutoLevel;return l===g||-1!==e&&e===g||(L.length&&this.trace(`Skipped level(s) ${L.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${p[L[0]].codecs}" ${p[L[0]].videoRange}; not compatible with "${S}" ${E}`),this.info(`switch candidate:${h}->${l} adjustedbw(${Math.round(k)})-bitrate=${Math.round(k-I)} ttfb:${D.toFixed(1)} avgDuration:${v.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${b} codecSet:${t.codecSet} videoRange:${t.videoRange} hls.loadLevel:${g}`)),b&&(this.firstSelection=l),l}}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)}},bufferController:class extends E{constructor(e,t){var i;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=e=>{var t;this.hls&&"open"===(null==(t=this.mediaSource)?void 0:t.readyState)&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=e=>{const{media:t,mediaSource:i}=this;e&&this.log("Media source opened"),t&&i&&(i.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(l.MEDIA_ATTACHED,{media:t,mediaSource:i}),null!==this.mediaSource&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&this.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=(i=D(e.config.preferManagedMediaSource),"undefined"!=typeof self&&i===self.ManagedMediaSource),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(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.BUFFER_RESET,this.onBufferReset,this),e.on(l.BUFFER_APPENDING,this.onBufferAppending,this),e.on(l.BUFFER_CODECS,this.onBufferCodecs,this),e.on(l.BUFFER_EOS,this.onBufferEos,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(l.FRAG_PARSED,this.onFragParsed,this),e.on(l.FRAG_CHANGED,this.onFragChanged,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.BUFFER_RESET,this.onBufferReset,this),e.off(l.BUFFER_APPENDING,this.onBufferAppending,this),e.off(l.BUFFER_CODECS,this.onBufferCodecs,this),e.off(l.BUFFER_EOS,this.onBufferEos,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(l.FRAG_PARSED,this.onFragParsed,this),e.off(l.FRAG_CHANGED,this.onFragChanged,this),e.off(l.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const e=this.isUpdating();e||this.operationQueue.removeBlockers();const t=this.isQueued();(e||t)&&this.warn(`Transfering MediaSource with${t?" operations in queue":""}${e?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?y(i,n.tracks):this.sourceBuffers.forEach((e=>{const[t]=e;t&&(i[t]=y({},this.tracks[t]),this.removeBuffer(t)),e[0]=e[1]=null})),{media:e,mediaSource:t,tracks:i}}initTracks(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),null!=(i=this.transferData)&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const n=D(this.appendSource);if(n){const e=!!t.mediaSource;(e||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(r),e)this._objectUrl=i.src,this.attachTransferred();else{const e=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{i.removeAttribute("src");const t=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||t&&r instanceof t,gs(i),function(e,t){const i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,e),i.load()}catch(t){i.src=e}else i.src=e}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${(null==(t=this.transferData)?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${null==(i=e.constructor)?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,n=t.tracks,r=n?Object.keys(n):null,s=r?r.length:0,o=()=>{Promise.resolve().then((()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()}))};if(n&&r&&s){if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})\nrequired tracks: ${it(i,((e,t)=>"initSegment"===e?void 0:t))};\ntransfer tracks: ${it(n,((e,t)=>"initSegment"===e?void 0:t))}}`),!L(n,i)){t.mediaSource=null,t.tracks=void 0;const r=e.currentTime,s=this.details,o=Math.max(r,(null==s?void 0:s.fragments[0].start)||0);return o-r>1?void this.log(`attachTransferred: waiting for playback to reach new tracks start time ${r} -> ${o}`):(this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(i)}") start time: ${o} currentTime: ${r}`),this.onMediaDetaching(l.MEDIA_DETACHING,{}),this.onMediaAttaching(l.MEDIA_ATTACHING,t),void(e.currentTime=o))}this.transferData=void 0,r.forEach((e=>{const t=e,i=n[t];if(i){const e=i.buffer;if(e){const n=this.fragmentTracker,r=i.id;if(n.hasFragments(r)||n.hasParts(r)){const i=ti.getBuffered(e);n.detectEvictedFragments(t,i,r,null,!0)}const s=ms(t),o=[t,e];this.sourceBuffers[s]=o,e.updating&&this.operationQueue&&this.operationQueue.prependBlocker(t),this.trackSourceBuffer(t,i)}}})),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=null==(e=this.mediaSource)?void 0:e.readyState;return"open"===t||"ended"===t}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:r,_objectUrl:s}=this;if(r){if(this.log("media source "+(i?"transferring":"detaching")),i)this.sourceBuffers.forEach((([e])=>{e&&this.removeBuffer(e)})),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const e="open"===r.readyState;try{const t=r.sourceBuffers;for(let i=t.length;i--;)e&&t[i].abort(),r.removeSourceBuffer(t[i]);e&&r.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.removeEventListener("startstreaming",this._onStartStreaming),r.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(n.removeAttribute("src"),this.appendSource&&gs(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(l.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach((([e])=>{e&&this.resetBuffer(e)})),this.initTracks()}resetBuffer(e){var t;const i=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;null!=(n=this.mediaSource)&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(t){this.warn(`onBufferReset ${e}`,t)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[ms(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new ds(this.tracks)}onBufferCodecs(e,t){var i;const n=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),o=!s&&this.sourceBufferCount&&this.media&&r.some((e=>!n[e]));s||o?this.warn(`Unsupported transition between "${Object.keys(n)}" and "${r}" SourceBuffers`):(r.forEach((e=>{var i,r;const s=t[e],{id:o,codec:a,levelCodec:l,container:c,metadata:u,supplemental:h}=s;let d=n[e];const f=null==(i=this.transferData)||null==(i=i.tracks)?void 0:i[e],p=null!=f&&f.buffer?f:d,_=(null==p?void 0:p.pendingCodec)||(null==p?void 0:p.codec),g=null==p?void 0:p.levelCodec;d||(d=n[e]={buffer:void 0,listeners:[],codec:a,supplemental:h,container:c,levelCodec:l,metadata:u,id:o});const m=Oe(_,g),v=null==m?void 0:m.replace(fs,"$1");let y=Oe(a,l);const b=null==(r=y)?void 0:r.replace(fs,"$1");y&&m&&v!==b&&("audio"===e.slice(0,5)&&(y=Pe(y,this.appendSource)),this.log(`switching codec ${_} to ${y}`),y!==(d.pendingCodec||d.codec)&&(d.pendingCodec=y),d.container=c,this.appendChangeType(e,c,y))})),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&"main"===(null==(i=t.audio)?void 0:i.id)&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks()))}get sourceBufferTracks(){return Object.keys(this.tracks).reduce(((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e}),{})}appendChangeType(e,t,i){const n=`${t};codecs=${i}`,r={label:`change-type=${n}`,execute:()=>{const r=this.tracks[e];if(r){const s=r.buffer;null!=s&&s.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),s.changeType(n),r.codec=i,r.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};this.append(r,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,n=i+.05*e.duration;if(!0===(null==(t=this.fragmentTracker.getAppendedFrag(i,f))?void 0:t.gap))return;const r={label:"block-audio",execute:()=>{var e;const t=this.tracks.video;(this.lastVideoAppendEnd>n||null!=t&&t.buffer&&ti.isBuffered(t.buffer,n)||!0===(null==(e=this.fragmentTracker.getAppendedFrag(n,f))?void 0:e.gap))&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn("Error executing block-audio operation",e)}};this.blockedAudioAppend={op:r,frag:e},this.append(r,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:r,type:s,parent:c,frag:u,part:h,chunkMeta:d,offset:p}=t,_=d.buffering[s],{sn:g,cc:m}=u,v=self.performance.now();_.start=v;const y=u.stats.buffering,b=h?h.stats.buffering:null;0===y.start&&(y.start=v),b&&0===b.start&&(b.start=v);const S=i.audio;let E=!1;"audio"===s&&"audio/mpeg"===(null==S?void 0:S.container)&&(E=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const w=i.video,C=null==w?void 0:w.buffer;if(C&&"initSegment"!==g){const e=h||u,t=this.blockedAudioAppend;if("audio"!==s||"main"===c||this.blockedAudioAppend||w.ending||w.ended){if("video"===s){const i=e.end;if(t){const e=t.frag.start;(i>e||i<this.lastVideoAppendEnd||ti.isBuffered(C,e))&&this.unblockAudio()}this.lastVideoAppendEnd=i}}else{const t=e.start+.05*e.duration,i=C.buffered,n=this.currentOp("video");i.length||n?!n&&!ti.isBuffered(C,t)&&this.lastVideoAppendEnd<t&&this.blockAudio(e):this.blockAudio(e)}}const k=(h||u).start,T={label:`append-${s}`,execute:()=>{var e;_.executeStart=self.performance.now();const t=null==(e=this.tracks[s])?void 0:e.buffer;t&&(E?this.updateTimestampOffset(t,k,.1,s,g,m):void 0!==p&&n(p)&&this.updateTimestampOffset(t,p,1e-6,s,g,m)),this.appendExecutor(r,s)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();_.executeEnd=_.end=e,0===y.first&&(y.first=e),b&&0===b.first&&(b.first=e);const t={};this.sourceBuffers.forEach((([e,i])=>{e&&(t[e]=ti.getBuffered(i))})),this.appendErrors[s]=0,"audio"===s||"video"===s?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(l.BUFFER_APPENDED,{type:s,frag:u,part:h,chunkMeta:d,parent:u.type,timeRanges:t})},onError:e=>{var t;const i={type:o.MEDIA_ERROR,parent:u.type,details:a.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:u,part:h,chunkMeta:d,error:e,err:e,fatal:!1},n=null==(t=this.media)?void 0:t.error;if(e.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==e.name||"quota"in e)i.details=a.BUFFER_FULL_ERROR;else if(e.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!n)i.errorAction=It(!0);else if(e.name===ps&&0===this.sourceBufferCount)i.errorAction=It(!0);else{const e=++this.appendErrors[s];this.warn(`Failed ${e}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${n||"no media error"})`),(e>=this.hls.config.appendErrorMaxRetry||n)&&(i.fatal=!0)}this.hls.trigger(l.ERROR,i)}};this.log(`queuing "${s}" append sn: ${g}${h?" p: "+h.index:""} of ${u.type===f?"level":"track"} ${u.level} cc: ${m}`),this.append(T,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(l.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:i,startOffset:n,endOffset:r}=t;i?this.append(this.getFlushOp(i,n,r),i):this.sourceBuffers.forEach((([e])=>{e&&this.append(this.getFlushOp(e,n,r),e)}))}onFragParsed(e,t){const{frag:i,part:n}=t,r=[],s=n?n.elementaryStreams:i.elementaryStreams;s[W]?r.push("audiovideo"):(s[z]&&r.push("audio"),s[K]&&r.push("video"));0===r.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers((()=>{const e=self.performance.now();i.stats.buffering.end=e,n&&(n.stats.buffering.end=e);const t=n?n.stats:i.stats;this.hls.trigger(l.FRAG_BUFFERED,{frag:i,part:n,stats:t,id:i.type})}),r).catch((e=>{this.warn(`Fragment buffered callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)}))}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some((([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1}))}onBufferEos(e,t){var i;this.sourceBuffers.forEach((([e])=>{if(e){const i=this.tracks[e];t.type&&t.type!==e||(i.ending=!0,i.ended||(i.ended=!0,this.log(`${e} buffer reached EOS`)))}}));const n=!1!==(null==(i=this.overrides)?void 0:i.endOfStream);this.sourceBufferCount>0&&!this.sourceBuffers.some((([e])=>{var t;return e&&!(null!=(t=this.tracks[e])&&t.ended)}))?n?(this.log("Queueing EOS"),this.blockUntilOpen((()=>{this.tracksEnded();const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream(),this.hls.trigger(l.BUFFERED_TO_END,void 0)):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)}))):(this.tracksEnded(),this.hls.trigger(l.BUFFERED_TO_END,void 0)):"video"===t.type&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach((([e])=>{if(null!==e){const t=this.tracks[e];t&&(t.ending=!1)}}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen((()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)}))}onError(e,t){if(t.details===a.BUFFER_APPEND_ERROR&&t.frag){var i;const e=null==(i=t.errorAction)?void 0:i.nextAutoLevel;n(e)&&e!==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||null===t)return;if(!this.sourceBufferCount)return;const r=e.config,s=i.currentTime,o=t.levelTargetDuration,a=t.live&&null!==r.liveBackBufferLength?r.liveBackBufferLength:r.backBufferLength;if(n(a)&&a>=0){const e=Math.max(a,o),t=Math.floor(s/o)*o-e;this.flushBackBuffer(s,o,t)}const l=r.frontBufferFlushThreshold;if(n(l)&&l>0){const e=Math.max(r.maxBufferLength,l),t=Math.max(e,o),i=Math.floor(s/o)*o+t;this.flushFrontBuffer(s,o,i)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach((([e,t])=>{if(t){const r=ti.getBuffered(t);if(r.length>0&&i>r.start(0)){var n;this.hls.trigger(l.BACK_BUFFER_REACHED,{bufferEnd:i});const t=this.tracks[e];if(null!=(n=this.details)&&n.live)this.hls.trigger(l.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(null!=t&&t.ended)return void this.log(`Cannot flush ${e} back buffer while SourceBuffer is in ended state`);this.hls.trigger(l.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:e})}}}))}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach((([t,n])=>{if(n){const r=ti.getBuffered(n),s=r.length;if(s<2)return;const o=r.start(s-1),a=r.end(s-1);if(i>o||e>=o&&e<=a)return;this.hls.trigger(l.BUFFER_FLUSHING,{startOffset:o,endOffset:1/0,type:t})}}))}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||"open"!==(null==i?void 0:i.readyState))return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const e=Math.max(0,t.fragmentStart);return{duration:1/0,start:e,end:Math.max(e,r)}}return{duration:1/0}}const s=null==(e=this.overrides)?void 0:e.duration;if(s)return n(s)?{duration:s}:null;const o=this.media.duration;return r>(n(i.duration)?i.duration:0)&&r>o||!n(o)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:i}){const r=this.mediaSource;this.media&&r&&"open"===r.readyState&&(r.duration!==e&&(n(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),void 0!==t&&void 0!==i&&(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}) ${it(i)}`),this.tracksReady){var n;const e=null==(n=this.transferData)?void 0:n.tracks;e&&Object.keys(e).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach((([t,i])=>{if(t){const n=this.tracks[t];e[t]={buffer:i,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}})),this.hls.trigger(l.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach((([e])=>{this.executeNext(e)}))}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.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 r in e){const s=r,c=e[s];if(this.isPending(c)){const e=this.getTrackCodec(c,s),r=`${c.container};codecs=${e}`;c.codec=e,this.log(`creating sourceBuffer(${r})${this.currentOp(s)?" Queued":""} ${it(c)}`);try{const e=i.addSourceBuffer(r),n=ms(s),o=[s,e];t[n]=o,c.buffer=e}catch(e){var n;return this.error(`error while trying to add sourceBuffer: ${e.message}`),this.shiftAndExecuteNext(s),null==(n=this.operationQueue)||n.removeBlockers(),delete this.tracks[s],void this.hls.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:s,mimeType:r,parent:c.id})}this.trackSourceBuffer(s,c)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let n=e.codec;i&&("video"===t||"audiovideo"===t)&&Te(i,"video")&&(n=function(e,t){const i=[];if(e){const t=e.split(",");for(let e=0;e<t.length;e++)ke(t[e],"video")||i.push(t[e])}return t&&i.push(t),i.join(",")}(n,i));const r=Oe(n,e.levelCodec);return r?"audio"===t.slice(0,5)?Pe(r,this.appendSource):r:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",((e,t)=>{const i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(l.BUFFER_FLUSHED,{type:e})}))}get mediaSrc(){var e,t;const i=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==i?void 0:i.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${n}`,t),this.hls.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const r=this.currentOp(e);r&&r.onError(n)}updateTimestampOffset(e,t,i,n,r,s){const o=t-e.timestampOffset;Math.abs(o)>=i&&(this.log(`Updating ${n} SourceBuffer timestampOffset to ${t} (sn: ${r} cc: ${s})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:r,mediaSource:s}=this,o=this.tracks[e],a=null==o?void 0:o.buffer;if(!r||!s||!a)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void this.shiftAndExecuteNext(e);const l=n(r.duration)?r.duration:1/0,c=n(s.duration)?s.duration:1/0,u=Math.max(0,t),h=Math.min(i,l,c);h>u&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${u},${h}] from the ${e} SourceBuffer`),a.remove(u,h)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=null==i?void 0:i.buffer;if(!n)throw new _s(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch((e=>{this.warn(`SourceBuffer blocked callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)}));else try{e()}catch(e){this.warn(`Callback run without blocking ${this.operationQueue} ${e}`)}}isUpdating(){return this.sourceBuffers.some((([e,t])=>e&&t.updating))}isQueued(){return this.sourceBuffers.some((([e])=>e&&!!this.currentOp(e)))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map((e=>this.appendBlocker(e)));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then((t=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))}))}stepOperationQueue(e){e.forEach((e=>{var t;const i=null==(t=this.tracks[e])?void 0:t.buffer;i&&!i.updating&&this.shiftAndExecuteNext(e)}))}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce(((e,t)=>e+(this.isPending(this.tracks[t])?1:0)),0)}get sourceBufferCount(){return this.sourceBuffers.reduce(((e,[t])=>e+(t?1:0)),0)}get sourceBufferTypes(){return this.sourceBuffers.map((([e])=>e)).filter((e=>!!e))}addBufferListener(e,t,i){const n=this.tracks[e];if(!n)return;const r=n.buffer;if(!r)return;const s=i.bind(this,e);n.listeners.push({event:t,listener:s}),r.addEventListener(t,s)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach((e=>{i.removeEventListener(e.event,e.listener)})),t.listeners.length=0)}},capLevelController:vs,errorController:class extends E{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(l.ERROR,this.onError,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(l.ERROR,this.onError,this),e.off(l.ERROR,this.onErrorOut,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===f?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return null!=(e=t.loadLevelObj)&&e.details||-1===i?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if(null!=(i=e.details)&&i.hasKey(t))return!0;const n=e.audioGroups;if(n){return this.hls.allAudioTracks.filter((e=>n.indexOf(e.groupId)>=0)).some((e=>{var i;return null==(i=e.details)?void 0:i.hasKey(t)}))}}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const n=this.hls,r=t.context;switch(t.details){case a.FRAG_LOAD_ERROR:case a.FRAG_LOAD_TIMEOUT:case a.KEY_LOAD_ERROR:case a.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case a.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction=It());case a.FRAG_GAP:case a.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=kt);case a.LEVEL_EMPTY_ERROR:case a.LEVEL_PARSING_ERROR:{var s;const e=t.parent===f?t.level:n.loadLevel;t.details===a.LEVEL_EMPTY_ERROR&&null!=(s=t.context)&&null!=(s=s.levelDetails)&&s.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case a.LEVEL_LOAD_ERROR:case a.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==r?void 0:r.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level)));case a.AUDIO_TRACK_LOAD_ERROR:case a.AUDIO_TRACK_LOAD_TIMEOUT:case a.SUBTITLE_LOAD_ERROR:case a.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const e=n.loadLevelObj;if(e&&(r.type===h&&e.hasAudioGroup(r.groupId)||r.type===d&&e.hasSubtitleGroup(r.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=kt,void(t.errorAction.flags=Dt)}return;case a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:return void(t.errorAction={action:kt,flags:Lt});case a.KEY_SYSTEM_SESSION_UPDATE_FAILED:case a.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case a.KEY_SYSTEM_NO_SESSION:return void(t.errorAction={action:kt,flags:Rt});case a.BUFFER_ADD_CODEC_ERROR:case a.REMUX_ALLOC_ERROR:case a.BUFFER_APPEND_ERROR:var l;if(!t.errorAction)t.errorAction=this.getLevelSwitchAction(t,null!=(l=t.level)?l:n.loadLevel);return;case a.INTERNAL_EXCEPTION:case a.BUFFER_APPENDING_ERROR:case a.BUFFER_FULL_ERROR:case a.LEVEL_SWITCH_ERROR:case a.BUFFER_STALLED_ERROR:case a.BUFFER_SEEK_OVER_HOLE:case a.BUFFER_NUDGE_ON_STALL:return void(t.errorAction=It())}t.type===o.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=It())}getPlaylistRetryOrSwitchAction(e,t){const i=yt(this.hls.config.playlistLoadPolicy,e),n=this.playlistError++;if(Et(i,n,gt(e),e.response))return{action:At,flags:xt,retryConfig:i,retryCount:n};const r=this.getLevelSwitchAction(e,t);return i&&(r.retryConfig=i,r.retryCount=n),r}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:s}=t.config,o=yt(mt(e)?s:r,e),l=t.levels.reduce(((e,t)=>e+t.fragmentError),0);if(n&&(e.details!==a.FRAG_GAP&&n.fragmentError++,!vt(e))){if(Et(o,l,gt(e),e.response))return{action:At,flags:xt,retryConfig:o,retryCount:l}}const c=this.getLevelSwitchAction(e,i);return o&&(c.retryConfig=o,c.retryCount=l),c}getLevelSwitchAction(e,t){const i=this.hls;null==t&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var r,s;const t=e.details;n.loadError++,t===a.BUFFER_APPEND_ERROR&&n.fragmentError++;let c=-1;const{levels:u,loadLevel:g,minAutoLevel:m,maxAutoLevel:v}=i;i.autoLevelEnabled||i.config.preserveManualLevelOnError||(i.loadLevel=-1);const y=null==(r=e.frag)?void 0:r.type,b=(y===p&&t===a.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===a.BUFFER_ADD_CODEC_ERROR||t===a.BUFFER_APPEND_ERROR))&&u.some((({audioCodec:e})=>n.audioCodec!==e)),S="video"===e.sourceBufferName&&(t===a.BUFFER_ADD_CODEC_ERROR||t===a.BUFFER_APPEND_ERROR)&&u.some((({codecSet:e,audioCodec:t})=>n.codecSet!==e&&n.audioCodec===t)),{type:E,groupId:w}=null!=(s=e.context)?s:{};for(let i=u.length;i--;){const r=(i+g)%u.length;if(r!==g&&r>=m&&r<=v&&0===u[r].loadError){var o,l;const i=u[r];if(t===a.FRAG_GAP&&y===f&&e.frag){const t=u[r].details;if(t){const i=dt(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else{if(E===h&&i.hasAudioGroup(w)||E===d&&i.hasSubtitleGroup(w))continue;if(y===p&&null!=(o=n.audioGroups)&&o.some((e=>i.hasAudioGroup(e)))||y===_&&null!=(l=n.subtitleGroups)&&l.some((e=>i.hasSubtitleGroup(e)))||b&&n.audioCodec===i.audioCodec||S&&n.codecSet===i.codecSet||!b&&n.codecSet!==i.codecSet)continue}c=r;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:kt,flags:xt,nextAutoLevel:c}}return{action:kt,flags:Dt}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case Ct:break;case kt:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===a.FRAG_GAP?/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()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n}=i,r=i.nextAutoLevel;switch(n){case xt:this.switchLevel(e,r);break;case Lt:{const n=this.getVariantLevelIndex(e.frag),r=t.levels[n],s=null==r?void 0:r.attrs["HDCP-LEVEL"];if(i.hdcpLevel=s,"NONE"===s)this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(s){t.maxHdcpLevel=We[We.indexOf(s)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Rt:{const t=e.decryptdata;if(t){const n=this.hls.levels,r=n.length;for(let i=r;i--;){var s,o;if(this.variantHasKey(n[i],t))this.log(`Banned key found in level ${i} (${n[i].bitrate}bps) or audio group "${null==(s=n[i].audioGroups)?void 0:s.join(",")}" (${null==(o=e.frag)?void 0:o.type} fragment) ${I(t.keyId||[])}`),n[i].fragmentError++,n[i].loadError++,this.log(`Removing level ${i} with key error (${e.error})`),this.hls.removeLevel(i)}const a=e.frag;if(this.hls.levels.length<r)i.resolved=!0;else if(a&&a.type!==f){const e=a.decryptdata;e&&!t.matches(e)&&(i.resolved=!0)}}break}}i.resolved||this.switchLevel(e,r)}switchLevel(e,t){if(void 0!==t&&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===a.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&"audiovideo"!==e.sourceBufferName)){const t=Ne(e.mimeType),i=this.hls.levels;for(let n=i.length;n--;)i[n][`${e.sourceBufferName}Codec`]===t&&(this.log(`Removing level ${n} for ${e.details} ("${t}" not supported)`),this.hls.removeLevel(n))}}},fpsController:class{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(l.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(l.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(l.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 e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const e=n-this.lastTime,r=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*r/e,a=this.hls;if(a.trigger(l.FPS_DROP,{currentDropped:r,currentDecoded:s,totalDroppedFrames:i}),o>0&&r>a.config.fpsDroppedMonitoringThreshold*s){let e=a.currentLevel;a.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===a.autoLevelCapping||a.autoLevelCapping>=e)&&(e-=1,a.trigger(l.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:a.currentLevel}),a.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},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:Li,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},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},{cueHandler:Ma,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends Rn{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",_),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(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(l.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(l.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=bn,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:n}=t;if(this.fragContextChanged(i)||(V(i)&&(this.fragPrevious=i),this.state=bn),!n)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let s;const o=i.start;for(let e=0;e<r.length;e++)if(o>=r[e].start&&o<=r[e].end){s=r[e];break}const a=i.start+i.duration;s?s.end=a:(s={start:o,end:a},r.push(s)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(0===i&&n!==Number.POSITIVE_INFINITY){const e=n-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach((t=>{for(let i=0;i<t.length;)if(t[i].end<=e)t.shift();else{if(!(t[i].start<e))break;t[i].start=e,i++}})),this.fragmentTracker.removeFragmentsInRange(i,e,_)}}onError(e,t){const i=t.frag;(null==i?void 0:i.type)===_&&(t.details===a.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==yn&&(this.state=bn))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){this.levels&&cs(this.levels,t)?this.levels=t.map((e=>new Je(e))):(this.tracksBuffered=[],this.levels=t.map((e=>{const t=new Je(e);return this.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,_),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==yn&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,levels:r}=this,{details:s,id:o}=t;if(!r)return void this.warn(`Subtitle tracks were reset while loading level ${o}`);const a=r[o];if(o>=r.length||!a)return;this.log(`Subtitle track ${o} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(s.live||null!=(i=a.details)&&i.live){if(s.deltaUpdateFailed)return;const e=this.mainDetails;if(!e)return void(this.startFragRequested=!1);const t=e.fragments[0];var u;if(a.details)c=this.alignPlaylists(s,a.details,null==(u=this.levelLastLoaded)?void 0:u.details),0===c&&t&&(c=t.start,nn(s,c));else s.hasProgramDateTime&&e.hasProgramDateTime?(_n(s,e),c=s.fragmentStart):t&&(c=t.start,nn(s,c));e&&!this.startFragRequested&&this.setStartPosition(e,c)}if(a.details=s,this.levelLastLoaded=a,o===n&&(this.hls.trigger(l.SUBTITLE_TRACK_UPDATED,{details:s,id:o,groupId:t.groupId}),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===bn)){dt(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),a.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,n=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&null!=n&&n.key&&n.iv&&_i(n.method)){const e=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,gi(n.method)).catch((e=>{throw r.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((i=>{const n=performance.now();r.trigger(l.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:n}})})).catch((e=>{this.warn(`${e.name}: ${e.message}`),this.state=bn}))}}doTick(){if(this.media){if(this.state===bn){const{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;if(this.waitForLive(i))return;const{config:n}=this,r=this.getLoadPosition(),s=ti.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,n.maxBufferHole),{end:o,len:a}=s,l=i.details;if(a>this.hls.maxBufferLength+l.levelTargetDuration)return;const c=l.fragments,u=c.length,h=l.edge;let d=null;const f=this.fragPrevious;if(o<h){const e=n.maxFragLookUpTolerance,t=o>h-e?0:e;d=dt(f,c,Math.max(c[0].start,o),t),!d&&f&&f.start<c[0].start&&(d=c[0])}else d=c[u-1];if(d=this.filterReplacedPrimary(d,i.details),!d)return;const p=c[d.sn-l.startSN-1];if(p&&p.cc===d.cc&&this.fragmentTracker.getState(p)===Pt&&(d=p),this.fragmentTracker.getState(d)===Pt){const e=this.mapToInitFragWhenRequired(d);e&&this.loadFragment(e,i,o)}}}else this.state=bn}loadFragment(e,t,i){V(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Ho(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends ls{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 e=null;const t=Co(this.media.textTracks);for(let i=0;i<t.length;i++)if("hidden"===t[i].mode)e=t[i];else if("showing"===t[i].mode){e=t[i];break}const i=this.findTrackForTextTrack(e);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},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(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.LEVEL_LOADING,this.onLevelLoading,this),e.off(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(l.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;Co(i.textTracks).forEach((e=>{Eo(e)}))}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:n,details:r}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==n)return void this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${null==s?void 0:s.groupId}`);const o=s.details;s.details=t.details,this.log(`Subtitle track ${i} "${s.name}" lang:${s.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let r=this.currentTrack;if(!i||(null==n?void 0:n.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==n?void 0:n.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!r&&t){this.selectDefaultTrack=!1;const i=ot(t,e);if(i>-1)r=e[i];else{const e=ot(t,this.tracks);r=this.tracks[e]}}let n=this.findTrackId(r);-1===n&&r&&(n=this.findTrackId(null));const s={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(l.SUBTITLE_TRACKS_UPDATED,s),-1!==n&&-1===this.trackId&&this.setSubtitleTrack(n)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n<t.length;n++){const r=t[n];if((!i||r.default)&&(i||e)&&(!e||at(r,e)))return n}if(e){for(let i=0;i<t.length;i++){const n=t[i];if(us(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const n=t[i];if(us(e.attrs,n.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){if(hs(t[i],e))return i}}return-1}onError(e,t){!t.fatal&&t.context&&(t.context.type!==d||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||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(-1===e.id)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&at(e,i))return i;const n=ot(e,this.tracksInGroup);if(n>-1){const e=this.tracksInGroup[n];return this.setSubtitleTrack(n),e}if(i)return null;{const i=ot(e,t);if(i>-1)return t[i]}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,r=this.getUrlWithDirectives(e.url,t),s=e.details,o=null==s?void 0:s.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""}${o&&s.live?" age "+o.toFixed(1)+(s.type?" "+s.type||0:""):""} ${r}`),this.hls.trigger(l.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Co(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter((e=>hs(i,e)))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach((e=>{"disabled"!==e.mode&&e!==n&&(e.mode="disabled")})),n){const e=this.subtitleDisplay?"showing":"hidden";n.mode!==e&&(n.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!n(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r)return void this.hls.trigger(l.SUBTITLE_TRACK_SWITCH,{id:e});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:o,groupId:a="",name:c,type:u,url:h}=r;this.hls.trigger(l.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:c,type:u,url:h});const d=this.switchParams(r.url,null==i?void 0:i.details,r.details);this.loadPlaylist(d)}},timelineController:class{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={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},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(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(l.FRAG_LOADING,this.onFragLoading,this),e.on(l.FRAG_LOADED,this.onFragLoaded,this),e.on(l.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(l.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(l.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(l.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(l.FRAG_LOADING,this.onFragLoading,this),e.off(l.FRAG_LOADED,this.onFragLoaded,this),e.off(l.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(l.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(l.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(l.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Ra(this,"textTrack1"),t=new Ra(this,"textTrack2"),i=new Ra(this,"textTrack3"),n=new Ra(this,"textTrack4");this.cea608Parser1=new na(1,e,t),this.cea608Parser2=new na(3,i,n)}addCues(e,t,i,n,r){let s=!1;for(let e=r.length;e--;){const n=r[e],l=(o=n[0],a=n[1],c=t,u=i,Math.min(a,u)-Math.max(o,c));if(l>=0&&(n[0]=Math.min(n[0],t),n[1]=Math.max(n[1],i),s=!0,l/(i-t)>.5))return}var o,a,c,u;if(s||r.push([t,i]),this.config.renderTextTracksNatively){const r=this.captionsTracks[e];this.Cues.newCue(r,t,i,n)}else{const r=this.Cues.newCue(null,t,i,n);this.hls.trigger(l.CUES_PARSED,{type:"captions",cues:r,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:r,trackId:s}){const{unparsedVttFrags:o}=this;i===f&&(this.initPTS[t.cc]={baseTime:n,timescale:r,trackId:s}),o.length&&(this.unparsedVttFrags=[],o.forEach((e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(l.FRAG_LOADED,e):this.hls.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,error:new Error("Subtitle discontinuity domain does not match main")})})))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n<i.textTracks.length;n++){const r=i.textTracks[n];if(Pa(r,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:n}=this,{label:r,languageCode:s}=t[e],o=this.getExistingTrack(r,s);if(o)i[e]=o,Eo(i[e]),bo(i[e],n);else{const t=this.createTextTrack("captions",r,s);t&&(t[e]=!0,i[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(l.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,i){const n=this.media;if(n)return n.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:n}=this;Object.keys(n).forEach((e=>{Eo(n[e]),delete n[e]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},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 e=0;e<t.length;e++)Eo(t[e])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some((e=>e.textCodec===ba));if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(cs(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const e=this.media,t=e?Co(e.textTracks):null;if(this.tracks.forEach(((e,i)=>{let n;if(t){let i=null;for(let n=0;n<t.length;n++)if(t[n]&&Pa(t[n],e)){i=t[n],t[n]=null;break}i&&(n=i)}if(n)Eo(n);else{const t=Ia(e);n=this.createTextTrack(t,e.name,e.lang),n&&(n.mode="disabled")}n&&this.textTracks.push(n)})),null!=t&&t.length){const e=t.filter((e=>null!==e)).map((e=>e.label));e.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map((e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e})));this.hls.trigger(l.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const i=`textTrack${t[1]}`,n=this.captionsProperties[i];n&&(n.label=e.name,e.lang&&(n.languageCode=e.lang),n.media=e)}))}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===f){var i,n;const{cea608Parser1:e,cea608Parser2:r,lastSn:s}=this,{cc:o,sn:a}=t.frag,l=null!=(i=null==(n=t.part)?void 0:n.index)?i:-1;e&&r&&(a!==s+1||a===s&&l!==this.lastPartIndex+1||o!==this.lastCc)&&(e.reset(),r.reset()),this.lastCc=o,this.lastSn=a,this.lastPartIndex=l}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===_)if(n.byteLength){const e=i.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){const e=this.tracks[i.level],r=this.vttCCs;r[i.cc]||(r[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===ba?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Ca(t,this.initPTS[e.cc],(t=>{this._appendCues(t,e.level),i.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(t=>{i.logger.log(`Failed to parse IMSC1: ${t}`),i.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:r,unparsedVttFrags:s}=this,o=r.length-1;if(!r[i.cc]&&-1===o)return void s.push(e);const a=this.hls;ya(null!=(t=i.initSegment)&&t.data?_e(i.initSegment.data,new Uint8Array(n)).buffer:n,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,(e=>{this._appendCues(e,i.level),a.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})}),(t=>{const r="Missing initPTS for VTT MPEGTS"===t.message;r?s.push(e):this._fallbackToIMSC1(i,n),a.logger.log(`Failed to parse VTT cue: ${t}`),r&&o>i.cc||a.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Ca(t,this.initPTS[e.cc],(()=>{i.textCodec=ba,this._parseIMSC1(e,t)}),(()=>{i.textCodec="wvtt"}))}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach((e=>So(i,e)))}else{const n=this.tracks[t];if(!n)return;const r=n.default?"default":"subtitles"+t;i.trigger(l.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===_&&this.onFragLoaded(l.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:n}=t;if(i.type!==f||"NONE"!==this.closedCaptionsForLevel(i))for(let e=0;e<n.length;e++){const t=n[e].bytes;if(t){this.cea608Parser1||this.initCea608Parsers();const i=this.extractCea608Data(t);this.cea608Parser1.addData(n[e].pts,i[0]),this.cea608Parser2.addData(n[e].pts,i[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:n,type:r}){const{media:s}=this;if(s&&!(s.currentTime<i)){if(!r||"video"===r){const{captionsTracks:e}=this;Object.keys(e).forEach((n=>wo(e[n],t,i)))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==n){const{textTracks:e}=this;Object.keys(e).forEach((i=>wo(e[i],t,n)))}}}extractCea608Data(e){const t=[[],[]],i=31&e[0];let n=2;for(let r=0;r<i;r++){const i=e[n++],r=127&e[n++],s=127&e[n++];if(0===r&&0===s)continue;if(0!=(4&i)){const e=3&i;0!==e&&1!==e||(t[e].push(r),t[e].push(s))}}return t}},audioStreamController:class extends Rn{constructor(e,t,i){super(e,t,i,"audio-stream-controller",p),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(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(l.BUFFER_RESET,this.onBufferReset,this),e.on(l.BUFFER_CREATED,this.onBufferCreated,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(l.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(l.FRAG_LOADING,this.onFragLoading,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(l.BUFFER_RESET,this.onBufferReset,this),e.off(l.BUFFER_CREATED,this.onBufferCreated,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(l.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(l.FRAG_LOADING,this.onFragLoading,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:r,trackId:s}){if(i===f){const e=t.cc,i=this.fragCurrent;if(this.initPTS[e]={baseTime:n,timescale:r,trackId:s},this.log(`InitPTS for cc: ${e} found from main: ${n/r} (${n}/${r}) trackId: ${s}`),this.mainAnchor=t,this.state===Dn){const i=this.waitingData;(!i&&!this.loadingParts||i&&i.frag.cc!==e)&&this.syncWithAnchor(t,null==i?void 0:i.frag)}else!this.hls.hasEnoughToStart&&i&&i.cc!==e?(i.abortRequests(),this.syncWithAnchor(t,i)):this.state===bn&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const n=(null==(i=this.mainFragLoading)?void 0:i.frag)||null;if(t&&(null==n?void 0:n.cc)===t.cc)return;const r=(n||e).cc,s=_t(this.getLevelDetails(),r,this.getLoadPosition());s&&(this.log(`Syncing with main frag at ${s.start} cc ${s.cc}`),this.startFragRequested=!1,this.nextLoadPosition=s.start,this.resetLoadingState(),this.state===bn&&this.doTickIdle())}startLoad(e,t){if(!this.levels)return this.startPosition=e,void(this.state=yn);const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=bn):this.state=Cn,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case bn:this.doTickIdle();break;case Cn:{const{levels:e,trackId:t}=this,i=null==e?void 0:e[t],n=null==i?void 0:i.details;if(n&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(n))break;this.state=Dn}break}case wn:this.checkRetryDate();break;case Dn:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:n,complete:r}=e,s=this.mainAnchor;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.state=En;const e={frag:t,part:i,payload:n.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(e),r&&super._handleFragmentLoadComplete(e)}else s&&s.cc!==e.frag.cc&&this.syncWithAnchor(s,e.frag)}else this.state=bn}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:r}=this,s=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!s.startFragPrefetch)||null==i||!i[r])return;const o=i[r],a=o.details;if(!a||this.waitForLive(o)||this.waitForCdnTuneIn(a))return this.state=Cn,void(this.startFragRequested=!1);const c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,z,p));const u=this.getFwdBufferInfo(c,p);if(null===u)return;if(!this.switchingTrack&&this._streamEnded(u,a))return t.trigger(l.BUFFER_EOS,{type:"audio"}),void(this.state=An);const h=u.len,d=t.maxBufferLength,_=a.fragments,g=_[0].start,m=this.getLoadPosition(),v=this.flushing?m:u.end;if(this.switchingTrack&&n){const e=m;a.PTSKnown&&e<g&&(u.end>g||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=g+.05)}if(h>=d&&!this.switchingTrack&&v<_[_.length-1].start)return;let y=this.getNextFragment(v,a);if(y&&this.isLoopLoading(y,v)&&(y=this.getNextFragmentLoopLoading(y,a,u,f,d)),!y)return void(this.bufferFlushed=!0);let b=(null==(e=this.mainFragLoading)?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&b&&V(y)&&!y.endList&&(!a.live||!this.loadingParts&&v<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(b)===Ft&&(this.mainFragLoading=b=null),b&&V(b))){if(y.start>b.end){const e=this.fragmentTracker.getFragAtPos(v,f);e&&e.end>b.end&&(b=e,this.mainFragLoading={frag:e,targetBufferTime:null})}if(y.start>b.end)return}this.loadFragment(y,o,v)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map((e=>new Je(e)))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==yn&&(this.setInterval(100),this.state=bn,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(l.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:n}=this,{details:r,id:s,groupId:o,track:a}=t;if(!n)return void this.warn(`Audio tracks reset while loading track ${s} "${a.name}" of "${o}"`);const c=this.mainDetails;if(!c||r.endCC>c.endCC||c.expired)return this.cachedTrackLoadedData=t,void(this.state!==yn&&(this.state=Cn));this.cachedTrackLoadedData=null,this.log(`Audio track ${s} "${a.name}" of "${o}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const u=n[s];let h=0;if(r.live||null!=(i=u.details)&&i.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;var d;if(u.details)h=this.alignPlaylists(r,u.details,null==(d=this.levelLastLoaded)?void 0:d.details);r.alignedSliding||(pn(r,c),r.alignedSliding||_n(r,c),h=r.fragmentStart)}u.details=r,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(c,h),this.hls.trigger(l.AUDIO_TRACK_UPDATED,{details:r,id:s,groupId:t.groupId}),this.state!==Cn||this.waitForCdnTuneIn(r)||(this.state=bn),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:r}=e,{config:s,trackId:o,levels:a}=this;if(!a)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const l=a[o];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const c=l.details;if(!c)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const u=s.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new as(this.hls,p,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[i.cc],f=null==(t=i.initSegment)?void 0:t.data;if(void 0!==d){const e=!1,t=n?n.index:-1,s=-1!==t,o=new Jt(i.level,i.sn,i.stats.chunkCount,r.byteLength,t,s);h.push(r,f,u,"",i,n,c.totalduration,e,o,d)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${c.startSN} ,${c.endSN}],track ${o}`);const{cache:e}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new Pn,complete:!1};e.push(new Uint8Array(r)),this.state!==yn&&(this.state=Dn)}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0: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===f&&V(t.frag)&&(this.mainFragLoading=t,this.state===bn&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type===p)if(this.fragContextChanged(i))this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if(V(i)){this.fragPrevious=i;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(l.AUDIO_TRACK_SWITCHED,S({},e)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}else this.audioOnly||i.type!==f||i.elementaryStreams.video||i.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)}onError(e,t){var i;if(t.fatal)this.state=xn;else switch(t.details){case a.FRAG_GAP:case a.FRAG_PARSING_ERROR:case a.FRAG_DECRYPT_ERROR:case a.FRAG_LOAD_ERROR:case a.FRAG_LOAD_TIMEOUT:case a.KEY_LOAD_ERROR:case a.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(p,t);break;case a.AUDIO_TRACK_LOAD_ERROR:case a.AUDIO_TRACK_LOAD_TIMEOUT:case a.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Cn||(null==(i=t.context)?void 0:i.type)!==h||(this.state=bn);break;case a.BUFFER_ADD_CODEC_ERROR:case a.BUFFER_APPEND_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case a.BUFFER_FULL_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case a.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==K&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==K){this.flushing=!1,this.bufferFlushed=!0,this.state===An&&(this.state=bn);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,p),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=this,{remuxResult:r,chunkMeta:s}=e,o=this.getCurrentContext(s);if(!o)return void this.resetWhenMissingContext(s);const{frag:a,part:c,level:u}=o,{details:h}=u,{audio:d,text:f,id3:p,initSegment:_}=r;if(!this.fragContextChanged(a)&&h){if(this.state=kn,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),null!=_&&_.tracks){const e=a.initSegment||a;if(this.unhandledEncryptionError(_,a))return;this._bufferInitSegment(u,_.tracks,e,s),n.trigger(l.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:_.tracks})}if(d){const{startPTS:e,endPTS:t,startDTS:i,endDTS:n}=d;c&&(c.elementaryStreams[z]={startPTS:e,endPTS:t,startDTS:i,endDTS:n}),a.setElementaryStreamInfo(z,e,t,i,n),this.bufferFragmentData(d,a,c,s)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=y({id:i,frag:a,details:h},p);n.trigger(l.FRAG_PARSING_METADATA,e)}if(f){const e=y({id:i,frag:a,details:h},f);n.trigger(l.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(a)}_bufferInitSegment(e,t,i,n){if(this.state!==kn)return;if(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio)return;const r=t.audio;r.id=p;const s=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${s}/${r.codec}]`),s&&1===s.split(",").length&&(r.levelCodec=s),this.hls.trigger(l.BUFFER_CODECS,t);const o=r.initSegment;if(null!=o&&o.byteLength){const e={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:o};this.hls.trigger(l.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);var r;if(this.switchingTrack||n===Pt||n===Mt)if(V(e))if(null!=(r=t.details)&&r.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=Dn;const i=this.mainDetails;i&&i.fragmentStart!==t.details.fragmentStart&&_n(t.details,i)}else super.loadFragment(e,t,i);else this._loadInitSegment(e,t);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:r,audioCodec:s,channels:o}=this.bufferedTrack;at({name:t,lang:i,assocLang:n,characteristics:r,audioCodec:s,channels:o},e,lt)||(ut(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(l.AUDIO_TRACK_SWITCHED,S({},e))}},audioTrackController:class extends ls{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(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.LEVEL_LOADING,this.onLevelLoading,this),e.off(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(l.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:n,details:r}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==n)return void this.warn(`Audio track with id:${i} and group:${n} not found in active group ${null==s?void 0:s.groupId}`);const o=s.details;s.details=t.details,this.log(`Audio track ${i} "${s.name}" lang:${s.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,n=this.groupIds;let r=this.currentTrack;if(!i||(null==n?void 0:n.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==n?void 0:n.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!r&&t){const i=ot(t,e,lt);if(i>-1)r=e[i];else{const e=ot(t,this.tracks);r=this.tracks[e]}}let n=this.findTrackId(r);-1===n&&r&&(n=this.findTrackId(null));const c={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(l.AUDIO_TRACKS_UPDATED,c);const u=this.trackId;if(-1!==n&&-1===u)this.setAudioTrack(n);else if(e.length&&-1===u){var s;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(s=this.groupIds)?void 0:s.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}}onError(e,t){!t.fatal&&t.context&&(t.context.type!==h||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const n=this.currentTrack;if(n&&at(e,n,lt))return n;const r=ot(e,this.tracksInGroup,lt);if(r>-1){const e=this.tracksInGroup[r];return this.setAudioTrack(r),e}if(n){let n=t.loadLevel;-1===n&&(n=t.firstAutoLevel);const r=function(e,t,i,n,r){const s=t[n],o=t.reduce(((e,t,i)=>{const n=t.uri;return(e[n]||(e[n]=[])).push(i),e}),{})[s.uri];o.length>1&&(n=Math.max.apply(Math,o));const a=s.videoRange,l=s.frameRate,c=s.codecSet.substring(0,4),u=ct(t,n,(t=>{if(t.videoRange!==a||t.frameRate!==l||t.codecSet.substring(0,4)!==c)return!1;const n=t.audioGroups,s=i.filter((e=>!n||-1!==n.indexOf(e.groupId)));return ot(e,s,r)>-1}));return u>-1?u:ct(t,n,(t=>{const n=t.audioGroups,s=i.filter((e=>!n||-1!==n.indexOf(e.groupId)));return ot(e,s,r)>-1}))}(e,t.levels,i,n,lt);if(-1===r)return null;t.nextLoadLevel=r}if(e.channels||e.audioCodec){const t=ot(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e],r=n.details&&!n.details.live;if(e===this.trackId&&n===i&&r)return;if(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger(l.AUDIO_TRACK_SWITCHING,S({},n)),r)return;const s=this.switchParams(n.url,null==i?void 0:i.details,n.details);this.loadPlaylist(s)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if((!this.selectDefaultTrack||n.default)&&(!e||at(e,n,lt)))return i}if(e){const{name:i,lang:n,assocLang:r,characteristics:s,audioCodec:o,channels:a}=e;for(let e=0;e<t.length;e++){if(at({name:i,lang:n,assocLang:r,characteristics:s,audioCodec:o,channels:a},t[e],lt))return e}for(let i=0;i<t.length;i++){const n=t[i];if(us(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const n=t[i];if(us(e.attrs,n.attrs,["LANGUAGE"]))return i}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&ut(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,r=this.getUrlWithDirectives(e.url,t),s=e.details,o=null==s?void 0:s.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${n}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""}${o&&s.live?" age "+o.toFixed(1)+(s.type?" "+s.type||0:""):""} ${r}`),this.hls.trigger(l.AUDIO_TRACK_LOADING,{url:r,id:i,groupId:n,deliveryDirectives:t||null,track:e})}},emeController:_o,cmcdController:class{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=e=>{try{this.apply(e,{ot:ys.MANIFEST,su:!this.initialized})}catch(e){this.hls.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{const{frag:t,part:i}=e,n=this.hls.levels[t.level],r=this.getObjectType(t),s={d:1e3*(i||t).duration,ot:r};r!==ys.VIDEO&&r!==ys.AUDIO&&r!=ys.MUXED||(s.br=n.bitrate/1e3,s.tb=this.getTopBandwidth(r)/1e3,s.bl=this.getBufferLength(r));const o=i?this.getNextPart(i):this.getNextFrag(t);null!=o&&o.url&&o.url!==t.url&&(s.nor=o.url),this.apply(e,s)}catch(e){this.hls.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHED,this.onMediaDetached,this),e.on(l.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHED,this.onMediaDetached,this),e.off(l.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,n;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(n=t.tracks.video)?void 0:n.buffer}createData(){var e;return{v:1,sf:bs.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){y(t,this.createData());const i=t.ot===ys.INIT||t.ot===ys.VIDEO||t.ot===ys.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce(((e,i)=>(n.includes(i)&&(e[i]=t[i]),e)),{}));const r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),lo(e.headers,t,r)):e.url=ho(e.url,t,r)}getNextFrag(e){var t;const i=null==(t=this.hls.levels[e.level])?void 0:t.details;if(i){const t=e.sn-i.startSN;return i.fragments[t+1]}}getNextPart(e){var t;const{index:i,fragment:n}=e,r=null==(t=this.hls.levels[n.level])||null==(t=t.details)?void 0:t.partList;if(r){const{sn:e}=n;for(let t=r.length-1;t>=0;t--){const n=r[t];if(n.index===i&&n.fragment.sn===e)return r[t+1]}}}getObjectType(e){const{type:t}=e;return"subtitle"===t?ys.TIMED_TEXT:"initSegment"===e.sn?ys.INIT:"audio"===t?ys.AUDIO:"main"===t?this.hls.audioTracks.length?ys.VIDEO:ys.MUXED:void 0}getTopBandwidth(e){let t,i=0;const n=this.hls;if(e===ys.AUDIO)t=n.audioTracks;else{const e=n.maxAutoLevel,i=e>-1?e+1:n.levels.length;t=n.levels.slice(0,i)}return t.forEach((e=>{e.bitrate>i&&(i=e.bitrate)})),i>0?i:NaN}getBufferLength(e){const t=this.media,i=e===ys.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;return 1e3*ti.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,n){t(e),this.loader.load(e,i,n)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,n){t(e),this.loader.load(e,i,n)}}}},contentSteeringController:class extends E{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(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce(((e,t)=>(-1===e.indexOf(t.pathwayId)&&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=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(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((t=>t!==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;null!==i&&(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((null==i?void 0:i.action)===kt&&i.flags===Dt){const e=this.levels;let n=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:i,pathwayId:n,type:s}=t.context;i&&e?r=this.getPathwayForGroupId(i,s,r):n&&(r=n)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!n&&e&&(n=this.pathways()),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==r),t.details!==a.BUFFER_APPEND_ERROR||t.fatal?i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${e?e.length:e} priorities: ${it(n)} penalized: ${it(this.penalizedPathways)}`):i.resolved=!0}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){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 null===this.levels?[]:this.levels.filter((t=>e===t.pathwayId))}updatePathwayPriority(e){let t;this._pathwayPriority=e;const i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach((e=>{n-i[e]>3e5&&delete i[e]}));for(let n=0;n<e.length;n++){const r=e[n];if(r in i)continue;if(r===this.pathwayId)return;const s=this.hls.nextLoadLevel,o=this.hls.levels[s];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,ln(t),this.hls.trigger(l.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[s];o&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==o.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==o.bitrate&&this.log(`Unstable Pathways change from bitrate ${o.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=s);break}}}getPathwayForGroupId(e,t,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i<n.length;i++)if(t===h&&n[i].hasAudioGroup(e)||t===d&&n[i].hasSubtitleGroup(e))return n[i].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},n={};e.forEach((e=>{const{ID:r,"BASE-ID":s,"URI-REPLACEMENT":o}=e;if(t.some((e=>e.pathwayId===r)))return;const a=this.getLevelsForPathway(s).map((e=>{const t=new ci(e.attrs);t["PATHWAY-ID"]=r;const s=t.AUDIO&&`${t.AUDIO}_clone_${r}`,a=t.SUBTITLES&&`${t.SUBTITLES}_clone_${r}`;s&&(i[t.AUDIO]=s,t.AUDIO=s),a&&(n[t.SUBTITLES]=a,t.SUBTITLES=a);const l=po(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",o),c=new Je({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)c.addGroupId("audio",`${e.audioGroups[t]}_clone_${r}`);if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)c.addGroupId("text",`${e.subtitleGroups[t]}_clone_${r}`);return c}));t.push(...a),fo(this.audioTracks,i,o,r),fo(this.subtitleTracks,n,o,r)}))}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;let n;this.loader&&this.loader.destroy(),this.loader=new i(t);try{n=new self.URL(e)}catch(t){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${e}`)}if("data:"!==n.protocol){const e=0|(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate);n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+e)}const r={responseType:"json",url:n.href},s=t.steeringManifestLoadPolicy.default,o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},c={onSuccess:(e,t,i,r)=>{this.log(`Loaded steering manifest: "${n}"`);const s=e.data;if(1!==(null==s?void 0:s.VERSION))return void this.log(`Steering VERSION ${s.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=s.TTL;const{"RELOAD-URI":o,"PATHWAY-CLONES":a,"PATHWAY-PRIORITY":c}=s;if(o)try{this.uri=new self.URL(o,n).href}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${o}`)}this.scheduleRefresh(this.uri||i.url),a&&this.clonePathways(a);const u={steeringManifest:s,url:n.toString()};this.hls.trigger(l.STEERING_MANIFEST_LOADED,u),c&&this.updatePathwayPriority(c)},onError:(e,t,i,n)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let r=1e3*this.timeToLoad;if(429!==e.code)this.scheduleRefresh(this.uri||t.url,r);else{const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(r=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`)}},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(r,a,c)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var t;const i=null==(t=this.hls)?void 0:t.media;!i||i.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)}),t)}},interstitialsController:class extends E{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 e=this.currentTime;if(void 0===e||this.playbackDisabled||!this.schedule)return;const t=e-this.timelinePos;if(Math.abs(t)<1/7056e5)return;const i=t<=-.01;this.timelinePos=e,this.bufferedPos=e;const n=this.playingItem;if(!n)return void this.checkBuffer();if(i){this.schedule.resetErrorsInRange(e,e-t)&&this.updateSchedule(!0)}if(this.checkBuffer(),i&&e<n.start||e>=n.end){var r;const t=this.findItemIndex(n);let s=this.schedule.findItemIndexAtTime(e);if(-1===s&&(s=t+(i?-1:1),this.log(`seeked ${i?"back ":""}to position not covered by schedule ${e} (resolving from ${t} to ${s})`)),!this.isInterstitial(n)&&null!=(r=this.media)&&r.paused&&(this.shouldPlay=!1),!i&&s>t){const e=this.schedule.findJumpRestrictedIndex(t+1,s);if(e>t)return void this.setSchedulePosition(e)}return void this.setSchedulePosition(s)}const s=this.playingAsset;if(!s){if(this.playingLastItem&&this.isInterstitial(n)){const t=n.event.assetList[0];t&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(e,t))}return}const o=s.timelineStart,a=s.duration||0;var l;(i&&e<o||e>=o+a)&&(null!=(l=n.event)&&l.appendInPlace&&(this.clearInterstitial(n.event,n),this.flushFrontBuffer(e)),this.setScheduleToAssetAtTime(e,s))},this.onTimeupdate=()=>{const e=this.currentTime;if(void 0===e||this.playbackDisabled)return;if(!(e>this.timelinePos))return;this.timelinePos=e,e>this.bufferedPos&&this.checkBuffer();const t=this.playingItem;if(!t||this.playingLastItem)return;if(e>=t.end){this.timelinePos=t.end;const e=this.findItemIndex(t);this.setSchedulePosition(e+1)}const i=this.playingAsset;if(!i)return;e>=i.timelineStart+(i.duration||0)&&this.setScheduleToAssetAtTime(e,i)},this.onScheduleUpdate=(e,t)=>{const i=this.schedule;if(!i)return;const n=this.playingItem,r=i.events||[],s=i.items||[],o=i.durations,a=e.map((e=>e.identifier)),c=!(!r.length&&!a.length);(c||t)&&this.log(`INTERSTITIALS_UPDATED (${r.length}): ${r}\nSchedule: ${s.map((e=>Fo(e)))} pos: ${this.timelinePos}`),a.length&&this.log(`Removed events ${a}`);let u=null,h=null;n&&(u=this.updateItem(n,this.timelinePos),this.itemsMatch(n,u)?this.playingItem=u:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const d=this.bufferingItem;if(d&&(h=this.updateItem(d,this.bufferedPos),this.itemsMatch(d,h)?this.bufferingItem=h:d.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(d.event,null))),e.forEach((e=>{e.assetList.forEach((e=>{this.clearAssetPlayer(e.identifier,null)}))})),this.playerQueue.forEach((e=>{if(e.interstitial.appendInPlace){const t=e.assetItem.timelineStart,i=e.timelineOffset-t;if(i)try{e.timelineOffset=t}catch(n){Math.abs(i)>To&&this.warn(`${n} ("${e.assetId}" ${e.timelineOffset}->${t})`)}}})),c||t){if(this.hls.trigger(l.INTERSTITIALS_UPDATED,{events:r.slice(0),schedule:s.slice(0),durations:o,removedIds:a}),this.isInterstitial(n)&&a.includes(n.event.identifier))return this.warn(`Interstitial "${n.event.identifier}" removed while playing`),void this.primaryFallback(n.event);n&&this.trimInPlace(u,n),d&&h!==u&&this.trimInPlace(h,d),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Bo(e),this.schedule=new Mo(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(l.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(l.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(l.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(l.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(l.BUFFER_APPENDED,this.onBufferAppended,this),e.on(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(l.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(l.MEDIA_ENDED,this.onMediaEnded,this),e.on(l.ERROR,this.onError,this),e.on(l.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(l.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(l.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(l.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(l.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(l.BUFFER_CODECS,this.onBufferCodecs,this),e.off(l.BUFFER_APPENDED,this.onBufferAppended,this),e.off(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(l.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(l.MEDIA_ENDED,this.onMediaEnded,this),e.off(l.ERROR,this.onError,this),e.off(l.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;null==(e=this.getBufferingPlayer())||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.getBufferingPlayer())||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){mn(e,"play",this.onPlay),mn(e,"pause",this.onPause),mn(e,"seeking",this.onSeeking),mn(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;gn(i,"seeking",this.onSeeking),gn(i,"timeupdate",this.onTimeupdate),gn(i,"play",this.onPlay),gn(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,null===i)this.checkStart();else if(!n){this.clearScheduleState();const e=this.findItemIndex(i);this.setSchedulePosition(e)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){const e=this.getBufferingPlayer();e&&(this.log(`Removing schedule state for detachedData and ${e}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,e.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=t=>t?e.getAssetPlayer(t.identifier):t,n=(t,n,s,o,a)=>{if(t){let l=t[n].start;const c=t.event;if(c){if("playout"===n||c.timelineOccupancy!==Ao.Point){const e=i(s);(null==e?void 0:e.interstitial)===c&&(l+=e.assetItem.startOffset+e[a])}}else{l+=("bufferedPos"===o?r():e[o])-t.start}return l}return 0},r=()=>{const t=e.bufferedPos;return t===Number.MAX_VALUE?s("primary"):Math.max(t,0)},s=t=>{var i,n;return null!=(i=e.primaryDetails)&&i.live?e.primaryDetails.edge:(null==(n=e.schedule)?void 0:n.durations[t])||0},o=(t,r)=>{var s,o;const a=e.effectivePlayingItem;if(null!=a&&null!=(s=a.event)&&s.restrictions.skip||!e.schedule)return;e.log(`seek to ${t} "${r}"`);const l=e.effectivePlayingItem,c=e.schedule.findItemIndexAtTime(t,r),u=null==(o=e.schedule.items)?void 0:o[c],h=e.getBufferingPlayer(),d=null==h?void 0:h.interstitial,f=null==d?void 0:d.appendInPlace,p=l&&e.itemsMatch(l,u);if(l&&(f||p)){const s=i(e.playingAsset),o=(null==s?void 0:s.media)||e.primaryMedia;if(o){const i="primary"===r?o.currentTime:n(l,r,e.playingAsset,"timelinePos","currentTime"),a=t-i,c=(f?i:o.currentTime)+a;if(c>=0&&(!s||f||c<=s.duration))return void(o.currentTime=c)}}if(u){let i=t;if("primary"!==r){const e=t-u[r].start;i=u.start+e}const n=!e.isInterstitial(u);if(e.isInterstitial(l)&&!l.event.appendInPlace||!n&&!u.event.appendInPlace){if(l){const s=e.findItemIndex(l);if(c>s){const t=e.schedule.findJumpRestrictedIndex(s+1,c);if(t>s)return void e.setSchedulePosition(t)}let o=0;if(n)e.timelinePos=i,e.checkBuffer();else{const e=u.event.assetList,i=t-(u[r]||u).start;for(let t=e.length;t--;){const n=e[t];if(n.duration&&i>=n.startOffset&&i<n.startOffset+n.duration){o=t;break}}}e.setSchedulePosition(c,o)}}else{const t=e.media||(f?null==h?void 0:h.media:null);t&&(t.currentTime=i)}}},a=()=>{const i=e.effectivePlayingItem;if(e.isInterstitial(i))return i;const n=t();return e.isInterstitial(n)?n:null},l={get bufferedEnd(){const i=t(),r=e.bufferingItem;var s;return r&&r===i&&(n(r,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-r.playout.start||(null==(s=e.bufferingAsset)?void 0:s.startOffset))||0},get currentTime(){const t=a(),i=e.effectivePlayingItem;return i&&i===t?n(i,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-i.playout.start:0},set currentTime(t){const i=a(),n=e.effectivePlayingItem;n&&n===i&&o(t+n.playout.start,"playout")},get duration(){const e=a();return e?e.playout.end-e.playout.start:0},get assetPlayers(){var t;const i=null==(t=a())?void 0:t.event.assetList;return i?i.map((t=>e.getAssetPlayer(t.identifier))):[]},get playingIndex(){var t;const i=null==(t=a())?void 0:t.event;return i&&e.effectivePlayingAsset?i.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return a()}};return this.manager={get events(){var t;return(null==(t=e.schedule)||null==(t=t.events)?void 0:t.slice(0))||[]},get schedule(){var t;return(null==(t=e.schedule)||null==(t=t.items)?void 0:t.slice(0))||[]},get interstitialPlayer(){return a()?l:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const i=t();return e.findItemIndex(i)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return r()},get currentTime(){const t=e.timelinePos;return t>0?t:0},set currentTime(e){o(e,"primary")},get duration(){return s("primary")},get seekableStart(){var t;return(null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(e){o(e,"integrated")},get duration(){return s("integrated")},get seekableStart(){var t;return((t,i)=>{var n;if(0!==t&&"primary"!==i&&null!=(n=e.schedule)&&n.length){var r;const n=e.schedule.findItemIndexAtTime(t),s=null==(r=e.schedule.items)?void 0:r[n];if(s)return t+(s[i].start-s.start)}return t})((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"integrated")}},skip:()=>{const t=e.effectivePlayingItem,i=null==t?void 0:t.event;if(i&&!i.restrictions.skip){const n=e.findItemIndex(t);if(i.appendInPlace){const e=t.playout.start+t.event.duration;o(e+.001,"playout")}else e.advanceAfterAssetEnded(i,n,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=null==(e=this.schedule)?void 0:e.items;return!!(this.playbackStarted&&t&&i)&&this.findItemIndex(t)===i.length-1}get playbackStarted(){return null!==this.effectivePlayingItem}get currentTime(){var e,t;if(null===this.mediaSelection)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let r=this.media;!r&&null!=(e=this.bufferingItem)&&null!=(e=e.event)&&e.appendInPlace&&(r=this.primaryMedia);const s=null==(t=r)?void 0:t.currentTime;return void 0!==s&&n(s)?s:void 0}get primaryMedia(){var e;return this.media||(null==(e=this.detachedData)?void 0:e.media)||null}isInterstitial(e){return!(null==e||!e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,n=e.media;if(i&&n===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&n)return void(this.detachedData={media:n});const i=e.transferMedia();this.log(`transfer MediaSource from ${e} ${it(i)}`),this.detachedData=i}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var i,n;if(e.media===t)return;let r=null;const s=this.hls,o=e!==s,a=o&&e.interstitial.appendInPlace,l=null==(i=this.detachedData)?void 0:i.mediaSource;let c;if(s.media)a&&(r=s.transferMedia(),this.detachedData=r),c="Primary";else if(l){const e=this.getBufferingPlayer();e?(r=e.transferMedia(),c=`${e}`):c="detached MediaSource"}else c="detached media";if(!r)if(l)r=this.detachedData,this.log(`using detachedData: MediaSource ${it(r)}`);else if(!this.detachedData||s.media===t){const e=this.playerQueue;e.length>1&&e.forEach((e=>{if(o&&e.interstitial.appendInPlace!==a){const t=e.interstitial;this.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${t}`)}})),this.hls.detachMedia(),this.detachedData={media:t}}const u=r&&"mediaSource"in r&&"closed"!==(null==(n=r.mediaSource)?void 0:n.readyState),h=u&&r?r:t;this.log(`${u?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${c} (media.currentTime: ${t.currentTime})`);const d=this.schedule;if(h===r&&d){const t=o&&e.assetId===d.assetIdAtEnd;h.overrides={duration:d.duration,endOfStream:!o||t,cueRemoval:!o}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=null==e?void 0:e.events;if(!t||this.playbackDisabled||!this.media)return;-1===this.bufferedPos&&(this.bufferedPos=0);const i=this.timelinePos,n=this.effectivePlayingItem;if(-1===i){const i=this.hls.startPosition;if(this.log(Uo("checkStart",i)),this.timelinePos=i,t.length&&t[0].cue.pre){const i=e.findEventIndex(t[0].identifier);this.setSchedulePosition(i)}else if(i>=0||!this.primaryLive){const t=this.timelinePos=i>0?i:0,n=e.findItemIndexAtTime(t);this.setSchedulePosition(n)}}else if(n&&!this.playingItem){const t=e.findItemIndex(n);this.setSchedulePosition(t)}}advanceAssetBuffering(e,t){const i=e.event,n=i.findAssetIndex(t),r=Io(i,n);if(i.isAssetPastPlayoutLimit(r)){if(this.schedule){var s;const t=null==(s=this.schedule.items)?void 0:s[this.findItemIndex(e)+1];t&&this.bufferedToItem(t)}}else this.bufferedToEvent(e,r)}advanceAfterAssetEnded(e,t,i){const n=Io(e,i);if(e.isAssetPastPlayoutLimit(n)){if(this.schedule){const i=this.schedule.items;if(i){const n=t+1;if(n>=i.length)return void this.setSchedulePosition(-1);const r=e.resumeTime;this.timelinePos<r&&(this.log(Uo("advanceAfterAssetEnded",r)),this.timelinePos=r,e.appendInPlace&&this.advanceInPlace(r),this.checkBuffer(this.bufferedPos<r)),this.setSchedulePosition(n)}}}else{if(e.appendInPlace){const t=e.assetList[n];t&&this.advanceInPlace(t.timelineStart)}this.setSchedulePosition(t,n)}}setScheduleToAssetAtTime(e,t){const i=this.schedule;if(!i)return;const n=t.parentIdentifier,r=i.getEvent(n);if(r){const t=i.findEventIndex(n),s=i.findAssetIndex(r,e);this.advanceAfterAssetEnded(r,t,s-1)}}setSchedulePosition(e,t){var i;const n=null==(i=this.schedule)?void 0:i.items;if(!n||this.playbackDisabled)return;const r=e>=0?n[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${r?Fo(r):r}) pos: ${this.timelinePos}`);const s=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(s)){const i=s.event,u=this.playingAsset,h=null==u?void 0:u.identifier,d=h?this.getAssetPlayer(h):null;if(d&&h&&(!this.eventItemsMatch(s,r)||void 0!==t&&h!==i.assetList[t].identifier)){var a;const t=i.findAssetIndex(u);if(this.log(`INTERSTITIAL_ASSET_ENDED ${t+1}/${i.assetList.length} ${Po(u)}`),this.endedAsset=u,this.playingAsset=null,this.hls.trigger(l.INTERSTITIAL_ASSET_ENDED,{asset:u,assetListIndex:t,event:i,schedule:n.slice(0),scheduleIndex:e,player:d}),s!==this.playingItem)return void(this.itemsMatch(s,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(i,this.findItemIndex(this.playingItem),t));this.retreiveMediaSource(h,r),!d.media||null!=(a=this.detachedData)&&a.mediaSource||d.detachMedia()}if(!this.eventItemsMatch(s,r)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${i} ${Fo(s)}`),i.hasPlayed=!0,this.hls.trigger(l.INTERSTITIAL_ENDED,{event:i,schedule:n.slice(0),scheduleIndex:e}),i.cue.once)){var c;this.updateSchedule();const e=null==(c=this.schedule)?void 0:c.items;if(r&&e){const i=this.findItemIndex(r);this.advanceSchedule(i,e,t,s,o)}return}}this.advanceSchedule(e,n,t,s,o)}advanceSchedule(e,t,i,n,r){const s=this.schedule;if(!s)return;const o=t[e]||null,a=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach((t=>{const i=t.interstitial,n=s.findEventIndex(i.identifier);(n<e||n>e+1)&&this.clearInterstitial(i,o)})),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const r=o.event;if(void 0===i){const t=Io(r,(i=s.findAssetIndex(r,this.timelinePos))-1);if(r.isAssetPastPlayoutLimit(t)||r.appendInPlace&&this.timelinePos===o.end)return void this.advanceAfterAssetEnded(r,e,i);i=t}const c=this.waitingItem;this.assetsBuffered(o,a)||this.setBufferingItem(o);let u=this.preloadAssets(r,i);if(this.eventItemsMatch(o,c||n)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Fo(o)} ${r.appendInPlace?"append in place":""}`),this.hls.trigger(l.INTERSTITIAL_STARTED,{event:r,schedule:t.slice(0),scheduleIndex:e})),!r.assetListLoaded)return void this.log(`Waiting for ASSET-LIST to complete loading ${r}`);if(r.assetListLoader&&(r.assetListLoader.destroy(),r.assetListLoader=void 0),!a)return void this.log(`Waiting for attachMedia to start Interstitial ${r}`);this.waitingItem=this.endedItem=null,this.playingItem=o;const h=r.assetList[i];if(!h)return void this.advanceAfterAssetEnded(r,e,i||0);if(u||(u=this.getAssetPlayer(h.identifier)),null===u||u.destroyed){const e=r.assetList.length;this.warn(`asset ${i+1}/${e} player destroyed ${r}`),u=this.createAssetPlayer(r,h,i),u.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&r.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(u,i,t,e,a),this.shouldPlay&&No(u.media)}else o?(this.resumePrimary(o,e,n),this.shouldPlay&&No(this.hls.media)):r&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.event.appendInPlace||this.attachPrimary(s.durations.primary,null))}get playbackDisabled(){return!1===this.hls.config.enableInterstitialPlayback}get primaryDetails(){var e;return null==(e=this.mediaSelection)?void 0:e.main.details}get primaryLive(){var e;return!(null==(e=this.primaryDetails)||!e.live)}resumePrimary(e,t,i){var n,r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Fo(e)}`),null==(n=this.detachedData)||!n.mediaSource){let i=this.timelinePos;(i<e.start||i>=e.end)&&(i=this.getPrimaryResumption(e,t),this.log(Uo("resumePrimary",i)),this.timelinePos=i),this.attachPrimary(i,e)}if(!i)return;const s=null==(r=this.schedule)?void 0:r.items;s&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Fo(e)}`),this.hls.trigger(l.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const e=this.primaryDetails;if(0===t)return this.hls.startPosition;if(e&&(i<e.fragmentStart||i>e.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);if(null!=t&&t.hls)return t.hls.bufferedToEnd;return ti.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(Uo("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs(((null==(i=n.mainForwardBufferInfo)?void 0:i.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),null==(e=this.schedule)||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(l.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(l.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(-1===t.level||!this.schedule)return;const i=this.hls.levels[t.level];if(!i.details)return;const n=S(S({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n)return void(this.altSelection=S(S({},this.altSelection),{},{audio:i}));const r=S(S({},n),{},{audio:i});this.mediaSelection=r}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n)return void(this.altSelection=S(S({},this.altSelection),{},{subtitles:i}));const r=S(S({},n),{},{subtitles:i});this.mediaSelection=r}onAudioTrackSwitching(e,t){const i=st(t);this.playerQueue.forEach((({hls:e})=>e&&(e.setAudioOption(t)||e.setAudioOption(i))))}onSubtitleTrackSwitch(e,t){const i=st(t);this.playerQueue.forEach((({hls:e})=>e&&(e.setSubtitleOption(t)||-1!==t.id&&e.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 e=this.timelinePos;this.bufferedPos=e,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let e=0;e<t.length;e++){const n=t[e];if(n.cue.post){var i;const e=this.schedule.findEventIndex(n.identifier),t=null==(i=this.schedule.items)?void 0:i[e];this.isInterstitial(t)&&this.eventItemsMatch(t,this.bufferingItem)&&this.bufferedToItem(t,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const e=this.findItemIndex(t);this.setSchedulePosition(e+1)}else this.shouldPlay=!1}updateItem(e,t){var i;const n=null==(i=this.schedule)?void 0:i.items;if(e&&n){return n[this.findItemIndex(e,t)]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach(((t,i)=>{e.event.isAssetPastPlayoutLimit(i)&&this.clearAssetPlayer(t.identifier,null)}));const i=e.end+.25,n=ti.bufferInfo(this.primaryMedia,i,0);if(n.end>i||(n.nextStart||0)>i){this.log(`trim buffered interstitial ${Fo(e)} (was ${Fo(t)})`);const n=!0;this.attachPrimary(i,null,n),this.flushFrontBuffer(i)}}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===(null==(i=t.event)?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&(null==(t=this.schedule)||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=null==(t=this.schedule)?void 0:t.items;if(!i)return;const n=ti.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=n.len<1),this.updateBufferedPos(n.end,i,e)}updateBufferedPos(e,t,i){const n=this.schedule,r=this.bufferingItem;if(this.bufferedPos>e||!n)return;if(1===t.length&&this.itemsMatch(t[0],r))return void(this.bufferedPos=e);const s=this.playingItem,o=this.findItemIndex(s);let a=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var l;const i=this.findItemIndex(r),n=Math.min(i+1,t.length-1),s=t[n];if((-1===a&&r&&e>=r.end||null!=(l=s.event)&&l.appendInPlace&&e+.01>=s.start)&&(a=n),this.isInterstitial(r)){const e=r.event;if(n-o>1&&!1===e.appendInPlace)return;if(0===e.assetList.length&&e.assetListLoader)return}if(this.bufferedPos=e,a>i&&a>o)this.bufferedToItem(s);else{const t=this.primaryDetails;this.primaryLive&&t&&e>t.edge-t.targetduration&&s.start<t.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(s)&&this.preloadAssets(s.event,0)}}else i&&s&&!this.itemsMatch(s,r)&&(a===o?this.bufferedToItem(s):a===o+1&&this.bufferedToItem(t[a]))}assetsBuffered(e,t){return 0!==e.event.assetList.length&&!e.event.assetList.some((e=>{const i=this.getAssetPlayer(e.identifier);return!(null!=i&&i.bufferedInPlaceToEnd(t))}))}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:n,events:r}=i;if(!n||!r)return t;const s=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const a=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Fo(e)}`+(t?` (${a.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(s){const t=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach(((e,i)=>{const n=this.getAssetPlayer(e.identifier);n&&(i===t&&n.loadSource(),n.resumeBuffering())}))}else this.hls.resumeBuffering(),this.playerQueue.forEach((e=>e.pauseBuffering()));this.hls.trigger(l.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled)if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==i){this.bufferingAsset=null;const t=this.detachedData;if(t)if(t.mediaSource){const t=!0;this.attachPrimary(e.start,e,t)}else this.preloadPrimary(e);else this.preloadPrimary(e)}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,n=0===i.assetList.length&&!i.assetListLoader,r=i.cue.once;if(n||!r){const e=this.preloadAssets(i,t);if(null!=e&&e.interstitial.appendInPlace){const t=this.primaryMedia;t&&this.bufferAssetPlayer(e,t)}}}preloadAssets(e,t){const i=e.assetUrl,n=e.assetList.length,r=0===n&&!e.assetListLoader,s=e.cue.once;if(r){const r=e.timelineStart;if(e.appendInPlace){var o;const t=this.playingItem;this.isInterstitial(t)||(null==t||null==(o=t.nextEvent)?void 0:o.identifier)!==e.identifier||this.flushFrontBuffer(r+.25)}let s,a=0;if(!this.playingItem&&this.primaryLive&&(a=this.hls.startPosition,-1===a&&(a=this.hls.liveSyncPosition||0)),a&&!e.cue.pre&&!e.cue.post){const e=a-r;e>0&&(s=Math.round(1e3*e)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${s?` live-start: ${a} start-offset: ${s}`:""}`),i)return this.createAsset(e,0,0,r,e.duration,i);const l=this.assetListLoader.loadAssetList(e,s);l&&(e.assetListLoader=l)}else if(!s&&n){for(let i=t;i<n;i++){const t=e.assetList[i],n=this.getAssetPlayerQueueIndex(t.identifier);-1!==n&&!this.playerQueue[n].destroyed||t.error||this.createAssetPlayer(e,t,i)}const i=e.assetList[t];if(i){const e=this.getAssetPlayer(i.identifier);return e&&e.loadSource(),e}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`);Object.keys(t).forEach((t=>{this.hls.trigger(l.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})}))}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t)for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i];return null}createAsset(e,t,i,n,r,s){const o={parentIdentifier:e.identifier,identifier:xo(e,s,t),duration:r,startOffset:i,timelineStart:n,uri:s};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,i){const n=this.hls,r=n.userConfig;let s=r.videoPreference;const c=n.loadLevelObj||n.levels[n.currentLevel];(s||c)&&(s=y({},s),c.videoCodec&&(s.videoCodec=c.videoCodec),c.videoRange&&(s.allowedVideoRanges=[c.videoRange]));const u=n.audioTracks[n.audioTrack],h=n.subtitleTracks[n.subtitleTrack];let d=0;if(this.primaryLive||e.appendInPlace){const e=this.timelinePos-t.timelineStart;if(e>1){const i=t.duration;i&&e<i&&(d=e)}}const f=t.identifier,p=S(S({},r),{},{maxMaxBufferLength:Math.min(180,n.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:d,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:u||r.audioPreference,subtitlePreference:h||r.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(p.timelineOffset=t.timelineStart));const _=p.cmcd;null!=_&&_.sessionId&&_.contentId&&(p.cmcd=y({},_,{contentId:ko(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const g=new Oo(this.HlsPlayerClass,p,e,t);this.playerQueue.push(g),e.assetList[i]=t;let m=!0;const v=n=>{if(n.live){var r;const t=new Error(`Interstitials MUST be VOD assets ${e}`),n={fatal:!0,type:o.OTHER_ERROR,details:a.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},s=(null==(r=this.schedule)?void 0:r.findEventIndex(e.identifier))||-1;return void this.handleAssetItemError(n,e,s,i,t.message)}const s=n.edge-n.fragmentStart,l=t.duration;(m||null===l||s>l)&&(m=!1,this.log(`Interstitial asset "${f}" duration change ${l} > ${s}`),t.duration=s,this.updateSchedule())};g.on(l.LEVEL_UPDATED,((e,{details:t})=>v(t))),g.on(l.LEVEL_PTS_UPDATED,((e,{details:t})=>v(t))),g.on(l.EVENT_CUE_ENTER,(()=>this.onInterstitialCueEnter()));const b=(e,t)=>{const i=this.getAssetPlayer(f);if(i&&t.tracks){i.off(l.BUFFER_CODECS,b),i.tracks=t.tracks;const e=this.primaryMedia;this.bufferingAsset===i.assetItem&&e&&!i.media&&this.bufferAssetPlayer(i,e)}};g.on(l.BUFFER_CODECS,b);g.on(l.BUFFERED_TO_END,(()=>{var i;const n=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${n}`),!n||!this.schedule)return;const r=this.schedule.findEventIndex(e.identifier),s=null==(i=this.schedule.items)?void 0:i[r];this.isInterstitial(s)&&this.advanceAssetBuffering(s,t)}));const E=t=>()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;this.shouldPlay=!0;const i=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,i,t)};return g.once(l.MEDIA_ENDED,E(i)),g.once(l.PLAYOUT_LIMIT_REACHED,E(1/0)),g.on(l.ERROR,((t,n)=>{if(!this.schedule)return;const r=this.getAssetPlayer(f);if(n.details===a.BUFFER_STALLED_ERROR)return null!=r&&r.appendInPlace?void this.handleInPlaceStall(e):(this.onTimeupdate(),void this.checkBuffer(!0));this.handleAssetItemError(n,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${n.error} ${e}`)})),g.on(l.DESTROYING,(()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;const t=new Error(`Asset player destroyed unexpectedly ${f}`),n={fatal:!0,type:o.OTHER_ERROR,details:a.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};this.handleAssetItemError(n,e,this.schedule.findEventIndex(e.identifier),i,t.message)})),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Po(t)}`),this.hls.trigger(l.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:g}),g}clearInterstitial(e,t){e.assetList.forEach((e=>{this.clearAssetPlayer(e.identifier,t)})),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(-1!==t){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(-1!==i){const e=this.playerQueue[i];this.log(`clear ${e} toSegment: ${t?Fo(t):t}`),this.transferMediaFromPlayer(e,t),this.playerQueue.splice(i,1),e.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,r){const{interstitial:s,assetItem:o,assetId:a}=e,c=s.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=o,u&&u.identifier===a||(u&&(this.clearAssetPlayer(u.identifier,i[n]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${c} ${Po(o)}`),this.hls.trigger(l.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:s,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,t){var i,n;if(!this.schedule)return;const{interstitial:r,assetItem:s}=e,l=this.schedule.findEventIndex(r.identifier),c=null==(i=this.schedule.items)?void 0:i[l];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=s;const u=this.getBufferingPlayer();if(u===e)return;const h=r.appendInPlace;if(h&&!1===(null==u?void 0:u.interstitial.appendInPlace))return;const d=(null==u?void 0:u.tracks)||(null==(n=this.detachedData)?void 0:n.tracks)||this.requiredTracks;if(h&&s!==this.playingAsset){if(!e.tracks)return void this.log(`Waiting for track info before buffering ${e}`);if(d&&!L(d,e.tracks)){const t=new Error(`Asset ${Po(s)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),i={fatal:!0,type:o.OTHER_ERROR,details:a.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},n=r.findAssetIndex(s);return void this.handleAssetItemError(i,r,l,n,t.message)}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const n=i.currentTime,r=t.findAssetIndex(e,n),s=e.assetList[r];if(s){const o=this.getAssetPlayer(s.identifier);if(o){const a=o.currentTime||n-s.timelineStart,l=o.duration-a;if(this.warn(`Stalled at ${a} of ${a+l} in ${o} ${e} (media.currentTime: ${n})`),a&&(l/i.playbackRate<.5||o.bufferedInPlaceToEnd(i))&&o.hls){const i=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,i,r)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,i,n,r){if(e.details===a.BUFFER_STALLED_ERROR)return;const s=t.assetList[n]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${s?Po(s):s} ${e.error}`),!this.schedule)return;const o=(null==s?void 0:s.identifier)||"",c=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[c]||null,h=this.schedule.items,d=y({},e,{fatal:!1,errorAction:It(!0),asset:s,assetListIndex:n,event:t,schedule:h,scheduleIndex:i,player:u});if(this.hls.trigger(l.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const f=this.playingAsset,p=this.bufferingAsset,_=new Error(r);if(s&&(this.clearAssetPlayer(o,null),s.error=_),t.assetList.some((e=>!e.error)))for(let e=n;e<t.assetList.length;e++)this.resetAssetPlayer(t.assetList[e].identifier);else t.error=_;this.updateSchedule(!0),t.error?this.primaryFallback(t):f&&f.identifier===o?this.advanceAfterAssetEnded(t,i,n):p&&p.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,p)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${Fo(i)} error: ${e.error}`);let n=this.timelinePos;-1===n&&(n=this.hls.startPosition);const r=this.updateItem(i,n);if(this.itemsMatch(i,r)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t)),!this.schedule)return;const s=this.schedule.findItemIndexAtTime(n);this.setSchedulePosition(s)}else this.checkStart()}onAssetListLoaded(e,t){var i,n;const r=t.event,s=r.identifier,o=t.assetListResponse.ASSETS;if(null==(i=this.schedule)||!i.hasEvent(s))return;const a=r.timelineStart,l=r.duration;let c=0;o.forEach(((e,t)=>{const i=parseFloat(e.DURATION);this.createAsset(r,t,c,a+c,i,e.URI),c+=i})),r.duration=c,this.log(`Loaded asset-list with duration: ${c} (was: ${l}) ${r}`);const u=this.waitingItem,h=(null==u?void 0:u.event.identifier)===s;this.updateSchedule();const d=null==(n=this.bufferingItem)?void 0:n.event;if(h){var f;const e=this.schedule.findEventIndex(s),t=null==(f=this.schedule.items)?void 0:f[e];if(t){if(!this.playingItem&&this.timelinePos>t.end){if(this.schedule.findItemIndexAtTime(this.timelinePos)!==e)return r.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${r}`),this.updateSchedule(!0),void this.primaryFallback(r)}this.setBufferingItem(t)}this.setSchedulePosition(e)}else if((null==d?void 0:d.identifier)===s){const e=r.assetList[0];if(e){const t=this.getAssetPlayer(e.identifier);if(d.appendInPlace){const e=this.primaryMedia;t&&e&&this.bufferAssetPlayer(t,e)}else t&&t.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case a.ASSET_LIST_PARSING_ERROR:case a.ASSET_LIST_LOAD_ERROR:case a.ASSET_LIST_LOAD_TIMEOUT:{const e=t.interstitial;e&&(this.updateSchedule(!0),this.primaryFallback(e));break}case a.BUFFER_STALLED_ERROR:{const e=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(e)&&e.event.appendInPlace)return void this.handleInPlaceStall(e.event);this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}});function Ga(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(Ga):Object.keys(e).reduce(((t,i)=>(t[i]=Ga(e[i]),t)),{}):e}function za(e,t){const i=e.loader;if(i!==Ba&&i!==ja)t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=Ba,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}}class Ka extends Qt{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var e;null!=(e=this.media)&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{var e;this.hls&&(this.ended=(null==(e=this.media)?void 0:e.currentTime)||1,this.hls.trigger(l.MEDIA_ENDED,{stalled:!1}))},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.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(100),this.mediaSource=t.mediaSource;const i=this.media=t.media;gn(i,"playing",this.onMediaPlaying),gn(i,"waiting",this.onMediaWaiting),gn(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(mn(i,"playing",this.onMediaPlaying),mn(i,"waiting",this.onMediaWaiting),mn(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(null==(e=this.media)||!e.readyState||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const r=null==(i=this.hls)?void 0:i.config;if(!r)return;const s=this.media;if(!s)return;const{seeking:o}=s,a=this.seeking&&!o,c=!this.seeking&&o,u=s.paused&&!o||s.ended||0===s.playbackRate;if(this.seeking=o,e!==t)return t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),void(0===this.waiting&&this.stallResolved(e));if(c||a)return void(a&&this.stallResolved(e));if(u)return this.nudgeRetry=0,this.stallResolved(e),void(!this.ended&&s.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(l.MEDIA_ENDED,{stalled:!1})));if(!ti.getBuffered(s).length)return void(this.nudgeRetry=0);const h=ti.bufferInfo(s,e,0),d=h.nextStart||0,f=this.fragmentTracker;if(o&&f&&this.hls){const t=Wa(this.hls.inFlightFragments,e),i=h.len>2,n=!d||t||d-e>2&&!f.getPartialFragment(e);if(i||n)return;this.moved=!1}const p=null==(n=this.hls)?void 0:n.latestLevelDetails;if(!this.moved&&null!==this.stalled&&f){if(!(h.len>0)&&!d)return;const t=Math.max(d,h.start||0)-e,i=!(null==p||!p.live)?2*p.targetduration:2,n=Va(e,f);if(t>0&&(t<=i||n))return void(s.paused||this._trySkipBufferHole(n))}const _=r.detectStallWithCurrentTimeMs,g=self.performance.now(),m=this.waiting;let v=this.stalled;if(null===v){if(!(m>0&&g-m<_))return void(this.stalled=g);v=this.stalled=m}const y=g-v;if(!o&&(y>=_||m)&&this.hls){var b;if("ended"===(null==(b=this.mediaSource)?void 0:b.readyState)&&(null==p||!p.live)&&Math.abs(e-((null==p?void 0:p.edge)||0))<1){if(this.ended)return;return this.ended=e||1,void this.hls.trigger(l.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(h),!this.media||!this.hls)return}const S=ti.bufferInfo(s,e,r.maxBufferHole);this._tryFixBufferStall(S,y,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(l.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&null!=(i=this.buffered.audio)&&i.length&&n&&n.length>1&&e>n.end(0)){const i=ti.bufferedInfo(ti.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&t>=i.start){const i=ti.timeRangesToArray(n),r=ti.bufferedInfo(i,t,0).bufferedIndex;if(r>-1&&r<i.length-1){const t=ti.bufferedInfo(i,e,0).bufferedIndex,n=i[r].end,s=i[r+1].start;if((-1===t||t>r)&&s-n<1&&e-n<2){const i=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${n} -> ${s} buffered index: ${t}`);this.warn(i.message),this.media.currentTime+=1e-6;let r=Va(e,this.fragmentTracker);r&&"fragment"in r?r=r.fragment:r||(r=void 0);const c=ti.bufferInfo(this.media,e,0);this.hls.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,frag:r,buffer:c.len,bufferInfo:c})}}}}}_tryFixBufferStall(e,t,i){var n,r;const{fragmentTracker:s,media:o}=this,a=null==(n=this.hls)?void 0:n.config;if(!o||!s||!a)return;const l=null==(r=this.hls)?void 0:r.latestLevelDetails,c=Va(i,s);if(c||null!=l&&l.live&&i<l.fragmentStart){if(this._trySkipBufferHole(c)||!this.media)return}const u=e.buffered,h=this.adjacentTraversal(e,i);(u&&u.length>1&&e.len>a.maxBufferHole||e.nextStart&&(e.nextStart-i<a.maxBufferHole||h))&&(t>1e3*a.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,n=e.nextStart;if(i&&n){const e=i.getFragAtPos(t,f),r=i.getFragAtPos(n,f);if(e&&r)return r.sn-e.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:r}=this;if(!n&&null!==r&&i&&t){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${it(e)})`);this.warn(n.message),t.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:n}=this,r=null==(t=this.hls)?void 0:t.config;if(!n||!i||!r)return 0;const s=n.currentTime,c=ti.bufferInfo(n,s,0),u=s<c.start?c.start:c.nextStart;if(u&&this.hls){const t=c.len<=r.maxBufferHole,d=c.len>0&&c.len<1&&n.readyState<3,p=u-s;if(p>0&&(t||d)){if(p>r.maxBufferHole){let t=!1;if(0===s){const e=i.getAppendedFrag(0,f);e&&u<e.end&&(t=!0)}if(!t&&e){var h;if(null==(h=this.hls.loadLevelObj)||!h.details)return 0;if(Wa(this.hls.inFlightFragments,u))return 0;let t=!1,n=e.end;for(;n<u;){const e=Va(n,i);if(!e){t=!0;break}n+=e.duration}if(t)return 0}}const t=Math.max(u+.05,s+.1);if(this.warn(`skipping hole, adjusting currentTime from ${s} to ${t}`),this.moved=!0,n.currentTime=t,null==e||!e.gap){const i=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${t}`),n={type:o.MEDIA_ERROR,details:a.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,buffer:c.len,bufferInfo:c};e&&("fragment"in e?n.part=e:n.frag=e),this.hls.trigger(l.ERROR,n)}return t}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:n}=this,r=null==t?void 0:t.config;if(!i||!r)return 0;const s=i.currentTime;if(this.nudgeRetry++,n<r.nudgeMaxRetry){const c=s+(n+1)*r.nudgeOffset,u=new Error(`Nudging 'currentTime' from ${s} to ${c}`);this.warn(u.message),i.currentTime=c,t.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.BUFFER_NUDGE_ON_STALL,error:u,fatal:!1,buffer:e.len,bufferInfo:e})}else{const i=new Error(`Playhead still not moving while enough data buffered @${s} after ${r.nudgeMaxRetry} nudges`);this.error(i.message),t.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.BUFFER_STALLED_ERROR,error:i,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Wa(e,t){const i=qa(e.main);if(i&&i.start<=t)return i;const n=qa(e.audio);return n&&n.start<=t?n:null}function qa(e){if(!e)return null;switch(e.state){case bn:case yn:case An:case xn:return null}return e.frag}function Va(e,t){return t.getAppendedFrag(e,f)||t.getPartialFragment(e)}function Ya(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function Za(e,t,i,n,r){let s=new e(t,i,"");try{s.value=n,r&&(s.type=r)}catch(o){s=new e(t,i,it(r?S({type:r},n):n))}return s}const Xa=(()=>{const e=Ya();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Qa{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(l.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(l.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(l.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,!1===(null==(i=t.overrides)?void 0:i.cueRemoval)&&(this.removeCues=!1)}onMediaAttached(){var e;const t=null==(e=this.hls)?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null;!!t.transferMedia||(this.id3Track&&(this.removeCues&&Eo(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("metadata"===i.kind&&"id3"===i.label)return bo(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:n}=this.hls.config;if(!i&&!n)return;const{samples:r}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const s=Ya();if(s)for(let e=0;e<r.length;e++){const t=r[e].type;if(t===ar.emsg&&!i||!n)continue;const o=nr(r[e].data),a=r[e].pts;let l=a+r[e].duration;l>Xa&&(l=Xa);l-a<=0&&(l=a+.25);for(let e=0;e<o.length;e++){const i=o[e];if(!rr(i)){this.updateId3CueEnds(a,t);const e=Za(s,a,l,i,t);e&&this.id3Track.addCue(e)}}}}updateId3CueEnds(e,t){var i;const n=null==(i=this.id3Track)?void 0:i.cues;if(n)for(let i=n.length;i--;){const r=n[i];r.type===t&&r.startTime<e&&r.endTime===Xa&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:n}){const{id3Track:r,hls:s}=this;if(!s)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:a}}=s;if(r&&(o||a)){let e;e="audio"===n?e=>e.type===ar.audioId3&&a:"video"===n?e=>e.type===ar.emsg&&o:e=>e.type===ar.audioId3&&a||e.type===ar.emsg&&o,wo(r,t,i,e)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:r,enableDateRangeMetadataCues:s,interstitialsController:o}=this.hls.config;if(!s)return;const a=Ya();if(i&&r&&!o){const{fragmentStart:t,fragmentEnd:n}=e;let r=this.assetCue;r?(r.startTime=t,r.endTime=n):a&&(r=this.assetCue=Za(a,t,n,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),r&&(r.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(r),r.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:c}=e,u=Object.keys(c);let h=this.dateRangeCuesAppended;var d;if(l&&t)if(null!=(d=l.cues)&&d.length){const e=Object.keys(h).filter((e=>!u.includes(e)));for(let t=e.length;t--;){var f;const i=e[t],n=null==(f=h[i])?void 0:f.cues;delete h[i],n&&Object.keys(n).forEach((e=>{const t=n[e];if(t){t.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(t)}catch(e){}}}))}}else h=this.dateRangeCuesAppended={};const p=e.fragments[e.fragments.length-1];if(0!==u.length&&n(null==p?void 0:p.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let e=0;e<u.length;e++){const t=u[e],i=c[t],n=i.startTime,r=h[t],s=(null==r?void 0:r.cues)||{};let l=(null==r?void 0:r.durationKnown)||!1,d=Xa;const{duration:f,endDate:p}=i;if(p&&null!==f)d=n+f,l=!0;else if(i.endOnNext&&!l){const e=u.reduce(((e,t)=>{if(t!==i.id){const n=c[t];if(n.class===i.class&&n.startDate>i.startDate&&(!e||i.startDate<e.startDate))return n}return e}),null);e&&(d=e.startTime,l=!0)}const g=Object.keys(i.attr);for(let e=0;e<g.length;e++){const c=g[e];if("ID"===(_=c)||"CLASS"===_||"CUE"===_||"START-DATE"===_||"DURATION"===_||"END-DATE"===_||"END-ON-NEXT"===_)continue;const u=s[c];if(u)!l||null!=r&&r.durationKnown?Math.abs(u.startTime-n)>.01&&(u.startTime=n,u.endTime=d):u.endTime=d;else if(a){let e=i.attr[c];ui(c)&&(e=P(e));const r=Za(a,n,d,{key:c,data:e},ar.dateRange);r&&(r.id=t,this.id3Track.addCue(r),s[c]=r,o&&("X-ASSET-LIST"!==c&&"X-ASSET-URL"!==c||r.addEventListener("enter",this.onEventCueEnter)))}}h[t]={cues:s,dateRange:i,durationKnown:l}}var _}}}class Ja{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:e}=this,t=this.levelDetails;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:r}=this.config;if(!n||1===r||!t.live)return;const s=this.targetLatency;if(null===s)return;const o=i-s;if(o<Math.min(this.maxLatency,s+t.targetduration)&&o>.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,r)),i=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20,n=Math.min(t,Math.max(1,i));this.changeMediaPlaybackRate(e,n)}else 1!==e.playbackRate&&0!==e.playbackRate&&this.changeMediaPlaybackRate(e,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return(null==(e=this.hls)?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(void 0!==e.liveMaxLatencyDuration)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(null===e||null===this.hls)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:r,liveSyncDurationCount:s,lowLatencyMode:o}=this.config,a=this.hls.userConfig;let l=o&&i||t;(this._targetLatencyUpdated||a.liveSyncDuration||a.liveSyncDurationCount||0===l)&&(l=void 0!==r?r:s*n);const c=n;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,c)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(null===e||null===t)return null;const i=this.levelDetails;if(null===i)return null;const n=i.edge,r=e-t-this.edgeStalled,s=n-i.totalduration,o=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(s,r),o)}get drift(){const e=this.levelDetails;return null===e?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);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(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(l.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(l.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===a.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&null!=(i=this.levelDetails)&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,n;e.playbackRate!==t&&(null==(i=this.hls)||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${null==(n=this.targetLatency)?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}class el extends ls{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(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this),e.on(l.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this),e.off(l.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((e=>{e.loadError=0,e.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,n=[],r={},s={};let o=!1,a=!1,l=!1;t.levels.forEach((e=>{const t=e.attrs;let{audioCodec:c,videoCodec:u}=e;c&&(e.audioCodec=c=Pe(c,i)||void 0),u&&(u=e.videoCodec=function(e){const t=e.split(",");for(let e=0;e<t.length;e++){const i=t[e].split(".");i.length>2&&"avc1"===i[0]&&(t[e]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return t.join(",")}(u));const{width:h,height:d,unknownCodecs:f}=e,p=(null==f?void 0:f.length)||0;if(o||(o=!(!h||!d)),a||(a=!!u),l||(l=!!c),p||c&&!this.isAudioSupported(c)||u&&!this.isVideoSupported(u))return void this.log(`Some or all CODECS not supported "${t.CODECS}"`);const{CODECS:_,"FRAME-RATE":g,"HDCP-LEVEL":m,"PATHWAY-ID":v,RESOLUTION:y,"VIDEO-RANGE":b}=t,S=`${`${v||"."}-`}${e.bitrate}-${y}-${g}-${_}-${b}-${m}`;if(r[S])if(r[S].uri===e.url||e.attrs["PATHWAY-ID"])r[S].addGroupId("audio",t.AUDIO),r[S].addGroupId("text",t.SUBTITLES);else{const t=s[S]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const i=this.createLevel(e);r[S]=i,n.push(i)}else{const t=this.createLevel(e);r[S]=t,s[S]=1,n.push(t)}})),this.filterAndSortMediaOptions(n,t,o,a,l)}createLevel(e){const t=new Je(e),i=e.supplemental;if(null!=i&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const e=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(e.message),t.supportedResult=je(e,[])}return t}isAudioSupported(e){return Te(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Te(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,r){var s;let c=[],u=[],h=e;const d=(null==(s=t.stats)?void 0:s.parsing)||{};if((i||n)&&r&&(h=h.filter((({videoCodec:e,videoRange:t,width:i,height:n})=>{return(!!e||!(!i||!n))&&(!!(r=t)&&qe.indexOf(r)>-1);var r}))),0===h.length)return Promise.resolve().then((()=>{if(this.hls){let e="no level with compatible codecs found in manifest",i=e;t.levels.length&&(i=`one or more CODECS in variant not supported: ${it(t.levels.map((e=>e.attrs.CODECS)).filter(((e,t,i)=>i.indexOf(e)===t)))}`,this.warn(i),e+=` (${i})`);const n=new Error(e);this.hls.trigger(l.ERROR,{type:o.MEDIA_ERROR,details:a.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:n,reason:i})}})),void(d.end=performance.now());t.audioTracks&&(c=t.audioTracks.filter((e=>!e.audioCodec||this.isAudioSupported(e.audioCodec))),tl(c)),t.subtitles&&(u=t.subtitles,tl(u));const f=h.slice(0);h.sort(((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return qe.indexOf(e.videoRange)-qe.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const i=De(e.videoCodec),n=De(t.videoCodec);if(i!==n)return n-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const i=Le(e.codecSet),n=Le(t.codecSet);if(i!==n)return n-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));let p=f[0];if(this.steering&&(h=this.steering.filterParsedLevels(h),h.length!==f.length))for(let e=0;e<f.length;e++)if(f[e].pathwayId===h[0].pathwayId){p=f[e];break}this._levels=h;for(let e=0;e<h.length;e++)if(h[e]===p){var _;this._firstLevel=e;const t=p.bitrate,i=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${h.length} level(s) found, first bitrate: ${t}`),void 0===(null==(_=this.hls.userConfig)?void 0:_.abrEwmaDefaultEstimate)){const e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>i&&i===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}const g=r&&!n,m=this.hls.config,v=!(!m.audioStreamController||!m.audioTrackController),y={levels:h,audioTracks:c,subtitleTracks:u,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:n,altAudio:v&&!g&&c.some((e=>!!e.url))};d.end=performance.now(),this.hls.trigger(l.MANIFEST_PARSED,y)}get levels(){return 0===this._levels.length?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const i=new Error("invalid level idx"),n=e<0;if(this.hls.trigger(l.ERROR,{type:o.OTHER_ERROR,details:a.LEVEL_SWITCH_ERROR,level:e,fatal:n,error:i,reason:i.message}),n)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,r=n?n.attrs["PATHWAY-ID"]:void 0,s=t[e],c=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,i===e&&n&&r===c)return;this.log(`Switching to level ${e} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${c?" with Pathway "+c:""} from level ${i}${r?" with Pathway "+r:""}`);const u={level:e,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(l.LEVEL_SWITCHING,u);const h=s.details;if(!h||h.live){const e=this.switchParams(s.uri,null==n?void 0:n.details,h);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?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((e=>-1!==t.indexOf(e)));if(e.length<1)return void this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);this.steering.pathwayPriority=i}}onError(e,t){!t.fatal&&t.context&&t.context.type===u&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===f){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return;const i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:n,details:r}=t,s=t.levelInfo;var o;if(!s)return this.warn(`Invalid level index ${n}`),void(null!=(o=t.deliveryDirectives)&&o.skip&&(r.deltaUpdateFailed=!0));if(s===this.currentLevel||t.withoutMultiVariant){0===s.fragmentError&&(s.loadError=0);let e=s.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(n,t,e)}else null!=(i=t.deliveryDirectives)&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],s=e.details,o=null==s?void 0:s.age;this.log(`Loading level index ${n}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""}${r?" Pathway "+r:""}${o&&s.live?" age "+o.toFixed(1)+(s.type?" "+s.type||0:""):""} ${i}`),this.hls.trigger(l.LEVEL_LOADING,{url:i,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(1===this._levels.length)return;const i=this._levels.filter(((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((e=>e.level=-1))),!1)));ln(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger(l.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(l.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function tl(e){const t={};e.forEach((e=>{const i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}function il(){return self.SourceBuffer||self.WebKitSourceBuffer}function nl(){if(!D())return!1;const e=il();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class rl extends Rn{constructor(e,t,i){super(e,t,i,"stream-controller",f),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 e=this.media,t=e?e.currentTime:null;if(null===t||!n(t))return;if(this.log(`Media seeked to ${t.toFixed(3)}`),!this.getBufferedFrag(t))return;const i=this.getFwdBufferInfoAtPos(e,t,f,0);null!==i&&0!==i.len?this.tick():this.warn(`Main forward buffer length at ${t} on "seeked" event ${i?i.len:"empty"})`)},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(l.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(l.BUFFER_CREATED,this.onBufferCreated,this),e.on(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(l.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(l.BUFFER_CREATED,this.onBufferCreated,this),e.off(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:n}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let e=n.startLevel;-1===e&&(n.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=n.firstAutoLevel),n.nextLoadLevel=e,this.level=n.loadLevel,this._hasEnoughToStart=!!t}i>0&&-1===e&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=bn,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=yn}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Ln:{const{levels:e,level:t}=this,i=null==e?void 0:e[t],n=null==i?void 0:i.details;if(n&&(!n.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(n))break;this.state=bn;break}if(this.hls.nextLoadLevel!==this.level){this.state=bn;break}break}case wn:this.checkRetryDate()}this.state===bn&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),null!=(e=this.media)&&e.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(null===t||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(null==i||!i[r])return;const s=i[r],o=this.getMainFwdBufferInfo();if(null===o)return;const a=this.getLevelDetails();if(a&&this._streamEnded(o,a)){const e={};return 2===this.altAudio&&(e.type="video"),this.hls.trigger(l.BUFFER_EOS,e),void(this.state=An)}if(!this.buffering)return;e.loadLevel!==r&&-1===e.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const c=s.details;if(!c||this.state===Ln||this.waitForLive(s))return this.level=r,this.state=Ln,void(this.startFragRequested=!1);const u=o.len,h=this.getMaxBufferLength(s.maxBitrate);if(u>=h)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:o.end;let p=this.getNextFragment(d,c);if(this.couldBacktrack&&!this.fragPrevious&&p&&V(p)&&this.fragmentTracker.getState(p)!==Ft){var _;const e=(null!=(_=this.backtrackFragment)?_:p).sn-c.startSN,t=c.fragments[e-1];t&&p.cc===t.cc&&(p=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,d)){if(!p.gap){const e=this.audioOnly&&!this.altAudio?z:K,t=(e===K?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,f)}p=this.getNextFragmentLoopLoading(p,c,o,f,h)}p&&(!p.initSegment||p.initSegment.data||this.bitrateTest||(p=p.initSegment),this.loadFragment(p,s,d))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===Pt||n===Mt?V(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,f)}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(null!=t&&t.readyState){let i;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*r.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],n=this.fragLastKbps;i=n&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*n)+1:0}else i=0;const s=this.getBufferedFrag(t.currentTime+i);if(s){const e=this.followingBufferedFrag(s);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,n=Math.max(s.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(n,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 Sn:case En:case wn:case kn:case Tn:this.state=bn}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,2===this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;gn(i,"playing",this.onMediaPlaying),gn(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(mn(i,"playing",this.onMediaPlaying),mn(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(l.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,n=!1;for(let e=0;e<t.levels.length;e++){const r=t.levels[e].audioCodec;r&&(i=i||-1!==r.indexOf("mp4a.40.2"),n=n||-1!==r.indexOf("mp4a.40.5"))}this.audioCodecSwitch=i&&n&&!function(){var e;const t=il();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),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!==bn)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=Ln)}onLevelLoaded(e,t){var i;const{levels:n,startFragRequested:r}=this,s=t.level,o=t.details,a=o.totalduration;if(!n)return void this.warn(`Levels were reset while loading level ${s}`);this.log(`Level ${s} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const c=t.levelInfo,u=this.fragCurrent;!u||this.state!==En&&this.state!==wn||u.level!==t.level&&u.loader&&this.abortCurrentFrag();let h=0;if(o.live||null!=(i=c.details)&&i.live){var d;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;h=this.alignPlaylists(o,c.details,null==(d=this.levelLastLoaded)?void 0:d.details)}if(c.details=o,this.levelLastLoaded=c,r||this.setStartPosition(o,h),this.hls.trigger(l.LEVEL_UPDATED,{details:o,level:s}),this.state===Ln){if(this.waitForCdnTuneIn(o))return;this.state=bn}r&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const n=this.hls.liveSyncPosition,r=this.getLoadPosition(),s=e.fragmentStart,o=e.edge,a=r>=s-t.maxFragLookUpTolerance&&r<=o;if(null!==n&&i.duration>n&&(r<n||!a)){const s=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!a&&i.readyState<4||r<o-s)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState))if(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed(3)}`),"buffered"===this.config.liveSyncMode){var l;const e=ti.bufferInfo(i,n,0);if(null==(l=e.buffered)||!l.length)return void(i.currentTime=n);if(e.start<=r)return void(i.currentTime=n);const{nextStart:t}=ti.bufferedInfo(e.buffered,r,0);t&&(i.currentTime=t)}else i.currentTime=n}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:r}=e,{levels:s}=this;if(!s)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const o=s[i.level];if(!o)return void this.warn(`Level ${i.level} not found on progress`);const a=o.details;if(!a)return this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),void this.fragmentTracker.removeFragment(i);const l=o.videoCodec,c=a.PTSKnown||!a.live,u=null==(t=i.initSegment)?void 0:t.data,h=this._getAudioCodec(o),d=this.transmuxer=this.transmuxer||new as(this.hls,f,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=n?n.index:-1,_=-1!==p,g=new Jt(i.level,i.sn,i.stats.chunkCount,r.byteLength,p,_),m=this.initPTS[i.cc];d.push(r,u,h,l,i,n,a.totalduration,c,g,m)}onAudioTrackSwitching(e,t){const i=this.hls,n=2===this.altAudio;if(ut(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 e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(n)return this.fragmentTracker.removeAllFragments(),i.once(l.BUFFER_FLUSHED,(()=>{this.hls&&this.hls.trigger(l.AUDIO_TRACK_SWITCHED,t)})),void i.trigger(l.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});i.trigger(l.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=ut(t.url,this.hls);if(i){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,r,s=!1;for(const e in i){const t=i[e];if("main"===t.id){if(r=e,n=t,"video"===e){const t=i[e];t&&(this.videoBuffer=t.buffer)}}else s=!0}s&&n?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t,r=i.type===f;if(r){if(this.fragContextChanged(i))return this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===Tn&&(this.state=bn));const e=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*e.total/(e.buffering.end-e.loading.first)),V(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const s=this.media;s&&(!this._hasEnoughToStart&&ti.getBuffered(s).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal)this.state=xn;else switch(t.details){case a.FRAG_GAP:case a.FRAG_PARSING_ERROR:case a.FRAG_DECRYPT_ERROR:case a.FRAG_LOAD_ERROR:case a.FRAG_LOAD_TIMEOUT:case a.KEY_LOAD_ERROR:case a.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(f,t);break;case a.LEVEL_LOAD_ERROR:case a.LEVEL_LOAD_TIMEOUT:case a.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Ln||(null==(i=t.context)?void 0:i.type)!==u||(this.state=bn);break;case a.BUFFER_ADD_CODEC_ERROR:case a.BUFFER_APPEND_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case a.BUFFER_FULL_ERROR:if("main"!==t.parent)return;if(this.reduceLengthAndFlushBuffer(t)){!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}break;case a.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onFragLoadEmergencyAborted(){this.state=bn,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==z||!this.altAudio){const e=(t===K?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,t,f),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&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)return void this.log(`could not seek to ${i}, already seeking at ${t}`);const n=this.timelineOffset;n&&i&&(i+=n);const r=this.getLevelDetails(),s=ti.getBuffered(e),o=s.length?s.start(0):0,a=o-i,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||a>0&&(a<l||this.loadingParts&&a<2*((null==r?void 0:r.partTarget)||0)))&&(this.log(`adjusting start position by ${a} to match buffer start`),i+=a,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then((e=>{const{hls:i}=this,n=null==e?void 0:e.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=bn,this.startFragRequested=!1,this.bitrateTest=!1;const r=n.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),i.trigger(l.FRAG_LOADED,e),n.bitrateTest=!1})).catch((t=>{this.state!==yn&&this.state!==xn&&(this.warn(t),this.resetFragmentLoading(e))}))}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:r,chunkMeta:s}=e,o=this.getCurrentContext(s);if(!o)return void this.resetWhenMissingContext(s);const{frag:a,part:c,level:u}=o,{video:h,text:d,id3:f,initSegment:p}=r,{details:_}=u,g=this.altAudio?void 0:r.audio;if(this.fragContextChanged(a))this.fragmentTracker.removeFragment(a);else{if(this.state=kn,p){const e=p.tracks;if(e){const n=a.initSegment||a;if(this.unhandledEncryptionError(p,a))return;this._bufferInitSegment(u,e,n,s),i.trigger(l.FRAG_PARSING_INIT_SEGMENT,{frag:n,id:t,tracks:e})}const r=p.initPTS,o=p.timescale,c=this.initPTS[a.cc];if(n(r)&&(!c||c.baseTime!==r||c.timescale!==o)){const e=p.trackId;this.initPTS[a.cc]={baseTime:r,timescale:o,trackId:e},i.trigger(l.INIT_PTS_FOUND,{frag:a,id:t,initPTS:r,timescale:o,trackId:e})}}if(h&&_){g&&"audiovideo"===h.type&&this.logMuxedErr(a);const e=_.fragments[a.sn-1-_.startSN],t=a.sn===_.startSN,i=!e||a.cc>e.cc;if(!1!==r.independent){const{startPTS:e,endPTS:n,startDTS:r,endDTS:o}=h;if(c)c.elementaryStreams[h.type]={startPTS:e,endPTS:n,startDTS:r,endDTS:o};else if(h.firstKeyFrame&&h.independent&&1===s.id&&!i&&(this.couldBacktrack=!0),h.dropped&&h.independent){const r=this.getMainFwdBufferInfo(),s=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,l=h.firstKeyFramePTS?h.firstKeyFramePTS:e;if(!t&&s<l-this.config.maxBufferHole&&!i)return void this.backtrack(a);i&&(a.gap=!0),a.setElementaryStreamInfo(h.type,a.start,n,a.start,o,!0)}else t&&e-(_.appliedTimelineOffset||0)>2&&(a.gap=!0);a.setElementaryStreamInfo(h.type,e,n,r,o),this.backtrackFragment&&(this.backtrackFragment=a),this.bufferFragmentData(h,a,c,s,t||i)}else{if(!t&&!i)return void this.backtrack(a);a.gap=!0}}if(g){const{startPTS:e,endPTS:t,startDTS:i,endDTS:n}=g;c&&(c.elementaryStreams[z]={startPTS:e,endPTS:t,startDTS:i,endDTS:n}),a.setElementaryStreamInfo(z,e,t,i,n),this.bufferFragmentData(g,a,c,s)}if(_&&null!=f&&f.samples.length){const e={id:t,frag:a,details:_,samples:f.samples};i.trigger(l.FRAG_PARSING_METADATA,e)}if(_&&d){const e={id:t,frag:a,details:_,samples:d.samples};i.trigger(l.FRAG_PARSING_USERDATA,e)}}}logMuxedErr(e){this.warn(`${V(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==kn)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:r,video:s,audiovideo:o}=t;if(r){const i=e.audioCodec;let n=Oe(r.codec,i);"mp4a"===n&&(n="mp4a.40.5");const s=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){n&&(n=-1!==n.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const e=r.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===s.indexOf("firefox")&&(n="mp4a.40.5")}n&&-1!==n.indexOf("mp4a.40.5")&&-1!==s.indexOf("android")&&"audio/mpeg"!==r.container&&(n="mp4a.40.2",this.log(`Android: force audio codec to ${n}`)),i&&i!==n&&this.log(`Swapping manifest audio codec "${i}" for "${n}"`),r.levelCodec=n,r.id=f,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${n||""}/${i||""}/${r.codec}]`),delete t.audiovideo}if(s){s.levelCodec=e.videoCodec,s.id=f;const i=s.codec;if(4===(null==i?void 0:i.length))switch(i){case"hvc1":case"hev1":s.codec="hvc1.1.6.L120.90";break;case"av01":s.codec="av01.0.04M.08";break;case"avc1":s.codec="avc1.42e01e"}this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${e.videoCodec||""}/${i}]${s.codec!==i?" parsed-corrected="+s.codec:""}${s.supplemental?" supplemental="+s.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const a=Object.keys(t);if(a.length){if(this.hls.trigger(l.BUFFER_CODECS,t),!this.hls)return;a.forEach((e=>{const r=t[e].initSegment;null!=r&&r.byteLength&&this.hls.trigger(l.BUFFER_APPENDING,{type:e,data:r,frag:i,part:null,chunkMeta:n,parent:i.type})}))}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&2===this.altAudio?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,f)}get maxBufferLength(){const{levels:e,level:t}=this,i=null==e?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=bn}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const i=e.currentTime;if(ti.isBuffered(e,i)?t=this.getAppendedFrag(i):ti.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,i=t.level;e&&t.sn===e.sn&&e.level===i||(this.fragPlaying=t,this.hls.trigger(l.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(l.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;return n(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(n(t)){const e=this.getLevelDetails(),i=this.currentFrag||(e?dt(null,e.fragments,t):null);if(i){const e=i.programDateTime;if(null!==e){const n=e+1e3*(t-i.start);return new Date(n)}}}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 sl extends E{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[i].loader;if(n){var t;if(e&&e!==(null==(t=n.context)?void 0:t.frag.type))return;n.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=a.KEY_LOAD_ERROR,i,n,r){return new Xt({type:o.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:n})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let n=0,r=t.length;n<r;n++){const s=t[n];if(e.cc<=s.cc&&(!V(e)||!V(s)||e.sn<s.sn)||!i&&n==r-1)return this.emeController.selectKeySystemFormat(s).then((e=>{if(!this.emeController)return;s.setKeyFormat(e);const t=Ai(e);return t?this.emeController.getKeySystemAccess([t]):void 0}))}if(this.config.requireKeySystemAccessOnStart){const e=Di(this.config);if(e.length)return this.emeController.getKeySystemAccess(e)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then((t=>this.loadInternal(e,t))):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const i=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,a.KEY_LOAD_ERROR,i))}const s=r.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,a.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));const o=ol(r);let l=this.keyIdToKeyInfo[o];if(null!=(i=l)&&i.decryptdata.key)return r.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if(this.emeController&&null!=(n=l)&&n.keyLoadPromise){switch(this.emeController.getKeyStatus(l.decryptdata)){case"usable":case"usable-in-future":return l.keyLoadPromise.then((t=>{const{keyInfo:i}=t;return r.key=i.decryptdata.key,{frag:e,keyInfo:i}}))}}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${r.keyId?" keyId: "+I(r.keyId):""} URI: ${r.uri} from ${e.type} ${e.level}`),l=this.keyIdToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,a.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const n=this.emeController.loadKey(i);return(e.keyLoadPromise=n.then((t=>(e.mediaKeySessionContext=t,i)))).catch((i=>{throw e.keyLoadPromise=null,"data"in i&&(i.data.frag=t),i}))}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=new(0,i.loader)(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise(((r,s)=>{const o={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(e,t,i,n)=>{const{frag:o,keyInfo:l}=i,c=ol(l.decryptdata);if(!o.decryptdata||l!==this.keyIdToKeyInfo[c])return s(this.createKeyLoadError(o,a.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),n));l.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,l.loader=null,r({frag:o,keyInfo:l})},onError:(e,i,n,r)=>{this.resetLoader(i),s(this.createKeyLoadError(t,a.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),n,S({url:o.url,data:void 0},e)))},onTimeout:(e,i,n)=>{this.resetLoader(i),s(this.createKeyLoadError(t,a.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),n))},onAbort:(e,i,n)=>{this.resetLoader(i),s(this.createKeyLoadError(t,a.INTERNAL_ABORTED,new Error("key loading aborted"),n))}};n.load(o,c,u)}))}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null);const s=ol(i.decryptdata)||n;delete this.keyIdToKeyInfo[s],r&&r.destroy()}}function ol(e){if(e.keyFormat!==Ci){const t=e.keyId;if(t)return I(t)}return e.uri}function al(e){const{type:t}=e;switch(t){case h:return p;case d:return _;default:return f}}function ll(e,t){let i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}class cl{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(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(l.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.LEVEL_LOADING,this.onLevelLoading,this),e.off(l.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(l.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,r=new(i||n)(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:c,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:r,url:s,deliveryDirectives:o,levelInfo:a}=t;this.load({id:i,level:n,pathwayId:r,responseType:"text",type:u,url:s,deliveryDirectives:o,levelOrTrack:a})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:r,deliveryDirectives:s,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:h,url:r,deliveryDirectives:s,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:r,deliveryDirectives:s,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:d,url:r,deliveryDirectives:s,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[u];if(i){const e=i.context;e&&!t.levels.some((t=>t===e.levelOrTrack))&&(i.abort(),delete this.loaders[u])}}load(e){var t;const i=this.hls.config;let r,s=this.getInternalLoader(e);if(s){const t=this.hls.logger,i=s.context;if(i&&i.levelOrTrack===e.levelOrTrack&&(i.url===e.url||i.deliveryDirectives&&!e.deliveryDirectives))return void(i.url===e.url?t.log(`[playlist-loader]: ignore ${e.url} ongoing request`):t.log(`[playlist-loader]: ignore ${e.url} in favor of ${i.url}`));t.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}if(r=e.type===c?i.manifestLoadPolicy.default:y({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),n(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===u&&null!==e.level?t=this.hls.levels[e.level].details:e.type===h&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===d&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,i=t.targetduration;if(e&&i){const t=1e3*Math.max(3*e,.8*i);r=y({},r,{maxTimeToFirstByteMs:Math.min(t,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,r.maxTimeToFirstByteMs)})}}}const o=r.errorRetry||r.timeoutRetry||{},a={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},l={onSuccess:(e,t,i,n)=>{const r=this.getInternalLoader(i);this.resetInternalLoader(i.type);const s=e.data;t.parsing.start=performance.now(),Ui.isMediaPlaylist(s)||i.type!==c?this.handleTrackOrLevelPlaylist(e,t,i,n||null,r):this.handleMasterPlaylist(e,t,i,n)},onError:(e,t,i,n)=>{this.handleNetworkError(t,i,!1,e,n)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}};s.load(e,a,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const r=this.hls,s=e.data,o=ll(e,i),a=Ui.parseMasterPlaylist(s,o);if(a.playlistParsingError)return t.parsing.end=performance.now(),void this.handleManifestParsingError(e,i,a.playlistParsingError,n,t);const{contentSteering:c,levels:u,sessionData:h,sessionKeys:d,startTimeOffset:f,variableList:p}=a;this.variableList=p,u.forEach((e=>{const{unknownCodecs:t}=e;if(t){const{preferManagedMediaSource:i}=this.hls.config;let{audioCodec:n,videoCodec:r}=e;for(let s=t.length;s--;){const o=t[s];Te(o,"audio",i)?(e.audioCodec=n=n?`${n},${o}`:o,Ce.audio[n.substring(0,4)]=2,t.splice(s,1)):Te(o,"video",i)&&(e.videoCodec=r=r?`${r},${o}`:o,Ce.video[r.substring(0,4)]=2,t.splice(s,1))}}}));const{AUDIO:_=[],SUBTITLES:g,"CLOSED-CAPTIONS":m}=Ui.parseMasterPlaylistMedia(s,o,a);if(_.length){_.some((e=>!e.url))||!u[0].audioCodec||u[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ci({}),bitrate:0,url:""}))}r.trigger(l.MANIFEST_LOADED,{levels:u,audioTracks:_,subtitles:g,captions:m,contentSteering:c,url:o,stats:t,networkDetails:n,sessionData:h,sessionKeys:d,startTimeOffset:f,variableList:p})}handleTrackOrLevelPlaylist(e,t,i,r,s){const o=this.hls,{id:a,level:u,type:h}=i,d=ll(e,i),f=n(u)?u:n(a)?a:0,p=al(i),_=Ui.parseLevelPlaylist(e.data,d,f,p,0,this.variableList);if(h===c){const e={attrs:new ci({}),bitrate:0,details:_,name:"",url:d};_.requestScheduled=t.loading.start+rn(_,0),o.trigger(l.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,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,n,r){this.hls.trigger(l.ERROR,{type:o.NETWORK_ERROR,details:a.MANIFEST_PARSING_ERROR,fatal:t.type===c,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:r})}handleNetworkError(e,t,i=!1,n,r){let s=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===u?s+=`: ${e.level} id: ${e.id}`:e.type!==h&&e.type!==d||(s+=` id: ${e.id} group-id: "${e.groupId}"`);const f=new Error(s);this.hls.logger.warn(`[playlist-loader]: ${s}`);let p=a.UNKNOWN,_=!1;const g=this.getInternalLoader(e);switch(e.type){case c:p=i?a.MANIFEST_LOAD_TIMEOUT:a.MANIFEST_LOAD_ERROR,_=!0;break;case u:p=i?a.LEVEL_LOAD_TIMEOUT:a.LEVEL_LOAD_ERROR,_=!1;break;case h:p=i?a.AUDIO_TRACK_LOAD_TIMEOUT:a.AUDIO_TRACK_LOAD_ERROR,_=!1;break;case d:p=i?a.SUBTITLE_TRACK_LOAD_TIMEOUT:a.SUBTITLE_LOAD_ERROR,_=!1}g&&this.resetInternalLoader(e.type);const m={type:o.NETWORK_ERROR,details:p,fatal:_,url:e.url,loader:g,context:e,error:f,networkDetails:t,stats:r};if(n){const i=(null==t?void 0:t.url)||e.url;m.response=S({url:i,data:void 0},n)}this.hls.trigger(l.ERROR,m)}handlePlaylistLoaded(e,t,i,n,r,s){const p=this.hls,{type:_,level:g,levelOrTrack:m,id:v,groupId:y,deliveryDirectives:b}=n,S=ll(t,n),E=al(n);let w="number"==typeof n.level&&E===f?g:void 0;const C=e.playlistParsingError;if(C){if(this.hls.logger.warn(`${C} ${e.url}`),!p.config.ignorePlaylistParsingErrors)return void p.trigger(l.ERROR,{type:o.NETWORK_ERROR,details:a.LEVEL_PARSING_ERROR,fatal:!1,url:S,error:C,reason:C.message,response:t,context:n,level:w,parent:E,networkDetails:r,stats:i});e.playlistParsingError=null}if(e.fragments.length)switch(e.live&&s&&(s.getCacheAge&&(e.ageHeader=s.getCacheAge()||0),s.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),_){case c:case u:if(w)if(m){if(m!==p.levels[w]){const e=p.levels.indexOf(m);e>-1&&(w=e)}}else w=0;p.trigger(l.LEVEL_LOADED,{details:e,levelInfo:m||p.levels[0],level:w||0,id:v||0,stats:i,networkDetails:r,deliveryDirectives:b,withoutMultiVariant:_===c});break;case h:p.trigger(l.AUDIO_TRACK_LOADED,{details:e,track:m,id:v||0,groupId:y||"",stats:i,networkDetails:r,deliveryDirectives:b});break;case d:p.trigger(l.SUBTITLE_TRACK_LOADED,{details:e,track:m,id:v||0,groupId:y||"",stats:i,networkDetails:r,deliveryDirectives:b})}else{const s=e.playlistParsingError=new Error("No Segments found in Playlist");p.trigger(l.ERROR,{type:o.NETWORK_ERROR,details:a.LEVEL_EMPTY_ERROR,fatal:!1,url:S,error:s,reason:s.message,response:t,context:n,level:w,parent:E,networkDetails:r,stats:i})}}}class ul{static get version(){return Nn}static isMSESupported(){return nl()}static isSupported(){return function(){if(!nl())return!1;const e=D();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((t=>e.isTypeSupported(xe(t,"video"))))||["mp4a.40.2","fLaC"].some((t=>e.isTypeSupported(xe(t,"audio")))))}()}static getMediaSource(){return D()}static get Events(){return l}static get MetadataSchema(){return ar}static get ErrorTypes(){return o}static get ErrorDetails(){return a}static get DefaultConfig(){return ul.defaultConfig?ul.defaultConfig:$a}static set DefaultConfig(e){ul.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 Bn,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=function(e,t,i){const n=k();if("object"==typeof console&&!0===e||"object"==typeof e){const r=["debug","log","info","warn","error"];r.forEach((t=>{n[t]=T(t,e,i)}));try{n.log(`Debug logs enabled for "${t}" in hls.js version 1.6.12`)}catch(e){return k()}r.forEach((t=>{A[t]=T(t,e)}))}else y(A,n);return n}(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=function(e,t,i){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const n=Ga(e),r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((e=>{const s=`${"level"===e?"playlist":e}LoadPolicy`,o=void 0===t[s],a=[];r.forEach((i=>{const r=`${e}Loading${i}`,l=t[r];if(void 0!==l&&o){a.push(r);const e=n[s].default;switch(t[s]={default:e},i){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}})),a.length&&i.warn(`hls.js config: "${a.join('", "')}" setting(s) are deprecated, use "${s}": ${it(t[s])}`)})),S(S({},n),t)}(ul.DefaultConfig,e,t);this.userConfig=e,i.progressive&&za(i,t);const{abrController:n,bufferController:r,capLevelController:s,errorController:o,fpsController:a}=i,c=new o(this),u=this.abrController=new n(this),h=new Bt(this),d=i.interstitialsController,f=d?this.interstitialsController=new d(this,ul):null,p=this.bufferController=new r(this,h),_=this.capLevelController=new s(this),g=new a(this),m=new cl(this),v=i.contentSteeringController,b=v?new v(this):null,E=this.levelController=new el(this,b),w=new Qa(this),C=new sl(this.config,this.logger),x=this.streamController=new rl(this,h,C),D=this.gapController=new Ka(this,h);_.setStreamController(x),g.setStreamController(x);const L=[m,E,x];f&&L.splice(1,0,f),b&&L.splice(1,0,b),this.networkControllers=L;const R=[u,p,D,_,g,w,h];this.audioTrackController=this.createController(i.audioTrackController,L);const I=i.audioStreamController;I&&L.push(this.audioStreamController=new I(this,h,C)),this.subtitleTrackController=this.createController(i.subtitleTrackController,L);const P=i.subtitleStreamController;P&&L.push(this.subtititleStreamController=new P(this,h,C)),this.createController(i.timelineController,R),C.emeController=this.emeController=this.createController(i.emeController,R),this.cmcdController=this.createController(i.cmcdController,R),this.latencyController=this.createController(Ja,R),this.coreComponents=R,L.push(c);const O=c.onErrorOut;"function"==typeof O&&this.on(l.ERROR,O,c),this.on(l.MANIFEST_LOADED,m.onManifestLoaded,m)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,n){this._emitter.off(e,t,i,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;const i=e===l.ERROR;this.trigger(l.ERROR,{type:o.OTHER_ERROR,details:a.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(l.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach((e=>e.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((e=>e.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 t=new Error(`attachMedia failed: invalid argument (${e})`);return void this.trigger(l.ERROR,{type:o.OTHER_ERROR,details:a.ATTACH_MEDIA_ERROR,fatal:!0,error:t})}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,n=t?e:{media:i};this._media=i,this.trigger(l.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger(l.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(l.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,n=this._url=$.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${n}`),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(l.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={[f]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[p]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[_]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=null==e?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=function(){try{return crypto.randomUUID()}catch(e){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,(e=>{const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}}}()),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-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),-1!==e&&(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){(function(e){return We.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let n=0;n<i;n++)if(e[n].maxBitrate>=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let n;if(n=-1===t&&null!=e&&e.length?e.length-1:t,i)for(let t=n;t--;){const n=e[t].attrs["HDCP-LEVEL"];if(n&&n<=i)return t}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return(null==(t=this.audioTrackController)?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return(null==(t=this.subtitleTrackController)?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}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!(null==(e=this.bufferController)||!e.bufferedToEnd)}get interstitialsManager(){var e;return(null==(e=this.interstitialsController)?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){return Ge(e,rt(t),navigator.mediaCapabilities)}}ul.defaultConfig=void 0}}]);