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.
150 lines
952 KiB
150 lines
952 KiB
!(function(){var xl=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[4339],{65030:function(Ut,at,W){"use strict";W.d(at,{Z:function(){return mi}});var V=W(33885),de=W(42978),Ie=W(75931),te=W(43403),M=W(92310),p=W.n(M),ce=W(29301),J=W(76846),l=W(96452),z=W(6089),x=W(80402),m=W(34280),_=W(49658),b=W(59301),T=W(54476),F=W(77900),C=W(8654);function P(we){var me=we.prefixCls,ie=we.align,ke=we.arrow,ze=we.arrowPos,Qe=ke||{},K=Qe.className,ne=Qe.content,Se=ze.x,Te=Se===void 0?0:Se,Ne=ze.y,He=Ne===void 0?0:Ne,bt=b.useRef();if(!ie||!ie.points)return null;var Xe={position:"absolute"};if(ie.autoArrow!==!1){var lt=ie.points[0],qe=ie.points[1],_t=lt[0],ct=lt[1],he=qe[0],_e=qe[1];_t===he||!["t","b"].includes(_t)?Xe.top=He:_t==="t"?Xe.top=0:Xe.bottom=0,ct===_e||!["l","r"].includes(ct)?Xe.left=Te:ct==="l"?Xe.left=0:Xe.right=0}return b.createElement("div",{ref:bt,className:p()("".concat(me,"-arrow"),K),style:Xe},ne)}function w(we){var me=we.prefixCls,ie=we.open,ke=we.zIndex,ze=we.mask,Qe=we.motion;return ze?b.createElement(F.default,(0,T.Z)({},Qe,{motionAppear:!0,visible:ie,removeOnLeave:!0}),function(K){var ne=K.className;return b.createElement("div",{style:{zIndex:ke},className:p()("".concat(me,"-mask"),ne)})}):null}var I=b.memo(function(we){var me=we.children;return me},function(we,me){return me.cache}),N=I,q=b.forwardRef(function(we,me){var ie=we.popup,ke=we.className,ze=we.prefixCls,Qe=we.style,K=we.target,ne=we.onVisibleChanged,Se=we.open,Te=we.keepDom,Ne=we.fresh,He=we.onClick,bt=we.mask,Xe=we.arrow,lt=we.arrowPos,qe=we.align,_t=we.motion,ct=we.maskMotion,he=we.forceRender,_e=we.getPopupContainer,Me=we.autoDestroy,$e=we.portal,Pe=we.zIndex,st=we.onMouseEnter,nt=we.onMouseLeave,Je=we.onPointerEnter,ft=we.onPointerDownCapture,At=we.ready,Ze=we.offsetX,dt=we.offsetY,fe=we.offsetR,ae=we.offsetB,oe=we.onAlign,R=we.onPrepare,k=we.stretch,Z=we.targetWidth,ee=we.targetHeight,se=typeof ie=="function"?ie():ie,Ue=Se||Te,Ge=(_e==null?void 0:_e.length)>0,tt=b.useState(!_e||!Ge),gt=(0,de.Z)(tt,2),wt=gt[0],$t=gt[1];if((0,m.Z)(function(){!wt&&Ge&&K&&$t(!0)},[wt,Ge,K]),!wt)return null;var Dt="auto",rt={left:"-1000vw",top:"-1000vh",right:Dt,bottom:Dt};if(At||!Se){var Lt,Jt=qe.points,Xt=qe.dynamicInset||((Lt=qe._experimental)===null||Lt===void 0?void 0:Lt.dynamicInset),ri=Xt&&Jt[0][1]==="r",Vt=Xt&&Jt[0][0]==="b";ri?(rt.right=fe,rt.left=Dt):(rt.left=Ze,rt.right=Dt),Vt?(rt.bottom=ae,rt.top=Dt):(rt.top=dt,rt.bottom=Dt)}var jt={};return k&&(k.includes("height")&&ee?jt.height=ee:k.includes("minHeight")&&ee&&(jt.minHeight=ee),k.includes("width")&&Z?jt.width=Z:k.includes("minWidth")&&Z&&(jt.minWidth=Z)),Se||(jt.pointerEvents="none"),b.createElement($e,{open:he||Ue,getContainer:_e&&function(){return _e(K)},autoDestroy:Me},b.createElement(w,{prefixCls:ze,open:Se,zIndex:Pe,mask:bt,motion:ct}),b.createElement(ce.Z,{onResize:oe,disabled:!Se},function(Fi){return b.createElement(F.default,(0,T.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:he,leavedClassName:"".concat(ze,"-hidden")},_t,{onAppearPrepare:R,onEnterPrepare:R,visible:Se,onVisibleChanged:function(qi){var wi;_t==null||(wi=_t.onVisibleChanged)===null||wi===void 0||wi.call(_t,qi),ne(qi)}}),function(ki,qi){var wi=ki.className,_n=ki.style,hi=p()(ze,wi,ke);return b.createElement("div",{ref:(0,C.sQ)(Fi,me,qi),className:hi,style:(0,V.Z)((0,V.Z)((0,V.Z)((0,V.Z)({"--arrow-x":"".concat(lt.x||0,"px"),"--arrow-y":"".concat(lt.y||0,"px")},rt),jt),_n),{},{boxSizing:"border-box",zIndex:Pe},Qe),onMouseEnter:st,onMouseLeave:nt,onPointerEnter:Je,onClick:He,onPointerDownCapture:ft},Xe&&b.createElement(P,{prefixCls:ze,arrow:Xe,arrowPos:lt,align:qe}),b.createElement(N,{cache:!Se&&!Ne},se))})}))}),re=q,le=b.forwardRef(function(we,me){var ie=we.children,ke=we.getTriggerDOMNode,ze=(0,C.Yr)(ie),Qe=b.useCallback(function(ne){(0,C.mH)(me,ke?ke(ne):ne)},[ke]),K=(0,C.x1)(Qe,(0,C.C4)(ie));return ze?b.cloneElement(ie,{ref:K}):ie}),H=le,ye=b.createContext(null),be=ye;function Ee(we){return we?Array.isArray(we)?we:[we]:[]}function We(we,me,ie,ke){return b.useMemo(function(){var ze=Ee(ie!=null?ie:me),Qe=Ee(ke!=null?ke:me),K=new Set(ze),ne=new Set(Qe);return we&&(K.has("hover")&&(K.delete("hover"),K.add("click")),ne.has("hover")&&(ne.delete("hover"),ne.add("click"))),[K,ne]},[we,me,ie,ke])}var $=W(29194);function D(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ie=arguments.length>2?arguments[2]:void 0;return ie?we[0]===me[0]:we[0]===me[0]&&we[1]===me[1]}function O(we,me,ie,ke){for(var ze=ie.points,Qe=Object.keys(we),K=0;K<Qe.length;K+=1){var ne,Se=Qe[K];if(D((ne=we[Se])===null||ne===void 0?void 0:ne.points,ze,ke))return"".concat(me,"-placement-").concat(Se)}return""}function B(we,me,ie,ke){return me||(ie?{motionName:"".concat(we,"-").concat(ie)}:ke?{motionName:ke}:null)}function Q(we){return we.ownerDocument.defaultView}function G(we){for(var me=[],ie=we==null?void 0:we.parentElement,ke=["hidden","scroll","clip","auto"];ie;){var ze=Q(ie).getComputedStyle(ie),Qe=ze.overflowX,K=ze.overflowY,ne=ze.overflow;[Qe,K,ne].some(function(Se){return ke.includes(Se)})&&me.push(ie),ie=ie.parentElement}return me}function g(we){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(we)?me:we}function v(we){return g(parseFloat(we),0)}function L(we,me){var ie=(0,V.Z)({},we);return(me||[]).forEach(function(ke){if(!(ke instanceof HTMLBodyElement||ke instanceof HTMLHtmlElement)){var ze=Q(ke).getComputedStyle(ke),Qe=ze.overflow,K=ze.overflowClipMargin,ne=ze.borderTopWidth,Se=ze.borderBottomWidth,Te=ze.borderLeftWidth,Ne=ze.borderRightWidth,He=ke.getBoundingClientRect(),bt=ke.offsetHeight,Xe=ke.clientHeight,lt=ke.offsetWidth,qe=ke.clientWidth,_t=v(ne),ct=v(Se),he=v(Te),_e=v(Ne),Me=g(Math.round(He.width/lt*1e3)/1e3),$e=g(Math.round(He.height/bt*1e3)/1e3),Pe=(lt-qe-he-_e)*Me,st=(bt-Xe-_t-ct)*$e,nt=_t*$e,Je=ct*$e,ft=he*Me,At=_e*Me,Ze=0,dt=0;if(Qe==="clip"){var fe=v(K);Ze=fe*Me,dt=fe*$e}var ae=He.x+ft-Ze,oe=He.y+nt-dt,R=ae+He.width+2*Ze-ft-At-Pe,k=oe+He.height+2*dt-nt-Je-st;ie.left=Math.max(ie.left,ae),ie.top=Math.max(ie.top,oe),ie.right=Math.min(ie.right,R),ie.bottom=Math.min(ie.bottom,k)}}),ie}function X(we){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ie="".concat(me),ke=ie.match(/^(.*)\%$/);return ke?we*(parseFloat(ke[1])/100):parseFloat(ie)}function Ae(we,me){var ie=me||[],ke=(0,de.Z)(ie,2),ze=ke[0],Qe=ke[1];return[X(we.width,ze),X(we.height,Qe)]}function Be(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[we[0],we[1]]}function ht(we,me){var ie=me[0],ke=me[1],ze,Qe;return ie==="t"?Qe=we.y:ie==="b"?Qe=we.y+we.height:Qe=we.y+we.height/2,ke==="l"?ze=we.x:ke==="r"?ze=we.x+we.width:ze=we.x+we.width/2,{x:ze,y:Qe}}function Ke(we,me){var ie={t:"b",b:"t",l:"r",r:"l"};return we.map(function(ke,ze){return ze===me?ie[ke]||"c":ke}).join("")}function yt(we,me,ie,ke,ze,Qe,K){var ne=b.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:ze[ke]||{}}),Se=(0,de.Z)(ne,2),Te=Se[0],Ne=Se[1],He=b.useRef(0),bt=b.useMemo(function(){return me?G(me):[]},[me]),Xe=b.useRef({}),lt=function(){Xe.current={}};we||lt();var qe=(0,z.Z)(function(){if(me&&ie&&we){let gn=function(xn,Rn){var Hn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Vi,Kn=Ue.x+xn,us=Ue.y+Rn,ms=Kn+Vt,rs=us+ri,Ds=Math.max(Kn,Hn.left),It=Math.max(us,Hn.top),Yt=Math.min(ms,Hn.right),Oi=Math.min(rs,Hn.bottom);return Math.max(0,(Yt-Ds)*(Oi-It))},tn=function(){zi=Ue.y+qt,Ki=zi+ri,xi=Ue.x+Kt,yi=xi+Vt};var he,_e,Me,$e,Pe=me,st=Pe.ownerDocument,nt=Q(Pe),Je=nt.getComputedStyle(Pe),ft=Je.position,At=Pe.style.left,Ze=Pe.style.top,dt=Pe.style.right,fe=Pe.style.bottom,ae=Pe.style.overflow,oe=(0,V.Z)((0,V.Z)({},ze[ke]),Qe),R=st.createElement("div");(he=Pe.parentElement)===null||he===void 0||he.appendChild(R),R.style.left="".concat(Pe.offsetLeft,"px"),R.style.top="".concat(Pe.offsetTop,"px"),R.style.position=ft,R.style.height="".concat(Pe.offsetHeight,"px"),R.style.width="".concat(Pe.offsetWidth,"px"),Pe.style.left="0",Pe.style.top="0",Pe.style.right="auto",Pe.style.bottom="auto",Pe.style.overflow="hidden";var k;if(Array.isArray(ie))k={x:ie[0],y:ie[1],width:0,height:0};else{var Z,ee,se=ie.getBoundingClientRect();se.x=(Z=se.x)!==null&&Z!==void 0?Z:se.left,se.y=(ee=se.y)!==null&&ee!==void 0?ee:se.top,k={x:se.x,y:se.y,width:se.width,height:se.height}}var Ue=Pe.getBoundingClientRect(),Ge=nt.getComputedStyle(Pe),tt=Ge.height,gt=Ge.width;Ue.x=(_e=Ue.x)!==null&&_e!==void 0?_e:Ue.left,Ue.y=(Me=Ue.y)!==null&&Me!==void 0?Me:Ue.top;var wt=st.documentElement,$t=wt.clientWidth,Dt=wt.clientHeight,rt=wt.scrollWidth,Lt=wt.scrollHeight,Jt=wt.scrollTop,Xt=wt.scrollLeft,ri=Ue.height,Vt=Ue.width,jt=k.height,Fi=k.width,ki={left:0,top:0,right:$t,bottom:Dt},qi={left:-Xt,top:-Jt,right:rt-Xt,bottom:Lt-Jt},wi=oe.htmlRegion,_n="visible",hi="visibleFirst";wi!=="scroll"&&wi!==hi&&(wi=_n);var Di=wi===hi,Hi=L(qi,bt),ii=L(ki,bt),Vi=wi===_n?ii:Hi,Ai=Di?ii:Vi;Pe.style.left="auto",Pe.style.top="auto",Pe.style.right="0",Pe.style.bottom="0";var un=Pe.getBoundingClientRect();Pe.style.left=At,Pe.style.top=Ze,Pe.style.right=dt,Pe.style.bottom=fe,Pe.style.overflow=ae,($e=Pe.parentElement)===null||$e===void 0||$e.removeChild(R);var Wi=g(Math.round(Vt/parseFloat(gt)*1e3)/1e3),nn=g(Math.round(ri/parseFloat(tt)*1e3)/1e3);if(Wi===0||nn===0||(0,J.Sh)(ie)&&!(0,$.Z)(ie))return;var kn=oe.offset,Ht=oe.targetOffset,Ct=Ae(Ue,kn),pe=(0,de.Z)(Ct,2),De=pe[0],Ve=pe[1],Oe=Ae(k,Ht),it=(0,de.Z)(Oe,2),ut=it[0],mt=it[1];k.x-=ut,k.y-=mt;var Et=oe.points||[],ti=(0,de.Z)(Et,2),Zt=ti[0],Li=ti[1],kt=Be(Li),ei=Be(Zt),Qt=ht(k,kt),ai=ht(Ue,ei),di=(0,V.Z)({},oe),Kt=Qt.x-ai.x+De,qt=Qt.y-ai.y+Ve,pi=gn(Kt,qt),li=gn(Kt,qt,ii),ni=ht(k,["t","l"]),Ri=ht(Ue,["t","l"]),fi=ht(k,["b","r"]),bi=ht(Ue,["b","r"]),ji=oe.overflow||{},Mi=ji.adjustX,cn=ji.adjustY,$i=ji.shiftX,Zi=ji.shiftY,Ji=function(Rn){return typeof Rn=="boolean"?Rn:Rn>=0},zi,Ki,xi,yi;tn();var En=Ji(cn),Si=ei[0]===kt[0];if(En&&ei[0]==="t"&&(Ki>Ai.bottom||Xe.current.bt)){var oi=qt;Si?oi-=ri-jt:oi=ni.y-bi.y-Ve;var vn=gn(Kt,oi),Tn=gn(Kt,oi,ii);vn>pi||vn===pi&&(!Di||Tn>=li)?(Xe.current.bt=!0,qt=oi,Ve=-Ve,di.points=[Ke(ei,0),Ke(kt,0)]):Xe.current.bt=!1}if(En&&ei[0]==="b"&&(zi<Ai.top||Xe.current.tb)){var Yi=qt;Si?Yi+=ri-jt:Yi=fi.y-Ri.y-Ve;var wn=gn(Kt,Yi),Bi=gn(Kt,Yi,ii);wn>pi||wn===pi&&(!Di||Bi>=li)?(Xe.current.tb=!0,qt=Yi,Ve=-Ve,di.points=[Ke(ei,0),Ke(kt,0)]):Xe.current.tb=!1}var an=Ji(Mi),Un=ei[1]===kt[1];if(an&&ei[1]==="l"&&(yi>Ai.right||Xe.current.rl)){var Sn=Kt;Un?Sn-=Vt-Fi:Sn=ni.x-bi.x-De;var bn=gn(Sn,qt),Qi=gn(Sn,qt,ii);bn>pi||bn===pi&&(!Di||Qi>=li)?(Xe.current.rl=!0,Kt=Sn,De=-De,di.points=[Ke(ei,1),Ke(kt,1)]):Xe.current.rl=!1}if(an&&ei[1]==="r"&&(xi<Ai.left||Xe.current.lr)){var fn=Kt;Un?fn+=Vt-Fi:fn=fi.x-Ri.x-De;var yn=gn(fn,qt),Ln=gn(fn,qt,ii);yn>pi||yn===pi&&(!Di||Ln>=li)?(Xe.current.lr=!0,Kt=fn,De=-De,di.points=[Ke(ei,1),Ke(kt,1)]):Xe.current.lr=!1}tn();var en=$i===!0?0:$i;typeof en=="number"&&(xi<ii.left&&(Kt-=xi-ii.left-De,k.x+Fi<ii.left+en&&(Kt+=k.x-ii.left+Fi-en)),yi>ii.right&&(Kt-=yi-ii.right-De,k.x>ii.right-en&&(Kt+=k.x-ii.right+en)));var hn=Zi===!0?0:Zi;typeof hn=="number"&&(zi<ii.top&&(qt-=zi-ii.top-Ve,k.y+jt<ii.top+hn&&(qt+=k.y-ii.top+jt-hn)),Ki>ii.bottom&&(qt-=Ki-ii.bottom-Ve,k.y>ii.bottom-hn&&(qt+=k.y-ii.bottom+hn)));var An=Ue.x+Kt,Pn=An+Vt,dn=Ue.y+qt,_i=dn+ri,Gt=k.x,vi=Gt+Fi,Pi=k.y,Mt=Pi+jt,sn=Math.max(An,Gt),on=Math.min(Pn,vi),ln=(sn+on)/2,Vn=ln-An,Dn=Math.max(dn,Pi),qn=Math.min(_i,Mt),Wn=(Dn+qn)/2,Ii=Wn-dn;K==null||K(me,di);var pn=un.right-Ue.x-(Kt+Ue.width),$n=un.bottom-Ue.y-(qt+Ue.height);Wi===1&&(Kt=Math.round(Kt),pn=Math.round(pn)),nn===1&&(qt=Math.round(qt),$n=Math.round($n));var ss={ready:!0,offsetX:Kt/Wi,offsetY:qt/nn,offsetR:pn/Wi,offsetB:$n/nn,arrowX:Vn/Wi,arrowY:Ii/nn,scaleX:Wi,scaleY:nn,align:di};Ne(ss)}}),_t=function(){He.current+=1;var _e=He.current;Promise.resolve().then(function(){He.current===_e&&qe()})},ct=function(){Ne(function(_e){return(0,V.Z)((0,V.Z)({},_e),{},{ready:!1})})};return(0,m.Z)(ct,[ke]),(0,m.Z)(function(){we||ct()},[we]),[Te.ready,Te.offsetX,Te.offsetY,Te.offsetR,Te.offsetB,Te.arrowX,Te.arrowY,Te.scaleX,Te.scaleY,Te.align,_t]}var ot=W(94480);function je(we,me,ie,ke,ze){(0,m.Z)(function(){if(we&&me&&ie){let He=function(){ke(),ze()};var Qe=me,K=ie,ne=G(Qe),Se=G(K),Te=Q(K),Ne=new Set([Te].concat((0,ot.Z)(ne),(0,ot.Z)(Se)));return Ne.forEach(function(bt){bt.addEventListener("scroll",He,{passive:!0})}),Te.addEventListener("resize",He,{passive:!0}),ke(),function(){Ne.forEach(function(bt){bt.removeEventListener("scroll",He),Te.removeEventListener("resize",He)})}}},[we,me,ie])}var zt=W(48736);function Ft(we,me,ie,ke,ze,Qe,K,ne){var Se=b.useRef(we);Se.current=we;var Te=b.useRef(!1);b.useEffect(function(){if(me&&ke&&(!ze||Qe)){var He=function(){Te.current=!1},bt=function(Me){var $e;Se.current&&!K((($e=Me.composedPath)===null||$e===void 0||($e=$e.call(Me))===null||$e===void 0?void 0:$e[0])||Me.target)&&!Te.current&&ne(!1)},Xe=Q(ke);Xe.addEventListener("pointerdown",He,!0),Xe.addEventListener("mousedown",bt,!0),Xe.addEventListener("contextmenu",bt,!0);var lt=(0,l.A)(ie);if(lt&&(lt.addEventListener("mousedown",bt,!0),lt.addEventListener("contextmenu",bt,!0)),0)var qe,_t,ct,he;return function(){Xe.removeEventListener("pointerdown",He,!0),Xe.removeEventListener("mousedown",bt,!0),Xe.removeEventListener("contextmenu",bt,!0),lt&&(lt.removeEventListener("mousedown",bt,!0),lt.removeEventListener("contextmenu",bt,!0))}}},[me,ie,ke,ze,Qe]);function Ne(){Te.current=!0}return Ne}var ci=["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 pt(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:te.Z,me=b.forwardRef(function(ie,ke){var ze=ie.prefixCls,Qe=ze===void 0?"rc-trigger-popup":ze,K=ie.children,ne=ie.action,Se=ne===void 0?"hover":ne,Te=ie.showAction,Ne=ie.hideAction,He=ie.popupVisible,bt=ie.defaultPopupVisible,Xe=ie.onPopupVisibleChange,lt=ie.afterPopupVisibleChange,qe=ie.mouseEnterDelay,_t=ie.mouseLeaveDelay,ct=_t===void 0?.1:_t,he=ie.focusDelay,_e=ie.blurDelay,Me=ie.mask,$e=ie.maskClosable,Pe=$e===void 0?!0:$e,st=ie.getPopupContainer,nt=ie.forceRender,Je=ie.autoDestroy,ft=ie.destroyPopupOnHide,At=ie.popup,Ze=ie.popupClassName,dt=ie.popupStyle,fe=ie.popupPlacement,ae=ie.builtinPlacements,oe=ae===void 0?{}:ae,R=ie.popupAlign,k=ie.zIndex,Z=ie.stretch,ee=ie.getPopupClassNameFromAlign,se=ie.fresh,Ue=ie.alignPoint,Ge=ie.onPopupClick,tt=ie.onPopupAlign,gt=ie.arrow,wt=ie.popupMotion,$t=ie.maskMotion,Dt=ie.popupTransitionName,rt=ie.popupAnimation,Lt=ie.maskTransitionName,Jt=ie.maskAnimation,Xt=ie.className,ri=ie.getTriggerDOMNode,Vt=(0,Ie.Z)(ie,ci),jt=Je||ft||!1,Fi=b.useState(!1),ki=(0,de.Z)(Fi,2),qi=ki[0],wi=ki[1];(0,m.Z)(function(){wi((0,_.Z)())},[]);var _n=b.useRef({}),hi=b.useContext(be),Di=b.useMemo(function(){return{registerSubPopup:function(Yt,Oi){_n.current[Yt]=Oi,hi==null||hi.registerSubPopup(Yt,Oi)}}},[hi]),Hi=(0,x.Z)(),ii=b.useState(null),Vi=(0,de.Z)(ii,2),Ai=Vi[0],un=Vi[1],Wi=b.useRef(null),nn=(0,z.Z)(function(It){Wi.current=It,(0,J.Sh)(It)&&Ai!==It&&un(It),hi==null||hi.registerSubPopup(Hi,It)}),kn=b.useState(null),Ht=(0,de.Z)(kn,2),Ct=Ht[0],pe=Ht[1],De=b.useRef(null),Ve=(0,z.Z)(function(It){(0,J.Sh)(It)&&Ct!==It&&(pe(It),De.current=It)}),Oe=b.Children.only(K),it=(Oe==null?void 0:Oe.props)||{},ut={},mt=(0,z.Z)(function(It){var Yt,Oi,ui=Ct;return(ui==null?void 0:ui.contains(It))||((Yt=(0,l.A)(ui))===null||Yt===void 0?void 0:Yt.host)===It||It===ui||(Ai==null?void 0:Ai.contains(It))||((Oi=(0,l.A)(Ai))===null||Oi===void 0?void 0:Oi.host)===It||It===Ai||Object.values(_n.current).some(function(gi){return(gi==null?void 0:gi.contains(It))||It===gi})}),Et=B(Qe,wt,rt,Dt),ti=B(Qe,$t,Jt,Lt),Zt=b.useState(bt||!1),Li=(0,de.Z)(Zt,2),kt=Li[0],ei=Li[1],Qt=He!=null?He:kt,ai=(0,z.Z)(function(It){He===void 0&&ei(It)});(0,m.Z)(function(){ei(He||!1)},[He]);var di=b.useRef(Qt);di.current=Qt;var Kt=b.useRef([]);Kt.current=[];var qt=(0,z.Z)(function(It){var Yt;ai(It),((Yt=Kt.current[Kt.current.length-1])!==null&&Yt!==void 0?Yt:Qt)!==It&&(Kt.current.push(It),Xe==null||Xe(It))}),pi=b.useRef(),li=function(){clearTimeout(pi.current)},ni=function(Yt){var Oi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;li(),Oi===0?qt(Yt):pi.current=setTimeout(function(){qt(Yt)},Oi*1e3)};b.useEffect(function(){return li},[]);var Ri=b.useState(!1),fi=(0,de.Z)(Ri,2),bi=fi[0],ji=fi[1];(0,m.Z)(function(It){(!It||Qt)&&ji(!0)},[Qt]);var Mi=b.useState(null),cn=(0,de.Z)(Mi,2),$i=cn[0],Zi=cn[1],Ji=b.useState(null),zi=(0,de.Z)(Ji,2),Ki=zi[0],xi=zi[1],yi=function(Yt){xi([Yt.clientX,Yt.clientY])},En=yt(Qt,Ai,Ue&&Ki!==null?Ki:Ct,fe,oe,R,tt),Si=(0,de.Z)(En,11),oi=Si[0],vn=Si[1],Tn=Si[2],Yi=Si[3],wn=Si[4],Bi=Si[5],an=Si[6],Un=Si[7],Sn=Si[8],bn=Si[9],Qi=Si[10],fn=We(qi,Se,Te,Ne),yn=(0,de.Z)(fn,2),Ln=yn[0],en=yn[1],hn=Ln.has("click"),An=en.has("click")||en.has("contextMenu"),Pn=(0,z.Z)(function(){bi||Qi()}),dn=function(){di.current&&Ue&&An&&ni(!1)};je(Qt,Ct,Ai,Pn,dn),(0,m.Z)(function(){Pn()},[Ki,fe]),(0,m.Z)(function(){Qt&&!(oe!=null&&oe[fe])&&Pn()},[JSON.stringify(R)]);var _i=b.useMemo(function(){var It=O(oe,Qe,bn,Ue);return p()(It,ee==null?void 0:ee(bn))},[bn,ee,oe,Qe,Ue]);b.useImperativeHandle(ke,function(){return{nativeElement:De.current,popupElement:Wi.current,forceAlign:Pn}});var Gt=b.useState(0),vi=(0,de.Z)(Gt,2),Pi=vi[0],Mt=vi[1],sn=b.useState(0),on=(0,de.Z)(sn,2),ln=on[0],Vn=on[1],Dn=function(){if(Z&&Ct){var Yt=Ct.getBoundingClientRect();Mt(Yt.width),Vn(Yt.height)}},qn=function(){Dn(),Pn()},Wn=function(Yt){ji(!1),Qi(),lt==null||lt(Yt)},Ii=function(){return new Promise(function(Yt){Dn(),Zi(function(){return Yt})})};(0,m.Z)(function(){$i&&(Qi(),$i(),Zi(null))},[$i]);function pn(It,Yt,Oi,ui){ut[It]=function(gi){var Jn;ui==null||ui(gi),ni(Yt,Oi);for(var On=arguments.length,cs=new Array(On>1?On-1:0),_s=1;_s<On;_s++)cs[_s-1]=arguments[_s];(Jn=it[It])===null||Jn===void 0||Jn.call.apply(Jn,[it,gi].concat(cs))}}(hn||An)&&(ut.onClick=function(It){var Yt;di.current&&An?ni(!1):!di.current&&hn&&(yi(It),ni(!0));for(var Oi=arguments.length,ui=new Array(Oi>1?Oi-1:0),gi=1;gi<Oi;gi++)ui[gi-1]=arguments[gi];(Yt=it.onClick)===null||Yt===void 0||Yt.call.apply(Yt,[it,It].concat(ui))});var $n=Ft(Qt,An,Ct,Ai,Me,Pe,mt,ni),ss=Ln.has("hover"),gn=en.has("hover"),tn,xn;ss&&(pn("onMouseEnter",!0,qe,function(It){yi(It)}),pn("onPointerEnter",!0,qe,function(It){yi(It)}),tn=function(Yt){(Qt||bi)&&Ai!==null&&Ai!==void 0&&Ai.contains(Yt.target)&&ni(!0,qe)},Ue&&(ut.onMouseMove=function(It){var Yt;(Yt=it.onMouseMove)===null||Yt===void 0||Yt.call(it,It)})),gn&&(pn("onMouseLeave",!1,ct),pn("onPointerLeave",!1,ct),xn=function(){ni(!1,ct)}),Ln.has("focus")&&pn("onFocus",!0,he),en.has("focus")&&pn("onBlur",!1,_e),Ln.has("contextMenu")&&(ut.onContextMenu=function(It){var Yt;di.current&&en.has("contextMenu")?ni(!1):(yi(It),ni(!0)),It.preventDefault();for(var Oi=arguments.length,ui=new Array(Oi>1?Oi-1:0),gi=1;gi<Oi;gi++)ui[gi-1]=arguments[gi];(Yt=it.onContextMenu)===null||Yt===void 0||Yt.call.apply(Yt,[it,It].concat(ui))}),Xt&&(ut.className=p()(it.className,Xt));var Rn=b.useRef(!1);Rn.current||(Rn.current=nt||Qt||bi);var Hn=(0,V.Z)((0,V.Z)({},it),ut),Kn={},us=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];us.forEach(function(It){Vt[It]&&(Kn[It]=function(){for(var Yt,Oi=arguments.length,ui=new Array(Oi),gi=0;gi<Oi;gi++)ui[gi]=arguments[gi];(Yt=Hn[It])===null||Yt===void 0||Yt.call.apply(Yt,[Hn].concat(ui)),Vt[It].apply(Vt,ui)})});var ms=b.cloneElement(Oe,(0,V.Z)((0,V.Z)({},Hn),Kn)),rs={x:Bi,y:an},Ds=gt?(0,V.Z)({},gt!==!0?gt:{}):null;return b.createElement(b.Fragment,null,b.createElement(ce.Z,{disabled:!Qt,ref:Ve,onResize:qn},b.createElement(H,{getTriggerDOMNode:ri},ms)),Rn.current&&b.createElement(be.Provider,{value:Di},b.createElement(re,{portal:we,ref:nn,prefixCls:Qe,popup:At,className:p()(Ze,_i),style:dt,target:Ct,onMouseEnter:tn,onMouseLeave:xn,onPointerEnter:tn,zIndex:k,open:Qt,keepDom:bi,fresh:se,onClick:Ge,onPointerDownCapture:$n,mask:Me,motion:Et,maskMotion:ti,onVisibleChanged:Wn,onPrepare:Ii,forceRender:nt,autoDestroy:jt,getPopupContainer:st,align:bn,arrow:Ds,arrowPos:rs,ready:oi,offsetX:vn,offsetY:Tn,offsetR:Yi,offsetB:wn,onAlign:Pn,stretch:Z,targetWidth:Pi/Un,targetHeight:ln/Sn})))});return me}var mi=pt(te.Z)},19388:function(Ut,at,W){"use strict";W.r(at),W.d(at,{default:function(){return ye}});var V=W(59301),de=W(95392),Ie=W.p+"static/detailTitle3.35713931.png",te=W(18645),M=W(48289),p=W(25399),ce=W(29787),J=W(60242),l=W(76421),z=W(53283),x=W(90036),m=W(13922),_=W(80992),b=W(57193),T=Object.defineProperty,F=Object.defineProperties,C=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,N=(be,Ee,We)=>Ee in be?T(be,Ee,{enumerable:!0,configurable:!0,writable:!0,value:We}):be[Ee]=We,q=(be,Ee)=>{for(var We in Ee||(Ee={}))w.call(Ee,We)&&N(be,We,Ee[We]);if(P)for(var We of P(Ee))I.call(Ee,We)&&N(be,We,Ee[We]);return be},re=(be,Ee)=>F(be,C(Ee)),le=(be,Ee,We)=>new Promise(($,D)=>{var O=G=>{try{Q(We.next(G))}catch(g){D(g)}},B=G=>{try{Q(We.throw(G))}catch(g){D(g)}},Q=G=>G.done?$(G.value):Promise.resolve(G.value).then(O,B);Q((We=We.apply(be,Ee)).next())});const H=({pathsDetail:be,dispatch:Ee})=>{var We,$,D,O,B;const Q=(0,de.useParams)(),[G,g]=(0,V.useState)(1),[,v,L,X]=(0,x.U)(z.Cc,{subject_id:Q==null?void 0:Q.pathId,uuid:Q==null?void 0:Q.learningpathId}),[Ae,Be]=(0,V.useState)([]),[ht,Ke]=(0,V.useState)(!1),[yt,ot]=(0,V.useState)({}),[je,zt]=(0,V.useState)(!1),Ft=[3,2,1];(0,V.useEffect)(()=>{L({})},[]),(0,V.useEffect)(()=>{var me,ie;if((me=be==null?void 0:be.detail)!=null&&me.nodes&&G===1){const ke=[...(ie=be==null?void 0:be.detail)==null?void 0:ie.nodes];Be(ke==null?void 0:ke.splice(1)),g(2)}},[(We=be==null?void 0:be.detail)==null?void 0:We.nodes]);const ci=(0,V.useMemo)(()=>[{title:"\u6807\u7B7E\u8282\u70B9\u540D\u79F0",width:"240rem",ellipsis:!0,dataIndex:"name",render:me=>V.createElement(p.Z,{title:me},me)},{title:"\u5DF2\u5173\u8054\u8D44\u6E90\u6570",ellipsis:!0,dataIndex:"resource_count"},{title:"\u5B9E\u8BAD",ellipsis:!0,dataIndex:"shixun"},{title:"\u89C6\u9891",ellipsis:!0,dataIndex:"video"},{title:"\u8BFE\u4EF6",ellipsis:!0,dataIndex:"attachment"},{title:"\u8BD5\u5377",ellipsis:!0,dataIndex:"examination_bank"},{title:"\u4F5C\u4E1A",ellipsis:!0,dataIndex:"homework"},{title:"\u5176\u4ED6",ellipsis:!0,dataIndex:"other"},{title:"\u67E5\u770B",ellipsis:!0,dataIndex:"look",render:(me,ie)=>V.createElement("a",{style:{color:"#18D6FF"},onClick:()=>{we(ie)}},"\u67E5\u770B\u8BE6\u60C5")}],[]),pt=()=>le(void 0,null,function*(){L({})}),mi=(0,V.useMemo)(()=>{var me,ie;const ke=((me=X==null?void 0:X.data)==null?void 0:me.relation_resource_count)||0,ze=((ie=X==null?void 0:X.data)==null?void 0:ie.no_relation_resource_count)||0,Qe=ke+ze;return Qe>0?Math.round(ke/Qe*100):0},[X==null?void 0:X.data]),we=me=>le(void 0,null,function*(){var ie,ke,ze,Qe,K;zt(!0);let ne=yield(0,b.ZP)("/api/knowledge/v2/get_node.json",{method:"get",params:{depth:0,subject_id:Q==null?void 0:Q.pathId,nodeUuid:me==null?void 0:me.knowledge_uuid}});if((ne==null?void 0:ne.status)===0&&((ke=(ie=ne==null?void 0:ne.data)==null?void 0:ie.nodes)==null?void 0:ke.length)>0){let Se=(K=(Qe=(ze=ne==null?void 0:ne.data)==null?void 0:ze.nodes)==null?void 0:Qe.map(Te=>{var Ne,He,bt,Xe,lt,qe,_t,ct,he,_e,Me,$e,Pe;const st=(Ne=ne==null?void 0:ne.data)==null?void 0:Ne.resource_count;return re(q({},Te==null?void 0:Te.properties),{rootNodeUuid:(He=Te==null?void 0:Te.properties)==null?void 0:He.rootNodeUuid,id:(bt=Te==null?void 0:Te.properties)==null?void 0:bt.uuid,name:(Xe=Te==null?void 0:Te.properties)==null?void 0:Xe.name,description:(lt=Te==null?void 0:Te.properties)==null?void 0:lt.description,nodeType:(qe=Te==null?void 0:Te.properties)==null?void 0:qe.nodeType,tags:((_t=Te==null?void 0:Te.properties)==null?void 0:_t.tags)&&((_e=(he=(ct=Te==null?void 0:Te.properties)==null?void 0:ct.tags)==null?void 0:he.split("\uFF0C"))==null?void 0:_e.map(nt=>({name:nt})))||[],colorType:parseInt((Me=Te==null?void 0:Te.properties)==null?void 0:Me.color)>3?"3":($e=Te==null?void 0:Te.properties)==null?void 0:$e.color,activeColor:"#FA6400",size:Ft[((Pe=Te==null?void 0:Te.properties)==null?void 0:Pe.color)-1]||1,shape:"circle",hide:!1,isExtendedState:!0,currentResourceTotal:st})}))==null?void 0:K[0];Se.resourceid=me==null?void 0:me.id,Se.tpacti=me==null?void 0:me.knowledge_uuid,ot(Se),Ke(!0)}zt(!1)});return V.createElement(ce.Z,{spinning:v||je},V.createElement("div",{className:"w-full c-white text-14px-rem",style:{background:`#030616 url(${M}) 0 0 / 100% auto no-repeat`,height:"100vh",overflow:"auto"}},V.createElement("div",{className:"w-full flex item-center justify-center",style:{background:`#030616 url(${Ie}) 0 0 / 100% 100% no-repeat`,height:"108rem"}}),V.createElement("div",{className:"ml-auto mr-auto flex flex-col mt-20px-rem",style:{width:"1200rem"}},V.createElement("div",{className:"w-full flex item-center gap-64px-rem",style:{background:`#030616 url(${te}) 0 0 / 100% 100% no-repeat`,height:"156rem",padding:"0 64px",justifyContent:"space-around"}},V.createElement("div",{className:"flex item-center gap-16px-rem"},V.createElement("img",{src:W(76296),width:65,height:80,style:{width:"65rem",height:"80rem"}}),V.createElement("div",{className:"flex flex-col"},V.createElement("div",{className:"text-500"},"\u5DF2\u5173\u8054\u8D44\u6E90\u6807\u7B7E\u8282\u70B9\u6570"),V.createElement("div",{className:"text-20px-rem multi_ellipsis1 blod",style:{color:"#7FBEFF"}},(($=X==null?void 0:X.data)==null?void 0:$.relation_resource_count)||0))),V.createElement("div",{className:"flex item-center gap-16px-rem"},V.createElement("img",{src:W(30757),width:65,height:80,style:{width:"65rem",height:"80rem"}}),V.createElement("div",{className:"flex flex-col"},V.createElement("div",{className:"text-500"},"\u672A\u5173\u8054\u8D44\u6E90\u6807\u7B7E\u8282\u70B9\u6570"),V.createElement("div",{className:"text-20px-rem multi_ellipsis1 blod",style:{color:"#86A0FF"}},((D=X==null?void 0:X.data)==null?void 0:D.no_relation_resource_count)||0))),V.createElement("div",{className:"flex item-center gap-16px-rem"},V.createElement(J.Z,{type:"circle",percent:mi,showInfo:!1,size:65,strokeWidth:18,trailColor:"rgba(100, 135, 188, 0.40)",strokeColor:"#1BBDE0"}),V.createElement("div",{className:"flex flex-col text-nowrap"},V.createElement("div",null,"\u77E5\u8BC6\u70B9\u5EFA\u8BBE\u7387\xA0",V.createElement(p.Z,{title:"\u8D44\u6E90\u5EFA\u8BBE\u7387 = \u56FE\u8C31\u4E2D\u5DF2\u5173\u8054\u8D44\u6E90\u7684\u6807\u7B7E\u8282\u70B9\u6570 / \u56FE\u8C31\u6807\u7B7E\u8282\u70B9\u603B\u6570"},V.createElement("i",{className:"iconfont icon-xiaowenhao2",style:{fontSize:"16rem"}})," ")),V.createElement("div",{className:"text-24px-rem ",style:{color:"#1BBDE0",fontWeight:800}},mi,"%")))),V.createElement("div",{className:"flex flex-col mt-22px-rem gap-12px-rem pb-20px"},V.createElement("div",{className:`w-full flex item-center justify-center px-30px-rem rounded-2px-rem gap-16px-rem sticky ${l.Z.TableMyHeader}`,style:{height:"40rem",top:0}},ci==null?void 0:ci.map((me,ie)=>V.createElement("div",{key:ie,className:`minW-0 ${me!=null&&me.ellipsis?"multi_ellipsis1":""}`,style:{flex:me!=null&&me.width?"":1,width:(me==null?void 0:me.width)||""}},me==null?void 0:me.title))),(X==null?void 0:X.total_count)==0?V.createElement(m.Z,null):(B=(O=X==null?void 0:X.data)==null?void 0:O.knowledge_infos)==null?void 0:B.map((me,ie)=>V.createElement("div",{key:ie,style:{height:"54rem"},className:`w-full flex item-center justify-center px-30px-rem rounded-2px-rem gap-16px-rem ${l.Z.TableMyDiv}`},ci==null?void 0:ci.map((ke,ze)=>{var Qe;return V.createElement("div",{key:ze,className:`minW-0 ${ke!=null&&ke.ellipsis?"multi_ellipsis1":""}`,style:{flex:ke!=null&&ke.width?"":1,width:(ke==null?void 0:ke.width)||""}},((Qe=ke==null?void 0:ke.render)==null?void 0:Qe.call(ke,me==null?void 0:me[ke==null?void 0:ke.dataIndex],me,ie))||(me==null?void 0:me[ke==null?void 0:ke.dataIndex]))})))))),V.createElement(_.Z,{initdata:pt,uuid:Q==null?void 0:Q.learningpathId,setshow:()=>{},getData:pt,containerRef:()=>{},showdetail:ht,setshowdetail:Ke,items:yt,Tabsdatas:Ae,tpacti:yt==null?void 0:yt.tpacti}))};var ye=(0,de.connect)(({pathsDetail:be})=>({pathsDetail:be}))(H)},64018:function(){var Ut,at,W,V=!1,de,Ie;window.PR_SHOULD_USE_CONTINUATION=!0;var te,M;(function(){var p=window,ce=["break,continue,do,else,for,if,return,while"],J=[ce,"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=[J,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],z=[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"],x=[l,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],m=[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"],_="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",b=[l,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],T="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",F=[ce,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],C=[ce,"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"],P=[ce,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[z,m,x,b,T,F,C,P],I=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,N="str",q="kwd",re="com",le="typ",H="lit",ye="pun",be="pln",Ee="tag",We="dec",$="src",D="atn",O="atv",B="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(me){for(var ie=0,ke=!1,ze=!1,Qe=0,K=me.length;Qe<K;++Qe){var ne=me[Qe];if(ne.ignoreCase)ze=!0;else if(/[a-z]/i.test(ne.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){ke=!0,ze=!1;break}}var Se={b:8,t:9,n:10,v:11,f:12,r:13};function Te(lt){var qe=lt.charCodeAt(0);if(qe!==92)return qe;var _t=lt.charAt(1);return qe=Se[_t],qe||("0"<=_t&&_t<="7"?parseInt(lt.substring(1),8):_t==="u"||_t==="x"?parseInt(lt.substring(2),16):lt.charCodeAt(1))}function Ne(lt){if(lt<32)return(lt<16?"\\x0":"\\x")+lt.toString(16);var qe=String.fromCharCode(lt);return qe==="\\"||qe==="-"||qe==="]"||qe==="^"?"\\"+qe:qe}function He(lt){var qe=lt.substring(1,lt.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")),_t=[],ct=qe[0]==="^",he=["["];ct&&he.push("^");for(var _e=ct?1:0,Me=qe.length;_e<Me;++_e){var $e=qe[_e];if(/\\[bdsw]/i.test($e))he.push($e);else{var Pe=Te($e),st;_e+2<Me&&qe[_e+1]==="-"?(st=Te(qe[_e+2]),_e+=2):st=Pe,_t.push([Pe,st]),st<65||Pe>122||(st<65||Pe>90||_t.push([Math.max(65,Pe)|32,Math.min(st,90)|32]),st<97||Pe>122||_t.push([Math.max(97,Pe)&-33,Math.min(st,122)&-33]))}}_t.sort(function(At,Ze){return At[0]-Ze[0]||Ze[1]-At[1]});for(var nt=[],Je=[],_e=0;_e<_t.length;++_e){var ft=_t[_e];ft[0]<=Je[1]+1?Je[1]=Math.max(Je[1],ft[1]):nt.push(Je=ft)}for(var _e=0;_e<nt.length;++_e){var ft=nt[_e];he.push(Ne(ft[0])),ft[1]>ft[0]&&(ft[1]+1>ft[0]&&he.push("-"),he.push(Ne(ft[1])))}return he.push("]"),he.join("")}function bt(lt){for(var qe=lt.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")),_t=qe.length,ct=[],he=0,_e=0;he<_t;++he){var Me=qe[he];if(Me==="(")++_e;else if(Me.charAt(0)==="\\"){var $e=+Me.substring(1);$e&&($e<=_e?ct[$e]=-1:qe[he]=Ne($e))}}for(var he=1;he<ct.length;++he)ct[he]===-1&&(ct[he]=++ie);for(var he=0,_e=0;he<_t;++he){var Me=qe[he];if(Me==="(")++_e,ct[_e]||(qe[he]="(?:");else if(Me.charAt(0)==="\\"){var $e=+Me.substring(1);$e&&$e<=_e&&(qe[he]="\\"+ct[$e])}}for(var he=0;he<_t;++he)qe[he]==="^"&&qe[he+1]!=="^"&&(qe[he]="");if(lt.ignoreCase&&ke)for(var he=0;he<_t;++he){var Me=qe[he],Pe=Me.charAt(0);Me.length>=2&&Pe==="["?qe[he]=He(Me):Pe!=="\\"&&(qe[he]=Me.replace(/[a-zA-Z]/g,function(Je){var ft=Je.charCodeAt(0);return"["+String.fromCharCode(ft&-33,ft|32)+"]"}))}return qe.join("")}for(var Xe=[],Qe=0,K=me.length;Qe<K;++Qe){var ne=me[Qe];if(ne.global||ne.multiline)throw new Error(""+ne);Xe.push("(?:"+bt(ne)+")")}return new RegExp(Xe.join("|"),ze?"gi":"g")}function g(me,ie){var ke=/(?:^|\s)nocode(?:\s|$)/,ze=[],Qe=0,K=[],ne=0;function Se(Te){var Ne=Te.nodeType;if(Ne==1){if(ke.test(Te.className))return;for(var He=Te.firstChild;He;He=He.nextSibling)Se(He);var bt=Te.nodeName.toLowerCase();(bt==="br"||bt==="li")&&(ze[ne]=`
|
|
`,K[ne<<1]=Qe++,K[ne++<<1|1]=Te)}else if(Ne==3||Ne==4){var Xe=Te.nodeValue;Xe.length&&(ie?Xe=Xe.replace(/\r\n?/g,`
|
|
`):Xe=Xe.replace(/[ \t\r\n]+/g," "),ze[ne]=Xe,K[ne<<1]=Qe,Qe+=Xe.length,K[ne++<<1|1]=Te)}}return Se(me),{sourceCode:ze.join("").replace(/\n$/,""),spans:K}}function v(me,ie,ke,ze,Qe){if(ke){var K={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:ke,spans:null,basePos:ie,decorations:null};ze(K),Qe.push.apply(Qe,K.decorations)}}var L=/\S/;function X(me){for(var ie=void 0,ke=me.firstChild;ke;ke=ke.nextSibling){var ze=ke.nodeType;ie=ze===1?ie?me:ke:ze===3&&L.test(ke.nodeValue)?me:ie}return ie===me?void 0:ie}function Ae(me,ie){var ke={},ze;(function(){for(var ne=me.concat(ie),Se=[],Te={},Ne=0,He=ne.length;Ne<He;++Ne){var bt=ne[Ne],Xe=bt[3];if(Xe)for(var lt=Xe.length;--lt>=0;)ke[Xe.charAt(lt)]=bt;var qe=bt[1],_t=""+qe;Te.hasOwnProperty(_t)||(Se.push(qe),Te[_t]=null)}Se.push(/[\0-\uffff]/),ze=G(Se)})();var Qe=ie.length,K=function(ne){for(var Se=ne.sourceCode,Te=ne.basePos,Ne=ne.sourceNode,He=[Te,be],bt=0,Xe=Se.match(ze)||[],lt={},qe=0,_t=Xe.length;qe<_t;++qe){var ct=Xe[qe],he=lt[ct],_e=void 0,Me;if(typeof he=="string")Me=!1;else{var $e=ke[ct.charAt(0)];if($e)_e=ct.match($e[1]),he=$e[0];else{for(var Pe=0;Pe<Qe;++Pe)if($e=ie[Pe],_e=ct.match($e[1]),_e){he=$e[0];break}_e||(he=be)}Me=he.length>=5&&he.substring(0,5)==="lang-",Me&&!(_e&&typeof _e[1]=="string")&&(Me=!1,he=$),Me||(lt[ct]=he)}var st=bt;if(bt+=ct.length,!Me)He.push(Te+st,he);else{var nt=_e[1],Je=ct.indexOf(nt),ft=Je+nt.length;_e[2]&&(ft=ct.length-_e[2].length,Je=ft-nt.length);var At=he.substring(5);v(Ne,Te+st,ct.substring(0,Je),K,He),v(Ne,Te+st+Je,nt,zt(At,nt),He),v(Ne,Te+st+ft,ct.substring(ft),K,He)}}ne.decorations=He};return K}function Be(me){var ie=[],ke=[];me.tripleQuotedStrings?ie.push([N,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?ie.push([N,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ie.push([N,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&ke.push([N,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ze=me.hashComments;ze&&(me.cStyleComments?(ze>1?ie.push([re,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ie.push([re,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ke.push([N,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ie.push([re,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(ke.push([re,/^\/\/[^\r\n]*/,null]),ke.push([re,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Qe=me.regexLiterals;if(Qe){var K=Qe>1?"":`
|
|
\r`,ne=K?".":"[\\S\\s]",Se="/(?=[^/*"+K+"])(?:[^/\\x5B\\x5C"+K+"]|\\x5C"+ne+"|\\x5B(?:[^\\x5C\\x5D"+K+"]|\\x5C"+ne+")*(?:\\x5D|$))+/";ke.push(["lang-regex",RegExp("^"+Q+"("+Se+")")])}var Te=me.types;Te&&ke.push([le,Te]);var Ne=(""+me.keywords).replace(/^ | $/g,"");Ne.length&&ke.push([q,new RegExp("^(?:"+Ne.replace(/[\s,]+/g,"|")+")\\b"),null]),ie.push([be,/^\s+/,null,` \r
|
|
\xA0`]);var He="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(He+="(?!s*/)"),ke.push([H,/^@[a-z_$][a-z_$@0-9]*/i,null],[le,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[be,/^[a-z_$][a-z_$@0-9]*/i,null],[H,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[be,/^\\[\s\S]?/,null],[ye,new RegExp(He),null]),Ae(ie,ke)}var ht=Be({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ke(me,ie,ke){for(var ze=/(?:^|\s)nocode(?:\s|$)/,Qe=/\r\n?|\n/,K=me.ownerDocument,ne=K.createElement("li");me.firstChild;)ne.appendChild(me.firstChild);var Se=[ne];function Te(qe){var _t=qe.nodeType;if(_t==1&&!ze.test(qe.className))if(qe.nodeName==="br")Ne(qe),qe.parentNode&&qe.parentNode.removeChild(qe);else for(var ct=qe.firstChild;ct;ct=ct.nextSibling)Te(ct);else if((_t==3||_t==4)&&ke){var he=qe.nodeValue,_e=he.match(Qe);if(_e){var Me=he.substring(0,_e.index);qe.nodeValue=Me;var $e=he.substring(_e.index+_e[0].length);if($e){var Pe=qe.parentNode;Pe.insertBefore(K.createTextNode($e),qe.nextSibling)}Ne(qe),Me||qe.parentNode.removeChild(qe)}}}function Ne(qe){for(;!qe.nextSibling;)if(qe=qe.parentNode,!qe)return;function _t(_e,Me){var $e=Me?_e.cloneNode(!1):_e,Pe=_e.parentNode;if(Pe){var st=_t(Pe,1),nt=_e.nextSibling;st.appendChild($e);for(var Je=nt;Je;Je=nt)nt=Je.nextSibling,st.appendChild(Je)}return $e}for(var ct=_t(qe.nextSibling,0),he;(he=ct.parentNode)&&he.nodeType===1;)ct=he;Se.push(ct)}for(var He=0;He<Se.length;++He)Te(Se[He]);ie===(ie|0)&&Se[0].setAttribute("value",ie);var bt=K.createElement("ol");bt.className="linenums";for(var Xe=Math.max(0,ie-1|0)||0,He=0,lt=Se.length;He<lt;++He)ne=Se[He],ne.className="L"+(He+Xe)%10,ne.firstChild||ne.appendChild(K.createTextNode("\xA0")),bt.appendChild(ne);me.appendChild(bt)}function yt(me){var ie=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ie=ie&&+ie[1]<=8;var ke=/\n/g,ze=me.sourceCode,Qe=ze.length,K=0,ne=me.spans,Se=ne.length,Te=0,Ne=me.decorations,He=Ne.length,bt=0;Ne[He]=Qe;var Xe,lt;for(lt=Xe=0;lt<He;)Ne[lt]!==Ne[lt+2]?(Ne[Xe++]=Ne[lt++],Ne[Xe++]=Ne[lt++]):lt+=2;for(He=Xe,lt=Xe=0;lt<He;){for(var qe=Ne[lt],_t=Ne[lt+1],ct=lt+2;ct+2<=He&&Ne[ct+1]===_t;)ct+=2;Ne[Xe++]=qe,Ne[Xe++]=_t,lt=ct}He=Ne.length=Xe;var he=me.sourceNode,_e="";he&&(_e=he.style.display,he.style.display="none");try{for(var Me=null;Te<Se;){var $e=ne[Te],Pe=ne[Te+2]||Qe,st=Ne[bt+2]||Qe,ct=Math.min(Pe,st),nt=ne[Te+1],Je;if(nt.nodeType!==1&&(Je=ze.substring(K,ct))){ie&&(Je=Je.replace(ke,"\r")),nt.nodeValue=Je;var ft=nt.ownerDocument,At=ft.createElement("span");At.className=Ne[bt+1];var Ze=nt.parentNode;Ze.replaceChild(At,nt),At.appendChild(nt),K<Pe&&(ne[Te+1]=nt=ft.createTextNode(ze.substring(ct,Pe)),Ze.insertBefore(nt,At.nextSibling))}K=ct,K>=Pe&&(Te+=2),K>=st&&(bt+=2)}}finally{he&&(he.style.display=_e)}}var ot={};function je(me,ie){for(var ke=ie.length;--ke>=0;){var ze=ie[ke];ot.hasOwnProperty(ze)?p.console&&console.warn("cannot override language handler %s",ze):ot[ze]=me}}function zt(me,ie){return me&&ot.hasOwnProperty(me)||(me=/^\s*</.test(ie)?"default-markup":"default-code"),ot[me]}je(ht,["default-code"]),je(Ae([],[[be,/^[^<?]+/],[We,/^<!\w[^>]*(?:>|$)/],[re,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[ye,/^(?:<[%?]|[%?]>)/],["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"]),je(Ae([[be,/^[\s]+/,null,` \r
|
|
`],[O,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[Ee,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[D,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[ye,/^[=<>\/]+/],["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"]),je(Ae([],[[O,/^[\s\S]+/]]),["uq.val"]),je(Be({keywords:z,hashComments:!0,cStyleComments:!0,types:I}),["c","cc","cpp","cxx","cyc","m"]),je(Be({keywords:"null,true,false"}),["json"]),je(Be({keywords:m,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:I}),["cs"]),je(Be({keywords:x,cStyleComments:!0}),["java"]),je(Be({keywords:P,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),je(Be({keywords:F,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),je(Be({keywords:T,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),je(Be({keywords:C,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),je(Be({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),je(Be({keywords:_,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),je(Ae([],[[N,/^[\s\S]+/]]),["regex"]);function Ft(me){var ie=me.langExtension;try{var ke=g(me.sourceNode,me.pre),ze=ke.sourceCode;me.sourceCode=ze,me.spans=ke.spans,me.basePos=0,zt(ie,ze)(me),yt(me)}catch(Qe){p.console&&console.log(Qe&&Qe.stack||Qe)}}function ci(me,ie,ke){var ze=ke||!1,Qe=ie||null,K=document.createElement("div");K.innerHTML="<pre>"+me+"</pre>",K=K.firstChild,ze&&Ke(K,ze,!0);var ne={langExtension:Qe,numberLines:ze,sourceNode:K,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ft(ne),K.innerHTML}function pt(me,ie){var ke=ie||document.body,ze=ke.ownerDocument||document;function Qe($e){return ke.getElementsByTagName($e)}for(var K=[Qe("pre"),Qe("code"),Qe("xmp")],ne=[],Se=0;Se<K.length;++Se)for(var Te=0,Ne=K[Se].length;Te<Ne;++Te)ne.push(K[Se][Te]);K=null;var He=Date;He.now||(He={now:function(){return+new Date}});var bt=0,Xe=/\blang(?:uage)?-([\w.]+)(?!\S)/,lt=/\bprettyprint\b/,qe=/\bprettyprinted\b/,_t=/pre|xmp/i,ct=/^code$/i,he=/^(?:pre|code|xmp)$/i,_e={};function Me(){for(var $e=p.PR_SHOULD_USE_CONTINUATION?He.now()+250:1/0;bt<ne.length&&He.now()<$e;bt++){for(var Pe=ne[bt],st=_e,nt=Pe;nt=nt.previousSibling;){var Je=nt.nodeType,ft=(Je===7||Je===8)&&nt.nodeValue;if(ft?!/^\??prettify\b/.test(ft):Je!==3||/\S/.test(nt.nodeValue))break;if(ft){st={},ft.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ge,tt,gt){st[tt]=gt});break}}var At=Pe.className;if((st!==_e||lt.test(At))&&!qe.test(At)){for(var Ze=!1,dt=Pe.parentNode;dt;dt=dt.parentNode){var fe=dt.tagName;if(he.test(fe)&&dt.className&<.test(dt.className)){Ze=!0;break}}if(!Ze){Pe.className+=" prettyprinted";var ae=st.lang;if(!ae){ae=At.match(Xe);var oe;!ae&&(oe=X(Pe))&&ct.test(oe.tagName)&&(ae=oe.className.match(Xe)),ae&&(ae=ae[1])}var R;if(_t.test(Pe.tagName))R=1;else{var k=Pe.currentStyle,Z=ze.defaultView,ee=k?k.whiteSpace:Z&&Z.getComputedStyle?Z.getComputedStyle(Pe,null).getPropertyValue("white-space"):0;R=ee&&ee.substring(0,3)==="pre"}var se=st.linenums;(se=se==="true"||+se)||(se=At.match(/\blinenums\b(?::(\d+))?/),se=se?se[1]&&se[1].length?+se[1]:!0:!1),se&&Ke(Pe,se,R);var Ue={langExtension:ae,sourceNode:Pe,numberLines:se,pre:R,sourceCode:null,basePos:null,spans:null,decorations:null};Ft(Ue)}}}bt<ne.length?p.setTimeout(Me,250):typeof me=="function"&&me()}Me()}var mi=p.PR={createSimpleLexer:Ae,registerLangHandler:je,sourceDecorator:Be,PR_ATTRIB_NAME:D,PR_ATTRIB_VALUE:O,PR_COMMENT:re,PR_DECLARATION:We,PR_KEYWORD:q,PR_LITERAL:H,PR_NOCODE:B,PR_PLAIN:be,PR_PUNCTUATION:ye,PR_SOURCE:$,PR_STRING:N,PR_TAG:Ee,PR_TYPE:le,prettyPrintOne:V?p.prettyPrintOne=ci:te=ci,prettyPrint:M=V?p.prettyPrint=pt:M=pt},we=p.define;typeof we=="function"&&we.amd&&we("google-code-prettify",[],function(){return mi})})()},25769:function(Ut,at,W){"use strict";var V=W(98040),de={"text/plain":"Text","text/html":"Url",default:"Text"},Ie="Copy to clipboard: #{key}, Enter";function te(p){var ce=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return p.replace(/#{\s*key\s*}/g,ce)}function M(p,ce){var J,l,z,x,m,_,b=!1;ce||(ce={}),J=ce.debug||!1;try{z=V(),x=document.createRange(),m=document.getSelection(),_=document.createElement("span"),_.textContent=p,_.ariaHidden="true",_.style.all="unset",_.style.position="fixed",_.style.top=0,_.style.clip="rect(0, 0, 0, 0)",_.style.whiteSpace="pre",_.style.webkitUserSelect="text",_.style.MozUserSelect="text",_.style.msUserSelect="text",_.style.userSelect="text",_.addEventListener("copy",function(F){if(F.stopPropagation(),ce.format)if(F.preventDefault(),typeof F.clipboardData=="undefined"){J&&console.warn("unable to use e.clipboardData"),J&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var C=de[ce.format]||de.default;window.clipboardData.setData(C,p)}else F.clipboardData.clearData(),F.clipboardData.setData(ce.format,p);ce.onCopy&&(F.preventDefault(),ce.onCopy(F.clipboardData))}),document.body.appendChild(_),x.selectNodeContents(_),m.addRange(x);var T=document.execCommand("copy");if(!T)throw new Error("copy command was unsuccessful");b=!0}catch(F){J&&console.error("unable to copy using execCommand: ",F),J&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(ce.format||"text",p),ce.onCopy&&ce.onCopy(window.clipboardData),b=!0}catch(C){J&&console.error("unable to copy using clipboardData: ",C),J&&console.error("falling back to prompt"),l=te("message"in ce?ce.message:Ie),window.prompt(l,p)}}finally{m&&(typeof m.removeRange=="function"?m.removeRange(x):m.removeAllRanges()),_&&document.body.removeChild(_),z()}return b}Ut.exports=M},53184:function(Ut,at,W){"use strict";var V,de;function Ie(te,M,p){var ce=function(J,l){return te.js_beautify(J,l)};return ce.js=te.js_beautify,ce.css=M.css_beautify,ce.html=p.html_beautify,ce.js_beautify=te.js_beautify,ce.css_beautify=M.css_beautify,ce.html_beautify=p.html_beautify,ce}V=[W(58553),W(87804),W(40998)],de=function(te,M,p){return Ie(te,M,p)}.apply(at,V),de!==void 0&&(Ut.exports=de)},87804:function(Ut,at){var W,V;(function(){var de;(function(){"use strict";var te=[,,function(J){function l(m){this.__parent=m,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 m=new l(this.__parent);return m.set_indent(this.__indent_count,this.__alignment_count),m},l.prototype.item=function(m){return m<0?this.__items[this.__items.length+m]:this.__items[m]},l.prototype.has_match=function(m){for(var _=this.__items.length-1;_>=0;_--)if(this.__items[_].match(m))return!0;return!1},l.prototype.set_indent=function(m,_){this.is_empty()&&(this.__indent_count=m||0,this.__alignment_count=_||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 m=this.__parent.current_line;return m.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),m.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),m.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,m.__items[0]===" "&&(m.__items.splice(0,1),m.__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(m){this.__items.push(m);var _=m.lastIndexOf(`
|
|
`);_!==-1?this.__character_count=m.length-_:this.__character_count+=m.length},l.prototype.pop=function(){var m=null;return this.is_empty()||(m=this.__items.pop(),this.__character_count-=m.length),m},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 m="";return this.is_empty()?this.__parent.indent_empty_lines&&(m=this.__parent.get_indent_string(this.__indent_count)):(m=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),m+=this.__items.join("")),m};function z(m,_){this.__cache=[""],this.__indent_size=m.indent_size,this.__indent_string=m.indent_char,m.indent_with_tabs||(this.__indent_string=new Array(m.indent_size+1).join(m.indent_char)),_=_||"",m.indent_level>0&&(_=new Array(m.indent_level+1).join(this.__indent_string)),this.__base_string=_,this.__base_string_length=_.length}z.prototype.get_indent_size=function(m,_){var b=this.__base_string_length;return _=_||0,m<0&&(b=0),b+=m*this.__indent_size,b+=_,b},z.prototype.get_indent_string=function(m,_){var b=this.__base_string;return _=_||0,m<0&&(m=0,b=""),_+=m*this.__indent_size,this.__ensure_cache(_),b+=this.__cache[_],b},z.prototype.__ensure_cache=function(m){for(;m>=this.__cache.length;)this.__add_column()},z.prototype.__add_column=function(){var m=this.__cache.length,_=0,b="";this.__indent_size&&m>=this.__indent_size&&(_=Math.floor(m/this.__indent_size),m-=_*this.__indent_size,b=new Array(_+1).join(this.__indent_string)),m&&(b+=new Array(m+1).join(" ")),this.__cache.push(b)};function x(m,_){this.__indent_cache=new z(m,_),this.raw=!1,this._end_with_newline=m.end_with_newline,this.indent_size=m.indent_size,this.wrap_line_length=m.wrap_line_length,this.indent_empty_lines=m.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()}x.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},x.prototype.get_line_number=function(){return this.__lines.length},x.prototype.get_indent_string=function(m,_){return this.__indent_cache.get_indent_string(m,_)},x.prototype.get_indent_size=function(m,_){return this.__indent_cache.get_indent_size(m,_)},x.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},x.prototype.add_new_line=function(m){return this.is_empty()||!m&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},x.prototype.get_code=function(m){this.trim(!0);var _=this.current_line.pop();_&&(_[_.length-1]===`
|
|
`&&(_=_.replace(/\n+$/g,"")),this.current_line.push(_)),this._end_with_newline&&this.__add_outputline();var b=this.__lines.join(`
|
|
`);return m!==`
|
|
`&&(b=b.replace(/[\n]/g,m)),b},x.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},x.prototype.set_indent=function(m,_){return m=m||0,_=_||0,this.next_line.set_indent(m,_),this.__lines.length>1?(this.current_line.set_indent(m,_),!0):(this.current_line.set_indent(),!1)},x.prototype.add_raw_token=function(m){for(var _=0;_<m.newlines;_++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(m.whitespace_before),this.current_line.push(m.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},x.prototype.add_token=function(m){this.__add_space_before_token(),this.current_line.push(m),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},x.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(" "))},x.prototype.remove_indent=function(m){for(var _=this.__lines.length;m<_;)this.__lines[m]._remove_indent(),m++;this.current_line._remove_wrap_indent()},x.prototype.trim=function(m){for(m=m===void 0?!1:m,this.current_line.trim();m&&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},x.prototype.just_added_newline=function(){return this.current_line.is_empty()},x.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},x.prototype.ensure_empty_line_above=function(m,_){for(var b=this.__lines.length-2;b>=0;){var T=this.__lines[b];if(T.is_empty())break;if(T.item(0).indexOf(m)!==0&&T.item(-1)!==_){this.__lines.splice(b+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}b--}},J.exports.Output=x},,,,function(J){function l(m,_){this.raw_options=z(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(m,_){var b=this.raw_options[m],T=_||[];return typeof b=="object"?b!==null&&typeof b.concat=="function"&&(T=b.concat()):typeof b=="string"&&(T=b.split(/[^a-zA-Z0-9_\/\-]+/)),T},l.prototype._get_boolean=function(m,_){var b=this.raw_options[m],T=b===void 0?!!_:!!b;return T},l.prototype._get_characters=function(m,_){var b=this.raw_options[m],T=_||"";return typeof b=="string"&&(T=b.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),T},l.prototype._get_number=function(m,_){var b=this.raw_options[m];_=parseInt(_,10),isNaN(_)&&(_=0);var T=parseInt(b,10);return isNaN(T)&&(T=_),T},l.prototype._get_selection=function(m,_,b){var T=this._get_selection_list(m,_,b);if(T.length!==1)throw new Error("Invalid Option Value: The option '"+m+`' can only be one of the following values:
|
|
`+_+`
|
|
You passed in: '`+this.raw_options[m]+"'");return T[0]},l.prototype._get_selection_list=function(m,_,b){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(b=b||[_[0]],!this._is_valid_selection(b,_))throw new Error("Invalid Default Value!");var T=this._get_array(m,b);if(!this._is_valid_selection(T,_))throw new Error("Invalid Option Value: The option '"+m+`' can contain only the following values:
|
|
`+_+`
|
|
You passed in: '`+this.raw_options[m]+"'");return T},l.prototype._is_valid_selection=function(m,_){return m.length&&_.length&&!m.some(function(b){return _.indexOf(b)===-1})};function z(m,_){var b={};m=x(m);var T;for(T in m)T!==_&&(b[T]=m[T]);if(_&&m[_])for(T in m[_])b[T]=m[_][T];return b}function x(m){var _={},b;for(b in m){var T=b.replace(/-/g,"_");_[T]=m[b]}return _}J.exports.Options=l,J.exports.normalizeOpts=x,J.exports.mergeOpts=z},,function(J){var l=RegExp.prototype.hasOwnProperty("sticky");function z(x){this.__input=x||"",this.__input_length=this.__input.length,this.__position=0}z.prototype.restart=function(){this.__position=0},z.prototype.back=function(){this.__position>0&&(this.__position-=1)},z.prototype.hasNext=function(){return this.__position<this.__input_length},z.prototype.next=function(){var x=null;return this.hasNext()&&(x=this.__input.charAt(this.__position),this.__position+=1),x},z.prototype.peek=function(x){var m=null;return x=x||0,x+=this.__position,x>=0&&x<this.__input_length&&(m=this.__input.charAt(x)),m},z.prototype.__match=function(x,m){x.lastIndex=m;var _=x.exec(this.__input);return _&&!(l&&x.sticky)&&_.index!==m&&(_=null),_},z.prototype.test=function(x,m){return m=m||0,m+=this.__position,m>=0&&m<this.__input_length?!!this.__match(x,m):!1},z.prototype.testChar=function(x,m){var _=this.peek(m);return x.lastIndex=0,_!==null&&x.test(_)},z.prototype.match=function(x){var m=this.__match(x,this.__position);return m?this.__position+=m[0].length:m=null,m},z.prototype.read=function(x,m,_){var b="",T;return x&&(T=this.match(x),T&&(b+=T[0])),m&&(T||!x)&&(b+=this.readUntil(m,_)),b},z.prototype.readUntil=function(x,m){var _="",b=this.__position;x.lastIndex=this.__position;var T=x.exec(this.__input);return T?(b=T.index,m&&(b+=T[0].length)):b=this.__input_length,_=this.__input.substring(this.__position,b),this.__position=b,_},z.prototype.readUntilAfter=function(x){return this.readUntil(x,!0)},z.prototype.get_regexp=function(x,m){var _=null,b="g";return m&&l&&(b="y"),typeof x=="string"&&x!==""?_=new RegExp(x,b):x&&(_=new RegExp(x.source,b)),_},z.prototype.get_literal_regexp=function(x){return RegExp(x.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},z.prototype.peekUntilAfter=function(x){var m=this.__position,_=this.readUntilAfter(x);return this.__position=m,_},z.prototype.lookBack=function(x){var m=this.__position-1;return m>=x.length&&this.__input.substring(m-x.length,m).toLowerCase()===x},J.exports.InputScanner=z},,,,,function(J){function l(z,x){z=typeof z=="string"?z:z.source,x=typeof x=="string"?x:x.source,this.__directives_block_pattern=new RegExp(z+/ beautify( \w+[:]\w+)+ /.source+x,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(z+/\sbeautify\signore:end\s/.source+x,"g")}l.prototype.get_directives=function(z){if(!z.match(this.__directives_block_pattern))return null;var x={};this.__directive_pattern.lastIndex=0;for(var m=this.__directive_pattern.exec(z);m;)x[m[1]]=m[2],m=this.__directive_pattern.exec(z);return x},l.prototype.readIgnored=function(z){return z.readUntilAfter(this.__directives_end_ignore_pattern)},J.exports.Directives=l},,function(J,l,z){var x=z(16).Beautifier,m=z(17).Options;function _(b,T){var F=new x(b,T);return F.beautify()}J.exports=_,J.exports.defaultOptions=function(){return new m}},function(J,l,z){var x=z(17).Options,m=z(2).Output,_=z(8).InputScanner,b=z(13).Directives,T=new b(/\/\*/,/\*\//),F=/\r\n|[\r\n]/,C=/\r\n|[\r\n]/g,P=/\s/,w=/(?:\s|\n)+/g,I=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,N=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function q(re,le){this._source_text=re||"",this._options=new x(le),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"]}q.prototype.eatString=function(re){var le="";for(this._ch=this._input.next();this._ch;){if(le+=this._ch,this._ch==="\\")le+=this._input.next();else if(re.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return le},q.prototype.eatWhitespace=function(re){for(var le=P.test(this._input.peek()),H=0;P.test(this._input.peek());)this._ch=this._input.next(),re&&this._ch===`
|
|
`&&(H===0||H<this._options.max_preserve_newlines)&&(H++,this._output.add_new_line(!0));return le},q.prototype.foundNestedPseudoClass=function(){for(var re=0,le=1,H=this._input.peek(le);H;){if(H==="{")return!0;if(H==="(")re+=1;else if(H===")"){if(re===0)return!1;re-=1}else if(H===";"||H==="}")return!1;le++,H=this._input.peek(le)}return!1},q.prototype.print_string=function(re){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(re)},q.prototype.preserveSingleSpace=function(re){re&&(this._output.space_before_token=!0)},q.prototype.indent=function(){this._indentLevel++},q.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},q.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var re=this._source_text,le=this._options.eol;le==="auto"&&(le=`
|
|
`,re&&F.test(re||"")&&(le=re.match(F)[0])),re=re.replace(C,`
|
|
`);var H=re.match(/^[\t ]*/)[0];this._output=new m(this._options,H),this._input=new _(re),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var ye=0,be=!1,Ee=!1,We=!1,$=!1,D=!1,O=this._ch,B=!1,Q,G,g;Q=this._input.read(w),G=Q!=="",g=O,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),O=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var v=this._input.read(I),L=T.get_directives(v);L&&L.ignore==="start"&&(v+=T.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(N)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(G),this.print_string(this._ch);var X=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);X.match(/[ :]$/)&&(X=this.eatString(": ").replace(/\s+$/,""),this.print_string(X),this._output.space_before_token=!0),ye===0&&X.indexOf(":")!==-1&&(Ee=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(G),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var Ae=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Ae.match(/[ :]$/)&&(Ae=this.eatString(": ").replace(/\s+$/,""),this.print_string(Ae),this._output.space_before_token=!0),ye===0&&Ae.indexOf(":")!==-1?(Ee=!0,this.indent()):Ae in this.NESTED_AT_RULE?(this._nestedLevel+=1,Ae in this.CONDITIONAL_GROUP_RULE&&(We=!0)):ye===0&&!Ee&&($=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(G),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")Ee&&(Ee=!1,this.outdent()),$=!1,We?(We=!1,be=this._indentLevel>=this._nestedLevel):be=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&be&&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)):(g==="("?this._output.space_before_token=!1:g!==","&&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(),g==="{"&&this._output.trim(!0),Ee&&(this.outdent(),Ee=!1),this.print_string(this._ch),be=!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 Be=0;Be<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Be++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Be])){B=!0;break}(be||We)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!$&&ye===0?(this.print_string(":"),Ee||(Ee=!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 ht=g==='"'||g==="'";this.preserveSingleSpace(ht||G),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")B=!1,ye===0?(Ee&&(this.outdent(),Ee=!1),$=!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(),ye++,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(")")),ye&&(ye--,this.outdent()));else{var Ke=!1;this._input.lookBack("with")&&(Ke=!0),this.preserveSingleSpace(G||Ke),this.print_string(this._ch),Ee&&g==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),D=!0):(this.eatWhitespace(),ye++,this.indent())}else if(this._ch===")")ye&&(ye--,this.outdent()),D&&this._input.peek()===";"&&this._options.selector_separator_newline&&(D=!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&&(!Ee||D)&&ye===0&&!$?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!Ee&&ye===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&&P.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(G),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),P.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 yt=g==='"'||g==="'";this.preserveSingleSpace(yt||G),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&B&&this._output.add_new_line()}var ot=this._output.get_code(le);return ot},J.exports.Beautifier=q},function(J,l,z){var x=z(6).Options;function m(_){x.call(this,_,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var b=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||b;var T=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var F=0;F<T.length;F++)T[F]!=="expand"?this.brace_style="collapse":this.brace_style=T[F]}m.prototype=new x,J.exports.Options=m}],M={};function p(J){var l=M[J];if(l!==void 0)return l.exports;var z=M[J]={exports:{}};return te[J](z,z.exports,p),z.exports}var ce=p(15);de=ce})();var Ie=de;W=[],V=function(){return{css_beautify:Ie}}.apply(at,W),V!==void 0&&(Ut.exports=V)})()},40998:function(Ut,at,W){var V,de;(function(){var Ie;(function(){"use strict";var ce=[,,function(x){function m(T){this.__parent=T,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=[]}m.prototype.clone_empty=function(){var T=new m(this.__parent);return T.set_indent(this.__indent_count,this.__alignment_count),T},m.prototype.item=function(T){return T<0?this.__items[this.__items.length+T]:this.__items[T]},m.prototype.has_match=function(T){for(var F=this.__items.length-1;F>=0;F--)if(this.__items[F].match(T))return!0;return!1},m.prototype.set_indent=function(T,F){this.is_empty()&&(this.__indent_count=T||0,this.__alignment_count=F||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},m.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)},m.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},m.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var T=this.__parent.current_line;return T.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),T.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),T.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,T.__items[0]===" "&&(T.__items.splice(0,1),T.__character_count-=1),!0}return!1},m.prototype.is_empty=function(){return this.__items.length===0},m.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},m.prototype.push=function(T){this.__items.push(T);var F=T.lastIndexOf(`
|
|
`);F!==-1?this.__character_count=T.length-F:this.__character_count+=T.length},m.prototype.pop=function(){var T=null;return this.is_empty()||(T=this.__items.pop(),this.__character_count-=T.length),T},m.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},m.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},m.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},m.prototype.toString=function(){var T="";return this.is_empty()?this.__parent.indent_empty_lines&&(T=this.__parent.get_indent_string(this.__indent_count)):(T=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),T+=this.__items.join("")),T};function _(T,F){this.__cache=[""],this.__indent_size=T.indent_size,this.__indent_string=T.indent_char,T.indent_with_tabs||(this.__indent_string=new Array(T.indent_size+1).join(T.indent_char)),F=F||"",T.indent_level>0&&(F=new Array(T.indent_level+1).join(this.__indent_string)),this.__base_string=F,this.__base_string_length=F.length}_.prototype.get_indent_size=function(T,F){var C=this.__base_string_length;return F=F||0,T<0&&(C=0),C+=T*this.__indent_size,C+=F,C},_.prototype.get_indent_string=function(T,F){var C=this.__base_string;return F=F||0,T<0&&(T=0,C=""),F+=T*this.__indent_size,this.__ensure_cache(F),C+=this.__cache[F],C},_.prototype.__ensure_cache=function(T){for(;T>=this.__cache.length;)this.__add_column()},_.prototype.__add_column=function(){var T=this.__cache.length,F=0,C="";this.__indent_size&&T>=this.__indent_size&&(F=Math.floor(T/this.__indent_size),T-=F*this.__indent_size,C=new Array(F+1).join(this.__indent_string)),T&&(C+=new Array(T+1).join(" ")),this.__cache.push(C)};function b(T,F){this.__indent_cache=new _(T,F),this.raw=!1,this._end_with_newline=T.end_with_newline,this.indent_size=T.indent_size,this.wrap_line_length=T.wrap_line_length,this.indent_empty_lines=T.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new m(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}b.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},b.prototype.get_line_number=function(){return this.__lines.length},b.prototype.get_indent_string=function(T,F){return this.__indent_cache.get_indent_string(T,F)},b.prototype.get_indent_size=function(T,F){return this.__indent_cache.get_indent_size(T,F)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(T){return this.is_empty()||!T&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.prototype.get_code=function(T){this.trim(!0);var F=this.current_line.pop();F&&(F[F.length-1]===`
|
|
`&&(F=F.replace(/\n+$/g,"")),this.current_line.push(F)),this._end_with_newline&&this.__add_outputline();var C=this.__lines.join(`
|
|
`);return T!==`
|
|
`&&(C=C.replace(/[\n]/g,T)),C},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.prototype.set_indent=function(T,F){return T=T||0,F=F||0,this.next_line.set_indent(T,F),this.__lines.length>1?(this.current_line.set_indent(T,F),!0):(this.current_line.set_indent(),!1)},b.prototype.add_raw_token=function(T){for(var F=0;F<T.newlines;F++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(T.whitespace_before),this.current_line.push(T.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},b.prototype.add_token=function(T){this.__add_space_before_token(),this.current_line.push(T),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},b.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(" "))},b.prototype.remove_indent=function(T){for(var F=this.__lines.length;T<F;)this.__lines[T]._remove_indent(),T++;this.current_line._remove_wrap_indent()},b.prototype.trim=function(T){for(T=T===void 0?!1:T,this.current_line.trim();T&&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},b.prototype.just_added_newline=function(){return this.current_line.is_empty()},b.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},b.prototype.ensure_empty_line_above=function(T,F){for(var C=this.__lines.length-2;C>=0;){var P=this.__lines[C];if(P.is_empty())break;if(P.item(0).indexOf(T)!==0&&P.item(-1)!==F){this.__lines.splice(C+1,0,new m(this)),this.previous_line=this.__lines[this.__lines.length-2];break}C--}},x.exports.Output=b},function(x){function m(_,b,T,F){this.type=_,this.text=b,this.comments_before=null,this.newlines=T||0,this.whitespace_before=F||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}x.exports.Token=m},,,function(x){function m(T,F){this.raw_options=_(T,F),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"])}m.prototype._get_array=function(T,F){var C=this.raw_options[T],P=F||[];return typeof C=="object"?C!==null&&typeof C.concat=="function"&&(P=C.concat()):typeof C=="string"&&(P=C.split(/[^a-zA-Z0-9_\/\-]+/)),P},m.prototype._get_boolean=function(T,F){var C=this.raw_options[T],P=C===void 0?!!F:!!C;return P},m.prototype._get_characters=function(T,F){var C=this.raw_options[T],P=F||"";return typeof C=="string"&&(P=C.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),P},m.prototype._get_number=function(T,F){var C=this.raw_options[T];F=parseInt(F,10),isNaN(F)&&(F=0);var P=parseInt(C,10);return isNaN(P)&&(P=F),P},m.prototype._get_selection=function(T,F,C){var P=this._get_selection_list(T,F,C);if(P.length!==1)throw new Error("Invalid Option Value: The option '"+T+`' can only be one of the following values:
|
|
`+F+`
|
|
You passed in: '`+this.raw_options[T]+"'");return P[0]},m.prototype._get_selection_list=function(T,F,C){if(!F||F.length===0)throw new Error("Selection list cannot be empty.");if(C=C||[F[0]],!this._is_valid_selection(C,F))throw new Error("Invalid Default Value!");var P=this._get_array(T,C);if(!this._is_valid_selection(P,F))throw new Error("Invalid Option Value: The option '"+T+`' can contain only the following values:
|
|
`+F+`
|
|
You passed in: '`+this.raw_options[T]+"'");return P},m.prototype._is_valid_selection=function(T,F){return T.length&&F.length&&!T.some(function(C){return F.indexOf(C)===-1})};function _(T,F){var C={};T=b(T);var P;for(P in T)P!==F&&(C[P]=T[P]);if(F&&T[F])for(P in T[F])C[P]=T[F][P];return C}function b(T){var F={},C;for(C in T){var P=C.replace(/-/g,"_");F[P]=T[C]}return F}x.exports.Options=m,x.exports.normalizeOpts=b,x.exports.mergeOpts=_},,function(x){var m=RegExp.prototype.hasOwnProperty("sticky");function _(b){this.__input=b||"",this.__input_length=this.__input.length,this.__position=0}_.prototype.restart=function(){this.__position=0},_.prototype.back=function(){this.__position>0&&(this.__position-=1)},_.prototype.hasNext=function(){return this.__position<this.__input_length},_.prototype.next=function(){var b=null;return this.hasNext()&&(b=this.__input.charAt(this.__position),this.__position+=1),b},_.prototype.peek=function(b){var T=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(T=this.__input.charAt(b)),T},_.prototype.__match=function(b,T){b.lastIndex=T;var F=b.exec(this.__input);return F&&!(m&&b.sticky)&&F.index!==T&&(F=null),F},_.prototype.test=function(b,T){return T=T||0,T+=this.__position,T>=0&&T<this.__input_length?!!this.__match(b,T):!1},_.prototype.testChar=function(b,T){var F=this.peek(T);return b.lastIndex=0,F!==null&&b.test(F)},_.prototype.match=function(b){var T=this.__match(b,this.__position);return T?this.__position+=T[0].length:T=null,T},_.prototype.read=function(b,T,F){var C="",P;return b&&(P=this.match(b),P&&(C+=P[0])),T&&(P||!b)&&(C+=this.readUntil(T,F)),C},_.prototype.readUntil=function(b,T){var F="",C=this.__position;b.lastIndex=this.__position;var P=b.exec(this.__input);return P?(C=P.index,T&&(C+=P[0].length)):C=this.__input_length,F=this.__input.substring(this.__position,C),this.__position=C,F},_.prototype.readUntilAfter=function(b){return this.readUntil(b,!0)},_.prototype.get_regexp=function(b,T){var F=null,C="g";return T&&m&&(C="y"),typeof b=="string"&&b!==""?F=new RegExp(b,C):b&&(F=new RegExp(b.source,C)),F},_.prototype.get_literal_regexp=function(b){return RegExp(b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},_.prototype.peekUntilAfter=function(b){var T=this.__position,F=this.readUntilAfter(b);return this.__position=T,F},_.prototype.lookBack=function(b){var T=this.__position-1;return T>=b.length&&this.__input.substring(T-b.length,T).toLowerCase()===b},x.exports.InputScanner=_},function(x,m,_){var b=_(8).InputScanner,T=_(3).Token,F=_(10).TokenStream,C=_(11).WhitespacePattern,P={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},w=function(I,N){this._input=new b(I),this._options=N||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new C(this._input)};w.prototype.tokenize=function(){this._input.restart(),this.__tokens=new F,this._reset();for(var I,N=new T(P.START,""),q=null,re=[],le=new F;N.type!==P.EOF;){for(I=this._get_next_token(N,q);this._is_comment(I);)le.add(I),I=this._get_next_token(N,q);le.isEmpty()||(I.comments_before=le,le=new F),I.parent=q,this._is_opening(I)?(re.push(q),q=I):q&&this._is_closing(I,q)&&(I.opened=q,q.closed=I,q=re.pop(),I.parent=q),I.previous=N,N.next=I,this.__tokens.add(I),N=I}return this.__tokens},w.prototype._is_first_token=function(){return this.__tokens.isEmpty()},w.prototype._reset=function(){},w.prototype._get_next_token=function(I,N){this._readWhitespace();var q=this._input.read(/.+/g);return q?this._create_token(P.RAW,q):this._create_token(P.EOF,"")},w.prototype._is_comment=function(I){return!1},w.prototype._is_opening=function(I){return!1},w.prototype._is_closing=function(I,N){return!1},w.prototype._create_token=function(I,N){var q=new T(I,N,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return q},w.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},x.exports.Tokenizer=w,x.exports.TOKEN=P},function(x){function m(_){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=_}m.prototype.restart=function(){this.__position=0},m.prototype.isEmpty=function(){return this.__tokens_length===0},m.prototype.hasNext=function(){return this.__position<this.__tokens_length},m.prototype.next=function(){var _=null;return this.hasNext()&&(_=this.__tokens[this.__position],this.__position+=1),_},m.prototype.peek=function(_){var b=null;return _=_||0,_+=this.__position,_>=0&&_<this.__tokens_length&&(b=this.__tokens[_]),b},m.prototype.add=function(_){this.__parent_token&&(_.parent=this.__parent_token),this.__tokens.push(_),this.__tokens_length+=1},x.exports.TokenStream=m},function(x,m,_){var b=_(12).Pattern;function T(F,C){b.call(this,F,C),C?this._line_regexp=this._input.get_regexp(C._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}T.prototype=new b,T.prototype.__set_whitespace_patterns=function(F,C){F+="\\t ",C+="\\n\\r",this._match_pattern=this._input.get_regexp("["+F+C+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+C+"]")},T.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var F=this._input.read(this._match_pattern);if(F===" ")this.whitespace_before_token=" ";else if(F){var C=this.__split(this._newline_regexp,F);this.newline_count=C.length-1,this.whitespace_before_token=C[this.newline_count]}return F},T.prototype.matching=function(F,C){var P=this._create();return P.__set_whitespace_patterns(F,C),P._update(),P},T.prototype._create=function(){return new T(this._input,this)},T.prototype.__split=function(F,C){F.lastIndex=0;for(var P=0,w=[],I=F.exec(C);I;)w.push(C.substring(P,I.index)),P=I.index+I[0].length,I=F.exec(C);return P<C.length?w.push(C.substring(P,C.length)):w.push(""),w},x.exports.WhitespacePattern=T},function(x){function m(_,b){this._input=_,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,b&&(this._starting_pattern=this._input.get_regexp(b._starting_pattern,!0),this._match_pattern=this._input.get_regexp(b._match_pattern,!0),this._until_pattern=this._input.get_regexp(b._until_pattern),this._until_after=b._until_after)}m.prototype.read=function(){var _=this._input.read(this._starting_pattern);return(!this._starting_pattern||_)&&(_+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),_},m.prototype.read_match=function(){return this._input.match(this._match_pattern)},m.prototype.until_after=function(_){var b=this._create();return b._until_after=!0,b._until_pattern=this._input.get_regexp(_),b._update(),b},m.prototype.until=function(_){var b=this._create();return b._until_after=!1,b._until_pattern=this._input.get_regexp(_),b._update(),b},m.prototype.starting_with=function(_){var b=this._create();return b._starting_pattern=this._input.get_regexp(_,!0),b._update(),b},m.prototype.matching=function(_){var b=this._create();return b._match_pattern=this._input.get_regexp(_,!0),b._update(),b},m.prototype._create=function(){return new m(this._input,this)},m.prototype._update=function(){},x.exports.Pattern=m},function(x){function m(_,b){_=typeof _=="string"?_:_.source,b=typeof b=="string"?b:b.source,this.__directives_block_pattern=new RegExp(_+/ beautify( \w+[:]\w+)+ /.source+b,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(_+/\sbeautify\signore:end\s/.source+b,"g")}m.prototype.get_directives=function(_){if(!_.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var T=this.__directive_pattern.exec(_);T;)b[T[1]]=T[2],T=this.__directive_pattern.exec(_);return b},m.prototype.readIgnored=function(_){return _.readUntilAfter(this.__directives_end_ignore_pattern)},x.exports.Directives=m},function(x,m,_){var b=_(12).Pattern,T={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function F(C,P){b.call(this,C,P),this.__template_pattern=null,this._disabled=Object.assign({},T),this._excluded=Object.assign({},T),P&&(this.__template_pattern=this._input.get_regexp(P.__template_pattern),this._excluded=Object.assign(this._excluded,P._excluded),this._disabled=Object.assign(this._disabled,P._disabled));var w=new b(C);this.__patterns={handlebars_comment:w.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:w.starting_with(/{{{/).until_after(/}}}/),handlebars:w.starting_with(/{{/).until_after(/}}/),php:w.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:w.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:w.starting_with(/{%/).until_after(/%}/),django_value:w.starting_with(/{{/).until_after(/}}/),django_comment:w.starting_with(/{#/).until_after(/#}/),smarty:w.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:w.starting_with(/{\*/).until_after(/\*}/),smarty_literal:w.starting_with(/{literal}/).until_after(/{\/literal}/)}}F.prototype=new b,F.prototype._create=function(){return new F(this._input,this)},F.prototype._update=function(){this.__set_templated_pattern()},F.prototype.disable=function(C){var P=this._create();return P._disabled[C]=!0,P._update(),P},F.prototype.read_options=function(C){var P=this._create();for(var w in T)P._disabled[w]=C.templating.indexOf(w)===-1;return P._update(),P},F.prototype.exclude=function(C){var P=this._create();return P._excluded[C]=!0,P._update(),P},F.prototype.read=function(){var C="";this._match_pattern?C=this._input.read(this._starting_pattern):C=this._input.read(this._starting_pattern,this.__template_pattern);for(var P=this._read_template();P;)this._match_pattern?P+=this._input.read(this._match_pattern):P+=this._input.readUntil(this.__template_pattern),C+=P,P=this._read_template();return this._until_after&&(C+=this._input.readUntilAfter(this._until_pattern)),C},F.prototype.__set_templated_pattern=function(){var C=[];this._disabled.php||C.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||C.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||C.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||C.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(C.push(this.__patterns.django._starting_pattern.source),C.push(this.__patterns.django_value._starting_pattern.source),C.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||C.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&C.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+C.join("|")+")")},F.prototype._read_template=function(){var C="",P=this._input.peek();if(P==="<"){var w=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&w==="?"&&(C=C||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&w==="%"&&(C=C||this.__patterns.erb.read())}else P==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(C=C||this.__patterns.handlebars_comment.read(),C=C||this.__patterns.handlebars_unescaped.read(),C=C||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(C=C||this.__patterns.django_value.read()),this._excluded.django||(C=C||this.__patterns.django_comment.read(),C=C||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(C=C||this.__patterns.smarty_comment.read(),C=C||this.__patterns.smarty_literal.read(),C=C||this.__patterns.smarty.read()));return C},x.exports.TemplatablePattern=F},,,,function(x,m,_){var b=_(19).Beautifier,T=_(20).Options;function F(C,P,w,I){var N=new b(C,P,w,I);return N.beautify()}x.exports=F,x.exports.defaultOptions=function(){return new T}},function(x,m,_){var b=_(20).Options,T=_(2).Output,F=_(21).Tokenizer,C=_(21).TOKEN,P=/\r\n|[\r\n]/,w=/\r\n|[\r\n]/g,I=function($,D){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=$.max_preserve_newlines,this.preserve_newlines=$.preserve_newlines,this._output=new T($,D)};I.prototype.current_line_has_match=function($){return this._output.current_line.has_match($)},I.prototype.set_space_before_token=function($,D){this._output.space_before_token=$,this._output.non_breaking_space=D},I.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},I.prototype.add_raw_token=function($){this._output.add_raw_token($)},I.prototype.print_preserved_newlines=function($){var D=0;$.type!==C.TEXT&&$.previous.type!==C.TEXT&&(D=$.newlines?1:0),this.preserve_newlines&&(D=$.newlines<this.max_preserve_newlines+1?$.newlines:this.max_preserve_newlines+1);for(var O=0;O<D;O++)this.print_newline(O>0);return D!==0},I.prototype.traverse_whitespace=function($){return $.whitespace_before||$.newlines?(this.print_preserved_newlines($)||(this._output.space_before_token=!0),!0):!1},I.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},I.prototype.print_newline=function($){this._output.add_new_line($)},I.prototype.print_token=function($){$.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token($.text))},I.prototype.indent=function(){this.indent_level++},I.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},I.prototype.get_full_indent=function($){return $=this.indent_level+($||0),$<1?"":this._output.get_indent_string($)};var N=function($){for(var D=null,O=$.next;O.type!==C.EOF&&$.closed!==O;){if(O.type===C.ATTRIBUTE&&O.text==="type"){O.next&&O.next.type===C.EQUALS&&O.next.next&&O.next.next.type===C.VALUE&&(D=O.next.next.text);break}O=O.next}return D},q=function($,D){var O=null,B=null;return D.closed?($==="script"?O="text/javascript":$==="style"&&(O="text/css"),O=N(D)||O,O.search("text/css")>-1?B="css":O.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?B="javascript":O.search(/(text|application|dojo)\/(x-)?(html)/)>-1?B="html":O.search(/test\/null/)>-1&&(B="null"),B):null};function re($,D){return D.indexOf($)!==-1}function le($,D,O){this.parent=$||null,this.tag=D?D.tag_name:"",this.indent_level=O||0,this.parser_token=D||null}function H($){this._printer=$,this._current_frame=null}H.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},H.prototype.record_tag=function($){var D=new le(this._current_frame,$,this._printer.indent_level);this._current_frame=D},H.prototype._try_pop_frame=function($){var D=null;return $&&(D=$.parser_token,this._printer.indent_level=$.indent_level,this._current_frame=$.parent),D},H.prototype._get_frame=function($,D){for(var O=this._current_frame;O&&$.indexOf(O.tag)===-1;){if(D&&D.indexOf(O.tag)!==-1){O=null;break}O=O.parent}return O},H.prototype.try_pop=function($,D){var O=this._get_frame([$],D);return this._try_pop_frame(O)},H.prototype.indent_to_tag=function($){var D=this._get_frame($);D&&(this._printer.indent_level=D.indent_level)};function ye($,D,O,B){this._source_text=$||"",D=D||{},this._js_beautify=O,this._css_beautify=B,this._tag_stack=null;var Q=new b(D,"html");this._options=Q,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"}ye.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var $=this._source_text,D=this._options.eol;this._options.eol==="auto"&&(D=`
|
|
`,$&&P.test($)&&(D=$.match(P)[0])),$=$.replace(w,`
|
|
`);var O=$.match(/^[\t ]*/)[0],B={text:"",type:""},Q=new be(this._options),G=new I(this._options,O),g=new F($,this._options).tokenize();this._tag_stack=new H(G);for(var v=null,L=g.next();L.type!==C.EOF;)L.type===C.TAG_OPEN||L.type===C.COMMENT?(v=this._handle_tag_open(G,L,Q,B,g),Q=v):L.type===C.ATTRIBUTE||L.type===C.EQUALS||L.type===C.VALUE||L.type===C.TEXT&&!Q.tag_complete?v=this._handle_inside_tag(G,L,Q,B):L.type===C.TAG_CLOSE?v=this._handle_tag_close(G,L,Q):L.type===C.TEXT?v=this._handle_text(G,L,Q):L.type===C.CONTROL_FLOW_OPEN?v=this._handle_control_flow_open(G,L):L.type===C.CONTROL_FLOW_CLOSE?v=this._handle_control_flow_close(G,L):G.add_raw_token(L),B=v,L=g.next();var X=G._output.get_code(D);return X},ye.prototype._handle_control_flow_open=function($,D){var O={text:D.text,type:D.type};return $.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),D.newlines?$.print_preserved_newlines(D):$.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),$.print_token(D),$.indent(),O},ye.prototype._handle_control_flow_close=function($,D){var O={text:D.text,type:D.type};return $.deindent(),D.newlines?$.print_preserved_newlines(D):$.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),$.print_token(D),O},ye.prototype._handle_tag_close=function($,D,O){var B={text:D.text,type:D.type};return $.alignment_size=0,O.tag_complete=!0,$.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),O.is_unformatted?$.add_raw_token(D):(O.tag_start_char==="<"&&($.set_space_before_token(D.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&O.has_wrapped_attrs&&$.print_newline(!1)),$.print_token(D)),O.indent_content&&!(O.is_unformatted||O.is_content_unformatted)&&($.indent(),O.indent_content=!1),!O.is_inline_element&&!(O.is_unformatted||O.is_content_unformatted)&&$.set_wrap_point(),B},ye.prototype._handle_inside_tag=function($,D,O,B){var Q=O.has_wrapped_attrs,G={text:D.text,type:D.type};return $.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),O.is_unformatted?$.add_raw_token(D):O.tag_start_char==="{"&&D.type===C.TEXT?$.print_preserved_newlines(D)?(D.newlines=0,$.add_raw_token(D)):$.print_token(D):(D.type===C.ATTRIBUTE?$.set_space_before_token(!0):(D.type===C.EQUALS||D.type===C.VALUE&&D.previous.type===C.EQUALS)&&$.set_space_before_token(!1),D.type===C.ATTRIBUTE&&O.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&($.traverse_whitespace(D),Q=Q||D.newlines!==0),this._is_wrap_attributes_force&&O.attr_count>=this._options.wrap_attributes_min_attrs&&(B.type!==C.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&($.print_newline(!1),Q=!0)),$.print_token(D),Q=Q||$.previous_token_wrapped(),O.has_wrapped_attrs=Q),G},ye.prototype._handle_text=function($,D,O){var B={text:D.text,type:"TK_CONTENT"};return O.custom_beautifier_name?this._print_custom_beatifier_text($,D,O):O.is_unformatted||O.is_content_unformatted?$.add_raw_token(D):($.traverse_whitespace(D),$.print_token(D)),B},ye.prototype._print_custom_beatifier_text=function($,D,O){var B=this;if(D.text!==""){var Q=D.text,G,g=1,v="",L="";O.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?G=this._js_beautify:O.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?G=this._css_beautify:O.custom_beautifier_name==="html"&&(G=function(yt,ot){var je=new ye(yt,ot,B._js_beautify,B._css_beautify);return je.beautify()}),this._options.indent_scripts==="keep"?g=0:this._options.indent_scripts==="separate"&&(g=-$.indent_level);var X=$.get_full_indent(g);if(Q=Q.replace(/\n[ \t]*$/,""),O.custom_beautifier_name!=="html"&&Q[0]==="<"&&Q.match(/^(<!--|<!\[CDATA\[)/)){var Ae=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(Q);if(!Ae){$.add_raw_token(D);return}v=X+Ae[1]+`
|
|
`,Q=Ae[4],Ae[5]&&(L=X+Ae[5]),Q=Q.replace(/\n[ \t]*$/,""),(Ae[2]||Ae[3].indexOf(`
|
|
`)!==-1)&&(Ae=Ae[3].match(/[ \t]+$/),Ae&&(D.whitespace_before=Ae[0]))}if(Q)if(G){var Be=function(){this.eol=`
|
|
`};Be.prototype=this._options.raw_options;var ht=new Be;Q=G(X+Q,ht)}else{var Ke=D.whitespace_before;Ke&&(Q=Q.replace(new RegExp(`
|
|
(`+Ke+")?","g"),`
|
|
`)),Q=X+Q.replace(/\n/g,`
|
|
`+X)}v&&(Q?Q=v+Q+`
|
|
`+L:Q=v+L),$.print_newline(!1),Q&&(D.text=Q,D.whitespace_before="",D.newlines=0,$.add_raw_token(D),$.print_newline(!0))}},ye.prototype._handle_tag_open=function($,D,O,B,Q){var G=this._get_tag_open_token(D);if((O.is_unformatted||O.is_content_unformatted)&&!O.is_empty_element&&D.type===C.TAG_OPEN&&!G.is_start_tag?($.add_raw_token(D),G.start_tag_token=this._tag_stack.try_pop(G.tag_name)):($.traverse_whitespace(D),this._set_tag_position($,D,G,O,B),G.is_inline_element||$.set_wrap_point(),$.print_token(D)),G.is_start_tag&&this._is_wrap_attributes_force){var g=0,v;do v=Q.peek(g),v.type===C.ATTRIBUTE&&(G.attr_count+=1),g+=1;while(v.type!==C.EOF&&v.type!==C.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(G.alignment_size=D.text.length+1),!G.tag_complete&&!G.is_unformatted&&($.alignment_size=G.alignment_size),G};var be=function($,D,O){if(this.parent=D||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="",!O)this.tag_complete=!0;else{var B;this.tag_start_char=O.text[0],this.text=O.text,this.tag_start_char==="<"?(B=O.text.match(/^<([^\s>]*)/),this.tag_check=B?B[1]:""):(B=O.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=B?B[1]:"",(O.text.startsWith("{{#>")||O.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&O.next!==null?this.tag_check=O.next.text.split(" ")[0]:this.tag_check=O.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),O.type===C.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||O.closed&&O.closed.text==="/>";var Q=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(Q=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!$.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(Q)))}};ye.prototype._get_tag_open_token=function($){var D=new be(this._options,this._tag_stack.get_parser_token(),$);return D.alignment_size=this._options.wrap_attributes_indent_size,D.is_end_tag=D.is_end_tag||re(D.tag_check,this._options.void_elements),D.is_empty_element=D.tag_complete||D.is_start_tag&&D.is_end_tag,D.is_unformatted=!D.tag_complete&&re(D.tag_check,this._options.unformatted),D.is_content_unformatted=!D.is_empty_element&&re(D.tag_check,this._options.content_unformatted),D.is_inline_element=re(D.tag_name,this._options.inline)||this._options.inline_custom_elements&&D.tag_name.includes("-")||D.tag_start_char==="{",D},ye.prototype._set_tag_position=function($,D,O,B,Q){if(O.is_empty_element||(O.is_end_tag?O.start_tag_token=this._tag_stack.try_pop(O.tag_name):(this._do_optional_end_element(O)&&(O.is_inline_element||$.print_newline(!1)),this._tag_stack.record_tag(O),(O.tag_name==="script"||O.tag_name==="style")&&!(O.is_unformatted||O.is_content_unformatted)&&(O.custom_beautifier_name=q(O.tag_check,D)))),re(O.tag_check,this._options.extra_liners)&&($.print_newline(!1),$._output.just_added_blankline()||$.print_newline(!0)),O.is_empty_element){if(O.tag_start_char==="{"&&O.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),O.indent_content=!0;var G=$.current_line_has_match(/{{#if/);G||$.print_newline(!1)}O.tag_name==="!--"&&Q.type===C.TAG_CLOSE&&B.is_end_tag&&O.text.indexOf(`
|
|
`)===-1||(O.is_inline_element||O.is_unformatted||$.print_newline(!1),this._calcluate_parent_multiline($,O))}else if(O.is_end_tag){var g=!1;g=O.start_tag_token&&O.start_tag_token.multiline_content,g=g||!O.is_inline_element&&!(B.is_inline_element||B.is_unformatted)&&!(Q.type===C.TAG_CLOSE&&O.start_tag_token===B)&&Q.type!=="TK_CONTENT",(O.is_content_unformatted||O.is_unformatted)&&(g=!1),g&&$.print_newline(!1)}else O.indent_content=!O.custom_beautifier_name,O.tag_start_char==="<"&&(O.tag_name==="html"?O.indent_content=this._options.indent_inner_html:O.tag_name==="head"?O.indent_content=this._options.indent_head_inner_html:O.tag_name==="body"&&(O.indent_content=this._options.indent_body_inner_html)),!(O.is_inline_element||O.is_unformatted)&&(Q.type!=="TK_CONTENT"||O.is_content_unformatted)&&$.print_newline(!1),this._calcluate_parent_multiline($,O)},ye.prototype._calcluate_parent_multiline=function($,D){D.parent&&$._output.just_added_newline()&&!((D.is_inline_element||D.is_unformatted)&&D.parent.is_inline_element)&&(D.parent.multiline_content=!0)};var Ee=["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"],We=["a","audio","del","ins","map","noscript","video"];ye.prototype._do_optional_end_element=function($){var D=null;if(!($.is_empty_element||!$.is_start_tag||!$.parent)){if($.tag_name==="body")D=D||this._tag_stack.try_pop("head");else if($.tag_name==="li")D=D||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if($.tag_name==="dd"||$.tag_name==="dt")D=D||this._tag_stack.try_pop("dt",["dl"]),D=D||this._tag_stack.try_pop("dd",["dl"]);else if($.parent.tag_name==="p"&&Ee.indexOf($.tag_name)!==-1){var O=$.parent.parent;(!O||We.indexOf(O.tag_name)===-1)&&(D=D||this._tag_stack.try_pop("p"))}else $.tag_name==="rp"||$.tag_name==="rt"?(D=D||this._tag_stack.try_pop("rt",["ruby","rtc"]),D=D||this._tag_stack.try_pop("rp",["ruby","rtc"])):$.tag_name==="optgroup"?D=D||this._tag_stack.try_pop("optgroup",["select"]):$.tag_name==="option"?D=D||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):$.tag_name==="colgroup"?D=D||this._tag_stack.try_pop("caption",["table"]):$.tag_name==="thead"?(D=D||this._tag_stack.try_pop("caption",["table"]),D=D||this._tag_stack.try_pop("colgroup",["table"])):$.tag_name==="tbody"||$.tag_name==="tfoot"?(D=D||this._tag_stack.try_pop("caption",["table"]),D=D||this._tag_stack.try_pop("colgroup",["table"]),D=D||this._tag_stack.try_pop("thead",["table"]),D=D||this._tag_stack.try_pop("tbody",["table"])):$.tag_name==="tr"?(D=D||this._tag_stack.try_pop("caption",["table"]),D=D||this._tag_stack.try_pop("colgroup",["table"]),D=D||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):($.tag_name==="th"||$.tag_name==="td")&&(D=D||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),D=D||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return $.parent=this._tag_stack.get_parser_token(),D}},x.exports.Beautifier=ye},function(x,m,_){var b=_(6).Options;function T(F){b.call(this,F,"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"])}T.prototype=new b,x.exports.Options=T},function(x,m,_){var b=_(9).Tokenizer,T=_(9).TOKEN,F=_(13).Directives,C=_(14).TemplatablePattern,P=_(12).Pattern,w={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",CONTROL_FLOW_OPEN:"TK_CONTROL_FLOW_OPEN",CONTROL_FLOW_CLOSE:"TK_CONTROL_FLOW_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:T.START,RAW:T.RAW,EOF:T.EOF},I=new F(/<\!--/,/-->/),N=function(q,re){b.call(this,q,re),this._current_tag_name="";var le=new C(this._input).read_options(this._options),H=new P(this._input);if(this.__patterns={word:le.until(/[\n\r\t <]/),word_control_flow_close_excluded:le.until(/[\n\r\t <}]/),single_quote:le.until_after(/'/),double_quote:le.until_after(/"/),attribute:le.until(/[\n\r\t =>]|\/>/),element_name:le.until(/[\n\r\t >\/]/),angular_control_flow_start:H.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:H.starting_with(/{{!--/).until_after(/--}}/),handlebars:H.starting_with(/{{/).until_after(/}}/),handlebars_open:H.until(/[\n\r\t }]/),handlebars_raw_close:H.until(/}}/),comment:H.starting_with(/<!--/).until_after(/-->/),cdata:H.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:H.starting_with(/<!\[/).until_after(/]>/),processing:H.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 ye=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=H.matching(ye).until_after(ye)}};N.prototype=new b,N.prototype._is_comment=function(q){return!1},N.prototype._is_opening=function(q){return q.type===w.TAG_OPEN||q.type===w.CONTROL_FLOW_OPEN},N.prototype._is_closing=function(q,re){return q.type===w.TAG_CLOSE&&re&&((q.text===">"||q.text==="/>")&&re.text[0]==="<"||q.text==="}}"&&re.text[0]==="{"&&re.text[1]==="{")||q.type===w.CONTROL_FLOW_CLOSE&&q.text==="}"&&re.text.endsWith("{")},N.prototype._reset=function(){this._current_tag_name=""},N.prototype._get_next_token=function(q,re){var le=null;this._readWhitespace();var H=this._input.peek();return H===null?this._create_token(w.EOF,""):(le=le||this._read_open_handlebars(H,re),le=le||this._read_attribute(H,q,re),le=le||this._read_close(H,re),le=le||this._read_script_and_style(H,q),le=le||this._read_control_flows(H,re),le=le||this._read_raw_content(H,q,re),le=le||this._read_content_word(H,re),le=le||this._read_comment_or_cdata(H),le=le||this._read_processing(H),le=le||this._read_open(H,re),le=le||this._create_token(w.UNKNOWN,this._input.next()),le)},N.prototype._read_comment_or_cdata=function(q){var re=null,le=null,H=null;if(q==="<"){var ye=this._input.peek(1);ye==="!"&&(le=this.__patterns.comment.read(),le?(H=I.get_directives(le),H&&H.ignore==="start"&&(le+=I.readIgnored(this._input))):le=this.__patterns.cdata.read()),le&&(re=this._create_token(w.COMMENT,le),re.directives=H)}return re},N.prototype._read_processing=function(q){var re=null,le=null,H=null;if(q==="<"){var ye=this._input.peek(1);(ye==="!"||ye==="?")&&(le=this.__patterns.conditional_comment.read(),le=le||this.__patterns.processing.read()),le&&(re=this._create_token(w.COMMENT,le),re.directives=H)}return re},N.prototype._read_open=function(q,re){var le=null,H=null;return(!re||re.type===w.CONTROL_FLOW_OPEN)&&q==="<"&&(le=this._input.next(),this._input.peek()==="/"&&(le+=this._input.next()),le+=this.__patterns.element_name.read(),H=this._create_token(w.TAG_OPEN,le)),H},N.prototype._read_open_handlebars=function(q,re){var le=null,H=null;return(!re||re.type===w.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&q==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(le=this.__patterns.handlebars_comment.read(),le=le||this.__patterns.handlebars.read(),H=this._create_token(w.COMMENT,le)):(le=this.__patterns.handlebars_open.read(),H=this._create_token(w.TAG_OPEN,le))),H},N.prototype._read_control_flows=function(q,re){var le="",H=null;if(!this._options.templating.includes("angular"))return H;if(q==="@"){if(le=this.__patterns.angular_control_flow_start.read(),le==="")return H;for(var ye=le.endsWith("(")?1:0,be=0;!(le.endsWith("{")&&ye===be);){var Ee=this._input.next();if(Ee===null)break;Ee==="("?ye++:Ee===")"&&be++,le+=Ee}H=this._create_token(w.CONTROL_FLOW_OPEN,le)}else q==="}"&&re&&re.type===w.CONTROL_FLOW_OPEN&&(le=this._input.next(),H=this._create_token(w.CONTROL_FLOW_CLOSE,le));return H},N.prototype._read_close=function(q,re){var le=null,H=null;return re&&re.type===w.TAG_OPEN&&(re.text[0]==="<"&&(q===">"||q==="/"&&this._input.peek(1)===">")?(le=this._input.next(),q==="/"&&(le+=this._input.next()),H=this._create_token(w.TAG_CLOSE,le)):re.text[0]==="{"&&q==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),H=this._create_token(w.TAG_CLOSE,"}}"))),H},N.prototype._read_attribute=function(q,re,le){var H=null,ye="";if(le&&le.text[0]==="<")if(q==="=")H=this._create_token(w.EQUALS,this._input.next());else if(q==='"'||q==="'"){var be=this._input.next();q==='"'?be+=this.__patterns.double_quote.read():be+=this.__patterns.single_quote.read(),H=this._create_token(w.VALUE,be)}else ye=this.__patterns.attribute.read(),ye&&(re.type===w.EQUALS?H=this._create_token(w.VALUE,ye):H=this._create_token(w.ATTRIBUTE,ye));return H},N.prototype._is_content_unformatted=function(q){return this._options.void_elements.indexOf(q)===-1&&(this._options.content_unformatted.indexOf(q)!==-1||this._options.unformatted.indexOf(q)!==-1)},N.prototype._read_raw_content=function(q,re,le){var H="";if(le&&le.text[0]==="{")H=this.__patterns.handlebars_raw_close.read();else if(re.type===w.TAG_CLOSE&&re.opened.text[0]==="<"&&re.text[0]!=="/"){var ye=re.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ye)&&(H=this._input.readUntil(new RegExp("</"+ye+"[\\n\\r\\t ]*?>","ig")))}return H?this._create_token(w.TEXT,H):null},N.prototype._read_script_and_style=function(q,re){if(re.type===w.TAG_CLOSE&&re.opened.text[0]==="<"&&re.text[0]!=="/"){var le=re.opened.text.substr(1).toLowerCase();if(le==="script"||le==="style"){var H=this._read_comment_or_cdata(q);if(H)return H.type=w.TEXT,H;var ye=this._input.readUntil(new RegExp("</"+le+"[\\n\\r\\t ]*?>","ig"));if(ye)return this._create_token(w.TEXT,ye)}}return null},N.prototype._read_content_word=function(q,re){var le="";return this._options.unformatted_content_delimiter&&q===this._options.unformatted_content_delimiter[0]&&(le=this.__patterns.unformatted_content_delimiter.read()),le||(le=re&&re.type===w.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),le?this._create_token(w.TEXT,le):null},x.exports.Tokenizer=N,x.exports.TOKEN=w}],J={};function l(x){var m=J[x];if(m!==void 0)return m.exports;var _=J[x]={exports:{}};return ce[x](_,_.exports,l),_.exports}var z=l(18);Ie=z})();var te=Ie;if(1)V=[W,W(58553),W(87804)],de=function(ce){var J=W(58553),l=W(87804);return{html_beautify:function(z,x){return te(z,x,J.js_beautify,l.css_beautify)}}}.apply(at,V),de!==void 0&&(Ut.exports=de);else var M,p})()},58553:function(Ut,at){var W,V;(function(){var de;(function(){"use strict";var te=[function(J,l,z){var x=z(1).Beautifier,m=z(5).Options;function _(b,T){var F=new x(b,T);return F.beautify()}J.exports=_,J.exports.defaultOptions=function(){return new m}},function(J,l,z){var x=z(2).Output,m=z(3).Token,_=z(4),b=z(5).Options,T=z(7).Tokenizer,F=z(7).line_starters,C=z(7).positionable_operators,P=z(7).TOKEN;function w(v,L){return L.indexOf(v)!==-1}function I(v){return v.replace(/^\s+/g,"")}function N(v){for(var L={},X=0;X<v.length;X++)L[v[X].replace(/-/g,"_")]=v[X];return L}function q(v,L){return v&&v.type===P.RESERVED&&v.text===L}function re(v,L){return v&&v.type===P.RESERVED&&w(v.text,L)}var le=["case","return","do","if","throw","else","await","break","continue","async"],H=["before-newline","after-newline","preserve-newline"],ye=N(H),be=[ye.before_newline,ye.preserve_newline],Ee={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function We(v,L){L.multiline_frame||L.mode===Ee.ForInitializer||L.mode===Ee.Conditional||v.remove_indent(L.start_line_index)}function $(v){v=v.replace(_.allLineBreaks,`
|
|
`);for(var L=[],X=v.indexOf(`
|
|
`);X!==-1;)L.push(v.substring(0,X)),v=v.substring(X+1),X=v.indexOf(`
|
|
`);return v.length&&L.push(v),L}function D(v){return v===Ee.ArrayLiteral}function O(v){return w(v,[Ee.Expression,Ee.ForInitializer,Ee.Conditional])}function B(v,L){for(var X=0;X<v.length;X++){var Ae=v[X].trim();if(Ae.charAt(0)!==L)return!1}return!0}function Q(v,L){for(var X=0,Ae=v.length,Be;X<Ae;X++)if(Be=v[X],Be&&Be.indexOf(L)!==0)return!1;return!0}function G(v,L){L=L||{},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 b(L)}G.prototype.create_flags=function(v,L){var X=0;v&&(X=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>X&&(X=v.line_indent_level));var Ae={mode:L,parent:v,last_token:v?v.last_token:new m(P.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:X,alignment:0,line_indent_level:v?v.line_indent_level:X,start_line_index:this._output.get_line_number(),ternary_depth:0};return Ae},G.prototype._reset=function(v){var L=v.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new x(this._options,L),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Ee.BlockStatement);var X=new T(v,this._options);return this._tokens=X.tokenize(),v},G.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,L=this._reset(this._source_text),X=this._options.eol;this._options.eol==="auto"&&(X=`
|
|
`,L&&_.lineBreak.test(L||"")&&(X=L.match(_.lineBreak)[0]));for(var Ae=this._tokens.next();Ae;)this.handle_token(Ae),this._last_last_text=this._flags.last_token.text,this._flags.last_token=Ae,Ae=this._tokens.next();return v=this._output.get_code(X),v},G.prototype.handle_token=function(v,L){v.type===P.START_EXPR?this.handle_start_expr(v):v.type===P.END_EXPR?this.handle_end_expr(v):v.type===P.START_BLOCK?this.handle_start_block(v):v.type===P.END_BLOCK?this.handle_end_block(v):v.type===P.WORD?this.handle_word(v):v.type===P.RESERVED?this.handle_word(v):v.type===P.SEMICOLON?this.handle_semicolon(v):v.type===P.STRING?this.handle_string(v):v.type===P.EQUALS?this.handle_equals(v):v.type===P.OPERATOR?this.handle_operator(v):v.type===P.COMMA?this.handle_comma(v):v.type===P.BLOCK_COMMENT?this.handle_block_comment(v,L):v.type===P.COMMENT?this.handle_comment(v,L):v.type===P.DOT?this.handle_dot(v):v.type===P.EOF?this.handle_eof(v):v.type===P.UNKNOWN?this.handle_unknown(v,L):this.handle_unknown(v,L)},G.prototype.handle_whitespace_and_comments=function(v,L){var X=v.newlines,Ae=this._options.keep_array_indentation&&D(this._flags.mode);if(v.comments_before)for(var Be=v.comments_before.next();Be;)this.handle_whitespace_and_comments(Be,L),this.handle_token(Be,L),Be=v.comments_before.next();if(Ae)for(var ht=0;ht<X;ht+=1)this.print_newline(ht>0,L);else if(this._options.max_preserve_newlines&&X>this._options.max_preserve_newlines&&(X=this._options.max_preserve_newlines),this._options.preserve_newlines&&X>1){this.print_newline(!1,L);for(var Ke=1;Ke<X;Ke+=1)this.print_newline(!0,L)}};var g=["async","break","continue","return","throw","yield"];G.prototype.allow_wrap_or_preserved_newline=function(v,L){if(L=L===void 0?!1:L,!this._output.just_added_newline()){var X=this._options.preserve_newlines&&v.newlines||L,Ae=w(this._flags.last_token.text,C)||w(v.text,C);if(Ae){var Be=w(this._flags.last_token.text,C)&&w(this._options.operator_position,be)||w(v.text,C);X=X&&Be}if(X)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(re(this._flags.last_token,g))return;this._output.set_wrap_point()}}},G.prototype.print_newline=function(v,L){if(!L&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==P.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var X=this._tokens.peek();this._flags.mode===Ee.Statement&&!(this._flags.if_block&&q(X,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},G.prototype.print_token_line_indentation=function(v){this._output.just_added_newline()&&(this._options.keep_array_indentation&&v.newlines&&(v.text==="["||D(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))},G.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===P.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var L=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(L),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)},G.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},G.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))},G.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)},G.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Ee.Statement&&We(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},G.prototype.start_of_object_property=function(){return this._flags.parent.mode===Ee.ObjectLiteral&&this._flags.mode===Ee.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||re(this._flags.last_token,["get","set"]))},G.prototype.start_of_statement=function(v){var L=!1;return L=L||re(this._flags.last_token,["var","let","const"])&&v.type===P.WORD,L=L||q(this._flags.last_token,"do"),L=L||!(this._flags.parent.mode===Ee.ObjectLiteral&&this._flags.mode===Ee.Statement)&&re(this._flags.last_token,g)&&!v.newlines,L=L||q(this._flags.last_token,"else")&&!(q(v,"if")&&!v.comments_before),L=L||this._flags.last_token.type===P.END_EXPR&&(this._previous_flags.mode===Ee.ForInitializer||this._previous_flags.mode===Ee.Conditional),L=L||this._flags.last_token.type===P.WORD&&this._flags.mode===Ee.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==P.WORD&&v.type!==P.RESERVED,L=L||this._flags.mode===Ee.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||re(this._flags.last_token,["get","set"])),L?(this.set_mode(Ee.Statement),this.indent(),this.handle_whitespace_and_comments(v,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v,re(v,["do","for","if","while"])),!0):!1},G.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var L=Ee.Expression;if(v.text==="["){if(this._flags.last_token.type===P.WORD||this._flags.last_token.text===")"){re(this._flags.last_token,F)&&(this._output.space_before_token=!0),this.print_token(v),this.set_mode(L),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}L=Ee.ArrayLiteral,D(this._flags.mode)&&(this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline()),w(this._flags.last_token.type,[P.START_EXPR,P.END_EXPR,P.WORD,P.OPERATOR,P.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===P.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,L=Ee.ForInitializer):w(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,L=Ee.Conditional):w(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:(w(this._flags.last_token.text,F)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===P.EQUALS||this._flags.last_token.type===P.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v);else if(this._flags.last_token.type===P.WORD){this._output.space_before_token=!1;var X=this._tokens.peek(-3);if(this._options.space_after_named_function&&X){var Ae=this._tokens.peek(-4);re(X,["async","function"])||X.text==="*"&&re(Ae,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Ee.ObjectLiteral?(X.text==="{"||X.text===","||X.text==="*"&&(Ae.text==="{"||Ae.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===P.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(w(this._last_last_text,["function","yield"])||this._flags.mode===Ee.ObjectLiteral&&w(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===P.START_BLOCK?this.print_newline():(this._flags.last_token.type===P.END_EXPR||this._flags.last_token.type===P.START_EXPR||this._flags.last_token.type===P.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===P.COMMA)&&this.allow_wrap_or_preserved_newline(v,v.newlines),this.print_token(v),this.set_mode(L),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},G.prototype.handle_end_expr=function(v){for(;this._flags.mode===Ee.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(v,v.text==="]"&&D(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===P.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(),We(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Ee.Conditional&&(this._previous_flags.mode=Ee.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},G.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var L=this._tokens.peek(),X=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===P.END_EXPR?(this.set_mode(Ee.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Ee.BlockStatement):X&&(w(X.text,[":",","])&&w(L.type,[P.STRING,P.WORD,P.RESERVED])||w(L.text,["get","set","..."])&&w(X.type,[P.WORD,P.RESERVED]))?w(this._last_last_text,["class","interface"])&&!w(X.text,[":",","])?this.set_mode(Ee.BlockStatement):this.set_mode(Ee.ObjectLiteral):this._flags.last_token.type===P.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(Ee.BlockStatement):w(this._flags.last_token.type,[P.EQUALS,P.START_EXPR,P.COMMA,P.OPERATOR])||re(this._flags.last_token,["return","throw","import","default"])?this.set_mode(Ee.ObjectLiteral):this.set_mode(Ee.BlockStatement),this._flags.last_token&&re(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var Ae=!L.comments_before&&L.text==="}",Be=Ae&&this._flags.last_word==="function"&&this._flags.last_token.type===P.END_EXPR;if(this._options.brace_preserve_inline){var ht=0,Ke=null;this._flags.inline_frame=!0;do if(ht+=1,Ke=this._tokens.peek(ht-1),Ke.newlines){this._flags.inline_frame=!1;break}while(Ke.type!==P.EOF&&!(Ke.type===P.END_BLOCK&&Ke.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==P.OPERATOR&&(Be||this._flags.last_token.type===P.EQUALS||re(this._flags.last_token,le)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(D(this._previous_flags.mode)&&(this._flags.last_token.type===P.START_EXPR||this._flags.last_token.type===P.COMMA)&&((this._flags.last_token.type===P.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===P.COMMA||this._flags.last_token.type===P.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!==P.OPERATOR&&this._flags.last_token.type!==P.START_EXPR&&(w(this._flags.last_token.type,[P.START_BLOCK,P.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(v),this.indent(),!Ae&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},G.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===Ee.Statement;)this.restore_mode();var L=this._flags.last_token.type===P.START_BLOCK;this._flags.inline_frame&&!L?this._output.space_before_token=!0:this._options.brace_style==="expand"?L||this.print_newline():L||(D(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)},G.prototype.handle_word=function(v){if(v.type===P.RESERVED){if(w(v.text,["set","get"])&&this._flags.mode!==Ee.ObjectLiteral)v.type=P.WORD;else if(v.text==="import"&&w(this._tokens.peek().text,["(","."]))v.type=P.WORD;else if(w(v.text,["as","from"])&&!this._flags.import_block)v.type=P.WORD;else if(this._flags.mode===Ee.ObjectLiteral){var L=this._tokens.peek();L.text===":"&&(v.type=P.WORD)}}if(this.start_of_statement(v)?re(this._flags.last_token,["var","let","const"])&&v.type===P.WORD&&(this._flags.declaration_statement=!0):v.newlines&&!O(this._flags.mode)&&(this._flags.last_token.type!==P.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==P.EQUALS&&(this._options.preserve_newlines||!re(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(q(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&&q(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===Ee.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&re(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===P.COMMA||this._flags.last_token.type===P.START_EXPR||this._flags.last_token.type===P.EQUALS||this._flags.last_token.type===P.OPERATOR)&&!this.start_of_object_property()&&!(w(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===Ee.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(v),q(v,"function")){(w(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(w(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===P.OPERATOR))&&!this._output.just_added_blankline()&&!v.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===P.RESERVED||this._flags.last_token.type===P.WORD?re(this._flags.last_token,["get","set","new","export"])||re(this._flags.last_token,g)?this._output.space_before_token=!0:q(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===P.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(O(this._flags.mode)||D(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var X="NONE";if(this._flags.last_token.type===P.END_BLOCK?this._previous_flags.inline_frame?X="SPACE":re(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?X="NEWLINE":(X="SPACE",this._output.space_before_token=!0):X="NEWLINE":this._flags.last_token.type===P.SEMICOLON&&this._flags.mode===Ee.BlockStatement?X="NEWLINE":this._flags.last_token.type===P.SEMICOLON&&O(this._flags.mode)?X="SPACE":this._flags.last_token.type===P.STRING?X="NEWLINE":this._flags.last_token.type===P.RESERVED||this._flags.last_token.type===P.WORD||this._flags.last_token.text==="*"&&(w(this._last_last_text,["function","yield"])||this._flags.mode===Ee.ObjectLiteral&&w(this._last_last_text,["{",","]))?X="SPACE":this._flags.last_token.type===P.START_BLOCK?this._flags.inline_frame?X="SPACE":X="NEWLINE":this._flags.last_token.type===P.END_EXPR&&(this._output.space_before_token=!0,X="NEWLINE"),re(v,F)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?X="SPACE":X="NEWLINE"),re(v,["else","catch","finally"]))if((!(this._flags.last_token.type===P.END_BLOCK&&this._previous_flags.mode===Ee.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 Ae=this._output.current_line;Ae.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else X==="NEWLINE"?re(this._flags.last_token,le)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&re(v,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==P.END_EXPR?(this._flags.last_token.type!==P.START_EXPR||!re(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(q(v,"if")&&q(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):re(v,F)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&D(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():X==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===P.WORD||v.previous.type===P.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===P.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&&q(v,"from")&&(this._flags.import_block=!1))},G.prototype.handle_semicolon=function(v){this.start_of_statement(v)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(v);for(var L=this._tokens.peek();this._flags.mode===Ee.Statement&&!(this._flags.if_block&&q(L,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(v)},G.prototype.handle_string=function(v){v.text.startsWith("`")&&v.newlines===0&&v.whitespace_before===""&&(v.previous.text===")"||this._flags.last_token.type===P.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),this._flags.last_token.type===P.RESERVED||this._flags.last_token.type===P.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===P.COMMA||this._flags.last_token.type===P.START_EXPR||this._flags.last_token.type===P.EQUALS||this._flags.last_token.type===P.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v):v.text.startsWith("`")&&this._flags.last_token.type===P.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},G.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},G.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?(O(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===Ee.ObjectLiteral||this._flags.mode===Ee.Statement&&this._flags.parent.mode===Ee.ObjectLiteral?(this._flags.mode===Ee.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},G.prototype.handle_operator=function(v){var L=v.text==="*"&&(re(this._flags.last_token,["function","yield"])||w(this._flags.last_token.type,[P.START_BLOCK,P.COMMA,P.END_BLOCK,P.SEMICOLON])),X=w(v.text,["-","+"])&&(w(this._flags.last_token.type,[P.START_BLOCK,P.START_EXPR,P.EQUALS,P.OPERATOR])||w(this._flags.last_token.text,F)||this._flags.last_token.text===",");if(!this.start_of_statement(v)){var Ae=!L;this.handle_whitespace_and_comments(v,Ae)}if(v.text==="*"&&this._flags.last_token.type===P.DOT){this.print_token(v);return}if(v.text==="::"){this.print_token(v);return}if(w(v.text,["-","+"])&&this.start_of_object_property()){this.print_token(v);return}if(this._flags.last_token.type===P.OPERATOR&&w(this._options.operator_position,be)&&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!==P.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 Be=!0,ht=!0,Ke=!1;if(v.text===":"?this._flags.ternary_depth===0?Be=!1:(this._flags.ternary_depth-=1,Ke=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!X&&!L&&this._options.preserve_newlines&&w(v.text,C)){var yt=v.text===":",ot=yt&&Ke,je=yt&&!Ke;switch(this._options.operator_position){case ye.before_newline:this._output.space_before_token=!je,this.print_token(v),(!yt||ot)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case ye.after_newline:this._output.space_before_token=!0,!yt||ot?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 ye.preserve_newline:je||this.allow_wrap_or_preserved_newline(v),Be=!(this._output.just_added_newline()||je),this._output.space_before_token=Be,this.print_token(v),this._output.space_before_token=!0;return}}if(L){this.allow_wrap_or_preserved_newline(v),Be=!1;var zt=this._tokens.peek();ht=zt&&w(zt.type,[P.WORD,P.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),Be=this._flags.last_token.type===P.START_BLOCK,ht=!1;else if(w(v.text,["--","++","!","~"])||X){if((this._flags.last_token.type===P.COMMA||this._flags.last_token.type===P.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),Be=!1,ht=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var Ft=re(this._flags.last_token,le)&&v.newlines;Ft&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(Ft,!0)}this._flags.last_token.text===";"&&O(this._flags.mode)&&(Be=!0),this._flags.last_token.type===P.RESERVED?Be=!0:this._flags.last_token.type===P.END_EXPR?Be=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===P.OPERATOR&&(Be=w(v.text,["--","-","++","+"])&&w(this._flags.last_token.text,["--","-","++","+"]),w(v.text,["+","-"])&&w(this._flags.last_token.text,["--","++"])&&(ht=!0)),(this._flags.mode===Ee.BlockStatement&&!this._flags.inline_frame||this._flags.mode===Ee.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Be,this.print_token(v),this._output.space_before_token=ht},G.prototype.handle_block_comment=function(v,L){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,L),this.print_token(v),v.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!_.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,L)},G.prototype.print_block_commment=function(v,L){var X=$(v.text),Ae,Be=!1,ht=!1,Ke=v.whitespace_before,yt=Ke.length;if(this.print_newline(!1,L),this.print_token_line_indentation(v),this._output.add_token(X[0]),this.print_newline(!1,L),X.length>1){for(X=X.slice(1),Be=B(X,"*"),ht=Q(X,Ke),Be&&(this._flags.alignment=1),Ae=0;Ae<X.length;Ae++)Be?(this.print_token_line_indentation(v),this._output.add_token(I(X[Ae]))):ht&&X[Ae]?(this.print_token_line_indentation(v),this._output.add_token(X[Ae].substring(yt))):(this._output.current_line.set_indent(-1),this._output.add_token(X[Ae])),this.print_newline(!1,L);this._flags.alignment=0}},G.prototype.handle_comment=function(v,L){v.newlines?this.print_newline(!1,L):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(v),this.print_newline(!1,L)},G.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),re(this._flags.last_token,le)?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)},G.prototype.handle_unknown=function(v,L){this.print_token(v),v.text[v.text.length-1]===`
|
|
`&&this.print_newline(!1,L)},G.prototype.handle_eof=function(v){for(;this._flags.mode===Ee.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v)},J.exports.Beautifier=G},function(J){function l(m){this.__parent=m,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 m=new l(this.__parent);return m.set_indent(this.__indent_count,this.__alignment_count),m},l.prototype.item=function(m){return m<0?this.__items[this.__items.length+m]:this.__items[m]},l.prototype.has_match=function(m){for(var _=this.__items.length-1;_>=0;_--)if(this.__items[_].match(m))return!0;return!1},l.prototype.set_indent=function(m,_){this.is_empty()&&(this.__indent_count=m||0,this.__alignment_count=_||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 m=this.__parent.current_line;return m.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),m.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),m.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,m.__items[0]===" "&&(m.__items.splice(0,1),m.__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(m){this.__items.push(m);var _=m.lastIndexOf(`
|
|
`);_!==-1?this.__character_count=m.length-_:this.__character_count+=m.length},l.prototype.pop=function(){var m=null;return this.is_empty()||(m=this.__items.pop(),this.__character_count-=m.length),m},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 m="";return this.is_empty()?this.__parent.indent_empty_lines&&(m=this.__parent.get_indent_string(this.__indent_count)):(m=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),m+=this.__items.join("")),m};function z(m,_){this.__cache=[""],this.__indent_size=m.indent_size,this.__indent_string=m.indent_char,m.indent_with_tabs||(this.__indent_string=new Array(m.indent_size+1).join(m.indent_char)),_=_||"",m.indent_level>0&&(_=new Array(m.indent_level+1).join(this.__indent_string)),this.__base_string=_,this.__base_string_length=_.length}z.prototype.get_indent_size=function(m,_){var b=this.__base_string_length;return _=_||0,m<0&&(b=0),b+=m*this.__indent_size,b+=_,b},z.prototype.get_indent_string=function(m,_){var b=this.__base_string;return _=_||0,m<0&&(m=0,b=""),_+=m*this.__indent_size,this.__ensure_cache(_),b+=this.__cache[_],b},z.prototype.__ensure_cache=function(m){for(;m>=this.__cache.length;)this.__add_column()},z.prototype.__add_column=function(){var m=this.__cache.length,_=0,b="";this.__indent_size&&m>=this.__indent_size&&(_=Math.floor(m/this.__indent_size),m-=_*this.__indent_size,b=new Array(_+1).join(this.__indent_string)),m&&(b+=new Array(m+1).join(" ")),this.__cache.push(b)};function x(m,_){this.__indent_cache=new z(m,_),this.raw=!1,this._end_with_newline=m.end_with_newline,this.indent_size=m.indent_size,this.wrap_line_length=m.wrap_line_length,this.indent_empty_lines=m.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()}x.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},x.prototype.get_line_number=function(){return this.__lines.length},x.prototype.get_indent_string=function(m,_){return this.__indent_cache.get_indent_string(m,_)},x.prototype.get_indent_size=function(m,_){return this.__indent_cache.get_indent_size(m,_)},x.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},x.prototype.add_new_line=function(m){return this.is_empty()||!m&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},x.prototype.get_code=function(m){this.trim(!0);var _=this.current_line.pop();_&&(_[_.length-1]===`
|
|
`&&(_=_.replace(/\n+$/g,"")),this.current_line.push(_)),this._end_with_newline&&this.__add_outputline();var b=this.__lines.join(`
|
|
`);return m!==`
|
|
`&&(b=b.replace(/[\n]/g,m)),b},x.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},x.prototype.set_indent=function(m,_){return m=m||0,_=_||0,this.next_line.set_indent(m,_),this.__lines.length>1?(this.current_line.set_indent(m,_),!0):(this.current_line.set_indent(),!1)},x.prototype.add_raw_token=function(m){for(var _=0;_<m.newlines;_++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(m.whitespace_before),this.current_line.push(m.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},x.prototype.add_token=function(m){this.__add_space_before_token(),this.current_line.push(m),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},x.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(" "))},x.prototype.remove_indent=function(m){for(var _=this.__lines.length;m<_;)this.__lines[m]._remove_indent(),m++;this.current_line._remove_wrap_indent()},x.prototype.trim=function(m){for(m=m===void 0?!1:m,this.current_line.trim();m&&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},x.prototype.just_added_newline=function(){return this.current_line.is_empty()},x.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},x.prototype.ensure_empty_line_above=function(m,_){for(var b=this.__lines.length-2;b>=0;){var T=this.__lines[b];if(T.is_empty())break;if(T.item(0).indexOf(m)!==0&&T.item(-1)!==_){this.__lines.splice(b+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}b--}},J.exports.Output=x},function(J){function l(z,x,m,_){this.type=z,this.text=x,this.comments_before=null,this.newlines=m||0,this.whitespace_before=_||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}J.exports.Token=l},function(J,l){var z="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",x="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",m="\\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",_="\\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",b="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",T="(?:"+b+"|["+z+m+"])",F="(?:"+b+"|["+x+m+_+"])*";l.identifier=new RegExp(T+F,"g"),l.identifierStart=new RegExp(T),l.identifierMatch=new RegExp("(?:"+b+"|["+x+m+_+"])+");var C=/[\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(J,l,z){var x=z(6).Options,m=["before-newline","after-newline","preserve-newline"];function _(b){x.call(this,b,"js");var T=this.raw_options.brace_style||null;T==="expand-strict"?this.raw_options.brace_style="expand":T==="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 F=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var C=0;C<F.length;C++)F[C]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=F[C];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",m),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}_.prototype=new x,J.exports.Options=_},function(J){function l(m,_){this.raw_options=z(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(m,_){var b=this.raw_options[m],T=_||[];return typeof b=="object"?b!==null&&typeof b.concat=="function"&&(T=b.concat()):typeof b=="string"&&(T=b.split(/[^a-zA-Z0-9_\/\-]+/)),T},l.prototype._get_boolean=function(m,_){var b=this.raw_options[m],T=b===void 0?!!_:!!b;return T},l.prototype._get_characters=function(m,_){var b=this.raw_options[m],T=_||"";return typeof b=="string"&&(T=b.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),T},l.prototype._get_number=function(m,_){var b=this.raw_options[m];_=parseInt(_,10),isNaN(_)&&(_=0);var T=parseInt(b,10);return isNaN(T)&&(T=_),T},l.prototype._get_selection=function(m,_,b){var T=this._get_selection_list(m,_,b);if(T.length!==1)throw new Error("Invalid Option Value: The option '"+m+`' can only be one of the following values:
|
|
`+_+`
|
|
You passed in: '`+this.raw_options[m]+"'");return T[0]},l.prototype._get_selection_list=function(m,_,b){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(b=b||[_[0]],!this._is_valid_selection(b,_))throw new Error("Invalid Default Value!");var T=this._get_array(m,b);if(!this._is_valid_selection(T,_))throw new Error("Invalid Option Value: The option '"+m+`' can contain only the following values:
|
|
`+_+`
|
|
You passed in: '`+this.raw_options[m]+"'");return T},l.prototype._is_valid_selection=function(m,_){return m.length&&_.length&&!m.some(function(b){return _.indexOf(b)===-1})};function z(m,_){var b={};m=x(m);var T;for(T in m)T!==_&&(b[T]=m[T]);if(_&&m[_])for(T in m[_])b[T]=m[_][T];return b}function x(m){var _={},b;for(b in m){var T=b.replace(/-/g,"_");_[T]=m[b]}return _}J.exports.Options=l,J.exports.normalizeOpts=x,J.exports.mergeOpts=z},function(J,l,z){var x=z(8).InputScanner,m=z(9).Tokenizer,_=z(9).TOKEN,b=z(13).Directives,T=z(4),F=z(12).Pattern,C=z(14).TemplatablePattern;function P(B,Q){return Q.indexOf(B)!==-1}var w={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:_.START,RAW:_.RAW,EOF:_.EOF},I=new b(/\/\*/,/\*\//),N=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,q=/[0-9]/,re=/[^\d\.]/,le=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),H=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";H=H.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),H="\\?\\.(?!\\d) "+H,H=H.replace(/ /g,"|");var ye=new RegExp(H),be="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),Ee=be.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),We=new RegExp("^(?:"+Ee.join("|")+")$"),$,D=function(B,Q){m.call(this,B,Q),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var G=new F(this._input),g=new C(this._input).read_options(this._options);this.__patterns={template:g,identifier:g.starting_with(T.identifier).matching(T.identifierMatch),number:G.matching(N),punct:G.matching(ye),comment:G.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:G.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:G.matching(/<!--/),html_comment_end:G.matching(/-->/),include:G.starting_with(/#include/).until_after(T.lineBreak),shebang:G.starting_with(/#!/).until_after(T.lineBreak),xml:G.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:g.until(/['\\\n\r\u2028\u2029]/),double_quote:g.until(/["\\\n\r\u2028\u2029]/),template_text:g.until(/[`\\$]/),template_expression:g.until(/[`}\\]/)}};D.prototype=new m,D.prototype._is_comment=function(B){return B.type===w.COMMENT||B.type===w.BLOCK_COMMENT||B.type===w.UNKNOWN},D.prototype._is_opening=function(B){return B.type===w.START_BLOCK||B.type===w.START_EXPR},D.prototype._is_closing=function(B,Q){return(B.type===w.END_BLOCK||B.type===w.END_EXPR)&&Q&&(B.text==="]"&&Q.text==="["||B.text===")"&&Q.text==="("||B.text==="}"&&Q.text==="{")},D.prototype._reset=function(){$=!1},D.prototype._get_next_token=function(B,Q){var G=null;this._readWhitespace();var g=this._input.peek();return g===null?this._create_token(w.EOF,""):(G=G||this._read_non_javascript(g),G=G||this._read_string(g),G=G||this._read_pair(g,this._input.peek(1)),G=G||this._read_word(B),G=G||this._read_singles(g),G=G||this._read_comment(g),G=G||this._read_regexp(g,B),G=G||this._read_xml(g,B),G=G||this._read_punctuation(),G=G||this._create_token(w.UNKNOWN,this._input.next()),G)},D.prototype._read_word=function(B){var Q;if(Q=this.__patterns.identifier.read(),Q!=="")return Q=Q.replace(T.allLineBreaks,`
|
|
`),!(B.type===w.DOT||B.type===w.RESERVED&&(B.text==="set"||B.text==="get"))&&We.test(Q)?(Q==="in"||Q==="of")&&(B.type===w.WORD||B.type===w.STRING)?this._create_token(w.OPERATOR,Q):this._create_token(w.RESERVED,Q):this._create_token(w.WORD,Q);if(Q=this.__patterns.number.read(),Q!=="")return this._create_token(w.WORD,Q)},D.prototype._read_singles=function(B){var Q=null;return B==="("||B==="["?Q=this._create_token(w.START_EXPR,B):B===")"||B==="]"?Q=this._create_token(w.END_EXPR,B):B==="{"?Q=this._create_token(w.START_BLOCK,B):B==="}"?Q=this._create_token(w.END_BLOCK,B):B===";"?Q=this._create_token(w.SEMICOLON,B):B==="."&&re.test(this._input.peek(1))?Q=this._create_token(w.DOT,B):B===","&&(Q=this._create_token(w.COMMA,B)),Q&&this._input.next(),Q},D.prototype._read_pair=function(B,Q){var G=null;return B==="#"&&Q==="{"&&(G=this._create_token(w.START_BLOCK,B+Q)),G&&(this._input.next(),this._input.next()),G},D.prototype._read_punctuation=function(){var B=this.__patterns.punct.read();if(B!=="")return B==="="?this._create_token(w.EQUALS,B):B==="?."?this._create_token(w.DOT,B):this._create_token(w.OPERATOR,B)},D.prototype._read_non_javascript=function(B){var Q="";if(B==="#"){if(this._is_first_token()&&(Q=this.__patterns.shebang.read(),Q))return this._create_token(w.UNKNOWN,Q.trim()+`
|
|
`);if(Q=this.__patterns.include.read(),Q)return this._create_token(w.UNKNOWN,Q.trim()+`
|
|
`);B=this._input.next();var G="#";if(this._input.hasNext()&&this._input.testChar(q)){do B=this._input.next(),G+=B;while(this._input.hasNext()&&B!=="#"&&B!=="=");return B==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(G+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(G+="{}",this._input.next(),this._input.next())),this._create_token(w.WORD,G)}this._input.back()}else if(B==="<"&&this._is_first_token()){if(Q=this.__patterns.html_comment_start.read(),Q){for(;this._input.hasNext()&&!this._input.testChar(T.newline);)Q+=this._input.next();return $=!0,this._create_token(w.COMMENT,Q)}}else if($&&B==="-"&&(Q=this.__patterns.html_comment_end.read(),Q))return $=!1,this._create_token(w.COMMENT,Q);return null},D.prototype._read_comment=function(B){var Q=null;if(B==="/"){var G="";if(this._input.peek(1)==="*"){G=this.__patterns.block_comment.read();var g=I.get_directives(G);g&&g.ignore==="start"&&(G+=I.readIgnored(this._input)),G=G.replace(T.allLineBreaks,`
|
|
`),Q=this._create_token(w.BLOCK_COMMENT,G),Q.directives=g}else this._input.peek(1)==="/"&&(G=this.__patterns.comment.read(),Q=this._create_token(w.COMMENT,G))}return Q},D.prototype._read_string=function(B){if(B==="`"||B==="'"||B==='"'){var Q=this._input.next();return this.has_char_escapes=!1,B==="`"?Q+=this._read_string_recursive("`",!0,"${"):Q+=this._read_string_recursive(B),this.has_char_escapes&&this._options.unescape_strings&&(Q=O(Q)),this._input.peek()===B&&(Q+=this._input.next()),Q=Q.replace(T.allLineBreaks,`
|
|
`),this._create_token(w.STRING,Q)}return null},D.prototype._allow_regexp_or_xml=function(B){return B.type===w.RESERVED&&P(B.text,["return","case","throw","else","do","typeof","yield"])||B.type===w.END_EXPR&&B.text===")"&&B.opened.previous.type===w.RESERVED&&P(B.opened.previous.text,["if","while","for"])||P(B.type,[w.COMMENT,w.START_EXPR,w.START_BLOCK,w.START,w.END_BLOCK,w.OPERATOR,w.EQUALS,w.EOF,w.SEMICOLON,w.COMMA])},D.prototype._read_regexp=function(B,Q){if(B==="/"&&this._allow_regexp_or_xml(Q)){for(var G=this._input.next(),g=!1,v=!1;this._input.hasNext()&&(g||v||this._input.peek()!==B)&&!this._input.testChar(T.newline);)G+=this._input.peek(),g?g=!1:(g=this._input.peek()==="\\",this._input.peek()==="["?v=!0:this._input.peek()==="]"&&(v=!1)),this._input.next();return this._input.peek()===B&&(G+=this._input.next(),G+=this._input.read(T.identifier)),this._create_token(w.STRING,G)}return null},D.prototype._read_xml=function(B,Q){if(this._options.e4x&&B==="<"&&this._allow_regexp_or_xml(Q)){var G="",g=this.__patterns.xml.read_match();if(g){for(var v=g[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),L=v.indexOf("{")===0,X=0;g;){var Ae=!!g[1],Be=g[2],ht=!!g[g.length-1]||Be.slice(0,8)==="![CDATA[";if(!ht&&(Be===v||L&&Be.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(Ae?--X:++X),G+=g[0],X<=0)break;g=this.__patterns.xml.read_match()}return g||(G+=this._input.match(/[\s\S]*/g)[0]),G=G.replace(T.allLineBreaks,`
|
|
`),this._create_token(w.STRING,G)}}return null};function O(B){for(var Q="",G=0,g=new x(B),v=null;g.hasNext();)if(v=g.match(/([\s]|[^\\]|\\\\)+/g),v&&(Q+=v[0]),g.peek()==="\\"){if(g.next(),g.peek()==="x")v=g.match(/x([0-9A-Fa-f]{2})/g);else if(g.peek()==="u")v=g.match(/u([0-9A-Fa-f]{4})/g),v||(v=g.match(/u\{([0-9A-Fa-f]+)\}/g));else{Q+="\\",g.hasNext()&&(Q+=g.next());continue}if(!v||(G=parseInt(v[1],16),G>126&&G<=255&&v[0].indexOf("x")===0))return B;G>=0&&G<32||G>1114111?Q+="\\"+v[0]:G===34||G===39||G===92?Q+="\\"+String.fromCharCode(G):Q+=String.fromCharCode(G)}return Q}D.prototype._read_string_recursive=function(B,Q,G){var g,v;B==="'"?v=this.__patterns.single_quote:B==='"'?v=this.__patterns.double_quote:B==="`"?v=this.__patterns.template_text:B==="}"&&(v=this.__patterns.template_expression);for(var L=v.read(),X="";this._input.hasNext();){if(X=this._input.next(),X===B||!Q&&T.newline.test(X)){this._input.back();break}else X==="\\"&&this._input.hasNext()?(g=this._input.peek(),g==="x"||g==="u"?this.has_char_escapes=!0:g==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),X+=this._input.next()):G&&(G==="${"&&X==="$"&&this._input.peek()==="{"&&(X+=this._input.next()),G===X&&(B==="`"?X+=this._read_string_recursive("}",Q,"`"):X+=this._read_string_recursive("`",Q,"${"),this._input.hasNext()&&(X+=this._input.next())));X+=v.read(),L+=X}return L},J.exports.Tokenizer=D,J.exports.TOKEN=w,J.exports.positionable_operators=le.slice(),J.exports.line_starters=be.slice()},function(J){var l=RegExp.prototype.hasOwnProperty("sticky");function z(x){this.__input=x||"",this.__input_length=this.__input.length,this.__position=0}z.prototype.restart=function(){this.__position=0},z.prototype.back=function(){this.__position>0&&(this.__position-=1)},z.prototype.hasNext=function(){return this.__position<this.__input_length},z.prototype.next=function(){var x=null;return this.hasNext()&&(x=this.__input.charAt(this.__position),this.__position+=1),x},z.prototype.peek=function(x){var m=null;return x=x||0,x+=this.__position,x>=0&&x<this.__input_length&&(m=this.__input.charAt(x)),m},z.prototype.__match=function(x,m){x.lastIndex=m;var _=x.exec(this.__input);return _&&!(l&&x.sticky)&&_.index!==m&&(_=null),_},z.prototype.test=function(x,m){return m=m||0,m+=this.__position,m>=0&&m<this.__input_length?!!this.__match(x,m):!1},z.prototype.testChar=function(x,m){var _=this.peek(m);return x.lastIndex=0,_!==null&&x.test(_)},z.prototype.match=function(x){var m=this.__match(x,this.__position);return m?this.__position+=m[0].length:m=null,m},z.prototype.read=function(x,m,_){var b="",T;return x&&(T=this.match(x),T&&(b+=T[0])),m&&(T||!x)&&(b+=this.readUntil(m,_)),b},z.prototype.readUntil=function(x,m){var _="",b=this.__position;x.lastIndex=this.__position;var T=x.exec(this.__input);return T?(b=T.index,m&&(b+=T[0].length)):b=this.__input_length,_=this.__input.substring(this.__position,b),this.__position=b,_},z.prototype.readUntilAfter=function(x){return this.readUntil(x,!0)},z.prototype.get_regexp=function(x,m){var _=null,b="g";return m&&l&&(b="y"),typeof x=="string"&&x!==""?_=new RegExp(x,b):x&&(_=new RegExp(x.source,b)),_},z.prototype.get_literal_regexp=function(x){return RegExp(x.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},z.prototype.peekUntilAfter=function(x){var m=this.__position,_=this.readUntilAfter(x);return this.__position=m,_},z.prototype.lookBack=function(x){var m=this.__position-1;return m>=x.length&&this.__input.substring(m-x.length,m).toLowerCase()===x},J.exports.InputScanner=z},function(J,l,z){var x=z(8).InputScanner,m=z(3).Token,_=z(10).TokenStream,b=z(11).WhitespacePattern,T={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},F=function(C,P){this._input=new x(C),this._options=P||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new b(this._input)};F.prototype.tokenize=function(){this._input.restart(),this.__tokens=new _,this._reset();for(var C,P=new m(T.START,""),w=null,I=[],N=new _;P.type!==T.EOF;){for(C=this._get_next_token(P,w);this._is_comment(C);)N.add(C),C=this._get_next_token(P,w);N.isEmpty()||(C.comments_before=N,N=new _),C.parent=w,this._is_opening(C)?(I.push(w),w=C):w&&this._is_closing(C,w)&&(C.opened=w,w.closed=C,w=I.pop(),C.parent=w),C.previous=P,P.next=C,this.__tokens.add(C),P=C}return this.__tokens},F.prototype._is_first_token=function(){return this.__tokens.isEmpty()},F.prototype._reset=function(){},F.prototype._get_next_token=function(C,P){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(T.RAW,w):this._create_token(T.EOF,"")},F.prototype._is_comment=function(C){return!1},F.prototype._is_opening=function(C){return!1},F.prototype._is_closing=function(C,P){return!1},F.prototype._create_token=function(C,P){var w=new m(C,P,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},F.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},J.exports.Tokenizer=F,J.exports.TOKEN=T},function(J){function l(z){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=z}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 z=null;return this.hasNext()&&(z=this.__tokens[this.__position],this.__position+=1),z},l.prototype.peek=function(z){var x=null;return z=z||0,z+=this.__position,z>=0&&z<this.__tokens_length&&(x=this.__tokens[z]),x},l.prototype.add=function(z){this.__parent_token&&(z.parent=this.__parent_token),this.__tokens.push(z),this.__tokens_length+=1},J.exports.TokenStream=l},function(J,l,z){var x=z(12).Pattern;function m(_,b){x.call(this,_,b),b?this._line_regexp=this._input.get_regexp(b._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}m.prototype=new x,m.prototype.__set_whitespace_patterns=function(_,b){_+="\\t ",b+="\\n\\r",this._match_pattern=this._input.get_regexp("["+_+b+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+b+"]")},m.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var _=this._input.read(this._match_pattern);if(_===" ")this.whitespace_before_token=" ";else if(_){var b=this.__split(this._newline_regexp,_);this.newline_count=b.length-1,this.whitespace_before_token=b[this.newline_count]}return _},m.prototype.matching=function(_,b){var T=this._create();return T.__set_whitespace_patterns(_,b),T._update(),T},m.prototype._create=function(){return new m(this._input,this)},m.prototype.__split=function(_,b){_.lastIndex=0;for(var T=0,F=[],C=_.exec(b);C;)F.push(b.substring(T,C.index)),T=C.index+C[0].length,C=_.exec(b);return T<b.length?F.push(b.substring(T,b.length)):F.push(""),F},J.exports.WhitespacePattern=m},function(J){function l(z,x){this._input=z,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,x&&(this._starting_pattern=this._input.get_regexp(x._starting_pattern,!0),this._match_pattern=this._input.get_regexp(x._match_pattern,!0),this._until_pattern=this._input.get_regexp(x._until_pattern),this._until_after=x._until_after)}l.prototype.read=function(){var z=this._input.read(this._starting_pattern);return(!this._starting_pattern||z)&&(z+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),z},l.prototype.read_match=function(){return this._input.match(this._match_pattern)},l.prototype.until_after=function(z){var x=this._create();return x._until_after=!0,x._until_pattern=this._input.get_regexp(z),x._update(),x},l.prototype.until=function(z){var x=this._create();return x._until_after=!1,x._until_pattern=this._input.get_regexp(z),x._update(),x},l.prototype.starting_with=function(z){var x=this._create();return x._starting_pattern=this._input.get_regexp(z,!0),x._update(),x},l.prototype.matching=function(z){var x=this._create();return x._match_pattern=this._input.get_regexp(z,!0),x._update(),x},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},J.exports.Pattern=l},function(J){function l(z,x){z=typeof z=="string"?z:z.source,x=typeof x=="string"?x:x.source,this.__directives_block_pattern=new RegExp(z+/ beautify( \w+[:]\w+)+ /.source+x,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(z+/\sbeautify\signore:end\s/.source+x,"g")}l.prototype.get_directives=function(z){if(!z.match(this.__directives_block_pattern))return null;var x={};this.__directive_pattern.lastIndex=0;for(var m=this.__directive_pattern.exec(z);m;)x[m[1]]=m[2],m=this.__directive_pattern.exec(z);return x},l.prototype.readIgnored=function(z){return z.readUntilAfter(this.__directives_end_ignore_pattern)},J.exports.Directives=l},function(J,l,z){var x=z(12).Pattern,m={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function _(b,T){x.call(this,b,T),this.__template_pattern=null,this._disabled=Object.assign({},m),this._excluded=Object.assign({},m),T&&(this.__template_pattern=this._input.get_regexp(T.__template_pattern),this._excluded=Object.assign(this._excluded,T._excluded),this._disabled=Object.assign(this._disabled,T._disabled));var F=new x(b);this.__patterns={handlebars_comment:F.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:F.starting_with(/{{{/).until_after(/}}}/),handlebars:F.starting_with(/{{/).until_after(/}}/),php:F.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:F.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:F.starting_with(/{%/).until_after(/%}/),django_value:F.starting_with(/{{/).until_after(/}}/),django_comment:F.starting_with(/{#/).until_after(/#}/),smarty:F.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:F.starting_with(/{\*/).until_after(/\*}/),smarty_literal:F.starting_with(/{literal}/).until_after(/{\/literal}/)}}_.prototype=new x,_.prototype._create=function(){return new _(this._input,this)},_.prototype._update=function(){this.__set_templated_pattern()},_.prototype.disable=function(b){var T=this._create();return T._disabled[b]=!0,T._update(),T},_.prototype.read_options=function(b){var T=this._create();for(var F in m)T._disabled[F]=b.templating.indexOf(F)===-1;return T._update(),T},_.prototype.exclude=function(b){var T=this._create();return T._excluded[b]=!0,T._update(),T},_.prototype.read=function(){var b="";this._match_pattern?b=this._input.read(this._starting_pattern):b=this._input.read(this._starting_pattern,this.__template_pattern);for(var T=this._read_template();T;)this._match_pattern?T+=this._input.read(this._match_pattern):T+=this._input.readUntil(this.__template_pattern),b+=T,T=this._read_template();return this._until_after&&(b+=this._input.readUntilAfter(this._until_pattern)),b},_.prototype.__set_templated_pattern=function(){var b=[];this._disabled.php||b.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||b.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||b.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||b.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(b.push(this.__patterns.django._starting_pattern.source),b.push(this.__patterns.django_value._starting_pattern.source),b.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||b.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&b.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+b.join("|")+")")},_.prototype._read_template=function(){var b="",T=this._input.peek();if(T==="<"){var F=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&F==="?"&&(b=b||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&F==="%"&&(b=b||this.__patterns.erb.read())}else T==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(b=b||this.__patterns.handlebars_comment.read(),b=b||this.__patterns.handlebars_unescaped.read(),b=b||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(b=b||this.__patterns.django_value.read()),this._excluded.django||(b=b||this.__patterns.django_comment.read(),b=b||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(b=b||this.__patterns.smarty_comment.read(),b=b||this.__patterns.smarty_literal.read(),b=b||this.__patterns.smarty.read()));return b},J.exports.TemplatablePattern=_}],M={};function p(J){var l=M[J];if(l!==void 0)return l.exports;var z=M[J]={exports:{}};return te[J](z,z.exports,p),z.exports}var ce=p(0);de=ce})();var Ie=de;W=[],V=function(){return{js_beautify:Ie}}.apply(at,W),V!==void 0&&(Ut.exports=V)})()},32834:function(Ut){(function(at,W){Ut.exports=W()})(this,function(){"use strict";function at(fe,ae){for(var oe=0;oe<ae.length;oe++){var R=ae[oe];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(fe,R.key,R)}}function W(fe,ae,oe){return ae&&at(fe.prototype,ae),oe&&at(fe,oe),fe}function V(fe,ae){if(fe){if(typeof fe=="string")return de(fe,ae);var oe=Object.prototype.toString.call(fe).slice(8,-1);if(oe==="Object"&&fe.constructor&&(oe=fe.constructor.name),oe==="Map"||oe==="Set")return Array.from(fe);if(oe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(oe))return de(fe,ae)}}function de(fe,ae){(ae==null||ae>fe.length)&&(ae=fe.length);for(var oe=0,R=new Array(ae);oe<ae;oe++)R[oe]=fe[oe];return R}function Ie(fe,ae){var oe=typeof Symbol!="undefined"&&fe[Symbol.iterator]||fe["@@iterator"];if(oe)return(oe=oe.call(fe)).next.bind(oe);if(Array.isArray(fe)||(oe=V(fe))||ae&&fe&&typeof fe.length=="number"){oe&&(fe=oe);var R=0;return function(){return R>=fe.length?{done:!0}:{done:!1,value:fe[R++]}}}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 te={exports:{}};function M(){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 p(fe){te.exports.defaults=fe}te.exports={defaults:M(),getDefaults:M,changeDefaults:p};var ce=/[&<>"']/,J=/[&<>"']/g,l=/[<>"']|&(?!#?\w+;)/,z=/[<>"']|&(?!#?\w+;)/g,x={"&":"&","<":"<",">":">",'"':""","'":"'"},m=function(ae){return x[ae]};function _(fe,ae){if(ae){if(ce.test(fe))return fe.replace(J,m)}else if(l.test(fe))return fe.replace(z,m);return fe}var b=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function T(fe){return fe.replace(b,function(ae,oe){return oe=oe.toLowerCase(),oe==="colon"?":":oe.charAt(0)==="#"?oe.charAt(1)==="x"?String.fromCharCode(parseInt(oe.substring(2),16)):String.fromCharCode(+oe.substring(1)):""})}var F=/(^|[^\[])\^/g;function C(fe,ae){fe=fe.source||fe,ae=ae||"";var oe={replace:function(k,Z){return Z=Z.source||Z,Z=Z.replace(F,"$1"),fe=fe.replace(k,Z),oe},getRegex:function(){return new RegExp(fe,ae)}};return oe}var P=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function I(fe,ae,oe){if(fe){var R;try{R=decodeURIComponent(T(oe)).replace(P,"").toLowerCase()}catch(k){return null}if(R.indexOf("javascript:")===0||R.indexOf("vbscript:")===0||R.indexOf("data:")===0)return null}ae&&!w.test(oe)&&(oe=H(ae,oe));try{oe=encodeURI(oe).replace(/%25/g,"%")}catch(k){return null}return oe}var N={},q=/^[^:]+:\/*[^/]*$/,re=/^([^:]+:)[\s\S]*$/,le=/^([^:]+:\/*[^/]*)[\s\S]*$/;function H(fe,ae){N[" "+fe]||(q.test(fe)?N[" "+fe]=fe+"/":N[" "+fe]=We(fe,"/",!0)),fe=N[" "+fe];var oe=fe.indexOf(":")===-1;return ae.substring(0,2)==="//"?oe?ae:fe.replace(re,"$1")+ae:ae.charAt(0)==="/"?oe?ae:fe.replace(le,"$1")+ae:fe+ae}var ye={exec:function(){}};function be(fe){for(var ae=1,oe,R;ae<arguments.length;ae++){oe=arguments[ae];for(R in oe)Object.prototype.hasOwnProperty.call(oe,R)&&(fe[R]=oe[R])}return fe}function Ee(fe,ae){var oe=fe.replace(/\|/g,function(Z,ee,se){for(var Ue=!1,Ge=ee;--Ge>=0&&se[Ge]==="\\";)Ue=!Ue;return Ue?"|":" |"}),R=oe.split(/ \|/),k=0;if(R.length>ae)R.splice(ae);else for(;R.length<ae;)R.push("");for(;k<R.length;k++)R[k]=R[k].trim().replace(/\\\|/g,"|");return R}function We(fe,ae,oe){var R=fe.length;if(R===0)return"";for(var k=0;k<R;){var Z=fe.charAt(R-k-1);if(Z===ae&&!oe)k++;else if(Z!==ae&&oe)k++;else break}return fe.substr(0,R-k)}function $(fe,ae){if(fe.indexOf(ae[1])===-1)return-1;for(var oe=fe.length,R=0,k=0;k<oe;k++)if(fe[k]==="\\")k++;else if(fe[k]===ae[0])R++;else if(fe[k]===ae[1]&&(R--,R<0))return k;return-1}function D(fe){fe&&fe.sanitize&&!fe.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 O(fe,ae){if(ae<1)return"";for(var oe="";ae>1;)ae&1&&(oe+=fe),ae>>=1,fe+=fe;return oe+fe}var B={escape:_,unescape:T,edit:C,cleanUrl:I,resolveUrl:H,noopTest:ye,merge:be,splitCells:Ee,rtrim:We,findClosingBracket:$,checkSanitizeDeprecation:D,repeatString:O},Q=te.exports.defaults,G=B.rtrim,g=B.splitCells,v=B.escape,L=B.findClosingBracket;function X(fe,ae,oe){var R=ae.href,k=ae.title?v(ae.title):null,Z=fe[1].replace(/\\([\[\]])/g,"$1");return fe[0].charAt(0)!=="!"?{type:"link",raw:oe,href:R,title:k,text:Z}:{type:"image",raw:oe,href:R,title:k,text:v(Z)}}function Ae(fe,ae){var oe=fe.match(/^(\s+)(?:```)/);if(oe===null)return ae;var R=oe[1];return ae.split(`
|
|
`).map(function(k){var Z=k.match(/^\s+/);if(Z===null)return k;var ee=Z[0];return ee.length>=R.length?k.slice(R.length):k}).join(`
|
|
`)}var Be=function(){function fe(oe){this.options=oe||Q}var ae=fe.prototype;return ae.space=function(R){var k=this.rules.block.newline.exec(R);if(k)return k[0].length>1?{type:"space",raw:k[0]}:{raw:`
|
|
`}},ae.code=function(R){var k=this.rules.block.code.exec(R);if(k){var Z=k[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:k[0],codeBlockStyle:"indented",text:this.options.pedantic?Z:G(Z,`
|
|
`)}}},ae.fences=function(R){var k=this.rules.block.fences.exec(R);if(k){var Z=k[0],ee=Ae(Z,k[3]||"");return{type:"code",raw:Z,lang:k[2]?k[2].trim():k[2],text:ee}}},ae.heading=function(R){var k=this.rules.block.heading.exec(R);if(k){var Z=k[2].trim();if(/#$/.test(Z)){var ee=G(Z,"#");(this.options.pedantic||!ee||/ $/.test(ee))&&(Z=ee.trim())}return{type:"heading",raw:k[0],depth:k[1].length,text:Z}}},ae.nptable=function(R){var k=this.rules.block.nptable.exec(R);if(k){var Z={type:"table",header:g(k[1].replace(/^ *| *\| *$/g,"")),align:k[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:k[3]?k[3].replace(/\n$/,"").split(`
|
|
`):[],raw:k[0]};if(Z.header.length===Z.align.length){var ee=Z.align.length,se;for(se=0;se<ee;se++)/^ *-+: *$/.test(Z.align[se])?Z.align[se]="right":/^ *:-+: *$/.test(Z.align[se])?Z.align[se]="center":/^ *:-+ *$/.test(Z.align[se])?Z.align[se]="left":Z.align[se]=null;for(ee=Z.cells.length,se=0;se<ee;se++)Z.cells[se]=g(Z.cells[se],Z.header.length);return Z}}},ae.hr=function(R){var k=this.rules.block.hr.exec(R);if(k)return{type:"hr",raw:k[0]}},ae.blockquote=function(R){var k=this.rules.block.blockquote.exec(R);if(k){var Z=k[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:k[0],text:Z}}},ae.list=function(R){var k=this.rules.block.list.exec(R);if(k){var Z=k[0],ee=k[2],se=ee.length>1,Ue={type:"list",raw:Z,ordered:se,start:se?+ee.slice(0,-1):"",loose:!1,items:[]},Ge=k[0].match(this.rules.block.item),tt=!1,gt,wt,$t,Dt,rt,Lt,Jt,Xt,ri,Vt=Ge.length;$t=this.rules.block.listItemStart.exec(Ge[0]);for(var jt=0;jt<Vt;jt++){if(gt=Ge[jt],Z=gt,this.options.pedantic||(ri=gt.match(new RegExp("\\n\\s*\\n {0,"+($t[0].length-1)+"}\\S")),ri&&(rt=gt.length-ri.index+Ge.slice(jt+1).join(`
|
|
`).length,Ue.raw=Ue.raw.substring(0,Ue.raw.length-rt),gt=gt.substring(0,ri.index),Z=gt,Vt=jt+1)),jt!==Vt-1){if(Dt=this.rules.block.listItemStart.exec(Ge[jt+1]),this.options.pedantic?Dt[1].length>$t[1].length:Dt[1].length>=$t[0].length||Dt[1].length>3){Ge.splice(jt,2,Ge[jt]+(!this.options.pedantic&&Dt[1].length<$t[0].length&&!Ge[jt].match(/\n$/)?"":`
|
|
`)+Ge[jt+1]),jt--,Vt--;continue}else(!this.options.pedantic||this.options.smartLists?Dt[2][Dt[2].length-1]!==ee[ee.length-1]:se===(Dt[2].length===1))&&(rt=Ge.slice(jt+1).join(`
|
|
`).length,Ue.raw=Ue.raw.substring(0,Ue.raw.length-rt),jt=Vt-1);$t=Dt}wt=gt.length,gt=gt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~gt.indexOf(`
|
|
`)&&(wt-=gt.length,gt=this.options.pedantic?gt.replace(/^ {1,4}/gm,""):gt.replace(new RegExp("^ {1,"+wt+"}","gm"),"")),gt=G(gt,`
|
|
`),jt!==Vt-1&&(Z=Z+`
|
|
`),Lt=tt||/\n\n(?!\s*$)/.test(Z),jt!==Vt-1&&(tt=Z.slice(-2)===`
|
|
|
|
`,Lt||(Lt=tt)),Lt&&(Ue.loose=!0),this.options.gfm&&(Jt=/^\[[ xX]\] /.test(gt),Xt=void 0,Jt&&(Xt=gt[1]!==" ",gt=gt.replace(/^\[[ xX]\] +/,""))),Ue.items.push({type:"list_item",raw:Z,task:Jt,checked:Xt,loose:Lt,text:gt})}return Ue}},ae.html=function(R){var k=this.rules.block.html.exec(R);if(k)return{type:this.options.sanitize?"paragraph":"html",raw:k[0],pre:!this.options.sanitizer&&(k[1]==="pre"||k[1]==="script"||k[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(k[0]):v(k[0]):k[0]}},ae.def=function(R){var k=this.rules.block.def.exec(R);if(k){k[3]&&(k[3]=k[3].substring(1,k[3].length-1));var Z=k[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:Z,raw:k[0],href:k[2],title:k[3]}}},ae.table=function(R){var k=this.rules.block.table.exec(R);if(k){var Z={type:"table",header:g(k[1].replace(/^ *| *\| *$/g,"")),align:k[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:k[3]?k[3].replace(/\n$/,"").split(`
|
|
`):[]};if(Z.header.length===Z.align.length){Z.raw=k[0];var ee=Z.align.length,se;for(se=0;se<ee;se++)/^ *-+: *$/.test(Z.align[se])?Z.align[se]="right":/^ *:-+: *$/.test(Z.align[se])?Z.align[se]="center":/^ *:-+ *$/.test(Z.align[se])?Z.align[se]="left":Z.align[se]=null;for(ee=Z.cells.length,se=0;se<ee;se++)Z.cells[se]=g(Z.cells[se].replace(/^ *\| *| *\| *$/g,""),Z.header.length);return Z}}},ae.lheading=function(R){var k=this.rules.block.lheading.exec(R);if(k)return{type:"heading",raw:k[0],depth:k[2].charAt(0)==="="?1:2,text:k[1]}},ae.paragraph=function(R){var k=this.rules.block.paragraph.exec(R);if(k)return{type:"paragraph",raw:k[0],text:k[1].charAt(k[1].length-1)===`
|
|
`?k[1].slice(0,-1):k[1]}},ae.text=function(R){var k=this.rules.block.text.exec(R);if(k)return{type:"text",raw:k[0],text:k[0]}},ae.escape=function(R){var k=this.rules.inline.escape.exec(R);if(k)return{type:"escape",raw:k[0],text:v(k[1])}},ae.tag=function(R,k,Z){var ee=this.rules.inline.tag.exec(R);if(ee)return!k&&/^<a /i.test(ee[0])?k=!0:k&&/^<\/a>/i.test(ee[0])&&(k=!1),!Z&&/^<(pre|code|kbd|script)(\s|>)/i.test(ee[0])?Z=!0:Z&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ee[0])&&(Z=!1),{type:this.options.sanitize?"text":"html",raw:ee[0],inLink:k,inRawBlock:Z,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):v(ee[0]):ee[0]}},ae.link=function(R){var k=this.rules.inline.link.exec(R);if(k){var Z=k[2].trim();if(!this.options.pedantic&&/^</.test(Z)){if(!/>$/.test(Z))return;var ee=G(Z.slice(0,-1),"\\");if((Z.length-ee.length)%2===0)return}else{var se=L(k[2],"()");if(se>-1){var Ue=k[0].indexOf("!")===0?5:4,Ge=Ue+k[1].length+se;k[2]=k[2].substring(0,se),k[0]=k[0].substring(0,Ge).trim(),k[3]=""}}var tt=k[2],gt="";if(this.options.pedantic){var wt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(tt);wt&&(tt=wt[1],gt=wt[3])}else gt=k[3]?k[3].slice(1,-1):"";return tt=tt.trim(),/^</.test(tt)&&(this.options.pedantic&&!/>$/.test(Z)?tt=tt.slice(1):tt=tt.slice(1,-1)),X(k,{href:tt&&tt.replace(this.rules.inline._escapes,"$1"),title:gt&>.replace(this.rules.inline._escapes,"$1")},k[0])}},ae.reflink=function(R,k){var Z;if((Z=this.rules.inline.reflink.exec(R))||(Z=this.rules.inline.nolink.exec(R))){var ee=(Z[2]||Z[1]).replace(/\s+/g," ");if(ee=k[ee.toLowerCase()],!ee||!ee.href){var se=Z[0].charAt(0);return{type:"text",raw:se,text:se}}return X(Z,ee,Z[0])}},ae.emStrong=function(R,k,Z){Z===void 0&&(Z="");var ee=this.rules.inline.emStrong.lDelim.exec(R);if(ee&&!(ee[3]&&Z.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 se=ee[1]||ee[2]||"";if(!se||se&&(Z===""||this.rules.inline.punctuation.exec(Z))){var Ue=ee[0].length-1,Ge,tt,gt=Ue,wt=0,$t=ee[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for($t.lastIndex=0,k=k.slice(-1*R.length+Ue);(ee=$t.exec(k))!=null;)if(Ge=ee[1]||ee[2]||ee[3]||ee[4]||ee[5]||ee[6],!!Ge){if(tt=Ge.length,ee[3]||ee[4]){gt+=tt;continue}else if((ee[5]||ee[6])&&Ue%3&&!((Ue+tt)%3)){wt+=tt;continue}if(gt-=tt,!(gt>0))return tt=Math.min(tt,tt+gt+wt),Math.min(Ue,tt)%2?{type:"em",raw:R.slice(0,Ue+ee.index+tt+1),text:R.slice(1,Ue+ee.index+tt)}:{type:"strong",raw:R.slice(0,Ue+ee.index+tt+1),text:R.slice(2,Ue+ee.index+tt-1)}}}}},ae.codespan=function(R){var k=this.rules.inline.code.exec(R);if(k){var Z=k[2].replace(/\n/g," "),ee=/[^ ]/.test(Z),se=/^ /.test(Z)&&/ $/.test(Z);return ee&&se&&(Z=Z.substring(1,Z.length-1)),Z=v(Z,!0),{type:"codespan",raw:k[0],text:Z}}},ae.br=function(R){var k=this.rules.inline.br.exec(R);if(k)return{type:"br",raw:k[0]}},ae.del=function(R){var k=this.rules.inline.del.exec(R);if(k)return{type:"del",raw:k[0],text:k[2]}},ae.autolink=function(R,k){var Z=this.rules.inline.autolink.exec(R);if(Z){var ee,se;return Z[2]==="@"?(ee=v(this.options.mangle?k(Z[1]):Z[1]),se="mailto:"+ee):(ee=v(Z[1]),se=ee),{type:"link",raw:Z[0],text:ee,href:se,tokens:[{type:"text",raw:ee,text:ee}]}}},ae.url=function(R,k){var Z;if(Z=this.rules.inline.url.exec(R)){var ee,se;if(Z[2]==="@")ee=v(this.options.mangle?k(Z[0]):Z[0]),se="mailto:"+ee;else{var Ue;do Ue=Z[0],Z[0]=this.rules.inline._backpedal.exec(Z[0])[0];while(Ue!==Z[0]);ee=v(Z[0]),Z[1]==="www."?se="http://"+ee:se=ee}return{type:"link",raw:Z[0],text:ee,href:se,tokens:[{type:"text",raw:ee,text:ee}]}}},ae.inlineText=function(R,k,Z){var ee=this.rules.inline.text.exec(R);if(ee){var se;return k?se=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):v(ee[0]):ee[0]:se=v(this.options.smartypants?Z(ee[0]):ee[0]),{type:"text",raw:ee[0],text:se}}},fe}(),ht=B.noopTest,Ke=B.edit,yt=B.merge,ot={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:ht,table:ht,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};ot._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ot._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ot.def=Ke(ot.def).replace("label",ot._label).replace("title",ot._title).getRegex(),ot.bullet=/(?:[*+-]|\d{1,9}[.)])/,ot.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,ot.item=Ke(ot.item,"gm").replace(/bull/g,ot.bullet).getRegex(),ot.listItemStart=Ke(/^( *)(bull) */).replace("bull",ot.bullet).getRegex(),ot.list=Ke(ot.list).replace(/bull/g,ot.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ot.def.source+")").getRegex(),ot._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",ot._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,ot.html=Ke(ot.html,"i").replace("comment",ot._comment).replace("tag",ot._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ot.paragraph=Ke(ot._paragraph).replace("hr",ot.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",ot._tag).getRegex(),ot.blockquote=Ke(ot.blockquote).replace("paragraph",ot.paragraph).getRegex(),ot.normal=yt({},ot),ot.gfm=yt({},ot.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*|$)"}),ot.gfm.nptable=Ke(ot.gfm.nptable).replace("hr",ot.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",ot._tag).getRegex(),ot.gfm.table=Ke(ot.gfm.table).replace("hr",ot.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",ot._tag).getRegex(),ot.pedantic=yt({},ot.normal,{html:Ke(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ot._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:ht,paragraph:Ke(ot.normal._paragraph).replace("hr",ot.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ot.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var je={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ht,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:ht,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};je._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",je.punctuation=Ke(je.punctuation).replace(/punctuation/g,je._punctuation).getRegex(),je.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,je.escapedEmSt=/\\\*|\\_/g,je._comment=Ke(ot._comment).replace("(?:-->|$)","-->").getRegex(),je.emStrong.lDelim=Ke(je.emStrong.lDelim).replace(/punct/g,je._punctuation).getRegex(),je.emStrong.rDelimAst=Ke(je.emStrong.rDelimAst,"g").replace(/punct/g,je._punctuation).getRegex(),je.emStrong.rDelimUnd=Ke(je.emStrong.rDelimUnd,"g").replace(/punct/g,je._punctuation).getRegex(),je._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,je._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,je._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])?)+(?![-_])/,je.autolink=Ke(je.autolink).replace("scheme",je._scheme).replace("email",je._email).getRegex(),je._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,je.tag=Ke(je.tag).replace("comment",je._comment).replace("attribute",je._attribute).getRegex(),je._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,je._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,je._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,je.link=Ke(je.link).replace("label",je._label).replace("href",je._href).replace("title",je._title).getRegex(),je.reflink=Ke(je.reflink).replace("label",je._label).getRegex(),je.reflinkSearch=Ke(je.reflinkSearch,"g").replace("reflink",je.reflink).replace("nolink",je.nolink).getRegex(),je.normal=yt({},je),je.pedantic=yt({},je.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:Ke(/^!?\[(label)\]\((.*?)\)/).replace("label",je._label).getRegex(),reflink:Ke(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",je._label).getRegex()}),je.gfm=yt({},je.normal,{escape:Ke(je.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),je.gfm.url=Ke(je.gfm.url,"i").replace("email",je.gfm._extended_email).getRegex(),je.breaks=yt({},je.gfm,{br:Ke(je.br).replace("{2,}","*").getRegex(),text:Ke(je.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var zt={block:ot,inline:je},Ft=Be,ci=te.exports.defaults,pt=zt.block,mi=zt.inline,we=B.repeatString;function me(fe){return fe.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 ie(fe){var ae="",oe,R,k=fe.length;for(oe=0;oe<k;oe++)R=fe.charCodeAt(oe),Math.random()>.5&&(R="x"+R.toString(16)),ae+="&#"+R+";";return ae}var ke=function(){function fe(oe){this.tokens=[],this.tokens.links=Object.create(null),this.options=oe||ci,this.options.tokenizer=this.options.tokenizer||new Ft,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var R={block:pt.normal,inline:mi.normal};this.options.pedantic?(R.block=pt.pedantic,R.inline=mi.pedantic):this.options.gfm&&(R.block=pt.gfm,this.options.breaks?R.inline=mi.breaks:R.inline=mi.gfm),this.tokenizer.rules=R}fe.lex=function(R,k){var Z=new fe(k);return Z.lex(R)},fe.lexInline=function(R,k){var Z=new fe(k);return Z.inlineTokens(R)};var ae=fe.prototype;return ae.lex=function(R){return R=R.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(R,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(R,k,Z){k===void 0&&(k=[]),Z===void 0&&(Z=!0),this.options.pedantic&&(R=R.replace(/^ +$/gm,""));for(var ee,se,Ue,Ge;R;){if(ee=this.tokenizer.space(R)){R=R.substring(ee.raw.length),ee.type&&k.push(ee);continue}if(ee=this.tokenizer.code(R)){R=R.substring(ee.raw.length),Ge=k[k.length-1],Ge&&Ge.type==="paragraph"?(Ge.raw+=`
|
|
`+ee.raw,Ge.text+=`
|
|
`+ee.text):k.push(ee);continue}if(ee=this.tokenizer.fences(R)){R=R.substring(ee.raw.length),k.push(ee);continue}if(ee=this.tokenizer.heading(R)){R=R.substring(ee.raw.length),k.push(ee);continue}if(ee=this.tokenizer.nptable(R)){R=R.substring(ee.raw.length),k.push(ee);continue}if(ee=this.tokenizer.hr(R)){R=R.substring(ee.raw.length),k.push(ee);continue}if(ee=this.tokenizer.blockquote(R)){R=R.substring(ee.raw.length),ee.tokens=this.blockTokens(ee.text,[],Z),k.push(ee);continue}if(ee=this.tokenizer.list(R)){for(R=R.substring(ee.raw.length),Ue=ee.items.length,se=0;se<Ue;se++)ee.items[se].tokens=this.blockTokens(ee.items[se].text,[],!1);k.push(ee);continue}if(ee=this.tokenizer.html(R)){R=R.substring(ee.raw.length),k.push(ee);continue}if(Z&&(ee=this.tokenizer.def(R))){R=R.substring(ee.raw.length),this.tokens.links[ee.tag]||(this.tokens.links[ee.tag]={href:ee.href,title:ee.title});continue}if(ee=this.tokenizer.table(R)){R=R.substring(ee.raw.length),k.push(ee);continue}if(ee=this.tokenizer.lheading(R)){R=R.substring(ee.raw.length),k.push(ee);continue}if(Z&&(ee=this.tokenizer.paragraph(R))){R=R.substring(ee.raw.length),k.push(ee);continue}if(ee=this.tokenizer.text(R)){R=R.substring(ee.raw.length),Ge=k[k.length-1],Ge&&Ge.type==="text"?(Ge.raw+=`
|
|
`+ee.raw,Ge.text+=`
|
|
`+ee.text):k.push(ee);continue}if(R){var tt="Infinite loop on byte: "+R.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return k},ae.inline=function(R){var k,Z,ee,se,Ue,Ge,tt=R.length;for(k=0;k<tt;k++)switch(Ge=R[k],Ge.type){case"paragraph":case"text":case"heading":{Ge.tokens=[],this.inlineTokens(Ge.text,Ge.tokens);break}case"table":{for(Ge.tokens={header:[],cells:[]},se=Ge.header.length,Z=0;Z<se;Z++)Ge.tokens.header[Z]=[],this.inlineTokens(Ge.header[Z],Ge.tokens.header[Z]);for(se=Ge.cells.length,Z=0;Z<se;Z++)for(Ue=Ge.cells[Z],Ge.tokens.cells[Z]=[],ee=0;ee<Ue.length;ee++)Ge.tokens.cells[Z][ee]=[],this.inlineTokens(Ue[ee],Ge.tokens.cells[Z][ee]);break}case"blockquote":{this.inline(Ge.tokens);break}case"list":{for(se=Ge.items.length,Z=0;Z<se;Z++)this.inline(Ge.items[Z].tokens);break}}return R},ae.inlineTokens=function(R,k,Z,ee){k===void 0&&(k=[]),Z===void 0&&(Z=!1),ee===void 0&&(ee=!1);var se,Ue,Ge=R,tt,gt,wt;if(this.tokens.links){var $t=Object.keys(this.tokens.links);if($t.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Ge))!=null;)$t.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Ge=Ge.slice(0,tt.index)+"["+we("a",tt[0].length-2)+"]"+Ge.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Ge))!=null;)Ge=Ge.slice(0,tt.index)+"["+we("a",tt[0].length-2)+"]"+Ge.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(tt=this.tokenizer.rules.inline.escapedEmSt.exec(Ge))!=null;)Ge=Ge.slice(0,tt.index)+"++"+Ge.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;R;){if(gt||(wt=""),gt=!1,se=this.tokenizer.escape(R)){R=R.substring(se.raw.length),k.push(se);continue}if(se=this.tokenizer.tag(R,Z,ee)){R=R.substring(se.raw.length),Z=se.inLink,ee=se.inRawBlock;var Dt=k[k.length-1];Dt&&se.type==="text"&&Dt.type==="text"?(Dt.raw+=se.raw,Dt.text+=se.text):k.push(se);continue}if(se=this.tokenizer.link(R)){R=R.substring(se.raw.length),se.type==="link"&&(se.tokens=this.inlineTokens(se.text,[],!0,ee)),k.push(se);continue}if(se=this.tokenizer.reflink(R,this.tokens.links)){R=R.substring(se.raw.length);var rt=k[k.length-1];se.type==="link"?(se.tokens=this.inlineTokens(se.text,[],!0,ee),k.push(se)):rt&&se.type==="text"&&rt.type==="text"?(rt.raw+=se.raw,rt.text+=se.text):k.push(se);continue}if(se=this.tokenizer.emStrong(R,Ge,wt)){R=R.substring(se.raw.length),se.tokens=this.inlineTokens(se.text,[],Z,ee),k.push(se);continue}if(se=this.tokenizer.codespan(R)){R=R.substring(se.raw.length),k.push(se);continue}if(se=this.tokenizer.br(R)){R=R.substring(se.raw.length),k.push(se);continue}if(se=this.tokenizer.del(R)){R=R.substring(se.raw.length),se.tokens=this.inlineTokens(se.text,[],Z,ee),k.push(se);continue}if(se=this.tokenizer.autolink(R,ie)){R=R.substring(se.raw.length),k.push(se);continue}if(!Z&&(se=this.tokenizer.url(R,ie))){R=R.substring(se.raw.length),k.push(se);continue}if(se=this.tokenizer.inlineText(R,ee,me)){R=R.substring(se.raw.length),se.raw.slice(-1)!=="_"&&(wt=se.raw.slice(-1)),gt=!0,Ue=k[k.length-1],Ue&&Ue.type==="text"?(Ue.raw+=se.raw,Ue.text+=se.text):k.push(se);continue}if(R){var Lt="Infinite loop on byte: "+R.charCodeAt(0);if(this.options.silent){console.error(Lt);break}else throw new Error(Lt)}}return k},W(fe,null,[{key:"rules",get:function(){return{block:pt,inline:mi}}}]),fe}(),ze=te.exports.defaults,Qe=B.cleanUrl,K=B.escape,ne=function(){function fe(oe){this.options=oe||ze}var ae=fe.prototype;return ae.code=function(R,k,Z){var ee=(k||"").match(/\S*/)[0];if(this.options.highlight){var se=this.options.highlight(R,ee);se!=null&&se!==R&&(Z=!0,R=se)}return R=R.replace(/\n$/,"")+`
|
|
`,ee?'<pre><code class="'+this.options.langPrefix+K(ee,!0)+'">'+(Z?R:K(R,!0))+`</code></pre>
|
|
`:"<pre><code>"+(Z?R:K(R,!0))+`</code></pre>
|
|
`},ae.blockquote=function(R){return`<blockquote>
|
|
`+R+`</blockquote>
|
|
`},ae.html=function(R){return R},ae.heading=function(R,k,Z,ee){return this.options.headerIds?"<h"+k+' id="'+this.options.headerPrefix+ee.slug(Z)+'">'+R+"</h"+k+`>
|
|
`:"<h"+k+">"+R+"</h"+k+`>
|
|
`},ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ae.list=function(R,k,Z){var ee=k?"ol":"ul",se=k&&Z!==1?' start="'+Z+'"':"";return"<"+ee+se+`>
|
|
`+R+"</"+ee+`>
|
|
`},ae.listitem=function(R){return"<li>"+R+`</li>
|
|
`},ae.checkbox=function(R){return"<input "+(R?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(R){return"<p>"+R+`</p>
|
|
`},ae.table=function(R,k){return k&&(k="<tbody>"+k+"</tbody>"),`<table>
|
|
<thead>
|
|
`+R+`</thead>
|
|
`+k+`</table>
|
|
`},ae.tablerow=function(R){return`<tr>
|
|
`+R+`</tr>
|
|
`},ae.tablecell=function(R,k){var Z=k.header?"th":"td",ee=k.align?"<"+Z+' align="'+k.align+'">':"<"+Z+">";return ee+R+"</"+Z+`>
|
|
`},ae.strong=function(R){return"<strong>"+R+"</strong>"},ae.em=function(R){return"<em>"+R+"</em>"},ae.codespan=function(R){return"<code>"+R+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(R){return"<del>"+R+"</del>"},ae.link=function(R,k,Z){if(R=Qe(this.options.sanitize,this.options.baseUrl,R),R===null)return Z;var ee='<a href="'+K(R)+'"';return k&&(ee+=' title="'+k+'"'),ee+=">"+Z+"</a>",ee},ae.image=function(R,k,Z){if(R=Qe(this.options.sanitize,this.options.baseUrl,R),R===null)return Z;var ee='<img src="'+R+'" alt="'+Z+'"';return k&&(ee+=' title="'+k+'"'),ee+=this.options.xhtml?"/>":">",ee},ae.text=function(R){return R},fe}(),Se=function(){function fe(){}var ae=fe.prototype;return ae.strong=function(R){return R},ae.em=function(R){return R},ae.codespan=function(R){return R},ae.del=function(R){return R},ae.html=function(R){return R},ae.text=function(R){return R},ae.link=function(R,k,Z){return""+Z},ae.image=function(R,k,Z){return""+Z},ae.br=function(){return""},fe}(),Te=function(){function fe(){this.seen={}}var ae=fe.prototype;return ae.serialize=function(R){return R.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},ae.getNextSafeSlug=function(R,k){var Z=R,ee=0;if(this.seen.hasOwnProperty(Z)){ee=this.seen[R];do ee++,Z=R+"-"+ee;while(this.seen.hasOwnProperty(Z))}return k||(this.seen[R]=ee,this.seen[Z]=0),Z},ae.slug=function(R,k){k===void 0&&(k={});var Z=this.serialize(R);return this.getNextSafeSlug(Z,k.dryrun)},fe}(),Ne=ne,He=Se,bt=Te,Xe=te.exports.defaults,lt=B.unescape,qe=function(){function fe(oe){this.options=oe||Xe,this.options.renderer=this.options.renderer||new Ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new He,this.slugger=new bt}fe.parse=function(R,k){var Z=new fe(k);return Z.parse(R)},fe.parseInline=function(R,k){var Z=new fe(k);return Z.parseInline(R)};var ae=fe.prototype;return ae.parse=function(R,k){k===void 0&&(k=!0);var Z="",ee,se,Ue,Ge,tt,gt,wt,$t,Dt,rt,Lt,Jt,Xt,ri,Vt,jt,Fi,ki,qi=R.length;for(ee=0;ee<qi;ee++)switch(rt=R[ee],rt.type){case"space":continue;case"hr":{Z+=this.renderer.hr();continue}case"heading":{Z+=this.renderer.heading(this.parseInline(rt.tokens),rt.depth,lt(this.parseInline(rt.tokens,this.textRenderer)),this.slugger);continue}case"code":{Z+=this.renderer.code(rt.text,rt.lang,rt.escaped);continue}case"table":{for($t="",wt="",Ge=rt.header.length,se=0;se<Ge;se++)wt+=this.renderer.tablecell(this.parseInline(rt.tokens.header[se]),{header:!0,align:rt.align[se]});for($t+=this.renderer.tablerow(wt),Dt="",Ge=rt.cells.length,se=0;se<Ge;se++){for(gt=rt.tokens.cells[se],wt="",tt=gt.length,Ue=0;Ue<tt;Ue++)wt+=this.renderer.tablecell(this.parseInline(gt[Ue]),{header:!1,align:rt.align[Ue]});Dt+=this.renderer.tablerow(wt)}Z+=this.renderer.table($t,Dt);continue}case"blockquote":{Dt=this.parse(rt.tokens),Z+=this.renderer.blockquote(Dt);continue}case"list":{for(Lt=rt.ordered,Jt=rt.start,Xt=rt.loose,Ge=rt.items.length,Dt="",se=0;se<Ge;se++)Vt=rt.items[se],jt=Vt.checked,Fi=Vt.task,ri="",Vt.task&&(ki=this.renderer.checkbox(jt),Xt?Vt.tokens.length>0&&Vt.tokens[0].type==="text"?(Vt.tokens[0].text=ki+" "+Vt.tokens[0].text,Vt.tokens[0].tokens&&Vt.tokens[0].tokens.length>0&&Vt.tokens[0].tokens[0].type==="text"&&(Vt.tokens[0].tokens[0].text=ki+" "+Vt.tokens[0].tokens[0].text)):Vt.tokens.unshift({type:"text",text:ki}):ri+=ki),ri+=this.parse(Vt.tokens,Xt),Dt+=this.renderer.listitem(ri,Fi,jt);Z+=this.renderer.list(Dt,Lt,Jt);continue}case"html":{Z+=this.renderer.html(rt.text);continue}case"paragraph":{Z+=this.renderer.paragraph(this.parseInline(rt.tokens));continue}case"text":{for(Dt=rt.tokens?this.parseInline(rt.tokens):rt.text;ee+1<qi&&R[ee+1].type==="text";)rt=R[++ee],Dt+=`
|
|
`+(rt.tokens?this.parseInline(rt.tokens):rt.text);Z+=k?this.renderer.paragraph(Dt):Dt;continue}default:{var wi='Token with "'+rt.type+'" type was not found.';if(this.options.silent){console.error(wi);return}else throw new Error(wi)}}return Z},ae.parseInline=function(R,k){k=k||this.renderer;var Z="",ee,se,Ue=R.length;for(ee=0;ee<Ue;ee++)switch(se=R[ee],se.type){case"escape":{Z+=k.text(se.text);break}case"html":{Z+=k.html(se.text);break}case"link":{Z+=k.link(se.href,se.title,this.parseInline(se.tokens,k));break}case"image":{Z+=k.image(se.href,se.title,se.text);break}case"strong":{Z+=k.strong(this.parseInline(se.tokens,k));break}case"em":{Z+=k.em(this.parseInline(se.tokens,k));break}case"codespan":{Z+=k.codespan(se.text);break}case"br":{Z+=k.br();break}case"del":{Z+=k.del(this.parseInline(se.tokens,k));break}case"text":{Z+=k.text(se.text);break}default:{var Ge='Token with "'+se.type+'" type was not found.';if(this.options.silent){console.error(Ge);return}else throw new Error(Ge)}}return Z},fe}(),_t=ke,ct=qe,he=Be,_e=ne,Me=Se,$e=Te,Pe=B.merge,st=B.checkSanitizeDeprecation,nt=B.escape,Je=te.exports.getDefaults,ft=te.exports.changeDefaults,At=te.exports.defaults;function Ze(fe,ae,oe){if(typeof fe=="undefined"||fe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof fe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(fe)+", string expected");if(typeof ae=="function"&&(oe=ae,ae=null),ae=Pe({},Ze.defaults,ae||{}),st(ae),oe){var R=ae.highlight,k;try{k=_t.lex(fe,ae)}catch(Ue){return oe(Ue)}var Z=function(Ge){var tt;if(!Ge)try{ae.walkTokens&&Ze.walkTokens(k,ae.walkTokens),tt=ct.parse(k,ae)}catch(gt){Ge=gt}return ae.highlight=R,Ge?oe(Ge):oe(null,tt)};if(!R||R.length<3||(delete ae.highlight,!k.length))return Z();var ee=0;Ze.walkTokens(k,function(Ue){Ue.type==="code"&&(ee++,setTimeout(function(){R(Ue.text,Ue.lang,function(Ge,tt){if(Ge)return Z(Ge);tt!=null&&tt!==Ue.text&&(Ue.text=tt,Ue.escaped=!0),ee--,ee===0&&Z()})},0))}),ee===0&&Z();return}try{var se=_t.lex(fe,ae);return ae.walkTokens&&Ze.walkTokens(se,ae.walkTokens),ct.parse(se,ae)}catch(Ue){if(Ue.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+nt(Ue.message+"",!0)+"</pre>";throw Ue}}Ze.options=Ze.setOptions=function(fe){return Pe(Ze.defaults,fe),ft(Ze.defaults),Ze},Ze.getDefaults=Je,Ze.defaults=At,Ze.use=function(fe){var ae=Pe({},fe);if(fe.renderer&&function(){var R=Ze.defaults.renderer||new _e,k=function(se){var Ue=R[se];R[se]=function(){for(var Ge=arguments.length,tt=new Array(Ge),gt=0;gt<Ge;gt++)tt[gt]=arguments[gt];var wt=fe.renderer[se].apply(R,tt);return wt===!1&&(wt=Ue.apply(R,tt)),wt}};for(var Z in fe.renderer)k(Z);ae.renderer=R}(),fe.tokenizer&&function(){var R=Ze.defaults.tokenizer||new he,k=function(se){var Ue=R[se];R[se]=function(){for(var Ge=arguments.length,tt=new Array(Ge),gt=0;gt<Ge;gt++)tt[gt]=arguments[gt];var wt=fe.tokenizer[se].apply(R,tt);return wt===!1&&(wt=Ue.apply(R,tt)),wt}};for(var Z in fe.tokenizer)k(Z);ae.tokenizer=R}(),fe.walkTokens){var oe=Ze.defaults.walkTokens;ae.walkTokens=function(R){fe.walkTokens(R),oe&&oe(R)}}Ze.setOptions(ae)},Ze.walkTokens=function(fe,ae){for(var oe=Ie(fe),R;!(R=oe()).done;){var k=R.value;switch(ae(k),k.type){case"table":{for(var Z=Ie(k.tokens.header),ee;!(ee=Z()).done;){var se=ee.value;Ze.walkTokens(se,ae)}for(var Ue=Ie(k.tokens.cells),Ge;!(Ge=Ue()).done;)for(var tt=Ge.value,gt=Ie(tt),wt;!(wt=gt()).done;){var $t=wt.value;Ze.walkTokens($t,ae)}break}case"list":{Ze.walkTokens(k.items,ae);break}default:k.tokens&&Ze.walkTokens(k.tokens,ae)}}},Ze.parseInline=function(fe,ae){if(typeof fe=="undefined"||fe===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof fe!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(fe)+", string expected");ae=Pe({},Ze.defaults,ae||{}),st(ae);try{var oe=_t.lexInline(fe,ae);return ae.walkTokens&&Ze.walkTokens(oe,ae.walkTokens),ct.parseInline(oe,ae)}catch(R){if(R.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+nt(R.message+"",!0)+"</pre>";throw R}},Ze.Parser=ct,Ze.parser=ct.parse,Ze.Renderer=_e,Ze.TextRenderer=Me,Ze.Lexer=_t,Ze.lexer=_t.lex,Ze.Tokenizer=he,Ze.Slugger=$e,Ze.parse=Ze;var dt=Ze;return dt})},11690:function(Ut){const at=/[&<>"']/,W=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,de=/[<>"']|&(?!#?\w+;)/g,Ie={"&":"&","<":"<",">":">",'"':""","'":"'"},te=H=>Ie[H];function M(H,ye){if(ye){if(at.test(H))return H.replace(W,te)}else if(V.test(H))return H.replace(de,te);return H}const p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ce(H){return H.replace(p,(ye,be)=>(be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""))}const J=/(^|[^\[])\^/g;function l(H,ye){H=H.source||H,ye=ye||"";const be={replace:(Ee,We)=>(We=We.source||We,We=We.replace(J,"$1"),H=H.replace(Ee,We),be),getRegex:()=>new RegExp(H,ye)};return be}const z=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function m(H,ye,be){if(H){let Ee;try{Ee=decodeURIComponent(ce(be)).replace(z,"").toLowerCase()}catch(We){return null}if(Ee.indexOf("javascript:")===0||Ee.indexOf("vbscript:")===0||Ee.indexOf("data:")===0)return null}ye&&!x.test(be)&&(be=C(ye,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(Ee){return null}return be}const _={},b=/^[^:]+:\/*[^/]*$/,T=/^([^:]+:)[\s\S]*$/,F=/^([^:]+:\/*[^/]*)[\s\S]*$/;function C(H,ye){_[" "+H]||(b.test(H)?_[" "+H]=H+"/":_[" "+H]=N(H,"/",!0)),H=_[" "+H];const be=H.indexOf(":")===-1;return ye.substring(0,2)==="//"?be?ye:H.replace(T,"$1")+ye:ye.charAt(0)==="/"?be?ye:H.replace(F,"$1")+ye:H+ye}const P={exec:function(){}};function w(H){let ye=1,be,Ee;for(;ye<arguments.length;ye++){be=arguments[ye];for(Ee in be)Object.prototype.hasOwnProperty.call(be,Ee)&&(H[Ee]=be[Ee])}return H}function I(H,ye){const be=H.replace(/\|/g,($,D,O)=>{let B=!1,Q=D;for(;--Q>=0&&O[Q]==="\\";)B=!B;return B?"|":" |"}),Ee=be.split(/ \|/);let We=0;if(Ee.length>ye)Ee.splice(ye);else for(;Ee.length<ye;)Ee.push("");for(;We<Ee.length;We++)Ee[We]=Ee[We].trim().replace(/\\\|/g,"|");return Ee}function N(H,ye,be){const Ee=H.length;if(Ee===0)return"";let We=0;for(;We<Ee;){const $=H.charAt(Ee-We-1);if($===ye&&!be)We++;else if($!==ye&&be)We++;else break}return H.substr(0,Ee-We)}function q(H,ye){if(H.indexOf(ye[1])===-1)return-1;const be=H.length;let Ee=0,We=0;for(;We<be;We++)if(H[We]==="\\")We++;else if(H[We]===ye[0])Ee++;else if(H[We]===ye[1]&&(Ee--,Ee<0))return We;return-1}function re(H){H&&H.sanitize&&!H.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 le(H,ye){if(ye<1)return"";let be="";for(;ye>1;)ye&1&&(be+=H),ye>>=1,H+=H;return be+H}Ut.exports={escape:M,unescape:ce,edit:l,cleanUrl:m,resolveUrl:C,noopTest:P,merge:w,splitCells:I,rtrim:N,findClosingBracket:q,checkSanitizeDeprecation:re,repeatString:le}},75918:function(Ut,at,W){"use strict";W.d(at,{Wi:function(){return p},Z0:function(){return ce},aU:function(){return M},eZ:function(){return l},wY:function(){return J}});var V=W(4348),de=W(69323),Ie=W(13268),te=function(z,x,m,_){function b(T){return T instanceof m?T:new m(function(F){F(T)})}return new(m||(m=Promise))(function(T,F){function C(I){try{w(_.next(I))}catch(N){F(N)}}function P(I){try{w(_.throw(I))}catch(N){F(N)}}function w(I){I.done?T(I.value):b(I.value).then(C,P)}w((_=_.apply(z,x||[])).next())})};class M extends de.JT{constructor(x,m="",_="",b=!0,T){super(),this._onDidChange=this._register(new V.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=x,this._label=m,this._cssClass=_,this._enabled=b,this._actionCallback=T}get id(){return this._id}get label(){return this._label}set label(x){this._setLabel(x)}_setLabel(x){this._label!==x&&(this._label=x,this._onDidChange.fire({label:x}))}get tooltip(){return this._tooltip||""}set tooltip(x){this._setTooltip(x)}_setTooltip(x){this._tooltip!==x&&(this._tooltip=x,this._onDidChange.fire({tooltip:x}))}get class(){return this._cssClass}set class(x){this._setClass(x)}_setClass(x){this._cssClass!==x&&(this._cssClass=x,this._onDidChange.fire({class:x}))}get enabled(){return this._enabled}set enabled(x){this._setEnabled(x)}_setEnabled(x){this._enabled!==x&&(this._enabled=x,this._onDidChange.fire({enabled:x}))}get checked(){return this._checked}set checked(x){this._setChecked(x)}_setChecked(x){this._checked!==x&&(this._checked=x,this._onDidChange.fire({checked:x}))}run(x,m){return te(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(x))})}}class p extends de.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new V.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new V.Q5),this.onDidRun=this._onDidRun.event}run(x,m){return te(this,void 0,void 0,function*(){if(!x.enabled)return;this._onBeforeRun.fire({action:x});let _;try{yield this.runAction(x,m)}catch(b){_=b}this._onDidRun.fire({action:x,error:_})})}runAction(x,m){return te(this,void 0,void 0,function*(){yield x.run(m)})}}class ce extends M{constructor(x){super(ce.ID,x,x?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ce.ID="vs.actions.separator";class J{constructor(x,m,_,b){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=x,this.label=m,this.class=b,this._actions=_}get actions(){return this._actions}dispose(){}run(){return te(this,void 0,void 0,function*(){})}}class l extends M{constructor(){super(l.ID,Ie.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Ut,at,W){"use strict";W.d(at,{ok:function(){return V}});function V(de,Ie){if(!de)throw new Error(Ie?`Assertion failed (${Ie})`:"Assertion Failed")}},52615:function(Ut,at,W){"use strict";W.d(at,{CM:function(){return M},JL:function(){return p},dT:function(){return J},fK:function(){return te},lA:function(){return ce}});var V=W(4348);class de{constructor(){this._icons=new Map,this._onDidRegister=new V.Q5}add(z){const x=this._icons.get(z.id);x?z.description?x.description=z.description:console.error(`Duplicate registration of codicon ${z.id}`):(this._icons.set(z.id,z),this._onDidRegister.fire(z))}get(z){return this._icons.get(z)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Ie=new de,te=Ie;function M(l,z){return new ce(l,z)}function p(l){return l?l.replace(/\$\((.*?)\)/g,(z,x)=>` ${x} `).trim():""}class ce{constructor(z,x,m){this.id=z,this.definition=x,this.description=m,Ie.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var J;(function(l){l.iconNameSegment="[A-Za-z0-9]+",l.iconNameExpression="[A-Za-z0-9\\-]+",l.iconModifierExpression="~[A-Za-z]+";const z=new RegExp(`^(${l.iconNameExpression})(${l.iconModifierExpression})?$`);function x(b){if(b instanceof ce)return["codicon","codicon-"+b.id];const T=z.exec(b.id);if(!T)return x(ce.error);let[,F,C]=T;const P=["codicon","codicon-"+F];return C&&P.push("codicon-modifier-"+C.substr(1)),P}l.asClassNameArray=x;function m(b){return x(b).join(" ")}l.asClassName=m;function _(b){return"."+x(b).join(".")}l.asCSSSelector=_})(J||(J={})),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"})}(ce||(ce={}))},79881:function(Ut,at,W){"use strict";W.d(at,{B8:function(){return x},Cp:function(){return te},F0:function(){return J},L6:function(){return z},VV:function(){return ce},b1:function(){return l},dL:function(){return Ie},ri:function(){return M}});class V{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(_){setTimeout(()=>{throw _.stack?new Error(_.message+`
|
|
|
|
`+_.stack):_},0)}}emit(_){this.listeners.forEach(b=>{b(_)})}onUnexpectedError(_){this.unexpectedErrorHandler(_),this.emit(_)}onUnexpectedExternalError(_){this.unexpectedErrorHandler(_)}}const de=new V;function Ie(m){ce(m)||de.onUnexpectedError(m)}function te(m){ce(m)||de.onUnexpectedExternalError(m)}function M(m){if(m instanceof Error){let{name:_,message:b}=m;const T=m.stacktrace||m.stack;return{$isError:!0,name:_,message:b,stack:T}}return m}const p="Canceled";function ce(m){return m instanceof Error&&m.name===p&&m.message===p}function J(){const m=new Error(p);return m.name=m.message,m}function l(m){return m?new Error(`Illegal argument: ${m}`):new Error("Illegal argument")}function z(m){return m?new Error(`Illegal state: ${m}`):new Error("Illegal state")}class x extends Error{constructor(_){super("NotSupported"),_&&(this.message=_)}}},4348:function(Ut,at,W){"use strict";W.d(at,{D0:function(){return x},E7:function(){return m},K3:function(){return z},Q5:function(){return l},ZD:function(){return _},ju:function(){return M}});var V=W(79881),de=W(69323),Ie=W(34502),te=W(95830),M;(function(b){b.None=()=>de.JT.None;function T(O){return(B,Q=null,G)=>{let g=!1,v;return v=O(L=>{if(!g)return v?v.dispose():g=!0,B.call(Q,L)},null,G),g&&v.dispose(),v}}b.once=T;function F(O,B){return q((Q,G=null,g)=>O(v=>Q.call(G,B(v)),null,g))}b.map=F;function C(O,B){return q((Q,G=null,g)=>O(v=>{B(v),Q.call(G,v)},null,g))}b.forEach=C;function P(O,B){return q((Q,G=null,g)=>O(v=>B(v)&&Q.call(G,v),null,g))}b.filter=P;function w(O){return O}b.signal=w;function I(...O){return(B,Q=null,G)=>(0,de.F8)(...O.map(g=>g(v=>B.call(Q,v),null,G)))}b.any=I;function N(O,B,Q){let G=Q;return F(O,g=>(G=B(G,g),G))}b.reduce=N;function q(O){let B;const Q=new l({onFirstListenerAdd(){B=O(Q.fire,Q)},onLastListenerRemove(){B.dispose()}});return Q.event}function re(O,B,Q=100,G=!1,g){let v,L,X,Ae=0;const Be=new l({leakWarningThreshold:g,onFirstListenerAdd(){v=O(ht=>{Ae++,L=B(L,ht),G&&!X&&(Be.fire(L),L=void 0),clearTimeout(X),X=setTimeout(()=>{const Ke=L;L=void 0,X=void 0,(!G||Ae>1)&&Be.fire(Ke),Ae=0},Q)})},onLastListenerRemove(){v.dispose()}});return Be.event}b.debounce=re;function le(O,B=(Q,G)=>Q===G){let Q=!0,G;return P(O,g=>{const v=Q||!B(g,G);return Q=!1,G=g,v})}b.latch=le;function H(O,B){return[b.filter(O,B),b.filter(O,Q=>!B(Q))]}b.split=H;function ye(O,B=!1,Q=[]){let G=Q.slice(),g=O(X=>{G?G.push(X):L.fire(X)});const v=()=>{G&&G.forEach(X=>L.fire(X)),G=null},L=new l({onFirstListenerAdd(){g||(g=O(X=>L.fire(X)))},onFirstListenerDidAdd(){G&&(B?setTimeout(v):v())},onLastListenerRemove(){g&&g.dispose(),g=null}});return L.event}b.buffer=ye;class be{constructor(B){this.event=B}map(B){return new be(F(this.event,B))}forEach(B){return new be(C(this.event,B))}filter(B){return new be(P(this.event,B))}reduce(B,Q){return new be(N(this.event,B,Q))}latch(){return new be(le(this.event))}debounce(B,Q=100,G=!1,g){return new be(re(this.event,B,Q,G,g))}on(B,Q,G){return this.event(B,Q,G)}once(B,Q,G){return T(this.event)(B,Q,G)}}function Ee(O){return new be(O)}b.chain=Ee;function We(O,B,Q=G=>G){const G=(...X)=>L.fire(Q(...X)),g=()=>O.on(B,G),v=()=>O.removeListener(B,G),L=new l({onFirstListenerAdd:g,onLastListenerRemove:v});return L.event}b.fromNodeEventEmitter=We;function $(O,B,Q=G=>G){const G=(...X)=>L.fire(Q(...X)),g=()=>O.addEventListener(B,G),v=()=>O.removeEventListener(B,G),L=new l({onFirstListenerAdd:g,onLastListenerRemove:v});return L.event}b.fromDOMEventEmitter=$;function D(O){return new Promise(B=>T(O)(B))}b.toPromise=D})(M||(M={}));class p{constructor(T){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${T}_${p._idPool++}`}start(T){this._stopWatch=new te.G(!0),this._listenerCount=T}stop(){if(this._stopWatch){const T=this._stopWatch.elapsed();this._elapsedOverall+=T,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${T.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}p._idPool=0;let ce=-1;class J{constructor(T,F=Math.random().toString(18).slice(2,5)){this.customThreshold=T,this.name=F,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(T){let F=ce;if(typeof this.customThreshold=="number"&&(F=this.customThreshold),F<=0||T<F)return;this._stacks||(this._stacks=new Map);const C=new Error().stack.split(`
|
|
`).slice(3).join(`
|
|
`),P=this._stacks.get(C)||0;if(this._stacks.set(C,P+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=F*.5;let w,I=0;for(const[N,q]of this._stacks)(!w||I<q)&&(w=N,I=q);console.warn(`[${this.name}] potential listener LEAK detected, having ${T} listeners already. MOST frequent listener (${I}):`),console.warn(w)}return()=>{const w=this._stacks.get(C)||0;this._stacks.set(C,w-1)}}}class l{constructor(T){var F;this._disposed=!1,this._options=T,this._leakageMon=ce>0?new J(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((F=this._options)===null||F===void 0)&&F._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(T,F,C)=>{var P;this._listeners||(this._listeners=new Ie.S);const w=this._listeners.isEmpty();w&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const I=this._listeners.push(F?[T,F]:T);w&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,T,F);const N=(P=this._leakageMon)===null||P===void 0?void 0:P.check(this._listeners.size),q=(0,de.OF)(()=>{N&&N(),this._disposed||(I(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return C instanceof de.SL?C.add(q):Array.isArray(C)&&C.push(q),q}),this._event}fire(T){var F,C;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Ie.S);for(let P of this._listeners)this._deliveryQueue.push([P,T]);for((F=this._perfMon)===null||F===void 0||F.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[P,w]=this._deliveryQueue.shift();try{typeof P=="function"?P.call(void 0,w):P[0].call(P[1],w)}catch(I){(0,V.dL)(I)}}(C=this._perfMon)===null||C===void 0||C.stop()}}dispose(){var T,F,C,P,w;this._disposed||(this._disposed=!0,(T=this._listeners)===null||T===void 0||T.clear(),(F=this._deliveryQueue)===null||F===void 0||F.clear(),(P=(C=this._options)===null||C===void 0?void 0:C.onLastListenerRemove)===null||P===void 0||P.call(C),(w=this._leakageMon)===null||w===void 0||w.dispose())}}class z extends l{constructor(T){super(T),this._isPaused=0,this._eventQueue=new Ie.S,this._mergeFn=T==null?void 0:T.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const T=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(T))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(T){this._listeners&&(this._isPaused!==0?this._eventQueue.push(T):super.fire(T))}}class x extends z{constructor(T){var F;super(T),this._delay=(F=T.delay)!==null&&F!==void 0?F:100}fire(T){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(T)}}class m{constructor(){this.buffers=[]}wrapEvent(T){return(F,C,P)=>T(w=>{const I=this.buffers[this.buffers.length-1];I?I.push(()=>F.call(C,w)):F.call(C,w)},void 0,P)}bufferEvents(T){const F=[];this.buffers.push(F);const C=T();return this.buffers.pop(),F.forEach(P=>P()),C}}class _{constructor(){this.listening=!1,this.inputEvent=M.None,this.inputEventListener=de.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(T){this.inputEvent=T,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=T(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Ut,at,W){"use strict";W.d(at,{I:function(){return V}});function V(de){const Ie=this;let te=!1,M;return function(){return te||(te=!0,M=de.apply(Ie,arguments)),M}}},88226:function(Ut,at,W){"use strict";W.d(at,{$:function(){return V}});var V;(function(de){function Ie(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}de.is=Ie;const te=Object.freeze([]);function M(){return te}de.empty=M;function*p(I){yield I}de.single=p;function ce(I){return I||te}de.from=ce;function J(I){return!I||I[Symbol.iterator]().next().done===!0}de.isEmpty=J;function l(I){return I[Symbol.iterator]().next().value}de.first=l;function z(I,N){for(const q of I)if(N(q))return!0;return!1}de.some=z;function x(I,N){for(const q of I)if(N(q))return q}de.find=x;function*m(I,N){for(const q of I)N(q)&&(yield q)}de.filter=m;function*_(I,N){let q=0;for(const re of I)yield N(re,q++)}de.map=_;function*b(...I){for(const N of I)for(const q of N)yield q}de.concat=b;function*T(I){for(const N of I)for(const q of N)yield q}de.concatNested=T;function F(I,N,q){let re=q;for(const le of I)re=N(re,le);return re}de.reduce=F;function*C(I,N,q=I.length){for(N<0&&(N+=I.length),q<0?q+=I.length:q>I.length&&(q=I.length);N<q;N++)yield I[N]}de.slice=C;function P(I,N=Number.POSITIVE_INFINITY){const q=[];if(N===0)return[q,I];const re=I[Symbol.iterator]();for(let le=0;le<N;le++){const H=re.next();if(H.done)return[q,de.empty()];q.push(H.value)}return[q,{[Symbol.iterator](){return re}}]}de.consume=P;function w(I,N,q=(re,le)=>re===le){const re=I[Symbol.iterator](),le=N[Symbol.iterator]();for(;;){const H=re.next(),ye=le.next();if(H.done!==ye.done)return!1;if(H.done)return!0;if(!q(H.value,ye.value))return!1}}de.equals=w})(V||(V={}))},69323:function(Ut,at,W){"use strict";W.d(at,{B9:function(){return _},F8:function(){return b},JT:function(){return C},Jz:function(){return w},OF:function(){return T},SL:function(){return F},Wf:function(){return m},XK:function(){return P},dk:function(){return z}});var V=W(17845),de=W(88226);const Ie=!1;let te=null;function M(I){te=I}if(Ie){const I="__is_disposable_tracked__";M(new class{trackDisposable(N){const q=new Error("Potentially leaked disposable").stack;setTimeout(()=>{N[I]||console.log(q)},3e3)}setParent(N,q){if(N&&N!==C.None)try{N[I]=!0}catch(re){}}markAsDisposed(N){if(N&&N!==C.None)try{N[I]=!0}catch(q){}}markAsSingleton(N){}})}function p(I){return te==null||te.trackDisposable(I),I}function ce(I){te==null||te.markAsDisposed(I)}function J(I,N){te==null||te.setParent(I,N)}function l(I,N){if(te)for(const q of I)te.setParent(q,N)}function z(I){return te==null||te.markAsSingleton(I),I}class x extends Error{constructor(N){super(`Encountered errors while disposing of store. Errors: [${N.join(", ")}]`),this.errors=N}}function m(I){return typeof I.dispose=="function"&&I.dispose.length===0}function _(I){if(de.$.is(I)){let N=[];for(const q of I)if(q)try{q.dispose()}catch(re){N.push(re)}if(N.length===1)throw N[0];if(N.length>1)throw new x(N);return Array.isArray(I)?[]:I}else if(I)return I.dispose(),I}function b(...I){const N=T(()=>_(I));return l(I,N),N}function T(I){const N=p({dispose:(0,V.I)(()=>{ce(N),I()})});return N}class F{constructor(){this._toDispose=new Set,this._isDisposed=!1,p(this)}dispose(){this._isDisposed||(ce(this),this._isDisposed=!0,this.clear())}clear(){try{_(this._toDispose.values())}finally{this._toDispose.clear()}}add(N){if(!N)return N;if(N===this)throw new Error("Cannot register a disposable on itself!");return J(N,this),this._isDisposed?F.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(N),N}}F.DISABLE_DISPOSED_WARNING=!1;class C{constructor(){this._store=new F,p(this),J(this._store,this)}dispose(){ce(this),this._store.dispose()}_register(N){if(N===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(N)}}C.None=Object.freeze({dispose(){}});class P{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(N){var q;this._isDisposed||N===this._value||((q=this._value)===null||q===void 0||q.dispose(),N&&J(N,this),this._value=N)}clear(){this.value=void 0}dispose(){var N;this._isDisposed=!0,ce(this),(N=this._value)===null||N===void 0||N.dispose(),this._value=void 0}clearAndLeak(){const N=this._value;return this._value=void 0,N&&J(N,null),N}}class w{constructor(N){this.object=N}dispose(){}}},34502:function(Ut,at,W){"use strict";W.d(at,{S:function(){return de}});class V{constructor(te){this.element=te,this.next=V.Undefined,this.prev=V.Undefined}}V.Undefined=new V(void 0);class de{constructor(){this._first=V.Undefined,this._last=V.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===V.Undefined}clear(){let te=this._first;for(;te!==V.Undefined;){const M=te.next;te.prev=V.Undefined,te.next=V.Undefined,te=M}this._first=V.Undefined,this._last=V.Undefined,this._size=0}unshift(te){return this._insert(te,!1)}push(te){return this._insert(te,!0)}_insert(te,M){const p=new V(te);if(this._first===V.Undefined)this._first=p,this._last=p;else if(M){const J=this._last;this._last=p,p.prev=J,J.next=p}else{const J=this._first;this._first=p,p.next=J,J.prev=p}this._size+=1;let ce=!1;return()=>{ce||(ce=!0,this._remove(p))}}shift(){if(this._first!==V.Undefined){const te=this._first.element;return this._remove(this._first),te}}pop(){if(this._last!==V.Undefined){const te=this._last.element;return this._remove(this._last),te}}_remove(te){if(te.prev!==V.Undefined&&te.next!==V.Undefined){const M=te.prev;M.next=te.next,te.next.prev=M}else te.prev===V.Undefined&&te.next===V.Undefined?(this._first=V.Undefined,this._last=V.Undefined):te.next===V.Undefined?(this._last=this._last.prev,this._last.next=V.Undefined):te.prev===V.Undefined&&(this._first=this._first.next,this._first.prev=V.Undefined);this._size-=1}*[Symbol.iterator](){let te=this._first;for(;te!==V.Undefined;)yield te.element,te=te.next}}},23345:function(Ut,at,W){"use strict";W.d(at,{$L:function(){return re},ED:function(){return w},IJ:function(){return N},OS:function(){return be},WE:function(){return H},dz:function(){return I},gn:function(){return le},li:function(){return T},r:function(){return $},tY:function(){return q},xS:function(){return ye}});var V=W(97671),de;const Ie="en";let te=!1,M=!1,p=!1,ce=!1,J=!1,l=!1,z=!1,x,m=null,_=null,b;const T=typeof self=="object"?self:typeof W.g=="object"?W.g:{};let F;typeof T.vscode!="undefined"&&typeof T.vscode.process!="undefined"?F=T.vscode.process:typeof V!="undefined"&&(F=V);const C=typeof((de=F==null?void 0:F.versions)===null||de===void 0?void 0:de.electron)=="string"&&F.type==="renderer";if(typeof navigator=="object"&&!C)b=navigator.userAgent,te=b.indexOf("Windows")>=0,M=b.indexOf("Macintosh")>=0,z=(b.indexOf("Macintosh")>=0||b.indexOf("iPad")>=0||b.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=b.indexOf("Linux")>=0,l=!0,x=navigator.language,m=x;else if(typeof F=="object"){te=F.platform==="win32",M=F.platform==="darwin",p=F.platform==="linux",ce=p&&!!F.env.SNAP&&!!F.env.SNAP_REVISION,x=Ie,m=Ie;const D=F.env.VSCODE_NLS_CONFIG;if(D)try{const O=JSON.parse(D),B=O.availableLanguages["*"];x=O.locale,m=B||Ie,_=O._translationsConfigFile}catch(O){}J=!0}else console.error("Unable to resolve platform.");let P=0;M?P=1:te?P=3:p&&(P=2);const w=te,I=M,N=p,q=J,re=l,le=z,H=b,ye=function(){if(T.setImmediate)return T.setImmediate.bind(T);if(typeof T.postMessage=="function"&&!T.importScripts){let B=[];T.addEventListener("message",G=>{if(G.data&&G.data.vscodeSetImmediateId)for(let g=0,v=B.length;g<v;g++){const L=B[g];if(L.id===G.data.vscodeSetImmediateId){B.splice(g,1),L.callback();return}}});let Q=0;return G=>{const g=++Q;B.push({id:g,callback:G}),T.postMessage({vscodeSetImmediateId:g},"*")}}if(typeof(F==null?void 0:F.nextTick)=="function")return F.nextTick.bind(F);const O=Promise.resolve();return B=>O.then(B)}(),be=M||z?2:te?1:3;let Ee=!0,We=!1;function $(){if(!We){We=!0;const D=new Uint8Array(2);D[0]=1,D[1]=2,Ee=new Uint16Array(D.buffer)[0]===513}return Ee}},95830:function(Ut,at,W){"use strict";W.d(at,{G:function(){return Ie}});var V=W(23345);const de=V.li.performance&&typeof V.li.performance.now=="function";class Ie{constructor(M){this._highResolution=de&&M,this._startTime=this._now(),this._stopTime=-1}static create(M=!0){return new Ie(M)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?V.li.performance.now():Date.now()}}},82983:function(Ut,at,W){"use strict";W.d(at,{$i:function(){return Ae},C8:function(){return ot},GF:function(){return x},HO:function(){return Q},IO:function(){return m},K7:function(){return yt},Kw:function(){return Ft},LC:function(){return T},Mh:function(){return ye},P1:function(){return be},PJ:function(){return ci},Qe:function(){return Be},R1:function(){return z},RP:function(){return L},S6:function(){return pt},TT:function(){return w},Ut:function(){return g},V8:function(){return F},WU:function(){return Ie},YK:function(){return We},YU:function(){return te},ZG:function(){return Ee},ZH:function(){return D},ab:function(){return ht},c1:function(){return je},df:function(){return re},ec:function(){return M},fi:function(){return mi},fy:function(){return p},j3:function(){return ce},j_:function(){return N},m5:function(){return V},mK:function(){return q},mr:function(){return _},oH:function(){return ie},oL:function(){return J},ok:function(){return H},ow:function(){return C},qq:function(){return le},qu:function(){return P},rL:function(){return $},uS:function(){return zt},un:function(){return l},uq:function(){return b},vH:function(){return B},xe:function(){return Ke},zY:function(){return I}});function V(K){return!K||typeof K!="string"?!0:K.trim().length===0}const de=/{(\d+)}/g;function Ie(K,...ne){return ne.length===0?K:K.replace(de,function(Se,Te){const Ne=parseInt(Te,10);return isNaN(Ne)||Ne<0||Ne>=ne.length?Se:ne[Ne]})}function te(K){return K.replace(/[<>&]/g,function(ne){switch(ne){case"<":return"<";case">":return">";case"&":return"&";default:return ne}})}function M(K){return K.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(K,ne=" "){const Se=ce(K,ne);return J(Se,ne)}function ce(K,ne){if(!K||!ne)return K;const Se=ne.length;if(Se===0||K.length===0)return K;let Te=0;for(;K.indexOf(ne,Te)===Te;)Te=Te+Se;return K.substring(Te)}function J(K,ne){if(!K||!ne)return K;const Se=ne.length,Te=K.length;if(Se===0||Te===0)return K;let Ne=Te,He=-1;for(;He=K.lastIndexOf(ne,Ne-1),!(He===-1||He+Se!==Ne);){if(He===0)return"";Ne=He}return K.substring(0,Ne)}function l(K){return K.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function z(K){return K.replace(/\*/g,"")}function x(K,ne,Se={}){if(!K)throw new Error("Cannot create regex from empty string");ne||(K=M(K)),Se.wholeWord&&(/\B/.test(K.charAt(0))||(K="\\b"+K),/\B/.test(K.charAt(K.length-1))||(K=K+"\\b"));let Te="";return Se.global&&(Te+="g"),Se.matchCase||(Te+="i"),Se.multiline&&(Te+="m"),Se.unicode&&(Te+="u"),new RegExp(K,Te)}function m(K){return K.source==="^"||K.source==="^$"||K.source==="$"||K.source==="^\\s*$"?!1:!!(K.exec("")&&K.lastIndex===0)}function _(K){return(K.global?"g":"")+(K.ignoreCase?"i":"")+(K.multiline?"m":"")+(K.unicode?"u":"")}function b(K){return K.split(/\r\n|\r|\n/)}function T(K){for(let ne=0,Se=K.length;ne<Se;ne++){const Te=K.charCodeAt(ne);if(Te!==32&&Te!==9)return ne}return-1}function F(K,ne=0,Se=K.length){for(let Te=ne;Te<Se;Te++){const Ne=K.charCodeAt(Te);if(Ne!==32&&Ne!==9)return K.substring(ne,Te)}return K.substring(ne,Se)}function C(K,ne=K.length-1){for(let Se=ne;Se>=0;Se--){const Te=K.charCodeAt(Se);if(Te!==32&&Te!==9)return Se}return-1}function P(K,ne){return K<ne?-1:K>ne?1:0}function w(K,ne,Se=0,Te=K.length,Ne=0,He=ne.length){for(;Se<Te&&Ne<He;Se++,Ne++){let lt=K.charCodeAt(Se),qe=ne.charCodeAt(Ne);if(lt<qe)return-1;if(lt>qe)return 1}const bt=Te-Se,Xe=He-Ne;return bt<Xe?-1:bt>Xe?1:0}function I(K,ne){return N(K,ne,0,K.length,0,ne.length)}function N(K,ne,Se=0,Te=K.length,Ne=0,He=ne.length){for(;Se<Te&&Ne<He;Se++,Ne++){let lt=K.charCodeAt(Se),qe=ne.charCodeAt(Ne);if(lt===qe)continue;if(lt>=128||qe>=128)return w(K.toLowerCase(),ne.toLowerCase(),Se,Te,Ne,He);q(lt)&&(lt-=32),q(qe)&&(qe-=32);const _t=lt-qe;if(_t!==0)return _t}const bt=Te-Se,Xe=He-Ne;return bt<Xe?-1:bt>Xe?1:0}function q(K){return K>=97&&K<=122}function re(K){return K>=65&&K<=90}function le(K,ne){return K.length===ne.length&&N(K,ne)===0}function H(K,ne){const Se=ne.length;return ne.length>K.length?!1:N(K,ne,0,Se)===0}function ye(K,ne){let Se,Te=Math.min(K.length,ne.length);for(Se=0;Se<Te;Se++)if(K.charCodeAt(Se)!==ne.charCodeAt(Se))return Se;return Te}function be(K,ne){let Se,Te=Math.min(K.length,ne.length);const Ne=K.length-1,He=ne.length-1;for(Se=0;Se<Te;Se++)if(K.charCodeAt(Ne-Se)!==ne.charCodeAt(He-Se))return Se;return Te}function Ee(K){return 55296<=K&&K<=56319}function We(K){return 56320<=K&&K<=57343}function $(K,ne){return(K-55296<<10)+(ne-56320)+65536}function D(K,ne,Se){const Te=K.charCodeAt(Se);if(Ee(Te)&&Se+1<ne){const Ne=K.charCodeAt(Se+1);if(We(Ne))return $(Te,Ne)}return Te}function O(K,ne){const Se=K.charCodeAt(ne-1);if(We(Se)&&ne>1){const Te=K.charCodeAt(ne-2);if(Ee(Te))return $(Te,Se)}return Se}function B(K,ne){const Se=we.getInstance(),Te=ne,Ne=K.length,He=D(K,Ne,ne);ne+=He>=65536?2:1;let bt=Se.getGraphemeBreakType(He);for(;ne<Ne;){const Xe=D(K,Ne,ne),lt=Se.getGraphemeBreakType(Xe);if(mi(bt,lt))break;ne+=Xe>=65536?2:1,bt=lt}return ne-Te}function Q(K,ne){const Se=we.getInstance(),Te=ne,Ne=O(K,ne);ne-=Ne>=65536?2:1;let He=Se.getGraphemeBreakType(Ne);for(;ne>0;){const bt=O(K,ne),Xe=Se.getGraphemeBreakType(bt);if(mi(Xe,He))break;ne-=bt>=65536?2:1,He=Xe}return Te-ne}const G=/(?:[\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(K){return G.test(K)}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 L(K){return v.test(K)}const X=/^[\t\n\r\x20-\x7E]*$/;function Ae(K){return X.test(K)}const Be=/[\u2028\u2029]/;function ht(K){return Be.test(K)}function Ke(K){for(let ne=0,Se=K.length;ne<Se;ne++)if(yt(K.charCodeAt(ne)))return!0;return!1}function yt(K){return K=+K,K>=11904&&K<=55215||K>=63744&&K<=64255||K>=65281&&K<=65374}function ot(K){return K>=127462&&K<=127487||K===8986||K===8987||K===9200||K===9203||K>=9728&&K<=10175||K===11088||K===11093||K>=127744&&K<=128591||K>=128640&&K<=128764||K>=128992&&K<=129003||K>=129280&&K<=129535||K>=129648&&K<=129750}const je="\uFEFF";function zt(K){return!!(K&&K.length>0&&K.charCodeAt(0)===65279)}function Ft(K,ne=!1){return K?(ne&&(K=K.replace(/\\./g,"")),K.toLowerCase()!==K):!1}function ci(K){return K=K%(2*26),K<26?String.fromCharCode(97+K):String.fromCharCode(65+K-26)}function pt(K){return we.getInstance().getGraphemeBreakType(K)}function mi(K,ne){return K===0?ne!==5&&ne!==7:K===2&&ne===3?!1:K===4||K===2||K===3||ne===4||ne===2||ne===3?!0:!(K===8&&(ne===8||ne===9||ne===11||ne===12)||(K===11||K===9)&&(ne===9||ne===10)||(K===12||K===10)&&ne===10||ne===5||ne===13||ne===7||K===1||K===13&&ne===14||K===6&&ne===6)}class we{constructor(){this._data=me()}static getInstance(){return we._INSTANCE||(we._INSTANCE=new we),we._INSTANCE}getGraphemeBreakType(ne){if(ne<32)return ne===10?3:ne===13?2:4;if(ne<127)return 0;const Se=this._data,Te=Se.length/3;let Ne=1;for(;Ne<=Te;)if(ne<Se[3*Ne])Ne=2*Ne;else if(ne>Se[3*Ne+1])Ne=2*Ne+1;else return Se[3*Ne+2];return 0}}we._INSTANCE=null;function me(){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 ie(K,ne){if(K===0)return 0;const Se=ke(K,ne);if(Se!==void 0)return Se;const Te=O(ne,K);return K-=ze(Te),K}function ke(K,ne){let Se=O(ne,K);for(K-=ze(Se);Qe(Se)||Se===65039||Se===8419;){if(K===0)return;Se=O(ne,K),K-=ze(Se)}if(ot(Se)){if(K>=0){const Te=O(ne,K);Te===8205&&(K-=ze(Te))}return K}}function ze(K){return K>=65536?2:1}function Qe(K){return 127995<=K&&K<=127999}},72999:function(Ut,at,W){"use strict";W.d(at,{$E:function(){return T},$K:function(){return ce},D8:function(){return m},HD:function(){return de},IU:function(){return F},Jp:function(){return J},Kn:function(){return Ie},cW:function(){return z},f6:function(){return C},hj:function(){return te},jn:function(){return M},kJ:function(){return V},mf:function(){return x},o8:function(){return p},p_:function(){return l},vE:function(){return P}});function V(w){return Array.isArray(w)}function de(w){return typeof w=="string"}function Ie(w){return typeof w=="object"&&w!==null&&!Array.isArray(w)&&!(w instanceof RegExp)&&!(w instanceof Date)}function te(w){return typeof w=="number"&&!isNaN(w)}function M(w){return w===!0||w===!1}function p(w){return typeof w=="undefined"}function ce(w){return!J(w)}function J(w){return p(w)||w===null}function l(w,I){if(!w)throw new Error(I?`Unexpected type, expected '${I}'`:"Unexpected type")}function z(w){if(J(w))throw new Error("Assertion Failed: argument is undefined or null");return w}function x(w){return typeof w=="function"}function m(w,I){const N=Math.min(w.length,I.length);for(let q=0;q<N;q++)_(w[q],I[q])}function _(w,I){if(de(I)){if(typeof w!==I)throw new Error(`argument does not match constraint: typeof ${I}`)}else if(x(I)){try{if(w instanceof I)return}catch(N){}if(!J(w)&&w.constructor===I||I.length===1&&I.call(void 0,w)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function b(w){let I=[],N=Object.getPrototypeOf(w);for(;Object.prototype!==N;)I=I.concat(Object.getOwnPropertyNames(N)),N=Object.getPrototypeOf(N);return I}function T(w){const I=[];for(const N of b(w))typeof w[N]=="function"&&I.push(N);return I}function F(w,I){const N=re=>function(){const le=Array.prototype.slice.call(arguments,0);return I(re,le)};let q={};for(const re of w)q[re]=N(re);return q}function C(w){return w===null?void 0:w}function P(w,I="Unreachable"){throw new Error(I)}},13268:function(Ut,at,W){"use strict";W.d(at,{N:function(){return de}});function V(Ie,te){let M;return te.length===0?M=Ie:M=Ie.replace(/\{(\d+)\}/g,function(p,ce){const J=ce[0];return typeof te[J]!="undefined"?te[J]:p}),M}function de(Ie,te,...M){return V(te,M)}},96236:function(Ut,at,W){"use strict";W.d(at,{BH:function(){return F},NZ:function(){return C},U8:function(){return P},co:function(){return T},eH:function(){return b},vr:function(){return _}});var V=W(75918),de=W(52615),Ie=W(4348),te=W(88226),M=W(69323),p=W(34502),ce=W(35884),J=W(90689),l=W(16925),z=W(49055),x=function(w,I,N,q){var re=arguments.length,le=re<3?I:q===null?q=Object.getOwnPropertyDescriptor(I,N):q,H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")le=Reflect.decorate(w,I,N,q);else for(var ye=w.length-1;ye>=0;ye--)(H=w[ye])&&(le=(re<3?H(le):re>3?H(I,N,le):H(I,N))||le);return re>3&&le&&Object.defineProperty(I,N,le),le},m=function(w,I){return function(N,q){I(N,q,w)}};function _(w){return w.command!==void 0}class b{constructor(I){this.id=b._idPool++,this._debugName=I}}b._idPool=0,b.CommandPalette=new b("CommandPalette"),b.EditorContext=new b("EditorContext"),b.SimpleEditorContext=new b("SimpleEditorContext"),b.EditorContextCopy=new b("EditorContextCopy"),b.EditorContextPeek=new b("EditorContextPeek"),b.MenubarEditMenu=new b("MenubarEditMenu"),b.MenubarCopy=new b("MenubarCopy"),b.MenubarGoMenu=new b("MenubarGoMenu"),b.MenubarSelectionMenu=new b("MenubarSelectionMenu"),b.InlineCompletionsActions=new b("InlineCompletionsActions");const T=(0,l.yh)("menuService"),F=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Ie.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:w=>w===b.CommandPalette}}addCommand(w){return this.addCommands(te.$.single(w))}addCommands(w){for(const I of w)this._commands.set(I.id,I);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,M.OF)(()=>{let I=!1;for(const N of w)I=this._commands.delete(N.id)||I;I&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(w){return this._commands.get(w)}getCommands(){const w=new Map;return this._commands.forEach((I,N)=>w.set(N,I)),w}appendMenuItem(w,I){return this.appendMenuItems(te.$.single({id:w,item:I}))}appendMenuItems(w){const I=new Set,N=new p.S;for(const{id:q,item:re}of w){let le=this._menuItems.get(q);le||(le=new p.S,this._menuItems.set(q,le)),N.push(le.push(re)),I.add(q)}return this._onDidChangeMenu.fire(I),(0,M.OF)(()=>{if(N.size>0){for(let q of N)q();this._onDidChangeMenu.fire(I),N.clear()}})}getMenuItems(w){let I;return this._menuItems.has(w)?I=[...this._menuItems.get(w)]:I=[],w===b.CommandPalette&&this._appendImplicitItems(I),I}_appendImplicitItems(w){const I=new Set;for(const N of w)_(N)&&(I.add(N.command.id),N.alt&&I.add(N.alt.id));this._commands.forEach((N,q)=>{I.has(q)||w.push({command:N})})}};class C extends V.wY{constructor(I,N,q,re){super(`submenuitem.${I.submenu.id}`,typeof I.title=="string"?I.title:I.title.value,[],"submenu"),this.item=I,this._menuService=N,this._contextKeyService=q,this._options=re}get actions(){const I=[],N=this._menuService.createMenu(this.item.submenu,this._contextKeyService),q=N.getActions(this._options);N.dispose();for(const[,re]of q)re.length>0&&(I.push(...re),I.push(new V.Z0));return I.length&&I.pop(),I}}let P=class Tl{constructor(I,N,q,re,le){var H,ye;if(this._commandService=le,this.id=I.id,this.label=q!=null&&q.renderShortTitle&&I.shortTitle?typeof I.shortTitle=="string"?I.shortTitle:I.shortTitle.value:typeof I.title=="string"?I.title:I.title.value,this.tooltip=(ye=typeof I.tooltip=="string"?I.tooltip:(H=I.tooltip)===null||H===void 0?void 0:H.value)!==null&&ye!==void 0?ye:"",this.enabled=!I.precondition||re.contextMatchesRules(I.precondition),this.checked=void 0,I.toggled){const be=I.toggled.condition?I.toggled:{condition:I.toggled};this.checked=re.contextMatchesRules(be.condition),this.checked&&be.tooltip&&(this.tooltip=typeof be.tooltip=="string"?be.tooltip:be.tooltip.value),be.title&&(this.label=typeof be.title=="string"?be.title:be.title.value)}this.item=I,this.alt=N?new Tl(N,void 0,q,re,le):void 0,this._options=q,z.kS.isThemeIcon(I.icon)&&(this.class=de.dT.asClassName(I.icon))}dispose(){}run(...I){var N,q;let re=[];return!((N=this._options)===null||N===void 0)&&N.arg&&(re=[...re,this._options.arg]),!((q=this._options)===null||q===void 0)&&q.shouldForwardArgs&&(re=[...re,...I]),this._commandService.executeCommand(this.id,...re)}};P=x([m(3,J.i6),m(4,ce.H)],P)},35884:function(Ut,at,W){"use strict";W.d(at,{H:function(){return ce},P:function(){return J}});var V=W(4348),de=W(88226),Ie=W(69323),te=W(34502),M=W(72999),p=W(16925);const ce=(0,p.yh)("commandService"),J=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new V.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(l,z){if(!l)throw new Error("invalid command");if(typeof l=="string"){if(!z)throw new Error("invalid command");return this.registerCommand({id:l,handler:z})}if(l.description){const T=[];for(let C of l.description.args)T.push(C.constraint);const F=l.handler;l.handler=function(C,...P){return(0,M.D8)(P,T),F(C,...P)}}const{id:x}=l;let m=this._commands.get(x);m||(m=new te.S,this._commands.set(x,m));let _=m.unshift(l),b=(0,Ie.OF)(()=>{_();const T=this._commands.get(x);T!=null&&T.isEmpty()&&this._commands.delete(x)});return this._onDidRegisterCommand.fire(x),b}registerCommandAlias(l,z){return J.registerCommand(l,(x,...m)=>x.get(ce).executeCommand(z,...m))}getCommand(l){const z=this._commands.get(l);if(!(!z||z.isEmpty()))return de.$.first(z)}getCommands(){const l=new Map;for(const z of this._commands.keys()){const x=this.getCommand(z);x&&l.set(z,x)}return l}};J.registerCommand("noop",()=>{})},90689:function(Ut,at,W){"use strict";W.d(at,{Ao:function(){return ce},Eq:function(){return $},Fb:function(){return J},K8:function(){return B},i6:function(){return We},uy:function(){return Ee}});var V=W(23345),de=W(82983),Ie=W(16925);let te=V.WE||"";const M=new Map;M.set("false",!1),M.set("true",!0),M.set("isMac",V.dz),M.set("isLinux",V.IJ),M.set("isWindows",V.ED),M.set("isWeb",V.$L),M.set("isMacNative",V.dz&&!V.$L),M.set("isEdge",te.indexOf("Edg/")>=0),M.set("isFirefox",te.indexOf("Firefox")>=0),M.set("isChrome",te.indexOf("Chrome")>=0),M.set("isSafari",te.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class ce{static has(g){return m.create(g)}static equals(g,v){return _.create(g,v)}static regex(g,v){return re.create(g,v)}static not(g){return C.create(g)}static and(...g){return ye.create(g,null)}static or(...g){return be.create(g,null,!0)}static deserialize(g,v=!1){if(g)return this._deserializeOrExpression(g,v)}static _deserializeOrExpression(g,v){let L=g.split("||");return be.create(L.map(X=>this._deserializeAndExpression(X,v)),null,!0)}static _deserializeAndExpression(g,v){let L=g.split("&&");return ye.create(L.map(X=>this._deserializeOne(X,v)),null)}static _deserializeOne(g,v){if(g=g.trim(),g.indexOf("!=")>=0){let L=g.split("!=");return F.create(L[0].trim(),this._deserializeValue(L[1],v))}if(g.indexOf("==")>=0){let L=g.split("==");return _.create(L[0].trim(),this._deserializeValue(L[1],v))}if(g.indexOf("=~")>=0){let L=g.split("=~");return re.create(L[0].trim(),this._deserializeRegexValue(L[1],v))}if(g.indexOf(" in ")>=0){let L=g.split(" in ");return b.create(L[0].trim(),L[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(g)){const L=g.split(">=");return I.create(L[0].trim(),L[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(g)){const L=g.split(">");return w.create(L[0].trim(),L[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(g)){const L=g.split("<=");return q.create(L[0].trim(),L[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(g)){const L=g.split("<");return N.create(L[0].trim(),L[1].trim())}return/^\!\s*/.test(g)?C.create(g.substr(1).trim()):m.create(g)}static _deserializeValue(g,v){if(g=g.trim(),g==="true")return!0;if(g==="false")return!1;let L=/^'([^']*)'$/.exec(g);return L?L[1].trim():g}static _deserializeRegexValue(g,v){if((0,de.m5)(g)){if(v)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let L=g.indexOf("/"),X=g.lastIndexOf("/");if(L===X||L<0){if(v)throw new Error(`bad regexp-value '${g}', missing /-enclosure`);return console.warn(`bad regexp-value '${g}', missing /-enclosure`),null}let Ae=g.slice(L+1,X),Be=g[X+1]==="i"?"i":"";try{return new RegExp(Ae,Be)}catch(ht){if(v)throw new Error(`bad regexp-value '${g}', parse error: ${ht}`);return console.warn(`bad regexp-value '${g}', parse error: ${ht}`),null}}}function J(G,g){const v=G?G.substituteConstants():void 0,L=g?g.substituteConstants():void 0;return!v&&!L?!0:!v||!L?!1:v.equals(L)}function l(G,g){return G.cmp(g)}class z{constructor(){this.type=0}cmp(g){return this.type-g.type}equals(g){return g.type===this.type}substituteConstants(){return this}evaluate(g){return!1}serialize(){return"false"}keys(){return[]}negate(){return x.INSTANCE}}z.INSTANCE=new z;class x{constructor(){this.type=1}cmp(g){return this.type-g.type}equals(g){return g.type===this.type}substituteConstants(){return this}evaluate(g){return!0}serialize(){return"true"}keys(){return[]}negate(){return z.INSTANCE}}x.INSTANCE=new x;class m{constructor(g,v){this.key=g,this.negated=v,this.type=2}static create(g,v=null){const L=M.get(g);return typeof L=="boolean"?L?x.INSTANCE:z.INSTANCE:new m(g,v)}cmp(g){return g.type!==this.type?this.type-g.type:D(this.key,g.key)}equals(g){return g.type===this.type?this.key===g.key:!1}substituteConstants(){const g=M.get(this.key);return typeof g=="boolean"?g?x.INSTANCE:z.INSTANCE:this}evaluate(g){return!!g.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=C.create(this.key,this)),this.negated}}class _{constructor(g,v,L){this.key=g,this.value=v,this.negated=L,this.type=4}static create(g,v,L=null){if(typeof v=="boolean")return v?m.create(g,L):C.create(g,L);const X=M.get(g);return typeof X=="boolean"?v===(X?"true":"false")?x.INSTANCE:z.INSTANCE:new _(g,v,L)}cmp(g){return g.type!==this.type?this.type-g.type:O(this.key,this.value,g.key,g.value)}equals(g){return g.type===this.type?this.key===g.key&&this.value===g.value:!1}substituteConstants(){const g=M.get(this.key);if(typeof g=="boolean"){const v=g?"true":"false";return this.value===v?x.INSTANCE:z.INSTANCE}return this}evaluate(g){return g.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=F.create(this.key,this.value,this)),this.negated}}class b{constructor(g,v){this.key=g,this.valueKey=v,this.type=10,this.negated=null}static create(g,v){return new b(g,v)}cmp(g){return g.type!==this.type?this.type-g.type:O(this.key,this.valueKey,g.key,g.valueKey)}equals(g){return g.type===this.type?this.key===g.key&&this.valueKey===g.valueKey:!1}substituteConstants(){return this}evaluate(g){const v=g.getValue(this.valueKey),L=g.getValue(this.key);return Array.isArray(v)?v.indexOf(L)>=0:typeof L=="string"&&typeof v=="object"&&v!==null?p.call(v,L):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=T.create(this)),this.negated}}class T{constructor(g){this._actual=g,this.type=11}static create(g){return new T(g)}cmp(g){return g.type!==this.type?this.type-g.type:this._actual.cmp(g._actual)}equals(g){return g.type===this.type?this._actual.equals(g._actual):!1}substituteConstants(){return this}evaluate(g){return!this._actual.evaluate(g)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class F{constructor(g,v,L){this.key=g,this.value=v,this.negated=L,this.type=5}static create(g,v,L=null){if(typeof v=="boolean")return v?C.create(g,L):m.create(g,L);const X=M.get(g);return typeof X=="boolean"?v===(X?"true":"false")?z.INSTANCE:x.INSTANCE:new F(g,v,L)}cmp(g){return g.type!==this.type?this.type-g.type:O(this.key,this.value,g.key,g.value)}equals(g){return g.type===this.type?this.key===g.key&&this.value===g.value:!1}substituteConstants(){const g=M.get(this.key);if(typeof g=="boolean"){const v=g?"true":"false";return this.value===v?z.INSTANCE:x.INSTANCE}return this}evaluate(g){return g.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=_.create(this.key,this.value,this)),this.negated}}class C{constructor(g,v){this.key=g,this.negated=v,this.type=3}static create(g,v=null){const L=M.get(g);return typeof L=="boolean"?L?z.INSTANCE:x.INSTANCE:new C(g,v)}cmp(g){return g.type!==this.type?this.type-g.type:D(this.key,g.key)}equals(g){return g.type===this.type?this.key===g.key:!1}substituteConstants(){const g=M.get(this.key);return typeof g=="boolean"?g?z.INSTANCE:x.INSTANCE:this}evaluate(g){return!g.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=m.create(this.key,this)),this.negated}}function P(G,g){if(typeof G=="string"){const v=parseFloat(G);isNaN(v)||(G=v)}return typeof G=="string"||typeof G=="number"?g(G):z.INSTANCE}class w{constructor(g,v,L){this.key=g,this.value=v,this.negated=L,this.type=12}static create(g,v,L=null){return P(v,X=>new w(g,X,L))}cmp(g){return g.type!==this.type?this.type-g.type:O(this.key,this.value,g.key,g.value)}equals(g){return g.type===this.type?this.key===g.key&&this.value===g.value:!1}substituteConstants(){return this}evaluate(g){return typeof this.value=="string"?!1:parseFloat(g.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=q.create(this.key,this.value,this)),this.negated}}class I{constructor(g,v,L){this.key=g,this.value=v,this.negated=L,this.type=13}static create(g,v,L=null){return P(v,X=>new I(g,X,L))}cmp(g){return g.type!==this.type?this.type-g.type:O(this.key,this.value,g.key,g.value)}equals(g){return g.type===this.type?this.key===g.key&&this.value===g.value:!1}substituteConstants(){return this}evaluate(g){return typeof this.value=="string"?!1:parseFloat(g.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=N.create(this.key,this.value,this)),this.negated}}class N{constructor(g,v,L){this.key=g,this.value=v,this.negated=L,this.type=14}static create(g,v,L=null){return P(v,X=>new N(g,X,L))}cmp(g){return g.type!==this.type?this.type-g.type:O(this.key,this.value,g.key,g.value)}equals(g){return g.type===this.type?this.key===g.key&&this.value===g.value:!1}substituteConstants(){return this}evaluate(g){return typeof this.value=="string"?!1:parseFloat(g.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 q{constructor(g,v,L){this.key=g,this.value=v,this.negated=L,this.type=15}static create(g,v,L=null){return P(v,X=>new q(g,X,L))}cmp(g){return g.type!==this.type?this.type-g.type:O(this.key,this.value,g.key,g.value)}equals(g){return g.type===this.type?this.key===g.key&&this.value===g.value:!1}substituteConstants(){return this}evaluate(g){return typeof this.value=="string"?!1:parseFloat(g.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=w.create(this.key,this.value,this)),this.negated}}class re{constructor(g,v){this.key=g,this.regexp=v,this.type=7,this.negated=null}static create(g,v){return new re(g,v)}cmp(g){if(g.type!==this.type)return this.type-g.type;if(this.key<g.key)return-1;if(this.key>g.key)return 1;const v=this.regexp?this.regexp.source:"",L=g.regexp?g.regexp.source:"";return v<L?-1:v>L?1:0}equals(g){if(g.type===this.type){const v=this.regexp?this.regexp.source:"",L=g.regexp?g.regexp.source:"";return this.key===g.key&&v===L}return!1}substituteConstants(){return this}evaluate(g){let v=g.getValue(this.key);return this.regexp?this.regexp.test(v):!1}serialize(){const g=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${g}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=le.create(this)),this.negated}}class le{constructor(g){this._actual=g,this.type=8}static create(g){return new le(g)}cmp(g){return g.type!==this.type?this.type-g.type:this._actual.cmp(g._actual)}equals(g){return g.type===this.type?this._actual.equals(g._actual):!1}substituteConstants(){return this}evaluate(g){return!this._actual.evaluate(g)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function H(G){let g=null;for(let v=0,L=G.length;v<L;v++){const X=G[v].substituteConstants();if(G[v]!==X&&g===null){g=[];for(let Ae=0;Ae<v;Ae++)g[Ae]=G[Ae]}g!==null&&(g[v]=X)}return g===null?G:g}class ye{constructor(g,v){this.expr=g,this.negated=v,this.type=6}static create(g,v){return ye._normalizeArr(g,v)}cmp(g){if(g.type!==this.type)return this.type-g.type;if(this.expr.length<g.expr.length)return-1;if(this.expr.length>g.expr.length)return 1;for(let v=0,L=this.expr.length;v<L;v++){const X=l(this.expr[v],g.expr[v]);if(X!==0)return X}return 0}equals(g){if(g.type===this.type){if(this.expr.length!==g.expr.length)return!1;for(let v=0,L=this.expr.length;v<L;v++)if(!this.expr[v].equals(g.expr[v]))return!1;return!0}return!1}substituteConstants(){const g=H(this.expr);return g===this.expr?this:ye.create(g,this.negated)}evaluate(g){for(let v=0,L=this.expr.length;v<L;v++)if(!this.expr[v].evaluate(g))return!1;return!0}static _normalizeArr(g,v){const L=[];let X=!1;for(const Ae of g)if(Ae){if(Ae.type===1){X=!0;continue}if(Ae.type===0)return z.INSTANCE;if(Ae.type===6){L.push(...Ae.expr);continue}L.push(Ae)}if(L.length===0&&X)return x.INSTANCE;if(L.length!==0){if(L.length===1)return L[0];L.sort(l);for(let Ae=1;Ae<L.length;Ae++)L[Ae-1].equals(L[Ae])&&(L.splice(Ae,1),Ae--);if(L.length===1)return L[0];for(;L.length>1;){const Ae=L[L.length-1];if(Ae.type!==9)break;L.pop();const Be=L.pop(),ht=L.length===0,Ke=be.create(Ae.expr.map(yt=>ye.create([yt,Be],null)),null,ht);Ke&&(L.push(Ke),L.sort(l))}return L.length===1?L[0]:new ye(L,v)}}serialize(){return this.expr.map(g=>g.serialize()).join(" && ")}keys(){const g=[];for(let v of this.expr)g.push(...v.keys());return g}negate(){if(!this.negated){const g=[];for(let v of this.expr)g.push(v.negate());this.negated=be.create(g,this,!0)}return this.negated}}class be{constructor(g,v){this.expr=g,this.negated=v,this.type=9}static create(g,v,L){return be._normalizeArr(g,v,L)}cmp(g){if(g.type!==this.type)return this.type-g.type;if(this.expr.length<g.expr.length)return-1;if(this.expr.length>g.expr.length)return 1;for(let v=0,L=this.expr.length;v<L;v++){const X=l(this.expr[v],g.expr[v]);if(X!==0)return X}return 0}equals(g){if(g.type===this.type){if(this.expr.length!==g.expr.length)return!1;for(let v=0,L=this.expr.length;v<L;v++)if(!this.expr[v].equals(g.expr[v]))return!1;return!0}return!1}substituteConstants(){const g=H(this.expr);return g===this.expr?this:be.create(g,this.negated,!1)}evaluate(g){for(let v=0,L=this.expr.length;v<L;v++)if(this.expr[v].evaluate(g))return!0;return!1}static _normalizeArr(g,v,L){let X=[],Ae=!1;if(g){for(let Be=0,ht=g.length;Be<ht;Be++){const Ke=g[Be];if(Ke){if(Ke.type===0){Ae=!0;continue}if(Ke.type===1)return x.INSTANCE;if(Ke.type===9){X=X.concat(Ke.expr);continue}X.push(Ke)}}if(X.length===0&&Ae)return z.INSTANCE;X.sort(l)}if(X.length!==0){if(X.length===1)return X[0];for(let Be=1;Be<X.length;Be++)X[Be-1].equals(X[Be])&&(X.splice(Be,1),Be--);if(X.length===1)return X[0];if(L){for(let Be=0;Be<X.length;Be++)for(let ht=Be+1;ht<X.length;ht++)B(X[Be],X[ht])&&(X.splice(ht,1),ht--);if(X.length===1)return X[0]}return new be(X,v)}}serialize(){return this.expr.map(g=>g.serialize()).join(" || ")}keys(){const g=[];for(let v of this.expr)g.push(...v.keys());return g}negate(){if(!this.negated){let g=[];for(let v of this.expr)g.push(v.negate());for(;g.length>1;){const v=g.shift(),L=g.shift(),X=[];for(const Be of Q(v))for(const ht of Q(L))X.push(ye.create([Be,ht],null));const Ae=g.length===0;g.unshift(be.create(X,null,Ae))}this.negated=g[0]}return this.negated}}class Ee extends m{constructor(g,v,L){super(g,null),this._defaultValue=v,typeof L=="object"?Ee._info.push(Object.assign(Object.assign({},L),{key:g})):L!==!0&&Ee._info.push({key:g,description:L,type:v!=null?typeof v:void 0})}static all(){return Ee._info.values()}bindTo(g){return g.createKey(this.key,this._defaultValue)}getValue(g){return g.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(g){return _.create(this.key,g)}}Ee._info=[];const We=(0,Ie.yh)("contextKeyService"),$="setContext";function D(G,g){return G<g?-1:G>g?1:0}function O(G,g,v,L){return G<v?-1:G>v?1:g<L?-1:g>L?1:0}function B(G,g){if(g.type===6&&G.type!==9&&G.type!==6){for(const X of g.expr)if(G.equals(X))return!0}const v=G.negate(),L=Q(v).concat(Q(g));L.sort(l);for(let X=0;X<L.length;X++){const Be=L[X].negate();for(let ht=X+1;ht<L.length;ht++){const Ke=L[ht];if(Be.equals(Ke))return!0}}return!1}function Q(G){return G.type===9?G.expr:[G]}},16925:function(Ut,at,W){"use strict";W.d(at,{I8:function(){return V},TG:function(){return de},jt:function(){return M},yh:function(){return te}});var V;(function(p){p.serviceIds=new Map,p.DI_TARGET="$di$target",p.DI_DEPENDENCIES="$di$dependencies";function ce(J){return J[p.DI_DEPENDENCIES]||[]}p.getServiceDependencies=ce})(V||(V={}));const de=te("instantiationService");function Ie(p,ce,J,l){ce[V.DI_TARGET]===ce?ce[V.DI_DEPENDENCIES].push({id:p,index:J,optional:l}):(ce[V.DI_DEPENDENCIES]=[{id:p,index:J,optional:l}],ce[V.DI_TARGET]=ce)}function te(p){if(V.serviceIds.has(p))return V.serviceIds.get(p);const ce=function(J,l,z){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ie(ce,J,z,!1)};return ce.toString=()=>p,V.serviceIds.set(p,ce),ce}function M(p){return function(ce,J,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Ie(p,ce,l,!0)}}},44650:function(Ut,at,W){"use strict";W.d(at,{B:function(){return te}});var V=W(76068),de=W(72999);class Ie{constructor(){this.data=new Map}add(p,ce){V.ok(de.HD(p)),V.ok(de.Kn(ce)),V.ok(!this.data.has(p),"There is already an extension with this id"),this.data.set(p,ce)}as(p){return this.data.get(p)||null}}const te=new Ie},66213:function(Ut,at,W){"use strict";W.d(at,{e:function(){return V}});var V;(function(de){de.DARK="dark",de.LIGHT="light",de.HIGH_CONTRAST="hc"})(V||(V={}))},49055:function(Ut,at,W){"use strict";W.d(at,{EN:function(){return l},IP:function(){return m},Ic:function(){return T},XE:function(){return ce},bB:function(){return F},kS:function(){return z},m6:function(){return x}});var V=W(52615),de=W(4348),Ie=W(69323),te=W(16925),M=W(44650),p=W(66213);const ce=(0,te.yh)("themeService");var J;(function(C){function P(w){return w&&typeof w=="object"&&typeof w.id=="string"}C.isThemeColor=P})(J||(J={}));function l(C){return{id:C}}var z;(function(C){function P(le){return le&&typeof le=="object"&&typeof le.id=="string"&&(typeof le.color=="undefined"||J.isThemeColor(le.color))}C.isThemeIcon=P;const w=new RegExp(`^\\$\\((${V.dT.iconNameExpression}(?:${V.dT.iconModifierExpression})?)\\)$`);function I(le){const H=w.exec(le);if(!H)return;let[,ye]=H;return{id:ye}}C.fromString=I;function N(le,H){let ye=le.id;const be=ye.lastIndexOf("~");return be!==-1&&(ye=ye.substring(0,be)),H&&(ye=`${ye}~${H}`),{id:ye}}C.modify=N;function q(le,H){var ye,be;return le.id===H.id&&((ye=le.color)===null||ye===void 0?void 0:ye.id)===((be=H.color)===null||be===void 0?void 0:be.id)}C.isEqual=q;function re(le,H){return{id:le.id,color:H?l(H):void 0}}C.asThemeIcon=re,C.asClassNameArray=V.dT.asClassNameArray,C.asClassName=V.dT.asClassName,C.asCSSSelector=V.dT.asCSSSelector})(z||(z={}));function x(C){switch(C){case p.e.DARK:return"vs-dark";case p.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const m={ThemingContribution:"base.contributions.theming"};class _{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new de.Q5}onColorThemeChange(P){return this.themingParticipants.push(P),this.onThemingParticipantAddedEmitter.fire(P),(0,Ie.OF)(()=>{const w=this.themingParticipants.indexOf(P);this.themingParticipants.splice(w,1)})}getThemingParticipants(){return this.themingParticipants}}let b=new _;M.B.add(m.ThemingContribution,b);function T(C){return b.onColorThemeChange(C)}class F extends Ie.JT{constructor(P){super(),this.themeService=P,this.theme=P.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(w=>this.onThemeChange(w)))}onThemeChange(P){this.theme=P,this.updateStyles()}updateStyles(){}}},16632:function(Ut,at,W){"use strict";var V=W(54476),de=W(33885),Ie=W(20068),te=W(42978),M=W(75931),p=W(92310),ce=W.n(p),J=W(18929),l=W(59301),z=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],x=(0,l.forwardRef)(function(m,_){var b=m.prefixCls,T=b===void 0?"rc-checkbox":b,F=m.className,C=m.style,P=m.checked,w=m.disabled,I=m.defaultChecked,N=I===void 0?!1:I,q=m.type,re=q===void 0?"checkbox":q,le=m.title,H=m.onChange,ye=(0,M.Z)(m,z),be=(0,l.useRef)(null),Ee=(0,l.useRef)(null),We=(0,J.Z)(N,{value:P}),$=(0,te.Z)(We,2),D=$[0],O=$[1];(0,l.useImperativeHandle)(_,function(){return{focus:function(g){var v;(v=be.current)===null||v===void 0||v.focus(g)},blur:function(){var g;(g=be.current)===null||g===void 0||g.blur()},input:be.current,nativeElement:Ee.current}});var B=ce()(T,F,(0,Ie.Z)((0,Ie.Z)({},"".concat(T,"-checked"),D),"".concat(T,"-disabled"),w)),Q=function(g){w||("checked"in m||O(g.target.checked),H==null||H({target:(0,de.Z)((0,de.Z)({},m),{},{type:re,checked:g.target.checked}),stopPropagation:function(){g.stopPropagation()},preventDefault:function(){g.preventDefault()},nativeEvent:g.nativeEvent}))};return l.createElement("span",{className:B,title:le,style:C,ref:Ee},l.createElement("input",(0,V.Z)({},ye,{className:"".concat(T,"-input"),ref:be,onChange:Q,disabled:w,checked:!!D,type:re})),l.createElement("span",{className:"".concat(T,"-inner")}))});at.Z=x},96478:function(Ut,at,W){"use strict";W.d(at,{Z:function(){return le}});var V=W(54476),de=W(20068),Ie=W(42978),te=W(75931),M=W(65030),p=W(92310),ce=W.n(p),J=W(8654),l=W(59301),z=W(10228),x=W(16089),m=z.Z.ESC,_=z.Z.TAB;function b(H){var ye=H.visible,be=H.triggerRef,Ee=H.onVisibleChange,We=H.autoFocus,$=H.overlayRef,D=l.useRef(!1),O=function(){if(ye){var g,v;(g=be.current)===null||g===void 0||(v=g.focus)===null||v===void 0||v.call(g),Ee==null||Ee(!1)}},B=function(){var g;return(g=$.current)!==null&&g!==void 0&&g.focus?($.current.focus(),D.current=!0,!0):!1},Q=function(g){switch(g.keyCode){case m:O();break;case _:{var v=!1;D.current||(v=B()),v?g.preventDefault():O();break}}};l.useEffect(function(){return ye?(window.addEventListener("keydown",Q),We&&(0,x.Z)(B,3),function(){window.removeEventListener("keydown",Q),D.current=!1}):function(){D.current=!1}},[ye])}var T=(0,l.forwardRef)(function(H,ye){var be=H.overlay,Ee=H.arrow,We=H.prefixCls,$=(0,l.useMemo)(function(){var O;return typeof be=="function"?O=be():O=be,O},[be]),D=(0,J.sQ)(ye,(0,J.C4)($));return l.createElement(l.Fragment,null,Ee&&l.createElement("div",{className:"".concat(We,"-arrow")}),l.cloneElement($,{ref:(0,J.Yr)($)?D:void 0}))}),F=T,C={adjustX:1,adjustY:1},P=[0,0],w={topLeft:{points:["bl","tl"],overflow:C,offset:[0,-4],targetOffset:P},top:{points:["bc","tc"],overflow:C,offset:[0,-4],targetOffset:P},topRight:{points:["br","tr"],overflow:C,offset:[0,-4],targetOffset:P},bottomLeft:{points:["tl","bl"],overflow:C,offset:[0,4],targetOffset:P},bottom:{points:["tc","bc"],overflow:C,offset:[0,4],targetOffset:P},bottomRight:{points:["tr","br"],overflow:C,offset:[0,4],targetOffset:P}},I=w,N=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function q(H,ye){var be,Ee=H.arrow,We=Ee===void 0?!1:Ee,$=H.prefixCls,D=$===void 0?"rc-dropdown":$,O=H.transitionName,B=H.animation,Q=H.align,G=H.placement,g=G===void 0?"bottomLeft":G,v=H.placements,L=v===void 0?I:v,X=H.getPopupContainer,Ae=H.showAction,Be=H.hideAction,ht=H.overlayClassName,Ke=H.overlayStyle,yt=H.visible,ot=H.trigger,je=ot===void 0?["hover"]:ot,zt=H.autoFocus,Ft=H.overlay,ci=H.children,pt=H.onVisibleChange,mi=(0,te.Z)(H,N),we=l.useState(),me=(0,Ie.Z)(we,2),ie=me[0],ke=me[1],ze="visible"in H?yt:ie,Qe=l.useRef(null),K=l.useRef(null),ne=l.useRef(null);l.useImperativeHandle(ye,function(){return Qe.current});var Se=function(ct){ke(ct),pt==null||pt(ct)};b({visible:ze,triggerRef:ne,onVisibleChange:Se,autoFocus:zt,overlayRef:K});var Te=function(ct){var he=H.onOverlayClick;ke(!1),he&&he(ct)},Ne=function(){return l.createElement(F,{ref:K,overlay:Ft,prefixCls:D,arrow:We})},He=function(){return typeof Ft=="function"?Ne:Ne()},bt=function(){var ct=H.minOverlayWidthMatchTrigger,he=H.alignPoint;return"minOverlayWidthMatchTrigger"in H?ct:!he},Xe=function(){var ct=H.openClassName;return ct!==void 0?ct:"".concat(D,"-open")},lt=l.cloneElement(ci,{className:ce()((be=ci.props)===null||be===void 0?void 0:be.className,ze&&Xe()),ref:(0,J.Yr)(ci)?(0,J.sQ)(ne,(0,J.C4)(ci)):void 0}),qe=Be;return!qe&&je.indexOf("contextMenu")!==-1&&(qe=["click"]),l.createElement(M.Z,(0,V.Z)({builtinPlacements:L},mi,{prefixCls:D,ref:Qe,popupClassName:ce()(ht,(0,de.Z)({},"".concat(D,"-show-arrow"),We)),popupStyle:Ke,action:je,showAction:Ae,hideAction:qe,popupPlacement:g,popupAlign:Q,popupTransitionName:O,popupAnimation:B,popupVisible:ze,stretch:bt()?"minWidth":"",popup:He(),onPopupVisibleChange:Se,onPopupClick:Te,getPopupContainer:X}),lt)}var re=l.forwardRef(q),le=re},66003:function(Ut,at,W){"use strict";W.d(at,{Z:function(){return ce}});var V=W(75931),de=W(33885),Ie=W(76190),te=W(59301),M=["show"];function p(J,l){if(!l.max)return!0;var z=l.strategy(J);return z<=l.max}function ce(J,l){return te.useMemo(function(){var z={};l&&(z.show=(0,Ie.Z)(l)==="object"&&l.formatter?l.formatter:!!l),z=(0,de.Z)((0,de.Z)({},z),J);var x=z,m=x.show,_=(0,V.Z)(x,M);return(0,de.Z)((0,de.Z)({},_),{},{show:!!m,showFormatter:typeof m=="function"?m:void 0,strategy:_.strategy||function(b){return b.length}})},[J,l])}},36901:function(Ut,at,W){"use strict";W.r(at),W.d(at,{BaseInput:function(){return z},default:function(){return I}});var V=W(33885),de=W(54476),Ie=W(20068),te=W(76190),M=W(92310),p=W.n(M),ce=W(59301),J=W(30292),l=ce.forwardRef(function(N,q){var re,le,H,ye=N.inputElement,be=N.children,Ee=N.prefixCls,We=N.prefix,$=N.suffix,D=N.addonBefore,O=N.addonAfter,B=N.className,Q=N.style,G=N.disabled,g=N.readOnly,v=N.focused,L=N.triggerFocus,X=N.allowClear,Ae=N.value,Be=N.handleReset,ht=N.hidden,Ke=N.classes,yt=N.classNames,ot=N.dataAttrs,je=N.styles,zt=N.components,Ft=N.onClear,ci=be!=null?be:ye,pt=(zt==null?void 0:zt.affixWrapper)||"span",mi=(zt==null?void 0:zt.groupWrapper)||"span",we=(zt==null?void 0:zt.wrapper)||"span",me=(zt==null?void 0:zt.groupAddon)||"span",ie=(0,ce.useRef)(null),ke=function(Me){var $e;($e=ie.current)!==null&&$e!==void 0&&$e.contains(Me.target)&&(L==null||L())},ze=(0,J.X3)(N),Qe=(0,ce.cloneElement)(ci,{value:Ae,className:p()((re=ci.props)===null||re===void 0?void 0:re.className,!ze&&(yt==null?void 0:yt.variant))||null}),K=(0,ce.useRef)(null);if(ce.useImperativeHandle(q,function(){return{nativeElement:K.current||ie.current}}),ze){var ne=null;if(X){var Se=!G&&!g&&Ae,Te="".concat(Ee,"-clear-icon"),Ne=(0,te.Z)(X)==="object"&&X!==null&&X!==void 0&&X.clearIcon?X.clearIcon:"\u2716";ne=ce.createElement("button",{type:"button",tabIndex:-1,onClick:function(Me){Be==null||Be(Me),Ft==null||Ft()},onMouseDown:function(Me){return Me.preventDefault()},className:p()(Te,(0,Ie.Z)((0,Ie.Z)({},"".concat(Te,"-hidden"),!Se),"".concat(Te,"-has-suffix"),!!$))},Ne)}var He="".concat(Ee,"-affix-wrapper"),bt=p()(He,(0,Ie.Z)((0,Ie.Z)((0,Ie.Z)((0,Ie.Z)((0,Ie.Z)({},"".concat(Ee,"-disabled"),G),"".concat(He,"-disabled"),G),"".concat(He,"-focused"),v),"".concat(He,"-readonly"),g),"".concat(He,"-input-with-clear-btn"),$&&X&&Ae),Ke==null?void 0:Ke.affixWrapper,yt==null?void 0:yt.affixWrapper,yt==null?void 0:yt.variant),Xe=($||X)&&ce.createElement("span",{className:p()("".concat(Ee,"-suffix"),yt==null?void 0:yt.suffix),style:je==null?void 0:je.suffix},ne,$);Qe=ce.createElement(pt,(0,de.Z)({className:bt,style:je==null?void 0:je.affixWrapper,onClick:ke},ot==null?void 0:ot.affixWrapper,{ref:ie}),We&&ce.createElement("span",{className:p()("".concat(Ee,"-prefix"),yt==null?void 0:yt.prefix),style:je==null?void 0:je.prefix},We),Qe,Xe)}if((0,J.He)(N)){var lt="".concat(Ee,"-group"),qe="".concat(lt,"-addon"),_t="".concat(lt,"-wrapper"),ct=p()("".concat(Ee,"-wrapper"),lt,Ke==null?void 0:Ke.wrapper,yt==null?void 0:yt.wrapper),he=p()(_t,(0,Ie.Z)({},"".concat(_t,"-disabled"),G),Ke==null?void 0:Ke.group,yt==null?void 0:yt.groupWrapper);Qe=ce.createElement(mi,{className:he,ref:K},ce.createElement(we,{className:ct},D&&ce.createElement(me,{className:qe},D),Qe,O&&ce.createElement(me,{className:qe},O)))}return ce.cloneElement(Qe,{className:p()((le=Qe.props)===null||le===void 0?void 0:le.className,B)||null,style:(0,V.Z)((0,V.Z)({},(H=Qe.props)===null||H===void 0?void 0:H.style),Q),hidden:ht})}),z=l,x=W(94480),m=W(42978),_=W(75931),b=W(18929),T=W(2738),F=W(66003),C=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],P=(0,ce.forwardRef)(function(N,q){var re=N.autoComplete,le=N.onChange,H=N.onFocus,ye=N.onBlur,be=N.onPressEnter,Ee=N.onKeyDown,We=N.onKeyUp,$=N.prefixCls,D=$===void 0?"rc-input":$,O=N.disabled,B=N.htmlSize,Q=N.className,G=N.maxLength,g=N.suffix,v=N.showCount,L=N.count,X=N.type,Ae=X===void 0?"text":X,Be=N.classes,ht=N.classNames,Ke=N.styles,yt=N.onCompositionStart,ot=N.onCompositionEnd,je=(0,_.Z)(N,C),zt=(0,ce.useState)(!1),Ft=(0,m.Z)(zt,2),ci=Ft[0],pt=Ft[1],mi=(0,ce.useRef)(!1),we=(0,ce.useRef)(!1),me=(0,ce.useRef)(null),ie=(0,ce.useRef)(null),ke=function(dt){me.current&&(0,J.nH)(me.current,dt)},ze=(0,b.Z)(N.defaultValue,{value:N.value}),Qe=(0,m.Z)(ze,2),K=Qe[0],ne=Qe[1],Se=K==null?"":String(K),Te=(0,ce.useState)(null),Ne=(0,m.Z)(Te,2),He=Ne[0],bt=Ne[1],Xe=(0,F.Z)(L,v),lt=Xe.max||G,qe=Xe.strategy(Se),_t=!!lt&&qe>lt;(0,ce.useImperativeHandle)(q,function(){var Ze;return{focus:ke,blur:function(){var fe;(fe=me.current)===null||fe===void 0||fe.blur()},setSelectionRange:function(fe,ae,oe){var R;(R=me.current)===null||R===void 0||R.setSelectionRange(fe,ae,oe)},select:function(){var fe;(fe=me.current)===null||fe===void 0||fe.select()},input:me.current,nativeElement:((Ze=ie.current)===null||Ze===void 0?void 0:Ze.nativeElement)||me.current}}),(0,ce.useEffect)(function(){we.current&&(we.current=!1),pt(function(Ze){return Ze&&O?!1:Ze})},[O]);var ct=function(dt,fe,ae){var oe=fe;if(!mi.current&&Xe.exceedFormatter&&Xe.max&&Xe.strategy(fe)>Xe.max){if(oe=Xe.exceedFormatter(fe,{max:Xe.max}),fe!==oe){var R,k;bt([((R=me.current)===null||R===void 0?void 0:R.selectionStart)||0,((k=me.current)===null||k===void 0?void 0:k.selectionEnd)||0])}}else if(ae.source==="compositionEnd")return;ne(oe),me.current&&(0,J.rJ)(me.current,dt,le,oe)};(0,ce.useEffect)(function(){if(He){var Ze;(Ze=me.current)===null||Ze===void 0||Ze.setSelectionRange.apply(Ze,(0,x.Z)(He))}},[He]);var he=function(dt){ct(dt,dt.target.value,{source:"change"})},_e=function(dt){mi.current=!1,ct(dt,dt.currentTarget.value,{source:"compositionEnd"}),ot==null||ot(dt)},Me=function(dt){be&&dt.key==="Enter"&&!we.current&&(we.current=!0,be(dt)),Ee==null||Ee(dt)},$e=function(dt){dt.key==="Enter"&&(we.current=!1),We==null||We(dt)},Pe=function(dt){pt(!0),H==null||H(dt)},st=function(dt){we.current&&(we.current=!1),pt(!1),ye==null||ye(dt)},nt=function(dt){ne(""),ke(),me.current&&(0,J.rJ)(me.current,dt,le)},Je=_t&&"".concat(D,"-out-of-range"),ft=function(){var dt=(0,T.Z)(N,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return ce.createElement("input",(0,de.Z)({autoComplete:re},dt,{onChange:he,onFocus:Pe,onBlur:st,onKeyDown:Me,onKeyUp:$e,className:p()(D,(0,Ie.Z)({},"".concat(D,"-disabled"),O),ht==null?void 0:ht.input),style:Ke==null?void 0:Ke.input,ref:me,size:B,type:Ae,onCompositionStart:function(ae){mi.current=!0,yt==null||yt(ae)},onCompositionEnd:_e}))},At=function(){var dt=Number(lt)>0;if(g||Xe.show){var fe=Xe.showFormatter?Xe.showFormatter({value:Se,count:qe,maxLength:lt}):"".concat(qe).concat(dt?" / ".concat(lt):"");return ce.createElement(ce.Fragment,null,Xe.show&&ce.createElement("span",{className:p()("".concat(D,"-show-count-suffix"),(0,Ie.Z)({},"".concat(D,"-show-count-has-suffix"),!!g),ht==null?void 0:ht.count),style:(0,V.Z)({},Ke==null?void 0:Ke.count)},fe),g)}return null};return ce.createElement(z,(0,de.Z)({},je,{prefixCls:D,className:p()(Q,Je),handleReset:nt,value:Se,focused:ci,triggerFocus:ke,suffix:At(),disabled:O,classes:Be,classNames:ht,styles:Ke}),ft())}),w=P,I=w},30292:function(Ut,at,W){"use strict";W.d(at,{He:function(){return V},X3:function(){return de},nH:function(){return M},rJ:function(){return te}});function V(p){return!!(p.addonBefore||p.addonAfter)}function de(p){return!!(p.prefix||p.suffix||p.allowClear)}function Ie(p,ce,J){var l=ce.cloneNode(!0),z=Object.create(p,{target:{value:l},currentTarget:{value:l}});return l.value=J,typeof ce.selectionStart=="number"&&typeof ce.selectionEnd=="number"&&(l.selectionStart=ce.selectionStart,l.selectionEnd=ce.selectionEnd),l.setSelectionRange=function(){ce.setSelectionRange.apply(ce,arguments)},z}function te(p,ce,J,l){if(J){var z=ce;if(ce.type==="click"){z=Ie(ce,p,""),J(z);return}if(p.type!=="file"&&l!==void 0){z=Ie(ce,p,l),J(z);return}J(z)}}function M(p,ce){if(p){p.focus(ce);var J=ce||{},l=J.cursor;if(l){var z=p.value.length;switch(l){case"start":p.setSelectionRange(0,0);break;case"end":p.setSelectionRange(z,z);break;default:p.setSelectionRange(0,z)}}}}},28321:function(Ut,at,W){"use strict";W.d(at,{iz:function(){return wi},ck:function(){return oe},BW:function(){return Hi},sN:function(){return oe},Wd:function(){return ki},ZP:function(){return Ct},Xl:function(){return be}});var V=W(54476),de=W(20068),Ie=W(33885),te=W(94480),M=W(42978),p=W(75931),ce=W(92310),J=W.n(ce),l=W(11780),z=W(18929),x=W(13697),m=W(48736),_=W(59301),b=W(4676),T=_.createContext(null);function F(pe,De){return pe===void 0?null:"".concat(pe,"-").concat(De)}function C(pe){var De=_.useContext(T);return F(De,pe)}var P=W(80547),w=["children","locked"],I=_.createContext(null);function N(pe,De){var Ve=(0,Ie.Z)({},pe);return Object.keys(De).forEach(function(Oe){var it=De[Oe];it!==void 0&&(Ve[Oe]=it)}),Ve}function q(pe){var De=pe.children,Ve=pe.locked,Oe=(0,p.Z)(pe,w),it=_.useContext(I),ut=(0,P.Z)(function(){return N(it,Oe)},[it,Oe],function(mt,Et){return!Ve&&(mt[0]!==Et[0]||!(0,x.Z)(mt[1],Et[1],!0))});return _.createElement(I.Provider,{value:ut},De)}var re=[],le=_.createContext(null);function H(){return _.useContext(le)}var ye=_.createContext(re);function be(pe){var De=_.useContext(ye);return _.useMemo(function(){return pe!==void 0?[].concat((0,te.Z)(De),[pe]):De},[De,pe])}var Ee=_.createContext(null),We=_.createContext({}),$=We,D=W(29194);function O(pe){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,D.Z)(pe)){var Ve=pe.nodeName.toLowerCase(),Oe=["input","select","textarea","button"].includes(Ve)||pe.isContentEditable||Ve==="a"&&!!pe.getAttribute("href"),it=pe.getAttribute("tabindex"),ut=Number(it),mt=null;return it&&!Number.isNaN(ut)?mt=ut:Oe&&mt===null&&(mt=0),Oe&&pe.disabled&&(mt=null),mt!==null&&(mt>=0||De&&mt<0)}return!1}function B(pe){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ve=(0,te.Z)(pe.querySelectorAll("*")).filter(function(Oe){return O(Oe,De)});return O(pe,De)&&Ve.unshift(pe),Ve}var Q=null;function G(){Q=document.activeElement}function g(){Q=null}function v(){if(Q)try{Q.focus()}catch(pe){}}function L(pe,De){if(De.keyCode===9){var Ve=B(pe),Oe=Ve[De.shiftKey?0:Ve.length-1],it=Oe===document.activeElement||pe===document.activeElement;if(it){var ut=Ve[De.shiftKey?Ve.length-1:0];ut.focus(),De.preventDefault()}}}var X=W(10228),Ae=W(16089),Be=X.Z.LEFT,ht=X.Z.RIGHT,Ke=X.Z.UP,yt=X.Z.DOWN,ot=X.Z.ENTER,je=X.Z.ESC,zt=X.Z.HOME,Ft=X.Z.END,ci=[Ke,yt,Be,ht];function pt(pe,De,Ve,Oe){var it,ut="prev",mt="next",Et="children",ti="parent";if(pe==="inline"&&Oe===ot)return{inlineTrigger:!0};var Zt=(0,de.Z)((0,de.Z)({},Ke,ut),yt,mt),Li=(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},Be,Ve?mt:ut),ht,Ve?ut:mt),yt,Et),ot,Et),kt=(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},Ke,ut),yt,mt),ot,Et),je,ti),Be,Ve?Et:ti),ht,Ve?ti:Et),ei={inline:Zt,horizontal:Li,vertical:kt,inlineSub:Zt,horizontalSub:kt,verticalSub:kt},Qt=(it=ei["".concat(pe).concat(De?"":"Sub")])===null||it===void 0?void 0:it[Oe];switch(Qt){case ut:return{offset:-1,sibling:!0};case mt:return{offset:1,sibling:!0};case ti:return{offset:-1,sibling:!1};case Et:return{offset:1,sibling:!1};default:return null}}function mi(pe){for(var De=pe;De;){if(De.getAttribute("data-menu-list"))return De;De=De.parentElement}return null}function we(pe,De){for(var Ve=pe||document.activeElement;Ve;){if(De.has(Ve))return Ve;Ve=Ve.parentElement}return null}function me(pe,De){var Ve=B(pe,!0);return Ve.filter(function(Oe){return De.has(Oe)})}function ie(pe,De,Ve){var Oe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!pe)return null;var it=me(pe,De),ut=it.length,mt=it.findIndex(function(Et){return Ve===Et});return Oe<0?mt===-1?mt=ut-1:mt-=1:Oe>0&&(mt+=1),mt=(mt+ut)%ut,it[mt]}var ke=function(De,Ve){var Oe=new Set,it=new Map,ut=new Map;return De.forEach(function(mt){var Et=document.querySelector("[data-menu-id='".concat(F(Ve,mt),"']"));Et&&(Oe.add(Et),ut.set(Et,mt),it.set(mt,Et))}),{elements:Oe,key2element:it,element2key:ut}};function ze(pe,De,Ve,Oe,it,ut,mt,Et,ti,Zt){var Li=_.useRef(),kt=_.useRef();kt.current=De;var ei=function(){Ae.Z.cancel(Li.current)};return _.useEffect(function(){return function(){ei()}},[]),function(Qt){var ai=Qt.which;if([].concat(ci,[ot,je,zt,Ft]).includes(ai)){var di=ut(),Kt=ke(di,Oe),qt=Kt,pi=qt.elements,li=qt.key2element,ni=qt.element2key,Ri=li.get(De),fi=we(Ri,pi),bi=ni.get(fi),ji=pt(pe,mt(bi,!0).length===1,Ve,ai);if(!ji&&ai!==zt&&ai!==Ft)return;(ci.includes(ai)||[zt,Ft].includes(ai))&&Qt.preventDefault();var Mi=function(yi){if(yi){var En=yi,Si=yi.querySelector("a");Si!=null&&Si.getAttribute("href")&&(En=Si);var oi=ni.get(yi);Et(oi),ei(),Li.current=(0,Ae.Z)(function(){kt.current===oi&&En.focus()})}};if([zt,Ft].includes(ai)||ji.sibling||!fi){var cn;!fi||pe==="inline"?cn=it.current:cn=mi(fi);var $i,Zi=me(cn,pi);ai===zt?$i=Zi[0]:ai===Ft?$i=Zi[Zi.length-1]:$i=ie(cn,pi,fi,ji.offset),Mi($i)}else if(ji.inlineTrigger)ti(bi);else if(ji.offset>0)ti(bi,!0),ei(),Li.current=(0,Ae.Z)(function(){Kt=ke(di,Oe);var xi=fi.getAttribute("aria-controls"),yi=document.getElementById(xi),En=ie(yi,Kt.elements);Mi(En)},5);else if(ji.offset<0){var Ji=mt(bi,!0),zi=Ji[Ji.length-2],Ki=li.get(zi);ti(zi,!1),Mi(Ki)}}Zt==null||Zt(Qt)}}function Qe(pe){Promise.resolve().then(pe)}var K="__RC_UTIL_PATH_SPLIT__",ne=function(De){return De.join(K)},Se=function(De){return De.split(K)},Te="rc-menu-more";function Ne(){var pe=_.useState({}),De=(0,M.Z)(pe,2),Ve=De[1],Oe=(0,_.useRef)(new Map),it=(0,_.useRef)(new Map),ut=_.useState([]),mt=(0,M.Z)(ut,2),Et=mt[0],ti=mt[1],Zt=(0,_.useRef)(0),Li=(0,_.useRef)(!1),kt=function(){Li.current||Ve({})},ei=(0,_.useCallback)(function(li,ni){var Ri=ne(ni);it.current.set(Ri,li),Oe.current.set(li,Ri),Zt.current+=1;var fi=Zt.current;Qe(function(){fi===Zt.current&&kt()})},[]),Qt=(0,_.useCallback)(function(li,ni){var Ri=ne(ni);it.current.delete(Ri),Oe.current.delete(li)},[]),ai=(0,_.useCallback)(function(li){ti(li)},[]),di=(0,_.useCallback)(function(li,ni){var Ri=Oe.current.get(li)||"",fi=Se(Ri);return ni&&Et.includes(fi[0])&&fi.unshift(Te),fi},[Et]),Kt=(0,_.useCallback)(function(li,ni){return li.filter(function(Ri){return Ri!==void 0}).some(function(Ri){var fi=di(Ri,!0);return fi.includes(ni)})},[di]),qt=function(){var ni=(0,te.Z)(Oe.current.keys());return Et.length&&ni.push(Te),ni},pi=(0,_.useCallback)(function(li){var ni="".concat(Oe.current.get(li)).concat(K),Ri=new Set;return(0,te.Z)(it.current.keys()).forEach(function(fi){fi.startsWith(ni)&&Ri.add(it.current.get(fi))}),Ri},[]);return _.useEffect(function(){return function(){Li.current=!0}},[]),{registerPath:ei,unregisterPath:Qt,refreshOverflowKeys:ai,isSubPathKey:Kt,getKeyPath:di,getKeys:qt,getSubPathKeys:pi}}function He(pe){var De=_.useRef(pe);De.current=pe;var Ve=_.useCallback(function(){for(var Oe,it=arguments.length,ut=new Array(it),mt=0;mt<it;mt++)ut[mt]=arguments[mt];return(Oe=De.current)===null||Oe===void 0?void 0:Oe.call.apply(Oe,[De].concat(ut))},[]);return pe?Ve:void 0}var bt=Math.random().toFixed(5).toString().slice(2),Xe=0;function lt(pe){var De=(0,z.Z)(pe,{value:pe}),Ve=(0,M.Z)(De,2),Oe=Ve[0],it=Ve[1];return _.useEffect(function(){Xe+=1;var ut="".concat(bt,"-").concat(Xe);it("rc-menu-uuid-".concat(ut))},[]),Oe}var qe=W(67732),_t=W(83652),ct=W(42403),he=W(158),_e=W(2738),Me=W(8654);function $e(pe,De,Ve,Oe){var it=_.useContext(I),ut=it.activeKey,mt=it.onActive,Et=it.onInactive,ti={active:ut===pe};return De||(ti.onMouseEnter=function(Zt){Ve==null||Ve({key:pe,domEvent:Zt}),mt(pe)},ti.onMouseLeave=function(Zt){Oe==null||Oe({key:pe,domEvent:Zt}),Et(pe)}),ti}function Pe(pe){var De=_.useContext(I),Ve=De.mode,Oe=De.rtl,it=De.inlineIndent;if(Ve!=="inline")return null;var ut=pe;return Oe?{paddingRight:ut*it}:{paddingLeft:ut*it}}function st(pe){var De=pe.icon,Ve=pe.props,Oe=pe.children,it;return De===null||De===!1?null:(typeof De=="function"?it=_.createElement(De,(0,Ie.Z)({},Ve)):typeof De!="boolean"&&(it=De),it||Oe||null)}var nt=["item"];function Je(pe){var De=pe.item,Ve=(0,p.Z)(pe,nt);return Object.defineProperty(Ve,"item",{get:function(){return(0,m.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),De}}),Ve}var ft=["title","attribute","elementRef"],At=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],Ze=["active"],dt=function(pe){(0,ct.Z)(Ve,pe);var De=(0,he.Z)(Ve);function Ve(){return(0,qe.Z)(this,Ve),De.apply(this,arguments)}return(0,_t.Z)(Ve,[{key:"render",value:function(){var it=this.props,ut=it.title,mt=it.attribute,Et=it.elementRef,ti=(0,p.Z)(it,ft),Zt=(0,_e.Z)(ti,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,m.ZP)(!mt,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),_.createElement(l.Z.Item,(0,V.Z)({},mt,{title:typeof ut=="string"?ut:void 0},Zt,{ref:Et}))}}]),Ve}(_.Component),fe=_.forwardRef(function(pe,De){var Ve=pe.style,Oe=pe.className,it=pe.eventKey,ut=pe.warnKey,mt=pe.disabled,Et=pe.itemIcon,ti=pe.children,Zt=pe.role,Li=pe.onMouseEnter,kt=pe.onMouseLeave,ei=pe.onClick,Qt=pe.onKeyDown,ai=pe.onFocus,di=(0,p.Z)(pe,At),Kt=C(it),qt=_.useContext(I),pi=qt.prefixCls,li=qt.onItemClick,ni=qt.disabled,Ri=qt.overflowDisabled,fi=qt.itemIcon,bi=qt.selectedKeys,ji=qt.onActive,Mi=_.useContext($),cn=Mi._internalRenderMenuItem,$i="".concat(pi,"-item"),Zi=_.useRef(),Ji=_.useRef(),zi=ni||mt,Ki=(0,Me.x1)(De,Ji),xi=be(it),yi=function(Qi){return{key:it,keyPath:(0,te.Z)(xi).reverse(),item:Zi.current,domEvent:Qi}},En=Et||fi,Si=$e(it,zi,Li,kt),oi=Si.active,vn=(0,p.Z)(Si,Ze),Tn=bi.includes(it),Yi=Pe(xi.length),wn=function(Qi){if(!zi){var fn=yi(Qi);ei==null||ei(Je(fn)),li(fn)}},Bi=function(Qi){if(Qt==null||Qt(Qi),Qi.which===X.Z.ENTER){var fn=yi(Qi);ei==null||ei(Je(fn)),li(fn)}},an=function(Qi){ji(it),ai==null||ai(Qi)},Un={};pe.role==="option"&&(Un["aria-selected"]=Tn);var Sn=_.createElement(dt,(0,V.Z)({ref:Zi,elementRef:Ki,role:Zt===null?"none":Zt||"menuitem",tabIndex:mt?null:-1,"data-menu-id":Ri&&Kt?null:Kt},(0,_e.Z)(di,["extra"]),vn,Un,{component:"li","aria-disabled":mt,style:(0,Ie.Z)((0,Ie.Z)({},Yi),Ve),className:J()($i,(0,de.Z)((0,de.Z)((0,de.Z)({},"".concat($i,"-active"),oi),"".concat($i,"-selected"),Tn),"".concat($i,"-disabled"),zi),Oe),onClick:wn,onKeyDown:Bi,onFocus:an}),ti,_.createElement(st,{props:(0,Ie.Z)((0,Ie.Z)({},pe),{},{isSelected:Tn}),icon:En}));return cn&&(Sn=cn(Sn,pe,{selected:Tn})),Sn});function ae(pe,De){var Ve=pe.eventKey,Oe=H(),it=be(Ve);return _.useEffect(function(){if(Oe)return Oe.registerPath(Ve,it),function(){Oe.unregisterPath(Ve,it)}},[it]),Oe?null:_.createElement(fe,(0,V.Z)({},pe,{ref:De}))}var oe=_.forwardRef(ae),R=["className","children"],k=function(De,Ve){var Oe=De.className,it=De.children,ut=(0,p.Z)(De,R),mt=_.useContext(I),Et=mt.prefixCls,ti=mt.mode,Zt=mt.rtl;return _.createElement("ul",(0,V.Z)({className:J()(Et,Zt&&"".concat(Et,"-rtl"),"".concat(Et,"-sub"),"".concat(Et,"-").concat(ti==="inline"?"inline":"vertical"),Oe),role:"menu"},ut,{"data-menu-list":!0,ref:Ve}),it)},Z=_.forwardRef(k);Z.displayName="SubMenuList";var ee=Z,se=W(11592);function Ue(pe,De){return(0,se.Z)(pe).map(function(Ve,Oe){if(_.isValidElement(Ve)){var it,ut,mt=Ve.key,Et=(it=(ut=Ve.props)===null||ut===void 0?void 0:ut.eventKey)!==null&&it!==void 0?it:mt,ti=Et==null;ti&&(Et="tmp_key-".concat([].concat((0,te.Z)(De),[Oe]).join("-")));var Zt={key:Et,eventKey:Et};return _.cloneElement(Ve,Zt)}return Ve})}var Ge=W(65030),tt={adjustX:1,adjustY:1},gt={topLeft:{points:["bl","tl"],overflow:tt},topRight:{points:["br","tr"],overflow:tt},bottomLeft:{points:["tl","bl"],overflow:tt},bottomRight:{points:["tr","br"],overflow:tt},leftTop:{points:["tr","tl"],overflow:tt},leftBottom:{points:["br","bl"],overflow:tt},rightTop:{points:["tl","tr"],overflow:tt},rightBottom:{points:["bl","br"],overflow:tt}},wt={topLeft:{points:["bl","tl"],overflow:tt},topRight:{points:["br","tr"],overflow:tt},bottomLeft:{points:["tl","bl"],overflow:tt},bottomRight:{points:["tr","br"],overflow:tt},rightTop:{points:["tr","tl"],overflow:tt},rightBottom:{points:["br","bl"],overflow:tt},leftTop:{points:["tl","tr"],overflow:tt},leftBottom:{points:["bl","br"],overflow:tt}},$t=null;function Dt(pe,De,Ve){if(De)return De;if(Ve)return Ve[pe]||Ve.other}var rt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function Lt(pe){var De=pe.prefixCls,Ve=pe.visible,Oe=pe.children,it=pe.popup,ut=pe.popupStyle,mt=pe.popupClassName,Et=pe.popupOffset,ti=pe.disabled,Zt=pe.mode,Li=pe.onVisibleChange,kt=_.useContext(I),ei=kt.getPopupContainer,Qt=kt.rtl,ai=kt.subMenuOpenDelay,di=kt.subMenuCloseDelay,Kt=kt.builtinPlacements,qt=kt.triggerSubMenuAction,pi=kt.forceSubMenuRender,li=kt.rootClassName,ni=kt.motion,Ri=kt.defaultMotions,fi=_.useState(!1),bi=(0,M.Z)(fi,2),ji=bi[0],Mi=bi[1],cn=Qt?(0,Ie.Z)((0,Ie.Z)({},wt),Kt):(0,Ie.Z)((0,Ie.Z)({},gt),Kt),$i=rt[Zt],Zi=Dt(Zt,ni,Ri),Ji=_.useRef(Zi);Zt!=="inline"&&(Ji.current=Zi);var zi=(0,Ie.Z)((0,Ie.Z)({},Ji.current),{},{leavedClassName:"".concat(De,"-hidden"),removeOnLeave:!1,motionAppear:!0}),Ki=_.useRef();return _.useEffect(function(){return Ki.current=(0,Ae.Z)(function(){Mi(Ve)}),function(){Ae.Z.cancel(Ki.current)}},[Ve]),_.createElement(Ge.Z,{prefixCls:De,popupClassName:J()("".concat(De,"-popup"),(0,de.Z)({},"".concat(De,"-rtl"),Qt),mt,li),stretch:Zt==="horizontal"?"minWidth":null,getPopupContainer:ei,builtinPlacements:cn,popupPlacement:$i,popupVisible:ji,popup:it,popupStyle:ut,popupAlign:Et&&{offset:Et},action:ti?[]:[qt],mouseEnterDelay:ai,mouseLeaveDelay:di,onPopupVisibleChange:Li,forceRender:pi,popupMotion:zi,fresh:!0},Oe)}var Jt=W(77900);function Xt(pe){var De=pe.id,Ve=pe.open,Oe=pe.keyPath,it=pe.children,ut="inline",mt=_.useContext(I),Et=mt.prefixCls,ti=mt.forceSubMenuRender,Zt=mt.motion,Li=mt.defaultMotions,kt=mt.mode,ei=_.useRef(!1);ei.current=kt===ut;var Qt=_.useState(!ei.current),ai=(0,M.Z)(Qt,2),di=ai[0],Kt=ai[1],qt=ei.current?Ve:!1;_.useEffect(function(){ei.current&&Kt(!1)},[kt]);var pi=(0,Ie.Z)({},Dt(ut,Zt,Li));Oe.length>1&&(pi.motionAppear=!1);var li=pi.onVisibleChanged;return pi.onVisibleChanged=function(ni){return!ei.current&&!ni&&Kt(!0),li==null?void 0:li(ni)},di?null:_.createElement(q,{mode:ut,locked:!ei.current},_.createElement(Jt.default,(0,V.Z)({visible:qt},pi,{forceRender:ti,removeOnLeave:!1,leavedClassName:"".concat(Et,"-hidden")}),function(ni){var Ri=ni.className,fi=ni.style;return _.createElement(ee,{id:De,className:Ri,style:fi},it)}))}var ri=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],Vt=["active"],jt=_.forwardRef(function(pe,De){var Ve=pe.style,Oe=pe.className,it=pe.title,ut=pe.eventKey,mt=pe.warnKey,Et=pe.disabled,ti=pe.internalPopupClose,Zt=pe.children,Li=pe.itemIcon,kt=pe.expandIcon,ei=pe.popupClassName,Qt=pe.popupOffset,ai=pe.popupStyle,di=pe.onClick,Kt=pe.onMouseEnter,qt=pe.onMouseLeave,pi=pe.onTitleClick,li=pe.onTitleMouseEnter,ni=pe.onTitleMouseLeave,Ri=(0,p.Z)(pe,ri),fi=C(ut),bi=_.useContext(I),ji=bi.prefixCls,Mi=bi.mode,cn=bi.openKeys,$i=bi.disabled,Zi=bi.overflowDisabled,Ji=bi.activeKey,zi=bi.selectedKeys,Ki=bi.itemIcon,xi=bi.expandIcon,yi=bi.onItemClick,En=bi.onOpenChange,Si=bi.onActive,oi=_.useContext($),vn=oi._internalRenderSubMenuItem,Tn=_.useContext(Ee),Yi=Tn.isSubPathKey,wn=be(),Bi="".concat(ji,"-submenu"),an=$i||Et,Un=_.useRef(),Sn=_.useRef(),bn=Li!=null?Li:Ki,Qi=kt!=null?kt:xi,fn=cn.includes(ut),yn=!Zi&&fn,Ln=Yi(zi,ut),en=$e(ut,an,li,ni),hn=en.active,An=(0,p.Z)(en,Vt),Pn=_.useState(!1),dn=(0,M.Z)(Pn,2),_i=dn[0],Gt=dn[1],vi=function(xn){an||Gt(xn)},Pi=function(xn){vi(!0),Kt==null||Kt({key:ut,domEvent:xn})},Mt=function(xn){vi(!1),qt==null||qt({key:ut,domEvent:xn})},sn=_.useMemo(function(){return hn||(Mi!=="inline"?_i||Yi([Ji],ut):!1)},[Mi,hn,Ji,_i,ut,Yi]),on=Pe(wn.length),ln=function(xn){an||(pi==null||pi({key:ut,domEvent:xn}),Mi==="inline"&&En(ut,!fn))},Vn=He(function(tn){di==null||di(Je(tn)),yi(tn)}),Dn=function(xn){Mi!=="inline"&&En(ut,xn)},qn=function(){Si(ut)},Wn=fi&&"".concat(fi,"-popup"),Ii=_.useMemo(function(){return _.createElement(st,{icon:Mi!=="horizontal"?Qi:void 0,props:(0,Ie.Z)((0,Ie.Z)({},pe),{},{isOpen:yn,isSubMenu:!0})},_.createElement("i",{className:"".concat(Bi,"-arrow")}))},[Mi,Qi,pe,yn,Bi]),pn=_.createElement("div",(0,V.Z)({role:"menuitem",style:on,className:"".concat(Bi,"-title"),tabIndex:an?null:-1,ref:Un,title:typeof it=="string"?it:null,"data-menu-id":Zi&&fi?null:fi,"aria-expanded":yn,"aria-haspopup":!0,"aria-controls":Wn,"aria-disabled":an,onClick:ln,onFocus:qn},An),it,Ii),$n=_.useRef(Mi);if(Mi!=="inline"&&wn.length>1?$n.current="vertical":$n.current=Mi,!Zi){var ss=$n.current;pn=_.createElement(Lt,{mode:ss,prefixCls:Bi,visible:!ti&&yn&&Mi!=="inline",popupClassName:ei,popupOffset:Qt,popupStyle:ai,popup:_.createElement(q,{mode:ss==="horizontal"?"vertical":ss},_.createElement(ee,{id:Wn,ref:Sn},Zt)),disabled:an,onVisibleChange:Dn},pn)}var gn=_.createElement(l.Z.Item,(0,V.Z)({ref:De,role:"none"},Ri,{component:"li",style:Ve,className:J()(Bi,"".concat(Bi,"-").concat(Mi),Oe,(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},"".concat(Bi,"-open"),yn),"".concat(Bi,"-active"),sn),"".concat(Bi,"-selected"),Ln),"".concat(Bi,"-disabled"),an)),onMouseEnter:Pi,onMouseLeave:Mt}),pn,!Zi&&_.createElement(Xt,{id:Wn,open:yn,keyPath:wn},Zt));return vn&&(gn=vn(gn,pe,{selected:Ln,active:sn,open:yn,disabled:an})),_.createElement(q,{onItemClick:Vn,mode:Mi==="horizontal"?"vertical":Mi,itemIcon:bn,expandIcon:Qi},gn)}),Fi=_.forwardRef(function(pe,De){var Ve=pe.eventKey,Oe=pe.children,it=be(Ve),ut=Ue(Oe,it),mt=H();_.useEffect(function(){if(mt)return mt.registerPath(Ve,it),function(){mt.unregisterPath(Ve,it)}},[it]);var Et;return mt?Et=ut:Et=_.createElement(jt,(0,V.Z)({ref:De},pe),ut),_.createElement(ye.Provider,{value:it},Et)}),ki=Fi,qi=W(76190);function wi(pe){var De=pe.className,Ve=pe.style,Oe=_.useContext(I),it=Oe.prefixCls,ut=H();return ut?null:_.createElement("li",{role:"separator",className:J()("".concat(it,"-item-divider"),De),style:Ve})}var _n=["className","title","eventKey","children"],hi=_.forwardRef(function(pe,De){var Ve=pe.className,Oe=pe.title,it=pe.eventKey,ut=pe.children,mt=(0,p.Z)(pe,_n),Et=_.useContext(I),ti=Et.prefixCls,Zt="".concat(ti,"-item-group");return _.createElement("li",(0,V.Z)({ref:De,role:"presentation"},mt,{onClick:function(kt){return kt.stopPropagation()},className:J()(Zt,Ve)}),_.createElement("div",{role:"presentation",className:"".concat(Zt,"-title"),title:typeof Oe=="string"?Oe:void 0},Oe),_.createElement("ul",{role:"group",className:"".concat(Zt,"-list")},ut))}),Di=_.forwardRef(function(pe,De){var Ve=pe.eventKey,Oe=pe.children,it=be(Ve),ut=Ue(Oe,it),mt=H();return mt?ut:_.createElement(hi,(0,V.Z)({ref:De},(0,_e.Z)(pe,["warnKey"])),ut)}),Hi=Di,ii=["label","children","key","type","extra"];function Vi(pe,De,Ve){var Oe=De.item,it=De.group,ut=De.submenu,mt=De.divider;return(pe||[]).map(function(Et,ti){if(Et&&(0,qi.Z)(Et)==="object"){var Zt=Et,Li=Zt.label,kt=Zt.children,ei=Zt.key,Qt=Zt.type,ai=Zt.extra,di=(0,p.Z)(Zt,ii),Kt=ei!=null?ei:"tmp-".concat(ti);return kt||Qt==="group"?Qt==="group"?_.createElement(it,(0,V.Z)({key:Kt},di,{title:Li}),Vi(kt,De,Ve)):_.createElement(ut,(0,V.Z)({key:Kt},di,{title:Li}),Vi(kt,De,Ve)):Qt==="divider"?_.createElement(mt,(0,V.Z)({key:Kt},di)):_.createElement(Oe,(0,V.Z)({key:Kt},di,{extra:ai}),Li,(!!ai||ai===0)&&_.createElement("span",{className:"".concat(Ve,"-item-extra")},ai))}return null}).filter(function(Et){return Et})}function Ai(pe,De,Ve,Oe,it){var ut=pe,mt=(0,Ie.Z)({divider:wi,item:oe,group:Hi,submenu:ki},Oe);return De&&(ut=Vi(De,mt,it)),Ue(ut,Ve)}var un=["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"],Wi=[],nn=_.forwardRef(function(pe,De){var Ve,Oe=pe,it=Oe.prefixCls,ut=it===void 0?"rc-menu":it,mt=Oe.rootClassName,Et=Oe.style,ti=Oe.className,Zt=Oe.tabIndex,Li=Zt===void 0?0:Zt,kt=Oe.items,ei=Oe.children,Qt=Oe.direction,ai=Oe.id,di=Oe.mode,Kt=di===void 0?"vertical":di,qt=Oe.inlineCollapsed,pi=Oe.disabled,li=Oe.disabledOverflow,ni=Oe.subMenuOpenDelay,Ri=ni===void 0?.1:ni,fi=Oe.subMenuCloseDelay,bi=fi===void 0?.1:fi,ji=Oe.forceSubMenuRender,Mi=Oe.defaultOpenKeys,cn=Oe.openKeys,$i=Oe.activeKey,Zi=Oe.defaultActiveFirst,Ji=Oe.selectable,zi=Ji===void 0?!0:Ji,Ki=Oe.multiple,xi=Ki===void 0?!1:Ki,yi=Oe.defaultSelectedKeys,En=Oe.selectedKeys,Si=Oe.onSelect,oi=Oe.onDeselect,vn=Oe.inlineIndent,Tn=vn===void 0?24:vn,Yi=Oe.motion,wn=Oe.defaultMotions,Bi=Oe.triggerSubMenuAction,an=Bi===void 0?"hover":Bi,Un=Oe.builtinPlacements,Sn=Oe.itemIcon,bn=Oe.expandIcon,Qi=Oe.overflowedIndicator,fn=Qi===void 0?"...":Qi,yn=Oe.overflowedIndicatorPopupClassName,Ln=Oe.getPopupContainer,en=Oe.onClick,hn=Oe.onOpenChange,An=Oe.onKeyDown,Pn=Oe.openAnimation,dn=Oe.openTransitionName,_i=Oe._internalRenderMenuItem,Gt=Oe._internalRenderSubMenuItem,vi=Oe._internalComponents,Pi=(0,p.Z)(Oe,un),Mt=_.useMemo(function(){return[Ai(ei,kt,Wi,vi,ut),Ai(ei,kt,Wi,{},ut)]},[ei,kt,vi]),sn=(0,M.Z)(Mt,2),on=sn[0],ln=sn[1],Vn=_.useState(!1),Dn=(0,M.Z)(Vn,2),qn=Dn[0],Wn=Dn[1],Ii=_.useRef(),pn=lt(ai),$n=Qt==="rtl",ss=(0,z.Z)(Mi,{value:cn,postState:function(Ui){return Ui||Wi}}),gn=(0,M.Z)(ss,2),tn=gn[0],xn=gn[1],Rn=function(Ui){var Xi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Fn(){xn(Ui),hn==null||hn(Ui)}Xi?(0,b.flushSync)(Fn):Fn()},Hn=_.useState(tn),Kn=(0,M.Z)(Hn,2),us=Kn[0],ms=Kn[1],rs=_.useRef(!1),Ds=_.useMemo(function(){return(Kt==="inline"||Kt==="vertical")&&qt?["vertical",qt]:[Kt,!1]},[Kt,qt]),It=(0,M.Z)(Ds,2),Yt=It[0],Oi=It[1],ui=Yt==="inline",gi=_.useState(Yt),Jn=(0,M.Z)(gi,2),On=Jn[0],cs=Jn[1],_s=_.useState(Oi),fr=(0,M.Z)(_s,2),Hr=fr[0],Zr=fr[1];_.useEffect(function(){cs(Yt),Zr(Oi),rs.current&&(ui?xn(us):Rn(Wi))},[Yt,Oi]);var dr=_.useState(0),Rs=(0,M.Z)(dr,2),es=Rs[0],Yr=Rs[1],Ms=es>=on.length-1||On!=="horizontal"||li;_.useEffect(function(){ui&&ms(tn)},[tn]),_.useEffect(function(){return rs.current=!0,function(){rs.current=!1}},[]);var vs=Ne(),Zs=vs.registerPath,Ys=vs.unregisterPath,Qr=vs.refreshOverflowKeys,Ns=vs.isSubPathKey,Xr=vs.getKeyPath,Zn=vs.getKeys,pr=vs.getSubPathKeys,qr=_.useMemo(function(){return{registerPath:Zs,unregisterPath:Ys}},[Zs,Ys]),gr=_.useMemo(function(){return{isSubPathKey:Ns}},[Ns]);_.useEffect(function(){Qr(Ms?Wi:on.slice(es+1).map(function(rn){return rn.key}))},[es,Ms]);var mr=(0,z.Z)($i||Zi&&((Ve=on[0])===null||Ve===void 0?void 0:Ve.key),{value:$i}),Qs=(0,M.Z)(mr,2),bs=Qs[0],Xs=Qs[1],qs=He(function(rn){Xs(rn)}),_r=He(function(){Xs(void 0)});(0,_.useImperativeHandle)(De,function(){return{list:Ii.current,focus:function(Ui){var Xi,Fn=Zn(),Mn=ke(Fn,pn),Bs=Mn.elements,Us=Mn.key2element,Ls=Mn.element2key,Tr=me(Ii.current,Bs),tr=bs!=null?bs:Tr[0]?Ls.get(Tr[0]):(Xi=on.find(function(Sr){return!Sr.props.disabled}))===null||Xi===void 0?void 0:Xi.key,xs=Us.get(tr);if(tr&&xs){var ir;xs==null||(ir=xs.focus)===null||ir===void 0||ir.call(xs,Ui)}}}});var vr=(0,z.Z)(yi||[],{value:En,postState:function(Ui){return Array.isArray(Ui)?Ui:Ui==null?Wi:[Ui]}}),ts=(0,M.Z)(vr,2),Is=ts[0],Js=ts[1],yr=function(Ui){if(zi){var Xi=Ui.key,Fn=Is.includes(Xi),Mn;xi?Fn?Mn=Is.filter(function(Us){return Us!==Xi}):Mn=[].concat((0,te.Z)(Is),[Xi]):Mn=[Xi],Js(Mn);var Bs=(0,Ie.Z)((0,Ie.Z)({},Ui),{},{selectedKeys:Mn});Fn?oi==null||oi(Bs):Si==null||Si(Bs)}!xi&&tn.length&&On!=="inline"&&Rn(Wi)},Jr=He(function(rn){en==null||en(Je(rn)),yr(rn)}),Er=He(function(rn,Ui){var Xi=tn.filter(function(Mn){return Mn!==rn});if(Ui)Xi.push(rn);else if(On!=="inline"){var Fn=pr(rn);Xi=Xi.filter(function(Mn){return!Fn.has(Mn)})}(0,x.Z)(tn,Xi,!0)||Rn(Xi,!0)}),ea=function(Ui,Xi){var Fn=Xi!=null?Xi:!tn.includes(Ui);Er(Ui,Fn)},ta=ze(On,bs,$n,pn,Ii,Zn,Xr,Xs,ea,An);_.useEffect(function(){Wn(!0)},[]);var br=_.useMemo(function(){return{_internalRenderMenuItem:_i,_internalRenderSubMenuItem:Gt}},[_i,Gt]),xr=On!=="horizontal"||li?on:on.map(function(rn,Ui){return _.createElement(q,{key:rn.key,overflowDisabled:Ui>es},rn)}),er=_.createElement(l.Z,(0,V.Z)({id:ai,ref:Ii,prefixCls:"".concat(ut,"-overflow"),component:"ul",itemComponent:oe,className:J()(ut,"".concat(ut,"-root"),"".concat(ut,"-").concat(On),ti,(0,de.Z)((0,de.Z)({},"".concat(ut,"-inline-collapsed"),Hr),"".concat(ut,"-rtl"),$n),mt),dir:Qt,style:Et,role:"menu",tabIndex:Li,data:xr,renderRawItem:function(Ui){return Ui},renderRawRest:function(Ui){var Xi=Ui.length,Fn=Xi?on.slice(-Xi):null;return _.createElement(ki,{eventKey:Te,title:fn,disabled:Ms,internalPopupClose:Xi===0,popupClassName:yn},Fn)},maxCount:On!=="horizontal"||li?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Ui){Yr(Ui)},onKeyDown:ta},Pi));return _.createElement($.Provider,{value:br},_.createElement(T.Provider,{value:pn},_.createElement(q,{prefixCls:ut,rootClassName:mt,mode:On,openKeys:tn,rtl:$n,disabled:pi,motion:qn?Yi:null,defaultMotions:qn?wn:null,activeKey:bs,onActive:qs,onInactive:_r,selectedKeys:Is,inlineIndent:Tn,subMenuOpenDelay:Ri,subMenuCloseDelay:bi,forceSubMenuRender:ji,builtinPlacements:Un,triggerSubMenuAction:an,getPopupContainer:Ln,itemIcon:Sn,expandIcon:bn,onItemClick:Jr,onOpenChange:Er},_.createElement(Ee.Provider,{value:gr},er),_.createElement("div",{style:{display:"none"},"aria-hidden":!0},_.createElement(le.Provider,{value:qr},ln)))))}),kn=nn,Ht=kn;Ht.Item=oe,Ht.SubMenu=ki,Ht.ItemGroup=Hi,Ht.Divider=wi;var Ct=Ht},11780:function(Ut,at,W){"use strict";W.d(at,{Z:function(){return G}});var V=W(54476),de=W(33885),Ie=W(42978),te=W(75931),M=W(59301),p=W(92310),ce=W.n(p),J=W(29301),l=W(34280),z=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],x=void 0;function m(g,v){var L=g.prefixCls,X=g.invalidate,Ae=g.item,Be=g.renderItem,ht=g.responsive,Ke=g.responsiveDisabled,yt=g.registerSize,ot=g.itemKey,je=g.className,zt=g.style,Ft=g.children,ci=g.display,pt=g.order,mi=g.component,we=mi===void 0?"div":mi,me=(0,te.Z)(g,z),ie=ht&&!ci;function ke(Se){yt(ot,Se)}M.useEffect(function(){return function(){ke(null)}},[]);var ze=Be&&Ae!==x?Be(Ae,{index:pt}):Ft,Qe;X||(Qe={opacity:ie?0:1,height:ie?0:x,overflowY:ie?"hidden":x,order:ht?pt:x,pointerEvents:ie?"none":x,position:ie?"absolute":x});var K={};ie&&(K["aria-hidden"]=!0);var ne=M.createElement(we,(0,V.Z)({className:ce()(!X&&L,je),style:(0,de.Z)((0,de.Z)({},Qe),zt)},K,me,{ref:v}),ze);return ht&&(ne=M.createElement(J.Z,{onResize:function(Te){var Ne=Te.offsetWidth;ke(Ne)},disabled:Ke},ne)),ne}var _=M.forwardRef(m);_.displayName="Item";var b=_,T=W(6089),F=W(4676),C=W(16089);function P(g){if(typeof MessageChannel=="undefined")(0,C.Z)(g);else{var v=new MessageChannel;v.port1.onmessage=function(){return g()},v.port2.postMessage(void 0)}}function w(){var g=M.useRef(null),v=function(X){g.current||(g.current=[],P(function(){(0,F.unstable_batchedUpdates)(function(){g.current.forEach(function(Ae){Ae()}),g.current=null})})),g.current.push(X)};return v}function I(g,v){var L=M.useState(v),X=(0,Ie.Z)(L,2),Ae=X[0],Be=X[1],ht=(0,T.Z)(function(Ke){g(function(){Be(Ke)})});return[Ae,ht]}var N=M.createContext(null),q=["component"],re=["className"],le=["className"],H=function(v,L){var X=M.useContext(N);if(!X){var Ae=v.component,Be=Ae===void 0?"div":Ae,ht=(0,te.Z)(v,q);return M.createElement(Be,(0,V.Z)({},ht,{ref:L}))}var Ke=X.className,yt=(0,te.Z)(X,re),ot=v.className,je=(0,te.Z)(v,le);return M.createElement(N.Provider,{value:null},M.createElement(b,(0,V.Z)({ref:L,className:ce()(Ke,ot)},yt,je)))},ye=M.forwardRef(H);ye.displayName="RawItem";var be=ye,Ee=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],We="responsive",$="invalidate";function D(g){return"+ ".concat(g.length," ...")}function O(g,v){var L=g.prefixCls,X=L===void 0?"rc-overflow":L,Ae=g.data,Be=Ae===void 0?[]:Ae,ht=g.renderItem,Ke=g.renderRawItem,yt=g.itemKey,ot=g.itemWidth,je=ot===void 0?10:ot,zt=g.ssr,Ft=g.style,ci=g.className,pt=g.maxCount,mi=g.renderRest,we=g.renderRawRest,me=g.suffix,ie=g.component,ke=ie===void 0?"div":ie,ze=g.itemComponent,Qe=g.onVisibleChange,K=(0,te.Z)(g,Ee),ne=zt==="full",Se=w(),Te=I(Se,null),Ne=(0,Ie.Z)(Te,2),He=Ne[0],bt=Ne[1],Xe=He||0,lt=I(Se,new Map),qe=(0,Ie.Z)(lt,2),_t=qe[0],ct=qe[1],he=I(Se,0),_e=(0,Ie.Z)(he,2),Me=_e[0],$e=_e[1],Pe=I(Se,0),st=(0,Ie.Z)(Pe,2),nt=st[0],Je=st[1],ft=I(Se,0),At=(0,Ie.Z)(ft,2),Ze=At[0],dt=At[1],fe=(0,M.useState)(null),ae=(0,Ie.Z)(fe,2),oe=ae[0],R=ae[1],k=(0,M.useState)(null),Z=(0,Ie.Z)(k,2),ee=Z[0],se=Z[1],Ue=M.useMemo(function(){return ee===null&&ne?Number.MAX_SAFE_INTEGER:ee||0},[ee,He]),Ge=(0,M.useState)(!1),tt=(0,Ie.Z)(Ge,2),gt=tt[0],wt=tt[1],$t="".concat(X,"-item"),Dt=Math.max(Me,nt),rt=pt===We,Lt=Be.length&&rt,Jt=pt===$,Xt=Lt||typeof pt=="number"&&Be.length>pt,ri=(0,M.useMemo)(function(){var Ht=Be;return Lt?He===null&&ne?Ht=Be:Ht=Be.slice(0,Math.min(Be.length,Xe/je)):typeof pt=="number"&&(Ht=Be.slice(0,pt)),Ht},[Be,je,He,pt,Lt]),Vt=(0,M.useMemo)(function(){return Lt?Be.slice(Ue+1):Be.slice(ri.length)},[Be,ri,Lt,Ue]),jt=(0,M.useCallback)(function(Ht,Ct){var pe;return typeof yt=="function"?yt(Ht):(pe=yt&&(Ht==null?void 0:Ht[yt]))!==null&&pe!==void 0?pe:Ct},[yt]),Fi=(0,M.useCallback)(ht||function(Ht){return Ht},[ht]);function ki(Ht,Ct,pe){ee===Ht&&(Ct===void 0||Ct===oe)||(se(Ht),pe||(wt(Ht<Be.length-1),Qe==null||Qe(Ht)),Ct!==void 0&&R(Ct))}function qi(Ht,Ct){bt(Ct.clientWidth)}function wi(Ht,Ct){ct(function(pe){var De=new Map(pe);return Ct===null?De.delete(Ht):De.set(Ht,Ct),De})}function _n(Ht,Ct){Je(Ct),$e(nt)}function hi(Ht,Ct){dt(Ct)}function Di(Ht){return _t.get(jt(ri[Ht],Ht))}(0,l.Z)(function(){if(Xe&&typeof Dt=="number"&&ri){var Ht=Ze,Ct=ri.length,pe=Ct-1;if(!Ct){ki(0,null);return}for(var De=0;De<Ct;De+=1){var Ve=Di(De);if(ne&&(Ve=Ve||0),Ve===void 0){ki(De-1,void 0,!0);break}if(Ht+=Ve,pe===0&&Ht<=Xe||De===pe-1&&Ht+Di(pe)<=Xe){ki(pe,null);break}else if(Ht+Dt>Xe){ki(De-1,Ht-Ve-Ze+nt);break}}me&&Di(0)+Ze>Xe&&R(null)}},[Xe,_t,nt,Ze,jt,ri]);var Hi=gt&&!!Vt.length,ii={};oe!==null&&Lt&&(ii={position:"absolute",left:oe,top:0});var Vi={prefixCls:$t,responsive:Lt,component:ze,invalidate:Jt},Ai=Ke?function(Ht,Ct){var pe=jt(Ht,Ct);return M.createElement(N.Provider,{key:pe,value:(0,de.Z)((0,de.Z)({},Vi),{},{order:Ct,item:Ht,itemKey:pe,registerSize:wi,display:Ct<=Ue})},Ke(Ht,Ct))}:function(Ht,Ct){var pe=jt(Ht,Ct);return M.createElement(b,(0,V.Z)({},Vi,{order:Ct,key:pe,item:Ht,renderItem:Fi,itemKey:pe,registerSize:wi,display:Ct<=Ue}))},un={order:Hi?Ue:Number.MAX_SAFE_INTEGER,className:"".concat($t,"-rest"),registerSize:_n,display:Hi},Wi=mi||D,nn=we?M.createElement(N.Provider,{value:(0,de.Z)((0,de.Z)({},Vi),un)},we(Vt)):M.createElement(b,(0,V.Z)({},Vi,un),typeof Wi=="function"?Wi(Vt):Wi),kn=M.createElement(ke,(0,V.Z)({className:ce()(!Jt&&X,ci),style:Ft,ref:v},K),ri.map(Ai),Xt?nn:null,me&&M.createElement(b,(0,V.Z)({},Vi,{responsive:rt,responsiveDisabled:!Lt,order:Ue,className:"".concat($t,"-suffix"),registerSize:hi,display:!0,style:ii}),me));return rt?M.createElement(J.Z,{onResize:qi,disabled:!Lt},kn):kn}var B=M.forwardRef(O);B.displayName="Overflow",B.Item=be,B.RESPONSIVE=We,B.INVALIDATE=$;var Q=B,G=Q},29301:function(Ut,at,W){"use strict";W.d(at,{Z:function(){return $}});var V=W(54476),de=W(59301),Ie=W(11592),te=W(48736),M=W(33885),p=W(76190),ce=W(76846),J=W(8654),l=de.createContext(null);function z(D){var O=D.children,B=D.onBatchResize,Q=de.useRef(0),G=de.useRef([]),g=de.useContext(l),v=de.useCallback(function(L,X,Ae){Q.current+=1;var Be=Q.current;G.current.push({size:L,element:X,data:Ae}),Promise.resolve().then(function(){Be===Q.current&&(B==null||B(G.current),G.current=[])}),g==null||g(L,X,Ae)},[B,g]);return de.createElement(l.Provider,{value:v},O)}var x=W(76374),m=new Map;function _(D){D.forEach(function(O){var B,Q=O.target;(B=m.get(Q))===null||B===void 0||B.forEach(function(G){return G(Q)})})}var b=new x.Z(_),T=null,F=null;function C(D,O){m.has(D)||(m.set(D,new Set),b.observe(D)),m.get(D).add(O)}function P(D,O){m.has(D)&&(m.get(D).delete(O),m.get(D).size||(b.unobserve(D),m.delete(D)))}var w=W(67732),I=W(83652),N=W(42403),q=W(158),re=function(D){(0,N.Z)(B,D);var O=(0,q.Z)(B);function B(){return(0,w.Z)(this,B),O.apply(this,arguments)}return(0,I.Z)(B,[{key:"render",value:function(){return this.props.children}}]),B}(de.Component);function le(D,O){var B=D.children,Q=D.disabled,G=de.useRef(null),g=de.useRef(null),v=de.useContext(l),L=typeof B=="function",X=L?B(G):B,Ae=de.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Be=!L&&de.isValidElement(X)&&(0,J.Yr)(X),ht=Be?(0,J.C4)(X):null,Ke=(0,J.x1)(ht,G),yt=function(){var Ft;return(0,ce.ZP)(G.current)||(G.current&&(0,p.Z)(G.current)==="object"?(0,ce.ZP)((Ft=G.current)===null||Ft===void 0?void 0:Ft.nativeElement):null)||(0,ce.ZP)(g.current)};de.useImperativeHandle(O,function(){return yt()});var ot=de.useRef(D);ot.current=D;var je=de.useCallback(function(zt){var Ft=ot.current,ci=Ft.onResize,pt=Ft.data,mi=zt.getBoundingClientRect(),we=mi.width,me=mi.height,ie=zt.offsetWidth,ke=zt.offsetHeight,ze=Math.floor(we),Qe=Math.floor(me);if(Ae.current.width!==ze||Ae.current.height!==Qe||Ae.current.offsetWidth!==ie||Ae.current.offsetHeight!==ke){var K={width:ze,height:Qe,offsetWidth:ie,offsetHeight:ke};Ae.current=K;var ne=ie===Math.round(we)?we:ie,Se=ke===Math.round(me)?me:ke,Te=(0,M.Z)((0,M.Z)({},K),{},{offsetWidth:ne,offsetHeight:Se});v==null||v(Te,zt,pt),ci&&Promise.resolve().then(function(){ci(Te,zt)})}},[]);return de.useEffect(function(){var zt=yt();return zt&&!Q&&C(zt,je),function(){return P(zt,je)}},[G.current,Q]),de.createElement(re,{ref:g},Be?de.cloneElement(X,{ref:Ke}):X)}var H=de.forwardRef(le),ye=H,be="rc-observer-key";function Ee(D,O){var B=D.children,Q=typeof B=="function"?[B]:(0,Ie.Z)(B);return Q.map(function(G,g){var v=(G==null?void 0:G.key)||"".concat(be,"-").concat(g);return de.createElement(ye,(0,V.Z)({},D,{key:v,ref:g===0?O:void 0}),G)})}var We=de.forwardRef(Ee);We.Collection=z;var $=We},29443:function(Ut,at,W){"use strict";W.d(at,{Z:function(){return ct}});var V=W(54476),de=W(20068),Ie=W(33885),te=W(42978),M=W(76190),p=W(75931),ce=W(92310),J=W.n(ce),l=W(18929),z=W(49658),x=W(59301),m=(0,x.createContext)(null),_=W(94480),b=W(29301),T=W(6089),F=W(8654),C=W(16089),P=function(_e){var Me=_e.activeTabOffset,$e=_e.horizontal,Pe=_e.rtl,st=_e.indicator,nt=st===void 0?{}:st,Je=nt.size,ft=nt.align,At=ft===void 0?"center":ft,Ze=(0,x.useState)(),dt=(0,te.Z)(Ze,2),fe=dt[0],ae=dt[1],oe=(0,x.useRef)(),R=x.useCallback(function(Z){return typeof Je=="function"?Je(Z):typeof Je=="number"?Je:Z},[Je]);function k(){C.Z.cancel(oe.current)}return(0,x.useEffect)(function(){var Z={};if(Me)if($e){Z.width=R(Me.width);var ee=Pe?"right":"left";At==="start"&&(Z[ee]=Me[ee]),At==="center"&&(Z[ee]=Me[ee]+Me.width/2,Z.transform=Pe?"translateX(50%)":"translateX(-50%)"),At==="end"&&(Z[ee]=Me[ee]+Me.width,Z.transform="translateX(-100%)")}else Z.height=R(Me.height),At==="start"&&(Z.top=Me.top),At==="center"&&(Z.top=Me.top+Me.height/2,Z.transform="translateY(-50%)"),At==="end"&&(Z.top=Me.top+Me.height,Z.transform="translateY(-100%)");return k(),oe.current=(0,C.Z)(function(){ae(Z)}),k},[Me,$e,Pe,At,R]),{style:fe}},w=P,I={width:0,height:0,left:0,top:0};function N(he,_e,Me){return(0,x.useMemo)(function(){for(var $e,Pe=new Map,st=_e.get(($e=he[0])===null||$e===void 0?void 0:$e.key)||I,nt=st.left+st.width,Je=0;Je<he.length;Je+=1){var ft=he[Je].key,At=_e.get(ft);if(!At){var Ze;At=_e.get((Ze=he[Je-1])===null||Ze===void 0?void 0:Ze.key)||I}var dt=Pe.get(ft)||(0,Ie.Z)({},At);dt.right=nt-dt.left-dt.width,Pe.set(ft,dt)}return Pe},[he.map(function($e){return $e.key}).join("_"),_e,Me])}function q(he,_e){var Me=x.useRef(he),$e=x.useState({}),Pe=(0,te.Z)($e,2),st=Pe[1];function nt(Je){var ft=typeof Je=="function"?Je(Me.current):Je;ft!==Me.current&&_e(ft,Me.current),Me.current=ft,st({})}return[Me.current,nt]}var re=.1,le=.01,H=20,ye=Math.pow(.995,H);function be(he,_e){var Me=(0,x.useState)(),$e=(0,te.Z)(Me,2),Pe=$e[0],st=$e[1],nt=(0,x.useState)(0),Je=(0,te.Z)(nt,2),ft=Je[0],At=Je[1],Ze=(0,x.useState)(0),dt=(0,te.Z)(Ze,2),fe=dt[0],ae=dt[1],oe=(0,x.useState)(),R=(0,te.Z)(oe,2),k=R[0],Z=R[1],ee=(0,x.useRef)();function se($t){var Dt=$t.touches[0],rt=Dt.screenX,Lt=Dt.screenY;st({x:rt,y:Lt}),window.clearInterval(ee.current)}function Ue($t){if(Pe){var Dt=$t.touches[0],rt=Dt.screenX,Lt=Dt.screenY;st({x:rt,y:Lt});var Jt=rt-Pe.x,Xt=Lt-Pe.y;_e(Jt,Xt);var ri=Date.now();At(ri),ae(ri-ft),Z({x:Jt,y:Xt})}}function Ge(){if(Pe&&(st(null),Z(null),k)){var $t=k.x/fe,Dt=k.y/fe,rt=Math.abs($t),Lt=Math.abs(Dt);if(Math.max(rt,Lt)<re)return;var Jt=$t,Xt=Dt;ee.current=window.setInterval(function(){if(Math.abs(Jt)<le&&Math.abs(Xt)<le){window.clearInterval(ee.current);return}Jt*=ye,Xt*=ye,_e(Jt*H,Xt*H)},H)}}var tt=(0,x.useRef)();function gt($t){var Dt=$t.deltaX,rt=$t.deltaY,Lt=0,Jt=Math.abs(Dt),Xt=Math.abs(rt);Jt===Xt?Lt=tt.current==="x"?Dt:rt:Jt>Xt?(Lt=Dt,tt.current="x"):(Lt=rt,tt.current="y"),_e(-Lt,-Lt)&&$t.preventDefault()}var wt=(0,x.useRef)(null);wt.current={onTouchStart:se,onTouchMove:Ue,onTouchEnd:Ge,onWheel:gt},x.useEffect(function(){function $t(Jt){wt.current.onTouchStart(Jt)}function Dt(Jt){wt.current.onTouchMove(Jt)}function rt(Jt){wt.current.onTouchEnd(Jt)}function Lt(Jt){wt.current.onWheel(Jt)}return document.addEventListener("touchmove",Dt,{passive:!1}),document.addEventListener("touchend",rt,{passive:!0}),he.current.addEventListener("touchstart",$t,{passive:!0}),he.current.addEventListener("wheel",Lt,{passive:!1}),function(){document.removeEventListener("touchmove",Dt),document.removeEventListener("touchend",rt)}},[])}var Ee=W(34280);function We(he){var _e=(0,x.useState)(0),Me=(0,te.Z)(_e,2),$e=Me[0],Pe=Me[1],st=(0,x.useRef)(0),nt=(0,x.useRef)();return nt.current=he,(0,Ee.o)(function(){var Je;(Je=nt.current)===null||Je===void 0||Je.call(nt)},[$e]),function(){st.current===$e&&(st.current+=1,Pe(st.current))}}function $(he){var _e=(0,x.useRef)([]),Me=(0,x.useState)({}),$e=(0,te.Z)(Me,2),Pe=$e[1],st=(0,x.useRef)(typeof he=="function"?he():he),nt=We(function(){var ft=st.current;_e.current.forEach(function(At){ft=At(ft)}),_e.current=[],st.current=ft,Pe({})});function Je(ft){_e.current.push(ft),nt()}return[st.current,Je]}var D={width:0,height:0,left:0,top:0,right:0};function O(he,_e,Me,$e,Pe,st,nt){var Je=nt.tabs,ft=nt.tabPosition,At=nt.rtl,Ze,dt,fe;return["top","bottom"].includes(ft)?(Ze="width",dt=At?"right":"left",fe=Math.abs(Me)):(Ze="height",dt="top",fe=-Me),(0,x.useMemo)(function(){if(!Je.length)return[0,0];for(var ae=Je.length,oe=ae,R=0;R<ae;R+=1){var k=he.get(Je[R].key)||D;if(Math.floor(k[dt]+k[Ze])>Math.floor(fe+_e)){oe=R-1;break}}for(var Z=0,ee=ae-1;ee>=0;ee-=1){var se=he.get(Je[ee].key)||D;if(se[dt]<fe){Z=ee+1;break}}return Z>=oe?[0,0]:[Z,oe]},[he,_e,$e,Pe,st,fe,ft,Je.map(function(ae){return ae.key}).join("_"),At])}function B(he){var _e;return he instanceof Map?(_e={},he.forEach(function(Me,$e){_e[$e]=Me})):_e=he,JSON.stringify(_e)}var Q="TABS_DQ";function G(he){return String(he).replace(/"/g,Q)}function g(he,_e,Me,$e){return!(!Me||$e||he===!1||he===void 0&&(_e===!1||_e===null))}var v=x.forwardRef(function(he,_e){var Me=he.prefixCls,$e=he.editable,Pe=he.locale,st=he.style;return!$e||$e.showAdd===!1?null:x.createElement("button",{ref:_e,type:"button",className:"".concat(Me,"-nav-add"),style:st,"aria-label":(Pe==null?void 0:Pe.addAriaLabel)||"Add tab",onClick:function(Je){$e.onEdit("add",{event:Je})}},$e.addIcon||"+")}),L=v,X=x.forwardRef(function(he,_e){var Me=he.position,$e=he.prefixCls,Pe=he.extra;if(!Pe)return null;var st,nt={};return(0,M.Z)(Pe)==="object"&&!x.isValidElement(Pe)?nt=Pe:nt.right=Pe,Me==="right"&&(st=nt.right),Me==="left"&&(st=nt.left),st?x.createElement("div",{className:"".concat($e,"-extra-content"),ref:_e},st):null}),Ae=X,Be=W(96478),ht=W(28321),Ke=W(10228),yt=x.forwardRef(function(he,_e){var Me=he.prefixCls,$e=he.id,Pe=he.tabs,st=he.locale,nt=he.mobile,Je=he.more,ft=Je===void 0?{}:Je,At=he.style,Ze=he.className,dt=he.editable,fe=he.tabBarGutter,ae=he.rtl,oe=he.removeAriaLabel,R=he.onTabClick,k=he.getPopupContainer,Z=he.popupClassName,ee=(0,x.useState)(!1),se=(0,te.Z)(ee,2),Ue=se[0],Ge=se[1],tt=(0,x.useState)(null),gt=(0,te.Z)(tt,2),wt=gt[0],$t=gt[1],Dt=ft.icon,rt=Dt===void 0?"More":Dt,Lt="".concat($e,"-more-popup"),Jt="".concat(Me,"-dropdown"),Xt=wt!==null?"".concat(Lt,"-").concat(wt):null,ri=st==null?void 0:st.dropdownAriaLabel;function Vt(hi,Di){hi.preventDefault(),hi.stopPropagation(),dt.onEdit("remove",{key:Di,event:hi})}var jt=x.createElement(ht.ZP,{onClick:function(Di){var Hi=Di.key,ii=Di.domEvent;R(Hi,ii),Ge(!1)},prefixCls:"".concat(Jt,"-menu"),id:Lt,tabIndex:-1,role:"listbox","aria-activedescendant":Xt,selectedKeys:[wt],"aria-label":ri!==void 0?ri:"expanded dropdown"},Pe.map(function(hi){var Di=hi.closable,Hi=hi.disabled,ii=hi.closeIcon,Vi=hi.key,Ai=hi.label,un=g(Di,ii,dt,Hi);return x.createElement(ht.sN,{key:Vi,id:"".concat(Lt,"-").concat(Vi),role:"option","aria-controls":$e&&"".concat($e,"-panel-").concat(Vi),disabled:Hi},x.createElement("span",null,Ai),un&&x.createElement("button",{type:"button","aria-label":oe||"remove",tabIndex:0,className:"".concat(Jt,"-menu-item-remove"),onClick:function(nn){nn.stopPropagation(),Vt(nn,Vi)}},ii||dt.removeIcon||"\xD7"))}));function Fi(hi){for(var Di=Pe.filter(function(un){return!un.disabled}),Hi=Di.findIndex(function(un){return un.key===wt})||0,ii=Di.length,Vi=0;Vi<ii;Vi+=1){Hi=(Hi+hi+ii)%ii;var Ai=Di[Hi];if(!Ai.disabled){$t(Ai.key);return}}}function ki(hi){var Di=hi.which;if(!Ue){[Ke.Z.DOWN,Ke.Z.SPACE,Ke.Z.ENTER].includes(Di)&&(Ge(!0),hi.preventDefault());return}switch(Di){case Ke.Z.UP:Fi(-1),hi.preventDefault();break;case Ke.Z.DOWN:Fi(1),hi.preventDefault();break;case Ke.Z.ESC:Ge(!1);break;case Ke.Z.SPACE:case Ke.Z.ENTER:wt!==null&&R(wt,hi);break}}(0,x.useEffect)(function(){var hi=document.getElementById(Xt);hi&&hi.scrollIntoView&&hi.scrollIntoView(!1)},[wt]),(0,x.useEffect)(function(){Ue||$t(null)},[Ue]);var qi=(0,de.Z)({},ae?"marginRight":"marginLeft",fe);Pe.length||(qi.visibility="hidden",qi.order=1);var wi=J()((0,de.Z)({},"".concat(Jt,"-rtl"),ae)),_n=nt?null:x.createElement(Be.Z,(0,V.Z)({prefixCls:Jt,overlay:jt,visible:Pe.length?Ue:!1,onVisibleChange:Ge,overlayClassName:J()(wi,Z),mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:k},ft),x.createElement("button",{type:"button",className:"".concat(Me,"-nav-more"),style:qi,"aria-haspopup":"listbox","aria-controls":Lt,id:"".concat($e,"-more"),"aria-expanded":Ue,onKeyDown:ki},rt));return x.createElement("div",{className:J()("".concat(Me,"-nav-operations"),Ze),style:At,ref:_e},_n,x.createElement(L,{prefixCls:Me,locale:st,editable:dt}))}),ot=x.memo(yt,function(he,_e){return _e.tabMoving}),je=function(_e){var Me=_e.prefixCls,$e=_e.id,Pe=_e.active,st=_e.focus,nt=_e.tab,Je=nt.key,ft=nt.label,At=nt.disabled,Ze=nt.closeIcon,dt=nt.icon,fe=_e.closable,ae=_e.renderWrapper,oe=_e.removeAriaLabel,R=_e.editable,k=_e.onClick,Z=_e.onFocus,ee=_e.onBlur,se=_e.onKeyDown,Ue=_e.onMouseDown,Ge=_e.onMouseUp,tt=_e.style,gt=_e.tabCount,wt=_e.currentPosition,$t="".concat(Me,"-tab"),Dt=g(fe,Ze,R,At);function rt(Vt){At||k(Vt)}function Lt(Vt){Vt.preventDefault(),Vt.stopPropagation(),R.onEdit("remove",{key:Je,event:Vt})}var Jt=x.useMemo(function(){return dt&&typeof ft=="string"?x.createElement("span",null,ft):ft},[ft,dt]),Xt=x.useRef(null);x.useEffect(function(){st&&Xt.current&&Xt.current.focus()},[st]);var ri=x.createElement("div",{key:Je,"data-node-key":G(Je),className:J()($t,(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},"".concat($t,"-with-remove"),Dt),"".concat($t,"-active"),Pe),"".concat($t,"-disabled"),At),"".concat($t,"-focus"),st)),style:tt,onClick:rt},x.createElement("div",{ref:Xt,role:"tab","aria-selected":Pe,id:$e&&"".concat($e,"-tab-").concat(Je),className:"".concat($t,"-btn"),"aria-controls":$e&&"".concat($e,"-panel-").concat(Je),"aria-disabled":At,tabIndex:At?null:Pe?0:-1,onClick:function(jt){jt.stopPropagation(),rt(jt)},onKeyDown:se,onMouseDown:Ue,onMouseUp:Ge,onFocus:Z,onBlur:ee},st&&x.createElement("div",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"Tab ".concat(wt," of ").concat(gt)),dt&&x.createElement("span",{className:"".concat($t,"-icon")},dt),ft&&Jt),Dt&&x.createElement("button",{type:"button",role:"tab","aria-label":oe||"remove",tabIndex:Pe?0:-1,className:"".concat($t,"-remove"),onClick:function(jt){jt.stopPropagation(),Lt(jt)}},Ze||R.removeIcon||"\xD7"));return ae?ae(ri):ri},zt=je,Ft=function(_e,Me){var $e=_e.offsetWidth,Pe=_e.offsetHeight,st=_e.offsetTop,nt=_e.offsetLeft,Je=_e.getBoundingClientRect(),ft=Je.width,At=Je.height,Ze=Je.left,dt=Je.top;return Math.abs(ft-$e)<1?[ft,At,Ze-Me.left,dt-Me.top]:[$e,Pe,nt,st]},ci=function(_e){var Me=_e.current||{},$e=Me.offsetWidth,Pe=$e===void 0?0:$e,st=Me.offsetHeight,nt=st===void 0?0:st;if(_e.current){var Je=_e.current.getBoundingClientRect(),ft=Je.width,At=Je.height;if(Math.abs(ft-Pe)<1)return[ft,At]}return[Pe,nt]},pt=function(_e,Me){return _e[Me?0:1]},mi=x.forwardRef(function(he,_e){var Me=he.className,$e=he.style,Pe=he.id,st=he.animated,nt=he.activeKey,Je=he.rtl,ft=he.extra,At=he.editable,Ze=he.locale,dt=he.tabPosition,fe=he.tabBarGutter,ae=he.children,oe=he.onTabClick,R=he.onTabScroll,k=he.indicator,Z=x.useContext(m),ee=Z.prefixCls,se=Z.tabs,Ue=(0,x.useRef)(null),Ge=(0,x.useRef)(null),tt=(0,x.useRef)(null),gt=(0,x.useRef)(null),wt=(0,x.useRef)(null),$t=(0,x.useRef)(null),Dt=(0,x.useRef)(null),rt=dt==="top"||dt==="bottom",Lt=q(0,function(_i,Gt){rt&&R&&R({direction:_i>Gt?"left":"right"})}),Jt=(0,te.Z)(Lt,2),Xt=Jt[0],ri=Jt[1],Vt=q(0,function(_i,Gt){!rt&&R&&R({direction:_i>Gt?"top":"bottom"})}),jt=(0,te.Z)(Vt,2),Fi=jt[0],ki=jt[1],qi=(0,x.useState)([0,0]),wi=(0,te.Z)(qi,2),_n=wi[0],hi=wi[1],Di=(0,x.useState)([0,0]),Hi=(0,te.Z)(Di,2),ii=Hi[0],Vi=Hi[1],Ai=(0,x.useState)([0,0]),un=(0,te.Z)(Ai,2),Wi=un[0],nn=un[1],kn=(0,x.useState)([0,0]),Ht=(0,te.Z)(kn,2),Ct=Ht[0],pe=Ht[1],De=$(new Map),Ve=(0,te.Z)(De,2),Oe=Ve[0],it=Ve[1],ut=N(se,Oe,ii[0]),mt=pt(_n,rt),Et=pt(ii,rt),ti=pt(Wi,rt),Zt=pt(Ct,rt),Li=Math.floor(mt)<Math.floor(Et+ti),kt=Li?mt-Zt:mt-ti,ei="".concat(ee,"-nav-operations-hidden"),Qt=0,ai=0;rt&&Je?(Qt=0,ai=Math.max(0,Et-kt)):(Qt=Math.min(0,kt-Et),ai=0);function di(_i){return _i<Qt?Qt:_i>ai?ai:_i}var Kt=(0,x.useRef)(null),qt=(0,x.useState)(),pi=(0,te.Z)(qt,2),li=pi[0],ni=pi[1];function Ri(){ni(Date.now())}function fi(){Kt.current&&clearTimeout(Kt.current)}be(gt,function(_i,Gt){function vi(Pi,Mt){Pi(function(sn){var on=di(sn+Mt);return on})}return Li?(rt?vi(ri,_i):vi(ki,Gt),fi(),Ri(),!0):!1}),(0,x.useEffect)(function(){return fi(),li&&(Kt.current=setTimeout(function(){ni(0)},100)),fi},[li]);var bi=O(ut,kt,rt?Xt:Fi,Et,ti,Zt,(0,Ie.Z)((0,Ie.Z)({},he),{},{tabs:se})),ji=(0,te.Z)(bi,2),Mi=ji[0],cn=ji[1],$i=(0,T.Z)(function(){var _i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nt,Gt=ut.get(_i)||{width:0,height:0,left:0,right:0,top:0};if(rt){var vi=Xt;Je?Gt.right<Xt?vi=Gt.right:Gt.right+Gt.width>Xt+kt&&(vi=Gt.right+Gt.width-kt):Gt.left<-Xt?vi=-Gt.left:Gt.left+Gt.width>-Xt+kt&&(vi=-(Gt.left+Gt.width-kt)),ki(0),ri(di(vi))}else{var Pi=Fi;Gt.top<-Fi?Pi=-Gt.top:Gt.top+Gt.height>-Fi+kt&&(Pi=-(Gt.top+Gt.height-kt)),ri(0),ki(di(Pi))}}),Zi=(0,x.useState)(),Ji=(0,te.Z)(Zi,2),zi=Ji[0],Ki=Ji[1],xi=(0,x.useState)(!1),yi=(0,te.Z)(xi,2),En=yi[0],Si=yi[1],oi=se.filter(function(_i){return!_i.disabled}).map(function(_i){return _i.key}),vn=function(Gt){var vi=oi.indexOf(zi||nt),Pi=oi.length,Mt=(vi+Gt+Pi)%Pi,sn=oi[Mt];Ki(sn)},Tn=function(Gt){var vi=Gt.code,Pi=Je&&rt,Mt=oi[0],sn=oi[oi.length-1];switch(vi){case"ArrowLeft":{rt&&vn(Pi?1:-1);break}case"ArrowRight":{rt&&vn(Pi?-1:1);break}case"ArrowUp":{Gt.preventDefault(),rt||vn(-1);break}case"ArrowDown":{Gt.preventDefault(),rt||vn(1);break}case"Home":{Gt.preventDefault(),Ki(Mt);break}case"End":{Gt.preventDefault(),Ki(sn);break}case"Enter":case"Space":{Gt.preventDefault(),oe(nt,Gt);break}case"Backspace":case"Delete":{var on=oi.indexOf(zi),ln=se.find(function(Dn){return Dn.key===zi}),Vn=g(ln==null?void 0:ln.closable,ln==null?void 0:ln.closeIcon,At,ln==null?void 0:ln.disabled);Vn&&(Gt.preventDefault(),Gt.stopPropagation(),At.onEdit("remove",{key:zi,event:Gt}),on===oi.length-1?vn(-1):vn(1));break}}},Yi={};rt?Yi[Je?"marginRight":"marginLeft"]=fe:Yi.marginTop=fe;var wn=se.map(function(_i,Gt){var vi=_i.key;return x.createElement(zt,{id:Pe,prefixCls:ee,key:vi,tab:_i,style:Gt===0?void 0:Yi,closable:_i.closable,editable:At,active:vi===nt,focus:vi===zi,renderWrapper:ae,removeAriaLabel:Ze==null?void 0:Ze.removeAriaLabel,tabCount:oi.length,currentPosition:Gt+1,onClick:function(Mt){oe(vi,Mt)},onKeyDown:Tn,onFocus:function(){En||Ki(vi),$i(vi),Ri(),gt.current&&(Je||(gt.current.scrollLeft=0),gt.current.scrollTop=0)},onBlur:function(){Ki(void 0)},onMouseDown:function(){Si(!0)},onMouseUp:function(){Si(!1)}})}),Bi=function(){return it(function(){var Gt,vi=new Map,Pi=(Gt=wt.current)===null||Gt===void 0?void 0:Gt.getBoundingClientRect();return se.forEach(function(Mt){var sn,on=Mt.key,ln=(sn=wt.current)===null||sn===void 0?void 0:sn.querySelector('[data-node-key="'.concat(G(on),'"]'));if(ln){var Vn=Ft(ln,Pi),Dn=(0,te.Z)(Vn,4),qn=Dn[0],Wn=Dn[1],Ii=Dn[2],pn=Dn[3];vi.set(on,{width:qn,height:Wn,left:Ii,top:pn})}}),vi})};(0,x.useEffect)(function(){Bi()},[se.map(function(_i){return _i.key}).join("_")]);var an=We(function(){var _i=ci(Ue),Gt=ci(Ge),vi=ci(tt);hi([_i[0]-Gt[0]-vi[0],_i[1]-Gt[1]-vi[1]]);var Pi=ci(Dt);nn(Pi);var Mt=ci($t);pe(Mt);var sn=ci(wt);Vi([sn[0]-Pi[0],sn[1]-Pi[1]]),Bi()}),Un=se.slice(0,Mi),Sn=se.slice(cn+1),bn=[].concat((0,_.Z)(Un),(0,_.Z)(Sn)),Qi=ut.get(nt),fn=w({activeTabOffset:Qi,horizontal:rt,indicator:k,rtl:Je}),yn=fn.style;(0,x.useEffect)(function(){$i()},[nt,Qt,ai,B(Qi),B(ut),rt]),(0,x.useEffect)(function(){an()},[Je]);var Ln=!!bn.length,en="".concat(ee,"-nav-wrap"),hn,An,Pn,dn;return rt?Je?(An=Xt>0,hn=Xt!==ai):(hn=Xt<0,An=Xt!==Qt):(Pn=Fi<0,dn=Fi!==Qt),x.createElement(b.Z,{onResize:an},x.createElement("div",{ref:(0,F.x1)(_e,Ue),role:"tablist","aria-orientation":rt?"horizontal":"vertical",className:J()("".concat(ee,"-nav"),Me),style:$e,onKeyDown:function(){Ri()}},x.createElement(Ae,{ref:Ge,position:"left",extra:ft,prefixCls:ee}),x.createElement(b.Z,{onResize:an},x.createElement("div",{className:J()(en,(0,de.Z)((0,de.Z)((0,de.Z)((0,de.Z)({},"".concat(en,"-ping-left"),hn),"".concat(en,"-ping-right"),An),"".concat(en,"-ping-top"),Pn),"".concat(en,"-ping-bottom"),dn)),ref:gt},x.createElement(b.Z,{onResize:an},x.createElement("div",{ref:wt,className:"".concat(ee,"-nav-list"),style:{transform:"translate(".concat(Xt,"px, ").concat(Fi,"px)"),transition:li?"none":void 0}},wn,x.createElement(L,{ref:Dt,prefixCls:ee,locale:Ze,editable:At,style:(0,Ie.Z)((0,Ie.Z)({},wn.length===0?void 0:Yi),{},{visibility:Ln?"hidden":null})}),x.createElement("div",{className:J()("".concat(ee,"-ink-bar"),(0,de.Z)({},"".concat(ee,"-ink-bar-animated"),st.inkBar)),style:yn}))))),x.createElement(ot,(0,V.Z)({},he,{removeAriaLabel:Ze==null?void 0:Ze.removeAriaLabel,ref:$t,prefixCls:ee,tabs:bn,className:!Ln&&ei,tabMoving:!!li})),x.createElement(Ae,{ref:tt,position:"right",extra:ft,prefixCls:ee})))}),we=mi,me=x.forwardRef(function(he,_e){var Me=he.prefixCls,$e=he.className,Pe=he.style,st=he.id,nt=he.active,Je=he.tabKey,ft=he.children;return x.createElement("div",{id:st&&"".concat(st,"-panel-").concat(Je),role:"tabpanel",tabIndex:nt?0:-1,"aria-labelledby":st&&"".concat(st,"-tab-").concat(Je),"aria-hidden":!nt,style:Pe,className:J()(Me,nt&&"".concat(Me,"-active"),$e),ref:_e},ft)}),ie=me,ke=["renderTabBar"],ze=["label","key"],Qe=function(_e){var Me=_e.renderTabBar,$e=(0,p.Z)(_e,ke),Pe=x.useContext(m),st=Pe.tabs;if(Me){var nt=(0,Ie.Z)((0,Ie.Z)({},$e),{},{panes:st.map(function(Je){var ft=Je.label,At=Je.key,Ze=(0,p.Z)(Je,ze);return x.createElement(ie,(0,V.Z)({tab:ft,key:At,tabKey:At},Ze))})});return Me(nt,we)}return x.createElement(we,$e)},K=Qe,ne=W(77900),Se=["key","forceRender","style","className","destroyInactiveTabPane"],Te=function(_e){var Me=_e.id,$e=_e.activeKey,Pe=_e.animated,st=_e.tabPosition,nt=_e.destroyInactiveTabPane,Je=x.useContext(m),ft=Je.prefixCls,At=Je.tabs,Ze=Pe.tabPane,dt="".concat(ft,"-tabpane");return x.createElement("div",{className:J()("".concat(ft,"-content-holder"))},x.createElement("div",{className:J()("".concat(ft,"-content"),"".concat(ft,"-content-").concat(st),(0,de.Z)({},"".concat(ft,"-content-animated"),Ze))},At.map(function(fe){var ae=fe.key,oe=fe.forceRender,R=fe.style,k=fe.className,Z=fe.destroyInactiveTabPane,ee=(0,p.Z)(fe,Se),se=ae===$e;return x.createElement(ne.default,(0,V.Z)({key:ae,visible:se,forceRender:oe,removeOnLeave:!!(nt||Z),leavedClassName:"".concat(dt,"-hidden")},Pe.tabPaneMotion),function(Ue,Ge){var tt=Ue.style,gt=Ue.className;return x.createElement(ie,(0,V.Z)({},ee,{prefixCls:dt,id:Me,tabKey:ae,animated:Ze,active:se,style:(0,Ie.Z)((0,Ie.Z)({},R),tt),className:J()(k,gt),ref:Ge}))})})))},Ne=Te,He=W(48736);function bt(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},_e;return he===!1?_e={inkBar:!1,tabPane:!1}:he===!0?_e={inkBar:!0,tabPane:!1}:_e=(0,Ie.Z)({inkBar:!0},(0,M.Z)(he)==="object"?he:{}),_e.tabPaneMotion&&_e.tabPane===void 0&&(_e.tabPane=!0),!_e.tabPaneMotion&&_e.tabPane&&(_e.tabPane=!1),_e}var Xe=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],lt=0,qe=x.forwardRef(function(he,_e){var Me=he.id,$e=he.prefixCls,Pe=$e===void 0?"rc-tabs":$e,st=he.className,nt=he.items,Je=he.direction,ft=he.activeKey,At=he.defaultActiveKey,Ze=he.editable,dt=he.animated,fe=he.tabPosition,ae=fe===void 0?"top":fe,oe=he.tabBarGutter,R=he.tabBarStyle,k=he.tabBarExtraContent,Z=he.locale,ee=he.more,se=he.destroyInactiveTabPane,Ue=he.renderTabBar,Ge=he.onChange,tt=he.onTabClick,gt=he.onTabScroll,wt=he.getPopupContainer,$t=he.popupClassName,Dt=he.indicator,rt=(0,p.Z)(he,Xe),Lt=x.useMemo(function(){return(nt||[]).filter(function(Ct){return Ct&&(0,M.Z)(Ct)==="object"&&"key"in Ct})},[nt]),Jt=Je==="rtl",Xt=bt(dt),ri=(0,x.useState)(!1),Vt=(0,te.Z)(ri,2),jt=Vt[0],Fi=Vt[1];(0,x.useEffect)(function(){Fi((0,z.Z)())},[]);var ki=(0,l.Z)(function(){var Ct;return(Ct=Lt[0])===null||Ct===void 0?void 0:Ct.key},{value:ft,defaultValue:At}),qi=(0,te.Z)(ki,2),wi=qi[0],_n=qi[1],hi=(0,x.useState)(function(){return Lt.findIndex(function(Ct){return Ct.key===wi})}),Di=(0,te.Z)(hi,2),Hi=Di[0],ii=Di[1];(0,x.useEffect)(function(){var Ct=Lt.findIndex(function(De){return De.key===wi});if(Ct===-1){var pe;Ct=Math.max(0,Math.min(Hi,Lt.length-1)),_n((pe=Lt[Ct])===null||pe===void 0?void 0:pe.key)}ii(Ct)},[Lt.map(function(Ct){return Ct.key}).join("_"),wi,Hi]);var Vi=(0,l.Z)(null,{value:Me}),Ai=(0,te.Z)(Vi,2),un=Ai[0],Wi=Ai[1];(0,x.useEffect)(function(){Me||(Wi("rc-tabs-".concat(lt)),lt+=1)},[]);function nn(Ct,pe){tt==null||tt(Ct,pe);var De=Ct!==wi;_n(Ct),De&&(Ge==null||Ge(Ct))}var kn={id:un,activeKey:wi,animated:Xt,tabPosition:ae,rtl:Jt,mobile:jt},Ht=(0,Ie.Z)((0,Ie.Z)({},kn),{},{editable:Ze,locale:Z,more:ee,tabBarGutter:oe,onTabClick:nn,onTabScroll:gt,extra:k,style:R,panes:null,getPopupContainer:wt,popupClassName:$t,indicator:Dt});return x.createElement(m.Provider,{value:{tabs:Lt,prefixCls:Pe}},x.createElement("div",(0,V.Z)({ref:_e,id:Me,className:J()(Pe,"".concat(Pe,"-").concat(ae),(0,de.Z)((0,de.Z)((0,de.Z)({},"".concat(Pe,"-mobile"),jt),"".concat(Pe,"-editable"),Ze),"".concat(Pe,"-rtl"),Jt),st)},rt),x.createElement(K,(0,V.Z)({},Ht,{renderTabBar:Ue})),x.createElement(Ne,(0,V.Z)({destroyInactiveTabPane:se},kn,{animated:Xt}))))}),_t=qe,ct=_t},29125:function(Ut,at,W){"use strict";W.d(at,{G:function(){return te},Z:function(){return P}});var V=W(92310),de=W.n(V),Ie=W(59301);function te(w){var I=w.children,N=w.prefixCls,q=w.id,re=w.overlayInnerStyle,le=w.bodyClassName,H=w.className,ye=w.style;return Ie.createElement("div",{className:de()("".concat(N,"-content"),H),style:ye},Ie.createElement("div",{className:de()("".concat(N,"-inner"),le),id:q,role:"tooltip",style:re},typeof I=="function"?I():I))}var M=W(54476),p=W(33885),ce=W(75931),J=W(65030),l={shiftX:64,adjustY:1},z={adjustX:1,shiftY:!0},x=[0,0],m={left:{points:["cr","cl"],overflow:z,offset:[-4,0],targetOffset:x},right:{points:["cl","cr"],overflow:z,offset:[4,0],targetOffset:x},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:x},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:x},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:x},leftTop:{points:["tr","tl"],overflow:z,offset:[-4,0],targetOffset:x},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:x},rightTop:{points:["tl","tr"],overflow:z,offset:[4,0],targetOffset:x},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:x},rightBottom:{points:["bl","br"],overflow:z,offset:[4,0],targetOffset:x},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:x},leftBottom:{points:["br","bl"],overflow:z,offset:[-4,0],targetOffset:x}},_=null,b=W(80402),T=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],F=function(I,N){var q=I.overlayClassName,re=I.trigger,le=re===void 0?["hover"]:re,H=I.mouseEnterDelay,ye=H===void 0?0:H,be=I.mouseLeaveDelay,Ee=be===void 0?.1:be,We=I.overlayStyle,$=I.prefixCls,D=$===void 0?"rc-tooltip":$,O=I.children,B=I.onVisibleChange,Q=I.afterVisibleChange,G=I.transitionName,g=I.animation,v=I.motion,L=I.placement,X=L===void 0?"right":L,Ae=I.align,Be=Ae===void 0?{}:Ae,ht=I.destroyTooltipOnHide,Ke=ht===void 0?!1:ht,yt=I.defaultVisible,ot=I.getTooltipContainer,je=I.overlayInnerStyle,zt=I.arrowContent,Ft=I.overlay,ci=I.id,pt=I.showArrow,mi=pt===void 0?!0:pt,we=I.classNames,me=I.styles,ie=(0,ce.Z)(I,T),ke=(0,b.Z)(ci),ze=(0,Ie.useRef)(null);(0,Ie.useImperativeHandle)(N,function(){return ze.current});var Qe=(0,p.Z)({},ie);"visible"in I&&(Qe.popupVisible=I.visible);var K=function(){return Ie.createElement(te,{key:"content",prefixCls:D,id:ke,bodyClassName:we==null?void 0:we.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},je),me==null?void 0:me.body)},Ft)},ne=function(){var Te=Ie.Children.only(O),Ne=(Te==null?void 0:Te.props)||{},He=(0,p.Z)((0,p.Z)({},Ne),{},{"aria-describedby":Ft?ke:null});return Ie.cloneElement(O,He)};return Ie.createElement(J.Z,(0,M.Z)({popupClassName:de()(q,we==null?void 0:we.root),prefixCls:D,popup:K,action:le,builtinPlacements:m,popupPlacement:X,ref:ze,popupAlign:Be,getPopupContainer:ot,onPopupVisibleChange:B,afterPopupVisibleChange:Q,popupTransitionName:G,popupAnimation:g,popupMotion:v,defaultPopupVisible:yt,autoDestroy:Ke,mouseLeaveDelay:Ee,popupStyle:(0,p.Z)((0,p.Z)({},We),me==null?void 0:me.root),mouseEnterDelay:ye,arrow:mi},Qe),ne())},C=(0,Ie.forwardRef)(F),P=C},49658:function(Ut,at){"use strict";at.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var W=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(W)||/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(W==null?void 0:W.substr(0,4))}},83145:function(Ut,at,W){"use strict";Object.defineProperty(at,"__esModule",{value:!0}),at.CopyToClipboard=void 0;var V=Ie(W(59301)),de=Ie(W(25769));function Ie(w){return w&&w.__esModule?w:{default:w}}function te(w){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?te=function(N){return typeof N}:te=function(N){return N&&typeof Symbol=="function"&&N.constructor===Symbol&&N!==Symbol.prototype?"symbol":typeof N},te(w)}function M(w,I){var N=Object.keys(w);if(Object.getOwnPropertySymbols){var q=Object.getOwnPropertySymbols(w);I&&(q=q.filter(function(re){return Object.getOwnPropertyDescriptor(w,re).enumerable})),N.push.apply(N,q)}return N}function p(w){for(var I=1;I<arguments.length;I++){var N=arguments[I]!=null?arguments[I]:{};I%2?M(N,!0).forEach(function(q){C(w,q,N[q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(N)):M(N).forEach(function(q){Object.defineProperty(w,q,Object.getOwnPropertyDescriptor(N,q))})}return w}function ce(w,I){if(w==null)return{};var N=J(w,I),q,re;if(Object.getOwnPropertySymbols){var le=Object.getOwnPropertySymbols(w);for(re=0;re<le.length;re++)q=le[re],!(I.indexOf(q)>=0)&&Object.prototype.propertyIsEnumerable.call(w,q)&&(N[q]=w[q])}return N}function J(w,I){if(w==null)return{};var N={},q=Object.keys(w),re,le;for(le=0;le<q.length;le++)re=q[le],!(I.indexOf(re)>=0)&&(N[re]=w[re]);return N}function l(w,I){if(!(w instanceof I))throw new TypeError("Cannot call a class as a function")}function z(w,I){for(var N=0;N<I.length;N++){var q=I[N];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(w,q.key,q)}}function x(w,I,N){return I&&z(w.prototype,I),N&&z(w,N),w}function m(w,I){return I&&(te(I)==="object"||typeof I=="function")?I:b(w)}function _(w){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(N){return N.__proto__||Object.getPrototypeOf(N)},_(w)}function b(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function T(w,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function");w.prototype=Object.create(I&&I.prototype,{constructor:{value:w,writable:!0,configurable:!0}}),I&&F(w,I)}function F(w,I){return F=Object.setPrototypeOf||function(q,re){return q.__proto__=re,q},F(w,I)}function C(w,I,N){return I in w?Object.defineProperty(w,I,{value:N,enumerable:!0,configurable:!0,writable:!0}):w[I]=N,w}var P=function(w){T(I,w);function I(){var N,q;l(this,I);for(var re=arguments.length,le=new Array(re),H=0;H<re;H++)le[H]=arguments[H];return q=m(this,(N=_(I)).call.apply(N,[this].concat(le))),C(b(q),"onClick",function(ye){var be=q.props,Ee=be.text,We=be.onCopy,$=be.children,D=be.options,O=V.default.Children.only($),B=(0,de.default)(Ee,D);We&&We(Ee,B),O&&O.props&&typeof O.props.onClick=="function"&&O.props.onClick(ye)}),q}return x(I,[{key:"render",value:function(){var q=this.props,re=q.text,le=q.onCopy,H=q.options,ye=q.children,be=ce(q,["text","onCopy","options","children"]),Ee=V.default.Children.only(ye);return V.default.cloneElement(Ee,p({},be,{onClick:this.onClick}))}}]),I}(V.default.PureComponent);at.CopyToClipboard=P,C(P,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Ut,at,W){"use strict";var V=W(83145),de=V.CopyToClipboard;de.CopyToClipboard=de,Ut.exports=de},76374:function(Ut,at,W){"use strict";var V=function(){if(typeof Map!="undefined")return Map;function $(D,O){var B=-1;return D.some(function(Q,G){return Q[0]===O?(B=G,!0):!1}),B}return function(){function D(){this.__entries__=[]}return Object.defineProperty(D.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),D.prototype.get=function(O){var B=$(this.__entries__,O),Q=this.__entries__[B];return Q&&Q[1]},D.prototype.set=function(O,B){var Q=$(this.__entries__,O);~Q?this.__entries__[Q][1]=B:this.__entries__.push([O,B])},D.prototype.delete=function(O){var B=this.__entries__,Q=$(B,O);~Q&&B.splice(Q,1)},D.prototype.has=function(O){return!!~$(this.__entries__,O)},D.prototype.clear=function(){this.__entries__.splice(0)},D.prototype.forEach=function(O,B){B===void 0&&(B=null);for(var Q=0,G=this.__entries__;Q<G.length;Q++){var g=G[Q];O.call(B,g[1],g[0])}},D}()}(),de=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Ie=function(){return typeof W.g!="undefined"&&W.g.Math===Math?W.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),te=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Ie):function($){return setTimeout(function(){return $(Date.now())},1e3/60)}}(),M=2;function p($,D){var O=!1,B=!1,Q=0;function G(){O&&(O=!1,$()),B&&v()}function g(){te(G)}function v(){var L=Date.now();if(O){if(L-Q<M)return;B=!0}else O=!0,B=!1,setTimeout(g,D);Q=L}return v}var ce=20,J=["top","right","bottom","left","width","height","size","weight"],l=typeof MutationObserver!="undefined",z=function(){function $(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=p(this.refresh.bind(this),ce)}return $.prototype.addObserver=function(D){~this.observers_.indexOf(D)||this.observers_.push(D),this.connected_||this.connect_()},$.prototype.removeObserver=function(D){var O=this.observers_,B=O.indexOf(D);~B&&O.splice(B,1),!O.length&&this.connected_&&this.disconnect_()},$.prototype.refresh=function(){var D=this.updateObservers_();D&&this.refresh()},$.prototype.updateObservers_=function(){var D=this.observers_.filter(function(O){return O.gatherActive(),O.hasActive()});return D.forEach(function(O){return O.broadcastActive()}),D.length>0},$.prototype.connect_=function(){!de||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)},$.prototype.disconnect_=function(){!de||!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)},$.prototype.onTransitionEnd_=function(D){var O=D.propertyName,B=O===void 0?"":O,Q=J.some(function(G){return!!~B.indexOf(G)});Q&&this.refresh()},$.getInstance=function(){return this.instance_||(this.instance_=new $),this.instance_},$.instance_=null,$}(),x=function($,D){for(var O=0,B=Object.keys(D);O<B.length;O++){var Q=B[O];Object.defineProperty($,Q,{value:D[Q],enumerable:!1,writable:!1,configurable:!0})}return $},m=function($){var D=$&&$.ownerDocument&&$.ownerDocument.defaultView;return D||Ie},_=re(0,0,0,0);function b($){return parseFloat($)||0}function T($){for(var D=[],O=1;O<arguments.length;O++)D[O-1]=arguments[O];return D.reduce(function(B,Q){var G=$["border-"+Q+"-width"];return B+b(G)},0)}function F($){for(var D=["top","right","bottom","left"],O={},B=0,Q=D;B<Q.length;B++){var G=Q[B],g=$["padding-"+G];O[G]=b(g)}return O}function C($){var D=$.getBBox();return re(0,0,D.width,D.height)}function P($){var D=$.clientWidth,O=$.clientHeight;if(!D&&!O)return _;var B=m($).getComputedStyle($),Q=F(B),G=Q.left+Q.right,g=Q.top+Q.bottom,v=b(B.width),L=b(B.height);if(B.boxSizing==="border-box"&&(Math.round(v+G)!==D&&(v-=T(B,"left","right")+G),Math.round(L+g)!==O&&(L-=T(B,"top","bottom")+g)),!I($)){var X=Math.round(v+G)-D,Ae=Math.round(L+g)-O;Math.abs(X)!==1&&(v-=X),Math.abs(Ae)!==1&&(L-=Ae)}return re(Q.left,Q.top,v,L)}var w=function(){return typeof SVGGraphicsElement!="undefined"?function($){return $ instanceof m($).SVGGraphicsElement}:function($){return $ instanceof m($).SVGElement&&typeof $.getBBox=="function"}}();function I($){return $===m($).document.documentElement}function N($){return de?w($)?C($):P($):_}function q($){var D=$.x,O=$.y,B=$.width,Q=$.height,G=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,g=Object.create(G.prototype);return x(g,{x:D,y:O,width:B,height:Q,top:O,right:D+B,bottom:Q+O,left:D}),g}function re($,D,O,B){return{x:$,y:D,width:O,height:B}}var le=function(){function $(D){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=re(0,0,0,0),this.target=D}return $.prototype.isActive=function(){var D=N(this.target);return this.contentRect_=D,D.width!==this.broadcastWidth||D.height!==this.broadcastHeight},$.prototype.broadcastRect=function(){var D=this.contentRect_;return this.broadcastWidth=D.width,this.broadcastHeight=D.height,D},$}(),H=function(){function $(D,O){var B=q(O);x(this,{target:D,contentRect:B})}return $}(),ye=function(){function $(D,O,B){if(this.activeObservations_=[],this.observations_=new V,typeof D!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=D,this.controller_=O,this.callbackCtx_=B}return $.prototype.observe=function(D){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(D instanceof m(D).Element))throw new TypeError('parameter 1 is not of type "Element".');var O=this.observations_;O.has(D)||(O.set(D,new le(D)),this.controller_.addObserver(this),this.controller_.refresh())}},$.prototype.unobserve=function(D){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(D instanceof m(D).Element))throw new TypeError('parameter 1 is not of type "Element".');var O=this.observations_;O.has(D)&&(O.delete(D),O.size||this.controller_.removeObserver(this))}},$.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},$.prototype.gatherActive=function(){var D=this;this.clearActive(),this.observations_.forEach(function(O){O.isActive()&&D.activeObservations_.push(O)})},$.prototype.broadcastActive=function(){if(this.hasActive()){var D=this.callbackCtx_,O=this.activeObservations_.map(function(B){return new H(B.target,B.broadcastRect())});this.callback_.call(D,O,D),this.clearActive()}},$.prototype.clearActive=function(){this.activeObservations_.splice(0)},$.prototype.hasActive=function(){return this.activeObservations_.length>0},$}(),be=typeof WeakMap!="undefined"?new WeakMap:new V,Ee=function(){function $(D){if(!(this instanceof $))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var O=z.getInstance(),B=new ye(D,O,this);be.set(this,B)}return $}();["observe","unobserve","disconnect"].forEach(function($){Ee.prototype[$]=function(){var D;return(D=be.get(this))[$].apply(D,arguments)}});var We=function(){return typeof Ie.ResizeObserver!="undefined"?Ie.ResizeObserver:Ee}();at.Z=We},98040:function(Ut){Ut.exports=function(){var at=document.getSelection();if(!at.rangeCount)return function(){};for(var W=document.activeElement,V=[],de=0;de<at.rangeCount;de++)V.push(at.getRangeAt(de));switch(W.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":W.blur();break;default:W=null;break}return at.removeAllRanges(),function(){at.type==="Caret"&&at.removeAllRanges(),at.rangeCount||V.forEach(function(Ie){at.addRange(Ie)}),W&&W.focus()}}},18645:function(Ut,at,W){"use strict";Ut.exports=W.p+"static/detailbg1.e67ff29c.png"},76296:function(Ut){"use strict";Ut.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAABMCAYAAADZXmGYAAAAAXNSR0IArs4c6QAAHBJJREFUeF7NfAl4HcWV7l/V2719Fy2WLMnyChiMjU2MMeAAIcALMCwBMoEBEhiWB4nDkgmZlwQSiF54IYTAgJkAIQnwWEISEwgEwhAY9h2zGIPB4AULG1myduluvVW971R3X13JMpaMMa/59Mm6t7uqzl//+c85VdUwfI6XlFIHUO0A1SWguwroZ4yJz2NIbGd3KqWkPlMA6jygGoAWj0ECrg902UAXY8zbmWPbaUBIKU0ANS4wgXlIbsNIYRjoQQhIfmcA8pkCEc1+2gEmcg9ZAHycRknDAAHRAWDgs3SbzwQImv1CAXW6jgnMhIntJDk9ZkTISQnX99Fl25+N2+wwIKSUNNtVDjAhmv1y29uJw6jkMYAgMNCb2MFu86mBkFImikCd5qLWZ+UJHKcHbNftMhDIB0V0LFmCgZaWTxdttgsIKSUpfbXrop6ZsD0P29XOdpk/ykPkNvDQmUqhe3ujzbgMkFKmikVM0HXUeADlAP9fXRIItNBtOhljhfEMbptAUNKTy6EGJuo5QwL4fGd/jMbJQDj5oGh1VFerJE1u67lRgahIeurzHqpYRdKzrQZ35PfeGMONAcinuwozujzMrDW13LyqxPI6XeY9GFwz4KSBTkC5jb+18Q0DgsJePo9aw1DCt62kZ1w2j9WocTUKYG2uZN+8rvCDrMWPnpHS+aSkAQHWYTH88vAG82nPC3MXchvLMHr6NqFr0qQt3UYBQeLnANOD7Uh6PisDxwIIMeH4ZzsuTyfZ8buldexZZWJmyoIrJVbmvGKDzs8+qjG5enhbhuQCuYyFdsbYQPxdDITZVfDm0oe2EaYwn6eBYwHB84AHNuYaLl/R8+Be9YbeZOuYlTExM2PCERLvDrhoHfAf/fXeTZf6FRmtAQ9kog1DwMBbcbZaBmJTwZtLjYdghIDsHDAMSTPrweODPvS8E9iarouEkMVM0vAlIH1F78o8Mxznt57dsP9/dRRv3G2igRpLw8SEholJDYGQ+Ljg46NBtvqZL6b/xTdTnKbXMAyV6ERzHQBY8YlAxDNi2/SgR2BtU3VHzmIM6ghaVvxJM2PI+1p793yn4B3tCTafIZhmcW7onCGp84KlaWszXL46J209snfG3liEN6xW+T8v9+x+04rue7INBrJJjqTOkOAMgQT6HAHhstfW/tOEb8G2uW0YI20YOxDxqA0DLHQZTw4ZGFcBYyHy0D3EsiQg7mrNz32+v3gx55ib1RjPGAxpgyOlcVgag8GZitO+ZCgJuEyI5+ZXJZbMzRgbieqG4clrH+2ZcdX9m++EYDb/sg1NZ2AMEAHgOwzHNFs/ffiYqX/fygjHD8QQIAYzDY/pniHIoO2pIXyAXbq8++zNvn9OtQ6zytKQNbgCIa3Tj2IDTMagkVESKAmJQU+g32f99Qb/xdET7CdOPL/1a28O5M4XOZliWaMg9+MZmAzqR+dyRpXxt+Vfa7wym0ySwaNd2w9EKKKAbRssBVCWIgqj+8BWaXLmyx0/zgtxYl2CocrUkIlBMDiyOkdG50jpXFFc5xTRoMQv7wv0uAIdThA8trSw5vVf5/fQJ6PjyCOTPz/hjNpVv3pq82mbIfZKJNjglxqNR+4+avLT5HqfwNdPB0Rlw8wAtxmYrhuBF7rNVjNVCu8nPdOxuMMNzp1oM1RbIQvIFeh3VmeoMjRUmxrSGoetM+jEc4RA5HyBPi9ARynAxryHF+4pvnb517P/fsS+VXkTBk+iINDfDRhJCbuqrIg7BYiYISYDtw1wqSPwvC2FlaLCZW/1LnyoLXdjU5prExIcGZMjGRlMLlFlcNSYIRDEDGKFwUKVLgUS+SAEotMJsLkUIOez/sVTEqd9oTq7Gcb4xRzAjmPESLQDBs02wHQJ4QLlRdjBYlE77Mnu3+m6mNeQ0hQbSAdI5W2NKW0gNyEgak2OKl1DSmcwGAuBII3wBQb9AE4g4Qig2xHQwO/733Nqr9zO+mf7gEjqCIq+p7W73CbBm2xq+aREUGRDi69lhhjgJoOmSwSugeAHL3Qt/MvG/M0NacbqbQ1ZkyOhMZhaCATNPgFRS6ywNMUOcpkQCAm3Yl27EAh0uwHaiwE2FfzSuVNSJy5qylItMd5rfEAkDUO83luqfaRj4JuBpn8po8kJaYNxS9d6zCB4eW42cceuSaODjahKKRHiDFpVEmyfv264vM0NjqmzOWqToVuYnMHUoUJlWgsjR7XJUU16YWiwI8G0NXIhBk9IDPgC/V4QukhJoK0oMNWUV105v+ne7WDF2IEgEK5e1XHIulJwWbXJa2tNhjpLxwSTBsrgg6HLCQYtqV197MTkIyPBiLJUOeOe1gcTKUyuTXFYBlPGmxqUGFoa6QFDKooaISAaGhOa6ofuIbEsBgK5QGDAFQqQHidARzGAzoxH75nNf4Kqus+GESRwSz7oX/Bq3rmhPoEECdgES8OkpI6mhK4EjTK4LjfAunzgJ5i49IxpVf8dpsND1/Pt+ezpj7X/DTZPT6zS0JzWYBKIgkgP5R7kJjTzVSbHFFtXfVAkoTyCwiexIRbMvB9FEEeoCJJh2rt/mmtc4FXX9RkhK7e5xhKNbmyMaM/55rnLu+5tTMlm2wjje31CwzTbQHPSUDQmIDodH60FD6sGg74zpqROnJO0BvRIxalaue3dnqbvPzv4ANKakU5xVCeYco3qBFdZoBtIJHSGJgLYJpHksMhtOIcW5REEBP0Ug5AZBV9iml/AqYleNKcT0k7ZeTC2Brq5xKtuXkGZ8BjosW0giA2LX+38yvuuf1VDEsqf0wZDXULH1KSO5pSOqogRFM42FDysy/noXufdbTztrNyQkbUDnpjo5mRdYLBU167iYGQ0Tbc1VCW5KuqoniA2NKU0BbByFc4UCJRek1DyKHwGgpL7EAyKGPP8PnzXaIORrgIyNUA6G8bZwa6CEPJiPn32sjEwY9tAkDbs//cPf6ZZOLbaCjM8ivmk6A2J8IeoS4zoJQUv+WgvBFj2nIvumzxgTwfQKe8UQMCBg3WgRgPSGpIJhpRJbTJwDkxJ66hNcPU35Q0aC7/TSXCico+CBrkSlaJCCNzgvYnmTBJIpIDsBCBdEzoEJVTdG1Z78w49bRtZJRFm20AQI/a8r/XmVBXbL22GvkoCRwJJfkyhjpQ8gETek+h3A/Q4Ah+878r8zz2fVUmPZXifLnlnfcpYt+kId1FgyUakOViSI2EyWDoD14ApqRAIMppAIBZQf/R3yG9GC0cqKSHgm908bpUvg5HxhgWkqgA7EzKiMAB0bgic5jknWDP32rQN99g2EMSIOX9Yt6SYEgdnE2EVqBGVGZQ/J+KsjwGOHwrZIKl5P9ZcXpO96NCF6d66tO4ZBqRueHLBjRsu2TDgn4QUB2wOWAwGJUwEREZHEhK97Q4apiRhmtRf7BayDAYVX7TOsIvTh7v8Z4GqGkDTAd0CDNpWpcEUgf7N0p2xz4nm7P037hAgDvjDmgs+lOLsVIYp0VLDo8JOFXdD/ksDJN/NOxL1gfHA6ydN/1nRG75ucPlz3XPueLX3dliSKyASTO3lMZ1hckbH5mU9cDZ4qJuSxdRDU6qai8oMZQtNtvIyqkT7Sni+dB/q6zMhI4hWsQ85JSA30Okf8+0T9Eyt86mBoAZufK1vxtVv9vwR1dC1aJZoVZxFI4xjpIBEEABBgclTp6XPu+rAuje3HICHvW/cuKSv5B4IiwSHfI3AYDDyHrx3BoBuHfUHZFE/1wotp58oahDYjivQ+UEO+XVFXNywCtfu+j6QygB6tL0S+EB+UKJ26jXeVxf/KQqln4TFtl2DnqZqce5vW1s6PO+ryISDDnlasWClpoqKAaAG+nPLz2j63tC27dAYSHOueKFr1s3P9d4KXSYUCAQICerKHPkXmJvA5JOrFPsqeyF36G8tYfDtAqTvAw0G9Ck2fmm+0Xcxe90EZ7YakpA51E25Df988Z1jCJ1jE8u4oQ+6S8kT/9y2JCflPrAlELmiAoNAIEwdIBXwD353XMPiA5vt/tEGQUXYW4OD9dcsy7WUpFiUSHD4LvDBKw7aXxkEkgESh2RgT9dVNkZuSMdJ3H4PubdzEGsIbR04wFJAcMlKZ81K/9vvd+lbK1Yt25P6FLP2fVdOnd07BibEQxwbI+K7P8z55tn3bjrvwx73ZGkwGxo5MPXMwHzpNGbNh35z7MT/XNhs5UZbj/AZ+DWre76Vlzi1xmQ2FVZUYVImSRV760YHtz/ci82764oNFFKlK+GvyUN86AIDGrCLBcy2ACbABXNO3C1z2V8Or34Shj3GyR/1tvEBEbqJIe5+q7PhwXfy+63p96dLxtiMlL7hiL1SyxbvU7WxOCKtjrslEH74dtfPGJdHZQ2oGoLS84ZEmJDFKXZrzsOVr/Tgo14feM8D1pdCZZxgAKQZdNAoULnMpjPmpFt+c9DE1+Ol6E+BxPiBiDsjX08anlr+KnoGHXLa+oqURHDh291ndwv/QgKB1hyoVplqG5ic1NXaAzVEUajPF3i+vYAll2+C/7EAJgBYYAANmgKEcz4wc4L1t1v/R+1tB05MDewAEManEeNFW5XeAO8UYkGbG5zT8mb3/KwpdUqlaZU6BmKKbURASFVdUjW5Lu/irr/24OMNDjBTQ21ax5w6C4dMT+G4Xau6Giz5f5OcP5zQddKh8gG08Y6x4v7tZ8TWOiUABIO+2fMP6xPy1EIQzHu1o4R71+dQZ4e1A2WiyjWSYXVJGSoxIsE58kGAtqKPtpyPn8ytU9llTDVVTjKAMw5D49065AMZrt1naWgH5SvRbs12ALLjgNANQxQDP7nRcY/qD+TpRSGmB0IoIx5Ym8OLXQ6qLEq+KKUO3aPG5Ki1wiqTgKD1B0rVe0oCq3pdLNlvolqfCP8Lo3VcW6s0nKpSxgom8Jil4c6MEOthGOM9pLZjXEOTCHJBUPuRECf2+uJfikLUi0CEoU/NHnD/qhye6CypspuSMNICtTRH65RGWGpTiKwzaaYZcp7A2l4fvz+oQYFTZkKcZEcUiUEhcHWNewbnLyWluDMDsRzh8v1YSvDtB4KEUhqQ3Y5oWldyT+n35XHFQFTTykmcDlOxRCYQEE+0FnDP+zmkM1yBQMMLK0soV1GJk2RosDlSBlPFW29OYOnhTaquUWl2xAi6ldosl2GRqSHw1BaXlsbfMILgzzWW/gwVq2MAZPyuQQxoC/xd1jvB6T1ucJQT0B6tAKeaIzo8SQAwVZOEg+4pBrj0H12QVRy6onpEcVLTiDn0Ca1HZEyG7oLA/CoLV+wXLrnFXB/pHsSE8jJUBUsUQziXOmOtJsRdWY5/6LpOx4e25jZjA4IEkBLJ1W4wd33JOavXZ4uKnmdSvaGMl+HMEx04fUa/IxAUKzhw20t9eLm9BKSj2jpOnsnvZbhUV5/S1cJP72CAu7/SiBkZo1yCK3ArNEJxovz3iO8q7tM1Wt/gnQZwf4aJv1i63jVKpPlkIOIQ+F7JWbS+JL7R4/oLHS+IbA47D6vRcFAaDVaGLCCGKI1QvTJVml/9aBe6fREWWlQfxR5MAiElDItD+MB5c7I4Z3ZVNNthO7HhsQsMY0kFKPH3ZeeJQKHJMXVtwIB8JM21pUkN62NibnVhpqvg7VXyoS8bKB32kSv+tcf193D8gNgeGhnNeAhAyAYV5uLfMjReUTeqUun7wZLALU/04KNufzgYVFK6QCLBcN6iGpyyR7Zc6qv1D2VMNOsVs13pGuUQW6EZ9P0WgHCuDlgkdO2phBB3Zk3t3ai+HX4+4rW2NttJVP/0pe7Sae1OMNn3gyFDozAWGx4CE/qpmgkSvshp4/ivyTD4xStNkkss/8jBsg8K2NjtQ/oSls0xd4qF0/apwuxaS+16V4bJeHEm1JzQ7VQojWc7npAogajUEvpIMbWyYI6oYOpaYDL+VgL+rVnDuIUxpnbL1fNH/6Ft2scFb83xC1PCTsJoL/qMBlae9YpOyyyo0IPRWBK7TSimIUsoGqg2o8+o9wZLVztfQ6IbMqFSD8psjKJSWScq9GK0JCwWXRWMo3sNzuRmx5ev9JYKX8gEkw6qrx8sA3HsHR9PffidfCvTpNxvr4T/tQVpXhCB1uvSssuQyoczPKTaZZbEA4zAiWeTBDPWDCWuEaDqsyh6NCZ0tbtVbjdyNbp/OENCgGIgY/esZMJIcY11jAylVfGcL+TLvUWs6CuxwQC5Xy1oamyMXoNQ7Sgg3i60qt0UWnZIQB4yPym+Mtdmfb7PB9wwV4hDY4y+GkycRMXiWQYl+o4MjilN4loGJGQK7WXQFl8ZsApKD2NPrHKRdgwBEjNuSMBjd6LfpM8lKeUbPSW82ldCrxOoxRQGnrt+/0mjALEiAqIiac9kmTxioS0X7ppgmx2P0U50bHjljITARLoRUz8S2LKWxAIbsUQJomRoTOpqsyhOmCqBjTVI3VuW+y2Zolwn6jcW2HBPhMl3+ovsxW5HdhQ9FtBER27HGcvdtKh5OBBH/37dtEdWyvWq6FdvGtEVPyRRXcfl1w9KY/pEjW12fLW/MERzAiccSMiaCkDKoMSJ11AUiO+n9YlqYoRaKa+Y1YiBKhJVRg9qU/U/PLGK71HZLWNYm3PxbGdRrs+7jMYbWxXPM9d4/tZFzQ3DXOOkpVL724q133GL/FLpy0a1ELnFoRuJ5im6PP6LKUysYayzFKjlyljkyou6XFYo9ghQKrUkijgERE3kGirsRkIaa4jSjjIow0Nque8IFNKBj51APtmRx5oBl7mk+JWpC/1bU+ez1mUN9uM/7T/pz/E57WFAnfdQ26x3OsRDL650mhDIlNKMkRcDZu9hyiP3TTDaaKKdrjChimYoDq2x6EUjiWes7PcRKI12JJaVIW+E+IbsidsfcpMwZ6HzYww0Mc91FeWK3hKjvdGRDCDKJjXuzrT1Jy29dOr182f0VZqm7r9tTWGKL73/yZmoTev6Td/+Y1dxsIddETjyZAQBZdrDL6KaDrlgnokjFyZYCUKdcYoHGydhauhRdl12pWiG4ohDaxO0lRjPnHKzOFdRj5NRFTtgkZtQuwRA0ZN4vrOAl7uL6uRdePeQW9Pfmq7nMkzcvqg+8fM90taXXcmODnzxYO3M6odPZsxVfV//Xs+lAcP+lskuumCXmtZKi6sv27h3Ludf6TvsSAh/xKoQRRim9lj239fEl75gIS8CFCJBjQW0EoDKpIymkmahWQFRUXZX7JuEoIQ5SCimoTbQDhll7S91lvBcR0FtN0qi5ZD9YQ2kaW6GY2mTxloeOHzq2ti2p6TU3/+g94iiZCcGMnje1Nlf2Q2rV1sDpeqzfIF5lqlffcmeNZSPly+a/OxlHx1U6AuuDRy+LxAMAR7fJYGEDXz5QBMLZpno9QN4gsYSR5mhKnWI4mGhphhhauVVqcowPYxhKlMNQXmj28HjmwroKPhlKYudWOUOnMuUwf8xSZOXPH7EjOVb+nf4yc9f75gXJK1rMkxeWXalq1fmGrvdwoV+gEHDLN5y1bxpvcMaWCo185XWU7yidol0xRzIUV7YlRLV9QyHHmhh9xka+lwBClnlkDssPQ+NarbDsxZbyyPKm8MSeH/Aw399nMf6QU8tcof1a5yHKgRgm/yViQZalh01/R/hUdAtr0tfW99U4PaFFjBQI/Sbf7Rvbf8WmnLx8s3z8yWxWABPfmX/hntPjnLxuLlJLW12d5//baeIH8BHQwhIxMmYnhJomsJx5CEm6uqZAiTWADXjcdUKYJKto7YcNUIBKafbLFzv3JD38fcNebzT64AigYpQysSoX07HlvmHdSZa9t6l+Kd758xRfj/yOvOpDxN6InGWzvhe1RquvWphw7r4ni2AUM1Lyc58sf1o15cn6zy46a6Dp7wystFsy4baUrf8vluQ30VAOw9kLDVXuVomMXUXjqMOs5BMQy3HVaa9ZM9kYoTFo9wgig60w8gZuooEQAGvdTrqWOEwh40qMJOzrjqLXbVnOv2bx45sHP2tYSnZN15oPyoQ8tSUod1y66KGF0baMyoQ8U0tr7XZb/aKb/mMNdsWbrj34OaPRjYw8Serd+3tTlzileQ3EQRW+H1FUkYJmiYxd56OAw8woCUlSpThRCl5ZdSgZIhyATow9vjHeby0qYQ8ic0Wl4oEg2lN/nZWKvurV45voDeFR71OeGrjF3yfnWNw/sbefNVdLYceOurrTJ8IRNzySU90NXc7hX93Jd9gd3ff8tgZe2+BvH3x+vnOoP7LoCQPgxwZYUKi6Caw7wE69ltgwOFCvRGvXEMdRmHqeNAzbUU8s6GAwdKIs+Sx9+mGa2ny/km2dvm6r+864u2cISyOe6itrlcT/2Zw5jb53f95z7HzhmveCNjGBET8zKEPty7o93GBxvhDx7w5+YEtXjqVYInvth7m5XBV4Mh9txDUyHMowiw6yMS8vQ213E+HTl/d7OC/1+UxUNjK+2dcE5auPd1o4n+1nj7zja0x4KSlK83VeupcjfPZjbq89u/HTivrwNaeqeTwJ90z7LsWKfm997ee4gbyoGTg3bHi1N230I8vt0j9hc3rv+kX9B9Jx99j1PdeBFBVx7Df4TreyhewuZ8OLavFzOFaQ6vUprYsa2hX9Jy528Of9OrinkvXHyMYOy6lyaVvfG36k2M2qsKZx/OMuverD67KrMhb57sCNTUmrlt58oz2kY3MaVmZXtOWXOzmtR9KX0wYVsMQO8j9Z3hAU/zmRyy2qigA13lrysIVDcV1d6+56OitnoDZ/fb3Z+V143sm56/ua+Tvuvfk0aPGDmXEyMZm37F2anvAvs9l0LoX1296+qwZpZH3TPp+W11Xr/sDNy/PRyDtMkNISKe7QGPkDooMnNL33kSCX5X0+n7Tc9EB5TfxRrY76473JnQE1vcMLoNJcuC65WfNH1Y/jGd2x6URn9Rw/a1rDyp57HRTike7Fu/2QBzpK5+p/96G3Xp62GVBwTsFQpgq0k71gIZIGDUtb5n8dxMziV9tOGdq29b6+6dHVlsvfijPZJo+J2nzmzedMf298Rg92r07DAhqfMEtrxmrRe0prht8qVrD9e0XzFw5Wqf2d9YudAa0XwRFeRgmOwxNzNN09lBNVruk67xdP9iaUZTuVy9Ze5jPcJqliT/3fGfm41GF9Wlx2LJa/dQtAtjthtXZtoB9VwTMrjbFf7RfNHPL1wikZKlvrz/SzQZnJqdp1w1cMGML0a0cS+b6dXt4rrjY0OWrDTruXnPRzG2dmhuXKTuUESN7zlz73u6ua5yvSblqYpN++/pR9GNbo538Hxtquxz3QjDBq238elRQt9XIGL7/TIGI+0//Ys1hviu/KXXtj86Pd3l8DOPCgluksapj9Td8pn/RMPl1uR9+eh34TKPGWIyie+YsXWmufdc6LQj4Isvk1+cu27ph6ZZ1X3IDnGPo7J7cT2c8NprwjrXfsd63UxgxzNeveb/O6dHPh+AskdBvGGiZQv+bJXVlWtbu7jp8MWSwdrd9dv3typPD1aOdce10IIaM/nBWKccu1ph8sSoVPNKb088FY+malHVdR0vj5p1hfGUfnxsQ8SCsH310BEo4wbBxU+7Kqe/sbADi/v4f+lz97xYENYMAAAAASUVORK5CYII="},30757:function(Ut){"use strict";Ut.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAABMCAYAAADUQBHfAAAAAXNSR0IArs4c6QAAH5JJREFUeF7FfAl0nUeV5q2qf3/7k2QtlmzLTkxsZbdJCAFis44hhGZJSJpu0j0zjc+wZBrmsHRPM4hzukP3YQ8wEGAG0jTQOExDSA8hIZAQZ2FJIAlxdjveLUuy3v7+terO3Prfk2XHi+Qoye9jS++9f6n71b3f/e6tembwIh+IyG/dWy9yjJylI73TY4xFL+aQ2Iv58Jsen8qVc5lSS8VWCCGYAWJPv1u9IJerMsbkizG2FwWQO555xlFGrgfQcLpGhwBQAIAAABzDTmq2U9lUhgZjDF9IYF5QQO64A41oTbNsRDIHNgCP2LOeXw8BshYiIRVxK7TRPfTyEea/UKC8IICMjyO/5OpqnjNW8gUT9gKsU0QyMmrlVvQdWs9YvIBLT+nU5x2QWycw48lKDze4OXeEUcSYZeFxw+HozxMflC9Y7Q3DeeIXdUrWzuOi5w2QbdvQOuBOloSbd6OwxizbPiEXcLISjw/QrC1SJWCVqxuXQAtg8fll0QHZgijK+xpFmyUZzlwWhQGDDnVa6GhQIhYc97l0zok+p+vpHBk1I4m9lY2jjHh40Y5FAwQR2S1Pz+QyHhQU5+JYI1wsQLr3VgjIQbRy+3O19esXh18WBZB796Drw6EyN8QRPLFo03aSG2UsW7bqYeNXK4r18efIL88JkC3btlkrR9bmVey7R4+Z8uSz3pwnQse7tvv+0Z93X3OFCcRebf2QTtOnpF9OCRDKhA/urObDfDFrMJ/P087n/TQdQkHAQmEGtcZE7Y2nn056b0HHwgBBZA8dBK8h2gUUzDhVD1jQCE/x5BYCmu24ddFwvraQMmDegJDcdr0VBcP0F6KrTtGcxbmM4kYokApb9du/0tsaHz+5fjkpINfff7957up1eRb7Hg2TMzjpNYtjzuLdhYCxExUlYaZ2sjLguMaNI/JLK5BL0M9xALbYQFC8k8kFFxS0U+Np4IwBC5+H59H96ZlBJINXDmRJ7R6zDDgGIMju33/ABbNQSDgTxBM0QLvD2mEAzHZSY+ayPZ1DpWr3s+PNr61QPdmK7S2P1If31uJlu+q4gmGSAyHw/AGzVbLZrpGsufOVq0p7CoaKBGfHJO3umOaO52Q+1b2m1W5jf6an+cDt0LziiiPbDEcAcv/9aGYGGnnHypnYmcGTPWQ+n3se4FS7xa75+cEzt01HlycIGxWDYUR0BeO65OUcYKzXBlMwNDjzBce9BUv8fLTIf/wfVxf+qLwM8vbihqv0QOVa0B4YYK2uHUcA8je/2dtzXjY21/eu0B5A7jsfg090jlSgNv9i+9hvD0QfTgA2Gpw5HHD2xpylrlewOawsWsRRYHCuATIFOYcKbMFuO73X/exfrnIfDznjHmSe07BoglpUCWWA7azOGPBUeWLjRpZom+femQCRtaZdcBw8d8TDNZ6HjGVOCRTysN9Mzljv/+X0f2nF8v2CQU57glZMqNGm3wkAsns0b4NjMDAEgMHoJwPOEEw6gTEwBTSyFvvyX53Z+5UBy01OdbK6nj8hfKNSDw2JiLndpf3HByRupmm1DTBYdvC1I8sVzcdCBkAP/cYf9xU+/0DtOgX89YZQjOKCalkCQb/QfsEgZzHo9wS4hgBySEGAcNCAGJyB0B7D6EK0OEPB4NZNQ4VrLh7ONxYyJvKK6XaLhYzxQ1FoVBqRIDAylq0O3L7jwObN6zXJPttDuoAQJm2AvOPg6T0eru/tw+w8Qgg9wG/8el/hCw/UvyURXk52k5Gck1ek/iiUBEvF0JP3oNVsQT7raVdRiYKenAtZm4EfIOQ8RpkBQpl6Ut7mBAi6Fr/7dcvz/+ni3vmBQhPkM2DTsW/ur9d04ek4DkAQQGzZqlLZcWDz+nkAMhtObQAKowuHXdWfyQD9IW4QXE+4TmeUlunnPU/tdzbfW/taomCTDhHNEQgMEeLpvVAo5cG2bWj7AfT1FKHaiqDgmcCQQSuWMFxyYefuGKZ3JLD0XAtGe02YaktyEBjOm/DwzoNwweoBzNri1uVO8L41vW44Wiyr1Y4nm3N0UndMxJZS+Ma+etVoNTjv9gpyeRspK1YhgOiuffvm5SFHM5ehHCw6Hr5hmas8zCK57NHZ6GX/+sR/qwTqI6iUzh9cxhAf2Al8aCUAKii4hg4JSeFiIkSKQ8YAoJtNVBIo5QW0Awb1qoQlAwYMZATo+zAAz+TQjhX0ZQwouEIpFX95fz385mOTqpixzOgdp+cnN5+daQJkoc2AyahttAQzEh6mQAQAU2HISEfkLMQAHLBswOmZ7fsX5iFzkWkDRErhBUt71FifhwRM9+P/fNv2M+/ZH9+UEVHOkCHUqk1IvB6ARAFYJlgCIe8AuAaAYMQXXBNolEgwDQHTLQU5l8Pe6QRQIZQLBki/CetGe8ExOTBAiBWAYzJ6TeFTO6NgvrVXmE997f6DSx+ZSFbmXVb/xw3Dj5y3ErF1jL4MARNUKWYCaDc4dwwpp7fu339KHnIELm2AZcWyOr8XcXnfErVrCvhlNz72TYXqUvPQNDR2NoAv80Dl+zR3cEOALQCKDoGhUsIUHKJYwXQthP6yA4lkkDU57JyO4PRBF3IWh0QqKLoCHINrLyF2pyA0BEPKQBzUz8Y3LL862wS44emKe+1t+ze0fez/2Jt7/v01y5gPxBVHHRqUgP4GoNDB5tbtzx2Q7jMi5eBYyVVfuK9+7hOHkh8rmTi8WYdkfx1gpAxge8B0Ck0zRsYC8AylDa3MtKDck4NQcSi7DDwjVSghAizPmZCxuXauhh/B3pkWnLu8DIpSFTKNi2Uw5Bzay3P8sj9fU3w0EdyYDIC/46u7NvntePRf3rPs+qV5VNExkkEaQgHM+IhDBwf3nTztzkP6UOhMNhzrN7uavbur7IOKiXdRpsC6BIgRwGYAWZ4yK6T6QnAGDouAcQ5BAlDyOFiCQDJ0GM20IihlTBjtcbq6BNsRsihRGgTyFETSJqhBtgVXrgnf/Miryp9shsyg5/zyyab9N9+ZGB/pt2++6X29dzdDLo4Jis4yBZV70p2HDjkJIF5sq399stH3zAQMD/fB5O66+d1YypdoeUGBTgsFNDxi0I6nEyxKSoBaHdzeAsl0yFsMbJPCgYHNOUy3E1hasGAob+qw4hxQKcpgCL/ffhBWD5XBc8xU0QqtZtEQ/Kkrx7KbBnKWVpuUYTZ9fudl7RqsuWO8/x85uCwOGZ/bvO42sxNlK+O5AmIohT94hA1t3x2ctXal9TvbEe4j+9TWBJUu+1LJNVfmdAojvw1AbVdkwG0BSzIURggWhRTnYHEG1XYCy8oulD1Dcw7TAkYxpQBm2jINO1uASY6XCjjkAP4ZJf6mt68b3h4Gvk7/7/76rgue2pu846d/O/QRz3WZjYBhELDkqGLRULZKngsgBMa/PZT0Pv4Mu/T0VfYt71prTnz7cX/D/hr7nlRKz2SX+AiW2aUWUliNOkAml4YQZ5C1GBTtdM2J6pYwUVCrtGHN8jLkLANcM+UdMlwqBD9G2DfTAIMhrBoopumYA5oMVH+eb77q7J5bDQZcoY+bPjf5lnZdrX3wn0b/oRGAFmO6L4KAcRjybgglCpUxVNq/kR2vlpmjVI8VNcQb190k/9LLwuPXbMrcY3GfXbcV/rQRi886QoHJEfwENT9oQMhf4iiVvXaOUgwwi3iAOAWg1yOjFXDOIIhTfdKfNSBvpZnFNlJGJFAoEg+1KSUrGMhZnVSsvUT1uvzjm88v35BwEA/siMz3fmvPtX095s9+9bFlt3UBORYohkL16IGFKtUOMiTMvn9/a+SZp+MP/cnr7I+tzrDIyFvy+ntb10gw/9YVqA0lr6iECJFE7SzYoFARALaVFkU8rWtsjpC304KOmKZSaYKdcaGcNcEWAhzBwDZEWssQNxA9JQoafgBRuw1jK5akzia4Knns7z988fD11cDnb/3MrjdNVJO3/dPV/e/fdHo2CI/KMnM9RTk2Prrj0QVK9y4ghiW/8KP2ZaGP5378ne4n25gYhmHJH/whel+sxMcTKdMQQQCf3D9EwOp06hmGCRT43SKPvIIAtATXmYdMrrZjyLoGFByuq1wChTyDsg95UFoFcy3xW+0ARvtymmeE4Cpv499/9JLer13+P3ev3/Zk8omz17h/952rhx6J06L6WUcXFD/wQT1ZPnBKadcwYvnFH7KrohiWX3uF86kpTAyMpbr5SeNdvhSfQSV1rBNdKKWgESloT04B5Ht0tunWNgaXOlzmpmJkCPV6AD1FD3I2B1fQ+WnI6VYAZxokQwiIpYJQKrBUAkNlDzjjqi/D/vstdzWe2TOR/N3AMvszt75/5BfHA2MuOi3fx1MHRCn86u1wfmVSvvfdb7LeM1BCJJK96QljQyth31VSaTNpwHTUqxUIjZzOvKYgl0+LPNkpgGjGtWATDOJEQlirw+BQjzbc4rwTKgiCc32ObgWw1KMQFdz3y6fhwktGoZCx1IOPBVsP7I57Viw3/uGm9624ez5g0BifEyB0g4f3oPWzrfFXMwX2vf/6lsxtEHF+185o2YEWuxMBnUSSDlAQxRKm9uyG4tJhHSaEFAGRUE7sgEI+QMbqYk9RycOg6AK4ptCGUzqmcwmAFBDqkaSedrCdwHQzBgcEVCakUk38+YaXZcc/e1n/3vmCsSiAkCD7yp3++VMHkmuLS2D8vZdm7ztQU9avdqifc4CXkMEKGLSCEBoRp91AOvYpHZOHaEAUQqK9BNMij3OQQQCYxNCrBZtuI4GjwyZVpAQIhY1NfRNgsGMqhsndkQZrdIXz9AdfV9j00oFsuNDVgefsIYQqxrb6X7c3XjlzEP6HlYEfrz/P/fZ0pD6kFH+vUqir15m9k5AZ6NHG0iyTWNOhQn0RSTyjNNdo0zkDSZIfAMoZEmSpUKPOmkPhonuNAEEEMFNVUJlM9+P1DxkwOmjjUJZff91rln1iZ+RbC10yWRRANCiWrW66qzXy1FPwEUzUardXPNGz1HirYTBjcucUtJ+ahsK6EXBzrt7Woj0ElQaFgJCKAEnTNBkeBwEI04RyhmR52lOlQk9GDGo1Bf6MgjhCcAscBpYa0F8wtbI1BEQXDGWuvGb1kq1Vs21GjPFGCMKd5zrrogFCoJBIC4Qlg332VTsOJdf+7rG2GxARCAkYtcEYzEE2JzQX6MqdQoZSMwNIJJEreY0CVAziWg1otdgxXYgDBUmLgaSSVCC4eQ65EoOekgDPot4rZfDUg84fsvB968u7FPLPWUr9KEhUHHMmaE1pPuGTICj/4d9MbNy48Thd95Mo1W7KCgNLXrzUW3JaT/avXcO4HFDmHpkO4f0/OQjTBxPQ/byOJiHhrImV/knb7mkYETLaXTrFD1WwFgczg2BlATIeB5dSsME119D9SIdQiFFsWIaAT7yqB4bzFt1SKcDfcRSfiiPr1zwDrBX6pl5oO0EvOAXEPcEyxEkAacZSjTie85rRnqsyhvEBBBykFEjzT2P+3qMNuOGhOkSSZDwZzHTvw49SMiXjCSdFupOnRMsFg2hmCkTGg1w+C5YGQIHOQuRdjGvVmmYlkvFkIYMrz8zD29bkdGgR/1ABCIyFqNRPODc+HfjhLt8UFtU3xxJn9N4pA0LhkQQBu/LMVRvKtvlRBDhLKZVi32na0O8UBtfeewju3x9oLiCeoPfiJM0qdG7KHenPSKGW44EvQVgCsnaqMyjMBE+zkPaKOVmHPOT8IRc+9vJefe7ctYMuJzHGp6SU3xCMfaseybaKmHGsHTwLBoTql1ak1GtWlc5YnrE+agj+WoWKljr1QFJuSEv+tOTg0E4S+ORd0/DoVJoWI+0VqGdQZxoiVECotWII2/ShVinAohCs3pz2BvISahyR15FXhAmDICJ9o+DsIQeuf/OwbjqnR3cER/oB7YJGgMfjGD8bg3Mr1btHa5QFcQjxxFlDXt/63vxmy+BXKyVz+vEsldTaPQ43P2ZnioxoRwo+/etD8Lt9qaeQ8NLCTKbeUWvH0K5FaRlLdh2sAsw0AVYPUh4GYXEQujuGIClNU7gBg1etysDn37SU1miAI2mS9P10B3j6uuu03X3SjLEEAbZGMXy6geqPGQDW5ZWTA1Jr2k1TqmW5ovXqkdzlOcv6a6nUcCoaUp448fatdMlAx6dC+MGjNfjho039O/VHCRjqe0zOBGk3Xgc/pR0EaCUAeVNnltmJp6IHqXXI4D0XleEDL+vr1Dg0nJQcCGiaJL0SrDtm3YWA7jpc2qMRwFoxqh9FkfqiZOwAtQpOCMgH791TxqRhX7py5OLhrPgoAlunFK2YHL0V4GgXTV/PZpKO5+qlSwawoxLBP/+xBvfvCyFMEJpBApUqfQuk014jkglIv1PTVAEYnVU++tVkcPGqDHz4kn44Z4k7WweloZp6BAFBeNI4iXNSEQhpV6gz+lQU6uVR5AwnY4lfr0Txd0MQjfiR304eM+3+Ymf1/IG89QnO2SZUSL2+jnroREPHO+jGqfEpN6RDO2phtGOrLt0767pPV0K4dXsLfvpEA5454Ovw0Uc3RZCnMATDABgomPCq1Tm46pwynNPvzGbwY2WLudOjJ6HTbzmaX7qOo7N/h1/8WH1G7nf+ZWws/Z5Ox6fGOYyvNe76q9f+JG9br7I4d5DWFjXZdW7b+fXZ31/oPvYwr3SletrHONIEeunHEnbWIth+KIBnZmKoByREELKWgBUlA1b12LCqaEPeMfWKHo0j5awOf3VKgdQbUuXbbRXMjrjbeOkQbpfqusFEgCQKwwMtf8qPog2vXd6/owMIsos+d6MzFQxkv/zusZstwdYbwOOSbXKDcxMVdSpQ5/5nHZ276/qTiohOBu6Sfrqw1HECqmES2gGndOmuQZNKG6wr2o5GSwVbmpHoUtIhGccC17a6fqhvSCGQ7pSg6w/zBvEKXUc8ku4y6DDeEWuuKKf8qD3RDM0EsG0hv+hNq/qe1IBsGB83JqxXFKQwl3zuyrXfzVrGeRQIElFmOI9ztk2ikMZ75KEx6JLsYefsgqFnpJOESJBFcdLZSYsaFOISSseRlu7pA6hVyFDp2KduPCUOAiyWEmzTgCWFDDWDnj0xs6CnH3VDVL848jNshHG4r+FDW6KFoLhgbEbMAoKMXT6+xdpRWNkz06qNfPHPzv561ubn0MgpvGkyGWBUtm2Vtw2bJqVLrzQPR4fD7EiP2EPMIEySTtqkrKJ0E7oRIfhSdkgybREQAASKwQU4XIFBswxMg0bzXPAc6Mt6aYh03JH4THYJvRNaGocuEGmhjL6UyUQ9kNUwMRkgZRcg3wfGZhjwl79lZd8TMI5cA7K73LdkoslGvvSuM7+etfiZ1P7TPEfNHr3AjMrmPBrOutw2uKkOe2MnHrpTcThSZ7mGEkgitRjT7osIrVhBM5TQVmRKil5XcBJ12YKDzRRYnZvEmg1podyGwUIWEqV0yu0eBBD1V+igLE2hQmmeDgWYTLeiuBokhkRlxLSA3Fkfph0ynPFKEMFFV5xxFCDVJi6/9PzB17/6jL6/cG22TEtt/SCK93RdBBQkeceMhrKOJRjTCwSHs0unWNPYHHaR7rXk9mlGUlpoBVTfJLS0kHKGXqWjMEQAU9cxlE4praZjoOp2pJTTPVWtazspPZ2KNP0Sb6QcoiW0qvhRNNGKWCyVpf1hTtuBQFGMVabb0fW/373nU19648vq4+PjnI2Nb7GcwkBP3U+WcRD9+ZzR886XLn3d2sHcpYxhjgZDKlErRWSQUDZHjJdmPdXnWVanx9OZrHTW5pYXNBn6UqpbEqlnV2+hUVL3XqkNS+5Li08ax85Mdxe46K2MY0JPxk2bTXMYpFNIzb7XyUIYShlPNEPViqUpEQRxmL5Oz6kGLp5uRvfd8eT0db/ZMXNP6PiVp695YwgECGy4wzjrDa0cOrmBOMIBDliQCTgvWZoffPv6gbf15uwLk0Tqr33QbOp4pcYNonIED1flMzzvGPRlMe2Ix0vL3ZmkDBMrpZvKFJq65dgJgbQeShOoSTximbq/St2zuV+26qbYuSUMZUGqPw+1o3gmiA1ENOl+JIYJhFQkMmyGyTNbd1S//aM/7LmHmTjRx70Jux7W7xynfohO8sBOu+4pq2DXclGj0RsjKykJRY7cA4b2hjN6xzas6XmnY/KVUXepck4oRRKTgYwdnVHOmQZjWswdwamzvjPHe2bDP9UQdAF1v7ppMg2VVK12SpS0s3ZE0XD4FWdMNcI4mm5HPJTK7F6m70Gkq8cLlccONn/03d/uvflQzZ90M0bFFGzaSYzmfR96ObWi9LC7XMzGtjxqOjv2u6FZyINSpVCGRcF5HmPlOS7PvPm8wUvOHM5dxpkqEZ8QiaWd8tQZBYd4TSmnhnIOaZduNaK9qbsXtdt9PzpvkrG07JCaeGRQ6JLgONUT5aUYVXioFUIzlhY5WHflsLOzjVw22lsNtv7wwYnv/H5n/RnPlTVHmBWJSb1Y2xncOf4XtMF59qFHyovLUQyN/bs9mB30IuHnYwklJbHIOGRRSndZOdf3xvN739qfty5WqKxQN91SEUShROFZtI34rHIOSq5lSUS9z2yuZO7G8iwoHWupm34szzoM3mFYtPACiBthEjWi2EZEQ7ckOyfTeAzOVcVPnvrF45Ub/u3hvb8zuVk1XVbxuFGV5qS/snRpeONR27rneMiRc7Zh/A5jqm/KYdayTNxqF1nMyyB5HjhkpUrsdaM9q1+xunRFxhZnkNFafaZJVRsfSSWX5d3o7L6CYRvCILVLMrvrwt2dibNJmjKL9pDUP+YWbR0u1Hfv5DTVljJohrGhEE2pUO84ID+iLh3dJUSc/v2exo3fv3fvTxuJmjY8XrWSpOZElWZQXBo8sHldcrxvdB5Djx+eu7HxLWb2tGWOP+Pn49AqJjIp0zIql8w1hHA3nrPkFS8ZzPyJIbCPshDdjAiz01lHg0Fybl8heUmZ9vzNDaNuQyntqNF1h3VFmjp1iuyk0c6IMFYqaoRSRUraqNSsZKWwJf6RCOH2Q/7W798/ccND+6q7Miavcdua4dJuDooD/i0zv41hfPyE3/k9ESDpOMaRb1h+pxVWbK8l40KUyLJSUGTCyCJKp7/glV53du9l/SV7o1LSoVSqW6edJYZEIfY4ZviywTL0Z2xb6c5yenSDQNcsc9LTbF3WRQIwrodJ7EtlccZILTOpl03TliQwoab9+NGbH5r85588ePAB0+U1y1YzDnPqItrVvu8+iODGK+b1nyucHJDOoLphJPhSj7VVsa2ghFFcNAyRkQrtsRXFVReuyr0z6xprk5hmTyvctIuVFmtytOhFFw2WhGdya26FSo/QDek5R4dPpJ9gGEppxEqZSqKu5RjnKpGJXtwIE5y8b1ftB9ffvetnfhLPeLZZccGo+uVaszzy+vDOzqb+o4n8eK/nDUh6A2Rj4zeaYXmZk2NJNghYWWJcAmA5Q2LGEMy9cG3PhacPZt4mGA50dwLQLNJmFwkMDUB5wWApPLsv53BgtKNE88ZcQMi5EsQoJN2jiCcU1yt+HTnOOSPpEj451b7tG3fv3fLEZGOX52DdM+xKYhuNWjgZPP2BTVGnrzhfLGa9dkEX6JMv3yJWjPWZmXzoWVYuF4ZJWSZYBFR5jswpZJ3SxWt7Ni0pWq9FJT0Sp1qid4RoggqLtog2jPTiioJnKYW8sykGJUISKkX4mSReycXCWOpqO9ZCnsmpZvTwD39/4IafPHzwIdcWddPFiozNWh7Av69+UQjz+G7dInnIUbfZgmJd5QFbhe2MillJh1GiCgZClkTd6EBudN1p+be7pjhHAgpdDzFqGqfNjigBuarkRq9Z3idKtiECqWKJKBjxxGFBQlmMsGGNMDlw5/aZ733z7t2/DKJoxvWgKnhxJhI13zFy4Ymyx3xnfYEhc8zbsrHxbWZY3uX0s4FsJW6XZKKKCFhgyDyB4Jx3enHd6IB3ucFhaVpJd0WdSsOIQ3zVGUPRQMbJEGRUXXdaz5p7pcLgoYnmT794x/Ybdx1s7c+4rCYcc4a3/NYSLw5uuWZTtFj/McJiANLJRuN8BSy3cktOc402z4dxUlbAC4iK9ItTcEV+3Rk9ry9njf/AQOVoI25HtVNWkn+6ZigcyXmebgkCUINKV4H7a8Efvv3rvf/7lm2Tjxser3kKqlKk4fGG/x8e8/nq6Xy9o5v5FnL+yc/dskWsq7i2OlTIsIJRaPpRicLJBFptTeyBcm5obDTzDs+GlypEQ5fhCuSfrR0Ol2Ztj0ASnONMEO3+v9smv/P1rbvvVoaa8UynylhUlaHfLresMC3GFv9YPA85cmxs3fXXG83qgGNkBzPgB+UkSkrIeZ4xzAgw7TXLvLOWD3pXCAErpET152PD4XDW8RLA+m931W7+3B07/s/eWnAw77EqMF5te9Aw9uwPt41fHi9WeBwLzucLkCPCqFg412FyptBKrKKKk5JhshyCcjOumTlrtPjqct5847vXDpkK2YNf2rr723c+NrkjY0PV4qqCgteKRQju3LUhei7ZY76+9PwC0h3F5VvE0JhrZ7NZz7JUIU54SfmsxIXyQDGzXPJ61i0t5W7bdvBBAFmzMuaMCbLOba+VO9CInq/weOE95KgwgvE7xFgfOCoSOUPKgh9AUdiWh1HIkJnNfE7UILFqTj5oBokTPLB5PfHEiYvg+U79PM97YTzkiMEgO+26W6ysdF1mFLzAb2QswRkmSdvEpJHrN8I7d/0qOlkRNk/7FnzaiwBIZ4zj43xT+QJz94xrQh9A3xQkfWun4huvmF8RtmBL53nB/wMjwfnDaT4WWAAAAABJRU5ErkJggg=="},80360:function(Ut,at,W){"use strict";W.d(at,{ZP:function(){return ws}});const V=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},de=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Ie},Ie=Number.MAX_SAFE_INTEGER||9007199254740991;let te=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}({}),M=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}({}),p=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 ce={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},J={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class l{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class z{constructor(e,t,i,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new l(e),this.fast_=new l(t),this.defaultTTFB_=n,this.ttfb_=new l(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new l(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new l(t,n.getEstimate(),n.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new l(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,n=e/1e3,s=i/n;this.fast_.sample(n,s),this.slow_.sample(n,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function x(a,e,t){return(e=F(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function m(){return m=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(a[i]=t[i])}return a},m.apply(null,arguments)}function _(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,i)}return t}function b(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_(Object(t),!0).forEach(function(i){x(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):_(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}function T(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var i=t.call(a,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function F(a){var e=T(a,"string");return typeof e=="symbol"?e:e+""}class C{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=P,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const P=function(){},w={trace:P,debug:P,log:P,warn:P,info:P,error:P};function I(){return m({},w)}function N(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):P}function q(a,e,t){return e[a]?e[a].bind(e):N(a,t)}const re=I();function le(a,e,t){const i=I();if(typeof console=="object"&&a===!0||typeof a=="object"){const n=["debug","log","info","warn","error"];n.forEach(s=>{i[s]=q(s,a,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.13`)}catch(s){return I()}n.forEach(s=>{re[s]=q(s,a)})}else m(re,i);return i}const H=re;function ye(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function be(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function Ee(a,e){const t=Object.keys(a),i=Object.keys(e),n=t.length,s=i.length;return!n||!s||n===s&&!t.some(r=>i.indexOf(r)===-1)}function We(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 i,n,s,r="",o=0;for(;o<t;){if(i=a[o++],i===0&&e)return r;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(i);break;case 12:case 13:n=a[o++],r+=String.fromCharCode((i&31)<<6|n&63);break;case 14:n=a[o++],s=a[o++],r+=String.fromCharCode((i&15)<<12|(n&63)<<6|(s&63)<<0);break}}return r}function $(a){let e="";for(let t=0;t<a.length;t++){let i=a[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function D(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function O(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var B={exports:{}},Q;function G(){return Q||(Q=1,function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\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 y=o.parseURL(c);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var E=n.exec(y.path);y.netLoc=E[1],y.path=E[2]}y.netLoc&&!y.path&&(y.path="/");var A={scheme:y.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(A.netLoc=y.netLoc,d.path[0]!=="/"))if(!d.path)A.path=y.path,d.params||(A.params=y.params,d.query||(A.query=y.query));else{var S=y.path,U=S.substring(0,S.lastIndexOf("/")+1)+d.path;A.path=o.normalizePath(U)}return A.path===null&&(A.path=h.alwaysNormalize?o.normalizePath(d.path):d.path),o.buildURLFromParts(A)},parseURL:function(c){var u=i.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})()}(B)),B.exports}var g=G();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 L={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class X{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,yt(this,"stats")}setByteRange(e,t){const i=e.split("@",2);let n;i.length===1?n=(t==null?void 0:t.byteRangeEndOffset)||0:n=parseInt(i[1]),this._byteRange=[n,parseInt(i[0])+n]}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={[L.AUDIO]:null,[L.VIDEO]:null,[L.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=g.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[L.AUDIO]=null,e[L.VIDEO]=null,e[L.AUDIOVIDEO]=null}}function Ae(a){return a.sn!=="initSegment"}class Be extends X{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(V(e)&&V(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(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const i=Object.keys(t);if(i.length===1){const n=this._decryptdata=t[i[0]]||null;n&&(this._decryptdata=n.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=V(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const i=Object.keys(this.levelkeys),n=i.length;if(n>1||n===1&&(t=this.levelkeys[i[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!V(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return Ae(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){const t=this.levelkeys;if(t){var i;const n=t[e];n&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=n.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,n,s,r=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:s,partial:r};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,i),c.startDTS=Math.min(c.startDTS,n),c.endDTS=Math.max(c.endDTS,s)}}class ht extends X{constructor(e,t,i,n,s){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;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 Ke(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||Ke(t,e)}}function yt(a,e){const t=Ke(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const ot=Math.pow(2,32)-1,je=[].push,zt={video:1,audio:2,id3:3,text:4};function Ft(a){return String.fromCharCode.apply(null,a)}function ci(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function pt(a,e){const t=we(a,e);return t<0?4294967296+t:t}function mi(a,e){let t=pt(a,e);return t*=Math.pow(2,32),t+=pt(a,e+4),t}function we(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function me(a){const e=a.byteLength;for(let t=0;t<e;){const i=pt(a,t);if(i>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=i>1?t+i:e}return!1}function ie(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const s=pt(a,n),r=Ft(a.subarray(n+4,n+8)),o=s>1?n+s:i;if(r===e[0])if(e.length===1)t.push(a.subarray(n+8,o));else{const c=ie(a.subarray(n+8,o),e.slice(1));c.length&&je.apply(t,c)}n=o}return t}function ke(a){const e=[],t=a[0];let i=8;const n=pt(a,i);i+=4;let s=0,r=0;t===0?(s=pt(a,i),r=pt(a,i+4),i+=8):(s=mi(a,i),r=mi(a,i+8),i+=16),i+=2;let o=a.length+r;const c=ci(a,i);i+=2;for(let u=0;u<c;u++){let h=i;const f=pt(a,h);h+=4;const d=f&2147483647;if((f&2147483648)>>>31===1)return H.warn("SIDX has hierarchical references (not supported)"),null;const E=pt(a,h);h+=4,e.push({referenceSize:d,subsegmentDuration:E,info:{duration:E/n,start:o,end:o+d-1}}),o+=d,h+=4,i=h}return{earliestPresentationTime:s,timescale:n,version:t,referencesCount:c,references:e}}function ze(a){const e=[],t=ie(a,["moov","trak"]);for(let n=0;n<t.length;n++){const s=t[n],r=ie(s,["tkhd"])[0];if(r){let o=r[0];const c=pt(r,o===0?12:20),u=ie(s,["mdia","mdhd"])[0];if(u){o=u[0];const h=pt(u,o===0?12:20),f=ie(s,["mdia","hdlr"])[0];if(f){const d=Ft(f.subarray(8,12)),y={soun:L.AUDIO,vide:L.VIDEO}[d],E=ie(s,["mdia","minf","stbl","stsd"])[0],A=Qe(E);y?(e[c]={timescale:h,type:y,stsd:A},e[y]=b({timescale:h,id:c},A)):e[c]={timescale:h,type:d,stsd:A}}}}}return ie(a,["moov","mvex","trex"]).forEach(n=>{const s=pt(n,4),r=e[s];r&&(r.default={duration:pt(n,12),flags:pt(n,20)})}),e}function Qe(a){const e=a.subarray(8),t=e.subarray(86),i=Ft(e.subarray(4,8));let n=i,s;const r=i==="enca"||i==="encv";if(r){const u=ie(e,[i])[0].subarray(i==="enca"?28:78);ie(u,["sinf"]).forEach(f=>{const d=ie(f,["schm"])[0];if(d){const y=Ft(d.subarray(4,8));if(y==="cbcs"||y==="cenc"){const E=ie(f,["frma"])[0];E&&(n=Ft(E))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=ie(t,["avcC"])[0];c&&c.length>3&&(n+="."+Te(c[1])+Te(c[2])+Te(c[3]),s=K(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=ie(e,[i])[0],u=ie(c.subarray(28),["esds"])[0];if(u&&u.length>7){let h=4;if(u[h++]!==3)break;h=Se(u,h),h+=2;const f=u[h++];if(f&128&&(h+=2),f&64&&(h+=u[h++]),u[h++]!==4)break;h=Se(u,h);const d=u[h++];if(d===64)n+="."+Te(d);else break;if(h+=12,u[h++]!==5)break;h=Se(u,h);const y=u[h++];let E=(y&248)>>3;E===31&&(E+=1+((y&7)<<3)+((u[h]&224)>>5)),n+="."+E}break}case"hvc1":case"hev1":{const c=ie(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],h=["","A","B","C"][u>>6],f=u&31,d=pt(c,2),y=(u&32)>>5?"H":"L",E=c[12],A=c.subarray(6,12);n+="."+h+f,n+="."+ne(d).toString(16).toUpperCase(),n+="."+y+E;let S="";for(let U=A.length;U--;){const j=A[U];(j||S)&&(S="."+j.toString(16).toUpperCase()+S)}n+=S}s=K(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=K(n,t)||n;break}case"vp09":{const c=ie(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],h=c[5],f=c[6]>>4&15;n+="."+Ne(u)+"."+Ne(h)+"."+Ne(f)}break}case"av01":{const c=ie(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,y=(c[2]&32)>>5,E=u===2&&d?y?12:10:d?10:8,A=(c[2]&16)>>4,S=(c[2]&8)>>3,U=(c[2]&4)>>2,j=c[2]&3;n+="."+u+"."+Ne(h)+f+"."+Ne(E)+"."+A+"."+S+U+j+"."+Ne(1)+"."+Ne(1)+"."+Ne(1)+"."+0,s=K("dav1",t)}break}}return{codec:n,encrypted:r,supplemental:s}}function K(a,e){const t=ie(e,["dvvC"]),i=t.length?t[0]:ie(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return a+"."+Ne(n)+"."+Ne(s)}}function ne(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function Se(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function Te(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function Ne(a){return(a<10?"0":"")+a}function He(a,e){if(!a||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&Xe(a,(i,n)=>{const s=i.subarray(8,24);s.some(r=>r!==0)||(H.log(`[eme] Patching keyId in 'enc${n?"a":"v"}>sinf>>tenc' box: ${$(s)} -> ${$(t)}`),i.set(t,8))})}function bt(a){const e=[];return Xe(a,t=>e.push(t.subarray(8,24))),e}function Xe(a,e){ie(a,["moov","trak"]).forEach(i=>{const n=ie(i,["mdia","minf","stbl","stsd"])[0];if(!n)return;const s=n.subarray(8);let r=ie(s,["enca"]);const o=r.length>0;o||(r=ie(s,["encv"])),r.forEach(c=>{const u=o?c.subarray(28):c.subarray(78);ie(u,["sinf"]).forEach(f=>{const d=lt(f);d&&e(d,o)})})})}function lt(a){const e=ie(a,["schm"])[0];if(e){const t=Ft(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const i=ie(a,["schi","tenc"])[0];if(i)return i}}}function qe(a,e,t){const i={},n=ie(a,["moof","traf"]);for(let s=0;s<n.length;s++){const r=n[s],o=ie(r,["tfhd"])[0],c=pt(o,4),u=e[c];if(!u)continue;i[c]||(i[c]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});const h=i[c],f=ie(r,["tfdt"])[0];if(f){const Y=f[0];let ue=pt(f,4);Y===1&&(ue===ot?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(ue*=ot+1,ue+=pt(f,8))),V(ue)&&(!V(h.start)||ue<h.start)&&(h.start=ue)}const d=u.default,y=pt(o,0)|(d==null?void 0:d.flags);let E=(d==null?void 0:d.duration)||0;y&8&&(y&2?E=pt(o,12):E=pt(o,8));const A=ie(r,["trun"]);let S=h.start||0,U=0,j=E;for(let Y=0;Y<A.length;Y++){const ue=A[Y],ge=pt(ue,4),Fe=h.sampleCount;h.sampleCount+=ge;const ve=ue[3]&1,Ce=ue[3]&4,Le=ue[2]&1,xe=ue[2]&2,et=ue[2]&4,St=ue[2]&8;let Pt=8,Wt=ge;for(ve&&(Pt+=4),Ce&&ge&&(!(ue[Pt+1]&1)&&h.keyFrameIndex===void 0&&(h.keyFrameIndex=Fe),Pt+=4,Le?(j=pt(ue,Pt),Pt+=4):j=E,xe&&(Pt+=4),St&&(Pt+=4),S+=j,U+=j,Wt--);Wt--;)Le?(j=pt(ue,Pt),Pt+=4):j=E,xe&&(Pt+=4),et&&(ue[Pt+1]&1||h.keyFrameIndex===void 0&&(h.keyFrameIndex=h.sampleCount-(Wt+1),h.keyFrameStart=S),Pt+=4),St&&(Pt+=4),S+=j,U+=j;!U&&E&&(U+=E*ge)}h.duration+=U}if(!Object.keys(i).some(s=>i[s].duration)){let s=1/0,r=0;const o=ie(a,["sidx"]);for(let c=0;c<o.length;c++){const u=ke(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&&V(r)&&Object.keys(i).forEach(c=>{i[c].duration||(i[c].duration=r*i[c].timescale-i[c].start)})}return i}function _t(a){const e={valid:null,remainder:null},t=ie(a,["moof"]);if(t.length<2)return e.remainder=a,e;const i=t[t.length-1];return e.valid=a.slice(0,i.byteOffset-8),e.remainder=a.slice(i.byteOffset-8),e}function ct(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=[],i=e.samples,n=e.timescale,s=e.id;let r=!1;return ie(i,["moof"]).map(c=>{const u=c.byteOffset-8;ie(c,["traf"]).map(f=>{const d=ie(f,["tfdt"]).map(y=>{const E=y[0];let A=pt(y,4);return E===1&&(A*=Math.pow(2,32),A+=pt(y,8)),A/n})[0];return d!==void 0&&(a=d),ie(f,["tfhd"]).map(y=>{const E=pt(y,4),A=pt(y,0)&16777215,S=(A&1)!==0,U=(A&2)!==0,j=(A&8)!==0;let Y=0;const ue=(A&16)!==0;let ge=0;const Fe=(A&32)!==0;let ve=8;E===s&&(S&&(ve+=8),U&&(ve+=4),j&&(Y=pt(y,ve),ve+=4),ue&&(ge=pt(y,ve),ve+=4),Fe&&(ve+=4),e.type==="video"&&(r=_e(e.codec)),ie(f,["trun"]).map(Ce=>{const Le=Ce[0],xe=pt(Ce,0)&16777215,et=(xe&1)!==0;let St=0;const Pt=(xe&4)!==0,Wt=(xe&256)!==0;let Ot=0;const vt=(xe&512)!==0;let Nt=0;const Rt=(xe&1024)!==0,Bt=(xe&2048)!==0;let si=0;const xt=pt(Ce,4);let Tt=8;et&&(St=pt(Ce,Tt),Tt+=4),Pt&&(Tt+=4);let Ei=St+u;for(let Gi=0;Gi<xt;Gi++){if(Wt?(Ot=pt(Ce,Tt),Tt+=4):Ot=Y,vt?(Nt=pt(Ce,Tt),Tt+=4):Nt=ge,Rt&&(Tt+=4),Bt&&(Le===0?si=pt(Ce,Tt):si=we(Ce,Tt),Tt+=4),e.type===L.VIDEO){let Ti=0;for(;Ti<Nt;){const Ci=pt(i,Ei);if(Ei+=4,Me(r,i[Ei])){const Nn=i.subarray(Ei,Ei+Ci);$e(Nn,r?2:1,a+si/n,t)}Ei+=Ci,Ti+=Ci+4}}a+=Ot/n}}))})})}),t}function _e(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function Me(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function $e(a,e,t,i){const n=Pe(a);let s=0;s+=e;let r=0,o=0,c=0;for(;s<n.length;){r=0;do{if(s>=n.length)break;c=n[s++],r+=c}while(c===255);o=0;do{if(s>=n.length)break;c=n[s++],o+=c}while(c===255);const u=n.length-s;let h=s;if(o<u)s+=o;else if(o>u){H.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(n[h++]===181){const d=ci(n,h);if(h+=2,d===49){const y=pt(n,h);if(h+=4,y===1195456820){const E=n[h++];if(E===3){const A=n[h++],S=31&A,U=64&A,j=U?2+S*3:0,Y=new Uint8Array(j);if(U){Y[0]=A;for(let ue=1;ue<j;ue++)Y[ue]=n[h++]}i.push({type:E,payloadType:r,pts:t,bytes:Y})}}}}}else if(r===5&&o>16){const f=[];for(let E=0;E<16;E++){const A=n[h++].toString(16);f.push(A.length==1?"0"+A:A),(E===3||E===5||E===7||E===9)&&f.push("-")}const d=o-16,y=new Uint8Array(d);for(let E=0;E<d;E++)y[E]=n[h++];i.push({payloadType:r,pts:t,uuid:f.join(""),userData:We(y),userDataBytes:y})}}}function Pe(a){const e=a.byteLength,t=[];let i=1;for(;i<e-2;)a[i]===0&&a[i+1]===0&&a[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return a;const n=e-t.length,s=new Uint8Array(n);let r=0;for(i=0;i<n;r++,i++)r===t[0]&&(r++,t.shift()),s[i]=a[r];return s}function st(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;Ft(a.subarray(u,u+1))!=="\0";)t+=Ft(a.subarray(u,u+1)),u+=1;for(t+=Ft(a.subarray(u,u+1)),u+=1;Ft(a.subarray(u,u+1))!=="\0";)i+=Ft(a.subarray(u,u+1)),u+=1;i+=Ft(a.subarray(u,u+1)),u+=1,n=pt(a,12),s=pt(a,16),o=pt(a,20),c=pt(a,24),u=28}else if(e===1){u+=4,n=pt(a,u),u+=4;const f=pt(a,u);u+=4;const d=pt(a,u);for(u+=4,r=xl(2,32)*f+d,de(r)||(r=Number.MAX_SAFE_INTEGER,H.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=pt(a,u),u+=4,c=pt(a,u),u+=4;Ft(a.subarray(u,u+1))!=="\0";)t+=Ft(a.subarray(u,u+1)),u+=1;for(t+=Ft(a.subarray(u,u+1)),u+=1;Ft(a.subarray(u,u+1))!=="\0";)i+=Ft(a.subarray(u,u+1)),u+=1;i+=Ft(a.subarray(u,u+1)),u+=1}const h=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:i,timeScale:n,presentationTime:r,presentationTimeDelta:s,eventDuration:o,id:c,payload:h}}function nt(a,...e){const t=e.length;let i=8,n=t;for(;n--;)i+=e[n].byteLength;const s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=i&255,s.set(a,4),n=0,i=8;n<t;n++)s.set(e[n],i),i+=e[n].byteLength;return s}function Je(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let i,n;i=0,n=new Uint8Array;let s;i>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const r=new Uint8Array(4);return t.byteLength>0&&new DataView(r.buffer).setUint32(0,t.byteLength,!1),nt([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t)}function ft(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let i=0;for(;i+32<t;){const n=new DataView(a,i),s=At(n);e.push(s),i+=s.size}}return e}function At(a){const e=a.getUint32(0),t=a.byteOffset,i=a.byteLength;if(i<e)return{offset:t,size:i};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const s=a.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};const r=a.buffer,o=$(new Uint8Array(r,t+12,16));let c=null,u=null,h=0;if(s===0)h=28;else{const d=a.getUint32(28);if(!d||i<32+d*16)return{offset:t,size:e};c=[];for(let y=0;y<d;y++)c.push(new Uint8Array(r,t+32+y*16,16));h=32+d*16}if(!h)return{offset:t,size:e};const f=a.getUint32(h);return e-32<f?{offset:t,size:e}:(u=new Uint8Array(r,t+h+4,f),{version:s,systemId:o,kids:c,data:u,offset:t,size:e})}const Ze=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),dt={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function fe(a,e){const t=dt[e];return!!t&&!!t[a.slice(0,4)]}function ae(a,e,t=!0){return!a.split(",").some(i=>!oe(i,e,t))}function oe(a,e,t=!0){var i;const n=ye(t);return(i=n==null?void 0:n.isTypeSupported(R(a,e)))!=null?i:!1}function R(a,e){return`${e}/mp4;codecs=${a}`}function k(a){if(a){const e=a.substring(0,4);return dt.video[e]}return 2}function Z(a){const e=Ze();return a.split(",").reduce((t,i)=>{const s=e&&_e(i)?9:dt.video[i];return s?(s*2+t)/(t?3:2):(dt.audio[i]+t)/(t?2:1)},0)}const ee={};function se(a,e=!0){if(ee[a])return ee[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let n=0;n<t.length;n++){var i;if(oe(t[n],"audio",e))return ee[a]=t[n],t[n];if(t[n]==="mp3"&&(i=ye(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const Ue=/flac|opus|mp4a\.40\.34/i;function Ge(a,e=!0){return a.replace(Ue,t=>se(t.toLowerCase(),e))}function tt(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)fe(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function gt(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(wt(a,"audio")||wt(a,"video")))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let i=t.length;i--;)if(t[i].substring(0,4)===a.substring(0,4))return t[i]}return t[0]}}return e||a}function wt(a,e){return fe(a,e)&&oe(a,e)}function $t(a){const e=a.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function Dt(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return a}function rt(a){const e=ye(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 Lt(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Jt={supported:!0,powerEfficient:!0,smooth:!0},Xt={supported:!1,smooth:!1,powerEfficient:!1},ri={supported:!0,configurations:[],decodingInfoResults:[Jt]};function Vt(a,e){return{supported:!1,configurations:e,decodingInfoResults:[Xt],error:a}}function jt(a,e,t,i,n,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,y)=>{if(y){const E=e.groups[y];if(!E)throw new Error(`Audio track group ${y} not found`);Object.keys(E.channels).forEach(A=>{d[A]=(d[A]||0)+E.channels[A]})}return d},{2:0})}catch(d){return!0}return r!==void 0&&(r.split(",").some(d=>_e(d))||a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(i,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(n,8e6))||!!f&&V(h)&&Object.keys(f).some(d=>parseInt(d)>h)}function Fi(a,e,t,i={}){const n=a.videoCodec;if(!n&&!a.audioCodec||!t)return Promise.resolve(ri);const s=[],r=ki(a),o=r.length,c=qi(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(n){const h=navigator.userAgent;if(n.split(",").some(f=>_e(f))&&Ze())return Promise.resolve(Vt(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${h})`),s))}return Promise.all(s.map(h=>{const f=hi(h);return i[f]||(i[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 ki(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),i=_n(a),n=a.width||640,s=a.height||480,r=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(c=>{const u={contentType:R(Dt(c),"video"),width:n,height:s,bitrate:i,framerate:r};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function qi(a,e,t){var i;const n=(i=a.audioCodec)==null?void 0:i.split(","),s=_n(a);return n&&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||"");n.forEach(y=>{const E={contentType:R(y,"audio"),bitrate:t?wi(y,s):s};d&&(E.channels=""+d),h.push(E)})}return h},r):r},[]):[]}function wi(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 _n(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function hi(a){let e="";const{audio:t,video:i}=a;if(i){const n=Lt(i.contentType);e+=`${n}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){const n=Lt(t.contentType);e+=`${i?"_":""}${n}_c${t.channels}`}return e}const Di=["NONE","TYPE-0","TYPE-1",null];function Hi(a){return Di.indexOf(a)>-1}const ii=["SDR","PQ","HLG"];function Vi(a){return!!a&&ii.indexOf(a)>-1}var Ai={No:"",Yes:"YES",v2:"v2"};function un(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?Ai.v2:Ai.Yes:Ai.No}class Wi{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class nn{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return kn(this._audioGroups,e)}hasSubtitleGroup(e){return kn(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function kn(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function Ht(){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 Ct(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||ii.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&Ht(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const pe=a=>{const e=new WeakSet;return(t,i)=>{if(a&&(i=a(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},De=(a,e)=>JSON.stringify(a,pe(e));function Ve(a,e,t,i,n){const s=Object.keys(a),r=i==null?void 0:i.channels,o=i==null?void 0:i.audioCodec,c=n==null?void 0:n.videoCodec,u=r&&parseInt(r)===2;let h=!1,f=!1,d=1/0,y=1/0,E=1/0,A=1/0,S=0,U=[];const{preferHDR:j,allowedVideoRanges:Y}=Ct(e,n);for(let Ce=s.length;Ce--;){const Le=a[s[Ce]];h||(h=Le.channels[2]>0),d=Math.min(d,Le.minHeight),y=Math.min(y,Le.minFramerate),E=Math.min(E,Le.minBitrate),Y.filter(et=>Le.videoRanges[et]>0).length>0&&(f=!0)}d=V(d)?d:0,y=V(y)?y:0;const ue=Math.max(1080,d),ge=Math.max(30,y);E=V(E)?E:t,t=Math.max(E,t),f||(e=void 0);const Fe=s.length>1;return{codecSet:s.reduce((Ce,Le)=>{const xe=a[Le];if(Le===Ce)return Ce;if(U=f?Y.filter(et=>xe.videoRanges[et]>0):[],Fe){if(xe.minBitrate>t)return Oe(Le,`min bitrate of ${xe.minBitrate} > current estimate of ${t}`),Ce;if(!xe.hasDefaultAudio)return Oe(Le,"no renditions with default or auto-select sound found"),Ce;if(o&&Le.indexOf(o.substring(0,4))%5!==0)return Oe(Le,`audio codec preference "${o}" not found`),Ce;if(r&&!u){if(!xe.channels[r])return Oe(Le,`no renditions with ${r} channel sound found (channels options: ${Object.keys(xe.channels)})`),Ce}else if((!o||u)&&h&&xe.channels[2]===0)return Oe(Le,"no renditions with stereo sound found"),Ce;if(xe.minHeight>ue)return Oe(Le,`min resolution of ${xe.minHeight} > maximum of ${ue}`),Ce;if(xe.minFramerate>ge)return Oe(Le,`min framerate of ${xe.minFramerate} > maximum of ${ge}`),Ce;if(!U.some(et=>xe.videoRanges[et]>0))return Oe(Le,`no variants with VIDEO-RANGE of ${De(U)} found`),Ce;if(c&&Le.indexOf(c.substring(0,4))%5!==0)return Oe(Le,`video codec preference "${c}" not found`),Ce;if(xe.maxScore<S)return Oe(Le,`max score of ${xe.maxScore} < selected max of ${S}`),Ce}return Ce&&(Z(Le)>=Z(Ce)||xe.fragmentError>a[Ce].fragmentError)?Ce:(A=xe.minIndex,S=xe.maxScore,Le)},void 0),videoRanges:U,preferHDR:j,minFramerate:y,minBitrate:E,minIndex:A}}function Oe(a,e){H.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function it(a){return a.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const n=t.channels||"2";return i.channels[n]=(i.channels[n]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function ut(a,e,t,i){return a.slice(t,i+1).reduce((n,s,r)=>{if(!s.codecSet)return n;const o=s.audioGroups;let c=n[s.codecSet];c||(n[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]}))}),n},{})}function mt(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:s}=a;return{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:s}}function Et(a,e,t){if("attrs"in a){const i=e.indexOf(a);if(i!==-1)return i}for(let i=0;i<e.length;i++){const n=e[i];if(ti(a,n,t))return i}return-1}function ti(a,e,t){const{groupId:i,name:n,lang:s,assocLang:r,default:o}=a,c=a.forced;return(i===void 0||e.groupId===i)&&(n===void 0||e.name===n)&&(s===void 0||Zt(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||Li(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function Zt(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function Li(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function kt(a,e){const{audioCodec:t,channels:i}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function ei(a,e,t,i,n){const s=e[i],o=e.reduce((d,y,E)=>{const A=y.uri;return(d[A]||(d[A]=[])).push(E),d},{})[s.uri];o.length>1&&(i=Math.max.apply(Math,o));const c=s.videoRange,u=s.frameRate,h=s.codecSet.substring(0,4),f=Qt(e,i,d=>{if(d.videoRange!==c||d.frameRate!==u||d.codecSet.substring(0,4)!==h)return!1;const y=d.audioGroups,E=t.filter(A=>!y||y.indexOf(A.groupId)!==-1);return Et(a,E,n)>-1});return f>-1?f:Qt(e,i,d=>{const y=d.audioGroups,E=t.filter(A=>!y||y.indexOf(A.groupId)!==-1);return Et(a,E,n)>-1})}function Qt(a,e,t){for(let i=e;i>-1;i--)if(t(a[i]))return i;for(let i=e+1;i<a.length;i++)if(t(a[i]))return i;return-1}function ai(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class di extends C{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:n,partCurrent:s,hls:r}=this,{autoLevelEnabled:o,media:c}=r;if(!n||!c)return;const u=performance.now(),h=s?s.stats:n.stats,f=s?s.duration:n.duration,d=u-h.loading.start,y=r.minAutoLevel,E=n.level,A=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||E<=y){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const S=A>-1&&A!==E,U=!!t||S;if(!U&&(c.paused||!c.playbackRate||!c.readyState))return;const j=r.mainForwardBufferInfo;if(!U&&j===null)return;const Y=this.bwEstimator.getEstimateTTFB(),ue=Math.abs(c.playbackRate);if(d<=Math.max(Y,1e3*(f/(ue*2))))return;const ge=j?j.len/ue:0,Fe=h.loading.first?h.loading.first-h.loading.start:-1,ve=h.loaded&&Fe>-1,Ce=this.getBwEstimate(),Le=r.levels,xe=Le[E],et=Math.max(h.loaded,Math.round(f*(n.bitrate||xe.averageBitrate)/8));let St=ve?d-Fe:d;St<1&&ve&&(St=Math.min(d,h.loaded*8/Ce));const Pt=ve?h.loaded*1e3/St:0,Wt=Y/1e3,Ot=Pt?(et-h.loaded)/Pt:et*8/Ce+Wt;if(Ot<=ge)return;const vt=Pt?Pt*8:Ce,Nt=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,Rt=this.hls.config.abrBandWidthUpFactor;let Bt=Number.POSITIVE_INFINITY,si;for(si=E-1;si>y;si--){const Gi=Le[si].maxBitrate,Ti=!Le[si].details||Nt;if(Bt=this.getTimeToLoadFrag(Wt,vt,f*Gi,Ti),Bt<Math.min(ge,f+Wt))break}if(Bt>=Ot||Bt>f*10)return;ve?this.bwEstimator.sample(d-Math.min(Y,Fe),h.loaded):this.bwEstimator.sampleTTFB(d);const xt=Le[si].maxBitrate;this.getBwEstimate()*Rt>xt&&this.resetEstimator(xt);const Tt=this.findBestLevel(xt,y,si,0,ge,1,1);Tt>-1&&(si=Tt),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${E} is loading too slowly;
|
|
Fragment duration: ${n.duration.toFixed(3)}
|
|
Time to underbuffer: ${ge.toFixed(3)} s
|
|
Estimated load time for current fragment: ${Ot.toFixed(3)} s
|
|
Estimated load time for down switch fragment: ${Bt.toFixed(3)} s
|
|
TTFB estimate: ${Fe|0} ms
|
|
Current BW estimate: ${V(Ce)?Ce|0:"Unknown"} bps
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
Switching to level ${si} @ ${xt|0} bps`),r.nextLoadLevel=r.nextAutoLevel=si,this.clearTimer();const Ei=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===si&&si>0){const Gi=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${si>0?"and switching down":""}
|
|
Fragment duration: ${n.duration.toFixed(3)} s
|
|
Time to underbuffer: ${Gi.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,si>y){let Ti=this.findBestLevel(this.hls.levels[y].bitrate,y,si,0,Gi,1,1);Ti===-1&&(Ti=y),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Ti,this.resetEstimator(this.hls.levels[Ti].bitrate)}}};S||Ot>Bt*2?Ei():this.timer=self.setInterval(Ei,Bt*1e3),r.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,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 z(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(p.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var n;this.fragCurrent=i,this.partCurrent=(n=t.part)!=null?n:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case M.BUFFER_ADD_CODEC_ERROR:case M.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case M.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:n,partCurrent:s}=this;if(i&&n&&i.sn===n.sn&&i.level===n.level){const r=performance.now(),o=s?s.stats:i.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,i,n){const s=e+i/t,r=n?e+this.lastLevelLoadSec:0;return s+r}onLevelLoaded(e,t){const i=this.hls.config,{loading:n}=t.stats,s=n.end-n.first;V(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===J.MAIN&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=i?i.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+n.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:n,frag:t,part:i,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,s=n!=null&&n.stats.loaded?n.stats:i.stats;if(s.aborted||this.ignoreFragment(i))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(),i.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==J.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,s=this.findBestLevel(i,t,e,0,n,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,i=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=i&&n?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:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:n,config:s,minAutoLevel:r}=i,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let h=s.abrBandWidthFactor,f=s.abrBandWidthUpFactor;if(u){const S=this.findBestLevel(c,r,n,u,0,h,f);if(S>=0)return this.rebufferNotice=-1,S}let d=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const S=this.bitrateTestDelay;S&&(d=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-S,this.info(`bitrate test took ${Math.round(1e3*S)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),h=f=1)}const y=this.findBestLevel(c,r,n,u,d,h,f);if(this.rebufferNotice!==y&&(this.rebufferNotice=y,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${y}`)),y>-1)return y;const E=i.levels[r],A=i.loadLevelObj;return A&&(E==null?void 0:E.bitrate)<A.bitrate?r:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,n,s,r,o){var c;const u=n+s,h=this.lastLoadedFragLevel,f=h===-1?this.hls.firstLevel:h,{fragCurrent:d,partCurrent:y}=this,{levels:E,allAudioTracks:A,loadLevel:S,config:U}=this.hls;if(E.length===1)return 0;const j=E[f],Y=!!((c=this.hls.latestLevelDetails)!=null&&c.live),ue=S===-1||h===-1;let ge,Fe="SDR",ve=(j==null?void 0:j.frameRate)||0;const{audioPreference:Ce,videoPreference:Le}=U,xe=this.audioTracksByGroup||(this.audioTracksByGroup=it(A));let et=-1;if(ue){if(this.firstSelection!==-1)return this.firstSelection;const vt=this.codecTiers||(this.codecTiers=ut(E,xe,t,i)),Nt=Ve(vt,Fe,e,Ce,Le),{codecSet:Rt,videoRanges:Bt,minFramerate:si,minBitrate:xt,minIndex:Tt,preferHDR:Ei}=Nt;et=Tt,ge=Rt,Fe=Ei?Bt[Bt.length-1]:Bt[0],ve=si,e=Math.max(e,xt),this.log(`picked start tier ${De(Nt)}`)}else ge=j==null?void 0:j.codecSet,Fe=j==null?void 0:j.videoRange;const St=y?y.duration:d?d.duration:0,Pt=this.bwEstimator.getEstimateTTFB()/1e3,Wt=[];for(let vt=i;vt>=t;vt--){var Ot;const Nt=E[vt],Rt=vt>f;if(!Nt)continue;if(U.useMediaCapabilities&&!Nt.supportedResult&&!Nt.supportedPromise){const Ti=navigator.mediaCapabilities;typeof(Ti==null?void 0:Ti.decodingInfo)=="function"&&jt(Nt,xe,Fe,ve,e,Ce)?(Nt.supportedPromise=Fi(Nt,xe,Ti,this.supportedCache),Nt.supportedPromise.then(Ci=>{if(!this.hls)return;Nt.supportedResult=Ci;const Nn=this.hls.levels,Cn=Nn.indexOf(Nt);Ci.error?this.warn(`MediaCapabilities decodingInfo error: "${Ci.error}" for level ${Cn} ${De(Ci)}`):Ci.supported?Ci.decodingInfoResults.some(is=>is.smooth===!1||is.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Cn} not smooth or powerEfficient: ${De(Ci)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Cn} ${De(Ci)}`),Cn>-1&&Nn.length>1&&(this.log(`Removing unsupported level ${Cn}`),this.hls.removeLevel(Cn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Ci=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Ci}`)})):Nt.supportedResult=ri}if((ge&&Nt.codecSet!==ge||Fe&&Nt.videoRange!==Fe||Rt&&ve>Nt.frameRate||!Rt&&ve>0&&ve<Nt.frameRate||(Ot=Nt.supportedResult)!=null&&(Ot=Ot.decodingInfoResults)!=null&&Ot.some(Ti=>Ti.smooth===!1))&&(!ue||vt!==et)){Wt.push(vt);continue}const Bt=Nt.details,si=(y?Bt==null?void 0:Bt.partTarget:Bt==null?void 0:Bt.averagetargetduration)||St;let xt;Rt?xt=o*e:xt=r*e;const Tt=St&&n>=St*2&&s===0?Nt.averageBitrate:Nt.maxBitrate,Ei=this.getTimeToLoadFrag(Pt,xt,Tt*si,Bt===void 0);if(xt>=Tt&&(vt===h||Nt.loadError===0&&Nt.fragmentError===0)&&(Ei<=Pt||!V(Ei)||Y&&!this.bitrateTestDelay||Ei<u)){const Ti=this.forcedAutoLevel;return vt!==S&&(Ti===-1||Ti!==S)&&(Wt.length&&this.trace(`Skipped level(s) ${Wt.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${E[Wt[0]].codecs}" ${E[Wt[0]].videoRange}; not compatible with "${ge}" ${Fe}`),this.info(`switch candidate:${f}->${vt} adjustedbw(${Math.round(xt)})-bitrate=${Math.round(xt-Tt)} ttfb:${Pt.toFixed(1)} avgDuration:${si.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${Ei.toFixed(1)} firstSelection:${ue} codecSet:${Nt.codecSet} videoRange:${Nt.videoRange} hls.loadLevel:${S}`)),ue&&(this.firstSelection=vt),vt}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}}const Kt={search:function(a,e){let t=0,i=a.length-1,n=null,s=null;for(;t<=i;){n=(t+i)/2|0,s=a[n];const r=e(s);if(r>0)t=n+1;else if(r<0)i=n-1;else return s}return null}};function qt(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!V(e))return null;const i=a[0].programDateTime;if(e<(i||0))return null;const n=a[a.length-1].endProgramDateTime;if(e>=(n||0))return null;for(let s=0;s<a.length;++s){const r=a[s];if(Ri(e,t,r))return r}return null}function pi(a,e,t=0,i=0,n=.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)&&ni(t,i,s)===0||li(s,a,Math.min(n,i))))return s;const r=Kt.search(e,ni.bind(null,t,i));return r&&(r!==a||!s)?r:s}function li(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((n,s)=>(s[0]==="INF"&&(n+=parseFloat(s[1])),n),t);return a.start<=i}return!1}function ni(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=a?1:t.start-i>a&&t.start?-1:0}function Ri(a,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>a}function fi(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let i=a.fragments;const{fragmentHint:n}=a;n&&(i=i.concat(n));let s;return Kt.search(i,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 bi(a){switch(a.details){case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_TIMEOUT:case M.LEVEL_LOAD_TIMEOUT:case M.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function ji(a){return a.details.startsWith("key")}function Mi(a){return ji(a)&&!!a.frag&&!a.frag.decryptdata}function cn(a,e){const t=bi(e);return a.default[`${t?"timeout":"error"}Retry`]}function $i(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function Zi(a){return b(b({},a),{errorRetry:null,timeoutRetry:null})}function Ji(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(zi(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,s):s}function zi(a){return Ki(a)||!!a&&(a<400||a>499)}function Ki(a){return a===0&&navigator.onLine===!1}var xi={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},yi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class En extends C{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(p.ERROR,this.onError,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.ERROR,this.onError,this),e.off(p.ERROR,this.onErrorOut,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.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)===J.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||i===-1?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if((i=e.details)!=null&&i.hasKey(t))return!0;const n=e.audioGroups;if(n)return this.hls.allAudioTracks.filter(r=>n.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 i;if(t.fatal)return;const n=this.hls,s=t.context;switch(t.details){case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case M.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Si();return}case M.FRAG_GAP:case M.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=xi.SendAlternateToPenaltyBox;return}case M.LEVEL_EMPTY_ERROR:case M.LEVEL_PARSING_ERROR:{var r;const c=t.parent===J.MAIN?t.level:n.loadLevel;t.details===M.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 M.LEVEL_LOAD_ERROR:case M.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case M.AUDIO_TRACK_LOAD_ERROR:case M.AUDIO_TRACK_LOAD_TIMEOUT:case M.SUBTITLE_LOAD_ERROR:case M.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const c=n.loadLevelObj;if(c&&(s.type===ce.AUDIO_TRACK&&c.hasAudioGroup(s.groupId)||s.type===ce.SUBTITLE_TRACK&&c.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=xi.SendAlternateToPenaltyBox,t.errorAction.flags=yi.MoveAllAlternatesMatchingHost;return}}return;case M.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:xi.SendAlternateToPenaltyBox,flags:yi.MoveAllAlternatesMatchingHDCP};return;case M.KEY_SYSTEM_SESSION_UPDATE_FAILED:case M.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case M.KEY_SYSTEM_NO_SESSION:t.errorAction={action:xi.SendAlternateToPenaltyBox,flags:yi.MoveAllAlternatesMatchingKey};return;case M.BUFFER_ADD_CODEC_ERROR:case M.REMUX_ALLOC_ERROR:case M.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:n.loadLevel)}return;case M.INTERNAL_EXCEPTION:case M.BUFFER_APPENDING_ERROR:case M.BUFFER_FULL_ERROR:case M.LEVEL_SWITCH_ERROR:case M.BUFFER_STALLED_ERROR:case M.BUFFER_SEEK_OVER_HOLE:case M.BUFFER_NUDGE_ON_STALL:t.errorAction=Si();return}t.type===te.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Si())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,n=cn(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(Ji(n,s,bi(e),e.response))return{action:xi.RetryRequest,flags:yi.None,retryConfig:n,retryCount:s};const o=this.getLevelSwitchAction(e,t);return n&&(o.retryConfig=n,o.retryCount=s),o}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:s,keyLoadPolicy:r}=t.config,o=cn(ji(e)?r:s,e),c=t.levels.reduce((h,f)=>h+f.fragmentError,0);if(n&&(e.details!==M.FRAG_GAP&&n.fragmentError++,!Mi(e)&&Ji(o,c,bi(e),e.response)))return{action:xi.RetryRequest,flags:yi.None,retryConfig:o,retryCount:c};const u=this.getLevelSwitchAction(e,i);return o&&(u.retryConfig=o,u.retryCount=c),u}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var s,r;const u=e.details;n.loadError++,u===M.BUFFER_APPEND_ERROR&&n.fragmentError++;let h=-1;const{levels:f,loadLevel:d,minAutoLevel:y,maxAutoLevel:E}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const A=(s=e.frag)==null?void 0:s.type,U=(A===J.AUDIO&&u===M.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===M.BUFFER_ADD_CODEC_ERROR||u===M.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:Fe})=>n.audioCodec!==Fe),Y=e.sourceBufferName==="video"&&(u===M.BUFFER_ADD_CODEC_ERROR||u===M.BUFFER_APPEND_ERROR)&&f.some(({codecSet:Fe,audioCodec:ve})=>n.codecSet!==Fe&&n.audioCodec===ve),{type:ue,groupId:ge}=(r=e.context)!=null?r:{};for(let Fe=f.length;Fe--;){const ve=(Fe+d)%f.length;if(ve!==d&&ve>=y&&ve<=E&&f[ve].loadError===0){var o,c;const Ce=f[ve];if(u===M.FRAG_GAP&&A===J.MAIN&&e.frag){const Le=f[ve].details;if(Le){const xe=pi(e.frag,Le.fragments,e.frag.start);if(xe!=null&&xe.gap)continue}}else{if(ue===ce.AUDIO_TRACK&&Ce.hasAudioGroup(ge)||ue===ce.SUBTITLE_TRACK&&Ce.hasSubtitleGroup(ge))continue;if(A===J.AUDIO&&(o=n.audioGroups)!=null&&o.some(Le=>Ce.hasAudioGroup(Le))||A===J.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(Le=>Ce.hasSubtitleGroup(Le))||U&&n.audioCodec===Ce.audioCodec||Y&&n.codecSet===Ce.codecSet||!U&&n.codecSet!==Ce.codecSet)continue}h=ve;break}}if(h>-1&&i.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:xi.SendAlternateToPenaltyBox,flags:yi.None,nextAutoLevel:h}}return{action:xi.SendAlternateToPenaltyBox,flags:yi.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case xi.DoNothing:break;case xi.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==M.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 xi.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n}=i,s=i.nextAutoLevel;switch(n){case yi.None:this.switchLevel(e,s);break;case yi.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),u=t.levels[c],h=u==null?void 0:u.attrs["HDCP-LEVEL"];if(i.hdcpLevel=h,h==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(h){t.maxHdcpLevel=Di[Di.indexOf(h)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case yi.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const u=this.hls.levels,h=u.length;for(let d=h;d--;)if(this.variantHasKey(u[d],c)){var r,o;this.log(`Banned key found in level ${d} (${u[d].bitrate}bps) or audio group "${(r=u[d].audioGroups)==null?void 0:r.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${$(c.keyId||[])}`),u[d].fragmentError++,u[d].loadError++,this.log(`Removing level ${d} with key error (${e.error})`),this.hls.removeLevel(d)}const f=e.frag;if(this.hls.levels.length<h)i.resolved=!0;else if(f&&f.type!==J.MAIN){const d=f.decryptdata;d&&!c.matches(d)&&(i.resolved=!0)}}break}}i.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===M.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=Lt(e.mimeType),n=this.hls.levels;for(let s=n.length;s--;)n[s][`${e.sourceBufferName}Codec`]===i&&(this.log(`Removing level ${s} for ${e.details} ("${i}" not supported)`),this.hls.removeLevel(s))}}}function Si(a){const e={action:xi.DoNothing,flags:yi.None};return a&&(e.resolved=!0),e}var oi={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class vn{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let n=i.length;n--;){const s=i[n];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,i){const{fragments:n}=this,s=Object.keys(n);for(let r=s.length;r--;){const o=n[s[r]];if((o==null?void 0:o.body.type)===t&&(!i||o.buffered)){const c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,i,n,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(n==null?void 0:n.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===i&&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 i=e.frag,n=Yi(i),s=this.fragments[n];if(!s||s.buffered&&i.gap)return;const r=!i.relurl;Object.keys(t).forEach(o=>{const c=i.elementaryStreams[o];if(!c)return;const u=t[o],h=r||c.partial===!0;s.range[o]=this.getBufferedTimes(i,e.part,h,u)}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=i.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),Tn(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=wn(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=Yi(e);let n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(e,t,i,n){const s={time:[],partial:i},r=e.start,o=e.end,c=e.minEndPTS||o,u=e.maxStartPTS||r;for(let h=0;h<n.length;h++){const f=n.start(h)-this.bufferPadding,d=n.end(h)+this.bufferPadding;if(u>=f&&c<=d){s.time.push({startPTS:Math.max(r,n.start(h)),endPTS:Math.min(o,n.end(h))});break}else if(r<d&&o>f){const y=Math.max(r,n.start(h)),E=Math.min(o,n.end(h));E>y&&(s.partial=!0,s.time.push({startPTS:y,endPTS:E}))}else if(o<=f)break}return s}getPartialFragment(e){let t=null,i,n,s,r=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(u=>{const h=c[u];h&&Tn(h)&&(n=h.body.start-o,s=h.body.end+o,e>=n&&e<=s&&(i=Math.min(e-n,s-e),r<=i&&(t=h.body,r=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Tn(t))}getState(e){const t=Yi(e),i=this.fragments[t];return i?i.buffered?Tn(i)?oi.PARTIAL:oi.OK:oi.APPENDING:oi.NOT_LOADED}isTimeBuffered(e,t,i){let n,s;for(let r=0;r<i.length;r++){if(n=i.start(r)-this.bufferPadding,s=i.end(r)+this.bufferPadding,e>=n&&t<=s)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,n=t.part?null:t,s=Yi(i);this.fragments[s]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:s,type:r}=t;if(i.sn==="initSegment")return;const o=i.type;if(n){let u=this.activePartLists[o];u||(this.activePartLists[o]=u=[]),u.push(n)}this.timeRanges=s;const c=s[r];this.detectEvictedFragments(r,c,o,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Yi(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let n=i.length;n--;){const s=t[i[n]];if((s==null?void 0:s.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,n,s){n&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const o=this.fragments[r];if(!o)return;const c=o.body;c.type!==i||n&&!c.gap||c.start<t&&c.end>e&&(o.buffered||s)&&this.removeFragment(c)})}removeFragment(e){const t=Yi(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=wn(i,s=>s.fragment.sn!==n)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(i=>i.clearElementaryStreamInfo())}}function Tn(a){var e,t,i;return a.buffered&&!!(a.body.gap||(e=a.range.video)!=null&&e.partial||(t=a.range.audio)!=null&&t.partial||(i=a.range.audiovideo)!=null&&i.partial)}function Yi(a){return`${a.type}_${a.level}_${a.sn}`}function wn(a,e){return a.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Bi={cbc:0,ctr:1};class an{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case Bi.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Bi.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 Un(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class Sn{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let n=0;n<4;n++)i[n]=t.getUint32(n*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],s=i[1],r=i[2],o=i[3],c=this.invSubMix,u=c[0],h=c[1],f=c[2],d=c[3],y=new Uint32Array(256);let E=0,A=0,S=0;for(S=0;S<256;S++)S<128?y[S]=S<<1:y[S]=S<<1^283;for(S=0;S<256;S++){let U=A^A<<1^A<<2^A<<3^A<<4;U=U>>>8^U&255^99,e[E]=U,t[U]=E;const j=y[E],Y=y[j],ue=y[Y];let ge=y[U]*257^U*16843008;n[E]=ge<<24|ge>>>8,s[E]=ge<<16|ge>>>16,r[E]=ge<<8|ge>>>24,o[E]=ge,ge=ue*16843009^Y*65537^j*257^E*16843008,u[U]=ge<<24|ge>>>8,h[U]=ge<<16|ge>>>16,f[U]=ge<<8|ge>>>24,d[U]=ge,E?(E=j^y[y[y[ue^j]]],A^=y[y[A]]):E=A=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,n=0;for(;n<t.length&&i;)i=t[n]===this.key[n],n++;if(i)return;this.key=t;const 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,y=this.invSubMix,E=y[0],A=y[1],S=y[2],U=y[3];let j,Y;for(o=0;o<r;o++){if(o<s){j=u[o]=t[o];continue}Y=j,o%s===0?(Y=Y<<8|Y>>>24,Y=f[Y>>>24]<<24|f[Y>>>16&255]<<16|f[Y>>>8&255]<<8|f[Y&255],Y^=d[o/s|0]<<24):s>6&&o%s===4&&(Y=f[Y>>>24]<<24|f[Y>>>16&255]<<16|f[Y>>>8&255]<<8|f[Y&255]),u[o]=j=(u[o-s]^Y)>>>0}for(c=0;c<r;c++)o=r-c,c&3?Y=u[o]:Y=u[o-4],c<4||o<=4?h[c]=Y:h[c]=E[f[Y>>>24]]^A[f[Y>>>16&255]]^S[f[Y>>>8&255]]^U[f[Y&255]],h[c]=h[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const n=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_(i);let y=d[0],E=d[1],A=d[2],S=d[3];const U=new Int32Array(e),j=new Int32Array(U.length);let Y,ue,ge,Fe,ve,Ce,Le,xe,et,St,Pt,Wt,Ot,vt;const Nt=this.networkToHostOrderSwap;for(;t<U.length;){for(et=Nt(U[t]),St=Nt(U[t+1]),Pt=Nt(U[t+2]),Wt=Nt(U[t+3]),ve=et^s[0],Ce=Wt^s[1],Le=Pt^s[2],xe=St^s[3],Ot=4,vt=1;vt<n;vt++)Y=c[ve>>>24]^u[Ce>>16&255]^h[Le>>8&255]^f[xe&255]^s[Ot],ue=c[Ce>>>24]^u[Le>>16&255]^h[xe>>8&255]^f[ve&255]^s[Ot+1],ge=c[Le>>>24]^u[xe>>16&255]^h[ve>>8&255]^f[Ce&255]^s[Ot+2],Fe=c[xe>>>24]^u[ve>>16&255]^h[Ce>>8&255]^f[Le&255]^s[Ot+3],ve=Y,Ce=ue,Le=ge,xe=Fe,Ot=Ot+4;Y=r[ve>>>24]<<24^r[Ce>>16&255]<<16^r[Le>>8&255]<<8^r[xe&255]^s[Ot],ue=r[Ce>>>24]<<24^r[Le>>16&255]<<16^r[xe>>8&255]<<8^r[ve&255]^s[Ot+1],ge=r[Le>>>24]<<24^r[xe>>16&255]<<16^r[ve>>8&255]<<8^r[Ce&255]^s[Ot+2],Fe=r[xe>>>24]<<24^r[ve>>16&255]<<16^r[Ce>>8&255]<<8^r[Le&255]^s[Ot+3],j[t]=Nt(Y^y),j[t+1]=Nt(Fe^E),j[t+2]=Nt(ge^A),j[t+3]=Nt(ue^S),y=et,E=St,A=Pt,S=Wt,t=t+4}return j.buffer}}class bn{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=Qi(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function Qi(a){switch(a){case Bi.cbc:return"AES-CBC";case Bi.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const fn=16;class yn{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(i){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Un(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,n){return this.useSoftware?new Promise((s,r)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,i,n);const c=this.flush();c?s(c.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}softwareDecrypt(e,t,i,n){const{currentIV:s,currentResult:r,remainderData:o}=this;if(n!==Bi.cbc||t.byteLength!==16)return H.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=ct(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;s&&(i=s);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new Sn),u.expandKey(t);const h=r;return this.currentResult=u.decrypt(c.buffer,0,i),this.currentIV=c.slice(-16).buffer,h||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new bn(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new an(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(H.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i,n)))}onWebCryptoError(e,t,i,n){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%fn;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(H.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Ln=Math.pow(2,17);class en{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new dn({type:te.NETWORK_ERROR,details:M.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(E=>E[0]==="GAP")){c(An(e));return}else e.gap=!1;const u=this.loader=s?new s(n):new r(n),h=hn(e);e.loader=u;const f=Zi(n.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Ln};e.stats=u.stats;const y={onSuccess:(E,A,S,U)=>{this.resetLoader(e,u);let j=E.data;S.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(j.slice(0,16)),j=j.slice(16)),o({frag:e,part:null,payload:j,networkDetails:U})},onError:(E,A,S,U)=>{this.resetLoader(e,u),c(new dn({type:te.NETWORK_ERROR,details:M.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:b({url:i,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:S,stats:U}))},onAbort:(E,A,S)=>{this.resetLoader(e,u),c(new dn({type:te.NETWORK_ERROR,details:M.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:S,stats:E}))},onTimeout:(E,A,S)=>{this.resetLoader(e,u),c(new dn({type:te.NETWORK_ERROR,details:M.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:S,stats:E}))}};t&&(y.onProgress=(E,A,S,U)=>t({frag:e,part:null,payload:S,networkDetails:U})),u.load(h,d,y)})}loadPart(e,t,i){this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(An(e,t));return}const u=this.loader=s?new s(n):new r(n),h=hn(e,t);e.loader=u;const f=Zi(n.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Ln};t.stats=u.stats,u.load(h,d,{onSuccess:(y,E,A,S)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const U={frag:e,part:t,payload:y.data,networkDetails:S};i(U),o(U)},onError:(y,E,A,S)=>{this.resetLoader(e,u),c(new dn({type:te.NETWORK_ERROR,details:M.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:b({url:h.url,data:void 0},y),error:new Error(`HTTP Error ${y.code} ${y.text}`),networkDetails:A,stats:S}))},onAbort:(y,E,A)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new dn({type:te.NETWORK_ERROR,details:M.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:A,stats:y}))},onTimeout:(y,E,A)=>{this.resetLoader(e,u),c(new dn({type:te.NETWORK_ERROR,details:M.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:A,stats:y}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,s=n.total;if(i.loaded+=n.loaded,s){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(i.loaded/s),c),f=(c-u)*Math.round(i.loaded/u);i.total=i.loaded+f}else i.total=Math.max(i.loaded,i.total);const r=i.loading,o=n.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 hn(a,e=null){const t=e||a,i={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},n=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(V(n)&&V(s)){var r;let o=n,c=s;if(a.sn==="initSegment"&&Pn((r=a.decryptdata)==null?void 0:r.method)){const u=s-n;u%16&&(c=s+(16-u%16)),n!==0&&(i.resetIV=!0,o=n-16)}i.rangeStart=o,i.rangeEnd=c}return i}function An(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:te.MEDIA_ERROR,details:M.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new dn(i)}function Pn(a){return a==="AES-128"||a==="AES-256"}class dn extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class _i extends C{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 Gt{constructor(e,t,i,n=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=vi(),this.buffering={audio:vi(),video:vi(),audiovideo:vi()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}function vi(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Pi={length:0,start:()=>0,end:()=>0};class Mt{static isBuffered(e,t){if(e){const i=Mt.getBuffered(e);for(let n=i.length;n--;)if(t>=i.start(n)&&t<=i.end(n))return!0}return!1}static bufferedRanges(e){if(e){const t=Mt.getBuffered(e);return Mt.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const n=Mt.bufferedRanges(e);if(n.length)return Mt.bufferedInfo(n,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort((h,f)=>h.start-f.start||f.end-h.end);let n=-1,s=[];if(i)for(let h=0;h<e.length;h++){t>=e[h].start&&t<=e[h].end&&(n=h);const f=s.length;if(f){const d=s[f-1].end;e[h].start-d<i?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(n===-1&&t>=f&&t<=d&&(n=h),t+i>=f&&t<d)c=f,u=d,r=u-t;else if(t+i<f){o=f;break}}return{len:r,start:c||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||Pi}catch(t){return H.log("failed to get media.buffered",t),Pi}}}const sn=/\{\$([a-zA-Z0-9-_]+)\}/g;function on(a){return sn.test(a)}function ln(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(sn,i=>{const n=i.substring(2,i.length-1),s=t==null?void 0:t[n];return s===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),i):s})}return e}function Vn(a,e,t){let i=a.variableList;i||(a.variableList=i={});let n,s;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const r=new self.URL(t).searchParams;if(r.has(n))s=r.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(r){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${r.message}`))}}else n=e.NAME,s=e.VALUE;n in i?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):i[n]=s||""}function Dn(a,e,t){const i=e.IMPORT;if(t&&i in t){let n=a.variableList;n||(a.variableList=n={}),n[i]=t[i]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const qn=/^(\d+)x(\d+)$/,Wn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ii{constructor(e,t){typeof e=="string"&&(e=Ii.parseAttrList(e,t)),m(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let n=0;n<t.length/2;n++)i[n]=parseInt(t.slice(n*2,n*2+2),16);return i}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((n,s)=>(n[s.toLowerCase()]=!0,n),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=qn.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={},s='"';for(Wn.lastIndex=0;(i=Wn.exec(e))!==null;){const r=i[1].trim();let o=i[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=ln(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":H.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=o}return n}}const pn="com.apple.hls.interstitial";function $n(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function ss(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class gn{constructor(e,t,i=0){var n;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=(n=t==null?void 0:t.tagOrder)!=null?n:i,t){const s=t.attr;for(const r in s)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==s[r]){H.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=m(new Ii({}),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"]);V(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?(H.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(V(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===pn}get isValid(){return!!this.id&&!this._badValueForSameId&&V(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 tn=10;class xn{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return this.fragments.length?V(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||tn}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Rn(a,e){return a.length===e.length?!a.some((t,i)=>t!==e[i]):!1}function Hn(a,e){return!a&&!e?!0:!a||!e?!1:Rn(a,e)}function Kn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function us(a){switch(a){case"AES-128":case"AES-256":return Bi.cbc;case"AES-256-CTR":return Bi.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function ms(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function rs(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function Ds(a){const e=rs(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function It(a){const e=function(i,n,s){const r=i[n];i[n]=i[s],i[s]=r};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function Yt(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),n=i[i.length-1].split(",");if(n.length===2){const s=n[0]==="base64",r=n[1];s?(i.splice(-1,1),t=ms(r)):t=Ds(r)}}return t}const Oi=typeof self!="undefined"?self:void 0;var ui={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},gi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Jn(a){switch(a){case gi.FAIRPLAY:return ui.FAIRPLAY;case gi.PLAYREADY:return ui.PLAYREADY;case gi.WIDEVINE:return ui.WIDEVINE;case gi.CLEARKEY:return ui.CLEARKEY}}function On(a){switch(a){case ui.FAIRPLAY:return gi.FAIRPLAY;case ui.PLAYREADY:return gi.PLAYREADY;case ui.WIDEVINE:return gi.WIDEVINE;case ui.CLEARKEY:return gi.CLEARKEY}}function cs(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[ui.FAIRPLAY,ui.WIDEVINE,ui.PLAYREADY,ui.CLEARKEY].filter(n=>!!e[n]):[];return!i[ui.WIDEVINE]&&t&&i.push(ui.WIDEVINE),i}const _s=function(a){return Oi!=null&&(a=Oi.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function fr(a,e,t,i){let n;switch(a){case ui.FAIRPLAY:n=["cenc","sinf"];break;case ui.WIDEVINE:case ui.PLAYREADY:n=["cenc"];break;case ui.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return Hr(n,e,t,i)}function Hr(a,e,t,i){return[{initDataTypes:a,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function Zr(a){var e;return!!a&&(a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function dr(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){const o=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(o){const c=ms(o).subarray(0,16);return It(c),c}}return null}let Rs={};class es{static clearKeyUriToKeyIdMap(){Rs={}}static setKeyIdForUri(e,t){Rs[e]=t}constructor(e,t,i,n=[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=i,this.keyFormatVersions=n,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Kn(e),r!=null&&r.startsWith("0x")&&(this.keyId=new Uint8Array(D(r)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Rn(e.keyFormatVersions,this.keyFormatVersions)&&Hn(e.iv,this.iv)&&Hn(e.keyId,this.keyId)}isSupported(){if(this.method){if(Kn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case gi.FAIRPLAY:case gi.WIDEVINE:case gi.PLAYREADY:case gi.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Kn(this.method)){let s=this.iv;return s||(typeof e!="number"&&(H.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),s=vs(e)),new es(this.method,this.uri,"identity",this.keyFormatVersions,s)}if(this.keyId){const s=Rs[this.uri];if(s&&!Rn(this.keyId,s)&&es.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=Yt(this.uri);if(i)switch(this.keyFormat){case gi.WIDEVINE:if(this.pssh=i,!this.keyId){const s=ft(i.buffer);if(s.length){var n;const r=s[0];this.keyId=(n=r.kids)!=null&&n.length?r.kids[0]:null}}this.keyId||(this.keyId=Ms(t));break;case gi.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Je(s,null,i),this.keyId=dr(i);break}default:{let s=i.subarray(0,16);if(s.length!==16){const r=new Uint8Array(16);r.set(s,16-s.length),s=r}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s;s=Yr(t),s||(s=Ms(t),s||(s=Rs[this.uri])),s&&(this.keyId=s,es.setKeyIdForUri(this.uri,s))}return this}}function Yr(a){const e=a==null?void 0:a[gi.WIDEVINE];return e?e.keyId:null}function Ms(a){const e=a==null?void 0:a[gi.PLAYREADY];if(e){const t=Yt(e.uri);if(t)return dr(t)}return null}function vs(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const Zs=/#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,Ys=/#EXT-X-MEDIA:(.*)/g,Qr=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ns=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Xr=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 Zn{static findGroup(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(n.id===t)return n}}static resolve(e,t){return g.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Qr.test(e)}static parseMasterPlaylist(e,t){const i=on(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];if(Zs.lastIndex=0,!e.startsWith("#EXTM3U"))return n.playlistParsingError=new Error("no EXTM3U delimiter"),n;let r;for(;(r=Zs.exec(e))!=null;)if(r[1]){var o;const u=new Ii(r[1],n),h=ln(n,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Zn.resolve(h,t)},d=u.decimalResolution("RESOLUTION");d&&(f.width=d.width,f.height=d.height),Qs(u.CODECS,f);const y=u["SUPPLEMENTAL-CODECS"];y&&(f.supplemental={},Qs(y,f.supplemental)),(o=f.unknownCodecs)!=null&&o.length||s.push(f),n.levels.push(f)}else if(r[3]){const u=r[3],h=r[4];switch(u){case"SESSION-DATA":{const f=new Ii(h,n),d=f["DATA-ID"];d&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[d]=f);break}case"SESSION-KEY":{const f=gr(h,t,n);f.encrypted&&f.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(f)):H.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const f=new Ii(h,n);Vn(n,f,t)}break}case"CONTENT-STEERING":{const f=new Ii(h,n);n.contentSteering={uri:Zn.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=mr(h);break}}}const c=s.length>0&&s.length<n.levels.length;return n.levels=c?s:n.levels,n.levels.length===0&&(n.playlistParsingError=new Error("no levels found in manifest")),n}static parseMasterPlaylistMedia(e,t,i){let n;const s={},r=i.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(Ys.lastIndex=0;(n=Ys.exec(e))!==null;){const u=new Ii(n[1],i),h=u.TYPE;if(h){const f=o[h],d=s[h]||[];s[h]=d;const y=u.LANGUAGE,E=u["ASSOC-LANGUAGE"],A=u.CHANNELS,S=u.CHARACTERISTICS,U=u["INSTREAM-ID"],j={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||y||"",type:h,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:y,url:u.URI?Zn.resolve(u.URI,t):""};if(E&&(j.assocLang=E),A&&(j.channels=A),S&&(j.characteristics=S),U&&(j.instreamId=U),f!=null&&f.length){const Y=Zn.findGroup(f,j.groupId)||f[0];bs(j,Y,"audioCodec"),bs(j,Y,"textCodec")}d.push(j)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},u=new xn(t),h=u.fragments,f=[];let d=null,y=0,E=0,A=0,S=0,U=0,j=null,Y=new Be(n,c),ue,ge,Fe,ve=-1,Ce=!1,Le=null,xe;if(Ns.lastIndex=0,u.m3u8=e,u.hasVariableRefs=on(e),((o=Ns.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(ue=Ns.exec(e))!==null;){Ce&&(Ce=!1,Y=new Be(n,c),Y.playlistOffset=A,Y.setStart(A),Y.sn=y,Y.cc=S,U&&(Y.bitrate=U),Y.level=i,d&&(Y.initSegment=d,d.rawProgramDateTime&&(Y.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null),Le&&(Y.setByteRange(Le),Le=null)));const Wt=ue[1];if(Wt){Y.duration=parseFloat(Wt);const Ot=(" "+ue[2]).slice(1);Y.title=Ot||null,Y.tagList.push(Ot?["INF",Wt,Ot]:["INF",Wt])}else if(ue[3]){if(V(Y.duration)){Y.playlistOffset=A,Y.setStart(A),Fe&&vr(Y,Fe,u),Y.sn=y,Y.level=i,Y.cc=S,h.push(Y);const Ot=(" "+ue[3]).slice(1);Y.relurl=ln(u,Ot),qs(Y,j,f),j=Y,A+=Y.duration,y++,E=0,Ce=!0}}else{if(ue=ue[0].match(Xr),!ue){H.warn("No matches on slow regex match for level playlist!");continue}for(ge=1;ge<ue.length&&ue[ge]===void 0;ge++);const Ot=(" "+ue[ge]).slice(1),vt=(" "+ue[ge+1]).slice(1),Nt=ue[ge+2]?(" "+ue[ge+2]).slice(1):null;switch(Ot){case"BYTERANGE":j?Y.setByteRange(vt,j):Y.setByteRange(vt);break;case"PROGRAM-DATE-TIME":Y.rawProgramDateTime=vt,Y.tagList.push(["PROGRAM-DATE-TIME",vt]),ve===-1&&(ve=h.length);break;case"PLAYLIST-TYPE":u.type&&ts(u,Ot,ue),u.type=vt.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?ts(u,Ot,ue):h.length>0&&Is(u,Ot,ue),y=u.startSN=parseInt(vt);break;case"SKIP":{u.skippedSegments&&ts(u,Ot,ue);const Rt=new Ii(vt,u),Bt=Rt.decimalInteger("SKIPPED-SEGMENTS");if(V(Bt)){u.skippedSegments+=Bt;for(let xt=Bt;xt--;)h.push(null);y+=Bt}const si=Rt.enumeratedString("RECENTLY-REMOVED-DATERANGES");si&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(si.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&ts(u,Ot,ue),u.targetduration=Math.max(parseInt(vt),1);break;case"VERSION":u.version!==null&&ts(u,Ot,ue),u.version=parseInt(vt);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||ts(u,Ot,ue),u.live=!1;break;case"#":(vt||Nt)&&Y.tagList.push(Nt?[vt,Nt]:[vt]);break;case"DISCONTINUITY":S++,Y.tagList.push(["DIS"]);break;case"GAP":Y.gap=!0,Y.tagList.push([Ot]);break;case"BITRATE":Y.tagList.push([Ot,vt]),U=parseInt(vt)*1e3,V(U)?Y.bitrate=U:U=0;break;case"DATERANGE":{const Rt=new Ii(vt,u),Bt=new gn(Rt,u.dateRanges[Rt.ID],u.dateRangeTagCount);u.dateRangeTagCount++,Bt.isValid||u.skippedSegments?u.dateRanges[Bt.id]=Bt:H.warn(`Ignoring invalid DATERANGE tag: "${vt}"`),Y.tagList.push(["EXT-X-DATERANGE",vt]);break}case"DEFINE":{{const Rt=new Ii(vt,u);"IMPORT"in Rt?Dn(u,Rt,r):Vn(u,Rt,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?ts(u,Ot,ue):h.length>0&&Is(u,Ot,ue),u.startCC=S=parseInt(vt);break;case"KEY":{const Rt=gr(vt,t,u);if(Rt.isSupported()){if(Rt.method==="NONE"){Fe=void 0;break}Fe||(Fe={});const Bt=Fe[Rt.keyFormat];Bt!=null&&Bt.matches(Rt)||(Bt&&(Fe=m({},Fe)),Fe[Rt.keyFormat]=Rt)}else H.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${vt}"`);break}case"START":u.startTimeOffset=mr(vt);break;case"MAP":{const Rt=new Ii(vt,u);if(Y.duration){const Bt=new Be(n,c);_r(Bt,Rt,i,Fe),d=Bt,Y.initSegment=d,d.rawProgramDateTime&&!Y.rawProgramDateTime&&(Y.rawProgramDateTime=d.rawProgramDateTime)}else{const Bt=Y.byteRangeEndOffset;if(Bt){const si=Y.byteRangeStartOffset;Le=`${Bt-si}@${si}`}else Le=null;_r(Y,Rt,i,Fe),d=Y,Ce=!0}d.cc=S;break}case"SERVER-CONTROL":{xe&&ts(u,Ot,ue),xe=new Ii(vt),u.canBlockReload=xe.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=xe.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&xe.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=xe.optionalFloat("PART-HOLD-BACK",0),u.holdBack=xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&ts(u,Ot,ue);const Rt=new Ii(vt);u.partTarget=Rt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Rt=u.partList;Rt||(Rt=u.partList=[]);const Bt=E>0?Rt[Rt.length-1]:void 0,si=E++,xt=new Ii(vt,u),Tt=new ht(xt,Y,c,si,Bt);Rt.push(Tt),Y.duration+=Tt.duration;break}case"PRELOAD-HINT":{const Rt=new Ii(vt,u);u.preloadHint=Rt;break}case"RENDITION-REPORT":{const Rt=new Ii(vt,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(Rt);break}default:H.warn(`line parsed but not handled: ${ue}`);break}}}j&&!j.relurl?(h.pop(),A-=j.duration,u.partList&&(u.fragmentHint=j)):u.partList&&(qs(Y,j,f),Y.cc=S,u.fragmentHint=Y,Fe&&vr(Y,Fe,u)),u.targetduration||(u.playlistParsingError=new Error("Missing Target Duration"));const et=h.length,St=h[0],Pt=h[et-1];if(A+=u.skippedSegments*u.targetduration,A>0&&et&&Pt){u.averagetargetduration=A/et;const Wt=Pt.sn;u.endSN=Wt!=="initSegment"?Wt:0,u.live||(Pt.endList=!0),ve>0&&(Xs(h,ve),St&&f.unshift(St))}return u.fragmentHint&&(A+=u.fragmentHint.duration),u.totalduration=A,f.length&&u.dateRangeTagCount&&St&&pr(f,u),u.endCC=S,u}}function pr(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 i=a[t-1],n=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=i.ref;for(let h=t;h--;){var r;if(((r=a[h])==null?void 0:r.sn)<e.startSN)break;const f=qr(e,u,a,h,n);if(f!==-1){c.tagAnchor=e.fragments[f].ref;break}}}}function qr(a,e,t,i,n){const s=t[i];if(s){const o=s.programDateTime;if(e>=o||i===0){var r;const c=(((r=t[i+1])==null?void 0:r.start)||n)-s.start;if(e<=o+c*1e3){const u=t[i].sn-a.startSN;if(u<0)return-1;const h=a.fragments;if(h.length>t.length){const d=(t[i+1]||h[h.length-1]).sn-a.startSN;for(let y=d;y>u;y--){const E=h[y].programDateTime;if(e>=E&&e<E+h[y].duration*1e3)return y}}return u}}}return-1}function gr(a,e,t){var i,n;const s=new Ii(a,t),r=(i=s.METHOD)!=null?i:"",o=s.URI,c=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,h=(n=s.KEYFORMAT)!=null?n:"identity";o&&s.IV&&!c&&H.error(`Invalid IV: ${s.IV}`);const f=o?Zn.resolve(o,e):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new es(r,f,h,d,c,s.KEYID)}function mr(a){const t=new Ii(a).decimalFloatingPoint("TIME-OFFSET");return V(t)?t:null}function Qs(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>fe(s,i));n.length&&(e[`${i}Codec`]=n.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>n.indexOf(s)===-1))}),e.unknownCodecs=t}function bs(a,e,t){const i=e[t];i&&(a[t]=i)}function Xs(a,e){let t=a[e];for(let i=e;i--;){const n=a[i];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function qs(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function _r(a,e,t,i){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",i&&(a.levelkeys=i),a.initSegment=null}function vr(a,e,t){a.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&i.push(a)}function ts(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Is(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Js(a,e){const t=e.startPTS;if(V(t)){let i=0,n;e.sn>a.sn?(i=t-a.start,n=a):(i=a.start-t,n=e),n.duration!==i&&n.setDuration(i)}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 yr(a,e,t,i,n,s,r){i-t<=0&&(r.warn("Fragment should have a positive duration",e),i=t+e.duration,s=n+e.duration);let c=t,u=i;const h=e.startPTS,f=e.endPTS;if(V(h)){const U=Math.abs(h-t);a&&U>a.totalduration?r.warn(`media timestamps and playlist times differ by ${U}s for level ${e.level} ${a.url}`):V(e.deltaPTS)?e.deltaPTS=Math.max(U,e.deltaPTS):e.deltaPTS=U,c=Math.max(t,h),t=Math.min(t,h),n=e.startDTS!==void 0?Math.min(n,e.startDTS):n,u=Math.min(i,f),i=Math.max(i,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(i-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=n,e.endPTS=i,e.minEndPTS=u,e.endDTS=s;const y=e.sn;if(!a||y<a.startSN||y>a.endSN)return 0;let E;const A=y-a.startSN,S=a.fragments;for(S[A]=e,E=A;E>0;E--)Js(S[E],S[E-1]);for(E=A;E<S.length-1;E++)Js(S[E],S[E+1]);return a.fragmentHint&&Js(S[S.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,d}function Jr(a,e,t){if(a===e)return;let i=null;const n=a.fragments;for(let h=n.length-1;h>=0;h--){const f=n[h].initSegment;if(f){i=f;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let s;ta(a,e,(h,f,d,y)=>{if((!e.startCC||e.skippedSegments)&&f.cc!==h.cc){const E=h.cc-f.cc;for(let A=d;A<y.length;A++)y[A].cc+=E;e.endCC=y[y.length-1].cc}V(h.startPTS)&&V(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,i=h.initSegment)});const r=e.fragments,o=e.fragmentHint?r.concat(e.fragmentHint):r;if(i&&o.forEach(h=>{var f;h&&(!h.initSegment||h.initSegment.relurl===((f=i)==null?void 0:f.relurl))&&(h.initSegment=i)}),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=Er(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&&qs(o[f],o[f-1],h);pr(h,e)}e.endCC=r[r.length-1].cc}if(!e.startCC){var c;const h=Ui(a,e.startSN-1);e.startCC=(c=h==null?void 0:h.cc)!=null?c:r[0].cc}ea(a.partList,e.partList,(h,f)=>{f.elementaryStreams=h.elementaryStreams,f.stats=h.stats}),s?yr(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,t):xr(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 Er(a,e,t){const{dateRanges:i,recentlyRemovedDateranges:n}=e,s=m({},a);n&&n.forEach(c=>{delete s[c]});const o=Object.keys(s).length;return o?(Object.keys(i).forEach(c=>{const u=s[c],h=new gn(i[c].attr,u);h.isValid?(s[c]=h,u||(h.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${De(i[c].attr)}"`)}),s):i}function ea(a,e,t){if(a&&e){let i=0;for(let n=0,s=a.length;n<=s;n++){const r=a[n],o=e[n+i];r&&o&&r.index===o.index&&r.fragment.sn===o.fragment.sn?t(r,o):i--}}}function ta(a,e,t){const i=e.skippedSegments,n=Math.max(a.startSN,e.startSN)-e.startSN,s=(a.fragmentHint?1:0)+(i?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=n;u<=s;u++){const h=c[r+u];let f=o[u];if(i&&!f&&h&&(f=e.fragments[u]=h),h&&f){t(h,f,u,o);const d=h.relurl,y=f.relurl;if(d&&Bs(d,y)){e.playlistParsingError=br(`media sequence mismatch ${f.sn}:`,a,e,h,f);return}else if(h.cc!==f.cc){e.playlistParsingError=br(`discontinuity sequence mismatch (${h.cc}!=${f.cc})`,a,e,h,f);return}}}}function br(a,e,t,i,n){return new Error(`${a} ${n.url}
|
|
Playlist starting @${e.startSN}
|
|
${e.m3u8}
|
|
|
|
Playlist starting @${t.startSN}
|
|
${t.m3u8}`)}function xr(a,e,t=!0){const i=e.startSN+e.skippedSegments-a.startSN,n=a.fragments,s=i>=0;let r=0;if(s&&i<n.length)r=n[i].start;else if(s&&e.startSN===a.endSN+1)r=a.fragmentEnd;else if(s&&t)r=a.fragmentStart+i*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 i=a.skippedSegments;i<t.length;i++)t[i].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function rn(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const i=a.fragments;if(i.length&&t*4>e){const s=i[i.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function Ui(a,e,t){if(!a)return null;let i=a.fragments[e-a.startSN];return i||(i=a.fragmentHint,i&&i.sn===e)?i:e<a.startSN&&t&&t.sn===e?t:null}function Xi(a,e,t){return a?Fn(a.partList,e,t):null}function Fn(a,e,t){if(a)for(let i=a.length;i--;){const n=a[i];if(n.index===t&&n.fragment.sn===e)return n}return null}function Mn(a){a.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(n=>{n.level=t,n.initSegment&&(n.initSegment.level=t)})})}function Bs(a,e){return a!==e&&e?Us(a)!==Us(e):!1}function Us(a){return a.replace(/\?[^?]*$/,"")}function Ls(a,e){for(let i=0,n=a.length;i<n;i++){var t;if(((t=a[i])==null?void 0:t.cc)===e)return a[i]}return null}function Tr(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function tr(a,e){const t=a.start+e;a.startPTS=t,a.setStart(t),a.endPTS=t+a.duration}function xs(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)tr(t[i],a);e.fragmentHint&&tr(e.fragmentHint,a),e.alignedSliding=!0}function ir(a,e){a&&(Sr(e,a),e.alignedSliding||Ar(e,a),!e.alignedSliding&&!e.skippedSegments&&xr(a,e,!1))}function Sr(a,e){if(!Tr(e,a))return;const t=Math.min(e.endCC,a.endCC),i=Ls(e.fragments,t),n=Ls(a.fragments,t);if(!i||!n)return;H.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;xs(s,a)}function Ar(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,i=e.fragments;if(!t.length||!i.length)return;let n,s;const r=Math.min(e.endCC,a.endCC);e.startCC<r&&a.startCC<r&&(n=Ls(i,r),s=Ls(t,r)),(!n||!s)&&(n=i[Math.floor(i.length/2)],s=Ls(t,n.cc)||t[Math.floor(t.length/2)]);const o=n.programDateTime,c=s.programDateTime;if(!o||!c)return;const u=(c-o)/1e3-(s.start-n.start);xs(u,a)}function Gn(a,e,t){zn(a,e,t),a.addEventListener(e,t)}function zn(a,e,t){a.removeEventListener(e,t)}const Sl={toString:function(a){let e="";const t=a.length;for(let i=0;i<t;i++)e+=`[${a.start(i).toFixed(3)}-${a.end(i).toFixed(3)}]`;return e}},Ye={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 ia extends _i{constructor(e,t,i,n,s){super(n,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Ye.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=Mt.bufferInfo(u||c,f,r.maxBufferHole),y=!d.len;if(this.log(`Media seeking to ${V(f)?f.toFixed(3):f}, state: ${h}, ${y?"out of":"in"} buffer`),this.state===Ye.ENDED)this.resetLoadingState();else if(o){const E=r.maxFragLookUpTolerance,A=o.start-E,S=o.start+o.duration+E;if(y||S<d.start||A>d.end){const U=f>S;(f<A||U)&&(U&&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 E=this.lastCurrentTime;if(f>E&&(this.lastCurrentTime=f),!this.loadingParts){const A=Math.max(d.end,f),S=this.shouldLoadParts(this.getLevelDetails(),A);S&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${A.toFixed(2)}`),this.loadingParts=S)}}this.hls.hasEnoughToStart||(this.log(`Setting ${y?"startPosition":"nextLoadPosition"} to ${f} for seek without enough to start`),this.nextLoadPosition=f,y&&(this.startPosition=f)),y&&this.state===Ye.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 en(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new yn(e.config)}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Ye.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=Ye.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=Mt.bufferedInfo(s,e.start,0));const r=e.nextStart;if(r&&r>n&&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 Mt.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 i=this.media=this.mediaBuffer=t.media;Gn(i,"seeking",this.onMediaSeeking),Gn(i,"ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===Ye.STOPPED&&this.startLoad(n.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(n!==null){if(n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),zn(n,"seeking",this.onMediaSeeking),zn(n,"ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=Ye.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const n=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,i,n).then(s=>{if(!s)return;const r=this.state,o=s.frag;if(this.fragContextChanged(o)){(r===Ye.FRAG_LOADING||!this.fragCurrent&&r===Ye.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=Ye.IDLE);return}"payload"in s&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(p.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===Ye.STOPPED||this.state===Ye.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===oi.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))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===oi.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger(p.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const n=i==null?void 0:i.frag;if(!n||this.fragContextChanged(n)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:n}=this,{frag:s,payload:r}=i,o=s.decryptdata;if(r&&r.byteLength>0&&o!=null&&o.key&&o.iv&&Kn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,us(o.method)).catch(u=>{throw n.trigger(p.ERROR,{type:te.MEDIA_ERROR,details:M.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:s}),u}).then(u=>{const h=self.performance.now();return n.trigger(p.FRAG_DECRYPTED,{frag:s,payload:u,stats:{tstart:c,tdecrypt:h}}),i.payload=u,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===Ye.STOPPED||this.state===Ye.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==Ye.STOPPED&&(this.state=Ye.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var i,n;const s=e.tracks;if(s&&!t.encrypted&&((i=s.audio)!=null&&i.encrypted||(n=s.video)!=null&&n.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(p.ERROR,{type:te.KEY_SYSTEM_ERROR,details:M.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 i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?Sl.toString(Mt.getBuffered(i)):"(detached)"})`),Ae(e)){var n;if(e.type!==J.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=Ye.IDLE;return}}const s=(n=this.levels)==null?void 0:n[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=Ye.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:s}=e,r=!s||s.length===0||s.some(c=>!c),o=new Gt(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!r);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,n){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=Ye.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(p.KEY_LOADED,d),this.state===Ye.KEY_LOADING&&(this.state=Ye.IDLE),d}),this.hls.trigger(p.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(Ae(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(i=Math.max(e.start,i||0),this.loadingParts&&Ae(e)){const d=r.partList;if(d&&n){i>r.fragmentEnd&&r.fragmentHint&&(e=r.fragmentHint);const y=this.getNextPart(d,e,i);if(y>-1){const E=d[y];e=this.fragCurrent=E.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${E.index} (${y}/${d.length-1}) of ${this.fragInfo(e,!1,E)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=E.start+E.duration,this.state=Ye.FRAG_LOADING;let A;return o?A=o.then(S=>!S||this.fragContextChanged(S.frag)?null:this.doFragPartsLoad(e,E,t,n)).catch(S=>this.handleFragLoadError(S)):A=this.doFragPartsLoad(e,E,t,n).catch(S=>this.handleFragLoadError(S)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:E,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):A}else if(!e.url||this.loadedEndOfParts(d,i))return Promise.resolve(null)}}if(Ae(e)&&this.loadingParts){var u;this.log(`LL-Part loading OFF after next part miss @${i.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(i.toFixed(3))}`),V(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Ye.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,n)).catch(d=>this.handleFragLoadError(d)):f=Promise.all([this.fragmentLoader.load(e,h?n:void 0),o]).then(([d])=>(!h&&n&&n(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):f}doFragPartsLoad(e,t,i,n){return new Promise((s,r)=>{var o;const c=[],u=(o=i.details)==null?void 0:o.partList,h=f=>{this.fragmentLoader.loadPart(e,f,n).then(d=>{c[f.index]=d;const y=d.part;this.hls.trigger(p.FRAG_LOADED,d);const E=Xi(i.details,e.sn,f.index+1)||Fn(u,e.sn,f.index+1);if(E)h(E);else return s({frag:e,part:y,partsLoaded:c})}).catch(r)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===M.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===te.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:te.OTHER_ERROR,details:M.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Ye.PARSING){!this.fragCurrent&&this.state!==Ye.STOPPED&&this.state!==Ye.ERROR&&(this.state=Ye.IDLE);return}const{frag:i,part:n,level:s}=t,r=self.performance.now();i.stats.parsing.end=r,n&&(n.stats.parsing.end=r);const o=this.getLevelDetails(),u=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(i,n,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const s=e.partList[0];if(s.fragment.type===J.SUBTITLE)return!1;const r=s.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=r){var n;if((this.hls.hasEnoughToStart?((n=this.media)==null?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:s,part:r}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const o=t[n],c=o.details,u=r>-1?Xi(c,s,r):null,h=u?u.fragment:Ui(c,s,i);return h?(i&&i!==h&&(h.stats=i.stats),{frag:h,part:u,level:o}):null}bufferFragmentData(e,t,i,n,s){if(this.state!==Ye.PARSING)return;const{data1:r,data2:o}=e;let c=r;if(o&&(c=ct(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:i,chunkMeta:n,offset:h,parent:t.type,data:c};if(this.hls.trigger(p.BUFFER_APPENDING,f),e.dropped&&e.independent&&!i){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Mt.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=Mt.bufferInfo(t,i,0),s=e.duration,r=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),o=Math.max(Math.min(e.start-r,n.end-r),i+r);e.start-o>r&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var i;const n=this.getLoadPosition();if(!V(n))return null;const r=this.lastCurrentTime>n||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,r)}getFwdBufferInfoAtPos(e,t,i,n){const s=Mt.bufferInfo(e,t,n);if(s.len===0&&s.nextStart!==void 0){const r=this.fragmentTracker.getBufferedFrag(t,i);if(r&&(s.nextStart<=r.end||r.gap)){const o=Math.max(Math.min(s.nextStart,r.end)-t,n);return Mt.bufferInfo(e,t,o)}}return s}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),s=Math.max(e-t*3,i.maxMaxBufferLength/2,n);return s>=n?(i.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=J.MAIN){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:s}=this,r=i[0].start,o=s.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const f=s.initialLiveManifestSize;if(n<f)return this.warn(`Not enough fragments to start playback (have: ${n}, 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,y=this.hls.liveSyncPosition,E=c?(d!==-1&&d>=r?d:y)||c.start:e;this.log(`Setting startPosition to ${E} to match start frag at live edge. mainStart: ${d} liveSyncPosition: ${y} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=E}}else e<=r&&(c=i[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(i[f+1]||null,t)}return this.mapToInitFragWhenRequired(h)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===oi.OK||i===oi.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,s){let r=null;if(e.gap&&(r=this.getNextFragment(this.nextLoadPosition,t),r&&!r.gap&&i.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(o!==null&&i.len+o.len>=s){const c=r.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,r}get primaryPrefetch(){if(za(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(za(this.config)&&e.type!==J.SUBTITLE){const i=this.hls.interstitialsManager,n=i==null?void 0:i.bufferingItem;if(n){const r=n.event;if(r){if(r.appendInPlace||Math.abs(e.start-n.start)>1||n.start===0)return null}else if(e.end<=n.start&&(t==null?void 0:t.live)===!1||e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}const s=i==null?void 0:i.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,i){let n=-1,s=!1,r=!0;for(let o=0,c=e.length;o<c;o++){const u=e[o];if(r=r&&!u.independent,n>-1&&i<u.start)break;const h=u.loaded;h?n=-1:(s||(u.independent||r)&&u.fragment===t)&&(u.fragment!==t&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${u.start}`),n=o),s=h}return n}loadedEndOfParts(e,t){let i;for(let n=e.length;n--;){if(i=e[n],!i.loaded)return!1;if(t>i.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let n=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),n=qt(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const s=i.sn+1;if(s>=e.startSN&&s<=e.endSN){const r=t[s-e.startSN];i.cc===r.cc&&(n=r,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=fi(e,i.cc,i.end),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:s}=this,{fragments:r,endSN:o}=i;const{fragmentHint:c}=i,{maxFragLookUpTolerance:u}=n,h=i.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 y;const A=e<this.lastCurrentTime||e>t-u||(y=this.media)!=null&&y.paused||!this.startFragRequested?0:u;d=pi(s,r,e,A)}else d=r[r.length-1];if(d){const E=d.sn-i.startSN,A=this.fragmentTracker.getState(d);if((A===oi.OK||A===oi.PARTIAL&&d.gap)&&(s=d),s&&d.sn===s.sn&&(!f||h[0].fragment.sn>d.sn||!i.live)&&d.level===s.level){const U=r[E+1];d.sn<o&&this.fragmentTracker.getState(U)!==oi.OK?d=U:d=null}}return d}alignPlaylists(e,t,i){const n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,r=!t,o=e.alignedSliding&&V(s);if(r||!o&&!s){ir(i,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${n}`),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 i=this.startPosition;i<t&&(i=-1);const n=this.timelineOffset;if(i===-1){const s=this.startTimeOffset!==null,r=s?this.startTimeOffset:e.startTimeOffset;r!==null&&V(r)?(i=t+r,r<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${r} found in ${s?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+n}this.nextLoadPosition=i+n}getLoadPosition(){var e;const{media:t}=this;let i=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&Ae(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!==Ye.FRAG_LOADING_WAITING_RETRY)&&(this.state=Ye.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const U=this.getCurrentContext(t.chunkMeta);U&&(t.frag=U.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var s;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(s=this.fragCurrent)==null?void 0:s.url}`);return}const r=t.details===M.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(n,!0);const o=t.errorAction;if(!o){this.state=Ye.ERROR;return}const{action:c,flags:u,retryCount:h=0,retryConfig:f}=o,d=!!f,y=d&&c===xi.RetryRequest,E=d&&!o.resolved&&u===yi.MoveAllAlternatesMatchingHost,A=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!y&&E&&Ae(n)&&!n.endList&&A&&!Mi(t))this.resetFragmentErrors(e),this.treatAsGap(n),o.resolved=!0;else if((y||E)&&h<f.maxNumRetry){var S;const U=Ki((S=t.response)==null?void 0:S.code),j=$i(f,h);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+j,this.state=Ye.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,U){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${h+1}/${f.maxNumRetry} in ${j}ms`)}else if(f)if(this.resetFragmentErrors(e),h<f.maxNumRetry)!r&&c!==xi.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${h})`);return}else c===xi.SendAlternateToPenaltyBox?this.state=Ye.WAITING_LEVEL:this.state=Ye.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!Ki(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Ye.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===Ye.PARSING||this.state===Ye.PARSED){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),s=n&&n.len>.5;s&&this.reduceMaxBufferLength(n.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 ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===J.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Ye.STOPPED&&(this.state=Ye.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=Mt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===Ye.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Ye.STOPPED&&(this.state=Ye.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,n){const s=i.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=n?0:yr(s,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS,this);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:s,level:i,drift:d,type:u,frag:e,start:h.startPTS,end:h.endPTS}),!0}return c},!1)){var o;if(i.fragmentError===0&&this.treatAsGap(e,i),((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(p.ERROR,{type:te.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Ye.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(p.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===J.MAIN?"level":"track"}fragInfo(e,t=!0,i){var n,s;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((n=t&&!i?e.startPTS:(i||e).start)!=null?n:NaN).toFixed(3)}-${((s=t&&!i?e.endPTS:(i||e).end)!=null?s:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function za(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class ja{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=Al(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Al(a,e){const t=new Uint8Array(e);let i=0;for(let n=0;n<a.length;n++){const s=a[n];t.set(s,i),i+=s.length}return t}var na={exports:{}},Ha;function wl(){return Ha||(Ha=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(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 y=new n(h,f||c,d),E=t?t+u:u;return c._events[E]?c._events[E].fn?c._events[E]=[c._events[E],y]:c._events[E].push(y):(c._events[E]=y,c._eventsCount++),c}function r(c,u){--c._eventsCount===0?c._events=new i:delete c._events[u]}function o(){this._events=new i,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,y=f.length,E=new Array(y);d<y;d++)E[d]=f[d].fn;return E},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,y,E){var A=t?t+u:u;if(!this._events[A])return!1;var S=this._events[A],U=arguments.length,j,Y;if(S.fn){switch(S.once&&this.removeListener(u,S.fn,void 0,!0),U){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,h),!0;case 3:return S.fn.call(S.context,h,f),!0;case 4:return S.fn.call(S.context,h,f,d),!0;case 5:return S.fn.call(S.context,h,f,d,y),!0;case 6:return S.fn.call(S.context,h,f,d,y,E),!0}for(Y=1,j=new Array(U-1);Y<U;Y++)j[Y-1]=arguments[Y];S.fn.apply(S.context,j)}else{var ue=S.length,ge;for(Y=0;Y<ue;Y++)switch(S[Y].once&&this.removeListener(u,S[Y].fn,void 0,!0),U){case 1:S[Y].fn.call(S[Y].context);break;case 2:S[Y].fn.call(S[Y].context,h);break;case 3:S[Y].fn.call(S[Y].context,h,f);break;case 4:S[Y].fn.call(S[Y].context,h,f,d);break;default:if(!j)for(ge=1,j=new Array(U-1);ge<U;ge++)j[ge-1]=arguments[ge];S[Y].fn.apply(S[Y].context,j)}}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 y=t?t+u:u;if(!this._events[y])return this;if(!h)return r(this,y),this;var E=this._events[y];if(E.fn)E.fn===h&&(!d||E.once)&&(!f||E.context===f)&&r(this,y);else{for(var A=0,S=[],U=E.length;A<U;A++)(E[A].fn!==h||d&&!E[A].once||f&&E[A].context!==f)&&S.push(E[A]);S.length?this._events[y]=S.length===1?S[0]:S:r(this,y)}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 i,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}(na)),na.exports}var Dl=wl(),sa=O(Dl);const nr="1.6.13",$s={};function Rl(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Il(){const a=$s[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),n={worker:new self.Worker(t),objectURL:t,clientCount:1};return $s[nr]=n,n}function Ll(a){const e=$s[a];if(e)return e.clientCount++,e;const t=new self.URL(a,self.location.href).href,n={worker:new self.Worker(t),scriptURL:t,clientCount:1};return $s[a]=n,n}function Cl(a){const e=$s[a||nr];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete $s[a||nr],n&&self.URL.revokeObjectURL(n),i.terminate()}}function Za(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 ra(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 sr(a,e){const t=e;let i=0;for(;ra(a,e);){i+=10;const n=wr(a,e+6);i+=n,Za(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)}function kl(a,e,t,i){const n=[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 y=new Error(`invalid ADTS sampling index:${r}`);a.emit(p.ERROR,p.ERROR,{type:te.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!0,error:y,reason:y.message});return}const o=(s>>6&3)+1,c=e[t+3]>>6&3|(s&1)<<2,u="mp4a.40."+o,h=n[r];let f=r;(o===5||o===29)&&(f-=3);const d=[o<<3|(f&14)>>1,(f&1)<<7|c<<3];return H.log(`manifest codec:${i}, 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:i}}function Ya(a,e){return a[e]===255&&(a[e+1]&246)===240}function Qa(a,e){return a[e+1]&1?7:9}function aa(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function Pl(a,e){return e+5<a.length}function Dr(a,e){return e+1<a.length&&Ya(a,e)}function Ol(a,e){return Pl(a,e)&&Ya(a,e)&&aa(a,e)<=a.length-e}function Fl(a,e){if(Dr(a,e)){const t=Qa(a,e);if(e+t>=a.length)return!1;const i=aa(a,e);if(i<=t)return!1;const n=e+i;return n===a.length||Dr(a,n)}return!1}function Xa(a,e,t,i,n){if(!a.samplerate){const s=kl(e,t,i,n);if(!s)return;m(a,s)}}function qa(a){return 1024*9e4/a}function Ml(a,e){const t=Qa(a,e);if(e+t<=a.length){const i=aa(a,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ja(a,e,t,i,n){const s=qa(a.samplerate),r=i+n*s,o=Ml(e,t);let c;if(o){const{frameLength:f,headerLength:d}=o,y=d+f,E=Math.max(0,t+y-e.length);E?(c=new Uint8Array(y-d),c.set(e.subarray(t+d,e.length),0)):c=e.subarray(t+d,t+y);const A={unit:c,pts:r};return E||a.samples.push(A),{sample:A,length:y,missing:E}}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 Nl(a,e){return ra(a,e)&&wr(a,e+6)+10<=a.length-e}function Bl(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function oa(a,e=0,t=1/0){return Ul(a,e,t,Uint8Array)}function Ul(a,e,t,i){const n=$l(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.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 i(n,u,h-u)}function $l(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 Gl(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 i=a.data.subarray(1).indexOf(0);if(i===-1)return;const n=We(oa(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=We(oa(a.data,3+i,r));let c;return n==="-->"?c=We(oa(a.data,4+i+r)):c=Bl(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function Vl(a){if(a.size<2)return;const e=We(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function Wl(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=We(a.data.subarray(t),!0);t+=i.length+1;const n=We(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=We(a.data.subarray(1));return{key:a.type,info:"",data:e}}function zl(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=We(a.data.subarray(t),!0);t+=i.length+1;const n=We(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=We(a.data);return{key:a.type,info:"",data:e}}function jl(a){return a.type==="PRIV"?Vl(a):a.type[0]==="W"?zl(a):a.type==="APIC"?Gl(a):Wl(a)}function Hl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=wr(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const Rr=10,Zl=10;function eo(a){let e=0;const t=[];for(;ra(a,e);){const i=wr(a,e+6);a[e+5]>>6&1&&(e+=Rr),e+=Rr;const n=e+i;for(;e+Zl<n;){const s=Hl(a.subarray(e)),r=jl(s);r&&t.push(r),e+=s.size+Rr}Za(a,e)&&(e+=Rr)}return t}function to(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function Yl(a){if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function la(a){const e=eo(a);for(let t=0;t<e.length;t++){const i=e[t];if(to(i))return Yl(i)}}let Yn=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 hs(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ua{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=ct(this.cachedData,e),this.cachedData=null);let i=sr(e,0),n=i?i.length:0,s;const r=this._audioTrack,o=this._id3Track,c=i?la(i):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&V(c))&&(this.basePTS=Ql(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Yn.audioId3,duration:Number.POSITIVE_INFINITY});n<u;){if(this.canParse(e,n)){const h=this.appendFrame(r,e,n);h?(this.frameIndex++,this.lastPTS=h.sample.pts,n+=h.length,s=n):n=u}else Nl(e,n)?(i=sr(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Yn.audioId3,duration:Number.POSITIVE_INFINITY}),n+=i.length,s=n):n++;if(n===u&&s!==u){const h=e.slice(s);this.cachedData?this.cachedData=ct(this.cachedData,h):this.cachedData=h}}return{audioTrack:r,videoTrack:hs(),id3Track:o,textTrack:hs()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:hs(),id3Track:this._id3Track,textTrack:hs()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Ql=(a,e,t)=>{if(V(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Ir=null;const Xl=[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],ql=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Jl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],eu=[0,1,1,4];function io(a,e,t,i,n){if(t+24>e.length)return;const s=no(e,t);if(s&&t+s.frameLength<=e.length){const r=s.samplesPerFrame*9e4/s.sampleRate,o=i+n*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 no(a,e){const t=a[e+1]>>3&3,i=a[e+1]>>1&3,n=a[e+2]>>4&15,s=a[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&s!==3){const r=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-i:i===3?3:4,u=Xl[c*14+n-1]*1e3,f=ql[(t===3?0:t===2?1:2)*3+s],d=o===3?1:2,y=Jl[t][i],E=eu[i],A=y*8*E,S=Math.floor(y*u/f+r)*E;if(Ir===null){const Y=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ir=Y?parseInt(Y[1]):0}return!!Ir&&Ir<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:d,frameLength:S,samplesPerFrame:A}}}function ca(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function so(a,e){return e+1<a.length&&ca(a,e)}function tu(a,e){return ca(a,e)&&4<=a.length-e}function ro(a,e){if(e+1<a.length&&ca(a,e)){const i=no(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const s=e+n;return s===a.length||so(a,s)}return!1}class iu extends ua{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=sr(e,0);let n=(i==null?void 0:i.length)||0;if(ro(e,n))return!1;for(let s=e.length;n<s;n++)if(Fl(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Ol(e,t)}appendFrame(e,t,i){Xa(e,this.observer,t,i,e.manifestCodec);const n=Ja(e,t,i,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const ao=(a,e)=>{let t=0,i=5;e+=i;const n=new Uint32Array(1),s=new Uint32Array(1),r=new Uint8Array(1);for(;i>0;){r[0]=a[e];const o=Math.min(i,8),c=8-o;s[0]=4278190080>>>24+c<<c,n[0]=(r[0]&s[0])>>c,t=t?t<<o|n[0]:n[0],e+=1,i-=o}return t};class nu extends ua{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const n=oo(e,t,i,this.basePTS,this.frameIndex);if(n!==-1)return{sample:e.samples[e.samples.length-1],length:n,missing:0}}static probe(e){if(!e)return!1;const t=sr(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&la(t)!==void 0&&ao(e,i)<16}}function oo(a,e,t,i,n){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 y=(e[t+6]<<8|e[t+7])>>12-d&1,A=[2,1,2,3,3,4,4,5][f]+y,S=e[t+5]>>3,U=e[t+5]&7,j=new Uint8Array([s<<6|S<<1|U>>2,(U&3)<<6|f<<3|y<<2|c>>4,c<<4&224]),Y=1536/o*9e4,ue=i+n*Y,ge=e.subarray(t,t+h);return a.config=j,a.channelCount=A,a.samplerate=o,a.samples.push({unit:ge,pts:ue}),h}class su extends ua{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=sr(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&la(t)!==void 0&&ao(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(ro(e,i))return H.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return tu(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return io(e,t,i,this.basePTS,this.frameIndex)}}const ru=/\/emsg[-/]ID3/i;class au{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,n){const s=this.videoTrack=hs("video",1),r=this.audioTrack=hs("audio",1),o=this.txtTrack=hs("text",1);if(this.id3Track=hs("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=ze(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=zt.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return me(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=ct(this.remainderData,e));const o=_t(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=he(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:r,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(t,this.timeOffset);return i.samples=he(e,t),{videoTrack:t,audioTrack:hs(),id3Track:n,textTrack:hs()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=ie(e.samples,["emsg"]);n&&n.forEach(s=>{const r=st(s);if(ru.test(r.schemeIdUri)){const o=lo(r,t);let c=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=r.payload;i.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Yn.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=lo(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Yn.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function lo(a,e){return V(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class ou{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new yn(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Bi.cbc)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const s=n.subarray(16,n.length-n.length%16),r=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(r).then(o=>{const c=new Uint8Array(o);n.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)i.set(e.subarray(s,s+16),n);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)e.set(i.subarray(n,n+16),s);return e}decryptAvcSample(e,t,i,n,s){const r=Pe(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,i+1,n)}).catch(n)}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){n();return}const s=e[t].units;for(;!(i>=s.length);i++){const r=s[i];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,i,n,r),!this.decrypter.isSync()))return}}}}class uo{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,n;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const s=i.units;n=s[s.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,n=i.length;if(n){const s=i[n-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let s=e.naluState||0;const r=s,o=[];let c=0,u,h,f,d=-1,y=0;for(s===-1&&(d=0,y=this.getNALuType(t,0),s=0,c=1);c<n;){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 E={data:t.subarray(d,h),type:y};o.push(E)}else{const E=this.getLastNalUnit(e.samples);E&&(r&&c<=4-r&&E.state&&(E.data=E.data.subarray(0,E.data.byteLength-r)),h>0&&(E.data=ct(E.data,t.subarray(0,h)),E.state=0))}c<n?(f=this.getNALuType(t,c),d=c,y=f,s=0):s=-1}else s=0}if(d>=0&&s>=0){const E={data:t.subarray(d,n),type:y,state:s};o.push(E)}if(o.length===0){const E=this.getLastNalUnit(e.samples);E&&(E.data=ct(E.data,t))}return e.naluState=s,o}}class rr{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");n.set(e.subarray(i,i+s)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&H.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class lu extends uo{parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(u=>{var h,f;switch(u.type){case 1:{let A=!1;o=!0;const S=u.data;if(c&&S.length>4){const U=this.readSliceType(S);(U===2||U===4||U===7||U===9)&&(A=!0)}if(A){var d;(d=r)!=null&&d.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.frame=!0,r.key=A;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,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 6:{o=!0,$e(u.data,1,i.pts,t.samples);break}case 7:{var y,E;o=!0,c=!0;const A=u.data,S=this.readSPS(A);if(!e.sps||e.width!==S.width||e.height!==S.height||((y=e.pixelRatio)==null?void 0:y[0])!==S.pixelRatio[0]||((E=e.pixelRatio)==null?void 0:E[1])!==S.pixelRatio[1]){e.width=S.width,e.height=S.height,e.pixelRatio=S.pixelRatio,e.sps=[A];const U=A.subarray(1,4);let j="avc1.";for(let Y=0;Y<3;Y++){let ue=U[Y].toString(16);ue.length<2&&(ue="0"+ue),j+=ue}e.codec=j}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,i.pts,i.dts));break;case 12:o=!0;break;default:o=!1;break}r&&o&&r.units.push(u)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new rr(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,n=8,s;for(let r=0;r<e;r++)n!==0&&(s=t.readEG(),n=(i+s+256)%256),i=n===0?i:n}readSPS(e){const t=new rr(e);let i=0,n=0,s=0,r=0,o,c,u;const h=t.readUByte.bind(t),f=t.readBits.bind(t),d=t.readUEG.bind(t),y=t.readBoolean.bind(t),E=t.skipBits.bind(t),A=t.skipEG.bind(t),S=t.skipUEG.bind(t),U=this.skipScalingList.bind(this);h();const j=h();if(f(5),E(3),h(),S(),j===100||j===110||j===122||j===244||j===44||j===83||j===86||j===118||j===128){const Ce=d();if(Ce===3&&E(1),S(),S(),E(1),y())for(c=Ce!==3?8:12,u=0;u<c;u++)y()&&(u<6?U(16,t):U(64,t))}S();const Y=d();if(Y===0)d();else if(Y===1)for(E(1),A(),A(),o=d(),u=0;u<o;u++)A();S(),E(1);const ue=d(),ge=d(),Fe=f(1);Fe===0&&E(1),E(1),y()&&(i=d(),n=d(),s=d(),r=d());let ve=[1,1];if(y()&&y())switch(h()){case 1:ve=[1,1];break;case 2:ve=[12,11];break;case 3:ve=[10,11];break;case 4:ve=[16,11];break;case 5:ve=[40,33];break;case 6:ve=[24,11];break;case 7:ve=[20,11];break;case 8:ve=[32,11];break;case 9:ve=[80,33];break;case 10:ve=[18,11];break;case 11:ve=[15,11];break;case 12:ve=[64,33];break;case 13:ve=[160,99];break;case 14:ve=[4,3];break;case 15:ve=[3,2];break;case 16:ve=[2,1];break;case 255:{ve=[h()<<8|h(),h()<<8|h()];break}}return{width:Math.ceil((ue+1)*16-i*2-n*2),height:(2-Fe)*(ge+1)*16-(Fe?2:4)*(s+r),pixelRatio:ve}}}class uu extends uo{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.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,i.pts,i.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,i.pts,i.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,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 39:o=!0,$e(u.data,2,i.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=m(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 y=this.readSPS(u.data);e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.codec=y.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const E in y.params)e.params[E]=y.params[E]}this.pushParameterSet(e.sps,u.data,e.vps),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const y=this.readPPS(u.data);for(const E in y)e.params[E]=y[E]}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,i.pts,i.dts));break;default:o=!1;break}r&&o&&r.units.push(u)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n<e.byteLength;n++)n>=2&&e[n]===3&&e[n-1]===0&&e[n-2]===0||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new rr(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),n=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:n}}readSPS(e){const t=new rr(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=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(),y=t.readUByte(),E=t.readUByte(),A=t.readUByte(),S=t.readUByte(),U=t.readUByte(),j=[],Y=[];for(let Ni=0;Ni<i;Ni++)j.push(t.readBoolean()),Y.push(t.readBoolean());if(i>0)for(let Ni=i;Ni<8;Ni++)t.readBits(2);for(let Ni=0;Ni<i;Ni++)j[Ni]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),Y[Ni]&&t.readUByte();t.readUEG();const ue=t.readUEG();ue==3&&t.skipBits(1);const ge=t.readUEG(),Fe=t.readUEG(),ve=t.readBoolean();let Ce=0,Le=0,xe=0,et=0;ve&&(Ce+=t.readUEG(),Le+=t.readUEG(),xe+=t.readUEG(),et+=t.readUEG());const St=t.readUEG(),Pt=t.readUEG(),Wt=t.readUEG(),Ot=t.readBoolean();for(let Ni=Ot?0:i;Ni<=i;Ni++)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 Bn=0;Bn<4;Bn++)for(let ns=0;ns<(Bn===3?2:6);ns++)if(!t.readBoolean())t.readUEG();else{const ls=Math.min(64,1<<4+(Bn<<1));Bn>1&&t.readEG();for(let Hs=0;Hs<ls;Hs++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const Rt=t.readUEG();let Bt=0;for(let Ni=0;Ni<Rt;Ni++){let Bn=!1;if(Ni!==0&&(Bn=t.readBoolean()),Bn){Ni===Rt&&t.readUEG(),t.readBoolean(),t.readUEG();let ns=0;for(let Os=0;Os<=Bt;Os++){const ls=t.readBoolean();let Hs=!1;ls||(Hs=t.readBoolean()),(ls||Hs)&&ns++}Bt=ns}else{const ns=t.readUEG(),Os=t.readUEG();Bt=ns+Os;for(let ls=0;ls<ns;ls++)t.readUEG(),t.readBoolean();for(let ls=0;ls<Os;ls++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Ni=t.readUEG();for(let Bn=0;Bn<Ni;Bn++){for(let ns=0;ns<Wt+4;ns++)t.readBits(1);t.readBits(1)}}let xt=0,Tt=1,Ei=1,Gi=!0,Ti=1,Ci=0;t.readBoolean(),t.readBoolean();let Nn=!1;if(t.readBoolean()){if(t.readBoolean()){const Fs=t.readUByte(),_l=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],jr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Fs>0&&Fs<16?(Tt=_l[Fs-1],Ei=jr[Fs-1]):Fs===255&&(Tt=t.readBits(16),Ei=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(),Nn=t.readBoolean(),Nn&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(Ti=t.readBits(32),Ci=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const jr=t.readBoolean(),vl=t.readBoolean();let cr=!1;(jr||vl)&&(cr=t.readBoolean(),cr&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),cr&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let yl=0;yl<=i;yl++){Gi=t.readBoolean();const Vh=Gi||t.readBoolean();let El=!1;Vh?t.readEG():El=t.readBoolean();const bl=El?1:t.readUEG()+1;if(jr)for(let hr=0;hr<bl;hr++)t.readUEG(),t.readUEG(),cr&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(vl)for(let hr=0;hr<bl;hr++)t.readUEG(),t.readUEG(),cr&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),xt=t.readUEG())}let is=ge,gs=Fe;if(ve){let Ni=1,Bn=1;ue===1?Ni=Bn=2:ue==2&&(Ni=2),is=ge-Ni*Le-Ni*Ce,gs=Fe-Bn*et-Bn*xe}const Ps=n?["A","B","C"][n]:"",Gh=o<<24|c<<16|u<<8|h;let Va=0;for(let Ni=0;Ni<32;Ni++)Va=(Va|(Gh>>Ni&1)<<31-Ni)>>>0;let Wa=Va.toString(16);return r===1&&Wa==="2"&&(Wa="6"),{codecString:`hvc1.${Ps}${r}.${Wa}.${s?"H":"L"}${U}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:n,general_profile_compatibility_flags:[o,c,u,h],general_constraint_indicator_flags:[f,d,y,E,A,S],general_level_idc:U,bit_depth:St+8,bit_depth_luma_minus8:St,bit_depth_chroma_minus8:Pt,min_spatial_segmentation_idc:xt,chroma_format_idc:ue,frame_rate:{fixed:Gi,fps:Ci/Ti}},width:is,height:gs,pixelRatio:[Tt,Ei]}}readPPS(e){const t=new rr(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 n=t.readBoolean(),s=t.readBoolean();let r=1;return s&&n?r=0:s?r=3:n&&(r=2),{parallelismType:r}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const In=188;class Ts{constructor(e,t,i,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.videoParser=null}static probe(e,t){const i=Ts.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(In*5,t-In)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let c=n;c<t;c+=In)if(e[c]===71&&(t-c===In||e[c+In]===71)){if(o++,r===-1&&(r=c,r!==0&&(i=Math.min(r+In*99,e.length-In)+1)),s||(s=ha(e,c)===0),s&&o>1&&(r===0&&o>2||c+In>i))return r}else{if(o)return-1;break}n++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:zt[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Ts.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=Ts.createTrack("audio",n),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=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,n=!1){i||(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,y=c.pid,E=o.pesData,A=c.pesData,S=null,U=this.pmtParsed,j=this._pmtId,Y=e.length;if(this.remainderData&&(e=ct(this.remainderData,e),Y=e.length,this.remainderData=null),Y<In&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const ue=Math.max(0,Ts.syncOffset(e));Y-=(Y-ue)%In,Y<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,Y,e.buffer.byteLength-Y));let ge=0;for(let ve=ue;ve<Y;ve+=In)if(e[ve]===71){const Ce=!!(e[ve+1]&64),Le=ha(e,ve),xe=(e[ve+3]&48)>>4;let et;if(xe>1){if(et=ve+5+e[ve+4],et===ve+In)continue}else et=ve+4;switch(Le){case h:Ce&&(f&&(s=Ks(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(et,ve+In)),f.size+=ve+In-et);break;case d:if(Ce){if(E&&(s=Ks(E,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}E={data:[],size:0}}E&&(E.data.push(e.subarray(et,ve+In)),E.size+=ve+In-et);break;case y:Ce&&(A&&(s=Ks(A,this.logger))&&this.parseID3PES(c,s),A={data:[],size:0}),A&&(A.data.push(e.subarray(et,ve+In)),A.size+=ve+In-et);break;case 0:Ce&&(et+=e[et]+1),j=this._pmtId=cu(e,et);break;case j:{Ce&&(et+=e[et]+1);const St=hu(e,et,this.typeSupported,i,this.observer,this.logger);h=St.videoPid,h>0&&(r.pid=h,r.segmentCodec=St.segmentVideoCodec),d=St.audioPid,d>0&&(o.pid=d,o.segmentCodec=St.segmentAudioCodec),y=St.id3Pid,y>0&&(c.pid=y),S!==null&&!U&&(this.logger.warn(`MPEG-TS PMT found at ${ve} after unknown PID '${S}'. Backtracking to sync byte @${ue} to parse all TS packets.`),S=null,ve=ue-188),U=this.pmtParsed=!0;break}case 17:case 8191:break;default:S=Le;break}}else ge++;ge>0&&fa(this.observer,new Error(`Found ${ge} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=E,c.pesData=A;const Fe={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return n&&this.extractRemainingSamples(Fe),Fe}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:n,textTrack:s}=e,r=i.pesData,o=t.pesData,c=n.pesData;let u;if(r&&(u=Ks(r,this.logger))?(this.readyVideoParser(i.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(i,s,u,!0),i.pesData=null)):i.pesData=r,o&&(u=Ks(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=Ks(c,this.logger))?(this.parseID3PES(n,u),n.pesData=null):n.pesData=c}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new ou(this.observer,this.config,t);return this.decrypt(n,s)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new lu:e==="hevc"&&(this.videoParser=new uu))}decrypt(e,t){return new Promise(i=>{const{audioTrack:n,videoTrack:s}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{i(e)}):i(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const n=this.aacOverFlow;let s=t.data;if(n){this.aacOverFlow=null;const f=n.missing,d=n.sample.unit.byteLength;if(f===-1)s=ct(n.sample.unit,s);else{const y=d-f;n.sample.unit.set(s.subarray(0,f),y),e.samples.push(n.sample),i=n.missing}}let r,o;for(r=i,o=s.length;r<o-1&&!Dr(s,r);r++);if(r!==i){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",fa(this.observer,new Error(f),d,this.logger),!d)return}Xa(e,this.observer,s,r,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(n){const f=qa(e.samplerate);c=n.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,h;for(;r<o;)if(h=Ja(e,s,r,c,u),r+=h.length,h.missing){this.aacOverFlow=h;break}else for(u++;r<o-1&&!Dr(s,r);r++);}parseMPEGPES(e,t){const i=t.data,n=i.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<n;)if(so(i,r)){const c=io(e,i,r,o,s);if(c)r+=c.length,s++;else break}else r++}parseAC3PES(e,t){{const i=t.data,n=t.pts;if(n===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=i.length;let r=0,o=0,c;for(;o<s&&(c=oo(e,i,o,n,r++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=m({},t,{type:this._videoTrack?Yn.emsg:Yn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function ha(a,e){return((a[e+1]&31)<<8)+a[e+2]}function cu(a,e){return(a[e+10]&31)<<8|a[e+11]}function hu(a,e,t,i,n,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=ha(a,e),f=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!i){da("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(!i){da("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(!i){da("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,y=f;for(;y>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 A=a[d+1]+2;d+=A,y-=A}}break;case 194:case 135:return fa(n,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 fa(a,e,t,i){i.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:te.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function da(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function Ks(a,e){let t=0,i,n,s,r,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=ct(c[0],c[1]),c.splice(1,1);if(i=c[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(n=(i[4]<<8)+i[5],n&&n>a.size-6)return null;const h=i[7];h&192&&(r=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,h&64?(o=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[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=i[8];let f=s+9;if(a.size<=f)return null;a.size-=f;const d=new Uint8Array(a.size);for(let y=0,E=c.length;y<E;y++){i=c[y];let A=i.byteLength;if(f)if(f>A){f-=A;continue}else i=i.subarray(f),A-=f,f=0;d.set(i,t),t+=A}return n&&(n-=s+3),{data:d,pts:r,dts:o,len:n}}return null}class fu{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 Ss=Math.pow(2,32)-1;class Re{static init(){Re.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in Re.types)Re.types.hasOwnProperty(e)&&(Re.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Re.HDLR_TYPES={video:t,audio:i};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);Re.STTS=Re.STSC=Re.STCO=s,Re.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Re.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Re.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Re.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const r=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);Re.FTYP=Re.box(Re.types.ftyp,r,c,r,o),Re.DINF=Re.box(Re.types.dinf,Re.box(Re.types.dref,n))}static box(e,...t){let i=8,n=t.length;const s=n;for(;n--;)i+=t[n].byteLength;const r=new Uint8Array(i);for(r[0]=i>>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(e,4),n=0,i=8;n<s;n++)r.set(t[n],i),i+=t[n].byteLength;return r}static hdlr(e){return Re.box(Re.types.hdlr,Re.HDLR_TYPES[e])}static mdat(e){return Re.box(Re.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Ss+1)),n=Math.floor(t%(Ss+1));return Re.box(Re.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,85,196,0,0]))}static mdia(e){return Re.box(Re.types.mdia,Re.mdhd(e.timescale||0,e.duration||0),Re.hdlr(e.type),Re.minf(e))}static mfhd(e){return Re.box(Re.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?Re.box(Re.types.minf,Re.box(Re.types.smhd,Re.SMHD),Re.DINF,Re.stbl(e)):Re.box(Re.types.minf,Re.box(Re.types.vmhd,Re.VMHD),Re.DINF,Re.stbl(e))}static moof(e,t,i){return Re.box(Re.types.moof,Re.mfhd(e),Re.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Re.trak(e[t]);return Re.box.apply(null,[Re.types.moov,Re.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(Re.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Re.trex(e[t]);return Re.box.apply(null,[Re.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Ss+1)),n=Math.floor(t%(Ss+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Re.box(Re.types.mvhd,s)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let n,s;for(n=0;n<t.length;n++)s=t[n].flags,i[n+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return Re.box(Re.types.sdtp,i)}static stbl(e){return Re.box(Re.types.stbl,Re.stsd(e),Re.box(Re.types.stts,Re.STTS),Re.box(Re.types.stsc,Re.STSC),Re.box(Re.types.stsz,Re.STSZ),Re.box(Re.types.stco,Re.STCO))}static avc1(e){let t=[],i=[],n,s,r;for(n=0;n<e.sps.length;n++)s=e.sps[n],r=s.byteLength,t.push(r>>>8&255),t.push(r&255),t=t.concat(Array.prototype.slice.call(s));for(n=0;n<e.pps.length;n++)s=e.pps[n],r=s.byteLength,i.push(r>>>8&255),i.push(r&255),i=i.concat(Array.prototype.slice.call(s));const o=Re.box(Re.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),c=e.width,u=e.height,h=e.pixelRatio[0],f=e.pixelRatio[1];return Re.box(Re.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,Re.box(Re.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Re.box(Re.types.pasp,new Uint8Array([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 Re.box(Re.types.mp4a,Re.audioStsd(e),Re.box(Re.types.esds,Re.esds(e)))}static mp3(e){return Re.box(Re.types[".mp3"],Re.audioStsd(e))}static ac3(e){return Re.box(Re.types["ac-3"],Re.audioStsd(e),Re.box(Re.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Re.box(Re.types.stsd,Re.STSD,Re.mp4a(e));if(t==="ac3"&&e.config)return Re.box(Re.types.stsd,Re.STSD,Re.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Re.box(Re.types.stsd,Re.STSD,Re.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Re.box(Re.types.stsd,Re.STSD,Re.avc1(e));if(t==="hevc"&&e.vps)return Re.box(Re.types.stsd,Re.STSD,Re.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),n=e.width||0,s=e.height||0,r=Math.floor(i/(Ss+1)),o=Math.floor(i%(Ss+1));return Re.box(Re.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,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,n>>8&255,n&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const i=Re.sdtp(e),n=e.id,s=Math.floor(t/(Ss+1)),r=Math.floor(t%(Ss+1));return Re.box(Re.types.traf,Re.box(Re.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),Re.box(Re.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])),Re.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Re.box(Re.types.trak,Re.tkhd(e),Re.mdia(e))}static trex(e){const t=e.id;return Re.box(Re.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],n=i.length,s=12+16*n,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,n>>>24&255,n>>>16&255,n>>>8&255,n&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<n;o++)c=i[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 Re.box(Re.types.trun,r)}static initSegment(e){Re.types||Re.init();const t=Re.moov(e);return ct(Re.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],n=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),n-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let r=s.length;for(let E=0;E<i.length;E+=1){r+=3;for(let A=0;A<i[E].length;A+=1)r+=2+i[E][A].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=i.length-1;for(let E=0;E<i.length;E+=1){o.set(new Uint8Array([32+E|(E===c?128:0),0,i[E].length]),r),r+=3;for(let A=0;A<i[E].length;A+=1)o.set(new Uint8Array([i[E][A].length>>8,i[E][A].length&255]),r),r+=2,o.set(i[E][A],r),r+=i[E][A].length}const u=Re.box(Re.types.hvcC,o),h=e.width,f=e.height,d=e.pixelRatio[0],y=e.pixelRatio[1];return Re.box(Re.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,Re.box(Re.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Re.box(Re.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,y>>24,y>>16&255,y>>8&255,y&255])))}}Re.types=void 0,Re.HDLR_TYPES=void 0,Re.STTS=void 0,Re.STSC=void 0,Re.STCO=void 0,Re.STSZ=void 0,Re.VMHD=void 0,Re.SMHD=void 0,Re.STSD=void 0,Re.FTYP=void 0,Re.DINF=void 0;const co=9e4;function pa(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function du(a,e,t=1,i=!1){return pa(a,e,1/t,i)}function ar(a,e=!1){return pa(a,1e3,1/co,e)}function pu(a,e=1){return pa(a,co,1/e)}function ho(a){const{baseTime:e,timescale:t,trackId:i}=a;return`${e/t} (${e}/${t}) trackId: ${i}`}const gu=10*1e3,mu=1024,_u=1152,vu=1536;let Gs=null,ga=null;function fo(a,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class Lr extends C{constructor(e,t,i,n){if(super("mp4-remuxer",n),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Gs===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Gs=r?parseInt(r[1]):0}if(ga===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);ga=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&ho(t)} > ${e&&ho(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((s,r)=>{let o=r.pts,c=o-s;return c<-4294967296&&(t=!0,o=Qn(o,i),c=o-s),c>0?s:o},i);return t&&this.debug("PTS rollover detected"),n}remux(e,t,i,n,s,r,o,c){let u,h,f,d,y,E,A=s,S=s;const U=e.pid>-1,j=t.pid>-1,Y=t.samples.length,ue=e.samples.length>0,ge=o&&Y>0||Y>1;if((!U||ue)&&(!j||ge)||this.ISGenerated||o){if(this.ISGenerated){var ve,Ce,Le,xe;const Wt=this.videoTrackConfig;(Wt&&(t.width!==Wt.width||t.height!==Wt.height||((ve=t.pixelRatio)==null?void 0:ve[0])!==((Ce=Wt.pixelRatio)==null?void 0:Ce[0])||((Le=t.pixelRatio)==null?void 0:Le[1])!==((xe=Wt.pixelRatio)==null?void 0:xe[1]))||!Wt&&ge||this.nextAudioTs===null&&ue)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const et=this.isVideoContiguous;let St=-1,Pt;if(ge&&(St=yu(t.samples),!et&&this.config.forceKeyFrameOnDiscontinuity))if(E=!0,St>0){this.warn(`Dropped ${St} out of ${Y} video samples due to a missing keyframe`);const Wt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(St),t.dropped+=St,S+=(t.samples[0].pts-Wt)/t.inputTimeScale,Pt=S}else St===-1&&(this.warn(`No keyframe found out of ${Y} video samples`),E=!1);if(this.ISGenerated){if(ue&&ge){const Wt=this.getVideoStartPts(t.samples),vt=(Qn(e.samples[0].pts,Wt)-Wt)/t.inputTimeScale;A+=Math.max(0,vt),S+=Math.max(0,-vt)}if(ue){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,r)),h=this.remuxAudio(e,A,this.isAudioContiguous,r,j||ge||c===J.AUDIO?S:void 0),ge){const Wt=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,S,et,Wt)}}else ge&&(u=this.remuxVideo(t,S,et,0));u&&(u.firstKeyFrame=St,u.independent=St!==-1,u.firstKeyFramePTS=Pt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(y=po(i,s,this._initPTS,this._initDTS)),n.samples.length&&(d=go(n,s,this._initPTS))),{audio:h,video:u,initSegment:f,independent:E,text:d,id3:y}}computeInitPts(e,t,i,n){const s=Math.round(i*t);let r=Qn(e,s);if(r<s+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(s-r)/t} ${n}`);r<s+t;)r+=8589934592;return r-s}generateIS(e,t,i,n){const s=e.samples,r=t.samples,o=this.typeSupported,c={},u=this._initPTS;let h=!u||n,f="audio/mp4",d,y,E,A=-1;if(h&&(d=y=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):Re.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(A=e.id,E=e.inputTimeScale,!u||E!==u.timescale?d=y=this.computeInitPts(s[0].pts,E,i,"audio"):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:Re.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(A=t.id,E=t.inputTimeScale,!u||E!==u.timescale){const S=this.getVideoStartPts(r),U=Qn(r[0].dts,S),j=this.computeInitPts(U,E,i,"video"),Y=this.computeInitPts(S,E,i,"video");y=Math.min(y,j),d=Math.min(d,Y)}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: ${n?"":"~"}${i} ${d/E} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${d/E} (${d}/${E}) trackId: ${A}`),this._initPTS={baseTime:d,timescale:E,trackId:A},this._initDTS={baseTime:y,timescale:E,trackId:A}):d=E=void 0,{tracks:c,initPTS:d,timescale:E,trackId:A}}remuxVideo(e,t,i,n){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,y=this.videoSampleDuration,E,A,S=Number.POSITIVE_INFINITY,U=Number.NEGATIVE_INFINITY,j=!1;if(!i||f===null){const xt=h+t*s,Tt=r[0].pts-Qn(r[0].dts,r[0].pts);Gs&&f!==null&&Math.abs(xt-Tt-(f+h))<15e3?i=!0:f=xt-Tt-h}const Y=f+h;for(let xt=0;xt<c;xt++){const Tt=r[xt];Tt.pts=Qn(Tt.pts,Y),Tt.dts=Qn(Tt.dts,Y),Tt.dts<r[xt>0?xt-1:xt].dts&&(j=!0)}j&&r.sort(function(xt,Tt){const Ei=xt.dts-Tt.dts,Gi=xt.pts-Tt.pts;return Ei||Gi}),E=r[0].dts,A=r[r.length-1].dts;const ue=A-E,ge=ue?Math.round(ue/(c-1)):y||e.inputTimeScale/30;if(i){const xt=E-Y,Tt=xt>ge,Ei=xt<-1;if((Tt||Ei)&&(Tt?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ar(xt,!0)} ms (${xt}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ar(-xt,!0)} ms (${xt}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Ei||Y>=r[0].pts||Gs)){E=Y;const Gi=r[0].pts-xt;if(Tt)r[0].dts=E,r[0].pts=Gi;else{let Ti=!0;for(let Ci=0;Ci<r.length&&!(r[Ci].dts>Gi&&Ti);Ci++){const Nn=r[Ci].pts;if(r[Ci].dts-=xt,r[Ci].pts-=xt,Ci<r.length-1){const Cn=r[Ci+1].pts,is=r[Ci].pts,gs=Cn<=is,Ps=Cn<=Nn;Ti=gs==Ps}}}this.log(`Video: Initial PTS/DTS adjusted: ${ar(Gi,!0)}/${ar(E,!0)}, delta: ${ar(xt,!0)} ms`)}}E=Math.max(0,E);let Fe=0,ve=0,Ce=E;for(let xt=0;xt<c;xt++){const Tt=r[xt],Ei=Tt.units,Gi=Ei.length;let Ti=0;for(let Ci=0;Ci<Gi;Ci++)Ti+=Ei[Ci].data.length;ve+=Ti,Fe+=Gi,Tt.length=Ti,Tt.dts<Ce?(Tt.dts=Ce,Ce+=ge/4|0||1):Ce=Tt.dts,S=Math.min(Tt.pts,S),U=Math.max(Tt.pts,U)}A=r[c-1].dts;const Le=ve+4*Fe+8;let xe;try{xe=new Uint8Array(Le)}catch(xt){this.observer.emit(p.ERROR,p.ERROR,{type:te.MUX_ERROR,details:M.REMUX_ALLOC_ERROR,fatal:!1,error:xt,bytes:Le,reason:`fail allocating video mdat ${Le}`});return}const et=new DataView(xe.buffer);et.setUint32(0,Le),xe.set(Re.types.mdat,4);let St=!1,Pt=Number.POSITIVE_INFINITY,Wt=Number.POSITIVE_INFINITY,Ot=Number.NEGATIVE_INFINITY,vt=Number.NEGATIVE_INFINITY;for(let xt=0;xt<c;xt++){const Tt=r[xt],Ei=Tt.units;let Gi=0;for(let Nn=0,Cn=Ei.length;Nn<Cn;Nn++){const is=Ei[Nn],gs=is.data,Ps=is.data.byteLength;et.setUint32(d,Ps),d+=4,xe.set(gs,d),d+=Ps,Gi+=4+Ps}let Ti;if(xt<c-1)y=r[xt+1].dts-Tt.dts,Ti=r[xt+1].pts-Tt.pts;else{const Nn=this.config,Cn=xt>0?Tt.dts-r[xt-1].dts:ge;if(Ti=xt>0?Tt.pts-r[xt-1].pts:ge,Nn.stretchShortVideoTrack&&this.nextAudioTs!==null){const is=Math.floor(Nn.maxBufferHole*s),gs=(n?S+n*s:this.nextAudioTs+h)-Tt.pts;gs>is?(y=gs-Cn,y<0?y=Cn:St=!0,this.log(`It is approximately ${gs/90} ms to the next segment; using duration ${y/90} ms for the last video frame.`)):y=Cn}else y=Cn}const Ci=Math.round(Tt.pts-Tt.dts);Pt=Math.min(Pt,y),Ot=Math.max(Ot,y),Wt=Math.min(Wt,Ti),vt=Math.max(vt,Ti),o.push(fo(Tt.key,y,Gi,Ci))}if(o.length){if(Gs){if(Gs<70){const xt=o[0].flags;xt.dependsOn=2,xt.isNonSync=0}}else if(ga&&vt-Wt<Ot-Pt&&ge/Ot<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let xt=E;for(let Tt=0,Ei=o.length;Tt<Ei;Tt++){const Gi=xt+o[Tt].duration,Ti=xt+o[Tt].cts;if(Tt<Ei-1){const Ci=Gi+o[Tt+1].cts;o[Tt].duration=Ci-Ti}else o[Tt].duration=Tt?o[Tt-1].duration:ge;o[Tt].cts=0,xt=Gi}}}y=St||!y?ge:y;const Nt=A+y;this.nextVideoTs=f=Nt-h,this.videoSampleDuration=y,this.isVideoContiguous=!0;const si={data1:Re.moof(e.sequenceNumber++,E,m(e,{samples:o})),data2:xe,startPTS:(S-h)/s,endPTS:(U+y-h)/s,startDTS:(E-h)/s,endDTS:f/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,si}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return _u;case"ac3":return vu;default:return mu}}remuxAudio(e,t,i,n,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,y=[],E=s!==void 0;let A=e.samples,S=d?0:8,U=this.nextAudioTs||-1;const j=f.baseTime*r/f.timescale,Y=j+t*r;if(this.isAudioContiguous=i=i||A.length&&U>0&&(n&&Math.abs(Y-(U+j))<9e3||Math.abs(Qn(A[0].pts,Y)-(U+j))<20*h),A.forEach(function(vt){vt.pts=Qn(vt.pts,Y)}),!i||U<0){const vt=A.length;if(A=A.filter(Nt=>Nt.pts>=0),vt!==A.length&&this.warn(`Removed ${A.length-vt} of ${vt} samples (initPTS ${j} / ${r})`),!A.length)return;s===0?U=0:n&&!E?U=Math.max(0,Y-j):U=A[0].pts-j}if(e.segmentCodec==="aac"){const vt=this.config.maxAudioFramesDrift;for(let Nt=0,Rt=U+j;Nt<A.length;Nt++){const Bt=A[Nt],si=Bt.pts,xt=si-Rt,Tt=Math.abs(1e3*xt/r);if(xt<=-vt*h&&E)Nt===0&&(this.warn(`Audio frame @ ${(si/r).toFixed(3)}s overlaps marker by ${Math.round(1e3*xt/r)} ms.`),this.nextAudioTs=U=si-j,Rt=si);else if(xt>=vt*h&&Tt<gu&&E){let Ei=Math.round(xt/h);for(Rt=si-Ei*h;Rt<0&&Ei&&h;)Ei--,Rt+=h;Nt===0&&(this.nextAudioTs=U=Rt-j),this.warn(`Injecting ${Ei} audio frames @ ${((Rt-j)/r).toFixed(3)}s due to ${Math.round(1e3*xt/r)} ms gap.`);for(let Gi=0;Gi<Ei;Gi++){let Ti=fu.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Ti||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Ti=Bt.unit.subarray()),A.splice(Nt,0,{unit:Ti,pts:Rt}),Rt+=h,Nt++}}Bt.pts=Rt,Rt+=h}}let ue=null,ge=null,Fe,ve=0,Ce=A.length;for(;Ce--;)ve+=A[Ce].unit.byteLength;for(let vt=0,Nt=A.length;vt<Nt;vt++){const Rt=A[vt],Bt=Rt.unit;let si=Rt.pts;if(ge!==null){const Tt=y[vt-1];Tt.duration=Math.round((si-ge)/c)}else if(i&&e.segmentCodec==="aac"&&(si=U+j),ue=si,ve>0){ve+=S;try{Fe=new Uint8Array(ve)}catch(Tt){this.observer.emit(p.ERROR,p.ERROR,{type:te.MUX_ERROR,details:M.REMUX_ALLOC_ERROR,fatal:!1,error:Tt,bytes:ve,reason:`fail allocating audio mdat ${ve}`});return}d||(new DataView(Fe.buffer).setUint32(0,ve),Fe.set(Re.types.mdat,4))}else return;Fe.set(Bt,S);const xt=Bt.byteLength;S+=xt,y.push(fo(!0,u,xt,0)),ge=si}const Le=y.length;if(!Le)return;const xe=y[y.length-1];U=ge-j,this.nextAudioTs=U+c*xe.duration;const et=d?new Uint8Array(0):Re.moof(e.sequenceNumber++,ue/c,m({},e,{samples:y}));e.samples=[];const St=(ue-j)/r,Pt=U/r,Ot={data1:et,data2:Fe,startPTS:St,endPTS:Pt,startDTS:St,endDTS:Pt,type:"audio",hasAudio:!0,hasVideo:!1,nb:Le};return this.isAudioContiguous=!0,Ot}}function Qn(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 yu(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function po(a,e,t,i){const n=a.samples.length;if(!n)return;const s=a.inputTimeScale;for(let o=0;o<n;o++){const c=a.samples[o];c.pts=Qn(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=Qn(c.dts-i.baseTime*s/i.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function go(a,e,t){const i=a.samples.length;if(!i)return;const n=a.inputTimeScale;for(let r=0;r<i;r++){const o=a.samples[r];o.pts=Qn(o.pts-t.baseTime*n/t.timescale,e*n)/n}a.samples.sort((r,o)=>r.pts-o.pts);const s=a.samples;return a.samples=[],{samples:s}}class Eu extends C{constructor(e,t,i,n){super("passthrough-remuxer",n),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,n),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:s,video:r}=this.initData=ze(e);if(t)He(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&&(i=mo(s,L.AUDIO,this)),r&&(n=mo(r,L.VIDEO,this));const o={};s&&r?o.audiovideo={container:"video/mp4",codec:i+","+n,supplemental:r.supplemental,encrypted:r.encrypted,initSegment:e,id:"main"}:s?o.audio={container:"audio/mp4",codec:i,encrypted:s.encrypted,initSegment:e,id:"audio"}:r?o.video={container:"video/mp4",codec:n,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,i,n,s,r){var o,c;let{initPTS:u,lastEndTime:h}=this;const f={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};V(h)||(h=this.lastEndTime=s||0);const d=t.samples;if(!d.length)return f;const y={initPTS:void 0,timescale:void 0,trackId:void 0};let E=this.initData;if((o=E)!=null&&o.length||(this.generateInitSegment(d),E=this.initData),!((c=E)!=null&&c.length))return this.warn("Failed to generate initSegment."),f;this.emitInitSegment&&(y.tracks=this.initTracks,this.emitInitSegment=!1);const A=qe(d,E,this),S=E.audio?A[E.audio.id]:null,U=E.video?A[E.video.id]:null,j=Cr(U,1/0),Y=Cr(S,1/0),ue=Cr(U,0,!0),ge=Cr(S,0,!0);let Fe=s,ve=0;const Ce=S&&(!U||!u&&Y<j||u&&u.trackId===E.audio.id),Le=Ce?S:U;if(Le){const Rt=Le.timescale,Bt=Le.start-s*Rt,si=Ce?E.audio.id:E.video.id;Fe=Le.start/Rt,ve=Ce?ge-Y:ue-j,(r||!u)&&(bu(u,Fe,s,ve)||Rt!==u.timescale)&&(u&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${Bt/Rt} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${Fe-s} (${Bt}/${Rt}) trackId: ${si}`),u=null,y.initPTS=Bt,y.timescale=Rt,y.trackId=si)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);u?(y.initPTS=u.baseTime,y.timescale=u.timescale,y.trackId=u.trackId):((!y.timescale||y.trackId===void 0||y.initPTS===void 0)&&(this.warn("Could not set initPTS"),y.initPTS=Fe,y.timescale=1,y.trackId=-1),this.initPTS=u={baseTime:y.initPTS,timescale:y.timescale,trackId:y.trackId});const xe=Fe-u.baseTime/u.timescale,et=xe+ve;ve>0?this.lastEndTime=et:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const St=!!E.audio,Pt=!!E.video;let Wt="";St&&(Wt+="audio"),Pt&&(Wt+="video");const Ot=(E.audio?E.audio.encrypted:!1)||(E.video?E.video.encrypted:!1),vt={data1:d,startPTS:xe,startDTS:xe,endPTS:et,endDTS:et,type:Wt,hasAudio:St,hasVideo:Pt,nb:1,dropped:0,encrypted:Ot};f.audio=St&&!Pt?vt:void 0,f.video=Pt?vt:void 0;const Nt=U==null?void 0:U.sampleCount;if(Nt){const Rt=U.keyFrameIndex,Bt=Rt!==-1;vt.nb=Nt,vt.dropped=Rt===0||this.isVideoContiguous?0:Bt?Rt:Nt,vt.independent=Bt,vt.firstKeyFrame=Rt,Bt&&U.keyFrameStart&&(vt.firstKeyFramePTS=(U.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(f.independent=Bt),this.isVideoContiguous||(this.isVideoContiguous=Bt),vt.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${Rt}/${Nt} dropped: ${vt.dropped} start: ${vt.firstKeyFramePTS||"NA"}`)}return f.initSegment=y,f.id3=po(i,s,u,u),n.samples.length&&(f.text=go(n,s,u)),f}}function Cr(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function bu(a,e,t,i){if(a===null)return!0;const n=Math.max(i,1),s=e-a.baseTime/a.timescale;return Math.abs(s-t)>n}function mo(a,e,t){const i=a.codec;return i&&i.length>4?i:e===L.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?Ge(i,!1):(t.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(t.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}let ys;try{ys=self.performance.now.bind(self.performance)}catch(a){ys=Date.now}const kr=[{demux:au,remux:Eu},{demux:Ts,remux:Lr},{demux:iu,remux:Lr},{demux:su,remux:Lr}];kr.splice(2,0,{demux:nu,remux:Lr});class _o{constructor(e,t,i,n,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=i,this.id=s,this.logger=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const s=i.transmuxing;s.executeStart=ys();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:u,discontinuity:h,trackSwitch:f,accurateTimeOffset:d,timeOffset:y,initSegmentChange:E}=n||o,{audioCodec:A,videoCodec:S,defaultInitPts:U,duration:j,initSegmentData:Y}=c,ue=xu(r,t);if(ue&&Kn(ue.method)){const Ce=this.getDecrypter(),Le=us(ue.method);if(Ce.isSync()){let xe=Ce.softwareDecrypt(r,ue.key.buffer,ue.iv.buffer,Le);if(i.part>-1){const St=Ce.flush();xe=St&&St.buffer}if(!xe)return s.executeEnd=ys(),ma(i);r=new Uint8Array(xe)}else return this.asyncResult=!0,this.decryptionPromise=Ce.webCryptoDecrypt(r,ue.key.buffer,ue.iv.buffer,Le).then(xe=>{const et=this.push(xe,null,i);return this.decryptionPromise=null,et}),this.decryptionPromise}const ge=this.needsProbing(h,f);if(ge){const Ce=this.configureTransmuxer(r);if(Ce)return this.logger.warn(`[transmuxer] ${Ce.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:te.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!1,error:Ce,reason:Ce.message}),s.executeEnd=ys(),ma(i)}(h||f||E||ge)&&this.resetInitSegment(Y,A,S,j,t),(h||E||ge)&&this.resetInitialTimestamp(U),u||this.resetContiguity();const Fe=this.transmux(r,ue,y,d,i);this.asyncResult=or(Fe);const ve=this.currentTransmuxState;return ve.contiguous=!0,ve.discontinuity=!1,ve.trackSwitch=!1,s.executeEnd=ys(),Fe}flush(e){const t=e.transmuxing;t.executeStart=ys();const{decrypter:i,currentTransmuxState:n,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const r=[],{timeOffset:o}=n;if(i){const f=i.flush();f&&r.push(this.push(f.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=ys();const f=[ma(e)];return this.asyncResult?Promise.resolve(f):f}const h=c.flush(o);return or(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,i){const{audioTrack:n,videoTrack:s,id3Track:r,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===J.MAIN?"level":"track"} ${i.level}`);const h=this.remuxer.remux(n,s,r,o,u,c,!0,this.id);e.push({remuxResult:h,chunkMeta:i}),i.transmuxing.executeEnd=ys()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,n,s){const{demuxer:r,remuxer:o}=this;!r||!o||(r.resetInitSegment(e,t,i,n),o.resetInitSegment(e,t,i,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,s){let r;return t&&t.method==="SAMPLE-AES"?r=this.transmuxSampleAes(e,t,i,n,s):r=this.transmuxUnencrypted(e,i,n,s),r}transmuxUnencrypted(e,t,i,n){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,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,s){return this.demuxer.demuxSampleAes(e,t,i).then(r=>({remuxResult:this.remuxer.remux(r.audioTrack,r.videoTrack,r.id3Track,r.textTrack,i,n,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n}=this;let s;for(let f=0,d=kr.length;f<d;f++){var r;if((r=kr[f].demux)!=null&&r.probe(e,this.logger)){s=kr[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(i,t,n,this.logger)),(!o||!(o instanceof h))&&(this.demuxer=new h(i,t,n,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 yn(this.config)),e}}function xu(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 ma=a=>({remuxResult:{},chunkMeta:a});function or(a){return"then"in a&&a.then instanceof Function}class Tu{constructor(e,t,i,n,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=n,this.defaultInitPts=s||null}}class Su{constructor(e,t,i,n,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=i,this.trackSwitch=n,this.timeOffset=s,this.initSegmentChange=r}}let vo=0;class yo{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=vo++,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(p.ERROR,{type:te.OTHER_ERROR,details:M.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const r=(c,u)=>{u=u||{},u.frag=this.frag||void 0,c===p.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(c,u)};this.observer=new sa,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=rt(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||Rl()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=Ll(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=Il());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:De(s)})}catch(h){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.terminateWorker(),this.error=null,this.transmuxer=new _o(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new _o(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=vo++;const t=this.hls.config,i=rt(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:De(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),Cl(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,n,s,r,o,c,u,h){var f,d;u.transmuxing.start=self.performance.now();const{instanceNo:y,transmuxer:E}=this,A=r?r.start:s.start,S=s.decryptdata,U=this.frag,j=!(U&&s.cc===U.cc),Y=!(U&&u.level===U.level),ue=U?u.sn-U.sn:-1,ge=this.part?u.part-this.part.index:-1,Fe=ue===0&&u.id>1&&u.id===(U==null?void 0:U.stats.chunkCount),ve=!Y&&(ue===1||ue===0&&(ge===1||Fe&&ge<=0)),Ce=self.performance.now();(Y||ue||s.stats.parsing.start===0)&&(s.stats.parsing.start=Ce),r&&(ge||!ve)&&(r.stats.parsing.start=Ce);const Le=!(U&&((f=s.initSegment)==null?void 0:f.url)===((d=U.initSegment)==null?void 0:d.url)),xe=new Su(j,ve,c,Y,A,Le);if(!ve||j||Le){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===J.MAIN?"level":"track"}: ${u.level} id: ${u.id}
|
|
discontinuity: ${j}
|
|
trackSwitch: ${Y}
|
|
contiguous: ${ve}
|
|
accurateTimeOffset: ${c}
|
|
timeOffset: ${A}
|
|
initSegmentChange: ${Le}`);const et=new Tu(i,n,t,o,h);this.configureTransmuxer(et)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:y,cmd:"demux",data:e,decryptdata:S,chunkMeta:u,state:xe},e instanceof ArrayBuffer?[e]:[]);else if(E){const et=E.push(e,S,u,xe);or(et)?et.then(St=>{this.handleTransmuxComplete(St)}).catch(St=>{this.transmuxerError(St,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(et)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const n=i.flush(e);or(n)?n.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(n,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:te.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Eo=100;class Au extends ia{constructor(e,t,i){super(e,t,i,"audio-stream-controller",J.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(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s,trackId:r}){if(i===J.MAIN){const o=t.cc,c=this.fragCurrent;if(this.initPTS[o]={baseTime:n,timescale:s,trackId:r},this.log(`InitPTS for cc: ${o} found from main: ${n/s} (${n}/${s}) trackId: ${r}`),this.mainAnchor=t,this.state===Ye.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===Ye.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const n=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&(n==null?void 0:n.cc)===t.cc)return;const s=(n||e).cc,r=this.getLevelDetails(),o=this.getLoadPosition(),c=fi(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===Ye.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=Ye.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Eo),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=Ye.IDLE):this.state=Ye.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case Ye.IDLE:this.doTickIdle();break;case Ye.WAITING_TRACK:{const{levels:e,trackId:t}=this,i=e==null?void 0:e[t],n=i==null?void 0:i.details;if(n&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(n))break;this.state=Ye.WAITING_INIT_PTS}break}case Ye.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case Ye.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:n,complete:s}=e,r=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=Ye.FRAG_LOADING;const o=n.flush().buffer,c={frag:t,part:i,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=Ye.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:s}=this,r=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!r.startFragPrefetch)||!(i!=null&&i[s]))return;const o=i[s],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=Ye.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,L.AUDIO,J.AUDIO));const h=this.getFwdBufferInfo(u,J.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,c)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=Ye.ENDED;return}const f=h.len,d=t.maxBufferLength,y=c.fragments,E=y[0].start,A=this.getLoadPosition(),S=this.flushing?A:h.end;if(this.switchingTrack&&n){const Y=A;c.PTSKnown&&Y<E&&(h.end>E||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=E+.05)}if(f>=d&&!this.switchingTrack&&S<y[y.length-1].start)return;let U=this.getNextFragment(S,c);if(U&&this.isLoopLoading(U,S)&&(U=this.getNextFragmentLoopLoading(U,c,h,J.MAIN,d)),!U){this.bufferFlushed=!0;return}let j=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&j&&Ae(U)&&!U.endList&&(!c.live||!this.loadingParts&&S<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(j)===oi.OK&&(this.mainFragLoading=j=null),j&&Ae(j))){if(U.start>j.end){const ue=this.fragmentTracker.getFragAtPos(S,J.MAIN);ue&&ue.end>j.end&&(j=ue,this.mainFragLoading={frag:ue,targetBufferTime:null})}if(U.start>j.end)return}this.loadFragment(U,o,S)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new nn(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==Ye.STOPPED&&(this.setInterval(Eo),this.state=Ye.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(p.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:n}=this,{details:s,id:r,groupId:o,track:c}=t;if(!n){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!==Ye.STOPPED&&(this.state=Ye.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=n[r];let f=0;if(s.live||(i=h.details)!=null&&i.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||(Sr(s,u),s.alignedSliding||Ar(s,u),f=s.fragmentStart)}h.details=s,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(u,f),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===Ye.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=Ye.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,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 ${i.sn} of level ${i.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(i.start);return}const f=r.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let d=this.transmuxer;d||(d=this.transmuxer=new yo(this.hls,J.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const y=this.initPTS[i.cc],E=(t=i.initSegment)==null?void 0:t.data;if(y!==void 0){const S=n?n.index:-1,U=S!==-1,j=new Gt(i.level,i.sn,i.stats.chunkCount,s.byteLength,S,U);d.push(s,E,f,"",i,n,h.totalduration,!1,j,y)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:A}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new ja,complete:!1};A.push(new Uint8Array(s)),this.state!==Ye.STOPPED&&(this.state=Ye.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===J.MAIN&&Ae(t.frag)&&(this.mainFragLoading=t,this.state===Ye.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==J.AUDIO){!this.audioOnly&&i.type===J.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(Ae(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,b({},s)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=Ye.ERROR;return}switch(t.details){case M.FRAG_GAP:case M.FRAG_PARSING_ERROR:case M.FRAG_DECRYPT_ERROR:case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(J.AUDIO,t);break;case M.AUDIO_TRACK_LOAD_ERROR:case M.AUDIO_TRACK_LOAD_TIMEOUT:case M.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ye.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===ce.AUDIO_TRACK&&(this.state=Ye.IDLE);break;case M.BUFFER_ADD_CODEC_ERROR:case M.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case M.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case M.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==L.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==L.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Ye.ENDED&&(this.state=Ye.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,J.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=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:y,id3:E,initSegment:A}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=Ye.PARSING,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),A!=null&&A.tracks){const S=c.initSegment||c;if(this.unhandledEncryptionError(A,c))return;this._bufferInitSegment(h,A.tracks,S,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:i,tracks:A.tracks})}if(d){const{startPTS:S,endPTS:U,startDTS:j,endDTS:Y}=d;u&&(u.elementaryStreams[L.AUDIO]={startPTS:S,endPTS:U,startDTS:j,endDTS:Y}),c.setElementaryStreamInfo(L.AUDIO,S,U,j,Y),this.bufferFragmentData(d,c,u,r)}if(E!=null&&(t=E.samples)!=null&&t.length){const S=m({id:i,frag:c,details:f},E);n.trigger(p.FRAG_PARSING_METADATA,S)}if(y){const S=m({id:i,frag:c,details:f},y);n.trigger(p.FRAG_PARSING_USERDATA,S)}}_bufferInitSegment(e,t,i,n){if(this.state!==Ye.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=J.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(p.BUFFER_CODECS,t);const o=s.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:o};this.hls.trigger(p.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);if(this.switchingTrack||n===oi.NOT_LOADED||n===oi.PARTIAL){var s;if(!Ae(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=Ye.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&Ar(t.details,r)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o}=this.bufferedTrack;ti({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,kt)||(ai(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(p.AUDIO_TRACK_SWITCHED,b({},e))}}class _a extends C{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const n=t==null?void 0:t.renditionReports;if(n){let s=-1;for(let r=0;r<n.length;r++){const o=n[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=n[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=i&&un(i);return new Wi(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(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:n,stats:s}=t,r=self.performance.now(),o=s.loading.first?Math.max(0,r-s.loading.first):0;n.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==n.appliedTimelineOffset){const h=Math.max(c||0,0);n.appliedTimelineOffset=h,n.fragments.forEach(f=>{f.setStart(f.playlistOffset+h)})}if(n.live||i!=null&&i.live){const h="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){Jr(i,n,this);const j=n.playlistParsingError;if(j){this.warn(j);const Y=this.hls;if(!Y.config.ignorePlaylistParsingErrors){var u;const{networkDetails:ue}=t;Y.trigger(p.ERROR,{type:te.NETWORK_ERROR,details:M.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:j,reason:j.message,level:t.level||void 0,parent:(u=n.fragments[0])==null?void 0:u.type,networkDetails:ue,stats:s});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=s.loading.start);const f=this.hls.mainForwardBufferInfo,d=f?f.end-f.len:0,y=(n.edge-d)*1e3,E=rn(n,y);if(n.requestScheduled+E<r?n.requestScheduled=r:n.requestScheduled+=E,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let A,S,U;if(n.canBlockReload&&n.endSN&&n.advanced){const j=this.hls.config.lowLatencyMode,Y=n.lastPartSn,ue=n.endSN,ge=n.lastPartIndex,Fe=ge!==-1,ve=Y===ue;Fe?ve?(S=ue+1,U=j?0:ge):(S=Y,U=j?ge+1:n.maxPartIndex):S=ue+1;const Ce=n.age,Le=Ce+n.ageHeader;let xe=Math.min(Le-n.partTarget,n.targetduration*1.5);if(xe>0){if(Le>n.targetduration*3)this.log(`Playlist last advanced ${Ce.toFixed(2)}s ago. Omitting segment and part directives.`),S=void 0,U=void 0;else if(i!=null&&i.tuneInGoal&&Le-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${xe} with playlist age: ${n.age}`),xe=0;else{const et=Math.floor(xe/n.targetduration);if(S+=et,U!==void 0){const St=Math.round(xe%n.targetduration/n.partTarget);U+=St}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${Ce.toFixed(2)}s goal: ${xe} skip sn ${et} to part ${U}`)}n.tuneInGoal=xe}if(A=this.getDeliveryDirectives(n,t.deliveryDirectives,S,U),j||!ve){n.requestScheduled=r,this.loadingPlaylist(h,A);return}}else(n.canBlockReload||n.canSkipUntil)&&(A=this.getDeliveryDirectives(n,t.deliveryDirectives,S,U));A&&S!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(E-o*2,E/2)),this.scheduleLoading(h,A,n)}else this.clearTimer()}scheduleLoading(e,t,i){const n=i||e.details;if(!n){this.loadingPlaylist(e,t);return}const s=self.performance.now(),r=n.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,i,n){let s=un(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=Ai.No),new Wi(i,n,s)}checkRetry(e){const t=e.details,i=bi(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},c=!!n&&!!o&&(s===xi.RetryRequest||!n.resolved&&s===xi.SendAlternateToPenaltyBox);if(c){var u;if(r>=o.maxNumRetry)return!1;if(i&&(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=$i(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,n.resolved=!0}return c}}function bo(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!lr(a[t].attrs,e[t].attrs))return!1;return!0}function lr(a,e,t){const i=a["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(n=>a[n]!==e[n])}function va(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class wu extends _a{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Audio track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Audio track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(n==null?void 0:n.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(d=>!i||i.indexOf(d.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(d=>d.default)&&(this.selectDefaultTrack=!1),o.forEach((d,y)=>{d.id=y});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const d=Et(c,o,kt);if(d>-1)s=o[d];else{const y=Et(c,this.tracks);s=this.tracks[y]}}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): ${i==null?void 0:i.join(",")}`),this.hls.trigger(p.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(p.ERROR,{type:te.MEDIA_ERROR,details:M.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:d})}}}onError(e,t){t.fatal||!t.context||t.context.type===ce.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const n=this.currentTrack;if(n&&ti(e,n,kt))return n;const s=Et(e,this.tracksInGroup,kt);if(s>-1){const r=this.tracksInGroup[s];return this.setAudioTrack(s),r}else if(n){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);const o=ei(e,t.levels,i,r,kt);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=Et(e,i);if(r>-1)return i[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 i=this.currentTrack,n=t[e],s=n.details&&!n.details.live;if(e===this.trackId&&n===i&&s||(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger(p.AUDIO_TRACK_SWITCHING,b({},n)),s))return;const r=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(!(this.selectDefaultTrack&&!n.default)&&(!e||ti(e,n,kt)))return i}if(e){const{name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c}=e;for(let u=0;u<t.length;u++){const h=t[u];if(ti({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c},h,kt))return u}for(let u=0;u<t.length;u++){const h=t[u];if(lr(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const h=t[u];if(lr(e.attrs,h.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&ai(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${n}${(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(p.AUDIO_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}}class Du{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const n=this.queues[t];n.push(e),n.length===1&&!i&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(s){var i;if(n.onError(s),this.queues===null||this.tracks===null)return;const r=(i=this.tracks[e])==null?void 0:i.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,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],n=i==null?void 0:i.buffer;return n?`SourceBuffer${n.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const xo=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,To="HlsJsTrackRemovedError";class Ru extends Error{constructor(e){super(e),this.name=To}}class Iu extends C{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var n;this.hls&&((n=this.mediaSource)==null?void 0:n.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:n,mediaSource:s}=this;i&&this.log("Media source opened"),!(!n||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:n,mediaSource:s}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:n}=this;i!==n&&this.error(`Media element src was set while attaching MediaSource (${n} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=be(ye(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(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_APPENDING,this.onBufferAppending,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.BUFFER_EOS,this.onBufferEos,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.FRAG_PARSED,this.onFragParsed,this),e.on(p.FRAG_CHANGED,this.onFragChanged,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_APPENDING,this.onBufferAppending,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_EOS,this.onBufferEos,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.FRAG_PARSED,this.onFragParsed,this),e.off(p.FRAG_CHANGED,this.onFragChanged,this),e.off(p.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const s=this.isUpdating();s||this.operationQueue.removeBlockers();const r=this.isQueued();(s||r)&&this.warn(`Transfering MediaSource with${r?" operations in queue":""}${s?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?m(i,n.tracks):this.sourceBuffers.forEach(s=>{const[r]=s;r&&(i[r]=m({},this.tracks[r]),this.removeBuffer(r)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const n=ye(this.appendSource);if(n){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(r),s)this._objectUrl=i.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&r instanceof c,So(i),Lu(i,o),i.load()}catch(c){i.src=o}else i.src=o}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,n=t.tracks,s=n?Object.keys(n):null,r=s?s.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(n&&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: ${De(i,(c,u)=>c==="initSegment"?void 0:u)};
|
|
transfer tracks: ${De(n,(c,u)=>c==="initSegment"?void 0:u)}}`),!Ee(n,i)){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(n)}"->"${Object.keys(i)}") start time: ${h} currentTime: ${c}`),this.onMediaDetaching(p.MEDIA_DETACHING,{}),this.onMediaAttaching(p.MEDIA_ATTACHING,t),e.currentTime=h;return}this.transferData=void 0,s.forEach(c=>{const u=c,h=n[u];if(h){const f=h.buffer;if(f){const d=this.fragmentTracker,y=h.id;if(d.hasFragments(y)||d.hasParts(y)){const S=Mt.getBuffered(f);d.detectEvictedFragments(u,S,y,null,!0)}const E=ya(u),A=[u,f];this.sourceBuffers[E]=A,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 i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:s,_objectUrl:r}=this;if(s){if(this.log(`media source ${i?"transferring":"detaching"}`),i)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}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(n.removeAttribute("src"),this.appendSource&&So(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(p.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[ya(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Du(this.tracks)}onBufferCodecs(e,t){var i;const n=this.tracks,s=Object.keys(t);this.log(`BUFFER_CODECS: "${s}" (current SB count ${this.sourceBufferCount})`);const r="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),o=!r&&this.sourceBufferCount&&this.media&&s.some(c=>!n[c]);if(r||o){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${s}" SourceBuffers`);return}s.forEach(c=>{var u,h;const f=t[c],{id:d,codec:y,levelCodec:E,container:A,metadata:S,supplemental:U}=f;let j=n[c];const Y=(u=this.transferData)==null||(u=u.tracks)==null?void 0:u[c],ue=Y!=null&&Y.buffer?Y:j,ge=(ue==null?void 0:ue.pendingCodec)||(ue==null?void 0:ue.codec),Fe=ue==null?void 0:ue.levelCodec;j||(j=n[c]={buffer:void 0,listeners:[],codec:y,supplemental:U,container:A,levelCodec:E,metadata:S,id:d});const ve=gt(ge,Fe),Ce=ve==null?void 0:ve.replace(xo,"$1");let Le=gt(y,E);const xe=(h=Le)==null?void 0:h.replace(xo,"$1");Le&&ve&&Ce!==xe&&(c.slice(0,5)==="audio"&&(Le=Ge(Le,this.appendSource)),this.log(`switching codec ${ge} to ${Le}`),Le!==(j.pendingCodec||j.codec)&&(j.pendingCodec=Le),j.container=A,this.appendChangeType(c,A,Le))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((i=t.audio)==null?void 0:i.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const n=`${t};codecs=${i}`,s={label:`change-type=${n}`,execute:()=>{const r=this.tracks[e];if(r){const o=r.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),o.changeType(n),r.codec=i,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 i=e.start,n=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,J.MAIN))==null?void 0:t.gap)===!0)return;const r={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>n||c!=null&&c.buffer&&Mt.isBuffered(c.buffer,n)||((o=this.fragmentTracker.getAppendedFrag(n,J.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:i}=this,{data:n,type:s,parent:r,frag:o,part:c,chunkMeta:u,offset:h}=t,f=u.buffering[s],{sn:d,cc:y}=o,E=self.performance.now();f.start=E;const A=o.stats.buffering,S=c?c.stats.buffering:null;A.start===0&&(A.start=E),S&&S.start===0&&(S.start=E);const U=i.audio;let j=!1;s==="audio"&&(U==null?void 0:U.container)==="audio/mpeg"&&(j=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const Y=i.video,ue=Y==null?void 0:Y.buffer;if(ue&&d!=="initSegment"){const ve=c||o,Ce=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend&&!(Y.ending||Y.ended)){const xe=ve.start+ve.duration*.05,et=ue.buffered,St=this.currentOp("video");!et.length&&!St?this.blockAudio(ve):!St&&!Mt.isBuffered(ue,xe)&&this.lastVideoAppendEnd<xe&&this.blockAudio(ve)}else if(s==="video"){const Le=ve.end;if(Ce){const xe=Ce.frag.start;(Le>xe||Le<this.lastVideoAppendEnd||Mt.isBuffered(ue,xe))&&this.unblockAudio()}this.lastVideoAppendEnd=Le}}const ge=(c||o).start,Fe={label:`append-${s}`,execute:()=>{var ve;f.executeStart=self.performance.now();const Ce=(ve=this.tracks[s])==null?void 0:ve.buffer;Ce&&(j?this.updateTimestampOffset(Ce,ge,.1,s,d,y):h!==void 0&&V(h)&&this.updateTimestampOffset(Ce,h,1e-6,s,d,y)),this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const ve=self.performance.now();f.executeEnd=f.end=ve,A.first===0&&(A.first=ve),S&&S.first===0&&(S.first=ve);const Ce={};this.sourceBuffers.forEach(([Le,xe])=>{Le&&(Ce[Le]=Mt.getBuffered(xe))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(p.BUFFER_APPENDED,{type:s,frag:o,part:c,chunkMeta:u,parent:o.type,timeRanges:Ce})},onError:ve=>{var Ce;const Le={type:te.MEDIA_ERROR,parent:o.type,details:M.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:ve,err:ve,fatal:!1},xe=(Ce=this.media)==null?void 0:Ce.error;if(ve.code===DOMException.QUOTA_EXCEEDED_ERR||ve.name=="QuotaExceededError"||"quota"in ve)Le.details=M.BUFFER_FULL_ERROR;else if(ve.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!xe)Le.errorAction=Si(!0);else if(ve.name===To&&this.sourceBufferCount===0)Le.errorAction=Si(!0);else{const et=++this.appendErrors[s];this.warn(`Failed ${et}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${xe||"no media error"})`),(et>=this.hls.config.appendErrorMaxRetry||xe)&&(Le.fatal=!0)}this.hls.trigger(p.ERROR,Le)}};this.log(`queuing "${s}" append sn: ${d}${c?" p: "+c.index:""} of ${o.type===J.MAIN?"level":"track"} ${o.level} cc: ${y}`),this.append(Fe,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:i,startOffset:n,endOffset:s}=t;i?this.append(this.getFlushOp(i,n,s),i):this.sourceBuffers.forEach(([r])=>{r&&this.append(this.getFlushOp(r,n,s),r)})}onFragParsed(e,t){const{frag:i,part:n}=t,s=[],r=n?n.elementaryStreams:i.elementaryStreams;r[L.AUDIOVIDEO]?s.push("audiovideo"):(r[L.AUDIO]&&s.push("audio"),r[L.VIDEO]&&s.push("video"));const o=()=>{const c=self.performance.now();i.stats.buffering.end=c,n&&(n.stats.buffering.end=c);const u=n?n.stats:i.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:i,part:n,stats:u,id:i.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(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 i;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 n=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([r])=>{var o;return r&&!((o=this.tracks[r])!=null&&o.ended)})?n?(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(p.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(p.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===M.BUFFER_APPEND_ERROR&&t.frag){var i;const n=(i=t.errorAction)==null?void 0:i.nextAutoLevel;V(n)&&n!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.sourceBufferCount)return;const n=e.config,s=i.currentTime,r=t.levelTargetDuration,o=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(V(o)&&o>=0){const u=Math.max(o,r),h=Math.floor(s/r)*r-u;this.flushBackBuffer(s,r,h)}const c=n.frontBufferFlushThreshold;if(V(c)&&c>0){const u=Math.max(n.maxBufferLength,c),h=Math.max(u,r),f=Math.floor(s/r)*r+h;this.flushFrontBuffer(s,r,f)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const o=Mt.getBuffered(s);if(o.length>0&&i>o.start(0)){var r;this.hls.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:i});const c=this.tracks[n];if((r=this.details)!=null&&r.live)this.hls.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(c!=null&&c.ended){this.log(`Cannot flush ${n} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:n})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const r=Mt.getBuffered(s),o=r.length;if(o<2)return;const c=r.start(o-1),u=r.end(o-1);if(i>c||e>=c&&e<=u)return;this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:n})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||(i==null?void 0:i.readyState)!=="open")return null;const n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),h=Math.max(u,n);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 V(s)?{duration:s}:null;const r=this.media.duration,o=V(i.duration)?i.duration:0;return n>o&&n>r||!V(r)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(V(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),n.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${n.duration}. Setting seekable range to ${t}-${i}.`),n.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${De(i)}`),this.tracksReady){var n;const s=(n=this.transferData)==null?void 0:n.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const n=this.tracks[t];e[t]={buffer:i,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}}),this.hls.trigger(p.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(p.ERROR,{type:te.MEDIA_ERROR,details:M.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const 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":""} ${De(o)}`);try{const h=i.addSourceBuffer(u),f=ya(r),d=[r,h];t[f]=d,o.buffer=h}catch(h){var n;this.error(`error while trying to add sourceBuffer: ${h.message}`),this.shiftAndExecuteNext(r),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[r],this.hls.trigger(p.ERROR,{type:te.MEDIA_ERROR,details:M.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 i=e.supplemental;let n=e.codec;i&&(t==="video"||t==="audiovideo")&&ae(i,"video")&&(n=tt(n,i));const s=gt(n,e.levelCodec);return s?t.slice(0,5)==="audio"?Ge(s,this.appendSource):s:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,r)=>{const o=r.removedRanges;o!=null&&o.length&&this.hls.trigger(p.BUFFER_FLUSHED,{type:s})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i==null?void 0:i.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${n}`,t),this.hls.trigger(p.ERROR,{type:te.MEDIA_ERROR,details:M.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const s=this.currentOp(e);s&&s.onError(n)}updateTimestampOffset(e,t,i,n,s,r){const o=t-e.timestampOffset;Math.abs(o)>=i&&(this.log(`Updating ${n} SourceBuffer timestampOffset to ${t} (sn: ${s} cc: ${r})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:n,mediaSource:s}=this,r=this.tracks[e],o=r==null?void 0:r.buffer;if(!n||!s||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=V(n.duration)?n.duration:1/0,u=V(s.duration)?s.duration:1/0,h=Math.max(0,t),f=Math.min(i,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 i=this.tracks[t],n=i==null?void 0:i.buffer;if(!n)throw new Ru(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map(r=>this.appendBlocker(r));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(r=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const n=(i=this.tracks[t])==null?void 0:i.buffer;!n||n.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const n=this.tracks[e];if(!n)return;const s=n.buffer;if(!s)return;const r=i.bind(this,e);n.listeners.push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(n=>{i.removeEventListener(n.event,n.listener)}),t.listeners.length=0)}}function So(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function Lu(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function ya(a){return a==="audio"?1:0}class Ea{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(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&V(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((n,s)=>this.isLevelAllowed(n)&&s<=e);return this.clientRect=null,Ea.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const n=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0;let s=e.length-1;const r=Math.max(t,i);for(let o=0;o<e.length;o+=1){const c=e[o];if((c.width>=r||c.height>=r)&&n(c,e[o+1])){s=o;break}}return s}}const jn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Cu={HLS:"h"};class fs{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof fs?i:new fs(i))),this.value=e,this.params=t}}const ku="Dict";function Pu(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 Ou(a,e,t,i){return new Error(`failed to ${a} "${Pu(e)}" as ${t}`,{cause:i})}function ds(a,e,t){return Ou("serialize",a,e,t)}class Ao{constructor(e){this.description=e}}const wo="Bare Item",Fu="Boolean";function Mu(a){if(typeof a!="boolean")throw ds(a,Fu);return a?"?1":"?0"}function Nu(a){return btoa(String.fromCharCode(...a))}const Bu="Byte Sequence";function Uu(a){if(ArrayBuffer.isView(a)===!1)throw ds(a,Bu);return`:${Nu(a)}:`}const $u="Integer";function Ku(a){return a<-999999999999999||999999999999999<a}function Do(a){if(Ku(a))throw ds(a,$u);return a.toString()}function Gu(a){return`@${Do(a.getTime()/1e3)}`}function Ro(a,e){if(a<0)return-Ro(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const n=Math.floor(a*t);return(n%2===0?n:n+1)/t}else return Math.round(a*t)/t}const Vu="Decimal";function Wu(a){const e=Ro(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ds(a,Vu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const zu="String",ju=/[\x00-\x1f\x7f]+/;function Hu(a){if(ju.test(a))throw ds(a,zu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Zu(a){return a.description||a.toString().slice(7,-1)}const Yu="Token";function Io(a){const e=Zu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ds(e,Yu);return e}function ba(a){switch(typeof a){case"number":if(!V(a))throw ds(a,wo);return Number.isInteger(a)?Do(a):Wu(a);case"string":return Hu(a);case"symbol":return Io(a);case"boolean":return Mu(a);case"object":if(a instanceof Date)return Gu(a);if(a instanceof Uint8Array)return Uu(a);if(a instanceof Ao)return Io(a);default:throw ds(a,wo)}}const Qu="Key";function xa(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw ds(a,Qu);return a}function Ta(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${xa(e)}`:`;${xa(e)}=${ba(t)}`).join("")}function Lo(a){return a instanceof fs?`${ba(a.value)}${Ta(a.params)}`:ba(a)}function Xu(a){return`(${a.value.map(Lo).join(" ")})${Ta(a.params)}`}function qu(a,e={whitespace:!0}){if(typeof a!="object"||a==null)throw ds(a,ku);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof fs||(s=new fs(s));let r=xa(n);return s.value===!0?r+=Ta(s.params):(r+="=",Array.isArray(s.value)?r+=Xu(s):r+=Lo(s)),r}).join(`,${i}`)}function Co(a,e){return qu(a,e)}const ps="CMCD-Object",mn="CMCD-Request",Cs="CMCD-Session",As="CMCD-Status",Ju={br:ps,ab:ps,d:ps,ot:ps,tb:ps,tpb:ps,lb:ps,tab:ps,lab:ps,url:ps,pb:mn,bl:mn,tbl:mn,dl:mn,ltc:mn,mtp:mn,nor:mn,nrr:mn,rc:mn,sn:mn,sta:mn,su:mn,ttfb:mn,ttfbb:mn,ttlb:mn,cmsdd:mn,cmsds:mn,smrt:mn,df:mn,cs:mn,ts:mn,cid:Cs,pr:Cs,sf:Cs,sid:Cs,st:Cs,v:Cs,msd:Cs,bs:As,bsd:As,cdn:As,rtp:As,bg:As,pt:As,ec:As,e:As},ec={REQUEST:mn};function tc(a){return Object.keys(a).reduce((e,t)=>{var i;return(i=a[t])===null||i===void 0||i.forEach(n=>e[n]=t),e},{})}function ic(a,e){const t={};if(!a)return t;const i=Object.keys(a),n=e?tc(e):{};return i.reduce((s,r)=>{var o;const c=Ju[r]||n[r]||ec.REQUEST,u=(o=s[c])!==null&&o!==void 0?o:s[c]={};return u[r]=a[r],s},t)}function nc(a){return["ot","sf","st","e","sta"].includes(a)}function sc(a){return typeof a=="number"?V(a):a!=null&&a!==""&&a!==!1}const ko="event";function rc(a,e){const t=new URL(a),i=new URL(e);if(t.origin!==i.origin)return a;const n=t.pathname.split("/").slice(1),s=i.pathname.split("/").slice(1,-1);for(;n[0]===s[0];)n.shift(),s.shift();for(;s.length;)s.shift(),n.unshift("..");return n.join("/")+t.search+t.hash}const Pr=a=>Math.round(a),Sa=(a,e)=>Array.isArray(a)?a.map(t=>Sa(t,e)):a instanceof fs&&typeof a.value=="string"?new fs(Sa(a.value,e),a.params):(e.baseUrl&&(a=rc(a,e.baseUrl)),e.version===1?encodeURIComponent(a):a),Or=a=>Pr(a/100)*100,ac={br:Pr,d:Pr,bl:Or,dl:Or,mtp:Or,nor:(a,e)=>{let t=a;return e.version>=2&&(a instanceof fs&&typeof a.value=="string"?t=new fs([a]):typeof a=="string"&&(t=[a])),Sa(t,e)},rtp:Or,tb:Pr},Po="request",Oo="response",Aa=["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"],oc=["e"],lc=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Fr(a){return lc.test(a)}function uc(a){return Aa.includes(a)||oc.includes(a)||Fr(a)}const Fo=["d","dl","nor","ot","rtp","su"];function cc(a){return Aa.includes(a)||Fo.includes(a)||Fr(a)}const hc=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function fc(a){return Aa.includes(a)||Fo.includes(a)||hc.includes(a)||Fr(a)}const dc=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function pc(a){return dc.includes(a)||Fr(a)}const gc={[Oo]:fc,[ko]:uc,[Po]:cc};function Mo(a,e={}){const t={};if(a==null||typeof a!="object")return t;const i=e.version||a.v||1,n=e.reportingMode||Po,s=i===1?pc:gc[n];let r=Object.keys(a).filter(s);const o=e.filter;typeof o=="function"&&(r=r.filter(o));const c=n===Oo||n===ko;c&&!r.includes("ts")&&r.push("ts"),i>1&&!r.includes("v")&&r.push("v");const u=m({},ac,e.formatters),h={version:i,reportingMode:n,baseUrl:e.baseUrl};return r.sort().forEach(f=>{let d=a[f];const y=u[f];if(typeof y=="function"&&(d=y(d,h)),f==="v"){if(i===1)return;d=i}f=="pr"&&d===1||(c&&f==="ts"&&!V(d)&&(d=Date.now()),sc(d)&&(nc(f)&&typeof d=="string"&&(d=new Ao(d)),t[f]=d))}),t}function mc(a,e={}){const t={};if(!a)return t;const i=Mo(a,e),n=ic(i,e==null?void 0:e.customHeaderMap);return Object.entries(n).reduce((s,[r,o])=>{const c=Co(o,{whitespace:!1});return c&&(s[r]=c),s},t)}function _c(a,e,t){return m(a,mc(e,t))}const vc="CMCD";function yc(a,e={}){return a?Co(Mo(a,e),{whitespace:!1}):""}function Ec(a,e={}){if(!a)return"";const t=yc(a,e);return encodeURIComponent(t)}function bc(a,e={}){if(!a)return"";const t=Ec(a,e);return`${vc}=${t}`}const No=/CMCD=[^&#]+/;function xc(a,e,t){const i=bc(e,t);if(!i)return a;if(No.test(a))return a.replace(No,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class Tc{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=n=>{try{this.apply(n,{ot:jn.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=n=>{try{const{frag:s,part:r}=n,o=this.hls.levels[s.level],c=this.getObjectType(s),u={d:(r||s).duration*1e3,ot:c};(c===jn.VIDEO||c===jn.AUDIO||c==jn.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(n,u)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)==null?void 0:n.buffer}createData(){var e;return{v:1,sf:Cu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){m(t,this.createData());const i=t.ot===jn.INIT||t.ot===jn.VIDEO||t.ot===jn.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((r,o)=>(n.includes(o)&&(r[o]=t[o]),r),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),_c(e.headers,t,s)):e.url=xc(e.url,t,s)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const n=e.sn-i.startSN;return i.fragments[n+1]}}getNextPart(e){var t;const{index:i,fragment:n}=e,s=(t=this.hls.levels[n.level])==null||(t=t.details)==null?void 0:t.partList;if(s){const{sn:r}=n;for(let o=s.length-1;o>=0;o--){const c=s[o];if(c.index===i&&c.fragment.sn===r)return s[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return jn.TIMED_TEXT;if(e.sn==="initSegment")return jn.INIT;if(t==="audio")return jn.AUDIO;if(t==="main")return this.hls.audioTracks.length?jn.VIDEO:jn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===jn.AUDIO)i=n.audioTracks;else{const s=n.maxAutoLevel,r=s>-1?s+1:n.levels.length;i=n.levels.slice(0,r)}return i.forEach(s=>{s.bitrate>t&&(t=s.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===jn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Mt.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}}const Sc=3e5;class Ac extends C{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===xi.SendAlternateToPenaltyBox&&i.flags===yi.MoveAllAlternatesMatchingHost){const n=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:u}=t.context;o&&n?r=this.getPathwayForGroupId(o,u,r):c&&(r=c)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&n&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),t.details===M.BUFFER_APPEND_ERROR&&!t.fatal?i.resolved=!0:i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${n&&n.length} priorities: ${De(s)} penalized: ${De(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach(s=>{n-i[s]>Sc&&delete i[s]});for(let s=0;s<e.length;s++){const r=e[s];if(r in i)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,Mn(t),this.hls.trigger(p.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,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let s=0;s<n.length;s++)if(t===ce.AUDIO_TRACK&&n[s].hasAudioGroup(e)||t===ce.SUBTITLE_TRACK&&n[s].hasSubtitleGroup(e))return n[s].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},n={};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 Ii(h.attrs);f["PATHWAY-ID"]=r;const d=f.AUDIO&&`${f.AUDIO}_clone_${r}`,y=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;d&&(i[f.AUDIO]=d,f.AUDIO=d),y&&(n[f.SUBTITLES]=y,f.SUBTITLES=y);const E=Uo(h.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),A=new nn({attrs:f,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:E,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let S=1;S<h.audioGroups.length;S++)A.addGroupId("audio",`${h.audioGroups[S]}_clone_${r}`);if(h.subtitleGroups)for(let S=1;S<h.subtitleGroups.length;S++)A.addGroupId("text",`${h.subtitleGroups[S]}_clone_${r}`);return A});t.push(...u),Bo(this.audioTracks,i,c,r),Bo(this.subtitleTracks,n,c,r)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let n;try{n=new self.URL(e)}catch(h){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+h)}const s={responseType:"json",url:n.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,y)=>{this.log(`Loaded steering manifest: "${n}"`);const E=h.data;if((E==null?void 0:E.VERSION)!==1){this.log(`Steering VERSION ${E.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=E.TTL;const{"RELOAD-URI":A,"PATHWAY-CLONES":S,"PATHWAY-PRIORITY":U}=E;if(A)try{this.uri=new self.URL(A,n).href}catch(Y){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${A}`);return}this.scheduleRefresh(this.uri||d.url),S&&this.clonePathways(S);const j={steeringManifest:E,url:n.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,j),U&&this.updatePathwayPriority(U)},onError:(h,f,d,y)=>{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 E=this.timeToLoad*1e3;if(h.code===429){const A=this.loader;if(typeof(A==null?void 0:A.getResponseHeader)=="function"){const S=A.getResponseHeader("Retry-After");S&&(E=parseFloat(S)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,E)},onTimeout:(h,f,d)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(s,c,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const n=(i=this.hls)==null?void 0:i.media;if(n&&!n.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Bo(a,e,t,i){a&&Object.keys(e).forEach(n=>{const s=a.filter(r=>r.groupId===n).map(r=>{const o=m({},r);return o.details=void 0,o.attrs=new Ii(o.attrs),o.url=o.attrs.URI=Uo(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[n],o.attrs["PATHWAY-ID"]=i,o});a.push(...s)})}function Uo(a,e,t,i){const{HOST:n,PARAMS:s,[t]:r}=i;let o;e&&(o=r==null?void 0:r[e],o&&(a=o));const c=new self.URL(a);return n&&!o&&(c.host=n),s&&Object.keys(s).sort().forEach(u=>{u&&c.searchParams.set(u,s[u])}),c.href}class Vs extends C{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:i,initData:n}=t,s=`"${t.type}" event: init data type: "${i}"`;if(this.debug(s),n!==null){if(!this.keyFormatPromise){let r=Object.keys(this.keySystemAccessPromises);r.length||(r=cs(this.config));const o=r.map(On).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=Jn(r);if(i!=="sinf"||o!==ui.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}let c;try{const y=Ft(new Uint8Array(n)),E=ms(JSON.parse(y).sinf),A=lt(E);if(!A)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(A.subarray(8,24))}catch(y){this.warn(`${s} Failed to parse sinf: ${y}`);return}const u=$(c),{keyIdToKeySessionPromise:h,mediaKeySessions:f}=this;let d=h[u];for(let y=0;y<f.length;y++){const E=f[y],A=E.decryptdata;if(!A.keyId)continue;const S=$(A.keyId);if(Rn(c,A.keyId)||A.uri.replace(/-/g,"").indexOf(u)!==-1){if(d=h[S],!d)continue;if(A.pssh)break;delete h[S],A.pssh=new Uint8Array(n),A.keyId=c,d=h[u]=d.then(()=>this.generateRequestWithPreferredKeySession(E,i,n,"encrypted-event-key-match")),d.catch(U=>this.handleError(U));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(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(p.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(p.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t==null?void 0:t[e];if(n)return n.licenseUrl;if(e===ui.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t==null?void 0:t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(r,o,c)=>!!r&&c.indexOf(r)===o,n=t.map(r=>r.audioCodec).filter(i),s=t.map(r=>r.videoCodec).filter(i);return n.length+s.length===0&&s.push("avc1.42e01e"),new Promise((r,o)=>{const c=u=>{const h=u.shift();this.getMediaKeysPromise(h,n,s).then(f=>r({keySystem:h,mediaKeys:f})).catch(f=>{u.length?c(u):f instanceof Xn?o(f):o(new Xn({type:te.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return _s===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return i(e,t)}getMediaKeysPromise(e,t,i){var n;const s=fr(e,t,i,this.config.drmSystemOptions||{});let r=this.keySystemAccessPromises[e],o=(n=r)==null?void 0:n.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${De(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(y=>y?this.setMediaKeysServerCertificate(d,e,y):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:i}){this.log(`Creating key-system session "${t}" keyId: ${$(e.keyId||[])} keyUri: ${e.uri}`);const n=i.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=Mr(t),s="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,s,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${$(e.decryptdata.keyId||[])}
|
|
} (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>On(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:i})=>this.attemptSetMediaKeys(t,i))}selectKeySystem(e){return new Promise((t,i)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:n})=>{const s=On(n);s?t(s):i(new Error(`Unable to find format for key-system "${n}"`))}).catch(i)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=cs(this.config),i=e.map(Jn).filter(n=>!!n&&t.indexOf(n)!==-1);return this.selectKeySystem(i)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let i=0;i<t.length;i++){const n=wc(e,t[i]);if(n)return n}}loadKey(e){const t=e.keyInfo.decryptdata,i=Mr(t),n=this.bannedKeyIds[i];if(n||this.getKeyStatus(t)==="internal-error"){const o=$o(n||"internal-error",t);return this.handleError(o,e.frag),Promise.reject(o)}const s=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);const r=this.keyIdToKeySessionPromise[i];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[i]=o,o}return r.catch(o=>{if(o instanceof Xn){const c=b({},o.data);this.getKeyStatus(t)==="internal-error"&&(c.decryptdata=t);const u=new Xn(c,o.message);this.handleError(u,e.frag)}}),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof Xn){t&&(e.data.frag=t);const i=e.data.decryptdata;this.error(`${e.message}${i?` (${$(i.keyId||[])})`:""}`),this.hls.trigger(p.ERROR,e.data)}else this.error(e.message),this.hls.trigger(p.ERROR,{type:te.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=Mr(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=Jn(e.keyFormat),s=n?[n]:cs(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=cs(this.config)),e.length===0)throw new Xn({type:te.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${De({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.mediaKeys=t,this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>i.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,i,n){var s;const r=(s=this.config.drmSystems)==null||(s=s[e.keySystem])==null?void 0:s.generateRequest;if(r)try{const E=r.call(this.hls,t,i,e);if(!E)throw new Error("Invalid response from configured generateRequest filter");t=E.initDataType,i=E.initData?E.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(E){if(this.warn(E.message),this.hls&&this.hls.config.debug)throw E}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const o=Mr(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${n}" keyId: ${o} URI: ${c} (init data type: ${t} length: ${i.byteLength})`);const u=new sa,h=e._onmessage=E=>{const A=e.mediaKeysSession;if(!A){u.emit("error",new Error("invalid state"));return}const{messageType:S,message:U}=E;this.log(`"${S}" message event for session "${A.sessionId}" message size: ${U.byteLength}`),S==="license-request"||S==="license-renewal"?this.renewLicense(e,U).catch(j=>{u.eventNames().length?u.emit("error",j):this.handleError(j)}):S==="license-release"?e.keySystem===ui.FAIRPLAY&&this.updateKeySession(e,rs("acknowledged")).then(()=>this.removeSession(e)).catch(j=>this.handleError(j)):this.warn(`unhandled media key message type "${S}"`)},f=(E,A)=>{A.keyStatus=E;let S;E.startsWith("usable")?u.emit("resolved"):E==="internal-error"||E==="output-restricted"||E==="output-downscaled"?S=$o(E,A.decryptdata):E==="expired"?S=new Error(`key expired (keyId: ${o})`):E==="released"?S=new Error("key released"):E==="status-pending"||this.warn(`unhandled key status change "${E}" (keyId: ${o})`),S&&(u.eventNames().length?u.emit("error",S):this.handleError(S))},d=e._onkeystatuseschange=E=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}const S=this.getKeyStatuses(e);if(!Object.keys(S).some(ue=>S[ue]!=="status-pending"))return;if(S[o]==="expired"){this.log(`Expired key ${De(S)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let j=S[o];if(j)f(j,e);else{var Y;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(Y=e.keyStatusTimeouts)[o]||(Y[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const ge=this.getKeyStatus(e.decryptdata);if(ge&&ge!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${ge} from other session.`),f(ge,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),j="internal-error",f(j,e)},1e3)),this.log(`No status for keyId ${o} (${De(S)}).`)}};Gn(e.mediaKeysSession,"message",h),Gn(e.mediaKeysSession,"keystatuseschange",d);const y=new Promise((E,A)=>{u.on("error",A),u.on("resolved",E)});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${c}`)}).catch(E=>{throw new Xn({type:te.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_NO_SESSION,error:E,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${E}`)}).then(()=>y).catch(E=>(u.removeAllListeners(),this.removeSession(e).then(()=>{throw E}))).then(()=>(u.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((i,n)=>{if(typeof n=="string"&&typeof i=="object"){const o=n;n=i,i=o}const s="buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n);e.keySystem===ui.PLAYREADY&&s.length===16&&It(s);const r=$(s);i==="internal-error"&&(this.bannedKeyIds[r]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${r} key-session "${e.mediaKeysSession.sessionId}"`),t[r]=i}),t}fetchServerCertificate(e){const t=this.config,i=t.loader,n=new i(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,y,E,A)=>{r(d.data)},onError:(d,y,E,A)=>{o(new Xn({type:te.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:b({url:c.url,data:void 0},d)},`"${e}" certificate request failed (${s}). Status: ${d.code} (${d.text})`))},onTimeout:(d,y,E)=>{o(new Xn({type:te.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(d,y,E)=>{o(new Error("aborted"))}};n.load(c,h,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((n,s)=>{e.setServerCertificate(i).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),n(e)}).catch(r=>{s(new Xn({type:te.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(n=>{throw new Xn({type:te.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:n,fatal:!1},n.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=new DOMParser().parseFromString(i,"application/xml"),s=n.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 y=(r=h.querySelector("name"))==null?void 0:r.textContent,E=(o=h.querySelector("value"))==null?void 0:o.textContent;y&&E&&e.setRequestHeader(y,E)}}const c=n.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return rs(atob(u))}setupLicenseXHR(e,t,i,n){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,i,n)}).catch(r=>{if(!i.decryptdata)throw r;return e.open("POST",t,!0),s.call(this.hls,e,t,i,n)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((n,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)}n(c)}else{const c=i.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)s(new Xn({type:te.KEY_SYSTEM_ERROR,details:M.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(n,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==ui.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 i=t.media;this.media=i,Gn(i,"encrypted",this.onMediaEncrypted),Gn(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(zn(e,"encrypted",this.onMediaEncrypted),zn(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,es.clearKeyUriToKeyIdMap();const n=i.length;Vs.CDMCleanupPromise=Promise.all(i.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(p.ERROR,{type:te.OTHER_ERROR,details:M.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))||Promise.resolve())).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`),this.hls&&this.hls.trigger(p.ERROR,{type:te.OTHER_ERROR,details:M.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null,this.bannedKeyIds={}}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((n,s)=>(n.indexOf(s.keyFormat)===-1&&n.push(s.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:n}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${$((n==null?void 0:n.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);const{keyStatusTimeouts:r}=e;r&&Object.keys(r).forEach(u=>self.clearTimeout(r[u]));const{drmSystemOptions:o}=this.config;return(Zr(o)?new Promise((u,h)=>{self.setTimeout(()=>h(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(u).catch(h)}):Promise.resolve()).catch(u=>{this.log(`Could not remove session: ${u}`),this.hls&&this.hls.trigger(p.ERROR,{type:te.OTHER_ERROR,details:M.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${u}`)})}).then(()=>t.close()).catch(u=>{this.log(`Could not close session: ${u}`),this.hls&&this.hls.trigger(p.ERROR,{type:te.OTHER_ERROR,details:M.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${u}`)})})}return Promise.resolve()}}Vs.CDMCleanupPromise=void 0;function Mr(a){if(!a)throw new Error("Could not read keyId of undefined decryptdata");if(a.keyId===null)throw new Error("keyId is null");return $(a.keyId)}function wc(a,e){if(a.keyId&&e.mediaKeysSession.keyStatuses.has(a.keyId))return e.mediaKeysSession.keyStatuses.get(a.keyId);if(a.matches(e.decryptdata))return e.keyStatus}class Xn 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 $o(a,e){const t=a==="output-restricted",i=t?M.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:M.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Xn({type:te.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${a}"`)}class Dc{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(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const s=n-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*r/s,u=this.hls;if(u.trigger(p.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),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(p.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function Ko(a,e){let t;try{t=new Event("addtrack")}catch(i){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function Go(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(i){H.debug(`[texttrack-utils]: ${i}`);try{const n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,a.addCue(n)}catch(n){H.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(a.mode=t)}function Ws(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let i=a.cues.length;i--;)e&&a.cues[i].removeEventListener("enter",e),a.removeCue(a.cues[i]);t==="disabled"&&(a.mode=t)}function wa(a,e,t,i){const n=a.mode;if(n==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=Ic(a.cues,e,t);for(let r=0;r<s.length;r++)(!i||i(s[r]))&&a.removeCue(s[r])}n==="disabled"&&(a.mode=n)}function Rc(a,e){if(e<=a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let i=0,n=t,s;for(;i<=n;)if(s=Math.floor((n+i)/2),e<a[s].startTime)n=s-1;else if(e>a[s].startTime&&i<t)i=s+1;else return s;return a[i].startTime-e<e-a[n].startTime?i:n}function Ic(a,e,t){const i=[],n=Rc(a,e);if(n>-1)for(let s=n,r=a.length;s<r;s++){const o=a[s];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function Nr(a){const e=[];for(let t=0;t<a.length;t++){const i=a[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(a[t])}return e}class Lc extends _a{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=Nr(this.media.textTracks);for(let s=0;s<i.length;s++)if(i[s].mode==="hidden")t=i[s];else if(i[s].mode==="showing"){t=i[s];break}const n=this.findTrackForTextTrack(t);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},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(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;Nr(i.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:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Subtitle track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(r=>(n==null?void 0:n.indexOf(r))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(h=>!i||i.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=Et(o,r);if(h>-1)s=r[h];else{const f=Et(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 "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(p.SUBTITLE_TRACKS_UPDATED,u),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n<t.length;n++){const s=t[n];if(!(i&&!s.default||!i&&!e)&&(!e||ti(s,e)))return n}if(e){for(let n=0;n<t.length;n++){const s=t[n];if(lr(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(lr(e.attrs,s.attrs,["LANGUAGE"]))return n}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(va(n,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ce.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&ti(e,i))return i;const n=Et(e,this.tracksInGroup);if(n>-1){const s=this.tracksInGroup[n];return this.setSubtitleTrack(n),s}else{if(i)return null;{const s=Et(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${(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(p.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Nr(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(s=>va(i,s))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==n&&(s.mode="disabled")}),n){const s=this.subtitleDisplay?"showing":"hidden";n.mode!==s&&(n.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!V(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n){this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!n.details&&!n.details.live;if(e===this.trackId&&n===i&&s)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:r,groupId:o="",name:c,type:u,url:h}=n;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:c,type:u,url:h});const f=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(f)}}function Cc(){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,n=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?s:s&3|8).toString(16)})}}}function ur(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const zs=.025;let Br=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function kc(a,e,t){return`${a.identifier}-${t+1}-${ur(e)}`}class Pc{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Da(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=Da(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=V(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 Da(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)<zs))}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"?Br.Range:Br.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 Oc(this)}}function Da(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<zs)?e.start:e.start+e.duration}function Vo(a,e,t){const i=new self.URL(a,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function Ra(a,e){for(;(t=a.assetList[++e])!=null&&t.error;)var t;return e}function Oc(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function js(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Fc{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(p.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=i,this.assetItem=n;const r=()=>{this.hasDetails=!0};s.once(p.LEVEL_LOADED,r),s.once(p.AUDIO_TRACK_LOADED,r),s.once(p.SUBTITLE_TRACK_LOADED,r),s.on(p.MEDIA_ATTACHING,(o,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(p.BUFFER_APPENDED,()=>{const h=this.bufferedEnd;this.reachedPlayout(h)&&(this._bufferedEosTime=h,s.trigger(p.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=Vo(t,e.config.primarySessionId||"").href}catch(i){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),n=this.timelineOffset,s=Mt.bufferInfo(e,n,0);return this.getAssetTime(s.end)>=i-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=Mt.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const i=t-this.startOffset;if(i>0&&i<e)return i}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var n;(n=this.hls)==null||n.on(e,t)}once(e,t,i){var n;(n=this.hls)==null||n.once(e,t)}off(e,t,i){var n;(n=this.hls)==null||n.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${js(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Wo=.033;class Mc extends C{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(s=n[i])!=null&&s.event;){var s;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let n=0;n<i.length;n++){let s=i[n];if(t&&t!=="primary"&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return n}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let n=e;n<=t&&i[n];n++){const s=i[n].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return n}return-1}findEventIndex(e){const t=this.items;if(t)for(let n=t.length;n--;){var i;if(((i=t[n].event)==null?void 0:i.identifier)===e)return n}return-1}findAssetIndex(e,t){const i=e.assetList,n=i.length;if(n>1)for(let s=0;s<n;s++){const r=i[s];if(!r.error){const o=r.timelineStart;if(t===o||t>o&&(t<o+(r.duration||0)||s===n-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 i=t.assetList,n=i[i.length-1];if(n)return n.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:n}=i,s=this.events,r=this.parseDateRanges(n,{url:i.url},t),o=Object.keys(n),c=s?s.filter(u=>!o.includes(u.identifier)):[];r.length&&r.sort((u,h)=>{const f=u.cue.pre,d=u.cue.post,y=h.cue.pre,E=h.cue.post;if(f&&!y)return-1;if(y&&!f||d&&!E)return 1;if(E&&!d)return-1;if(!f&&!y&&!d&&!E){const A=u.startTime,S=h.startTime;if(A!==S)return A-S}return u.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=r,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],i=!1){const n=this.events||[];if(n.length||t.length||this.length<2){const s=this.items,r=this.parseSchedule(n,e);(i||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,i){const n=[],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 Pc(c,t),this.eventMap[o]=u,i===!1&&(u.appendInPlace=i)),n.push(u)}}return n}parseSchedule(e,t){const i=[],n=t.main.details,s=n.live?1/0:n.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,y=h.cue.post,E=e[f-1]||null,A=h.appendInPlace,S=y?s:h.startOffset,U=h.duration,j=h.timelineOccupancy===Br.Range?U:0,Y=h.resumptionOffset,ue=(E==null?void 0:E.startTime)===S,ge=S+h.cumulativeDuration;let Fe=A?ge+U:S+Y;if(d||!y&&S<=0){const Ce=u;u+=j,h.timelineStart=ge;const Le=r;r+=U,i.push({event:h,start:ge,end:Fe,playout:{start:Le,end:r},integrated:{start:Ce,end:u}})}else if(S<=s){if(!ue){const xe=S-c;if(xe>Wo){const et=c,St=u;u+=xe;const Pt=r;r+=xe;const Wt={previousEvent:e[f-1]||null,nextEvent:h,start:et,end:et+xe,playout:{start:Pt,end:r},integrated:{start:St,end:u}};i.push(Wt)}else xe>0&&E&&(E.cumulativeDuration+=xe,i[i.length-1].end=S)}y&&(Fe=ge),h.timelineStart=ge;const Ce=u;u+=j;const Le=r;r+=U,i.push({event:h,start:ge,end:Fe,playout:{start:Le,end:r},integrated:{start:Ce,end:u}})}else return;const ve=h.resumeTime;y||ve>s?c=s:c=ve}),c<s){var o;const h=c,f=u,d=s-c;u+=d;const y=r;r+=d,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:h+d,playout:{start:y,end:r},integrated:{start:f,end:u}})}this.setDurations(s,r,u)}else i.push({previousEvent:null,nextEvent:null,start:0,end:s,playout:{start:0,end:s},integrated:{start:0,end:s}}),this.setDurations(s,s,s);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,n=i.live?1/0:i.edge;let s=0,r=-1;e.forEach((o,c)=>{const u=o.cue.pre,h=o.cue.post,f=u?0:h?n:o.startTime;this.updateAssetDurations(o),r===f?o.cumulativeDuration=s:(s=0,r=f),!h&&o.snapOptions.in&&(o.resumeAnchor=pi(null,i.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<Wo&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const y=V(o.resumeOffset)?o.resumeOffset:o.duration;s+=y})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>zs?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1):!Object.keys(t).some(r=>{const o=t[r].details,c=o.edge;if(i>=c)return this.log(`"${e.identifier}" resumption ${i} past ${r} playlist end ${c}`),!1;const u=pi(null,o.fragments,i);if(!u)return this.log(`"${e.identifier}" resumption ${i} 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-i)<zs+h||Math.abs(u.end-i)<zs+h?!1:(this.log(`"${e.identifier}" resumption ${i} 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 i=0,n=!1,s=!1;for(let r=0;r<e.assetList.length;r++){const o=e.assetList[r],c=t+i;o.startOffset=i,o.timelineStart=c,n||(n=o.duration===null),s||(s=!!o.error);const u=o.error?0:o.duration||0;i+=u}n&&!s?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function as(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class Nc{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=Vo(i,this.hls.sessionId,e.baseUrl)}catch(d){const y=this.assignAssetListError(e,M.ASSET_LIST_LOAD_ERROR,d,i);this.hls.trigger(p.ERROR,y);return}t&&n.protocol!=="data:"&&n.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,r=s.loader,o=new r(s),c={responseType:"json",url:n.href},u=s.interstitialAssetListLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,y,E,A)=>{const S=d.data,U=S==null?void 0:S.ASSETS;if(!Array.isArray(U)){const j=this.assignAssetListError(e,M.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),E.url,y,A);this.hls.trigger(p.ERROR,j);return}e.assetListResponse=S,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:S,networkDetails:A})},onError:(d,y,E,A)=>{const S=this.assignAssetListError(e,M.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${d.code} ${d.text} (${y.url})`),y.url,A,E);this.hls.trigger(p.ERROR,S)},onTimeout:(d,y,E)=>{const A=this.assignAssetListError(e,M.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${y.url})`),y.url,d,E);this.hls.trigger(p.ERROR,A)}};return o.load(c,h,f),this.hls.trigger(p.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,i,n,s,r){return e.error=i,{type:te.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:r,stats:s}}}function zo(a){a==null||a.play().catch(()=>{})}function Ur(a,e){return`[${a}] Advancing timeline position to ${e}`}class Bc extends C{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled||!this.schedule)return;const n=i-this.timelinePos;if(Math.abs(n)<1/7056e5)return;const r=n<=-.01;this.timelinePos=i,this.bufferedPos=i;const o=this.playingItem;if(!o){this.checkBuffer();return}if(r&&this.schedule.resetErrorsInRange(i,i-n)&&this.updateSchedule(!0),this.checkBuffer(),r&&i<o.start||i>=o.end){var c;const y=this.findItemIndex(o);let E=this.schedule.findItemIndexAtTime(i);if(E===-1&&(E=y+(r?-1:1),this.log(`seeked ${r?"back ":""}to position not covered by schedule ${i} (resolving from ${y} to ${E})`)),!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!r&&E>y){const A=this.schedule.findJumpRestrictedIndex(y+1,E);if(A>y){this.setSchedulePosition(A);return}}this.setSchedulePosition(E);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const y=o.event.assetList[0];y&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,y))}return}const h=u.timelineStart,f=u.duration||0;if(r&&i<h||i>=h+f){var d;(d=o.event)!=null&&d.appendInPlace&&(this.clearInterstitial(o.event,o),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,u)}},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const n=this.playingItem;if(!n||this.playingLastItem)return;if(i>=n.end){this.timelinePos=n.end;const o=this.findItemIndex(n);this.setSchedulePosition(o+1)}const s=this.playingAsset;if(!s)return;const r=s.timelineStart+(s.duration||0);i>=r&&this.setScheduleToAssetAtTime(i,s)},this.onScheduleUpdate=(i,n)=>{const s=this.schedule;if(!s)return;const r=this.playingItem,o=s.events||[],c=s.items||[],u=s.durations,h=i.map(A=>A.identifier),f=!!(o.length||h.length);(f||n)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
|
|
Schedule: ${c.map(A=>as(A))} pos: ${this.timelinePos}`),h.length&&this.log(`Removed events ${h}`);let d=null,y=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 E=this.bufferingItem;if(E&&(y=this.updateItem(E,this.bufferedPos),this.itemsMatch(E,y)?this.bufferingItem=y:E.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(E.event,null))),i.forEach(A=>{A.assetList.forEach(S=>{this.clearAssetPlayer(S.identifier,null)})}),this.playerQueue.forEach(A=>{if(A.interstitial.appendInPlace){const S=A.assetItem.timelineStart,U=A.timelineOffset-S;if(U)try{A.timelineOffset=S}catch(j){Math.abs(U)>zs&&this.warn(`${j} ("${A.assetId}" ${A.timelineOffset}->${S})`)}}}),f||n){if(this.hls.trigger(p.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),E&&y!==d&&this.trimInPlace(y,E),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Nc(e),this.schedule=new Mc(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(p.MEDIA_ENDED,this.onMediaEnded,this),e.on(p.ERROR,this.onError,this),e.on(p.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(p.MEDIA_ENDED,this.onMediaEnded,this),e.off(p.ERROR,this.onError,this),e.off(p.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){zn(e,"play",this.onPlay),zn(e,"pause",this.onPause),zn(e,"seeking",this.onSeeking),zn(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;Gn(i,"seeking",this.onSeeking),Gn(i,"timeupdate",this.onTimeupdate),Gn(i,"play",this.onPlay),Gn(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!n){this.clearScheduleState();const s=this.findItemIndex(i);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 i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),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,i=f=>f&&e.getAssetPlayer(f.identifier),n=(f,d,y,E,A)=>{if(f){let S=f[d].start;const U=f.event;if(U){if(d==="playout"||U.timelineOccupancy!==Br.Point){const j=i(y);(j==null?void 0:j.interstitial)===U&&(S+=j.assetItem.startOffset+j[A])}}else{const j=E==="bufferedPos"?r():e[E];S+=j-f.start}return S}return 0},s=(f,d)=>{var y;if(f!==0&&d!=="primary"&&(y=e.schedule)!=null&&y.length){var E;const A=e.schedule.findItemIndexAtTime(f),S=(E=e.schedule.items)==null?void 0:E[A];if(S){const U=S[d].start-S.start;return f+U}}return f},r=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var d,y;return(d=e.primaryDetails)!=null&&d.live?e.primaryDetails.edge:((y=e.schedule)==null?void 0:y.durations[f])||0},c=(f,d)=>{var y,E;const A=e.effectivePlayingItem;if(A!=null&&(y=A.event)!=null&&y.restrictions.skip||!e.schedule)return;e.log(`seek to ${f} "${d}"`);const S=e.effectivePlayingItem,U=e.schedule.findItemIndexAtTime(f,d),j=(E=e.schedule.items)==null?void 0:E[U],Y=e.getBufferingPlayer(),ue=Y==null?void 0:Y.interstitial,ge=ue==null?void 0:ue.appendInPlace,Fe=S&&e.itemsMatch(S,j);if(S&&(ge||Fe)){const ve=i(e.playingAsset),Ce=(ve==null?void 0:ve.media)||e.primaryMedia;if(Ce){const Le=d==="primary"?Ce.currentTime:n(S,d,e.playingAsset,"timelinePos","currentTime"),xe=f-Le,et=(ge?Le:Ce.currentTime)+xe;if(et>=0&&(!ve||ge||et<=ve.duration)){Ce.currentTime=et;return}}}if(j){let ve=f;if(d!=="primary"){const Le=j[d].start,xe=f-Le;ve=j.start+xe}const Ce=!e.isInterstitial(j);if((!e.isInterstitial(S)||S.event.appendInPlace)&&(Ce||j.event.appendInPlace)){const Le=e.media||(ge?Y==null?void 0:Y.media:null);Le&&(Le.currentTime=ve)}else if(S){const Le=e.findItemIndex(S);if(U>Le){const et=e.schedule.findJumpRestrictedIndex(Le+1,U);if(et>Le){e.setSchedulePosition(et);return}}let xe=0;if(Ce)e.timelinePos=ve,e.checkBuffer();else{const et=j.event.assetList,St=f-(j[d]||j).start;for(let Pt=et.length;Pt--;){const Wt=et[Pt];if(Wt.duration&&St>=Wt.startOffset&&St<Wt.startOffset+Wt.duration){xe=Pt;break}}}e.setSchedulePosition(U,xe)}}},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 y;return n(d,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-d.playout.start||((y=e.bufferingAsset)==null?void 0:y.startOffset)||0}return 0},get currentTime(){const f=u(),d=e.effectivePlayingItem;return d&&d===f?n(d,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-d.playout.start:0},set currentTime(f){const d=u(),y=e.effectivePlayingItem;y&&y===d&&c(f+y.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(y=>e.getAssetPlayer(y.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 n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(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 y=e.findItemIndex(f);if(d.appendInPlace){const E=f.playout.start+f.event.duration;c(E+.001,"playout")}else e.advanceAfterAssetEnded(d,y,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let n=this.media;!n&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(n=this.primaryMedia);const s=(t=n)==null?void 0:t.currentTime;if(!(s===void 0||!V(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 i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,n=e.media;if(i&&n===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&n){this.detachedData={media:n};return}const s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${De(s)}`),this.detachedData=s}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var i,n;if(e.media===t)return;let s=null;const r=this.hls,o=e!==r,c=o&&e.interstitial.appendInPlace,u=(i=this.detachedData)==null?void 0:i.mediaSource;let h;if(r.media)c&&(s=r.transferMedia(),this.detachedData=s),h="Primary";else if(u){const E=this.getBufferingPlayer();E?(s=E.transferMedia(),h=`${E}`):h="detached MediaSource"}else h="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${De(s)}`);else if(!this.detachedData||r.media===t){const E=this.playerQueue;E.length>1&&E.forEach(A=>{if(o&&A.interstitial.appendInPlace!==c){const S=A.interstitial;this.clearInterstitial(A.interstitial,null),S.appendInPlace=!1,S.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${S}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=s&&"mediaSource"in s&&((n=s.mediaSource)==null?void 0:n.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 y=this.schedule;if(d===s&&y){const E=o&&e.assetId===y.assetIdAtEnd;d.overrides={duration:y.duration,endOfStream:!o||E,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 i=this.timelinePos,n=this.effectivePlayingItem;if(i===-1){const s=this.hls.startPosition;if(this.log(Ur("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(n&&!this.playingItem){const s=e.findItemIndex(n);this.setSchedulePosition(s)}}advanceAssetBuffering(e,t){const i=e.event,n=i.findAssetIndex(t),s=Ra(i,n);if(!i.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,i){const n=Ra(e,i);if(e.isAssetPastPlayoutLimit(n)){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(Ur("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[n];s&&this.advanceInPlace(s.timelineStart)}this.setSchedulePosition(t,n)}}setScheduleToAssetAtTime(e,t){const i=this.schedule;if(!i)return;const n=t.parentIdentifier,s=i.getEvent(n);if(s){const r=i.findEventIndex(n),o=i.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,r,o-1)}}setSchedulePosition(e,t){var i;const n=(i=this.schedule)==null?void 0:i.items;if(!n||this.playbackDisabled)return;const s=e>=0?n[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${s&&as(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,y=d?this.getAssetPlayer(d):null;if(y&&d&&(!this.eventItemsMatch(r,s)||t!==void 0&&d!==h.assetList[t].identifier)){var c;const E=h.findAssetIndex(f);if(this.log(`INTERSTITIAL_ASSET_ENDED ${E+1}/${h.assetList.length} ${js(f)}`),this.endedAsset=f,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:f,assetListIndex:E,event:h,schedule:n.slice(0),scheduleIndex:e,player:y}),r!==this.playingItem){this.itemsMatch(r,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(h,this.findItemIndex(this.playingItem),E);return}this.retreiveMediaSource(d,s),y.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&y.detachMedia()}if(!this.eventItemsMatch(r,s)&&(this.endedItem=r,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${h} ${as(r)}`),h.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:h,schedule:n.slice(0),scheduleIndex:e}),h.cue.once)){var u;this.updateSchedule();const E=(u=this.schedule)==null?void 0:u.items;if(s&&E){const A=this.findItemIndex(s);this.advanceSchedule(A,E,t,r,o)}return}}this.advanceSchedule(e,n,t,r,o)}advanceSchedule(e,t,i,n,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(i===void 0){i=r.findAssetIndex(h,this.timelinePos);const E=Ra(h,i-1);if(h.isAssetPastPlayoutLimit(E)||h.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(h,e,i);return}i=E}const f=this.waitingItem;this.assetsBuffered(o,c)||this.setBufferingItem(o);let d=this.preloadAssets(h,i);if(this.eventItemsMatch(o,f||n)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${as(o)} ${h.appendInPlace?"append in place":""}`),this.hls.trigger(p.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 y=h.assetList[i];if(!y){this.advanceAfterAssetEnded(h,e,i||0);return}if(d||(d=this.getAssetPlayer(y.identifier)),d===null||d.destroyed){const E=h.assetList.length;this.warn(`asset ${i+1}/${E} player destroyed ${h}`),d=this.createAssetPlayer(h,y,i),d.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&h.appendInPlace&&this.isAssetBuffered(y))return;this.startAssetPlayer(d,i,t,e,c),this.shouldPlay&&zo(d.media)}else o?(this.resumePrimary(o,e,n),this.shouldPlay&&zo(this.hls.media)):s&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.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,i){var n,s;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${as(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(Ur("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!i)return;const r=(s=this.schedule)==null?void 0:s.items;r&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${as(e)}`),this.hls.trigger(p.INTERSTITIALS_PRIMARY_RESUMED,{schedule:r.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const n=this.primaryDetails;if(t===0)return this.hls.startPosition;if(n&&(i<n.fragmentStart||i>n.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:Mt.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(Ur("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs((((i=n.mainForwardBufferInfo)==null?void 0:i.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.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(p.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(p.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const i=this.hls.levels[t.level];if(!i.details)return;const n=b(b({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=b(b({},this.altSelection),{},{audio:i});return}const s=b(b({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=b(b({},this.altSelection),{},{subtitles:i});return}const s=b(b({},n),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=mt(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setAudioOption(t)||n.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=mt(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setSubtitleOption(t)||t.id!==-1&&n.setSubtitleOption(i)))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const n=this.timelinePos;this.bufferedPos=n,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let n=0;n<t.length;n++){const s=t[n];if(s.cue.post){var i;const r=this.schedule.findEventIndex(s.identifier),o=(i=this.schedule.items)==null?void 0:i[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 i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){var i;const n=(i=this.schedule)==null?void 0:i.items;if(e&&n){const s=this.findItemIndex(e,t);return n[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 i=e.end+.25,n=Mt.bufferInfo(this.primaryMedia,i,0);(n.end>i||(n.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${as(e)} (was ${as(t)})`),this.attachPrimary(i,null,!0),this.flushFrontBuffer(i))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&((t=this.schedule)==null||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=(t=this.schedule)==null?void 0:t.items;if(!i)return;const n=Mt.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=n.len<1),this.updateBufferedPos(n.end,i,e)}updateBufferedPos(e,t,i){const n=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e||!n)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const r=this.playingItem,o=this.findItemIndex(r);let c=n.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 y=s.event;if(f-o>1&&y.appendInPlace===!1||y.assetList.length===0&&y.assetListLoader)return}if(this.bufferedPos=e,c>h&&c>o)this.bufferedToItem(d);else{const y=this.primaryDetails;this.primaryLive&&y&&e>y.edge-y.targetduration&&d.start<y.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(d)&&this.preloadAssets(d.event,0)}}else i&&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(n=>{const s=this.getAssetPlayer(n.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:n,events:s}=i;if(!n||!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 ${as(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(r){const u=i.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(p.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const n=this.detachedData;n?n.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,n=i.assetList.length===0&&!i.assetListLoader,s=i.cue.once;if(n||!s){const r=this.preloadAssets(i,t);if(r!=null&&r.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(r,o)}}}preloadAssets(e,t){const i=e.assetUrl,n=e.assetList.length,s=n===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}/${i?1:n} ${e}${u?` live-start: ${h} start-offset: ${u}`:""}`),i)return this.createAsset(e,0,0,c,e.duration,i);const f=this.assetListLoader.loadAssetList(e,u);f&&(e.assetListLoader=f)}else if(!r&&n){for(let u=t;u<n;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(n=>{this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:n})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,n,s,r){const o={parentIdentifier:e.identifier,identifier:kc(e,r,t),duration:s,startOffset:i,timelineStart:n,uri:r};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,i){const n=this.hls,s=n.userConfig;let r=s.videoPreference;const o=n.loadLevelObj||n.levels[n.currentLevel];(r||o)&&(r=m({},r),o.videoCodec&&(r.videoCodec=o.videoCodec),o.videoRange&&(r.allowedVideoRanges=[o.videoRange]));const c=n.audioTracks[n.audioTrack],u=n.subtitleTracks[n.subtitleTrack];let h=0;if(this.primaryLive||e.appendInPlace){const ue=this.timelinePos-t.timelineStart;if(ue>1){const ge=t.duration;ge&&ue<ge&&(h=ue)}}const f=t.identifier,d=b(b({},s),{},{maxMaxBufferLength:Math.min(180,n.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:n.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 y=d.cmcd;y!=null&&y.sessionId&&y.contentId&&(d.cmcd=m({},y,{contentId:ur(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const E=new Fc(this.HlsPlayerClass,d,e,t);this.playerQueue.push(E),e.assetList[i]=t;let A=!0;const S=ue=>{if(ue.live){var ge;const Ce=new Error(`Interstitials MUST be VOD assets ${e}`),Le={fatal:!0,type:te.OTHER_ERROR,details:M.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ce},xe=((ge=this.schedule)==null?void 0:ge.findEventIndex(e.identifier))||-1;this.handleAssetItemError(Le,e,xe,i,Ce.message);return}const Fe=ue.edge-ue.fragmentStart,ve=t.duration;(A||ve===null||Fe>ve)&&(A=!1,this.log(`Interstitial asset "${f}" duration change ${ve} > ${Fe}`),t.duration=Fe,this.updateSchedule())};E.on(p.LEVEL_UPDATED,(ue,{details:ge})=>S(ge)),E.on(p.LEVEL_PTS_UPDATED,(ue,{details:ge})=>S(ge)),E.on(p.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const U=(ue,ge)=>{const Fe=this.getAssetPlayer(f);if(Fe&&ge.tracks){Fe.off(p.BUFFER_CODECS,U),Fe.tracks=ge.tracks;const ve=this.primaryMedia;this.bufferingAsset===Fe.assetItem&&ve&&!Fe.media&&this.bufferAssetPlayer(Fe,ve)}};E.on(p.BUFFER_CODECS,U);const j=()=>{var ue;const ge=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${ge}`),!ge||!this.schedule)return;const Fe=this.schedule.findEventIndex(e.identifier),ve=(ue=this.schedule.items)==null?void 0:ue[Fe];this.isInterstitial(ve)&&this.advanceAssetBuffering(ve,t)};E.on(p.BUFFERED_TO_END,j);const Y=ue=>()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;this.shouldPlay=!0;const Fe=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,Fe,ue)};return E.once(p.MEDIA_ENDED,Y(i)),E.once(p.PLAYOUT_LIMIT_REACHED,Y(1/0)),E.on(p.ERROR,(ue,ge)=>{if(!this.schedule)return;const Fe=this.getAssetPlayer(f);if(ge.details===M.BUFFER_STALLED_ERROR){if(Fe!=null&&Fe.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(ge,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${ge.error} ${e}`)}),E.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;const ge=new Error(`Asset player destroyed unexpectedly ${f}`),Fe={fatal:!0,type:te.OTHER_ERROR,details:M.INTERSTITIAL_ASSET_ITEM_ERROR,error:ge};this.handleAssetItemError(Fe,e,this.schedule.findEventIndex(e.identifier),i,ge.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${js(t)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:E}),E}clearInterstitial(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){const n=this.playerQueue[i];this.log(`clear ${n} toSegment: ${t&&as(t)}`),this.transferMediaFromPlayer(n,t),this.playerQueue.splice(i,1),n.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,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,i[n]),delete h.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${js(o)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:r,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var i,n;if(!this.schedule)return;const{interstitial:s,assetItem:r}=e,o=this.schedule.findEventIndex(s.identifier),c=(i=this.schedule.items)==null?void 0:i[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)||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(h&&r!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(f&&!Ee(f,e.tracks)){const d=new Error(`Asset ${js(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(f)}')`),y={fatal:!0,type:te.OTHER_ERROR,details:M.INTERSTITIAL_ASSET_ITEM_ERROR,error:d},E=s.findAssetIndex(r);this.handleAssetItemError(y,s,o,E,d.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const n=i.currentTime,s=t.findAssetIndex(e,n),r=e.assetList[s];if(r){const o=this.getAssetPlayer(r.identifier);if(o){const c=o.currentTime||n-r.timelineStart,u=o.duration-c;if(this.warn(`Stalled at ${c} of ${c+u} in ${o} ${e} (media.currentTime: ${n})`),c&&(u/i.playbackRate<.5||o.bufferedInPlaceToEnd(i))&&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,i,n,s){if(e.details===M.BUFFER_STALLED_ERROR)return;const r=t.assetList[n]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${r&&js(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=m({},e,{fatal:!1,errorAction:Si(!0),asset:r,assetListIndex:n,event:t,schedule:h,scheduleIndex:i,player:u});if(this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const d=this.playingAsset,y=this.bufferingAsset,E=new Error(s);if(r&&(this.clearAssetPlayer(o,null),r.error=E),!t.assetList.some(A=>!A.error))t.error=E;else for(let A=n;A<t.assetList.length;A++)this.resetAssetPlayer(t.assetList[A].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):d&&d.identifier===o?this.advanceAfterAssetEnded(t,i,n):y&&y.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,y)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${as(i)} error: ${e.error}`);let n=this.timelinePos;n===-1&&(n=this.hls.startPosition);const s=this.updateItem(i,n);if(this.itemsMatch(i,s)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t)),!this.schedule)return;const r=this.schedule.findItemIndexAtTime(n);this.setSchedulePosition(r)}else this.checkStart()}onAssetListLoaded(e,t){var i,n;const s=t.event,r=s.identifier,o=t.assetListResponse.ASSETS;if(!((i=this.schedule)!=null&&i.hasEvent(r)))return;const c=s.timelineStart,u=s.duration;let h=0;o.forEach((A,S)=>{const U=parseFloat(A.DURATION);this.createAsset(s,S,h,c+h,U,A.URI),h+=U}),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 y=(n=this.bufferingItem)==null?void 0:n.event;if(d){var E;const A=this.schedule.findEventIndex(r),S=(E=this.schedule.items)==null?void 0:E[A];if(S){if(!this.playingItem&&this.timelinePos>S.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==A){s.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${s}`),this.updateSchedule(!0),this.primaryFallback(s);return}this.setBufferingItem(S)}this.setSchedulePosition(A)}else if((y==null?void 0:y.identifier)===r){const A=s.assetList[0];if(A){const S=this.getAssetPlayer(A.identifier);if(y.appendInPlace){const U=this.primaryMedia;S&&U&&this.bufferAssetPlayer(S,U)}else S&&S.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case M.ASSET_LIST_PARSING_ERROR:case M.ASSET_LIST_LOAD_ERROR:case M.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&(this.updateSchedule(!0),this.primaryFallback(i));break}case M.BUFFER_STALLED_ERROR:{const i=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&i.event.appendInPlace){this.handleInPlaceStall(i.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const jo=500;class Uc extends ia{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",J.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(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=Ye.IDLE,this.setInterval(jo),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:n}=t;if(this.fragContextChanged(i)||(Ae(i)&&(this.fragPrevious=i),this.state=Ye.IDLE),!n)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let r;const o=i.start;for(let u=0;u<s.length;u++)if(o>=s[u].start&&o<=s[u].end){r=s[u];break}const c=i.start+i.duration;r?r.end=c:(r={start:o,end:c},s.push(r)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(i===0&&n!==Number.POSITIVE_INFINITY){const s=n-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(i,s,J.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===J.SUBTITLE&&(t.details===M.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ye.STOPPED&&(this.state=Ye.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&bo(this.levels,t)){this.levels=t.map(i=>new nn(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new nn(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,J.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const n=this.levels[this.currentTrackId];n!=null&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==Ye.STOPPED&&this.setInterval(jo)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,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||(i=c.details)!=null&&i.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?(Ar(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===n&&(this.hls.trigger(p.SUBTITLE_TRACK_UPDATED,{details:r,id:o,groupId:t.groupId}),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===Ye.IDLE&&(pi(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:i}=e,n=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&n!=null&&n.key&&n.iv&&Kn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,us(n.method)).catch(o=>{throw s.trigger(p.ERROR,{type:te.MEDIA_ERROR,details:M.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();s.trigger(p.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:r,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=Ye.IDLE})}}doTick(){if(!this.media){this.state=Ye.IDLE;return}if(this.state===Ye.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:n}=this,s=this.getLoadPosition(),r=Mt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,n.maxBufferHole),{end:o,len:c}=r,u=i.details,h=this.hls.maxBufferLength+u.levelTargetDuration;if(c>h)return;const f=u.fragments,d=f.length,y=u.edge;let E=null;const A=this.fragPrevious;if(o<y){const j=n.maxFragLookUpTolerance,Y=o>y-j?0:j;E=pi(A,f,Math.max(f[0].start,o),Y),!E&&A&&A.start<f[0].start&&(E=f[0])}else E=f[d-1];if(E=this.filterReplacedPrimary(E,i.details),!E)return;const S=E.sn-u.startSN,U=f[S-1];if(U&&U.cc===E.cc&&this.fragmentTracker.getState(U)===oi.NOT_LOADED&&(E=U),this.fragmentTracker.getState(E)===oi.NOT_LOADED){const j=this.mapToInitFragWhenRequired(E);j&&this.loadFragment(j,i,o)}}}loadFragment(e,t,i){Ae(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new $c(this.tracksBuffered[this.currentTrackId]||[])}}class $c{constructor(e){this.buffered=void 0;const t=(i,n,s)=>{if(n=n>>>0,n>s-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${s})`);return e[n][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const Kc={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Ho=a=>String.fromCharCode(Kc[a]||a),os=15,Es=100,Gc={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Vc={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Wc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},zc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},jc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Hc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;H.log(`${this.time} [${e}] ${i}`)}}}const ks=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Zo{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}}isDefault(){return 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 Zc{constructor(){this.uchar=" ",this.penState=new Zo}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 Yc{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Zo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Es;t++)this.chars.push(new Zc);this.logger=e}equals(e){for(let t=0;t<Es;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Es;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Es;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>Es&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Es)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Ho(e);if(this.pos>=Es){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<Es;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<Es;i++){const n=this.chars[i].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Ia{constructor(e){this.rows=[],this.currRow=os-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<os;t++)this.rows.push(new Yc(e));this.logger=e}reset(){for(let e=0;e<os;e++)this.rows[e].clear();this.currRow=os-1}equals(e){let t=!0;for(let i=0;i<os;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<os;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<os;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 = "+De(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<os;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 i=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,r=Math.max(s-1,0);i.setCursor(e.indent),e.color=i.chars[r].penState.foreground}const n={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+De(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",n=-1;for(let s=0;s<os;s++){const r=this.rows[s].getTextString();r&&(n=s+1,e?t.push("Row "+n+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
|
|
`)),i}getTextAndFormat(){return this.rows}}class Yo{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Ia(i),this.nonDisplayedMemory=new Ia(i),this.lastOutputScreen=new Ia(i),this.currRollUpRow=this.displayedMemory.rows[os-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[os-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+De(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 Qo{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Xc(),this.logger=void 0;const n=this.logger=new Hc;this.channels=[null,new Yo(e,t,n),new Yo(e+1,i,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const n=t[i]&127,s=t[i+1]&127;let r=!1,o=null;if(n===0&&s===0)continue;this.logger.log(3,()=>"["+ks([t[i],t[i+1]])+"] -> ("+ks([n,s])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(Qc(n,s,c)){$r(null,null,c),this.logger.log(3,()=>"Repeated command ("+ks([n,s])+") is dropped");continue}$r(n,s,this.cmdHistory),r=this.parseCmd(n,s),r||(r=this.parseMidrow(n,s)),r||(r=this.parsePAC(n,s)),r||(r=this.parseBackgroundAttributes(n,s))}else $r(null,null,c);if(!r&&(o=this.parseChars(n,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 "+ks([n,s])+" orig: "+ks([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(i||n))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 i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return n?(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+ks([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(n||s))return!1;const r=e<=23?1:2;t>=64&&t<=95?i=r===1?Gc[e]:Wc[e]:i=r===1?Vc[e]:zc[e];const o=this.channels[r];return o?(o.setPAC(this.interpretPAC(i,t)),this.currentChannel=r,!0):!1}interpretPAC(e,t){let i;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,n.underline=(i&1)===1,i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=Math.floor((i-16)/2)*4,n}parseChars(e,t){let i,n=null,s=null;if(e>=25?(i=2,s=e-8):(i=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 '"+Ho(r)+"' in channel "+i),n=[r]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+ks(n).join(",")),n}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(i||n))return!1;let s;const r={};e===16||e===24?(s=Math.floor((t-32)/2),r.background=jc[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()}$r(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function $r(a,e,t){t.a=a,t.b=e}function Qc(a,e,t){return t.a===a&&t.b===e}function Xc(){return{a:null,b:null}}var La=function(){if(Oi!=null&&Oi.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 i(o){return t(a,o)}function n(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="",y=!1,E=o,A=c,S=u,U=null,j="",Y=!0,ue="auto",ge="start",Fe=50,ve="middle",Ce=50,Le="middle";Object.defineProperty(h,"id",s({},f,{get:function(){return d},set:function(xe){d=""+xe}})),Object.defineProperty(h,"pauseOnExit",s({},f,{get:function(){return y},set:function(xe){y=!!xe}})),Object.defineProperty(h,"startTime",s({},f,{get:function(){return E},set:function(xe){if(typeof xe!="number")throw new TypeError("Start time must be set to a number.");E=xe,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",s({},f,{get:function(){return A},set:function(xe){if(typeof xe!="number")throw new TypeError("End time must be set to a number.");A=xe,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",s({},f,{get:function(){return S},set:function(xe){S=""+xe,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",s({},f,{get:function(){return U},set:function(xe){U=xe,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",s({},f,{get:function(){return j},set:function(xe){const et=i(xe);if(et===!1)throw new SyntaxError("An invalid or illegal string was specified.");j=et,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",s({},f,{get:function(){return Y},set:function(xe){Y=!!xe,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",s({},f,{get:function(){return ue},set:function(xe){if(typeof xe!="number"&&xe!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");ue=xe,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",s({},f,{get:function(){return ge},set:function(xe){const et=n(xe);if(!et)throw new SyntaxError("An invalid or illegal string was specified.");ge=et,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",s({},f,{get:function(){return Fe},set:function(xe){if(xe<0||xe>100)throw new Error("Position must be between 0 and 100.");Fe=xe,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",s({},f,{get:function(){return ve},set:function(xe){const et=n(xe);if(!et)throw new SyntaxError("An invalid or illegal string was specified.");ve=et,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",s({},f,{get:function(){return Ce},set:function(xe){if(xe<0||xe>100)throw new Error("Size must be between 0 and 100.");Ce=xe,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",s({},f,{get:function(){return Le},set:function(xe){const et=n(xe);if(!et)throw new SyntaxError("An invalid or illegal string was specified.");Le=et,this.hasBeenReset=!0}})),h.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class qc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Xo(a){function e(i,n,s,r){return(i|0)*3600+(n|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 Jc{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function qo(a,e,t,i){const n=i?a.split(i):[a];for(const s in n){if(typeof n[s]!="string")continue;const r=n[s].split(t);if(r.length!==2)continue;const o=r[0],c=r[1];e(o,c)}}const Ca=new La(0,0,""),Kr=Ca.align==="middle"?"middle":"center";function eh(a,e,t){const i=a;function n(){const o=Xo(a);if(o===null)throw new Error("Malformed timestamp: "+i);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,c){const u=new Jc;qo(o,function(d,y){let E;switch(d){case"region":for(let A=t.length-1;A>=0;A--)if(t[A].id===y){u.set(d,t[A].region);break}break;case"vertical":u.alt(d,y,["rl","lr"]);break;case"line":E=y.split(","),u.integer(d,E[0]),u.percent(d,E[0])&&u.set("snapToLines",!1),u.alt(d,E[0],["auto"]),E.length===2&&u.alt("lineAlign",E[1],["start",Kr,"end"]);break;case"position":E=y.split(","),u.percent(d,E[0]),E.length===2&&u.alt("positionAlign",E[1],["start",Kr,"end","line-left","line-right","auto"]);break;case"size":u.percent(d,y);break;case"align":u.alt(d,y,["start",Kr,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let h=u.get("line","auto");h==="auto"&&Ca.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",Kr);let f=u.get("position","auto");f==="auto"&&Ca.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=n(),r(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);a=a.slice(3),r(),e.endTime=n(),r(),s(a,e)}function Jo(a){return a.replace(/<br(?: \/)?>/gi,`
|
|
`)}class th{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new qc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let s=t.buffer,r=0;for(s=Jo(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 n(s){qo(s,function(r,o){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=i();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=i(),t.state){case"HEADER":/:/.test(s)?n(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 La(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{eh(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 ih=/\r\n|\n\r|\n|\r/g,ka=function(e,t,i=0){return e.slice(i,i+t.length)===t},nh=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!V(t)||!V(i)||!V(n)||!V(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*s,t};function Pa(a,e,t){return ur(a.toString())+ur(e.toString())+ur(t)}const sh=function(e,t,i){let n=e[t],s=e[n.prevCC];if(!s||!s.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(r=s)!=null&&r.new;){var r;e.ccOffset+=n.start-s.start,n.new=!1,n=s,s=e[n.prevCC]}e.presentationOffset=i};function rh(a,e,t,i,n,s,r){const o=new th,c=We(new Uint8Array(a)).trim().replace(ih,`
|
|
`).split(`
|
|
`),u=[],h=e?pu(e.baseTime,e.timescale):0;let f="00:00.000",d=0,y=0,E,A=!0;o.oncue=function(S){const U=t[i];let j=t.ccOffset;const Y=(d-h)/9e4;if(U!=null&&U.new&&(y!==void 0?j=t.ccOffset=U.start:sh(t,i,Y)),Y){if(!e){E=new Error("Missing initPTS for VTT MPEGTS");return}j=Y-t.presentationOffset}const ue=S.endTime-S.startTime,ge=Qn((S.startTime+j-y)*9e4,n*9e4)/9e4;S.startTime=Math.max(ge,0),S.endTime=Math.max(ge+ue,0);const Fe=S.text.trim();S.text=decodeURIComponent(encodeURIComponent(Fe)),S.id||(S.id=Pa(S.startTime,S.endTime,Fe)),S.endTime>0&&u.push(S)},o.onparsingerror=function(S){E=S},o.onflush=function(){if(E){r(E);return}s(u)},c.forEach(S=>{if(A)if(ka(S,"X-TIMESTAMP-MAP=")){A=!1,S.slice(16).split(",").forEach(U=>{ka(U,"LOCAL:")?f=U.slice(6):ka(U,"MPEGTS:")&&(d=parseInt(U.slice(7)))});try{y=nh(f)/1e3}catch(U){E=U}return}else S===""&&(A=!1);o.parse(S+`
|
|
`)}),o.flush()}const Oa="stpp.ttml.im1t",el=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,tl=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,ah={left:"start",center:"center",right:"end",start:"start",end:"end"};function il(a,e,t,i){const n=ie(new Uint8Array(a),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const s=n.map(o=>We(o)),r=du(e.baseTime,1,e.timescale);try{s.forEach(o=>t(oh(o,r)))}catch(o){i(o)}}function oh(a,e){const n=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(s).reduce((f,d)=>(f[d]=n.getAttribute(`ttp:${d}`)||s[d],f),{}),o=n.getAttribute("xml:space")!=="preserve",c=nl(Fa(n,"styling","style")),u=nl(Fa(n,"layout","region")),h=Fa(n,"body","[begin]");return[].map.call(h,f=>{const d=sl(f,o);if(!d||!f.hasAttribute("begin"))return null;const y=Na(f.getAttribute("begin"),r),E=Na(f.getAttribute("dur"),r);let A=Na(f.getAttribute("end"),r);if(y===null)throw rl(f);if(A===null){if(E===null)throw rl(f);A=y+E}const S=new La(y-e,A-e,d);S.id=Pa(S.startTime,S.endTime,S.text);const U=u[f.getAttribute("region")],j=c[f.getAttribute("style")],Y=lh(U,j,c),{textAlign:ue}=Y;if(ue){const ge=ah[ue];ge&&(S.lineAlign=ge),S.align=ue}return m(S,Y),S}).filter(f=>f!==null)}function Fa(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function nl(a){return a.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function sl(a,e){return[].slice.call(a.childNodes).reduce((t,i,n)=>{var s;return i.nodeName==="br"&&n?t+`
|
|
`:(s=i.childNodes)!=null&&s.length?sl(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function lh(a,e,t){const i="http://www.w3.org/ns/ttml#styling";let n=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return r&&t.hasOwnProperty(r)&&(n=t[r]),s.reduce((o,c)=>{const u=Ma(e,i,c)||Ma(a,i,c)||Ma(n,i,c);return u&&(o[c]=u),o},{})}function Ma(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function rl(a){return new Error(`Could not parse ttml timestamp ${a}`)}function Na(a,e){if(!a)return null;let t=Xo(a);return t===null&&(el.test(a)?t=uh(a,e):tl.test(a)&&(t=ch(a,e))),t}function uh(a,e){const t=el.exec(a),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function ch(a,e){const t=tl.exec(a),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class Gr{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class hh{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=ll(),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(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Gr(this,"textTrack1"),t=new Gr(this,"textTrack2"),i=new Gr(this,"textTrack3"),n=new Gr(this,"textTrack4");this.cea608Parser1=new Qo(1,e,t),this.cea608Parser2=new Qo(3,i,n)}addCues(e,t,i,n,s){let r=!1;for(let o=s.length;o--;){const c=s[o],u=fh(c[0],c[1],t,i);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),r=!0,u/(i-t)>.5))return}if(r||s.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,n)}else{const o=this.Cues.newCue(null,t,i,n);this.hls.trigger(p.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s,trackId:r}){const{unparsedVttFrags:o}=this;i===J.MAIN&&(this.initPTS[t.cc]={baseTime:n,timescale:s,trackId:r}),o.length&&(this.unparsedVttFrags=[],o.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded(p.FRAG_LOADED,c):this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n<i.textTracks.length;n++){const s=i.textTracks[n];if(ol(s,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:n}=this,{label:s,languageCode:r}=t[e],o=this.getExistingTrack(s,r);if(o)i[e]=o,Ws(i[e]),Ko(i[e],n);else{const c=this.createTextTrack("captions",s,r);c&&(c[e]=!0,i[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,n={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,i){const n=this.media;if(n)return n.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:n}=this;Object.keys(n).forEach(s=>{Ws(n[s]),delete n[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=ll(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)Ws(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(s=>s.textCodec===Oa);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(bo(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const r=this.media,o=r?Nr(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]&&ol(o[d],c)){f=o[d],o[d]=null;break}f&&(h=f)}if(h)Ws(h);else{const f=al(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(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const n=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!n)return;const s=`textTrack${n[1]}`,r=this.captionsProperties[s];r&&(r.label=i.name,i.lang&&(r.languageCode=i.lang),r.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===J.MAIN){var i,n;const{cea608Parser1:s,cea608Parser2:r,lastSn:o}=this,{cc:c,sn:u}=t.frag,h=(i=(n=t.part)==null?void 0:n.index)!=null?i:-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:i,payload:n}=t;if(i.type===J.SUBTITLE)if(n.byteLength){const s=i.decryptdata,r="stats"in t;if(s==null||!s.encrypted||r){const o=this.tracks[i.level],c=this.vttCCs;c[i.cc]||(c[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===Oa?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;il(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{i.logger.log(`Failed to parse IMSC1: ${n}`),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:s,unparsedVttFrags:r}=this,o=s.length-1;if(!s[i.cc]&&o===-1){r.push(e);return}const c=this.hls,u=(t=i.initSegment)!=null&&t.data?ct(i.initSegment.data,new Uint8Array(n)).buffer:n;rh(u,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,h=>{this._appendCues(h,i.level),c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},h=>{const f=h.message==="Missing initPTS for VTT MPEGTS";f?r.push(e):this._fallbackToIMSC1(i,n),c.logger.log(`Failed to parse VTT cue: ${h}`),!(f&&o>i.cc)&&c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:h})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||il(t,this.initPTS[e.cc],()=>{i.textCodec=Oa,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(s=>Go(n,s))}else{const n=this.tracks[t];if(!n)return;const s=n.default?"default":"subtitles"+t;i.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===J.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:n}=t;if(!(i.type===J.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let s=0;s<n.length;s++){const r=n[s].bytes;if(r){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(r);this.cea608Parser1.addData(n[s].pts,o[0]),this.cea608Parser2.addData(n[s].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:n,type:s}){const{media:r}=this;if(!(!r||r.currentTime<i)){if(!s||s==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(c=>wa(o[c],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>wa(o[c],t,n))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let n=2;for(let s=0;s<i;s++){const r=e[n++],o=127&e[n++],c=127&e[n++];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 al(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function ol(a,e){return!!a&&a.kind===al(e)&&va(e,a)}function fh(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function ll(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const dh=/\s/,ph={newCue(a,e,t,i){const n=[];let s,r,o,c,u;const h=self.VTTCue||self.TextTrackCue;for(let d=0;d<i.rows.length;d++)if(s=i.rows[d],o=!0,c=0,u="",!s.isEmpty()){var f;for(let A=0;A<s.chars.length;A++)dh.test(s.chars[A].uchar)&&o?c++:(u+=s.chars[A].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const y=Jo(u.trim()),E=Pa(e,t,y);a!=null&&(f=a.cues)!=null&&f.getCueById(E)||(r=new h(e,t,y),r.id=E,r.line=d+1,r.align="left",r.position=10+Math.min(80,Math.floor(c*8/32)*10),n.push(r))}return a&&n.length&&(n.sort((d,y)=>d.line==="auto"||y.line==="auto"?0:d.line>8&&y.line>8?y.line-d.line:d.line-y.line),n.forEach(d=>Go(a,d))),n}};function gh(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const mh=/(\d+)-(\d+)\/(\d+)/;class ul{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||Eh,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,i){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const s=_h(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=i,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=c&&V(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(or(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var d;this.response=this.loader=f;const y=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},u-(y-n.loading.start)),!f.ok){const{status:A,statusText:S}=f;throw new bh(S||"fetch, bad network response",A,f)}n.loading.first=y,n.total=yh(f.headers)||n.total;const E=(d=this.callbacks)==null?void 0:d.onProgress;return E&&V(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,E):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var d,y;const E=this.response;if(!E)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const A=f[o];A&&(n.loaded=n.total=A);const S={url:E.url,data:f,code:E.status},U=(d=this.callbacks)==null?void 0:d.onProgress;U&&!V(t.highWaterMark)&&U(n,e,f,E),(y=this.callbacks)==null||y.onSuccess(S,n,e,E)}).catch(f=>{var d;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const y=f&&f.code||0,E=f?f.message:null;(d=this.callbacks)==null||d.onError({code:y,text:E},e,f?f.details:null,n)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,n=0,s){const r=new ja,o=e.body.getReader(),c=()=>o.read().then(u=>{if(u.done)return r.dataLength&&s(t,i,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const h=u.value,f=h.length;return t.loaded+=f,f<n||r.dataLength?(r.push(h),r.dataLength>=n&&s(t,i,r.flush().buffer,e)):s(t,i,h.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function _h(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(m({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function vh(a){const e=mh.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function yh(a){const e=a.get("Content-Range");if(e){const i=vh(e);if(V(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function Eh(a,e){return new self.Request(a.url,e)}class bh extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const xh=/^age:\s*[\d.]+\s*$/im;class cl{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,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return s(i,t.url)}).catch(r=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),s(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(r=>{var o;(o=this.callbacks)==null||o.onError({code:i.status,text:r.message},t,i,n)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const n=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:r}=i.loadPolicy;if(n)for(const o in n)e.setRequestHeader(o,n[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),i.timeout=s&&V(s)?s:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const n=t.readyState,s=this.config;if(!i.aborted&&n>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),n===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 E=h!=null?h:t.response;if(E!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=t.responseType==="arraybuffer"?E.byteLength:E.length;i.loaded=i.total=A,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const S=(r=this.callbacks)==null?void 0:r.onProgress;S&&S(i,e,E,t);const U={url:t.responseURL,data:E,code:u};(o=this.callbacks)==null||o.onSuccess(U,i,e,t);return}}const f=s.loadPolicy.errorRetry,d=i.retry,y={url:e.url,data:void 0,code:u};if(Ji(f,d,!1,y))this.retry(f);else{var c;H.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Ji(e,t,!0))this.retry(e);else{var i;H.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=$i(e,i.retry),i.retry++,H.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&xh.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 Th={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Sh=b(b({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:cl,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:di,bufferController:Iu,capLevelController:Ea,errorController:En,fpsController:Dc,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:_s,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:Th},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},Ah()),{},{subtitleStreamController:Uc,subtitleTrackController:Lc,timelineController:hh,audioStreamController:Au,audioTrackController:wu,emeController:Vs,cmcdController:Tc,contentSteeringController:Ac,interstitialsController:Bc});function Ah(){return{cueHandler:ph,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 wh(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 i=Ba(a),n=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.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 y=i[o].default;switch(e[o]={default:y},h){case"TimeOut":y.maxLoadTimeMs=d,y.maxTimeToFirstByteMs=d;break;case"MaxRetry":y.errorRetry.maxNumRetry=d,y.timeoutRetry.maxNumRetry=d;break;case"RetryDelay":y.errorRetry.retryDelayMs=d,y.timeoutRetry.retryDelayMs=d;break;case"MaxRetryTimeout":y.errorRetry.maxRetryDelayMs=d,y.timeoutRetry.maxRetryDelayMs=d;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${De(e[o])}`)}),b(b({},i),e)}function Ba(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(Ba):Object.keys(a).reduce((e,t)=>(e[t]=Ba(a[t]),e),{}):a}function Dh(a,e){const t=a.loader;t!==ul&&t!==cl?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):gh()&&(a.loader=ul,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Vr=2,Rh=.1,Ih=.05,Lh=100;class Ch extends _i{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.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(Lh),this.mediaSource=t.mediaSource;const i=this.media=t.media;Gn(i,"playing",this.onMediaPlaying),Gn(i,"waiting",this.onMediaWaiting),Gn(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(zn(i,"playing",this.onMediaPlaying),zn(i,"waiting",this.onMediaWaiting),zn(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const s=(i=this.hls)==null?void 0:i.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(p.MEDIA_ENDED,{stalled:!1}));return}if(!Mt.getBuffered(r).length){this.nudgeRetry=0;return}const f=Mt.bufferInfo(r,e,0),d=f.nextStart||0,y=this.fragmentTracker;if(o&&y&&this.hls){const Fe=hl(this.hls.inFlightFragments,e),ve=f.len>Vr,Ce=!d||Fe||d-e>Vr&&!y.getPartialFragment(e);if(ve||Ce)return;this.moved=!1}const E=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&y){if(!(f.len>0)&&!d)return;const ve=Math.max(d,f.start||0)-e,Le=!!(E!=null&&E.live)?E.targetduration*2:Vr,xe=Wr(e,y);if(ve>0&&(ve<=Le||xe)){r.paused||this._trySkipBufferHole(xe);return}}const A=s.detectStallWithCurrentTimeMs,S=self.performance.now(),U=this.waiting;let j=this.stalled;if(j===null)if(U>0&&S-U<A)j=this.stalled=U;else{this.stalled=S;return}const Y=S-j;if(!o&&(Y>=A||U)&&this.hls){var ue;if(((ue=this.mediaSource)==null?void 0:ue.readyState)==="ended"&&!(E!=null&&E.live)&&Math.abs(e-((E==null?void 0:E.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(f),!this.media||!this.hls)return}const ge=Mt.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(ge,Y,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(p.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&n&&n.length>1&&e>n.end(0)){const s=Mt.bufferedInfo(Mt.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=Mt.timeRangesToArray(n),o=Mt.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=Mt.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=Wr(e,this.fragmentTracker);d&&"fragment"in d?d=d.fragment:d||(d=void 0);const y=Mt.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:te.MEDIA_ERROR,details:M.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:d,buffer:y.len,bufferInfo:y})}}}}}_tryFixBufferStall(e,t,i){var n,s;const{fragmentTracker:r,media:o}=this,c=(n=this.hls)==null?void 0:n.config;if(!o||!r||!c)return;const u=(s=this.hls)==null?void 0:s.latestLevelDetails,h=Wr(i,r);if((h||u!=null&&u.live&&i<u.fragmentStart)&&(this._trySkipBufferHole(h)||!this.media))return;const f=e.buffered,d=this.adjacentTraversal(e,i);(f&&f.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-i<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 i=this.fragmentTracker,n=e.nextStart;if(i&&n){const s=i.getFragAtPos(t,J.MAIN),r=i.getFragAtPos(n,J.MAIN);if(s&&r)return r.sn-s.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:s}=this;if(!n&&s!==null&&i&&t){this.stallReported=!0;const r=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${De(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:te.MEDIA_ERROR,details:M.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:n}=this,s=(t=this.hls)==null?void 0:t.config;if(!n||!i||!s)return 0;const r=n.currentTime,o=Mt.bufferInfo(n,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&&n.readyState<3,d=c-r;if(d>0&&(h||f)){if(d>s.maxBufferHole){let E=!1;if(r===0){const A=i.getAppendedFrag(0,J.MAIN);A&&c<A.end&&(E=!0)}if(!E&&e){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||hl(this.hls.inFlightFragments,c))return 0;let S=!1,U=e.end;for(;U<c;){const j=Wr(U,i);if(j)U+=j.duration;else{S=!0;break}}if(S)return 0}}const y=Math.max(c+Ih,r+Rh);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${y}`),this.moved=!0,n.currentTime=y,!(e!=null&&e.gap)){const E=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${y}`),A={type:te.MEDIA_ERROR,details:M.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:E,reason:E.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?A.part=e:A.frag=e),this.hls.trigger(p.ERROR,A)}return y}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:n}=this,s=t==null?void 0:t.config;if(!i||!s)return 0;const r=i.currentTime;if(this.nudgeRetry++,n<s.nudgeMaxRetry){const o=r+(n+1)*s.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${r} to ${o}`);this.warn(c.message),i.currentTime=o,t.trigger(p.ERROR,{type:te.MEDIA_ERROR,details:M.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(p.ERROR,{type:te.MEDIA_ERROR,details:M.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function hl(a,e){const t=fl(a.main);if(t&&t.start<=e)return t;const i=fl(a.audio);return i&&i.start<=e?i:null}function fl(a){if(!a)return null;switch(a.state){case Ye.IDLE:case Ye.STOPPED:case Ye.ENDED:case Ye.ERROR:return null}return a.frag}function Wr(a,e){return e.getAppendedFrag(a,J.MAIN)||e.getPartialFragment(a)}const kh=.25;function Ua(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function $a(a,e,t,i,n){let s=new a(e,t,"");try{s.value=i,n&&(s.type=n)}catch(r){s=new a(e,t,De(n?b({type:n},i):i))}return s}const zr=(()=>{const a=Ua();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Ph{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(p.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(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&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 i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Ko(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:n}=this.hls.config;if(!i&&!n)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=Ua();if(r)for(let o=0;o<s.length;o++){const c=s[o].type;if(c===Yn.emsg&&!i||!n)continue;const u=eo(s[o].data),h=s[o].pts;let f=h+s[o].duration;f>zr&&(f=zr),f-h<=0&&(f=h+kh);for(let y=0;y<u.length;y++){const E=u[y];if(!to(E)){this.updateId3CueEnds(h,c);const A=$a(r,h,f,E,c);A&&this.id3Track.addCue(A)}}}}updateId3CueEnds(e,t){var i;const n=(i=this.id3Track)==null?void 0:i.cues;if(n)for(let s=n.length;s--;){const r=n[s];r.type===t&&r.startTime<e&&r.endTime===zr&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:n}){const{id3Track:s,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=r;if(s&&(o||c)){let u;n==="audio"?u=h=>h.type===Yn.audioId3&&c:n==="video"?u=h=>h.type===Yn.emsg&&o:u=h=>h.type===Yn.audioId3&&c||h.type===Yn.emsg&&o,wa(s,t,i,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:i,timelineOffset:n,enableDateRangeMetadataCues:s,interstitialsController:r}=this.hls.config;if(!s)return;const o=Ua();if(i&&n&&!r){const{fragmentStart:A,fragmentEnd:S}=e;let U=this.assetCue;U?(U.startTime=A,U.endTime=S):o&&(U=this.assetCue=$a(o,A,S,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),U&&(U.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(U),U.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 A=Object.keys(f).filter(S=>!h.includes(S));for(let S=A.length;S--;){var y;const U=A[S],j=(y=f[U])==null?void 0:y.cues;delete f[U],j&&Object.keys(j).forEach(Y=>{const ue=j[Y];if(ue){ue.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(ue)}catch(ge){}}})}}else f=this.dateRangeCuesAppended={}}const E=e.fragments[e.fragments.length-1];if(!(h.length===0||!V(E==null?void 0:E.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let A=0;A<h.length;A++){const S=h[A],U=u[S],j=U.startTime,Y=f[S],ue=(Y==null?void 0:Y.cues)||{};let ge=(Y==null?void 0:Y.durationKnown)||!1,Fe=zr;const{duration:ve,endDate:Ce}=U;if(Ce&&ve!==null)Fe=j+ve,ge=!0;else if(U.endOnNext&&!ge){const xe=h.reduce((et,St)=>{if(St!==U.id){const Pt=u[St];if(Pt.class===U.class&&Pt.startDate>U.startDate&&(!et||U.startDate<et.startDate))return Pt}return et},null);xe&&(Fe=xe.startTime,ge=!0)}const Le=Object.keys(U.attr);for(let xe=0;xe<Le.length;xe++){const et=Le[xe];if(!$n(et))continue;const St=ue[et];if(St)ge&&!(Y!=null&&Y.durationKnown)?St.endTime=Fe:Math.abs(St.startTime-j)>.01&&(St.startTime=j,St.endTime=Fe);else if(o){let Pt=U.attr[et];ss(et)&&(Pt=D(Pt));const Ot=$a(o,j,Fe,{key:et,data:Pt},Yn.dateRange);Ot&&(Ot.id=S,this.id3Track.addCue(Ot),ue[et]=Ot,r&&(et==="X-ASSET-LIST"||et==="X-ASSET-URL")&&Ot.addEventListener("enter",this.onEventCueEnter))}}f[S]={cues:ue,dateRange:U,durationKnown:ge}}}}}class Oh{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||r===1||!i.live)return;const o=this.targetLatency;if(o===null)return;const c=n-o,u=Math.min(this.maxLatency,o+i.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,y=Math.min(f,Math.max(1,d));this.changeMediaPlaybackRate(t,y)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:s,liveSyncDurationCount:r,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let u=o&&i||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=s!==void 0?s:r*n);const h=n;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 i=this.levelDetails;if(i===null)return null;const n=i.edge,s=e-t-this.edgeStalled,r=n-i.totalduration,o=n-(this.config.lowLatencyMode&&i.partTarget||i.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 i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===M.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,n;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(n=this.targetLatency)==null?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class Fh extends _a{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,n=[],s={},r={};let o=!1,c=!1,u=!1;t.levels.forEach(h=>{const f=h.attrs;let{audioCodec:d,videoCodec:y}=h;d&&(h.audioCodec=d=Ge(d,i)||void 0),y&&(y=h.videoCodec=$t(y));const{width:E,height:A,unknownCodecs:S}=h,U=(S==null?void 0:S.length)||0;if(o||(o=!!(E&&A)),c||(c=!!y),u||(u=!!d),U||d&&!this.isAudioSupported(d)||y&&!this.isVideoSupported(y)){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}const{CODECS:j,"FRAME-RATE":Y,"HDCP-LEVEL":ue,"PATHWAY-ID":ge,RESOLUTION:Fe,"VIDEO-RANGE":ve}=f,Le=`${`${ge||"."}-`}${h.bitrate}-${Fe}-${Y}-${j}-${ve}-${ue}`;if(s[Le])if(s[Le].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const xe=r[Le]+=1;h.attrs["PATHWAY-ID"]=new Array(xe+1).join(".");const et=this.createLevel(h);s[Le]=et,n.push(et)}else s[Le].addGroupId("audio",f.AUDIO),s[Le].addGroupId("text",f.SUBTITLES);else{const xe=this.createLevel(h);s[Le]=xe,r[Le]=1,n.push(xe)}}),this.filterAndSortMediaOptions(n,t,o,c,u)}createLevel(e){const t=new nn(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const n=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(n.message),t.supportedResult=Vt(n,[])}return t}isAudioSupported(e){return ae(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return ae(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,s){var r;let o=[],c=[],u=e;const h=((r=t.stats)==null?void 0:r.parsing)||{};if((i||n)&&s&&(u=u.filter(({videoCodec:j,videoRange:Y,width:ue,height:ge})=>(!!j||!!(ue&&ge))&&Vi(Y))),u.length===0){Promise.resolve().then(()=>{if(this.hls){let j="no level with compatible codecs found in manifest",Y=j;t.levels.length&&(Y=`one or more CODECS in variant not supported: ${De(t.levels.map(ge=>ge.attrs.CODECS).filter((ge,Fe,ve)=>ve.indexOf(ge)===Fe))}`,this.warn(Y),j+=` (${Y})`);const ue=new Error(j);this.hls.trigger(p.ERROR,{type:te.MEDIA_ERROR,details:M.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:ue,reason:Y})}}),h.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(j=>!j.audioCodec||this.isAudioSupported(j.audioCodec)),dl(o)),t.subtitles&&(c=t.subtitles,dl(c));const f=u.slice(0);u.sort((j,Y)=>{if(j.attrs["HDCP-LEVEL"]!==Y.attrs["HDCP-LEVEL"])return(j.attrs["HDCP-LEVEL"]||"")>(Y.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&j.height!==Y.height)return j.height-Y.height;if(j.frameRate!==Y.frameRate)return j.frameRate-Y.frameRate;if(j.videoRange!==Y.videoRange)return ii.indexOf(j.videoRange)-ii.indexOf(Y.videoRange);if(j.videoCodec!==Y.videoCodec){const ue=k(j.videoCodec),ge=k(Y.videoCodec);if(ue!==ge)return ge-ue}if(j.uri===Y.uri&&j.codecSet!==Y.codecSet){const ue=Z(j.codecSet),ge=Z(Y.codecSet);if(ue!==ge)return ge-ue}return j.averageBitrate!==Y.averageBitrate?j.averageBitrate-Y.averageBitrate:0});let d=f[0];if(this.steering&&(u=this.steering.filterParsedLevels(u),u.length!==f.length)){for(let j=0;j<f.length;j++)if(f[j].pathwayId===u[0].pathwayId){d=f[j];break}}this._levels=u;for(let j=0;j<u.length;j++)if(u[j]===d){var y;this._firstLevel=j;const Y=d.bitrate,ue=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${u.length} level(s) found, first bitrate: ${Y}`),((y=this.hls.userConfig)==null?void 0:y.abrEwmaDefaultEstimate)===void 0){const ge=Math.min(Y,this.hls.config.abrEwmaDefaultEstimateMax);ge>ue&&ue===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=ge)}break}const E=s&&!n,A=this.hls.config,S=!!(A.audioStreamController&&A.audioTrackController),U={levels:u,audioTracks:o,subtitleTracks:c,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:S&&!E&&o.some(j=>!!j.url)};h.end=performance.now(),this.hls.trigger(p.MANIFEST_PARSED,U)}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(p.ERROR,{type:te.OTHER_ERROR,details:M.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:h,reason:h.message}),f)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,s=n?n.attrs["PATHWAY-ID"]:void 0,r=t[e],o=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,i===e&&n&&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 ${i}${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(p.LEVEL_SWITCHING,c);const u=r.details;if(!u||u.live){const h=this.switchParams(r.uri,n==null?void 0:n.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(),i=e.filter(n=>t.indexOf(n)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===ce.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===J.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(s=>!!i[s]))return;const n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var i;const{level:n,details:s}=t,r=t.levelInfo;if(!r){var o;this.warn(`Invalid level index ${n}`),(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(n,t,c)}else(i=t.deliveryDirectives)!=null&&i.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],r=e.details,o=r==null?void 0:r.age;this.log(`Loading level index ${n}${(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:""):""} ${i}`),this.hls.trigger(p.LEVEL_LOADING,{url:i,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((s,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));Mn(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger(p.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(p.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function dl(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function pl(){return self.SourceBuffer||self.WebKitSourceBuffer}function gl(){if(!ye())return!1;const e=pl();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Mh(){if(!gl())return!1;const a=ye();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(R(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(R(e,"audio"))))}function Nh(){var a;const e=pl();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Bh=100;class Uh extends ia{constructor(e,t,i){super(e,t,i,"stream-controller",J.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 n=this.media,s=n?n.currentTime:null;if(s===null||!V(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const r=this.getFwdBufferInfoAtPos(n,s,J.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(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:n}=this;if(this.stopLoad(),this.setInterval(Bh),this.level=-1,!this.startFragRequested){let s=n.startLevel;s===-1&&(n.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=n.firstAutoLevel),n.nextLoadLevel=s,this.level=n.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=Ye.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Ye.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Ye.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e==null?void 0:e[t],n=i==null?void 0:i.details;if(n&&(!n.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(n))break;this.state=Ye.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Ye.IDLE;break}break}case Ye.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===Ye.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(t===null||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[s]))return;const r=i[s],o=this.getMainFwdBufferInfo();if(o===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){const A={};this.altAudio===2&&(A.type="video"),this.hls.trigger(p.BUFFER_EOS,A),this.state=Ye.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===Ye.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=Ye.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 y=this.getNextFragment(d,u);if(this.couldBacktrack&&!this.fragPrevious&&y&&Ae(y)&&this.fragmentTracker.getState(y)!==oi.OK){var E;const S=((E=this.backtrackFragment)!=null?E:y).sn-u.startSN,U=u.fragments[S-1];U&&y.cc===U.cc&&(y=U,this.fragmentTracker.removeFragment(U))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(y&&this.isLoopLoading(y,d)){if(!y.gap){const S=this.audioOnly&&!this.altAudio?L.AUDIO:L.VIDEO,U=(S===L.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;U&&this.afterBufferFlushed(U,S,J.MAIN)}y=this.getNextFragmentLoopLoading(y,u,o,J.MAIN,f)}y&&(y.initSegment&&!y.initSegment.data&&!this.bitrateTest&&(y=y.initSegment),this.loadFragment(y,r,d))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===oi.NOT_LOADED||n===oi.PARTIAL?Ae(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,J.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.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?i=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:i=0}else i=0;const r=this.getBufferedFrag(t.currentTime+i);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 Ye.KEY_LOADING:case Ye.FRAG_LOADING:case Ye.FRAG_LOADING_WAITING_RETRY:case Ye.PARSING:case Ye.PARSED:this.state=Ye.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;Gn(i,"playing",this.onMediaPlaying),Gn(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(zn(i,"playing",this.onMediaPlaying),zn(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(p.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,n=!1;for(let s=0;s<t.levels.length;s++){const r=t.levels[s].audioCodec;r&&(i=i||r.indexOf("mp4a.40.2")!==-1,n=n||r.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=i&&n&&!Nh(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==Ye.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=Ye.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:n,startFragRequested:s}=this,r=t.level,o=t.details,c=o.totalduration;if(!n){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===Ye.FRAG_LOADING||this.state===Ye.FRAG_LOADING_WAITING_RETRY)&&h.level!==t.level&&h.loader&&this.abortCurrentFrag();let f=0;if(o.live||(i=u.details)!=null&&i.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(p.LEVEL_UPDATED,{details:o,level:r}),this.state===Ye.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=Ye.IDLE}s&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const n=this.hls.liveSyncPosition,s=this.getLoadPosition(),r=e.fragmentStart,o=e.edge,c=s>=r-t.maxFragLookUpTolerance&&s<=o;if(n!==null&&i.duration>n&&(s<n||!c)){const h=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&i.readyState<4||s<o-h)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var u;const f=Mt.bufferInfo(i,n,0);if(!((u=f.buffered)!=null&&u.length)){i.currentTime=n;return}if(f.start<=s){i.currentTime=n;return}const{nextStart:y}=Mt.bufferedInfo(f.buffered,s,0);y&&(i.currentTime=y)}else i.currentTime=n}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=r[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const u=o.videoCodec,h=c.PTSKnown||!c.live,f=(t=i.initSegment)==null?void 0:t.data,d=this._getAudioCodec(o),y=this.transmuxer=this.transmuxer||new yo(this.hls,J.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),E=n?n.index:-1,A=E!==-1,S=new Gt(i.level,i.sn,i.stats.chunkCount,s.byteLength,E,A),U=this.initPTS[i.cc];y.push(s,f,d,u,i,n,c.totalduration,h,S,U)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(ai(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const 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(n){this.fragmentTracker.removeAllFragments(),i.once(p.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(p.AUDIO_TRACK_SWITCHED,t)}),i.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(p.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=ai(t.url,this.hls);if(i){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,s,r=!1;for(const o in i){const c=i[o];if(c.id==="main"){if(s=o,n=c,o==="video"){const u=i[o];u&&(this.videoBuffer=u.buffer)}}else r=!0}r&&n?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t,s=i.type===J.MAIN;if(s){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Ye.PARSED&&(this.state=Ye.IDLE);return}const o=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),Ae(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const r=this.media;r&&(!this._hasEnoughToStart&&Mt.getBuffered(r).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=Ye.ERROR;return}switch(t.details){case M.FRAG_GAP:case M.FRAG_PARSING_ERROR:case M.FRAG_DECRYPT_ERROR:case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(J.MAIN,t);break;case M.LEVEL_LOAD_ERROR:case M.LEVEL_LOAD_TIMEOUT:case M.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ye.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ce.LEVEL&&(this.state=Ye.IDLE);break;case M.BUFFER_ADD_CODEC_ERROR:case M.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case M.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 M.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=Ye.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==L.AUDIO||!this.altAudio){const i=(t===L.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,J.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const n=this.timelineOffset;n&&i&&(i+=n);const s=this.getLevelDetails(),r=Mt.getBuffered(e),o=r.length?r.start(0):0,c=o-i,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`),i+=c,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:n}=this,s=i==null?void 0:i.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=Ye.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(),n.trigger(p.FRAG_LOADED,i),s.bitrateTest=!1}).catch(i=>{this.state===Ye.STOPPED||this.state===Ye.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:n,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:y}=n,{details:E}=u,A=this.altAudio?void 0:n.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=Ye.PARSING,y){const S=y.tracks;if(S){const ue=o.initSegment||o;if(this.unhandledEncryptionError(y,o))return;this._bufferInitSegment(u,S,ue,s),i.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:ue,id:t,tracks:S})}const U=y.initPTS,j=y.timescale,Y=this.initPTS[o.cc];if(V(U)&&(!Y||Y.baseTime!==U||Y.timescale!==j)){const ue=y.trackId;this.initPTS[o.cc]={baseTime:U,timescale:j,trackId:ue},i.trigger(p.INIT_PTS_FOUND,{frag:o,id:t,initPTS:U,timescale:j,trackId:ue})}}if(h&&E){A&&h.type==="audiovideo"&&this.logMuxedErr(o);const S=E.fragments[o.sn-1-E.startSN],U=o.sn===E.startSN,j=!S||o.cc>S.cc;if(n.independent!==!1){const{startPTS:Y,endPTS:ue,startDTS:ge,endDTS:Fe}=h;if(c)c.elementaryStreams[h.type]={startPTS:Y,endPTS:ue,startDTS:ge,endDTS:Fe};else if(h.firstKeyFrame&&h.independent&&s.id===1&&!j&&(this.couldBacktrack=!0),h.dropped&&h.independent){const ve=this.getMainFwdBufferInfo(),Ce=(ve?ve.end:this.getLoadPosition())+this.config.maxBufferHole,Le=h.firstKeyFramePTS?h.firstKeyFramePTS:Y;if(!U&&Ce<Le-this.config.maxBufferHole&&!j){this.backtrack(o);return}else j&&(o.gap=!0);o.setElementaryStreamInfo(h.type,o.start,ue,o.start,Fe,!0)}else U&&Y-(E.appliedTimelineOffset||0)>Vr&&(o.gap=!0);o.setElementaryStreamInfo(h.type,Y,ue,ge,Fe),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(h,o,c,s,U||j)}else if(U||j)o.gap=!0;else{this.backtrack(o);return}}if(A){const{startPTS:S,endPTS:U,startDTS:j,endDTS:Y}=A;c&&(c.elementaryStreams[L.AUDIO]={startPTS:S,endPTS:U,startDTS:j,endDTS:Y}),o.setElementaryStreamInfo(L.AUDIO,S,U,j,Y),this.bufferFragmentData(A,o,c,s)}if(E&&d!=null&&d.samples.length){const S={id:t,frag:o,details:E,samples:d.samples};i.trigger(p.FRAG_PARSING_METADATA,S)}if(E&&f){const S={id:t,frag:o,details:E,samples:f.samples};i.trigger(p.FRAG_PARSING_USERDATA,S)}}logMuxedErr(e){this.warn(`${Ae(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==Ye.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:s,video:r,audiovideo:o}=t;if(s){const u=e.audioCodec;let h=gt(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=J.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=J.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(p.BUFFER_CODECS,t),!this.hls)return;c.forEach(u=>{const f=t[u].initSegment;f!=null&&f.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:u,data:f,frag:i,part:null,chunkMeta:n,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,J.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e==null?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Ye.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Mt.isBuffered(e,i)?t=this.getAppendedFrag(i):Mt.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const n=this.fragPlaying,s=t.level;(!n||t.sn!==n.sn||n.level!==s)&&(this.fragPlaying=t,this.hls.trigger(p.FRAG_CHANGED,{frag:t}),(!n||n.level!==s)&&this.hls.trigger(p.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 V(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(V(t)){const i=this.getLevelDetails(),n=this.currentFrag||(i?pi(null,i.fragments,t):null);if(n){const s=n.programDateTime;if(s!==null){const r=s+(t-n.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 $h extends C{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[i].loader;if(n){var t;if(e&&e!==((t=n.context)==null?void 0:t.frag.type))return;n.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=M.KEY_LOAD_ERROR,i,n,s){return new dn({type:te.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:i,networkDetails:n})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let n=0,s=t.length;n<s;n++){const r=t[n];if(e.cc<=r.cc&&(!Ae(e)||!Ae(r)||e.sn<r.sn)||!i&&n==s-1)return this.emeController.selectKeySystemFormat(r).then(o=>{if(!this.emeController)return;r.setKeyFormat(o);const c=Jn(o);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const n=cs(this.config);if(n.length)return this.emeController.getKeySystemAccess(n)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const u=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,u))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));const o=Ka(s);let c=this.keyIdToKeyInfo[o];if((i=c)!=null&&i.decryptdata.key)return s.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if(this.emeController&&(n=c)!=null&&n.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case"usable":case"usable-in-future":return c.keyLoadPromise.then(h=>{const{keyInfo:f}=h;return s.key=f.decryptdata.key,{frag:e,keyInfo:f}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${s.keyId?" keyId: "+$(s.keyId):""} URI: ${s.uri} 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,M.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var n;if(!e.decryptdata.keyId&&(n=t.initSegment)!=null&&n.data){const r=bt(t.initSegment.data);if(r.length){const o=r[0];o.some(c=>c!==0)&&(this.log(`Using keyId found in init segment ${$(o)}`),e.decryptdata.keyId=o,es.setKeyIdForUri(e.decryptdata.uri,o))}}const s=this.emeController.loadKey(i);return(e.keyLoadPromise=s.then(r=>(e.mediaKeySessionContext=r,i))).catch(r=>{throw e.keyLoadPromise=null,"data"in r&&(r.data.frag=t),r})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=i.loader,s=new n(i);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=i.keyLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,y,E,A)=>{const{frag:S,keyInfo:U}=E,j=Ka(U.decryptdata);if(!S.decryptdata||U!==this.keyIdToKeyInfo[j])return o(this.createKeyLoadError(S,M.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),A));U.decryptdata.key=S.decryptdata.key=new Uint8Array(d.data),S.keyLoader=null,U.loader=null,r({frag:S,keyInfo:U})},onError:(d,y,E,A)=>{this.resetLoader(y),o(this.createKeyLoadError(t,M.KEY_LOAD_ERROR,new Error(`HTTP Error ${d.code} loading key ${d.text}`),E,b({url:c.url,data:void 0},d)))},onTimeout:(d,y,E)=>{this.resetLoader(y),o(this.createKeyLoadError(t,M.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),E))},onAbort:(d,y,E)=>{this.resetLoader(y),o(this.createKeyLoadError(t,M.INTERNAL_ABORTED,new Error("key loading aborted"),E))}};s.load(c,h,f)})}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,s=i.loader;t.keyLoader===s&&(t.keyLoader=null,i.loader=null);const r=Ka(i.decryptdata)||n;delete this.keyIdToKeyInfo[r],s&&s.destroy()}}function Ka(a){if(a.keyFormat!==gi.FAIRPLAY){const e=a.keyId;if(e)return $(e)}return a.uri}function ml(a){const{type:e}=a;switch(e){case ce.AUDIO_TRACK:return J.AUDIO;case ce.SUBTITLE_TRACK:return J.SUBTITLE;default:return J.MAIN}}function Ga(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Kh{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,s=i||n,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:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ce.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:s,url:r,deliveryDirectives:o,levelInfo:c}=t;this.load({id:i,level:n,pathwayId:s,responseType:"text",type:ce.LEVEL,url:r,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:ce.AUDIO_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:ce.SUBTITLE_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[ce.LEVEL];if(i){const n=i.context;n&&!t.levels.some(s=>s===n.levelOrTrack)&&(i.abort(),delete this.loaders[ce.LEVEL])}}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const u=this.hls.logger,h=n.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}`),n.abort()}let s;if(e.type===ce.MANIFEST?s=i.manifestLoadPolicy.default:s=m({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),V((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===ce.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===ce.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===ce.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=m({},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 y=this.getInternalLoader(f);this.resetInternalLoader(f.type);const E=u.data;h.parsing.start=performance.now(),Zn.isMediaPlaylist(E)||f.type!==ce.MANIFEST?this.handleTrackOrLevelPlaylist(u,h,f,d||null,y):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)}};n.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const s=this.hls,r=e.data,o=Ga(e,i),c=Zn.parseMasterPlaylist(r,o);if(c.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:u,levels:h,sessionData:f,sessionKeys:d,startTimeOffset:y,variableList:E}=c;this.variableList=E,h.forEach(j=>{const{unknownCodecs:Y}=j;if(Y){const{preferManagedMediaSource:ue}=this.hls.config;let{audioCodec:ge,videoCodec:Fe}=j;for(let ve=Y.length;ve--;){const Ce=Y[ve];ae(Ce,"audio",ue)?(j.audioCodec=ge=ge?`${ge},${Ce}`:Ce,dt.audio[ge.substring(0,4)]=2,Y.splice(ve,1)):ae(Ce,"video",ue)&&(j.videoCodec=Fe=Fe?`${Fe},${Ce}`:Ce,dt.video[Fe.substring(0,4)]=2,Y.splice(ve,1))}}});const{AUDIO:A=[],SUBTITLES:S,"CLOSED-CAPTIONS":U}=Zn.parseMasterPlaylistMedia(r,o,c);A.length&&!A.some(Y=>!Y.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"),A.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ii({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:h,audioTracks:A,subtitles:S,captions:U,contentSteering:u,url:o,stats:t,networkDetails:n,sessionData:f,sessionKeys:d,startTimeOffset:y,variableList:E})}handleTrackOrLevelPlaylist(e,t,i,n,s){const r=this.hls,{id:o,level:c,type:u}=i,h=Ga(e,i),f=V(c)?c:V(o)?o:0,d=ml(i),y=Zn.parseLevelPlaylist(e.data,h,f,d,0,this.variableList);if(u===ce.MANIFEST){const E={attrs:new Ii({}),bitrate:0,details:y,name:"",url:h};y.requestScheduled=t.loading.start+rn(y,0),r.trigger(p.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:h,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=y,this.handlePlaylistLoaded(y,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(p.ERROR,{type:te.NETWORK_ERROR,details:M.MANIFEST_PARSING_ERROR,fatal:t.type===ce.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:s})}handleNetworkError(e,t,i=!1,n,s){let r=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===ce.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===ce.AUDIO_TRACK||e.type===ce.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let c=M.UNKNOWN,u=!1;const h=this.getInternalLoader(e);switch(e.type){case ce.MANIFEST:c=i?M.MANIFEST_LOAD_TIMEOUT:M.MANIFEST_LOAD_ERROR,u=!0;break;case ce.LEVEL:c=i?M.LEVEL_LOAD_TIMEOUT:M.LEVEL_LOAD_ERROR,u=!1;break;case ce.AUDIO_TRACK:c=i?M.AUDIO_TRACK_LOAD_TIMEOUT:M.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ce.SUBTITLE_TRACK:c=i?M.SUBTITLE_TRACK_LOAD_TIMEOUT:M.SUBTITLE_LOAD_ERROR,u=!1;break}h&&this.resetInternalLoader(e.type);const f={type:te.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:s};if(n){const d=(t==null?void 0:t.url)||e.url;f.response=b({url:d,data:void 0},n)}this.hls.trigger(p.ERROR,f)}handlePlaylistLoaded(e,t,i,n,s,r){const o=this.hls,{type:c,level:u,levelOrTrack:h,id:f,groupId:d,deliveryDirectives:y}=n,E=Ga(t,n),A=ml(n);let S=typeof n.level=="number"&&A===J.MAIN?u:void 0;const U=e.playlistParsingError;if(U){if(this.hls.logger.warn(`${U} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(p.ERROR,{type:te.NETWORK_ERROR,details:M.LEVEL_PARSING_ERROR,fatal:!1,url:E,error:U,reason:U.message,response:t,context:n,level:S,parent:A,networkDetails:s,stats:i});return}e.playlistParsingError=null}if(!e.fragments.length){const j=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:te.NETWORK_ERROR,details:M.LEVEL_EMPTY_ERROR,fatal:!1,url:E,error:j,reason:j.message,response:t,context:n,level:S,parent:A,networkDetails:s,stats:i});return}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),(!r.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case ce.MANIFEST:case ce.LEVEL:if(S){if(!h)S=0;else if(h!==o.levels[S]){const j=o.levels.indexOf(h);j>-1&&(S=j)}}o.trigger(p.LEVEL_LOADED,{details:e,levelInfo:h||o.levels[0],level:S||0,id:f||0,stats:i,networkDetails:s,deliveryDirectives:y,withoutMultiVariant:c===ce.MANIFEST});break;case ce.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:h,id:f||0,groupId:d||"",stats:i,networkDetails:s,deliveryDirectives:y});break;case ce.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:h,id:f||0,groupId:d||"",stats:i,networkDetails:s,deliveryDirectives:y});break}}}class ws{static get version(){return nr}static isMSESupported(){return gl()}static isSupported(){return Mh()}static getMediaSource(){return ye()}static get Events(){return p}static get MetadataSchema(){return Yn}static get ErrorTypes(){return te}static get ErrorDetails(){return M}static get DefaultConfig(){return ws.defaultConfig?ws.defaultConfig:Sh}static set DefaultConfig(e){ws.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 sa,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=le(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=wh(ws.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Dh(i,t);const{abrController:n,bufferController:s,capLevelController:r,errorController:o,fpsController:c}=i,u=new o(this),h=this.abrController=new n(this),f=new vn(this),d=i.interstitialsController,y=d?this.interstitialsController=new d(this,ws):null,E=this.bufferController=new s(this,f),A=this.capLevelController=new r(this),S=new c(this),U=new Kh(this),j=i.contentSteeringController,Y=j?new j(this):null,ue=this.levelController=new Fh(this,Y),ge=new Ph(this),Fe=new $h(this.config,this.logger),ve=this.streamController=new Uh(this,f,Fe),Ce=this.gapController=new Ch(this,f);A.setStreamController(ve),S.setStreamController(ve);const Le=[U,ue,ve];y&&Le.splice(1,0,y),Y&&Le.splice(1,0,Y),this.networkControllers=Le;const xe=[h,E,Ce,A,S,ge,f];this.audioTrackController=this.createController(i.audioTrackController,Le);const et=i.audioStreamController;et&&Le.push(this.audioStreamController=new et(this,f,Fe)),this.subtitleTrackController=this.createController(i.subtitleTrackController,Le);const St=i.subtitleStreamController;St&&Le.push(this.subtititleStreamController=new St(this,f,Fe)),this.createController(i.timelineController,xe),Fe.emeController=this.emeController=this.createController(i.emeController,xe),this.cmcdController=this.createController(i.cmcdController,xe),this.latencyController=this.createController(Oh,xe),this.coreComponents=xe,Le.push(u);const Pt=u.onErrorOut;typeof Pt=="function"&&this.on(p.ERROR,Pt,u),this.on(p.MANIFEST_LOADED,U.onManifestLoaded,U)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,n){this._emitter.off(e,t,i,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const n=e===p.ERROR;this.trigger(p.ERROR,{type:te.OTHER_ERROR,details:M.INTERNAL_EXCEPTION,fatal:n,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(p.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(p.ERROR,{type:te.OTHER_ERROR,details:M.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,n=t?e:{media:i};this._media=i,this.trigger(p.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger(p.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(p.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,n=this._url=g.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${n}`),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(p.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[J.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[J.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[J.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=Cc()),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){Hi(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let n=0;n<i;n++)if(e[n].maxBitrate>=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let n;if(t===-1&&e!=null&&e.length?n=e.length-1:n=t,i)for(let s=n;s--;){const r=e[s].attrs["HDCP-LEVEL"];if(r&&r<=i)return s}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=it(t);return Fi(e,i,navigator.mediaCapabilities)}}ws.defaultConfig=void 0}}]);
|
|
}()); |