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.
1022 lines
939 KiB
1022 lines
939 KiB
!(function(){var el=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[1855],{65030:function(Dt,Ze,ee){"use strict";ee.d(Ze,{Z:function(){return wt}});var N=ee(27247),ye=ee(11913),Ne=ee(43079),oe=ee(43403),V=ee(92310),p=ee.n(V),ge=ee(29301),ne=ee(76846),l=ee(96452),z=ee(6089),D=ee(80402),g=ee(34280),x=ee(49658),y=ee(59301),b=ee(32855),O=ee(77900),P=ee(8654);function F(de){var Ee=de.prefixCls,Q=de.align,Le=de.arrow,Ce=de.arrowPos,Ve=Le||{},G=Ve.className,ae=Ve.content,we=Ce.x,De=we===void 0?0:we,ke=Ce.y,je=ke===void 0?0:ke,ut=y.useRef();if(!Q||!Q.points)return null;var Qe={position:"absolute"};if(Q.autoArrow!==!1){var qe=Q.points[0],Ue=Q.points[1],dt=qe[0],ht=qe[1],et=Ue[0],_e=Ue[1];dt===et||!["t","b"].includes(dt)?Qe.top=je:dt==="t"?Qe.top=0:Qe.bottom=0,ht===_e||!["l","r"].includes(ht)?Qe.left=De:ht==="l"?Qe.left=0:Qe.right=0}return y.createElement("div",{ref:ut,className:p()("".concat(Ee,"-arrow"),G),style:Qe},ae)}function S(de){var Ee=de.prefixCls,Q=de.open,Le=de.zIndex,Ce=de.mask,Ve=de.motion;return Ce?y.createElement(O.default,(0,b.Z)({},Ve,{motionAppear:!0,visible:Q,removeOnLeave:!0}),function(G){var ae=G.className;return y.createElement("div",{style:{zIndex:Le},className:p()("".concat(Ee,"-mask"),ae)})}):null}var L=y.memo(function(de){var Ee=de.children;return Ee},function(de,Ee){return Ee.cache}),j=L,K=y.forwardRef(function(de,Ee){var Q=de.popup,Le=de.className,Ce=de.prefixCls,Ve=de.style,G=de.target,ae=de.onVisibleChanged,we=de.open,De=de.keepDom,ke=de.fresh,je=de.onClick,ut=de.mask,Qe=de.arrow,qe=de.arrowPos,Ue=de.align,dt=de.motion,ht=de.maskMotion,et=de.forceRender,_e=de.getPopupContainer,it=de.autoDestroy,We=de.portal,Be=de.zIndex,At=de.onMouseEnter,vt=de.onMouseLeave,nt=de.onPointerEnter,It=de.onPointerDownCapture,Bt=de.ready,Et=de.offsetX,ei=de.offsetY,be=de.offsetR,le=de.offsetB,he=de.onAlign,I=de.onPrepare,$=de.stretch,Z=de.targetWidth,se=de.targetHeight,re=typeof Q=="function"?Q():Q,Ge=we||De,ze=(_e==null?void 0:_e.length)>0,ot=y.useState(!_e||!ze),ct=(0,ye.Z)(ot,2),Ct=ct[0],Yt=ct[1];if((0,g.Z)(function(){!Ct&&ze&&G&&Yt(!0)},[Ct,ze,G]),!Ct)return null;var Ft="auto",St={left:"-1000vw",top:"-1000vh",right:Ft,bottom:Ft};if(Bt||!we){var li,yi=Ue.points,ci=Ue.dynamicInset||((li=Ue._experimental)===null||li===void 0?void 0:li.dynamicInset),ai=ci&&yi[0][1]==="r",Xe=ci&&yi[0][0]==="b";ai?(St.right=be,St.left=Ft):(St.left=Et,St.right=Ft),Xe?(St.bottom=le,St.top=Ft):(St.top=ei,St.bottom=Ft)}var Ye={};return $&&($.includes("height")&&se?Ye.height=se:$.includes("minHeight")&&se&&(Ye.minHeight=se),$.includes("width")&&Z?Ye.width=Z:$.includes("minWidth")&&Z&&(Ye.minWidth=Z)),we||(Ye.pointerEvents="none"),y.createElement(We,{open:et||Ge,getContainer:_e&&function(){return _e(G)},autoDestroy:it},y.createElement(S,{prefixCls:Ce,open:we,zIndex:Be,mask:ut,motion:ht}),y.createElement(ge.Z,{onResize:he,disabled:!we},function(Pt){return y.createElement(O.default,(0,b.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:et,leavedClassName:"".concat(Ce,"-hidden")},dt,{onAppearPrepare:I,onEnterPrepare:I,visible:we,onVisibleChanged:function(Ht){var qt;dt==null||(qt=dt.onVisibleChanged)===null||qt===void 0||qt.call(dt,Ht),ae(Ht)}}),function($t,Ht){var qt=$t.className,Ei=$t.style,_i=p()(Ce,qt,Le);return y.createElement("div",{ref:(0,P.sQ)(Pt,Ee,Ht),className:_i,style:(0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)({"--arrow-x":"".concat(qe.x||0,"px"),"--arrow-y":"".concat(qe.y||0,"px")},St),Ye),Ei),{},{boxSizing:"border-box",zIndex:Be},Ve),onMouseEnter:At,onMouseLeave:vt,onPointerEnter:nt,onClick:je,onPointerDownCapture:It},Qe&&y.createElement(F,{prefixCls:Ce,arrow:Qe,arrowPos:qe,align:Ue}),y.createElement(j,{cache:!we&&!ke},re))})}))}),J=K,ie=y.forwardRef(function(de,Ee){var Q=de.children,Le=de.getTriggerDOMNode,Ce=(0,P.Yr)(Q),Ve=y.useCallback(function(ae){(0,P.mH)(Ee,Le?Le(ae):ae)},[Le]),G=(0,P.x1)(Ve,(0,P.C4)(Q));return Ce?y.cloneElement(Q,{ref:G}):Q}),W=ie,te=y.createContext(null),fe=te;function me(de){return de?Array.isArray(de)?de:[de]:[]}function Pe(de,Ee,Q,Le){return y.useMemo(function(){var Ce=me(Q!=null?Q:Ee),Ve=me(Le!=null?Le:Ee),G=new Set(Ce),ae=new Set(Ve);return de&&(G.has("hover")&&(G.delete("hover"),G.add("click")),ae.has("hover")&&(ae.delete("hover"),ae.add("click"))),[G,ae]},[de,Ee,Q,Le])}var M=ee(29194);function A(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Q=arguments.length>2?arguments[2]:void 0;return Q?de[0]===Ee[0]:de[0]===Ee[0]&&de[1]===Ee[1]}function C(de,Ee,Q,Le){for(var Ce=Q.points,Ve=Object.keys(de),G=0;G<Ve.length;G+=1){var ae,we=Ve[G];if(A((ae=de[we])===null||ae===void 0?void 0:ae.points,Ce,Le))return"".concat(Ee,"-placement-").concat(we)}return""}function U(de,Ee,Q,Le){return Ee||(Q?{motionName:"".concat(de,"-").concat(Q)}:Le?{motionName:Le}:null)}function Y(de){return de.ownerDocument.defaultView}function B(de){for(var Ee=[],Q=de==null?void 0:de.parentElement,Le=["hidden","scroll","clip","auto"];Q;){var Ce=Y(Q).getComputedStyle(Q),Ve=Ce.overflowX,G=Ce.overflowY,ae=Ce.overflow;[Ve,G,ae].some(function(we){return Le.includes(we)})&&Ee.push(Q),Q=Q.parentElement}return Ee}function E(de){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(de)?Ee:de}function _(de){return E(parseFloat(de),0)}function R(de,Ee){var Q=(0,N.Z)({},de);return(Ee||[]).forEach(function(Le){if(!(Le instanceof HTMLBodyElement||Le instanceof HTMLHtmlElement)){var Ce=Y(Le).getComputedStyle(Le),Ve=Ce.overflow,G=Ce.overflowClipMargin,ae=Ce.borderTopWidth,we=Ce.borderBottomWidth,De=Ce.borderLeftWidth,ke=Ce.borderRightWidth,je=Le.getBoundingClientRect(),ut=Le.offsetHeight,Qe=Le.clientHeight,qe=Le.offsetWidth,Ue=Le.clientWidth,dt=_(ae),ht=_(we),et=_(De),_e=_(ke),it=E(Math.round(je.width/qe*1e3)/1e3),We=E(Math.round(je.height/ut*1e3)/1e3),Be=(qe-Ue-et-_e)*it,At=(ut-Qe-dt-ht)*We,vt=dt*We,nt=ht*We,It=et*it,Bt=_e*it,Et=0,ei=0;if(Ve==="clip"){var be=_(G);Et=be*it,ei=be*We}var le=je.x+It-Et,he=je.y+vt-ei,I=le+je.width+2*Et-It-Bt-Be,$=he+je.height+2*ei-vt-nt-At;Q.left=Math.max(Q.left,le),Q.top=Math.max(Q.top,he),Q.right=Math.min(Q.right,I),Q.bottom=Math.min(Q.bottom,$)}}),Q}function q(de){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Q="".concat(Ee),Le=Q.match(/^(.*)\%$/);return Le?de*(parseFloat(Le[1])/100):parseFloat(Q)}function Te(de,Ee){var Q=Ee||[],Le=(0,ye.Z)(Q,2),Ce=Le[0],Ve=Le[1];return[q(de.width,Ce),q(de.height,Ve)]}function Re(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[de[0],de[1]]}function Je(de,Ee){var Q=Ee[0],Le=Ee[1],Ce,Ve;return Q==="t"?Ve=de.y:Q==="b"?Ve=de.y+de.height:Ve=de.y+de.height/2,Le==="l"?Ce=de.x:Le==="r"?Ce=de.x+de.width:Ce=de.x+de.width/2,{x:Ce,y:Ve}}function He(de,Ee){var Q={t:"b",b:"t",l:"r",r:"l"};return de.map(function(Le,Ce){return Ce===Ee?Q[Le]||"c":Le}).join("")}function yt(de,Ee,Q,Le,Ce,Ve,G){var ae=y.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Ce[Le]||{}}),we=(0,ye.Z)(ae,2),De=we[0],ke=we[1],je=y.useRef(0),ut=y.useMemo(function(){return Ee?B(Ee):[]},[Ee]),Qe=y.useRef({}),qe=function(){Qe.current={}};de||qe();var Ue=(0,z.Z)(function(){if(Ee&&Q&&de){let Ii=function(Rn,sn){var pn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xi,Qn=Ge.x+Rn,In=Ge.y+sn,si=Qn+Xe,wi=In+ai,Kn=Math.max(Qn,pn.left),gt=Math.max(In,pn.top),Rt=Math.min(si,pn.right),ni=Math.min(wi,pn.bottom);return Math.max(0,(Rt-Kn)*(ni-gt))},dn=function(){Qt=Ge.y+ri,hn=Qt+ai,Zi=Ge.x+Xt,Ri=Zi+Xe};var et,_e,it,We,Be=Ee,At=Be.ownerDocument,vt=Y(Be),nt=vt.getComputedStyle(Be),It=nt.position,Bt=Be.style.left,Et=Be.style.top,ei=Be.style.right,be=Be.style.bottom,le=Be.style.overflow,he=(0,N.Z)((0,N.Z)({},Ce[Le]),Ve),I=At.createElement("div");(et=Be.parentElement)===null||et===void 0||et.appendChild(I),I.style.left="".concat(Be.offsetLeft,"px"),I.style.top="".concat(Be.offsetTop,"px"),I.style.position=It,I.style.height="".concat(Be.offsetHeight,"px"),I.style.width="".concat(Be.offsetWidth,"px"),Be.style.left="0",Be.style.top="0",Be.style.right="auto",Be.style.bottom="auto",Be.style.overflow="hidden";var $;if(Array.isArray(Q))$={x:Q[0],y:Q[1],width:0,height:0};else{var Z,se,re=Q.getBoundingClientRect();re.x=(Z=re.x)!==null&&Z!==void 0?Z:re.left,re.y=(se=re.y)!==null&&se!==void 0?se:re.top,$={x:re.x,y:re.y,width:re.width,height:re.height}}var Ge=Be.getBoundingClientRect(),ze=vt.getComputedStyle(Be),ot=ze.height,ct=ze.width;Ge.x=(_e=Ge.x)!==null&&_e!==void 0?_e:Ge.left,Ge.y=(it=Ge.y)!==null&&it!==void 0?it:Ge.top;var Ct=At.documentElement,Yt=Ct.clientWidth,Ft=Ct.clientHeight,St=Ct.scrollWidth,li=Ct.scrollHeight,yi=Ct.scrollTop,ci=Ct.scrollLeft,ai=Ge.height,Xe=Ge.width,Ye=$.height,Pt=$.width,$t={left:0,top:0,right:Yt,bottom:Ft},Ht={left:-ci,top:-yi,right:St-ci,bottom:li-yi},qt=he.htmlRegion,Ei="visible",_i="visibleFirst";qt!=="scroll"&&qt!==_i&&(qt=Ei);var ti=qt===_i,bi=R(Ht,ut),Gt=R($t,ut),xi=qt===Ei?Gt:bi,ii=ti?Gt:xi;Be.style.left="auto",Be.style.top="auto",Be.style.right="0",Be.style.bottom="0";var bn=Be.getBoundingClientRect();Be.style.left=Bt,Be.style.top=Et,Be.style.right=ei,Be.style.bottom=be,Be.style.overflow=le,(We=Be.parentElement)===null||We===void 0||We.removeChild(I);var Kt=E(Math.round(Xe/parseFloat(ct)*1e3)/1e3),Vt=E(Math.round(ai/parseFloat(ot)*1e3)/1e3);if(Kt===0||Vt===0||(0,ne.Sh)(Q)&&!(0,M.Z)(Q))return;var kt=he.offset,gi=he.targetOffset,jt=Te(Ge,kt),vi=(0,ye.Z)(jt,2),Ni=vi[0],Bi=vi[1],Ai=Te($,gi),di=(0,ye.Z)(Ai,2),un=di[0],Ts=di[1];$.x-=un,$.y-=Ts;var Ji=he.points||[],rs=(0,ye.Z)(Ji,2),as=rs[0],xn=rs[1],en=Re(xn),Di=Re(as),Ti=Je($,en),Hi=Je(Ge,Di),Ui=(0,N.Z)({},he),Xt=Ti.x-Hi.x+Ni,ri=Ti.y-Hi.y+Bi,$i=Ii(Xt,ri),Wi=Ii(Xt,ri,Gt),Pi=Je($,["t","l"]),Fn=Je(Ge,["t","l"]),Mn=Je($,["b","r"]),Yi=Je(Ge,["b","r"]),Tn=he.overflow||{},Wn=Tn.adjustX,ui=Tn.adjustY,mi=Tn.shiftX,Yn=Tn.shiftY,tn=function(sn){return typeof sn=="boolean"?sn:sn>=0},Qt,hn,Zi,Ri;dn();var Zn=tn(ui),hi=Di[0]===en[0];if(Zn&&Di[0]==="t"&&(hn>ii.bottom||Qe.current.bt)){var wn=ri;hi?wn-=ai-Ye:wn=Pi.y-Yi.y-Bi;var os=Ii(Xt,wn),ws=Ii(Xt,wn,Gt);os>$i||os===$i&&(!ti||ws>=Wi)?(Qe.current.bt=!0,ri=wn,Bi=-Bi,Ui.points=[He(Di,0),He(en,0)]):Qe.current.bt=!1}if(Zn&&Di[0]==="b"&&(Qt<ii.top||Qe.current.tb)){var Sn=ri;hi?Sn+=ai-Ye:Sn=Mn.y-Fn.y-Bi;var ls=Ii(Xt,Sn),Ss=Ii(Xt,Sn,Gt);ls>$i||ls===$i&&(!ti||Ss>=Wi)?(Qe.current.tb=!0,ri=Sn,Bi=-Bi,Ui.points=[He(Di,0),He(en,0)]):Qe.current.tb=!1}var Nn=tn(Wn),qn=Di[1]===en[1];if(Nn&&Di[1]==="l"&&(Ri>ii.right||Qe.current.rl)){var An=Xt;qn?An-=Xe-Pt:An=Pi.x-Yi.x-Ni;var cn=Ii(An,ri),Bn=Ii(An,ri,Gt);cn>$i||cn===$i&&(!ti||Bn>=Wi)?(Qe.current.rl=!0,Xt=An,Ni=-Ni,Ui.points=[He(Di,1),He(en,1)]):Qe.current.rl=!1}if(Nn&&Di[1]==="r"&&(Zi<ii.left||Qe.current.lr)){var Dn=Xt;qn?Dn+=Xe-Pt:Dn=Mn.x-Fn.x-Ni;var Oi=Ii(Dn,ri),Ln=Ii(Dn,ri,Gt);Oi>$i||Oi===$i&&(!ti||Ln>=Wi)?(Qe.current.lr=!0,Xt=Dn,Ni=-Ni,Ui.points=[He(Di,1),He(en,1)]):Qe.current.lr=!1}dn();var Fi=mi===!0?0:mi;typeof Fi=="number"&&(Zi<Gt.left&&(Xt-=Zi-Gt.left-Ni,$.x+Pt<Gt.left+Fi&&(Xt+=$.x-Gt.left+Pt-Fi)),Ri>Gt.right&&(Xt-=Ri-Gt.right-Ni,$.x>Gt.right-Fi&&(Xt+=$.x-Gt.right+Fi)));var Vi=Yn===!0?0:Yn;typeof Vi=="number"&&(Qt<Gt.top&&(ri-=Qt-Gt.top-Bi,$.y+Ye<Gt.top+Vi&&(ri+=$.y-Gt.top+Ye-Vi)),hn>Gt.bottom&&(ri-=hn-Gt.bottom-Bi,$.y>Gt.bottom-Vi&&(ri+=$.y-Gt.bottom+Vi)));var nn=Ge.x+Xt,Lt=nn+Xe,Un=Ge.y+ri,us=Un+ai,$n=$.x,Xn=$n+Pt,hs=$.y,As=hs+Ye,cs=Math.max(nn,$n),Jt=Math.min(Lt,Xn),Ds=(cs+Jt)/2,Ls=Ds-nn,fs=Math.max(Un,hs),ds=Math.min(us,As),Rs=(fs+ds)/2,Is=Rs-Un;G==null||G(Ee,Ui);var ji=bn.right-Ge.x-(Xt+Ge.width),Gn=bn.bottom-Ge.y-(ri+Ge.height);Kt===1&&(Xt=Math.round(Xt),ji=Math.round(ji)),Vt===1&&(ri=Math.round(ri),Gn=Math.round(Gn));var fn={ready:!0,offsetX:Xt/Kt,offsetY:ri/Vt,offsetR:ji/Kt,offsetB:Gn/Vt,arrowX:Ls/Kt,arrowY:Is/Vt,scaleX:Kt,scaleY:Vt,align:Ui};ke(fn)}}),dt=function(){je.current+=1;var _e=je.current;Promise.resolve().then(function(){je.current===_e&&Ue()})},ht=function(){ke(function(_e){return(0,N.Z)((0,N.Z)({},_e),{},{ready:!1})})};return(0,g.Z)(ht,[Le]),(0,g.Z)(function(){de||ht()},[de]),[De.ready,De.offsetX,De.offsetY,De.offsetR,De.offsetB,De.arrowX,De.arrowY,De.scaleX,De.scaleY,De.align,dt]}var tt=ee(3300);function Ke(de,Ee,Q,Le,Ce){(0,g.Z)(function(){if(de&&Ee&&Q){let je=function(){Le(),Ce()};var Ve=Ee,G=Q,ae=B(Ve),we=B(G),De=Y(G),ke=new Set([De].concat((0,tt.Z)(ae),(0,tt.Z)(we)));return ke.forEach(function(ut){ut.addEventListener("scroll",je,{passive:!0})}),De.addEventListener("resize",je,{passive:!0}),Le(),function(){ke.forEach(function(ut){ut.removeEventListener("scroll",je),De.removeEventListener("resize",je)})}}},[de,Ee,Q])}var Mt=ee(48736);function $e(de,Ee,Q,Le,Ce,Ve,G,ae){var we=y.useRef(de);we.current=de;var De=y.useRef(!1);y.useEffect(function(){if(Ee&&Le&&(!Ce||Ve)){var je=function(){De.current=!1},ut=function(it){var We;we.current&&!G(((We=it.composedPath)===null||We===void 0||(We=We.call(it))===null||We===void 0?void 0:We[0])||it.target)&&!De.current&&ae(!1)},Qe=Y(Le);Qe.addEventListener("pointerdown",je,!0),Qe.addEventListener("mousedown",ut,!0),Qe.addEventListener("contextmenu",ut,!0);var qe=(0,l.A)(Q);if(qe&&(qe.addEventListener("mousedown",ut,!0),qe.addEventListener("contextmenu",ut,!0)),0)var Ue,dt,ht,et;return function(){Qe.removeEventListener("pointerdown",je,!0),Qe.removeEventListener("mousedown",ut,!0),Qe.removeEventListener("contextmenu",ut,!0),qe&&(qe.removeEventListener("mousedown",ut,!0),qe.removeEventListener("contextmenu",ut,!0))}}},[Ee,Q,Le,Ce,Ve]);function ke(){De.current=!0}return ke}var pt=["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 Oe(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oe.Z,Ee=y.forwardRef(function(Q,Le){var Ce=Q.prefixCls,Ve=Ce===void 0?"rc-trigger-popup":Ce,G=Q.children,ae=Q.action,we=ae===void 0?"hover":ae,De=Q.showAction,ke=Q.hideAction,je=Q.popupVisible,ut=Q.defaultPopupVisible,Qe=Q.onPopupVisibleChange,qe=Q.afterPopupVisibleChange,Ue=Q.mouseEnterDelay,dt=Q.mouseLeaveDelay,ht=dt===void 0?.1:dt,et=Q.focusDelay,_e=Q.blurDelay,it=Q.mask,We=Q.maskClosable,Be=We===void 0?!0:We,At=Q.getPopupContainer,vt=Q.forceRender,nt=Q.autoDestroy,It=Q.destroyPopupOnHide,Bt=Q.popup,Et=Q.popupClassName,ei=Q.popupStyle,be=Q.popupPlacement,le=Q.builtinPlacements,he=le===void 0?{}:le,I=Q.popupAlign,$=Q.zIndex,Z=Q.stretch,se=Q.getPopupClassNameFromAlign,re=Q.fresh,Ge=Q.alignPoint,ze=Q.onPopupClick,ot=Q.onPopupAlign,ct=Q.arrow,Ct=Q.popupMotion,Yt=Q.maskMotion,Ft=Q.popupTransitionName,St=Q.popupAnimation,li=Q.maskTransitionName,yi=Q.maskAnimation,ci=Q.className,ai=Q.getTriggerDOMNode,Xe=(0,Ne.Z)(Q,pt),Ye=nt||It||!1,Pt=y.useState(!1),$t=(0,ye.Z)(Pt,2),Ht=$t[0],qt=$t[1];(0,g.Z)(function(){qt((0,x.Z)())},[]);var Ei=y.useRef({}),_i=y.useContext(fe),ti=y.useMemo(function(){return{registerSubPopup:function(Rt,ni){Ei.current[Rt]=ni,_i==null||_i.registerSubPopup(Rt,ni)}}},[_i]),bi=(0,D.Z)(),Gt=y.useState(null),xi=(0,ye.Z)(Gt,2),ii=xi[0],bn=xi[1],Kt=y.useRef(null),Vt=(0,z.Z)(function(gt){Kt.current=gt,(0,ne.Sh)(gt)&&ii!==gt&&bn(gt),_i==null||_i.registerSubPopup(bi,gt)}),kt=y.useState(null),gi=(0,ye.Z)(kt,2),jt=gi[0],vi=gi[1],Ni=y.useRef(null),Bi=(0,z.Z)(function(gt){(0,ne.Sh)(gt)&&jt!==gt&&(vi(gt),Ni.current=gt)}),Ai=y.Children.only(G),di=(Ai==null?void 0:Ai.props)||{},un={},Ts=(0,z.Z)(function(gt){var Rt,ni,pi=jt;return(pi==null?void 0:pi.contains(gt))||((Rt=(0,l.A)(pi))===null||Rt===void 0?void 0:Rt.host)===gt||gt===pi||(ii==null?void 0:ii.contains(gt))||((ni=(0,l.A)(ii))===null||ni===void 0?void 0:ni.host)===gt||gt===ii||Object.values(Ei.current).some(function(oi){return(oi==null?void 0:oi.contains(gt))||gt===oi})}),Ji=U(Ve,Ct,St,Ft),rs=U(Ve,Yt,yi,li),as=y.useState(ut||!1),xn=(0,ye.Z)(as,2),en=xn[0],Di=xn[1],Ti=je!=null?je:en,Hi=(0,z.Z)(function(gt){je===void 0&&Di(gt)});(0,g.Z)(function(){Di(je||!1)},[je]);var Ui=y.useRef(Ti);Ui.current=Ti;var Xt=y.useRef([]);Xt.current=[];var ri=(0,z.Z)(function(gt){var Rt;Hi(gt),((Rt=Xt.current[Xt.current.length-1])!==null&&Rt!==void 0?Rt:Ti)!==gt&&(Xt.current.push(gt),Qe==null||Qe(gt))}),$i=y.useRef(),Wi=function(){clearTimeout($i.current)},Pi=function(Rt){var ni=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Wi(),ni===0?ri(Rt):$i.current=setTimeout(function(){ri(Rt)},ni*1e3)};y.useEffect(function(){return Wi},[]);var Fn=y.useState(!1),Mn=(0,ye.Z)(Fn,2),Yi=Mn[0],Tn=Mn[1];(0,g.Z)(function(gt){(!gt||Ti)&&Tn(!0)},[Ti]);var Wn=y.useState(null),ui=(0,ye.Z)(Wn,2),mi=ui[0],Yn=ui[1],tn=y.useState(null),Qt=(0,ye.Z)(tn,2),hn=Qt[0],Zi=Qt[1],Ri=function(Rt){Zi([Rt.clientX,Rt.clientY])},Zn=yt(Ti,ii,Ge&&hn!==null?hn:jt,be,he,I,ot),hi=(0,ye.Z)(Zn,11),wn=hi[0],os=hi[1],ws=hi[2],Sn=hi[3],ls=hi[4],Ss=hi[5],Nn=hi[6],qn=hi[7],An=hi[8],cn=hi[9],Bn=hi[10],Dn=Pe(Ht,we,De,ke),Oi=(0,ye.Z)(Dn,2),Ln=Oi[0],Fi=Oi[1],Vi=Ln.has("click"),nn=Fi.has("click")||Fi.has("contextMenu"),Lt=(0,z.Z)(function(){Yi||Bn()}),Un=function(){Ui.current&&Ge&&nn&&Pi(!1)};Ke(Ti,jt,ii,Lt,Un),(0,g.Z)(function(){Lt()},[hn,be]),(0,g.Z)(function(){Ti&&!(he!=null&&he[be])&&Lt()},[JSON.stringify(I)]);var us=y.useMemo(function(){var gt=C(he,Ve,cn,Ge);return p()(gt,se==null?void 0:se(cn))},[cn,se,he,Ve,Ge]);y.useImperativeHandle(Le,function(){return{nativeElement:Ni.current,popupElement:Kt.current,forceAlign:Lt}});var $n=y.useState(0),Xn=(0,ye.Z)($n,2),hs=Xn[0],As=Xn[1],cs=y.useState(0),Jt=(0,ye.Z)(cs,2),Ds=Jt[0],Ls=Jt[1],fs=function(){if(Z&&jt){var Rt=jt.getBoundingClientRect();As(Rt.width),Ls(Rt.height)}},ds=function(){fs(),Lt()},Rs=function(Rt){Tn(!1),Bn(),qe==null||qe(Rt)},Is=function(){return new Promise(function(Rt){fs(),Yn(function(){return Rt})})};(0,g.Z)(function(){mi&&(Bn(),mi(),Yn(null))},[mi]);function ji(gt,Rt,ni,pi){un[gt]=function(oi){var ps;pi==null||pi(oi),Pi(Rt,ni);for(var ks=arguments.length,Jn=new Array(ks>1?ks-1:0),kn=1;kn<ks;kn++)Jn[kn-1]=arguments[kn];(ps=di[gt])===null||ps===void 0||ps.call.apply(ps,[di,oi].concat(Jn))}}(Vi||nn)&&(un.onClick=function(gt){var Rt;Ui.current&&nn?Pi(!1):!Ui.current&&Vi&&(Ri(gt),Pi(!0));for(var ni=arguments.length,pi=new Array(ni>1?ni-1:0),oi=1;oi<ni;oi++)pi[oi-1]=arguments[oi];(Rt=di.onClick)===null||Rt===void 0||Rt.call.apply(Rt,[di,gt].concat(pi))});var Gn=$e(Ti,nn,jt,ii,it,Be,Ts,Pi),fn=Ln.has("hover"),Ii=Fi.has("hover"),dn,Rn;fn&&(ji("onMouseEnter",!0,Ue,function(gt){Ri(gt)}),ji("onPointerEnter",!0,Ue,function(gt){Ri(gt)}),dn=function(Rt){(Ti||Yi)&&ii!==null&&ii!==void 0&&ii.contains(Rt.target)&&Pi(!0,Ue)},Ge&&(un.onMouseMove=function(gt){var Rt;(Rt=di.onMouseMove)===null||Rt===void 0||Rt.call(di,gt)})),Ii&&(ji("onMouseLeave",!1,ht),ji("onPointerLeave",!1,ht),Rn=function(){Pi(!1,ht)}),Ln.has("focus")&&ji("onFocus",!0,et),Fi.has("focus")&&ji("onBlur",!1,_e),Ln.has("contextMenu")&&(un.onContextMenu=function(gt){var Rt;Ui.current&&Fi.has("contextMenu")?Pi(!1):(Ri(gt),Pi(!0)),gt.preventDefault();for(var ni=arguments.length,pi=new Array(ni>1?ni-1:0),oi=1;oi<ni;oi++)pi[oi-1]=arguments[oi];(Rt=di.onContextMenu)===null||Rt===void 0||Rt.call.apply(Rt,[di,gt].concat(pi))}),ci&&(un.className=p()(di.className,ci));var sn=y.useRef(!1);sn.current||(sn.current=vt||Ti||Yi);var pn=(0,N.Z)((0,N.Z)({},di),un),Qn={},In=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];In.forEach(function(gt){Xe[gt]&&(Qn[gt]=function(){for(var Rt,ni=arguments.length,pi=new Array(ni),oi=0;oi<ni;oi++)pi[oi]=arguments[oi];(Rt=pn[gt])===null||Rt===void 0||Rt.call.apply(Rt,[pn].concat(pi)),Xe[gt].apply(Xe,pi)})});var si=y.cloneElement(Ai,(0,N.Z)((0,N.Z)({},pn),Qn)),wi={x:Ss,y:Nn},Kn=ct?(0,N.Z)({},ct!==!0?ct:{}):null;return y.createElement(y.Fragment,null,y.createElement(ge.Z,{disabled:!Ti,ref:Bi,onResize:ds},y.createElement(W,{getTriggerDOMNode:ai},si)),sn.current&&y.createElement(fe.Provider,{value:ti},y.createElement(J,{portal:de,ref:Vt,prefixCls:Ve,popup:Bt,className:p()(Et,us),style:ei,target:jt,onMouseEnter:dn,onMouseLeave:Rn,onPointerEnter:dn,zIndex:$,open:Ti,keepDom:Yi,fresh:re,onClick:ze,onPointerDownCapture:Gn,mask:it,motion:Ji,maskMotion:rs,onVisibleChanged:Rs,onPrepare:Is,forceRender:vt,autoDestroy:Ye,getPopupContainer:At,align:cn,arrow:Kn,arrowPos:wi,ready:wn,offsetX:os,offsetY:ws,offsetR:Sn,offsetB:ls,onAlign:Lt,stretch:Z,targetWidth:hs/qn,targetHeight:Ds/An})))});return Ee}var wt=Oe(oe.Z)},58109:function(){"use strict"},73327:function(){"use strict"},57884:function(Dt,Ze,ee){"use strict";var N=ee(59301),ye=ee(93314),Ne=ee(99571),oe=Object.defineProperty,V=Object.defineProperties,p=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,z=(y,b,O)=>b in y?oe(y,b,{enumerable:!0,configurable:!0,writable:!0,value:O}):y[b]=O,D=(y,b)=>{for(var O in b||(b={}))ne.call(b,O)&&z(y,O,b[O]);if(ge)for(var O of ge(b))l.call(b,O)&&z(y,O,b[O]);return y},g=(y,b)=>V(y,p(b));const x=({img:y,buttonProps:b={},styles:O={},customText:P,ButtonText:F,ButtonClick:S,Buttonclass:L,ButtonTwo:j,imgStyles:K,loading:J=!1,className:ie=""})=>N.createElement("section",{className:`tc animated fadeIn ${ie}`,style:D({color:"#999",margin:"100px auto",visibility:J?"hidden":"visible"},O)},N.createElement("img",{src:y||ye,style:g(D({},K),{pointerEvents:"none",userSelect:"none"})}),N.createElement("p",{className:"mt20 font14"},P||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),F&&N.createElement(Ne.ZP,D({className:L,onClick:S},b),F),j&&j);Ze.Z=x},41550:function(Dt,Ze,ee){"use strict";ee.d(Ze,{Z:function(){return L}});var N=ee(59301),ye={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},Ne=ee(99571),oe=ee(70557),V=ee(51124),p=ee(25399),ge=ee(49661),ne=ee(72664),l=ee(57884),z=ee(90524),D=ee(14794),g=ee(59301),x=Object.defineProperty,y=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,P=(j,K,J)=>K in j?x(j,K,{enumerable:!0,configurable:!0,writable:!0,value:J}):j[K]=J,F=(j,K)=>{for(var J in K||(K={}))b.call(K,J)&&P(j,J,K[J]);if(y)for(var J of y(K))O.call(K,J)&&P(j,J,K[J]);return j},S=(j,K,J)=>new Promise((ie,W)=>{var te=Pe=>{try{me(J.next(Pe))}catch(M){W(M)}},fe=Pe=>{try{me(J.throw(Pe))}catch(M){W(M)}},me=Pe=>Pe.done?ie(Pe.value):Promise.resolve(Pe.value).then(te,fe);me((J=J.apply(j,K)).next())}),L=({editOffice:j="view",data:K,issaver:J,onSaver:ie,theme:W,type:te,filename:fe,monacoEditor:me,className:Pe,style:M,close:A,onClose:C,hasMask:U,disabledDownload:Y,onImgDimensions:B,showNodata:E,recordInfo:_})=>{const[R,q]=(0,N.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Te,Re]=(0,N.useState)(""),[Je,He]=(0,N.useState)(),yt=window.ENV==="build"?"/react/build":"",tt=location.host.startsWith("localhost")?z.Z.PROXY_SERVER:z.Z.API_SERVER,Mt=10*(1024*1024),$e=(0,N.useRef)();K!=null&&K.startsWith("/api")&&te!=="txt"&&(K=z.Z.API_SERVER+K);const pt=Q=>Q.substring(Q.lastIndexOf("/")+1).split(".").pop();fe&&me&&(me.filename=fe),(0,N.useEffect)(()=>{var Q,Le;const Ce=(Le=(Q=document.cookie)==null?void 0:Q.replace(/\s/g,""))==null?void 0:Le.split(";");Ce==null||Ce.map(Ve=>{let G=Ve.split("=");G[0]==="_educoder_session"&&Re(G[1])})},[]),(0,N.useEffect)(()=>{te==="office"&&(K.indexOf("bigfilescdn.")>-1||K.indexOf("bigfiles1")>-1?He({url:K,fileType:pt(K),model:K.indexOf("model=edit")?"edit":"view"}):wt())},[te,K]);function Oe(Q){return S(this,null,function*(){Q.data.type==="pdfdata"&&(ie(Q.data.data),window.removeEventListener("message",Oe,!1)),console.log("mess---:",Q.data)})}const wt=()=>S(void 0,null,function*(){console.log("data:",K);let Q=K;K.startsWith("http")||(Q=location.origin+Q);let Le=new URL(Q).pathname.split("/").pop();const Ce=yield(0,ne.gJ)({attachment_id:Le});Ce.url=tt+Ce.url,He(Ce)}),de=()=>{if(K.startsWith("http")||K.startsWith("blob:")){Ee();return}(0,ge.Sv)(fe||"educoder",K,fe)},Ee=()=>{_&&(0,D.fc)({id:_==null?void 0:_.id,watch_type:1,course_id:_==null?void 0:_.course_id}),(0,ge.Nd)(fe||"educoder",decodeURIComponent(K))};return g.createElement("div",{style:F({},M||{}),className:`${U&&ye.bgBlack} ${te?ye.wrp:"hide"}`},A&&g.createElement("div",{className:ye.close,ref:$e},!!B&&g.createElement(p.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>$e.current},g.createElement("span",{onClick:()=>{C(),B()}},g.createElement("i",{className:"icon-yulanpizhu"}))),!Y&&g.createElement(p.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>$e.current},g.createElement("span",{onClick:Ee},g.createElement("i",{className:"icon-quxiaozhiding"}))),J&&g.createElement(p.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>$e.current},g.createElement("span",{className:"",onClick:()=>{const Q=document.getElementById("pdfiframe");window.addEventListener("message",Oe,!1),setTimeout(()=>{Q.contentWindow.postMessage("getData","*")},300)}},g.createElement("i",{className:"icon-baocun"}))),g.createElement(p.Z,{title:"\u5173\u95ED",getPopupContainer:()=>$e.current},g.createElement("span",{className:"",onClick:()=>{C()}},g.createElement("i",{className:"icon-guanbi1"})))),g.createElement("div",{className:`${ye[Pe]} ${Pe} ${ye.monaco} ${te==="txt"?"show":"hide"}`},te==="txt"&&g.createElement(g.Fragment,null,g.createElement(V.ZP,F({},me)))),te==="audio"&&g.createElement("audio",{src:`${(K==null?void 0:K.indexOf("http://"))>-1||(K==null?void 0:K.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${K}`,autoPlay:!0}),te==="video"&&g.createElement(g.Fragment,null,(K==null?void 0:K.indexOf("http"))>-1?g.createElement("video",{controls:!0,src:`${K}`,autoPlay:!0}):g.createElement("video",{controls:!0,src:`data:video/mp4;base64,${K}`,autoPlay:!0})),te==="office"&&Je&&g.createElement("iframe",{src:`${yt}/office.html?key=${Je.key}&url=${btoa(Je.url)}&callbackUrl=${tt+(Je.callbackUrl||"")}&fileType=${Je.fileType}&title=${Je.title||""}&model=${j}&officeServer=${z.Z.ONLYOFFICE}&disabledDownload=${!!Y}`}),te==="html"&&g.createElement("iframe",{src:K+"&disposition=inline"}),te==="pdf"&&g.createElement("iframe",{id:"pdfiframe",src:`${yt}/js/pdfview/index.html?filename=${fe||"educoder.pdf"}&url=${encodeURIComponent(K)}&disabledDownload=${!!Y}&model=${j}`}),te==="image"&&g.createElement("img",{src:`${(K==null?void 0:K.indexOf("http://"))>-1||(K==null?void 0:K.indexOf("https://"))>-1?"":"data:image/png;base64,"}${K}`}),(te==="other"||te==="download")&&g.createElement(g.Fragment,null,E?g.createElement(l.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:g.createElement(Ne.ZP,{icon:g.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:de,disabled:Y},"\u4E0B\u8F7D")}):g.createElement(Ne.ZP,{type:"primary",size:"middle",onClick:de,disabled:Y},g.createElement(oe.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")),te==="flowChart"&&g.createElement("div",{className:"embed"},g.createElement("iframe",{src:`/drawio/src/main/webapp/viewer.html?id=${K||""}&gapi=0&od=0&db=0&gh=0&gl=0`,width:"100%",height:"100%",frameBorder:"0"})))}},38394:function(Dt,Ze,ee){"use strict";ee.d(Ze,{z:function(){return me},Z:function(){return Pe}});var N=ee(59301),ye=ee(88831),Ne=ee(90290),oe=ee(64018),V=ee(68535),p=ee(90524),ge=ee(49661),ne=ee(15342),l=ee(77736),z=ee(99571),D=ee(1012),g=ee(41550),x=ee(59301),b=({html:M})=>{const A=(0,N.useRef)(null),C=(0,N.useRef)(null),U=`.markdown-body p {
|
|
margin: 0 0 16px 0 !important;
|
|
line-height: 28px;
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
ol,
|
|
ul,
|
|
li {
|
|
list-style-type: none
|
|
}
|
|
|
|
ol,
|
|
ul,
|
|
dl {
|
|
margin-bottom: 0px;
|
|
}
|
|
|
|
.markdown-body {
|
|
-ms-text-size-adjust: 100%;
|
|
-webkit-text-size-adjust: 100%;
|
|
color: #333;
|
|
overflow: hidden;
|
|
font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", "Monaco", monospace, Tahoma, STXihei, "\u534E\u6587\u7EC6\u9ED1", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "\u5B8B\u4F53", Heiti, "\u9ED1\u4F53", sans-serif;
|
|
word-break: break-word;
|
|
font-size: 16px;
|
|
line-height: 1.6;
|
|
white-space: normal;
|
|
word-wrap: break-word;
|
|
position: relative;
|
|
}
|
|
|
|
.markdown-body ul>li {
|
|
list-style-type: disc;
|
|
}
|
|
|
|
.markdown-body ol>li {
|
|
list-style-type: decimal;
|
|
}
|
|
|
|
.markdown-body a {
|
|
background: transparent;
|
|
}
|
|
|
|
.markdown-body a:active,
|
|
.markdown-body a:hover {
|
|
outline: 0;
|
|
}
|
|
|
|
.markdown-body strong {
|
|
font-weight: bold;
|
|
}
|
|
|
|
.markdown-body h1 {
|
|
font-size: 2em;
|
|
margin: 0.67em 0;
|
|
}
|
|
|
|
.markdown-body img {
|
|
border: 0;
|
|
}
|
|
|
|
.markdown-body hr {
|
|
-moz-box-sizing: content-box;
|
|
box-sizing: content-box;
|
|
height: 0;
|
|
}
|
|
|
|
.markdown-body pre {
|
|
overflow: auto;
|
|
}
|
|
|
|
.markdown-body code,
|
|
.markdown-body kbd,
|
|
.markdown-body pre {
|
|
font-family: "Meiryo UI", "YaHei Consolas Hybrid", Consolas, "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace;
|
|
font-size: 1em;
|
|
}
|
|
|
|
.markdown-body input {
|
|
color: inherit;
|
|
font: inherit;
|
|
margin: 0;
|
|
}
|
|
|
|
.markdown-body html input[disabled] {
|
|
cursor: default;
|
|
}
|
|
|
|
.markdown-body input {
|
|
line-height: normal;
|
|
}
|
|
|
|
.markdown-body input[type="checkbox"] {
|
|
-moz-box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
padding: 0;
|
|
}
|
|
|
|
.markdown-body table {
|
|
border-collapse: collapse;
|
|
border-spacing: 0;
|
|
}
|
|
|
|
.markdown-body td,
|
|
.markdown-body th {
|
|
padding: 0;
|
|
}
|
|
|
|
.markdown-body * {
|
|
-moz-box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.markdown-body input {
|
|
font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
|
|
}
|
|
|
|
.markdown-body a {
|
|
color: #4183c4;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.markdown-body a:hover,
|
|
.markdown-body a:active {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.markdown-body hr {
|
|
height: 0;
|
|
margin: 15px 0;
|
|
overflow: hidden;
|
|
background: transparent;
|
|
border: 0;
|
|
border-bottom: 1px solid #ddd;
|
|
}
|
|
|
|
.markdown-body hr:before {
|
|
display: table;
|
|
content: "";
|
|
}
|
|
|
|
.markdown-body hr:after {
|
|
display: table;
|
|
clear: both;
|
|
content: "";
|
|
}
|
|
|
|
.markdown-body h1,
|
|
.markdown-body h2,
|
|
.markdown-body h3,
|
|
.markdown-body h4,
|
|
.markdown-body h5,
|
|
.markdown-body h6 {
|
|
margin-top: 15px;
|
|
margin-bottom: 15px;
|
|
line-height: 1.1;
|
|
}
|
|
|
|
.markdown-body h1 {
|
|
font-size: 30px;
|
|
}
|
|
|
|
.markdown-body h2 {
|
|
font-size: 21px;
|
|
}
|
|
|
|
.markdown-body h3 {
|
|
font-size: 16px;
|
|
}
|
|
|
|
.markdown-body h4 {
|
|
font-size: 14px;
|
|
}
|
|
|
|
.markdown-body h5 {
|
|
font-size: 12px;
|
|
}
|
|
|
|
.markdown-body h6 {
|
|
font-size: 11px;
|
|
}
|
|
|
|
.markdown-body blockquote {
|
|
margin: 0;
|
|
}
|
|
|
|
.markdown-body ul,
|
|
.markdown-body ol {
|
|
padding: 0;
|
|
margin-top: 0;
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
ul.linenums,
|
|
ol.linenums {
|
|
padding: 16px 0 0 56px !important;
|
|
}
|
|
|
|
.markdown-body ul,
|
|
.markdown-body ol {
|
|
padding-left: 2em;
|
|
}
|
|
|
|
|
|
.markdown-body ol ol,
|
|
.markdown-body ul ol {
|
|
list-style-type: lower-roman;
|
|
}
|
|
|
|
.markdown-body ul ul ol,
|
|
.markdown-body ul ol ol,
|
|
.markdown-body ol ul ol,
|
|
.markdown-body ol ol ol {
|
|
list-style-type: lower-alpha;
|
|
}
|
|
|
|
.markdown-body dd {
|
|
margin-left: 0;
|
|
}
|
|
|
|
.markdown-body code {
|
|
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.markdown-body pre {
|
|
margin-top: 0;
|
|
margin-bottom: 0;
|
|
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
}
|
|
|
|
.markdown-body .octicon {
|
|
font: normal normal 16px octicons-anchor;
|
|
line-height: 1;
|
|
display: inline-block;
|
|
text-decoration: none;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
-webkit-user-select: none;
|
|
-moz-user-select: none;
|
|
-ms-user-select: none;
|
|
user-select: none;
|
|
}
|
|
|
|
.markdown-body .octicon-link:before {
|
|
content: '\f05c';
|
|
}
|
|
|
|
.markdown-body>*:first-child {
|
|
margin-top: 0 !important;
|
|
}
|
|
|
|
.markdown-body>*:last-child {
|
|
margin-bottom: 0 !important;
|
|
}
|
|
|
|
.markdown-body .anchor {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
display: block;
|
|
padding-right: 6px;
|
|
padding-left: 30px;
|
|
margin-left: -30px;
|
|
}
|
|
|
|
.markdown-body .anchor:focus {
|
|
outline: none;
|
|
}
|
|
|
|
.markdown-body h1,
|
|
.markdown-body h2,
|
|
.markdown-body h3,
|
|
.markdown-body h4,
|
|
.markdown-body h5,
|
|
.markdown-body h6 {
|
|
position: relative;
|
|
margin-top: 1em;
|
|
margin-bottom: 16px;
|
|
font-weight: bold;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.markdown-body h1 .octicon-link,
|
|
.markdown-body h2 .octicon-link,
|
|
.markdown-body h3 .octicon-link,
|
|
.markdown-body h4 .octicon-link,
|
|
.markdown-body h5 .octicon-link,
|
|
.markdown-body h6 .octicon-link {
|
|
display: none;
|
|
color: #000;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.markdown-body h1:hover .anchor,
|
|
.markdown-body h2:hover .anchor,
|
|
.markdown-body h3:hover .anchor,
|
|
.markdown-body h4:hover .anchor,
|
|
.markdown-body h5:hover .anchor,
|
|
.markdown-body h6:hover .anchor {
|
|
padding-left: 8px;
|
|
margin-left: -30px;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.markdown-body h1:hover .anchor .octicon-link,
|
|
.markdown-body h2:hover .anchor .octicon-link,
|
|
.markdown-body h3:hover .anchor .octicon-link,
|
|
.markdown-body h4:hover .anchor .octicon-link,
|
|
.markdown-body h5:hover .anchor .octicon-link,
|
|
.markdown-body h6:hover .anchor .octicon-link {
|
|
display: inline-block;
|
|
}
|
|
|
|
.markdown-body h1 {
|
|
padding-bottom: 0.3em;
|
|
font-size: 2.25em;
|
|
line-height: 1.2;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.markdown-body h1 .anchor {
|
|
line-height: 1;
|
|
}
|
|
|
|
.markdown-body h2 {
|
|
padding-bottom: 0.3em;
|
|
font-size: 1.75em;
|
|
line-height: 1.225;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.markdown-body h2 .anchor {
|
|
line-height: 1;
|
|
}
|
|
|
|
.markdown-body h3 {
|
|
font-size: 1.5em;
|
|
line-height: 1.43;
|
|
}
|
|
|
|
.markdown-body h3 .anchor {
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.markdown-body h4 {
|
|
font-size: 1.25em;
|
|
}
|
|
|
|
.markdown-body h4 .anchor {
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.markdown-body h5 {
|
|
font-size: 1em;
|
|
}
|
|
|
|
.markdown-body h5 .anchor {
|
|
line-height: 1.1;
|
|
}
|
|
|
|
.markdown-body h6 {
|
|
font-size: 1em;
|
|
color: #777;
|
|
}
|
|
|
|
.markdown-body h6 .anchor {
|
|
line-height: 1.1;
|
|
}
|
|
|
|
.markdown-body p,
|
|
.markdown-body blockquote,
|
|
.markdown-body ul,
|
|
.markdown-body ol,
|
|
.markdown-body dl,
|
|
.markdown-body table,
|
|
.markdown-body pre {
|
|
margin-top: 0;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.markdown-body ul ul,
|
|
.markdown-body ul ol,
|
|
.markdown-body ol ol,
|
|
.markdown-body ol ul {
|
|
margin-top: 0;
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.markdown-body li>p {
|
|
margin-top: 16px;
|
|
}
|
|
|
|
.markdown-body dl {
|
|
padding: 0;
|
|
}
|
|
|
|
.markdown-body dl dt {
|
|
padding: 0;
|
|
margin-top: 16px;
|
|
font-size: 1em;
|
|
font-style: italic;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.markdown-body dl dd {
|
|
padding: 0 16px;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.markdown-body blockquote {
|
|
padding: 0 15px;
|
|
color: #777;
|
|
border-left: 4px solid #ddd;
|
|
}
|
|
|
|
.markdown-body blockquote> :first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.markdown-body blockquote> :last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.markdown-body table {
|
|
display: block;
|
|
width: 100%;
|
|
overflow: auto;
|
|
word-break: normal;
|
|
word-break: keep-all;
|
|
}
|
|
|
|
.markdown-body table th {
|
|
font-weight: bold;
|
|
text-align: revert;
|
|
}
|
|
|
|
.markdown-body table th,
|
|
.markdown-body table td {
|
|
padding: 6px 13px;
|
|
border: 1px solid #ddd;
|
|
}
|
|
|
|
.markdown-body table tr {
|
|
background-color: #fff;
|
|
border-top: 1px solid #ccc;
|
|
}
|
|
|
|
.markdown-body table tr:nth-child(2n) {
|
|
background-color: #f8f8f8;
|
|
}
|
|
|
|
.markdown-body img {
|
|
max-width: 100%;
|
|
-moz-box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.markdown-body code {
|
|
padding: 0;
|
|
padding-top: 0.2em;
|
|
padding-bottom: 0.2em;
|
|
margin: 0;
|
|
font-size: 85%;
|
|
background-color: rgba(0, 0, 0, 0.04);
|
|
border-radius: 3px;
|
|
}
|
|
|
|
.markdown-body code:has(.katex) {
|
|
background-color: transparent;
|
|
}
|
|
|
|
.markdown-body code:before,
|
|
.markdown-body code:after {
|
|
letter-spacing: -0.2em;
|
|
content: "\\00a0";
|
|
}
|
|
|
|
.markdown-body pre>code {
|
|
padding: 0;
|
|
margin: 0;
|
|
font-size: 100%;
|
|
word-break: normal;
|
|
white-space: pre;
|
|
background: transparent;
|
|
border: 0;
|
|
}
|
|
|
|
.markdown-body .highlight {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.markdown-body .highlight pre,
|
|
.markdown-body pre {
|
|
padding: 16px;
|
|
overflow: auto;
|
|
font-size: 85%;
|
|
line-height: 1.45;
|
|
background-color: #f7f7f7;
|
|
border-radius: 3px;
|
|
}
|
|
|
|
.markdown-body .highlight pre {
|
|
margin-bottom: 0;
|
|
word-break: normal;
|
|
}
|
|
|
|
.markdown-body pre {
|
|
word-wrap: normal;
|
|
}
|
|
|
|
.markdown-body pre code {
|
|
display: inline;
|
|
max-width: initial;
|
|
padding: 0;
|
|
margin: 0;
|
|
overflow: initial;
|
|
line-height: inherit;
|
|
word-wrap: normal;
|
|
background-color: transparent;
|
|
border: 0;
|
|
}
|
|
|
|
.markdown-body pre code:before,
|
|
.markdown-body pre code:after {
|
|
content: normal;
|
|
}
|
|
|
|
.markdown-body kbd {
|
|
display: inline-block;
|
|
padding: 3px 5px;
|
|
font-size: 11px;
|
|
line-height: 10px;
|
|
color: #555;
|
|
vertical-align: middle;
|
|
background-color: #fcfcfc;
|
|
border: solid 1px #ccc;
|
|
border-bottom-color: #bbb;
|
|
border-radius: 3px;
|
|
box-shadow: inset 0 -1px 0 #bbb;
|
|
}
|
|
|
|
.markdown-body .pl-c {
|
|
color: #969896;
|
|
}
|
|
|
|
.markdown-body .pl-c1,
|
|
.markdown-body .pl-mdh,
|
|
.markdown-body .pl-mm,
|
|
.markdown-body .pl-mp,
|
|
.markdown-body .pl-mr,
|
|
.markdown-body .pl-s1 .pl-v,
|
|
.markdown-body .pl-s3,
|
|
.markdown-body .pl-sc,
|
|
.markdown-body .pl-sv {
|
|
color: #0086b3;
|
|
}
|
|
|
|
.markdown-body .pl-e,
|
|
.markdown-body .pl-en {
|
|
color: #795da3;
|
|
}
|
|
|
|
.markdown-body .pl-s1 .pl-s2,
|
|
.markdown-body .pl-smi,
|
|
.markdown-body .pl-smp,
|
|
.markdown-body .pl-stj,
|
|
.markdown-body .pl-vo,
|
|
.markdown-body .pl-vpf {
|
|
color: #333;
|
|
}
|
|
|
|
.markdown-body .pl-ent {
|
|
color: #63a35c;
|
|
}
|
|
|
|
.markdown-body .pl-k,
|
|
.markdown-body .pl-s,
|
|
.markdown-body .pl-st {
|
|
color: #a71d5d;
|
|
}
|
|
|
|
.markdown-body .pl-pds,
|
|
.markdown-body .pl-s1,
|
|
.markdown-body .pl-s1 .pl-pse .pl-s2,
|
|
.markdown-body .pl-sr,
|
|
.markdown-body .pl-sr .pl-cce,
|
|
.markdown-body .pl-sr .pl-sra,
|
|
.markdown-body .pl-sr .pl-sre,
|
|
.markdown-body .pl-src {
|
|
color: #df5000;
|
|
}
|
|
|
|
.markdown-body .pl-mo,
|
|
.markdown-body .pl-v {
|
|
color: #1d3e81;
|
|
}
|
|
|
|
.markdown-body .pl-id {
|
|
color: #b52a1d;
|
|
}
|
|
|
|
.markdown-body .pl-ii {
|
|
background-color: #b52a1d;
|
|
color: #f8f8f8;
|
|
}
|
|
|
|
.markdown-body .pl-sr .pl-cce {
|
|
color: #63a35c;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.markdown-body .pl-ml {
|
|
color: #693a17;
|
|
}
|
|
|
|
.markdown-body .pl-mh,
|
|
.markdown-body .pl-mh .pl-en,
|
|
.markdown-body .pl-ms {
|
|
color: #1d3e81;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.markdown-body .pl-mq {
|
|
color: #008080;
|
|
}
|
|
|
|
.markdown-body .pl-mi {
|
|
color: #333;
|
|
font-style: italic;
|
|
}
|
|
|
|
.markdown-body .pl-mb {
|
|
color: #333;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.markdown-body .pl-md,
|
|
.markdown-body .pl-mdhf {
|
|
background-color: #ffecec;
|
|
color: #bd2c00;
|
|
}
|
|
|
|
.markdown-body .pl-mdht,
|
|
.markdown-body .pl-mi1 {
|
|
background-color: #eaffea;
|
|
color: #55a532;
|
|
}
|
|
|
|
.markdown-body .pl-mdr {
|
|
color: #795da3;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.markdown-body kbd {
|
|
display: inline-block;
|
|
padding: 3px 5px;
|
|
font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
line-height: 10px;
|
|
color: #555;
|
|
vertical-align: middle;
|
|
background-color: #fcfcfc;
|
|
border: solid 1px #ccc;
|
|
border-bottom-color: #bbb;
|
|
border-radius: 3px;
|
|
box-shadow: inset 0 -1px 0 #bbb;
|
|
}
|
|
|
|
.markdown-body .task-list-item {
|
|
list-style-type: none;
|
|
}
|
|
|
|
.markdown-body .task-list-item+.task-list-item {
|
|
margin-top: 3px;
|
|
}
|
|
|
|
.markdown-body .task-list-item input {
|
|
float: left;
|
|
margin: 0.3em 0 0.25em -1.6em;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.markdown-body :checked+.radio-label {
|
|
z-index: 1;
|
|
position: relative;
|
|
border-color: #4183c4;
|
|
}
|
|
|
|
|
|
/*! Pretty printing styles. Used with prettify.js. */
|
|
/* SPAN elements with the classes below are added by prettyprint. */
|
|
.pln {
|
|
color: #000
|
|
}
|
|
|
|
/* plain text */
|
|
|
|
@media screen {
|
|
.str {
|
|
color: #080
|
|
}
|
|
|
|
/* string content */
|
|
.kwd {
|
|
color: #008
|
|
}
|
|
|
|
/* a keyword */
|
|
.com {
|
|
color: #800
|
|
}
|
|
|
|
/* a comment */
|
|
.typ {
|
|
color: #606
|
|
}
|
|
|
|
/* a type name */
|
|
.lit {
|
|
color: #066
|
|
}
|
|
|
|
/* a literal value */
|
|
/* punctuation, lisp open bracket, lisp close bracket */
|
|
.pun,
|
|
.opn,
|
|
.clo {
|
|
color: #660
|
|
}
|
|
|
|
.tag {
|
|
color: #008
|
|
}
|
|
|
|
/* a markup tag name */
|
|
.atn {
|
|
color: #606
|
|
}
|
|
|
|
/* a markup attribute name */
|
|
.atv {
|
|
color: #080
|
|
}
|
|
|
|
/* a markup attribute value */
|
|
.dec,
|
|
.var {
|
|
color: #606
|
|
}
|
|
|
|
/* a declaration; a variable name */
|
|
.fun {
|
|
color: red
|
|
}
|
|
|
|
/* a function name */
|
|
}
|
|
|
|
/* Use higher contrast and text-weight for printable form. */
|
|
@media print,
|
|
projection {
|
|
.str {
|
|
color: #060
|
|
}
|
|
|
|
.kwd {
|
|
color: #006;
|
|
font-weight: bold
|
|
}
|
|
|
|
.com {
|
|
color: #600;
|
|
font-style: italic
|
|
}
|
|
|
|
.typ {
|
|
color: #404;
|
|
font-weight: bold
|
|
}
|
|
|
|
.lit {
|
|
color: #044
|
|
}
|
|
|
|
.pun,
|
|
.opn,
|
|
.clo {
|
|
color: #440
|
|
}
|
|
|
|
.tag {
|
|
color: #006;
|
|
font-weight: bold
|
|
}
|
|
|
|
.atn {
|
|
color: #404
|
|
}
|
|
|
|
.atv {
|
|
color: #060
|
|
}
|
|
}
|
|
|
|
/* Put a border around prettyprinted code snippets. */
|
|
pre.prettyprint {
|
|
padding: 2px;
|
|
/* border: 1px solid #888 */
|
|
}
|
|
|
|
/* Specify class=linenums on a pre to get line numbering */
|
|
ol.linenums {
|
|
margin-top: 0;
|
|
margin-bottom: 0
|
|
}
|
|
|
|
/* IE indents via margin-left */
|
|
li.L0,
|
|
li.L1,
|
|
li.L2,
|
|
li.L3,
|
|
li.L5,
|
|
li.L6,
|
|
li.L7,
|
|
li.L8 {
|
|
list-style-type: none
|
|
}
|
|
|
|
/* Alternate shading for lines */
|
|
li.L1,
|
|
li.L3,
|
|
li.L5,
|
|
li.L7,
|
|
li.L9 {
|
|
background: #eee
|
|
}
|
|
|
|
.markdown-body p,
|
|
.markdown-body blockquote,
|
|
.markdown-body ul,
|
|
.markdown-body ol,
|
|
.markdown-body dl,
|
|
.markdown-body table,
|
|
.markdown-body pre {
|
|
margin-top: 0;
|
|
margin-bottom: 16px;
|
|
}`;return(0,N.useEffect)(()=>{const Y=A.current.attachShadow({mode:"open"});C.current=document.createElement("div"),C.current.className="markdown-body",C.current.innerHTML=M,Y.appendChild(C.current);const B=document.createElement("style");return B.textContent=U,Y.appendChild(B),()=>{Y.innerHTML=""}},[]),(0,N.useEffect)(()=>{C.current&&(C.current.innerHTML=M)},[M]),x.createElement("div",{ref:A})};function O(M){const A=["onabort","onanimationend","onanimationiteration","onanimationstart","onauxclick","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncopy","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitionend","onvolumechange","onwaiting","onwheel"],C=new RegExp(`\\b(${A.join("|")})\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]*)`,"gi");return M.replace(C,"").trim()}var P={mdBody:"mdBody___raKXb",button:"button___Ch5Pc",previewFlowChart:"previewFlowChart___vY1dq"},F=Object.defineProperty,S=Object.getOwnPropertySymbols,L=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,K=(M,A,C)=>A in M?F(M,A,{enumerable:!0,configurable:!0,writable:!0,value:C}):M[A]=C,J=(M,A)=>{for(var C in A||(A={}))L.call(A,C)&&K(M,C,A[C]);if(S)for(var C of S(A))j.call(A,C)&&K(M,C,A[C]);return M};const ie="@\u2581\u2581@",W="@\u2581@",te=/<pre[^>]*>/g;function fe(M){let A=document.createElement("div");return A.innerHTML=M,A.childNodes.length===0?"":A.childNodes[0].nodeValue}const me=(M,A)=>{M=M||"";const C=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,U=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,Y=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,B=/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return A?M.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(C,(E,_,R,q,Te,Re,Je)=>{const He=_||q||Re,yt=R||Te||Je||"?";return p.Z.API_SERVER+"/api/attachments/"+He+yt+"&t="+(0,ge.Jn)(He,Date.now())+(E.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(M=M.replace(B,(E,_,R,q,Te,Re,Je)=>{const He=_||q||Re,yt=R||Te||Je||"?";return p.Z.API_SERVER+"/attachments/download/"+He+yt+"&t="+(0,ge.Jn)(He,Date.now())+(E.indexOf(")")>-1?")":"&")}).replace(C,(E,_,R,q,Te,Re,Je)=>{const He=_||q||Re,yt=R||Te||Je||"?";return p.Z.API_SERVER+"/api/attachments/"+He+yt+"&t="+(0,ge.Jn)(He,Date.now())+(E.indexOf(")")>-1?")":"&")}).replace(U,(E,_,R,q,Te)=>{const Re=_||q,Je=R||Te||"";return'"'+p.Z.API_SERVER+"/api/attachments/"+Re+Je+Re+Je+"&t="+(0,ge.Jn)(Re,Date.now())}).replace(Y,(E,_,R,q,Te)=>{const Re=_||q,Je=R||Te||"";return"("+p.Z.API_SERVER+"/files/uploads/"+Re+Je+Re+Je+"&t="+(0,ge.Jn)(Re,Date.now())}).replaceAll('src="(','src="').replaceAll("src='(",'src="').replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`),M)};var Pe=({value:M="",edit:A=!1,className:C,showTextOnly:U,showLines:Y,style:B={},stylesPrev:E={},highlightKeywords:_,showProgramFill:R,isProgramFill:q,disabledFill:Te=!1,programFillValue:Re,openEditor:Je=()=>{},onFillChange:He=Ke=>{},onFillBlur:yt=()=>{},onFillFocus:tt=()=>{}})=>{let Ke=O(String(M||""));const Mt=(0,N.useRef)(),$e=(0,N.useRef)(),[pt,Oe]=(0,N.useState)(""),[wt,de]=(0,N.useState)("office"),[Ee,Q]=(0,N.useState)([]),Le=(0,N.useRef)("a"+(0,D.Z)()),Ce={},Ve=_e=>/<style[\s\S]*?>/i.test(_e||""),G=(_e,it,We)=>{const Be=document.createElement(_e===W?"input":"textarea");Be.style.width="100%",Be.style.height=_e===W?"40px":"151px",Be.rows=5,Be.spellcheck=!1,Be.name="edu-program-fill",Be.placeholder="\u8BF7\u8F93\u5165",Be.dataset.id=it;const At=Object.keys(Ce).length;return Ce[At]=Be,`<span class="edu-program-fill-wrap ${_e===W?"":"show"}" style="width:${_e===W?"600px":"100%"}" title=${We||""}><span>${Be.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function ae(_e){return _e=_e.replace(/!\[.*?\]\(.*?\)/g,""),_e=_e.replace(/\[.*?\]\(.*?\)/g,""),_e=_e.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),_e=_e.replace(/<embed.*?>/g,""),_e=_e.replace(/<img.*?>/g,""),_e=_e.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),_e=_e.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),_e=_e.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),_e=_e.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),_e}const we=_e=>!U&&Ve(Ke)?_e:_e.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(it,We){let Be=We.replace(/(\n|\r)/g,"").split("}"),At=[];return Be.map(vt=>{vt!=""&&At.push(`.${Le.current} ${vt}`)}),`<style>${At.join("}")}</style>`}),De=(0,N.useMemo)(()=>{try{const Be=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,At=/\"\/api\/attachments\/|\"\/attachments\/download\//g,vt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,nt=/\(\/attachments\/download\//g;Ke=Ke.replace(nt,"("+p.Z.API_SERVER+"/attachments/download/").replace(Be,"("+p.Z.API_SERVER+"/api/attachments/").replace(At,'"'+p.Z.API_SERVER+"/api/attachments/").replace(vt,'"'+p.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`),Mt.current.style.display="none"}catch(Be){}if(R){let Be=-1;return Ke=Ke.replaceAll("<","<").replaceAll(">",">").replace(/(@▁▁@|@▁@)/g,function(At,vt,nt){var It;return++Be,G(At,Be,(It=Re==null?void 0:Re[Be])==null?void 0:It.value.replaceAll("<","<").replaceAll(">",">"))}),`<pre style="background:#fff;padding:4px">${we(Ke||"")}</pre>`}let _e=we(Ke);_e=(0,Ne.ZP)(_e);const it=(0,Ne.ez)();Ke.match(/\[TOC\]/)&&(_e=_e.replace("<p>[TOC]</p>",(0,Ne.Qv)()),(0,Ne.Iy)()),_e=_e.replace(/(__special_katext_id_\d+__)/g,(Be,At)=>{const{type:vt,expression:nt}=it[At];return(0,ne.renderToString)(fe(nt)||"",{displayMode:vt==="block",throwOnError:!1,output:"html"})}),_e=_e.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,Ne.AL)();const We=document.createElement("div");if(We.innerHTML=_e,U)return We.innerText;if(_){const Be=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return Qe(We,Be),We.innerHTML}return setTimeout(()=>dt(),500),We.innerHTML},[Ke,_]);(0,N.useEffect)(()=>{qe.current&&qe.current.querySelectorAll(["input","textarea"]).forEach(it=>{it.oninput=ke,it.onblur=je,it.onfocus=ut})},[Ee]),(0,N.useEffect)(()=>{var _e,it,We,Be,At;if(Re!=null&&Re.length)try{const vt=qe.current.querySelectorAll(".edu-program-fill-score"),nt=qe.current.querySelectorAll('[name="edu-program-fill"]');for(const[It,Bt]of nt.entries())Bt.value=((_e=Re==null?void 0:Re[It])==null?void 0:_e.value)||"",((it=Re==null?void 0:Re[It])==null?void 0:it.type)==="warning"?Bt.className="program-fill-warning":((We=Re==null?void 0:Re[It])==null?void 0:We.type)==="success"?Bt.className="program-fill-success":Bt.className="";for(const[It,Bt]of vt.entries())Bt.innerHTML=(Be=Re==null?void 0:Re[It])!=null&&Be.score?`${(At=Re==null?void 0:Re[It])==null?void 0:At.score}\u5206`:"";Q(Re)}catch(vt){console.log(vt,"error")}},[Re]);const ke=_e=>{Ee[_e.target.dataset.id]=Ee[_e.target.dataset.id]||{},Ee[_e.target.dataset.id].value=_e.target.value,Q([...Ee]),He(Ee,_e.target.dataset.id)},je=_e=>{Ee[_e.target.dataset.id]=Ee[_e.target.dataset.id]||{},Ee[_e.target.dataset.id].value=_e.target.value,Q([...Ee]),yt(Ee,_e.target.dataset.id)},ut=_e=>{Ee[_e.target.dataset.id]=Ee[_e.target.dataset.id]||{},Ee[_e.target.dataset.id].value=_e.target.value,Q([...Ee]),tt(Ee,_e.target.dataset.id)};function Qe(_e,it){return _e.childNodes.forEach(We=>{var Be;if(We.childNodes.length>0)Qe(We,it);else if(We.nodeName!=="IMG")if(We.innerHTML)We.innerHTML=(Be=We.innerHTML)==null?void 0:Be.replace(new RegExp(it,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const At=document.createElement("span");At.innerHTML=We.textContent.replace(new RegExp(it,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),We.replaceWith(At)}})}const qe=(0,N.useRef)();Ne.jb.WebkitLineClamp=Y,Y&&(B=J(J({},B),Ne.jb));function Ue(_e){let it=_e.target;if(it.tagName.toUpperCase()==="A"){let We=it.getAttribute("href");if(We.indexOf("office")>-1)_e.preventDefault(),Oe(We),de("office");else if(We.indexOf("application/pdf")>-1)_e.preventDefault(),Oe(We),de("pdf");else if(We.indexOf("text/html")>-1)_e.preventDefault(),Oe(We),de("html");else if(We.startsWith("#")){_e.preventDefault();let Be=document.getElementById(We.replace("#",""));Be&&Be.scrollIntoView(!0)}}}const dt=()=>{var _e;const it=(_e=qe.current)==null?void 0:_e.querySelectorAll("video");it==null||it.forEach(We=>{if(We.oncontextmenu=()=>!1,We.src.indexOf(".m3u8")>-1&&!We.canPlayType("application/vnd.apple.mpegurl")){if(V.ZP.isSupported()){var Be=new V.ZP;Be.loadSource(We.src),Be.attachMedia(We)}}})};(0,N.useEffect)(()=>{if(qe.current&&De&&De.match(te)&&window.PR.prettyPrint(),qe.current)return qe.current.addEventListener("click",Ue),()=>{var _e;(_e=qe.current)==null||_e.removeEventListener("click",Ue),(0,Ne.AL)(),(0,Ne.Iy)()}},[De,qe.current,Ue]);const ht=_e=>{_e.target.nodeName==="IMG"&&_e.target.className.indexOf("draw-flowchart")>-1?(Mt.current.style.zIndex=1,Mt.current.style.display="flex",Mt.current.style.width=_e.target.clientWidth+"px",Mt.current.style.height=_e.target.clientHeight+"px",Mt.current.style.top=_e.target.offsetTop+"px",Mt.current.style.left=_e.target.offsetLeft+"px",_e.target.id&&($e.current=_e.target.id)):Mt.current.style.display="none"},et=()=>{Mt.current.style.display="none"};return(0,N.useEffect)(()=>{var _e;const it=We=>{We.preventDefault(),We.clipboardData.setData("text",window.getSelection().toString())};return(_e=qe.current)==null||_e.addEventListener("copy",it),()=>{var We;(We=qe.current)==null||We.removeEventListener("copy",it)}},[qe.current]),N.createElement("div",{style:{position:"relative"},onMouseLeave:et},U&&N.createElement("div",{ref:qe,className:`${P.mdBody} `},De),!U&&!Ve(De)&&N.createElement("div",{ref:qe,style:J({},B),onMouseOver:ht,className:`${C||""} ${Te?"disabled-fill":""} markdown-body ${P.mdBody} ${Le.current}`,dangerouslySetInnerHTML:{__html:De}}),!U&&Ve(De)&&N.createElement(b,{html:De}),N.createElement("div",{ref:Mt,className:`${P.button} ${A?"":P.previewFlowChart}`},N.createElement(l.Z,null,N.createElement(z.ZP,{onClick:()=>{A?Je($e.current):(Oe($e.current),de("flowChart"))}},A?"\u7F16\u8F91":"\u9884\u89C8"))),N.createElement(g.Z,{close:!0,data:pt,type:pt!=null&&pt.length?wt:"",style:J({},E),onClose:()=>Oe("")}))}},51124:function(Dt,Ze,ee){"use strict";ee.d(Ze,{SV:function(){return Mt},ZP:function(){return Ke}});var N=ee(59301),ye=ee(76374);const Ne={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},oe={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},V={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"if",content:["if () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
|
|
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
|
|
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
|
|
`)},{label:"include <map>",content:["#include <map>"].join(`
|
|
`)},{label:"include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},p={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},ge={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],quickKey:[{label:"println",content:["println($0)"].join(`
|
|
`)}]};var ne=ee(53184),l=ee.n(ne),z=($e,pt,Oe)=>new Promise((wt,de)=>{var Ee=Ce=>{try{Le(Oe.next(Ce))}catch(Ve){de(Ve)}},Q=Ce=>{try{Le(Oe.throw(Ce))}catch(Ve){de(Ve)}},Le=Ce=>Ce.done?wt(Ce.value):Promise.resolve(Ce.value).then(Ee,Q);Le((Oe=Oe.apply($e,pt)).next())});const D={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},g=($e,pt,Oe,wt)=>{const de=pt.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:Oe.lineNumber,endColumn:Oe.column});return Array.from(new Set(de.match(/\b\w{2,}\b/g)||[])).map(Q=>({label:Q,kind:$e.languages.CompletionItemKind.Text,insertText:Q,range:wt}))},x=($e,pt,Oe,wt)=>{$e.languages.registerCompletionItemProvider(pt,{provideCompletionItems(de,Ee){const Q=de.getWordUntilPosition(Ee),Le={startLineNumber:Ee.lineNumber,endLineNumber:Ee.lineNumber,startColumn:Q.startColumn,endColumn:Q.endColumn},Ce=de.getLineContent(Ee.lineNumber).substring(Q.startColumn-2,Q.endColumn);return{suggestions:[...g($e,de,Ee,Le),...Oe.map(G=>({label:G,kind:$e.languages.CompletionItemKind.Keyword,documentation:G,insertText:G,insertTextRules:$e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le})),...wt.map(G=>({label:G.label,kind:$e.languages.CompletionItemKind.Snippet,documentation:G.content,insertText:Ce.startsWith("#")?G.content.replace(/#/,""):G.content,insertTextRules:$e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le}))]}}})};var y=$e=>{D.languages.forEach(pt=>{$e.languages.registerDocumentFormattingEditProvider(pt,{provideDocumentFormattingEdits(Oe){return z(this,null,function*(){const wt=l()(Oe.getValue(),{indent_size:2,indent_char:" ",max_preserve_newlines:2,preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:0,indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1});return[{range:Oe.getFullModelRange(),text:wt}]})}})}),x($e,"java",oe.keywords,oe.quickKey),x($e,"cpp",V.keywords,V.quickKey),x($e,"c",Ne.keywords,[]),x($e,"python",p.keywords,p.quickKey),x($e,"scala",ge.keywords,ge.quickKey)};const b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var O=Object.defineProperty,P=($e,pt,Oe)=>pt in $e?O($e,pt,{enumerable:!0,configurable:!0,writable:!0,value:Oe}):$e[pt]=Oe,F=($e,pt,Oe)=>P($e,typeof pt!="symbol"?pt+"":pt,Oe);const S=class tl{constructor(pt,Oe,wt){this.placeholder=pt,this.editor=Oe,this.monaco=wt,Oe.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return tl.ID}getDomNode(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.style.width="max-content",this.domNode.textContent=this.placeholder,this.domNode.style.fontStyle="initial",this.domNode.style.color="#D7D7D7",this.domNode.style.pointerEvents="none",this.editor.applyFontInfo(this.domNode)),this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[this.monaco.editor.ContentWidgetPositionPreference.EXACT]}}dispose(){this.editor.removeContentWidget(this)}};F(S,"ID","editor.widget.placeholderHint");var j=S,K=ee(96236),J=ee(6767),ie=ee(25399),W=ee(89392),te=ee(33796),fe=ee(56102),me=Object.defineProperty,Pe=Object.defineProperties,M=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,Y=($e,pt,Oe)=>pt in $e?me($e,pt,{enumerable:!0,configurable:!0,writable:!0,value:Oe}):$e[pt]=Oe,B=($e,pt)=>{for(var Oe in pt||(pt={}))C.call(pt,Oe)&&Y($e,Oe,pt[Oe]);if(A)for(var Oe of A(pt))U.call(pt,Oe)&&Y($e,Oe,pt[Oe]);return $e},E=($e,pt)=>Pe($e,M(pt)),_=($e,pt)=>{var Oe={};for(var wt in $e)C.call($e,wt)&&pt.indexOf(wt)<0&&(Oe[wt]=$e[wt]);if($e!=null&&A)for(var wt of A($e))pt.indexOf(wt)<0&&U.call($e,wt)&&(Oe[wt]=$e[wt]);return Oe},R=($e,pt,Oe)=>new Promise((wt,de)=>{var Ee=Ce=>{try{Le(Oe.next(Ce))}catch(Ve){de(Ve)}},Q=Ce=>{try{Le(Oe.throw(Ce))}catch(Ve){de(Ve)}},Le=Ce=>Ce.done?wt(Ce.value):Promise.resolve(Ce.value).then(Ee,Q);Le((Oe=Oe.apply($e,pt)).next())});function q($e){return/^\d+$/.test($e)?`${$e}px`:$e}function Te(){}let Re=!1;const Je={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale",solidity:"sol"};function He($e=[]){let pt=$e;if(Array.isArray($e)){for(let Oe=0;Oe<$e.length;Oe++){let wt=Je[$e[Oe]];if(wt)return wt}return pt[0]}return Je[pt]||pt}let yt=null;const tt=()=>R(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch($e){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",$e)}});var Ke=$e=>{var pt=$e,{width:Oe="100%",height:wt="100%",value:de,language:Ee="javascript",style:Q={},options:Le={},overrideServices:Ce={},theme:Ve="vs-dark",onEditBlur:G,isCopy:ae=!1,onSave:we,autoHeight:De=!1,forbidCopy:ke=!1,onChange:je=Te,editorDidMount:ut=Te,onFocus:Qe=Te,onBreakPoint:qe=Te,breakPointValue:Ue=[],filename:dt="educoder.txt",errorLine:ht,errorContent:et="",highlightLine:_e,openBreakPoint:it=!1,placeholder:We="",showMiniMap:Be=!0}=pt,At=_(pt,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","isCopy","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint","placeholder","showMiniMap"]);const vt=(0,N.useRef)(),nt=(0,N.useRef)({}),It=(0,N.useRef)(),Bt=(0,N.useRef)(),Et=(0,N.useRef)([]),ei=(0,N.useRef)(!1),be=(0,N.useRef)(),le=(0,N.useRef)(),he=(0,N.useRef)(!1),[I,$]=(0,N.useState)(!1);function Z(){let Xe;return vt.current&&(Xe=new ye.Z(Ye=>{for(let Pt of Ye)(Pt.target.offsetHeight>0||Pt.target.offsetWidth>0)&&nt.current.instance.layout()}),Xe.observe(vt.current)),Xe}function se(){J.ZP.warning({content:decodeURIComponent(b),key:"monaco-editor-tip"})}const re=()=>{let Xe=nt.current.instance;if(de!=null&&Xe&&I){const Ye=Xe.getModel();Ye&&de!==Ye.getValue()&&(Re=!0,Ye.setValue(de),Xe.layout(),Re=!1)}};(0,N.useEffect)(()=>{const Xe=te.Z.subscribe("formatDocument",Ye=>{var Pt;let $t=nt.current.instance;(Pt=$t==null?void 0:$t.getAction)==null||Pt.call($t,"editor.action.formatDocument").run()});return window.updateMonacoValue=Ye=>{je(Ye)},Xe},[]),(0,N.useEffect)(()=>{var Xe;let Ye=nt.current.instance;Bt.current&&clearTimeout(Bt.current),Bt.current=setTimeout(()=>{re()},500),de&&(de!=null&&de.length)&&((Xe=Ye==null?void 0:Ye.updateOptions)==null||Xe.call(Ye,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(de.split(/\r\n|\r|\n/g).length))+3,5)}))},[de,I,nt.current]),(0,N.useEffect)(()=>{if(ht&&nt.current&&nt.current.instance){let Ye=nt.current.instance;Ye.changeViewZones(function(Pt){var $t=document.createElement("div");$t.style.padding="10px 20px",$t.style.width="calc(100% - 20px)",$t.className="my-error-line-wrp",$t.innerHTML=et,Pt.addZone({afterLineNumber:ht||11,heightInLines:3,domNode:$t})});var Xe={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ye.addOverlayWidget(Xe),Ye.revealPositionInCenter({lineNumber:20,column:1})}},[ht,nt.current,I]);const Ge=(Xe="",Ye)=>{if(!Xe||Xe.trim()==="")return!0;const $t=nt.current.instance.getModel().getLineTokens(Ye);let Ht=!1;for(let qt=0;qt<2;qt++)$t.getStandardTokenType(qt)===1&&(Ht=!0);return Ht};(0,N.useEffect)(()=>{var Xe;const Ye=(Xe=nt.current)==null?void 0:Xe.instance;if(Ye&&I&&ke){const Pt=Ye.onDidBlurEditorWidget(()=>{he.current=!1}),$t=Ye.onDidFocusEditorText(()=>{he.current=!0});return()=>{Pt.dispose(),$t.dispose()}}},[nt.current,I,ke]),(0,N.useEffect)(()=>{var Xe;if((Xe=nt.current)!=null&&Xe.instance&&I&&it){let Ye=nt.current.instance,Pt=Ye.getModel();if(!Pt)return;(()=>{var Kt;let Vt=[],kt=[];const gi=Pt.getAllDecorations();for(let vi of gi)vi.options.className==="highlighted-line"&&(Vt.push((Kt=vi==null?void 0:vi.range)==null?void 0:Kt.startLineNumber),kt.push(vi==null?void 0:vi.id));if(_e===Vt[0])return;Pt.deltaDecorations(kt,[]);const jt=Pt.getLineCount();_e&&_e<=jt&&(Ye.deltaDecorations([],[{range:new yt.Range(_e,1,_e,Pt.getLineMaxColumn(_e)),options:{isWholeLine:!0,className:"highlighted-line"}}]),Ye.revealLineInCenter(_e))})();const Ht=(Kt=!1)=>{var Vt;let kt=[],gi=[];const jt=Pt.getAllDecorations();for(let vi of jt)vi.options.linesDecorationsClassName==="breakpoints-select"&&(kt.push((Vt=vi==null?void 0:vi.range)==null?void 0:Vt.startLineNumber),gi.push(vi==null?void 0:vi.id));if(Kt)return{lines:kt,ids:gi};qe(kt)},qt=Kt=>R(void 0,null,function*(){let Vt={range:new yt.Range(Kt,1,Kt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield Pt.deltaDecorations([],[Vt]),Ht()}),Ei=Kt=>R(void 0,null,function*(){let Vt=[];const kt=Ye.getLineDecorations(Kt);for(let gi of kt)gi.options.linesDecorationsClassName==="breakpoints-select"&&Vt.push(gi.id);yield Pt.deltaDecorations(Vt,[]),Ht()}),_i=Kt=>{let Vt=Ye.getLineDecorations(Kt);for(let kt of Vt)if(kt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,W.isEqual)(Ue,Ht(!0).lines)){Pt.deltaDecorations(Ht(!0).ids,[]);const Kt=Ue.map(Vt=>({range:new yt.Range(Vt,1,Vt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));Pt.deltaDecorations([],Kt)}const ti=Ye.onDidChangeModelContent(Kt=>{let Vt=Ye.getPosition();if(Vt){let kt=Vt.lineNumber;clearTimeout(le.current),le.current=setTimeout(()=>{Ge(Pt.getLineContent(kt),kt)?Ei(kt):_i(kt)?(Ei(kt),qt(kt)):Ht()},100)}}),bi=Ye.onMouseDown(Kt=>{var Vt,kt,gi;if(Kt.target.detail&&((gi=(kt=(Vt=Kt.target)==null?void 0:Vt.element)==null?void 0:kt.className)!=null&&gi.includes("line-numbers"))){let jt=Kt.target.position.lineNumber;if(Ge(Pt.getLineContent(jt),jt))return;_i(jt)?Ei(jt):qt(jt)}}),Gt=Kt=>{let Vt={range:new yt.Range(Kt,1,Kt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};Et.current=Ye.deltaDecorations(Et.current,[Vt])},xi=()=>{Et.current=Ye.deltaDecorations(Et.current,[])},ii=Ye.onMouseMove(Kt=>{var Vt,kt,gi;if(xi(),Kt.target.detail&&((gi=(kt=(Vt=Kt.target)==null?void 0:Vt.element)==null?void 0:kt.className)!=null&&gi.includes("line-numbers"))){let jt=Kt.target.position.lineNumber;if(Ge(Pt.getLineContent(jt),jt))return;Gt(jt)}}),bn=Ye.onMouseLeave(()=>{xi()});return()=>{ti.dispose(),bi.dispose(),ii.dispose(),bn.dispose()}}},[nt.current,I,Ue,_e,it,Ee]),(0,N.useEffect)(()=>{var Xe;(Xe=nt.current)!=null&&Xe.instance&&it&&nt.current.instance.setPosition({lineNumber:0,column:0})},[_e]);function ze(){let Xe=nt.current.instance;if(Xe){const Ye=Xe.getSelection(),Pt=nt.current.pastePos||{},$t=new yt.Range(Pt.startLineNumber||Ye.endLineNumber,Pt.startColumn||Ye.endColumn,Pt.endLineNumber||Ye.endLineNumber,Pt.endColumn||Ye.endColumn);setTimeout(()=>{Xe.executeEdits("",[{range:$t,text:""}])},300)}}function ot(Xe){(window.navigator.platform.match("Mac")?Xe.metaKey:Xe.ctrlKey)&&Xe.keyCode==83&&(Xe.preventDefault(),we())}const ct=()=>{if(De&&nt.current.instance){const Xe=nt.current.instance.getContentHeight();ci(Xe<wt?wt:Xe)}else ci(wt)};function Ct(Xe){var Ye=document.createEvent("MouseEvents");Ye.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Xe.dispatchEvent(Ye)}const Yt=Xe=>{if(!he.current)return;const{keyCode:Ye,ctrlKey:Pt,metaKey:$t,target:Ht,type:qt}=Xe;return(qt==="paste"||(Ye===67||Ye===86)&&($t||Pt))&&Ht.nodeName==="TEXTAREA"&&(se(),Xe.preventDefault()),!1};function Ft(Xe,Ye){var Pt=window.URL||window.webkitURL||window,$t=new Blob([Ye]),Ht=document.createElementNS("http://www.w3.org/1999/xhtml","a");Ht.href=Pt.createObjectURL($t),Ht.download=Xe,Ct(Ht)}(0,N.useEffect)(()=>{ct()},[ct]),(0,N.useEffect)(()=>{vt.current&&!I&&Promise.all([ee.e(8909),ee.e(5028)]).then(ee.bind(ee,71448)).then(Xe=>{try{yt=Xe,nt.current.instance=yt.editor.create(vt.current,{value:de,language:He(Ee),theme:Ve,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:Be||!1}},Ce);const Ye=nt.current.instance;let Ht=[...K.BH._menuItems].find(ti=>ti[0]._debugName=="EditorContext")[1],qt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],Ei=(ti,bi)=>{var Gt,xi;let ii=ti._first;do bi.includes((xi=(Gt=ii.element)==null?void 0:Gt.command)==null?void 0:xi.id)&&ti._remove(ii);while(ii=ii.next)};if(ut(Ye,yt),setTimeout(()=>{ct(),nt.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{Ft(dt||"educoder.txt",Ye.getValue())}})},500),nt.current.subscription=Ye.onDidChangeModelContent(ti=>{ei.current?clearTimeout(be.current):(ct(),je(Ye.getValue(),ti)),be.current=setTimeout(()=>{ei.current=!1},500)}),window.Monaco||y(yt,He(Ee)),ke&&(Ei(Ht,qt),vt.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Yt),window.removeEventListener("paste",Yt),window.addEventListener("keydown",Yt),window.addEventListener("paste",Yt)),window.Monaco=yt,G&&Ye.onDidBlurEditorWidget(()=>{G(Ye.getValue())}),Qe&&Ye.onDidFocusEditorText(()=>{ke&&tt(),Qe(Ye.getValue())}),ke){tt();try{Ye.onDidPaste(ti=>{const bi=Ye.getSelection(),Gt=nt.current.pastePos||{},xi=new yt.Range(Gt.startLineNumber||bi.endLineNumber,Gt.startColumn||bi.endColumn,Gt.endLineNumber||bi.endLineNumber,Gt.endColumn||bi.endColumn);Ye.executeEdits("",[{range:ti.range,text:""}])})}catch(ti){}}let _i=Z();return We&&typeof We=="string"&&new j(We,Ye,yt),$(!0),()=>{const ti=nt.current.instance;ti.dispose();const bi=ti.getModel();bi&&bi.dispose(),nt.current.subscription&&nt.current.subscription.dispose(),_i.unobserve(vt.current)}}catch(Ye){}})},[]),(0,N.useEffect)(()=>{if(nt.current.instance&&I)return document.addEventListener("keydown",ot,!1),()=>{document.removeEventListener("keydown",ot)}},[we,I]),(0,N.useEffect)(()=>{let Xe=nt.current.instance;if(Xe&&I){let Ye=He(Ee);yt.editor.setModelLanguage(Xe.getModel(),Ye)}},[Ee,I]),(0,N.useEffect)(()=>{nt.current.instance&&I&&yt.editor.setTheme(Ve)},[Ve,I]),(0,N.useEffect)(()=>{let Xe=nt.current.instance;It.current=Le,Xe&&I&&(Xe.updateOptions(B({},Le)),setTimeout(()=>{Xe.getModel().updateOptions(B({},Le))},200))},[JSON.stringify(Le),I]),(0,N.useEffect)(()=>{let Xe=nt.current.instance;Xe&&I&&Xe.layout()},[Oe,wt,I]);const[St,li]=(0,N.useState)(q(Oe)),[yi,ci]=(0,N.useState)(q(wt)),ai=E(B({},Q),{width:St,height:yi,position:"relative"});return N.createElement("div",{className:"my-monaco-editor",ref:vt,style:ai},ae&&N.createElement(fe.CopyToClipboard,{text:de,onCopy:()=>J.ZP.success("\u590D\u5236\u6210\u529F")},N.createElement(ie.Z,{title:"\u590D\u5236\u4EE3\u7801"},N.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},N.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function Mt({width:$e="100%",height:pt="100%",original:Oe,modified:wt,language:de,options:Ee={}}){const Q=(0,N.useRef)(),[Le,Ce]=(0,N.useState)(null);function Ve(De){let ke;return Q.current&&(ke=new ye.Z(je=>{for(let ut of je)(ut.target.offsetHeight>0||ut.target.offsetWidth>0)&&De.layout()}),ke.observe(Q.current)),ke}(0,N.useEffect)(()=>(Q.current&&Promise.all([ee.e(8909),ee.e(9404)]).then(ee.bind(ee,2550)).then(De=>{yt=De;const ke=yt.editor.createDiffEditor(Q.current,E(B({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},Ee),{wordWrap:!0}));Ce(ke);let je=Ve(ke);return()=>{ke.dispose();const ut=ke.getModel();ut&&ut.dispose(),je.unobserve(Q.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,N.useEffect)(()=>{Le&&Le.setModel({original:yt.editor.createModel(Oe,de),modified:yt.editor.createModel(wt,de)})},[Oe,wt,de,Le]);const G=q($e),ae=q(pt),we={width:G,height:ae};return N.createElement("div",{className:"my-diff-editor",ref:Q,style:we})}},62422:function(Dt,Ze,ee){"use strict";ee.r(Ze),ee.d(Ze,{Types:function(){return K}});var N=ee(59301),ye=ee(29787),Ne=ee(99571),oe=ee(93725),V=ee(76560),p=ee(82093),ge=ee(90524),ne=ee(38394),l=ee(73327),z=ee(58109),D=Object.defineProperty,g=Object.defineProperties,x=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,P=(ie,W,te)=>W in ie?D(ie,W,{enumerable:!0,configurable:!0,writable:!0,value:te}):ie[W]=te,F=(ie,W)=>{for(var te in W||(W={}))b.call(W,te)&&P(ie,te,W[te]);if(y)for(var te of y(W))O.call(W,te)&&P(ie,te,W[te]);return ie},S=(ie,W)=>g(ie,x(W)),L=(ie,W,te)=>new Promise((fe,me)=>{var Pe=C=>{try{A(te.next(C))}catch(U){me(U)}},M=C=>{try{A(te.throw(C))}catch(U){me(U)}},A=C=>C.done?fe(C.value):Promise.resolve(C.value).then(Pe,M);A((te=te.apply(ie,W)).next())});const j={data:void 0};var K=(ie=>(ie.GET_DATA="get-data",ie.PRAISE="on-praise",ie))(K||{});function J(ie,W){switch(W.type){case"get-data":return S(F({},ie),{data:W.payload});case"on-praise":return S(F({},ie),{data:W.payload});default:throw new Error}}Ze.default=()=>{var ie,W,te,fe,me,Pe,M,A,C;const[U,Y]=(0,N.useReducer)(J,j),{data:B}=U,{caseId:E}=(0,V.useParams)();(0,N.useEffect)(()=>{let q=!1;function Te(){return L(this,null,function*(){const Re=yield(0,p.U2)(`libraries/${E}.json`);q||(Re.status===404?V.history.push("/moop_cases"):Y({type:"get-data",payload:Re}))})}return q||Te(),()=>{q=!0}},[E]);function _(){return L(this,null,function*(){yield(0,p.v_)("praise_tread/like.json",{object_id:E,object_type:"library"});let q=F({},B);q.operation.user_praised=!0,q.praise_count+=1,Y({type:"on-praise",payload:q})})}function R(){return L(this,null,function*(){yield(0,p.IV)(`/libraries/${E}.json`),V.history.push("/moop_cases")})}return N.createElement(ye.Z,{spinning:!B,delay:500},B?N.createElement("section",{className:"moop-info"},N.createElement("div",{className:"crumb"},N.createElement(V.Link,{to:"/moop_cases"},"\u6559\u5B66\u6848\u4F8B > "),N.createElement("span",null,B.title)),N.createElement("div",{className:"title"},N.createElement("h2",null,B.title,(ie=B.tags)==null?void 0:ie.map((q,Te)=>N.createElement("span",{className:"label-"+Te,key:q.id},q.name))),N.createElement(V.Link,{to:"/moop_cases"},"\u8FD4\u56DE")),N.createElement("div",{className:"moop-info-body"},N.createElement("div",{className:"moop-sub-title"},N.createElement("img",{src:`${ge.Z.IMG_SERVER}/images/${(W=B.creator)==null?void 0:W.image_url}`,alt:"cover",width:50}),N.createElement("div",{className:"desc"},N.createElement("div",{className:"flex-container"},N.createElement("span",null,(te=B.creator)==null?void 0:te.name),(fe=B.operation)!=null&&fe.can_editable?N.createElement(V.Link,{to:`/moop_cases/${B.id}/edit`,style:{marginRight:10}},N.createElement(Ne.ZP,{type:"ghost"},"\u7F16\u8F91")):null,(me=B.operation)!=null&&me.can_deletable?N.createElement(oe.Z,{placement:"bottomRight",title:"\u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F",onConfirm:R},N.createElement(Ne.ZP,{type:"dashed"},"\u5220\u9664")):null),N.createElement("div",{className:"sum"},N.createElement("span",null,(Pe=B.creator)==null?void 0:Pe.school_name),N.createElement("span",null,"\u7F16\u7801\uFF1A",B.uuid),N.createElement("span",null,"\u53D1\u5E03\u65F6\u95F4\uFF1A",B.published_at)))),N.createElement("p",null,"\u4F5C\u8005\uFF1A",`${B.author_name} / ${B.author_school_name}`),N.createElement(ne.Z,{value:B.content}),N.createElement("ul",{className:"attachment"},(M=B.attachments)==null?void 0:M.map(q=>N.createElement("li",{key:q.id},N.createElement("a",{href:q.url},N.createElement("i",{className:"iconfont icon-fujian"}),N.createElement("span",null,q.title),N.createElement("span",null,q.filesize))))),N.createElement("button",{className:"praise",disabled:(A=B.operation)==null?void 0:A.user_praised,onClick:_},(C=B.operation)!=null&&C.user_praised?N.createElement("span",null,"\u5DF2\u8D5E"):N.createElement("span",null,N.createElement("i",{className:"iconfont icon-dianzan"})),N.createElement("span",null,B.praise_count)))):null)}},90290:function(Dt,Ze,ee){"use strict";ee.d(Ze,{AL:function(){return j},Iy:function(){return D},Qv:function(){return y},ez:function(){return L},jb:function(){return g}});var N=ee(32834),ye=ee.n(N),Ne=ee(11690),oe=ee.n(Ne);let V=1;function p(te,fe){const me=te.match(/^(\s+)(?:```)/);if(me===null)return fe;const Pe=me[1];return fe.split(`
|
|
`).map(M=>{const A=M.match(/^\s+/);if(A===null)return M;const[C]=A;return C.length>=Pe.length?M.slice(Pe.length):M}).join(`
|
|
`)}let ge=[],ne=["<ul>"];const l=new(ye()).Renderer,z=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function D(){ge.length=0,ne=["<ul>"]}const g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function x(te,fe,me,Pe){if(fe>=te.length||te[fe].level<=me)return fe;var M=te[fe];Pe.push("<li><a href='#"+V+M.anchor+"'>"+M.text+"</a>"),fe++;var A=[];return fe=x(te,fe,M.level,A),A.length>0&&(Pe.push("<ul>"),A.forEach(function(C){Pe.push(C)}),Pe.push("</ul>")),Pe.push("</li>"),fe=x(te,fe,me,Pe),fe}function y(){return x(ge,0,0,ne),ne.push("</ul>"),ne.join("")}const b={heading(te){const fe=z.exec(te);if(V+=1,fe)return{type:"heading",raw:fe[0],depth:fe[1].length,text:fe[2]}},fences(te){const fe=this.rules.block.fences.exec(te);if(fe){const me=fe[0];let Pe=p(me,fe[3]||"");const M=fe[2]?fe[2].trim():fe[2];if(["latex","katex","math"].indexOf(M)>=0){const A=F(),C=Pe;Pe=A,S[A]={type:"block",expression:C}}return{type:"code",raw:me,lang:M,text:Pe}}}},O=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let P=0;const F=()=>`__special_katext_id_${P++}__`;let S={};function L(){return S}function j(){P=0,S={}}function K(te){return te=te.replace(O,(fe,me)=>{const Pe=F();return S[Pe]={type:"inline",expression:me},Pe}),te}const J=l.listitem;l.listitem=function(te){return J(K(te))};const ie=l.paragraph;l.paragraph=function(te){return ie(K(te))};const W=l.tablecell;l.tablecell=function(te,fe){return W(K(te),fe)},l.code=function(te,fe,me){const Pe=(fe||"").match(/\S*/)[0];return Pe?["latex","katex","math"].indexOf(Pe)>=0?`<p class='editormd-tex'>${te}</p>`:`<pre class="prettyprint linenums"><code class="language-${fe}">${me?te:(0,Ne.escape)(te,!0)}</code></pre>
|
|
`:'<pre class="prettyprint linenums"><code>'+(me?te:(0,Ne.escape)(te,!0))+"</code></pre>"},l.heading=function(te,fe,me){let Pe=this.options.headerPrefix+me.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return ge.push({anchor:Pe,level:fe,text:te}),"<h"+fe+' id="'+V+Pe+'">'+te+"</h"+fe+">"},ye().setOptions({silent:!0,gfm:!0,pedantic:!1}),ye().use({tokenizer:b,renderer:l}),Ze.ZP=ye()},64018:function(){var Dt,Ze,ee,N=!1,ye,Ne;window.PR_SHOULD_USE_CONTINUATION=!0;var oe,V;(function(){var p=window,ge=["break,continue,do,else,for,if,return,while"],ne=[ge,"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=[ne,"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"],D=[l,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],g=[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"],x="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",y=[l,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],b="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",O=[ge,"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"],P=[ge,"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"],F=[ge,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[z,g,D,y,b,O,P,F],L=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,j="str",K="kwd",J="com",ie="typ",W="lit",te="pun",fe="pln",me="tag",Pe="dec",M="src",A="atn",C="atv",U="nocode",Y="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(Ee){for(var Q=0,Le=!1,Ce=!1,Ve=0,G=Ee.length;Ve<G;++Ve){var ae=Ee[Ve];if(ae.ignoreCase)Ce=!0;else if(/[a-z]/i.test(ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Le=!0,Ce=!1;break}}var we={b:8,t:9,n:10,v:11,f:12,r:13};function De(qe){var Ue=qe.charCodeAt(0);if(Ue!==92)return Ue;var dt=qe.charAt(1);return Ue=we[dt],Ue||("0"<=dt&&dt<="7"?parseInt(qe.substring(1),8):dt==="u"||dt==="x"?parseInt(qe.substring(2),16):qe.charCodeAt(1))}function ke(qe){if(qe<32)return(qe<16?"\\x0":"\\x")+qe.toString(16);var Ue=String.fromCharCode(qe);return Ue==="\\"||Ue==="-"||Ue==="]"||Ue==="^"?"\\"+Ue:Ue}function je(qe){var Ue=qe.substring(1,qe.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")),dt=[],ht=Ue[0]==="^",et=["["];ht&&et.push("^");for(var _e=ht?1:0,it=Ue.length;_e<it;++_e){var We=Ue[_e];if(/\\[bdsw]/i.test(We))et.push(We);else{var Be=De(We),At;_e+2<it&&Ue[_e+1]==="-"?(At=De(Ue[_e+2]),_e+=2):At=Be,dt.push([Be,At]),At<65||Be>122||(At<65||Be>90||dt.push([Math.max(65,Be)|32,Math.min(At,90)|32]),At<97||Be>122||dt.push([Math.max(97,Be)&-33,Math.min(At,122)&-33]))}}dt.sort(function(Bt,Et){return Bt[0]-Et[0]||Et[1]-Bt[1]});for(var vt=[],nt=[],_e=0;_e<dt.length;++_e){var It=dt[_e];It[0]<=nt[1]+1?nt[1]=Math.max(nt[1],It[1]):vt.push(nt=It)}for(var _e=0;_e<vt.length;++_e){var It=vt[_e];et.push(ke(It[0])),It[1]>It[0]&&(It[1]+1>It[0]&&et.push("-"),et.push(ke(It[1])))}return et.push("]"),et.join("")}function ut(qe){for(var Ue=qe.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")),dt=Ue.length,ht=[],et=0,_e=0;et<dt;++et){var it=Ue[et];if(it==="(")++_e;else if(it.charAt(0)==="\\"){var We=+it.substring(1);We&&(We<=_e?ht[We]=-1:Ue[et]=ke(We))}}for(var et=1;et<ht.length;++et)ht[et]===-1&&(ht[et]=++Q);for(var et=0,_e=0;et<dt;++et){var it=Ue[et];if(it==="(")++_e,ht[_e]||(Ue[et]="(?:");else if(it.charAt(0)==="\\"){var We=+it.substring(1);We&&We<=_e&&(Ue[et]="\\"+ht[We])}}for(var et=0;et<dt;++et)Ue[et]==="^"&&Ue[et+1]!=="^"&&(Ue[et]="");if(qe.ignoreCase&&Le)for(var et=0;et<dt;++et){var it=Ue[et],Be=it.charAt(0);it.length>=2&&Be==="["?Ue[et]=je(it):Be!=="\\"&&(Ue[et]=it.replace(/[a-zA-Z]/g,function(nt){var It=nt.charCodeAt(0);return"["+String.fromCharCode(It&-33,It|32)+"]"}))}return Ue.join("")}for(var Qe=[],Ve=0,G=Ee.length;Ve<G;++Ve){var ae=Ee[Ve];if(ae.global||ae.multiline)throw new Error(""+ae);Qe.push("(?:"+ut(ae)+")")}return new RegExp(Qe.join("|"),Ce?"gi":"g")}function E(Ee,Q){var Le=/(?:^|\s)nocode(?:\s|$)/,Ce=[],Ve=0,G=[],ae=0;function we(De){var ke=De.nodeType;if(ke==1){if(Le.test(De.className))return;for(var je=De.firstChild;je;je=je.nextSibling)we(je);var ut=De.nodeName.toLowerCase();(ut==="br"||ut==="li")&&(Ce[ae]=`
|
|
`,G[ae<<1]=Ve++,G[ae++<<1|1]=De)}else if(ke==3||ke==4){var Qe=De.nodeValue;Qe.length&&(Q?Qe=Qe.replace(/\r\n?/g,`
|
|
`):Qe=Qe.replace(/[ \t\r\n]+/g," "),Ce[ae]=Qe,G[ae<<1]=Ve,Ve+=Qe.length,G[ae++<<1|1]=De)}}return we(Ee),{sourceCode:Ce.join("").replace(/\n$/,""),spans:G}}function _(Ee,Q,Le,Ce,Ve){if(Le){var G={sourceNode:Ee,pre:1,langExtension:null,numberLines:null,sourceCode:Le,spans:null,basePos:Q,decorations:null};Ce(G),Ve.push.apply(Ve,G.decorations)}}var R=/\S/;function q(Ee){for(var Q=void 0,Le=Ee.firstChild;Le;Le=Le.nextSibling){var Ce=Le.nodeType;Q=Ce===1?Q?Ee:Le:Ce===3&&R.test(Le.nodeValue)?Ee:Q}return Q===Ee?void 0:Q}function Te(Ee,Q){var Le={},Ce;(function(){for(var ae=Ee.concat(Q),we=[],De={},ke=0,je=ae.length;ke<je;++ke){var ut=ae[ke],Qe=ut[3];if(Qe)for(var qe=Qe.length;--qe>=0;)Le[Qe.charAt(qe)]=ut;var Ue=ut[1],dt=""+Ue;De.hasOwnProperty(dt)||(we.push(Ue),De[dt]=null)}we.push(/[\0-\uffff]/),Ce=B(we)})();var Ve=Q.length,G=function(ae){for(var we=ae.sourceCode,De=ae.basePos,ke=ae.sourceNode,je=[De,fe],ut=0,Qe=we.match(Ce)||[],qe={},Ue=0,dt=Qe.length;Ue<dt;++Ue){var ht=Qe[Ue],et=qe[ht],_e=void 0,it;if(typeof et=="string")it=!1;else{var We=Le[ht.charAt(0)];if(We)_e=ht.match(We[1]),et=We[0];else{for(var Be=0;Be<Ve;++Be)if(We=Q[Be],_e=ht.match(We[1]),_e){et=We[0];break}_e||(et=fe)}it=et.length>=5&&et.substring(0,5)==="lang-",it&&!(_e&&typeof _e[1]=="string")&&(it=!1,et=M),it||(qe[ht]=et)}var At=ut;if(ut+=ht.length,!it)je.push(De+At,et);else{var vt=_e[1],nt=ht.indexOf(vt),It=nt+vt.length;_e[2]&&(It=ht.length-_e[2].length,nt=It-vt.length);var Bt=et.substring(5);_(ke,De+At,ht.substring(0,nt),G,je),_(ke,De+At+nt,vt,Mt(Bt,vt),je),_(ke,De+At+It,ht.substring(It),G,je)}}ae.decorations=je};return G}function Re(Ee){var Q=[],Le=[];Ee.tripleQuotedStrings?Q.push([j,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ee.multiLineStrings?Q.push([j,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Q.push([j,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ee.verbatimStrings&&Le.push([j,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ce=Ee.hashComments;Ce&&(Ee.cStyleComments?(Ce>1?Q.push([J,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Q.push([J,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Le.push([j,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Q.push([J,/^#[^\r\n]*/,null,"#"])),Ee.cStyleComments&&(Le.push([J,/^\/\/[^\r\n]*/,null]),Le.push([J,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ve=Ee.regexLiterals;if(Ve){var G=Ve>1?"":`
|
|
\r`,ae=G?".":"[\\S\\s]",we="/(?=[^/*"+G+"])(?:[^/\\x5B\\x5C"+G+"]|\\x5C"+ae+"|\\x5B(?:[^\\x5C\\x5D"+G+"]|\\x5C"+ae+")*(?:\\x5D|$))+/";Le.push(["lang-regex",RegExp("^"+Y+"("+we+")")])}var De=Ee.types;De&&Le.push([ie,De]);var ke=(""+Ee.keywords).replace(/^ | $/g,"");ke.length&&Le.push([K,new RegExp("^(?:"+ke.replace(/[\s,]+/g,"|")+")\\b"),null]),Q.push([fe,/^\s+/,null,` \r
|
|
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return Ee.regexLiterals&&(je+="(?!s*/)"),Le.push([W,/^@[a-z_$][a-z_$@0-9]*/i,null],[ie,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[fe,/^[a-z_$][a-z_$@0-9]*/i,null],[W,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[fe,/^\\[\s\S]?/,null],[te,new RegExp(je),null]),Te(Q,Le)}var Je=Re({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function He(Ee,Q,Le){for(var Ce=/(?:^|\s)nocode(?:\s|$)/,Ve=/\r\n?|\n/,G=Ee.ownerDocument,ae=G.createElement("li");Ee.firstChild;)ae.appendChild(Ee.firstChild);var we=[ae];function De(Ue){var dt=Ue.nodeType;if(dt==1&&!Ce.test(Ue.className))if(Ue.nodeName==="br")ke(Ue),Ue.parentNode&&Ue.parentNode.removeChild(Ue);else for(var ht=Ue.firstChild;ht;ht=ht.nextSibling)De(ht);else if((dt==3||dt==4)&&Le){var et=Ue.nodeValue,_e=et.match(Ve);if(_e){var it=et.substring(0,_e.index);Ue.nodeValue=it;var We=et.substring(_e.index+_e[0].length);if(We){var Be=Ue.parentNode;Be.insertBefore(G.createTextNode(We),Ue.nextSibling)}ke(Ue),it||Ue.parentNode.removeChild(Ue)}}}function ke(Ue){for(;!Ue.nextSibling;)if(Ue=Ue.parentNode,!Ue)return;function dt(_e,it){var We=it?_e.cloneNode(!1):_e,Be=_e.parentNode;if(Be){var At=dt(Be,1),vt=_e.nextSibling;At.appendChild(We);for(var nt=vt;nt;nt=vt)vt=nt.nextSibling,At.appendChild(nt)}return We}for(var ht=dt(Ue.nextSibling,0),et;(et=ht.parentNode)&&et.nodeType===1;)ht=et;we.push(ht)}for(var je=0;je<we.length;++je)De(we[je]);Q===(Q|0)&&we[0].setAttribute("value",Q);var ut=G.createElement("ol");ut.className="linenums";for(var Qe=Math.max(0,Q-1|0)||0,je=0,qe=we.length;je<qe;++je)ae=we[je],ae.className="L"+(je+Qe)%10,ae.firstChild||ae.appendChild(G.createTextNode("\xA0")),ut.appendChild(ae);Ee.appendChild(ut)}function yt(Ee){var Q=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Q=Q&&+Q[1]<=8;var Le=/\n/g,Ce=Ee.sourceCode,Ve=Ce.length,G=0,ae=Ee.spans,we=ae.length,De=0,ke=Ee.decorations,je=ke.length,ut=0;ke[je]=Ve;var Qe,qe;for(qe=Qe=0;qe<je;)ke[qe]!==ke[qe+2]?(ke[Qe++]=ke[qe++],ke[Qe++]=ke[qe++]):qe+=2;for(je=Qe,qe=Qe=0;qe<je;){for(var Ue=ke[qe],dt=ke[qe+1],ht=qe+2;ht+2<=je&&ke[ht+1]===dt;)ht+=2;ke[Qe++]=Ue,ke[Qe++]=dt,qe=ht}je=ke.length=Qe;var et=Ee.sourceNode,_e="";et&&(_e=et.style.display,et.style.display="none");try{for(var it=null;De<we;){var We=ae[De],Be=ae[De+2]||Ve,At=ke[ut+2]||Ve,ht=Math.min(Be,At),vt=ae[De+1],nt;if(vt.nodeType!==1&&(nt=Ce.substring(G,ht))){Q&&(nt=nt.replace(Le,"\r")),vt.nodeValue=nt;var It=vt.ownerDocument,Bt=It.createElement("span");Bt.className=ke[ut+1];var Et=vt.parentNode;Et.replaceChild(Bt,vt),Bt.appendChild(vt),G<Be&&(ae[De+1]=vt=It.createTextNode(Ce.substring(ht,Be)),Et.insertBefore(vt,Bt.nextSibling))}G=ht,G>=Be&&(De+=2),G>=At&&(ut+=2)}}finally{et&&(et.style.display=_e)}}var tt={};function Ke(Ee,Q){for(var Le=Q.length;--Le>=0;){var Ce=Q[Le];tt.hasOwnProperty(Ce)?p.console&&console.warn("cannot override language handler %s",Ce):tt[Ce]=Ee}}function Mt(Ee,Q){return Ee&&tt.hasOwnProperty(Ee)||(Ee=/^\s*</.test(Q)?"default-markup":"default-code"),tt[Ee]}Ke(Je,["default-code"]),Ke(Te([],[[fe,/^[^<?]+/],[Pe,/^<!\w[^>]*(?:>|$)/],[J,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[te,/^(?:<[%?]|[%?]>)/],["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"]),Ke(Te([[fe,/^[\s]+/,null,` \r
|
|
`],[C,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[me,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[A,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[te,/^[=<>\/]+/],["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"]),Ke(Te([],[[C,/^[\s\S]+/]]),["uq.val"]),Ke(Re({keywords:z,hashComments:!0,cStyleComments:!0,types:L}),["c","cc","cpp","cxx","cyc","m"]),Ke(Re({keywords:"null,true,false"}),["json"]),Ke(Re({keywords:g,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:L}),["cs"]),Ke(Re({keywords:D,cStyleComments:!0}),["java"]),Ke(Re({keywords:F,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Ke(Re({keywords:O,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Ke(Re({keywords:b,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Ke(Re({keywords:P,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Ke(Re({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Ke(Re({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Ke(Te([],[[j,/^[\s\S]+/]]),["regex"]);function $e(Ee){var Q=Ee.langExtension;try{var Le=E(Ee.sourceNode,Ee.pre),Ce=Le.sourceCode;Ee.sourceCode=Ce,Ee.spans=Le.spans,Ee.basePos=0,Mt(Q,Ce)(Ee),yt(Ee)}catch(Ve){p.console&&console.log(Ve&&Ve.stack||Ve)}}function pt(Ee,Q,Le){var Ce=Le||!1,Ve=Q||null,G=document.createElement("div");G.innerHTML="<pre>"+Ee+"</pre>",G=G.firstChild,Ce&&He(G,Ce,!0);var ae={langExtension:Ve,numberLines:Ce,sourceNode:G,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $e(ae),G.innerHTML}function Oe(Ee,Q){var Le=Q||document.body,Ce=Le.ownerDocument||document;function Ve(We){return Le.getElementsByTagName(We)}for(var G=[Ve("pre"),Ve("code"),Ve("xmp")],ae=[],we=0;we<G.length;++we)for(var De=0,ke=G[we].length;De<ke;++De)ae.push(G[we][De]);G=null;var je=Date;je.now||(je={now:function(){return+new Date}});var ut=0,Qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,qe=/\bprettyprint\b/,Ue=/\bprettyprinted\b/,dt=/pre|xmp/i,ht=/^code$/i,et=/^(?:pre|code|xmp)$/i,_e={};function it(){for(var We=p.PR_SHOULD_USE_CONTINUATION?je.now()+250:1/0;ut<ae.length&&je.now()<We;ut++){for(var Be=ae[ut],At=_e,vt=Be;vt=vt.previousSibling;){var nt=vt.nodeType,It=(nt===7||nt===8)&&vt.nodeValue;if(It?!/^\??prettify\b/.test(It):nt!==3||/\S/.test(vt.nodeValue))break;if(It){At={},It.replace(/\b(\w+)=([\w:.%+-]+)/g,function(ze,ot,ct){At[ot]=ct});break}}var Bt=Be.className;if((At!==_e||qe.test(Bt))&&!Ue.test(Bt)){for(var Et=!1,ei=Be.parentNode;ei;ei=ei.parentNode){var be=ei.tagName;if(et.test(be)&&ei.className&&qe.test(ei.className)){Et=!0;break}}if(!Et){Be.className+=" prettyprinted";var le=At.lang;if(!le){le=Bt.match(Qe);var he;!le&&(he=q(Be))&&ht.test(he.tagName)&&(le=he.className.match(Qe)),le&&(le=le[1])}var I;if(dt.test(Be.tagName))I=1;else{var $=Be.currentStyle,Z=Ce.defaultView,se=$?$.whiteSpace:Z&&Z.getComputedStyle?Z.getComputedStyle(Be,null).getPropertyValue("white-space"):0;I=se&&se.substring(0,3)==="pre"}var re=At.linenums;(re=re==="true"||+re)||(re=Bt.match(/\blinenums\b(?::(\d+))?/),re=re?re[1]&&re[1].length?+re[1]:!0:!1),re&&He(Be,re,I);var Ge={langExtension:le,sourceNode:Be,numberLines:re,pre:I,sourceCode:null,basePos:null,spans:null,decorations:null};$e(Ge)}}}ut<ae.length?p.setTimeout(it,250):typeof Ee=="function"&&Ee()}it()}var wt=p.PR={createSimpleLexer:Te,registerLangHandler:Ke,sourceDecorator:Re,PR_ATTRIB_NAME:A,PR_ATTRIB_VALUE:C,PR_COMMENT:J,PR_DECLARATION:Pe,PR_KEYWORD:K,PR_LITERAL:W,PR_NOCODE:U,PR_PLAIN:fe,PR_PUNCTUATION:te,PR_SOURCE:M,PR_STRING:j,PR_TAG:me,PR_TYPE:ie,prettyPrintOne:N?p.prettyPrintOne=pt:oe=pt,prettyPrint:V=N?p.prettyPrint=Oe:V=Oe},de=p.define;typeof de=="function"&&de.amd&&de("google-code-prettify",[],function(){return wt})})()},25769:function(Dt,Ze,ee){"use strict";var N=ee(98040),ye={"text/plain":"Text","text/html":"Url",default:"Text"},Ne="Copy to clipboard: #{key}, Enter";function oe(p){var ge=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return p.replace(/#{\s*key\s*}/g,ge)}function V(p,ge){var ne,l,z,D,g,x,y=!1;ge||(ge={}),ne=ge.debug||!1;try{z=N(),D=document.createRange(),g=document.getSelection(),x=document.createElement("span"),x.textContent=p,x.ariaHidden="true",x.style.all="unset",x.style.position="fixed",x.style.top=0,x.style.clip="rect(0, 0, 0, 0)",x.style.whiteSpace="pre",x.style.webkitUserSelect="text",x.style.MozUserSelect="text",x.style.msUserSelect="text",x.style.userSelect="text",x.addEventListener("copy",function(O){if(O.stopPropagation(),ge.format)if(O.preventDefault(),typeof O.clipboardData=="undefined"){ne&&console.warn("unable to use e.clipboardData"),ne&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var P=ye[ge.format]||ye.default;window.clipboardData.setData(P,p)}else O.clipboardData.clearData(),O.clipboardData.setData(ge.format,p);ge.onCopy&&(O.preventDefault(),ge.onCopy(O.clipboardData))}),document.body.appendChild(x),D.selectNodeContents(x),g.addRange(D);var b=document.execCommand("copy");if(!b)throw new Error("copy command was unsuccessful");y=!0}catch(O){ne&&console.error("unable to copy using execCommand: ",O),ne&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(ge.format||"text",p),ge.onCopy&&ge.onCopy(window.clipboardData),y=!0}catch(P){ne&&console.error("unable to copy using clipboardData: ",P),ne&&console.error("falling back to prompt"),l=oe("message"in ge?ge.message:Ne),window.prompt(l,p)}}finally{g&&(typeof g.removeRange=="function"?g.removeRange(D):g.removeAllRanges()),x&&document.body.removeChild(x),z()}return y}Dt.exports=V},53184:function(Dt,Ze,ee){"use strict";var N,ye;function Ne(oe,V,p){var ge=function(ne,l){return oe.js_beautify(ne,l)};return ge.js=oe.js_beautify,ge.css=V.css_beautify,ge.html=p.html_beautify,ge.js_beautify=oe.js_beautify,ge.css_beautify=V.css_beautify,ge.html_beautify=p.html_beautify,ge}N=[ee(58553),ee(87804),ee(40998)],ye=function(oe,V,p){return Ne(oe,V,p)}.apply(Ze,N),ye!==void 0&&(Dt.exports=ye)},87804:function(Dt,Ze){var ee,N;(function(){var ye;(function(){"use strict";var oe=[,,function(ne){function l(g){this.__parent=g,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 g=new l(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},l.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},l.prototype.has_match=function(g){for(var x=this.__items.length-1;x>=0;x--)if(this.__items[x].match(g))return!0;return!1},l.prototype.set_indent=function(g,x){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=x||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 g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__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(g){this.__items.push(g);var x=g.lastIndexOf(`
|
|
`);x!==-1?this.__character_count=g.length-x:this.__character_count+=g.length},l.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},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 g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function z(g,x){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),x=x||"",g.indent_level>0&&(x=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=x,this.__base_string_length=x.length}z.prototype.get_indent_size=function(g,x){var y=this.__base_string_length;return x=x||0,g<0&&(y=0),y+=g*this.__indent_size,y+=x,y},z.prototype.get_indent_string=function(g,x){var y=this.__base_string;return x=x||0,g<0&&(g=0,y=""),x+=g*this.__indent_size,this.__ensure_cache(x),y+=this.__cache[x],y},z.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},z.prototype.__add_column=function(){var g=this.__cache.length,x=0,y="";this.__indent_size&&g>=this.__indent_size&&(x=Math.floor(g/this.__indent_size),g-=x*this.__indent_size,y=new Array(x+1).join(this.__indent_string)),g&&(y+=new Array(g+1).join(" ")),this.__cache.push(y)};function D(g,x){this.__indent_cache=new z(g,x),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.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()}D.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},D.prototype.get_line_number=function(){return this.__lines.length},D.prototype.get_indent_string=function(g,x){return this.__indent_cache.get_indent_string(g,x)},D.prototype.get_indent_size=function(g,x){return this.__indent_cache.get_indent_size(g,x)},D.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},D.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},D.prototype.get_code=function(g){this.trim(!0);var x=this.current_line.pop();x&&(x[x.length-1]===`
|
|
`&&(x=x.replace(/\n+$/g,"")),this.current_line.push(x)),this._end_with_newline&&this.__add_outputline();var y=this.__lines.join(`
|
|
`);return g!==`
|
|
`&&(y=y.replace(/[\n]/g,g)),y},D.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},D.prototype.set_indent=function(g,x){return g=g||0,x=x||0,this.next_line.set_indent(g,x),this.__lines.length>1?(this.current_line.set_indent(g,x),!0):(this.current_line.set_indent(),!1)},D.prototype.add_raw_token=function(g){for(var x=0;x<g.newlines;x++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},D.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},D.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(" "))},D.prototype.remove_indent=function(g){for(var x=this.__lines.length;g<x;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},D.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&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},D.prototype.just_added_newline=function(){return this.current_line.is_empty()},D.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},D.prototype.ensure_empty_line_above=function(g,x){for(var y=this.__lines.length-2;y>=0;){var b=this.__lines[y];if(b.is_empty())break;if(b.item(0).indexOf(g)!==0&&b.item(-1)!==x){this.__lines.splice(y+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}y--}},ne.exports.Output=D},,,,function(ne){function l(g,x){this.raw_options=z(g,x),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(g,x){var y=this.raw_options[g],b=x||[];return typeof y=="object"?y!==null&&typeof y.concat=="function"&&(b=y.concat()):typeof y=="string"&&(b=y.split(/[^a-zA-Z0-9_\/\-]+/)),b},l.prototype._get_boolean=function(g,x){var y=this.raw_options[g],b=y===void 0?!!x:!!y;return b},l.prototype._get_characters=function(g,x){var y=this.raw_options[g],b=x||"";return typeof y=="string"&&(b=y.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),b},l.prototype._get_number=function(g,x){var y=this.raw_options[g];x=parseInt(x,10),isNaN(x)&&(x=0);var b=parseInt(y,10);return isNaN(b)&&(b=x),b},l.prototype._get_selection=function(g,x,y){var b=this._get_selection_list(g,x,y);if(b.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
|
|
`+x+`
|
|
You passed in: '`+this.raw_options[g]+"'");return b[0]},l.prototype._get_selection_list=function(g,x,y){if(!x||x.length===0)throw new Error("Selection list cannot be empty.");if(y=y||[x[0]],!this._is_valid_selection(y,x))throw new Error("Invalid Default Value!");var b=this._get_array(g,y);if(!this._is_valid_selection(b,x))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
|
|
`+x+`
|
|
You passed in: '`+this.raw_options[g]+"'");return b},l.prototype._is_valid_selection=function(g,x){return g.length&&x.length&&!g.some(function(y){return x.indexOf(y)===-1})};function z(g,x){var y={};g=D(g);var b;for(b in g)b!==x&&(y[b]=g[b]);if(x&&g[x])for(b in g[x])y[b]=g[x][b];return y}function D(g){var x={},y;for(y in g){var b=y.replace(/-/g,"_");x[b]=g[y]}return x}ne.exports.Options=l,ne.exports.normalizeOpts=D,ne.exports.mergeOpts=z},,function(ne){var l=RegExp.prototype.hasOwnProperty("sticky");function z(D){this.__input=D||"",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 D=null;return this.hasNext()&&(D=this.__input.charAt(this.__position),this.__position+=1),D},z.prototype.peek=function(D){var g=null;return D=D||0,D+=this.__position,D>=0&&D<this.__input_length&&(g=this.__input.charAt(D)),g},z.prototype.__match=function(D,g){D.lastIndex=g;var x=D.exec(this.__input);return x&&!(l&&D.sticky)&&x.index!==g&&(x=null),x},z.prototype.test=function(D,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(D,g):!1},z.prototype.testChar=function(D,g){var x=this.peek(g);return D.lastIndex=0,x!==null&&D.test(x)},z.prototype.match=function(D){var g=this.__match(D,this.__position);return g?this.__position+=g[0].length:g=null,g},z.prototype.read=function(D,g,x){var y="",b;return D&&(b=this.match(D),b&&(y+=b[0])),g&&(b||!D)&&(y+=this.readUntil(g,x)),y},z.prototype.readUntil=function(D,g){var x="",y=this.__position;D.lastIndex=this.__position;var b=D.exec(this.__input);return b?(y=b.index,g&&(y+=b[0].length)):y=this.__input_length,x=this.__input.substring(this.__position,y),this.__position=y,x},z.prototype.readUntilAfter=function(D){return this.readUntil(D,!0)},z.prototype.get_regexp=function(D,g){var x=null,y="g";return g&&l&&(y="y"),typeof D=="string"&&D!==""?x=new RegExp(D,y):D&&(x=new RegExp(D.source,y)),x},z.prototype.get_literal_regexp=function(D){return RegExp(D.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},z.prototype.peekUntilAfter=function(D){var g=this.__position,x=this.readUntilAfter(D);return this.__position=g,x},z.prototype.lookBack=function(D){var g=this.__position-1;return g>=D.length&&this.__input.substring(g-D.length,g).toLowerCase()===D},ne.exports.InputScanner=z},,,,,function(ne){function l(z,D){z=typeof z=="string"?z:z.source,D=typeof D=="string"?D:D.source,this.__directives_block_pattern=new RegExp(z+/ beautify( \w+[:]\w+)+ /.source+D,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(z+/\sbeautify\signore:end\s/.source+D,"g")}l.prototype.get_directives=function(z){if(!z.match(this.__directives_block_pattern))return null;var D={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(z);g;)D[g[1]]=g[2],g=this.__directive_pattern.exec(z);return D},l.prototype.readIgnored=function(z){return z.readUntilAfter(this.__directives_end_ignore_pattern)},ne.exports.Directives=l},,function(ne,l,z){var D=z(16).Beautifier,g=z(17).Options;function x(y,b){var O=new D(y,b);return O.beautify()}ne.exports=x,ne.exports.defaultOptions=function(){return new g}},function(ne,l,z){var D=z(17).Options,g=z(2).Output,x=z(8).InputScanner,y=z(13).Directives,b=new y(/\/\*/,/\*\//),O=/\r\n|[\r\n]/,P=/\r\n|[\r\n]/g,F=/\s/,S=/(?:\s|\n)+/g,L=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,j=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function K(J,ie){this._source_text=J||"",this._options=new D(ie),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"]}K.prototype.eatString=function(J){var ie="";for(this._ch=this._input.next();this._ch;){if(ie+=this._ch,this._ch==="\\")ie+=this._input.next();else if(J.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return ie},K.prototype.eatWhitespace=function(J){for(var ie=F.test(this._input.peek()),W=0;F.test(this._input.peek());)this._ch=this._input.next(),J&&this._ch===`
|
|
`&&(W===0||W<this._options.max_preserve_newlines)&&(W++,this._output.add_new_line(!0));return ie},K.prototype.foundNestedPseudoClass=function(){for(var J=0,ie=1,W=this._input.peek(ie);W;){if(W==="{")return!0;if(W==="(")J+=1;else if(W===")"){if(J===0)return!1;J-=1}else if(W===";"||W==="}")return!1;ie++,W=this._input.peek(ie)}return!1},K.prototype.print_string=function(J){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(J)},K.prototype.preserveSingleSpace=function(J){J&&(this._output.space_before_token=!0)},K.prototype.indent=function(){this._indentLevel++},K.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},K.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var J=this._source_text,ie=this._options.eol;ie==="auto"&&(ie=`
|
|
`,J&&O.test(J||"")&&(ie=J.match(O)[0])),J=J.replace(P,`
|
|
`);var W=J.match(/^[\t ]*/)[0];this._output=new g(this._options,W),this._input=new x(J),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var te=0,fe=!1,me=!1,Pe=!1,M=!1,A=!1,C=this._ch,U=!1,Y,B,E;Y=this._input.read(S),B=Y!=="",E=C,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),C=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var _=this._input.read(L),R=b.get_directives(_);R&&R.ignore==="start"&&(_+=b.readIgnored(this._input)),this.print_string(_),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(j)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(B),this.print_string(this._ch);var q=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);q.match(/[ :]$/)&&(q=this.eatString(": ").replace(/\s+$/,""),this.print_string(q),this._output.space_before_token=!0),te===0&&q.indexOf(":")!==-1&&(me=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(B),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var Te=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Te.match(/[ :]$/)&&(Te=this.eatString(": ").replace(/\s+$/,""),this.print_string(Te),this._output.space_before_token=!0),te===0&&Te.indexOf(":")!==-1?(me=!0,this.indent()):Te in this.NESTED_AT_RULE?(this._nestedLevel+=1,Te in this.CONDITIONAL_GROUP_RULE&&(Pe=!0)):te===0&&!me&&(M=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(B),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")me&&(me=!1,this.outdent()),M=!1,Pe?(Pe=!1,fe=this._indentLevel>=this._nestedLevel):fe=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&fe&&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)):(E==="("?this._output.space_before_token=!1:E!==","&&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(),E==="{"&&this._output.trim(!0),me&&(this.outdent(),me=!1),this.print_string(this._ch),fe=!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 Re=0;Re<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Re++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Re])){U=!0;break}(fe||Pe)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!M&&te===0?(this.print_string(":"),me||(me=!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 Je=E==='"'||E==="'";this.preserveSingleSpace(Je||B),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")U=!1,te===0?(me&&(this.outdent(),me=!1),M=!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(),te++,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(")")),te&&(te--,this.outdent()));else{var He=!1;this._input.lookBack("with")&&(He=!0),this.preserveSingleSpace(B||He),this.print_string(this._ch),me&&E==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),A=!0):(this.eatWhitespace(),te++,this.indent())}else if(this._ch===")")te&&(te--,this.outdent()),A&&this._input.peek()===";"&&this._options.selector_separator_newline&&(A=!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&&(!me||A)&&te===0&&!M?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!me&&te===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&&F.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(B),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),F.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=E==='"'||E==="'";this.preserveSingleSpace(yt||B),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&U&&this._output.add_new_line()}var tt=this._output.get_code(ie);return tt},ne.exports.Beautifier=K},function(ne,l,z){var D=z(6).Options;function g(x){D.call(this,x,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var y=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||y;var b=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var O=0;O<b.length;O++)b[O]!=="expand"?this.brace_style="collapse":this.brace_style=b[O]}g.prototype=new D,ne.exports.Options=g}],V={};function p(ne){var l=V[ne];if(l!==void 0)return l.exports;var z=V[ne]={exports:{}};return oe[ne](z,z.exports,p),z.exports}var ge=p(15);ye=ge})();var Ne=ye;ee=[],N=function(){return{css_beautify:Ne}}.apply(Ze,ee),N!==void 0&&(Dt.exports=N)})()},40998:function(Dt,Ze,ee){var N,ye;(function(){var Ne;(function(){"use strict";var ge=[,,function(D){function g(b){this.__parent=b,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=[]}g.prototype.clone_empty=function(){var b=new g(this.__parent);return b.set_indent(this.__indent_count,this.__alignment_count),b},g.prototype.item=function(b){return b<0?this.__items[this.__items.length+b]:this.__items[b]},g.prototype.has_match=function(b){for(var O=this.__items.length-1;O>=0;O--)if(this.__items[O].match(b))return!0;return!1},g.prototype.set_indent=function(b,O){this.is_empty()&&(this.__indent_count=b||0,this.__alignment_count=O||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},g.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)},g.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},g.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var b=this.__parent.current_line;return b.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),b.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),b.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,b.__items[0]===" "&&(b.__items.splice(0,1),b.__character_count-=1),!0}return!1},g.prototype.is_empty=function(){return this.__items.length===0},g.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},g.prototype.push=function(b){this.__items.push(b);var O=b.lastIndexOf(`
|
|
`);O!==-1?this.__character_count=b.length-O:this.__character_count+=b.length},g.prototype.pop=function(){var b=null;return this.is_empty()||(b=this.__items.pop(),this.__character_count-=b.length),b},g.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},g.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},g.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},g.prototype.toString=function(){var b="";return this.is_empty()?this.__parent.indent_empty_lines&&(b=this.__parent.get_indent_string(this.__indent_count)):(b=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),b+=this.__items.join("")),b};function x(b,O){this.__cache=[""],this.__indent_size=b.indent_size,this.__indent_string=b.indent_char,b.indent_with_tabs||(this.__indent_string=new Array(b.indent_size+1).join(b.indent_char)),O=O||"",b.indent_level>0&&(O=new Array(b.indent_level+1).join(this.__indent_string)),this.__base_string=O,this.__base_string_length=O.length}x.prototype.get_indent_size=function(b,O){var P=this.__base_string_length;return O=O||0,b<0&&(P=0),P+=b*this.__indent_size,P+=O,P},x.prototype.get_indent_string=function(b,O){var P=this.__base_string;return O=O||0,b<0&&(b=0,P=""),O+=b*this.__indent_size,this.__ensure_cache(O),P+=this.__cache[O],P},x.prototype.__ensure_cache=function(b){for(;b>=this.__cache.length;)this.__add_column()},x.prototype.__add_column=function(){var b=this.__cache.length,O=0,P="";this.__indent_size&&b>=this.__indent_size&&(O=Math.floor(b/this.__indent_size),b-=O*this.__indent_size,P=new Array(O+1).join(this.__indent_string)),b&&(P+=new Array(b+1).join(" ")),this.__cache.push(P)};function y(b,O){this.__indent_cache=new x(b,O),this.raw=!1,this._end_with_newline=b.end_with_newline,this.indent_size=b.indent_size,this.wrap_line_length=b.wrap_line_length,this.indent_empty_lines=b.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new g(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}y.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},y.prototype.get_line_number=function(){return this.__lines.length},y.prototype.get_indent_string=function(b,O){return this.__indent_cache.get_indent_string(b,O)},y.prototype.get_indent_size=function(b,O){return this.__indent_cache.get_indent_size(b,O)},y.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},y.prototype.add_new_line=function(b){return this.is_empty()||!b&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},y.prototype.get_code=function(b){this.trim(!0);var O=this.current_line.pop();O&&(O[O.length-1]===`
|
|
`&&(O=O.replace(/\n+$/g,"")),this.current_line.push(O)),this._end_with_newline&&this.__add_outputline();var P=this.__lines.join(`
|
|
`);return b!==`
|
|
`&&(P=P.replace(/[\n]/g,b)),P},y.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},y.prototype.set_indent=function(b,O){return b=b||0,O=O||0,this.next_line.set_indent(b,O),this.__lines.length>1?(this.current_line.set_indent(b,O),!0):(this.current_line.set_indent(),!1)},y.prototype.add_raw_token=function(b){for(var O=0;O<b.newlines;O++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(b.whitespace_before),this.current_line.push(b.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},y.prototype.add_token=function(b){this.__add_space_before_token(),this.current_line.push(b),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},y.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},y.prototype.remove_indent=function(b){for(var O=this.__lines.length;b<O;)this.__lines[b]._remove_indent(),b++;this.current_line._remove_wrap_indent()},y.prototype.trim=function(b){for(b=b===void 0?!1:b,this.current_line.trim();b&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},y.prototype.just_added_newline=function(){return this.current_line.is_empty()},y.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},y.prototype.ensure_empty_line_above=function(b,O){for(var P=this.__lines.length-2;P>=0;){var F=this.__lines[P];if(F.is_empty())break;if(F.item(0).indexOf(b)!==0&&F.item(-1)!==O){this.__lines.splice(P+1,0,new g(this)),this.previous_line=this.__lines[this.__lines.length-2];break}P--}},D.exports.Output=y},function(D){function g(x,y,b,O){this.type=x,this.text=y,this.comments_before=null,this.newlines=b||0,this.whitespace_before=O||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}D.exports.Token=g},,,function(D){function g(b,O){this.raw_options=x(b,O),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"])}g.prototype._get_array=function(b,O){var P=this.raw_options[b],F=O||[];return typeof P=="object"?P!==null&&typeof P.concat=="function"&&(F=P.concat()):typeof P=="string"&&(F=P.split(/[^a-zA-Z0-9_\/\-]+/)),F},g.prototype._get_boolean=function(b,O){var P=this.raw_options[b],F=P===void 0?!!O:!!P;return F},g.prototype._get_characters=function(b,O){var P=this.raw_options[b],F=O||"";return typeof P=="string"&&(F=P.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),F},g.prototype._get_number=function(b,O){var P=this.raw_options[b];O=parseInt(O,10),isNaN(O)&&(O=0);var F=parseInt(P,10);return isNaN(F)&&(F=O),F},g.prototype._get_selection=function(b,O,P){var F=this._get_selection_list(b,O,P);if(F.length!==1)throw new Error("Invalid Option Value: The option '"+b+`' can only be one of the following values:
|
|
`+O+`
|
|
You passed in: '`+this.raw_options[b]+"'");return F[0]},g.prototype._get_selection_list=function(b,O,P){if(!O||O.length===0)throw new Error("Selection list cannot be empty.");if(P=P||[O[0]],!this._is_valid_selection(P,O))throw new Error("Invalid Default Value!");var F=this._get_array(b,P);if(!this._is_valid_selection(F,O))throw new Error("Invalid Option Value: The option '"+b+`' can contain only the following values:
|
|
`+O+`
|
|
You passed in: '`+this.raw_options[b]+"'");return F},g.prototype._is_valid_selection=function(b,O){return b.length&&O.length&&!b.some(function(P){return O.indexOf(P)===-1})};function x(b,O){var P={};b=y(b);var F;for(F in b)F!==O&&(P[F]=b[F]);if(O&&b[O])for(F in b[O])P[F]=b[O][F];return P}function y(b){var O={},P;for(P in b){var F=P.replace(/-/g,"_");O[F]=b[P]}return O}D.exports.Options=g,D.exports.normalizeOpts=y,D.exports.mergeOpts=x},,function(D){var g=RegExp.prototype.hasOwnProperty("sticky");function x(y){this.__input=y||"",this.__input_length=this.__input.length,this.__position=0}x.prototype.restart=function(){this.__position=0},x.prototype.back=function(){this.__position>0&&(this.__position-=1)},x.prototype.hasNext=function(){return this.__position<this.__input_length},x.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__input.charAt(this.__position),this.__position+=1),y},x.prototype.peek=function(y){var b=null;return y=y||0,y+=this.__position,y>=0&&y<this.__input_length&&(b=this.__input.charAt(y)),b},x.prototype.__match=function(y,b){y.lastIndex=b;var O=y.exec(this.__input);return O&&!(g&&y.sticky)&&O.index!==b&&(O=null),O},x.prototype.test=function(y,b){return b=b||0,b+=this.__position,b>=0&&b<this.__input_length?!!this.__match(y,b):!1},x.prototype.testChar=function(y,b){var O=this.peek(b);return y.lastIndex=0,O!==null&&y.test(O)},x.prototype.match=function(y){var b=this.__match(y,this.__position);return b?this.__position+=b[0].length:b=null,b},x.prototype.read=function(y,b,O){var P="",F;return y&&(F=this.match(y),F&&(P+=F[0])),b&&(F||!y)&&(P+=this.readUntil(b,O)),P},x.prototype.readUntil=function(y,b){var O="",P=this.__position;y.lastIndex=this.__position;var F=y.exec(this.__input);return F?(P=F.index,b&&(P+=F[0].length)):P=this.__input_length,O=this.__input.substring(this.__position,P),this.__position=P,O},x.prototype.readUntilAfter=function(y){return this.readUntil(y,!0)},x.prototype.get_regexp=function(y,b){var O=null,P="g";return b&&g&&(P="y"),typeof y=="string"&&y!==""?O=new RegExp(y,P):y&&(O=new RegExp(y.source,P)),O},x.prototype.get_literal_regexp=function(y){return RegExp(y.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},x.prototype.peekUntilAfter=function(y){var b=this.__position,O=this.readUntilAfter(y);return this.__position=b,O},x.prototype.lookBack=function(y){var b=this.__position-1;return b>=y.length&&this.__input.substring(b-y.length,b).toLowerCase()===y},D.exports.InputScanner=x},function(D,g,x){var y=x(8).InputScanner,b=x(3).Token,O=x(10).TokenStream,P=x(11).WhitespacePattern,F={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},S=function(L,j){this._input=new y(L),this._options=j||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new P(this._input)};S.prototype.tokenize=function(){this._input.restart(),this.__tokens=new O,this._reset();for(var L,j=new b(F.START,""),K=null,J=[],ie=new O;j.type!==F.EOF;){for(L=this._get_next_token(j,K);this._is_comment(L);)ie.add(L),L=this._get_next_token(j,K);ie.isEmpty()||(L.comments_before=ie,ie=new O),L.parent=K,this._is_opening(L)?(J.push(K),K=L):K&&this._is_closing(L,K)&&(L.opened=K,K.closed=L,K=J.pop(),L.parent=K),L.previous=j,j.next=L,this.__tokens.add(L),j=L}return this.__tokens},S.prototype._is_first_token=function(){return this.__tokens.isEmpty()},S.prototype._reset=function(){},S.prototype._get_next_token=function(L,j){this._readWhitespace();var K=this._input.read(/.+/g);return K?this._create_token(F.RAW,K):this._create_token(F.EOF,"")},S.prototype._is_comment=function(L){return!1},S.prototype._is_opening=function(L){return!1},S.prototype._is_closing=function(L,j){return!1},S.prototype._create_token=function(L,j){var K=new b(L,j,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return K},S.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},D.exports.Tokenizer=S,D.exports.TOKEN=F},function(D){function g(x){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=x}g.prototype.restart=function(){this.__position=0},g.prototype.isEmpty=function(){return this.__tokens_length===0},g.prototype.hasNext=function(){return this.__position<this.__tokens_length},g.prototype.next=function(){var x=null;return this.hasNext()&&(x=this.__tokens[this.__position],this.__position+=1),x},g.prototype.peek=function(x){var y=null;return x=x||0,x+=this.__position,x>=0&&x<this.__tokens_length&&(y=this.__tokens[x]),y},g.prototype.add=function(x){this.__parent_token&&(x.parent=this.__parent_token),this.__tokens.push(x),this.__tokens_length+=1},D.exports.TokenStream=g},function(D,g,x){var y=x(12).Pattern;function b(O,P){y.call(this,O,P),P?this._line_regexp=this._input.get_regexp(P._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}b.prototype=new y,b.prototype.__set_whitespace_patterns=function(O,P){O+="\\t ",P+="\\n\\r",this._match_pattern=this._input.get_regexp("["+O+P+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+P+"]")},b.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var O=this._input.read(this._match_pattern);if(O===" ")this.whitespace_before_token=" ";else if(O){var P=this.__split(this._newline_regexp,O);this.newline_count=P.length-1,this.whitespace_before_token=P[this.newline_count]}return O},b.prototype.matching=function(O,P){var F=this._create();return F.__set_whitespace_patterns(O,P),F._update(),F},b.prototype._create=function(){return new b(this._input,this)},b.prototype.__split=function(O,P){O.lastIndex=0;for(var F=0,S=[],L=O.exec(P);L;)S.push(P.substring(F,L.index)),F=L.index+L[0].length,L=O.exec(P);return F<P.length?S.push(P.substring(F,P.length)):S.push(""),S},D.exports.WhitespacePattern=b},function(D){function g(x,y){this._input=x,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,y&&(this._starting_pattern=this._input.get_regexp(y._starting_pattern,!0),this._match_pattern=this._input.get_regexp(y._match_pattern,!0),this._until_pattern=this._input.get_regexp(y._until_pattern),this._until_after=y._until_after)}g.prototype.read=function(){var x=this._input.read(this._starting_pattern);return(!this._starting_pattern||x)&&(x+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),x},g.prototype.read_match=function(){return this._input.match(this._match_pattern)},g.prototype.until_after=function(x){var y=this._create();return y._until_after=!0,y._until_pattern=this._input.get_regexp(x),y._update(),y},g.prototype.until=function(x){var y=this._create();return y._until_after=!1,y._until_pattern=this._input.get_regexp(x),y._update(),y},g.prototype.starting_with=function(x){var y=this._create();return y._starting_pattern=this._input.get_regexp(x,!0),y._update(),y},g.prototype.matching=function(x){var y=this._create();return y._match_pattern=this._input.get_regexp(x,!0),y._update(),y},g.prototype._create=function(){return new g(this._input,this)},g.prototype._update=function(){},D.exports.Pattern=g},function(D){function g(x,y){x=typeof x=="string"?x:x.source,y=typeof y=="string"?y:y.source,this.__directives_block_pattern=new RegExp(x+/ beautify( \w+[:]\w+)+ /.source+y,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(x+/\sbeautify\signore:end\s/.source+y,"g")}g.prototype.get_directives=function(x){if(!x.match(this.__directives_block_pattern))return null;var y={};this.__directive_pattern.lastIndex=0;for(var b=this.__directive_pattern.exec(x);b;)y[b[1]]=b[2],b=this.__directive_pattern.exec(x);return y},g.prototype.readIgnored=function(x){return x.readUntilAfter(this.__directives_end_ignore_pattern)},D.exports.Directives=g},function(D,g,x){var y=x(12).Pattern,b={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function O(P,F){y.call(this,P,F),this.__template_pattern=null,this._disabled=Object.assign({},b),this._excluded=Object.assign({},b),F&&(this.__template_pattern=this._input.get_regexp(F.__template_pattern),this._excluded=Object.assign(this._excluded,F._excluded),this._disabled=Object.assign(this._disabled,F._disabled));var S=new y(P);this.__patterns={handlebars_comment:S.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:S.starting_with(/{{{/).until_after(/}}}/),handlebars:S.starting_with(/{{/).until_after(/}}/),php:S.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:S.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:S.starting_with(/{%/).until_after(/%}/),django_value:S.starting_with(/{{/).until_after(/}}/),django_comment:S.starting_with(/{#/).until_after(/#}/),smarty:S.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:S.starting_with(/{\*/).until_after(/\*}/),smarty_literal:S.starting_with(/{literal}/).until_after(/{\/literal}/)}}O.prototype=new y,O.prototype._create=function(){return new O(this._input,this)},O.prototype._update=function(){this.__set_templated_pattern()},O.prototype.disable=function(P){var F=this._create();return F._disabled[P]=!0,F._update(),F},O.prototype.read_options=function(P){var F=this._create();for(var S in b)F._disabled[S]=P.templating.indexOf(S)===-1;return F._update(),F},O.prototype.exclude=function(P){var F=this._create();return F._excluded[P]=!0,F._update(),F},O.prototype.read=function(){var P="";this._match_pattern?P=this._input.read(this._starting_pattern):P=this._input.read(this._starting_pattern,this.__template_pattern);for(var F=this._read_template();F;)this._match_pattern?F+=this._input.read(this._match_pattern):F+=this._input.readUntil(this.__template_pattern),P+=F,F=this._read_template();return this._until_after&&(P+=this._input.readUntilAfter(this._until_pattern)),P},O.prototype.__set_templated_pattern=function(){var P=[];this._disabled.php||P.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||P.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||P.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||P.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(P.push(this.__patterns.django._starting_pattern.source),P.push(this.__patterns.django_value._starting_pattern.source),P.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||P.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&P.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+P.join("|")+")")},O.prototype._read_template=function(){var P="",F=this._input.peek();if(F==="<"){var S=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&S==="?"&&(P=P||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&S==="%"&&(P=P||this.__patterns.erb.read())}else F==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(P=P||this.__patterns.handlebars_comment.read(),P=P||this.__patterns.handlebars_unescaped.read(),P=P||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(P=P||this.__patterns.django_value.read()),this._excluded.django||(P=P||this.__patterns.django_comment.read(),P=P||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(P=P||this.__patterns.smarty_comment.read(),P=P||this.__patterns.smarty_literal.read(),P=P||this.__patterns.smarty.read()));return P},D.exports.TemplatablePattern=O},,,,function(D,g,x){var y=x(19).Beautifier,b=x(20).Options;function O(P,F,S,L){var j=new y(P,F,S,L);return j.beautify()}D.exports=O,D.exports.defaultOptions=function(){return new b}},function(D,g,x){var y=x(20).Options,b=x(2).Output,O=x(21).Tokenizer,P=x(21).TOKEN,F=/\r\n|[\r\n]/,S=/\r\n|[\r\n]/g,L=function(M,A){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=M.max_preserve_newlines,this.preserve_newlines=M.preserve_newlines,this._output=new b(M,A)};L.prototype.current_line_has_match=function(M){return this._output.current_line.has_match(M)},L.prototype.set_space_before_token=function(M,A){this._output.space_before_token=M,this._output.non_breaking_space=A},L.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},L.prototype.add_raw_token=function(M){this._output.add_raw_token(M)},L.prototype.print_preserved_newlines=function(M){var A=0;M.type!==P.TEXT&&M.previous.type!==P.TEXT&&(A=M.newlines?1:0),this.preserve_newlines&&(A=M.newlines<this.max_preserve_newlines+1?M.newlines:this.max_preserve_newlines+1);for(var C=0;C<A;C++)this.print_newline(C>0);return A!==0},L.prototype.traverse_whitespace=function(M){return M.whitespace_before||M.newlines?(this.print_preserved_newlines(M)||(this._output.space_before_token=!0),!0):!1},L.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},L.prototype.print_newline=function(M){this._output.add_new_line(M)},L.prototype.print_token=function(M){M.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(M.text))},L.prototype.indent=function(){this.indent_level++},L.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},L.prototype.get_full_indent=function(M){return M=this.indent_level+(M||0),M<1?"":this._output.get_indent_string(M)};var j=function(M){for(var A=null,C=M.next;C.type!==P.EOF&&M.closed!==C;){if(C.type===P.ATTRIBUTE&&C.text==="type"){C.next&&C.next.type===P.EQUALS&&C.next.next&&C.next.next.type===P.VALUE&&(A=C.next.next.text);break}C=C.next}return A},K=function(M,A){var C=null,U=null;return A.closed?(M==="script"?C="text/javascript":M==="style"&&(C="text/css"),C=j(A)||C,C.search("text/css")>-1?U="css":C.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?U="javascript":C.search(/(text|application|dojo)\/(x-)?(html)/)>-1?U="html":C.search(/test\/null/)>-1&&(U="null"),U):null};function J(M,A){return A.indexOf(M)!==-1}function ie(M,A,C){this.parent=M||null,this.tag=A?A.tag_name:"",this.indent_level=C||0,this.parser_token=A||null}function W(M){this._printer=M,this._current_frame=null}W.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},W.prototype.record_tag=function(M){var A=new ie(this._current_frame,M,this._printer.indent_level);this._current_frame=A},W.prototype._try_pop_frame=function(M){var A=null;return M&&(A=M.parser_token,this._printer.indent_level=M.indent_level,this._current_frame=M.parent),A},W.prototype._get_frame=function(M,A){for(var C=this._current_frame;C&&M.indexOf(C.tag)===-1;){if(A&&A.indexOf(C.tag)!==-1){C=null;break}C=C.parent}return C},W.prototype.try_pop=function(M,A){var C=this._get_frame([M],A);return this._try_pop_frame(C)},W.prototype.indent_to_tag=function(M){var A=this._get_frame(M);A&&(this._printer.indent_level=A.indent_level)};function te(M,A,C,U){this._source_text=M||"",A=A||{},this._js_beautify=C,this._css_beautify=U,this._tag_stack=null;var Y=new y(A,"html");this._options=Y,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"}te.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var M=this._source_text,A=this._options.eol;this._options.eol==="auto"&&(A=`
|
|
`,M&&F.test(M)&&(A=M.match(F)[0])),M=M.replace(S,`
|
|
`);var C=M.match(/^[\t ]*/)[0],U={text:"",type:""},Y=new fe(this._options),B=new L(this._options,C),E=new O(M,this._options).tokenize();this._tag_stack=new W(B);for(var _=null,R=E.next();R.type!==P.EOF;)R.type===P.TAG_OPEN||R.type===P.COMMENT?(_=this._handle_tag_open(B,R,Y,U,E),Y=_):R.type===P.ATTRIBUTE||R.type===P.EQUALS||R.type===P.VALUE||R.type===P.TEXT&&!Y.tag_complete?_=this._handle_inside_tag(B,R,Y,U):R.type===P.TAG_CLOSE?_=this._handle_tag_close(B,R,Y):R.type===P.TEXT?_=this._handle_text(B,R,Y):R.type===P.CONTROL_FLOW_OPEN?_=this._handle_control_flow_open(B,R):R.type===P.CONTROL_FLOW_CLOSE?_=this._handle_control_flow_close(B,R):B.add_raw_token(R),U=_,R=E.next();var q=B._output.get_code(A);return q},te.prototype._handle_control_flow_open=function(M,A){var C={text:A.text,type:A.type};return M.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),A.newlines?M.print_preserved_newlines(A):M.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),M.print_token(A),M.indent(),C},te.prototype._handle_control_flow_close=function(M,A){var C={text:A.text,type:A.type};return M.deindent(),A.newlines?M.print_preserved_newlines(A):M.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),M.print_token(A),C},te.prototype._handle_tag_close=function(M,A,C){var U={text:A.text,type:A.type};return M.alignment_size=0,C.tag_complete=!0,M.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),C.is_unformatted?M.add_raw_token(A):(C.tag_start_char==="<"&&(M.set_space_before_token(A.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&C.has_wrapped_attrs&&M.print_newline(!1)),M.print_token(A)),C.indent_content&&!(C.is_unformatted||C.is_content_unformatted)&&(M.indent(),C.indent_content=!1),!C.is_inline_element&&!(C.is_unformatted||C.is_content_unformatted)&&M.set_wrap_point(),U},te.prototype._handle_inside_tag=function(M,A,C,U){var Y=C.has_wrapped_attrs,B={text:A.text,type:A.type};return M.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),C.is_unformatted?M.add_raw_token(A):C.tag_start_char==="{"&&A.type===P.TEXT?M.print_preserved_newlines(A)?(A.newlines=0,M.add_raw_token(A)):M.print_token(A):(A.type===P.ATTRIBUTE?M.set_space_before_token(!0):(A.type===P.EQUALS||A.type===P.VALUE&&A.previous.type===P.EQUALS)&&M.set_space_before_token(!1),A.type===P.ATTRIBUTE&&C.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(M.traverse_whitespace(A),Y=Y||A.newlines!==0),this._is_wrap_attributes_force&&C.attr_count>=this._options.wrap_attributes_min_attrs&&(U.type!==P.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(M.print_newline(!1),Y=!0)),M.print_token(A),Y=Y||M.previous_token_wrapped(),C.has_wrapped_attrs=Y),B},te.prototype._handle_text=function(M,A,C){var U={text:A.text,type:"TK_CONTENT"};return C.custom_beautifier_name?this._print_custom_beatifier_text(M,A,C):C.is_unformatted||C.is_content_unformatted?M.add_raw_token(A):(M.traverse_whitespace(A),M.print_token(A)),U},te.prototype._print_custom_beatifier_text=function(M,A,C){var U=this;if(A.text!==""){var Y=A.text,B,E=1,_="",R="";C.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?B=this._js_beautify:C.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?B=this._css_beautify:C.custom_beautifier_name==="html"&&(B=function(yt,tt){var Ke=new te(yt,tt,U._js_beautify,U._css_beautify);return Ke.beautify()}),this._options.indent_scripts==="keep"?E=0:this._options.indent_scripts==="separate"&&(E=-M.indent_level);var q=M.get_full_indent(E);if(Y=Y.replace(/\n[ \t]*$/,""),C.custom_beautifier_name!=="html"&&Y[0]==="<"&&Y.match(/^(<!--|<!\[CDATA\[)/)){var Te=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(Y);if(!Te){M.add_raw_token(A);return}_=q+Te[1]+`
|
|
`,Y=Te[4],Te[5]&&(R=q+Te[5]),Y=Y.replace(/\n[ \t]*$/,""),(Te[2]||Te[3].indexOf(`
|
|
`)!==-1)&&(Te=Te[3].match(/[ \t]+$/),Te&&(A.whitespace_before=Te[0]))}if(Y)if(B){var Re=function(){this.eol=`
|
|
`};Re.prototype=this._options.raw_options;var Je=new Re;Y=B(q+Y,Je)}else{var He=A.whitespace_before;He&&(Y=Y.replace(new RegExp(`
|
|
(`+He+")?","g"),`
|
|
`)),Y=q+Y.replace(/\n/g,`
|
|
`+q)}_&&(Y?Y=_+Y+`
|
|
`+R:Y=_+R),M.print_newline(!1),Y&&(A.text=Y,A.whitespace_before="",A.newlines=0,M.add_raw_token(A),M.print_newline(!0))}},te.prototype._handle_tag_open=function(M,A,C,U,Y){var B=this._get_tag_open_token(A);if((C.is_unformatted||C.is_content_unformatted)&&!C.is_empty_element&&A.type===P.TAG_OPEN&&!B.is_start_tag?(M.add_raw_token(A),B.start_tag_token=this._tag_stack.try_pop(B.tag_name)):(M.traverse_whitespace(A),this._set_tag_position(M,A,B,C,U),B.is_inline_element||M.set_wrap_point(),M.print_token(A)),B.is_start_tag&&this._is_wrap_attributes_force){var E=0,_;do _=Y.peek(E),_.type===P.ATTRIBUTE&&(B.attr_count+=1),E+=1;while(_.type!==P.EOF&&_.type!==P.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(B.alignment_size=A.text.length+1),!B.tag_complete&&!B.is_unformatted&&(M.alignment_size=B.alignment_size),B};var fe=function(M,A,C){if(this.parent=A||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="",!C)this.tag_complete=!0;else{var U;this.tag_start_char=C.text[0],this.text=C.text,this.tag_start_char==="<"?(U=C.text.match(/^<([^\s>]*)/),this.tag_check=U?U[1]:""):(U=C.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=U?U[1]:"",(C.text.startsWith("{{#>")||C.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&C.next!==null?this.tag_check=C.next.text.split(" ")[0]:this.tag_check=C.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),C.type===P.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||C.closed&&C.closed.text==="/>";var Y=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(Y=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!M.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(Y)))}};te.prototype._get_tag_open_token=function(M){var A=new fe(this._options,this._tag_stack.get_parser_token(),M);return A.alignment_size=this._options.wrap_attributes_indent_size,A.is_end_tag=A.is_end_tag||J(A.tag_check,this._options.void_elements),A.is_empty_element=A.tag_complete||A.is_start_tag&&A.is_end_tag,A.is_unformatted=!A.tag_complete&&J(A.tag_check,this._options.unformatted),A.is_content_unformatted=!A.is_empty_element&&J(A.tag_check,this._options.content_unformatted),A.is_inline_element=J(A.tag_name,this._options.inline)||this._options.inline_custom_elements&&A.tag_name.includes("-")||A.tag_start_char==="{",A},te.prototype._set_tag_position=function(M,A,C,U,Y){if(C.is_empty_element||(C.is_end_tag?C.start_tag_token=this._tag_stack.try_pop(C.tag_name):(this._do_optional_end_element(C)&&(C.is_inline_element||M.print_newline(!1)),this._tag_stack.record_tag(C),(C.tag_name==="script"||C.tag_name==="style")&&!(C.is_unformatted||C.is_content_unformatted)&&(C.custom_beautifier_name=K(C.tag_check,A)))),J(C.tag_check,this._options.extra_liners)&&(M.print_newline(!1),M._output.just_added_blankline()||M.print_newline(!0)),C.is_empty_element){if(C.tag_start_char==="{"&&C.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),C.indent_content=!0;var B=M.current_line_has_match(/{{#if/);B||M.print_newline(!1)}C.tag_name==="!--"&&Y.type===P.TAG_CLOSE&&U.is_end_tag&&C.text.indexOf(`
|
|
`)===-1||(C.is_inline_element||C.is_unformatted||M.print_newline(!1),this._calcluate_parent_multiline(M,C))}else if(C.is_end_tag){var E=!1;E=C.start_tag_token&&C.start_tag_token.multiline_content,E=E||!C.is_inline_element&&!(U.is_inline_element||U.is_unformatted)&&!(Y.type===P.TAG_CLOSE&&C.start_tag_token===U)&&Y.type!=="TK_CONTENT",(C.is_content_unformatted||C.is_unformatted)&&(E=!1),E&&M.print_newline(!1)}else C.indent_content=!C.custom_beautifier_name,C.tag_start_char==="<"&&(C.tag_name==="html"?C.indent_content=this._options.indent_inner_html:C.tag_name==="head"?C.indent_content=this._options.indent_head_inner_html:C.tag_name==="body"&&(C.indent_content=this._options.indent_body_inner_html)),!(C.is_inline_element||C.is_unformatted)&&(Y.type!=="TK_CONTENT"||C.is_content_unformatted)&&M.print_newline(!1),this._calcluate_parent_multiline(M,C)},te.prototype._calcluate_parent_multiline=function(M,A){A.parent&&M._output.just_added_newline()&&!((A.is_inline_element||A.is_unformatted)&&A.parent.is_inline_element)&&(A.parent.multiline_content=!0)};var me=["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"],Pe=["a","audio","del","ins","map","noscript","video"];te.prototype._do_optional_end_element=function(M){var A=null;if(!(M.is_empty_element||!M.is_start_tag||!M.parent)){if(M.tag_name==="body")A=A||this._tag_stack.try_pop("head");else if(M.tag_name==="li")A=A||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(M.tag_name==="dd"||M.tag_name==="dt")A=A||this._tag_stack.try_pop("dt",["dl"]),A=A||this._tag_stack.try_pop("dd",["dl"]);else if(M.parent.tag_name==="p"&&me.indexOf(M.tag_name)!==-1){var C=M.parent.parent;(!C||Pe.indexOf(C.tag_name)===-1)&&(A=A||this._tag_stack.try_pop("p"))}else M.tag_name==="rp"||M.tag_name==="rt"?(A=A||this._tag_stack.try_pop("rt",["ruby","rtc"]),A=A||this._tag_stack.try_pop("rp",["ruby","rtc"])):M.tag_name==="optgroup"?A=A||this._tag_stack.try_pop("optgroup",["select"]):M.tag_name==="option"?A=A||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):M.tag_name==="colgroup"?A=A||this._tag_stack.try_pop("caption",["table"]):M.tag_name==="thead"?(A=A||this._tag_stack.try_pop("caption",["table"]),A=A||this._tag_stack.try_pop("colgroup",["table"])):M.tag_name==="tbody"||M.tag_name==="tfoot"?(A=A||this._tag_stack.try_pop("caption",["table"]),A=A||this._tag_stack.try_pop("colgroup",["table"]),A=A||this._tag_stack.try_pop("thead",["table"]),A=A||this._tag_stack.try_pop("tbody",["table"])):M.tag_name==="tr"?(A=A||this._tag_stack.try_pop("caption",["table"]),A=A||this._tag_stack.try_pop("colgroup",["table"]),A=A||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(M.tag_name==="th"||M.tag_name==="td")&&(A=A||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),A=A||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return M.parent=this._tag_stack.get_parser_token(),A}},D.exports.Beautifier=te},function(D,g,x){var y=x(6).Options;function b(O){y.call(this,O,"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"])}b.prototype=new y,D.exports.Options=b},function(D,g,x){var y=x(9).Tokenizer,b=x(9).TOKEN,O=x(13).Directives,P=x(14).TemplatablePattern,F=x(12).Pattern,S={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:b.START,RAW:b.RAW,EOF:b.EOF},L=new O(/<\!--/,/-->/),j=function(K,J){y.call(this,K,J),this._current_tag_name="";var ie=new P(this._input).read_options(this._options),W=new F(this._input);if(this.__patterns={word:ie.until(/[\n\r\t <]/),word_control_flow_close_excluded:ie.until(/[\n\r\t <}]/),single_quote:ie.until_after(/'/),double_quote:ie.until_after(/"/),attribute:ie.until(/[\n\r\t =>]|\/>/),element_name:ie.until(/[\n\r\t >\/]/),angular_control_flow_start:W.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:W.starting_with(/{{!--/).until_after(/--}}/),handlebars:W.starting_with(/{{/).until_after(/}}/),handlebars_open:W.until(/[\n\r\t }]/),handlebars_raw_close:W.until(/}}/),comment:W.starting_with(/<!--/).until_after(/-->/),cdata:W.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:W.starting_with(/<!\[/).until_after(/]>/),processing:W.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 te=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=W.matching(te).until_after(te)}};j.prototype=new y,j.prototype._is_comment=function(K){return!1},j.prototype._is_opening=function(K){return K.type===S.TAG_OPEN||K.type===S.CONTROL_FLOW_OPEN},j.prototype._is_closing=function(K,J){return K.type===S.TAG_CLOSE&&J&&((K.text===">"||K.text==="/>")&&J.text[0]==="<"||K.text==="}}"&&J.text[0]==="{"&&J.text[1]==="{")||K.type===S.CONTROL_FLOW_CLOSE&&K.text==="}"&&J.text.endsWith("{")},j.prototype._reset=function(){this._current_tag_name=""},j.prototype._get_next_token=function(K,J){var ie=null;this._readWhitespace();var W=this._input.peek();return W===null?this._create_token(S.EOF,""):(ie=ie||this._read_open_handlebars(W,J),ie=ie||this._read_attribute(W,K,J),ie=ie||this._read_close(W,J),ie=ie||this._read_script_and_style(W,K),ie=ie||this._read_control_flows(W,J),ie=ie||this._read_raw_content(W,K,J),ie=ie||this._read_content_word(W,J),ie=ie||this._read_comment_or_cdata(W),ie=ie||this._read_processing(W),ie=ie||this._read_open(W,J),ie=ie||this._create_token(S.UNKNOWN,this._input.next()),ie)},j.prototype._read_comment_or_cdata=function(K){var J=null,ie=null,W=null;if(K==="<"){var te=this._input.peek(1);te==="!"&&(ie=this.__patterns.comment.read(),ie?(W=L.get_directives(ie),W&&W.ignore==="start"&&(ie+=L.readIgnored(this._input))):ie=this.__patterns.cdata.read()),ie&&(J=this._create_token(S.COMMENT,ie),J.directives=W)}return J},j.prototype._read_processing=function(K){var J=null,ie=null,W=null;if(K==="<"){var te=this._input.peek(1);(te==="!"||te==="?")&&(ie=this.__patterns.conditional_comment.read(),ie=ie||this.__patterns.processing.read()),ie&&(J=this._create_token(S.COMMENT,ie),J.directives=W)}return J},j.prototype._read_open=function(K,J){var ie=null,W=null;return(!J||J.type===S.CONTROL_FLOW_OPEN)&&K==="<"&&(ie=this._input.next(),this._input.peek()==="/"&&(ie+=this._input.next()),ie+=this.__patterns.element_name.read(),W=this._create_token(S.TAG_OPEN,ie)),W},j.prototype._read_open_handlebars=function(K,J){var ie=null,W=null;return(!J||J.type===S.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&K==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(ie=this.__patterns.handlebars_comment.read(),ie=ie||this.__patterns.handlebars.read(),W=this._create_token(S.COMMENT,ie)):(ie=this.__patterns.handlebars_open.read(),W=this._create_token(S.TAG_OPEN,ie))),W},j.prototype._read_control_flows=function(K,J){var ie="",W=null;if(!this._options.templating.includes("angular"))return W;if(K==="@"){if(ie=this.__patterns.angular_control_flow_start.read(),ie==="")return W;for(var te=ie.endsWith("(")?1:0,fe=0;!(ie.endsWith("{")&&te===fe);){var me=this._input.next();if(me===null)break;me==="("?te++:me===")"&&fe++,ie+=me}W=this._create_token(S.CONTROL_FLOW_OPEN,ie)}else K==="}"&&J&&J.type===S.CONTROL_FLOW_OPEN&&(ie=this._input.next(),W=this._create_token(S.CONTROL_FLOW_CLOSE,ie));return W},j.prototype._read_close=function(K,J){var ie=null,W=null;return J&&J.type===S.TAG_OPEN&&(J.text[0]==="<"&&(K===">"||K==="/"&&this._input.peek(1)===">")?(ie=this._input.next(),K==="/"&&(ie+=this._input.next()),W=this._create_token(S.TAG_CLOSE,ie)):J.text[0]==="{"&&K==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),W=this._create_token(S.TAG_CLOSE,"}}"))),W},j.prototype._read_attribute=function(K,J,ie){var W=null,te="";if(ie&&ie.text[0]==="<")if(K==="=")W=this._create_token(S.EQUALS,this._input.next());else if(K==='"'||K==="'"){var fe=this._input.next();K==='"'?fe+=this.__patterns.double_quote.read():fe+=this.__patterns.single_quote.read(),W=this._create_token(S.VALUE,fe)}else te=this.__patterns.attribute.read(),te&&(J.type===S.EQUALS?W=this._create_token(S.VALUE,te):W=this._create_token(S.ATTRIBUTE,te));return W},j.prototype._is_content_unformatted=function(K){return this._options.void_elements.indexOf(K)===-1&&(this._options.content_unformatted.indexOf(K)!==-1||this._options.unformatted.indexOf(K)!==-1)},j.prototype._read_raw_content=function(K,J,ie){var W="";if(ie&&ie.text[0]==="{")W=this.__patterns.handlebars_raw_close.read();else if(J.type===S.TAG_CLOSE&&J.opened.text[0]==="<"&&J.text[0]!=="/"){var te=J.opened.text.substr(1).toLowerCase();this._is_content_unformatted(te)&&(W=this._input.readUntil(new RegExp("</"+te+"[\\n\\r\\t ]*?>","ig")))}return W?this._create_token(S.TEXT,W):null},j.prototype._read_script_and_style=function(K,J){if(J.type===S.TAG_CLOSE&&J.opened.text[0]==="<"&&J.text[0]!=="/"){var ie=J.opened.text.substr(1).toLowerCase();if(ie==="script"||ie==="style"){var W=this._read_comment_or_cdata(K);if(W)return W.type=S.TEXT,W;var te=this._input.readUntil(new RegExp("</"+ie+"[\\n\\r\\t ]*?>","ig"));if(te)return this._create_token(S.TEXT,te)}}return null},j.prototype._read_content_word=function(K,J){var ie="";return this._options.unformatted_content_delimiter&&K===this._options.unformatted_content_delimiter[0]&&(ie=this.__patterns.unformatted_content_delimiter.read()),ie||(ie=J&&J.type===S.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),ie?this._create_token(S.TEXT,ie):null},D.exports.Tokenizer=j,D.exports.TOKEN=S}],ne={};function l(D){var g=ne[D];if(g!==void 0)return g.exports;var x=ne[D]={exports:{}};return ge[D](x,x.exports,l),x.exports}var z=l(18);Ne=z})();var oe=Ne;if(1)N=[ee,ee(58553),ee(87804)],ye=function(ge){var ne=ee(58553),l=ee(87804);return{html_beautify:function(z,D){return oe(z,D,ne.js_beautify,l.css_beautify)}}}.apply(Ze,N),ye!==void 0&&(Dt.exports=ye);else var V,p})()},58553:function(Dt,Ze){var ee,N;(function(){var ye;(function(){"use strict";var oe=[function(ne,l,z){var D=z(1).Beautifier,g=z(5).Options;function x(y,b){var O=new D(y,b);return O.beautify()}ne.exports=x,ne.exports.defaultOptions=function(){return new g}},function(ne,l,z){var D=z(2).Output,g=z(3).Token,x=z(4),y=z(5).Options,b=z(7).Tokenizer,O=z(7).line_starters,P=z(7).positionable_operators,F=z(7).TOKEN;function S(_,R){return R.indexOf(_)!==-1}function L(_){return _.replace(/^\s+/g,"")}function j(_){for(var R={},q=0;q<_.length;q++)R[_[q].replace(/-/g,"_")]=_[q];return R}function K(_,R){return _&&_.type===F.RESERVED&&_.text===R}function J(_,R){return _&&_.type===F.RESERVED&&S(_.text,R)}var ie=["case","return","do","if","throw","else","await","break","continue","async"],W=["before-newline","after-newline","preserve-newline"],te=j(W),fe=[te.before_newline,te.preserve_newline],me={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Pe(_,R){R.multiline_frame||R.mode===me.ForInitializer||R.mode===me.Conditional||_.remove_indent(R.start_line_index)}function M(_){_=_.replace(x.allLineBreaks,`
|
|
`);for(var R=[],q=_.indexOf(`
|
|
`);q!==-1;)R.push(_.substring(0,q)),_=_.substring(q+1),q=_.indexOf(`
|
|
`);return _.length&&R.push(_),R}function A(_){return _===me.ArrayLiteral}function C(_){return S(_,[me.Expression,me.ForInitializer,me.Conditional])}function U(_,R){for(var q=0;q<_.length;q++){var Te=_[q].trim();if(Te.charAt(0)!==R)return!1}return!0}function Y(_,R){for(var q=0,Te=_.length,Re;q<Te;q++)if(Re=_[q],Re&&Re.indexOf(R)!==0)return!1;return!0}function B(_,R){R=R||{},this._source_text=_||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new y(R)}B.prototype.create_flags=function(_,R){var q=0;_&&(q=_.indentation_level,!this._output.just_added_newline()&&_.line_indent_level>q&&(q=_.line_indent_level));var Te={mode:R,parent:_,last_token:_?_.last_token:new g(F.START_BLOCK,""),last_word:_?_.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:q,alignment:0,line_indent_level:_?_.line_indent_level:q,start_line_index:this._output.get_line_number(),ternary_depth:0};return Te},B.prototype._reset=function(_){var R=_.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new D(this._options,R),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(me.BlockStatement);var q=new b(_,this._options);return this._tokens=q.tokenize(),_},B.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var _,R=this._reset(this._source_text),q=this._options.eol;this._options.eol==="auto"&&(q=`
|
|
`,R&&x.lineBreak.test(R||"")&&(q=R.match(x.lineBreak)[0]));for(var Te=this._tokens.next();Te;)this.handle_token(Te),this._last_last_text=this._flags.last_token.text,this._flags.last_token=Te,Te=this._tokens.next();return _=this._output.get_code(q),_},B.prototype.handle_token=function(_,R){_.type===F.START_EXPR?this.handle_start_expr(_):_.type===F.END_EXPR?this.handle_end_expr(_):_.type===F.START_BLOCK?this.handle_start_block(_):_.type===F.END_BLOCK?this.handle_end_block(_):_.type===F.WORD?this.handle_word(_):_.type===F.RESERVED?this.handle_word(_):_.type===F.SEMICOLON?this.handle_semicolon(_):_.type===F.STRING?this.handle_string(_):_.type===F.EQUALS?this.handle_equals(_):_.type===F.OPERATOR?this.handle_operator(_):_.type===F.COMMA?this.handle_comma(_):_.type===F.BLOCK_COMMENT?this.handle_block_comment(_,R):_.type===F.COMMENT?this.handle_comment(_,R):_.type===F.DOT?this.handle_dot(_):_.type===F.EOF?this.handle_eof(_):_.type===F.UNKNOWN?this.handle_unknown(_,R):this.handle_unknown(_,R)},B.prototype.handle_whitespace_and_comments=function(_,R){var q=_.newlines,Te=this._options.keep_array_indentation&&A(this._flags.mode);if(_.comments_before)for(var Re=_.comments_before.next();Re;)this.handle_whitespace_and_comments(Re,R),this.handle_token(Re,R),Re=_.comments_before.next();if(Te)for(var Je=0;Je<q;Je+=1)this.print_newline(Je>0,R);else if(this._options.max_preserve_newlines&&q>this._options.max_preserve_newlines&&(q=this._options.max_preserve_newlines),this._options.preserve_newlines&&q>1){this.print_newline(!1,R);for(var He=1;He<q;He+=1)this.print_newline(!0,R)}};var E=["async","break","continue","return","throw","yield"];B.prototype.allow_wrap_or_preserved_newline=function(_,R){if(R=R===void 0?!1:R,!this._output.just_added_newline()){var q=this._options.preserve_newlines&&_.newlines||R,Te=S(this._flags.last_token.text,P)||S(_.text,P);if(Te){var Re=S(this._flags.last_token.text,P)&&S(this._options.operator_position,fe)||S(_.text,P);q=q&&Re}if(q)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(J(this._flags.last_token,E))return;this._output.set_wrap_point()}}},B.prototype.print_newline=function(_,R){if(!R&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==F.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var q=this._tokens.peek();this._flags.mode===me.Statement&&!(this._flags.if_block&&K(q,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(_)&&(this._flags.multiline_frame=!0)},B.prototype.print_token_line_indentation=function(_){this._output.just_added_newline()&&(this._options.keep_array_indentation&&_.newlines&&(_.text==="["||A(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(_.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))},B.prototype.print_token=function(_){if(this._output.raw){this._output.add_raw_token(_);return}if(this._options.comma_first&&_.previous&&_.previous.type===F.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var R=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(R),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(_),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(_),this._output.non_breaking_space=!0,this._output.add_token(_.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},B.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},B.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))},B.prototype.set_mode=function(_){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,_),this._flags=this.create_flags(this._previous_flags,_),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},B.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===me.Statement&&Pe(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},B.prototype.start_of_object_property=function(){return this._flags.parent.mode===me.ObjectLiteral&&this._flags.mode===me.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||J(this._flags.last_token,["get","set"]))},B.prototype.start_of_statement=function(_){var R=!1;return R=R||J(this._flags.last_token,["var","let","const"])&&_.type===F.WORD,R=R||K(this._flags.last_token,"do"),R=R||!(this._flags.parent.mode===me.ObjectLiteral&&this._flags.mode===me.Statement)&&J(this._flags.last_token,E)&&!_.newlines,R=R||K(this._flags.last_token,"else")&&!(K(_,"if")&&!_.comments_before),R=R||this._flags.last_token.type===F.END_EXPR&&(this._previous_flags.mode===me.ForInitializer||this._previous_flags.mode===me.Conditional),R=R||this._flags.last_token.type===F.WORD&&this._flags.mode===me.BlockStatement&&!this._flags.in_case&&!(_.text==="--"||_.text==="++")&&this._last_last_text!=="function"&&_.type!==F.WORD&&_.type!==F.RESERVED,R=R||this._flags.mode===me.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||J(this._flags.last_token,["get","set"])),R?(this.set_mode(me.Statement),this.indent(),this.handle_whitespace_and_comments(_,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(_,J(_,["do","for","if","while"])),!0):!1},B.prototype.handle_start_expr=function(_){this.start_of_statement(_)||this.handle_whitespace_and_comments(_);var R=me.Expression;if(_.text==="["){if(this._flags.last_token.type===F.WORD||this._flags.last_token.text===")"){J(this._flags.last_token,O)&&(this._output.space_before_token=!0),this.print_token(_),this.set_mode(R),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}R=me.ArrayLiteral,A(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()),S(this._flags.last_token.type,[F.START_EXPR,F.END_EXPR,F.WORD,F.OPERATOR,F.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===F.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,R=me.ForInitializer):S(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,R=me.Conditional):S(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&_.whitespace_before===""?this._output.space_before_token=!1:(S(this._flags.last_token.text,O)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===F.EQUALS||this._flags.last_token.type===F.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(_);else if(this._flags.last_token.type===F.WORD){this._output.space_before_token=!1;var q=this._tokens.peek(-3);if(this._options.space_after_named_function&&q){var Te=this._tokens.peek(-4);J(q,["async","function"])||q.text==="*"&&J(Te,["async","function"])?this._output.space_before_token=!0:this._flags.mode===me.ObjectLiteral?(q.text==="{"||q.text===","||q.text==="*"&&(Te.text==="{"||Te.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(_);(this._flags.last_token.type===F.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(S(this._last_last_text,["function","yield"])||this._flags.mode===me.ObjectLiteral&&S(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===F.START_BLOCK?this.print_newline():(this._flags.last_token.type===F.END_EXPR||this._flags.last_token.type===F.START_EXPR||this._flags.last_token.type===F.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===F.COMMA)&&this.allow_wrap_or_preserved_newline(_,_.newlines),this.print_token(_),this.set_mode(R),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},B.prototype.handle_end_expr=function(_){for(;this._flags.mode===me.Statement;)this.restore_mode();this.handle_whitespace_and_comments(_),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(_,_.text==="]"&&A(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===F.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(_),this.restore_mode(),Pe(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===me.Conditional&&(this._previous_flags.mode=me.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},B.prototype.handle_start_block=function(_){this.handle_whitespace_and_comments(_);var R=this._tokens.peek(),q=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===F.END_EXPR?(this.set_mode(me.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(me.BlockStatement):q&&(S(q.text,[":",","])&&S(R.type,[F.STRING,F.WORD,F.RESERVED])||S(R.text,["get","set","..."])&&S(q.type,[F.WORD,F.RESERVED]))?S(this._last_last_text,["class","interface"])&&!S(q.text,[":",","])?this.set_mode(me.BlockStatement):this.set_mode(me.ObjectLiteral):this._flags.last_token.type===F.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(me.BlockStatement):S(this._flags.last_token.type,[F.EQUALS,F.START_EXPR,F.COMMA,F.OPERATOR])||J(this._flags.last_token,["return","throw","import","default"])?this.set_mode(me.ObjectLiteral):this.set_mode(me.BlockStatement),this._flags.last_token&&J(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var Te=!R.comments_before&&R.text==="}",Re=Te&&this._flags.last_word==="function"&&this._flags.last_token.type===F.END_EXPR;if(this._options.brace_preserve_inline){var Je=0,He=null;this._flags.inline_frame=!0;do if(Je+=1,He=this._tokens.peek(Je-1),He.newlines){this._flags.inline_frame=!1;break}while(He.type!==F.EOF&&!(He.type===F.END_BLOCK&&He.opened===_))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&_.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==F.OPERATOR&&(Re||this._flags.last_token.type===F.EQUALS||J(this._flags.last_token,ie)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(A(this._previous_flags.mode)&&(this._flags.last_token.type===F.START_EXPR||this._flags.last_token.type===F.COMMA)&&((this._flags.last_token.type===F.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===F.COMMA||this._flags.last_token.type===F.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(_),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==F.OPERATOR&&this._flags.last_token.type!==F.START_EXPR&&(S(this._flags.last_token.type,[F.START_BLOCK,F.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(_),this.indent(),!Te&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},B.prototype.handle_end_block=function(_){for(this.handle_whitespace_and_comments(_);this._flags.mode===me.Statement;)this.restore_mode();var R=this._flags.last_token.type===F.START_BLOCK;this._flags.inline_frame&&!R?this._output.space_before_token=!0:this._options.brace_style==="expand"?R||this.print_newline():R||(A(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(_)},B.prototype.handle_word=function(_){if(_.type===F.RESERVED){if(S(_.text,["set","get"])&&this._flags.mode!==me.ObjectLiteral)_.type=F.WORD;else if(_.text==="import"&&S(this._tokens.peek().text,["(","."]))_.type=F.WORD;else if(S(_.text,["as","from"])&&!this._flags.import_block)_.type=F.WORD;else if(this._flags.mode===me.ObjectLiteral){var R=this._tokens.peek();R.text===":"&&(_.type=F.WORD)}}if(this.start_of_statement(_)?J(this._flags.last_token,["var","let","const"])&&_.type===F.WORD&&(this._flags.declaration_statement=!0):_.newlines&&!C(this._flags.mode)&&(this._flags.last_token.type!==F.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==F.EQUALS&&(this._options.preserve_newlines||!J(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(_),this.print_newline()):this.handle_whitespace_and_comments(_),this._flags.do_block&&!this._flags.do_while)if(K(_,"while")){this._output.space_before_token=!0,this.print_token(_),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&&K(_,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===me.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&J(_,["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(_),this._flags.in_case=!0;return}if((this._flags.last_token.type===F.COMMA||this._flags.last_token.type===F.START_EXPR||this._flags.last_token.type===F.EQUALS||this._flags.last_token.type===F.OPERATOR)&&!this.start_of_object_property()&&!(S(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===me.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(_),K(_,"function")){(S(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(S(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===F.OPERATOR))&&!this._output.just_added_blankline()&&!_.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===F.RESERVED||this._flags.last_token.type===F.WORD?J(this._flags.last_token,["get","set","new","export"])||J(this._flags.last_token,E)?this._output.space_before_token=!0:K(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===F.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(C(this._flags.mode)||A(this._flags.mode))||this.print_newline(),this.print_token(_),this._flags.last_word=_.text;return}var q="NONE";if(this._flags.last_token.type===F.END_BLOCK?this._previous_flags.inline_frame?q="SPACE":J(_,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&_.newlines?q="NEWLINE":(q="SPACE",this._output.space_before_token=!0):q="NEWLINE":this._flags.last_token.type===F.SEMICOLON&&this._flags.mode===me.BlockStatement?q="NEWLINE":this._flags.last_token.type===F.SEMICOLON&&C(this._flags.mode)?q="SPACE":this._flags.last_token.type===F.STRING?q="NEWLINE":this._flags.last_token.type===F.RESERVED||this._flags.last_token.type===F.WORD||this._flags.last_token.text==="*"&&(S(this._last_last_text,["function","yield"])||this._flags.mode===me.ObjectLiteral&&S(this._last_last_text,["{",","]))?q="SPACE":this._flags.last_token.type===F.START_BLOCK?this._flags.inline_frame?q="SPACE":q="NEWLINE":this._flags.last_token.type===F.END_EXPR&&(this._output.space_before_token=!0,q="NEWLINE"),J(_,O)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?q="SPACE":q="NEWLINE"),J(_,["else","catch","finally"]))if((!(this._flags.last_token.type===F.END_BLOCK&&this._previous_flags.mode===me.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&_.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var Te=this._output.current_line;Te.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else q==="NEWLINE"?J(this._flags.last_token,ie)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&J(_,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==F.END_EXPR?(this._flags.last_token.type!==F.START_EXPR||!J(_,["var","let","const"]))&&this._flags.last_token.text!==":"&&(K(_,"if")&&K(_.previous,"else")?this._output.space_before_token=!0:this.print_newline()):J(_,O)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&A(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():q==="SPACE"&&(this._output.space_before_token=!0);_.previous&&(_.previous.type===F.WORD||_.previous.type===F.RESERVED)&&(this._output.space_before_token=!0),this.print_token(_),this._flags.last_word=_.text,_.type===F.RESERVED&&(_.text==="do"?this._flags.do_block=!0:_.text==="if"?this._flags.if_block=!0:_.text==="import"?this._flags.import_block=!0:this._flags.import_block&&K(_,"from")&&(this._flags.import_block=!1))},B.prototype.handle_semicolon=function(_){this.start_of_statement(_)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(_);for(var R=this._tokens.peek();this._flags.mode===me.Statement&&!(this._flags.if_block&&K(R,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(_)},B.prototype.handle_string=function(_){_.text.startsWith("`")&&_.newlines===0&&_.whitespace_before===""&&(_.previous.text===")"||this._flags.last_token.type===F.WORD)||(this.start_of_statement(_)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(_),this._flags.last_token.type===F.RESERVED||this._flags.last_token.type===F.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===F.COMMA||this._flags.last_token.type===F.START_EXPR||this._flags.last_token.type===F.EQUALS||this._flags.last_token.type===F.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(_):_.text.startsWith("`")&&this._flags.last_token.type===F.END_EXPR&&(_.previous.text==="]"||_.previous.text===")")&&_.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(_)},B.prototype.handle_equals=function(_){this.start_of_statement(_)||this.handle_whitespace_and_comments(_),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(_),this._output.space_before_token=!0},B.prototype.handle_comma=function(_){this.handle_whitespace_and_comments(_,!0),this.print_token(_),this._output.space_before_token=!0,this._flags.declaration_statement?(C(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(_)):this._flags.mode===me.ObjectLiteral||this._flags.mode===me.Statement&&this._flags.parent.mode===me.ObjectLiteral?(this._flags.mode===me.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(_)},B.prototype.handle_operator=function(_){var R=_.text==="*"&&(J(this._flags.last_token,["function","yield"])||S(this._flags.last_token.type,[F.START_BLOCK,F.COMMA,F.END_BLOCK,F.SEMICOLON])),q=S(_.text,["-","+"])&&(S(this._flags.last_token.type,[F.START_BLOCK,F.START_EXPR,F.EQUALS,F.OPERATOR])||S(this._flags.last_token.text,O)||this._flags.last_token.text===",");if(!this.start_of_statement(_)){var Te=!R;this.handle_whitespace_and_comments(_,Te)}if(_.text==="*"&&this._flags.last_token.type===F.DOT){this.print_token(_);return}if(_.text==="::"){this.print_token(_);return}if(S(_.text,["-","+"])&&this.start_of_object_property()){this.print_token(_);return}if(this._flags.last_token.type===F.OPERATOR&&S(this._options.operator_position,fe)&&this.allow_wrap_or_preserved_newline(_),_.text===":"&&this._flags.in_case){this.print_token(_),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==F.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 Re=!0,Je=!0,He=!1;if(_.text===":"?this._flags.ternary_depth===0?Re=!1:(this._flags.ternary_depth-=1,He=!0):_.text==="?"&&(this._flags.ternary_depth+=1),!q&&!R&&this._options.preserve_newlines&&S(_.text,P)){var yt=_.text===":",tt=yt&&He,Ke=yt&&!He;switch(this._options.operator_position){case te.before_newline:this._output.space_before_token=!Ke,this.print_token(_),(!yt||tt)&&this.allow_wrap_or_preserved_newline(_),this._output.space_before_token=!0;return;case te.after_newline:this._output.space_before_token=!0,!yt||tt?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(_):this._output.space_before_token=!1,this.print_token(_),this._output.space_before_token=!0;return;case te.preserve_newline:Ke||this.allow_wrap_or_preserved_newline(_),Re=!(this._output.just_added_newline()||Ke),this._output.space_before_token=Re,this.print_token(_),this._output.space_before_token=!0;return}}if(R){this.allow_wrap_or_preserved_newline(_),Re=!1;var Mt=this._tokens.peek();Je=Mt&&S(Mt.type,[F.WORD,F.RESERVED])}else if(_.text==="...")this.allow_wrap_or_preserved_newline(_),Re=this._flags.last_token.type===F.START_BLOCK,Je=!1;else if(S(_.text,["--","++","!","~"])||q){if((this._flags.last_token.type===F.COMMA||this._flags.last_token.type===F.START_EXPR)&&this.allow_wrap_or_preserved_newline(_),Re=!1,Je=!1,_.newlines&&(_.text==="--"||_.text==="++"||_.text==="~")){var $e=J(this._flags.last_token,ie)&&_.newlines;$e&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline($e,!0)}this._flags.last_token.text===";"&&C(this._flags.mode)&&(Re=!0),this._flags.last_token.type===F.RESERVED?Re=!0:this._flags.last_token.type===F.END_EXPR?Re=!(this._flags.last_token.text==="]"&&(_.text==="--"||_.text==="++")):this._flags.last_token.type===F.OPERATOR&&(Re=S(_.text,["--","-","++","+"])&&S(this._flags.last_token.text,["--","-","++","+"]),S(_.text,["+","-"])&&S(this._flags.last_token.text,["--","++"])&&(Je=!0)),(this._flags.mode===me.BlockStatement&&!this._flags.inline_frame||this._flags.mode===me.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Re,this.print_token(_),this._output.space_before_token=Je},B.prototype.handle_block_comment=function(_,R){if(this._output.raw){this._output.add_raw_token(_),_.directives&&_.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(_.directives){this.print_newline(!1,R),this.print_token(_),_.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!x.newline.test(_.text)&&!_.newlines){this._output.space_before_token=!0,this.print_token(_),this._output.space_before_token=!0;return}else this.print_block_commment(_,R)},B.prototype.print_block_commment=function(_,R){var q=M(_.text),Te,Re=!1,Je=!1,He=_.whitespace_before,yt=He.length;if(this.print_newline(!1,R),this.print_token_line_indentation(_),this._output.add_token(q[0]),this.print_newline(!1,R),q.length>1){for(q=q.slice(1),Re=U(q,"*"),Je=Y(q,He),Re&&(this._flags.alignment=1),Te=0;Te<q.length;Te++)Re?(this.print_token_line_indentation(_),this._output.add_token(L(q[Te]))):Je&&q[Te]?(this.print_token_line_indentation(_),this._output.add_token(q[Te].substring(yt))):(this._output.current_line.set_indent(-1),this._output.add_token(q[Te])),this.print_newline(!1,R);this._flags.alignment=0}},B.prototype.handle_comment=function(_,R){_.newlines?this.print_newline(!1,R):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(_),this.print_newline(!1,R)},B.prototype.handle_dot=function(_){this.start_of_statement(_)||this.handle_whitespace_and_comments(_,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),J(this._flags.last_token,ie)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(_,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(_)},B.prototype.handle_unknown=function(_,R){this.print_token(_),_.text[_.text.length-1]===`
|
|
`&&this.print_newline(!1,R)},B.prototype.handle_eof=function(_){for(;this._flags.mode===me.Statement;)this.restore_mode();this.handle_whitespace_and_comments(_)},ne.exports.Beautifier=B},function(ne){function l(g){this.__parent=g,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 g=new l(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},l.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},l.prototype.has_match=function(g){for(var x=this.__items.length-1;x>=0;x--)if(this.__items[x].match(g))return!0;return!1},l.prototype.set_indent=function(g,x){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=x||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 g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__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(g){this.__items.push(g);var x=g.lastIndexOf(`
|
|
`);x!==-1?this.__character_count=g.length-x:this.__character_count+=g.length},l.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},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 g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function z(g,x){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),x=x||"",g.indent_level>0&&(x=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=x,this.__base_string_length=x.length}z.prototype.get_indent_size=function(g,x){var y=this.__base_string_length;return x=x||0,g<0&&(y=0),y+=g*this.__indent_size,y+=x,y},z.prototype.get_indent_string=function(g,x){var y=this.__base_string;return x=x||0,g<0&&(g=0,y=""),x+=g*this.__indent_size,this.__ensure_cache(x),y+=this.__cache[x],y},z.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},z.prototype.__add_column=function(){var g=this.__cache.length,x=0,y="";this.__indent_size&&g>=this.__indent_size&&(x=Math.floor(g/this.__indent_size),g-=x*this.__indent_size,y=new Array(x+1).join(this.__indent_string)),g&&(y+=new Array(g+1).join(" ")),this.__cache.push(y)};function D(g,x){this.__indent_cache=new z(g,x),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.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()}D.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},D.prototype.get_line_number=function(){return this.__lines.length},D.prototype.get_indent_string=function(g,x){return this.__indent_cache.get_indent_string(g,x)},D.prototype.get_indent_size=function(g,x){return this.__indent_cache.get_indent_size(g,x)},D.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},D.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},D.prototype.get_code=function(g){this.trim(!0);var x=this.current_line.pop();x&&(x[x.length-1]===`
|
|
`&&(x=x.replace(/\n+$/g,"")),this.current_line.push(x)),this._end_with_newline&&this.__add_outputline();var y=this.__lines.join(`
|
|
`);return g!==`
|
|
`&&(y=y.replace(/[\n]/g,g)),y},D.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},D.prototype.set_indent=function(g,x){return g=g||0,x=x||0,this.next_line.set_indent(g,x),this.__lines.length>1?(this.current_line.set_indent(g,x),!0):(this.current_line.set_indent(),!1)},D.prototype.add_raw_token=function(g){for(var x=0;x<g.newlines;x++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},D.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},D.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(" "))},D.prototype.remove_indent=function(g){for(var x=this.__lines.length;g<x;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},D.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&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},D.prototype.just_added_newline=function(){return this.current_line.is_empty()},D.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},D.prototype.ensure_empty_line_above=function(g,x){for(var y=this.__lines.length-2;y>=0;){var b=this.__lines[y];if(b.is_empty())break;if(b.item(0).indexOf(g)!==0&&b.item(-1)!==x){this.__lines.splice(y+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}y--}},ne.exports.Output=D},function(ne){function l(z,D,g,x){this.type=z,this.text=D,this.comments_before=null,this.newlines=g||0,this.whitespace_before=x||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}ne.exports.Token=l},function(ne,l){var z="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",D="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",g="\\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",x="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",y="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",b="(?:"+y+"|["+z+g+"])",O="(?:"+y+"|["+D+g+x+"])*";l.identifier=new RegExp(b+O,"g"),l.identifierStart=new RegExp(b),l.identifierMatch=new RegExp("(?:"+y+"|["+D+g+x+"])+");var P=/[\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(ne,l,z){var D=z(6).Options,g=["before-newline","after-newline","preserve-newline"];function x(y){D.call(this,y,"js");var b=this.raw_options.brace_style||null;b==="expand-strict"?this.raw_options.brace_style="expand":b==="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 O=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var P=0;P<O.length;P++)O[P]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=O[P];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",g),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}x.prototype=new D,ne.exports.Options=x},function(ne){function l(g,x){this.raw_options=z(g,x),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(g,x){var y=this.raw_options[g],b=x||[];return typeof y=="object"?y!==null&&typeof y.concat=="function"&&(b=y.concat()):typeof y=="string"&&(b=y.split(/[^a-zA-Z0-9_\/\-]+/)),b},l.prototype._get_boolean=function(g,x){var y=this.raw_options[g],b=y===void 0?!!x:!!y;return b},l.prototype._get_characters=function(g,x){var y=this.raw_options[g],b=x||"";return typeof y=="string"&&(b=y.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),b},l.prototype._get_number=function(g,x){var y=this.raw_options[g];x=parseInt(x,10),isNaN(x)&&(x=0);var b=parseInt(y,10);return isNaN(b)&&(b=x),b},l.prototype._get_selection=function(g,x,y){var b=this._get_selection_list(g,x,y);if(b.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
|
|
`+x+`
|
|
You passed in: '`+this.raw_options[g]+"'");return b[0]},l.prototype._get_selection_list=function(g,x,y){if(!x||x.length===0)throw new Error("Selection list cannot be empty.");if(y=y||[x[0]],!this._is_valid_selection(y,x))throw new Error("Invalid Default Value!");var b=this._get_array(g,y);if(!this._is_valid_selection(b,x))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
|
|
`+x+`
|
|
You passed in: '`+this.raw_options[g]+"'");return b},l.prototype._is_valid_selection=function(g,x){return g.length&&x.length&&!g.some(function(y){return x.indexOf(y)===-1})};function z(g,x){var y={};g=D(g);var b;for(b in g)b!==x&&(y[b]=g[b]);if(x&&g[x])for(b in g[x])y[b]=g[x][b];return y}function D(g){var x={},y;for(y in g){var b=y.replace(/-/g,"_");x[b]=g[y]}return x}ne.exports.Options=l,ne.exports.normalizeOpts=D,ne.exports.mergeOpts=z},function(ne,l,z){var D=z(8).InputScanner,g=z(9).Tokenizer,x=z(9).TOKEN,y=z(13).Directives,b=z(4),O=z(12).Pattern,P=z(14).TemplatablePattern;function F(U,Y){return Y.indexOf(U)!==-1}var S={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:x.START,RAW:x.RAW,EOF:x.EOF},L=new y(/\/\*/,/\*\//),j=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,K=/[0-9]/,J=/[^\d\.]/,ie=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),W=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";W=W.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),W="\\?\\.(?!\\d) "+W,W=W.replace(/ /g,"|");var te=new RegExp(W),fe="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),me=fe.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),Pe=new RegExp("^(?:"+me.join("|")+")$"),M,A=function(U,Y){g.call(this,U,Y),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var B=new O(this._input),E=new P(this._input).read_options(this._options);this.__patterns={template:E,identifier:E.starting_with(b.identifier).matching(b.identifierMatch),number:B.matching(j),punct:B.matching(te),comment:B.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:B.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:B.matching(/<!--/),html_comment_end:B.matching(/-->/),include:B.starting_with(/#include/).until_after(b.lineBreak),shebang:B.starting_with(/#!/).until_after(b.lineBreak),xml:B.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:E.until(/['\\\n\r\u2028\u2029]/),double_quote:E.until(/["\\\n\r\u2028\u2029]/),template_text:E.until(/[`\\$]/),template_expression:E.until(/[`}\\]/)}};A.prototype=new g,A.prototype._is_comment=function(U){return U.type===S.COMMENT||U.type===S.BLOCK_COMMENT||U.type===S.UNKNOWN},A.prototype._is_opening=function(U){return U.type===S.START_BLOCK||U.type===S.START_EXPR},A.prototype._is_closing=function(U,Y){return(U.type===S.END_BLOCK||U.type===S.END_EXPR)&&Y&&(U.text==="]"&&Y.text==="["||U.text===")"&&Y.text==="("||U.text==="}"&&Y.text==="{")},A.prototype._reset=function(){M=!1},A.prototype._get_next_token=function(U,Y){var B=null;this._readWhitespace();var E=this._input.peek();return E===null?this._create_token(S.EOF,""):(B=B||this._read_non_javascript(E),B=B||this._read_string(E),B=B||this._read_pair(E,this._input.peek(1)),B=B||this._read_word(U),B=B||this._read_singles(E),B=B||this._read_comment(E),B=B||this._read_regexp(E,U),B=B||this._read_xml(E,U),B=B||this._read_punctuation(),B=B||this._create_token(S.UNKNOWN,this._input.next()),B)},A.prototype._read_word=function(U){var Y;if(Y=this.__patterns.identifier.read(),Y!=="")return Y=Y.replace(b.allLineBreaks,`
|
|
`),!(U.type===S.DOT||U.type===S.RESERVED&&(U.text==="set"||U.text==="get"))&&Pe.test(Y)?(Y==="in"||Y==="of")&&(U.type===S.WORD||U.type===S.STRING)?this._create_token(S.OPERATOR,Y):this._create_token(S.RESERVED,Y):this._create_token(S.WORD,Y);if(Y=this.__patterns.number.read(),Y!=="")return this._create_token(S.WORD,Y)},A.prototype._read_singles=function(U){var Y=null;return U==="("||U==="["?Y=this._create_token(S.START_EXPR,U):U===")"||U==="]"?Y=this._create_token(S.END_EXPR,U):U==="{"?Y=this._create_token(S.START_BLOCK,U):U==="}"?Y=this._create_token(S.END_BLOCK,U):U===";"?Y=this._create_token(S.SEMICOLON,U):U==="."&&J.test(this._input.peek(1))?Y=this._create_token(S.DOT,U):U===","&&(Y=this._create_token(S.COMMA,U)),Y&&this._input.next(),Y},A.prototype._read_pair=function(U,Y){var B=null;return U==="#"&&Y==="{"&&(B=this._create_token(S.START_BLOCK,U+Y)),B&&(this._input.next(),this._input.next()),B},A.prototype._read_punctuation=function(){var U=this.__patterns.punct.read();if(U!=="")return U==="="?this._create_token(S.EQUALS,U):U==="?."?this._create_token(S.DOT,U):this._create_token(S.OPERATOR,U)},A.prototype._read_non_javascript=function(U){var Y="";if(U==="#"){if(this._is_first_token()&&(Y=this.__patterns.shebang.read(),Y))return this._create_token(S.UNKNOWN,Y.trim()+`
|
|
`);if(Y=this.__patterns.include.read(),Y)return this._create_token(S.UNKNOWN,Y.trim()+`
|
|
`);U=this._input.next();var B="#";if(this._input.hasNext()&&this._input.testChar(K)){do U=this._input.next(),B+=U;while(this._input.hasNext()&&U!=="#"&&U!=="=");return U==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(B+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(B+="{}",this._input.next(),this._input.next())),this._create_token(S.WORD,B)}this._input.back()}else if(U==="<"&&this._is_first_token()){if(Y=this.__patterns.html_comment_start.read(),Y){for(;this._input.hasNext()&&!this._input.testChar(b.newline);)Y+=this._input.next();return M=!0,this._create_token(S.COMMENT,Y)}}else if(M&&U==="-"&&(Y=this.__patterns.html_comment_end.read(),Y))return M=!1,this._create_token(S.COMMENT,Y);return null},A.prototype._read_comment=function(U){var Y=null;if(U==="/"){var B="";if(this._input.peek(1)==="*"){B=this.__patterns.block_comment.read();var E=L.get_directives(B);E&&E.ignore==="start"&&(B+=L.readIgnored(this._input)),B=B.replace(b.allLineBreaks,`
|
|
`),Y=this._create_token(S.BLOCK_COMMENT,B),Y.directives=E}else this._input.peek(1)==="/"&&(B=this.__patterns.comment.read(),Y=this._create_token(S.COMMENT,B))}return Y},A.prototype._read_string=function(U){if(U==="`"||U==="'"||U==='"'){var Y=this._input.next();return this.has_char_escapes=!1,U==="`"?Y+=this._read_string_recursive("`",!0,"${"):Y+=this._read_string_recursive(U),this.has_char_escapes&&this._options.unescape_strings&&(Y=C(Y)),this._input.peek()===U&&(Y+=this._input.next()),Y=Y.replace(b.allLineBreaks,`
|
|
`),this._create_token(S.STRING,Y)}return null},A.prototype._allow_regexp_or_xml=function(U){return U.type===S.RESERVED&&F(U.text,["return","case","throw","else","do","typeof","yield"])||U.type===S.END_EXPR&&U.text===")"&&U.opened.previous.type===S.RESERVED&&F(U.opened.previous.text,["if","while","for"])||F(U.type,[S.COMMENT,S.START_EXPR,S.START_BLOCK,S.START,S.END_BLOCK,S.OPERATOR,S.EQUALS,S.EOF,S.SEMICOLON,S.COMMA])},A.prototype._read_regexp=function(U,Y){if(U==="/"&&this._allow_regexp_or_xml(Y)){for(var B=this._input.next(),E=!1,_=!1;this._input.hasNext()&&(E||_||this._input.peek()!==U)&&!this._input.testChar(b.newline);)B+=this._input.peek(),E?E=!1:(E=this._input.peek()==="\\",this._input.peek()==="["?_=!0:this._input.peek()==="]"&&(_=!1)),this._input.next();return this._input.peek()===U&&(B+=this._input.next(),B+=this._input.read(b.identifier)),this._create_token(S.STRING,B)}return null},A.prototype._read_xml=function(U,Y){if(this._options.e4x&&U==="<"&&this._allow_regexp_or_xml(Y)){var B="",E=this.__patterns.xml.read_match();if(E){for(var _=E[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),R=_.indexOf("{")===0,q=0;E;){var Te=!!E[1],Re=E[2],Je=!!E[E.length-1]||Re.slice(0,8)==="![CDATA[";if(!Je&&(Re===_||R&&Re.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(Te?--q:++q),B+=E[0],q<=0)break;E=this.__patterns.xml.read_match()}return E||(B+=this._input.match(/[\s\S]*/g)[0]),B=B.replace(b.allLineBreaks,`
|
|
`),this._create_token(S.STRING,B)}}return null};function C(U){for(var Y="",B=0,E=new D(U),_=null;E.hasNext();)if(_=E.match(/([\s]|[^\\]|\\\\)+/g),_&&(Y+=_[0]),E.peek()==="\\"){if(E.next(),E.peek()==="x")_=E.match(/x([0-9A-Fa-f]{2})/g);else if(E.peek()==="u")_=E.match(/u([0-9A-Fa-f]{4})/g),_||(_=E.match(/u\{([0-9A-Fa-f]+)\}/g));else{Y+="\\",E.hasNext()&&(Y+=E.next());continue}if(!_||(B=parseInt(_[1],16),B>126&&B<=255&&_[0].indexOf("x")===0))return U;B>=0&&B<32||B>1114111?Y+="\\"+_[0]:B===34||B===39||B===92?Y+="\\"+String.fromCharCode(B):Y+=String.fromCharCode(B)}return Y}A.prototype._read_string_recursive=function(U,Y,B){var E,_;U==="'"?_=this.__patterns.single_quote:U==='"'?_=this.__patterns.double_quote:U==="`"?_=this.__patterns.template_text:U==="}"&&(_=this.__patterns.template_expression);for(var R=_.read(),q="";this._input.hasNext();){if(q=this._input.next(),q===U||!Y&&b.newline.test(q)){this._input.back();break}else q==="\\"&&this._input.hasNext()?(E=this._input.peek(),E==="x"||E==="u"?this.has_char_escapes=!0:E==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),q+=this._input.next()):B&&(B==="${"&&q==="$"&&this._input.peek()==="{"&&(q+=this._input.next()),B===q&&(U==="`"?q+=this._read_string_recursive("}",Y,"`"):q+=this._read_string_recursive("`",Y,"${"),this._input.hasNext()&&(q+=this._input.next())));q+=_.read(),R+=q}return R},ne.exports.Tokenizer=A,ne.exports.TOKEN=S,ne.exports.positionable_operators=ie.slice(),ne.exports.line_starters=fe.slice()},function(ne){var l=RegExp.prototype.hasOwnProperty("sticky");function z(D){this.__input=D||"",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 D=null;return this.hasNext()&&(D=this.__input.charAt(this.__position),this.__position+=1),D},z.prototype.peek=function(D){var g=null;return D=D||0,D+=this.__position,D>=0&&D<this.__input_length&&(g=this.__input.charAt(D)),g},z.prototype.__match=function(D,g){D.lastIndex=g;var x=D.exec(this.__input);return x&&!(l&&D.sticky)&&x.index!==g&&(x=null),x},z.prototype.test=function(D,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(D,g):!1},z.prototype.testChar=function(D,g){var x=this.peek(g);return D.lastIndex=0,x!==null&&D.test(x)},z.prototype.match=function(D){var g=this.__match(D,this.__position);return g?this.__position+=g[0].length:g=null,g},z.prototype.read=function(D,g,x){var y="",b;return D&&(b=this.match(D),b&&(y+=b[0])),g&&(b||!D)&&(y+=this.readUntil(g,x)),y},z.prototype.readUntil=function(D,g){var x="",y=this.__position;D.lastIndex=this.__position;var b=D.exec(this.__input);return b?(y=b.index,g&&(y+=b[0].length)):y=this.__input_length,x=this.__input.substring(this.__position,y),this.__position=y,x},z.prototype.readUntilAfter=function(D){return this.readUntil(D,!0)},z.prototype.get_regexp=function(D,g){var x=null,y="g";return g&&l&&(y="y"),typeof D=="string"&&D!==""?x=new RegExp(D,y):D&&(x=new RegExp(D.source,y)),x},z.prototype.get_literal_regexp=function(D){return RegExp(D.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},z.prototype.peekUntilAfter=function(D){var g=this.__position,x=this.readUntilAfter(D);return this.__position=g,x},z.prototype.lookBack=function(D){var g=this.__position-1;return g>=D.length&&this.__input.substring(g-D.length,g).toLowerCase()===D},ne.exports.InputScanner=z},function(ne,l,z){var D=z(8).InputScanner,g=z(3).Token,x=z(10).TokenStream,y=z(11).WhitespacePattern,b={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},O=function(P,F){this._input=new D(P),this._options=F||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new y(this._input)};O.prototype.tokenize=function(){this._input.restart(),this.__tokens=new x,this._reset();for(var P,F=new g(b.START,""),S=null,L=[],j=new x;F.type!==b.EOF;){for(P=this._get_next_token(F,S);this._is_comment(P);)j.add(P),P=this._get_next_token(F,S);j.isEmpty()||(P.comments_before=j,j=new x),P.parent=S,this._is_opening(P)?(L.push(S),S=P):S&&this._is_closing(P,S)&&(P.opened=S,S.closed=P,S=L.pop(),P.parent=S),P.previous=F,F.next=P,this.__tokens.add(P),F=P}return this.__tokens},O.prototype._is_first_token=function(){return this.__tokens.isEmpty()},O.prototype._reset=function(){},O.prototype._get_next_token=function(P,F){this._readWhitespace();var S=this._input.read(/.+/g);return S?this._create_token(b.RAW,S):this._create_token(b.EOF,"")},O.prototype._is_comment=function(P){return!1},O.prototype._is_opening=function(P){return!1},O.prototype._is_closing=function(P,F){return!1},O.prototype._create_token=function(P,F){var S=new g(P,F,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return S},O.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},ne.exports.Tokenizer=O,ne.exports.TOKEN=b},function(ne){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 D=null;return z=z||0,z+=this.__position,z>=0&&z<this.__tokens_length&&(D=this.__tokens[z]),D},l.prototype.add=function(z){this.__parent_token&&(z.parent=this.__parent_token),this.__tokens.push(z),this.__tokens_length+=1},ne.exports.TokenStream=l},function(ne,l,z){var D=z(12).Pattern;function g(x,y){D.call(this,x,y),y?this._line_regexp=this._input.get_regexp(y._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}g.prototype=new D,g.prototype.__set_whitespace_patterns=function(x,y){x+="\\t ",y+="\\n\\r",this._match_pattern=this._input.get_regexp("["+x+y+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+y+"]")},g.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var x=this._input.read(this._match_pattern);if(x===" ")this.whitespace_before_token=" ";else if(x){var y=this.__split(this._newline_regexp,x);this.newline_count=y.length-1,this.whitespace_before_token=y[this.newline_count]}return x},g.prototype.matching=function(x,y){var b=this._create();return b.__set_whitespace_patterns(x,y),b._update(),b},g.prototype._create=function(){return new g(this._input,this)},g.prototype.__split=function(x,y){x.lastIndex=0;for(var b=0,O=[],P=x.exec(y);P;)O.push(y.substring(b,P.index)),b=P.index+P[0].length,P=x.exec(y);return b<y.length?O.push(y.substring(b,y.length)):O.push(""),O},ne.exports.WhitespacePattern=g},function(ne){function l(z,D){this._input=z,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,D&&(this._starting_pattern=this._input.get_regexp(D._starting_pattern,!0),this._match_pattern=this._input.get_regexp(D._match_pattern,!0),this._until_pattern=this._input.get_regexp(D._until_pattern),this._until_after=D._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 D=this._create();return D._until_after=!0,D._until_pattern=this._input.get_regexp(z),D._update(),D},l.prototype.until=function(z){var D=this._create();return D._until_after=!1,D._until_pattern=this._input.get_regexp(z),D._update(),D},l.prototype.starting_with=function(z){var D=this._create();return D._starting_pattern=this._input.get_regexp(z,!0),D._update(),D},l.prototype.matching=function(z){var D=this._create();return D._match_pattern=this._input.get_regexp(z,!0),D._update(),D},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},ne.exports.Pattern=l},function(ne){function l(z,D){z=typeof z=="string"?z:z.source,D=typeof D=="string"?D:D.source,this.__directives_block_pattern=new RegExp(z+/ beautify( \w+[:]\w+)+ /.source+D,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(z+/\sbeautify\signore:end\s/.source+D,"g")}l.prototype.get_directives=function(z){if(!z.match(this.__directives_block_pattern))return null;var D={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(z);g;)D[g[1]]=g[2],g=this.__directive_pattern.exec(z);return D},l.prototype.readIgnored=function(z){return z.readUntilAfter(this.__directives_end_ignore_pattern)},ne.exports.Directives=l},function(ne,l,z){var D=z(12).Pattern,g={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function x(y,b){D.call(this,y,b),this.__template_pattern=null,this._disabled=Object.assign({},g),this._excluded=Object.assign({},g),b&&(this.__template_pattern=this._input.get_regexp(b.__template_pattern),this._excluded=Object.assign(this._excluded,b._excluded),this._disabled=Object.assign(this._disabled,b._disabled));var O=new D(y);this.__patterns={handlebars_comment:O.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:O.starting_with(/{{{/).until_after(/}}}/),handlebars:O.starting_with(/{{/).until_after(/}}/),php:O.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:O.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:O.starting_with(/{%/).until_after(/%}/),django_value:O.starting_with(/{{/).until_after(/}}/),django_comment:O.starting_with(/{#/).until_after(/#}/),smarty:O.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:O.starting_with(/{\*/).until_after(/\*}/),smarty_literal:O.starting_with(/{literal}/).until_after(/{\/literal}/)}}x.prototype=new D,x.prototype._create=function(){return new x(this._input,this)},x.prototype._update=function(){this.__set_templated_pattern()},x.prototype.disable=function(y){var b=this._create();return b._disabled[y]=!0,b._update(),b},x.prototype.read_options=function(y){var b=this._create();for(var O in g)b._disabled[O]=y.templating.indexOf(O)===-1;return b._update(),b},x.prototype.exclude=function(y){var b=this._create();return b._excluded[y]=!0,b._update(),b},x.prototype.read=function(){var y="";this._match_pattern?y=this._input.read(this._starting_pattern):y=this._input.read(this._starting_pattern,this.__template_pattern);for(var b=this._read_template();b;)this._match_pattern?b+=this._input.read(this._match_pattern):b+=this._input.readUntil(this.__template_pattern),y+=b,b=this._read_template();return this._until_after&&(y+=this._input.readUntilAfter(this._until_pattern)),y},x.prototype.__set_templated_pattern=function(){var y=[];this._disabled.php||y.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||y.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||y.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||y.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(y.push(this.__patterns.django._starting_pattern.source),y.push(this.__patterns.django_value._starting_pattern.source),y.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||y.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&y.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+y.join("|")+")")},x.prototype._read_template=function(){var y="",b=this._input.peek();if(b==="<"){var O=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&O==="?"&&(y=y||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&O==="%"&&(y=y||this.__patterns.erb.read())}else b==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(y=y||this.__patterns.handlebars_comment.read(),y=y||this.__patterns.handlebars_unescaped.read(),y=y||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(y=y||this.__patterns.django_value.read()),this._excluded.django||(y=y||this.__patterns.django_comment.read(),y=y||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(y=y||this.__patterns.smarty_comment.read(),y=y||this.__patterns.smarty_literal.read(),y=y||this.__patterns.smarty.read()));return y},ne.exports.TemplatablePattern=x}],V={};function p(ne){var l=V[ne];if(l!==void 0)return l.exports;var z=V[ne]={exports:{}};return oe[ne](z,z.exports,p),z.exports}var ge=p(0);ye=ge})();var Ne=ye;ee=[],N=function(){return{js_beautify:Ne}}.apply(Ze,ee),N!==void 0&&(Dt.exports=N)})()},32834:function(Dt){(function(Ze,ee){Dt.exports=ee()})(this,function(){"use strict";function Ze(be,le){for(var he=0;he<le.length;he++){var I=le[he];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(be,I.key,I)}}function ee(be,le,he){return le&&Ze(be.prototype,le),he&&Ze(be,he),be}function N(be,le){if(be){if(typeof be=="string")return ye(be,le);var he=Object.prototype.toString.call(be).slice(8,-1);if(he==="Object"&&be.constructor&&(he=be.constructor.name),he==="Map"||he==="Set")return Array.from(be);if(he==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(he))return ye(be,le)}}function ye(be,le){(le==null||le>be.length)&&(le=be.length);for(var he=0,I=new Array(le);he<le;he++)I[he]=be[he];return I}function Ne(be,le){var he=typeof Symbol!="undefined"&&be[Symbol.iterator]||be["@@iterator"];if(he)return(he=he.call(be)).next.bind(he);if(Array.isArray(be)||(he=N(be))||le&&be&&typeof be.length=="number"){he&&(be=he);var I=0;return function(){return I>=be.length?{done:!0}:{done:!1,value:be[I++]}}}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 oe={exports:{}};function V(){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(be){oe.exports.defaults=be}oe.exports={defaults:V(),getDefaults:V,changeDefaults:p};var ge=/[&<>"']/,ne=/[&<>"']/g,l=/[<>"']|&(?!#?\w+;)/,z=/[<>"']|&(?!#?\w+;)/g,D={"&":"&","<":"<",">":">",'"':""","'":"'"},g=function(le){return D[le]};function x(be,le){if(le){if(ge.test(be))return be.replace(ne,g)}else if(l.test(be))return be.replace(z,g);return be}var y=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function b(be){return be.replace(y,function(le,he){return he=he.toLowerCase(),he==="colon"?":":he.charAt(0)==="#"?he.charAt(1)==="x"?String.fromCharCode(parseInt(he.substring(2),16)):String.fromCharCode(+he.substring(1)):""})}var O=/(^|[^\[])\^/g;function P(be,le){be=be.source||be,le=le||"";var he={replace:function($,Z){return Z=Z.source||Z,Z=Z.replace(O,"$1"),be=be.replace($,Z),he},getRegex:function(){return new RegExp(be,le)}};return he}var F=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(be,le,he){if(be){var I;try{I=decodeURIComponent(b(he)).replace(F,"").toLowerCase()}catch($){return null}if(I.indexOf("javascript:")===0||I.indexOf("vbscript:")===0||I.indexOf("data:")===0)return null}le&&!S.test(he)&&(he=W(le,he));try{he=encodeURI(he).replace(/%25/g,"%")}catch($){return null}return he}var j={},K=/^[^:]+:\/*[^/]*$/,J=/^([^:]+:)[\s\S]*$/,ie=/^([^:]+:\/*[^/]*)[\s\S]*$/;function W(be,le){j[" "+be]||(K.test(be)?j[" "+be]=be+"/":j[" "+be]=Pe(be,"/",!0)),be=j[" "+be];var he=be.indexOf(":")===-1;return le.substring(0,2)==="//"?he?le:be.replace(J,"$1")+le:le.charAt(0)==="/"?he?le:be.replace(ie,"$1")+le:be+le}var te={exec:function(){}};function fe(be){for(var le=1,he,I;le<arguments.length;le++){he=arguments[le];for(I in he)Object.prototype.hasOwnProperty.call(he,I)&&(be[I]=he[I])}return be}function me(be,le){var he=be.replace(/\|/g,function(Z,se,re){for(var Ge=!1,ze=se;--ze>=0&&re[ze]==="\\";)Ge=!Ge;return Ge?"|":" |"}),I=he.split(/ \|/),$=0;if(I.length>le)I.splice(le);else for(;I.length<le;)I.push("");for(;$<I.length;$++)I[$]=I[$].trim().replace(/\\\|/g,"|");return I}function Pe(be,le,he){var I=be.length;if(I===0)return"";for(var $=0;$<I;){var Z=be.charAt(I-$-1);if(Z===le&&!he)$++;else if(Z!==le&&he)$++;else break}return be.substr(0,I-$)}function M(be,le){if(be.indexOf(le[1])===-1)return-1;for(var he=be.length,I=0,$=0;$<he;$++)if(be[$]==="\\")$++;else if(be[$]===le[0])I++;else if(be[$]===le[1]&&(I--,I<0))return $;return-1}function A(be){be&&be.sanitize&&!be.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 C(be,le){if(le<1)return"";for(var he="";le>1;)le&1&&(he+=be),le>>=1,be+=be;return he+be}var U={escape:x,unescape:b,edit:P,cleanUrl:L,resolveUrl:W,noopTest:te,merge:fe,splitCells:me,rtrim:Pe,findClosingBracket:M,checkSanitizeDeprecation:A,repeatString:C},Y=oe.exports.defaults,B=U.rtrim,E=U.splitCells,_=U.escape,R=U.findClosingBracket;function q(be,le,he){var I=le.href,$=le.title?_(le.title):null,Z=be[1].replace(/\\([\[\]])/g,"$1");return be[0].charAt(0)!=="!"?{type:"link",raw:he,href:I,title:$,text:Z}:{type:"image",raw:he,href:I,title:$,text:_(Z)}}function Te(be,le){var he=be.match(/^(\s+)(?:```)/);if(he===null)return le;var I=he[1];return le.split(`
|
|
`).map(function($){var Z=$.match(/^\s+/);if(Z===null)return $;var se=Z[0];return se.length>=I.length?$.slice(I.length):$}).join(`
|
|
`)}var Re=function(){function be(he){this.options=he||Y}var le=be.prototype;return le.space=function(I){var $=this.rules.block.newline.exec(I);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
|
|
`}},le.code=function(I){var $=this.rules.block.code.exec(I);if($){var Z=$[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:$[0],codeBlockStyle:"indented",text:this.options.pedantic?Z:B(Z,`
|
|
`)}}},le.fences=function(I){var $=this.rules.block.fences.exec(I);if($){var Z=$[0],se=Te(Z,$[3]||"");return{type:"code",raw:Z,lang:$[2]?$[2].trim():$[2],text:se}}},le.heading=function(I){var $=this.rules.block.heading.exec(I);if($){var Z=$[2].trim();if(/#$/.test(Z)){var se=B(Z,"#");(this.options.pedantic||!se||/ $/.test(se))&&(Z=se.trim())}return{type:"heading",raw:$[0],depth:$[1].length,text:Z}}},le.nptable=function(I){var $=this.rules.block.nptable.exec(I);if($){var Z={type:"table",header:E($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[],raw:$[0]};if(Z.header.length===Z.align.length){var se=Z.align.length,re;for(re=0;re<se;re++)/^ *-+: *$/.test(Z.align[re])?Z.align[re]="right":/^ *:-+: *$/.test(Z.align[re])?Z.align[re]="center":/^ *:-+ *$/.test(Z.align[re])?Z.align[re]="left":Z.align[re]=null;for(se=Z.cells.length,re=0;re<se;re++)Z.cells[re]=E(Z.cells[re],Z.header.length);return Z}}},le.hr=function(I){var $=this.rules.block.hr.exec(I);if($)return{type:"hr",raw:$[0]}},le.blockquote=function(I){var $=this.rules.block.blockquote.exec(I);if($){var Z=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:Z}}},le.list=function(I){var $=this.rules.block.list.exec(I);if($){var Z=$[0],se=$[2],re=se.length>1,Ge={type:"list",raw:Z,ordered:re,start:re?+se.slice(0,-1):"",loose:!1,items:[]},ze=$[0].match(this.rules.block.item),ot=!1,ct,Ct,Yt,Ft,St,li,yi,ci,ai,Xe=ze.length;Yt=this.rules.block.listItemStart.exec(ze[0]);for(var Ye=0;Ye<Xe;Ye++){if(ct=ze[Ye],Z=ct,this.options.pedantic||(ai=ct.match(new RegExp("\\n\\s*\\n {0,"+(Yt[0].length-1)+"}\\S")),ai&&(St=ct.length-ai.index+ze.slice(Ye+1).join(`
|
|
`).length,Ge.raw=Ge.raw.substring(0,Ge.raw.length-St),ct=ct.substring(0,ai.index),Z=ct,Xe=Ye+1)),Ye!==Xe-1){if(Ft=this.rules.block.listItemStart.exec(ze[Ye+1]),this.options.pedantic?Ft[1].length>Yt[1].length:Ft[1].length>=Yt[0].length||Ft[1].length>3){ze.splice(Ye,2,ze[Ye]+(!this.options.pedantic&&Ft[1].length<Yt[0].length&&!ze[Ye].match(/\n$/)?"":`
|
|
`)+ze[Ye+1]),Ye--,Xe--;continue}else(!this.options.pedantic||this.options.smartLists?Ft[2][Ft[2].length-1]!==se[se.length-1]:re===(Ft[2].length===1))&&(St=ze.slice(Ye+1).join(`
|
|
`).length,Ge.raw=Ge.raw.substring(0,Ge.raw.length-St),Ye=Xe-1);Yt=Ft}Ct=ct.length,ct=ct.replace(/^ *([*+-]|\d+[.)]) ?/,""),~ct.indexOf(`
|
|
`)&&(Ct-=ct.length,ct=this.options.pedantic?ct.replace(/^ {1,4}/gm,""):ct.replace(new RegExp("^ {1,"+Ct+"}","gm"),"")),ct=B(ct,`
|
|
`),Ye!==Xe-1&&(Z=Z+`
|
|
`),li=ot||/\n\n(?!\s*$)/.test(Z),Ye!==Xe-1&&(ot=Z.slice(-2)===`
|
|
|
|
`,li||(li=ot)),li&&(Ge.loose=!0),this.options.gfm&&(yi=/^\[[ xX]\] /.test(ct),ci=void 0,yi&&(ci=ct[1]!==" ",ct=ct.replace(/^\[[ xX]\] +/,""))),Ge.items.push({type:"list_item",raw:Z,task:yi,checked:ci,loose:li,text:ct})}return Ge}},le.html=function(I){var $=this.rules.block.html.exec(I);if($)return{type:this.options.sanitize?"paragraph":"html",raw:$[0],pre:!this.options.sanitizer&&($[1]==="pre"||$[1]==="script"||$[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer($[0]):_($[0]):$[0]}},le.def=function(I){var $=this.rules.block.def.exec(I);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var Z=$[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:Z,raw:$[0],href:$[2],title:$[3]}}},le.table=function(I){var $=this.rules.block.table.exec(I);if($){var Z={type:"table",header:E($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[]};if(Z.header.length===Z.align.length){Z.raw=$[0];var se=Z.align.length,re;for(re=0;re<se;re++)/^ *-+: *$/.test(Z.align[re])?Z.align[re]="right":/^ *:-+: *$/.test(Z.align[re])?Z.align[re]="center":/^ *:-+ *$/.test(Z.align[re])?Z.align[re]="left":Z.align[re]=null;for(se=Z.cells.length,re=0;re<se;re++)Z.cells[re]=E(Z.cells[re].replace(/^ *\| *| *\| *$/g,""),Z.header.length);return Z}}},le.lheading=function(I){var $=this.rules.block.lheading.exec(I);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},le.paragraph=function(I){var $=this.rules.block.paragraph.exec(I);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
|
|
`?$[1].slice(0,-1):$[1]}},le.text=function(I){var $=this.rules.block.text.exec(I);if($)return{type:"text",raw:$[0],text:$[0]}},le.escape=function(I){var $=this.rules.inline.escape.exec(I);if($)return{type:"escape",raw:$[0],text:_($[1])}},le.tag=function(I,$,Z){var se=this.rules.inline.tag.exec(I);if(se)return!$&&/^<a /i.test(se[0])?$=!0:$&&/^<\/a>/i.test(se[0])&&($=!1),!Z&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?Z=!0:Z&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(Z=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:$,inRawBlock:Z,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):_(se[0]):se[0]}},le.link=function(I){var $=this.rules.inline.link.exec(I);if($){var Z=$[2].trim();if(!this.options.pedantic&&/^</.test(Z)){if(!/>$/.test(Z))return;var se=B(Z.slice(0,-1),"\\");if((Z.length-se.length)%2===0)return}else{var re=R($[2],"()");if(re>-1){var Ge=$[0].indexOf("!")===0?5:4,ze=Ge+$[1].length+re;$[2]=$[2].substring(0,re),$[0]=$[0].substring(0,ze).trim(),$[3]=""}}var ot=$[2],ct="";if(this.options.pedantic){var Ct=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ot);Ct&&(ot=Ct[1],ct=Ct[3])}else ct=$[3]?$[3].slice(1,-1):"";return ot=ot.trim(),/^</.test(ot)&&(this.options.pedantic&&!/>$/.test(Z)?ot=ot.slice(1):ot=ot.slice(1,-1)),q($,{href:ot&&ot.replace(this.rules.inline._escapes,"$1"),title:ct&&ct.replace(this.rules.inline._escapes,"$1")},$[0])}},le.reflink=function(I,$){var Z;if((Z=this.rules.inline.reflink.exec(I))||(Z=this.rules.inline.nolink.exec(I))){var se=(Z[2]||Z[1]).replace(/\s+/g," ");if(se=$[se.toLowerCase()],!se||!se.href){var re=Z[0].charAt(0);return{type:"text",raw:re,text:re}}return q(Z,se,Z[0])}},le.emStrong=function(I,$,Z){Z===void 0&&(Z="");var se=this.rules.inline.emStrong.lDelim.exec(I);if(se&&!(se[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 re=se[1]||se[2]||"";if(!re||re&&(Z===""||this.rules.inline.punctuation.exec(Z))){var Ge=se[0].length-1,ze,ot,ct=Ge,Ct=0,Yt=se[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(Yt.lastIndex=0,$=$.slice(-1*I.length+Ge);(se=Yt.exec($))!=null;)if(ze=se[1]||se[2]||se[3]||se[4]||se[5]||se[6],!!ze){if(ot=ze.length,se[3]||se[4]){ct+=ot;continue}else if((se[5]||se[6])&&Ge%3&&!((Ge+ot)%3)){Ct+=ot;continue}if(ct-=ot,!(ct>0))return ot=Math.min(ot,ot+ct+Ct),Math.min(Ge,ot)%2?{type:"em",raw:I.slice(0,Ge+se.index+ot+1),text:I.slice(1,Ge+se.index+ot)}:{type:"strong",raw:I.slice(0,Ge+se.index+ot+1),text:I.slice(2,Ge+se.index+ot-1)}}}}},le.codespan=function(I){var $=this.rules.inline.code.exec(I);if($){var Z=$[2].replace(/\n/g," "),se=/[^ ]/.test(Z),re=/^ /.test(Z)&&/ $/.test(Z);return se&&re&&(Z=Z.substring(1,Z.length-1)),Z=_(Z,!0),{type:"codespan",raw:$[0],text:Z}}},le.br=function(I){var $=this.rules.inline.br.exec(I);if($)return{type:"br",raw:$[0]}},le.del=function(I){var $=this.rules.inline.del.exec(I);if($)return{type:"del",raw:$[0],text:$[2]}},le.autolink=function(I,$){var Z=this.rules.inline.autolink.exec(I);if(Z){var se,re;return Z[2]==="@"?(se=_(this.options.mangle?$(Z[1]):Z[1]),re="mailto:"+se):(se=_(Z[1]),re=se),{type:"link",raw:Z[0],text:se,href:re,tokens:[{type:"text",raw:se,text:se}]}}},le.url=function(I,$){var Z;if(Z=this.rules.inline.url.exec(I)){var se,re;if(Z[2]==="@")se=_(this.options.mangle?$(Z[0]):Z[0]),re="mailto:"+se;else{var Ge;do Ge=Z[0],Z[0]=this.rules.inline._backpedal.exec(Z[0])[0];while(Ge!==Z[0]);se=_(Z[0]),Z[1]==="www."?re="http://"+se:re=se}return{type:"link",raw:Z[0],text:se,href:re,tokens:[{type:"text",raw:se,text:se}]}}},le.inlineText=function(I,$,Z){var se=this.rules.inline.text.exec(I);if(se){var re;return $?re=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):_(se[0]):se[0]:re=_(this.options.smartypants?Z(se[0]):se[0]),{type:"text",raw:se[0],text:re}}},be}(),Je=U.noopTest,He=U.edit,yt=U.merge,tt={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:Je,table:Je,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};tt._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,tt._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,tt.def=He(tt.def).replace("label",tt._label).replace("title",tt._title).getRegex(),tt.bullet=/(?:[*+-]|\d{1,9}[.)])/,tt.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,tt.item=He(tt.item,"gm").replace(/bull/g,tt.bullet).getRegex(),tt.listItemStart=He(/^( *)(bull) */).replace("bull",tt.bullet).getRegex(),tt.list=He(tt.list).replace(/bull/g,tt.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+tt.def.source+")").getRegex(),tt._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",tt._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,tt.html=He(tt.html,"i").replace("comment",tt._comment).replace("tag",tt._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),tt.paragraph=He(tt._paragraph).replace("hr",tt.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",tt._tag).getRegex(),tt.blockquote=He(tt.blockquote).replace("paragraph",tt.paragraph).getRegex(),tt.normal=yt({},tt),tt.gfm=yt({},tt.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*|$)"}),tt.gfm.nptable=He(tt.gfm.nptable).replace("hr",tt.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",tt._tag).getRegex(),tt.gfm.table=He(tt.gfm.table).replace("hr",tt.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",tt._tag).getRegex(),tt.pedantic=yt({},tt.normal,{html:He(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",tt._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:Je,paragraph:He(tt.normal._paragraph).replace("hr",tt.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",tt.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Ke={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Je,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:Je,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};Ke._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Ke.punctuation=He(Ke.punctuation).replace(/punctuation/g,Ke._punctuation).getRegex(),Ke.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,Ke.escapedEmSt=/\\\*|\\_/g,Ke._comment=He(tt._comment).replace("(?:-->|$)","-->").getRegex(),Ke.emStrong.lDelim=He(Ke.emStrong.lDelim).replace(/punct/g,Ke._punctuation).getRegex(),Ke.emStrong.rDelimAst=He(Ke.emStrong.rDelimAst,"g").replace(/punct/g,Ke._punctuation).getRegex(),Ke.emStrong.rDelimUnd=He(Ke.emStrong.rDelimUnd,"g").replace(/punct/g,Ke._punctuation).getRegex(),Ke._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Ke._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Ke._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])?)+(?![-_])/,Ke.autolink=He(Ke.autolink).replace("scheme",Ke._scheme).replace("email",Ke._email).getRegex(),Ke._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Ke.tag=He(Ke.tag).replace("comment",Ke._comment).replace("attribute",Ke._attribute).getRegex(),Ke._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ke._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Ke._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Ke.link=He(Ke.link).replace("label",Ke._label).replace("href",Ke._href).replace("title",Ke._title).getRegex(),Ke.reflink=He(Ke.reflink).replace("label",Ke._label).getRegex(),Ke.reflinkSearch=He(Ke.reflinkSearch,"g").replace("reflink",Ke.reflink).replace("nolink",Ke.nolink).getRegex(),Ke.normal=yt({},Ke),Ke.pedantic=yt({},Ke.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:He(/^!?\[(label)\]\((.*?)\)/).replace("label",Ke._label).getRegex(),reflink:He(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ke._label).getRegex()}),Ke.gfm=yt({},Ke.normal,{escape:He(Ke.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Ke.gfm.url=He(Ke.gfm.url,"i").replace("email",Ke.gfm._extended_email).getRegex(),Ke.breaks=yt({},Ke.gfm,{br:He(Ke.br).replace("{2,}","*").getRegex(),text:He(Ke.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Mt={block:tt,inline:Ke},$e=Re,pt=oe.exports.defaults,Oe=Mt.block,wt=Mt.inline,de=U.repeatString;function Ee(be){return be.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 Q(be){var le="",he,I,$=be.length;for(he=0;he<$;he++)I=be.charCodeAt(he),Math.random()>.5&&(I="x"+I.toString(16)),le+="&#"+I+";";return le}var Le=function(){function be(he){this.tokens=[],this.tokens.links=Object.create(null),this.options=he||pt,this.options.tokenizer=this.options.tokenizer||new $e,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var I={block:Oe.normal,inline:wt.normal};this.options.pedantic?(I.block=Oe.pedantic,I.inline=wt.pedantic):this.options.gfm&&(I.block=Oe.gfm,this.options.breaks?I.inline=wt.breaks:I.inline=wt.gfm),this.tokenizer.rules=I}be.lex=function(I,$){var Z=new be($);return Z.lex(I)},be.lexInline=function(I,$){var Z=new be($);return Z.inlineTokens(I)};var le=be.prototype;return le.lex=function(I){return I=I.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(I,this.tokens,!0),this.inline(this.tokens),this.tokens},le.blockTokens=function(I,$,Z){$===void 0&&($=[]),Z===void 0&&(Z=!0),this.options.pedantic&&(I=I.replace(/^ +$/gm,""));for(var se,re,Ge,ze;I;){if(se=this.tokenizer.space(I)){I=I.substring(se.raw.length),se.type&&$.push(se);continue}if(se=this.tokenizer.code(I)){I=I.substring(se.raw.length),ze=$[$.length-1],ze&&ze.type==="paragraph"?(ze.raw+=`
|
|
`+se.raw,ze.text+=`
|
|
`+se.text):$.push(se);continue}if(se=this.tokenizer.fences(I)){I=I.substring(se.raw.length),$.push(se);continue}if(se=this.tokenizer.heading(I)){I=I.substring(se.raw.length),$.push(se);continue}if(se=this.tokenizer.nptable(I)){I=I.substring(se.raw.length),$.push(se);continue}if(se=this.tokenizer.hr(I)){I=I.substring(se.raw.length),$.push(se);continue}if(se=this.tokenizer.blockquote(I)){I=I.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],Z),$.push(se);continue}if(se=this.tokenizer.list(I)){for(I=I.substring(se.raw.length),Ge=se.items.length,re=0;re<Ge;re++)se.items[re].tokens=this.blockTokens(se.items[re].text,[],!1);$.push(se);continue}if(se=this.tokenizer.html(I)){I=I.substring(se.raw.length),$.push(se);continue}if(Z&&(se=this.tokenizer.def(I))){I=I.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table(I)){I=I.substring(se.raw.length),$.push(se);continue}if(se=this.tokenizer.lheading(I)){I=I.substring(se.raw.length),$.push(se);continue}if(Z&&(se=this.tokenizer.paragraph(I))){I=I.substring(se.raw.length),$.push(se);continue}if(se=this.tokenizer.text(I)){I=I.substring(se.raw.length),ze=$[$.length-1],ze&&ze.type==="text"?(ze.raw+=`
|
|
`+se.raw,ze.text+=`
|
|
`+se.text):$.push(se);continue}if(I){var ot="Infinite loop on byte: "+I.charCodeAt(0);if(this.options.silent){console.error(ot);break}else throw new Error(ot)}}return $},le.inline=function(I){var $,Z,se,re,Ge,ze,ot=I.length;for($=0;$<ot;$++)switch(ze=I[$],ze.type){case"paragraph":case"text":case"heading":{ze.tokens=[],this.inlineTokens(ze.text,ze.tokens);break}case"table":{for(ze.tokens={header:[],cells:[]},re=ze.header.length,Z=0;Z<re;Z++)ze.tokens.header[Z]=[],this.inlineTokens(ze.header[Z],ze.tokens.header[Z]);for(re=ze.cells.length,Z=0;Z<re;Z++)for(Ge=ze.cells[Z],ze.tokens.cells[Z]=[],se=0;se<Ge.length;se++)ze.tokens.cells[Z][se]=[],this.inlineTokens(Ge[se],ze.tokens.cells[Z][se]);break}case"blockquote":{this.inline(ze.tokens);break}case"list":{for(re=ze.items.length,Z=0;Z<re;Z++)this.inline(ze.items[Z].tokens);break}}return I},le.inlineTokens=function(I,$,Z,se){$===void 0&&($=[]),Z===void 0&&(Z=!1),se===void 0&&(se=!1);var re,Ge,ze=I,ot,ct,Ct;if(this.tokens.links){var Yt=Object.keys(this.tokens.links);if(Yt.length>0)for(;(ot=this.tokenizer.rules.inline.reflinkSearch.exec(ze))!=null;)Yt.includes(ot[0].slice(ot[0].lastIndexOf("[")+1,-1))&&(ze=ze.slice(0,ot.index)+"["+de("a",ot[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ot=this.tokenizer.rules.inline.blockSkip.exec(ze))!=null;)ze=ze.slice(0,ot.index)+"["+de("a",ot[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(ot=this.tokenizer.rules.inline.escapedEmSt.exec(ze))!=null;)ze=ze.slice(0,ot.index)+"++"+ze.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;I;){if(ct||(Ct=""),ct=!1,re=this.tokenizer.escape(I)){I=I.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.tag(I,Z,se)){I=I.substring(re.raw.length),Z=re.inLink,se=re.inRawBlock;var Ft=$[$.length-1];Ft&&re.type==="text"&&Ft.type==="text"?(Ft.raw+=re.raw,Ft.text+=re.text):$.push(re);continue}if(re=this.tokenizer.link(I)){I=I.substring(re.raw.length),re.type==="link"&&(re.tokens=this.inlineTokens(re.text,[],!0,se)),$.push(re);continue}if(re=this.tokenizer.reflink(I,this.tokens.links)){I=I.substring(re.raw.length);var St=$[$.length-1];re.type==="link"?(re.tokens=this.inlineTokens(re.text,[],!0,se),$.push(re)):St&&re.type==="text"&&St.type==="text"?(St.raw+=re.raw,St.text+=re.text):$.push(re);continue}if(re=this.tokenizer.emStrong(I,ze,Ct)){I=I.substring(re.raw.length),re.tokens=this.inlineTokens(re.text,[],Z,se),$.push(re);continue}if(re=this.tokenizer.codespan(I)){I=I.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.br(I)){I=I.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.del(I)){I=I.substring(re.raw.length),re.tokens=this.inlineTokens(re.text,[],Z,se),$.push(re);continue}if(re=this.tokenizer.autolink(I,Q)){I=I.substring(re.raw.length),$.push(re);continue}if(!Z&&(re=this.tokenizer.url(I,Q))){I=I.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.inlineText(I,se,Ee)){I=I.substring(re.raw.length),re.raw.slice(-1)!=="_"&&(Ct=re.raw.slice(-1)),ct=!0,Ge=$[$.length-1],Ge&&Ge.type==="text"?(Ge.raw+=re.raw,Ge.text+=re.text):$.push(re);continue}if(I){var li="Infinite loop on byte: "+I.charCodeAt(0);if(this.options.silent){console.error(li);break}else throw new Error(li)}}return $},ee(be,null,[{key:"rules",get:function(){return{block:Oe,inline:wt}}}]),be}(),Ce=oe.exports.defaults,Ve=U.cleanUrl,G=U.escape,ae=function(){function be(he){this.options=he||Ce}var le=be.prototype;return le.code=function(I,$,Z){var se=($||"").match(/\S*/)[0];if(this.options.highlight){var re=this.options.highlight(I,se);re!=null&&re!==I&&(Z=!0,I=re)}return I=I.replace(/\n$/,"")+`
|
|
`,se?'<pre><code class="'+this.options.langPrefix+G(se,!0)+'">'+(Z?I:G(I,!0))+`</code></pre>
|
|
`:"<pre><code>"+(Z?I:G(I,!0))+`</code></pre>
|
|
`},le.blockquote=function(I){return`<blockquote>
|
|
`+I+`</blockquote>
|
|
`},le.html=function(I){return I},le.heading=function(I,$,Z,se){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+se.slug(Z)+'">'+I+"</h"+$+`>
|
|
`:"<h"+$+">"+I+"</h"+$+`>
|
|
`},le.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},le.list=function(I,$,Z){var se=$?"ol":"ul",re=$&&Z!==1?' start="'+Z+'"':"";return"<"+se+re+`>
|
|
`+I+"</"+se+`>
|
|
`},le.listitem=function(I){return"<li>"+I+`</li>
|
|
`},le.checkbox=function(I){return"<input "+(I?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},le.paragraph=function(I){return"<p>"+I+`</p>
|
|
`},le.table=function(I,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
|
|
<thead>
|
|
`+I+`</thead>
|
|
`+$+`</table>
|
|
`},le.tablerow=function(I){return`<tr>
|
|
`+I+`</tr>
|
|
`},le.tablecell=function(I,$){var Z=$.header?"th":"td",se=$.align?"<"+Z+' align="'+$.align+'">':"<"+Z+">";return se+I+"</"+Z+`>
|
|
`},le.strong=function(I){return"<strong>"+I+"</strong>"},le.em=function(I){return"<em>"+I+"</em>"},le.codespan=function(I){return"<code>"+I+"</code>"},le.br=function(){return this.options.xhtml?"<br/>":"<br>"},le.del=function(I){return"<del>"+I+"</del>"},le.link=function(I,$,Z){if(I=Ve(this.options.sanitize,this.options.baseUrl,I),I===null)return Z;var se='<a href="'+G(I)+'"';return $&&(se+=' title="'+$+'"'),se+=">"+Z+"</a>",se},le.image=function(I,$,Z){if(I=Ve(this.options.sanitize,this.options.baseUrl,I),I===null)return Z;var se='<img src="'+I+'" alt="'+Z+'"';return $&&(se+=' title="'+$+'"'),se+=this.options.xhtml?"/>":">",se},le.text=function(I){return I},be}(),we=function(){function be(){}var le=be.prototype;return le.strong=function(I){return I},le.em=function(I){return I},le.codespan=function(I){return I},le.del=function(I){return I},le.html=function(I){return I},le.text=function(I){return I},le.link=function(I,$,Z){return""+Z},le.image=function(I,$,Z){return""+Z},le.br=function(){return""},be}(),De=function(){function be(){this.seen={}}var le=be.prototype;return le.serialize=function(I){return I.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},le.getNextSafeSlug=function(I,$){var Z=I,se=0;if(this.seen.hasOwnProperty(Z)){se=this.seen[I];do se++,Z=I+"-"+se;while(this.seen.hasOwnProperty(Z))}return $||(this.seen[I]=se,this.seen[Z]=0),Z},le.slug=function(I,$){$===void 0&&($={});var Z=this.serialize(I);return this.getNextSafeSlug(Z,$.dryrun)},be}(),ke=ae,je=we,ut=De,Qe=oe.exports.defaults,qe=U.unescape,Ue=function(){function be(he){this.options=he||Qe,this.options.renderer=this.options.renderer||new ke,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new je,this.slugger=new ut}be.parse=function(I,$){var Z=new be($);return Z.parse(I)},be.parseInline=function(I,$){var Z=new be($);return Z.parseInline(I)};var le=be.prototype;return le.parse=function(I,$){$===void 0&&($=!0);var Z="",se,re,Ge,ze,ot,ct,Ct,Yt,Ft,St,li,yi,ci,ai,Xe,Ye,Pt,$t,Ht=I.length;for(se=0;se<Ht;se++)switch(St=I[se],St.type){case"space":continue;case"hr":{Z+=this.renderer.hr();continue}case"heading":{Z+=this.renderer.heading(this.parseInline(St.tokens),St.depth,qe(this.parseInline(St.tokens,this.textRenderer)),this.slugger);continue}case"code":{Z+=this.renderer.code(St.text,St.lang,St.escaped);continue}case"table":{for(Yt="",Ct="",ze=St.header.length,re=0;re<ze;re++)Ct+=this.renderer.tablecell(this.parseInline(St.tokens.header[re]),{header:!0,align:St.align[re]});for(Yt+=this.renderer.tablerow(Ct),Ft="",ze=St.cells.length,re=0;re<ze;re++){for(ct=St.tokens.cells[re],Ct="",ot=ct.length,Ge=0;Ge<ot;Ge++)Ct+=this.renderer.tablecell(this.parseInline(ct[Ge]),{header:!1,align:St.align[Ge]});Ft+=this.renderer.tablerow(Ct)}Z+=this.renderer.table(Yt,Ft);continue}case"blockquote":{Ft=this.parse(St.tokens),Z+=this.renderer.blockquote(Ft);continue}case"list":{for(li=St.ordered,yi=St.start,ci=St.loose,ze=St.items.length,Ft="",re=0;re<ze;re++)Xe=St.items[re],Ye=Xe.checked,Pt=Xe.task,ai="",Xe.task&&($t=this.renderer.checkbox(Ye),ci?Xe.tokens.length>0&&Xe.tokens[0].type==="text"?(Xe.tokens[0].text=$t+" "+Xe.tokens[0].text,Xe.tokens[0].tokens&&Xe.tokens[0].tokens.length>0&&Xe.tokens[0].tokens[0].type==="text"&&(Xe.tokens[0].tokens[0].text=$t+" "+Xe.tokens[0].tokens[0].text)):Xe.tokens.unshift({type:"text",text:$t}):ai+=$t),ai+=this.parse(Xe.tokens,ci),Ft+=this.renderer.listitem(ai,Pt,Ye);Z+=this.renderer.list(Ft,li,yi);continue}case"html":{Z+=this.renderer.html(St.text);continue}case"paragraph":{Z+=this.renderer.paragraph(this.parseInline(St.tokens));continue}case"text":{for(Ft=St.tokens?this.parseInline(St.tokens):St.text;se+1<Ht&&I[se+1].type==="text";)St=I[++se],Ft+=`
|
|
`+(St.tokens?this.parseInline(St.tokens):St.text);Z+=$?this.renderer.paragraph(Ft):Ft;continue}default:{var qt='Token with "'+St.type+'" type was not found.';if(this.options.silent){console.error(qt);return}else throw new Error(qt)}}return Z},le.parseInline=function(I,$){$=$||this.renderer;var Z="",se,re,Ge=I.length;for(se=0;se<Ge;se++)switch(re=I[se],re.type){case"escape":{Z+=$.text(re.text);break}case"html":{Z+=$.html(re.text);break}case"link":{Z+=$.link(re.href,re.title,this.parseInline(re.tokens,$));break}case"image":{Z+=$.image(re.href,re.title,re.text);break}case"strong":{Z+=$.strong(this.parseInline(re.tokens,$));break}case"em":{Z+=$.em(this.parseInline(re.tokens,$));break}case"codespan":{Z+=$.codespan(re.text);break}case"br":{Z+=$.br();break}case"del":{Z+=$.del(this.parseInline(re.tokens,$));break}case"text":{Z+=$.text(re.text);break}default:{var ze='Token with "'+re.type+'" type was not found.';if(this.options.silent){console.error(ze);return}else throw new Error(ze)}}return Z},be}(),dt=Le,ht=Ue,et=Re,_e=ae,it=we,We=De,Be=U.merge,At=U.checkSanitizeDeprecation,vt=U.escape,nt=oe.exports.getDefaults,It=oe.exports.changeDefaults,Bt=oe.exports.defaults;function Et(be,le,he){if(typeof be=="undefined"||be===null)throw new Error("marked(): input parameter is undefined or null");if(typeof be!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(be)+", string expected");if(typeof le=="function"&&(he=le,le=null),le=Be({},Et.defaults,le||{}),At(le),he){var I=le.highlight,$;try{$=dt.lex(be,le)}catch(Ge){return he(Ge)}var Z=function(ze){var ot;if(!ze)try{le.walkTokens&&Et.walkTokens($,le.walkTokens),ot=ht.parse($,le)}catch(ct){ze=ct}return le.highlight=I,ze?he(ze):he(null,ot)};if(!I||I.length<3||(delete le.highlight,!$.length))return Z();var se=0;Et.walkTokens($,function(Ge){Ge.type==="code"&&(se++,setTimeout(function(){I(Ge.text,Ge.lang,function(ze,ot){if(ze)return Z(ze);ot!=null&&ot!==Ge.text&&(Ge.text=ot,Ge.escaped=!0),se--,se===0&&Z()})},0))}),se===0&&Z();return}try{var re=dt.lex(be,le);return le.walkTokens&&Et.walkTokens(re,le.walkTokens),ht.parse(re,le)}catch(Ge){if(Ge.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+vt(Ge.message+"",!0)+"</pre>";throw Ge}}Et.options=Et.setOptions=function(be){return Be(Et.defaults,be),It(Et.defaults),Et},Et.getDefaults=nt,Et.defaults=Bt,Et.use=function(be){var le=Be({},be);if(be.renderer&&function(){var I=Et.defaults.renderer||new _e,$=function(re){var Ge=I[re];I[re]=function(){for(var ze=arguments.length,ot=new Array(ze),ct=0;ct<ze;ct++)ot[ct]=arguments[ct];var Ct=be.renderer[re].apply(I,ot);return Ct===!1&&(Ct=Ge.apply(I,ot)),Ct}};for(var Z in be.renderer)$(Z);le.renderer=I}(),be.tokenizer&&function(){var I=Et.defaults.tokenizer||new et,$=function(re){var Ge=I[re];I[re]=function(){for(var ze=arguments.length,ot=new Array(ze),ct=0;ct<ze;ct++)ot[ct]=arguments[ct];var Ct=be.tokenizer[re].apply(I,ot);return Ct===!1&&(Ct=Ge.apply(I,ot)),Ct}};for(var Z in be.tokenizer)$(Z);le.tokenizer=I}(),be.walkTokens){var he=Et.defaults.walkTokens;le.walkTokens=function(I){be.walkTokens(I),he&&he(I)}}Et.setOptions(le)},Et.walkTokens=function(be,le){for(var he=Ne(be),I;!(I=he()).done;){var $=I.value;switch(le($),$.type){case"table":{for(var Z=Ne($.tokens.header),se;!(se=Z()).done;){var re=se.value;Et.walkTokens(re,le)}for(var Ge=Ne($.tokens.cells),ze;!(ze=Ge()).done;)for(var ot=ze.value,ct=Ne(ot),Ct;!(Ct=ct()).done;){var Yt=Ct.value;Et.walkTokens(Yt,le)}break}case"list":{Et.walkTokens($.items,le);break}default:$.tokens&&Et.walkTokens($.tokens,le)}}},Et.parseInline=function(be,le){if(typeof be=="undefined"||be===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof be!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(be)+", string expected");le=Be({},Et.defaults,le||{}),At(le);try{var he=dt.lexInline(be,le);return le.walkTokens&&Et.walkTokens(he,le.walkTokens),ht.parseInline(he,le)}catch(I){if(I.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+vt(I.message+"",!0)+"</pre>";throw I}},Et.Parser=ht,Et.parser=ht.parse,Et.Renderer=_e,Et.TextRenderer=it,Et.Lexer=dt,Et.lexer=dt.lex,Et.Tokenizer=et,Et.Slugger=We,Et.parse=Et;var ei=Et;return ei})},11690:function(Dt){const Ze=/[&<>"']/,ee=/[&<>"']/g,N=/[<>"']|&(?!#?\w+;)/,ye=/[<>"']|&(?!#?\w+;)/g,Ne={"&":"&","<":"<",">":">",'"':""","'":"'"},oe=W=>Ne[W];function V(W,te){if(te){if(Ze.test(W))return W.replace(ee,oe)}else if(N.test(W))return W.replace(ye,oe);return W}const p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ge(W){return W.replace(p,(te,fe)=>(fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""))}const ne=/(^|[^\[])\^/g;function l(W,te){W=W.source||W,te=te||"";const fe={replace:(me,Pe)=>(Pe=Pe.source||Pe,Pe=Pe.replace(ne,"$1"),W=W.replace(me,Pe),fe),getRegex:()=>new RegExp(W,te)};return fe}const z=/[^\w:]/g,D=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function g(W,te,fe){if(W){let me;try{me=decodeURIComponent(ge(fe)).replace(z,"").toLowerCase()}catch(Pe){return null}if(me.indexOf("javascript:")===0||me.indexOf("vbscript:")===0||me.indexOf("data:")===0)return null}te&&!D.test(fe)&&(fe=P(te,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(me){return null}return fe}const x={},y=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,O=/^([^:]+:\/*[^/]*)[\s\S]*$/;function P(W,te){x[" "+W]||(y.test(W)?x[" "+W]=W+"/":x[" "+W]=j(W,"/",!0)),W=x[" "+W];const fe=W.indexOf(":")===-1;return te.substring(0,2)==="//"?fe?te:W.replace(b,"$1")+te:te.charAt(0)==="/"?fe?te:W.replace(O,"$1")+te:W+te}const F={exec:function(){}};function S(W){let te=1,fe,me;for(;te<arguments.length;te++){fe=arguments[te];for(me in fe)Object.prototype.hasOwnProperty.call(fe,me)&&(W[me]=fe[me])}return W}function L(W,te){const fe=W.replace(/\|/g,(M,A,C)=>{let U=!1,Y=A;for(;--Y>=0&&C[Y]==="\\";)U=!U;return U?"|":" |"}),me=fe.split(/ \|/);let Pe=0;if(me.length>te)me.splice(te);else for(;me.length<te;)me.push("");for(;Pe<me.length;Pe++)me[Pe]=me[Pe].trim().replace(/\\\|/g,"|");return me}function j(W,te,fe){const me=W.length;if(me===0)return"";let Pe=0;for(;Pe<me;){const M=W.charAt(me-Pe-1);if(M===te&&!fe)Pe++;else if(M!==te&&fe)Pe++;else break}return W.substr(0,me-Pe)}function K(W,te){if(W.indexOf(te[1])===-1)return-1;const fe=W.length;let me=0,Pe=0;for(;Pe<fe;Pe++)if(W[Pe]==="\\")Pe++;else if(W[Pe]===te[0])me++;else if(W[Pe]===te[1]&&(me--,me<0))return Pe;return-1}function J(W){W&&W.sanitize&&!W.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 ie(W,te){if(te<1)return"";let fe="";for(;te>1;)te&1&&(fe+=W),te>>=1,W+=W;return fe+W}Dt.exports={escape:V,unescape:ge,edit:l,cleanUrl:g,resolveUrl:P,noopTest:F,merge:S,splitCells:L,rtrim:j,findClosingBracket:K,checkSanitizeDeprecation:J,repeatString:ie}},75918:function(Dt,Ze,ee){"use strict";ee.d(Ze,{Wi:function(){return p},Z0:function(){return ge},aU:function(){return V},eZ:function(){return l},wY:function(){return ne}});var N=ee(4348),ye=ee(69323),Ne=ee(13268),oe=function(z,D,g,x){function y(b){return b instanceof g?b:new g(function(O){O(b)})}return new(g||(g=Promise))(function(b,O){function P(L){try{S(x.next(L))}catch(j){O(j)}}function F(L){try{S(x.throw(L))}catch(j){O(j)}}function S(L){L.done?b(L.value):y(L.value).then(P,F)}S((x=x.apply(z,D||[])).next())})};class V extends ye.JT{constructor(D,g="",x="",y=!0,b){super(),this._onDidChange=this._register(new N.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=D,this._label=g,this._cssClass=x,this._enabled=y,this._actionCallback=b}get id(){return this._id}get label(){return this._label}set label(D){this._setLabel(D)}_setLabel(D){this._label!==D&&(this._label=D,this._onDidChange.fire({label:D}))}get tooltip(){return this._tooltip||""}set tooltip(D){this._setTooltip(D)}_setTooltip(D){this._tooltip!==D&&(this._tooltip=D,this._onDidChange.fire({tooltip:D}))}get class(){return this._cssClass}set class(D){this._setClass(D)}_setClass(D){this._cssClass!==D&&(this._cssClass=D,this._onDidChange.fire({class:D}))}get enabled(){return this._enabled}set enabled(D){this._setEnabled(D)}_setEnabled(D){this._enabled!==D&&(this._enabled=D,this._onDidChange.fire({enabled:D}))}get checked(){return this._checked}set checked(D){this._setChecked(D)}_setChecked(D){this._checked!==D&&(this._checked=D,this._onDidChange.fire({checked:D}))}run(D,g){return oe(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(D))})}}class p extends ye.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new N.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new N.Q5),this.onDidRun=this._onDidRun.event}run(D,g){return oe(this,void 0,void 0,function*(){if(!D.enabled)return;this._onBeforeRun.fire({action:D});let x;try{yield this.runAction(D,g)}catch(y){x=y}this._onDidRun.fire({action:D,error:x})})}runAction(D,g){return oe(this,void 0,void 0,function*(){yield D.run(g)})}}class ge extends V{constructor(D){super(ge.ID,D,D?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ge.ID="vs.actions.separator";class ne{constructor(D,g,x,y){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=D,this.label=g,this.class=y,this._actions=x}get actions(){return this._actions}dispose(){}run(){return oe(this,void 0,void 0,function*(){})}}class l extends V{constructor(){super(l.ID,Ne.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Dt,Ze,ee){"use strict";ee.d(Ze,{ok:function(){return N}});function N(ye,Ne){if(!ye)throw new Error(Ne?`Assertion failed (${Ne})`:"Assertion Failed")}},52615:function(Dt,Ze,ee){"use strict";ee.d(Ze,{CM:function(){return V},JL:function(){return p},dT:function(){return ne},fK:function(){return oe},lA:function(){return ge}});var N=ee(4348);class ye{constructor(){this._icons=new Map,this._onDidRegister=new N.Q5}add(z){const D=this._icons.get(z.id);D?z.description?D.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 Ne=new ye,oe=Ne;function V(l,z){return new ge(l,z)}function p(l){return l?l.replace(/\$\((.*?)\)/g,(z,D)=>` ${D} `).trim():""}class ge{constructor(z,D,g){this.id=z,this.definition=D,this.description=g,Ne.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var ne;(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 D(y){if(y instanceof ge)return["codicon","codicon-"+y.id];const b=z.exec(y.id);if(!b)return D(ge.error);let[,O,P]=b;const F=["codicon","codicon-"+O];return P&&F.push("codicon-modifier-"+P.substr(1)),F}l.asClassNameArray=D;function g(y){return D(y).join(" ")}l.asClassName=g;function x(y){return"."+D(y).join(".")}l.asCSSSelector=x})(ne||(ne={})),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"})}(ge||(ge={}))},79881:function(Dt,Ze,ee){"use strict";ee.d(Ze,{B8:function(){return D},Cp:function(){return oe},F0:function(){return ne},L6:function(){return z},VV:function(){return ge},b1:function(){return l},dL:function(){return Ne},ri:function(){return V}});class N{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(x){setTimeout(()=>{throw x.stack?new Error(x.message+`
|
|
|
|
`+x.stack):x},0)}}emit(x){this.listeners.forEach(y=>{y(x)})}onUnexpectedError(x){this.unexpectedErrorHandler(x),this.emit(x)}onUnexpectedExternalError(x){this.unexpectedErrorHandler(x)}}const ye=new N;function Ne(g){ge(g)||ye.onUnexpectedError(g)}function oe(g){ge(g)||ye.onUnexpectedExternalError(g)}function V(g){if(g instanceof Error){let{name:x,message:y}=g;const b=g.stacktrace||g.stack;return{$isError:!0,name:x,message:y,stack:b}}return g}const p="Canceled";function ge(g){return g instanceof Error&&g.name===p&&g.message===p}function ne(){const g=new Error(p);return g.name=g.message,g}function l(g){return g?new Error(`Illegal argument: ${g}`):new Error("Illegal argument")}function z(g){return g?new Error(`Illegal state: ${g}`):new Error("Illegal state")}class D extends Error{constructor(x){super("NotSupported"),x&&(this.message=x)}}},4348:function(Dt,Ze,ee){"use strict";ee.d(Ze,{D0:function(){return D},E7:function(){return g},K3:function(){return z},Q5:function(){return l},ZD:function(){return x},ju:function(){return V}});var N=ee(79881),ye=ee(69323),Ne=ee(34502),oe=ee(95830),V;(function(y){y.None=()=>ye.JT.None;function b(C){return(U,Y=null,B)=>{let E=!1,_;return _=C(R=>{if(!E)return _?_.dispose():E=!0,U.call(Y,R)},null,B),E&&_.dispose(),_}}y.once=b;function O(C,U){return K((Y,B=null,E)=>C(_=>Y.call(B,U(_)),null,E))}y.map=O;function P(C,U){return K((Y,B=null,E)=>C(_=>{U(_),Y.call(B,_)},null,E))}y.forEach=P;function F(C,U){return K((Y,B=null,E)=>C(_=>U(_)&&Y.call(B,_),null,E))}y.filter=F;function S(C){return C}y.signal=S;function L(...C){return(U,Y=null,B)=>(0,ye.F8)(...C.map(E=>E(_=>U.call(Y,_),null,B)))}y.any=L;function j(C,U,Y){let B=Y;return O(C,E=>(B=U(B,E),B))}y.reduce=j;function K(C){let U;const Y=new l({onFirstListenerAdd(){U=C(Y.fire,Y)},onLastListenerRemove(){U.dispose()}});return Y.event}function J(C,U,Y=100,B=!1,E){let _,R,q,Te=0;const Re=new l({leakWarningThreshold:E,onFirstListenerAdd(){_=C(Je=>{Te++,R=U(R,Je),B&&!q&&(Re.fire(R),R=void 0),clearTimeout(q),q=setTimeout(()=>{const He=R;R=void 0,q=void 0,(!B||Te>1)&&Re.fire(He),Te=0},Y)})},onLastListenerRemove(){_.dispose()}});return Re.event}y.debounce=J;function ie(C,U=(Y,B)=>Y===B){let Y=!0,B;return F(C,E=>{const _=Y||!U(E,B);return Y=!1,B=E,_})}y.latch=ie;function W(C,U){return[y.filter(C,U),y.filter(C,Y=>!U(Y))]}y.split=W;function te(C,U=!1,Y=[]){let B=Y.slice(),E=C(q=>{B?B.push(q):R.fire(q)});const _=()=>{B&&B.forEach(q=>R.fire(q)),B=null},R=new l({onFirstListenerAdd(){E||(E=C(q=>R.fire(q)))},onFirstListenerDidAdd(){B&&(U?setTimeout(_):_())},onLastListenerRemove(){E&&E.dispose(),E=null}});return R.event}y.buffer=te;class fe{constructor(U){this.event=U}map(U){return new fe(O(this.event,U))}forEach(U){return new fe(P(this.event,U))}filter(U){return new fe(F(this.event,U))}reduce(U,Y){return new fe(j(this.event,U,Y))}latch(){return new fe(ie(this.event))}debounce(U,Y=100,B=!1,E){return new fe(J(this.event,U,Y,B,E))}on(U,Y,B){return this.event(U,Y,B)}once(U,Y,B){return b(this.event)(U,Y,B)}}function me(C){return new fe(C)}y.chain=me;function Pe(C,U,Y=B=>B){const B=(...q)=>R.fire(Y(...q)),E=()=>C.on(U,B),_=()=>C.removeListener(U,B),R=new l({onFirstListenerAdd:E,onLastListenerRemove:_});return R.event}y.fromNodeEventEmitter=Pe;function M(C,U,Y=B=>B){const B=(...q)=>R.fire(Y(...q)),E=()=>C.addEventListener(U,B),_=()=>C.removeEventListener(U,B),R=new l({onFirstListenerAdd:E,onLastListenerRemove:_});return R.event}y.fromDOMEventEmitter=M;function A(C){return new Promise(U=>b(C)(U))}y.toPromise=A})(V||(V={}));class p{constructor(b){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${b}_${p._idPool++}`}start(b){this._stopWatch=new oe.G(!0),this._listenerCount=b}stop(){if(this._stopWatch){const b=this._stopWatch.elapsed();this._elapsedOverall+=b,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${b.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}p._idPool=0;let ge=-1;class ne{constructor(b,O=Math.random().toString(18).slice(2,5)){this.customThreshold=b,this.name=O,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(b){let O=ge;if(typeof this.customThreshold=="number"&&(O=this.customThreshold),O<=0||b<O)return;this._stacks||(this._stacks=new Map);const P=new Error().stack.split(`
|
|
`).slice(3).join(`
|
|
`),F=this._stacks.get(P)||0;if(this._stacks.set(P,F+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=O*.5;let S,L=0;for(const[j,K]of this._stacks)(!S||L<K)&&(S=j,L=K);console.warn(`[${this.name}] potential listener LEAK detected, having ${b} listeners already. MOST frequent listener (${L}):`),console.warn(S)}return()=>{const S=this._stacks.get(P)||0;this._stacks.set(P,S-1)}}}class l{constructor(b){var O;this._disposed=!1,this._options=b,this._leakageMon=ge>0?new ne(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((O=this._options)===null||O===void 0)&&O._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(b,O,P)=>{var F;this._listeners||(this._listeners=new Ne.S);const S=this._listeners.isEmpty();S&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const L=this._listeners.push(O?[b,O]:b);S&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,b,O);const j=(F=this._leakageMon)===null||F===void 0?void 0:F.check(this._listeners.size),K=(0,ye.OF)(()=>{j&&j(),this._disposed||(L(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return P instanceof ye.SL?P.add(K):Array.isArray(P)&&P.push(K),K}),this._event}fire(b){var O,P;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Ne.S);for(let F of this._listeners)this._deliveryQueue.push([F,b]);for((O=this._perfMon)===null||O===void 0||O.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[F,S]=this._deliveryQueue.shift();try{typeof F=="function"?F.call(void 0,S):F[0].call(F[1],S)}catch(L){(0,N.dL)(L)}}(P=this._perfMon)===null||P===void 0||P.stop()}}dispose(){var b,O,P,F,S;this._disposed||(this._disposed=!0,(b=this._listeners)===null||b===void 0||b.clear(),(O=this._deliveryQueue)===null||O===void 0||O.clear(),(F=(P=this._options)===null||P===void 0?void 0:P.onLastListenerRemove)===null||F===void 0||F.call(P),(S=this._leakageMon)===null||S===void 0||S.dispose())}}class z extends l{constructor(b){super(b),this._isPaused=0,this._eventQueue=new Ne.S,this._mergeFn=b==null?void 0:b.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const b=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(b))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(b){this._listeners&&(this._isPaused!==0?this._eventQueue.push(b):super.fire(b))}}class D extends z{constructor(b){var O;super(b),this._delay=(O=b.delay)!==null&&O!==void 0?O:100}fire(b){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(b)}}class g{constructor(){this.buffers=[]}wrapEvent(b){return(O,P,F)=>b(S=>{const L=this.buffers[this.buffers.length-1];L?L.push(()=>O.call(P,S)):O.call(P,S)},void 0,F)}bufferEvents(b){const O=[];this.buffers.push(O);const P=b();return this.buffers.pop(),O.forEach(F=>F()),P}}class x{constructor(){this.listening=!1,this.inputEvent=V.None,this.inputEventListener=ye.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(b){this.inputEvent=b,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=b(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Dt,Ze,ee){"use strict";ee.d(Ze,{I:function(){return N}});function N(ye){const Ne=this;let oe=!1,V;return function(){return oe||(oe=!0,V=ye.apply(Ne,arguments)),V}}},88226:function(Dt,Ze,ee){"use strict";ee.d(Ze,{$:function(){return N}});var N;(function(ye){function Ne(L){return L&&typeof L=="object"&&typeof L[Symbol.iterator]=="function"}ye.is=Ne;const oe=Object.freeze([]);function V(){return oe}ye.empty=V;function*p(L){yield L}ye.single=p;function ge(L){return L||oe}ye.from=ge;function ne(L){return!L||L[Symbol.iterator]().next().done===!0}ye.isEmpty=ne;function l(L){return L[Symbol.iterator]().next().value}ye.first=l;function z(L,j){for(const K of L)if(j(K))return!0;return!1}ye.some=z;function D(L,j){for(const K of L)if(j(K))return K}ye.find=D;function*g(L,j){for(const K of L)j(K)&&(yield K)}ye.filter=g;function*x(L,j){let K=0;for(const J of L)yield j(J,K++)}ye.map=x;function*y(...L){for(const j of L)for(const K of j)yield K}ye.concat=y;function*b(L){for(const j of L)for(const K of j)yield K}ye.concatNested=b;function O(L,j,K){let J=K;for(const ie of L)J=j(J,ie);return J}ye.reduce=O;function*P(L,j,K=L.length){for(j<0&&(j+=L.length),K<0?K+=L.length:K>L.length&&(K=L.length);j<K;j++)yield L[j]}ye.slice=P;function F(L,j=Number.POSITIVE_INFINITY){const K=[];if(j===0)return[K,L];const J=L[Symbol.iterator]();for(let ie=0;ie<j;ie++){const W=J.next();if(W.done)return[K,ye.empty()];K.push(W.value)}return[K,{[Symbol.iterator](){return J}}]}ye.consume=F;function S(L,j,K=(J,ie)=>J===ie){const J=L[Symbol.iterator](),ie=j[Symbol.iterator]();for(;;){const W=J.next(),te=ie.next();if(W.done!==te.done)return!1;if(W.done)return!0;if(!K(W.value,te.value))return!1}}ye.equals=S})(N||(N={}))},69323:function(Dt,Ze,ee){"use strict";ee.d(Ze,{B9:function(){return x},F8:function(){return y},JT:function(){return P},Jz:function(){return S},OF:function(){return b},SL:function(){return O},Wf:function(){return g},XK:function(){return F},dk:function(){return z}});var N=ee(17845),ye=ee(88226);const Ne=!1;let oe=null;function V(L){oe=L}if(Ne){const L="__is_disposable_tracked__";V(new class{trackDisposable(j){const K=new Error("Potentially leaked disposable").stack;setTimeout(()=>{j[L]||console.log(K)},3e3)}setParent(j,K){if(j&&j!==P.None)try{j[L]=!0}catch(J){}}markAsDisposed(j){if(j&&j!==P.None)try{j[L]=!0}catch(K){}}markAsSingleton(j){}})}function p(L){return oe==null||oe.trackDisposable(L),L}function ge(L){oe==null||oe.markAsDisposed(L)}function ne(L,j){oe==null||oe.setParent(L,j)}function l(L,j){if(oe)for(const K of L)oe.setParent(K,j)}function z(L){return oe==null||oe.markAsSingleton(L),L}class D extends Error{constructor(j){super(`Encountered errors while disposing of store. Errors: [${j.join(", ")}]`),this.errors=j}}function g(L){return typeof L.dispose=="function"&&L.dispose.length===0}function x(L){if(ye.$.is(L)){let j=[];for(const K of L)if(K)try{K.dispose()}catch(J){j.push(J)}if(j.length===1)throw j[0];if(j.length>1)throw new D(j);return Array.isArray(L)?[]:L}else if(L)return L.dispose(),L}function y(...L){const j=b(()=>x(L));return l(L,j),j}function b(L){const j=p({dispose:(0,N.I)(()=>{ge(j),L()})});return j}class O{constructor(){this._toDispose=new Set,this._isDisposed=!1,p(this)}dispose(){this._isDisposed||(ge(this),this._isDisposed=!0,this.clear())}clear(){try{x(this._toDispose.values())}finally{this._toDispose.clear()}}add(j){if(!j)return j;if(j===this)throw new Error("Cannot register a disposable on itself!");return ne(j,this),this._isDisposed?O.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(j),j}}O.DISABLE_DISPOSED_WARNING=!1;class P{constructor(){this._store=new O,p(this),ne(this._store,this)}dispose(){ge(this),this._store.dispose()}_register(j){if(j===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(j)}}P.None=Object.freeze({dispose(){}});class F{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(j){var K;this._isDisposed||j===this._value||((K=this._value)===null||K===void 0||K.dispose(),j&&ne(j,this),this._value=j)}clear(){this.value=void 0}dispose(){var j;this._isDisposed=!0,ge(this),(j=this._value)===null||j===void 0||j.dispose(),this._value=void 0}clearAndLeak(){const j=this._value;return this._value=void 0,j&&ne(j,null),j}}class S{constructor(j){this.object=j}dispose(){}}},34502:function(Dt,Ze,ee){"use strict";ee.d(Ze,{S:function(){return ye}});class N{constructor(oe){this.element=oe,this.next=N.Undefined,this.prev=N.Undefined}}N.Undefined=new N(void 0);class ye{constructor(){this._first=N.Undefined,this._last=N.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===N.Undefined}clear(){let oe=this._first;for(;oe!==N.Undefined;){const V=oe.next;oe.prev=N.Undefined,oe.next=N.Undefined,oe=V}this._first=N.Undefined,this._last=N.Undefined,this._size=0}unshift(oe){return this._insert(oe,!1)}push(oe){return this._insert(oe,!0)}_insert(oe,V){const p=new N(oe);if(this._first===N.Undefined)this._first=p,this._last=p;else if(V){const ne=this._last;this._last=p,p.prev=ne,ne.next=p}else{const ne=this._first;this._first=p,p.next=ne,ne.prev=p}this._size+=1;let ge=!1;return()=>{ge||(ge=!0,this._remove(p))}}shift(){if(this._first!==N.Undefined){const oe=this._first.element;return this._remove(this._first),oe}}pop(){if(this._last!==N.Undefined){const oe=this._last.element;return this._remove(this._last),oe}}_remove(oe){if(oe.prev!==N.Undefined&&oe.next!==N.Undefined){const V=oe.prev;V.next=oe.next,oe.next.prev=V}else oe.prev===N.Undefined&&oe.next===N.Undefined?(this._first=N.Undefined,this._last=N.Undefined):oe.next===N.Undefined?(this._last=this._last.prev,this._last.next=N.Undefined):oe.prev===N.Undefined&&(this._first=this._first.next,this._first.prev=N.Undefined);this._size-=1}*[Symbol.iterator](){let oe=this._first;for(;oe!==N.Undefined;)yield oe.element,oe=oe.next}}},23345:function(Dt,Ze,ee){"use strict";ee.d(Ze,{$L:function(){return J},ED:function(){return S},IJ:function(){return j},OS:function(){return fe},WE:function(){return W},dz:function(){return L},gn:function(){return ie},li:function(){return b},r:function(){return M},tY:function(){return K},xS:function(){return te}});var N=ee(97671),ye;const Ne="en";let oe=!1,V=!1,p=!1,ge=!1,ne=!1,l=!1,z=!1,D,g=null,x=null,y;const b=typeof self=="object"?self:typeof ee.g=="object"?ee.g:{};let O;typeof b.vscode!="undefined"&&typeof b.vscode.process!="undefined"?O=b.vscode.process:typeof N!="undefined"&&(O=N);const P=typeof((ye=O==null?void 0:O.versions)===null||ye===void 0?void 0:ye.electron)=="string"&&O.type==="renderer";if(typeof navigator=="object"&&!P)y=navigator.userAgent,oe=y.indexOf("Windows")>=0,V=y.indexOf("Macintosh")>=0,z=(y.indexOf("Macintosh")>=0||y.indexOf("iPad")>=0||y.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=y.indexOf("Linux")>=0,l=!0,D=navigator.language,g=D;else if(typeof O=="object"){oe=O.platform==="win32",V=O.platform==="darwin",p=O.platform==="linux",ge=p&&!!O.env.SNAP&&!!O.env.SNAP_REVISION,D=Ne,g=Ne;const A=O.env.VSCODE_NLS_CONFIG;if(A)try{const C=JSON.parse(A),U=C.availableLanguages["*"];D=C.locale,g=U||Ne,x=C._translationsConfigFile}catch(C){}ne=!0}else console.error("Unable to resolve platform.");let F=0;V?F=1:oe?F=3:p&&(F=2);const S=oe,L=V,j=p,K=ne,J=l,ie=z,W=y,te=function(){if(b.setImmediate)return b.setImmediate.bind(b);if(typeof b.postMessage=="function"&&!b.importScripts){let U=[];b.addEventListener("message",B=>{if(B.data&&B.data.vscodeSetImmediateId)for(let E=0,_=U.length;E<_;E++){const R=U[E];if(R.id===B.data.vscodeSetImmediateId){U.splice(E,1),R.callback();return}}});let Y=0;return B=>{const E=++Y;U.push({id:E,callback:B}),b.postMessage({vscodeSetImmediateId:E},"*")}}if(typeof(O==null?void 0:O.nextTick)=="function")return O.nextTick.bind(O);const C=Promise.resolve();return U=>C.then(U)}(),fe=V||z?2:oe?1:3;let me=!0,Pe=!1;function M(){if(!Pe){Pe=!0;const A=new Uint8Array(2);A[0]=1,A[1]=2,me=new Uint16Array(A.buffer)[0]===513}return me}},95830:function(Dt,Ze,ee){"use strict";ee.d(Ze,{G:function(){return Ne}});var N=ee(23345);const ye=N.li.performance&&typeof N.li.performance.now=="function";class Ne{constructor(V){this._highResolution=ye&&V,this._startTime=this._now(),this._stopTime=-1}static create(V=!0){return new Ne(V)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?N.li.performance.now():Date.now()}}},82983:function(Dt,Ze,ee){"use strict";ee.d(Ze,{$i:function(){return Te},C8:function(){return tt},GF:function(){return D},HO:function(){return Y},IO:function(){return g},K7:function(){return yt},Kw:function(){return $e},LC:function(){return b},Mh:function(){return te},P1:function(){return fe},PJ:function(){return pt},Qe:function(){return Re},R1:function(){return z},RP:function(){return R},S6:function(){return Oe},TT:function(){return S},Ut:function(){return E},V8:function(){return O},WU:function(){return Ne},YK:function(){return Pe},YU:function(){return oe},ZG:function(){return me},ZH:function(){return A},ab:function(){return Je},c1:function(){return Ke},df:function(){return J},ec:function(){return V},fi:function(){return wt},fy:function(){return p},j3:function(){return ge},j_:function(){return j},m5:function(){return N},mK:function(){return K},mr:function(){return x},oH:function(){return Q},oL:function(){return ne},ok:function(){return W},ow:function(){return P},qq:function(){return ie},qu:function(){return F},rL:function(){return M},uS:function(){return Mt},un:function(){return l},uq:function(){return y},vH:function(){return U},xe:function(){return He},zY:function(){return L}});function N(G){return!G||typeof G!="string"?!0:G.trim().length===0}const ye=/{(\d+)}/g;function Ne(G,...ae){return ae.length===0?G:G.replace(ye,function(we,De){const ke=parseInt(De,10);return isNaN(ke)||ke<0||ke>=ae.length?we:ae[ke]})}function oe(G){return G.replace(/[<>&]/g,function(ae){switch(ae){case"<":return"<";case">":return">";case"&":return"&";default:return ae}})}function V(G){return G.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(G,ae=" "){const we=ge(G,ae);return ne(we,ae)}function ge(G,ae){if(!G||!ae)return G;const we=ae.length;if(we===0||G.length===0)return G;let De=0;for(;G.indexOf(ae,De)===De;)De=De+we;return G.substring(De)}function ne(G,ae){if(!G||!ae)return G;const we=ae.length,De=G.length;if(we===0||De===0)return G;let ke=De,je=-1;for(;je=G.lastIndexOf(ae,ke-1),!(je===-1||je+we!==ke);){if(je===0)return"";ke=je}return G.substring(0,ke)}function l(G){return G.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function z(G){return G.replace(/\*/g,"")}function D(G,ae,we={}){if(!G)throw new Error("Cannot create regex from empty string");ae||(G=V(G)),we.wholeWord&&(/\B/.test(G.charAt(0))||(G="\\b"+G),/\B/.test(G.charAt(G.length-1))||(G=G+"\\b"));let De="";return we.global&&(De+="g"),we.matchCase||(De+="i"),we.multiline&&(De+="m"),we.unicode&&(De+="u"),new RegExp(G,De)}function g(G){return G.source==="^"||G.source==="^$"||G.source==="$"||G.source==="^\\s*$"?!1:!!(G.exec("")&&G.lastIndex===0)}function x(G){return(G.global?"g":"")+(G.ignoreCase?"i":"")+(G.multiline?"m":"")+(G.unicode?"u":"")}function y(G){return G.split(/\r\n|\r|\n/)}function b(G){for(let ae=0,we=G.length;ae<we;ae++){const De=G.charCodeAt(ae);if(De!==32&&De!==9)return ae}return-1}function O(G,ae=0,we=G.length){for(let De=ae;De<we;De++){const ke=G.charCodeAt(De);if(ke!==32&&ke!==9)return G.substring(ae,De)}return G.substring(ae,we)}function P(G,ae=G.length-1){for(let we=ae;we>=0;we--){const De=G.charCodeAt(we);if(De!==32&&De!==9)return we}return-1}function F(G,ae){return G<ae?-1:G>ae?1:0}function S(G,ae,we=0,De=G.length,ke=0,je=ae.length){for(;we<De&&ke<je;we++,ke++){let qe=G.charCodeAt(we),Ue=ae.charCodeAt(ke);if(qe<Ue)return-1;if(qe>Ue)return 1}const ut=De-we,Qe=je-ke;return ut<Qe?-1:ut>Qe?1:0}function L(G,ae){return j(G,ae,0,G.length,0,ae.length)}function j(G,ae,we=0,De=G.length,ke=0,je=ae.length){for(;we<De&&ke<je;we++,ke++){let qe=G.charCodeAt(we),Ue=ae.charCodeAt(ke);if(qe===Ue)continue;if(qe>=128||Ue>=128)return S(G.toLowerCase(),ae.toLowerCase(),we,De,ke,je);K(qe)&&(qe-=32),K(Ue)&&(Ue-=32);const dt=qe-Ue;if(dt!==0)return dt}const ut=De-we,Qe=je-ke;return ut<Qe?-1:ut>Qe?1:0}function K(G){return G>=97&&G<=122}function J(G){return G>=65&&G<=90}function ie(G,ae){return G.length===ae.length&&j(G,ae)===0}function W(G,ae){const we=ae.length;return ae.length>G.length?!1:j(G,ae,0,we)===0}function te(G,ae){let we,De=Math.min(G.length,ae.length);for(we=0;we<De;we++)if(G.charCodeAt(we)!==ae.charCodeAt(we))return we;return De}function fe(G,ae){let we,De=Math.min(G.length,ae.length);const ke=G.length-1,je=ae.length-1;for(we=0;we<De;we++)if(G.charCodeAt(ke-we)!==ae.charCodeAt(je-we))return we;return De}function me(G){return 55296<=G&&G<=56319}function Pe(G){return 56320<=G&&G<=57343}function M(G,ae){return(G-55296<<10)+(ae-56320)+65536}function A(G,ae,we){const De=G.charCodeAt(we);if(me(De)&&we+1<ae){const ke=G.charCodeAt(we+1);if(Pe(ke))return M(De,ke)}return De}function C(G,ae){const we=G.charCodeAt(ae-1);if(Pe(we)&&ae>1){const De=G.charCodeAt(ae-2);if(me(De))return M(De,we)}return we}function U(G,ae){const we=de.getInstance(),De=ae,ke=G.length,je=A(G,ke,ae);ae+=je>=65536?2:1;let ut=we.getGraphemeBreakType(je);for(;ae<ke;){const Qe=A(G,ke,ae),qe=we.getGraphemeBreakType(Qe);if(wt(ut,qe))break;ae+=Qe>=65536?2:1,ut=qe}return ae-De}function Y(G,ae){const we=de.getInstance(),De=ae,ke=C(G,ae);ae-=ke>=65536?2:1;let je=we.getGraphemeBreakType(ke);for(;ae>0;){const ut=C(G,ae),Qe=we.getGraphemeBreakType(ut);if(wt(Qe,je))break;ae-=ut>=65536?2:1,je=Qe}return De-ae}const B=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function E(G){return B.test(G)}const _=/(?:[\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 R(G){return _.test(G)}const q=/^[\t\n\r\x20-\x7E]*$/;function Te(G){return q.test(G)}const Re=/[\u2028\u2029]/;function Je(G){return Re.test(G)}function He(G){for(let ae=0,we=G.length;ae<we;ae++)if(yt(G.charCodeAt(ae)))return!0;return!1}function yt(G){return G=+G,G>=11904&&G<=55215||G>=63744&&G<=64255||G>=65281&&G<=65374}function tt(G){return G>=127462&&G<=127487||G===8986||G===8987||G===9200||G===9203||G>=9728&&G<=10175||G===11088||G===11093||G>=127744&&G<=128591||G>=128640&&G<=128764||G>=128992&&G<=129003||G>=129280&&G<=129535||G>=129648&&G<=129750}const Ke="\uFEFF";function Mt(G){return!!(G&&G.length>0&&G.charCodeAt(0)===65279)}function $e(G,ae=!1){return G?(ae&&(G=G.replace(/\\./g,"")),G.toLowerCase()!==G):!1}function pt(G){return G=G%(2*26),G<26?String.fromCharCode(97+G):String.fromCharCode(65+G-26)}function Oe(G){return de.getInstance().getGraphemeBreakType(G)}function wt(G,ae){return G===0?ae!==5&&ae!==7:G===2&&ae===3?!1:G===4||G===2||G===3||ae===4||ae===2||ae===3?!0:!(G===8&&(ae===8||ae===9||ae===11||ae===12)||(G===11||G===9)&&(ae===9||ae===10)||(G===12||G===10)&&ae===10||ae===5||ae===13||ae===7||G===1||G===13&&ae===14||G===6&&ae===6)}class de{constructor(){this._data=Ee()}static getInstance(){return de._INSTANCE||(de._INSTANCE=new de),de._INSTANCE}getGraphemeBreakType(ae){if(ae<32)return ae===10?3:ae===13?2:4;if(ae<127)return 0;const we=this._data,De=we.length/3;let ke=1;for(;ke<=De;)if(ae<we[3*ke])ke=2*ke;else if(ae>we[3*ke+1])ke=2*ke+1;else return we[3*ke+2];return 0}}de._INSTANCE=null;function Ee(){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 Q(G,ae){if(G===0)return 0;const we=Le(G,ae);if(we!==void 0)return we;const De=C(ae,G);return G-=Ce(De),G}function Le(G,ae){let we=C(ae,G);for(G-=Ce(we);Ve(we)||we===65039||we===8419;){if(G===0)return;we=C(ae,G),G-=Ce(we)}if(tt(we)){if(G>=0){const De=C(ae,G);De===8205&&(G-=Ce(De))}return G}}function Ce(G){return G>=65536?2:1}function Ve(G){return 127995<=G&&G<=127999}},72999:function(Dt,Ze,ee){"use strict";ee.d(Ze,{$E:function(){return b},$K:function(){return ge},D8:function(){return g},HD:function(){return ye},IU:function(){return O},Jp:function(){return ne},Kn:function(){return Ne},cW:function(){return z},f6:function(){return P},hj:function(){return oe},jn:function(){return V},kJ:function(){return N},mf:function(){return D},o8:function(){return p},p_:function(){return l},vE:function(){return F}});function N(S){return Array.isArray(S)}function ye(S){return typeof S=="string"}function Ne(S){return typeof S=="object"&&S!==null&&!Array.isArray(S)&&!(S instanceof RegExp)&&!(S instanceof Date)}function oe(S){return typeof S=="number"&&!isNaN(S)}function V(S){return S===!0||S===!1}function p(S){return typeof S=="undefined"}function ge(S){return!ne(S)}function ne(S){return p(S)||S===null}function l(S,L){if(!S)throw new Error(L?`Unexpected type, expected '${L}'`:"Unexpected type")}function z(S){if(ne(S))throw new Error("Assertion Failed: argument is undefined or null");return S}function D(S){return typeof S=="function"}function g(S,L){const j=Math.min(S.length,L.length);for(let K=0;K<j;K++)x(S[K],L[K])}function x(S,L){if(ye(L)){if(typeof S!==L)throw new Error(`argument does not match constraint: typeof ${L}`)}else if(D(L)){try{if(S instanceof L)return}catch(j){}if(!ne(S)&&S.constructor===L||L.length===1&&L.call(void 0,S)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function y(S){let L=[],j=Object.getPrototypeOf(S);for(;Object.prototype!==j;)L=L.concat(Object.getOwnPropertyNames(j)),j=Object.getPrototypeOf(j);return L}function b(S){const L=[];for(const j of y(S))typeof S[j]=="function"&&L.push(j);return L}function O(S,L){const j=J=>function(){const ie=Array.prototype.slice.call(arguments,0);return L(J,ie)};let K={};for(const J of S)K[J]=j(J);return K}function P(S){return S===null?void 0:S}function F(S,L="Unreachable"){throw new Error(L)}},13268:function(Dt,Ze,ee){"use strict";ee.d(Ze,{N:function(){return ye}});function N(Ne,oe){let V;return oe.length===0?V=Ne:V=Ne.replace(/\{(\d+)\}/g,function(p,ge){const ne=ge[0];return typeof oe[ne]!="undefined"?oe[ne]:p}),V}function ye(Ne,oe,...V){return N(oe,V)}},96236:function(Dt,Ze,ee){"use strict";ee.d(Ze,{BH:function(){return O},NZ:function(){return P},U8:function(){return F},co:function(){return b},eH:function(){return y},vr:function(){return x}});var N=ee(75918),ye=ee(52615),Ne=ee(4348),oe=ee(88226),V=ee(69323),p=ee(34502),ge=ee(35884),ne=ee(90689),l=ee(16925),z=ee(49055),D=function(S,L,j,K){var J=arguments.length,ie=J<3?L:K===null?K=Object.getOwnPropertyDescriptor(L,j):K,W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ie=Reflect.decorate(S,L,j,K);else for(var te=S.length-1;te>=0;te--)(W=S[te])&&(ie=(J<3?W(ie):J>3?W(L,j,ie):W(L,j))||ie);return J>3&&ie&&Object.defineProperty(L,j,ie),ie},g=function(S,L){return function(j,K){L(j,K,S)}};function x(S){return S.command!==void 0}class y{constructor(L){this.id=y._idPool++,this._debugName=L}}y._idPool=0,y.CommandPalette=new y("CommandPalette"),y.EditorContext=new y("EditorContext"),y.SimpleEditorContext=new y("SimpleEditorContext"),y.EditorContextCopy=new y("EditorContextCopy"),y.EditorContextPeek=new y("EditorContextPeek"),y.MenubarEditMenu=new y("MenubarEditMenu"),y.MenubarCopy=new y("MenubarCopy"),y.MenubarGoMenu=new y("MenubarGoMenu"),y.MenubarSelectionMenu=new y("MenubarSelectionMenu"),y.InlineCompletionsActions=new y("InlineCompletionsActions");const b=(0,l.yh)("menuService"),O=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Ne.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:S=>S===y.CommandPalette}}addCommand(S){return this.addCommands(oe.$.single(S))}addCommands(S){for(const L of S)this._commands.set(L.id,L);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,V.OF)(()=>{let L=!1;for(const j of S)L=this._commands.delete(j.id)||L;L&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(S){return this._commands.get(S)}getCommands(){const S=new Map;return this._commands.forEach((L,j)=>S.set(j,L)),S}appendMenuItem(S,L){return this.appendMenuItems(oe.$.single({id:S,item:L}))}appendMenuItems(S){const L=new Set,j=new p.S;for(const{id:K,item:J}of S){let ie=this._menuItems.get(K);ie||(ie=new p.S,this._menuItems.set(K,ie)),j.push(ie.push(J)),L.add(K)}return this._onDidChangeMenu.fire(L),(0,V.OF)(()=>{if(j.size>0){for(let K of j)K();this._onDidChangeMenu.fire(L),j.clear()}})}getMenuItems(S){let L;return this._menuItems.has(S)?L=[...this._menuItems.get(S)]:L=[],S===y.CommandPalette&&this._appendImplicitItems(L),L}_appendImplicitItems(S){const L=new Set;for(const j of S)x(j)&&(L.add(j.command.id),j.alt&&L.add(j.alt.id));this._commands.forEach((j,K)=>{L.has(K)||S.push({command:j})})}};class P extends N.wY{constructor(L,j,K,J){super(`submenuitem.${L.submenu.id}`,typeof L.title=="string"?L.title:L.title.value,[],"submenu"),this.item=L,this._menuService=j,this._contextKeyService=K,this._options=J}get actions(){const L=[],j=this._menuService.createMenu(this.item.submenu,this._contextKeyService),K=j.getActions(this._options);j.dispose();for(const[,J]of K)J.length>0&&(L.push(...J),L.push(new N.Z0));return L.length&&L.pop(),L}}let F=class il{constructor(L,j,K,J,ie){var W,te;if(this._commandService=ie,this.id=L.id,this.label=K!=null&&K.renderShortTitle&&L.shortTitle?typeof L.shortTitle=="string"?L.shortTitle:L.shortTitle.value:typeof L.title=="string"?L.title:L.title.value,this.tooltip=(te=typeof L.tooltip=="string"?L.tooltip:(W=L.tooltip)===null||W===void 0?void 0:W.value)!==null&&te!==void 0?te:"",this.enabled=!L.precondition||J.contextMatchesRules(L.precondition),this.checked=void 0,L.toggled){const fe=L.toggled.condition?L.toggled:{condition:L.toggled};this.checked=J.contextMatchesRules(fe.condition),this.checked&&fe.tooltip&&(this.tooltip=typeof fe.tooltip=="string"?fe.tooltip:fe.tooltip.value),fe.title&&(this.label=typeof fe.title=="string"?fe.title:fe.title.value)}this.item=L,this.alt=j?new il(j,void 0,K,J,ie):void 0,this._options=K,z.kS.isThemeIcon(L.icon)&&(this.class=ye.dT.asClassName(L.icon))}dispose(){}run(...L){var j,K;let J=[];return!((j=this._options)===null||j===void 0)&&j.arg&&(J=[...J,this._options.arg]),!((K=this._options)===null||K===void 0)&&K.shouldForwardArgs&&(J=[...J,...L]),this._commandService.executeCommand(this.id,...J)}};F=D([g(3,ne.i6),g(4,ge.H)],F)},35884:function(Dt,Ze,ee){"use strict";ee.d(Ze,{H:function(){return ge},P:function(){return ne}});var N=ee(4348),ye=ee(88226),Ne=ee(69323),oe=ee(34502),V=ee(72999),p=ee(16925);const ge=(0,p.yh)("commandService"),ne=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new N.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 b=[];for(let P of l.description.args)b.push(P.constraint);const O=l.handler;l.handler=function(P,...F){return(0,V.D8)(F,b),O(P,...F)}}const{id:D}=l;let g=this._commands.get(D);g||(g=new oe.S,this._commands.set(D,g));let x=g.unshift(l),y=(0,Ne.OF)(()=>{x();const b=this._commands.get(D);b!=null&&b.isEmpty()&&this._commands.delete(D)});return this._onDidRegisterCommand.fire(D),y}registerCommandAlias(l,z){return ne.registerCommand(l,(D,...g)=>D.get(ge).executeCommand(z,...g))}getCommand(l){const z=this._commands.get(l);if(!(!z||z.isEmpty()))return ye.$.first(z)}getCommands(){const l=new Map;for(const z of this._commands.keys()){const D=this.getCommand(z);D&&l.set(z,D)}return l}};ne.registerCommand("noop",()=>{})},90689:function(Dt,Ze,ee){"use strict";ee.d(Ze,{Ao:function(){return ge},Eq:function(){return M},Fb:function(){return ne},K8:function(){return U},i6:function(){return Pe},uy:function(){return me}});var N=ee(23345),ye=ee(82983),Ne=ee(16925);let oe=N.WE||"";const V=new Map;V.set("false",!1),V.set("true",!0),V.set("isMac",N.dz),V.set("isLinux",N.IJ),V.set("isWindows",N.ED),V.set("isWeb",N.$L),V.set("isMacNative",N.dz&&!N.$L),V.set("isEdge",oe.indexOf("Edg/")>=0),V.set("isFirefox",oe.indexOf("Firefox")>=0),V.set("isChrome",oe.indexOf("Chrome")>=0),V.set("isSafari",oe.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class ge{static has(E){return g.create(E)}static equals(E,_){return x.create(E,_)}static regex(E,_){return J.create(E,_)}static not(E){return P.create(E)}static and(...E){return te.create(E,null)}static or(...E){return fe.create(E,null,!0)}static deserialize(E,_=!1){if(E)return this._deserializeOrExpression(E,_)}static _deserializeOrExpression(E,_){let R=E.split("||");return fe.create(R.map(q=>this._deserializeAndExpression(q,_)),null,!0)}static _deserializeAndExpression(E,_){let R=E.split("&&");return te.create(R.map(q=>this._deserializeOne(q,_)),null)}static _deserializeOne(E,_){if(E=E.trim(),E.indexOf("!=")>=0){let R=E.split("!=");return O.create(R[0].trim(),this._deserializeValue(R[1],_))}if(E.indexOf("==")>=0){let R=E.split("==");return x.create(R[0].trim(),this._deserializeValue(R[1],_))}if(E.indexOf("=~")>=0){let R=E.split("=~");return J.create(R[0].trim(),this._deserializeRegexValue(R[1],_))}if(E.indexOf(" in ")>=0){let R=E.split(" in ");return y.create(R[0].trim(),R[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(E)){const R=E.split(">=");return L.create(R[0].trim(),R[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(E)){const R=E.split(">");return S.create(R[0].trim(),R[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(E)){const R=E.split("<=");return K.create(R[0].trim(),R[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(E)){const R=E.split("<");return j.create(R[0].trim(),R[1].trim())}return/^\!\s*/.test(E)?P.create(E.substr(1).trim()):g.create(E)}static _deserializeValue(E,_){if(E=E.trim(),E==="true")return!0;if(E==="false")return!1;let R=/^'([^']*)'$/.exec(E);return R?R[1].trim():E}static _deserializeRegexValue(E,_){if((0,ye.m5)(E)){if(_)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let R=E.indexOf("/"),q=E.lastIndexOf("/");if(R===q||R<0){if(_)throw new Error(`bad regexp-value '${E}', missing /-enclosure`);return console.warn(`bad regexp-value '${E}', missing /-enclosure`),null}let Te=E.slice(R+1,q),Re=E[q+1]==="i"?"i":"";try{return new RegExp(Te,Re)}catch(Je){if(_)throw new Error(`bad regexp-value '${E}', parse error: ${Je}`);return console.warn(`bad regexp-value '${E}', parse error: ${Je}`),null}}}function ne(B,E){const _=B?B.substituteConstants():void 0,R=E?E.substituteConstants():void 0;return!_&&!R?!0:!_||!R?!1:_.equals(R)}function l(B,E){return B.cmp(E)}class z{constructor(){this.type=0}cmp(E){return this.type-E.type}equals(E){return E.type===this.type}substituteConstants(){return this}evaluate(E){return!1}serialize(){return"false"}keys(){return[]}negate(){return D.INSTANCE}}z.INSTANCE=new z;class D{constructor(){this.type=1}cmp(E){return this.type-E.type}equals(E){return E.type===this.type}substituteConstants(){return this}evaluate(E){return!0}serialize(){return"true"}keys(){return[]}negate(){return z.INSTANCE}}D.INSTANCE=new D;class g{constructor(E,_){this.key=E,this.negated=_,this.type=2}static create(E,_=null){const R=V.get(E);return typeof R=="boolean"?R?D.INSTANCE:z.INSTANCE:new g(E,_)}cmp(E){return E.type!==this.type?this.type-E.type:A(this.key,E.key)}equals(E){return E.type===this.type?this.key===E.key:!1}substituteConstants(){const E=V.get(this.key);return typeof E=="boolean"?E?D.INSTANCE:z.INSTANCE:this}evaluate(E){return!!E.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=P.create(this.key,this)),this.negated}}class x{constructor(E,_,R){this.key=E,this.value=_,this.negated=R,this.type=4}static create(E,_,R=null){if(typeof _=="boolean")return _?g.create(E,R):P.create(E,R);const q=V.get(E);return typeof q=="boolean"?_===(q?"true":"false")?D.INSTANCE:z.INSTANCE:new x(E,_,R)}cmp(E){return E.type!==this.type?this.type-E.type:C(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){const E=V.get(this.key);if(typeof E=="boolean"){const _=E?"true":"false";return this.value===_?D.INSTANCE:z.INSTANCE}return this}evaluate(E){return E.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=O.create(this.key,this.value,this)),this.negated}}class y{constructor(E,_){this.key=E,this.valueKey=_,this.type=10,this.negated=null}static create(E,_){return new y(E,_)}cmp(E){return E.type!==this.type?this.type-E.type:C(this.key,this.valueKey,E.key,E.valueKey)}equals(E){return E.type===this.type?this.key===E.key&&this.valueKey===E.valueKey:!1}substituteConstants(){return this}evaluate(E){const _=E.getValue(this.valueKey),R=E.getValue(this.key);return Array.isArray(_)?_.indexOf(R)>=0:typeof R=="string"&&typeof _=="object"&&_!==null?p.call(_,R):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=b.create(this)),this.negated}}class b{constructor(E){this._actual=E,this.type=11}static create(E){return new b(E)}cmp(E){return E.type!==this.type?this.type-E.type:this._actual.cmp(E._actual)}equals(E){return E.type===this.type?this._actual.equals(E._actual):!1}substituteConstants(){return this}evaluate(E){return!this._actual.evaluate(E)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class O{constructor(E,_,R){this.key=E,this.value=_,this.negated=R,this.type=5}static create(E,_,R=null){if(typeof _=="boolean")return _?P.create(E,R):g.create(E,R);const q=V.get(E);return typeof q=="boolean"?_===(q?"true":"false")?z.INSTANCE:D.INSTANCE:new O(E,_,R)}cmp(E){return E.type!==this.type?this.type-E.type:C(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){const E=V.get(this.key);if(typeof E=="boolean"){const _=E?"true":"false";return this.value===_?z.INSTANCE:D.INSTANCE}return this}evaluate(E){return E.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=x.create(this.key,this.value,this)),this.negated}}class P{constructor(E,_){this.key=E,this.negated=_,this.type=3}static create(E,_=null){const R=V.get(E);return typeof R=="boolean"?R?z.INSTANCE:D.INSTANCE:new P(E,_)}cmp(E){return E.type!==this.type?this.type-E.type:A(this.key,E.key)}equals(E){return E.type===this.type?this.key===E.key:!1}substituteConstants(){const E=V.get(this.key);return typeof E=="boolean"?E?z.INSTANCE:D.INSTANCE:this}evaluate(E){return!E.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=g.create(this.key,this)),this.negated}}function F(B,E){if(typeof B=="string"){const _=parseFloat(B);isNaN(_)||(B=_)}return typeof B=="string"||typeof B=="number"?E(B):z.INSTANCE}class S{constructor(E,_,R){this.key=E,this.value=_,this.negated=R,this.type=12}static create(E,_,R=null){return F(_,q=>new S(E,q,R))}cmp(E){return E.type!==this.type?this.type-E.type:C(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){return this}evaluate(E){return typeof this.value=="string"?!1:parseFloat(E.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=K.create(this.key,this.value,this)),this.negated}}class L{constructor(E,_,R){this.key=E,this.value=_,this.negated=R,this.type=13}static create(E,_,R=null){return F(_,q=>new L(E,q,R))}cmp(E){return E.type!==this.type?this.type-E.type:C(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){return this}evaluate(E){return typeof this.value=="string"?!1:parseFloat(E.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=j.create(this.key,this.value,this)),this.negated}}class j{constructor(E,_,R){this.key=E,this.value=_,this.negated=R,this.type=14}static create(E,_,R=null){return F(_,q=>new j(E,q,R))}cmp(E){return E.type!==this.type?this.type-E.type:C(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){return this}evaluate(E){return typeof this.value=="string"?!1:parseFloat(E.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=L.create(this.key,this.value,this)),this.negated}}class K{constructor(E,_,R){this.key=E,this.value=_,this.negated=R,this.type=15}static create(E,_,R=null){return F(_,q=>new K(E,q,R))}cmp(E){return E.type!==this.type?this.type-E.type:C(this.key,this.value,E.key,E.value)}equals(E){return E.type===this.type?this.key===E.key&&this.value===E.value:!1}substituteConstants(){return this}evaluate(E){return typeof this.value=="string"?!1:parseFloat(E.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=S.create(this.key,this.value,this)),this.negated}}class J{constructor(E,_){this.key=E,this.regexp=_,this.type=7,this.negated=null}static create(E,_){return new J(E,_)}cmp(E){if(E.type!==this.type)return this.type-E.type;if(this.key<E.key)return-1;if(this.key>E.key)return 1;const _=this.regexp?this.regexp.source:"",R=E.regexp?E.regexp.source:"";return _<R?-1:_>R?1:0}equals(E){if(E.type===this.type){const _=this.regexp?this.regexp.source:"",R=E.regexp?E.regexp.source:"";return this.key===E.key&&_===R}return!1}substituteConstants(){return this}evaluate(E){let _=E.getValue(this.key);return this.regexp?this.regexp.test(_):!1}serialize(){const E=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${E}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=ie.create(this)),this.negated}}class ie{constructor(E){this._actual=E,this.type=8}static create(E){return new ie(E)}cmp(E){return E.type!==this.type?this.type-E.type:this._actual.cmp(E._actual)}equals(E){return E.type===this.type?this._actual.equals(E._actual):!1}substituteConstants(){return this}evaluate(E){return!this._actual.evaluate(E)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function W(B){let E=null;for(let _=0,R=B.length;_<R;_++){const q=B[_].substituteConstants();if(B[_]!==q&&E===null){E=[];for(let Te=0;Te<_;Te++)E[Te]=B[Te]}E!==null&&(E[_]=q)}return E===null?B:E}class te{constructor(E,_){this.expr=E,this.negated=_,this.type=6}static create(E,_){return te._normalizeArr(E,_)}cmp(E){if(E.type!==this.type)return this.type-E.type;if(this.expr.length<E.expr.length)return-1;if(this.expr.length>E.expr.length)return 1;for(let _=0,R=this.expr.length;_<R;_++){const q=l(this.expr[_],E.expr[_]);if(q!==0)return q}return 0}equals(E){if(E.type===this.type){if(this.expr.length!==E.expr.length)return!1;for(let _=0,R=this.expr.length;_<R;_++)if(!this.expr[_].equals(E.expr[_]))return!1;return!0}return!1}substituteConstants(){const E=W(this.expr);return E===this.expr?this:te.create(E,this.negated)}evaluate(E){for(let _=0,R=this.expr.length;_<R;_++)if(!this.expr[_].evaluate(E))return!1;return!0}static _normalizeArr(E,_){const R=[];let q=!1;for(const Te of E)if(Te){if(Te.type===1){q=!0;continue}if(Te.type===0)return z.INSTANCE;if(Te.type===6){R.push(...Te.expr);continue}R.push(Te)}if(R.length===0&&q)return D.INSTANCE;if(R.length!==0){if(R.length===1)return R[0];R.sort(l);for(let Te=1;Te<R.length;Te++)R[Te-1].equals(R[Te])&&(R.splice(Te,1),Te--);if(R.length===1)return R[0];for(;R.length>1;){const Te=R[R.length-1];if(Te.type!==9)break;R.pop();const Re=R.pop(),Je=R.length===0,He=fe.create(Te.expr.map(yt=>te.create([yt,Re],null)),null,Je);He&&(R.push(He),R.sort(l))}return R.length===1?R[0]:new te(R,_)}}serialize(){return this.expr.map(E=>E.serialize()).join(" && ")}keys(){const E=[];for(let _ of this.expr)E.push(..._.keys());return E}negate(){if(!this.negated){const E=[];for(let _ of this.expr)E.push(_.negate());this.negated=fe.create(E,this,!0)}return this.negated}}class fe{constructor(E,_){this.expr=E,this.negated=_,this.type=9}static create(E,_,R){return fe._normalizeArr(E,_,R)}cmp(E){if(E.type!==this.type)return this.type-E.type;if(this.expr.length<E.expr.length)return-1;if(this.expr.length>E.expr.length)return 1;for(let _=0,R=this.expr.length;_<R;_++){const q=l(this.expr[_],E.expr[_]);if(q!==0)return q}return 0}equals(E){if(E.type===this.type){if(this.expr.length!==E.expr.length)return!1;for(let _=0,R=this.expr.length;_<R;_++)if(!this.expr[_].equals(E.expr[_]))return!1;return!0}return!1}substituteConstants(){const E=W(this.expr);return E===this.expr?this:fe.create(E,this.negated,!1)}evaluate(E){for(let _=0,R=this.expr.length;_<R;_++)if(this.expr[_].evaluate(E))return!0;return!1}static _normalizeArr(E,_,R){let q=[],Te=!1;if(E){for(let Re=0,Je=E.length;Re<Je;Re++){const He=E[Re];if(He){if(He.type===0){Te=!0;continue}if(He.type===1)return D.INSTANCE;if(He.type===9){q=q.concat(He.expr);continue}q.push(He)}}if(q.length===0&&Te)return z.INSTANCE;q.sort(l)}if(q.length!==0){if(q.length===1)return q[0];for(let Re=1;Re<q.length;Re++)q[Re-1].equals(q[Re])&&(q.splice(Re,1),Re--);if(q.length===1)return q[0];if(R){for(let Re=0;Re<q.length;Re++)for(let Je=Re+1;Je<q.length;Je++)U(q[Re],q[Je])&&(q.splice(Je,1),Je--);if(q.length===1)return q[0]}return new fe(q,_)}}serialize(){return this.expr.map(E=>E.serialize()).join(" || ")}keys(){const E=[];for(let _ of this.expr)E.push(..._.keys());return E}negate(){if(!this.negated){let E=[];for(let _ of this.expr)E.push(_.negate());for(;E.length>1;){const _=E.shift(),R=E.shift(),q=[];for(const Re of Y(_))for(const Je of Y(R))q.push(te.create([Re,Je],null));const Te=E.length===0;E.unshift(fe.create(q,null,Te))}this.negated=E[0]}return this.negated}}class me extends g{constructor(E,_,R){super(E,null),this._defaultValue=_,typeof R=="object"?me._info.push(Object.assign(Object.assign({},R),{key:E})):R!==!0&&me._info.push({key:E,description:R,type:_!=null?typeof _:void 0})}static all(){return me._info.values()}bindTo(E){return E.createKey(this.key,this._defaultValue)}getValue(E){return E.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(E){return x.create(this.key,E)}}me._info=[];const Pe=(0,Ne.yh)("contextKeyService"),M="setContext";function A(B,E){return B<E?-1:B>E?1:0}function C(B,E,_,R){return B<_?-1:B>_?1:E<R?-1:E>R?1:0}function U(B,E){if(E.type===6&&B.type!==9&&B.type!==6){for(const q of E.expr)if(B.equals(q))return!0}const _=B.negate(),R=Y(_).concat(Y(E));R.sort(l);for(let q=0;q<R.length;q++){const Re=R[q].negate();for(let Je=q+1;Je<R.length;Je++){const He=R[Je];if(Re.equals(He))return!0}}return!1}function Y(B){return B.type===9?B.expr:[B]}},16925:function(Dt,Ze,ee){"use strict";ee.d(Ze,{I8:function(){return N},TG:function(){return ye},jt:function(){return V},yh:function(){return oe}});var N;(function(p){p.serviceIds=new Map,p.DI_TARGET="$di$target",p.DI_DEPENDENCIES="$di$dependencies";function ge(ne){return ne[p.DI_DEPENDENCIES]||[]}p.getServiceDependencies=ge})(N||(N={}));const ye=oe("instantiationService");function Ne(p,ge,ne,l){ge[N.DI_TARGET]===ge?ge[N.DI_DEPENDENCIES].push({id:p,index:ne,optional:l}):(ge[N.DI_DEPENDENCIES]=[{id:p,index:ne,optional:l}],ge[N.DI_TARGET]=ge)}function oe(p){if(N.serviceIds.has(p))return N.serviceIds.get(p);const ge=function(ne,l,z){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ne(ge,ne,z,!1)};return ge.toString=()=>p,N.serviceIds.set(p,ge),ge}function V(p){return function(ge,ne,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Ne(p,ge,l,!0)}}},44650:function(Dt,Ze,ee){"use strict";ee.d(Ze,{B:function(){return oe}});var N=ee(76068),ye=ee(72999);class Ne{constructor(){this.data=new Map}add(p,ge){N.ok(ye.HD(p)),N.ok(ye.Kn(ge)),N.ok(!this.data.has(p),"There is already an extension with this id"),this.data.set(p,ge)}as(p){return this.data.get(p)||null}}const oe=new Ne},66213:function(Dt,Ze,ee){"use strict";ee.d(Ze,{e:function(){return N}});var N;(function(ye){ye.DARK="dark",ye.LIGHT="light",ye.HIGH_CONTRAST="hc"})(N||(N={}))},49055:function(Dt,Ze,ee){"use strict";ee.d(Ze,{EN:function(){return l},IP:function(){return g},Ic:function(){return b},XE:function(){return ge},bB:function(){return O},kS:function(){return z},m6:function(){return D}});var N=ee(52615),ye=ee(4348),Ne=ee(69323),oe=ee(16925),V=ee(44650),p=ee(66213);const ge=(0,oe.yh)("themeService");var ne;(function(P){function F(S){return S&&typeof S=="object"&&typeof S.id=="string"}P.isThemeColor=F})(ne||(ne={}));function l(P){return{id:P}}var z;(function(P){function F(ie){return ie&&typeof ie=="object"&&typeof ie.id=="string"&&(typeof ie.color=="undefined"||ne.isThemeColor(ie.color))}P.isThemeIcon=F;const S=new RegExp(`^\\$\\((${N.dT.iconNameExpression}(?:${N.dT.iconModifierExpression})?)\\)$`);function L(ie){const W=S.exec(ie);if(!W)return;let[,te]=W;return{id:te}}P.fromString=L;function j(ie,W){let te=ie.id;const fe=te.lastIndexOf("~");return fe!==-1&&(te=te.substring(0,fe)),W&&(te=`${te}~${W}`),{id:te}}P.modify=j;function K(ie,W){var te,fe;return ie.id===W.id&&((te=ie.color)===null||te===void 0?void 0:te.id)===((fe=W.color)===null||fe===void 0?void 0:fe.id)}P.isEqual=K;function J(ie,W){return{id:ie.id,color:W?l(W):void 0}}P.asThemeIcon=J,P.asClassNameArray=N.dT.asClassNameArray,P.asClassName=N.dT.asClassName,P.asCSSSelector=N.dT.asCSSSelector})(z||(z={}));function D(P){switch(P){case p.e.DARK:return"vs-dark";case p.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const g={ThemingContribution:"base.contributions.theming"};class x{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new ye.Q5}onColorThemeChange(F){return this.themingParticipants.push(F),this.onThemingParticipantAddedEmitter.fire(F),(0,Ne.OF)(()=>{const S=this.themingParticipants.indexOf(F);this.themingParticipants.splice(S,1)})}getThemingParticipants(){return this.themingParticipants}}let y=new x;V.B.add(g.ThemingContribution,y);function b(P){return y.onColorThemeChange(P)}class O extends Ne.JT{constructor(F){super(),this.themeService=F,this.theme=F.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(S=>this.onThemeChange(S)))}onThemeChange(F){this.theme=F,this.updateStyles()}updateStyles(){}}},29301:function(Dt,Ze,ee){"use strict";ee.d(Ze,{Z:function(){return M}});var N=ee(32855),ye=ee(59301),Ne=ee(11592),oe=ee(48736),V=ee(27247),p=ee(34666),ge=ee(76846),ne=ee(8654),l=ye.createContext(null);function z(A){var C=A.children,U=A.onBatchResize,Y=ye.useRef(0),B=ye.useRef([]),E=ye.useContext(l),_=ye.useCallback(function(R,q,Te){Y.current+=1;var Re=Y.current;B.current.push({size:R,element:q,data:Te}),Promise.resolve().then(function(){Re===Y.current&&(U==null||U(B.current),B.current=[])}),E==null||E(R,q,Te)},[U,E]);return ye.createElement(l.Provider,{value:_},C)}var D=ee(76374),g=new Map;function x(A){A.forEach(function(C){var U,Y=C.target;(U=g.get(Y))===null||U===void 0||U.forEach(function(B){return B(Y)})})}var y=new D.Z(x),b=null,O=null;function P(A,C){g.has(A)||(g.set(A,new Set),y.observe(A)),g.get(A).add(C)}function F(A,C){g.has(A)&&(g.get(A).delete(C),g.get(A).size||(y.unobserve(A),g.delete(A)))}var S=ee(33377),L=ee(93912),j=ee(18881),K=ee(85461),J=function(A){(0,j.Z)(U,A);var C=(0,K.Z)(U);function U(){return(0,S.Z)(this,U),C.apply(this,arguments)}return(0,L.Z)(U,[{key:"render",value:function(){return this.props.children}}]),U}(ye.Component);function ie(A,C){var U=A.children,Y=A.disabled,B=ye.useRef(null),E=ye.useRef(null),_=ye.useContext(l),R=typeof U=="function",q=R?U(B):U,Te=ye.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Re=!R&&ye.isValidElement(q)&&(0,ne.Yr)(q),Je=Re?(0,ne.C4)(q):null,He=(0,ne.x1)(Je,B),yt=function(){var $e;return(0,ge.ZP)(B.current)||(B.current&&(0,p.Z)(B.current)==="object"?(0,ge.ZP)(($e=B.current)===null||$e===void 0?void 0:$e.nativeElement):null)||(0,ge.ZP)(E.current)};ye.useImperativeHandle(C,function(){return yt()});var tt=ye.useRef(A);tt.current=A;var Ke=ye.useCallback(function(Mt){var $e=tt.current,pt=$e.onResize,Oe=$e.data,wt=Mt.getBoundingClientRect(),de=wt.width,Ee=wt.height,Q=Mt.offsetWidth,Le=Mt.offsetHeight,Ce=Math.floor(de),Ve=Math.floor(Ee);if(Te.current.width!==Ce||Te.current.height!==Ve||Te.current.offsetWidth!==Q||Te.current.offsetHeight!==Le){var G={width:Ce,height:Ve,offsetWidth:Q,offsetHeight:Le};Te.current=G;var ae=Q===Math.round(de)?de:Q,we=Le===Math.round(Ee)?Ee:Le,De=(0,V.Z)((0,V.Z)({},G),{},{offsetWidth:ae,offsetHeight:we});_==null||_(De,Mt,Oe),pt&&Promise.resolve().then(function(){pt(De,Mt)})}},[]);return ye.useEffect(function(){var Mt=yt();return Mt&&!Y&&P(Mt,Ke),function(){return F(Mt,Ke)}},[B.current,Y]),ye.createElement(J,{ref:E},Re?ye.cloneElement(q,{ref:He}):q)}var W=ye.forwardRef(ie),te=W,fe="rc-observer-key";function me(A,C){var U=A.children,Y=typeof U=="function"?[U]:(0,Ne.Z)(U);return Y.map(function(B,E){var _=(B==null?void 0:B.key)||"".concat(fe,"-").concat(E);return ye.createElement(te,(0,N.Z)({},A,{key:_,ref:E===0?C:void 0}),B)})}var Pe=ye.forwardRef(me);Pe.Collection=z;var M=Pe},29125:function(Dt,Ze,ee){"use strict";ee.d(Ze,{G:function(){return oe},Z:function(){return F}});var N=ee(92310),ye=ee.n(N),Ne=ee(59301);function oe(S){var L=S.children,j=S.prefixCls,K=S.id,J=S.overlayInnerStyle,ie=S.bodyClassName,W=S.className,te=S.style;return Ne.createElement("div",{className:ye()("".concat(j,"-content"),W),style:te},Ne.createElement("div",{className:ye()("".concat(j,"-inner"),ie),id:K,role:"tooltip",style:J},typeof L=="function"?L():L))}var V=ee(32855),p=ee(27247),ge=ee(43079),ne=ee(65030),l={shiftX:64,adjustY:1},z={adjustX:1,shiftY:!0},D=[0,0],g={left:{points:["cr","cl"],overflow:z,offset:[-4,0],targetOffset:D},right:{points:["cl","cr"],overflow:z,offset:[4,0],targetOffset:D},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:D},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:D},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:D},leftTop:{points:["tr","tl"],overflow:z,offset:[-4,0],targetOffset:D},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:D},rightTop:{points:["tl","tr"],overflow:z,offset:[4,0],targetOffset:D},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:D},rightBottom:{points:["bl","br"],overflow:z,offset:[4,0],targetOffset:D},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:D},leftBottom:{points:["br","bl"],overflow:z,offset:[-4,0],targetOffset:D}},x=null,y=ee(80402),b=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],O=function(L,j){var K=L.overlayClassName,J=L.trigger,ie=J===void 0?["hover"]:J,W=L.mouseEnterDelay,te=W===void 0?0:W,fe=L.mouseLeaveDelay,me=fe===void 0?.1:fe,Pe=L.overlayStyle,M=L.prefixCls,A=M===void 0?"rc-tooltip":M,C=L.children,U=L.onVisibleChange,Y=L.afterVisibleChange,B=L.transitionName,E=L.animation,_=L.motion,R=L.placement,q=R===void 0?"right":R,Te=L.align,Re=Te===void 0?{}:Te,Je=L.destroyTooltipOnHide,He=Je===void 0?!1:Je,yt=L.defaultVisible,tt=L.getTooltipContainer,Ke=L.overlayInnerStyle,Mt=L.arrowContent,$e=L.overlay,pt=L.id,Oe=L.showArrow,wt=Oe===void 0?!0:Oe,de=L.classNames,Ee=L.styles,Q=(0,ge.Z)(L,b),Le=(0,y.Z)(pt),Ce=(0,Ne.useRef)(null);(0,Ne.useImperativeHandle)(j,function(){return Ce.current});var Ve=(0,p.Z)({},Q);"visible"in L&&(Ve.popupVisible=L.visible);var G=function(){return Ne.createElement(oe,{key:"content",prefixCls:A,id:Le,bodyClassName:de==null?void 0:de.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},Ke),Ee==null?void 0:Ee.body)},$e)},ae=function(){var De=Ne.Children.only(C),ke=(De==null?void 0:De.props)||{},je=(0,p.Z)((0,p.Z)({},ke),{},{"aria-describedby":$e?Le:null});return Ne.cloneElement(C,je)};return Ne.createElement(ne.Z,(0,V.Z)({popupClassName:ye()(K,de==null?void 0:de.root),prefixCls:A,popup:G,action:ie,builtinPlacements:g,popupPlacement:q,ref:Ce,popupAlign:Re,getPopupContainer:tt,onPopupVisibleChange:U,afterPopupVisibleChange:Y,popupTransitionName:B,popupAnimation:E,popupMotion:_,defaultPopupVisible:yt,autoDestroy:He,mouseLeaveDelay:me,popupStyle:(0,p.Z)((0,p.Z)({},Pe),Ee==null?void 0:Ee.root),mouseEnterDelay:te,arrow:wt},Ve),ae())},P=(0,Ne.forwardRef)(O),F=P},49658:function(Dt,Ze){"use strict";Ze.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var ee=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(ee)||/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(ee==null?void 0:ee.substr(0,4))}},83145:function(Dt,Ze,ee){"use strict";Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.CopyToClipboard=void 0;var N=Ne(ee(59301)),ye=Ne(ee(25769));function Ne(S){return S&&S.__esModule?S:{default:S}}function oe(S){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?oe=function(j){return typeof j}:oe=function(j){return j&&typeof Symbol=="function"&&j.constructor===Symbol&&j!==Symbol.prototype?"symbol":typeof j},oe(S)}function V(S,L){var j=Object.keys(S);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(S);L&&(K=K.filter(function(J){return Object.getOwnPropertyDescriptor(S,J).enumerable})),j.push.apply(j,K)}return j}function p(S){for(var L=1;L<arguments.length;L++){var j=arguments[L]!=null?arguments[L]:{};L%2?V(j,!0).forEach(function(K){P(S,K,j[K])}):Object.getOwnPropertyDescriptors?Object.defineProperties(S,Object.getOwnPropertyDescriptors(j)):V(j).forEach(function(K){Object.defineProperty(S,K,Object.getOwnPropertyDescriptor(j,K))})}return S}function ge(S,L){if(S==null)return{};var j=ne(S,L),K,J;if(Object.getOwnPropertySymbols){var ie=Object.getOwnPropertySymbols(S);for(J=0;J<ie.length;J++)K=ie[J],!(L.indexOf(K)>=0)&&Object.prototype.propertyIsEnumerable.call(S,K)&&(j[K]=S[K])}return j}function ne(S,L){if(S==null)return{};var j={},K=Object.keys(S),J,ie;for(ie=0;ie<K.length;ie++)J=K[ie],!(L.indexOf(J)>=0)&&(j[J]=S[J]);return j}function l(S,L){if(!(S instanceof L))throw new TypeError("Cannot call a class as a function")}function z(S,L){for(var j=0;j<L.length;j++){var K=L[j];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(S,K.key,K)}}function D(S,L,j){return L&&z(S.prototype,L),j&&z(S,j),S}function g(S,L){return L&&(oe(L)==="object"||typeof L=="function")?L:y(S)}function x(S){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(j){return j.__proto__||Object.getPrototypeOf(j)},x(S)}function y(S){if(S===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S}function b(S,L){if(typeof L!="function"&&L!==null)throw new TypeError("Super expression must either be null or a function");S.prototype=Object.create(L&&L.prototype,{constructor:{value:S,writable:!0,configurable:!0}}),L&&O(S,L)}function O(S,L){return O=Object.setPrototypeOf||function(K,J){return K.__proto__=J,K},O(S,L)}function P(S,L,j){return L in S?Object.defineProperty(S,L,{value:j,enumerable:!0,configurable:!0,writable:!0}):S[L]=j,S}var F=function(S){b(L,S);function L(){var j,K;l(this,L);for(var J=arguments.length,ie=new Array(J),W=0;W<J;W++)ie[W]=arguments[W];return K=g(this,(j=x(L)).call.apply(j,[this].concat(ie))),P(y(K),"onClick",function(te){var fe=K.props,me=fe.text,Pe=fe.onCopy,M=fe.children,A=fe.options,C=N.default.Children.only(M),U=(0,ye.default)(me,A);Pe&&Pe(me,U),C&&C.props&&typeof C.props.onClick=="function"&&C.props.onClick(te)}),K}return D(L,[{key:"render",value:function(){var K=this.props,J=K.text,ie=K.onCopy,W=K.options,te=K.children,fe=ge(K,["text","onCopy","options","children"]),me=N.default.Children.only(te);return N.default.cloneElement(me,p({},fe,{onClick:this.onClick}))}}]),L}(N.default.PureComponent);Ze.CopyToClipboard=F,P(F,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Dt,Ze,ee){"use strict";var N=ee(83145),ye=N.CopyToClipboard;ye.CopyToClipboard=ye,Dt.exports=ye},76374:function(Dt,Ze,ee){"use strict";var N=function(){if(typeof Map!="undefined")return Map;function M(A,C){var U=-1;return A.some(function(Y,B){return Y[0]===C?(U=B,!0):!1}),U}return function(){function A(){this.__entries__=[]}return Object.defineProperty(A.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),A.prototype.get=function(C){var U=M(this.__entries__,C),Y=this.__entries__[U];return Y&&Y[1]},A.prototype.set=function(C,U){var Y=M(this.__entries__,C);~Y?this.__entries__[Y][1]=U:this.__entries__.push([C,U])},A.prototype.delete=function(C){var U=this.__entries__,Y=M(U,C);~Y&&U.splice(Y,1)},A.prototype.has=function(C){return!!~M(this.__entries__,C)},A.prototype.clear=function(){this.__entries__.splice(0)},A.prototype.forEach=function(C,U){U===void 0&&(U=null);for(var Y=0,B=this.__entries__;Y<B.length;Y++){var E=B[Y];C.call(U,E[1],E[0])}},A}()}(),ye=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Ne=function(){return typeof ee.g!="undefined"&&ee.g.Math===Math?ee.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),oe=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Ne):function(M){return setTimeout(function(){return M(Date.now())},1e3/60)}}(),V=2;function p(M,A){var C=!1,U=!1,Y=0;function B(){C&&(C=!1,M()),U&&_()}function E(){oe(B)}function _(){var R=Date.now();if(C){if(R-Y<V)return;U=!0}else C=!0,U=!1,setTimeout(E,A);Y=R}return _}var ge=20,ne=["top","right","bottom","left","width","height","size","weight"],l=typeof MutationObserver!="undefined",z=function(){function M(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=p(this.refresh.bind(this),ge)}return M.prototype.addObserver=function(A){~this.observers_.indexOf(A)||this.observers_.push(A),this.connected_||this.connect_()},M.prototype.removeObserver=function(A){var C=this.observers_,U=C.indexOf(A);~U&&C.splice(U,1),!C.length&&this.connected_&&this.disconnect_()},M.prototype.refresh=function(){var A=this.updateObservers_();A&&this.refresh()},M.prototype.updateObservers_=function(){var A=this.observers_.filter(function(C){return C.gatherActive(),C.hasActive()});return A.forEach(function(C){return C.broadcastActive()}),A.length>0},M.prototype.connect_=function(){!ye||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)},M.prototype.disconnect_=function(){!ye||!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)},M.prototype.onTransitionEnd_=function(A){var C=A.propertyName,U=C===void 0?"":C,Y=ne.some(function(B){return!!~U.indexOf(B)});Y&&this.refresh()},M.getInstance=function(){return this.instance_||(this.instance_=new M),this.instance_},M.instance_=null,M}(),D=function(M,A){for(var C=0,U=Object.keys(A);C<U.length;C++){var Y=U[C];Object.defineProperty(M,Y,{value:A[Y],enumerable:!1,writable:!1,configurable:!0})}return M},g=function(M){var A=M&&M.ownerDocument&&M.ownerDocument.defaultView;return A||Ne},x=J(0,0,0,0);function y(M){return parseFloat(M)||0}function b(M){for(var A=[],C=1;C<arguments.length;C++)A[C-1]=arguments[C];return A.reduce(function(U,Y){var B=M["border-"+Y+"-width"];return U+y(B)},0)}function O(M){for(var A=["top","right","bottom","left"],C={},U=0,Y=A;U<Y.length;U++){var B=Y[U],E=M["padding-"+B];C[B]=y(E)}return C}function P(M){var A=M.getBBox();return J(0,0,A.width,A.height)}function F(M){var A=M.clientWidth,C=M.clientHeight;if(!A&&!C)return x;var U=g(M).getComputedStyle(M),Y=O(U),B=Y.left+Y.right,E=Y.top+Y.bottom,_=y(U.width),R=y(U.height);if(U.boxSizing==="border-box"&&(Math.round(_+B)!==A&&(_-=b(U,"left","right")+B),Math.round(R+E)!==C&&(R-=b(U,"top","bottom")+E)),!L(M)){var q=Math.round(_+B)-A,Te=Math.round(R+E)-C;Math.abs(q)!==1&&(_-=q),Math.abs(Te)!==1&&(R-=Te)}return J(Y.left,Y.top,_,R)}var S=function(){return typeof SVGGraphicsElement!="undefined"?function(M){return M instanceof g(M).SVGGraphicsElement}:function(M){return M instanceof g(M).SVGElement&&typeof M.getBBox=="function"}}();function L(M){return M===g(M).document.documentElement}function j(M){return ye?S(M)?P(M):F(M):x}function K(M){var A=M.x,C=M.y,U=M.width,Y=M.height,B=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,E=Object.create(B.prototype);return D(E,{x:A,y:C,width:U,height:Y,top:C,right:A+U,bottom:Y+C,left:A}),E}function J(M,A,C,U){return{x:M,y:A,width:C,height:U}}var ie=function(){function M(A){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=J(0,0,0,0),this.target=A}return M.prototype.isActive=function(){var A=j(this.target);return this.contentRect_=A,A.width!==this.broadcastWidth||A.height!==this.broadcastHeight},M.prototype.broadcastRect=function(){var A=this.contentRect_;return this.broadcastWidth=A.width,this.broadcastHeight=A.height,A},M}(),W=function(){function M(A,C){var U=K(C);D(this,{target:A,contentRect:U})}return M}(),te=function(){function M(A,C,U){if(this.activeObservations_=[],this.observations_=new N,typeof A!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=A,this.controller_=C,this.callbackCtx_=U}return M.prototype.observe=function(A){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(A instanceof g(A).Element))throw new TypeError('parameter 1 is not of type "Element".');var C=this.observations_;C.has(A)||(C.set(A,new ie(A)),this.controller_.addObserver(this),this.controller_.refresh())}},M.prototype.unobserve=function(A){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(A instanceof g(A).Element))throw new TypeError('parameter 1 is not of type "Element".');var C=this.observations_;C.has(A)&&(C.delete(A),C.size||this.controller_.removeObserver(this))}},M.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},M.prototype.gatherActive=function(){var A=this;this.clearActive(),this.observations_.forEach(function(C){C.isActive()&&A.activeObservations_.push(C)})},M.prototype.broadcastActive=function(){if(this.hasActive()){var A=this.callbackCtx_,C=this.activeObservations_.map(function(U){return new W(U.target,U.broadcastRect())});this.callback_.call(A,C,A),this.clearActive()}},M.prototype.clearActive=function(){this.activeObservations_.splice(0)},M.prototype.hasActive=function(){return this.activeObservations_.length>0},M}(),fe=typeof WeakMap!="undefined"?new WeakMap:new N,me=function(){function M(A){if(!(this instanceof M))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var C=z.getInstance(),U=new te(A,C,this);fe.set(this,U)}return M}();["observe","unobserve","disconnect"].forEach(function(M){me.prototype[M]=function(){var A;return(A=fe.get(this))[M].apply(A,arguments)}});var Pe=function(){return typeof Ne.ResizeObserver!="undefined"?Ne.ResizeObserver:me}();Ze.Z=Pe},98040:function(Dt){Dt.exports=function(){var Ze=document.getSelection();if(!Ze.rangeCount)return function(){};for(var ee=document.activeElement,N=[],ye=0;ye<Ze.rangeCount;ye++)N.push(Ze.getRangeAt(ye));switch(ee.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":ee.blur();break;default:ee=null;break}return Ze.removeAllRanges(),function(){Ze.type==="Caret"&&Ze.removeAllRanges(),Ze.rangeCount||N.forEach(function(Ne){Ze.addRange(Ne)}),ee&&ee.focus()}}},93314:function(Dt){"use strict";Dt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAACaCAYAAADl9acYAAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQd4U1Ubfs/NaJtO9kzLahFQEJkiUBBFUFFkCCjiAAVFERT5FREQQQXBBcpysWRP2RtkKRsEOphNodCZdDfjnv85CU2TZt2bhABNDw9PmtzvrO+c957xLQIP0pkz1yrQIEmwwcDzHhTj91klEo7jpcG5zetWUJdmRjmPvTM9GI9JgSGvadOoLE9KJJ5kPp2YXLtZdO1kT8ooz2vigCNelvPYezPEG7z0CDAn4pJqPvJA5A3vdcl/S3LEy3Iee29OeIOX5YDx3nh4VFI5YDxin6DM5YARxKb7g6gcMHd+nMoBc+d57LKGhCQ1ZURBCoVL2nKCO8sBZWW50x1TOWDuLP8FlV4OGEFs8glROWB8wmbPKikHjGf882bucsB4k5t3qKxywNwhxrpRbJkGTOx0ehlA3d9e5VEtzA3ulGe55zmg1QOfrCVo34BgQGvr5rLDRl4RRZG+5NjBESBc4FHw1LlrCAuPsCo0JjKi7J5hYqfTXADBq4byCJLf82Nf3kA3OfD9LgKdgeCzZ4CUTJ1VKQFyKQgpmeMSjiKvQC+oplspN/wOMDcBVFv0Bo+KwYJ4VE50H3Jg7j6CWzkEX74A3MrSgTfeKZpSaBCHcAVn/JunBHlFPDR5BkG9LMjPt7mZLOtbskQADea9wqOW9coqiGHlRPcHBxYcJriQQvB9P+v2cqCwWFxgoOJk6JeTNX4HmJMAHv6xP4/6VXw/+OxNx/bM/pIohdUE9VW/VxwjOHiJYO5A6xolpGSpYW3jIW4w/A8wM+h+UHSY2pvHgzV9NXymeor0wPc7Cf7XzWJ/4Nsm+Ly2LzZx+OwZ3yuVbzhNsPEMwcI3rM8wMikHiURi5gNbbQoKrc84zpjkj2eYzQC6f96DomUd305ctrp8tp5gSk/f1utzlFhUOHYthy9f8D1gdpwnWHiEYOVQ6zNM6QM/AY+CImHnF9YtfwTMCgB9P+5G0SHa9xP3bk2gT9cBU3r6Hjp95nBYNcz3gDlwkRhX843vlfS59PmFHfjFzgC/2pJ1nEEnEIpIAG+834Wia2Ox7PJ8wt0twLz7J8Gsl3zf316zCVYPsz5oe85F1yUcu0YwcQPBjlElZyjL8wsrQeyBn+XxK8DETqefgyACFCPe6kjxfDPfT6C7BpilBLMG+L6/A34h+P1VikCZ60nuTYpzN4AxqznjCqPOMZ1RSp9f2OVLYZH1lbOrNvjVlswIGEAKYOyrj1K82NL3E+huAWbEMnbFSn1+Qzd4AcE3fajPZV6X04D3lnHGM4xOawKFJwLLYiD5H2AoCkHwJQMLA42v090CzJjVBBN7UCh8rN3AgDrqCYq6lX3L6RQ1MGQRhwWvA7UrALbnFzCJjOhG+d2WjFCkUYKZPZpSDIv1PWDGrycY34NCahI0+yxN/Ivg3c4UlUN8VqWxok/XEfRrSdG0tm/rzcoHBv7KYc5AILqqLWDcOb/45RmGEFyhFL8/0Yga33y+Tl9uJhjxOEVIoG9rnrqVKSJSRFb0fb3tG1A81sC39TLRSu85HL57Eaii0Bm3oqEKqZXSJaUURUxTU0Tyuy0ZAc5SYCUbxE+6+x4w3+0kGNiWooqP3/Qz9xB0bUTRsLqI2eEFUlbvA9WBJxv5ltdMit9jFocpLwB1InQIkBEQTmLUHStOBoMBOr24K2+/AwwPHOKArS2iKCY9VzKIg34jyMgTv6f1wpwqL8JLHKgUTLHwjZIxZTKg0V2Bzg2tLzvYBYA75xe/25J1mkEnGAzYyXE40KQmMK23uLeLN8b1j0ME7epTxFTzRmnCy/jzXyCqIny+NVryDzFeKfd+xLcrDOMMO8MMfgx45iFrOZA7AstiTvvVoZ91usM3tClHcLpeZWDmAN8DZtlRgkY1KJr5+BC87hQQLAeebCwcZN6gXH6MgG2P+rfyDmD+WLoV8xZugkIRiNh2TTHghcfRoF4tFBZpkXgpGQ81rmdu9puLOLzwMPBYPR1Cgzw/v7CC/WpLxjrc/jtaT2LApRrhwC+DfA+Y9aeI0dKzbT3vTCChk3r7eaBABzzfTGgO79CtPUmM9b7U2jv9bf3kOyjSlihLcoSg93MdkZ2Th227j2Hoq8/inTeeNzZ+xFIOsTHAsw/pAeL5+cUvAdPuG1pVRnArQgEsGex7wGw7RxAgBTo19M4EEjqtD1wEkrPYm15oDu/QbfkPSM0hHsu8du0/gSnfLkFGVrbThjFLynULJ6FOZHUw2RNbyd/qUJLFHZV+ywr9aksWO4Ou0BK8KueRz/bVq++CUuD+RGbhB3R/0LeAOZEEnFIRvPGYb+vdGw+cvU7w3uOe1dv+mfeRk5svCMUfvz8AA3o9jgkbCJQVgPe7lGTz5MDvj4f+VXs/JH1ip1PmAkHy17u8z42bjl4lxjf9C809m0CCZo4FUVwKsDPOJLz0ZTp6Fdh6jtnWe1bvuCm/4q/tRwQ1/b03e2LIwGfw1RaCkADg425AOvPkYCHZd0cG43dbsk4zaDFgWHiHcG85wjBQoEhnMhAzf5r/Jihkf9/+fjXDtDXqGA108+Eqcy0DYAfwMU95NnEFzVgLovibwK8HCab19qze61s24Pf5K7A5KwB5vHM1CblMij9m/Q87rtc1jsek54CMPIBayGD0BgP0ImUw/gwYFiqjllhHGAcvAkuPcijU8cgv0KGgSGv8LNJqweu1MOh14A3ss+S78W+Dzuo3RsPoTy0YgIjQALFz0C36tBzg570EE3p4NnHFVn5TA0zaSPDzy57Vu2bIS6jF67BDHYBHgnVI0kow+6ZjLyZNm9RD+35jkZINfNO7ZIVhEn+e16NQ6157/OqWjJ1h9n1IXoydTi8AeGD+KzxqinCEsfkswfBJC2HQacXOG7v0B+e9CGXVUK+U5aoQdm5iE3eqh296R/XoDEBu0e3/hcz3FzF+Z292trI91Zgav7N2tKrDrrfFTdgTI4dAl61BipZDDXYINRCMvBrusNvBikAMHT8LTM3/pwElK4xMAuQV6uBuKK4yA5hEVfY8SvmmHCETGyjDtzqbQLHf0KMgaCnWEcaW/whGT1mAHHZP6oW09bueaFy3khdKcl0EO+y+v4xgphs2MWxbs+K46bLCDIoi6+9iVLKY4PbTp8UB5t8h/UB53qimz1aJA9lyLExz7H1vyMCnUa15L/x9EfhtkIk/nh74y9ShPz5JnUGA26qFZIdcTofWqR5xxd5Uip1O9wDoJNYRxs4LBB9PXYxUdaHrGSqAYuWUp9GmSQ0BlN4h8cTq8qVfOGgKStpBeAoJb4DEYPrPsU89b/5e/LvEYPubLCIQX06NEtWpfwa/yA4h0FEgqVCK71OCUeTARdLLfbpg9PAXsfGsBBtOA0uHmKpyV0PZsqFl5lo5QaXWgRqNw4pTHiEYGa2M+KX0yMROpxsA9BDrCGNvAsG4GcuQdMt45eJx+nXsk3iyNbOY9k161wOry8/GqZCr1t4GBA/O3T0Nm7gSDl/89IBRHiU0nRk3CgU3knEmT4pZN51rrjI5TN2oGmCOMP44BKx7B8jINemP8ZRCK2Y5LNXAMrMlS0hSpwKw9TRGME+XHf5ekybEfPCInU7/BDBArCOMw5cIPvt+JRJUGqHj7JRu2rsd0P+JGBuanELTTVpwwO3/cnjFxNcTwMz95hquxud5pd+skIEfR6NJA+F2y6o1S3Fj4xpj/X9lBmK7OsDuChMUKMf+v36AXC4Fc4QxYwew/X0gM8/k5VKvN0BvcF9gfc8CJuGWuh4twgoQnJSBzK+nDP+3eLTsBahJSNL8DdD29kaUAFsDSU4vpVJp3FTETqdzAbwl1hHGySSCCTPX41RimlcmzthBrTCsV1Obss5cJ2hWXQupTIoiHUW+1nRYZkcn5kRbTzlIOQq5hBmimfRu2RwoeU4gl5rAFiI3Odpmb/NRK0zXu+zgKzZtWZWK/VvTxWZzSP/EK5HoEivcxsFQWIBzk8caVxmWmMT+g6thNlfMg/p1xYfv9DXSMEcYEzYAu247wnBXQ9myE/fslixRpf6FUgw2N5bgDChmk6Lw33MMqkqlg8JeVKmn8hRjHI0QIdgbiJynGWhiZ9AZoPhgaEeK50Q4wmDCvwmzt+HwGe8EcH67V1N8MshWV4UBpnlNLQID3Lcn5nkKrZ6iUEex4azEqC08di0BW1XDgsTP+2NHsrH6F+/0m9Xetns1PN9b3IWHPi8XyetXIOPoEeg1WbhYKMGK9CCoiiSoWq0SnuvWzqhLVuyoz+wI411mmi3epZI9Lt2zgElIUht9INtpdDJPMUsSGf59NCFFxc8TknI6AoZ9LqbCmj+V4X33zMAEAOMHtaXoJ0KLVpUJjJuzD3v+vSh+xtnJ0ffxaMwY0dHuCtO8pg6BAcK3LI4axCTai/4hRsBM3kww5DGK6o5vYx32S52pw9QxbEi8k6o2DMeoj2q5VVhqNnB29JsI0TP5M6Dj5Gg7dwmkpVZOsyOMtyg4joDyBhRq3d+Osbru3S2ZSp0LCmf+9ZM5CUY3qBWx3LREUy5RpbkKQOl0FAimvrksPAME08Q6wmD74DGz/8H2A/+5NdClM8U2r4VFE7rZBcwjtXQIkHsOGLbSLP7XBJhvdxD0fJiinhs+pVk5n41IBM/UFryQSHggvpxRooovpsgdFwjoD8MQri3ZIso/XYzm9a2FwDfUAFPxX/AaRYSCeCR/KW7fvQuYJE0RQF3vSQh2UQn3bsOaYXEJSZrPADrJBfP5BceCVx+4LO0r1hGG3gC8//Np/LXrmJjxdUhbv1YE9vzU22eAmbOPBRmieNCNFzvP8/jhaxVSL3vn4M9zBJN/bgSZgJsyplZ0KQ24oSZgq8vmE4V4+9hrkNIS8O5uPhbNOz+CprWpWRhd7Ahj9svMYM871rT38pbM/q2XvelHoeU4bpxBgt+Jjr8MAqfi80NXZEW/H1UEuOMIY/zCRPyxZr9XABMSJMP5pbelahYlsjNMi1p6402Pp8lyhWEhIBpVp2hdV1yp6nwgPAhYvzQF/+zOEpfZCfXgz6LRIMrxKsq0B5YcKsL6UxRFvBygelBdLjhZGMCx/RfTKWMCUGZzbAClvJEmtiGH97oEGLdhzBHGjL4UDyvLOmBUmn9AaamAay7GimAXgdErzG1RlX36k9el+PlgsPFtK9YRxtwtNzBl7havTZoLywYhuJRbSCNgauvBlAg9TQYDjyVHOeOWbOVxoEoo0Mn2JttpNZvOcmhfn0KTXoTr8TlITSnCrRSt8TMvV7gj79KVPDskCo+1tb/rZkLScavzcTlTARBrZUu+MB1coHNHZ8rQXEzvH4T+8yWY9DzQrj6QptFDzzRlPUj37JbM5pZMeCfZK5CNgsPt3PlbEny3LwSlHWEIqWLzcTWGfbFaCKkgml0zeyNaaa3QdqcAs+msSa2k+4OCmmYm2nyWQ98W9idabo4eqSla3EopMn6m3mRgKkJ6KlM6dV5Plz418ES3CjZE7Ar9w2X5UGXbv3bmC1NBAiqBEOf34zFhKlzLq40PuxK0i8qFutBzRdd7FjDx1zSDCKELxA2tmZoyyztqqc9tUdDlDAm+2hUCdxxhHIwrwOAJy5EvIkSCsz78Nq4rnmhpfU/BANOytgEydwQmpSpjQro/b68we+JNArzej4jjKouz0q+luDwGAzWCxnI1Kr0qPfpEZTzXv6pVwUzf6+MVBTiX6vi+hxoKQfUF4AJswWZZGF+UCUN2IsYMaINnbcVd4jp0m/qePcNcvJlTldcaUm5vVN3qnKNM1zUcJm4LhTuOMP65qMWYGWtxJcU76jGT3nwUrz1j7ZnCCBilAbLS96RucIFJtv88ZpLD/HMZSEgFXmkrrqANp2yjEYsroYRar6f44I3zxh9qNwnH8FHWNxBLj2ix6F85SKltmGV9lBrAF6RConCuh8fotCn7MSC2Fob3ELkPddDBexYwrL2JSZqtFPQpdwfHUT7mf+zjTWFwxxHG8St6zPhtCw6cZXcSnqdhLzTF2FethZcMMK2UBki9DBgmbz18mYAJbMUk5shiYBsxORzT5ucZ8PHbcUaC4OpBGDe55AbiShqP9/40gHLOt058UZbxXMPJnQuUKK+DLi8DEs0R/PJBLIIVwjULHPXgnt2SsQbHq7JeIJSYFIi8mNgeeeT6cFRQAItFOsL4L5li0do9WLrLriK06FZ2e7QO5v3PwugcgDcBo9MbsPT2CnMxFcYwdiNFuMhlKjcs/J23AMMEoONHJhj5JA2T44tvS2TTo5cX4kKqY5X9YuYacq9CEhzlMngmr8uGQasFLUpDPcUV/DCiKwrcNBwrrvueBsyKFVTSvG32aQraRPRMdJKBWaa+vSrcqNAo1hEGsyD8Y/1R/LzmjFea1EBZAbtn9rIqywiYSB5Siecey3U6A5YeN23JmCCPORIcK8IWhV0ps1Wpj8hzjyPmsDPN5P+ZNCWInMOXPz9g/PtgohZfbpEZ3SE5TxSGXBUkIa61vPnCDLCzFEuGrOMY1q02Xunq2VS6p7dkrKOJ17N7UAPP1PG9moatCoOBJ9go0hEGe+P+vC4e3yw84JX2VAoLxMmFL9sApnUkD4kXAKPV6bHsuNQIGDb5p28nmCwixmZSJnA5jeCZh1x3NzfpKi7M/xlFGRmo0qoNqnfohPAG1mcH1dUCfDP+sqkwjuCreY2Mf478swiJGa6V3Az518EFVgHhXMu0DYUZ4G8Dhuqy0Sg0EfM+8myHf88DhjEzIUmzAaA9XA+ZcIqR60KRp+XgjiOM3Sdu4s0vtyAkSIrgQCmCg6QIYZ+BMuPf7Dfzs9vP2bPi34ICZTh2szJ6NM41HuyrV7f2G8tWmNZRPCSc5yuMJWCYGcjHawm+7Sv8DPPfdSBfS9C5oWveHhg+GFqNyfRBEhgIeWgY2kz7AZysRDh5KT4fP0y5vZ0lwBdzGoO9FwbOK4S6KMDpCkP1eaD6fCNghCSDNhe8zmTsVznrMD59XIGa7Wx194SUVUxzT2/JihuZmJJThWoNZ0HgNY/EH28MRUY+B7GOMFibcrJzkJuXB3Z1zXHc7U9ivNlh0mX2aXpm/7ekLA57E6R44zHm5slWAs0A0ybKpDDoaWLhHJafMK0wLIm1ujx0iYD56WgrQO3ryuplSN6xzajkqM83+RCr1aUrol95A5zUJIT971QO5n2bZPybXYRNntsYvx4guLJrL1qkbsD2moOQHP6wlUskRkt5PfiCm5AEC/exa9DmgNcVoVL2KQy59RsqhAQg6tPvwAU5U1F0zvH7AjCsC4mqnE6UGpitvsfSJ0IIHb8lmNzIlkCsIwxPJzDLf10NrDtJMNyBjzDvAkaH5SdkbgOGOf5oVAN4sKawnl+YOwspf+81EzPIh9VvgCbvfoDAKlVx9JAai+ZcNz4PVBBE9W+M07uPo9/laeBgknSeC22ObbVeQ06QCRzselivuQhZBNveCX+JGAoyEZEThyE3fkIYNa00yh69UPdF6y2wsJ6ZqO6LLZl5pUlW9wHFMkrh6mTokgdf7QzG5UwpxDrCcFmwAAImPPztIMHorva3RkbA1GEhGoRPDkfVMj/EVoARaabM2vliCxj9QQtJ1GDAtU3rcGPXDmjVWWDfWWJbtHp9BiCwRScU6KQICJRg4VEp4g8ex4tXvrFSpGT0JxXNsKraIEgVFaHLuQ5ZSE1wAeLsEioRFZ5PnAVlTok5hiQwCG1+mAupwr1V5r4CDGNkgkrzEij93Znqi5CB/XafAhduySDWEYaQsl3RFGiB6Tsce4NkgGlbx+WtqatqjM9ZlOAVJ0tWmPeWEvzYX3gYcOY9cuKzsLE1EVK5oagQJ7/4DDlXS67gZTVqI6dlXxwNaIXrJ06j75UZkFhoHbNyK7Zqh2E3usHAlCupDgFhtSAJEmdsxsqJqZSHevmJaHPoC6vm1nvpNdTu7t6R+L4DjAk06t7M+tKuDb+QkQTw00EFTl2XQawjDIHFOyVj6h+frSeY4uC2it1MRVXgIeUIpBLTWcjdxMJArDgpN2/JPlpF8PlzwoPDjl9v0vZ1N2k1apz+ehJyVaZzS3HimUMKIoWUWrusqtDqUTR46308/bUKekghU1QBkbq+PbPXPkNuEog8DAOS5+ABzVEzSWj9GDSf+JVbXbovAcNs+oODFYSjsp8oqCm2gcj06z9BOHJNbjTZ7RDt/oQQWa2ZXEw0ZWY1yYzYGdCYuj5L7AJNwgBlvHRgj3mjnfvtx0YlS/Zcp9dj6wU5nmpiysccdLMYm5UECr3HruHwQ3/P+KPLzcWZ6VOQfdG5xWbVzl0R9fJgEI7DjO0Eu85rQSTuH1lbV45HbmYSzl1OR+2im4g0ZEJpyETdAC26zpnv1tDdt4AptulPNJ1rplMKUY6uFh8PxL5LARDrCMMtLtvJJAYw3qqTlcOCw7JYLUoBwWHZWWvBIYJxz3jeAiZxv7R0AZJ3bIetdT1B7T4voebTPc0VMbe2G08Wur26sII+6JyD5x4JQU6+FkfOp+DA2es4fO4GsvO1qFk5BE3qVEaTupWNn9G1K0AmILT1fQ8YxhhKqfTi9ewBoPQjSiFAxAasOh2AbfGBRr0qMY4wPJ86phLuFmBm7ibo2oSioYAL+uPXgKvpBIMe9VavgctnE5C7fyuyz58Bc2oRVKMWaj7XBxVbWGuELjxMsOxIAYjUtaqMo9Z90CkHz7WwXkoNPMXZy2k4ePYGDvx3HVdSTHIjBqCVn7verJQJwBQzjKnzJyRlPcZJuJ6UxwsAHEoP/joXgA3nAiHWEYa3ps7dAgyTeTwSRdHcuecDYzdXHCN4oBrwaH3v9Fqr55GWmY2ICNe3XWtOEvyy17MVZmRsLnq2dH4bdv5qBt6Ytg3d29TDOAFvhjIFmNLDGp+c1UxCycs8xTu3jcrMJDvi5VhxOghiHWF4Z+rcvRXGGBy2EvCYABB8sZHggycpqoa6f+lgya/MXC20RUUIDXV9gGJueb/d5tkZ5r0OOejd2nldm/+5gkkLDuOzQe3QrY1r2+0yDZjiwbp4PUNJeelKSqlZSX3/ZRkWHVNArCMMbwFm/AaC8c9Qt65rPWkDCw7Lggw9YVLhcprWnCCoH5qKGmHUaC4tl8sgl0kgl7FPqWhdt6upuQiWc1AoXN96MSd849ez62/31YPeeSwHL7Z1DpixvxzA7hNJWP9lL1RmjgtcJL8ADOOBSkWDCqiGaQoYlYn+TZJh/hEF3HGE4YqpQp7/sC0PrzRPhYxPg9yQjmCkoTA/HUV5aZDq0wBZBQQ0my6kKFE028/BGODpOYHBYfPy8qDT6aDT6Y2flolpUxeDhznscAWkfxKzEFNDAbncteIk8xIzYinxSBj1VrtcvPSo4y0Zs0Z96qPVqFpBgcXjnhXEx/saMCZfZNmTQCjTmZCAEC0oUglPU3iOnDEYtCcb16nCrDaN6ZxKU1HK0xOEIOrMDSlmHnDPEYZLzhoKAW0aivLSQXRpCKRp4HTpKMxNAy1KN36XE+cRAHjKIb/pckhk7h967bXz70STao47wWHZ9bZebwJOMYDY38Zrb4vEtKwZeAKMq5IJSDKZFOuPpqFr8yqCNBjYDd3AXwwgnPu+2Qa3zccrjzleNY7G3cR7P+7G8+2jMWaAMH8r9zVg4pKynudA1jmawExnjKf8fwRkAwF+j46MuJSoyupEKdkdnyoh0/e65wjDUX1c3MdA3hUEEO+YL6fU+BwRNUQa07tAM7v5OpNM8LoXg8PqDXrotHrojUDSQafXgXmrKZ3i0uV4vKkwiT2TJ/WcqYWBBLp8PzkieK1NIV5r71iO8/2qE1i2O8542GeHfiHpvgbMRVX2RzzlpwnpKCGEOa76i5dynxCeTriaTvpP2RnqliMMhwC9MBaBBaeFNEcQTU7FvpDWeU0QrVCiCynA7jjHip9Cy3FFxxz/mVYi0//sPD2u5wWgXUOBSmkAXvtVj7R819s3R215ta0Orz/m2FVVnwkbkJyWa7xOZtfKQtJ9DZiEpKzXAfKbkI6W0JAiQrDyZjZ5adyWUM4dRxiO6qOqRVCkLRPXHCfUt2gjhLXw7jmGBYdl18Uf+Tg47K4LBCz0uZh6P1oJnL/p/qH/5dYGvNnBfv5rN7PRb9JGVAoLwoavrC1enQ3gfQ2YC1ey6kil3CV2lhE7S7MKuMIxf4UGuuMIw1FdhszjCLk6XmxTHNLrqRT5TVdAJnNfPaR04cbgsPsIJjzrmbqL2E4evgxsPy+uXubM7+Vfmbss9661X2lDMdhuABRgyc4LmLnmJGKbKfHlW8KNyu5rwLBBS0zSbKBuWGOyWCoj1rrnCMPRZNEX5SLk3ACmVih2PjmkV9WYiso1RHrec1I7i1HJ5Ct3Kjiso6rPXgeY9P6bPsKB2uSRWKSlZbjNy3FjhuOTD5kIzja9891OnEhMxVs9muHVbsL5e98DJu5ydkNOxh934enfhmPsUDl0ZRgCZUS0IwyHWzJmqPPfcATorrk9yKUzZld5DTKlKUCQNxLr98jlJhV/X6ZrmcBXmwnmDBReb2R0CxQWmiOaiG5uj+5dsOyPH23yMd2ybmNWg6nJfDv8cbRpLDzO6H0PGMaN2zYyi8Q6/Ru+Ogw6A8FfIh1hOBs5evE7KLJ3ih5cRxluSR5FWLNxXiuPFeRJ6D53G5KWC3y4gmDhG8IAw7Ssa9Vlpsrup8jaNXHh+A6bAnYcu4bPfjto/H3z1D4IZ5JcgalMAIb1NVGlHkwpmQ1QwRf3H6wPRU6Re44wHPHXcGMTQm7+LJD9rsnU+soIaO2ux1z75Yu163fdStcUuYXA6wsIVg4VBpjMLDUeaOrgAOK6OjNFcvwhVCiluzbh90PYdvQqqlcMxuovSjSkhRRbZgDDOnsxOaczpYaFlEKQp4Sxm0KQlidxyxGGI+Zqs+IRfuUDIbwXTJMWsxghIc79CAsu7C6Ndg0lAAAdVklEQVStMEws88Jsgg3DhQEmSXUdLdt55hLJuIKs/g2x7UvcdrJtWPcxq40q/h2bKfGViAM/K69MAYZ16NKlzHCDlHwBwr0FUKdr7efbQpCs8a4jjMKCfITHDQRH3d97l578qmqTUblWczGYcErLzjDT+/hej63HLA5r32YOCl135dyFeHTuahtsynVOa4qvPv8II4aVyLJOXUzFsG9NW+bXuz+EISK9lJc5wBSz69KNzEheLxlFQVnEIrvmUlN3B+NiuncdYWi1OsjjP0KQznvxIDVVh0Bem1kreCcZg8N2pwhzX4juVkN6zebwx+u8oHr/OXoCPXrZBpsSW/GAvj3wy6yvzdl+WnsKi3aYnKFPHtIBnZu79qBpWWeZBUxxJ69coYE6ae4zlOqfIyBPM59uxc++36/AuZvedYTBJNz6+OkIL3AVn1b40N8K6oawRu8Jz+CCcvImgiEdKKoLF7p7pe4B8zl8148XVO+uPQcwYNAwj+tt0iga/+4t0Z4a8MUms9HY0vE9ECnUHc7tlpR5wFhyfA+l0lqq7L4A/QlAhTmHgnA8We51Rxh5FxejcvZSjwe7uIAk/cOo0nqK18qbsYPghebUGO7Dl+n1Pzh89iwvqN71G7fhzbc/9Lh5LALCzr+PQVMkR2w0Na4u566m49J1tVElRqyDEb8CTDH3LyblPMhTw67fjwZVPXTV+44wspP2oVq6IBU3QRPiprYWwtvOE0QrhGj2PoKO0dSoR+fL9O5SDm/H8oLq/XP5Gowc7R2tic9/XIlNyU2wY5RH1gJGVvklYFjHL6k0Ty85EbhxV6KceNsRRuatS6h1fYTX5mK+IQR5TZcbDb+8kVhw2MY1KFrV8UZpwsv4ZC3BCw8LC0o7/7fF+HRCydnDWS1FOSmQh1S363aX5XtlxGTEBfbCxveAIMFCB/s1+i1gGDsGL9Cvvpgm6eVtRxgZGZmomTQYHNUKn01OKHlIcEG5AfWE+eB2WefKY0DVMCDWO0G5XNZXTMDOTu3qUzxuinDhNH0/cx6+nGYrpS+diflxLkhPgFRRGfIQ+wzq9OxA5DUei5VDgYruObw0V+vXgOn8LR3L85jibUcY6iw1KiV9CLnhpqt5Ieg5DxkOV16PRyKFyTBcFbrxDPNZJj44rKtyXT1nvsYaVqeC4k1OmfoDfpjl2ncYb9CiMOOS0edyUOVoEGM4cuvUuGkrBHdbgIVvALWs4++6arLNc78GTOx0yq6efvS2I4zs7ByEJY1HkNYUactZ4kkg9FwE9JIKMEgijH8bjN/Z36bftCQcudLaeKC6q9KEPd8dB2Tliw8OK6x0x1Q/7SWoGkrRt4XrksZN/Brzfl3skpB59S9IN13hy0KrQxZkK+ANCQ1Do7ePYO5AoIF1DFqX5Zcm8G/AfENfB8Fv3naEkZubi6CkbxCou2yc9CZARJgBwcCRVlgZV3KC0aSmAhwnQYBcYowHI5FIwIN9MjPfkt/shcUQPdq3Mxy5DLDwfQNFBod1t77ifMyxuVxCBdX7wZgJWLzUdXh3Zh7NtmSgPCQBIQgIt+8/qtmw3fj5zep4yDoGregu+TVgOk2nTNl8pbcdYeTnFyA9U2MMDhQYIIFcwoGTSGCgnHHLECTnIJVIMG2H1BjywtcCRBYc9shlgrdEBocVPbtKZVjyDwGLLyqk3mHvjsGa9ZtdV0k4FGZdBa/NM/JbUcX+wSy692z8PDoWAjwpOa3TvwEzjXajHLa0b0DxSXfvnA9cj3AJxfe7TG5bq4aKyeU5bWIqsOkswcguvu3zyuPE6IBDSL2DBr+Hrdv3uOxshVqNkZqwH7q8NCNtYKUG4CS2V2G1OozE7ClvoZOHFx3+DZjptD0F/m4RRTHpOd9OHja4c/cRdHuQGh3r+TKxScuMuXz9kmDRmM/dgKB6+wwYgv0HjrhkS6+Bb2PlbzNQpDbZILEtGdualU4VH3gaX0/92ii89HZSVpY7NQllzvOLfYG7W7d7Nqe3a/NGA1hR7WfQZhKKU0yAN62396wkhTKFyUPa1qVo6KXDvNB62YH/2x0EXzzv/cnjrA07zhPsT4SgepkeGdMnc5V++nE6Phz/PTITmEIlhSykOmQK24M/W3mmzV2Lpxp7f5z9BjCPT6P1DRwuetMRhqsBtnzOnFHEVAMeVvp24hbpmata4lHcFzH9LKZl8TJXn4Cgep98+kWcPmtSknSWVi/7BZNmrsc/G2eC1xVAqqgEeYjtVRjhpPji1wN49qE7x+uYyAi7C4E3XvA+XWFU6Vo1ABsP2MzJwvDlMnjTEYarAbZ8zrYoVUKBR+vduUF01J67YUR2OhmYs49g9suu+9uhy/OIT2DyFedpz/bVWLXtFL77/F3o8zMhCQxHQJh9nZ/RU5diYJc7p95QZgCTnKHLppTaHK3Zm3bwYhkqKIDFg72/VLsabLZFYbYhnRu6nkCuyhL7/G4AJuEWwKT9QsyUWz3WDdeSkl1268zR3ThwLgtDBzyFIo0KnDwYgRH2VfYrP/jCzKTdX3pPZ8ll60wE990Kk5yhi6OU2kSaZx5OBy2UIkDqPUcYAnloJDtwkSC7AHj6Dm4THK4wIoPDiumXI1pVJjBqBcGqYa5fEA+16IxbqaabL2cp+dJJ3MqRoGXL1si7cRKcNAiBFe2vIopqDZemn133kqsyvf38fgTMJkops4WxSUOWSFGoI9joRUcYQhl+SgUkZZK7EtBp3DpgsjhzdqHdckiXlQcMWcReTq4Bw+z5mV2/sxQcrMCVuH+NoQof7DwESf/+aTz4B1WyH8tDHl7zhDpxlwA9A4+7alXAfQcYVYb2V1C8YY8N7y6XQl1AsGoojyD3vZK6zWHm9siDmK9u13u3Mgrtb71GbZCbm+e0mbVq1cDJIyavMK99OAvrfp0IfVEOFJWj7earUKUG9mxZ45WuOzqv2Cv8vgNMcqZuCuXpWHudGb1GipvZxKuOMLwyIn5eSGSDR8AiQDtLDzZ+ALu3rTKSzPrzAMa//xK0OSlQVLHZfd8uhuDQ/p1QKDyPiFCmAaNK17KD3g/2mP/ZXxJcyeAw/xUeNT3UZPXzOe7V7tes2wx6vcFpme3btcaa5SbX2gfP56Dnk62NipiKqo7tB1at+BMPPdjE47a6kr1YVnD/rTAZ+r6U8ivscWnyVgnibnL4sT+P+l6yN/F4NMoLQLXIh2zizpRmy9PduuCP+ab3YE4h8OCjzyMzfrvDMwyjm/rVZPR8vofHHC7TgLmRpetoMFC7Ximm75TgVDJn1G96srHrw6jHnC4vQBAHqipd+zvu/2JP/Dhjsrm8zv0n4sSWHx3KYRjh0DcH44NRnt8sl2nApGTROnqD7oq9kZq1T4IjV0Q7/xc06OVE7nPg6DS2bXL+AqvW4hVEdvnEXEna2bW4uGY4pEGO99ZPPv4YZs3y3DNpmQYM42hyujaBAjbXJxvOcFhxggHGI+UD92dGeU67HDg6/SGAd36GqfHoMNTuULJaFGZexem5T4CTOL7ufCCmAf7dv0EQ11MyrWN6WmYq84C5lqEdyVF8J4hTlkQc+URZUSbMG4PowsVlSEhSO3zlBtm5+alR0UOPD+KaZ5fa0aQryM+3oi/d/ocfaYOCQudxQCeOHYUPRrxpLocZk8U0i8Wt1HSHLQ+Qy3Hj0jFjzE1Xya8Bw4IuJWfoFgJ42RWjip8TQlbVqijtbwz3dw8kfwJM23YdkaXWOOX6tMljMWzIQCuawW9/hJVrNznNt37Fr+jc8VGXI+rXgCnmjipT353w/Es80IIALDAIM56QMFBQSpmkLAUEJzmeX1qrSuBfLrnqQwJ/AkyXJ7sh+bo5ALZdLs+cPgmvDuxj9ezPFesxbETJucZexrfeeAnTv3QdQqTMAyY5TdeZEspcjdjXjfDm5Ka4REDerF1F5tos0Ev1+hNger7QGxfiLzrl3PyfpqJfb+sr4vSMTDR4qCOYy15HSVmrJs4ddx3Dp8wDRpWhvQQKYfGjvTGJCS4rK8nvPDhvt9WfADPwlUE4etx5ROpFv/6A55950mYkn+zxMv45etLpCB/esw5NGjm3Vy77gEnX+lyQIua2xFOM+hNghg8fjp17Djhl2aolc9C1i21A1x9//h3jJn3jNO+EsaPwocWFgT3isg+Y8hXGatzv51uyTz75GGvWb3E66Teu+h0dLYIlFRNfuapCs7bOgzG1a9MCW9ezKI+OU5kHTPkZxnrw72fAfP3VFPy+yK42k7mTOzf+idYt7cfB7PBkH6cmzsz/29ULhxAe5thlT5kHjOV0SUzKfp6CLwkMAnIjJjLcyo3bRZV6Kk8xxpyPIjsmqiQgYkKS5jpAzfauBFzP6Miw9Z5urdzN709bsjmzZ+K7mb84ZdWBnavR9MFGdmm+/XE+Jn7pXOy2cP536NnD8UrkX4BRaSZQSieauUnIphhl+LNWoFJpFlFKSy7yCYmLUYabRyBBpdkISp8pzkMImRitDP/c3QnvaT5/AsyyJQswYcq3Tll29O+NaBht/45HyLZs0Et9MOvbSQ7r8DfArKOUPm/BjSkxkRFWl++JKvUuSvF4CSCwO1oZ0aX4e0KSmmn2fWoBmPXRynAf2ymW9MCfALNt8zqMGD3BKWDOHt2BKKVj36+du/XD8VNnHZZRu2YNnD+xqxwwjAOJKvU1SlHiDYGgT4wywspZb8I19QUQlBhPULokJqqCecVJUKl7g8JkocS0zQiSopURUZ6uFO7m9yfA/HtoL14Z8r5TViWe2Y9qVR2HUftp7kJ84iLGjLNVqsysMKcTk2s3i67t0KXIheTsSlJK0yilJRqVFPVjoiIuW59z1Ew5q8T9EsE3McoI85km4Zq6HgjMvn4IIVRPSJVGtcMy3J30nuTzJ8AkXjiJZ3uXRD+2xzdV/BGEhzsO1JlyMxWNHnncqRDzmymfYuhg+9pS3gKMq/kqZE54pBp85sy1CjRIEmww2BfnKoKC23NEsrzk/IKc/PycRjzTzrudQoLCAi3BwH6mlH6eV5Bjjo3HEUIUitALoDBfpfDU0C+/IM+5gEAIB9ygCVGEXXeUrawpX2bcvIx2jzuPHJ167SQCA5yHZevR9w3s+9uxy9mnn+qMZQtYyFPb5Awwaek3BcUBkEg4jhQY8po2jcpyY8gtprAnuV3kTVCpPwKFOcgkIdgbrYzobJntokrTgKfUKjY4B/RvEBlRAjTT1m4Ppehk0fIxMcoI51KxO9Q3f1phaFEmHmhuNWQ2XNWknHMYpq+YePGytXhnpPkYalNGSEgwkuIOQyq11V721grjjeng0QrjqgGJKs0SSqmF/ynyfUxk+CjLfAlJWR0BYmWFKZVyHevVDPvbmk7zHUBHFv9GCPkzWhkuWOPZVVvFPPcnwFQI5lE1qrlD9jA1/bSkUy7Zl52TiwYPdkBhUZFD2u0blqBta9u6/AcwSZrzFNR8PcxR8mqDqHCm2m9O8Uma/gTUKjY4R0h0A2W4lcbfxWuaQTyhC8yAAbkQHRne2OVI3QECfwIME7pWr9sC+QUFdjkZFhqK5MR/BHH5taEfOtUa+GT0u/hk9Ds2ZfkFYG7coIo8gyabUpiDHUqItGl9ZYjV/WJikmYUBbW66A+RhgfXrEmsLJsuqXIfMlD9mZIVBoZgSXhYaTpBI+chkb8BpknLJ6BKvmGXa1WrVMbFs/sFcXT7rv3o8/Iwh7SO1GT8AjCJydmPUp4/ZMGdwmhleCghRG+11VKpp4HiI4vfNDGRETbG4JRSaaJKk8Ni9ZhBw3HtomuHHRY0Wl4kEgsYL1bt9aJcWVyyCnv1HYBz5+x78K9Zswb27NwqqF16gwGxnZ9Eerr9y01mffnv4QNQKIIElceIfKl0y+q7Y2eY+CTNOwS05NqDkKMxyvDWpTmRqNIsppRanEXIhRgHW60ElYb5I21VXAYFGd4wMtxzTwqCh8dE6G+AGfzW2zhwwPLdV8KwunXqYOtm4VpKX0+bjt//cKxs+cu8n9Gh/WOCR6TMACZRlT2PUr7E0Jtw82KUYUNLcyL+mno3ISi5hiFkV4wy/Al7HEtQZc8F5d8q2ZZx86OVYebvgrnsIaG/Aeaj/43Fhr/smxs3bBiDDWtXCubohbg49OzVzyH9kMGv46MPzXc7LsstO4BJ0hyloC3Nkxt4JzoyYnZpDiRcU8eBwOxTlFK6uGFUhVfscSoxSf02BcwrCgE5Fh0Zbl5xXHLXSwRiAXM/ayuztn88/mv8PM/qrsbMyRbNH8KeLVYSAJdcZnKd/87H26Vr3uxB7NtmrR1d5s8w7LxxUZWdQ0Etzhvk0eja4TaSq4Qko4cFs5iYI9y0Bsqw/9kFTLKmLeWp+cxCQAobKMNszkUuR8xDAn8DzLTv5mDy1B/tcq1d25bYus4+mByxedacBRg7cardxxzH4VrcYSt1/zIPmMuqzKZ6ylnatRpCpPlhNWvWtLr5unmTBmdrNbmWnCOUjIqOCv/eHjdv3LihyNUrspmzjOLnUsI3q6esaL498xALgrL7G2B+W7gcI8fYVw5/PPYxrFvO3DcIT2npGWj4cGfo9Vb3P+YCmMSfSf6LU5kHTPy17FcJ4f8o2Y6R89GR4Taepy+pNNEGShOsAYN+0VERDi2WEpM05yioWf5CKfdaw6gws3xG+LC5T+lvgNmwaQcGDravgNm9a2csX2hfpcUZh/u/+i42b9ttl2T40Ffx1eclm4wyD5jEJM131FoqvyRaGW7tuMqo7pIVSynZa8k1Cr5jw8iKVlJ+y+elb9UIyPfRpbQH3IeCsJz+BphDR46jW0+7x0qj4RczABObNm7ZhZdef89uNmaMxozS/GaFSVSp91KKWAtufBQTGTG9NHcuXtf05w3WUn4CNIiOjHAYhTQhST0agFmHjBDsi1ZGlOiYiR05N+j9DTDxiZfRqoOVzZ+Za/369MD8WfbPI85Yq9Pp0fDhTmDumEondo5hZssRtzWgy/QKw1T5L6o0WZbq+pTiiYZRETYWQolJ2R9Q8DMsGRakDFcoCbGvhwEg/pq6CyEwO7MigKaBMrwCU/l3Y+67lcXfAMNC9tVp1M4ur159uQ9mznBsLemMwWMnTMOsueaduxXp0j9m4ZluJpvCMg2YxCR1fQqY9cDYRA4MC6usDCc2r5KEJDVbKdiKUZzUMZERFZwxWaXSVCwE0i1tbFytSm6hwkkmR4Cxp9rPirnfr5WZM75KymYwGGw99Qr1XmmPnefjEtG2k6UxbgmV5TmmbAMmWd2H8jBLsgjBtWhlhN1wuglJmiWAlTbz+Rg7lwOlmZ2oUl+lFGaLS8Khb3TtCLNFprcBUro8fwMM6z/zYpmaZutc/L23X8eUCZaaTeK437l7Pxw/aWu+3Oyhxvh7h2lIyzZgktRTKGCOY0kI1kUrI+xaICUkqZl715LzB8WumKgIu1J+y2FIVKnXUgqzTT8BvoyOjHBsbCFuDF1SiwWMywLvIoEQXTLWvB49+yAhwcpsydjqYUOHYNT79g/vQrq1bPkqTPj8CxtSdo759/DfCA1lLrcdp/te0p+g0myCRWhx5jGmYVQFu5f4CSpNHCg1S/kJIYuileGDXDE6/lrWBOY5xkxHyOYYZbjZq4yr/J4+90fAvPbGWzh8xFaNf8S772D4OzYaT4JZnJubi/Ydu9gNqTF39kx0irX1qGlZuM8Bc+PGZa86k8jVVzwGwOwRQQLD4CCpxq5LkFxDxXOgCC5mAOEwO5jLdHnlUqAP72KA5FcLxqWHSDPNajiCR8tNwlx9xav2sjo6w9ymTeCobjTR3bpjQlaDvLbddjnrptAV5oPRH2PTZlsPmLVrVv1q7+bf57rJSmO2Zu36TM3LLzArmAVWqo+qD/dD96c6Y1T3CiASx/F1JNpku9t9T9rjLO8d01a+Uw0uL/fucCCoSqPvCYGN9JJS8n5B2nn7ejMCmxpUpUl7TsL9HRHdBVWbD0CYspXRNZA+Lz394IQq91SI4HLACBxUfydTVGs8FpROseUDHZafGufRCtNxOh1nyM+YKFVUMqs86fLSaW7y0U1n5j/teahlLw5eOWC8yMyyXJSiWqMhoLBRGiOUvpaXFueRalLsdPongAGMfwUZl6G4sARtcw4e/XrXNhv7qbvN43sCMGcSUyy1Asw8aRpdw+gcw9FzMcwrLktMnnLaEg4oqjV8DpSzsRSjPAYUpF9Y5gmvOs2gbXke069tm8A9l7enaYNQWXCAhKMNK4ZFdl6yxqHfO0/qdDfvPQEYdxtfns93HIj9xpBm0BVUpgYteH0ReL0W1FAEWXDl/w5+VvEhIS1JSbli98VYnLdGjbr7furWZVGYXDawYlAAgmTSMY8vXn1XXGk56k+ZBYw3ViV7TLvXVipXk1DIRHZGwyYxex47nf4LwJ6xXuK+0cR5CDERjdjzWs8IXsvdvJRTGDDt7HXt9QLtmIJbF34QUcQdJS2zgLmjXPPHwmu2UCj0+SxYr1XiCN8l91a8fT19kXwqBv9Xg975fuHZaw9reZN6YLWqlfYe2rGoRO4motxiwIvI4pS0HDDe4qSflDPrqS5aA6UyAtAR23dz3u52gyffH3vj9HYWrcE0Nyl0lCOjC255dnXtrXaWA8ZbnPSTcna/3PsyBa0LILPLkjWVvN3tyk2emp+fljTEVC5N43j0zU2Ps/KM6u06xZRXDhgx3Cqnxe6Xe12gYKFJSF6XJaudK3qJ5xdRVG3ETNvZJcI5nqPPFt6ME629IL5a4TnKNGAopfLkbIRIDAgBj2BQnUJPiUIqQRD7JNSgAIgCBIGUkkCOIIAHH0gIFwBKAkH5QEogJwRyUCKn4OWEcDJCIQeBnFLIACoFAfOgLQX7TnH7O5UCHAdQCQjhQKkEIKbvAGf8m4DAFAqEEGIcCnLbbMH4m3FDAtDbtj70dtADCmb7w/6B8gB4gBiMfxNiAGW/se8sogLRg0IPYvyvA2D6DqIn7DuFlhJoKeV1BJwWhGophZZQaEG4QhBaSClfxIEr/HbR1mZrli2unp/8X6tcHW92bhJdv/6cLRvW/AIiyweHPIMEubXDkEsI0QqfhibK4KqNXqEA86hxOF9X1B1Zl5mDlHsq3dOASU2lIQYZKuv0usrgSCUJIRUBvgLlSQVKEMGBhPOgEaB8OEDCKBBGYAyJEUKBEAI2ocuTOxw4dfoMzp0/j/j4RJw5+x/i4uJZGBKbotq0boWFf9jGwKSAjgDMwUkuBXIIkA3QbBBOw4GoeVANoVATjmYBXJaB0syWrR79SSaX33rhuef7zpr2P/u+ad3pjBfz3BXAUEq5lCzUNhj0dQmhUQBRArQWBalBCGoAtBqlqAZAuM9QLzKlvCjgzaHDceCgydslc+Eqk8nNoSiYIRn7r9PpUCEiAn/vMxvAepN1BYTgFkBuUYoUApoCEBYcWEUpuSaRSK/UqIBkQghbZX2W7jhgKKWylCx9WwOPdoTQhylIE0IRbemzzGe9La+oTHGA+aWjBIkE9Byl5JSEw6EaFaRHCCFs+3lH0h0FTHK6bjIFhoNtm8pTOQd8wgGiJsBPtSvLrAIPe6vqOw8YguGg5YDx1oCVl+OCA4SoCb1PAcO6Zt6SAe0IpQ9TigcBRANwHhSxfGaUc8A1B1g4s0RC8B8l5JQE9/mWzFF/iw/9hOjrGkCiYKDmQz9AaxKCqpSSagAtP/S7njRllIIUEELZgT+VgqZwIDeMh34JUUlAr1FaRg/9noxm8bUy1esq6+1cK5vORiS8/FrZEy7fmbzOrpUBqgGImhCoCUqulaU8zSBSWbpEh/SqVYmVz+0700rxpd7RM4z45ng3hz3BJSREoadQSDkSZKBQgPIKUAeCS8IHMiElE16aBZeAnICTWQouCYHUJMQ0Ci9vCy6JlIJKOJOAkqNMcGkrwCTMFJdYCCwtBZilBZbsO5NWwiQPoaUFlsQouGQSS8oTkzCzRHAJGIWVtLTgEryOAtpiwSUTWjJhJqi14JKnKCKEFoKgEITLlxDk63laICXIh4Hme0Nw6d3RvzOl/R8AdGoXzom1qQAAAABJRU5ErkJggg=="},68535:function(Dt,Ze,ee){"use strict";ee.d(Ze,{ZP:function(){return Hn}});const N=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},ye=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Ne},Ne=Number.MAX_SAFE_INTEGER||9007199254740991;let oe=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}({}),V=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 ge={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ne={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 D(a,e,t){return(e=O(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function g(){return g=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},g.apply(null,arguments)}function x(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 y(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?x(Object(t),!0).forEach(function(i){D(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):x(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}function b(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 O(a){var e=b(a,"string");return typeof e=="symbol"?e:e+""}class P{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=F,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 F=function(){},S={trace:F,debug:F,log:F,warn:F,info:F,error:F};function L(){return g({},S)}function j(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):F}function K(a,e,t){return e[a]?e[a].bind(e):j(a,t)}const J=L();function ie(a,e,t){const i=L();if(typeof console=="object"&&a===!0||typeof a=="object"){const n=["debug","log","info","warn","error"];n.forEach(s=>{i[s]=K(s,a,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.11`)}catch(s){return L()}n.forEach(s=>{J[s]=K(s,a)})}else g(J,i);return i}const W=J;function te(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function fe(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function me(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 Pe(a,e=!1){if(typeof TextDecoder!="undefined"){const u=new TextDecoder("utf-8").decode(a);if(e){const c=u.indexOf("\0");return c!==-1?u.substring(0,c):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 M(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 A(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function C(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var U={exports:{}},Y;function B(){return Y||(Y=1,function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(h,u,c){if(c=c||{},h=h.trim(),u=u.trim(),!u){if(!c.alwaysNormalize)return h;var f=o.parseURL(h);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 c.alwaysNormalize?(d.path=o.normalizePath(d.path),o.buildURLFromParts(d)):u;var m=o.parseURL(h);if(!m)throw new Error("Error trying to parse base URL.");if(!m.netLoc&&m.path&&m.path[0]!=="/"){var v=n.exec(m.path);m.netLoc=v[1],m.path=v[2]}m.netLoc&&!m.path&&(m.path="/");var w={scheme:m.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(w.netLoc=m.netLoc,d.path[0]!=="/"))if(!d.path)w.path=m.path,d.params||(w.params=m.params,d.query||(w.query=m.query));else{var T=m.path,k=T.substring(0,T.lastIndexOf("/")+1)+d.path;w.path=o.normalizePath(k)}return w.path===null&&(w.path=c.alwaysNormalize?o.normalizePath(d.path):d.path),o.buildURLFromParts(w)},parseURL:function(h){var u=i.exec(h);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(h){for(h=h.split("").reverse().join("").replace(s,"");h.length!==(h=h.replace(r,"")).length;);return h.split("").reverse().join("")},buildURLFromParts:function(h){return h.scheme+h.netLoc+h.path+h.params+h.query+h.fragment}};a.exports=o})()}(U)),U.exports}var E=B();class _{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 R={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class q{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,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={[R.AUDIO]:null,[R.VIDEO]:null,[R.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 _),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=E.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[R.AUDIO]=null,e[R.VIDEO]=null,e[R.AUDIOVIDEO]=null}}function Te(a){return a.sn!=="initSegment"}class Re extends q{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(N(e)&&N(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1){const n=this._decryptdata=this.levelkeys[i[0]]||null;if(n)return n.getDecryptData(this.sn)}}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=N(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const 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(!N(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return Te(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,n,s,r=!1){const{elementaryStreams:o}=this,h=o[e];if(!h){o[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:s,partial:r};return}h.startPTS=Math.min(h.startPTS,t),h.endPTS=Math.max(h.endPTS,i),h.startDTS=Math.min(h.startDTS,n),h.endDTS=Math.max(h.endDTS,s)}}class Je extends q{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 He(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||He(t,e)}}function yt(a,e){const t=He(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const tt=Math.pow(2,32)-1,Ke=[].push,Mt={video:1,audio:2,id3:3,text:4};function $e(a){return String.fromCharCode.apply(null,a)}function pt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function Oe(a,e){const t=de(a,e);return t<0?4294967296+t:t}function wt(a,e){let t=Oe(a,e);return t*=Math.pow(2,32),t+=Oe(a,e+4),t}function de(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function Ee(a){const e=a.byteLength;for(let t=0;t<e;){const i=Oe(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 Q(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const s=Oe(a,n),r=$e(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 h=Q(a.subarray(n+8,o),e.slice(1));h.length&&Ke.apply(t,h)}n=o}return t}function Le(a){const e=[],t=a[0];let i=8;const n=Oe(a,i);i+=4;let s=0,r=0;t===0?(s=Oe(a,i),r=Oe(a,i+4),i+=8):(s=wt(a,i),r=wt(a,i+8),i+=16),i+=2;let o=a.length+r;const h=pt(a,i);i+=2;for(let u=0;u<h;u++){let c=i;const f=Oe(a,c);c+=4;const d=f&2147483647;if((f&2147483648)>>>31===1)return W.warn("SIDX has hierarchical references (not supported)"),null;const v=Oe(a,c);c+=4,e.push({referenceSize:d,subsegmentDuration:v,info:{duration:v/n,start:o,end:o+d-1}}),o+=d,c+=4,i=c}return{earliestPresentationTime:s,timescale:n,version:t,referencesCount:h,references:e}}function Ce(a){const e=[],t=Q(a,["moov","trak"]);for(let n=0;n<t.length;n++){const s=t[n],r=Q(s,["tkhd"])[0];if(r){let o=r[0];const h=Oe(r,o===0?12:20),u=Q(s,["mdia","mdhd"])[0];if(u){o=u[0];const c=Oe(u,o===0?12:20),f=Q(s,["mdia","hdlr"])[0];if(f){const d=$e(f.subarray(8,12)),m={soun:R.AUDIO,vide:R.VIDEO}[d],v=Q(s,["mdia","minf","stbl","stsd"])[0],w=Ve(v);m?(e[h]={timescale:c,type:m,stsd:w},e[m]=y({timescale:c,id:h},w)):e[h]={timescale:c,type:d,stsd:w}}}}}return Q(a,["moov","mvex","trex"]).forEach(n=>{const s=Oe(n,4),r=e[s];r&&(r.default={duration:Oe(n,12),flags:Oe(n,20)})}),e}function Ve(a){const e=a.subarray(8),t=e.subarray(86),i=$e(e.subarray(4,8));let n=i,s;const r=i==="enca"||i==="encv";if(r){const u=Q(e,[i])[0].subarray(i==="enca"?28:78);Q(u,["sinf"]).forEach(f=>{const d=Q(f,["schm"])[0];if(d){const m=$e(d.subarray(4,8));if(m==="cbcs"||m==="cenc"){const v=Q(f,["frma"])[0];v&&(n=$e(v))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const h=Q(t,["avcC"])[0];h&&h.length>3&&(n+="."+De(h[1])+De(h[2])+De(h[3]),s=G(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const h=Q(e,[i])[0],u=Q(h.subarray(28),["esds"])[0];if(u&&u.length>7){let c=4;if(u[c++]!==3)break;c=we(u,c),c+=2;const f=u[c++];if(f&128&&(c+=2),f&64&&(c+=u[c++]),u[c++]!==4)break;c=we(u,c);const d=u[c++];if(d===64)n+="."+De(d);else break;if(c+=12,u[c++]!==5)break;c=we(u,c);const m=u[c++];let v=(m&248)>>3;v===31&&(v+=1+((m&7)<<3)+((u[c]&224)>>5)),n+="."+v}break}case"hvc1":case"hev1":{const h=Q(t,["hvcC"])[0];if(h&&h.length>12){const u=h[1],c=["","A","B","C"][u>>6],f=u&31,d=Oe(h,2),m=(u&32)>>5?"H":"L",v=h[12],w=h.subarray(6,12);n+="."+c+f,n+="."+ae(d).toString(16).toUpperCase(),n+="."+m+v;let T="";for(let k=w.length;k--;){const X=w[k];(X||T)&&(T="."+X.toString(16).toUpperCase()+T)}n+=T}s=G(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=G(n,t)||n;break}case"vp09":{const h=Q(t,["vpcC"])[0];if(h&&h.length>6){const u=h[4],c=h[5],f=h[6]>>4&15;n+="."+ke(u)+"."+ke(c)+"."+ke(f)}break}case"av01":{const h=Q(t,["av1C"])[0];if(h&&h.length>2){const u=h[1]>>>5,c=h[1]&31,f=h[2]>>>7?"H":"M",d=(h[2]&64)>>6,m=(h[2]&32)>>5,v=u===2&&d?m?12:10:d?10:8,w=(h[2]&16)>>4,T=(h[2]&8)>>3,k=(h[2]&4)>>2,X=h[2]&3;n+="."+u+"."+ke(c)+f+"."+ke(v)+"."+w+"."+T+k+X+"."+ke(1)+"."+ke(1)+"."+ke(1)+"."+0,s=G("dav1",t)}break}}return{codec:n,encrypted:r,supplemental:s}}function G(a,e){const t=Q(e,["dvvC"]),i=t.length?t[0]:Q(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return a+"."+ke(n)+"."+ke(s)}}function ae(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function we(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function De(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function ke(a){return(a<10?"0":"")+a}function je(a,e){if(!a||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&Q(a,["moov","trak"]).forEach(n=>{const r=Q(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=Q(r,["enca"]);const h=o.length>0;h||(o=Q(r,["encv"])),o.forEach(u=>{const c=h?u.subarray(28):u.subarray(78);Q(c,["sinf"]).forEach(d=>{const m=ut(d);if(m){const v=m.subarray(8,24);v.some(w=>w!==0)||(W.log(`[eme] Patching keyId in 'enc${h?"a":"v"}>sinf>>tenc' box: ${M(v)} -> ${M(t)}`),m.set(t,8))}})})})}function ut(a){const e=Q(a,["schm"])[0];if(e){const t=$e(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Q(a,["schi","tenc"])[0]}return null}function Qe(a,e,t){const i={},n=Q(a,["moof","traf"]);for(let s=0;s<n.length;s++){const r=n[s],o=Q(r,["tfhd"])[0],h=Oe(o,4),u=e[h];if(!u)continue;i[h]||(i[h]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});const c=i[h],f=Q(r,["tfdt"])[0];if(f){const H=f[0];let ue=Oe(f,4);H===1&&(ue===tt?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(ue*=tt+1,ue+=Oe(f,8))),N(ue)&&(!N(c.start)||ue<c.start)&&(c.start=ue)}const d=u.default,m=Oe(o,0)|(d==null?void 0:d.flags);let v=(d==null?void 0:d.duration)||0;m&8&&(m&2?v=Oe(o,12):v=Oe(o,8));const w=Q(r,["trun"]);let T=c.start||0,k=0,X=v;for(let H=0;H<w.length;H++){const ue=w[H],ve=Oe(ue,4),Ie=c.sampleCount;c.sampleCount+=ve;const ce=ue[3]&1,Se=ue[3]&4,Ae=ue[2]&1,pe=ue[2]&2,Fe=ue[2]&4,lt=ue[2]&8;let mt=8,Tt=ve;for(ce&&(mt+=4),Se&&ve&&(!(ue[mt+1]&1)&&c.keyFrameIndex===void 0&&(c.keyFrameIndex=Ie),mt+=4,Ae?(X=Oe(ue,mt),mt+=4):X=v,pe&&(mt+=4),lt&&(mt+=4),T+=X,k+=X,Tt--);Tt--;)Ae?(X=Oe(ue,mt),mt+=4):X=v,pe&&(mt+=4),Fe&&(ue[mt+1]&1||c.keyFrameIndex===void 0&&(c.keyFrameIndex=c.sampleCount-(Tt+1),c.keyFrameStart=T),mt+=4),lt&&(mt+=4),T+=X,k+=X;!k&&v&&(k+=v*ve)}c.duration+=k}if(!Object.keys(i).some(s=>i[s].duration)){let s=1/0,r=0;const o=Q(a,["sidx"]);for(let h=0;h<o.length;h++){const u=Le(o[h]);if(u!=null&&u.references){s=Math.min(s,u.earliestPresentationTime/u.timescale);const c=u.references.reduce((f,d)=>f+d.info.duration||0,0);r=Math.max(r,c+u.earliestPresentationTime/u.timescale)}}r&&N(r)&&Object.keys(i).forEach(h=>{i[h].duration||(i[h].duration=r*i[h].timescale-i[h].start)})}return i}function qe(a){const e={valid:null,remainder:null},t=Q(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 Ue(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function dt(a,e){const t=[],i=e.samples,n=e.timescale,s=e.id;let r=!1;return Q(i,["moof"]).map(h=>{const u=h.byteOffset-8;Q(h,["traf"]).map(f=>{const d=Q(f,["tfdt"]).map(m=>{const v=m[0];let w=Oe(m,4);return v===1&&(w*=Math.pow(2,32),w+=Oe(m,8)),w/n})[0];return d!==void 0&&(a=d),Q(f,["tfhd"]).map(m=>{const v=Oe(m,4),w=Oe(m,0)&16777215,T=(w&1)!==0,k=(w&2)!==0,X=(w&8)!==0;let H=0;const ue=(w&16)!==0;let ve=0;const Ie=(w&32)!==0;let ce=8;v===s&&(T&&(ce+=8),k&&(ce+=4),X&&(H=Oe(m,ce),ce+=4),ue&&(ve=Oe(m,ce),ce+=4),Ie&&(ce+=4),e.type==="video"&&(r=ht(e.codec)),Q(f,["trun"]).map(Se=>{const Ae=Se[0],pe=Oe(Se,0)&16777215,Fe=(pe&1)!==0;let lt=0;const mt=(pe&4)!==0,Tt=(pe&256)!==0;let _t=0;const st=(pe&512)!==0;let bt=0;const ft=(pe&1024)!==0,xt=(pe&2048)!==0;let Ot=0;const rt=Oe(Se,4);let at=8;Fe&&(lt=Oe(Se,at),at+=4),mt&&(at+=4);let Nt=lt+u;for(let Zt=0;Zt<rt;Zt++){if(Tt?(_t=Oe(Se,at),at+=4):_t=H,st?(bt=Oe(Se,at),at+=4):bt=ve,ft&&(at+=4),xt&&(Ae===0?Ot=Oe(Se,at):Ot=de(Se,at),at+=4),e.type===R.VIDEO){let Ut=0;for(;Ut<bt;){const zt=Oe(i,Nt);if(Nt+=4,et(r,i[Nt])){const ki=i.subarray(Nt,Nt+zt);_e(ki,r?2:1,a+Ot/n,t)}Nt+=zt,Ut+=zt+4}}a+=_t/n}}))})})}),t}function ht(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function et(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=it(a);let s=0;s+=e;let r=0,o=0,h=0;for(;s<n.length;){r=0;do{if(s>=n.length)break;h=n[s++],r+=h}while(h===255);o=0;do{if(s>=n.length)break;h=n[s++],o+=h}while(h===255);const u=n.length-s;let c=s;if(o<u)s+=o;else if(o>u){W.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(n[c++]===181){const d=pt(n,c);if(c+=2,d===49){const m=Oe(n,c);if(c+=4,m===1195456820){const v=n[c++];if(v===3){const w=n[c++],T=31&w,k=64&w,X=k?2+T*3:0,H=new Uint8Array(X);if(k){H[0]=w;for(let ue=1;ue<X;ue++)H[ue]=n[c++]}i.push({type:v,payloadType:r,pts:t,bytes:H})}}}}}else if(r===5&&o>16){const f=[];for(let v=0;v<16;v++){const w=n[c++].toString(16);f.push(w.length==1?"0"+w:w),(v===3||v===5||v===7||v===9)&&f.push("-")}const d=o-16,m=new Uint8Array(d);for(let v=0;v<d;v++)m[v]=n[c++];i.push({payloadType:r,pts:t,uuid:f.join(""),userData:Pe(m),userDataBytes:m})}}}function it(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 We(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,h=0,u=0;if(e===0){for(;$e(a.subarray(u,u+1))!=="\0";)t+=$e(a.subarray(u,u+1)),u+=1;for(t+=$e(a.subarray(u,u+1)),u+=1;$e(a.subarray(u,u+1))!=="\0";)i+=$e(a.subarray(u,u+1)),u+=1;i+=$e(a.subarray(u,u+1)),u+=1,n=Oe(a,12),s=Oe(a,16),o=Oe(a,20),h=Oe(a,24),u=28}else if(e===1){u+=4,n=Oe(a,u),u+=4;const f=Oe(a,u);u+=4;const d=Oe(a,u);for(u+=4,r=el(2,32)*f+d,ye(r)||(r=Number.MAX_SAFE_INTEGER,W.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Oe(a,u),u+=4,h=Oe(a,u),u+=4;$e(a.subarray(u,u+1))!=="\0";)t+=$e(a.subarray(u,u+1)),u+=1;for(t+=$e(a.subarray(u,u+1)),u+=1;$e(a.subarray(u,u+1))!=="\0";)i+=$e(a.subarray(u,u+1)),u+=1;i+=$e(a.subarray(u,u+1)),u+=1}const c=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:i,timeScale:n,presentationTime:r,presentationTimeDelta:s,eventDuration:o,id:h,payload:c}}function Be(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 At(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),Be([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t)}const vt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),nt={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 It(a,e){const t=nt[e];return!!t&&!!t[a.slice(0,4)]}function Bt(a,e,t=!0){return!a.split(",").some(i=>!Et(i,e,t))}function Et(a,e,t=!0){var i;const n=te(t);return(i=n==null?void 0:n.isTypeSupported(ei(a,e)))!=null?i:!1}function ei(a,e){return`${e}/mp4;codecs=${a}`}function be(a){if(a){const e=a.substring(0,4);return nt.video[e]}return 2}function le(a){const e=vt();return a.split(",").reduce((t,i)=>{const s=e&&ht(i)?9:nt.video[i];return s?(s*2+t)/(t?3:2):(nt.audio[i]+t)/(t?2:1)},0)}const he={};function I(a,e=!0){if(he[a])return he[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(Et(t[n],"audio",e))return he[a]=t[n],t[n];if(t[n]==="mp3"&&(i=te(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const $=/flac|opus|mp4a\.40\.34/i;function Z(a,e=!0){return a.replace($,t=>I(t.toLowerCase(),e))}function se(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)It(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function re(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(Ge(a,"audio")||Ge(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 Ge(a,e){return It(a,e)&&Et(a,e)}function ze(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 ot(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 ct(a){const e=te(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 Ct(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Yt={supported:!0,powerEfficient:!0,smooth:!0},Ft={supported:!1,smooth:!1,powerEfficient:!1},St={supported:!0,configurations:[],decodingInfoResults:[Yt]};function li(a,e){return{supported:!1,configurations:e,decodingInfoResults:[Ft],error:a}}function yi(a,e,t,i,n,s){const r=a.videoCodec,o=a.audioCodec?a.audioGroups:null,h=s==null?void 0:s.audioCodec,u=s==null?void 0:s.channels,c=u?parseInt(u):h?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,m)=>{if(m){const v=e.groups[m];if(!v)throw new Error(`Audio track group ${m} not found`);Object.keys(v.channels).forEach(w=>{d[w]=(d[w]||0)+v.channels[w]})}return d},{2:0})}catch(d){return!0}return r!==void 0&&(r.split(",").some(d=>ht(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&&N(c)&&Object.keys(f).some(d=>parseInt(d)>c)}function ci(a,e,t,i={}){const n=a.videoCodec;if(!n&&!a.audioCodec||!t)return Promise.resolve(St);const s=[],r=ai(a),o=r.length,h=Xe(a,e,o>0),u=h.length;for(let c=o||1*u||1;c--;){const f={type:"media-source"};if(o&&(f.video=r[c%o]),u){f.audio=h[c%u];const d=f.audio.bitrate;f.video&&d&&(f.video.bitrate-=d)}s.push(f)}if(n){const c=navigator.userAgent;if(n.split(",").some(f=>ht(f))&&vt())return Promise.resolve(li(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${c})`),s))}return Promise.all(s.map(c=>{const f=$t(c);return i[f]||(i[f]=t.decodingInfo(c))})).then(c=>({supported:!c.some(f=>!f.supported),configurations:s,decodingInfoResults:c})).catch(c=>({supported:!1,configurations:s,decodingInfoResults:[],error:c}))}function ai(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),i=Pt(a),n=a.width||640,s=a.height||480,r=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(h=>{const u={contentType:ei(ot(h),"video"),width:n,height:s,bitrate:i,framerate:r};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function Xe(a,e,t){var i;const n=(i=a.audioCodec)==null?void 0:i.split(","),s=Pt(a);return n&&a.audioGroups?a.audioGroups.reduce((r,o)=>{var h;const u=o?(h=e.groups[o])==null?void 0:h.tracks:null;return u?u.reduce((c,f)=>{if(f.groupId===o){const d=parseFloat(f.channels||"");n.forEach(m=>{const v={contentType:ei(m,"audio"),bitrate:t?Ye(m,s):s};d&&(v.channels=""+d),c.push(v)})}return c},r):r},[]):[]}function Ye(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 Pt(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function $t(a){let e="";const{audio:t,video:i}=a;if(i){const n=Ct(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=Ct(t.contentType);e+=`${i?"_":""}${n}_c${t.channels}`}return e}const Ht=["NONE","TYPE-0","TYPE-1",null];function qt(a){return Ht.indexOf(a)>-1}const Ei=["SDR","PQ","HLG"];function _i(a){return!!a&&Ei.indexOf(a)>-1}var ti={No:"",Yes:"YES",v2:"v2"};function bi(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?ti.v2:ti.Yes:ti.No}class Gt{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 xi{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 ii(this._audioGroups,e)}hasSubtitleGroup(e){return ii(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 ii(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function bn(){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 Kt(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||Ei.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&bn(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Vt=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}},kt=(a,e)=>JSON.stringify(a,Vt(e));function gi(a,e,t,i,n){const s=Object.keys(a),r=i==null?void 0:i.channels,o=i==null?void 0:i.audioCodec,h=n==null?void 0:n.videoCodec,u=r&&parseInt(r)===2;let c=!1,f=!1,d=1/0,m=1/0,v=1/0,w=1/0,T=0,k=[];const{preferHDR:X,allowedVideoRanges:H}=Kt(e,n);for(let Se=s.length;Se--;){const Ae=a[s[Se]];c||(c=Ae.channels[2]>0),d=Math.min(d,Ae.minHeight),m=Math.min(m,Ae.minFramerate),v=Math.min(v,Ae.minBitrate),H.filter(Fe=>Ae.videoRanges[Fe]>0).length>0&&(f=!0)}d=N(d)?d:0,m=N(m)?m:0;const ue=Math.max(1080,d),ve=Math.max(30,m);v=N(v)?v:t,t=Math.max(v,t),f||(e=void 0);const Ie=s.length>1;return{codecSet:s.reduce((Se,Ae)=>{const pe=a[Ae];if(Ae===Se)return Se;if(k=f?H.filter(Fe=>pe.videoRanges[Fe]>0):[],Ie){if(pe.minBitrate>t)return jt(Ae,`min bitrate of ${pe.minBitrate} > current estimate of ${t}`),Se;if(!pe.hasDefaultAudio)return jt(Ae,"no renditions with default or auto-select sound found"),Se;if(o&&Ae.indexOf(o.substring(0,4))%5!==0)return jt(Ae,`audio codec preference "${o}" not found`),Se;if(r&&!u){if(!pe.channels[r])return jt(Ae,`no renditions with ${r} channel sound found (channels options: ${Object.keys(pe.channels)})`),Se}else if((!o||u)&&c&&pe.channels[2]===0)return jt(Ae,"no renditions with stereo sound found"),Se;if(pe.minHeight>ue)return jt(Ae,`min resolution of ${pe.minHeight} > maximum of ${ue}`),Se;if(pe.minFramerate>ve)return jt(Ae,`min framerate of ${pe.minFramerate} > maximum of ${ve}`),Se;if(!k.some(Fe=>pe.videoRanges[Fe]>0))return jt(Ae,`no variants with VIDEO-RANGE of ${kt(k)} found`),Se;if(h&&Ae.indexOf(h.substring(0,4))%5!==0)return jt(Ae,`video codec preference "${h}" not found`),Se;if(pe.maxScore<T)return jt(Ae,`max score of ${pe.maxScore} < selected max of ${T}`),Se}return Se&&(le(Ae)>=le(Se)||pe.fragmentError>a[Se].fragmentError)?Se:(w=pe.minIndex,T=pe.maxScore,Ae)},void 0),videoRanges:k,preferHDR:X,minFramerate:m,minBitrate:v,minIndex:w}}function jt(a,e){W.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function vi(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 Ni(a,e,t,i){return a.slice(t,i+1).reduce((n,s,r)=>{if(!s.codecSet)return n;const o=s.audioGroups;let h=n[s.codecSet];h||(n[s.codecSet]=h={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),h.minBitrate=Math.min(h.minBitrate,s.bitrate);const u=Math.min(s.height,s.width);return h.minHeight=Math.min(h.minHeight,u),h.minFramerate=Math.min(h.minFramerate,s.frameRate),h.minIndex=Math.min(h.minIndex,r),h.maxScore=Math.max(h.maxScore,s.score),h.fragmentError+=s.fragmentError,h.videoRanges[s.videoRange]=(h.videoRanges[s.videoRange]||0)+1,o&&o.forEach(c=>{if(!c)return;const f=e.groups[c];f&&(h.hasDefaultAudio=h.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(d=>{h.channels[d]=(h.channels[d]||0)+f.channels[d]}))}),n},{})}function Bi(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 Ai(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(di(a,n,t))return i}return-1}function di(a,e,t){const{groupId:i,name:n,lang:s,assocLang:r,default:o}=a,h=a.forced;return(i===void 0||e.groupId===i)&&(n===void 0||e.name===n)&&(s===void 0||un(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(h===void 0||e.forced===h)&&(!("characteristics"in a)||Ts(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function un(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function Ts(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function Ji(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 rs(a,e,t,i,n){const s=e[i],o=e.reduce((d,m,v)=>{const w=m.uri;return(d[w]||(d[w]=[])).push(v),d},{})[s.uri];o.length>1&&(i=Math.max.apply(Math,o));const h=s.videoRange,u=s.frameRate,c=s.codecSet.substring(0,4),f=as(e,i,d=>{if(d.videoRange!==h||d.frameRate!==u||d.codecSet.substring(0,4)!==c)return!1;const m=d.audioGroups,v=t.filter(w=>!m||m.indexOf(w.groupId)!==-1);return Ai(a,v,n)>-1});return f>-1?f:as(e,i,d=>{const m=d.audioGroups,v=t.filter(w=>!m||m.indexOf(w.groupId)!==-1);return Ai(a,v,n)>-1})}function as(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 xn(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class en extends P{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:h}=r;if(!n||!h)return;const u=performance.now(),c=s?s.stats:n.stats,f=s?s.duration:n.duration,d=u-c.loading.start,m=r.minAutoLevel,v=n.level,w=this._nextAutoLevel;if(c.aborted||c.loaded&&c.loaded===c.total||v<=m){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const T=w>-1&&w!==v,k=!!t||T;if(!k&&(h.paused||!h.playbackRate||!h.readyState))return;const X=r.mainForwardBufferInfo;if(!k&&X===null)return;const H=this.bwEstimator.getEstimateTTFB(),ue=Math.abs(h.playbackRate);if(d<=Math.max(H,1e3*(f/(ue*2))))return;const ve=X?X.len/ue:0,Ie=c.loading.first?c.loading.first-c.loading.start:-1,ce=c.loaded&&Ie>-1,Se=this.getBwEstimate(),Ae=r.levels,pe=Ae[v],Fe=Math.max(c.loaded,Math.round(f*(n.bitrate||pe.averageBitrate)/8));let lt=ce?d-Ie:d;lt<1&&ce&&(lt=Math.min(d,c.loaded*8/Se));const mt=ce?c.loaded*1e3/lt:0,Tt=H/1e3,_t=mt?(Fe-c.loaded)/mt:Fe*8/Se+Tt;if(_t<=ve)return;const st=mt?mt*8:Se,bt=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,ft=this.hls.config.abrBandWidthUpFactor;let xt=Number.POSITIVE_INFINITY,Ot;for(Ot=v-1;Ot>m;Ot--){const Zt=Ae[Ot].maxBitrate,Ut=!Ae[Ot].details||bt;if(xt=this.getTimeToLoadFrag(Tt,st,f*Zt,Ut),xt<Math.min(ve,f+Tt))break}if(xt>=_t||xt>f*10)return;ce?this.bwEstimator.sample(d-Math.min(H,Ie),c.loaded):this.bwEstimator.sampleTTFB(d);const rt=Ae[Ot].maxBitrate;this.getBwEstimate()*ft>rt&&this.resetEstimator(rt);const at=this.findBestLevel(rt,m,Ot,0,ve,1,1);at>-1&&(Ot=at),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${v} is loading too slowly;
|
|
Fragment duration: ${n.duration.toFixed(3)}
|
|
Time to underbuffer: ${ve.toFixed(3)} s
|
|
Estimated load time for current fragment: ${_t.toFixed(3)} s
|
|
Estimated load time for down switch fragment: ${xt.toFixed(3)} s
|
|
TTFB estimate: ${Ie|0} ms
|
|
Current BW estimate: ${N(Se)?Se|0:"Unknown"} bps
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
Switching to level ${Ot} @ ${rt|0} bps`),r.nextLoadLevel=r.nextAutoLevel=Ot,this.clearTimer();const Nt=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===Ot&&Ot>0){const Zt=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Ot>0?"and switching down":""}
|
|
Fragment duration: ${n.duration.toFixed(3)} s
|
|
Time to underbuffer: ${Zt.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,Ot>m){let Ut=this.findBestLevel(this.hls.levels[m].bitrate,m,Ot,0,Zt,1,1);Ut===-1&&(Ut=m),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Ut,this.resetEstimator(this.hls.levels[Ut].bitrate)}}};T||_t>xt*2?Nt():this.timer=self.setInterval(Nt,xt*1e3),r.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:s,stats:c})},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 V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case V.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,h=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(h-Math.min(f,u),o.loaded)}else this.bwEstimator.sampleTTFB(h)}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;N(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===ne.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,h=(r.loaded?r.loaded.duration:0)+s;r.loaded={bytes:o,duration:h},r.realBitrate=Math.round(8*o/h)}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!==ne.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,h=this.getBwEstimate(),u=this.getStarvationDelay();let c=s.abrBandWidthFactor,f=s.abrBandWidthUpFactor;if(u){const T=this.findBestLevel(h,r,n,u,0,c,f);if(T>=0)return this.rebufferNotice=-1,T}let d=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const T=this.bitrateTestDelay;T&&(d=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-T,this.info(`bitrate test took ${Math.round(1e3*T)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),c=f=1)}const m=this.findBestLevel(h,r,n,u,d,c,f);if(this.rebufferNotice!==m&&(this.rebufferNotice=m,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${m}`)),m>-1)return m;const v=i.levels[r],w=i.loadLevelObj;return w&&(v==null?void 0:v.bitrate)<w.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 h;const u=n+s,c=this.lastLoadedFragLevel,f=c===-1?this.hls.firstLevel:c,{fragCurrent:d,partCurrent:m}=this,{levels:v,allAudioTracks:w,loadLevel:T,config:k}=this.hls;if(v.length===1)return 0;const X=v[f],H=!!((h=this.hls.latestLevelDetails)!=null&&h.live),ue=T===-1||c===-1;let ve,Ie="SDR",ce=(X==null?void 0:X.frameRate)||0;const{audioPreference:Se,videoPreference:Ae}=k,pe=this.audioTracksByGroup||(this.audioTracksByGroup=vi(w));let Fe=-1;if(ue){if(this.firstSelection!==-1)return this.firstSelection;const st=this.codecTiers||(this.codecTiers=Ni(v,pe,t,i)),bt=gi(st,Ie,e,Se,Ae),{codecSet:ft,videoRanges:xt,minFramerate:Ot,minBitrate:rt,minIndex:at,preferHDR:Nt}=bt;Fe=at,ve=ft,Ie=Nt?xt[xt.length-1]:xt[0],ce=Ot,e=Math.max(e,rt),this.log(`picked start tier ${kt(bt)}`)}else ve=X==null?void 0:X.codecSet,Ie=X==null?void 0:X.videoRange;const lt=m?m.duration:d?d.duration:0,mt=this.bwEstimator.getEstimateTTFB()/1e3,Tt=[];for(let st=i;st>=t;st--){var _t;const bt=v[st],ft=st>f;if(!bt)continue;if(k.useMediaCapabilities&&!bt.supportedResult&&!bt.supportedPromise){const Ut=navigator.mediaCapabilities;typeof(Ut==null?void 0:Ut.decodingInfo)=="function"&&yi(bt,pe,Ie,ce,e,Se)?(bt.supportedPromise=ci(bt,pe,Ut,this.supportedCache),bt.supportedPromise.then(zt=>{if(!this.hls)return;bt.supportedResult=zt;const ki=this.hls.levels,Li=ki.indexOf(bt);zt.error?this.warn(`MediaCapabilities decodingInfo error: "${zt.error}" for level ${Li} ${kt(zt)}`):zt.supported?zt.decodingInfoResults.some(Xi=>Xi.smooth===!1||Xi.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Li} not smooth or powerEfficient: ${kt(zt)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Li} ${kt(zt)}`),Li>-1&&ki.length>1&&(this.log(`Removing unsupported level ${Li}`),this.hls.removeLevel(Li),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(zt=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${zt}`)})):bt.supportedResult=St}if((ve&&bt.codecSet!==ve||Ie&&bt.videoRange!==Ie||ft&&ce>bt.frameRate||!ft&&ce>0&&ce<bt.frameRate||(_t=bt.supportedResult)!=null&&(_t=_t.decodingInfoResults)!=null&&_t.some(Ut=>Ut.smooth===!1))&&(!ue||st!==Fe)){Tt.push(st);continue}const xt=bt.details,Ot=(m?xt==null?void 0:xt.partTarget:xt==null?void 0:xt.averagetargetduration)||lt;let rt;ft?rt=o*e:rt=r*e;const at=lt&&n>=lt*2&&s===0?bt.averageBitrate:bt.maxBitrate,Nt=this.getTimeToLoadFrag(mt,rt,at*Ot,xt===void 0);if(rt>=at&&(st===c||bt.loadError===0&&bt.fragmentError===0)&&(Nt<=mt||!N(Nt)||H&&!this.bitrateTestDelay||Nt<u)){const Ut=this.forcedAutoLevel;return st!==T&&(Ut===-1||Ut!==T)&&(Tt.length&&this.trace(`Skipped level(s) ${Tt.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${v[Tt[0]].codecs}" ${v[Tt[0]].videoRange}; not compatible with "${ve}" ${Ie}`),this.info(`switch candidate:${f}->${st} adjustedbw(${Math.round(rt)})-bitrate=${Math.round(rt-at)} ttfb:${mt.toFixed(1)} avgDuration:${Ot.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${Nt.toFixed(1)} firstSelection:${ue} codecSet:${bt.codecSet} videoRange:${bt.videoRange} hls.loadLevel:${T}`)),ue&&(this.firstSelection=st),st}}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 Di={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 Ti(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!N(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 Hi(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)&&Xt(t,i,s)===0||Ui(s,a,Math.min(n,i))))return s;const r=Di.search(e,Xt.bind(null,t,i));return r&&(r!==a||!s)?r:s}function Ui(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 Xt(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 $i(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 Di.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 Wi(a){switch(a.details){case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_TIMEOUT:case V.LEVEL_LOAD_TIMEOUT:case V.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Pi(a,e){const t=Wi(e);return a.default[`${t?"timeout":"error"}Retry`]}function Fn(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function Mn(a){return y(y({},a),{errorRetry:null,timeoutRetry:null})}function Yi(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(Tn(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,s):s}function Tn(a){return Wn(a)||!!a&&(a<400||a>499)}function Wn(a){return a===0&&navigator.onLine===!1}var ui={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},mi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class Yn extends P{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)===ne.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 V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case V.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=tn();return}case V.FRAG_GAP:case V.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ui.SendAlternateToPenaltyBox;return}case V.LEVEL_EMPTY_ERROR:case V.LEVEL_PARSING_ERROR:{var r;const h=t.parent===ne.MAIN?t.level:n.loadLevel;t.details===V.LEVEL_EMPTY_ERROR&&((r=t.context)!=null&&(r=r.levelDetails)!=null&&r.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,h):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,h))}return;case V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.SUBTITLE_LOAD_ERROR:case V.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const h=n.loadLevelObj;if(h&&(s.type===ge.AUDIO_TRACK&&h.hasAudioGroup(s.groupId)||s.type===ge.SUBTITLE_TRACK&&h.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=ui.SendAlternateToPenaltyBox,t.errorAction.flags=mi.MoveAllAlternatesMatchingHost;return}}return;case V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:ui.SendAlternateToPenaltyBox,flags:mi.MoveAllAlternatesMatchingHDCP};return;case V.KEY_SYSTEM_SESSION_UPDATE_FAILED:case V.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case V.KEY_SYSTEM_NO_SESSION:t.errorAction={action:ui.SendAlternateToPenaltyBox,flags:mi.MoveAllAlternatesMatchingKey};return;case V.BUFFER_ADD_CODEC_ERROR:case V.REMUX_ALLOC_ERROR:case V.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:n.loadLevel)}return;case V.INTERNAL_EXCEPTION:case V.BUFFER_APPENDING_ERROR:case V.BUFFER_FULL_ERROR:case V.LEVEL_SWITCH_ERROR:case V.BUFFER_STALLED_ERROR:case V.BUFFER_SEEK_OVER_HOLE:case V.BUFFER_NUDGE_ON_STALL:t.errorAction=tn();return}t.type===oe.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=tn())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,n=Pi(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(Yi(n,s,Wi(e),e.response))return{action:ui.RetryRequest,flags:mi.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=Pi(e.details.startsWith("key")?r:s,e),h=t.levels.reduce((c,f)=>c+f.fragmentError,0);if(n&&(e.details!==V.FRAG_GAP&&n.fragmentError++,Yi(o,h,Wi(e),e.response)))return{action:ui.RetryRequest,flags:mi.None,retryConfig:o,retryCount:h};const u=this.getLevelSwitchAction(e,i);return o&&(u.retryConfig=o,u.retryCount=h),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===V.BUFFER_APPEND_ERROR&&n.fragmentError++;let c=-1;const{levels:f,loadLevel:d,minAutoLevel:m,maxAutoLevel:v}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const w=(s=e.frag)==null?void 0:s.type,k=(w===ne.AUDIO&&u===V.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===V.BUFFER_ADD_CODEC_ERROR||u===V.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:Ie})=>n.audioCodec!==Ie),H=e.sourceBufferName==="video"&&(u===V.BUFFER_ADD_CODEC_ERROR||u===V.BUFFER_APPEND_ERROR)&&f.some(({codecSet:Ie,audioCodec:ce})=>n.codecSet!==Ie&&n.audioCodec===ce),{type:ue,groupId:ve}=(r=e.context)!=null?r:{};for(let Ie=f.length;Ie--;){const ce=(Ie+d)%f.length;if(ce!==d&&ce>=m&&ce<=v&&f[ce].loadError===0){var o,h;const Se=f[ce];if(u===V.FRAG_GAP&&w===ne.MAIN&&e.frag){const Ae=f[ce].details;if(Ae){const pe=Hi(e.frag,Ae.fragments,e.frag.start);if(pe!=null&&pe.gap)continue}}else{if(ue===ge.AUDIO_TRACK&&Se.hasAudioGroup(ve)||ue===ge.SUBTITLE_TRACK&&Se.hasSubtitleGroup(ve))continue;if(w===ne.AUDIO&&(o=n.audioGroups)!=null&&o.some(Ae=>Se.hasAudioGroup(Ae))||w===ne.SUBTITLE&&(h=n.subtitleGroups)!=null&&h.some(Ae=>Se.hasSubtitleGroup(Ae))||k&&n.audioCodec===Se.audioCodec||H&&n.codecSet===Se.codecSet||!k&&n.codecSet!==Se.codecSet)continue}c=ce;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:ui.SendAlternateToPenaltyBox,flags:mi.None,nextAutoLevel:c}}return{action:ui.SendAlternateToPenaltyBox,flags:mi.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ui.DoNothing:break;case ui.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==V.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case ui.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n}=i,s=i.nextAutoLevel;switch(n){case mi.None:this.switchLevel(e,s);break;case mi.MoveAllAlternatesMatchingHDCP:{const h=this.getVariantLevelIndex(e.frag),u=t.levels[h],c=u==null?void 0:u.attrs["HDCP-LEVEL"];if(i.hdcpLevel=c,c){t.maxHdcpLevel=Ht[Ht.indexOf(c)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case mi.MoveAllAlternatesMatchingKey:{const h=e.decryptdata;if(h){const u=this.hls.levels;for(let c=u.length;c--;)if(this.variantHasKey(u[c],h)){var r,o;this.log(`Banned key found in level ${c} (${u[c].bitrate}bps) or audio group "${(r=u[c].audioGroups)==null?void 0:r.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${M(h.keyId||[])}`),u[c].fragmentError++,u[c].loadError++,this.log(`Removing level ${c} with key error (${e.error})`),this.hls.removeLevel(c)}u.length&&(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===V.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=Ct(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 tn(a){const e={action:ui.DoNothing,flags:mi.None};return a&&(e.resolved=!0),e}var Qt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class hn{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 h=o.body;if(h.start<=e&&e<=h.end)return h}}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 h=this.fragments[o];if(!h||r>=h.body.sn)return;if(!h.buffered&&(!h.loaded||s)){h.body.type===i&&this.removeFragment(h.body);return}const u=h.range[e];if(u){if(u.time.length===0){this.removeFragment(h.body);return}u.time.some(c=>{const f=!this.isTimeBuffered(c.startPTS,c.endPTS,t);return f&&this.removeFragment(h.body),f})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,n=Ri(i),s=this.fragments[n];if(!s||s.buffered&&i.gap)return;const r=!i.relurl;Object.keys(t).forEach(o=>{const h=i.elementaryStreams[o];if(!h)return;const u=t[o],c=r||h.partial===!0;s.range[o]=this.getBufferedTimes(i,e.part,c,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),Zi(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=Zn(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=Ri(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,h=e.minEndPTS||o,u=e.maxStartPTS||r;for(let c=0;c<n.length;c++){const f=n.start(c)-this.bufferPadding,d=n.end(c)+this.bufferPadding;if(u>=f&&h<=d){s.time.push({startPTS:Math.max(r,n.start(c)),endPTS:Math.min(o,n.end(c))});break}else if(r<d&&o>f){const m=Math.max(r,n.start(c)),v=Math.min(o,n.end(c));v>m&&(s.partial=!0,s.time.push({startPTS:m,endPTS:v}))}else if(o<=f)break}return s}getPartialFragment(e){let t=null,i,n,s,r=0;const{bufferPadding:o,fragments:h}=this;return Object.keys(h).forEach(u=>{const c=h[u];c&&Zi(c)&&(n=c.body.start-o,s=c.body.end+o,e>=n&&e<=s&&(i=Math.min(e-n,s-e),r<=i&&(t=c.body,r=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Zi(t))}getState(e){const t=Ri(e),i=this.fragments[t];return i?i.buffered?Zi(i)?Qt.PARTIAL:Qt.OK:Qt.APPENDING:Qt.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=Ri(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 h=s[r];this.detectEvictedFragments(r,h,o,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Ri(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 h=o.body;h.type!==i||n&&!h.gap||h.start<t&&h.end>e&&(o.buffered||s)&&this.removeFragment(h)})}removeFragment(e){const t=Ri(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=Zn(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 Zi(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 Ri(a){return`${a.type}_${a.level}_${a.sn}`}function Zn(a,e){return a.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var hi={cbc:0,ctr:1};class wn{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 hi.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case hi.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 os(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class ws{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],h=this.invSubMix,u=h[0],c=h[1],f=h[2],d=h[3],m=new Uint32Array(256);let v=0,w=0,T=0;for(T=0;T<256;T++)T<128?m[T]=T<<1:m[T]=T<<1^283;for(T=0;T<256;T++){let k=w^w<<1^w<<2^w<<3^w<<4;k=k>>>8^k&255^99,e[v]=k,t[k]=v;const X=m[v],H=m[X],ue=m[H];let ve=m[k]*257^k*16843008;n[v]=ve<<24|ve>>>8,s[v]=ve<<16|ve>>>16,r[v]=ve<<8|ve>>>24,o[v]=ve,ve=ue*16843009^H*65537^X*257^v*16843008,u[k]=ve<<24|ve>>>8,c[k]=ve<<16|ve>>>16,f[k]=ve<<8|ve>>>24,d[k]=ve,v?(v=X^m[m[m[ue^X]]],w^=m[m[w]]):v=w=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,h;const u=this.keySchedule=new Uint32Array(r),c=this.invKeySchedule=new Uint32Array(r),f=this.sBox,d=this.rcon,m=this.invSubMix,v=m[0],w=m[1],T=m[2],k=m[3];let X,H;for(o=0;o<r;o++){if(o<s){X=u[o]=t[o];continue}H=X,o%s===0?(H=H<<8|H>>>24,H=f[H>>>24]<<24|f[H>>>16&255]<<16|f[H>>>8&255]<<8|f[H&255],H^=d[o/s|0]<<24):s>6&&o%s===4&&(H=f[H>>>24]<<24|f[H>>>16&255]<<16|f[H>>>8&255]<<8|f[H&255]),u[o]=X=(u[o-s]^H)>>>0}for(h=0;h<r;h++)o=r-h,h&3?H=u[o]:H=u[o-4],h<4||o<=4?c[h]=H:c[h]=v[f[H>>>24]]^w[f[H>>>16&255]]^T[f[H>>>8&255]]^k[f[H&255]],c[h]=c[h]>>>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,h=o[0],u=o[1],c=o[2],f=o[3],d=this.uint8ArrayToUint32Array_(i);let m=d[0],v=d[1],w=d[2],T=d[3];const k=new Int32Array(e),X=new Int32Array(k.length);let H,ue,ve,Ie,ce,Se,Ae,pe,Fe,lt,mt,Tt,_t,st;const bt=this.networkToHostOrderSwap;for(;t<k.length;){for(Fe=bt(k[t]),lt=bt(k[t+1]),mt=bt(k[t+2]),Tt=bt(k[t+3]),ce=Fe^s[0],Se=Tt^s[1],Ae=mt^s[2],pe=lt^s[3],_t=4,st=1;st<n;st++)H=h[ce>>>24]^u[Se>>16&255]^c[Ae>>8&255]^f[pe&255]^s[_t],ue=h[Se>>>24]^u[Ae>>16&255]^c[pe>>8&255]^f[ce&255]^s[_t+1],ve=h[Ae>>>24]^u[pe>>16&255]^c[ce>>8&255]^f[Se&255]^s[_t+2],Ie=h[pe>>>24]^u[ce>>16&255]^c[Se>>8&255]^f[Ae&255]^s[_t+3],ce=H,Se=ue,Ae=ve,pe=Ie,_t=_t+4;H=r[ce>>>24]<<24^r[Se>>16&255]<<16^r[Ae>>8&255]<<8^r[pe&255]^s[_t],ue=r[Se>>>24]<<24^r[Ae>>16&255]<<16^r[pe>>8&255]<<8^r[ce&255]^s[_t+1],ve=r[Ae>>>24]<<24^r[pe>>16&255]<<16^r[ce>>8&255]<<8^r[Se&255]^s[_t+2],Ie=r[pe>>>24]<<24^r[ce>>16&255]<<16^r[Se>>8&255]<<8^r[Ae&255]^s[_t+3],X[t]=bt(H^m),X[t+1]=bt(Ie^v),X[t+2]=bt(ve^w),X[t+3]=bt(ue^T),m=Fe,v=lt,w=mt,T=Tt,t=t+4}return X.buffer}}class Sn{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=ls(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function ls(a){switch(a){case hi.cbc:return"AES-CBC";case hi.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const Ss=16;class Nn{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?os(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 h=this.flush();h?s(h.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!==hi.cbc||t.byteLength!==16)return W.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Ue(o,e),this.remainderData=null);const h=this.getValidChunk(e);if(!h.length)return null;s&&(i=s);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new ws),u.expandKey(t);const c=r;return this.currentResult=u.decrypt(h.buffer,0,i),this.currentIV=h.slice(-16).buffer,c||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new Sn(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new wn(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(W.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%Ss;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(W.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const qn=Math.pow(2,17);class An{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 Oi({type:oe.NETWORK_ERROR,details:V.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,h)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(v=>v[0]==="GAP")){h(Bn(e));return}else e.gap=!1;const u=this.loader=s?new s(n):new r(n),c=cn(e);e.loader=u;const f=Mn(n.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:qn};e.stats=u.stats;const m={onSuccess:(v,w,T,k)=>{this.resetLoader(e,u);let X=v.data;T.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(X.slice(0,16)),X=X.slice(16)),o({frag:e,part:null,payload:X,networkDetails:k})},onError:(v,w,T,k)=>{this.resetLoader(e,u),h(new Oi({type:oe.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:y({url:i,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:T,stats:k}))},onAbort:(v,w,T)=>{this.resetLoader(e,u),h(new Oi({type:oe.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:T,stats:v}))},onTimeout:(v,w,T)=>{this.resetLoader(e,u),h(new Oi({type:oe.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:T,stats:v}))}};t&&(m.onProgress=(v,w,T,k)=>t({frag:e,part:null,payload:T,networkDetails:k})),u.load(c,d,m)})}loadPart(e,t,i){this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,h)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){h(Bn(e,t));return}const u=this.loader=s?new s(n):new r(n),c=cn(e,t);e.loader=u;const f=Mn(n.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:qn};t.stats=u.stats,u.load(c,d,{onSuccess:(m,v,w,T)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const k={frag:e,part:t,payload:m.data,networkDetails:T};i(k),o(k)},onError:(m,v,w,T)=>{this.resetLoader(e,u),h(new Oi({type:oe.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:y({url:c.url,data:void 0},m),error:new Error(`HTTP Error ${m.code} ${m.text}`),networkDetails:w,stats:T}))},onAbort:(m,v,w)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),h(new Oi({type:oe.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:w,stats:m}))},onTimeout:(m,v,w)=>{this.resetLoader(e,u),h(new Oi({type:oe.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:w,stats:m}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,s=n.total;if(i.loaded+=n.loaded,s){const h=Math.round(e.duration/t.duration),u=Math.min(Math.round(i.loaded/s),h),f=(h-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 cn(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(N(n)&&N(s)){var r;let o=n,h=s;if(a.sn==="initSegment"&&Dn((r=a.decryptdata)==null?void 0:r.method)){const u=s-n;u%16&&(h=s+(16-u%16)),n!==0&&(i.resetIV=!0,o=n-16)}i.rangeStart=o,i.rangeEnd=h}return i}function Bn(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:oe.MEDIA_ERROR,details:V.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new Oi(i)}function Dn(a){return a==="AES-128"||a==="AES-256"}class Oi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Ln extends P{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 Fi{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 nn={length:0,start:()=>0,end:()=>0};class Lt{static isBuffered(e,t){if(e){const i=Lt.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=Lt.getBuffered(e);return Lt.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const n=Lt.bufferedRanges(e);if(n.length)return Lt.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((c,f)=>c.start-f.start||f.end-c.end);let n=-1,s=[];if(i)for(let c=0;c<e.length;c++){t>=e[c].start&&t<=e[c].end&&(n=c);const f=s.length;if(f){const d=s[f-1].end;e[c].start-d<i?e[c].end>d&&(s[f-1].end=e[c].end):s.push(e[c])}else s.push(e[c])}else s=e;let r=0,o,h=t,u=t;for(let c=0;c<s.length;c++){const f=s[c].start,d=s[c].end;if(n===-1&&t>=f&&t<=d&&(n=c),t+i>=f&&t<d)h=f,u=d,r=u-t;else if(t+i<f){o=f;break}}return{len:r,start:h||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||nn}catch(t){return W.log("failed to get media.buffered",t),nn}}}const Un=/\{\$([a-zA-Z0-9-_]+)\}/g;function us(a){return Un.test(a)}function $n(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(Un,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 Xn(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 hs(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 As=/^(\d+)x(\d+)$/,cs=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Jt{constructor(e,t){typeof e=="string"&&(e=Jt.parseAttrList(e,t)),g(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=As.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(cs.lastIndex=0;(i=cs.exec(e))!==null;){const r=i[1].trim();let o=i[2];const h=o.indexOf(s)===0&&o.lastIndexOf(s)===o.length-1;let u=!1;if(h)o=o.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(h||u))o=$n(t,o);else if(!u&&!h)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":W.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=o}return n}}const Ds="com.apple.hls.interstitial";function Ls(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function fs(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class ds{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]){W.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=g(new Jt({}),s,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);N(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(W.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(N(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===Ds}get isValid(){return!!this.id&&!this._badValueForSameId&&N(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const Rs=10;class Is{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?N(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Rs}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 ji(a,e){return a.length===e.length?!a.some((t,i)=>t!==e[i]):!1}function Gn(a,e){return!a&&!e?!0:!a||!e?!1:ji(a,e)}function fn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function Ii(a){switch(a){case"AES-128":case"AES-256":return hi.cbc;case"AES-256-CTR":return hi.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function dn(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Rn(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function sn(a){const e=Rn(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function pn(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 Qn(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=dn(r)):t=sn(r)}}return t}const In=typeof self!="undefined"?self:void 0;var si={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},wi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Kn(a){switch(a){case wi.FAIRPLAY:return si.FAIRPLAY;case wi.PLAYREADY:return si.PLAYREADY;case wi.WIDEVINE:return si.WIDEVINE;case wi.CLEARKEY:return si.CLEARKEY}}function gt(a){switch(a){case si.FAIRPLAY:return wi.FAIRPLAY;case si.PLAYREADY:return wi.PLAYREADY;case si.WIDEVINE:return wi.WIDEVINE;case si.CLEARKEY:return wi.CLEARKEY}}function Rt(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[si.FAIRPLAY,si.WIDEVINE,si.PLAYREADY,si.CLEARKEY].filter(n=>!!e[n]):[];return!i[si.WIDEVINE]&&t&&i.push(si.WIDEVINE),i}const ni=function(a){return In!=null&&(a=In.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function pi(a,e,t,i){let n;switch(a){case si.FAIRPLAY:n=["cenc","sinf"];break;case si.WIDEVINE:case si.PLAYREADY:n=["cenc"];break;case si.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return oi(n,e,t,i)}function oi(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 ps(a){var e;return!!a&&(a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function ks(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 h=dn(o).subarray(0,16);return pn(h),h}}return null}let Jn={};class kn{static clearKeyUriToKeyIdMap(){Jn={}}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&&!fn(e),r!=null&&r.startsWith("0x")&&(this.keyId=new Uint8Array(A(r)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&ji(e.keyFormatVersions,this.keyFormatVersions)&&Gn(e.iv,this.iv)&&Gn(e.keyId,this.keyId)}isSupported(){if(this.method){if(fn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case wi.FAIRPLAY:case wi.WIDEVINE:case wi.PLAYREADY:case wi.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(fn(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(W.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=nl(e);return new kn(this.method,this.uri,"identity",this.keyFormatVersions,i)}if(this.pssh&&this.keyId)return this;const t=Qn(this.uri);if(t)switch(this.keyFormat){case wi.WIDEVINE:if(this.pssh=t,!this.keyId&&t.length>=22){const i=t.length-22;this.keyId=t.subarray(i,i+16)}break;case wi.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=At(i,null,t),this.keyId=ks(t);break}default:{let i=t.subarray(0,16);if(i.length!==16){const n=new Uint8Array(16);n.set(i,16-i.length),i=n}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=Jn[this.uri];if(!i){const n=Object.keys(Jn).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,n),Jn[this.uri]=i}this.keyId=i}return this}}function nl(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const ia=/#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,na=/#EXT-X-MEDIA:(.*)/g,sl=/^#EXT(?:INF|-X-TARGETDURATION):/m,ur=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),rl=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 gn{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 E.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return sl.test(e)}static parseMasterPlaylist(e,t){const i=us(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];ia.lastIndex=0;let r;for(;(r=ia.exec(e))!=null;)if(r[1]){var o;const u=new Jt(r[1],n),c=$n(n,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:gn.resolve(c,t)},d=u.decimalResolution("RESOLUTION");d&&(f.width=d.width,f.height=d.height),oa(u.CODECS,f);const m=u["SUPPLEMENTAL-CODECS"];m&&(f.supplemental={},oa(m,f.supplemental)),(o=f.unknownCodecs)!=null&&o.length||s.push(f),n.levels.push(f)}else if(r[3]){const u=r[3],c=r[4];switch(u){case"SESSION-DATA":{const f=new Jt(c,n),d=f["DATA-ID"];d&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[d]=f);break}case"SESSION-KEY":{const f=ra(c,t,n);f.encrypted&&f.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(f)):W.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const f=new Jt(c,n);Xn(n,f,t)}break}case"CONTENT-STEERING":{const f=new Jt(c,n);n.contentSteering={uri:gn.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=aa(c);break}}}const h=s.length>0&&s.length<n.levels.length;return n.levels=h?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 h=0;for(na.lastIndex=0;(n=na.exec(e))!==null;){const u=new Jt(n[1],i),c=u.TYPE;if(c){const f=o[c],d=s[c]||[];s[c]=d;const m=u.LANGUAGE,v=u["ASSOC-LANGUAGE"],w=u.CHANNELS,T=u.CHARACTERISTICS,k=u["INSTREAM-ID"],X={attrs:u,bitrate:0,id:h++,groupId:u["GROUP-ID"]||"",name:u.NAME||m||"",type:c,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:m,url:u.URI?gn.resolve(u.URI,t):""};if(v&&(X.assocLang=v),w&&(X.channels=w),T&&(X.characteristics=T),k&&(X.instreamId=k),f!=null&&f.length){const H=gn.findGroup(f,X.groupId)||f[0];la(X,H,"audioCodec"),la(X,H,"textCodec")}d.push(X)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const h={url:t},u=new Is(t),c=u.fragments,f=[];let d=null,m=0,v=0,w=0,T=0,k=0,X=null,H=new Re(n,h),ue,ve,Ie,ce=-1,Se=!1,Ae=null,pe;if(ur.lastIndex=0,u.m3u8=e,u.hasVariableRefs=us(e),((o=ur.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(ue=ur.exec(e))!==null;){Se&&(Se=!1,H=new Re(n,h),H.playlistOffset=w,H.setStart(w),H.sn=m,H.cc=T,k&&(H.bitrate=k),H.level=i,d&&(H.initSegment=d,d.rawProgramDateTime&&(H.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null),Ae&&(H.setByteRange(Ae),Ae=null)));const Tt=ue[1];if(Tt){H.duration=parseFloat(Tt);const _t=(" "+ue[2]).slice(1);H.title=_t||null,H.tagList.push(_t?["INF",Tt,_t]:["INF",Tt])}else if(ue[3]){if(N(H.duration)){H.playlistOffset=w,H.setStart(w),Ie&&ha(H,Ie,u),H.sn=m,H.level=i,H.cc=T,c.push(H);const _t=(" "+ue[3]).slice(1);H.relurl=$n(u,_t),hr(H,X,f),X=H,w+=H.duration,m++,v=0,Se=!0}}else{if(ue=ue[0].match(rl),!ue){W.warn("No matches on slow regex match for level playlist!");continue}for(ve=1;ve<ue.length&&ue[ve]===void 0;ve++);const _t=(" "+ue[ve]).slice(1),st=(" "+ue[ve+1]).slice(1),bt=ue[ve+2]?(" "+ue[ve+2]).slice(1):null;switch(_t){case"BYTERANGE":X?H.setByteRange(st,X):H.setByteRange(st);break;case"PROGRAM-DATE-TIME":H.rawProgramDateTime=st,H.tagList.push(["PROGRAM-DATE-TIME",st]),ce===-1&&(ce=c.length);break;case"PLAYLIST-TYPE":u.type&&Cn(u,_t,ue),u.type=st.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?Cn(u,_t,ue):c.length>0&&ca(u,_t,ue),m=u.startSN=parseInt(st);break;case"SKIP":{u.skippedSegments&&Cn(u,_t,ue);const ft=new Jt(st,u),xt=ft.decimalInteger("SKIPPED-SEGMENTS");if(N(xt)){u.skippedSegments+=xt;for(let rt=xt;rt--;)c.push(null);m+=xt}const Ot=ft.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ot&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(Ot.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&Cn(u,_t,ue),u.targetduration=Math.max(parseInt(st),1);break;case"VERSION":u.version!==null&&Cn(u,_t,ue),u.version=parseInt(st);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||Cn(u,_t,ue),u.live=!1;break;case"#":(st||bt)&&H.tagList.push(bt?[st,bt]:[st]);break;case"DISCONTINUITY":T++,H.tagList.push(["DIS"]);break;case"GAP":H.gap=!0,H.tagList.push([_t]);break;case"BITRATE":H.tagList.push([_t,st]),k=parseInt(st)*1e3,N(k)?H.bitrate=k:k=0;break;case"DATERANGE":{const ft=new Jt(st,u),xt=new ds(ft,u.dateRanges[ft.ID],u.dateRangeTagCount);u.dateRangeTagCount++,xt.isValid||u.skippedSegments?u.dateRanges[xt.id]=xt:W.warn(`Ignoring invalid DATERANGE tag: "${st}"`),H.tagList.push(["EXT-X-DATERANGE",st]);break}case"DEFINE":{{const ft=new Jt(st,u);"IMPORT"in ft?hs(u,ft,r):Xn(u,ft,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?Cn(u,_t,ue):c.length>0&&ca(u,_t,ue),u.startCC=T=parseInt(st);break;case"KEY":{const ft=ra(st,t,u);if(ft.isSupported()){if(ft.method==="NONE"){Ie=void 0;break}Ie||(Ie={});const xt=Ie[ft.keyFormat];xt!=null&&xt.matches(ft)||(xt&&(Ie=g({},Ie)),Ie[ft.keyFormat]=ft)}else W.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${st}"`);break}case"START":u.startTimeOffset=aa(st);break;case"MAP":{const ft=new Jt(st,u);if(H.duration){const xt=new Re(n,h);ua(xt,ft,i,Ie),d=xt,H.initSegment=d,d.rawProgramDateTime&&!H.rawProgramDateTime&&(H.rawProgramDateTime=d.rawProgramDateTime)}else{const xt=H.byteRangeEndOffset;if(xt){const Ot=H.byteRangeStartOffset;Ae=`${xt-Ot}@${Ot}`}else Ae=null;ua(H,ft,i,Ie),d=H,Se=!0}d.cc=T;break}case"SERVER-CONTROL":{pe&&Cn(u,_t,ue),pe=new Jt(st),u.canBlockReload=pe.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=pe.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&pe.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=pe.optionalFloat("PART-HOLD-BACK",0),u.holdBack=pe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&Cn(u,_t,ue);const ft=new Jt(st);u.partTarget=ft.decimalFloatingPoint("PART-TARGET");break}case"PART":{let ft=u.partList;ft||(ft=u.partList=[]);const xt=v>0?ft[ft.length-1]:void 0,Ot=v++,rt=new Jt(st,u),at=new Je(rt,H,h,Ot,xt);ft.push(at),H.duration+=at.duration;break}case"PRELOAD-HINT":{const ft=new Jt(st,u);u.preloadHint=ft;break}case"RENDITION-REPORT":{const ft=new Jt(st,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(ft);break}default:W.warn(`line parsed but not handled: ${ue}`);break}}}X&&!X.relurl?(c.pop(),w-=X.duration,u.partList&&(u.fragmentHint=X)):u.partList&&(hr(H,X,f),H.cc=T,u.fragmentHint=H,Ie&&ha(H,Ie,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const Fe=c.length,lt=c[0],mt=c[Fe-1];if(w+=u.skippedSegments*u.targetduration,w>0&&Fe&&mt){u.averagetargetduration=w/Fe;const Tt=mt.sn;u.endSN=Tt!=="initSegment"?Tt:0,u.live||(mt.endList=!0),ce>0&&(ol(c,ce),lt&&f.unshift(lt))}return u.fragmentHint&&(w+=u.fragmentHint.duration),u.totalduration=w,f.length&&u.dateRangeTagCount&<&&sa(f,u),u.endCC=T,u}}function sa(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 h=e.dateRanges[s[o]],u=h.startDate.getTime();h.tagAnchor=i.ref;for(let c=t;c--;){var r;if(((r=a[c])==null?void 0:r.sn)<e.startSN)break;const f=al(e,u,a,c,n);if(f!==-1){h.tagAnchor=e.fragments[f].ref;break}}}}function al(a,e,t,i,n){const s=t[i];if(s){const o=s.programDateTime;if(e>=o||i===0){var r;const h=(((r=t[i+1])==null?void 0:r.start)||n)-s.start;if(e<=o+h*1e3){const u=t[i].sn-a.startSN;if(u<0)return-1;const c=a.fragments;if(c.length>t.length){const d=(t[i+1]||c[c.length-1]).sn-a.startSN;for(let m=d;m>u;m--){const v=c[m].programDateTime;if(e>=v&&e<v+c[m].duration*1e3)return m}}return u}}}return-1}function ra(a,e,t){var i,n;const s=new Jt(a,t),r=(i=s.METHOD)!=null?i:"",o=s.URI,h=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,c=(n=s.KEYFORMAT)!=null?n:"identity";o&&s.IV&&!h&&W.error(`Invalid IV: ${s.IV}`);const f=o?gn.resolve(o,e):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new kn(r,f,c,d,h,s.KEYID)}function aa(a){const t=new Jt(a).decimalFloatingPoint("TIME-OFFSET");return N(t)?t:null}function oa(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>It(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 la(a,e,t){const i=e[t];i&&(a[t]=i)}function ol(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 hr(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function ua(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 ha(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 Cn(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function ca(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function cr(a,e){const t=e.startPTS;if(N(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 fa(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 h=t,u=i;const c=e.startPTS,f=e.endPTS;if(N(c)){const k=Math.abs(c-t);a&&k>a.totalduration?r.warn(`media timestamps and playlist times differ by ${k}s for level ${e.level} ${a.url}`):N(e.deltaPTS)?e.deltaPTS=Math.max(k,e.deltaPTS):e.deltaPTS=k,h=Math.max(t,c),t=Math.min(t,c),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=h,e.startDTS=n,e.endPTS=i,e.minEndPTS=u,e.endDTS=s;const m=e.sn;if(!a||m<a.startSN||m>a.endSN)return 0;let v;const w=m-a.startSN,T=a.fragments;for(T[w]=e,v=w;v>0;v--)cr(T[v],T[v-1]);for(v=w;v<T.length-1;v++)cr(T[v],T[v+1]);return a.fragmentHint&&cr(T[T.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,d}function ll(a,e,t){if(a===e)return;let i=null;const n=a.fragments;for(let c=n.length-1;c>=0;c--){const f=n[c].initSegment;if(f){i=f;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let s;cl(a,e,(c,f,d,m)=>{if((!e.startCC||e.skippedSegments)&&f.cc!==c.cc){const v=c.cc-f.cc;for(let w=d;w<m.length;w++)m[w].cc+=v;e.endCC=m[m.length-1].cc}N(c.startPTS)&&N(c.endPTS)&&(f.setStart(f.startPTS=c.startPTS),f.startDTS=c.startDTS,f.maxStartPTS=c.maxStartPTS,f.endPTS=c.endPTS,f.endDTS=c.endDTS,f.minEndPTS=c.minEndPTS,f.setDuration(c.endPTS-c.startPTS),f.duration&&(s=f),e.PTSKnown=e.alignedSliding=!0),c.hasStreams&&(f.elementaryStreams=c.elementaryStreams),f.loader=c.loader,c.hasStats&&(f.stats=c.stats),c.initSegment&&(f.initSegment=c.initSegment,i=c.initSegment)});const r=e.fragments,o=e.fragmentHint?r.concat(e.fragmentHint):r;if(i&&o.forEach(c=>{var f;c&&(!c.initSegment||c.initSegment.relurl===((f=i)==null?void 0:f.relurl))&&(c.initSegment=i)}),e.skippedSegments){if(e.deltaUpdateFailed=r.some(c=>!c),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let c=e.skippedSegments;c--;)r.shift();e.startSN=r[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=ul(a.dateRanges,e,t));const c=a.fragments.filter(f=>f.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let f=1;f<o.length;f++)o[f].programDateTime===null&&hr(o[f],o[f-1],c);sa(c,e)}e.endCC=r[r.length-1].cc}if(!e.startCC){var h;const c=ma(a,e.startSN-1);e.startCC=(h=c==null?void 0:c.cc)!=null?h:r[0].cc}hl(a.partList,e.partList,(c,f)=>{f.elementaryStreams=c.elementaryStreams,f.stats=c.stats}),s?fa(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,t):pa(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 c=e.edge;e.driftStart||(e.driftStartTime=u,e.driftStart=c),e.driftEndTime=u,e.driftEnd=c}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function ul(a,e,t){const{dateRanges:i,recentlyRemovedDateranges:n}=e,s=g({},a);n&&n.forEach(h=>{delete s[h]});const o=Object.keys(s).length;return o?(Object.keys(i).forEach(h=>{const u=s[h],c=new ds(i[h].attr,u);c.isValid?(s[h]=c,u||(c.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${kt(i[h].attr)}"`)}),s):i}function hl(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 cl(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,h=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let u=n;u<=s;u++){const c=h[r+u];let f=o[u];if(i&&!f&&c&&(f=e.fragments[u]=c),c&&f){t(c,f,u,o);const d=c.relurl,m=f.relurl;if(d&&fl(d,m)){e.playlistParsingError=da(`media sequence mismatch ${f.sn}:`,a,e,c,f);return}else if(c.cc!==f.cc){e.playlistParsingError=da(`discontinuity sequence mismatch (${c.cc}!=${f.cc})`,a,e,c,f);return}}}}function da(a,e,t,i,n){return new Error(`${a} ${n.url}
|
|
Playlist starting @${e.startSN}
|
|
${e.m3u8}
|
|
|
|
Playlist starting @${t.startSN}
|
|
${t.m3u8}`)}function pa(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;fr(e,r)}function fr(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 ga(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 ma(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 _a(a,e,t){return a?va(a.partList,e,t):null}function va(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 ya(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 fl(a,e){return a!==e&&e?Ea(a)!==Ea(e):!1}function Ea(a){return a.replace(/\?[^?]*$/,"")}function Cs(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 dl(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function ba(a,e){const t=a.start+e;a.startPTS=t,a.setStart(t),a.endPTS=t+a.duration}function xa(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)ba(t[i],a);e.fragmentHint&&ba(e.fragmentHint,a),e.alignedSliding=!0}function pl(a,e){a&&(Ta(e,a),e.alignedSliding||Ks(e,a),!e.alignedSliding&&!e.skippedSegments&&pa(a,e,!1))}function Ta(a,e){if(!dl(e,a))return;const t=Math.min(e.endCC,a.endCC),i=Cs(e.fragments,t),n=Cs(a.fragments,t);if(!i||!n)return;W.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;xa(s,a)}function Ks(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=Cs(i,r),s=Cs(t,r)),(!n||!s)&&(n=i[Math.floor(i.length/2)],s=Cs(t,n.cc)||t[Math.floor(t.length/2)]);const o=n.programDateTime,h=s.programDateTime;if(!o||!h)return;const u=(h-o)/1e3-(s.start-n.start);xa(u,a)}function Mi(a,e,t){Gi(a,e,t),a.addEventListener(e,t)}function Gi(a,e,t){a.removeEventListener(e,t)}const gl={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}},Me={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 dr extends Ln{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=Me.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:h,mediaBuffer:u,state:c}=this,f=h?h.currentTime:0,d=Lt.bufferInfo(u||h,f,r.maxBufferHole),m=!d.len;if(this.log(`Media seeking to ${N(f)?f.toFixed(3):f}, state: ${c}, ${m?"out of":"in"} buffer`),this.state===Me.ENDED)this.resetLoadingState();else if(o){const v=r.maxFragLookUpTolerance,w=o.start-v,T=o.start+o.duration+v;if(m||T<d.start||w>d.end){const k=f>T;(f<w||k)&&(k&&o.loader&&(this.log(`Cancelling fragment load for seek (sn: ${o.sn})`),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(h){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const v=this.lastCurrentTime;if(f>v&&(this.lastCurrentTime=f),!this.loadingParts){const w=Math.max(d.end,f),T=this.shouldLoadParts(this.getLevelDetails(),w);T&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${w.toFixed(2)}`),this.loadingParts=T)}}this.hls.hasEnoughToStart||(this.log(`Setting ${m?"startPosition":"nextLoadPosition"} to ${f} for seek without enough to start`),this.nextLoadPosition=f,m&&(this.startPosition=f)),m&&this.state===Me.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 An(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Nn(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===Me.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=Me.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=Lt.bufferedInfo(s,e.start,0));const r=e.nextStart;if(r&&r>n&&r<t.edge||this.media.currentTime<e.start)return!1;const h=t.partList;if(h!=null&&h.length){const c=h[h.length-1];return Lt.isBuffered(this.media,c.start+c.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;Mi(i,"seeking",this.onMediaSeeking),Mi(i,"ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===Me.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),Gi(n,"seeking",this.onMediaSeeking),Gi(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=Me.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===Me.FRAG_LOADING||!this.fragCurrent&&r===Me.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=Me.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===Me.STOPPED||this.state===Me.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)===Qt.APPENDING){const s=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,s),o=Math.max(e.duration,r?r.len:this.config.maxBufferLength),h=this.backtrackFragment;((h?e.sn-h.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)===Qt.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&&fn(o.method)){const h=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,Ii(o.method)).catch(u=>{throw n.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:V.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:s}),u}).then(u=>{const c=self.performance.now();return n.trigger(p.FRAG_DECRYPTED,{frag:s,payload:u,stats:{tstart:h,tdecrypt:c}}),i.payload=u,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===Me.STOPPED||this.state===Me.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!==Me.STOPPED&&(this.state=Me.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:oe.KEY_SYSTEM_ERROR,details:V.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?gl.toString(Lt.getBuffered(i)):"(detached)"})`),Te(e)){var n;if(e.type!==ne.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=Me.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=Me.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(h=>!h),o=new Fi(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=Me.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===Me.KEY_LOADING&&(this.state=Me.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 h=this.fragPrevious;if(Te(e)&&(!h||e.sn!==h.sn)){const d=this.shouldLoadParts(t.details,e.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} loading sn ${h==null?void 0:h.sn}->${e.sn}`),this.loadingParts=d)}if(i=Math.max(e.start,i||0),this.loadingParts&&Te(e)){const d=r.partList;if(d&&n){i>r.fragmentEnd&&r.fragmentHint&&(e=r.fragmentHint);const m=this.getNextPart(d,e,i);if(m>-1){const v=d[m];e=this.fragCurrent=v.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${v.index} (${m}/${d.length-1}) of ${this.fragInfo(e,!1,v)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=v.start+v.duration,this.state=Me.FRAG_LOADING;let w;return o?w=o.then(T=>!T||this.fragContextChanged(T.frag)?null:this.doFragPartsLoad(e,v,t,n)).catch(T=>this.handleFragLoadError(T)):w=this.doFragPartsLoad(e,v,t,n).catch(T=>this.handleFragLoadError(T)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:v,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):w}else if(!e.url||this.loadedEndOfParts(d,i))return Promise.resolve(null)}}if(Te(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))}`),N(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Me.FRAG_LOADING;const c=this.config.progressive;let f;return c&&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,c?n:void 0),o]).then(([d])=>(!c&&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 h=[],u=(o=i.details)==null?void 0:o.partList,c=f=>{this.fragmentLoader.loadPart(e,f,n).then(d=>{h[f.index]=d;const m=d.part;this.hls.trigger(p.FRAG_LOADED,d);const v=_a(i.details,e.sn,f.index+1)||va(u,e.sn,f.index+1);if(v)c(v);else return s({frag:e,part:m,partsLoaded:h})}).catch(r)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===V.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===oe.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetFragmentLoading(t.frag)):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Me.PARSING){!this.fragCurrent&&this.state!==Me.STOPPED&&this.state!==Me.ERROR&&(this.state=Me.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===ne.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],h=o.details,u=r>-1?_a(h,s,r):null,c=u?u.fragment:ma(h,s,i);return c?(i&&i!==c&&(c.stats=i.stats),{frag:c,part:u,level:o}):null}bufferFragmentData(e,t,i,n,s){if(this.state!==Me.PARSING)return;const{data1:r,data2:o}=e;let h=r;if(o&&(h=Ue(r,o)),!h.length)return;const u=this.initPTS[t.cc],c=u?-u.baseTime/u.timescale:void 0,f={type:e.type,frag:t,part:i,chunkMeta:n,offset:c,parent:t.type,data:h};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(!Lt.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=Lt.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(!N(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=Lt.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 Lt.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=ne.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 h=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),h=this.getInitialLiveFragment(t);const d=this.hls.startPosition,m=this.hls.liveSyncPosition,v=h?(d!==-1&&d>=r?d:m)||h.start:e;this.log(`Setting startPosition to ${v} to match start frag at live edge. mainStart: ${d} liveSyncPosition: ${m} frag.start: ${(u=h)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=v}}else e<=r&&(h=i[0]);if(!h){const f=this.loadingParts?t.partEnd:t.fragmentEnd;h=this.getFragmentAtPosition(e,f,t)}let c=this.filterReplacedPrimary(h,t);if(!c&&h){const f=h.sn-t.startSN;c=this.filterReplacedPrimary(i[f+1]||null,t)}return this.mapToInitFragWhenRequired(c)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===Qt.OK||i===Qt.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 h=r.sn;return this.loopSn!==h&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${h}`),this.loopSn=h),null}}return this.loopSn=void 0,r}get primaryPrefetch(){if(wa(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(wa(this.config)&&e.type!==ne.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,h=e.length;o<h;o++){const u=e[o];if(r=r&&!u.independent,n>-1&&i<u.start)break;const c=u.loaded;c?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=c}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=Ti(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=$i(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:h}=i,{maxFragLookUpTolerance:u}=n,c=i.partList,f=!!(this.loadingParts&&c!=null&&c.length&&h);f&&!this.bitrateTest&&c[c.length-1].fragment.sn===h.sn&&(r=r.concat(h),o=h.sn);let d;if(e<t){var m;const w=e<this.lastCurrentTime||e>t-u||(m=this.media)!=null&&m.paused||!this.startFragRequested?0:u;d=Hi(s,r,e,w)}else d=r[r.length-1];if(d){const v=d.sn-i.startSN,w=this.fragmentTracker.getState(d);if((w===Qt.OK||w===Qt.PARTIAL&&d.gap)&&(s=d),s&&d.sn===s.sn&&(!f||c[0].fragment.sn>d.sn||!i.live)&&d.level===s.level){const k=r[v+1];d.sn<o&&this.fragmentTracker.getState(k)!==Qt.OK?d=k: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&&N(s);if(r||!o&&!s){pl(i,e);const h=e.fragmentStart;return this.log(`Live playlist sliding: ${h.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${n}`),h}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&&N(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&&Te(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!==Me.FRAG_LOADING_WAITING_RETRY)&&(this.state=Me.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const k=this.getCurrentContext(t.chunkMeta);k&&(t.frag=k.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===V.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(n,!0);const o=t.errorAction;if(!o){this.state=Me.ERROR;return}const{action:h,flags:u,retryCount:c=0,retryConfig:f}=o,d=!!f,m=d&&h===ui.RetryRequest,v=d&&!o.resolved&&u===mi.MoveAllAlternatesMatchingHost,w=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!m&&v&&Te(n)&&!n.endList&&w)this.resetFragmentErrors(e),this.treatAsGap(n),o.resolved=!0;else if((m||v)&&c<f.maxNumRetry){var T;const k=Wn((T=t.response)==null?void 0:T.code),X=Fn(f,c);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+X,this.state=Me.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,k){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 ${c+1}/${f.maxNumRetry} in ${X}ms`)}else if(f)if(this.resetFragmentErrors(e),c<f.maxNumRetry)!r&&h!==ui.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${c})`);return}else h===ui.SendAlternateToPenaltyBox?this.state=Me.WAITING_LEVEL:this.state=Me.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!Wn(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Me.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===Me.PARSING||this.state===Me.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===ne.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Me.STOPPED&&(this.state=Me.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=Lt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===Me.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Me.STOPPED&&(this.state=Me.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((h,u)=>{const c=e.elementaryStreams[u];if(c){const f=c.endPTS-c.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${f})`),h||!1;const d=n?0:fa(s,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS,this);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:s,level:i,drift:d,type:u,frag:e,start:c.startPTS,end:c.endPTS}),!0}return h},!1)){var o;if(i.fragmentError===0&&this.treatAsGap(e,i),((o=this.transmuxer)==null?void 0:o.error)===null){const h=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(h.message),this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,error:h,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Me.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===ne.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 wa(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Sa{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=ml(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function ml(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 pr={exports:{}},Aa;function _l(){return Aa||(Aa=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(h,u,c){this.fn=h,this.context=u,this.once=c||!1}function s(h,u,c,f,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var m=new n(c,f||h,d),v=t?t+u:u;return h._events[v]?h._events[v].fn?h._events[v]=[h._events[v],m]:h._events[v].push(m):(h._events[v]=m,h._eventsCount++),h}function r(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],c,f;if(this._eventsCount===0)return u;for(f in c=this._events)e.call(c,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},o.prototype.listeners=function(u){var c=t?t+u:u,f=this._events[c];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,m=f.length,v=new Array(m);d<m;d++)v[d]=f[d].fn;return v},o.prototype.listenerCount=function(u){var c=t?t+u:u,f=this._events[c];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,c,f,d,m,v){var w=t?t+u:u;if(!this._events[w])return!1;var T=this._events[w],k=arguments.length,X,H;if(T.fn){switch(T.once&&this.removeListener(u,T.fn,void 0,!0),k){case 1:return T.fn.call(T.context),!0;case 2:return T.fn.call(T.context,c),!0;case 3:return T.fn.call(T.context,c,f),!0;case 4:return T.fn.call(T.context,c,f,d),!0;case 5:return T.fn.call(T.context,c,f,d,m),!0;case 6:return T.fn.call(T.context,c,f,d,m,v),!0}for(H=1,X=new Array(k-1);H<k;H++)X[H-1]=arguments[H];T.fn.apply(T.context,X)}else{var ue=T.length,ve;for(H=0;H<ue;H++)switch(T[H].once&&this.removeListener(u,T[H].fn,void 0,!0),k){case 1:T[H].fn.call(T[H].context);break;case 2:T[H].fn.call(T[H].context,c);break;case 3:T[H].fn.call(T[H].context,c,f);break;case 4:T[H].fn.call(T[H].context,c,f,d);break;default:if(!X)for(ve=1,X=new Array(k-1);ve<k;ve++)X[ve-1]=arguments[ve];T[H].fn.apply(T[H].context,X)}}return!0},o.prototype.on=function(u,c,f){return s(this,u,c,f,!1)},o.prototype.once=function(u,c,f){return s(this,u,c,f,!0)},o.prototype.removeListener=function(u,c,f,d){var m=t?t+u:u;if(!this._events[m])return this;if(!c)return r(this,m),this;var v=this._events[m];if(v.fn)v.fn===c&&(!d||v.once)&&(!f||v.context===f)&&r(this,m);else{for(var w=0,T=[],k=v.length;w<k;w++)(v[w].fn!==c||d&&!v[w].once||f&&v[w].context!==f)&&T.push(v[w]);T.length?this._events[m]=T.length===1?T[0]:T:r(this,m)}return this},o.prototype.removeAllListeners=function(u){var c;return u?(c=t?t+u:u,this._events[c]&&r(this,c)):(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}(pr)),pr.exports}var vl=_l(),gr=C(vl);const Ps="1.6.11",gs={};function yl(){return typeof __HLS_WORKER_BUNDLE__=="function"}function El(){const a=gs[Ps];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 gs[Ps]=n,n}function bl(a){const e=gs[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 gs[a]=n,n}function xl(a){const e=gs[a||Ps];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete gs[a||Ps],n&&self.URL.revokeObjectURL(n),i.terminate()}}function Da(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 mr(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 Vs(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 Os(a,e){const t=e;let i=0;for(;mr(a,e);){i+=10;const n=Vs(a,e+6);i+=n,Da(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)}function Tl(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 m=new Error(`invalid ADTS sampling index:${r}`);a.emit(p.ERROR,p.ERROR,{type:oe.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!0,error:m,reason:m.message});return}const o=(s>>6&3)+1,h=e[t+3]>>6&3|(s&1)<<2,u="mp4a.40."+o,c=n[r];let f=r;(o===5||o===29)&&(f-=3);const d=[o<<3|(f&14)>>1,(f&1)<<7|h<<3];return W.log(`manifest codec:${i}, parsed codec:${u}, channels:${h}, rate:${c} (ADTS object type:${o} sampling index:${r})`),{config:d,samplerate:c,channelCount:h,codec:u,parsedCodec:u,manifestCodec:i}}function La(a,e){return a[e]===255&&(a[e+1]&246)===240}function Ra(a,e){return a[e+1]&1?7:9}function _r(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function wl(a,e){return e+5<a.length}function js(a,e){return e+1<a.length&&La(a,e)}function Sl(a,e){return wl(a,e)&&La(a,e)&&_r(a,e)<=a.length-e}function Al(a,e){if(js(a,e)){const t=Ra(a,e);if(e+t>=a.length)return!1;const i=_r(a,e);if(i<=t)return!1;const n=e+i;return n===a.length||js(a,n)}return!1}function Ia(a,e,t,i,n){if(!a.samplerate){const s=Tl(e,t,i,n);if(!s)return;g(a,s)}}function ka(a){return 1024*9e4/a}function Dl(a,e){const t=Ra(a,e);if(e+t<=a.length){const i=_r(a,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ca(a,e,t,i,n){const s=ka(a.samplerate),r=i+n*s,o=Dl(e,t);let h;if(o){const{frameLength:f,headerLength:d}=o,m=d+f,v=Math.max(0,t+m-e.length);v?(h=new Uint8Array(m-d),h.set(e.subarray(t+d,e.length),0)):h=e.subarray(t+d,t+m);const w={unit:h,pts:r};return v||a.samples.push(w),{sample:w,length:m,missing:v}}const u=e.length-t;return h=new Uint8Array(u),h.set(e.subarray(t,e.length),0),{sample:{unit:h,pts:r},length:u,missing:-1}}function Ll(a,e){return mr(a,e)&&Vs(a,e+6)+10<=a.length-e}function Rl(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function vr(a,e=0,t=1/0){return Il(a,e,t,Uint8Array)}function Il(a,e,t,i){const n=kl(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=Cl(a)?a.byteOffset:0,o=(r+a.byteLength)/s,h=(r+e)/s,u=Math.floor(Math.max(0,Math.min(h,o))),c=Math.floor(Math.min(u+Math.max(t,0),o));return new i(n,u,c-u)}function kl(a){return a instanceof ArrayBuffer?a:a.buffer}function Cl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function Pl(a){const e={key:a.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(a.size<2)return;if(a.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=a.data.subarray(1).indexOf(0);if(i===-1)return;const n=Pe(vr(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=Pe(vr(a.data,3+i,r));let h;return n==="-->"?h=Pe(vr(a.data,4+i+r)):h=Rl(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=h,e}function Ol(a){if(a.size<2)return;const e=Pe(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function Fl(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=Pe(a.data.subarray(t),!0);t+=i.length+1;const n=Pe(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=Pe(a.data.subarray(1));return{key:a.type,info:"",data:e}}function Ml(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=Pe(a.data.subarray(t),!0);t+=i.length+1;const n=Pe(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=Pe(a.data);return{key:a.type,info:"",data:e}}function Nl(a){return a.type==="PRIV"?Ol(a):a.type[0]==="W"?Ml(a):a.type==="APIC"?Pl(a):Fl(a)}function Bl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=Vs(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const zs=10,Ul=10;function Pa(a){let e=0;const t=[];for(;mr(a,e);){const i=Vs(a,e+6);a[e+5]>>6&1&&(e+=zs),e+=zs;const n=e+i;for(;e+Ul<n;){const s=Bl(a.subarray(e)),r=Nl(s);r&&t.push(r),e+=s.size+zs}Da(a,e)&&(e+=zs)}return t}function Oa(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function $l(a){if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function yr(a){const e=Pa(a);for(let t=0;t<e.length;t++){const i=e[t];if(Oa(i))return $l(i)}}let zi=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 mn(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Er{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=Ue(this.cachedData,e),this.cachedData=null);let i=Os(e,0),n=i?i.length:0,s;const r=this._audioTrack,o=this._id3Track,h=i?yr(i):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&N(h))&&(this.basePTS=Gl(h,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:zi.audioId3,duration:Number.POSITIVE_INFINITY});n<u;){if(this.canParse(e,n)){const c=this.appendFrame(r,e,n);c?(this.frameIndex++,this.lastPTS=c.sample.pts,n+=c.length,s=n):n=u}else Ll(e,n)?(i=Os(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:zi.audioId3,duration:Number.POSITIVE_INFINITY}),n+=i.length,s=n):n++;if(n===u&&s!==u){const c=e.slice(s);this.cachedData?this.cachedData=Ue(this.cachedData,c):this.cachedData=c}}return{audioTrack:r,videoTrack:mn(),id3Track:o,textTrack:mn()}}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:mn(),id3Track:this._id3Track,textTrack:mn()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Gl=(a,e,t)=>{if(N(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Hs=null;const Kl=[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],Vl=[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]],zl=[0,1,1,4];function Fa(a,e,t,i,n){if(t+24>e.length)return;const s=Ma(e,t);if(s&&t+s.frameLength<=e.length){const r=s.samplesPerFrame*9e4/s.sampleRate,o=i+n*r,h={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(h),{sample:h,length:s.frameLength,missing:0}}}function Ma(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,h=t===3?3-i:i===3?3:4,u=Kl[h*14+n-1]*1e3,f=Vl[(t===3?0:t===2?1:2)*3+s],d=o===3?1:2,m=jl[t][i],v=zl[i],w=m*8*v,T=Math.floor(m*u/f+r)*v;if(Hs===null){const H=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Hs=H?parseInt(H[1]):0}return!!Hs&&Hs<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:d,frameLength:T,samplesPerFrame:w}}}function br(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function Na(a,e){return e+1<a.length&&br(a,e)}function Hl(a,e){return br(a,e)&&4<=a.length-e}function Ba(a,e){if(e+1<a.length&&br(a,e)){const i=Ma(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const s=e+n;return s===a.length||Na(a,s)}return!1}class Wl extends Er{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=Os(e,0);let n=(i==null?void 0:i.length)||0;if(Ba(e,n))return!1;for(let s=e.length;n<s;n++)if(Al(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Sl(e,t)}appendFrame(e,t,i){Ia(e,this.observer,t,i,e.manifestCodec);const n=Ca(e,t,i,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const Ua=(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),h=8-o;s[0]=4278190080>>>24+h<<h,n[0]=(r[0]&s[0])>>h,t=t?t<<o|n[0]:n[0],e+=1,i-=o}return t};class Yl extends Er{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=$a(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=Os(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&yr(t)!==void 0&&Ua(e,i)<16}}function $a(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],h=e[t+4]&63,c=[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][h*3+s]*2;if(t+c>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 m=(e[t+6]<<8|e[t+7])>>12-d&1,w=[2,1,2,3,3,4,4,5][f]+m,T=e[t+5]>>3,k=e[t+5]&7,X=new Uint8Array([s<<6|T<<1|k>>2,(k&3)<<6|f<<3|m<<2|h>>4,h<<4&224]),H=1536/o*9e4,ue=i+n*H,ve=e.subarray(t,t+c);return a.config=X,a.channelCount=w,a.samplerate=o,a.samples.push({unit:ve,pts:ue}),c}class Zl extends Er{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=Os(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&yr(t)!==void 0&&Ua(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(Ba(e,i))return W.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Hl(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Fa(e,t,i,this.basePTS,this.frameIndex)}}const ql=/\/emsg[-/]ID3/i;class Xl{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,n){const s=this.videoTrack=mn("video",1),r=this.audioTrack=mn("audio",1),o=this.txtTrack=mn("text",1);if(this.id3Track=mn("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const h=Ce(e);if(h.video){const{id:u,timescale:c,codec:f,supplemental:d}=h.video;s.id=u,s.timescale=o.timescale=c,s.codec=f,s.supplemental=d}if(h.audio){const{id:u,timescale:c,codec:f}=h.audio;r.id=u,r.timescale=c,r.codec=f}o.id=Mt.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return Ee(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Ue(this.remainderData,e));const o=qe(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=dt(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=dt(e,t),{videoTrack:t,audioTrack:mn(),id3Track:n,textTrack:mn()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=Q(e.samples,["emsg"]);n&&n.forEach(s=>{const r=We(s);if(ql.test(r.schemeIdUri)){const o=Ga(r,t);let h=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;h<=.001&&(h=Number.POSITIVE_INFINITY);const u=r.payload;i.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:zi.emsg,duration:h})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=Ga(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:zi.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function Ga(a,e){return N(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Ql{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Nn(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,hi.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 h=new Uint8Array(o);n.set(h,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=it(s.data),o=this.getAvcEncryptedData(r);this.decryptBuffer(o.buffer).then(h=>{s.data=this.getAvcDecryptedUnit(r,h),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 Ka{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 h=0,u,c,f,d=-1,m=0;for(s===-1&&(d=0,m=this.getNALuType(t,0),s=0,h=1);h<n;){if(u=t[h++],!s){s=u?0:1;continue}if(s===1){s=u?0:2;continue}if(!u)s=3;else if(u===1){if(c=h-s-1,d>=0){const v={data:t.subarray(d,c),type:m};o.push(v)}else{const v=this.getLastNalUnit(e.samples);v&&(r&&h<=4-r&&v.state&&(v.data=v.data.subarray(0,v.data.byteLength-r)),c>0&&(v.data=Ue(v.data,t.subarray(0,c)),v.state=0))}h<n?(f=this.getNALuType(t,h),d=h,m=f,s=0):s=-1}else s=0}if(d>=0&&s>=0){const v={data:t.subarray(d,n),type:m,state:s};o.push(v)}if(o.length===0){const v=this.getLastNalUnit(e.samples);v&&(v.data=Ue(v.data,t))}return e.naluState=s,o}}class Fs{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&&W.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 Jl extends Ka{parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,h=!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 c,f;switch(u.type){case 1:{let w=!1;o=!0;const T=u.data;if(h&&T.length>4){const k=this.readSliceType(T);(k===2||k===4||k===7||k===9)&&(w=!0)}if(w){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=w;break}case 5:o=!0,(c=r)!=null&&c.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 m,v;o=!0,h=!0;const w=u.data,T=this.readSPS(w);if(!e.sps||e.width!==T.width||e.height!==T.height||((m=e.pixelRatio)==null?void 0:m[0])!==T.pixelRatio[0]||((v=e.pixelRatio)==null?void 0:v[1])!==T.pixelRatio[1]){e.width=T.width,e.height=T.height,e.pixelRatio=T.pixelRatio,e.sps=[w];const k=w.subarray(1,4);let X="avc1.";for(let H=0;H<3;H++){let ue=k[H].toString(16);ue.length<2&&(ue="0"+ue),X+=ue}e.codec=X}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 Fs(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 Fs(e);let i=0,n=0,s=0,r=0,o,h,u;const c=t.readUByte.bind(t),f=t.readBits.bind(t),d=t.readUEG.bind(t),m=t.readBoolean.bind(t),v=t.skipBits.bind(t),w=t.skipEG.bind(t),T=t.skipUEG.bind(t),k=this.skipScalingList.bind(this);c();const X=c();if(f(5),v(3),c(),T(),X===100||X===110||X===122||X===244||X===44||X===83||X===86||X===118||X===128){const Se=d();if(Se===3&&v(1),T(),T(),v(1),m())for(h=Se!==3?8:12,u=0;u<h;u++)m()&&(u<6?k(16,t):k(64,t))}T();const H=d();if(H===0)d();else if(H===1)for(v(1),w(),w(),o=d(),u=0;u<o;u++)w();T(),v(1);const ue=d(),ve=d(),Ie=f(1);Ie===0&&v(1),v(1),m()&&(i=d(),n=d(),s=d(),r=d());let ce=[1,1];if(m()&&m())switch(c()){case 1:ce=[1,1];break;case 2:ce=[12,11];break;case 3:ce=[10,11];break;case 4:ce=[16,11];break;case 5:ce=[40,33];break;case 6:ce=[24,11];break;case 7:ce=[20,11];break;case 8:ce=[32,11];break;case 9:ce=[80,33];break;case 10:ce=[18,11];break;case 11:ce=[15,11];break;case 12:ce=[64,33];break;case 13:ce=[160,99];break;case 14:ce=[4,3];break;case 15:ce=[3,2];break;case 16:ce=[2,1];break;case 255:{ce=[c()<<8|c(),c()<<8|c()];break}}return{width:Math.ceil((ue+1)*16-i*2-n*2),height:(2-Ie)*(ve+1)*16-(Ie?2:4)*(s+r),pixelRatio:ce}}}class eu extends Ka{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,h=!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 c,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,h){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,(c=r)!=null&&c.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=g(e.params,this.readVPS(u.data)),this.initVPS=u.data),e.vps=[u.data];break;case 33:if(o=!0,h=!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 m=this.readSPS(u.data);e.width=m.width,e.height=m.height,e.pixelRatio=m.pixelRatio,e.codec=m.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const v in m.params)e.params[v]=m.params[v]}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 m=this.readPPS(u.data);for(const v in m)e.params[v]=m[v]}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 Fs(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 Fs(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(),h=t.readUByte(),u=t.readUByte(),c=t.readUByte(),f=t.readUByte(),d=t.readUByte(),m=t.readUByte(),v=t.readUByte(),w=t.readUByte(),T=t.readUByte(),k=t.readUByte(),X=[],H=[];for(let Wt=0;Wt<i;Wt++)X.push(t.readBoolean()),H.push(t.readBoolean());if(i>0)for(let Wt=i;Wt<8;Wt++)t.readBits(2);for(let Wt=0;Wt<i;Wt++)X[Wt]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),H[Wt]&&t.readUByte();t.readUEG();const ue=t.readUEG();ue==3&&t.skipBits(1);const ve=t.readUEG(),Ie=t.readUEG(),ce=t.readBoolean();let Se=0,Ae=0,pe=0,Fe=0;ce&&(Se+=t.readUEG(),Ae+=t.readUEG(),pe+=t.readUEG(),Fe+=t.readUEG());const lt=t.readUEG(),mt=t.readUEG(),Tt=t.readUEG(),_t=t.readBoolean();for(let Wt=_t?0:i;Wt<=i;Wt++)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 Ci=0;Ci<4;Ci++)for(let Qi=0;Qi<(Ci===3?2:6);Qi++)if(!t.readBoolean())t.readUEG();else{const ln=Math.min(64,1<<4+(Ci<<1));Ci>1&&t.readEG();for(let xs=0;xs<ln;xs++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const ft=t.readUEG();let xt=0;for(let Wt=0;Wt<ft;Wt++){let Ci=!1;if(Wt!==0&&(Ci=t.readBoolean()),Ci){Wt===ft&&t.readUEG(),t.readBoolean(),t.readUEG();let Qi=0;for(let ns=0;ns<=xt;ns++){const ln=t.readBoolean();let xs=!1;ln||(xs=t.readBoolean()),(ln||xs)&&Qi++}xt=Qi}else{const Qi=t.readUEG(),ns=t.readUEG();xt=Qi+ns;for(let ln=0;ln<Qi;ln++)t.readUEG(),t.readBoolean();for(let ln=0;ln<ns;ln++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Wt=t.readUEG();for(let Ci=0;Ci<Wt;Ci++){for(let Qi=0;Qi<Tt+4;Qi++)t.readBits(1);t.readBits(1)}}let rt=0,at=1,Nt=1,Zt=!0,Ut=1,zt=0;t.readBoolean(),t.readBoolean();let ki=!1;if(t.readBoolean()){if(t.readBoolean()){const ss=t.readUByte(),Zo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],lr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];ss>0&&ss<16?(at=Zo[ss-1],Nt=lr[ss-1]):ss===255&&(at=t.readBits(16),Nt=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(),ki=t.readBoolean(),ki&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(Ut=t.readBits(32),zt=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const lr=t.readBoolean(),qo=t.readBoolean();let $s=!1;(lr||qo)&&($s=t.readBoolean(),$s&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),$s&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Xo=0;Xo<=i;Xo++){Zt=t.readBoolean();const Pc=Zt||t.readBoolean();let Qo=!1;Pc?t.readEG():Qo=t.readBoolean();const Jo=Qo?1:t.readUEG()+1;if(lr)for(let Gs=0;Gs<Jo;Gs++)t.readUEG(),t.readUEG(),$s&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(qo)for(let Gs=0;Gs<Jo;Gs++)t.readUEG(),t.readUEG(),$s&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),rt=t.readUEG())}let Xi=ve,En=Ie;if(ce){let Wt=1,Ci=1;ue===1?Wt=Ci=2:ue==2&&(Wt=2),Xi=ve-Wt*Ae-Wt*Se,En=Ie-Ci*Fe-Ci*pe}const is=n?["A","B","C"][n]:"",Cc=o<<24|h<<16|u<<8|c;let ea=0;for(let Wt=0;Wt<32;Wt++)ea=(ea|(Cc>>Wt&1)<<31-Wt)>>>0;let ta=ea.toString(16);return r===1&&ta==="2"&&(ta="6"),{codecString:`hvc1.${is}${r}.${ta}.${s?"H":"L"}${k}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:n,general_profile_compatibility_flags:[o,h,u,c],general_constraint_indicator_flags:[f,d,m,v,w,T],general_level_idc:k,bit_depth:lt+8,bit_depth_luma_minus8:lt,bit_depth_chroma_minus8:mt,min_spatial_segmentation_idc:rt,chroma_format_idc:ue,frame_rate:{fixed:Zt,fps:zt/Ut}},width:Xi,height:En,pixelRatio:[at,Nt]}}readPPS(e){const t=new Fs(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 Si=188;class Vn{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=Vn.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(Si*5,t-Si)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let h=n;h<t;h+=Si)if(e[h]===71&&(t-h===Si||e[h+Si]===71)){if(o++,r===-1&&(r=h,r!==0&&(i=Math.min(r+Si*99,e.length-Si)+1)),s||(s=xr(e,h)===0),s&&o>1&&(r===0&&o>2||h+Si>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:Mt[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=Vn.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=Vn.createTrack("audio",n),this._id3Track=Vn.createTrack("id3"),this._txtTrack=Vn.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,h=this._id3Track,u=this._txtTrack;let c=r.pid,f=r.pesData,d=o.pid,m=h.pid,v=o.pesData,w=h.pesData,T=null,k=this.pmtParsed,X=this._pmtId,H=e.length;if(this.remainderData&&(e=Ue(this.remainderData,e),H=e.length,this.remainderData=null),H<Si&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:h,textTrack:u};const ue=Math.max(0,Vn.syncOffset(e));H-=(H-ue)%Si,H<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,H,e.buffer.byteLength-H));let ve=0;for(let ce=ue;ce<H;ce+=Si)if(e[ce]===71){const Se=!!(e[ce+1]&64),Ae=xr(e,ce),pe=(e[ce+3]&48)>>4;let Fe;if(pe>1){if(Fe=ce+5+e[ce+4],Fe===ce+Si)continue}else Fe=ce+4;switch(Ae){case c:Se&&(f&&(s=ms(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(Fe,ce+Si)),f.size+=ce+Si-Fe);break;case d:if(Se){if(v&&(s=ms(v,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}v={data:[],size:0}}v&&(v.data.push(e.subarray(Fe,ce+Si)),v.size+=ce+Si-Fe);break;case m:Se&&(w&&(s=ms(w,this.logger))&&this.parseID3PES(h,s),w={data:[],size:0}),w&&(w.data.push(e.subarray(Fe,ce+Si)),w.size+=ce+Si-Fe);break;case 0:Se&&(Fe+=e[Fe]+1),X=this._pmtId=tu(e,Fe);break;case X:{Se&&(Fe+=e[Fe]+1);const lt=iu(e,Fe,this.typeSupported,i,this.observer,this.logger);c=lt.videoPid,c>0&&(r.pid=c,r.segmentCodec=lt.segmentVideoCodec),d=lt.audioPid,d>0&&(o.pid=d,o.segmentCodec=lt.segmentAudioCodec),m=lt.id3Pid,m>0&&(h.pid=m),T!==null&&!k&&(this.logger.warn(`MPEG-TS PMT found at ${ce} after unknown PID '${T}'. Backtracking to sync byte @${ue} to parse all TS packets.`),T=null,ce=ue-188),k=this.pmtParsed=!0;break}case 17:case 8191:break;default:T=Ae;break}}else ve++;ve>0&&Tr(this.observer,new Error(`Found ${ve} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=v,h.pesData=w;const Ie={audioTrack:o,videoTrack:r,id3Track:h,textTrack:u};return n&&this.extractRemainingSamples(Ie),Ie}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,h=n.pesData;let u;if(r&&(u=ms(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=ms(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;h&&(u=ms(h,this.logger))?(this.parseID3PES(n,u),n.pesData=null):n.pesData=h}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new Ql(this.observer,this.config,t);return this.decrypt(n,s)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Jl:e==="hevc"&&(this.videoParser=new eu))}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=Ue(n.sample.unit,s);else{const m=d-f;n.sample.unit.set(s.subarray(0,f),m),e.samples.push(n.sample),i=n.missing}}let r,o;for(r=i,o=s.length;r<o-1&&!js(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",Tr(this.observer,new Error(f),d,this.logger),!d)return}Ia(e,this.observer,s,r,this.audioCodec);let h;if(t.pts!==void 0)h=t.pts;else if(n){const f=ka(e.samplerate);h=n.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,c;for(;r<o;)if(c=Ca(e,s,r,h,u),r+=c.length,c.missing){this.aacOverFlow=c;break}else for(u++;r<o-1&&!js(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(Na(i,r)){const h=Fa(e,i,r,o,s);if(h)r+=h.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,h;for(;o<s&&(h=$a(e,i,o,n,r++))>0;)o+=h}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=g({},t,{type:this._videoTrack?zi.emsg:zi.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function xr(a,e){return((a[e+1]&31)<<8)+a[e+2]}function tu(a,e){return(a[e+10]&31)<<8|a[e+11]}function iu(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],h=e+3+o-4,u=(a[e+10]&15)<<8|a[e+11];for(e+=12+u;e<h;){const c=xr(a,e),f=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!i){wr("ADTS AAC",s);break}case 15:r.audioPid===-1&&(r.audioPid=c);break;case 21:r.id3Pid===-1&&(r.id3Pid=c);break;case 219:if(!i){wr("H.264",s);break}case 27:r.videoPid===-1&&(r.videoPid=c);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=c,r.segmentAudioCodec="mp3");break;case 193:if(!i){wr("AC-3",s);break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=c,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,m=f;for(;m>2;){switch(a[d]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=c,r.segmentAudioCodec="ac3");break}const w=a[d+1]+2;d+=w,m-=w}}break;case 194:case 135:return Tr(n,new Error("Unsupported EC-3 in M2TS found"),void 0,s),r;case 36:r.videoPid===-1&&(r.videoPid=c,r.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=f+5}return r}function Tr(a,e,t,i){i.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:oe.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function wr(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function ms(a,e){let t=0,i,n,s,r,o;const h=a.data;if(!a||a.size===0)return null;for(;h[0].length<19&&h.length>1;)h[0]=Ue(h[0],h[1]),h.splice(1,1);if(i=h[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 c=i[7];c&192&&(r=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,c&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 m=0,v=h.length;m<v;m++){i=h[m];let w=i.byteLength;if(f)if(f>w){f-=w;continue}else i=i.subarray(f),w-=f,f=0;d.set(i,t),t+=w}return n&&(n-=s+3),{data:d,pts:r,dts:o,len:n}}return null}class nu{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 jn=Math.pow(2,32)-1;class xe{static init(){xe.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 xe.types)xe.types.hasOwnProperty(e)&&(xe.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]);xe.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]);xe.STTS=xe.STSC=xe.STCO=s,xe.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),xe.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),xe.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),xe.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]),h=new Uint8Array([0,0,0,1]);xe.FTYP=xe.box(xe.types.ftyp,r,h,r,o),xe.DINF=xe.box(xe.types.dinf,xe.box(xe.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 xe.box(xe.types.hdlr,xe.HDLR_TYPES[e])}static mdat(e){return xe.box(xe.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(jn+1)),n=Math.floor(t%(jn+1));return xe.box(xe.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 xe.box(xe.types.mdia,xe.mdhd(e.timescale||0,e.duration||0),xe.hdlr(e.type),xe.minf(e))}static mfhd(e){return xe.box(xe.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"?xe.box(xe.types.minf,xe.box(xe.types.smhd,xe.SMHD),xe.DINF,xe.stbl(e)):xe.box(xe.types.minf,xe.box(xe.types.vmhd,xe.VMHD),xe.DINF,xe.stbl(e))}static moof(e,t,i){return xe.box(xe.types.moof,xe.mfhd(e),xe.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=xe.trak(e[t]);return xe.box.apply(null,[xe.types.moov,xe.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(xe.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=xe.trex(e[t]);return xe.box.apply(null,[xe.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(jn+1)),n=Math.floor(t%(jn+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 xe.box(xe.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 xe.box(xe.types.sdtp,i)}static stbl(e){return xe.box(xe.types.stbl,xe.stsd(e),xe.box(xe.types.stts,xe.STTS),xe.box(xe.types.stsc,xe.STSC),xe.box(xe.types.stsz,xe.STSZ),xe.box(xe.types.stco,xe.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=xe.box(xe.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),h=e.width,u=e.height,c=e.pixelRatio[0],f=e.pixelRatio[1];return xe.box(xe.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,h>>8&255,h&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,xe.box(xe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),xe.box(xe.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&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 xe.box(xe.types.mp4a,xe.audioStsd(e),xe.box(xe.types.esds,xe.esds(e)))}static mp3(e){return xe.box(xe.types[".mp3"],xe.audioStsd(e))}static ac3(e){return xe.box(xe.types["ac-3"],xe.audioStsd(e),xe.box(xe.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return xe.box(xe.types.stsd,xe.STSD,xe.mp4a(e));if(t==="ac3"&&e.config)return xe.box(xe.types.stsd,xe.STSD,xe.ac3(e));if(t==="mp3"&&e.codec==="mp3")return xe.box(xe.types.stsd,xe.STSD,xe.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return xe.box(xe.types.stsd,xe.STSD,xe.avc1(e));if(t==="hevc"&&e.vps)return xe.box(xe.types.stsd,xe.STSD,xe.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/(jn+1)),o=Math.floor(i%(jn+1));return xe.box(xe.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=xe.sdtp(e),n=e.id,s=Math.floor(t/(jn+1)),r=Math.floor(t%(jn+1));return xe.box(xe.types.traf,xe.box(xe.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),xe.box(xe.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])),xe.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,xe.box(xe.types.trak,xe.tkhd(e),xe.mdia(e))}static trex(e){const t=e.id;return xe.box(xe.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,h,u,c,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++)h=i[o],u=h.duration,c=h.size,f=h.flags,d=h.cts,r.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,c>>>24&255,c>>>16&255,c>>>8&255,c&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 xe.box(xe.types.trun,r)}static initSegment(e){xe.types||xe.init();const t=xe.moov(e);return Ue(xe.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 v=0;v<i.length;v+=1){r+=3;for(let w=0;w<i[v].length;w+=1)r+=2+i[v][w].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const h=i.length-1;for(let v=0;v<i.length;v+=1){o.set(new Uint8Array([32+v|(v===h?128:0),0,i[v].length]),r),r+=3;for(let w=0;w<i[v].length;w+=1)o.set(new Uint8Array([i[v][w].length>>8,i[v][w].length&255]),r),r+=2,o.set(i[v][w],r),r+=i[v][w].length}const u=xe.box(xe.types.hvcC,o),c=e.width,f=e.height,d=e.pixelRatio[0],m=e.pixelRatio[1];return xe.box(xe.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,c>>8&255,c&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,xe.box(xe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),xe.box(xe.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,m>>24,m>>16&255,m>>8&255,m&255])))}}xe.types=void 0,xe.HDLR_TYPES=void 0,xe.STTS=void 0,xe.STSC=void 0,xe.STCO=void 0,xe.STSZ=void 0,xe.VMHD=void 0,xe.SMHD=void 0,xe.STSD=void 0,xe.FTYP=void 0,xe.DINF=void 0;const Va=9e4;function Sr(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function su(a,e,t=1,i=!1){return Sr(a,e,1/t,i)}function Ms(a,e=!1){return Sr(a,1e3,1/Va,e)}function ru(a,e=1){return Sr(a,Va,1/e)}const au=10*1e3,ou=1024,lu=1152,uu=1536;let _s=null,Ar=null;function ja(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 Ws extends P{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,_s===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);_s=r?parseInt(r[1]):0}if(Ar===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Ar=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((s,r)=>{let o=r.pts,h=o-s;return h<-4294967296&&(t=!0,o=qi(o,i),h=o-s),h>0?s:o},i);return t&&this.debug("PTS rollover detected"),n}remux(e,t,i,n,s,r,o,h){let u,c,f,d,m,v,w=s,T=s;const k=e.pid>-1,X=t.pid>-1,H=t.samples.length,ue=e.samples.length>0,ve=o&&H>0||H>1;if((!k||ue)&&(!X||ve)||this.ISGenerated||o){if(this.ISGenerated){var ce,Se,Ae,pe;const Tt=this.videoTrackConfig;(Tt&&(t.width!==Tt.width||t.height!==Tt.height||((ce=t.pixelRatio)==null?void 0:ce[0])!==((Se=Tt.pixelRatio)==null?void 0:Se[0])||((Ae=t.pixelRatio)==null?void 0:Ae[1])!==((pe=Tt.pixelRatio)==null?void 0:pe[1]))||!Tt&&ve||this.nextAudioTs===null&&ue)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const Fe=this.isVideoContiguous;let lt=-1,mt;if(ve&&(lt=hu(t.samples),!Fe&&this.config.forceKeyFrameOnDiscontinuity))if(v=!0,lt>0){this.warn(`Dropped ${lt} out of ${H} video samples due to a missing keyframe`);const Tt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(lt),t.dropped+=lt,T+=(t.samples[0].pts-Tt)/t.inputTimeScale,mt=T}else lt===-1&&(this.warn(`No keyframe found out of ${H} video samples`),v=!1);if(this.ISGenerated){if(ue&&ve){const Tt=this.getVideoStartPts(t.samples),st=(qi(e.samples[0].pts,Tt)-Tt)/t.inputTimeScale;w+=Math.max(0,st),T+=Math.max(0,-st)}if(ue){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,r)),c=this.remuxAudio(e,w,this.isAudioContiguous,r,X||ve||h===ne.AUDIO?T:void 0),ve){const Tt=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),f=this.generateIS(e,t,s,r)),u=this.remuxVideo(t,T,Fe,Tt)}}else ve&&(u=this.remuxVideo(t,T,Fe,0));u&&(u.firstKeyFrame=lt,u.independent=lt!==-1,u.firstKeyFramePTS=mt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(m=za(i,s,this._initPTS,this._initDTS)),n.samples.length&&(d=Ha(n,s,this._initPTS))),{audio:c,video:u,initSegment:f,independent:v,text:d,id3:m}}generateIS(e,t,i,n){const s=e.samples,r=t.samples,o=this.typeSupported,h={},u=this._initPTS;let c=!u||n,f="audio/mp4",d,m,v,w=-1;if(c&&(d=m=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}h.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):xe.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(w=e.id,v=e.inputTimeScale,!u||v!==u.timescale?d=m=s[0].pts-Math.round(v*i):c=!1)}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,h.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:xe.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(w=t.id,v=t.inputTimeScale,!u||v!==u.timescale){const T=this.getVideoStartPts(r),k=Math.round(v*i);m=Math.min(m,qi(r[0].dts,T)-k),d=Math.min(d,T-k)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(h).length)return this.ISGenerated=!0,c?(u&&this.warn(`Timestamps at playlist time: ${n?"":"~"}${i} ${d/v} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${d/v} (${d}/${v}) trackId: ${w}`),this._initPTS={baseTime:d,timescale:v,trackId:w},this._initDTS={baseTime:m,timescale:v,trackId:w}):d=v=void 0,{tracks:h,initPTS:d,timescale:v,trackId:w}}remuxVideo(e,t,i,n){const s=e.inputTimeScale,r=e.samples,o=[],h=r.length,u=this._initPTS,c=u.baseTime*s/u.timescale;let f=this.nextVideoTs,d=8,m=this.videoSampleDuration,v,w,T=Number.POSITIVE_INFINITY,k=Number.NEGATIVE_INFINITY,X=!1;if(!i||f===null){const rt=c+t*s,at=r[0].pts-qi(r[0].dts,r[0].pts);_s&&f!==null&&Math.abs(rt-at-(f+c))<15e3?i=!0:f=rt-at-c}const H=f+c;for(let rt=0;rt<h;rt++){const at=r[rt];at.pts=qi(at.pts,H),at.dts=qi(at.dts,H),at.dts<r[rt>0?rt-1:rt].dts&&(X=!0)}X&&r.sort(function(rt,at){const Nt=rt.dts-at.dts,Zt=rt.pts-at.pts;return Nt||Zt}),v=r[0].dts,w=r[r.length-1].dts;const ue=w-v,ve=ue?Math.round(ue/(h-1)):m||e.inputTimeScale/30;if(i){const rt=v-H,at=rt>ve,Nt=rt<-1;if((at||Nt)&&(at?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Ms(rt,!0)} ms (${rt}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Ms(-rt,!0)} ms (${rt}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Nt||H>=r[0].pts||_s)){v=H;const Zt=r[0].pts-rt;if(at)r[0].dts=v,r[0].pts=Zt;else{let Ut=!0;for(let zt=0;zt<r.length&&!(r[zt].dts>Zt&&Ut);zt++){const ki=r[zt].pts;if(r[zt].dts-=rt,r[zt].pts-=rt,zt<r.length-1){const Li=r[zt+1].pts,Xi=r[zt].pts,En=Li<=Xi,is=Li<=ki;Ut=En==is}}}this.log(`Video: Initial PTS/DTS adjusted: ${Ms(Zt,!0)}/${Ms(v,!0)}, delta: ${Ms(rt,!0)} ms`)}}v=Math.max(0,v);let Ie=0,ce=0,Se=v;for(let rt=0;rt<h;rt++){const at=r[rt],Nt=at.units,Zt=Nt.length;let Ut=0;for(let zt=0;zt<Zt;zt++)Ut+=Nt[zt].data.length;ce+=Ut,Ie+=Zt,at.length=Ut,at.dts<Se?(at.dts=Se,Se+=ve/4|0||1):Se=at.dts,T=Math.min(at.pts,T),k=Math.max(at.pts,k)}w=r[h-1].dts;const Ae=ce+4*Ie+8;let pe;try{pe=new Uint8Array(Ae)}catch(rt){this.observer.emit(p.ERROR,p.ERROR,{type:oe.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:rt,bytes:Ae,reason:`fail allocating video mdat ${Ae}`});return}const Fe=new DataView(pe.buffer);Fe.setUint32(0,Ae),pe.set(xe.types.mdat,4);let lt=!1,mt=Number.POSITIVE_INFINITY,Tt=Number.POSITIVE_INFINITY,_t=Number.NEGATIVE_INFINITY,st=Number.NEGATIVE_INFINITY;for(let rt=0;rt<h;rt++){const at=r[rt],Nt=at.units;let Zt=0;for(let ki=0,Li=Nt.length;ki<Li;ki++){const Xi=Nt[ki],En=Xi.data,is=Xi.data.byteLength;Fe.setUint32(d,is),d+=4,pe.set(En,d),d+=is,Zt+=4+is}let Ut;if(rt<h-1)m=r[rt+1].dts-at.dts,Ut=r[rt+1].pts-at.pts;else{const ki=this.config,Li=rt>0?at.dts-r[rt-1].dts:ve;if(Ut=rt>0?at.pts-r[rt-1].pts:ve,ki.stretchShortVideoTrack&&this.nextAudioTs!==null){const Xi=Math.floor(ki.maxBufferHole*s),En=(n?T+n*s:this.nextAudioTs+c)-at.pts;En>Xi?(m=En-Li,m<0?m=Li:lt=!0,this.log(`It is approximately ${En/90} ms to the next segment; using duration ${m/90} ms for the last video frame.`)):m=Li}else m=Li}const zt=Math.round(at.pts-at.dts);mt=Math.min(mt,m),_t=Math.max(_t,m),Tt=Math.min(Tt,Ut),st=Math.max(st,Ut),o.push(ja(at.key,m,Zt,zt))}if(o.length){if(_s){if(_s<70){const rt=o[0].flags;rt.dependsOn=2,rt.isNonSync=0}}else if(Ar&&st-Tt<_t-mt&&ve/_t<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let rt=v;for(let at=0,Nt=o.length;at<Nt;at++){const Zt=rt+o[at].duration,Ut=rt+o[at].cts;if(at<Nt-1){const zt=Zt+o[at+1].cts;o[at].duration=zt-Ut}else o[at].duration=at?o[at-1].duration:ve;o[at].cts=0,rt=Zt}}}m=lt||!m?ve:m;const bt=w+m;this.nextVideoTs=f=bt-c,this.videoSampleDuration=m,this.isVideoContiguous=!0;const Ot={data1:xe.moof(e.sequenceNumber++,v,g(e,{samples:o})),data2:pe,startPTS:(T-c)/s,endPTS:(k+m-c)/s,startDTS:(v-c)/s,endDTS:f/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Ot}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return lu;case"ac3":return uu;default:return ou}}remuxAudio(e,t,i,n,s){const r=e.inputTimeScale,o=e.samplerate?e.samplerate:r,h=r/o,u=this.getSamplesPerFrame(e),c=u*h,f=this._initPTS,d=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,m=[],v=s!==void 0;let w=e.samples,T=d?0:8,k=this.nextAudioTs||-1;const X=f.baseTime*r/f.timescale,H=X+t*r;if(this.isAudioContiguous=i=i||w.length&&k>0&&(n&&Math.abs(H-(k+X))<9e3||Math.abs(qi(w[0].pts,H)-(k+X))<20*c),w.forEach(function(st){st.pts=qi(st.pts,H)}),!i||k<0){if(w=w.filter(st=>st.pts>=0),!w.length)return;s===0?k=0:n&&!v?k=Math.max(0,H-X):k=w[0].pts-X}if(e.segmentCodec==="aac"){const st=this.config.maxAudioFramesDrift;for(let bt=0,ft=k+X;bt<w.length;bt++){const xt=w[bt],Ot=xt.pts,rt=Ot-ft,at=Math.abs(1e3*rt/r);if(rt<=-st*c&&v)bt===0&&(this.warn(`Audio frame @ ${(Ot/r).toFixed(3)}s overlaps marker by ${Math.round(1e3*rt/r)} ms.`),this.nextAudioTs=k=Ot-X,ft=Ot);else if(rt>=st*c&&at<au&&v){let Nt=Math.round(rt/c);for(ft=Ot-Nt*c;ft<0&&Nt&&c;)Nt--,ft+=c;bt===0&&(this.nextAudioTs=k=ft-X),this.warn(`Injecting ${Nt} audio frames @ ${((ft-X)/r).toFixed(3)}s due to ${Math.round(1e3*rt/r)} ms gap.`);for(let Zt=0;Zt<Nt;Zt++){let Ut=nu.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Ut||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Ut=xt.unit.subarray()),w.splice(bt,0,{unit:Ut,pts:ft}),ft+=c,bt++}}xt.pts=ft,ft+=c}}let ue=null,ve=null,Ie,ce=0,Se=w.length;for(;Se--;)ce+=w[Se].unit.byteLength;for(let st=0,bt=w.length;st<bt;st++){const ft=w[st],xt=ft.unit;let Ot=ft.pts;if(ve!==null){const at=m[st-1];at.duration=Math.round((Ot-ve)/h)}else if(i&&e.segmentCodec==="aac"&&(Ot=k+X),ue=Ot,ce>0){ce+=T;try{Ie=new Uint8Array(ce)}catch(at){this.observer.emit(p.ERROR,p.ERROR,{type:oe.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:at,bytes:ce,reason:`fail allocating audio mdat ${ce}`});return}d||(new DataView(Ie.buffer).setUint32(0,ce),Ie.set(xe.types.mdat,4))}else return;Ie.set(xt,T);const rt=xt.byteLength;T+=rt,m.push(ja(!0,u,rt,0)),ve=Ot}const Ae=m.length;if(!Ae)return;const pe=m[m.length-1];k=ve-X,this.nextAudioTs=k+h*pe.duration;const Fe=d?new Uint8Array(0):xe.moof(e.sequenceNumber++,ue/h,g({},e,{samples:m}));e.samples=[];const lt=(ue-X)/r,mt=k/r,_t={data1:Fe,data2:Ie,startPTS:lt,endPTS:mt,startDTS:lt,endDTS:mt,type:"audio",hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,_t}}function qi(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 hu(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function za(a,e,t,i){const n=a.samples.length;if(!n)return;const s=a.inputTimeScale;for(let o=0;o<n;o++){const h=a.samples[o];h.pts=qi(h.pts-t.baseTime*s/t.timescale,e*s)/s,h.dts=qi(h.dts-i.baseTime*s/i.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function Ha(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=qi(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 cu extends P{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=Ce(e);if(t)je(e,t);else{const h=s||r;h!=null&&h.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${h.codec}")!`)}s&&(i=Wa(s,R.AUDIO,this)),r&&(n=Wa(r,R.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,h;let{initPTS:u,lastEndTime:c}=this;const f={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};N(c)||(c=this.lastEndTime=s||0);const d=t.samples;if(!d.length)return f;const m={initPTS:void 0,timescale:void 0,trackId:void 0};let v=this.initData;if((o=v)!=null&&o.length||(this.generateInitSegment(d),v=this.initData),!((h=v)!=null&&h.length))return this.warn("Failed to generate initSegment."),f;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1);const w=Qe(d,v,this),T=v.audio?w[v.audio.id]:null,k=v.video?w[v.video.id]:null,X=Ys(k,1/0),H=Ys(T,1/0),ue=Ys(k,0,!0),ve=Ys(T,0,!0);let Ie=s,ce=0;const Se=T&&(!k||!u&&H<X||u&&u.trackId===v.audio.id),Ae=Se?T:k;if(Ae){const ft=Ae.timescale,xt=Ae.start-s*ft,Ot=Se?v.audio.id:v.video.id;Ie=Ae.start/ft,ce=Se?ve-H:ue-X,(r||!u)&&(fu(u,Ie,s,ce)||ft!==u.timescale)&&(u&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${xt/ft} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${Ie-s} (${xt}/${ft}) trackId: ${Ot}`),u=null,m.initPTS=xt,m.timescale=ft,m.trackId=Ot)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);u?(m.initPTS=u.baseTime,m.timescale=u.timescale,m.trackId=u.trackId):((!m.timescale||m.trackId===void 0||m.initPTS===void 0)&&(this.warn("Could not set initPTS"),m.initPTS=Ie,m.timescale=1,m.trackId=-1),this.initPTS=u={baseTime:m.initPTS,timescale:m.timescale,trackId:m.trackId});const pe=Ie-u.baseTime/u.timescale,Fe=pe+ce;ce>0?this.lastEndTime=Fe:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const lt=!!v.audio,mt=!!v.video;let Tt="";lt&&(Tt+="audio"),mt&&(Tt+="video");const _t=(v.audio?v.audio.encrypted:!1)||(v.video?v.video.encrypted:!1),st={data1:d,startPTS:pe,startDTS:pe,endPTS:Fe,endDTS:Fe,type:Tt,hasAudio:lt,hasVideo:mt,nb:1,dropped:0,encrypted:_t};f.audio=lt&&!mt?st:void 0,f.video=mt?st:void 0;const bt=k==null?void 0:k.sampleCount;if(bt){const ft=k.keyFrameIndex,xt=ft!==-1;st.nb=bt,st.dropped=ft===0||this.isVideoContiguous?0:xt?ft:bt,st.independent=xt,st.firstKeyFrame=ft,xt&&k.keyFrameStart&&(st.firstKeyFramePTS=(k.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(f.independent=xt),this.isVideoContiguous||(this.isVideoContiguous=xt),st.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${ft}/${bt} dropped: ${st.dropped} start: ${st.firstKeyFramePTS||"NA"}`)}return f.initSegment=m,f.id3=za(i,s,u,u),n.samples.length&&(f.text=Ha(n,s,u)),f}}function Ys(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function fu(a,e,t,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 Wa(a,e,t){const i=a.codec;return i&&i.length>4?i:e===R.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?Z(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 Pn;try{Pn=self.performance.now.bind(self.performance)}catch(a){Pn=Date.now}const Zs=[{demux:Xl,remux:cu},{demux:Vn,remux:Ws},{demux:Wl,remux:Ws},{demux:Zl,remux:Ws}];Zs.splice(2,0,{demux:Yl,remux:Ws});class Ya{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=Pn();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:h}=this;n&&(this.currentTransmuxState=n);const{contiguous:u,discontinuity:c,trackSwitch:f,accurateTimeOffset:d,timeOffset:m,initSegmentChange:v}=n||o,{audioCodec:w,videoCodec:T,defaultInitPts:k,duration:X,initSegmentData:H}=h,ue=du(r,t);if(ue&&fn(ue.method)){const Se=this.getDecrypter(),Ae=Ii(ue.method);if(Se.isSync()){let pe=Se.softwareDecrypt(r,ue.key.buffer,ue.iv.buffer,Ae);if(i.part>-1){const lt=Se.flush();pe=lt&<.buffer}if(!pe)return s.executeEnd=Pn(),Dr(i);r=new Uint8Array(pe)}else return this.asyncResult=!0,this.decryptionPromise=Se.webCryptoDecrypt(r,ue.key.buffer,ue.iv.buffer,Ae).then(pe=>{const Fe=this.push(pe,null,i);return this.decryptionPromise=null,Fe}),this.decryptionPromise}const ve=this.needsProbing(c,f);if(ve){const Se=this.configureTransmuxer(r);if(Se)return this.logger.warn(`[transmuxer] ${Se.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:oe.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,error:Se,reason:Se.message}),s.executeEnd=Pn(),Dr(i)}(c||f||v||ve)&&this.resetInitSegment(H,w,T,X,t),(c||v||ve)&&this.resetInitialTimestamp(k),u||this.resetContiguity();const Ie=this.transmux(r,ue,m,d,i);this.asyncResult=Ns(Ie);const ce=this.currentTransmuxState;return ce.contiguous=!0,ce.discontinuity=!1,ce.trackSwitch=!1,s.executeEnd=Pn(),Ie}flush(e){const t=e.transmuxing;t.executeStart=Pn();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:h,remuxer:u}=this;if(!h||!u){t.executeEnd=Pn();const f=[Dr(e)];return this.asyncResult?Promise.resolve(f):f}const c=h.flush(o);return Ns(c)?(this.asyncResult=!0,c.then(f=>(this.flushRemux(r,f,e),r))):(this.flushRemux(r,c,e),this.asyncResult?Promise.resolve(r):r)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:s,id3Track:r,textTrack:o}=t,{accurateTimeOffset:h,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===ne.MAIN?"level":"track"} ${i.level}`);const c=this.remuxer.remux(n,s,r,o,u,h,!0,this.id);e.push({remuxResult:c,chunkMeta:i}),i.transmuxing.executeEnd=Pn()}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:h}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,r,o,h,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=Zs.length;f<d;f++){var r;if((r=Zs[f].demux)!=null&&r.probe(e,this.logger)){s=Zs[f];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,h=this.remuxer,u=s.remux,c=s.demux;(!h||!(h instanceof u))&&(this.remuxer=new u(i,t,n,this.logger)),(!o||!(o instanceof c))&&(this.demuxer=new c(i,t,n,this.logger),this.probe=c.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Nn(this.config)),e}}function du(a,e){let t=null;return a.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Dr=a=>({remuxResult:{},chunkMeta:a});function Ns(a){return"then"in a&&a.then instanceof Function}class pu{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 gu{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 Za=0;class qa{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Za++,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=h=>{const u=h.data,c=this.hls;if(!(!c||!(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":{c.logger[u.data.logType]&&c.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,c.trigger(u.event,u.data);break}}},this.onWorkerError=h=>{if(!this.hls)return;const u=new Error(`${h.message} (${h.filename}:${h.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:oe.OTHER_ERROR,details:V.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=(h,u)=>{u=u||{},u.frag=this.frag||void 0,h===p.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(h,u)};this.observer=new gr,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=ct(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const h=this.hls.logger;if(s.workerPath||yl()){try{s.workerPath?(h.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=bl(s.workerPath)):(h.log(`injecting Web Worker for "${t}"`),this.workerContext=El());const{worker:c}=this.workerContext;c.addEventListener("message",this.onWorkerMessage),c.addEventListener("error",this.onWorkerError),c.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:kt(s)})}catch(c){h.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.terminateWorker(),this.error=null,this.transmuxer=new Ya(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new Ya(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Za++;const t=this.hls.config,i=ct(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:kt(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),xl(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,n,s,r,o,h,u,c){var f,d;u.transmuxing.start=self.performance.now();const{instanceNo:m,transmuxer:v}=this,w=r?r.start:s.start,T=s.decryptdata,k=this.frag,X=!(k&&s.cc===k.cc),H=!(k&&u.level===k.level),ue=k?u.sn-k.sn:-1,ve=this.part?u.part-this.part.index:-1,Ie=ue===0&&u.id>1&&u.id===(k==null?void 0:k.stats.chunkCount),ce=!H&&(ue===1||ue===0&&(ve===1||Ie&&ve<=0)),Se=self.performance.now();(H||ue||s.stats.parsing.start===0)&&(s.stats.parsing.start=Se),r&&(ve||!ce)&&(r.stats.parsing.start=Se);const Ae=!(k&&((f=s.initSegment)==null?void 0:f.url)===((d=k.initSegment)==null?void 0:d.url)),pe=new gu(X,ce,h,H,w,Ae);if(!ce||X||Ae){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===ne.MAIN?"level":"track"}: ${u.level} id: ${u.id}
|
|
discontinuity: ${X}
|
|
trackSwitch: ${H}
|
|
contiguous: ${ce}
|
|
accurateTimeOffset: ${h}
|
|
timeOffset: ${w}
|
|
initSegmentChange: ${Ae}`);const Fe=new pu(i,n,t,o,c);this.configureTransmuxer(Fe)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:m,cmd:"demux",data:e,decryptdata:T,chunkMeta:u,state:pe},e instanceof ArrayBuffer?[e]:[]);else if(v){const Fe=v.push(e,T,u,pe);Ns(Fe)?Fe.then(lt=>{this.handleTransmuxComplete(lt)}).catch(lt=>{this.transmuxerError(lt,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(Fe)}}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);Ns(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:oe.MEDIA_ERROR,details:V.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 Xa=100;class mu extends dr{constructor(e,t,i){super(e,t,i,"audio-stream-controller",ne.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===ne.MAIN){const o=t.cc,h=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===Me.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&&h&&h.cc!==o?(h.abortRequests(),this.syncWithAnchor(t,h)):this.state===Me.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(),h=$i(r,s,o);h&&(this.log(`Syncing with main frag at ${h.start} cc ${h.cc}`),this.startFragRequested=!1,this.nextLoadPosition=h.start,this.resetLoadingState(),this.state===Me.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=Me.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Xa),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=Me.IDLE):this.state=Me.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case Me.IDLE:this.doTickIdle();break;case Me.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=Me.WAITING_INIT_PTS}break}case Me.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case Me.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=Me.FRAG_LOADING;const o=n.flush().buffer,h={frag:t,part:i,payload:o,networkDetails:null};this._handleFragmentLoadProgress(h),s&&super._handleFragmentLoadComplete(h)}else r&&r.cc!==e.frag.cc&&this.syncWithAnchor(r,e.frag)}else this.state=Me.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],h=o.details;if(!h||this.waitForLive(o)||this.waitForCdnTuneIn(h)){this.state=Me.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,R.AUDIO,ne.AUDIO));const c=this.getFwdBufferInfo(u,ne.AUDIO);if(c===null)return;if(!this.switchingTrack&&this._streamEnded(c,h)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=Me.ENDED;return}const f=c.len,d=t.maxBufferLength,m=h.fragments,v=m[0].start,w=this.getLoadPosition(),T=this.flushing?w:c.end;if(this.switchingTrack&&n){const H=w;h.PTSKnown&&H<v&&(c.end>v||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=v+.05)}if(f>=d&&!this.switchingTrack&&T<m[m.length-1].start)return;let k=this.getNextFragment(T,h);if(k&&this.isLoopLoading(k,T)&&(k=this.getNextFragmentLoopLoading(k,h,c,ne.MAIN,d)),!k){this.bufferFlushed=!0;return}let X=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&X&&Te(k)&&!k.endList&&(!h.live||!this.loadingParts&&T<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(X)===Qt.OK&&(this.mainFragLoading=X=null),X&&Te(X))){if(k.start>X.end){const ue=this.fragmentTracker.getFragAtPos(T,ne.MAIN);ue&&ue.end>X.end&&(X=ue,this.mainFragLoading={frag:ue,targetBufferTime:null})}if(k.start>X.end)return}this.loadFragment(k,o,T)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new xi(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!==Me.STOPPED&&(this.setInterval(Xa),this.state=Me.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:h}=t;if(!n){this.warn(`Audio tracks reset while loading track ${r} "${h.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||s.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==Me.STOPPED&&(this.state=Me.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${r} "${h.name}" of "${o}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const c=n[r];let f=0;if(s.live||(i=c.details)!=null&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(c.details){var d;f=this.alignPlaylists(s,c.details,(d=this.levelLastLoaded)==null?void 0:d.details)}s.alignedSliding||(Ta(s,u),s.alignedSliding||Ks(s,u),f=s.fragmentStart)}c.details=s,this.levelLastLoaded=c,this.startFragRequested||this.setStartPosition(u,f),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===Me.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=Me.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{config:r,trackId:o,levels:h}=this;if(!h){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=h[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const c=u.details;if(!c){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 qa(this.hls,ne.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const m=this.initPTS[i.cc],v=(t=i.initSegment)==null?void 0:t.data;if(m!==void 0){const T=n?n.index:-1,k=T!==-1,X=new Fi(i.level,i.sn,i.stats.chunkCount,s.byteLength,T,k);d.push(s,v,f,"",i,n,c.totalduration,!1,X,m)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${c.startSN} ,${c.endSN}],track ${o}`);const{cache:w}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new Sa,complete:!1};w.push(new Uint8Array(s)),this.state!==Me.STOPPED&&(this.state=Me.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===ne.MAIN&&Te(t.frag)&&(this.mainFragLoading=t,this.state===Me.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==ne.AUDIO){!this.audioOnly&&i.type===ne.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(Te(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,y({},s)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=Me.ERROR;return}switch(t.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ne.AUDIO,t);break;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Me.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===ge.AUDIO_TRACK&&(this.state=Me.IDLE);break;case V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case V.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case V.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==R.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==R.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Me.ENDED&&(this.state=Me.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,ne.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:h,part:u,level:c}=o,{details:f}=c,{audio:d,text:m,id3:v,initSegment:w}=s;if(this.fragContextChanged(h)||!f){this.fragmentTracker.removeFragment(h);return}if(this.state=Me.PARSING,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),w!=null&&w.tracks){const T=h.initSegment||h;if(this.unhandledEncryptionError(w,h))return;this._bufferInitSegment(c,w.tracks,T,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:i,tracks:w.tracks})}if(d){const{startPTS:T,endPTS:k,startDTS:X,endDTS:H}=d;u&&(u.elementaryStreams[R.AUDIO]={startPTS:T,endPTS:k,startDTS:X,endDTS:H}),h.setElementaryStreamInfo(R.AUDIO,T,k,X,H),this.bufferFragmentData(d,h,u,r)}if(v!=null&&(t=v.samples)!=null&&t.length){const T=g({id:i,frag:h,details:f},v);n.trigger(p.FRAG_PARSING_METADATA,T)}if(m){const T=g({id:i,frag:h,details:f},m);n.trigger(p.FRAG_PARSING_USERDATA,T)}}_bufferInitSegment(e,t,i,n){if(this.state!==Me.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=ne.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 h={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:o};this.hls.trigger(p.BUFFER_APPENDING,h)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);if(this.switchingTrack||n===Qt.NOT_LOADED||n===Qt.PARTIAL){var s;if(!Te(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=Me.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&Ks(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;di({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,Ji)||(xn(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,y({},e))}}class Lr extends P{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 h;try{h=new self.URL(o.URI,t.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),h=o.URI||""}if(h===e){s=r;break}else h===e.substring(0,h.length)&&(s=r)}if(s!==-1){const r=n[s],o=parseInt(r["LAST-MSN"])||t.lastPartSn;let h=parseInt(r["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const c=Math.min(t.age-t.partTarget,t.targetduration);h>=0&&c>t.partTarget&&(h+=1)}const u=i&&bi(i);return new Gt(o,h>=0?h: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 h=this.hls.config.timelineOffset;if(h!==n.appliedTimelineOffset){const c=Math.max(h||0,0);n.appliedTimelineOffset=c,n.fragments.forEach(f=>{f.setStart(f.playlistOffset+c)})}if(n.live||i!=null&&i.live){const c="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){ll(i,n,this);const X=n.playlistParsingError;if(X){this.warn(X);const H=this.hls;if(!H.config.ignorePlaylistParsingErrors){var u;const{networkDetails:ue}=t;H.trigger(p.ERROR,{type:oe.NETWORK_ERROR,details:V.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:X,reason:X.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,m=(n.edge-d)*1e3,v=ga(n,m);if(n.requestScheduled+v<r?n.requestScheduled=r:n.requestScheduled+=v,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let w,T,k;if(n.canBlockReload&&n.endSN&&n.advanced){const X=this.hls.config.lowLatencyMode,H=n.lastPartSn,ue=n.endSN,ve=n.lastPartIndex,Ie=ve!==-1,ce=H===ue;Ie?ce?(T=ue+1,k=X?0:ve):(T=H,k=X?ve+1:n.maxPartIndex):T=ue+1;const Se=n.age,Ae=Se+n.ageHeader;let pe=Math.min(Ae-n.partTarget,n.targetduration*1.5);if(pe>0){if(Ae>n.targetduration*3)this.log(`Playlist last advanced ${Se.toFixed(2)}s ago. Omitting segment and part directives.`),T=void 0,k=void 0;else if(i!=null&&i.tuneInGoal&&Ae-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${pe} with playlist age: ${n.age}`),pe=0;else{const Fe=Math.floor(pe/n.targetduration);if(T+=Fe,k!==void 0){const lt=Math.round(pe%n.targetduration/n.partTarget);k+=lt}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${Se.toFixed(2)}s goal: ${pe} skip sn ${Fe} to part ${k}`)}n.tuneInGoal=pe}if(w=this.getDeliveryDirectives(n,t.deliveryDirectives,T,k),X||!ce){n.requestScheduled=r,this.loadingPlaylist(c,w);return}}else(n.canBlockReload||n.canSkipUntil)&&(w=this.getDeliveryDirectives(n,t.deliveryDirectives,T,k));w&&T!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(v-o*2,v/2)),this.scheduleLoading(c,w,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=bi(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=ti.No),new Gt(i,n,s)}checkRetry(e){const t=e.details,i=Wi(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},h=!!n&&!!o&&(s===ui.RetryRequest||!n.resolved&&s===ui.SendAlternateToPenaltyBox);if(h){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 c=Fn(o,r);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),c),this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" in ${c}ms`)}e.levelRetry=!0,n.resolved=!0}return h}}function Qa(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!Bs(a[t].attrs,e[t].attrs))return!1;return!0}function Bs(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 Rr(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class _u extends Lr{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,m)=>{d.id=m});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const h=this.hls.config.audioPreference;if(!s&&h){const d=Ai(h,o,Ji);if(d>-1)s=o[d];else{const m=Ai(h,this.tracks);s=this.tracks[m]}}let u=this.findTrackId(s);u===-1&&s&&(u=this.findTrackId(null));const c={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,c);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:oe.MEDIA_ERROR,details:V.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:d})}}}onError(e,t){t.fatal||!t.context||t.context.type===ge.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&&di(e,n,Ji))return n;const s=Ai(e,this.tracksInGroup,Ji);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=rs(e,t.levels,i,r,Ji);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=Ai(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,y({},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||di(e,n,Ji)))return i}if(e){const{name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:h}=e;for(let u=0;u<t.length;u++){const c=t[u];if(di({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:h},c,Ji))return u}for(let u=0;u<t.length;u++){const c=t[u];if(Bs(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const c=t[u];if(Bs(e.attrs,c.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&xn(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 vu{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 Ja=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,eo="HlsJsTrackRemovedError";class yu extends Error{constructor(e){super(e),this.name=eo}}class Eu extends P{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=fe(te(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?g(i,n.tracks):this.sourceBuffers.forEach(s=>{const[r]=s;r&&(i[r]=g({},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=te(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 h=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||h&&r instanceof h,to(i),bu(i,o),i.load()}catch(h){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: ${kt(i,(h,u)=>h==="initSegment"?void 0:u)};
|
|
transfer tracks: ${kt(n,(h,u)=>h==="initSegment"?void 0:u)}}`),!me(n,i)){t.mediaSource=null,t.tracks=void 0;const h=e.currentTime,u=this.details,c=Math.max(h,(u==null?void 0:u.fragments[0].start)||0);if(c-h>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${h} -> ${c}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(i)}") start time: ${c} currentTime: ${h}`),this.onMediaDetaching(p.MEDIA_DETACHING,{}),this.onMediaAttaching(p.MEDIA_ATTACHING,t),e.currentTime=c;return}this.transferData=void 0,s.forEach(h=>{const u=h,c=n[u];if(c){const f=c.buffer;if(f){const d=this.fragmentTracker,m=c.id;if(d.hasFragments(m)||d.hasParts(m)){const T=Lt.getBuffered(f);d.detectEvictedFragments(u,T,m,null,!0)}const v=Ir(u),w=[u,f];this.sourceBuffers[v]=w,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,c)}}}),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 h=s.sourceBuffers;for(let u=h.length;u--;)o&&h[u].abort(),s.removeSourceBuffer(h[u]);o&&s.endOfStream()}catch(h){this.warn(`onMediaDetaching: ${h.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&&to(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[Ir(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new vu(this.tracks)}onBufferCodecs(e,t){const i=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),r=!s&&this.sourceBufferCount&&this.media&&n.some(o=>!i[o]);if(s||r){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${n}" SourceBuffers`);return}n.forEach(o=>{var h,u;const c=t[o],{id:f,codec:d,levelCodec:m,container:v,metadata:w,supplemental:T}=c;let k=i[o];const X=(h=this.transferData)==null||(h=h.tracks)==null?void 0:h[o],H=X!=null&&X.buffer?X:k,ue=(H==null?void 0:H.pendingCodec)||(H==null?void 0:H.codec),ve=H==null?void 0:H.levelCodec;k||(k=i[o]={buffer:void 0,listeners:[],codec:d,supplemental:T,container:v,levelCodec:m,metadata:w,id:f});const Ie=re(ue,ve),ce=Ie==null?void 0:Ie.replace(Ja,"$1");let Se=re(d,m);const Ae=(u=Se)==null?void 0:u.replace(Ja,"$1");Se&&Ie&&ce!==Ae&&(o.slice(0,5)==="audio"&&(Se=Z(Se,this.appendSource)),this.log(`switching codec ${ue} to ${Se}`),Se!==(k.pendingCodec||k.codec)&&(k.pendingCodec=Se),k.container=v,this.appendChangeType(o,v,Se))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const 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,ne.MAIN))==null?void 0:t.gap)===!0)return;const r={label:"block-audio",execute:()=>{var o;const h=this.tracks.video;(this.lastVideoAppendEnd>n||h!=null&&h.buffer&&Lt.isBuffered(h.buffer,n)||((o=this.fragmentTracker.getAppendedFrag(n,ne.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:h,chunkMeta:u,offset:c}=t,f=u.buffering[s],{sn:d,cc:m}=o,v=self.performance.now();f.start=v;const w=o.stats.buffering,T=h?h.stats.buffering:null;w.start===0&&(w.start=v),T&&T.start===0&&(T.start=v);const k=i.audio;let X=!1;s==="audio"&&(k==null?void 0:k.container)==="audio/mpeg"&&(X=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const H=i.video,ue=H==null?void 0:H.buffer;if(ue&&d!=="initSegment"){const ce=h||o,Se=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend&&!(H.ending||H.ended)){const pe=ce.start+ce.duration*.05,Fe=ue.buffered,lt=this.currentOp("video");!Fe.length&&!lt?this.blockAudio(ce):!lt&&!Lt.isBuffered(ue,pe)&&this.lastVideoAppendEnd<pe&&this.blockAudio(ce)}else if(s==="video"){const Ae=ce.end;if(Se){const pe=Se.frag.start;(Ae>pe||Ae<this.lastVideoAppendEnd||Lt.isBuffered(ue,pe))&&this.unblockAudio()}this.lastVideoAppendEnd=Ae}}const ve=(h||o).start,Ie={label:`append-${s}`,execute:()=>{var ce;f.executeStart=self.performance.now();const Se=(ce=this.tracks[s])==null?void 0:ce.buffer;Se&&(X?this.updateTimestampOffset(Se,ve,.1,s,d,m):c!==void 0&&N(c)&&this.updateTimestampOffset(Se,c,1e-6,s,d,m)),this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const ce=self.performance.now();f.executeEnd=f.end=ce,w.first===0&&(w.first=ce),T&&T.first===0&&(T.first=ce);const Se={};this.sourceBuffers.forEach(([Ae,pe])=>{Ae&&(Se[Ae]=Lt.getBuffered(pe))}),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:h,chunkMeta:u,parent:o.type,timeRanges:Se})},onError:ce=>{var Se;const Ae={type:oe.MEDIA_ERROR,parent:o.type,details:V.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:h,chunkMeta:u,error:ce,err:ce,fatal:!1},pe=(Se=this.media)==null?void 0:Se.error;if(ce.code===DOMException.QUOTA_EXCEEDED_ERR||ce.name=="QuotaExceededError"||"quota"in ce)Ae.details=V.BUFFER_FULL_ERROR;else if(ce.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!pe)Ae.errorAction=tn(!0);else if(ce.name===eo&&this.sourceBufferCount===0)Ae.errorAction=tn(!0);else{const Fe=++this.appendErrors[s];this.warn(`Failed ${Fe}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${pe||"no media error"})`),(Fe>=this.hls.config.appendErrorMaxRetry||pe)&&(Ae.fatal=!0)}this.hls.trigger(p.ERROR,Ae)}};this.append(Ie,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[R.AUDIOVIDEO]?s.push("audiovideo"):(r[R.AUDIO]&&s.push("audio"),r[R.VIDEO]&&s.push("video"));const o=()=>{const h=self.performance.now();i.stats.buffering.end=h,n&&(n.stats.buffering.end=h);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(h=>{this.warn(`Fragment buffered callback ${h}`),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===V.BUFFER_APPEND_ERROR&&t.frag){var i;const n=(i=t.errorAction)==null?void 0:i.nextAutoLevel;N(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(N(o)&&o>=0){const u=Math.max(o,r),c=Math.floor(s/r)*r-u;this.flushBackBuffer(s,r,c)}const h=n.frontBufferFlushThreshold;if(N(h)&&h>0){const u=Math.max(n.maxBufferLength,h),c=Math.max(u,r),f=Math.floor(s/r)*r+c;this.flushFrontBuffer(s,r,f)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const o=Lt.getBuffered(s);if(o.length>0&&i>o.start(0)){var r;this.hls.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:i});const h=this.tracks[n];if((r=this.details)!=null&&r.live)this.hls.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(h!=null&&h.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=Lt.getBuffered(s),o=r.length;if(o<2)return;const h=r.start(o-1),u=r.end(o-1);if(i>h||e>=h&&e<=u)return;this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:h,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),c=Math.max(u,n);return{duration:1/0,start:u,end:c}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return N(s)?{duration:s}:null;const r=this.media.duration,o=N(i.duration)?i.duration:0;return n>o&&n>r||!N(r)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(N(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}) ${kt(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:oe.MEDIA_ERROR,details:V.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 h=this.getTrackCodec(o,r),u=`${o.container};codecs=${h}`;o.codec=h,this.log(`creating sourceBuffer(${u})${this.currentOp(r)?" Queued":""} ${kt(o)}`);try{const c=i.addSourceBuffer(u),f=Ir(r),d=[r,c];t[f]=d,o.buffer=c}catch(c){var n;this.error(`error while trying to add sourceBuffer: ${c.message}`),this.shiftAndExecuteNext(r),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[r],this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:V.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,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")&&Bt(i,"video")&&(n=se(n,i));const s=re(n,e.levelCodec);return s?t.slice(0,5)==="audio"?Z(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:oe.MEDIA_ERROR,details:V.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 h=N(n.duration)?n.duration:1/0,u=N(s.duration)?s.duration:1/0,c=Math.max(0,t),f=Math.min(i,h,u);f>c&&(!r.ending||r.ended)?(r.ended=!1,this.log(`Removing [${c},${f}] from the ${e} SourceBuffer`),o.remove(c,f)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=i==null?void 0:i.buffer;if(!n)throw new yu(`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 to(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function bu(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function Ir(a){return a==="audio"?1:0}class kr{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&&N(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,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,kr.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,h)=>h?o.width!==h.width||o.height!==h.height:!0;let s=e.length-1;const r=Math.max(t,i);for(let o=0;o<e.length;o+=1){const h=e[o];if((h.width>=r||h.height>=r)&&n(h,e[o+1])){s=o;break}}return s}}const Ki={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},xu={HLS:"h"};class _n{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof _n?i:new _n(i))),this.value=e,this.params=t}}const Tu="Dict";function wu(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 Su(a,e,t,i){return new Error(`failed to ${a} "${wu(e)}" as ${t}`,{cause:i})}function vn(a,e,t){return Su("serialize",a,e,t)}class io{constructor(e){this.description=e}}const no="Bare Item",Au="Boolean";function Du(a){if(typeof a!="boolean")throw vn(a,Au);return a?"?1":"?0"}function Lu(a){return btoa(String.fromCharCode(...a))}const Ru="Byte Sequence";function Iu(a){if(ArrayBuffer.isView(a)===!1)throw vn(a,Ru);return`:${Lu(a)}:`}const ku="Integer";function Cu(a){return a<-999999999999999||999999999999999<a}function so(a){if(Cu(a))throw vn(a,ku);return a.toString()}function Pu(a){return`@${so(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 Ou="Decimal";function Fu(a){const e=ro(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw vn(a,Ou);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Mu="String",Nu=/[\x00-\x1f\x7f]+/;function Bu(a){if(Nu.test(a))throw vn(a,Mu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Uu(a){return a.description||a.toString().slice(7,-1)}const $u="Token";function ao(a){const e=Uu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw vn(e,$u);return e}function Cr(a){switch(typeof a){case"number":if(!N(a))throw vn(a,no);return Number.isInteger(a)?so(a):Fu(a);case"string":return Bu(a);case"symbol":return ao(a);case"boolean":return Du(a);case"object":if(a instanceof Date)return Pu(a);if(a instanceof Uint8Array)return Iu(a);if(a instanceof io)return ao(a);default:throw vn(a,no)}}const Gu="Key";function Pr(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw vn(a,Gu);return a}function Or(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${Pr(e)}`:`;${Pr(e)}=${Cr(t)}`).join("")}function oo(a){return a instanceof _n?`${Cr(a.value)}${Or(a.params)}`:Cr(a)}function Ku(a){return`(${a.value.map(oo).join(" ")})${Or(a.params)}`}function Vu(a,e={whitespace:!0}){if(typeof a!="object"||a==null)throw vn(a,Tu);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof _n||(s=new _n(s));let r=Pr(n);return s.value===!0?r+=Or(s.params):(r+="=",Array.isArray(s.value)?r+=Ku(s):r+=oo(s)),r}).join(`,${i}`)}function lo(a,e){return Vu(a,e)}const yn="CMCD-Object",fi="CMCD-Request",es="CMCD-Session",zn="CMCD-Status",ju={br:yn,ab:yn,d:yn,ot:yn,tb:yn,tpb:yn,lb:yn,tab:yn,lab:yn,url:yn,pb:fi,bl:fi,tbl:fi,dl:fi,ltc:fi,mtp:fi,nor:fi,nrr:fi,rc:fi,sn:fi,sta:fi,su:fi,ttfb:fi,ttfbb:fi,ttlb:fi,cmsdd:fi,cmsds:fi,smrt:fi,df:fi,cs:fi,ts:fi,cid:es,pr:es,sf:es,sid:es,st:es,v:es,msd:es,bs:zn,bsd:zn,cdn:zn,rtp:zn,bg:zn,pt:zn,ec:zn,e:zn},zu={REQUEST:fi};function Hu(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 Wu(a,e){const t={};if(!a)return t;const i=Object.keys(a),n=e?Hu(e):{};return i.reduce((s,r)=>{var o;const h=ju[r]||n[r]||zu.REQUEST,u=(o=s[h])!==null&&o!==void 0?o:s[h]={};return u[r]=a[r],s},t)}function Yu(a){return["ot","sf","st","e","sta"].includes(a)}function Zu(a){return typeof a=="number"?N(a):a!=null&&a!==""&&a!==!1}const uo="event";function qu(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 qs=a=>Math.round(a),Fr=(a,e)=>Array.isArray(a)?a.map(t=>Fr(t,e)):a instanceof _n&&typeof a.value=="string"?new _n(Fr(a.value,e),a.params):(e.baseUrl&&(a=qu(a,e.baseUrl)),e.version===1?encodeURIComponent(a):a),Xs=a=>qs(a/100)*100,Xu={br:qs,d:qs,bl:Xs,dl:Xs,mtp:Xs,nor:(a,e)=>{let t=a;return e.version>=2&&(a instanceof _n&&typeof a.value=="string"?t=new _n([a]):typeof a=="string"&&(t=[a])),Fr(t,e)},rtp:Xs,tb:qs},ho="request",co="response",Mr=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Qu=["e"],Ju=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Qs(a){return Ju.test(a)}function eh(a){return Mr.includes(a)||Qu.includes(a)||Qs(a)}const fo=["d","dl","nor","ot","rtp","su"];function th(a){return Mr.includes(a)||fo.includes(a)||Qs(a)}const ih=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function nh(a){return Mr.includes(a)||fo.includes(a)||ih.includes(a)||Qs(a)}const sh=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function rh(a){return sh.includes(a)||Qs(a)}const ah={[co]:nh,[uo]:eh,[ho]:th};function po(a,e={}){const t={};if(a==null||typeof a!="object")return t;const i=e.version||a.v||1,n=e.reportingMode||ho,s=i===1?rh:ah[n];let r=Object.keys(a).filter(s);const o=e.filter;typeof o=="function"&&(r=r.filter(o));const h=n===co||n===uo;h&&!r.includes("ts")&&r.push("ts"),i>1&&!r.includes("v")&&r.push("v");const u=g({},Xu,e.formatters),c={version:i,reportingMode:n,baseUrl:e.baseUrl};return r.sort().forEach(f=>{let d=a[f];const m=u[f];if(typeof m=="function"&&(d=m(d,c)),f==="v"){if(i===1)return;d=i}f=="pr"&&d===1||(h&&f==="ts"&&!N(d)&&(d=Date.now()),Zu(d)&&(Yu(f)&&typeof d=="string"&&(d=new io(d)),t[f]=d))}),t}function oh(a,e={}){const t={};if(!a)return t;const i=po(a,e),n=Wu(i,e==null?void 0:e.customHeaderMap);return Object.entries(n).reduce((s,[r,o])=>{const h=lo(o,{whitespace:!1});return h&&(s[r]=h),s},t)}function lh(a,e,t){return g(a,oh(e,t))}const uh="CMCD";function hh(a,e={}){return a?lo(po(a,e),{whitespace:!1}):""}function ch(a,e={}){if(!a)return"";const t=hh(a,e);return encodeURIComponent(t)}function fh(a,e={}){if(!a)return"";const t=ch(a,e);return`${uh}=${t}`}const go=/CMCD=[^&#]+/;function dh(a,e,t){const i=fh(e,t);if(!i)return a;if(go.test(a))return a.replace(go,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class ph{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:Ki.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],h=this.getObjectType(s),u={d:(r||s).duration*1e3,ot:h};(h===Ki.VIDEO||h===Ki.AUDIO||h==Ki.MUXED)&&(u.br=o.bitrate/1e3,u.tb=this.getTopBandwidth(h)/1e3,u.bl=this.getBufferLength(h));const c=r?this.getNextPart(r):this.getNextFrag(s);c!=null&&c.url&&c.url!==s.url&&(u.nor=c.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:xu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){g(t,this.createData());const i=t.ot===Ki.INIT||t.ot===Ki.VIDEO||t.ot===Ki.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={}),lh(e.headers,t,s)):e.url=dh(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 h=s[o];if(h.index===i&&h.fragment.sn===r)return s[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Ki.TIMED_TEXT;if(e.sn==="initSegment")return Ki.INIT;if(t==="audio")return Ki.AUDIO;if(t==="main")return this.hls.audioTracks.length?Ki.VIDEO:Ki.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===Ki.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===Ki.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Lt.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,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 gh=3e5;class mh extends P{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)===ui.SendAlternateToPenaltyBox&&i.flags===mi.MoveAllAlternatesMatchingHost){const n=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:o,pathwayId:h,type:u}=t.context;o&&n?r=this.getPathwayForGroupId(o,u,r):h&&(r=h)}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===V.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: ${kt(s)} penalized: ${kt(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]>gh&&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,h=this.hls.levels[o];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,ya(t),this.hls.trigger(p.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];h&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==h.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==h.bitrate&&this.log(`Unstable Pathways change from bitrate ${h.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===ge.AUDIO_TRACK&&n[s].hasAudioGroup(e)||t===ge.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":h}=s;if(t.some(c=>c.pathwayId===r))return;const u=this.getLevelsForPathway(o).map(c=>{const f=new Jt(c.attrs);f["PATHWAY-ID"]=r;const d=f.AUDIO&&`${f.AUDIO}_clone_${r}`,m=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;d&&(i[f.AUDIO]=d,f.AUDIO=d),m&&(n[f.SUBTITLES]=m,f.SUBTITLES=m);const v=_o(c.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",h),w=new xi({attrs:f,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:v,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let T=1;T<c.audioGroups.length;T++)w.addGroupId("audio",`${c.audioGroups[T]}_clone_${r}`);if(c.subtitleGroups)for(let T=1;T<c.subtitleGroups.length;T++)w.addGroupId("text",`${c.subtitleGroups[T]}_clone_${r}`);return w});t.push(...u),mo(this.audioTracks,i,h,r),mo(this.subtitleTracks,n,h,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(c){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+c)}const s={responseType:"json",url:n.href},r=t.steeringManifestLoadPolicy.default,o=r.errorRetry||r.timeoutRetry||{},h={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(c,f,d,m)=>{this.log(`Loaded steering manifest: "${n}"`);const v=c.data;if((v==null?void 0:v.VERSION)!==1){this.log(`Steering VERSION ${v.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=v.TTL;const{"RELOAD-URI":w,"PATHWAY-CLONES":T,"PATHWAY-PRIORITY":k}=v;if(w)try{this.uri=new self.URL(w,n).href}catch(H){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${w}`);return}this.scheduleRefresh(this.uri||d.url),T&&this.clonePathways(T);const X={steeringManifest:v,url:n.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,X),k&&this.updatePathwayPriority(k)},onError:(c,f,d,m)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${f.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let v=this.timeToLoad*1e3;if(c.code===429){const w=this.loader;if(typeof(w==null?void 0:w.getResponseHeader)=="function"){const T=w.getResponseHeader("Retry-After");T&&(v=parseFloat(T)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,v)},onTimeout:(c,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,h,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 mo(a,e,t,i){a&&Object.keys(e).forEach(n=>{const s=a.filter(r=>r.groupId===n).map(r=>{const o=g({},r);return o.details=void 0,o.attrs=new Jt(o.attrs),o.url=o.attrs.URI=_o(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 _o(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 h=new self.URL(a);return n&&!o&&(h.host=n),s&&Object.keys(s).sort().forEach(u=>{u&&h.searchParams.set(u,s[u])}),h.href}class vs extends P{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=Rt(this.config));const o=r.map(gt).filter(h=>!!h);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=Kn(r);if(i!=="sinf"||o!==si.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}let h;try{const m=$e(new Uint8Array(n)),v=dn(JSON.parse(m).sinf),w=ut(v);if(!w)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");h=new Uint8Array(w.subarray(8,24))}catch(m){this.warn(`${s} Failed to parse sinf: ${m}`);return}const u=M(h),{keyIdToKeySessionPromise:c,mediaKeySessions:f}=this;let d=c[u];for(let m=0;m<f.length;m++){const v=f[m],w=v.decryptdata;if(!w.keyId)continue;const T=M(w.keyId);if(u===T||w.uri.replace(/-/g,"").indexOf(u)!==-1){if(d=c[T],!d)continue;if(w.pssh)break;delete c[T],w.pssh=new Uint8Array(n),w.keyId=h,d=c[u]=d.then(()=>this.generateRequestWithPreferredKeySession(v,i,n,"encrypted-event-key-match")),d.catch(k=>this.handleError(k));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===si.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,h)=>!!r&&h.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 h=u=>{const c=u.shift();this.getMediaKeysPromise(c,n,s).then(f=>r({keySystem:c,mediaKeys:f})).catch(f=>{u.length?h(u):f instanceof rn?o(f):o(new rn({type:oe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};h(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return ni===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=pi(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: ${kt(s)}`),o=this.requestMediaKeySystemAccess(e,s);const h=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 c=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const f=h.mediaKeys=u.createMediaKeys().then(d=>(this.log(`Media-keys created for "${e}"`),h.hasMediaKeys=!0,c.then(m=>m?this.setMediaKeysServerCertificate(d,e,m):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: ${M(e.keyId||[])}`);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=this.getKeyIdString(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)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return M(e.keyId)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${M(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})=>gt(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=gt(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=Rt(this.config),i=e.map(Kn).filter(n=>!!n&&t.indexOf(n)!==-1);return this.selectKeySystem(i)}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),n=this.bannedKeyIds[i];if(n){const o=vo(n,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:h,mediaKeys:u})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(h,u).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:h,mediaKeys:u,decryptdata:t}))))).then(h=>{const u="cenc",c=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(h,u,c,"playlist-key")});return o.catch(h=>this.handleError(h,e.frag)),this.keyIdToKeySessionPromise[i]=o,o}return r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){this.hls&&(this.error(e.message),e instanceof rn?(t&&(e.data.frag=t),this.hls.trigger(p.ERROR,e.data)):this.hls.trigger(p.ERROR,{type:oe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=Kn(e.keyFormat),s=n?[n]:Rt(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Rt(this.config)),e.length===0)throw new rn({type:oe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${kt({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 d=r.call(this.hls,t,i,e);if(!d)throw new Error("Invalid response from configured generateRequest filter");t=d.initDataType,i=d.initData?d.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(d){if(this.warn(d.message),this.hls&&this.hls.config.debug)throw d}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const o=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${n}": ${o} (init data type: ${t} length: ${i.byteLength})`);const h=new gr,u=e._onmessage=d=>{const m=e.mediaKeysSession;if(!m){h.emit("error",new Error("invalid state"));return}const{messageType:v,message:w}=d;this.log(`"${v}" message event for session "${m.sessionId}" message size: ${w.byteLength}`),v==="license-request"||v==="license-renewal"?this.renewLicense(e,w).catch(T=>{h.eventNames().length?h.emit("error",T):this.handleError(T)}):v==="license-release"?e.keySystem===si.FAIRPLAY&&(this.updateKeySession(e,Rn("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${v}"`)},c=e._onkeystatuseschange=d=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}const v=e.keyStatus;this.onKeyStatusChange(e);const w=e.keyStatus;w!==v&&(h.emit("keyStatus",w,e),w==="expired"&&(this.log(`${e.keySystem} expired for key ${o}`),this.renewKeySession(e)))};Mi(e.mediaKeysSession,"message",u),Mi(e.mediaKeysSession,"keystatuseschange",c);const f=new Promise((d,m)=>{h.on("error",m),h.on("keyStatus",(v,{decryptdata:w})=>{v.startsWith("usable")?d():v==="internal-error"||v==="output-restricted"?m(vo(v,w)):v==="expired"?m(new Error(`key expired while generating request (keyId: ${o})`)):this.warn(`unhandled key status change "${v}" (keyId: ${o})`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o}`)}).catch(d=>{throw new rn({type:oe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_SESSION,error:d,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${d}`)}).then(()=>f).catch(d=>{throw h.removeAllListeners(),this.removeSession(e),d}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){const t=M(new Uint8Array(e.decryptdata.keyId||[]));e.mediaKeysSession.keyStatuses.forEach((i,n)=>{if(typeof n=="string"&&typeof i=="object"){const o=n;n=i,i=o}const s=M("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n));i==="internal-error"&&(this.bannedKeyIds[s]=i);const r=s===t;this.log(`${r?"":"un"}matched key status change "${i}" for keyStatuses keyId: ${s} session keyId: ${t} uri: ${e.decryptdata.uri}`),r&&(e.keyStatus=i)})}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 h={responseType:"arraybuffer",url:s},u=t.certLoadPolicy.default,c={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,m,v,w)=>{r(d.data)},onError:(d,m,v,w)=>{o(new rn({type:oe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:v,response:y({url:h.url,data:void 0},d)},`"${e}" certificate request failed (${s}). Status: ${d.code} (${d.text})`))},onTimeout:(d,m,v)=>{o(new rn({type:oe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:v,response:{url:h.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(d,m,v)=>{o(new Error("aborted"))}};n.load(h,c,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 rn({type:oe.KEY_SYSTEM_ERROR,details:V.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 rn({type:oe.KEY_SYSTEM_ERROR,details:V.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 c;for(let f=0,d=s.length;f<d;f++){var r,o;c=s[f];const m=(r=c.querySelector("name"))==null?void 0:r.textContent,v=(o=c.querySelector("value"))==null?void 0:o.textContent;m&&v&&e.setRequestHeader(m,v)}}const h=n.querySelector("Challenge"),u=h==null?void 0:h.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return Rn(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 h=o.response;this.log(`License received ${h instanceof ArrayBuffer?h.byteLength:h}`);const u=this.config.licenseResponseCallback;if(u)try{h=u.call(this.hls,o,r,e)}catch(c){this.error(c)}n(h)}else{const h=i.errorRetry,u=h?h.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)s(new rn({type:oe.KEY_SYSTEM_ERROR,details:V.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 c=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} 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:h,licenseChallenge:u})=>{e.keySystem==si.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(h,u)),h.send(u)}).catch(s)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,Mi(i,"encrypted",this.onMediaEncrypted),Mi(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(Gi(e,"encrypted",this.onMediaEncrypted),Gi(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,kn.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:oe.OTHER_ERROR,details:V.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`),this.hls&&this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:V.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: ${M((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{drmSystemOptions:r}=this.config;return(ps(r)?new Promise((h,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(h).catch(u)}):Promise.resolve()).catch(h=>{this.log(`Could not remove session: ${h}`),this.hls&&this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:V.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${h}`)})}).then(()=>t.close()).catch(h=>{this.log(`Could not close session: ${h}`),this.hls&&this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:V.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${h}`)})})}}}vs.CDMCleanupPromise=void 0;class rn 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 vo(a,e){const t=a==="output-restricted",i=t?V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:V.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new rn({type:oe.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${a}"`)}class _h{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,h=1e3*r/s,u=this.hls;if(u.trigger(p.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),h>0&&r>u.config.fpsDroppedMonitoringThreshold*o){let c=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=c)&&(c=c-1,u.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:u.currentLevel}),u.autoLevelCapping=c,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 yo(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 Eo(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){W.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){W.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(a.mode=t)}function ys(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 Nr(a,e,t,i){const n=a.mode;if(n==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=yh(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 vh(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 yh(a,e,t){const i=[],n=vh(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 Js(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 Eh extends Lr{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=Js(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;Js(i.textTracks).forEach(r=>{ys(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(c=>!i||i.indexOf(c.groupId)!==-1);if(r.length)this.selectDefaultTrack&&!r.some(c=>c.default)&&(this.selectDefaultTrack=!1),r.forEach((c,f)=>{c.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 c=Ai(o,r);if(c>-1)s=r[c];else{const f=Ai(o,this.tracks);s=this.tracks[f]}}let h=this.findTrackId(s);h===-1&&s&&(h=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),h!==-1&&this.trackId===-1&&this.setSubtitleTrack(h)}}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||di(s,e)))return n}if(e){for(let n=0;n<t.length;n++){const s=t[n];if(Bs(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(Bs(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(Rr(n,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ge.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&&di(e,i))return i;const n=Ai(e,this.tracksInGroup);if(n>-1){const s=this.tracksInGroup[n];return this.setSubtitleTrack(n),s}else{if(i)return null;{const s=Ai(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=Js(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(s=>Rr(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||!N(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:h,type:u,url:c}=n;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:h,type:u,url:c});const f=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(f)}}function bh(){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 Us(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const Es=.025;let er=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function xh(a,e,t){return`${a.identifier}-${t+1}-${Us(e)}`}class Th{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 Br(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=Br(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=N(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return Br(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)<Es))}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"?er.Range:er.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 wh(this)}}function Br(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<Es)?e.start:e.start+e.duration}function bo(a,e,t){const i=new self.URL(a,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function Ur(a,e){for(;(t=a.assetList[++e])!=null&&t.error;)var t;return e}function wh(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function bs(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Sh{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:h})=>{this.removeMediaListeners(),this.mediaAttached=h,this.interstitial.playoutLimit&&(h.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(p.BUFFER_APPENDED,()=>{const c=this.bufferedEnd;this.reachedPlayout(c)&&(this._bufferedEosTime=c,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=bo(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=Lt.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=Lt.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;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: ${bs(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const xo=.033;class Ah extends P{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),h=s?s.filter(u=>!o.includes(u.identifier)):[];r.length&&r.sort((u,c)=>{const f=u.cue.pre,d=u.cue.post,m=c.cue.pre,v=c.cue.post;if(f&&!m)return-1;if(m&&!f||d&&!v)return 1;if(v&&!d)return-1;if(!f&&!m&&!d&&!v){const w=u.startTime,T=c.startTime;if(w!==T)return w-T}return u.dateRange.tagOrder-c.dateRange.tagOrder}),this.events=r,h.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,h)}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((h,u)=>Math.abs(h.playout.start-s[u].playout.start)>.005||Math.abs(h.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],h=e[o];if(h.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(h):(u=new Th(h,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(h=>!h.error&&!(h.cue.once&&h.hasPlayed)),e.length){this.resolveOffsets(e,t);let h=0,u=0;if(e.forEach((c,f)=>{const d=c.cue.pre,m=c.cue.post,v=e[f-1]||null,w=c.appendInPlace,T=m?s:c.startOffset,k=c.duration,X=c.timelineOccupancy===er.Range?k:0,H=c.resumptionOffset,ue=(v==null?void 0:v.startTime)===T,ve=T+c.cumulativeDuration;let Ie=w?ve+k:T+H;if(d||!m&&T<=0){const Se=u;u+=X,c.timelineStart=ve;const Ae=r;r+=k,i.push({event:c,start:ve,end:Ie,playout:{start:Ae,end:r},integrated:{start:Se,end:u}})}else if(T<=s){if(!ue){const pe=T-h;if(pe>xo){const Fe=h,lt=u;u+=pe;const mt=r;r+=pe;const Tt={previousEvent:e[f-1]||null,nextEvent:c,start:Fe,end:Fe+pe,playout:{start:mt,end:r},integrated:{start:lt,end:u}};i.push(Tt)}else pe>0&&v&&(v.cumulativeDuration+=pe,i[i.length-1].end=T)}m&&(Ie=ve),c.timelineStart=ve;const Se=u;u+=X;const Ae=r;r+=k,i.push({event:c,start:ve,end:Ie,playout:{start:Ae,end:r},integrated:{start:Se,end:u}})}else return;const ce=c.resumeTime;m||ce>s?h=s:h=ce}),h<s){var o;const c=h,f=u,d=s-h;u+=d;const m=r;r+=d,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:h,end:c+d,playout:{start:m,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,h)=>{const u=o.cue.pre,c=o.cue.post,f=u?0:c?n:o.startTime;this.updateAssetDurations(o),r===f?o.cumulativeDuration=s:(s=0,r=f),!c&&o.snapOptions.in&&(o.resumeAnchor=Hi(null,i.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&h+1<e.length&&e[h+1].startTime-e[h].resumeTime<xo&&(e[h+1].appendInPlace=!1,e[h+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const m=N(o.resumeOffset)?o.resumeOffset:o.duration;s+=m})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>Es?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1):!Object.keys(t).some(r=>{const o=t[r].details,h=o.edge;if(i>=h)return this.log(`"${e.identifier}" resumption ${i} past ${r} playlist end ${h}`),!1;const u=Hi(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 c=r==="audio"?.175:0;return Math.abs(u.start-i)<Es+c||Math.abs(u.end-i)<Es+c?!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],h=t+i;o.startOffset=i,o.timelineStart=h,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 an(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class Dh{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=bo(i,this.hls.sessionId,e.baseUrl)}catch(d){const m=this.assignAssetListError(e,V.ASSET_LIST_LOAD_ERROR,d,i);this.hls.trigger(p.ERROR,m);return}t&&n.protocol!=="data:"&&n.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,r=s.loader,o=new r(s),h={responseType:"json",url:n.href},u=s.interstitialAssetListLoadPolicy.default,c={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,m,v,w)=>{const T=d.data,k=T==null?void 0:T.ASSETS;if(!Array.isArray(k)){const X=this.assignAssetListError(e,V.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),v.url,m,w);this.hls.trigger(p.ERROR,X);return}e.assetListResponse=T,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:T,networkDetails:w})},onError:(d,m,v,w)=>{const T=this.assignAssetListError(e,V.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${d.code} ${d.text} (${m.url})`),m.url,w,v);this.hls.trigger(p.ERROR,T)},onTimeout:(d,m,v)=>{const w=this.assignAssetListError(e,V.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${m.url})`),m.url,d,v);this.hls.trigger(p.ERROR,w)}};return o.load(h,c,f),this.hls.trigger(p.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,i,n,s,r){return e.error=i,{type:oe.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:r,stats:s}}}function To(a){a==null||a.play().catch(()=>{})}function tr(a,e){return`[${a}] Advancing timeline position to ${e}`}class Lh extends P{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 h;const m=this.findItemIndex(o);let v=this.schedule.findItemIndexAtTime(i);if(v===-1&&(v=m+(r?-1:1),this.log(`seeked ${r?"back ":""}to position not covered by schedule ${i} (resolving from ${m} to ${v})`)),!this.isInterstitial(o)&&(h=this.media)!=null&&h.paused&&(this.shouldPlay=!1),!r&&v>m){const w=this.schedule.findJumpRestrictedIndex(m+1,v);if(w>m){this.setSchedulePosition(w);return}}this.setSchedulePosition(v);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const m=o.event.assetList[0];m&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,m))}return}const c=u.timelineStart,f=u.duration||0;if(r&&i<c||i>=c+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||[],h=s.items||[],u=s.durations,c=i.map(w=>w.identifier),f=!!(o.length||c.length);(f||n)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
|
|
Schedule: ${h.map(w=>an(w))} pos: ${this.timelinePos}`),c.length&&this.log(`Removed events ${c}`);let d=null,m=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 v=this.bufferingItem;if(v&&(m=this.updateItem(v,this.bufferedPos),this.itemsMatch(v,m)?this.bufferingItem=m:v.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(v.event,null))),i.forEach(w=>{w.assetList.forEach(T=>{this.clearAssetPlayer(T.identifier,null)})}),this.playerQueue.forEach(w=>{if(w.interstitial.appendInPlace){const T=w.assetItem.timelineStart,k=w.timelineOffset-T;if(k)try{w.timelineOffset=T}catch(X){Math.abs(k)>Es&&this.warn(`${X} ("${w.assetId}" ${w.timelineOffset}->${T})`)}}}),f||n){if(this.hls.trigger(p.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:h.slice(0),durations:u,removedIds:c}),this.isInterstitial(r)&&c.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}r&&this.trimInPlace(d,r),v&&m!==d&&this.trimInPlace(m,v),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Dh(e),this.schedule=new Ah(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){Gi(e,"play",this.onPlay),Gi(e,"pause",this.onPause),Gi(e,"seeking",this.onSeeking),Gi(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;Mi(i,"seeking",this.onSeeking),Mi(i,"timeupdate",this.onTimeupdate),Mi(i,"play",this.onPlay),Mi(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,m,v,w)=>{if(f){let T=f[d].start;const k=f.event;if(k){if(d==="playout"||k.timelineOccupancy!==er.Point){const X=i(m);(X==null?void 0:X.interstitial)===k&&(T+=X.assetItem.startOffset+X[w])}}else{const X=v==="bufferedPos"?r():e[v];T+=X-f.start}return T}return 0},s=(f,d)=>{var m;if(f!==0&&d!=="primary"&&(m=e.schedule)!=null&&m.length){var v;const w=e.schedule.findItemIndexAtTime(f),T=(v=e.schedule.items)==null?void 0:v[w];if(T){const k=T[d].start-T.start;return f+k}}return f},r=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var d,m;return(d=e.primaryDetails)!=null&&d.live?e.primaryDetails.edge:((m=e.schedule)==null?void 0:m.durations[f])||0},h=(f,d)=>{var m,v;const w=e.effectivePlayingItem;if(w!=null&&(m=w.event)!=null&&m.restrictions.skip||!e.schedule)return;e.log(`seek to ${f} "${d}"`);const T=e.effectivePlayingItem,k=e.schedule.findItemIndexAtTime(f,d),X=(v=e.schedule.items)==null?void 0:v[k],H=e.getBufferingPlayer(),ue=H==null?void 0:H.interstitial,ve=ue==null?void 0:ue.appendInPlace,Ie=T&&e.itemsMatch(T,X);if(T&&(ve||Ie)){const ce=i(e.playingAsset),Se=(ce==null?void 0:ce.media)||e.primaryMedia;if(Se){const Ae=d==="primary"?Se.currentTime:n(T,d,e.playingAsset,"timelinePos","currentTime"),pe=f-Ae,Fe=(ve?Ae:Se.currentTime)+pe;if(Fe>=0&&(!ce||ve||Fe<=ce.duration)){Se.currentTime=Fe;return}}}if(X){let ce=f;if(d!=="primary"){const Ae=X[d].start,pe=f-Ae;ce=X.start+pe}const Se=!e.isInterstitial(X);if((!e.isInterstitial(T)||T.event.appendInPlace)&&(Se||X.event.appendInPlace)){const Ae=e.media||(ve?H==null?void 0:H.media:null);Ae&&(Ae.currentTime=ce)}else if(T){const Ae=e.findItemIndex(T);if(k>Ae){const Fe=e.schedule.findJumpRestrictedIndex(Ae+1,k);if(Fe>Ae){e.setSchedulePosition(Fe);return}}let pe=0;if(Se)e.timelinePos=ce,e.checkBuffer();else{const Fe=X.event.assetList,lt=f-(X[d]||X).start;for(let mt=Fe.length;mt--;){const Tt=Fe[mt];if(Tt.duration&<>=Tt.startOffset&<<Tt.startOffset+Tt.duration){pe=mt;break}}}e.setSchedulePosition(k,pe)}}},u=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const d=t();return e.isInterstitial(d)?d:null},c={get bufferedEnd(){const f=t(),d=e.bufferingItem;if(d&&d===f){var m;return n(d,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-d.playout.start||((m=e.bufferingAsset)==null?void 0:m.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(),m=e.effectivePlayingItem;m&&m===d&&h(f+m.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(m=>e.getAssetPlayer(m.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()?c: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){h(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){h(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 m=e.findItemIndex(f);if(d.appendInPlace){const v=f.playout.start+f.event.duration;h(v+.001,"playout")}else e.advanceAfterAssetEnded(d,m,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||!N(s)))return s}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const 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} ${kt(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,h=o&&e.interstitial.appendInPlace,u=(i=this.detachedData)==null?void 0:i.mediaSource;let c;if(r.media)h&&(s=r.transferMedia(),this.detachedData=s),c="Primary";else if(u){const v=this.getBufferingPlayer();v?(s=v.transferMedia(),c=`${v}`):c="detached MediaSource"}else c="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${kt(s)}`);else if(!this.detachedData||r.media===t){const v=this.playerQueue;v.length>1&&v.forEach(w=>{if(o&&w.interstitial.appendInPlace!==h){const T=w.interstitial;this.clearInterstitial(w.interstitial,null),T.appendInPlace=!1,T.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${T}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=s&&"mediaSource"in s&&((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 ${c} (media.currentTime: ${t.currentTime})`);const m=this.schedule;if(d===s&&m){const v=o&&e.assetId===m.assetIdAtEnd;d.overrides={duration:m.duration,endOfStream:!o||v,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(tr("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=Ur(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=Ur(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 h=e.resumeTime;this.timelinePos<h&&(this.log(tr("advanceAfterAssetEnded",h)),this.timelinePos=h,e.appendInPlace&&this.advanceInPlace(h),this.checkBuffer(this.bufferedPos<h)),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&&an(s)}) pos: ${this.timelinePos}`);const r=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(r)){const c=r.event,f=this.playingAsset,d=f==null?void 0:f.identifier,m=d?this.getAssetPlayer(d):null;if(m&&d&&(!this.eventItemsMatch(r,s)||t!==void 0&&d!==c.assetList[t].identifier)){var h;const v=c.findAssetIndex(f);if(this.log(`INTERSTITIAL_ASSET_ENDED ${v+1}/${c.assetList.length} ${bs(f)}`),this.endedAsset=f,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:f,assetListIndex:v,event:c,schedule:n.slice(0),scheduleIndex:e,player:m}),r!==this.playingItem){this.itemsMatch(r,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(c,this.findItemIndex(this.playingItem),v);return}this.retreiveMediaSource(d,s),m.media&&!((h=this.detachedData)!=null&&h.mediaSource)&&m.detachMedia()}if(!this.eventItemsMatch(r,s)&&(this.endedItem=r,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${c} ${an(r)}`),c.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:c,schedule:n.slice(0),scheduleIndex:e}),c.cue.once)){var u;this.updateSchedule();const v=(u=this.schedule)==null?void 0:u.items;if(s&&v){const w=this.findItemIndex(s);this.advanceSchedule(w,v,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,h=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach(c=>{const f=c.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 c=o.event;if(i===void 0){i=r.findAssetIndex(c,this.timelinePos);const v=Ur(c,i-1);if(c.isAssetPastPlayoutLimit(v)||c.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(c,e,i);return}i=v}const f=this.waitingItem;this.assetsBuffered(o,h)||this.setBufferingItem(o);let d=this.preloadAssets(c,i);if(this.eventItemsMatch(o,f||n)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${an(o)} ${c.appendInPlace?"append in place":""}`),this.hls.trigger(p.INTERSTITIAL_STARTED,{event:c,schedule:t.slice(0),scheduleIndex:e})),!c.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${c}`);return}if(c.assetListLoader&&(c.assetListLoader.destroy(),c.assetListLoader=void 0),!h){this.log(`Waiting for attachMedia to start Interstitial ${c}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const m=c.assetList[i];if(!m){this.advanceAfterAssetEnded(c,e,i||0);return}if(d||(d=this.getAssetPlayer(m.identifier)),d===null||d.destroyed){const v=c.assetList.length;this.warn(`asset ${i+1}/${v} player destroyed ${c}`),d=this.createAssetPlayer(c,m,i),d.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&c.appendInPlace&&this.isAssetBuffered(m))return;this.startAssetPlayer(d,i,t,e,h),this.shouldPlay&&To(d.media)}else o?(this.resumePrimary(o,e,n),this.shouldPlay&&To(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 ${an(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(tr("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 ${an(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:Lt.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const 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(tr("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],n=y(y({},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=y(y({},this.altSelection),{},{audio:i});return}const s=y(y({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=y(y({},this.altSelection),{},{subtitles:i});return}const s=y(y({},n),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=Bi(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setAudioOption(t)||n.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=Bi(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=Lt.bufferInfo(this.primaryMedia,i,0);(n.end>i||(n.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${an(e)} (was ${an(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=Lt.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 h=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var u;const c=this.findItemIndex(s),f=Math.min(c+1,t.length-1),d=t[f];if((h===-1&&s&&e>=s.end||(u=d.event)!=null&&u.appendInPlace&&e+.01>=d.start)&&(h=f),this.isInterstitial(s)){const m=s.event;if(f-o>1&&m.appendInPlace===!1||m.assetList.length===0&&m.assetListLoader)return}if(this.bufferedPos=e,h>c&&h>o)this.bufferedToItem(d);else{const m=this.primaryDetails;this.primaryLive&&m&&e>m.edge-m.targetduration&&d.start<m.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(d)&&this.preloadAssets(d.event,0)}}else i&&r&&!this.itemsMatch(r,s)&&(h===o?this.bufferedToItem(r):h===o+1&&this.bufferedToItem(t[h]))}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 h=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${an(e)}`+(t?` (${h.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(r){const u=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((c,f)=>{const d=this.getAssetPlayer(c.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 h=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(h+.25)}let u,c=0;if(!this.playingItem&&this.primaryLive&&(c=this.hls.startPosition,c===-1&&(c=this.hls.liveSyncPosition||0)),c&&!(e.cue.pre||e.cue.post)){const d=c-h;d>0&&(u=Math.round(d*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${u?` live-start: ${c} start-offset: ${u}`:""}`),i)return this.createAsset(e,0,0,h,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 c=e.assetList[u],f=this.getAssetPlayerQueueIndex(c.identifier);(f===-1||this.playerQueue[f].destroyed)&&!c.error&&this.createAssetPlayer(e,c,u)}const h=e.assetList[t];if(h){const u=this.getAssetPlayer(h.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:xh(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=g({},r),o.videoCodec&&(r.videoCodec=o.videoCodec),o.videoRange&&(r.allowedVideoRanges=[o.videoRange]));const h=n.audioTracks[n.audioTrack],u=n.subtitleTracks[n.subtitleTrack];let c=0;if(this.primaryLive||e.appendInPlace){const ue=this.timelinePos-t.timelineStart;if(ue>1){const ve=t.duration;ve&&ue<ve&&(c=ue)}}const f=t.identifier,d=y(y({},s),{},{maxMaxBufferLength:Math.min(180,n.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:c,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:r,audioPreference:h||s.audioPreference,subtitlePreference:u||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(d.timelineOffset=t.timelineStart));const m=d.cmcd;m!=null&&m.sessionId&&m.contentId&&(d.cmcd=g({},m,{contentId:Us(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const v=new Sh(this.HlsPlayerClass,d,e,t);this.playerQueue.push(v),e.assetList[i]=t;let w=!0;const T=ue=>{if(ue.live){var ve;const Se=new Error(`Interstitials MUST be VOD assets ${e}`),Ae={fatal:!0,type:oe.OTHER_ERROR,details:V.INTERSTITIAL_ASSET_ITEM_ERROR,error:Se},pe=((ve=this.schedule)==null?void 0:ve.findEventIndex(e.identifier))||-1;this.handleAssetItemError(Ae,e,pe,i,Se.message);return}const Ie=ue.edge-ue.fragmentStart,ce=t.duration;(w||ce===null||Ie>ce)&&(w=!1,this.log(`Interstitial asset "${f}" duration change ${ce} > ${Ie}`),t.duration=Ie,this.updateSchedule())};v.on(p.LEVEL_UPDATED,(ue,{details:ve})=>T(ve)),v.on(p.LEVEL_PTS_UPDATED,(ue,{details:ve})=>T(ve)),v.on(p.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const k=(ue,ve)=>{const Ie=this.getAssetPlayer(f);if(Ie&&ve.tracks){Ie.off(p.BUFFER_CODECS,k),Ie.tracks=ve.tracks;const ce=this.primaryMedia;this.bufferingAsset===Ie.assetItem&&ce&&!Ie.media&&this.bufferAssetPlayer(Ie,ce)}};v.on(p.BUFFER_CODECS,k);const X=()=>{var ue;const ve=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${ve}`),!ve||!this.schedule)return;const Ie=this.schedule.findEventIndex(e.identifier),ce=(ue=this.schedule.items)==null?void 0:ue[Ie];this.isInterstitial(ce)&&this.advanceAssetBuffering(ce,t)};v.on(p.BUFFERED_TO_END,X);const H=ue=>()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;this.shouldPlay=!0;const Ie=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,Ie,ue)};return v.once(p.MEDIA_ENDED,H(i)),v.once(p.PLAYOUT_LIMIT_REACHED,H(1/0)),v.on(p.ERROR,(ue,ve)=>{if(!this.schedule)return;const Ie=this.getAssetPlayer(f);if(ve.details===V.BUFFER_STALLED_ERROR){if(Ie!=null&&Ie.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(ve,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${ve.error} ${e}`)}),v.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;const ve=new Error(`Asset player destroyed unexpectedly ${f}`),Ie={fatal:!0,type:oe.OTHER_ERROR,details:V.INTERSTITIAL_ASSET_ITEM_ERROR,error:ve};this.handleAssetItemError(Ie,e,this.schedule.findEventIndex(e.identifier),i,ve.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${bs(t)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:v}),v}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&&an(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:h}=e,u=r.assetList.length,c=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!c||c.identifier!==h)&&(c&&(this.clearAssetPlayer(c.identifier,i[n]),delete c.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${bs(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),h=(i=this.schedule.items)==null?void 0:i[o];if(!h)return;e.loadSource(),this.setBufferingItem(h),this.bufferingAsset=r;const u=this.getBufferingPlayer();if(u===e)return;const c=s.appendInPlace;if(c&&(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(c&&r!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(f&&!me(f,e.tracks)){const d=new Error(`Asset ${bs(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(f)}')`),m={fatal:!0,type:oe.OTHER_ERROR,details:V.INTERSTITIAL_ASSET_ITEM_ERROR,error:d},v=s.findAssetIndex(r);this.handleAssetItemError(m,s,o,v,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 h=o.currentTime||n-r.timelineStart,u=o.duration-h;if(this.warn(`Stalled at ${h} of ${h+u} in ${o} ${e} (media.currentTime: ${n})`),h&&(u/i.playbackRate<.5||o.bufferedInPlaceToEnd(i))&&o.hls){const c=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,c,s)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,i,n,s){if(e.details===V.BUFFER_STALLED_ERROR)return;const r=t.assetList[n]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${r&&bs(r)} ${e.error}`),!this.schedule)return;const o=(r==null?void 0:r.identifier)||"",h=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[h]||null,c=this.schedule.items,f=g({},e,{fatal:!1,errorAction:tn(!0),asset:r,assetListIndex:n,event:t,schedule:c,scheduleIndex:i,player:u});if(this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const d=this.playingAsset,m=this.bufferingAsset,v=new Error(s);if(r&&(this.clearAssetPlayer(o,null),r.error=v),!t.assetList.some(w=>!w.error))t.error=v;else for(let w=n;w<t.assetList.length;w++)this.resetAssetPlayer(t.assetList[w].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):d&&d.identifier===o?this.advanceAfterAssetEnded(t,i,n):m&&m.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,m)}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: ${an(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 h=s.timelineStart,u=s.duration;let c=0;o.forEach((w,T)=>{const k=parseFloat(w.DURATION);this.createAsset(s,T,c,h+c,k,w.URI),c+=k}),s.duration=c,this.log(`Loaded asset-list with duration: ${c} (was: ${u}) ${s}`);const f=this.waitingItem,d=(f==null?void 0:f.event.identifier)===r;this.updateSchedule();const m=(n=this.bufferingItem)==null?void 0:n.event;if(d){var v;const w=this.schedule.findEventIndex(r),T=(v=this.schedule.items)==null?void 0:v[w];if(T){if(!this.playingItem&&this.timelinePos>T.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==w){s.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${s}`),this.updateSchedule(!0),this.primaryFallback(s);return}this.setBufferingItem(T)}this.setSchedulePosition(w)}else if((m==null?void 0:m.identifier)===r){const w=s.assetList[0];if(w){const T=this.getAssetPlayer(w.identifier);if(m.appendInPlace){const k=this.primaryMedia;T&&k&&this.bufferAssetPlayer(T,k)}else T&&T.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case V.ASSET_LIST_PARSING_ERROR:case V.ASSET_LIST_LOAD_ERROR:case V.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&(this.updateSchedule(!0),this.primaryFallback(i));break}case V.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 wo=500;class Rh extends dr{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",ne.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=Me.IDLE,this.setInterval(wo),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)||(Te(i)&&(this.fragPrevious=i),this.state=Me.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 h=i.start+i.duration;r?r.end=h:(r={start:o,end:h},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,ne.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===ne.SUBTITLE&&(t.details===V.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Me.STOPPED&&(this.state=Me.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Qa(this.levels,t)){this.levels=t.map(i=>new xi(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new xi(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ne.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!==Me.STOPPED&&this.setInterval(wo)}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 h=s[o];if(o>=s.length||!h)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=h.details)!=null&&i.live){if(r.deltaUpdateFailed)return;const f=this.mainDetails;if(!f){this.startFragRequested=!1;return}const d=f.fragments[0];if(!h.details)r.hasProgramDateTime&&f.hasProgramDateTime?(Ks(r,f),u=r.fragmentStart):d&&(u=d.start,fr(r,u));else{var c;u=this.alignPlaylists(r,h.details,(c=this.levelLastLoaded)==null?void 0:c.details),u===0&&d&&(u=d.start,fr(r,u))}f&&!this.startFragRequested&&this.setStartPosition(f,u)}h.details=r,this.levelLastLoaded=h,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===Me.IDLE&&(Hi(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),h.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&&fn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,Ii(n.method)).catch(o=>{throw s.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:V.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const h=performance.now();s.trigger(p.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:r,tdecrypt:h}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=Me.IDLE})}}doTick(){if(!this.media){this.state=Me.IDLE;return}if(this.state===Me.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=Lt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,n.maxBufferHole),{end:o,len:h}=r,u=i.details,c=this.hls.maxBufferLength+u.levelTargetDuration;if(h>c)return;const f=u.fragments,d=f.length,m=u.edge;let v=null;const w=this.fragPrevious;if(o<m){const X=n.maxFragLookUpTolerance,H=o>m-X?0:X;v=Hi(w,f,Math.max(f[0].start,o),H),!v&&w&&w.start<f[0].start&&(v=f[0])}else v=f[d-1];if(v=this.filterReplacedPrimary(v,i.details),!v)return;const T=v.sn-u.startSN,k=f[T-1];if(k&&k.cc===v.cc&&this.fragmentTracker.getState(k)===Qt.NOT_LOADED&&(v=k),this.fragmentTracker.getState(v)===Qt.NOT_LOADED){const X=this.mapToInitFragWhenRequired(v);X&&this.loadFragment(X,i,o)}}}loadFragment(e,t,i){Te(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Ih(this.tracksBuffered[this.currentTrackId]||[])}}class Ih{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 kh={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},So=a=>String.fromCharCode(kh[a]||a),on=15,On=100,Ch={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Ph={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Oh={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Fh={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Mh=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Nh{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;W.log(`${this.time} [${e}] ${i}`)}}}const ts=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Ao{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 Bh{constructor(){this.uchar=" ",this.penState=new Ao}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 Uh{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Ao,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<On;t++)this.chars.push(new Bh);this.logger=e}equals(e){for(let t=0;t<On;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<On;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<On;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>On&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=On)}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=So(e);if(this.pos>=On){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<On;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<On;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 $r{constructor(e){this.rows=[],this.currRow=on-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<on;t++)this.rows.push(new Uh(e));this.logger=e}reset(){for(let e=0;e<on;e++)this.rows[e].clear();this.currRow=on-1}equals(e){let t=!0;for(let i=0;i<on;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<on;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<on;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 = "+kt(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<on;o++)this.rows[o].clear();const s=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const o=r.rows[s].cueStartTime,h=this.logger.time;if(o!==null&&h!==null&&o<h)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 = "+kt(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<on;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 Do{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 $r(i),this.nonDisplayedMemory=new $r(i),this.lastOutputScreen=new $r(i),this.currRollUpRow=this.displayedMemory.rows[on-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[on-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: "+kt(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 Lo{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Gh(),this.logger=void 0;const n=this.logger=new Nh;this.channels=[null,new Do(e,t,n),new Do(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,()=>"["+ts([t[i],t[i+1]])+"] -> ("+ts([n,s])+")");const h=this.cmdHistory;if(n>=16&&n<=31){if($h(n,s,h)){ir(null,null,h),this.logger.log(3,()=>"Repeated command ("+ts([n,s])+") is dropped");continue}ir(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 ir(null,null,h);if(!r&&(o=this.parseChars(n,s),o)){const c=this.currentChannel;c&&c>0?this.channels[c].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!r&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+ts([n,s])+" orig: "+ts([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 ("+ts([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?Ch[e]:Oh[e]:i=r===1?Ph[e]:Fh[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 '"+So(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 = "+ts(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=Mh[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()}ir(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 ir(a,e,t){t.a=a,t.b=e}function $h(a,e,t){return t.a===a&&t.b===e}function Gh(){return{a:null,b:null}}var Gr=function(){if(In!=null&&In.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,h){if(typeof h!="string"||!Array.isArray(o))return!1;const u=h.toLowerCase();return~o.indexOf(u)?u:!1}function i(o){return t(a,o)}function n(o){return t(e,o)}function s(o,...h){let u=1;for(;u<arguments.length;u++){const c=arguments[u];for(const f in c)o[f]=c[f]}return o}function r(o,h,u){const c=this,f={enumerable:!0};c.hasBeenReset=!1;let d="",m=!1,v=o,w=h,T=u,k=null,X="",H=!0,ue="auto",ve="start",Ie=50,ce="middle",Se=50,Ae="middle";Object.defineProperty(c,"id",s({},f,{get:function(){return d},set:function(pe){d=""+pe}})),Object.defineProperty(c,"pauseOnExit",s({},f,{get:function(){return m},set:function(pe){m=!!pe}})),Object.defineProperty(c,"startTime",s({},f,{get:function(){return v},set:function(pe){if(typeof pe!="number")throw new TypeError("Start time must be set to a number.");v=pe,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",s({},f,{get:function(){return w},set:function(pe){if(typeof pe!="number")throw new TypeError("End time must be set to a number.");w=pe,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",s({},f,{get:function(){return T},set:function(pe){T=""+pe,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",s({},f,{get:function(){return k},set:function(pe){k=pe,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",s({},f,{get:function(){return X},set:function(pe){const Fe=i(pe);if(Fe===!1)throw new SyntaxError("An invalid or illegal string was specified.");X=Fe,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",s({},f,{get:function(){return H},set:function(pe){H=!!pe,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",s({},f,{get:function(){return ue},set:function(pe){if(typeof pe!="number"&&pe!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");ue=pe,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",s({},f,{get:function(){return ve},set:function(pe){const Fe=n(pe);if(!Fe)throw new SyntaxError("An invalid or illegal string was specified.");ve=Fe,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",s({},f,{get:function(){return Ie},set:function(pe){if(pe<0||pe>100)throw new Error("Position must be between 0 and 100.");Ie=pe,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",s({},f,{get:function(){return ce},set:function(pe){const Fe=n(pe);if(!Fe)throw new SyntaxError("An invalid or illegal string was specified.");ce=Fe,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",s({},f,{get:function(){return Se},set:function(pe){if(pe<0||pe>100)throw new Error("Size must be between 0 and 100.");Se=pe,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",s({},f,{get:function(){return Ae},set:function(pe){const Fe=n(pe);if(!Fe)throw new SyntaxError("An invalid or illegal string was specified.");Ae=Fe,this.hasBeenReset=!0}})),c.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class Kh{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Ro(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 Vh{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 Io(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],h=r[1];e(o,h)}}const Kr=new Gr(0,0,""),nr=Kr.align==="middle"?"middle":"center";function jh(a,e,t){const i=a;function n(){const o=Ro(a);if(o===null)throw new Error("Malformed timestamp: "+i);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,h){const u=new Vh;Io(o,function(d,m){let v;switch(d){case"region":for(let w=t.length-1;w>=0;w--)if(t[w].id===m){u.set(d,t[w].region);break}break;case"vertical":u.alt(d,m,["rl","lr"]);break;case"line":v=m.split(","),u.integer(d,v[0]),u.percent(d,v[0])&&u.set("snapToLines",!1),u.alt(d,v[0],["auto"]),v.length===2&&u.alt("lineAlign",v[1],["start",nr,"end"]);break;case"position":v=m.split(","),u.percent(d,v[0]),v.length===2&&u.alt("positionAlign",v[1],["start",nr,"end","line-left","line-right","auto"]);break;case"size":u.percent(d,m);break;case"align":u.alt(d,m,["start",nr,"end","left","right"]);break}},/:/,/\s/),h.region=u.get("region",null),h.vertical=u.get("vertical","");let c=u.get("line","auto");c==="auto"&&Kr.line===-1&&(c=-1),h.line=c,h.lineAlign=u.get("lineAlign","start"),h.snapToLines=u.get("snapToLines",!0),h.size=u.get("size",100),h.align=u.get("align",nr);let f=u.get("position","auto");f==="auto"&&Kr.position===50&&(f=h.align==="start"||h.align==="left"?0:h.align==="end"||h.align==="right"?100:50),h.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 ko(a){return a.replace(/<br(?: \/)?>/gi,`
|
|
`)}class zh{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Kh,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=ko(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){Io(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 Gr(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{jh(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 Hh=/\r\n|\n\r|\n|\r/g,Vr=function(e,t,i=0){return e.slice(i,i+t.length)===t},Wh=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(!N(t)||!N(i)||!N(n)||!N(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*s,t};function jr(a,e,t){return Us(a.toString())+Us(e.toString())+Us(t)}const Yh=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 Zh(a,e,t,i,n,s,r){const o=new zh,h=Pe(new Uint8Array(a)).trim().replace(Hh,`
|
|
`).split(`
|
|
`),u=[],c=e?ru(e.baseTime,e.timescale):0;let f="00:00.000",d=0,m=0,v,w=!0;o.oncue=function(T){const k=t[i];let X=t.ccOffset;const H=(d-c)/9e4;if(k!=null&&k.new&&(m!==void 0?X=t.ccOffset=k.start:Yh(t,i,H)),H){if(!e){v=new Error("Missing initPTS for VTT MPEGTS");return}X=H-t.presentationOffset}const ue=T.endTime-T.startTime,ve=qi((T.startTime+X-m)*9e4,n*9e4)/9e4;T.startTime=Math.max(ve,0),T.endTime=Math.max(ve+ue,0);const Ie=T.text.trim();T.text=decodeURIComponent(encodeURIComponent(Ie)),T.id||(T.id=jr(T.startTime,T.endTime,Ie)),T.endTime>0&&u.push(T)},o.onparsingerror=function(T){v=T},o.onflush=function(){if(v){r(v);return}s(u)},h.forEach(T=>{if(w)if(Vr(T,"X-TIMESTAMP-MAP=")){w=!1,T.slice(16).split(",").forEach(k=>{Vr(k,"LOCAL:")?f=k.slice(6):Vr(k,"MPEGTS:")&&(d=parseInt(k.slice(7)))});try{m=Wh(f)/1e3}catch(k){v=k}return}else T===""&&(w=!1);o.parse(T+`
|
|
`)}),o.flush()}const zr="stpp.ttml.im1t",Co=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Po=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,qh={left:"start",center:"center",right:"end",start:"start",end:"end"};function Oo(a,e,t,i){const n=Q(new Uint8Array(a),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const s=n.map(o=>Pe(o)),r=su(e.baseTime,1,e.timescale);try{s.forEach(o=>t(Xh(o,r)))}catch(o){i(o)}}function Xh(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",h=Fo(Hr(n,"styling","style")),u=Fo(Hr(n,"layout","region")),c=Hr(n,"body","[begin]");return[].map.call(c,f=>{const d=Mo(f,o);if(!d||!f.hasAttribute("begin"))return null;const m=Yr(f.getAttribute("begin"),r),v=Yr(f.getAttribute("dur"),r);let w=Yr(f.getAttribute("end"),r);if(m===null)throw No(f);if(w===null){if(v===null)throw No(f);w=m+v}const T=new Gr(m-e,w-e,d);T.id=jr(T.startTime,T.endTime,T.text);const k=u[f.getAttribute("region")],X=h[f.getAttribute("style")],H=Qh(k,X,h),{textAlign:ue}=H;if(ue){const ve=qh[ue];ve&&(T.lineAlign=ve),T.align=ue}return g(T,H),T}).filter(f=>f!==null)}function Hr(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Fo(a){return a.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Mo(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?Mo(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function Qh(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,h)=>{const u=Wr(e,i,h)||Wr(a,i,h)||Wr(n,i,h);return u&&(o[h]=u),o},{})}function Wr(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function No(a){return new Error(`Could not parse ttml timestamp ${a}`)}function Yr(a,e){if(!a)return null;let t=Ro(a);return t===null&&(Co.test(a)?t=Jh(a,e):Po.test(a)&&(t=ec(a,e))),t}function Jh(a,e){const t=Co.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 ec(a,e){const t=Po.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 sr{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 tc{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=$o(),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 sr(this,"textTrack1"),t=new sr(this,"textTrack2"),i=new sr(this,"textTrack3"),n=new sr(this,"textTrack4");this.cea608Parser1=new Lo(1,e,t),this.cea608Parser2=new Lo(3,i,n)}addCues(e,t,i,n,s){let r=!1;for(let o=s.length;o--;){const h=s[o],u=ic(h[0],h[1],t,i);if(u>=0&&(h[0]=Math.min(h[0],t),h[1]=Math.max(h[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===ne.MAIN&&(this.initPTS[t.cc]={baseTime:n,timescale:s,trackId:r}),o.length&&(this.unparsedVttFrags=[],o.forEach(h=>{this.initPTS[h.frag.cc]?this.onFragLoaded(p.FRAG_LOADED,h):this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n<i.textTracks.length;n++){const s=i.textTracks[n];if(Uo(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,ys(i[e]),yo(i[e],n);else{const h=this.createTextTrack("captions",s,r);h&&(h[e]=!0,i[e]=h)}}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=>{ys(n[s]),delete n[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=$o(),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++)ys(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(s=>s.textCodec===zr);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(Qa(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const r=this.media,o=r?Js(r.textTracks):null;if(this.tracks.forEach((h,u)=>{let c;if(o){let f=null;for(let d=0;d<o.length;d++)if(o[d]&&Uo(o[d],h)){f=o[d],o[d]=null;break}f&&(c=f)}if(c)ys(c);else{const f=Bo(h);c=this.createTextTrack(f,h.name,h.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),o!=null&&o.length){const h=o.filter(u=>u!==null).map(u=>u.label);h.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${h.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===ne.MAIN){var i,n;const{cea608Parser1:s,cea608Parser2:r,lastSn:o}=this,{cc:h,sn:u}=t.frag,c=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;s&&r&&(u!==o+1||u===o&&c!==this.lastPartIndex+1||h!==this.lastCc)&&(s.reset(),r.reset()),this.lastCc=h,this.lastSn=u,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===ne.SUBTITLE)if(n.byteLength){const s=i.decryptdata,r="stats"in t;if(s==null||!s.encrypted||r){const o=this.tracks[i.level],h=this.vttCCs;h[i.cc]||(h[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===zr?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;Oo(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 h=this.hls,u=(t=i.initSegment)!=null&&t.data?Ue(i.initSegment.data,new Uint8Array(n)).buffer:n;Zh(u,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,c=>{this._appendCues(c,i.level),h.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},c=>{const f=c.message==="Missing initPTS for VTT MPEGTS";f?r.push(e):this._fallbackToIMSC1(i,n),h.logger.log(`Failed to parse VTT cue: ${c}`),!(f&&o>i.cc)&&h.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:c})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Oo(t,this.initPTS[e.cc],()=>{i.textCodec=zr,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=>Eo(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===ne.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===ne.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(h=>Nr(o[h],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(h=>Nr(o[h],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++],h=127&e[n++];if(o===0&&h===0)continue;if((4&r)!==0){const c=3&r;(c===0||c===1)&&(t[c].push(o),t[c].push(h))}}return t}}function Bo(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Uo(a,e){return!!a&&a.kind===Bo(e)&&Rr(e,a)}function ic(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function $o(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const nc=/\s/,sc={newCue(a,e,t,i){const n=[];let s,r,o,h,u;const c=self.VTTCue||self.TextTrackCue;for(let d=0;d<i.rows.length;d++)if(s=i.rows[d],o=!0,h=0,u="",!s.isEmpty()){var f;for(let w=0;w<s.chars.length;w++)nc.test(s.chars[w].uchar)&&o?h++:(u+=s.chars[w].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),h>=16?h--:h++;const m=ko(u.trim()),v=jr(e,t,m);a!=null&&(f=a.cues)!=null&&f.getCueById(v)||(r=new c(e,t,m),r.id=v,r.line=d+1,r.align="left",r.position=10+Math.min(80,Math.floor(h*8/32)*10),n.push(r))}return a&&n.length&&(n.sort((d,m)=>d.line==="auto"||m.line==="auto"?0:d.line>8&&m.line>8?m.line-d.line:d.line-m.line),n.forEach(d=>Eo(a,d))),n}};function rc(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const ac=/(\d+)-(\d+)\/(\d+)/;class Go{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||hc,this.controller=new self.AbortController,this.stats=new _}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=oc(e,this.controller.signal),r=e.responseType==="arraybuffer",o=r?"byteLength":"length",{maxTimeToFirstByteMs:h,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=h&&N(h)?h:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(Ns(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var d;this.response=this.loader=f;const m=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-(m-n.loading.start)),!f.ok){const{status:w,statusText:T}=f;throw new cc(T||"fetch, bad network response",w,f)}n.loading.first=m,n.total=uc(f.headers)||n.total;const v=(d=this.callbacks)==null?void 0:d.onProgress;return v&&N(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,v):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var d,m;const v=this.response;if(!v)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const w=f[o];w&&(n.loaded=n.total=w);const T={url:v.url,data:f,code:v.status},k=(d=this.callbacks)==null?void 0:d.onProgress;k&&!N(t.highWaterMark)&&k(n,e,f,v),(m=this.callbacks)==null||m.onSuccess(T,n,e,v)}).catch(f=>{var d;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const m=f&&f.code||0,v=f?f.message:null;(d=this.callbacks)==null||d.onError({code:m,text:v},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 Sa,o=e.body.getReader(),h=()=>o.read().then(u=>{if(u.done)return r.dataLength&&s(t,i,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const c=u.value,f=c.length;return t.loaded+=f,f<n||r.dataLength?(r.push(c),r.dataLength>=n&&s(t,i,r.flush().buffer,e)):s(t,i,c.buffer,e),h()}).catch(()=>Promise.reject());return h()}}function oc(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(g({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function lc(a){const e=ac.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function uc(a){const e=a.get("Content-Range");if(e){const i=lc(e);if(N(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function hc(a,e){return new self.Request(a.url,e)}class cc extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const fc=/^age:\s*[\d.]+\s*$/im;class Ko{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 _,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&&N(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,c=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const v=c!=null?c:t.response;if(v!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const w=t.responseType==="arraybuffer"?v.byteLength:v.length;i.loaded=i.total=w,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const T=(r=this.callbacks)==null?void 0:r.onProgress;T&&T(i,e,v,t);const k={url:t.responseURL,data:v,code:u};(o=this.callbacks)==null||o.onSuccess(k,i,e,t);return}}const f=s.loadPolicy.errorRetry,d=i.retry,m={url:e.url,data:void 0,code:u};if(Yi(f,d,!1,m))this.retry(f);else{var h;W.error(`${u} while loading ${e.url}`),(h=this.callbacks)==null||h.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(Yi(e,t,!0))this.retry(e);else{var i;W.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=Fn(e,i.retry),i.retry++,W.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&&fc.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 dc={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},pc=y(y({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:Ko,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:en,bufferController:Eu,capLevelController:kr,errorController:Yn,fpsController:_h,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:ni,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:dc},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},gc()),{},{subtitleStreamController:Rh,subtitleTrackController:Eh,timelineController:tc,audioStreamController:mu,audioTrackController:_u,emeController:vs,cmcdController:ph,contentSteeringController:mh,interstitialsController:Lh});function gc(){return{cueHandler:sc,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 mc(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=Zr(a),n=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(r=>{const o=`${r==="level"?"playlist":r}LoadPolicy`,h=e[o]===void 0,u=[];s.forEach(c=>{const f=`${r}Loading${c}`,d=e[f];if(d!==void 0&&h){u.push(f);const m=i[o].default;switch(e[o]={default:m},c){case"TimeOut":m.maxLoadTimeMs=d,m.maxTimeToFirstByteMs=d;break;case"MaxRetry":m.errorRetry.maxNumRetry=d,m.timeoutRetry.maxNumRetry=d;break;case"RetryDelay":m.errorRetry.retryDelayMs=d,m.timeoutRetry.retryDelayMs=d;break;case"MaxRetryTimeout":m.errorRetry.maxRetryDelayMs=d,m.timeoutRetry.maxRetryDelayMs=d;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${kt(e[o])}`)}),y(y({},i),e)}function Zr(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(Zr):Object.keys(a).reduce((e,t)=>(e[t]=Zr(a[t]),e),{}):a}function _c(a,e){const t=a.loader;t!==Go&&t!==Ko?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):rc()&&(a.loader=Go,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const rr=2,vc=.1,yc=.05,Ec=100;class bc extends Ln{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(Ec),this.mediaSource=t.mediaSource;const i=this.media=t.media;Mi(i,"playing",this.onMediaPlaying),Mi(i,"waiting",this.onMediaWaiting),Mi(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(Gi(i,"playing",this.onMediaPlaying),Gi(i,"waiting",this.onMediaWaiting),Gi(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,h=this.seeking&&!o,u=!this.seeking&&o,c=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&&!c&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(u||h){h&&this.stallResolved(e);return}if(c){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(!Lt.getBuffered(r).length){this.nudgeRetry=0;return}const f=Lt.bufferInfo(r,e,0),d=f.nextStart||0,m=this.fragmentTracker;if(o&&m&&this.hls){const Ie=Vo(this.hls.inFlightFragments,e),ce=f.len>rr,Se=!d||Ie||d-e>rr&&!m.getPartialFragment(e);if(ce||Se)return;this.moved=!1}const v=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&m){if(!(f.len>0)&&!d)return;const ce=Math.max(d,f.start||0)-e,Ae=!!(v!=null&&v.live)?v.targetduration*2:rr,pe=ar(e,m);if(ce>0&&(ce<=Ae||pe)){r.paused||this._trySkipBufferHole(pe);return}}const w=s.detectStallWithCurrentTimeMs,T=self.performance.now(),k=this.waiting;let X=this.stalled;if(X===null)if(k>0&&T-k<w)X=this.stalled=k;else{this.stalled=T;return}const H=T-X;if(!o&&(H>=w||k)&&this.hls){var ue;if(((ue=this.mediaSource)==null?void 0:ue.readyState)==="ended"&&!(v!=null&&v.live)&&Math.abs(e-((v==null?void 0:v.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 ve=Lt.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(ve,H,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=Lt.bufferedInfo(Lt.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=Lt.timeRangesToArray(n),o=Lt.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const h=Lt.bufferedInfo(r,e,0).bufferedIndex,u=r[o].end,c=r[o+1].start;if((h===-1||h>o)&&c-u<1&&e-u<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${c} buffered index: ${h}`);this.warn(f.message),this.media.currentTime+=1e-6;let d=ar(e,this.fragmentTracker);d&&"fragment"in d?d=d.fragment:d||(d=void 0);const m=Lt.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:V.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:d,buffer:m.len,bufferInfo:m})}}}}}_tryFixBufferStall(e,t,i){var n,s;const{fragmentTracker:r,media:o}=this,h=(n=this.hls)==null?void 0:n.config;if(!o||!r||!h)return;const u=(s=this.hls)==null?void 0:s.latestLevelDetails,c=ar(i,r);if((c||u!=null&&u.live&&i<u.fragmentStart)&&(this._trySkipBufferHole(c)||!this.media))return;const f=e.buffered,d=this.adjacentTraversal(e,i);(f&&f.length>1&&e.len>h.maxBufferHole||e.nextStart&&(e.nextStart-i<h.maxBufferHole||d))&&(t>h.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,ne.MAIN),r=i.getFragAtPos(n,ne.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 (${kt(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:V.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=Lt.bufferInfo(n,r,0),h=r<o.start?o.start:o.nextStart;if(h&&this.hls){const c=o.len<=s.maxBufferHole,f=o.len>0&&o.len<1&&n.readyState<3,d=h-r;if(d>0&&(c||f)){if(d>s.maxBufferHole){let v=!1;if(r===0){const w=i.getAppendedFrag(0,ne.MAIN);w&&h<w.end&&(v=!0)}if(!v&&e){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||Vo(this.hls.inFlightFragments,h))return 0;let T=!1,k=e.end;for(;k<h;){const X=ar(k,i);if(X)k+=X.duration;else{T=!0;break}}if(T)return 0}}const m=Math.max(h+yc,r+vc);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${m}`),this.moved=!0,n.currentTime=m,!(e!=null&&e.gap)){const v=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${m}`),w={type:oe.MEDIA_ERROR,details:V.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:v,reason:v.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?w.part=e:w.frag=e),this.hls.trigger(p.ERROR,w)}return m}}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,h=new Error(`Nudging 'currentTime' from ${r} to ${o}`);this.warn(h.message),i.currentTime=o,t.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:V.BUFFER_NUDGE_ON_STALL,error:h,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:oe.MEDIA_ERROR,details:V.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Vo(a,e){const t=jo(a.main);if(t&&t.start<=e)return t;const i=jo(a.audio);return i&&i.start<=e?i:null}function jo(a){if(!a)return null;switch(a.state){case Me.IDLE:case Me.STOPPED:case Me.ENDED:case Me.ERROR:return null}return a.frag}function ar(a,e){return e.getAppendedFrag(a,ne.MAIN)||e.getPartialFragment(a)}const xc=.25;function qr(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Xr(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,kt(n?y({type:n},i):i))}return s}const or=(()=>{const a=qr();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Tc{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&&ys(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 yo(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=qr();if(r)for(let o=0;o<s.length;o++){const h=s[o].type;if(h===zi.emsg&&!i||!n)continue;const u=Pa(s[o].data),c=s[o].pts;let f=c+s[o].duration;f>or&&(f=or),f-c<=0&&(f=c+xc);for(let m=0;m<u.length;m++){const v=u[m];if(!Oa(v)){this.updateId3CueEnds(c,h);const w=Xr(r,c,f,v,h);w&&this.id3Track.addCue(w)}}}}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===or&&(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:h}}=r;if(s&&(o||h)){let u;n==="audio"?u=c=>c.type===zi.audioId3&&h:n==="video"?u=c=>c.type===zi.emsg&&o:u=c=>c.type===zi.audioId3&&h||c.type===zi.emsg&&o,Nr(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=qr();if(i&&n&&!r){const{fragmentStart:w,fragmentEnd:T}=e;let k=this.assetCue;k?(k.startTime=w,k.endTime=T):o&&(k=this.assetCue=Xr(o,w,T,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),k&&(k.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(k),k.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:h}=this,{dateRanges:u}=e,c=Object.keys(u);let f=this.dateRangeCuesAppended;if(h&&t){var d;if((d=h.cues)!=null&&d.length){const w=Object.keys(f).filter(T=>!c.includes(T));for(let T=w.length;T--;){var m;const k=w[T],X=(m=f[k])==null?void 0:m.cues;delete f[k],X&&Object.keys(X).forEach(H=>{const ue=X[H];if(ue){ue.removeEventListener("enter",this.onEventCueEnter);try{h.removeCue(ue)}catch(ve){}}})}}else f=this.dateRangeCuesAppended={}}const v=e.fragments[e.fragments.length-1];if(!(c.length===0||!N(v==null?void 0:v.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let w=0;w<c.length;w++){const T=c[w],k=u[T],X=k.startTime,H=f[T],ue=(H==null?void 0:H.cues)||{};let ve=(H==null?void 0:H.durationKnown)||!1,Ie=or;const{duration:ce,endDate:Se}=k;if(Se&&ce!==null)Ie=X+ce,ve=!0;else if(k.endOnNext&&!ve){const pe=c.reduce((Fe,lt)=>{if(lt!==k.id){const mt=u[lt];if(mt.class===k.class&&mt.startDate>k.startDate&&(!Fe||k.startDate<Fe.startDate))return mt}return Fe},null);pe&&(Ie=pe.startTime,ve=!0)}const Ae=Object.keys(k.attr);for(let pe=0;pe<Ae.length;pe++){const Fe=Ae[pe];if(!Ls(Fe))continue;const lt=ue[Fe];if(lt)ve&&!(H!=null&&H.durationKnown)?lt.endTime=Ie:Math.abs(lt.startTime-X)>.01&&(lt.startTime=X,lt.endTime=Ie);else if(o){let mt=k.attr[Fe];fs(Fe)&&(mt=A(mt));const _t=Xr(o,X,Ie,{key:Fe,data:mt},zi.dateRange);_t&&(_t.id=T,this.id3Track.addCue(_t),ue[Fe]=_t,r&&(Fe==="X-ASSET-LIST"||Fe==="X-ASSET-URL")&&_t.addEventListener("enter",this.onEventCueEnter))}}f[T]={cues:ue,dateRange:k,durationKnown:ve}}}}}class wc{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 h=n-o,u=Math.min(this.maxLatency,o+i.targetduration);if(h<u&&h>.05&&this.forwardBufferLength>1){const f=Math.min(2,Math.max(1,r)),d=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20,m=Math.min(f,Math.max(1,d));this.changeMediaPlaybackRate(t,m)}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,h=this.hls.userConfig;let u=o&&i||t;(this._targetLatencyUpdated||h.liveSyncDuration||h.liveSyncDurationCount||u===0)&&(u=s!==void 0?s:r*n);const c=n;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,c)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(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===V.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 Sc extends Lr{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,h=!1,u=!1;t.levels.forEach(c=>{const f=c.attrs;let{audioCodec:d,videoCodec:m}=c;d&&(c.audioCodec=d=Z(d,i)||void 0),m&&(m=c.videoCodec=ze(m));const{width:v,height:w,unknownCodecs:T}=c;let k=T?T.length:0;if(T)for(let pe=k;pe--;){const Fe=T[pe];this.isAudioSupported(Fe)?(c.audioCodec=d=d?`${d},${Fe}`:Fe,k--,nt.audio[d.substring(0,4)]=2):this.isVideoSupported(Fe)&&(c.videoCodec=m=m?`${m},${Fe}`:Fe,k--,nt.video[m.substring(0,4)]=2)}if(o||(o=!!(v&&w)),h||(h=!!m),u||(u=!!d),k||d&&!this.isAudioSupported(d)||m&&!this.isVideoSupported(m)){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}const{CODECS:X,"FRAME-RATE":H,"HDCP-LEVEL":ue,"PATHWAY-ID":ve,RESOLUTION:Ie,"VIDEO-RANGE":ce}=f,Ae=`${`${ve||"."}-`}${c.bitrate}-${Ie}-${H}-${X}-${ce}-${ue}`;if(s[Ae])if(s[Ae].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const pe=r[Ae]+=1;c.attrs["PATHWAY-ID"]=new Array(pe+1).join(".");const Fe=this.createLevel(c);s[Ae]=Fe,n.push(Fe)}else s[Ae].addGroupId("audio",f.AUDIO),s[Ae].addGroupId("text",f.SUBTITLES);else{const pe=this.createLevel(c);s[Ae]=pe,r[Ae]=1,n.push(pe)}}),this.filterAndSortMediaOptions(n,t,o,h,u)}createLevel(e){const t=new xi(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=li(n,[])}return t}isAudioSupported(e){return Bt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Bt(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,s){let r=[],o=[],h=e;if((i||n)&&s&&(h=h.filter(({videoCodec:T,videoRange:k,width:X,height:H})=>(!!T||!!(X&&H))&&_i(k))),h.length===0){Promise.resolve().then(()=>{if(this.hls){let T="no level with compatible codecs found in manifest",k=T;t.levels.length&&(k=`one or more CODECS in variant not supported: ${kt(t.levels.map(H=>H.attrs.CODECS).filter((H,ue,ve)=>ve.indexOf(H)===ue))}`,this.warn(k),T+=` (${k})`);const X=new Error(T);this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:V.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:X,reason:k})}});return}t.audioTracks&&(r=t.audioTracks.filter(T=>!T.audioCodec||this.isAudioSupported(T.audioCodec)),zo(r)),t.subtitles&&(o=t.subtitles,zo(o));const u=h.slice(0);h.sort((T,k)=>{if(T.attrs["HDCP-LEVEL"]!==k.attrs["HDCP-LEVEL"])return(T.attrs["HDCP-LEVEL"]||"")>(k.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&T.height!==k.height)return T.height-k.height;if(T.frameRate!==k.frameRate)return T.frameRate-k.frameRate;if(T.videoRange!==k.videoRange)return Ei.indexOf(T.videoRange)-Ei.indexOf(k.videoRange);if(T.videoCodec!==k.videoCodec){const X=be(T.videoCodec),H=be(k.videoCodec);if(X!==H)return H-X}if(T.uri===k.uri&&T.codecSet!==k.codecSet){const X=le(T.codecSet),H=le(k.codecSet);if(X!==H)return H-X}return T.averageBitrate!==k.averageBitrate?T.averageBitrate-k.averageBitrate:0});let c=u[0];if(this.steering&&(h=this.steering.filterParsedLevels(h),h.length!==u.length)){for(let T=0;T<u.length;T++)if(u[T].pathwayId===h[0].pathwayId){c=u[T];break}}this._levels=h;for(let T=0;T<h.length;T++)if(h[T]===c){var f;this._firstLevel=T;const k=c.bitrate,X=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${h.length} level(s) found, first bitrate: ${k}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const H=Math.min(k,this.hls.config.abrEwmaDefaultEstimateMax);H>X&&X===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=H)}break}const d=s&&!n,m=this.hls.config,v=!!(m.audioStreamController&&m.audioTrackController),w={levels:h,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:v&&!d&&r.some(T=>!!T.url)};this.hls.trigger(p.MANIFEST_PARSED,w)}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 c=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:V.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:c,reason:c.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 h={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,h);const u=r.details;if(!u||u.live){const c=this.switchParams(r.uri,n==null?void 0:n.details,u);this.loadPlaylist(c)}}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===ge.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ne.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 h=r.details;h===t.details&&h.advanced&&(h=void 0),this.playlistLoaded(n,t,h)}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));ya(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 zo(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function Ho(){return self.SourceBuffer||self.WebKitSourceBuffer}function Wo(){if(!te())return!1;const e=Ho();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Ac(){if(!Wo())return!1;const a=te();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(ei(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(ei(e,"audio"))))}function Dc(){var a;const e=Ho();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Lc=100;class Rc extends dr{constructor(e,t,i){super(e,t,i,"stream-controller",ne.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||!N(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const r=this.getFwdBufferInfoAtPos(n,s,ne.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(Lc),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=Me.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Me.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Me.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=Me.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Me.IDLE;break}break}case Me.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===Me.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 h=this.getLevelDetails();if(h&&this._streamEnded(o,h)){const w={};this.altAudio===2&&(w.type="video"),this.hls.trigger(p.BUFFER_EOS,w),this.state=Me.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===Me.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=Me.WAITING_LEVEL,this.startFragRequested=!1;return}const c=o.len,f=this.getMaxBufferLength(r.maxBitrate);if(c>=f)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:o.end;let m=this.getNextFragment(d,u);if(this.couldBacktrack&&!this.fragPrevious&&m&&Te(m)&&this.fragmentTracker.getState(m)!==Qt.OK){var v;const T=((v=this.backtrackFragment)!=null?v:m).sn-u.startSN,k=u.fragments[T-1];k&&m.cc===k.cc&&(m=k,this.fragmentTracker.removeFragment(k))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(m&&this.isLoopLoading(m,d)){if(!m.gap){const T=this.audioOnly&&!this.altAudio?R.AUDIO:R.VIDEO,k=(T===R.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;k&&this.afterBufferFlushed(k,T,ne.MAIN)}m=this.getNextFragmentLoopLoading(m,u,o,ne.MAIN,f)}m&&(m.initSegment&&!m.initSegment.data&&!this.bitrateTest&&(m=m.initSegment),this.loadFragment(m,r,d))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===Qt.NOT_LOADED||n===Qt.PARTIAL?Te(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,ne.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,h=e[o],u=this.fragLastKbps;u&&this.fragCurrent?i=this.fragCurrent.duration*h.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 h=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,c=Math.max(r.end,h+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(c,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 Me.KEY_LOADING:case Me.FRAG_LOADING:case Me.FRAG_LOADING_WAITING_RETRY:case Me.PARSING:case Me.PARSED:this.state=Me.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;Mi(i,"playing",this.onMediaPlaying),Mi(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(Gi(i,"playing",this.onMediaPlaying),Gi(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&&!Dc(),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!==Me.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=Me.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:n,startFragRequested:s}=this,r=t.level,o=t.details,h=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:${h}`);const u=t.levelInfo,c=this.fragCurrent;c&&(this.state===Me.FRAG_LOADING||this.state===Me.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.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===Me.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=Me.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,h=s>=r-t.maxFragLookUpTolerance&&s<=o;if(n!==null&&i.duration>n&&(s<n||!h)){const c=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!h&&i.readyState<4||s<o-c)&&(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=Lt.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:m}=Lt.bufferedInfo(f.buffered,s,0);m&&(i.currentTime=m)}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 h=o.details;if(!h){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const u=o.videoCodec,c=h.PTSKnown||!h.live,f=(t=i.initSegment)==null?void 0:t.data,d=this._getAudioCodec(o),m=this.transmuxer=this.transmuxer||new qa(this.hls,ne.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),v=n?n.index:-1,w=v!==-1,T=new Fi(i.level,i.sn,i.stats.chunkCount,s.byteLength,v,w),k=this.initPTS[i.cc];m.push(s,f,d,u,i,n,h.totalduration,c,T,k)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(xn(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=xn(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 h=i[o];if(h.id==="main"){if(s=o,n=h,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===ne.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===Me.PARSED&&(this.state=Me.IDLE);return}const o=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),Te(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const r=this.media;r&&(!this._hasEnoughToStart&&Lt.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=Me.ERROR;return}switch(t.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ne.MAIN,t);break;case V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Me.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ge.LEVEL&&(this.state=Me.IDLE);break;case V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case V.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 V.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=Me.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==R.AUDIO||!this.altAudio){const i=(t===R.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,ne.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=Lt.getBuffered(e),o=r.length?r.start(0):0,h=o-i,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||h>0&&(h<u||this.loadingParts&&h<2*((s==null?void 0:s.partTarget)||0)))&&(this.log(`adjusting start position by ${h} to match buffer start`),i+=h,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=Me.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===Me.STOPPED||this.state===Me.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:h,level:u}=r,{video:c,text:f,id3:d,initSegment:m}=n,{details:v}=u,w=this.altAudio?void 0:n.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=Me.PARSING,m){const T=m.tracks;if(T){const ue=o.initSegment||o;if(this.unhandledEncryptionError(m,o))return;this._bufferInitSegment(u,T,ue,s),i.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:ue,id:t,tracks:T})}const k=m.initPTS,X=m.timescale,H=this.initPTS[o.cc];if(N(k)&&(!H||H.baseTime!==k||H.timescale!==X)){const ue=m.trackId;this.initPTS[o.cc]={baseTime:k,timescale:X,trackId:ue},i.trigger(p.INIT_PTS_FOUND,{frag:o,id:t,initPTS:k,timescale:X,trackId:ue})}}if(c&&v){w&&c.type==="audiovideo"&&this.logMuxedErr(o);const T=v.fragments[o.sn-1-v.startSN],k=o.sn===v.startSN,X=!T||o.cc>T.cc;if(n.independent!==!1){const{startPTS:H,endPTS:ue,startDTS:ve,endDTS:Ie}=c;if(h)h.elementaryStreams[c.type]={startPTS:H,endPTS:ue,startDTS:ve,endDTS:Ie};else if(c.firstKeyFrame&&c.independent&&s.id===1&&!X&&(this.couldBacktrack=!0),c.dropped&&c.independent){const ce=this.getMainFwdBufferInfo(),Se=(ce?ce.end:this.getLoadPosition())+this.config.maxBufferHole,Ae=c.firstKeyFramePTS?c.firstKeyFramePTS:H;if(!k&&Se<Ae-this.config.maxBufferHole&&!X){this.backtrack(o);return}else X&&(o.gap=!0);o.setElementaryStreamInfo(c.type,o.start,ue,o.start,Ie,!0)}else k&&H-(v.appliedTimelineOffset||0)>rr&&(o.gap=!0);o.setElementaryStreamInfo(c.type,H,ue,ve,Ie),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(c,o,h,s,k||X)}else if(k||X)o.gap=!0;else{this.backtrack(o);return}}if(w){const{startPTS:T,endPTS:k,startDTS:X,endDTS:H}=w;h&&(h.elementaryStreams[R.AUDIO]={startPTS:T,endPTS:k,startDTS:X,endDTS:H}),o.setElementaryStreamInfo(R.AUDIO,T,k,X,H),this.bufferFragmentData(w,o,h,s)}if(v&&d!=null&&d.samples.length){const T={id:t,frag:o,details:v,samples:d.samples};i.trigger(p.FRAG_PARSING_METADATA,T)}if(v&&f){const T={id:t,frag:o,details:v,samples:f.samples};i.trigger(p.FRAG_PARSING_USERDATA,T)}}logMuxedErr(e){this.warn(`${Te(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==Me.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 c=re(s.codec,u);c==="mp4a"&&(c="mp4a.40.5");const f=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){c&&(c.indexOf("mp4a.40.5")!==-1?c="mp4a.40.2":c="mp4a.40.5");const d=s.metadata;d&&"channelCount"in d&&(d.channelCount||1)!==1&&f.indexOf("firefox")===-1&&(c="mp4a.40.5")}c&&c.indexOf("mp4a.40.5")!==-1&&f.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(c="mp4a.40.2",this.log(`Android: force audio codec to ${c}`)),u&&u!==c&&this.log(`Swapping manifest audio codec "${u}" for "${c}"`),s.levelCodec=c,s.id=ne.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${c||""}/${u||""}/${s.codec}]`),delete t.audiovideo}if(r){r.levelCodec=e.videoCodec,r.id=ne.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 h=Object.keys(t);if(h.length){if(this.hls.trigger(p.BUFFER_CODECS,t),!this.hls)return;h.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,ne.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=Me.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Lt.isBuffered(e,i)?t=this.getAppendedFrag(i):Lt.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const 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 N(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(N(t)){const i=this.getLevelDetails(),n=this.currentFrag||(i?Hi(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 Ic extends P{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=V.KEY_LOAD_ERROR,i,n,s){return new Oi({type:oe.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&&(!Te(e)||!Te(r)||e.sn<r.sn)||!i&&n==s-1)return this.emeController.selectKeySystemFormat(r).then(o=>{if(!this.emeController)return;r.setKeyFormat(o);const h=Kn(o);if(h)return this.emeController.getKeySystemAccess([h])})}if(this.config.requireKeySystemAccessOnStart){const n=Rt(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 c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,V.KEY_LOAD_ERROR,c))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,V.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));const o=Qr(s);let h=this.keyIdToKeyInfo[o];if((i=h)!=null&&i.decryptdata.key)return s.key=h.decryptdata.key,Promise.resolve({frag:e,keyInfo:h});if((n=h)!=null&&n.keyLoadPromise){var u;switch((u=h.mediaKeySessionContext)==null?void 0:u.keyStatus){case"usable":case"usable-in-future":return h.keyLoadPromise.then(f=>{const{keyInfo:d}=f;return s.key=d.decryptdata.key,{frag:e,keyInfo:d}})}}switch(this.log(`Loading key ${M(s.keyId||[])} from ${e.type} ${e.level}`),h=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(h,e):this.loadKeyEME(h,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(h,e);default:return Promise.reject(this.createKeyLoadError(e,V.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const n=this.emeController.loadKey(i);return(e.keyLoadPromise=n.then(s=>(e.mediaKeySessionContext=s,i))).catch(s=>{throw e.keyLoadPromise=null,s.data&&(s.data.frag=t),s})}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 h={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=i.keyLoadPolicy.default,c={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,m,v,w)=>{const{frag:T,keyInfo:k,url:X}=v,H=Qr(k.decryptdata)||X;if(!T.decryptdata||k!==this.keyIdToKeyInfo[H])return o(this.createKeyLoadError(T,V.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),w));k.decryptdata.key=T.decryptdata.key=new Uint8Array(d.data),T.keyLoader=null,k.loader=null,r({frag:T,keyInfo:k})},onError:(d,m,v,w)=>{this.resetLoader(m),o(this.createKeyLoadError(t,V.KEY_LOAD_ERROR,new Error(`HTTP Error ${d.code} loading key ${d.text}`),v,y({url:h.url,data:void 0},d)))},onTimeout:(d,m,v)=>{this.resetLoader(m),o(this.createKeyLoadError(t,V.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),v))},onAbort:(d,m,v)=>{this.resetLoader(m),o(this.createKeyLoadError(t,V.INTERNAL_ABORTED,new Error("key loading aborted"),v))}};s.load(h,c,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=Qr(i.decryptdata)||n;delete this.keyIdToKeyInfo[r],s&&s.destroy()}}function Qr(a){const e=a.keyId;return e?M(e):a.uri}function Yo(a){const{type:e}=a;switch(e){case ge.AUDIO_TRACK:return ne.AUDIO;case ge.SUBTITLE_TRACK:return ne.SUBTITLE;default:return ne.MAIN}}function Jr(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class kc{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:ge.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:s,url:r,deliveryDirectives:o,levelInfo:h}=t;this.load({id:i,level:n,pathwayId:s,responseType:"text",type:ge.LEVEL,url:r,deliveryDirectives:o,levelOrTrack:h})}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:ge.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:ge.SUBTITLE_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[ge.LEVEL];if(i){const n=i.context;n&&!t.levels.some(s=>s===n.levelOrTrack)&&(i.abort(),delete this.loaders[ge.LEVEL])}}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const u=this.hls.logger,c=n.context;if(c&&c.levelOrTrack===e.levelOrTrack&&(c.url===e.url||c.deliveryDirectives&&!e.deliveryDirectives)){c.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${c.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let s;if(e.type===ge.MANIFEST?s=i.manifestLoadPolicy.default:s=g({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),N((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===ge.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===ge.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===ge.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const c=u.partTarget,f=u.targetduration;if(c&&f){const d=Math.max(c*3,f*.8)*1e3;s=g({},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},h={onSuccess:(u,c,f,d)=>{const m=this.getInternalLoader(f);this.resetInternalLoader(f.type);const v=u.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),d||null,c);return}c.parsing.start=performance.now(),gn.isMediaPlaylist(v)||f.type!==ge.MANIFEST?this.handleTrackOrLevelPlaylist(u,c,f,d||null,m):this.handleMasterPlaylist(u,c,f,d)},onError:(u,c,f,d)=>{this.handleNetworkError(c,f,!1,u,d)},onTimeout:(u,c,f)=>{this.handleNetworkError(c,f,!0,void 0,u)}};n.load(e,o,h)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const s=this.hls,r=e.data,o=Jr(e,i),h=gn.parseMasterPlaylist(r,o);if(h.playlistParsingError){this.handleManifestParsingError(e,i,h.playlistParsingError,n,t);return}const{contentSteering:u,levels:c,sessionData:f,sessionKeys:d,startTimeOffset:m,variableList:v}=h;this.variableList=v;const{AUDIO:w=[],SUBTITLES:T,"CLOSED-CAPTIONS":k}=gn.parseMasterPlaylistMedia(r,o,h);w.length&&!w.some(H=>!H.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),w.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Jt({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:c,audioTracks:w,subtitles:T,captions:k,contentSteering:u,url:o,stats:t,networkDetails:n,sessionData:f,sessionKeys:d,startTimeOffset:m,variableList:v})}handleTrackOrLevelPlaylist(e,t,i,n,s){const r=this.hls,{id:o,level:h,type:u}=i,c=Jr(e,i),f=N(h)?h:N(o)?o:0,d=Yo(i),m=gn.parseLevelPlaylist(e.data,c,f,d,0,this.variableList);if(u===ge.MANIFEST){const v={attrs:new Jt({}),bitrate:0,details:m,name:"",url:c};m.requestScheduled=t.loading.start+ga(m,0),r.trigger(p.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:c,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=m,this.handlePlaylistLoaded(m,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(p.ERROR,{type:oe.NETWORK_ERROR,details:V.MANIFEST_PARSING_ERROR,fatal:t.type===ge.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===ge.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===ge.AUDIO_TRACK||e.type===ge.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let h=V.UNKNOWN,u=!1;const c=this.getInternalLoader(e);switch(e.type){case ge.MANIFEST:h=i?V.MANIFEST_LOAD_TIMEOUT:V.MANIFEST_LOAD_ERROR,u=!0;break;case ge.LEVEL:h=i?V.LEVEL_LOAD_TIMEOUT:V.LEVEL_LOAD_ERROR,u=!1;break;case ge.AUDIO_TRACK:h=i?V.AUDIO_TRACK_LOAD_TIMEOUT:V.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ge.SUBTITLE_TRACK:h=i?V.SUBTITLE_TRACK_LOAD_TIMEOUT:V.SUBTITLE_LOAD_ERROR,u=!1;break}c&&this.resetInternalLoader(e.type);const f={type:oe.NETWORK_ERROR,details:h,fatal:u,url:e.url,loader:c,context:e,error:o,networkDetails:t,stats:s};if(n){const d=(t==null?void 0:t.url)||e.url;f.response=y({url:d,data:void 0},n)}this.hls.trigger(p.ERROR,f)}handlePlaylistLoaded(e,t,i,n,s,r){const o=this.hls,{type:h,level:u,id:c,groupId:f,deliveryDirectives:d}=n,m=Jr(t,n),v=Yo(n),w=typeof n.level=="number"&&v===ne.MAIN?u:void 0;if(!e.fragments.length){const k=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:oe.NETWORK_ERROR,details:V.LEVEL_EMPTY_ERROR,fatal:!1,url:m,error:k,reason:k.message,response:t,context:n,level:w,parent:v,networkDetails:s,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const T=e.playlistParsingError;if(T){if(this.hls.logger.warn(`${T} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(p.ERROR,{type:oe.NETWORK_ERROR,details:V.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:T,reason:T.message,response:t,context:n,level:w,parent:v,networkDetails:s,stats:i});return}e.playlistParsingError=null}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),(!r.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),h){case ge.MANIFEST:case ge.LEVEL:o.trigger(p.LEVEL_LOADED,{details:e,levelInfo:n.levelOrTrack||o.levels[0],level:w||0,id:c||0,stats:i,networkDetails:s,deliveryDirectives:d,withoutMultiVariant:h===ge.MANIFEST});break;case ge.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:c||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:d});break;case ge.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:c||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:d});break}}}class Hn{static get version(){return Ps}static isMSESupported(){return Wo()}static isSupported(){return Ac()}static getMediaSource(){return te()}static get Events(){return p}static get MetadataSchema(){return zi}static get ErrorTypes(){return oe}static get ErrorDetails(){return V}static get DefaultConfig(){return Hn.defaultConfig?Hn.defaultConfig:pc}static set DefaultConfig(e){Hn.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 gr,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=ie(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=mc(Hn.DefaultConfig,e,t);this.userConfig=e,i.progressive&&_c(i,t);const{abrController:n,bufferController:s,capLevelController:r,errorController:o,fpsController:h}=i,u=new o(this),c=this.abrController=new n(this),f=new hn(this),d=i.interstitialsController,m=d?this.interstitialsController=new d(this,Hn):null,v=this.bufferController=new s(this,f),w=this.capLevelController=new r(this),T=new h(this),k=new kc(this),X=i.contentSteeringController,H=X?new X(this):null,ue=this.levelController=new Sc(this,H),ve=new Tc(this),Ie=new Ic(this.config,this.logger),ce=this.streamController=new Rc(this,f,Ie),Se=this.gapController=new bc(this,f);w.setStreamController(ce),T.setStreamController(ce);const Ae=[k,ue,ce];m&&Ae.splice(1,0,m),H&&Ae.splice(1,0,H),this.networkControllers=Ae;const pe=[c,v,Se,w,T,ve,f];this.audioTrackController=this.createController(i.audioTrackController,Ae);const Fe=i.audioStreamController;Fe&&Ae.push(this.audioStreamController=new Fe(this,f,Ie)),this.subtitleTrackController=this.createController(i.subtitleTrackController,Ae);const lt=i.subtitleStreamController;lt&&Ae.push(this.subtititleStreamController=new lt(this,f,Ie)),this.createController(i.timelineController,pe),Ie.emeController=this.emeController=this.createController(i.emeController,pe),this.cmcdController=this.createController(i.cmcdController,pe),this.latencyController=this.createController(wc,pe),this.coreComponents=pe,Ae.push(u);const mt=u.onErrorOut;typeof mt=="function"&&this.on(p.ERROR,mt,u),this.on(p.MANIFEST_LOADED,k.onManifestLoaded,k)}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:oe.OTHER_ERROR,details:V.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:oe.OTHER_ERROR,details:V.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=E.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={[ne.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[ne.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[ne.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=bh()),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){qt(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=vi(t);return ci(e,i,navigator.mediaCapabilities)}}Hn.defaultConfig=void 0}}]);
|
|
}()); |