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__Classrooms__Lists__Polls...

1034 lines
1015 KiB

!(function(){var dl=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[5148],{65030:function(Ut,at,O){"use strict";O.d(at,{Z:function(){return ut}});var N=O(27247),re=O(11913),De=O(43079),ne=O(43403),$=O(92310),g=O.n($),ue=O(29301),ee=O(76846),l=O(96452),j=O(6089),A=O(80402),p=O(34280),m=O(49658),y=O(59301),x=O(32855),M=O(77900),F=O(8654);function z(ce){var le=ce.prefixCls,Y=ce.align,Te=ce.arrow,ke=ce.arrowPos,Ke=Te||{},G=Ke.className,q=Ke.content,me=ke.x,we=me===void 0?0:me,Le=ke.y,$e=Le===void 0?0:Le,yt=y.useRef();if(!Y||!Y.points)return null;var Qe={position:"absolute"};if(Y.autoArrow!==!1){var et=Y.points[0],Ve=Y.points[1],He=et[0],_t=et[1],ht=Ve[0],xe=Ve[1];He===ht||!["t","b"].includes(He)?Qe.top=$e:He==="t"?Qe.top=0:Qe.bottom=0,_t===xe||!["l","r"].includes(_t)?Qe.left=we:_t==="l"?Qe.left=0:Qe.right=0}return y.createElement("div",{ref:yt,className:g()("".concat(le,"-arrow"),G),style:Qe},q)}function I(ce){var le=ce.prefixCls,Y=ce.open,Te=ce.zIndex,ke=ce.mask,Ke=ce.motion;return ke?y.createElement(M.default,(0,x.Z)({},Ke,{motionAppear:!0,visible:Y,removeOnLeave:!0}),function(G){var q=G.className;return y.createElement("div",{style:{zIndex:Te},className:g()("".concat(le,"-mask"),q)})}):null}var C=y.memo(function(ce){var le=ce.children;return le},function(ce,le){return le.cache}),U=C,H=y.forwardRef(function(ce,le){var Y=ce.popup,Te=ce.className,ke=ce.prefixCls,Ke=ce.style,G=ce.target,q=ce.onVisibleChanged,me=ce.open,we=ce.keepDom,Le=ce.fresh,$e=ce.onClick,yt=ce.mask,Qe=ce.arrow,et=ce.arrowPos,Ve=ce.align,He=ce.motion,_t=ce.maskMotion,ht=ce.forceRender,xe=ce.getPopupContainer,ct=ce.autoDestroy,Xe=ce.portal,We=ce.zIndex,Et=ce.onMouseEnter,St=ce.onMouseLeave,mt=ce.onPointerEnter,st=ce.onPointerDownCapture,Pt=ce.ready,ot=ce.offsetX,bt=ce.offsetY,Ee=ce.offsetR,pe=ce.offsetB,ge=ce.onAlign,L=ce.onPrepare,B=ce.stretch,Q=ce.targetWidth,ae=ce.targetHeight,de=typeof Y=="function"?Y():Y,qe=me||we,lt=(xe==null?void 0:xe.length)>0,pt=y.useState(!xe||!lt),Tt=(0,re.Z)(pt,2),Wt=Tt[0],mn=Tt[1];if((0,p.Z)(function(){!Wt&&lt&&G&&mn(!0)},[Wt,lt,G]),!Wt)return null;var Qt="auto",Ot={left:"-1000vw",top:"-1000vh",right:Qt,bottom:Qt};if(Pt||!me){var vn,Kn=Ve.points,Ln=Ve.dynamicInset||((vn=Ve._experimental)===null||vn===void 0?void 0:vn.dynamicInset),Sn=Ln&&Kn[0][1]==="r",gt=Ln&&Kn[0][0]==="b";Sn?(Ot.right=Ee,Ot.left=Qt):(Ot.left=ot,Ot.right=Qt),gt?(Ot.bottom=pe,Ot.top=Qt):(Ot.top=bt,Ot.bottom=Qt)}var Je={};return B&&(B.includes("height")&&ae?Je.height=ae:B.includes("minHeight")&&ae&&(Je.minHeight=ae),B.includes("width")&&Q?Je.width=Q:B.includes("minWidth")&&Q&&(Je.minWidth=Q)),me||(Je.pointerEvents="none"),y.createElement(Xe,{open:ht||qe,getContainer:xe&&function(){return xe(G)},autoDestroy:ct},y.createElement(I,{prefixCls:ke,open:me,zIndex:We,mask:yt,motion:_t}),y.createElement(ue.Z,{onResize:ge,disabled:!me},function(wt){return y.createElement(M.default,(0,x.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:ht,leavedClassName:"".concat(ke,"-hidden")},He,{onAppearPrepare:L,onEnterPrepare:L,visible:me,onVisibleChanged:function(ln){var Tn;He==null||(Tn=He.onVisibleChanged)===null||Tn===void 0||Tn.call(He,ln),q(ln)}}),function(jt,ln){var Tn=jt.className,ti=jt.style,Qn=g()(ke,Tn,Te);return y.createElement("div",{ref:(0,F.sQ)(wt,le,ln),className:Qn,style:(0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)({"--arrow-x":"".concat(et.x||0,"px"),"--arrow-y":"".concat(et.y||0,"px")},Ot),Je),ti),{},{boxSizing:"border-box",zIndex:We},Ke),onMouseEnter:Et,onMouseLeave:St,onPointerEnter:mt,onClick:$e,onPointerDownCapture:st},Qe&&y.createElement(z,{prefixCls:ke,arrow:Qe,arrowPos:et,align:Ve}),y.createElement(U,{cache:!me&&!Le},de))})}))}),J=H,he=y.forwardRef(function(ce,le){var Y=ce.children,Te=ce.getTriggerDOMNode,ke=(0,F.Yr)(Y),Ke=y.useCallback(function(q){(0,F.mH)(le,Te?Te(q):q)},[Te]),G=(0,F.x1)(Ke,(0,F.C4)(Y));return ke?y.cloneElement(Y,{ref:G}):Y}),X=he,oe=y.createContext(null),_e=oe;function ie(ce){return ce?Array.isArray(ce)?ce:[ce]:[]}function ze(ce,le,Y,Te){return y.useMemo(function(){var ke=ie(Y!=null?Y:le),Ke=ie(Te!=null?Te:le),G=new Set(ke),q=new Set(Ke);return ce&&(G.has("hover")&&(G.delete("hover"),G.add("click")),q.has("hover")&&(q.delete("hover"),q.add("click"))),[G,q]},[ce,le,Y,Te])}var k=O(29194);function S(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Y=arguments.length>2?arguments[2]:void 0;return Y?ce[0]===le[0]:ce[0]===le[0]&&ce[1]===le[1]}function w(ce,le,Y,Te){for(var ke=Y.points,Ke=Object.keys(ce),G=0;G<Ke.length;G+=1){var q,me=Ke[G];if(S((q=ce[me])===null||q===void 0?void 0:q.points,ke,Te))return"".concat(le,"-placement-").concat(me)}return""}function P(ce,le,Y,Te){return le||(Y?{motionName:"".concat(ce,"-").concat(Y)}:Te?{motionName:Te}:null)}function W(ce){return ce.ownerDocument.defaultView}function K(ce){for(var le=[],Y=ce==null?void 0:ce.parentElement,Te=["hidden","scroll","clip","auto"];Y;){var ke=W(Y).getComputedStyle(Y),Ke=ke.overflowX,G=ke.overflowY,q=ke.overflow;[Ke,G,q].some(function(me){return Te.includes(me)})&&le.push(Y),Y=Y.parentElement}return le}function _(ce){var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(ce)?le:ce}function v(ce){return _(parseFloat(ce),0)}function D(ce,le){var Y=(0,N.Z)({},ce);return(le||[]).forEach(function(Te){if(!(Te instanceof HTMLBodyElement||Te instanceof HTMLHtmlElement)){var ke=W(Te).getComputedStyle(Te),Ke=ke.overflow,G=ke.overflowClipMargin,q=ke.borderTopWidth,me=ke.borderBottomWidth,we=ke.borderLeftWidth,Le=ke.borderRightWidth,$e=Te.getBoundingClientRect(),yt=Te.offsetHeight,Qe=Te.clientHeight,et=Te.offsetWidth,Ve=Te.clientWidth,He=v(q),_t=v(me),ht=v(we),xe=v(Le),ct=_(Math.round($e.width/et*1e3)/1e3),Xe=_(Math.round($e.height/yt*1e3)/1e3),We=(et-Ve-ht-xe)*ct,Et=(yt-Qe-He-_t)*Xe,St=He*Xe,mt=_t*Xe,st=ht*ct,Pt=xe*ct,ot=0,bt=0;if(Ke==="clip"){var Ee=v(G);ot=Ee*ct,bt=Ee*Xe}var pe=$e.x+st-ot,ge=$e.y+St-bt,L=pe+$e.width+2*ot-st-Pt-We,B=ge+$e.height+2*bt-St-mt-Et;Y.left=Math.max(Y.left,pe),Y.top=Math.max(Y.top,ge),Y.right=Math.min(Y.right,L),Y.bottom=Math.min(Y.bottom,B)}}),Y}function Z(ce){var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Y="".concat(le),Te=Y.match(/^(.*)\%$/);return Te?ce*(parseFloat(Te[1])/100):parseFloat(Y)}function fe(ce,le){var Y=le||[],Te=(0,re.Z)(Y,2),ke=Te[0],Ke=Te[1];return[Z(ce.width,ke),Z(ce.height,Ke)]}function ye(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[ce[0],ce[1]]}function Oe(ce,le){var Y=le[0],Te=le[1],ke,Ke;return Y==="t"?Ke=ce.y:Y==="b"?Ke=ce.y+ce.height:Ke=ce.y+ce.height/2,Te==="l"?ke=ce.x:Te==="r"?ke=ce.x+ce.width:ke=ce.x+ce.width/2,{x:ke,y:Ke}}function Ne(ce,le){var Y={t:"b",b:"t",l:"r",r:"l"};return ce.map(function(Te,ke){return ke===le?Y[Te]||"c":Te}).join("")}function ve(ce,le,Y,Te,ke,Ke,G){var q=y.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:ke[Te]||{}}),me=(0,re.Z)(q,2),we=me[0],Le=me[1],$e=y.useRef(0),yt=y.useMemo(function(){return le?K(le):[]},[le]),Qe=y.useRef({}),et=function(){Qe.current={}};ce||et();var Ve=(0,j.Z)(function(){if(le&&Y&&ce){let ei=function(si,Di){var Vi=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bn,as=qe.x+si,Qi=qe.y+Di,$n=as+gt,ri=Qi+Sn,os=Math.max(as,Vi.left),kt=Math.max(Qi,Vi.top),zt=Math.min($n,Vi.right),On=Math.min(ri,Vi.bottom);return Math.max(0,(zt-os)*(On-kt))},Un=function(){hn=qe.y+Xt,ni=hn+Sn,Jn=qe.x+Ht,Mn=Jn+gt};var ht,xe,ct,Xe,We=le,Et=We.ownerDocument,St=W(We),mt=St.getComputedStyle(We),st=mt.position,Pt=We.style.left,ot=We.style.top,bt=We.style.right,Ee=We.style.bottom,pe=We.style.overflow,ge=(0,N.Z)((0,N.Z)({},ke[Te]),Ke),L=Et.createElement("div");(ht=We.parentElement)===null||ht===void 0||ht.appendChild(L),L.style.left="".concat(We.offsetLeft,"px"),L.style.top="".concat(We.offsetTop,"px"),L.style.position=st,L.style.height="".concat(We.offsetHeight,"px"),L.style.width="".concat(We.offsetWidth,"px"),We.style.left="0",We.style.top="0",We.style.right="auto",We.style.bottom="auto",We.style.overflow="hidden";var B;if(Array.isArray(Y))B={x:Y[0],y:Y[1],width:0,height:0};else{var Q,ae,de=Y.getBoundingClientRect();de.x=(Q=de.x)!==null&&Q!==void 0?Q:de.left,de.y=(ae=de.y)!==null&&ae!==void 0?ae:de.top,B={x:de.x,y:de.y,width:de.width,height:de.height}}var qe=We.getBoundingClientRect(),lt=St.getComputedStyle(We),pt=lt.height,Tt=lt.width;qe.x=(xe=qe.x)!==null&&xe!==void 0?xe:qe.left,qe.y=(ct=qe.y)!==null&&ct!==void 0?ct:qe.top;var Wt=Et.documentElement,mn=Wt.clientWidth,Qt=Wt.clientHeight,Ot=Wt.scrollWidth,vn=Wt.scrollHeight,Kn=Wt.scrollTop,Ln=Wt.scrollLeft,Sn=qe.height,gt=qe.width,Je=B.height,wt=B.width,jt={left:0,top:0,right:mn,bottom:Qt},ln={left:-Ln,top:-Kn,right:Ot-Ln,bottom:vn-Kn},Tn=ge.htmlRegion,ti="visible",Qn="visibleFirst";Tn!=="scroll"&&Tn!==Qn&&(Tn=ti);var In=Tn===Qn,Vn=D(ln,yt),an=D(jt,yt),Bn=Tn===ti?an:Vn,Cn=In?an:Bn;We.style.left="auto",We.style.top="auto",We.style.right="0",We.style.bottom="0";var Ii=We.getBoundingClientRect();We.style.left=Pt,We.style.top=ot,We.style.right=bt,We.style.bottom=Ee,We.style.overflow=pe,(Xe=We.parentElement)===null||Xe===void 0||Xe.removeChild(L);var en=_(Math.round(gt/parseFloat(Tt)*1e3)/1e3),un=_(Math.round(Sn/parseFloat(pt)*1e3)/1e3);if(en===0||un===0||(0,ee.Sh)(Y)&&!(0,k.Z)(Y))return;var Vt=ge.offset,Bt=ge.targetOffset,Ft=fe(qe,Vt),be=(0,re.Z)(Ft,2),Ze=be[0],nt=be[1],je=fe(B,Bt),ft=(0,re.Z)(je,2),vt=ft[0],xt=ft[1];B.x-=vt,B.y-=xt;var Ct=ge.points||[],cn=(0,re.Z)(Ct,2),Yt=cn[0],wn=cn[1],Jt=ye(wn),qt=ye(Yt),sn=Oe(B,Jt),on=Oe(qe,qt),pn=(0,N.Z)({},ge),Ht=sn.x-on.x+Ze,Xt=sn.y-on.y+nt,An=ei(Ht,Xt),rn=ei(Ht,Xt,an),nn=Oe(B,["t","l"]),Rn=Oe(qe,["t","l"]),fn=Oe(B,["b","r"]),yn=Oe(qe,["b","r"]),Zn=ge.overflow||{},Pn=Zn.adjustX,En=Zn.adjustY,bn=Zn.shiftX,Yn=Zn.shiftY,Wn=function(Di){return typeof Di=="boolean"?Di:Di>=0},hn,ni,Jn,Mn;Un();var di=Wn(En),xn=qt[0]===Jt[0];if(di&&qt[0]==="t"&&(ni>Cn.bottom||Qe.current.bt)){var hi=Xt;xn?hi-=Sn-Je:hi=nn.y-yn.y-nt;var Li=ei(Ht,hi),Ci=ei(Ht,hi,an);Li>An||Li===An&&(!In||Ci>=rn)?(Qe.current.bt=!0,Xt=hi,nt=-nt,pn.points=[Ne(qt,0),Ne(Jt,0)]):Qe.current.bt=!1}if(di&&qt[0]==="b"&&(hn<Cn.top||Qe.current.tb)){var _i=Xt;xn?_i+=Sn-Je:_i=fn.y-Rn.y-nt;var ki=ei(Ht,_i),oi=ei(Ht,_i,an);ki>An||ki===An&&(!In||oi>=rn)?(Qe.current.tb=!0,Xt=_i,nt=-nt,pn.points=[Ne(qt,0),Ne(Jt,0)]):Qe.current.tb=!1}var li=Wn(Pn),Pi=qt[1]===Jt[1];if(li&&qt[1]==="l"&&(Mn>Cn.right||Qe.current.rl)){var vi=Ht;Pi?vi-=gt-wt:vi=nn.x-yn.x-Ze;var gi=ei(vi,Xt),jn=ei(vi,Xt,an);gi>An||gi===An&&(!In||jn>=rn)?(Qe.current.rl=!0,Ht=vi,Ze=-Ze,pn.points=[Ne(qt,1),Ne(Jt,1)]):Qe.current.rl=!1}if(li&&qt[1]==="r"&&(Jn<Cn.left||Qe.current.lr)){var fi=Ht;Pi?fi+=gt-wt:fi=fn.x-Rn.x-Ze;var Hn=ei(fi,Xt),Oi=ei(fi,Xt,an);Hn>An||Hn===An&&(!In||Oi>=rn)?(Qe.current.lr=!0,Ht=fi,Ze=-Ze,pn.points=[Ne(qt,1),Ne(Jt,1)]):Qe.current.lr=!1}Un();var ii=bn===!0?0:bn;typeof ii=="number"&&(Jn<an.left&&(Ht-=Jn-an.left-Ze,B.x+wt<an.left+ii&&(Ht+=B.x-an.left+wt-ii)),Mn>an.right&&(Ht-=Mn-an.right-Ze,B.x>an.right-ii&&(Ht+=B.x-an.right+ii)));var ui=Yn===!0?0:Yn;typeof ui=="number"&&(hn<an.top&&(Xt-=hn-an.top-nt,B.y+Je<an.top+ui&&(Xt+=B.y-an.top+Je-ui)),ni>an.bottom&&(Xt-=ni-an.bottom-nt,B.y>an.bottom-ui&&(Xt+=B.y-an.bottom+ui)));var Ai=qe.x+Ht,Zt=Ai+gt,$i=qe.y+Xt,Ki=$i+Sn,Ni=B.x,Bi=Ni+wt,rs=B.y,ds=rs+Je,Gi=Math.max(Ai,Ni),_n=Math.min(Zt,Bi),ps=(Gi+_n)/2,gs=ps-Ai,Yi=Math.max($i,rs),qi=Math.min(Ki,ds),Xi=(Yi+qi)/2,zi=Xi-$i;G==null||G(le,pn);var ci=Ii.right-qe.x-(Ht+qe.width),Ei=Ii.bottom-qe.y-(Xt+qe.height);en===1&&(Ht=Math.round(Ht),ci=Math.round(ci)),un===1&&(Xt=Math.round(Xt),Ei=Math.round(Ei));var bi={ready:!0,offsetX:Ht/en,offsetY:Xt/un,offsetR:ci/en,offsetB:Ei/un,arrowX:gs/en,arrowY:zi/un,scaleX:en,scaleY:un,align:pn};Le(bi)}}),He=function(){$e.current+=1;var xe=$e.current;Promise.resolve().then(function(){$e.current===xe&&Ve()})},_t=function(){Le(function(xe){return(0,N.Z)((0,N.Z)({},xe),{},{ready:!1})})};return(0,p.Z)(_t,[Te]),(0,p.Z)(function(){ce||_t()},[ce]),[we.ready,we.offsetX,we.offsetY,we.offsetR,we.offsetB,we.arrowX,we.arrowY,we.scaleX,we.scaleY,we.align,He]}var Me=O(3300);function Ae(ce,le,Y,Te,ke){(0,p.Z)(function(){if(ce&&le&&Y){let $e=function(){Te(),ke()};var Ke=le,G=Y,q=K(Ke),me=K(G),we=W(G),Le=new Set([we].concat((0,Me.Z)(q),(0,Me.Z)(me)));return Le.forEach(function(yt){yt.addEventListener("scroll",$e,{passive:!0})}),we.addEventListener("resize",$e,{passive:!0}),Te(),function(){Le.forEach(function(yt){yt.removeEventListener("scroll",$e),we.removeEventListener("resize",$e)})}}},[ce,le,Y])}var dt=O(48736);function Ce(ce,le,Y,Te,ke,Ke,G,q){var me=y.useRef(ce);me.current=ce;var we=y.useRef(!1);y.useEffect(function(){if(le&&Te&&(!ke||Ke)){var $e=function(){we.current=!1},yt=function(ct){var Xe;me.current&&!G(((Xe=ct.composedPath)===null||Xe===void 0||(Xe=Xe.call(ct))===null||Xe===void 0?void 0:Xe[0])||ct.target)&&!we.current&&q(!1)},Qe=W(Te);Qe.addEventListener("pointerdown",$e,!0),Qe.addEventListener("mousedown",yt,!0),Qe.addEventListener("contextmenu",yt,!0);var et=(0,l.A)(Y);if(et&&(et.addEventListener("mousedown",yt,!0),et.addEventListener("contextmenu",yt,!0)),0)var Ve,He,_t,ht;return function(){Qe.removeEventListener("pointerdown",$e,!0),Qe.removeEventListener("mousedown",yt,!0),Qe.removeEventListener("contextmenu",yt,!0),et&&(et.removeEventListener("mousedown",yt,!0),et.removeEventListener("contextmenu",yt,!0))}}},[le,Y,Te,ke,Ke]);function Le(){we.current=!0}return Le}var rt=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function Pe(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ne.Z,le=y.forwardRef(function(Y,Te){var ke=Y.prefixCls,Ke=ke===void 0?"rc-trigger-popup":ke,G=Y.children,q=Y.action,me=q===void 0?"hover":q,we=Y.showAction,Le=Y.hideAction,$e=Y.popupVisible,yt=Y.defaultPopupVisible,Qe=Y.onPopupVisibleChange,et=Y.afterPopupVisibleChange,Ve=Y.mouseEnterDelay,He=Y.mouseLeaveDelay,_t=He===void 0?.1:He,ht=Y.focusDelay,xe=Y.blurDelay,ct=Y.mask,Xe=Y.maskClosable,We=Xe===void 0?!0:Xe,Et=Y.getPopupContainer,St=Y.forceRender,mt=Y.autoDestroy,st=Y.destroyPopupOnHide,Pt=Y.popup,ot=Y.popupClassName,bt=Y.popupStyle,Ee=Y.popupPlacement,pe=Y.builtinPlacements,ge=pe===void 0?{}:pe,L=Y.popupAlign,B=Y.zIndex,Q=Y.stretch,ae=Y.getPopupClassNameFromAlign,de=Y.fresh,qe=Y.alignPoint,lt=Y.onPopupClick,pt=Y.onPopupAlign,Tt=Y.arrow,Wt=Y.popupMotion,mn=Y.maskMotion,Qt=Y.popupTransitionName,Ot=Y.popupAnimation,vn=Y.maskTransitionName,Kn=Y.maskAnimation,Ln=Y.className,Sn=Y.getTriggerDOMNode,gt=(0,De.Z)(Y,rt),Je=mt||st||!1,wt=y.useState(!1),jt=(0,re.Z)(wt,2),ln=jt[0],Tn=jt[1];(0,p.Z)(function(){Tn((0,m.Z)())},[]);var ti=y.useRef({}),Qn=y.useContext(_e),In=y.useMemo(function(){return{registerSubPopup:function(zt,On){ti.current[zt]=On,Qn==null||Qn.registerSubPopup(zt,On)}}},[Qn]),Vn=(0,A.Z)(),an=y.useState(null),Bn=(0,re.Z)(an,2),Cn=Bn[0],Ii=Bn[1],en=y.useRef(null),un=(0,j.Z)(function(kt){en.current=kt,(0,ee.Sh)(kt)&&Cn!==kt&&Ii(kt),Qn==null||Qn.registerSubPopup(Vn,kt)}),Vt=y.useState(null),Bt=(0,re.Z)(Vt,2),Ft=Bt[0],be=Bt[1],Ze=y.useRef(null),nt=(0,j.Z)(function(kt){(0,ee.Sh)(kt)&&Ft!==kt&&(be(kt),Ze.current=kt)}),je=y.Children.only(G),ft=(je==null?void 0:je.props)||{},vt={},xt=(0,j.Z)(function(kt){var zt,On,qn=Ft;return(qn==null?void 0:qn.contains(kt))||((zt=(0,l.A)(qn))===null||zt===void 0?void 0:zt.host)===kt||kt===qn||(Cn==null?void 0:Cn.contains(kt))||((On=(0,l.A)(Cn))===null||On===void 0?void 0:On.host)===kt||kt===Cn||Object.values(ti.current).some(function(zn){return(zn==null?void 0:zn.contains(kt))||kt===zn})}),Ct=P(Ke,Wt,Ot,Qt),cn=P(Ke,mn,Kn,vn),Yt=y.useState(yt||!1),wn=(0,re.Z)(Yt,2),Jt=wn[0],qt=wn[1],sn=$e!=null?$e:Jt,on=(0,j.Z)(function(kt){$e===void 0&&qt(kt)});(0,p.Z)(function(){qt($e||!1)},[$e]);var pn=y.useRef(sn);pn.current=sn;var Ht=y.useRef([]);Ht.current=[];var Xt=(0,j.Z)(function(kt){var zt;on(kt),((zt=Ht.current[Ht.current.length-1])!==null&&zt!==void 0?zt:sn)!==kt&&(Ht.current.push(kt),Qe==null||Qe(kt))}),An=y.useRef(),rn=function(){clearTimeout(An.current)},nn=function(zt){var On=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;rn(),On===0?Xt(zt):An.current=setTimeout(function(){Xt(zt)},On*1e3)};y.useEffect(function(){return rn},[]);var Rn=y.useState(!1),fn=(0,re.Z)(Rn,2),yn=fn[0],Zn=fn[1];(0,p.Z)(function(kt){(!kt||sn)&&Zn(!0)},[sn]);var Pn=y.useState(null),En=(0,re.Z)(Pn,2),bn=En[0],Yn=En[1],Wn=y.useState(null),hn=(0,re.Z)(Wn,2),ni=hn[0],Jn=hn[1],Mn=function(zt){Jn([zt.clientX,zt.clientY])},di=ve(sn,Cn,qe&&ni!==null?ni:Ft,Ee,ge,L,pt),xn=(0,re.Z)(di,11),hi=xn[0],Li=xn[1],Ci=xn[2],_i=xn[3],ki=xn[4],oi=xn[5],li=xn[6],Pi=xn[7],vi=xn[8],gi=xn[9],jn=xn[10],fi=ze(ln,me,we,Le),Hn=(0,re.Z)(fi,2),Oi=Hn[0],ii=Hn[1],ui=Oi.has("click"),Ai=ii.has("click")||ii.has("contextMenu"),Zt=(0,j.Z)(function(){yn||jn()}),$i=function(){pn.current&&qe&&Ai&&nn(!1)};Ae(sn,Ft,Cn,Zt,$i),(0,p.Z)(function(){Zt()},[ni,Ee]),(0,p.Z)(function(){sn&&!(ge!=null&&ge[Ee])&&Zt()},[JSON.stringify(L)]);var Ki=y.useMemo(function(){var kt=w(ge,Ke,gi,qe);return g()(kt,ae==null?void 0:ae(gi))},[gi,ae,ge,Ke,qe]);y.useImperativeHandle(Te,function(){return{nativeElement:Ze.current,popupElement:en.current,forceAlign:Zt}});var Ni=y.useState(0),Bi=(0,re.Z)(Ni,2),rs=Bi[0],ds=Bi[1],Gi=y.useState(0),_n=(0,re.Z)(Gi,2),ps=_n[0],gs=_n[1],Yi=function(){if(Q&&Ft){var zt=Ft.getBoundingClientRect();ds(zt.width),gs(zt.height)}},qi=function(){Yi(),Zt()},Xi=function(zt){Zn(!1),jn(),et==null||et(zt)},zi=function(){return new Promise(function(zt){Yi(),Yn(function(){return zt})})};(0,p.Z)(function(){bn&&(jn(),bn(),Yn(null))},[bn]);function ci(kt,zt,On,qn){vt[kt]=function(zn){var ms;qn==null||qn(zn),nn(zt,On);for(var Fi=arguments.length,_s=new Array(Fi>1?Fi-1:0),Ji=1;Ji<Fi;Ji++)_s[Ji-1]=arguments[Ji];(ms=ft[kt])===null||ms===void 0||ms.call.apply(ms,[ft,zn].concat(_s))}}(ui||Ai)&&(vt.onClick=function(kt){var zt;pn.current&&Ai?nn(!1):!pn.current&&ui&&(Mn(kt),nn(!0));for(var On=arguments.length,qn=new Array(On>1?On-1:0),zn=1;zn<On;zn++)qn[zn-1]=arguments[zn];(zt=ft.onClick)===null||zt===void 0||zt.call.apply(zt,[ft,kt].concat(qn))});var Ei=Ce(sn,Ai,Ft,Cn,ct,We,xt,nn),bi=Oi.has("hover"),ei=ii.has("hover"),Un,si;bi&&(ci("onMouseEnter",!0,Ve,function(kt){Mn(kt)}),ci("onPointerEnter",!0,Ve,function(kt){Mn(kt)}),Un=function(zt){(sn||yn)&&Cn!==null&&Cn!==void 0&&Cn.contains(zt.target)&&nn(!0,Ve)},qe&&(vt.onMouseMove=function(kt){var zt;(zt=ft.onMouseMove)===null||zt===void 0||zt.call(ft,kt)})),ei&&(ci("onMouseLeave",!1,_t),ci("onPointerLeave",!1,_t),si=function(){nn(!1,_t)}),Oi.has("focus")&&ci("onFocus",!0,ht),ii.has("focus")&&ci("onBlur",!1,xe),Oi.has("contextMenu")&&(vt.onContextMenu=function(kt){var zt;pn.current&&ii.has("contextMenu")?nn(!1):(Mn(kt),nn(!0)),kt.preventDefault();for(var On=arguments.length,qn=new Array(On>1?On-1:0),zn=1;zn<On;zn++)qn[zn-1]=arguments[zn];(zt=ft.onContextMenu)===null||zt===void 0||zt.call.apply(zt,[ft,kt].concat(qn))}),Ln&&(vt.className=g()(ft.className,Ln));var Di=y.useRef(!1);Di.current||(Di.current=St||sn||yn);var Vi=(0,N.Z)((0,N.Z)({},ft),vt),as={},Qi=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Qi.forEach(function(kt){gt[kt]&&(as[kt]=function(){for(var zt,On=arguments.length,qn=new Array(On),zn=0;zn<On;zn++)qn[zn]=arguments[zn];(zt=Vi[kt])===null||zt===void 0||zt.call.apply(zt,[Vi].concat(qn)),gt[kt].apply(gt,qn)})});var $n=y.cloneElement(je,(0,N.Z)((0,N.Z)({},Vi),as)),ri={x:oi,y:li},os=Tt?(0,N.Z)({},Tt!==!0?Tt:{}):null;return y.createElement(y.Fragment,null,y.createElement(ue.Z,{disabled:!sn,ref:nt,onResize:qi},y.createElement(X,{getTriggerDOMNode:Sn},$n)),Di.current&&y.createElement(_e.Provider,{value:In},y.createElement(J,{portal:ce,ref:un,prefixCls:Ke,popup:Pt,className:g()(ot,Ki),style:bt,target:Ft,onMouseEnter:Un,onMouseLeave:si,onPointerEnter:Un,zIndex:B,open:sn,keepDom:yn,fresh:de,onClick:lt,onPointerDownCapture:Ei,mask:ct,motion:Ct,maskMotion:cn,onVisibleChanged:Xi,onPrepare:zi,forceRender:St,autoDestroy:Je,getPopupContainer:Et,align:gi,arrow:os,arrowPos:ri,ready:hi,offsetX:Li,offsetY:Ci,offsetR:_i,offsetB:ki,onAlign:Zt,stretch:Q,targetWidth:rs/Pi,targetHeight:ps/vi})))});return le}var ut=Pe(ne.Z)},57884:function(Ut,at,O){"use strict";var N=O(59301),re=O(93314),De=O(99571),ne=Object.defineProperty,$=Object.defineProperties,g=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,j=(y,x,M)=>x in y?ne(y,x,{enumerable:!0,configurable:!0,writable:!0,value:M}):y[x]=M,A=(y,x)=>{for(var M in x||(x={}))ee.call(x,M)&&j(y,M,x[M]);if(ue)for(var M of ue(x))l.call(x,M)&&j(y,M,x[M]);return y},p=(y,x)=>$(y,g(x));const m=({img:y,buttonProps:x={},styles:M={},customText:F,ButtonText:z,ButtonClick:I,Buttonclass:C,ButtonTwo:U,imgStyles:H,loading:J=!1,className:he=""})=>N.createElement("section",{className:`tc animated fadeIn ${he}`,style:A({color:"#999",margin:"100px auto",visibility:J?"hidden":"visible"},M)},N.createElement("img",{src:y||re,style:p(A({},H),{pointerEvents:"none",userSelect:"none"})}),N.createElement("p",{className:"mt20 font14"},F||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),z&&N.createElement(De.ZP,A({className:C,onClick:I},x),z),U&&U);at.Z=m},41550:function(Ut,at,O){"use strict";O.d(at,{Z:function(){return C}});var N=O(59301),re={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},De=O(99571),ne=O(70557),$=O(51124),g=O(25399),ue=O(49661),ee=O(72664),l=O(57884),j=O(90524),A=O(14794),p=O(59301),m=Object.defineProperty,y=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,F=(U,H,J)=>H in U?m(U,H,{enumerable:!0,configurable:!0,writable:!0,value:J}):U[H]=J,z=(U,H)=>{for(var J in H||(H={}))x.call(H,J)&&F(U,J,H[J]);if(y)for(var J of y(H))M.call(H,J)&&F(U,J,H[J]);return U},I=(U,H,J)=>new Promise((he,X)=>{var oe=ze=>{try{ie(J.next(ze))}catch(k){X(k)}},_e=ze=>{try{ie(J.throw(ze))}catch(k){X(k)}},ie=ze=>ze.done?he(ze.value):Promise.resolve(ze.value).then(oe,_e);ie((J=J.apply(U,H)).next())}),C=({editOffice:U="view",data:H,issaver:J,onSaver:he,theme:X,type:oe,filename:_e,monacoEditor:ie,className:ze,style:k,close:S,onClose:w,hasMask:P,disabledDownload:W,onImgDimensions:K,showNodata:_,recordInfo:v})=>{const[D,Z]=(0,N.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[fe,ye]=(0,N.useState)(""),[Oe,Ne]=(0,N.useState)(),ve=window.ENV==="build"?"/react/build":"",Me=location.host.startsWith("localhost")?j.Z.PROXY_SERVER:j.Z.API_SERVER,dt=10*(1024*1024),Ce=(0,N.useRef)();H!=null&&H.startsWith("/api")&&oe!=="txt"&&(H=j.Z.API_SERVER+H);const rt=Y=>Y.substring(Y.lastIndexOf("/")+1).split(".").pop();_e&&ie&&(ie.filename=_e),(0,N.useEffect)(()=>{var Y,Te;const ke=(Te=(Y=document.cookie)==null?void 0:Y.replace(/\s/g,""))==null?void 0:Te.split(";");ke==null||ke.map(Ke=>{let G=Ke.split("=");G[0]==="_educoder_session"&&ye(G[1])})},[]),(0,N.useEffect)(()=>{oe==="office"&&(H.indexOf("bigfilescdn.")>-1||H.indexOf("bigfiles1")>-1?Ne({url:H,fileType:rt(H),model:H.indexOf("model=edit")?"edit":"view"}):ut())},[oe,H]);function Pe(Y){return I(this,null,function*(){Y.data.type==="pdfdata"&&(he(Y.data.data),window.removeEventListener("message",Pe,!1)),console.log("mess---:",Y.data)})}const ut=()=>I(void 0,null,function*(){console.log("data:",H);let Y=H;H.startsWith("http")||(Y=location.origin+Y);let Te=new URL(Y).pathname.split("/").pop();const ke=yield(0,ee.gJ)({attachment_id:Te});ke.url=Me+ke.url,Ne(ke)}),ce=()=>{if(H.startsWith("http")||H.startsWith("blob:")){le();return}(0,ue.Sv)(_e||"educoder",H,_e)},le=()=>{v&&(0,A.fc)({id:v==null?void 0:v.id,watch_type:1,course_id:v==null?void 0:v.course_id}),(0,ue.Nd)(_e||"educoder",decodeURIComponent(H))};return p.createElement("div",{style:z({},k||{}),className:`${P&&re.bgBlack} ${oe?re.wrp:"hide"}`},S&&p.createElement("div",{className:re.close,ref:Ce},!!K&&p.createElement(g.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>Ce.current},p.createElement("span",{onClick:()=>{w(),K()}},p.createElement("i",{className:"icon-yulanpizhu"}))),!W&&p.createElement(g.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>Ce.current},p.createElement("span",{onClick:le},p.createElement("i",{className:"icon-quxiaozhiding"}))),J&&p.createElement(g.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>Ce.current},p.createElement("span",{className:"",onClick:()=>{const Y=document.getElementById("pdfiframe");window.addEventListener("message",Pe,!1),setTimeout(()=>{Y.contentWindow.postMessage("getData","*")},300)}},p.createElement("i",{className:"icon-baocun"}))),p.createElement(g.Z,{title:"\u5173\u95ED",getPopupContainer:()=>Ce.current},p.createElement("span",{className:"",onClick:()=>{w()}},p.createElement("i",{className:"icon-guanbi1"})))),p.createElement("div",{className:`${re[ze]} ${ze} ${re.monaco} ${oe==="txt"?"show":"hide"}`},oe==="txt"&&p.createElement(p.Fragment,null,p.createElement($.ZP,z({},ie)))),oe==="audio"&&p.createElement("audio",{src:`${(H==null?void 0:H.indexOf("http://"))>-1||(H==null?void 0:H.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${H}`,autoPlay:!0}),oe==="video"&&p.createElement(p.Fragment,null,(H==null?void 0:H.indexOf("http"))>-1?p.createElement("video",{controls:!0,src:`${H}`,autoPlay:!0}):p.createElement("video",{controls:!0,src:`data:video/mp4;base64,${H}`,autoPlay:!0})),oe==="office"&&Oe&&p.createElement("iframe",{src:`${ve}/office.html?key=${Oe.key}&url=${btoa(Oe.url)}&callbackUrl=${Me+(Oe.callbackUrl||"")}&fileType=${Oe.fileType}&title=${Oe.title||""}&model=${U}&officeServer=${j.Z.ONLYOFFICE}&disabledDownload=${!!W}`}),oe==="html"&&p.createElement("iframe",{src:H+"&disposition=inline"}),oe==="pdf"&&p.createElement("iframe",{id:"pdfiframe",src:`${ve}/js/pdfview/index.html?filename=${_e||"educoder.pdf"}&url=${encodeURIComponent(H)}&disabledDownload=${!!W}&model=${U}`}),oe==="image"&&p.createElement("img",{src:`${(H==null?void 0:H.indexOf("http://"))>-1||(H==null?void 0:H.indexOf("https://"))>-1?"":"data:image/png;base64,"}${H}`}),(oe==="other"||oe==="download")&&p.createElement(p.Fragment,null,_?p.createElement(l.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:p.createElement(De.ZP,{icon:p.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:ce,disabled:W},"\u4E0B\u8F7D")}):p.createElement(De.ZP,{type:"primary",size:"middle",onClick:ce,disabled:W},p.createElement(ne.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")),oe==="flowChart"&&p.createElement("div",{className:"embed"},p.createElement("iframe",{src:`/drawio/src/main/webapp/viewer.html?id=${H||""}&gapi=0&od=0&db=0&gh=0&gl=0`,width:"100%",height:"100%",frameBorder:"0"})))}},38394:function(Ut,at,O){"use strict";O.d(at,{z:function(){return ie},Z:function(){return ze}});var N=O(59301),re=O(88831),De=O(90290),ne=O(64018),$=O(68535),g=O(90524),ue=O(49661),ee=O(15342),l=O(77736),j=O(99571),A=O(1012),p=O(41550),m=O(59301),x=({html:k})=>{const S=(0,N.useRef)(null),w=(0,N.useRef)(null),P=`.markdown-body p {
margin: 0 0 16px 0 !important;
line-height: 28px;
white-space: pre-wrap;
}
ol,
ul,
li {
list-style-type: none
}
ol,
ul,
dl {
margin-bottom: 0px;
}
.markdown-body {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
color: #333;
overflow: hidden;
font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", "Monaco", monospace, Tahoma, STXihei, "\u534E\u6587\u7EC6\u9ED1", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "\u5B8B\u4F53", Heiti, "\u9ED1\u4F53", sans-serif;
word-break: break-word;
font-size: 16px;
line-height: 1.6;
white-space: normal;
word-wrap: break-word;
position: relative;
}
.markdown-body ul>li {
list-style-type: disc;
}
.markdown-body ol>li {
list-style-type: decimal;
}
.markdown-body a {
background: transparent;
}
.markdown-body a:active,
.markdown-body a:hover {
outline: 0;
}
.markdown-body strong {
font-weight: bold;
}
.markdown-body h1 {
font-size: 2em;
margin: 0.67em 0;
}
.markdown-body img {
border: 0;
}
.markdown-body hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
.markdown-body pre {
overflow: auto;
}
.markdown-body code,
.markdown-body kbd,
.markdown-body pre {
font-family: "Meiryo UI", "YaHei Consolas Hybrid", Consolas, "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace;
font-size: 1em;
}
.markdown-body input {
color: inherit;
font: inherit;
margin: 0;
}
.markdown-body html input[disabled] {
cursor: default;
}
.markdown-body input {
line-height: normal;
}
.markdown-body input[type="checkbox"] {
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
.markdown-body table {
border-collapse: collapse;
border-spacing: 0;
}
.markdown-body td,
.markdown-body th {
padding: 0;
}
.markdown-body * {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.markdown-body input {
font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}
.markdown-body a {
color: #4183c4;
text-decoration: none;
}
.markdown-body a:hover,
.markdown-body a:active {
text-decoration: underline;
}
.markdown-body hr {
height: 0;
margin: 15px 0;
overflow: hidden;
background: transparent;
border: 0;
border-bottom: 1px solid #ddd;
}
.markdown-body hr:before {
display: table;
content: "";
}
.markdown-body hr:after {
display: table;
clear: both;
content: "";
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin-top: 15px;
margin-bottom: 15px;
line-height: 1.1;
}
.markdown-body h1 {
font-size: 30px;
}
.markdown-body h2 {
font-size: 21px;
}
.markdown-body h3 {
font-size: 16px;
}
.markdown-body h4 {
font-size: 14px;
}
.markdown-body h5 {
font-size: 12px;
}
.markdown-body h6 {
font-size: 11px;
}
.markdown-body blockquote {
margin: 0;
}
.markdown-body ul,
.markdown-body ol {
padding: 0;
margin-top: 0;
margin-bottom: 0;
}
ul.linenums,
ol.linenums {
padding: 16px 0 0 56px !important;
}
.markdown-body ul,
.markdown-body ol {
padding-left: 2em;
}
.markdown-body ol ol,
.markdown-body ul ol {
list-style-type: lower-roman;
}
.markdown-body ul ul ol,
.markdown-body ul ol ol,
.markdown-body ol ul ol,
.markdown-body ol ol ol {
list-style-type: lower-alpha;
}
.markdown-body dd {
margin-left: 0;
}
.markdown-body code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 12px;
}
.markdown-body pre {
margin-top: 0;
margin-bottom: 0;
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
.markdown-body .octicon {
font: normal normal 16px octicons-anchor;
line-height: 1;
display: inline-block;
text-decoration: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.markdown-body .octicon-link:before {
content: '\f05c';
}
.markdown-body>*:first-child {
margin-top: 0 !important;
}
.markdown-body>*:last-child {
margin-bottom: 0 !important;
}
.markdown-body .anchor {
position: absolute;
top: 0;
left: 0;
display: block;
padding-right: 6px;
padding-left: 30px;
margin-left: -30px;
}
.markdown-body .anchor:focus {
outline: none;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
position: relative;
margin-top: 1em;
margin-bottom: 16px;
font-weight: bold;
line-height: 1.4;
}
.markdown-body h1 .octicon-link,
.markdown-body h2 .octicon-link,
.markdown-body h3 .octicon-link,
.markdown-body h4 .octicon-link,
.markdown-body h5 .octicon-link,
.markdown-body h6 .octicon-link {
display: none;
color: #000;
vertical-align: middle;
}
.markdown-body h1:hover .anchor,
.markdown-body h2:hover .anchor,
.markdown-body h3:hover .anchor,
.markdown-body h4:hover .anchor,
.markdown-body h5:hover .anchor,
.markdown-body h6:hover .anchor {
padding-left: 8px;
margin-left: -30px;
text-decoration: none;
}
.markdown-body h1:hover .anchor .octicon-link,
.markdown-body h2:hover .anchor .octicon-link,
.markdown-body h3:hover .anchor .octicon-link,
.markdown-body h4:hover .anchor .octicon-link,
.markdown-body h5:hover .anchor .octicon-link,
.markdown-body h6:hover .anchor .octicon-link {
display: inline-block;
}
.markdown-body h1 {
padding-bottom: 0.3em;
font-size: 2.25em;
line-height: 1.2;
border-bottom: 1px solid #eee;
}
.markdown-body h1 .anchor {
line-height: 1;
}
.markdown-body h2 {
padding-bottom: 0.3em;
font-size: 1.75em;
line-height: 1.225;
border-bottom: 1px solid #eee;
}
.markdown-body h2 .anchor {
line-height: 1;
}
.markdown-body h3 {
font-size: 1.5em;
line-height: 1.43;
}
.markdown-body h3 .anchor {
line-height: 1.2;
}
.markdown-body h4 {
font-size: 1.25em;
}
.markdown-body h4 .anchor {
line-height: 1.2;
}
.markdown-body h5 {
font-size: 1em;
}
.markdown-body h5 .anchor {
line-height: 1.1;
}
.markdown-body h6 {
font-size: 1em;
color: #777;
}
.markdown-body h6 .anchor {
line-height: 1.1;
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
}
.markdown-body ul ul,
.markdown-body ul ol,
.markdown-body ol ol,
.markdown-body ol ul {
margin-top: 0;
margin-bottom: 0;
}
.markdown-body li>p {
margin-top: 16px;
}
.markdown-body dl {
padding: 0;
}
.markdown-body dl dt {
padding: 0;
margin-top: 16px;
font-size: 1em;
font-style: italic;
font-weight: bold;
}
.markdown-body dl dd {
padding: 0 16px;
margin-bottom: 16px;
}
.markdown-body blockquote {
padding: 0 15px;
color: #777;
border-left: 4px solid #ddd;
}
.markdown-body blockquote> :first-child {
margin-top: 0;
}
.markdown-body blockquote> :last-child {
margin-bottom: 0;
}
.markdown-body table {
display: block;
width: 100%;
overflow: auto;
word-break: normal;
word-break: keep-all;
}
.markdown-body table th {
font-weight: bold;
text-align: revert;
}
.markdown-body table th,
.markdown-body table td {
padding: 6px 13px;
border: 1px solid #ddd;
}
.markdown-body table tr {
background-color: #fff;
border-top: 1px solid #ccc;
}
.markdown-body table tr:nth-child(2n) {
background-color: #f8f8f8;
}
.markdown-body img {
max-width: 100%;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.markdown-body code {
padding: 0;
padding-top: 0.2em;
padding-bottom: 0.2em;
margin: 0;
font-size: 85%;
background-color: rgba(0, 0, 0, 0.04);
border-radius: 3px;
}
.markdown-body code:has(.katex) {
background-color: transparent;
}
.markdown-body code:before,
.markdown-body code:after {
letter-spacing: -0.2em;
content: "\\00a0";
}
.markdown-body pre>code {
padding: 0;
margin: 0;
font-size: 100%;
word-break: normal;
white-space: pre;
background: transparent;
border: 0;
}
.markdown-body .highlight {
margin-bottom: 16px;
}
.markdown-body .highlight pre,
.markdown-body pre {
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: #f7f7f7;
border-radius: 3px;
}
.markdown-body .highlight pre {
margin-bottom: 0;
word-break: normal;
}
.markdown-body pre {
word-wrap: normal;
}
.markdown-body pre code {
display: inline;
max-width: initial;
padding: 0;
margin: 0;
overflow: initial;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0;
}
.markdown-body pre code:before,
.markdown-body pre code:after {
content: normal;
}
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
.markdown-body .pl-c {
color: #969896;
}
.markdown-body .pl-c1,
.markdown-body .pl-mdh,
.markdown-body .pl-mm,
.markdown-body .pl-mp,
.markdown-body .pl-mr,
.markdown-body .pl-s1 .pl-v,
.markdown-body .pl-s3,
.markdown-body .pl-sc,
.markdown-body .pl-sv {
color: #0086b3;
}
.markdown-body .pl-e,
.markdown-body .pl-en {
color: #795da3;
}
.markdown-body .pl-s1 .pl-s2,
.markdown-body .pl-smi,
.markdown-body .pl-smp,
.markdown-body .pl-stj,
.markdown-body .pl-vo,
.markdown-body .pl-vpf {
color: #333;
}
.markdown-body .pl-ent {
color: #63a35c;
}
.markdown-body .pl-k,
.markdown-body .pl-s,
.markdown-body .pl-st {
color: #a71d5d;
}
.markdown-body .pl-pds,
.markdown-body .pl-s1,
.markdown-body .pl-s1 .pl-pse .pl-s2,
.markdown-body .pl-sr,
.markdown-body .pl-sr .pl-cce,
.markdown-body .pl-sr .pl-sra,
.markdown-body .pl-sr .pl-sre,
.markdown-body .pl-src {
color: #df5000;
}
.markdown-body .pl-mo,
.markdown-body .pl-v {
color: #1d3e81;
}
.markdown-body .pl-id {
color: #b52a1d;
}
.markdown-body .pl-ii {
background-color: #b52a1d;
color: #f8f8f8;
}
.markdown-body .pl-sr .pl-cce {
color: #63a35c;
font-weight: bold;
}
.markdown-body .pl-ml {
color: #693a17;
}
.markdown-body .pl-mh,
.markdown-body .pl-mh .pl-en,
.markdown-body .pl-ms {
color: #1d3e81;
font-weight: bold;
}
.markdown-body .pl-mq {
color: #008080;
}
.markdown-body .pl-mi {
color: #333;
font-style: italic;
}
.markdown-body .pl-mb {
color: #333;
font-weight: bold;
}
.markdown-body .pl-md,
.markdown-body .pl-mdhf {
background-color: #ffecec;
color: #bd2c00;
}
.markdown-body .pl-mdht,
.markdown-body .pl-mi1 {
background-color: #eaffea;
color: #55a532;
}
.markdown-body .pl-mdr {
color: #795da3;
font-weight: bold;
}
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
.markdown-body .task-list-item {
list-style-type: none;
}
.markdown-body .task-list-item+.task-list-item {
margin-top: 3px;
}
.markdown-body .task-list-item input {
float: left;
margin: 0.3em 0 0.25em -1.6em;
vertical-align: middle;
}
.markdown-body :checked+.radio-label {
z-index: 1;
position: relative;
border-color: #4183c4;
}
/*! Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
.pln {
color: #000
}
/* plain text */
@media screen {
.str {
color: #080
}
/* string content */
.kwd {
color: #008
}
/* a keyword */
.com {
color: #800
}
/* a comment */
.typ {
color: #606
}
/* a type name */
.lit {
color: #066
}
/* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun,
.opn,
.clo {
color: #660
}
.tag {
color: #008
}
/* a markup tag name */
.atn {
color: #606
}
/* a markup attribute name */
.atv {
color: #080
}
/* a markup attribute value */
.dec,
.var {
color: #606
}
/* a declaration; a variable name */
.fun {
color: red
}
/* a function name */
}
/* Use higher contrast and text-weight for printable form. */
@media print,
projection {
.str {
color: #060
}
.kwd {
color: #006;
font-weight: bold
}
.com {
color: #600;
font-style: italic
}
.typ {
color: #404;
font-weight: bold
}
.lit {
color: #044
}
.pun,
.opn,
.clo {
color: #440
}
.tag {
color: #006;
font-weight: bold
}
.atn {
color: #404
}
.atv {
color: #060
}
}
/* Put a border around prettyprinted code snippets. */
pre.prettyprint {
padding: 2px;
/* border: 1px solid #888 */
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0
}
/* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 {
list-style-type: none
}
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 {
background: #eee
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
}`;return(0,N.useEffect)(()=>{const W=S.current.attachShadow({mode:"open"});w.current=document.createElement("div"),w.current.className="markdown-body",w.current.innerHTML=k,W.appendChild(w.current);const K=document.createElement("style");return K.textContent=P,W.appendChild(K),()=>{W.innerHTML=""}},[]),(0,N.useEffect)(()=>{w.current&&(w.current.innerHTML=k)},[k]),m.createElement("div",{ref:S})};function M(k){const S=["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"],w=new RegExp(`\\b(${S.join("|")})\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]*)`,"gi");return k.replace(w,"").trim()}var F={mdBody:"mdBody___raKXb",button:"button___Ch5Pc",previewFlowChart:"previewFlowChart___vY1dq"},z=Object.defineProperty,I=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,H=(k,S,w)=>S in k?z(k,S,{enumerable:!0,configurable:!0,writable:!0,value:w}):k[S]=w,J=(k,S)=>{for(var w in S||(S={}))C.call(S,w)&&H(k,w,S[w]);if(I)for(var w of I(S))U.call(S,w)&&H(k,w,S[w]);return k};const he="@\u2581\u2581@",X="@\u2581@",oe=/<pre[^>]*>/g;function _e(k){let S=document.createElement("div");return S.innerHTML=k,S.childNodes.length===0?"":S.childNodes[0].nodeValue}const ie=(k,S)=>{k=k||"";const w=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,P=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,W=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,K=/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return S?k.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(w,(_,v,D,Z,fe,ye,Oe)=>{const Ne=v||Z||ye,ve=D||fe||Oe||"?";return g.Z.API_SERVER+"/api/attachments/"+Ne+ve+"&t="+(0,ue.Jn)(Ne,Date.now())+(_.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(k=k.replace(K,(_,v,D,Z,fe,ye,Oe)=>{const Ne=v||Z||ye,ve=D||fe||Oe||"?";return g.Z.API_SERVER+"/attachments/download/"+Ne+ve+"&t="+(0,ue.Jn)(Ne,Date.now())+(_.indexOf(")")>-1?")":"&")}).replace(w,(_,v,D,Z,fe,ye,Oe)=>{const Ne=v||Z||ye,ve=D||fe||Oe||"?";return g.Z.API_SERVER+"/api/attachments/"+Ne+ve+"&t="+(0,ue.Jn)(Ne,Date.now())+(_.indexOf(")")>-1?")":"&")}).replace(P,(_,v,D,Z,fe)=>{const ye=v||Z,Oe=D||fe||"";return'"'+g.Z.API_SERVER+"/api/attachments/"+ye+Oe+ye+Oe+"&t="+(0,ue.Jn)(ye,Date.now())}).replace(W,(_,v,D,Z,fe)=>{const ye=v||Z,Oe=D||fe||"";return"("+g.Z.API_SERVER+"/files/uploads/"+ye+Oe+ye+Oe+"&t="+(0,ue.Jn)(ye,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,`
`),k)};var ze=({value:k="",edit:S=!1,className:w,showTextOnly:P,showLines:W,style:K={},stylesPrev:_={},highlightKeywords:v,showProgramFill:D,isProgramFill:Z,disabledFill:fe=!1,programFillValue:ye,openEditor:Oe=()=>{},onFillChange:Ne=Ae=>{},onFillBlur:ve=()=>{},onFillFocus:Me=()=>{}})=>{let Ae=M(String(k||""));const dt=(0,N.useRef)(),Ce=(0,N.useRef)(),[rt,Pe]=(0,N.useState)(""),[ut,ce]=(0,N.useState)("office"),[le,Y]=(0,N.useState)([]),Te=(0,N.useRef)("a"+(0,A.Z)()),ke={},Ke=xe=>/<style[\s\S]*?>/i.test(xe||""),G=(xe,ct,Xe)=>{const We=document.createElement(xe===X?"input":"textarea");We.style.width="100%",We.style.height=xe===X?"40px":"151px",We.rows=5,We.spellcheck=!1,We.name="edu-program-fill",We.placeholder="\u8BF7\u8F93\u5165",We.dataset.id=ct;const Et=Object.keys(ke).length;return ke[Et]=We,`<span class="edu-program-fill-wrap ${xe===X?"":"show"}" style="width:${xe===X?"600px":"100%"}" title=${Xe||""}><span>${We.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function q(xe){return xe=xe.replace(/!\[.*?\]\(.*?\)/g,""),xe=xe.replace(/\[.*?\]\(.*?\)/g,""),xe=xe.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),xe=xe.replace(/<embed.*?>/g,""),xe=xe.replace(/<img.*?>/g,""),xe=xe.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),xe=xe.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),xe=xe.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),xe=xe.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),xe}const me=xe=>!P&&Ke(Ae)?xe:xe.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(ct,Xe){let We=Xe.replace(/(\n|\r)/g,"").split("}"),Et=[];return We.map(St=>{St!=""&&Et.push(`.${Te.current} ${St}`)}),`<style>${Et.join("}")}</style>`}),we=(0,N.useMemo)(()=>{try{const We=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,Et=/\"\/api\/attachments\/|\"\/attachments\/download\//g,St=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,mt=/\(\/attachments\/download\//g;Ae=Ae.replace(mt,"("+g.Z.API_SERVER+"/attachments/download/").replace(We,"("+g.Z.API_SERVER+"/api/attachments/").replace(Et,'"'+g.Z.API_SERVER+"/api/attachments/").replace(St,'"'+g.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`),dt.current.style.display="none"}catch(We){}if(D){let We=-1;return Ae=Ae.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,function(Et,St,mt){var st;return++We,G(Et,We,(st=ye==null?void 0:ye[We])==null?void 0:st.value.replaceAll("<","&lt;").replaceAll(">","&gt;"))}),`<pre style="background:#fff;padding:4px">${me(Ae||"")}</pre>`}let xe=me(Ae);xe=(0,De.ZP)(xe);const ct=(0,De.ez)();Ae.match(/\[TOC\]/)&&(xe=xe.replace("<p>[TOC]</p>",(0,De.Qv)()),(0,De.Iy)()),xe=xe.replace(/(__special_katext_id_\d+__)/g,(We,Et)=>{const{type:St,expression:mt}=ct[Et];return(0,ee.renderToString)(_e(mt)||"",{displayMode:St==="block",throwOnError:!1,output:"html"})}),xe=xe.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,De.AL)();const Xe=document.createElement("div");if(Xe.innerHTML=xe,P)return Xe.innerText;if(v){const We=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return Qe(Xe,We),Xe.innerHTML}return setTimeout(()=>He(),500),Xe.innerHTML},[Ae,v]);(0,N.useEffect)(()=>{et.current&&et.current.querySelectorAll(["input","textarea"]).forEach(ct=>{ct.oninput=Le,ct.onblur=$e,ct.onfocus=yt})},[le]),(0,N.useEffect)(()=>{var xe,ct,Xe,We,Et;if(ye!=null&&ye.length)try{const St=et.current.querySelectorAll(".edu-program-fill-score"),mt=et.current.querySelectorAll('[name="edu-program-fill"]');for(const[st,Pt]of mt.entries())Pt.value=((xe=ye==null?void 0:ye[st])==null?void 0:xe.value)||"",((ct=ye==null?void 0:ye[st])==null?void 0:ct.type)==="warning"?Pt.className="program-fill-warning":((Xe=ye==null?void 0:ye[st])==null?void 0:Xe.type)==="success"?Pt.className="program-fill-success":Pt.className="";for(const[st,Pt]of St.entries())Pt.innerHTML=(We=ye==null?void 0:ye[st])!=null&&We.score?`${(Et=ye==null?void 0:ye[st])==null?void 0:Et.score}\u5206`:"";Y(ye)}catch(St){console.log(St,"error")}},[ye]);const Le=xe=>{le[xe.target.dataset.id]=le[xe.target.dataset.id]||{},le[xe.target.dataset.id].value=xe.target.value,Y([...le]),Ne(le,xe.target.dataset.id)},$e=xe=>{le[xe.target.dataset.id]=le[xe.target.dataset.id]||{},le[xe.target.dataset.id].value=xe.target.value,Y([...le]),ve(le,xe.target.dataset.id)},yt=xe=>{le[xe.target.dataset.id]=le[xe.target.dataset.id]||{},le[xe.target.dataset.id].value=xe.target.value,Y([...le]),Me(le,xe.target.dataset.id)};function Qe(xe,ct){return xe.childNodes.forEach(Xe=>{var We;if(Xe.childNodes.length>0)Qe(Xe,ct);else if(Xe.nodeName!=="IMG")if(Xe.innerHTML)Xe.innerHTML=(We=Xe.innerHTML)==null?void 0:We.replace(new RegExp(ct,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const Et=document.createElement("span");Et.innerHTML=Xe.textContent.replace(new RegExp(ct,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),Xe.replaceWith(Et)}})}const et=(0,N.useRef)();De.jb.WebkitLineClamp=W,W&&(K=J(J({},K),De.jb));function Ve(xe){let ct=xe.target;if(ct.tagName.toUpperCase()==="A"){let Xe=ct.getAttribute("href");if(Xe.indexOf("office")>-1)xe.preventDefault(),Pe(Xe),ce("office");else if(Xe.indexOf("application/pdf")>-1)xe.preventDefault(),Pe(Xe),ce("pdf");else if(Xe.indexOf("text/html")>-1)xe.preventDefault(),Pe(Xe),ce("html");else if(Xe.startsWith("#")){xe.preventDefault();let We=document.getElementById(Xe.replace("#",""));We&&We.scrollIntoView(!0)}}}const He=()=>{var xe;const ct=(xe=et.current)==null?void 0:xe.querySelectorAll("video");ct==null||ct.forEach(Xe=>{if(Xe.oncontextmenu=()=>!1,Xe.src.indexOf(".m3u8")>-1&&!Xe.canPlayType("application/vnd.apple.mpegurl")){if($.ZP.isSupported()){var We=new $.ZP;We.loadSource(Xe.src),We.attachMedia(Xe)}}})};(0,N.useEffect)(()=>{if(et.current&&we&&we.match(oe)&&window.PR.prettyPrint(),et.current)return et.current.addEventListener("click",Ve),()=>{var xe;(xe=et.current)==null||xe.removeEventListener("click",Ve),(0,De.AL)(),(0,De.Iy)()}},[we,et.current,Ve]);const _t=xe=>{xe.target.nodeName==="IMG"&&xe.target.className.indexOf("draw-flowchart")>-1?(dt.current.style.zIndex=1,dt.current.style.display="flex",dt.current.style.width=xe.target.clientWidth+"px",dt.current.style.height=xe.target.clientHeight+"px",dt.current.style.top=xe.target.offsetTop+"px",dt.current.style.left=xe.target.offsetLeft+"px",xe.target.id&&(Ce.current=xe.target.id)):dt.current.style.display="none"},ht=()=>{dt.current.style.display="none"};return(0,N.useEffect)(()=>{var xe;const ct=Xe=>{Xe.preventDefault(),Xe.clipboardData.setData("text",window.getSelection().toString())};return(xe=et.current)==null||xe.addEventListener("copy",ct),()=>{var Xe;(Xe=et.current)==null||Xe.removeEventListener("copy",ct)}},[et.current]),N.createElement("div",{style:{position:"relative"},onMouseLeave:ht},P&&N.createElement("div",{ref:et,className:`${F.mdBody} `},we),!P&&!Ke(we)&&N.createElement("div",{ref:et,style:J({},K),onMouseOver:_t,className:`${w||""} ${fe?"disabled-fill":""} markdown-body ${F.mdBody} ${Te.current}`,dangerouslySetInnerHTML:{__html:we}}),!P&&Ke(we)&&N.createElement(x,{html:we}),N.createElement("div",{ref:dt,className:`${F.button} ${S?"":F.previewFlowChart}`},N.createElement(l.Z,null,N.createElement(j.ZP,{onClick:()=>{S?Oe(Ce.current):(Pe(Ce.current),ce("flowChart"))}},S?"\u7F16\u8F91":"\u9884\u89C8"))),N.createElement(p.Z,{close:!0,data:rt,type:rt!=null&&rt.length?ut:"",style:J({},_),onClose:()=>Pe("")}))}},51124:function(Ut,at,O){"use strict";O.d(at,{SV:function(){return dt},ZP:function(){return Ae}});var N=O(59301),re=O(76374);const De={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},ne={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},$={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"if",content:["if () {"," $0","}"].join(`
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"include <vector>",content:["#include <vector>"].join(`
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
`)},{label:"include <map>",content:["#include <map>"].join(`
`)},{label:"include <string>",content:["#include <string>"].join(`
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
`)}]},g={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},ue={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],quickKey:[{label:"println",content:["println($0)"].join(`
`)}]};var ee=O(53184),l=O.n(ee),j=(Ce,rt,Pe)=>new Promise((ut,ce)=>{var le=ke=>{try{Te(Pe.next(ke))}catch(Ke){ce(Ke)}},Y=ke=>{try{Te(Pe.throw(ke))}catch(Ke){ce(Ke)}},Te=ke=>ke.done?ut(ke.value):Promise.resolve(ke.value).then(le,Y);Te((Pe=Pe.apply(Ce,rt)).next())});const A={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},p=(Ce,rt,Pe,ut)=>{const ce=rt.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:Pe.lineNumber,endColumn:Pe.column});return Array.from(new Set(ce.match(/\b\w{2,}\b/g)||[])).map(Y=>({label:Y,kind:Ce.languages.CompletionItemKind.Text,insertText:Y,range:ut}))},m=(Ce,rt,Pe,ut)=>{Ce.languages.registerCompletionItemProvider(rt,{provideCompletionItems(ce,le){const Y=ce.getWordUntilPosition(le),Te={startLineNumber:le.lineNumber,endLineNumber:le.lineNumber,startColumn:Y.startColumn,endColumn:Y.endColumn},ke=ce.getLineContent(le.lineNumber).substring(Y.startColumn-2,Y.endColumn);return{suggestions:[...p(Ce,ce,le,Te),...Pe.map(G=>({label:G,kind:Ce.languages.CompletionItemKind.Keyword,documentation:G,insertText:G,insertTextRules:Ce.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Te})),...ut.map(G=>({label:G.label,kind:Ce.languages.CompletionItemKind.Snippet,documentation:G.content,insertText:ke.startsWith("#")?G.content.replace(/#/,""):G.content,insertTextRules:Ce.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Te}))]}}})};var y=Ce=>{A.languages.forEach(rt=>{Ce.languages.registerDocumentFormattingEditProvider(rt,{provideDocumentFormattingEdits(Pe){return j(this,null,function*(){const ut=l()(Pe.getValue(),{indent_size:2,indent_char:" ",max_preserve_newlines:2,preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:0,indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1});return[{range:Pe.getFullModelRange(),text:ut}]})}})}),m(Ce,"java",ne.keywords,ne.quickKey),m(Ce,"cpp",$.keywords,$.quickKey),m(Ce,"c",De.keywords,[]),m(Ce,"python",g.keywords,g.quickKey),m(Ce,"scala",ue.keywords,ue.quickKey)};const x="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var M=Object.defineProperty,F=(Ce,rt,Pe)=>rt in Ce?M(Ce,rt,{enumerable:!0,configurable:!0,writable:!0,value:Pe}):Ce[rt]=Pe,z=(Ce,rt,Pe)=>F(Ce,typeof rt!="symbol"?rt+"":rt,Pe);const I=class pl{constructor(rt,Pe,ut){this.placeholder=rt,this.editor=Pe,this.monaco=ut,Pe.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return pl.ID}getDomNode(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.style.width="max-content",this.domNode.textContent=this.placeholder,this.domNode.style.fontStyle="initial",this.domNode.style.color="#D7D7D7",this.domNode.style.pointerEvents="none",this.editor.applyFontInfo(this.domNode)),this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[this.monaco.editor.ContentWidgetPositionPreference.EXACT]}}dispose(){this.editor.removeContentWidget(this)}};z(I,"ID","editor.widget.placeholderHint");var U=I,H=O(96236),J=O(6767),he=O(25399),X=O(89392),oe=O(33796),_e=O(56102),ie=Object.defineProperty,ze=Object.defineProperties,k=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,W=(Ce,rt,Pe)=>rt in Ce?ie(Ce,rt,{enumerable:!0,configurable:!0,writable:!0,value:Pe}):Ce[rt]=Pe,K=(Ce,rt)=>{for(var Pe in rt||(rt={}))w.call(rt,Pe)&&W(Ce,Pe,rt[Pe]);if(S)for(var Pe of S(rt))P.call(rt,Pe)&&W(Ce,Pe,rt[Pe]);return Ce},_=(Ce,rt)=>ze(Ce,k(rt)),v=(Ce,rt)=>{var Pe={};for(var ut in Ce)w.call(Ce,ut)&&rt.indexOf(ut)<0&&(Pe[ut]=Ce[ut]);if(Ce!=null&&S)for(var ut of S(Ce))rt.indexOf(ut)<0&&P.call(Ce,ut)&&(Pe[ut]=Ce[ut]);return Pe},D=(Ce,rt,Pe)=>new Promise((ut,ce)=>{var le=ke=>{try{Te(Pe.next(ke))}catch(Ke){ce(Ke)}},Y=ke=>{try{Te(Pe.throw(ke))}catch(Ke){ce(Ke)}},Te=ke=>ke.done?ut(ke.value):Promise.resolve(ke.value).then(le,Y);Te((Pe=Pe.apply(Ce,rt)).next())});function Z(Ce){return/^\d+$/.test(Ce)?`${Ce}px`:Ce}function fe(){}let ye=!1;const Oe={"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 Ne(Ce=[]){let rt=Ce;if(Array.isArray(Ce)){for(let Pe=0;Pe<Ce.length;Pe++){let ut=Oe[Ce[Pe]];if(ut)return ut}return rt[0]}return Oe[rt]||rt}let ve=null;const Me=()=>D(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch(Ce){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",Ce)}});var Ae=Ce=>{var rt=Ce,{width:Pe="100%",height:ut="100%",value:ce,language:le="javascript",style:Y={},options:Te={},overrideServices:ke={},theme:Ke="vs-dark",onEditBlur:G,isCopy:q=!1,onSave:me,autoHeight:we=!1,forbidCopy:Le=!1,onChange:$e=fe,editorDidMount:yt=fe,onFocus:Qe=fe,onBreakPoint:et=fe,breakPointValue:Ve=[],filename:He="educoder.txt",errorLine:_t,errorContent:ht="",highlightLine:xe,openBreakPoint:ct=!1,placeholder:Xe="",showMiniMap:We=!0}=rt,Et=v(rt,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","isCopy","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint","placeholder","showMiniMap"]);const St=(0,N.useRef)(),mt=(0,N.useRef)({}),st=(0,N.useRef)(),Pt=(0,N.useRef)(),ot=(0,N.useRef)([]),bt=(0,N.useRef)(!1),Ee=(0,N.useRef)(),pe=(0,N.useRef)(),ge=(0,N.useRef)(!1),[L,B]=(0,N.useState)(!1);function Q(){let gt;return St.current&&(gt=new re.Z(Je=>{for(let wt of Je)(wt.target.offsetHeight>0||wt.target.offsetWidth>0)&&mt.current.instance.layout()}),gt.observe(St.current)),gt}function ae(){J.ZP.warning({content:decodeURIComponent(x),key:"monaco-editor-tip"})}const de=()=>{let gt=mt.current.instance;if(ce!=null&&gt&&L){const Je=gt.getModel();Je&&ce!==Je.getValue()&&(ye=!0,Je.setValue(ce),gt.layout(),ye=!1)}};(0,N.useEffect)(()=>{const gt=oe.Z.subscribe("formatDocument",Je=>{var wt;let jt=mt.current.instance;(wt=jt==null?void 0:jt.getAction)==null||wt.call(jt,"editor.action.formatDocument").run()});return window.updateMonacoValue=Je=>{$e(Je)},gt},[]),(0,N.useEffect)(()=>{var gt;let Je=mt.current.instance;Pt.current&&clearTimeout(Pt.current),Pt.current=setTimeout(()=>{de()},500),ce&&(ce!=null&&ce.length)&&((gt=Je==null?void 0:Je.updateOptions)==null||gt.call(Je,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(ce.split(/\r\n|\r|\n/g).length))+3,5)}))},[ce,L,mt.current]),(0,N.useEffect)(()=>{if(_t&&mt.current&&mt.current.instance){let Je=mt.current.instance;Je.changeViewZones(function(wt){var jt=document.createElement("div");jt.style.padding="10px 20px",jt.style.width="calc(100% - 20px)",jt.className="my-error-line-wrp",jt.innerHTML=ht,wt.addZone({afterLineNumber:_t||11,heightInLines:3,domNode:jt})});var gt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Je.addOverlayWidget(gt),Je.revealPositionInCenter({lineNumber:20,column:1})}},[_t,mt.current,L]);const qe=(gt="",Je)=>{if(!gt||gt.trim()==="")return!0;const jt=mt.current.instance.getModel().getLineTokens(Je);let ln=!1;for(let Tn=0;Tn<2;Tn++)jt.getStandardTokenType(Tn)===1&&(ln=!0);return ln};(0,N.useEffect)(()=>{var gt;const Je=(gt=mt.current)==null?void 0:gt.instance;if(Je&&L&&Le){const wt=Je.onDidBlurEditorWidget(()=>{ge.current=!1}),jt=Je.onDidFocusEditorText(()=>{ge.current=!0});return()=>{wt.dispose(),jt.dispose()}}},[mt.current,L,Le]),(0,N.useEffect)(()=>{var gt;if((gt=mt.current)!=null&&gt.instance&&L&&ct){let Je=mt.current.instance,wt=Je.getModel();if(!wt)return;(()=>{var en;let un=[],Vt=[];const Bt=wt.getAllDecorations();for(let be of Bt)be.options.className==="highlighted-line"&&(un.push((en=be==null?void 0:be.range)==null?void 0:en.startLineNumber),Vt.push(be==null?void 0:be.id));if(xe===un[0])return;wt.deltaDecorations(Vt,[]);const Ft=wt.getLineCount();xe&&xe<=Ft&&(Je.deltaDecorations([],[{range:new ve.Range(xe,1,xe,wt.getLineMaxColumn(xe)),options:{isWholeLine:!0,className:"highlighted-line"}}]),Je.revealLineInCenter(xe))})();const ln=(en=!1)=>{var un;let Vt=[],Bt=[];const Ft=wt.getAllDecorations();for(let be of Ft)be.options.linesDecorationsClassName==="breakpoints-select"&&(Vt.push((un=be==null?void 0:be.range)==null?void 0:un.startLineNumber),Bt.push(be==null?void 0:be.id));if(en)return{lines:Vt,ids:Bt};et(Vt)},Tn=en=>D(void 0,null,function*(){let un={range:new ve.Range(en,1,en,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield wt.deltaDecorations([],[un]),ln()}),ti=en=>D(void 0,null,function*(){let un=[];const Vt=Je.getLineDecorations(en);for(let Bt of Vt)Bt.options.linesDecorationsClassName==="breakpoints-select"&&un.push(Bt.id);yield wt.deltaDecorations(un,[]),ln()}),Qn=en=>{let un=Je.getLineDecorations(en);for(let Vt of un)if(Vt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,X.isEqual)(Ve,ln(!0).lines)){wt.deltaDecorations(ln(!0).ids,[]);const en=Ve.map(un=>({range:new ve.Range(un,1,un,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));wt.deltaDecorations([],en)}const In=Je.onDidChangeModelContent(en=>{let un=Je.getPosition();if(un){let Vt=un.lineNumber;clearTimeout(pe.current),pe.current=setTimeout(()=>{qe(wt.getLineContent(Vt),Vt)?ti(Vt):Qn(Vt)?(ti(Vt),Tn(Vt)):ln()},100)}}),Vn=Je.onMouseDown(en=>{var un,Vt,Bt;if(en.target.detail&&((Bt=(Vt=(un=en.target)==null?void 0:un.element)==null?void 0:Vt.className)!=null&&Bt.includes("line-numbers"))){let Ft=en.target.position.lineNumber;if(qe(wt.getLineContent(Ft),Ft))return;Qn(Ft)?ti(Ft):Tn(Ft)}}),an=en=>{let un={range:new ve.Range(en,1,en,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};ot.current=Je.deltaDecorations(ot.current,[un])},Bn=()=>{ot.current=Je.deltaDecorations(ot.current,[])},Cn=Je.onMouseMove(en=>{var un,Vt,Bt;if(Bn(),en.target.detail&&((Bt=(Vt=(un=en.target)==null?void 0:un.element)==null?void 0:Vt.className)!=null&&Bt.includes("line-numbers"))){let Ft=en.target.position.lineNumber;if(qe(wt.getLineContent(Ft),Ft))return;an(Ft)}}),Ii=Je.onMouseLeave(()=>{Bn()});return()=>{In.dispose(),Vn.dispose(),Cn.dispose(),Ii.dispose()}}},[mt.current,L,Ve,xe,ct,le]),(0,N.useEffect)(()=>{var gt;(gt=mt.current)!=null&&gt.instance&&ct&&mt.current.instance.setPosition({lineNumber:0,column:0})},[xe]);function lt(){let gt=mt.current.instance;if(gt){const Je=gt.getSelection(),wt=mt.current.pastePos||{},jt=new ve.Range(wt.startLineNumber||Je.endLineNumber,wt.startColumn||Je.endColumn,wt.endLineNumber||Je.endLineNumber,wt.endColumn||Je.endColumn);setTimeout(()=>{gt.executeEdits("",[{range:jt,text:""}])},300)}}function pt(gt){(window.navigator.platform.match("Mac")?gt.metaKey:gt.ctrlKey)&&gt.keyCode==83&&(gt.preventDefault(),me())}const Tt=()=>{if(we&&mt.current.instance){const gt=mt.current.instance.getContentHeight();Ln(gt<ut?ut:gt)}else Ln(ut)};function Wt(gt){var Je=document.createEvent("MouseEvents");Je.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),gt.dispatchEvent(Je)}const mn=gt=>{if(!ge.current)return;const{keyCode:Je,ctrlKey:wt,metaKey:jt,target:ln,type:Tn}=gt;return(Tn==="paste"||(Je===67||Je===86)&&(jt||wt))&&ln.nodeName==="TEXTAREA"&&(ae(),gt.preventDefault()),!1};function Qt(gt,Je){var wt=window.URL||window.webkitURL||window,jt=new Blob([Je]),ln=document.createElementNS("http://www.w3.org/1999/xhtml","a");ln.href=wt.createObjectURL(jt),ln.download=gt,Wt(ln)}(0,N.useEffect)(()=>{Tt()},[Tt]),(0,N.useEffect)(()=>{St.current&&!L&&Promise.all([O.e(8909),O.e(5028)]).then(O.bind(O,71448)).then(gt=>{try{ve=gt,mt.current.instance=ve.editor.create(St.current,{value:ce,language:Ne(le),theme:Ke,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:We||!1}},ke);const Je=mt.current.instance;let ln=[...H.BH._menuItems].find(In=>In[0]._debugName=="EditorContext")[1],Tn=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],ti=(In,Vn)=>{var an,Bn;let Cn=In._first;do Vn.includes((Bn=(an=Cn.element)==null?void 0:an.command)==null?void 0:Bn.id)&&In._remove(Cn);while(Cn=Cn.next)};if(yt(Je,ve),setTimeout(()=>{Tt(),mt.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{Qt(He||"educoder.txt",Je.getValue())}})},500),mt.current.subscription=Je.onDidChangeModelContent(In=>{bt.current?clearTimeout(Ee.current):(Tt(),$e(Je.getValue(),In)),Ee.current=setTimeout(()=>{bt.current=!1},500)}),window.Monaco||y(ve,Ne(le)),Le&&(ti(ln,Tn),St.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",mn),window.removeEventListener("paste",mn),window.addEventListener("keydown",mn),window.addEventListener("paste",mn)),window.Monaco=ve,G&&Je.onDidBlurEditorWidget(()=>{G(Je.getValue())}),Qe&&Je.onDidFocusEditorText(()=>{Le&&Me(),Qe(Je.getValue())}),Le){Me();try{Je.onDidPaste(In=>{const Vn=Je.getSelection(),an=mt.current.pastePos||{},Bn=new ve.Range(an.startLineNumber||Vn.endLineNumber,an.startColumn||Vn.endColumn,an.endLineNumber||Vn.endLineNumber,an.endColumn||Vn.endColumn);Je.executeEdits("",[{range:In.range,text:""}])})}catch(In){}}let Qn=Q();return Xe&&typeof Xe=="string"&&new U(Xe,Je,ve),B(!0),()=>{const In=mt.current.instance;In.dispose();const Vn=In.getModel();Vn&&Vn.dispose(),mt.current.subscription&&mt.current.subscription.dispose(),Qn.unobserve(St.current)}}catch(Je){}})},[]),(0,N.useEffect)(()=>{if(mt.current.instance&&L)return document.addEventListener("keydown",pt,!1),()=>{document.removeEventListener("keydown",pt)}},[me,L]),(0,N.useEffect)(()=>{let gt=mt.current.instance;if(gt&&L){let Je=Ne(le);ve.editor.setModelLanguage(gt.getModel(),Je)}},[le,L]),(0,N.useEffect)(()=>{mt.current.instance&&L&&ve.editor.setTheme(Ke)},[Ke,L]),(0,N.useEffect)(()=>{let gt=mt.current.instance;st.current=Te,gt&&L&&(gt.updateOptions(K({},Te)),setTimeout(()=>{gt.getModel().updateOptions(K({},Te))},200))},[JSON.stringify(Te),L]),(0,N.useEffect)(()=>{let gt=mt.current.instance;gt&&L&&gt.layout()},[Pe,ut,L]);const[Ot,vn]=(0,N.useState)(Z(Pe)),[Kn,Ln]=(0,N.useState)(Z(ut)),Sn=_(K({},Y),{width:Ot,height:Kn,position:"relative"});return N.createElement("div",{className:"my-monaco-editor",ref:St,style:Sn},q&&N.createElement(_e.CopyToClipboard,{text:ce,onCopy:()=>J.ZP.success("\u590D\u5236\u6210\u529F")},N.createElement(he.Z,{title:"\u590D\u5236\u4EE3\u7801"},N.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},N.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function dt({width:Ce="100%",height:rt="100%",original:Pe,modified:ut,language:ce,options:le={}}){const Y=(0,N.useRef)(),[Te,ke]=(0,N.useState)(null);function Ke(we){let Le;return Y.current&&(Le=new re.Z($e=>{for(let yt of $e)(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&we.layout()}),Le.observe(Y.current)),Le}(0,N.useEffect)(()=>(Y.current&&Promise.all([O.e(8909),O.e(9404)]).then(O.bind(O,2550)).then(we=>{ve=we;const Le=ve.editor.createDiffEditor(Y.current,_(K({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},le),{wordWrap:!0}));ke(Le);let $e=Ke(Le);return()=>{Le.dispose();const yt=Le.getModel();yt&&yt.dispose(),$e.unobserve(Y.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,N.useEffect)(()=>{Te&&Te.setModel({original:ve.editor.createModel(Pe,ce),modified:ve.editor.createModel(ut,ce)})},[Pe,ut,ce,Te]);const G=Z(Ce),q=Z(rt),me={width:G,height:q};return N.createElement("div",{className:"my-diff-editor",ref:Y,style:me})}},97862:function(Ut,at,O){"use strict";O.r(at),O.d(at,{checkedOtherName:function(){return fe},default:function(){return Ne}});var N=O(59301),re=O(76560),De=O(93041),ne=O(24404),$=O(62957),g=O(6767),ue=O(77019),ee=O(5269),l=O(60242),j=O(45685),A=O(25399),p={flex_box_center:"flex_box_center___iNvBA",flex_space_between:"flex_space_between___btrNY",flex_box_vertical_center:"flex_box_vertical_center___jNwqd",flex_box_center_end:"flex_box_center_end___yhhzS",flex_box_column:"flex_box_column___XCG9Z",bg:"bg___pkT5R",title:"title___txwwg",questionIcons:"questionIcons___bUmrp",green:"green___pU_n6",orange:"orange___WqPTj",greenTip:"greenTip___xA46L",redTip:"redTip___cLZrd",orangeTip:"orangeTip___IYw_9",pollDesc:"pollDesc___k8j8U",answered:"answered___Wv6LV",unanswer:"unanswer___HFr5V",anchor:"anchor___wiaGO",answerFlag:"answerFlag___Son3q",answerActive:"answerActive___vadIk",redactivie:"redactivie___lv5Yx",questionItem:"questionItem___eheF5",answerWrap:"answerWrap___q0vMa",answerSubjective:"answerSubjective___g0GxR",otherInput:"otherInput___lNi1t",submitButton:"submitButton___Kwl_S",flexRow:"flexRow___CzS9_",header_style:"header_style___IO875",header_content:"header_content___rvYNy",header_title:"header_title___vaUUE",header_button:"header_button___pO_DR",answerInfo:"answerInfo___pUCTt",answerProgress:"answerProgress___u6eCf",dottedLineWrapper:"dottedLineWrapper___OntUi",leftHalfCircle:"leftHalfCircle___W0Nay",dottedLine:"dottedLine___KvX72",rightHalfCircle:"rightHalfCircle___NshfJ",answerSheetWrap:"answerSheetWrap___slZzY",answerSheetQuestionTitle:"answerSheetQuestionTitle___VK50d",user_info:"user_info___nyGwf",user_label:"user_label___bAPw8",user_value:"user_value___pZ4rK",tag:"tag___yWlIO"},m=O(49661),y=O(64948),x=O(34055),M=O(47889),F=O(37568),I=({itemData:ve,answerData:Me,onSave:Ae=()=>{}})=>{var dt,Ce,rt,Pe;const[ut,ce]=(0,N.useState)([]),[le,Y]=(0,N.useState)(),[Te,ke]=(0,N.useState)();(0,N.useEffect)(()=>{var q;ce(((q=ve==null?void 0:ve.question)==null?void 0:q.answers)||[])},[(dt=ve==null?void 0:ve.question)==null?void 0:dt.answers]),(0,N.useEffect)(()=>{var q,me;Y((me=(q=ve==null?void 0:ve.question)==null?void 0:q.poll_answer_ids)==null?void 0:me[0])},[(Ce=ve==null?void 0:ve.question)==null?void 0:Ce.poll_answer_ids]),(0,N.useEffect)(()=>{var q;ke((q=ve==null?void 0:ve.question)==null?void 0:q.poll_vote_texts)},[(rt=ve==null?void 0:ve.question)==null?void 0:rt.poll_vote_texts]);const Ke=(q,me)=>{var we;Y(q);const Le=(we=ut.find($e=>fe($e.answer_text)))==null?void 0:we.answer_id;q===Le?Ae(me,q,Te):Ae(me,q,"")},G=q=>{var me;if(!le)return;const we=(me=ut.find(Le=>fe(Le.answer_text)))==null?void 0:me.answer_id;le===we?Ae(q,le,Te):Ae(q,le,"")};return N.createElement(M.ZP.Group,{disabled:(0,x.GJ)()||(0,x.dE)()&&((Pe=Me==null?void 0:Me.poll)==null?void 0:Pe.user_poll_status)===1,value:le,onChange:q=>{var me;Ke(q.target.value,(me=ve==null?void 0:ve.question)==null?void 0:me.id)}},ut.map((q,me)=>{var we;return N.createElement("div",{className:`${p.answerWrap} ${p.flexRow}`,key:me},N.createElement(M.ZP,{value:q==null?void 0:q.answer_id},q==null?void 0:q.answer_text),fe(q==null?void 0:q.answer_text)&&(q==null?void 0:q.answer_id)==le&&N.createElement("div",{style:{marginTop:"10px"}},N.createElement(F.default.TextArea,{disabled:(0,x.GJ)()||(0,x.dE)()&&((we=Me==null?void 0:Me.poll)==null?void 0:we.user_poll_status)===1,className:p.otherInput,value:Te,onChange:Le=>ke(Le.target.value),onBlur:Le=>{var $e;return G(($e=ve==null?void 0:ve.question)==null?void 0:$e.id)}})))}))},C=O(62673),H=({itemData:ve,answerData:Me,onSave:Ae=()=>{}})=>{var dt,Ce,rt,Pe;const[ut,ce]=(0,N.useState)([]),[le,Y]=(0,N.useState)(),[Te,ke]=(0,N.useState)();(0,N.useEffect)(()=>{var q;ce(((q=ve==null?void 0:ve.question)==null?void 0:q.answers)||[])},[(dt=ve==null?void 0:ve.question)==null?void 0:dt.answers]),(0,N.useEffect)(()=>{var q;Y((q=ve==null?void 0:ve.question)==null?void 0:q.poll_answer_ids)},[(Ce=ve==null?void 0:ve.question)==null?void 0:Ce.poll_answer_ids]),(0,N.useEffect)(()=>{var q;ke((q=ve==null?void 0:ve.question)==null?void 0:q.poll_vote_texts)},[(rt=ve==null?void 0:ve.question)==null?void 0:rt.poll_vote_texts]);const Ke=(q,me)=>{var we;Y(q);const Le=(we=ut.find($e=>fe($e.answer_text)))==null?void 0:we.answer_id;q.includes(Le)?Ae(me,q,Te):Ae(me,q,"")},G=q=>{var me;if(!(le!=null&&le.length))return;const we=(me=ut.find(Le=>fe(Le.answer_text)))==null?void 0:me.answer_id;le.includes(we)?Ae(q,le,Te):Ae(q,le,"")};return N.createElement(C.default.Group,{style:{display:"block"},disabled:(0,x.GJ)()||(0,x.dE)()&&((Pe=Me==null?void 0:Me.poll)==null?void 0:Pe.user_poll_status)===1,value:le,onChange:q=>{var me;Ke(q,(me=ve==null?void 0:ve.question)==null?void 0:me.id)}},ut==null?void 0:ut.map((q,me)=>{var we;return N.createElement("div",{className:`${p.answerWrap} ${p.flexRow}`},N.createElement(C.default,{value:q==null?void 0:q.answer_id},q==null?void 0:q.answer_text),fe(q==null?void 0:q.answer_text)&&(le==null?void 0:le.includes(q==null?void 0:q.answer_id))&&N.createElement("div",{style:{marginTop:"10px"}},N.createElement(F.default.TextArea,{disabled:(0,x.GJ)()||(0,x.dE)()&&((we=Me==null?void 0:Me.poll)==null?void 0:we.user_poll_status)===1,className:p.otherInput,value:Te,onChange:Le=>ke(Le.target.value),onBlur:Le=>{var $e;return G(($e=ve==null?void 0:ve.question)==null?void 0:$e.id)}})))}))},he=({itemData:ve,answerData:Me,onSave:Ae=()=>{}})=>{var dt,Ce;const[rt,Pe]=(0,N.useState)();return(0,N.useEffect)(()=>{var ut;Pe((ut=ve==null?void 0:ve.question)==null?void 0:ut.poll_vote_texts)},[(dt=ve==null?void 0:ve.question)==null?void 0:dt.poll_vote_texts]),N.createElement("div",null,N.createElement("textarea",{className:p.answerSubjective,placeholder:"\u5728\u6B64\u586B\u5165\u7B54\u6848",disabled:(0,x.GJ)()||(0,x.dE)()&&((Ce=Me==null?void 0:Me.poll)==null?void 0:Ce.user_poll_status)===1,value:rt,onChange:ut=>Pe(ut.target.value),onBlur:ut=>{var ce;return Ae((ce=ve==null?void 0:ve.question)==null?void 0:ce.id,null,rt)}}))},X=O(38394),oe=O(15075),_e=O(43531),ie=O(59301),ze=Object.defineProperty,k=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,P=(ve,Me,Ae)=>Me in ve?ze(ve,Me,{enumerable:!0,configurable:!0,writable:!0,value:Ae}):ve[Me]=Ae,W=(ve,Me)=>{for(var Ae in Me||(Me={}))S.call(Me,Ae)&&P(ve,Ae,Me[Ae]);if(k)for(var Ae of k(Me))w.call(Me,Ae)&&P(ve,Ae,Me[Ae]);return ve},K=(ve,Me)=>{var Ae={};for(var dt in ve)S.call(ve,dt)&&Me.indexOf(dt)<0&&(Ae[dt]=ve[dt]);if(ve!=null&&k)for(var dt of k(ve))Me.indexOf(dt)<0&&w.call(ve,dt)&&(Ae[dt]=ve[dt]);return Ae},_=(ve,Me,Ae)=>new Promise((dt,Ce)=>{var rt=ce=>{try{ut(Ae.next(ce))}catch(le){Ce(le)}},Pe=ce=>{try{ut(Ae.throw(ce))}catch(le){Ce(le)}},ut=ce=>ce.done?dt(ce.value):Promise.resolve(ce.value).then(rt,Pe);ut((Ae=Ae.apply(ve,Me)).next())});const{SubMenu:v}=De.default,{Content:D,Sider:Z}=ne.default,fe=ve=>ve==="\u5176\u4ED6"||ve==="\u5176\u5B83",ye={1:"\u5355\u9009",2:"\u591A\u9009",3:"\u95EE\u7B54"},Oe=ve=>{var Me=ve,{globalSetting:Ae,loading:dt,user:Ce,dispatch:rt}=Me,Pe=K(Me,["globalSetting","loading","user","dispatch"]),ut,ce,le,Y,Te,ke,Ke,G,q,me,we,Le,$e,yt,Qe,et;const Ve=(0,re.useParams)(),[He,_t]=(0,N.useState)({}),[ht,xe]=(0,N.useState)(!1),[ct,Xe]=(0,N.useState)([{id:1,name:"\u5355\u9009\u9898",open:!0},{id:2,name:"\u591A\u9009\u9898",open:!0},{id:3,name:"\u95EE\u7B54\u9898",open:!0}]);(0,N.useEffect)(()=>{We()},[Ve.categoryId]),(0,N.useEffect)(()=>(rt({type:"globalSetting/headerToggle",payload:!1}),rt({type:"globalSetting/footerToggle",payload:!1}),()=>{rt({type:"globalSetting/headerToggle",payload:!0}),rt({type:"globalSetting/footerToggle",payload:!0})}),[]);const We=()=>_(void 0,null,function*(){var st,Pt,ot;const bt=yield(0,y.i7)(W({},Ve));bt&&(_t(bt),Xe([{id:1,name:"\u5355\u9009\u9898",open:!0,countSize:(st=bt==null?void 0:bt.question_types)==null?void 0:st.q_singles},{id:2,name:"\u591A\u9009\u9898",open:!0,countSize:(Pt=bt==null?void 0:bt.question_types)==null?void 0:Pt.q_doubles},{id:3,name:"\u95EE\u7B54\u9898",open:!0,countSize:(ot=bt==null?void 0:bt.question_types)==null?void 0:ot.q_mains}]))}),Et=(st,Pt,ot)=>_(void 0,null,function*(){if(!st){console.error("handleSave no questionId params");return}const bt=yield(0,y.ID)({questionId:st,poll_answer_id:Pt,vote_text:ot});bt!=null&&bt.poll_vote&&(He.question_answered.find(Ee=>Ee.ques_id===st).ques_status=bt.poll_vote.question_status,_t(W({},He)))}),St=()=>{var st;let Pt=0,ot=0,bt=[],Ee=[];if((st=He==null?void 0:He.question_answered)==null||st.map((pe,ge)=>{var L,B,Q;(pe==null?void 0:pe.ques_status)===0&&(((Q=(B=(L=He==null?void 0:He.questions)==null?void 0:L.find(de=>{var qe;return((qe=de==null?void 0:de.question)==null?void 0:qe.id)===pe.ques_id}))==null?void 0:B.question)==null?void 0:Q.is_necessary)===1?(bt.push(ge),Pt++):(Ee.push(ge),ot++))}),Pt>0){$.default.info({width:530,title:"\u63D0\u793A",centered:!0,okText:"\u77E5\u9053\u5566",onOk:()=>{xe(!0);const pe=`Anchor_${bt[0]}`,B=document.getElementById(pe).getBoundingClientRect().top+window.pageYOffset+-100;window.scrollTo({top:B,behavior:"smooth"})},content:ie.createElement("div",{className:"tc font16 c-black-333"},"\u6709 ",Pt," \u9898\u5FC5\u7B54\u9898\u672A\u7B54\uFF0C\u65E0\u6CD5\u63D0\u4EA4 ",ie.createElement("br",null),"\u8BF7\u5B8C\u6210\u5168\u90E8\u5FC5\u7B54\u9898\u540E\u518D\u63D0\u4EA4")});return}$.default.confirm({width:530,title:"\u63D0\u793A",centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:ie.createElement("div",{className:"tc font16 c-black-333"},ot>0&&ie.createElement(ie.Fragment,null,"\u6709 ",ot," \u9898\u672A\u7B54 ",ie.createElement("br",null)),"\u63D0\u4EA4\u540E\u65E0\u6CD5\u518D\u4FEE\u6539\u7B54\u9898\uFF0C\u662F\u5426\u786E\u8BA4\u63D0\u4EA4\uFF1F"),onOk:()=>{mt();const pe=`Anchor_${Ee[0]}`,B=document.getElementById(pe).getBoundingClientRect().top+window.pageYOffset+-100;window.scrollTo({top:B,behavior:"smooth"})}})},mt=()=>_(void 0,null,function*(){const st=yield(0,y.Ns)({categoryId:Ve.categoryId});(st==null?void 0:st.status)===0&&(g.ZP.success(st==null?void 0:st.message),re.history.push(`/classrooms/${Ve.coursesId}/poll/${Ve.categoryId}/detail?tabs=0`))});return ie.createElement("div",null,ie.createElement("section",{className:"edu-container"},ie.createElement("div",{style:{height:"64px"}}),((ut=He==null?void 0:He.poll)==null?void 0:ut.un_anonymous)===!1&&ie.createElement("div",{className:p.tag},ie.createElement("i",{className:"iconfont icon-weixiada"}),"\u5F53\u524D\u95EE\u5377\u4E3A\u533F\u540D\u95EE\u5377\uFF0C\u95EE\u5377\u63D0\u4EA4\u65F6\u5C06\u5BF9\u6BCF\u4E2A\u5B66\u751F\u7684\u59D3\u540D\u548C\u5B66\u53F7\u8FDB\u884C\u533F\u540D\u5904\u7406\uFF0C\u6559\u5E08\u65E0\u6CD5\u67E5\u770B\u5B66\u751F\u59D3\u540D\u548C\u5B66\u53F7\u3002"),ie.createElement("section",{className:"animated fadeIn"},((ce=He==null?void 0:He.poll)==null?void 0:ce.polls_description)&&ie.createElement(X.Z,{className:p.pollDesc,value:(le=He==null?void 0:He.poll)==null?void 0:le.polls_description})),ie.createElement("div",{style:{display:"flex",alignItems:"flex-start"}},ie.createElement("div",{style:{margin:"20px 20px 20px 0",width:280,maxHeight:"60%"}},ie.createElement("div",{className:p.user_info},ie.createElement("div",{className:p.user_label,style:{lineHeight:"60px"}},"\u59D3\u540D",ie.createElement("span",{className:p.user_value},(Y=He==null?void 0:He.poll)==null?void 0:Y.real_name)),ie.createElement("div",{className:p.user_label,style:{lineHeight:"40px"}},"\u5B66\u53F7",ie.createElement("span",{className:p.user_value},(Te=He==null?void 0:He.poll)==null?void 0:Te.student_id))),ie.createElement("div",{style:{background:"#fff"}},ie.createElement("aside",{className:p.answerInfo},ie.createElement(ue.Z,{justify:"space-between"},ie.createElement(ee.Z,null,"\u7B54\u9898\u8FDB\u5EA6"),ie.createElement(ee.Z,{className:p.answerProgress},ie.createElement("span",{style:{color:"#165DFF"}},(Ke=(ke=He==null?void 0:He.question_answered)==null?void 0:ke.filter(st=>(st==null?void 0:st.ques_status)===1))==null?void 0:Ke.length),ie.createElement("span",{style:{color:"#999999"}},"/",(G=He==null?void 0:He.question_types)==null?void 0:G.q_counts))),ie.createElement(ue.Z,null,ie.createElement(l.Z,{strokeColor:"#165dffa6",trailColor:"#0000000d",percent:((me=(q=He==null?void 0:He.question_answered)==null?void 0:q.filter(st=>(st==null?void 0:st.ques_status)==1))==null?void 0:me.length)/((we=He==null?void 0:He.question_types)==null?void 0:we.q_counts)*100,showInfo:!1}))),ie.createElement(ue.Z,{className:p.dottedLineWrapper,align:"middle"},ie.createElement(ee.Z,{className:p.leftHalfCircle}),ie.createElement(ee.Z,{flex:1,className:p.dottedLine}),ie.createElement(ee.Z,{className:p.rightHalfCircle})),ie.createElement("div",{className:p.answerSheetWrap},ct==null?void 0:ct.map((st,Pt)=>{var ot;let bt=0;return ie.createElement("div",{key:Pt},(st==null?void 0:st.countSize)>0&&ie.createElement("div",{className:p.answerSheetQuestionTitle,onClick:()=>{ct[Pt].open=!(st!=null&&st.open),Xe([...ct])}},st!=null&&st.open?ie.createElement(oe.Z,null):ie.createElement(_e.Z,null),ie.createElement("span",{className:"ml5 c-grey-666"},st==null?void 0:st.name)),(st==null?void 0:st.open)&&ie.createElement("div",null,(ot=He==null?void 0:He.questions)==null?void 0:ot.map((Ee,pe)=>{var ge,L,B;if(((ge=Ee==null?void 0:Ee.question)==null?void 0:ge.question_type)==(st==null?void 0:st.id))return ie.createElement(j.default.Link,{className:`${p.answerFlag} ${((B=(L=He==null?void 0:He.question_answered)==null?void 0:L[pe])==null?void 0:B.ques_status)==1?p.answerActive:ht&&Ee.question.is_necessary===1?p.redactivie:""}`,href:`#Anchor_${pe}`,title:++bt})})),ie.createElement("div",{style:{clear:"both"}}))})))),ie.createElement("section",{style:{width:900},className:[p.bg,"pt10","pl30","pr30","pb30","mt20","mb50"].join(" ")},ie.createElement("div",null,(Le=He==null?void 0:He.questions)==null?void 0:Le.map((st,Pt)=>{var ot,bt,Ee,pe,ge;return ie.createElement("div",{className:p.questionItem,id:`Anchor_${Pt}`},ie.createElement("div",{className:"mt20"},ie.createElement("span",{className:"font16",style:{display:"flex",alignItems:"center",marginBottom:"20px"}},((ot=st==null?void 0:st.question)==null?void 0:ot.is_necessary)!==0&&ie.createElement("span",{style:{color:"red",fontSize:"14px"}},"*"),ie.createElement("span",{className:"c-blue font16"},"\u3010",ye[st.question.question_type],"\u3011"),ie.createElement(A.Z,{title:st.question.question_title},ie.createElement("div",{className:p.title},(bt=st==null?void 0:st.question)==null?void 0:bt.question_number,"\u3001",st.question.question_title)),st.question.question_type===2&&((Ee=st==null?void 0:st.question)==null?void 0:Ee.min_choices)&&ie.createElement("div",{className:"ml10",style:{fontWeight:400,color:"#666666"}},"(\u53EF\u9009",(pe=st==null?void 0:st.question)==null?void 0:pe.min_choices,"-",(ge=st==null?void 0:st.question)==null?void 0:ge.max_choices,"\u9879)"))),st.question.question_type==1&&ie.createElement(I,{answerData:He,itemData:st,onSave:Et}),st.question.question_type==2&&ie.createElement(H,{answerData:He,itemData:st,onSave:Et}),st.question.question_type==3&&ie.createElement(he,{answerData:He,itemData:st,onSave:Et}))}))))),ie.createElement("div",{className:p.header_style},ie.createElement("div",{className:p.header_content},ie.createElement(m.VV,{status:[m.L4[($e=He==null?void 0:He.poll)==null?void 0:$e.poll_status]]}),ie.createElement(A.Z,{title:(yt=He==null?void 0:He.poll)==null?void 0:yt.polls_name},ie.createElement("div",{className:p.header_title},(Qe=He==null?void 0:He.poll)==null?void 0:Qe.polls_name)),(0,x.dE)()&&((et=He==null?void 0:He.poll)==null?void 0:et.user_poll_status)===0&&ie.createElement("div",{className:p.header_button,onClick:St},"\u63D0\u4EA4\u95EE\u5377"))))};var Ne=(0,re.connect)(({loading:ve,user:Me,globalSetting:Ae})=>({globalSetting:Ae,user:Me,loading:ve.effects}))(Oe)},90290:function(Ut,at,O){"use strict";O.d(at,{AL:function(){return U},Iy:function(){return A},Qv:function(){return y},ez:function(){return C},jb:function(){return p}});var N=O(32834),re=O.n(N),De=O(11690),ne=O.n(De);let $=1;function g(oe,_e){const ie=oe.match(/^(\s+)(?:```)/);if(ie===null)return _e;const ze=ie[1];return _e.split(`
`).map(k=>{const S=k.match(/^\s+/);if(S===null)return k;const[w]=S;return w.length>=ze.length?k.slice(ze.length):k}).join(`
`)}let ue=[],ee=["<ul>"];const l=new(re()).Renderer,j=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){ue.length=0,ee=["<ul>"]}const p={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(oe,_e,ie,ze){if(_e>=oe.length||oe[_e].level<=ie)return _e;var k=oe[_e];ze.push("<li><a href='#"+$+k.anchor+"'>"+k.text+"</a>"),_e++;var S=[];return _e=m(oe,_e,k.level,S),S.length>0&&(ze.push("<ul>"),S.forEach(function(w){ze.push(w)}),ze.push("</ul>")),ze.push("</li>"),_e=m(oe,_e,ie,ze),_e}function y(){return m(ue,0,0,ee),ee.push("</ul>"),ee.join("")}const x={heading(oe){const _e=j.exec(oe);if($+=1,_e)return{type:"heading",raw:_e[0],depth:_e[1].length,text:_e[2]}},fences(oe){const _e=this.rules.block.fences.exec(oe);if(_e){const ie=_e[0];let ze=g(ie,_e[3]||"");const k=_e[2]?_e[2].trim():_e[2];if(["latex","katex","math"].indexOf(k)>=0){const S=z(),w=ze;ze=S,I[S]={type:"block",expression:w}}return{type:"code",raw:ie,lang:k,text:ze}}}},M=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let F=0;const z=()=>`__special_katext_id_${F++}__`;let I={};function C(){return I}function U(){F=0,I={}}function H(oe){return oe=oe.replace(M,(_e,ie)=>{const ze=z();return I[ze]={type:"inline",expression:ie},ze}),oe}const J=l.listitem;l.listitem=function(oe){return J(H(oe))};const he=l.paragraph;l.paragraph=function(oe){return he(H(oe))};const X=l.tablecell;l.tablecell=function(oe,_e){return X(H(oe),_e)},l.code=function(oe,_e,ie){const ze=(_e||"").match(/\S*/)[0];return ze?["latex","katex","math"].indexOf(ze)>=0?`<p class='editormd-tex'>${oe}</p>`:`<pre class="prettyprint linenums"><code class="language-${_e}">${ie?oe:(0,De.escape)(oe,!0)}</code></pre>
`:'<pre class="prettyprint linenums"><code>'+(ie?oe:(0,De.escape)(oe,!0))+"</code></pre>"},l.heading=function(oe,_e,ie){let ze=this.options.headerPrefix+ie.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return ue.push({anchor:ze,level:_e,text:oe}),"<h"+_e+' id="'+$+ze+'">'+oe+"</h"+_e+">"},re().setOptions({silent:!0,gfm:!0,pedantic:!1}),re().use({tokenizer:x,renderer:l}),at.ZP=re()},45685:function(Ut,at,O){"use strict";O.d(at,{default:function(){return k}});var N=O(3300),re=O(59301),De=O(92310),ne=O.n(De),$=O(6089),g=O(16722),ue=O(97224),ee=O(83010),l=O(48608),j=O(48755),A=O(83397),m=re.createContext(void 0),x=S=>{const{href:w,title:P,prefixCls:W,children:K,className:_,target:v,replace:D}=S,Z=re.useContext(m),{registerLink:fe,unregisterLink:ye,scrollTo:Oe,onClick:Ne,activeLink:ve,direction:Me}=Z||{};re.useEffect(()=>(fe==null||fe(w),()=>{ye==null||ye(w)}),[w]);const Ae=ce=>{Ne==null||Ne(ce,{title:P,href:w}),Oe==null||Oe(w),D&&(ce.preventDefault(),window.location.replace(w))},{getPrefixCls:dt}=re.useContext(j.E_),Ce=dt("anchor",W),rt=ve===w,Pe=ne()(`${Ce}-link`,_,{[`${Ce}-link-active`]:rt}),ut=ne()(`${Ce}-link-title`,{[`${Ce}-link-title-active`]:rt});return re.createElement("div",{className:Pe},re.createElement("a",{className:ut,href:w,title:typeof P=="string"?P:"",target:v,onClick:Ae},P),Me!=="horizontal"?K:null)},M=O(36237),F=O(63356),z=O(16931),I=O(51636);const C=S=>{const{componentCls:w,holderOffsetBlock:P,motionDurationSlow:W,lineWidthBold:K,colorPrimary:_,lineType:v,colorSplit:D,calc:Z}=S;return{[`${w}-wrapper`]:{marginBlockStart:Z(P).mul(-1).equal(),paddingBlockStart:P,[w]:Object.assign(Object.assign({},(0,F.Wf)(S)),{position:"relative",paddingInlineStart:K,[`${w}-link`]:{paddingBlock:S.linkPaddingBlock,paddingInline:`${(0,M.unit)(S.linkPaddingInlineStart)} 0`,"&-title":Object.assign(Object.assign({},F.vS),{position:"relative",display:"block",marginBlockEnd:S.anchorTitleBlock,color:S.colorText,transition:`all ${S.motionDurationSlow}`,"&:only-child":{marginBlockEnd:0}}),[`&-active > ${w}-link-title`]:{color:S.colorPrimary},[`${w}-link`]:{paddingBlock:S.anchorPaddingBlockSecondary}}}),[`&:not(${w}-wrapper-horizontal)`]:{[w]:{"&::before":{position:"absolute",insetInlineStart:0,top:0,height:"100%",borderInlineStart:`${(0,M.unit)(K)} ${v} ${D}`,content:'" "'},[`${w}-ink`]:{position:"absolute",insetInlineStart:0,display:"none",transform:"translateY(-50%)",transition:`top ${W} ease-in-out`,width:K,backgroundColor:_,[`&${w}-ink-visible`]:{display:"inline-block"}}}},[`${w}-fixed ${w}-ink ${w}-ink`]:{display:"none"}}}},U=S=>{const{componentCls:w,motionDurationSlow:P,lineWidthBold:W,colorPrimary:K}=S;return{[`${w}-wrapper-horizontal`]:{position:"relative","&::before":{position:"absolute",left:{_skip_check_:!0,value:0},right:{_skip_check_:!0,value:0},bottom:0,borderBottom:`${(0,M.unit)(S.lineWidth)} ${S.lineType} ${S.colorSplit}`,content:'" "'},[w]:{overflowX:"scroll",position:"relative",display:"flex",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},[`${w}-link:first-of-type`]:{paddingInline:0},[`${w}-ink`]:{position:"absolute",bottom:0,transition:`left ${P} ease-in-out, width ${P} ease-in-out`,height:W,backgroundColor:K}}}}},H=S=>({linkPaddingBlock:S.paddingXXS,linkPaddingInlineStart:S.padding});var J=(0,z.I$)("Anchor",S=>{const{fontSize:w,fontSizeLG:P,paddingXXS:W,calc:K}=S,_=(0,I.mergeToken)(S,{holderOffsetBlock:W,anchorPaddingBlockSecondary:K(W).div(2).equal(),anchorTitleBlock:K(w).div(14).mul(3).equal(),anchorBallSize:K(P).div(2).equal()});return[C(_),U(_)]},H);function he(){return window}function X(S,w){if(!S.getClientRects().length)return 0;const P=S.getBoundingClientRect();return P.width||P.height?w===window?P.top-S.ownerDocument.documentElement.clientTop:P.top-w.getBoundingClientRect().top:P.top}const oe=/#([\S ]+)$/;var ie=S=>{var w;const{rootClassName:P,prefixCls:W,className:K,style:_,offsetTop:v,affix:D=!0,showInkInFixed:Z=!1,children:fe,items:ye,direction:Oe="vertical",bounds:Ne,targetOffset:ve,onClick:Me,onChange:Ae,getContainer:dt,getCurrentAnchor:Ce,replace:rt}=S,[Pe,ut]=re.useState([]),[ce,le]=re.useState(null),Y=re.useRef(ce),Te=re.useRef(null),ke=re.useRef(null),Ke=re.useRef(!1),{direction:G,getPrefixCls:q,className:me,style:we}=(0,j.dj)("anchor"),{getTargetContainer:Le}=re.useContext(j.E_),$e=q("anchor",W),yt=(0,A.Z)($e),[Qe,et,Ve]=J($e,yt),He=(w=dt!=null?dt:Le)!==null&&w!==void 0?w:he,_t=JSON.stringify(Pe),ht=(0,$.Z)(L=>{Pe.includes(L)||ut(B=>[].concat((0,N.Z)(B),[L]))}),xe=(0,$.Z)(L=>{Pe.includes(L)&&ut(B=>B.filter(Q=>Q!==L))}),ct=()=>{var L;const B=(L=Te.current)===null||L===void 0?void 0:L.querySelector(`.${$e}-link-title-active`);if(B&&ke.current){const{style:Q}=ke.current,ae=Oe==="horizontal";Q.top=ae?"":`${B.offsetTop+B.clientHeight/2}px`,Q.height=ae?"":`${B.clientHeight}px`,Q.left=ae?`${B.offsetLeft}px`:"",Q.width=ae?`${B.clientWidth}px`:"",ae&&(0,g.Z)(B,{scrollMode:"if-needed",block:"nearest"})}},Xe=function(L){let B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;const ae=[],de=He();return L.forEach(qe=>{const lt=oe.exec(qe==null?void 0:qe.toString());if(!lt)return;const pt=document.getElementById(lt[1]);if(pt){const Tt=X(pt,de);Tt<=B+Q&&ae.push({link:qe,top:Tt})}}),ae.length?ae.reduce((lt,pt)=>pt.top>lt.top?pt:lt).link:""},We=(0,$.Z)(L=>{if(Y.current===L)return;const B=typeof Ce=="function"?Ce(L):L;le(B),Y.current=B,Ae==null||Ae(L)}),Et=re.useCallback(()=>{if(Ke.current)return;const L=Xe(Pe,ve!==void 0?ve:v||0,Ne);We(L)},[_t,ve,v]),St=re.useCallback(L=>{We(L);const B=oe.exec(L);if(!B)return;const Q=document.getElementById(B[1]);if(!Q)return;const ae=He(),de=(0,ue.Z)(ae),qe=X(Q,ae);let lt=de+qe;lt-=ve!==void 0?ve:v||0,Ke.current=!0,(0,ee.Z)(lt,{getContainer:He,callback(){Ke.current=!1}})},[ve,v]),mt=ne()(et,Ve,yt,P,`${$e}-wrapper`,{[`${$e}-wrapper-horizontal`]:Oe==="horizontal",[`${$e}-rtl`]:G==="rtl"},K,me),st=ne()($e,{[`${$e}-fixed`]:!D&&!Z}),Pt=ne()(`${$e}-ink`,{[`${$e}-ink-visible`]:ce}),ot=Object.assign(Object.assign({maxHeight:v?`calc(100vh - ${v}px)`:"100vh"},we),_),bt=L=>Array.isArray(L)?L.map(B=>re.createElement(x,Object.assign({replace:rt},B,{key:B.key}),Oe==="vertical"&&bt(B.children))):null,Ee=re.createElement("div",{ref:Te,className:mt,style:ot},re.createElement("div",{className:st},re.createElement("span",{className:Pt,ref:ke}),"items"in S?bt(ye):fe));re.useEffect(()=>{const L=He();return Et(),L==null||L.addEventListener("scroll",Et),()=>{L==null||L.removeEventListener("scroll",Et)}},[_t]),re.useEffect(()=>{typeof Ce=="function"&&We(Ce(Y.current||""))},[Ce]),re.useEffect(()=>{ct()},[Oe,Ce,_t,ce]);const pe=re.useMemo(()=>({registerLink:ht,unregisterLink:xe,scrollTo:St,activeLink:ce,onClick:Me,direction:Oe}),[ce,Me,St,Oe]),ge=D&&typeof D=="object"?D:void 0;return Qe(re.createElement(m.Provider,{value:pe},D?re.createElement(l.Z,Object.assign({offsetTop:v,target:He},ge),Ee):Ee))};const ze=ie;ze.Link=x;var k=ze},64018:function(){var Ut,at,O,N=!1,re,De;window.PR_SHOULD_USE_CONTINUATION=!0;var ne,$;(function(){var g=window,ue=["break,continue,do,else,for,if,return,while"],ee=[ue,"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"],l=[ee,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],j=[l,"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"],A=[l,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],p=[l,"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"],m="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",y=[l,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],x="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",M=[ue,"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"],F=[ue,"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"],z=[ue,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],I=[j,p,A,y,x,M,F,z],C=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,U="str",H="kwd",J="com",he="typ",X="lit",oe="pun",_e="pln",ie="tag",ze="dec",k="src",S="atn",w="atv",P="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function K(le){for(var Y=0,Te=!1,ke=!1,Ke=0,G=le.length;Ke<G;++Ke){var q=le[Ke];if(q.ignoreCase)ke=!0;else if(/[a-z]/i.test(q.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Te=!0,ke=!1;break}}var me={b:8,t:9,n:10,v:11,f:12,r:13};function we(et){var Ve=et.charCodeAt(0);if(Ve!==92)return Ve;var He=et.charAt(1);return Ve=me[He],Ve||("0"<=He&&He<="7"?parseInt(et.substring(1),8):He==="u"||He==="x"?parseInt(et.substring(2),16):et.charCodeAt(1))}function Le(et){if(et<32)return(et<16?"\\x0":"\\x")+et.toString(16);var Ve=String.fromCharCode(et);return Ve==="\\"||Ve==="-"||Ve==="]"||Ve==="^"?"\\"+Ve:Ve}function $e(et){var Ve=et.substring(1,et.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")),He=[],_t=Ve[0]==="^",ht=["["];_t&&ht.push("^");for(var xe=_t?1:0,ct=Ve.length;xe<ct;++xe){var Xe=Ve[xe];if(/\\[bdsw]/i.test(Xe))ht.push(Xe);else{var We=we(Xe),Et;xe+2<ct&&Ve[xe+1]==="-"?(Et=we(Ve[xe+2]),xe+=2):Et=We,He.push([We,Et]),Et<65||We>122||(Et<65||We>90||He.push([Math.max(65,We)|32,Math.min(Et,90)|32]),Et<97||We>122||He.push([Math.max(97,We)&-33,Math.min(Et,122)&-33]))}}He.sort(function(Pt,ot){return Pt[0]-ot[0]||ot[1]-Pt[1]});for(var St=[],mt=[],xe=0;xe<He.length;++xe){var st=He[xe];st[0]<=mt[1]+1?mt[1]=Math.max(mt[1],st[1]):St.push(mt=st)}for(var xe=0;xe<St.length;++xe){var st=St[xe];ht.push(Le(st[0])),st[1]>st[0]&&(st[1]+1>st[0]&&ht.push("-"),ht.push(Le(st[1])))}return ht.push("]"),ht.join("")}function yt(et){for(var Ve=et.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")),He=Ve.length,_t=[],ht=0,xe=0;ht<He;++ht){var ct=Ve[ht];if(ct==="(")++xe;else if(ct.charAt(0)==="\\"){var Xe=+ct.substring(1);Xe&&(Xe<=xe?_t[Xe]=-1:Ve[ht]=Le(Xe))}}for(var ht=1;ht<_t.length;++ht)_t[ht]===-1&&(_t[ht]=++Y);for(var ht=0,xe=0;ht<He;++ht){var ct=Ve[ht];if(ct==="(")++xe,_t[xe]||(Ve[ht]="(?:");else if(ct.charAt(0)==="\\"){var Xe=+ct.substring(1);Xe&&Xe<=xe&&(Ve[ht]="\\"+_t[Xe])}}for(var ht=0;ht<He;++ht)Ve[ht]==="^"&&Ve[ht+1]!=="^"&&(Ve[ht]="");if(et.ignoreCase&&Te)for(var ht=0;ht<He;++ht){var ct=Ve[ht],We=ct.charAt(0);ct.length>=2&&We==="["?Ve[ht]=$e(ct):We!=="\\"&&(Ve[ht]=ct.replace(/[a-zA-Z]/g,function(mt){var st=mt.charCodeAt(0);return"["+String.fromCharCode(st&-33,st|32)+"]"}))}return Ve.join("")}for(var Qe=[],Ke=0,G=le.length;Ke<G;++Ke){var q=le[Ke];if(q.global||q.multiline)throw new Error(""+q);Qe.push("(?:"+yt(q)+")")}return new RegExp(Qe.join("|"),ke?"gi":"g")}function _(le,Y){var Te=/(?:^|\s)nocode(?:\s|$)/,ke=[],Ke=0,G=[],q=0;function me(we){var Le=we.nodeType;if(Le==1){if(Te.test(we.className))return;for(var $e=we.firstChild;$e;$e=$e.nextSibling)me($e);var yt=we.nodeName.toLowerCase();(yt==="br"||yt==="li")&&(ke[q]=`
`,G[q<<1]=Ke++,G[q++<<1|1]=we)}else if(Le==3||Le==4){var Qe=we.nodeValue;Qe.length&&(Y?Qe=Qe.replace(/\r\n?/g,`
`):Qe=Qe.replace(/[ \t\r\n]+/g," "),ke[q]=Qe,G[q<<1]=Ke,Ke+=Qe.length,G[q++<<1|1]=we)}}return me(le),{sourceCode:ke.join("").replace(/\n$/,""),spans:G}}function v(le,Y,Te,ke,Ke){if(Te){var G={sourceNode:le,pre:1,langExtension:null,numberLines:null,sourceCode:Te,spans:null,basePos:Y,decorations:null};ke(G),Ke.push.apply(Ke,G.decorations)}}var D=/\S/;function Z(le){for(var Y=void 0,Te=le.firstChild;Te;Te=Te.nextSibling){var ke=Te.nodeType;Y=ke===1?Y?le:Te:ke===3&&D.test(Te.nodeValue)?le:Y}return Y===le?void 0:Y}function fe(le,Y){var Te={},ke;(function(){for(var q=le.concat(Y),me=[],we={},Le=0,$e=q.length;Le<$e;++Le){var yt=q[Le],Qe=yt[3];if(Qe)for(var et=Qe.length;--et>=0;)Te[Qe.charAt(et)]=yt;var Ve=yt[1],He=""+Ve;we.hasOwnProperty(He)||(me.push(Ve),we[He]=null)}me.push(/[\0-\uffff]/),ke=K(me)})();var Ke=Y.length,G=function(q){for(var me=q.sourceCode,we=q.basePos,Le=q.sourceNode,$e=[we,_e],yt=0,Qe=me.match(ke)||[],et={},Ve=0,He=Qe.length;Ve<He;++Ve){var _t=Qe[Ve],ht=et[_t],xe=void 0,ct;if(typeof ht=="string")ct=!1;else{var Xe=Te[_t.charAt(0)];if(Xe)xe=_t.match(Xe[1]),ht=Xe[0];else{for(var We=0;We<Ke;++We)if(Xe=Y[We],xe=_t.match(Xe[1]),xe){ht=Xe[0];break}xe||(ht=_e)}ct=ht.length>=5&&ht.substring(0,5)==="lang-",ct&&!(xe&&typeof xe[1]=="string")&&(ct=!1,ht=k),ct||(et[_t]=ht)}var Et=yt;if(yt+=_t.length,!ct)$e.push(we+Et,ht);else{var St=xe[1],mt=_t.indexOf(St),st=mt+St.length;xe[2]&&(st=_t.length-xe[2].length,mt=st-St.length);var Pt=ht.substring(5);v(Le,we+Et,_t.substring(0,mt),G,$e),v(Le,we+Et+mt,St,dt(Pt,St),$e),v(Le,we+Et+st,_t.substring(st),G,$e)}}q.decorations=$e};return G}function ye(le){var Y=[],Te=[];le.tripleQuotedStrings?Y.push([U,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):le.multiLineStrings?Y.push([U,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Y.push([U,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),le.verbatimStrings&&Te.push([U,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ke=le.hashComments;ke&&(le.cStyleComments?(ke>1?Y.push([J,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Y.push([J,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Te.push([U,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Y.push([J,/^#[^\r\n]*/,null,"#"])),le.cStyleComments&&(Te.push([J,/^\/\/[^\r\n]*/,null]),Te.push([J,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ke=le.regexLiterals;if(Ke){var G=Ke>1?"":`
\r`,q=G?".":"[\\S\\s]",me="/(?=[^/*"+G+"])(?:[^/\\x5B\\x5C"+G+"]|\\x5C"+q+"|\\x5B(?:[^\\x5C\\x5D"+G+"]|\\x5C"+q+")*(?:\\x5D|$))+/";Te.push(["lang-regex",RegExp("^"+W+"("+me+")")])}var we=le.types;we&&Te.push([he,we]);var Le=(""+le.keywords).replace(/^ | $/g,"");Le.length&&Te.push([H,new RegExp("^(?:"+Le.replace(/[\s,]+/g,"|")+")\\b"),null]),Y.push([_e,/^\s+/,null,` \r
\xA0`]);var $e="^.[^\\s\\w.$@'\"`/\\\\]*";return le.regexLiterals&&($e+="(?!s*/)"),Te.push([X,/^@[a-z_$][a-z_$@0-9]*/i,null],[he,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[_e,/^[a-z_$][a-z_$@0-9]*/i,null],[X,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[_e,/^\\[\s\S]?/,null],[oe,new RegExp($e),null]),fe(Y,Te)}var Oe=ye({keywords:I,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ne(le,Y,Te){for(var ke=/(?:^|\s)nocode(?:\s|$)/,Ke=/\r\n?|\n/,G=le.ownerDocument,q=G.createElement("li");le.firstChild;)q.appendChild(le.firstChild);var me=[q];function we(Ve){var He=Ve.nodeType;if(He==1&&!ke.test(Ve.className))if(Ve.nodeName==="br")Le(Ve),Ve.parentNode&&Ve.parentNode.removeChild(Ve);else for(var _t=Ve.firstChild;_t;_t=_t.nextSibling)we(_t);else if((He==3||He==4)&&Te){var ht=Ve.nodeValue,xe=ht.match(Ke);if(xe){var ct=ht.substring(0,xe.index);Ve.nodeValue=ct;var Xe=ht.substring(xe.index+xe[0].length);if(Xe){var We=Ve.parentNode;We.insertBefore(G.createTextNode(Xe),Ve.nextSibling)}Le(Ve),ct||Ve.parentNode.removeChild(Ve)}}}function Le(Ve){for(;!Ve.nextSibling;)if(Ve=Ve.parentNode,!Ve)return;function He(xe,ct){var Xe=ct?xe.cloneNode(!1):xe,We=xe.parentNode;if(We){var Et=He(We,1),St=xe.nextSibling;Et.appendChild(Xe);for(var mt=St;mt;mt=St)St=mt.nextSibling,Et.appendChild(mt)}return Xe}for(var _t=He(Ve.nextSibling,0),ht;(ht=_t.parentNode)&&ht.nodeType===1;)_t=ht;me.push(_t)}for(var $e=0;$e<me.length;++$e)we(me[$e]);Y===(Y|0)&&me[0].setAttribute("value",Y);var yt=G.createElement("ol");yt.className="linenums";for(var Qe=Math.max(0,Y-1|0)||0,$e=0,et=me.length;$e<et;++$e)q=me[$e],q.className="L"+($e+Qe)%10,q.firstChild||q.appendChild(G.createTextNode("\xA0")),yt.appendChild(q);le.appendChild(yt)}function ve(le){var Y=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Y=Y&&+Y[1]<=8;var Te=/\n/g,ke=le.sourceCode,Ke=ke.length,G=0,q=le.spans,me=q.length,we=0,Le=le.decorations,$e=Le.length,yt=0;Le[$e]=Ke;var Qe,et;for(et=Qe=0;et<$e;)Le[et]!==Le[et+2]?(Le[Qe++]=Le[et++],Le[Qe++]=Le[et++]):et+=2;for($e=Qe,et=Qe=0;et<$e;){for(var Ve=Le[et],He=Le[et+1],_t=et+2;_t+2<=$e&&Le[_t+1]===He;)_t+=2;Le[Qe++]=Ve,Le[Qe++]=He,et=_t}$e=Le.length=Qe;var ht=le.sourceNode,xe="";ht&&(xe=ht.style.display,ht.style.display="none");try{for(var ct=null;we<me;){var Xe=q[we],We=q[we+2]||Ke,Et=Le[yt+2]||Ke,_t=Math.min(We,Et),St=q[we+1],mt;if(St.nodeType!==1&&(mt=ke.substring(G,_t))){Y&&(mt=mt.replace(Te,"\r")),St.nodeValue=mt;var st=St.ownerDocument,Pt=st.createElement("span");Pt.className=Le[yt+1];var ot=St.parentNode;ot.replaceChild(Pt,St),Pt.appendChild(St),G<We&&(q[we+1]=St=st.createTextNode(ke.substring(_t,We)),ot.insertBefore(St,Pt.nextSibling))}G=_t,G>=We&&(we+=2),G>=Et&&(yt+=2)}}finally{ht&&(ht.style.display=xe)}}var Me={};function Ae(le,Y){for(var Te=Y.length;--Te>=0;){var ke=Y[Te];Me.hasOwnProperty(ke)?g.console&&console.warn("cannot override language handler %s",ke):Me[ke]=le}}function dt(le,Y){return le&&Me.hasOwnProperty(le)||(le=/^\s*</.test(Y)?"default-markup":"default-code"),Me[le]}Ae(Oe,["default-code"]),Ae(fe([],[[_e,/^[^<?]+/],[ze,/^<!\w[^>]*(?:>|$)/],[J,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[oe,/^(?:<[%?]|[%?]>)/],["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"]),Ae(fe([[_e,/^[\s]+/,null,` \r
`],[w,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[ie,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[S,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[oe,/^[=<>\/]+/],["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"]),Ae(fe([],[[w,/^[\s\S]+/]]),["uq.val"]),Ae(ye({keywords:j,hashComments:!0,cStyleComments:!0,types:C}),["c","cc","cpp","cxx","cyc","m"]),Ae(ye({keywords:"null,true,false"}),["json"]),Ae(ye({keywords:p,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:C}),["cs"]),Ae(ye({keywords:A,cStyleComments:!0}),["java"]),Ae(ye({keywords:z,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Ae(ye({keywords:M,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Ae(ye({keywords:x,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Ae(ye({keywords:F,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Ae(ye({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Ae(ye({keywords:m,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Ae(fe([],[[U,/^[\s\S]+/]]),["regex"]);function Ce(le){var Y=le.langExtension;try{var Te=_(le.sourceNode,le.pre),ke=Te.sourceCode;le.sourceCode=ke,le.spans=Te.spans,le.basePos=0,dt(Y,ke)(le),ve(le)}catch(Ke){g.console&&console.log(Ke&&Ke.stack||Ke)}}function rt(le,Y,Te){var ke=Te||!1,Ke=Y||null,G=document.createElement("div");G.innerHTML="<pre>"+le+"</pre>",G=G.firstChild,ke&&Ne(G,ke,!0);var q={langExtension:Ke,numberLines:ke,sourceNode:G,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ce(q),G.innerHTML}function Pe(le,Y){var Te=Y||document.body,ke=Te.ownerDocument||document;function Ke(Xe){return Te.getElementsByTagName(Xe)}for(var G=[Ke("pre"),Ke("code"),Ke("xmp")],q=[],me=0;me<G.length;++me)for(var we=0,Le=G[me].length;we<Le;++we)q.push(G[me][we]);G=null;var $e=Date;$e.now||($e={now:function(){return+new Date}});var yt=0,Qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,et=/\bprettyprint\b/,Ve=/\bprettyprinted\b/,He=/pre|xmp/i,_t=/^code$/i,ht=/^(?:pre|code|xmp)$/i,xe={};function ct(){for(var Xe=g.PR_SHOULD_USE_CONTINUATION?$e.now()+250:1/0;yt<q.length&&$e.now()<Xe;yt++){for(var We=q[yt],Et=xe,St=We;St=St.previousSibling;){var mt=St.nodeType,st=(mt===7||mt===8)&&St.nodeValue;if(st?!/^\??prettify\b/.test(st):mt!==3||/\S/.test(St.nodeValue))break;if(st){Et={},st.replace(/\b(\w+)=([\w:.%+-]+)/g,function(lt,pt,Tt){Et[pt]=Tt});break}}var Pt=We.className;if((Et!==xe||et.test(Pt))&&!Ve.test(Pt)){for(var ot=!1,bt=We.parentNode;bt;bt=bt.parentNode){var Ee=bt.tagName;if(ht.test(Ee)&&bt.className&&et.test(bt.className)){ot=!0;break}}if(!ot){We.className+=" prettyprinted";var pe=Et.lang;if(!pe){pe=Pt.match(Qe);var ge;!pe&&(ge=Z(We))&&_t.test(ge.tagName)&&(pe=ge.className.match(Qe)),pe&&(pe=pe[1])}var L;if(He.test(We.tagName))L=1;else{var B=We.currentStyle,Q=ke.defaultView,ae=B?B.whiteSpace:Q&&Q.getComputedStyle?Q.getComputedStyle(We,null).getPropertyValue("white-space"):0;L=ae&&ae.substring(0,3)==="pre"}var de=Et.linenums;(de=de==="true"||+de)||(de=Pt.match(/\blinenums\b(?::(\d+))?/),de=de?de[1]&&de[1].length?+de[1]:!0:!1),de&&Ne(We,de,L);var qe={langExtension:pe,sourceNode:We,numberLines:de,pre:L,sourceCode:null,basePos:null,spans:null,decorations:null};Ce(qe)}}}yt<q.length?g.setTimeout(ct,250):typeof le=="function"&&le()}ct()}var ut=g.PR={createSimpleLexer:fe,registerLangHandler:Ae,sourceDecorator:ye,PR_ATTRIB_NAME:S,PR_ATTRIB_VALUE:w,PR_COMMENT:J,PR_DECLARATION:ze,PR_KEYWORD:H,PR_LITERAL:X,PR_NOCODE:P,PR_PLAIN:_e,PR_PUNCTUATION:oe,PR_SOURCE:k,PR_STRING:U,PR_TAG:ie,PR_TYPE:he,prettyPrintOne:N?g.prettyPrintOne=rt:ne=rt,prettyPrint:$=N?g.prettyPrint=Pe:$=Pe},ce=g.define;typeof ce=="function"&&ce.amd&&ce("google-code-prettify",[],function(){return ut})})()},25769:function(Ut,at,O){"use strict";var N=O(98040),re={"text/plain":"Text","text/html":"Url",default:"Text"},De="Copy to clipboard: #{key}, Enter";function ne(g){var ue=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return g.replace(/#{\s*key\s*}/g,ue)}function $(g,ue){var ee,l,j,A,p,m,y=!1;ue||(ue={}),ee=ue.debug||!1;try{j=N(),A=document.createRange(),p=document.getSelection(),m=document.createElement("span"),m.textContent=g,m.ariaHidden="true",m.style.all="unset",m.style.position="fixed",m.style.top=0,m.style.clip="rect(0, 0, 0, 0)",m.style.whiteSpace="pre",m.style.webkitUserSelect="text",m.style.MozUserSelect="text",m.style.msUserSelect="text",m.style.userSelect="text",m.addEventListener("copy",function(M){if(M.stopPropagation(),ue.format)if(M.preventDefault(),typeof M.clipboardData=="undefined"){ee&&console.warn("unable to use e.clipboardData"),ee&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var F=re[ue.format]||re.default;window.clipboardData.setData(F,g)}else M.clipboardData.clearData(),M.clipboardData.setData(ue.format,g);ue.onCopy&&(M.preventDefault(),ue.onCopy(M.clipboardData))}),document.body.appendChild(m),A.selectNodeContents(m),p.addRange(A);var x=document.execCommand("copy");if(!x)throw new Error("copy command was unsuccessful");y=!0}catch(M){ee&&console.error("unable to copy using execCommand: ",M),ee&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(ue.format||"text",g),ue.onCopy&&ue.onCopy(window.clipboardData),y=!0}catch(F){ee&&console.error("unable to copy using clipboardData: ",F),ee&&console.error("falling back to prompt"),l=ne("message"in ue?ue.message:De),window.prompt(l,g)}}finally{p&&(typeof p.removeRange=="function"?p.removeRange(A):p.removeAllRanges()),m&&document.body.removeChild(m),j()}return y}Ut.exports=$},53184:function(Ut,at,O){"use strict";var N,re;function De(ne,$,g){var ue=function(ee,l){return ne.js_beautify(ee,l)};return ue.js=ne.js_beautify,ue.css=$.css_beautify,ue.html=g.html_beautify,ue.js_beautify=ne.js_beautify,ue.css_beautify=$.css_beautify,ue.html_beautify=g.html_beautify,ue}N=[O(58553),O(87804),O(40998)],re=function(ne,$,g){return De(ne,$,g)}.apply(at,N),re!==void 0&&(Ut.exports=re)},87804:function(Ut,at){var O,N;(function(){var re;(function(){"use strict";var ne=[,,function(ee){function l(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}l.prototype.clone_empty=function(){var p=new l(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},l.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},l.prototype.has_match=function(p){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(p))return!0;return!1},l.prototype.set_indent=function(p,m){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=m||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},l.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)},l.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},l.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},l.prototype.is_empty=function(){return this.__items.length===0},l.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},l.prototype.push=function(p){this.__items.push(p);var m=p.lastIndexOf(`
`);m!==-1?this.__character_count=p.length-m:this.__character_count+=p.length},l.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},l.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},l.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},l.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},l.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function j(p,m){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),m=m||"",p.indent_level>0&&(m=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}j.prototype.get_indent_size=function(p,m){var y=this.__base_string_length;return m=m||0,p<0&&(y=0),y+=p*this.__indent_size,y+=m,y},j.prototype.get_indent_string=function(p,m){var y=this.__base_string;return m=m||0,p<0&&(p=0,y=""),m+=p*this.__indent_size,this.__ensure_cache(m),y+=this.__cache[m],y},j.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},j.prototype.__add_column=function(){var p=this.__cache.length,m=0,y="";this.__indent_size&&p>=this.__indent_size&&(m=Math.floor(p/this.__indent_size),p-=m*this.__indent_size,y=new Array(m+1).join(this.__indent_string)),p&&(y+=new Array(p+1).join(" ")),this.__cache.push(y)};function A(p,m){this.__indent_cache=new j(p,m),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}A.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},A.prototype.get_line_number=function(){return this.__lines.length},A.prototype.get_indent_string=function(p,m){return this.__indent_cache.get_indent_string(p,m)},A.prototype.get_indent_size=function(p,m){return this.__indent_cache.get_indent_size(p,m)},A.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},A.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},A.prototype.get_code=function(p){this.trim(!0);var m=this.current_line.pop();m&&(m[m.length-1]===`
`&&(m=m.replace(/\n+$/g,"")),this.current_line.push(m)),this._end_with_newline&&this.__add_outputline();var y=this.__lines.join(`
`);return p!==`
`&&(y=y.replace(/[\n]/g,p)),y},A.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},A.prototype.set_indent=function(p,m){return p=p||0,m=m||0,this.next_line.set_indent(p,m),this.__lines.length>1?(this.current_line.set_indent(p,m),!0):(this.current_line.set_indent(),!1)},A.prototype.add_raw_token=function(p){for(var m=0;m<p.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},A.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},A.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(" "))},A.prototype.remove_indent=function(p){for(var m=this.__lines.length;p<m;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},A.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},A.prototype.just_added_newline=function(){return this.current_line.is_empty()},A.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},A.prototype.ensure_empty_line_above=function(p,m){for(var y=this.__lines.length-2;y>=0;){var x=this.__lines[y];if(x.is_empty())break;if(x.item(0).indexOf(p)!==0&&x.item(-1)!==m){this.__lines.splice(y+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}y--}},ee.exports.Output=A},,,,function(ee){function l(p,m){this.raw_options=j(p,m),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(p,m){var y=this.raw_options[p],x=m||[];return typeof y=="object"?y!==null&&typeof y.concat=="function"&&(x=y.concat()):typeof y=="string"&&(x=y.split(/[^a-zA-Z0-9_\/\-]+/)),x},l.prototype._get_boolean=function(p,m){var y=this.raw_options[p],x=y===void 0?!!m:!!y;return x},l.prototype._get_characters=function(p,m){var y=this.raw_options[p],x=m||"";return typeof y=="string"&&(x=y.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),x},l.prototype._get_number=function(p,m){var y=this.raw_options[p];m=parseInt(m,10),isNaN(m)&&(m=0);var x=parseInt(y,10);return isNaN(x)&&(x=m),x},l.prototype._get_selection=function(p,m,y){var x=this._get_selection_list(p,m,y);if(x.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[p]+"'");return x[0]},l.prototype._get_selection_list=function(p,m,y){if(!m||m.length===0)throw new Error("Selection list cannot be empty.");if(y=y||[m[0]],!this._is_valid_selection(y,m))throw new Error("Invalid Default Value!");var x=this._get_array(p,y);if(!this._is_valid_selection(x,m))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[p]+"'");return x},l.prototype._is_valid_selection=function(p,m){return p.length&&m.length&&!p.some(function(y){return m.indexOf(y)===-1})};function j(p,m){var y={};p=A(p);var x;for(x in p)x!==m&&(y[x]=p[x]);if(m&&p[m])for(x in p[m])y[x]=p[m][x];return y}function A(p){var m={},y;for(y in p){var x=y.replace(/-/g,"_");m[x]=p[y]}return m}ee.exports.Options=l,ee.exports.normalizeOpts=A,ee.exports.mergeOpts=j},,function(ee){var l=RegExp.prototype.hasOwnProperty("sticky");function j(A){this.__input=A||"",this.__input_length=this.__input.length,this.__position=0}j.prototype.restart=function(){this.__position=0},j.prototype.back=function(){this.__position>0&&(this.__position-=1)},j.prototype.hasNext=function(){return this.__position<this.__input_length},j.prototype.next=function(){var A=null;return this.hasNext()&&(A=this.__input.charAt(this.__position),this.__position+=1),A},j.prototype.peek=function(A){var p=null;return A=A||0,A+=this.__position,A>=0&&A<this.__input_length&&(p=this.__input.charAt(A)),p},j.prototype.__match=function(A,p){A.lastIndex=p;var m=A.exec(this.__input);return m&&!(l&&A.sticky)&&m.index!==p&&(m=null),m},j.prototype.test=function(A,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(A,p):!1},j.prototype.testChar=function(A,p){var m=this.peek(p);return A.lastIndex=0,m!==null&&A.test(m)},j.prototype.match=function(A){var p=this.__match(A,this.__position);return p?this.__position+=p[0].length:p=null,p},j.prototype.read=function(A,p,m){var y="",x;return A&&(x=this.match(A),x&&(y+=x[0])),p&&(x||!A)&&(y+=this.readUntil(p,m)),y},j.prototype.readUntil=function(A,p){var m="",y=this.__position;A.lastIndex=this.__position;var x=A.exec(this.__input);return x?(y=x.index,p&&(y+=x[0].length)):y=this.__input_length,m=this.__input.substring(this.__position,y),this.__position=y,m},j.prototype.readUntilAfter=function(A){return this.readUntil(A,!0)},j.prototype.get_regexp=function(A,p){var m=null,y="g";return p&&l&&(y="y"),typeof A=="string"&&A!==""?m=new RegExp(A,y):A&&(m=new RegExp(A.source,y)),m},j.prototype.get_literal_regexp=function(A){return RegExp(A.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},j.prototype.peekUntilAfter=function(A){var p=this.__position,m=this.readUntilAfter(A);return this.__position=p,m},j.prototype.lookBack=function(A){var p=this.__position-1;return p>=A.length&&this.__input.substring(p-A.length,p).toLowerCase()===A},ee.exports.InputScanner=j},,,,,function(ee){function l(j,A){j=typeof j=="string"?j:j.source,A=typeof A=="string"?A:A.source,this.__directives_block_pattern=new RegExp(j+/ beautify( \w+[:]\w+)+ /.source+A,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(j+/\sbeautify\signore:end\s/.source+A,"g")}l.prototype.get_directives=function(j){if(!j.match(this.__directives_block_pattern))return null;var A={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(j);p;)A[p[1]]=p[2],p=this.__directive_pattern.exec(j);return A},l.prototype.readIgnored=function(j){return j.readUntilAfter(this.__directives_end_ignore_pattern)},ee.exports.Directives=l},,function(ee,l,j){var A=j(16).Beautifier,p=j(17).Options;function m(y,x){var M=new A(y,x);return M.beautify()}ee.exports=m,ee.exports.defaultOptions=function(){return new p}},function(ee,l,j){var A=j(17).Options,p=j(2).Output,m=j(8).InputScanner,y=j(13).Directives,x=new y(/\/\*/,/\*\//),M=/\r\n|[\r\n]/,F=/\r\n|[\r\n]/g,z=/\s/,I=/(?:\s|\n)+/g,C=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,U=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function H(J,he){this._source_text=J||"",this._options=new A(he),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"]}H.prototype.eatString=function(J){var he="";for(this._ch=this._input.next();this._ch;){if(he+=this._ch,this._ch==="\\")he+=this._input.next();else if(J.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return he},H.prototype.eatWhitespace=function(J){for(var he=z.test(this._input.peek()),X=0;z.test(this._input.peek());)this._ch=this._input.next(),J&&this._ch===`
`&&(X===0||X<this._options.max_preserve_newlines)&&(X++,this._output.add_new_line(!0));return he},H.prototype.foundNestedPseudoClass=function(){for(var J=0,he=1,X=this._input.peek(he);X;){if(X==="{")return!0;if(X==="(")J+=1;else if(X===")"){if(J===0)return!1;J-=1}else if(X===";"||X==="}")return!1;he++,X=this._input.peek(he)}return!1},H.prototype.print_string=function(J){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(J)},H.prototype.preserveSingleSpace=function(J){J&&(this._output.space_before_token=!0)},H.prototype.indent=function(){this._indentLevel++},H.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},H.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var J=this._source_text,he=this._options.eol;he==="auto"&&(he=`
`,J&&M.test(J||"")&&(he=J.match(M)[0])),J=J.replace(F,`
`);var X=J.match(/^[\t ]*/)[0];this._output=new p(this._options,X),this._input=new m(J),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var oe=0,_e=!1,ie=!1,ze=!1,k=!1,S=!1,w=this._ch,P=!1,W,K,_;W=this._input.read(I),K=W!=="",_=w,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),w=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var v=this._input.read(C),D=x.get_directives(v);D&&D.ignore==="start"&&(v+=x.readIgnored(this._input)),this.print_string(v),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(U)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(K),this.print_string(this._ch);var Z=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Z.match(/[ :]$/)&&(Z=this.eatString(": ").replace(/\s+$/,""),this.print_string(Z),this._output.space_before_token=!0),oe===0&&Z.indexOf(":")!==-1&&(ie=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(K),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var fe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);fe.match(/[ :]$/)&&(fe=this.eatString(": ").replace(/\s+$/,""),this.print_string(fe),this._output.space_before_token=!0),oe===0&&fe.indexOf(":")!==-1?(ie=!0,this.indent()):fe in this.NESTED_AT_RULE?(this._nestedLevel+=1,fe in this.CONDITIONAL_GROUP_RULE&&(ze=!0)):oe===0&&!ie&&(k=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(K),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")ie&&(ie=!1,this.outdent()),k=!1,ze?(ze=!1,_e=this._indentLevel>=this._nestedLevel):_e=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&_e&&this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(_==="("?this._output.space_before_token=!1:_!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),_==="{"&&this._output.trim(!0),ie&&(this.outdent(),ie=!1),this.print_string(this._ch),_e=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&this._input.peek()!=="}"&&this._output.add_new_line(!0),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var ye=0;ye<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;ye++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[ye])){P=!0;break}(_e||ze)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!k&&oe===0?(this.print_string(":"),ie||(ie=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Oe=_==='"'||_==="'";this.preserveSingleSpace(Oe||K),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")P=!1,oe===0?(ie&&(this.outdent(),ie=!1),k=!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(),oe++,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(")")),oe&&(oe--,this.outdent()));else{var Ne=!1;this._input.lookBack("with")&&(Ne=!0),this.preserveSingleSpace(K||Ne),this.print_string(this._ch),ie&&_==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),S=!0):(this.eatWhitespace(),oe++,this.indent())}else if(this._ch===")")oe&&(oe--,this.outdent()),S&&this._input.peek()===";"&&this._options.selector_separator_newline&&(S=!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&&(!ie||S)&&oe===0&&!k?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!ie&&oe===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&z.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(K),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),z.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var ve=_==='"'||_==="'";this.preserveSingleSpace(ve||K),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&P&&this._output.add_new_line()}var Me=this._output.get_code(he);return Me},ee.exports.Beautifier=H},function(ee,l,j){var A=j(6).Options;function p(m){A.call(this,m,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var y=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||y;var x=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var M=0;M<x.length;M++)x[M]!=="expand"?this.brace_style="collapse":this.brace_style=x[M]}p.prototype=new A,ee.exports.Options=p}],$={};function g(ee){var l=$[ee];if(l!==void 0)return l.exports;var j=$[ee]={exports:{}};return ne[ee](j,j.exports,g),j.exports}var ue=g(15);re=ue})();var De=re;O=[],N=function(){return{css_beautify:De}}.apply(at,O),N!==void 0&&(Ut.exports=N)})()},40998:function(Ut,at,O){var N,re;(function(){var De;(function(){"use strict";var ue=[,,function(A){function p(x){this.__parent=x,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=[]}p.prototype.clone_empty=function(){var x=new p(this.__parent);return x.set_indent(this.__indent_count,this.__alignment_count),x},p.prototype.item=function(x){return x<0?this.__items[this.__items.length+x]:this.__items[x]},p.prototype.has_match=function(x){for(var M=this.__items.length-1;M>=0;M--)if(this.__items[M].match(x))return!0;return!1},p.prototype.set_indent=function(x,M){this.is_empty()&&(this.__indent_count=x||0,this.__alignment_count=M||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},p.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)},p.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},p.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var x=this.__parent.current_line;return x.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),x.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),x.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,x.__items[0]===" "&&(x.__items.splice(0,1),x.__character_count-=1),!0}return!1},p.prototype.is_empty=function(){return this.__items.length===0},p.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},p.prototype.push=function(x){this.__items.push(x);var M=x.lastIndexOf(`
`);M!==-1?this.__character_count=x.length-M:this.__character_count+=x.length},p.prototype.pop=function(){var x=null;return this.is_empty()||(x=this.__items.pop(),this.__character_count-=x.length),x},p.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},p.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},p.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},p.prototype.toString=function(){var x="";return this.is_empty()?this.__parent.indent_empty_lines&&(x=this.__parent.get_indent_string(this.__indent_count)):(x=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),x+=this.__items.join("")),x};function m(x,M){this.__cache=[""],this.__indent_size=x.indent_size,this.__indent_string=x.indent_char,x.indent_with_tabs||(this.__indent_string=new Array(x.indent_size+1).join(x.indent_char)),M=M||"",x.indent_level>0&&(M=new Array(x.indent_level+1).join(this.__indent_string)),this.__base_string=M,this.__base_string_length=M.length}m.prototype.get_indent_size=function(x,M){var F=this.__base_string_length;return M=M||0,x<0&&(F=0),F+=x*this.__indent_size,F+=M,F},m.prototype.get_indent_string=function(x,M){var F=this.__base_string;return M=M||0,x<0&&(x=0,F=""),M+=x*this.__indent_size,this.__ensure_cache(M),F+=this.__cache[M],F},m.prototype.__ensure_cache=function(x){for(;x>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var x=this.__cache.length,M=0,F="";this.__indent_size&&x>=this.__indent_size&&(M=Math.floor(x/this.__indent_size),x-=M*this.__indent_size,F=new Array(M+1).join(this.__indent_string)),x&&(F+=new Array(x+1).join(" ")),this.__cache.push(F)};function y(x,M){this.__indent_cache=new m(x,M),this.raw=!1,this._end_with_newline=x.end_with_newline,this.indent_size=x.indent_size,this.wrap_line_length=x.wrap_line_length,this.indent_empty_lines=x.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new p(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}y.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},y.prototype.get_line_number=function(){return this.__lines.length},y.prototype.get_indent_string=function(x,M){return this.__indent_cache.get_indent_string(x,M)},y.prototype.get_indent_size=function(x,M){return this.__indent_cache.get_indent_size(x,M)},y.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},y.prototype.add_new_line=function(x){return this.is_empty()||!x&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},y.prototype.get_code=function(x){this.trim(!0);var M=this.current_line.pop();M&&(M[M.length-1]===`
`&&(M=M.replace(/\n+$/g,"")),this.current_line.push(M)),this._end_with_newline&&this.__add_outputline();var F=this.__lines.join(`
`);return x!==`
`&&(F=F.replace(/[\n]/g,x)),F},y.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},y.prototype.set_indent=function(x,M){return x=x||0,M=M||0,this.next_line.set_indent(x,M),this.__lines.length>1?(this.current_line.set_indent(x,M),!0):(this.current_line.set_indent(),!1)},y.prototype.add_raw_token=function(x){for(var M=0;M<x.newlines;M++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(x.whitespace_before),this.current_line.push(x.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},y.prototype.add_token=function(x){this.__add_space_before_token(),this.current_line.push(x),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},y.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(" "))},y.prototype.remove_indent=function(x){for(var M=this.__lines.length;x<M;)this.__lines[x]._remove_indent(),x++;this.current_line._remove_wrap_indent()},y.prototype.trim=function(x){for(x=x===void 0?!1:x,this.current_line.trim();x&&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},y.prototype.just_added_newline=function(){return this.current_line.is_empty()},y.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},y.prototype.ensure_empty_line_above=function(x,M){for(var F=this.__lines.length-2;F>=0;){var z=this.__lines[F];if(z.is_empty())break;if(z.item(0).indexOf(x)!==0&&z.item(-1)!==M){this.__lines.splice(F+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}F--}},A.exports.Output=y},function(A){function p(m,y,x,M){this.type=m,this.text=y,this.comments_before=null,this.newlines=x||0,this.whitespace_before=M||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}A.exports.Token=p},,,function(A){function p(x,M){this.raw_options=m(x,M),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}p.prototype._get_array=function(x,M){var F=this.raw_options[x],z=M||[];return typeof F=="object"?F!==null&&typeof F.concat=="function"&&(z=F.concat()):typeof F=="string"&&(z=F.split(/[^a-zA-Z0-9_\/\-]+/)),z},p.prototype._get_boolean=function(x,M){var F=this.raw_options[x],z=F===void 0?!!M:!!F;return z},p.prototype._get_characters=function(x,M){var F=this.raw_options[x],z=M||"";return typeof F=="string"&&(z=F.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),z},p.prototype._get_number=function(x,M){var F=this.raw_options[x];M=parseInt(M,10),isNaN(M)&&(M=0);var z=parseInt(F,10);return isNaN(z)&&(z=M),z},p.prototype._get_selection=function(x,M,F){var z=this._get_selection_list(x,M,F);if(z.length!==1)throw new Error("Invalid Option Value: The option '"+x+`' can only be one of the following values:
`+M+`
You passed in: '`+this.raw_options[x]+"'");return z[0]},p.prototype._get_selection_list=function(x,M,F){if(!M||M.length===0)throw new Error("Selection list cannot be empty.");if(F=F||[M[0]],!this._is_valid_selection(F,M))throw new Error("Invalid Default Value!");var z=this._get_array(x,F);if(!this._is_valid_selection(z,M))throw new Error("Invalid Option Value: The option '"+x+`' can contain only the following values:
`+M+`
You passed in: '`+this.raw_options[x]+"'");return z},p.prototype._is_valid_selection=function(x,M){return x.length&&M.length&&!x.some(function(F){return M.indexOf(F)===-1})};function m(x,M){var F={};x=y(x);var z;for(z in x)z!==M&&(F[z]=x[z]);if(M&&x[M])for(z in x[M])F[z]=x[M][z];return F}function y(x){var M={},F;for(F in x){var z=F.replace(/-/g,"_");M[z]=x[F]}return M}A.exports.Options=p,A.exports.normalizeOpts=y,A.exports.mergeOpts=m},,function(A){var p=RegExp.prototype.hasOwnProperty("sticky");function m(y){this.__input=y||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__input.charAt(this.__position),this.__position+=1),y},m.prototype.peek=function(y){var x=null;return y=y||0,y+=this.__position,y>=0&&y<this.__input_length&&(x=this.__input.charAt(y)),x},m.prototype.__match=function(y,x){y.lastIndex=x;var M=y.exec(this.__input);return M&&!(p&&y.sticky)&&M.index!==x&&(M=null),M},m.prototype.test=function(y,x){return x=x||0,x+=this.__position,x>=0&&x<this.__input_length?!!this.__match(y,x):!1},m.prototype.testChar=function(y,x){var M=this.peek(x);return y.lastIndex=0,M!==null&&y.test(M)},m.prototype.match=function(y){var x=this.__match(y,this.__position);return x?this.__position+=x[0].length:x=null,x},m.prototype.read=function(y,x,M){var F="",z;return y&&(z=this.match(y),z&&(F+=z[0])),x&&(z||!y)&&(F+=this.readUntil(x,M)),F},m.prototype.readUntil=function(y,x){var M="",F=this.__position;y.lastIndex=this.__position;var z=y.exec(this.__input);return z?(F=z.index,x&&(F+=z[0].length)):F=this.__input_length,M=this.__input.substring(this.__position,F),this.__position=F,M},m.prototype.readUntilAfter=function(y){return this.readUntil(y,!0)},m.prototype.get_regexp=function(y,x){var M=null,F="g";return x&&p&&(F="y"),typeof y=="string"&&y!==""?M=new RegExp(y,F):y&&(M=new RegExp(y.source,F)),M},m.prototype.get_literal_regexp=function(y){return RegExp(y.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(y){var x=this.__position,M=this.readUntilAfter(y);return this.__position=x,M},m.prototype.lookBack=function(y){var x=this.__position-1;return x>=y.length&&this.__input.substring(x-y.length,x).toLowerCase()===y},A.exports.InputScanner=m},function(A,p,m){var y=m(8).InputScanner,x=m(3).Token,M=m(10).TokenStream,F=m(11).WhitespacePattern,z={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},I=function(C,U){this._input=new y(C),this._options=U||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new F(this._input)};I.prototype.tokenize=function(){this._input.restart(),this.__tokens=new M,this._reset();for(var C,U=new x(z.START,""),H=null,J=[],he=new M;U.type!==z.EOF;){for(C=this._get_next_token(U,H);this._is_comment(C);)he.add(C),C=this._get_next_token(U,H);he.isEmpty()||(C.comments_before=he,he=new M),C.parent=H,this._is_opening(C)?(J.push(H),H=C):H&&this._is_closing(C,H)&&(C.opened=H,H.closed=C,H=J.pop(),C.parent=H),C.previous=U,U.next=C,this.__tokens.add(C),U=C}return this.__tokens},I.prototype._is_first_token=function(){return this.__tokens.isEmpty()},I.prototype._reset=function(){},I.prototype._get_next_token=function(C,U){this._readWhitespace();var H=this._input.read(/.+/g);return H?this._create_token(z.RAW,H):this._create_token(z.EOF,"")},I.prototype._is_comment=function(C){return!1},I.prototype._is_opening=function(C){return!1},I.prototype._is_closing=function(C,U){return!1},I.prototype._create_token=function(C,U){var H=new x(C,U,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return H},I.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},A.exports.Tokenizer=I,A.exports.TOKEN=z},function(A){function p(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}p.prototype.restart=function(){this.__position=0},p.prototype.isEmpty=function(){return this.__tokens_length===0},p.prototype.hasNext=function(){return this.__position<this.__tokens_length},p.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},p.prototype.peek=function(m){var y=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(y=this.__tokens[m]),y},p.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},A.exports.TokenStream=p},function(A,p,m){var y=m(12).Pattern;function x(M,F){y.call(this,M,F),F?this._line_regexp=this._input.get_regexp(F._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}x.prototype=new y,x.prototype.__set_whitespace_patterns=function(M,F){M+="\\t ",F+="\\n\\r",this._match_pattern=this._input.get_regexp("["+M+F+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+F+"]")},x.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var M=this._input.read(this._match_pattern);if(M===" ")this.whitespace_before_token=" ";else if(M){var F=this.__split(this._newline_regexp,M);this.newline_count=F.length-1,this.whitespace_before_token=F[this.newline_count]}return M},x.prototype.matching=function(M,F){var z=this._create();return z.__set_whitespace_patterns(M,F),z._update(),z},x.prototype._create=function(){return new x(this._input,this)},x.prototype.__split=function(M,F){M.lastIndex=0;for(var z=0,I=[],C=M.exec(F);C;)I.push(F.substring(z,C.index)),z=C.index+C[0].length,C=M.exec(F);return z<F.length?I.push(F.substring(z,F.length)):I.push(""),I},A.exports.WhitespacePattern=x},function(A){function p(m,y){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,y&&(this._starting_pattern=this._input.get_regexp(y._starting_pattern,!0),this._match_pattern=this._input.get_regexp(y._match_pattern,!0),this._until_pattern=this._input.get_regexp(y._until_pattern),this._until_after=y._until_after)}p.prototype.read=function(){var m=this._input.read(this._starting_pattern);return(!this._starting_pattern||m)&&(m+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),m},p.prototype.read_match=function(){return this._input.match(this._match_pattern)},p.prototype.until_after=function(m){var y=this._create();return y._until_after=!0,y._until_pattern=this._input.get_regexp(m),y._update(),y},p.prototype.until=function(m){var y=this._create();return y._until_after=!1,y._until_pattern=this._input.get_regexp(m),y._update(),y},p.prototype.starting_with=function(m){var y=this._create();return y._starting_pattern=this._input.get_regexp(m,!0),y._update(),y},p.prototype.matching=function(m){var y=this._create();return y._match_pattern=this._input.get_regexp(m,!0),y._update(),y},p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){},A.exports.Pattern=p},function(A){function p(m,y){m=typeof m=="string"?m:m.source,y=typeof y=="string"?y:y.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+y,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+y,"g")}p.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var y={};this.__directive_pattern.lastIndex=0;for(var x=this.__directive_pattern.exec(m);x;)y[x[1]]=x[2],x=this.__directive_pattern.exec(m);return y},p.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},A.exports.Directives=p},function(A,p,m){var y=m(12).Pattern,x={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function M(F,z){y.call(this,F,z),this.__template_pattern=null,this._disabled=Object.assign({},x),this._excluded=Object.assign({},x),z&&(this.__template_pattern=this._input.get_regexp(z.__template_pattern),this._excluded=Object.assign(this._excluded,z._excluded),this._disabled=Object.assign(this._disabled,z._disabled));var I=new y(F);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}/)}}M.prototype=new y,M.prototype._create=function(){return new M(this._input,this)},M.prototype._update=function(){this.__set_templated_pattern()},M.prototype.disable=function(F){var z=this._create();return z._disabled[F]=!0,z._update(),z},M.prototype.read_options=function(F){var z=this._create();for(var I in x)z._disabled[I]=F.templating.indexOf(I)===-1;return z._update(),z},M.prototype.exclude=function(F){var z=this._create();return z._excluded[F]=!0,z._update(),z},M.prototype.read=function(){var F="";this._match_pattern?F=this._input.read(this._starting_pattern):F=this._input.read(this._starting_pattern,this.__template_pattern);for(var z=this._read_template();z;)this._match_pattern?z+=this._input.read(this._match_pattern):z+=this._input.readUntil(this.__template_pattern),F+=z,z=this._read_template();return this._until_after&&(F+=this._input.readUntilAfter(this._until_pattern)),F},M.prototype.__set_templated_pattern=function(){var F=[];this._disabled.php||F.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||F.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||F.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||F.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(F.push(this.__patterns.django._starting_pattern.source),F.push(this.__patterns.django_value._starting_pattern.source),F.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||F.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&F.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+F.join("|")+")")},M.prototype._read_template=function(){var F="",z=this._input.peek();if(z==="<"){var I=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&I==="?"&&(F=F||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&I==="%"&&(F=F||this.__patterns.erb.read())}else z==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(F=F||this.__patterns.handlebars_comment.read(),F=F||this.__patterns.handlebars_unescaped.read(),F=F||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(F=F||this.__patterns.django_value.read()),this._excluded.django||(F=F||this.__patterns.django_comment.read(),F=F||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(F=F||this.__patterns.smarty_comment.read(),F=F||this.__patterns.smarty_literal.read(),F=F||this.__patterns.smarty.read()));return F},A.exports.TemplatablePattern=M},,,,function(A,p,m){var y=m(19).Beautifier,x=m(20).Options;function M(F,z,I,C){var U=new y(F,z,I,C);return U.beautify()}A.exports=M,A.exports.defaultOptions=function(){return new x}},function(A,p,m){var y=m(20).Options,x=m(2).Output,M=m(21).Tokenizer,F=m(21).TOKEN,z=/\r\n|[\r\n]/,I=/\r\n|[\r\n]/g,C=function(k,S){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=k.max_preserve_newlines,this.preserve_newlines=k.preserve_newlines,this._output=new x(k,S)};C.prototype.current_line_has_match=function(k){return this._output.current_line.has_match(k)},C.prototype.set_space_before_token=function(k,S){this._output.space_before_token=k,this._output.non_breaking_space=S},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(k){this._output.add_raw_token(k)},C.prototype.print_preserved_newlines=function(k){var S=0;k.type!==F.TEXT&&k.previous.type!==F.TEXT&&(S=k.newlines?1:0),this.preserve_newlines&&(S=k.newlines<this.max_preserve_newlines+1?k.newlines:this.max_preserve_newlines+1);for(var w=0;w<S;w++)this.print_newline(w>0);return S!==0},C.prototype.traverse_whitespace=function(k){return k.whitespace_before||k.newlines?(this.print_preserved_newlines(k)||(this._output.space_before_token=!0),!0):!1},C.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},C.prototype.print_newline=function(k){this._output.add_new_line(k)},C.prototype.print_token=function(k){k.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(k.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(k){return k=this.indent_level+(k||0),k<1?"":this._output.get_indent_string(k)};var U=function(k){for(var S=null,w=k.next;w.type!==F.EOF&&k.closed!==w;){if(w.type===F.ATTRIBUTE&&w.text==="type"){w.next&&w.next.type===F.EQUALS&&w.next.next&&w.next.next.type===F.VALUE&&(S=w.next.next.text);break}w=w.next}return S},H=function(k,S){var w=null,P=null;return S.closed?(k==="script"?w="text/javascript":k==="style"&&(w="text/css"),w=U(S)||w,w.search("text/css")>-1?P="css":w.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?P="javascript":w.search(/(text|application|dojo)\/(x-)?(html)/)>-1?P="html":w.search(/test\/null/)>-1&&(P="null"),P):null};function J(k,S){return S.indexOf(k)!==-1}function he(k,S,w){this.parent=k||null,this.tag=S?S.tag_name:"",this.indent_level=w||0,this.parser_token=S||null}function X(k){this._printer=k,this._current_frame=null}X.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},X.prototype.record_tag=function(k){var S=new he(this._current_frame,k,this._printer.indent_level);this._current_frame=S},X.prototype._try_pop_frame=function(k){var S=null;return k&&(S=k.parser_token,this._printer.indent_level=k.indent_level,this._current_frame=k.parent),S},X.prototype._get_frame=function(k,S){for(var w=this._current_frame;w&&k.indexOf(w.tag)===-1;){if(S&&S.indexOf(w.tag)!==-1){w=null;break}w=w.parent}return w},X.prototype.try_pop=function(k,S){var w=this._get_frame([k],S);return this._try_pop_frame(w)},X.prototype.indent_to_tag=function(k){var S=this._get_frame(k);S&&(this._printer.indent_level=S.indent_level)};function oe(k,S,w,P){this._source_text=k||"",S=S||{},this._js_beautify=w,this._css_beautify=P,this._tag_stack=null;var W=new y(S,"html");this._options=W,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,5)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,8)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}oe.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var k=this._source_text,S=this._options.eol;this._options.eol==="auto"&&(S=`
`,k&&z.test(k)&&(S=k.match(z)[0])),k=k.replace(I,`
`);var w=k.match(/^[\t ]*/)[0],P={text:"",type:""},W=new _e(this._options),K=new C(this._options,w),_=new M(k,this._options).tokenize();this._tag_stack=new X(K);for(var v=null,D=_.next();D.type!==F.EOF;)D.type===F.TAG_OPEN||D.type===F.COMMENT?(v=this._handle_tag_open(K,D,W,P,_),W=v):D.type===F.ATTRIBUTE||D.type===F.EQUALS||D.type===F.VALUE||D.type===F.TEXT&&!W.tag_complete?v=this._handle_inside_tag(K,D,W,P):D.type===F.TAG_CLOSE?v=this._handle_tag_close(K,D,W):D.type===F.TEXT?v=this._handle_text(K,D,W):D.type===F.CONTROL_FLOW_OPEN?v=this._handle_control_flow_open(K,D):D.type===F.CONTROL_FLOW_CLOSE?v=this._handle_control_flow_close(K,D):K.add_raw_token(D),P=v,D=_.next();var Z=K._output.get_code(S);return Z},oe.prototype._handle_control_flow_open=function(k,S){var w={text:S.text,type:S.type};return k.set_space_before_token(S.newlines||S.whitespace_before!=="",!0),S.newlines?k.print_preserved_newlines(S):k.set_space_before_token(S.newlines||S.whitespace_before!=="",!0),k.print_token(S),k.indent(),w},oe.prototype._handle_control_flow_close=function(k,S){var w={text:S.text,type:S.type};return k.deindent(),S.newlines?k.print_preserved_newlines(S):k.set_space_before_token(S.newlines||S.whitespace_before!=="",!0),k.print_token(S),w},oe.prototype._handle_tag_close=function(k,S,w){var P={text:S.text,type:S.type};return k.alignment_size=0,w.tag_complete=!0,k.set_space_before_token(S.newlines||S.whitespace_before!=="",!0),w.is_unformatted?k.add_raw_token(S):(w.tag_start_char==="<"&&(k.set_space_before_token(S.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&w.has_wrapped_attrs&&k.print_newline(!1)),k.print_token(S)),w.indent_content&&!(w.is_unformatted||w.is_content_unformatted)&&(k.indent(),w.indent_content=!1),!w.is_inline_element&&!(w.is_unformatted||w.is_content_unformatted)&&k.set_wrap_point(),P},oe.prototype._handle_inside_tag=function(k,S,w,P){var W=w.has_wrapped_attrs,K={text:S.text,type:S.type};return k.set_space_before_token(S.newlines||S.whitespace_before!=="",!0),w.is_unformatted?k.add_raw_token(S):w.tag_start_char==="{"&&S.type===F.TEXT?k.print_preserved_newlines(S)?(S.newlines=0,k.add_raw_token(S)):k.print_token(S):(S.type===F.ATTRIBUTE?k.set_space_before_token(!0):(S.type===F.EQUALS||S.type===F.VALUE&&S.previous.type===F.EQUALS)&&k.set_space_before_token(!1),S.type===F.ATTRIBUTE&&w.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(k.traverse_whitespace(S),W=W||S.newlines!==0),this._is_wrap_attributes_force&&w.attr_count>=this._options.wrap_attributes_min_attrs&&(P.type!==F.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(k.print_newline(!1),W=!0)),k.print_token(S),W=W||k.previous_token_wrapped(),w.has_wrapped_attrs=W),K},oe.prototype._handle_text=function(k,S,w){var P={text:S.text,type:"TK_CONTENT"};return w.custom_beautifier_name?this._print_custom_beatifier_text(k,S,w):w.is_unformatted||w.is_content_unformatted?k.add_raw_token(S):(k.traverse_whitespace(S),k.print_token(S)),P},oe.prototype._print_custom_beatifier_text=function(k,S,w){var P=this;if(S.text!==""){var W=S.text,K,_=1,v="",D="";w.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?K=this._js_beautify:w.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?K=this._css_beautify:w.custom_beautifier_name==="html"&&(K=function(ve,Me){var Ae=new oe(ve,Me,P._js_beautify,P._css_beautify);return Ae.beautify()}),this._options.indent_scripts==="keep"?_=0:this._options.indent_scripts==="separate"&&(_=-k.indent_level);var Z=k.get_full_indent(_);if(W=W.replace(/\n[ \t]*$/,""),w.custom_beautifier_name!=="html"&&W[0]==="<"&&W.match(/^(<!--|<!\[CDATA\[)/)){var fe=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(W);if(!fe){k.add_raw_token(S);return}v=Z+fe[1]+`
`,W=fe[4],fe[5]&&(D=Z+fe[5]),W=W.replace(/\n[ \t]*$/,""),(fe[2]||fe[3].indexOf(`
`)!==-1)&&(fe=fe[3].match(/[ \t]+$/),fe&&(S.whitespace_before=fe[0]))}if(W)if(K){var ye=function(){this.eol=`
`};ye.prototype=this._options.raw_options;var Oe=new ye;W=K(Z+W,Oe)}else{var Ne=S.whitespace_before;Ne&&(W=W.replace(new RegExp(`
(`+Ne+")?","g"),`
`)),W=Z+W.replace(/\n/g,`
`+Z)}v&&(W?W=v+W+`
`+D:W=v+D),k.print_newline(!1),W&&(S.text=W,S.whitespace_before="",S.newlines=0,k.add_raw_token(S),k.print_newline(!0))}},oe.prototype._handle_tag_open=function(k,S,w,P,W){var K=this._get_tag_open_token(S);if((w.is_unformatted||w.is_content_unformatted)&&!w.is_empty_element&&S.type===F.TAG_OPEN&&!K.is_start_tag?(k.add_raw_token(S),K.start_tag_token=this._tag_stack.try_pop(K.tag_name)):(k.traverse_whitespace(S),this._set_tag_position(k,S,K,w,P),K.is_inline_element||k.set_wrap_point(),k.print_token(S)),K.is_start_tag&&this._is_wrap_attributes_force){var _=0,v;do v=W.peek(_),v.type===F.ATTRIBUTE&&(K.attr_count+=1),_+=1;while(v.type!==F.EOF&&v.type!==F.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(K.alignment_size=S.text.length+1),!K.tag_complete&&!K.is_unformatted&&(k.alignment_size=K.alignment_size),K};var _e=function(k,S,w){if(this.parent=S||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="",!w)this.tag_complete=!0;else{var P;this.tag_start_char=w.text[0],this.text=w.text,this.tag_start_char==="<"?(P=w.text.match(/^<([^\s>]*)/),this.tag_check=P?P[1]:""):(P=w.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=P?P[1]:"",(w.text.startsWith("{{#>")||w.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&w.next!==null?this.tag_check=w.next.text.split(" ")[0]:this.tag_check=w.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),w.type===F.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||w.closed&&w.closed.text==="/>";var W=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(W=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!k.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(W)))}};oe.prototype._get_tag_open_token=function(k){var S=new _e(this._options,this._tag_stack.get_parser_token(),k);return S.alignment_size=this._options.wrap_attributes_indent_size,S.is_end_tag=S.is_end_tag||J(S.tag_check,this._options.void_elements),S.is_empty_element=S.tag_complete||S.is_start_tag&&S.is_end_tag,S.is_unformatted=!S.tag_complete&&J(S.tag_check,this._options.unformatted),S.is_content_unformatted=!S.is_empty_element&&J(S.tag_check,this._options.content_unformatted),S.is_inline_element=J(S.tag_name,this._options.inline)||this._options.inline_custom_elements&&S.tag_name.includes("-")||S.tag_start_char==="{",S},oe.prototype._set_tag_position=function(k,S,w,P,W){if(w.is_empty_element||(w.is_end_tag?w.start_tag_token=this._tag_stack.try_pop(w.tag_name):(this._do_optional_end_element(w)&&(w.is_inline_element||k.print_newline(!1)),this._tag_stack.record_tag(w),(w.tag_name==="script"||w.tag_name==="style")&&!(w.is_unformatted||w.is_content_unformatted)&&(w.custom_beautifier_name=H(w.tag_check,S)))),J(w.tag_check,this._options.extra_liners)&&(k.print_newline(!1),k._output.just_added_blankline()||k.print_newline(!0)),w.is_empty_element){if(w.tag_start_char==="{"&&w.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),w.indent_content=!0;var K=k.current_line_has_match(/{{#if/);K||k.print_newline(!1)}w.tag_name==="!--"&&W.type===F.TAG_CLOSE&&P.is_end_tag&&w.text.indexOf(`
`)===-1||(w.is_inline_element||w.is_unformatted||k.print_newline(!1),this._calcluate_parent_multiline(k,w))}else if(w.is_end_tag){var _=!1;_=w.start_tag_token&&w.start_tag_token.multiline_content,_=_||!w.is_inline_element&&!(P.is_inline_element||P.is_unformatted)&&!(W.type===F.TAG_CLOSE&&w.start_tag_token===P)&&W.type!=="TK_CONTENT",(w.is_content_unformatted||w.is_unformatted)&&(_=!1),_&&k.print_newline(!1)}else w.indent_content=!w.custom_beautifier_name,w.tag_start_char==="<"&&(w.tag_name==="html"?w.indent_content=this._options.indent_inner_html:w.tag_name==="head"?w.indent_content=this._options.indent_head_inner_html:w.tag_name==="body"&&(w.indent_content=this._options.indent_body_inner_html)),!(w.is_inline_element||w.is_unformatted)&&(W.type!=="TK_CONTENT"||w.is_content_unformatted)&&k.print_newline(!1),this._calcluate_parent_multiline(k,w)},oe.prototype._calcluate_parent_multiline=function(k,S){S.parent&&k._output.just_added_newline()&&!((S.is_inline_element||S.is_unformatted)&&S.parent.is_inline_element)&&(S.parent.multiline_content=!0)};var ie=["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"],ze=["a","audio","del","ins","map","noscript","video"];oe.prototype._do_optional_end_element=function(k){var S=null;if(!(k.is_empty_element||!k.is_start_tag||!k.parent)){if(k.tag_name==="body")S=S||this._tag_stack.try_pop("head");else if(k.tag_name==="li")S=S||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(k.tag_name==="dd"||k.tag_name==="dt")S=S||this._tag_stack.try_pop("dt",["dl"]),S=S||this._tag_stack.try_pop("dd",["dl"]);else if(k.parent.tag_name==="p"&&ie.indexOf(k.tag_name)!==-1){var w=k.parent.parent;(!w||ze.indexOf(w.tag_name)===-1)&&(S=S||this._tag_stack.try_pop("p"))}else k.tag_name==="rp"||k.tag_name==="rt"?(S=S||this._tag_stack.try_pop("rt",["ruby","rtc"]),S=S||this._tag_stack.try_pop("rp",["ruby","rtc"])):k.tag_name==="optgroup"?S=S||this._tag_stack.try_pop("optgroup",["select"]):k.tag_name==="option"?S=S||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):k.tag_name==="colgroup"?S=S||this._tag_stack.try_pop("caption",["table"]):k.tag_name==="thead"?(S=S||this._tag_stack.try_pop("caption",["table"]),S=S||this._tag_stack.try_pop("colgroup",["table"])):k.tag_name==="tbody"||k.tag_name==="tfoot"?(S=S||this._tag_stack.try_pop("caption",["table"]),S=S||this._tag_stack.try_pop("colgroup",["table"]),S=S||this._tag_stack.try_pop("thead",["table"]),S=S||this._tag_stack.try_pop("tbody",["table"])):k.tag_name==="tr"?(S=S||this._tag_stack.try_pop("caption",["table"]),S=S||this._tag_stack.try_pop("colgroup",["table"]),S=S||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(k.tag_name==="th"||k.tag_name==="td")&&(S=S||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),S=S||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return k.parent=this._tag_stack.get_parser_token(),S}},A.exports.Beautifier=oe},function(A,p,m){var y=m(6).Options;function x(M){y.call(this,M,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_min_attrs=this._get_number("wrap_attributes_min_attrs",2),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.inline_custom_elements=this._get_boolean("inline_custom_elements",!0),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}x.prototype=new y,A.exports.Options=x},function(A,p,m){var y=m(9).Tokenizer,x=m(9).TOKEN,M=m(13).Directives,F=m(14).TemplatablePattern,z=m(12).Pattern,I={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",CONTROL_FLOW_OPEN:"TK_CONTROL_FLOW_OPEN",CONTROL_FLOW_CLOSE:"TK_CONTROL_FLOW_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:x.START,RAW:x.RAW,EOF:x.EOF},C=new M(/<\!--/,/-->/),U=function(H,J){y.call(this,H,J),this._current_tag_name="";var he=new F(this._input).read_options(this._options),X=new z(this._input);if(this.__patterns={word:he.until(/[\n\r\t <]/),word_control_flow_close_excluded:he.until(/[\n\r\t <}]/),single_quote:he.until_after(/'/),double_quote:he.until_after(/"/),attribute:he.until(/[\n\r\t =>]|\/>/),element_name:he.until(/[\n\r\t >\/]/),angular_control_flow_start:X.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:X.starting_with(/{{!--/).until_after(/--}}/),handlebars:X.starting_with(/{{/).until_after(/}}/),handlebars_open:X.until(/[\n\r\t }]/),handlebars_raw_close:X.until(/}}/),comment:X.starting_with(/<!--/).until_after(/-->/),cdata:X.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:X.starting_with(/<!\[/).until_after(/]>/),processing:X.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars"),this.__patterns.word_control_flow_close_excluded=this.__patterns.word_control_flow_close_excluded.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var oe=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=X.matching(oe).until_after(oe)}};U.prototype=new y,U.prototype._is_comment=function(H){return!1},U.prototype._is_opening=function(H){return H.type===I.TAG_OPEN||H.type===I.CONTROL_FLOW_OPEN},U.prototype._is_closing=function(H,J){return H.type===I.TAG_CLOSE&&J&&((H.text===">"||H.text==="/>")&&J.text[0]==="<"||H.text==="}}"&&J.text[0]==="{"&&J.text[1]==="{")||H.type===I.CONTROL_FLOW_CLOSE&&H.text==="}"&&J.text.endsWith("{")},U.prototype._reset=function(){this._current_tag_name=""},U.prototype._get_next_token=function(H,J){var he=null;this._readWhitespace();var X=this._input.peek();return X===null?this._create_token(I.EOF,""):(he=he||this._read_open_handlebars(X,J),he=he||this._read_attribute(X,H,J),he=he||this._read_close(X,J),he=he||this._read_script_and_style(X,H),he=he||this._read_control_flows(X,J),he=he||this._read_raw_content(X,H,J),he=he||this._read_content_word(X,J),he=he||this._read_comment_or_cdata(X),he=he||this._read_processing(X),he=he||this._read_open(X,J),he=he||this._create_token(I.UNKNOWN,this._input.next()),he)},U.prototype._read_comment_or_cdata=function(H){var J=null,he=null,X=null;if(H==="<"){var oe=this._input.peek(1);oe==="!"&&(he=this.__patterns.comment.read(),he?(X=C.get_directives(he),X&&X.ignore==="start"&&(he+=C.readIgnored(this._input))):he=this.__patterns.cdata.read()),he&&(J=this._create_token(I.COMMENT,he),J.directives=X)}return J},U.prototype._read_processing=function(H){var J=null,he=null,X=null;if(H==="<"){var oe=this._input.peek(1);(oe==="!"||oe==="?")&&(he=this.__patterns.conditional_comment.read(),he=he||this.__patterns.processing.read()),he&&(J=this._create_token(I.COMMENT,he),J.directives=X)}return J},U.prototype._read_open=function(H,J){var he=null,X=null;return(!J||J.type===I.CONTROL_FLOW_OPEN)&&H==="<"&&(he=this._input.next(),this._input.peek()==="/"&&(he+=this._input.next()),he+=this.__patterns.element_name.read(),X=this._create_token(I.TAG_OPEN,he)),X},U.prototype._read_open_handlebars=function(H,J){var he=null,X=null;return(!J||J.type===I.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&H==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(he=this.__patterns.handlebars_comment.read(),he=he||this.__patterns.handlebars.read(),X=this._create_token(I.COMMENT,he)):(he=this.__patterns.handlebars_open.read(),X=this._create_token(I.TAG_OPEN,he))),X},U.prototype._read_control_flows=function(H,J){var he="",X=null;if(!this._options.templating.includes("angular"))return X;if(H==="@"){if(he=this.__patterns.angular_control_flow_start.read(),he==="")return X;for(var oe=he.endsWith("(")?1:0,_e=0;!(he.endsWith("{")&&oe===_e);){var ie=this._input.next();if(ie===null)break;ie==="("?oe++:ie===")"&&_e++,he+=ie}X=this._create_token(I.CONTROL_FLOW_OPEN,he)}else H==="}"&&J&&J.type===I.CONTROL_FLOW_OPEN&&(he=this._input.next(),X=this._create_token(I.CONTROL_FLOW_CLOSE,he));return X},U.prototype._read_close=function(H,J){var he=null,X=null;return J&&J.type===I.TAG_OPEN&&(J.text[0]==="<"&&(H===">"||H==="/"&&this._input.peek(1)===">")?(he=this._input.next(),H==="/"&&(he+=this._input.next()),X=this._create_token(I.TAG_CLOSE,he)):J.text[0]==="{"&&H==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),X=this._create_token(I.TAG_CLOSE,"}}"))),X},U.prototype._read_attribute=function(H,J,he){var X=null,oe="";if(he&&he.text[0]==="<")if(H==="=")X=this._create_token(I.EQUALS,this._input.next());else if(H==='"'||H==="'"){var _e=this._input.next();H==='"'?_e+=this.__patterns.double_quote.read():_e+=this.__patterns.single_quote.read(),X=this._create_token(I.VALUE,_e)}else oe=this.__patterns.attribute.read(),oe&&(J.type===I.EQUALS?X=this._create_token(I.VALUE,oe):X=this._create_token(I.ATTRIBUTE,oe));return X},U.prototype._is_content_unformatted=function(H){return this._options.void_elements.indexOf(H)===-1&&(this._options.content_unformatted.indexOf(H)!==-1||this._options.unformatted.indexOf(H)!==-1)},U.prototype._read_raw_content=function(H,J,he){var X="";if(he&&he.text[0]==="{")X=this.__patterns.handlebars_raw_close.read();else if(J.type===I.TAG_CLOSE&&J.opened.text[0]==="<"&&J.text[0]!=="/"){var oe=J.opened.text.substr(1).toLowerCase();this._is_content_unformatted(oe)&&(X=this._input.readUntil(new RegExp("</"+oe+"[\\n\\r\\t ]*?>","ig")))}return X?this._create_token(I.TEXT,X):null},U.prototype._read_script_and_style=function(H,J){if(J.type===I.TAG_CLOSE&&J.opened.text[0]==="<"&&J.text[0]!=="/"){var he=J.opened.text.substr(1).toLowerCase();if(he==="script"||he==="style"){var X=this._read_comment_or_cdata(H);if(X)return X.type=I.TEXT,X;var oe=this._input.readUntil(new RegExp("</"+he+"[\\n\\r\\t ]*?>","ig"));if(oe)return this._create_token(I.TEXT,oe)}}return null},U.prototype._read_content_word=function(H,J){var he="";return this._options.unformatted_content_delimiter&&H===this._options.unformatted_content_delimiter[0]&&(he=this.__patterns.unformatted_content_delimiter.read()),he||(he=J&&J.type===I.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),he?this._create_token(I.TEXT,he):null},A.exports.Tokenizer=U,A.exports.TOKEN=I}],ee={};function l(A){var p=ee[A];if(p!==void 0)return p.exports;var m=ee[A]={exports:{}};return ue[A](m,m.exports,l),m.exports}var j=l(18);De=j})();var ne=De;if(1)N=[O,O(58553),O(87804)],re=function(ue){var ee=O(58553),l=O(87804);return{html_beautify:function(j,A){return ne(j,A,ee.js_beautify,l.css_beautify)}}}.apply(at,N),re!==void 0&&(Ut.exports=re);else var $,g})()},58553:function(Ut,at){var O,N;(function(){var re;(function(){"use strict";var ne=[function(ee,l,j){var A=j(1).Beautifier,p=j(5).Options;function m(y,x){var M=new A(y,x);return M.beautify()}ee.exports=m,ee.exports.defaultOptions=function(){return new p}},function(ee,l,j){var A=j(2).Output,p=j(3).Token,m=j(4),y=j(5).Options,x=j(7).Tokenizer,M=j(7).line_starters,F=j(7).positionable_operators,z=j(7).TOKEN;function I(v,D){return D.indexOf(v)!==-1}function C(v){return v.replace(/^\s+/g,"")}function U(v){for(var D={},Z=0;Z<v.length;Z++)D[v[Z].replace(/-/g,"_")]=v[Z];return D}function H(v,D){return v&&v.type===z.RESERVED&&v.text===D}function J(v,D){return v&&v.type===z.RESERVED&&I(v.text,D)}var he=["case","return","do","if","throw","else","await","break","continue","async"],X=["before-newline","after-newline","preserve-newline"],oe=U(X),_e=[oe.before_newline,oe.preserve_newline],ie={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function ze(v,D){D.multiline_frame||D.mode===ie.ForInitializer||D.mode===ie.Conditional||v.remove_indent(D.start_line_index)}function k(v){v=v.replace(m.allLineBreaks,`
`);for(var D=[],Z=v.indexOf(`
`);Z!==-1;)D.push(v.substring(0,Z)),v=v.substring(Z+1),Z=v.indexOf(`
`);return v.length&&D.push(v),D}function S(v){return v===ie.ArrayLiteral}function w(v){return I(v,[ie.Expression,ie.ForInitializer,ie.Conditional])}function P(v,D){for(var Z=0;Z<v.length;Z++){var fe=v[Z].trim();if(fe.charAt(0)!==D)return!1}return!0}function W(v,D){for(var Z=0,fe=v.length,ye;Z<fe;Z++)if(ye=v[Z],ye&&ye.indexOf(D)!==0)return!1;return!0}function K(v,D){D=D||{},this._source_text=v||"",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 y(D)}K.prototype.create_flags=function(v,D){var Z=0;v&&(Z=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>Z&&(Z=v.line_indent_level));var fe={mode:D,parent:v,last_token:v?v.last_token:new p(z.START_BLOCK,""),last_word:v?v.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:Z,alignment:0,line_indent_level:v?v.line_indent_level:Z,start_line_index:this._output.get_line_number(),ternary_depth:0};return fe},K.prototype._reset=function(v){var D=v.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new A(this._options,D),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(ie.BlockStatement);var Z=new x(v,this._options);return this._tokens=Z.tokenize(),v},K.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,D=this._reset(this._source_text),Z=this._options.eol;this._options.eol==="auto"&&(Z=`
`,D&&m.lineBreak.test(D||"")&&(Z=D.match(m.lineBreak)[0]));for(var fe=this._tokens.next();fe;)this.handle_token(fe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=fe,fe=this._tokens.next();return v=this._output.get_code(Z),v},K.prototype.handle_token=function(v,D){v.type===z.START_EXPR?this.handle_start_expr(v):v.type===z.END_EXPR?this.handle_end_expr(v):v.type===z.START_BLOCK?this.handle_start_block(v):v.type===z.END_BLOCK?this.handle_end_block(v):v.type===z.WORD?this.handle_word(v):v.type===z.RESERVED?this.handle_word(v):v.type===z.SEMICOLON?this.handle_semicolon(v):v.type===z.STRING?this.handle_string(v):v.type===z.EQUALS?this.handle_equals(v):v.type===z.OPERATOR?this.handle_operator(v):v.type===z.COMMA?this.handle_comma(v):v.type===z.BLOCK_COMMENT?this.handle_block_comment(v,D):v.type===z.COMMENT?this.handle_comment(v,D):v.type===z.DOT?this.handle_dot(v):v.type===z.EOF?this.handle_eof(v):v.type===z.UNKNOWN?this.handle_unknown(v,D):this.handle_unknown(v,D)},K.prototype.handle_whitespace_and_comments=function(v,D){var Z=v.newlines,fe=this._options.keep_array_indentation&&S(this._flags.mode);if(v.comments_before)for(var ye=v.comments_before.next();ye;)this.handle_whitespace_and_comments(ye,D),this.handle_token(ye,D),ye=v.comments_before.next();if(fe)for(var Oe=0;Oe<Z;Oe+=1)this.print_newline(Oe>0,D);else if(this._options.max_preserve_newlines&&Z>this._options.max_preserve_newlines&&(Z=this._options.max_preserve_newlines),this._options.preserve_newlines&&Z>1){this.print_newline(!1,D);for(var Ne=1;Ne<Z;Ne+=1)this.print_newline(!0,D)}};var _=["async","break","continue","return","throw","yield"];K.prototype.allow_wrap_or_preserved_newline=function(v,D){if(D=D===void 0?!1:D,!this._output.just_added_newline()){var Z=this._options.preserve_newlines&&v.newlines||D,fe=I(this._flags.last_token.text,F)||I(v.text,F);if(fe){var ye=I(this._flags.last_token.text,F)&&I(this._options.operator_position,_e)||I(v.text,F);Z=Z&&ye}if(Z)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(J(this._flags.last_token,_))return;this._output.set_wrap_point()}}},K.prototype.print_newline=function(v,D){if(!D&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==z.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var Z=this._tokens.peek();this._flags.mode===ie.Statement&&!(this._flags.if_block&&H(Z,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},K.prototype.print_token_line_indentation=function(v){this._output.just_added_newline()&&(this._options.keep_array_indentation&&v.newlines&&(v.text==="["||S(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(v.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))},K.prototype.print_token=function(v){if(this._output.raw){this._output.add_raw_token(v);return}if(this._options.comma_first&&v.previous&&v.previous.type===z.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var D=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(D),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(v),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(v),this._output.non_breaking_space=!0,this._output.add_token(v.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},K.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},K.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))},K.prototype.set_mode=function(v){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,v),this._flags=this.create_flags(this._previous_flags,v),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},K.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===ie.Statement&&ze(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},K.prototype.start_of_object_property=function(){return this._flags.parent.mode===ie.ObjectLiteral&&this._flags.mode===ie.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||J(this._flags.last_token,["get","set"]))},K.prototype.start_of_statement=function(v){var D=!1;return D=D||J(this._flags.last_token,["var","let","const"])&&v.type===z.WORD,D=D||H(this._flags.last_token,"do"),D=D||!(this._flags.parent.mode===ie.ObjectLiteral&&this._flags.mode===ie.Statement)&&J(this._flags.last_token,_)&&!v.newlines,D=D||H(this._flags.last_token,"else")&&!(H(v,"if")&&!v.comments_before),D=D||this._flags.last_token.type===z.END_EXPR&&(this._previous_flags.mode===ie.ForInitializer||this._previous_flags.mode===ie.Conditional),D=D||this._flags.last_token.type===z.WORD&&this._flags.mode===ie.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==z.WORD&&v.type!==z.RESERVED,D=D||this._flags.mode===ie.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||J(this._flags.last_token,["get","set"])),D?(this.set_mode(ie.Statement),this.indent(),this.handle_whitespace_and_comments(v,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v,J(v,["do","for","if","while"])),!0):!1},K.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var D=ie.Expression;if(v.text==="["){if(this._flags.last_token.type===z.WORD||this._flags.last_token.text===")"){J(this._flags.last_token,M)&&(this._output.space_before_token=!0),this.print_token(v),this.set_mode(D),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}D=ie.ArrayLiteral,S(this._flags.mode)&&(this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline()),I(this._flags.last_token.type,[z.START_EXPR,z.END_EXPR,z.WORD,z.OPERATOR,z.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===z.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,D=ie.ForInitializer):I(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,D=ie.Conditional):I(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&v.whitespace_before===""?this._output.space_before_token=!1:(I(this._flags.last_token.text,M)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===z.EQUALS||this._flags.last_token.type===z.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v);else if(this._flags.last_token.type===z.WORD){this._output.space_before_token=!1;var Z=this._tokens.peek(-3);if(this._options.space_after_named_function&&Z){var fe=this._tokens.peek(-4);J(Z,["async","function"])||Z.text==="*"&&J(fe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===ie.ObjectLiteral?(Z.text==="{"||Z.text===","||Z.text==="*"&&(fe.text==="{"||fe.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(v);(this._flags.last_token.type===z.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===ie.ObjectLiteral&&I(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===z.START_BLOCK?this.print_newline():(this._flags.last_token.type===z.END_EXPR||this._flags.last_token.type===z.START_EXPR||this._flags.last_token.type===z.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===z.COMMA)&&this.allow_wrap_or_preserved_newline(v,v.newlines),this.print_token(v),this.set_mode(D),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},K.prototype.handle_end_expr=function(v){for(;this._flags.mode===ie.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(v,v.text==="]"&&S(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===z.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(v),this.restore_mode(),ze(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===ie.Conditional&&(this._previous_flags.mode=ie.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},K.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var D=this._tokens.peek(),Z=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===z.END_EXPR?(this.set_mode(ie.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(ie.BlockStatement):Z&&(I(Z.text,[":",","])&&I(D.type,[z.STRING,z.WORD,z.RESERVED])||I(D.text,["get","set","..."])&&I(Z.type,[z.WORD,z.RESERVED]))?I(this._last_last_text,["class","interface"])&&!I(Z.text,[":",","])?this.set_mode(ie.BlockStatement):this.set_mode(ie.ObjectLiteral):this._flags.last_token.type===z.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(ie.BlockStatement):I(this._flags.last_token.type,[z.EQUALS,z.START_EXPR,z.COMMA,z.OPERATOR])||J(this._flags.last_token,["return","throw","import","default"])?this.set_mode(ie.ObjectLiteral):this.set_mode(ie.BlockStatement),this._flags.last_token&&J(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var fe=!D.comments_before&&D.text==="}",ye=fe&&this._flags.last_word==="function"&&this._flags.last_token.type===z.END_EXPR;if(this._options.brace_preserve_inline){var Oe=0,Ne=null;this._flags.inline_frame=!0;do if(Oe+=1,Ne=this._tokens.peek(Oe-1),Ne.newlines){this._flags.inline_frame=!1;break}while(Ne.type!==z.EOF&&!(Ne.type===z.END_BLOCK&&Ne.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==z.OPERATOR&&(ye||this._flags.last_token.type===z.EQUALS||J(this._flags.last_token,he)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(S(this._previous_flags.mode)&&(this._flags.last_token.type===z.START_EXPR||this._flags.last_token.type===z.COMMA)&&((this._flags.last_token.type===z.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===z.COMMA||this._flags.last_token.type===z.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(v),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==z.OPERATOR&&this._flags.last_token.type!==z.START_EXPR&&(I(this._flags.last_token.type,[z.START_BLOCK,z.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(v),this.indent(),!fe&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},K.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===ie.Statement;)this.restore_mode();var D=this._flags.last_token.type===z.START_BLOCK;this._flags.inline_frame&&!D?this._output.space_before_token=!0:this._options.brace_style==="expand"?D||this.print_newline():D||(S(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(v)},K.prototype.handle_word=function(v){if(v.type===z.RESERVED){if(I(v.text,["set","get"])&&this._flags.mode!==ie.ObjectLiteral)v.type=z.WORD;else if(v.text==="import"&&I(this._tokens.peek().text,["(","."]))v.type=z.WORD;else if(I(v.text,["as","from"])&&!this._flags.import_block)v.type=z.WORD;else if(this._flags.mode===ie.ObjectLiteral){var D=this._tokens.peek();D.text===":"&&(v.type=z.WORD)}}if(this.start_of_statement(v)?J(this._flags.last_token,["var","let","const"])&&v.type===z.WORD&&(this._flags.declaration_statement=!0):v.newlines&&!w(this._flags.mode)&&(this._flags.last_token.type!==z.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==z.EQUALS&&(this._options.preserve_newlines||!J(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(v),this.print_newline()):this.handle_whitespace_and_comments(v),this._flags.do_block&&!this._flags.do_while)if(H(v,"while")){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&H(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===ie.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&J(v,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(v),this._flags.in_case=!0;return}if((this._flags.last_token.type===z.COMMA||this._flags.last_token.type===z.START_EXPR||this._flags.last_token.type===z.EQUALS||this._flags.last_token.type===z.OPERATOR)&&!this.start_of_object_property()&&!(I(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===ie.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(v),H(v,"function")){(I(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(I(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===z.OPERATOR))&&!this._output.just_added_blankline()&&!v.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===z.RESERVED||this._flags.last_token.type===z.WORD?J(this._flags.last_token,["get","set","new","export"])||J(this._flags.last_token,_)?this._output.space_before_token=!0:H(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===z.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(w(this._flags.mode)||S(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var Z="NONE";if(this._flags.last_token.type===z.END_BLOCK?this._previous_flags.inline_frame?Z="SPACE":J(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?Z="NEWLINE":(Z="SPACE",this._output.space_before_token=!0):Z="NEWLINE":this._flags.last_token.type===z.SEMICOLON&&this._flags.mode===ie.BlockStatement?Z="NEWLINE":this._flags.last_token.type===z.SEMICOLON&&w(this._flags.mode)?Z="SPACE":this._flags.last_token.type===z.STRING?Z="NEWLINE":this._flags.last_token.type===z.RESERVED||this._flags.last_token.type===z.WORD||this._flags.last_token.text==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===ie.ObjectLiteral&&I(this._last_last_text,["{",","]))?Z="SPACE":this._flags.last_token.type===z.START_BLOCK?this._flags.inline_frame?Z="SPACE":Z="NEWLINE":this._flags.last_token.type===z.END_EXPR&&(this._output.space_before_token=!0,Z="NEWLINE"),J(v,M)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Z="SPACE":Z="NEWLINE"),J(v,["else","catch","finally"]))if((!(this._flags.last_token.type===z.END_BLOCK&&this._previous_flags.mode===ie.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var fe=this._output.current_line;fe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Z==="NEWLINE"?J(this._flags.last_token,he)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&J(v,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==z.END_EXPR?(this._flags.last_token.type!==z.START_EXPR||!J(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(H(v,"if")&&H(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):J(v,M)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&S(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Z==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===z.WORD||v.previous.type===z.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===z.RESERVED&&(v.text==="do"?this._flags.do_block=!0:v.text==="if"?this._flags.if_block=!0:v.text==="import"?this._flags.import_block=!0:this._flags.import_block&&H(v,"from")&&(this._flags.import_block=!1))},K.prototype.handle_semicolon=function(v){this.start_of_statement(v)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(v);for(var D=this._tokens.peek();this._flags.mode===ie.Statement&&!(this._flags.if_block&&H(D,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(v)},K.prototype.handle_string=function(v){v.text.startsWith("`")&&v.newlines===0&&v.whitespace_before===""&&(v.previous.text===")"||this._flags.last_token.type===z.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),this._flags.last_token.type===z.RESERVED||this._flags.last_token.type===z.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===z.COMMA||this._flags.last_token.type===z.START_EXPR||this._flags.last_token.type===z.EQUALS||this._flags.last_token.type===z.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v):v.text.startsWith("`")&&this._flags.last_token.type===z.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},K.prototype.handle_equals=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0},K.prototype.handle_comma=function(v){this.handle_whitespace_and_comments(v,!0),this.print_token(v),this._output.space_before_token=!0,this._flags.declaration_statement?(w(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(v)):this._flags.mode===ie.ObjectLiteral||this._flags.mode===ie.Statement&&this._flags.parent.mode===ie.ObjectLiteral?(this._flags.mode===ie.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},K.prototype.handle_operator=function(v){var D=v.text==="*"&&(J(this._flags.last_token,["function","yield"])||I(this._flags.last_token.type,[z.START_BLOCK,z.COMMA,z.END_BLOCK,z.SEMICOLON])),Z=I(v.text,["-","+"])&&(I(this._flags.last_token.type,[z.START_BLOCK,z.START_EXPR,z.EQUALS,z.OPERATOR])||I(this._flags.last_token.text,M)||this._flags.last_token.text===",");if(!this.start_of_statement(v)){var fe=!D;this.handle_whitespace_and_comments(v,fe)}if(v.text==="*"&&this._flags.last_token.type===z.DOT){this.print_token(v);return}if(v.text==="::"){this.print_token(v);return}if(I(v.text,["-","+"])&&this.start_of_object_property()){this.print_token(v);return}if(this._flags.last_token.type===z.OPERATOR&&I(this._options.operator_position,_e)&&this.allow_wrap_or_preserved_newline(v),v.text===":"&&this._flags.in_case){this.print_token(v),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==z.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var ye=!0,Oe=!0,Ne=!1;if(v.text===":"?this._flags.ternary_depth===0?ye=!1:(this._flags.ternary_depth-=1,Ne=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!Z&&!D&&this._options.preserve_newlines&&I(v.text,F)){var ve=v.text===":",Me=ve&&Ne,Ae=ve&&!Ne;switch(this._options.operator_position){case oe.before_newline:this._output.space_before_token=!Ae,this.print_token(v),(!ve||Me)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case oe.after_newline:this._output.space_before_token=!0,!ve||Me?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(v):this._output.space_before_token=!1,this.print_token(v),this._output.space_before_token=!0;return;case oe.preserve_newline:Ae||this.allow_wrap_or_preserved_newline(v),ye=!(this._output.just_added_newline()||Ae),this._output.space_before_token=ye,this.print_token(v),this._output.space_before_token=!0;return}}if(D){this.allow_wrap_or_preserved_newline(v),ye=!1;var dt=this._tokens.peek();Oe=dt&&I(dt.type,[z.WORD,z.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),ye=this._flags.last_token.type===z.START_BLOCK,Oe=!1;else if(I(v.text,["--","++","!","~"])||Z){if((this._flags.last_token.type===z.COMMA||this._flags.last_token.type===z.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),ye=!1,Oe=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var Ce=J(this._flags.last_token,he)&&v.newlines;Ce&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(Ce,!0)}this._flags.last_token.text===";"&&w(this._flags.mode)&&(ye=!0),this._flags.last_token.type===z.RESERVED?ye=!0:this._flags.last_token.type===z.END_EXPR?ye=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===z.OPERATOR&&(ye=I(v.text,["--","-","++","+"])&&I(this._flags.last_token.text,["--","-","++","+"]),I(v.text,["+","-"])&&I(this._flags.last_token.text,["--","++"])&&(Oe=!0)),(this._flags.mode===ie.BlockStatement&&!this._flags.inline_frame||this._flags.mode===ie.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||ye,this.print_token(v),this._output.space_before_token=Oe},K.prototype.handle_block_comment=function(v,D){if(this._output.raw){this._output.add_raw_token(v),v.directives&&v.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(v.directives){this.print_newline(!1,D),this.print_token(v),v.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!m.newline.test(v.text)&&!v.newlines){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0;return}else this.print_block_commment(v,D)},K.prototype.print_block_commment=function(v,D){var Z=k(v.text),fe,ye=!1,Oe=!1,Ne=v.whitespace_before,ve=Ne.length;if(this.print_newline(!1,D),this.print_token_line_indentation(v),this._output.add_token(Z[0]),this.print_newline(!1,D),Z.length>1){for(Z=Z.slice(1),ye=P(Z,"*"),Oe=W(Z,Ne),ye&&(this._flags.alignment=1),fe=0;fe<Z.length;fe++)ye?(this.print_token_line_indentation(v),this._output.add_token(C(Z[fe]))):Oe&&Z[fe]?(this.print_token_line_indentation(v),this._output.add_token(Z[fe].substring(ve))):(this._output.current_line.set_indent(-1),this._output.add_token(Z[fe])),this.print_newline(!1,D);this._flags.alignment=0}},K.prototype.handle_comment=function(v,D){v.newlines?this.print_newline(!1,D):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(v),this.print_newline(!1,D)},K.prototype.handle_dot=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),J(this._flags.last_token,he)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(v,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(v)},K.prototype.handle_unknown=function(v,D){this.print_token(v),v.text[v.text.length-1]===`
`&&this.print_newline(!1,D)},K.prototype.handle_eof=function(v){for(;this._flags.mode===ie.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v)},ee.exports.Beautifier=K},function(ee){function l(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}l.prototype.clone_empty=function(){var p=new l(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},l.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},l.prototype.has_match=function(p){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(p))return!0;return!1},l.prototype.set_indent=function(p,m){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=m||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},l.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)},l.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},l.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},l.prototype.is_empty=function(){return this.__items.length===0},l.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},l.prototype.push=function(p){this.__items.push(p);var m=p.lastIndexOf(`
`);m!==-1?this.__character_count=p.length-m:this.__character_count+=p.length},l.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},l.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},l.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},l.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},l.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function j(p,m){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),m=m||"",p.indent_level>0&&(m=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}j.prototype.get_indent_size=function(p,m){var y=this.__base_string_length;return m=m||0,p<0&&(y=0),y+=p*this.__indent_size,y+=m,y},j.prototype.get_indent_string=function(p,m){var y=this.__base_string;return m=m||0,p<0&&(p=0,y=""),m+=p*this.__indent_size,this.__ensure_cache(m),y+=this.__cache[m],y},j.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},j.prototype.__add_column=function(){var p=this.__cache.length,m=0,y="";this.__indent_size&&p>=this.__indent_size&&(m=Math.floor(p/this.__indent_size),p-=m*this.__indent_size,y=new Array(m+1).join(this.__indent_string)),p&&(y+=new Array(p+1).join(" ")),this.__cache.push(y)};function A(p,m){this.__indent_cache=new j(p,m),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}A.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},A.prototype.get_line_number=function(){return this.__lines.length},A.prototype.get_indent_string=function(p,m){return this.__indent_cache.get_indent_string(p,m)},A.prototype.get_indent_size=function(p,m){return this.__indent_cache.get_indent_size(p,m)},A.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},A.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},A.prototype.get_code=function(p){this.trim(!0);var m=this.current_line.pop();m&&(m[m.length-1]===`
`&&(m=m.replace(/\n+$/g,"")),this.current_line.push(m)),this._end_with_newline&&this.__add_outputline();var y=this.__lines.join(`
`);return p!==`
`&&(y=y.replace(/[\n]/g,p)),y},A.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},A.prototype.set_indent=function(p,m){return p=p||0,m=m||0,this.next_line.set_indent(p,m),this.__lines.length>1?(this.current_line.set_indent(p,m),!0):(this.current_line.set_indent(),!1)},A.prototype.add_raw_token=function(p){for(var m=0;m<p.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},A.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},A.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(" "))},A.prototype.remove_indent=function(p){for(var m=this.__lines.length;p<m;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},A.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},A.prototype.just_added_newline=function(){return this.current_line.is_empty()},A.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},A.prototype.ensure_empty_line_above=function(p,m){for(var y=this.__lines.length-2;y>=0;){var x=this.__lines[y];if(x.is_empty())break;if(x.item(0).indexOf(p)!==0&&x.item(-1)!==m){this.__lines.splice(y+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}y--}},ee.exports.Output=A},function(ee){function l(j,A,p,m){this.type=j,this.text=A,this.comments_before=null,this.newlines=p||0,this.whitespace_before=m||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}ee.exports.Token=l},function(ee,l){var j="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",A="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",m="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",y="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",x="(?:"+y+"|["+j+p+"])",M="(?:"+y+"|["+A+p+m+"])*";l.identifier=new RegExp(x+M,"g"),l.identifierStart=new RegExp(x),l.identifierMatch=new RegExp("(?:"+y+"|["+A+p+m+"])+");var F=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;l.newline=/[\n\r\u2028\u2029]/,l.lineBreak=new RegExp(`\r
|`+l.newline.source),l.allLineBreaks=new RegExp(l.lineBreak.source,"g")},function(ee,l,j){var A=j(6).Options,p=["before-newline","after-newline","preserve-newline"];function m(y){A.call(this,y,"js");var x=this.raw_options.brace_style||null;x==="expand-strict"?this.raw_options.brace_style="expand":x==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var M=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var F=0;F<M.length;F++)M[F]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=M[F];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",p),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}m.prototype=new A,ee.exports.Options=m},function(ee){function l(p,m){this.raw_options=j(p,m),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(p,m){var y=this.raw_options[p],x=m||[];return typeof y=="object"?y!==null&&typeof y.concat=="function"&&(x=y.concat()):typeof y=="string"&&(x=y.split(/[^a-zA-Z0-9_\/\-]+/)),x},l.prototype._get_boolean=function(p,m){var y=this.raw_options[p],x=y===void 0?!!m:!!y;return x},l.prototype._get_characters=function(p,m){var y=this.raw_options[p],x=m||"";return typeof y=="string"&&(x=y.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),x},l.prototype._get_number=function(p,m){var y=this.raw_options[p];m=parseInt(m,10),isNaN(m)&&(m=0);var x=parseInt(y,10);return isNaN(x)&&(x=m),x},l.prototype._get_selection=function(p,m,y){var x=this._get_selection_list(p,m,y);if(x.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[p]+"'");return x[0]},l.prototype._get_selection_list=function(p,m,y){if(!m||m.length===0)throw new Error("Selection list cannot be empty.");if(y=y||[m[0]],!this._is_valid_selection(y,m))throw new Error("Invalid Default Value!");var x=this._get_array(p,y);if(!this._is_valid_selection(x,m))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[p]+"'");return x},l.prototype._is_valid_selection=function(p,m){return p.length&&m.length&&!p.some(function(y){return m.indexOf(y)===-1})};function j(p,m){var y={};p=A(p);var x;for(x in p)x!==m&&(y[x]=p[x]);if(m&&p[m])for(x in p[m])y[x]=p[m][x];return y}function A(p){var m={},y;for(y in p){var x=y.replace(/-/g,"_");m[x]=p[y]}return m}ee.exports.Options=l,ee.exports.normalizeOpts=A,ee.exports.mergeOpts=j},function(ee,l,j){var A=j(8).InputScanner,p=j(9).Tokenizer,m=j(9).TOKEN,y=j(13).Directives,x=j(4),M=j(12).Pattern,F=j(14).TemplatablePattern;function z(P,W){return W.indexOf(P)!==-1}var I={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:m.START,RAW:m.RAW,EOF:m.EOF},C=new y(/\/\*/,/\*\//),U=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,H=/[0-9]/,J=/[^\d\.]/,he=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),X=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";X=X.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),X="\\?\\.(?!\\d) "+X,X=X.replace(/ /g,"|");var oe=new RegExp(X),_e="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),ie=_e.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),ze=new RegExp("^(?:"+ie.join("|")+")$"),k,S=function(P,W){p.call(this,P,W),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var K=new M(this._input),_=new F(this._input).read_options(this._options);this.__patterns={template:_,identifier:_.starting_with(x.identifier).matching(x.identifierMatch),number:K.matching(U),punct:K.matching(oe),comment:K.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:K.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:K.matching(/<!--/),html_comment_end:K.matching(/-->/),include:K.starting_with(/#include/).until_after(x.lineBreak),shebang:K.starting_with(/#!/).until_after(x.lineBreak),xml:K.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:_.until(/['\\\n\r\u2028\u2029]/),double_quote:_.until(/["\\\n\r\u2028\u2029]/),template_text:_.until(/[`\\$]/),template_expression:_.until(/[`}\\]/)}};S.prototype=new p,S.prototype._is_comment=function(P){return P.type===I.COMMENT||P.type===I.BLOCK_COMMENT||P.type===I.UNKNOWN},S.prototype._is_opening=function(P){return P.type===I.START_BLOCK||P.type===I.START_EXPR},S.prototype._is_closing=function(P,W){return(P.type===I.END_BLOCK||P.type===I.END_EXPR)&&W&&(P.text==="]"&&W.text==="["||P.text===")"&&W.text==="("||P.text==="}"&&W.text==="{")},S.prototype._reset=function(){k=!1},S.prototype._get_next_token=function(P,W){var K=null;this._readWhitespace();var _=this._input.peek();return _===null?this._create_token(I.EOF,""):(K=K||this._read_non_javascript(_),K=K||this._read_string(_),K=K||this._read_pair(_,this._input.peek(1)),K=K||this._read_word(P),K=K||this._read_singles(_),K=K||this._read_comment(_),K=K||this._read_regexp(_,P),K=K||this._read_xml(_,P),K=K||this._read_punctuation(),K=K||this._create_token(I.UNKNOWN,this._input.next()),K)},S.prototype._read_word=function(P){var W;if(W=this.__patterns.identifier.read(),W!=="")return W=W.replace(x.allLineBreaks,`
`),!(P.type===I.DOT||P.type===I.RESERVED&&(P.text==="set"||P.text==="get"))&&ze.test(W)?(W==="in"||W==="of")&&(P.type===I.WORD||P.type===I.STRING)?this._create_token(I.OPERATOR,W):this._create_token(I.RESERVED,W):this._create_token(I.WORD,W);if(W=this.__patterns.number.read(),W!=="")return this._create_token(I.WORD,W)},S.prototype._read_singles=function(P){var W=null;return P==="("||P==="["?W=this._create_token(I.START_EXPR,P):P===")"||P==="]"?W=this._create_token(I.END_EXPR,P):P==="{"?W=this._create_token(I.START_BLOCK,P):P==="}"?W=this._create_token(I.END_BLOCK,P):P===";"?W=this._create_token(I.SEMICOLON,P):P==="."&&J.test(this._input.peek(1))?W=this._create_token(I.DOT,P):P===","&&(W=this._create_token(I.COMMA,P)),W&&this._input.next(),W},S.prototype._read_pair=function(P,W){var K=null;return P==="#"&&W==="{"&&(K=this._create_token(I.START_BLOCK,P+W)),K&&(this._input.next(),this._input.next()),K},S.prototype._read_punctuation=function(){var P=this.__patterns.punct.read();if(P!=="")return P==="="?this._create_token(I.EQUALS,P):P==="?."?this._create_token(I.DOT,P):this._create_token(I.OPERATOR,P)},S.prototype._read_non_javascript=function(P){var W="";if(P==="#"){if(this._is_first_token()&&(W=this.__patterns.shebang.read(),W))return this._create_token(I.UNKNOWN,W.trim()+`
`);if(W=this.__patterns.include.read(),W)return this._create_token(I.UNKNOWN,W.trim()+`
`);P=this._input.next();var K="#";if(this._input.hasNext()&&this._input.testChar(H)){do P=this._input.next(),K+=P;while(this._input.hasNext()&&P!=="#"&&P!=="=");return P==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(K+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(K+="{}",this._input.next(),this._input.next())),this._create_token(I.WORD,K)}this._input.back()}else if(P==="<"&&this._is_first_token()){if(W=this.__patterns.html_comment_start.read(),W){for(;this._input.hasNext()&&!this._input.testChar(x.newline);)W+=this._input.next();return k=!0,this._create_token(I.COMMENT,W)}}else if(k&&P==="-"&&(W=this.__patterns.html_comment_end.read(),W))return k=!1,this._create_token(I.COMMENT,W);return null},S.prototype._read_comment=function(P){var W=null;if(P==="/"){var K="";if(this._input.peek(1)==="*"){K=this.__patterns.block_comment.read();var _=C.get_directives(K);_&&_.ignore==="start"&&(K+=C.readIgnored(this._input)),K=K.replace(x.allLineBreaks,`
`),W=this._create_token(I.BLOCK_COMMENT,K),W.directives=_}else this._input.peek(1)==="/"&&(K=this.__patterns.comment.read(),W=this._create_token(I.COMMENT,K))}return W},S.prototype._read_string=function(P){if(P==="`"||P==="'"||P==='"'){var W=this._input.next();return this.has_char_escapes=!1,P==="`"?W+=this._read_string_recursive("`",!0,"${"):W+=this._read_string_recursive(P),this.has_char_escapes&&this._options.unescape_strings&&(W=w(W)),this._input.peek()===P&&(W+=this._input.next()),W=W.replace(x.allLineBreaks,`
`),this._create_token(I.STRING,W)}return null},S.prototype._allow_regexp_or_xml=function(P){return P.type===I.RESERVED&&z(P.text,["return","case","throw","else","do","typeof","yield"])||P.type===I.END_EXPR&&P.text===")"&&P.opened.previous.type===I.RESERVED&&z(P.opened.previous.text,["if","while","for"])||z(P.type,[I.COMMENT,I.START_EXPR,I.START_BLOCK,I.START,I.END_BLOCK,I.OPERATOR,I.EQUALS,I.EOF,I.SEMICOLON,I.COMMA])},S.prototype._read_regexp=function(P,W){if(P==="/"&&this._allow_regexp_or_xml(W)){for(var K=this._input.next(),_=!1,v=!1;this._input.hasNext()&&(_||v||this._input.peek()!==P)&&!this._input.testChar(x.newline);)K+=this._input.peek(),_?_=!1:(_=this._input.peek()==="\\",this._input.peek()==="["?v=!0:this._input.peek()==="]"&&(v=!1)),this._input.next();return this._input.peek()===P&&(K+=this._input.next(),K+=this._input.read(x.identifier)),this._create_token(I.STRING,K)}return null},S.prototype._read_xml=function(P,W){if(this._options.e4x&&P==="<"&&this._allow_regexp_or_xml(W)){var K="",_=this.__patterns.xml.read_match();if(_){for(var v=_[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),D=v.indexOf("{")===0,Z=0;_;){var fe=!!_[1],ye=_[2],Oe=!!_[_.length-1]||ye.slice(0,8)==="![CDATA[";if(!Oe&&(ye===v||D&&ye.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(fe?--Z:++Z),K+=_[0],Z<=0)break;_=this.__patterns.xml.read_match()}return _||(K+=this._input.match(/[\s\S]*/g)[0]),K=K.replace(x.allLineBreaks,`
`),this._create_token(I.STRING,K)}}return null};function w(P){for(var W="",K=0,_=new A(P),v=null;_.hasNext();)if(v=_.match(/([\s]|[^\\]|\\\\)+/g),v&&(W+=v[0]),_.peek()==="\\"){if(_.next(),_.peek()==="x")v=_.match(/x([0-9A-Fa-f]{2})/g);else if(_.peek()==="u")v=_.match(/u([0-9A-Fa-f]{4})/g),v||(v=_.match(/u\{([0-9A-Fa-f]+)\}/g));else{W+="\\",_.hasNext()&&(W+=_.next());continue}if(!v||(K=parseInt(v[1],16),K>126&&K<=255&&v[0].indexOf("x")===0))return P;K>=0&&K<32||K>1114111?W+="\\"+v[0]:K===34||K===39||K===92?W+="\\"+String.fromCharCode(K):W+=String.fromCharCode(K)}return W}S.prototype._read_string_recursive=function(P,W,K){var _,v;P==="'"?v=this.__patterns.single_quote:P==='"'?v=this.__patterns.double_quote:P==="`"?v=this.__patterns.template_text:P==="}"&&(v=this.__patterns.template_expression);for(var D=v.read(),Z="";this._input.hasNext();){if(Z=this._input.next(),Z===P||!W&&x.newline.test(Z)){this._input.back();break}else Z==="\\"&&this._input.hasNext()?(_=this._input.peek(),_==="x"||_==="u"?this.has_char_escapes=!0:_==="\r"&&this._input.peek(1)===`
`&&this._input.next(),Z+=this._input.next()):K&&(K==="${"&&Z==="$"&&this._input.peek()==="{"&&(Z+=this._input.next()),K===Z&&(P==="`"?Z+=this._read_string_recursive("}",W,"`"):Z+=this._read_string_recursive("`",W,"${"),this._input.hasNext()&&(Z+=this._input.next())));Z+=v.read(),D+=Z}return D},ee.exports.Tokenizer=S,ee.exports.TOKEN=I,ee.exports.positionable_operators=he.slice(),ee.exports.line_starters=_e.slice()},function(ee){var l=RegExp.prototype.hasOwnProperty("sticky");function j(A){this.__input=A||"",this.__input_length=this.__input.length,this.__position=0}j.prototype.restart=function(){this.__position=0},j.prototype.back=function(){this.__position>0&&(this.__position-=1)},j.prototype.hasNext=function(){return this.__position<this.__input_length},j.prototype.next=function(){var A=null;return this.hasNext()&&(A=this.__input.charAt(this.__position),this.__position+=1),A},j.prototype.peek=function(A){var p=null;return A=A||0,A+=this.__position,A>=0&&A<this.__input_length&&(p=this.__input.charAt(A)),p},j.prototype.__match=function(A,p){A.lastIndex=p;var m=A.exec(this.__input);return m&&!(l&&A.sticky)&&m.index!==p&&(m=null),m},j.prototype.test=function(A,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(A,p):!1},j.prototype.testChar=function(A,p){var m=this.peek(p);return A.lastIndex=0,m!==null&&A.test(m)},j.prototype.match=function(A){var p=this.__match(A,this.__position);return p?this.__position+=p[0].length:p=null,p},j.prototype.read=function(A,p,m){var y="",x;return A&&(x=this.match(A),x&&(y+=x[0])),p&&(x||!A)&&(y+=this.readUntil(p,m)),y},j.prototype.readUntil=function(A,p){var m="",y=this.__position;A.lastIndex=this.__position;var x=A.exec(this.__input);return x?(y=x.index,p&&(y+=x[0].length)):y=this.__input_length,m=this.__input.substring(this.__position,y),this.__position=y,m},j.prototype.readUntilAfter=function(A){return this.readUntil(A,!0)},j.prototype.get_regexp=function(A,p){var m=null,y="g";return p&&l&&(y="y"),typeof A=="string"&&A!==""?m=new RegExp(A,y):A&&(m=new RegExp(A.source,y)),m},j.prototype.get_literal_regexp=function(A){return RegExp(A.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},j.prototype.peekUntilAfter=function(A){var p=this.__position,m=this.readUntilAfter(A);return this.__position=p,m},j.prototype.lookBack=function(A){var p=this.__position-1;return p>=A.length&&this.__input.substring(p-A.length,p).toLowerCase()===A},ee.exports.InputScanner=j},function(ee,l,j){var A=j(8).InputScanner,p=j(3).Token,m=j(10).TokenStream,y=j(11).WhitespacePattern,x={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},M=function(F,z){this._input=new A(F),this._options=z||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new y(this._input)};M.prototype.tokenize=function(){this._input.restart(),this.__tokens=new m,this._reset();for(var F,z=new p(x.START,""),I=null,C=[],U=new m;z.type!==x.EOF;){for(F=this._get_next_token(z,I);this._is_comment(F);)U.add(F),F=this._get_next_token(z,I);U.isEmpty()||(F.comments_before=U,U=new m),F.parent=I,this._is_opening(F)?(C.push(I),I=F):I&&this._is_closing(F,I)&&(F.opened=I,I.closed=F,I=C.pop(),F.parent=I),F.previous=z,z.next=F,this.__tokens.add(F),z=F}return this.__tokens},M.prototype._is_first_token=function(){return this.__tokens.isEmpty()},M.prototype._reset=function(){},M.prototype._get_next_token=function(F,z){this._readWhitespace();var I=this._input.read(/.+/g);return I?this._create_token(x.RAW,I):this._create_token(x.EOF,"")},M.prototype._is_comment=function(F){return!1},M.prototype._is_opening=function(F){return!1},M.prototype._is_closing=function(F,z){return!1},M.prototype._create_token=function(F,z){var I=new p(F,z,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return I},M.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},ee.exports.Tokenizer=M,ee.exports.TOKEN=x},function(ee){function l(j){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=j}l.prototype.restart=function(){this.__position=0},l.prototype.isEmpty=function(){return this.__tokens_length===0},l.prototype.hasNext=function(){return this.__position<this.__tokens_length},l.prototype.next=function(){var j=null;return this.hasNext()&&(j=this.__tokens[this.__position],this.__position+=1),j},l.prototype.peek=function(j){var A=null;return j=j||0,j+=this.__position,j>=0&&j<this.__tokens_length&&(A=this.__tokens[j]),A},l.prototype.add=function(j){this.__parent_token&&(j.parent=this.__parent_token),this.__tokens.push(j),this.__tokens_length+=1},ee.exports.TokenStream=l},function(ee,l,j){var A=j(12).Pattern;function p(m,y){A.call(this,m,y),y?this._line_regexp=this._input.get_regexp(y._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}p.prototype=new A,p.prototype.__set_whitespace_patterns=function(m,y){m+="\\t ",y+="\\n\\r",this._match_pattern=this._input.get_regexp("["+m+y+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+y+"]")},p.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var m=this._input.read(this._match_pattern);if(m===" ")this.whitespace_before_token=" ";else if(m){var y=this.__split(this._newline_regexp,m);this.newline_count=y.length-1,this.whitespace_before_token=y[this.newline_count]}return m},p.prototype.matching=function(m,y){var x=this._create();return x.__set_whitespace_patterns(m,y),x._update(),x},p.prototype._create=function(){return new p(this._input,this)},p.prototype.__split=function(m,y){m.lastIndex=0;for(var x=0,M=[],F=m.exec(y);F;)M.push(y.substring(x,F.index)),x=F.index+F[0].length,F=m.exec(y);return x<y.length?M.push(y.substring(x,y.length)):M.push(""),M},ee.exports.WhitespacePattern=p},function(ee){function l(j,A){this._input=j,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,A&&(this._starting_pattern=this._input.get_regexp(A._starting_pattern,!0),this._match_pattern=this._input.get_regexp(A._match_pattern,!0),this._until_pattern=this._input.get_regexp(A._until_pattern),this._until_after=A._until_after)}l.prototype.read=function(){var j=this._input.read(this._starting_pattern);return(!this._starting_pattern||j)&&(j+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),j},l.prototype.read_match=function(){return this._input.match(this._match_pattern)},l.prototype.until_after=function(j){var A=this._create();return A._until_after=!0,A._until_pattern=this._input.get_regexp(j),A._update(),A},l.prototype.until=function(j){var A=this._create();return A._until_after=!1,A._until_pattern=this._input.get_regexp(j),A._update(),A},l.prototype.starting_with=function(j){var A=this._create();return A._starting_pattern=this._input.get_regexp(j,!0),A._update(),A},l.prototype.matching=function(j){var A=this._create();return A._match_pattern=this._input.get_regexp(j,!0),A._update(),A},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},ee.exports.Pattern=l},function(ee){function l(j,A){j=typeof j=="string"?j:j.source,A=typeof A=="string"?A:A.source,this.__directives_block_pattern=new RegExp(j+/ beautify( \w+[:]\w+)+ /.source+A,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(j+/\sbeautify\signore:end\s/.source+A,"g")}l.prototype.get_directives=function(j){if(!j.match(this.__directives_block_pattern))return null;var A={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(j);p;)A[p[1]]=p[2],p=this.__directive_pattern.exec(j);return A},l.prototype.readIgnored=function(j){return j.readUntilAfter(this.__directives_end_ignore_pattern)},ee.exports.Directives=l},function(ee,l,j){var A=j(12).Pattern,p={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function m(y,x){A.call(this,y,x),this.__template_pattern=null,this._disabled=Object.assign({},p),this._excluded=Object.assign({},p),x&&(this.__template_pattern=this._input.get_regexp(x.__template_pattern),this._excluded=Object.assign(this._excluded,x._excluded),this._disabled=Object.assign(this._disabled,x._disabled));var M=new A(y);this.__patterns={handlebars_comment:M.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:M.starting_with(/{{{/).until_after(/}}}/),handlebars:M.starting_with(/{{/).until_after(/}}/),php:M.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:M.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:M.starting_with(/{%/).until_after(/%}/),django_value:M.starting_with(/{{/).until_after(/}}/),django_comment:M.starting_with(/{#/).until_after(/#}/),smarty:M.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:M.starting_with(/{\*/).until_after(/\*}/),smarty_literal:M.starting_with(/{literal}/).until_after(/{\/literal}/)}}m.prototype=new A,m.prototype._create=function(){return new m(this._input,this)},m.prototype._update=function(){this.__set_templated_pattern()},m.prototype.disable=function(y){var x=this._create();return x._disabled[y]=!0,x._update(),x},m.prototype.read_options=function(y){var x=this._create();for(var M in p)x._disabled[M]=y.templating.indexOf(M)===-1;return x._update(),x},m.prototype.exclude=function(y){var x=this._create();return x._excluded[y]=!0,x._update(),x},m.prototype.read=function(){var y="";this._match_pattern?y=this._input.read(this._starting_pattern):y=this._input.read(this._starting_pattern,this.__template_pattern);for(var x=this._read_template();x;)this._match_pattern?x+=this._input.read(this._match_pattern):x+=this._input.readUntil(this.__template_pattern),y+=x,x=this._read_template();return this._until_after&&(y+=this._input.readUntilAfter(this._until_pattern)),y},m.prototype.__set_templated_pattern=function(){var y=[];this._disabled.php||y.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||y.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||y.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||y.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(y.push(this.__patterns.django._starting_pattern.source),y.push(this.__patterns.django_value._starting_pattern.source),y.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||y.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&y.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+y.join("|")+")")},m.prototype._read_template=function(){var y="",x=this._input.peek();if(x==="<"){var M=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&M==="?"&&(y=y||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&M==="%"&&(y=y||this.__patterns.erb.read())}else x==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(y=y||this.__patterns.handlebars_comment.read(),y=y||this.__patterns.handlebars_unescaped.read(),y=y||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(y=y||this.__patterns.django_value.read()),this._excluded.django||(y=y||this.__patterns.django_comment.read(),y=y||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(y=y||this.__patterns.smarty_comment.read(),y=y||this.__patterns.smarty_literal.read(),y=y||this.__patterns.smarty.read()));return y},ee.exports.TemplatablePattern=m}],$={};function g(ee){var l=$[ee];if(l!==void 0)return l.exports;var j=$[ee]={exports:{}};return ne[ee](j,j.exports,g),j.exports}var ue=g(0);re=ue})();var De=re;O=[],N=function(){return{js_beautify:De}}.apply(at,O),N!==void 0&&(Ut.exports=N)})()},32834:function(Ut){(function(at,O){Ut.exports=O()})(this,function(){"use strict";function at(Ee,pe){for(var ge=0;ge<pe.length;ge++){var L=pe[ge];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(Ee,L.key,L)}}function O(Ee,pe,ge){return pe&&at(Ee.prototype,pe),ge&&at(Ee,ge),Ee}function N(Ee,pe){if(Ee){if(typeof Ee=="string")return re(Ee,pe);var ge=Object.prototype.toString.call(Ee).slice(8,-1);if(ge==="Object"&&Ee.constructor&&(ge=Ee.constructor.name),ge==="Map"||ge==="Set")return Array.from(Ee);if(ge==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ge))return re(Ee,pe)}}function re(Ee,pe){(pe==null||pe>Ee.length)&&(pe=Ee.length);for(var ge=0,L=new Array(pe);ge<pe;ge++)L[ge]=Ee[ge];return L}function De(Ee,pe){var ge=typeof Symbol!="undefined"&&Ee[Symbol.iterator]||Ee["@@iterator"];if(ge)return(ge=ge.call(Ee)).next.bind(ge);if(Array.isArray(Ee)||(ge=N(Ee))||pe&&Ee&&typeof Ee.length=="number"){ge&&(Ee=ge);var L=0;return function(){return L>=Ee.length?{done:!0}:{done:!1,value:Ee[L++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ne={exports:{}};function $(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function g(Ee){ne.exports.defaults=Ee}ne.exports={defaults:$(),getDefaults:$,changeDefaults:g};var ue=/[&<>"']/,ee=/[&<>"']/g,l=/[<>"']|&(?!#?\w+;)/,j=/[<>"']|&(?!#?\w+;)/g,A={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},p=function(pe){return A[pe]};function m(Ee,pe){if(pe){if(ue.test(Ee))return Ee.replace(ee,p)}else if(l.test(Ee))return Ee.replace(j,p);return Ee}var y=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function x(Ee){return Ee.replace(y,function(pe,ge){return ge=ge.toLowerCase(),ge==="colon"?":":ge.charAt(0)==="#"?ge.charAt(1)==="x"?String.fromCharCode(parseInt(ge.substring(2),16)):String.fromCharCode(+ge.substring(1)):""})}var M=/(^|[^\[])\^/g;function F(Ee,pe){Ee=Ee.source||Ee,pe=pe||"";var ge={replace:function(B,Q){return Q=Q.source||Q,Q=Q.replace(M,"$1"),Ee=Ee.replace(B,Q),ge},getRegex:function(){return new RegExp(Ee,pe)}};return ge}var z=/[^\w:]/g,I=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function C(Ee,pe,ge){if(Ee){var L;try{L=decodeURIComponent(x(ge)).replace(z,"").toLowerCase()}catch(B){return null}if(L.indexOf("javascript:")===0||L.indexOf("vbscript:")===0||L.indexOf("data:")===0)return null}pe&&!I.test(ge)&&(ge=X(pe,ge));try{ge=encodeURI(ge).replace(/%25/g,"%")}catch(B){return null}return ge}var U={},H=/^[^:]+:\/*[^/]*$/,J=/^([^:]+:)[\s\S]*$/,he=/^([^:]+:\/*[^/]*)[\s\S]*$/;function X(Ee,pe){U[" "+Ee]||(H.test(Ee)?U[" "+Ee]=Ee+"/":U[" "+Ee]=ze(Ee,"/",!0)),Ee=U[" "+Ee];var ge=Ee.indexOf(":")===-1;return pe.substring(0,2)==="//"?ge?pe:Ee.replace(J,"$1")+pe:pe.charAt(0)==="/"?ge?pe:Ee.replace(he,"$1")+pe:Ee+pe}var oe={exec:function(){}};function _e(Ee){for(var pe=1,ge,L;pe<arguments.length;pe++){ge=arguments[pe];for(L in ge)Object.prototype.hasOwnProperty.call(ge,L)&&(Ee[L]=ge[L])}return Ee}function ie(Ee,pe){var ge=Ee.replace(/\|/g,function(Q,ae,de){for(var qe=!1,lt=ae;--lt>=0&&de[lt]==="\\";)qe=!qe;return qe?"|":" |"}),L=ge.split(/ \|/),B=0;if(L.length>pe)L.splice(pe);else for(;L.length<pe;)L.push("");for(;B<L.length;B++)L[B]=L[B].trim().replace(/\\\|/g,"|");return L}function ze(Ee,pe,ge){var L=Ee.length;if(L===0)return"";for(var B=0;B<L;){var Q=Ee.charAt(L-B-1);if(Q===pe&&!ge)B++;else if(Q!==pe&&ge)B++;else break}return Ee.substr(0,L-B)}function k(Ee,pe){if(Ee.indexOf(pe[1])===-1)return-1;for(var ge=Ee.length,L=0,B=0;B<ge;B++)if(Ee[B]==="\\")B++;else if(Ee[B]===pe[0])L++;else if(Ee[B]===pe[1]&&(L--,L<0))return B;return-1}function S(Ee){Ee&&Ee.sanitize&&!Ee.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 w(Ee,pe){if(pe<1)return"";for(var ge="";pe>1;)pe&1&&(ge+=Ee),pe>>=1,Ee+=Ee;return ge+Ee}var P={escape:m,unescape:x,edit:F,cleanUrl:C,resolveUrl:X,noopTest:oe,merge:_e,splitCells:ie,rtrim:ze,findClosingBracket:k,checkSanitizeDeprecation:S,repeatString:w},W=ne.exports.defaults,K=P.rtrim,_=P.splitCells,v=P.escape,D=P.findClosingBracket;function Z(Ee,pe,ge){var L=pe.href,B=pe.title?v(pe.title):null,Q=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:ge,href:L,title:B,text:Q}:{type:"image",raw:ge,href:L,title:B,text:v(Q)}}function fe(Ee,pe){var ge=Ee.match(/^(\s+)(?:```)/);if(ge===null)return pe;var L=ge[1];return pe.split(`
`).map(function(B){var Q=B.match(/^\s+/);if(Q===null)return B;var ae=Q[0];return ae.length>=L.length?B.slice(L.length):B}).join(`
`)}var ye=function(){function Ee(ge){this.options=ge||W}var pe=Ee.prototype;return pe.space=function(L){var B=this.rules.block.newline.exec(L);if(B)return B[0].length>1?{type:"space",raw:B[0]}:{raw:`
`}},pe.code=function(L){var B=this.rules.block.code.exec(L);if(B){var Q=B[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:B[0],codeBlockStyle:"indented",text:this.options.pedantic?Q:K(Q,`
`)}}},pe.fences=function(L){var B=this.rules.block.fences.exec(L);if(B){var Q=B[0],ae=fe(Q,B[3]||"");return{type:"code",raw:Q,lang:B[2]?B[2].trim():B[2],text:ae}}},pe.heading=function(L){var B=this.rules.block.heading.exec(L);if(B){var Q=B[2].trim();if(/#$/.test(Q)){var ae=K(Q,"#");(this.options.pedantic||!ae||/ $/.test(ae))&&(Q=ae.trim())}return{type:"heading",raw:B[0],depth:B[1].length,text:Q}}},pe.nptable=function(L){var B=this.rules.block.nptable.exec(L);if(B){var Q={type:"table",header:_(B[1].replace(/^ *| *\| *$/g,"")),align:B[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:B[3]?B[3].replace(/\n$/,"").split(`
`):[],raw:B[0]};if(Q.header.length===Q.align.length){var ae=Q.align.length,de;for(de=0;de<ae;de++)/^ *-+: *$/.test(Q.align[de])?Q.align[de]="right":/^ *:-+: *$/.test(Q.align[de])?Q.align[de]="center":/^ *:-+ *$/.test(Q.align[de])?Q.align[de]="left":Q.align[de]=null;for(ae=Q.cells.length,de=0;de<ae;de++)Q.cells[de]=_(Q.cells[de],Q.header.length);return Q}}},pe.hr=function(L){var B=this.rules.block.hr.exec(L);if(B)return{type:"hr",raw:B[0]}},pe.blockquote=function(L){var B=this.rules.block.blockquote.exec(L);if(B){var Q=B[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:B[0],text:Q}}},pe.list=function(L){var B=this.rules.block.list.exec(L);if(B){var Q=B[0],ae=B[2],de=ae.length>1,qe={type:"list",raw:Q,ordered:de,start:de?+ae.slice(0,-1):"",loose:!1,items:[]},lt=B[0].match(this.rules.block.item),pt=!1,Tt,Wt,mn,Qt,Ot,vn,Kn,Ln,Sn,gt=lt.length;mn=this.rules.block.listItemStart.exec(lt[0]);for(var Je=0;Je<gt;Je++){if(Tt=lt[Je],Q=Tt,this.options.pedantic||(Sn=Tt.match(new RegExp("\\n\\s*\\n {0,"+(mn[0].length-1)+"}\\S")),Sn&&(Ot=Tt.length-Sn.index+lt.slice(Je+1).join(`
`).length,qe.raw=qe.raw.substring(0,qe.raw.length-Ot),Tt=Tt.substring(0,Sn.index),Q=Tt,gt=Je+1)),Je!==gt-1){if(Qt=this.rules.block.listItemStart.exec(lt[Je+1]),this.options.pedantic?Qt[1].length>mn[1].length:Qt[1].length>=mn[0].length||Qt[1].length>3){lt.splice(Je,2,lt[Je]+(!this.options.pedantic&&Qt[1].length<mn[0].length&&!lt[Je].match(/\n$/)?"":`
`)+lt[Je+1]),Je--,gt--;continue}else(!this.options.pedantic||this.options.smartLists?Qt[2][Qt[2].length-1]!==ae[ae.length-1]:de===(Qt[2].length===1))&&(Ot=lt.slice(Je+1).join(`
`).length,qe.raw=qe.raw.substring(0,qe.raw.length-Ot),Je=gt-1);mn=Qt}Wt=Tt.length,Tt=Tt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~Tt.indexOf(`
`)&&(Wt-=Tt.length,Tt=this.options.pedantic?Tt.replace(/^ {1,4}/gm,""):Tt.replace(new RegExp("^ {1,"+Wt+"}","gm"),"")),Tt=K(Tt,`
`),Je!==gt-1&&(Q=Q+`
`),vn=pt||/\n\n(?!\s*$)/.test(Q),Je!==gt-1&&(pt=Q.slice(-2)===`
`,vn||(vn=pt)),vn&&(qe.loose=!0),this.options.gfm&&(Kn=/^\[[ xX]\] /.test(Tt),Ln=void 0,Kn&&(Ln=Tt[1]!==" ",Tt=Tt.replace(/^\[[ xX]\] +/,""))),qe.items.push({type:"list_item",raw:Q,task:Kn,checked:Ln,loose:vn,text:Tt})}return qe}},pe.html=function(L){var B=this.rules.block.html.exec(L);if(B)return{type:this.options.sanitize?"paragraph":"html",raw:B[0],pre:!this.options.sanitizer&&(B[1]==="pre"||B[1]==="script"||B[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(B[0]):v(B[0]):B[0]}},pe.def=function(L){var B=this.rules.block.def.exec(L);if(B){B[3]&&(B[3]=B[3].substring(1,B[3].length-1));var Q=B[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:Q,raw:B[0],href:B[2],title:B[3]}}},pe.table=function(L){var B=this.rules.block.table.exec(L);if(B){var Q={type:"table",header:_(B[1].replace(/^ *| *\| *$/g,"")),align:B[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:B[3]?B[3].replace(/\n$/,"").split(`
`):[]};if(Q.header.length===Q.align.length){Q.raw=B[0];var ae=Q.align.length,de;for(de=0;de<ae;de++)/^ *-+: *$/.test(Q.align[de])?Q.align[de]="right":/^ *:-+: *$/.test(Q.align[de])?Q.align[de]="center":/^ *:-+ *$/.test(Q.align[de])?Q.align[de]="left":Q.align[de]=null;for(ae=Q.cells.length,de=0;de<ae;de++)Q.cells[de]=_(Q.cells[de].replace(/^ *\| *| *\| *$/g,""),Q.header.length);return Q}}},pe.lheading=function(L){var B=this.rules.block.lheading.exec(L);if(B)return{type:"heading",raw:B[0],depth:B[2].charAt(0)==="="?1:2,text:B[1]}},pe.paragraph=function(L){var B=this.rules.block.paragraph.exec(L);if(B)return{type:"paragraph",raw:B[0],text:B[1].charAt(B[1].length-1)===`
`?B[1].slice(0,-1):B[1]}},pe.text=function(L){var B=this.rules.block.text.exec(L);if(B)return{type:"text",raw:B[0],text:B[0]}},pe.escape=function(L){var B=this.rules.inline.escape.exec(L);if(B)return{type:"escape",raw:B[0],text:v(B[1])}},pe.tag=function(L,B,Q){var ae=this.rules.inline.tag.exec(L);if(ae)return!B&&/^<a /i.test(ae[0])?B=!0:B&&/^<\/a>/i.test(ae[0])&&(B=!1),!Q&&/^<(pre|code|kbd|script)(\s|>)/i.test(ae[0])?Q=!0:Q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ae[0])&&(Q=!1),{type:this.options.sanitize?"text":"html",raw:ae[0],inLink:B,inRawBlock:Q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):v(ae[0]):ae[0]}},pe.link=function(L){var B=this.rules.inline.link.exec(L);if(B){var Q=B[2].trim();if(!this.options.pedantic&&/^</.test(Q)){if(!/>$/.test(Q))return;var ae=K(Q.slice(0,-1),"\\");if((Q.length-ae.length)%2===0)return}else{var de=D(B[2],"()");if(de>-1){var qe=B[0].indexOf("!")===0?5:4,lt=qe+B[1].length+de;B[2]=B[2].substring(0,de),B[0]=B[0].substring(0,lt).trim(),B[3]=""}}var pt=B[2],Tt="";if(this.options.pedantic){var Wt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(pt);Wt&&(pt=Wt[1],Tt=Wt[3])}else Tt=B[3]?B[3].slice(1,-1):"";return pt=pt.trim(),/^</.test(pt)&&(this.options.pedantic&&!/>$/.test(Q)?pt=pt.slice(1):pt=pt.slice(1,-1)),Z(B,{href:pt&&pt.replace(this.rules.inline._escapes,"$1"),title:Tt&&Tt.replace(this.rules.inline._escapes,"$1")},B[0])}},pe.reflink=function(L,B){var Q;if((Q=this.rules.inline.reflink.exec(L))||(Q=this.rules.inline.nolink.exec(L))){var ae=(Q[2]||Q[1]).replace(/\s+/g," ");if(ae=B[ae.toLowerCase()],!ae||!ae.href){var de=Q[0].charAt(0);return{type:"text",raw:de,text:de}}return Z(Q,ae,Q[0])}},pe.emStrong=function(L,B,Q){Q===void 0&&(Q="");var ae=this.rules.inline.emStrong.lDelim.exec(L);if(ae&&!(ae[3]&&Q.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var de=ae[1]||ae[2]||"";if(!de||de&&(Q===""||this.rules.inline.punctuation.exec(Q))){var qe=ae[0].length-1,lt,pt,Tt=qe,Wt=0,mn=ae[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(mn.lastIndex=0,B=B.slice(-1*L.length+qe);(ae=mn.exec(B))!=null;)if(lt=ae[1]||ae[2]||ae[3]||ae[4]||ae[5]||ae[6],!!lt){if(pt=lt.length,ae[3]||ae[4]){Tt+=pt;continue}else if((ae[5]||ae[6])&&qe%3&&!((qe+pt)%3)){Wt+=pt;continue}if(Tt-=pt,!(Tt>0))return pt=Math.min(pt,pt+Tt+Wt),Math.min(qe,pt)%2?{type:"em",raw:L.slice(0,qe+ae.index+pt+1),text:L.slice(1,qe+ae.index+pt)}:{type:"strong",raw:L.slice(0,qe+ae.index+pt+1),text:L.slice(2,qe+ae.index+pt-1)}}}}},pe.codespan=function(L){var B=this.rules.inline.code.exec(L);if(B){var Q=B[2].replace(/\n/g," "),ae=/[^ ]/.test(Q),de=/^ /.test(Q)&&/ $/.test(Q);return ae&&de&&(Q=Q.substring(1,Q.length-1)),Q=v(Q,!0),{type:"codespan",raw:B[0],text:Q}}},pe.br=function(L){var B=this.rules.inline.br.exec(L);if(B)return{type:"br",raw:B[0]}},pe.del=function(L){var B=this.rules.inline.del.exec(L);if(B)return{type:"del",raw:B[0],text:B[2]}},pe.autolink=function(L,B){var Q=this.rules.inline.autolink.exec(L);if(Q){var ae,de;return Q[2]==="@"?(ae=v(this.options.mangle?B(Q[1]):Q[1]),de="mailto:"+ae):(ae=v(Q[1]),de=ae),{type:"link",raw:Q[0],text:ae,href:de,tokens:[{type:"text",raw:ae,text:ae}]}}},pe.url=function(L,B){var Q;if(Q=this.rules.inline.url.exec(L)){var ae,de;if(Q[2]==="@")ae=v(this.options.mangle?B(Q[0]):Q[0]),de="mailto:"+ae;else{var qe;do qe=Q[0],Q[0]=this.rules.inline._backpedal.exec(Q[0])[0];while(qe!==Q[0]);ae=v(Q[0]),Q[1]==="www."?de="http://"+ae:de=ae}return{type:"link",raw:Q[0],text:ae,href:de,tokens:[{type:"text",raw:ae,text:ae}]}}},pe.inlineText=function(L,B,Q){var ae=this.rules.inline.text.exec(L);if(ae){var de;return B?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):v(ae[0]):ae[0]:de=v(this.options.smartypants?Q(ae[0]):ae[0]),{type:"text",raw:ae[0],text:de}}},Ee}(),Oe=P.noopTest,Ne=P.edit,ve=P.merge,Me={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Oe,table:Oe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};Me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Me.def=Ne(Me.def).replace("label",Me._label).replace("title",Me._title).getRegex(),Me.bullet=/(?:[*+-]|\d{1,9}[.)])/,Me.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Me.item=Ne(Me.item,"gm").replace(/bull/g,Me.bullet).getRegex(),Me.listItemStart=Ne(/^( *)(bull) */).replace("bull",Me.bullet).getRegex(),Me.list=Ne(Me.list).replace(/bull/g,Me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Me.def.source+")").getRegex(),Me._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Me._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Me.html=Ne(Me.html,"i").replace("comment",Me._comment).replace("tag",Me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Me.paragraph=Ne(Me._paragraph).replace("hr",Me.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Me._tag).getRegex(),Me.blockquote=Ne(Me.blockquote).replace("paragraph",Me.paragraph).getRegex(),Me.normal=ve({},Me),Me.gfm=ve({},Me.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Me.gfm.nptable=Ne(Me.gfm.nptable).replace("hr",Me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Me._tag).getRegex(),Me.gfm.table=Ne(Me.gfm.table).replace("hr",Me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Me._tag).getRegex(),Me.pedantic=ve({},Me.normal,{html:Ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Me._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Oe,paragraph:Ne(Me.normal._paragraph).replace("hr",Me.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Ae={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Oe,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:Oe,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};Ae._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Ae.punctuation=Ne(Ae.punctuation).replace(/punctuation/g,Ae._punctuation).getRegex(),Ae.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,Ae.escapedEmSt=/\\\*|\\_/g,Ae._comment=Ne(Me._comment).replace("(?:-->|$)","-->").getRegex(),Ae.emStrong.lDelim=Ne(Ae.emStrong.lDelim).replace(/punct/g,Ae._punctuation).getRegex(),Ae.emStrong.rDelimAst=Ne(Ae.emStrong.rDelimAst,"g").replace(/punct/g,Ae._punctuation).getRegex(),Ae.emStrong.rDelimUnd=Ne(Ae.emStrong.rDelimUnd,"g").replace(/punct/g,Ae._punctuation).getRegex(),Ae._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Ae._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Ae._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])?)+(?![-_])/,Ae.autolink=Ne(Ae.autolink).replace("scheme",Ae._scheme).replace("email",Ae._email).getRegex(),Ae._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Ae.tag=Ne(Ae.tag).replace("comment",Ae._comment).replace("attribute",Ae._attribute).getRegex(),Ae._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ae._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Ae._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Ae.link=Ne(Ae.link).replace("label",Ae._label).replace("href",Ae._href).replace("title",Ae._title).getRegex(),Ae.reflink=Ne(Ae.reflink).replace("label",Ae._label).getRegex(),Ae.reflinkSearch=Ne(Ae.reflinkSearch,"g").replace("reflink",Ae.reflink).replace("nolink",Ae.nolink).getRegex(),Ae.normal=ve({},Ae),Ae.pedantic=ve({},Ae.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:Ne(/^!?\[(label)\]\((.*?)\)/).replace("label",Ae._label).getRegex(),reflink:Ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ae._label).getRegex()}),Ae.gfm=ve({},Ae.normal,{escape:Ne(Ae.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Ae.gfm.url=Ne(Ae.gfm.url,"i").replace("email",Ae.gfm._extended_email).getRegex(),Ae.breaks=ve({},Ae.gfm,{br:Ne(Ae.br).replace("{2,}","*").getRegex(),text:Ne(Ae.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var dt={block:Me,inline:Ae},Ce=ye,rt=ne.exports.defaults,Pe=dt.block,ut=dt.inline,ce=P.repeatString;function le(Ee){return Ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Y(Ee){var pe="",ge,L,B=Ee.length;for(ge=0;ge<B;ge++)L=Ee.charCodeAt(ge),Math.random()>.5&&(L="x"+L.toString(16)),pe+="&#"+L+";";return pe}var Te=function(){function Ee(ge){this.tokens=[],this.tokens.links=Object.create(null),this.options=ge||rt,this.options.tokenizer=this.options.tokenizer||new Ce,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var L={block:Pe.normal,inline:ut.normal};this.options.pedantic?(L.block=Pe.pedantic,L.inline=ut.pedantic):this.options.gfm&&(L.block=Pe.gfm,this.options.breaks?L.inline=ut.breaks:L.inline=ut.gfm),this.tokenizer.rules=L}Ee.lex=function(L,B){var Q=new Ee(B);return Q.lex(L)},Ee.lexInline=function(L,B){var Q=new Ee(B);return Q.inlineTokens(L)};var pe=Ee.prototype;return pe.lex=function(L){return L=L.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(L,this.tokens,!0),this.inline(this.tokens),this.tokens},pe.blockTokens=function(L,B,Q){B===void 0&&(B=[]),Q===void 0&&(Q=!0),this.options.pedantic&&(L=L.replace(/^ +$/gm,""));for(var ae,de,qe,lt;L;){if(ae=this.tokenizer.space(L)){L=L.substring(ae.raw.length),ae.type&&B.push(ae);continue}if(ae=this.tokenizer.code(L)){L=L.substring(ae.raw.length),lt=B[B.length-1],lt&&lt.type==="paragraph"?(lt.raw+=`
`+ae.raw,lt.text+=`
`+ae.text):B.push(ae);continue}if(ae=this.tokenizer.fences(L)){L=L.substring(ae.raw.length),B.push(ae);continue}if(ae=this.tokenizer.heading(L)){L=L.substring(ae.raw.length),B.push(ae);continue}if(ae=this.tokenizer.nptable(L)){L=L.substring(ae.raw.length),B.push(ae);continue}if(ae=this.tokenizer.hr(L)){L=L.substring(ae.raw.length),B.push(ae);continue}if(ae=this.tokenizer.blockquote(L)){L=L.substring(ae.raw.length),ae.tokens=this.blockTokens(ae.text,[],Q),B.push(ae);continue}if(ae=this.tokenizer.list(L)){for(L=L.substring(ae.raw.length),qe=ae.items.length,de=0;de<qe;de++)ae.items[de].tokens=this.blockTokens(ae.items[de].text,[],!1);B.push(ae);continue}if(ae=this.tokenizer.html(L)){L=L.substring(ae.raw.length),B.push(ae);continue}if(Q&&(ae=this.tokenizer.def(L))){L=L.substring(ae.raw.length),this.tokens.links[ae.tag]||(this.tokens.links[ae.tag]={href:ae.href,title:ae.title});continue}if(ae=this.tokenizer.table(L)){L=L.substring(ae.raw.length),B.push(ae);continue}if(ae=this.tokenizer.lheading(L)){L=L.substring(ae.raw.length),B.push(ae);continue}if(Q&&(ae=this.tokenizer.paragraph(L))){L=L.substring(ae.raw.length),B.push(ae);continue}if(ae=this.tokenizer.text(L)){L=L.substring(ae.raw.length),lt=B[B.length-1],lt&&lt.type==="text"?(lt.raw+=`
`+ae.raw,lt.text+=`
`+ae.text):B.push(ae);continue}if(L){var pt="Infinite loop on byte: "+L.charCodeAt(0);if(this.options.silent){console.error(pt);break}else throw new Error(pt)}}return B},pe.inline=function(L){var B,Q,ae,de,qe,lt,pt=L.length;for(B=0;B<pt;B++)switch(lt=L[B],lt.type){case"paragraph":case"text":case"heading":{lt.tokens=[],this.inlineTokens(lt.text,lt.tokens);break}case"table":{for(lt.tokens={header:[],cells:[]},de=lt.header.length,Q=0;Q<de;Q++)lt.tokens.header[Q]=[],this.inlineTokens(lt.header[Q],lt.tokens.header[Q]);for(de=lt.cells.length,Q=0;Q<de;Q++)for(qe=lt.cells[Q],lt.tokens.cells[Q]=[],ae=0;ae<qe.length;ae++)lt.tokens.cells[Q][ae]=[],this.inlineTokens(qe[ae],lt.tokens.cells[Q][ae]);break}case"blockquote":{this.inline(lt.tokens);break}case"list":{for(de=lt.items.length,Q=0;Q<de;Q++)this.inline(lt.items[Q].tokens);break}}return L},pe.inlineTokens=function(L,B,Q,ae){B===void 0&&(B=[]),Q===void 0&&(Q=!1),ae===void 0&&(ae=!1);var de,qe,lt=L,pt,Tt,Wt;if(this.tokens.links){var mn=Object.keys(this.tokens.links);if(mn.length>0)for(;(pt=this.tokenizer.rules.inline.reflinkSearch.exec(lt))!=null;)mn.includes(pt[0].slice(pt[0].lastIndexOf("[")+1,-1))&&(lt=lt.slice(0,pt.index)+"["+ce("a",pt[0].length-2)+"]"+lt.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(pt=this.tokenizer.rules.inline.blockSkip.exec(lt))!=null;)lt=lt.slice(0,pt.index)+"["+ce("a",pt[0].length-2)+"]"+lt.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(pt=this.tokenizer.rules.inline.escapedEmSt.exec(lt))!=null;)lt=lt.slice(0,pt.index)+"++"+lt.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;L;){if(Tt||(Wt=""),Tt=!1,de=this.tokenizer.escape(L)){L=L.substring(de.raw.length),B.push(de);continue}if(de=this.tokenizer.tag(L,Q,ae)){L=L.substring(de.raw.length),Q=de.inLink,ae=de.inRawBlock;var Qt=B[B.length-1];Qt&&de.type==="text"&&Qt.type==="text"?(Qt.raw+=de.raw,Qt.text+=de.text):B.push(de);continue}if(de=this.tokenizer.link(L)){L=L.substring(de.raw.length),de.type==="link"&&(de.tokens=this.inlineTokens(de.text,[],!0,ae)),B.push(de);continue}if(de=this.tokenizer.reflink(L,this.tokens.links)){L=L.substring(de.raw.length);var Ot=B[B.length-1];de.type==="link"?(de.tokens=this.inlineTokens(de.text,[],!0,ae),B.push(de)):Ot&&de.type==="text"&&Ot.type==="text"?(Ot.raw+=de.raw,Ot.text+=de.text):B.push(de);continue}if(de=this.tokenizer.emStrong(L,lt,Wt)){L=L.substring(de.raw.length),de.tokens=this.inlineTokens(de.text,[],Q,ae),B.push(de);continue}if(de=this.tokenizer.codespan(L)){L=L.substring(de.raw.length),B.push(de);continue}if(de=this.tokenizer.br(L)){L=L.substring(de.raw.length),B.push(de);continue}if(de=this.tokenizer.del(L)){L=L.substring(de.raw.length),de.tokens=this.inlineTokens(de.text,[],Q,ae),B.push(de);continue}if(de=this.tokenizer.autolink(L,Y)){L=L.substring(de.raw.length),B.push(de);continue}if(!Q&&(de=this.tokenizer.url(L,Y))){L=L.substring(de.raw.length),B.push(de);continue}if(de=this.tokenizer.inlineText(L,ae,le)){L=L.substring(de.raw.length),de.raw.slice(-1)!=="_"&&(Wt=de.raw.slice(-1)),Tt=!0,qe=B[B.length-1],qe&&qe.type==="text"?(qe.raw+=de.raw,qe.text+=de.text):B.push(de);continue}if(L){var vn="Infinite loop on byte: "+L.charCodeAt(0);if(this.options.silent){console.error(vn);break}else throw new Error(vn)}}return B},O(Ee,null,[{key:"rules",get:function(){return{block:Pe,inline:ut}}}]),Ee}(),ke=ne.exports.defaults,Ke=P.cleanUrl,G=P.escape,q=function(){function Ee(ge){this.options=ge||ke}var pe=Ee.prototype;return pe.code=function(L,B,Q){var ae=(B||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(L,ae);de!=null&&de!==L&&(Q=!0,L=de)}return L=L.replace(/\n$/,"")+`
`,ae?'<pre><code class="'+this.options.langPrefix+G(ae,!0)+'">'+(Q?L:G(L,!0))+`</code></pre>
`:"<pre><code>"+(Q?L:G(L,!0))+`</code></pre>
`},pe.blockquote=function(L){return`<blockquote>
`+L+`</blockquote>
`},pe.html=function(L){return L},pe.heading=function(L,B,Q,ae){return this.options.headerIds?"<h"+B+' id="'+this.options.headerPrefix+ae.slug(Q)+'">'+L+"</h"+B+`>
`:"<h"+B+">"+L+"</h"+B+`>
`},pe.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},pe.list=function(L,B,Q){var ae=B?"ol":"ul",de=B&&Q!==1?' start="'+Q+'"':"";return"<"+ae+de+`>
`+L+"</"+ae+`>
`},pe.listitem=function(L){return"<li>"+L+`</li>
`},pe.checkbox=function(L){return"<input "+(L?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},pe.paragraph=function(L){return"<p>"+L+`</p>
`},pe.table=function(L,B){return B&&(B="<tbody>"+B+"</tbody>"),`<table>
<thead>
`+L+`</thead>
`+B+`</table>
`},pe.tablerow=function(L){return`<tr>
`+L+`</tr>
`},pe.tablecell=function(L,B){var Q=B.header?"th":"td",ae=B.align?"<"+Q+' align="'+B.align+'">':"<"+Q+">";return ae+L+"</"+Q+`>
`},pe.strong=function(L){return"<strong>"+L+"</strong>"},pe.em=function(L){return"<em>"+L+"</em>"},pe.codespan=function(L){return"<code>"+L+"</code>"},pe.br=function(){return this.options.xhtml?"<br/>":"<br>"},pe.del=function(L){return"<del>"+L+"</del>"},pe.link=function(L,B,Q){if(L=Ke(this.options.sanitize,this.options.baseUrl,L),L===null)return Q;var ae='<a href="'+G(L)+'"';return B&&(ae+=' title="'+B+'"'),ae+=">"+Q+"</a>",ae},pe.image=function(L,B,Q){if(L=Ke(this.options.sanitize,this.options.baseUrl,L),L===null)return Q;var ae='<img src="'+L+'" alt="'+Q+'"';return B&&(ae+=' title="'+B+'"'),ae+=this.options.xhtml?"/>":">",ae},pe.text=function(L){return L},Ee}(),me=function(){function Ee(){}var pe=Ee.prototype;return pe.strong=function(L){return L},pe.em=function(L){return L},pe.codespan=function(L){return L},pe.del=function(L){return L},pe.html=function(L){return L},pe.text=function(L){return L},pe.link=function(L,B,Q){return""+Q},pe.image=function(L,B,Q){return""+Q},pe.br=function(){return""},Ee}(),we=function(){function Ee(){this.seen={}}var pe=Ee.prototype;return pe.serialize=function(L){return L.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},pe.getNextSafeSlug=function(L,B){var Q=L,ae=0;if(this.seen.hasOwnProperty(Q)){ae=this.seen[L];do ae++,Q=L+"-"+ae;while(this.seen.hasOwnProperty(Q))}return B||(this.seen[L]=ae,this.seen[Q]=0),Q},pe.slug=function(L,B){B===void 0&&(B={});var Q=this.serialize(L);return this.getNextSafeSlug(Q,B.dryrun)},Ee}(),Le=q,$e=me,yt=we,Qe=ne.exports.defaults,et=P.unescape,Ve=function(){function Ee(ge){this.options=ge||Qe,this.options.renderer=this.options.renderer||new Le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new $e,this.slugger=new yt}Ee.parse=function(L,B){var Q=new Ee(B);return Q.parse(L)},Ee.parseInline=function(L,B){var Q=new Ee(B);return Q.parseInline(L)};var pe=Ee.prototype;return pe.parse=function(L,B){B===void 0&&(B=!0);var Q="",ae,de,qe,lt,pt,Tt,Wt,mn,Qt,Ot,vn,Kn,Ln,Sn,gt,Je,wt,jt,ln=L.length;for(ae=0;ae<ln;ae++)switch(Ot=L[ae],Ot.type){case"space":continue;case"hr":{Q+=this.renderer.hr();continue}case"heading":{Q+=this.renderer.heading(this.parseInline(Ot.tokens),Ot.depth,et(this.parseInline(Ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{Q+=this.renderer.code(Ot.text,Ot.lang,Ot.escaped);continue}case"table":{for(mn="",Wt="",lt=Ot.header.length,de=0;de<lt;de++)Wt+=this.renderer.tablecell(this.parseInline(Ot.tokens.header[de]),{header:!0,align:Ot.align[de]});for(mn+=this.renderer.tablerow(Wt),Qt="",lt=Ot.cells.length,de=0;de<lt;de++){for(Tt=Ot.tokens.cells[de],Wt="",pt=Tt.length,qe=0;qe<pt;qe++)Wt+=this.renderer.tablecell(this.parseInline(Tt[qe]),{header:!1,align:Ot.align[qe]});Qt+=this.renderer.tablerow(Wt)}Q+=this.renderer.table(mn,Qt);continue}case"blockquote":{Qt=this.parse(Ot.tokens),Q+=this.renderer.blockquote(Qt);continue}case"list":{for(vn=Ot.ordered,Kn=Ot.start,Ln=Ot.loose,lt=Ot.items.length,Qt="",de=0;de<lt;de++)gt=Ot.items[de],Je=gt.checked,wt=gt.task,Sn="",gt.task&&(jt=this.renderer.checkbox(Je),Ln?gt.tokens.length>0&&gt.tokens[0].type==="text"?(gt.tokens[0].text=jt+" "+gt.tokens[0].text,gt.tokens[0].tokens&&gt.tokens[0].tokens.length>0&&gt.tokens[0].tokens[0].type==="text"&&(gt.tokens[0].tokens[0].text=jt+" "+gt.tokens[0].tokens[0].text)):gt.tokens.unshift({type:"text",text:jt}):Sn+=jt),Sn+=this.parse(gt.tokens,Ln),Qt+=this.renderer.listitem(Sn,wt,Je);Q+=this.renderer.list(Qt,vn,Kn);continue}case"html":{Q+=this.renderer.html(Ot.text);continue}case"paragraph":{Q+=this.renderer.paragraph(this.parseInline(Ot.tokens));continue}case"text":{for(Qt=Ot.tokens?this.parseInline(Ot.tokens):Ot.text;ae+1<ln&&L[ae+1].type==="text";)Ot=L[++ae],Qt+=`
`+(Ot.tokens?this.parseInline(Ot.tokens):Ot.text);Q+=B?this.renderer.paragraph(Qt):Qt;continue}default:{var Tn='Token with "'+Ot.type+'" type was not found.';if(this.options.silent){console.error(Tn);return}else throw new Error(Tn)}}return Q},pe.parseInline=function(L,B){B=B||this.renderer;var Q="",ae,de,qe=L.length;for(ae=0;ae<qe;ae++)switch(de=L[ae],de.type){case"escape":{Q+=B.text(de.text);break}case"html":{Q+=B.html(de.text);break}case"link":{Q+=B.link(de.href,de.title,this.parseInline(de.tokens,B));break}case"image":{Q+=B.image(de.href,de.title,de.text);break}case"strong":{Q+=B.strong(this.parseInline(de.tokens,B));break}case"em":{Q+=B.em(this.parseInline(de.tokens,B));break}case"codespan":{Q+=B.codespan(de.text);break}case"br":{Q+=B.br();break}case"del":{Q+=B.del(this.parseInline(de.tokens,B));break}case"text":{Q+=B.text(de.text);break}default:{var lt='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(lt);return}else throw new Error(lt)}}return Q},Ee}(),He=Te,_t=Ve,ht=ye,xe=q,ct=me,Xe=we,We=P.merge,Et=P.checkSanitizeDeprecation,St=P.escape,mt=ne.exports.getDefaults,st=ne.exports.changeDefaults,Pt=ne.exports.defaults;function ot(Ee,pe,ge){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof pe=="function"&&(ge=pe,pe=null),pe=We({},ot.defaults,pe||{}),Et(pe),ge){var L=pe.highlight,B;try{B=He.lex(Ee,pe)}catch(qe){return ge(qe)}var Q=function(lt){var pt;if(!lt)try{pe.walkTokens&&ot.walkTokens(B,pe.walkTokens),pt=_t.parse(B,pe)}catch(Tt){lt=Tt}return pe.highlight=L,lt?ge(lt):ge(null,pt)};if(!L||L.length<3||(delete pe.highlight,!B.length))return Q();var ae=0;ot.walkTokens(B,function(qe){qe.type==="code"&&(ae++,setTimeout(function(){L(qe.text,qe.lang,function(lt,pt){if(lt)return Q(lt);pt!=null&&pt!==qe.text&&(qe.text=pt,qe.escaped=!0),ae--,ae===0&&Q()})},0))}),ae===0&&Q();return}try{var de=He.lex(Ee,pe);return pe.walkTokens&&ot.walkTokens(de,pe.walkTokens),_t.parse(de,pe)}catch(qe){if(qe.message+=`
Please report this to https://github.com/markedjs/marked.`,pe.silent)return"<p>An error occurred:</p><pre>"+St(qe.message+"",!0)+"</pre>";throw qe}}ot.options=ot.setOptions=function(Ee){return We(ot.defaults,Ee),st(ot.defaults),ot},ot.getDefaults=mt,ot.defaults=Pt,ot.use=function(Ee){var pe=We({},Ee);if(Ee.renderer&&function(){var L=ot.defaults.renderer||new xe,B=function(de){var qe=L[de];L[de]=function(){for(var lt=arguments.length,pt=new Array(lt),Tt=0;Tt<lt;Tt++)pt[Tt]=arguments[Tt];var Wt=Ee.renderer[de].apply(L,pt);return Wt===!1&&(Wt=qe.apply(L,pt)),Wt}};for(var Q in Ee.renderer)B(Q);pe.renderer=L}(),Ee.tokenizer&&function(){var L=ot.defaults.tokenizer||new ht,B=function(de){var qe=L[de];L[de]=function(){for(var lt=arguments.length,pt=new Array(lt),Tt=0;Tt<lt;Tt++)pt[Tt]=arguments[Tt];var Wt=Ee.tokenizer[de].apply(L,pt);return Wt===!1&&(Wt=qe.apply(L,pt)),Wt}};for(var Q in Ee.tokenizer)B(Q);pe.tokenizer=L}(),Ee.walkTokens){var ge=ot.defaults.walkTokens;pe.walkTokens=function(L){Ee.walkTokens(L),ge&&ge(L)}}ot.setOptions(pe)},ot.walkTokens=function(Ee,pe){for(var ge=De(Ee),L;!(L=ge()).done;){var B=L.value;switch(pe(B),B.type){case"table":{for(var Q=De(B.tokens.header),ae;!(ae=Q()).done;){var de=ae.value;ot.walkTokens(de,pe)}for(var qe=De(B.tokens.cells),lt;!(lt=qe()).done;)for(var pt=lt.value,Tt=De(pt),Wt;!(Wt=Tt()).done;){var mn=Wt.value;ot.walkTokens(mn,pe)}break}case"list":{ot.walkTokens(B.items,pe);break}default:B.tokens&&ot.walkTokens(B.tokens,pe)}}},ot.parseInline=function(Ee,pe){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");pe=We({},ot.defaults,pe||{}),Et(pe);try{var ge=He.lexInline(Ee,pe);return pe.walkTokens&&ot.walkTokens(ge,pe.walkTokens),_t.parseInline(ge,pe)}catch(L){if(L.message+=`
Please report this to https://github.com/markedjs/marked.`,pe.silent)return"<p>An error occurred:</p><pre>"+St(L.message+"",!0)+"</pre>";throw L}},ot.Parser=_t,ot.parser=_t.parse,ot.Renderer=xe,ot.TextRenderer=ct,ot.Lexer=He,ot.lexer=He.lex,ot.Tokenizer=ht,ot.Slugger=Xe,ot.parse=ot;var bt=ot;return bt})},11690:function(Ut){const at=/[&<>"']/,O=/[&<>"']/g,N=/[<>"']|&(?!#?\w+;)/,re=/[<>"']|&(?!#?\w+;)/g,De={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ne=X=>De[X];function $(X,oe){if(oe){if(at.test(X))return X.replace(O,ne)}else if(N.test(X))return X.replace(re,ne);return X}const g=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ue(X){return X.replace(g,(oe,_e)=>(_e=_e.toLowerCase(),_e==="colon"?":":_e.charAt(0)==="#"?_e.charAt(1)==="x"?String.fromCharCode(parseInt(_e.substring(2),16)):String.fromCharCode(+_e.substring(1)):""))}const ee=/(^|[^\[])\^/g;function l(X,oe){X=X.source||X,oe=oe||"";const _e={replace:(ie,ze)=>(ze=ze.source||ze,ze=ze.replace(ee,"$1"),X=X.replace(ie,ze),_e),getRegex:()=>new RegExp(X,oe)};return _e}const j=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function p(X,oe,_e){if(X){let ie;try{ie=decodeURIComponent(ue(_e)).replace(j,"").toLowerCase()}catch(ze){return null}if(ie.indexOf("javascript:")===0||ie.indexOf("vbscript:")===0||ie.indexOf("data:")===0)return null}oe&&!A.test(_e)&&(_e=F(oe,_e));try{_e=encodeURI(_e).replace(/%25/g,"%")}catch(ie){return null}return _e}const m={},y=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,M=/^([^:]+:\/*[^/]*)[\s\S]*$/;function F(X,oe){m[" "+X]||(y.test(X)?m[" "+X]=X+"/":m[" "+X]=U(X,"/",!0)),X=m[" "+X];const _e=X.indexOf(":")===-1;return oe.substring(0,2)==="//"?_e?oe:X.replace(x,"$1")+oe:oe.charAt(0)==="/"?_e?oe:X.replace(M,"$1")+oe:X+oe}const z={exec:function(){}};function I(X){let oe=1,_e,ie;for(;oe<arguments.length;oe++){_e=arguments[oe];for(ie in _e)Object.prototype.hasOwnProperty.call(_e,ie)&&(X[ie]=_e[ie])}return X}function C(X,oe){const _e=X.replace(/\|/g,(k,S,w)=>{let P=!1,W=S;for(;--W>=0&&w[W]==="\\";)P=!P;return P?"|":" |"}),ie=_e.split(/ \|/);let ze=0;if(ie.length>oe)ie.splice(oe);else for(;ie.length<oe;)ie.push("");for(;ze<ie.length;ze++)ie[ze]=ie[ze].trim().replace(/\\\|/g,"|");return ie}function U(X,oe,_e){const ie=X.length;if(ie===0)return"";let ze=0;for(;ze<ie;){const k=X.charAt(ie-ze-1);if(k===oe&&!_e)ze++;else if(k!==oe&&_e)ze++;else break}return X.substr(0,ie-ze)}function H(X,oe){if(X.indexOf(oe[1])===-1)return-1;const _e=X.length;let ie=0,ze=0;for(;ze<_e;ze++)if(X[ze]==="\\")ze++;else if(X[ze]===oe[0])ie++;else if(X[ze]===oe[1]&&(ie--,ie<0))return ze;return-1}function J(X){X&&X.sanitize&&!X.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 he(X,oe){if(oe<1)return"";let _e="";for(;oe>1;)oe&1&&(_e+=X),oe>>=1,X+=X;return _e+X}Ut.exports={escape:$,unescape:ue,edit:l,cleanUrl:p,resolveUrl:F,noopTest:z,merge:I,splitCells:C,rtrim:U,findClosingBracket:H,checkSanitizeDeprecation:J,repeatString:he}},75918:function(Ut,at,O){"use strict";O.d(at,{Wi:function(){return g},Z0:function(){return ue},aU:function(){return $},eZ:function(){return l},wY:function(){return ee}});var N=O(4348),re=O(69323),De=O(13268),ne=function(j,A,p,m){function y(x){return x instanceof p?x:new p(function(M){M(x)})}return new(p||(p=Promise))(function(x,M){function F(C){try{I(m.next(C))}catch(U){M(U)}}function z(C){try{I(m.throw(C))}catch(U){M(U)}}function I(C){C.done?x(C.value):y(C.value).then(F,z)}I((m=m.apply(j,A||[])).next())})};class $ extends re.JT{constructor(A,p="",m="",y=!0,x){super(),this._onDidChange=this._register(new N.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=A,this._label=p,this._cssClass=m,this._enabled=y,this._actionCallback=x}get id(){return this._id}get label(){return this._label}set label(A){this._setLabel(A)}_setLabel(A){this._label!==A&&(this._label=A,this._onDidChange.fire({label:A}))}get tooltip(){return this._tooltip||""}set tooltip(A){this._setTooltip(A)}_setTooltip(A){this._tooltip!==A&&(this._tooltip=A,this._onDidChange.fire({tooltip:A}))}get class(){return this._cssClass}set class(A){this._setClass(A)}_setClass(A){this._cssClass!==A&&(this._cssClass=A,this._onDidChange.fire({class:A}))}get enabled(){return this._enabled}set enabled(A){this._setEnabled(A)}_setEnabled(A){this._enabled!==A&&(this._enabled=A,this._onDidChange.fire({enabled:A}))}get checked(){return this._checked}set checked(A){this._setChecked(A)}_setChecked(A){this._checked!==A&&(this._checked=A,this._onDidChange.fire({checked:A}))}run(A,p){return ne(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(A))})}}class g extends re.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(A,p){return ne(this,void 0,void 0,function*(){if(!A.enabled)return;this._onBeforeRun.fire({action:A});let m;try{yield this.runAction(A,p)}catch(y){m=y}this._onDidRun.fire({action:A,error:m})})}runAction(A,p){return ne(this,void 0,void 0,function*(){yield A.run(p)})}}class ue extends ${constructor(A){super(ue.ID,A,A?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ue.ID="vs.actions.separator";class ee{constructor(A,p,m,y){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=A,this.label=p,this.class=y,this._actions=m}get actions(){return this._actions}dispose(){}run(){return ne(this,void 0,void 0,function*(){})}}class l extends ${constructor(){super(l.ID,De.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Ut,at,O){"use strict";O.d(at,{ok:function(){return N}});function N(re,De){if(!re)throw new Error(De?`Assertion failed (${De})`:"Assertion Failed")}},52615:function(Ut,at,O){"use strict";O.d(at,{CM:function(){return $},JL:function(){return g},dT:function(){return ee},fK:function(){return ne},lA:function(){return ue}});var N=O(4348);class re{constructor(){this._icons=new Map,this._onDidRegister=new N.Q5}add(j){const A=this._icons.get(j.id);A?j.description?A.description=j.description:console.error(`Duplicate registration of codicon ${j.id}`):(this._icons.set(j.id,j),this._onDidRegister.fire(j))}get(j){return this._icons.get(j)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const De=new re,ne=De;function $(l,j){return new ue(l,j)}function g(l){return l?l.replace(/\$\((.*?)\)/g,(j,A)=>` ${A} `).trim():""}class ue{constructor(j,A,p){this.id=j,this.definition=A,this.description=p,De.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var ee;(function(l){l.iconNameSegment="[A-Za-z0-9]+",l.iconNameExpression="[A-Za-z0-9\\-]+",l.iconModifierExpression="~[A-Za-z]+";const j=new RegExp(`^(${l.iconNameExpression})(${l.iconModifierExpression})?$`);function A(y){if(y instanceof ue)return["codicon","codicon-"+y.id];const x=j.exec(y.id);if(!x)return A(ue.error);let[,M,F]=x;const z=["codicon","codicon-"+M];return F&&z.push("codicon-modifier-"+F.substr(1)),z}l.asClassNameArray=A;function p(y){return A(y).join(" ")}l.asClassName=p;function m(y){return"."+A(y).join(".")}l.asCSSSelector=m})(ee||(ee={})),function(l){l.add=new l("add",{fontCharacter:"\\ea60"}),l.plus=new l("plus",l.add.definition),l.gistNew=new l("gist-new",l.add.definition),l.repoCreate=new l("repo-create",l.add.definition),l.lightbulb=new l("lightbulb",{fontCharacter:"\\ea61"}),l.lightBulb=new l("light-bulb",{fontCharacter:"\\ea61"}),l.repo=new l("repo",{fontCharacter:"\\ea62"}),l.repoDelete=new l("repo-delete",{fontCharacter:"\\ea62"}),l.gistFork=new l("gist-fork",{fontCharacter:"\\ea63"}),l.repoForked=new l("repo-forked",{fontCharacter:"\\ea63"}),l.gitPullRequest=new l("git-pull-request",{fontCharacter:"\\ea64"}),l.gitPullRequestAbandoned=new l("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),l.recordKeys=new l("record-keys",{fontCharacter:"\\ea65"}),l.keyboard=new l("keyboard",{fontCharacter:"\\ea65"}),l.tag=new l("tag",{fontCharacter:"\\ea66"}),l.tagAdd=new l("tag-add",{fontCharacter:"\\ea66"}),l.tagRemove=new l("tag-remove",{fontCharacter:"\\ea66"}),l.person=new l("person",{fontCharacter:"\\ea67"}),l.personFollow=new l("person-follow",{fontCharacter:"\\ea67"}),l.personOutline=new l("person-outline",{fontCharacter:"\\ea67"}),l.personFilled=new l("person-filled",{fontCharacter:"\\ea67"}),l.gitBranch=new l("git-branch",{fontCharacter:"\\ea68"}),l.gitBranchCreate=new l("git-branch-create",{fontCharacter:"\\ea68"}),l.gitBranchDelete=new l("git-branch-delete",{fontCharacter:"\\ea68"}),l.sourceControl=new l("source-control",{fontCharacter:"\\ea68"}),l.mirror=new l("mirror",{fontCharacter:"\\ea69"}),l.mirrorPublic=new l("mirror-public",{fontCharacter:"\\ea69"}),l.star=new l("star",{fontCharacter:"\\ea6a"}),l.starAdd=new l("star-add",{fontCharacter:"\\ea6a"}),l.starDelete=new l("star-delete",{fontCharacter:"\\ea6a"}),l.starEmpty=new l("star-empty",{fontCharacter:"\\ea6a"}),l.comment=new l("comment",{fontCharacter:"\\ea6b"}),l.commentAdd=new l("comment-add",{fontCharacter:"\\ea6b"}),l.alert=new l("alert",{fontCharacter:"\\ea6c"}),l.warning=new l("warning",{fontCharacter:"\\ea6c"}),l.search=new l("search",{fontCharacter:"\\ea6d"}),l.searchSave=new l("search-save",{fontCharacter:"\\ea6d"}),l.logOut=new l("log-out",{fontCharacter:"\\ea6e"}),l.signOut=new l("sign-out",{fontCharacter:"\\ea6e"}),l.logIn=new l("log-in",{fontCharacter:"\\ea6f"}),l.signIn=new l("sign-in",{fontCharacter:"\\ea6f"}),l.eye=new l("eye",{fontCharacter:"\\ea70"}),l.eyeUnwatch=new l("eye-unwatch",{fontCharacter:"\\ea70"}),l.eyeWatch=new l("eye-watch",{fontCharacter:"\\ea70"}),l.circleFilled=new l("circle-filled",{fontCharacter:"\\ea71"}),l.primitiveDot=new l("primitive-dot",{fontCharacter:"\\ea71"}),l.closeDirty=new l("close-dirty",{fontCharacter:"\\ea71"}),l.debugBreakpoint=new l("debug-breakpoint",{fontCharacter:"\\ea71"}),l.debugBreakpointDisabled=new l("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),l.debugHint=new l("debug-hint",{fontCharacter:"\\ea71"}),l.primitiveSquare=new l("primitive-square",{fontCharacter:"\\ea72"}),l.edit=new l("edit",{fontCharacter:"\\ea73"}),l.pencil=new l("pencil",{fontCharacter:"\\ea73"}),l.info=new l("info",{fontCharacter:"\\ea74"}),l.issueOpened=new l("issue-opened",{fontCharacter:"\\ea74"}),l.gistPrivate=new l("gist-private",{fontCharacter:"\\ea75"}),l.gitForkPrivate=new l("git-fork-private",{fontCharacter:"\\ea75"}),l.lock=new l("lock",{fontCharacter:"\\ea75"}),l.mirrorPrivate=new l("mirror-private",{fontCharacter:"\\ea75"}),l.close=new l("close",{fontCharacter:"\\ea76"}),l.removeClose=new l("remove-close",{fontCharacter:"\\ea76"}),l.x=new l("x",{fontCharacter:"\\ea76"}),l.repoSync=new l("repo-sync",{fontCharacter:"\\ea77"}),l.sync=new l("sync",{fontCharacter:"\\ea77"}),l.clone=new l("clone",{fontCharacter:"\\ea78"}),l.desktopDownload=new l("desktop-download",{fontCharacter:"\\ea78"}),l.beaker=new l("beaker",{fontCharacter:"\\ea79"}),l.microscope=new l("microscope",{fontCharacter:"\\ea79"}),l.vm=new l("vm",{fontCharacter:"\\ea7a"}),l.deviceDesktop=new l("device-desktop",{fontCharacter:"\\ea7a"}),l.file=new l("file",{fontCharacter:"\\ea7b"}),l.fileText=new l("file-text",{fontCharacter:"\\ea7b"}),l.more=new l("more",{fontCharacter:"\\ea7c"}),l.ellipsis=new l("ellipsis",{fontCharacter:"\\ea7c"}),l.kebabHorizontal=new l("kebab-horizontal",{fontCharacter:"\\ea7c"}),l.mailReply=new l("mail-reply",{fontCharacter:"\\ea7d"}),l.reply=new l("reply",{fontCharacter:"\\ea7d"}),l.organization=new l("organization",{fontCharacter:"\\ea7e"}),l.organizationFilled=new l("organization-filled",{fontCharacter:"\\ea7e"}),l.organizationOutline=new l("organization-outline",{fontCharacter:"\\ea7e"}),l.newFile=new l("new-file",{fontCharacter:"\\ea7f"}),l.fileAdd=new l("file-add",{fontCharacter:"\\ea7f"}),l.newFolder=new l("new-folder",{fontCharacter:"\\ea80"}),l.fileDirectoryCreate=new l("file-directory-create",{fontCharacter:"\\ea80"}),l.trash=new l("trash",{fontCharacter:"\\ea81"}),l.trashcan=new l("trashcan",{fontCharacter:"\\ea81"}),l.history=new l("history",{fontCharacter:"\\ea82"}),l.clock=new l("clock",{fontCharacter:"\\ea82"}),l.folder=new l("folder",{fontCharacter:"\\ea83"}),l.fileDirectory=new l("file-directory",{fontCharacter:"\\ea83"}),l.symbolFolder=new l("symbol-folder",{fontCharacter:"\\ea83"}),l.logoGithub=new l("logo-github",{fontCharacter:"\\ea84"}),l.markGithub=new l("mark-github",{fontCharacter:"\\ea84"}),l.github=new l("github",{fontCharacter:"\\ea84"}),l.terminal=new l("terminal",{fontCharacter:"\\ea85"}),l.console=new l("console",{fontCharacter:"\\ea85"}),l.repl=new l("repl",{fontCharacter:"\\ea85"}),l.zap=new l("zap",{fontCharacter:"\\ea86"}),l.symbolEvent=new l("symbol-event",{fontCharacter:"\\ea86"}),l.error=new l("error",{fontCharacter:"\\ea87"}),l.stop=new l("stop",{fontCharacter:"\\ea87"}),l.variable=new l("variable",{fontCharacter:"\\ea88"}),l.symbolVariable=new l("symbol-variable",{fontCharacter:"\\ea88"}),l.array=new l("array",{fontCharacter:"\\ea8a"}),l.symbolArray=new l("symbol-array",{fontCharacter:"\\ea8a"}),l.symbolModule=new l("symbol-module",{fontCharacter:"\\ea8b"}),l.symbolPackage=new l("symbol-package",{fontCharacter:"\\ea8b"}),l.symbolNamespace=new l("symbol-namespace",{fontCharacter:"\\ea8b"}),l.symbolObject=new l("symbol-object",{fontCharacter:"\\ea8b"}),l.symbolMethod=new l("symbol-method",{fontCharacter:"\\ea8c"}),l.symbolFunction=new l("symbol-function",{fontCharacter:"\\ea8c"}),l.symbolConstructor=new l("symbol-constructor",{fontCharacter:"\\ea8c"}),l.symbolBoolean=new l("symbol-boolean",{fontCharacter:"\\ea8f"}),l.symbolNull=new l("symbol-null",{fontCharacter:"\\ea8f"}),l.symbolNumeric=new l("symbol-numeric",{fontCharacter:"\\ea90"}),l.symbolNumber=new l("symbol-number",{fontCharacter:"\\ea90"}),l.symbolStructure=new l("symbol-structure",{fontCharacter:"\\ea91"}),l.symbolStruct=new l("symbol-struct",{fontCharacter:"\\ea91"}),l.symbolParameter=new l("symbol-parameter",{fontCharacter:"\\ea92"}),l.symbolTypeParameter=new l("symbol-type-parameter",{fontCharacter:"\\ea92"}),l.symbolKey=new l("symbol-key",{fontCharacter:"\\ea93"}),l.symbolText=new l("symbol-text",{fontCharacter:"\\ea93"}),l.symbolReference=new l("symbol-reference",{fontCharacter:"\\ea94"}),l.goToFile=new l("go-to-file",{fontCharacter:"\\ea94"}),l.symbolEnum=new l("symbol-enum",{fontCharacter:"\\ea95"}),l.symbolValue=new l("symbol-value",{fontCharacter:"\\ea95"}),l.symbolRuler=new l("symbol-ruler",{fontCharacter:"\\ea96"}),l.symbolUnit=new l("symbol-unit",{fontCharacter:"\\ea96"}),l.activateBreakpoints=new l("activate-breakpoints",{fontCharacter:"\\ea97"}),l.archive=new l("archive",{fontCharacter:"\\ea98"}),l.arrowBoth=new l("arrow-both",{fontCharacter:"\\ea99"}),l.arrowDown=new l("arrow-down",{fontCharacter:"\\ea9a"}),l.arrowLeft=new l("arrow-left",{fontCharacter:"\\ea9b"}),l.arrowRight=new l("arrow-right",{fontCharacter:"\\ea9c"}),l.arrowSmallDown=new l("arrow-small-down",{fontCharacter:"\\ea9d"}),l.arrowSmallLeft=new l("arrow-small-left",{fontCharacter:"\\ea9e"}),l.arrowSmallRight=new l("arrow-small-right",{fontCharacter:"\\ea9f"}),l.arrowSmallUp=new l("arrow-small-up",{fontCharacter:"\\eaa0"}),l.arrowUp=new l("arrow-up",{fontCharacter:"\\eaa1"}),l.bell=new l("bell",{fontCharacter:"\\eaa2"}),l.bold=new l("bold",{fontCharacter:"\\eaa3"}),l.book=new l("book",{fontCharacter:"\\eaa4"}),l.bookmark=new l("bookmark",{fontCharacter:"\\eaa5"}),l.debugBreakpointConditionalUnverified=new l("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),l.debugBreakpointConditional=new l("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),l.debugBreakpointConditionalDisabled=new l("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),l.debugBreakpointDataUnverified=new l("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),l.debugBreakpointData=new l("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),l.debugBreakpointDataDisabled=new l("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),l.debugBreakpointLogUnverified=new l("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),l.debugBreakpointLog=new l("debug-breakpoint-log",{fontCharacter:"\\eaab"}),l.debugBreakpointLogDisabled=new l("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),l.briefcase=new l("briefcase",{fontCharacter:"\\eaac"}),l.broadcast=new l("broadcast",{fontCharacter:"\\eaad"}),l.browser=new l("browser",{fontCharacter:"\\eaae"}),l.bug=new l("bug",{fontCharacter:"\\eaaf"}),l.calendar=new l("calendar",{fontCharacter:"\\eab0"}),l.caseSensitive=new l("case-sensitive",{fontCharacter:"\\eab1"}),l.check=new l("check",{fontCharacter:"\\eab2"}),l.checklist=new l("checklist",{fontCharacter:"\\eab3"}),l.chevronDown=new l("chevron-down",{fontCharacter:"\\eab4"}),l.dropDownButton=new l("drop-down-button",l.chevronDown.definition),l.chevronLeft=new l("chevron-left",{fontCharacter:"\\eab5"}),l.chevronRight=new l("chevron-right",{fontCharacter:"\\eab6"}),l.chevronUp=new l("chevron-up",{fontCharacter:"\\eab7"}),l.chromeClose=new l("chrome-close",{fontCharacter:"\\eab8"}),l.chromeMaximize=new l("chrome-maximize",{fontCharacter:"\\eab9"}),l.chromeMinimize=new l("chrome-minimize",{fontCharacter:"\\eaba"}),l.chromeRestore=new l("chrome-restore",{fontCharacter:"\\eabb"}),l.circleOutline=new l("circle-outline",{fontCharacter:"\\eabc"}),l.debugBreakpointUnverified=new l("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),l.circleSlash=new l("circle-slash",{fontCharacter:"\\eabd"}),l.circuitBoard=new l("circuit-board",{fontCharacter:"\\eabe"}),l.clearAll=new l("clear-all",{fontCharacter:"\\eabf"}),l.clippy=new l("clippy",{fontCharacter:"\\eac0"}),l.closeAll=new l("close-all",{fontCharacter:"\\eac1"}),l.cloudDownload=new l("cloud-download",{fontCharacter:"\\eac2"}),l.cloudUpload=new l("cloud-upload",{fontCharacter:"\\eac3"}),l.code=new l("code",{fontCharacter:"\\eac4"}),l.collapseAll=new l("collapse-all",{fontCharacter:"\\eac5"}),l.colorMode=new l("color-mode",{fontCharacter:"\\eac6"}),l.commentDiscussion=new l("comment-discussion",{fontCharacter:"\\eac7"}),l.compareChanges=new l("compare-changes",{fontCharacter:"\\eafd"}),l.creditCard=new l("credit-card",{fontCharacter:"\\eac9"}),l.dash=new l("dash",{fontCharacter:"\\eacc"}),l.dashboard=new l("dashboard",{fontCharacter:"\\eacd"}),l.database=new l("database",{fontCharacter:"\\eace"}),l.debugContinue=new l("debug-continue",{fontCharacter:"\\eacf"}),l.debugDisconnect=new l("debug-disconnect",{fontCharacter:"\\ead0"}),l.debugPause=new l("debug-pause",{fontCharacter:"\\ead1"}),l.debugRestart=new l("debug-restart",{fontCharacter:"\\ead2"}),l.debugStart=new l("debug-start",{fontCharacter:"\\ead3"}),l.debugStepInto=new l("debug-step-into",{fontCharacter:"\\ead4"}),l.debugStepOut=new l("debug-step-out",{fontCharacter:"\\ead5"}),l.debugStepOver=new l("debug-step-over",{fontCharacter:"\\ead6"}),l.debugStop=new l("debug-stop",{fontCharacter:"\\ead7"}),l.debug=new l("debug",{fontCharacter:"\\ead8"}),l.deviceCameraVideo=new l("device-camera-video",{fontCharacter:"\\ead9"}),l.deviceCamera=new l("device-camera",{fontCharacter:"\\eada"}),l.deviceMobile=new l("device-mobile",{fontCharacter:"\\eadb"}),l.diffAdded=new l("diff-added",{fontCharacter:"\\eadc"}),l.diffIgnored=new l("diff-ignored",{fontCharacter:"\\eadd"}),l.diffModified=new l("diff-modified",{fontCharacter:"\\eade"}),l.diffRemoved=new l("diff-removed",{fontCharacter:"\\eadf"}),l.diffRenamed=new l("diff-renamed",{fontCharacter:"\\eae0"}),l.diff=new l("diff",{fontCharacter:"\\eae1"}),l.discard=new l("discard",{fontCharacter:"\\eae2"}),l.editorLayout=new l("editor-layout",{fontCharacter:"\\eae3"}),l.emptyWindow=new l("empty-window",{fontCharacter:"\\eae4"}),l.exclude=new l("exclude",{fontCharacter:"\\eae5"}),l.extensions=new l("extensions",{fontCharacter:"\\eae6"}),l.eyeClosed=new l("eye-closed",{fontCharacter:"\\eae7"}),l.fileBinary=new l("file-binary",{fontCharacter:"\\eae8"}),l.fileCode=new l("file-code",{fontCharacter:"\\eae9"}),l.fileMedia=new l("file-media",{fontCharacter:"\\eaea"}),l.filePdf=new l("file-pdf",{fontCharacter:"\\eaeb"}),l.fileSubmodule=new l("file-submodule",{fontCharacter:"\\eaec"}),l.fileSymlinkDirectory=new l("file-symlink-directory",{fontCharacter:"\\eaed"}),l.fileSymlinkFile=new l("file-symlink-file",{fontCharacter:"\\eaee"}),l.fileZip=new l("file-zip",{fontCharacter:"\\eaef"}),l.files=new l("files",{fontCharacter:"\\eaf0"}),l.filter=new l("filter",{fontCharacter:"\\eaf1"}),l.flame=new l("flame",{fontCharacter:"\\eaf2"}),l.foldDown=new l("fold-down",{fontCharacter:"\\eaf3"}),l.foldUp=new l("fold-up",{fontCharacter:"\\eaf4"}),l.fold=new l("fold",{fontCharacter:"\\eaf5"}),l.folderActive=new l("folder-active",{fontCharacter:"\\eaf6"}),l.folderOpened=new l("folder-opened",{fontCharacter:"\\eaf7"}),l.gear=new l("gear",{fontCharacter:"\\eaf8"}),l.gift=new l("gift",{fontCharacter:"\\eaf9"}),l.gistSecret=new l("gist-secret",{fontCharacter:"\\eafa"}),l.gist=new l("gist",{fontCharacter:"\\eafb"}),l.gitCommit=new l("git-commit",{fontCharacter:"\\eafc"}),l.gitCompare=new l("git-compare",{fontCharacter:"\\eafd"}),l.gitMerge=new l("git-merge",{fontCharacter:"\\eafe"}),l.githubAction=new l("github-action",{fontCharacter:"\\eaff"}),l.githubAlt=new l("github-alt",{fontCharacter:"\\eb00"}),l.globe=new l("globe",{fontCharacter:"\\eb01"}),l.grabber=new l("grabber",{fontCharacter:"\\eb02"}),l.graph=new l("graph",{fontCharacter:"\\eb03"}),l.gripper=new l("gripper",{fontCharacter:"\\eb04"}),l.heart=new l("heart",{fontCharacter:"\\eb05"}),l.home=new l("home",{fontCharacter:"\\eb06"}),l.horizontalRule=new l("horizontal-rule",{fontCharacter:"\\eb07"}),l.hubot=new l("hubot",{fontCharacter:"\\eb08"}),l.inbox=new l("inbox",{fontCharacter:"\\eb09"}),l.issueClosed=new l("issue-closed",{fontCharacter:"\\eba4"}),l.issueReopened=new l("issue-reopened",{fontCharacter:"\\eb0b"}),l.issues=new l("issues",{fontCharacter:"\\eb0c"}),l.italic=new l("italic",{fontCharacter:"\\eb0d"}),l.jersey=new l("jersey",{fontCharacter:"\\eb0e"}),l.json=new l("json",{fontCharacter:"\\eb0f"}),l.kebabVertical=new l("kebab-vertical",{fontCharacter:"\\eb10"}),l.key=new l("key",{fontCharacter:"\\eb11"}),l.law=new l("law",{fontCharacter:"\\eb12"}),l.lightbulbAutofix=new l("lightbulb-autofix",{fontCharacter:"\\eb13"}),l.linkExternal=new l("link-external",{fontCharacter:"\\eb14"}),l.link=new l("link",{fontCharacter:"\\eb15"}),l.listOrdered=new l("list-ordered",{fontCharacter:"\\eb16"}),l.listUnordered=new l("list-unordered",{fontCharacter:"\\eb17"}),l.liveShare=new l("live-share",{fontCharacter:"\\eb18"}),l.loading=new l("loading",{fontCharacter:"\\eb19"}),l.location=new l("location",{fontCharacter:"\\eb1a"}),l.mailRead=new l("mail-read",{fontCharacter:"\\eb1b"}),l.mail=new l("mail",{fontCharacter:"\\eb1c"}),l.markdown=new l("markdown",{fontCharacter:"\\eb1d"}),l.megaphone=new l("megaphone",{fontCharacter:"\\eb1e"}),l.mention=new l("mention",{fontCharacter:"\\eb1f"}),l.milestone=new l("milestone",{fontCharacter:"\\eb20"}),l.mortarBoard=new l("mortar-board",{fontCharacter:"\\eb21"}),l.move=new l("move",{fontCharacter:"\\eb22"}),l.multipleWindows=new l("multiple-windows",{fontCharacter:"\\eb23"}),l.mute=new l("mute",{fontCharacter:"\\eb24"}),l.noNewline=new l("no-newline",{fontCharacter:"\\eb25"}),l.note=new l("note",{fontCharacter:"\\eb26"}),l.octoface=new l("octoface",{fontCharacter:"\\eb27"}),l.openPreview=new l("open-preview",{fontCharacter:"\\eb28"}),l.package_=new l("package",{fontCharacter:"\\eb29"}),l.paintcan=new l("paintcan",{fontCharacter:"\\eb2a"}),l.pin=new l("pin",{fontCharacter:"\\eb2b"}),l.play=new l("play",{fontCharacter:"\\eb2c"}),l.run=new l("run",{fontCharacter:"\\eb2c"}),l.plug=new l("plug",{fontCharacter:"\\eb2d"}),l.preserveCase=new l("preserve-case",{fontCharacter:"\\eb2e"}),l.preview=new l("preview",{fontCharacter:"\\eb2f"}),l.project=new l("project",{fontCharacter:"\\eb30"}),l.pulse=new l("pulse",{fontCharacter:"\\eb31"}),l.question=new l("question",{fontCharacter:"\\eb32"}),l.quote=new l("quote",{fontCharacter:"\\eb33"}),l.radioTower=new l("radio-tower",{fontCharacter:"\\eb34"}),l.reactions=new l("reactions",{fontCharacter:"\\eb35"}),l.references=new l("references",{fontCharacter:"\\eb36"}),l.refresh=new l("refresh",{fontCharacter:"\\eb37"}),l.regex=new l("regex",{fontCharacter:"\\eb38"}),l.remoteExplorer=new l("remote-explorer",{fontCharacter:"\\eb39"}),l.remote=new l("remote",{fontCharacter:"\\eb3a"}),l.remove=new l("remove",{fontCharacter:"\\eb3b"}),l.replaceAll=new l("replace-all",{fontCharacter:"\\eb3c"}),l.replace=new l("replace",{fontCharacter:"\\eb3d"}),l.repoClone=new l("repo-clone",{fontCharacter:"\\eb3e"}),l.repoForcePush=new l("repo-force-push",{fontCharacter:"\\eb3f"}),l.repoPull=new l("repo-pull",{fontCharacter:"\\eb40"}),l.repoPush=new l("repo-push",{fontCharacter:"\\eb41"}),l.report=new l("report",{fontCharacter:"\\eb42"}),l.requestChanges=new l("request-changes",{fontCharacter:"\\eb43"}),l.rocket=new l("rocket",{fontCharacter:"\\eb44"}),l.rootFolderOpened=new l("root-folder-opened",{fontCharacter:"\\eb45"}),l.rootFolder=new l("root-folder",{fontCharacter:"\\eb46"}),l.rss=new l("rss",{fontCharacter:"\\eb47"}),l.ruby=new l("ruby",{fontCharacter:"\\eb48"}),l.saveAll=new l("save-all",{fontCharacter:"\\eb49"}),l.saveAs=new l("save-as",{fontCharacter:"\\eb4a"}),l.save=new l("save",{fontCharacter:"\\eb4b"}),l.screenFull=new l("screen-full",{fontCharacter:"\\eb4c"}),l.screenNormal=new l("screen-normal",{fontCharacter:"\\eb4d"}),l.searchStop=new l("search-stop",{fontCharacter:"\\eb4e"}),l.server=new l("server",{fontCharacter:"\\eb50"}),l.settingsGear=new l("settings-gear",{fontCharacter:"\\eb51"}),l.settings=new l("settings",{fontCharacter:"\\eb52"}),l.shield=new l("shield",{fontCharacter:"\\eb53"}),l.smiley=new l("smiley",{fontCharacter:"\\eb54"}),l.sortPrecedence=new l("sort-precedence",{fontCharacter:"\\eb55"}),l.splitHorizontal=new l("split-horizontal",{fontCharacter:"\\eb56"}),l.splitVertical=new l("split-vertical",{fontCharacter:"\\eb57"}),l.squirrel=new l("squirrel",{fontCharacter:"\\eb58"}),l.starFull=new l("star-full",{fontCharacter:"\\eb59"}),l.starHalf=new l("star-half",{fontCharacter:"\\eb5a"}),l.symbolClass=new l("symbol-class",{fontCharacter:"\\eb5b"}),l.symbolColor=new l("symbol-color",{fontCharacter:"\\eb5c"}),l.symbolConstant=new l("symbol-constant",{fontCharacter:"\\eb5d"}),l.symbolEnumMember=new l("symbol-enum-member",{fontCharacter:"\\eb5e"}),l.symbolField=new l("symbol-field",{fontCharacter:"\\eb5f"}),l.symbolFile=new l("symbol-file",{fontCharacter:"\\eb60"}),l.symbolInterface=new l("symbol-interface",{fontCharacter:"\\eb61"}),l.symbolKeyword=new l("symbol-keyword",{fontCharacter:"\\eb62"}),l.symbolMisc=new l("symbol-misc",{fontCharacter:"\\eb63"}),l.symbolOperator=new l("symbol-operator",{fontCharacter:"\\eb64"}),l.symbolProperty=new l("symbol-property",{fontCharacter:"\\eb65"}),l.wrench=new l("wrench",{fontCharacter:"\\eb65"}),l.wrenchSubaction=new l("wrench-subaction",{fontCharacter:"\\eb65"}),l.symbolSnippet=new l("symbol-snippet",{fontCharacter:"\\eb66"}),l.tasklist=new l("tasklist",{fontCharacter:"\\eb67"}),l.telescope=new l("telescope",{fontCharacter:"\\eb68"}),l.textSize=new l("text-size",{fontCharacter:"\\eb69"}),l.threeBars=new l("three-bars",{fontCharacter:"\\eb6a"}),l.thumbsdown=new l("thumbsdown",{fontCharacter:"\\eb6b"}),l.thumbsup=new l("thumbsup",{fontCharacter:"\\eb6c"}),l.tools=new l("tools",{fontCharacter:"\\eb6d"}),l.triangleDown=new l("triangle-down",{fontCharacter:"\\eb6e"}),l.triangleLeft=new l("triangle-left",{fontCharacter:"\\eb6f"}),l.triangleRight=new l("triangle-right",{fontCharacter:"\\eb70"}),l.triangleUp=new l("triangle-up",{fontCharacter:"\\eb71"}),l.twitter=new l("twitter",{fontCharacter:"\\eb72"}),l.unfold=new l("unfold",{fontCharacter:"\\eb73"}),l.unlock=new l("unlock",{fontCharacter:"\\eb74"}),l.unmute=new l("unmute",{fontCharacter:"\\eb75"}),l.unverified=new l("unverified",{fontCharacter:"\\eb76"}),l.verified=new l("verified",{fontCharacter:"\\eb77"}),l.versions=new l("versions",{fontCharacter:"\\eb78"}),l.vmActive=new l("vm-active",{fontCharacter:"\\eb79"}),l.vmOutline=new l("vm-outline",{fontCharacter:"\\eb7a"}),l.vmRunning=new l("vm-running",{fontCharacter:"\\eb7b"}),l.watch=new l("watch",{fontCharacter:"\\eb7c"}),l.whitespace=new l("whitespace",{fontCharacter:"\\eb7d"}),l.wholeWord=new l("whole-word",{fontCharacter:"\\eb7e"}),l.window=new l("window",{fontCharacter:"\\eb7f"}),l.wordWrap=new l("word-wrap",{fontCharacter:"\\eb80"}),l.zoomIn=new l("zoom-in",{fontCharacter:"\\eb81"}),l.zoomOut=new l("zoom-out",{fontCharacter:"\\eb82"}),l.listFilter=new l("list-filter",{fontCharacter:"\\eb83"}),l.listFlat=new l("list-flat",{fontCharacter:"\\eb84"}),l.listSelection=new l("list-selection",{fontCharacter:"\\eb85"}),l.selection=new l("selection",{fontCharacter:"\\eb85"}),l.listTree=new l("list-tree",{fontCharacter:"\\eb86"}),l.debugBreakpointFunctionUnverified=new l("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),l.debugBreakpointFunction=new l("debug-breakpoint-function",{fontCharacter:"\\eb88"}),l.debugBreakpointFunctionDisabled=new l("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),l.debugStackframeActive=new l("debug-stackframe-active",{fontCharacter:"\\eb89"}),l.debugStackframeDot=new l("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),l.debugStackframe=new l("debug-stackframe",{fontCharacter:"\\eb8b"}),l.debugStackframeFocused=new l("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),l.debugBreakpointUnsupported=new l("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),l.symbolString=new l("symbol-string",{fontCharacter:"\\eb8d"}),l.debugReverseContinue=new l("debug-reverse-continue",{fontCharacter:"\\eb8e"}),l.debugStepBack=new l("debug-step-back",{fontCharacter:"\\eb8f"}),l.debugRestartFrame=new l("debug-restart-frame",{fontCharacter:"\\eb90"}),l.callIncoming=new l("call-incoming",{fontCharacter:"\\eb92"}),l.callOutgoing=new l("call-outgoing",{fontCharacter:"\\eb93"}),l.menu=new l("menu",{fontCharacter:"\\eb94"}),l.expandAll=new l("expand-all",{fontCharacter:"\\eb95"}),l.feedback=new l("feedback",{fontCharacter:"\\eb96"}),l.groupByRefType=new l("group-by-ref-type",{fontCharacter:"\\eb97"}),l.ungroupByRefType=new l("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),l.account=new l("account",{fontCharacter:"\\eb99"}),l.bellDot=new l("bell-dot",{fontCharacter:"\\eb9a"}),l.debugConsole=new l("debug-console",{fontCharacter:"\\eb9b"}),l.library=new l("library",{fontCharacter:"\\eb9c"}),l.output=new l("output",{fontCharacter:"\\eb9d"}),l.runAll=new l("run-all",{fontCharacter:"\\eb9e"}),l.syncIgnored=new l("sync-ignored",{fontCharacter:"\\eb9f"}),l.pinned=new l("pinned",{fontCharacter:"\\eba0"}),l.githubInverted=new l("github-inverted",{fontCharacter:"\\eba1"}),l.debugAlt=new l("debug-alt",{fontCharacter:"\\eb91"}),l.serverProcess=new l("server-process",{fontCharacter:"\\eba2"}),l.serverEnvironment=new l("server-environment",{fontCharacter:"\\eba3"}),l.pass=new l("pass",{fontCharacter:"\\eba4"}),l.stopCircle=new l("stop-circle",{fontCharacter:"\\eba5"}),l.playCircle=new l("play-circle",{fontCharacter:"\\eba6"}),l.record=new l("record",{fontCharacter:"\\eba7"}),l.debugAltSmall=new l("debug-alt-small",{fontCharacter:"\\eba8"}),l.vmConnect=new l("vm-connect",{fontCharacter:"\\eba9"}),l.cloud=new l("cloud",{fontCharacter:"\\ebaa"}),l.merge=new l("merge",{fontCharacter:"\\ebab"}),l.exportIcon=new l("export",{fontCharacter:"\\ebac"}),l.graphLeft=new l("graph-left",{fontCharacter:"\\ebad"}),l.magnet=new l("magnet",{fontCharacter:"\\ebae"}),l.notebook=new l("notebook",{fontCharacter:"\\ebaf"}),l.redo=new l("redo",{fontCharacter:"\\ebb0"}),l.checkAll=new l("check-all",{fontCharacter:"\\ebb1"}),l.pinnedDirty=new l("pinned-dirty",{fontCharacter:"\\ebb2"}),l.passFilled=new l("pass-filled",{fontCharacter:"\\ebb3"}),l.circleLargeFilled=new l("circle-large-filled",{fontCharacter:"\\ebb4"}),l.circleLargeOutline=new l("circle-large-outline",{fontCharacter:"\\ebb5"}),l.combine=new l("combine",{fontCharacter:"\\ebb6"}),l.gather=new l("gather",{fontCharacter:"\\ebb6"}),l.table=new l("table",{fontCharacter:"\\ebb7"}),l.variableGroup=new l("variable-group",{fontCharacter:"\\ebb8"}),l.typeHierarchy=new l("type-hierarchy",{fontCharacter:"\\ebb9"}),l.typeHierarchySub=new l("type-hierarchy-sub",{fontCharacter:"\\ebba"}),l.typeHierarchySuper=new l("type-hierarchy-super",{fontCharacter:"\\ebbb"}),l.gitPullRequestCreate=new l("git-pull-request-create",{fontCharacter:"\\ebbc"}),l.runAbove=new l("run-above",{fontCharacter:"\\ebbd"}),l.runBelow=new l("run-below",{fontCharacter:"\\ebbe"}),l.notebookTemplate=new l("notebook-template",{fontCharacter:"\\ebbf"}),l.debugRerun=new l("debug-rerun",{fontCharacter:"\\ebc0"}),l.workspaceTrusted=new l("workspace-trusted",{fontCharacter:"\\ebc1"}),l.workspaceUntrusted=new l("workspace-untrusted",{fontCharacter:"\\ebc2"}),l.workspaceUnspecified=new l("workspace-unspecified",{fontCharacter:"\\ebc3"}),l.terminalCmd=new l("terminal-cmd",{fontCharacter:"\\ebc4"}),l.terminalDebian=new l("terminal-debian",{fontCharacter:"\\ebc5"}),l.terminalLinux=new l("terminal-linux",{fontCharacter:"\\ebc6"}),l.terminalPowershell=new l("terminal-powershell",{fontCharacter:"\\ebc7"}),l.terminalTmux=new l("terminal-tmux",{fontCharacter:"\\ebc8"}),l.terminalUbuntu=new l("terminal-ubuntu",{fontCharacter:"\\ebc9"}),l.terminalBash=new l("terminal-bash",{fontCharacter:"\\ebca"}),l.arrowSwap=new l("arrow-swap",{fontCharacter:"\\ebcb"}),l.copy=new l("copy",{fontCharacter:"\\ebcc"}),l.personAdd=new l("person-add",{fontCharacter:"\\ebcd"}),l.filterFilled=new l("filter-filled",{fontCharacter:"\\ebce"}),l.wand=new l("wand",{fontCharacter:"\\ebcf"}),l.debugLineByLine=new l("debug-line-by-line",{fontCharacter:"\\ebd0"}),l.inspect=new l("inspect",{fontCharacter:"\\ebd1"}),l.layers=new l("layers",{fontCharacter:"\\ebd2"}),l.layersDot=new l("layers-dot",{fontCharacter:"\\ebd3"}),l.layersActive=new l("layers-active",{fontCharacter:"\\ebd4"}),l.compass=new l("compass",{fontCharacter:"\\ebd5"}),l.compassDot=new l("compass-dot",{fontCharacter:"\\ebd6"}),l.compassActive=new l("compass-active",{fontCharacter:"\\ebd7"}),l.azure=new l("azure",{fontCharacter:"\\ebd8"}),l.issueDraft=new l("issue-draft",{fontCharacter:"\\ebd9"}),l.gitPullRequestClosed=new l("git-pull-request-closed",{fontCharacter:"\\ebda"}),l.gitPullRequestDraft=new l("git-pull-request-draft",{fontCharacter:"\\ebdb"}),l.debugAll=new l("debug-all",{fontCharacter:"\\ebdc"}),l.debugCoverage=new l("debug-coverage",{fontCharacter:"\\ebdd"}),l.runErrors=new l("run-errors",{fontCharacter:"\\ebde"}),l.folderLibrary=new l("folder-library",{fontCharacter:"\\ebdf"}),l.debugContinueSmall=new l("debug-continue-small",{fontCharacter:"\\ebe0"}),l.beakerStop=new l("beaker-stop",{fontCharacter:"\\ebe1"}),l.graphLine=new l("graph-line",{fontCharacter:"\\ebe2"}),l.graphScatter=new l("graph-scatter",{fontCharacter:"\\ebe3"}),l.pieChart=new l("pie-chart",{fontCharacter:"\\ebe4"}),l.bracket=new l("bracket",l.json.definition),l.bracketDot=new l("bracket-dot",{fontCharacter:"\\ebe5"}),l.bracketError=new l("bracket-error",{fontCharacter:"\\ebe6"}),l.lockSmall=new l("lock-small",{fontCharacter:"\\ebe7"}),l.azureDevops=new l("azure-devops",{fontCharacter:"\\ebe8"}),l.verifiedFilled=new l("verified-filled",{fontCharacter:"\\ebe9"})}(ue||(ue={}))},79881:function(Ut,at,O){"use strict";O.d(at,{B8:function(){return A},Cp:function(){return ne},F0:function(){return ee},L6:function(){return j},VV:function(){return ue},b1:function(){return l},dL:function(){return De},ri:function(){return $}});class N{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(m){setTimeout(()=>{throw m.stack?new Error(m.message+`
`+m.stack):m},0)}}emit(m){this.listeners.forEach(y=>{y(m)})}onUnexpectedError(m){this.unexpectedErrorHandler(m),this.emit(m)}onUnexpectedExternalError(m){this.unexpectedErrorHandler(m)}}const re=new N;function De(p){ue(p)||re.onUnexpectedError(p)}function ne(p){ue(p)||re.onUnexpectedExternalError(p)}function $(p){if(p instanceof Error){let{name:m,message:y}=p;const x=p.stacktrace||p.stack;return{$isError:!0,name:m,message:y,stack:x}}return p}const g="Canceled";function ue(p){return p instanceof Error&&p.name===g&&p.message===g}function ee(){const p=new Error(g);return p.name=p.message,p}function l(p){return p?new Error(`Illegal argument: ${p}`):new Error("Illegal argument")}function j(p){return p?new Error(`Illegal state: ${p}`):new Error("Illegal state")}class A extends Error{constructor(m){super("NotSupported"),m&&(this.message=m)}}},4348:function(Ut,at,O){"use strict";O.d(at,{D0:function(){return A},E7:function(){return p},K3:function(){return j},Q5:function(){return l},ZD:function(){return m},ju:function(){return $}});var N=O(79881),re=O(69323),De=O(34502),ne=O(95830),$;(function(y){y.None=()=>re.JT.None;function x(w){return(P,W=null,K)=>{let _=!1,v;return v=w(D=>{if(!_)return v?v.dispose():_=!0,P.call(W,D)},null,K),_&&v.dispose(),v}}y.once=x;function M(w,P){return H((W,K=null,_)=>w(v=>W.call(K,P(v)),null,_))}y.map=M;function F(w,P){return H((W,K=null,_)=>w(v=>{P(v),W.call(K,v)},null,_))}y.forEach=F;function z(w,P){return H((W,K=null,_)=>w(v=>P(v)&&W.call(K,v),null,_))}y.filter=z;function I(w){return w}y.signal=I;function C(...w){return(P,W=null,K)=>(0,re.F8)(...w.map(_=>_(v=>P.call(W,v),null,K)))}y.any=C;function U(w,P,W){let K=W;return M(w,_=>(K=P(K,_),K))}y.reduce=U;function H(w){let P;const W=new l({onFirstListenerAdd(){P=w(W.fire,W)},onLastListenerRemove(){P.dispose()}});return W.event}function J(w,P,W=100,K=!1,_){let v,D,Z,fe=0;const ye=new l({leakWarningThreshold:_,onFirstListenerAdd(){v=w(Oe=>{fe++,D=P(D,Oe),K&&!Z&&(ye.fire(D),D=void 0),clearTimeout(Z),Z=setTimeout(()=>{const Ne=D;D=void 0,Z=void 0,(!K||fe>1)&&ye.fire(Ne),fe=0},W)})},onLastListenerRemove(){v.dispose()}});return ye.event}y.debounce=J;function he(w,P=(W,K)=>W===K){let W=!0,K;return z(w,_=>{const v=W||!P(_,K);return W=!1,K=_,v})}y.latch=he;function X(w,P){return[y.filter(w,P),y.filter(w,W=>!P(W))]}y.split=X;function oe(w,P=!1,W=[]){let K=W.slice(),_=w(Z=>{K?K.push(Z):D.fire(Z)});const v=()=>{K&&K.forEach(Z=>D.fire(Z)),K=null},D=new l({onFirstListenerAdd(){_||(_=w(Z=>D.fire(Z)))},onFirstListenerDidAdd(){K&&(P?setTimeout(v):v())},onLastListenerRemove(){_&&_.dispose(),_=null}});return D.event}y.buffer=oe;class _e{constructor(P){this.event=P}map(P){return new _e(M(this.event,P))}forEach(P){return new _e(F(this.event,P))}filter(P){return new _e(z(this.event,P))}reduce(P,W){return new _e(U(this.event,P,W))}latch(){return new _e(he(this.event))}debounce(P,W=100,K=!1,_){return new _e(J(this.event,P,W,K,_))}on(P,W,K){return this.event(P,W,K)}once(P,W,K){return x(this.event)(P,W,K)}}function ie(w){return new _e(w)}y.chain=ie;function ze(w,P,W=K=>K){const K=(...Z)=>D.fire(W(...Z)),_=()=>w.on(P,K),v=()=>w.removeListener(P,K),D=new l({onFirstListenerAdd:_,onLastListenerRemove:v});return D.event}y.fromNodeEventEmitter=ze;function k(w,P,W=K=>K){const K=(...Z)=>D.fire(W(...Z)),_=()=>w.addEventListener(P,K),v=()=>w.removeEventListener(P,K),D=new l({onFirstListenerAdd:_,onLastListenerRemove:v});return D.event}y.fromDOMEventEmitter=k;function S(w){return new Promise(P=>x(w)(P))}y.toPromise=S})($||($={}));class g{constructor(x){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${x}_${g._idPool++}`}start(x){this._stopWatch=new ne.G(!0),this._listenerCount=x}stop(){if(this._stopWatch){const x=this._stopWatch.elapsed();this._elapsedOverall+=x,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${x.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}g._idPool=0;let ue=-1;class ee{constructor(x,M=Math.random().toString(18).slice(2,5)){this.customThreshold=x,this.name=M,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(x){let M=ue;if(typeof this.customThreshold=="number"&&(M=this.customThreshold),M<=0||x<M)return;this._stacks||(this._stacks=new Map);const F=new Error().stack.split(`
`).slice(3).join(`
`),z=this._stacks.get(F)||0;if(this._stacks.set(F,z+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=M*.5;let I,C=0;for(const[U,H]of this._stacks)(!I||C<H)&&(I=U,C=H);console.warn(`[${this.name}] potential listener LEAK detected, having ${x} listeners already. MOST frequent listener (${C}):`),console.warn(I)}return()=>{const I=this._stacks.get(F)||0;this._stacks.set(F,I-1)}}}class l{constructor(x){var M;this._disposed=!1,this._options=x,this._leakageMon=ue>0?new ee(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((M=this._options)===null||M===void 0)&&M._profName?new g(this._options._profName):void 0}get event(){return this._event||(this._event=(x,M,F)=>{var z;this._listeners||(this._listeners=new De.S);const I=this._listeners.isEmpty();I&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const C=this._listeners.push(M?[x,M]:x);I&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,x,M);const U=(z=this._leakageMon)===null||z===void 0?void 0:z.check(this._listeners.size),H=(0,re.OF)(()=>{U&&U(),this._disposed||(C(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return F instanceof re.SL?F.add(H):Array.isArray(F)&&F.push(H),H}),this._event}fire(x){var M,F;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new De.S);for(let z of this._listeners)this._deliveryQueue.push([z,x]);for((M=this._perfMon)===null||M===void 0||M.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[z,I]=this._deliveryQueue.shift();try{typeof z=="function"?z.call(void 0,I):z[0].call(z[1],I)}catch(C){(0,N.dL)(C)}}(F=this._perfMon)===null||F===void 0||F.stop()}}dispose(){var x,M,F,z,I;this._disposed||(this._disposed=!0,(x=this._listeners)===null||x===void 0||x.clear(),(M=this._deliveryQueue)===null||M===void 0||M.clear(),(z=(F=this._options)===null||F===void 0?void 0:F.onLastListenerRemove)===null||z===void 0||z.call(F),(I=this._leakageMon)===null||I===void 0||I.dispose())}}class j extends l{constructor(x){super(x),this._isPaused=0,this._eventQueue=new De.S,this._mergeFn=x==null?void 0:x.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const x=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(x))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(x){this._listeners&&(this._isPaused!==0?this._eventQueue.push(x):super.fire(x))}}class A extends j{constructor(x){var M;super(x),this._delay=(M=x.delay)!==null&&M!==void 0?M:100}fire(x){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(x)}}class p{constructor(){this.buffers=[]}wrapEvent(x){return(M,F,z)=>x(I=>{const C=this.buffers[this.buffers.length-1];C?C.push(()=>M.call(F,I)):M.call(F,I)},void 0,z)}bufferEvents(x){const M=[];this.buffers.push(M);const F=x();return this.buffers.pop(),M.forEach(z=>z()),F}}class m{constructor(){this.listening=!1,this.inputEvent=$.None,this.inputEventListener=re.JT.None,this.emitter=new l({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(x){this.inputEvent=x,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=x(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Ut,at,O){"use strict";O.d(at,{I:function(){return N}});function N(re){const De=this;let ne=!1,$;return function(){return ne||(ne=!0,$=re.apply(De,arguments)),$}}},88226:function(Ut,at,O){"use strict";O.d(at,{$:function(){return N}});var N;(function(re){function De(C){return C&&typeof C=="object"&&typeof C[Symbol.iterator]=="function"}re.is=De;const ne=Object.freeze([]);function $(){return ne}re.empty=$;function*g(C){yield C}re.single=g;function ue(C){return C||ne}re.from=ue;function ee(C){return!C||C[Symbol.iterator]().next().done===!0}re.isEmpty=ee;function l(C){return C[Symbol.iterator]().next().value}re.first=l;function j(C,U){for(const H of C)if(U(H))return!0;return!1}re.some=j;function A(C,U){for(const H of C)if(U(H))return H}re.find=A;function*p(C,U){for(const H of C)U(H)&&(yield H)}re.filter=p;function*m(C,U){let H=0;for(const J of C)yield U(J,H++)}re.map=m;function*y(...C){for(const U of C)for(const H of U)yield H}re.concat=y;function*x(C){for(const U of C)for(const H of U)yield H}re.concatNested=x;function M(C,U,H){let J=H;for(const he of C)J=U(J,he);return J}re.reduce=M;function*F(C,U,H=C.length){for(U<0&&(U+=C.length),H<0?H+=C.length:H>C.length&&(H=C.length);U<H;U++)yield C[U]}re.slice=F;function z(C,U=Number.POSITIVE_INFINITY){const H=[];if(U===0)return[H,C];const J=C[Symbol.iterator]();for(let he=0;he<U;he++){const X=J.next();if(X.done)return[H,re.empty()];H.push(X.value)}return[H,{[Symbol.iterator](){return J}}]}re.consume=z;function I(C,U,H=(J,he)=>J===he){const J=C[Symbol.iterator](),he=U[Symbol.iterator]();for(;;){const X=J.next(),oe=he.next();if(X.done!==oe.done)return!1;if(X.done)return!0;if(!H(X.value,oe.value))return!1}}re.equals=I})(N||(N={}))},69323:function(Ut,at,O){"use strict";O.d(at,{B9:function(){return m},F8:function(){return y},JT:function(){return F},Jz:function(){return I},OF:function(){return x},SL:function(){return M},Wf:function(){return p},XK:function(){return z},dk:function(){return j}});var N=O(17845),re=O(88226);const De=!1;let ne=null;function $(C){ne=C}if(De){const C="__is_disposable_tracked__";$(new class{trackDisposable(U){const H=new Error("Potentially leaked disposable").stack;setTimeout(()=>{U[C]||console.log(H)},3e3)}setParent(U,H){if(U&&U!==F.None)try{U[C]=!0}catch(J){}}markAsDisposed(U){if(U&&U!==F.None)try{U[C]=!0}catch(H){}}markAsSingleton(U){}})}function g(C){return ne==null||ne.trackDisposable(C),C}function ue(C){ne==null||ne.markAsDisposed(C)}function ee(C,U){ne==null||ne.setParent(C,U)}function l(C,U){if(ne)for(const H of C)ne.setParent(H,U)}function j(C){return ne==null||ne.markAsSingleton(C),C}class A extends Error{constructor(U){super(`Encountered errors while disposing of store. Errors: [${U.join(", ")}]`),this.errors=U}}function p(C){return typeof C.dispose=="function"&&C.dispose.length===0}function m(C){if(re.$.is(C)){let U=[];for(const H of C)if(H)try{H.dispose()}catch(J){U.push(J)}if(U.length===1)throw U[0];if(U.length>1)throw new A(U);return Array.isArray(C)?[]:C}else if(C)return C.dispose(),C}function y(...C){const U=x(()=>m(C));return l(C,U),U}function x(C){const U=g({dispose:(0,N.I)(()=>{ue(U),C()})});return U}class M{constructor(){this._toDispose=new Set,this._isDisposed=!1,g(this)}dispose(){this._isDisposed||(ue(this),this._isDisposed=!0,this.clear())}clear(){try{m(this._toDispose.values())}finally{this._toDispose.clear()}}add(U){if(!U)return U;if(U===this)throw new Error("Cannot register a disposable on itself!");return ee(U,this),this._isDisposed?M.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(U),U}}M.DISABLE_DISPOSED_WARNING=!1;class F{constructor(){this._store=new M,g(this),ee(this._store,this)}dispose(){ue(this),this._store.dispose()}_register(U){if(U===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(U)}}F.None=Object.freeze({dispose(){}});class z{constructor(){this._isDisposed=!1,g(this)}get value(){return this._isDisposed?void 0:this._value}set value(U){var H;this._isDisposed||U===this._value||((H=this._value)===null||H===void 0||H.dispose(),U&&ee(U,this),this._value=U)}clear(){this.value=void 0}dispose(){var U;this._isDisposed=!0,ue(this),(U=this._value)===null||U===void 0||U.dispose(),this._value=void 0}clearAndLeak(){const U=this._value;return this._value=void 0,U&&ee(U,null),U}}class I{constructor(U){this.object=U}dispose(){}}},34502:function(Ut,at,O){"use strict";O.d(at,{S:function(){return re}});class N{constructor(ne){this.element=ne,this.next=N.Undefined,this.prev=N.Undefined}}N.Undefined=new N(void 0);class re{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 ne=this._first;for(;ne!==N.Undefined;){const $=ne.next;ne.prev=N.Undefined,ne.next=N.Undefined,ne=$}this._first=N.Undefined,this._last=N.Undefined,this._size=0}unshift(ne){return this._insert(ne,!1)}push(ne){return this._insert(ne,!0)}_insert(ne,$){const g=new N(ne);if(this._first===N.Undefined)this._first=g,this._last=g;else if($){const ee=this._last;this._last=g,g.prev=ee,ee.next=g}else{const ee=this._first;this._first=g,g.next=ee,ee.prev=g}this._size+=1;let ue=!1;return()=>{ue||(ue=!0,this._remove(g))}}shift(){if(this._first!==N.Undefined){const ne=this._first.element;return this._remove(this._first),ne}}pop(){if(this._last!==N.Undefined){const ne=this._last.element;return this._remove(this._last),ne}}_remove(ne){if(ne.prev!==N.Undefined&&ne.next!==N.Undefined){const $=ne.prev;$.next=ne.next,ne.next.prev=$}else ne.prev===N.Undefined&&ne.next===N.Undefined?(this._first=N.Undefined,this._last=N.Undefined):ne.next===N.Undefined?(this._last=this._last.prev,this._last.next=N.Undefined):ne.prev===N.Undefined&&(this._first=this._first.next,this._first.prev=N.Undefined);this._size-=1}*[Symbol.iterator](){let ne=this._first;for(;ne!==N.Undefined;)yield ne.element,ne=ne.next}}},23345:function(Ut,at,O){"use strict";O.d(at,{$L:function(){return J},ED:function(){return I},IJ:function(){return U},OS:function(){return _e},WE:function(){return X},dz:function(){return C},gn:function(){return he},li:function(){return x},r:function(){return k},tY:function(){return H},xS:function(){return oe}});var N=O(97671),re;const De="en";let ne=!1,$=!1,g=!1,ue=!1,ee=!1,l=!1,j=!1,A,p=null,m=null,y;const x=typeof self=="object"?self:typeof O.g=="object"?O.g:{};let M;typeof x.vscode!="undefined"&&typeof x.vscode.process!="undefined"?M=x.vscode.process:typeof N!="undefined"&&(M=N);const F=typeof((re=M==null?void 0:M.versions)===null||re===void 0?void 0:re.electron)=="string"&&M.type==="renderer";if(typeof navigator=="object"&&!F)y=navigator.userAgent,ne=y.indexOf("Windows")>=0,$=y.indexOf("Macintosh")>=0,j=(y.indexOf("Macintosh")>=0||y.indexOf("iPad")>=0||y.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,g=y.indexOf("Linux")>=0,l=!0,A=navigator.language,p=A;else if(typeof M=="object"){ne=M.platform==="win32",$=M.platform==="darwin",g=M.platform==="linux",ue=g&&!!M.env.SNAP&&!!M.env.SNAP_REVISION,A=De,p=De;const S=M.env.VSCODE_NLS_CONFIG;if(S)try{const w=JSON.parse(S),P=w.availableLanguages["*"];A=w.locale,p=P||De,m=w._translationsConfigFile}catch(w){}ee=!0}else console.error("Unable to resolve platform.");let z=0;$?z=1:ne?z=3:g&&(z=2);const I=ne,C=$,U=g,H=ee,J=l,he=j,X=y,oe=function(){if(x.setImmediate)return x.setImmediate.bind(x);if(typeof x.postMessage=="function"&&!x.importScripts){let P=[];x.addEventListener("message",K=>{if(K.data&&K.data.vscodeSetImmediateId)for(let _=0,v=P.length;_<v;_++){const D=P[_];if(D.id===K.data.vscodeSetImmediateId){P.splice(_,1),D.callback();return}}});let W=0;return K=>{const _=++W;P.push({id:_,callback:K}),x.postMessage({vscodeSetImmediateId:_},"*")}}if(typeof(M==null?void 0:M.nextTick)=="function")return M.nextTick.bind(M);const w=Promise.resolve();return P=>w.then(P)}(),_e=$||j?2:ne?1:3;let ie=!0,ze=!1;function k(){if(!ze){ze=!0;const S=new Uint8Array(2);S[0]=1,S[1]=2,ie=new Uint16Array(S.buffer)[0]===513}return ie}},95830:function(Ut,at,O){"use strict";O.d(at,{G:function(){return De}});var N=O(23345);const re=N.li.performance&&typeof N.li.performance.now=="function";class De{constructor($){this._highResolution=re&&$,this._startTime=this._now(),this._stopTime=-1}static create($=!0){return new De($)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?N.li.performance.now():Date.now()}}},82983:function(Ut,at,O){"use strict";O.d(at,{$i:function(){return fe},C8:function(){return Me},GF:function(){return A},HO:function(){return W},IO:function(){return p},K7:function(){return ve},Kw:function(){return Ce},LC:function(){return x},Mh:function(){return oe},P1:function(){return _e},PJ:function(){return rt},Qe:function(){return ye},R1:function(){return j},RP:function(){return D},S6:function(){return Pe},TT:function(){return I},Ut:function(){return _},V8:function(){return M},WU:function(){return De},YK:function(){return ze},YU:function(){return ne},ZG:function(){return ie},ZH:function(){return S},ab:function(){return Oe},c1:function(){return Ae},df:function(){return J},ec:function(){return $},fi:function(){return ut},fy:function(){return g},j3:function(){return ue},j_:function(){return U},m5:function(){return N},mK:function(){return H},mr:function(){return m},oH:function(){return Y},oL:function(){return ee},ok:function(){return X},ow:function(){return F},qq:function(){return he},qu:function(){return z},rL:function(){return k},uS:function(){return dt},un:function(){return l},uq:function(){return y},vH:function(){return P},xe:function(){return Ne},zY:function(){return C}});function N(G){return!G||typeof G!="string"?!0:G.trim().length===0}const re=/{(\d+)}/g;function De(G,...q){return q.length===0?G:G.replace(re,function(me,we){const Le=parseInt(we,10);return isNaN(Le)||Le<0||Le>=q.length?me:q[Le]})}function ne(G){return G.replace(/[<>&]/g,function(q){switch(q){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return q}})}function $(G){return G.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function g(G,q=" "){const me=ue(G,q);return ee(me,q)}function ue(G,q){if(!G||!q)return G;const me=q.length;if(me===0||G.length===0)return G;let we=0;for(;G.indexOf(q,we)===we;)we=we+me;return G.substring(we)}function ee(G,q){if(!G||!q)return G;const me=q.length,we=G.length;if(me===0||we===0)return G;let Le=we,$e=-1;for(;$e=G.lastIndexOf(q,Le-1),!($e===-1||$e+me!==Le);){if($e===0)return"";Le=$e}return G.substring(0,Le)}function l(G){return G.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function j(G){return G.replace(/\*/g,"")}function A(G,q,me={}){if(!G)throw new Error("Cannot create regex from empty string");q||(G=$(G)),me.wholeWord&&(/\B/.test(G.charAt(0))||(G="\\b"+G),/\B/.test(G.charAt(G.length-1))||(G=G+"\\b"));let we="";return me.global&&(we+="g"),me.matchCase||(we+="i"),me.multiline&&(we+="m"),me.unicode&&(we+="u"),new RegExp(G,we)}function p(G){return G.source==="^"||G.source==="^$"||G.source==="$"||G.source==="^\\s*$"?!1:!!(G.exec("")&&G.lastIndex===0)}function m(G){return(G.global?"g":"")+(G.ignoreCase?"i":"")+(G.multiline?"m":"")+(G.unicode?"u":"")}function y(G){return G.split(/\r\n|\r|\n/)}function x(G){for(let q=0,me=G.length;q<me;q++){const we=G.charCodeAt(q);if(we!==32&&we!==9)return q}return-1}function M(G,q=0,me=G.length){for(let we=q;we<me;we++){const Le=G.charCodeAt(we);if(Le!==32&&Le!==9)return G.substring(q,we)}return G.substring(q,me)}function F(G,q=G.length-1){for(let me=q;me>=0;me--){const we=G.charCodeAt(me);if(we!==32&&we!==9)return me}return-1}function z(G,q){return G<q?-1:G>q?1:0}function I(G,q,me=0,we=G.length,Le=0,$e=q.length){for(;me<we&&Le<$e;me++,Le++){let et=G.charCodeAt(me),Ve=q.charCodeAt(Le);if(et<Ve)return-1;if(et>Ve)return 1}const yt=we-me,Qe=$e-Le;return yt<Qe?-1:yt>Qe?1:0}function C(G,q){return U(G,q,0,G.length,0,q.length)}function U(G,q,me=0,we=G.length,Le=0,$e=q.length){for(;me<we&&Le<$e;me++,Le++){let et=G.charCodeAt(me),Ve=q.charCodeAt(Le);if(et===Ve)continue;if(et>=128||Ve>=128)return I(G.toLowerCase(),q.toLowerCase(),me,we,Le,$e);H(et)&&(et-=32),H(Ve)&&(Ve-=32);const He=et-Ve;if(He!==0)return He}const yt=we-me,Qe=$e-Le;return yt<Qe?-1:yt>Qe?1:0}function H(G){return G>=97&&G<=122}function J(G){return G>=65&&G<=90}function he(G,q){return G.length===q.length&&U(G,q)===0}function X(G,q){const me=q.length;return q.length>G.length?!1:U(G,q,0,me)===0}function oe(G,q){let me,we=Math.min(G.length,q.length);for(me=0;me<we;me++)if(G.charCodeAt(me)!==q.charCodeAt(me))return me;return we}function _e(G,q){let me,we=Math.min(G.length,q.length);const Le=G.length-1,$e=q.length-1;for(me=0;me<we;me++)if(G.charCodeAt(Le-me)!==q.charCodeAt($e-me))return me;return we}function ie(G){return 55296<=G&&G<=56319}function ze(G){return 56320<=G&&G<=57343}function k(G,q){return(G-55296<<10)+(q-56320)+65536}function S(G,q,me){const we=G.charCodeAt(me);if(ie(we)&&me+1<q){const Le=G.charCodeAt(me+1);if(ze(Le))return k(we,Le)}return we}function w(G,q){const me=G.charCodeAt(q-1);if(ze(me)&&q>1){const we=G.charCodeAt(q-2);if(ie(we))return k(we,me)}return me}function P(G,q){const me=ce.getInstance(),we=q,Le=G.length,$e=S(G,Le,q);q+=$e>=65536?2:1;let yt=me.getGraphemeBreakType($e);for(;q<Le;){const Qe=S(G,Le,q),et=me.getGraphemeBreakType(Qe);if(ut(yt,et))break;q+=Qe>=65536?2:1,yt=et}return q-we}function W(G,q){const me=ce.getInstance(),we=q,Le=w(G,q);q-=Le>=65536?2:1;let $e=me.getGraphemeBreakType(Le);for(;q>0;){const yt=w(G,q),Qe=me.getGraphemeBreakType(yt);if(ut(Qe,$e))break;q-=yt>=65536?2:1,$e=Qe}return we-q}const K=/(?:[\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 _(G){return K.test(G)}const v=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function D(G){return v.test(G)}const Z=/^[\t\n\r\x20-\x7E]*$/;function fe(G){return Z.test(G)}const ye=/[\u2028\u2029]/;function Oe(G){return ye.test(G)}function Ne(G){for(let q=0,me=G.length;q<me;q++)if(ve(G.charCodeAt(q)))return!0;return!1}function ve(G){return G=+G,G>=11904&&G<=55215||G>=63744&&G<=64255||G>=65281&&G<=65374}function Me(G){return G>=127462&&G<=127487||G===8986||G===8987||G===9200||G===9203||G>=9728&&G<=10175||G===11088||G===11093||G>=127744&&G<=128591||G>=128640&&G<=128764||G>=128992&&G<=129003||G>=129280&&G<=129535||G>=129648&&G<=129750}const Ae="\uFEFF";function dt(G){return!!(G&&G.length>0&&G.charCodeAt(0)===65279)}function Ce(G,q=!1){return G?(q&&(G=G.replace(/\\./g,"")),G.toLowerCase()!==G):!1}function rt(G){return G=G%(2*26),G<26?String.fromCharCode(97+G):String.fromCharCode(65+G-26)}function Pe(G){return ce.getInstance().getGraphemeBreakType(G)}function ut(G,q){return G===0?q!==5&&q!==7:G===2&&q===3?!1:G===4||G===2||G===3||q===4||q===2||q===3?!0:!(G===8&&(q===8||q===9||q===11||q===12)||(G===11||G===9)&&(q===9||q===10)||(G===12||G===10)&&q===10||q===5||q===13||q===7||G===1||G===13&&q===14||G===6&&q===6)}class ce{constructor(){this._data=le()}static getInstance(){return ce._INSTANCE||(ce._INSTANCE=new ce),ce._INSTANCE}getGraphemeBreakType(q){if(q<32)return q===10?3:q===13?2:4;if(q<127)return 0;const me=this._data,we=me.length/3;let Le=1;for(;Le<=we;)if(q<me[3*Le])Le=2*Le;else if(q>me[3*Le+1])Le=2*Le+1;else return me[3*Le+2];return 0}}ce._INSTANCE=null;function le(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function Y(G,q){if(G===0)return 0;const me=Te(G,q);if(me!==void 0)return me;const we=w(q,G);return G-=ke(we),G}function Te(G,q){let me=w(q,G);for(G-=ke(me);Ke(me)||me===65039||me===8419;){if(G===0)return;me=w(q,G),G-=ke(me)}if(Me(me)){if(G>=0){const we=w(q,G);we===8205&&(G-=ke(we))}return G}}function ke(G){return G>=65536?2:1}function Ke(G){return 127995<=G&&G<=127999}},72999:function(Ut,at,O){"use strict";O.d(at,{$E:function(){return x},$K:function(){return ue},D8:function(){return p},HD:function(){return re},IU:function(){return M},Jp:function(){return ee},Kn:function(){return De},cW:function(){return j},f6:function(){return F},hj:function(){return ne},jn:function(){return $},kJ:function(){return N},mf:function(){return A},o8:function(){return g},p_:function(){return l},vE:function(){return z}});function N(I){return Array.isArray(I)}function re(I){return typeof I=="string"}function De(I){return typeof I=="object"&&I!==null&&!Array.isArray(I)&&!(I instanceof RegExp)&&!(I instanceof Date)}function ne(I){return typeof I=="number"&&!isNaN(I)}function $(I){return I===!0||I===!1}function g(I){return typeof I=="undefined"}function ue(I){return!ee(I)}function ee(I){return g(I)||I===null}function l(I,C){if(!I)throw new Error(C?`Unexpected type, expected '${C}'`:"Unexpected type")}function j(I){if(ee(I))throw new Error("Assertion Failed: argument is undefined or null");return I}function A(I){return typeof I=="function"}function p(I,C){const U=Math.min(I.length,C.length);for(let H=0;H<U;H++)m(I[H],C[H])}function m(I,C){if(re(C)){if(typeof I!==C)throw new Error(`argument does not match constraint: typeof ${C}`)}else if(A(C)){try{if(I instanceof C)return}catch(U){}if(!ee(I)&&I.constructor===C||C.length===1&&C.call(void 0,I)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function y(I){let C=[],U=Object.getPrototypeOf(I);for(;Object.prototype!==U;)C=C.concat(Object.getOwnPropertyNames(U)),U=Object.getPrototypeOf(U);return C}function x(I){const C=[];for(const U of y(I))typeof I[U]=="function"&&C.push(U);return C}function M(I,C){const U=J=>function(){const he=Array.prototype.slice.call(arguments,0);return C(J,he)};let H={};for(const J of I)H[J]=U(J);return H}function F(I){return I===null?void 0:I}function z(I,C="Unreachable"){throw new Error(C)}},13268:function(Ut,at,O){"use strict";O.d(at,{N:function(){return re}});function N(De,ne){let $;return ne.length===0?$=De:$=De.replace(/\{(\d+)\}/g,function(g,ue){const ee=ue[0];return typeof ne[ee]!="undefined"?ne[ee]:g}),$}function re(De,ne,...$){return N(ne,$)}},96236:function(Ut,at,O){"use strict";O.d(at,{BH:function(){return M},NZ:function(){return F},U8:function(){return z},co:function(){return x},eH:function(){return y},vr:function(){return m}});var N=O(75918),re=O(52615),De=O(4348),ne=O(88226),$=O(69323),g=O(34502),ue=O(35884),ee=O(90689),l=O(16925),j=O(49055),A=function(I,C,U,H){var J=arguments.length,he=J<3?C:H===null?H=Object.getOwnPropertyDescriptor(C,U):H,X;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")he=Reflect.decorate(I,C,U,H);else for(var oe=I.length-1;oe>=0;oe--)(X=I[oe])&&(he=(J<3?X(he):J>3?X(C,U,he):X(C,U))||he);return J>3&&he&&Object.defineProperty(C,U,he),he},p=function(I,C){return function(U,H){C(U,H,I)}};function m(I){return I.command!==void 0}class y{constructor(C){this.id=y._idPool++,this._debugName=C}}y._idPool=0,y.CommandPalette=new y("CommandPalette"),y.EditorContext=new y("EditorContext"),y.SimpleEditorContext=new y("SimpleEditorContext"),y.EditorContextCopy=new y("EditorContextCopy"),y.EditorContextPeek=new y("EditorContextPeek"),y.MenubarEditMenu=new y("MenubarEditMenu"),y.MenubarCopy=new y("MenubarCopy"),y.MenubarGoMenu=new y("MenubarGoMenu"),y.MenubarSelectionMenu=new y("MenubarSelectionMenu"),y.InlineCompletionsActions=new y("InlineCompletionsActions");const x=(0,l.yh)("menuService"),M=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new De.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:I=>I===y.CommandPalette}}addCommand(I){return this.addCommands(ne.$.single(I))}addCommands(I){for(const C of I)this._commands.set(C.id,C);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,$.OF)(()=>{let C=!1;for(const U of I)C=this._commands.delete(U.id)||C;C&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(I){return this._commands.get(I)}getCommands(){const I=new Map;return this._commands.forEach((C,U)=>I.set(U,C)),I}appendMenuItem(I,C){return this.appendMenuItems(ne.$.single({id:I,item:C}))}appendMenuItems(I){const C=new Set,U=new g.S;for(const{id:H,item:J}of I){let he=this._menuItems.get(H);he||(he=new g.S,this._menuItems.set(H,he)),U.push(he.push(J)),C.add(H)}return this._onDidChangeMenu.fire(C),(0,$.OF)(()=>{if(U.size>0){for(let H of U)H();this._onDidChangeMenu.fire(C),U.clear()}})}getMenuItems(I){let C;return this._menuItems.has(I)?C=[...this._menuItems.get(I)]:C=[],I===y.CommandPalette&&this._appendImplicitItems(C),C}_appendImplicitItems(I){const C=new Set;for(const U of I)m(U)&&(C.add(U.command.id),U.alt&&C.add(U.alt.id));this._commands.forEach((U,H)=>{C.has(H)||I.push({command:U})})}};class F extends N.wY{constructor(C,U,H,J){super(`submenuitem.${C.submenu.id}`,typeof C.title=="string"?C.title:C.title.value,[],"submenu"),this.item=C,this._menuService=U,this._contextKeyService=H,this._options=J}get actions(){const C=[],U=this._menuService.createMenu(this.item.submenu,this._contextKeyService),H=U.getActions(this._options);U.dispose();for(const[,J]of H)J.length>0&&(C.push(...J),C.push(new N.Z0));return C.length&&C.pop(),C}}let z=class gl{constructor(C,U,H,J,he){var X,oe;if(this._commandService=he,this.id=C.id,this.label=H!=null&&H.renderShortTitle&&C.shortTitle?typeof C.shortTitle=="string"?C.shortTitle:C.shortTitle.value:typeof C.title=="string"?C.title:C.title.value,this.tooltip=(oe=typeof C.tooltip=="string"?C.tooltip:(X=C.tooltip)===null||X===void 0?void 0:X.value)!==null&&oe!==void 0?oe:"",this.enabled=!C.precondition||J.contextMatchesRules(C.precondition),this.checked=void 0,C.toggled){const _e=C.toggled.condition?C.toggled:{condition:C.toggled};this.checked=J.contextMatchesRules(_e.condition),this.checked&&_e.tooltip&&(this.tooltip=typeof _e.tooltip=="string"?_e.tooltip:_e.tooltip.value),_e.title&&(this.label=typeof _e.title=="string"?_e.title:_e.title.value)}this.item=C,this.alt=U?new gl(U,void 0,H,J,he):void 0,this._options=H,j.kS.isThemeIcon(C.icon)&&(this.class=re.dT.asClassName(C.icon))}dispose(){}run(...C){var U,H;let J=[];return!((U=this._options)===null||U===void 0)&&U.arg&&(J=[...J,this._options.arg]),!((H=this._options)===null||H===void 0)&&H.shouldForwardArgs&&(J=[...J,...C]),this._commandService.executeCommand(this.id,...J)}};z=A([p(3,ee.i6),p(4,ue.H)],z)},35884:function(Ut,at,O){"use strict";O.d(at,{H:function(){return ue},P:function(){return ee}});var N=O(4348),re=O(88226),De=O(69323),ne=O(34502),$=O(72999),g=O(16925);const ue=(0,g.yh)("commandService"),ee=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new N.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(l,j){if(!l)throw new Error("invalid command");if(typeof l=="string"){if(!j)throw new Error("invalid command");return this.registerCommand({id:l,handler:j})}if(l.description){const x=[];for(let F of l.description.args)x.push(F.constraint);const M=l.handler;l.handler=function(F,...z){return(0,$.D8)(z,x),M(F,...z)}}const{id:A}=l;let p=this._commands.get(A);p||(p=new ne.S,this._commands.set(A,p));let m=p.unshift(l),y=(0,De.OF)(()=>{m();const x=this._commands.get(A);x!=null&&x.isEmpty()&&this._commands.delete(A)});return this._onDidRegisterCommand.fire(A),y}registerCommandAlias(l,j){return ee.registerCommand(l,(A,...p)=>A.get(ue).executeCommand(j,...p))}getCommand(l){const j=this._commands.get(l);if(!(!j||j.isEmpty()))return re.$.first(j)}getCommands(){const l=new Map;for(const j of this._commands.keys()){const A=this.getCommand(j);A&&l.set(j,A)}return l}};ee.registerCommand("noop",()=>{})},90689:function(Ut,at,O){"use strict";O.d(at,{Ao:function(){return ue},Eq:function(){return k},Fb:function(){return ee},K8:function(){return P},i6:function(){return ze},uy:function(){return ie}});var N=O(23345),re=O(82983),De=O(16925);let ne=N.WE||"";const $=new Map;$.set("false",!1),$.set("true",!0),$.set("isMac",N.dz),$.set("isLinux",N.IJ),$.set("isWindows",N.ED),$.set("isWeb",N.$L),$.set("isMacNative",N.dz&&!N.$L),$.set("isEdge",ne.indexOf("Edg/")>=0),$.set("isFirefox",ne.indexOf("Firefox")>=0),$.set("isChrome",ne.indexOf("Chrome")>=0),$.set("isSafari",ne.indexOf("Safari")>=0);const g=Object.prototype.hasOwnProperty;class ue{static has(_){return p.create(_)}static equals(_,v){return m.create(_,v)}static regex(_,v){return J.create(_,v)}static not(_){return F.create(_)}static and(..._){return oe.create(_,null)}static or(..._){return _e.create(_,null,!0)}static deserialize(_,v=!1){if(_)return this._deserializeOrExpression(_,v)}static _deserializeOrExpression(_,v){let D=_.split("||");return _e.create(D.map(Z=>this._deserializeAndExpression(Z,v)),null,!0)}static _deserializeAndExpression(_,v){let D=_.split("&&");return oe.create(D.map(Z=>this._deserializeOne(Z,v)),null)}static _deserializeOne(_,v){if(_=_.trim(),_.indexOf("!=")>=0){let D=_.split("!=");return M.create(D[0].trim(),this._deserializeValue(D[1],v))}if(_.indexOf("==")>=0){let D=_.split("==");return m.create(D[0].trim(),this._deserializeValue(D[1],v))}if(_.indexOf("=~")>=0){let D=_.split("=~");return J.create(D[0].trim(),this._deserializeRegexValue(D[1],v))}if(_.indexOf(" in ")>=0){let D=_.split(" in ");return y.create(D[0].trim(),D[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(_)){const D=_.split(">=");return C.create(D[0].trim(),D[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(_)){const D=_.split(">");return I.create(D[0].trim(),D[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(_)){const D=_.split("<=");return H.create(D[0].trim(),D[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(_)){const D=_.split("<");return U.create(D[0].trim(),D[1].trim())}return/^\!\s*/.test(_)?F.create(_.substr(1).trim()):p.create(_)}static _deserializeValue(_,v){if(_=_.trim(),_==="true")return!0;if(_==="false")return!1;let D=/^'([^']*)'$/.exec(_);return D?D[1].trim():_}static _deserializeRegexValue(_,v){if((0,re.m5)(_)){if(v)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let D=_.indexOf("/"),Z=_.lastIndexOf("/");if(D===Z||D<0){if(v)throw new Error(`bad regexp-value '${_}', missing /-enclosure`);return console.warn(`bad regexp-value '${_}', missing /-enclosure`),null}let fe=_.slice(D+1,Z),ye=_[Z+1]==="i"?"i":"";try{return new RegExp(fe,ye)}catch(Oe){if(v)throw new Error(`bad regexp-value '${_}', parse error: ${Oe}`);return console.warn(`bad regexp-value '${_}', parse error: ${Oe}`),null}}}function ee(K,_){const v=K?K.substituteConstants():void 0,D=_?_.substituteConstants():void 0;return!v&&!D?!0:!v||!D?!1:v.equals(D)}function l(K,_){return K.cmp(_)}class j{constructor(){this.type=0}cmp(_){return this.type-_.type}equals(_){return _.type===this.type}substituteConstants(){return this}evaluate(_){return!1}serialize(){return"false"}keys(){return[]}negate(){return A.INSTANCE}}j.INSTANCE=new j;class A{constructor(){this.type=1}cmp(_){return this.type-_.type}equals(_){return _.type===this.type}substituteConstants(){return this}evaluate(_){return!0}serialize(){return"true"}keys(){return[]}negate(){return j.INSTANCE}}A.INSTANCE=new A;class p{constructor(_,v){this.key=_,this.negated=v,this.type=2}static create(_,v=null){const D=$.get(_);return typeof D=="boolean"?D?A.INSTANCE:j.INSTANCE:new p(_,v)}cmp(_){return _.type!==this.type?this.type-_.type:S(this.key,_.key)}equals(_){return _.type===this.type?this.key===_.key:!1}substituteConstants(){const _=$.get(this.key);return typeof _=="boolean"?_?A.INSTANCE:j.INSTANCE:this}evaluate(_){return!!_.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=F.create(this.key,this)),this.negated}}class m{constructor(_,v,D){this.key=_,this.value=v,this.negated=D,this.type=4}static create(_,v,D=null){if(typeof v=="boolean")return v?p.create(_,D):F.create(_,D);const Z=$.get(_);return typeof Z=="boolean"?v===(Z?"true":"false")?A.INSTANCE:j.INSTANCE:new m(_,v,D)}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){const _=$.get(this.key);if(typeof _=="boolean"){const v=_?"true":"false";return this.value===v?A.INSTANCE:j.INSTANCE}return this}evaluate(_){return _.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=M.create(this.key,this.value,this)),this.negated}}class y{constructor(_,v){this.key=_,this.valueKey=v,this.type=10,this.negated=null}static create(_,v){return new y(_,v)}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,this.valueKey,_.key,_.valueKey)}equals(_){return _.type===this.type?this.key===_.key&&this.valueKey===_.valueKey:!1}substituteConstants(){return this}evaluate(_){const v=_.getValue(this.valueKey),D=_.getValue(this.key);return Array.isArray(v)?v.indexOf(D)>=0:typeof D=="string"&&typeof v=="object"&&v!==null?g.call(v,D):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=x.create(this)),this.negated}}class x{constructor(_){this._actual=_,this.type=11}static create(_){return new x(_)}cmp(_){return _.type!==this.type?this.type-_.type:this._actual.cmp(_._actual)}equals(_){return _.type===this.type?this._actual.equals(_._actual):!1}substituteConstants(){return this}evaluate(_){return!this._actual.evaluate(_)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class M{constructor(_,v,D){this.key=_,this.value=v,this.negated=D,this.type=5}static create(_,v,D=null){if(typeof v=="boolean")return v?F.create(_,D):p.create(_,D);const Z=$.get(_);return typeof Z=="boolean"?v===(Z?"true":"false")?j.INSTANCE:A.INSTANCE:new M(_,v,D)}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){const _=$.get(this.key);if(typeof _=="boolean"){const v=_?"true":"false";return this.value===v?j.INSTANCE:A.INSTANCE}return this}evaluate(_){return _.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=m.create(this.key,this.value,this)),this.negated}}class F{constructor(_,v){this.key=_,this.negated=v,this.type=3}static create(_,v=null){const D=$.get(_);return typeof D=="boolean"?D?j.INSTANCE:A.INSTANCE:new F(_,v)}cmp(_){return _.type!==this.type?this.type-_.type:S(this.key,_.key)}equals(_){return _.type===this.type?this.key===_.key:!1}substituteConstants(){const _=$.get(this.key);return typeof _=="boolean"?_?j.INSTANCE:A.INSTANCE:this}evaluate(_){return!_.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 z(K,_){if(typeof K=="string"){const v=parseFloat(K);isNaN(v)||(K=v)}return typeof K=="string"||typeof K=="number"?_(K):j.INSTANCE}class I{constructor(_,v,D){this.key=_,this.value=v,this.negated=D,this.type=12}static create(_,v,D=null){return z(v,Z=>new I(_,Z,D))}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=H.create(this.key,this.value,this)),this.negated}}class C{constructor(_,v,D){this.key=_,this.value=v,this.negated=D,this.type=13}static create(_,v,D=null){return z(v,Z=>new C(_,Z,D))}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=U.create(this.key,this.value,this)),this.negated}}class U{constructor(_,v,D){this.key=_,this.value=v,this.negated=D,this.type=14}static create(_,v,D=null){return z(v,Z=>new U(_,Z,D))}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=C.create(this.key,this.value,this)),this.negated}}class H{constructor(_,v,D){this.key=_,this.value=v,this.negated=D,this.type=15}static create(_,v,D=null){return z(v,Z=>new H(_,Z,D))}cmp(_){return _.type!==this.type?this.type-_.type:w(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=I.create(this.key,this.value,this)),this.negated}}class J{constructor(_,v){this.key=_,this.regexp=v,this.type=7,this.negated=null}static create(_,v){return new J(_,v)}cmp(_){if(_.type!==this.type)return this.type-_.type;if(this.key<_.key)return-1;if(this.key>_.key)return 1;const v=this.regexp?this.regexp.source:"",D=_.regexp?_.regexp.source:"";return v<D?-1:v>D?1:0}equals(_){if(_.type===this.type){const v=this.regexp?this.regexp.source:"",D=_.regexp?_.regexp.source:"";return this.key===_.key&&v===D}return!1}substituteConstants(){return this}evaluate(_){let v=_.getValue(this.key);return this.regexp?this.regexp.test(v):!1}serialize(){const _=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${_}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=he.create(this)),this.negated}}class he{constructor(_){this._actual=_,this.type=8}static create(_){return new he(_)}cmp(_){return _.type!==this.type?this.type-_.type:this._actual.cmp(_._actual)}equals(_){return _.type===this.type?this._actual.equals(_._actual):!1}substituteConstants(){return this}evaluate(_){return!this._actual.evaluate(_)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function X(K){let _=null;for(let v=0,D=K.length;v<D;v++){const Z=K[v].substituteConstants();if(K[v]!==Z&&_===null){_=[];for(let fe=0;fe<v;fe++)_[fe]=K[fe]}_!==null&&(_[v]=Z)}return _===null?K:_}class oe{constructor(_,v){this.expr=_,this.negated=v,this.type=6}static create(_,v){return oe._normalizeArr(_,v)}cmp(_){if(_.type!==this.type)return this.type-_.type;if(this.expr.length<_.expr.length)return-1;if(this.expr.length>_.expr.length)return 1;for(let v=0,D=this.expr.length;v<D;v++){const Z=l(this.expr[v],_.expr[v]);if(Z!==0)return Z}return 0}equals(_){if(_.type===this.type){if(this.expr.length!==_.expr.length)return!1;for(let v=0,D=this.expr.length;v<D;v++)if(!this.expr[v].equals(_.expr[v]))return!1;return!0}return!1}substituteConstants(){const _=X(this.expr);return _===this.expr?this:oe.create(_,this.negated)}evaluate(_){for(let v=0,D=this.expr.length;v<D;v++)if(!this.expr[v].evaluate(_))return!1;return!0}static _normalizeArr(_,v){const D=[];let Z=!1;for(const fe of _)if(fe){if(fe.type===1){Z=!0;continue}if(fe.type===0)return j.INSTANCE;if(fe.type===6){D.push(...fe.expr);continue}D.push(fe)}if(D.length===0&&Z)return A.INSTANCE;if(D.length!==0){if(D.length===1)return D[0];D.sort(l);for(let fe=1;fe<D.length;fe++)D[fe-1].equals(D[fe])&&(D.splice(fe,1),fe--);if(D.length===1)return D[0];for(;D.length>1;){const fe=D[D.length-1];if(fe.type!==9)break;D.pop();const ye=D.pop(),Oe=D.length===0,Ne=_e.create(fe.expr.map(ve=>oe.create([ve,ye],null)),null,Oe);Ne&&(D.push(Ne),D.sort(l))}return D.length===1?D[0]:new oe(D,v)}}serialize(){return this.expr.map(_=>_.serialize()).join(" && ")}keys(){const _=[];for(let v of this.expr)_.push(...v.keys());return _}negate(){if(!this.negated){const _=[];for(let v of this.expr)_.push(v.negate());this.negated=_e.create(_,this,!0)}return this.negated}}class _e{constructor(_,v){this.expr=_,this.negated=v,this.type=9}static create(_,v,D){return _e._normalizeArr(_,v,D)}cmp(_){if(_.type!==this.type)return this.type-_.type;if(this.expr.length<_.expr.length)return-1;if(this.expr.length>_.expr.length)return 1;for(let v=0,D=this.expr.length;v<D;v++){const Z=l(this.expr[v],_.expr[v]);if(Z!==0)return Z}return 0}equals(_){if(_.type===this.type){if(this.expr.length!==_.expr.length)return!1;for(let v=0,D=this.expr.length;v<D;v++)if(!this.expr[v].equals(_.expr[v]))return!1;return!0}return!1}substituteConstants(){const _=X(this.expr);return _===this.expr?this:_e.create(_,this.negated,!1)}evaluate(_){for(let v=0,D=this.expr.length;v<D;v++)if(this.expr[v].evaluate(_))return!0;return!1}static _normalizeArr(_,v,D){let Z=[],fe=!1;if(_){for(let ye=0,Oe=_.length;ye<Oe;ye++){const Ne=_[ye];if(Ne){if(Ne.type===0){fe=!0;continue}if(Ne.type===1)return A.INSTANCE;if(Ne.type===9){Z=Z.concat(Ne.expr);continue}Z.push(Ne)}}if(Z.length===0&&fe)return j.INSTANCE;Z.sort(l)}if(Z.length!==0){if(Z.length===1)return Z[0];for(let ye=1;ye<Z.length;ye++)Z[ye-1].equals(Z[ye])&&(Z.splice(ye,1),ye--);if(Z.length===1)return Z[0];if(D){for(let ye=0;ye<Z.length;ye++)for(let Oe=ye+1;Oe<Z.length;Oe++)P(Z[ye],Z[Oe])&&(Z.splice(Oe,1),Oe--);if(Z.length===1)return Z[0]}return new _e(Z,v)}}serialize(){return this.expr.map(_=>_.serialize()).join(" || ")}keys(){const _=[];for(let v of this.expr)_.push(...v.keys());return _}negate(){if(!this.negated){let _=[];for(let v of this.expr)_.push(v.negate());for(;_.length>1;){const v=_.shift(),D=_.shift(),Z=[];for(const ye of W(v))for(const Oe of W(D))Z.push(oe.create([ye,Oe],null));const fe=_.length===0;_.unshift(_e.create(Z,null,fe))}this.negated=_[0]}return this.negated}}class ie extends p{constructor(_,v,D){super(_,null),this._defaultValue=v,typeof D=="object"?ie._info.push(Object.assign(Object.assign({},D),{key:_})):D!==!0&&ie._info.push({key:_,description:D,type:v!=null?typeof v:void 0})}static all(){return ie._info.values()}bindTo(_){return _.createKey(this.key,this._defaultValue)}getValue(_){return _.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(_){return m.create(this.key,_)}}ie._info=[];const ze=(0,De.yh)("contextKeyService"),k="setContext";function S(K,_){return K<_?-1:K>_?1:0}function w(K,_,v,D){return K<v?-1:K>v?1:_<D?-1:_>D?1:0}function P(K,_){if(_.type===6&&K.type!==9&&K.type!==6){for(const Z of _.expr)if(K.equals(Z))return!0}const v=K.negate(),D=W(v).concat(W(_));D.sort(l);for(let Z=0;Z<D.length;Z++){const ye=D[Z].negate();for(let Oe=Z+1;Oe<D.length;Oe++){const Ne=D[Oe];if(ye.equals(Ne))return!0}}return!1}function W(K){return K.type===9?K.expr:[K]}},16925:function(Ut,at,O){"use strict";O.d(at,{I8:function(){return N},TG:function(){return re},jt:function(){return $},yh:function(){return ne}});var N;(function(g){g.serviceIds=new Map,g.DI_TARGET="$di$target",g.DI_DEPENDENCIES="$di$dependencies";function ue(ee){return ee[g.DI_DEPENDENCIES]||[]}g.getServiceDependencies=ue})(N||(N={}));const re=ne("instantiationService");function De(g,ue,ee,l){ue[N.DI_TARGET]===ue?ue[N.DI_DEPENDENCIES].push({id:g,index:ee,optional:l}):(ue[N.DI_DEPENDENCIES]=[{id:g,index:ee,optional:l}],ue[N.DI_TARGET]=ue)}function ne(g){if(N.serviceIds.has(g))return N.serviceIds.get(g);const ue=function(ee,l,j){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");De(ue,ee,j,!1)};return ue.toString=()=>g,N.serviceIds.set(g,ue),ue}function $(g){return function(ue,ee,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");De(g,ue,l,!0)}}},44650:function(Ut,at,O){"use strict";O.d(at,{B:function(){return ne}});var N=O(76068),re=O(72999);class De{constructor(){this.data=new Map}add(g,ue){N.ok(re.HD(g)),N.ok(re.Kn(ue)),N.ok(!this.data.has(g),"There is already an extension with this id"),this.data.set(g,ue)}as(g){return this.data.get(g)||null}}const ne=new De},66213:function(Ut,at,O){"use strict";O.d(at,{e:function(){return N}});var N;(function(re){re.DARK="dark",re.LIGHT="light",re.HIGH_CONTRAST="hc"})(N||(N={}))},49055:function(Ut,at,O){"use strict";O.d(at,{EN:function(){return l},IP:function(){return p},Ic:function(){return x},XE:function(){return ue},bB:function(){return M},kS:function(){return j},m6:function(){return A}});var N=O(52615),re=O(4348),De=O(69323),ne=O(16925),$=O(44650),g=O(66213);const ue=(0,ne.yh)("themeService");var ee;(function(F){function z(I){return I&&typeof I=="object"&&typeof I.id=="string"}F.isThemeColor=z})(ee||(ee={}));function l(F){return{id:F}}var j;(function(F){function z(he){return he&&typeof he=="object"&&typeof he.id=="string"&&(typeof he.color=="undefined"||ee.isThemeColor(he.color))}F.isThemeIcon=z;const I=new RegExp(`^\\$\\((${N.dT.iconNameExpression}(?:${N.dT.iconModifierExpression})?)\\)$`);function C(he){const X=I.exec(he);if(!X)return;let[,oe]=X;return{id:oe}}F.fromString=C;function U(he,X){let oe=he.id;const _e=oe.lastIndexOf("~");return _e!==-1&&(oe=oe.substring(0,_e)),X&&(oe=`${oe}~${X}`),{id:oe}}F.modify=U;function H(he,X){var oe,_e;return he.id===X.id&&((oe=he.color)===null||oe===void 0?void 0:oe.id)===((_e=X.color)===null||_e===void 0?void 0:_e.id)}F.isEqual=H;function J(he,X){return{id:he.id,color:X?l(X):void 0}}F.asThemeIcon=J,F.asClassNameArray=N.dT.asClassNameArray,F.asClassName=N.dT.asClassName,F.asCSSSelector=N.dT.asCSSSelector})(j||(j={}));function A(F){switch(F){case g.e.DARK:return"vs-dark";case g.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const p={ThemingContribution:"base.contributions.theming"};class m{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new re.Q5}onColorThemeChange(z){return this.themingParticipants.push(z),this.onThemingParticipantAddedEmitter.fire(z),(0,De.OF)(()=>{const I=this.themingParticipants.indexOf(z);this.themingParticipants.splice(I,1)})}getThemingParticipants(){return this.themingParticipants}}let y=new m;$.B.add(p.ThemingContribution,y);function x(F){return y.onColorThemeChange(F)}class M extends De.JT{constructor(z){super(),this.themeService=z,this.theme=z.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(I=>this.onThemeChange(I)))}onThemeChange(z){this.theme=z,this.updateStyles()}updateStyles(){}}},16632:function(Ut,at,O){"use strict";var N=O(32855),re=O(27247),De=O(74430),ne=O(11913),$=O(43079),g=O(92310),ue=O.n(g),ee=O(18929),l=O(59301),j=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],A=(0,l.forwardRef)(function(p,m){var y=p.prefixCls,x=y===void 0?"rc-checkbox":y,M=p.className,F=p.style,z=p.checked,I=p.disabled,C=p.defaultChecked,U=C===void 0?!1:C,H=p.type,J=H===void 0?"checkbox":H,he=p.title,X=p.onChange,oe=(0,$.Z)(p,j),_e=(0,l.useRef)(null),ie=(0,l.useRef)(null),ze=(0,ee.Z)(U,{value:z}),k=(0,ne.Z)(ze,2),S=k[0],w=k[1];(0,l.useImperativeHandle)(m,function(){return{focus:function(_){var v;(v=_e.current)===null||v===void 0||v.focus(_)},blur:function(){var _;(_=_e.current)===null||_===void 0||_.blur()},input:_e.current,nativeElement:ie.current}});var P=ue()(x,M,(0,De.Z)((0,De.Z)({},"".concat(x,"-checked"),S),"".concat(x,"-disabled"),I)),W=function(_){I||("checked"in p||w(_.target.checked),X==null||X({target:(0,re.Z)((0,re.Z)({},p),{},{type:J,checked:_.target.checked}),stopPropagation:function(){_.stopPropagation()},preventDefault:function(){_.preventDefault()},nativeEvent:_.nativeEvent}))};return l.createElement("span",{className:P,title:he,style:F,ref:ie},l.createElement("input",(0,N.Z)({},oe,{className:"".concat(x,"-input"),ref:_e,onChange:W,disabled:I,checked:!!S,type:J})),l.createElement("span",{className:"".concat(x,"-inner")}))});at.Z=A},66003:function(Ut,at,O){"use strict";O.d(at,{Z:function(){return ue}});var N=O(43079),re=O(27247),De=O(34666),ne=O(59301),$=["show"];function g(ee,l){if(!l.max)return!0;var j=l.strategy(ee);return j<=l.max}function ue(ee,l){return ne.useMemo(function(){var j={};l&&(j.show=(0,De.Z)(l)==="object"&&l.formatter?l.formatter:!!l),j=(0,re.Z)((0,re.Z)({},j),ee);var A=j,p=A.show,m=(0,N.Z)(A,$);return(0,re.Z)((0,re.Z)({},m),{},{show:!!p,showFormatter:typeof p=="function"?p:void 0,strategy:m.strategy||function(y){return y.length}})},[ee,l])}},36901:function(Ut,at,O){"use strict";O.r(at),O.d(at,{BaseInput:function(){return j},default:function(){return C}});var N=O(27247),re=O(32855),De=O(74430),ne=O(34666),$=O(92310),g=O.n($),ue=O(59301),ee=O(30292),l=ue.forwardRef(function(U,H){var J,he,X,oe=U.inputElement,_e=U.children,ie=U.prefixCls,ze=U.prefix,k=U.suffix,S=U.addonBefore,w=U.addonAfter,P=U.className,W=U.style,K=U.disabled,_=U.readOnly,v=U.focused,D=U.triggerFocus,Z=U.allowClear,fe=U.value,ye=U.handleReset,Oe=U.hidden,Ne=U.classes,ve=U.classNames,Me=U.dataAttrs,Ae=U.styles,dt=U.components,Ce=U.onClear,rt=_e!=null?_e:oe,Pe=(dt==null?void 0:dt.affixWrapper)||"span",ut=(dt==null?void 0:dt.groupWrapper)||"span",ce=(dt==null?void 0:dt.wrapper)||"span",le=(dt==null?void 0:dt.groupAddon)||"span",Y=(0,ue.useRef)(null),Te=function(ct){var Xe;(Xe=Y.current)!==null&&Xe!==void 0&&Xe.contains(ct.target)&&(D==null||D())},ke=(0,ee.X3)(U),Ke=(0,ue.cloneElement)(rt,{value:fe,className:g()((J=rt.props)===null||J===void 0?void 0:J.className,!ke&&(ve==null?void 0:ve.variant))||null}),G=(0,ue.useRef)(null);if(ue.useImperativeHandle(H,function(){return{nativeElement:G.current||Y.current}}),ke){var q=null;if(Z){var me=!K&&!_&&fe,we="".concat(ie,"-clear-icon"),Le=(0,ne.Z)(Z)==="object"&&Z!==null&&Z!==void 0&&Z.clearIcon?Z.clearIcon:"\u2716";q=ue.createElement("button",{type:"button",tabIndex:-1,onClick:function(ct){ye==null||ye(ct),Ce==null||Ce()},onMouseDown:function(ct){return ct.preventDefault()},className:g()(we,(0,De.Z)((0,De.Z)({},"".concat(we,"-hidden"),!me),"".concat(we,"-has-suffix"),!!k))},Le)}var $e="".concat(ie,"-affix-wrapper"),yt=g()($e,(0,De.Z)((0,De.Z)((0,De.Z)((0,De.Z)((0,De.Z)({},"".concat(ie,"-disabled"),K),"".concat($e,"-disabled"),K),"".concat($e,"-focused"),v),"".concat($e,"-readonly"),_),"".concat($e,"-input-with-clear-btn"),k&&Z&&fe),Ne==null?void 0:Ne.affixWrapper,ve==null?void 0:ve.affixWrapper,ve==null?void 0:ve.variant),Qe=(k||Z)&&ue.createElement("span",{className:g()("".concat(ie,"-suffix"),ve==null?void 0:ve.suffix),style:Ae==null?void 0:Ae.suffix},q,k);Ke=ue.createElement(Pe,(0,re.Z)({className:yt,style:Ae==null?void 0:Ae.affixWrapper,onClick:Te},Me==null?void 0:Me.affixWrapper,{ref:Y}),ze&&ue.createElement("span",{className:g()("".concat(ie,"-prefix"),ve==null?void 0:ve.prefix),style:Ae==null?void 0:Ae.prefix},ze),Ke,Qe)}if((0,ee.He)(U)){var et="".concat(ie,"-group"),Ve="".concat(et,"-addon"),He="".concat(et,"-wrapper"),_t=g()("".concat(ie,"-wrapper"),et,Ne==null?void 0:Ne.wrapper,ve==null?void 0:ve.wrapper),ht=g()(He,(0,De.Z)({},"".concat(He,"-disabled"),K),Ne==null?void 0:Ne.group,ve==null?void 0:ve.groupWrapper);Ke=ue.createElement(ut,{className:ht,ref:G},ue.createElement(ce,{className:_t},S&&ue.createElement(le,{className:Ve},S),Ke,w&&ue.createElement(le,{className:Ve},w)))}return ue.cloneElement(Ke,{className:g()((he=Ke.props)===null||he===void 0?void 0:he.className,P)||null,style:(0,N.Z)((0,N.Z)({},(X=Ke.props)===null||X===void 0?void 0:X.style),W),hidden:Oe})}),j=l,A=O(3300),p=O(11913),m=O(43079),y=O(18929),x=O(2738),M=O(66003),F=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],z=(0,ue.forwardRef)(function(U,H){var J=U.autoComplete,he=U.onChange,X=U.onFocus,oe=U.onBlur,_e=U.onPressEnter,ie=U.onKeyDown,ze=U.onKeyUp,k=U.prefixCls,S=k===void 0?"rc-input":k,w=U.disabled,P=U.htmlSize,W=U.className,K=U.maxLength,_=U.suffix,v=U.showCount,D=U.count,Z=U.type,fe=Z===void 0?"text":Z,ye=U.classes,Oe=U.classNames,Ne=U.styles,ve=U.onCompositionStart,Me=U.onCompositionEnd,Ae=(0,m.Z)(U,F),dt=(0,ue.useState)(!1),Ce=(0,p.Z)(dt,2),rt=Ce[0],Pe=Ce[1],ut=(0,ue.useRef)(!1),ce=(0,ue.useRef)(!1),le=(0,ue.useRef)(null),Y=(0,ue.useRef)(null),Te=function(bt){le.current&&(0,ee.nH)(le.current,bt)},ke=(0,y.Z)(U.defaultValue,{value:U.value}),Ke=(0,p.Z)(ke,2),G=Ke[0],q=Ke[1],me=G==null?"":String(G),we=(0,ue.useState)(null),Le=(0,p.Z)(we,2),$e=Le[0],yt=Le[1],Qe=(0,M.Z)(D,v),et=Qe.max||K,Ve=Qe.strategy(me),He=!!et&&Ve>et;(0,ue.useImperativeHandle)(H,function(){var ot;return{focus:Te,blur:function(){var Ee;(Ee=le.current)===null||Ee===void 0||Ee.blur()},setSelectionRange:function(Ee,pe,ge){var L;(L=le.current)===null||L===void 0||L.setSelectionRange(Ee,pe,ge)},select:function(){var Ee;(Ee=le.current)===null||Ee===void 0||Ee.select()},input:le.current,nativeElement:((ot=Y.current)===null||ot===void 0?void 0:ot.nativeElement)||le.current}}),(0,ue.useEffect)(function(){ce.current&&(ce.current=!1),Pe(function(ot){return ot&&w?!1:ot})},[w]);var _t=function(bt,Ee,pe){var ge=Ee;if(!ut.current&&Qe.exceedFormatter&&Qe.max&&Qe.strategy(Ee)>Qe.max){if(ge=Qe.exceedFormatter(Ee,{max:Qe.max}),Ee!==ge){var L,B;yt([((L=le.current)===null||L===void 0?void 0:L.selectionStart)||0,((B=le.current)===null||B===void 0?void 0:B.selectionEnd)||0])}}else if(pe.source==="compositionEnd")return;q(ge),le.current&&(0,ee.rJ)(le.current,bt,he,ge)};(0,ue.useEffect)(function(){if($e){var ot;(ot=le.current)===null||ot===void 0||ot.setSelectionRange.apply(ot,(0,A.Z)($e))}},[$e]);var ht=function(bt){_t(bt,bt.target.value,{source:"change"})},xe=function(bt){ut.current=!1,_t(bt,bt.currentTarget.value,{source:"compositionEnd"}),Me==null||Me(bt)},ct=function(bt){_e&&bt.key==="Enter"&&!ce.current&&(ce.current=!0,_e(bt)),ie==null||ie(bt)},Xe=function(bt){bt.key==="Enter"&&(ce.current=!1),ze==null||ze(bt)},We=function(bt){Pe(!0),X==null||X(bt)},Et=function(bt){ce.current&&(ce.current=!1),Pe(!1),oe==null||oe(bt)},St=function(bt){q(""),Te(),le.current&&(0,ee.rJ)(le.current,bt,he)},mt=He&&"".concat(S,"-out-of-range"),st=function(){var bt=(0,x.Z)(U,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return ue.createElement("input",(0,re.Z)({autoComplete:J},bt,{onChange:ht,onFocus:We,onBlur:Et,onKeyDown:ct,onKeyUp:Xe,className:g()(S,(0,De.Z)({},"".concat(S,"-disabled"),w),Oe==null?void 0:Oe.input),style:Ne==null?void 0:Ne.input,ref:le,size:P,type:fe,onCompositionStart:function(pe){ut.current=!0,ve==null||ve(pe)},onCompositionEnd:xe}))},Pt=function(){var bt=Number(et)>0;if(_||Qe.show){var Ee=Qe.showFormatter?Qe.showFormatter({value:me,count:Ve,maxLength:et}):"".concat(Ve).concat(bt?" / ".concat(et):"");return ue.createElement(ue.Fragment,null,Qe.show&&ue.createElement("span",{className:g()("".concat(S,"-show-count-suffix"),(0,De.Z)({},"".concat(S,"-show-count-has-suffix"),!!_),Oe==null?void 0:Oe.count),style:(0,N.Z)({},Ne==null?void 0:Ne.count)},Ee),_)}return null};return ue.createElement(j,(0,re.Z)({},Ae,{prefixCls:S,className:g()(W,mt),handleReset:St,value:me,focused:rt,triggerFocus:Te,suffix:Pt(),disabled:w,classes:ye,classNames:Oe,styles:Ne}),st())}),I=z,C=I},30292:function(Ut,at,O){"use strict";O.d(at,{He:function(){return N},X3:function(){return re},nH:function(){return $},rJ:function(){return ne}});function N(g){return!!(g.addonBefore||g.addonAfter)}function re(g){return!!(g.prefix||g.suffix||g.allowClear)}function De(g,ue,ee){var l=ue.cloneNode(!0),j=Object.create(g,{target:{value:l},currentTarget:{value:l}});return l.value=ee,typeof ue.selectionStart=="number"&&typeof ue.selectionEnd=="number"&&(l.selectionStart=ue.selectionStart,l.selectionEnd=ue.selectionEnd),l.setSelectionRange=function(){ue.setSelectionRange.apply(ue,arguments)},j}function ne(g,ue,ee,l){if(ee){var j=ue;if(ue.type==="click"){j=De(ue,g,""),ee(j);return}if(g.type!=="file"&&l!==void 0){j=De(ue,g,l),ee(j);return}ee(j)}}function $(g,ue){if(g){g.focus(ue);var ee=ue||{},l=ee.cursor;if(l){var j=g.value.length;switch(l){case"start":g.setSelectionRange(0,0);break;case"end":g.setSelectionRange(j,j);break;default:g.setSelectionRange(0,j)}}}}},28321:function(Ut,at,O){"use strict";O.d(at,{iz:function(){return Tn},ck:function(){return ge},BW:function(){return Vn},sN:function(){return ge},Wd:function(){return jt},ZP:function(){return Ft},Xl:function(){return _e}});var N=O(32855),re=O(74430),De=O(27247),ne=O(3300),$=O(11913),g=O(43079),ue=O(92310),ee=O.n(ue),l=O(11780),j=O(18929),A=O(13697),p=O(48736),m=O(59301),y=O(4676),x=m.createContext(null);function M(be,Ze){return be===void 0?null:"".concat(be,"-").concat(Ze)}function F(be){var Ze=m.useContext(x);return M(Ze,be)}var z=O(80547),I=["children","locked"],C=m.createContext(null);function U(be,Ze){var nt=(0,De.Z)({},be);return Object.keys(Ze).forEach(function(je){var ft=Ze[je];ft!==void 0&&(nt[je]=ft)}),nt}function H(be){var Ze=be.children,nt=be.locked,je=(0,g.Z)(be,I),ft=m.useContext(C),vt=(0,z.Z)(function(){return U(ft,je)},[ft,je],function(xt,Ct){return!nt&&(xt[0]!==Ct[0]||!(0,A.Z)(xt[1],Ct[1],!0))});return m.createElement(C.Provider,{value:vt},Ze)}var J=[],he=m.createContext(null);function X(){return m.useContext(he)}var oe=m.createContext(J);function _e(be){var Ze=m.useContext(oe);return m.useMemo(function(){return be!==void 0?[].concat((0,ne.Z)(Ze),[be]):Ze},[Ze,be])}var ie=m.createContext(null),ze=m.createContext({}),k=ze,S=O(29194);function w(be){var Ze=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,S.Z)(be)){var nt=be.nodeName.toLowerCase(),je=["input","select","textarea","button"].includes(nt)||be.isContentEditable||nt==="a"&&!!be.getAttribute("href"),ft=be.getAttribute("tabindex"),vt=Number(ft),xt=null;return ft&&!Number.isNaN(vt)?xt=vt:je&&xt===null&&(xt=0),je&&be.disabled&&(xt=null),xt!==null&&(xt>=0||Ze&&xt<0)}return!1}function P(be){var Ze=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,nt=(0,ne.Z)(be.querySelectorAll("*")).filter(function(je){return w(je,Ze)});return w(be,Ze)&&nt.unshift(be),nt}var W=null;function K(){W=document.activeElement}function _(){W=null}function v(){if(W)try{W.focus()}catch(be){}}function D(be,Ze){if(Ze.keyCode===9){var nt=P(be),je=nt[Ze.shiftKey?0:nt.length-1],ft=je===document.activeElement||be===document.activeElement;if(ft){var vt=nt[Ze.shiftKey?nt.length-1:0];vt.focus(),Ze.preventDefault()}}}var Z=O(10228),fe=O(16089),ye=Z.Z.LEFT,Oe=Z.Z.RIGHT,Ne=Z.Z.UP,ve=Z.Z.DOWN,Me=Z.Z.ENTER,Ae=Z.Z.ESC,dt=Z.Z.HOME,Ce=Z.Z.END,rt=[Ne,ve,ye,Oe];function Pe(be,Ze,nt,je){var ft,vt="prev",xt="next",Ct="children",cn="parent";if(be==="inline"&&je===Me)return{inlineTrigger:!0};var Yt=(0,re.Z)((0,re.Z)({},Ne,vt),ve,xt),wn=(0,re.Z)((0,re.Z)((0,re.Z)((0,re.Z)({},ye,nt?xt:vt),Oe,nt?vt:xt),ve,Ct),Me,Ct),Jt=(0,re.Z)((0,re.Z)((0,re.Z)((0,re.Z)((0,re.Z)((0,re.Z)({},Ne,vt),ve,xt),Me,Ct),Ae,cn),ye,nt?Ct:cn),Oe,nt?cn:Ct),qt={inline:Yt,horizontal:wn,vertical:Jt,inlineSub:Yt,horizontalSub:Jt,verticalSub:Jt},sn=(ft=qt["".concat(be).concat(Ze?"":"Sub")])===null||ft===void 0?void 0:ft[je];switch(sn){case vt:return{offset:-1,sibling:!0};case xt:return{offset:1,sibling:!0};case cn:return{offset:-1,sibling:!1};case Ct:return{offset:1,sibling:!1};default:return null}}function ut(be){for(var Ze=be;Ze;){if(Ze.getAttribute("data-menu-list"))return Ze;Ze=Ze.parentElement}return null}function ce(be,Ze){for(var nt=be||document.activeElement;nt;){if(Ze.has(nt))return nt;nt=nt.parentElement}return null}function le(be,Ze){var nt=P(be,!0);return nt.filter(function(je){return Ze.has(je)})}function Y(be,Ze,nt){var je=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!be)return null;var ft=le(be,Ze),vt=ft.length,xt=ft.findIndex(function(Ct){return nt===Ct});return je<0?xt===-1?xt=vt-1:xt-=1:je>0&&(xt+=1),xt=(xt+vt)%vt,ft[xt]}var Te=function(Ze,nt){var je=new Set,ft=new Map,vt=new Map;return Ze.forEach(function(xt){var Ct=document.querySelector("[data-menu-id='".concat(M(nt,xt),"']"));Ct&&(je.add(Ct),vt.set(Ct,xt),ft.set(xt,Ct))}),{elements:je,key2element:ft,element2key:vt}};function ke(be,Ze,nt,je,ft,vt,xt,Ct,cn,Yt){var wn=m.useRef(),Jt=m.useRef();Jt.current=Ze;var qt=function(){fe.Z.cancel(wn.current)};return m.useEffect(function(){return function(){qt()}},[]),function(sn){var on=sn.which;if([].concat(rt,[Me,Ae,dt,Ce]).includes(on)){var pn=vt(),Ht=Te(pn,je),Xt=Ht,An=Xt.elements,rn=Xt.key2element,nn=Xt.element2key,Rn=rn.get(Ze),fn=ce(Rn,An),yn=nn.get(fn),Zn=Pe(be,xt(yn,!0).length===1,nt,on);if(!Zn&&on!==dt&&on!==Ce)return;(rt.includes(on)||[dt,Ce].includes(on))&&sn.preventDefault();var Pn=function(Mn){if(Mn){var di=Mn,xn=Mn.querySelector("a");xn!=null&&xn.getAttribute("href")&&(di=xn);var hi=nn.get(Mn);Ct(hi),qt(),wn.current=(0,fe.Z)(function(){Jt.current===hi&&di.focus()})}};if([dt,Ce].includes(on)||Zn.sibling||!fn){var En;!fn||be==="inline"?En=ft.current:En=ut(fn);var bn,Yn=le(En,An);on===dt?bn=Yn[0]:on===Ce?bn=Yn[Yn.length-1]:bn=Y(En,An,fn,Zn.offset),Pn(bn)}else if(Zn.inlineTrigger)cn(yn);else if(Zn.offset>0)cn(yn,!0),qt(),wn.current=(0,fe.Z)(function(){Ht=Te(pn,je);var Jn=fn.getAttribute("aria-controls"),Mn=document.getElementById(Jn),di=Y(Mn,Ht.elements);Pn(di)},5);else if(Zn.offset<0){var Wn=xt(yn,!0),hn=Wn[Wn.length-2],ni=rn.get(hn);cn(hn,!1),Pn(ni)}}Yt==null||Yt(sn)}}function Ke(be){Promise.resolve().then(be)}var G="__RC_UTIL_PATH_SPLIT__",q=function(Ze){return Ze.join(G)},me=function(Ze){return Ze.split(G)},we="rc-menu-more";function Le(){var be=m.useState({}),Ze=(0,$.Z)(be,2),nt=Ze[1],je=(0,m.useRef)(new Map),ft=(0,m.useRef)(new Map),vt=m.useState([]),xt=(0,$.Z)(vt,2),Ct=xt[0],cn=xt[1],Yt=(0,m.useRef)(0),wn=(0,m.useRef)(!1),Jt=function(){wn.current||nt({})},qt=(0,m.useCallback)(function(rn,nn){var Rn=q(nn);ft.current.set(Rn,rn),je.current.set(rn,Rn),Yt.current+=1;var fn=Yt.current;Ke(function(){fn===Yt.current&&Jt()})},[]),sn=(0,m.useCallback)(function(rn,nn){var Rn=q(nn);ft.current.delete(Rn),je.current.delete(rn)},[]),on=(0,m.useCallback)(function(rn){cn(rn)},[]),pn=(0,m.useCallback)(function(rn,nn){var Rn=je.current.get(rn)||"",fn=me(Rn);return nn&&Ct.includes(fn[0])&&fn.unshift(we),fn},[Ct]),Ht=(0,m.useCallback)(function(rn,nn){return rn.filter(function(Rn){return Rn!==void 0}).some(function(Rn){var fn=pn(Rn,!0);return fn.includes(nn)})},[pn]),Xt=function(){var nn=(0,ne.Z)(je.current.keys());return Ct.length&&nn.push(we),nn},An=(0,m.useCallback)(function(rn){var nn="".concat(je.current.get(rn)).concat(G),Rn=new Set;return(0,ne.Z)(ft.current.keys()).forEach(function(fn){fn.startsWith(nn)&&Rn.add(ft.current.get(fn))}),Rn},[]);return m.useEffect(function(){return function(){wn.current=!0}},[]),{registerPath:qt,unregisterPath:sn,refreshOverflowKeys:on,isSubPathKey:Ht,getKeyPath:pn,getKeys:Xt,getSubPathKeys:An}}function $e(be){var Ze=m.useRef(be);Ze.current=be;var nt=m.useCallback(function(){for(var je,ft=arguments.length,vt=new Array(ft),xt=0;xt<ft;xt++)vt[xt]=arguments[xt];return(je=Ze.current)===null||je===void 0?void 0:je.call.apply(je,[Ze].concat(vt))},[]);return be?nt:void 0}var yt=Math.random().toFixed(5).toString().slice(2),Qe=0;function et(be){var Ze=(0,j.Z)(be,{value:be}),nt=(0,$.Z)(Ze,2),je=nt[0],ft=nt[1];return m.useEffect(function(){Qe+=1;var vt="".concat(yt,"-").concat(Qe);ft("rc-menu-uuid-".concat(vt))},[]),je}var Ve=O(33377),He=O(93912),_t=O(18881),ht=O(85461),xe=O(2738),ct=O(8654);function Xe(be,Ze,nt,je){var ft=m.useContext(C),vt=ft.activeKey,xt=ft.onActive,Ct=ft.onInactive,cn={active:vt===be};return Ze||(cn.onMouseEnter=function(Yt){nt==null||nt({key:be,domEvent:Yt}),xt(be)},cn.onMouseLeave=function(Yt){je==null||je({key:be,domEvent:Yt}),Ct(be)}),cn}function We(be){var Ze=m.useContext(C),nt=Ze.mode,je=Ze.rtl,ft=Ze.inlineIndent;if(nt!=="inline")return null;var vt=be;return je?{paddingRight:vt*ft}:{paddingLeft:vt*ft}}function Et(be){var Ze=be.icon,nt=be.props,je=be.children,ft;return Ze===null||Ze===!1?null:(typeof Ze=="function"?ft=m.createElement(Ze,(0,De.Z)({},nt)):typeof Ze!="boolean"&&(ft=Ze),ft||je||null)}var St=["item"];function mt(be){var Ze=be.item,nt=(0,g.Z)(be,St);return Object.defineProperty(nt,"item",{get:function(){return(0,p.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),Ze}}),nt}var st=["title","attribute","elementRef"],Pt=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],ot=["active"],bt=function(be){(0,_t.Z)(nt,be);var Ze=(0,ht.Z)(nt);function nt(){return(0,Ve.Z)(this,nt),Ze.apply(this,arguments)}return(0,He.Z)(nt,[{key:"render",value:function(){var ft=this.props,vt=ft.title,xt=ft.attribute,Ct=ft.elementRef,cn=(0,g.Z)(ft,st),Yt=(0,xe.Z)(cn,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,p.ZP)(!xt,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),m.createElement(l.Z.Item,(0,N.Z)({},xt,{title:typeof vt=="string"?vt:void 0},Yt,{ref:Ct}))}}]),nt}(m.Component),Ee=m.forwardRef(function(be,Ze){var nt=be.style,je=be.className,ft=be.eventKey,vt=be.warnKey,xt=be.disabled,Ct=be.itemIcon,cn=be.children,Yt=be.role,wn=be.onMouseEnter,Jt=be.onMouseLeave,qt=be.onClick,sn=be.onKeyDown,on=be.onFocus,pn=(0,g.Z)(be,Pt),Ht=F(ft),Xt=m.useContext(C),An=Xt.prefixCls,rn=Xt.onItemClick,nn=Xt.disabled,Rn=Xt.overflowDisabled,fn=Xt.itemIcon,yn=Xt.selectedKeys,Zn=Xt.onActive,Pn=m.useContext(k),En=Pn._internalRenderMenuItem,bn="".concat(An,"-item"),Yn=m.useRef(),Wn=m.useRef(),hn=nn||xt,ni=(0,ct.x1)(Ze,Wn),Jn=_e(ft),Mn=function(jn){return{key:ft,keyPath:(0,ne.Z)(Jn).reverse(),item:Yn.current,domEvent:jn}},di=Ct||fn,xn=Xe(ft,hn,wn,Jt),hi=xn.active,Li=(0,g.Z)(xn,ot),Ci=yn.includes(ft),_i=We(Jn.length),ki=function(jn){if(!hn){var fi=Mn(jn);qt==null||qt(mt(fi)),rn(fi)}},oi=function(jn){if(sn==null||sn(jn),jn.which===Z.Z.ENTER){var fi=Mn(jn);qt==null||qt(mt(fi)),rn(fi)}},li=function(jn){Zn(ft),on==null||on(jn)},Pi={};be.role==="option"&&(Pi["aria-selected"]=Ci);var vi=m.createElement(bt,(0,N.Z)({ref:Yn,elementRef:ni,role:Yt===null?"none":Yt||"menuitem",tabIndex:xt?null:-1,"data-menu-id":Rn&&Ht?null:Ht},(0,xe.Z)(pn,["extra"]),Li,Pi,{component:"li","aria-disabled":xt,style:(0,De.Z)((0,De.Z)({},_i),nt),className:ee()(bn,(0,re.Z)((0,re.Z)((0,re.Z)({},"".concat(bn,"-active"),hi),"".concat(bn,"-selected"),Ci),"".concat(bn,"-disabled"),hn),je),onClick:ki,onKeyDown:oi,onFocus:li}),cn,m.createElement(Et,{props:(0,De.Z)((0,De.Z)({},be),{},{isSelected:Ci}),icon:di}));return En&&(vi=En(vi,be,{selected:Ci})),vi});function pe(be,Ze){var nt=be.eventKey,je=X(),ft=_e(nt);return m.useEffect(function(){if(je)return je.registerPath(nt,ft),function(){je.unregisterPath(nt,ft)}},[ft]),je?null:m.createElement(Ee,(0,N.Z)({},be,{ref:Ze}))}var ge=m.forwardRef(pe),L=["className","children"],B=function(Ze,nt){var je=Ze.className,ft=Ze.children,vt=(0,g.Z)(Ze,L),xt=m.useContext(C),Ct=xt.prefixCls,cn=xt.mode,Yt=xt.rtl;return m.createElement("ul",(0,N.Z)({className:ee()(Ct,Yt&&"".concat(Ct,"-rtl"),"".concat(Ct,"-sub"),"".concat(Ct,"-").concat(cn==="inline"?"inline":"vertical"),je),role:"menu"},vt,{"data-menu-list":!0,ref:nt}),ft)},Q=m.forwardRef(B);Q.displayName="SubMenuList";var ae=Q,de=O(11592);function qe(be,Ze){return(0,de.Z)(be).map(function(nt,je){if(m.isValidElement(nt)){var ft,vt,xt=nt.key,Ct=(ft=(vt=nt.props)===null||vt===void 0?void 0:vt.eventKey)!==null&&ft!==void 0?ft:xt,cn=Ct==null;cn&&(Ct="tmp_key-".concat([].concat((0,ne.Z)(Ze),[je]).join("-")));var Yt={key:Ct,eventKey:Ct};return m.cloneElement(nt,Yt)}return nt})}var lt=O(65030),pt={adjustX:1,adjustY:1},Tt={topLeft:{points:["bl","tl"],overflow:pt},topRight:{points:["br","tr"],overflow:pt},bottomLeft:{points:["tl","bl"],overflow:pt},bottomRight:{points:["tr","br"],overflow:pt},leftTop:{points:["tr","tl"],overflow:pt},leftBottom:{points:["br","bl"],overflow:pt},rightTop:{points:["tl","tr"],overflow:pt},rightBottom:{points:["bl","br"],overflow:pt}},Wt={topLeft:{points:["bl","tl"],overflow:pt},topRight:{points:["br","tr"],overflow:pt},bottomLeft:{points:["tl","bl"],overflow:pt},bottomRight:{points:["tr","br"],overflow:pt},rightTop:{points:["tr","tl"],overflow:pt},rightBottom:{points:["br","bl"],overflow:pt},leftTop:{points:["tl","tr"],overflow:pt},leftBottom:{points:["bl","br"],overflow:pt}},mn=null;function Qt(be,Ze,nt){if(Ze)return Ze;if(nt)return nt[be]||nt.other}var Ot={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function vn(be){var Ze=be.prefixCls,nt=be.visible,je=be.children,ft=be.popup,vt=be.popupStyle,xt=be.popupClassName,Ct=be.popupOffset,cn=be.disabled,Yt=be.mode,wn=be.onVisibleChange,Jt=m.useContext(C),qt=Jt.getPopupContainer,sn=Jt.rtl,on=Jt.subMenuOpenDelay,pn=Jt.subMenuCloseDelay,Ht=Jt.builtinPlacements,Xt=Jt.triggerSubMenuAction,An=Jt.forceSubMenuRender,rn=Jt.rootClassName,nn=Jt.motion,Rn=Jt.defaultMotions,fn=m.useState(!1),yn=(0,$.Z)(fn,2),Zn=yn[0],Pn=yn[1],En=sn?(0,De.Z)((0,De.Z)({},Wt),Ht):(0,De.Z)((0,De.Z)({},Tt),Ht),bn=Ot[Yt],Yn=Qt(Yt,nn,Rn),Wn=m.useRef(Yn);Yt!=="inline"&&(Wn.current=Yn);var hn=(0,De.Z)((0,De.Z)({},Wn.current),{},{leavedClassName:"".concat(Ze,"-hidden"),removeOnLeave:!1,motionAppear:!0}),ni=m.useRef();return m.useEffect(function(){return ni.current=(0,fe.Z)(function(){Pn(nt)}),function(){fe.Z.cancel(ni.current)}},[nt]),m.createElement(lt.Z,{prefixCls:Ze,popupClassName:ee()("".concat(Ze,"-popup"),(0,re.Z)({},"".concat(Ze,"-rtl"),sn),xt,rn),stretch:Yt==="horizontal"?"minWidth":null,getPopupContainer:qt,builtinPlacements:En,popupPlacement:bn,popupVisible:Zn,popup:ft,popupStyle:vt,popupAlign:Ct&&{offset:Ct},action:cn?[]:[Xt],mouseEnterDelay:on,mouseLeaveDelay:pn,onPopupVisibleChange:wn,forceRender:An,popupMotion:hn,fresh:!0},je)}var Kn=O(77900);function Ln(be){var Ze=be.id,nt=be.open,je=be.keyPath,ft=be.children,vt="inline",xt=m.useContext(C),Ct=xt.prefixCls,cn=xt.forceSubMenuRender,Yt=xt.motion,wn=xt.defaultMotions,Jt=xt.mode,qt=m.useRef(!1);qt.current=Jt===vt;var sn=m.useState(!qt.current),on=(0,$.Z)(sn,2),pn=on[0],Ht=on[1],Xt=qt.current?nt:!1;m.useEffect(function(){qt.current&&Ht(!1)},[Jt]);var An=(0,De.Z)({},Qt(vt,Yt,wn));je.length>1&&(An.motionAppear=!1);var rn=An.onVisibleChanged;return An.onVisibleChanged=function(nn){return!qt.current&&!nn&&Ht(!0),rn==null?void 0:rn(nn)},pn?null:m.createElement(H,{mode:vt,locked:!qt.current},m.createElement(Kn.default,(0,N.Z)({visible:Xt},An,{forceRender:cn,removeOnLeave:!1,leavedClassName:"".concat(Ct,"-hidden")}),function(nn){var Rn=nn.className,fn=nn.style;return m.createElement(ae,{id:Ze,className:Rn,style:fn},ft)}))}var Sn=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],gt=["active"],Je=m.forwardRef(function(be,Ze){var nt=be.style,je=be.className,ft=be.title,vt=be.eventKey,xt=be.warnKey,Ct=be.disabled,cn=be.internalPopupClose,Yt=be.children,wn=be.itemIcon,Jt=be.expandIcon,qt=be.popupClassName,sn=be.popupOffset,on=be.popupStyle,pn=be.onClick,Ht=be.onMouseEnter,Xt=be.onMouseLeave,An=be.onTitleClick,rn=be.onTitleMouseEnter,nn=be.onTitleMouseLeave,Rn=(0,g.Z)(be,Sn),fn=F(vt),yn=m.useContext(C),Zn=yn.prefixCls,Pn=yn.mode,En=yn.openKeys,bn=yn.disabled,Yn=yn.overflowDisabled,Wn=yn.activeKey,hn=yn.selectedKeys,ni=yn.itemIcon,Jn=yn.expandIcon,Mn=yn.onItemClick,di=yn.onOpenChange,xn=yn.onActive,hi=m.useContext(k),Li=hi._internalRenderSubMenuItem,Ci=m.useContext(ie),_i=Ci.isSubPathKey,ki=_e(),oi="".concat(Zn,"-submenu"),li=bn||Ct,Pi=m.useRef(),vi=m.useRef(),gi=wn!=null?wn:ni,jn=Jt!=null?Jt:Jn,fi=En.includes(vt),Hn=!Yn&&fi,Oi=_i(hn,vt),ii=Xe(vt,li,rn,nn),ui=ii.active,Ai=(0,g.Z)(ii,gt),Zt=m.useState(!1),$i=(0,$.Z)(Zt,2),Ki=$i[0],Ni=$i[1],Bi=function(si){li||Ni(si)},rs=function(si){Bi(!0),Ht==null||Ht({key:vt,domEvent:si})},ds=function(si){Bi(!1),Xt==null||Xt({key:vt,domEvent:si})},Gi=m.useMemo(function(){return ui||(Pn!=="inline"?Ki||_i([Wn],vt):!1)},[Pn,ui,Wn,Ki,vt,_i]),_n=We(ki.length),ps=function(si){li||(An==null||An({key:vt,domEvent:si}),Pn==="inline"&&di(vt,!fi))},gs=$e(function(Un){pn==null||pn(mt(Un)),Mn(Un)}),Yi=function(si){Pn!=="inline"&&di(vt,si)},qi=function(){xn(vt)},Xi=fn&&"".concat(fn,"-popup"),zi=m.useMemo(function(){return m.createElement(Et,{icon:Pn!=="horizontal"?jn:void 0,props:(0,De.Z)((0,De.Z)({},be),{},{isOpen:Hn,isSubMenu:!0})},m.createElement("i",{className:"".concat(oi,"-arrow")}))},[Pn,jn,be,Hn,oi]),ci=m.createElement("div",(0,N.Z)({role:"menuitem",style:_n,className:"".concat(oi,"-title"),tabIndex:li?null:-1,ref:Pi,title:typeof ft=="string"?ft:null,"data-menu-id":Yn&&fn?null:fn,"aria-expanded":Hn,"aria-haspopup":!0,"aria-controls":Xi,"aria-disabled":li,onClick:ps,onFocus:qi},Ai),ft,zi),Ei=m.useRef(Pn);if(Pn!=="inline"&&ki.length>1?Ei.current="vertical":Ei.current=Pn,!Yn){var bi=Ei.current;ci=m.createElement(vn,{mode:bi,prefixCls:oi,visible:!cn&&Hn&&Pn!=="inline",popupClassName:qt,popupOffset:sn,popupStyle:on,popup:m.createElement(H,{mode:bi==="horizontal"?"vertical":bi},m.createElement(ae,{id:Xi,ref:vi},Yt)),disabled:li,onVisibleChange:Yi},ci)}var ei=m.createElement(l.Z.Item,(0,N.Z)({ref:Ze,role:"none"},Rn,{component:"li",style:nt,className:ee()(oi,"".concat(oi,"-").concat(Pn),je,(0,re.Z)((0,re.Z)((0,re.Z)((0,re.Z)({},"".concat(oi,"-open"),Hn),"".concat(oi,"-active"),Gi),"".concat(oi,"-selected"),Oi),"".concat(oi,"-disabled"),li)),onMouseEnter:rs,onMouseLeave:ds}),ci,!Yn&&m.createElement(Ln,{id:Xi,open:Hn,keyPath:ki},Yt));return Li&&(ei=Li(ei,be,{selected:Oi,active:Gi,open:Hn,disabled:li})),m.createElement(H,{onItemClick:gs,mode:Pn==="horizontal"?"vertical":Pn,itemIcon:gi,expandIcon:jn},ei)}),wt=m.forwardRef(function(be,Ze){var nt=be.eventKey,je=be.children,ft=_e(nt),vt=qe(je,ft),xt=X();m.useEffect(function(){if(xt)return xt.registerPath(nt,ft),function(){xt.unregisterPath(nt,ft)}},[ft]);var Ct;return xt?Ct=vt:Ct=m.createElement(Je,(0,N.Z)({ref:Ze},be),vt),m.createElement(oe.Provider,{value:ft},Ct)}),jt=wt,ln=O(34666);function Tn(be){var Ze=be.className,nt=be.style,je=m.useContext(C),ft=je.prefixCls,vt=X();return vt?null:m.createElement("li",{role:"separator",className:ee()("".concat(ft,"-item-divider"),Ze),style:nt})}var ti=["className","title","eventKey","children"],Qn=m.forwardRef(function(be,Ze){var nt=be.className,je=be.title,ft=be.eventKey,vt=be.children,xt=(0,g.Z)(be,ti),Ct=m.useContext(C),cn=Ct.prefixCls,Yt="".concat(cn,"-item-group");return m.createElement("li",(0,N.Z)({ref:Ze,role:"presentation"},xt,{onClick:function(Jt){return Jt.stopPropagation()},className:ee()(Yt,nt)}),m.createElement("div",{role:"presentation",className:"".concat(Yt,"-title"),title:typeof je=="string"?je:void 0},je),m.createElement("ul",{role:"group",className:"".concat(Yt,"-list")},vt))}),In=m.forwardRef(function(be,Ze){var nt=be.eventKey,je=be.children,ft=_e(nt),vt=qe(je,ft),xt=X();return xt?vt:m.createElement(Qn,(0,N.Z)({ref:Ze},(0,xe.Z)(be,["warnKey"])),vt)}),Vn=In,an=["label","children","key","type","extra"];function Bn(be,Ze,nt){var je=Ze.item,ft=Ze.group,vt=Ze.submenu,xt=Ze.divider;return(be||[]).map(function(Ct,cn){if(Ct&&(0,ln.Z)(Ct)==="object"){var Yt=Ct,wn=Yt.label,Jt=Yt.children,qt=Yt.key,sn=Yt.type,on=Yt.extra,pn=(0,g.Z)(Yt,an),Ht=qt!=null?qt:"tmp-".concat(cn);return Jt||sn==="group"?sn==="group"?m.createElement(ft,(0,N.Z)({key:Ht},pn,{title:wn}),Bn(Jt,Ze,nt)):m.createElement(vt,(0,N.Z)({key:Ht},pn,{title:wn}),Bn(Jt,Ze,nt)):sn==="divider"?m.createElement(xt,(0,N.Z)({key:Ht},pn)):m.createElement(je,(0,N.Z)({key:Ht},pn,{extra:on}),wn,(!!on||on===0)&&m.createElement("span",{className:"".concat(nt,"-item-extra")},on))}return null}).filter(function(Ct){return Ct})}function Cn(be,Ze,nt,je,ft){var vt=be,xt=(0,De.Z)({divider:Tn,item:ge,group:Vn,submenu:jt},je);return Ze&&(vt=Bn(Ze,xt,ft)),qe(vt,nt)}var Ii=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],en=[],un=m.forwardRef(function(be,Ze){var nt,je=be,ft=je.prefixCls,vt=ft===void 0?"rc-menu":ft,xt=je.rootClassName,Ct=je.style,cn=je.className,Yt=je.tabIndex,wn=Yt===void 0?0:Yt,Jt=je.items,qt=je.children,sn=je.direction,on=je.id,pn=je.mode,Ht=pn===void 0?"vertical":pn,Xt=je.inlineCollapsed,An=je.disabled,rn=je.disabledOverflow,nn=je.subMenuOpenDelay,Rn=nn===void 0?.1:nn,fn=je.subMenuCloseDelay,yn=fn===void 0?.1:fn,Zn=je.forceSubMenuRender,Pn=je.defaultOpenKeys,En=je.openKeys,bn=je.activeKey,Yn=je.defaultActiveFirst,Wn=je.selectable,hn=Wn===void 0?!0:Wn,ni=je.multiple,Jn=ni===void 0?!1:ni,Mn=je.defaultSelectedKeys,di=je.selectedKeys,xn=je.onSelect,hi=je.onDeselect,Li=je.inlineIndent,Ci=Li===void 0?24:Li,_i=je.motion,ki=je.defaultMotions,oi=je.triggerSubMenuAction,li=oi===void 0?"hover":oi,Pi=je.builtinPlacements,vi=je.itemIcon,gi=je.expandIcon,jn=je.overflowedIndicator,fi=jn===void 0?"...":jn,Hn=je.overflowedIndicatorPopupClassName,Oi=je.getPopupContainer,ii=je.onClick,ui=je.onOpenChange,Ai=je.onKeyDown,Zt=je.openAnimation,$i=je.openTransitionName,Ki=je._internalRenderMenuItem,Ni=je._internalRenderSubMenuItem,Bi=je._internalComponents,rs=(0,g.Z)(je,Ii),ds=m.useMemo(function(){return[Cn(qt,Jt,en,Bi,vt),Cn(qt,Jt,en,{},vt)]},[qt,Jt,Bi]),Gi=(0,$.Z)(ds,2),_n=Gi[0],ps=Gi[1],gs=m.useState(!1),Yi=(0,$.Z)(gs,2),qi=Yi[0],Xi=Yi[1],zi=m.useRef(),ci=et(on),Ei=sn==="rtl",bi=(0,j.Z)(Pn,{value:En,postState:function(Fn){return Fn||en}}),ei=(0,$.Z)(bi,2),Un=ei[0],si=ei[1],Di=function(Fn){var Gn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Ri(){si(Fn),ui==null||ui(Fn)}Gn?(0,y.flushSync)(Ri):Ri()},Vi=m.useState(Un),as=(0,$.Z)(Vi,2),Qi=as[0],$n=as[1],ri=m.useRef(!1),os=m.useMemo(function(){return(Ht==="inline"||Ht==="vertical")&&Xt?["vertical",Xt]:[Ht,!1]},[Ht,Xt]),kt=(0,$.Z)(os,2),zt=kt[0],On=kt[1],qn=zt==="inline",zn=m.useState(zt),ms=(0,$.Z)(zn,2),Fi=ms[0],_s=ms[1],Ji=m.useState(On),hr=(0,$.Z)(Ji,2),fr=hr[0],dr=hr[1];m.useEffect(function(){_s(zt),dr(On),ri.current&&(qn?si(Qi):Di(en))},[zt,On]);var Wr=m.useState(0),Fs=(0,$.Z)(Wr,2),Ms=Fs[0],Wi=Fs[1],Ns=Ms>=_n.length-1||Fi!=="horizontal"||rn;m.useEffect(function(){qn&&$n(Un)},[Un]),m.useEffect(function(){return ri.current=!0,function(){ri.current=!1}},[]);var vs=Le(),Ys=vs.registerPath,qs=vs.unregisterPath,pr=vs.refreshOverflowKeys,Xs=vs.isSubPathKey,jr=vs.getKeyPath,Bs=vs.getKeys,gr=vs.getSubPathKeys,mr=m.useMemo(function(){return{registerPath:Ys,unregisterPath:qs}},[Ys,qs]),es=m.useMemo(function(){return{isSubPathKey:Xs}},[Xs]);m.useEffect(function(){pr(Ns?en:_n.slice(Ms+1).map(function(Xn){return Xn.key}))},[Ms,Ns]);var _r=(0,j.Z)(bn||Yn&&((nt=_n[0])===null||nt===void 0?void 0:nt.key),{value:bn}),Us=(0,$.Z)(_r,2),Ss=Us[0],Qs=Us[1],Hr=$e(function(Xn){Qs(Xn)}),Zr=$e(function(){Qs(void 0)});(0,m.useImperativeHandle)(Ze,function(){return{list:zi.current,focus:function(Fn){var Gn,Ri=Bs(),xi=Te(Ri,ci),ys=xi.elements,pi=xi.key2element,Si=xi.element2key,Sr=le(zi.current,ys),tt=Ss!=null?Ss:Sr[0]?Si.get(Sr[0]):(Gn=_n.find(function(Tr){return!Tr.props.disabled}))===null||Gn===void 0?void 0:Gn.key,Es=pi.get(tt);if(tt&&Es){var $s;Es==null||($s=Es.focus)===null||$s===void 0||$s.call(Es,Fn)}}}});var Yr=(0,j.Z)(Mn||[],{value:di,postState:function(Fn){return Array.isArray(Fn)?Fn:Fn==null?en:[Fn]}}),Js=(0,$.Z)(Yr,2),Rs=Js[0],er=Js[1],vr=function(Fn){if(hn){var Gn=Fn.key,Ri=Rs.includes(Gn),xi;Jn?Ri?xi=Rs.filter(function(pi){return pi!==Gn}):xi=[].concat((0,ne.Z)(Rs),[Gn]):xi=[Gn],er(xi);var ys=(0,De.Z)((0,De.Z)({},Fn),{},{selectedKeys:xi});Ri?hi==null||hi(ys):xn==null||xn(ys)}!Jn&&Un.length&&Fi!=="inline"&&Di(en)},yr=$e(function(Xn){ii==null||ii(mt(Xn)),vr(Xn)}),tr=$e(function(Xn,Fn){var Gn=Un.filter(function(xi){return xi!==Xn});if(Fn)Gn.push(Xn);else if(Fi!=="inline"){var Ri=gr(Xn);Gn=Gn.filter(function(xi){return!Ri.has(xi)})}(0,A.Z)(Un,Gn,!0)||Di(Gn,!0)}),Er=function(Fn,Gn){var Ri=Gn!=null?Gn:!Un.includes(Fn);tr(Fn,Ri)},br=ke(Fi,Ss,Ei,ci,zi,Bs,jr,Qs,Er,Ai);m.useEffect(function(){Xi(!0)},[]);var qr=m.useMemo(function(){return{_internalRenderMenuItem:Ki,_internalRenderSubMenuItem:Ni}},[Ki,Ni]),xr=Fi!=="horizontal"||rn?_n:_n.map(function(Xn,Fn){return m.createElement(H,{key:Xn.key,overflowDisabled:Fn>Ms},Xn)}),Is=m.createElement(l.Z,(0,N.Z)({id:on,ref:zi,prefixCls:"".concat(vt,"-overflow"),component:"ul",itemComponent:ge,className:ee()(vt,"".concat(vt,"-root"),"".concat(vt,"-").concat(Fi),cn,(0,re.Z)((0,re.Z)({},"".concat(vt,"-inline-collapsed"),fr),"".concat(vt,"-rtl"),Ei),xt),dir:sn,style:Ct,role:"menu",tabIndex:wn,data:xr,renderRawItem:function(Fn){return Fn},renderRawRest:function(Fn){var Gn=Fn.length,Ri=Gn?_n.slice(-Gn):null;return m.createElement(jt,{eventKey:we,title:fi,disabled:Ns,internalPopupClose:Gn===0,popupClassName:Hn},Ri)},maxCount:Fi!=="horizontal"||rn?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Fn){Wi(Fn)},onKeyDown:br},rs));return m.createElement(k.Provider,{value:qr},m.createElement(x.Provider,{value:ci},m.createElement(H,{prefixCls:vt,rootClassName:xt,mode:Fi,openKeys:Un,rtl:Ei,disabled:An,motion:qi?_i:null,defaultMotions:qi?ki:null,activeKey:Ss,onActive:Hr,onInactive:Zr,selectedKeys:Rs,inlineIndent:Ci,subMenuOpenDelay:Rn,subMenuCloseDelay:yn,forceSubMenuRender:Zn,builtinPlacements:Pi,triggerSubMenuAction:li,getPopupContainer:Oi,itemIcon:vi,expandIcon:gi,onItemClick:yr,onOpenChange:tr},m.createElement(ie.Provider,{value:es},Is),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(he.Provider,{value:mr},ps)))))}),Vt=un,Bt=Vt;Bt.Item=ge,Bt.SubMenu=jt,Bt.ItemGroup=Vn,Bt.Divider=Tn;var Ft=Bt},11780:function(Ut,at,O){"use strict";O.d(at,{Z:function(){return K}});var N=O(32855),re=O(27247),De=O(11913),ne=O(43079),$=O(59301),g=O(92310),ue=O.n(g),ee=O(29301),l=O(34280),j=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],A=void 0;function p(_,v){var D=_.prefixCls,Z=_.invalidate,fe=_.item,ye=_.renderItem,Oe=_.responsive,Ne=_.responsiveDisabled,ve=_.registerSize,Me=_.itemKey,Ae=_.className,dt=_.style,Ce=_.children,rt=_.display,Pe=_.order,ut=_.component,ce=ut===void 0?"div":ut,le=(0,ne.Z)(_,j),Y=Oe&&!rt;function Te(me){ve(Me,me)}$.useEffect(function(){return function(){Te(null)}},[]);var ke=ye&&fe!==A?ye(fe,{index:Pe}):Ce,Ke;Z||(Ke={opacity:Y?0:1,height:Y?0:A,overflowY:Y?"hidden":A,order:Oe?Pe:A,pointerEvents:Y?"none":A,position:Y?"absolute":A});var G={};Y&&(G["aria-hidden"]=!0);var q=$.createElement(ce,(0,N.Z)({className:ue()(!Z&&D,Ae),style:(0,re.Z)((0,re.Z)({},Ke),dt)},G,le,{ref:v}),ke);return Oe&&(q=$.createElement(ee.Z,{onResize:function(we){var Le=we.offsetWidth;Te(Le)},disabled:Ne},q)),q}var m=$.forwardRef(p);m.displayName="Item";var y=m,x=O(6089),M=O(4676),F=O(16089);function z(_){if(typeof MessageChannel=="undefined")(0,F.Z)(_);else{var v=new MessageChannel;v.port1.onmessage=function(){return _()},v.port2.postMessage(void 0)}}function I(){var _=$.useRef(null),v=function(Z){_.current||(_.current=[],z(function(){(0,M.unstable_batchedUpdates)(function(){_.current.forEach(function(fe){fe()}),_.current=null})})),_.current.push(Z)};return v}function C(_,v){var D=$.useState(v),Z=(0,De.Z)(D,2),fe=Z[0],ye=Z[1],Oe=(0,x.Z)(function(Ne){_(function(){ye(Ne)})});return[fe,Oe]}var U=$.createContext(null),H=["component"],J=["className"],he=["className"],X=function(v,D){var Z=$.useContext(U);if(!Z){var fe=v.component,ye=fe===void 0?"div":fe,Oe=(0,ne.Z)(v,H);return $.createElement(ye,(0,N.Z)({},Oe,{ref:D}))}var Ne=Z.className,ve=(0,ne.Z)(Z,J),Me=v.className,Ae=(0,ne.Z)(v,he);return $.createElement(U.Provider,{value:null},$.createElement(y,(0,N.Z)({ref:D,className:ue()(Ne,Me)},ve,Ae)))},oe=$.forwardRef(X);oe.displayName="RawItem";var _e=oe,ie=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],ze="responsive",k="invalidate";function S(_){return"+ ".concat(_.length," ...")}function w(_,v){var D=_.prefixCls,Z=D===void 0?"rc-overflow":D,fe=_.data,ye=fe===void 0?[]:fe,Oe=_.renderItem,Ne=_.renderRawItem,ve=_.itemKey,Me=_.itemWidth,Ae=Me===void 0?10:Me,dt=_.ssr,Ce=_.style,rt=_.className,Pe=_.maxCount,ut=_.renderRest,ce=_.renderRawRest,le=_.suffix,Y=_.component,Te=Y===void 0?"div":Y,ke=_.itemComponent,Ke=_.onVisibleChange,G=(0,ne.Z)(_,ie),q=dt==="full",me=I(),we=C(me,null),Le=(0,De.Z)(we,2),$e=Le[0],yt=Le[1],Qe=$e||0,et=C(me,new Map),Ve=(0,De.Z)(et,2),He=Ve[0],_t=Ve[1],ht=C(me,0),xe=(0,De.Z)(ht,2),ct=xe[0],Xe=xe[1],We=C(me,0),Et=(0,De.Z)(We,2),St=Et[0],mt=Et[1],st=C(me,0),Pt=(0,De.Z)(st,2),ot=Pt[0],bt=Pt[1],Ee=(0,$.useState)(null),pe=(0,De.Z)(Ee,2),ge=pe[0],L=pe[1],B=(0,$.useState)(null),Q=(0,De.Z)(B,2),ae=Q[0],de=Q[1],qe=$.useMemo(function(){return ae===null&&q?Number.MAX_SAFE_INTEGER:ae||0},[ae,$e]),lt=(0,$.useState)(!1),pt=(0,De.Z)(lt,2),Tt=pt[0],Wt=pt[1],mn="".concat(Z,"-item"),Qt=Math.max(ct,St),Ot=Pe===ze,vn=ye.length&&Ot,Kn=Pe===k,Ln=vn||typeof Pe=="number"&&ye.length>Pe,Sn=(0,$.useMemo)(function(){var Bt=ye;return vn?$e===null&&q?Bt=ye:Bt=ye.slice(0,Math.min(ye.length,Qe/Ae)):typeof Pe=="number"&&(Bt=ye.slice(0,Pe)),Bt},[ye,Ae,$e,Pe,vn]),gt=(0,$.useMemo)(function(){return vn?ye.slice(qe+1):ye.slice(Sn.length)},[ye,Sn,vn,qe]),Je=(0,$.useCallback)(function(Bt,Ft){var be;return typeof ve=="function"?ve(Bt):(be=ve&&(Bt==null?void 0:Bt[ve]))!==null&&be!==void 0?be:Ft},[ve]),wt=(0,$.useCallback)(Oe||function(Bt){return Bt},[Oe]);function jt(Bt,Ft,be){ae===Bt&&(Ft===void 0||Ft===ge)||(de(Bt),be||(Wt(Bt<ye.length-1),Ke==null||Ke(Bt)),Ft!==void 0&&L(Ft))}function ln(Bt,Ft){yt(Ft.clientWidth)}function Tn(Bt,Ft){_t(function(be){var Ze=new Map(be);return Ft===null?Ze.delete(Bt):Ze.set(Bt,Ft),Ze})}function ti(Bt,Ft){mt(Ft),Xe(St)}function Qn(Bt,Ft){bt(Ft)}function In(Bt){return He.get(Je(Sn[Bt],Bt))}(0,l.Z)(function(){if(Qe&&typeof Qt=="number"&&Sn){var Bt=ot,Ft=Sn.length,be=Ft-1;if(!Ft){jt(0,null);return}for(var Ze=0;Ze<Ft;Ze+=1){var nt=In(Ze);if(q&&(nt=nt||0),nt===void 0){jt(Ze-1,void 0,!0);break}if(Bt+=nt,be===0&&Bt<=Qe||Ze===be-1&&Bt+In(be)<=Qe){jt(be,null);break}else if(Bt+Qt>Qe){jt(Ze-1,Bt-nt-ot+St);break}}le&&In(0)+ot>Qe&&L(null)}},[Qe,He,St,ot,Je,Sn]);var Vn=Tt&&!!gt.length,an={};ge!==null&&vn&&(an={position:"absolute",left:ge,top:0});var Bn={prefixCls:mn,responsive:vn,component:ke,invalidate:Kn},Cn=Ne?function(Bt,Ft){var be=Je(Bt,Ft);return $.createElement(U.Provider,{key:be,value:(0,re.Z)((0,re.Z)({},Bn),{},{order:Ft,item:Bt,itemKey:be,registerSize:Tn,display:Ft<=qe})},Ne(Bt,Ft))}:function(Bt,Ft){var be=Je(Bt,Ft);return $.createElement(y,(0,N.Z)({},Bn,{order:Ft,key:be,item:Bt,renderItem:wt,itemKey:be,registerSize:Tn,display:Ft<=qe}))},Ii={order:Vn?qe:Number.MAX_SAFE_INTEGER,className:"".concat(mn,"-rest"),registerSize:ti,display:Vn},en=ut||S,un=ce?$.createElement(U.Provider,{value:(0,re.Z)((0,re.Z)({},Bn),Ii)},ce(gt)):$.createElement(y,(0,N.Z)({},Bn,Ii),typeof en=="function"?en(gt):en),Vt=$.createElement(Te,(0,N.Z)({className:ue()(!Kn&&Z,rt),style:Ce,ref:v},G),Sn.map(Cn),Ln?un:null,le&&$.createElement(y,(0,N.Z)({},Bn,{responsive:Ot,responsiveDisabled:!vn,order:qe,className:"".concat(mn,"-suffix"),registerSize:Qn,display:!0,style:an}),le));return Ot?$.createElement(ee.Z,{onResize:ln,disabled:!vn},Vt):Vt}var P=$.forwardRef(w);P.displayName="Overflow",P.Item=_e,P.RESPONSIVE=ze,P.INVALIDATE=k;var W=P,K=W},25930:function(Ut,at,O){"use strict";O.d(at,{Cd:function(){return ie}});var N=O(32855),re=O(27247),De=O(43079),ne=O(59301),$=O(92310),g=O.n($),ue={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},ee=function(){var S=(0,ne.useRef)([]),w=(0,ne.useRef)(null);return(0,ne.useEffect)(function(){var P=Date.now(),W=!1;S.current.forEach(function(K){if(K){W=!0;var _=K.style;_.transitionDuration=".3s, .3s, .3s, .06s",w.current&&P-w.current<100&&(_.transitionDuration="0s, 0s")}}),W&&(w.current=Date.now())}),S.current},l=["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"],j=function(S){var w=(0,re.Z)((0,re.Z)({},ue),S),P=w.className,W=w.percent,K=w.prefixCls,_=w.strokeColor,v=w.strokeLinecap,D=w.strokeWidth,Z=w.style,fe=w.trailColor,ye=w.trailWidth,Oe=w.transition,Ne=(0,De.Z)(w,l);delete Ne.gapPosition;var ve=Array.isArray(W)?W:[W],Me=Array.isArray(_)?_:[_],Ae=ee(),dt=D/2,Ce=100-D/2,rt="M ".concat(v==="round"?dt:0,",").concat(dt,`
L `).concat(v==="round"?Ce:100,",").concat(dt),Pe="0 0 100 ".concat(D),ut=0;return ne.createElement("svg",(0,N.Z)({className:g()("".concat(K,"-line"),P),viewBox:Pe,preserveAspectRatio:"none",style:Z},Ne),ne.createElement("path",{className:"".concat(K,"-line-trail"),d:rt,strokeLinecap:v,stroke:fe,strokeWidth:ye||D,fillOpacity:"0"}),ve.map(function(ce,le){var Y=1;switch(v){case"round":Y=1-D/100;break;case"square":Y=1-D/2/100;break;default:Y=1;break}var Te={strokeDasharray:"".concat(ce*Y,"px, 100px"),strokeDashoffset:"-".concat(ut,"px"),transition:Oe||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},ke=Me[le]||Me[Me.length-1];return ut+=ce,ne.createElement("path",{key:le,className:"".concat(K,"-line-path"),d:rt,strokeLinecap:v,stroke:ke,strokeWidth:D,fillOpacity:"0",ref:function(G){Ae[le]=G},style:Te})}))},A=j,p=O(34666),m=O(11913),y=O(47273),x=0,M=(0,y.Z)();function F(){var k;return M?(k=x,x+=1):k="TEST_OR_SSR",k}var z=function(k){var S=ne.useState(),w=(0,m.Z)(S,2),P=w[0],W=w[1];return ne.useEffect(function(){W("rc_progress_".concat(F()))},[]),k||P},I=function(S){var w=S.bg,P=S.children;return ne.createElement("div",{style:{width:"100%",height:"100%",background:w}},P)};function C(k,S){return Object.keys(k).map(function(w){var P=parseFloat(w),W="".concat(Math.floor(P*S),"%");return"".concat(k[w]," ").concat(W)})}var U=ne.forwardRef(function(k,S){var w=k.prefixCls,P=k.color,W=k.gradientId,K=k.radius,_=k.style,v=k.ptg,D=k.strokeLinecap,Z=k.strokeWidth,fe=k.size,ye=k.gapDegree,Oe=P&&(0,p.Z)(P)==="object",Ne=Oe?"#FFF":void 0,ve=fe/2,Me=ne.createElement("circle",{className:"".concat(w,"-circle-path"),r:K,cx:ve,cy:ve,stroke:Ne,strokeLinecap:D,strokeWidth:Z,opacity:v===0?0:1,style:_,ref:S});if(!Oe)return Me;var Ae="".concat(W,"-conic"),dt=ye?"".concat(180+ye/2,"deg"):"0deg",Ce=C(P,(360-ye)/360),rt=C(P,1),Pe="conic-gradient(from ".concat(dt,", ").concat(Ce.join(", "),")"),ut="linear-gradient(to ".concat(ye?"bottom":"top",", ").concat(rt.join(", "),")");return ne.createElement(ne.Fragment,null,ne.createElement("mask",{id:Ae},Me),ne.createElement("foreignObject",{x:0,y:0,width:fe,height:fe,mask:"url(#".concat(Ae,")")},ne.createElement(I,{bg:ut},ne.createElement(I,{bg:Pe}))))}),H=U,J=100,he=function(S,w,P,W,K,_,v,D,Z,fe){var ye=arguments.length>10&&arguments[10]!==void 0?arguments[10]:0,Oe=P/100*360*((360-_)/360),Ne=_===0?0:{bottom:0,top:180,left:90,right:-90}[v],ve=(100-W)/100*w;Z==="round"&&W!==100&&(ve+=fe/2,ve>=w&&(ve=w-.01));var Me=J/2;return{stroke:typeof D=="string"?D:void 0,strokeDasharray:"".concat(w,"px ").concat(S),strokeDashoffset:ve+ye,transform:"rotate(".concat(K+Oe+Ne,"deg)"),transformOrigin:"".concat(Me,"px ").concat(Me,"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},X=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function oe(k){var S=k!=null?k:[];return Array.isArray(S)?S:[S]}var _e=function(S){var w=(0,re.Z)((0,re.Z)({},ue),S),P=w.id,W=w.prefixCls,K=w.steps,_=w.strokeWidth,v=w.trailWidth,D=w.gapDegree,Z=D===void 0?0:D,fe=w.gapPosition,ye=w.trailColor,Oe=w.strokeLinecap,Ne=w.style,ve=w.className,Me=w.strokeColor,Ae=w.percent,dt=(0,De.Z)(w,X),Ce=J/2,rt=z(P),Pe="".concat(rt,"-gradient"),ut=Ce-_/2,ce=Math.PI*2*ut,le=Z>0?90+Z/2:-90,Y=ce*((360-Z)/360),Te=(0,p.Z)(K)==="object"?K:{count:K,gap:2},ke=Te.count,Ke=Te.gap,G=oe(Ae),q=oe(Me),me=q.find(function(Ve){return Ve&&(0,p.Z)(Ve)==="object"}),we=me&&(0,p.Z)(me)==="object",Le=we?"butt":Oe,$e=he(ce,Y,0,100,le,Z,fe,ye,Le,_),yt=ee(),Qe=function(){var He=0;return G.map(function(_t,ht){var xe=q[ht]||q[q.length-1],ct=he(ce,Y,He,_t,le,Z,fe,xe,Le,_);return He+=_t,ne.createElement(H,{key:ht,color:xe,ptg:_t,radius:ut,prefixCls:W,gradientId:Pe,style:ct,strokeLinecap:Le,strokeWidth:_,gapDegree:Z,ref:function(We){yt[ht]=We},size:J})}).reverse()},et=function(){var He=Math.round(ke*(G[0]/100)),_t=100/ke,ht=0;return new Array(ke).fill(null).map(function(xe,ct){var Xe=ct<=He-1?q[0]:ye,We=Xe&&(0,p.Z)(Xe)==="object"?"url(#".concat(Pe,")"):void 0,Et=he(ce,Y,ht,_t,le,Z,fe,Xe,"butt",_,Ke);return ht+=(Y-Et.strokeDashoffset+Ke)*100/Y,ne.createElement("circle",{key:ct,className:"".concat(W,"-circle-path"),r:ut,cx:Ce,cy:Ce,stroke:We,strokeWidth:_,opacity:1,style:Et,ref:function(mt){yt[ct]=mt}})})};return ne.createElement("svg",(0,N.Z)({className:g()("".concat(W,"-circle"),ve),viewBox:"0 0 ".concat(J," ").concat(J),style:Ne,id:P,role:"presentation"},dt),!ke&&ne.createElement("circle",{className:"".concat(W,"-circle-trail"),r:ut,cx:Ce,cy:Ce,stroke:ye,strokeLinecap:Le,strokeWidth:v||_,style:$e}),ke?et():Qe())},ie=_e,ze={Line:A,Circle:ie}},29301:function(Ut,at,O){"use strict";O.d(at,{Z:function(){return k}});var N=O(32855),re=O(59301),De=O(11592),ne=O(48736),$=O(27247),g=O(34666),ue=O(76846),ee=O(8654),l=re.createContext(null);function j(S){var w=S.children,P=S.onBatchResize,W=re.useRef(0),K=re.useRef([]),_=re.useContext(l),v=re.useCallback(function(D,Z,fe){W.current+=1;var ye=W.current;K.current.push({size:D,element:Z,data:fe}),Promise.resolve().then(function(){ye===W.current&&(P==null||P(K.current),K.current=[])}),_==null||_(D,Z,fe)},[P,_]);return re.createElement(l.Provider,{value:v},w)}var A=O(76374),p=new Map;function m(S){S.forEach(function(w){var P,W=w.target;(P=p.get(W))===null||P===void 0||P.forEach(function(K){return K(W)})})}var y=new A.Z(m),x=null,M=null;function F(S,w){p.has(S)||(p.set(S,new Set),y.observe(S)),p.get(S).add(w)}function z(S,w){p.has(S)&&(p.get(S).delete(w),p.get(S).size||(y.unobserve(S),p.delete(S)))}var I=O(33377),C=O(93912),U=O(18881),H=O(85461),J=function(S){(0,U.Z)(P,S);var w=(0,H.Z)(P);function P(){return(0,I.Z)(this,P),w.apply(this,arguments)}return(0,C.Z)(P,[{key:"render",value:function(){return this.props.children}}]),P}(re.Component);function he(S,w){var P=S.children,W=S.disabled,K=re.useRef(null),_=re.useRef(null),v=re.useContext(l),D=typeof P=="function",Z=D?P(K):P,fe=re.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ye=!D&&re.isValidElement(Z)&&(0,ee.Yr)(Z),Oe=ye?(0,ee.C4)(Z):null,Ne=(0,ee.x1)(Oe,K),ve=function(){var Ce;return(0,ue.ZP)(K.current)||(K.current&&(0,g.Z)(K.current)==="object"?(0,ue.ZP)((Ce=K.current)===null||Ce===void 0?void 0:Ce.nativeElement):null)||(0,ue.ZP)(_.current)};re.useImperativeHandle(w,function(){return ve()});var Me=re.useRef(S);Me.current=S;var Ae=re.useCallback(function(dt){var Ce=Me.current,rt=Ce.onResize,Pe=Ce.data,ut=dt.getBoundingClientRect(),ce=ut.width,le=ut.height,Y=dt.offsetWidth,Te=dt.offsetHeight,ke=Math.floor(ce),Ke=Math.floor(le);if(fe.current.width!==ke||fe.current.height!==Ke||fe.current.offsetWidth!==Y||fe.current.offsetHeight!==Te){var G={width:ke,height:Ke,offsetWidth:Y,offsetHeight:Te};fe.current=G;var q=Y===Math.round(ce)?ce:Y,me=Te===Math.round(le)?le:Te,we=(0,$.Z)((0,$.Z)({},G),{},{offsetWidth:q,offsetHeight:me});v==null||v(we,dt,Pe),rt&&Promise.resolve().then(function(){rt(we,dt)})}},[]);return re.useEffect(function(){var dt=ve();return dt&&!W&&F(dt,Ae),function(){return z(dt,Ae)}},[K.current,W]),re.createElement(J,{ref:_},ye?re.cloneElement(Z,{ref:Ne}):Z)}var X=re.forwardRef(he),oe=X,_e="rc-observer-key";function ie(S,w){var P=S.children,W=typeof P=="function"?[P]:(0,De.Z)(P);return W.map(function(K,_){var v=(K==null?void 0:K.key)||"".concat(_e,"-").concat(_);return re.createElement(oe,(0,N.Z)({},S,{key:v,ref:_===0?w:void 0}),K)})}var ze=re.forwardRef(ie);ze.Collection=j;var k=ze},22711:function(Ut,at,O){"use strict";O.r(at),O.d(at,{ResizableTextArea:function(){return ze},default:function(){return P}});var N=O(32855),re=O(74430),De=O(27247),ne=O(3300),$=O(11913),g=O(43079),ue=O(92310),ee=O.n(ue),l=O(36901),j=O(66003),A=O(30292),p=O(18929),m=O(59301),y=O(34666),x=O(29301),M=O(34280),F=O(16089),z=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important;
pointer-events: none !important;
`,I=["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"],C={},U;function H(W){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_=W.getAttribute("id")||W.getAttribute("data-reactid")||W.getAttribute("name");if(K&&C[_])return C[_];var v=window.getComputedStyle(W),D=v.getPropertyValue("box-sizing")||v.getPropertyValue("-moz-box-sizing")||v.getPropertyValue("-webkit-box-sizing"),Z=parseFloat(v.getPropertyValue("padding-bottom"))+parseFloat(v.getPropertyValue("padding-top")),fe=parseFloat(v.getPropertyValue("border-bottom-width"))+parseFloat(v.getPropertyValue("border-top-width")),ye=I.map(function(Ne){return"".concat(Ne,":").concat(v.getPropertyValue(Ne))}).join(";"),Oe={sizingStyle:ye,paddingSize:Z,borderSize:fe,boxSizing:D};return K&&_&&(C[_]=Oe),Oe}function J(W){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),U.setAttribute("name","hiddenTextarea"),document.body.appendChild(U)),W.getAttribute("wrap")?U.setAttribute("wrap",W.getAttribute("wrap")):U.removeAttribute("wrap");var D=H(W,K),Z=D.paddingSize,fe=D.borderSize,ye=D.boxSizing,Oe=D.sizingStyle;U.setAttribute("style","".concat(Oe,";").concat(z)),U.value=W.value||W.placeholder||"";var Ne=void 0,ve=void 0,Me,Ae=U.scrollHeight;if(ye==="border-box"?Ae+=fe:ye==="content-box"&&(Ae-=Z),_!==null||v!==null){U.value=" ";var dt=U.scrollHeight-Z;_!==null&&(Ne=dt*_,ye==="border-box"&&(Ne=Ne+Z+fe),Ae=Math.max(Ne,Ae)),v!==null&&(ve=dt*v,ye==="border-box"&&(ve=ve+Z+fe),Me=Ae>ve?"":"hidden",Ae=Math.min(ve,Ae))}var Ce={height:Ae,overflowY:Me,resize:"none"};return Ne&&(Ce.minHeight=Ne),ve&&(Ce.maxHeight=ve),Ce}var he=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],X=0,oe=1,_e=2,ie=m.forwardRef(function(W,K){var _=W,v=_.prefixCls,D=_.defaultValue,Z=_.value,fe=_.autoSize,ye=_.onResize,Oe=_.className,Ne=_.style,ve=_.disabled,Me=_.onChange,Ae=_.onInternalAutoSize,dt=(0,g.Z)(_,he),Ce=(0,p.Z)(D,{value:Z,postState:function(Et){return Et!=null?Et:""}}),rt=(0,$.Z)(Ce,2),Pe=rt[0],ut=rt[1],ce=function(Et){ut(Et.target.value),Me==null||Me(Et)},le=m.useRef();m.useImperativeHandle(K,function(){return{textArea:le.current}});var Y=m.useMemo(function(){return fe&&(0,y.Z)(fe)==="object"?[fe.minRows,fe.maxRows]:[]},[fe]),Te=(0,$.Z)(Y,2),ke=Te[0],Ke=Te[1],G=!!fe,q=function(){try{if(document.activeElement===le.current){var Et=le.current,St=Et.selectionStart,mt=Et.selectionEnd,st=Et.scrollTop;le.current.setSelectionRange(St,mt),le.current.scrollTop=st}}catch(Pt){}},me=m.useState(_e),we=(0,$.Z)(me,2),Le=we[0],$e=we[1],yt=m.useState(),Qe=(0,$.Z)(yt,2),et=Qe[0],Ve=Qe[1],He=function(){$e(X)};(0,M.Z)(function(){G&&He()},[Z,ke,Ke,G]),(0,M.Z)(function(){if(Le===X)$e(oe);else if(Le===oe){var We=J(le.current,!1,ke,Ke);$e(_e),Ve(We)}else q()},[Le]);var _t=m.useRef(),ht=function(){F.Z.cancel(_t.current)},xe=function(Et){Le===_e&&(ye==null||ye(Et),fe&&(ht(),_t.current=(0,F.Z)(function(){He()})))};m.useEffect(function(){return ht},[]);var ct=G?et:null,Xe=(0,De.Z)((0,De.Z)({},Ne),ct);return(Le===X||Le===oe)&&(Xe.overflowY="hidden",Xe.overflowX="hidden"),m.createElement(x.Z,{onResize:xe,disabled:!(fe||ye)},m.createElement("textarea",(0,N.Z)({},dt,{ref:le,style:Xe,className:ee()(v,Oe,(0,re.Z)({},"".concat(v,"-disabled"),ve)),disabled:ve,value:Pe,onChange:ce})))}),ze=ie,k=["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"],S=m.forwardRef(function(W,K){var _,v=W.defaultValue,D=W.value,Z=W.onFocus,fe=W.onBlur,ye=W.onChange,Oe=W.allowClear,Ne=W.maxLength,ve=W.onCompositionStart,Me=W.onCompositionEnd,Ae=W.suffix,dt=W.prefixCls,Ce=dt===void 0?"rc-textarea":dt,rt=W.showCount,Pe=W.count,ut=W.className,ce=W.style,le=W.disabled,Y=W.hidden,Te=W.classNames,ke=W.styles,Ke=W.onResize,G=W.onClear,q=W.onPressEnter,me=W.readOnly,we=W.autoSize,Le=W.onKeyDown,$e=(0,g.Z)(W,k),yt=(0,p.Z)(v,{value:D,defaultValue:v}),Qe=(0,$.Z)(yt,2),et=Qe[0],Ve=Qe[1],He=et==null?"":String(et),_t=m.useState(!1),ht=(0,$.Z)(_t,2),xe=ht[0],ct=ht[1],Xe=m.useRef(!1),We=m.useState(null),Et=(0,$.Z)(We,2),St=Et[0],mt=Et[1],st=(0,m.useRef)(null),Pt=(0,m.useRef)(null),ot=function(){var wt;return(wt=Pt.current)===null||wt===void 0?void 0:wt.textArea},bt=function(){ot().focus()};(0,m.useImperativeHandle)(K,function(){var Je;return{resizableTextArea:Pt.current,focus:bt,blur:function(){ot().blur()},nativeElement:((Je=st.current)===null||Je===void 0?void 0:Je.nativeElement)||ot()}}),(0,m.useEffect)(function(){ct(function(Je){return!le&&Je})},[le]);var Ee=m.useState(null),pe=(0,$.Z)(Ee,2),ge=pe[0],L=pe[1];m.useEffect(function(){if(ge){var Je;(Je=ot()).setSelectionRange.apply(Je,(0,ne.Z)(ge))}},[ge]);var B=(0,j.Z)(Pe,rt),Q=(_=B.max)!==null&&_!==void 0?_:Ne,ae=Number(Q)>0,de=B.strategy(He),qe=!!Q&&de>Q,lt=function(wt,jt){var ln=jt;!Xe.current&&B.exceedFormatter&&B.max&&B.strategy(jt)>B.max&&(ln=B.exceedFormatter(jt,{max:B.max}),jt!==ln&&L([ot().selectionStart||0,ot().selectionEnd||0])),Ve(ln),(0,A.rJ)(wt.currentTarget,wt,ye,ln)},pt=function(wt){Xe.current=!0,ve==null||ve(wt)},Tt=function(wt){Xe.current=!1,lt(wt,wt.currentTarget.value),Me==null||Me(wt)},Wt=function(wt){lt(wt,wt.target.value)},mn=function(wt){wt.key==="Enter"&&q&&q(wt),Le==null||Le(wt)},Qt=function(wt){ct(!0),Z==null||Z(wt)},Ot=function(wt){ct(!1),fe==null||fe(wt)},vn=function(wt){Ve(""),bt(),(0,A.rJ)(ot(),wt,ye)},Kn=Ae,Ln;B.show&&(B.showFormatter?Ln=B.showFormatter({value:He,count:de,maxLength:Q}):Ln="".concat(de).concat(ae?" / ".concat(Q):""),Kn=m.createElement(m.Fragment,null,Kn,m.createElement("span",{className:ee()("".concat(Ce,"-data-count"),Te==null?void 0:Te.count),style:ke==null?void 0:ke.count},Ln)));var Sn=function(wt){var jt;Ke==null||Ke(wt),(jt=ot())!==null&&jt!==void 0&&jt.style.height&&mt(!0)},gt=!we&&!rt&&!Oe;return m.createElement(l.BaseInput,{ref:st,value:He,allowClear:Oe,handleReset:vn,suffix:Kn,prefixCls:Ce,classNames:(0,De.Z)((0,De.Z)({},Te),{},{affixWrapper:ee()(Te==null?void 0:Te.affixWrapper,(0,re.Z)((0,re.Z)({},"".concat(Ce,"-show-count"),rt),"".concat(Ce,"-textarea-allow-clear"),Oe))}),disabled:le,focused:xe,className:ee()(ut,qe&&"".concat(Ce,"-out-of-range")),style:(0,De.Z)((0,De.Z)({},ce),St&&!gt?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof Ln=="string"?Ln:void 0}},hidden:Y,readOnly:me,onClear:G},m.createElement(ze,(0,N.Z)({},$e,{autoSize:we,maxLength:Ne,onKeyDown:mn,onChange:Wt,onFocus:Qt,onBlur:Ot,onCompositionStart:pt,onCompositionEnd:Tt,className:ee()(Te==null?void 0:Te.textarea),style:(0,De.Z)((0,De.Z)({},ke==null?void 0:ke.textarea),{},{resize:ce==null?void 0:ce.resize}),disabled:le,prefixCls:Ce,onResize:Sn,ref:Pt,readOnly:me})))}),w=S,P=w},29125:function(Ut,at,O){"use strict";O.d(at,{G:function(){return ne},Z:function(){return z}});var N=O(92310),re=O.n(N),De=O(59301);function ne(I){var C=I.children,U=I.prefixCls,H=I.id,J=I.overlayInnerStyle,he=I.bodyClassName,X=I.className,oe=I.style;return De.createElement("div",{className:re()("".concat(U,"-content"),X),style:oe},De.createElement("div",{className:re()("".concat(U,"-inner"),he),id:H,role:"tooltip",style:J},typeof C=="function"?C():C))}var $=O(32855),g=O(27247),ue=O(43079),ee=O(65030),l={shiftX:64,adjustY:1},j={adjustX:1,shiftY:!0},A=[0,0],p={left:{points:["cr","cl"],overflow:j,offset:[-4,0],targetOffset:A},right:{points:["cl","cr"],overflow:j,offset:[4,0],targetOffset:A},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:A},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:A},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:A},leftTop:{points:["tr","tl"],overflow:j,offset:[-4,0],targetOffset:A},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:A},rightTop:{points:["tl","tr"],overflow:j,offset:[4,0],targetOffset:A},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:A},rightBottom:{points:["bl","br"],overflow:j,offset:[4,0],targetOffset:A},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:A},leftBottom:{points:["br","bl"],overflow:j,offset:[-4,0],targetOffset:A}},m=null,y=O(80402),x=["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(C,U){var H=C.overlayClassName,J=C.trigger,he=J===void 0?["hover"]:J,X=C.mouseEnterDelay,oe=X===void 0?0:X,_e=C.mouseLeaveDelay,ie=_e===void 0?.1:_e,ze=C.overlayStyle,k=C.prefixCls,S=k===void 0?"rc-tooltip":k,w=C.children,P=C.onVisibleChange,W=C.afterVisibleChange,K=C.transitionName,_=C.animation,v=C.motion,D=C.placement,Z=D===void 0?"right":D,fe=C.align,ye=fe===void 0?{}:fe,Oe=C.destroyTooltipOnHide,Ne=Oe===void 0?!1:Oe,ve=C.defaultVisible,Me=C.getTooltipContainer,Ae=C.overlayInnerStyle,dt=C.arrowContent,Ce=C.overlay,rt=C.id,Pe=C.showArrow,ut=Pe===void 0?!0:Pe,ce=C.classNames,le=C.styles,Y=(0,ue.Z)(C,x),Te=(0,y.Z)(rt),ke=(0,De.useRef)(null);(0,De.useImperativeHandle)(U,function(){return ke.current});var Ke=(0,g.Z)({},Y);"visible"in C&&(Ke.popupVisible=C.visible);var G=function(){return De.createElement(ne,{key:"content",prefixCls:S,id:Te,bodyClassName:ce==null?void 0:ce.body,overlayInnerStyle:(0,g.Z)((0,g.Z)({},Ae),le==null?void 0:le.body)},Ce)},q=function(){var we=De.Children.only(w),Le=(we==null?void 0:we.props)||{},$e=(0,g.Z)((0,g.Z)({},Le),{},{"aria-describedby":Ce?Te:null});return De.cloneElement(w,$e)};return De.createElement(ee.Z,(0,$.Z)({popupClassName:re()(H,ce==null?void 0:ce.root),prefixCls:S,popup:G,action:he,builtinPlacements:p,popupPlacement:Z,ref:ke,popupAlign:ye,getPopupContainer:Me,onPopupVisibleChange:P,afterPopupVisibleChange:W,popupTransitionName:K,popupAnimation:_,popupMotion:v,defaultPopupVisible:ve,autoDestroy:Ne,mouseLeaveDelay:ie,popupStyle:(0,g.Z)((0,g.Z)({},ze),le==null?void 0:le.root),mouseEnterDelay:oe,arrow:ut},Ke),q())},F=(0,De.forwardRef)(M),z=F},49658:function(Ut,at){"use strict";at.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var O=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(O)||/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(O==null?void 0:O.substr(0,4))}},83145:function(Ut,at,O){"use strict";Object.defineProperty(at,"__esModule",{value:!0}),at.CopyToClipboard=void 0;var N=De(O(59301)),re=De(O(25769));function De(I){return I&&I.__esModule?I:{default:I}}function ne(I){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ne=function(U){return typeof U}:ne=function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},ne(I)}function $(I,C){var U=Object.keys(I);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(I);C&&(H=H.filter(function(J){return Object.getOwnPropertyDescriptor(I,J).enumerable})),U.push.apply(U,H)}return U}function g(I){for(var C=1;C<arguments.length;C++){var U=arguments[C]!=null?arguments[C]:{};C%2?$(U,!0).forEach(function(H){F(I,H,U[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(U)):$(U).forEach(function(H){Object.defineProperty(I,H,Object.getOwnPropertyDescriptor(U,H))})}return I}function ue(I,C){if(I==null)return{};var U=ee(I,C),H,J;if(Object.getOwnPropertySymbols){var he=Object.getOwnPropertySymbols(I);for(J=0;J<he.length;J++)H=he[J],!(C.indexOf(H)>=0)&&Object.prototype.propertyIsEnumerable.call(I,H)&&(U[H]=I[H])}return U}function ee(I,C){if(I==null)return{};var U={},H=Object.keys(I),J,he;for(he=0;he<H.length;he++)J=H[he],!(C.indexOf(J)>=0)&&(U[J]=I[J]);return U}function l(I,C){if(!(I instanceof C))throw new TypeError("Cannot call a class as a function")}function j(I,C){for(var U=0;U<C.length;U++){var H=C[U];H.enumerable=H.enumerable||!1,H.configurable=!0,"value"in H&&(H.writable=!0),Object.defineProperty(I,H.key,H)}}function A(I,C,U){return C&&j(I.prototype,C),U&&j(I,U),I}function p(I,C){return C&&(ne(C)==="object"||typeof C=="function")?C:y(I)}function m(I){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},m(I)}function y(I){if(I===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I}function x(I,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(C&&C.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),C&&M(I,C)}function M(I,C){return M=Object.setPrototypeOf||function(H,J){return H.__proto__=J,H},M(I,C)}function F(I,C,U){return C in I?Object.defineProperty(I,C,{value:U,enumerable:!0,configurable:!0,writable:!0}):I[C]=U,I}var z=function(I){x(C,I);function C(){var U,H;l(this,C);for(var J=arguments.length,he=new Array(J),X=0;X<J;X++)he[X]=arguments[X];return H=p(this,(U=m(C)).call.apply(U,[this].concat(he))),F(y(H),"onClick",function(oe){var _e=H.props,ie=_e.text,ze=_e.onCopy,k=_e.children,S=_e.options,w=N.default.Children.only(k),P=(0,re.default)(ie,S);ze&&ze(ie,P),w&&w.props&&typeof w.props.onClick=="function"&&w.props.onClick(oe)}),H}return A(C,[{key:"render",value:function(){var H=this.props,J=H.text,he=H.onCopy,X=H.options,oe=H.children,_e=ue(H,["text","onCopy","options","children"]),ie=N.default.Children.only(oe);return N.default.cloneElement(ie,g({},_e,{onClick:this.onClick}))}}]),C}(N.default.PureComponent);at.CopyToClipboard=z,F(z,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Ut,at,O){"use strict";var N=O(83145),re=N.CopyToClipboard;re.CopyToClipboard=re,Ut.exports=re},76374:function(Ut,at,O){"use strict";var N=function(){if(typeof Map!="undefined")return Map;function k(S,w){var P=-1;return S.some(function(W,K){return W[0]===w?(P=K,!0):!1}),P}return function(){function S(){this.__entries__=[]}return Object.defineProperty(S.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),S.prototype.get=function(w){var P=k(this.__entries__,w),W=this.__entries__[P];return W&&W[1]},S.prototype.set=function(w,P){var W=k(this.__entries__,w);~W?this.__entries__[W][1]=P:this.__entries__.push([w,P])},S.prototype.delete=function(w){var P=this.__entries__,W=k(P,w);~W&&P.splice(W,1)},S.prototype.has=function(w){return!!~k(this.__entries__,w)},S.prototype.clear=function(){this.__entries__.splice(0)},S.prototype.forEach=function(w,P){P===void 0&&(P=null);for(var W=0,K=this.__entries__;W<K.length;W++){var _=K[W];w.call(P,_[1],_[0])}},S}()}(),re=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,De=function(){return typeof O.g!="undefined"&&O.g.Math===Math?O.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),ne=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(De):function(k){return setTimeout(function(){return k(Date.now())},1e3/60)}}(),$=2;function g(k,S){var w=!1,P=!1,W=0;function K(){w&&(w=!1,k()),P&&v()}function _(){ne(K)}function v(){var D=Date.now();if(w){if(D-W<$)return;P=!0}else w=!0,P=!1,setTimeout(_,S);W=D}return v}var ue=20,ee=["top","right","bottom","left","width","height","size","weight"],l=typeof MutationObserver!="undefined",j=function(){function k(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=g(this.refresh.bind(this),ue)}return k.prototype.addObserver=function(S){~this.observers_.indexOf(S)||this.observers_.push(S),this.connected_||this.connect_()},k.prototype.removeObserver=function(S){var w=this.observers_,P=w.indexOf(S);~P&&w.splice(P,1),!w.length&&this.connected_&&this.disconnect_()},k.prototype.refresh=function(){var S=this.updateObservers_();S&&this.refresh()},k.prototype.updateObservers_=function(){var S=this.observers_.filter(function(w){return w.gatherActive(),w.hasActive()});return S.forEach(function(w){return w.broadcastActive()}),S.length>0},k.prototype.connect_=function(){!re||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)},k.prototype.disconnect_=function(){!re||!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)},k.prototype.onTransitionEnd_=function(S){var w=S.propertyName,P=w===void 0?"":w,W=ee.some(function(K){return!!~P.indexOf(K)});W&&this.refresh()},k.getInstance=function(){return this.instance_||(this.instance_=new k),this.instance_},k.instance_=null,k}(),A=function(k,S){for(var w=0,P=Object.keys(S);w<P.length;w++){var W=P[w];Object.defineProperty(k,W,{value:S[W],enumerable:!1,writable:!1,configurable:!0})}return k},p=function(k){var S=k&&k.ownerDocument&&k.ownerDocument.defaultView;return S||De},m=J(0,0,0,0);function y(k){return parseFloat(k)||0}function x(k){for(var S=[],w=1;w<arguments.length;w++)S[w-1]=arguments[w];return S.reduce(function(P,W){var K=k["border-"+W+"-width"];return P+y(K)},0)}function M(k){for(var S=["top","right","bottom","left"],w={},P=0,W=S;P<W.length;P++){var K=W[P],_=k["padding-"+K];w[K]=y(_)}return w}function F(k){var S=k.getBBox();return J(0,0,S.width,S.height)}function z(k){var S=k.clientWidth,w=k.clientHeight;if(!S&&!w)return m;var P=p(k).getComputedStyle(k),W=M(P),K=W.left+W.right,_=W.top+W.bottom,v=y(P.width),D=y(P.height);if(P.boxSizing==="border-box"&&(Math.round(v+K)!==S&&(v-=x(P,"left","right")+K),Math.round(D+_)!==w&&(D-=x(P,"top","bottom")+_)),!C(k)){var Z=Math.round(v+K)-S,fe=Math.round(D+_)-w;Math.abs(Z)!==1&&(v-=Z),Math.abs(fe)!==1&&(D-=fe)}return J(W.left,W.top,v,D)}var I=function(){return typeof SVGGraphicsElement!="undefined"?function(k){return k instanceof p(k).SVGGraphicsElement}:function(k){return k instanceof p(k).SVGElement&&typeof k.getBBox=="function"}}();function C(k){return k===p(k).document.documentElement}function U(k){return re?I(k)?F(k):z(k):m}function H(k){var S=k.x,w=k.y,P=k.width,W=k.height,K=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,_=Object.create(K.prototype);return A(_,{x:S,y:w,width:P,height:W,top:w,right:S+P,bottom:W+w,left:S}),_}function J(k,S,w,P){return{x:k,y:S,width:w,height:P}}var he=function(){function k(S){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=J(0,0,0,0),this.target=S}return k.prototype.isActive=function(){var S=U(this.target);return this.contentRect_=S,S.width!==this.broadcastWidth||S.height!==this.broadcastHeight},k.prototype.broadcastRect=function(){var S=this.contentRect_;return this.broadcastWidth=S.width,this.broadcastHeight=S.height,S},k}(),X=function(){function k(S,w){var P=H(w);A(this,{target:S,contentRect:P})}return k}(),oe=function(){function k(S,w,P){if(this.activeObservations_=[],this.observations_=new N,typeof S!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=S,this.controller_=w,this.callbackCtx_=P}return k.prototype.observe=function(S){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(S instanceof p(S).Element))throw new TypeError('parameter 1 is not of type "Element".');var w=this.observations_;w.has(S)||(w.set(S,new he(S)),this.controller_.addObserver(this),this.controller_.refresh())}},k.prototype.unobserve=function(S){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(S instanceof p(S).Element))throw new TypeError('parameter 1 is not of type "Element".');var w=this.observations_;w.has(S)&&(w.delete(S),w.size||this.controller_.removeObserver(this))}},k.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},k.prototype.gatherActive=function(){var S=this;this.clearActive(),this.observations_.forEach(function(w){w.isActive()&&S.activeObservations_.push(w)})},k.prototype.broadcastActive=function(){if(this.hasActive()){var S=this.callbackCtx_,w=this.activeObservations_.map(function(P){return new X(P.target,P.broadcastRect())});this.callback_.call(S,w,S),this.clearActive()}},k.prototype.clearActive=function(){this.activeObservations_.splice(0)},k.prototype.hasActive=function(){return this.activeObservations_.length>0},k}(),_e=typeof WeakMap!="undefined"?new WeakMap:new N,ie=function(){function k(S){if(!(this instanceof k))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var w=j.getInstance(),P=new oe(S,w,this);_e.set(this,P)}return k}();["observe","unobserve","disconnect"].forEach(function(k){ie.prototype[k]=function(){var S;return(S=_e.get(this))[k].apply(S,arguments)}});var ze=function(){return typeof De.ResizeObserver!="undefined"?De.ResizeObserver:ie}();at.Z=ze},98040:function(Ut){Ut.exports=function(){var at=document.getSelection();if(!at.rangeCount)return function(){};for(var O=document.activeElement,N=[],re=0;re<at.rangeCount;re++)N.push(at.getRangeAt(re));switch(O.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":O.blur();break;default:O=null;break}return at.removeAllRanges(),function(){at.type==="Caret"&&at.removeAllRanges(),at.rangeCount||N.forEach(function(De){at.addRange(De)}),O&&O.focus()}}},93314:function(Ut){"use strict";Ut.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAACaCAYAAADl9acYAAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQd4U1Ubfs/NaJtO9kzLahFQEJkiUBBFUFFkCCjiAAVFERT5FREQQQXBBcpysWRP2RtkKRsEOphNodCZdDfjnv85CU2TZt2bhABNDw9PmtzvrO+c957xLQIP0pkz1yrQIEmwwcDzHhTj91klEo7jpcG5zetWUJdmRjmPvTM9GI9JgSGvadOoLE9KJJ5kPp2YXLtZdO1kT8ooz2vigCNelvPYezPEG7z0CDAn4pJqPvJA5A3vdcl/S3LEy3Iee29OeIOX5YDx3nh4VFI5YDxin6DM5YARxKb7g6gcMHd+nMoBc+d57LKGhCQ1ZURBCoVL2nKCO8sBZWW50x1TOWDuLP8FlV4OGEFs8glROWB8wmbPKikHjGf882bucsB4k5t3qKxywNwhxrpRbJkGTOx0ehlA3d9e5VEtzA3ulGe55zmg1QOfrCVo34BgQGvr5rLDRl4RRZG+5NjBESBc4FHw1LlrCAuPsCo0JjKi7J5hYqfTXADBq4byCJLf82Nf3kA3OfD9LgKdgeCzZ4CUTJ1VKQFyKQgpmeMSjiKvQC+oplspN/wOMDcBVFv0Bo+KwYJ4VE50H3Jg7j6CWzkEX74A3MrSgTfeKZpSaBCHcAVn/JunBHlFPDR5BkG9LMjPt7mZLOtbskQADea9wqOW9coqiGHlRPcHBxYcJriQQvB9P+v2cqCwWFxgoOJk6JeTNX4HmJMAHv6xP4/6VXw/+OxNx/bM/pIohdUE9VW/VxwjOHiJYO5A6xolpGSpYW3jIW4w/A8wM+h+UHSY2pvHgzV9NXymeor0wPc7Cf7XzWJ/4Nsm+Ly2LzZx+OwZ3yuVbzhNsPEMwcI3rM8wMikHiURi5gNbbQoKrc84zpjkj2eYzQC6f96DomUd305ctrp8tp5gSk/f1utzlFhUOHYthy9f8D1gdpwnWHiEYOVQ6zNM6QM/AY+CImHnF9YtfwTMCgB9P+5G0SHa9xP3bk2gT9cBU3r6Hjp95nBYNcz3gDlwkRhX843vlfS59PmFHfjFzgC/2pJ1nEEnEIpIAG+834Wia2Ox7PJ8wt0twLz7J8Gsl3zf316zCVYPsz5oe85F1yUcu0YwcQPBjlElZyjL8wsrQeyBn+XxK8DETqefgyACFCPe6kjxfDPfT6C7BpilBLMG+L6/A34h+P1VikCZ60nuTYpzN4AxqznjCqPOMZ1RSp9f2OVLYZH1lbOrNvjVlswIGEAKYOyrj1K82NL3E+huAWbEMnbFSn1+Qzd4AcE3fajPZV6X04D3lnHGM4xOawKFJwLLYiD5H2AoCkHwJQMLA42v090CzJjVBBN7UCh8rN3AgDrqCYq6lX3L6RQ1MGQRhwWvA7UrALbnFzCJjOhG+d2WjFCkUYKZPZpSDIv1PWDGrycY34NCahI0+yxN/Ivg3c4UlUN8VqWxok/XEfRrSdG0tm/rzcoHBv7KYc5AILqqLWDcOb/45RmGEFyhFL8/0Yga33y+Tl9uJhjxOEVIoG9rnrqVKSJSRFb0fb3tG1A81sC39TLRSu85HL57Eaii0Bm3oqEKqZXSJaUURUxTU0Tyuy0ZAc5SYCUbxE+6+x4w3+0kGNiWooqP3/Qz9xB0bUTRsLqI2eEFUlbvA9WBJxv5ltdMit9jFocpLwB1InQIkBEQTmLUHStOBoMBOr24K2+/AwwPHOKArS2iKCY9VzKIg34jyMgTv6f1wpwqL8JLHKgUTLHwjZIxZTKg0V2Bzg2tLzvYBYA75xe/25J1mkEnGAzYyXE40KQmMK23uLeLN8b1j0ME7epTxFTzRmnCy/jzXyCqIny+NVryDzFeKfd+xLcrDOMMO8MMfgx45iFrOZA7AstiTvvVoZ91usM3tClHcLpeZWDmAN8DZtlRgkY1KJr5+BC87hQQLAeebCwcZN6gXH6MgG2P+rfyDmD+WLoV8xZugkIRiNh2TTHghcfRoF4tFBZpkXgpGQ81rmdu9puLOLzwMPBYPR1Cgzw/v7CC/WpLxjrc/jtaT2LApRrhwC+DfA+Y9aeI0dKzbT3vTCChk3r7eaBABzzfTGgO79CtPUmM9b7U2jv9bf3kOyjSlihLcoSg93MdkZ2Th227j2Hoq8/inTeeNzZ+xFIOsTHAsw/pAeL5+cUvAdPuG1pVRnArQgEsGex7wGw7RxAgBTo19M4EEjqtD1wEkrPYm15oDu/QbfkPSM0hHsu8du0/gSnfLkFGVrbThjFLynULJ6FOZHUw2RNbyd/qUJLFHZV+ywr9aksWO4Ou0BK8KueRz/bVq++CUuD+RGbhB3R/0LeAOZEEnFIRvPGYb+vdGw+cvU7w3uOe1dv+mfeRk5svCMUfvz8AA3o9jgkbCJQVgPe7lGTz5MDvj4f+VXs/JH1ip1PmAkHy17u8z42bjl4lxjf9C809m0CCZo4FUVwKsDPOJLz0ZTp6Fdh6jtnWe1bvuCm/4q/tRwQ1/b03e2LIwGfw1RaCkADg425AOvPkYCHZd0cG43dbsk4zaDFgWHiHcG85wjBQoEhnMhAzf5r/Jihkf9/+fjXDtDXqGA108+Eqcy0DYAfwMU95NnEFzVgLovibwK8HCab19qze61s24Pf5K7A5KwB5vHM1CblMij9m/Q87rtc1jsek54CMPIBayGD0BgP0ImUw/gwYFiqjllhHGAcvAkuPcijU8cgv0KGgSGv8LNJqweu1MOh14A3ss+S78W+Dzuo3RsPoTy0YgIjQALFz0C36tBzg570EE3p4NnHFVn5TA0zaSPDzy57Vu2bIS6jF67BDHYBHgnVI0kow+6ZjLyZNm9RD+35jkZINfNO7ZIVhEn+e16NQ6157/OqWjJ1h9n1IXoydTi8AeGD+KzxqinCEsfkswfBJC2HQacXOG7v0B+e9CGXVUK+U5aoQdm5iE3eqh296R/XoDEBu0e3/hcz3FzF+Z292trI91Zgav7N2tKrDrrfFTdgTI4dAl61BipZDDXYINRCMvBrusNvBikAMHT8LTM3/pwElK4xMAuQV6uBuKK4yA5hEVfY8SvmmHCETGyjDtzqbQLHf0KMgaCnWEcaW/whGT1mAHHZP6oW09bueaFy3khdKcl0EO+y+v4xgphs2MWxbs+K46bLCDIoi6+9iVLKY4PbTp8UB5t8h/UB53qimz1aJA9lyLExz7H1vyMCnUa15L/x9EfhtkIk/nh74y9ShPz5JnUGA26qFZIdcTofWqR5xxd5Uip1O9wDoJNYRxs4LBB9PXYxUdaHrGSqAYuWUp9GmSQ0BlN4h8cTq8qVfOGgKStpBeAoJb4DEYPrPsU89b/5e/LvEYPubLCIQX06NEtWpfwa/yA4h0FEgqVCK71OCUeTARdLLfbpg9PAXsfGsBBtOA0uHmKpyV0PZsqFl5lo5QaXWgRqNw4pTHiEYGa2M+KX0yMROpxsA9BDrCGNvAsG4GcuQdMt45eJx+nXsk3iyNbOY9k161wOry8/GqZCr1t4GBA/O3T0Nm7gSDl/89IBRHiU0nRk3CgU3knEmT4pZN51rrjI5TN2oGmCOMP44BKx7B8jINemP8ZRCK2Y5LNXAMrMlS0hSpwKw9TRGME+XHf5ekybEfPCInU7/BDBArCOMw5cIPvt+JRJUGqHj7JRu2rsd0P+JGBuanELTTVpwwO3/cnjFxNcTwMz95hquxud5pd+skIEfR6NJA+F2y6o1S3Fj4xpj/X9lBmK7OsDuChMUKMf+v36AXC4Fc4QxYwew/X0gM8/k5VKvN0BvcF9gfc8CJuGWuh4twgoQnJSBzK+nDP+3eLTsBahJSNL8DdD29kaUAFsDSU4vpVJp3FTETqdzAbwl1hHGySSCCTPX41RimlcmzthBrTCsV1Obss5cJ2hWXQupTIoiHUW+1nRYZkcn5kRbTzlIOQq5hBmimfRu2RwoeU4gl5rAFiI3Odpmb/NRK0zXu+zgKzZtWZWK/VvTxWZzSP/EK5HoEivcxsFQWIBzk8caVxmWmMT+g6thNlfMg/p1xYfv9DXSMEcYEzYAu247wnBXQ9myE/fslixRpf6FUgw2N5bgDChmk6Lw33MMqkqlg8JeVKmn8hRjHI0QIdgbiJynGWhiZ9AZoPhgaEeK50Q4wmDCvwmzt+HwGe8EcH67V1N8MshWV4UBpnlNLQID3Lcn5nkKrZ6iUEex4azEqC08di0BW1XDgsTP+2NHsrH6F+/0m9Xetns1PN9b3IWHPi8XyetXIOPoEeg1WbhYKMGK9CCoiiSoWq0SnuvWzqhLVuyoz+wI411mmi3epZI9Lt2zgElIUht9INtpdDJPMUsSGf59NCFFxc8TknI6AoZ9LqbCmj+V4X33zMAEAOMHtaXoJ0KLVpUJjJuzD3v+vSh+xtnJ0ffxaMwY0dHuCtO8pg6BAcK3LI4axCTai/4hRsBM3kww5DGK6o5vYx32S52pw9QxbEi8k6o2DMeoj2q5VVhqNnB29JsI0TP5M6Dj5Gg7dwmkpVZOsyOMtyg4joDyBhRq3d+Osbru3S2ZSp0LCmf+9ZM5CUY3qBWx3LREUy5RpbkKQOl0FAimvrksPAME08Q6wmD74DGz/8H2A/+5NdClM8U2r4VFE7rZBcwjtXQIkHsOGLbSLP7XBJhvdxD0fJiinhs+pVk5n41IBM/UFryQSHggvpxRooovpsgdFwjoD8MQri3ZIso/XYzm9a2FwDfUAFPxX/AaRYSCeCR/KW7fvQuYJE0RQF3vSQh2UQn3bsOaYXEJSZrPADrJBfP5BceCVx+4LO0r1hGG3gC8//Np/LXrmJjxdUhbv1YE9vzU22eAmbOPBRmieNCNFzvP8/jhaxVSL3vn4M9zBJN/bgSZgJsyplZ0KQ24oSZgq8vmE4V4+9hrkNIS8O5uPhbNOz+CprWpWRhd7Ahj9svMYM871rT38pbM/q2XvelHoeU4bpxBgt+Jjr8MAqfi80NXZEW/H1UEuOMIY/zCRPyxZr9XABMSJMP5pbelahYlsjNMi1p6402Pp8lyhWEhIBpVp2hdV1yp6nwgPAhYvzQF/+zOEpfZCfXgz6LRIMrxKsq0B5YcKsL6UxRFvBygelBdLjhZGMCx/RfTKWMCUGZzbAClvJEmtiGH97oEGLdhzBHGjL4UDyvLOmBUmn9AaamAay7GimAXgdErzG1RlX36k9el+PlgsPFtK9YRxtwtNzBl7havTZoLywYhuJRbSCNgauvBlAg9TQYDjyVHOeOWbOVxoEoo0Mn2JttpNZvOcmhfn0KTXoTr8TlITSnCrRSt8TMvV7gj79KVPDskCo+1tb/rZkLScavzcTlTARBrZUu+MB1coHNHZ8rQXEzvH4T+8yWY9DzQrj6QptFDzzRlPUj37JbM5pZMeCfZK5CNgsPt3PlbEny3LwSlHWEIqWLzcTWGfbFaCKkgml0zeyNaaa3QdqcAs+msSa2k+4OCmmYm2nyWQ98W9idabo4eqSla3EopMn6m3mRgKkJ6KlM6dV5Plz418ES3CjZE7Ar9w2X5UGXbv3bmC1NBAiqBEOf34zFhKlzLq40PuxK0i8qFutBzRdd7FjDx1zSDCKELxA2tmZoyyztqqc9tUdDlDAm+2hUCdxxhHIwrwOAJy5EvIkSCsz78Nq4rnmhpfU/BANOytgEydwQmpSpjQro/b68we+JNArzej4jjKouz0q+luDwGAzWCxnI1Kr0qPfpEZTzXv6pVwUzf6+MVBTiX6vi+hxoKQfUF4AJswWZZGF+UCUN2IsYMaINnbcVd4jp0m/qePcNcvJlTldcaUm5vVN3qnKNM1zUcJm4LhTuOMP65qMWYGWtxJcU76jGT3nwUrz1j7ZnCCBilAbLS96RucIFJtv88ZpLD/HMZSEgFXmkrrqANp2yjEYsroYRar6f44I3zxh9qNwnH8FHWNxBLj2ix6F85SKltmGV9lBrAF6RConCuh8fotCn7MSC2Fob3ELkPddDBexYwrL2JSZqtFPQpdwfHUT7mf+zjTWFwxxHG8St6zPhtCw6cZXcSnqdhLzTF2FethZcMMK2UBki9DBgmbz18mYAJbMUk5shiYBsxORzT5ucZ8PHbcUaC4OpBGDe55AbiShqP9/40gHLOt058UZbxXMPJnQuUKK+DLi8DEs0R/PJBLIIVwjULHPXgnt2SsQbHq7JeIJSYFIi8mNgeeeT6cFRQAItFOsL4L5li0do9WLrLriK06FZ2e7QO5v3PwugcgDcBo9MbsPT2CnMxFcYwdiNFuMhlKjcs/J23AMMEoONHJhj5JA2T44tvS2TTo5cX4kKqY5X9YuYacq9CEhzlMngmr8uGQasFLUpDPcUV/DCiKwrcNBwrrvueBsyKFVTSvG32aQraRPRMdJKBWaa+vSrcqNAo1hEGsyD8Y/1R/LzmjFea1EBZAbtn9rIqywiYSB5Siecey3U6A5YeN23JmCCPORIcK8IWhV0ps1Wpj8hzjyPmsDPN5P+ZNCWInMOXPz9g/PtgohZfbpEZ3SE5TxSGXBUkIa61vPnCDLCzFEuGrOMY1q02Xunq2VS6p7dkrKOJ17N7UAPP1PG9moatCoOBJ9go0hEGe+P+vC4e3yw84JX2VAoLxMmFL9sApnUkD4kXAKPV6bHsuNQIGDb5p28nmCwixmZSJnA5jeCZh1x3NzfpKi7M/xlFGRmo0qoNqnfohPAG1mcH1dUCfDP+sqkwjuCreY2Mf478swiJGa6V3Az518EFVgHhXMu0DYUZ4G8Dhuqy0Sg0EfM+8myHf88DhjEzIUmzAaA9XA+ZcIqR60KRp+XgjiOM3Sdu4s0vtyAkSIrgQCmCg6QIYZ+BMuPf7Dfzs9vP2bPi34ICZTh2szJ6NM41HuyrV7f2G8tWmNZRPCSc5yuMJWCYGcjHawm+7Sv8DPPfdSBfS9C5oWveHhg+GFqNyfRBEhgIeWgY2kz7AZysRDh5KT4fP0y5vZ0lwBdzGoO9FwbOK4S6KMDpCkP1eaD6fCNghCSDNhe8zmTsVznrMD59XIGa7Wx194SUVUxzT2/JihuZmJJThWoNZ0HgNY/EH28MRUY+B7GOMFibcrJzkJuXB3Z1zXHc7U9ivNlh0mX2aXpm/7ekLA57E6R44zHm5slWAs0A0ybKpDDoaWLhHJafMK0wLIm1ujx0iYD56WgrQO3ryuplSN6xzajkqM83+RCr1aUrol95A5zUJIT971QO5n2bZPybXYRNntsYvx4guLJrL1qkbsD2moOQHP6wlUskRkt5PfiCm5AEC/exa9DmgNcVoVL2KQy59RsqhAQg6tPvwAU5U1F0zvH7AjCsC4mqnE6UGpitvsfSJ0IIHb8lmNzIlkCsIwxPJzDLf10NrDtJMNyBjzDvAkaH5SdkbgOGOf5oVAN4sKawnl+YOwspf+81EzPIh9VvgCbvfoDAKlVx9JAai+ZcNz4PVBBE9W+M07uPo9/laeBgknSeC22ObbVeQ06QCRzselivuQhZBNveCX+JGAoyEZEThyE3fkIYNa00yh69UPdF6y2wsJ6ZqO6LLZl5pUlW9wHFMkrh6mTokgdf7QzG5UwpxDrCcFmwAAImPPztIMHorva3RkbA1GEhGoRPDkfVMj/EVoARaabM2vliCxj9QQtJ1GDAtU3rcGPXDmjVWWDfWWJbtHp9BiCwRScU6KQICJRg4VEp4g8ex4tXvrFSpGT0JxXNsKraIEgVFaHLuQ5ZSE1wAeLsEioRFZ5PnAVlTok5hiQwCG1+mAupwr1V5r4CDGNkgkrzEij93Znqi5CB/XafAhduySDWEYaQsl3RFGiB6Tsce4NkgGlbx+WtqatqjM9ZlOAVJ0tWmPeWEvzYX3gYcOY9cuKzsLE1EVK5oagQJ7/4DDlXS67gZTVqI6dlXxwNaIXrJ06j75UZkFhoHbNyK7Zqh2E3usHAlCupDgFhtSAJEmdsxsqJqZSHevmJaHPoC6vm1nvpNdTu7t6R+L4DjAk06t7M+tKuDb+QkQTw00EFTl2XQawjDIHFOyVj6h+frSeY4uC2it1MRVXgIeUIpBLTWcjdxMJArDgpN2/JPlpF8PlzwoPDjl9v0vZ1N2k1apz+ehJyVaZzS3HimUMKIoWUWrusqtDqUTR46308/bUKekghU1QBkbq+PbPXPkNuEog8DAOS5+ABzVEzSWj9GDSf+JVbXbovAcNs+oODFYSjsp8oqCm2gcj06z9BOHJNbjTZ7RDt/oQQWa2ZXEw0ZWY1yYzYGdCYuj5L7AJNwgBlvHRgj3mjnfvtx0YlS/Zcp9dj6wU5nmpiysccdLMYm5UECr3HruHwQ3/P+KPLzcWZ6VOQfdG5xWbVzl0R9fJgEI7DjO0Eu85rQSTuH1lbV45HbmYSzl1OR+2im4g0ZEJpyETdAC26zpnv1tDdt4AptulPNJ1rplMKUY6uFh8PxL5LARDrCMMtLtvJJAYw3qqTlcOCw7JYLUoBwWHZWWvBIYJxz3jeAiZxv7R0AZJ3bIetdT1B7T4voebTPc0VMbe2G08Wur26sII+6JyD5x4JQU6+FkfOp+DA2es4fO4GsvO1qFk5BE3qVEaTupWNn9G1K0AmILT1fQ8YxhhKqfTi9ewBoPQjSiFAxAasOh2AbfGBRr0qMY4wPJ86phLuFmBm7ibo2oSioYAL+uPXgKvpBIMe9VavgctnE5C7fyuyz58Bc2oRVKMWaj7XBxVbWGuELjxMsOxIAYjUtaqMo9Z90CkHz7WwXkoNPMXZy2k4ePYGDvx3HVdSTHIjBqCVn7verJQJwBQzjKnzJyRlPcZJuJ6UxwsAHEoP/joXgA3nAiHWEYa3ps7dAgyTeTwSRdHcuecDYzdXHCN4oBrwaH3v9Fqr55GWmY2ICNe3XWtOEvyy17MVZmRsLnq2dH4bdv5qBt6Ytg3d29TDOAFvhjIFmNLDGp+c1UxCycs8xTu3jcrMJDvi5VhxOghiHWF4Z+rcvRXGGBy2EvCYABB8sZHggycpqoa6f+lgya/MXC20RUUIDXV9gGJueb/d5tkZ5r0OOejd2nldm/+5gkkLDuOzQe3QrY1r2+0yDZjiwbp4PUNJeelKSqlZSX3/ZRkWHVNArCMMbwFm/AaC8c9Qt65rPWkDCw7Lggw9YVLhcprWnCCoH5qKGmHUaC4tl8sgl0kgl7FPqWhdt6upuQiWc1AoXN96MSd849ez62/31YPeeSwHL7Z1DpixvxzA7hNJWP9lL1RmjgtcJL8ADOOBSkWDCqiGaQoYlYn+TZJh/hEF3HGE4YqpQp7/sC0PrzRPhYxPg9yQjmCkoTA/HUV5aZDq0wBZBQQ0my6kKFE028/BGODpOYHBYfPy8qDT6aDT6Y2flolpUxeDhznscAWkfxKzEFNDAbncteIk8xIzYinxSBj1VrtcvPSo4y0Zs0Z96qPVqFpBgcXjnhXEx/saMCZfZNmTQCjTmZCAEC0oUglPU3iOnDEYtCcb16nCrDaN6ZxKU1HK0xOEIOrMDSlmHnDPEYZLzhoKAW0aivLSQXRpCKRp4HTpKMxNAy1KN36XE+cRAHjKIb/pckhk7h967bXz70STao47wWHZ9bZebwJOMYDY38Zrb4vEtKwZeAKMq5IJSDKZFOuPpqFr8yqCNBjYDd3AXwwgnPu+2Qa3zccrjzleNY7G3cR7P+7G8+2jMWaAMH8r9zVg4pKynudA1jmawExnjKf8fwRkAwF+j46MuJSoyupEKdkdnyoh0/e65wjDUX1c3MdA3hUEEO+YL6fU+BwRNUQa07tAM7v5OpNM8LoXg8PqDXrotHrojUDSQafXgXmrKZ3i0uV4vKkwiT2TJ/WcqYWBBLp8PzkieK1NIV5r71iO8/2qE1i2O8542GeHfiHpvgbMRVX2RzzlpwnpKCGEOa76i5dynxCeTriaTvpP2RnqliMMhwC9MBaBBaeFNEcQTU7FvpDWeU0QrVCiCynA7jjHip9Cy3FFxxz/mVYi0//sPD2u5wWgXUOBSmkAXvtVj7R819s3R215ta0Orz/m2FVVnwkbkJyWa7xOZtfKQtJ9DZiEpKzXAfKbkI6W0JAiQrDyZjZ5adyWUM4dRxiO6qOqRVCkLRPXHCfUt2gjhLXw7jmGBYdl18Uf+Tg47K4LBCz0uZh6P1oJnL/p/qH/5dYGvNnBfv5rN7PRb9JGVAoLwoavrC1enQ3gfQ2YC1ey6kil3CV2lhE7S7MKuMIxf4UGuuMIw1FdhszjCLk6XmxTHNLrqRT5TVdAJnNfPaR04cbgsPsIJjzrmbqL2E4evgxsPy+uXubM7+Vfmbss9661X2lDMdhuABRgyc4LmLnmJGKbKfHlW8KNyu5rwLBBS0zSbKBuWGOyWCoj1rrnCMPRZNEX5SLk3ACmVih2PjmkV9WYiso1RHrec1I7i1HJ5Ct3Kjiso6rPXgeY9P6bPsKB2uSRWKSlZbjNy3FjhuOTD5kIzja9891OnEhMxVs9muHVbsL5e98DJu5ydkNOxh934enfhmPsUDl0ZRgCZUS0IwyHWzJmqPPfcATorrk9yKUzZld5DTKlKUCQNxLr98jlJhV/X6ZrmcBXmwnmDBReb2R0CxQWmiOaiG5uj+5dsOyPH23yMd2ybmNWg6nJfDv8cbRpLDzO6H0PGMaN2zYyi8Q6/Ru+Ogw6A8FfIh1hOBs5evE7KLJ3ih5cRxluSR5FWLNxXiuPFeRJ6D53G5KWC3y4gmDhG8IAw7Ssa9Vlpsrup8jaNXHh+A6bAnYcu4bPfjto/H3z1D4IZ5JcgalMAIb1NVGlHkwpmQ1QwRf3H6wPRU6Re44wHPHXcGMTQm7+LJD9rsnU+soIaO2ux1z75Yu163fdStcUuYXA6wsIVg4VBpjMLDUeaOrgAOK6OjNFcvwhVCiluzbh90PYdvQqqlcMxuovSjSkhRRbZgDDOnsxOaczpYaFlEKQp4Sxm0KQlidxyxGGI+Zqs+IRfuUDIbwXTJMWsxghIc79CAsu7C6Ndg0lAAAdVklEQVStMEws88Jsgg3DhQEmSXUdLdt55hLJuIKs/g2x7UvcdrJtWPcxq40q/h2bKfGViAM/K69MAYZ16NKlzHCDlHwBwr0FUKdr7efbQpCs8a4jjMKCfITHDQRH3d97l578qmqTUblWczGYcErLzjDT+/hej63HLA5r32YOCl135dyFeHTuahtsynVOa4qvPv8II4aVyLJOXUzFsG9NW+bXuz+EISK9lJc5wBSz69KNzEheLxlFQVnEIrvmUlN3B+NiuncdYWi1OsjjP0KQznvxIDVVh0Bem1kreCcZg8N2pwhzX4juVkN6zebwx+u8oHr/OXoCPXrZBpsSW/GAvj3wy6yvzdl+WnsKi3aYnKFPHtIBnZu79qBpWWeZBUxxJ69coYE6ae4zlOqfIyBPM59uxc++36/AuZvedYTBJNz6+OkIL3AVn1b40N8K6oawRu8Jz+CCcvImgiEdKKoLF7p7pe4B8zl8148XVO+uPQcwYNAwj+tt0iga/+4t0Z4a8MUms9HY0vE9ECnUHc7tlpR5wFhyfA+l0lqq7L4A/QlAhTmHgnA8We51Rxh5FxejcvZSjwe7uIAk/cOo0nqK18qbsYPghebUGO7Dl+n1Pzh89iwvqN71G7fhzbc/9Lh5LALCzr+PQVMkR2w0Na4u566m49J1tVElRqyDEb8CTDH3LyblPMhTw67fjwZVPXTV+44wspP2oVq6IBU3QRPiprYWwtvOE0QrhGj2PoKO0dSoR+fL9O5SDm/H8oLq/XP5Gowc7R2tic9/XIlNyU2wY5RH1gJGVvklYFjHL6k0Ty85EbhxV6KceNsRRuatS6h1fYTX5mK+IQR5TZcbDb+8kVhw2MY1KFrV8UZpwsv4ZC3BCw8LC0o7/7fF+HRCydnDWS1FOSmQh1S363aX5XtlxGTEBfbCxveAIMFCB/s1+i1gGDsGL9Cvvpgm6eVtRxgZGZmomTQYHNUKn01OKHlIcEG5AfWE+eB2WefKY0DVMCDWO0G5XNZXTMDOTu3qUzxuinDhNH0/cx6+nGYrpS+diflxLkhPgFRRGfIQ+wzq9OxA5DUei5VDgYruObw0V+vXgOn8LR3L85jibUcY6iw1KiV9CLnhpqt5Ieg5DxkOV16PRyKFyTBcFbrxDPNZJj44rKtyXT1nvsYaVqeC4k1OmfoDfpjl2ncYb9CiMOOS0edyUOVoEGM4cuvUuGkrBHdbgIVvALWs4++6arLNc78GTOx0yq6efvS2I4zs7ByEJY1HkNYUactZ4kkg9FwE9JIKMEgijH8bjN/Z36bftCQcudLaeKC6q9KEPd8dB2Tliw8OK6x0x1Q/7SWoGkrRt4XrksZN/Brzfl3skpB59S9IN13hy0KrQxZkK+ANCQ1Do7ePYO5AoIF1DFqX5Zcm8G/AfENfB8Fv3naEkZubi6CkbxCou2yc9CZARJgBwcCRVlgZV3KC0aSmAhwnQYBcYowHI5FIwIN9MjPfkt/shcUQPdq3Mxy5DLDwfQNFBod1t77ifMyxuVxCBdX7wZgJWLzUdXh3Zh7NtmSgPCQBIQgIt+8/qtmw3fj5zep4yDoGregu+TVgOk2nTNl8pbcdYeTnFyA9U2MMDhQYIIFcwoGTSGCgnHHLECTnIJVIMG2H1BjywtcCRBYc9shlgrdEBocVPbtKZVjyDwGLLyqk3mHvjsGa9ZtdV0k4FGZdBa/NM/JbUcX+wSy692z8PDoWAjwpOa3TvwEzjXajHLa0b0DxSXfvnA9cj3AJxfe7TG5bq4aKyeU5bWIqsOkswcguvu3zyuPE6IBDSL2DBr+Hrdv3uOxshVqNkZqwH7q8NCNtYKUG4CS2V2G1OozE7ClvoZOHFx3+DZjptD0F/m4RRTHpOd9OHja4c/cRdHuQGh3r+TKxScuMuXz9kmDRmM/dgKB6+wwYgv0HjrhkS6+Bb2PlbzNQpDbZILEtGdualU4VH3gaX0/92ii89HZSVpY7NQllzvOLfYG7W7d7Nqe3a/NGA1hR7WfQZhKKU0yAN62396wkhTKFyUPa1qVo6KXDvNB62YH/2x0EXzzv/cnjrA07zhPsT4SgepkeGdMnc5V++nE6Phz/PTITmEIlhSykOmQK24M/W3mmzV2Lpxp7f5z9BjCPT6P1DRwuetMRhqsBtnzOnFHEVAMeVvp24hbpmata4lHcFzH9LKZl8TJXn4Cgep98+kWcPmtSknSWVi/7BZNmrsc/G2eC1xVAqqgEeYjtVRjhpPji1wN49qE7x+uYyAi7C4E3XvA+XWFU6Vo1ABsP2MzJwvDlMnjTEYarAbZ8zrYoVUKBR+vduUF01J67YUR2OhmYs49g9suu+9uhy/OIT2DyFedpz/bVWLXtFL77/F3o8zMhCQxHQJh9nZ/RU5diYJc7p95QZgCTnKHLppTaHK3Zm3bwYhkqKIDFg72/VLsabLZFYbYhnRu6nkCuyhL7/G4AJuEWwKT9QsyUWz3WDdeSkl1268zR3ThwLgtDBzyFIo0KnDwYgRH2VfYrP/jCzKTdX3pPZ8ll60wE990Kk5yhi6OU2kSaZx5OBy2UIkDqPUcYAnloJDtwkSC7AHj6Dm4THK4wIoPDiumXI1pVJjBqBcGqYa5fEA+16IxbqaabL2cp+dJJ3MqRoGXL1si7cRKcNAiBFe2vIopqDZemn133kqsyvf38fgTMJkops4WxSUOWSFGoI9joRUcYQhl+SgUkZZK7EtBp3DpgsjhzdqHdckiXlQcMWcReTq4Bw+z5mV2/sxQcrMCVuH+NoQof7DwESf/+aTz4B1WyH8tDHl7zhDpxlwA9A4+7alXAfQcYVYb2V1C8YY8N7y6XQl1AsGoojyD3vZK6zWHm9siDmK9u13u3Mgrtb71GbZCbm+e0mbVq1cDJIyavMK99OAvrfp0IfVEOFJWj7earUKUG9mxZ45WuOzqv2Cv8vgNMcqZuCuXpWHudGb1GipvZxKuOMLwyIn5eSGSDR8AiQDtLDzZ+ALu3rTKSzPrzAMa//xK0OSlQVLHZfd8uhuDQ/p1QKDyPiFCmAaNK17KD3g/2mP/ZXxJcyeAw/xUeNT3UZPXzOe7V7tes2wx6vcFpme3btcaa5SbX2gfP56Dnk62NipiKqo7tB1at+BMPPdjE47a6kr1YVnD/rTAZ+r6U8ivscWnyVgnibnL4sT+P+l6yN/F4NMoLQLXIh2zizpRmy9PduuCP+ab3YE4h8OCjzyMzfrvDMwyjm/rVZPR8vofHHC7TgLmRpetoMFC7Ximm75TgVDJn1G96srHrw6jHnC4vQBAHqipd+zvu/2JP/Dhjsrm8zv0n4sSWHx3KYRjh0DcH44NRnt8sl2nApGTROnqD7oq9kZq1T4IjV0Q7/xc06OVE7nPg6DS2bXL+AqvW4hVEdvnEXEna2bW4uGY4pEGO99ZPPv4YZs3y3DNpmQYM42hyujaBAjbXJxvOcFhxggHGI+UD92dGeU67HDg6/SGAd36GqfHoMNTuULJaFGZexem5T4CTOL7ufCCmAf7dv0EQ11MyrWN6WmYq84C5lqEdyVF8J4hTlkQc+URZUSbMG4PowsVlSEhSO3zlBtm5+alR0UOPD+KaZ5fa0aQryM+3oi/d/ocfaYOCQudxQCeOHYUPRrxpLocZk8U0i8Wt1HSHLQ+Qy3Hj0jFjzE1Xya8Bw4IuJWfoFgJ42RWjip8TQlbVqijtbwz3dw8kfwJM23YdkaXWOOX6tMljMWzIQCuawW9/hJVrNznNt37Fr+jc8VGXI+rXgCnmjipT353w/Es80IIALDAIM56QMFBQSpmkLAUEJzmeX1qrSuBfLrnqQwJ/AkyXJ7sh+bo5ALZdLs+cPgmvDuxj9ezPFesxbETJucZexrfeeAnTv3QdQqTMAyY5TdeZEspcjdjXjfDm5Ka4REDerF1F5tos0Ev1+hNger7QGxfiLzrl3PyfpqJfb+sr4vSMTDR4qCOYy15HSVmrJs4ddx3Dp8wDRpWhvQQKYfGjvTGJCS4rK8nvPDhvt9WfADPwlUE4etx5ROpFv/6A55950mYkn+zxMv45etLpCB/esw5NGjm3Vy77gEnX+lyQIua2xFOM+hNghg8fjp17Djhl2aolc9C1i21A1x9//h3jJn3jNO+EsaPwocWFgT3isg+Y8hXGatzv51uyTz75GGvWb3E66Teu+h0dLYIlFRNfuapCs7bOgzG1a9MCW9ezKI+OU5kHTPkZxnrw72fAfP3VFPy+yK42k7mTOzf+idYt7cfB7PBkH6cmzsz/29ULhxAe5thlT5kHjOV0SUzKfp6CLwkMAnIjJjLcyo3bRZV6Kk8xxpyPIjsmqiQgYkKS5jpAzfauBFzP6Miw9Z5urdzN709bsjmzZ+K7mb84ZdWBnavR9MFGdmm+/XE+Jn7pXOy2cP536NnD8UrkX4BRaSZQSieauUnIphhl+LNWoFJpFlFKSy7yCYmLUYabRyBBpdkISp8pzkMImRitDP/c3QnvaT5/AsyyJQswYcq3Tll29O+NaBht/45HyLZs0Et9MOvbSQ7r8DfArKOUPm/BjSkxkRFWl++JKvUuSvF4CSCwO1oZ0aX4e0KSmmn2fWoBmPXRynAf2ymW9MCfALNt8zqMGD3BKWDOHt2BKKVj36+du/XD8VNnHZZRu2YNnD+xqxwwjAOJKvU1SlHiDYGgT4wywspZb8I19QUQlBhPULokJqqCecVJUKl7g8JkocS0zQiSopURUZ6uFO7m9yfA/HtoL14Z8r5TViWe2Y9qVR2HUftp7kJ84iLGjLNVqsysMKcTk2s3i67t0KXIheTsSlJK0yilJRqVFPVjoiIuW59z1Ew5q8T9EsE3McoI85km4Zq6HgjMvn4IIVRPSJVGtcMy3J30nuTzJ8AkXjiJZ3uXRD+2xzdV/BGEhzsO1JlyMxWNHnncqRDzmymfYuhg+9pS3gKMq/kqZE54pBp85sy1CjRIEmww2BfnKoKC23NEsrzk/IKc/PycRjzTzrudQoLCAi3BwH6mlH6eV5Bjjo3HEUIUitALoDBfpfDU0C+/IM+5gEAIB9ygCVGEXXeUrawpX2bcvIx2jzuPHJ167SQCA5yHZevR9w3s+9uxy9mnn+qMZQtYyFPb5Awwaek3BcUBkEg4jhQY8po2jcpyY8gtprAnuV3kTVCpPwKFOcgkIdgbrYzobJntokrTgKfUKjY4B/RvEBlRAjTT1m4Ppehk0fIxMcoI51KxO9Q3f1phaFEmHmhuNWQ2XNWknHMYpq+YePGytXhnpPkYalNGSEgwkuIOQyq11V721grjjeng0QrjqgGJKs0SSqmF/ynyfUxk+CjLfAlJWR0BYmWFKZVyHevVDPvbmk7zHUBHFv9GCPkzWhkuWOPZVVvFPPcnwFQI5lE1qrlD9jA1/bSkUy7Zl52TiwYPdkBhUZFD2u0blqBta9u6/AcwSZrzFNR8PcxR8mqDqHCm2m9O8Uma/gTUKjY4R0h0A2W4lcbfxWuaQTyhC8yAAbkQHRne2OVI3QECfwIME7pWr9sC+QUFdjkZFhqK5MR/BHH5taEfOtUa+GT0u/hk9Ds2ZfkFYG7coIo8gyabUpiDHUqItGl9ZYjV/WJikmYUBbW66A+RhgfXrEmsLJsuqXIfMlD9mZIVBoZgSXhYaTpBI+chkb8BpknLJ6BKvmGXa1WrVMbFs/sFcXT7rv3o8/Iwh7SO1GT8AjCJydmPUp4/ZMGdwmhleCghRG+11VKpp4HiI4vfNDGRETbG4JRSaaJKk8Ni9ZhBw3HtomuHHRY0Wl4kEgsYL1bt9aJcWVyyCnv1HYBz5+x78K9Zswb27NwqqF16gwGxnZ9Eerr9y01mffnv4QNQKIIElceIfKl0y+q7Y2eY+CTNOwS05NqDkKMxyvDWpTmRqNIsppRanEXIhRgHW60ElYb5I21VXAYFGd4wMtxzTwqCh8dE6G+AGfzW2zhwwPLdV8KwunXqYOtm4VpKX0+bjt//cKxs+cu8n9Gh/WOCR6TMACZRlT2PUr7E0Jtw82KUYUNLcyL+mno3ISi5hiFkV4wy/Al7HEtQZc8F5d8q2ZZx86OVYebvgrnsIaG/Aeaj/43Fhr/smxs3bBiDDWtXCubohbg49OzVzyH9kMGv46MPzXc7LsstO4BJ0hyloC3Nkxt4JzoyYnZpDiRcU8eBwOxTlFK6uGFUhVfscSoxSf02BcwrCgE5Fh0Zbl5xXHLXSwRiAXM/ayuztn88/mv8PM/qrsbMyRbNH8KeLVYSAJdcZnKd/87H26Vr3uxB7NtmrR1d5s8w7LxxUZWdQ0Etzhvk0eja4TaSq4Qko4cFs5iYI9y0Bsqw/9kFTLKmLeWp+cxCQAobKMNszkUuR8xDAn8DzLTv5mDy1B/tcq1d25bYus4+mByxedacBRg7cardxxzH4VrcYSt1/zIPmMuqzKZ6ylnatRpCpPlhNWvWtLr5unmTBmdrNbmWnCOUjIqOCv/eHjdv3LihyNUrspmzjOLnUsI3q6esaL498xALgrL7G2B+W7gcI8fYVw5/PPYxrFvO3DcIT2npGWj4cGfo9Vb3P+YCmMSfSf6LU5kHTPy17FcJ4f8o2Y6R89GR4Taepy+pNNEGShOsAYN+0VERDi2WEpM05yioWf5CKfdaw6gws3xG+LC5T+lvgNmwaQcGDravgNm9a2csX2hfpcUZh/u/+i42b9ttl2T40Ffx1eclm4wyD5jEJM131FoqvyRaGW7tuMqo7pIVSynZa8k1Cr5jw8iKVlJ+y+elb9UIyPfRpbQH3IeCsJz+BphDR46jW0+7x0qj4RczABObNm7ZhZdef89uNmaMxozS/GaFSVSp91KKWAtufBQTGTG9NHcuXtf05w3WUn4CNIiOjHAYhTQhST0agFmHjBDsi1ZGlOiYiR05N+j9DTDxiZfRqoOVzZ+Za/369MD8WfbPI85Yq9Pp0fDhTmDumEondo5hZssRtzWgy/QKw1T5L6o0WZbq+pTiiYZRETYWQolJ2R9Q8DMsGRakDFcoCbGvhwEg/pq6CyEwO7MigKaBMrwCU/l3Y+67lcXfAMNC9tVp1M4ur159uQ9mznBsLemMwWMnTMOsueaduxXp0j9m4ZluJpvCMg2YxCR1fQqY9cDYRA4MC6usDCc2r5KEJDVbKdiKUZzUMZERFZwxWaXSVCwE0i1tbFytSm6hwkkmR4Cxp9rPirnfr5WZM75KymYwGGw99Qr1XmmPnefjEtG2k6UxbgmV5TmmbAMmWd2H8jBLsgjBtWhlhN1wuglJmiWAlTbz+Rg7lwOlmZ2oUl+lFGaLS8Khb3TtCLNFprcBUro8fwMM6z/zYpmaZutc/L23X8eUCZaaTeK437l7Pxw/aWu+3Oyhxvh7h2lIyzZgktRTKGCOY0kI1kUrI+xaICUkqZl715LzB8WumKgIu1J+y2FIVKnXUgqzTT8BvoyOjHBsbCFuDF1SiwWMywLvIoEQXTLWvB49+yAhwcpsydjqYUOHYNT79g/vQrq1bPkqTPj8CxtSdo759/DfCA1lLrcdp/te0p+g0myCRWhx5jGmYVQFu5f4CSpNHCg1S/kJIYuileGDXDE6/lrWBOY5xkxHyOYYZbjZq4yr/J4+90fAvPbGWzh8xFaNf8S772D4OzYaT4JZnJubi/Ydu9gNqTF39kx0irX1qGlZuM8Bc+PGZa86k8jVVzwGwOwRQQLD4CCpxq5LkFxDxXOgCC5mAOEwO5jLdHnlUqAP72KA5FcLxqWHSDPNajiCR8tNwlx9xav2sjo6w9ymTeCobjTR3bpjQlaDvLbddjnrptAV5oPRH2PTZlsPmLVrVv1q7+bf57rJSmO2Zu36TM3LLzArmAVWqo+qD/dD96c6Y1T3CiASx/F1JNpku9t9T9rjLO8d01a+Uw0uL/fucCCoSqPvCYGN9JJS8n5B2nn7ejMCmxpUpUl7TsL9HRHdBVWbD0CYspXRNZA+Lz394IQq91SI4HLACBxUfydTVGs8FpROseUDHZafGufRCtNxOh1nyM+YKFVUMqs86fLSaW7y0U1n5j/teahlLw5eOWC8yMyyXJSiWqMhoLBRGiOUvpaXFueRalLsdPongAGMfwUZl6G4sARtcw4e/XrXNhv7qbvN43sCMGcSUyy1Asw8aRpdw+gcw9FzMcwrLktMnnLaEg4oqjV8DpSzsRSjPAYUpF9Y5gmvOs2gbXke069tm8A9l7enaYNQWXCAhKMNK4ZFdl6yxqHfO0/qdDfvPQEYdxtfns93HIj9xpBm0BVUpgYteH0ReL0W1FAEWXDl/w5+VvEhIS1JSbli98VYnLdGjbr7furWZVGYXDawYlAAgmTSMY8vXn1XXGk56k+ZBYw3ViV7TLvXVipXk1DIRHZGwyYxex47nf4LwJ6xXuK+0cR5CDERjdjzWs8IXsvdvJRTGDDt7HXt9QLtmIJbF34QUcQdJS2zgLmjXPPHwmu2UCj0+SxYr1XiCN8l91a8fT19kXwqBv9Xg975fuHZaw9reZN6YLWqlfYe2rGoRO4motxiwIvI4pS0HDDe4qSflDPrqS5aA6UyAtAR23dz3u52gyffH3vj9HYWrcE0Nyl0lCOjC255dnXtrXaWA8ZbnPSTcna/3PsyBa0LILPLkjWVvN3tyk2emp+fljTEVC5N43j0zU2Ps/KM6u06xZRXDhgx3Cqnxe6Xe12gYKFJSF6XJaudK3qJ5xdRVG3ETNvZJcI5nqPPFt6ME629IL5a4TnKNGAopfLkbIRIDAgBj2BQnUJPiUIqQRD7JNSgAIgCBIGUkkCOIIAHH0gIFwBKAkH5QEogJwRyUCKn4OWEcDJCIQeBnFLIACoFAfOgLQX7TnH7O5UCHAdQCQjhQKkEIKbvAGf8m4DAFAqEEGIcCnLbbMH4m3FDAtDbtj70dtADCmb7w/6B8gB4gBiMfxNiAGW/se8sogLRg0IPYvyvA2D6DqIn7DuFlhJoKeV1BJwWhGophZZQaEG4QhBaSClfxIEr/HbR1mZrli2unp/8X6tcHW92bhJdv/6cLRvW/AIiyweHPIMEubXDkEsI0QqfhibK4KqNXqEA86hxOF9X1B1Zl5mDlHsq3dOASU2lIQYZKuv0usrgSCUJIRUBvgLlSQVKEMGBhPOgEaB8OEDCKBBGYAyJEUKBEAI2ocuTOxw4dfoMzp0/j/j4RJw5+x/i4uJZGBKbotq0boWFf9jGwKSAjgDMwUkuBXIIkA3QbBBOw4GoeVANoVATjmYBXJaB0syWrR79SSaX33rhuef7zpr2P/u+ad3pjBfz3BXAUEq5lCzUNhj0dQmhUQBRArQWBalBCGoAtBqlqAZAuM9QLzKlvCjgzaHDceCgydslc+Eqk8nNoSiYIRn7r9PpUCEiAn/vMxvAepN1BYTgFkBuUYoUApoCEBYcWEUpuSaRSK/UqIBkQghbZX2W7jhgKKWylCx9WwOPdoTQhylIE0IRbemzzGe9La+oTHGA+aWjBIkE9Byl5JSEw6EaFaRHCCFs+3lH0h0FTHK6bjIFhoNtm8pTOQd8wgGiJsBPtSvLrAIPe6vqOw8YguGg5YDx1oCVl+OCA4SoCb1PAcO6Zt6SAe0IpQ9TigcBRANwHhSxfGaUc8A1B1g4s0RC8B8l5JQE9/mWzFF/iw/9hOjrGkCiYKDmQz9AaxKCqpSSagAtP/S7njRllIIUEELZgT+VgqZwIDeMh34JUUlAr1FaRg/9noxm8bUy1esq6+1cK5vORiS8/FrZEy7fmbzOrpUBqgGImhCoCUqulaU8zSBSWbpEh/SqVYmVz+0700rxpd7RM4z45ng3hz3BJSREoadQSDkSZKBQgPIKUAeCS8IHMiElE16aBZeAnICTWQouCYHUJMQ0Ci9vCy6JlIJKOJOAkqNMcGkrwCTMFJdYCCwtBZilBZbsO5NWwiQPoaUFlsQouGQSS8oTkzCzRHAJGIWVtLTgEryOAtpiwSUTWjJhJqi14JKnKCKEFoKgEITLlxDk63laICXIh4Hme0Nw6d3RvzOl/R8AdGoXzom1qQAAAABJRU5ErkJggg=="},68535:function(Ut,at,O){"use strict";O.d(at,{ZP:function(){return Ds}});const N=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},re=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=De},De=Number.MAX_SAFE_INTEGER||9007199254740991;let ne=function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a}({}),$=function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a}({}),g=function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a}({});var ue={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class l{constructor(e,t=0,n=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_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*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 j{constructor(e,t,n,i=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_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new l(e),this.fast_=new l(t),this.defaultTTFB_=i,this.ttfb_=new l(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:s}=this;n.halfLife!==e&&(this.slow_=new l(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new l(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new l(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,i=e/1e3,s=n/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,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 A(a,e,t){return(e=M(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function p(){return p=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(a[n]=t[n])}return a},p.apply(null,arguments)}function m(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(a,i).enumerable})),t.push.apply(t,n)}return t}function y(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?m(Object(t),!0).forEach(function(n){A(a,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(t,n))})}return a}function x(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var n=t.call(a,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function M(a){var e=x(a,"string");return typeof e=="symbol"?e:e+""}class F{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 n=`[${e}]:`;this.trace=z,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}}const z=function(){},I={trace:z,debug:z,log:z,warn:z,info:z,error:z};function C(){return p({},I)}function U(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):z}function H(a,e,t){return e[a]?e[a].bind(e):U(a,t)}const J=C();function he(a,e,t){const n=C();if(typeof console=="object"&&a===!0||typeof a=="object"){const i=["debug","log","info","warn","error"];i.forEach(s=>{n[s]=H(s,a,t)});try{n.log(`Debug logs enabled for "${e}" in hls.js version 1.6.11`)}catch(s){return C()}i.forEach(s=>{J[s]=H(s,a)})}else p(J,n);return n}const X=J;function oe(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function _e(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function ie(a,e){const t=Object.keys(a),n=Object.keys(e),i=t.length,s=n.length;return!i||!s||i===s&&!t.some(r=>n.indexOf(r)===-1)}function ze(a,e=!1){if(typeof TextDecoder!="undefined"){const u=new TextDecoder("utf-8").decode(a);if(e){const h=u.indexOf("\0");return h!==-1?u.substring(0,h):u}return u.replace(/\0/g,"")}const t=a.length;let n,i,s,r="",o=0;for(;o<t;){if(n=a[o++],n===0&&e)return r;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(n);break;case 12:case 13:i=a[o++],r+=String.fromCharCode((n&31)<<6|i&63);break;case 14:i=a[o++],s=a[o++],r+=String.fromCharCode((n&15)<<12|(i&63)<<6|(s&63)<<0);break}}return r}function k(a){let e="";for(let t=0;t<a.length;t++){let n=a[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}function S(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function w(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var P={exports:{}},W;function K(){return W||(W=1,function(a,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,u,h){if(h=h||{},c=c.trim(),u=u.trim(),!u){if(!h.alwaysNormalize)return c;var f=o.parseURL(c);if(!f)throw new Error("Error trying to parse base URL.");return f.path=o.normalizePath(f.path),o.buildURLFromParts(f)}var d=o.parseURL(u);if(!d)throw new Error("Error trying to parse relative URL.");if(d.scheme)return h.alwaysNormalize?(d.path=o.normalizePath(d.path),o.buildURLFromParts(d)):u;var E=o.parseURL(c);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var b=i.exec(E.path);E.netLoc=b[1],E.path=b[2]}E.netLoc&&!E.path&&(E.path="/");var R={scheme:E.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(R.netLoc=E.netLoc,d.path[0]!=="/"))if(!d.path)R.path=E.path,d.params||(R.params=E.params,d.query||(R.query=E.query));else{var T=E.path,V=T.substring(0,T.lastIndexOf("/")+1)+d.path;R.path=o.normalizePath(V)}return R.path===null&&(R.path=h.alwaysNormalize?o.normalizePath(d.path):d.path),o.buildURLFromParts(R)},parseURL:function(c){var u=n.exec(c);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(s,"");c.length!==(c=c.replace(r,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};a.exports=o})()}(P)),P.exports}var _=K();class v{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 D={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Z{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,ve(this,"stats")}setByteRange(e,t){const n=e.split("@",2);let i;n.length===1?i=(t==null?void 0:t.byteRangeEndOffset)||0:i=parseInt(n[1]),this._byteRange=[i,parseInt(n[0])+i]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[D.AUDIO]:null,[D.VIDEO]:null,[D.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new v),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[D.AUDIO]=null,e[D.VIDEO]=null,e[D.AUDIOVIDEO]=null}}function fe(a){return a.sn!=="initSegment"}class ye extends Z{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?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const n=Object.keys(this.levelkeys);if(n.length===1){const i=this._decryptdata=this.levelkeys[n[0]]||null;if(i)return i.getDecryptData(this.sn)}}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=N(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const n=Object.keys(this.levelkeys),i=n.length;if(i>1||i===1&&(t=this.levelkeys[n[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!N(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return fe(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,n,i,s,r=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:n,startDTS:i,endDTS:s,partial:r};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,n),c.startDTS=Math.min(c.startDTS,i),c.endDTS=Math.max(c.endDTS,s)}}class Oe extends Z{constructor(e,t,n,i,s){super(n),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=i;const r=e.enumeratedString("BYTERANGE");r&&this.setByteRange(r,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function Ne(a,e){const t=Object.getPrototypeOf(a);if(t){const n=Object.getOwnPropertyDescriptor(t,e);return n||Ne(t,e)}}function ve(a,e){const t=Ne(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const Me=Math.pow(2,32)-1,Ae=[].push,dt={video:1,audio:2,id3:3,text:4};function Ce(a){return String.fromCharCode.apply(null,a)}function rt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function Pe(a,e){const t=ce(a,e);return t<0?4294967296+t:t}function ut(a,e){let t=Pe(a,e);return t*=Math.pow(2,32),t+=Pe(a,e+4),t}function ce(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function le(a){const e=a.byteLength;for(let t=0;t<e;){const n=Pe(a,t);if(n>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=n>1?t+n:e}return!1}function Y(a,e){const t=[];if(!e.length)return t;const n=a.byteLength;for(let i=0;i<n;){const s=Pe(a,i),r=Ce(a.subarray(i+4,i+8)),o=s>1?i+s:n;if(r===e[0])if(e.length===1)t.push(a.subarray(i+8,o));else{const c=Y(a.subarray(i+8,o),e.slice(1));c.length&&Ae.apply(t,c)}i=o}return t}function Te(a){const e=[],t=a[0];let n=8;const i=Pe(a,n);n+=4;let s=0,r=0;t===0?(s=Pe(a,n),r=Pe(a,n+4),n+=8):(s=ut(a,n),r=ut(a,n+8),n+=16),n+=2;let o=a.length+r;const c=rt(a,n);n+=2;for(let u=0;u<c;u++){let h=n;const f=Pe(a,h);h+=4;const d=f&2147483647;if((f&2147483648)>>>31===1)return X.warn("SIDX has hierarchical references (not supported)"),null;const b=Pe(a,h);h+=4,e.push({referenceSize:d,subsegmentDuration:b,info:{duration:b/i,start:o,end:o+d-1}}),o+=d,h+=4,n=h}return{earliestPresentationTime:s,timescale:i,version:t,referencesCount:c,references:e}}function ke(a){const e=[],t=Y(a,["moov","trak"]);for(let i=0;i<t.length;i++){const s=t[i],r=Y(s,["tkhd"])[0];if(r){let o=r[0];const c=Pe(r,o===0?12:20),u=Y(s,["mdia","mdhd"])[0];if(u){o=u[0];const h=Pe(u,o===0?12:20),f=Y(s,["mdia","hdlr"])[0];if(f){const d=Ce(f.subarray(8,12)),E={soun:D.AUDIO,vide:D.VIDEO}[d],b=Y(s,["mdia","minf","stbl","stsd"])[0],R=Ke(b);E?(e[c]={timescale:h,type:E,stsd:R},e[E]=y({timescale:h,id:c},R)):e[c]={timescale:h,type:d,stsd:R}}}}}return Y(a,["moov","mvex","trex"]).forEach(i=>{const s=Pe(i,4),r=e[s];r&&(r.default={duration:Pe(i,12),flags:Pe(i,20)})}),e}function Ke(a){const e=a.subarray(8),t=e.subarray(86),n=Ce(e.subarray(4,8));let i=n,s;const r=n==="enca"||n==="encv";if(r){const u=Y(e,[n])[0].subarray(n==="enca"?28:78);Y(u,["sinf"]).forEach(f=>{const d=Y(f,["schm"])[0];if(d){const E=Ce(d.subarray(4,8));if(E==="cbcs"||E==="cenc"){const b=Y(f,["frma"])[0];b&&(i=Ce(b))}}})}const o=i;switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const c=Y(t,["avcC"])[0];c&&c.length>3&&(i+="."+we(c[1])+we(c[2])+we(c[3]),s=G(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=Y(e,[n])[0],u=Y(c.subarray(28),["esds"])[0];if(u&&u.length>7){let h=4;if(u[h++]!==3)break;h=me(u,h),h+=2;const f=u[h++];if(f&128&&(h+=2),f&64&&(h+=u[h++]),u[h++]!==4)break;h=me(u,h);const d=u[h++];if(d===64)i+="."+we(d);else break;if(h+=12,u[h++]!==5)break;h=me(u,h);const E=u[h++];let b=(E&248)>>3;b===31&&(b+=1+((E&7)<<3)+((u[h]&224)>>5)),i+="."+b}break}case"hvc1":case"hev1":{const c=Y(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],h=["","A","B","C"][u>>6],f=u&31,d=Pe(c,2),E=(u&32)>>5?"H":"L",b=c[12],R=c.subarray(6,12);i+="."+h+f,i+="."+q(d).toString(16).toUpperCase(),i+="."+E+b;let T="";for(let V=R.length;V--;){const se=R[V];(se||T)&&(T="."+se.toString(16).toUpperCase()+T)}i+=T}s=G(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{i=G(i,t)||i;break}case"vp09":{const c=Y(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],h=c[5],f=c[6]>>4&15;i+="."+Le(u)+"."+Le(h)+"."+Le(f)}break}case"av01":{const c=Y(t,["av1C"])[0];if(c&&c.length>2){const u=c[1]>>>5,h=c[1]&31,f=c[2]>>>7?"H":"M",d=(c[2]&64)>>6,E=(c[2]&32)>>5,b=u===2&&d?E?12:10:d?10:8,R=(c[2]&16)>>4,T=(c[2]&8)>>3,V=(c[2]&4)>>2,se=c[2]&3;i+="."+u+"."+Le(h)+f+"."+Le(b)+"."+R+"."+T+V+se+"."+Le(1)+"."+Le(1)+"."+Le(1)+"."+0,s=G("dav1",t)}break}}return{codec:i,encrypted:r,supplemental:s}}function G(a,e){const t=Y(e,["dvvC"]),n=t.length?t[0]:Y(e,["dvcC"])[0];if(n){const i=n[2]>>1&127,s=n[2]<<5&32|n[3]>>3&31;return a+"."+Le(i)+"."+Le(s)}}function q(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function me(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function we(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function Le(a){return(a<10?"0":"")+a}function $e(a,e){if(!a||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&Y(a,["moov","trak"]).forEach(i=>{const r=Y(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=Y(r,["enca"]);const c=o.length>0;c||(o=Y(r,["encv"])),o.forEach(u=>{const h=c?u.subarray(28):u.subarray(78);Y(h,["sinf"]).forEach(d=>{const E=yt(d);if(E){const b=E.subarray(8,24);b.some(R=>R!==0)||(X.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${k(b)} -> ${k(t)}`),E.set(t,8))}})})})}function yt(a){const e=Y(a,["schm"])[0];if(e){const t=Ce(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Y(a,["schi","tenc"])[0]}return null}function Qe(a,e,t){const n={},i=Y(a,["moof","traf"]);for(let s=0;s<i.length;s++){const r=i[s],o=Y(r,["tfhd"])[0],c=Pe(o,4),u=e[c];if(!u)continue;n[c]||(n[c]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});const h=n[c],f=Y(r,["tfdt"])[0];if(f){const te=f[0];let Se=Pe(f,4);te===1&&(Se===Me?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(Se*=Me+1,Se+=Pe(f,8))),N(Se)&&(!N(h.start)||Se<h.start)&&(h.start=Se)}const d=u.default,E=Pe(o,0)|(d==null?void 0:d.flags);let b=(d==null?void 0:d.duration)||0;E&8&&(E&2?b=Pe(o,12):b=Pe(o,8));const R=Y(r,["trun"]);let T=h.start||0,V=0,se=b;for(let te=0;te<R.length;te++){const Se=R[te],Fe=Pe(Se,4),Ye=h.sampleCount;h.sampleCount+=Fe;const Re=Se[3]&1,Ue=Se[3]&4,Ge=Se[2]&1,Ie=Se[2]&2,it=Se[2]&4,It=Se[2]&8;let Mt=8,Gt=Fe;for(Re&&(Mt+=4),Ue&&Fe&&(!(Se[Mt+1]&1)&&h.keyFrameIndex===void 0&&(h.keyFrameIndex=Ye),Mt+=4,Ge?(se=Pe(Se,Mt),Mt+=4):se=b,Ie&&(Mt+=4),It&&(Mt+=4),T+=se,V+=se,Gt--);Gt--;)Ge?(se=Pe(Se,Mt),Mt+=4):se=b,Ie&&(Mt+=4),it&&(Se[Mt+1]&1||h.keyFrameIndex===void 0&&(h.keyFrameIndex=h.sampleCount-(Gt+1),h.keyFrameStart=T),Mt+=4),It&&(Mt+=4),T+=se,V+=se;!V&&b&&(V+=b*Fe)}h.duration+=V}if(!Object.keys(n).some(s=>n[s].duration)){let s=1/0,r=0;const o=Y(a,["sidx"]);for(let c=0;c<o.length;c++){const u=Te(o[c]);if(u!=null&&u.references){s=Math.min(s,u.earliestPresentationTime/u.timescale);const h=u.references.reduce((f,d)=>f+d.info.duration||0,0);r=Math.max(r,h+u.earliestPresentationTime/u.timescale)}}r&&N(r)&&Object.keys(n).forEach(c=>{n[c].duration||(n[c].duration=r*n[c].timescale-n[c].start)})}return n}function et(a){const e={valid:null,remainder:null},t=Y(a,["moof"]);if(t.length<2)return e.remainder=a,e;const n=t[t.length-1];return e.valid=a.slice(0,n.byteOffset-8),e.remainder=a.slice(n.byteOffset-8),e}function Ve(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function He(a,e){const t=[],n=e.samples,i=e.timescale,s=e.id;let r=!1;return Y(n,["moof"]).map(c=>{const u=c.byteOffset-8;Y(c,["traf"]).map(f=>{const d=Y(f,["tfdt"]).map(E=>{const b=E[0];let R=Pe(E,4);return b===1&&(R*=Math.pow(2,32),R+=Pe(E,8)),R/i})[0];return d!==void 0&&(a=d),Y(f,["tfhd"]).map(E=>{const b=Pe(E,4),R=Pe(E,0)&16777215,T=(R&1)!==0,V=(R&2)!==0,se=(R&8)!==0;let te=0;const Se=(R&16)!==0;let Fe=0;const Ye=(R&32)!==0;let Re=8;b===s&&(T&&(Re+=8),V&&(Re+=4),se&&(te=Pe(E,Re),Re+=4),Se&&(Fe=Pe(E,Re),Re+=4),Ye&&(Re+=4),e.type==="video"&&(r=_t(e.codec)),Y(f,["trun"]).map(Ue=>{const Ge=Ue[0],Ie=Pe(Ue,0)&16777215,it=(Ie&1)!==0;let It=0;const Mt=(Ie&4)!==0,Gt=(Ie&256)!==0;let Nt=0;const At=(Ie&512)!==0;let $t=0;const Lt=(Ie&1024)!==0,Kt=(Ie&2048)!==0;let tn=0;const Dt=Pe(Ue,4);let Rt=8;it&&(It=Pe(Ue,Rt),Rt+=4),Mt&&(Rt+=4);let dn=It+u;for(let Nn=0;Nn<Dt;Nn++){if(Gt?(Nt=Pe(Ue,Rt),Rt+=4):Nt=te,At?($t=Pe(Ue,Rt),Rt+=4):$t=Fe,Lt&&(Rt+=4),Kt&&(Ge===0?tn=Pe(Ue,Rt):tn=ce(Ue,Rt),Rt+=4),e.type===D.VIDEO){let gn=0;for(;gn<$t;){const Dn=Pe(n,dn);if(dn+=4,ht(r,n[dn])){const Ti=n.subarray(dn,dn+Dn);xe(Ti,r?2:1,a+tn/i,t)}dn+=Dn,gn+=Dn+4}}a+=Nt/i}}))})})}),t}function _t(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function ht(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function xe(a,e,t,n){const i=ct(a);let s=0;s+=e;let r=0,o=0,c=0;for(;s<i.length;){r=0;do{if(s>=i.length)break;c=i[s++],r+=c}while(c===255);o=0;do{if(s>=i.length)break;c=i[s++],o+=c}while(c===255);const u=i.length-s;let h=s;if(o<u)s+=o;else if(o>u){X.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(i[h++]===181){const d=rt(i,h);if(h+=2,d===49){const E=Pe(i,h);if(h+=4,E===1195456820){const b=i[h++];if(b===3){const R=i[h++],T=31&R,V=64&R,se=V?2+T*3:0,te=new Uint8Array(se);if(V){te[0]=R;for(let Se=1;Se<se;Se++)te[Se]=i[h++]}n.push({type:b,payloadType:r,pts:t,bytes:te})}}}}}else if(r===5&&o>16){const f=[];for(let b=0;b<16;b++){const R=i[h++].toString(16);f.push(R.length==1?"0"+R:R),(b===3||b===5||b===7||b===9)&&f.push("-")}const d=o-16,E=new Uint8Array(d);for(let b=0;b<d;b++)E[b]=i[h++];n.push({payloadType:r,pts:t,uuid:f.join(""),userData:ze(E),userDataBytes:E})}}}function ct(a){const e=a.byteLength,t=[];let n=1;for(;n<e-2;)a[n]===0&&a[n+1]===0&&a[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return a;const i=e-t.length,s=new Uint8Array(i);let r=0;for(n=0;n<i;r++,n++)r===t[0]&&(r++,t.shift()),s[n]=a[r];return s}function Xe(a){const e=a[0];let t="",n="",i=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;Ce(a.subarray(u,u+1))!=="\0";)t+=Ce(a.subarray(u,u+1)),u+=1;for(t+=Ce(a.subarray(u,u+1)),u+=1;Ce(a.subarray(u,u+1))!=="\0";)n+=Ce(a.subarray(u,u+1)),u+=1;n+=Ce(a.subarray(u,u+1)),u+=1,i=Pe(a,12),s=Pe(a,16),o=Pe(a,20),c=Pe(a,24),u=28}else if(e===1){u+=4,i=Pe(a,u),u+=4;const f=Pe(a,u);u+=4;const d=Pe(a,u);for(u+=4,r=dl(2,32)*f+d,re(r)||(r=Number.MAX_SAFE_INTEGER,X.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Pe(a,u),u+=4,c=Pe(a,u),u+=4;Ce(a.subarray(u,u+1))!=="\0";)t+=Ce(a.subarray(u,u+1)),u+=1;for(t+=Ce(a.subarray(u,u+1)),u+=1;Ce(a.subarray(u,u+1))!=="\0";)n+=Ce(a.subarray(u,u+1)),u+=1;n+=Ce(a.subarray(u,u+1)),u+=1}const h=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:n,timeScale:i,presentationTime:r,presentationTimeDelta:s,eventDuration:o,id:c,payload:h}}function We(a,...e){const t=e.length;let n=8,i=t;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(a,4),i=0,n=8;i<t;i++)s.set(e[i],n),n+=e[i].byteLength;return s}function Et(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let n,i;n=0,i=new Uint8Array;let s;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const r=new Uint8Array(4);return t.byteLength>0&&new DataView(r.buffer).setUint32(0,t.byteLength,!1),We([112,115,115,104],new Uint8Array([n,0,0,0]),a,s,i,r,t)}const St=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),mt={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 st(a,e){const t=mt[e];return!!t&&!!t[a.slice(0,4)]}function Pt(a,e,t=!0){return!a.split(",").some(n=>!ot(n,e,t))}function ot(a,e,t=!0){var n;const i=oe(t);return(n=i==null?void 0:i.isTypeSupported(bt(a,e)))!=null?n:!1}function bt(a,e){return`${e}/mp4;codecs=${a}`}function Ee(a){if(a){const e=a.substring(0,4);return mt.video[e]}return 2}function pe(a){const e=St();return a.split(",").reduce((t,n)=>{const s=e&&_t(n)?9:mt.video[n];return s?(s*2+t)/(t?3:2):(mt.audio[n]+t)/(t?2:1)},0)}const ge={};function L(a,e=!0){if(ge[a])return ge[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let i=0;i<t.length;i++){var n;if(ot(t[i],"audio",e))return ge[a]=t[i],t[i];if(t[i]==="mp3"&&(n=oe(e))!=null&&n.isTypeSupported("audio/mpeg"))return""}return a}const B=/flac|opus|mp4a\.40\.34/i;function Q(a,e=!0){return a.replace(B,t=>L(t.toLowerCase(),e))}function ae(a,e){const t=[];if(a){const n=a.split(",");for(let i=0;i<n.length;i++)st(n[i],"video")||t.push(n[i])}return e&&t.push(e),t.join(",")}function de(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(qe(a,"audio")||qe(a,"video")))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let n=t.length;n--;)if(t[n].substring(0,4)===a.substring(0,4))return t[n]}return t[0]}}return e||a}function qe(a,e){return st(a,e)&&ot(a,e)}function lt(a){const e=a.split(",");for(let t=0;t<e.length;t++){const n=e[t].split(".");n.length>2&&n[0]==="avc1"&&(e[t]=`avc1.${parseInt(n[1]).toString(16)}${("000"+parseInt(n[2]).toString(16)).slice(-4)}`)}return e.join(",")}function pt(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let n=e.length;n>4&&n<10;n++)e[n]=t[n-4];return e.join(".")}return a}function Tt(a){const e=oe(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Wt(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const mn={supported:!0,powerEfficient:!0,smooth:!0},Qt={supported:!1,smooth:!1,powerEfficient:!1},Ot={supported:!0,configurations:[],decodingInfoResults:[mn]};function vn(a,e){return{supported:!1,configurations:e,decodingInfoResults:[Qt],error:a}}function Kn(a,e,t,n,i,s){const r=a.videoCodec,o=a.audioCodec?a.audioGroups:null,c=s==null?void 0:s.audioCodec,u=s==null?void 0:s.channels,h=u?parseInt(u):c?1/0:2;let f=null;if(o!=null&&o.length)try{o.length===1&&o[0]?f=e.groups[o[0]].channels:f=o.reduce((d,E)=>{if(E){const b=e.groups[E];if(!b)throw new Error(`Audio track group ${E} not found`);Object.keys(b.channels).forEach(R=>{d[R]=(d[R]||0)+b.channels[R]})}return d},{2:0})}catch(d){return!0}return r!==void 0&&(r.split(",").some(d=>_t(d))||a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(n,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(i,8e6))||!!f&&N(h)&&Object.keys(f).some(d=>parseInt(d)>h)}function Ln(a,e,t,n={}){const i=a.videoCodec;if(!i&&!a.audioCodec||!t)return Promise.resolve(Ot);const s=[],r=Sn(a),o=r.length,c=gt(a,e,o>0),u=c.length;for(let h=o||1*u||1;h--;){const f={type:"media-source"};if(o&&(f.video=r[h%o]),u){f.audio=c[h%u];const d=f.audio.bitrate;f.video&&d&&(f.video.bitrate-=d)}s.push(f)}if(i){const h=navigator.userAgent;if(i.split(",").some(f=>_t(f))&&St())return Promise.resolve(vn(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${h})`),s))}return Promise.all(s.map(h=>{const f=jt(h);return n[f]||(n[f]=t.decodingInfo(h))})).then(h=>({supported:!h.some(f=>!f.supported),configurations:s,decodingInfoResults:h})).catch(h=>({supported:!1,configurations:s,decodingInfoResults:[],error:h}))}function Sn(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),n=wt(a),i=a.width||640,s=a.height||480,r=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(c=>{const u={contentType:bt(pt(c),"video"),width:i,height:s,bitrate:n,framerate:r};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function gt(a,e,t){var n;const i=(n=a.audioCodec)==null?void 0:n.split(","),s=wt(a);return i&&a.audioGroups?a.audioGroups.reduce((r,o)=>{var c;const u=o?(c=e.groups[o])==null?void 0:c.tracks:null;return u?u.reduce((h,f)=>{if(f.groupId===o){const d=parseFloat(f.channels||"");i.forEach(E=>{const b={contentType:bt(E,"audio"),bitrate:t?Je(E,s):s};d&&(b.channels=""+d),h.push(b)})}return h},r):r},[]):[]}function Je(a,e){if(e<=1)return 1;let t=128e3;return a==="ec-3"?t=768e3:a==="ac-3"&&(t=64e4),Math.min(e/2,t)}function wt(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function jt(a){let e="";const{audio:t,video:n}=a;if(n){const i=Wt(n.contentType);e+=`${i}_r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${Math.ceil(n.bitrate/1e5)}`}if(t){const i=Wt(t.contentType);e+=`${n?"_":""}${i}_c${t.channels}`}return e}const ln=["NONE","TYPE-0","TYPE-1",null];function Tn(a){return ln.indexOf(a)>-1}const ti=["SDR","PQ","HLG"];function Qn(a){return!!a&&ti.indexOf(a)>-1}var In={No:"",Yes:"YES",v2:"v2"};function Vn(a){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=a,i=n<e/2;return e&&i?t?In.v2:In.Yes:In.No}class an{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Bn{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(n=>!!n).map(n=>n.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const n=(t=e.supplemental)==null?void 0:t.videoCodec;n&&n!==e.videoCodec&&(this.codecSet+=`,${n.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 Cn(this._audioGroups,e)}hasSubtitleGroup(e){return Cn(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Cn(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function Ii(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function en(a,e){let t=!1,n=[];if(a&&(t=a!=="SDR",n=[a]),e){n=e.allowedVideoRanges||ti.slice(0);const i=n.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&Ii(),t||(n=["SDR"])}return{preferHDR:t,allowedVideoRanges:n}}const un=a=>{const e=new WeakSet;return(t,n)=>{if(a&&(n=a(t,n)),typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}},Vt=(a,e)=>JSON.stringify(a,un(e));function Bt(a,e,t,n,i){const s=Object.keys(a),r=n==null?void 0:n.channels,o=n==null?void 0:n.audioCodec,c=i==null?void 0:i.videoCodec,u=r&&parseInt(r)===2;let h=!1,f=!1,d=1/0,E=1/0,b=1/0,R=1/0,T=0,V=[];const{preferHDR:se,allowedVideoRanges:te}=en(e,i);for(let Ue=s.length;Ue--;){const Ge=a[s[Ue]];h||(h=Ge.channels[2]>0),d=Math.min(d,Ge.minHeight),E=Math.min(E,Ge.minFramerate),b=Math.min(b,Ge.minBitrate),te.filter(it=>Ge.videoRanges[it]>0).length>0&&(f=!0)}d=N(d)?d:0,E=N(E)?E:0;const Se=Math.max(1080,d),Fe=Math.max(30,E);b=N(b)?b:t,t=Math.max(b,t),f||(e=void 0);const Ye=s.length>1;return{codecSet:s.reduce((Ue,Ge)=>{const Ie=a[Ge];if(Ge===Ue)return Ue;if(V=f?te.filter(it=>Ie.videoRanges[it]>0):[],Ye){if(Ie.minBitrate>t)return Ft(Ge,`min bitrate of ${Ie.minBitrate} > current estimate of ${t}`),Ue;if(!Ie.hasDefaultAudio)return Ft(Ge,"no renditions with default or auto-select sound found"),Ue;if(o&&Ge.indexOf(o.substring(0,4))%5!==0)return Ft(Ge,`audio codec preference "${o}" not found`),Ue;if(r&&!u){if(!Ie.channels[r])return Ft(Ge,`no renditions with ${r} channel sound found (channels options: ${Object.keys(Ie.channels)})`),Ue}else if((!o||u)&&h&&Ie.channels[2]===0)return Ft(Ge,"no renditions with stereo sound found"),Ue;if(Ie.minHeight>Se)return Ft(Ge,`min resolution of ${Ie.minHeight} > maximum of ${Se}`),Ue;if(Ie.minFramerate>Fe)return Ft(Ge,`min framerate of ${Ie.minFramerate} > maximum of ${Fe}`),Ue;if(!V.some(it=>Ie.videoRanges[it]>0))return Ft(Ge,`no variants with VIDEO-RANGE of ${Vt(V)} found`),Ue;if(c&&Ge.indexOf(c.substring(0,4))%5!==0)return Ft(Ge,`video codec preference "${c}" not found`),Ue;if(Ie.maxScore<T)return Ft(Ge,`max score of ${Ie.maxScore} < selected max of ${T}`),Ue}return Ue&&(pe(Ge)>=pe(Ue)||Ie.fragmentError>a[Ue].fragmentError)?Ue:(R=Ie.minIndex,T=Ie.maxScore,Ge)},void 0),videoRanges:V,preferHDR:se,minFramerate:E,minBitrate:b,minIndex:R}}function Ft(a,e){X.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function be(a){return a.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const i=t.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Ze(a,e,t,n){return a.slice(t,n+1).reduce((i,s,r)=>{if(!s.codecSet)return i;const o=s.audioGroups;let c=i[s.codecSet];c||(i[s.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,s.bitrate);const u=Math.min(s.height,s.width);return c.minHeight=Math.min(c.minHeight,u),c.minFramerate=Math.min(c.minFramerate,s.frameRate),c.minIndex=Math.min(c.minIndex,r),c.maxScore=Math.max(c.maxScore,s.score),c.fragmentError+=s.fragmentError,c.videoRanges[s.videoRange]=(c.videoRanges[s.videoRange]||0)+1,o&&o.forEach(h=>{if(!h)return;const f=e.groups[h];f&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(d=>{c.channels[d]=(c.channels[d]||0)+f.channels[d]}))}),i},{})}function nt(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:n,channels:i,audioCodec:s}=a;return{lang:e,assocLang:t,characteristics:n,channels:i,audioCodec:s}}function je(a,e,t){if("attrs"in a){const n=e.indexOf(a);if(n!==-1)return n}for(let n=0;n<e.length;n++){const i=e[n];if(ft(a,i,t))return n}return-1}function ft(a,e,t){const{groupId:n,name:i,lang:s,assocLang:r,default:o}=a,c=a.forced;return(n===void 0||e.groupId===n)&&(i===void 0||e.name===i)&&(s===void 0||vt(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||xt(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function vt(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function xt(a,e=""){const t=a.split(","),n=e.split(",");return t.length===n.length&&!t.some(i=>n.indexOf(i)===-1)}function Ct(a,e){const{audioCodec:t,channels:n}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function cn(a,e,t,n,i){const s=e[n],o=e.reduce((d,E,b)=>{const R=E.uri;return(d[R]||(d[R]=[])).push(b),d},{})[s.uri];o.length>1&&(n=Math.max.apply(Math,o));const c=s.videoRange,u=s.frameRate,h=s.codecSet.substring(0,4),f=Yt(e,n,d=>{if(d.videoRange!==c||d.frameRate!==u||d.codecSet.substring(0,4)!==h)return!1;const E=d.audioGroups,b=t.filter(R=>!E||E.indexOf(R.groupId)!==-1);return je(a,b,i)>-1});return f>-1?f:Yt(e,n,d=>{const E=d.audioGroups,b=t.filter(R=>!E||E.indexOf(R.groupId)!==-1);return je(a,b,i)>-1})}function Yt(a,e,t){for(let n=e;n>-1;n--)if(t(a[n]))return n;for(let n=e+1;n<a.length;n++)if(t(a[n]))return n;return-1}function wn(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Jt extends F{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var n;const{fragCurrent:i,partCurrent:s,hls:r}=this,{autoLevelEnabled:o,media:c}=r;if(!i||!c)return;const u=performance.now(),h=s?s.stats:i.stats,f=s?s.duration:i.duration,d=u-h.loading.start,E=r.minAutoLevel,b=i.level,R=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||b<=E){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const T=R>-1&&R!==b,V=!!t||T;if(!V&&(c.paused||!c.playbackRate||!c.readyState))return;const se=r.mainForwardBufferInfo;if(!V&&se===null)return;const te=this.bwEstimator.getEstimateTTFB(),Se=Math.abs(c.playbackRate);if(d<=Math.max(te,1e3*(f/(Se*2))))return;const Fe=se?se.len/Se:0,Ye=h.loading.first?h.loading.first-h.loading.start:-1,Re=h.loaded&&Ye>-1,Ue=this.getBwEstimate(),Ge=r.levels,Ie=Ge[b],it=Math.max(h.loaded,Math.round(f*(i.bitrate||Ie.averageBitrate)/8));let It=Re?d-Ye:d;It<1&&Re&&(It=Math.min(d,h.loaded*8/Ue));const Mt=Re?h.loaded*1e3/It:0,Gt=te/1e3,Nt=Mt?(it-h.loaded)/Mt:it*8/Ue+Gt;if(Nt<=Fe)return;const At=Mt?Mt*8:Ue,$t=((n=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:n.live)===!0,Lt=this.hls.config.abrBandWidthUpFactor;let Kt=Number.POSITIVE_INFINITY,tn;for(tn=b-1;tn>E;tn--){const Nn=Ge[tn].maxBitrate,gn=!Ge[tn].details||$t;if(Kt=this.getTimeToLoadFrag(Gt,At,f*Nn,gn),Kt<Math.min(Fe,f+Gt))break}if(Kt>=Nt||Kt>f*10)return;Re?this.bwEstimator.sample(d-Math.min(te,Ye),h.loaded):this.bwEstimator.sampleTTFB(d);const Dt=Ge[tn].maxBitrate;this.getBwEstimate()*Lt>Dt&&this.resetEstimator(Dt);const Rt=this.findBestLevel(Dt,E,tn,0,Fe,1,1);Rt>-1&&(tn=Rt),this.warn(`Fragment ${i.sn}${s?" part "+s.index:""} of level ${b} is loading too slowly;
Fragment duration: ${i.duration.toFixed(3)}
Time to underbuffer: ${Fe.toFixed(3)} s
Estimated load time for current fragment: ${Nt.toFixed(3)} s
Estimated load time for down switch fragment: ${Kt.toFixed(3)} s
TTFB estimate: ${Ye|0} ms
Current BW estimate: ${N(Ue)?Ue|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${tn} @ ${Dt|0} bps`),r.nextLoadLevel=r.nextAutoLevel=tn,this.clearTimer();const dn=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===tn&&tn>0){const Nn=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${tn>0?"and switching down":""}
Fragment duration: ${i.duration.toFixed(3)} s
Time to underbuffer: ${Nn.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,tn>E){let gn=this.findBestLevel(this.hls.levels[E].bitrate,E,tn,0,Nn,1,1);gn===-1&&(gn=E),this.hls.nextLoadLevel=this.hls.nextAutoLevel=gn,this.resetEstimator(this.hls.levels[gn].bitrate)}}};T||Nt>Kt*2?dn():this.timer=self.setInterval(dn,Kt*1e3),r.trigger(g.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:s,stats:h})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new j(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(g.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=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 n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var i;this.fragCurrent=n,this.partCurrent=(i=t.part)!=null?i: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 $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case $.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:i,partCurrent:s}=this;if(n&&i&&n.sn===i.sn&&n.level===i.level){const r=performance.now(),o=s?s.stats:n.stats,c=r-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(f,u),o.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,n,i){const s=e+n/t,r=i?e+this.lastLevelLoadSec:0;return s+r}onLevelLoaded(e,t){const n=this.hls.config,{loading:i}=t.stats,s=i.end-i.first;N(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){const i=n?n.stats:t.stats;if(t.type===ee.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=n?n.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+i.loaded,c=(r.loaded?r.loaded.duration:0)+s;r.loaded={bytes:o,duration:c},r.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){const s={stats:i,frag:t,part:n,id:t.type};this.onFragBuffered(g.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:i}=t,s=i!=null&&i.stats.loaded?i.stats:n.stats;if(s.aborted||this.ignoreFragment(n))return;const r=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(r,s.loaded),s.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==ee.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,t,e,0,i,1,1);if(s>-1)return s;const r=this.hls.firstLevel,o=Math.min(Math.max(r,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${r} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,n=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=n&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,s)&&r[e].loadError<=r[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:i,config:s,minAutoLevel:r}=n,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let h=s.abrBandWidthFactor,f=s.abrBandWidthUpFactor;if(u){const T=this.findBestLevel(c,r,i,u,0,h,f);if(T>=0)return this.rebufferNotice=-1,T}let d=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const T=this.bitrateTestDelay;T&&(d=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-T,this.info(`bitrate test took ${Math.round(1e3*T)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),h=f=1)}const E=this.findBestLevel(c,r,i,u,d,h,f);if(this.rebufferNotice!==E&&(this.rebufferNotice=E,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${E}`)),E>-1)return E;const b=n.levels[r],R=n.loadLevelObj;return R&&(b==null?void 0:b.bitrate)<R.bitrate?r:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,i,s,r,o){var c;const u=i+s,h=this.lastLoadedFragLevel,f=h===-1?this.hls.firstLevel:h,{fragCurrent:d,partCurrent:E}=this,{levels:b,allAudioTracks:R,loadLevel:T,config:V}=this.hls;if(b.length===1)return 0;const se=b[f],te=!!((c=this.hls.latestLevelDetails)!=null&&c.live),Se=T===-1||h===-1;let Fe,Ye="SDR",Re=(se==null?void 0:se.frameRate)||0;const{audioPreference:Ue,videoPreference:Ge}=V,Ie=this.audioTracksByGroup||(this.audioTracksByGroup=be(R));let it=-1;if(Se){if(this.firstSelection!==-1)return this.firstSelection;const At=this.codecTiers||(this.codecTiers=Ze(b,Ie,t,n)),$t=Bt(At,Ye,e,Ue,Ge),{codecSet:Lt,videoRanges:Kt,minFramerate:tn,minBitrate:Dt,minIndex:Rt,preferHDR:dn}=$t;it=Rt,Fe=Lt,Ye=dn?Kt[Kt.length-1]:Kt[0],Re=tn,e=Math.max(e,Dt),this.log(`picked start tier ${Vt($t)}`)}else Fe=se==null?void 0:se.codecSet,Ye=se==null?void 0:se.videoRange;const It=E?E.duration:d?d.duration:0,Mt=this.bwEstimator.getEstimateTTFB()/1e3,Gt=[];for(let At=n;At>=t;At--){var Nt;const $t=b[At],Lt=At>f;if(!$t)continue;if(V.useMediaCapabilities&&!$t.supportedResult&&!$t.supportedPromise){const gn=navigator.mediaCapabilities;typeof(gn==null?void 0:gn.decodingInfo)=="function"&&Kn($t,Ie,Ye,Re,e,Ue)?($t.supportedPromise=Ln($t,Ie,gn,this.supportedCache),$t.supportedPromise.then(Dn=>{if(!this.hls)return;$t.supportedResult=Dn;const Ti=this.hls.levels,yi=Ti.indexOf($t);Dn.error?this.warn(`MediaCapabilities decodingInfo error: "${Dn.error}" for level ${yi} ${Vt(Dn)}`):Dn.supported?Dn.decodingInfoResults.some(Hi=>Hi.smooth===!1||Hi.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${yi} not smooth or powerEfficient: ${Vt(Dn)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${yi} ${Vt(Dn)}`),yi>-1&&Ti.length>1&&(this.log(`Removing unsupported level ${yi}`),this.hls.removeLevel(yi),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Dn=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Dn}`)})):$t.supportedResult=Ot}if((Fe&&$t.codecSet!==Fe||Ye&&$t.videoRange!==Ye||Lt&&Re>$t.frameRate||!Lt&&Re>0&&Re<$t.frameRate||(Nt=$t.supportedResult)!=null&&(Nt=Nt.decodingInfoResults)!=null&&Nt.some(gn=>gn.smooth===!1))&&(!Se||At!==it)){Gt.push(At);continue}const Kt=$t.details,tn=(E?Kt==null?void 0:Kt.partTarget:Kt==null?void 0:Kt.averagetargetduration)||It;let Dt;Lt?Dt=o*e:Dt=r*e;const Rt=It&&i>=It*2&&s===0?$t.averageBitrate:$t.maxBitrate,dn=this.getTimeToLoadFrag(Mt,Dt,Rt*tn,Kt===void 0);if(Dt>=Rt&&(At===h||$t.loadError===0&&$t.fragmentError===0)&&(dn<=Mt||!N(dn)||te&&!this.bitrateTestDelay||dn<u)){const gn=this.forcedAutoLevel;return At!==T&&(gn===-1||gn!==T)&&(Gt.length&&this.trace(`Skipped level(s) ${Gt.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${b[Gt[0]].codecs}" ${b[Gt[0]].videoRange}; not compatible with "${Fe}" ${Ye}`),this.info(`switch candidate:${f}->${At} adjustedbw(${Math.round(Dt)})-bitrate=${Math.round(Dt-Rt)} ttfb:${Mt.toFixed(1)} avgDuration:${tn.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${dn.toFixed(1)} firstSelection:${Se} codecSet:${$t.codecSet} videoRange:${$t.videoRange} hls.loadLevel:${T}`)),Se&&(this.firstSelection=At),At}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}}const qt={search:function(a,e){let t=0,n=a.length-1,i=null,s=null;for(;t<=n;){i=(t+n)/2|0,s=a[i];const r=e(s);if(r>0)t=i+1;else if(r<0)n=i-1;else return s}return null}};function sn(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!N(e))return null;const n=a[0].programDateTime;if(e<(n||0))return null;const i=a[a.length-1].endProgramDateTime;if(e>=(i||0))return null;for(let s=0;s<a.length;++s){const r=a[s];if(Xt(e,t,r))return r}return null}function on(a,e,t=0,n=0,i=.005){let s=null;if(a){s=e[1+a.sn-e[0].sn]||null;const o=a.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),s&&a.level!==s.level&&s.end<=a.end&&(s=e[2+a.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!a||a.level===s.level)&&Ht(t,n,s)===0||pn(s,a,Math.min(i,n))))return s;const r=qt.search(e,Ht.bind(null,t,n));return r&&(r!==a||!s)?r:s}function pn(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((i,s)=>(s[0]==="INF"&&(i+=parseFloat(s[1])),i),t);return a.start<=n}return!1}function Ht(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=a?1:t.start-n>a&&t.start?-1:0}function Xt(a,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>a}function An(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let n=a.fragments;const{fragmentHint:i}=a;i&&(n=n.concat(i));let s;return qt.search(n,r=>r.cc<e?1:r.cc>e?-1:(s=r,r.end<=t?1:r.start>t?-1:0)),s||null}return null}function rn(a){switch(a.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function nn(a,e){const t=rn(e);return a.default[`${t?"timeout":"error"}Retry`]}function Rn(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function fn(a){return y(y({},a),{errorRetry:null,timeoutRetry:null})}function yn(a,e,t,n){if(!a)return!1;const i=n==null?void 0:n.code,s=e<a.maxNumRetry&&(Zn(i)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,n,s):s}function Zn(a){return Pn(a)||!!a&&(a<400||a>499)}function Pn(a){return a===0&&navigator.onLine===!1}var En={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},bn={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class Yn extends F{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(g.ERROR,this.onError,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.ERROR,this.onError,this),e.off(g.ERROR,this.onErrorOut,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===ee.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,n=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||n===-1?t.loadLevel:n}variantHasKey(e,t){if(e){var n;if((n=e.details)!=null&&n.hasKey(t))return!0;const i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter(r=>i.indexOf(r.groupId)>=0).some(r=>{var o;return(o=r.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;const i=this.hls,s=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case $.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction=Wn();return}case $.FRAG_GAP:case $.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=En.SendAlternateToPenaltyBox;return}case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:{var r;const c=t.parent===ee.MAIN?t.level:i.loadLevel;t.details===$.LEVEL_EMPTY_ERROR&&((r=t.context)!=null&&(r=r.levelDetails)!=null&&r.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const c=i.loadLevelObj;if(c&&(s.type===ue.AUDIO_TRACK&&c.hasAudioGroup(s.groupId)||s.type===ue.SUBTITLE_TRACK&&c.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=En.SendAlternateToPenaltyBox,t.errorAction.flags=bn.MoveAllAlternatesMatchingHost;return}}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:En.SendAlternateToPenaltyBox,flags:bn.MoveAllAlternatesMatchingHDCP};return;case $.KEY_SYSTEM_SESSION_UPDATE_FAILED:case $.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case $.KEY_SYSTEM_NO_SESSION:t.errorAction={action:En.SendAlternateToPenaltyBox,flags:bn.MoveAllAlternatesMatchingKey};return;case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:case $.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:i.loadLevel)}return;case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:t.errorAction=Wn();return}t.type===ne.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Wn())}getPlaylistRetryOrSwitchAction(e,t){const n=this.hls,i=nn(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(yn(i,s,rn(e),e.response))return{action:En.RetryRequest,flags:bn.None,retryConfig:i,retryCount:s};const o=this.getLevelSwitchAction(e,t);return i&&(o.retryConfig=i,o.retryCount=s),o}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),i=t.levels[n],{fragLoadPolicy:s,keyLoadPolicy:r}=t.config,o=nn(e.details.startsWith("key")?r:s,e),c=t.levels.reduce((h,f)=>h+f.fragmentError,0);if(i&&(e.details!==$.FRAG_GAP&&i.fragmentError++,yn(o,c,rn(e),e.response)))return{action:En.RetryRequest,flags:bn.None,retryConfig:o,retryCount:c};const u=this.getLevelSwitchAction(e,n);return o&&(u.retryConfig=o,u.retryCount=c),u}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const i=this.hls.levels[t];if(i){var s,r;const u=e.details;i.loadError++,u===$.BUFFER_APPEND_ERROR&&i.fragmentError++;let h=-1;const{levels:f,loadLevel:d,minAutoLevel:E,maxAutoLevel:b}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);const R=(s=e.frag)==null?void 0:s.type,V=(R===ee.AUDIO&&u===$.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===$.BUFFER_ADD_CODEC_ERROR||u===$.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:Ye})=>i.audioCodec!==Ye),te=e.sourceBufferName==="video"&&(u===$.BUFFER_ADD_CODEC_ERROR||u===$.BUFFER_APPEND_ERROR)&&f.some(({codecSet:Ye,audioCodec:Re})=>i.codecSet!==Ye&&i.audioCodec===Re),{type:Se,groupId:Fe}=(r=e.context)!=null?r:{};for(let Ye=f.length;Ye--;){const Re=(Ye+d)%f.length;if(Re!==d&&Re>=E&&Re<=b&&f[Re].loadError===0){var o,c;const Ue=f[Re];if(u===$.FRAG_GAP&&R===ee.MAIN&&e.frag){const Ge=f[Re].details;if(Ge){const Ie=on(e.frag,Ge.fragments,e.frag.start);if(Ie!=null&&Ie.gap)continue}}else{if(Se===ue.AUDIO_TRACK&&Ue.hasAudioGroup(Fe)||Se===ue.SUBTITLE_TRACK&&Ue.hasSubtitleGroup(Fe))continue;if(R===ee.AUDIO&&(o=i.audioGroups)!=null&&o.some(Ge=>Ue.hasAudioGroup(Ge))||R===ee.SUBTITLE&&(c=i.subtitleGroups)!=null&&c.some(Ge=>Ue.hasSubtitleGroup(Ge))||V&&i.audioCodec===Ue.audioCodec||te&&i.codecSet===Ue.codecSet||!V&&i.codecSet!==Ue.codecSet)continue}h=Re;break}}if(h>-1&&n.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:En.SendAlternateToPenaltyBox,flags:bn.None,nextAutoLevel:h}}return{action:En.SendAlternateToPenaltyBox,flags:bn.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case En.DoNothing:break;case En.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==$.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case En.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,n=e.errorAction;if(!n)return;const{flags:i}=n,s=n.nextAutoLevel;switch(i){case bn.None:this.switchLevel(e,s);break;case bn.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),u=t.levels[c],h=u==null?void 0:u.attrs["HDCP-LEVEL"];if(n.hdcpLevel=h,h){t.maxHdcpLevel=ln[ln.indexOf(h)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case bn.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const u=this.hls.levels;for(let h=u.length;h--;)if(this.variantHasKey(u[h],c)){var r,o;this.log(`Banned key found in level ${h} (${u[h].bitrate}bps) or audio group "${(r=u[h].audioGroups)==null?void 0:r.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${k(c.keyId||[])}`),u[h].fragmentError++,u[h].loadError++,this.log(`Removing level ${h} with key error (${e.error})`),this.hls.removeLevel(h)}u.length&&(n.resolved=!0)}break}}n.resolved||this.switchLevel(e,s)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===$.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const n=Wt(e.mimeType),i=this.hls.levels;for(let s=i.length;s--;)i[s][`${e.sourceBufferName}Codec`]===n&&(this.log(`Removing level ${s} for ${e.details} ("${n}" not supported)`),this.hls.removeLevel(s))}}}function Wn(a){const e={action:En.DoNothing,flags:bn.None};return a&&(e.resolved=!0),e}var hn={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class ni{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(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.BUFFER_APPENDED,this.onBufferAppended,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.BUFFER_APPENDED,this.onBufferAppended,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let i=n.length;i--;){const s=n[i];if(!s)break;if(s.start<=e&&e<=s.end&&s.loaded)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,n){const{fragments:i}=this,s=Object.keys(i);for(let r=s.length;r--;){const o=i[s[r]];if((o==null?void 0:o.body.type)===t&&(!n||o.buffered)){const c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,n,i,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const c=this.fragments[o];if(!c||r>=c.body.sn)return;if(!c.buffered&&(!c.loaded||s)){c.body.type===n&&this.removeFragment(c.body);return}const u=c.range[e];if(u){if(u.time.length===0){this.removeFragment(c.body);return}u.time.some(h=>{const f=!this.isTimeBuffered(h.startPTS,h.endPTS,t);return f&&this.removeFragment(c.body),f})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const n=e.frag,i=Mn(n),s=this.fragments[i];if(!s||s.buffered&&n.gap)return;const r=!n.relurl;Object.keys(t).forEach(o=>{const c=n.elementaryStreams[o];if(!c)return;const u=t[o],h=r||c.partial===!0;s.range[o]=this.getBufferedTimes(n,e.part,h,u)}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=n.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),Jn(s)||this.removeParts(n.sn-1,n.type)):this.removeFragment(s.body)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=di(n,i=>i.fragment.sn>=e))}fragBuffered(e,t){const n=Mn(e);let i=this.fragments[n];!i&&t&&(i=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,n,i){const s={time:[],partial:n},r=e.start,o=e.end,c=e.minEndPTS||o,u=e.maxStartPTS||r;for(let h=0;h<i.length;h++){const f=i.start(h)-this.bufferPadding,d=i.end(h)+this.bufferPadding;if(u>=f&&c<=d){s.time.push({startPTS:Math.max(r,i.start(h)),endPTS:Math.min(o,i.end(h))});break}else if(r<d&&o>f){const E=Math.max(r,i.start(h)),b=Math.min(o,i.end(h));b>E&&(s.partial=!0,s.time.push({startPTS:E,endPTS:b}))}else if(o<=f)break}return s}getPartialFragment(e){let t=null,n,i,s,r=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(u=>{const h=c[u];h&&Jn(h)&&(i=h.body.start-o,s=h.body.end+o,e>=i&&e<=s&&(n=Math.min(e-i,s-e),r<=n&&(t=h.body,r=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Jn(t))}getState(e){const t=Mn(e),n=this.fragments[t];return n?n.buffered?Jn(n)?hn.PARTIAL:hn.OK:hn.APPENDING:hn.NOT_LOADED}isTimeBuffered(e,t,n){let i,s;for(let r=0;r<n.length;r++){if(i=n.start(r)-this.bufferPadding,s=n.end(r)+this.bufferPadding,e>=i&&t<=s)return!0;if(t<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const n=t.frag,i=t.part?null:t,s=Mn(n);this.fragments[s]={body:n,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:i,timeRanges:s,type:r}=t;if(n.sn==="initSegment")return;const o=n.type;if(i){let u=this.activePartLists[o];u||(this.activePartLists[o]=u=[]),u.push(i)}this.timeRanges=s;const c=s[r];this.detectEvictedFragments(r,c,o,i)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Mn(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,n=Object.keys(t);if(!e)return n.length>0;for(let i=n.length;i--;){const s=t[n[i]];if((s==null?void 0:s.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const o=this.fragments[r];if(!o)return;const c=o.body;c.type!==n||i&&!c.gap||c.start<t&&c.end>e&&(o.buffered||s)&&this.removeFragment(c)})}removeFragment(e){const t=Mn(e);e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const i=e.sn;this.activePartLists[e.type]=di(n,s=>s.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(n=>n.clearElementaryStreamInfo())}}function Jn(a){var e,t,n;return a.buffered&&!!(a.body.gap||(e=a.range.video)!=null&&e.partial||(t=a.range.audio)!=null&&t.partial||(n=a.range.audiovideo)!=null&&n.partial)}function Mn(a){return`${a.type}_${a.level}_${a.sn}`}function di(a,e){return a.filter(t=>{const n=e(t);return n||t.clearElementaryStreamInfo(),n})}var xn={cbc:0,ctr:1};class hi{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case xn.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case xn.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function Li(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class Ci{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),n=new Uint32Array(4);for(let i=0;i<4;i++)n[i]=t.getUint32(i*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],s=n[1],r=n[2],o=n[3],c=this.invSubMix,u=c[0],h=c[1],f=c[2],d=c[3],E=new Uint32Array(256);let b=0,R=0,T=0;for(T=0;T<256;T++)T<128?E[T]=T<<1:E[T]=T<<1^283;for(T=0;T<256;T++){let V=R^R<<1^R<<2^R<<3^R<<4;V=V>>>8^V&255^99,e[b]=V,t[V]=b;const se=E[b],te=E[se],Se=E[te];let Fe=E[V]*257^V*16843008;i[b]=Fe<<24|Fe>>>8,s[b]=Fe<<16|Fe>>>16,r[b]=Fe<<8|Fe>>>24,o[b]=Fe,Fe=Se*16843009^te*65537^se*257^b*16843008,u[V]=Fe<<24|Fe>>>8,h[V]=Fe<<16|Fe>>>16,f[V]=Fe<<8|Fe>>>24,d[V]=Fe,b?(b=se^E[E[E[Se^se]]],R^=E[E[R]]):b=R=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<t.length&&n;)n=t[i]===this.key[i],i++;if(n)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const r=this.ksRows=(s+6+1)*4;let o,c;const u=this.keySchedule=new Uint32Array(r),h=this.invKeySchedule=new Uint32Array(r),f=this.sBox,d=this.rcon,E=this.invSubMix,b=E[0],R=E[1],T=E[2],V=E[3];let se,te;for(o=0;o<r;o++){if(o<s){se=u[o]=t[o];continue}te=se,o%s===0?(te=te<<8|te>>>24,te=f[te>>>24]<<24|f[te>>>16&255]<<16|f[te>>>8&255]<<8|f[te&255],te^=d[o/s|0]<<24):s>6&&o%s===4&&(te=f[te>>>24]<<24|f[te>>>16&255]<<16|f[te>>>8&255]<<8|f[te&255]),u[o]=se=(u[o-s]^te)>>>0}for(c=0;c<r;c++)o=r-c,c&3?te=u[o]:te=u[o-4],c<4||o<=4?h[c]=te:h[c]=b[f[te>>>24]]^R[f[te>>>16&255]]^T[f[te>>>8&255]]^V[f[te&255]],h[c]=h[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const i=this.keySize+6,s=this.invKeySchedule,r=this.invSBox,o=this.invSubMix,c=o[0],u=o[1],h=o[2],f=o[3],d=this.uint8ArrayToUint32Array_(n);let E=d[0],b=d[1],R=d[2],T=d[3];const V=new Int32Array(e),se=new Int32Array(V.length);let te,Se,Fe,Ye,Re,Ue,Ge,Ie,it,It,Mt,Gt,Nt,At;const $t=this.networkToHostOrderSwap;for(;t<V.length;){for(it=$t(V[t]),It=$t(V[t+1]),Mt=$t(V[t+2]),Gt=$t(V[t+3]),Re=it^s[0],Ue=Gt^s[1],Ge=Mt^s[2],Ie=It^s[3],Nt=4,At=1;At<i;At++)te=c[Re>>>24]^u[Ue>>16&255]^h[Ge>>8&255]^f[Ie&255]^s[Nt],Se=c[Ue>>>24]^u[Ge>>16&255]^h[Ie>>8&255]^f[Re&255]^s[Nt+1],Fe=c[Ge>>>24]^u[Ie>>16&255]^h[Re>>8&255]^f[Ue&255]^s[Nt+2],Ye=c[Ie>>>24]^u[Re>>16&255]^h[Ue>>8&255]^f[Ge&255]^s[Nt+3],Re=te,Ue=Se,Ge=Fe,Ie=Ye,Nt=Nt+4;te=r[Re>>>24]<<24^r[Ue>>16&255]<<16^r[Ge>>8&255]<<8^r[Ie&255]^s[Nt],Se=r[Ue>>>24]<<24^r[Ge>>16&255]<<16^r[Ie>>8&255]<<8^r[Re&255]^s[Nt+1],Fe=r[Ge>>>24]<<24^r[Ie>>16&255]<<16^r[Re>>8&255]<<8^r[Ue&255]^s[Nt+2],Ye=r[Ie>>>24]<<24^r[Re>>16&255]<<16^r[Ue>>8&255]<<8^r[Ge&255]^s[Nt+3],se[t]=$t(te^E),se[t+1]=$t(Ye^b),se[t+2]=$t(Fe^R),se[t+3]=$t(Se^T),E=it,b=It,R=Mt,T=Gt,t=t+4}return se.buffer}}class _i{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){const e=ki(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function ki(a){switch(a){case xn.cbc:return"AES-CBC";case xn.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const oi=16;class li{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 n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(n){}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 n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Li(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n,i){return this.useSoftware?new Promise((s,r)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,n,i);const c=this.flush();c?s(c.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n,i)}softwareDecrypt(e,t,n,i){const{currentIV:s,currentResult:r,remainderData:o}=this;if(i!==xn.cbc||t.byteLength!==16)return X.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Ve(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;s&&(n=s);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new Ci),u.expandKey(t);const h=r;return this.currentResult=u.decrypt(c.buffer,0,n),this.currentIV=c.slice(-16).buffer,h||null}webCryptoDecrypt(e,t,n,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,i));this.key=t,this.fastAesKey=new _i(this.subtle,t,i)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new hi(this.subtle,new Uint8Array(n),i).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(X.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,n,i)))}onWebCryptoError(e,t,n,i){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,i);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%oi;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&(X.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Pi=Math.pow(2,17);class vi{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 n=e.url;if(!n)return Promise.reject(new Hn({type:ne.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,s=i.fLoader,r=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(b=>b[0]==="GAP")){c(jn(e));return}else e.gap=!1;const u=this.loader=s?new s(i):new r(i),h=gi(e);e.loader=u;const f=fn(i.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Pi};e.stats=u.stats;const E={onSuccess:(b,R,T,V)=>{this.resetLoader(e,u);let se=b.data;T.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(se.slice(0,16)),se=se.slice(16)),o({frag:e,part:null,payload:se,networkDetails:V})},onError:(b,R,T,V)=>{this.resetLoader(e,u),c(new Hn({type:ne.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:y({url:n,data:void 0},b),error:new Error(`HTTP Error ${b.code} ${b.text}`),networkDetails:T,stats:V}))},onAbort:(b,R,T)=>{this.resetLoader(e,u),c(new Hn({type:ne.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:T,stats:b}))},onTimeout:(b,R,T)=>{this.resetLoader(e,u),c(new Hn({type:ne.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:T,stats:b}))}};t&&(E.onProgress=(b,R,T,V)=>t({frag:e,part:null,payload:T,networkDetails:V})),u.load(h,d,E)})}loadPart(e,t,n){this.abort();const i=this.config,s=i.fLoader,r=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(jn(e,t));return}const u=this.loader=s?new s(i):new r(i),h=gi(e,t);e.loader=u;const f=fn(i.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Pi};t.stats=u.stats,u.load(h,d,{onSuccess:(E,b,R,T)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const V={frag:e,part:t,payload:E.data,networkDetails:T};n(V),o(V)},onError:(E,b,R,T)=>{this.resetLoader(e,u),c(new Hn({type:ne.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:y({url:h.url,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:R,stats:T}))},onAbort:(E,b,R)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new Hn({type:ne.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:R,stats:E}))},onTimeout:(E,b,R)=>{this.resetLoader(e,u),c(new Hn({type:ne.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:R,stats:E}))}})})}updateStatsFromPart(e,t){const n=e.stats,i=t.stats,s=i.total;if(n.loaded+=i.loaded,s){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(n.loaded/s),c),f=(c-u)*Math.round(n.loaded/u);n.total=n.loaded+f}else n.total=Math.max(n.loaded,n.total);const r=n.loading,o=i.loading;r.start?r.first+=o.first-o.start:(r.start=o.start,r.first=o.first),r.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function gi(a,e=null){const t=e||a,n={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(N(i)&&N(s)){var r;let o=i,c=s;if(a.sn==="initSegment"&&fi((r=a.decryptdata)==null?void 0:r.method)){const u=s-i;u%16&&(c=s+(16-u%16)),i!==0&&(n.resetIV=!0,o=i-16)}n.rangeStart=o,n.rangeEnd=c}return n}function jn(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),n={type:ne.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(n.part=e),(e||a).stats.aborted=!0,new Hn(n)}function fi(a){return a==="AES-128"||a==="AES-256"}class Hn extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Oi extends F{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class ii{constructor(e,t,n,i=0,s=-1,r=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=ui(),this.buffering={audio:ui(),video:ui(),audiovideo:ui()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=s,this.partial=r}}function ui(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Ai={length:0,start:()=>0,end:()=>0};class Zt{static isBuffered(e,t){if(e){const n=Zt.getBuffered(e);for(let i=n.length;i--;)if(t>=n.start(i)&&t<=n.end(i))return!0}return!1}static bufferedRanges(e){if(e){const t=Zt.getBuffered(e);return Zt.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(e,t,n){if(e){const i=Zt.bufferedRanges(e);if(i.length)return Zt.bufferedInfo(i,t,n)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort((h,f)=>h.start-f.start||f.end-h.end);let i=-1,s=[];if(n)for(let h=0;h<e.length;h++){t>=e[h].start&&t<=e[h].end&&(i=h);const f=s.length;if(f){const d=s[f-1].end;e[h].start-d<n?e[h].end>d&&(s[f-1].end=e[h].end):s.push(e[h])}else s.push(e[h])}else s=e;let r=0,o,c=t,u=t;for(let h=0;h<s.length;h++){const f=s[h].start,d=s[h].end;if(i===-1&&t>=f&&t<=d&&(i=h),t+n>=f&&t<d)c=f,u=d,r=u-t;else if(t+n<f){o=f;break}}return{len:r,start:c||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:i}}static getBuffered(e){try{return e.buffered||Ai}catch(t){return X.log("failed to get media.buffered",t),Ai}}}const $i=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ki(a){return $i.test(a)}function Ni(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace($i,n=>{const i=n.substring(2,n.length-1),s=t==null?void 0:t[i];return s===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),n):s})}return e}function Bi(a,e,t){let n=a.variableList;n||(a.variableList=n={});let i,s;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const r=new self.URL(t).searchParams;if(r.has(i))s=r.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(r){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${r.message}`))}}else i=e.NAME,s=e.VALUE;i in n?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=s||""}function rs(a,e,t){const n=e.IMPORT;if(t&&n in t){let i=a.variableList;i||(a.variableList=i={}),i[n]=t[n]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}const ds=/^(\d+)x(\d+)$/,Gi=/(.+?)=(".*?"|.*?)(?:,|$)/g;class _n{constructor(e,t){typeof e=="string"&&(e=_n.parseAttrList(e,t)),p(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const n=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(i*2,i*2+2),16);return n}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 n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((i,s)=>(i[s.toLowerCase()]=!0,i),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=ds.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n;const i={},s='"';for(Gi.lastIndex=0;(n=Gi.exec(e))!==null;){const r=n[1].trim();let o=n[2];const c=o.indexOf(s)===0&&o.lastIndexOf(s)===o.length-1;let u=!1;if(c)o=o.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(c||u))o=Ni(t,o);else if(!u&&!c)switch(r){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":X.warn(`${e}: attribute ${r} is missing quotes`)}i[r]=o}return i}}const ps="com.apple.hls.interstitial";function gs(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function Yi(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class qi{constructor(e,t,n=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(i=t==null?void 0:t.tagOrder)!=null?i:n,t){const s=t.attr;for(const r in s)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==s[r]){X.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=p(new _n({}),s,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);N(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(X.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(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 this.class===ps}get isValid(){return!!this.id&&!this._badValueForSameId&&N(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const Xi=10;class zi{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let n=t.decryptdata;return n||(t.setKeyFormat(e.keyFormat),n=t.decryptdata),!!n&&e.matches(n)})}get hasProgramDateTime(){return this.fragments.length?N(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Xi}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let n=e.length;n--;)if(e[n].index>t)return e[n].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function ci(a,e){return a.length===e.length?!a.some((t,n)=>t!==e[n]):!1}function Ei(a,e){return!a&&!e?!0:!a||!e?!1:ci(a,e)}function bi(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function ei(a){switch(a){case"AES-128":case"AES-256":return xn.cbc;case"AES-256-CTR":return xn.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function Un(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function si(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function Di(a){const e=si(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Vi(a){const e=function(n,i,s){const r=n[i];n[i]=n[s],n[s]=r};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function as(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),i=n[n.length-1].split(",");if(i.length===2){const s=i[0]==="base64",r=i[1];s?(n.splice(-1,1),t=Un(r)):t=Di(r)}}return t}const Qi=typeof self!="undefined"?self:void 0;var $n={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ri={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function os(a){switch(a){case ri.FAIRPLAY:return $n.FAIRPLAY;case ri.PLAYREADY:return $n.PLAYREADY;case ri.WIDEVINE:return $n.WIDEVINE;case ri.CLEARKEY:return $n.CLEARKEY}}function kt(a){switch(a){case $n.FAIRPLAY:return ri.FAIRPLAY;case $n.PLAYREADY:return ri.PLAYREADY;case $n.WIDEVINE:return ri.WIDEVINE;case $n.CLEARKEY:return ri.CLEARKEY}}function zt(a){const{drmSystems:e,widevineLicenseUrl:t}=a,n=e?[$n.FAIRPLAY,$n.WIDEVINE,$n.PLAYREADY,$n.CLEARKEY].filter(i=>!!e[i]):[];return!n[$n.WIDEVINE]&&t&&n.push($n.WIDEVINE),n}const On=function(a){return Qi!=null&&(a=Qi.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function qn(a,e,t,n){let i;switch(a){case $n.FAIRPLAY:i=["cenc","sinf"];break;case $n.WIDEVINE:case $n.PLAYREADY:i=["cenc"];break;case $n.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return zn(i,e,t,n)}function zn(a,e,t,n){return[{initDataTypes:a,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function ms(a){var e;return!!a&&(a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Fi(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),n=t.substring(t.indexOf("<"),t.length),r=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(r){const o=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(o){const c=Un(o).subarray(0,16);return Vi(c),c}}return null}let _s={};class Ji{static clearKeyUriToKeyIdMap(){_s={}}constructor(e,t,n,i=[1],s=null,r){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=n,this.keyFormatVersions=i,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!bi(e),r!=null&&r.startsWith("0x")&&(this.keyId=new Uint8Array(S(r)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&ci(e.keyFormatVersions,this.keyFormatVersions)&&Ei(e.iv,this.iv)&&Ei(e.keyId,this.keyId)}isSupported(){if(this.method){if(bi(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case ri.FAIRPLAY:case ri.WIDEVINE:case ri.PLAYREADY:case ri.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(bi(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(X.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const n=hr(e);return new Ji(this.method,this.uri,"identity",this.keyFormatVersions,n)}if(this.pssh&&this.keyId)return this;const t=as(this.uri);if(t)switch(this.keyFormat){case ri.WIDEVINE:if(this.pssh=t,!this.keyId&&t.length>=22){const n=t.length-22;this.keyId=t.subarray(n,n+16)}break;case ri.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Et(n,null,t),this.keyId=Fi(t);break}default:{let n=t.subarray(0,16);if(n.length!==16){const i=new Uint8Array(16);i.set(n,16-n.length),n=i}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n=_s[this.uri];if(!n){const i=Object.keys(_s).length%Number.MAX_SAFE_INTEGER;n=new Uint8Array(16),new DataView(n.buffer,12,4).setUint32(0,i),_s[this.uri]=n}this.keyId=n}return this}}function hr(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const fr=/#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,dr=/#EXT-X-MEDIA:(.*)/g,Wr=/^#EXT(?:INF|-X-TARGETDURATION):/m,Fs=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Ms=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 Wi{static findGroup(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.id===t)return i}}static resolve(e,t){return _.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Wr.test(e)}static parseMasterPlaylist(e,t){const n=Ki(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];fr.lastIndex=0;let r;for(;(r=fr.exec(e))!=null;)if(r[1]){var o;const u=new _n(r[1],i),h=Ni(i,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Wi.resolve(h,t)},d=u.decimalResolution("RESOLUTION");d&&(f.width=d.width,f.height=d.height),pr(u.CODECS,f);const E=u["SUPPLEMENTAL-CODECS"];E&&(f.supplemental={},pr(E,f.supplemental)),(o=f.unknownCodecs)!=null&&o.length||s.push(f),i.levels.push(f)}else if(r[3]){const u=r[3],h=r[4];switch(u){case"SESSION-DATA":{const f=new _n(h,i),d=f["DATA-ID"];d&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[d]=f);break}case"SESSION-KEY":{const f=Ys(h,t,i);f.encrypted&&f.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(f)):X.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const f=new _n(h,i);Bi(i,f,t)}break}case"CONTENT-STEERING":{const f=new _n(h,i);i.contentSteering={uri:Wi.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=qs(h);break}}}const c=s.length>0&&s.length<i.levels.length;return i.levels=c?s:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,n){let i;const s={},r=n.levels,o={AUDIO:r.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:r.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(dr.lastIndex=0;(i=dr.exec(e))!==null;){const u=new _n(i[1],n),h=u.TYPE;if(h){const f=o[h],d=s[h]||[];s[h]=d;const E=u.LANGUAGE,b=u["ASSOC-LANGUAGE"],R=u.CHANNELS,T=u.CHARACTERISTICS,V=u["INSTREAM-ID"],se={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||E||"",type:h,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:E,url:u.URI?Wi.resolve(u.URI,t):""};if(b&&(se.assocLang=b),R&&(se.channels=R),T&&(se.characteristics=T),V&&(se.instreamId=V),f!=null&&f.length){const te=Wi.findGroup(f,se.groupId)||f[0];Xs(se,te,"audioCodec"),Xs(se,te,"textCodec")}d.push(se)}}return s}static parseLevelPlaylist(e,t,n,i,s,r){var o;const c={url:t},u=new zi(t),h=u.fragments,f=[];let d=null,E=0,b=0,R=0,T=0,V=0,se=null,te=new ye(i,c),Se,Fe,Ye,Re=-1,Ue=!1,Ge=null,Ie;if(Fs.lastIndex=0,u.m3u8=e,u.hasVariableRefs=Ki(e),((o=Fs.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(Se=Fs.exec(e))!==null;){Ue&&(Ue=!1,te=new ye(i,c),te.playlistOffset=R,te.setStart(R),te.sn=E,te.cc=T,V&&(te.bitrate=V),te.level=n,d&&(te.initSegment=d,d.rawProgramDateTime&&(te.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null),Ge&&(te.setByteRange(Ge),Ge=null)));const Gt=Se[1];if(Gt){te.duration=parseFloat(Gt);const Nt=(" "+Se[2]).slice(1);te.title=Nt||null,te.tagList.push(Nt?["INF",Gt,Nt]:["INF",Gt])}else if(Se[3]){if(N(te.duration)){te.playlistOffset=R,te.setStart(R),Ye&&mr(te,Ye,u),te.sn=E,te.level=n,te.cc=T,h.push(te);const Nt=(" "+Se[3]).slice(1);te.relurl=Ni(u,Nt),Bs(te,se,f),se=te,R+=te.duration,E++,b=0,Ue=!0}}else{if(Se=Se[0].match(Ms),!Se){X.warn("No matches on slow regex match for level playlist!");continue}for(Fe=1;Fe<Se.length&&Se[Fe]===void 0;Fe++);const Nt=(" "+Se[Fe]).slice(1),At=(" "+Se[Fe+1]).slice(1),$t=Se[Fe+2]?(" "+Se[Fe+2]).slice(1):null;switch(Nt){case"BYTERANGE":se?te.setByteRange(At,se):te.setByteRange(At);break;case"PROGRAM-DATE-TIME":te.rawProgramDateTime=At,te.tagList.push(["PROGRAM-DATE-TIME",At]),Re===-1&&(Re=h.length);break;case"PLAYLIST-TYPE":u.type&&es(u,Nt,Se),u.type=At.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?es(u,Nt,Se):h.length>0&&_r(u,Nt,Se),E=u.startSN=parseInt(At);break;case"SKIP":{u.skippedSegments&&es(u,Nt,Se);const Lt=new _n(At,u),Kt=Lt.decimalInteger("SKIPPED-SEGMENTS");if(N(Kt)){u.skippedSegments+=Kt;for(let Dt=Kt;Dt--;)h.push(null);E+=Kt}const tn=Lt.enumeratedString("RECENTLY-REMOVED-DATERANGES");tn&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(tn.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&es(u,Nt,Se),u.targetduration=Math.max(parseInt(At),1);break;case"VERSION":u.version!==null&&es(u,Nt,Se),u.version=parseInt(At);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||es(u,Nt,Se),u.live=!1;break;case"#":(At||$t)&&te.tagList.push($t?[At,$t]:[At]);break;case"DISCONTINUITY":T++,te.tagList.push(["DIS"]);break;case"GAP":te.gap=!0,te.tagList.push([Nt]);break;case"BITRATE":te.tagList.push([Nt,At]),V=parseInt(At)*1e3,N(V)?te.bitrate=V:V=0;break;case"DATERANGE":{const Lt=new _n(At,u),Kt=new qi(Lt,u.dateRanges[Lt.ID],u.dateRangeTagCount);u.dateRangeTagCount++,Kt.isValid||u.skippedSegments?u.dateRanges[Kt.id]=Kt:X.warn(`Ignoring invalid DATERANGE tag: "${At}"`),te.tagList.push(["EXT-X-DATERANGE",At]);break}case"DEFINE":{{const Lt=new _n(At,u);"IMPORT"in Lt?rs(u,Lt,r):Bi(u,Lt,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?es(u,Nt,Se):h.length>0&&_r(u,Nt,Se),u.startCC=T=parseInt(At);break;case"KEY":{const Lt=Ys(At,t,u);if(Lt.isSupported()){if(Lt.method==="NONE"){Ye=void 0;break}Ye||(Ye={});const Kt=Ye[Lt.keyFormat];Kt!=null&&Kt.matches(Lt)||(Kt&&(Ye=p({},Ye)),Ye[Lt.keyFormat]=Lt)}else X.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${At}"`);break}case"START":u.startTimeOffset=qs(At);break;case"MAP":{const Lt=new _n(At,u);if(te.duration){const Kt=new ye(i,c);gr(Kt,Lt,n,Ye),d=Kt,te.initSegment=d,d.rawProgramDateTime&&!te.rawProgramDateTime&&(te.rawProgramDateTime=d.rawProgramDateTime)}else{const Kt=te.byteRangeEndOffset;if(Kt){const tn=te.byteRangeStartOffset;Ge=`${Kt-tn}@${tn}`}else Ge=null;gr(te,Lt,n,Ye),d=te,Ue=!0}d.cc=T;break}case"SERVER-CONTROL":{Ie&&es(u,Nt,Se),Ie=new _n(At),u.canBlockReload=Ie.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=Ie.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&Ie.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=Ie.optionalFloat("PART-HOLD-BACK",0),u.holdBack=Ie.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&es(u,Nt,Se);const Lt=new _n(At);u.partTarget=Lt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Lt=u.partList;Lt||(Lt=u.partList=[]);const Kt=b>0?Lt[Lt.length-1]:void 0,tn=b++,Dt=new _n(At,u),Rt=new Oe(Dt,te,c,tn,Kt);Lt.push(Rt),te.duration+=Rt.duration;break}case"PRELOAD-HINT":{const Lt=new _n(At,u);u.preloadHint=Lt;break}case"RENDITION-REPORT":{const Lt=new _n(At,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(Lt);break}default:X.warn(`line parsed but not handled: ${Se}`);break}}}se&&!se.relurl?(h.pop(),R-=se.duration,u.partList&&(u.fragmentHint=se)):u.partList&&(Bs(te,se,f),te.cc=T,u.fragmentHint=te,Ye&&mr(te,Ye,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const it=h.length,It=h[0],Mt=h[it-1];if(R+=u.skippedSegments*u.targetduration,R>0&&it&&Mt){u.averagetargetduration=R/it;const Gt=Mt.sn;u.endSN=Gt!=="initSegment"?Gt:0,u.live||(Mt.endList=!0),Re>0&&(jr(h,Re),It&&f.unshift(It))}return u.fragmentHint&&(R+=u.fragmentHint.duration),u.totalduration=R,f.length&&u.dateRangeTagCount&&It&&Ns(f,u),u.endCC=T,u}}function Ns(a,e){let t=a.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];a.push(o),t++}else return;const n=a[t-1],i=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let o=s.length;o--;){const c=e.dateRanges[s[o]],u=c.startDate.getTime();c.tagAnchor=n.ref;for(let h=t;h--;){var r;if(((r=a[h])==null?void 0:r.sn)<e.startSN)break;const f=vs(e,u,a,h,i);if(f!==-1){c.tagAnchor=e.fragments[f].ref;break}}}}function vs(a,e,t,n,i){const s=t[n];if(s){const o=s.programDateTime;if(e>=o||n===0){var r;const c=(((r=t[n+1])==null?void 0:r.start)||i)-s.start;if(e<=o+c*1e3){const u=t[n].sn-a.startSN;if(u<0)return-1;const h=a.fragments;if(h.length>t.length){const d=(t[n+1]||h[h.length-1]).sn-a.startSN;for(let E=d;E>u;E--){const b=h[E].programDateTime;if(e>=b&&e<b+h[E].duration*1e3)return E}}return u}}}return-1}function Ys(a,e,t){var n,i;const s=new _n(a,t),r=(n=s.METHOD)!=null?n:"",o=s.URI,c=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,h=(i=s.KEYFORMAT)!=null?i:"identity";o&&s.IV&&!c&&X.error(`Invalid IV: ${s.IV}`);const f=o?Wi.resolve(o,e):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Ji(r,f,h,d,c,s.KEYID)}function qs(a){const t=new _n(a).decimalFloatingPoint("TIME-OFFSET");return N(t)?t:null}function pr(a,e){let t=(a||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=t.filter(s=>st(s,n));i.length&&(e[`${n}Codec`]=i.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function Xs(a,e,t){const n=e[t];n&&(a[t]=n)}function jr(a,e){let t=a[e];for(let n=e;n--;){const i=a[n];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function Bs(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function gr(a,e,t,n){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",n&&(a.levelkeys=n),a.initSegment=null}function mr(a,e,t){a.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&n.push(a)}function es(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function _r(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Us(a,e){const t=e.startPTS;if(N(t)){let n=0,i;e.sn>a.sn?(n=t-a.start,i=a):(n=a.start-t,i=e),i.duration!==n&&i.setDuration(n)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.setStart(a.start+(a.minEndPTS-a.start)):e.setStart(a.start+a.duration):e.setStart(Math.max(a.start-e.duration,0))}function Ss(a,e,t,n,i,s,r){n-t<=0&&(r.warn("Fragment should have a positive duration",e),n=t+e.duration,s=i+e.duration);let c=t,u=n;const h=e.startPTS,f=e.endPTS;if(N(h)){const V=Math.abs(h-t);a&&V>a.totalduration?r.warn(`media timestamps and playlist times differ by ${V}s for level ${e.level} ${a.url}`):N(e.deltaPTS)?e.deltaPTS=Math.max(V,e.deltaPTS):e.deltaPTS=V,c=Math.max(t,h),t=Math.min(t,h),i=e.startDTS!==void 0?Math.min(i,e.startDTS):i,u=Math.min(n,f),n=Math.max(n,f),s=e.endDTS!==void 0?Math.max(s,e.endDTS):s}const d=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(n-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=i,e.endPTS=n,e.minEndPTS=u,e.endDTS=s;const E=e.sn;if(!a||E<a.startSN||E>a.endSN)return 0;let b;const R=E-a.startSN,T=a.fragments;for(T[R]=e,b=R;b>0;b--)Us(T[b],T[b-1]);for(b=R;b<T.length-1;b++)Us(T[b],T[b+1]);return a.fragmentHint&&Us(T[T.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,d}function Qs(a,e,t){if(a===e)return;let n=null;const i=a.fragments;for(let h=i.length-1;h>=0;h--){const f=i[h].initSegment;if(f){n=f;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let s;Yr(a,e,(h,f,d,E)=>{if((!e.startCC||e.skippedSegments)&&f.cc!==h.cc){const b=h.cc-f.cc;for(let R=d;R<E.length;R++)E[R].cc+=b;e.endCC=E[E.length-1].cc}N(h.startPTS)&&N(h.endPTS)&&(f.setStart(f.startPTS=h.startPTS),f.startDTS=h.startDTS,f.maxStartPTS=h.maxStartPTS,f.endPTS=h.endPTS,f.endDTS=h.endDTS,f.minEndPTS=h.minEndPTS,f.setDuration(h.endPTS-h.startPTS),f.duration&&(s=f),e.PTSKnown=e.alignedSliding=!0),h.hasStreams&&(f.elementaryStreams=h.elementaryStreams),f.loader=h.loader,h.hasStats&&(f.stats=h.stats),h.initSegment&&(f.initSegment=h.initSegment,n=h.initSegment)});const r=e.fragments,o=e.fragmentHint?r.concat(e.fragmentHint):r;if(n&&o.forEach(h=>{var f;h&&(!h.initSegment||h.initSegment.relurl===((f=n)==null?void 0:f.relurl))&&(h.initSegment=n)}),e.skippedSegments){if(e.deltaUpdateFailed=r.some(h=>!h),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let h=e.skippedSegments;h--;)r.shift();e.startSN=r[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=Hr(a.dateRanges,e,t));const h=a.fragments.filter(f=>f.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let f=1;f<o.length;f++)o[f].programDateTime===null&&Bs(o[f],o[f-1],h);Ns(h,e)}e.endCC=r[r.length-1].cc}if(!e.startCC){var c;const h=yr(a,e.startSN-1);e.startCC=(c=h==null?void 0:h.cc)!=null?c:r[0].cc}Zr(a.partList,e.partList,(h,f)=>{f.elementaryStreams=h.elementaryStreams,f.stats=h.stats}),s?Ss(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,t):Rs(a,e),r.length&&(e.totalduration=e.edge-r[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const u=e.advancedDateTime;if(e.advanced&&u){const h=e.edge;e.driftStart||(e.driftStartTime=u,e.driftStart=h),e.driftEndTime=u,e.driftEnd=h}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function Hr(a,e,t){const{dateRanges:n,recentlyRemovedDateranges:i}=e,s=p({},a);i&&i.forEach(c=>{delete s[c]});const o=Object.keys(s).length;return o?(Object.keys(n).forEach(c=>{const u=s[c],h=new qi(n[c].attr,u);h.isValid?(s[c]=h,u||(h.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Vt(n[c].attr)}"`)}),s):n}function Zr(a,e,t){if(a&&e){let n=0;for(let i=0,s=a.length;i<=s;i++){const r=a[i],o=e[i+n];r&&o&&r.index===o.index&&r.fragment.sn===o.fragment.sn?t(r,o):n--}}}function Yr(a,e,t){const n=e.skippedSegments,i=Math.max(a.startSN,e.startSN)-e.startSN,s=(a.fragmentHint?1:0)+(n?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,r=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let u=i;u<=s;u++){const h=c[r+u];let f=o[u];if(n&&!f&&h&&(f=e.fragments[u]=h),h&&f){t(h,f,u,o);const d=h.relurl,E=f.relurl;if(d&&qr(d,E)){e.playlistParsingError=Js(`media sequence mismatch ${f.sn}:`,a,e,h,f);return}else if(h.cc!==f.cc){e.playlistParsingError=Js(`discontinuity sequence mismatch (${h.cc}!=${f.cc})`,a,e,h,f);return}}}}function Js(a,e,t,n,i){return new Error(`${a} ${i.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function Rs(a,e,t=!0){const n=e.startSN+e.skippedSegments-a.startSN,i=a.fragments,s=n>=0;let r=0;if(s&&n<i.length)r=i[n].start;else if(s&&e.startSN===a.endSN+1)r=a.fragmentEnd;else if(s&&t)r=a.fragmentStart+n*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)r=a.fragmentStart;else return;er(e,r)}function er(a,e){if(e){const t=a.fragments;for(let n=a.skippedSegments;n<t.length;n++)t[n].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function vr(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const n=a.fragments;if(n.length&&t*4>e){const s=n[n.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function yr(a,e,t){if(!a)return null;let n=a.fragments[e-a.startSN];return n||(n=a.fragmentHint,n&&n.sn===e)?n:e<a.startSN&&t&&t.sn===e?t:null}function tr(a,e,t){return a?Er(a.partList,e,t):null}function Er(a,e,t){if(a)for(let n=a.length;n--;){const i=a[n];if(i.index===t&&i.fragment.sn===e)return i}return null}function br(a){a.forEach((e,t)=>{var n;(n=e.details)==null||n.fragments.forEach(i=>{i.level=t,i.initSegment&&(i.initSegment.level=t)})})}function qr(a,e){return a!==e&&e?xr(a)!==xr(e):!1}function xr(a){return a.replace(/\?[^?]*$/,"")}function Is(a,e){for(let n=0,i=a.length;n<i;n++){var t;if(((t=a[n])==null?void 0:t.cc)===e)return a[n]}return null}function Xn(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function Fn(a,e){const t=a.start+e;a.startPTS=t,a.setStart(t),a.endPTS=t+a.duration}function Gn(a,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)Fn(t[n],a);e.fragmentHint&&Fn(e.fragmentHint,a),e.alignedSliding=!0}function Ri(a,e){a&&(xi(e,a),e.alignedSliding||ys(e,a),!e.alignedSliding&&!e.skippedSegments&&Rs(a,e,!1))}function xi(a,e){if(!Xn(e,a))return;const t=Math.min(e.endCC,a.endCC),n=Is(e.fragments,t),i=Is(a.fragments,t);if(!n||!i)return;X.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=n.start-i.start;Gn(s,a)}function ys(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,n=e.fragments;if(!t.length||!n.length)return;let i,s;const r=Math.min(e.endCC,a.endCC);e.startCC<r&&a.startCC<r&&(i=Is(n,r),s=Is(t,r)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=Is(t,i.cc)||t[Math.floor(t.length/2)]);const o=i.programDateTime,c=s.programDateTime;if(!o||!c)return;const u=(c-o)/1e3-(s.start-i.start);Gn(u,a)}function pi(a,e,t){Si(a,e,t),a.addEventListener(e,t)}function Si(a,e,t){a.removeEventListener(e,t)}const Sr={toString:function(a){let e="";const t=a.length;for(let n=0;n<t;n++)e+=`[${a.start(n).toFixed(3)}-${a.end(n).toFixed(3)}]`;return e}},tt={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Es extends Oi{constructor(e,t,n,i,s){super(i,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=tt.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:r,fragCurrent:o,media:c,mediaBuffer:u,state:h}=this,f=c?c.currentTime:0,d=Zt.bufferInfo(u||c,f,r.maxBufferHole),E=!d.len;if(this.log(`Media seeking to ${N(f)?f.toFixed(3):f}, state: ${h}, ${E?"out of":"in"} buffer`),this.state===tt.ENDED)this.resetLoadingState();else if(o){const b=r.maxFragLookUpTolerance,R=o.start-b,T=o.start+o.duration+b;if(E||T<d.start||R>d.end){const V=f>T;(f<R||V)&&(V&&o.loader&&(this.log(`Cancelling fragment load for seek (sn: ${o.sn})`),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const b=this.lastCurrentTime;if(f>b&&(this.lastCurrentTime=f),!this.loadingParts){const R=Math.max(d.end,f),T=this.shouldLoadParts(this.getLevelDetails(),R);T&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${R.toFixed(2)}`),this.loadingParts=T)}}this.hls.hasEnoughToStart||(this.log(`Setting ${E?"startPosition":"nextLoadPosition"} to ${f} for seek without enough to start`),this.nextLoadPosition=f,E&&(this.startPosition=f)),E&&this.state===tt.IDLE&&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 vi(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new li(e.config)}registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===tt.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=tt.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const n=e.end||0,i=this.config.timelineOffset||0;if(n<=i)return!1;const s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=Zt.bufferedInfo(s,e.start,0));const r=e.nextStart;if(r&&r>i&&r<t.edge||this.media.currentTime<e.start)return!1;const c=t.partList;if(c!=null&&c.length){const h=c[c.length-1];return Zt.isBuffered(this.media,h.start+h.duration/2)}const u=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;pi(n,"seeking",this.onMediaSeeking),pi(n,"ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===tt.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(e,t){const n=!!t.transferMedia,i=this.media;if(i!==null){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Si(i,"seeking",this.onMediaSeeking),Si(i,"ended",this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=tt.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const i=s=>{const r=s.frag;if(this.fragContextChanged(r)){this.warn(`${r.type} sn: ${r.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(r,!1,s.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(r);return}r.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,n,i).then(s=>{if(!s)return;const r=this.state,o=s.frag;if(this.fragContextChanged(o)){(r===tt.FRAG_LOADING||!this.fragCurrent&&r===tt.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=tt.IDLE);return}"payload"in s&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(g.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===tt.STOPPED||this.state===tt.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===hn.APPENDING){const s=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,s),o=Math.max(e.duration,r?r.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===hn.PARTIAL&&n.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,n=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:n};this.hls.trigger(g.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{const i=n==null?void 0:n.frag;if(!i||this.fragContextChanged(i)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:i}=this,{frag:s,payload:r}=n,o=s.decryptdata;if(r&&r.byteLength>0&&o!=null&&o.key&&o.iv&&bi(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,ei(o.method)).catch(u=>{throw i.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:s}),u}).then(u=>{const h=self.performance.now();return i.trigger(g.FRAG_DECRYPTED,{frag:s,payload:u,stats:{tstart:c,tdecrypt:h}}),n.payload=u,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===tt.STOPPED||this.state===tt.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state!==tt.STOPPED&&(this.state=tt.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var n,i;const s=e.tracks;if(s&&!t.encrypted&&((n=s.audio)!=null&&n.encrypted||(i=s.video)!=null&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const r=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${r?"attached mediaKeys: "+r.mediaKeys:"detached"})`);return this.warn(o.message),!r||r.mediaKeys?!1:(this.hls.trigger(g.ERROR,{type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,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 n=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:${n?Sr.toString(Zt.getBuffered(n)):"(detached)"})`),fe(e)){var i;if(e.type!==ee.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=tt.IDLE;return}}const s=(i=this.levels)==null?void 0:i[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=tt.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:n,part:i,partsLoaded:s}=e,r=!s||s.length===0||s.some(c=>!c),o=new ii(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!r);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,i){var s;this.fragCurrent=e;const r=t.details;if(!this.levels||!r)throw new Error(`frag load aborted, missing level${r?"":" detail"}s`);let o=null;if(e.encrypted&&!((s=e.decryptdata)!=null&&s.key)){if(this.log(`Loading key for ${e.sn} of [${r.startSN}-${r.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=tt.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(g.KEY_LOADED,d),this.state===tt.KEY_LOADING&&(this.state=tt.IDLE),d}),this.hls.trigger(g.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,r.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(fe(e)&&(!c||e.sn!==c.sn)){const d=this.shouldLoadParts(t.details,e.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=d)}if(n=Math.max(e.start,n||0),this.loadingParts&&fe(e)){const d=r.partList;if(d&&i){n>r.fragmentEnd&&r.fragmentHint&&(e=r.fragmentHint);const E=this.getNextPart(d,e,n);if(E>-1){const b=d[E];e=this.fragCurrent=b.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${b.index} (${E}/${d.length-1}) of ${this.fragInfo(e,!1,b)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=b.start+b.duration,this.state=tt.FRAG_LOADING;let R;return o?R=o.then(T=>!T||this.fragContextChanged(T.frag)?null:this.doFragPartsLoad(e,b,t,i)).catch(T=>this.handleFragLoadError(T)):R=this.doFragPartsLoad(e,b,t,i).catch(T=>this.handleFragLoadError(T)),this.hls.trigger(g.FRAG_LOADING,{frag:e,part:b,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):R}else if(!e.url||this.loadedEndOfParts(d,n))return Promise.resolve(null)}}if(fe(e)&&this.loadingParts){var u;this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(u=r.partList)==null?void 0:u.filter(d=>d.loaded).map(d=>`[${d.start}-${d.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} ${"["+r.startSN+"-"+r.endSN+"]"}, target: ${parseFloat(n.toFixed(3))}`),N(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=tt.FRAG_LOADING;const h=this.config.progressive;let f;return h&&o?f=o.then(d=>!d||this.fragContextChanged(d.frag)?null:this.fragmentLoader.load(e,i)).catch(d=>this.handleFragLoadError(d)):f=Promise.all([this.fragmentLoader.load(e,h?i:void 0),o]).then(([d])=>(!h&&i&&i(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(g.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):f}doFragPartsLoad(e,t,n,i){return new Promise((s,r)=>{var o;const c=[],u=(o=n.details)==null?void 0:o.partList,h=f=>{this.fragmentLoader.loadPart(e,f,i).then(d=>{c[f.index]=d;const E=d.part;this.hls.trigger(g.FRAG_LOADED,d);const b=tr(n.details,e.sn,f.index+1)||Er(u,e.sn,f.index+1);if(b)h(b);else return s({frag:e,part:E,partsLoaded:c})}).catch(r)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===ne.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetFragmentLoading(t.frag)):this.hls.trigger(g.ERROR,t)}else this.hls.trigger(g.ERROR,{type:ne.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==tt.PARSING){!this.fragCurrent&&this.state!==tt.STOPPED&&this.state!==tt.ERROR&&(this.state=tt.IDLE);return}const{frag:n,part:i,level:s}=t,r=self.performance.now();n.stats.parsing.end=r,i&&(i.stats.parsing.end=r);const o=this.getLevelDetails(),u=o&&n.sn>o.endSN||this.shouldLoadParts(o,n.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(n,i,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var n;const s=e.partList[0];if(s.fragment.type===ee.SUBTITLE)return!1;const r=s.end+(((n=e.fragmentHint)==null?void 0:n.duration)||0);if(t>=r){var i;if((this.hls.hasEnoughToStart?((i=this.media)==null?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:i,sn:s,part:r}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const o=t[i],c=o.details,u=r>-1?tr(c,s,r):null,h=u?u.fragment:yr(c,s,n);return h?(n&&n!==h&&(h.stats=n.stats),{frag:h,part:u,level:o}):null}bufferFragmentData(e,t,n,i,s){if(this.state!==tt.PARSING)return;const{data1:r,data2:o}=e;let c=r;if(o&&(c=Ve(r,o)),!c.length)return;const u=this.initPTS[t.cc],h=u?-u.baseTime/u.timescale:void 0,f={type:e.type,frag:t,part:n,chunkMeta:i,offset:h,parent:t.type,data:c};if(this.hls.trigger(g.BUFFER_APPENDING,f),e.dropped&&e.independent&&!n){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Zt.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,i=Zt.bufferInfo(t,n,0),s=e.duration,r=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),o=Math.max(Math.min(e.start-r,i.end-r),n+r);e.start-o>r&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var n;const i=this.getLoadPosition();if(!N(i))return null;const r=this.lastCurrentTime>i||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,r)}getFwdBufferInfoAtPos(e,t,n,i){const s=Zt.bufferInfo(e,t,i);if(s.len===0&&s.nextStart!==void 0){const r=this.fragmentTracker.getBufferedFrag(t,n);if(r&&(s.nextStart<=r.end||r.gap)){const o=Math.max(Math.min(s.nextStart,r.end)-t,i);return Zt.bufferInfo(e,t,o)}}return s}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const n=this.config,i=Math.max(Math.min(e-t,n.maxBufferLength),t),s=Math.max(e-t*3,n.maxMaxBufferLength/2,i);return s>=i?(n.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=ee.MAIN){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,i=n.length;if(!i)return null;const{config:s}=this,r=n[0].start,o=s.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const f=s.initialLiveManifestSize;if(i<f)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${f})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<r){var u;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t);const d=this.hls.startPosition,E=this.hls.liveSyncPosition,b=c?(d!==-1&&d>=r?d:E)||c.start:e;this.log(`Setting startPosition to ${b} to match start frag at live edge. mainStart: ${d} liveSyncPosition: ${E} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=b}}else e<=r&&(c=n[0]);if(!c){const f=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,f,t)}let h=this.filterReplacedPrimary(c,t);if(!h&&c){const f=c.sn-t.startSN;h=this.filterReplacedPrimary(n[f+1]||null,t)}return this.mapToInitFragWhenRequired(h)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===hn.OK||n===hn.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,i,s){let r=null;if(e.gap&&(r=this.getNextFragment(this.nextLoadPosition,t),r&&!r.gap&&n.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i,0);if(o!==null&&n.len+o.len>=s){const c=r.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,r}get primaryPrefetch(){if($s(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if($s(this.config)&&e.type!==ee.SUBTITLE){const n=this.hls.interstitialsManager,i=n==null?void 0:n.bufferingItem;if(i){const r=i.event;if(r){if(r.appendInPlace||Math.abs(e.start-i.start)>1||i.start===0)return null}else if(e.end<=i.start&&(t==null?void 0:t.live)===!1||e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}const s=n==null?void 0:n.playerQueue;if(s)for(let r=s.length;r--;){const o=s[r].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,n){let i=-1,s=!1,r=!0;for(let o=0,c=e.length;o<c;o++){const u=e[o];if(r=r&&!u.independent,i>-1&&n<u.start)break;const h=u.loaded;h?i=-1:(s||(u.independent||r)&&u.fragment===t)&&(u.fragment!==t&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${u.start}`),i=o),s=h}return i}loadedEndOfParts(e,t){let n;for(let i=e.length;i--;){if(n=e[i],!n.loaded)return!1;if(t>n.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,n=this.fragPrevious;let i=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),i=sn(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const s=n.sn+1;if(s>=e.startSN&&s<=e.endSN){const r=t[s-e.startSN];n.cc===r.cc&&(i=r,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=An(e,n.cc,n.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,n){const{config:i}=this;let{fragPrevious:s}=this,{fragments:r,endSN:o}=n;const{fragmentHint:c}=n,{maxFragLookUpTolerance:u}=i,h=n.partList,f=!!(this.loadingParts&&h!=null&&h.length&&c);f&&!this.bitrateTest&&h[h.length-1].fragment.sn===c.sn&&(r=r.concat(c),o=c.sn);let d;if(e<t){var E;const R=e<this.lastCurrentTime||e>t-u||(E=this.media)!=null&&E.paused||!this.startFragRequested?0:u;d=on(s,r,e,R)}else d=r[r.length-1];if(d){const b=d.sn-n.startSN,R=this.fragmentTracker.getState(d);if((R===hn.OK||R===hn.PARTIAL&&d.gap)&&(s=d),s&&d.sn===s.sn&&(!f||h[0].fragment.sn>d.sn||!n.live)&&d.level===s.level){const V=r[b+1];d.sn<o&&this.fragmentTracker.getState(V)!==hn.OK?d=V:d=null}}return d}alignPlaylists(e,t,n){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,r=!t,o=e.alignedSliding&&N(s);if(r||!o&&!s){Ri(n,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${i}`),c}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;n<t&&(n=-1);const i=this.timelineOffset;if(n===-1){const s=this.startTimeOffset!==null,r=s?this.startTimeOffset:e.startTimeOffset;r!==null&&N(r)?(n=t+r,r<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${r} found in ${s?"multivariant":"media"} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+i}this.nextLoadPosition=n+i}getLoadPosition(){var e;const{media:t}=this;let n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&fe(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!==tt.FRAG_LOADING_WAITING_RETRY)&&(this.state=tt.IDLE)}onFragmentOrKeyLoadError(e,t){var n;if(t.chunkMeta&&!t.frag){const V=this.getCurrentContext(t.chunkMeta);V&&(t.frag=V.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var s;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(s=this.fragCurrent)==null?void 0:s.url}`);return}const r=t.details===$.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction;if(!o){this.state=tt.ERROR;return}const{action:c,flags:u,retryCount:h=0,retryConfig:f}=o,d=!!f,E=d&&c===En.RetryRequest,b=d&&!o.resolved&&u===bn.MoveAllAlternatesMatchingHost,R=(n=this.hls.latestLevelDetails)==null?void 0:n.live;if(!E&&b&&fe(i)&&!i.endList&&R)this.resetFragmentErrors(e),this.treatAsGap(i),o.resolved=!0;else if((E||b)&&h<f.maxNumRetry){var T;const V=Pn((T=t.response)==null?void 0:T.code),se=Rn(f,h);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+se,this.state=tt.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,V){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${h+1}/${f.maxNumRetry} in ${se}ms`)}else if(f)if(this.resetFragmentErrors(e),h<f.maxNumRetry)!r&&c!==En.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${h})`);return}else c===En.SendAlternateToPenaltyBox?this.state=tt.WAITING_LEVEL:this.state=tt.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,n=t===1/0;(!t||e>=t||n&&!Pn(0))&&(n&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=tt.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===tt.PARSING||this.state===tt.PARSED){const t=e.frag,n=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,n),s=i&&i.len>.5;s&&this.reduceMaxBufferLength(i.len,(t==null?void 0:t.duration)||10);const r=!s;return r&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===ee.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==tt.STOPPED&&(this.state=tt.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const i=Zt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===tt.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==tt.STOPPED&&(this.state=tt.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,n,i){const s=n.details;if(!s){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,u)=>{const h=e.elementaryStreams[u];if(h){const f=h.endPTS-h.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${f})`),c||!1;const d=i?0:Ss(s,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS,this);return this.hls.trigger(g.LEVEL_PTS_UPDATED,{details:s,level:n,drift:d,type:u,frag:e,start:h.startPTS,end:h.endPTS}),!0}return c},!1)){var o;if(n.fragmentError===0&&this.treatAsGap(e,n),((o=this.transmuxer)==null?void 0:o.error)===null){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=tt.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(g.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===ee.MAIN?"level":"track"}fragInfo(e,t=!0,n){var i,s;return`${this.playlistLabel()} ${e.level} (${n?"part":"frag"}:[${((i=t&&!n?e.startPTS:(n||e).start)!=null?i:NaN).toFixed(3)}-${((s=t&&!n?e.endPTS:(n||e).end)!=null?s:NaN).toFixed(3)}]${n&&e.type==="main"?"INDEPENDENT="+(n.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function $s(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Tr{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=ml(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function ml(a,e){const t=new Uint8Array(e);let n=0;for(let i=0;i<a.length;i++){const s=a[i];t.set(s,n),n+=s.length}return t}var Xr={exports:{}},Ua;function _l(){return Ua||(Ua=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(c,u,h){this.fn=c,this.context=u,this.once=h||!1}function s(c,u,h,f,d){if(typeof h!="function")throw new TypeError("The listener must be a function");var E=new i(h,f||c,d),b=t?t+u:u;return c._events[b]?c._events[b].fn?c._events[b]=[c._events[b],E]:c._events[b].push(E):(c._events[b]=E,c._eventsCount++),c}function r(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],h,f;if(this._eventsCount===0)return u;for(f in h=this._events)e.call(h,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},o.prototype.listeners=function(u){var h=t?t+u:u,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,E=f.length,b=new Array(E);d<E;d++)b[d]=f[d].fn;return b},o.prototype.listenerCount=function(u){var h=t?t+u:u,f=this._events[h];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,h,f,d,E,b){var R=t?t+u:u;if(!this._events[R])return!1;var T=this._events[R],V=arguments.length,se,te;if(T.fn){switch(T.once&&this.removeListener(u,T.fn,void 0,!0),V){case 1:return T.fn.call(T.context),!0;case 2:return T.fn.call(T.context,h),!0;case 3:return T.fn.call(T.context,h,f),!0;case 4:return T.fn.call(T.context,h,f,d),!0;case 5:return T.fn.call(T.context,h,f,d,E),!0;case 6:return T.fn.call(T.context,h,f,d,E,b),!0}for(te=1,se=new Array(V-1);te<V;te++)se[te-1]=arguments[te];T.fn.apply(T.context,se)}else{var Se=T.length,Fe;for(te=0;te<Se;te++)switch(T[te].once&&this.removeListener(u,T[te].fn,void 0,!0),V){case 1:T[te].fn.call(T[te].context);break;case 2:T[te].fn.call(T[te].context,h);break;case 3:T[te].fn.call(T[te].context,h,f);break;case 4:T[te].fn.call(T[te].context,h,f,d);break;default:if(!se)for(Fe=1,se=new Array(V-1);Fe<V;Fe++)se[Fe-1]=arguments[Fe];T[te].fn.apply(T[te].context,se)}}return!0},o.prototype.on=function(u,h,f){return s(this,u,h,f,!1)},o.prototype.once=function(u,h,f){return s(this,u,h,f,!0)},o.prototype.removeListener=function(u,h,f,d){var E=t?t+u:u;if(!this._events[E])return this;if(!h)return r(this,E),this;var b=this._events[E];if(b.fn)b.fn===h&&(!d||b.once)&&(!f||b.context===f)&&r(this,E);else{for(var R=0,T=[],V=b.length;R<V;R++)(b[R].fn!==h||d&&!b[R].once||f&&b[R].context!==f)&&T.push(b[R]);T.length?this._events[E]=T.length===1?T[0]:T:r(this,E)}return this},o.prototype.removeAllListeners=function(u){var h;return u?(h=t?t+u:u,this._events[h]&&r(this,h)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,a.exports=o}(Xr)),Xr.exports}var vl=_l(),Qr=w(vl);const nr="1.6.11",Ks={};function yl(){return typeof __HLS_WORKER_BUNDLE__=="function"}function El(){const a=Ks[nr];if(a)return a.clientCount++,a;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),i={worker:new self.Worker(t),objectURL:t,clientCount:1};return Ks[nr]=i,i}function bl(a){const e=Ks[a];if(e)return e.clientCount++,e;const t=new self.URL(a,self.location.href).href,i={worker:new self.Worker(t),scriptURL:t,clientCount:1};return Ks[a]=i,i}function xl(a){const e=Ks[a||nr];if(e&&e.clientCount--===1){const{worker:n,objectURL:i}=e;delete Ks[a||nr],i&&self.URL.revokeObjectURL(i),n.terminate()}}function $a(a,e){return e+10<=a.length&&a[e]===51&&a[e+1]===68&&a[e+2]===73&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function Jr(a,e){return e+10<=a.length&&a[e]===73&&a[e+1]===68&&a[e+2]===51&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function wr(a,e){let t=0;return t=(a[e]&127)<<21,t|=(a[e+1]&127)<<14,t|=(a[e+2]&127)<<7,t|=a[e+3]&127,t}function ir(a,e){const t=e;let n=0;for(;Jr(a,e);){n+=10;const i=wr(a,e+6);n+=i,$a(a,e+10)&&(n+=10),e+=n}if(n>0)return a.subarray(t,t+n)}function Sl(a,e,t,n){const i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],s=e[t+2],r=s>>2&15;if(r>12){const E=new Error(`invalid ADTS sampling index:${r}`);a.emit(g.ERROR,g.ERROR,{type:ne.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,error:E,reason:E.message});return}const o=(s>>6&3)+1,c=e[t+3]>>6&3|(s&1)<<2,u="mp4a.40."+o,h=i[r];let f=r;(o===5||o===29)&&(f-=3);const d=[o<<3|(f&14)>>1,(f&1)<<7|c<<3];return X.log(`manifest codec:${n}, parsed codec:${u}, channels:${c}, rate:${h} (ADTS object type:${o} sampling index:${r})`),{config:d,samplerate:h,channelCount:c,codec:u,parsedCodec:u,manifestCodec:n}}function Ka(a,e){return a[e]===255&&(a[e+1]&246)===240}function Ga(a,e){return a[e+1]&1?7:9}function ea(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function Tl(a,e){return e+5<a.length}function Ar(a,e){return e+1<a.length&&Ka(a,e)}function wl(a,e){return Tl(a,e)&&Ka(a,e)&&ea(a,e)<=a.length-e}function Al(a,e){if(Ar(a,e)){const t=Ga(a,e);if(e+t>=a.length)return!1;const n=ea(a,e);if(n<=t)return!1;const i=e+n;return i===a.length||Ar(a,i)}return!1}function za(a,e,t,n,i){if(!a.samplerate){const s=Sl(e,t,n,i);if(!s)return;p(a,s)}}function Va(a){return 1024*9e4/a}function Dl(a,e){const t=Ga(a,e);if(e+t<=a.length){const n=ea(a,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function Wa(a,e,t,n,i){const s=Va(a.samplerate),r=n+i*s,o=Dl(e,t);let c;if(o){const{frameLength:f,headerLength:d}=o,E=d+f,b=Math.max(0,t+E-e.length);b?(c=new Uint8Array(E-d),c.set(e.subarray(t+d,e.length),0)):c=e.subarray(t+d,t+E);const R={unit:c,pts:r};return b||a.samples.push(R),{sample:R,length:E,missing:b}}const u=e.length-t;return c=new Uint8Array(u),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:r},length:u,missing:-1}}function Rl(a,e){return Jr(a,e)&&wr(a,e+6)+10<=a.length-e}function Il(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function ta(a,e=0,t=1/0){return Ll(a,e,t,Uint8Array)}function Ll(a,e,t,n){const i=Cl(a);let s=1;"BYTES_PER_ELEMENT"in n&&(s=n.BYTES_PER_ELEMENT);const r=kl(a)?a.byteOffset:0,o=(r+a.byteLength)/s,c=(r+e)/s,u=Math.floor(Math.max(0,Math.min(c,o))),h=Math.floor(Math.min(u+Math.max(t,0),o));return new n(i,u,h-u)}function Cl(a){return a instanceof ArrayBuffer?a:a.buffer}function kl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function Pl(a){const e={key:a.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(a.size<2)return;if(a.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const n=a.data.subarray(1).indexOf(0);if(n===-1)return;const i=ze(ta(a.data,1,n)),s=a.data[2+n],r=a.data.subarray(3+n).indexOf(0);if(r===-1)return;const o=ze(ta(a.data,3+n,r));let c;return i==="-->"?c=ze(ta(a.data,4+n+r)):c=Il(a.data.subarray(4+n+r)),e.mimeType=i,e.pictureType=s,e.description=o,e.data=c,e}function Ol(a){if(a.size<2)return;const e=ze(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function Fl(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const n=ze(a.data.subarray(t),!0);t+=n.length+1;const i=ze(a.data.subarray(t));return{key:a.type,info:n,data:i}}const e=ze(a.data.subarray(1));return{key:a.type,info:"",data:e}}function Ml(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const n=ze(a.data.subarray(t),!0);t+=n.length+1;const i=ze(a.data.subarray(t));return{key:a.type,info:n,data:i}}const e=ze(a.data);return{key:a.type,info:"",data:e}}function Nl(a){return a.type==="PRIV"?Ol(a):a.type[0]==="W"?Ml(a):a.type==="APIC"?Pl(a):Fl(a)}function Bl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=wr(a,4),n=10;return{type:e,size:t,data:a.subarray(n,n+t)}}const Dr=10,Ul=10;function ja(a){let e=0;const t=[];for(;Jr(a,e);){const n=wr(a,e+6);a[e+5]>>6&1&&(e+=Dr),e+=Dr;const i=e+n;for(;e+Ul<i;){const s=Bl(a.subarray(e)),r=Nl(s);r&&t.push(r),e+=s.size+Dr}$a(a,e)&&(e+=Dr)}return t}function Ha(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function $l(a){if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}}function na(a){const e=ja(a);for(let t=0;t<e.length;t++){const n=e[t];if(Ha(n))return $l(n)}}let Ui=function(a){return a.audioId3="org.id3",a.dateRange="com.apple.quicktime.HLS",a.emsg="https://aomedia.org/emsg/ID3",a.misbklv="urn:misb:KLV:bin:1910.1",a}({});function ls(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ia{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,n,i){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,n){}demux(e,t){this.cachedData&&(e=Ve(this.cachedData,e),this.cachedData=null);let n=ir(e,0),i=n?n.length:0,s;const r=this._audioTrack,o=this._id3Track,c=n?na(n):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&N(c))&&(this.basePTS=Kl(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:Ui.audioId3,duration:Number.POSITIVE_INFINITY});i<u;){if(this.canParse(e,i)){const h=this.appendFrame(r,e,i);h?(this.frameIndex++,this.lastPTS=h.sample.pts,i+=h.length,s=i):i=u}else Rl(e,i)?(n=ir(e,i),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:Ui.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===u&&s!==u){const h=e.slice(s);this.cachedData?this.cachedData=Ve(this.cachedData,h):this.cachedData=h}}return{audioTrack:r,videoTrack:ls(),id3Track:o,textTrack:ls()}}demuxSampleAes(e,t,n){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:ls(),id3Track:this._id3Track,textTrack:ls()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Kl=(a,e,t)=>{if(N(a))return a*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};let Rr=null;const Gl=[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],zl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Vl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Wl=[0,1,1,4];function Za(a,e,t,n,i){if(t+24>e.length)return;const s=Ya(e,t);if(s&&t+s.frameLength<=e.length){const r=s.samplesPerFrame*9e4/s.sampleRate,o=n+i*r,c={unit:e.subarray(t,t+s.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=s.channelCount,a.samplerate=s.sampleRate,a.samples.push(c),{sample:c,length:s.frameLength,missing:0}}}function Ya(a,e){const t=a[e+1]>>3&3,n=a[e+1]>>1&3,i=a[e+2]>>4&15,s=a[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&s!==3){const r=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-n:n===3?3:4,u=Gl[c*14+i-1]*1e3,f=zl[(t===3?0:t===2?1:2)*3+s],d=o===3?1:2,E=Vl[t][n],b=Wl[n],R=E*8*b,T=Math.floor(E*u/f+r)*b;if(Rr===null){const te=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Rr=te?parseInt(te[1]):0}return!!Rr&&Rr<=87&&n===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:d,frameLength:T,samplesPerFrame:R}}}function sa(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function qa(a,e){return e+1<a.length&&sa(a,e)}function jl(a,e){return sa(a,e)&&4<=a.length-e}function Xa(a,e){if(e+1<a.length&&sa(a,e)){const n=Ya(a,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===a.length||qa(a,s)}return!1}class Hl extends ia{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const n=ir(e,0);let i=(n==null?void 0:n.length)||0;if(Xa(e,i))return!1;for(let s=e.length;i<s;i++)if(Al(e,i))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return wl(e,t)}appendFrame(e,t,n){za(e,this.observer,t,n,e.manifestCodec);const i=Wa(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const Qa=(a,e)=>{let t=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),r=new Uint8Array(1);for(;n>0;){r[0]=a[e];const o=Math.min(n,8),c=8-o;s[0]=4278190080>>>24+c<<c,i[0]=(r[0]&s[0])>>c,t=t?t<<o|i[0]:i[0],e+=1,n-=o}return t};class Zl extends ia{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const i=Ja(e,t,n,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=ir(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&na(t)!==void 0&&Qa(e,n)<16}}function Ja(a,e,t,n,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const o=[48e3,44100,32e3][s],c=e[t+4]&63,h=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+s]*2;if(t+h>e.length)return-1;const f=e[t+6]>>5;let d=0;f===2?d+=2:(f&1&&f!==1&&(d+=2),f&4&&(d+=2));const E=(e[t+6]<<8|e[t+7])>>12-d&1,R=[2,1,2,3,3,4,4,5][f]+E,T=e[t+5]>>3,V=e[t+5]&7,se=new Uint8Array([s<<6|T<<1|V>>2,(V&3)<<6|f<<3|E<<2|c>>4,c<<4&224]),te=1536/o*9e4,Se=n+i*te,Fe=e.subarray(t,t+h);return a.config=se,a.channelCount=R,a.samplerate=o,a.samples.push({unit:Fe,pts:Se}),h}class Yl extends ia{resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=ir(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&na(t)!==void 0&&Qa(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(Xa(e,n))return X.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return jl(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return Za(e,t,n,this.basePTS,this.frameIndex)}}const ql=/\/emsg[-/]ID3/i;class Xl{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,n,i){const s=this.videoTrack=ls("video",1),r=this.audioTrack=ls("audio",1),o=this.txtTrack=ls("text",1);if(this.id3Track=ls("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=ke(e);if(c.video){const{id:u,timescale:h,codec:f,supplemental:d}=c.video;s.id=u,s.timescale=o.timescale=h,s.codec=f,s.supplemental=d}if(c.audio){const{id:u,timescale:h,codec:f}=c.audio;r.id=u,r.timescale=h,r.codec=f}o.id=dt.text,s.sampleDuration=0,s.duration=r.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return le(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=Ve(this.remainderData,e));const o=et(n);this.remainderData=o.remainder,i.samples=o.valid||new Uint8Array}else i.samples=n;const r=this.extractID3Track(i,t);return s.samples=He(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:r,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return n.samples=He(e,t),{videoTrack:t,audioTrack:ls(),id3Track:i,textTrack:ls()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=Y(e.samples,["emsg"]);i&&i.forEach(s=>{const r=Xe(s);if(ql.test(r.schemeIdUri)){const o=eo(r,t);let c=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=r.payload;n.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Ui.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=eo(r,t);n.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Ui.misbklv,duration:Number.POSITIVE_INFINITY})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function eo(a,e){return N(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Ql{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new li(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,xn.cbc)}decryptAacSample(e,t,n){const i=e[t].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),r=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(r).then(o=>{const c=new Uint8Array(o);i.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)}).catch(n)}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)n.set(e.subarray(s,s+16),i);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)e.set(n.subarray(i,i+16),s);return e}decryptAvcSample(e,t,n,i,s){const r=ct(s.data),o=this.getAvcEncryptedData(r);this.decryptBuffer(o.buffer).then(c=>{s.data=this.getAvcDecryptedUnit(r,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,i)}).catch(i)}decryptAvcSamples(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){i();return}const s=e[t].units;for(;!(n>=s.length);n++){const r=s[n];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,n,i,r),!this.decrypter.isSync()))return}}}}class to{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,i;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const s=n.units;i=s[s.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,i=n.length;if(i){const s=n[i-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,n){const i=t.byteLength;let s=e.naluState||0;const r=s,o=[];let c=0,u,h,f,d=-1,E=0;for(s===-1&&(d=0,E=this.getNALuType(t,0),s=0,c=1);c<i;){if(u=t[c++],!s){s=u?0:1;continue}if(s===1){s=u?0:2;continue}if(!u)s=3;else if(u===1){if(h=c-s-1,d>=0){const b={data:t.subarray(d,h),type:E};o.push(b)}else{const b=this.getLastNalUnit(e.samples);b&&(r&&c<=4-r&&b.state&&(b.data=b.data.subarray(0,b.data.byteLength-r)),h>0&&(b.data=Ve(b.data,t.subarray(0,h)),b.state=0))}c<i?(f=this.getNALuType(t,c),d=c,E=f,s=0):s=-1}else s=0}if(d>=0&&s>=0){const b={data:t.subarray(d,i),type:E,state:s};o.push(b)}if(o.length===0){const b=this.getLastNalUnit(e.samples);b&&(b.data=Ve(b.data,t))}return e.naluState=s,o}}class sr{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,n=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");i.set(e.subarray(n,n+s)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const n=this.word>>>32-t;if(e>32&&X.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?n<<t|this.readBits(t):n}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Jl extends to{parsePES(e,t,n,i){const s=this.parseNALu(e,n.data,i);let r=this.VideoSample,o,c=!1;n.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),s.forEach(u=>{var h,f;switch(u.type){case 1:{let R=!1;o=!0;const T=u.data;if(c&&T.length>4){const V=this.readSliceType(T);(V===2||V===4||V===7||V===9)&&(R=!0)}if(R){var d;(d=r)!=null&&d.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),r.frame=!0,r.key=R;break}case 5:o=!0,(h=r)!=null&&h.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),r.key=!0,r.frame=!0;break;case 6:{o=!0,xe(u.data,1,n.pts,t.samples);break}case 7:{var E,b;o=!0,c=!0;const R=u.data,T=this.readSPS(R);if(!e.sps||e.width!==T.width||e.height!==T.height||((E=e.pixelRatio)==null?void 0:E[0])!==T.pixelRatio[0]||((b=e.pixelRatio)==null?void 0:b[1])!==T.pixelRatio[1]){e.width=T.width,e.height=T.height,e.pixelRatio=T.pixelRatio,e.sps=[R];const V=R.subarray(1,4);let se="avc1.";for(let te=0;te<3;te++){let Se=V[te].toString(16);Se.length<2&&(Se="0"+Se),se+=Se}e.codec=se}break}case 8:o=!0,e.pps=[u.data];break;case 9:o=!0,e.audFound=!0,(f=r)!=null&&f.frame&&(this.pushAccessUnit(r,e),r=null),r||(r=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;case 12:o=!0;break;default:o=!1;break}r&&o&&r.units.push(u)}),i&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new sr(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n=8,i=8,s;for(let r=0;r<e;r++)i!==0&&(s=t.readEG(),i=(n+s+256)%256),n=i===0?n:i}readSPS(e){const t=new sr(e);let n=0,i=0,s=0,r=0,o,c,u;const h=t.readUByte.bind(t),f=t.readBits.bind(t),d=t.readUEG.bind(t),E=t.readBoolean.bind(t),b=t.skipBits.bind(t),R=t.skipEG.bind(t),T=t.skipUEG.bind(t),V=this.skipScalingList.bind(this);h();const se=h();if(f(5),b(3),h(),T(),se===100||se===110||se===122||se===244||se===44||se===83||se===86||se===118||se===128){const Ue=d();if(Ue===3&&b(1),T(),T(),b(1),E())for(c=Ue!==3?8:12,u=0;u<c;u++)E()&&(u<6?V(16,t):V(64,t))}T();const te=d();if(te===0)d();else if(te===1)for(b(1),R(),R(),o=d(),u=0;u<o;u++)R();T(),b(1);const Se=d(),Fe=d(),Ye=f(1);Ye===0&&b(1),b(1),E()&&(n=d(),i=d(),s=d(),r=d());let Re=[1,1];if(E()&&E())switch(h()){case 1:Re=[1,1];break;case 2:Re=[12,11];break;case 3:Re=[10,11];break;case 4:Re=[16,11];break;case 5:Re=[40,33];break;case 6:Re=[24,11];break;case 7:Re=[20,11];break;case 8:Re=[32,11];break;case 9:Re=[80,33];break;case 10:Re=[18,11];break;case 11:Re=[15,11];break;case 12:Re=[64,33];break;case 13:Re=[160,99];break;case 14:Re=[4,3];break;case 15:Re=[3,2];break;case 16:Re=[2,1];break;case 255:{Re=[h()<<8|h(),h()<<8|h()];break}}return{width:Math.ceil((Se+1)*16-n*2-i*2),height:(2-Ye)*(Fe+1)*16-(Ye?2:4)*(s+r),pixelRatio:Re}}}class eu extends to{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,i){const s=this.parseNALu(e,n.data,i);let r=this.VideoSample,o,c=!1;n.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),s.forEach(u=>{var h,f;switch(u.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:r||(r=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),r.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var d;(d=r)!=null&&d.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),r.key=!0,r.frame=!0;break;case 19:case 20:o=!0,(h=r)!=null&&h.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),r.key=!0,r.frame=!0;break;case 39:o=!0,xe(u.data,2,n.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=p(e.params,this.readVPS(u.data)),this.initVPS=u.data),e.vps=[u.data];break;case 33:if(o=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],u.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const E=this.readSPS(u.data);e.width=E.width,e.height=E.height,e.pixelRatio=E.pixelRatio,e.codec=E.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const b in E.params)e.params[b]=E.params[b]}this.pushParameterSet(e.sps,u.data,e.vps),r||(r=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),r.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const E=this.readPPS(u.data);for(const b in E)e.params[b]=E[b]}this.pushParameterSet(e.pps,u.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(f=r)!=null&&f.frame&&(this.pushAccessUnit(r,e),r=null),r||(r=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;default:o=!1;break}r&&o&&r.units.push(u)}),i&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let n=0;for(let i=0;i<e.byteLength;i++)i>=2&&e[i]===3&&e[i-1]===0&&e[i-2]===0||(t[n]=e[i],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new sr(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const n=t.readBits(3),i=t.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:i}}readSPS(e){const t=new sr(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const n=t.readBits(3);t.readBoolean();const i=t.readBits(2),s=t.readBoolean(),r=t.readBits(5),o=t.readUByte(),c=t.readUByte(),u=t.readUByte(),h=t.readUByte(),f=t.readUByte(),d=t.readUByte(),E=t.readUByte(),b=t.readUByte(),R=t.readUByte(),T=t.readUByte(),V=t.readUByte(),se=[],te=[];for(let kn=0;kn<n;kn++)se.push(t.readBoolean()),te.push(t.readBoolean());if(n>0)for(let kn=n;kn<8;kn++)t.readBits(2);for(let kn=0;kn<n;kn++)se[kn]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),te[kn]&&t.readUByte();t.readUEG();const Se=t.readUEG();Se==3&&t.skipBits(1);const Fe=t.readUEG(),Ye=t.readUEG(),Re=t.readBoolean();let Ue=0,Ge=0,Ie=0,it=0;Re&&(Ue+=t.readUEG(),Ge+=t.readUEG(),Ie+=t.readUEG(),it+=t.readUEG());const It=t.readUEG(),Mt=t.readUEG(),Gt=t.readUEG(),Nt=t.readBoolean();for(let kn=Nt?0:n;kn<=n;kn++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let wi=0;wi<4;wi++)for(let Zi=0;Zi<(wi===3?2:6);Zi++)if(!t.readBoolean())t.readUEG();else{const ss=Math.min(64,1<<4+(wi<<1));wi>1&&t.readEG();for(let Zs=0;Zs<ss;Zs++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const Lt=t.readUEG();let Kt=0;for(let kn=0;kn<Lt;kn++){let wi=!1;if(kn!==0&&(wi=t.readBoolean()),wi){kn===Lt&&t.readUEG(),t.readBoolean(),t.readUEG();let Zi=0;for(let Ps=0;Ps<=Kt;Ps++){const ss=t.readBoolean();let Zs=!1;ss||(Zs=t.readBoolean()),(ss||Zs)&&Zi++}Kt=Zi}else{const Zi=t.readUEG(),Ps=t.readUEG();Kt=Zi+Ps;for(let ss=0;ss<Zi;ss++)t.readUEG(),t.readBoolean();for(let ss=0;ss<Ps;ss++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const kn=t.readUEG();for(let wi=0;wi<kn;wi++){for(let Zi=0;Zi<Gt+4;Zi++)t.readBits(1);t.readBits(1)}}let Dt=0,Rt=1,dn=1,Nn=!0,gn=1,Dn=0;t.readBoolean(),t.readBoolean();let Ti=!1;if(t.readBoolean()){if(t.readBoolean()){const Os=t.readUByte(),ll=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Vr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Os>0&&Os<16?(Rt=ll[Os-1],dn=Vr[Os-1]):Os===255&&(Rt=t.readBits(16),dn=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),Ti=t.readBoolean(),Ti&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(gn=t.readBits(32),Dn=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Vr=t.readBoolean(),ul=t.readBoolean();let ur=!1;(Vr||ul)&&(ur=t.readBoolean(),ur&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),ur&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let cl=0;cl<=n;cl++){Nn=t.readBoolean();const Ph=Nn||t.readBoolean();let hl=!1;Ph?t.readEG():hl=t.readBoolean();const fl=hl?1:t.readUEG()+1;if(Vr)for(let cr=0;cr<fl;cr++)t.readUEG(),t.readUEG(),ur&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(ul)for(let cr=0;cr<fl;cr++)t.readUEG(),t.readUEG(),ur&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Dt=t.readUEG())}let Hi=Fe,fs=Ye;if(Re){let kn=1,wi=1;Se===1?kn=wi=2:Se==2&&(kn=2),Hi=Fe-kn*Ge-kn*Ue,fs=Ye-wi*it-wi*Ie}const ks=i?["A","B","C"][i]:"",kh=o<<24|c<<16|u<<8|h;let Na=0;for(let kn=0;kn<32;kn++)Na=(Na|(kh>>kn&1)<<31-kn)>>>0;let Ba=Na.toString(16);return r===1&&Ba==="2"&&(Ba="6"),{codecString:`hvc1.${ks}${r}.${Ba}.${s?"H":"L"}${V}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:i,general_profile_compatibility_flags:[o,c,u,h],general_constraint_indicator_flags:[f,d,E,b,R,T],general_level_idc:V,bit_depth:It+8,bit_depth_luma_minus8:It,bit_depth_chroma_minus8:Mt,min_spatial_segmentation_idc:Dt,chroma_format_idc:Se,frame_rate:{fixed:Nn,fps:Dn/gn}},width:Hi,height:fs,pixelRatio:[Rt,dn]}}readPPS(e){const t=new sr(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(),s=t.readBoolean();let r=1;return s&&i?r=0:s?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 mi=188;class Ts{constructor(e,t,n,i){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=n,this.logger=i,this.videoParser=null}static probe(e,t){const n=Ts.syncOffset(e);return n>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),n!==-1}static syncOffset(e){const t=e.length;let n=Math.min(mi*5,t-mi)+1,i=0;for(;i<n;){let s=!1,r=-1,o=0;for(let c=i;c<t;c+=mi)if(e[c]===71&&(t-c===mi||e[c+mi]===71)){if(o++,r===-1&&(r=c,r!==0&&(n=Math.min(r+mi*99,e.length-mi)+1)),s||(s=ra(e,c)===0),s&&o>1&&(r===0&&o>2||c+mi>n))return r}else{if(o)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:dt[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Ts.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=Ts.createTrack("audio",i),this._id3Track=Ts.createTrack("id3"),this._txtTrack=Ts.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,i=!1){n||(this.sampleAes=null);let s;const r=this._videoTrack,o=this._audioTrack,c=this._id3Track,u=this._txtTrack;let h=r.pid,f=r.pesData,d=o.pid,E=c.pid,b=o.pesData,R=c.pesData,T=null,V=this.pmtParsed,se=this._pmtId,te=e.length;if(this.remainderData&&(e=Ve(this.remainderData,e),te=e.length,this.remainderData=null),te<mi&&!i)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const Se=Math.max(0,Ts.syncOffset(e));te-=(te-Se)%mi,te<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,te,e.buffer.byteLength-te));let Fe=0;for(let Re=Se;Re<te;Re+=mi)if(e[Re]===71){const Ue=!!(e[Re+1]&64),Ge=ra(e,Re),Ie=(e[Re+3]&48)>>4;let it;if(Ie>1){if(it=Re+5+e[Re+4],it===Re+mi)continue}else it=Re+4;switch(Ge){case h:Ue&&(f&&(s=Gs(f,this.logger))&&(this.readyVideoParser(r.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(r,u,s,!1)),f={data:[],size:0}),f&&(f.data.push(e.subarray(it,Re+mi)),f.size+=Re+mi-it);break;case d:if(Ue){if(b&&(s=Gs(b,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,s);break;case"mp3":this.parseMPEGPES(o,s);break;case"ac3":this.parseAC3PES(o,s);break}b={data:[],size:0}}b&&(b.data.push(e.subarray(it,Re+mi)),b.size+=Re+mi-it);break;case E:Ue&&(R&&(s=Gs(R,this.logger))&&this.parseID3PES(c,s),R={data:[],size:0}),R&&(R.data.push(e.subarray(it,Re+mi)),R.size+=Re+mi-it);break;case 0:Ue&&(it+=e[it]+1),se=this._pmtId=tu(e,it);break;case se:{Ue&&(it+=e[it]+1);const It=nu(e,it,this.typeSupported,n,this.observer,this.logger);h=It.videoPid,h>0&&(r.pid=h,r.segmentCodec=It.segmentVideoCodec),d=It.audioPid,d>0&&(o.pid=d,o.segmentCodec=It.segmentAudioCodec),E=It.id3Pid,E>0&&(c.pid=E),T!==null&&!V&&(this.logger.warn(`MPEG-TS PMT found at ${Re} after unknown PID '${T}'. Backtracking to sync byte @${Se} to parse all TS packets.`),T=null,Re=Se-188),V=this.pmtParsed=!0;break}case 17:case 8191:break;default:T=Ge;break}}else Fe++;Fe>0&&aa(this.observer,new Error(`Found ${Fe} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=b,c.pesData=R;const Ye={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return i&&this.extractRemainingSamples(Ye),Ye}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:n,id3Track:i,textTrack:s}=e,r=n.pesData,o=t.pesData,c=i.pesData;let u;if(r&&(u=Gs(r,this.logger))?(this.readyVideoParser(n.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(n,s,u,!0),n.pesData=null)):n.pesData=r,o&&(u=Gs(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,u);break;case"mp3":this.parseMPEGPES(t,u);break;case"ac3":this.parseAC3PES(t,u);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;c&&(u=Gs(c,this.logger))?(this.parseID3PES(i,u),i.pesData=null):i.pesData=c}demuxSampleAes(e,t,n){const i=this.demux(e,n,!0,!this.config.progressive),s=this.sampleAes=new Ql(this.observer,this.config,t);return this.decrypt(i,s)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Jl:e==="hevc"&&(this.videoParser=new eu))}decrypt(e,t){return new Promise(n=>{const{audioTrack:i,videoTrack:s}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{n(e)}):n(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{n(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 n=0;const i=this.aacOverFlow;let s=t.data;if(i){this.aacOverFlow=null;const f=i.missing,d=i.sample.unit.byteLength;if(f===-1)s=Ve(i.sample.unit,s);else{const E=d-f;i.sample.unit.set(s.subarray(0,f),E),e.samples.push(i.sample),n=i.missing}}let r,o;for(r=n,o=s.length;r<o-1&&!Ar(s,r);r++);if(r!==n){let f;const d=r<o-1;if(d?f=`AAC PES did not start with ADTS header,offset:${r}`:f="No ADTS header found in AAC PES",aa(this.observer,new Error(f),d,this.logger),!d)return}za(e,this.observer,s,r,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(i){const f=Va(e.samplerate);c=i.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,h;for(;r<o;)if(h=Wa(e,s,r,c,u),r+=h.length,h.missing){this.aacOverFlow=h;break}else for(u++;r<o-1&&!Ar(s,r);r++);}parseMPEGPES(e,t){const n=t.data,i=n.length;let s=0,r=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;r<i;)if(qa(n,r)){const c=Za(e,n,r,o,s);if(c)r+=c.length,s++;else break}else r++}parseAC3PES(e,t){{const n=t.data,i=t.pts;if(i===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=n.length;let r=0,o=0,c;for(;o<s&&(c=Ja(e,n,o,i,r++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=p({},t,{type:this._videoTrack?Ui.emsg:Ui.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function ra(a,e){return((a[e+1]&31)<<8)+a[e+2]}function tu(a,e){return(a[e+10]&31)<<8|a[e+11]}function nu(a,e,t,n,i,s){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(a[e+1]&15)<<8|a[e+2],c=e+3+o-4,u=(a[e+10]&15)<<8|a[e+11];for(e+=12+u;e<c;){const h=ra(a,e),f=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!n){oa("ADTS AAC",s);break}case 15:r.audioPid===-1&&(r.audioPid=h);break;case 21:r.id3Pid===-1&&(r.id3Pid=h);break;case 219:if(!n){oa("H.264",s);break}case 27:r.videoPid===-1&&(r.videoPid=h);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=h,r.segmentAudioCodec="mp3");break;case 193:if(!n){oa("AC-3",s);break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=h,r.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&f>0){let d=e+5,E=f;for(;E>2;){switch(a[d]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=h,r.segmentAudioCodec="ac3");break}const R=a[d+1]+2;d+=R,E-=R}}break;case 194:case 135:return aa(i,new Error("Unsupported EC-3 in M2TS found"),void 0,s),r;case 36:r.videoPid===-1&&(r.videoPid=h,r.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=f+5}return r}function aa(a,e,t,n){n.warn(`parsing error: ${e.message}`),a.emit(g.ERROR,g.ERROR,{type:ne.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function oa(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function Gs(a,e){let t=0,n,i,s,r,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=Ve(c[0],c[1]),c.splice(1,1);if(n=c[0],(n[0]<<16)+(n[1]<<8)+n[2]===1){if(i=(n[4]<<8)+n[5],i&&i>a.size-6)return null;const h=n[7];h&192&&(r=(n[9]&14)*536870912+(n[10]&255)*4194304+(n[11]&254)*16384+(n[12]&255)*128+(n[13]&254)/2,h&64?(o=(n[14]&14)*536870912+(n[15]&255)*4194304+(n[16]&254)*16384+(n[17]&255)*128+(n[18]&254)/2,r-o>60*9e4&&(e.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),s=n[8];let f=s+9;if(a.size<=f)return null;a.size-=f;const d=new Uint8Array(a.size);for(let E=0,b=c.length;E<b;E++){n=c[E];let R=n.byteLength;if(f)if(f>R){f-=R;continue}else n=n.subarray(f),R-=f,f=0;d.set(n,t),t+=R}return i&&(i-=s+3),{data:d,pts:r,dts:o,len:i}}return null}class iu{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const ws=Math.pow(2,32)-1;class Be{static init(){Be.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in Be.types)Be.types.hasOwnProperty(e)&&(Be.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]),n=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]);Be.HDLR_TYPES={video:t,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);Be.STTS=Be.STSC=Be.STCO=s,Be.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Be.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Be.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Be.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const r=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);Be.FTYP=Be.box(Be.types.ftyp,r,c,r,o),Be.DINF=Be.box(Be.types.dinf,Be.box(Be.types.dref,i))}static box(e,...t){let n=8,i=t.length;const s=i;for(;i--;)n+=t[i].byteLength;const r=new Uint8Array(n);for(r[0]=n>>24&255,r[1]=n>>16&255,r[2]=n>>8&255,r[3]=n&255,r.set(e,4),i=0,n=8;i<s;i++)r.set(t[i],n),n+=t[i].byteLength;return r}static hdlr(e){return Be.box(Be.types.hdlr,Be.HDLR_TYPES[e])}static mdat(e){return Be.box(Be.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(ws+1)),i=Math.floor(t%(ws+1));return Be.box(Be.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return Be.box(Be.types.mdia,Be.mdhd(e.timescale||0,e.duration||0),Be.hdlr(e.type),Be.minf(e))}static mfhd(e){return Be.box(Be.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?Be.box(Be.types.minf,Be.box(Be.types.smhd,Be.SMHD),Be.DINF,Be.stbl(e)):Be.box(Be.types.minf,Be.box(Be.types.vmhd,Be.VMHD),Be.DINF,Be.stbl(e))}static moof(e,t,n){return Be.box(Be.types.moof,Be.mfhd(e),Be.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=Be.trak(e[t]);return Be.box.apply(null,[Be.types.moov,Be.mvhd(e[0].timescale||0,e[0].duration||0)].concat(n).concat(Be.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=Be.trex(e[t]);return Be.box.apply(null,[Be.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(ws+1)),i=Math.floor(t%(ws+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Be.box(Be.types.mvhd,s)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let i,s;for(i=0;i<t.length;i++)s=t[i].flags,n[i+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return Be.box(Be.types.sdtp,n)}static stbl(e){return Be.box(Be.types.stbl,Be.stsd(e),Be.box(Be.types.stts,Be.STTS),Be.box(Be.types.stsc,Be.STSC),Be.box(Be.types.stsz,Be.STSZ),Be.box(Be.types.stco,Be.STCO))}static avc1(e){let t=[],n=[],i,s,r;for(i=0;i<e.sps.length;i++)s=e.sps[i],r=s.byteLength,t.push(r>>>8&255),t.push(r&255),t=t.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)s=e.pps[i],r=s.byteLength,n.push(r>>>8&255),n.push(r&255),n=n.concat(Array.prototype.slice.call(s));const o=Be.box(Be.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),c=e.width,u=e.height,h=e.pixelRatio[0],f=e.pixelRatio[1];return Be.box(Be.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,Be.box(Be.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Be.box(Be.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,f>>24,f>>16&255,f>>8&255,f&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return Be.box(Be.types.mp4a,Be.audioStsd(e),Be.box(Be.types.esds,Be.esds(e)))}static mp3(e){return Be.box(Be.types[".mp3"],Be.audioStsd(e))}static ac3(e){return Be.box(Be.types["ac-3"],Be.audioStsd(e),Be.box(Be.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Be.box(Be.types.stsd,Be.STSD,Be.mp4a(e));if(t==="ac3"&&e.config)return Be.box(Be.types.stsd,Be.STSD,Be.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Be.box(Be.types.stsd,Be.STSD,Be.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Be.box(Be.types.stsd,Be.STSD,Be.avc1(e));if(t==="hevc"&&e.vps)return Be.box(Be.types.stsd,Be.STSD,Be.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,n=(e.duration||0)*(e.timescale||0),i=e.width||0,s=e.height||0,r=Math.floor(n/(ws+1)),o=Math.floor(n%(ws+1));return Be.box(Be.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const n=Be.sdtp(e),i=e.id,s=Math.floor(t/(ws+1)),r=Math.floor(t%(ws+1));return Be.box(Be.types.traf,Be.box(Be.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),Be.box(Be.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255])),Be.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,Be.box(Be.types.trak,Be.tkhd(e),Be.mdia(e))}static trex(e){const t=e.id;return Be.box(Be.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const n=e.samples||[],i=n.length,s=12+16*i,r=new Uint8Array(s);let o,c,u,h,f,d;for(t+=8+s,r.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<i;o++)c=n[o],u=c.duration,h=c.size,f=c.flags,d=c.cts,r.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*o);return Be.box(Be.types.trun,r)}static initSegment(e){Be.types||Be.init();const t=Be.moov(e);return Ve(Be.FTYP,t)}static hvc1(e){const t=e.params,n=[e.vps,e.sps,e.pps],i=4,s=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),i-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),n.length]);let r=s.length;for(let b=0;b<n.length;b+=1){r+=3;for(let R=0;R<n[b].length;R+=1)r+=2+n[b][R].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=n.length-1;for(let b=0;b<n.length;b+=1){o.set(new Uint8Array([32+b|(b===c?128:0),0,n[b].length]),r),r+=3;for(let R=0;R<n[b].length;R+=1)o.set(new Uint8Array([n[b][R].length>>8,n[b][R].length&255]),r),r+=2,o.set(n[b][R],r),r+=n[b][R].length}const u=Be.box(Be.types.hvcC,o),h=e.width,f=e.height,d=e.pixelRatio[0],E=e.pixelRatio[1];return Be.box(Be.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,h>>8&255,h&255,f>>8&255,f&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,Be.box(Be.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Be.box(Be.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,E>>24,E>>16&255,E>>8&255,E&255])))}}Be.types=void 0,Be.HDLR_TYPES=void 0,Be.STTS=void 0,Be.STSC=void 0,Be.STCO=void 0,Be.STSZ=void 0,Be.VMHD=void 0,Be.SMHD=void 0,Be.STSD=void 0,Be.FTYP=void 0,Be.DINF=void 0;const no=9e4;function la(a,e,t=1,n=!1){const i=a*e*t;return n?Math.round(i):i}function su(a,e,t=1,n=!1){return la(a,e,1/t,n)}function rr(a,e=!1){return la(a,1e3,1/no,e)}function ru(a,e=1){return la(a,no,1/e)}const au=10*1e3,ou=1024,lu=1152,uu=1536;let zs=null,ua=null;function io(a,e,t,n){return{duration:e,size:t,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class Ir extends F{constructor(e,t,n,i){if(super("mp4-remuxer",i),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=n,this.ISGenerated=!1,zs===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);zs=r?parseInt(r[1]):0}if(ua===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);ua=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e[0].pts,i=e.reduce((s,r)=>{let o=r.pts,c=o-s;return c<-4294967296&&(t=!0,o=ji(o,n),c=o-s),c>0?s:o},n);return t&&this.debug("PTS rollover detected"),i}remux(e,t,n,i,s,r,o,c){let u,h,f,d,E,b,R=s,T=s;const V=e.pid>-1,se=t.pid>-1,te=t.samples.length,Se=e.samples.length>0,Fe=o&&te>0||te>1;if((!V||Se)&&(!se||Fe)||this.ISGenerated||o){if(this.ISGenerated){var Re,Ue,Ge,Ie;const Gt=this.videoTrackConfig;(Gt&&(t.width!==Gt.width||t.height!==Gt.height||((Re=t.pixelRatio)==null?void 0:Re[0])!==((Ue=Gt.pixelRatio)==null?void 0:Ue[0])||((Ge=t.pixelRatio)==null?void 0:Ge[1])!==((Ie=Gt.pixelRatio)==null?void 0:Ie[1]))||!Gt&&Fe||this.nextAudioTs===null&&Se)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const it=this.isVideoContiguous;let It=-1,Mt;if(Fe&&(It=cu(t.samples),!it&&this.config.forceKeyFrameOnDiscontinuity))if(b=!0,It>0){this.warn(`Dropped ${It} out of ${te} video samples due to a missing keyframe`);const Gt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(It),t.dropped+=It,T+=(t.samples[0].pts-Gt)/t.inputTimeScale,Mt=T}else It===-1&&(this.warn(`No keyframe found out of ${te} video samples`),b=!1);if(this.ISGenerated){if(Se&&Fe){const Gt=this.getVideoStartPts(t.samples),At=(ji(e.samples[0].pts,Gt)-Gt)/t.inputTimeScale;R+=Math.max(0,At),T+=Math.max(0,-At)}if(Se){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,r)),h=this.remuxAudio(e,R,this.isAudioContiguous,r,se||Fe||c===ee.AUDIO?T:void 0),Fe){const Gt=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),f=this.generateIS(e,t,s,r)),u=this.remuxVideo(t,T,it,Gt)}}else Fe&&(u=this.remuxVideo(t,T,it,0));u&&(u.firstKeyFrame=It,u.independent=It!==-1,u.firstKeyFramePTS=Mt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(E=so(n,s,this._initPTS,this._initDTS)),i.samples.length&&(d=ro(i,s,this._initPTS))),{audio:h,video:u,initSegment:f,independent:b,text:d,id3:E}}generateIS(e,t,n,i){const s=e.samples,r=t.samples,o=this.typeSupported,c={},u=this._initPTS;let h=!u||i,f="audio/mp4",d,E,b,R=-1;if(h&&(d=E=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(f="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):Be.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(R=e.id,b=e.inputTimeScale,!u||b!==u.timescale?d=E=s[0].pts-Math.round(b*n):h=!1)}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Be.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(R=t.id,b=t.inputTimeScale,!u||b!==u.timescale){const T=this.getVideoStartPts(r),V=Math.round(b*n);E=Math.min(E,ji(r[0].dts,T)-V),d=Math.min(d,T-V)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,h?(u&&this.warn(`Timestamps at playlist time: ${i?"":"~"}${n} ${d/b} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${d/b} (${d}/${b}) trackId: ${R}`),this._initPTS={baseTime:d,timescale:b,trackId:R},this._initDTS={baseTime:E,timescale:b,trackId:R}):d=b=void 0,{tracks:c,initPTS:d,timescale:b,trackId:R}}remuxVideo(e,t,n,i){const s=e.inputTimeScale,r=e.samples,o=[],c=r.length,u=this._initPTS,h=u.baseTime*s/u.timescale;let f=this.nextVideoTs,d=8,E=this.videoSampleDuration,b,R,T=Number.POSITIVE_INFINITY,V=Number.NEGATIVE_INFINITY,se=!1;if(!n||f===null){const Dt=h+t*s,Rt=r[0].pts-ji(r[0].dts,r[0].pts);zs&&f!==null&&Math.abs(Dt-Rt-(f+h))<15e3?n=!0:f=Dt-Rt-h}const te=f+h;for(let Dt=0;Dt<c;Dt++){const Rt=r[Dt];Rt.pts=ji(Rt.pts,te),Rt.dts=ji(Rt.dts,te),Rt.dts<r[Dt>0?Dt-1:Dt].dts&&(se=!0)}se&&r.sort(function(Dt,Rt){const dn=Dt.dts-Rt.dts,Nn=Dt.pts-Rt.pts;return dn||Nn}),b=r[0].dts,R=r[r.length-1].dts;const Se=R-b,Fe=Se?Math.round(Se/(c-1)):E||e.inputTimeScale/30;if(n){const Dt=b-te,Rt=Dt>Fe,dn=Dt<-1;if((Rt||dn)&&(Rt?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${rr(Dt,!0)} ms (${Dt}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${rr(-Dt,!0)} ms (${Dt}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!dn||te>=r[0].pts||zs)){b=te;const Nn=r[0].pts-Dt;if(Rt)r[0].dts=b,r[0].pts=Nn;else{let gn=!0;for(let Dn=0;Dn<r.length&&!(r[Dn].dts>Nn&&gn);Dn++){const Ti=r[Dn].pts;if(r[Dn].dts-=Dt,r[Dn].pts-=Dt,Dn<r.length-1){const yi=r[Dn+1].pts,Hi=r[Dn].pts,fs=yi<=Hi,ks=yi<=Ti;gn=fs==ks}}}this.log(`Video: Initial PTS/DTS adjusted: ${rr(Nn,!0)}/${rr(b,!0)}, delta: ${rr(Dt,!0)} ms`)}}b=Math.max(0,b);let Ye=0,Re=0,Ue=b;for(let Dt=0;Dt<c;Dt++){const Rt=r[Dt],dn=Rt.units,Nn=dn.length;let gn=0;for(let Dn=0;Dn<Nn;Dn++)gn+=dn[Dn].data.length;Re+=gn,Ye+=Nn,Rt.length=gn,Rt.dts<Ue?(Rt.dts=Ue,Ue+=Fe/4|0||1):Ue=Rt.dts,T=Math.min(Rt.pts,T),V=Math.max(Rt.pts,V)}R=r[c-1].dts;const Ge=Re+4*Ye+8;let Ie;try{Ie=new Uint8Array(Ge)}catch(Dt){this.observer.emit(g.ERROR,g.ERROR,{type:ne.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:Dt,bytes:Ge,reason:`fail allocating video mdat ${Ge}`});return}const it=new DataView(Ie.buffer);it.setUint32(0,Ge),Ie.set(Be.types.mdat,4);let It=!1,Mt=Number.POSITIVE_INFINITY,Gt=Number.POSITIVE_INFINITY,Nt=Number.NEGATIVE_INFINITY,At=Number.NEGATIVE_INFINITY;for(let Dt=0;Dt<c;Dt++){const Rt=r[Dt],dn=Rt.units;let Nn=0;for(let Ti=0,yi=dn.length;Ti<yi;Ti++){const Hi=dn[Ti],fs=Hi.data,ks=Hi.data.byteLength;it.setUint32(d,ks),d+=4,Ie.set(fs,d),d+=ks,Nn+=4+ks}let gn;if(Dt<c-1)E=r[Dt+1].dts-Rt.dts,gn=r[Dt+1].pts-Rt.pts;else{const Ti=this.config,yi=Dt>0?Rt.dts-r[Dt-1].dts:Fe;if(gn=Dt>0?Rt.pts-r[Dt-1].pts:Fe,Ti.stretchShortVideoTrack&&this.nextAudioTs!==null){const Hi=Math.floor(Ti.maxBufferHole*s),fs=(i?T+i*s:this.nextAudioTs+h)-Rt.pts;fs>Hi?(E=fs-yi,E<0?E=yi:It=!0,this.log(`It is approximately ${fs/90} ms to the next segment; using duration ${E/90} ms for the last video frame.`)):E=yi}else E=yi}const Dn=Math.round(Rt.pts-Rt.dts);Mt=Math.min(Mt,E),Nt=Math.max(Nt,E),Gt=Math.min(Gt,gn),At=Math.max(At,gn),o.push(io(Rt.key,E,Nn,Dn))}if(o.length){if(zs){if(zs<70){const Dt=o[0].flags;Dt.dependsOn=2,Dt.isNonSync=0}}else if(ua&&At-Gt<Nt-Mt&&Fe/Nt<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Dt=b;for(let Rt=0,dn=o.length;Rt<dn;Rt++){const Nn=Dt+o[Rt].duration,gn=Dt+o[Rt].cts;if(Rt<dn-1){const Dn=Nn+o[Rt+1].cts;o[Rt].duration=Dn-gn}else o[Rt].duration=Rt?o[Rt-1].duration:Fe;o[Rt].cts=0,Dt=Nn}}}E=It||!E?Fe:E;const $t=R+E;this.nextVideoTs=f=$t-h,this.videoSampleDuration=E,this.isVideoContiguous=!0;const tn={data1:Be.moof(e.sequenceNumber++,b,p(e,{samples:o})),data2:Ie,startPTS:(T-h)/s,endPTS:(V+E-h)/s,startDTS:(b-h)/s,endDTS:f/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,tn}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return lu;case"ac3":return uu;default:return ou}}remuxAudio(e,t,n,i,s){const r=e.inputTimeScale,o=e.samplerate?e.samplerate:r,c=r/o,u=this.getSamplesPerFrame(e),h=u*c,f=this._initPTS,d=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,E=[],b=s!==void 0;let R=e.samples,T=d?0:8,V=this.nextAudioTs||-1;const se=f.baseTime*r/f.timescale,te=se+t*r;if(this.isAudioContiguous=n=n||R.length&&V>0&&(i&&Math.abs(te-(V+se))<9e3||Math.abs(ji(R[0].pts,te)-(V+se))<20*h),R.forEach(function(At){At.pts=ji(At.pts,te)}),!n||V<0){if(R=R.filter(At=>At.pts>=0),!R.length)return;s===0?V=0:i&&!b?V=Math.max(0,te-se):V=R[0].pts-se}if(e.segmentCodec==="aac"){const At=this.config.maxAudioFramesDrift;for(let $t=0,Lt=V+se;$t<R.length;$t++){const Kt=R[$t],tn=Kt.pts,Dt=tn-Lt,Rt=Math.abs(1e3*Dt/r);if(Dt<=-At*h&&b)$t===0&&(this.warn(`Audio frame @ ${(tn/r).toFixed(3)}s overlaps marker by ${Math.round(1e3*Dt/r)} ms.`),this.nextAudioTs=V=tn-se,Lt=tn);else if(Dt>=At*h&&Rt<au&&b){let dn=Math.round(Dt/h);for(Lt=tn-dn*h;Lt<0&&dn&&h;)dn--,Lt+=h;$t===0&&(this.nextAudioTs=V=Lt-se),this.warn(`Injecting ${dn} audio frames @ ${((Lt-se)/r).toFixed(3)}s due to ${Math.round(1e3*Dt/r)} ms gap.`);for(let Nn=0;Nn<dn;Nn++){let gn=iu.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);gn||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),gn=Kt.unit.subarray()),R.splice($t,0,{unit:gn,pts:Lt}),Lt+=h,$t++}}Kt.pts=Lt,Lt+=h}}let Se=null,Fe=null,Ye,Re=0,Ue=R.length;for(;Ue--;)Re+=R[Ue].unit.byteLength;for(let At=0,$t=R.length;At<$t;At++){const Lt=R[At],Kt=Lt.unit;let tn=Lt.pts;if(Fe!==null){const Rt=E[At-1];Rt.duration=Math.round((tn-Fe)/c)}else if(n&&e.segmentCodec==="aac"&&(tn=V+se),Se=tn,Re>0){Re+=T;try{Ye=new Uint8Array(Re)}catch(Rt){this.observer.emit(g.ERROR,g.ERROR,{type:ne.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:Rt,bytes:Re,reason:`fail allocating audio mdat ${Re}`});return}d||(new DataView(Ye.buffer).setUint32(0,Re),Ye.set(Be.types.mdat,4))}else return;Ye.set(Kt,T);const Dt=Kt.byteLength;T+=Dt,E.push(io(!0,u,Dt,0)),Fe=tn}const Ge=E.length;if(!Ge)return;const Ie=E[E.length-1];V=Fe-se,this.nextAudioTs=V+c*Ie.duration;const it=d?new Uint8Array(0):Be.moof(e.sequenceNumber++,Se/c,p({},e,{samples:E}));e.samples=[];const It=(Se-se)/r,Mt=V/r,Nt={data1:it,data2:Ye,startPTS:It,endPTS:Mt,startDTS:It,endDTS:Mt,type:"audio",hasAudio:!0,hasVideo:!1,nb:Ge};return this.isAudioContiguous=!0,Nt}}function ji(a,e){let t;if(e===null)return a;for(e<a?t=-8589934592:t=8589934592;Math.abs(a-e)>4294967296;)a+=t;return a}function cu(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function so(a,e,t,n){const i=a.samples.length;if(!i)return;const s=a.inputTimeScale;for(let o=0;o<i;o++){const c=a.samples[o];c.pts=ji(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=ji(c.dts-n.baseTime*s/n.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function ro(a,e,t){const n=a.samples.length;if(!n)return;const i=a.inputTimeScale;for(let r=0;r<n;r++){const o=a.samples[r];o.pts=ji(o.pts-t.baseTime*i/t.timescale,e*i)/i}a.samples.sort((r,o)=>r.pts-o.pts);const s=a.samples;return a.samples=[],{samples:s}}class hu extends F{constructor(e,t,n,i){super("passthrough-remuxer",i),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,n,i){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(e,i),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:n,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:s,video:r}=this.initData=ke(e);if(t)$e(e,t);else{const c=s||r;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}s&&(n=ao(s,D.AUDIO,this)),r&&(i=ao(r,D.VIDEO,this));const o={};s&&r?o.audiovideo={container:"video/mp4",codec:n+","+i,supplemental:r.supplemental,encrypted:r.encrypted,initSegment:e,id:"main"}:s?o.audio={container:"audio/mp4",codec:n,encrypted:s.encrypted,initSegment:e,id:"audio"}:r?o.video={container:"video/mp4",codec:i,supplemental:r.supplemental,encrypted:r.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,n,i,s,r){var o,c;let{initPTS:u,lastEndTime:h}=this;const f={audio:void 0,video:void 0,text:i,id3:n,initSegment:void 0};N(h)||(h=this.lastEndTime=s||0);const d=t.samples;if(!d.length)return f;const E={initPTS:void 0,timescale:void 0,trackId:void 0};let b=this.initData;if((o=b)!=null&&o.length||(this.generateInitSegment(d),b=this.initData),!((c=b)!=null&&c.length))return this.warn("Failed to generate initSegment."),f;this.emitInitSegment&&(E.tracks=this.initTracks,this.emitInitSegment=!1);const R=Qe(d,b,this),T=b.audio?R[b.audio.id]:null,V=b.video?R[b.video.id]:null,se=Lr(V,1/0),te=Lr(T,1/0),Se=Lr(V,0,!0),Fe=Lr(T,0,!0);let Ye=s,Re=0;const Ue=T&&(!V||!u&&te<se||u&&u.trackId===b.audio.id),Ge=Ue?T:V;if(Ge){const Lt=Ge.timescale,Kt=Ge.start-s*Lt,tn=Ue?b.audio.id:b.video.id;Ye=Ge.start/Lt,Re=Ue?Fe-te:Se-se,(r||!u)&&(fu(u,Ye,s,Re)||Lt!==u.timescale)&&(u&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${Kt/Lt} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${Ye-s} (${Kt}/${Lt}) trackId: ${tn}`),u=null,E.initPTS=Kt,E.timescale=Lt,E.trackId=tn)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);u?(E.initPTS=u.baseTime,E.timescale=u.timescale,E.trackId=u.trackId):((!E.timescale||E.trackId===void 0||E.initPTS===void 0)&&(this.warn("Could not set initPTS"),E.initPTS=Ye,E.timescale=1,E.trackId=-1),this.initPTS=u={baseTime:E.initPTS,timescale:E.timescale,trackId:E.trackId});const Ie=Ye-u.baseTime/u.timescale,it=Ie+Re;Re>0?this.lastEndTime=it:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const It=!!b.audio,Mt=!!b.video;let Gt="";It&&(Gt+="audio"),Mt&&(Gt+="video");const Nt=(b.audio?b.audio.encrypted:!1)||(b.video?b.video.encrypted:!1),At={data1:d,startPTS:Ie,startDTS:Ie,endPTS:it,endDTS:it,type:Gt,hasAudio:It,hasVideo:Mt,nb:1,dropped:0,encrypted:Nt};f.audio=It&&!Mt?At:void 0,f.video=Mt?At:void 0;const $t=V==null?void 0:V.sampleCount;if($t){const Lt=V.keyFrameIndex,Kt=Lt!==-1;At.nb=$t,At.dropped=Lt===0||this.isVideoContiguous?0:Kt?Lt:$t,At.independent=Kt,At.firstKeyFrame=Lt,Kt&&V.keyFrameStart&&(At.firstKeyFramePTS=(V.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(f.independent=Kt),this.isVideoContiguous||(this.isVideoContiguous=Kt),At.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${Lt}/${$t} dropped: ${At.dropped} start: ${At.firstKeyFramePTS||"NA"}`)}return f.initSegment=E,f.id3=so(n,s,u,u),i.samples.length&&(f.text=ro(i,s,u)),f}}function Lr(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function fu(a,e,t,n){if(a===null)return!0;const i=Math.max(n,1),s=e-a.baseTime/a.timescale;return Math.abs(s-t)>i}function ao(a,e,t){const n=a.codec;return n&&n.length>4?n:e===D.AUDIO?n==="ec-3"||n==="ac-3"||n==="alac"?n:n==="fLaC"||n==="Opus"?Q(n,!1):(t.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"):(t.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1")}let bs;try{bs=self.performance.now.bind(self.performance)}catch(a){bs=Date.now}const Cr=[{demux:Xl,remux:hu},{demux:Ts,remux:Ir},{demux:Hl,remux:Ir},{demux:Yl,remux:Ir}];Cr.splice(2,0,{demux:Zl,remux:Ir});class oo{constructor(e,t,n,i,s,r){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=n,this.id=s,this.logger=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,i){const s=n.transmuxing;s.executeStart=bs();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;i&&(this.currentTransmuxState=i);const{contiguous:u,discontinuity:h,trackSwitch:f,accurateTimeOffset:d,timeOffset:E,initSegmentChange:b}=i||o,{audioCodec:R,videoCodec:T,defaultInitPts:V,duration:se,initSegmentData:te}=c,Se=du(r,t);if(Se&&bi(Se.method)){const Ue=this.getDecrypter(),Ge=ei(Se.method);if(Ue.isSync()){let Ie=Ue.softwareDecrypt(r,Se.key.buffer,Se.iv.buffer,Ge);if(n.part>-1){const It=Ue.flush();Ie=It&&It.buffer}if(!Ie)return s.executeEnd=bs(),ca(n);r=new Uint8Array(Ie)}else return this.asyncResult=!0,this.decryptionPromise=Ue.webCryptoDecrypt(r,Se.key.buffer,Se.iv.buffer,Ge).then(Ie=>{const it=this.push(Ie,null,n);return this.decryptionPromise=null,it}),this.decryptionPromise}const Fe=this.needsProbing(h,f);if(Fe){const Ue=this.configureTransmuxer(r);if(Ue)return this.logger.warn(`[transmuxer] ${Ue.message}`),this.observer.emit(g.ERROR,g.ERROR,{type:ne.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:Ue,reason:Ue.message}),s.executeEnd=bs(),ca(n)}(h||f||b||Fe)&&this.resetInitSegment(te,R,T,se,t),(h||b||Fe)&&this.resetInitialTimestamp(V),u||this.resetContiguity();const Ye=this.transmux(r,Se,E,d,n);this.asyncResult=ar(Ye);const Re=this.currentTransmuxState;return Re.contiguous=!0,Re.discontinuity=!1,Re.trackSwitch=!1,s.executeEnd=bs(),Ye}flush(e){const t=e.transmuxing;t.executeStart=bs();const{decrypter:n,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const r=[],{timeOffset:o}=i;if(n){const f=n.flush();f&&r.push(this.push(f.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=bs();const f=[ca(e)];return this.asyncResult?Promise.resolve(f):f}const h=c.flush(o);return ar(h)?(this.asyncResult=!0,h.then(f=>(this.flushRemux(r,f,e),r))):(this.flushRemux(r,h,e),this.asyncResult?Promise.resolve(r):r)}flushRemux(e,t,n){const{audioTrack:i,videoTrack:s,id3Track:r,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?" part: "+n.part:""} of ${this.id===ee.MAIN?"level":"track"} ${n.level}`);const h=this.remuxer.remux(i,s,r,o,u,c,!0,this.id);e.push({remuxResult:h,chunkMeta:n}),n.transmuxing.executeEnd=bs()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,i,s){const{demuxer:r,remuxer:o}=this;!r||!o||(r.resetInitSegment(e,t,n,i),o.resetInitSegment(e,t,n,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,i,s){let r;return t&&t.method==="SAMPLE-AES"?r=this.transmuxSampleAes(e,t,n,i,s):r=this.transmuxUnencrypted(e,n,i,s),r}transmuxUnencrypted(e,t,n,i){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,r,o,c,t,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,n,i,s){return this.demuxer.demuxSampleAes(e,t,n).then(r=>({remuxResult:this.remuxer.remux(r.audioTrack,r.videoTrack,r.id3Track,r.textTrack,n,i,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:i}=this;let s;for(let f=0,d=Cr.length;f<d;f++){var r;if((r=Cr[f].demux)!=null&&r.probe(e,this.logger)){s=Cr[f];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,c=this.remuxer,u=s.remux,h=s.demux;(!c||!(c instanceof u))&&(this.remuxer=new u(n,t,i,this.logger)),(!o||!(o instanceof h))&&(this.demuxer=new h(n,t,i,this.logger),this.probe=h.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new li(this.config)),e}}function du(a,e){let t=null;return a.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const ca=a=>({remuxResult:{},chunkMeta:a});function ar(a){return"then"in a&&a.then instanceof Function}class pu{constructor(e,t,n,i,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=n,this.duration=i,this.defaultInitPts=s||null}}class gu{constructor(e,t,n,i,s,r){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=n,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=r}}let lo=0;class uo{constructor(e,t,n,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=lo++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const u=c.data,h=this.hls;if(!(!h||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var f;const d=(f=this.workerContext)==null?void 0:f.objectURL;d&&self.URL.revokeObjectURL(d);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{h.logger[u.data.logType]&&h.logger[u.data.logType](u.data.message);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.part=this.part,u.data.id=this.id,h.trigger(u.event,u.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const u=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(g.ERROR,{type:ne.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const r=(c,u)=>{u=u||{},u.frag=this.frag||void 0,c===g.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(c,u)};this.observer=new Qr,this.observer.on(g.FRAG_DECRYPTED,r),this.observer.on(g.ERROR,r);const o=Tt(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||yl()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=bl(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=El());const{worker:h}=this.workerContext;h.addEventListener("message",this.onWorkerMessage),h.addEventListener("error",this.onWorkerError),h.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:Vt(s)})}catch(h){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.terminateWorker(),this.error=null,this.transmuxer=new oo(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new oo(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=lo++;const t=this.hls.config,n=Tt(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:n,id:this.id,config:Vt(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),xl(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,n,i,s,r,o,c,u,h){var f,d;u.transmuxing.start=self.performance.now();const{instanceNo:E,transmuxer:b}=this,R=r?r.start:s.start,T=s.decryptdata,V=this.frag,se=!(V&&s.cc===V.cc),te=!(V&&u.level===V.level),Se=V?u.sn-V.sn:-1,Fe=this.part?u.part-this.part.index:-1,Ye=Se===0&&u.id>1&&u.id===(V==null?void 0:V.stats.chunkCount),Re=!te&&(Se===1||Se===0&&(Fe===1||Ye&&Fe<=0)),Ue=self.performance.now();(te||Se||s.stats.parsing.start===0)&&(s.stats.parsing.start=Ue),r&&(Fe||!Re)&&(r.stats.parsing.start=Ue);const Ge=!(V&&((f=s.initSegment)==null?void 0:f.url)===((d=V.initSegment)==null?void 0:d.url)),Ie=new gu(se,Re,c,te,R,Ge);if(!Re||se||Ge){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===ee.MAIN?"level":"track"}: ${u.level} id: ${u.id}
discontinuity: ${se}
trackSwitch: ${te}
contiguous: ${Re}
accurateTimeOffset: ${c}
timeOffset: ${R}
initSegmentChange: ${Ge}`);const it=new pu(n,i,t,o,h);this.configureTransmuxer(it)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:E,cmd:"demux",data:e,decryptdata:T,chunkMeta:u,state:Ie},e instanceof ArrayBuffer?[e]:[]);else if(b){const it=b.push(e,T,u,Ie);ar(it)?it.then(It=>{this.handleTransmuxComplete(It)}).catch(It=>{this.transmuxerError(It,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(it)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(n){const i=n.flush(e);ar(i)?i.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(i,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const co=100;class mu extends Es{constructor(e,t,n){super(e,t,n,"audio-stream-controller",ee.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(g.BUFFER_RESET,this.onBufferReset,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(g.BUFFER_RESET,this.onBufferReset,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s,trackId:r}){if(n===ee.MAIN){const o=t.cc,c=this.fragCurrent;if(this.initPTS[o]={baseTime:i,timescale:s,trackId:r},this.log(`InitPTS for cc: ${o} found from main: ${i/s} (${i}/${s}) trackId: ${r}`),this.mainAnchor=t,this.state===tt.WAITING_INIT_PTS){const u=this.waitingData;(!u&&!this.loadingParts||u&&u.frag.cc!==o)&&this.syncWithAnchor(t,u==null?void 0:u.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==o?(c.abortRequests(),this.syncWithAnchor(t,c)):this.state===tt.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var n;const i=((n=this.mainFragLoading)==null?void 0:n.frag)||null;if(t&&(i==null?void 0:i.cc)===t.cc)return;const s=(i||e).cc,r=this.getLevelDetails(),o=this.getLoadPosition(),c=An(r,s,o);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===tt.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=tt.STOPPED;return}const n=this.lastCurrentTime;this.stopLoad(),this.setInterval(co),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=tt.IDLE):this.state=tt.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case tt.IDLE:this.doTickIdle();break;case tt.WAITING_TRACK:{const{levels:e,trackId:t}=this,n=e==null?void 0:e[t],i=n==null?void 0:n.details;if(i&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(i))break;this.state=tt.WAITING_INIT_PTS}break}case tt.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case tt.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:n,cache:i,complete:s}=e,r=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=tt.FRAG_LOADING;const o=i.flush().buffer,c={frag:t,part:n,payload:o,networkDetails:null};this._handleFragmentLoadProgress(c),s&&super._handleFragmentLoadComplete(c)}else r&&r.cc!==e.frag.cc&&this.syncWithAnchor(r,e.frag)}else this.state=tt.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:n,media:i,trackId:s}=this,r=t.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!r.startFragPrefetch)||!(n!=null&&n[s]))return;const o=n[s],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=tt.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,D.AUDIO,ee.AUDIO));const h=this.getFwdBufferInfo(u,ee.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,c)){t.trigger(g.BUFFER_EOS,{type:"audio"}),this.state=tt.ENDED;return}const f=h.len,d=t.maxBufferLength,E=c.fragments,b=E[0].start,R=this.getLoadPosition(),T=this.flushing?R:h.end;if(this.switchingTrack&&i){const te=R;c.PTSKnown&&te<b&&(h.end>b||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=b+.05)}if(f>=d&&!this.switchingTrack&&T<E[E.length-1].start)return;let V=this.getNextFragment(T,c);if(V&&this.isLoopLoading(V,T)&&(V=this.getNextFragmentLoopLoading(V,c,h,ee.MAIN,d)),!V){this.bufferFlushed=!0;return}let se=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&se&&fe(V)&&!V.endList&&(!c.live||!this.loadingParts&&T<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(se)===hn.OK&&(this.mainFragLoading=se=null),se&&fe(se))){if(V.start>se.end){const Se=this.fragmentTracker.getFragAtPos(T,ee.MAIN);Se&&Se.end>se.end&&(se=Se,this.mainFragLoading={frag:Se,targetBufferTime:null})}if(V.start>se.end)return}this.loadFragment(V,o,T)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(n=>new Bn(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==tt.STOPPED&&(this.setInterval(co),this.state=tt.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(g.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;const{levels:i}=this,{details:s,id:r,groupId:o,track:c}=t;if(!i){this.warn(`Audio tracks reset while loading track ${r} "${c.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||s.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==tt.STOPPED&&(this.state=tt.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${r} "${c.name}" of "${o}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const h=i[r];let f=0;if(s.live||(n=h.details)!=null&&n.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(h.details){var d;f=this.alignPlaylists(s,h.details,(d=this.levelLastLoaded)==null?void 0:d.details)}s.alignedSliding||(xi(s,u),s.alignedSliding||ys(s,u),f=s.fragmentStart)}h.details=s,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(u,f),this.hls.trigger(g.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===tt.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=tt.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:i,payload:s}=e,{config:r,trackId:o,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const u=c[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const h=u.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const f=r.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let d=this.transmuxer;d||(d=this.transmuxer=new uo(this.hls,ee.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const E=this.initPTS[n.cc],b=(t=n.initSegment)==null?void 0:t.data;if(E!==void 0){const T=i?i.index:-1,V=T!==-1,se=new ii(n.level,n.sn,n.stats.chunkCount,s.byteLength,T,V);d.push(s,b,f,"",n,i,h.totalduration,!1,se,E)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:R}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new Tr,complete:!1};R.push(new Uint8Array(s)),this.state!==tt.STOPPED&&(this.state=tt.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===ee.MAIN&&fe(t.frag)&&(this.mainFragLoading=t,this.state===tt.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n.type!==ee.AUDIO){!this.audioOnly&&n.type===ee.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(fe(n)){this.fragPrevious=n;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(g.AUDIO_TRACK_SWITCHED,y({},s)))}this.fragBufferedComplete(n,i),this.media&&this.tick()}onError(e,t){var n;if(t.fatal){this.state=tt.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ee.AUDIO,t);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===tt.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===ue.AUDIO_TRACK&&(this.state=tt.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==D.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==D.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===tt.ENDED&&(this.state=tt.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,ee.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:i}=this,{remuxResult:s,chunkMeta:r}=e,o=this.getCurrentContext(r);if(!o){this.resetWhenMissingContext(r);return}const{frag:c,part:u,level:h}=o,{details:f}=h,{audio:d,text:E,id3:b,initSegment:R}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=tt.PARSING,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),R!=null&&R.tracks){const T=c.initSegment||c;if(this.unhandledEncryptionError(R,c))return;this._bufferInitSegment(h,R.tracks,T,r),i.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:n,tracks:R.tracks})}if(d){const{startPTS:T,endPTS:V,startDTS:se,endDTS:te}=d;u&&(u.elementaryStreams[D.AUDIO]={startPTS:T,endPTS:V,startDTS:se,endDTS:te}),c.setElementaryStreamInfo(D.AUDIO,T,V,se,te),this.bufferFragmentData(d,c,u,r)}if(b!=null&&(t=b.samples)!=null&&t.length){const T=p({id:n,frag:c,details:f},b);i.trigger(g.FRAG_PARSING_METADATA,T)}if(E){const T=p({id:n,frag:c,details:f},E);i.trigger(g.FRAG_PARSING_USERDATA,T)}}_bufferInitSegment(e,t,n,i){if(this.state!==tt.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=ee.AUDIO;const r=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${r}/${s.codec}]`),r&&r.split(",").length===1&&(s.levelCodec=r),this.hls.trigger(g.BUFFER_CODECS,t);const o=s.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:o};this.hls.trigger(g.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===hn.NOT_LOADED||i===hn.PARTIAL){var s;if(!fe(e))this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=tt.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&ys(t.details,r)}else super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:n,assocLang:i,characteristics:s,audioCodec:r,channels:o}=this.bufferedTrack;ft({name:t,lang:n,assocLang:i,characteristics:s,audioCodec:r,channels:o},e,Ct)||(wn(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(g.AUDIO_TRACK_SWITCHED,y({},e))}}class ha extends F{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,n){const i=t==null?void 0:t.renditionReports;if(i){let s=-1;for(let r=0;r<i.length;r++){const o=i[r];let c;try{c=new self.URL(o.URI,t.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),c=o.URI||""}if(c===e){s=r;break}else c===e.substring(0,c.length)&&(s=r)}if(s!==-1){const r=i[s],o=parseInt(r["LAST-MSN"])||t.lastPartSn;let c=parseInt(r["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const h=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&h>t.partTarget&&(c+=1)}const u=n&&Vn(n);return new an(o,c>=0?c:void 0,u)}}}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(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}return e}playlistLoaded(e,t,n){const{details:i,stats:s}=t,r=self.performance.now(),o=s.loading.first?Math.max(0,r-s.loading.first):0;i.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==i.appliedTimelineOffset){const h=Math.max(c||0,0);i.appliedTimelineOffset=h,i.fragments.forEach(f=>{f.setStart(f.playlistOffset+h)})}if(i.live||n!=null&&n.live){const h="levelInfo"in t?t.levelInfo:t.track;if(i.reloaded(n),n&&i.fragments.length>0){Qs(n,i,this);const se=i.playlistParsingError;if(se){this.warn(se);const te=this.hls;if(!te.config.ignorePlaylistParsingErrors){var u;const{networkDetails:Se}=t;te.trigger(g.ERROR,{type:ne.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:se,reason:se.message,level:t.level||void 0,parent:(u=i.fragments[0])==null?void 0:u.type,networkDetails:Se,stats:s});return}i.playlistParsingError=null}}i.requestScheduled===-1&&(i.requestScheduled=s.loading.start);const f=this.hls.mainForwardBufferInfo,d=f?f.end-f.len:0,E=(i.edge-d)*1e3,b=vr(i,E);if(i.requestScheduled+b<r?i.requestScheduled=r:i.requestScheduled+=b,this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),!this.canLoad||!i.live)return;let R,T,V;if(i.canBlockReload&&i.endSN&&i.advanced){const se=this.hls.config.lowLatencyMode,te=i.lastPartSn,Se=i.endSN,Fe=i.lastPartIndex,Ye=Fe!==-1,Re=te===Se;Ye?Re?(T=Se+1,V=se?0:Fe):(T=te,V=se?Fe+1:i.maxPartIndex):T=Se+1;const Ue=i.age,Ge=Ue+i.ageHeader;let Ie=Math.min(Ge-i.partTarget,i.targetduration*1.5);if(Ie>0){if(Ge>i.targetduration*3)this.log(`Playlist last advanced ${Ue.toFixed(2)}s ago. Omitting segment and part directives.`),T=void 0,V=void 0;else if(n!=null&&n.tuneInGoal&&Ge-i.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${Ie} with playlist age: ${i.age}`),Ie=0;else{const it=Math.floor(Ie/i.targetduration);if(T+=it,V!==void 0){const It=Math.round(Ie%i.targetduration/i.partTarget);V+=It}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${Ue.toFixed(2)}s goal: ${Ie} skip sn ${it} to part ${V}`)}i.tuneInGoal=Ie}if(R=this.getDeliveryDirectives(i,t.deliveryDirectives,T,V),se||!Re){i.requestScheduled=r,this.loadingPlaylist(h,R);return}}else(i.canBlockReload||i.canSkipUntil)&&(R=this.getDeliveryDirectives(i,t.deliveryDirectives,T,V));R&&T!==void 0&&i.canBlockReload&&(i.requestScheduled=s.loading.first+Math.max(b-o*2,b/2)),this.scheduleLoading(h,R,i)}else this.clearTimer()}scheduleLoading(e,t,n){const i=n||e.details;if(!i){this.loadingPlaylist(e,t);return}const s=self.performance.now(),r=i.requestScheduled;if(s>=r){this.loadingPlaylist(e,t);return}const o=r-s;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,n,i){let s=Vn(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,s=In.No),new an(n,i,s)}checkRetry(e){const t=e.details,n=rn(e),i=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=i||{},c=!!i&&!!o&&(s===En.RetryRequest||!i.resolved&&s===En.SendAlternateToPenaltyBox);if(c){var u;if(r>=o.maxNumRetry)return!1;if(n&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=Rn(o,r);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,i.resolved=!0}return c}}function ho(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!or(a[t].attrs,e[t].attrs))return!1;return!0}function or(a,e,t){const n=a["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>a[i]!==e[i])}function fa(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class _u extends ha{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(g.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:n,groupId:i,details:s}=t,r=this.tracksInGroup[n];if(!r||r.groupId!==i){this.warn(`Audio track with id:${n} and group:${i} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Audio track ${n} "${r.name}" lang:${r.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(o=>(i==null?void 0:i.indexOf(o))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(d=>!n||n.indexOf(d.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(d=>d.default)&&(this.selectDefaultTrack=!1),o.forEach((d,E)=>{d.id=E});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const d=je(c,o,Ct);if(d>-1)s=o[d];else{const E=je(c,this.tracks);s=this.tracks[E]}}let u=this.findTrackId(s);u===-1&&s&&(u=this.findTrackId(null));const h={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${n==null?void 0:n.join(",")}`),this.hls.trigger(g.AUDIO_TRACKS_UPDATED,h);const f=this.trackId;if(u!==-1&&f===-1)this.setAudioTrack(u);else if(o.length&&f===-1){var r;const d=new Error(`No audio track selected for current audio group-ID(s): ${(r=this.groupIds)==null?void 0:r.join(",")} track count: ${o.length}`);this.warn(d.message),this.hls.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:d})}}}onError(e,t){t.fatal||!t.context||t.context.type===ue.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&ft(e,i,Ct))return i;const s=je(e,this.tracksInGroup,Ct);if(s>-1){const r=this.tracksInGroup[s];return this.setAudioTrack(s),r}else if(i){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);const o=cn(e,t.levels,n,r,Ct);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=je(e,n);if(r>-1)return n[r]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e],s=i.details&&!i.details.live;if(e===this.trackId&&i===n&&s||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(g.AUDIO_TRACK_SWITCHING,y({},i)),s))return;const r=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(!(this.selectDefaultTrack&&!i.default)&&(!e||ft(e,i,Ct)))return n}if(e){const{name:n,lang:i,assocLang:s,characteristics:r,audioCodec:o,channels:c}=e;for(let u=0;u<t.length;u++){const h=t[u];if(ft({name:n,lang:i,assocLang:s,characteristics:r,audioCodec:o,channels:c},h,Ct))return u}for(let u=0;u<t.length;u++){const h=t[u];if(or(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const h=t[u];if(or(e.attrs,h.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&wn(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${i}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(g.AUDIO_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:t||null,track:e})}}class vu{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(this.queues===null||this.tracks===null)return;const i=this.queues[t];i.push(e),i.length===1&&!n&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const n={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const n={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const n=(t=e[0])==null?void 0:t.label;(n==="async-blocker"||n==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(s){var n;if(i.onError(s),this.queues===null||this.tracks===null)return;const r=(n=this.tracks[e])==null?void 0:n.buffer;r!=null&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(e){var t,n;return(t=this.queues)!=null&&t[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const n=(t=this.tracks)==null?void 0:t[e],i=n==null?void 0:n.buffer;return i?`SourceBuffer${i.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(n=>n.label).join(", "))||""}}const fo=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,po="HlsJsTrackRemovedError";class yu extends Error{constructor(e){super(e),this.name=po}}class Eu extends F{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=n=>{var i;this.hls&&((i=this.mediaSource)==null?void 0:i.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=n=>{const{media:i,mediaSource:s}=this;n&&this.log("Media source opened"),!(!i||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(g.MEDIA_ATTACHED,{media:i,mediaSource:s}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:i}=this;n!==i&&this.error(`Media element src was set while attaching MediaSource (${i} > ${n})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=_e(oe(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.BUFFER_RESET,this.onBufferReset,this),e.on(g.BUFFER_APPENDING,this.onBufferAppending,this),e.on(g.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.BUFFER_EOS,this.onBufferEos,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.FRAG_PARSED,this.onFragParsed,this),e.on(g.FRAG_CHANGED,this.onFragChanged,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.BUFFER_RESET,this.onBufferReset,this),e.off(g.BUFFER_APPENDING,this.onBufferAppending,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.BUFFER_EOS,this.onBufferEos,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.FRAG_PARSED,this.onFragParsed,this),e.off(g.FRAG_CHANGED,this.onFragChanged,this),e.off(g.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const n={};if(this.operationQueue){const s=this.isUpdating();s||this.operationQueue.removeBlockers();const r=this.isQueued();(s||r)&&this.warn(`Transfering MediaSource with${r?" operations in queue":""}${s?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===t?p(n,i.tracks):this.sourceBuffers.forEach(s=>{const[r]=s;r&&(n[r]=p({},this.tracks[r]),this.removeBuffer(r)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:n}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var n;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,t){const n=this.media=t.media;this.transferData=this.overrides=void 0;const i=oe(this.appendSource);if(i){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(r),s)this._objectUrl=n.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{n.removeAttribute("src");const c=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||c&&r instanceof c,go(n),bu(n,o),n.load()}catch(c){n.src=o}else n.src=o}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,n;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(n=e.constructor)==null?void 0:n.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 n=this.tracks,i=t.tracks,s=i?Object.keys(i):null,r=s?s.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(i&&s&&r){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
required tracks: ${Vt(n,(c,u)=>c==="initSegment"?void 0:u)};
transfer tracks: ${Vt(i,(c,u)=>c==="initSegment"?void 0:u)}}`),!ie(i,n)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,u=this.details,h=Math.max(c,(u==null?void 0:u.fragments[0].start)||0);if(h-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${h}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(n)}") start time: ${h} currentTime: ${c}`),this.onMediaDetaching(g.MEDIA_DETACHING,{}),this.onMediaAttaching(g.MEDIA_ATTACHING,t),e.currentTime=h;return}this.transferData=void 0,s.forEach(c=>{const u=c,h=i[u];if(h){const f=h.buffer;if(f){const d=this.fragmentTracker,E=h.id;if(d.hasFragments(E)||d.hasParts(E)){const T=Zt.getBuffered(f);d.detectEvictedFragments(u,T,E,null,!0)}const b=da(u),R=[u,f];this.sourceBuffers[b]=R,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,h)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const n=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:s,_objectUrl:r}=this;if(s){if(this.log(`media source ${n?"transferring":"detaching"}`),n)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=s.readyState==="open";try{const c=s.sourceBuffers;for(let u=c.length;u--;)o&&c[u].abort(),s.removeSourceBuffer(c[u]);o&&s.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}i&&(i.removeEventListener("emptied",this._onMediaEmptied),n||(r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(i.removeAttribute("src"),this.appendSource&&go(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(g.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const n=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),n)try{var i;(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[da(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new vu(this.tracks)}onBufferCodecs(e,t){const n=this.tracks,i=Object.keys(t);this.log(`BUFFER_CODECS: "${i}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),r=!s&&this.sourceBufferCount&&this.media&&i.some(o=>!n[o]);if(s||r){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${i}" SourceBuffers`);return}i.forEach(o=>{var c,u;const h=t[o],{id:f,codec:d,levelCodec:E,container:b,metadata:R,supplemental:T}=h;let V=n[o];const se=(c=this.transferData)==null||(c=c.tracks)==null?void 0:c[o],te=se!=null&&se.buffer?se:V,Se=(te==null?void 0:te.pendingCodec)||(te==null?void 0:te.codec),Fe=te==null?void 0:te.levelCodec;V||(V=n[o]={buffer:void 0,listeners:[],codec:d,supplemental:T,container:b,levelCodec:E,metadata:R,id:f});const Ye=de(Se,Fe),Re=Ye==null?void 0:Ye.replace(fo,"$1");let Ue=de(d,E);const Ge=(u=Ue)==null?void 0:u.replace(fo,"$1");Ue&&Ye&&Re!==Ge&&(o.slice(0,5)==="audio"&&(Ue=Q(Ue,this.appendSource)),this.log(`switching codec ${Se} to ${Ue}`),Ue!==(V.pendingCodec||V.codec)&&(V.pendingCodec=Ue),V.container=b,this.appendChangeType(o,b,Ue))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,t,n){const i=`${t};codecs=${n}`,s={label:`change-type=${i}`,execute:()=>{const r=this.tracks[e];if(r){const o=r.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),o.changeType(i),r.codec=n,r.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:r=>{this.warn(`Failed to change ${e} SourceBuffer type`,r)}};this.append(s,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const n=e.start,i=n+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(n,ee.MAIN))==null?void 0:t.gap)===!0)return;const r={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>i||c!=null&&c.buffer&&Zt.isBuffered(c.buffer,i)||((o=this.fragmentTracker.getAppendedFrag(i,ee.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:r,frag:e},this.append(r,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:n}=this,{data:i,type:s,parent:r,frag:o,part:c,chunkMeta:u,offset:h}=t,f=u.buffering[s],{sn:d,cc:E}=o,b=self.performance.now();f.start=b;const R=o.stats.buffering,T=c?c.stats.buffering:null;R.start===0&&(R.start=b),T&&T.start===0&&(T.start=b);const V=n.audio;let se=!1;s==="audio"&&(V==null?void 0:V.container)==="audio/mpeg"&&(se=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const te=n.video,Se=te==null?void 0:te.buffer;if(Se&&d!=="initSegment"){const Re=c||o,Ue=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend&&!(te.ending||te.ended)){const Ie=Re.start+Re.duration*.05,it=Se.buffered,It=this.currentOp("video");!it.length&&!It?this.blockAudio(Re):!It&&!Zt.isBuffered(Se,Ie)&&this.lastVideoAppendEnd<Ie&&this.blockAudio(Re)}else if(s==="video"){const Ge=Re.end;if(Ue){const Ie=Ue.frag.start;(Ge>Ie||Ge<this.lastVideoAppendEnd||Zt.isBuffered(Se,Ie))&&this.unblockAudio()}this.lastVideoAppendEnd=Ge}}const Fe=(c||o).start,Ye={label:`append-${s}`,execute:()=>{var Re;f.executeStart=self.performance.now();const Ue=(Re=this.tracks[s])==null?void 0:Re.buffer;Ue&&(se?this.updateTimestampOffset(Ue,Fe,.1,s,d,E):h!==void 0&&N(h)&&this.updateTimestampOffset(Ue,h,1e-6,s,d,E)),this.appendExecutor(i,s)},onStart:()=>{},onComplete:()=>{const Re=self.performance.now();f.executeEnd=f.end=Re,R.first===0&&(R.first=Re),T&&T.first===0&&(T.first=Re);const Ue={};this.sourceBuffers.forEach(([Ge,Ie])=>{Ge&&(Ue[Ge]=Zt.getBuffered(Ie))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(g.BUFFER_APPENDED,{type:s,frag:o,part:c,chunkMeta:u,parent:o.type,timeRanges:Ue})},onError:Re=>{var Ue;const Ge={type:ne.MEDIA_ERROR,parent:o.type,details:$.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:Re,err:Re,fatal:!1},Ie=(Ue=this.media)==null?void 0:Ue.error;if(Re.code===DOMException.QUOTA_EXCEEDED_ERR||Re.name=="QuotaExceededError"||"quota"in Re)Ge.details=$.BUFFER_FULL_ERROR;else if(Re.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Ie)Ge.errorAction=Wn(!0);else if(Re.name===po&&this.sourceBufferCount===0)Ge.errorAction=Wn(!0);else{const it=++this.appendErrors[s];this.warn(`Failed ${it}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${Ie||"no media error"})`),(it>=this.hls.config.appendErrorMaxRetry||Ie)&&(Ge.fatal=!0)}this.hls.trigger(g.ERROR,Ge)}};this.append(Ye,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(g.BUFFER_FLUSHED,{type:e})},onError:i=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,i)}}}onBufferFlushing(e,t){const{type:n,startOffset:i,endOffset:s}=t;n?this.append(this.getFlushOp(n,i,s),n):this.sourceBuffers.forEach(([r])=>{r&&this.append(this.getFlushOp(r,i,s),r)})}onFragParsed(e,t){const{frag:n,part:i}=t,s=[],r=i?i.elementaryStreams:n.elementaryStreams;r[D.AUDIOVIDEO]?s.push("audiovideo"):(r[D.AUDIO]&&s.push("audio"),r[D.VIDEO]&&s.push("video"));const o=()=>{const c=self.performance.now();n.stats.buffering.end=c,i&&(i.stats.buffering.end=c);const u=i?i.stats:n.stats;this.hls.trigger(g.FRAG_BUFFERED,{frag:n,part:i,stats:u,id:n.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(o,s).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var n;this.sourceBuffers.forEach(([r])=>{if(r){const o=this.tracks[r];(!t.type||t.type===r)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${r} buffer reached EOS`)))}});const i=((n=this.overrides)==null?void 0:n.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([r])=>{var o;return r&&!((o=this.tracks[r])!=null&&o.ended)})?i?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream(),this.hls.trigger(g.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(g.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===$.BUFFER_APPEND_ERROR&&t.frag){var n;const i=(n=t.errorAction)==null?void 0:n.nextAutoLevel;N(i)&&i!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:n}=this;if(!n||t===null||!this.sourceBufferCount)return;const i=e.config,s=n.currentTime,r=t.levelTargetDuration,o=t.live&&i.liveBackBufferLength!==null?i.liveBackBufferLength:i.backBufferLength;if(N(o)&&o>=0){const u=Math.max(o,r),h=Math.floor(s/r)*r-u;this.flushBackBuffer(s,r,h)}const c=i.frontBufferFlushThreshold;if(N(c)&&c>0){const u=Math.max(i.maxBufferLength,c),h=Math.max(u,r),f=Math.floor(s/r)*r+h;this.flushFrontBuffer(s,r,f)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach(([i,s])=>{if(s){const o=Zt.getBuffered(s);if(o.length>0&&n>o.start(0)){var r;this.hls.trigger(g.BACK_BUFFER_REACHED,{bufferEnd:n});const c=this.tracks[i];if((r=this.details)!=null&&r.live)this.hls.trigger(g.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(c!=null&&c.ended){this.log(`Cannot flush ${i} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(g.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:i})}}})}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach(([i,s])=>{if(s){const r=Zt.getBuffered(s),o=r.length;if(o<2)return;const c=r.start(o-1),u=r.end(o-1);if(n>c||e>=c&&e<=u)return;this.hls.trigger(g.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:i})}})}getDurationAndRange(){var e;const{details:t,mediaSource:n}=this;if(!t||!this.media||(n==null?void 0:n.readyState)!=="open")return null;const i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&n.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),h=Math.max(u,i);return{duration:1/0,start:u,end:h}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return N(s)?{duration:s}:null;const r=this.media.duration,o=N(n.duration)?n.duration:0;return i>o&&i>r||!N(r)?{duration:i}:null}updateMediaSource({duration:e,start:t,end:n}){const i=this.mediaSource;!this.media||!i||i.readyState!=="open"||(i.duration!==e&&(N(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),t!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${t}-${n}.`),i.setLiveSeekableRange(t,n)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Vt(n)}`),this.tracksReady){var i;const s=(i=this.transferData)==null?void 0:i.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,n])=>{if(t){const i=this.tracks[t];e[t]={buffer:n,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}}),this.hls.trigger(g.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const r=s,o=e[r];if(this.isPending(o)){const c=this.getTrackCodec(o,r),u=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${u})${this.currentOp(r)?" Queued":""} ${Vt(o)}`);try{const h=n.addSourceBuffer(u),f=da(r),d=[r,h];t[f]=d,o.buffer=h}catch(h){var i;this.error(`error while trying to add sourceBuffer: ${h.message}`),this.shiftAndExecuteNext(r),(i=this.operationQueue)==null||i.removeBlockers(),delete this.tracks[r],this.hls.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,sourceBufferName:r,mimeType:u,parent:o.id});return}this.trackSourceBuffer(r,o)}}this.bufferCreated()}getTrackCodec(e,t){const n=e.supplemental;let i=e.codec;n&&(t==="video"||t==="audiovideo")&&Pt(n,"video")&&(i=ae(i,n));const s=de(i,e.levelCodec);return s?t.slice(0,5)==="audio"?Q(s,this.appendSource):s:""}trackSourceBuffer(e,t){const n=t.buffer;if(!n)return;const i=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,r)=>{const o=r.removedRanges;o!=null&&o.length&&this.hls.trigger(g.BUFFER_FLUSHED,{type:s})})}get mediaSrc(){var e,t;const n=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return n==null?void 0:n.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const n=this.currentOp(e);n&&(n.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${i}`,t),this.hls.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const s=this.currentOp(e);s&&s.onError(i)}updateTimestampOffset(e,t,n,i,s,r){const o=t-e.timestampOffset;Math.abs(o)>=n&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${s} cc: ${r})`),e.timestampOffset=t)}removeExecutor(e,t,n){const{media:i,mediaSource:s}=this,r=this.tracks[e],o=r==null?void 0:r.buffer;if(!i||!s||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=N(i.duration)?i.duration:1/0,u=N(s.duration)?s.duration:1/0,h=Math.max(0,t),f=Math.min(n,c,u);f>h&&(!r.ending||r.ended)?(r.ended=!1,this.log(`Removing [${h},${f}] from the ${e} SourceBuffer`),o.remove(h,f)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.tracks[t],i=n==null?void 0:n.buffer;if(!i)throw new yu(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,i.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:n}=this,i=t.map(r=>this.appendBlocker(r));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then(r=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var n;const i=(n=this.tracks[t])==null?void 0:n.buffer;!i||i.updating||this.shiftAndExecuteNext(t)})}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}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,n){const i=this.tracks[e];if(!i)return;const s=i.buffer;if(!s)return;const r=n.bind(this,e);i.listeners.push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const n=t.buffer;n&&(t.listeners.forEach(i=>{n.removeEventListener(i.event,i.listener)}),t.listeners.length=0)}}function go(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function bu(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function da(a){return a==="audio"?1:0}class pa{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(g.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(g.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.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 n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.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){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,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 n=t.filter((i,s)=>this.isLevelAllowed(i)&&s<=e);return this.clientRect=null,pa.getMaxLevelByMediaSize(n,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 n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const i=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0;let s=e.length-1;const r=Math.max(t,n);for(let o=0;o<e.length;o+=1){const c=e[o];if((c.width>=r||c.height>=r)&&i(c,e[o+1])){s=o;break}}return s}}const Mi={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},xu={HLS:"h"};class us{constructor(e,t){Array.isArray(e)&&(e=e.map(n=>n instanceof us?n:new us(n))),this.value=e,this.params=t}}const Su="Dict";function Tu(a){return Array.isArray(a)?JSON.stringify(a):a instanceof Map?"Map{}":a instanceof Set?"Set{}":typeof a=="object"?JSON.stringify(a):String(a)}function wu(a,e,t,n){return new Error(`failed to ${a} "${Tu(e)}" as ${t}`,{cause:n})}function cs(a,e,t){return wu("serialize",a,e,t)}class mo{constructor(e){this.description=e}}const _o="Bare Item",Au="Boolean";function Du(a){if(typeof a!="boolean")throw cs(a,Au);return a?"?1":"?0"}function Ru(a){return btoa(String.fromCharCode(...a))}const Iu="Byte Sequence";function Lu(a){if(ArrayBuffer.isView(a)===!1)throw cs(a,Iu);return`:${Ru(a)}:`}const Cu="Integer";function ku(a){return a<-999999999999999||999999999999999<a}function vo(a){if(ku(a))throw cs(a,Cu);return a.toString()}function Pu(a){return`@${vo(a.getTime()/1e3)}`}function yo(a,e){if(a<0)return-yo(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const i=Math.floor(a*t);return(i%2===0?i:i+1)/t}else return Math.round(a*t)/t}const Ou="Decimal";function Fu(a){const e=yo(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw cs(a,Ou);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Mu="String",Nu=/[\x00-\x1f\x7f]+/;function Bu(a){if(Nu.test(a))throw cs(a,Mu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Uu(a){return a.description||a.toString().slice(7,-1)}const $u="Token";function Eo(a){const e=Uu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw cs(e,$u);return e}function ga(a){switch(typeof a){case"number":if(!N(a))throw cs(a,_o);return Number.isInteger(a)?vo(a):Fu(a);case"string":return Bu(a);case"symbol":return Eo(a);case"boolean":return Du(a);case"object":if(a instanceof Date)return Pu(a);if(a instanceof Uint8Array)return Lu(a);if(a instanceof mo)return Eo(a);default:throw cs(a,_o)}}const Ku="Key";function ma(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw cs(a,Ku);return a}function _a(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${ma(e)}`:`;${ma(e)}=${ga(t)}`).join("")}function bo(a){return a instanceof us?`${ga(a.value)}${_a(a.params)}`:ga(a)}function Gu(a){return`(${a.value.map(bo).join(" ")})${_a(a.params)}`}function zu(a,e={whitespace:!0}){if(typeof a!="object"||a==null)throw cs(a,Su);const t=a instanceof Map?a.entries():Object.entries(a),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,s])=>{s instanceof us||(s=new us(s));let r=ma(i);return s.value===!0?r+=_a(s.params):(r+="=",Array.isArray(s.value)?r+=Gu(s):r+=bo(s)),r}).join(`,${n}`)}function xo(a,e){return zu(a,e)}const hs="CMCD-Object",ai="CMCD-Request",Ls="CMCD-Session",As="CMCD-Status",Vu={br:hs,ab:hs,d:hs,ot:hs,tb:hs,tpb:hs,lb:hs,tab:hs,lab:hs,url:hs,pb:ai,bl:ai,tbl:ai,dl:ai,ltc:ai,mtp:ai,nor:ai,nrr:ai,rc:ai,sn:ai,sta:ai,su:ai,ttfb:ai,ttfbb:ai,ttlb:ai,cmsdd:ai,cmsds:ai,smrt:ai,df:ai,cs:ai,ts:ai,cid:Ls,pr:Ls,sf:Ls,sid:Ls,st:Ls,v:Ls,msd:Ls,bs:As,bsd:As,cdn:As,rtp:As,bg:As,pt:As,ec:As,e:As},Wu={REQUEST:ai};function ju(a){return Object.keys(a).reduce((e,t)=>{var n;return(n=a[t])===null||n===void 0||n.forEach(i=>e[i]=t),e},{})}function Hu(a,e){const t={};if(!a)return t;const n=Object.keys(a),i=e?ju(e):{};return n.reduce((s,r)=>{var o;const c=Vu[r]||i[r]||Wu.REQUEST,u=(o=s[c])!==null&&o!==void 0?o:s[c]={};return u[r]=a[r],s},t)}function Zu(a){return["ot","sf","st","e","sta"].includes(a)}function Yu(a){return typeof a=="number"?N(a):a!=null&&a!==""&&a!==!1}const So="event";function qu(a,e){const t=new URL(a),n=new URL(e);if(t.origin!==n.origin)return a;const i=t.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")+t.search+t.hash}const kr=a=>Math.round(a),va=(a,e)=>Array.isArray(a)?a.map(t=>va(t,e)):a instanceof us&&typeof a.value=="string"?new us(va(a.value,e),a.params):(e.baseUrl&&(a=qu(a,e.baseUrl)),e.version===1?encodeURIComponent(a):a),Pr=a=>kr(a/100)*100,Xu={br:kr,d:kr,bl:Pr,dl:Pr,mtp:Pr,nor:(a,e)=>{let t=a;return e.version>=2&&(a instanceof us&&typeof a.value=="string"?t=new us([a]):typeof a=="string"&&(t=[a])),va(t,e)},rtp:Pr,tb:kr},To="request",wo="response",ya=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Qu=["e"],Ju=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Or(a){return Ju.test(a)}function ec(a){return ya.includes(a)||Qu.includes(a)||Or(a)}const Ao=["d","dl","nor","ot","rtp","su"];function tc(a){return ya.includes(a)||Ao.includes(a)||Or(a)}const nc=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function ic(a){return ya.includes(a)||Ao.includes(a)||nc.includes(a)||Or(a)}const sc=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function rc(a){return sc.includes(a)||Or(a)}const ac={[wo]:ic,[So]:ec,[To]:tc};function Do(a,e={}){const t={};if(a==null||typeof a!="object")return t;const n=e.version||a.v||1,i=e.reportingMode||To,s=n===1?rc:ac[i];let r=Object.keys(a).filter(s);const o=e.filter;typeof o=="function"&&(r=r.filter(o));const c=i===wo||i===So;c&&!r.includes("ts")&&r.push("ts"),n>1&&!r.includes("v")&&r.push("v");const u=p({},Xu,e.formatters),h={version:n,reportingMode:i,baseUrl:e.baseUrl};return r.sort().forEach(f=>{let d=a[f];const E=u[f];if(typeof E=="function"&&(d=E(d,h)),f==="v"){if(n===1)return;d=n}f=="pr"&&d===1||(c&&f==="ts"&&!N(d)&&(d=Date.now()),Yu(d)&&(Zu(f)&&typeof d=="string"&&(d=new mo(d)),t[f]=d))}),t}function oc(a,e={}){const t={};if(!a)return t;const n=Do(a,e),i=Hu(n,e==null?void 0:e.customHeaderMap);return Object.entries(i).reduce((s,[r,o])=>{const c=xo(o,{whitespace:!1});return c&&(s[r]=c),s},t)}function lc(a,e,t){return p(a,oc(e,t))}const uc="CMCD";function cc(a,e={}){return a?xo(Do(a,e),{whitespace:!1}):""}function hc(a,e={}){if(!a)return"";const t=cc(a,e);return encodeURIComponent(t)}function fc(a,e={}){if(!a)return"";const t=hc(a,e);return`${uc}=${t}`}const Ro=/CMCD=[^&#]+/;function dc(a,e,t){const n=fc(e,t);if(!n)return a;if(Ro.test(a))return a.replace(Ro,n);const i=a.includes("?")?"&":"?";return`${a}${i}${n}`}class pc{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:Mi.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=i=>{try{const{frag:s,part:r}=i,o=this.hls.levels[s.level],c=this.getObjectType(s),u={d:(r||s).duration*1e3,ot:c};(c===Mi.VIDEO||c===Mi.AUDIO||c==Mi.MUXED)&&(u.br=o.bitrate/1e3,u.tb=this.getTopBandwidth(c)/1e3,u.bl=this.getBufferLength(c));const h=r?this.getNextPart(r):this.getNextFrag(s);h!=null&&h.url&&h.url!==s.url&&(u.nor=h.url),this.apply(i,u)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHED,this.onMediaDetached,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHED,this.onMediaDetached,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var n,i;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:xu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){p(t,this.createData());const n=t.ot===Mi.INIT||t.ot===Mi.VIDEO||t.ot===Mi.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((r,o)=>(i.includes(o)&&(r[o]=t[o]),r),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),lc(e.headers,t,s)):e.url=dc(e.url,t,s)}getNextFrag(e){var t;const n=(t=this.hls.levels[e.level])==null?void 0:t.details;if(n){const i=e.sn-n.startSN;return n.fragments[i+1]}}getNextPart(e){var t;const{index:n,fragment:i}=e,s=(t=this.hls.levels[i.level])==null||(t=t.details)==null?void 0:t.partList;if(s){const{sn:r}=i;for(let o=s.length-1;o>=0;o--){const c=s[o];if(c.index===n&&c.fragment.sn===r)return s[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Mi.TIMED_TEXT;if(e.sn==="initSegment")return Mi.INIT;if(t==="audio")return Mi.AUDIO;if(t==="main")return this.hls.audioTracks.length?Mi.VIDEO:Mi.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===Mi.AUDIO)n=i.audioTracks;else{const s=i.maxAutoLevel,r=s>-1?s+1:i.levels.length;n=i.levels.slice(0,r)}return n.forEach(s=>{s.bitrate>t&&(t=s.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,n=e===Mi.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:Zt.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}}const gc=3e5;class mc extends F{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(n=>n!==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:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((n==null?void 0:n.action)===En.SendAlternateToPenaltyBox&&n.flags===bn.MoveAllAlternatesMatchingHost){const i=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:u}=t.context;o&&i?r=this.getPathwayForGroupId(o,u,r):c&&(r=c)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&i&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),n.resolved=this.pathwayId!==r),t.details===$.BUFFER_APPEND_ERROR&&!t.fatal?n.resolved=!0:n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${i&&i.length} priorities: ${Vt(s)} penalized: ${Vt(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach(s=>{i-n[s]>gc&&delete n[s]});for(let s=0;s<e.length;s++){const r=e[s];if(r in n)continue;if(r===this.pathwayId)return;const o=this.hls.nextLoadLevel,c=this.hls.levels[o];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,br(t),this.hls.trigger(g.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];c&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let s=0;s<i.length;s++)if(t===ue.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===ue.SUBTITLE_TRACK&&i[s].hasSubtitleGroup(e))return i[s].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},i={};e.forEach(s=>{const{ID:r,"BASE-ID":o,"URI-REPLACEMENT":c}=s;if(t.some(h=>h.pathwayId===r))return;const u=this.getLevelsForPathway(o).map(h=>{const f=new _n(h.attrs);f["PATHWAY-ID"]=r;const d=f.AUDIO&&`${f.AUDIO}_clone_${r}`,E=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;d&&(n[f.AUDIO]=d,f.AUDIO=d),E&&(i[f.SUBTITLES]=E,f.SUBTITLES=E);const b=Lo(h.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),R=new Bn({attrs:f,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:b,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let T=1;T<h.audioGroups.length;T++)R.addGroupId("audio",`${h.audioGroups[T]}_clone_${r}`);if(h.subtitleGroups)for(let T=1;T<h.subtitleGroups.length;T++)R.addGroupId("text",`${h.subtitleGroups[T]}_clone_${r}`);return R});t.push(...u),Io(this.audioTracks,n,c,r),Io(this.subtitleTracks,i,c,r)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let i;try{i=new self.URL(e)}catch(h){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+h)}const s={responseType:"json",url:i.href},r=t.steeringManifestLoadPolicy.default,o=r.errorRetry||r.timeoutRetry||{},c={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(h,f,d,E)=>{this.log(`Loaded steering manifest: "${i}"`);const b=h.data;if((b==null?void 0:b.VERSION)!==1){this.log(`Steering VERSION ${b.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=b.TTL;const{"RELOAD-URI":R,"PATHWAY-CLONES":T,"PATHWAY-PRIORITY":V}=b;if(R)try{this.uri=new self.URL(R,i).href}catch(te){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${R}`);return}this.scheduleRefresh(this.uri||d.url),T&&this.clonePathways(T);const se={steeringManifest:b,url:i.toString()};this.hls.trigger(g.STEERING_MANIFEST_LOADED,se),V&&this.updatePathwayPriority(V)},onError:(h,f,d,E)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${f.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let b=this.timeToLoad*1e3;if(h.code===429){const R=this.loader;if(typeof(R==null?void 0:R.getResponseHeader)=="function"){const T=R.getResponseHeader("Retry-After");T&&(b=parseFloat(T)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,b)},onTimeout:(h,f,d)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,c,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const i=(n=this.hls)==null?void 0:n.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Io(a,e,t,n){a&&Object.keys(e).forEach(i=>{const s=a.filter(r=>r.groupId===i).map(r=>{const o=p({},r);return o.details=void 0,o.attrs=new _n(o.attrs),o.url=o.attrs.URI=Lo(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[i],o.attrs["PATHWAY-ID"]=n,o});a.push(...s)})}function Lo(a,e,t,n){const{HOST:i,PARAMS:s,[t]:r}=n;let o;e&&(o=r==null?void 0:r[e],o&&(a=o));const c=new self.URL(a);return i&&!o&&(c.host=i),s&&Object.keys(s).sort().forEach(u=>{u&&c.searchParams.set(u,s[u])}),c.href}class Vs extends F{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=Vs.CDMCleanupPromise?[Vs.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:n,initData:i}=t,s=`"${t.type}" event: init data type: "${n}"`;if(this.debug(s),i!==null){if(!this.keyFormatPromise){let r=Object.keys(this.keySystemAccessPromises);r.length||(r=zt(this.config));const o=r.map(kt).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=os(r);if(n!=="sinf"||o!==$n.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${n}" for selected key-system ${o}`);return}let c;try{const E=Ce(new Uint8Array(i)),b=Un(JSON.parse(E).sinf),R=yt(b);if(!R)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(R.subarray(8,24))}catch(E){this.warn(`${s} Failed to parse sinf: ${E}`);return}const u=k(c),{keyIdToKeySessionPromise:h,mediaKeySessions:f}=this;let d=h[u];for(let E=0;E<f.length;E++){const b=f[E],R=b.decryptdata;if(!R.keyId)continue;const T=k(R.keyId);if(u===T||R.uri.replace(/-/g,"").indexOf(u)!==-1){if(d=h[T],!d)continue;if(R.pssh)break;delete h[T],R.pssh=new Uint8Array(i),R.keyId=c,d=h[u]=d.then(()=>this.generateRequestWithPreferredKeySession(b,n,i,"encrypted-event-key-match")),d.catch(V=>this.handleError(V));break}}d||this.handleError(new Error(`Key ID ${u} not encountered in playlist. Key-system sessions ${f.length}.`))}).catch(r=>this.handleError(r))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(g.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(g.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(g.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(g.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(g.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,i=t==null?void 0:t[e];if(i)return i.licenseUrl;if(e===$n.WIDEVINE&&n)return n}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=t==null?void 0:t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(r,o,c)=>!!r&&c.indexOf(r)===o,i=t.map(r=>r.audioCodec).filter(n),s=t.map(r=>r.videoCodec).filter(n);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((r,o)=>{const c=u=>{const h=u.shift();this.getMediaKeysPromise(h,i,s).then(f=>r({keySystem:h,mediaKeys:f})).catch(f=>{u.length?c(u):f instanceof ts?o(f):o(new ts({type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${n}`;return On===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return n(e,t)}getMediaKeysPromise(e,t,n){var i;const s=qn(e,t,n,this.config.drmSystemOptions||{});let r=this.keySystemAccessPromises[e],o=(i=r)==null?void 0:i.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Vt(s)}`),o=this.requestMediaKeySystemAccess(e,s);const c=r=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(u=>{this.log(`Failed to obtain access to key-system "${e}": ${u}`)}),o.then(u=>{this.log(`Access for key-system "${u.keySystem}" obtained`);const h=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const f=c.mediaKeys=u.createMediaKeys().then(d=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,h.then(E=>E?this.setMediaKeysServerCertificate(d,e,E):d)));return f.catch(d=>{this.error(`Failed to create media-keys for "${e}"}: ${d}`)}),f})}return o.then(()=>r.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${k(e.keyId||[])}`);const i=n.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,s,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return k(e.keyId)}updateKeySession(e,t){const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${k(e.decryptdata.keyId||[])}
} (data length: ${t.byteLength})`),n.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>kt(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:n})=>this.attemptSetMediaKeys(t,n))}selectKeySystem(e){return new Promise((t,n)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:i})=>{const s=kt(i);s?t(s):n(new Error(`Unable to find format for key-system "${i}"`))}).catch(n)})}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=zt(this.config),n=e.map(os).filter(i=>!!i&&t.indexOf(i)!==-1);return this.selectKeySystem(n)}loadKey(e){const t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),i=this.bannedKeyIds[n];if(i){const o=Co(i,t);return this.handleError(o,e.frag),Promise.reject(o)}const s=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);const r=this.keyIdToKeySessionPromise[n];if(!r){const o=this.getKeySystemForKeyPromise(t).then(({keySystem:c,mediaKeys:u})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(c,u).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:c,mediaKeys:u,decryptdata:t}))))).then(c=>{const u="cenc",h=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(c,u,h,"playlist-key")});return o.catch(c=>this.handleError(c,e.frag)),this.keyIdToKeySessionPromise[n]=o,o}return r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){this.hls&&(this.error(e.message),e instanceof ts?(t&&(e.data.frag=t),this.hls.trigger(g.ERROR,e.data)):this.hls.trigger(g.ERROR,{type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){const i=os(e.keyFormat),s=i?[i]:zt(this.config);return this.attemptKeySystemAccess(s)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=zt(this.config)),e.length===0)throw new ts({type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Vt({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).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(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>n.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,n,i){var s;const r=(s=this.config.drmSystems)==null||(s=s[e.keySystem])==null?void 0:s.generateRequest;if(r)try{const d=r.call(this.hls,t,n,e);if(!d)throw new Error("Invalid response from configured generateRequest filter");t=d.initDataType,n=d.initData?d.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(d){if(this.warn(d.message),this.hls&&this.hls.config.debug)throw d}if(n===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const o=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${o} (init data type: ${t} length: ${n.byteLength})`);const c=new Qr,u=e._onmessage=d=>{const E=e.mediaKeysSession;if(!E){c.emit("error",new Error("invalid state"));return}const{messageType:b,message:R}=d;this.log(`"${b}" message event for session "${E.sessionId}" message size: ${R.byteLength}`),b==="license-request"||b==="license-renewal"?this.renewLicense(e,R).catch(T=>{c.eventNames().length?c.emit("error",T):this.handleError(T)}):b==="license-release"?e.keySystem===$n.FAIRPLAY&&(this.updateKeySession(e,si("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${b}"`)},h=e._onkeystatuseschange=d=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}const b=e.keyStatus;this.onKeyStatusChange(e);const R=e.keyStatus;R!==b&&(c.emit("keyStatus",R,e),R==="expired"&&(this.log(`${e.keySystem} expired for key ${o}`),this.renewKeySession(e)))};pi(e.mediaKeysSession,"message",u),pi(e.mediaKeysSession,"keystatuseschange",h);const f=new Promise((d,E)=>{c.on("error",E),c.on("keyStatus",(b,{decryptdata:R})=>{b.startsWith("usable")?d():b==="internal-error"||b==="output-restricted"?E(Co(b,R)):b==="expired"?E(new Error(`key expired while generating request (keyId: ${o})`)):this.warn(`unhandled key status change "${b}" (keyId: ${o})`)})});return e.mediaKeysSession.generateRequest(t,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o}`)}).catch(d=>{throw new ts({type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:d,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${d}`)}).then(()=>f).catch(d=>{throw c.removeAllListeners(),this.removeSession(e),d}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){const t=k(new Uint8Array(e.decryptdata.keyId||[]));e.mediaKeysSession.keyStatuses.forEach((n,i)=>{if(typeof i=="string"&&typeof n=="object"){const o=i;i=n,n=o}const s=k("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i));n==="internal-error"&&(this.bannedKeyIds[s]=n);const r=s===t;this.log(`${r?"":"un"}matched key status change "${n}" for keyStatuses keyId: ${s} session keyId: ${t} uri: ${e.decryptdata.uri}`),r&&(e.keyStatus=n)})}fetchServerCertificate(e){const t=this.config,n=t.loader,i=new n(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((r,o)=>{const c={responseType:"arraybuffer",url:s},u=t.certLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,E,b,R)=>{r(d.data)},onError:(d,E,b,R)=>{o(new ts({type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:b,response:y({url:c.url,data:void 0},d)},`"${e}" certificate request failed (${s}). Status: ${d.code} (${d.text})`))},onTimeout:(d,E,b)=>{o(new ts({type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:b,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(d,E,b)=>{o(new Error("aborted"))}};i.load(c,h,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((i,s)=>{e.setServerCertificate(n).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${n.byteLength}) on "${t}"`),i(e)}).catch(r=>{s(new ts({type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(i=>{throw new ts({type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:i,fatal:!1},i.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(n,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let h;for(let f=0,d=s.length;f<d;f++){var r,o;h=s[f];const E=(r=h.querySelector("name"))==null?void 0:r.textContent,b=(o=h.querySelector("value"))==null?void 0:o.textContent;E&&b&&e.setRequestHeader(E,b)}}const c=i.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return si(atob(u))}setupLicenseXHR(e,t,n,i){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,n,i)}).catch(r=>{if(!n.decryptdata)throw r;return e.open("POST",t,!0),s.call(this.hls,e,t,n,i)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((i,s)=>{const r=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${r}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let c=o.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const u=this.config.licenseResponseCallback;if(u)try{c=u.call(this.hls,o,r,e)}catch(h){this.error(h)}i(c)}else{const c=n.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)s(new ts({type:ne.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:r,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${r}). Status: ${o.status} (${o.statusText})`));else{const h=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(i,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,r,e,t).then(({xhr:c,licenseChallenge:u})=>{e.keySystem==$n.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)}).catch(s)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,pi(n,"encrypted",this.onMediaEncrypted),pi(n,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(Si(e,"encrypted",this.onMediaEncrypted),Si(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,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Ji.clearKeyUriToKeyIdMap();const i=n.length;Vs.CDMCleanupPromise=Promise.all(n.map(s=>this.removeSession(s)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(s=>{this.log(`Could not clear media keys: ${s}`),this.hls&&this.hls.trigger(g.ERROR,{type:ne.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`),this.hls&&this.hls.trigger(g.ERROR,{type:ne.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})}).then(()=>{i&&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 n=t.reduce((i,s)=>(i.indexOf(s.keyFormat)===-1&&i.push(s.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n,decryptdata:i}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${k((i==null?void 0:i.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);const{drmSystemOptions:r}=this.config;return(ms(r)?new Promise((c,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(c).catch(u)}):Promise.resolve()).catch(c=>{this.log(`Could not remove session: ${c}`),this.hls&&this.hls.trigger(g.ERROR,{type:ne.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${c}`)})}).then(()=>t.close()).catch(c=>{this.log(`Could not close session: ${c}`),this.hls&&this.hls.trigger(g.ERROR,{type:ne.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${c}`)})})}}}Vs.CDMCleanupPromise=void 0;class ts 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 Co(a,e){const t=a==="output-restricted",n=t?$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new ts({type:ne.KEY_SYSTEM_ERROR,details:n,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${a}"`)}class _c{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(g.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(g.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){const i=performance.now();if(t){if(this.lastTime){const s=i-this.lastTime,r=n-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*r/s,u=this.hls;if(u.trigger(g.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:n}),c>0&&r>u.config.fpsDroppedMonitoringThreshold*o){let h=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=h)&&(h=h-1,u.trigger(g.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function ko(a,e){let t;try{t=new Event("addtrack")}catch(n){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function Po(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues&&!a.cues.getCueById(e.id))try{if(a.addCue(e),!a.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){X.debug(`[texttrack-utils]: ${n}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,a.addCue(i)}catch(i){X.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(a.mode=t)}function Ws(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let n=a.cues.length;n--;)e&&a.cues[n].removeEventListener("enter",e),a.removeCue(a.cues[n]);t==="disabled"&&(a.mode=t)}function Ea(a,e,t,n){const i=a.mode;if(i==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=yc(a.cues,e,t);for(let r=0;r<s.length;r++)(!n||n(s[r]))&&a.removeCue(s[r])}i==="disabled"&&(a.mode=i)}function vc(a,e){if(e<=a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let n=0,i=t,s;for(;n<=i;)if(s=Math.floor((i+n)/2),e<a[s].startTime)i=s-1;else if(e>a[s].startTime&&n<t)n=s+1;else return s;return a[n].startTime-e<e-a[i].startTime?n:i}function yc(a,e,t){const n=[],i=vc(a,e);if(i>-1)for(let s=i,r=a.length;s<r;s++){const o=a[s];if(o.startTime>=e&&o.endTime<=t)n.push(o);else if(o.startTime>t)return n}return n}function Fr(a){const e=[];for(let t=0;t<a.length;t++){const n=a[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(a[t])}return e}class Ec extends ha{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const n=Fr(this.media.textTracks);for(let s=0;s<n.length;s++)if(n[s].mode==="hidden")t=n[s];else if(n[s].mode==="showing"){t=n[s];break}const i=this.findTrackForTextTrack(t);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(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(g.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const n=this.media;if(!n)return;const i=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;Fr(n.textTracks).forEach(r=>{Ws(r)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:n,groupId:i,details:s}=t,r=this.tracksInGroup[n];if(!r||r.groupId!==i){this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Subtitle track ${n} "${r.name}" lang:${r.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(r=>(i==null?void 0:i.indexOf(r))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(h=>!n||n.indexOf(h.groupId)!==-1);if(r.length)this.selectDefaultTrack&&!r.some(h=>h.default)&&(this.selectDefaultTrack=!1),r.forEach((h,f)=>{h.id=f});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=r;const o=this.hls.config.subtitlePreference;if(!s&&o){this.selectDefaultTrack=!1;const h=je(o,r);if(h>-1)s=r[h];else{const f=je(o,this.tracks);s=this.tracks[f]}}let c=this.findTrackId(s);c===-1&&s&&(c=this.findTrackId(null));const u={subtitleTracks:r};this.log(`Updating subtitle tracks, ${r.length} track(s) found in "${n==null?void 0:n.join(",")}" group-id`),this.hls.trigger(g.SUBTITLE_TRACKS_UPDATED,u),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const s=t[i];if(!(n&&!s.default||!n&&!e)&&(!e||ft(s,e)))return i}if(e){for(let i=0;i<t.length;i++){const s=t[i];if(or(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const s=t[i];if(or(e.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(fa(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ue.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const n=this.currentTrack;if(n&&ft(e,n))return n;const i=je(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=je(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${i}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(g.SUBTITLE_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Fr(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(s=>fa(n,s))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==i&&(s.mode="disabled")}),i){const s=this.subtitleDisplay?"showing":"hidden";i.mode!==s&&(i.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!N(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(g.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!i.details&&!i.details.live;if(e===this.trackId&&i===n&&s)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:r,groupId:o="",name:c,type:u,url:h}=i;this.hls.trigger(g.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:c,type:u,url:h});const f=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(f)}}function bc(){try{return crypto.randomUUID()}catch(a){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?s:s&3|8).toString(16)})}}}function lr(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const js=.025;let Mr=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function xc(a,e,t){return`${a.identifier}-${t+1}-${lr(e)}`}class Sc{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const n=this.playoutLimit;return e<=0||isNaN(n)?!1:n===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>n}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 ba(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,n=ba(t,e);return t-n<.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 ba(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<js))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Mr.Range:Mr.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return Tc(this)}}function ba(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<js)?e.start:e.start+e.duration}function Oo(a,e,t){const n=new self.URL(a,t);return n.protocol!=="data:"&&n.searchParams.set("_HLS_primary_id",e),n}function xa(a,e){for(;(t=a.assetList[++e])!=null&&t.error;)var t;return e}function Tc(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function Hs(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class wc{constructor(e,t,n,i){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(g.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=n,this.assetItem=i;const r=()=>{this.hasDetails=!0};s.once(g.LEVEL_LOADED,r),s.once(g.AUDIO_TRACK_LOADED,r),s.once(g.SUBTITLE_TRACK_LOADED,r),s.on(g.MEDIA_ATTACHING,(o,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(g.BUFFER_APPENDED,()=>{const h=this.bufferedEnd;this.reachedPlayout(h)&&(this._bufferedEosTime=h,s.trigger(g.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=Oo(t,e.config.primarySessionId||"").href}catch(n){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const n=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset,s=Zt.bufferInfo(e,i,0);return this.getAssetTime(s.end)>=n-.02}reachedPlayout(e){const n=this.interstitial.playoutLimit;return this.startOffset+e>=n}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=Zt.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 n=t-this.startOffset;if(n>0&&n<e)return n}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const n=e-t;if(Math.abs(n)>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,n=this.duration;return Math.min(Math.max(0,e-t),n)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=n=>delete n.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){var i;(i=this.hls)==null||i.on(e,t)}once(e,t,n){var i;(i=this.hls)==null||i.once(e,t)}off(e,t,n){var i;(i=this.hls)==null||i.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Hs(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Fo=.033;class Ac extends F{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((n,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,n+1):n,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 n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[n]||(t===void 0&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&(s=i[n])!=null&&s.event;){var s;n--}return n}findItemIndexAtTime(e,t){const n=this.items;if(n)for(let i=0;i<n.length;i++){let s=n[i];if(t&&t!=="primary"&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return i}return-1}findJumpRestrictedIndex(e,t){const n=this.items;if(n)for(let i=e;i<=t&&n[i];i++){const s=n[i].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return i}return-1}findEventIndex(e){const t=this.items;if(t)for(let i=t.length;i--;){var n;if(((n=t[i].event)==null?void 0:n.identifier)===e)return i}return-1}findAssetIndex(e,t){const n=e.assetList,i=n.length;if(i>1)for(let s=0;s<i;s++){const r=n[s];if(!r.error){const o=r.timelineStart;if(t===o||t>o&&(t<o+(r.duration||0)||s===i-1))return s}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const n=t.assetList,i=n[n.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t){const n=e.main.details,{dateRanges:i}=n,s=this.events,r=this.parseDateRanges(i,{url:n.url},t),o=Object.keys(i),c=s?s.filter(u=>!o.includes(u.identifier)):[];r.length&&r.sort((u,h)=>{const f=u.cue.pre,d=u.cue.post,E=h.cue.pre,b=h.cue.post;if(f&&!E)return-1;if(E&&!f||d&&!b)return 1;if(b&&!d)return-1;if(!f&&!E&&!d&&!b){const R=u.startTime,T=h.startTime;if(R!==T)return R-T}return u.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=r,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],n=!1){const i=this.events||[];if(i.length||t.length||this.length<2){const s=this.items,r=this.parseSchedule(i,e);(n||t.length||(s==null?void 0:s.length)!==r.length||r.some((c,u)=>Math.abs(c.playout.start-s[u].playout.start)>.005||Math.abs(c.playout.end-s[u].playout.end)>.005))&&(this.items=r,this.onScheduleUpdate(t,s))}}parseDateRanges(e,t,n){const i=[],s=Object.keys(e);for(let r=0;r<s.length;r++){const o=s[r],c=e[o];if(c.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(c):(u=new Sc(c,t),this.eventMap[o]=u,n===!1&&(u.appendInPlace=n)),i.push(u)}}return i}parseSchedule(e,t){const n=[],i=t.main.details,s=i.live?1/0:i.edge;let r=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,u=0;if(e.forEach((h,f)=>{const d=h.cue.pre,E=h.cue.post,b=e[f-1]||null,R=h.appendInPlace,T=E?s:h.startOffset,V=h.duration,se=h.timelineOccupancy===Mr.Range?V:0,te=h.resumptionOffset,Se=(b==null?void 0:b.startTime)===T,Fe=T+h.cumulativeDuration;let Ye=R?Fe+V:T+te;if(d||!E&&T<=0){const Ue=u;u+=se,h.timelineStart=Fe;const Ge=r;r+=V,n.push({event:h,start:Fe,end:Ye,playout:{start:Ge,end:r},integrated:{start:Ue,end:u}})}else if(T<=s){if(!Se){const Ie=T-c;if(Ie>Fo){const it=c,It=u;u+=Ie;const Mt=r;r+=Ie;const Gt={previousEvent:e[f-1]||null,nextEvent:h,start:it,end:it+Ie,playout:{start:Mt,end:r},integrated:{start:It,end:u}};n.push(Gt)}else Ie>0&&b&&(b.cumulativeDuration+=Ie,n[n.length-1].end=T)}E&&(Ye=Fe),h.timelineStart=Fe;const Ue=u;u+=se;const Ge=r;r+=V,n.push({event:h,start:Fe,end:Ye,playout:{start:Ge,end:r},integrated:{start:Ue,end:u}})}else return;const Re=h.resumeTime;E||Re>s?c=s:c=Re}),c<s){var o;const h=c,f=u,d=s-c;u+=d;const E=r;r+=d,n.push({previousEvent:((o=n[n.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:h+d,playout:{start:E,end:r},integrated:{start:f,end:u}})}this.setDurations(s,r,u)}else n.push({previousEvent:null,nextEvent:null,start:0,end:s,playout:{start:0,end:s},integrated:{start:0,end:s}}),this.setDurations(s,s,s);return n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){const n=t.main.details,i=n.live?1/0:n.edge;let s=0,r=-1;e.forEach((o,c)=>{const u=o.cue.pre,h=o.cue.post,f=u?0:h?i:o.startTime;this.updateAssetDurations(o),r===f?o.cumulativeDuration=s:(s=0,r=f),!h&&o.snapOptions.in&&(o.resumeAnchor=on(null,n.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<Fo&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const E=N(o.resumeOffset)?o.resumeOffset:o.duration;s+=E})}primaryCanResumeInPlaceAt(e,t){const n=e.resumeTime,i=e.startTime+e.resumptionOffset;return Math.abs(n-i)>js?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${i}`),!1):!Object.keys(t).some(r=>{const o=t[r].details,c=o.edge;if(n>=c)return this.log(`"${e.identifier}" resumption ${n} past ${r} playlist end ${c}`),!1;const u=on(null,o.fragments,n);if(!u)return this.log(`"${e.identifier}" resumption ${n} does not align with any fragments in ${r} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const h=r==="audio"?.175:0;return Math.abs(u.start-n)<js+h||Math.abs(u.end-n)<js+h?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${r} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let n=0,i=!1,s=!1;for(let r=0;r<e.assetList.length;r++){const o=e.assetList[r],c=t+n;o.startOffset=n,o.timelineStart=c,i||(i=o.duration===null),s||(s=!!o.error);const u=o.error?0:o.duration||0;n+=u}i&&!s?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function ns(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class Dc{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const n=e.assetListUrl;let i;try{i=Oo(n,this.hls.sessionId,e.baseUrl)}catch(d){const E=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,d,n);this.hls.trigger(g.ERROR,E);return}t&&i.protocol!=="data:"&&i.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,r=s.loader,o=new r(s),c={responseType:"json",url:i.href},u=s.interstitialAssetListLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,E,b,R)=>{const T=d.data,V=T==null?void 0:T.ASSETS;if(!Array.isArray(V)){const se=this.assignAssetListError(e,$.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),b.url,E,R);this.hls.trigger(g.ERROR,se);return}e.assetListResponse=T,this.hls.trigger(g.ASSET_LIST_LOADED,{event:e,assetListResponse:T,networkDetails:R})},onError:(d,E,b,R)=>{const T=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${d.code} ${d.text} (${E.url})`),E.url,R,b);this.hls.trigger(g.ERROR,T)},onTimeout:(d,E,b)=>{const R=this.assignAssetListError(e,$.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${E.url})`),E.url,d,b);this.hls.trigger(g.ERROR,R)}};return o.load(c,h,f),this.hls.trigger(g.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,n,i,s,r){return e.error=n,{type:ne.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:n,networkDetails:r,stats:s}}}function Mo(a){a==null||a.play().catch(()=>{})}function Nr(a,e){return`[${a}] Advancing timeline position to ${e}`}class Rc extends F{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 n=this.currentTime;if(n===void 0||this.playbackDisabled||!this.schedule)return;const i=n-this.timelinePos;if(Math.abs(i)<1/7056e5)return;const r=i<=-.01;this.timelinePos=n,this.bufferedPos=n;const o=this.playingItem;if(!o){this.checkBuffer();return}if(r&&this.schedule.resetErrorsInRange(n,n-i)&&this.updateSchedule(!0),this.checkBuffer(),r&&n<o.start||n>=o.end){var c;const E=this.findItemIndex(o);let b=this.schedule.findItemIndexAtTime(n);if(b===-1&&(b=E+(r?-1:1),this.log(`seeked ${r?"back ":""}to position not covered by schedule ${n} (resolving from ${E} to ${b})`)),!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!r&&b>E){const R=this.schedule.findJumpRestrictedIndex(E+1,b);if(R>E){this.setSchedulePosition(R);return}}this.setSchedulePosition(b);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const E=o.event.assetList[0];E&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(n,E))}return}const h=u.timelineStart,f=u.duration||0;if(r&&n<h||n>=h+f){var d;(d=o.event)!=null&&d.appendInPlace&&(this.clearInterstitial(o.event,o),this.flushFrontBuffer(n)),this.setScheduleToAssetAtTime(n,u)}},this.onTimeupdate=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled)return;if(n>this.timelinePos)this.timelinePos=n,n>this.bufferedPos&&this.checkBuffer();else return;const i=this.playingItem;if(!i||this.playingLastItem)return;if(n>=i.end){this.timelinePos=i.end;const o=this.findItemIndex(i);this.setSchedulePosition(o+1)}const s=this.playingAsset;if(!s)return;const r=s.timelineStart+(s.duration||0);n>=r&&this.setScheduleToAssetAtTime(n,s)},this.onScheduleUpdate=(n,i)=>{const s=this.schedule;if(!s)return;const r=this.playingItem,o=s.events||[],c=s.items||[],u=s.durations,h=n.map(R=>R.identifier),f=!!(o.length||h.length);(f||i)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
Schedule: ${c.map(R=>ns(R))} pos: ${this.timelinePos}`),h.length&&this.log(`Removed events ${h}`);let d=null,E=null;r&&(d=this.updateItem(r,this.timelinePos),this.itemsMatch(r,d)?this.playingItem=d:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const b=this.bufferingItem;if(b&&(E=this.updateItem(b,this.bufferedPos),this.itemsMatch(b,E)?this.bufferingItem=E:b.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(b.event,null))),n.forEach(R=>{R.assetList.forEach(T=>{this.clearAssetPlayer(T.identifier,null)})}),this.playerQueue.forEach(R=>{if(R.interstitial.appendInPlace){const T=R.assetItem.timelineStart,V=R.timelineOffset-T;if(V)try{R.timelineOffset=T}catch(se){Math.abs(V)>js&&this.warn(`${se} ("${R.assetId}" ${R.timelineOffset}->${T})`)}}}),f||i){if(this.hls.trigger(g.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:u,removedIds:h}),this.isInterstitial(r)&&h.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}r&&this.trimInPlace(d,r),b&&E!==d&&this.trimInPlace(E,b),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Dc(e),this.schedule=new Ac(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(g.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(g.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(g.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(g.BUFFER_APPENDED,this.onBufferAppended,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(g.MEDIA_ENDED,this.onMediaEnded,this),e.on(g.ERROR,this.onError,this),e.on(g.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(g.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(g.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(g.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.BUFFER_APPENDED,this.onBufferAppended,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(g.MEDIA_ENDED,this.onMediaEnded,this),e.off(g.ERROR,this.onError,this),e.off(g.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.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){Si(e,"play",this.onPlay),Si(e,"pause",this.onPause),Si(e,"seeking",this.onSeeking),Si(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const n=this.media=t.media;pi(n,"seeking",this.onSeeking),pi(n,"timeupdate",this.onTimeupdate),pi(n,"play",this.onPlay),pi(n,"pause",this.onPause)}onMediaAttached(e,t){const n=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!i){this.clearScheduleState();const s=this.findItemIndex(n);this.setSchedulePosition(s)}}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 n=!!t.transferMedia,i=this.media;if(this.media=null,!n&&(i&&this.removeMediaListeners(i),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.log(`Removing schedule state for detachedData and ${s}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.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,n=f=>f&&e.getAssetPlayer(f.identifier),i=(f,d,E,b,R)=>{if(f){let T=f[d].start;const V=f.event;if(V){if(d==="playout"||V.timelineOccupancy!==Mr.Point){const se=n(E);(se==null?void 0:se.interstitial)===V&&(T+=se.assetItem.startOffset+se[R])}}else{const se=b==="bufferedPos"?r():e[b];T+=se-f.start}return T}return 0},s=(f,d)=>{var E;if(f!==0&&d!=="primary"&&(E=e.schedule)!=null&&E.length){var b;const R=e.schedule.findItemIndexAtTime(f),T=(b=e.schedule.items)==null?void 0:b[R];if(T){const V=T[d].start-T.start;return f+V}}return f},r=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var d,E;return(d=e.primaryDetails)!=null&&d.live?e.primaryDetails.edge:((E=e.schedule)==null?void 0:E.durations[f])||0},c=(f,d)=>{var E,b;const R=e.effectivePlayingItem;if(R!=null&&(E=R.event)!=null&&E.restrictions.skip||!e.schedule)return;e.log(`seek to ${f} "${d}"`);const T=e.effectivePlayingItem,V=e.schedule.findItemIndexAtTime(f,d),se=(b=e.schedule.items)==null?void 0:b[V],te=e.getBufferingPlayer(),Se=te==null?void 0:te.interstitial,Fe=Se==null?void 0:Se.appendInPlace,Ye=T&&e.itemsMatch(T,se);if(T&&(Fe||Ye)){const Re=n(e.playingAsset),Ue=(Re==null?void 0:Re.media)||e.primaryMedia;if(Ue){const Ge=d==="primary"?Ue.currentTime:i(T,d,e.playingAsset,"timelinePos","currentTime"),Ie=f-Ge,it=(Fe?Ge:Ue.currentTime)+Ie;if(it>=0&&(!Re||Fe||it<=Re.duration)){Ue.currentTime=it;return}}}if(se){let Re=f;if(d!=="primary"){const Ge=se[d].start,Ie=f-Ge;Re=se.start+Ie}const Ue=!e.isInterstitial(se);if((!e.isInterstitial(T)||T.event.appendInPlace)&&(Ue||se.event.appendInPlace)){const Ge=e.media||(Fe?te==null?void 0:te.media:null);Ge&&(Ge.currentTime=Re)}else if(T){const Ge=e.findItemIndex(T);if(V>Ge){const it=e.schedule.findJumpRestrictedIndex(Ge+1,V);if(it>Ge){e.setSchedulePosition(it);return}}let Ie=0;if(Ue)e.timelinePos=Re,e.checkBuffer();else{const it=se.event.assetList,It=f-(se[d]||se).start;for(let Mt=it.length;Mt--;){const Gt=it[Mt];if(Gt.duration&&It>=Gt.startOffset&&It<Gt.startOffset+Gt.duration){Ie=Mt;break}}}e.setSchedulePosition(V,Ie)}}},u=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const d=t();return e.isInterstitial(d)?d:null},h={get bufferedEnd(){const f=t(),d=e.bufferingItem;if(d&&d===f){var E;return i(d,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-d.playout.start||((E=e.bufferingAsset)==null?void 0:E.startOffset)||0}return 0},get currentTime(){const f=u(),d=e.effectivePlayingItem;return d&&d===f?i(d,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-d.playout.start:0},set currentTime(f){const d=u(),E=e.effectivePlayingItem;E&&E===d&&c(f+E.playout.start,"playout")},get duration(){const f=u();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const d=(f=u())==null?void 0:f.event.assetList;return d?d.map(E=>e.getAssetPlayer(E.identifier)):[]},get playingIndex(){var f;const d=(f=u())==null?void 0:f.event;return d&&e.effectivePlayingAsset?d.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};return this.manager={get events(){var f;return((f=e.schedule)==null||(f=f.events)==null?void 0:f.slice(0))||[]},get schedule(){var f;return((f=e.schedule)==null||(f=f.items)==null?void 0:f.slice(0))||[]},get interstitialPlayer(){return u()?h:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const f=t();return e.findItemIndex(f)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const f=e.effectivePlayingItem;return e.findItemIndex(f)},primary:{get bufferedEnd(){return r()},get currentTime(){const f=e.timelinePos;return f>0?f:0},set currentTime(f){c(f,"primary")},get duration(){return o("primary")},get seekableStart(){var f;return((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(f){c(f,"integrated")},get duration(){return o("integrated")},get seekableStart(){var f;return s(((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0,"integrated")}},skip:()=>{const f=e.effectivePlayingItem,d=f==null?void 0:f.event;if(d&&!d.restrictions.skip){const E=e.findItemIndex(f);if(d.appendInPlace){const b=f.playout.start+f.event.duration;c(b+.001,"playout")}else e.advanceAfterAssetEnded(d,E,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,n=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!n?!1:this.findItemIndex(t)===n.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let i=this.media;!i&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(i=this.primaryMedia);const s=(t=i)==null?void 0:t.currentTime;if(!(s===void 0||!N(s)))return s}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){const n=e.interstitial.appendInPlace,i=e.media;if(n&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i){this.detachedData={media:i};return}const s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Vt(s)}`),this.detachedData=s}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,t){var n,i;if(e.media===t)return;let s=null;const r=this.hls,o=e!==r,c=o&&e.interstitial.appendInPlace,u=(n=this.detachedData)==null?void 0:n.mediaSource;let h;if(r.media)c&&(s=r.transferMedia(),this.detachedData=s),h="Primary";else if(u){const b=this.getBufferingPlayer();b?(s=b.transferMedia(),h=`${b}`):h="detached MediaSource"}else h="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${Vt(s)}`);else if(!this.detachedData||r.media===t){const b=this.playerQueue;b.length>1&&b.forEach(R=>{if(o&&R.interstitial.appendInPlace!==c){const T=R.interstitial;this.clearInterstitial(R.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 f=s&&"mediaSource"in s&&((i=s.mediaSource)==null?void 0:i.readyState)!=="closed",d=f&&s?s:t;this.log(`${f?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${h} (media.currentTime: ${t.currentTime})`);const E=this.schedule;if(d===s&&E){const b=o&&e.assetId===E.assetIdAtEnd;d.overrides={duration:E.duration,endOfStream:!o||b,cueRemoval:!o}}e.attachMedia(d)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e==null?void 0:e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const n=this.timelinePos,i=this.effectivePlayingItem;if(n===-1){const s=this.hls.startPosition;if(this.log(Nr("checkStart",s)),this.timelinePos=s,t.length&&t[0].cue.pre){const r=e.findEventIndex(t[0].identifier);this.setSchedulePosition(r)}else if(s>=0||!this.primaryLive){const r=this.timelinePos=s>0?s:0,o=e.findItemIndexAtTime(r);this.setSchedulePosition(o)}}else if(i&&!this.playingItem){const s=e.findItemIndex(i);this.setSchedulePosition(s)}}advanceAssetBuffering(e,t){const n=e.event,i=n.findAssetIndex(t),s=xa(n,i);if(!n.isAssetPastPlayoutLimit(s))this.bufferedToEvent(e,s);else if(this.schedule){var r;const o=(r=this.schedule.items)==null?void 0:r[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,n){const i=xa(e,n);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){const s=this.schedule.items;if(s){const r=t+1,o=s.length;if(r>=o){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.log(Nr("advanceAfterAssetEnded",c)),this.timelinePos=c,e.appendInPlace&&this.advanceInPlace(c),this.checkBuffer(this.bufferedPos<c)),this.setSchedulePosition(r)}}}else{if(e.appendInPlace){const s=e.assetList[i];s&&this.advanceInPlace(s.timelineStart)}this.setSchedulePosition(t,i)}}setScheduleToAssetAtTime(e,t){const n=this.schedule;if(!n)return;const i=t.parentIdentifier,s=n.getEvent(i);if(s){const r=n.findEventIndex(i),o=n.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,r,o-1)}}setSchedulePosition(e,t){var n;const i=(n=this.schedule)==null?void 0:n.items;if(!i||this.playbackDisabled)return;const s=e>=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${s&&ns(s)}) pos: ${this.timelinePos}`);const r=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(r)){const h=r.event,f=this.playingAsset,d=f==null?void 0:f.identifier,E=d?this.getAssetPlayer(d):null;if(E&&d&&(!this.eventItemsMatch(r,s)||t!==void 0&&d!==h.assetList[t].identifier)){var c;const b=h.findAssetIndex(f);if(this.log(`INTERSTITIAL_ASSET_ENDED ${b+1}/${h.assetList.length} ${Hs(f)}`),this.endedAsset=f,this.playingAsset=null,this.hls.trigger(g.INTERSTITIAL_ASSET_ENDED,{asset:f,assetListIndex:b,event:h,schedule:i.slice(0),scheduleIndex:e,player:E}),r!==this.playingItem){this.itemsMatch(r,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(h,this.findItemIndex(this.playingItem),b);return}this.retreiveMediaSource(d,s),E.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&E.detachMedia()}if(!this.eventItemsMatch(r,s)&&(this.endedItem=r,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${h} ${ns(r)}`),h.hasPlayed=!0,this.hls.trigger(g.INTERSTITIAL_ENDED,{event:h,schedule:i.slice(0),scheduleIndex:e}),h.cue.once)){var u;this.updateSchedule();const b=(u=this.schedule)==null?void 0:u.items;if(s&&b){const R=this.findItemIndex(s);this.advanceSchedule(R,b,t,r,o)}return}}this.advanceSchedule(e,i,t,r,o)}advanceSchedule(e,t,n,i,s){const r=this.schedule;if(!r)return;const o=t[e]||null,c=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach(h=>{const f=h.interstitial,d=r.findEventIndex(f.identifier);(d<e||d>e+1)&&this.clearInterstitial(f,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const h=o.event;if(n===void 0){n=r.findAssetIndex(h,this.timelinePos);const b=xa(h,n-1);if(h.isAssetPastPlayoutLimit(b)||h.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(h,e,n);return}n=b}const f=this.waitingItem;this.assetsBuffered(o,c)||this.setBufferingItem(o);let d=this.preloadAssets(h,n);if(this.eventItemsMatch(o,f||i)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${ns(o)} ${h.appendInPlace?"append in place":""}`),this.hls.trigger(g.INTERSTITIAL_STARTED,{event:h,schedule:t.slice(0),scheduleIndex:e})),!h.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${h}`);return}if(h.assetListLoader&&(h.assetListLoader.destroy(),h.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${h}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const E=h.assetList[n];if(!E){this.advanceAfterAssetEnded(h,e,n||0);return}if(d||(d=this.getAssetPlayer(E.identifier)),d===null||d.destroyed){const b=h.assetList.length;this.warn(`asset ${n+1}/${b} player destroyed ${h}`),d=this.createAssetPlayer(h,E,n),d.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&h.appendInPlace&&this.isAssetBuffered(E))return;this.startAssetPlayer(d,n,t,e,c),this.shouldPlay&&Mo(d.media)}else o?(this.resumePrimary(o,e,i),this.shouldPlay&&Mo(this.hls.media)):s&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(r.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,n){var i,s;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${ns(e)}`),!((i=this.detachedData)!=null&&i.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(Nr("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!n)return;const r=(s=this.schedule)==null?void 0:s.items;r&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${ns(e)}`),this.hls.trigger(g.INTERSTITIALS_PRIMARY_RESUMED,{schedule:r.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const n=e.start;if(this.primaryLive){const i=this.primaryDetails;if(t===0)return this.hls.startPosition;if(i&&(n<i.fragmentStart||n>i.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:Zt.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,i),n&&this.startLoadingPrimaryAt(e,n)),n||(this.log(Nr("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){var n;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs((((n=i.mainForwardBufferInfo)==null?void 0:n.start)||i.media.currentTime)-e)>.5?i.startLoad(e,t):i.bufferingEnabled||i.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(g.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(g.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const n=this.hls.levels[t.level],i=y(y({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const n=this.hls.audioTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=y(y({},this.altSelection),{},{audio:n});return}const s=y(y({},i),{},{audio:n});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const n=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=y(y({},this.altSelection),{},{subtitles:n});return}const s=y(y({},i),{},{subtitles:n});this.mediaSelection=s}onAudioTrackSwitching(e,t){const n=nt(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setAudioOption(t)||i.setAudioOption(n)))}onSubtitleTrackSwitch(e,t){const n=nt(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setSubtitleOption(t)||t.id!==-1&&i.setSubtitleOption(n)))}onBufferCodecs(e,t){const n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const i=this.timelinePos;this.bufferedPos=i,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let i=0;i<t.length;i++){const s=t[i];if(s.cue.post){var n;const r=this.schedule.findEventIndex(s.identifier),o=(n=this.schedule.items)==null?void 0:n[r];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const n=this.findItemIndex(t);this.setSchedulePosition(n+1)}else this.shouldPlay=!1}updateItem(e,t){var n;const i=(n=this.schedule)==null?void 0:n.items;if(e&&i){const s=this.findItemIndex(e,t);return i[s]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((s,r)=>{e.event.isAssetPastPlayoutLimit(r)&&this.clearAssetPlayer(s.identifier,null)});const n=e.end+.25,i=Zt.bufferInfo(this.primaryMedia,n,0);(i.end>n||(i.nextStart||0)>n)&&(this.log(`trim buffered interstitial ${ns(e)} (was ${ns(t)})`),this.attachPrimary(n,null,!0),this.flushFrontBuffer(n))}}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 n;return!!t&&(e===t||e.event.identifier===((n=t.event)==null?void 0:n.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const n=this.mediaSelection;n&&((t=this.schedule)==null||t.updateSchedule(n,[],e))}checkBuffer(e){var t;const n=(t=this.schedule)==null?void 0:t.items;if(!n)return;const i=Zt.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,n,e)}updateBufferedPos(e,t,n){const i=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const r=this.playingItem,o=this.findItemIndex(r);let c=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var u;const h=this.findItemIndex(s),f=Math.min(h+1,t.length-1),d=t[f];if((c===-1&&s&&e>=s.end||(u=d.event)!=null&&u.appendInPlace&&e+.01>=d.start)&&(c=f),this.isInterstitial(s)){const E=s.event;if(f-o>1&&E.appendInPlace===!1||E.assetList.length===0&&E.assetListLoader)return}if(this.bufferedPos=e,c>h&&c>o)this.bufferedToItem(d);else{const E=this.primaryDetails;this.primaryLive&&E&&e>E.edge-E.targetduration&&d.start<E.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(d)&&this.preloadAssets(d.event,0)}}else n&&r&&!this.itemsMatch(r,s)&&(c===o?this.bufferedToItem(r):c===o+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(i=>{const s=this.getAssetPlayer(i.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(e,t)&&n){const{items:i,events:s}=n;if(!i||!s)return t;const r=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${ns(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(r){const u=n.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((h,f)=>{const d=this.getAssetPlayer(h.identifier);d&&(f===u&&d.loadSource(),d.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering());this.hls.trigger(g.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:i.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 n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(n!==null){this.bufferingAsset=null;const i=this.detachedData;i?i.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){const n=e.event,i=n.assetList.length===0&&!n.assetListLoader,s=n.cue.once;if(i||!s){const r=this.preloadAssets(n,t);if(r!=null&&r.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(r,o)}}}preloadAssets(e,t){const n=e.assetUrl,i=e.assetList.length,s=i===0&&!e.assetListLoader,r=e.cue.once;if(s){const c=e.timelineStart;if(e.appendInPlace){var o;const d=this.playingItem;!this.isInterstitial(d)&&(d==null||(o=d.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let u,h=0;if(!this.playingItem&&this.primaryLive&&(h=this.hls.startPosition,h===-1&&(h=this.hls.liveSyncPosition||0)),h&&!(e.cue.pre||e.cue.post)){const d=h-c;d>0&&(u=Math.round(d*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:i} ${e}${u?` live-start: ${h} start-offset: ${u}`:""}`),n)return this.createAsset(e,0,0,c,e.duration,n);const f=this.assetListLoader.loadAssetList(e,u);f&&(e.assetListLoader=f)}else if(!r&&i){for(let u=t;u<i;u++){const h=e.assetList[u],f=this.getAssetPlayerQueueIndex(h.identifier);(f===-1||this.playerQueue[f].destroyed)&&!h.error&&this.createAssetPlayer(e,h,u)}const c=e.assetList[t];if(c){const u=this.getAssetPlayer(c.identifier);return u&&u.loadSource(),u}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(i=>{this.hls.trigger(g.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:i})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;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 n=0;n<e.length;n++)if(e[n].media===t)return e[n]}return null}createAsset(e,t,n,i,s,r){const o={parentIdentifier:e.identifier,identifier:xc(e,r,t),duration:s,startOffset:n,timelineStart:i,uri:r};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,n){const i=this.hls,s=i.userConfig;let r=s.videoPreference;const o=i.loadLevelObj||i.levels[i.currentLevel];(r||o)&&(r=p({},r),o.videoCodec&&(r.videoCodec=o.videoCodec),o.videoRange&&(r.allowedVideoRanges=[o.videoRange]));const c=i.audioTracks[i.audioTrack],u=i.subtitleTracks[i.subtitleTrack];let h=0;if(this.primaryLive||e.appendInPlace){const Se=this.timelinePos-t.timelineStart;if(Se>1){const Fe=t.duration;Fe&&Se<Fe&&(h=Se)}}const f=t.identifier,d=y(y({},s),{},{maxMaxBufferLength:Math.min(180,i.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:i.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:i.bandwidthEstimate,interstitialsController:void 0,startPosition:h,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:r,audioPreference:c||s.audioPreference,subtitlePreference:u||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(d.timelineOffset=t.timelineStart));const E=d.cmcd;E!=null&&E.sessionId&&E.contentId&&(d.cmcd=p({},E,{contentId:lr(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const b=new wc(this.HlsPlayerClass,d,e,t);this.playerQueue.push(b),e.assetList[n]=t;let R=!0;const T=Se=>{if(Se.live){var Fe;const Ue=new Error(`Interstitials MUST be VOD assets ${e}`),Ge={fatal:!0,type:ne.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ue},Ie=((Fe=this.schedule)==null?void 0:Fe.findEventIndex(e.identifier))||-1;this.handleAssetItemError(Ge,e,Ie,n,Ue.message);return}const Ye=Se.edge-Se.fragmentStart,Re=t.duration;(R||Re===null||Ye>Re)&&(R=!1,this.log(`Interstitial asset "${f}" duration change ${Re} > ${Ye}`),t.duration=Ye,this.updateSchedule())};b.on(g.LEVEL_UPDATED,(Se,{details:Fe})=>T(Fe)),b.on(g.LEVEL_PTS_UPDATED,(Se,{details:Fe})=>T(Fe)),b.on(g.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const V=(Se,Fe)=>{const Ye=this.getAssetPlayer(f);if(Ye&&Fe.tracks){Ye.off(g.BUFFER_CODECS,V),Ye.tracks=Fe.tracks;const Re=this.primaryMedia;this.bufferingAsset===Ye.assetItem&&Re&&!Ye.media&&this.bufferAssetPlayer(Ye,Re)}};b.on(g.BUFFER_CODECS,V);const se=()=>{var Se;const Fe=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${Fe}`),!Fe||!this.schedule)return;const Ye=this.schedule.findEventIndex(e.identifier),Re=(Se=this.schedule.items)==null?void 0:Se[Ye];this.isInterstitial(Re)&&this.advanceAssetBuffering(Re,t)};b.on(g.BUFFERED_TO_END,se);const te=Se=>()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;this.shouldPlay=!0;const Ye=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,Ye,Se)};return b.once(g.MEDIA_ENDED,te(n)),b.once(g.PLAYOUT_LIMIT_REACHED,te(1/0)),b.on(g.ERROR,(Se,Fe)=>{if(!this.schedule)return;const Ye=this.getAssetPlayer(f);if(Fe.details===$.BUFFER_STALLED_ERROR){if(Ye!=null&&Ye.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(Fe,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${Fe.error} ${e}`)}),b.on(g.DESTROYING,()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;const Fe=new Error(`Asset player destroyed unexpectedly ${f}`),Ye={fatal:!0,type:ne.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:Fe};this.handleAssetItemError(Ye,e,this.schedule.findEventIndex(e.identifier),n,Fe.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Hs(t)}`),this.hls.trigger(g.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:b}),b}clearInterstitial(e,t){e.assetList.forEach(n=>{this.clearAssetPlayer(n.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){const i=this.playerQueue[n];this.log(`clear ${i} toSegment: ${t&&ns(t)}`),this.transferMediaFromPlayer(i,t),this.playerQueue.splice(n,1),i.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,n,i,s){const{interstitial:r,assetItem:o,assetId:c}=e,u=r.assetList.length,h=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!h||h.identifier!==c)&&(h&&(this.clearAssetPlayer(h.identifier,n[i]),delete h.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${Hs(o)}`),this.hls.trigger(g.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:r,schedule:n.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var n,i;if(!this.schedule)return;const{interstitial:s,assetItem:r}=e,o=this.schedule.findEventIndex(s.identifier),c=(n=this.schedule.items)==null?void 0:n[o];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=r;const u=this.getBufferingPlayer();if(u===e)return;const h=s.appendInPlace;if(h&&(u==null?void 0:u.interstitial.appendInPlace)===!1)return;const f=(u==null?void 0:u.tracks)||((i=this.detachedData)==null?void 0:i.tracks)||this.requiredTracks;if(h&&r!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(f&&!ie(f,e.tracks)){const d=new Error(`Asset ${Hs(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(f)}')`),E={fatal:!0,type:ne.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:d},b=s.findAssetIndex(r);this.handleAssetItemError(E,s,o,b,d.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,n=this.primaryMedia;if(!t||!n)return;const i=n.currentTime,s=t.findAssetIndex(e,i),r=e.assetList[s];if(r){const o=this.getAssetPlayer(r.identifier);if(o){const c=o.currentTime||i-r.timelineStart,u=o.duration-c;if(this.warn(`Stalled at ${c} of ${c+u} in ${o} ${e} (media.currentTime: ${i})`),c&&(u/n.playbackRate<.5||o.bufferedInPlaceToEnd(n))&&o.hls){const h=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,h,s)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,n,i,s){if(e.details===$.BUFFER_STALLED_ERROR)return;const r=t.assetList[i]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${r&&Hs(r)} ${e.error}`),!this.schedule)return;const o=(r==null?void 0:r.identifier)||"",c=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[c]||null,h=this.schedule.items,f=p({},e,{fatal:!1,errorAction:Wn(!0),asset:r,assetListIndex:i,event:t,schedule:h,scheduleIndex:n,player:u});if(this.hls.trigger(g.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const d=this.playingAsset,E=this.bufferingAsset,b=new Error(s);if(r&&(this.clearAssetPlayer(o,null),r.error=b),!t.assetList.some(R=>!R.error))t.error=b;else for(let R=i;R<t.assetList.length;R++)this.resetAssetPlayer(t.assetList[R].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):d&&d.identifier===o?this.advanceAfterAssetEnded(t,n,i):E&&E.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,E)}primaryFallback(e){const t=e.timelineStart,n=this.effectivePlayingItem;if(n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${ns(n)} error: ${e.error}`);let i=this.timelinePos;i===-1&&(i=this.hls.startPosition);const s=this.updateItem(n,i);if(this.itemsMatch(n,s)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t)),!this.schedule)return;const r=this.schedule.findItemIndexAtTime(i);this.setSchedulePosition(r)}else this.checkStart()}onAssetListLoaded(e,t){var n,i;const s=t.event,r=s.identifier,o=t.assetListResponse.ASSETS;if(!((n=this.schedule)!=null&&n.hasEvent(r)))return;const c=s.timelineStart,u=s.duration;let h=0;o.forEach((R,T)=>{const V=parseFloat(R.DURATION);this.createAsset(s,T,h,c+h,V,R.URI),h+=V}),s.duration=h,this.log(`Loaded asset-list with duration: ${h} (was: ${u}) ${s}`);const f=this.waitingItem,d=(f==null?void 0:f.event.identifier)===r;this.updateSchedule();const E=(i=this.bufferingItem)==null?void 0:i.event;if(d){var b;const R=this.schedule.findEventIndex(r),T=(b=this.schedule.items)==null?void 0:b[R];if(T){if(!this.playingItem&&this.timelinePos>T.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==R){s.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${s}`),this.updateSchedule(!0),this.primaryFallback(s);return}this.setBufferingItem(T)}this.setSchedulePosition(R)}else if((E==null?void 0:E.identifier)===r){const R=s.assetList[0];if(R){const T=this.getAssetPlayer(R.identifier);if(E.appendInPlace){const V=this.primaryMedia;T&&V&&this.bufferAssetPlayer(T,V)}else T&&T.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case $.ASSET_LIST_PARSING_ERROR:case $.ASSET_LIST_LOAD_ERROR:case $.ASSET_LIST_LOAD_TIMEOUT:{const n=t.interstitial;n&&(this.updateSchedule(!0),this.primaryFallback(n));break}case $.BUFFER_STALLED_ERROR:{const n=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&n.event.appendInPlace){this.handleInPlaceStall(n.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const No=500;class Ic extends Es{constructor(e,t,n){super(e,t,n,"subtitle-stream-controller",ee.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(g.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(g.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=tt.IDLE,this.setInterval(No),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:n,success:i}=t;if(this.fragContextChanged(n)||(fe(n)&&(this.fragPrevious=n),this.state=tt.IDLE),!i)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let r;const o=n.start;for(let u=0;u<s.length;u++)if(o>=s[u].start&&o<=s[u].end){r=s[u];break}const c=n.start+n.duration;r?r.end=c:(r={start:o,end:c},s.push(r)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:n,endOffset:i}=t;if(n===0&&i!==Number.POSITIVE_INFINITY){const s=i-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(r=>{for(let o=0;o<r.length;){if(r[o].end<=s){r.shift();continue}else if(r[o].start<s)r[o].start=s;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(n,s,ee.SUBTITLE)}}onError(e,t){const n=t.frag;(n==null?void 0:n.type)===ee.SUBTITLE&&(t.details===$.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==tt.STOPPED&&(this.state=tt.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&ho(this.levels,t)){this.levels=t.map(n=>new Bn(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const i=new Bn(n);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ee.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==tt.STOPPED&&this.setInterval(No)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:i,levels:s}=this,{details:r,id:o}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const c=s[o];if(o>=s.length||!c)return;this.log(`Subtitle track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(r.live||(n=c.details)!=null&&n.live){if(r.deltaUpdateFailed)return;const f=this.mainDetails;if(!f){this.startFragRequested=!1;return}const d=f.fragments[0];if(!c.details)r.hasProgramDateTime&&f.hasProgramDateTime?(ys(r,f),u=r.fragmentStart):d&&(u=d.start,er(r,u));else{var h;u=this.alignPlaylists(r,c.details,(h=this.levelLastLoaded)==null?void 0:h.details),u===0&&d&&(u=d.start,er(r,u))}f&&!this.startFragRequested&&this.setStartPosition(f,u)}c.details=r,this.levelLastLoaded=c,o===i&&(this.hls.trigger(g.SUBTITLE_TRACK_UPDATED,{details:r,id:o,groupId:t.groupId}),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===tt.IDLE&&(on(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,i=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&i!=null&&i.key&&i.iv&&bi(i.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer,ei(i.method)).catch(o=>{throw s.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();s.trigger(g.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:r,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=tt.IDLE})}}doTick(){if(!this.media){this.state=tt.IDLE;return}if(this.state===tt.IDLE){const{currentTrackId:e,levels:t}=this,n=t==null?void 0:t[e];if(!n||!t.length||!n.details||this.waitForLive(n))return;const{config:i}=this,s=this.getLoadPosition(),r=Zt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,i.maxBufferHole),{end:o,len:c}=r,u=n.details,h=this.hls.maxBufferLength+u.levelTargetDuration;if(c>h)return;const f=u.fragments,d=f.length,E=u.edge;let b=null;const R=this.fragPrevious;if(o<E){const se=i.maxFragLookUpTolerance,te=o>E-se?0:se;b=on(R,f,Math.max(f[0].start,o),te),!b&&R&&R.start<f[0].start&&(b=f[0])}else b=f[d-1];if(b=this.filterReplacedPrimary(b,n.details),!b)return;const T=b.sn-u.startSN,V=f[T-1];if(V&&V.cc===b.cc&&this.fragmentTracker.getState(V)===hn.NOT_LOADED&&(b=V),this.fragmentTracker.getState(b)===hn.NOT_LOADED){const se=this.mapToInitFragWhenRequired(b);se&&this.loadFragment(se,n,o)}}}loadFragment(e,t,n){fe(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Lc(this.tracksBuffered[this.currentTrackId]||[])}}class Lc{constructor(e){this.buffered=void 0;const t=(n,i,s)=>{if(i=i>>>0,i>s-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}const Cc={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},Bo=a=>String.fromCharCode(Cc[a]||a),is=15,xs=100,kc={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Pc={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Oc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Fc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Mc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Nc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;X.log(`${this.time} [${e}] ${n}`)}}}const Cs=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class Uo{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 n=0;n<t.length;n++){const i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class Bc{constructor(){this.uchar=" ",this.penState=new Uo}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class Uc{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Uo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<xs;t++)this.chars.push(new Bc);this.logger=e}equals(e){for(let t=0;t<xs;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<xs;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<xs;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>xs&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=xs)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].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=Bo(e);if(this.pos>=xs){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<xs;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 n=0;n<xs;n++){const i=this.chars[n].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Sa{constructor(e){this.rows=[],this.currRow=is-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<is;t++)this.rows.push(new Uc(e));this.logger=e}reset(){for(let e=0;e<is;e++)this.rows[e].clear();this.currRow=is-1}equals(e){let t=!0;for(let n=0;n<is;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<is;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<is;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 = "+Vt(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<is;o++)this.rows[o].clear();const s=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const o=r.rows[s].cueStartTime,c=this.logger.time;if(o!==null&&c!==null&&o<c)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(r.rows[s+u])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,r=Math.max(s-1,0);n.setCursor(e.indent),e.color=n.chars[r].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Vt(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let n="",i=-1;for(let s=0;s<is;s++){const r=this.rows[s].getTextString();r&&(i=s+1,e?t.push("Row "+i+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
`)),n}getTextAndFormat(){return this.rows}}class $o{constructor(e,t,n){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 Sa(n),this.nonDisplayedMemory=new Sa(n),this.lastOutputScreen=new Sa(n),this.currRollUpRow=this.displayedMemory.rows[is-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[is-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[n]}this.logger.log(2,"MIDROW: "+Vt(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Ko{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Kc(),this.logger=void 0;const i=this.logger=new Nc;this.channels=[null,new $o(e,t,i),new $o(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const i=t[n]&127,s=t[n+1]&127;let r=!1,o=null;if(i===0&&s===0)continue;this.logger.log(3,()=>"["+Cs([t[n],t[n+1]])+"] -> ("+Cs([i,s])+")");const c=this.cmdHistory;if(i>=16&&i<=31){if($c(i,s,c)){Br(null,null,c),this.logger.log(3,()=>"Repeated command ("+Cs([i,s])+") is dropped");continue}Br(i,s,this.cmdHistory),r=this.parseCmd(i,s),r||(r=this.parseMidrow(i,s)),r||(r=this.parsePAC(i,s)),r||(r=this.parseBackgroundAttributes(i,s))}else Br(null,null,c);if(!r&&(o=this.parseChars(i,s),o)){const h=this.currentChannel;h&&h>0?this.channels[h].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!r&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Cs([i,s])+" orig: "+Cs([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(n||i))return!1;const s=e===20||e===21||e===23?1:2,r=this.channels[s];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=s,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Cs([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(i||s))return!1;const r=e<=23?1:2;t>=64&&t<=95?n=r===1?kc[e]:Oc[e]:n=r===1?Pc[e]:Fc[e];const o=this.channels[r];return o?(o.setPAC(this.interpretPAC(n,t)),this.currentChannel=r,!0):!1}interpretPAC(e,t){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,i.underline=(n&1)===1,n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((n-16)/2)*4,i}parseChars(e,t){let n,i=null,s=null;if(e>=25?(n=2,s=e-8):(n=1,s=e),s>=17&&s<=19){let r;s===17?r=t+80:s===18?r=t+112:r=t+144,this.logger.log(2,()=>"Special char '"+Bo(r)+"' in channel "+n),i=[r]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+Cs(i).join(",")),i}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(n||i))return!1;let s;const r={};e===16||e===24?(s=Math.floor((t-32)/2),r.background=Mc[s],t%2===1&&(r.background=r.background+"_semi")):t===45?r.background="transparent":(r.foreground="black",t===47&&(r.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(r),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Br(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function Br(a,e,t){t.a=a,t.b=e}function $c(a,e,t){return t.a===a&&t.b===e}function Kc(){return{a:null,b:null}}var Ta=function(){if(Qi!=null&&Qi.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,c){if(typeof c!="string"||!Array.isArray(o))return!1;const u=c.toLowerCase();return~o.indexOf(u)?u:!1}function n(o){return t(a,o)}function i(o){return t(e,o)}function s(o,...c){let u=1;for(;u<arguments.length;u++){const h=arguments[u];for(const f in h)o[f]=h[f]}return o}function r(o,c,u){const h=this,f={enumerable:!0};h.hasBeenReset=!1;let d="",E=!1,b=o,R=c,T=u,V=null,se="",te=!0,Se="auto",Fe="start",Ye=50,Re="middle",Ue=50,Ge="middle";Object.defineProperty(h,"id",s({},f,{get:function(){return d},set:function(Ie){d=""+Ie}})),Object.defineProperty(h,"pauseOnExit",s({},f,{get:function(){return E},set:function(Ie){E=!!Ie}})),Object.defineProperty(h,"startTime",s({},f,{get:function(){return b},set:function(Ie){if(typeof Ie!="number")throw new TypeError("Start time must be set to a number.");b=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",s({},f,{get:function(){return R},set:function(Ie){if(typeof Ie!="number")throw new TypeError("End time must be set to a number.");R=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",s({},f,{get:function(){return T},set:function(Ie){T=""+Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",s({},f,{get:function(){return V},set:function(Ie){V=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",s({},f,{get:function(){return se},set:function(Ie){const it=n(Ie);if(it===!1)throw new SyntaxError("An invalid or illegal string was specified.");se=it,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",s({},f,{get:function(){return te},set:function(Ie){te=!!Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",s({},f,{get:function(){return Se},set:function(Ie){if(typeof Ie!="number"&&Ie!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Se=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",s({},f,{get:function(){return Fe},set:function(Ie){const it=i(Ie);if(!it)throw new SyntaxError("An invalid or illegal string was specified.");Fe=it,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",s({},f,{get:function(){return Ye},set:function(Ie){if(Ie<0||Ie>100)throw new Error("Position must be between 0 and 100.");Ye=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",s({},f,{get:function(){return Re},set:function(Ie){const it=i(Ie);if(!it)throw new SyntaxError("An invalid or illegal string was specified.");Re=it,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",s({},f,{get:function(){return Ue},set:function(Ie){if(Ie<0||Ie>100)throw new Error("Size must be between 0 and 100.");Ue=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",s({},f,{get:function(){return Ge},set:function(Ie){const it=i(Ie);if(!it)throw new SyntaxError("An invalid or illegal string was specified.");Ge=it,this.hasBeenReset=!0}})),h.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class Gc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Go(a){function e(n,i,s,r){return(n|0)*3600+(i|0)*60+(s|0)+parseFloat(r||0)}const t=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class zc{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let i=0;i<n.length;++i)if(t===n[i]){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 n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function zo(a,e,t,n){const i=n?a.split(n):[a];for(const s in i){if(typeof i[s]!="string")continue;const r=i[s].split(t);if(r.length!==2)continue;const o=r[0],c=r[1];e(o,c)}}const wa=new Ta(0,0,""),Ur=wa.align==="middle"?"middle":"center";function Vc(a,e,t){const n=a;function i(){const o=Go(a);if(o===null)throw new Error("Malformed timestamp: "+n);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,c){const u=new zc;zo(o,function(d,E){let b;switch(d){case"region":for(let R=t.length-1;R>=0;R--)if(t[R].id===E){u.set(d,t[R].region);break}break;case"vertical":u.alt(d,E,["rl","lr"]);break;case"line":b=E.split(","),u.integer(d,b[0]),u.percent(d,b[0])&&u.set("snapToLines",!1),u.alt(d,b[0],["auto"]),b.length===2&&u.alt("lineAlign",b[1],["start",Ur,"end"]);break;case"position":b=E.split(","),u.percent(d,b[0]),b.length===2&&u.alt("positionAlign",b[1],["start",Ur,"end","line-left","line-right","auto"]);break;case"size":u.percent(d,E);break;case"align":u.alt(d,E,["start",Ur,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let h=u.get("line","auto");h==="auto"&&wa.line===-1&&(h=-1),c.line=h,c.lineAlign=u.get("lineAlign","start"),c.snapToLines=u.get("snapToLines",!0),c.size=u.get("size",100),c.align=u.get("align",Ur);let f=u.get("position","auto");f==="auto"&&wa.position===50&&(f=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=f}function r(){a=a.replace(/^\s+/,"")}if(r(),e.startTime=i(),r(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);a=a.slice(3),r(),e.endTime=i(),r(),s(a,e)}function Vo(a){return a.replace(/<br(?: \/)?>/gi,`
`)}class Wc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Gc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function n(){let s=t.buffer,r=0;for(s=Vo(s);r<s.length&&s[r]!=="\r"&&s[r]!==`
`;)++r;const o=s.slice(0,r);return s[r]==="\r"&&++r,s[r]===`
`&&++r,t.buffer=s.slice(r),o}function i(s){zo(s,function(r,o){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=n();const o=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let r=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(r?r=!1:s=n(),t.state){case"HEADER":/:/.test(s)?i(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new Ta(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Vc(s,t.cue,t.regionList)}catch(o){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=s.indexOf("-->")!==-1;if(!s||o&&(r=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
`),t.cue.text+=s}continue;case"BADCUE":s||(t.state="ID")}}}catch(s){t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const jc=/\r\n|\n\r|\n|\r/g,Aa=function(e,t,n=0){return e.slice(n,n+t.length)===t},Hc=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!N(t)||!N(n)||!N(i)||!N(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*i,t+=60*60*1e3*s,t};function Da(a,e,t){return lr(a.toString())+lr(e.toString())+lr(t)}const Zc=function(e,t,n){let i=e[t],s=e[i.prevCC];if(!s||!s.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(r=s)!=null&&r.new;){var r;e.ccOffset+=i.start-s.start,i.new=!1,i=s,s=e[i.prevCC]}e.presentationOffset=n};function Yc(a,e,t,n,i,s,r){const o=new Wc,c=ze(new Uint8Array(a)).trim().replace(jc,`
`).split(`
`),u=[],h=e?ru(e.baseTime,e.timescale):0;let f="00:00.000",d=0,E=0,b,R=!0;o.oncue=function(T){const V=t[n];let se=t.ccOffset;const te=(d-h)/9e4;if(V!=null&&V.new&&(E!==void 0?se=t.ccOffset=V.start:Zc(t,n,te)),te){if(!e){b=new Error("Missing initPTS for VTT MPEGTS");return}se=te-t.presentationOffset}const Se=T.endTime-T.startTime,Fe=ji((T.startTime+se-E)*9e4,i*9e4)/9e4;T.startTime=Math.max(Fe,0),T.endTime=Math.max(Fe+Se,0);const Ye=T.text.trim();T.text=decodeURIComponent(encodeURIComponent(Ye)),T.id||(T.id=Da(T.startTime,T.endTime,Ye)),T.endTime>0&&u.push(T)},o.onparsingerror=function(T){b=T},o.onflush=function(){if(b){r(b);return}s(u)},c.forEach(T=>{if(R)if(Aa(T,"X-TIMESTAMP-MAP=")){R=!1,T.slice(16).split(",").forEach(V=>{Aa(V,"LOCAL:")?f=V.slice(6):Aa(V,"MPEGTS:")&&(d=parseInt(V.slice(7)))});try{E=Hc(f)/1e3}catch(V){b=V}return}else T===""&&(R=!1);o.parse(T+`
`)}),o.flush()}const Ra="stpp.ttml.im1t",Wo=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,jo=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,qc={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ho(a,e,t,n){const i=Y(new Uint8Array(a),["mdat"]);if(i.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const s=i.map(o=>ze(o)),r=su(e.baseTime,1,e.timescale);try{s.forEach(o=>t(Xc(o,r)))}catch(o){n(o)}}function Xc(a,e){const i=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(s).reduce((f,d)=>(f[d]=i.getAttribute(`ttp:${d}`)||s[d],f),{}),o=i.getAttribute("xml:space")!=="preserve",c=Zo(Ia(i,"styling","style")),u=Zo(Ia(i,"layout","region")),h=Ia(i,"body","[begin]");return[].map.call(h,f=>{const d=Yo(f,o);if(!d||!f.hasAttribute("begin"))return null;const E=Ca(f.getAttribute("begin"),r),b=Ca(f.getAttribute("dur"),r);let R=Ca(f.getAttribute("end"),r);if(E===null)throw qo(f);if(R===null){if(b===null)throw qo(f);R=E+b}const T=new Ta(E-e,R-e,d);T.id=Da(T.startTime,T.endTime,T.text);const V=u[f.getAttribute("region")],se=c[f.getAttribute("style")],te=Qc(V,se,c),{textAlign:Se}=te;if(Se){const Fe=qc[Se];Fe&&(T.lineAlign=Fe),T.align=Se}return p(T,te),T}).filter(f=>f!==null)}function Ia(a,e,t){const n=a.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function Zo(a){return a.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function Yo(a,e){return[].slice.call(a.childNodes).reduce((t,n,i)=>{var s;return n.nodeName==="br"&&i?t+`
`:(s=n.childNodes)!=null&&s.length?Yo(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function Qc(a,e,t){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return r&&t.hasOwnProperty(r)&&(i=t[r]),s.reduce((o,c)=>{const u=La(e,n,c)||La(a,n,c)||La(i,n,c);return u&&(o[c]=u),o},{})}function La(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function qo(a){return new Error(`Could not parse ttml timestamp ${a}`)}function Ca(a,e){if(!a)return null;let t=Go(a);return t===null&&(Wo.test(a)?t=Jc(a,e):jo.test(a)&&(t=eh(a,e))),t}function Jc(a,e){const t=Wo.exec(a),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function eh(a,e){const t=jo.exec(a),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class $r{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class th{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Jo(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this),e.on(g.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(g.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(g.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this),e.off(g.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(g.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(g.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new $r(this,"textTrack1"),t=new $r(this,"textTrack2"),n=new $r(this,"textTrack3"),i=new $r(this,"textTrack4");this.cea608Parser1=new Ko(1,e,t),this.cea608Parser2=new Ko(3,n,i)}addCues(e,t,n,i,s){let r=!1;for(let o=s.length;o--;){const c=s[o],u=nh(c[0],c[1],t,n);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],n),r=!0,u/(n-t)>.5))return}if(r||s.push([t,n]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,n,i)}else{const o=this.Cues.newCue(null,t,n,i);this.hls.trigger(g.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s,trackId:r}){const{unparsedVttFrags:o}=this;n===ee.MAIN&&(this.initPTS[t.cc]={baseTime:i,timescale:s,trackId:r}),o.length&&(this.unparsedVttFrags=[],o.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded(g.FRAG_LOADED,c):this.hls.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const s=n.textTracks[i];if(Qo(s,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:i}=this,{label:s,languageCode:r}=t[e],o=this.getExistingTrack(s,r);if(o)n[e]=o,Ws(n[e]),ko(n[e],i);else{const c=this.createTextTrack("captions",s,r);c&&(c[e]=!0,n[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,i={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(g.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,n){const i=this.media;if(i)return i.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const n=!!t.transferMedia;if(this.media=null,n)return;const{captionsTracks:i}=this;Object.keys(i).forEach(s=>{Ws(i[s]),delete i[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Jo(),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 n=0;n<t.length;n++)Ws(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some(s=>s.textCodec===Ra);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(ho(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const r=this.media,o=r?Fr(r.textTracks):null;if(this.tracks.forEach((c,u)=>{let h;if(o){let f=null;for(let d=0;d<o.length;d++)if(o[d]&&Qo(o[d],c)){f=o[d],o[d]=null;break}f&&(h=f)}if(h)Ws(h);else{const f=Xo(c);h=this.createTextTrack(f,c.name,c.lang),h&&(h.mode="disabled")}h&&this.textTracks.push(h)}),o!=null&&o.length){const c=o.filter(u=>u!==null).map(u=>u.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const r=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(g.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const i=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!i)return;const s=`textTrack${i[1]}`,r=this.captionsProperties[s];r&&(r.label=n.name,n.lang&&(r.languageCode=n.lang),r.media=n)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===ee.MAIN){var n,i;const{cea608Parser1:s,cea608Parser2:r,lastSn:o}=this,{cc:c,sn:u}=t.frag,h=(n=(i=t.part)==null?void 0:i.index)!=null?n:-1;s&&r&&(u!==o+1||u===o&&h!==this.lastPartIndex+1||c!==this.lastCc)&&(s.reset(),r.reset()),this.lastCc=c,this.lastSn=u,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:n,payload:i}=t;if(n.type===ee.SUBTITLE)if(i.byteLength){const s=n.decryptdata,r="stats"in t;if(s==null||!s.encrypted||r){const o=this.tracks[n.level],c=this.vttCCs;c[n.cc]||(c[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),o&&o.textCodec===Ra?this._parseIMSC1(n,i):this._parseVTTs(t)}}else this.hls.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;Ho(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),n.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{n.logger.log(`Failed to parse IMSC1: ${i}`),n.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:n,payload:i}=e,{initPTS:s,unparsedVttFrags:r}=this,o=s.length-1;if(!s[n.cc]&&o===-1){r.push(e);return}const c=this.hls,u=(t=n.initSegment)!=null&&t.data?Ve(n.initSegment.data,new Uint8Array(i)).buffer:i;Yc(u,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,h=>{this._appendCues(h,n.level),c.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},h=>{const f=h.message==="Missing initPTS for VTT MPEGTS";f?r.push(e):this._fallbackToIMSC1(n,i),c.logger.log(`Failed to parse VTT cue: ${h}`),!(f&&o>n.cc)&&c.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:h})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||Ho(t,this.initPTS[e.cc],()=>{n.textCodec=Ra,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(s=>Po(i,s))}else{const i=this.tracks[t];if(!i)return;const s=i.default?"default":"subtitles"+t;n.trigger(g.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===ee.SUBTITLE&&this.onFragLoaded(g.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:i}=t;if(!(n.type===ee.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let s=0;s<i.length;s++){const r=i[s].bytes;if(r){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(r);this.cea608Parser1.addData(i[s].pts,o[0]),this.cea608Parser2.addData(i[s].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:i,type:s}){const{media:r}=this;if(!(!r||r.currentTime<n)){if(!s||s==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(c=>Ea(o[c],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>Ea(o[c],t,i))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let i=2;for(let s=0;s<n;s++){const r=e[i++],o=127&e[i++],c=127&e[i++];if(o===0&&c===0)continue;if((4&r)!==0){const h=3&r;(h===0||h===1)&&(t[h].push(o),t[h].push(c))}}return t}}function Xo(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Qo(a,e){return!!a&&a.kind===Xo(e)&&fa(e,a)}function nh(a,e,t,n){return Math.min(e,n)-Math.max(a,t)}function Jo(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const ih=/\s/,sh={newCue(a,e,t,n){const i=[];let s,r,o,c,u;const h=self.VTTCue||self.TextTrackCue;for(let d=0;d<n.rows.length;d++)if(s=n.rows[d],o=!0,c=0,u="",!s.isEmpty()){var f;for(let R=0;R<s.chars.length;R++)ih.test(s.chars[R].uchar)&&o?c++:(u+=s.chars[R].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const E=Vo(u.trim()),b=Da(e,t,E);a!=null&&(f=a.cues)!=null&&f.getCueById(b)||(r=new h(e,t,E),r.id=b,r.line=d+1,r.align="left",r.position=10+Math.min(80,Math.floor(c*8/32)*10),i.push(r))}return a&&i.length&&(i.sort((d,E)=>d.line==="auto"||E.line==="auto"?0:d.line>8&&E.line>8?E.line-d.line:d.line-E.line),i.forEach(d=>Po(a,d))),i}};function rh(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const ah=/(\d+)-(\d+)\/(\d+)/;class el{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||ch,this.controller=new self.AbortController,this.stats=new v}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,n){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const s=oh(e,this.controller.signal),r=e.responseType==="arraybuffer",o=r?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=c&&N(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},t.timeout),(ar(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var d;this.response=this.loader=f;const E=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},u-(E-i.loading.start)),!f.ok){const{status:R,statusText:T}=f;throw new hh(T||"fetch, bad network response",R,f)}i.loading.first=E,i.total=uh(f.headers)||i.total;const b=(d=this.callbacks)==null?void 0:d.onProgress;return b&&N(t.highWaterMark)?this.loadProgressively(f,i,e,t.highWaterMark,b):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var d,E;const b=this.response;if(!b)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const R=f[o];R&&(i.loaded=i.total=R);const T={url:b.url,data:f,code:b.status},V=(d=this.callbacks)==null?void 0:d.onProgress;V&&!N(t.highWaterMark)&&V(i,e,f,b),(E=this.callbacks)==null||E.onSuccess(T,i,e,b)}).catch(f=>{var d;if(self.clearTimeout(this.requestTimeout),i.aborted)return;const E=f&&f.code||0,b=f?f.message:null;(d=this.callbacks)==null||d.onError({code:E,text:b},e,f?f.details:null,i)})}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,n,i=0,s){const r=new Tr,o=e.body.getReader(),c=()=>o.read().then(u=>{if(u.done)return r.dataLength&&s(t,n,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const h=u.value,f=h.length;return t.loaded+=f,f<i||r.dataLength?(r.push(h),r.dataLength>=i&&s(t,n,r.flush().buffer,e)):s(t,n,h.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function oh(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(p({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function lh(a){const e=ah.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function uh(a){const e=a.get("Content-Range");if(e){const n=lh(e);if(N(n))return n}const t=a.get("Content-Length");if(t)return parseInt(t)}function ch(a,e){return new self.Request(a.url,e)}class hh extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const fh=/^age:\s*[\d.]+\s*$/im;class tl{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 v,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,n){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=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return s(n,t.url)}).catch(r=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),s(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(r=>{var o;(o=this.callbacks)==null||o.onError({code:n.status,text:r.message},t,n,i)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:r}=n.loadPolicy;if(i)for(const o in i)e.setRequestHeader(o,i[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),n.timeout=s&&N(s)?s:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const i=t.readyState,s=this.config;if(!n.aborted&&i>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const u=t.status,h=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const b=h!=null?h:t.response;if(b!=null){var r,o;n.loading.end=Math.max(self.performance.now(),n.loading.first);const R=t.responseType==="arraybuffer"?b.byteLength:b.length;n.loaded=n.total=R,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);const T=(r=this.callbacks)==null?void 0:r.onProgress;T&&T(n,e,b,t);const V={url:t.responseURL,data:b,code:u};(o=this.callbacks)==null||o.onSuccess(V,n,e,t);return}}const f=s.loadPolicy.errorRetry,d=n.retry,E={url:e.url,data:void 0,code:u};if(yn(f,d,!1,E))this.retry(f);else{var c;X.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(yn(e,t,!0))this.retry(e);else{var n;X.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=Rn(e,n.retry),n.retry++,X.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&fh.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const dh={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},ph=y(y({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:tl,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Jt,bufferController:Eu,capLevelController:pa,errorController:Yn,fpsController:_c,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:On,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:dh},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},gh()),{},{subtitleStreamController:Ic,subtitleTrackController:Ec,timelineController:th,audioStreamController:mu,audioTrackController:_u,emeController:Vs,cmcdController:pc,contentSteeringController:mc,interstitialsController:Rc});function gh(){return{cueHandler:sh,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function mh(a,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const n=ka(a),i=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(r=>{const o=`${r==="level"?"playlist":r}LoadPolicy`,c=e[o]===void 0,u=[];s.forEach(h=>{const f=`${r}Loading${h}`,d=e[f];if(d!==void 0&&c){u.push(f);const E=n[o].default;switch(e[o]={default:E},h){case"TimeOut":E.maxLoadTimeMs=d,E.maxTimeToFirstByteMs=d;break;case"MaxRetry":E.errorRetry.maxNumRetry=d,E.timeoutRetry.maxNumRetry=d;break;case"RetryDelay":E.errorRetry.retryDelayMs=d,E.timeoutRetry.retryDelayMs=d;break;case"MaxRetryTimeout":E.errorRetry.maxRetryDelayMs=d,E.timeoutRetry.maxRetryDelayMs=d;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${Vt(e[o])}`)}),y(y({},n),e)}function ka(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(ka):Object.keys(a).reduce((e,t)=>(e[t]=ka(a[t]),e),{}):a}function _h(a,e){const t=a.loader;t!==el&&t!==tl?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):rh()&&(a.loader=el,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Kr=2,vh=.1,yh=.05,Eh=100;class bh extends Oi{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 n;(n=this.media)!=null&&n.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var n;this.ended=((n=this.media)==null?void 0:n.currentTime)||1,this.hls.trigger(g.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Eh),this.mediaSource=t.mediaSource;const n=this.media=t.media;pi(n,"playing",this.onMediaPlaying),pi(n,"waiting",this.onMediaWaiting),pi(n,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:n}=this;n&&(Si(n,"playing",this.onMediaPlaying),Si(n,"waiting",this.onMediaWaiting),Si(n,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var n,i;const s=(n=this.hls)==null?void 0:n.config;if(!s)return;const r=this.media;if(!r)return;const{seeking:o}=r,c=this.seeking&&!o,u=!this.seeking&&o,h=r.paused&&!o||r.ended||r.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!h&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(u||c){c&&this.stallResolved(e);return}if(h){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(g.MEDIA_ENDED,{stalled:!1}));return}if(!Zt.getBuffered(r).length){this.nudgeRetry=0;return}const f=Zt.bufferInfo(r,e,0),d=f.nextStart||0,E=this.fragmentTracker;if(o&&E&&this.hls){const Ye=nl(this.hls.inFlightFragments,e),Re=f.len>Kr,Ue=!d||Ye||d-e>Kr&&!E.getPartialFragment(e);if(Re||Ue)return;this.moved=!1}const b=(i=this.hls)==null?void 0:i.latestLevelDetails;if(!this.moved&&this.stalled!==null&&E){if(!(f.len>0)&&!d)return;const Re=Math.max(d,f.start||0)-e,Ge=!!(b!=null&&b.live)?b.targetduration*2:Kr,Ie=Gr(e,E);if(Re>0&&(Re<=Ge||Ie)){r.paused||this._trySkipBufferHole(Ie);return}}const R=s.detectStallWithCurrentTimeMs,T=self.performance.now(),V=this.waiting;let se=this.stalled;if(se===null)if(V>0&&T-V<R)se=this.stalled=V;else{this.stalled=T;return}const te=T-se;if(!o&&(te>=R||V)&&this.hls){var Se;if(((Se=this.mediaSource)==null?void 0:Se.readyState)==="ended"&&!(b!=null&&b.live)&&Math.abs(e-((b==null?void 0:b.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(g.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(f),!this.media||!this.hls)return}const Fe=Zt.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(Fe,te,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(g.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var n;const i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&i&&i.length>1&&e>i.end(0)){const s=Zt.bufferedInfo(Zt.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=Zt.timeRangesToArray(i),o=Zt.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=Zt.bufferedInfo(r,e,0).bufferedIndex,u=r[o].end,h=r[o+1].start;if((c===-1||c>o)&&h-u<1&&e-u<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${h} buffered index: ${c}`);this.warn(f.message),this.media.currentTime+=1e-6;let d=Gr(e,this.fragmentTracker);d&&"fragment"in d?d=d.fragment:d||(d=void 0);const E=Zt.bufferInfo(this.media,e,0);this.hls.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:d,buffer:E.len,bufferInfo:E})}}}}}_tryFixBufferStall(e,t,n){var i,s;const{fragmentTracker:r,media:o}=this,c=(i=this.hls)==null?void 0:i.config;if(!o||!r||!c)return;const u=(s=this.hls)==null?void 0:s.latestLevelDetails,h=Gr(n,r);if((h||u!=null&&u.live&&n<u.fragmentStart)&&(this._trySkipBufferHole(h)||!this.media))return;const f=e.buffered,d=this.adjacentTraversal(e,n);(f&&f.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-n<c.maxBufferHole||d))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const n=this.fragmentTracker,i=e.nextStart;if(n&&i){const s=n.getFragAtPos(t,ee.MAIN),r=n.getFragAtPos(i,ee.MAIN);if(s&&r)return r.sn-s.sn<2}return!1}_reportStall(e){const{hls:t,media:n,stallReported:i,stalled:s}=this;if(!i&&s!==null&&n&&t){this.stallReported=!0;const r=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${Vt(e)})`);this.warn(r.message),t.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:n,media:i}=this,s=(t=this.hls)==null?void 0:t.config;if(!i||!n||!s)return 0;const r=i.currentTime,o=Zt.bufferInfo(i,r,0),c=r<o.start?o.start:o.nextStart;if(c&&this.hls){const h=o.len<=s.maxBufferHole,f=o.len>0&&o.len<1&&i.readyState<3,d=c-r;if(d>0&&(h||f)){if(d>s.maxBufferHole){let b=!1;if(r===0){const R=n.getAppendedFrag(0,ee.MAIN);R&&c<R.end&&(b=!0)}if(!b&&e){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||nl(this.hls.inFlightFragments,c))return 0;let T=!1,V=e.end;for(;V<c;){const se=Gr(V,n);if(se)V+=se.duration;else{T=!0;break}}if(T)return 0}}const E=Math.max(c+yh,r+vh);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${E}`),this.moved=!0,i.currentTime=E,!(e!=null&&e.gap)){const b=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${E}`),R={type:ne.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:b,reason:b.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?R.part=e:R.frag=e),this.hls.trigger(g.ERROR,R)}return E}}return 0}_tryNudgeBuffer(e){const{hls:t,media:n,nudgeRetry:i}=this,s=t==null?void 0:t.config;if(!n||!s)return 0;const r=n.currentTime;if(this.nudgeRetry++,i<s.nudgeMaxRetry){const o=r+(i+1)*s.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${r} to ${o}`);this.warn(c.message),n.currentTime=o,t.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${r} after ${s.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function nl(a,e){const t=il(a.main);if(t&&t.start<=e)return t;const n=il(a.audio);return n&&n.start<=e?n:null}function il(a){if(!a)return null;switch(a.state){case tt.IDLE:case tt.STOPPED:case tt.ENDED:case tt.ERROR:return null}return a.frag}function Gr(a,e){return e.getAppendedFrag(a,ee.MAIN)||e.getPartialFragment(a)}const xh=.25;function Pa(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Oa(a,e,t,n,i){let s=new a(e,t,"");try{s.value=n,i&&(s.type=i)}catch(r){s=new a(e,t,Vt(i?y({type:i},n):n))}return s}const zr=(()=>{const a=Pa();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Sh{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(g.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var n;this.media=t.media,((n=t.overrides)==null?void 0:n.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Ws(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 n=e[t];if(n.kind==="metadata"&&n.label==="id3")return ko(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:n,enableID3MetadataCues:i}=this.hls.config;if(!n&&!i)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=Pa();if(r)for(let o=0;o<s.length;o++){const c=s[o].type;if(c===Ui.emsg&&!n||!i)continue;const u=ja(s[o].data),h=s[o].pts;let f=h+s[o].duration;f>zr&&(f=zr),f-h<=0&&(f=h+xh);for(let E=0;E<u.length;E++){const b=u[E];if(!Ha(b)){this.updateId3CueEnds(h,c);const R=Oa(r,h,f,b,c);R&&this.id3Track.addCue(R)}}}}updateId3CueEnds(e,t){var n;const i=(n=this.id3Track)==null?void 0:n.cues;if(i)for(let s=i.length;s--;){const r=i[s];r.type===t&&r.startTime<e&&r.endTime===zr&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:i}){const{id3Track:s,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=r;if(s&&(o||c)){let u;i==="audio"?u=h=>h.type===Ui.audioId3&&c:i==="video"?u=h=>h.type===Ui.emsg&&o:u=h=>h.type===Ui.audioId3&&c||h.type===Ui.emsg&&o,Ea(s,t,n,u)}}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:n,timelineOffset:i,enableDateRangeMetadataCues:s,interstitialsController:r}=this.hls.config;if(!s)return;const o=Pa();if(n&&i&&!r){const{fragmentStart:R,fragmentEnd:T}=e;let V=this.assetCue;V?(V.startTime=R,V.endTime=T):o&&(V=this.assetCue=Oa(o,R,T,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),V&&(V.id=n,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(V),V.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:c}=this,{dateRanges:u}=e,h=Object.keys(u);let f=this.dateRangeCuesAppended;if(c&&t){var d;if((d=c.cues)!=null&&d.length){const R=Object.keys(f).filter(T=>!h.includes(T));for(let T=R.length;T--;){var E;const V=R[T],se=(E=f[V])==null?void 0:E.cues;delete f[V],se&&Object.keys(se).forEach(te=>{const Se=se[te];if(Se){Se.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(Se)}catch(Fe){}}})}}else f=this.dateRangeCuesAppended={}}const b=e.fragments[e.fragments.length-1];if(!(h.length===0||!N(b==null?void 0:b.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let R=0;R<h.length;R++){const T=h[R],V=u[T],se=V.startTime,te=f[T],Se=(te==null?void 0:te.cues)||{};let Fe=(te==null?void 0:te.durationKnown)||!1,Ye=zr;const{duration:Re,endDate:Ue}=V;if(Ue&&Re!==null)Ye=se+Re,Fe=!0;else if(V.endOnNext&&!Fe){const Ie=h.reduce((it,It)=>{if(It!==V.id){const Mt=u[It];if(Mt.class===V.class&&Mt.startDate>V.startDate&&(!it||V.startDate<it.startDate))return Mt}return it},null);Ie&&(Ye=Ie.startTime,Fe=!0)}const Ge=Object.keys(V.attr);for(let Ie=0;Ie<Ge.length;Ie++){const it=Ge[Ie];if(!gs(it))continue;const It=Se[it];if(It)Fe&&!(te!=null&&te.durationKnown)?It.endTime=Ye:Math.abs(It.startTime-se)>.01&&(It.startTime=se,It.endTime=Ye);else if(o){let Mt=V.attr[it];Yi(it)&&(Mt=S(Mt));const Nt=Oa(o,se,Ye,{key:it,data:Mt},Ui.dateRange);Nt&&(Nt.id=T,this.id3Track.addCue(Nt),Se[it]=Nt,r&&(it==="X-ASSET-LIST"||it==="X-ASSET-URL")&&Nt.addEventListener("enter",this.onEventCueEnter))}}f[T]={cues:Se,dateRange:V,durationKnown:Fe}}}}}class Th{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,n=this.levelDetails;if(!t||!n)return;this.currentTime=t.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||r===1||!n.live)return;const o=this.targetLatency;if(o===null)return;const c=i-o,u=Math.min(this.maxLatency,o+n.targetduration);if(c<u&&c>.05&&this.forwardBufferLength>1){const f=Math.min(2,Math.max(1,r)),d=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,E=Math.min(f,Math.max(1,d));this.changeMediaPlaybackRate(t,E)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:n,targetduration:i}=e,{liveSyncDuration:s,liveSyncDurationCount:r,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let u=o&&n||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=s!==void 0?s:r*i);const h=i;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,h)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const n=this.levelDetails;if(n===null)return null;const i=n.edge,s=e-t-this.edgeStalled,r=i-n.totalduration,o=i-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(r,s),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var n;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var n,i;e.playbackRate!==t&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(i=this.targetLatency)==null?void 0:i.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class wh extends ha{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const n=this.hls.config.preferManagedMediaSource,i=[],s={},r={};let o=!1,c=!1,u=!1;t.levels.forEach(h=>{const f=h.attrs;let{audioCodec:d,videoCodec:E}=h;d&&(h.audioCodec=d=Q(d,n)||void 0),E&&(E=h.videoCodec=lt(E));const{width:b,height:R,unknownCodecs:T}=h;let V=T?T.length:0;if(T)for(let Ie=V;Ie--;){const it=T[Ie];this.isAudioSupported(it)?(h.audioCodec=d=d?`${d},${it}`:it,V--,mt.audio[d.substring(0,4)]=2):this.isVideoSupported(it)&&(h.videoCodec=E=E?`${E},${it}`:it,V--,mt.video[E.substring(0,4)]=2)}if(o||(o=!!(b&&R)),c||(c=!!E),u||(u=!!d),V||d&&!this.isAudioSupported(d)||E&&!this.isVideoSupported(E)){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}const{CODECS:se,"FRAME-RATE":te,"HDCP-LEVEL":Se,"PATHWAY-ID":Fe,RESOLUTION:Ye,"VIDEO-RANGE":Re}=f,Ge=`${`${Fe||"."}-`}${h.bitrate}-${Ye}-${te}-${se}-${Re}-${Se}`;if(s[Ge])if(s[Ge].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const Ie=r[Ge]+=1;h.attrs["PATHWAY-ID"]=new Array(Ie+1).join(".");const it=this.createLevel(h);s[Ge]=it,i.push(it)}else s[Ge].addGroupId("audio",f.AUDIO),s[Ge].addGroupId("text",f.SUBTITLES);else{const Ie=this.createLevel(h);s[Ge]=Ie,r[Ge]=1,i.push(Ie)}}),this.filterAndSortMediaOptions(i,t,o,c,u)}createLevel(e){const t=new Bn(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){const i=new Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(i.message),t.supportedResult=vn(i,[])}return t}isAudioSupported(e){return Pt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Pt(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,n,i,s){let r=[],o=[],c=e;if((n||i)&&s&&(c=c.filter(({videoCodec:T,videoRange:V,width:se,height:te})=>(!!T||!!(se&&te))&&Qn(V))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let T="no level with compatible codecs found in manifest",V=T;t.levels.length&&(V=`one or more CODECS in variant not supported: ${Vt(t.levels.map(te=>te.attrs.CODECS).filter((te,Se,Fe)=>Fe.indexOf(te)===Se))}`,this.warn(V),T+=` (${V})`);const se=new Error(T);this.hls.trigger(g.ERROR,{type:ne.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:se,reason:V})}});return}t.audioTracks&&(r=t.audioTracks.filter(T=>!T.audioCodec||this.isAudioSupported(T.audioCodec)),sl(r)),t.subtitles&&(o=t.subtitles,sl(o));const u=c.slice(0);c.sort((T,V)=>{if(T.attrs["HDCP-LEVEL"]!==V.attrs["HDCP-LEVEL"])return(T.attrs["HDCP-LEVEL"]||"")>(V.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&T.height!==V.height)return T.height-V.height;if(T.frameRate!==V.frameRate)return T.frameRate-V.frameRate;if(T.videoRange!==V.videoRange)return ti.indexOf(T.videoRange)-ti.indexOf(V.videoRange);if(T.videoCodec!==V.videoCodec){const se=Ee(T.videoCodec),te=Ee(V.videoCodec);if(se!==te)return te-se}if(T.uri===V.uri&&T.codecSet!==V.codecSet){const se=pe(T.codecSet),te=pe(V.codecSet);if(se!==te)return te-se}return T.averageBitrate!==V.averageBitrate?T.averageBitrate-V.averageBitrate:0});let h=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let T=0;T<u.length;T++)if(u[T].pathwayId===c[0].pathwayId){h=u[T];break}}this._levels=c;for(let T=0;T<c.length;T++)if(c[T]===h){var f;this._firstLevel=T;const V=h.bitrate,se=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${V}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const te=Math.min(V,this.hls.config.abrEwmaDefaultEstimateMax);te>se&&se===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=te)}break}const d=s&&!i,E=this.hls.config,b=!!(E.audioStreamController&&E.audioTrackController),R={levels:c,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:i,altAudio:b&&!d&&r.some(T=>!!T.url)};this.hls.trigger(g.MANIFEST_PARSED,R)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(g.ERROR,{type:ne.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:h,reason:h.message}),f)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,r=t[e],o=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,n===e&&i&&s===o)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${o?" with Pathway "+o:""} from level ${n}${s?" with Pathway "+s:""}`);const c={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(g.LEVEL_SWITCHING,c);const u=r.details;if(!u||u.live){const h=this.switchParams(r.uri,i==null?void 0:i.details,u);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),n=e.filter(i=>t.indexOf(i)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=n}}onError(e,t){t.fatal||!t.context||t.context.type===ue.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ee.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(s=>!!n[s]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var n;const{level:i,details:s}=t,r=t.levelInfo;if(!r){var o;this.warn(`Invalid level index ${i}`),(o=t.deliveryDirectives)!=null&&o.skip&&(s.deltaUpdateFailed=!0);return}if(r===this.currentLevel||t.withoutMultiVariant){r.fragmentError===0&&(r.loadError=0);let c=r.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(i,t,c)}else(n=t.deliveryDirectives)!=null&&n.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=this.getUrlWithDirectives(e.uri,t),i=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],r=e.details,o=r==null?void 0:r.age;this.log(`Loading level index ${i}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${s?" Pathway "+s:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${n}`),this.hls.trigger(g.LEVEL_LOADING,{url:n,level:i,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const n=this._levels.filter((s,r)=>r!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(o=>o.level=-1)),!1));br(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const i=n.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(g.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(g.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function sl(a){const e={};a.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}function rl(){return self.SourceBuffer||self.WebKitSourceBuffer}function al(){if(!oe())return!1;const e=rl();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Ah(){if(!al())return!1;const a=oe();return typeof(a==null?void 0:a.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>a.isTypeSupported(bt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(bt(e,"audio"))))}function Dh(){var a;const e=rl();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Rh=100;class Ih extends Es{constructor(e,t,n){super(e,t,n,"stream-controller",ee.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const i=this.media,s=i?i.currentTime:null;if(s===null||!N(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const r=this.getFwdBufferInfoAtPos(i,s,ee.MAIN,0);if(r===null||r.len===0){this.warn(`Main forward buffer length at ${s} on "seeked" event ${r?r.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:n,hls:i}=this;if(this.stopLoad(),this.setInterval(Rh),this.level=-1,!this.startFragRequested){let s=i.startLevel;s===-1&&(i.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=i.firstAutoLevel),i.nextLoadLevel=s,this.level=i.loadLevel,this._hasEnoughToStart=!!t}n>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=tt.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=tt.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case tt.WAITING_LEVEL:{const{levels:e,level:t}=this,n=e==null?void 0:e[t],i=n==null?void 0:n.details;if(i&&(!i.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(i))break;this.state=tt.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=tt.IDLE;break}break}case tt.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===tt.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:n,media:i}=this;if(t===null||!i&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[s]))return;const r=n[s],o=this.getMainFwdBufferInfo();if(o===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){const R={};this.altAudio===2&&(R.type="video"),this.hls.trigger(g.BUFFER_EOS,R),this.state=tt.ENDED;return}if(!this.buffering)return;e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const u=r.details;if(!u||this.state===tt.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=tt.WAITING_LEVEL,this.startFragRequested=!1;return}const h=o.len,f=this.getMaxBufferLength(r.maxBitrate);if(h>=f)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:o.end;let E=this.getNextFragment(d,u);if(this.couldBacktrack&&!this.fragPrevious&&E&&fe(E)&&this.fragmentTracker.getState(E)!==hn.OK){var b;const T=((b=this.backtrackFragment)!=null?b:E).sn-u.startSN,V=u.fragments[T-1];V&&E.cc===V.cc&&(E=V,this.fragmentTracker.removeFragment(V))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(E&&this.isLoopLoading(E,d)){if(!E.gap){const T=this.audioOnly&&!this.altAudio?D.AUDIO:D.VIDEO,V=(T===D.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;V&&this.afterBufferFlushed(V,T,ee.MAIN)}E=this.getNextFragmentLoopLoading(E,u,o,ee.MAIN,f)}E&&(E.initSegment&&!E.initSegment.data&&!this.bitrateTest&&(E=E.initSegment),this.loadFragment(E,r,d))}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);i===hn.NOT_LOADED||i===hn.PARTIAL?fe(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,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ee.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let n;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<s.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,c=e[o],u=this.fragLastKbps;u&&this.fragCurrent?n=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:n=0}else n=0;const r=this.getBufferedFrag(t.currentTime+n);if(r){const o=this.followingBufferedFrag(r);if(o){this.abortCurrentFrag();const c=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,h=Math.max(r.end,c+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case tt.KEY_LOADING:case tt.FRAG_LOADING:case tt.FRAG_LOADING_WAITING_RETRY:case tt.PARSING:case tt.PARSED:this.state=tt.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const n=t.media;pi(n,"playing",this.onMediaPlaying),pi(n,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:n}=this;n&&(Si(n,"playing",this.onMediaPlaying),Si(n,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(g.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let n=!1,i=!1;for(let s=0;s<t.levels.length;s++){const r=t.levels[s].audioCodec;r&&(n=n||r.indexOf("mp4a.40.2")!==-1,i=i||r.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=n&&i&&!Dh(),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:n}=this;if(!n||this.state!==tt.IDLE)return;const i=t.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=tt.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:i,startFragRequested:s}=this,r=t.level,o=t.details,c=o.totalduration;if(!i){this.warn(`Levels were reset while loading level ${r}`);return}this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${c}`);const u=t.levelInfo,h=this.fragCurrent;h&&(this.state===tt.FRAG_LOADING||this.state===tt.FRAG_LOADING_WAITING_RETRY)&&h.level!==t.level&&h.loader&&this.abortCurrentFrag();let f=0;if(o.live||(n=u.details)!=null&&n.live){var d;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;f=this.alignPlaylists(o,u.details,(d=this.levelLastLoaded)==null?void 0:d.details)}if(u.details=o,this.levelLastLoaded=u,s||this.setStartPosition(o,f),this.hls.trigger(g.LEVEL_UPDATED,{details:o,level:r}),this.state===tt.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=tt.IDLE}s&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,s=this.getLoadPosition(),r=e.fragmentStart,o=e.edge,c=s>=r-t.maxFragLookUpTolerance&&s<=o;if(i!==null&&n.duration>i&&(s<i||!c)){const h=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&n.readyState<4||s<o-h)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),n.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${i.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var u;const f=Zt.bufferInfo(n,i,0);if(!((u=f.buffered)!=null&&u.length)){n.currentTime=i;return}if(f.start<=s){n.currentTime=i;return}const{nextStart:E}=Zt.bufferedInfo(f.buffered,s,0);E&&(n.currentTime=E)}else n.currentTime=i}}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:i,payload:s}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const o=r[n.level];if(!o){this.warn(`Level ${n.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const u=o.videoCodec,h=c.PTSKnown||!c.live,f=(t=n.initSegment)==null?void 0:t.data,d=this._getAudioCodec(o),E=this.transmuxer=this.transmuxer||new uo(this.hls,ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),b=i?i.index:-1,R=b!==-1,T=new ii(n.level,n.sn,n.stats.chunkCount,s.byteLength,b,R),V=this.initPTS[n.cc];E.push(s,f,d,u,n,i,c.totalduration,h,T,V)}onAudioTrackSwitching(e,t){const n=this.hls,i=this.altAudio===2;if(wn(t.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const r=this.fragCurrent;r&&(this.log("Switching to main audio track, cancel main fragment load"),r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(i){this.fragmentTracker.removeAllFragments(),n.once(g.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(g.AUDIO_TRACK_SWITCHED,t)}),n.trigger(g.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}n.trigger(g.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=wn(t.url,this.hls);if(n){const i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){const n=t.tracks;let i,s,r=!1;for(const o in n){const c=n[o];if(c.id==="main"){if(s=o,i=c,o==="video"){const u=n[o];u&&(this.videoBuffer=u.buffer)}}else r=!0}r&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:i}=t,s=n.type===ee.MAIN;if(s){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===tt.PARSED&&(this.state=tt.IDLE);return}const o=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),fe(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}const r=this.media;r&&(!this._hasEnoughToStart&&Zt.getBuffered(r).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var n;if(t.fatal){this.state=tt.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ee.MAIN,t);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===tt.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===ue.LEVEL&&(this.state=tt.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=tt.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==D.AUDIO||!this.altAudio){const n=(t===D.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;n&&(this.afterBufferFlushed(n,t,ee.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const i=this.timelineOffset;i&&n&&(n+=i);const s=this.getLevelDetails(),r=Zt.getBuffered(e),o=r.length?r.start(0):0,c=o-n,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<u||this.loadingParts&&c<2*((s==null?void 0:s.partTarget)||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),n+=c,this.startPosition=n),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${o}`),e.currentTime=n)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(n=>{const{hls:i}=this,s=n==null?void 0:n.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=tt.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const r=s.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),i.trigger(g.FRAG_LOADED,n),s.bitrateTest=!1}).catch(n=>{this.state===tt.STOPPED||this.state===tt.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:n}=this,{remuxResult:i,chunkMeta:s}=e,r=this.getCurrentContext(s);if(!r){this.resetWhenMissingContext(s);return}const{frag:o,part:c,level:u}=r,{video:h,text:f,id3:d,initSegment:E}=i,{details:b}=u,R=this.altAudio?void 0:i.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=tt.PARSING,E){const T=E.tracks;if(T){const Se=o.initSegment||o;if(this.unhandledEncryptionError(E,o))return;this._bufferInitSegment(u,T,Se,s),n.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:Se,id:t,tracks:T})}const V=E.initPTS,se=E.timescale,te=this.initPTS[o.cc];if(N(V)&&(!te||te.baseTime!==V||te.timescale!==se)){const Se=E.trackId;this.initPTS[o.cc]={baseTime:V,timescale:se,trackId:Se},n.trigger(g.INIT_PTS_FOUND,{frag:o,id:t,initPTS:V,timescale:se,trackId:Se})}}if(h&&b){R&&h.type==="audiovideo"&&this.logMuxedErr(o);const T=b.fragments[o.sn-1-b.startSN],V=o.sn===b.startSN,se=!T||o.cc>T.cc;if(i.independent!==!1){const{startPTS:te,endPTS:Se,startDTS:Fe,endDTS:Ye}=h;if(c)c.elementaryStreams[h.type]={startPTS:te,endPTS:Se,startDTS:Fe,endDTS:Ye};else if(h.firstKeyFrame&&h.independent&&s.id===1&&!se&&(this.couldBacktrack=!0),h.dropped&&h.independent){const Re=this.getMainFwdBufferInfo(),Ue=(Re?Re.end:this.getLoadPosition())+this.config.maxBufferHole,Ge=h.firstKeyFramePTS?h.firstKeyFramePTS:te;if(!V&&Ue<Ge-this.config.maxBufferHole&&!se){this.backtrack(o);return}else se&&(o.gap=!0);o.setElementaryStreamInfo(h.type,o.start,Se,o.start,Ye,!0)}else V&&te-(b.appliedTimelineOffset||0)>Kr&&(o.gap=!0);o.setElementaryStreamInfo(h.type,te,Se,Fe,Ye),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(h,o,c,s,V||se)}else if(V||se)o.gap=!0;else{this.backtrack(o);return}}if(R){const{startPTS:T,endPTS:V,startDTS:se,endDTS:te}=R;c&&(c.elementaryStreams[D.AUDIO]={startPTS:T,endPTS:V,startDTS:se,endDTS:te}),o.setElementaryStreamInfo(D.AUDIO,T,V,se,te),this.bufferFragmentData(R,o,c,s)}if(b&&d!=null&&d.samples.length){const T={id:t,frag:o,details:b,samples:d.samples};n.trigger(g.FRAG_PARSING_METADATA,T)}if(b&&f){const T={id:t,frag:o,details:b,samples:f.samples};n.trigger(g.FRAG_PARSING_USERDATA,T)}}logMuxedErr(e){this.warn(`${fe(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,i){if(this.state!==tt.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));const{audio:s,video:r,audiovideo:o}=t;if(s){const u=e.audioCodec;let h=de(s.codec,u);h==="mp4a"&&(h="mp4a.40.5");const f=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){h&&(h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5");const d=s.metadata;d&&"channelCount"in d&&(d.channelCount||1)!==1&&f.indexOf("firefox")===-1&&(h="mp4a.40.5")}h&&h.indexOf("mp4a.40.5")!==-1&&f.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(h="mp4a.40.2",this.log(`Android: force audio codec to ${h}`)),u&&u!==h&&this.log(`Swapping manifest audio codec "${u}" for "${h}"`),s.levelCodec=h,s.id=ee.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${h||""}/${u||""}/${s.codec}]`),delete t.audiovideo}if(r){r.levelCodec=e.videoCodec,r.id=ee.MAIN;const u=r.codec;if((u==null?void 0:u.length)===4)switch(u){case"hvc1":case"hev1":r.codec="hvc1.1.6.L120.90";break;case"av01":r.codec="av01.0.04M.08";break;case"avc1":r.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${r.codec!==u?" parsed-corrected="+r.codec:""}${r.supplemental?" supplemental="+r.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger(g.BUFFER_CODECS,t),!this.hls)return;c.forEach(u=>{const f=t[u].initSegment;f!=null&&f.byteLength&&this.hls.trigger(g.BUFFER_APPENDING,{type:u,data:f,frag:n,part:null,chunkMeta:i,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,ee.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,n=e==null?void 0:e[t];return n?this.getMaxBufferLength(n.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=tt.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(Zt.isBuffered(e,n)?t=this.getAppendedFrag(n):Zt.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,s=t.level;(!i||t.sn!==i.sn||i.level!==s)&&(this.fragPlaying=t,this.hls.trigger(g.FRAG_CHANGED,{frag:t}),(!i||i.level!==s)&&this.hls.trigger(g.LEVEL_SWITCHED,{level:s}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return N(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(N(t)){const n=this.getLevelDetails(),i=this.currentFrag||(n?on(null,n.fragments,t):null);if(i){const s=i.programDateTime;if(s!==null){const r=s+(t-i.start)*1e3;return new Date(r)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Lh extends F{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyIdToKeyInfo){const i=this.keyIdToKeyInfo[n].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.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=$.KEY_LOAD_ERROR,n,i,s){return new Hn({type:ne.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:n,networkDetails:i})}loadClear(e,t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let i=0,s=t.length;i<s;i++){const r=t[i];if(e.cc<=r.cc&&(!fe(e)||!fe(r)||e.sn<r.sn)||!n&&i==s-1)return this.emeController.selectKeySystemFormat(r).then(o=>{if(!this.emeController)return;r.setKeyFormat(o);const c=os(o);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const i=zt(this.config);if(i.length)return this.emeController.getKeySystemAccess(i)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var n,i;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const h=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,h))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));const o=Fa(s);let c=this.keyIdToKeyInfo[o];if((n=c)!=null&&n.decryptdata.key)return s.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if((i=c)!=null&&i.keyLoadPromise){var u;switch((u=c.mediaKeySessionContext)==null?void 0:u.keyStatus){case"usable":case"usable-in-future":return c.keyLoadPromise.then(f=>{const{keyInfo:d}=f;return s.key=d.decryptdata.key,{frag:e,keyInfo:d}})}}switch(this.log(`Loading key ${k(s.keyId||[])} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[o]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(n);return(e.keyLoadPromise=i.then(s=>(e.mediaKeySessionContext=s,n))).catch(s=>{throw e.keyLoadPromise=null,s.data&&(s.data.frag=t),s})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,i=n.loader,s=new i(n);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((r,o)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=n.keyLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,E,b,R)=>{const{frag:T,keyInfo:V,url:se}=b,te=Fa(V.decryptdata)||se;if(!T.decryptdata||V!==this.keyIdToKeyInfo[te])return o(this.createKeyLoadError(T,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),R));V.decryptdata.key=T.decryptdata.key=new Uint8Array(d.data),T.keyLoader=null,V.loader=null,r({frag:T,keyInfo:V})},onError:(d,E,b,R)=>{this.resetLoader(E),o(this.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error(`HTTP Error ${d.code} loading key ${d.text}`),b,y({url:c.url,data:void 0},d)))},onTimeout:(d,E,b)=>{this.resetLoader(E),o(this.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),b))},onAbort:(d,E,b)=>{this.resetLoader(E),o(this.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),b))}};s.load(c,h,f)})}resetLoader(e){const{frag:t,keyInfo:n,url:i}=e,s=n.loader;t.keyLoader===s&&(t.keyLoader=null,n.loader=null);const r=Fa(n.decryptdata)||i;delete this.keyIdToKeyInfo[r],s&&s.destroy()}}function Fa(a){const e=a.keyId;return e?k(e):a.uri}function ol(a){const{type:e}=a;switch(e){case ue.AUDIO_TRACK:return ee.AUDIO;case ue.SUBTITLE_TRACK:return ee.SUBTITLE;default:return ee.MAIN}}function Ma(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Ch{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(g.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(g.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,n=t.pLoader,i=t.loader,s=n||i,r=new s(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ue.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:n,level:i,pathwayId:s,url:r,deliveryDirectives:o,levelInfo:c}=t;this.load({id:n,level:i,pathwayId:s,responseType:"text",type:ue.LEVEL,url:r,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:r,track:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:ue.AUDIO_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:r,track:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:ue.SUBTITLE_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onLevelsUpdated(e,t){const n=this.loaders[ue.LEVEL];if(n){const i=n.context;i&&!t.levels.some(s=>s===i.levelOrTrack)&&(n.abort(),delete this.loaders[ue.LEVEL])}}load(e){var t;const n=this.hls.config;let i=this.getInternalLoader(e);if(i){const u=this.hls.logger,h=i.context;if(h&&h.levelOrTrack===e.levelOrTrack&&(h.url===e.url||h.deliveryDirectives&&!e.deliveryDirectives)){h.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${h.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let s;if(e.type===ue.MANIFEST?s=n.manifestLoadPolicy.default:s=p({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),N((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===ue.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===ue.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===ue.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const h=u.partTarget,f=u.targetduration;if(h&&f){const d=Math.max(h*3,f*.8)*1e3;s=p({},s,{maxTimeToFirstByteMs:Math.min(d,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(d,s.maxTimeToFirstByteMs)})}}}const r=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},c={onSuccess:(u,h,f,d)=>{const E=this.getInternalLoader(f);this.resetInternalLoader(f.type);const b=u.data;if(b.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),d||null,h);return}h.parsing.start=performance.now(),Wi.isMediaPlaylist(b)||f.type!==ue.MANIFEST?this.handleTrackOrLevelPlaylist(u,h,f,d||null,E):this.handleMasterPlaylist(u,h,f,d)},onError:(u,h,f,d)=>{this.handleNetworkError(h,f,!1,u,d)},onTimeout:(u,h,f)=>{this.handleNetworkError(h,f,!0,void 0,u)}};i.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,i){const s=this.hls,r=e.data,o=Ma(e,n),c=Wi.parseMasterPlaylist(r,o);if(c.playlistParsingError){this.handleManifestParsingError(e,n,c.playlistParsingError,i,t);return}const{contentSteering:u,levels:h,sessionData:f,sessionKeys:d,startTimeOffset:E,variableList:b}=c;this.variableList=b;const{AUDIO:R=[],SUBTITLES:T,"CLOSED-CAPTIONS":V}=Wi.parseMasterPlaylistMedia(r,o,c);R.length&&!R.some(te=>!te.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),R.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new _n({}),bitrate:0,url:""})),s.trigger(g.MANIFEST_LOADED,{levels:h,audioTracks:R,subtitles:T,captions:V,contentSteering:u,url:o,stats:t,networkDetails:i,sessionData:f,sessionKeys:d,startTimeOffset:E,variableList:b})}handleTrackOrLevelPlaylist(e,t,n,i,s){const r=this.hls,{id:o,level:c,type:u}=n,h=Ma(e,n),f=N(c)?c:N(o)?o:0,d=ol(n),E=Wi.parseLevelPlaylist(e.data,h,f,d,0,this.variableList);if(u===ue.MANIFEST){const b={attrs:new _n({}),bitrate:0,details:E,name:"",url:h};E.requestScheduled=t.loading.start+vr(E,0),r.trigger(g.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:h,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=E,this.handlePlaylistLoaded(E,e,t,n,i,s)}handleManifestParsingError(e,t,n,i,s){this.hls.trigger(g.ERROR,{type:ne.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===ue.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:i,stats:s})}handleNetworkError(e,t,n=!1,i,s){let r=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===ue.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===ue.AUDIO_TRACK||e.type===ue.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let c=$.UNKNOWN,u=!1;const h=this.getInternalLoader(e);switch(e.type){case ue.MANIFEST:c=n?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,u=!0;break;case ue.LEVEL:c=n?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,u=!1;break;case ue.AUDIO_TRACK:c=n?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ue.SUBTITLE_TRACK:c=n?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,u=!1;break}h&&this.resetInternalLoader(e.type);const f={type:ne.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:s};if(i){const d=(t==null?void 0:t.url)||e.url;f.response=y({url:d,data:void 0},i)}this.hls.trigger(g.ERROR,f)}handlePlaylistLoaded(e,t,n,i,s,r){const o=this.hls,{type:c,level:u,id:h,groupId:f,deliveryDirectives:d}=i,E=Ma(t,i),b=ol(i),R=typeof i.level=="number"&&b===ee.MAIN?u:void 0;if(!e.fragments.length){const V=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(g.ERROR,{type:ne.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:E,error:V,reason:V.message,response:t,context:i,level:R,parent:b,networkDetails:s,stats:n});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const T=e.playlistParsingError;if(T){if(this.hls.logger.warn(`${T} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(g.ERROR,{type:ne.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:E,error:T,reason:T.message,response:t,context:i,level:R,parent:b,networkDetails:s,stats:n});return}e.playlistParsingError=null}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),(!r.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case ue.MANIFEST:case ue.LEVEL:o.trigger(g.LEVEL_LOADED,{details:e,levelInfo:i.levelOrTrack||o.levels[0],level:R||0,id:h||0,stats:n,networkDetails:s,deliveryDirectives:d,withoutMultiVariant:c===ue.MANIFEST});break;case ue.AUDIO_TRACK:o.trigger(g.AUDIO_TRACK_LOADED,{details:e,track:i.levelOrTrack,id:h||0,groupId:f||"",stats:n,networkDetails:s,deliveryDirectives:d});break;case ue.SUBTITLE_TRACK:o.trigger(g.SUBTITLE_TRACK_LOADED,{details:e,track:i.levelOrTrack,id:h||0,groupId:f||"",stats:n,networkDetails:s,deliveryDirectives:d});break}}}class Ds{static get version(){return nr}static isMSESupported(){return al()}static isSupported(){return Ah()}static getMediaSource(){return oe()}static get Events(){return g}static get MetadataSchema(){return Ui}static get ErrorTypes(){return ne}static get ErrorDetails(){return $}static get DefaultConfig(){return Ds.defaultConfig?Ds.defaultConfig:ph}static set DefaultConfig(e){Ds.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 Qr,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=he(e.debug||!1,"Hls instance",e.assetPlayerId),n=this.config=mh(Ds.DefaultConfig,e,t);this.userConfig=e,n.progressive&&_h(n,t);const{abrController:i,bufferController:s,capLevelController:r,errorController:o,fpsController:c}=n,u=new o(this),h=this.abrController=new i(this),f=new ni(this),d=n.interstitialsController,E=d?this.interstitialsController=new d(this,Ds):null,b=this.bufferController=new s(this,f),R=this.capLevelController=new r(this),T=new c(this),V=new Ch(this),se=n.contentSteeringController,te=se?new se(this):null,Se=this.levelController=new wh(this,te),Fe=new Sh(this),Ye=new Lh(this.config,this.logger),Re=this.streamController=new Ih(this,f,Ye),Ue=this.gapController=new bh(this,f);R.setStreamController(Re),T.setStreamController(Re);const Ge=[V,Se,Re];E&&Ge.splice(1,0,E),te&&Ge.splice(1,0,te),this.networkControllers=Ge;const Ie=[h,b,Ue,R,T,Fe,f];this.audioTrackController=this.createController(n.audioTrackController,Ge);const it=n.audioStreamController;it&&Ge.push(this.audioStreamController=new it(this,f,Ye)),this.subtitleTrackController=this.createController(n.subtitleTrackController,Ge);const It=n.subtitleStreamController;It&&Ge.push(this.subtititleStreamController=new It(this,f,Ye)),this.createController(n.timelineController,Ie),Ye.emeController=this.emeController=this.createController(n.emeController,Ie),this.cmcdController=this.createController(n.cmcdController,Ie),this.latencyController=this.createController(Th,Ie),this.coreComponents=Ie,Ge.push(u);const Mt=u.onErrorOut;typeof Mt=="function"&&this.on(g.ERROR,Mt,u),this.on(g.MANIFEST_LOADED,V.onManifestLoaded,V)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,i){this._emitter.off(e,t,n,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const i=e===g.ERROR;this.trigger(g.ERROR,{type:ne.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:i,event:e,error:n}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(g.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const s=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(g.ERROR,{type:ne.OTHER_ERROR,details:$.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,n=t?e.media:e,i=t?e:{media:n};this._media=n,this.trigger(g.MEDIA_ATTACHING,i)}detachMedia(){this.logger.log("detachMedia"),this.trigger(g.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(g.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,n=this._url,i=this._url=_.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),t&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(g.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),!(!this.started||!this.networkControllers));n++);}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={[ee.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[ee.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[ee.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=bc()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Tn(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const n=e.length;for(let i=0;i<n;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,n)for(let s=i;s--;){const r=e[s].attrs["HDCP-LEVEL"];if(r&&r<=n)return s}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const n=be(t);return Ln(e,n,navigator.mediaCapabilities)}}Ds.defaultConfig=void 0},16722:function(Ut,at,O){"use strict";O.d(at,{Z:function(){return ee}});const N=l=>typeof l=="object"&&l!=null&&l.nodeType===1,re=(l,j)=>(!j||l!=="hidden")&&l!=="visible"&&l!=="clip",De=(l,j)=>{if(l.clientHeight<l.scrollHeight||l.clientWidth<l.scrollWidth){const A=getComputedStyle(l,null);return re(A.overflowY,j)||re(A.overflowX,j)||(p=>{const m=(y=>{if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(x){return null}})(p);return!!m&&(m.clientHeight<p.scrollHeight||m.clientWidth<p.scrollWidth)})(l)}return!1},ne=(l,j,A,p,m,y,x,M)=>y<l&&x>j||y>l&&x<j?0:y<=l&&M<=A||x>=j&&M>=A?y-l-p:x>j&&M<A||y<l&&M>A?x-j+m:0,$=l=>{const j=l.parentElement;return j==null?l.getRootNode().host||null:j},g=(l,j)=>{var A,p,m,y;if(typeof document=="undefined")return[];const{scrollMode:x,block:M,inline:F,boundary:z,skipOverflowHiddenElements:I}=j,C=typeof z=="function"?z:ye=>ye!==z;if(!N(l))throw new TypeError("Invalid target");const U=document.scrollingElement||document.documentElement,H=[];let J=l;for(;N(J)&&C(J);){if(J=$(J),J===U){H.push(J);break}J!=null&&J===document.body&&De(J)&&!De(document.documentElement)||J!=null&&De(J,I)&&H.push(J)}const he=(p=(A=window.visualViewport)==null?void 0:A.width)!=null?p:innerWidth,X=(y=(m=window.visualViewport)==null?void 0:m.height)!=null?y:innerHeight,{scrollX:oe,scrollY:_e}=window,{height:ie,width:ze,top:k,right:S,bottom:w,left:P}=l.getBoundingClientRect(),{top:W,right:K,bottom:_,left:v}=(ye=>{const Oe=window.getComputedStyle(ye);return{top:parseFloat(Oe.scrollMarginTop)||0,right:parseFloat(Oe.scrollMarginRight)||0,bottom:parseFloat(Oe.scrollMarginBottom)||0,left:parseFloat(Oe.scrollMarginLeft)||0}})(l);let D=M==="start"||M==="nearest"?k-W:M==="end"?w+_:k+ie/2-W+_,Z=F==="center"?P+ze/2-v+K:F==="end"?S+K:P-v;const fe=[];for(let ye=0;ye<H.length;ye++){const Oe=H[ye],{height:Ne,width:ve,top:Me,right:Ae,bottom:dt,left:Ce}=Oe.getBoundingClientRect();if(x==="if-needed"&&k>=0&&P>=0&&w<=X&&S<=he&&(Oe===U&&!De(Oe)||k>=Me&&w<=dt&&P>=Ce&&S<=Ae))return fe;const rt=getComputedStyle(Oe),Pe=parseInt(rt.borderLeftWidth,10),ut=parseInt(rt.borderTopWidth,10),ce=parseInt(rt.borderRightWidth,10),le=parseInt(rt.borderBottomWidth,10);let Y=0,Te=0;const ke="offsetWidth"in Oe?Oe.offsetWidth-Oe.clientWidth-Pe-ce:0,Ke="offsetHeight"in Oe?Oe.offsetHeight-Oe.clientHeight-ut-le:0,G="offsetWidth"in Oe?Oe.offsetWidth===0?0:ve/Oe.offsetWidth:0,q="offsetHeight"in Oe?Oe.offsetHeight===0?0:Ne/Oe.offsetHeight:0;if(U===Oe)Y=M==="start"?D:M==="end"?D-X:M==="nearest"?ne(_e,_e+X,X,ut,le,_e+D,_e+D+ie,ie):D-X/2,Te=F==="start"?Z:F==="center"?Z-he/2:F==="end"?Z-he:ne(oe,oe+he,he,Pe,ce,oe+Z,oe+Z+ze,ze),Y=Math.max(0,Y+_e),Te=Math.max(0,Te+oe);else{Y=M==="start"?D-Me-ut:M==="end"?D-dt+le+Ke:M==="nearest"?ne(Me,dt,Ne,ut,le+Ke,D,D+ie,ie):D-(Me+Ne/2)+Ke/2,Te=F==="start"?Z-Ce-Pe:F==="center"?Z-(Ce+ve/2)+ke/2:F==="end"?Z-Ae+ce+ke:ne(Ce,Ae,ve,Pe,ce+ke,Z,Z+ze,ze);const{scrollLeft:me,scrollTop:we}=Oe;Y=q===0?0:Math.max(0,Math.min(we+Y/q,Oe.scrollHeight-Ne/q+Ke)),Te=G===0?0:Math.max(0,Math.min(me+Te/G,Oe.scrollWidth-ve/G+ke)),D+=we-Y,Z+=me-Te}fe.push({el:Oe,top:Y,left:Te})}return fe},ue=l=>l===!1?{block:"end",inline:"nearest"}:(j=>j===Object(j)&&Object.keys(j).length!==0)(l)?l:{block:"start",inline:"nearest"};function ee(l,j){if(!l.isConnected||!(m=>{let y=m;for(;y&&y.parentNode;){if(y.parentNode===document)return!0;y=y.parentNode instanceof ShadowRoot?y.parentNode.host:y.parentNode}return!1})(l))return;const A=(m=>{const y=window.getComputedStyle(m);return{top:parseFloat(y.scrollMarginTop)||0,right:parseFloat(y.scrollMarginRight)||0,bottom:parseFloat(y.scrollMarginBottom)||0,left:parseFloat(y.scrollMarginLeft)||0}})(l);if((m=>typeof m=="object"&&typeof m.behavior=="function")(j))return j.behavior(g(l,j));const p=typeof j=="boolean"||j==null?void 0:j.behavior;for(const{el:m,top:y,left:x}of g(l,ue(j))){const M=y-A.top+A.bottom,F=x-A.left+A.right;m.scroll({top:M,left:F,behavior:p})}}}}]);
}());