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

1038 lines
1.1 MiB

!(function(){var Xo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[1006],{65966:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return Ke}});var k=T(20439),ce=T(50298),Se=T(62646),le=T(43403),K=T(92310),p=T.n(K),he=T(29301),oe=T(76846),o=T(96452),x=T(6089),A=T(80402),h=T(34280),m=T(49658),y=T(59301),S=T(14809),O=T(77900),G=T(8654);function W(_e){var ve=_e.prefixCls,F=_e.align,xe=_e.arrow,ke=_e.arrowPos,$=xe||{},R=$.className,ne=$.content,be=ke.x,P=be===void 0?0:be,C=ke.y,X=C===void 0?0:C,q=y.useRef();if(!F||!F.points)return null;var Q={position:"absolute"};if(F.autoArrow!==!1){var se=F.points[0],me=F.points[1],Ce=se[0],Ie=se[1],De=me[0],Fe=me[1];Ce===De||!["t","b"].includes(Ce)?Q.top=X:Ce==="t"?Q.top=0:Q.bottom=0,Ie===Fe||!["l","r"].includes(Ie)?Q.left=P:Ie==="l"?Q.left=0:Q.right=0}return y.createElement("div",{ref:q,className:p()("".concat(ve,"-arrow"),R),style:Q},ne)}function I(_e){var ve=_e.prefixCls,F=_e.open,xe=_e.zIndex,ke=_e.mask,$=_e.motion;return ke?y.createElement(O.default,(0,S.Z)({},$,{motionAppear:!0,visible:F,removeOnLeave:!0}),function(R){var ne=R.className;return y.createElement("div",{style:{zIndex:xe},className:p()("".concat(ve,"-mask"),ne)})}):null}var M=y.memo(function(_e){var ve=_e.children;return ve},function(_e,ve){return ve.cache}),w=M,D=y.forwardRef(function(_e,ve){var F=_e.popup,xe=_e.className,ke=_e.prefixCls,$=_e.style,R=_e.target,ne=_e.onVisibleChanged,be=_e.open,P=_e.keepDom,C=_e.fresh,X=_e.onClick,q=_e.mask,Q=_e.arrow,se=_e.arrowPos,me=_e.align,Ce=_e.motion,Ie=_e.maskMotion,De=_e.forceRender,Fe=_e.getPopupContainer,ze=_e.autoDestroy,je=_e.portal,Ue=_e.zIndex,bt=_e.onMouseEnter,xt=_e.onMouseLeave,it=_e.onPointerEnter,Ft=_e.onPointerDownCapture,Yt=_e.ready,at=_e.offsetX,Ut=_e.offsetY,Me=_e.offsetR,Te=_e.offsetB,Re=_e.onAlign,B=_e.onPrepare,z=_e.stretch,de=_e.targetWidth,fe=_e.targetHeight,pe=typeof F=="function"?F():F,Ve=be||P,qe=(Fe==null?void 0:Fe.length)>0,mt=y.useState(!Fe||!qe),Pt=(0,ce.Z)(mt,2),rn=Pt[0],hn=Pt[1];if((0,h.Z)(function(){!rn&&qe&&R&&hn(!0)},[rn,qe,R]),!rn)return null;var qt="auto",sn={left:"-1000vw",top:"-1000vh",right:qt,bottom:qt};if(Yt||!be){var Rn,Zn=me.points,In=me.dynamicInset||((Rn=me._experimental)===null||Rn===void 0?void 0:Rn.dynamicInset),Nn=In&&Zn[0][1]==="r",kt=In&&Zn[0][0]==="b";Nn?(sn.right=Me,sn.left=qt):(sn.left=at,sn.right=qt),kt?(sn.bottom=Te,sn.top=qt):(sn.top=Ut,sn.bottom=qt)}var ft={};return z&&(z.includes("height")&&fe?ft.height=fe:z.includes("minHeight")&&fe&&(ft.minHeight=fe),z.includes("width")&&de?ft.width=de:z.includes("minWidth")&&de&&(ft.minWidth=de)),be||(ft.pointerEvents="none"),y.createElement(je,{open:De||Ve,getContainer:Fe&&function(){return Fe(R)},autoDestroy:ze},y.createElement(I,{prefixCls:ke,open:be,zIndex:Ue,mask:q,motion:Ie}),y.createElement(he.Z,{onResize:Re,disabled:!be},function(Kt){return y.createElement(O.default,(0,S.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:De,leavedClassName:"".concat(ke,"-hidden")},Ce,{onAppearPrepare:B,onEnterPrepare:B,visible:be,onVisibleChanged:function(Wn){var Oe;Ce==null||(Oe=Ce.onVisibleChanged)===null||Oe===void 0||Oe.call(Ce,Wn),ne(Wn)}}),function(_n,Wn){var Oe=_n.className,Le=_n.style,At=p()(ke,Oe,xe);return y.createElement("div",{ref:(0,G.sQ)(Kt,ve,Wn),className:At,style:(0,k.Z)((0,k.Z)((0,k.Z)((0,k.Z)({"--arrow-x":"".concat(se.x||0,"px"),"--arrow-y":"".concat(se.y||0,"px")},sn),ft),Le),{},{boxSizing:"border-box",zIndex:Ue},$),onMouseEnter:bt,onMouseLeave:xt,onPointerEnter:it,onClick:X,onPointerDownCapture:Ft},Q&&y.createElement(W,{prefixCls:ke,arrow:Q,arrowPos:se,align:me}),y.createElement(w,{cache:!be&&!C},pe))})}))}),re=D,ie=y.forwardRef(function(_e,ve){var F=_e.children,xe=_e.getTriggerDOMNode,ke=(0,G.Yr)(F),$=y.useCallback(function(ne){(0,G.mH)(ve,xe?xe(ne):ne)},[xe]),R=(0,G.x1)($,(0,G.C4)(F));return ke?y.cloneElement(F,{ref:R}):F}),J=ie,ue=y.createContext(null),ge=ue;function Ee(_e){return _e?Array.isArray(_e)?_e:[_e]:[]}function Ne(_e,ve,F,xe){return y.useMemo(function(){var ke=Ee(F!=null?F:ve),$=Ee(xe!=null?xe:ve),R=new Set(ke),ne=new Set($);return _e&&(R.has("hover")&&(R.delete("hover"),R.add("click")),ne.has("hover")&&(ne.delete("hover"),ne.add("click"))),[R,ne]},[_e,ve,F,xe])}var Y=T(29194);function L(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],F=arguments.length>2?arguments[2]:void 0;return F?_e[0]===ve[0]:_e[0]===ve[0]&&_e[1]===ve[1]}function V(_e,ve,F,xe){for(var ke=F.points,$=Object.keys(_e),R=0;R<$.length;R+=1){var ne,be=$[R];if(L((ne=_e[be])===null||ne===void 0?void 0:ne.points,ke,xe))return"".concat(ve,"-placement-").concat(be)}return""}function H(_e,ve,F,xe){return ve||(F?{motionName:"".concat(_e,"-").concat(F)}:xe?{motionName:xe}:null)}function ee(_e){return _e.ownerDocument.defaultView}function j(_e){for(var ve=[],F=_e==null?void 0:_e.parentElement,xe=["hidden","scroll","clip","auto"];F;){var ke=ee(F).getComputedStyle(F),$=ke.overflowX,R=ke.overflowY,ne=ke.overflow;[$,R,ne].some(function(be){return xe.includes(be)})&&ve.push(F),F=F.parentElement}return ve}function v(_e){var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(_e)?ve:_e}function g(_e){return v(parseFloat(_e),0)}function U(_e,ve){var F=(0,k.Z)({},_e);return(ve||[]).forEach(function(xe){if(!(xe instanceof HTMLBodyElement||xe instanceof HTMLHtmlElement)){var ke=ee(xe).getComputedStyle(xe),$=ke.overflow,R=ke.overflowClipMargin,ne=ke.borderTopWidth,be=ke.borderBottomWidth,P=ke.borderLeftWidth,C=ke.borderRightWidth,X=xe.getBoundingClientRect(),q=xe.offsetHeight,Q=xe.clientHeight,se=xe.offsetWidth,me=xe.clientWidth,Ce=g(ne),Ie=g(be),De=g(P),Fe=g(C),ze=v(Math.round(X.width/se*1e3)/1e3),je=v(Math.round(X.height/q*1e3)/1e3),Ue=(se-me-De-Fe)*ze,bt=(q-Q-Ce-Ie)*je,xt=Ce*je,it=Ie*je,Ft=De*ze,Yt=Fe*ze,at=0,Ut=0;if($==="clip"){var Me=g(R);at=Me*ze,Ut=Me*je}var Te=X.x+Ft-at,Re=X.y+xt-Ut,B=Te+X.width+2*at-Ft-Yt-Ue,z=Re+X.height+2*Ut-xt-it-bt;F.left=Math.max(F.left,Te),F.top=Math.max(F.top,Re),F.right=Math.min(F.right,B),F.bottom=Math.min(F.bottom,z)}}),F}function te(_e){var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,F="".concat(ve),xe=F.match(/^(.*)\%$/);return xe?_e*(parseFloat(xe[1])/100):parseFloat(F)}function Be(_e,ve){var F=ve||[],xe=(0,ce.Z)(F,2),ke=xe[0],$=xe[1];return[te(_e.width,ke),te(_e.height,$)]}function Ge(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[_e[0],_e[1]]}function Qe(_e,ve){var F=ve[0],xe=ve[1],ke,$;return F==="t"?$=_e.y:F==="b"?$=_e.y+_e.height:$=_e.y+_e.height/2,xe==="l"?ke=_e.x:xe==="r"?ke=_e.x+_e.width:ke=_e.x+_e.width/2,{x:ke,y:$}}function et(_e,ve){var F={t:"b",b:"t",l:"r",r:"l"};return _e.map(function(xe,ke){return ke===ve?F[xe]||"c":xe}).join("")}function gt(_e,ve,F,xe,ke,$,R){var ne=y.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:ke[xe]||{}}),be=(0,ce.Z)(ne,2),P=be[0],C=be[1],X=y.useRef(0),q=y.useMemo(function(){return ve?j(ve):[]},[ve]),Q=y.useRef({}),se=function(){Q.current={}};_e||se();var me=(0,x.Z)(function(){if(ve&&F&&_e){let lr=function(hr,Sn){var Un=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Et,Pn=Ve.x+hr,Mn=Ve.y+Sn,ur=Pn+kt,yr=Mn+Nn,vn=Math.max(Pn,Un.left),Ln=Math.max(Mn,Un.top),pr=Math.min(ur,Un.right),rr=Math.min(yr,Un.bottom);return Math.max(0,(pr-vn)*(rr-Ln))},On=function(){_r=Ve.y+zt,ar=_r+Nn,or=Ve.x+Bt,bn=or+kt};var De,Fe,ze,je,Ue=ve,bt=Ue.ownerDocument,xt=ee(Ue),it=xt.getComputedStyle(Ue),Ft=it.position,Yt=Ue.style.left,at=Ue.style.top,Ut=Ue.style.right,Me=Ue.style.bottom,Te=Ue.style.overflow,Re=(0,k.Z)((0,k.Z)({},ke[xe]),$),B=bt.createElement("div");(De=Ue.parentElement)===null||De===void 0||De.appendChild(B),B.style.left="".concat(Ue.offsetLeft,"px"),B.style.top="".concat(Ue.offsetTop,"px"),B.style.position=Ft,B.style.height="".concat(Ue.offsetHeight,"px"),B.style.width="".concat(Ue.offsetWidth,"px"),Ue.style.left="0",Ue.style.top="0",Ue.style.right="auto",Ue.style.bottom="auto",Ue.style.overflow="hidden";var z;if(Array.isArray(F))z={x:F[0],y:F[1],width:0,height:0};else{var de,fe,pe=F.getBoundingClientRect();pe.x=(de=pe.x)!==null&&de!==void 0?de:pe.left,pe.y=(fe=pe.y)!==null&&fe!==void 0?fe:pe.top,z={x:pe.x,y:pe.y,width:pe.width,height:pe.height}}var Ve=Ue.getBoundingClientRect(),qe=xt.getComputedStyle(Ue),mt=qe.height,Pt=qe.width;Ve.x=(Fe=Ve.x)!==null&&Fe!==void 0?Fe:Ve.left,Ve.y=(ze=Ve.y)!==null&&ze!==void 0?ze:Ve.top;var rn=bt.documentElement,hn=rn.clientWidth,qt=rn.clientHeight,sn=rn.scrollWidth,Rn=rn.scrollHeight,Zn=rn.scrollTop,In=rn.scrollLeft,Nn=Ve.height,kt=Ve.width,ft=z.height,Kt=z.width,_n={left:0,top:0,right:hn,bottom:qt},Wn={left:-In,top:-Zn,right:sn-In,bottom:Rn-Zn},Oe=Re.htmlRegion,Le="visible",At="visibleFirst";Oe!=="scroll"&&Oe!==At&&(Oe=Le);var rt=Oe===At,St=U(Wn,q),Rt=U(_n,q),Et=Oe===Le?Rt:St,Ot=rt?Rt:Et;Ue.style.left="auto",Ue.style.top="auto",Ue.style.right="0",Ue.style.bottom="0";var Mt=Ue.getBoundingClientRect();Ue.style.left=Yt,Ue.style.top=at,Ue.style.right=Ut,Ue.style.bottom=Me,Ue.style.overflow=Te,(je=Ue.parentElement)===null||je===void 0||je.removeChild(B);var Ct=v(Math.round(kt/parseFloat(Pt)*1e3)/1e3),It=v(Math.round(Nn/parseFloat(mt)*1e3)/1e3);if(Ct===0||It===0||(0,oe.Sh)(F)&&!(0,Y.Z)(F))return;var Zt=Re.offset,Nt=Re.targetOffset,ut=Be(Ve,Zt),Ae=(0,ce.Z)(ut,2),Ze=Ae[0],He=Ae[1],Je=Be(z,Nt),lt=(0,ce.Z)(Je,2),pt=lt[0],Lt=lt[1];z.x-=pt,z.y-=Lt;var Gt=Re.points||[],Qt=(0,ce.Z)(Gt,2),tn=Qt[0],$n=Qt[1],Vt=Ge($n),fn=Ge(tn),ln=Qe(z,Vt),mn=Qe(Ve,fn),Wt=(0,k.Z)({},Re),Bt=ln.x-mn.x+Ze,zt=ln.y-mn.y+He,an=lr(Bt,zt),un=lr(Bt,zt,Rt),cn=Qe(z,["t","l"]),En=Qe(Ve,["t","l"]),jt=Qe(z,["b","r"]),en=Qe(Ve,["b","r"]),Qn=Re.overflow||{},Hn=Qn.adjustX,Kn=Qn.adjustY,jn=Qn.shiftX,er=Qn.shiftY,Xn=function(Sn){return typeof Sn=="boolean"?Sn:Sn>=0},_r,ar,or,bn;On();var Dt=Xn(Kn),wt=fn[0]===Vt[0];if(Dt&&fn[0]==="t"&&(ar>Ot.bottom||Q.current.bt)){var Xt=zt;wt?Xt-=Nn-ft:Xt=cn.y-en.y-He;var Jt=lr(Bt,Xt),xn=lr(Bt,Xt,Rt);Jt>an||Jt===an&&(!rt||xn>=un)?(Q.current.bt=!0,zt=Xt,He=-He,Wt.points=[et(fn,0),et(Vt,0)]):Q.current.bt=!1}if(Dt&&fn[0]==="b"&&(_r<Ot.top||Q.current.tb)){var Yn=zt;wt?Yn+=Nn-ft:Yn=jt.y-En.y-He;var tr=lr(Bt,Yn),on=lr(Bt,Yn,Rt);tr>an||tr===an&&(!rt||on>=un)?(Q.current.tb=!0,zt=Yn,He=-He,Wt.points=[et(fn,0),et(Vt,0)]):Q.current.tb=!1}var wn=Xn(Hn),Bn=fn[1]===Vt[1];if(wn&&fn[1]==="l"&&(bn>Ot.right||Q.current.rl)){var An=Bt;Bn?An-=kt-Kt:An=cn.x-en.x-Ze;var dr=lr(An,zt),Tn=lr(An,zt,Rt);dr>an||dr===an&&(!rt||Tn>=un)?(Q.current.rl=!0,Bt=An,Ze=-Ze,Wt.points=[et(fn,1),et(Vt,1)]):Q.current.rl=!1}if(wn&&fn[1]==="r"&&(or<Ot.left||Q.current.lr)){var zn=Bt;Bn?zn+=kt-Kt:zn=jt.x-En.x-Ze;var Jn=lr(zn,zt),dn=lr(zn,zt,Rt);Jn>an||Jn===an&&(!rt||dn>=un)?(Q.current.lr=!0,Bt=zn,Ze=-Ze,Wt.points=[et(fn,1),et(Vt,1)]):Q.current.lr=!1}On();var nr=jn===!0?0:jn;typeof nr=="number"&&(or<Rt.left&&(Bt-=or-Rt.left-Ze,z.x+Kt<Rt.left+nr&&(Bt+=z.x-Rt.left+Kt-nr)),bn>Rt.right&&(Bt-=bn-Rt.right-Ze,z.x>Rt.right-nr&&(Bt+=z.x-Rt.right+nr)));var gr=er===!0?0:er;typeof gr=="number"&&(_r<Rt.top&&(zt-=_r-Rt.top-He,z.y+ft<Rt.top+gr&&(zt+=z.y-Rt.top+ft-gr)),ar>Rt.bottom&&(zt-=ar-Rt.bottom-He,z.y>Rt.bottom-gr&&(zt+=z.y-Rt.bottom+gr)));var cr=Ve.x+Bt,xr=cr+kt,Cr=Ve.y+zt,Ir=Cr+Nn,Er=z.x,Gn=Er+Kt,zr=z.y,Or=zr+ft,Wr=Math.max(cr,Er),wr=Math.min(xr,Gn),ai=(Wr+wr)/2,ti=ai-cr,Mr=Math.max(Cr,zr),Hr=Math.min(Ir,Or),Kr=(Mr+Hr)/2,Ur=Kr-Cr;R==null||R(ve,Wt);var Ar=Mt.right-Ve.x-(Bt+Ve.width),Fr=Mt.bottom-Ve.y-(zt+Ve.height);Ct===1&&(Bt=Math.round(Bt),Ar=Math.round(Ar)),It===1&&(zt=Math.round(zt),Fr=Math.round(Fr));var Gr={ready:!0,offsetX:Bt/Ct,offsetY:zt/It,offsetR:Ar/Ct,offsetB:Fr/It,arrowX:ti/Ct,arrowY:Ur/It,scaleX:Ct,scaleY:It,align:Wt};C(Gr)}}),Ce=function(){X.current+=1;var Fe=X.current;Promise.resolve().then(function(){X.current===Fe&&me()})},Ie=function(){C(function(Fe){return(0,k.Z)((0,k.Z)({},Fe),{},{ready:!1})})};return(0,h.Z)(Ie,[xe]),(0,h.Z)(function(){_e||Ie()},[_e]),[P.ready,P.offsetX,P.offsetY,P.offsetR,P.offsetB,P.arrowX,P.arrowY,P.scaleX,P.scaleY,P.align,Ce]}var vt=T(95190);function we(_e,ve,F,xe,ke){(0,h.Z)(function(){if(_e&&ve&&F){let X=function(){xe(),ke()};var $=ve,R=F,ne=j($),be=j(R),P=ee(R),C=new Set([P].concat((0,vt.Z)(ne),(0,vt.Z)(be)));return C.forEach(function(q){q.addEventListener("scroll",X,{passive:!0})}),P.addEventListener("resize",X,{passive:!0}),xe(),function(){C.forEach(function(q){q.removeEventListener("scroll",X),P.removeEventListener("resize",X)})}}},[_e,ve,F])}var _t=T(48736);function ot(_e,ve,F,xe,ke,$,R,ne){var be=y.useRef(_e);be.current=_e;var P=y.useRef(!1);y.useEffect(function(){if(ve&&xe&&(!ke||$)){var X=function(){P.current=!1},q=function(ze){var je;be.current&&!R(((je=ze.composedPath)===null||je===void 0||(je=je.call(ze))===null||je===void 0?void 0:je[0])||ze.target)&&!P.current&&ne(!1)},Q=ee(xe);Q.addEventListener("pointerdown",X,!0),Q.addEventListener("mousedown",q,!0),Q.addEventListener("contextmenu",q,!0);var se=(0,o.A)(F);if(se&&(se.addEventListener("mousedown",q,!0),se.addEventListener("contextmenu",q,!0)),0)var me,Ce,Ie,De;return function(){Q.removeEventListener("pointerdown",X,!0),Q.removeEventListener("mousedown",q,!0),Q.removeEventListener("contextmenu",q,!0),se&&(se.removeEventListener("mousedown",q,!0),se.removeEventListener("contextmenu",q,!0))}}},[ve,F,xe,ke,$]);function C(){P.current=!0}return C}var nt=["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 Tt(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:le.Z,ve=y.forwardRef(function(F,xe){var ke=F.prefixCls,$=ke===void 0?"rc-trigger-popup":ke,R=F.children,ne=F.action,be=ne===void 0?"hover":ne,P=F.showAction,C=F.hideAction,X=F.popupVisible,q=F.defaultPopupVisible,Q=F.onPopupVisibleChange,se=F.afterPopupVisibleChange,me=F.mouseEnterDelay,Ce=F.mouseLeaveDelay,Ie=Ce===void 0?.1:Ce,De=F.focusDelay,Fe=F.blurDelay,ze=F.mask,je=F.maskClosable,Ue=je===void 0?!0:je,bt=F.getPopupContainer,xt=F.forceRender,it=F.autoDestroy,Ft=F.destroyPopupOnHide,Yt=F.popup,at=F.popupClassName,Ut=F.popupStyle,Me=F.popupPlacement,Te=F.builtinPlacements,Re=Te===void 0?{}:Te,B=F.popupAlign,z=F.zIndex,de=F.stretch,fe=F.getPopupClassNameFromAlign,pe=F.fresh,Ve=F.alignPoint,qe=F.onPopupClick,mt=F.onPopupAlign,Pt=F.arrow,rn=F.popupMotion,hn=F.maskMotion,qt=F.popupTransitionName,sn=F.popupAnimation,Rn=F.maskTransitionName,Zn=F.maskAnimation,In=F.className,Nn=F.getTriggerDOMNode,kt=(0,Se.Z)(F,nt),ft=it||Ft||!1,Kt=y.useState(!1),_n=(0,ce.Z)(Kt,2),Wn=_n[0],Oe=_n[1];(0,h.Z)(function(){Oe((0,m.Z)())},[]);var Le=y.useRef({}),At=y.useContext(ge),rt=y.useMemo(function(){return{registerSubPopup:function(Ln,pr){Le.current[Ln]=pr,At==null||At.registerSubPopup(Ln,pr)}}},[At]),St=(0,A.Z)(),Rt=y.useState(null),Et=(0,ce.Z)(Rt,2),Ot=Et[0],Mt=Et[1],Ct=y.useRef(null),It=(0,x.Z)(function(vn){Ct.current=vn,(0,oe.Sh)(vn)&&Ot!==vn&&Mt(vn),At==null||At.registerSubPopup(St,vn)}),Zt=y.useState(null),Nt=(0,ce.Z)(Zt,2),ut=Nt[0],Ae=Nt[1],Ze=y.useRef(null),He=(0,x.Z)(function(vn){(0,oe.Sh)(vn)&&ut!==vn&&(Ae(vn),Ze.current=vn)}),Je=y.Children.only(R),lt=(Je==null?void 0:Je.props)||{},pt={},Lt=(0,x.Z)(function(vn){var Ln,pr,rr=ut;return(rr==null?void 0:rr.contains(vn))||((Ln=(0,o.A)(rr))===null||Ln===void 0?void 0:Ln.host)===vn||vn===rr||(Ot==null?void 0:Ot.contains(vn))||((pr=(0,o.A)(Ot))===null||pr===void 0?void 0:pr.host)===vn||vn===Ot||Object.values(Le.current).some(function(mr){return(mr==null?void 0:mr.contains(vn))||vn===mr})}),Gt=H($,rn,sn,qt),Qt=H($,hn,Zn,Rn),tn=y.useState(q||!1),$n=(0,ce.Z)(tn,2),Vt=$n[0],fn=$n[1],ln=X!=null?X:Vt,mn=(0,x.Z)(function(vn){X===void 0&&fn(vn)});(0,h.Z)(function(){fn(X||!1)},[X]);var Wt=y.useRef(ln);Wt.current=ln;var Bt=y.useRef([]);Bt.current=[];var zt=(0,x.Z)(function(vn){var Ln;mn(vn),((Ln=Bt.current[Bt.current.length-1])!==null&&Ln!==void 0?Ln:ln)!==vn&&(Bt.current.push(vn),Q==null||Q(vn))}),an=y.useRef(),un=function(){clearTimeout(an.current)},cn=function(Ln){var pr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;un(),pr===0?zt(Ln):an.current=setTimeout(function(){zt(Ln)},pr*1e3)};y.useEffect(function(){return un},[]);var En=y.useState(!1),jt=(0,ce.Z)(En,2),en=jt[0],Qn=jt[1];(0,h.Z)(function(vn){(!vn||ln)&&Qn(!0)},[ln]);var Hn=y.useState(null),Kn=(0,ce.Z)(Hn,2),jn=Kn[0],er=Kn[1],Xn=y.useState(null),_r=(0,ce.Z)(Xn,2),ar=_r[0],or=_r[1],bn=function(Ln){or([Ln.clientX,Ln.clientY])},Dt=gt(ln,Ot,Ve&&ar!==null?ar:ut,Me,Re,B,mt),wt=(0,ce.Z)(Dt,11),Xt=wt[0],Jt=wt[1],xn=wt[2],Yn=wt[3],tr=wt[4],on=wt[5],wn=wt[6],Bn=wt[7],An=wt[8],dr=wt[9],Tn=wt[10],zn=Ne(Wn,be,P,C),Jn=(0,ce.Z)(zn,2),dn=Jn[0],nr=Jn[1],gr=dn.has("click"),cr=nr.has("click")||nr.has("contextMenu"),xr=(0,x.Z)(function(){en||Tn()}),Cr=function(){Wt.current&&Ve&&cr&&cn(!1)};we(ln,ut,Ot,xr,Cr),(0,h.Z)(function(){xr()},[ar,Me]),(0,h.Z)(function(){ln&&!(Re!=null&&Re[Me])&&xr()},[JSON.stringify(B)]);var Ir=y.useMemo(function(){var vn=V(Re,$,dr,Ve);return p()(vn,fe==null?void 0:fe(dr))},[dr,fe,Re,$,Ve]);y.useImperativeHandle(xe,function(){return{nativeElement:Ze.current,popupElement:Ct.current,forceAlign:xr}});var Er=y.useState(0),Gn=(0,ce.Z)(Er,2),zr=Gn[0],Or=Gn[1],Wr=y.useState(0),wr=(0,ce.Z)(Wr,2),ai=wr[0],ti=wr[1],Mr=function(){if(de&&ut){var Ln=ut.getBoundingClientRect();Or(Ln.width),ti(Ln.height)}},Hr=function(){Mr(),xr()},Kr=function(Ln){Qn(!1),Tn(),se==null||se(Ln)},Ur=function(){return new Promise(function(Ln){Mr(),er(function(){return Ln})})};(0,h.Z)(function(){jn&&(Tn(),jn(),er(null))},[jn]);function Ar(vn,Ln,pr,rr){pt[vn]=function(mr){var Nr;rr==null||rr(mr),cn(Ln,pr);for(var fi=arguments.length,Vr=new Array(fi>1?fi-1:0),Qr=1;Qr<fi;Qr++)Vr[Qr-1]=arguments[Qr];(Nr=lt[vn])===null||Nr===void 0||Nr.call.apply(Nr,[lt,mr].concat(Vr))}}(gr||cr)&&(pt.onClick=function(vn){var Ln;Wt.current&&cr?cn(!1):!Wt.current&&gr&&(bn(vn),cn(!0));for(var pr=arguments.length,rr=new Array(pr>1?pr-1:0),mr=1;mr<pr;mr++)rr[mr-1]=arguments[mr];(Ln=lt.onClick)===null||Ln===void 0||Ln.call.apply(Ln,[lt,vn].concat(rr))});var Fr=ot(ln,cr,ut,Ot,ze,Ue,Lt,cn),Gr=dn.has("hover"),lr=nr.has("hover"),On,hr;Gr&&(Ar("onMouseEnter",!0,me,function(vn){bn(vn)}),Ar("onPointerEnter",!0,me,function(vn){bn(vn)}),On=function(Ln){(ln||en)&&Ot!==null&&Ot!==void 0&&Ot.contains(Ln.target)&&cn(!0,me)},Ve&&(pt.onMouseMove=function(vn){var Ln;(Ln=lt.onMouseMove)===null||Ln===void 0||Ln.call(lt,vn)})),lr&&(Ar("onMouseLeave",!1,Ie),Ar("onPointerLeave",!1,Ie),hr=function(){cn(!1,Ie)}),dn.has("focus")&&Ar("onFocus",!0,De),nr.has("focus")&&Ar("onBlur",!1,Fe),dn.has("contextMenu")&&(pt.onContextMenu=function(vn){var Ln;Wt.current&&nr.has("contextMenu")?cn(!1):(bn(vn),cn(!0)),vn.preventDefault();for(var pr=arguments.length,rr=new Array(pr>1?pr-1:0),mr=1;mr<pr;mr++)rr[mr-1]=arguments[mr];(Ln=lt.onContextMenu)===null||Ln===void 0||Ln.call.apply(Ln,[lt,vn].concat(rr))}),In&&(pt.className=p()(lt.className,In));var Sn=(0,k.Z)((0,k.Z)({},lt),pt),Un={},Pn=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Pn.forEach(function(vn){kt[vn]&&(Un[vn]=function(){for(var Ln,pr=arguments.length,rr=new Array(pr),mr=0;mr<pr;mr++)rr[mr]=arguments[mr];(Ln=Sn[vn])===null||Ln===void 0||Ln.call.apply(Ln,[Sn].concat(rr)),kt[vn].apply(kt,rr)})});var Mn=y.cloneElement(Je,(0,k.Z)((0,k.Z)({},Sn),Un)),ur={x:on,y:wn},yr=Pt?(0,k.Z)({},Pt!==!0?Pt:{}):null;return y.createElement(y.Fragment,null,y.createElement(he.Z,{disabled:!ln,ref:He,onResize:Hr},y.createElement(J,{getTriggerDOMNode:Nn},Mn)),y.createElement(ge.Provider,{value:rt},y.createElement(re,{portal:_e,ref:It,prefixCls:$,popup:Yt,className:p()(at,Ir),style:Ut,target:ut,onMouseEnter:On,onMouseLeave:hr,onPointerEnter:On,zIndex:z,open:ln,keepDom:en,fresh:pe,onClick:qe,onPointerDownCapture:Fr,mask:ze,motion:Gt,maskMotion:Qt,onVisibleChanged:Kr,onPrepare:Ur,forceRender:xt,autoDestroy:ft,getPopupContainer:bt,align:dr,arrow:yr,arrowPos:ur,ready:Xt,offsetX:Jt,offsetY:xn,offsetR:Yn,offsetB:tr,onAlign:xr,stretch:de,targetWidth:zr/Bn,targetHeight:ai/An})))});return ve}var Ke=Tt(le.Z)},28426:function(yn,yt,T){"use strict";var k=T(59301),ce=T(93314),Se=T(99571),le=Object.defineProperty,K=Object.defineProperties,p=Object.getOwnPropertyDescriptors,he=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,x=(y,S,O)=>S in y?le(y,S,{enumerable:!0,configurable:!0,writable:!0,value:O}):y[S]=O,A=(y,S)=>{for(var O in S||(S={}))oe.call(S,O)&&x(y,O,S[O]);if(he)for(var O of he(S))o.call(S,O)&&x(y,O,S[O]);return y},h=(y,S)=>K(y,p(S));const m=({img:y,buttonProps:S={},styles:O={},customText:G,ButtonText:W,ButtonClick:I,Buttonclass:M,ButtonTwo:w,imgStyles:D,loading:re=!1,className:ie=""})=>k.createElement("section",{className:`tc animated fadeIn ${ie}`,style:A({color:"#999",margin:"100px auto",visibility:re?"hidden":"visible"},O)},k.createElement("img",{src:y||ce,style:h(A({},D),{pointerEvents:"none",userSelect:"none"})}),k.createElement("p",{className:"mt20 font14"},G||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),W&&k.createElement(Se.ZP,A({className:M,onClick:I},S),W),w&&w);yt.Z=m},45677:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return M}});var k=T(59301),ce={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},Se=T(99571),le=T(70557),K=T(75975),p=T(25399),he=T(51257),oe=T(81722),o=T(28426),x=T(346),A=T(44203),h=T(59301),m=Object.defineProperty,y=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,G=(w,D,re)=>D in w?m(w,D,{enumerable:!0,configurable:!0,writable:!0,value:re}):w[D]=re,W=(w,D)=>{for(var re in D||(D={}))S.call(D,re)&&G(w,re,D[re]);if(y)for(var re of y(D))O.call(D,re)&&G(w,re,D[re]);return w},I=(w,D,re)=>new Promise((ie,J)=>{var ue=Ne=>{try{Ee(re.next(Ne))}catch(Y){J(Y)}},ge=Ne=>{try{Ee(re.throw(Ne))}catch(Y){J(Y)}},Ee=Ne=>Ne.done?ie(Ne.value):Promise.resolve(Ne.value).then(ue,ge);Ee((re=re.apply(w,D)).next())}),M=({editOffice:w="view",data:D,issaver:re,onSaver:ie,theme:J,type:ue,filename:ge,monacoEditor:Ee,className:Ne,style:Y,close:L,onClose:V,hasMask:H,disabledDownload:ee,onImgDimensions:j,showNodata:v,recordInfo:g})=>{const[U,te]=(0,k.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Be,Ge]=(0,k.useState)(""),[Qe,et]=(0,k.useState)(),gt=window.ENV==="build"?"/react/build":"",vt=location.host.startsWith("localhost")?x.Z.PROXY_SERVER:x.Z.API_SERVER,_t=10*(1024*1024),ot=(0,k.useRef)();D!=null&&D.startsWith("/api")&&ue!=="txt"&&(D=x.Z.API_SERVER+D);const nt=F=>F.substring(F.lastIndexOf("/")+1).split(".").pop();ge&&Ee&&(Ee.filename=ge),(0,k.useEffect)(()=>{var F,xe;const ke=(xe=(F=document.cookie)==null?void 0:F.replace(/\s/g,""))==null?void 0:xe.split(";");ke==null||ke.map($=>{let R=$.split("=");R[0]==="_educoder_session"&&Ge(R[1])})},[]),(0,k.useEffect)(()=>{ue==="office"&&(D.indexOf("bigfilescdn.")>-1||D.indexOf("bigfiles1")>-1?et({url:D,fileType:nt(D),model:D.indexOf("model=edit")?"edit":"view"}):Ke())},[ue,D]);function Tt(F){return I(this,null,function*(){F.data.type==="pdfdata"&&(ie(F.data.data),window.removeEventListener("message",Tt,!1)),console.log("mess---:",F.data)})}const Ke=()=>I(void 0,null,function*(){console.log("data:",D);let F=D;D.startsWith("http")||(F=location.origin+F);let xe=new URL(F).pathname.split("/").pop();const ke=yield(0,oe.gJ)({attachment_id:xe});ke.url=vt+ke.url,et(ke)}),_e=()=>{if(D.startsWith("http")||D.startsWith("blob:")){ve();return}(0,he.Sv)(ge||"educoder",D,ge)},ve=()=>{g&&(0,A.fc)({id:g==null?void 0:g.id,watch_type:1,course_id:g==null?void 0:g.course_id}),(0,he.Nd)(ge||"educoder",decodeURIComponent(D))};return h.createElement("div",{style:W({},Y||{}),className:`${H&&ce.bgBlack} ${ue?ce.wrp:"hide"}`},L&&h.createElement("div",{className:ce.close,ref:ot},!!j&&h.createElement(p.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>ot.current},h.createElement("span",{onClick:()=>{V(),j()}},h.createElement("i",{className:"icon-yulanpizhu"}))),!ee&&h.createElement(p.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>ot.current},h.createElement("span",{onClick:ve},h.createElement("i",{className:"icon-quxiaozhiding"}))),re&&h.createElement(p.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>ot.current},h.createElement("span",{className:"",onClick:()=>{const F=document.getElementById("pdfiframe");window.addEventListener("message",Tt,!1),setTimeout(()=>{F.contentWindow.postMessage("getData","*")},300)}},h.createElement("i",{className:"icon-baocun"}))),h.createElement(p.Z,{title:"\u5173\u95ED",getPopupContainer:()=>ot.current},h.createElement("span",{className:"",onClick:()=>{V()}},h.createElement("i",{className:"icon-guanbi1"})))),h.createElement("div",{className:`${ce[Ne]} ${Ne} ${ce.monaco} ${ue==="txt"?"show":"hide"}`},ue==="txt"&&h.createElement(h.Fragment,null,h.createElement(K.ZP,W({},Ee)))),ue==="audio"&&h.createElement("audio",{src:`${(D==null?void 0:D.indexOf("http://"))>-1||(D==null?void 0:D.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${D}`,autoPlay:!0}),ue==="video"&&h.createElement(h.Fragment,null,(D==null?void 0:D.indexOf("http"))>-1?h.createElement("video",{controls:!0,src:`${D}`,autoPlay:!0}):h.createElement("video",{controls:!0,src:`data:video/mp4;base64,${D}`,autoPlay:!0})),ue==="office"&&Qe&&h.createElement("iframe",{src:`${gt}/office.html?key=${Qe.key}&url=${btoa(Qe.url)}&callbackUrl=${vt+(Qe.callbackUrl||"")}&fileType=${Qe.fileType}&title=${Qe.title||""}&model=${w}&officeServer=${x.Z.ONLYOFFICE}&disabledDownload=${!!ee}`}),ue==="html"&&h.createElement("iframe",{src:D+"&disposition=inline"}),ue==="pdf"&&h.createElement("iframe",{id:"pdfiframe",src:`${gt}/js/pdfview/index.html?filename=${ge||"educoder.pdf"}&url=${encodeURIComponent(D)}&disabledDownload=${!!ee}&model=${w}`}),ue==="image"&&h.createElement("img",{src:`${(D==null?void 0:D.indexOf("http://"))>-1||(D==null?void 0:D.indexOf("https://"))>-1?"":"data:image/png;base64,"}${D}`}),(ue==="other"||ue==="download")&&h.createElement(h.Fragment,null,v?h.createElement(o.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:h.createElement(Se.ZP,{icon:h.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:_e,disabled:ee},"\u4E0B\u8F7D")}):h.createElement(Se.ZP,{type:"primary",size:"middle",onClick:_e,disabled:ee},h.createElement(le.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")))}},76902:function(yn,yt,T){"use strict";T.d(yt,{z:function(){return J},Z:function(){return ue}});var k=T(59301),ce=T(8944),Se=T(81428),le=T(64018),K=T(15360),p=T(346),he=T(51257),oe=T(15342),o=T(1012),x=T(45677),A=T(59301),m=({html:ge})=>{const Ee=(0,k.useRef)(null),Ne=(0,k.useRef)(null),Y=`.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,k.useEffect)(()=>{const L=Ee.current.attachShadow({mode:"open"});Ne.current=document.createElement("div"),Ne.current.className="markdown-body",Ne.current.innerHTML=ge,L.appendChild(Ne.current);const V=document.createElement("style");return V.textContent=Y,L.appendChild(V),()=>{L.innerHTML=""}},[]),(0,k.useEffect)(()=>{Ne.current&&(Ne.current.innerHTML=ge)},[ge]),A.createElement("div",{ref:Ee})};function y(ge){const Ee=["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"],Ne=new RegExp(`\\b(${Ee.join("|")})\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]*)`,"gi");return ge.replace(Ne,"").trim()}var S=Object.defineProperty,O=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,I=(ge,Ee,Ne)=>Ee in ge?S(ge,Ee,{enumerable:!0,configurable:!0,writable:!0,value:Ne}):ge[Ee]=Ne,M=(ge,Ee)=>{for(var Ne in Ee||(Ee={}))G.call(Ee,Ne)&&I(ge,Ne,Ee[Ne]);if(O)for(var Ne of O(Ee))W.call(Ee,Ne)&&I(ge,Ne,Ee[Ne]);return ge};const w="@\u2581\u2581@",D="@\u2581@",re=/<pre[^>]*>/g;function ie(ge){let Ee=document.createElement("div");return Ee.innerHTML=ge,Ee.childNodes.length===0?"":Ee.childNodes[0].nodeValue}const J=(ge,Ee)=>{ge=ge||"";const Ne=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,Y=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,L=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,V=/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return Ee?ge.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(Ne,(H,ee,j,v,g,U,te)=>{const Be=ee||v||U,Ge=j||g||te||"?";return p.Z.API_SERVER+"/api/attachments/"+Be+Ge+"&t="+(0,he.Jn)(Be,Date.now())+(H.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(ge=ge.replace(V,(H,ee,j,v,g,U,te)=>{const Be=ee||v||U,Ge=j||g||te||"?";return p.Z.API_SERVER+"/attachments/download/"+Be+Ge+"&t="+(0,he.Jn)(Be,Date.now())+(H.indexOf(")")>-1?")":"&")}).replace(Ne,(H,ee,j,v,g,U,te)=>{const Be=ee||v||U,Ge=j||g||te||"?";return p.Z.API_SERVER+"/api/attachments/"+Be+Ge+"&t="+(0,he.Jn)(Be,Date.now())+(H.indexOf(")")>-1?")":"&")}).replace(Y,(H,ee,j,v,g)=>{const U=ee||v,te=j||g||"";return'"'+p.Z.API_SERVER+"/api/attachments/"+U+te+U+te+"&t="+(0,he.Jn)(U,Date.now())}).replace(L,(H,ee,j,v,g)=>{const U=ee||v,te=j||g||"";return"("+p.Z.API_SERVER+"/files/uploads/"+U+te+U+te+"&t="+(0,he.Jn)(U,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,`
`),ge)};var ue=({value:ge="",className:Ee,showTextOnly:Ne,showLines:Y,style:L={},stylesPrev:V={},highlightKeywords:H,showProgramFill:ee,isProgramFill:j,disabledFill:v=!1,programFillValue:g,onFillChange:U=Ge=>{},onFillBlur:te=()=>{},onFillFocus:Be=()=>{}})=>{let Ge=y(String(ge||""));const[Qe,et]=(0,k.useState)(""),[gt,vt]=(0,k.useState)("office"),[we,_t]=(0,k.useState)([]),ot=(0,k.useRef)("a"+(0,o.Z)()),nt={},Tt=C=>/<style[\s\S]*?>/i.test(C||""),Ke=(C,X,q)=>{const Q=document.createElement(C===D?"input":"textarea");Q.style.width="100%",Q.style.height=C===D?"40px":"151px",Q.rows=5,Q.spellcheck=!1,Q.name="edu-program-fill",Q.placeholder="\u8BF7\u8F93\u5165",Q.dataset.id=X;const se=Object.keys(nt).length;return nt[se]=Q,`<span class="edu-program-fill-wrap ${C===D?"":"show"}" style="width:${C===D?"600px":"100%"}" title=${q||""}><span>${Q.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function _e(C){return C=C.replace(/!\[.*?\]\(.*?\)/g,""),C=C.replace(/\[.*?\]\(.*?\)/g,""),C=C.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),C=C.replace(/<embed.*?>/g,""),C=C.replace(/<img.*?>/g,""),C=C.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),C=C.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),C=C.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),C=C.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),C}const ve=C=>!Ne&&Tt(Ge)?C:C.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(X,q){let Q=q.replace(/(\n|\r)/g,"").split("}"),se=[];return Q.map(me=>{me!=""&&se.push(`.${ot.current} ${me}`)}),`<style>${se.join("}")}</style>`}),F=(0,k.useMemo)(()=>{try{const Q=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,se=/\"\/api\/attachments\/|\"\/attachments\/download\//g,me=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,Ce=/\(\/attachments\/download\//g;Ge=Ge.replace(Ce,"("+p.Z.API_SERVER+"/attachments/download/").replace(Q,"("+p.Z.API_SERVER+"/api/attachments/").replace(se,'"'+p.Z.API_SERVER+"/api/attachments/").replace(me,'"'+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,`
`)}catch(Q){}if(ee){let Q=-1;return Ge=Ge.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,function(se,me,Ce){var Ie;return++Q,Ke(se,Q,(Ie=g==null?void 0:g[Q])==null?void 0:Ie.value.replaceAll("<","&lt;").replaceAll(">","&gt;"))}),`<pre style="background:#fff;padding:4px">${ve(Ge||"")}</pre>`}let C=ve(Ge);C=(0,Se.ZP)(C);const X=(0,Se.ez)();Ge.match(/\[TOC\]/)&&(C=C.replace("<p>[TOC]</p>",(0,Se.Qv)()),(0,Se.Iy)()),C=C.replace(/(__special_katext_id_\d+__)/g,(Q,se)=>{const{type:me,expression:Ce}=X[se];return(0,oe.renderToString)(ie(Ce)||"",{displayMode:me==="block",throwOnError:!1,output:"html"})}),C=C.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,Se.AL)();const q=document.createElement("div");if(q.innerHTML=C,Ne)return q.innerText;if(H){const Q=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return R(q,Q),q.innerHTML}return setTimeout(()=>P(),500),q.innerHTML},[Ge,H]);(0,k.useEffect)(()=>{ne.current&&ne.current.querySelectorAll(["input","textarea"]).forEach(X=>{X.oninput=xe,X.onblur=ke,X.onfocus=$})},[we]),(0,k.useEffect)(()=>{var C,X,q,Q,se;if(g!=null&&g.length)try{const me=ne.current.querySelectorAll(".edu-program-fill-score"),Ce=ne.current.querySelectorAll('[name="edu-program-fill"]');for(const[Ie,De]of Ce.entries())De.value=((C=g==null?void 0:g[Ie])==null?void 0:C.value)||"",((X=g==null?void 0:g[Ie])==null?void 0:X.type)==="warning"?De.className="program-fill-warning":((q=g==null?void 0:g[Ie])==null?void 0:q.type)==="success"?De.className="program-fill-success":De.className="";for(const[Ie,De]of me.entries())De.innerHTML=(Q=g==null?void 0:g[Ie])!=null&&Q.score?`${(se=g==null?void 0:g[Ie])==null?void 0:se.score}\u5206`:"";_t(g)}catch(me){console.log(me,"error")}},[g]);const xe=C=>{we[C.target.dataset.id]=we[C.target.dataset.id]||{},we[C.target.dataset.id].value=C.target.value,_t([...we]),U(we,C.target.dataset.id)},ke=C=>{we[C.target.dataset.id]=we[C.target.dataset.id]||{},we[C.target.dataset.id].value=C.target.value,_t([...we]),te(we,C.target.dataset.id)},$=C=>{we[C.target.dataset.id]=we[C.target.dataset.id]||{},we[C.target.dataset.id].value=C.target.value,_t([...we]),Be(we,C.target.dataset.id)};function R(C,X){return C.childNodes.forEach(q=>{var Q;if(q.childNodes.length>0)R(q,X);else if(q.nodeName!=="IMG")if(q.innerHTML)q.innerHTML=(Q=q.innerHTML)==null?void 0:Q.replace(new RegExp(X,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const se=document.createElement("span");se.innerHTML=q.textContent.replace(new RegExp(X,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),q.replaceWith(se)}})}const ne=(0,k.useRef)();Se.jb.WebkitLineClamp=Y,Y&&(L=M(M({},L),Se.jb));function be(C){let X=C.target;if(X.tagName.toUpperCase()==="A"){let q=X.getAttribute("href");if(q.indexOf("office")>-1)C.preventDefault(),et(q),vt("office");else if(q.indexOf("application/pdf")>-1)C.preventDefault(),et(q),vt("pdf");else if(q.indexOf("text/html")>-1)C.preventDefault(),et(q),vt("html");else if(q.startsWith("#")){C.preventDefault();let Q=document.getElementById(q.replace("#",""));Q&&Q.scrollIntoView(!0)}}}const P=()=>{var C;const X=(C=ne.current)==null?void 0:C.querySelectorAll("video");X==null||X.forEach(q=>{if(q.oncontextmenu=()=>!1,q.src.indexOf(".m3u8")>-1&&!q.canPlayType("application/vnd.apple.mpegurl")){if(K.ZP.isSupported()){var Q=new K.ZP;Q.loadSource(q.src),Q.attachMedia(q)}}})};return(0,k.useEffect)(()=>{if(ne.current&&F&&F.match(re)&&window.PR.prettyPrint(),ne.current)return ne.current.addEventListener("click",be),()=>{var C;(C=ne.current)==null||C.removeEventListener("click",be),(0,Se.AL)(),(0,Se.Iy)()}},[F,ne.current,be]),(0,k.useEffect)(()=>{var C;const X=q=>{q.preventDefault(),q.clipboardData.setData("text",window.getSelection().toString())};return(C=ne.current)==null||C.addEventListener("copy",X),()=>{var q;(q=ne.current)==null||q.removeEventListener("copy",X)}},[ne.current]),k.createElement(k.Fragment,null,Ne&&k.createElement("div",{ref:ne},F),!Ne&&!Tt(F)&&k.createElement("div",{ref:ne,style:M({},L),className:`${Ee||""} ${v?"disabled-fill":""} markdown-body ${ot.current}`,dangerouslySetInnerHTML:{__html:F}}),!Ne&&Tt(F)&&k.createElement(m,{html:F}),k.createElement(x.Z,{close:!0,data:Qe,type:Qe!=null&&Qe.length?gt:"",style:M({},V),onClose:()=>et("")}))}},75975:function(yn,yt,T){"use strict";T.d(yt,{SV:function(){return _t},ZP:function(){return we}});var k=T(59301),ce=T(76374);const Se={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"]},le={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"]},K={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(`
`)}]},he={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 oe=T(53184),o=T.n(oe),x=(ot,nt,Tt)=>new Promise((Ke,_e)=>{var ve=ke=>{try{xe(Tt.next(ke))}catch($){_e($)}},F=ke=>{try{xe(Tt.throw(ke))}catch($){_e($)}},xe=ke=>ke.done?Ke(ke.value):Promise.resolve(ke.value).then(ve,F);xe((Tt=Tt.apply(ot,nt)).next())});const A={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},h=(ot,nt,Tt,Ke)=>{const _e=nt.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:Tt.lineNumber,endColumn:Tt.column});return Array.from(new Set(_e.match(/\b\w{2,}\b/g)||[])).map(F=>({label:F,kind:ot.languages.CompletionItemKind.Text,insertText:F,range:Ke}))},m=(ot,nt,Tt,Ke)=>{ot.languages.registerCompletionItemProvider(nt,{provideCompletionItems(_e,ve){const F=_e.getWordUntilPosition(ve),xe={startLineNumber:ve.lineNumber,endLineNumber:ve.lineNumber,startColumn:F.startColumn,endColumn:F.endColumn},ke=_e.getLineContent(ve.lineNumber).substring(F.startColumn-2,F.endColumn);return{suggestions:[...h(ot,_e,ve,xe),...Tt.map(R=>({label:R,kind:ot.languages.CompletionItemKind.Keyword,documentation:R,insertText:R,insertTextRules:ot.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:xe})),...Ke.map(R=>({label:R.label,kind:ot.languages.CompletionItemKind.Snippet,documentation:R.content,insertText:ke.startsWith("#")?R.content.replace(/#/,""):R.content,insertTextRules:ot.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:xe}))]}}})};var y=ot=>{A.languages.forEach(nt=>{ot.languages.registerDocumentFormattingEditProvider(nt,{provideDocumentFormattingEdits(Tt){return x(this,null,function*(){const Ke=o()(Tt.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:Tt.getFullModelRange(),text:Ke}]})}})}),m(ot,"java",le.keywords,le.quickKey),m(ot,"cpp",K.keywords,K.quickKey),m(ot,"c",Se.keywords,[]),m(ot,"python",p.keywords,p.quickKey),m(ot,"scala",he.keywords,he.quickKey)};const S="\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,G=(ot,nt,Tt)=>nt in ot?O(ot,nt,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):ot[nt]=Tt,W=(ot,nt,Tt)=>G(ot,typeof nt!="symbol"?nt+"":nt,Tt);const I=class Qo{constructor(nt,Tt,Ke){this.placeholder=nt,this.editor=Tt,this.monaco=Ke,Tt.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return Qo.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)}};W(I,"ID","editor.widget.placeholderHint");var w=I,D=T(96236),re=T(6767),ie=T(25399),J=T(89392),ue=T(49535),ge=T(56102),Ee=Object.defineProperty,Ne=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,ee=(ot,nt,Tt)=>nt in ot?Ee(ot,nt,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):ot[nt]=Tt,j=(ot,nt)=>{for(var Tt in nt||(nt={}))V.call(nt,Tt)&&ee(ot,Tt,nt[Tt]);if(L)for(var Tt of L(nt))H.call(nt,Tt)&&ee(ot,Tt,nt[Tt]);return ot},v=(ot,nt)=>Ne(ot,Y(nt)),g=(ot,nt)=>{var Tt={};for(var Ke in ot)V.call(ot,Ke)&&nt.indexOf(Ke)<0&&(Tt[Ke]=ot[Ke]);if(ot!=null&&L)for(var Ke of L(ot))nt.indexOf(Ke)<0&&H.call(ot,Ke)&&(Tt[Ke]=ot[Ke]);return Tt},U=(ot,nt,Tt)=>new Promise((Ke,_e)=>{var ve=ke=>{try{xe(Tt.next(ke))}catch($){_e($)}},F=ke=>{try{xe(Tt.throw(ke))}catch($){_e($)}},xe=ke=>ke.done?Ke(ke.value):Promise.resolve(ke.value).then(ve,F);xe((Tt=Tt.apply(ot,nt)).next())});function te(ot){return/^\d+$/.test(ot)?`${ot}px`:ot}function Be(){}let Ge=!1;const Qe={"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 et(ot=[]){let nt=ot;if(Array.isArray(ot)){for(let Tt=0;Tt<ot.length;Tt++){let Ke=Qe[ot[Tt]];if(Ke)return Ke}return nt[0]}return Qe[nt]||nt}let gt=null;const vt=()=>U(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch(ot){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",ot)}});var we=ot=>{var nt=ot,{width:Tt="100%",height:Ke="100%",value:_e,language:ve="javascript",style:F={},options:xe={},overrideServices:ke={},theme:$="vs-dark",onEditBlur:R,isCopy:ne=!1,onSave:be,autoHeight:P=!1,forbidCopy:C=!1,onChange:X=Be,editorDidMount:q=Be,onFocus:Q=Be,onBreakPoint:se=Be,breakPointValue:me=[],filename:Ce="educoder.txt",errorLine:Ie,errorContent:De="",highlightLine:Fe,openBreakPoint:ze=!1,placeholder:je="",showMiniMap:Ue=!0}=nt,bt=g(nt,["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 xt=(0,k.useRef)(),it=(0,k.useRef)({}),Ft=(0,k.useRef)(),Yt=(0,k.useRef)(),at=(0,k.useRef)([]),Ut=(0,k.useRef)(!1),Me=(0,k.useRef)(),Te=(0,k.useRef)(),Re=(0,k.useRef)(!1),[B,z]=(0,k.useState)(!1);function de(){let kt;return xt.current&&(kt=new ce.Z(ft=>{for(let Kt of ft)(Kt.target.offsetHeight>0||Kt.target.offsetWidth>0)&&it.current.instance.layout()}),kt.observe(xt.current)),kt}function fe(){re.ZP.warning({content:decodeURIComponent(S),key:"monaco-editor-tip"})}const pe=()=>{let kt=it.current.instance;if(_e!=null&&kt&&B){const ft=kt.getModel();ft&&_e!==ft.getValue()&&(Ge=!0,ft.setValue(_e),kt.layout(),Ge=!1)}};(0,k.useEffect)(()=>{const kt=ue.Z.subscribe("formatDocument",ft=>{var Kt;let _n=it.current.instance;(Kt=_n==null?void 0:_n.getAction)==null||Kt.call(_n,"editor.action.formatDocument").run()});return window.updateMonacoValue=ft=>{X(ft)},kt},[]),(0,k.useEffect)(()=>{var kt;let ft=it.current.instance;Yt.current&&clearTimeout(Yt.current),Yt.current=setTimeout(()=>{pe()},500),_e&&(_e!=null&&_e.length)&&((kt=ft==null?void 0:ft.updateOptions)==null||kt.call(ft,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(_e.split(/\r\n|\r|\n/g).length))+3,5)}))},[_e,B,it.current]),(0,k.useEffect)(()=>{if(Ie&&it.current&&it.current.instance){let ft=it.current.instance;ft.changeViewZones(function(Kt){var _n=document.createElement("div");_n.style.padding="10px 20px",_n.style.width="calc(100% - 20px)",_n.className="my-error-line-wrp",_n.innerHTML=De,Kt.addZone({afterLineNumber:Ie||11,heightInLines:3,domNode:_n})});var kt={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}};ft.addOverlayWidget(kt),ft.revealPositionInCenter({lineNumber:20,column:1})}},[Ie,it.current,B]);const Ve=(kt="",ft)=>{if(!kt||kt.trim()==="")return!0;const _n=it.current.instance.getModel().getLineTokens(ft);let Wn=!1;for(let Oe=0;Oe<2;Oe++)_n.getStandardTokenType(Oe)===1&&(Wn=!0);return Wn};(0,k.useEffect)(()=>{var kt;const ft=(kt=it.current)==null?void 0:kt.instance;if(ft&&B&&C){const Kt=ft.onDidBlurEditorWidget(()=>{Re.current=!1}),_n=ft.onDidFocusEditorText(()=>{Re.current=!0});return()=>{Kt.dispose(),_n.dispose()}}},[it.current,B,C]),(0,k.useEffect)(()=>{var kt;if((kt=it.current)!=null&&kt.instance&&B&&ze){let ft=it.current.instance,Kt=ft.getModel();if(!Kt)return;(()=>{var Ct;let It=[],Zt=[];const Nt=Kt.getAllDecorations();for(let Ae of Nt)Ae.options.className==="highlighted-line"&&(It.push((Ct=Ae==null?void 0:Ae.range)==null?void 0:Ct.startLineNumber),Zt.push(Ae==null?void 0:Ae.id));if(Fe===It[0])return;Kt.deltaDecorations(Zt,[]);const ut=Kt.getLineCount();Fe&&Fe<=ut&&(ft.deltaDecorations([],[{range:new gt.Range(Fe,1,Fe,Kt.getLineMaxColumn(Fe)),options:{isWholeLine:!0,className:"highlighted-line"}}]),ft.revealLineInCenter(Fe))})();const Wn=(Ct=!1)=>{var It;let Zt=[],Nt=[];const ut=Kt.getAllDecorations();for(let Ae of ut)Ae.options.linesDecorationsClassName==="breakpoints-select"&&(Zt.push((It=Ae==null?void 0:Ae.range)==null?void 0:It.startLineNumber),Nt.push(Ae==null?void 0:Ae.id));if(Ct)return{lines:Zt,ids:Nt};se(Zt)},Oe=Ct=>U(void 0,null,function*(){let It={range:new gt.Range(Ct,1,Ct,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield Kt.deltaDecorations([],[It]),Wn()}),Le=Ct=>U(void 0,null,function*(){let It=[];const Zt=ft.getLineDecorations(Ct);for(let Nt of Zt)Nt.options.linesDecorationsClassName==="breakpoints-select"&&It.push(Nt.id);yield Kt.deltaDecorations(It,[]),Wn()}),At=Ct=>{let It=ft.getLineDecorations(Ct);for(let Zt of It)if(Zt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,J.isEqual)(me,Wn(!0).lines)){Kt.deltaDecorations(Wn(!0).ids,[]);const Ct=me.map(It=>({range:new gt.Range(It,1,It,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));Kt.deltaDecorations([],Ct)}const rt=ft.onDidChangeModelContent(Ct=>{let It=ft.getPosition();if(It){let Zt=It.lineNumber;clearTimeout(Te.current),Te.current=setTimeout(()=>{Ve(Kt.getLineContent(Zt),Zt)?Le(Zt):At(Zt)?(Le(Zt),Oe(Zt)):Wn()},100)}}),St=ft.onMouseDown(Ct=>{var It,Zt,Nt;if(Ct.target.detail&&((Nt=(Zt=(It=Ct.target)==null?void 0:It.element)==null?void 0:Zt.className)!=null&&Nt.includes("line-numbers"))){let ut=Ct.target.position.lineNumber;if(Ve(Kt.getLineContent(ut),ut))return;At(ut)?Le(ut):Oe(ut)}}),Rt=Ct=>{let It={range:new gt.Range(Ct,1,Ct,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};at.current=ft.deltaDecorations(at.current,[It])},Et=()=>{at.current=ft.deltaDecorations(at.current,[])},Ot=ft.onMouseMove(Ct=>{var It,Zt,Nt;if(Et(),Ct.target.detail&&((Nt=(Zt=(It=Ct.target)==null?void 0:It.element)==null?void 0:Zt.className)!=null&&Nt.includes("line-numbers"))){let ut=Ct.target.position.lineNumber;if(Ve(Kt.getLineContent(ut),ut))return;Rt(ut)}}),Mt=ft.onMouseLeave(()=>{Et()});return()=>{rt.dispose(),St.dispose(),Ot.dispose(),Mt.dispose()}}},[it.current,B,me,Fe,ze,ve]),(0,k.useEffect)(()=>{var kt;(kt=it.current)!=null&&kt.instance&&ze&&it.current.instance.setPosition({lineNumber:0,column:0})},[Fe]);function qe(){let kt=it.current.instance;if(kt){const ft=kt.getSelection(),Kt=it.current.pastePos||{},_n=new gt.Range(Kt.startLineNumber||ft.endLineNumber,Kt.startColumn||ft.endColumn,Kt.endLineNumber||ft.endLineNumber,Kt.endColumn||ft.endColumn);setTimeout(()=>{kt.executeEdits("",[{range:_n,text:""}])},300)}}function mt(kt){(window.navigator.platform.match("Mac")?kt.metaKey:kt.ctrlKey)&&kt.keyCode==83&&(kt.preventDefault(),be())}const Pt=()=>{if(P&&it.current.instance){const kt=it.current.instance.getContentHeight();In(kt<Ke?Ke:kt)}else In(Ke)};function rn(kt){var ft=document.createEvent("MouseEvents");ft.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),kt.dispatchEvent(ft)}const hn=kt=>{if(!Re.current)return;const{keyCode:ft,ctrlKey:Kt,metaKey:_n,target:Wn,type:Oe}=kt;return(Oe==="paste"||(ft===67||ft===86)&&(_n||Kt))&&Wn.nodeName==="TEXTAREA"&&(fe(),kt.preventDefault()),!1};function qt(kt,ft){var Kt=window.URL||window.webkitURL||window,_n=new Blob([ft]),Wn=document.createElementNS("http://www.w3.org/1999/xhtml","a");Wn.href=Kt.createObjectURL(_n),Wn.download=kt,rn(Wn)}(0,k.useEffect)(()=>{Pt()},[Pt]),(0,k.useEffect)(()=>{xt.current&&!B&&Promise.all([T.e(8909),T.e(6656)]).then(T.bind(T,71448)).then(kt=>{try{gt=kt,it.current.instance=gt.editor.create(xt.current,{value:_e,language:et(ve),theme:$,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:Ue||!1}},ke);const ft=it.current.instance;let Wn=[...D.BH._menuItems].find(rt=>rt[0]._debugName=="EditorContext")[1],Oe=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],Le=(rt,St)=>{var Rt,Et;let Ot=rt._first;do St.includes((Et=(Rt=Ot.element)==null?void 0:Rt.command)==null?void 0:Et.id)&&rt._remove(Ot);while(Ot=Ot.next)};if(q(ft,gt),setTimeout(()=>{Pt(),it.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{qt(Ce||"educoder.txt",ft.getValue())}})},500),it.current.subscription=ft.onDidChangeModelContent(rt=>{Ut.current?clearTimeout(Me.current):(Pt(),X(ft.getValue(),rt)),Me.current=setTimeout(()=>{Ut.current=!1},500)}),window.Monaco||y(gt,et(ve)),C&&(Le(Wn,Oe),xt.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",hn),window.removeEventListener("paste",hn),window.addEventListener("keydown",hn),window.addEventListener("paste",hn)),window.Monaco=gt,R&&ft.onDidBlurEditorWidget(()=>{R(ft.getValue())}),Q&&ft.onDidFocusEditorText(()=>{C&&vt(),Q(ft.getValue())}),C){vt();try{ft.onDidPaste(rt=>{const St=ft.getSelection(),Rt=it.current.pastePos||{},Et=new gt.Range(Rt.startLineNumber||St.endLineNumber,Rt.startColumn||St.endColumn,Rt.endLineNumber||St.endLineNumber,Rt.endColumn||St.endColumn);ft.executeEdits("",[{range:rt.range,text:""}])})}catch(rt){}}let At=de();return je&&typeof je=="string"&&new w(je,ft,gt),z(!0),()=>{const rt=it.current.instance;rt.dispose();const St=rt.getModel();St&&St.dispose(),it.current.subscription&&it.current.subscription.dispose(),At.unobserve(xt.current)}}catch(ft){}})},[]),(0,k.useEffect)(()=>{if(it.current.instance&&B)return document.addEventListener("keydown",mt,!1),()=>{document.removeEventListener("keydown",mt)}},[be,B]),(0,k.useEffect)(()=>{let kt=it.current.instance;if(kt&&B){let ft=et(ve);gt.editor.setModelLanguage(kt.getModel(),ft)}},[ve,B]),(0,k.useEffect)(()=>{it.current.instance&&B&&gt.editor.setTheme($)},[$,B]),(0,k.useEffect)(()=>{let kt=it.current.instance;Ft.current=xe,kt&&B&&(kt.updateOptions(j({},xe)),setTimeout(()=>{kt.getModel().updateOptions(j({},xe))},200))},[JSON.stringify(xe),B]),(0,k.useEffect)(()=>{let kt=it.current.instance;kt&&B&&kt.layout()},[Tt,Ke,B]);const[sn,Rn]=(0,k.useState)(te(Tt)),[Zn,In]=(0,k.useState)(te(Ke)),Nn=v(j({},F),{width:sn,height:Zn,position:"relative"});return k.createElement("div",{className:"my-monaco-editor",ref:xt,style:Nn},ne&&k.createElement(ge.CopyToClipboard,{text:_e,onCopy:()=>re.ZP.success("\u590D\u5236\u6210\u529F")},k.createElement(ie.Z,{title:"\u590D\u5236\u4EE3\u7801"},k.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},k.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function _t({width:ot="100%",height:nt="100%",original:Tt,modified:Ke,language:_e,options:ve={}}){const F=(0,k.useRef)(),[xe,ke]=(0,k.useState)(null);function $(P){let C;return F.current&&(C=new ce.Z(X=>{for(let q of X)(q.target.offsetHeight>0||q.target.offsetWidth>0)&&P.layout()}),C.observe(F.current)),C}(0,k.useEffect)(()=>(F.current&&Promise.all([T.e(8909),T.e(9404)]).then(T.bind(T,2550)).then(P=>{gt=P;const C=gt.editor.createDiffEditor(F.current,v(j({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},ve),{wordWrap:!0}));ke(C);let X=$(C);return()=>{C.dispose();const q=C.getModel();q&&q.dispose(),X.unobserve(F.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,k.useEffect)(()=>{xe&&xe.setModel({original:gt.editor.createModel(Tt,_e),modified:gt.editor.createModel(Ke,_e)})},[Tt,Ke,_e,xe]);const R=te(ot),ne=te(nt),be={width:R,height:ne};return k.createElement("div",{className:"my-diff-editor",ref:F,style:be})}},54204:function(yn,yt,T){"use strict";T.r(yt),T.d(yt,{default:function(){return X}});var k=T(59301),ce=T(25690),Se=T(91882),le=T(77019),K=T(5269),p=T(25399),he=T(76902),oe=T(48790),o={flex_box_center:"flex_box_center___iOjMJ",flex_space_between:"flex_space_between___aidWN",flex_box_vertical_center:"flex_box_vertical_center___z01Y6",flex_box_center_end:"flex_box_center_end___bizdK",flex_box_column:"flex_box_column___T3eUo",info:"info___PTCcN",bar:"bar___F2ZHD"},x=T(37568),A=T(18287),h=T(28284),m=T(62957),y=T(6767),S=T(37639),O=T(69219),G=T(38986),W=Object.defineProperty,I=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,D=(q,Q,se)=>Q in q?W(q,Q,{enumerable:!0,configurable:!0,writable:!0,value:se}):q[Q]=se,re=(q,Q)=>{for(var se in Q||(Q={}))M.call(Q,se)&&D(q,se,Q[se]);if(I)for(var se of I(Q))w.call(Q,se)&&D(q,se,Q[se]);return q},ie=(q,Q,se)=>new Promise((me,Ce)=>{var Ie=ze=>{try{Fe(se.next(ze))}catch(je){Ce(je)}},De=ze=>{try{Fe(se.throw(ze))}catch(je){Ce(je)}},Fe=ze=>ze.done?me(ze.value):Promise.resolve(ze.value).then(Ie,De);Fe((se=se.apply(q,Q)).next())});const{TreeNode:J}=O.default,ue=({restful:q,loading:Q,dispatch:se})=>{const me=(0,ce.useParams)(),Ce=(0,ce.useLocation)(),[Ie,De]=(0,k.useState)(!1),[Fe,ze]=(0,k.useState)(),{actionTabs:je}=q,[Ue]=h.default.useForm();return(0,k.useEffect)(()=>{q.actionTabs.key=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"&&Ue.resetFields()},[q.actionTabs.key]),q.actionTabs.key!=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"?null:k.createElement(m.default,{centered:!0,title:"\u65B0\u5EFA\u76EE\u5F55",open:q.actionTabs.key==="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{minHeight:150},confirmLoading:Ie,onOk:()=>ie(void 0,null,function*(){yield Ue.validateFields();const bt=Ue.getFieldValue();De(!0),(yield(0,G.ZP)("/api/restfuls.json",{method:"post",body:re({file_type:1},bt)})).status===0&&(y.ZP.success("\u6DFB\u52A0\u6210\u529F"),se({type:"restful/setActionTabs",payload:{}}),se({type:"restful/getRestful"})),De(!1)}),onCancel:()=>{se({type:"restful/setActionTabs",payload:{}})}},k.createElement("div",{className:"pl30 pr30"},k.createElement(h.default,{form:Ue,initialValues:{name:""}},k.createElement(h.default.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0"}]},k.createElement(le.Z,{className:"mt30"},k.createElement(K.Z,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),k.createElement(K.Z,{flex:"1"},k.createElement(x.default,{placeholder:`\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26
`,maxLength:60})))))))};var ge=(0,ce.connect)(({restful:q,loading:Q})=>({restful:q,loading:Q}))(ue),Ee=Object.defineProperty,Ne=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,V=(q,Q,se)=>Q in q?Ee(q,Q,{enumerable:!0,configurable:!0,writable:!0,value:se}):q[Q]=se,H=(q,Q)=>{for(var se in Q||(Q={}))Y.call(Q,se)&&V(q,se,Q[se]);if(Ne)for(var se of Ne(Q))L.call(Q,se)&&V(q,se,Q[se]);return q},ee=(q,Q,se)=>new Promise((me,Ce)=>{var Ie=ze=>{try{Fe(se.next(ze))}catch(je){Ce(je)}},De=ze=>{try{Fe(se.throw(ze))}catch(je){Ce(je)}},Fe=ze=>ze.done?me(ze.value):Promise.resolve(ze.value).then(Ie,De);Fe((se=se.apply(q,Q)).next())});const{TreeNode:j}=O.default,v=({restful:q,loading:Q,dispatch:se})=>{const me=(0,ce.useParams)(),Ce=(0,ce.useLocation)(),[Ie,De]=(0,k.useState)(!1),[Fe,ze]=(0,k.useState)(),{actionTabs:je}=q,[Ue]=h.default.useForm();return(0,k.useEffect)(()=>{q.actionTabs.key=="\u91CD\u547D\u540D"&&(Ue.resetFields(),Ue.setFieldsValue({name:q.actionTabs.data.title}))},[q.actionTabs.key]),q.actionTabs.key!=="\u91CD\u547D\u540D"?null:k.createElement(m.default,{centered:!0,title:"\u91CD\u547D\u540D",open:q.actionTabs.key==="\u91CD\u547D\u540D",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{minHeight:150},confirmLoading:Ie,onOk:()=>ee(void 0,null,function*(){yield Ue.validateFields();const bt=Ue.getFieldValue();De(!0);let xt=`/api/restfuls/${q.actionTabs.data.id}.json`;(yield(0,G.ZP)(xt,{method:"put",body:H({file_type:1},bt)})).status===0&&(y.ZP.success("\u4FEE\u6539\u6210\u529F"),se({type:"restful/setActionTabs",payload:{}}),se({type:"restful/getRestful"})),De(!1)}),onCancel:()=>{se({type:"restful/setActionTabs",payload:{}})}},k.createElement("div",{className:"pl30 pr30"},k.createElement(h.default,{form:Ue,initialValues:{name:""}},k.createElement(le.Z,{className:"mt30"},k.createElement(K.Z,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),k.createElement(K.Z,{flex:"1"},k.createElement(h.default.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u65B0\u540D\u79F0"}]},k.createElement(x.default,{placeholder:`\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26
`,maxLength:60})))))))};var g=(0,ce.connect)(({restful:q,loading:Q})=>({restful:q,loading:Q}))(v),U=T(506),te={flex_box_center:"flex_box_center___EW6x1",flex_space_between:"flex_space_between___aSZFN",flex_box_vertical_center:"flex_box_vertical_center___MsqeW",flex_box_center_end:"flex_box_center_end___YMP0b",flex_box_column:"flex_box_column___KXrxt",tree:"tree___Zx4EL",actions:"actions___zwp8u"},Be=Object.defineProperty,Ge=Object.defineProperties,Qe=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable,we=(q,Q,se)=>Q in q?Be(q,Q,{enumerable:!0,configurable:!0,writable:!0,value:se}):q[Q]=se,_t=(q,Q)=>{for(var se in Q||(Q={}))gt.call(Q,se)&&we(q,se,Q[se]);if(et)for(var se of et(Q))vt.call(Q,se)&&we(q,se,Q[se]);return q},ot=(q,Q)=>Ge(q,Qe(Q)),nt=(q,Q,se)=>new Promise((me,Ce)=>{var Ie=ze=>{try{Fe(se.next(ze))}catch(je){Ce(je)}},De=ze=>{try{Fe(se.throw(ze))}catch(je){Ce(je)}},Fe=ze=>ze.done?me(ze.value):Promise.resolve(ze.value).then(Ie,De);Fe((se=se.apply(q,Q)).next())});const{Search:Tt}=x.default,{DirectoryTree:Ke}=A.default,_e=({user:q,globalSetting:Q,loading:se,dispatch:me,restful:Ce})=>{const Ie=(0,ce.useParams)(),[De,Fe]=(0,k.useState)(!0),[ze]=h.default.useForm(),[je,Ue]=(0,k.useState)(""),[bt]=(0,k.useState)([{id:1,name:"\u65B0\u5EFA\u6587\u4EF6"},{id:2,name:"\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"},{id:3,name:"\u91CD\u547D\u540D"},{id:4,name:"\u7F16\u8F91"},{id:5,name:"\u5220\u9664"}]),[xt,it]=(0,k.useState)([]),[Ft,Yt]=(0,k.useState)([]),[at,Ut]=(0,k.useState)(!1),[Me,Te]=(0,k.useState)([]);(0,k.useEffect)(()=>{var Ve,qe,mt,Pt;if((Ve=Ce.restful)!=null&&Ve.data){Te([...(qe=Ce.restful)==null?void 0:qe.data]);let rn=0,hn;if((Pt=(mt=Ce.restful)==null?void 0:mt.data)==null||Pt.map(qt=>{var sn;qt.id==Ie.id&&(rn=qt.id),qt.file_type==0&&!hn&&(hn=qt.id),(sn=qt==null?void 0:qt.children)==null||sn.map(Rn=>{hn||(hn=Rn.id),Rn.id==Ie.id&&(rn=qt.id)}),!qt.children&&!hn&&(hn=qt.id)}),!Ie.id&&hn){ce.history.push(`/ch/rest/${hn}`);return}rn&&setTimeout(()=>{it([rn]),Yt([Number(Ie.id||hn)])},200)}},[Ce.restful]);const Re=(Ve,qe)=>{qe.node.file_type===0?ce.history.push(`/ch/rest/${Ve[0]}`):Yt([...Ve]),console.log("Trigger Select",Ve,qe)},B=Ve=>{it(Ve),console.log("Trigger Expand",Ve)},z=Ve=>k.createElement("div",null,bt.map((qe,mt)=>k.createElement("p",{key:qe.id,className:"current",onClick:()=>{switch(qe.id){case 1:ce.history.push(`/ch/rest/edit/${Ve.id}/0`);break;case 2:case 3:me({type:"restful/setActionTabs",payload:{key:qe.name,data:Ve}});break;case 4:document.location.href=`/ch/rest/edit/${Ve.pid||0}/${Ve.id}`;break;case 5:m.default.confirm({title:"\u63D0\u793A",content:"\u662F\u5426\u786E\u5B9A\u5220\u9664\uFF1F",onOk:()=>nt(void 0,null,function*(){const Pt=yield(0,U.E1)({id:Ve.id});(Pt==null?void 0:Pt.status)==0&&(y.ZP.success("\u5220\u9664\u6210\u529F"),me({type:"restful/getRestful"}))})});break}}},qe.name)).filter(qe=>!!qe).filter(qe=>Ve.pid||Ve.file_type==0?qe.key>3:qe.key!=4)),de=Ve=>Ve.map(qe=>{var mt;const Pt=qe.title.indexOf(je),rn=qe.title.substr(0,Pt),hn=qe.title.substr(Pt+je.length),qt=k.createElement("span",null,rn,k.createElement("span",{className:"c-blue"},je),hn,(0,oe.ag)()&&k.createElement(S.Z,{placement:"right",title:je,content:()=>z(qe),trigger:"hover"},k.createElement("span",{className:`iconfont icon-sandian ${te.actions}`})));return je!==""&&Pt===-1&&!((mt=qe.children)!=null&&mt.length)?null:qe.children&&qe.file_type===1?ot(_t({},qe),{title:qt,key:qe.key,children:de(qe.children)}):ot(_t({},qe),{title:qt,key:qe.key,isLeaf:!0})}).filter(qe=>!!qe),fe=(Ve,qe)=>{let mt;for(let Pt=0;Pt<qe.length;Pt++){const rn=qe[Pt];rn.children&&(rn.children.some(hn=>hn.key===Ve)?mt=rn.key:fe(Ve,rn.children)&&(mt=fe(Ve,rn.children)))}return mt},pe=Ve=>{const{value:qe}=Ve.target,mt=Me.map(Pt=>{var rn;return Pt!=null&&Pt.children&&(rn=Pt==null?void 0:Pt.children.filter(hn=>hn.title.indexOf(qe)>-1))!=null&&rn.length?Pt.id:null});Ue(qe),Ut(!0),console.log("expandedKeys:",mt),it(mt)};return console.log("loop(treeData):",de(Me)),k.createElement("div",{className:te.tree},k.createElement(Tt,{style:{marginBottom:8},placeholder:"\u8F93\u5165\u5173\u952E\u5B57\u68C0\u7D22",onChange:pe}),k.createElement(Ke,{multiple:!0,defaultExpandAll:!0,onSelect:Re,onExpand:B,expandedKeys:xt,selectedKeys:Ft,autoExpandParent:at,treeData:de(Me)}),k.createElement(ge,null),k.createElement(g,null))};var ve=(0,ce.connect)(({user:q,loading:Q,globalSetting:se,restful:me})=>({user:q,globalSetting:se,restful:me,loading:Q.models.index}))(_e),F=Object.defineProperty,xe=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,R=(q,Q,se)=>Q in q?F(q,Q,{enumerable:!0,configurable:!0,writable:!0,value:se}):q[Q]=se,ne=(q,Q)=>{for(var se in Q||(Q={}))ke.call(Q,se)&&R(q,se,Q[se]);if(xe)for(var se of xe(Q))$.call(Q,se)&&R(q,se,Q[se]);return q},be=(q,Q)=>{var se={};for(var me in q)ke.call(q,me)&&Q.indexOf(me)<0&&(se[me]=q[me]);if(q!=null&&xe)for(var me of xe(q))Q.indexOf(me)<0&&$.call(q,me)&&(se[me]=q[me]);return se},P=(q,Q,se)=>new Promise((me,Ce)=>{var Ie=ze=>{try{Fe(se.next(ze))}catch(je){Ce(je)}},De=ze=>{try{Fe(se.throw(ze))}catch(je){Ce(je)}},Fe=ze=>ze.done?me(ze.value):Promise.resolve(ze.value).then(Ie,De);Fe((se=se.apply(q,Q)).next())});const C=q=>{var Q=q,{user:se,globalSetting:me,loading:Ce,dispatch:Ie,restful:De}=Q,Fe=be(Q,["user","globalSetting","loading","dispatch","restful"]),ze,je;const Ue=(0,ce.useParams)(),[bt,xt]=(0,k.useState)(!0),it=()=>P(void 0,null,function*(){Ie({type:"restful/getRestful"}),Ue.id&&Ie({type:"restful/getRestfulDetail",payload:ne({},Ue)})});(0,k.useEffect)(()=>{xt(!0),it()},[Ue.id]);const Ft=()=>{Ie({type:"restful/setActionTabs",payload:{key:"\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"}})},Yt=()=>{var at,Ut,Me;if((at=De.restful)!=null&&at.data){let Te=0;return(Me=(Ut=De.restful)==null?void 0:Ut.data)==null||Me.map(Re=>{var B;(B=Re==null?void 0:Re.children)==null||B.map(z=>{z.id==Ue.id&&(Te=Re.id)}),!Re.children&&!Te&&(Te=Re.id)}),Te}return 0};return k.createElement("section",null,k.createElement("aside",{className:"edu-container mt20"},k.createElement(Se.Z,null,k.createElement(Se.Z.Item,null,k.createElement(ce.Link,{to:"/"},"\u9996\u9875")),k.createElement(Se.Z.Item,null,k.createElement(ce.Link,{to:"/ch/rest"},"API\u6587\u6863"))),k.createElement("div",{className:"mt20"},k.createElement(le.Z,{gutter:[20,20]},k.createElement(K.Z,{flex:"300px"},k.createElement(ve,ne({},Fe))),k.createElement(K.Z,{flex:"1"},k.createElement("div",{className:o.info},k.createElement("h1",{style:{fontSize:28,paddingBottom:15,borderBottom:"1px solid #eaeaea",textAlign:"center"}},(ze=De.restfulDetail)==null?void 0:ze.name),k.createElement(he.Z,{value:(je=De.restfulDetail)==null?void 0:je.description}))))),(0,oe.ag)()&&k.createElement("div",{className:o.bar},k.createElement(le.Z,null,!!Yt()&&k.createElement(K.Z,null,k.createElement(p.Z,{title:"\u7F16\u8F91\u6587\u4EF6"},k.createElement(ce.Link,{to:`/ch/rest/edit/${Yt()}/${Ue.id}`,className:"icon-zhongmingming current"}))),k.createElement(K.Z,null,k.createElement(p.Z,{title:"\u6DFB\u52A0\u6587\u4EF6"},k.createElement(ce.Link,{to:`/ch/rest/edit/${Yt()}/0`,className:"icon-tianjiatimu current"}))),k.createElement(K.Z,null,k.createElement(p.Z,{title:"\u65B0\u5EFA\u6587\u4EF6\u5939"},k.createElement("span",{className:"icon-wenjianjia1 current",onClick:Ft})))))))};var X=(0,ce.connect)(({user:q,loading:Q,globalSetting:se,restful:me})=>({user:q,globalSetting:se,restful:me,loading:Q.models.index}))(C)},81428:function(yn,yt,T){"use strict";T.d(yt,{AL:function(){return w},Iy:function(){return A},Qv:function(){return y},ez:function(){return M},jb:function(){return h}});var k=T(32834),ce=T.n(k),Se=T(11690),le=T.n(Se);let K=1;function p(ue,ge){const Ee=ue.match(/^(\s+)(?:```)/);if(Ee===null)return ge;const Ne=Ee[1];return ge.split(`
`).map(Y=>{const L=Y.match(/^\s+/);if(L===null)return Y;const[V]=L;return V.length>=Ne.length?Y.slice(Ne.length):Y}).join(`
`)}let he=[],oe=["<ul>"];const o=new(ce()).Renderer,x=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){he.length=0,oe=["<ul>"]}const h={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(ue,ge,Ee,Ne){if(ge>=ue.length||ue[ge].level<=Ee)return ge;var Y=ue[ge];Ne.push("<li><a href='#"+K+Y.anchor+"'>"+Y.text+"</a>"),ge++;var L=[];return ge=m(ue,ge,Y.level,L),L.length>0&&(Ne.push("<ul>"),L.forEach(function(V){Ne.push(V)}),Ne.push("</ul>")),Ne.push("</li>"),ge=m(ue,ge,Ee,Ne),ge}function y(){return m(he,0,0,oe),oe.push("</ul>"),oe.join("")}const S={heading(ue){const ge=x.exec(ue);if(K+=1,ge)return{type:"heading",raw:ge[0],depth:ge[1].length,text:ge[2]}},fences(ue){const ge=this.rules.block.fences.exec(ue);if(ge){const Ee=ge[0];let Ne=p(Ee,ge[3]||"");const Y=ge[2]?ge[2].trim():ge[2];if(["latex","katex","math"].indexOf(Y)>=0){const L=W(),V=Ne;Ne=L,I[L]={type:"block",expression:V}}return{type:"code",raw:Ee,lang:Y,text:Ne}}}},O=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let G=0;const W=()=>`__special_katext_id_${G++}__`;let I={};function M(){return I}function w(){G=0,I={}}function D(ue){return ue=ue.replace(O,(ge,Ee)=>{const Ne=W();return I[Ne]={type:"inline",expression:Ee},Ne}),ue}const re=o.listitem;o.listitem=function(ue){return re(D(ue))};const ie=o.paragraph;o.paragraph=function(ue){return ie(D(ue))};const J=o.tablecell;o.tablecell=function(ue,ge){return J(D(ue),ge)},o.code=function(ue,ge,Ee){const Ne=(ge||"").match(/\S*/)[0];return Ne?["latex","katex","math"].indexOf(Ne)>=0?`<p class='editormd-tex'>${ue}</p>`:`<pre class="prettyprint linenums"><code class="language-${ge}">${Ee?ue:(0,Se.escape)(ue,!0)}</code></pre>
`:'<pre class="prettyprint linenums"><code>'+(Ee?ue:(0,Se.escape)(ue,!0))+"</code></pre>"},o.heading=function(ue,ge,Ee){let Ne=this.options.headerPrefix+Ee.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return he.push({anchor:Ne,level:ge,text:ue}),"<h"+ge+' id="'+K+Ne+'">'+ue+"</h"+ge+">"},ce().setOptions({silent:!0,gfm:!0,pedantic:!1}),ce().use({tokenizer:S,renderer:o}),yt.ZP=ce()},64018:function(){var yn,yt,T,k=!1,ce,Se;window.PR_SHOULD_USE_CONTINUATION=!0;var le,K;(function(){var p=window,he=["break,continue,do,else,for,if,return,while"],oe=[he,"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"],o=[oe,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],x=[o,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],A=[o,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[o,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],m="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",y=[o,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],S="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=[he,"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"],G=[he,"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"],W=[he,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],I=[x,h,A,y,S,O,G,W],M=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,w="str",D="kwd",re="com",ie="typ",J="lit",ue="pun",ge="pln",Ee="tag",Ne="dec",Y="src",L="atn",V="atv",H="nocode",ee="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function j(ve){for(var F=0,xe=!1,ke=!1,$=0,R=ve.length;$<R;++$){var ne=ve[$];if(ne.ignoreCase)ke=!0;else if(/[a-z]/i.test(ne.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){xe=!0,ke=!1;break}}var be={b:8,t:9,n:10,v:11,f:12,r:13};function P(se){var me=se.charCodeAt(0);if(me!==92)return me;var Ce=se.charAt(1);return me=be[Ce],me||("0"<=Ce&&Ce<="7"?parseInt(se.substring(1),8):Ce==="u"||Ce==="x"?parseInt(se.substring(2),16):se.charCodeAt(1))}function C(se){if(se<32)return(se<16?"\\x0":"\\x")+se.toString(16);var me=String.fromCharCode(se);return me==="\\"||me==="-"||me==="]"||me==="^"?"\\"+me:me}function X(se){var me=se.substring(1,se.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")),Ce=[],Ie=me[0]==="^",De=["["];Ie&&De.push("^");for(var Fe=Ie?1:0,ze=me.length;Fe<ze;++Fe){var je=me[Fe];if(/\\[bdsw]/i.test(je))De.push(je);else{var Ue=P(je),bt;Fe+2<ze&&me[Fe+1]==="-"?(bt=P(me[Fe+2]),Fe+=2):bt=Ue,Ce.push([Ue,bt]),bt<65||Ue>122||(bt<65||Ue>90||Ce.push([Math.max(65,Ue)|32,Math.min(bt,90)|32]),bt<97||Ue>122||Ce.push([Math.max(97,Ue)&-33,Math.min(bt,122)&-33]))}}Ce.sort(function(Yt,at){return Yt[0]-at[0]||at[1]-Yt[1]});for(var xt=[],it=[],Fe=0;Fe<Ce.length;++Fe){var Ft=Ce[Fe];Ft[0]<=it[1]+1?it[1]=Math.max(it[1],Ft[1]):xt.push(it=Ft)}for(var Fe=0;Fe<xt.length;++Fe){var Ft=xt[Fe];De.push(C(Ft[0])),Ft[1]>Ft[0]&&(Ft[1]+1>Ft[0]&&De.push("-"),De.push(C(Ft[1])))}return De.push("]"),De.join("")}function q(se){for(var me=se.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")),Ce=me.length,Ie=[],De=0,Fe=0;De<Ce;++De){var ze=me[De];if(ze==="(")++Fe;else if(ze.charAt(0)==="\\"){var je=+ze.substring(1);je&&(je<=Fe?Ie[je]=-1:me[De]=C(je))}}for(var De=1;De<Ie.length;++De)Ie[De]===-1&&(Ie[De]=++F);for(var De=0,Fe=0;De<Ce;++De){var ze=me[De];if(ze==="(")++Fe,Ie[Fe]||(me[De]="(?:");else if(ze.charAt(0)==="\\"){var je=+ze.substring(1);je&&je<=Fe&&(me[De]="\\"+Ie[je])}}for(var De=0;De<Ce;++De)me[De]==="^"&&me[De+1]!=="^"&&(me[De]="");if(se.ignoreCase&&xe)for(var De=0;De<Ce;++De){var ze=me[De],Ue=ze.charAt(0);ze.length>=2&&Ue==="["?me[De]=X(ze):Ue!=="\\"&&(me[De]=ze.replace(/[a-zA-Z]/g,function(it){var Ft=it.charCodeAt(0);return"["+String.fromCharCode(Ft&-33,Ft|32)+"]"}))}return me.join("")}for(var Q=[],$=0,R=ve.length;$<R;++$){var ne=ve[$];if(ne.global||ne.multiline)throw new Error(""+ne);Q.push("(?:"+q(ne)+")")}return new RegExp(Q.join("|"),ke?"gi":"g")}function v(ve,F){var xe=/(?:^|\s)nocode(?:\s|$)/,ke=[],$=0,R=[],ne=0;function be(P){var C=P.nodeType;if(C==1){if(xe.test(P.className))return;for(var X=P.firstChild;X;X=X.nextSibling)be(X);var q=P.nodeName.toLowerCase();(q==="br"||q==="li")&&(ke[ne]=`
`,R[ne<<1]=$++,R[ne++<<1|1]=P)}else if(C==3||C==4){var Q=P.nodeValue;Q.length&&(F?Q=Q.replace(/\r\n?/g,`
`):Q=Q.replace(/[ \t\r\n]+/g," "),ke[ne]=Q,R[ne<<1]=$,$+=Q.length,R[ne++<<1|1]=P)}}return be(ve),{sourceCode:ke.join("").replace(/\n$/,""),spans:R}}function g(ve,F,xe,ke,$){if(xe){var R={sourceNode:ve,pre:1,langExtension:null,numberLines:null,sourceCode:xe,spans:null,basePos:F,decorations:null};ke(R),$.push.apply($,R.decorations)}}var U=/\S/;function te(ve){for(var F=void 0,xe=ve.firstChild;xe;xe=xe.nextSibling){var ke=xe.nodeType;F=ke===1?F?ve:xe:ke===3&&U.test(xe.nodeValue)?ve:F}return F===ve?void 0:F}function Be(ve,F){var xe={},ke;(function(){for(var ne=ve.concat(F),be=[],P={},C=0,X=ne.length;C<X;++C){var q=ne[C],Q=q[3];if(Q)for(var se=Q.length;--se>=0;)xe[Q.charAt(se)]=q;var me=q[1],Ce=""+me;P.hasOwnProperty(Ce)||(be.push(me),P[Ce]=null)}be.push(/[\0-\uffff]/),ke=j(be)})();var $=F.length,R=function(ne){for(var be=ne.sourceCode,P=ne.basePos,C=ne.sourceNode,X=[P,ge],q=0,Q=be.match(ke)||[],se={},me=0,Ce=Q.length;me<Ce;++me){var Ie=Q[me],De=se[Ie],Fe=void 0,ze;if(typeof De=="string")ze=!1;else{var je=xe[Ie.charAt(0)];if(je)Fe=Ie.match(je[1]),De=je[0];else{for(var Ue=0;Ue<$;++Ue)if(je=F[Ue],Fe=Ie.match(je[1]),Fe){De=je[0];break}Fe||(De=ge)}ze=De.length>=5&&De.substring(0,5)==="lang-",ze&&!(Fe&&typeof Fe[1]=="string")&&(ze=!1,De=Y),ze||(se[Ie]=De)}var bt=q;if(q+=Ie.length,!ze)X.push(P+bt,De);else{var xt=Fe[1],it=Ie.indexOf(xt),Ft=it+xt.length;Fe[2]&&(Ft=Ie.length-Fe[2].length,it=Ft-xt.length);var Yt=De.substring(5);g(C,P+bt,Ie.substring(0,it),R,X),g(C,P+bt+it,xt,_t(Yt,xt),X),g(C,P+bt+Ft,Ie.substring(Ft),R,X)}}ne.decorations=X};return R}function Ge(ve){var F=[],xe=[];ve.tripleQuotedStrings?F.push([w,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ve.multiLineStrings?F.push([w,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):F.push([w,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ve.verbatimStrings&&xe.push([w,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ke=ve.hashComments;ke&&(ve.cStyleComments?(ke>1?F.push([re,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):F.push([re,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),xe.push([w,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):F.push([re,/^#[^\r\n]*/,null,"#"])),ve.cStyleComments&&(xe.push([re,/^\/\/[^\r\n]*/,null]),xe.push([re,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var $=ve.regexLiterals;if($){var R=$>1?"":`
\r`,ne=R?".":"[\\S\\s]",be="/(?=[^/*"+R+"])(?:[^/\\x5B\\x5C"+R+"]|\\x5C"+ne+"|\\x5B(?:[^\\x5C\\x5D"+R+"]|\\x5C"+ne+")*(?:\\x5D|$))+/";xe.push(["lang-regex",RegExp("^"+ee+"("+be+")")])}var P=ve.types;P&&xe.push([ie,P]);var C=(""+ve.keywords).replace(/^ | $/g,"");C.length&&xe.push([D,new RegExp("^(?:"+C.replace(/[\s,]+/g,"|")+")\\b"),null]),F.push([ge,/^\s+/,null,` \r
\xA0`]);var X="^.[^\\s\\w.$@'\"`/\\\\]*";return ve.regexLiterals&&(X+="(?!s*/)"),xe.push([J,/^@[a-z_$][a-z_$@0-9]*/i,null],[ie,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[ge,/^[a-z_$][a-z_$@0-9]*/i,null],[J,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[ge,/^\\[\s\S]?/,null],[ue,new RegExp(X),null]),Be(F,xe)}var Qe=Ge({keywords:I,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function et(ve,F,xe){for(var ke=/(?:^|\s)nocode(?:\s|$)/,$=/\r\n?|\n/,R=ve.ownerDocument,ne=R.createElement("li");ve.firstChild;)ne.appendChild(ve.firstChild);var be=[ne];function P(me){var Ce=me.nodeType;if(Ce==1&&!ke.test(me.className))if(me.nodeName==="br")C(me),me.parentNode&&me.parentNode.removeChild(me);else for(var Ie=me.firstChild;Ie;Ie=Ie.nextSibling)P(Ie);else if((Ce==3||Ce==4)&&xe){var De=me.nodeValue,Fe=De.match($);if(Fe){var ze=De.substring(0,Fe.index);me.nodeValue=ze;var je=De.substring(Fe.index+Fe[0].length);if(je){var Ue=me.parentNode;Ue.insertBefore(R.createTextNode(je),me.nextSibling)}C(me),ze||me.parentNode.removeChild(me)}}}function C(me){for(;!me.nextSibling;)if(me=me.parentNode,!me)return;function Ce(Fe,ze){var je=ze?Fe.cloneNode(!1):Fe,Ue=Fe.parentNode;if(Ue){var bt=Ce(Ue,1),xt=Fe.nextSibling;bt.appendChild(je);for(var it=xt;it;it=xt)xt=it.nextSibling,bt.appendChild(it)}return je}for(var Ie=Ce(me.nextSibling,0),De;(De=Ie.parentNode)&&De.nodeType===1;)Ie=De;be.push(Ie)}for(var X=0;X<be.length;++X)P(be[X]);F===(F|0)&&be[0].setAttribute("value",F);var q=R.createElement("ol");q.className="linenums";for(var Q=Math.max(0,F-1|0)||0,X=0,se=be.length;X<se;++X)ne=be[X],ne.className="L"+(X+Q)%10,ne.firstChild||ne.appendChild(R.createTextNode("\xA0")),q.appendChild(ne);ve.appendChild(q)}function gt(ve){var F=/\bMSIE\s(\d+)/.exec(navigator.userAgent);F=F&&+F[1]<=8;var xe=/\n/g,ke=ve.sourceCode,$=ke.length,R=0,ne=ve.spans,be=ne.length,P=0,C=ve.decorations,X=C.length,q=0;C[X]=$;var Q,se;for(se=Q=0;se<X;)C[se]!==C[se+2]?(C[Q++]=C[se++],C[Q++]=C[se++]):se+=2;for(X=Q,se=Q=0;se<X;){for(var me=C[se],Ce=C[se+1],Ie=se+2;Ie+2<=X&&C[Ie+1]===Ce;)Ie+=2;C[Q++]=me,C[Q++]=Ce,se=Ie}X=C.length=Q;var De=ve.sourceNode,Fe="";De&&(Fe=De.style.display,De.style.display="none");try{for(var ze=null;P<be;){var je=ne[P],Ue=ne[P+2]||$,bt=C[q+2]||$,Ie=Math.min(Ue,bt),xt=ne[P+1],it;if(xt.nodeType!==1&&(it=ke.substring(R,Ie))){F&&(it=it.replace(xe,"\r")),xt.nodeValue=it;var Ft=xt.ownerDocument,Yt=Ft.createElement("span");Yt.className=C[q+1];var at=xt.parentNode;at.replaceChild(Yt,xt),Yt.appendChild(xt),R<Ue&&(ne[P+1]=xt=Ft.createTextNode(ke.substring(Ie,Ue)),at.insertBefore(xt,Yt.nextSibling))}R=Ie,R>=Ue&&(P+=2),R>=bt&&(q+=2)}}finally{De&&(De.style.display=Fe)}}var vt={};function we(ve,F){for(var xe=F.length;--xe>=0;){var ke=F[xe];vt.hasOwnProperty(ke)?p.console&&console.warn("cannot override language handler %s",ke):vt[ke]=ve}}function _t(ve,F){return ve&&vt.hasOwnProperty(ve)||(ve=/^\s*</.test(F)?"default-markup":"default-code"),vt[ve]}we(Qe,["default-code"]),we(Be([],[[ge,/^[^<?]+/],[Ne,/^<!\w[^>]*(?:>|$)/],[re,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[ue,/^(?:<[%?]|[%?]>)/],["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"]),we(Be([[ge,/^[\s]+/,null,` \r
`],[V,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[Ee,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[L,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[ue,/^[=<>\/]+/],["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"]),we(Be([],[[V,/^[\s\S]+/]]),["uq.val"]),we(Ge({keywords:x,hashComments:!0,cStyleComments:!0,types:M}),["c","cc","cpp","cxx","cyc","m"]),we(Ge({keywords:"null,true,false"}),["json"]),we(Ge({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:M}),["cs"]),we(Ge({keywords:A,cStyleComments:!0}),["java"]),we(Ge({keywords:W,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),we(Ge({keywords:O,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),we(Ge({keywords:S,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),we(Ge({keywords:G,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),we(Ge({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),we(Ge({keywords:m,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),we(Be([],[[w,/^[\s\S]+/]]),["regex"]);function ot(ve){var F=ve.langExtension;try{var xe=v(ve.sourceNode,ve.pre),ke=xe.sourceCode;ve.sourceCode=ke,ve.spans=xe.spans,ve.basePos=0,_t(F,ke)(ve),gt(ve)}catch($){p.console&&console.log($&&$.stack||$)}}function nt(ve,F,xe){var ke=xe||!1,$=F||null,R=document.createElement("div");R.innerHTML="<pre>"+ve+"</pre>",R=R.firstChild,ke&&et(R,ke,!0);var ne={langExtension:$,numberLines:ke,sourceNode:R,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ot(ne),R.innerHTML}function Tt(ve,F){var xe=F||document.body,ke=xe.ownerDocument||document;function $(je){return xe.getElementsByTagName(je)}for(var R=[$("pre"),$("code"),$("xmp")],ne=[],be=0;be<R.length;++be)for(var P=0,C=R[be].length;P<C;++P)ne.push(R[be][P]);R=null;var X=Date;X.now||(X={now:function(){return+new Date}});var q=0,Q=/\blang(?:uage)?-([\w.]+)(?!\S)/,se=/\bprettyprint\b/,me=/\bprettyprinted\b/,Ce=/pre|xmp/i,Ie=/^code$/i,De=/^(?:pre|code|xmp)$/i,Fe={};function ze(){for(var je=p.PR_SHOULD_USE_CONTINUATION?X.now()+250:1/0;q<ne.length&&X.now()<je;q++){for(var Ue=ne[q],bt=Fe,xt=Ue;xt=xt.previousSibling;){var it=xt.nodeType,Ft=(it===7||it===8)&&xt.nodeValue;if(Ft?!/^\??prettify\b/.test(Ft):it!==3||/\S/.test(xt.nodeValue))break;if(Ft){bt={},Ft.replace(/\b(\w+)=([\w:.%+-]+)/g,function(qe,mt,Pt){bt[mt]=Pt});break}}var Yt=Ue.className;if((bt!==Fe||se.test(Yt))&&!me.test(Yt)){for(var at=!1,Ut=Ue.parentNode;Ut;Ut=Ut.parentNode){var Me=Ut.tagName;if(De.test(Me)&&Ut.className&&se.test(Ut.className)){at=!0;break}}if(!at){Ue.className+=" prettyprinted";var Te=bt.lang;if(!Te){Te=Yt.match(Q);var Re;!Te&&(Re=te(Ue))&&Ie.test(Re.tagName)&&(Te=Re.className.match(Q)),Te&&(Te=Te[1])}var B;if(Ce.test(Ue.tagName))B=1;else{var z=Ue.currentStyle,de=ke.defaultView,fe=z?z.whiteSpace:de&&de.getComputedStyle?de.getComputedStyle(Ue,null).getPropertyValue("white-space"):0;B=fe&&fe.substring(0,3)==="pre"}var pe=bt.linenums;(pe=pe==="true"||+pe)||(pe=Yt.match(/\blinenums\b(?::(\d+))?/),pe=pe?pe[1]&&pe[1].length?+pe[1]:!0:!1),pe&&et(Ue,pe,B);var Ve={langExtension:Te,sourceNode:Ue,numberLines:pe,pre:B,sourceCode:null,basePos:null,spans:null,decorations:null};ot(Ve)}}}q<ne.length?p.setTimeout(ze,250):typeof ve=="function"&&ve()}ze()}var Ke=p.PR={createSimpleLexer:Be,registerLangHandler:we,sourceDecorator:Ge,PR_ATTRIB_NAME:L,PR_ATTRIB_VALUE:V,PR_COMMENT:re,PR_DECLARATION:Ne,PR_KEYWORD:D,PR_LITERAL:J,PR_NOCODE:H,PR_PLAIN:ge,PR_PUNCTUATION:ue,PR_SOURCE:Y,PR_STRING:w,PR_TAG:Ee,PR_TYPE:ie,prettyPrintOne:k?p.prettyPrintOne=nt:le=nt,prettyPrint:K=k?p.prettyPrint=Tt:K=Tt},_e=p.define;typeof _e=="function"&&_e.amd&&_e("google-code-prettify",[],function(){return Ke})})()},25769:function(yn,yt,T){"use strict";var k=T(98040),ce={"text/plain":"Text","text/html":"Url",default:"Text"},Se="Copy to clipboard: #{key}, Enter";function le(p){var he=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return p.replace(/#{\s*key\s*}/g,he)}function K(p,he){var oe,o,x,A,h,m,y=!1;he||(he={}),oe=he.debug||!1;try{x=k(),A=document.createRange(),h=document.getSelection(),m=document.createElement("span"),m.textContent=p,m.ariaHidden="true",m.style.all="unset",m.style.position="fixed",m.style.top=0,m.style.clip="rect(0, 0, 0, 0)",m.style.whiteSpace="pre",m.style.webkitUserSelect="text",m.style.MozUserSelect="text",m.style.msUserSelect="text",m.style.userSelect="text",m.addEventListener("copy",function(O){if(O.stopPropagation(),he.format)if(O.preventDefault(),typeof O.clipboardData=="undefined"){oe&&console.warn("unable to use e.clipboardData"),oe&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var G=ce[he.format]||ce.default;window.clipboardData.setData(G,p)}else O.clipboardData.clearData(),O.clipboardData.setData(he.format,p);he.onCopy&&(O.preventDefault(),he.onCopy(O.clipboardData))}),document.body.appendChild(m),A.selectNodeContents(m),h.addRange(A);var S=document.execCommand("copy");if(!S)throw new Error("copy command was unsuccessful");y=!0}catch(O){oe&&console.error("unable to copy using execCommand: ",O),oe&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(he.format||"text",p),he.onCopy&&he.onCopy(window.clipboardData),y=!0}catch(G){oe&&console.error("unable to copy using clipboardData: ",G),oe&&console.error("falling back to prompt"),o=le("message"in he?he.message:Se),window.prompt(o,p)}}finally{h&&(typeof h.removeRange=="function"?h.removeRange(A):h.removeAllRanges()),m&&document.body.removeChild(m),x()}return y}yn.exports=K},53184:function(yn,yt,T){"use strict";var k,ce;function Se(le,K,p){var he=function(oe,o){return le.js_beautify(oe,o)};return he.js=le.js_beautify,he.css=K.css_beautify,he.html=p.html_beautify,he.js_beautify=le.js_beautify,he.css_beautify=K.css_beautify,he.html_beautify=p.html_beautify,he}k=[T(58553),T(87804),T(40998)],ce=function(le,K,p){return Se(le,K,p)}.apply(yt,k),ce!==void 0&&(yn.exports=ce)},87804:function(yn,yt){var T,k;(function(){var ce;(function(){"use strict";var le=[,,function(oe){function o(h){this.__parent=h,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=[]}o.prototype.clone_empty=function(){var h=new o(this.__parent);return h.set_indent(this.__indent_count,this.__alignment_count),h},o.prototype.item=function(h){return h<0?this.__items[this.__items.length+h]:this.__items[h]},o.prototype.has_match=function(h){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(h))return!0;return!1},o.prototype.set_indent=function(h,m){this.is_empty()&&(this.__indent_count=h||0,this.__alignment_count=m||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},o.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)},o.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},o.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var h=this.__parent.current_line;return h.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),h.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),h.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,h.__items[0]===" "&&(h.__items.splice(0,1),h.__character_count-=1),!0}return!1},o.prototype.is_empty=function(){return this.__items.length===0},o.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},o.prototype.push=function(h){this.__items.push(h);var m=h.lastIndexOf(`
`);m!==-1?this.__character_count=h.length-m:this.__character_count+=h.length},o.prototype.pop=function(){var h=null;return this.is_empty()||(h=this.__items.pop(),this.__character_count-=h.length),h},o.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},o.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},o.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},o.prototype.toString=function(){var h="";return this.is_empty()?this.__parent.indent_empty_lines&&(h=this.__parent.get_indent_string(this.__indent_count)):(h=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),h+=this.__items.join("")),h};function x(h,m){this.__cache=[""],this.__indent_size=h.indent_size,this.__indent_string=h.indent_char,h.indent_with_tabs||(this.__indent_string=new Array(h.indent_size+1).join(h.indent_char)),m=m||"",h.indent_level>0&&(m=new Array(h.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}x.prototype.get_indent_size=function(h,m){var y=this.__base_string_length;return m=m||0,h<0&&(y=0),y+=h*this.__indent_size,y+=m,y},x.prototype.get_indent_string=function(h,m){var y=this.__base_string;return m=m||0,h<0&&(h=0,y=""),m+=h*this.__indent_size,this.__ensure_cache(m),y+=this.__cache[m],y},x.prototype.__ensure_cache=function(h){for(;h>=this.__cache.length;)this.__add_column()},x.prototype.__add_column=function(){var h=this.__cache.length,m=0,y="";this.__indent_size&&h>=this.__indent_size&&(m=Math.floor(h/this.__indent_size),h-=m*this.__indent_size,y=new Array(m+1).join(this.__indent_string)),h&&(y+=new Array(h+1).join(" ")),this.__cache.push(y)};function A(h,m){this.__indent_cache=new x(h,m),this.raw=!1,this._end_with_newline=h.end_with_newline,this.indent_size=h.indent_size,this.wrap_line_length=h.wrap_line_length,this.indent_empty_lines=h.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new o(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}A.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},A.prototype.get_line_number=function(){return this.__lines.length},A.prototype.get_indent_string=function(h,m){return this.__indent_cache.get_indent_string(h,m)},A.prototype.get_indent_size=function(h,m){return this.__indent_cache.get_indent_size(h,m)},A.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},A.prototype.add_new_line=function(h){return this.is_empty()||!h&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},A.prototype.get_code=function(h){this.trim(!0);var m=this.current_line.pop();m&&(m[m.length-1]===`
`&&(m=m.replace(/\n+$/g,"")),this.current_line.push(m)),this._end_with_newline&&this.__add_outputline();var y=this.__lines.join(`
`);return h!==`
`&&(y=y.replace(/[\n]/g,h)),y},A.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},A.prototype.set_indent=function(h,m){return h=h||0,m=m||0,this.next_line.set_indent(h,m),this.__lines.length>1?(this.current_line.set_indent(h,m),!0):(this.current_line.set_indent(),!1)},A.prototype.add_raw_token=function(h){for(var m=0;m<h.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(h.whitespace_before),this.current_line.push(h.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},A.prototype.add_token=function(h){this.__add_space_before_token(),this.current_line.push(h),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},A.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},A.prototype.remove_indent=function(h){for(var m=this.__lines.length;h<m;)this.__lines[h]._remove_indent(),h++;this.current_line._remove_wrap_indent()},A.prototype.trim=function(h){for(h=h===void 0?!1:h,this.current_line.trim();h&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},A.prototype.just_added_newline=function(){return this.current_line.is_empty()},A.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},A.prototype.ensure_empty_line_above=function(h,m){for(var y=this.__lines.length-2;y>=0;){var S=this.__lines[y];if(S.is_empty())break;if(S.item(0).indexOf(h)!==0&&S.item(-1)!==m){this.__lines.splice(y+1,0,new o(this)),this.previous_line=this.__lines[this.__lines.length-2];break}y--}},oe.exports.Output=A},,,,function(oe){function o(h,m){this.raw_options=x(h,m),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}o.prototype._get_array=function(h,m){var y=this.raw_options[h],S=m||[];return typeof y=="object"?y!==null&&typeof y.concat=="function"&&(S=y.concat()):typeof y=="string"&&(S=y.split(/[^a-zA-Z0-9_\/\-]+/)),S},o.prototype._get_boolean=function(h,m){var y=this.raw_options[h],S=y===void 0?!!m:!!y;return S},o.prototype._get_characters=function(h,m){var y=this.raw_options[h],S=m||"";return typeof y=="string"&&(S=y.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),S},o.prototype._get_number=function(h,m){var y=this.raw_options[h];m=parseInt(m,10),isNaN(m)&&(m=0);var S=parseInt(y,10);return isNaN(S)&&(S=m),S},o.prototype._get_selection=function(h,m,y){var S=this._get_selection_list(h,m,y);if(S.length!==1)throw new Error("Invalid Option Value: The option '"+h+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[h]+"'");return S[0]},o.prototype._get_selection_list=function(h,m,y){if(!m||m.length===0)throw new Error("Selection list cannot be empty.");if(y=y||[m[0]],!this._is_valid_selection(y,m))throw new Error("Invalid Default Value!");var S=this._get_array(h,y);if(!this._is_valid_selection(S,m))throw new Error("Invalid Option Value: The option '"+h+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[h]+"'");return S},o.prototype._is_valid_selection=function(h,m){return h.length&&m.length&&!h.some(function(y){return m.indexOf(y)===-1})};function x(h,m){var y={};h=A(h);var S;for(S in h)S!==m&&(y[S]=h[S]);if(m&&h[m])for(S in h[m])y[S]=h[m][S];return y}function A(h){var m={},y;for(y in h){var S=y.replace(/-/g,"_");m[S]=h[y]}return m}oe.exports.Options=o,oe.exports.normalizeOpts=A,oe.exports.mergeOpts=x},,function(oe){var o=RegExp.prototype.hasOwnProperty("sticky");function x(A){this.__input=A||"",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 A=null;return this.hasNext()&&(A=this.__input.charAt(this.__position),this.__position+=1),A},x.prototype.peek=function(A){var h=null;return A=A||0,A+=this.__position,A>=0&&A<this.__input_length&&(h=this.__input.charAt(A)),h},x.prototype.__match=function(A,h){A.lastIndex=h;var m=A.exec(this.__input);return m&&!(o&&A.sticky)&&m.index!==h&&(m=null),m},x.prototype.test=function(A,h){return h=h||0,h+=this.__position,h>=0&&h<this.__input_length?!!this.__match(A,h):!1},x.prototype.testChar=function(A,h){var m=this.peek(h);return A.lastIndex=0,m!==null&&A.test(m)},x.prototype.match=function(A){var h=this.__match(A,this.__position);return h?this.__position+=h[0].length:h=null,h},x.prototype.read=function(A,h,m){var y="",S;return A&&(S=this.match(A),S&&(y+=S[0])),h&&(S||!A)&&(y+=this.readUntil(h,m)),y},x.prototype.readUntil=function(A,h){var m="",y=this.__position;A.lastIndex=this.__position;var S=A.exec(this.__input);return S?(y=S.index,h&&(y+=S[0].length)):y=this.__input_length,m=this.__input.substring(this.__position,y),this.__position=y,m},x.prototype.readUntilAfter=function(A){return this.readUntil(A,!0)},x.prototype.get_regexp=function(A,h){var m=null,y="g";return h&&o&&(y="y"),typeof A=="string"&&A!==""?m=new RegExp(A,y):A&&(m=new RegExp(A.source,y)),m},x.prototype.get_literal_regexp=function(A){return RegExp(A.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},x.prototype.peekUntilAfter=function(A){var h=this.__position,m=this.readUntilAfter(A);return this.__position=h,m},x.prototype.lookBack=function(A){var h=this.__position-1;return h>=A.length&&this.__input.substring(h-A.length,h).toLowerCase()===A},oe.exports.InputScanner=x},,,,,function(oe){function o(x,A){x=typeof x=="string"?x:x.source,A=typeof A=="string"?A:A.source,this.__directives_block_pattern=new RegExp(x+/ beautify( \w+[:]\w+)+ /.source+A,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(x+/\sbeautify\signore:end\s/.source+A,"g")}o.prototype.get_directives=function(x){if(!x.match(this.__directives_block_pattern))return null;var A={};this.__directive_pattern.lastIndex=0;for(var h=this.__directive_pattern.exec(x);h;)A[h[1]]=h[2],h=this.__directive_pattern.exec(x);return A},o.prototype.readIgnored=function(x){return x.readUntilAfter(this.__directives_end_ignore_pattern)},oe.exports.Directives=o},,function(oe,o,x){var A=x(16).Beautifier,h=x(17).Options;function m(y,S){var O=new A(y,S);return O.beautify()}oe.exports=m,oe.exports.defaultOptions=function(){return new h}},function(oe,o,x){var A=x(17).Options,h=x(2).Output,m=x(8).InputScanner,y=x(13).Directives,S=new y(/\/\*/,/\*\//),O=/\r\n|[\r\n]/,G=/\r\n|[\r\n]/g,W=/\s/,I=/(?:\s|\n)+/g,M=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function D(re,ie){this._source_text=re||"",this._options=new A(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"]}D.prototype.eatString=function(re){var ie="";for(this._ch=this._input.next();this._ch;){if(ie+=this._ch,this._ch==="\\")ie+=this._input.next();else if(re.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return ie},D.prototype.eatWhitespace=function(re){for(var ie=W.test(this._input.peek()),J=0;W.test(this._input.peek());)this._ch=this._input.next(),re&&this._ch===`
`&&(J===0||J<this._options.max_preserve_newlines)&&(J++,this._output.add_new_line(!0));return ie},D.prototype.foundNestedPseudoClass=function(){for(var re=0,ie=1,J=this._input.peek(ie);J;){if(J==="{")return!0;if(J==="(")re+=1;else if(J===")"){if(re===0)return!1;re-=1}else if(J===";"||J==="}")return!1;ie++,J=this._input.peek(ie)}return!1},D.prototype.print_string=function(re){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(re)},D.prototype.preserveSingleSpace=function(re){re&&(this._output.space_before_token=!0)},D.prototype.indent=function(){this._indentLevel++},D.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},D.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var re=this._source_text,ie=this._options.eol;ie==="auto"&&(ie=`
`,re&&O.test(re||"")&&(ie=re.match(O)[0])),re=re.replace(G,`
`);var J=re.match(/^[\t ]*/)[0];this._output=new h(this._options,J),this._input=new m(re),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var ue=0,ge=!1,Ee=!1,Ne=!1,Y=!1,L=!1,V=this._ch,H=!1,ee,j,v;ee=this._input.read(I),j=ee!=="",v=V,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),V=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var g=this._input.read(M),U=S.get_directives(g);U&&U.ignore==="start"&&(g+=S.readIgnored(this._input)),this.print_string(g),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(w)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(j),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),ue===0&&te.indexOf(":")!==-1&&(Ee=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(j),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var Be=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Be.match(/[ :]$/)&&(Be=this.eatString(": ").replace(/\s+$/,""),this.print_string(Be),this._output.space_before_token=!0),ue===0&&Be.indexOf(":")!==-1?(Ee=!0,this.indent()):Be in this.NESTED_AT_RULE?(this._nestedLevel+=1,Be in this.CONDITIONAL_GROUP_RULE&&(Ne=!0)):ue===0&&!Ee&&(Y=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(j),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")Ee&&(Ee=!1,this.outdent()),Y=!1,Ne?(Ne=!1,ge=this._indentLevel>=this._nestedLevel):ge=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&ge&&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)):(v==="("?this._output.space_before_token=!1:v!==","&&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(),v==="{"&&this._output.trim(!0),Ee&&(this.outdent(),Ee=!1),this.print_string(this._ch),ge=!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 Ge=0;Ge<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Ge++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Ge])){H=!0;break}(ge||Ne)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!Y&&ue===0?(this.print_string(":"),Ee||(Ee=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Qe=v==='"'||v==="'";this.preserveSingleSpace(Qe||j),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")H=!1,ue===0?(Ee&&(this.outdent(),Ee=!1),Y=!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(),ue++,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(")")),ue&&(ue--,this.outdent()));else{var et=!1;this._input.lookBack("with")&&(et=!0),this.preserveSingleSpace(j||et),this.print_string(this._ch),Ee&&v==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),L=!0):(this.eatWhitespace(),ue++,this.indent())}else if(this._ch===")")ue&&(ue--,this.outdent()),L&&this._input.peek()===";"&&this._options.selector_separator_newline&&(L=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!Ee||L)&&ue===0&&!Y?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!Ee&&ue===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&&W.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(j),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),W.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 gt=v==='"'||v==="'";this.preserveSingleSpace(gt||j),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&H&&this._output.add_new_line()}var vt=this._output.get_code(ie);return vt},oe.exports.Beautifier=D},function(oe,o,x){var A=x(6).Options;function h(m){A.call(this,m,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var y=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||y;var S=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var O=0;O<S.length;O++)S[O]!=="expand"?this.brace_style="collapse":this.brace_style=S[O]}h.prototype=new A,oe.exports.Options=h}],K={};function p(oe){var o=K[oe];if(o!==void 0)return o.exports;var x=K[oe]={exports:{}};return le[oe](x,x.exports,p),x.exports}var he=p(15);ce=he})();var Se=ce;T=[],k=function(){return{css_beautify:Se}}.apply(yt,T),k!==void 0&&(yn.exports=k)})()},40998:function(yn,yt,T){var k,ce;(function(){var Se;(function(){"use strict";var he=[,,function(A){function h(S){this.__parent=S,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=[]}h.prototype.clone_empty=function(){var S=new h(this.__parent);return S.set_indent(this.__indent_count,this.__alignment_count),S},h.prototype.item=function(S){return S<0?this.__items[this.__items.length+S]:this.__items[S]},h.prototype.has_match=function(S){for(var O=this.__items.length-1;O>=0;O--)if(this.__items[O].match(S))return!0;return!1},h.prototype.set_indent=function(S,O){this.is_empty()&&(this.__indent_count=S||0,this.__alignment_count=O||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},h.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)},h.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},h.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var S=this.__parent.current_line;return S.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),S.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),S.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,S.__items[0]===" "&&(S.__items.splice(0,1),S.__character_count-=1),!0}return!1},h.prototype.is_empty=function(){return this.__items.length===0},h.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},h.prototype.push=function(S){this.__items.push(S);var O=S.lastIndexOf(`
`);O!==-1?this.__character_count=S.length-O:this.__character_count+=S.length},h.prototype.pop=function(){var S=null;return this.is_empty()||(S=this.__items.pop(),this.__character_count-=S.length),S},h.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},h.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},h.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},h.prototype.toString=function(){var S="";return this.is_empty()?this.__parent.indent_empty_lines&&(S=this.__parent.get_indent_string(this.__indent_count)):(S=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),S+=this.__items.join("")),S};function m(S,O){this.__cache=[""],this.__indent_size=S.indent_size,this.__indent_string=S.indent_char,S.indent_with_tabs||(this.__indent_string=new Array(S.indent_size+1).join(S.indent_char)),O=O||"",S.indent_level>0&&(O=new Array(S.indent_level+1).join(this.__indent_string)),this.__base_string=O,this.__base_string_length=O.length}m.prototype.get_indent_size=function(S,O){var G=this.__base_string_length;return O=O||0,S<0&&(G=0),G+=S*this.__indent_size,G+=O,G},m.prototype.get_indent_string=function(S,O){var G=this.__base_string;return O=O||0,S<0&&(S=0,G=""),O+=S*this.__indent_size,this.__ensure_cache(O),G+=this.__cache[O],G},m.prototype.__ensure_cache=function(S){for(;S>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var S=this.__cache.length,O=0,G="";this.__indent_size&&S>=this.__indent_size&&(O=Math.floor(S/this.__indent_size),S-=O*this.__indent_size,G=new Array(O+1).join(this.__indent_string)),S&&(G+=new Array(S+1).join(" ")),this.__cache.push(G)};function y(S,O){this.__indent_cache=new m(S,O),this.raw=!1,this._end_with_newline=S.end_with_newline,this.indent_size=S.indent_size,this.wrap_line_length=S.wrap_line_length,this.indent_empty_lines=S.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new h(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(S,O){return this.__indent_cache.get_indent_string(S,O)},y.prototype.get_indent_size=function(S,O){return this.__indent_cache.get_indent_size(S,O)},y.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},y.prototype.add_new_line=function(S){return this.is_empty()||!S&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},y.prototype.get_code=function(S){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 G=this.__lines.join(`
`);return S!==`
`&&(G=G.replace(/[\n]/g,S)),G},y.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},y.prototype.set_indent=function(S,O){return S=S||0,O=O||0,this.next_line.set_indent(S,O),this.__lines.length>1?(this.current_line.set_indent(S,O),!0):(this.current_line.set_indent(),!1)},y.prototype.add_raw_token=function(S){for(var O=0;O<S.newlines;O++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(S.whitespace_before),this.current_line.push(S.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},y.prototype.add_token=function(S){this.__add_space_before_token(),this.current_line.push(S),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(S){for(var O=this.__lines.length;S<O;)this.__lines[S]._remove_indent(),S++;this.current_line._remove_wrap_indent()},y.prototype.trim=function(S){for(S=S===void 0?!1:S,this.current_line.trim();S&&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(S,O){for(var G=this.__lines.length-2;G>=0;){var W=this.__lines[G];if(W.is_empty())break;if(W.item(0).indexOf(S)!==0&&W.item(-1)!==O){this.__lines.splice(G+1,0,new h(this)),this.previous_line=this.__lines[this.__lines.length-2];break}G--}},A.exports.Output=y},function(A){function h(m,y,S,O){this.type=m,this.text=y,this.comments_before=null,this.newlines=S||0,this.whitespace_before=O||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}A.exports.Token=h},,,function(A){function h(S,O){this.raw_options=m(S,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"])}h.prototype._get_array=function(S,O){var G=this.raw_options[S],W=O||[];return typeof G=="object"?G!==null&&typeof G.concat=="function"&&(W=G.concat()):typeof G=="string"&&(W=G.split(/[^a-zA-Z0-9_\/\-]+/)),W},h.prototype._get_boolean=function(S,O){var G=this.raw_options[S],W=G===void 0?!!O:!!G;return W},h.prototype._get_characters=function(S,O){var G=this.raw_options[S],W=O||"";return typeof G=="string"&&(W=G.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),W},h.prototype._get_number=function(S,O){var G=this.raw_options[S];O=parseInt(O,10),isNaN(O)&&(O=0);var W=parseInt(G,10);return isNaN(W)&&(W=O),W},h.prototype._get_selection=function(S,O,G){var W=this._get_selection_list(S,O,G);if(W.length!==1)throw new Error("Invalid Option Value: The option '"+S+`' can only be one of the following values:
`+O+`
You passed in: '`+this.raw_options[S]+"'");return W[0]},h.prototype._get_selection_list=function(S,O,G){if(!O||O.length===0)throw new Error("Selection list cannot be empty.");if(G=G||[O[0]],!this._is_valid_selection(G,O))throw new Error("Invalid Default Value!");var W=this._get_array(S,G);if(!this._is_valid_selection(W,O))throw new Error("Invalid Option Value: The option '"+S+`' can contain only the following values:
`+O+`
You passed in: '`+this.raw_options[S]+"'");return W},h.prototype._is_valid_selection=function(S,O){return S.length&&O.length&&!S.some(function(G){return O.indexOf(G)===-1})};function m(S,O){var G={};S=y(S);var W;for(W in S)W!==O&&(G[W]=S[W]);if(O&&S[O])for(W in S[O])G[W]=S[O][W];return G}function y(S){var O={},G;for(G in S){var W=G.replace(/-/g,"_");O[W]=S[G]}return O}A.exports.Options=h,A.exports.normalizeOpts=y,A.exports.mergeOpts=m},,function(A){var h=RegExp.prototype.hasOwnProperty("sticky");function m(y){this.__input=y||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__input.charAt(this.__position),this.__position+=1),y},m.prototype.peek=function(y){var S=null;return y=y||0,y+=this.__position,y>=0&&y<this.__input_length&&(S=this.__input.charAt(y)),S},m.prototype.__match=function(y,S){y.lastIndex=S;var O=y.exec(this.__input);return O&&!(h&&y.sticky)&&O.index!==S&&(O=null),O},m.prototype.test=function(y,S){return S=S||0,S+=this.__position,S>=0&&S<this.__input_length?!!this.__match(y,S):!1},m.prototype.testChar=function(y,S){var O=this.peek(S);return y.lastIndex=0,O!==null&&y.test(O)},m.prototype.match=function(y){var S=this.__match(y,this.__position);return S?this.__position+=S[0].length:S=null,S},m.prototype.read=function(y,S,O){var G="",W;return y&&(W=this.match(y),W&&(G+=W[0])),S&&(W||!y)&&(G+=this.readUntil(S,O)),G},m.prototype.readUntil=function(y,S){var O="",G=this.__position;y.lastIndex=this.__position;var W=y.exec(this.__input);return W?(G=W.index,S&&(G+=W[0].length)):G=this.__input_length,O=this.__input.substring(this.__position,G),this.__position=G,O},m.prototype.readUntilAfter=function(y){return this.readUntil(y,!0)},m.prototype.get_regexp=function(y,S){var O=null,G="g";return S&&h&&(G="y"),typeof y=="string"&&y!==""?O=new RegExp(y,G):y&&(O=new RegExp(y.source,G)),O},m.prototype.get_literal_regexp=function(y){return RegExp(y.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(y){var S=this.__position,O=this.readUntilAfter(y);return this.__position=S,O},m.prototype.lookBack=function(y){var S=this.__position-1;return S>=y.length&&this.__input.substring(S-y.length,S).toLowerCase()===y},A.exports.InputScanner=m},function(A,h,m){var y=m(8).InputScanner,S=m(3).Token,O=m(10).TokenStream,G=m(11).WhitespacePattern,W={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},I=function(M,w){this._input=new y(M),this._options=w||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new G(this._input)};I.prototype.tokenize=function(){this._input.restart(),this.__tokens=new O,this._reset();for(var M,w=new S(W.START,""),D=null,re=[],ie=new O;w.type!==W.EOF;){for(M=this._get_next_token(w,D);this._is_comment(M);)ie.add(M),M=this._get_next_token(w,D);ie.isEmpty()||(M.comments_before=ie,ie=new O),M.parent=D,this._is_opening(M)?(re.push(D),D=M):D&&this._is_closing(M,D)&&(M.opened=D,D.closed=M,D=re.pop(),M.parent=D),M.previous=w,w.next=M,this.__tokens.add(M),w=M}return this.__tokens},I.prototype._is_first_token=function(){return this.__tokens.isEmpty()},I.prototype._reset=function(){},I.prototype._get_next_token=function(M,w){this._readWhitespace();var D=this._input.read(/.+/g);return D?this._create_token(W.RAW,D):this._create_token(W.EOF,"")},I.prototype._is_comment=function(M){return!1},I.prototype._is_opening=function(M){return!1},I.prototype._is_closing=function(M,w){return!1},I.prototype._create_token=function(M,w){var D=new S(M,w,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return D},I.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},A.exports.Tokenizer=I,A.exports.TOKEN=W},function(A){function h(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}h.prototype.restart=function(){this.__position=0},h.prototype.isEmpty=function(){return this.__tokens_length===0},h.prototype.hasNext=function(){return this.__position<this.__tokens_length},h.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},h.prototype.peek=function(m){var y=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(y=this.__tokens[m]),y},h.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},A.exports.TokenStream=h},function(A,h,m){var y=m(12).Pattern;function S(O,G){y.call(this,O,G),G?this._line_regexp=this._input.get_regexp(G._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}S.prototype=new y,S.prototype.__set_whitespace_patterns=function(O,G){O+="\\t ",G+="\\n\\r",this._match_pattern=this._input.get_regexp("["+O+G+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+G+"]")},S.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 G=this.__split(this._newline_regexp,O);this.newline_count=G.length-1,this.whitespace_before_token=G[this.newline_count]}return O},S.prototype.matching=function(O,G){var W=this._create();return W.__set_whitespace_patterns(O,G),W._update(),W},S.prototype._create=function(){return new S(this._input,this)},S.prototype.__split=function(O,G){O.lastIndex=0;for(var W=0,I=[],M=O.exec(G);M;)I.push(G.substring(W,M.index)),W=M.index+M[0].length,M=O.exec(G);return W<G.length?I.push(G.substring(W,G.length)):I.push(""),I},A.exports.WhitespacePattern=S},function(A){function h(m,y){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,y&&(this._starting_pattern=this._input.get_regexp(y._starting_pattern,!0),this._match_pattern=this._input.get_regexp(y._match_pattern,!0),this._until_pattern=this._input.get_regexp(y._until_pattern),this._until_after=y._until_after)}h.prototype.read=function(){var m=this._input.read(this._starting_pattern);return(!this._starting_pattern||m)&&(m+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),m},h.prototype.read_match=function(){return this._input.match(this._match_pattern)},h.prototype.until_after=function(m){var y=this._create();return y._until_after=!0,y._until_pattern=this._input.get_regexp(m),y._update(),y},h.prototype.until=function(m){var y=this._create();return y._until_after=!1,y._until_pattern=this._input.get_regexp(m),y._update(),y},h.prototype.starting_with=function(m){var y=this._create();return y._starting_pattern=this._input.get_regexp(m,!0),y._update(),y},h.prototype.matching=function(m){var y=this._create();return y._match_pattern=this._input.get_regexp(m,!0),y._update(),y},h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){},A.exports.Pattern=h},function(A){function h(m,y){m=typeof m=="string"?m:m.source,y=typeof y=="string"?y:y.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+y,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+y,"g")}h.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var y={};this.__directive_pattern.lastIndex=0;for(var S=this.__directive_pattern.exec(m);S;)y[S[1]]=S[2],S=this.__directive_pattern.exec(m);return y},h.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},A.exports.Directives=h},function(A,h,m){var y=m(12).Pattern,S={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function O(G,W){y.call(this,G,W),this.__template_pattern=null,this._disabled=Object.assign({},S),this._excluded=Object.assign({},S),W&&(this.__template_pattern=this._input.get_regexp(W.__template_pattern),this._excluded=Object.assign(this._excluded,W._excluded),this._disabled=Object.assign(this._disabled,W._disabled));var I=new y(G);this.__patterns={handlebars_comment:I.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:I.starting_with(/{{{/).until_after(/}}}/),handlebars:I.starting_with(/{{/).until_after(/}}/),php:I.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:I.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:I.starting_with(/{%/).until_after(/%}/),django_value:I.starting_with(/{{/).until_after(/}}/),django_comment:I.starting_with(/{#/).until_after(/#}/),smarty:I.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:I.starting_with(/{\*/).until_after(/\*}/),smarty_literal:I.starting_with(/{literal}/).until_after(/{\/literal}/)}}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(G){var W=this._create();return W._disabled[G]=!0,W._update(),W},O.prototype.read_options=function(G){var W=this._create();for(var I in S)W._disabled[I]=G.templating.indexOf(I)===-1;return W._update(),W},O.prototype.exclude=function(G){var W=this._create();return W._excluded[G]=!0,W._update(),W},O.prototype.read=function(){var G="";this._match_pattern?G=this._input.read(this._starting_pattern):G=this._input.read(this._starting_pattern,this.__template_pattern);for(var W=this._read_template();W;)this._match_pattern?W+=this._input.read(this._match_pattern):W+=this._input.readUntil(this.__template_pattern),G+=W,W=this._read_template();return this._until_after&&(G+=this._input.readUntilAfter(this._until_pattern)),G},O.prototype.__set_templated_pattern=function(){var G=[];this._disabled.php||G.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||G.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||G.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||G.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(G.push(this.__patterns.django._starting_pattern.source),G.push(this.__patterns.django_value._starting_pattern.source),G.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||G.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&G.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+G.join("|")+")")},O.prototype._read_template=function(){var G="",W=this._input.peek();if(W==="<"){var I=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&I==="?"&&(G=G||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&I==="%"&&(G=G||this.__patterns.erb.read())}else W==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(G=G||this.__patterns.handlebars_comment.read(),G=G||this.__patterns.handlebars_unescaped.read(),G=G||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(G=G||this.__patterns.django_value.read()),this._excluded.django||(G=G||this.__patterns.django_comment.read(),G=G||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(G=G||this.__patterns.smarty_comment.read(),G=G||this.__patterns.smarty_literal.read(),G=G||this.__patterns.smarty.read()));return G},A.exports.TemplatablePattern=O},,,,function(A,h,m){var y=m(19).Beautifier,S=m(20).Options;function O(G,W,I,M){var w=new y(G,W,I,M);return w.beautify()}A.exports=O,A.exports.defaultOptions=function(){return new S}},function(A,h,m){var y=m(20).Options,S=m(2).Output,O=m(21).Tokenizer,G=m(21).TOKEN,W=/\r\n|[\r\n]/,I=/\r\n|[\r\n]/g,M=function(Y,L){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=Y.max_preserve_newlines,this.preserve_newlines=Y.preserve_newlines,this._output=new S(Y,L)};M.prototype.current_line_has_match=function(Y){return this._output.current_line.has_match(Y)},M.prototype.set_space_before_token=function(Y,L){this._output.space_before_token=Y,this._output.non_breaking_space=L},M.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},M.prototype.add_raw_token=function(Y){this._output.add_raw_token(Y)},M.prototype.print_preserved_newlines=function(Y){var L=0;Y.type!==G.TEXT&&Y.previous.type!==G.TEXT&&(L=Y.newlines?1:0),this.preserve_newlines&&(L=Y.newlines<this.max_preserve_newlines+1?Y.newlines:this.max_preserve_newlines+1);for(var V=0;V<L;V++)this.print_newline(V>0);return L!==0},M.prototype.traverse_whitespace=function(Y){return Y.whitespace_before||Y.newlines?(this.print_preserved_newlines(Y)||(this._output.space_before_token=!0),!0):!1},M.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},M.prototype.print_newline=function(Y){this._output.add_new_line(Y)},M.prototype.print_token=function(Y){Y.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(Y.text))},M.prototype.indent=function(){this.indent_level++},M.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},M.prototype.get_full_indent=function(Y){return Y=this.indent_level+(Y||0),Y<1?"":this._output.get_indent_string(Y)};var w=function(Y){for(var L=null,V=Y.next;V.type!==G.EOF&&Y.closed!==V;){if(V.type===G.ATTRIBUTE&&V.text==="type"){V.next&&V.next.type===G.EQUALS&&V.next.next&&V.next.next.type===G.VALUE&&(L=V.next.next.text);break}V=V.next}return L},D=function(Y,L){var V=null,H=null;return L.closed?(Y==="script"?V="text/javascript":Y==="style"&&(V="text/css"),V=w(L)||V,V.search("text/css")>-1?H="css":V.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?H="javascript":V.search(/(text|application|dojo)\/(x-)?(html)/)>-1?H="html":V.search(/test\/null/)>-1&&(H="null"),H):null};function re(Y,L){return L.indexOf(Y)!==-1}function ie(Y,L,V){this.parent=Y||null,this.tag=L?L.tag_name:"",this.indent_level=V||0,this.parser_token=L||null}function J(Y){this._printer=Y,this._current_frame=null}J.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},J.prototype.record_tag=function(Y){var L=new ie(this._current_frame,Y,this._printer.indent_level);this._current_frame=L},J.prototype._try_pop_frame=function(Y){var L=null;return Y&&(L=Y.parser_token,this._printer.indent_level=Y.indent_level,this._current_frame=Y.parent),L},J.prototype._get_frame=function(Y,L){for(var V=this._current_frame;V&&Y.indexOf(V.tag)===-1;){if(L&&L.indexOf(V.tag)!==-1){V=null;break}V=V.parent}return V},J.prototype.try_pop=function(Y,L){var V=this._get_frame([Y],L);return this._try_pop_frame(V)},J.prototype.indent_to_tag=function(Y){var L=this._get_frame(Y);L&&(this._printer.indent_level=L.indent_level)};function ue(Y,L,V,H){this._source_text=Y||"",L=L||{},this._js_beautify=V,this._css_beautify=H,this._tag_stack=null;var ee=new y(L,"html");this._options=ee,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"}ue.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var Y=this._source_text,L=this._options.eol;this._options.eol==="auto"&&(L=`
`,Y&&W.test(Y)&&(L=Y.match(W)[0])),Y=Y.replace(I,`
`);var V=Y.match(/^[\t ]*/)[0],H={text:"",type:""},ee=new ge(this._options),j=new M(this._options,V),v=new O(Y,this._options).tokenize();this._tag_stack=new J(j);for(var g=null,U=v.next();U.type!==G.EOF;)U.type===G.TAG_OPEN||U.type===G.COMMENT?(g=this._handle_tag_open(j,U,ee,H,v),ee=g):U.type===G.ATTRIBUTE||U.type===G.EQUALS||U.type===G.VALUE||U.type===G.TEXT&&!ee.tag_complete?g=this._handle_inside_tag(j,U,ee,H):U.type===G.TAG_CLOSE?g=this._handle_tag_close(j,U,ee):U.type===G.TEXT?g=this._handle_text(j,U,ee):U.type===G.CONTROL_FLOW_OPEN?g=this._handle_control_flow_open(j,U):U.type===G.CONTROL_FLOW_CLOSE?g=this._handle_control_flow_close(j,U):j.add_raw_token(U),H=g,U=v.next();var te=j._output.get_code(L);return te},ue.prototype._handle_control_flow_open=function(Y,L){var V={text:L.text,type:L.type};return Y.set_space_before_token(L.newlines||L.whitespace_before!=="",!0),L.newlines?Y.print_preserved_newlines(L):Y.set_space_before_token(L.newlines||L.whitespace_before!=="",!0),Y.print_token(L),Y.indent(),V},ue.prototype._handle_control_flow_close=function(Y,L){var V={text:L.text,type:L.type};return Y.deindent(),L.newlines?Y.print_preserved_newlines(L):Y.set_space_before_token(L.newlines||L.whitespace_before!=="",!0),Y.print_token(L),V},ue.prototype._handle_tag_close=function(Y,L,V){var H={text:L.text,type:L.type};return Y.alignment_size=0,V.tag_complete=!0,Y.set_space_before_token(L.newlines||L.whitespace_before!=="",!0),V.is_unformatted?Y.add_raw_token(L):(V.tag_start_char==="<"&&(Y.set_space_before_token(L.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&V.has_wrapped_attrs&&Y.print_newline(!1)),Y.print_token(L)),V.indent_content&&!(V.is_unformatted||V.is_content_unformatted)&&(Y.indent(),V.indent_content=!1),!V.is_inline_element&&!(V.is_unformatted||V.is_content_unformatted)&&Y.set_wrap_point(),H},ue.prototype._handle_inside_tag=function(Y,L,V,H){var ee=V.has_wrapped_attrs,j={text:L.text,type:L.type};return Y.set_space_before_token(L.newlines||L.whitespace_before!=="",!0),V.is_unformatted?Y.add_raw_token(L):V.tag_start_char==="{"&&L.type===G.TEXT?Y.print_preserved_newlines(L)?(L.newlines=0,Y.add_raw_token(L)):Y.print_token(L):(L.type===G.ATTRIBUTE?Y.set_space_before_token(!0):(L.type===G.EQUALS||L.type===G.VALUE&&L.previous.type===G.EQUALS)&&Y.set_space_before_token(!1),L.type===G.ATTRIBUTE&&V.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(Y.traverse_whitespace(L),ee=ee||L.newlines!==0),this._is_wrap_attributes_force&&V.attr_count>=this._options.wrap_attributes_min_attrs&&(H.type!==G.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(Y.print_newline(!1),ee=!0)),Y.print_token(L),ee=ee||Y.previous_token_wrapped(),V.has_wrapped_attrs=ee),j},ue.prototype._handle_text=function(Y,L,V){var H={text:L.text,type:"TK_CONTENT"};return V.custom_beautifier_name?this._print_custom_beatifier_text(Y,L,V):V.is_unformatted||V.is_content_unformatted?Y.add_raw_token(L):(Y.traverse_whitespace(L),Y.print_token(L)),H},ue.prototype._print_custom_beatifier_text=function(Y,L,V){var H=this;if(L.text!==""){var ee=L.text,j,v=1,g="",U="";V.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?j=this._js_beautify:V.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?j=this._css_beautify:V.custom_beautifier_name==="html"&&(j=function(gt,vt){var we=new ue(gt,vt,H._js_beautify,H._css_beautify);return we.beautify()}),this._options.indent_scripts==="keep"?v=0:this._options.indent_scripts==="separate"&&(v=-Y.indent_level);var te=Y.get_full_indent(v);if(ee=ee.replace(/\n[ \t]*$/,""),V.custom_beautifier_name!=="html"&&ee[0]==="<"&&ee.match(/^(<!--|<!\[CDATA\[)/)){var Be=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(ee);if(!Be){Y.add_raw_token(L);return}g=te+Be[1]+`
`,ee=Be[4],Be[5]&&(U=te+Be[5]),ee=ee.replace(/\n[ \t]*$/,""),(Be[2]||Be[3].indexOf(`
`)!==-1)&&(Be=Be[3].match(/[ \t]+$/),Be&&(L.whitespace_before=Be[0]))}if(ee)if(j){var Ge=function(){this.eol=`
`};Ge.prototype=this._options.raw_options;var Qe=new Ge;ee=j(te+ee,Qe)}else{var et=L.whitespace_before;et&&(ee=ee.replace(new RegExp(`
(`+et+")?","g"),`
`)),ee=te+ee.replace(/\n/g,`
`+te)}g&&(ee?ee=g+ee+`
`+U:ee=g+U),Y.print_newline(!1),ee&&(L.text=ee,L.whitespace_before="",L.newlines=0,Y.add_raw_token(L),Y.print_newline(!0))}},ue.prototype._handle_tag_open=function(Y,L,V,H,ee){var j=this._get_tag_open_token(L);if((V.is_unformatted||V.is_content_unformatted)&&!V.is_empty_element&&L.type===G.TAG_OPEN&&!j.is_start_tag?(Y.add_raw_token(L),j.start_tag_token=this._tag_stack.try_pop(j.tag_name)):(Y.traverse_whitespace(L),this._set_tag_position(Y,L,j,V,H),j.is_inline_element||Y.set_wrap_point(),Y.print_token(L)),j.is_start_tag&&this._is_wrap_attributes_force){var v=0,g;do g=ee.peek(v),g.type===G.ATTRIBUTE&&(j.attr_count+=1),v+=1;while(g.type!==G.EOF&&g.type!==G.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(j.alignment_size=L.text.length+1),!j.tag_complete&&!j.is_unformatted&&(Y.alignment_size=j.alignment_size),j};var ge=function(Y,L,V){if(this.parent=L||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="",!V)this.tag_complete=!0;else{var H;this.tag_start_char=V.text[0],this.text=V.text,this.tag_start_char==="<"?(H=V.text.match(/^<([^\s>]*)/),this.tag_check=H?H[1]:""):(H=V.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=H?H[1]:"",(V.text.startsWith("{{#>")||V.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&V.next!==null?this.tag_check=V.next.text.split(" ")[0]:this.tag_check=V.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),V.type===G.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||V.closed&&V.closed.text==="/>";var ee=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(ee=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!Y.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(ee)))}};ue.prototype._get_tag_open_token=function(Y){var L=new ge(this._options,this._tag_stack.get_parser_token(),Y);return L.alignment_size=this._options.wrap_attributes_indent_size,L.is_end_tag=L.is_end_tag||re(L.tag_check,this._options.void_elements),L.is_empty_element=L.tag_complete||L.is_start_tag&&L.is_end_tag,L.is_unformatted=!L.tag_complete&&re(L.tag_check,this._options.unformatted),L.is_content_unformatted=!L.is_empty_element&&re(L.tag_check,this._options.content_unformatted),L.is_inline_element=re(L.tag_name,this._options.inline)||this._options.inline_custom_elements&&L.tag_name.includes("-")||L.tag_start_char==="{",L},ue.prototype._set_tag_position=function(Y,L,V,H,ee){if(V.is_empty_element||(V.is_end_tag?V.start_tag_token=this._tag_stack.try_pop(V.tag_name):(this._do_optional_end_element(V)&&(V.is_inline_element||Y.print_newline(!1)),this._tag_stack.record_tag(V),(V.tag_name==="script"||V.tag_name==="style")&&!(V.is_unformatted||V.is_content_unformatted)&&(V.custom_beautifier_name=D(V.tag_check,L)))),re(V.tag_check,this._options.extra_liners)&&(Y.print_newline(!1),Y._output.just_added_blankline()||Y.print_newline(!0)),V.is_empty_element){if(V.tag_start_char==="{"&&V.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),V.indent_content=!0;var j=Y.current_line_has_match(/{{#if/);j||Y.print_newline(!1)}V.tag_name==="!--"&&ee.type===G.TAG_CLOSE&&H.is_end_tag&&V.text.indexOf(`
`)===-1||(V.is_inline_element||V.is_unformatted||Y.print_newline(!1),this._calcluate_parent_multiline(Y,V))}else if(V.is_end_tag){var v=!1;v=V.start_tag_token&&V.start_tag_token.multiline_content,v=v||!V.is_inline_element&&!(H.is_inline_element||H.is_unformatted)&&!(ee.type===G.TAG_CLOSE&&V.start_tag_token===H)&&ee.type!=="TK_CONTENT",(V.is_content_unformatted||V.is_unformatted)&&(v=!1),v&&Y.print_newline(!1)}else V.indent_content=!V.custom_beautifier_name,V.tag_start_char==="<"&&(V.tag_name==="html"?V.indent_content=this._options.indent_inner_html:V.tag_name==="head"?V.indent_content=this._options.indent_head_inner_html:V.tag_name==="body"&&(V.indent_content=this._options.indent_body_inner_html)),!(V.is_inline_element||V.is_unformatted)&&(ee.type!=="TK_CONTENT"||V.is_content_unformatted)&&Y.print_newline(!1),this._calcluate_parent_multiline(Y,V)},ue.prototype._calcluate_parent_multiline=function(Y,L){L.parent&&Y._output.just_added_newline()&&!((L.is_inline_element||L.is_unformatted)&&L.parent.is_inline_element)&&(L.parent.multiline_content=!0)};var Ee=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","menu","nav","ol","p","pre","section","table","ul"],Ne=["a","audio","del","ins","map","noscript","video"];ue.prototype._do_optional_end_element=function(Y){var L=null;if(!(Y.is_empty_element||!Y.is_start_tag||!Y.parent)){if(Y.tag_name==="body")L=L||this._tag_stack.try_pop("head");else if(Y.tag_name==="li")L=L||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(Y.tag_name==="dd"||Y.tag_name==="dt")L=L||this._tag_stack.try_pop("dt",["dl"]),L=L||this._tag_stack.try_pop("dd",["dl"]);else if(Y.parent.tag_name==="p"&&Ee.indexOf(Y.tag_name)!==-1){var V=Y.parent.parent;(!V||Ne.indexOf(V.tag_name)===-1)&&(L=L||this._tag_stack.try_pop("p"))}else Y.tag_name==="rp"||Y.tag_name==="rt"?(L=L||this._tag_stack.try_pop("rt",["ruby","rtc"]),L=L||this._tag_stack.try_pop("rp",["ruby","rtc"])):Y.tag_name==="optgroup"?L=L||this._tag_stack.try_pop("optgroup",["select"]):Y.tag_name==="option"?L=L||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):Y.tag_name==="colgroup"?L=L||this._tag_stack.try_pop("caption",["table"]):Y.tag_name==="thead"?(L=L||this._tag_stack.try_pop("caption",["table"]),L=L||this._tag_stack.try_pop("colgroup",["table"])):Y.tag_name==="tbody"||Y.tag_name==="tfoot"?(L=L||this._tag_stack.try_pop("caption",["table"]),L=L||this._tag_stack.try_pop("colgroup",["table"]),L=L||this._tag_stack.try_pop("thead",["table"]),L=L||this._tag_stack.try_pop("tbody",["table"])):Y.tag_name==="tr"?(L=L||this._tag_stack.try_pop("caption",["table"]),L=L||this._tag_stack.try_pop("colgroup",["table"]),L=L||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(Y.tag_name==="th"||Y.tag_name==="td")&&(L=L||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),L=L||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return Y.parent=this._tag_stack.get_parser_token(),L}},A.exports.Beautifier=ue},function(A,h,m){var y=m(6).Options;function S(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"])}S.prototype=new y,A.exports.Options=S},function(A,h,m){var y=m(9).Tokenizer,S=m(9).TOKEN,O=m(13).Directives,G=m(14).TemplatablePattern,W=m(12).Pattern,I={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",CONTROL_FLOW_OPEN:"TK_CONTROL_FLOW_OPEN",CONTROL_FLOW_CLOSE:"TK_CONTROL_FLOW_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:S.START,RAW:S.RAW,EOF:S.EOF},M=new O(/<\!--/,/-->/),w=function(D,re){y.call(this,D,re),this._current_tag_name="";var ie=new G(this._input).read_options(this._options),J=new W(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:J.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:J.starting_with(/{{!--/).until_after(/--}}/),handlebars:J.starting_with(/{{/).until_after(/}}/),handlebars_open:J.until(/[\n\r\t }]/),handlebars_raw_close:J.until(/}}/),comment:J.starting_with(/<!--/).until_after(/-->/),cdata:J.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:J.starting_with(/<!\[/).until_after(/]>/),processing:J.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 ue=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=J.matching(ue).until_after(ue)}};w.prototype=new y,w.prototype._is_comment=function(D){return!1},w.prototype._is_opening=function(D){return D.type===I.TAG_OPEN||D.type===I.CONTROL_FLOW_OPEN},w.prototype._is_closing=function(D,re){return D.type===I.TAG_CLOSE&&re&&((D.text===">"||D.text==="/>")&&re.text[0]==="<"||D.text==="}}"&&re.text[0]==="{"&&re.text[1]==="{")||D.type===I.CONTROL_FLOW_CLOSE&&D.text==="}"&&re.text.endsWith("{")},w.prototype._reset=function(){this._current_tag_name=""},w.prototype._get_next_token=function(D,re){var ie=null;this._readWhitespace();var J=this._input.peek();return J===null?this._create_token(I.EOF,""):(ie=ie||this._read_open_handlebars(J,re),ie=ie||this._read_attribute(J,D,re),ie=ie||this._read_close(J,re),ie=ie||this._read_script_and_style(J,D),ie=ie||this._read_control_flows(J,re),ie=ie||this._read_raw_content(J,D,re),ie=ie||this._read_content_word(J,re),ie=ie||this._read_comment_or_cdata(J),ie=ie||this._read_processing(J),ie=ie||this._read_open(J,re),ie=ie||this._create_token(I.UNKNOWN,this._input.next()),ie)},w.prototype._read_comment_or_cdata=function(D){var re=null,ie=null,J=null;if(D==="<"){var ue=this._input.peek(1);ue==="!"&&(ie=this.__patterns.comment.read(),ie?(J=M.get_directives(ie),J&&J.ignore==="start"&&(ie+=M.readIgnored(this._input))):ie=this.__patterns.cdata.read()),ie&&(re=this._create_token(I.COMMENT,ie),re.directives=J)}return re},w.prototype._read_processing=function(D){var re=null,ie=null,J=null;if(D==="<"){var ue=this._input.peek(1);(ue==="!"||ue==="?")&&(ie=this.__patterns.conditional_comment.read(),ie=ie||this.__patterns.processing.read()),ie&&(re=this._create_token(I.COMMENT,ie),re.directives=J)}return re},w.prototype._read_open=function(D,re){var ie=null,J=null;return(!re||re.type===I.CONTROL_FLOW_OPEN)&&D==="<"&&(ie=this._input.next(),this._input.peek()==="/"&&(ie+=this._input.next()),ie+=this.__patterns.element_name.read(),J=this._create_token(I.TAG_OPEN,ie)),J},w.prototype._read_open_handlebars=function(D,re){var ie=null,J=null;return(!re||re.type===I.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&D==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(ie=this.__patterns.handlebars_comment.read(),ie=ie||this.__patterns.handlebars.read(),J=this._create_token(I.COMMENT,ie)):(ie=this.__patterns.handlebars_open.read(),J=this._create_token(I.TAG_OPEN,ie))),J},w.prototype._read_control_flows=function(D,re){var ie="",J=null;if(!this._options.templating.includes("angular"))return J;if(D==="@"){if(ie=this.__patterns.angular_control_flow_start.read(),ie==="")return J;for(var ue=ie.endsWith("(")?1:0,ge=0;!(ie.endsWith("{")&&ue===ge);){var Ee=this._input.next();if(Ee===null)break;Ee==="("?ue++:Ee===")"&&ge++,ie+=Ee}J=this._create_token(I.CONTROL_FLOW_OPEN,ie)}else D==="}"&&re&&re.type===I.CONTROL_FLOW_OPEN&&(ie=this._input.next(),J=this._create_token(I.CONTROL_FLOW_CLOSE,ie));return J},w.prototype._read_close=function(D,re){var ie=null,J=null;return re&&re.type===I.TAG_OPEN&&(re.text[0]==="<"&&(D===">"||D==="/"&&this._input.peek(1)===">")?(ie=this._input.next(),D==="/"&&(ie+=this._input.next()),J=this._create_token(I.TAG_CLOSE,ie)):re.text[0]==="{"&&D==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),J=this._create_token(I.TAG_CLOSE,"}}"))),J},w.prototype._read_attribute=function(D,re,ie){var J=null,ue="";if(ie&&ie.text[0]==="<")if(D==="=")J=this._create_token(I.EQUALS,this._input.next());else if(D==='"'||D==="'"){var ge=this._input.next();D==='"'?ge+=this.__patterns.double_quote.read():ge+=this.__patterns.single_quote.read(),J=this._create_token(I.VALUE,ge)}else ue=this.__patterns.attribute.read(),ue&&(re.type===I.EQUALS?J=this._create_token(I.VALUE,ue):J=this._create_token(I.ATTRIBUTE,ue));return J},w.prototype._is_content_unformatted=function(D){return this._options.void_elements.indexOf(D)===-1&&(this._options.content_unformatted.indexOf(D)!==-1||this._options.unformatted.indexOf(D)!==-1)},w.prototype._read_raw_content=function(D,re,ie){var J="";if(ie&&ie.text[0]==="{")J=this.__patterns.handlebars_raw_close.read();else if(re.type===I.TAG_CLOSE&&re.opened.text[0]==="<"&&re.text[0]!=="/"){var ue=re.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ue)&&(J=this._input.readUntil(new RegExp("</"+ue+"[\\n\\r\\t ]*?>","ig")))}return J?this._create_token(I.TEXT,J):null},w.prototype._read_script_and_style=function(D,re){if(re.type===I.TAG_CLOSE&&re.opened.text[0]==="<"&&re.text[0]!=="/"){var ie=re.opened.text.substr(1).toLowerCase();if(ie==="script"||ie==="style"){var J=this._read_comment_or_cdata(D);if(J)return J.type=I.TEXT,J;var ue=this._input.readUntil(new RegExp("</"+ie+"[\\n\\r\\t ]*?>","ig"));if(ue)return this._create_token(I.TEXT,ue)}}return null},w.prototype._read_content_word=function(D,re){var ie="";return this._options.unformatted_content_delimiter&&D===this._options.unformatted_content_delimiter[0]&&(ie=this.__patterns.unformatted_content_delimiter.read()),ie||(ie=re&&re.type===I.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),ie?this._create_token(I.TEXT,ie):null},A.exports.Tokenizer=w,A.exports.TOKEN=I}],oe={};function o(A){var h=oe[A];if(h!==void 0)return h.exports;var m=oe[A]={exports:{}};return he[A](m,m.exports,o),m.exports}var x=o(18);Se=x})();var le=Se;if(1)k=[T,T(58553),T(87804)],ce=function(he){var oe=T(58553),o=T(87804);return{html_beautify:function(x,A){return le(x,A,oe.js_beautify,o.css_beautify)}}}.apply(yt,k),ce!==void 0&&(yn.exports=ce);else var K,p})()},58553:function(yn,yt){var T,k;(function(){var ce;(function(){"use strict";var le=[function(oe,o,x){var A=x(1).Beautifier,h=x(5).Options;function m(y,S){var O=new A(y,S);return O.beautify()}oe.exports=m,oe.exports.defaultOptions=function(){return new h}},function(oe,o,x){var A=x(2).Output,h=x(3).Token,m=x(4),y=x(5).Options,S=x(7).Tokenizer,O=x(7).line_starters,G=x(7).positionable_operators,W=x(7).TOKEN;function I(g,U){return U.indexOf(g)!==-1}function M(g){return g.replace(/^\s+/g,"")}function w(g){for(var U={},te=0;te<g.length;te++)U[g[te].replace(/-/g,"_")]=g[te];return U}function D(g,U){return g&&g.type===W.RESERVED&&g.text===U}function re(g,U){return g&&g.type===W.RESERVED&&I(g.text,U)}var ie=["case","return","do","if","throw","else","await","break","continue","async"],J=["before-newline","after-newline","preserve-newline"],ue=w(J),ge=[ue.before_newline,ue.preserve_newline],Ee={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Ne(g,U){U.multiline_frame||U.mode===Ee.ForInitializer||U.mode===Ee.Conditional||g.remove_indent(U.start_line_index)}function Y(g){g=g.replace(m.allLineBreaks,`
`);for(var U=[],te=g.indexOf(`
`);te!==-1;)U.push(g.substring(0,te)),g=g.substring(te+1),te=g.indexOf(`
`);return g.length&&U.push(g),U}function L(g){return g===Ee.ArrayLiteral}function V(g){return I(g,[Ee.Expression,Ee.ForInitializer,Ee.Conditional])}function H(g,U){for(var te=0;te<g.length;te++){var Be=g[te].trim();if(Be.charAt(0)!==U)return!1}return!0}function ee(g,U){for(var te=0,Be=g.length,Ge;te<Be;te++)if(Ge=g[te],Ge&&Ge.indexOf(U)!==0)return!1;return!0}function j(g,U){U=U||{},this._source_text=g||"",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(U)}j.prototype.create_flags=function(g,U){var te=0;g&&(te=g.indentation_level,!this._output.just_added_newline()&&g.line_indent_level>te&&(te=g.line_indent_level));var Be={mode:U,parent:g,last_token:g?g.last_token:new h(W.START_BLOCK,""),last_word:g?g.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:te,alignment:0,line_indent_level:g?g.line_indent_level:te,start_line_index:this._output.get_line_number(),ternary_depth:0};return Be},j.prototype._reset=function(g){var U=g.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new A(this._options,U),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Ee.BlockStatement);var te=new S(g,this._options);return this._tokens=te.tokenize(),g},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var g,U=this._reset(this._source_text),te=this._options.eol;this._options.eol==="auto"&&(te=`
`,U&&m.lineBreak.test(U||"")&&(te=U.match(m.lineBreak)[0]));for(var Be=this._tokens.next();Be;)this.handle_token(Be),this._last_last_text=this._flags.last_token.text,this._flags.last_token=Be,Be=this._tokens.next();return g=this._output.get_code(te),g},j.prototype.handle_token=function(g,U){g.type===W.START_EXPR?this.handle_start_expr(g):g.type===W.END_EXPR?this.handle_end_expr(g):g.type===W.START_BLOCK?this.handle_start_block(g):g.type===W.END_BLOCK?this.handle_end_block(g):g.type===W.WORD?this.handle_word(g):g.type===W.RESERVED?this.handle_word(g):g.type===W.SEMICOLON?this.handle_semicolon(g):g.type===W.STRING?this.handle_string(g):g.type===W.EQUALS?this.handle_equals(g):g.type===W.OPERATOR?this.handle_operator(g):g.type===W.COMMA?this.handle_comma(g):g.type===W.BLOCK_COMMENT?this.handle_block_comment(g,U):g.type===W.COMMENT?this.handle_comment(g,U):g.type===W.DOT?this.handle_dot(g):g.type===W.EOF?this.handle_eof(g):g.type===W.UNKNOWN?this.handle_unknown(g,U):this.handle_unknown(g,U)},j.prototype.handle_whitespace_and_comments=function(g,U){var te=g.newlines,Be=this._options.keep_array_indentation&&L(this._flags.mode);if(g.comments_before)for(var Ge=g.comments_before.next();Ge;)this.handle_whitespace_and_comments(Ge,U),this.handle_token(Ge,U),Ge=g.comments_before.next();if(Be)for(var Qe=0;Qe<te;Qe+=1)this.print_newline(Qe>0,U);else if(this._options.max_preserve_newlines&&te>this._options.max_preserve_newlines&&(te=this._options.max_preserve_newlines),this._options.preserve_newlines&&te>1){this.print_newline(!1,U);for(var et=1;et<te;et+=1)this.print_newline(!0,U)}};var v=["async","break","continue","return","throw","yield"];j.prototype.allow_wrap_or_preserved_newline=function(g,U){if(U=U===void 0?!1:U,!this._output.just_added_newline()){var te=this._options.preserve_newlines&&g.newlines||U,Be=I(this._flags.last_token.text,G)||I(g.text,G);if(Be){var Ge=I(this._flags.last_token.text,G)&&I(this._options.operator_position,ge)||I(g.text,G);te=te&&Ge}if(te)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(re(this._flags.last_token,v))return;this._output.set_wrap_point()}}},j.prototype.print_newline=function(g,U){if(!U&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==W.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var te=this._tokens.peek();this._flags.mode===Ee.Statement&&!(this._flags.if_block&&D(te,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(g)&&(this._flags.multiline_frame=!0)},j.prototype.print_token_line_indentation=function(g){this._output.just_added_newline()&&(this._options.keep_array_indentation&&g.newlines&&(g.text==="["||L(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(g.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},j.prototype.print_token=function(g){if(this._output.raw){this._output.add_raw_token(g);return}if(this._options.comma_first&&g.previous&&g.previous.type===W.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var U=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(U),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(g),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(g),this._output.non_breaking_space=!0,this._output.add_token(g.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},j.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.set_mode=function(g){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,g),this._flags=this.create_flags(this._previous_flags,g),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Ee.Statement&&Ne(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.start_of_object_property=function(){return this._flags.parent.mode===Ee.ObjectLiteral&&this._flags.mode===Ee.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||re(this._flags.last_token,["get","set"]))},j.prototype.start_of_statement=function(g){var U=!1;return U=U||re(this._flags.last_token,["var","let","const"])&&g.type===W.WORD,U=U||D(this._flags.last_token,"do"),U=U||!(this._flags.parent.mode===Ee.ObjectLiteral&&this._flags.mode===Ee.Statement)&&re(this._flags.last_token,v)&&!g.newlines,U=U||D(this._flags.last_token,"else")&&!(D(g,"if")&&!g.comments_before),U=U||this._flags.last_token.type===W.END_EXPR&&(this._previous_flags.mode===Ee.ForInitializer||this._previous_flags.mode===Ee.Conditional),U=U||this._flags.last_token.type===W.WORD&&this._flags.mode===Ee.BlockStatement&&!this._flags.in_case&&!(g.text==="--"||g.text==="++")&&this._last_last_text!=="function"&&g.type!==W.WORD&&g.type!==W.RESERVED,U=U||this._flags.mode===Ee.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||re(this._flags.last_token,["get","set"])),U?(this.set_mode(Ee.Statement),this.indent(),this.handle_whitespace_and_comments(g,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g,re(g,["do","for","if","while"])),!0):!1},j.prototype.handle_start_expr=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g);var U=Ee.Expression;if(g.text==="["){if(this._flags.last_token.type===W.WORD||this._flags.last_token.text===")"){re(this._flags.last_token,O)&&(this._output.space_before_token=!0),this.print_token(g),this.set_mode(U),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}U=Ee.ArrayLiteral,L(this._flags.mode)&&(this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline()),I(this._flags.last_token.type,[W.START_EXPR,W.END_EXPR,W.WORD,W.OPERATOR,W.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===W.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,U=Ee.ForInitializer):I(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,U=Ee.Conditional):I(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&g.whitespace_before===""?this._output.space_before_token=!1:(I(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===W.EQUALS||this._flags.last_token.type===W.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g);else if(this._flags.last_token.type===W.WORD){this._output.space_before_token=!1;var te=this._tokens.peek(-3);if(this._options.space_after_named_function&&te){var Be=this._tokens.peek(-4);re(te,["async","function"])||te.text==="*"&&re(Be,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Ee.ObjectLiteral?(te.text==="{"||te.text===","||te.text==="*"&&(Be.text==="{"||Be.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(g);(this._flags.last_token.type===W.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===Ee.ObjectLiteral&&I(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===W.START_BLOCK?this.print_newline():(this._flags.last_token.type===W.END_EXPR||this._flags.last_token.type===W.START_EXPR||this._flags.last_token.type===W.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===W.COMMA)&&this.allow_wrap_or_preserved_newline(g,g.newlines),this.print_token(g),this.set_mode(U),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},j.prototype.handle_end_expr=function(g){for(;this._flags.mode===Ee.Statement;)this.restore_mode();this.handle_whitespace_and_comments(g),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(g,g.text==="]"&&L(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===W.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(g),this.restore_mode(),Ne(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Ee.Conditional&&(this._previous_flags.mode=Ee.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},j.prototype.handle_start_block=function(g){this.handle_whitespace_and_comments(g);var U=this._tokens.peek(),te=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===W.END_EXPR?(this.set_mode(Ee.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Ee.BlockStatement):te&&(I(te.text,[":",","])&&I(U.type,[W.STRING,W.WORD,W.RESERVED])||I(U.text,["get","set","..."])&&I(te.type,[W.WORD,W.RESERVED]))?I(this._last_last_text,["class","interface"])&&!I(te.text,[":",","])?this.set_mode(Ee.BlockStatement):this.set_mode(Ee.ObjectLiteral):this._flags.last_token.type===W.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(Ee.BlockStatement):I(this._flags.last_token.type,[W.EQUALS,W.START_EXPR,W.COMMA,W.OPERATOR])||re(this._flags.last_token,["return","throw","import","default"])?this.set_mode(Ee.ObjectLiteral):this.set_mode(Ee.BlockStatement),this._flags.last_token&&re(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var Be=!U.comments_before&&U.text==="}",Ge=Be&&this._flags.last_word==="function"&&this._flags.last_token.type===W.END_EXPR;if(this._options.brace_preserve_inline){var Qe=0,et=null;this._flags.inline_frame=!0;do if(Qe+=1,et=this._tokens.peek(Qe-1),et.newlines){this._flags.inline_frame=!1;break}while(et.type!==W.EOF&&!(et.type===W.END_BLOCK&&et.opened===g))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&g.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==W.OPERATOR&&(Ge||this._flags.last_token.type===W.EQUALS||re(this._flags.last_token,ie)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(L(this._previous_flags.mode)&&(this._flags.last_token.type===W.START_EXPR||this._flags.last_token.type===W.COMMA)&&((this._flags.last_token.type===W.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===W.COMMA||this._flags.last_token.type===W.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(g),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==W.OPERATOR&&this._flags.last_token.type!==W.START_EXPR&&(I(this._flags.last_token.type,[W.START_BLOCK,W.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(g),this.indent(),!Be&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},j.prototype.handle_end_block=function(g){for(this.handle_whitespace_and_comments(g);this._flags.mode===Ee.Statement;)this.restore_mode();var U=this._flags.last_token.type===W.START_BLOCK;this._flags.inline_frame&&!U?this._output.space_before_token=!0:this._options.brace_style==="expand"?U||this.print_newline():U||(L(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(g)},j.prototype.handle_word=function(g){if(g.type===W.RESERVED){if(I(g.text,["set","get"])&&this._flags.mode!==Ee.ObjectLiteral)g.type=W.WORD;else if(g.text==="import"&&I(this._tokens.peek().text,["(","."]))g.type=W.WORD;else if(I(g.text,["as","from"])&&!this._flags.import_block)g.type=W.WORD;else if(this._flags.mode===Ee.ObjectLiteral){var U=this._tokens.peek();U.text===":"&&(g.type=W.WORD)}}if(this.start_of_statement(g)?re(this._flags.last_token,["var","let","const"])&&g.type===W.WORD&&(this._flags.declaration_statement=!0):g.newlines&&!V(this._flags.mode)&&(this._flags.last_token.type!==W.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==W.EQUALS&&(this._options.preserve_newlines||!re(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(g),this.print_newline()):this.handle_whitespace_and_comments(g),this._flags.do_block&&!this._flags.do_while)if(D(g,"while")){this._output.space_before_token=!0,this.print_token(g),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&&D(g,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===Ee.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&re(g,["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(g),this._flags.in_case=!0;return}if((this._flags.last_token.type===W.COMMA||this._flags.last_token.type===W.START_EXPR||this._flags.last_token.type===W.EQUALS||this._flags.last_token.type===W.OPERATOR)&&!this.start_of_object_property()&&!(I(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===Ee.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(g),D(g,"function")){(I(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(I(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===W.OPERATOR))&&!this._output.just_added_blankline()&&!g.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===W.RESERVED||this._flags.last_token.type===W.WORD?re(this._flags.last_token,["get","set","new","export"])||re(this._flags.last_token,v)?this._output.space_before_token=!0:D(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===W.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(V(this._flags.mode)||L(this._flags.mode))||this.print_newline(),this.print_token(g),this._flags.last_word=g.text;return}var te="NONE";if(this._flags.last_token.type===W.END_BLOCK?this._previous_flags.inline_frame?te="SPACE":re(g,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&g.newlines?te="NEWLINE":(te="SPACE",this._output.space_before_token=!0):te="NEWLINE":this._flags.last_token.type===W.SEMICOLON&&this._flags.mode===Ee.BlockStatement?te="NEWLINE":this._flags.last_token.type===W.SEMICOLON&&V(this._flags.mode)?te="SPACE":this._flags.last_token.type===W.STRING?te="NEWLINE":this._flags.last_token.type===W.RESERVED||this._flags.last_token.type===W.WORD||this._flags.last_token.text==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===Ee.ObjectLiteral&&I(this._last_last_text,["{",","]))?te="SPACE":this._flags.last_token.type===W.START_BLOCK?this._flags.inline_frame?te="SPACE":te="NEWLINE":this._flags.last_token.type===W.END_EXPR&&(this._output.space_before_token=!0,te="NEWLINE"),re(g,O)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?te="SPACE":te="NEWLINE"),re(g,["else","catch","finally"]))if((!(this._flags.last_token.type===W.END_BLOCK&&this._previous_flags.mode===Ee.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&g.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var Be=this._output.current_line;Be.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else te==="NEWLINE"?re(this._flags.last_token,ie)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&re(g,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==W.END_EXPR?(this._flags.last_token.type!==W.START_EXPR||!re(g,["var","let","const"]))&&this._flags.last_token.text!==":"&&(D(g,"if")&&D(g.previous,"else")?this._output.space_before_token=!0:this.print_newline()):re(g,O)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&L(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():te==="SPACE"&&(this._output.space_before_token=!0);g.previous&&(g.previous.type===W.WORD||g.previous.type===W.RESERVED)&&(this._output.space_before_token=!0),this.print_token(g),this._flags.last_word=g.text,g.type===W.RESERVED&&(g.text==="do"?this._flags.do_block=!0:g.text==="if"?this._flags.if_block=!0:g.text==="import"?this._flags.import_block=!0:this._flags.import_block&&D(g,"from")&&(this._flags.import_block=!1))},j.prototype.handle_semicolon=function(g){this.start_of_statement(g)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(g);for(var U=this._tokens.peek();this._flags.mode===Ee.Statement&&!(this._flags.if_block&&D(U,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(g)},j.prototype.handle_string=function(g){g.text.startsWith("`")&&g.newlines===0&&g.whitespace_before===""&&(g.previous.text===")"||this._flags.last_token.type===W.WORD)||(this.start_of_statement(g)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(g),this._flags.last_token.type===W.RESERVED||this._flags.last_token.type===W.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===W.COMMA||this._flags.last_token.type===W.START_EXPR||this._flags.last_token.type===W.EQUALS||this._flags.last_token.type===W.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(g):g.text.startsWith("`")&&this._flags.last_token.type===W.END_EXPR&&(g.previous.text==="]"||g.previous.text===")")&&g.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(g)},j.prototype.handle_equals=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(g),this._output.space_before_token=!0},j.prototype.handle_comma=function(g){this.handle_whitespace_and_comments(g,!0),this.print_token(g),this._output.space_before_token=!0,this._flags.declaration_statement?(V(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(g)):this._flags.mode===Ee.ObjectLiteral||this._flags.mode===Ee.Statement&&this._flags.parent.mode===Ee.ObjectLiteral?(this._flags.mode===Ee.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(g)},j.prototype.handle_operator=function(g){var U=g.text==="*"&&(re(this._flags.last_token,["function","yield"])||I(this._flags.last_token.type,[W.START_BLOCK,W.COMMA,W.END_BLOCK,W.SEMICOLON])),te=I(g.text,["-","+"])&&(I(this._flags.last_token.type,[W.START_BLOCK,W.START_EXPR,W.EQUALS,W.OPERATOR])||I(this._flags.last_token.text,O)||this._flags.last_token.text===",");if(!this.start_of_statement(g)){var Be=!U;this.handle_whitespace_and_comments(g,Be)}if(g.text==="*"&&this._flags.last_token.type===W.DOT){this.print_token(g);return}if(g.text==="::"){this.print_token(g);return}if(I(g.text,["-","+"])&&this.start_of_object_property()){this.print_token(g);return}if(this._flags.last_token.type===W.OPERATOR&&I(this._options.operator_position,ge)&&this.allow_wrap_or_preserved_newline(g),g.text===":"&&this._flags.in_case){this.print_token(g),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==W.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 Ge=!0,Qe=!0,et=!1;if(g.text===":"?this._flags.ternary_depth===0?Ge=!1:(this._flags.ternary_depth-=1,et=!0):g.text==="?"&&(this._flags.ternary_depth+=1),!te&&!U&&this._options.preserve_newlines&&I(g.text,G)){var gt=g.text===":",vt=gt&&et,we=gt&&!et;switch(this._options.operator_position){case ue.before_newline:this._output.space_before_token=!we,this.print_token(g),(!gt||vt)&&this.allow_wrap_or_preserved_newline(g),this._output.space_before_token=!0;return;case ue.after_newline:this._output.space_before_token=!0,!gt||vt?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(g):this._output.space_before_token=!1,this.print_token(g),this._output.space_before_token=!0;return;case ue.preserve_newline:we||this.allow_wrap_or_preserved_newline(g),Ge=!(this._output.just_added_newline()||we),this._output.space_before_token=Ge,this.print_token(g),this._output.space_before_token=!0;return}}if(U){this.allow_wrap_or_preserved_newline(g),Ge=!1;var _t=this._tokens.peek();Qe=_t&&I(_t.type,[W.WORD,W.RESERVED])}else if(g.text==="...")this.allow_wrap_or_preserved_newline(g),Ge=this._flags.last_token.type===W.START_BLOCK,Qe=!1;else if(I(g.text,["--","++","!","~"])||te){if((this._flags.last_token.type===W.COMMA||this._flags.last_token.type===W.START_EXPR)&&this.allow_wrap_or_preserved_newline(g),Ge=!1,Qe=!1,g.newlines&&(g.text==="--"||g.text==="++"||g.text==="~")){var ot=re(this._flags.last_token,ie)&&g.newlines;ot&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(ot,!0)}this._flags.last_token.text===";"&&V(this._flags.mode)&&(Ge=!0),this._flags.last_token.type===W.RESERVED?Ge=!0:this._flags.last_token.type===W.END_EXPR?Ge=!(this._flags.last_token.text==="]"&&(g.text==="--"||g.text==="++")):this._flags.last_token.type===W.OPERATOR&&(Ge=I(g.text,["--","-","++","+"])&&I(this._flags.last_token.text,["--","-","++","+"]),I(g.text,["+","-"])&&I(this._flags.last_token.text,["--","++"])&&(Qe=!0)),(this._flags.mode===Ee.BlockStatement&&!this._flags.inline_frame||this._flags.mode===Ee.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Ge,this.print_token(g),this._output.space_before_token=Qe},j.prototype.handle_block_comment=function(g,U){if(this._output.raw){this._output.add_raw_token(g),g.directives&&g.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(g.directives){this.print_newline(!1,U),this.print_token(g),g.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!m.newline.test(g.text)&&!g.newlines){this._output.space_before_token=!0,this.print_token(g),this._output.space_before_token=!0;return}else this.print_block_commment(g,U)},j.prototype.print_block_commment=function(g,U){var te=Y(g.text),Be,Ge=!1,Qe=!1,et=g.whitespace_before,gt=et.length;if(this.print_newline(!1,U),this.print_token_line_indentation(g),this._output.add_token(te[0]),this.print_newline(!1,U),te.length>1){for(te=te.slice(1),Ge=H(te,"*"),Qe=ee(te,et),Ge&&(this._flags.alignment=1),Be=0;Be<te.length;Be++)Ge?(this.print_token_line_indentation(g),this._output.add_token(M(te[Be]))):Qe&&te[Be]?(this.print_token_line_indentation(g),this._output.add_token(te[Be].substring(gt))):(this._output.current_line.set_indent(-1),this._output.add_token(te[Be])),this.print_newline(!1,U);this._flags.alignment=0}},j.prototype.handle_comment=function(g,U){g.newlines?this.print_newline(!1,U):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(g),this.print_newline(!1,U)},j.prototype.handle_dot=function(g){this.start_of_statement(g)||this.handle_whitespace_and_comments(g,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),re(this._flags.last_token,ie)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(g,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(g)},j.prototype.handle_unknown=function(g,U){this.print_token(g),g.text[g.text.length-1]===`
`&&this.print_newline(!1,U)},j.prototype.handle_eof=function(g){for(;this._flags.mode===Ee.Statement;)this.restore_mode();this.handle_whitespace_and_comments(g)},oe.exports.Beautifier=j},function(oe){function o(h){this.__parent=h,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=[]}o.prototype.clone_empty=function(){var h=new o(this.__parent);return h.set_indent(this.__indent_count,this.__alignment_count),h},o.prototype.item=function(h){return h<0?this.__items[this.__items.length+h]:this.__items[h]},o.prototype.has_match=function(h){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(h))return!0;return!1},o.prototype.set_indent=function(h,m){this.is_empty()&&(this.__indent_count=h||0,this.__alignment_count=m||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},o.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)},o.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},o.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var h=this.__parent.current_line;return h.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),h.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),h.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,h.__items[0]===" "&&(h.__items.splice(0,1),h.__character_count-=1),!0}return!1},o.prototype.is_empty=function(){return this.__items.length===0},o.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},o.prototype.push=function(h){this.__items.push(h);var m=h.lastIndexOf(`
`);m!==-1?this.__character_count=h.length-m:this.__character_count+=h.length},o.prototype.pop=function(){var h=null;return this.is_empty()||(h=this.__items.pop(),this.__character_count-=h.length),h},o.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},o.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},o.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},o.prototype.toString=function(){var h="";return this.is_empty()?this.__parent.indent_empty_lines&&(h=this.__parent.get_indent_string(this.__indent_count)):(h=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),h+=this.__items.join("")),h};function x(h,m){this.__cache=[""],this.__indent_size=h.indent_size,this.__indent_string=h.indent_char,h.indent_with_tabs||(this.__indent_string=new Array(h.indent_size+1).join(h.indent_char)),m=m||"",h.indent_level>0&&(m=new Array(h.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}x.prototype.get_indent_size=function(h,m){var y=this.__base_string_length;return m=m||0,h<0&&(y=0),y+=h*this.__indent_size,y+=m,y},x.prototype.get_indent_string=function(h,m){var y=this.__base_string;return m=m||0,h<0&&(h=0,y=""),m+=h*this.__indent_size,this.__ensure_cache(m),y+=this.__cache[m],y},x.prototype.__ensure_cache=function(h){for(;h>=this.__cache.length;)this.__add_column()},x.prototype.__add_column=function(){var h=this.__cache.length,m=0,y="";this.__indent_size&&h>=this.__indent_size&&(m=Math.floor(h/this.__indent_size),h-=m*this.__indent_size,y=new Array(m+1).join(this.__indent_string)),h&&(y+=new Array(h+1).join(" ")),this.__cache.push(y)};function A(h,m){this.__indent_cache=new x(h,m),this.raw=!1,this._end_with_newline=h.end_with_newline,this.indent_size=h.indent_size,this.wrap_line_length=h.wrap_line_length,this.indent_empty_lines=h.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new o(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}A.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},A.prototype.get_line_number=function(){return this.__lines.length},A.prototype.get_indent_string=function(h,m){return this.__indent_cache.get_indent_string(h,m)},A.prototype.get_indent_size=function(h,m){return this.__indent_cache.get_indent_size(h,m)},A.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},A.prototype.add_new_line=function(h){return this.is_empty()||!h&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},A.prototype.get_code=function(h){this.trim(!0);var m=this.current_line.pop();m&&(m[m.length-1]===`
`&&(m=m.replace(/\n+$/g,"")),this.current_line.push(m)),this._end_with_newline&&this.__add_outputline();var y=this.__lines.join(`
`);return h!==`
`&&(y=y.replace(/[\n]/g,h)),y},A.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},A.prototype.set_indent=function(h,m){return h=h||0,m=m||0,this.next_line.set_indent(h,m),this.__lines.length>1?(this.current_line.set_indent(h,m),!0):(this.current_line.set_indent(),!1)},A.prototype.add_raw_token=function(h){for(var m=0;m<h.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(h.whitespace_before),this.current_line.push(h.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},A.prototype.add_token=function(h){this.__add_space_before_token(),this.current_line.push(h),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},A.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},A.prototype.remove_indent=function(h){for(var m=this.__lines.length;h<m;)this.__lines[h]._remove_indent(),h++;this.current_line._remove_wrap_indent()},A.prototype.trim=function(h){for(h=h===void 0?!1:h,this.current_line.trim();h&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},A.prototype.just_added_newline=function(){return this.current_line.is_empty()},A.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},A.prototype.ensure_empty_line_above=function(h,m){for(var y=this.__lines.length-2;y>=0;){var S=this.__lines[y];if(S.is_empty())break;if(S.item(0).indexOf(h)!==0&&S.item(-1)!==m){this.__lines.splice(y+1,0,new o(this)),this.previous_line=this.__lines[this.__lines.length-2];break}y--}},oe.exports.Output=A},function(oe){function o(x,A,h,m){this.type=x,this.text=A,this.comments_before=null,this.newlines=h||0,this.whitespace_before=m||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}oe.exports.Token=o},function(oe,o){var x="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",A="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",h="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",m="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",y="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",S="(?:"+y+"|["+x+h+"])",O="(?:"+y+"|["+A+h+m+"])*";o.identifier=new RegExp(S+O,"g"),o.identifierStart=new RegExp(S),o.identifierMatch=new RegExp("(?:"+y+"|["+A+h+m+"])+");var G=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;o.newline=/[\n\r\u2028\u2029]/,o.lineBreak=new RegExp(`\r
|`+o.newline.source),o.allLineBreaks=new RegExp(o.lineBreak.source,"g")},function(oe,o,x){var A=x(6).Options,h=["before-newline","after-newline","preserve-newline"];function m(y){A.call(this,y,"js");var S=this.raw_options.brace_style||null;S==="expand-strict"?this.raw_options.brace_style="expand":S==="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 G=0;G<O.length;G++)O[G]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=O[G];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",h),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}m.prototype=new A,oe.exports.Options=m},function(oe){function o(h,m){this.raw_options=x(h,m),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}o.prototype._get_array=function(h,m){var y=this.raw_options[h],S=m||[];return typeof y=="object"?y!==null&&typeof y.concat=="function"&&(S=y.concat()):typeof y=="string"&&(S=y.split(/[^a-zA-Z0-9_\/\-]+/)),S},o.prototype._get_boolean=function(h,m){var y=this.raw_options[h],S=y===void 0?!!m:!!y;return S},o.prototype._get_characters=function(h,m){var y=this.raw_options[h],S=m||"";return typeof y=="string"&&(S=y.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),S},o.prototype._get_number=function(h,m){var y=this.raw_options[h];m=parseInt(m,10),isNaN(m)&&(m=0);var S=parseInt(y,10);return isNaN(S)&&(S=m),S},o.prototype._get_selection=function(h,m,y){var S=this._get_selection_list(h,m,y);if(S.length!==1)throw new Error("Invalid Option Value: The option '"+h+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[h]+"'");return S[0]},o.prototype._get_selection_list=function(h,m,y){if(!m||m.length===0)throw new Error("Selection list cannot be empty.");if(y=y||[m[0]],!this._is_valid_selection(y,m))throw new Error("Invalid Default Value!");var S=this._get_array(h,y);if(!this._is_valid_selection(S,m))throw new Error("Invalid Option Value: The option '"+h+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[h]+"'");return S},o.prototype._is_valid_selection=function(h,m){return h.length&&m.length&&!h.some(function(y){return m.indexOf(y)===-1})};function x(h,m){var y={};h=A(h);var S;for(S in h)S!==m&&(y[S]=h[S]);if(m&&h[m])for(S in h[m])y[S]=h[m][S];return y}function A(h){var m={},y;for(y in h){var S=y.replace(/-/g,"_");m[S]=h[y]}return m}oe.exports.Options=o,oe.exports.normalizeOpts=A,oe.exports.mergeOpts=x},function(oe,o,x){var A=x(8).InputScanner,h=x(9).Tokenizer,m=x(9).TOKEN,y=x(13).Directives,S=x(4),O=x(12).Pattern,G=x(14).TemplatablePattern;function W(H,ee){return ee.indexOf(H)!==-1}var I={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:m.START,RAW:m.RAW,EOF:m.EOF},M=new y(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,D=/[0-9]/,re=/[^\d\.]/,ie=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),J=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";J=J.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),J="\\?\\.(?!\\d) "+J,J=J.replace(/ /g,"|");var ue=new RegExp(J),ge="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),Ee=ge.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),Ne=new RegExp("^(?:"+Ee.join("|")+")$"),Y,L=function(H,ee){h.call(this,H,ee),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var j=new O(this._input),v=new G(this._input).read_options(this._options);this.__patterns={template:v,identifier:v.starting_with(S.identifier).matching(S.identifierMatch),number:j.matching(w),punct:j.matching(ue),comment:j.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:j.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:j.matching(/<!--/),html_comment_end:j.matching(/-->/),include:j.starting_with(/#include/).until_after(S.lineBreak),shebang:j.starting_with(/#!/).until_after(S.lineBreak),xml:j.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:v.until(/['\\\n\r\u2028\u2029]/),double_quote:v.until(/["\\\n\r\u2028\u2029]/),template_text:v.until(/[`\\$]/),template_expression:v.until(/[`}\\]/)}};L.prototype=new h,L.prototype._is_comment=function(H){return H.type===I.COMMENT||H.type===I.BLOCK_COMMENT||H.type===I.UNKNOWN},L.prototype._is_opening=function(H){return H.type===I.START_BLOCK||H.type===I.START_EXPR},L.prototype._is_closing=function(H,ee){return(H.type===I.END_BLOCK||H.type===I.END_EXPR)&&ee&&(H.text==="]"&&ee.text==="["||H.text===")"&&ee.text==="("||H.text==="}"&&ee.text==="{")},L.prototype._reset=function(){Y=!1},L.prototype._get_next_token=function(H,ee){var j=null;this._readWhitespace();var v=this._input.peek();return v===null?this._create_token(I.EOF,""):(j=j||this._read_non_javascript(v),j=j||this._read_string(v),j=j||this._read_pair(v,this._input.peek(1)),j=j||this._read_word(H),j=j||this._read_singles(v),j=j||this._read_comment(v),j=j||this._read_regexp(v,H),j=j||this._read_xml(v,H),j=j||this._read_punctuation(),j=j||this._create_token(I.UNKNOWN,this._input.next()),j)},L.prototype._read_word=function(H){var ee;if(ee=this.__patterns.identifier.read(),ee!=="")return ee=ee.replace(S.allLineBreaks,`
`),!(H.type===I.DOT||H.type===I.RESERVED&&(H.text==="set"||H.text==="get"))&&Ne.test(ee)?(ee==="in"||ee==="of")&&(H.type===I.WORD||H.type===I.STRING)?this._create_token(I.OPERATOR,ee):this._create_token(I.RESERVED,ee):this._create_token(I.WORD,ee);if(ee=this.__patterns.number.read(),ee!=="")return this._create_token(I.WORD,ee)},L.prototype._read_singles=function(H){var ee=null;return H==="("||H==="["?ee=this._create_token(I.START_EXPR,H):H===")"||H==="]"?ee=this._create_token(I.END_EXPR,H):H==="{"?ee=this._create_token(I.START_BLOCK,H):H==="}"?ee=this._create_token(I.END_BLOCK,H):H===";"?ee=this._create_token(I.SEMICOLON,H):H==="."&&re.test(this._input.peek(1))?ee=this._create_token(I.DOT,H):H===","&&(ee=this._create_token(I.COMMA,H)),ee&&this._input.next(),ee},L.prototype._read_pair=function(H,ee){var j=null;return H==="#"&&ee==="{"&&(j=this._create_token(I.START_BLOCK,H+ee)),j&&(this._input.next(),this._input.next()),j},L.prototype._read_punctuation=function(){var H=this.__patterns.punct.read();if(H!=="")return H==="="?this._create_token(I.EQUALS,H):H==="?."?this._create_token(I.DOT,H):this._create_token(I.OPERATOR,H)},L.prototype._read_non_javascript=function(H){var ee="";if(H==="#"){if(this._is_first_token()&&(ee=this.__patterns.shebang.read(),ee))return this._create_token(I.UNKNOWN,ee.trim()+`
`);if(ee=this.__patterns.include.read(),ee)return this._create_token(I.UNKNOWN,ee.trim()+`
`);H=this._input.next();var j="#";if(this._input.hasNext()&&this._input.testChar(D)){do H=this._input.next(),j+=H;while(this._input.hasNext()&&H!=="#"&&H!=="=");return H==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(j+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(j+="{}",this._input.next(),this._input.next())),this._create_token(I.WORD,j)}this._input.back()}else if(H==="<"&&this._is_first_token()){if(ee=this.__patterns.html_comment_start.read(),ee){for(;this._input.hasNext()&&!this._input.testChar(S.newline);)ee+=this._input.next();return Y=!0,this._create_token(I.COMMENT,ee)}}else if(Y&&H==="-"&&(ee=this.__patterns.html_comment_end.read(),ee))return Y=!1,this._create_token(I.COMMENT,ee);return null},L.prototype._read_comment=function(H){var ee=null;if(H==="/"){var j="";if(this._input.peek(1)==="*"){j=this.__patterns.block_comment.read();var v=M.get_directives(j);v&&v.ignore==="start"&&(j+=M.readIgnored(this._input)),j=j.replace(S.allLineBreaks,`
`),ee=this._create_token(I.BLOCK_COMMENT,j),ee.directives=v}else this._input.peek(1)==="/"&&(j=this.__patterns.comment.read(),ee=this._create_token(I.COMMENT,j))}return ee},L.prototype._read_string=function(H){if(H==="`"||H==="'"||H==='"'){var ee=this._input.next();return this.has_char_escapes=!1,H==="`"?ee+=this._read_string_recursive("`",!0,"${"):ee+=this._read_string_recursive(H),this.has_char_escapes&&this._options.unescape_strings&&(ee=V(ee)),this._input.peek()===H&&(ee+=this._input.next()),ee=ee.replace(S.allLineBreaks,`
`),this._create_token(I.STRING,ee)}return null},L.prototype._allow_regexp_or_xml=function(H){return H.type===I.RESERVED&&W(H.text,["return","case","throw","else","do","typeof","yield"])||H.type===I.END_EXPR&&H.text===")"&&H.opened.previous.type===I.RESERVED&&W(H.opened.previous.text,["if","while","for"])||W(H.type,[I.COMMENT,I.START_EXPR,I.START_BLOCK,I.START,I.END_BLOCK,I.OPERATOR,I.EQUALS,I.EOF,I.SEMICOLON,I.COMMA])},L.prototype._read_regexp=function(H,ee){if(H==="/"&&this._allow_regexp_or_xml(ee)){for(var j=this._input.next(),v=!1,g=!1;this._input.hasNext()&&(v||g||this._input.peek()!==H)&&!this._input.testChar(S.newline);)j+=this._input.peek(),v?v=!1:(v=this._input.peek()==="\\",this._input.peek()==="["?g=!0:this._input.peek()==="]"&&(g=!1)),this._input.next();return this._input.peek()===H&&(j+=this._input.next(),j+=this._input.read(S.identifier)),this._create_token(I.STRING,j)}return null},L.prototype._read_xml=function(H,ee){if(this._options.e4x&&H==="<"&&this._allow_regexp_or_xml(ee)){var j="",v=this.__patterns.xml.read_match();if(v){for(var g=v[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),U=g.indexOf("{")===0,te=0;v;){var Be=!!v[1],Ge=v[2],Qe=!!v[v.length-1]||Ge.slice(0,8)==="![CDATA[";if(!Qe&&(Ge===g||U&&Ge.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(Be?--te:++te),j+=v[0],te<=0)break;v=this.__patterns.xml.read_match()}return v||(j+=this._input.match(/[\s\S]*/g)[0]),j=j.replace(S.allLineBreaks,`
`),this._create_token(I.STRING,j)}}return null};function V(H){for(var ee="",j=0,v=new A(H),g=null;v.hasNext();)if(g=v.match(/([\s]|[^\\]|\\\\)+/g),g&&(ee+=g[0]),v.peek()==="\\"){if(v.next(),v.peek()==="x")g=v.match(/x([0-9A-Fa-f]{2})/g);else if(v.peek()==="u")g=v.match(/u([0-9A-Fa-f]{4})/g),g||(g=v.match(/u\{([0-9A-Fa-f]+)\}/g));else{ee+="\\",v.hasNext()&&(ee+=v.next());continue}if(!g||(j=parseInt(g[1],16),j>126&&j<=255&&g[0].indexOf("x")===0))return H;j>=0&&j<32||j>1114111?ee+="\\"+g[0]:j===34||j===39||j===92?ee+="\\"+String.fromCharCode(j):ee+=String.fromCharCode(j)}return ee}L.prototype._read_string_recursive=function(H,ee,j){var v,g;H==="'"?g=this.__patterns.single_quote:H==='"'?g=this.__patterns.double_quote:H==="`"?g=this.__patterns.template_text:H==="}"&&(g=this.__patterns.template_expression);for(var U=g.read(),te="";this._input.hasNext();){if(te=this._input.next(),te===H||!ee&&S.newline.test(te)){this._input.back();break}else te==="\\"&&this._input.hasNext()?(v=this._input.peek(),v==="x"||v==="u"?this.has_char_escapes=!0:v==="\r"&&this._input.peek(1)===`
`&&this._input.next(),te+=this._input.next()):j&&(j==="${"&&te==="$"&&this._input.peek()==="{"&&(te+=this._input.next()),j===te&&(H==="`"?te+=this._read_string_recursive("}",ee,"`"):te+=this._read_string_recursive("`",ee,"${"),this._input.hasNext()&&(te+=this._input.next())));te+=g.read(),U+=te}return U},oe.exports.Tokenizer=L,oe.exports.TOKEN=I,oe.exports.positionable_operators=ie.slice(),oe.exports.line_starters=ge.slice()},function(oe){var o=RegExp.prototype.hasOwnProperty("sticky");function x(A){this.__input=A||"",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 A=null;return this.hasNext()&&(A=this.__input.charAt(this.__position),this.__position+=1),A},x.prototype.peek=function(A){var h=null;return A=A||0,A+=this.__position,A>=0&&A<this.__input_length&&(h=this.__input.charAt(A)),h},x.prototype.__match=function(A,h){A.lastIndex=h;var m=A.exec(this.__input);return m&&!(o&&A.sticky)&&m.index!==h&&(m=null),m},x.prototype.test=function(A,h){return h=h||0,h+=this.__position,h>=0&&h<this.__input_length?!!this.__match(A,h):!1},x.prototype.testChar=function(A,h){var m=this.peek(h);return A.lastIndex=0,m!==null&&A.test(m)},x.prototype.match=function(A){var h=this.__match(A,this.__position);return h?this.__position+=h[0].length:h=null,h},x.prototype.read=function(A,h,m){var y="",S;return A&&(S=this.match(A),S&&(y+=S[0])),h&&(S||!A)&&(y+=this.readUntil(h,m)),y},x.prototype.readUntil=function(A,h){var m="",y=this.__position;A.lastIndex=this.__position;var S=A.exec(this.__input);return S?(y=S.index,h&&(y+=S[0].length)):y=this.__input_length,m=this.__input.substring(this.__position,y),this.__position=y,m},x.prototype.readUntilAfter=function(A){return this.readUntil(A,!0)},x.prototype.get_regexp=function(A,h){var m=null,y="g";return h&&o&&(y="y"),typeof A=="string"&&A!==""?m=new RegExp(A,y):A&&(m=new RegExp(A.source,y)),m},x.prototype.get_literal_regexp=function(A){return RegExp(A.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},x.prototype.peekUntilAfter=function(A){var h=this.__position,m=this.readUntilAfter(A);return this.__position=h,m},x.prototype.lookBack=function(A){var h=this.__position-1;return h>=A.length&&this.__input.substring(h-A.length,h).toLowerCase()===A},oe.exports.InputScanner=x},function(oe,o,x){var A=x(8).InputScanner,h=x(3).Token,m=x(10).TokenStream,y=x(11).WhitespacePattern,S={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},O=function(G,W){this._input=new A(G),this._options=W||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new y(this._input)};O.prototype.tokenize=function(){this._input.restart(),this.__tokens=new m,this._reset();for(var G,W=new h(S.START,""),I=null,M=[],w=new m;W.type!==S.EOF;){for(G=this._get_next_token(W,I);this._is_comment(G);)w.add(G),G=this._get_next_token(W,I);w.isEmpty()||(G.comments_before=w,w=new m),G.parent=I,this._is_opening(G)?(M.push(I),I=G):I&&this._is_closing(G,I)&&(G.opened=I,I.closed=G,I=M.pop(),G.parent=I),G.previous=W,W.next=G,this.__tokens.add(G),W=G}return this.__tokens},O.prototype._is_first_token=function(){return this.__tokens.isEmpty()},O.prototype._reset=function(){},O.prototype._get_next_token=function(G,W){this._readWhitespace();var I=this._input.read(/.+/g);return I?this._create_token(S.RAW,I):this._create_token(S.EOF,"")},O.prototype._is_comment=function(G){return!1},O.prototype._is_opening=function(G){return!1},O.prototype._is_closing=function(G,W){return!1},O.prototype._create_token=function(G,W){var I=new h(G,W,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return I},O.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},oe.exports.Tokenizer=O,oe.exports.TOKEN=S},function(oe){function o(x){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=x}o.prototype.restart=function(){this.__position=0},o.prototype.isEmpty=function(){return this.__tokens_length===0},o.prototype.hasNext=function(){return this.__position<this.__tokens_length},o.prototype.next=function(){var x=null;return this.hasNext()&&(x=this.__tokens[this.__position],this.__position+=1),x},o.prototype.peek=function(x){var A=null;return x=x||0,x+=this.__position,x>=0&&x<this.__tokens_length&&(A=this.__tokens[x]),A},o.prototype.add=function(x){this.__parent_token&&(x.parent=this.__parent_token),this.__tokens.push(x),this.__tokens_length+=1},oe.exports.TokenStream=o},function(oe,o,x){var A=x(12).Pattern;function h(m,y){A.call(this,m,y),y?this._line_regexp=this._input.get_regexp(y._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}h.prototype=new A,h.prototype.__set_whitespace_patterns=function(m,y){m+="\\t ",y+="\\n\\r",this._match_pattern=this._input.get_regexp("["+m+y+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+y+"]")},h.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var m=this._input.read(this._match_pattern);if(m===" ")this.whitespace_before_token=" ";else if(m){var y=this.__split(this._newline_regexp,m);this.newline_count=y.length-1,this.whitespace_before_token=y[this.newline_count]}return m},h.prototype.matching=function(m,y){var S=this._create();return S.__set_whitespace_patterns(m,y),S._update(),S},h.prototype._create=function(){return new h(this._input,this)},h.prototype.__split=function(m,y){m.lastIndex=0;for(var S=0,O=[],G=m.exec(y);G;)O.push(y.substring(S,G.index)),S=G.index+G[0].length,G=m.exec(y);return S<y.length?O.push(y.substring(S,y.length)):O.push(""),O},oe.exports.WhitespacePattern=h},function(oe){function o(x,A){this._input=x,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,A&&(this._starting_pattern=this._input.get_regexp(A._starting_pattern,!0),this._match_pattern=this._input.get_regexp(A._match_pattern,!0),this._until_pattern=this._input.get_regexp(A._until_pattern),this._until_after=A._until_after)}o.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},o.prototype.read_match=function(){return this._input.match(this._match_pattern)},o.prototype.until_after=function(x){var A=this._create();return A._until_after=!0,A._until_pattern=this._input.get_regexp(x),A._update(),A},o.prototype.until=function(x){var A=this._create();return A._until_after=!1,A._until_pattern=this._input.get_regexp(x),A._update(),A},o.prototype.starting_with=function(x){var A=this._create();return A._starting_pattern=this._input.get_regexp(x,!0),A._update(),A},o.prototype.matching=function(x){var A=this._create();return A._match_pattern=this._input.get_regexp(x,!0),A._update(),A},o.prototype._create=function(){return new o(this._input,this)},o.prototype._update=function(){},oe.exports.Pattern=o},function(oe){function o(x,A){x=typeof x=="string"?x:x.source,A=typeof A=="string"?A:A.source,this.__directives_block_pattern=new RegExp(x+/ beautify( \w+[:]\w+)+ /.source+A,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(x+/\sbeautify\signore:end\s/.source+A,"g")}o.prototype.get_directives=function(x){if(!x.match(this.__directives_block_pattern))return null;var A={};this.__directive_pattern.lastIndex=0;for(var h=this.__directive_pattern.exec(x);h;)A[h[1]]=h[2],h=this.__directive_pattern.exec(x);return A},o.prototype.readIgnored=function(x){return x.readUntilAfter(this.__directives_end_ignore_pattern)},oe.exports.Directives=o},function(oe,o,x){var A=x(12).Pattern,h={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function m(y,S){A.call(this,y,S),this.__template_pattern=null,this._disabled=Object.assign({},h),this._excluded=Object.assign({},h),S&&(this.__template_pattern=this._input.get_regexp(S.__template_pattern),this._excluded=Object.assign(this._excluded,S._excluded),this._disabled=Object.assign(this._disabled,S._disabled));var O=new A(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}/)}}m.prototype=new A,m.prototype._create=function(){return new m(this._input,this)},m.prototype._update=function(){this.__set_templated_pattern()},m.prototype.disable=function(y){var S=this._create();return S._disabled[y]=!0,S._update(),S},m.prototype.read_options=function(y){var S=this._create();for(var O in h)S._disabled[O]=y.templating.indexOf(O)===-1;return S._update(),S},m.prototype.exclude=function(y){var S=this._create();return S._excluded[y]=!0,S._update(),S},m.prototype.read=function(){var y="";this._match_pattern?y=this._input.read(this._starting_pattern):y=this._input.read(this._starting_pattern,this.__template_pattern);for(var S=this._read_template();S;)this._match_pattern?S+=this._input.read(this._match_pattern):S+=this._input.readUntil(this.__template_pattern),y+=S,S=this._read_template();return this._until_after&&(y+=this._input.readUntilAfter(this._until_pattern)),y},m.prototype.__set_templated_pattern=function(){var y=[];this._disabled.php||y.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||y.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||y.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||y.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(y.push(this.__patterns.django._starting_pattern.source),y.push(this.__patterns.django_value._starting_pattern.source),y.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||y.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&y.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+y.join("|")+")")},m.prototype._read_template=function(){var y="",S=this._input.peek();if(S==="<"){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 S==="{"&&(!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},oe.exports.TemplatablePattern=m}],K={};function p(oe){var o=K[oe];if(o!==void 0)return o.exports;var x=K[oe]={exports:{}};return le[oe](x,x.exports,p),x.exports}var he=p(0);ce=he})();var Se=ce;T=[],k=function(){return{js_beautify:Se}}.apply(yt,T),k!==void 0&&(yn.exports=k)})()},32834:function(yn){(function(yt,T){yn.exports=T()})(this,function(){"use strict";function yt(Me,Te){for(var Re=0;Re<Te.length;Re++){var B=Te[Re];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(Me,B.key,B)}}function T(Me,Te,Re){return Te&&yt(Me.prototype,Te),Re&&yt(Me,Re),Me}function k(Me,Te){if(Me){if(typeof Me=="string")return ce(Me,Te);var Re=Object.prototype.toString.call(Me).slice(8,-1);if(Re==="Object"&&Me.constructor&&(Re=Me.constructor.name),Re==="Map"||Re==="Set")return Array.from(Me);if(Re==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Re))return ce(Me,Te)}}function ce(Me,Te){(Te==null||Te>Me.length)&&(Te=Me.length);for(var Re=0,B=new Array(Te);Re<Te;Re++)B[Re]=Me[Re];return B}function Se(Me,Te){var Re=typeof Symbol!="undefined"&&Me[Symbol.iterator]||Me["@@iterator"];if(Re)return(Re=Re.call(Me)).next.bind(Re);if(Array.isArray(Me)||(Re=k(Me))||Te&&Me&&typeof Me.length=="number"){Re&&(Me=Re);var B=0;return function(){return B>=Me.length?{done:!0}:{done:!1,value:Me[B++]}}}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 le={exports:{}};function K(){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(Me){le.exports.defaults=Me}le.exports={defaults:K(),getDefaults:K,changeDefaults:p};var he=/[&<>"']/,oe=/[&<>"']/g,o=/[<>"']|&(?!#?\w+;)/,x=/[<>"']|&(?!#?\w+;)/g,A={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},h=function(Te){return A[Te]};function m(Me,Te){if(Te){if(he.test(Me))return Me.replace(oe,h)}else if(o.test(Me))return Me.replace(x,h);return Me}var y=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function S(Me){return Me.replace(y,function(Te,Re){return Re=Re.toLowerCase(),Re==="colon"?":":Re.charAt(0)==="#"?Re.charAt(1)==="x"?String.fromCharCode(parseInt(Re.substring(2),16)):String.fromCharCode(+Re.substring(1)):""})}var O=/(^|[^\[])\^/g;function G(Me,Te){Me=Me.source||Me,Te=Te||"";var Re={replace:function(z,de){return de=de.source||de,de=de.replace(O,"$1"),Me=Me.replace(z,de),Re},getRegex:function(){return new RegExp(Me,Te)}};return Re}var W=/[^\w:]/g,I=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(Me,Te,Re){if(Me){var B;try{B=decodeURIComponent(S(Re)).replace(W,"").toLowerCase()}catch(z){return null}if(B.indexOf("javascript:")===0||B.indexOf("vbscript:")===0||B.indexOf("data:")===0)return null}Te&&!I.test(Re)&&(Re=J(Te,Re));try{Re=encodeURI(Re).replace(/%25/g,"%")}catch(z){return null}return Re}var w={},D=/^[^:]+:\/*[^/]*$/,re=/^([^:]+:)[\s\S]*$/,ie=/^([^:]+:\/*[^/]*)[\s\S]*$/;function J(Me,Te){w[" "+Me]||(D.test(Me)?w[" "+Me]=Me+"/":w[" "+Me]=Ne(Me,"/",!0)),Me=w[" "+Me];var Re=Me.indexOf(":")===-1;return Te.substring(0,2)==="//"?Re?Te:Me.replace(re,"$1")+Te:Te.charAt(0)==="/"?Re?Te:Me.replace(ie,"$1")+Te:Me+Te}var ue={exec:function(){}};function ge(Me){for(var Te=1,Re,B;Te<arguments.length;Te++){Re=arguments[Te];for(B in Re)Object.prototype.hasOwnProperty.call(Re,B)&&(Me[B]=Re[B])}return Me}function Ee(Me,Te){var Re=Me.replace(/\|/g,function(de,fe,pe){for(var Ve=!1,qe=fe;--qe>=0&&pe[qe]==="\\";)Ve=!Ve;return Ve?"|":" |"}),B=Re.split(/ \|/),z=0;if(B.length>Te)B.splice(Te);else for(;B.length<Te;)B.push("");for(;z<B.length;z++)B[z]=B[z].trim().replace(/\\\|/g,"|");return B}function Ne(Me,Te,Re){var B=Me.length;if(B===0)return"";for(var z=0;z<B;){var de=Me.charAt(B-z-1);if(de===Te&&!Re)z++;else if(de!==Te&&Re)z++;else break}return Me.substr(0,B-z)}function Y(Me,Te){if(Me.indexOf(Te[1])===-1)return-1;for(var Re=Me.length,B=0,z=0;z<Re;z++)if(Me[z]==="\\")z++;else if(Me[z]===Te[0])B++;else if(Me[z]===Te[1]&&(B--,B<0))return z;return-1}function L(Me){Me&&Me.sanitize&&!Me.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 V(Me,Te){if(Te<1)return"";for(var Re="";Te>1;)Te&1&&(Re+=Me),Te>>=1,Me+=Me;return Re+Me}var H={escape:m,unescape:S,edit:G,cleanUrl:M,resolveUrl:J,noopTest:ue,merge:ge,splitCells:Ee,rtrim:Ne,findClosingBracket:Y,checkSanitizeDeprecation:L,repeatString:V},ee=le.exports.defaults,j=H.rtrim,v=H.splitCells,g=H.escape,U=H.findClosingBracket;function te(Me,Te,Re){var B=Te.href,z=Te.title?g(Te.title):null,de=Me[1].replace(/\\([\[\]])/g,"$1");return Me[0].charAt(0)!=="!"?{type:"link",raw:Re,href:B,title:z,text:de}:{type:"image",raw:Re,href:B,title:z,text:g(de)}}function Be(Me,Te){var Re=Me.match(/^(\s+)(?:```)/);if(Re===null)return Te;var B=Re[1];return Te.split(`
`).map(function(z){var de=z.match(/^\s+/);if(de===null)return z;var fe=de[0];return fe.length>=B.length?z.slice(B.length):z}).join(`
`)}var Ge=function(){function Me(Re){this.options=Re||ee}var Te=Me.prototype;return Te.space=function(B){var z=this.rules.block.newline.exec(B);if(z)return z[0].length>1?{type:"space",raw:z[0]}:{raw:`
`}},Te.code=function(B){var z=this.rules.block.code.exec(B);if(z){var de=z[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:z[0],codeBlockStyle:"indented",text:this.options.pedantic?de:j(de,`
`)}}},Te.fences=function(B){var z=this.rules.block.fences.exec(B);if(z){var de=z[0],fe=Be(de,z[3]||"");return{type:"code",raw:de,lang:z[2]?z[2].trim():z[2],text:fe}}},Te.heading=function(B){var z=this.rules.block.heading.exec(B);if(z){var de=z[2].trim();if(/#$/.test(de)){var fe=j(de,"#");(this.options.pedantic||!fe||/ $/.test(fe))&&(de=fe.trim())}return{type:"heading",raw:z[0],depth:z[1].length,text:de}}},Te.nptable=function(B){var z=this.rules.block.nptable.exec(B);if(z){var de={type:"table",header:v(z[1].replace(/^ *| *\| *$/g,"")),align:z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:z[3]?z[3].replace(/\n$/,"").split(`
`):[],raw:z[0]};if(de.header.length===de.align.length){var fe=de.align.length,pe;for(pe=0;pe<fe;pe++)/^ *-+: *$/.test(de.align[pe])?de.align[pe]="right":/^ *:-+: *$/.test(de.align[pe])?de.align[pe]="center":/^ *:-+ *$/.test(de.align[pe])?de.align[pe]="left":de.align[pe]=null;for(fe=de.cells.length,pe=0;pe<fe;pe++)de.cells[pe]=v(de.cells[pe],de.header.length);return de}}},Te.hr=function(B){var z=this.rules.block.hr.exec(B);if(z)return{type:"hr",raw:z[0]}},Te.blockquote=function(B){var z=this.rules.block.blockquote.exec(B);if(z){var de=z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:z[0],text:de}}},Te.list=function(B){var z=this.rules.block.list.exec(B);if(z){var de=z[0],fe=z[2],pe=fe.length>1,Ve={type:"list",raw:de,ordered:pe,start:pe?+fe.slice(0,-1):"",loose:!1,items:[]},qe=z[0].match(this.rules.block.item),mt=!1,Pt,rn,hn,qt,sn,Rn,Zn,In,Nn,kt=qe.length;hn=this.rules.block.listItemStart.exec(qe[0]);for(var ft=0;ft<kt;ft++){if(Pt=qe[ft],de=Pt,this.options.pedantic||(Nn=Pt.match(new RegExp("\\n\\s*\\n {0,"+(hn[0].length-1)+"}\\S")),Nn&&(sn=Pt.length-Nn.index+qe.slice(ft+1).join(`
`).length,Ve.raw=Ve.raw.substring(0,Ve.raw.length-sn),Pt=Pt.substring(0,Nn.index),de=Pt,kt=ft+1)),ft!==kt-1){if(qt=this.rules.block.listItemStart.exec(qe[ft+1]),this.options.pedantic?qt[1].length>hn[1].length:qt[1].length>=hn[0].length||qt[1].length>3){qe.splice(ft,2,qe[ft]+(!this.options.pedantic&&qt[1].length<hn[0].length&&!qe[ft].match(/\n$/)?"":`
`)+qe[ft+1]),ft--,kt--;continue}else(!this.options.pedantic||this.options.smartLists?qt[2][qt[2].length-1]!==fe[fe.length-1]:pe===(qt[2].length===1))&&(sn=qe.slice(ft+1).join(`
`).length,Ve.raw=Ve.raw.substring(0,Ve.raw.length-sn),ft=kt-1);hn=qt}rn=Pt.length,Pt=Pt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~Pt.indexOf(`
`)&&(rn-=Pt.length,Pt=this.options.pedantic?Pt.replace(/^ {1,4}/gm,""):Pt.replace(new RegExp("^ {1,"+rn+"}","gm"),"")),Pt=j(Pt,`
`),ft!==kt-1&&(de=de+`
`),Rn=mt||/\n\n(?!\s*$)/.test(de),ft!==kt-1&&(mt=de.slice(-2)===`
`,Rn||(Rn=mt)),Rn&&(Ve.loose=!0),this.options.gfm&&(Zn=/^\[[ xX]\] /.test(Pt),In=void 0,Zn&&(In=Pt[1]!==" ",Pt=Pt.replace(/^\[[ xX]\] +/,""))),Ve.items.push({type:"list_item",raw:de,task:Zn,checked:In,loose:Rn,text:Pt})}return Ve}},Te.html=function(B){var z=this.rules.block.html.exec(B);if(z)return{type:this.options.sanitize?"paragraph":"html",raw:z[0],pre:!this.options.sanitizer&&(z[1]==="pre"||z[1]==="script"||z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(z[0]):g(z[0]):z[0]}},Te.def=function(B){var z=this.rules.block.def.exec(B);if(z){z[3]&&(z[3]=z[3].substring(1,z[3].length-1));var de=z[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:de,raw:z[0],href:z[2],title:z[3]}}},Te.table=function(B){var z=this.rules.block.table.exec(B);if(z){var de={type:"table",header:v(z[1].replace(/^ *| *\| *$/g,"")),align:z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:z[3]?z[3].replace(/\n$/,"").split(`
`):[]};if(de.header.length===de.align.length){de.raw=z[0];var fe=de.align.length,pe;for(pe=0;pe<fe;pe++)/^ *-+: *$/.test(de.align[pe])?de.align[pe]="right":/^ *:-+: *$/.test(de.align[pe])?de.align[pe]="center":/^ *:-+ *$/.test(de.align[pe])?de.align[pe]="left":de.align[pe]=null;for(fe=de.cells.length,pe=0;pe<fe;pe++)de.cells[pe]=v(de.cells[pe].replace(/^ *\| *| *\| *$/g,""),de.header.length);return de}}},Te.lheading=function(B){var z=this.rules.block.lheading.exec(B);if(z)return{type:"heading",raw:z[0],depth:z[2].charAt(0)==="="?1:2,text:z[1]}},Te.paragraph=function(B){var z=this.rules.block.paragraph.exec(B);if(z)return{type:"paragraph",raw:z[0],text:z[1].charAt(z[1].length-1)===`
`?z[1].slice(0,-1):z[1]}},Te.text=function(B){var z=this.rules.block.text.exec(B);if(z)return{type:"text",raw:z[0],text:z[0]}},Te.escape=function(B){var z=this.rules.inline.escape.exec(B);if(z)return{type:"escape",raw:z[0],text:g(z[1])}},Te.tag=function(B,z,de){var fe=this.rules.inline.tag.exec(B);if(fe)return!z&&/^<a /i.test(fe[0])?z=!0:z&&/^<\/a>/i.test(fe[0])&&(z=!1),!de&&/^<(pre|code|kbd|script)(\s|>)/i.test(fe[0])?de=!0:de&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(fe[0])&&(de=!1),{type:this.options.sanitize?"text":"html",raw:fe[0],inLink:z,inRawBlock:de,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):g(fe[0]):fe[0]}},Te.link=function(B){var z=this.rules.inline.link.exec(B);if(z){var de=z[2].trim();if(!this.options.pedantic&&/^</.test(de)){if(!/>$/.test(de))return;var fe=j(de.slice(0,-1),"\\");if((de.length-fe.length)%2===0)return}else{var pe=U(z[2],"()");if(pe>-1){var Ve=z[0].indexOf("!")===0?5:4,qe=Ve+z[1].length+pe;z[2]=z[2].substring(0,pe),z[0]=z[0].substring(0,qe).trim(),z[3]=""}}var mt=z[2],Pt="";if(this.options.pedantic){var rn=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(mt);rn&&(mt=rn[1],Pt=rn[3])}else Pt=z[3]?z[3].slice(1,-1):"";return mt=mt.trim(),/^</.test(mt)&&(this.options.pedantic&&!/>$/.test(de)?mt=mt.slice(1):mt=mt.slice(1,-1)),te(z,{href:mt&&mt.replace(this.rules.inline._escapes,"$1"),title:Pt&&Pt.replace(this.rules.inline._escapes,"$1")},z[0])}},Te.reflink=function(B,z){var de;if((de=this.rules.inline.reflink.exec(B))||(de=this.rules.inline.nolink.exec(B))){var fe=(de[2]||de[1]).replace(/\s+/g," ");if(fe=z[fe.toLowerCase()],!fe||!fe.href){var pe=de[0].charAt(0);return{type:"text",raw:pe,text:pe}}return te(de,fe,de[0])}},Te.emStrong=function(B,z,de){de===void 0&&(de="");var fe=this.rules.inline.emStrong.lDelim.exec(B);if(fe&&!(fe[3]&&de.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 pe=fe[1]||fe[2]||"";if(!pe||pe&&(de===""||this.rules.inline.punctuation.exec(de))){var Ve=fe[0].length-1,qe,mt,Pt=Ve,rn=0,hn=fe[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(hn.lastIndex=0,z=z.slice(-1*B.length+Ve);(fe=hn.exec(z))!=null;)if(qe=fe[1]||fe[2]||fe[3]||fe[4]||fe[5]||fe[6],!!qe){if(mt=qe.length,fe[3]||fe[4]){Pt+=mt;continue}else if((fe[5]||fe[6])&&Ve%3&&!((Ve+mt)%3)){rn+=mt;continue}if(Pt-=mt,!(Pt>0))return mt=Math.min(mt,mt+Pt+rn),Math.min(Ve,mt)%2?{type:"em",raw:B.slice(0,Ve+fe.index+mt+1),text:B.slice(1,Ve+fe.index+mt)}:{type:"strong",raw:B.slice(0,Ve+fe.index+mt+1),text:B.slice(2,Ve+fe.index+mt-1)}}}}},Te.codespan=function(B){var z=this.rules.inline.code.exec(B);if(z){var de=z[2].replace(/\n/g," "),fe=/[^ ]/.test(de),pe=/^ /.test(de)&&/ $/.test(de);return fe&&pe&&(de=de.substring(1,de.length-1)),de=g(de,!0),{type:"codespan",raw:z[0],text:de}}},Te.br=function(B){var z=this.rules.inline.br.exec(B);if(z)return{type:"br",raw:z[0]}},Te.del=function(B){var z=this.rules.inline.del.exec(B);if(z)return{type:"del",raw:z[0],text:z[2]}},Te.autolink=function(B,z){var de=this.rules.inline.autolink.exec(B);if(de){var fe,pe;return de[2]==="@"?(fe=g(this.options.mangle?z(de[1]):de[1]),pe="mailto:"+fe):(fe=g(de[1]),pe=fe),{type:"link",raw:de[0],text:fe,href:pe,tokens:[{type:"text",raw:fe,text:fe}]}}},Te.url=function(B,z){var de;if(de=this.rules.inline.url.exec(B)){var fe,pe;if(de[2]==="@")fe=g(this.options.mangle?z(de[0]):de[0]),pe="mailto:"+fe;else{var Ve;do Ve=de[0],de[0]=this.rules.inline._backpedal.exec(de[0])[0];while(Ve!==de[0]);fe=g(de[0]),de[1]==="www."?pe="http://"+fe:pe=fe}return{type:"link",raw:de[0],text:fe,href:pe,tokens:[{type:"text",raw:fe,text:fe}]}}},Te.inlineText=function(B,z,de){var fe=this.rules.inline.text.exec(B);if(fe){var pe;return z?pe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):g(fe[0]):fe[0]:pe=g(this.options.smartypants?de(fe[0]):fe[0]),{type:"text",raw:fe[0],text:pe}}},Me}(),Qe=H.noopTest,et=H.edit,gt=H.merge,vt={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:Qe,table:Qe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};vt._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,vt._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,vt.def=et(vt.def).replace("label",vt._label).replace("title",vt._title).getRegex(),vt.bullet=/(?:[*+-]|\d{1,9}[.)])/,vt.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,vt.item=et(vt.item,"gm").replace(/bull/g,vt.bullet).getRegex(),vt.listItemStart=et(/^( *)(bull) */).replace("bull",vt.bullet).getRegex(),vt.list=et(vt.list).replace(/bull/g,vt.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+vt.def.source+")").getRegex(),vt._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",vt._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,vt.html=et(vt.html,"i").replace("comment",vt._comment).replace("tag",vt._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vt.paragraph=et(vt._paragraph).replace("hr",vt.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",vt._tag).getRegex(),vt.blockquote=et(vt.blockquote).replace("paragraph",vt.paragraph).getRegex(),vt.normal=gt({},vt),vt.gfm=gt({},vt.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*|$)"}),vt.gfm.nptable=et(vt.gfm.nptable).replace("hr",vt.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",vt._tag).getRegex(),vt.gfm.table=et(vt.gfm.table).replace("hr",vt.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",vt._tag).getRegex(),vt.pedantic=gt({},vt.normal,{html:et(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",vt._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:Qe,paragraph:et(vt.normal._paragraph).replace("hr",vt.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",vt.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var we={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Qe,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:Qe,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};we._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",we.punctuation=et(we.punctuation).replace(/punctuation/g,we._punctuation).getRegex(),we.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,we.escapedEmSt=/\\\*|\\_/g,we._comment=et(vt._comment).replace("(?:-->|$)","-->").getRegex(),we.emStrong.lDelim=et(we.emStrong.lDelim).replace(/punct/g,we._punctuation).getRegex(),we.emStrong.rDelimAst=et(we.emStrong.rDelimAst,"g").replace(/punct/g,we._punctuation).getRegex(),we.emStrong.rDelimUnd=et(we.emStrong.rDelimUnd,"g").replace(/punct/g,we._punctuation).getRegex(),we._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,we._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,we._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])?)+(?![-_])/,we.autolink=et(we.autolink).replace("scheme",we._scheme).replace("email",we._email).getRegex(),we._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,we.tag=et(we.tag).replace("comment",we._comment).replace("attribute",we._attribute).getRegex(),we._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,we._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,we._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,we.link=et(we.link).replace("label",we._label).replace("href",we._href).replace("title",we._title).getRegex(),we.reflink=et(we.reflink).replace("label",we._label).getRegex(),we.reflinkSearch=et(we.reflinkSearch,"g").replace("reflink",we.reflink).replace("nolink",we.nolink).getRegex(),we.normal=gt({},we),we.pedantic=gt({},we.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:et(/^!?\[(label)\]\((.*?)\)/).replace("label",we._label).getRegex(),reflink:et(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",we._label).getRegex()}),we.gfm=gt({},we.normal,{escape:et(we.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),we.gfm.url=et(we.gfm.url,"i").replace("email",we.gfm._extended_email).getRegex(),we.breaks=gt({},we.gfm,{br:et(we.br).replace("{2,}","*").getRegex(),text:et(we.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var _t={block:vt,inline:we},ot=Ge,nt=le.exports.defaults,Tt=_t.block,Ke=_t.inline,_e=H.repeatString;function ve(Me){return Me.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 F(Me){var Te="",Re,B,z=Me.length;for(Re=0;Re<z;Re++)B=Me.charCodeAt(Re),Math.random()>.5&&(B="x"+B.toString(16)),Te+="&#"+B+";";return Te}var xe=function(){function Me(Re){this.tokens=[],this.tokens.links=Object.create(null),this.options=Re||nt,this.options.tokenizer=this.options.tokenizer||new ot,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var B={block:Tt.normal,inline:Ke.normal};this.options.pedantic?(B.block=Tt.pedantic,B.inline=Ke.pedantic):this.options.gfm&&(B.block=Tt.gfm,this.options.breaks?B.inline=Ke.breaks:B.inline=Ke.gfm),this.tokenizer.rules=B}Me.lex=function(B,z){var de=new Me(z);return de.lex(B)},Me.lexInline=function(B,z){var de=new Me(z);return de.inlineTokens(B)};var Te=Me.prototype;return Te.lex=function(B){return B=B.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(B,this.tokens,!0),this.inline(this.tokens),this.tokens},Te.blockTokens=function(B,z,de){z===void 0&&(z=[]),de===void 0&&(de=!0),this.options.pedantic&&(B=B.replace(/^ +$/gm,""));for(var fe,pe,Ve,qe;B;){if(fe=this.tokenizer.space(B)){B=B.substring(fe.raw.length),fe.type&&z.push(fe);continue}if(fe=this.tokenizer.code(B)){B=B.substring(fe.raw.length),qe=z[z.length-1],qe&&qe.type==="paragraph"?(qe.raw+=`
`+fe.raw,qe.text+=`
`+fe.text):z.push(fe);continue}if(fe=this.tokenizer.fences(B)){B=B.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.heading(B)){B=B.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.nptable(B)){B=B.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.hr(B)){B=B.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.blockquote(B)){B=B.substring(fe.raw.length),fe.tokens=this.blockTokens(fe.text,[],de),z.push(fe);continue}if(fe=this.tokenizer.list(B)){for(B=B.substring(fe.raw.length),Ve=fe.items.length,pe=0;pe<Ve;pe++)fe.items[pe].tokens=this.blockTokens(fe.items[pe].text,[],!1);z.push(fe);continue}if(fe=this.tokenizer.html(B)){B=B.substring(fe.raw.length),z.push(fe);continue}if(de&&(fe=this.tokenizer.def(B))){B=B.substring(fe.raw.length),this.tokens.links[fe.tag]||(this.tokens.links[fe.tag]={href:fe.href,title:fe.title});continue}if(fe=this.tokenizer.table(B)){B=B.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.lheading(B)){B=B.substring(fe.raw.length),z.push(fe);continue}if(de&&(fe=this.tokenizer.paragraph(B))){B=B.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.text(B)){B=B.substring(fe.raw.length),qe=z[z.length-1],qe&&qe.type==="text"?(qe.raw+=`
`+fe.raw,qe.text+=`
`+fe.text):z.push(fe);continue}if(B){var mt="Infinite loop on byte: "+B.charCodeAt(0);if(this.options.silent){console.error(mt);break}else throw new Error(mt)}}return z},Te.inline=function(B){var z,de,fe,pe,Ve,qe,mt=B.length;for(z=0;z<mt;z++)switch(qe=B[z],qe.type){case"paragraph":case"text":case"heading":{qe.tokens=[],this.inlineTokens(qe.text,qe.tokens);break}case"table":{for(qe.tokens={header:[],cells:[]},pe=qe.header.length,de=0;de<pe;de++)qe.tokens.header[de]=[],this.inlineTokens(qe.header[de],qe.tokens.header[de]);for(pe=qe.cells.length,de=0;de<pe;de++)for(Ve=qe.cells[de],qe.tokens.cells[de]=[],fe=0;fe<Ve.length;fe++)qe.tokens.cells[de][fe]=[],this.inlineTokens(Ve[fe],qe.tokens.cells[de][fe]);break}case"blockquote":{this.inline(qe.tokens);break}case"list":{for(pe=qe.items.length,de=0;de<pe;de++)this.inline(qe.items[de].tokens);break}}return B},Te.inlineTokens=function(B,z,de,fe){z===void 0&&(z=[]),de===void 0&&(de=!1),fe===void 0&&(fe=!1);var pe,Ve,qe=B,mt,Pt,rn;if(this.tokens.links){var hn=Object.keys(this.tokens.links);if(hn.length>0)for(;(mt=this.tokenizer.rules.inline.reflinkSearch.exec(qe))!=null;)hn.includes(mt[0].slice(mt[0].lastIndexOf("[")+1,-1))&&(qe=qe.slice(0,mt.index)+"["+_e("a",mt[0].length-2)+"]"+qe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(mt=this.tokenizer.rules.inline.blockSkip.exec(qe))!=null;)qe=qe.slice(0,mt.index)+"["+_e("a",mt[0].length-2)+"]"+qe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(mt=this.tokenizer.rules.inline.escapedEmSt.exec(qe))!=null;)qe=qe.slice(0,mt.index)+"++"+qe.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;B;){if(Pt||(rn=""),Pt=!1,pe=this.tokenizer.escape(B)){B=B.substring(pe.raw.length),z.push(pe);continue}if(pe=this.tokenizer.tag(B,de,fe)){B=B.substring(pe.raw.length),de=pe.inLink,fe=pe.inRawBlock;var qt=z[z.length-1];qt&&pe.type==="text"&&qt.type==="text"?(qt.raw+=pe.raw,qt.text+=pe.text):z.push(pe);continue}if(pe=this.tokenizer.link(B)){B=B.substring(pe.raw.length),pe.type==="link"&&(pe.tokens=this.inlineTokens(pe.text,[],!0,fe)),z.push(pe);continue}if(pe=this.tokenizer.reflink(B,this.tokens.links)){B=B.substring(pe.raw.length);var sn=z[z.length-1];pe.type==="link"?(pe.tokens=this.inlineTokens(pe.text,[],!0,fe),z.push(pe)):sn&&pe.type==="text"&&sn.type==="text"?(sn.raw+=pe.raw,sn.text+=pe.text):z.push(pe);continue}if(pe=this.tokenizer.emStrong(B,qe,rn)){B=B.substring(pe.raw.length),pe.tokens=this.inlineTokens(pe.text,[],de,fe),z.push(pe);continue}if(pe=this.tokenizer.codespan(B)){B=B.substring(pe.raw.length),z.push(pe);continue}if(pe=this.tokenizer.br(B)){B=B.substring(pe.raw.length),z.push(pe);continue}if(pe=this.tokenizer.del(B)){B=B.substring(pe.raw.length),pe.tokens=this.inlineTokens(pe.text,[],de,fe),z.push(pe);continue}if(pe=this.tokenizer.autolink(B,F)){B=B.substring(pe.raw.length),z.push(pe);continue}if(!de&&(pe=this.tokenizer.url(B,F))){B=B.substring(pe.raw.length),z.push(pe);continue}if(pe=this.tokenizer.inlineText(B,fe,ve)){B=B.substring(pe.raw.length),pe.raw.slice(-1)!=="_"&&(rn=pe.raw.slice(-1)),Pt=!0,Ve=z[z.length-1],Ve&&Ve.type==="text"?(Ve.raw+=pe.raw,Ve.text+=pe.text):z.push(pe);continue}if(B){var Rn="Infinite loop on byte: "+B.charCodeAt(0);if(this.options.silent){console.error(Rn);break}else throw new Error(Rn)}}return z},T(Me,null,[{key:"rules",get:function(){return{block:Tt,inline:Ke}}}]),Me}(),ke=le.exports.defaults,$=H.cleanUrl,R=H.escape,ne=function(){function Me(Re){this.options=Re||ke}var Te=Me.prototype;return Te.code=function(B,z,de){var fe=(z||"").match(/\S*/)[0];if(this.options.highlight){var pe=this.options.highlight(B,fe);pe!=null&&pe!==B&&(de=!0,B=pe)}return B=B.replace(/\n$/,"")+`
`,fe?'<pre><code class="'+this.options.langPrefix+R(fe,!0)+'">'+(de?B:R(B,!0))+`</code></pre>
`:"<pre><code>"+(de?B:R(B,!0))+`</code></pre>
`},Te.blockquote=function(B){return`<blockquote>
`+B+`</blockquote>
`},Te.html=function(B){return B},Te.heading=function(B,z,de,fe){return this.options.headerIds?"<h"+z+' id="'+this.options.headerPrefix+fe.slug(de)+'">'+B+"</h"+z+`>
`:"<h"+z+">"+B+"</h"+z+`>
`},Te.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},Te.list=function(B,z,de){var fe=z?"ol":"ul",pe=z&&de!==1?' start="'+de+'"':"";return"<"+fe+pe+`>
`+B+"</"+fe+`>
`},Te.listitem=function(B){return"<li>"+B+`</li>
`},Te.checkbox=function(B){return"<input "+(B?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},Te.paragraph=function(B){return"<p>"+B+`</p>
`},Te.table=function(B,z){return z&&(z="<tbody>"+z+"</tbody>"),`<table>
<thead>
`+B+`</thead>
`+z+`</table>
`},Te.tablerow=function(B){return`<tr>
`+B+`</tr>
`},Te.tablecell=function(B,z){var de=z.header?"th":"td",fe=z.align?"<"+de+' align="'+z.align+'">':"<"+de+">";return fe+B+"</"+de+`>
`},Te.strong=function(B){return"<strong>"+B+"</strong>"},Te.em=function(B){return"<em>"+B+"</em>"},Te.codespan=function(B){return"<code>"+B+"</code>"},Te.br=function(){return this.options.xhtml?"<br/>":"<br>"},Te.del=function(B){return"<del>"+B+"</del>"},Te.link=function(B,z,de){if(B=$(this.options.sanitize,this.options.baseUrl,B),B===null)return de;var fe='<a href="'+R(B)+'"';return z&&(fe+=' title="'+z+'"'),fe+=">"+de+"</a>",fe},Te.image=function(B,z,de){if(B=$(this.options.sanitize,this.options.baseUrl,B),B===null)return de;var fe='<img src="'+B+'" alt="'+de+'"';return z&&(fe+=' title="'+z+'"'),fe+=this.options.xhtml?"/>":">",fe},Te.text=function(B){return B},Me}(),be=function(){function Me(){}var Te=Me.prototype;return Te.strong=function(B){return B},Te.em=function(B){return B},Te.codespan=function(B){return B},Te.del=function(B){return B},Te.html=function(B){return B},Te.text=function(B){return B},Te.link=function(B,z,de){return""+de},Te.image=function(B,z,de){return""+de},Te.br=function(){return""},Me}(),P=function(){function Me(){this.seen={}}var Te=Me.prototype;return Te.serialize=function(B){return B.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},Te.getNextSafeSlug=function(B,z){var de=B,fe=0;if(this.seen.hasOwnProperty(de)){fe=this.seen[B];do fe++,de=B+"-"+fe;while(this.seen.hasOwnProperty(de))}return z||(this.seen[B]=fe,this.seen[de]=0),de},Te.slug=function(B,z){z===void 0&&(z={});var de=this.serialize(B);return this.getNextSafeSlug(de,z.dryrun)},Me}(),C=ne,X=be,q=P,Q=le.exports.defaults,se=H.unescape,me=function(){function Me(Re){this.options=Re||Q,this.options.renderer=this.options.renderer||new C,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new X,this.slugger=new q}Me.parse=function(B,z){var de=new Me(z);return de.parse(B)},Me.parseInline=function(B,z){var de=new Me(z);return de.parseInline(B)};var Te=Me.prototype;return Te.parse=function(B,z){z===void 0&&(z=!0);var de="",fe,pe,Ve,qe,mt,Pt,rn,hn,qt,sn,Rn,Zn,In,Nn,kt,ft,Kt,_n,Wn=B.length;for(fe=0;fe<Wn;fe++)switch(sn=B[fe],sn.type){case"space":continue;case"hr":{de+=this.renderer.hr();continue}case"heading":{de+=this.renderer.heading(this.parseInline(sn.tokens),sn.depth,se(this.parseInline(sn.tokens,this.textRenderer)),this.slugger);continue}case"code":{de+=this.renderer.code(sn.text,sn.lang,sn.escaped);continue}case"table":{for(hn="",rn="",qe=sn.header.length,pe=0;pe<qe;pe++)rn+=this.renderer.tablecell(this.parseInline(sn.tokens.header[pe]),{header:!0,align:sn.align[pe]});for(hn+=this.renderer.tablerow(rn),qt="",qe=sn.cells.length,pe=0;pe<qe;pe++){for(Pt=sn.tokens.cells[pe],rn="",mt=Pt.length,Ve=0;Ve<mt;Ve++)rn+=this.renderer.tablecell(this.parseInline(Pt[Ve]),{header:!1,align:sn.align[Ve]});qt+=this.renderer.tablerow(rn)}de+=this.renderer.table(hn,qt);continue}case"blockquote":{qt=this.parse(sn.tokens),de+=this.renderer.blockquote(qt);continue}case"list":{for(Rn=sn.ordered,Zn=sn.start,In=sn.loose,qe=sn.items.length,qt="",pe=0;pe<qe;pe++)kt=sn.items[pe],ft=kt.checked,Kt=kt.task,Nn="",kt.task&&(_n=this.renderer.checkbox(ft),In?kt.tokens.length>0&&kt.tokens[0].type==="text"?(kt.tokens[0].text=_n+" "+kt.tokens[0].text,kt.tokens[0].tokens&&kt.tokens[0].tokens.length>0&&kt.tokens[0].tokens[0].type==="text"&&(kt.tokens[0].tokens[0].text=_n+" "+kt.tokens[0].tokens[0].text)):kt.tokens.unshift({type:"text",text:_n}):Nn+=_n),Nn+=this.parse(kt.tokens,In),qt+=this.renderer.listitem(Nn,Kt,ft);de+=this.renderer.list(qt,Rn,Zn);continue}case"html":{de+=this.renderer.html(sn.text);continue}case"paragraph":{de+=this.renderer.paragraph(this.parseInline(sn.tokens));continue}case"text":{for(qt=sn.tokens?this.parseInline(sn.tokens):sn.text;fe+1<Wn&&B[fe+1].type==="text";)sn=B[++fe],qt+=`
`+(sn.tokens?this.parseInline(sn.tokens):sn.text);de+=z?this.renderer.paragraph(qt):qt;continue}default:{var Oe='Token with "'+sn.type+'" type was not found.';if(this.options.silent){console.error(Oe);return}else throw new Error(Oe)}}return de},Te.parseInline=function(B,z){z=z||this.renderer;var de="",fe,pe,Ve=B.length;for(fe=0;fe<Ve;fe++)switch(pe=B[fe],pe.type){case"escape":{de+=z.text(pe.text);break}case"html":{de+=z.html(pe.text);break}case"link":{de+=z.link(pe.href,pe.title,this.parseInline(pe.tokens,z));break}case"image":{de+=z.image(pe.href,pe.title,pe.text);break}case"strong":{de+=z.strong(this.parseInline(pe.tokens,z));break}case"em":{de+=z.em(this.parseInline(pe.tokens,z));break}case"codespan":{de+=z.codespan(pe.text);break}case"br":{de+=z.br();break}case"del":{de+=z.del(this.parseInline(pe.tokens,z));break}case"text":{de+=z.text(pe.text);break}default:{var qe='Token with "'+pe.type+'" type was not found.';if(this.options.silent){console.error(qe);return}else throw new Error(qe)}}return de},Me}(),Ce=xe,Ie=me,De=Ge,Fe=ne,ze=be,je=P,Ue=H.merge,bt=H.checkSanitizeDeprecation,xt=H.escape,it=le.exports.getDefaults,Ft=le.exports.changeDefaults,Yt=le.exports.defaults;function at(Me,Te,Re){if(typeof Me=="undefined"||Me===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Me!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Me)+", string expected");if(typeof Te=="function"&&(Re=Te,Te=null),Te=Ue({},at.defaults,Te||{}),bt(Te),Re){var B=Te.highlight,z;try{z=Ce.lex(Me,Te)}catch(Ve){return Re(Ve)}var de=function(qe){var mt;if(!qe)try{Te.walkTokens&&at.walkTokens(z,Te.walkTokens),mt=Ie.parse(z,Te)}catch(Pt){qe=Pt}return Te.highlight=B,qe?Re(qe):Re(null,mt)};if(!B||B.length<3||(delete Te.highlight,!z.length))return de();var fe=0;at.walkTokens(z,function(Ve){Ve.type==="code"&&(fe++,setTimeout(function(){B(Ve.text,Ve.lang,function(qe,mt){if(qe)return de(qe);mt!=null&&mt!==Ve.text&&(Ve.text=mt,Ve.escaped=!0),fe--,fe===0&&de()})},0))}),fe===0&&de();return}try{var pe=Ce.lex(Me,Te);return Te.walkTokens&&at.walkTokens(pe,Te.walkTokens),Ie.parse(pe,Te)}catch(Ve){if(Ve.message+=`
Please report this to https://github.com/markedjs/marked.`,Te.silent)return"<p>An error occurred:</p><pre>"+xt(Ve.message+"",!0)+"</pre>";throw Ve}}at.options=at.setOptions=function(Me){return Ue(at.defaults,Me),Ft(at.defaults),at},at.getDefaults=it,at.defaults=Yt,at.use=function(Me){var Te=Ue({},Me);if(Me.renderer&&function(){var B=at.defaults.renderer||new Fe,z=function(pe){var Ve=B[pe];B[pe]=function(){for(var qe=arguments.length,mt=new Array(qe),Pt=0;Pt<qe;Pt++)mt[Pt]=arguments[Pt];var rn=Me.renderer[pe].apply(B,mt);return rn===!1&&(rn=Ve.apply(B,mt)),rn}};for(var de in Me.renderer)z(de);Te.renderer=B}(),Me.tokenizer&&function(){var B=at.defaults.tokenizer||new De,z=function(pe){var Ve=B[pe];B[pe]=function(){for(var qe=arguments.length,mt=new Array(qe),Pt=0;Pt<qe;Pt++)mt[Pt]=arguments[Pt];var rn=Me.tokenizer[pe].apply(B,mt);return rn===!1&&(rn=Ve.apply(B,mt)),rn}};for(var de in Me.tokenizer)z(de);Te.tokenizer=B}(),Me.walkTokens){var Re=at.defaults.walkTokens;Te.walkTokens=function(B){Me.walkTokens(B),Re&&Re(B)}}at.setOptions(Te)},at.walkTokens=function(Me,Te){for(var Re=Se(Me),B;!(B=Re()).done;){var z=B.value;switch(Te(z),z.type){case"table":{for(var de=Se(z.tokens.header),fe;!(fe=de()).done;){var pe=fe.value;at.walkTokens(pe,Te)}for(var Ve=Se(z.tokens.cells),qe;!(qe=Ve()).done;)for(var mt=qe.value,Pt=Se(mt),rn;!(rn=Pt()).done;){var hn=rn.value;at.walkTokens(hn,Te)}break}case"list":{at.walkTokens(z.items,Te);break}default:z.tokens&&at.walkTokens(z.tokens,Te)}}},at.parseInline=function(Me,Te){if(typeof Me=="undefined"||Me===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof Me!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(Me)+", string expected");Te=Ue({},at.defaults,Te||{}),bt(Te);try{var Re=Ce.lexInline(Me,Te);return Te.walkTokens&&at.walkTokens(Re,Te.walkTokens),Ie.parseInline(Re,Te)}catch(B){if(B.message+=`
Please report this to https://github.com/markedjs/marked.`,Te.silent)return"<p>An error occurred:</p><pre>"+xt(B.message+"",!0)+"</pre>";throw B}},at.Parser=Ie,at.parser=Ie.parse,at.Renderer=Fe,at.TextRenderer=ze,at.Lexer=Ce,at.lexer=Ce.lex,at.Tokenizer=De,at.Slugger=je,at.parse=at;var Ut=at;return Ut})},11690:function(yn){const yt=/[&<>"']/,T=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,ce=/[<>"']|&(?!#?\w+;)/g,Se={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},le=J=>Se[J];function K(J,ue){if(ue){if(yt.test(J))return J.replace(T,le)}else if(k.test(J))return J.replace(ce,le);return J}const p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function he(J){return J.replace(p,(ue,ge)=>(ge=ge.toLowerCase(),ge==="colon"?":":ge.charAt(0)==="#"?ge.charAt(1)==="x"?String.fromCharCode(parseInt(ge.substring(2),16)):String.fromCharCode(+ge.substring(1)):""))}const oe=/(^|[^\[])\^/g;function o(J,ue){J=J.source||J,ue=ue||"";const ge={replace:(Ee,Ne)=>(Ne=Ne.source||Ne,Ne=Ne.replace(oe,"$1"),J=J.replace(Ee,Ne),ge),getRegex:()=>new RegExp(J,ue)};return ge}const x=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function h(J,ue,ge){if(J){let Ee;try{Ee=decodeURIComponent(he(ge)).replace(x,"").toLowerCase()}catch(Ne){return null}if(Ee.indexOf("javascript:")===0||Ee.indexOf("vbscript:")===0||Ee.indexOf("data:")===0)return null}ue&&!A.test(ge)&&(ge=G(ue,ge));try{ge=encodeURI(ge).replace(/%25/g,"%")}catch(Ee){return null}return ge}const m={},y=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,O=/^([^:]+:\/*[^/]*)[\s\S]*$/;function G(J,ue){m[" "+J]||(y.test(J)?m[" "+J]=J+"/":m[" "+J]=w(J,"/",!0)),J=m[" "+J];const ge=J.indexOf(":")===-1;return ue.substring(0,2)==="//"?ge?ue:J.replace(S,"$1")+ue:ue.charAt(0)==="/"?ge?ue:J.replace(O,"$1")+ue:J+ue}const W={exec:function(){}};function I(J){let ue=1,ge,Ee;for(;ue<arguments.length;ue++){ge=arguments[ue];for(Ee in ge)Object.prototype.hasOwnProperty.call(ge,Ee)&&(J[Ee]=ge[Ee])}return J}function M(J,ue){const ge=J.replace(/\|/g,(Y,L,V)=>{let H=!1,ee=L;for(;--ee>=0&&V[ee]==="\\";)H=!H;return H?"|":" |"}),Ee=ge.split(/ \|/);let Ne=0;if(Ee.length>ue)Ee.splice(ue);else for(;Ee.length<ue;)Ee.push("");for(;Ne<Ee.length;Ne++)Ee[Ne]=Ee[Ne].trim().replace(/\\\|/g,"|");return Ee}function w(J,ue,ge){const Ee=J.length;if(Ee===0)return"";let Ne=0;for(;Ne<Ee;){const Y=J.charAt(Ee-Ne-1);if(Y===ue&&!ge)Ne++;else if(Y!==ue&&ge)Ne++;else break}return J.substr(0,Ee-Ne)}function D(J,ue){if(J.indexOf(ue[1])===-1)return-1;const ge=J.length;let Ee=0,Ne=0;for(;Ne<ge;Ne++)if(J[Ne]==="\\")Ne++;else if(J[Ne]===ue[0])Ee++;else if(J[Ne]===ue[1]&&(Ee--,Ee<0))return Ne;return-1}function re(J){J&&J.sanitize&&!J.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(J,ue){if(ue<1)return"";let ge="";for(;ue>1;)ue&1&&(ge+=J),ue>>=1,J+=J;return ge+J}yn.exports={escape:K,unescape:he,edit:o,cleanUrl:h,resolveUrl:G,noopTest:W,merge:I,splitCells:M,rtrim:w,findClosingBracket:D,checkSanitizeDeprecation:re,repeatString:ie}},75918:function(yn,yt,T){"use strict";T.d(yt,{Wi:function(){return p},Z0:function(){return he},aU:function(){return K},eZ:function(){return o},wY:function(){return oe}});var k=T(4348),ce=T(69323),Se=T(13268),le=function(x,A,h,m){function y(S){return S instanceof h?S:new h(function(O){O(S)})}return new(h||(h=Promise))(function(S,O){function G(M){try{I(m.next(M))}catch(w){O(w)}}function W(M){try{I(m.throw(M))}catch(w){O(w)}}function I(M){M.done?S(M.value):y(M.value).then(G,W)}I((m=m.apply(x,A||[])).next())})};class K extends ce.JT{constructor(A,h="",m="",y=!0,S){super(),this._onDidChange=this._register(new k.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=A,this._label=h,this._cssClass=m,this._enabled=y,this._actionCallback=S}get id(){return this._id}get label(){return this._label}set label(A){this._setLabel(A)}_setLabel(A){this._label!==A&&(this._label=A,this._onDidChange.fire({label:A}))}get tooltip(){return this._tooltip||""}set tooltip(A){this._setTooltip(A)}_setTooltip(A){this._tooltip!==A&&(this._tooltip=A,this._onDidChange.fire({tooltip:A}))}get class(){return this._cssClass}set class(A){this._setClass(A)}_setClass(A){this._cssClass!==A&&(this._cssClass=A,this._onDidChange.fire({class:A}))}get enabled(){return this._enabled}set enabled(A){this._setEnabled(A)}_setEnabled(A){this._enabled!==A&&(this._enabled=A,this._onDidChange.fire({enabled:A}))}get checked(){return this._checked}set checked(A){this._setChecked(A)}_setChecked(A){this._checked!==A&&(this._checked=A,this._onDidChange.fire({checked:A}))}run(A,h){return le(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(A))})}}class p extends ce.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new k.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new k.Q5),this.onDidRun=this._onDidRun.event}run(A,h){return le(this,void 0,void 0,function*(){if(!A.enabled)return;this._onBeforeRun.fire({action:A});let m;try{yield this.runAction(A,h)}catch(y){m=y}this._onDidRun.fire({action:A,error:m})})}runAction(A,h){return le(this,void 0,void 0,function*(){yield A.run(h)})}}class he extends K{constructor(A){super(he.ID,A,A?"separator text":"separator"),this.checked=!1,this.enabled=!1}}he.ID="vs.actions.separator";class oe{constructor(A,h,m,y){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=A,this.label=h,this.class=y,this._actions=m}get actions(){return this._actions}dispose(){}run(){return le(this,void 0,void 0,function*(){})}}class o extends K{constructor(){super(o.ID,Se.N("submenu.empty","(empty)"),void 0,!1)}}o.ID="vs.actions.empty"},76068:function(yn,yt,T){"use strict";T.d(yt,{ok:function(){return k}});function k(ce,Se){if(!ce)throw new Error(Se?`Assertion failed (${Se})`:"Assertion Failed")}},52615:function(yn,yt,T){"use strict";T.d(yt,{CM:function(){return K},JL:function(){return p},dT:function(){return oe},fK:function(){return le},lA:function(){return he}});var k=T(4348);class ce{constructor(){this._icons=new Map,this._onDidRegister=new k.Q5}add(x){const A=this._icons.get(x.id);A?x.description?A.description=x.description:console.error(`Duplicate registration of codicon ${x.id}`):(this._icons.set(x.id,x),this._onDidRegister.fire(x))}get(x){return this._icons.get(x)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Se=new ce,le=Se;function K(o,x){return new he(o,x)}function p(o){return o?o.replace(/\$\((.*?)\)/g,(x,A)=>` ${A} `).trim():""}class he{constructor(x,A,h){this.id=x,this.definition=A,this.description=h,Se.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var oe;(function(o){o.iconNameSegment="[A-Za-z0-9]+",o.iconNameExpression="[A-Za-z0-9\\-]+",o.iconModifierExpression="~[A-Za-z]+";const x=new RegExp(`^(${o.iconNameExpression})(${o.iconModifierExpression})?$`);function A(y){if(y instanceof he)return["codicon","codicon-"+y.id];const S=x.exec(y.id);if(!S)return A(he.error);let[,O,G]=S;const W=["codicon","codicon-"+O];return G&&W.push("codicon-modifier-"+G.substr(1)),W}o.asClassNameArray=A;function h(y){return A(y).join(" ")}o.asClassName=h;function m(y){return"."+A(y).join(".")}o.asCSSSelector=m})(oe||(oe={})),function(o){o.add=new o("add",{fontCharacter:"\\ea60"}),o.plus=new o("plus",o.add.definition),o.gistNew=new o("gist-new",o.add.definition),o.repoCreate=new o("repo-create",o.add.definition),o.lightbulb=new o("lightbulb",{fontCharacter:"\\ea61"}),o.lightBulb=new o("light-bulb",{fontCharacter:"\\ea61"}),o.repo=new o("repo",{fontCharacter:"\\ea62"}),o.repoDelete=new o("repo-delete",{fontCharacter:"\\ea62"}),o.gistFork=new o("gist-fork",{fontCharacter:"\\ea63"}),o.repoForked=new o("repo-forked",{fontCharacter:"\\ea63"}),o.gitPullRequest=new o("git-pull-request",{fontCharacter:"\\ea64"}),o.gitPullRequestAbandoned=new o("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),o.recordKeys=new o("record-keys",{fontCharacter:"\\ea65"}),o.keyboard=new o("keyboard",{fontCharacter:"\\ea65"}),o.tag=new o("tag",{fontCharacter:"\\ea66"}),o.tagAdd=new o("tag-add",{fontCharacter:"\\ea66"}),o.tagRemove=new o("tag-remove",{fontCharacter:"\\ea66"}),o.person=new o("person",{fontCharacter:"\\ea67"}),o.personFollow=new o("person-follow",{fontCharacter:"\\ea67"}),o.personOutline=new o("person-outline",{fontCharacter:"\\ea67"}),o.personFilled=new o("person-filled",{fontCharacter:"\\ea67"}),o.gitBranch=new o("git-branch",{fontCharacter:"\\ea68"}),o.gitBranchCreate=new o("git-branch-create",{fontCharacter:"\\ea68"}),o.gitBranchDelete=new o("git-branch-delete",{fontCharacter:"\\ea68"}),o.sourceControl=new o("source-control",{fontCharacter:"\\ea68"}),o.mirror=new o("mirror",{fontCharacter:"\\ea69"}),o.mirrorPublic=new o("mirror-public",{fontCharacter:"\\ea69"}),o.star=new o("star",{fontCharacter:"\\ea6a"}),o.starAdd=new o("star-add",{fontCharacter:"\\ea6a"}),o.starDelete=new o("star-delete",{fontCharacter:"\\ea6a"}),o.starEmpty=new o("star-empty",{fontCharacter:"\\ea6a"}),o.comment=new o("comment",{fontCharacter:"\\ea6b"}),o.commentAdd=new o("comment-add",{fontCharacter:"\\ea6b"}),o.alert=new o("alert",{fontCharacter:"\\ea6c"}),o.warning=new o("warning",{fontCharacter:"\\ea6c"}),o.search=new o("search",{fontCharacter:"\\ea6d"}),o.searchSave=new o("search-save",{fontCharacter:"\\ea6d"}),o.logOut=new o("log-out",{fontCharacter:"\\ea6e"}),o.signOut=new o("sign-out",{fontCharacter:"\\ea6e"}),o.logIn=new o("log-in",{fontCharacter:"\\ea6f"}),o.signIn=new o("sign-in",{fontCharacter:"\\ea6f"}),o.eye=new o("eye",{fontCharacter:"\\ea70"}),o.eyeUnwatch=new o("eye-unwatch",{fontCharacter:"\\ea70"}),o.eyeWatch=new o("eye-watch",{fontCharacter:"\\ea70"}),o.circleFilled=new o("circle-filled",{fontCharacter:"\\ea71"}),o.primitiveDot=new o("primitive-dot",{fontCharacter:"\\ea71"}),o.closeDirty=new o("close-dirty",{fontCharacter:"\\ea71"}),o.debugBreakpoint=new o("debug-breakpoint",{fontCharacter:"\\ea71"}),o.debugBreakpointDisabled=new o("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),o.debugHint=new o("debug-hint",{fontCharacter:"\\ea71"}),o.primitiveSquare=new o("primitive-square",{fontCharacter:"\\ea72"}),o.edit=new o("edit",{fontCharacter:"\\ea73"}),o.pencil=new o("pencil",{fontCharacter:"\\ea73"}),o.info=new o("info",{fontCharacter:"\\ea74"}),o.issueOpened=new o("issue-opened",{fontCharacter:"\\ea74"}),o.gistPrivate=new o("gist-private",{fontCharacter:"\\ea75"}),o.gitForkPrivate=new o("git-fork-private",{fontCharacter:"\\ea75"}),o.lock=new o("lock",{fontCharacter:"\\ea75"}),o.mirrorPrivate=new o("mirror-private",{fontCharacter:"\\ea75"}),o.close=new o("close",{fontCharacter:"\\ea76"}),o.removeClose=new o("remove-close",{fontCharacter:"\\ea76"}),o.x=new o("x",{fontCharacter:"\\ea76"}),o.repoSync=new o("repo-sync",{fontCharacter:"\\ea77"}),o.sync=new o("sync",{fontCharacter:"\\ea77"}),o.clone=new o("clone",{fontCharacter:"\\ea78"}),o.desktopDownload=new o("desktop-download",{fontCharacter:"\\ea78"}),o.beaker=new o("beaker",{fontCharacter:"\\ea79"}),o.microscope=new o("microscope",{fontCharacter:"\\ea79"}),o.vm=new o("vm",{fontCharacter:"\\ea7a"}),o.deviceDesktop=new o("device-desktop",{fontCharacter:"\\ea7a"}),o.file=new o("file",{fontCharacter:"\\ea7b"}),o.fileText=new o("file-text",{fontCharacter:"\\ea7b"}),o.more=new o("more",{fontCharacter:"\\ea7c"}),o.ellipsis=new o("ellipsis",{fontCharacter:"\\ea7c"}),o.kebabHorizontal=new o("kebab-horizontal",{fontCharacter:"\\ea7c"}),o.mailReply=new o("mail-reply",{fontCharacter:"\\ea7d"}),o.reply=new o("reply",{fontCharacter:"\\ea7d"}),o.organization=new o("organization",{fontCharacter:"\\ea7e"}),o.organizationFilled=new o("organization-filled",{fontCharacter:"\\ea7e"}),o.organizationOutline=new o("organization-outline",{fontCharacter:"\\ea7e"}),o.newFile=new o("new-file",{fontCharacter:"\\ea7f"}),o.fileAdd=new o("file-add",{fontCharacter:"\\ea7f"}),o.newFolder=new o("new-folder",{fontCharacter:"\\ea80"}),o.fileDirectoryCreate=new o("file-directory-create",{fontCharacter:"\\ea80"}),o.trash=new o("trash",{fontCharacter:"\\ea81"}),o.trashcan=new o("trashcan",{fontCharacter:"\\ea81"}),o.history=new o("history",{fontCharacter:"\\ea82"}),o.clock=new o("clock",{fontCharacter:"\\ea82"}),o.folder=new o("folder",{fontCharacter:"\\ea83"}),o.fileDirectory=new o("file-directory",{fontCharacter:"\\ea83"}),o.symbolFolder=new o("symbol-folder",{fontCharacter:"\\ea83"}),o.logoGithub=new o("logo-github",{fontCharacter:"\\ea84"}),o.markGithub=new o("mark-github",{fontCharacter:"\\ea84"}),o.github=new o("github",{fontCharacter:"\\ea84"}),o.terminal=new o("terminal",{fontCharacter:"\\ea85"}),o.console=new o("console",{fontCharacter:"\\ea85"}),o.repl=new o("repl",{fontCharacter:"\\ea85"}),o.zap=new o("zap",{fontCharacter:"\\ea86"}),o.symbolEvent=new o("symbol-event",{fontCharacter:"\\ea86"}),o.error=new o("error",{fontCharacter:"\\ea87"}),o.stop=new o("stop",{fontCharacter:"\\ea87"}),o.variable=new o("variable",{fontCharacter:"\\ea88"}),o.symbolVariable=new o("symbol-variable",{fontCharacter:"\\ea88"}),o.array=new o("array",{fontCharacter:"\\ea8a"}),o.symbolArray=new o("symbol-array",{fontCharacter:"\\ea8a"}),o.symbolModule=new o("symbol-module",{fontCharacter:"\\ea8b"}),o.symbolPackage=new o("symbol-package",{fontCharacter:"\\ea8b"}),o.symbolNamespace=new o("symbol-namespace",{fontCharacter:"\\ea8b"}),o.symbolObject=new o("symbol-object",{fontCharacter:"\\ea8b"}),o.symbolMethod=new o("symbol-method",{fontCharacter:"\\ea8c"}),o.symbolFunction=new o("symbol-function",{fontCharacter:"\\ea8c"}),o.symbolConstructor=new o("symbol-constructor",{fontCharacter:"\\ea8c"}),o.symbolBoolean=new o("symbol-boolean",{fontCharacter:"\\ea8f"}),o.symbolNull=new o("symbol-null",{fontCharacter:"\\ea8f"}),o.symbolNumeric=new o("symbol-numeric",{fontCharacter:"\\ea90"}),o.symbolNumber=new o("symbol-number",{fontCharacter:"\\ea90"}),o.symbolStructure=new o("symbol-structure",{fontCharacter:"\\ea91"}),o.symbolStruct=new o("symbol-struct",{fontCharacter:"\\ea91"}),o.symbolParameter=new o("symbol-parameter",{fontCharacter:"\\ea92"}),o.symbolTypeParameter=new o("symbol-type-parameter",{fontCharacter:"\\ea92"}),o.symbolKey=new o("symbol-key",{fontCharacter:"\\ea93"}),o.symbolText=new o("symbol-text",{fontCharacter:"\\ea93"}),o.symbolReference=new o("symbol-reference",{fontCharacter:"\\ea94"}),o.goToFile=new o("go-to-file",{fontCharacter:"\\ea94"}),o.symbolEnum=new o("symbol-enum",{fontCharacter:"\\ea95"}),o.symbolValue=new o("symbol-value",{fontCharacter:"\\ea95"}),o.symbolRuler=new o("symbol-ruler",{fontCharacter:"\\ea96"}),o.symbolUnit=new o("symbol-unit",{fontCharacter:"\\ea96"}),o.activateBreakpoints=new o("activate-breakpoints",{fontCharacter:"\\ea97"}),o.archive=new o("archive",{fontCharacter:"\\ea98"}),o.arrowBoth=new o("arrow-both",{fontCharacter:"\\ea99"}),o.arrowDown=new o("arrow-down",{fontCharacter:"\\ea9a"}),o.arrowLeft=new o("arrow-left",{fontCharacter:"\\ea9b"}),o.arrowRight=new o("arrow-right",{fontCharacter:"\\ea9c"}),o.arrowSmallDown=new o("arrow-small-down",{fontCharacter:"\\ea9d"}),o.arrowSmallLeft=new o("arrow-small-left",{fontCharacter:"\\ea9e"}),o.arrowSmallRight=new o("arrow-small-right",{fontCharacter:"\\ea9f"}),o.arrowSmallUp=new o("arrow-small-up",{fontCharacter:"\\eaa0"}),o.arrowUp=new o("arrow-up",{fontCharacter:"\\eaa1"}),o.bell=new o("bell",{fontCharacter:"\\eaa2"}),o.bold=new o("bold",{fontCharacter:"\\eaa3"}),o.book=new o("book",{fontCharacter:"\\eaa4"}),o.bookmark=new o("bookmark",{fontCharacter:"\\eaa5"}),o.debugBreakpointConditionalUnverified=new o("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),o.debugBreakpointConditional=new o("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),o.debugBreakpointConditionalDisabled=new o("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),o.debugBreakpointDataUnverified=new o("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),o.debugBreakpointData=new o("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),o.debugBreakpointDataDisabled=new o("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),o.debugBreakpointLogUnverified=new o("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),o.debugBreakpointLog=new o("debug-breakpoint-log",{fontCharacter:"\\eaab"}),o.debugBreakpointLogDisabled=new o("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),o.briefcase=new o("briefcase",{fontCharacter:"\\eaac"}),o.broadcast=new o("broadcast",{fontCharacter:"\\eaad"}),o.browser=new o("browser",{fontCharacter:"\\eaae"}),o.bug=new o("bug",{fontCharacter:"\\eaaf"}),o.calendar=new o("calendar",{fontCharacter:"\\eab0"}),o.caseSensitive=new o("case-sensitive",{fontCharacter:"\\eab1"}),o.check=new o("check",{fontCharacter:"\\eab2"}),o.checklist=new o("checklist",{fontCharacter:"\\eab3"}),o.chevronDown=new o("chevron-down",{fontCharacter:"\\eab4"}),o.dropDownButton=new o("drop-down-button",o.chevronDown.definition),o.chevronLeft=new o("chevron-left",{fontCharacter:"\\eab5"}),o.chevronRight=new o("chevron-right",{fontCharacter:"\\eab6"}),o.chevronUp=new o("chevron-up",{fontCharacter:"\\eab7"}),o.chromeClose=new o("chrome-close",{fontCharacter:"\\eab8"}),o.chromeMaximize=new o("chrome-maximize",{fontCharacter:"\\eab9"}),o.chromeMinimize=new o("chrome-minimize",{fontCharacter:"\\eaba"}),o.chromeRestore=new o("chrome-restore",{fontCharacter:"\\eabb"}),o.circleOutline=new o("circle-outline",{fontCharacter:"\\eabc"}),o.debugBreakpointUnverified=new o("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),o.circleSlash=new o("circle-slash",{fontCharacter:"\\eabd"}),o.circuitBoard=new o("circuit-board",{fontCharacter:"\\eabe"}),o.clearAll=new o("clear-all",{fontCharacter:"\\eabf"}),o.clippy=new o("clippy",{fontCharacter:"\\eac0"}),o.closeAll=new o("close-all",{fontCharacter:"\\eac1"}),o.cloudDownload=new o("cloud-download",{fontCharacter:"\\eac2"}),o.cloudUpload=new o("cloud-upload",{fontCharacter:"\\eac3"}),o.code=new o("code",{fontCharacter:"\\eac4"}),o.collapseAll=new o("collapse-all",{fontCharacter:"\\eac5"}),o.colorMode=new o("color-mode",{fontCharacter:"\\eac6"}),o.commentDiscussion=new o("comment-discussion",{fontCharacter:"\\eac7"}),o.compareChanges=new o("compare-changes",{fontCharacter:"\\eafd"}),o.creditCard=new o("credit-card",{fontCharacter:"\\eac9"}),o.dash=new o("dash",{fontCharacter:"\\eacc"}),o.dashboard=new o("dashboard",{fontCharacter:"\\eacd"}),o.database=new o("database",{fontCharacter:"\\eace"}),o.debugContinue=new o("debug-continue",{fontCharacter:"\\eacf"}),o.debugDisconnect=new o("debug-disconnect",{fontCharacter:"\\ead0"}),o.debugPause=new o("debug-pause",{fontCharacter:"\\ead1"}),o.debugRestart=new o("debug-restart",{fontCharacter:"\\ead2"}),o.debugStart=new o("debug-start",{fontCharacter:"\\ead3"}),o.debugStepInto=new o("debug-step-into",{fontCharacter:"\\ead4"}),o.debugStepOut=new o("debug-step-out",{fontCharacter:"\\ead5"}),o.debugStepOver=new o("debug-step-over",{fontCharacter:"\\ead6"}),o.debugStop=new o("debug-stop",{fontCharacter:"\\ead7"}),o.debug=new o("debug",{fontCharacter:"\\ead8"}),o.deviceCameraVideo=new o("device-camera-video",{fontCharacter:"\\ead9"}),o.deviceCamera=new o("device-camera",{fontCharacter:"\\eada"}),o.deviceMobile=new o("device-mobile",{fontCharacter:"\\eadb"}),o.diffAdded=new o("diff-added",{fontCharacter:"\\eadc"}),o.diffIgnored=new o("diff-ignored",{fontCharacter:"\\eadd"}),o.diffModified=new o("diff-modified",{fontCharacter:"\\eade"}),o.diffRemoved=new o("diff-removed",{fontCharacter:"\\eadf"}),o.diffRenamed=new o("diff-renamed",{fontCharacter:"\\eae0"}),o.diff=new o("diff",{fontCharacter:"\\eae1"}),o.discard=new o("discard",{fontCharacter:"\\eae2"}),o.editorLayout=new o("editor-layout",{fontCharacter:"\\eae3"}),o.emptyWindow=new o("empty-window",{fontCharacter:"\\eae4"}),o.exclude=new o("exclude",{fontCharacter:"\\eae5"}),o.extensions=new o("extensions",{fontCharacter:"\\eae6"}),o.eyeClosed=new o("eye-closed",{fontCharacter:"\\eae7"}),o.fileBinary=new o("file-binary",{fontCharacter:"\\eae8"}),o.fileCode=new o("file-code",{fontCharacter:"\\eae9"}),o.fileMedia=new o("file-media",{fontCharacter:"\\eaea"}),o.filePdf=new o("file-pdf",{fontCharacter:"\\eaeb"}),o.fileSubmodule=new o("file-submodule",{fontCharacter:"\\eaec"}),o.fileSymlinkDirectory=new o("file-symlink-directory",{fontCharacter:"\\eaed"}),o.fileSymlinkFile=new o("file-symlink-file",{fontCharacter:"\\eaee"}),o.fileZip=new o("file-zip",{fontCharacter:"\\eaef"}),o.files=new o("files",{fontCharacter:"\\eaf0"}),o.filter=new o("filter",{fontCharacter:"\\eaf1"}),o.flame=new o("flame",{fontCharacter:"\\eaf2"}),o.foldDown=new o("fold-down",{fontCharacter:"\\eaf3"}),o.foldUp=new o("fold-up",{fontCharacter:"\\eaf4"}),o.fold=new o("fold",{fontCharacter:"\\eaf5"}),o.folderActive=new o("folder-active",{fontCharacter:"\\eaf6"}),o.folderOpened=new o("folder-opened",{fontCharacter:"\\eaf7"}),o.gear=new o("gear",{fontCharacter:"\\eaf8"}),o.gift=new o("gift",{fontCharacter:"\\eaf9"}),o.gistSecret=new o("gist-secret",{fontCharacter:"\\eafa"}),o.gist=new o("gist",{fontCharacter:"\\eafb"}),o.gitCommit=new o("git-commit",{fontCharacter:"\\eafc"}),o.gitCompare=new o("git-compare",{fontCharacter:"\\eafd"}),o.gitMerge=new o("git-merge",{fontCharacter:"\\eafe"}),o.githubAction=new o("github-action",{fontCharacter:"\\eaff"}),o.githubAlt=new o("github-alt",{fontCharacter:"\\eb00"}),o.globe=new o("globe",{fontCharacter:"\\eb01"}),o.grabber=new o("grabber",{fontCharacter:"\\eb02"}),o.graph=new o("graph",{fontCharacter:"\\eb03"}),o.gripper=new o("gripper",{fontCharacter:"\\eb04"}),o.heart=new o("heart",{fontCharacter:"\\eb05"}),o.home=new o("home",{fontCharacter:"\\eb06"}),o.horizontalRule=new o("horizontal-rule",{fontCharacter:"\\eb07"}),o.hubot=new o("hubot",{fontCharacter:"\\eb08"}),o.inbox=new o("inbox",{fontCharacter:"\\eb09"}),o.issueClosed=new o("issue-closed",{fontCharacter:"\\eba4"}),o.issueReopened=new o("issue-reopened",{fontCharacter:"\\eb0b"}),o.issues=new o("issues",{fontCharacter:"\\eb0c"}),o.italic=new o("italic",{fontCharacter:"\\eb0d"}),o.jersey=new o("jersey",{fontCharacter:"\\eb0e"}),o.json=new o("json",{fontCharacter:"\\eb0f"}),o.kebabVertical=new o("kebab-vertical",{fontCharacter:"\\eb10"}),o.key=new o("key",{fontCharacter:"\\eb11"}),o.law=new o("law",{fontCharacter:"\\eb12"}),o.lightbulbAutofix=new o("lightbulb-autofix",{fontCharacter:"\\eb13"}),o.linkExternal=new o("link-external",{fontCharacter:"\\eb14"}),o.link=new o("link",{fontCharacter:"\\eb15"}),o.listOrdered=new o("list-ordered",{fontCharacter:"\\eb16"}),o.listUnordered=new o("list-unordered",{fontCharacter:"\\eb17"}),o.liveShare=new o("live-share",{fontCharacter:"\\eb18"}),o.loading=new o("loading",{fontCharacter:"\\eb19"}),o.location=new o("location",{fontCharacter:"\\eb1a"}),o.mailRead=new o("mail-read",{fontCharacter:"\\eb1b"}),o.mail=new o("mail",{fontCharacter:"\\eb1c"}),o.markdown=new o("markdown",{fontCharacter:"\\eb1d"}),o.megaphone=new o("megaphone",{fontCharacter:"\\eb1e"}),o.mention=new o("mention",{fontCharacter:"\\eb1f"}),o.milestone=new o("milestone",{fontCharacter:"\\eb20"}),o.mortarBoard=new o("mortar-board",{fontCharacter:"\\eb21"}),o.move=new o("move",{fontCharacter:"\\eb22"}),o.multipleWindows=new o("multiple-windows",{fontCharacter:"\\eb23"}),o.mute=new o("mute",{fontCharacter:"\\eb24"}),o.noNewline=new o("no-newline",{fontCharacter:"\\eb25"}),o.note=new o("note",{fontCharacter:"\\eb26"}),o.octoface=new o("octoface",{fontCharacter:"\\eb27"}),o.openPreview=new o("open-preview",{fontCharacter:"\\eb28"}),o.package_=new o("package",{fontCharacter:"\\eb29"}),o.paintcan=new o("paintcan",{fontCharacter:"\\eb2a"}),o.pin=new o("pin",{fontCharacter:"\\eb2b"}),o.play=new o("play",{fontCharacter:"\\eb2c"}),o.run=new o("run",{fontCharacter:"\\eb2c"}),o.plug=new o("plug",{fontCharacter:"\\eb2d"}),o.preserveCase=new o("preserve-case",{fontCharacter:"\\eb2e"}),o.preview=new o("preview",{fontCharacter:"\\eb2f"}),o.project=new o("project",{fontCharacter:"\\eb30"}),o.pulse=new o("pulse",{fontCharacter:"\\eb31"}),o.question=new o("question",{fontCharacter:"\\eb32"}),o.quote=new o("quote",{fontCharacter:"\\eb33"}),o.radioTower=new o("radio-tower",{fontCharacter:"\\eb34"}),o.reactions=new o("reactions",{fontCharacter:"\\eb35"}),o.references=new o("references",{fontCharacter:"\\eb36"}),o.refresh=new o("refresh",{fontCharacter:"\\eb37"}),o.regex=new o("regex",{fontCharacter:"\\eb38"}),o.remoteExplorer=new o("remote-explorer",{fontCharacter:"\\eb39"}),o.remote=new o("remote",{fontCharacter:"\\eb3a"}),o.remove=new o("remove",{fontCharacter:"\\eb3b"}),o.replaceAll=new o("replace-all",{fontCharacter:"\\eb3c"}),o.replace=new o("replace",{fontCharacter:"\\eb3d"}),o.repoClone=new o("repo-clone",{fontCharacter:"\\eb3e"}),o.repoForcePush=new o("repo-force-push",{fontCharacter:"\\eb3f"}),o.repoPull=new o("repo-pull",{fontCharacter:"\\eb40"}),o.repoPush=new o("repo-push",{fontCharacter:"\\eb41"}),o.report=new o("report",{fontCharacter:"\\eb42"}),o.requestChanges=new o("request-changes",{fontCharacter:"\\eb43"}),o.rocket=new o("rocket",{fontCharacter:"\\eb44"}),o.rootFolderOpened=new o("root-folder-opened",{fontCharacter:"\\eb45"}),o.rootFolder=new o("root-folder",{fontCharacter:"\\eb46"}),o.rss=new o("rss",{fontCharacter:"\\eb47"}),o.ruby=new o("ruby",{fontCharacter:"\\eb48"}),o.saveAll=new o("save-all",{fontCharacter:"\\eb49"}),o.saveAs=new o("save-as",{fontCharacter:"\\eb4a"}),o.save=new o("save",{fontCharacter:"\\eb4b"}),o.screenFull=new o("screen-full",{fontCharacter:"\\eb4c"}),o.screenNormal=new o("screen-normal",{fontCharacter:"\\eb4d"}),o.searchStop=new o("search-stop",{fontCharacter:"\\eb4e"}),o.server=new o("server",{fontCharacter:"\\eb50"}),o.settingsGear=new o("settings-gear",{fontCharacter:"\\eb51"}),o.settings=new o("settings",{fontCharacter:"\\eb52"}),o.shield=new o("shield",{fontCharacter:"\\eb53"}),o.smiley=new o("smiley",{fontCharacter:"\\eb54"}),o.sortPrecedence=new o("sort-precedence",{fontCharacter:"\\eb55"}),o.splitHorizontal=new o("split-horizontal",{fontCharacter:"\\eb56"}),o.splitVertical=new o("split-vertical",{fontCharacter:"\\eb57"}),o.squirrel=new o("squirrel",{fontCharacter:"\\eb58"}),o.starFull=new o("star-full",{fontCharacter:"\\eb59"}),o.starHalf=new o("star-half",{fontCharacter:"\\eb5a"}),o.symbolClass=new o("symbol-class",{fontCharacter:"\\eb5b"}),o.symbolColor=new o("symbol-color",{fontCharacter:"\\eb5c"}),o.symbolConstant=new o("symbol-constant",{fontCharacter:"\\eb5d"}),o.symbolEnumMember=new o("symbol-enum-member",{fontCharacter:"\\eb5e"}),o.symbolField=new o("symbol-field",{fontCharacter:"\\eb5f"}),o.symbolFile=new o("symbol-file",{fontCharacter:"\\eb60"}),o.symbolInterface=new o("symbol-interface",{fontCharacter:"\\eb61"}),o.symbolKeyword=new o("symbol-keyword",{fontCharacter:"\\eb62"}),o.symbolMisc=new o("symbol-misc",{fontCharacter:"\\eb63"}),o.symbolOperator=new o("symbol-operator",{fontCharacter:"\\eb64"}),o.symbolProperty=new o("symbol-property",{fontCharacter:"\\eb65"}),o.wrench=new o("wrench",{fontCharacter:"\\eb65"}),o.wrenchSubaction=new o("wrench-subaction",{fontCharacter:"\\eb65"}),o.symbolSnippet=new o("symbol-snippet",{fontCharacter:"\\eb66"}),o.tasklist=new o("tasklist",{fontCharacter:"\\eb67"}),o.telescope=new o("telescope",{fontCharacter:"\\eb68"}),o.textSize=new o("text-size",{fontCharacter:"\\eb69"}),o.threeBars=new o("three-bars",{fontCharacter:"\\eb6a"}),o.thumbsdown=new o("thumbsdown",{fontCharacter:"\\eb6b"}),o.thumbsup=new o("thumbsup",{fontCharacter:"\\eb6c"}),o.tools=new o("tools",{fontCharacter:"\\eb6d"}),o.triangleDown=new o("triangle-down",{fontCharacter:"\\eb6e"}),o.triangleLeft=new o("triangle-left",{fontCharacter:"\\eb6f"}),o.triangleRight=new o("triangle-right",{fontCharacter:"\\eb70"}),o.triangleUp=new o("triangle-up",{fontCharacter:"\\eb71"}),o.twitter=new o("twitter",{fontCharacter:"\\eb72"}),o.unfold=new o("unfold",{fontCharacter:"\\eb73"}),o.unlock=new o("unlock",{fontCharacter:"\\eb74"}),o.unmute=new o("unmute",{fontCharacter:"\\eb75"}),o.unverified=new o("unverified",{fontCharacter:"\\eb76"}),o.verified=new o("verified",{fontCharacter:"\\eb77"}),o.versions=new o("versions",{fontCharacter:"\\eb78"}),o.vmActive=new o("vm-active",{fontCharacter:"\\eb79"}),o.vmOutline=new o("vm-outline",{fontCharacter:"\\eb7a"}),o.vmRunning=new o("vm-running",{fontCharacter:"\\eb7b"}),o.watch=new o("watch",{fontCharacter:"\\eb7c"}),o.whitespace=new o("whitespace",{fontCharacter:"\\eb7d"}),o.wholeWord=new o("whole-word",{fontCharacter:"\\eb7e"}),o.window=new o("window",{fontCharacter:"\\eb7f"}),o.wordWrap=new o("word-wrap",{fontCharacter:"\\eb80"}),o.zoomIn=new o("zoom-in",{fontCharacter:"\\eb81"}),o.zoomOut=new o("zoom-out",{fontCharacter:"\\eb82"}),o.listFilter=new o("list-filter",{fontCharacter:"\\eb83"}),o.listFlat=new o("list-flat",{fontCharacter:"\\eb84"}),o.listSelection=new o("list-selection",{fontCharacter:"\\eb85"}),o.selection=new o("selection",{fontCharacter:"\\eb85"}),o.listTree=new o("list-tree",{fontCharacter:"\\eb86"}),o.debugBreakpointFunctionUnverified=new o("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),o.debugBreakpointFunction=new o("debug-breakpoint-function",{fontCharacter:"\\eb88"}),o.debugBreakpointFunctionDisabled=new o("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),o.debugStackframeActive=new o("debug-stackframe-active",{fontCharacter:"\\eb89"}),o.debugStackframeDot=new o("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),o.debugStackframe=new o("debug-stackframe",{fontCharacter:"\\eb8b"}),o.debugStackframeFocused=new o("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),o.debugBreakpointUnsupported=new o("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),o.symbolString=new o("symbol-string",{fontCharacter:"\\eb8d"}),o.debugReverseContinue=new o("debug-reverse-continue",{fontCharacter:"\\eb8e"}),o.debugStepBack=new o("debug-step-back",{fontCharacter:"\\eb8f"}),o.debugRestartFrame=new o("debug-restart-frame",{fontCharacter:"\\eb90"}),o.callIncoming=new o("call-incoming",{fontCharacter:"\\eb92"}),o.callOutgoing=new o("call-outgoing",{fontCharacter:"\\eb93"}),o.menu=new o("menu",{fontCharacter:"\\eb94"}),o.expandAll=new o("expand-all",{fontCharacter:"\\eb95"}),o.feedback=new o("feedback",{fontCharacter:"\\eb96"}),o.groupByRefType=new o("group-by-ref-type",{fontCharacter:"\\eb97"}),o.ungroupByRefType=new o("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),o.account=new o("account",{fontCharacter:"\\eb99"}),o.bellDot=new o("bell-dot",{fontCharacter:"\\eb9a"}),o.debugConsole=new o("debug-console",{fontCharacter:"\\eb9b"}),o.library=new o("library",{fontCharacter:"\\eb9c"}),o.output=new o("output",{fontCharacter:"\\eb9d"}),o.runAll=new o("run-all",{fontCharacter:"\\eb9e"}),o.syncIgnored=new o("sync-ignored",{fontCharacter:"\\eb9f"}),o.pinned=new o("pinned",{fontCharacter:"\\eba0"}),o.githubInverted=new o("github-inverted",{fontCharacter:"\\eba1"}),o.debugAlt=new o("debug-alt",{fontCharacter:"\\eb91"}),o.serverProcess=new o("server-process",{fontCharacter:"\\eba2"}),o.serverEnvironment=new o("server-environment",{fontCharacter:"\\eba3"}),o.pass=new o("pass",{fontCharacter:"\\eba4"}),o.stopCircle=new o("stop-circle",{fontCharacter:"\\eba5"}),o.playCircle=new o("play-circle",{fontCharacter:"\\eba6"}),o.record=new o("record",{fontCharacter:"\\eba7"}),o.debugAltSmall=new o("debug-alt-small",{fontCharacter:"\\eba8"}),o.vmConnect=new o("vm-connect",{fontCharacter:"\\eba9"}),o.cloud=new o("cloud",{fontCharacter:"\\ebaa"}),o.merge=new o("merge",{fontCharacter:"\\ebab"}),o.exportIcon=new o("export",{fontCharacter:"\\ebac"}),o.graphLeft=new o("graph-left",{fontCharacter:"\\ebad"}),o.magnet=new o("magnet",{fontCharacter:"\\ebae"}),o.notebook=new o("notebook",{fontCharacter:"\\ebaf"}),o.redo=new o("redo",{fontCharacter:"\\ebb0"}),o.checkAll=new o("check-all",{fontCharacter:"\\ebb1"}),o.pinnedDirty=new o("pinned-dirty",{fontCharacter:"\\ebb2"}),o.passFilled=new o("pass-filled",{fontCharacter:"\\ebb3"}),o.circleLargeFilled=new o("circle-large-filled",{fontCharacter:"\\ebb4"}),o.circleLargeOutline=new o("circle-large-outline",{fontCharacter:"\\ebb5"}),o.combine=new o("combine",{fontCharacter:"\\ebb6"}),o.gather=new o("gather",{fontCharacter:"\\ebb6"}),o.table=new o("table",{fontCharacter:"\\ebb7"}),o.variableGroup=new o("variable-group",{fontCharacter:"\\ebb8"}),o.typeHierarchy=new o("type-hierarchy",{fontCharacter:"\\ebb9"}),o.typeHierarchySub=new o("type-hierarchy-sub",{fontCharacter:"\\ebba"}),o.typeHierarchySuper=new o("type-hierarchy-super",{fontCharacter:"\\ebbb"}),o.gitPullRequestCreate=new o("git-pull-request-create",{fontCharacter:"\\ebbc"}),o.runAbove=new o("run-above",{fontCharacter:"\\ebbd"}),o.runBelow=new o("run-below",{fontCharacter:"\\ebbe"}),o.notebookTemplate=new o("notebook-template",{fontCharacter:"\\ebbf"}),o.debugRerun=new o("debug-rerun",{fontCharacter:"\\ebc0"}),o.workspaceTrusted=new o("workspace-trusted",{fontCharacter:"\\ebc1"}),o.workspaceUntrusted=new o("workspace-untrusted",{fontCharacter:"\\ebc2"}),o.workspaceUnspecified=new o("workspace-unspecified",{fontCharacter:"\\ebc3"}),o.terminalCmd=new o("terminal-cmd",{fontCharacter:"\\ebc4"}),o.terminalDebian=new o("terminal-debian",{fontCharacter:"\\ebc5"}),o.terminalLinux=new o("terminal-linux",{fontCharacter:"\\ebc6"}),o.terminalPowershell=new o("terminal-powershell",{fontCharacter:"\\ebc7"}),o.terminalTmux=new o("terminal-tmux",{fontCharacter:"\\ebc8"}),o.terminalUbuntu=new o("terminal-ubuntu",{fontCharacter:"\\ebc9"}),o.terminalBash=new o("terminal-bash",{fontCharacter:"\\ebca"}),o.arrowSwap=new o("arrow-swap",{fontCharacter:"\\ebcb"}),o.copy=new o("copy",{fontCharacter:"\\ebcc"}),o.personAdd=new o("person-add",{fontCharacter:"\\ebcd"}),o.filterFilled=new o("filter-filled",{fontCharacter:"\\ebce"}),o.wand=new o("wand",{fontCharacter:"\\ebcf"}),o.debugLineByLine=new o("debug-line-by-line",{fontCharacter:"\\ebd0"}),o.inspect=new o("inspect",{fontCharacter:"\\ebd1"}),o.layers=new o("layers",{fontCharacter:"\\ebd2"}),o.layersDot=new o("layers-dot",{fontCharacter:"\\ebd3"}),o.layersActive=new o("layers-active",{fontCharacter:"\\ebd4"}),o.compass=new o("compass",{fontCharacter:"\\ebd5"}),o.compassDot=new o("compass-dot",{fontCharacter:"\\ebd6"}),o.compassActive=new o("compass-active",{fontCharacter:"\\ebd7"}),o.azure=new o("azure",{fontCharacter:"\\ebd8"}),o.issueDraft=new o("issue-draft",{fontCharacter:"\\ebd9"}),o.gitPullRequestClosed=new o("git-pull-request-closed",{fontCharacter:"\\ebda"}),o.gitPullRequestDraft=new o("git-pull-request-draft",{fontCharacter:"\\ebdb"}),o.debugAll=new o("debug-all",{fontCharacter:"\\ebdc"}),o.debugCoverage=new o("debug-coverage",{fontCharacter:"\\ebdd"}),o.runErrors=new o("run-errors",{fontCharacter:"\\ebde"}),o.folderLibrary=new o("folder-library",{fontCharacter:"\\ebdf"}),o.debugContinueSmall=new o("debug-continue-small",{fontCharacter:"\\ebe0"}),o.beakerStop=new o("beaker-stop",{fontCharacter:"\\ebe1"}),o.graphLine=new o("graph-line",{fontCharacter:"\\ebe2"}),o.graphScatter=new o("graph-scatter",{fontCharacter:"\\ebe3"}),o.pieChart=new o("pie-chart",{fontCharacter:"\\ebe4"}),o.bracket=new o("bracket",o.json.definition),o.bracketDot=new o("bracket-dot",{fontCharacter:"\\ebe5"}),o.bracketError=new o("bracket-error",{fontCharacter:"\\ebe6"}),o.lockSmall=new o("lock-small",{fontCharacter:"\\ebe7"}),o.azureDevops=new o("azure-devops",{fontCharacter:"\\ebe8"}),o.verifiedFilled=new o("verified-filled",{fontCharacter:"\\ebe9"})}(he||(he={}))},79881:function(yn,yt,T){"use strict";T.d(yt,{B8:function(){return A},Cp:function(){return le},F0:function(){return oe},L6:function(){return x},VV:function(){return he},b1:function(){return o},dL:function(){return Se},ri:function(){return K}});class k{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(m){setTimeout(()=>{throw m.stack?new Error(m.message+`
`+m.stack):m},0)}}emit(m){this.listeners.forEach(y=>{y(m)})}onUnexpectedError(m){this.unexpectedErrorHandler(m),this.emit(m)}onUnexpectedExternalError(m){this.unexpectedErrorHandler(m)}}const ce=new k;function Se(h){he(h)||ce.onUnexpectedError(h)}function le(h){he(h)||ce.onUnexpectedExternalError(h)}function K(h){if(h instanceof Error){let{name:m,message:y}=h;const S=h.stacktrace||h.stack;return{$isError:!0,name:m,message:y,stack:S}}return h}const p="Canceled";function he(h){return h instanceof Error&&h.name===p&&h.message===p}function oe(){const h=new Error(p);return h.name=h.message,h}function o(h){return h?new Error(`Illegal argument: ${h}`):new Error("Illegal argument")}function x(h){return h?new Error(`Illegal state: ${h}`):new Error("Illegal state")}class A extends Error{constructor(m){super("NotSupported"),m&&(this.message=m)}}},4348:function(yn,yt,T){"use strict";T.d(yt,{D0:function(){return A},E7:function(){return h},K3:function(){return x},Q5:function(){return o},ZD:function(){return m},ju:function(){return K}});var k=T(79881),ce=T(69323),Se=T(34502),le=T(95830),K;(function(y){y.None=()=>ce.JT.None;function S(V){return(H,ee=null,j)=>{let v=!1,g;return g=V(U=>{if(!v)return g?g.dispose():v=!0,H.call(ee,U)},null,j),v&&g.dispose(),g}}y.once=S;function O(V,H){return D((ee,j=null,v)=>V(g=>ee.call(j,H(g)),null,v))}y.map=O;function G(V,H){return D((ee,j=null,v)=>V(g=>{H(g),ee.call(j,g)},null,v))}y.forEach=G;function W(V,H){return D((ee,j=null,v)=>V(g=>H(g)&&ee.call(j,g),null,v))}y.filter=W;function I(V){return V}y.signal=I;function M(...V){return(H,ee=null,j)=>(0,ce.F8)(...V.map(v=>v(g=>H.call(ee,g),null,j)))}y.any=M;function w(V,H,ee){let j=ee;return O(V,v=>(j=H(j,v),j))}y.reduce=w;function D(V){let H;const ee=new o({onFirstListenerAdd(){H=V(ee.fire,ee)},onLastListenerRemove(){H.dispose()}});return ee.event}function re(V,H,ee=100,j=!1,v){let g,U,te,Be=0;const Ge=new o({leakWarningThreshold:v,onFirstListenerAdd(){g=V(Qe=>{Be++,U=H(U,Qe),j&&!te&&(Ge.fire(U),U=void 0),clearTimeout(te),te=setTimeout(()=>{const et=U;U=void 0,te=void 0,(!j||Be>1)&&Ge.fire(et),Be=0},ee)})},onLastListenerRemove(){g.dispose()}});return Ge.event}y.debounce=re;function ie(V,H=(ee,j)=>ee===j){let ee=!0,j;return W(V,v=>{const g=ee||!H(v,j);return ee=!1,j=v,g})}y.latch=ie;function J(V,H){return[y.filter(V,H),y.filter(V,ee=>!H(ee))]}y.split=J;function ue(V,H=!1,ee=[]){let j=ee.slice(),v=V(te=>{j?j.push(te):U.fire(te)});const g=()=>{j&&j.forEach(te=>U.fire(te)),j=null},U=new o({onFirstListenerAdd(){v||(v=V(te=>U.fire(te)))},onFirstListenerDidAdd(){j&&(H?setTimeout(g):g())},onLastListenerRemove(){v&&v.dispose(),v=null}});return U.event}y.buffer=ue;class ge{constructor(H){this.event=H}map(H){return new ge(O(this.event,H))}forEach(H){return new ge(G(this.event,H))}filter(H){return new ge(W(this.event,H))}reduce(H,ee){return new ge(w(this.event,H,ee))}latch(){return new ge(ie(this.event))}debounce(H,ee=100,j=!1,v){return new ge(re(this.event,H,ee,j,v))}on(H,ee,j){return this.event(H,ee,j)}once(H,ee,j){return S(this.event)(H,ee,j)}}function Ee(V){return new ge(V)}y.chain=Ee;function Ne(V,H,ee=j=>j){const j=(...te)=>U.fire(ee(...te)),v=()=>V.on(H,j),g=()=>V.removeListener(H,j),U=new o({onFirstListenerAdd:v,onLastListenerRemove:g});return U.event}y.fromNodeEventEmitter=Ne;function Y(V,H,ee=j=>j){const j=(...te)=>U.fire(ee(...te)),v=()=>V.addEventListener(H,j),g=()=>V.removeEventListener(H,j),U=new o({onFirstListenerAdd:v,onLastListenerRemove:g});return U.event}y.fromDOMEventEmitter=Y;function L(V){return new Promise(H=>S(V)(H))}y.toPromise=L})(K||(K={}));class p{constructor(S){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${S}_${p._idPool++}`}start(S){this._stopWatch=new le.G(!0),this._listenerCount=S}stop(){if(this._stopWatch){const S=this._stopWatch.elapsed();this._elapsedOverall+=S,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${S.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}p._idPool=0;let he=-1;class oe{constructor(S,O=Math.random().toString(18).slice(2,5)){this.customThreshold=S,this.name=O,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(S){let O=he;if(typeof this.customThreshold=="number"&&(O=this.customThreshold),O<=0||S<O)return;this._stacks||(this._stacks=new Map);const G=new Error().stack.split(`
`).slice(3).join(`
`),W=this._stacks.get(G)||0;if(this._stacks.set(G,W+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=O*.5;let I,M=0;for(const[w,D]of this._stacks)(!I||M<D)&&(I=w,M=D);console.warn(`[${this.name}] potential listener LEAK detected, having ${S} listeners already. MOST frequent listener (${M}):`),console.warn(I)}return()=>{const I=this._stacks.get(G)||0;this._stacks.set(G,I-1)}}}class o{constructor(S){var O;this._disposed=!1,this._options=S,this._leakageMon=he>0?new oe(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=(S,O,G)=>{var W;this._listeners||(this._listeners=new Se.S);const I=this._listeners.isEmpty();I&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const M=this._listeners.push(O?[S,O]:S);I&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,S,O);const w=(W=this._leakageMon)===null||W===void 0?void 0:W.check(this._listeners.size),D=(0,ce.OF)(()=>{w&&w(),this._disposed||(M(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return G instanceof ce.SL?G.add(D):Array.isArray(G)&&G.push(D),D}),this._event}fire(S){var O,G;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Se.S);for(let W of this._listeners)this._deliveryQueue.push([W,S]);for((O=this._perfMon)===null||O===void 0||O.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[W,I]=this._deliveryQueue.shift();try{typeof W=="function"?W.call(void 0,I):W[0].call(W[1],I)}catch(M){(0,k.dL)(M)}}(G=this._perfMon)===null||G===void 0||G.stop()}}dispose(){var S,O,G,W,I;this._disposed||(this._disposed=!0,(S=this._listeners)===null||S===void 0||S.clear(),(O=this._deliveryQueue)===null||O===void 0||O.clear(),(W=(G=this._options)===null||G===void 0?void 0:G.onLastListenerRemove)===null||W===void 0||W.call(G),(I=this._leakageMon)===null||I===void 0||I.dispose())}}class x extends o{constructor(S){super(S),this._isPaused=0,this._eventQueue=new Se.S,this._mergeFn=S==null?void 0:S.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const S=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(S))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(S){this._listeners&&(this._isPaused!==0?this._eventQueue.push(S):super.fire(S))}}class A extends x{constructor(S){var O;super(S),this._delay=(O=S.delay)!==null&&O!==void 0?O:100}fire(S){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(S)}}class h{constructor(){this.buffers=[]}wrapEvent(S){return(O,G,W)=>S(I=>{const M=this.buffers[this.buffers.length-1];M?M.push(()=>O.call(G,I)):O.call(G,I)},void 0,W)}bufferEvents(S){const O=[];this.buffers.push(O);const G=S();return this.buffers.pop(),O.forEach(W=>W()),G}}class m{constructor(){this.listening=!1,this.inputEvent=K.None,this.inputEventListener=ce.JT.None,this.emitter=new o({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(S){this.inputEvent=S,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=S(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(yn,yt,T){"use strict";T.d(yt,{I:function(){return k}});function k(ce){const Se=this;let le=!1,K;return function(){return le||(le=!0,K=ce.apply(Se,arguments)),K}}},88226:function(yn,yt,T){"use strict";T.d(yt,{$:function(){return k}});var k;(function(ce){function Se(M){return M&&typeof M=="object"&&typeof M[Symbol.iterator]=="function"}ce.is=Se;const le=Object.freeze([]);function K(){return le}ce.empty=K;function*p(M){yield M}ce.single=p;function he(M){return M||le}ce.from=he;function oe(M){return!M||M[Symbol.iterator]().next().done===!0}ce.isEmpty=oe;function o(M){return M[Symbol.iterator]().next().value}ce.first=o;function x(M,w){for(const D of M)if(w(D))return!0;return!1}ce.some=x;function A(M,w){for(const D of M)if(w(D))return D}ce.find=A;function*h(M,w){for(const D of M)w(D)&&(yield D)}ce.filter=h;function*m(M,w){let D=0;for(const re of M)yield w(re,D++)}ce.map=m;function*y(...M){for(const w of M)for(const D of w)yield D}ce.concat=y;function*S(M){for(const w of M)for(const D of w)yield D}ce.concatNested=S;function O(M,w,D){let re=D;for(const ie of M)re=w(re,ie);return re}ce.reduce=O;function*G(M,w,D=M.length){for(w<0&&(w+=M.length),D<0?D+=M.length:D>M.length&&(D=M.length);w<D;w++)yield M[w]}ce.slice=G;function W(M,w=Number.POSITIVE_INFINITY){const D=[];if(w===0)return[D,M];const re=M[Symbol.iterator]();for(let ie=0;ie<w;ie++){const J=re.next();if(J.done)return[D,ce.empty()];D.push(J.value)}return[D,{[Symbol.iterator](){return re}}]}ce.consume=W;function I(M,w,D=(re,ie)=>re===ie){const re=M[Symbol.iterator](),ie=w[Symbol.iterator]();for(;;){const J=re.next(),ue=ie.next();if(J.done!==ue.done)return!1;if(J.done)return!0;if(!D(J.value,ue.value))return!1}}ce.equals=I})(k||(k={}))},69323:function(yn,yt,T){"use strict";T.d(yt,{B9:function(){return m},F8:function(){return y},JT:function(){return G},Jz:function(){return I},OF:function(){return S},SL:function(){return O},Wf:function(){return h},XK:function(){return W},dk:function(){return x}});var k=T(17845),ce=T(88226);const Se=!1;let le=null;function K(M){le=M}if(Se){const M="__is_disposable_tracked__";K(new class{trackDisposable(w){const D=new Error("Potentially leaked disposable").stack;setTimeout(()=>{w[M]||console.log(D)},3e3)}setParent(w,D){if(w&&w!==G.None)try{w[M]=!0}catch(re){}}markAsDisposed(w){if(w&&w!==G.None)try{w[M]=!0}catch(D){}}markAsSingleton(w){}})}function p(M){return le==null||le.trackDisposable(M),M}function he(M){le==null||le.markAsDisposed(M)}function oe(M,w){le==null||le.setParent(M,w)}function o(M,w){if(le)for(const D of M)le.setParent(D,w)}function x(M){return le==null||le.markAsSingleton(M),M}class A extends Error{constructor(w){super(`Encountered errors while disposing of store. Errors: [${w.join(", ")}]`),this.errors=w}}function h(M){return typeof M.dispose=="function"&&M.dispose.length===0}function m(M){if(ce.$.is(M)){let w=[];for(const D of M)if(D)try{D.dispose()}catch(re){w.push(re)}if(w.length===1)throw w[0];if(w.length>1)throw new A(w);return Array.isArray(M)?[]:M}else if(M)return M.dispose(),M}function y(...M){const w=S(()=>m(M));return o(M,w),w}function S(M){const w=p({dispose:(0,k.I)(()=>{he(w),M()})});return w}class O{constructor(){this._toDispose=new Set,this._isDisposed=!1,p(this)}dispose(){this._isDisposed||(he(this),this._isDisposed=!0,this.clear())}clear(){try{m(this._toDispose.values())}finally{this._toDispose.clear()}}add(w){if(!w)return w;if(w===this)throw new Error("Cannot register a disposable on itself!");return oe(w,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(w),w}}O.DISABLE_DISPOSED_WARNING=!1;class G{constructor(){this._store=new O,p(this),oe(this._store,this)}dispose(){he(this),this._store.dispose()}_register(w){if(w===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(w)}}G.None=Object.freeze({dispose(){}});class W{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(w){var D;this._isDisposed||w===this._value||((D=this._value)===null||D===void 0||D.dispose(),w&&oe(w,this),this._value=w)}clear(){this.value=void 0}dispose(){var w;this._isDisposed=!0,he(this),(w=this._value)===null||w===void 0||w.dispose(),this._value=void 0}clearAndLeak(){const w=this._value;return this._value=void 0,w&&oe(w,null),w}}class I{constructor(w){this.object=w}dispose(){}}},34502:function(yn,yt,T){"use strict";T.d(yt,{S:function(){return ce}});class k{constructor(le){this.element=le,this.next=k.Undefined,this.prev=k.Undefined}}k.Undefined=new k(void 0);class ce{constructor(){this._first=k.Undefined,this._last=k.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===k.Undefined}clear(){let le=this._first;for(;le!==k.Undefined;){const K=le.next;le.prev=k.Undefined,le.next=k.Undefined,le=K}this._first=k.Undefined,this._last=k.Undefined,this._size=0}unshift(le){return this._insert(le,!1)}push(le){return this._insert(le,!0)}_insert(le,K){const p=new k(le);if(this._first===k.Undefined)this._first=p,this._last=p;else if(K){const oe=this._last;this._last=p,p.prev=oe,oe.next=p}else{const oe=this._first;this._first=p,p.next=oe,oe.prev=p}this._size+=1;let he=!1;return()=>{he||(he=!0,this._remove(p))}}shift(){if(this._first!==k.Undefined){const le=this._first.element;return this._remove(this._first),le}}pop(){if(this._last!==k.Undefined){const le=this._last.element;return this._remove(this._last),le}}_remove(le){if(le.prev!==k.Undefined&&le.next!==k.Undefined){const K=le.prev;K.next=le.next,le.next.prev=K}else le.prev===k.Undefined&&le.next===k.Undefined?(this._first=k.Undefined,this._last=k.Undefined):le.next===k.Undefined?(this._last=this._last.prev,this._last.next=k.Undefined):le.prev===k.Undefined&&(this._first=this._first.next,this._first.prev=k.Undefined);this._size-=1}*[Symbol.iterator](){let le=this._first;for(;le!==k.Undefined;)yield le.element,le=le.next}}},23345:function(yn,yt,T){"use strict";T.d(yt,{$L:function(){return re},ED:function(){return I},IJ:function(){return w},OS:function(){return ge},WE:function(){return J},dz:function(){return M},gn:function(){return ie},li:function(){return S},r:function(){return Y},tY:function(){return D},xS:function(){return ue}});var k=T(97671),ce;const Se="en";let le=!1,K=!1,p=!1,he=!1,oe=!1,o=!1,x=!1,A,h=null,m=null,y;const S=typeof self=="object"?self:typeof T.g=="object"?T.g:{};let O;typeof S.vscode!="undefined"&&typeof S.vscode.process!="undefined"?O=S.vscode.process:typeof k!="undefined"&&(O=k);const G=typeof((ce=O==null?void 0:O.versions)===null||ce===void 0?void 0:ce.electron)=="string"&&O.type==="renderer";if(typeof navigator=="object"&&!G)y=navigator.userAgent,le=y.indexOf("Windows")>=0,K=y.indexOf("Macintosh")>=0,x=(y.indexOf("Macintosh")>=0||y.indexOf("iPad")>=0||y.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=y.indexOf("Linux")>=0,o=!0,A=navigator.language,h=A;else if(typeof O=="object"){le=O.platform==="win32",K=O.platform==="darwin",p=O.platform==="linux",he=p&&!!O.env.SNAP&&!!O.env.SNAP_REVISION,A=Se,h=Se;const L=O.env.VSCODE_NLS_CONFIG;if(L)try{const V=JSON.parse(L),H=V.availableLanguages["*"];A=V.locale,h=H||Se,m=V._translationsConfigFile}catch(V){}oe=!0}else console.error("Unable to resolve platform.");let W=0;K?W=1:le?W=3:p&&(W=2);const I=le,M=K,w=p,D=oe,re=o,ie=x,J=y,ue=function(){if(S.setImmediate)return S.setImmediate.bind(S);if(typeof S.postMessage=="function"&&!S.importScripts){let H=[];S.addEventListener("message",j=>{if(j.data&&j.data.vscodeSetImmediateId)for(let v=0,g=H.length;v<g;v++){const U=H[v];if(U.id===j.data.vscodeSetImmediateId){H.splice(v,1),U.callback();return}}});let ee=0;return j=>{const v=++ee;H.push({id:v,callback:j}),S.postMessage({vscodeSetImmediateId:v},"*")}}if(typeof(O==null?void 0:O.nextTick)=="function")return O.nextTick.bind(O);const V=Promise.resolve();return H=>V.then(H)}(),ge=K||x?2:le?1:3;let Ee=!0,Ne=!1;function Y(){if(!Ne){Ne=!0;const L=new Uint8Array(2);L[0]=1,L[1]=2,Ee=new Uint16Array(L.buffer)[0]===513}return Ee}},95830:function(yn,yt,T){"use strict";T.d(yt,{G:function(){return Se}});var k=T(23345);const ce=k.li.performance&&typeof k.li.performance.now=="function";class Se{constructor(K){this._highResolution=ce&&K,this._startTime=this._now(),this._stopTime=-1}static create(K=!0){return new Se(K)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?k.li.performance.now():Date.now()}}},82983:function(yn,yt,T){"use strict";T.d(yt,{$i:function(){return Be},C8:function(){return vt},GF:function(){return A},HO:function(){return ee},IO:function(){return h},K7:function(){return gt},Kw:function(){return ot},LC:function(){return S},Mh:function(){return ue},P1:function(){return ge},PJ:function(){return nt},Qe:function(){return Ge},R1:function(){return x},RP:function(){return U},S6:function(){return Tt},TT:function(){return I},Ut:function(){return v},V8:function(){return O},WU:function(){return Se},YK:function(){return Ne},YU:function(){return le},ZG:function(){return Ee},ZH:function(){return L},ab:function(){return Qe},c1:function(){return we},df:function(){return re},ec:function(){return K},fi:function(){return Ke},fy:function(){return p},j3:function(){return he},j_:function(){return w},m5:function(){return k},mK:function(){return D},mr:function(){return m},oH:function(){return F},oL:function(){return oe},ok:function(){return J},ow:function(){return G},qq:function(){return ie},qu:function(){return W},rL:function(){return Y},uS:function(){return _t},un:function(){return o},uq:function(){return y},vH:function(){return H},xe:function(){return et},zY:function(){return M}});function k(R){return!R||typeof R!="string"?!0:R.trim().length===0}const ce=/{(\d+)}/g;function Se(R,...ne){return ne.length===0?R:R.replace(ce,function(be,P){const C=parseInt(P,10);return isNaN(C)||C<0||C>=ne.length?be:ne[C]})}function le(R){return R.replace(/[<>&]/g,function(ne){switch(ne){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return ne}})}function K(R){return R.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(R,ne=" "){const be=he(R,ne);return oe(be,ne)}function he(R,ne){if(!R||!ne)return R;const be=ne.length;if(be===0||R.length===0)return R;let P=0;for(;R.indexOf(ne,P)===P;)P=P+be;return R.substring(P)}function oe(R,ne){if(!R||!ne)return R;const be=ne.length,P=R.length;if(be===0||P===0)return R;let C=P,X=-1;for(;X=R.lastIndexOf(ne,C-1),!(X===-1||X+be!==C);){if(X===0)return"";C=X}return R.substring(0,C)}function o(R){return R.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function x(R){return R.replace(/\*/g,"")}function A(R,ne,be={}){if(!R)throw new Error("Cannot create regex from empty string");ne||(R=K(R)),be.wholeWord&&(/\B/.test(R.charAt(0))||(R="\\b"+R),/\B/.test(R.charAt(R.length-1))||(R=R+"\\b"));let P="";return be.global&&(P+="g"),be.matchCase||(P+="i"),be.multiline&&(P+="m"),be.unicode&&(P+="u"),new RegExp(R,P)}function h(R){return R.source==="^"||R.source==="^$"||R.source==="$"||R.source==="^\\s*$"?!1:!!(R.exec("")&&R.lastIndex===0)}function m(R){return(R.global?"g":"")+(R.ignoreCase?"i":"")+(R.multiline?"m":"")+(R.unicode?"u":"")}function y(R){return R.split(/\r\n|\r|\n/)}function S(R){for(let ne=0,be=R.length;ne<be;ne++){const P=R.charCodeAt(ne);if(P!==32&&P!==9)return ne}return-1}function O(R,ne=0,be=R.length){for(let P=ne;P<be;P++){const C=R.charCodeAt(P);if(C!==32&&C!==9)return R.substring(ne,P)}return R.substring(ne,be)}function G(R,ne=R.length-1){for(let be=ne;be>=0;be--){const P=R.charCodeAt(be);if(P!==32&&P!==9)return be}return-1}function W(R,ne){return R<ne?-1:R>ne?1:0}function I(R,ne,be=0,P=R.length,C=0,X=ne.length){for(;be<P&&C<X;be++,C++){let se=R.charCodeAt(be),me=ne.charCodeAt(C);if(se<me)return-1;if(se>me)return 1}const q=P-be,Q=X-C;return q<Q?-1:q>Q?1:0}function M(R,ne){return w(R,ne,0,R.length,0,ne.length)}function w(R,ne,be=0,P=R.length,C=0,X=ne.length){for(;be<P&&C<X;be++,C++){let se=R.charCodeAt(be),me=ne.charCodeAt(C);if(se===me)continue;if(se>=128||me>=128)return I(R.toLowerCase(),ne.toLowerCase(),be,P,C,X);D(se)&&(se-=32),D(me)&&(me-=32);const Ce=se-me;if(Ce!==0)return Ce}const q=P-be,Q=X-C;return q<Q?-1:q>Q?1:0}function D(R){return R>=97&&R<=122}function re(R){return R>=65&&R<=90}function ie(R,ne){return R.length===ne.length&&w(R,ne)===0}function J(R,ne){const be=ne.length;return ne.length>R.length?!1:w(R,ne,0,be)===0}function ue(R,ne){let be,P=Math.min(R.length,ne.length);for(be=0;be<P;be++)if(R.charCodeAt(be)!==ne.charCodeAt(be))return be;return P}function ge(R,ne){let be,P=Math.min(R.length,ne.length);const C=R.length-1,X=ne.length-1;for(be=0;be<P;be++)if(R.charCodeAt(C-be)!==ne.charCodeAt(X-be))return be;return P}function Ee(R){return 55296<=R&&R<=56319}function Ne(R){return 56320<=R&&R<=57343}function Y(R,ne){return(R-55296<<10)+(ne-56320)+65536}function L(R,ne,be){const P=R.charCodeAt(be);if(Ee(P)&&be+1<ne){const C=R.charCodeAt(be+1);if(Ne(C))return Y(P,C)}return P}function V(R,ne){const be=R.charCodeAt(ne-1);if(Ne(be)&&ne>1){const P=R.charCodeAt(ne-2);if(Ee(P))return Y(P,be)}return be}function H(R,ne){const be=_e.getInstance(),P=ne,C=R.length,X=L(R,C,ne);ne+=X>=65536?2:1;let q=be.getGraphemeBreakType(X);for(;ne<C;){const Q=L(R,C,ne),se=be.getGraphemeBreakType(Q);if(Ke(q,se))break;ne+=Q>=65536?2:1,q=se}return ne-P}function ee(R,ne){const be=_e.getInstance(),P=ne,C=V(R,ne);ne-=C>=65536?2:1;let X=be.getGraphemeBreakType(C);for(;ne>0;){const q=V(R,ne),Q=be.getGraphemeBreakType(q);if(Ke(Q,X))break;ne-=q>=65536?2:1,X=Q}return P-ne}const j=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function v(R){return j.test(R)}const g=/(?:[\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 U(R){return g.test(R)}const te=/^[\t\n\r\x20-\x7E]*$/;function Be(R){return te.test(R)}const Ge=/[\u2028\u2029]/;function Qe(R){return Ge.test(R)}function et(R){for(let ne=0,be=R.length;ne<be;ne++)if(gt(R.charCodeAt(ne)))return!0;return!1}function gt(R){return R=+R,R>=11904&&R<=55215||R>=63744&&R<=64255||R>=65281&&R<=65374}function vt(R){return R>=127462&&R<=127487||R===8986||R===8987||R===9200||R===9203||R>=9728&&R<=10175||R===11088||R===11093||R>=127744&&R<=128591||R>=128640&&R<=128764||R>=128992&&R<=129003||R>=129280&&R<=129535||R>=129648&&R<=129750}const we="\uFEFF";function _t(R){return!!(R&&R.length>0&&R.charCodeAt(0)===65279)}function ot(R,ne=!1){return R?(ne&&(R=R.replace(/\\./g,"")),R.toLowerCase()!==R):!1}function nt(R){return R=R%(2*26),R<26?String.fromCharCode(97+R):String.fromCharCode(65+R-26)}function Tt(R){return _e.getInstance().getGraphemeBreakType(R)}function Ke(R,ne){return R===0?ne!==5&&ne!==7:R===2&&ne===3?!1:R===4||R===2||R===3||ne===4||ne===2||ne===3?!0:!(R===8&&(ne===8||ne===9||ne===11||ne===12)||(R===11||R===9)&&(ne===9||ne===10)||(R===12||R===10)&&ne===10||ne===5||ne===13||ne===7||R===1||R===13&&ne===14||R===6&&ne===6)}class _e{constructor(){this._data=ve()}static getInstance(){return _e._INSTANCE||(_e._INSTANCE=new _e),_e._INSTANCE}getGraphemeBreakType(ne){if(ne<32)return ne===10?3:ne===13?2:4;if(ne<127)return 0;const be=this._data,P=be.length/3;let C=1;for(;C<=P;)if(ne<be[3*C])C=2*C;else if(ne>be[3*C+1])C=2*C+1;else return be[3*C+2];return 0}}_e._INSTANCE=null;function ve(){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 F(R,ne){if(R===0)return 0;const be=xe(R,ne);if(be!==void 0)return be;const P=V(ne,R);return R-=ke(P),R}function xe(R,ne){let be=V(ne,R);for(R-=ke(be);$(be)||be===65039||be===8419;){if(R===0)return;be=V(ne,R),R-=ke(be)}if(vt(be)){if(R>=0){const P=V(ne,R);P===8205&&(R-=ke(P))}return R}}function ke(R){return R>=65536?2:1}function $(R){return 127995<=R&&R<=127999}},72999:function(yn,yt,T){"use strict";T.d(yt,{$E:function(){return S},$K:function(){return he},D8:function(){return h},HD:function(){return ce},IU:function(){return O},Jp:function(){return oe},Kn:function(){return Se},cW:function(){return x},f6:function(){return G},hj:function(){return le},jn:function(){return K},kJ:function(){return k},mf:function(){return A},o8:function(){return p},p_:function(){return o},vE:function(){return W}});function k(I){return Array.isArray(I)}function ce(I){return typeof I=="string"}function Se(I){return typeof I=="object"&&I!==null&&!Array.isArray(I)&&!(I instanceof RegExp)&&!(I instanceof Date)}function le(I){return typeof I=="number"&&!isNaN(I)}function K(I){return I===!0||I===!1}function p(I){return typeof I=="undefined"}function he(I){return!oe(I)}function oe(I){return p(I)||I===null}function o(I,M){if(!I)throw new Error(M?`Unexpected type, expected '${M}'`:"Unexpected type")}function x(I){if(oe(I))throw new Error("Assertion Failed: argument is undefined or null");return I}function A(I){return typeof I=="function"}function h(I,M){const w=Math.min(I.length,M.length);for(let D=0;D<w;D++)m(I[D],M[D])}function m(I,M){if(ce(M)){if(typeof I!==M)throw new Error(`argument does not match constraint: typeof ${M}`)}else if(A(M)){try{if(I instanceof M)return}catch(w){}if(!oe(I)&&I.constructor===M||M.length===1&&M.call(void 0,I)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function y(I){let M=[],w=Object.getPrototypeOf(I);for(;Object.prototype!==w;)M=M.concat(Object.getOwnPropertyNames(w)),w=Object.getPrototypeOf(w);return M}function S(I){const M=[];for(const w of y(I))typeof I[w]=="function"&&M.push(w);return M}function O(I,M){const w=re=>function(){const ie=Array.prototype.slice.call(arguments,0);return M(re,ie)};let D={};for(const re of I)D[re]=w(re);return D}function G(I){return I===null?void 0:I}function W(I,M="Unreachable"){throw new Error(M)}},13268:function(yn,yt,T){"use strict";T.d(yt,{N:function(){return ce}});function k(Se,le){let K;return le.length===0?K=Se:K=Se.replace(/\{(\d+)\}/g,function(p,he){const oe=he[0];return typeof le[oe]!="undefined"?le[oe]:p}),K}function ce(Se,le,...K){return k(le,K)}},96236:function(yn,yt,T){"use strict";T.d(yt,{BH:function(){return O},NZ:function(){return G},U8:function(){return W},co:function(){return S},eH:function(){return y},vr:function(){return m}});var k=T(75918),ce=T(52615),Se=T(4348),le=T(88226),K=T(69323),p=T(34502),he=T(35884),oe=T(90689),o=T(16925),x=T(49055),A=function(I,M,w,D){var re=arguments.length,ie=re<3?M:D===null?D=Object.getOwnPropertyDescriptor(M,w):D,J;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ie=Reflect.decorate(I,M,w,D);else for(var ue=I.length-1;ue>=0;ue--)(J=I[ue])&&(ie=(re<3?J(ie):re>3?J(M,w,ie):J(M,w))||ie);return re>3&&ie&&Object.defineProperty(M,w,ie),ie},h=function(I,M){return function(w,D){M(w,D,I)}};function m(I){return I.command!==void 0}class y{constructor(M){this.id=y._idPool++,this._debugName=M}}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 S=(0,o.yh)("menuService"),O=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Se.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:I=>I===y.CommandPalette}}addCommand(I){return this.addCommands(le.$.single(I))}addCommands(I){for(const M of I)this._commands.set(M.id,M);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,K.OF)(()=>{let M=!1;for(const w of I)M=this._commands.delete(w.id)||M;M&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(I){return this._commands.get(I)}getCommands(){const I=new Map;return this._commands.forEach((M,w)=>I.set(w,M)),I}appendMenuItem(I,M){return this.appendMenuItems(le.$.single({id:I,item:M}))}appendMenuItems(I){const M=new Set,w=new p.S;for(const{id:D,item:re}of I){let ie=this._menuItems.get(D);ie||(ie=new p.S,this._menuItems.set(D,ie)),w.push(ie.push(re)),M.add(D)}return this._onDidChangeMenu.fire(M),(0,K.OF)(()=>{if(w.size>0){for(let D of w)D();this._onDidChangeMenu.fire(M),w.clear()}})}getMenuItems(I){let M;return this._menuItems.has(I)?M=[...this._menuItems.get(I)]:M=[],I===y.CommandPalette&&this._appendImplicitItems(M),M}_appendImplicitItems(I){const M=new Set;for(const w of I)m(w)&&(M.add(w.command.id),w.alt&&M.add(w.alt.id));this._commands.forEach((w,D)=>{M.has(D)||I.push({command:w})})}};class G extends k.wY{constructor(M,w,D,re){super(`submenuitem.${M.submenu.id}`,typeof M.title=="string"?M.title:M.title.value,[],"submenu"),this.item=M,this._menuService=w,this._contextKeyService=D,this._options=re}get actions(){const M=[],w=this._menuService.createMenu(this.item.submenu,this._contextKeyService),D=w.getActions(this._options);w.dispose();for(const[,re]of D)re.length>0&&(M.push(...re),M.push(new k.Z0));return M.length&&M.pop(),M}}let W=class Jo{constructor(M,w,D,re,ie){var J,ue;if(this._commandService=ie,this.id=M.id,this.label=D!=null&&D.renderShortTitle&&M.shortTitle?typeof M.shortTitle=="string"?M.shortTitle:M.shortTitle.value:typeof M.title=="string"?M.title:M.title.value,this.tooltip=(ue=typeof M.tooltip=="string"?M.tooltip:(J=M.tooltip)===null||J===void 0?void 0:J.value)!==null&&ue!==void 0?ue:"",this.enabled=!M.precondition||re.contextMatchesRules(M.precondition),this.checked=void 0,M.toggled){const ge=M.toggled.condition?M.toggled:{condition:M.toggled};this.checked=re.contextMatchesRules(ge.condition),this.checked&&ge.tooltip&&(this.tooltip=typeof ge.tooltip=="string"?ge.tooltip:ge.tooltip.value),ge.title&&(this.label=typeof ge.title=="string"?ge.title:ge.title.value)}this.item=M,this.alt=w?new Jo(w,void 0,D,re,ie):void 0,this._options=D,x.kS.isThemeIcon(M.icon)&&(this.class=ce.dT.asClassName(M.icon))}dispose(){}run(...M){var w,D;let re=[];return!((w=this._options)===null||w===void 0)&&w.arg&&(re=[...re,this._options.arg]),!((D=this._options)===null||D===void 0)&&D.shouldForwardArgs&&(re=[...re,...M]),this._commandService.executeCommand(this.id,...re)}};W=A([h(3,oe.i6),h(4,he.H)],W)},35884:function(yn,yt,T){"use strict";T.d(yt,{H:function(){return he},P:function(){return oe}});var k=T(4348),ce=T(88226),Se=T(69323),le=T(34502),K=T(72999),p=T(16925);const he=(0,p.yh)("commandService"),oe=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new k.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(o,x){if(!o)throw new Error("invalid command");if(typeof o=="string"){if(!x)throw new Error("invalid command");return this.registerCommand({id:o,handler:x})}if(o.description){const S=[];for(let G of o.description.args)S.push(G.constraint);const O=o.handler;o.handler=function(G,...W){return(0,K.D8)(W,S),O(G,...W)}}const{id:A}=o;let h=this._commands.get(A);h||(h=new le.S,this._commands.set(A,h));let m=h.unshift(o),y=(0,Se.OF)(()=>{m();const S=this._commands.get(A);S!=null&&S.isEmpty()&&this._commands.delete(A)});return this._onDidRegisterCommand.fire(A),y}registerCommandAlias(o,x){return oe.registerCommand(o,(A,...h)=>A.get(he).executeCommand(x,...h))}getCommand(o){const x=this._commands.get(o);if(!(!x||x.isEmpty()))return ce.$.first(x)}getCommands(){const o=new Map;for(const x of this._commands.keys()){const A=this.getCommand(x);A&&o.set(x,A)}return o}};oe.registerCommand("noop",()=>{})},90689:function(yn,yt,T){"use strict";T.d(yt,{Ao:function(){return he},Eq:function(){return Y},Fb:function(){return oe},K8:function(){return H},i6:function(){return Ne},uy:function(){return Ee}});var k=T(23345),ce=T(82983),Se=T(16925);let le=k.WE||"";const K=new Map;K.set("false",!1),K.set("true",!0),K.set("isMac",k.dz),K.set("isLinux",k.IJ),K.set("isWindows",k.ED),K.set("isWeb",k.$L),K.set("isMacNative",k.dz&&!k.$L),K.set("isEdge",le.indexOf("Edg/")>=0),K.set("isFirefox",le.indexOf("Firefox")>=0),K.set("isChrome",le.indexOf("Chrome")>=0),K.set("isSafari",le.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class he{static has(v){return h.create(v)}static equals(v,g){return m.create(v,g)}static regex(v,g){return re.create(v,g)}static not(v){return G.create(v)}static and(...v){return ue.create(v,null)}static or(...v){return ge.create(v,null,!0)}static deserialize(v,g=!1){if(v)return this._deserializeOrExpression(v,g)}static _deserializeOrExpression(v,g){let U=v.split("||");return ge.create(U.map(te=>this._deserializeAndExpression(te,g)),null,!0)}static _deserializeAndExpression(v,g){let U=v.split("&&");return ue.create(U.map(te=>this._deserializeOne(te,g)),null)}static _deserializeOne(v,g){if(v=v.trim(),v.indexOf("!=")>=0){let U=v.split("!=");return O.create(U[0].trim(),this._deserializeValue(U[1],g))}if(v.indexOf("==")>=0){let U=v.split("==");return m.create(U[0].trim(),this._deserializeValue(U[1],g))}if(v.indexOf("=~")>=0){let U=v.split("=~");return re.create(U[0].trim(),this._deserializeRegexValue(U[1],g))}if(v.indexOf(" in ")>=0){let U=v.split(" in ");return y.create(U[0].trim(),U[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(v)){const U=v.split(">=");return M.create(U[0].trim(),U[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(v)){const U=v.split(">");return I.create(U[0].trim(),U[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(v)){const U=v.split("<=");return D.create(U[0].trim(),U[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(v)){const U=v.split("<");return w.create(U[0].trim(),U[1].trim())}return/^\!\s*/.test(v)?G.create(v.substr(1).trim()):h.create(v)}static _deserializeValue(v,g){if(v=v.trim(),v==="true")return!0;if(v==="false")return!1;let U=/^'([^']*)'$/.exec(v);return U?U[1].trim():v}static _deserializeRegexValue(v,g){if((0,ce.m5)(v)){if(g)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let U=v.indexOf("/"),te=v.lastIndexOf("/");if(U===te||U<0){if(g)throw new Error(`bad regexp-value '${v}', missing /-enclosure`);return console.warn(`bad regexp-value '${v}', missing /-enclosure`),null}let Be=v.slice(U+1,te),Ge=v[te+1]==="i"?"i":"";try{return new RegExp(Be,Ge)}catch(Qe){if(g)throw new Error(`bad regexp-value '${v}', parse error: ${Qe}`);return console.warn(`bad regexp-value '${v}', parse error: ${Qe}`),null}}}function oe(j,v){const g=j?j.substituteConstants():void 0,U=v?v.substituteConstants():void 0;return!g&&!U?!0:!g||!U?!1:g.equals(U)}function o(j,v){return j.cmp(v)}class x{constructor(){this.type=0}cmp(v){return this.type-v.type}equals(v){return v.type===this.type}substituteConstants(){return this}evaluate(v){return!1}serialize(){return"false"}keys(){return[]}negate(){return A.INSTANCE}}x.INSTANCE=new x;class A{constructor(){this.type=1}cmp(v){return this.type-v.type}equals(v){return v.type===this.type}substituteConstants(){return this}evaluate(v){return!0}serialize(){return"true"}keys(){return[]}negate(){return x.INSTANCE}}A.INSTANCE=new A;class h{constructor(v,g){this.key=v,this.negated=g,this.type=2}static create(v,g=null){const U=K.get(v);return typeof U=="boolean"?U?A.INSTANCE:x.INSTANCE:new h(v,g)}cmp(v){return v.type!==this.type?this.type-v.type:L(this.key,v.key)}equals(v){return v.type===this.type?this.key===v.key:!1}substituteConstants(){const v=K.get(this.key);return typeof v=="boolean"?v?A.INSTANCE:x.INSTANCE:this}evaluate(v){return!!v.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=G.create(this.key,this)),this.negated}}class m{constructor(v,g,U){this.key=v,this.value=g,this.negated=U,this.type=4}static create(v,g,U=null){if(typeof g=="boolean")return g?h.create(v,U):G.create(v,U);const te=K.get(v);return typeof te=="boolean"?g===(te?"true":"false")?A.INSTANCE:x.INSTANCE:new m(v,g,U)}cmp(v){return v.type!==this.type?this.type-v.type:V(this.key,this.value,v.key,v.value)}equals(v){return v.type===this.type?this.key===v.key&&this.value===v.value:!1}substituteConstants(){const v=K.get(this.key);if(typeof v=="boolean"){const g=v?"true":"false";return this.value===g?A.INSTANCE:x.INSTANCE}return this}evaluate(v){return v.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(v,g){this.key=v,this.valueKey=g,this.type=10,this.negated=null}static create(v,g){return new y(v,g)}cmp(v){return v.type!==this.type?this.type-v.type:V(this.key,this.valueKey,v.key,v.valueKey)}equals(v){return v.type===this.type?this.key===v.key&&this.valueKey===v.valueKey:!1}substituteConstants(){return this}evaluate(v){const g=v.getValue(this.valueKey),U=v.getValue(this.key);return Array.isArray(g)?g.indexOf(U)>=0:typeof U=="string"&&typeof g=="object"&&g!==null?p.call(g,U):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=S.create(this)),this.negated}}class S{constructor(v){this._actual=v,this.type=11}static create(v){return new S(v)}cmp(v){return v.type!==this.type?this.type-v.type:this._actual.cmp(v._actual)}equals(v){return v.type===this.type?this._actual.equals(v._actual):!1}substituteConstants(){return this}evaluate(v){return!this._actual.evaluate(v)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class O{constructor(v,g,U){this.key=v,this.value=g,this.negated=U,this.type=5}static create(v,g,U=null){if(typeof g=="boolean")return g?G.create(v,U):h.create(v,U);const te=K.get(v);return typeof te=="boolean"?g===(te?"true":"false")?x.INSTANCE:A.INSTANCE:new O(v,g,U)}cmp(v){return v.type!==this.type?this.type-v.type:V(this.key,this.value,v.key,v.value)}equals(v){return v.type===this.type?this.key===v.key&&this.value===v.value:!1}substituteConstants(){const v=K.get(this.key);if(typeof v=="boolean"){const g=v?"true":"false";return this.value===g?x.INSTANCE:A.INSTANCE}return this}evaluate(v){return v.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=m.create(this.key,this.value,this)),this.negated}}class G{constructor(v,g){this.key=v,this.negated=g,this.type=3}static create(v,g=null){const U=K.get(v);return typeof U=="boolean"?U?x.INSTANCE:A.INSTANCE:new G(v,g)}cmp(v){return v.type!==this.type?this.type-v.type:L(this.key,v.key)}equals(v){return v.type===this.type?this.key===v.key:!1}substituteConstants(){const v=K.get(this.key);return typeof v=="boolean"?v?x.INSTANCE:A.INSTANCE:this}evaluate(v){return!v.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=h.create(this.key,this)),this.negated}}function W(j,v){if(typeof j=="string"){const g=parseFloat(j);isNaN(g)||(j=g)}return typeof j=="string"||typeof j=="number"?v(j):x.INSTANCE}class I{constructor(v,g,U){this.key=v,this.value=g,this.negated=U,this.type=12}static create(v,g,U=null){return W(g,te=>new I(v,te,U))}cmp(v){return v.type!==this.type?this.type-v.type:V(this.key,this.value,v.key,v.value)}equals(v){return v.type===this.type?this.key===v.key&&this.value===v.value:!1}substituteConstants(){return this}evaluate(v){return typeof this.value=="string"?!1:parseFloat(v.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=D.create(this.key,this.value,this)),this.negated}}class M{constructor(v,g,U){this.key=v,this.value=g,this.negated=U,this.type=13}static create(v,g,U=null){return W(g,te=>new M(v,te,U))}cmp(v){return v.type!==this.type?this.type-v.type:V(this.key,this.value,v.key,v.value)}equals(v){return v.type===this.type?this.key===v.key&&this.value===v.value:!1}substituteConstants(){return this}evaluate(v){return typeof this.value=="string"?!1:parseFloat(v.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=w.create(this.key,this.value,this)),this.negated}}class w{constructor(v,g,U){this.key=v,this.value=g,this.negated=U,this.type=14}static create(v,g,U=null){return W(g,te=>new w(v,te,U))}cmp(v){return v.type!==this.type?this.type-v.type:V(this.key,this.value,v.key,v.value)}equals(v){return v.type===this.type?this.key===v.key&&this.value===v.value:!1}substituteConstants(){return this}evaluate(v){return typeof this.value=="string"?!1:parseFloat(v.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=M.create(this.key,this.value,this)),this.negated}}class D{constructor(v,g,U){this.key=v,this.value=g,this.negated=U,this.type=15}static create(v,g,U=null){return W(g,te=>new D(v,te,U))}cmp(v){return v.type!==this.type?this.type-v.type:V(this.key,this.value,v.key,v.value)}equals(v){return v.type===this.type?this.key===v.key&&this.value===v.value:!1}substituteConstants(){return this}evaluate(v){return typeof this.value=="string"?!1:parseFloat(v.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=I.create(this.key,this.value,this)),this.negated}}class re{constructor(v,g){this.key=v,this.regexp=g,this.type=7,this.negated=null}static create(v,g){return new re(v,g)}cmp(v){if(v.type!==this.type)return this.type-v.type;if(this.key<v.key)return-1;if(this.key>v.key)return 1;const g=this.regexp?this.regexp.source:"",U=v.regexp?v.regexp.source:"";return g<U?-1:g>U?1:0}equals(v){if(v.type===this.type){const g=this.regexp?this.regexp.source:"",U=v.regexp?v.regexp.source:"";return this.key===v.key&&g===U}return!1}substituteConstants(){return this}evaluate(v){let g=v.getValue(this.key);return this.regexp?this.regexp.test(g):!1}serialize(){const v=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${v}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=ie.create(this)),this.negated}}class ie{constructor(v){this._actual=v,this.type=8}static create(v){return new ie(v)}cmp(v){return v.type!==this.type?this.type-v.type:this._actual.cmp(v._actual)}equals(v){return v.type===this.type?this._actual.equals(v._actual):!1}substituteConstants(){return this}evaluate(v){return!this._actual.evaluate(v)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function J(j){let v=null;for(let g=0,U=j.length;g<U;g++){const te=j[g].substituteConstants();if(j[g]!==te&&v===null){v=[];for(let Be=0;Be<g;Be++)v[Be]=j[Be]}v!==null&&(v[g]=te)}return v===null?j:v}class ue{constructor(v,g){this.expr=v,this.negated=g,this.type=6}static create(v,g){return ue._normalizeArr(v,g)}cmp(v){if(v.type!==this.type)return this.type-v.type;if(this.expr.length<v.expr.length)return-1;if(this.expr.length>v.expr.length)return 1;for(let g=0,U=this.expr.length;g<U;g++){const te=o(this.expr[g],v.expr[g]);if(te!==0)return te}return 0}equals(v){if(v.type===this.type){if(this.expr.length!==v.expr.length)return!1;for(let g=0,U=this.expr.length;g<U;g++)if(!this.expr[g].equals(v.expr[g]))return!1;return!0}return!1}substituteConstants(){const v=J(this.expr);return v===this.expr?this:ue.create(v,this.negated)}evaluate(v){for(let g=0,U=this.expr.length;g<U;g++)if(!this.expr[g].evaluate(v))return!1;return!0}static _normalizeArr(v,g){const U=[];let te=!1;for(const Be of v)if(Be){if(Be.type===1){te=!0;continue}if(Be.type===0)return x.INSTANCE;if(Be.type===6){U.push(...Be.expr);continue}U.push(Be)}if(U.length===0&&te)return A.INSTANCE;if(U.length!==0){if(U.length===1)return U[0];U.sort(o);for(let Be=1;Be<U.length;Be++)U[Be-1].equals(U[Be])&&(U.splice(Be,1),Be--);if(U.length===1)return U[0];for(;U.length>1;){const Be=U[U.length-1];if(Be.type!==9)break;U.pop();const Ge=U.pop(),Qe=U.length===0,et=ge.create(Be.expr.map(gt=>ue.create([gt,Ge],null)),null,Qe);et&&(U.push(et),U.sort(o))}return U.length===1?U[0]:new ue(U,g)}}serialize(){return this.expr.map(v=>v.serialize()).join(" && ")}keys(){const v=[];for(let g of this.expr)v.push(...g.keys());return v}negate(){if(!this.negated){const v=[];for(let g of this.expr)v.push(g.negate());this.negated=ge.create(v,this,!0)}return this.negated}}class ge{constructor(v,g){this.expr=v,this.negated=g,this.type=9}static create(v,g,U){return ge._normalizeArr(v,g,U)}cmp(v){if(v.type!==this.type)return this.type-v.type;if(this.expr.length<v.expr.length)return-1;if(this.expr.length>v.expr.length)return 1;for(let g=0,U=this.expr.length;g<U;g++){const te=o(this.expr[g],v.expr[g]);if(te!==0)return te}return 0}equals(v){if(v.type===this.type){if(this.expr.length!==v.expr.length)return!1;for(let g=0,U=this.expr.length;g<U;g++)if(!this.expr[g].equals(v.expr[g]))return!1;return!0}return!1}substituteConstants(){const v=J(this.expr);return v===this.expr?this:ge.create(v,this.negated,!1)}evaluate(v){for(let g=0,U=this.expr.length;g<U;g++)if(this.expr[g].evaluate(v))return!0;return!1}static _normalizeArr(v,g,U){let te=[],Be=!1;if(v){for(let Ge=0,Qe=v.length;Ge<Qe;Ge++){const et=v[Ge];if(et){if(et.type===0){Be=!0;continue}if(et.type===1)return A.INSTANCE;if(et.type===9){te=te.concat(et.expr);continue}te.push(et)}}if(te.length===0&&Be)return x.INSTANCE;te.sort(o)}if(te.length!==0){if(te.length===1)return te[0];for(let Ge=1;Ge<te.length;Ge++)te[Ge-1].equals(te[Ge])&&(te.splice(Ge,1),Ge--);if(te.length===1)return te[0];if(U){for(let Ge=0;Ge<te.length;Ge++)for(let Qe=Ge+1;Qe<te.length;Qe++)H(te[Ge],te[Qe])&&(te.splice(Qe,1),Qe--);if(te.length===1)return te[0]}return new ge(te,g)}}serialize(){return this.expr.map(v=>v.serialize()).join(" || ")}keys(){const v=[];for(let g of this.expr)v.push(...g.keys());return v}negate(){if(!this.negated){let v=[];for(let g of this.expr)v.push(g.negate());for(;v.length>1;){const g=v.shift(),U=v.shift(),te=[];for(const Ge of ee(g))for(const Qe of ee(U))te.push(ue.create([Ge,Qe],null));const Be=v.length===0;v.unshift(ge.create(te,null,Be))}this.negated=v[0]}return this.negated}}class Ee extends h{constructor(v,g,U){super(v,null),this._defaultValue=g,typeof U=="object"?Ee._info.push(Object.assign(Object.assign({},U),{key:v})):U!==!0&&Ee._info.push({key:v,description:U,type:g!=null?typeof g:void 0})}static all(){return Ee._info.values()}bindTo(v){return v.createKey(this.key,this._defaultValue)}getValue(v){return v.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(v){return m.create(this.key,v)}}Ee._info=[];const Ne=(0,Se.yh)("contextKeyService"),Y="setContext";function L(j,v){return j<v?-1:j>v?1:0}function V(j,v,g,U){return j<g?-1:j>g?1:v<U?-1:v>U?1:0}function H(j,v){if(v.type===6&&j.type!==9&&j.type!==6){for(const te of v.expr)if(j.equals(te))return!0}const g=j.negate(),U=ee(g).concat(ee(v));U.sort(o);for(let te=0;te<U.length;te++){const Ge=U[te].negate();for(let Qe=te+1;Qe<U.length;Qe++){const et=U[Qe];if(Ge.equals(et))return!0}}return!1}function ee(j){return j.type===9?j.expr:[j]}},16925:function(yn,yt,T){"use strict";T.d(yt,{I8:function(){return k},TG:function(){return ce},jt:function(){return K},yh:function(){return le}});var k;(function(p){p.serviceIds=new Map,p.DI_TARGET="$di$target",p.DI_DEPENDENCIES="$di$dependencies";function he(oe){return oe[p.DI_DEPENDENCIES]||[]}p.getServiceDependencies=he})(k||(k={}));const ce=le("instantiationService");function Se(p,he,oe,o){he[k.DI_TARGET]===he?he[k.DI_DEPENDENCIES].push({id:p,index:oe,optional:o}):(he[k.DI_DEPENDENCIES]=[{id:p,index:oe,optional:o}],he[k.DI_TARGET]=he)}function le(p){if(k.serviceIds.has(p))return k.serviceIds.get(p);const he=function(oe,o,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Se(he,oe,x,!1)};return he.toString=()=>p,k.serviceIds.set(p,he),he}function K(p){return function(he,oe,o){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Se(p,he,o,!0)}}},44650:function(yn,yt,T){"use strict";T.d(yt,{B:function(){return le}});var k=T(76068),ce=T(72999);class Se{constructor(){this.data=new Map}add(p,he){k.ok(ce.HD(p)),k.ok(ce.Kn(he)),k.ok(!this.data.has(p),"There is already an extension with this id"),this.data.set(p,he)}as(p){return this.data.get(p)||null}}const le=new Se},66213:function(yn,yt,T){"use strict";T.d(yt,{e:function(){return k}});var k;(function(ce){ce.DARK="dark",ce.LIGHT="light",ce.HIGH_CONTRAST="hc"})(k||(k={}))},49055:function(yn,yt,T){"use strict";T.d(yt,{EN:function(){return o},IP:function(){return h},Ic:function(){return S},XE:function(){return he},bB:function(){return O},kS:function(){return x},m6:function(){return A}});var k=T(52615),ce=T(4348),Se=T(69323),le=T(16925),K=T(44650),p=T(66213);const he=(0,le.yh)("themeService");var oe;(function(G){function W(I){return I&&typeof I=="object"&&typeof I.id=="string"}G.isThemeColor=W})(oe||(oe={}));function o(G){return{id:G}}var x;(function(G){function W(ie){return ie&&typeof ie=="object"&&typeof ie.id=="string"&&(typeof ie.color=="undefined"||oe.isThemeColor(ie.color))}G.isThemeIcon=W;const I=new RegExp(`^\\$\\((${k.dT.iconNameExpression}(?:${k.dT.iconModifierExpression})?)\\)$`);function M(ie){const J=I.exec(ie);if(!J)return;let[,ue]=J;return{id:ue}}G.fromString=M;function w(ie,J){let ue=ie.id;const ge=ue.lastIndexOf("~");return ge!==-1&&(ue=ue.substring(0,ge)),J&&(ue=`${ue}~${J}`),{id:ue}}G.modify=w;function D(ie,J){var ue,ge;return ie.id===J.id&&((ue=ie.color)===null||ue===void 0?void 0:ue.id)===((ge=J.color)===null||ge===void 0?void 0:ge.id)}G.isEqual=D;function re(ie,J){return{id:ie.id,color:J?o(J):void 0}}G.asThemeIcon=re,G.asClassNameArray=k.dT.asClassNameArray,G.asClassName=k.dT.asClassName,G.asCSSSelector=k.dT.asCSSSelector})(x||(x={}));function A(G){switch(G){case p.e.DARK:return"vs-dark";case p.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const h={ThemingContribution:"base.contributions.theming"};class m{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new ce.Q5}onColorThemeChange(W){return this.themingParticipants.push(W),this.onThemingParticipantAddedEmitter.fire(W),(0,Se.OF)(()=>{const I=this.themingParticipants.indexOf(W);this.themingParticipants.splice(I,1)})}getThemingParticipants(){return this.themingParticipants}}let y=new m;K.B.add(h.ThemingContribution,y);function S(G){return y.onColorThemeChange(G)}class O extends Se.JT{constructor(W){super(),this.themeService=W,this.theme=W.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(I=>this.onThemeChange(I)))}onThemeChange(W){this.theme=W,this.updateStyles()}updateStyles(){}}},96478:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return ie}});var k=T(14809),ce=T(4635),Se=T(50298),le=T(62646),K=T(65966),p=T(92310),he=T.n(p),oe=T(8654),o=T(59301),x=T(10228),A=T(16089),h=x.Z.ESC,m=x.Z.TAB;function y(J){var ue=J.visible,ge=J.triggerRef,Ee=J.onVisibleChange,Ne=J.autoFocus,Y=J.overlayRef,L=o.useRef(!1),V=function(){if(ue){var v,g;(v=ge.current)===null||v===void 0||(g=v.focus)===null||g===void 0||g.call(v),Ee==null||Ee(!1)}},H=function(){var v;return(v=Y.current)!==null&&v!==void 0&&v.focus?(Y.current.focus(),L.current=!0,!0):!1},ee=function(v){switch(v.keyCode){case h:V();break;case m:{var g=!1;L.current||(g=H()),g?v.preventDefault():V();break}}};o.useEffect(function(){return ue?(window.addEventListener("keydown",ee),Ne&&(0,A.Z)(H,3),function(){window.removeEventListener("keydown",ee),L.current=!1}):function(){L.current=!1}},[ue])}var S=(0,o.forwardRef)(function(J,ue){var ge=J.overlay,Ee=J.arrow,Ne=J.prefixCls,Y=(0,o.useMemo)(function(){var V;return typeof ge=="function"?V=ge():V=ge,V},[ge]),L=(0,oe.sQ)(ue,(0,oe.C4)(Y));return o.createElement(o.Fragment,null,Ee&&o.createElement("div",{className:"".concat(Ne,"-arrow")}),o.cloneElement(Y,{ref:(0,oe.Yr)(Y)?L:void 0}))}),O=S,G={adjustX:1,adjustY:1},W=[0,0],I={topLeft:{points:["bl","tl"],overflow:G,offset:[0,-4],targetOffset:W},top:{points:["bc","tc"],overflow:G,offset:[0,-4],targetOffset:W},topRight:{points:["br","tr"],overflow:G,offset:[0,-4],targetOffset:W},bottomLeft:{points:["tl","bl"],overflow:G,offset:[0,4],targetOffset:W},bottom:{points:["tc","bc"],overflow:G,offset:[0,4],targetOffset:W},bottomRight:{points:["tr","br"],overflow:G,offset:[0,4],targetOffset:W}},M=I,w=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function D(J,ue){var ge,Ee=J.arrow,Ne=Ee===void 0?!1:Ee,Y=J.prefixCls,L=Y===void 0?"rc-dropdown":Y,V=J.transitionName,H=J.animation,ee=J.align,j=J.placement,v=j===void 0?"bottomLeft":j,g=J.placements,U=g===void 0?M:g,te=J.getPopupContainer,Be=J.showAction,Ge=J.hideAction,Qe=J.overlayClassName,et=J.overlayStyle,gt=J.visible,vt=J.trigger,we=vt===void 0?["hover"]:vt,_t=J.autoFocus,ot=J.overlay,nt=J.children,Tt=J.onVisibleChange,Ke=(0,le.Z)(J,w),_e=o.useState(),ve=(0,Se.Z)(_e,2),F=ve[0],xe=ve[1],ke="visible"in J?gt:F,$=o.useRef(null),R=o.useRef(null),ne=o.useRef(null);o.useImperativeHandle(ue,function(){return $.current});var be=function(Ie){xe(Ie),Tt==null||Tt(Ie)};y({visible:ke,triggerRef:ne,onVisibleChange:be,autoFocus:_t,overlayRef:R});var P=function(Ie){var De=J.onOverlayClick;xe(!1),De&&De(Ie)},C=function(){return o.createElement(O,{ref:R,overlay:ot,prefixCls:L,arrow:Ne})},X=function(){return typeof ot=="function"?C:C()},q=function(){var Ie=J.minOverlayWidthMatchTrigger,De=J.alignPoint;return"minOverlayWidthMatchTrigger"in J?Ie:!De},Q=function(){var Ie=J.openClassName;return Ie!==void 0?Ie:"".concat(L,"-open")},se=o.cloneElement(nt,{className:he()((ge=nt.props)===null||ge===void 0?void 0:ge.className,ke&&Q()),ref:(0,oe.Yr)(nt)?(0,oe.sQ)(ne,(0,oe.C4)(nt)):void 0}),me=Ge;return!me&&we.indexOf("contextMenu")!==-1&&(me=["click"]),o.createElement(K.Z,(0,k.Z)({builtinPlacements:U},Ke,{prefixCls:L,ref:$,popupClassName:he()(Qe,(0,ce.Z)({},"".concat(L,"-show-arrow"),Ne)),popupStyle:et,action:we,showAction:Be,hideAction:me,popupPlacement:v,popupAlign:ee,popupTransitionName:V,popupAnimation:H,popupVisible:ke,stretch:q()?"minWidth":"",popup:X(),onPopupVisibleChange:be,onPopupClick:P,getPopupContainer:te}),se)}var re=o.forwardRef(D),ie=re},66003:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return he}});var k=T(62646),ce=T(20439),Se=T(93664),le=T(59301),K=["show"];function p(oe,o){if(!o.max)return!0;var x=o.strategy(oe);return x<=o.max}function he(oe,o){return le.useMemo(function(){var x={};o&&(x.show=(0,Se.Z)(o)==="object"&&o.formatter?o.formatter:!!o),x=(0,ce.Z)((0,ce.Z)({},x),oe);var A=x,h=A.show,m=(0,k.Z)(A,K);return(0,ce.Z)((0,ce.Z)({},m),{},{show:!!h,showFormatter:typeof h=="function"?h:void 0,strategy:m.strategy||function(y){return y.length}})},[oe,o])}},36901:function(yn,yt,T){"use strict";T.r(yt),T.d(yt,{BaseInput:function(){return x},default:function(){return M}});var k=T(20439),ce=T(14809),Se=T(4635),le=T(93664),K=T(92310),p=T.n(K),he=T(59301),oe=T(30292),o=he.forwardRef(function(w,D){var re,ie,J,ue=w.inputElement,ge=w.children,Ee=w.prefixCls,Ne=w.prefix,Y=w.suffix,L=w.addonBefore,V=w.addonAfter,H=w.className,ee=w.style,j=w.disabled,v=w.readOnly,g=w.focused,U=w.triggerFocus,te=w.allowClear,Be=w.value,Ge=w.handleReset,Qe=w.hidden,et=w.classes,gt=w.classNames,vt=w.dataAttrs,we=w.styles,_t=w.components,ot=w.onClear,nt=ge!=null?ge:ue,Tt=(_t==null?void 0:_t.affixWrapper)||"span",Ke=(_t==null?void 0:_t.groupWrapper)||"span",_e=(_t==null?void 0:_t.wrapper)||"span",ve=(_t==null?void 0:_t.groupAddon)||"span",F=(0,he.useRef)(null),xe=function(ze){var je;(je=F.current)!==null&&je!==void 0&&je.contains(ze.target)&&(U==null||U())},ke=(0,oe.X3)(w),$=(0,he.cloneElement)(nt,{value:Be,className:p()((re=nt.props)===null||re===void 0?void 0:re.className,!ke&&(gt==null?void 0:gt.variant))||null}),R=(0,he.useRef)(null);if(he.useImperativeHandle(D,function(){return{nativeElement:R.current||F.current}}),ke){var ne=null;if(te){var be=!j&&!v&&Be,P="".concat(Ee,"-clear-icon"),C=(0,le.Z)(te)==="object"&&te!==null&&te!==void 0&&te.clearIcon?te.clearIcon:"\u2716";ne=he.createElement("button",{type:"button",tabIndex:-1,onClick:function(ze){Ge==null||Ge(ze),ot==null||ot()},onMouseDown:function(ze){return ze.preventDefault()},className:p()(P,(0,Se.Z)((0,Se.Z)({},"".concat(P,"-hidden"),!be),"".concat(P,"-has-suffix"),!!Y))},C)}var X="".concat(Ee,"-affix-wrapper"),q=p()(X,(0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)({},"".concat(Ee,"-disabled"),j),"".concat(X,"-disabled"),j),"".concat(X,"-focused"),g),"".concat(X,"-readonly"),v),"".concat(X,"-input-with-clear-btn"),Y&&te&&Be),et==null?void 0:et.affixWrapper,gt==null?void 0:gt.affixWrapper,gt==null?void 0:gt.variant),Q=(Y||te)&&he.createElement("span",{className:p()("".concat(Ee,"-suffix"),gt==null?void 0:gt.suffix),style:we==null?void 0:we.suffix},ne,Y);$=he.createElement(Tt,(0,ce.Z)({className:q,style:we==null?void 0:we.affixWrapper,onClick:xe},vt==null?void 0:vt.affixWrapper,{ref:F}),Ne&&he.createElement("span",{className:p()("".concat(Ee,"-prefix"),gt==null?void 0:gt.prefix),style:we==null?void 0:we.prefix},Ne),$,Q)}if((0,oe.He)(w)){var se="".concat(Ee,"-group"),me="".concat(se,"-addon"),Ce="".concat(se,"-wrapper"),Ie=p()("".concat(Ee,"-wrapper"),se,et==null?void 0:et.wrapper,gt==null?void 0:gt.wrapper),De=p()(Ce,(0,Se.Z)({},"".concat(Ce,"-disabled"),j),et==null?void 0:et.group,gt==null?void 0:gt.groupWrapper);$=he.createElement(Ke,{className:De,ref:R},he.createElement(_e,{className:Ie},L&&he.createElement(ve,{className:me},L),$,V&&he.createElement(ve,{className:me},V)))}return he.cloneElement($,{className:p()((ie=$.props)===null||ie===void 0?void 0:ie.className,H)||null,style:(0,k.Z)((0,k.Z)({},(J=$.props)===null||J===void 0?void 0:J.style),ee),hidden:Qe})}),x=o,A=T(95190),h=T(50298),m=T(62646),y=T(18929),S=T(2738),O=T(66003),G=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],W=(0,he.forwardRef)(function(w,D){var re=w.autoComplete,ie=w.onChange,J=w.onFocus,ue=w.onBlur,ge=w.onPressEnter,Ee=w.onKeyDown,Ne=w.onKeyUp,Y=w.prefixCls,L=Y===void 0?"rc-input":Y,V=w.disabled,H=w.htmlSize,ee=w.className,j=w.maxLength,v=w.suffix,g=w.showCount,U=w.count,te=w.type,Be=te===void 0?"text":te,Ge=w.classes,Qe=w.classNames,et=w.styles,gt=w.onCompositionStart,vt=w.onCompositionEnd,we=(0,m.Z)(w,G),_t=(0,he.useState)(!1),ot=(0,h.Z)(_t,2),nt=ot[0],Tt=ot[1],Ke=(0,he.useRef)(!1),_e=(0,he.useRef)(!1),ve=(0,he.useRef)(null),F=(0,he.useRef)(null),xe=function(Ut){ve.current&&(0,oe.nH)(ve.current,Ut)},ke=(0,y.Z)(w.defaultValue,{value:w.value}),$=(0,h.Z)(ke,2),R=$[0],ne=$[1],be=R==null?"":String(R),P=(0,he.useState)(null),C=(0,h.Z)(P,2),X=C[0],q=C[1],Q=(0,O.Z)(U,g),se=Q.max||j,me=Q.strategy(be),Ce=!!se&&me>se;(0,he.useImperativeHandle)(D,function(){var at;return{focus:xe,blur:function(){var Me;(Me=ve.current)===null||Me===void 0||Me.blur()},setSelectionRange:function(Me,Te,Re){var B;(B=ve.current)===null||B===void 0||B.setSelectionRange(Me,Te,Re)},select:function(){var Me;(Me=ve.current)===null||Me===void 0||Me.select()},input:ve.current,nativeElement:((at=F.current)===null||at===void 0?void 0:at.nativeElement)||ve.current}}),(0,he.useEffect)(function(){_e.current&&(_e.current=!1),Tt(function(at){return at&&V?!1:at})},[V]);var Ie=function(Ut,Me,Te){var Re=Me;if(!Ke.current&&Q.exceedFormatter&&Q.max&&Q.strategy(Me)>Q.max){if(Re=Q.exceedFormatter(Me,{max:Q.max}),Me!==Re){var B,z;q([((B=ve.current)===null||B===void 0?void 0:B.selectionStart)||0,((z=ve.current)===null||z===void 0?void 0:z.selectionEnd)||0])}}else if(Te.source==="compositionEnd")return;ne(Re),ve.current&&(0,oe.rJ)(ve.current,Ut,ie,Re)};(0,he.useEffect)(function(){if(X){var at;(at=ve.current)===null||at===void 0||at.setSelectionRange.apply(at,(0,A.Z)(X))}},[X]);var De=function(Ut){Ie(Ut,Ut.target.value,{source:"change"})},Fe=function(Ut){Ke.current=!1,Ie(Ut,Ut.currentTarget.value,{source:"compositionEnd"}),vt==null||vt(Ut)},ze=function(Ut){ge&&Ut.key==="Enter"&&!_e.current&&(_e.current=!0,ge(Ut)),Ee==null||Ee(Ut)},je=function(Ut){Ut.key==="Enter"&&(_e.current=!1),Ne==null||Ne(Ut)},Ue=function(Ut){Tt(!0),J==null||J(Ut)},bt=function(Ut){_e.current&&(_e.current=!1),Tt(!1),ue==null||ue(Ut)},xt=function(Ut){ne(""),xe(),ve.current&&(0,oe.rJ)(ve.current,Ut,ie)},it=Ce&&"".concat(L,"-out-of-range"),Ft=function(){var Ut=(0,S.Z)(w,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return he.createElement("input",(0,ce.Z)({autoComplete:re},Ut,{onChange:De,onFocus:Ue,onBlur:bt,onKeyDown:ze,onKeyUp:je,className:p()(L,(0,Se.Z)({},"".concat(L,"-disabled"),V),Qe==null?void 0:Qe.input),style:et==null?void 0:et.input,ref:ve,size:H,type:Be,onCompositionStart:function(Te){Ke.current=!0,gt==null||gt(Te)},onCompositionEnd:Fe}))},Yt=function(){var Ut=Number(se)>0;if(v||Q.show){var Me=Q.showFormatter?Q.showFormatter({value:be,count:me,maxLength:se}):"".concat(me).concat(Ut?" / ".concat(se):"");return he.createElement(he.Fragment,null,Q.show&&he.createElement("span",{className:p()("".concat(L,"-show-count-suffix"),(0,Se.Z)({},"".concat(L,"-show-count-has-suffix"),!!v),Qe==null?void 0:Qe.count),style:(0,k.Z)({},et==null?void 0:et.count)},Me),v)}return null};return he.createElement(x,(0,ce.Z)({},we,{prefixCls:L,className:p()(ee,it),handleReset:xt,value:be,focused:nt,triggerFocus:xe,suffix:Yt(),disabled:V,classes:Ge,classNames:Qe,styles:et}),Ft())}),I=W,M=I},30292:function(yn,yt,T){"use strict";T.d(yt,{He:function(){return k},X3:function(){return ce},nH:function(){return K},rJ:function(){return le}});function k(p){return!!(p.addonBefore||p.addonAfter)}function ce(p){return!!(p.prefix||p.suffix||p.allowClear)}function Se(p,he,oe){var o=he.cloneNode(!0),x=Object.create(p,{target:{value:o},currentTarget:{value:o}});return o.value=oe,typeof he.selectionStart=="number"&&typeof he.selectionEnd=="number"&&(o.selectionStart=he.selectionStart,o.selectionEnd=he.selectionEnd),o.setSelectionRange=function(){he.setSelectionRange.apply(he,arguments)},x}function le(p,he,oe,o){if(oe){var x=he;if(he.type==="click"){x=Se(he,p,""),oe(x);return}if(p.type!=="file"&&o!==void 0){x=Se(he,p,o),oe(x);return}oe(x)}}function K(p,he){if(p){p.focus(he);var oe=he||{},o=oe.cursor;if(o){var x=p.value.length;switch(o){case"start":p.setSelectionRange(0,0);break;case"end":p.setSelectionRange(x,x);break;default:p.setSelectionRange(0,x)}}}}},28321:function(yn,yt,T){"use strict";T.d(yt,{iz:function(){return Oe},ck:function(){return Re},BW:function(){return St},sN:function(){return Re},Wd:function(){return _n},ZP:function(){return ut},Xl:function(){return ge}});var k=T(14809),ce=T(4635),Se=T(20439),le=T(95190),K=T(50298),p=T(62646),he=T(92310),oe=T.n(he),o=T(11780),x=T(18929),A=T(13697),h=T(48736),m=T(59301),y=T(4676),S=m.createContext(null);function O(Ae,Ze){return Ae===void 0?null:"".concat(Ae,"-").concat(Ze)}function G(Ae){var Ze=m.useContext(S);return O(Ze,Ae)}var W=T(80547),I=["children","locked"],M=m.createContext(null);function w(Ae,Ze){var He=(0,Se.Z)({},Ae);return Object.keys(Ze).forEach(function(Je){var lt=Ze[Je];lt!==void 0&&(He[Je]=lt)}),He}function D(Ae){var Ze=Ae.children,He=Ae.locked,Je=(0,p.Z)(Ae,I),lt=m.useContext(M),pt=(0,W.Z)(function(){return w(lt,Je)},[lt,Je],function(Lt,Gt){return!He&&(Lt[0]!==Gt[0]||!(0,A.Z)(Lt[1],Gt[1],!0))});return m.createElement(M.Provider,{value:pt},Ze)}var re=[],ie=m.createContext(null);function J(){return m.useContext(ie)}var ue=m.createContext(re);function ge(Ae){var Ze=m.useContext(ue);return m.useMemo(function(){return Ae!==void 0?[].concat((0,le.Z)(Ze),[Ae]):Ze},[Ze,Ae])}var Ee=m.createContext(null),Ne=m.createContext({}),Y=Ne,L=T(29194);function V(Ae){var Ze=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,L.Z)(Ae)){var He=Ae.nodeName.toLowerCase(),Je=["input","select","textarea","button"].includes(He)||Ae.isContentEditable||He==="a"&&!!Ae.getAttribute("href"),lt=Ae.getAttribute("tabindex"),pt=Number(lt),Lt=null;return lt&&!Number.isNaN(pt)?Lt=pt:Je&&Lt===null&&(Lt=0),Je&&Ae.disabled&&(Lt=null),Lt!==null&&(Lt>=0||Ze&&Lt<0)}return!1}function H(Ae){var Ze=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,He=(0,le.Z)(Ae.querySelectorAll("*")).filter(function(Je){return V(Je,Ze)});return V(Ae,Ze)&&He.unshift(Ae),He}var ee=null;function j(){ee=document.activeElement}function v(){ee=null}function g(){if(ee)try{ee.focus()}catch(Ae){}}function U(Ae,Ze){if(Ze.keyCode===9){var He=H(Ae),Je=He[Ze.shiftKey?0:He.length-1],lt=Je===document.activeElement||Ae===document.activeElement;if(lt){var pt=He[Ze.shiftKey?He.length-1:0];pt.focus(),Ze.preventDefault()}}}var te=T(10228),Be=T(16089),Ge=te.Z.LEFT,Qe=te.Z.RIGHT,et=te.Z.UP,gt=te.Z.DOWN,vt=te.Z.ENTER,we=te.Z.ESC,_t=te.Z.HOME,ot=te.Z.END,nt=[et,gt,Ge,Qe];function Tt(Ae,Ze,He,Je){var lt,pt="prev",Lt="next",Gt="children",Qt="parent";if(Ae==="inline"&&Je===vt)return{inlineTrigger:!0};var tn=(0,ce.Z)((0,ce.Z)({},et,pt),gt,Lt),$n=(0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)({},Ge,He?Lt:pt),Qe,He?pt:Lt),gt,Gt),vt,Gt),Vt=(0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)({},et,pt),gt,Lt),vt,Gt),we,Qt),Ge,He?Gt:Qt),Qe,He?Qt:Gt),fn={inline:tn,horizontal:$n,vertical:Vt,inlineSub:tn,horizontalSub:Vt,verticalSub:Vt},ln=(lt=fn["".concat(Ae).concat(Ze?"":"Sub")])===null||lt===void 0?void 0:lt[Je];switch(ln){case pt:return{offset:-1,sibling:!0};case Lt:return{offset:1,sibling:!0};case Qt:return{offset:-1,sibling:!1};case Gt:return{offset:1,sibling:!1};default:return null}}function Ke(Ae){for(var Ze=Ae;Ze;){if(Ze.getAttribute("data-menu-list"))return Ze;Ze=Ze.parentElement}return null}function _e(Ae,Ze){for(var He=Ae||document.activeElement;He;){if(Ze.has(He))return He;He=He.parentElement}return null}function ve(Ae,Ze){var He=H(Ae,!0);return He.filter(function(Je){return Ze.has(Je)})}function F(Ae,Ze,He){var Je=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Ae)return null;var lt=ve(Ae,Ze),pt=lt.length,Lt=lt.findIndex(function(Gt){return He===Gt});return Je<0?Lt===-1?Lt=pt-1:Lt-=1:Je>0&&(Lt+=1),Lt=(Lt+pt)%pt,lt[Lt]}var xe=function(Ze,He){var Je=new Set,lt=new Map,pt=new Map;return Ze.forEach(function(Lt){var Gt=document.querySelector("[data-menu-id='".concat(O(He,Lt),"']"));Gt&&(Je.add(Gt),pt.set(Gt,Lt),lt.set(Lt,Gt))}),{elements:Je,key2element:lt,element2key:pt}};function ke(Ae,Ze,He,Je,lt,pt,Lt,Gt,Qt,tn){var $n=m.useRef(),Vt=m.useRef();Vt.current=Ze;var fn=function(){Be.Z.cancel($n.current)};return m.useEffect(function(){return function(){fn()}},[]),function(ln){var mn=ln.which;if([].concat(nt,[vt,we,_t,ot]).includes(mn)){var Wt=pt(),Bt=xe(Wt,Je),zt=Bt,an=zt.elements,un=zt.key2element,cn=zt.element2key,En=un.get(Ze),jt=_e(En,an),en=cn.get(jt),Qn=Tt(Ae,Lt(en,!0).length===1,He,mn);if(!Qn&&mn!==_t&&mn!==ot)return;(nt.includes(mn)||[_t,ot].includes(mn))&&ln.preventDefault();var Hn=function(bn){if(bn){var Dt=bn,wt=bn.querySelector("a");wt!=null&&wt.getAttribute("href")&&(Dt=wt);var Xt=cn.get(bn);Gt(Xt),fn(),$n.current=(0,Be.Z)(function(){Vt.current===Xt&&Dt.focus()})}};if([_t,ot].includes(mn)||Qn.sibling||!jt){var Kn;!jt||Ae==="inline"?Kn=lt.current:Kn=Ke(jt);var jn,er=ve(Kn,an);mn===_t?jn=er[0]:mn===ot?jn=er[er.length-1]:jn=F(Kn,an,jt,Qn.offset),Hn(jn)}else if(Qn.inlineTrigger)Qt(en);else if(Qn.offset>0)Qt(en,!0),fn(),$n.current=(0,Be.Z)(function(){Bt=xe(Wt,Je);var or=jt.getAttribute("aria-controls"),bn=document.getElementById(or),Dt=F(bn,Bt.elements);Hn(Dt)},5);else if(Qn.offset<0){var Xn=Lt(en,!0),_r=Xn[Xn.length-2],ar=un.get(_r);Qt(_r,!1),Hn(ar)}}tn==null||tn(ln)}}function $(Ae){Promise.resolve().then(Ae)}var R="__RC_UTIL_PATH_SPLIT__",ne=function(Ze){return Ze.join(R)},be=function(Ze){return Ze.split(R)},P="rc-menu-more";function C(){var Ae=m.useState({}),Ze=(0,K.Z)(Ae,2),He=Ze[1],Je=(0,m.useRef)(new Map),lt=(0,m.useRef)(new Map),pt=m.useState([]),Lt=(0,K.Z)(pt,2),Gt=Lt[0],Qt=Lt[1],tn=(0,m.useRef)(0),$n=(0,m.useRef)(!1),Vt=function(){$n.current||He({})},fn=(0,m.useCallback)(function(un,cn){var En=ne(cn);lt.current.set(En,un),Je.current.set(un,En),tn.current+=1;var jt=tn.current;$(function(){jt===tn.current&&Vt()})},[]),ln=(0,m.useCallback)(function(un,cn){var En=ne(cn);lt.current.delete(En),Je.current.delete(un)},[]),mn=(0,m.useCallback)(function(un){Qt(un)},[]),Wt=(0,m.useCallback)(function(un,cn){var En=Je.current.get(un)||"",jt=be(En);return cn&&Gt.includes(jt[0])&&jt.unshift(P),jt},[Gt]),Bt=(0,m.useCallback)(function(un,cn){return un.filter(function(En){return En!==void 0}).some(function(En){var jt=Wt(En,!0);return jt.includes(cn)})},[Wt]),zt=function(){var cn=(0,le.Z)(Je.current.keys());return Gt.length&&cn.push(P),cn},an=(0,m.useCallback)(function(un){var cn="".concat(Je.current.get(un)).concat(R),En=new Set;return(0,le.Z)(lt.current.keys()).forEach(function(jt){jt.startsWith(cn)&&En.add(lt.current.get(jt))}),En},[]);return m.useEffect(function(){return function(){$n.current=!0}},[]),{registerPath:fn,unregisterPath:ln,refreshOverflowKeys:mn,isSubPathKey:Bt,getKeyPath:Wt,getKeys:zt,getSubPathKeys:an}}function X(Ae){var Ze=m.useRef(Ae);Ze.current=Ae;var He=m.useCallback(function(){for(var Je,lt=arguments.length,pt=new Array(lt),Lt=0;Lt<lt;Lt++)pt[Lt]=arguments[Lt];return(Je=Ze.current)===null||Je===void 0?void 0:Je.call.apply(Je,[Ze].concat(pt))},[]);return Ae?He:void 0}var q=Math.random().toFixed(5).toString().slice(2),Q=0;function se(Ae){var Ze=(0,x.Z)(Ae,{value:Ae}),He=(0,K.Z)(Ze,2),Je=He[0],lt=He[1];return m.useEffect(function(){Q+=1;var pt="".concat(q,"-").concat(Q);lt("rc-menu-uuid-".concat(pt))},[]),Je}var me=T(99153),Ce=T(84851),Ie=T(19257),De=T(93046),Fe=T(2738),ze=T(8654);function je(Ae,Ze,He,Je){var lt=m.useContext(M),pt=lt.activeKey,Lt=lt.onActive,Gt=lt.onInactive,Qt={active:pt===Ae};return Ze||(Qt.onMouseEnter=function(tn){He==null||He({key:Ae,domEvent:tn}),Lt(Ae)},Qt.onMouseLeave=function(tn){Je==null||Je({key:Ae,domEvent:tn}),Gt(Ae)}),Qt}function Ue(Ae){var Ze=m.useContext(M),He=Ze.mode,Je=Ze.rtl,lt=Ze.inlineIndent;if(He!=="inline")return null;var pt=Ae;return Je?{paddingRight:pt*lt}:{paddingLeft:pt*lt}}function bt(Ae){var Ze=Ae.icon,He=Ae.props,Je=Ae.children,lt;return Ze===null||Ze===!1?null:(typeof Ze=="function"?lt=m.createElement(Ze,(0,Se.Z)({},He)):typeof Ze!="boolean"&&(lt=Ze),lt||Je||null)}var xt=["item"];function it(Ae){var Ze=Ae.item,He=(0,p.Z)(Ae,xt);return Object.defineProperty(He,"item",{get:function(){return(0,h.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),Ze}}),He}var Ft=["title","attribute","elementRef"],Yt=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],at=["active"],Ut=function(Ae){(0,Ie.Z)(He,Ae);var Ze=(0,De.Z)(He);function He(){return(0,me.Z)(this,He),Ze.apply(this,arguments)}return(0,Ce.Z)(He,[{key:"render",value:function(){var lt=this.props,pt=lt.title,Lt=lt.attribute,Gt=lt.elementRef,Qt=(0,p.Z)(lt,Ft),tn=(0,Fe.Z)(Qt,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,h.ZP)(!Lt,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),m.createElement(o.Z.Item,(0,k.Z)({},Lt,{title:typeof pt=="string"?pt:void 0},tn,{ref:Gt}))}}]),He}(m.Component),Me=m.forwardRef(function(Ae,Ze){var He=Ae.style,Je=Ae.className,lt=Ae.eventKey,pt=Ae.warnKey,Lt=Ae.disabled,Gt=Ae.itemIcon,Qt=Ae.children,tn=Ae.role,$n=Ae.onMouseEnter,Vt=Ae.onMouseLeave,fn=Ae.onClick,ln=Ae.onKeyDown,mn=Ae.onFocus,Wt=(0,p.Z)(Ae,Yt),Bt=G(lt),zt=m.useContext(M),an=zt.prefixCls,un=zt.onItemClick,cn=zt.disabled,En=zt.overflowDisabled,jt=zt.itemIcon,en=zt.selectedKeys,Qn=zt.onActive,Hn=m.useContext(Y),Kn=Hn._internalRenderMenuItem,jn="".concat(an,"-item"),er=m.useRef(),Xn=m.useRef(),_r=cn||Lt,ar=(0,ze.x1)(Ze,Xn),or=ge(lt),bn=function(Tn){return{key:lt,keyPath:(0,le.Z)(or).reverse(),item:er.current,domEvent:Tn}},Dt=Gt||jt,wt=je(lt,_r,$n,Vt),Xt=wt.active,Jt=(0,p.Z)(wt,at),xn=en.includes(lt),Yn=Ue(or.length),tr=function(Tn){if(!_r){var zn=bn(Tn);fn==null||fn(it(zn)),un(zn)}},on=function(Tn){if(ln==null||ln(Tn),Tn.which===te.Z.ENTER){var zn=bn(Tn);fn==null||fn(it(zn)),un(zn)}},wn=function(Tn){Qn(lt),mn==null||mn(Tn)},Bn={};Ae.role==="option"&&(Bn["aria-selected"]=xn);var An=m.createElement(Ut,(0,k.Z)({ref:er,elementRef:ar,role:tn===null?"none":tn||"menuitem",tabIndex:Lt?null:-1,"data-menu-id":En&&Bt?null:Bt},(0,Fe.Z)(Wt,["extra"]),Jt,Bn,{component:"li","aria-disabled":Lt,style:(0,Se.Z)((0,Se.Z)({},Yn),He),className:oe()(jn,(0,ce.Z)((0,ce.Z)((0,ce.Z)({},"".concat(jn,"-active"),Xt),"".concat(jn,"-selected"),xn),"".concat(jn,"-disabled"),_r),Je),onClick:tr,onKeyDown:on,onFocus:wn}),Qt,m.createElement(bt,{props:(0,Se.Z)((0,Se.Z)({},Ae),{},{isSelected:xn}),icon:Dt}));return Kn&&(An=Kn(An,Ae,{selected:xn})),An});function Te(Ae,Ze){var He=Ae.eventKey,Je=J(),lt=ge(He);return m.useEffect(function(){if(Je)return Je.registerPath(He,lt),function(){Je.unregisterPath(He,lt)}},[lt]),Je?null:m.createElement(Me,(0,k.Z)({},Ae,{ref:Ze}))}var Re=m.forwardRef(Te),B=["className","children"],z=function(Ze,He){var Je=Ze.className,lt=Ze.children,pt=(0,p.Z)(Ze,B),Lt=m.useContext(M),Gt=Lt.prefixCls,Qt=Lt.mode,tn=Lt.rtl;return m.createElement("ul",(0,k.Z)({className:oe()(Gt,tn&&"".concat(Gt,"-rtl"),"".concat(Gt,"-sub"),"".concat(Gt,"-").concat(Qt==="inline"?"inline":"vertical"),Je),role:"menu"},pt,{"data-menu-list":!0,ref:He}),lt)},de=m.forwardRef(z);de.displayName="SubMenuList";var fe=de,pe=T(11592);function Ve(Ae,Ze){return(0,pe.Z)(Ae).map(function(He,Je){if(m.isValidElement(He)){var lt,pt,Lt=He.key,Gt=(lt=(pt=He.props)===null||pt===void 0?void 0:pt.eventKey)!==null&&lt!==void 0?lt:Lt,Qt=Gt==null;Qt&&(Gt="tmp_key-".concat([].concat((0,le.Z)(Ze),[Je]).join("-")));var tn={key:Gt,eventKey:Gt};return m.cloneElement(He,tn)}return He})}var qe=T(65966),mt={adjustX:1,adjustY:1},Pt={topLeft:{points:["bl","tl"],overflow:mt},topRight:{points:["br","tr"],overflow:mt},bottomLeft:{points:["tl","bl"],overflow:mt},bottomRight:{points:["tr","br"],overflow:mt},leftTop:{points:["tr","tl"],overflow:mt},leftBottom:{points:["br","bl"],overflow:mt},rightTop:{points:["tl","tr"],overflow:mt},rightBottom:{points:["bl","br"],overflow:mt}},rn={topLeft:{points:["bl","tl"],overflow:mt},topRight:{points:["br","tr"],overflow:mt},bottomLeft:{points:["tl","bl"],overflow:mt},bottomRight:{points:["tr","br"],overflow:mt},rightTop:{points:["tr","tl"],overflow:mt},rightBottom:{points:["br","bl"],overflow:mt},leftTop:{points:["tl","tr"],overflow:mt},leftBottom:{points:["bl","br"],overflow:mt}},hn=null;function qt(Ae,Ze,He){if(Ze)return Ze;if(He)return He[Ae]||He.other}var sn={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function Rn(Ae){var Ze=Ae.prefixCls,He=Ae.visible,Je=Ae.children,lt=Ae.popup,pt=Ae.popupStyle,Lt=Ae.popupClassName,Gt=Ae.popupOffset,Qt=Ae.disabled,tn=Ae.mode,$n=Ae.onVisibleChange,Vt=m.useContext(M),fn=Vt.getPopupContainer,ln=Vt.rtl,mn=Vt.subMenuOpenDelay,Wt=Vt.subMenuCloseDelay,Bt=Vt.builtinPlacements,zt=Vt.triggerSubMenuAction,an=Vt.forceSubMenuRender,un=Vt.rootClassName,cn=Vt.motion,En=Vt.defaultMotions,jt=m.useState(!1),en=(0,K.Z)(jt,2),Qn=en[0],Hn=en[1],Kn=ln?(0,Se.Z)((0,Se.Z)({},rn),Bt):(0,Se.Z)((0,Se.Z)({},Pt),Bt),jn=sn[tn],er=qt(tn,cn,En),Xn=m.useRef(er);tn!=="inline"&&(Xn.current=er);var _r=(0,Se.Z)((0,Se.Z)({},Xn.current),{},{leavedClassName:"".concat(Ze,"-hidden"),removeOnLeave:!1,motionAppear:!0}),ar=m.useRef();return m.useEffect(function(){return ar.current=(0,Be.Z)(function(){Hn(He)}),function(){Be.Z.cancel(ar.current)}},[He]),m.createElement(qe.Z,{prefixCls:Ze,popupClassName:oe()("".concat(Ze,"-popup"),(0,ce.Z)({},"".concat(Ze,"-rtl"),ln),Lt,un),stretch:tn==="horizontal"?"minWidth":null,getPopupContainer:fn,builtinPlacements:Kn,popupPlacement:jn,popupVisible:Qn,popup:lt,popupStyle:pt,popupAlign:Gt&&{offset:Gt},action:Qt?[]:[zt],mouseEnterDelay:mn,mouseLeaveDelay:Wt,onPopupVisibleChange:$n,forceRender:an,popupMotion:_r,fresh:!0},Je)}var Zn=T(77900);function In(Ae){var Ze=Ae.id,He=Ae.open,Je=Ae.keyPath,lt=Ae.children,pt="inline",Lt=m.useContext(M),Gt=Lt.prefixCls,Qt=Lt.forceSubMenuRender,tn=Lt.motion,$n=Lt.defaultMotions,Vt=Lt.mode,fn=m.useRef(!1);fn.current=Vt===pt;var ln=m.useState(!fn.current),mn=(0,K.Z)(ln,2),Wt=mn[0],Bt=mn[1],zt=fn.current?He:!1;m.useEffect(function(){fn.current&&Bt(!1)},[Vt]);var an=(0,Se.Z)({},qt(pt,tn,$n));Je.length>1&&(an.motionAppear=!1);var un=an.onVisibleChanged;return an.onVisibleChanged=function(cn){return!fn.current&&!cn&&Bt(!0),un==null?void 0:un(cn)},Wt?null:m.createElement(D,{mode:pt,locked:!fn.current},m.createElement(Zn.default,(0,k.Z)({visible:zt},an,{forceRender:Qt,removeOnLeave:!1,leavedClassName:"".concat(Gt,"-hidden")}),function(cn){var En=cn.className,jt=cn.style;return m.createElement(fe,{id:Ze,className:En,style:jt},lt)}))}var Nn=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],kt=["active"],ft=m.forwardRef(function(Ae,Ze){var He=Ae.style,Je=Ae.className,lt=Ae.title,pt=Ae.eventKey,Lt=Ae.warnKey,Gt=Ae.disabled,Qt=Ae.internalPopupClose,tn=Ae.children,$n=Ae.itemIcon,Vt=Ae.expandIcon,fn=Ae.popupClassName,ln=Ae.popupOffset,mn=Ae.popupStyle,Wt=Ae.onClick,Bt=Ae.onMouseEnter,zt=Ae.onMouseLeave,an=Ae.onTitleClick,un=Ae.onTitleMouseEnter,cn=Ae.onTitleMouseLeave,En=(0,p.Z)(Ae,Nn),jt=G(pt),en=m.useContext(M),Qn=en.prefixCls,Hn=en.mode,Kn=en.openKeys,jn=en.disabled,er=en.overflowDisabled,Xn=en.activeKey,_r=en.selectedKeys,ar=en.itemIcon,or=en.expandIcon,bn=en.onItemClick,Dt=en.onOpenChange,wt=en.onActive,Xt=m.useContext(Y),Jt=Xt._internalRenderSubMenuItem,xn=m.useContext(Ee),Yn=xn.isSubPathKey,tr=ge(),on="".concat(Qn,"-submenu"),wn=jn||Gt,Bn=m.useRef(),An=m.useRef(),dr=$n!=null?$n:ar,Tn=Vt!=null?Vt:or,zn=Kn.includes(pt),Jn=!er&&zn,dn=Yn(_r,pt),nr=je(pt,wn,un,cn),gr=nr.active,cr=(0,p.Z)(nr,kt),xr=m.useState(!1),Cr=(0,K.Z)(xr,2),Ir=Cr[0],Er=Cr[1],Gn=function(hr){wn||Er(hr)},zr=function(hr){Gn(!0),Bt==null||Bt({key:pt,domEvent:hr})},Or=function(hr){Gn(!1),zt==null||zt({key:pt,domEvent:hr})},Wr=m.useMemo(function(){return gr||(Hn!=="inline"?Ir||Yn([Xn],pt):!1)},[Hn,gr,Xn,Ir,pt,Yn]),wr=Ue(tr.length),ai=function(hr){wn||(an==null||an({key:pt,domEvent:hr}),Hn==="inline"&&Dt(pt,!zn))},ti=X(function(On){Wt==null||Wt(it(On)),bn(On)}),Mr=function(hr){Hn!=="inline"&&Dt(pt,hr)},Hr=function(){wt(pt)},Kr=jt&&"".concat(jt,"-popup"),Ur=m.useMemo(function(){return m.createElement(bt,{icon:Hn!=="horizontal"?Tn:void 0,props:(0,Se.Z)((0,Se.Z)({},Ae),{},{isOpen:Jn,isSubMenu:!0})},m.createElement("i",{className:"".concat(on,"-arrow")}))},[Hn,Tn,Ae,Jn,on]),Ar=m.createElement("div",(0,k.Z)({role:"menuitem",style:wr,className:"".concat(on,"-title"),tabIndex:wn?null:-1,ref:Bn,title:typeof lt=="string"?lt:null,"data-menu-id":er&&jt?null:jt,"aria-expanded":Jn,"aria-haspopup":!0,"aria-controls":Kr,"aria-disabled":wn,onClick:ai,onFocus:Hr},cr),lt,Ur),Fr=m.useRef(Hn);if(Hn!=="inline"&&tr.length>1?Fr.current="vertical":Fr.current=Hn,!er){var Gr=Fr.current;Ar=m.createElement(Rn,{mode:Gr,prefixCls:on,visible:!Qt&&Jn&&Hn!=="inline",popupClassName:fn,popupOffset:ln,popupStyle:mn,popup:m.createElement(D,{mode:Gr==="horizontal"?"vertical":Gr},m.createElement(fe,{id:Kr,ref:An},tn)),disabled:wn,onVisibleChange:Mr},Ar)}var lr=m.createElement(o.Z.Item,(0,k.Z)({ref:Ze,role:"none"},En,{component:"li",style:He,className:oe()(on,"".concat(on,"-").concat(Hn),Je,(0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)({},"".concat(on,"-open"),Jn),"".concat(on,"-active"),Wr),"".concat(on,"-selected"),dn),"".concat(on,"-disabled"),wn)),onMouseEnter:zr,onMouseLeave:Or}),Ar,!er&&m.createElement(In,{id:Kr,open:Jn,keyPath:tr},tn));return Jt&&(lr=Jt(lr,Ae,{selected:dn,active:Wr,open:Jn,disabled:wn})),m.createElement(D,{onItemClick:ti,mode:Hn==="horizontal"?"vertical":Hn,itemIcon:dr,expandIcon:Tn},lr)}),Kt=m.forwardRef(function(Ae,Ze){var He=Ae.eventKey,Je=Ae.children,lt=ge(He),pt=Ve(Je,lt),Lt=J();m.useEffect(function(){if(Lt)return Lt.registerPath(He,lt),function(){Lt.unregisterPath(He,lt)}},[lt]);var Gt;return Lt?Gt=pt:Gt=m.createElement(ft,(0,k.Z)({ref:Ze},Ae),pt),m.createElement(ue.Provider,{value:lt},Gt)}),_n=Kt,Wn=T(93664);function Oe(Ae){var Ze=Ae.className,He=Ae.style,Je=m.useContext(M),lt=Je.prefixCls,pt=J();return pt?null:m.createElement("li",{role:"separator",className:oe()("".concat(lt,"-item-divider"),Ze),style:He})}var Le=["className","title","eventKey","children"],At=m.forwardRef(function(Ae,Ze){var He=Ae.className,Je=Ae.title,lt=Ae.eventKey,pt=Ae.children,Lt=(0,p.Z)(Ae,Le),Gt=m.useContext(M),Qt=Gt.prefixCls,tn="".concat(Qt,"-item-group");return m.createElement("li",(0,k.Z)({ref:Ze,role:"presentation"},Lt,{onClick:function(Vt){return Vt.stopPropagation()},className:oe()(tn,He)}),m.createElement("div",{role:"presentation",className:"".concat(tn,"-title"),title:typeof Je=="string"?Je:void 0},Je),m.createElement("ul",{role:"group",className:"".concat(tn,"-list")},pt))}),rt=m.forwardRef(function(Ae,Ze){var He=Ae.eventKey,Je=Ae.children,lt=ge(He),pt=Ve(Je,lt),Lt=J();return Lt?pt:m.createElement(At,(0,k.Z)({ref:Ze},(0,Fe.Z)(Ae,["warnKey"])),pt)}),St=rt,Rt=["label","children","key","type","extra"];function Et(Ae,Ze,He){var Je=Ze.item,lt=Ze.group,pt=Ze.submenu,Lt=Ze.divider;return(Ae||[]).map(function(Gt,Qt){if(Gt&&(0,Wn.Z)(Gt)==="object"){var tn=Gt,$n=tn.label,Vt=tn.children,fn=tn.key,ln=tn.type,mn=tn.extra,Wt=(0,p.Z)(tn,Rt),Bt=fn!=null?fn:"tmp-".concat(Qt);return Vt||ln==="group"?ln==="group"?m.createElement(lt,(0,k.Z)({key:Bt},Wt,{title:$n}),Et(Vt,Ze,He)):m.createElement(pt,(0,k.Z)({key:Bt},Wt,{title:$n}),Et(Vt,Ze,He)):ln==="divider"?m.createElement(Lt,(0,k.Z)({key:Bt},Wt)):m.createElement(Je,(0,k.Z)({key:Bt},Wt,{extra:mn}),$n,(!!mn||mn===0)&&m.createElement("span",{className:"".concat(He,"-item-extra")},mn))}return null}).filter(function(Gt){return Gt})}function Ot(Ae,Ze,He,Je,lt){var pt=Ae,Lt=(0,Se.Z)({divider:Oe,item:Re,group:St,submenu:_n},Je);return Ze&&(pt=Et(Ze,Lt,lt)),Ve(pt,He)}var Mt=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],Ct=[],It=m.forwardRef(function(Ae,Ze){var He,Je=Ae,lt=Je.prefixCls,pt=lt===void 0?"rc-menu":lt,Lt=Je.rootClassName,Gt=Je.style,Qt=Je.className,tn=Je.tabIndex,$n=tn===void 0?0:tn,Vt=Je.items,fn=Je.children,ln=Je.direction,mn=Je.id,Wt=Je.mode,Bt=Wt===void 0?"vertical":Wt,zt=Je.inlineCollapsed,an=Je.disabled,un=Je.disabledOverflow,cn=Je.subMenuOpenDelay,En=cn===void 0?.1:cn,jt=Je.subMenuCloseDelay,en=jt===void 0?.1:jt,Qn=Je.forceSubMenuRender,Hn=Je.defaultOpenKeys,Kn=Je.openKeys,jn=Je.activeKey,er=Je.defaultActiveFirst,Xn=Je.selectable,_r=Xn===void 0?!0:Xn,ar=Je.multiple,or=ar===void 0?!1:ar,bn=Je.defaultSelectedKeys,Dt=Je.selectedKeys,wt=Je.onSelect,Xt=Je.onDeselect,Jt=Je.inlineIndent,xn=Jt===void 0?24:Jt,Yn=Je.motion,tr=Je.defaultMotions,on=Je.triggerSubMenuAction,wn=on===void 0?"hover":on,Bn=Je.builtinPlacements,An=Je.itemIcon,dr=Je.expandIcon,Tn=Je.overflowedIndicator,zn=Tn===void 0?"...":Tn,Jn=Je.overflowedIndicatorPopupClassName,dn=Je.getPopupContainer,nr=Je.onClick,gr=Je.onOpenChange,cr=Je.onKeyDown,xr=Je.openAnimation,Cr=Je.openTransitionName,Ir=Je._internalRenderMenuItem,Er=Je._internalRenderSubMenuItem,Gn=Je._internalComponents,zr=(0,p.Z)(Je,Mt),Or=m.useMemo(function(){return[Ot(fn,Vt,Ct,Gn,pt),Ot(fn,Vt,Ct,{},pt)]},[fn,Vt,Gn]),Wr=(0,K.Z)(Or,2),wr=Wr[0],ai=Wr[1],ti=m.useState(!1),Mr=(0,K.Z)(ti,2),Hr=Mr[0],Kr=Mr[1],Ur=m.useRef(),Ar=se(mn),Fr=ln==="rtl",Gr=(0,x.Z)(Hn,{value:Kn,postState:function(ct){return ct||Ct}}),lr=(0,K.Z)(Gr,2),On=lr[0],hr=lr[1],Sn=function(ct){var Dr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function jr(){hr(ct),gr==null||gr(ct)}Dr?(0,y.flushSync)(jr):jr()},Un=m.useState(On),Pn=(0,K.Z)(Un,2),Mn=Pn[0],ur=Pn[1],yr=m.useRef(!1),vn=m.useMemo(function(){return(Bt==="inline"||Bt==="vertical")&&zt?["vertical",zt]:[Bt,!1]},[Bt,zt]),Ln=(0,K.Z)(vn,2),pr=Ln[0],rr=Ln[1],mr=pr==="inline",Nr=m.useState(pr),fi=(0,K.Z)(Nr,2),Vr=fi[0],Qr=fi[1],oi=m.useState(rr),Si=(0,K.Z)(oi,2),cs=Si[0],ni=Si[1];m.useEffect(function(){Qr(pr),ni(rr),yr.current&&(mr?hr(Mn):Sn(Ct))},[pr,rr]);var _i=m.useState(0),Qi=(0,K.Z)(_i,2),Ai=Qi[0],Ji=Qi[1],ki=Ai>=wr.length-1||Vr!=="horizontal"||un;m.useEffect(function(){mr&&ur(On)},[On]),m.useEffect(function(){return yr.current=!0,function(){yr.current=!1}},[]);var di=C(),Gi=di.registerPath,Pi=di.unregisterPath,Vi=di.refreshOverflowKeys,Oi=di.isSubPathKey,li=di.getKeyPath,Mi=di.getKeys,zi=di.getSubPathKeys,qi=m.useMemo(function(){return{registerPath:Gi,unregisterPath:Pi}},[Gi,Pi]),fs=m.useMemo(function(){return{isSubPathKey:Oi}},[Oi]);m.useEffect(function(){Vi(ki?Ct:wr.slice(Ai+1).map(function(Pr){return Pr.key}))},[Ai,ki]);var ds=(0,x.Z)(jn||er&&((He=wr[0])===null||He===void 0?void 0:He.key),{value:jn}),Wi=(0,K.Z)(ds,2),yi=Wi[0],fr=Wi[1],ir=X(function(Pr){fr(Pr)}),Br=X(function(){fr(void 0)});(0,m.useImperativeHandle)(Ze,function(){return{list:Ur.current,focus:function(ct){var Dr,jr=Mi(),Yr=xe(jr,Ar),ts=Yr.elements,Hi=Yr.key2element,Ss=Yr.element2key,ws=ve(Ur.current,ts),Ts=yi!=null?yi:ws[0]?Ss.get(ws[0]):(Dr=wr.find(function(Ni){return!Ni.props.disabled}))===null||Dr===void 0?void 0:Dr.key,Ri=Hi.get(Ts);if(Ts&&Ri){var Ci;Ri==null||(Ci=Ri.focus)===null||Ci===void 0||Ci.call(Ri,ct)}}}});var $r=(0,x.Z)(bn||[],{value:Dt,postState:function(ct){return Array.isArray(ct)?ct:ct==null?Ct:[ct]}}),Lr=(0,K.Z)($r,2),kr=Lr[0],ri=Lr[1],Jr=function(ct){if(_r){var Dr=ct.key,jr=kr.includes(Dr),Yr;or?jr?Yr=kr.filter(function(Hi){return Hi!==Dr}):Yr=[].concat((0,le.Z)(kr),[Dr]):Yr=[Dr],ri(Yr);var ts=(0,Se.Z)((0,Se.Z)({},ct),{},{selectedKeys:Yr});jr?Xt==null||Xt(ts):wt==null||wt(ts)}!or&&On.length&&Vr!=="inline"&&Sn(Ct)},qr=X(function(Pr){nr==null||nr(it(Pr)),Jr(Pr)}),Ei=X(function(Pr,ct){var Dr=On.filter(function(Yr){return Yr!==Pr});if(ct)Dr.push(Pr);else if(Vr!=="inline"){var jr=zi(Pr);Dr=Dr.filter(function(Yr){return!jr.has(Yr)})}(0,A.Z)(On,Dr,!0)||Sn(Dr,!0)}),hi=function(ct,Dr){var jr=Dr!=null?Dr:!On.includes(ct);Ei(ct,jr)},Di=ke(Vr,yi,Fr,Ar,Ur,Mi,li,fr,hi,cr);m.useEffect(function(){Kr(!0)},[]);var Fi=m.useMemo(function(){return{_internalRenderMenuItem:Ir,_internalRenderSubMenuItem:Er}},[Ir,Er]),xs=Vr!=="horizontal"||un?wr:wr.map(function(Pr,ct){return m.createElement(D,{key:Pr.key,overflowDisabled:ct>Ai},Pr)}),es=m.createElement(o.Z,(0,k.Z)({id:mn,ref:Ur,prefixCls:"".concat(pt,"-overflow"),component:"ul",itemComponent:Re,className:oe()(pt,"".concat(pt,"-root"),"".concat(pt,"-").concat(Vr),Qt,(0,ce.Z)((0,ce.Z)({},"".concat(pt,"-inline-collapsed"),cs),"".concat(pt,"-rtl"),Fr),Lt),dir:ln,style:Gt,role:"menu",tabIndex:$n,data:xs,renderRawItem:function(ct){return ct},renderRawRest:function(ct){var Dr=ct.length,jr=Dr?wr.slice(-Dr):null;return m.createElement(_n,{eventKey:P,title:zn,disabled:ki,internalPopupClose:Dr===0,popupClassName:Jn},jr)},maxCount:Vr!=="horizontal"||un?o.Z.INVALIDATE:o.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(ct){Ji(ct)},onKeyDown:Di},zr));return m.createElement(Y.Provider,{value:Fi},m.createElement(S.Provider,{value:Ar},m.createElement(D,{prefixCls:pt,rootClassName:Lt,mode:Vr,openKeys:On,rtl:Fr,disabled:an,motion:Hr?Yn:null,defaultMotions:Hr?tr:null,activeKey:yi,onActive:ir,onInactive:Br,selectedKeys:kr,inlineIndent:xn,subMenuOpenDelay:En,subMenuCloseDelay:en,forceSubMenuRender:Qn,builtinPlacements:Bn,triggerSubMenuAction:wn,getPopupContainer:dn,itemIcon:An,expandIcon:dr,onItemClick:qr,onOpenChange:Ei},m.createElement(Ee.Provider,{value:fs},es),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(ie.Provider,{value:qi},ai)))))}),Zt=It,Nt=Zt;Nt.Item=Re,Nt.SubMenu=_n,Nt.ItemGroup=St,Nt.Divider=Oe;var ut=Nt},11780:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return j}});var k=T(14809),ce=T(20439),Se=T(50298),le=T(62646),K=T(59301),p=T(92310),he=T.n(p),oe=T(29301),o=T(34280),x=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],A=void 0;function h(v,g){var U=v.prefixCls,te=v.invalidate,Be=v.item,Ge=v.renderItem,Qe=v.responsive,et=v.responsiveDisabled,gt=v.registerSize,vt=v.itemKey,we=v.className,_t=v.style,ot=v.children,nt=v.display,Tt=v.order,Ke=v.component,_e=Ke===void 0?"div":Ke,ve=(0,le.Z)(v,x),F=Qe&&!nt;function xe(be){gt(vt,be)}K.useEffect(function(){return function(){xe(null)}},[]);var ke=Ge&&Be!==A?Ge(Be,{index:Tt}):ot,$;te||($={opacity:F?0:1,height:F?0:A,overflowY:F?"hidden":A,order:Qe?Tt:A,pointerEvents:F?"none":A,position:F?"absolute":A});var R={};F&&(R["aria-hidden"]=!0);var ne=K.createElement(_e,(0,k.Z)({className:he()(!te&&U,we),style:(0,ce.Z)((0,ce.Z)({},$),_t)},R,ve,{ref:g}),ke);return Qe&&(ne=K.createElement(oe.Z,{onResize:function(P){var C=P.offsetWidth;xe(C)},disabled:et},ne)),ne}var m=K.forwardRef(h);m.displayName="Item";var y=m,S=T(6089),O=T(4676),G=T(16089);function W(v){if(typeof MessageChannel=="undefined")(0,G.Z)(v);else{var g=new MessageChannel;g.port1.onmessage=function(){return v()},g.port2.postMessage(void 0)}}function I(){var v=K.useRef(null),g=function(te){v.current||(v.current=[],W(function(){(0,O.unstable_batchedUpdates)(function(){v.current.forEach(function(Be){Be()}),v.current=null})})),v.current.push(te)};return g}function M(v,g){var U=K.useState(g),te=(0,Se.Z)(U,2),Be=te[0],Ge=te[1],Qe=(0,S.Z)(function(et){v(function(){Ge(et)})});return[Be,Qe]}var w=K.createContext(null),D=["component"],re=["className"],ie=["className"],J=function(g,U){var te=K.useContext(w);if(!te){var Be=g.component,Ge=Be===void 0?"div":Be,Qe=(0,le.Z)(g,D);return K.createElement(Ge,(0,k.Z)({},Qe,{ref:U}))}var et=te.className,gt=(0,le.Z)(te,re),vt=g.className,we=(0,le.Z)(g,ie);return K.createElement(w.Provider,{value:null},K.createElement(y,(0,k.Z)({ref:U,className:he()(et,vt)},gt,we)))},ue=K.forwardRef(J);ue.displayName="RawItem";var ge=ue,Ee=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Ne="responsive",Y="invalidate";function L(v){return"+ ".concat(v.length," ...")}function V(v,g){var U=v.prefixCls,te=U===void 0?"rc-overflow":U,Be=v.data,Ge=Be===void 0?[]:Be,Qe=v.renderItem,et=v.renderRawItem,gt=v.itemKey,vt=v.itemWidth,we=vt===void 0?10:vt,_t=v.ssr,ot=v.style,nt=v.className,Tt=v.maxCount,Ke=v.renderRest,_e=v.renderRawRest,ve=v.suffix,F=v.component,xe=F===void 0?"div":F,ke=v.itemComponent,$=v.onVisibleChange,R=(0,le.Z)(v,Ee),ne=_t==="full",be=I(),P=M(be,null),C=(0,Se.Z)(P,2),X=C[0],q=C[1],Q=X||0,se=M(be,new Map),me=(0,Se.Z)(se,2),Ce=me[0],Ie=me[1],De=M(be,0),Fe=(0,Se.Z)(De,2),ze=Fe[0],je=Fe[1],Ue=M(be,0),bt=(0,Se.Z)(Ue,2),xt=bt[0],it=bt[1],Ft=M(be,0),Yt=(0,Se.Z)(Ft,2),at=Yt[0],Ut=Yt[1],Me=(0,K.useState)(null),Te=(0,Se.Z)(Me,2),Re=Te[0],B=Te[1],z=(0,K.useState)(null),de=(0,Se.Z)(z,2),fe=de[0],pe=de[1],Ve=K.useMemo(function(){return fe===null&&ne?Number.MAX_SAFE_INTEGER:fe||0},[fe,X]),qe=(0,K.useState)(!1),mt=(0,Se.Z)(qe,2),Pt=mt[0],rn=mt[1],hn="".concat(te,"-item"),qt=Math.max(ze,xt),sn=Tt===Ne,Rn=Ge.length&&sn,Zn=Tt===Y,In=Rn||typeof Tt=="number"&&Ge.length>Tt,Nn=(0,K.useMemo)(function(){var Nt=Ge;return Rn?X===null&&ne?Nt=Ge:Nt=Ge.slice(0,Math.min(Ge.length,Q/we)):typeof Tt=="number"&&(Nt=Ge.slice(0,Tt)),Nt},[Ge,we,X,Tt,Rn]),kt=(0,K.useMemo)(function(){return Rn?Ge.slice(Ve+1):Ge.slice(Nn.length)},[Ge,Nn,Rn,Ve]),ft=(0,K.useCallback)(function(Nt,ut){var Ae;return typeof gt=="function"?gt(Nt):(Ae=gt&&(Nt==null?void 0:Nt[gt]))!==null&&Ae!==void 0?Ae:ut},[gt]),Kt=(0,K.useCallback)(Qe||function(Nt){return Nt},[Qe]);function _n(Nt,ut,Ae){fe===Nt&&(ut===void 0||ut===Re)||(pe(Nt),Ae||(rn(Nt<Ge.length-1),$==null||$(Nt)),ut!==void 0&&B(ut))}function Wn(Nt,ut){q(ut.clientWidth)}function Oe(Nt,ut){Ie(function(Ae){var Ze=new Map(Ae);return ut===null?Ze.delete(Nt):Ze.set(Nt,ut),Ze})}function Le(Nt,ut){it(ut),je(xt)}function At(Nt,ut){Ut(ut)}function rt(Nt){return Ce.get(ft(Nn[Nt],Nt))}(0,o.Z)(function(){if(Q&&typeof qt=="number"&&Nn){var Nt=at,ut=Nn.length,Ae=ut-1;if(!ut){_n(0,null);return}for(var Ze=0;Ze<ut;Ze+=1){var He=rt(Ze);if(ne&&(He=He||0),He===void 0){_n(Ze-1,void 0,!0);break}if(Nt+=He,Ae===0&&Nt<=Q||Ze===Ae-1&&Nt+rt(Ae)<=Q){_n(Ae,null);break}else if(Nt+qt>Q){_n(Ze-1,Nt-He-at+xt);break}}ve&&rt(0)+at>Q&&B(null)}},[Q,Ce,xt,at,ft,Nn]);var St=Pt&&!!kt.length,Rt={};Re!==null&&Rn&&(Rt={position:"absolute",left:Re,top:0});var Et={prefixCls:hn,responsive:Rn,component:ke,invalidate:Zn},Ot=et?function(Nt,ut){var Ae=ft(Nt,ut);return K.createElement(w.Provider,{key:Ae,value:(0,ce.Z)((0,ce.Z)({},Et),{},{order:ut,item:Nt,itemKey:Ae,registerSize:Oe,display:ut<=Ve})},et(Nt,ut))}:function(Nt,ut){var Ae=ft(Nt,ut);return K.createElement(y,(0,k.Z)({},Et,{order:ut,key:Ae,item:Nt,renderItem:Kt,itemKey:Ae,registerSize:Oe,display:ut<=Ve}))},Mt={order:St?Ve:Number.MAX_SAFE_INTEGER,className:"".concat(hn,"-rest"),registerSize:Le,display:St},Ct=Ke||L,It=_e?K.createElement(w.Provider,{value:(0,ce.Z)((0,ce.Z)({},Et),Mt)},_e(kt)):K.createElement(y,(0,k.Z)({},Et,Mt),typeof Ct=="function"?Ct(kt):Ct),Zt=K.createElement(xe,(0,k.Z)({className:he()(!Zn&&te,nt),style:ot,ref:g},R),Nn.map(Ot),In?It:null,ve&&K.createElement(y,(0,k.Z)({},Et,{responsive:sn,responsiveDisabled:!Rn,order:Ve,className:"".concat(hn,"-suffix"),registerSize:At,display:!0,style:Rt}),ve));return sn?K.createElement(oe.Z,{onResize:Wn,disabled:!Rn},Zt):Zt}var H=K.forwardRef(V);H.displayName="Overflow",H.Item=ge,H.RESPONSIVE=Ne,H.INVALIDATE=Y;var ee=H,j=ee},29301:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return Y}});var k=T(14809),ce=T(59301),Se=T(11592),le=T(48736),K=T(20439),p=T(93664),he=T(76846),oe=T(8654),o=ce.createContext(null);function x(L){var V=L.children,H=L.onBatchResize,ee=ce.useRef(0),j=ce.useRef([]),v=ce.useContext(o),g=ce.useCallback(function(U,te,Be){ee.current+=1;var Ge=ee.current;j.current.push({size:U,element:te,data:Be}),Promise.resolve().then(function(){Ge===ee.current&&(H==null||H(j.current),j.current=[])}),v==null||v(U,te,Be)},[H,v]);return ce.createElement(o.Provider,{value:g},V)}var A=T(76374),h=new Map;function m(L){L.forEach(function(V){var H,ee=V.target;(H=h.get(ee))===null||H===void 0||H.forEach(function(j){return j(ee)})})}var y=new A.Z(m),S=null,O=null;function G(L,V){h.has(L)||(h.set(L,new Set),y.observe(L)),h.get(L).add(V)}function W(L,V){h.has(L)&&(h.get(L).delete(V),h.get(L).size||(y.unobserve(L),h.delete(L)))}var I=T(99153),M=T(84851),w=T(19257),D=T(93046),re=function(L){(0,w.Z)(H,L);var V=(0,D.Z)(H);function H(){return(0,I.Z)(this,H),V.apply(this,arguments)}return(0,M.Z)(H,[{key:"render",value:function(){return this.props.children}}]),H}(ce.Component);function ie(L,V){var H=L.children,ee=L.disabled,j=ce.useRef(null),v=ce.useRef(null),g=ce.useContext(o),U=typeof H=="function",te=U?H(j):H,Be=ce.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ge=!U&&ce.isValidElement(te)&&(0,oe.Yr)(te),Qe=Ge?(0,oe.C4)(te):null,et=(0,oe.x1)(Qe,j),gt=function(){var ot;return(0,he.ZP)(j.current)||(j.current&&(0,p.Z)(j.current)==="object"?(0,he.ZP)((ot=j.current)===null||ot===void 0?void 0:ot.nativeElement):null)||(0,he.ZP)(v.current)};ce.useImperativeHandle(V,function(){return gt()});var vt=ce.useRef(L);vt.current=L;var we=ce.useCallback(function(_t){var ot=vt.current,nt=ot.onResize,Tt=ot.data,Ke=_t.getBoundingClientRect(),_e=Ke.width,ve=Ke.height,F=_t.offsetWidth,xe=_t.offsetHeight,ke=Math.floor(_e),$=Math.floor(ve);if(Be.current.width!==ke||Be.current.height!==$||Be.current.offsetWidth!==F||Be.current.offsetHeight!==xe){var R={width:ke,height:$,offsetWidth:F,offsetHeight:xe};Be.current=R;var ne=F===Math.round(_e)?_e:F,be=xe===Math.round(ve)?ve:xe,P=(0,K.Z)((0,K.Z)({},R),{},{offsetWidth:ne,offsetHeight:be});g==null||g(P,_t,Tt),nt&&Promise.resolve().then(function(){nt(P,_t)})}},[]);return ce.useEffect(function(){var _t=gt();return _t&&!ee&&G(_t,we),function(){return W(_t,we)}},[j.current,ee]),ce.createElement(re,{ref:v},Ge?ce.cloneElement(te,{ref:et}):te)}var J=ce.forwardRef(ie),ue=J,ge="rc-observer-key";function Ee(L,V){var H=L.children,ee=typeof H=="function"?[H]:(0,Se.Z)(H);return ee.map(function(j,v){var g=(j==null?void 0:j.key)||"".concat(ge,"-").concat(v);return ce.createElement(ue,(0,k.Z)({},L,{key:g,ref:v===0?V:void 0}),j)})}var Ne=ce.forwardRef(Ee);Ne.Collection=x;var Y=Ne},6551:function(yn,yt,T){"use strict";T.d(yt,{ZP:function(){return he}});var k=T(50298),ce=T(59301),Se=T(47273),le=0,K=(0,Se.Z)();function p(){var oe;return K?(oe=le,le+=1):oe="TEST_OR_SSR",oe}function he(oe){var o=ce.useState(),x=(0,k.Z)(o,2),A=x[0],h=x[1];return ce.useEffect(function(){h("rc_select_".concat(p()))},[]),oe||A}},37463:function(yn,yt,T){"use strict";T.d(yt,{Ac:function(){return Fe},Xo:function(){return je},Wx:function(){return bt},ZP:function(){return Wn},lk:function(){return M}});var k=T(14809),ce=T(95190),Se=T(4635),le=T(20439),K=T(50298),p=T(62646),he=T(93664),oe=T(18929),o=T(48736),x=T(59301),A=T(92310),h=T.n(A),m=T(34280),y=T(49658),S=T(8654),O=function(Le){var At=Le.className,rt=Le.customizeIcon,St=Le.customizeIconProps,Rt=Le.children,Et=Le.onMouseDown,Ot=Le.onClick,Mt=typeof rt=="function"?rt(St):rt;return x.createElement("span",{className:At,onMouseDown:function(It){It.preventDefault(),Et==null||Et(It)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:Ot,"aria-hidden":!0},Mt!==void 0?Mt:x.createElement("span",{className:h()(At.split(/\s+/).map(function(Ct){return"".concat(Ct,"-icon")}))},Rt))},G=O,W=function(Le,At,rt,St,Rt){var Et=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,Ot=arguments.length>6?arguments[6]:void 0,Mt=arguments.length>7?arguments[7]:void 0,Ct=x.useMemo(function(){if((0,he.Z)(St)==="object")return St.clearIcon;if(Rt)return Rt},[St,Rt]),It=x.useMemo(function(){return!!(!Et&&St&&(rt.length||Ot)&&!(Mt==="combobox"&&Ot===""))},[St,Et,rt.length,Ot,Mt]);return{allowClear:It,clearIcon:x.createElement(G,{className:"".concat(Le,"-clear"),onMouseDown:At,customizeIcon:Ct},"\xD7")}},I=x.createContext(null);function M(){return x.useContext(I)}function w(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,Le=x.useState(!1),At=(0,K.Z)(Le,2),rt=At[0],St=At[1],Rt=x.useRef(null),Et=function(){window.clearTimeout(Rt.current)};x.useEffect(function(){return Et},[]);var Ot=function(Ct,It){Et(),Rt.current=window.setTimeout(function(){St(Ct),It&&It()},Oe)};return[rt,Ot,Et]}function D(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,Le=x.useRef(null),At=x.useRef(null);x.useEffect(function(){return function(){window.clearTimeout(At.current)}},[]);function rt(St){(St||Le.current===null)&&(Le.current=St),window.clearTimeout(At.current),At.current=window.setTimeout(function(){Le.current=null},Oe)}return[function(){return Le.current},rt]}function re(Oe,Le,At,rt){var St=x.useRef(null);St.current={open:Le,triggerOpen:At,customizedTrigger:rt},x.useEffect(function(){function Rt(Et){var Ot;if(!((Ot=St.current)!==null&&Ot!==void 0&&Ot.customizedTrigger)){var Mt=Et.target;Mt.shadowRoot&&Et.composed&&(Mt=Et.composedPath()[0]||Mt),St.current.open&&Oe().filter(function(Ct){return Ct}).every(function(Ct){return!Ct.contains(Mt)&&Ct!==Mt})&&St.current.triggerOpen(!1)}}return window.addEventListener("mousedown",Rt),function(){return window.removeEventListener("mousedown",Rt)}},[])}var ie=T(10228);function J(Oe){return Oe&&![ie.Z.ESC,ie.Z.SHIFT,ie.Z.BACKSPACE,ie.Z.TAB,ie.Z.WIN_KEY,ie.Z.ALT,ie.Z.META,ie.Z.WIN_KEY_RIGHT,ie.Z.CTRL,ie.Z.SEMICOLON,ie.Z.EQUALS,ie.Z.CAPS_LOCK,ie.Z.CONTEXT_MENU,ie.Z.F1,ie.Z.F2,ie.Z.F3,ie.Z.F4,ie.Z.F5,ie.Z.F6,ie.Z.F7,ie.Z.F8,ie.Z.F9,ie.Z.F10,ie.Z.F11,ie.Z.F12].includes(Oe)}var ue=T(26112),ge=T(11780);function Ee(Oe,Le,At){var rt=(0,le.Z)((0,le.Z)({},Oe),At?Le:{});return Object.keys(Le).forEach(function(St){var Rt=Le[St];typeof Rt=="function"&&(rt[St]=function(){for(var Et,Ot=arguments.length,Mt=new Array(Ot),Ct=0;Ct<Ot;Ct++)Mt[Ct]=arguments[Ct];return Rt.apply(void 0,Mt),(Et=Oe[St])===null||Et===void 0?void 0:Et.call.apply(Et,[Oe].concat(Mt))})}),rt}var Ne=Ee,Y=["prefixCls","id","inputElement","autoFocus","autoComplete","editable","activeDescendantId","value","open","attrs"],L=function(Le,At){var rt=Le.prefixCls,St=Le.id,Rt=Le.inputElement,Et=Le.autoFocus,Ot=Le.autoComplete,Mt=Le.editable,Ct=Le.activeDescendantId,It=Le.value,Zt=Le.open,Nt=Le.attrs,ut=(0,p.Z)(Le,Y),Ae=Rt||x.createElement("input",null),Ze=Ae,He=Ze.ref,Je=Ze.props;return(0,o.Kp)(!("maxLength"in Ae.props),"Passing 'maxLength' to input element directly may not work because input in BaseSelect is controlled."),Ae=x.cloneElement(Ae,(0,le.Z)((0,le.Z)((0,le.Z)({type:"search"},Ne(ut,Je,!0)),{},{id:St,ref:(0,S.sQ)(At,He),autoComplete:Ot||"off",autoFocus:Et,className:h()("".concat(rt,"-selection-search-input"),Je==null?void 0:Je.className),role:"combobox","aria-expanded":Zt||!1,"aria-haspopup":"listbox","aria-owns":"".concat(St,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(St,"_list"),"aria-activedescendant":Zt?Ct:void 0},Nt),{},{value:Mt?It:"",readOnly:!Mt,unselectable:Mt?null:"on",style:(0,le.Z)((0,le.Z)({},Je.style),{},{opacity:Mt?null:0})})),Ae},V=x.forwardRef(L),H=V;function ee(Oe){return Array.isArray(Oe)?Oe:Oe!==void 0?[Oe]:[]}var j=typeof window!="undefined"&&window.document&&window.document.documentElement,v=j;function g(Oe){return Oe!=null}function U(Oe){return!Oe&&Oe!==0}function te(Oe){return["string","number"].includes((0,he.Z)(Oe))}function Be(Oe){var Le=void 0;return Oe&&(te(Oe.title)?Le=Oe.title.toString():te(Oe.label)&&(Le=Oe.label.toString())),Le}function Ge(Oe,Le){v?x.useLayoutEffect(Oe,Le):x.useEffect(Oe,Le)}function Qe(Oe){var Le;return(Le=Oe.key)!==null&&Le!==void 0?Le:Oe.value}var et=function(Le){Le.preventDefault(),Le.stopPropagation()},gt=function(Le){var At=Le.id,rt=Le.prefixCls,St=Le.values,Rt=Le.open,Et=Le.searchValue,Ot=Le.autoClearSearchValue,Mt=Le.inputRef,Ct=Le.placeholder,It=Le.disabled,Zt=Le.mode,Nt=Le.showSearch,ut=Le.autoFocus,Ae=Le.autoComplete,Ze=Le.activeDescendantId,He=Le.tabIndex,Je=Le.removeIcon,lt=Le.maxTagCount,pt=Le.maxTagTextLength,Lt=Le.maxTagPlaceholder,Gt=Lt===void 0?function(Xt){return"+ ".concat(Xt.length," ...")}:Lt,Qt=Le.tagRender,tn=Le.onToggleOpen,$n=Le.onRemove,Vt=Le.onInputChange,fn=Le.onInputPaste,ln=Le.onInputKeyDown,mn=Le.onInputMouseDown,Wt=Le.onInputCompositionStart,Bt=Le.onInputCompositionEnd,zt=Le.onInputBlur,an=x.useRef(null),un=(0,x.useState)(0),cn=(0,K.Z)(un,2),En=cn[0],jt=cn[1],en=(0,x.useState)(!1),Qn=(0,K.Z)(en,2),Hn=Qn[0],Kn=Qn[1],jn="".concat(rt,"-selection"),er=Rt||Zt==="multiple"&&Ot===!1||Zt==="tags"?Et:"",Xn=Zt==="tags"||Zt==="multiple"&&Ot===!1||Nt&&(Rt||Hn);Ge(function(){jt(an.current.scrollWidth)},[er]);var _r=function(Jt,xn,Yn,tr,on){return x.createElement("span",{title:Be(Jt),className:h()("".concat(jn,"-item"),(0,Se.Z)({},"".concat(jn,"-item-disabled"),Yn))},x.createElement("span",{className:"".concat(jn,"-item-content")},xn),tr&&x.createElement(G,{className:"".concat(jn,"-item-remove"),onMouseDown:et,onClick:on,customizeIcon:Je},"\xD7"))},ar=function(Jt,xn,Yn,tr,on,wn){var Bn=function(dr){et(dr),tn(!Rt)};return x.createElement("span",{onMouseDown:Bn},Qt({label:xn,value:Jt,disabled:Yn,closable:tr,onClose:on,isMaxTag:!!wn}))},or=function(Jt){var xn=Jt.disabled,Yn=Jt.label,tr=Jt.value,on=!It&&!xn,wn=Yn;if(typeof pt=="number"&&(typeof Yn=="string"||typeof Yn=="number")){var Bn=String(wn);Bn.length>pt&&(wn="".concat(Bn.slice(0,pt),"..."))}var An=function(Tn){Tn&&Tn.stopPropagation(),$n(Jt)};return typeof Qt=="function"?ar(tr,wn,xn,on,An):_r(Jt,wn,xn,on,An)},bn=function(Jt){if(!St.length)return null;var xn=typeof Gt=="function"?Gt(Jt):Gt;return typeof Qt=="function"?ar(void 0,xn,!1,!1,void 0,!0):_r({title:xn},xn,!1)},Dt=x.createElement("div",{className:"".concat(jn,"-search"),style:{width:En},onFocus:function(){Kn(!0)},onBlur:function(){Kn(!1)}},x.createElement(H,{ref:Mt,open:Rt,prefixCls:rt,id:At,inputElement:null,disabled:It,autoFocus:ut,autoComplete:Ae,editable:Xn,activeDescendantId:Ze,value:er,onKeyDown:ln,onMouseDown:mn,onChange:Vt,onPaste:fn,onCompositionStart:Wt,onCompositionEnd:Bt,onBlur:zt,tabIndex:He,attrs:(0,ue.Z)(Le,!0)}),x.createElement("span",{ref:an,className:"".concat(jn,"-search-mirror"),"aria-hidden":!0},er,"\xA0")),wt=x.createElement(ge.Z,{prefixCls:"".concat(jn,"-overflow"),data:St,renderItem:or,renderRest:bn,suffix:Dt,itemKey:Qe,maxCount:lt});return x.createElement("span",{className:"".concat(jn,"-wrap")},wt,!St.length&&!er&&x.createElement("span",{className:"".concat(jn,"-placeholder")},Ct))},vt=gt,we=function(Le){var At=Le.inputElement,rt=Le.prefixCls,St=Le.id,Rt=Le.inputRef,Et=Le.disabled,Ot=Le.autoFocus,Mt=Le.autoComplete,Ct=Le.activeDescendantId,It=Le.mode,Zt=Le.open,Nt=Le.values,ut=Le.placeholder,Ae=Le.tabIndex,Ze=Le.showSearch,He=Le.searchValue,Je=Le.activeValue,lt=Le.maxLength,pt=Le.onInputKeyDown,Lt=Le.onInputMouseDown,Gt=Le.onInputChange,Qt=Le.onInputPaste,tn=Le.onInputCompositionStart,$n=Le.onInputCompositionEnd,Vt=Le.onInputBlur,fn=Le.title,ln=x.useState(!1),mn=(0,K.Z)(ln,2),Wt=mn[0],Bt=mn[1],zt=It==="combobox",an=zt||Ze,un=Nt[0],cn=He||"";zt&&Je&&!Wt&&(cn=Je),x.useEffect(function(){zt&&Bt(!1)},[zt,Je]);var En=It!=="combobox"&&!Zt&&!Ze?!1:!!cn,jt=fn===void 0?Be(un):fn,en=x.useMemo(function(){return un?null:x.createElement("span",{className:"".concat(rt,"-selection-placeholder"),style:En?{visibility:"hidden"}:void 0},ut)},[un,En,ut,rt]);return x.createElement("span",{className:"".concat(rt,"-selection-wrap")},x.createElement("span",{className:"".concat(rt,"-selection-search")},x.createElement(H,{ref:Rt,prefixCls:rt,id:St,open:Zt,inputElement:At,disabled:Et,autoFocus:Ot,autoComplete:Mt,editable:an,activeDescendantId:Ct,value:cn,onKeyDown:pt,onMouseDown:Lt,onChange:function(Hn){Bt(!0),Gt(Hn)},onPaste:Qt,onCompositionStart:tn,onCompositionEnd:$n,onBlur:Vt,tabIndex:Ae,attrs:(0,ue.Z)(Le,!0),maxLength:zt?lt:void 0})),!zt&&un?x.createElement("span",{className:"".concat(rt,"-selection-item"),title:jt,style:En?{visibility:"hidden"}:void 0},un.label):null,en)},_t=we,ot=function(Le,At){var rt=(0,x.useRef)(null),St=(0,x.useRef)(!1),Rt=Le.prefixCls,Et=Le.open,Ot=Le.mode,Mt=Le.showSearch,Ct=Le.tokenWithEnter,It=Le.disabled,Zt=Le.prefix,Nt=Le.autoClearSearchValue,ut=Le.onSearch,Ae=Le.onSearchSubmit,Ze=Le.onToggleOpen,He=Le.onInputKeyDown,Je=Le.onInputBlur,lt=Le.domRef;x.useImperativeHandle(At,function(){return{focus:function(jt){rt.current.focus(jt)},blur:function(){rt.current.blur()}}});var pt=D(0),Lt=(0,K.Z)(pt,2),Gt=Lt[0],Qt=Lt[1],tn=function(jt){var en=jt.which,Qn=rt.current instanceof HTMLTextAreaElement;!Qn&&Et&&(en===ie.Z.UP||en===ie.Z.DOWN)&&jt.preventDefault(),He&&He(jt),en===ie.Z.ENTER&&Ot==="tags"&&!St.current&&!Et&&(Ae==null||Ae(jt.target.value)),!(Qn&&!Et&&~[ie.Z.UP,ie.Z.DOWN,ie.Z.LEFT,ie.Z.RIGHT].indexOf(en))&&J(en)&&Ze(!0)},$n=function(){Qt(!0)},Vt=(0,x.useRef)(null),fn=function(jt){ut(jt,!0,St.current)!==!1&&Ze(!0)},ln=function(){St.current=!0},mn=function(jt){St.current=!1,Ot!=="combobox"&&fn(jt.target.value)},Wt=function(jt){var en=jt.target.value;if(Ct&&Vt.current&&/[\r\n]/.test(Vt.current)){var Qn=Vt.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");en=en.replace(Qn,Vt.current)}Vt.current=null,fn(en)},Bt=function(jt){var en=jt.clipboardData,Qn=en==null?void 0:en.getData("text");Vt.current=Qn||""},zt=function(jt){var en=jt.target;if(en!==rt.current){var Qn=document.body.style.msTouchAction!==void 0;Qn?setTimeout(function(){rt.current.focus()}):rt.current.focus()}},an=function(jt){var en=Gt();jt.target!==rt.current&&!en&&!(Ot==="combobox"&&It)&&jt.preventDefault(),(Ot!=="combobox"&&(!Mt||!en)||!Et)&&(Et&&Nt!==!1&&ut("",!0,!1),Ze())},un={inputRef:rt,onInputKeyDown:tn,onInputMouseDown:$n,onInputChange:Wt,onInputPaste:Bt,onInputCompositionStart:ln,onInputCompositionEnd:mn,onInputBlur:Je},cn=Ot==="multiple"||Ot==="tags"?x.createElement(vt,(0,k.Z)({},Le,un)):x.createElement(_t,(0,k.Z)({},Le,un));return x.createElement("div",{ref:lt,className:"".concat(Rt,"-selector"),onClick:zt,onMouseDown:an},Zt&&x.createElement("div",{className:"".concat(Rt,"-prefix")},Zt),cn)},nt=x.forwardRef(ot),Tt=nt,Ke=T(65966),_e=["prefixCls","disabled","visible","children","popupElement","animation","transitionName","dropdownStyle","dropdownClassName","direction","placement","builtinPlacements","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","getPopupContainer","empty","getTriggerDOMNode","onPopupVisibleChange","onPopupMouseEnter"],ve=function(Le){var At=Le===!0?0:1;return{bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:At,adjustY:1},htmlRegion:"scroll"},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:At,adjustY:1},htmlRegion:"scroll"},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:At,adjustY:1},htmlRegion:"scroll"},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:At,adjustY:1},htmlRegion:"scroll"}}},F=function(Le,At){var rt=Le.prefixCls,St=Le.disabled,Rt=Le.visible,Et=Le.children,Ot=Le.popupElement,Mt=Le.animation,Ct=Le.transitionName,It=Le.dropdownStyle,Zt=Le.dropdownClassName,Nt=Le.direction,ut=Nt===void 0?"ltr":Nt,Ae=Le.placement,Ze=Le.builtinPlacements,He=Le.dropdownMatchSelectWidth,Je=Le.dropdownRender,lt=Le.dropdownAlign,pt=Le.getPopupContainer,Lt=Le.empty,Gt=Le.getTriggerDOMNode,Qt=Le.onPopupVisibleChange,tn=Le.onPopupMouseEnter,$n=(0,p.Z)(Le,_e),Vt="".concat(rt,"-dropdown"),fn=Ot;Je&&(fn=Je(Ot));var ln=x.useMemo(function(){return Ze||ve(He)},[Ze,He]),mn=Mt?"".concat(Vt,"-").concat(Mt):Ct,Wt=typeof He=="number",Bt=x.useMemo(function(){return Wt?null:He===!1?"minWidth":"width"},[He,Wt]),zt=It;Wt&&(zt=(0,le.Z)((0,le.Z)({},zt),{},{width:He}));var an=x.useRef(null);return x.useImperativeHandle(At,function(){return{getPopupElement:function(){var cn;return(cn=an.current)===null||cn===void 0?void 0:cn.popupElement}}}),x.createElement(Ke.Z,(0,k.Z)({},$n,{showAction:Qt?["click"]:[],hideAction:Qt?["click"]:[],popupPlacement:Ae||(ut==="rtl"?"bottomRight":"bottomLeft"),builtinPlacements:ln,prefixCls:Vt,popupTransitionName:mn,popup:x.createElement("div",{onMouseEnter:tn},fn),ref:an,stretch:Bt,popupAlign:lt,popupVisible:Rt,getPopupContainer:pt,popupClassName:h()(Zt,(0,Se.Z)({},"".concat(Vt,"-empty"),Lt)),popupStyle:zt,getTriggerDOMNode:Gt,onPopupVisibleChange:Qt}),Et)},xe=x.forwardRef(F),ke=xe,$=T(21696);function R(Oe,Le){var At=Oe.key,rt;return"value"in Oe&&(rt=Oe.value),At!=null?At:rt!==void 0?rt:"rc-index-key-".concat(Le)}function ne(Oe){return typeof Oe!="undefined"&&!Number.isNaN(Oe)}function be(Oe,Le){var At=Oe||{},rt=At.label,St=At.value,Rt=At.options,Et=At.groupLabel,Ot=rt||(Le?"children":"label");return{label:Ot,value:St||"value",options:Rt||"options",groupLabel:Et||Ot}}function P(Oe){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},At=Le.fieldNames,rt=Le.childrenAsData,St=[],Rt=be(At,!1),Et=Rt.label,Ot=Rt.value,Mt=Rt.options,Ct=Rt.groupLabel;function It(Zt,Nt){Array.isArray(Zt)&&Zt.forEach(function(ut){if(Nt||!(Mt in ut)){var Ae=ut[Ot];St.push({key:R(ut,St.length),groupOption:Nt,data:ut,label:ut[Et],value:Ae})}else{var Ze=ut[Ct];Ze===void 0&&rt&&(Ze=ut.label),St.push({key:R(ut,St.length),group:!0,data:ut,label:Ze}),It(ut[Mt],!0)}})}return It(Oe,!1),St}function C(Oe){var Le=(0,le.Z)({},Oe);return"props"in Le||Object.defineProperty(Le,"props",{get:function(){return(0,o.ZP)(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),Le}}),Le}var X=function(Le,At,rt){if(!At||!At.length)return null;var St=!1,Rt=function Ot(Mt,Ct){var It=(0,$.Z)(Ct),Zt=It[0],Nt=It.slice(1);if(!Zt)return[Mt];var ut=Mt.split(Zt);return St=St||ut.length>1,ut.reduce(function(Ae,Ze){return[].concat((0,ce.Z)(Ae),(0,ce.Z)(Ot(Ze,Nt)))},[]).filter(Boolean)},Et=Rt(Le,At);return St?typeof rt!="undefined"?Et.slice(0,rt):Et:null},q=x.createContext(null),Q=q;function se(Oe){var Le=Oe.visible,At=Oe.values;if(!Le)return null;var rt=50;return x.createElement("span",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"".concat(At.slice(0,rt).map(function(St){var Rt=St.label,Et=St.value;return["number","string"].includes((0,he.Z)(Rt))?Rt:Et}).join(", ")),At.length>rt?", ...":null)}var me=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","prefix","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],Ce=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],Ie=function(Le){return Le==="tags"||Le==="multiple"},De=x.forwardRef(function(Oe,Le){var At,rt=Oe.id,St=Oe.prefixCls,Rt=Oe.className,Et=Oe.showSearch,Ot=Oe.tagRender,Mt=Oe.direction,Ct=Oe.omitDomProps,It=Oe.displayValues,Zt=Oe.onDisplayValuesChange,Nt=Oe.emptyOptions,ut=Oe.notFoundContent,Ae=ut===void 0?"Not Found":ut,Ze=Oe.onClear,He=Oe.mode,Je=Oe.disabled,lt=Oe.loading,pt=Oe.getInputElement,Lt=Oe.getRawInputElement,Gt=Oe.open,Qt=Oe.defaultOpen,tn=Oe.onDropdownVisibleChange,$n=Oe.activeValue,Vt=Oe.onActiveValueChange,fn=Oe.activeDescendantId,ln=Oe.searchValue,mn=Oe.autoClearSearchValue,Wt=Oe.onSearch,Bt=Oe.onSearchSplit,zt=Oe.tokenSeparators,an=Oe.allowClear,un=Oe.prefix,cn=Oe.suffixIcon,En=Oe.clearIcon,jt=Oe.OptionList,en=Oe.animation,Qn=Oe.transitionName,Hn=Oe.dropdownStyle,Kn=Oe.dropdownClassName,jn=Oe.dropdownMatchSelectWidth,er=Oe.dropdownRender,Xn=Oe.dropdownAlign,_r=Oe.placement,ar=Oe.builtinPlacements,or=Oe.getPopupContainer,bn=Oe.showAction,Dt=bn===void 0?[]:bn,wt=Oe.onFocus,Xt=Oe.onBlur,Jt=Oe.onKeyUp,xn=Oe.onKeyDown,Yn=Oe.onMouseDown,tr=(0,p.Z)(Oe,me),on=Ie(He),wn=(Et!==void 0?Et:on)||He==="combobox",Bn=(0,le.Z)({},tr);Ce.forEach(function(fr){delete Bn[fr]}),Ct==null||Ct.forEach(function(fr){delete Bn[fr]});var An=x.useState(!1),dr=(0,K.Z)(An,2),Tn=dr[0],zn=dr[1];x.useEffect(function(){zn((0,y.Z)())},[]);var Jn=x.useRef(null),dn=x.useRef(null),nr=x.useRef(null),gr=x.useRef(null),cr=x.useRef(null),xr=x.useRef(!1),Cr=w(),Ir=(0,K.Z)(Cr,3),Er=Ir[0],Gn=Ir[1],zr=Ir[2];x.useImperativeHandle(Le,function(){var fr,ir;return{focus:(fr=gr.current)===null||fr===void 0?void 0:fr.focus,blur:(ir=gr.current)===null||ir===void 0?void 0:ir.blur,scrollTo:function($r){var Lr;return(Lr=cr.current)===null||Lr===void 0?void 0:Lr.scrollTo($r)},nativeElement:Jn.current||dn.current}});var Or=x.useMemo(function(){var fr;if(He!=="combobox")return ln;var ir=(fr=It[0])===null||fr===void 0?void 0:fr.value;return typeof ir=="string"||typeof ir=="number"?String(ir):""},[ln,He,It]),Wr=He==="combobox"&&typeof pt=="function"&&pt()||null,wr=typeof Lt=="function"&&Lt(),ai=(0,S.x1)(dn,wr==null||(At=wr.props)===null||At===void 0?void 0:At.ref),ti=x.useState(!1),Mr=(0,K.Z)(ti,2),Hr=Mr[0],Kr=Mr[1];(0,m.Z)(function(){Kr(!0)},[]);var Ur=(0,oe.Z)(!1,{defaultValue:Qt,value:Gt}),Ar=(0,K.Z)(Ur,2),Fr=Ar[0],Gr=Ar[1],lr=Hr?Fr:!1,On=!Ae&&Nt;(Je||On&&lr&&He==="combobox")&&(lr=!1);var hr=On?!1:lr,Sn=x.useCallback(function(fr){var ir=fr!==void 0?fr:!lr;Je||(Gr(ir),lr!==ir&&(tn==null||tn(ir)))},[Je,lr,Gr,tn]),Un=x.useMemo(function(){return(zt||[]).some(function(fr){return[`
`,`\r
`].includes(fr)})},[zt]),Pn=x.useContext(Q)||{},Mn=Pn.maxCount,ur=Pn.rawValues,yr=function(ir,Br,$r){if(!(on&&ne(Mn)&&(ur==null?void 0:ur.size)>=Mn)){var Lr=!0,kr=ir;Vt==null||Vt(null);var ri=X(ir,zt,ne(Mn)?Mn-ur.size:void 0),Jr=$r?null:ri;return He!=="combobox"&&Jr&&(kr="",Bt==null||Bt(Jr),Sn(!1),Lr=!1),Wt&&Or!==kr&&Wt(kr,{source:Br?"typing":"effect"}),Lr}},vn=function(ir){!ir||!ir.trim()||Wt(ir,{source:"submit"})};x.useEffect(function(){!lr&&!on&&He!=="combobox"&&yr("",!1,!1)},[lr]),x.useEffect(function(){Fr&&Je&&Gr(!1),Je&&!xr.current&&Gn(!1)},[Je]);var Ln=D(),pr=(0,K.Z)(Ln,2),rr=pr[0],mr=pr[1],Nr=x.useRef(!1),fi=function(ir){var Br=rr(),$r=ir.key,Lr=$r==="Enter";if(Lr&&(He!=="combobox"&&ir.preventDefault(),lr||Sn(!0)),mr(!!Or),$r==="Backspace"&&!Br&&on&&!Or&&It.length){for(var kr=(0,ce.Z)(It),ri=null,Jr=kr.length-1;Jr>=0;Jr-=1){var qr=kr[Jr];if(!qr.disabled){kr.splice(Jr,1),ri=qr;break}}ri&&Zt(kr,{type:"remove",values:[ri]})}for(var Ei=arguments.length,hi=new Array(Ei>1?Ei-1:0),Di=1;Di<Ei;Di++)hi[Di-1]=arguments[Di];if(lr&&(!Lr||!Nr.current)){var Fi;Lr&&(Nr.current=!0),(Fi=cr.current)===null||Fi===void 0||Fi.onKeyDown.apply(Fi,[ir].concat(hi))}xn==null||xn.apply(void 0,[ir].concat(hi))},Vr=function(ir){for(var Br=arguments.length,$r=new Array(Br>1?Br-1:0),Lr=1;Lr<Br;Lr++)$r[Lr-1]=arguments[Lr];if(lr){var kr;(kr=cr.current)===null||kr===void 0||kr.onKeyUp.apply(kr,[ir].concat($r))}ir.key==="Enter"&&(Nr.current=!1),Jt==null||Jt.apply(void 0,[ir].concat($r))},Qr=function(ir){var Br=It.filter(function($r){return $r!==ir});Zt(Br,{type:"remove",values:[ir]})},oi=function(){Nr.current=!1},Si=x.useRef(!1),cs=function(){Gn(!0),Je||(wt&&!Si.current&&wt.apply(void 0,arguments),Dt.includes("focus")&&Sn(!0)),Si.current=!0},ni=function(){xr.current=!0,Gn(!1,function(){Si.current=!1,xr.current=!1,Sn(!1)}),!Je&&(Or&&(He==="tags"?Wt(Or,{source:"submit"}):He==="multiple"&&Wt("",{source:"blur"})),Xt&&Xt.apply(void 0,arguments))},_i=[];x.useEffect(function(){return function(){_i.forEach(function(fr){return clearTimeout(fr)}),_i.splice(0,_i.length)}},[]);var Qi=function(ir){var Br,$r=ir.target,Lr=(Br=nr.current)===null||Br===void 0?void 0:Br.getPopupElement();if(Lr&&Lr.contains($r)){var kr=setTimeout(function(){var Ei=_i.indexOf(kr);if(Ei!==-1&&_i.splice(Ei,1),zr(),!Tn&&!Lr.contains(document.activeElement)){var hi;(hi=gr.current)===null||hi===void 0||hi.focus()}});_i.push(kr)}for(var ri=arguments.length,Jr=new Array(ri>1?ri-1:0),qr=1;qr<ri;qr++)Jr[qr-1]=arguments[qr];Yn==null||Yn.apply(void 0,[ir].concat(Jr))},Ai=x.useState({}),Ji=(0,K.Z)(Ai,2),ki=Ji[1];function di(){ki({})}var Gi;wr&&(Gi=function(ir){Sn(ir)}),re(function(){var fr;return[Jn.current,(fr=nr.current)===null||fr===void 0?void 0:fr.getPopupElement()]},hr,Sn,!!wr);var Pi=x.useMemo(function(){return(0,le.Z)((0,le.Z)({},Oe),{},{notFoundContent:Ae,open:lr,triggerOpen:hr,id:rt,showSearch:wn,multiple:on,toggleOpen:Sn})},[Oe,Ae,hr,lr,rt,wn,on,Sn]),Vi=!!cn||lt,Oi;Vi&&(Oi=x.createElement(G,{className:h()("".concat(St,"-arrow"),(0,Se.Z)({},"".concat(St,"-arrow-loading"),lt)),customizeIcon:cn,customizeIconProps:{loading:lt,searchValue:Or,open:lr,focused:Er,showSearch:wn}}));var li=function(){var ir;Ze==null||Ze(),(ir=gr.current)===null||ir===void 0||ir.focus(),Zt([],{type:"clear",values:It}),yr("",!1,!1)},Mi=W(St,li,It,an,En,Je,Or,He),zi=Mi.allowClear,qi=Mi.clearIcon,fs=x.createElement(jt,{ref:cr}),ds=h()(St,Rt,(0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)({},"".concat(St,"-focused"),Er),"".concat(St,"-multiple"),on),"".concat(St,"-single"),!on),"".concat(St,"-allow-clear"),an),"".concat(St,"-show-arrow"),Vi),"".concat(St,"-disabled"),Je),"".concat(St,"-loading"),lt),"".concat(St,"-open"),lr),"".concat(St,"-customize-input"),Wr),"".concat(St,"-show-search"),wn)),Wi=x.createElement(ke,{ref:nr,disabled:Je,prefixCls:St,visible:hr,popupElement:fs,animation:en,transitionName:Qn,dropdownStyle:Hn,dropdownClassName:Kn,direction:Mt,dropdownMatchSelectWidth:jn,dropdownRender:er,dropdownAlign:Xn,placement:_r,builtinPlacements:ar,getPopupContainer:or,empty:Nt,getTriggerDOMNode:function(ir){return dn.current||ir},onPopupVisibleChange:Gi,onPopupMouseEnter:di},wr?x.cloneElement(wr,{ref:ai}):x.createElement(Tt,(0,k.Z)({},Oe,{domRef:dn,prefixCls:St,inputElement:Wr,ref:gr,id:rt,prefix:un,showSearch:wn,autoClearSearchValue:mn,mode:He,activeDescendantId:fn,tagRender:Ot,values:It,open:lr,onToggleOpen:Sn,activeValue:$n,searchValue:Or,onSearch:yr,onSearchSubmit:vn,onRemove:Qr,tokenWithEnter:Un,onInputBlur:oi}))),yi;return wr?yi=Wi:yi=x.createElement("div",(0,k.Z)({className:ds},Bn,{ref:Jn,onMouseDown:Qi,onKeyDown:fi,onKeyUp:Vr,onFocus:cs,onBlur:ni}),x.createElement(se,{visible:Er&&!lr,values:It}),Wi,Oi,zi&&qi),x.createElement(I.Provider,{value:Pi},yi)}),Fe=De,ze=function(){return null};ze.isSelectOptGroup=!0;var je=ze,Ue=function(){return null};Ue.isSelectOption=!0;var bt=Ue,xt=T(80547),it=T(2738),Ft=T(6790);function Yt(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var at=["disabled","title","children","style","className"];function Ut(Oe){return typeof Oe=="string"||typeof Oe=="number"}var Me=function(Le,At){var rt=M(),St=rt.prefixCls,Rt=rt.id,Et=rt.open,Ot=rt.multiple,Mt=rt.mode,Ct=rt.searchValue,It=rt.toggleOpen,Zt=rt.notFoundContent,Nt=rt.onPopupScroll,ut=x.useContext(Q),Ae=ut.maxCount,Ze=ut.flattenOptions,He=ut.onActiveValue,Je=ut.defaultActiveFirstOption,lt=ut.onSelect,pt=ut.menuItemSelectedIcon,Lt=ut.rawValues,Gt=ut.fieldNames,Qt=ut.virtual,tn=ut.direction,$n=ut.listHeight,Vt=ut.listItemHeight,fn=ut.optionRender,ln="".concat(St,"-item"),mn=(0,xt.Z)(function(){return Ze},[Et,Ze],function(bn,Dt){return Dt[0]&&bn[1]!==Dt[1]}),Wt=x.useRef(null),Bt=x.useMemo(function(){return Ot&&ne(Ae)&&(Lt==null?void 0:Lt.size)>=Ae},[Ot,Ae,Lt==null?void 0:Lt.size]),zt=function(Dt){Dt.preventDefault()},an=function(Dt){var wt;(wt=Wt.current)===null||wt===void 0||wt.scrollTo(typeof Dt=="number"?{index:Dt}:Dt)},un=x.useCallback(function(bn){return Mt==="combobox"?!1:Lt.has(bn)},[Mt,(0,ce.Z)(Lt).toString(),Lt.size]),cn=function(Dt){for(var wt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Xt=mn.length,Jt=0;Jt<Xt;Jt+=1){var xn=(Dt+Jt*wt+Xt)%Xt,Yn=mn[xn]||{},tr=Yn.group,on=Yn.data;if(!tr&&!(on!=null&&on.disabled)&&(un(on.value)||!Bt))return xn}return-1},En=x.useState(function(){return cn(0)}),jt=(0,K.Z)(En,2),en=jt[0],Qn=jt[1],Hn=function(Dt){var wt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;Qn(Dt);var Xt={source:wt?"keyboard":"mouse"},Jt=mn[Dt];if(!Jt){He(null,-1,Xt);return}He(Jt.value,Dt,Xt)};(0,x.useEffect)(function(){Hn(Je!==!1?cn(0):-1)},[mn.length,Ct]);var Kn=x.useCallback(function(bn){return Mt==="combobox"?String(bn).toLowerCase()===Ct.toLowerCase():Lt.has(bn)},[Mt,Ct,(0,ce.Z)(Lt).toString(),Lt.size]);(0,x.useEffect)(function(){var bn=setTimeout(function(){if(!Ot&&Et&&Lt.size===1){var wt=Array.from(Lt)[0],Xt=mn.findIndex(function(Jt){var xn=Jt.data;return Ct?String(xn.value).startsWith(Ct):xn.value===wt});Xt!==-1&&(Hn(Xt),an(Xt))}});if(Et){var Dt;(Dt=Wt.current)===null||Dt===void 0||Dt.scrollTo(void 0)}return function(){return clearTimeout(bn)}},[Et,Ct]);var jn=function(Dt){Dt!==void 0&&lt(Dt,{selected:!Lt.has(Dt)}),Ot||It(!1)};if(x.useImperativeHandle(At,function(){return{onKeyDown:function(Dt){var wt=Dt.which,Xt=Dt.ctrlKey;switch(wt){case ie.Z.N:case ie.Z.P:case ie.Z.UP:case ie.Z.DOWN:{var Jt=0;if(wt===ie.Z.UP?Jt=-1:wt===ie.Z.DOWN?Jt=1:Yt()&&Xt&&(wt===ie.Z.N?Jt=1:wt===ie.Z.P&&(Jt=-1)),Jt!==0){var xn=cn(en+Jt,Jt);an(xn),Hn(xn,!0)}break}case ie.Z.TAB:case ie.Z.ENTER:{var Yn,tr=mn[en];tr&&!(tr!=null&&(Yn=tr.data)!==null&&Yn!==void 0&&Yn.disabled)&&!Bt?jn(tr.value):jn(void 0),Et&&Dt.preventDefault();break}case ie.Z.ESC:It(!1),Et&&Dt.stopPropagation()}},onKeyUp:function(){},scrollTo:function(Dt){an(Dt)}}}),mn.length===0)return x.createElement("div",{role:"listbox",id:"".concat(Rt,"_list"),className:"".concat(ln,"-empty"),onMouseDown:zt},Zt);var er=Object.keys(Gt).map(function(bn){return Gt[bn]}),Xn=function(Dt){return Dt.label};function _r(bn,Dt){var wt=bn.group;return{role:wt?"presentation":"option",id:"".concat(Rt,"_list_").concat(Dt)}}var ar=function(Dt){var wt=mn[Dt];if(!wt)return null;var Xt=wt.data||{},Jt=Xt.value,xn=wt.group,Yn=(0,ue.Z)(Xt,!0),tr=Xn(wt);return wt?x.createElement("div",(0,k.Z)({"aria-label":typeof tr=="string"&&!xn?tr:null},Yn,{key:Dt},_r(wt,Dt),{"aria-selected":Kn(Jt)}),Jt):null},or={role:"listbox",id:"".concat(Rt,"_list")};return x.createElement(x.Fragment,null,Qt&&x.createElement("div",(0,k.Z)({},or,{style:{height:0,width:0,overflow:"hidden"}}),ar(en-1),ar(en),ar(en+1)),x.createElement(Ft.Z,{itemKey:"key",ref:Wt,data:mn,height:$n,itemHeight:Vt,fullHeight:!1,onMouseDown:zt,onScroll:Nt,virtual:Qt,direction:tn,innerProps:Qt?null:or},function(bn,Dt){var wt=bn.group,Xt=bn.groupOption,Jt=bn.data,xn=bn.label,Yn=bn.value,tr=Jt.key;if(wt){var on,wn=(on=Jt.title)!==null&&on!==void 0?on:Ut(xn)?xn.toString():void 0;return x.createElement("div",{className:h()(ln,"".concat(ln,"-group"),Jt.className),title:wn},xn!==void 0?xn:tr)}var Bn=Jt.disabled,An=Jt.title,dr=Jt.children,Tn=Jt.style,zn=Jt.className,Jn=(0,p.Z)(Jt,at),dn=(0,it.Z)(Jn,er),nr=un(Yn),gr=Bn||!nr&&Bt,cr="".concat(ln,"-option"),xr=h()(ln,cr,zn,(0,Se.Z)((0,Se.Z)((0,Se.Z)((0,Se.Z)({},"".concat(cr,"-grouped"),Xt),"".concat(cr,"-active"),en===Dt&&!gr),"".concat(cr,"-disabled"),gr),"".concat(cr,"-selected"),nr)),Cr=Xn(bn),Ir=!pt||typeof pt=="function"||nr,Er=typeof Cr=="number"?Cr:Cr||Yn,Gn=Ut(Er)?Er.toString():void 0;return An!==void 0&&(Gn=An),x.createElement("div",(0,k.Z)({},(0,ue.Z)(dn),Qt?{}:_r(bn,Dt),{"aria-selected":Kn(Yn),className:xr,title:Gn,onMouseMove:function(){en===Dt||gr||Hn(Dt)},onClick:function(){gr||jn(Yn)},style:Tn}),x.createElement("div",{className:"".concat(cr,"-content")},typeof fn=="function"?fn(bn,{index:Dt}):Er),x.isValidElement(pt)||nr,Ir&&x.createElement(G,{className:"".concat(ln,"-option-state"),customizeIcon:pt,customizeIconProps:{value:Yn,disabled:gr,isSelected:nr}},nr?"\u2713":null))}))},Te=x.forwardRef(Me),Re=Te,B=function(Oe,Le){var At=x.useRef({values:new Map,options:new Map}),rt=x.useMemo(function(){var Rt=At.current,Et=Rt.values,Ot=Rt.options,Mt=Oe.map(function(Zt){if(Zt.label===void 0){var Nt;return(0,le.Z)((0,le.Z)({},Zt),{},{label:(Nt=Et.get(Zt.value))===null||Nt===void 0?void 0:Nt.label})}return Zt}),Ct=new Map,It=new Map;return Mt.forEach(function(Zt){Ct.set(Zt.value,Zt),It.set(Zt.value,Le.get(Zt.value)||Ot.get(Zt.value))}),At.current.values=Ct,At.current.options=It,Mt},[Oe,Le]),St=x.useCallback(function(Rt){return Le.get(Rt)||At.current.options.get(Rt)},[Le]);return[rt,St]};function z(Oe,Le){return ee(Oe).join("").toUpperCase().includes(Le)}var de=function(Oe,Le,At,rt,St){return x.useMemo(function(){if(!At||rt===!1)return Oe;var Rt=Le.options,Et=Le.label,Ot=Le.value,Mt=[],Ct=typeof rt=="function",It=At.toUpperCase(),Zt=Ct?rt:function(ut,Ae){return St?z(Ae[St],It):Ae[Rt]?z(Ae[Et!=="children"?Et:"label"],It):z(Ae[Ot],It)},Nt=Ct?function(ut){return C(ut)}:function(ut){return ut};return Oe.forEach(function(ut){if(ut[Rt]){var Ae=Zt(At,Nt(ut));if(Ae)Mt.push(ut);else{var Ze=ut[Rt].filter(function(He){return Zt(At,Nt(He))});Ze.length&&Mt.push((0,le.Z)((0,le.Z)({},ut),{},(0,Se.Z)({},Rt,Ze)))}return}Zt(At,Nt(ut))&&Mt.push(ut)}),Mt},[Oe,rt,St,At,Le])},fe=T(6551),pe=T(11592),Ve=["children","value"],qe=["children"];function mt(Oe){var Le=Oe,At=Le.key,rt=Le.props,St=rt.children,Rt=rt.value,Et=(0,p.Z)(rt,Ve);return(0,le.Z)({key:At,value:Rt!==void 0?Rt:At,children:St},Et)}function Pt(Oe){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return(0,pe.Z)(Oe).map(function(At,rt){if(!x.isValidElement(At)||!At.type)return null;var St=At,Rt=St.type.isSelectOptGroup,Et=St.key,Ot=St.props,Mt=Ot.children,Ct=(0,p.Z)(Ot,qe);return Le||!Rt?mt(At):(0,le.Z)((0,le.Z)({key:"__RC_SELECT_GRP__".concat(Et===null?rt:Et,"__"),label:Et},Ct),{},{options:Pt(Mt)})}).filter(function(At){return At})}var rn=function(Le,At,rt,St,Rt){return x.useMemo(function(){var Et=Le,Ot=!Le;Ot&&(Et=Pt(At));var Mt=new Map,Ct=new Map,It=function(ut,Ae,Ze){Ze&&typeof Ze=="string"&&ut.set(Ae[Ze],Ae)},Zt=function Nt(ut){for(var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ze=0;Ze<ut.length;Ze+=1){var He=ut[Ze];!He[rt.options]||Ae?(Mt.set(He[rt.value],He),It(Ct,He,rt.label),It(Ct,He,St),It(Ct,He,Rt)):Nt(He[rt.options],!0)}};return Zt(Et),{options:Et,valueOptions:Mt,labelOptions:Ct}},[Le,At,rt,St,Rt])},hn=rn;function qt(Oe){var Le=x.useRef();Le.current=Oe;var At=x.useCallback(function(){return Le.current.apply(Le,arguments)},[]);return At}function sn(Oe){var Le=Oe.mode,At=Oe.options,rt=Oe.children,St=Oe.backfill,Rt=Oe.allowClear,Et=Oe.placeholder,Ot=Oe.getInputElement,Mt=Oe.showSearch,Ct=Oe.onSearch,It=Oe.defaultOpen,Zt=Oe.autoFocus,Nt=Oe.labelInValue,ut=Oe.value,Ae=Oe.inputValue,Ze=Oe.optionLabelProp,He=isMultiple(Le),Je=Mt!==void 0?Mt:He||Le==="combobox",lt=At||convertChildrenToData(rt);if(warning(Le!=="tags"||lt.every(function(Qt){return!Qt.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Le==="tags"||Le==="combobox"){var pt=lt.some(function(Qt){return Qt.options?Qt.options.some(function(tn){return typeof("value"in tn?tn.value:tn.key)=="number"}):typeof("value"in Qt?Qt.value:Qt.key)=="number"});warning(!pt,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(warning(Le!=="combobox"||!Ze,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),warning(Le==="combobox"||!St,"`backfill` only works with `combobox` mode."),warning(Le==="combobox"||!Ot,"`getInputElement` only work with `combobox` mode."),noteOnce(Le!=="combobox"||!Ot||!Rt||!Et,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ct&&!Je&&Le!=="combobox"&&Le!=="tags"&&warning(!1,"`onSearch` should work with `showSearch` instead of use alone."),noteOnce(!It||Zt,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ut!=null){var Lt=toArray(ut);warning(!Nt||Lt.every(function(Qt){return _typeof(Qt)==="object"&&("key"in Qt||"value"in Qt)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),warning(!He||Array.isArray(ut),"`value` should be array when `mode` is `multiple` or `tags`")}if(rt){var Gt=null;toNodeArray(rt).some(function(Qt){if(!React.isValidElement(Qt)||!Qt.type)return!1;var tn=Qt,$n=tn.type;if($n.isSelectOption)return!1;if($n.isSelectOptGroup){var Vt=toNodeArray(Qt.props.children).every(function(fn){return!React.isValidElement(fn)||!Qt.type||fn.type.isSelectOption?!0:(Gt=fn.type,!1)});return!Vt}return Gt=$n,!0}),Gt&&warning(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Gt.displayName||Gt.name||Gt,"`.")),warning(Ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}function Rn(Oe,Le){if(Oe){var At=function rt(St){for(var Rt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Et=0;Et<St.length;Et++){var Ot=St[Et];if(Ot[Le==null?void 0:Le.value]===null)return warning(!1,"`value` in Select options should not be `null`."),!0;if(!Rt&&Array.isArray(Ot[Le==null?void 0:Le.options])&&rt(Ot[Le==null?void 0:Le.options],!0))break}};At(Oe)}}var Zn=null,In=["id","mode","prefixCls","backfill","fieldNames","inputValue","searchValue","onSearch","autoClearSearchValue","onSelect","onDeselect","dropdownMatchSelectWidth","filterOption","filterSort","optionFilterProp","optionLabelProp","options","optionRender","children","defaultActiveFirstOption","menuItemSelectedIcon","virtual","direction","listHeight","listItemHeight","labelRender","value","defaultValue","labelInValue","onChange","maxCount"],Nn=["inputValue"];function kt(Oe){return!Oe||(0,he.Z)(Oe)!=="object"}var ft=x.forwardRef(function(Oe,Le){var At=Oe.id,rt=Oe.mode,St=Oe.prefixCls,Rt=St===void 0?"rc-select":St,Et=Oe.backfill,Ot=Oe.fieldNames,Mt=Oe.inputValue,Ct=Oe.searchValue,It=Oe.onSearch,Zt=Oe.autoClearSearchValue,Nt=Zt===void 0?!0:Zt,ut=Oe.onSelect,Ae=Oe.onDeselect,Ze=Oe.dropdownMatchSelectWidth,He=Ze===void 0?!0:Ze,Je=Oe.filterOption,lt=Oe.filterSort,pt=Oe.optionFilterProp,Lt=Oe.optionLabelProp,Gt=Oe.options,Qt=Oe.optionRender,tn=Oe.children,$n=Oe.defaultActiveFirstOption,Vt=Oe.menuItemSelectedIcon,fn=Oe.virtual,ln=Oe.direction,mn=Oe.listHeight,Wt=mn===void 0?200:mn,Bt=Oe.listItemHeight,zt=Bt===void 0?20:Bt,an=Oe.labelRender,un=Oe.value,cn=Oe.defaultValue,En=Oe.labelInValue,jt=Oe.onChange,en=Oe.maxCount,Qn=(0,p.Z)(Oe,In),Hn=(0,fe.ZP)(At),Kn=Ie(rt),jn=!!(!Gt&&tn),er=x.useMemo(function(){return Je===void 0&&rt==="combobox"?!1:Je},[Je,rt]),Xn=x.useMemo(function(){return be(Ot,jn)},[JSON.stringify(Ot),jn]),_r=(0,oe.Z)("",{value:Ct!==void 0?Ct:Mt,postState:function(Un){return Un||""}}),ar=(0,K.Z)(_r,2),or=ar[0],bn=ar[1],Dt=hn(Gt,tn,Xn,pt,Lt),wt=Dt.valueOptions,Xt=Dt.labelOptions,Jt=Dt.options,xn=x.useCallback(function(Sn){var Un=ee(Sn);return Un.map(function(Pn){var Mn,ur,yr,vn,Ln;if(kt(Pn))Mn=Pn;else{var pr;yr=Pn.key,ur=Pn.label,Mn=(pr=Pn.value)!==null&&pr!==void 0?pr:yr}var rr=wt.get(Mn);if(rr){var mr;if(ur===void 0&&(ur=rr==null?void 0:rr[Lt||Xn.label]),yr===void 0&&(yr=(mr=rr==null?void 0:rr.key)!==null&&mr!==void 0?mr:Mn),vn=rr==null?void 0:rr.disabled,Ln=rr==null?void 0:rr.title,0)var Nr}return{label:ur,value:Mn,key:yr,disabled:vn,title:Ln}})},[Xn,Lt,wt]),Yn=(0,oe.Z)(cn,{value:un}),tr=(0,K.Z)(Yn,2),on=tr[0],wn=tr[1],Bn=x.useMemo(function(){var Sn,Un=Kn&&on===null?[]:on,Pn=xn(Un);return rt==="combobox"&&U((Sn=Pn[0])===null||Sn===void 0?void 0:Sn.value)?[]:Pn},[on,xn,rt,Kn]),An=B(Bn,wt),dr=(0,K.Z)(An,2),Tn=dr[0],zn=dr[1],Jn=x.useMemo(function(){if(!rt&&Tn.length===1){var Sn=Tn[0];if(Sn.value===null&&(Sn.label===null||Sn.label===void 0))return[]}return Tn.map(function(Un){var Pn;return(0,le.Z)((0,le.Z)({},Un),{},{label:(Pn=typeof an=="function"?an(Un):Un.label)!==null&&Pn!==void 0?Pn:Un.value})})},[rt,Tn,an]),dn=x.useMemo(function(){return new Set(Tn.map(function(Sn){return Sn.value}))},[Tn]);x.useEffect(function(){if(rt==="combobox"){var Sn,Un=(Sn=Tn[0])===null||Sn===void 0?void 0:Sn.value;bn(g(Un)?String(Un):"")}},[Tn]);var nr=qt(function(Sn,Un){var Pn=Un!=null?Un:Sn;return(0,Se.Z)((0,Se.Z)({},Xn.value,Sn),Xn.label,Pn)}),gr=x.useMemo(function(){if(rt!=="tags")return Jt;var Sn=(0,ce.Z)(Jt),Un=function(Mn){return wt.has(Mn)};return(0,ce.Z)(Tn).sort(function(Pn,Mn){return Pn.value<Mn.value?-1:1}).forEach(function(Pn){var Mn=Pn.value;Un(Mn)||Sn.push(nr(Mn,Pn.label))}),Sn},[nr,Jt,wt,Tn,rt]),cr=de(gr,Xn,or,er,pt),xr=x.useMemo(function(){return rt!=="tags"||!or||cr.some(function(Sn){return Sn[pt||"value"]===or})||cr.some(function(Sn){return Sn[Xn.value]===or})?cr:[nr(or)].concat((0,ce.Z)(cr))},[nr,pt,rt,cr,or,Xn]),Cr=function Sn(Un){var Pn=(0,ce.Z)(Un).sort(function(Mn,ur){return lt(Mn,ur,{searchValue:or})});return Pn.map(function(Mn){return Array.isArray(Mn.options)?(0,le.Z)((0,le.Z)({},Mn),{},{options:Mn.options.length>0?Sn(Mn.options):Mn.options}):Mn})},Ir=x.useMemo(function(){return lt?Cr(xr):xr},[xr,lt,or]),Er=x.useMemo(function(){return P(Ir,{fieldNames:Xn,childrenAsData:jn})},[Ir,Xn,jn]),Gn=function(Un){var Pn=xn(Un);if(wn(Pn),jt&&(Pn.length!==Tn.length||Pn.some(function(yr,vn){var Ln;return((Ln=Tn[vn])===null||Ln===void 0?void 0:Ln.value)!==(yr==null?void 0:yr.value)}))){var Mn=En?Pn:Pn.map(function(yr){return yr.value}),ur=Pn.map(function(yr){return C(zn(yr.value))});jt(Kn?Mn:Mn[0],Kn?ur:ur[0])}},zr=x.useState(null),Or=(0,K.Z)(zr,2),Wr=Or[0],wr=Or[1],ai=x.useState(0),ti=(0,K.Z)(ai,2),Mr=ti[0],Hr=ti[1],Kr=$n!==void 0?$n:rt!=="combobox",Ur=x.useCallback(function(Sn,Un){var Pn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Mn=Pn.source,ur=Mn===void 0?"keyboard":Mn;Hr(Un),Et&&rt==="combobox"&&Sn!==null&&ur==="keyboard"&&wr(String(Sn))},[Et,rt]),Ar=function(Un,Pn,Mn){var ur=function(){var Qr,oi=zn(Un);return[En?{label:oi==null?void 0:oi[Xn.label],value:Un,key:(Qr=oi==null?void 0:oi.key)!==null&&Qr!==void 0?Qr:Un}:Un,C(oi)]};if(Pn&&ut){var yr=ur(),vn=(0,K.Z)(yr,2),Ln=vn[0],pr=vn[1];ut(Ln,pr)}else if(!Pn&&Ae&&Mn!=="clear"){var rr=ur(),mr=(0,K.Z)(rr,2),Nr=mr[0],fi=mr[1];Ae(Nr,fi)}},Fr=qt(function(Sn,Un){var Pn,Mn=Kn?Un.selected:!0;Mn?Pn=Kn?[].concat((0,ce.Z)(Tn),[Sn]):[Sn]:Pn=Tn.filter(function(ur){return ur.value!==Sn}),Gn(Pn),Ar(Sn,Mn),rt==="combobox"?wr(""):(!Ie||Nt)&&(bn(""),wr(""))}),Gr=function(Un,Pn){Gn(Un);var Mn=Pn.type,ur=Pn.values;(Mn==="remove"||Mn==="clear")&&ur.forEach(function(yr){Ar(yr.value,!1,Mn)})},lr=function(Un,Pn){if(bn(Un),wr(null),Pn.source==="submit"){var Mn=(Un||"").trim();if(Mn){var ur=Array.from(new Set([].concat((0,ce.Z)(dn),[Mn])));Gn(ur),Ar(Mn,!0),bn("")}return}Pn.source!=="blur"&&(rt==="combobox"&&Gn(Un),It==null||It(Un))},On=function(Un){var Pn=Un;rt!=="tags"&&(Pn=Un.map(function(ur){var yr=Xt.get(ur);return yr==null?void 0:yr.value}).filter(function(ur){return ur!==void 0}));var Mn=Array.from(new Set([].concat((0,ce.Z)(dn),(0,ce.Z)(Pn))));Gn(Mn),Mn.forEach(function(ur){Ar(ur,!0)})},hr=x.useMemo(function(){var Sn=fn!==!1&&He!==!1;return(0,le.Z)((0,le.Z)({},Dt),{},{flattenOptions:Er,onActiveValue:Ur,defaultActiveFirstOption:Kr,onSelect:Fr,menuItemSelectedIcon:Vt,rawValues:dn,fieldNames:Xn,virtual:Sn,direction:ln,listHeight:Wt,listItemHeight:zt,childrenAsData:jn,maxCount:en,optionRender:Qt})},[en,Dt,Er,Ur,Kr,Fr,Vt,dn,Xn,fn,He,ln,Wt,zt,jn,Qt]);return x.createElement(Q.Provider,{value:hr},x.createElement(Fe,(0,k.Z)({},Qn,{id:Hn,prefixCls:Rt,ref:Le,omitDomProps:Nn,mode:rt,displayValues:Jn,onDisplayValuesChange:Gr,direction:ln,searchValue:or,onSearch:lr,autoClearSearchValue:Nt,onSearchSplit:On,dropdownMatchSelectWidth:He,OptionList:Re,emptyOptions:!Er.length,activeValue:Wr,activeDescendantId:"".concat(Hn,"_list_").concat(Mr)})))}),Kt=ft;Kt.Option=bt,Kt.OptGroup=je;var _n=Kt,Wn=_n},22711:function(yn,yt,T){"use strict";T.r(yt),T.d(yt,{ResizableTextArea:function(){return Ne},default:function(){return H}});var k=T(14809),ce=T(4635),Se=T(20439),le=T(95190),K=T(50298),p=T(62646),he=T(92310),oe=T.n(he),o=T(36901),x=T(66003),A=T(30292),h=T(18929),m=T(59301),y=T(93664),S=T(29301),O=T(34280),G=T(16089),W=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important;
pointer-events: none !important;
`,I=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],M={},w;function D(ee){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,v=ee.getAttribute("id")||ee.getAttribute("data-reactid")||ee.getAttribute("name");if(j&&M[v])return M[v];var g=window.getComputedStyle(ee),U=g.getPropertyValue("box-sizing")||g.getPropertyValue("-moz-box-sizing")||g.getPropertyValue("-webkit-box-sizing"),te=parseFloat(g.getPropertyValue("padding-bottom"))+parseFloat(g.getPropertyValue("padding-top")),Be=parseFloat(g.getPropertyValue("border-bottom-width"))+parseFloat(g.getPropertyValue("border-top-width")),Ge=I.map(function(et){return"".concat(et,":").concat(g.getPropertyValue(et))}).join(";"),Qe={sizingStyle:Ge,paddingSize:te,borderSize:Be,boxSizing:U};return j&&v&&(M[v]=Qe),Qe}function re(ee){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;w||(w=document.createElement("textarea"),w.setAttribute("tab-index","-1"),w.setAttribute("aria-hidden","true"),w.setAttribute("name","hiddenTextarea"),document.body.appendChild(w)),ee.getAttribute("wrap")?w.setAttribute("wrap",ee.getAttribute("wrap")):w.removeAttribute("wrap");var U=D(ee,j),te=U.paddingSize,Be=U.borderSize,Ge=U.boxSizing,Qe=U.sizingStyle;w.setAttribute("style","".concat(Qe,";").concat(W)),w.value=ee.value||ee.placeholder||"";var et=void 0,gt=void 0,vt,we=w.scrollHeight;if(Ge==="border-box"?we+=Be:Ge==="content-box"&&(we-=te),v!==null||g!==null){w.value=" ";var _t=w.scrollHeight-te;v!==null&&(et=_t*v,Ge==="border-box"&&(et=et+te+Be),we=Math.max(et,we)),g!==null&&(gt=_t*g,Ge==="border-box"&&(gt=gt+te+Be),vt=we>gt?"":"hidden",we=Math.min(gt,we))}var ot={height:we,overflowY:vt,resize:"none"};return et&&(ot.minHeight=et),gt&&(ot.maxHeight=gt),ot}var ie=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],J=0,ue=1,ge=2,Ee=m.forwardRef(function(ee,j){var v=ee,g=v.prefixCls,U=v.defaultValue,te=v.value,Be=v.autoSize,Ge=v.onResize,Qe=v.className,et=v.style,gt=v.disabled,vt=v.onChange,we=v.onInternalAutoSize,_t=(0,p.Z)(v,ie),ot=(0,h.Z)(U,{value:te,postState:function(bt){return bt!=null?bt:""}}),nt=(0,K.Z)(ot,2),Tt=nt[0],Ke=nt[1],_e=function(bt){Ke(bt.target.value),vt==null||vt(bt)},ve=m.useRef();m.useImperativeHandle(j,function(){return{textArea:ve.current}});var F=m.useMemo(function(){return Be&&(0,y.Z)(Be)==="object"?[Be.minRows,Be.maxRows]:[]},[Be]),xe=(0,K.Z)(F,2),ke=xe[0],$=xe[1],R=!!Be,ne=function(){try{if(document.activeElement===ve.current){var bt=ve.current,xt=bt.selectionStart,it=bt.selectionEnd,Ft=bt.scrollTop;ve.current.setSelectionRange(xt,it),ve.current.scrollTop=Ft}}catch(Yt){}},be=m.useState(ge),P=(0,K.Z)(be,2),C=P[0],X=P[1],q=m.useState(),Q=(0,K.Z)(q,2),se=Q[0],me=Q[1],Ce=function(){X(J)};(0,O.Z)(function(){R&&Ce()},[te,ke,$,R]),(0,O.Z)(function(){if(C===J)X(ue);else if(C===ue){var Ue=re(ve.current,!1,ke,$);X(ge),me(Ue)}else ne()},[C]);var Ie=m.useRef(),De=function(){G.Z.cancel(Ie.current)},Fe=function(bt){C===ge&&(Ge==null||Ge(bt),Be&&(De(),Ie.current=(0,G.Z)(function(){Ce()})))};m.useEffect(function(){return De},[]);var ze=R?se:null,je=(0,Se.Z)((0,Se.Z)({},et),ze);return(C===J||C===ue)&&(je.overflowY="hidden",je.overflowX="hidden"),m.createElement(S.Z,{onResize:Fe,disabled:!(Be||Ge)},m.createElement("textarea",(0,k.Z)({},_t,{ref:ve,style:je,className:oe()(g,Qe,(0,ce.Z)({},"".concat(g,"-disabled"),gt)),disabled:gt,value:Tt,onChange:_e})))}),Ne=Ee,Y=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],L=m.forwardRef(function(ee,j){var v,g=ee.defaultValue,U=ee.value,te=ee.onFocus,Be=ee.onBlur,Ge=ee.onChange,Qe=ee.allowClear,et=ee.maxLength,gt=ee.onCompositionStart,vt=ee.onCompositionEnd,we=ee.suffix,_t=ee.prefixCls,ot=_t===void 0?"rc-textarea":_t,nt=ee.showCount,Tt=ee.count,Ke=ee.className,_e=ee.style,ve=ee.disabled,F=ee.hidden,xe=ee.classNames,ke=ee.styles,$=ee.onResize,R=ee.onClear,ne=ee.onPressEnter,be=ee.readOnly,P=ee.autoSize,C=ee.onKeyDown,X=(0,p.Z)(ee,Y),q=(0,h.Z)(g,{value:U,defaultValue:g}),Q=(0,K.Z)(q,2),se=Q[0],me=Q[1],Ce=se==null?"":String(se),Ie=m.useState(!1),De=(0,K.Z)(Ie,2),Fe=De[0],ze=De[1],je=m.useRef(!1),Ue=m.useState(null),bt=(0,K.Z)(Ue,2),xt=bt[0],it=bt[1],Ft=(0,m.useRef)(null),Yt=(0,m.useRef)(null),at=function(){var Kt;return(Kt=Yt.current)===null||Kt===void 0?void 0:Kt.textArea},Ut=function(){at().focus()};(0,m.useImperativeHandle)(j,function(){var ft;return{resizableTextArea:Yt.current,focus:Ut,blur:function(){at().blur()},nativeElement:((ft=Ft.current)===null||ft===void 0?void 0:ft.nativeElement)||at()}}),(0,m.useEffect)(function(){ze(function(ft){return!ve&&ft})},[ve]);var Me=m.useState(null),Te=(0,K.Z)(Me,2),Re=Te[0],B=Te[1];m.useEffect(function(){if(Re){var ft;(ft=at()).setSelectionRange.apply(ft,(0,le.Z)(Re))}},[Re]);var z=(0,x.Z)(Tt,nt),de=(v=z.max)!==null&&v!==void 0?v:et,fe=Number(de)>0,pe=z.strategy(Ce),Ve=!!de&&pe>de,qe=function(Kt,_n){var Wn=_n;!je.current&&z.exceedFormatter&&z.max&&z.strategy(_n)>z.max&&(Wn=z.exceedFormatter(_n,{max:z.max}),_n!==Wn&&B([at().selectionStart||0,at().selectionEnd||0])),me(Wn),(0,A.rJ)(Kt.currentTarget,Kt,Ge,Wn)},mt=function(Kt){je.current=!0,gt==null||gt(Kt)},Pt=function(Kt){je.current=!1,qe(Kt,Kt.currentTarget.value),vt==null||vt(Kt)},rn=function(Kt){qe(Kt,Kt.target.value)},hn=function(Kt){Kt.key==="Enter"&&ne&&ne(Kt),C==null||C(Kt)},qt=function(Kt){ze(!0),te==null||te(Kt)},sn=function(Kt){ze(!1),Be==null||Be(Kt)},Rn=function(Kt){me(""),Ut(),(0,A.rJ)(at(),Kt,Ge)},Zn=we,In;z.show&&(z.showFormatter?In=z.showFormatter({value:Ce,count:pe,maxLength:de}):In="".concat(pe).concat(fe?" / ".concat(de):""),Zn=m.createElement(m.Fragment,null,Zn,m.createElement("span",{className:oe()("".concat(ot,"-data-count"),xe==null?void 0:xe.count),style:ke==null?void 0:ke.count},In)));var Nn=function(Kt){var _n;$==null||$(Kt),(_n=at())!==null&&_n!==void 0&&_n.style.height&&it(!0)},kt=!P&&!nt&&!Qe;return m.createElement(o.BaseInput,{ref:Ft,value:Ce,allowClear:Qe,handleReset:Rn,suffix:Zn,prefixCls:ot,classNames:(0,Se.Z)((0,Se.Z)({},xe),{},{affixWrapper:oe()(xe==null?void 0:xe.affixWrapper,(0,ce.Z)((0,ce.Z)({},"".concat(ot,"-show-count"),nt),"".concat(ot,"-textarea-allow-clear"),Qe))}),disabled:ve,focused:Fe,className:oe()(Ke,Ve&&"".concat(ot,"-out-of-range")),style:(0,Se.Z)((0,Se.Z)({},_e),xt&&!kt?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof In=="string"?In:void 0}},hidden:F,readOnly:be,onClear:R},m.createElement(Ne,(0,k.Z)({},X,{autoSize:P,maxLength:et,onKeyDown:hn,onChange:rn,onFocus:qt,onBlur:sn,onCompositionStart:mt,onCompositionEnd:Pt,className:oe()(xe==null?void 0:xe.textarea),style:(0,Se.Z)((0,Se.Z)({},ke==null?void 0:ke.textarea),{},{resize:_e==null?void 0:_e.resize}),disabled:ve,prefixCls:ot,onResize:Nn,ref:Yt,readOnly:be})))}),V=L,H=V},29125:function(yn,yt,T){"use strict";T.d(yt,{G:function(){return le},Z:function(){return W}});var k=T(92310),ce=T.n(k),Se=T(59301);function le(I){var M=I.children,w=I.prefixCls,D=I.id,re=I.overlayInnerStyle,ie=I.bodyClassName,J=I.className,ue=I.style;return Se.createElement("div",{className:ce()("".concat(w,"-content"),J),style:ue},Se.createElement("div",{className:ce()("".concat(w,"-inner"),ie),id:D,role:"tooltip",style:re},typeof M=="function"?M():M))}var K=T(14809),p=T(20439),he=T(62646),oe=T(65966),o={shiftX:64,adjustY:1},x={adjustX:1,shiftY:!0},A=[0,0],h={left:{points:["cr","cl"],overflow:x,offset:[-4,0],targetOffset:A},right:{points:["cl","cr"],overflow:x,offset:[4,0],targetOffset:A},top:{points:["bc","tc"],overflow:o,offset:[0,-4],targetOffset:A},bottom:{points:["tc","bc"],overflow:o,offset:[0,4],targetOffset:A},topLeft:{points:["bl","tl"],overflow:o,offset:[0,-4],targetOffset:A},leftTop:{points:["tr","tl"],overflow:x,offset:[-4,0],targetOffset:A},topRight:{points:["br","tr"],overflow:o,offset:[0,-4],targetOffset:A},rightTop:{points:["tl","tr"],overflow:x,offset:[4,0],targetOffset:A},bottomRight:{points:["tr","br"],overflow:o,offset:[0,4],targetOffset:A},rightBottom:{points:["bl","br"],overflow:x,offset:[4,0],targetOffset:A},bottomLeft:{points:["tl","bl"],overflow:o,offset:[0,4],targetOffset:A},leftBottom:{points:["br","bl"],overflow:x,offset:[-4,0],targetOffset:A}},m=null,y=T(80402),S=["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(M,w){var D=M.overlayClassName,re=M.trigger,ie=re===void 0?["hover"]:re,J=M.mouseEnterDelay,ue=J===void 0?0:J,ge=M.mouseLeaveDelay,Ee=ge===void 0?.1:ge,Ne=M.overlayStyle,Y=M.prefixCls,L=Y===void 0?"rc-tooltip":Y,V=M.children,H=M.onVisibleChange,ee=M.afterVisibleChange,j=M.transitionName,v=M.animation,g=M.motion,U=M.placement,te=U===void 0?"right":U,Be=M.align,Ge=Be===void 0?{}:Be,Qe=M.destroyTooltipOnHide,et=Qe===void 0?!1:Qe,gt=M.defaultVisible,vt=M.getTooltipContainer,we=M.overlayInnerStyle,_t=M.arrowContent,ot=M.overlay,nt=M.id,Tt=M.showArrow,Ke=Tt===void 0?!0:Tt,_e=M.classNames,ve=M.styles,F=(0,he.Z)(M,S),xe=(0,y.Z)(nt),ke=(0,Se.useRef)(null);(0,Se.useImperativeHandle)(w,function(){return ke.current});var $=(0,p.Z)({},F);"visible"in M&&($.popupVisible=M.visible);var R=function(){return Se.createElement(le,{key:"content",prefixCls:L,id:xe,bodyClassName:_e==null?void 0:_e.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},we),ve==null?void 0:ve.body)},ot)},ne=function(){var P=Se.Children.only(V),C=(P==null?void 0:P.props)||{},X=(0,p.Z)((0,p.Z)({},C),{},{"aria-describedby":ot?xe:null});return Se.cloneElement(V,X)};return Se.createElement(oe.Z,(0,K.Z)({popupClassName:ce()(D,_e==null?void 0:_e.root),prefixCls:L,popup:R,action:ie,builtinPlacements:h,popupPlacement:te,ref:ke,popupAlign:Ge,getPopupContainer:vt,onPopupVisibleChange:H,afterPopupVisibleChange:ee,popupTransitionName:j,popupAnimation:v,popupMotion:g,defaultPopupVisible:gt,autoDestroy:et,mouseLeaveDelay:Ee,popupStyle:(0,p.Z)((0,p.Z)({},Ne),ve==null?void 0:ve.root),mouseEnterDelay:ue,arrow:Ke},$),ne())},G=(0,Se.forwardRef)(O),W=G},9940:function(yn,yt,T){"use strict";T.d(yt,{Qw:function(){return nt},FJ:function(){return Ke},hT:function(){return Tt},OF:function(){return w},ZP:function(){return be}});var k=T(14809),ce=T(95190),Se=T(20439),le=T(50298),K=T(62646),p=T(93664),he=T(37463),oe=T(6551),o=T(34643),x=T(18929),A=T(48736),h=T(59301),m=function(P){var C=h.useRef({valueLabels:new Map});return h.useMemo(function(){var X=C.current.valueLabels,q=new Map,Q=P.map(function(se){var me=se.value,Ce=se.label,Ie=Ce!=null?Ce:X.get(me);return q.set(me,Ie),(0,Se.Z)((0,Se.Z)({},se),{},{label:Ie})});return C.current.valueLabels=q,[Q]},[P])},y=function(C,X,q,Q){return h.useMemo(function(){var se=function(Ue){return Ue.map(function(bt){var xt=bt.value;return xt})},me=se(C),Ce=se(X),Ie=me.filter(function(je){return!Q[je]}),De=me,Fe=Ce;if(q){var ze=(0,o.S)(me,!0,Q);De=ze.checkedKeys,Fe=ze.halfCheckedKeys}return[Array.from(new Set([].concat((0,ce.Z)(Ie),(0,ce.Z)(De)))),Fe]},[C,X,q,Q])},S=y,O=T(34061),G=function(P,C){return h.useMemo(function(){var X=(0,O.I8)(P,{fieldNames:C,initWrapper:function(Q){return(0,Se.Z)((0,Se.Z)({},Q),{},{valueEntities:new Map})},processEntity:function(Q,se){var me=Q.node[C.value];if(0)var Ce;se.valueEntities.set(me,Q)}});return X},[P,C])},W=T(4635),I=T(11592),M=function(){return null},w=M,D=["children","value"];function re(P){return(0,I.Z)(P).map(function(C){if(!h.isValidElement(C)||!C.type)return null;var X=C,q=X.key,Q=X.props,se=Q.children,me=Q.value,Ce=(0,K.Z)(Q,D),Ie=(0,Se.Z)({key:q,value:me},Ce),De=re(se);return De.length&&(Ie.children=De),Ie}).filter(function(C){return C})}function ie(P){if(!P)return P;var C=(0,Se.Z)({},P);return"props"in C||Object.defineProperty(C,"props",{get:function(){return(0,A.ZP)(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),C}}),C}function J(P,C,X,q,Q,se){var me=null,Ce=null;function Ie(){function De(Fe){var ze=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",je=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Fe.map(function(Ue,bt){var xt="".concat(ze,"-").concat(bt),it=Ue[se.value],Ft=X.includes(it),Yt=De(Ue[se.children]||[],xt,Ft),at=h.createElement(w,Ue,Yt.map(function(Me){return Me.node}));if(C===it&&(me=at),Ft){var Ut={pos:xt,node:at,children:Yt};return je||Ce.push(Ut),Ut}return null}).filter(function(Ue){return Ue})}Ce||(Ce=[],De(q),Ce.sort(function(Fe,ze){var je=Fe.node.props.value,Ue=ze.node.props.value,bt=X.indexOf(je),xt=X.indexOf(Ue);return bt-xt}))}Object.defineProperty(P,"triggerNode",{get:function(){return(0,A.ZP)(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),Ie(),me}}),Object.defineProperty(P,"allCheckedNodes",{get:function(){return(0,A.ZP)(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),Ie(),Q?Ce:Ce.map(function(Fe){var ze=Fe.node;return ze})}})}var ue=function(C,X,q){var Q=q.fieldNames,se=q.treeNodeFilterProp,me=q.filterTreeNode,Ce=Q.children;return h.useMemo(function(){if(!X||me===!1)return C;var Ie=typeof me=="function"?me:function(Fe,ze){return String(ze[se]).toUpperCase().includes(X.toUpperCase())},De=function Fe(ze){var je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return ze.reduce(function(Ue,bt){var xt=bt[Ce],it=je||Ie(X,ie(bt)),Ft=Fe(xt||[],it);return(it||Ft.length)&&Ue.push((0,Se.Z)((0,Se.Z)({},bt),{},(0,W.Z)({isLeaf:void 0},Ce,Ft))),Ue},[])};return De(C)},[C,X,Ce,se,me])},ge=ue;function Ee(P){var C=h.useRef();C.current=P;var X=h.useCallback(function(){return C.current.apply(C,arguments)},[]);return X}function Ne(P,C){var X=C.id,q=C.pId,Q=C.rootPId,se=new Map,me=[];return P.forEach(function(Ce){var Ie=Ce[X],De=(0,Se.Z)((0,Se.Z)({},Ce),{},{key:Ce.key||Ie});se.set(Ie,De)}),se.forEach(function(Ce){var Ie=Ce[q],De=se.get(Ie);De?(De.children=De.children||[],De.children.push(Ce)):(Ie===Q||Q===null)&&me.push(Ce)}),me}function Y(P,C,X){return h.useMemo(function(){if(P){if(X){var q=(0,Se.Z)({id:"id",pId:"pId",rootPId:null},(0,p.Z)(X)==="object"?X:{});return Ne(P,q)}return P}return re(C)},[C,X,P])}var L=h.createContext(null),V=L,H=T(37530),ee=T(29530),j=T(10228),v=T(80547),g=h.createContext(null),U=g,te=function(C){return Array.isArray(C)?C:C!==void 0?[C]:[]},Be=function(C){var X=C||{},q=X.label,Q=X.value,se=X.children;return{_title:q?[q]:["title","label"],value:Q||"value",key:Q||"value",children:se||"children"}},Ge=function(C){return!C||C.disabled||C.disableCheckbox||C.checkable===!1},Qe=function(C,X){var q=[],Q=function se(me){me.forEach(function(Ce){var Ie=Ce[X.children];Ie&&(q.push(Ce[X.value]),se(Ie))})};return Q(C),q},et=function(C){return C==null},gt=T(70425),vt={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},we=function(C,X){var q=(0,he.lk)(),Q=q.prefixCls,se=q.multiple,me=q.searchValue,Ce=q.toggleOpen,Ie=q.open,De=q.notFoundContent,Fe=h.useContext(U),ze=Fe.virtual,je=Fe.listHeight,Ue=Fe.listItemHeight,bt=Fe.listItemScrollOffset,xt=Fe.treeData,it=Fe.fieldNames,Ft=Fe.onSelect,Yt=Fe.dropdownMatchSelectWidth,at=Fe.treeExpandAction,Ut=Fe.treeTitleRender,Me=Fe.onPopupScroll,Te=Fe.leftMaxCount,Re=Fe.leafCountOnly,B=Fe.valueEntities,z=h.useContext(V),de=z.checkable,fe=z.checkedKeys,pe=z.halfCheckedKeys,Ve=z.treeExpandedKeys,qe=z.treeDefaultExpandAll,mt=z.treeDefaultExpandedKeys,Pt=z.onTreeExpand,rn=z.treeIcon,hn=z.showTreeIcon,qt=z.switcherIcon,sn=z.treeLine,Rn=z.treeNodeFilterProp,Zn=z.loadData,In=z.treeLoadedKeys,Nn=z.treeMotion,kt=z.onTreeLoad,ft=z.keyEntities,Kt=h.useRef(),_n=(0,v.Z)(function(){return xt},[Ie,xt],function(Wt,Bt){return Bt[0]&&Wt[1]!==Bt[1]}),Wn=h.useMemo(function(){return de?{checked:fe,halfChecked:pe}:null},[de,fe,pe]);h.useEffect(function(){if(Ie&&!se&&fe.length){var Wt;(Wt=Kt.current)===null||Wt===void 0||Wt.scrollTo({key:fe[0]})}},[Ie]);var Oe=function(Bt){Bt.preventDefault()},Le=function(Bt,zt){var an=zt.node;de&&Ge(an)||(Ft(an.key,{selected:!fe.includes(an.key)}),se||Ce(!1))},At=h.useState(mt),rt=(0,le.Z)(At,2),St=rt[0],Rt=rt[1],Et=h.useState(null),Ot=(0,le.Z)(Et,2),Mt=Ot[0],Ct=Ot[1],It=h.useMemo(function(){return Ve?(0,ce.Z)(Ve):me?Mt:St},[St,Mt,Ve,me]),Zt=function(Bt){Rt(Bt),Ct(Bt),Pt&&Pt(Bt)},Nt=String(me).toLowerCase(),ut=function(Bt){return Nt?String(Bt[Rn]).toLowerCase().includes(Nt):!1};h.useEffect(function(){me&&Ct(Qe(xt,it))},[me]);var Ae=h.useState(function(){return new Map}),Ze=(0,le.Z)(Ae,2),He=Ze[0],Je=Ze[1];h.useEffect(function(){Te&&Je(new Map)},[Te]);function lt(Wt){var Bt=Wt[it.value];if(!He.has(Bt)){var zt=B.get(Bt),an=(zt.children||[]).length===0;if(an)He.set(Bt,!1);else{var un=zt.children.filter(function(En){return!En.node.disabled&&!En.node.disableCheckbox&&!fe.includes(En.node[it.value])}),cn=un.length;He.set(Bt,cn>Te)}}return He.get(Bt)}var pt=(0,gt.zX)(function(Wt){var Bt=Wt[it.value];return fe.includes(Bt)||Te===null?!1:Te<=0?!0:Re&&Te?lt(Wt):!1}),Lt=function Wt(Bt){var zt=(0,H.Z)(Bt),an;try{for(zt.s();!(an=zt.n()).done;){var un=an.value;if(!(un.disabled||un.selectable===!1)){if(me){if(ut(un))return un}else return un;if(un[it.children]){var cn=Wt(un[it.children]);if(cn)return cn}}}}catch(En){zt.e(En)}finally{zt.f()}return null},Gt=h.useState(null),Qt=(0,le.Z)(Gt,2),tn=Qt[0],$n=Qt[1],Vt=ft[tn];h.useEffect(function(){if(Ie){var Wt=null,Bt=function(){var an=Lt(_n);return an?an[it.value]:null};!se&&fe.length&&!me?Wt=fe[0]:Wt=Bt(),$n(Wt)}},[Ie,me]),h.useImperativeHandle(X,function(){var Wt;return{scrollTo:(Wt=Kt.current)===null||Wt===void 0?void 0:Wt.scrollTo,onKeyDown:function(zt){var an,un=zt.which;switch(un){case j.Z.UP:case j.Z.DOWN:case j.Z.LEFT:case j.Z.RIGHT:(an=Kt.current)===null||an===void 0||an.onKeyDown(zt);break;case j.Z.ENTER:{if(Vt){var cn=pt(Vt.node),En=(Vt==null?void 0:Vt.node)||{},jt=En.selectable,en=En.value,Qn=En.disabled;jt!==!1&&!Qn&&!cn&&Le(null,{node:{key:tn},selected:!fe.includes(en)})}break}case j.Z.ESC:Ce(!1)}},onKeyUp:function(){}}});var fn=(0,v.Z)(function(){return!me},[me,Ve||St],function(Wt,Bt){var zt=(0,le.Z)(Wt,1),an=zt[0],un=(0,le.Z)(Bt,2),cn=un[0],En=un[1];return an!==cn&&!!(cn||En)}),ln=fn?Zn:null;if(_n.length===0)return h.createElement("div",{role:"listbox",className:"".concat(Q,"-empty"),onMouseDown:Oe},De);var mn={fieldNames:it};return In&&(mn.loadedKeys=In),It&&(mn.expandedKeys=It),h.createElement("div",{onMouseDown:Oe},Vt&&Ie&&h.createElement("span",{style:vt,"aria-live":"assertive"},Vt.node.value),h.createElement(ee.y6.Provider,{value:{nodeDisabled:pt}},h.createElement(ee.ZP,(0,k.Z)({ref:Kt,focusable:!1,prefixCls:"".concat(Q,"-tree"),treeData:_n,height:je,itemHeight:Ue,itemScrollOffset:bt,virtual:ze!==!1&&Yt!==!1,multiple:se,icon:rn,showIcon:hn,switcherIcon:qt,showLine:sn,loadData:ln,motion:Nn,activeKey:tn,checkable:de,checkStrictly:!0,checkedKeys:Wn,selectedKeys:de?[]:fe,defaultExpandAll:qe,titleRender:Ut},mn,{onActiveChange:$n,onSelect:Le,onCheck:Le,onExpand:Zt,onLoad:kt,filterTreeNode:ut,expandAction:at,onScroll:Me}))))},_t=h.forwardRef(we),ot=_t,nt="SHOW_ALL",Tt="SHOW_PARENT",Ke="SHOW_CHILD";function _e(P,C,X,q){var Q=new Set(P);return C===Ke?P.filter(function(se){var me=X[se];return!me||!me.children||!me.children.some(function(Ce){var Ie=Ce.node;return Q.has(Ie[q.value])})||!me.children.every(function(Ce){var Ie=Ce.node;return Ge(Ie)||Q.has(Ie[q.value])})}):C===Tt?P.filter(function(se){var me=X[se],Ce=me?me.parent:null;return!Ce||Ge(Ce.node)||!Q.has(Ce.key)}):P}function ve(P){var C=P.searchPlaceholder,X=P.treeCheckStrictly,q=P.treeCheckable,Q=P.labelInValue,se=P.value,me=P.multiple,Ce=P.showCheckedStrategy,Ie=P.maxCount;warning(!C,"`searchPlaceholder` has been removed."),X&&Q===!1&&warning(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(Q||X)&&warning(toArray(se).every(function(De){return De&&_typeof(De)==="object"&&"value"in De}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),X||me||q?warning(!se||Array.isArray(se),"`value` should be an array when `TreeSelect` is checkable or multiple."):warning(!Array.isArray(se),"`value` should not be array when `TreeSelect` is single mode."),Ie&&(Ce==="SHOW_ALL"&&!X||Ce==="SHOW_PARENT")&&warning(!1,"`maxCount` not work with `showCheckedStrategy=SHOW_ALL` (when `treeCheckStrictly=false`) or `showCheckedStrategy=SHOW_PARENT`.")}var F=null,xe=["id","prefixCls","value","defaultValue","onChange","onSelect","onDeselect","searchValue","inputValue","onSearch","autoClearSearchValue","filterTreeNode","treeNodeFilterProp","showCheckedStrategy","treeNodeLabelProp","multiple","treeCheckable","treeCheckStrictly","labelInValue","maxCount","fieldNames","treeDataSimpleMode","treeData","children","loadData","treeLoadedKeys","onTreeLoad","treeDefaultExpandAll","treeExpandedKeys","treeDefaultExpandedKeys","onTreeExpand","treeExpandAction","virtual","listHeight","listItemHeight","listItemScrollOffset","onDropdownVisibleChange","dropdownMatchSelectWidth","treeLine","treeIcon","showTreeIcon","switcherIcon","treeMotion","treeTitleRender","onPopupScroll"];function ke(P){return!P||(0,p.Z)(P)!=="object"}var $=h.forwardRef(function(P,C){var X=P.id,q=P.prefixCls,Q=q===void 0?"rc-tree-select":q,se=P.value,me=P.defaultValue,Ce=P.onChange,Ie=P.onSelect,De=P.onDeselect,Fe=P.searchValue,ze=P.inputValue,je=P.onSearch,Ue=P.autoClearSearchValue,bt=Ue===void 0?!0:Ue,xt=P.filterTreeNode,it=P.treeNodeFilterProp,Ft=it===void 0?"value":it,Yt=P.showCheckedStrategy,at=P.treeNodeLabelProp,Ut=P.multiple,Me=P.treeCheckable,Te=P.treeCheckStrictly,Re=P.labelInValue,B=P.maxCount,z=P.fieldNames,de=P.treeDataSimpleMode,fe=P.treeData,pe=P.children,Ve=P.loadData,qe=P.treeLoadedKeys,mt=P.onTreeLoad,Pt=P.treeDefaultExpandAll,rn=P.treeExpandedKeys,hn=P.treeDefaultExpandedKeys,qt=P.onTreeExpand,sn=P.treeExpandAction,Rn=P.virtual,Zn=P.listHeight,In=Zn===void 0?200:Zn,Nn=P.listItemHeight,kt=Nn===void 0?20:Nn,ft=P.listItemScrollOffset,Kt=ft===void 0?0:ft,_n=P.onDropdownVisibleChange,Wn=P.dropdownMatchSelectWidth,Oe=Wn===void 0?!0:Wn,Le=P.treeLine,At=P.treeIcon,rt=P.showTreeIcon,St=P.switcherIcon,Rt=P.treeMotion,Et=P.treeTitleRender,Ot=P.onPopupScroll,Mt=(0,K.Z)(P,xe),Ct=(0,oe.ZP)(X),It=Me&&!Te,Zt=Me||Te,Nt=Te||Re,ut=Zt||Ut,Ae=(0,x.Z)(me,{value:se}),Ze=(0,le.Z)(Ae,2),He=Ze[0],Je=Ze[1],lt=h.useMemo(function(){return Me?Yt||Ke:nt},[Yt,Me]),pt=h.useMemo(function(){return Be(z)},[JSON.stringify(z)]),Lt=(0,x.Z)("",{value:Fe!==void 0?Fe:ze,postState:function(wn){return wn||""}}),Gt=(0,le.Z)(Lt,2),Qt=Gt[0],tn=Gt[1],$n=function(wn){tn(wn),je==null||je(wn)},Vt=Y(fe,pe,de),fn=G(Vt,pt),ln=fn.keyEntities,mn=fn.valueEntities,Wt=h.useCallback(function(on){var wn=[],Bn=[];return on.forEach(function(An){mn.has(An)?Bn.push(An):wn.push(An)}),{missingRawValues:wn,existRawValues:Bn}},[mn]),Bt=ge(Vt,Qt,{fieldNames:pt,treeNodeFilterProp:Ft,filterTreeNode:xt}),zt=h.useCallback(function(on){if(on){if(at)return on[at];for(var wn=pt._title,Bn=0;Bn<wn.length;Bn+=1){var An=on[wn[Bn]];if(An!==void 0)return An}}},[pt,at]),an=h.useCallback(function(on){var wn=te(on);return wn.map(function(Bn){return ke(Bn)?{value:Bn}:Bn})},[]),un=h.useCallback(function(on){var wn=an(on);return wn.map(function(Bn){var An=Bn.label,dr=Bn.value,Tn=Bn.halfChecked,zn,Jn=mn.get(dr);if(Jn){var dn;An=Et?Et(Jn.node):(dn=An)!==null&&dn!==void 0?dn:zt(Jn.node),zn=Jn.node.disabled}else if(An===void 0){var nr=an(He).find(function(gr){return gr.value===dr});An=nr.label}return{label:An,value:dr,halfChecked:Tn,disabled:zn}})},[mn,zt,an,He]),cn=h.useMemo(function(){return an(He===null?[]:He)},[an,He]),En=h.useMemo(function(){var on=[],wn=[];return cn.forEach(function(Bn){Bn.halfChecked?wn.push(Bn):on.push(Bn)}),[on,wn]},[cn]),jt=(0,le.Z)(En,2),en=jt[0],Qn=jt[1],Hn=h.useMemo(function(){return en.map(function(on){return on.value})},[en]),Kn=S(en,Qn,It,ln),jn=(0,le.Z)(Kn,2),er=jn[0],Xn=jn[1],_r=h.useMemo(function(){var on=_e(er,lt,ln,pt),wn=on.map(function(Tn){var zn,Jn;return(zn=(Jn=ln[Tn])===null||Jn===void 0||(Jn=Jn.node)===null||Jn===void 0?void 0:Jn[pt.value])!==null&&zn!==void 0?zn:Tn}),Bn=wn.map(function(Tn){var zn=en.find(function(dn){return dn.value===Tn}),Jn=Re?zn==null?void 0:zn.label:Et==null?void 0:Et(zn);return{value:Tn,label:Jn}}),An=un(Bn),dr=An[0];return!ut&&dr&&et(dr.value)&&et(dr.label)?[]:An.map(function(Tn){var zn;return(0,Se.Z)((0,Se.Z)({},Tn),{},{label:(zn=Tn.label)!==null&&zn!==void 0?zn:Tn.value})})},[pt,ut,er,en,un,lt,ln]),ar=m(_r),or=(0,le.Z)(ar,1),bn=or[0],Dt=h.useMemo(function(){return ut&&(lt==="SHOW_CHILD"||Te||!Me)?B:null},[B,ut,Te,lt,Me]),wt=Ee(function(on,wn,Bn){var An=_e(on,lt,ln,pt);if(!(Dt&&An.length>Dt)){var dr=un(on);if(Je(dr),bt&&tn(""),Ce){var Tn=on;It&&(Tn=An.map(function(Er){var Gn=mn.get(Er);return Gn?Gn.node[pt.value]:Er}));var zn=wn||{triggerValue:void 0,selected:void 0},Jn=zn.triggerValue,dn=zn.selected,nr=Tn;if(Te){var gr=Qn.filter(function(Er){return!Tn.includes(Er.value)});nr=[].concat((0,ce.Z)(nr),(0,ce.Z)(gr))}var cr=un(nr),xr={preValue:en,triggerValue:Jn},Cr=!0;(Te||Bn==="selection"&&!dn)&&(Cr=!1),J(xr,Jn,on,Vt,Cr,pt),Zt?xr.checked=dn:xr.selected=dn;var Ir=Nt?cr:cr.map(function(Er){return Er.value});Ce(ut?Ir:Ir[0],Nt?null:cr.map(function(Er){return Er.label}),xr)}}}),Xt=h.useCallback(function(on,wn){var Bn,An=wn.selected,dr=wn.source,Tn=ln[on],zn=Tn==null?void 0:Tn.node,Jn=(Bn=zn==null?void 0:zn[pt.value])!==null&&Bn!==void 0?Bn:on;if(!ut)wt([Jn],{selected:!0,triggerValue:Jn},"option");else{var dn=An?[].concat((0,ce.Z)(Hn),[Jn]):er.filter(function(Gn){return Gn!==Jn});if(It){var nr=Wt(dn),gr=nr.missingRawValues,cr=nr.existRawValues,xr=cr.map(function(Gn){return mn.get(Gn).key}),Cr;if(An){var Ir=(0,o.S)(xr,!0,ln);Cr=Ir.checkedKeys}else{var Er=(0,o.S)(xr,{checked:!1,halfCheckedKeys:Xn},ln);Cr=Er.checkedKeys}dn=[].concat((0,ce.Z)(gr),(0,ce.Z)(Cr.map(function(Gn){return ln[Gn].node[pt.value]})))}wt(dn,{selected:An,triggerValue:Jn},dr||"option")}An||!ut?Ie==null||Ie(Jn,ie(zn)):De==null||De(Jn,ie(zn))},[Wt,mn,ln,pt,ut,Hn,wt,It,Ie,De,er,Xn,B]),Jt=h.useCallback(function(on){if(_n){var wn={};Object.defineProperty(wn,"documentClickClose",{get:function(){return(0,A.ZP)(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),_n(on,wn)}},[_n]),xn=Ee(function(on,wn){var Bn=on.map(function(An){return An.value});if(wn.type==="clear"){wt(Bn,{},"selection");return}wn.values.length&&Xt(wn.values[0].value,{selected:!1,source:"selection"})}),Yn=h.useMemo(function(){return{virtual:Rn,dropdownMatchSelectWidth:Oe,listHeight:In,listItemHeight:kt,listItemScrollOffset:Kt,treeData:Bt,fieldNames:pt,onSelect:Xt,treeExpandAction:sn,treeTitleRender:Et,onPopupScroll:Ot,leftMaxCount:B===void 0?null:B-bn.length,leafCountOnly:lt==="SHOW_CHILD"&&!Te&&!!Me,valueEntities:mn}},[Rn,Oe,In,kt,Kt,Bt,pt,Xt,sn,Et,Ot,B,bn.length,lt,Te,Me,mn]),tr=h.useMemo(function(){return{checkable:Zt,loadData:Ve,treeLoadedKeys:qe,onTreeLoad:mt,checkedKeys:er,halfCheckedKeys:Xn,treeDefaultExpandAll:Pt,treeExpandedKeys:rn,treeDefaultExpandedKeys:hn,onTreeExpand:qt,treeIcon:At,treeMotion:Rt,showTreeIcon:rt,switcherIcon:St,treeLine:Le,treeNodeFilterProp:Ft,keyEntities:ln}},[Zt,Ve,qe,mt,er,Xn,Pt,rn,hn,qt,At,Rt,rt,St,Le,Ft,ln]);return h.createElement(U.Provider,{value:Yn},h.createElement(V.Provider,{value:tr},h.createElement(he.Ac,(0,k.Z)({ref:C},Mt,{id:Ct,prefixCls:Q,mode:ut?"multiple":void 0,displayValues:bn,onDisplayValuesChange:xn,searchValue:Qt,onSearch:$n,OptionList:ot,emptyOptions:!Vt.length,onDropdownVisibleChange:Jt,dropdownMatchSelectWidth:Oe}))))}),R=$;R.TreeNode=w,R.SHOW_ALL=nt,R.SHOW_PARENT=Tt,R.SHOW_CHILD=Ke;var ne=R,be=ne},639:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return M}});var k=T(14809),ce=T(4635),Se=T(20439),le=T(50298),K=T(62646),p=T(59301),he=T(92310),oe=T.n(he),o=T(26112),x=T(30699),A=function(D){for(var re=D.prefixCls,ie=D.level,J=D.isStart,ue=D.isEnd,ge="".concat(re,"-indent-unit"),Ee=[],Ne=0;Ne<ie;Ne+=1)Ee.push(p.createElement("span",{key:Ne,className:oe()(ge,(0,ce.Z)((0,ce.Z)({},"".concat(ge,"-start"),J[Ne]),"".concat(ge,"-end"),ue[Ne]))}));return p.createElement("span",{"aria-hidden":"true",className:"".concat(re,"-indent")},Ee)},h=p.memo(A),m=T(65065),y=T(34061),S=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],O="open",G="close",W="---",I=function(D){var re,ie,J,ue=D.eventKey,ge=D.className,Ee=D.style,Ne=D.dragOver,Y=D.dragOverGapTop,L=D.dragOverGapBottom,V=D.isLeaf,H=D.isStart,ee=D.isEnd,j=D.expanded,v=D.selected,g=D.checked,U=D.halfChecked,te=D.loading,Be=D.domRef,Ge=D.active,Qe=D.data,et=D.onMouseMove,gt=D.selectable,vt=(0,K.Z)(D,S),we=p.useContext(x.k),_t=p.useContext(x.y),ot=p.useRef(null),nt=p.useState(!1),Tt=(0,le.Z)(nt,2),Ke=Tt[0],_e=Tt[1],ve=!!(we.disabled||D.disabled||(re=_t.nodeDisabled)!==null&&re!==void 0&&re.call(_t,Qe)),F=p.useMemo(function(){return!we.checkable||D.checkable===!1?!1:we.checkable},[we.checkable,D.checkable]),xe=function(pe){ve||we.onNodeSelect(pe,(0,y.F)(D))},ke=function(pe){ve||!F||D.disableCheckbox||we.onNodeCheck(pe,(0,y.F)(D),!g)},$=p.useMemo(function(){return typeof gt=="boolean"?gt:we.selectable},[gt,we.selectable]),R=function(pe){we.onNodeClick(pe,(0,y.F)(D)),$?xe(pe):ke(pe)},ne=function(pe){we.onNodeDoubleClick(pe,(0,y.F)(D))},be=function(pe){we.onNodeMouseEnter(pe,(0,y.F)(D))},P=function(pe){we.onNodeMouseLeave(pe,(0,y.F)(D))},C=function(pe){we.onNodeContextMenu(pe,(0,y.F)(D))},X=p.useMemo(function(){return!!(we.draggable&&(!we.draggable.nodeDraggable||we.draggable.nodeDraggable(Qe)))},[we.draggable,Qe]),q=function(pe){pe.stopPropagation(),_e(!0),we.onNodeDragStart(pe,D);try{pe.dataTransfer.setData("text/plain","")}catch(Ve){}},Q=function(pe){pe.preventDefault(),pe.stopPropagation(),we.onNodeDragEnter(pe,D)},se=function(pe){pe.preventDefault(),pe.stopPropagation(),we.onNodeDragOver(pe,D)},me=function(pe){pe.stopPropagation(),we.onNodeDragLeave(pe,D)},Ce=function(pe){pe.stopPropagation(),_e(!1),we.onNodeDragEnd(pe,D)},Ie=function(pe){pe.preventDefault(),pe.stopPropagation(),_e(!1),we.onNodeDrop(pe,D)},De=function(pe){te||we.onNodeExpand(pe,(0,y.F)(D))},Fe=p.useMemo(function(){var fe=(0,m.Z)(we.keyEntities,ue)||{},pe=fe.children;return!!(pe||[]).length},[we.keyEntities,ue]),ze=p.useMemo(function(){return V===!1?!1:V||!we.loadData&&!Fe||we.loadData&&D.loaded&&!Fe},[V,we.loadData,Fe,D.loaded]);p.useEffect(function(){te||typeof we.loadData=="function"&&j&&!ze&&!D.loaded&&we.onNodeLoad((0,y.F)(D))},[te,we.loadData,we.onNodeLoad,j,ze,D]);var je=p.useMemo(function(){var fe;return(fe=we.draggable)!==null&&fe!==void 0&&fe.icon?p.createElement("span",{className:"".concat(we.prefixCls,"-draggable-icon")},we.draggable.icon):null},[we.draggable]),Ue=function(pe){var Ve=D.switcherIcon||we.switcherIcon;return typeof Ve=="function"?Ve((0,Se.Z)((0,Se.Z)({},D),{},{isLeaf:pe})):Ve},bt=function(){if(ze){var pe=Ue(!0);return pe!==!1?p.createElement("span",{className:oe()("".concat(we.prefixCls,"-switcher"),"".concat(we.prefixCls,"-switcher-noop"))},pe):null}var Ve=Ue(!1);return Ve!==!1?p.createElement("span",{onClick:De,className:oe()("".concat(we.prefixCls,"-switcher"),"".concat(we.prefixCls,"-switcher_").concat(j?O:G))},Ve):null},xt=p.useMemo(function(){if(!F)return null;var fe=typeof F!="boolean"?F:null;return p.createElement("span",{className:oe()("".concat(we.prefixCls,"-checkbox"),(0,ce.Z)((0,ce.Z)((0,ce.Z)({},"".concat(we.prefixCls,"-checkbox-checked"),g),"".concat(we.prefixCls,"-checkbox-indeterminate"),!g&&U),"".concat(we.prefixCls,"-checkbox-disabled"),ve||D.disableCheckbox)),onClick:ke,role:"checkbox","aria-checked":U?"mixed":g,"aria-disabled":ve||D.disableCheckbox,"aria-label":"Select ".concat(typeof D.title=="string"?D.title:"tree node")},fe)},[F,g,U,ve,D.disableCheckbox,D.title]),it=p.useMemo(function(){return ze?null:j?O:G},[ze,j]),Ft=p.useMemo(function(){return p.createElement("span",{className:oe()("".concat(we.prefixCls,"-iconEle"),"".concat(we.prefixCls,"-icon__").concat(it||"docu"),(0,ce.Z)({},"".concat(we.prefixCls,"-icon_loading"),te))})},[we.prefixCls,it,te]),Yt=p.useMemo(function(){var fe=!!we.draggable,pe=!D.disabled&&fe&&we.dragOverNodeKey===ue;return pe?we.dropIndicatorRender({dropPosition:we.dropPosition,dropLevelOffset:we.dropLevelOffset,indent:we.indent,prefixCls:we.prefixCls,direction:we.direction}):null},[we.dropPosition,we.dropLevelOffset,we.indent,we.prefixCls,we.direction,we.draggable,we.dragOverNodeKey,we.dropIndicatorRender]),at=p.useMemo(function(){var fe=D.title,pe=fe===void 0?W:fe,Ve="".concat(we.prefixCls,"-node-content-wrapper"),qe;if(we.showIcon){var mt=D.icon||we.icon;qe=mt?p.createElement("span",{className:oe()("".concat(we.prefixCls,"-iconEle"),"".concat(we.prefixCls,"-icon__customize"))},typeof mt=="function"?mt(D):mt):Ft}else we.loadData&&te&&(qe=Ft);var Pt;return typeof pe=="function"?Pt=pe(Qe):we.titleRender?Pt=we.titleRender(Qe):Pt=pe,p.createElement("span",{ref:ot,title:typeof pe=="string"?pe:"",className:oe()(Ve,"".concat(Ve,"-").concat(it||"normal"),(0,ce.Z)({},"".concat(we.prefixCls,"-node-selected"),!ve&&(v||Ke))),onMouseEnter:be,onMouseLeave:P,onContextMenu:C,onClick:R,onDoubleClick:ne},qe,p.createElement("span",{className:"".concat(we.prefixCls,"-title")},Pt),Yt)},[we.prefixCls,we.showIcon,D,we.icon,Ft,we.titleRender,Qe,it,be,P,C,R,ne]),Ut=(0,o.Z)(vt,{aria:!0,data:!0}),Me=(0,m.Z)(we.keyEntities,ue)||{},Te=Me.level,Re=ee[ee.length-1],B=!ve&&X,z=we.draggingNodeKey===ue,de=gt!==void 0?{"aria-selected":!!gt}:void 0;return p.createElement("div",(0,k.Z)({ref:Be,role:"treeitem","aria-expanded":V?void 0:j,className:oe()(ge,"".concat(we.prefixCls,"-treenode"),(J={},(0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)(J,"".concat(we.prefixCls,"-treenode-disabled"),ve),"".concat(we.prefixCls,"-treenode-switcher-").concat(j?"open":"close"),!V),"".concat(we.prefixCls,"-treenode-checkbox-checked"),g),"".concat(we.prefixCls,"-treenode-checkbox-indeterminate"),U),"".concat(we.prefixCls,"-treenode-selected"),v),"".concat(we.prefixCls,"-treenode-loading"),te),"".concat(we.prefixCls,"-treenode-active"),Ge),"".concat(we.prefixCls,"-treenode-leaf-last"),Re),"".concat(we.prefixCls,"-treenode-draggable"),X),"dragging",z),(0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)(J,"drop-target",we.dropTargetKey===ue),"drop-container",we.dropContainerKey===ue),"drag-over",!ve&&Ne),"drag-over-gap-top",!ve&&Y),"drag-over-gap-bottom",!ve&&L),"filter-node",(ie=we.filterTreeNode)===null||ie===void 0?void 0:ie.call(we,(0,y.F)(D))),"".concat(we.prefixCls,"-treenode-leaf"),ze))),style:Ee,draggable:B,onDragStart:B?q:void 0,onDragEnter:X?Q:void 0,onDragOver:X?se:void 0,onDragLeave:X?me:void 0,onDrop:X?Ie:void 0,onDragEnd:X?Ce:void 0,onMouseMove:et},de,Ut),p.createElement(h,{prefixCls:we.prefixCls,level:Te,isStart:H,isEnd:ee}),je,bt(),xt,at)};I.isTreeNode=1;var M=I},30699:function(yn,yt,T){"use strict";T.d(yt,{k:function(){return ce},y:function(){return Se}});var k=T(59301),ce=k.createContext(null),Se=k.createContext({})},29530:function(yn,yt,T){"use strict";T.d(yt,{OF:function(){return ue.Z},y6:function(){return G.y},ZP:function(){return ve}});var k=T(14809),ce=T(93664),Se=T(20439),le=T(95190),K=T(99153),p=T(84851),he=T(13028),oe=T(19257),o=T(93046),x=T(4635),A=T(92310),h=T.n(A),m=T(10228),y=T(26112),S=T(48736),O=T(59301),G=T(30699),W=function(xe){var ke=xe.dropPosition,$=xe.dropLevelOffset,R=xe.indent,ne={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(ke){case-1:ne.top=0,ne.left=-$*R;break;case 1:ne.bottom=0,ne.left=-$*R;break;case 0:ne.bottom=0,ne.left=R;break}return O.createElement("div",{style:ne})},I=W;function M(F){if(F==null)throw new TypeError("Cannot destructure "+F)}var w=T(50298),D=T(62646),re=T(34280),ie=T(6790),J=T(77900),ue=T(639);function ge(F,xe){var ke=O.useState(!1),$=(0,w.Z)(ke,2),R=$[0],ne=$[1];(0,re.Z)(function(){if(R)return F(),function(){xe()}},[R]),(0,re.Z)(function(){return ne(!0),function(){ne(!1)}},[])}var Ee=ge,Ne=T(34061),Y=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],L=O.forwardRef(function(F,xe){var ke=F.className,$=F.style,R=F.motion,ne=F.motionNodes,be=F.motionType,P=F.onMotionStart,C=F.onMotionEnd,X=F.active,q=F.treeNodeRequiredProps,Q=(0,D.Z)(F,Y),se=O.useState(!0),me=(0,w.Z)(se,2),Ce=me[0],Ie=me[1],De=O.useContext(G.k),Fe=De.prefixCls,ze=ne&&be!=="hide";(0,re.Z)(function(){ne&&ze!==Ce&&Ie(ze)},[ne]);var je=function(){ne&&P()},Ue=O.useRef(!1),bt=function(){ne&&!Ue.current&&(Ue.current=!0,C())};Ee(je,bt);var xt=function(Ft){ze===Ft&&bt()};return ne?O.createElement(J.default,(0,k.Z)({ref:xe,visible:Ce},R,{motionAppear:be==="show",onVisibleChanged:xt}),function(it,Ft){var Yt=it.className,at=it.style;return O.createElement("div",{ref:Ft,className:h()("".concat(Fe,"-treenode-motion"),Yt),style:at},ne.map(function(Ut){var Me=Object.assign({},(M(Ut.data),Ut.data)),Te=Ut.title,Re=Ut.key,B=Ut.isStart,z=Ut.isEnd;delete Me.children;var de=(0,Ne.H8)(Re,q);return O.createElement(ue.Z,(0,k.Z)({},Me,de,{title:Te,active:X,data:Ut.data,key:Re,isStart:B,isEnd:z}))}))}):O.createElement(ue.Z,(0,k.Z)({domRef:xe,className:ke,style:$},Q,{active:X}))}),V=L;function H(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ke=F.length,$=xe.length;if(Math.abs(ke-$)!==1)return{add:!1,key:null};function R(ne,be){var P=new Map;ne.forEach(function(X){P.set(X,!0)});var C=be.filter(function(X){return!P.has(X)});return C.length===1?C[0]:null}return ke<$?{add:!0,key:R(F,xe)}:{add:!1,key:R(xe,F)}}function ee(F,xe,ke){var $=F.findIndex(function(P){return P.key===ke}),R=F[$+1],ne=xe.findIndex(function(P){return P.key===ke});if(R){var be=xe.findIndex(function(P){return P.key===R.key});return xe.slice(ne+1,be)}return xe.slice(ne+1)}var j=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","scrollWidth","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],v={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},g=function(){},U="RC_TREE_MOTION_".concat(Math.random()),te={key:U},Be={key:U,level:0,index:0,pos:"0",node:te,nodes:[te]},Ge={parent:null,children:[],pos:Be.pos,data:te,title:null,key:U,isStart:[],isEnd:[]};function Qe(F,xe,ke,$){return xe===!1||!ke?F:F.slice(0,Math.ceil(ke/$)+1)}function et(F){var xe=F.key,ke=F.pos;return(0,Ne.km)(xe,ke)}function gt(F){for(var xe=String(F.data.key),ke=F;ke.parent;)ke=ke.parent,xe="".concat(ke.data.key," > ").concat(xe);return xe}var vt=O.forwardRef(function(F,xe){var ke=F.prefixCls,$=F.data,R=F.selectable,ne=F.checkable,be=F.expandedKeys,P=F.selectedKeys,C=F.checkedKeys,X=F.loadedKeys,q=F.loadingKeys,Q=F.halfCheckedKeys,se=F.keyEntities,me=F.disabled,Ce=F.dragging,Ie=F.dragOverNodeKey,De=F.dropPosition,Fe=F.motion,ze=F.height,je=F.itemHeight,Ue=F.virtual,bt=F.scrollWidth,xt=F.focusable,it=F.activeItem,Ft=F.focused,Yt=F.tabIndex,at=F.onKeyDown,Ut=F.onFocus,Me=F.onBlur,Te=F.onActiveChange,Re=F.onListChangeStart,B=F.onListChangeEnd,z=(0,D.Z)(F,j),de=O.useRef(null),fe=O.useRef(null);O.useImperativeHandle(xe,function(){return{scrollTo:function(Ot){de.current.scrollTo(Ot)},getIndentWidth:function(){return fe.current.offsetWidth}}});var pe=O.useState(be),Ve=(0,w.Z)(pe,2),qe=Ve[0],mt=Ve[1],Pt=O.useState($),rn=(0,w.Z)(Pt,2),hn=rn[0],qt=rn[1],sn=O.useState($),Rn=(0,w.Z)(sn,2),Zn=Rn[0],In=Rn[1],Nn=O.useState([]),kt=(0,w.Z)(Nn,2),ft=kt[0],Kt=kt[1],_n=O.useState(null),Wn=(0,w.Z)(_n,2),Oe=Wn[0],Le=Wn[1],At=O.useRef($);At.current=$;function rt(){var Et=At.current;qt(Et),In(Et),Kt([]),Le(null),B()}(0,re.Z)(function(){mt(be);var Et=H(qe,be);if(Et.key!==null)if(Et.add){var Ot=hn.findIndex(function(ut){var Ae=ut.key;return Ae===Et.key}),Mt=Qe(ee(hn,$,Et.key),Ue,ze,je),Ct=hn.slice();Ct.splice(Ot+1,0,Ge),In(Ct),Kt(Mt),Le("show")}else{var It=$.findIndex(function(ut){var Ae=ut.key;return Ae===Et.key}),Zt=Qe(ee($,hn,Et.key),Ue,ze,je),Nt=$.slice();Nt.splice(It+1,0,Ge),In(Nt),Kt(Zt),Le("hide")}else hn!==$&&(qt($),In($))},[be,$]),O.useEffect(function(){Ce||rt()},[Ce]);var St=Fe?Zn:$,Rt={expandedKeys:be,selectedKeys:P,loadedKeys:X,loadingKeys:q,checkedKeys:C,halfCheckedKeys:Q,dragOverNodeKey:Ie,dropPosition:De,keyEntities:se};return O.createElement(O.Fragment,null,Ft&&it&&O.createElement("span",{style:v,"aria-live":"assertive"},gt(it)),O.createElement("div",null,O.createElement("input",{style:v,disabled:xt===!1||me,tabIndex:xt!==!1?Yt:null,onKeyDown:at,onFocus:Ut,onBlur:Me,value:"",onChange:g,"aria-label":"for screen reader"})),O.createElement("div",{className:"".concat(ke,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},O.createElement("div",{className:"".concat(ke,"-indent")},O.createElement("div",{ref:fe,className:"".concat(ke,"-indent-unit")}))),O.createElement(ie.Z,(0,k.Z)({},z,{data:St,itemKey:et,height:ze,fullHeight:!1,virtual:Ue,itemHeight:je,scrollWidth:bt,prefixCls:"".concat(ke,"-list"),ref:de,role:"tree",onVisibleChange:function(Ot){Ot.every(function(Mt){return et(Mt)!==U})&&rt()}}),function(Et){var Ot=Et.pos,Mt=Object.assign({},(M(Et.data),Et.data)),Ct=Et.title,It=Et.key,Zt=Et.isStart,Nt=Et.isEnd,ut=(0,Ne.km)(It,Ot);delete Mt.key,delete Mt.children;var Ae=(0,Ne.H8)(ut,Rt);return O.createElement(V,(0,k.Z)({},Mt,Ae,{title:Ct,active:!!it&&It===it.key,pos:Ot,data:Et.data,isStart:Zt,isEnd:Nt,motion:Fe,motionNodes:It===U?ft:null,motionType:Oe,onMotionStart:Re,onMotionEnd:rt,treeNodeRequiredProps:Rt,onMouseMove:function(){Te(null)}}))}))}),we=vt,_t=T(82661),ot=T(34643),nt=T(65065),Tt=10,Ke=function(F){(0,oe.Z)(ke,F);var xe=(0,o.Z)(ke);function ke(){var $;(0,K.Z)(this,ke);for(var R=arguments.length,ne=new Array(R),be=0;be<R;be++)ne[be]=arguments[be];return $=xe.call.apply(xe,[this].concat(ne)),(0,x.Z)((0,he.Z)($),"destroyed",!1),(0,x.Z)((0,he.Z)($),"delayedDragEnterLogic",void 0),(0,x.Z)((0,he.Z)($),"loadingRetryTimes",{}),(0,x.Z)((0,he.Z)($),"state",{keyEntities:{},indent:null,selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],draggingNodeKey:null,dragChildrenKeys:[],dropTargetKey:null,dropPosition:null,dropContainerKey:null,dropLevelOffset:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null,fieldNames:(0,Ne.w$)()}),(0,x.Z)((0,he.Z)($),"dragStartMousePosition",null),(0,x.Z)((0,he.Z)($),"dragNodeProps",null),(0,x.Z)((0,he.Z)($),"currentMouseOverDroppableNodeKey",null),(0,x.Z)((0,he.Z)($),"listRef",O.createRef()),(0,x.Z)((0,he.Z)($),"onNodeDragStart",function(P,C){var X=$.state,q=X.expandedKeys,Q=X.keyEntities,se=$.props.onDragStart,me=C.eventKey;$.dragNodeProps=C,$.dragStartMousePosition={x:P.clientX,y:P.clientY};var Ce=(0,_t._5)(q,me);$.setState({draggingNodeKey:me,dragChildrenKeys:(0,_t.wA)(me,Q),indent:$.listRef.current.getIndentWidth()}),$.setExpandedKeys(Ce),window.addEventListener("dragend",$.onWindowDragEnd),se==null||se({event:P,node:(0,Ne.F)(C)})}),(0,x.Z)((0,he.Z)($),"onNodeDragEnter",function(P,C){var X=$.state,q=X.expandedKeys,Q=X.keyEntities,se=X.dragChildrenKeys,me=X.flattenNodes,Ce=X.indent,Ie=$.props,De=Ie.onDragEnter,Fe=Ie.onExpand,ze=Ie.allowDrop,je=Ie.direction,Ue=C.pos,bt=C.eventKey;if($.currentMouseOverDroppableNodeKey!==bt&&($.currentMouseOverDroppableNodeKey=bt),!$.dragNodeProps){$.resetDragState();return}var xt=(0,_t.OM)(P,$.dragNodeProps,C,Ce,$.dragStartMousePosition,ze,me,Q,q,je),it=xt.dropPosition,Ft=xt.dropLevelOffset,Yt=xt.dropTargetKey,at=xt.dropContainerKey,Ut=xt.dropTargetPos,Me=xt.dropAllowed,Te=xt.dragOverNodeKey;if(se.includes(Yt)||!Me){$.resetDragState();return}if($.delayedDragEnterLogic||($.delayedDragEnterLogic={}),Object.keys($.delayedDragEnterLogic).forEach(function(Re){clearTimeout($.delayedDragEnterLogic[Re])}),$.dragNodeProps.eventKey!==C.eventKey&&(P.persist(),$.delayedDragEnterLogic[Ue]=window.setTimeout(function(){if($.state.draggingNodeKey!==null){var Re=(0,le.Z)(q),B=(0,nt.Z)(Q,C.eventKey);B&&(B.children||[]).length&&(Re=(0,_t.L0)(q,C.eventKey)),$.props.hasOwnProperty("expandedKeys")||$.setExpandedKeys(Re),Fe==null||Fe(Re,{node:(0,Ne.F)(C),expanded:!0,nativeEvent:P.nativeEvent})}},800)),$.dragNodeProps.eventKey===Yt&&Ft===0){$.resetDragState();return}$.setState({dragOverNodeKey:Te,dropPosition:it,dropLevelOffset:Ft,dropTargetKey:Yt,dropContainerKey:at,dropTargetPos:Ut,dropAllowed:Me}),De==null||De({event:P,node:(0,Ne.F)(C),expandedKeys:q})}),(0,x.Z)((0,he.Z)($),"onNodeDragOver",function(P,C){var X=$.state,q=X.dragChildrenKeys,Q=X.flattenNodes,se=X.keyEntities,me=X.expandedKeys,Ce=X.indent,Ie=$.props,De=Ie.onDragOver,Fe=Ie.allowDrop,ze=Ie.direction;if($.dragNodeProps){var je=(0,_t.OM)(P,$.dragNodeProps,C,Ce,$.dragStartMousePosition,Fe,Q,se,me,ze),Ue=je.dropPosition,bt=je.dropLevelOffset,xt=je.dropTargetKey,it=je.dropContainerKey,Ft=je.dropTargetPos,Yt=je.dropAllowed,at=je.dragOverNodeKey;q.includes(xt)||!Yt||($.dragNodeProps.eventKey===xt&&bt===0?$.state.dropPosition===null&&$.state.dropLevelOffset===null&&$.state.dropTargetKey===null&&$.state.dropContainerKey===null&&$.state.dropTargetPos===null&&$.state.dropAllowed===!1&&$.state.dragOverNodeKey===null||$.resetDragState():Ue===$.state.dropPosition&&bt===$.state.dropLevelOffset&&xt===$.state.dropTargetKey&&it===$.state.dropContainerKey&&Ft===$.state.dropTargetPos&&Yt===$.state.dropAllowed&&at===$.state.dragOverNodeKey||$.setState({dropPosition:Ue,dropLevelOffset:bt,dropTargetKey:xt,dropContainerKey:it,dropTargetPos:Ft,dropAllowed:Yt,dragOverNodeKey:at}),De==null||De({event:P,node:(0,Ne.F)(C)}))}}),(0,x.Z)((0,he.Z)($),"onNodeDragLeave",function(P,C){$.currentMouseOverDroppableNodeKey===C.eventKey&&!P.currentTarget.contains(P.relatedTarget)&&($.resetDragState(),$.currentMouseOverDroppableNodeKey=null);var X=$.props.onDragLeave;X==null||X({event:P,node:(0,Ne.F)(C)})}),(0,x.Z)((0,he.Z)($),"onWindowDragEnd",function(P){$.onNodeDragEnd(P,null,!0),window.removeEventListener("dragend",$.onWindowDragEnd)}),(0,x.Z)((0,he.Z)($),"onNodeDragEnd",function(P,C){var X=$.props.onDragEnd;$.setState({dragOverNodeKey:null}),$.cleanDragState(),X==null||X({event:P,node:(0,Ne.F)(C)}),$.dragNodeProps=null,window.removeEventListener("dragend",$.onWindowDragEnd)}),(0,x.Z)((0,he.Z)($),"onNodeDrop",function(P,C){var X,q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Q=$.state,se=Q.dragChildrenKeys,me=Q.dropPosition,Ce=Q.dropTargetKey,Ie=Q.dropTargetPos,De=Q.dropAllowed;if(De){var Fe=$.props.onDrop;if($.setState({dragOverNodeKey:null}),$.cleanDragState(),Ce!==null){var ze=(0,Se.Z)((0,Se.Z)({},(0,Ne.H8)(Ce,$.getTreeNodeRequiredProps())),{},{active:((X=$.getActiveItem())===null||X===void 0?void 0:X.key)===Ce,data:(0,nt.Z)($.state.keyEntities,Ce).node}),je=se.includes(Ce);(0,S.ZP)(!je,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var Ue=(0,_t.yx)(Ie),bt={event:P,node:(0,Ne.F)(ze),dragNode:$.dragNodeProps?(0,Ne.F)($.dragNodeProps):null,dragNodesKeys:[$.dragNodeProps.eventKey].concat(se),dropToGap:me!==0,dropPosition:me+Number(Ue[Ue.length-1])};q||Fe==null||Fe(bt),$.dragNodeProps=null}}}),(0,x.Z)((0,he.Z)($),"cleanDragState",function(){var P=$.state.draggingNodeKey;P!==null&&$.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),$.dragStartMousePosition=null,$.currentMouseOverDroppableNodeKey=null}),(0,x.Z)((0,he.Z)($),"triggerExpandActionExpand",function(P,C){var X=$.state,q=X.expandedKeys,Q=X.flattenNodes,se=C.expanded,me=C.key,Ce=C.isLeaf;if(!(Ce||P.shiftKey||P.metaKey||P.ctrlKey)){var Ie=Q.filter(function(Fe){return Fe.key===me})[0],De=(0,Ne.F)((0,Se.Z)((0,Se.Z)({},(0,Ne.H8)(me,$.getTreeNodeRequiredProps())),{},{data:Ie.data}));$.setExpandedKeys(se?(0,_t._5)(q,me):(0,_t.L0)(q,me)),$.onNodeExpand(P,De)}}),(0,x.Z)((0,he.Z)($),"onNodeClick",function(P,C){var X=$.props,q=X.onClick,Q=X.expandAction;Q==="click"&&$.triggerExpandActionExpand(P,C),q==null||q(P,C)}),(0,x.Z)((0,he.Z)($),"onNodeDoubleClick",function(P,C){var X=$.props,q=X.onDoubleClick,Q=X.expandAction;Q==="doubleClick"&&$.triggerExpandActionExpand(P,C),q==null||q(P,C)}),(0,x.Z)((0,he.Z)($),"onNodeSelect",function(P,C){var X=$.state.selectedKeys,q=$.state,Q=q.keyEntities,se=q.fieldNames,me=$.props,Ce=me.onSelect,Ie=me.multiple,De=C.selected,Fe=C[se.key],ze=!De;ze?Ie?X=(0,_t.L0)(X,Fe):X=[Fe]:X=(0,_t._5)(X,Fe);var je=X.map(function(Ue){var bt=(0,nt.Z)(Q,Ue);return bt?bt.node:null}).filter(Boolean);$.setUncontrolledState({selectedKeys:X}),Ce==null||Ce(X,{event:"select",selected:ze,node:C,selectedNodes:je,nativeEvent:P.nativeEvent})}),(0,x.Z)((0,he.Z)($),"onNodeCheck",function(P,C,X){var q=$.state,Q=q.keyEntities,se=q.checkedKeys,me=q.halfCheckedKeys,Ce=$.props,Ie=Ce.checkStrictly,De=Ce.onCheck,Fe=C.key,ze,je={event:"check",node:C,checked:X,nativeEvent:P.nativeEvent};if(Ie){var Ue=X?(0,_t.L0)(se,Fe):(0,_t._5)(se,Fe),bt=(0,_t._5)(me,Fe);ze={checked:Ue,halfChecked:bt},je.checkedNodes=Ue.map(function(Ut){return(0,nt.Z)(Q,Ut)}).filter(Boolean).map(function(Ut){return Ut.node}),$.setUncontrolledState({checkedKeys:Ue})}else{var xt=(0,ot.S)([].concat((0,le.Z)(se),[Fe]),!0,Q),it=xt.checkedKeys,Ft=xt.halfCheckedKeys;if(!X){var Yt=new Set(it);Yt.delete(Fe);var at=(0,ot.S)(Array.from(Yt),{checked:!1,halfCheckedKeys:Ft},Q);it=at.checkedKeys,Ft=at.halfCheckedKeys}ze=it,je.checkedNodes=[],je.checkedNodesPositions=[],je.halfCheckedKeys=Ft,it.forEach(function(Ut){var Me=(0,nt.Z)(Q,Ut);if(Me){var Te=Me.node,Re=Me.pos;je.checkedNodes.push(Te),je.checkedNodesPositions.push({node:Te,pos:Re})}}),$.setUncontrolledState({checkedKeys:it},!1,{halfCheckedKeys:Ft})}De==null||De(ze,je)}),(0,x.Z)((0,he.Z)($),"onNodeLoad",function(P){var C,X=P.key,q=$.state.keyEntities,Q=(0,nt.Z)(q,X);if(!(Q!=null&&(C=Q.children)!==null&&C!==void 0&&C.length)){var se=new Promise(function(me,Ce){$.setState(function(Ie){var De=Ie.loadedKeys,Fe=De===void 0?[]:De,ze=Ie.loadingKeys,je=ze===void 0?[]:ze,Ue=$.props,bt=Ue.loadData,xt=Ue.onLoad;if(!bt||Fe.includes(X)||je.includes(X))return null;var it=bt(P);return it.then(function(){var Ft=$.state.loadedKeys,Yt=(0,_t.L0)(Ft,X);xt==null||xt(Yt,{event:"load",node:P}),$.setUncontrolledState({loadedKeys:Yt}),$.setState(function(at){return{loadingKeys:(0,_t._5)(at.loadingKeys,X)}}),me()}).catch(function(Ft){if($.setState(function(at){return{loadingKeys:(0,_t._5)(at.loadingKeys,X)}}),$.loadingRetryTimes[X]=($.loadingRetryTimes[X]||0)+1,$.loadingRetryTimes[X]>=Tt){var Yt=$.state.loadedKeys;(0,S.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),$.setUncontrolledState({loadedKeys:(0,_t.L0)(Yt,X)}),me()}Ce(Ft)}),{loadingKeys:(0,_t.L0)(je,X)}})});return se.catch(function(){}),se}}),(0,x.Z)((0,he.Z)($),"onNodeMouseEnter",function(P,C){var X=$.props.onMouseEnter;X==null||X({event:P,node:C})}),(0,x.Z)((0,he.Z)($),"onNodeMouseLeave",function(P,C){var X=$.props.onMouseLeave;X==null||X({event:P,node:C})}),(0,x.Z)((0,he.Z)($),"onNodeContextMenu",function(P,C){var X=$.props.onRightClick;X&&(P.preventDefault(),X({event:P,node:C}))}),(0,x.Z)((0,he.Z)($),"onFocus",function(){var P=$.props.onFocus;$.setState({focused:!0});for(var C=arguments.length,X=new Array(C),q=0;q<C;q++)X[q]=arguments[q];P==null||P.apply(void 0,X)}),(0,x.Z)((0,he.Z)($),"onBlur",function(){var P=$.props.onBlur;$.setState({focused:!1}),$.onActiveChange(null);for(var C=arguments.length,X=new Array(C),q=0;q<C;q++)X[q]=arguments[q];P==null||P.apply(void 0,X)}),(0,x.Z)((0,he.Z)($),"getTreeNodeRequiredProps",function(){var P=$.state,C=P.expandedKeys,X=P.selectedKeys,q=P.loadedKeys,Q=P.loadingKeys,se=P.checkedKeys,me=P.halfCheckedKeys,Ce=P.dragOverNodeKey,Ie=P.dropPosition,De=P.keyEntities;return{expandedKeys:C||[],selectedKeys:X||[],loadedKeys:q||[],loadingKeys:Q||[],checkedKeys:se||[],halfCheckedKeys:me||[],dragOverNodeKey:Ce,dropPosition:Ie,keyEntities:De}}),(0,x.Z)((0,he.Z)($),"setExpandedKeys",function(P){var C=$.state,X=C.treeData,q=C.fieldNames,Q=(0,Ne.oH)(X,P,q);$.setUncontrolledState({expandedKeys:P,flattenNodes:Q},!0)}),(0,x.Z)((0,he.Z)($),"onNodeExpand",function(P,C){var X=$.state.expandedKeys,q=$.state,Q=q.listChanging,se=q.fieldNames,me=$.props,Ce=me.onExpand,Ie=me.loadData,De=C.expanded,Fe=C[se.key];if(!Q){var ze=X.includes(Fe),je=!De;if((0,S.ZP)(De&&ze||!De&&!ze,"Expand state not sync with index check"),X=je?(0,_t.L0)(X,Fe):(0,_t._5)(X,Fe),$.setExpandedKeys(X),Ce==null||Ce(X,{node:C,expanded:je,nativeEvent:P.nativeEvent}),je&&Ie){var Ue=$.onNodeLoad(C);Ue&&Ue.then(function(){var bt=(0,Ne.oH)($.state.treeData,X,se);$.setUncontrolledState({flattenNodes:bt})}).catch(function(){var bt=$.state.expandedKeys,xt=(0,_t._5)(bt,Fe);$.setExpandedKeys(xt)})}}}),(0,x.Z)((0,he.Z)($),"onListChangeStart",function(){$.setUncontrolledState({listChanging:!0})}),(0,x.Z)((0,he.Z)($),"onListChangeEnd",function(){setTimeout(function(){$.setUncontrolledState({listChanging:!1})})}),(0,x.Z)((0,he.Z)($),"onActiveChange",function(P){var C=$.state.activeKey,X=$.props,q=X.onActiveChange,Q=X.itemScrollOffset,se=Q===void 0?0:Q;C!==P&&($.setState({activeKey:P}),P!==null&&$.scrollTo({key:P,offset:se}),q==null||q(P))}),(0,x.Z)((0,he.Z)($),"getActiveItem",function(){var P=$.state,C=P.activeKey,X=P.flattenNodes;return C===null?null:X.find(function(q){var Q=q.key;return Q===C})||null}),(0,x.Z)((0,he.Z)($),"offsetActiveKey",function(P){var C=$.state,X=C.flattenNodes,q=C.activeKey,Q=X.findIndex(function(Ce){var Ie=Ce.key;return Ie===q});Q===-1&&P<0&&(Q=X.length),Q=(Q+P+X.length)%X.length;var se=X[Q];if(se){var me=se.key;$.onActiveChange(me)}else $.onActiveChange(null)}),(0,x.Z)((0,he.Z)($),"onKeyDown",function(P){var C=$.state,X=C.activeKey,q=C.expandedKeys,Q=C.checkedKeys,se=C.fieldNames,me=$.props,Ce=me.onKeyDown,Ie=me.checkable,De=me.selectable;switch(P.which){case m.Z.UP:{$.offsetActiveKey(-1),P.preventDefault();break}case m.Z.DOWN:{$.offsetActiveKey(1),P.preventDefault();break}}var Fe=$.getActiveItem();if(Fe&&Fe.data){var ze=$.getTreeNodeRequiredProps(),je=Fe.data.isLeaf===!1||!!(Fe.data[se.children]||[]).length,Ue=(0,Ne.F)((0,Se.Z)((0,Se.Z)({},(0,Ne.H8)(X,ze)),{},{data:Fe.data,active:!0}));switch(P.which){case m.Z.LEFT:{je&&q.includes(X)?$.onNodeExpand({},Ue):Fe.parent&&$.onActiveChange(Fe.parent.key),P.preventDefault();break}case m.Z.RIGHT:{je&&!q.includes(X)?$.onNodeExpand({},Ue):Fe.children&&Fe.children.length&&$.onActiveChange(Fe.children[0].key),P.preventDefault();break}case m.Z.ENTER:case m.Z.SPACE:{Ie&&!Ue.disabled&&Ue.checkable!==!1&&!Ue.disableCheckbox?$.onNodeCheck({},Ue,!Q.includes(X)):!Ie&&De&&!Ue.disabled&&Ue.selectable!==!1&&$.onNodeSelect({},Ue);break}}}Ce==null||Ce(P)}),(0,x.Z)((0,he.Z)($),"setUncontrolledState",function(P){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,X=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!$.destroyed){var q=!1,Q=!0,se={};Object.keys(P).forEach(function(me){if($.props.hasOwnProperty(me)){Q=!1;return}q=!0,se[me]=P[me]}),q&&(!C||Q)&&$.setState((0,Se.Z)((0,Se.Z)({},se),X))}}),(0,x.Z)((0,he.Z)($),"scrollTo",function(P){$.listRef.current.scrollTo(P)}),$}return(0,p.Z)(ke,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var R=this.props,ne=R.activeKey,be=R.itemScrollOffset,P=be===void 0?0:be;ne!==void 0&&ne!==this.state.activeKey&&(this.setState({activeKey:ne}),ne!==null&&this.scrollTo({key:ne,offset:P}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var R=this.state,ne=R.focused,be=R.flattenNodes,P=R.keyEntities,C=R.draggingNodeKey,X=R.activeKey,q=R.dropLevelOffset,Q=R.dropContainerKey,se=R.dropTargetKey,me=R.dropPosition,Ce=R.dragOverNodeKey,Ie=R.indent,De=this.props,Fe=De.prefixCls,ze=De.className,je=De.style,Ue=De.showLine,bt=De.focusable,xt=De.tabIndex,it=xt===void 0?0:xt,Ft=De.selectable,Yt=De.showIcon,at=De.icon,Ut=De.switcherIcon,Me=De.draggable,Te=De.checkable,Re=De.checkStrictly,B=De.disabled,z=De.motion,de=De.loadData,fe=De.filterTreeNode,pe=De.height,Ve=De.itemHeight,qe=De.scrollWidth,mt=De.virtual,Pt=De.titleRender,rn=De.dropIndicatorRender,hn=De.onContextMenu,qt=De.onScroll,sn=De.direction,Rn=De.rootClassName,Zn=De.rootStyle,In=(0,y.Z)(this.props,{aria:!0,data:!0}),Nn;Me&&((0,ce.Z)(Me)==="object"?Nn=Me:typeof Me=="function"?Nn={nodeDraggable:Me}:Nn={});var kt={prefixCls:Fe,selectable:Ft,showIcon:Yt,icon:at,switcherIcon:Ut,draggable:Nn,draggingNodeKey:C,checkable:Te,checkStrictly:Re,disabled:B,keyEntities:P,dropLevelOffset:q,dropContainerKey:Q,dropTargetKey:se,dropPosition:me,dragOverNodeKey:Ce,indent:Ie,direction:sn,dropIndicatorRender:rn,loadData:de,filterTreeNode:fe,titleRender:Pt,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop};return O.createElement(G.k.Provider,{value:kt},O.createElement("div",{className:h()(Fe,ze,Rn,(0,x.Z)((0,x.Z)((0,x.Z)({},"".concat(Fe,"-show-line"),Ue),"".concat(Fe,"-focused"),ne),"".concat(Fe,"-active-focused"),X!==null)),style:Zn},O.createElement(we,(0,k.Z)({ref:this.listRef,prefixCls:Fe,style:je,data:be,disabled:B,selectable:Ft,checkable:!!Te,motion:z,dragging:C!==null,height:pe,itemHeight:Ve,virtual:mt,focusable:bt,focused:ne,tabIndex:it,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:hn,onScroll:qt,scrollWidth:qe},this.getTreeNodeRequiredProps(),In))))}}],[{key:"getDerivedStateFromProps",value:function(R,ne){var be=ne.prevProps,P={prevProps:R};function C(it){return!be&&R.hasOwnProperty(it)||be&&be[it]!==R[it]}var X,q=ne.fieldNames;if(C("fieldNames")&&(q=(0,Ne.w$)(R.fieldNames),P.fieldNames=q),C("treeData")?X=R.treeData:C("children")&&((0,S.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),X=(0,Ne.zn)(R.children)),X){P.treeData=X;var Q=(0,Ne.I8)(X,{fieldNames:q});P.keyEntities=(0,Se.Z)((0,x.Z)({},U,Be),Q.keyEntities)}var se=P.keyEntities||ne.keyEntities;if(C("expandedKeys")||be&&C("autoExpandParent"))P.expandedKeys=R.autoExpandParent||!be&&R.defaultExpandParent?(0,_t.r7)(R.expandedKeys,se):R.expandedKeys;else if(!be&&R.defaultExpandAll){var me=(0,Se.Z)({},se);delete me[U];var Ce=[];Object.keys(me).forEach(function(it){var Ft=me[it];Ft.children&&Ft.children.length&&Ce.push(Ft.key)}),P.expandedKeys=Ce}else!be&&R.defaultExpandedKeys&&(P.expandedKeys=R.autoExpandParent||R.defaultExpandParent?(0,_t.r7)(R.defaultExpandedKeys,se):R.defaultExpandedKeys);if(P.expandedKeys||delete P.expandedKeys,X||P.expandedKeys){var Ie=(0,Ne.oH)(X||ne.treeData,P.expandedKeys||ne.expandedKeys,q);P.flattenNodes=Ie}if(R.selectable&&(C("selectedKeys")?P.selectedKeys=(0,_t.BT)(R.selectedKeys,R):!be&&R.defaultSelectedKeys&&(P.selectedKeys=(0,_t.BT)(R.defaultSelectedKeys,R))),R.checkable){var De;if(C("checkedKeys")?De=(0,_t.E6)(R.checkedKeys)||{}:!be&&R.defaultCheckedKeys?De=(0,_t.E6)(R.defaultCheckedKeys)||{}:X&&(De=(0,_t.E6)(R.checkedKeys)||{checkedKeys:ne.checkedKeys,halfCheckedKeys:ne.halfCheckedKeys}),De){var Fe=De,ze=Fe.checkedKeys,je=ze===void 0?[]:ze,Ue=Fe.halfCheckedKeys,bt=Ue===void 0?[]:Ue;if(!R.checkStrictly){var xt=(0,ot.S)(je,!0,se);je=xt.checkedKeys,bt=xt.halfCheckedKeys}P.checkedKeys=je,P.halfCheckedKeys=bt}}return C("loadedKeys")&&(P.loadedKeys=R.loadedKeys),P}}]),ke}(O.Component);(0,x.Z)(Ke,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:I,allowDrop:function(){return!0},expandAction:!1}),(0,x.Z)(Ke,"TreeNode",ue.Z);var _e=Ke,ve=_e},82661:function(yn,yt,T){"use strict";T.d(yt,{BT:function(){return O},E6:function(){return I},L0:function(){return x},OM:function(){return S},_5:function(){return o},r7:function(){return M},wA:function(){return h},yx:function(){return A}});var k=T(95190),ce=T(93664),Se=T(48736),le=T(59301),K=T(639),p=T(65065),he=T(34061),oe=null;function o(w,D){if(!w)return[];var re=w.slice(),ie=re.indexOf(D);return ie>=0&&re.splice(ie,1),re}function x(w,D){var re=(w||[]).slice();return re.indexOf(D)===-1&&re.push(D),re}function A(w){return w.split("-")}function h(w,D){var re=[],ie=(0,p.Z)(D,w);function J(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];ue.forEach(function(ge){var Ee=ge.key,Ne=ge.children;re.push(Ee),J(Ne)})}return J(ie.children),re}function m(w){if(w.parent){var D=A(w.pos);return Number(D[D.length-1])===w.parent.children.length-1}return!1}function y(w){var D=A(w.pos);return Number(D[D.length-1])===0}function S(w,D,re,ie,J,ue,ge,Ee,Ne,Y){var L,V=w.clientX,H=w.clientY,ee=w.target.getBoundingClientRect(),j=ee.top,v=ee.height,g=(Y==="rtl"?-1:1)*(((J==null?void 0:J.x)||0)-V),U=(g-12)/ie,te=Ne.filter(function(ve){var F;return(F=Ee[ve])===null||F===void 0||(F=F.children)===null||F===void 0?void 0:F.length}),Be=(0,p.Z)(Ee,re.eventKey);if(H<j+v/2){var Ge=ge.findIndex(function(ve){return ve.key===Be.key}),Qe=Ge<=0?0:Ge-1,et=ge[Qe].key;Be=(0,p.Z)(Ee,et)}var gt=Be.key,vt=Be,we=Be.key,_t=0,ot=0;if(!te.includes(gt))for(var nt=0;nt<U&&m(Be);nt+=1)Be=Be.parent,ot+=1;var Tt=D.data,Ke=Be.node,_e=!0;return y(Be)&&Be.level===0&&H<j+v/2&&ue({dragNode:Tt,dropNode:Ke,dropPosition:-1})&&Be.key===re.eventKey?_t=-1:(vt.children||[]).length&&te.includes(we)?ue({dragNode:Tt,dropNode:Ke,dropPosition:0})?_t=0:_e=!1:ot===0?U>-1.5?ue({dragNode:Tt,dropNode:Ke,dropPosition:1})?_t=1:_e=!1:ue({dragNode:Tt,dropNode:Ke,dropPosition:0})?_t=0:ue({dragNode:Tt,dropNode:Ke,dropPosition:1})?_t=1:_e=!1:ue({dragNode:Tt,dropNode:Ke,dropPosition:1})?_t=1:_e=!1,{dropPosition:_t,dropLevelOffset:ot,dropTargetKey:Be.key,dropTargetPos:Be.pos,dragOverNodeKey:we,dropContainerKey:_t===0?null:((L=Be.parent)===null||L===void 0?void 0:L.key)||null,dropAllowed:_e}}function O(w,D){if(w){var re=D.multiple;return re?w.slice():w.length?[w[0]]:w}}var G=function(D){return D};function W(w,D){if(!w)return[];var re=D||{},ie=re.processProps,J=ie===void 0?G:ie,ue=Array.isArray(w)?w:[w];return ue.map(function(ge){var Ee=ge.children,Ne=_objectWithoutProperties(ge,oe),Y=W(Ee,D);return React.createElement(TreeNode,_extends({key:Ne.key},J(Ne)),Y)})}function I(w){if(!w)return null;var D;if(Array.isArray(w))D={checkedKeys:w,halfCheckedKeys:void 0};else if((0,ce.Z)(w)==="object")D={checkedKeys:w.checked||void 0,halfCheckedKeys:w.halfChecked||void 0};else return(0,Se.ZP)(!1,"`checkedKeys` is not an array or an object"),null;return D}function M(w,D){var re=new Set;function ie(J){if(!re.has(J)){var ue=(0,p.Z)(D,J);if(ue){re.add(J);var ge=ue.parent,Ee=ue.node;Ee.disabled||ge&&ie(ge.key)}}}return(w||[]).forEach(function(J){ie(J)}),(0,k.Z)(re)}},34643:function(yn,yt,T){"use strict";T.d(yt,{S:function(){return he}});var k=T(48736),ce=T(65065);function Se(oe,o){var x=new Set;return oe.forEach(function(A){o.has(A)||x.add(A)}),x}function le(oe){var o=oe||{},x=o.disabled,A=o.disableCheckbox,h=o.checkable;return!!(x||A)||h===!1}function K(oe,o,x,A){for(var h=new Set(oe),m=new Set,y=0;y<=x;y+=1){var S=o.get(y)||new Set;S.forEach(function(I){var M=I.key,w=I.node,D=I.children,re=D===void 0?[]:D;h.has(M)&&!A(w)&&re.filter(function(ie){return!A(ie.node)}).forEach(function(ie){h.add(ie.key)})})}for(var O=new Set,G=x;G>=0;G-=1){var W=o.get(G)||new Set;W.forEach(function(I){var M=I.parent,w=I.node;if(!(A(w)||!I.parent||O.has(I.parent.key))){if(A(I.parent.node)){O.add(M.key);return}var D=!0,re=!1;(M.children||[]).filter(function(ie){return!A(ie.node)}).forEach(function(ie){var J=ie.key,ue=h.has(J);D&&!ue&&(D=!1),!re&&(ue||m.has(J))&&(re=!0)}),D&&h.add(M.key),re&&m.add(M.key),O.add(M.key)}})}return{checkedKeys:Array.from(h),halfCheckedKeys:Array.from(Se(m,h))}}function p(oe,o,x,A,h){for(var m=new Set(oe),y=new Set(o),S=0;S<=A;S+=1){var O=x.get(S)||new Set;O.forEach(function(M){var w=M.key,D=M.node,re=M.children,ie=re===void 0?[]:re;!m.has(w)&&!y.has(w)&&!h(D)&&ie.filter(function(J){return!h(J.node)}).forEach(function(J){m.delete(J.key)})})}y=new Set;for(var G=new Set,W=A;W>=0;W-=1){var I=x.get(W)||new Set;I.forEach(function(M){var w=M.parent,D=M.node;if(!(h(D)||!M.parent||G.has(M.parent.key))){if(h(M.parent.node)){G.add(w.key);return}var re=!0,ie=!1;(w.children||[]).filter(function(J){return!h(J.node)}).forEach(function(J){var ue=J.key,ge=m.has(ue);re&&!ge&&(re=!1),!ie&&(ge||y.has(ue))&&(ie=!0)}),re||m.delete(w.key),ie&&y.add(w.key),G.add(w.key)}})}return{checkedKeys:Array.from(m),halfCheckedKeys:Array.from(Se(y,m))}}function he(oe,o,x,A){var h=[],m;A?m=A:m=le;var y=new Set(oe.filter(function(W){var I=!!(0,ce.Z)(x,W);return I||h.push(W),I})),S=new Map,O=0;Object.keys(x).forEach(function(W){var I=x[W],M=I.level,w=S.get(M);w||(w=new Set,S.set(M,w)),w.add(I),O=Math.max(O,M)}),(0,k.ZP)(!h.length,"Tree missing follow keys: ".concat(h.slice(0,100).map(function(W){return"'".concat(W,"'")}).join(", ")));var G;return o===!0?G=K(y,S,O,m):G=p(y,o.halfCheckedKeys,S,O,m),G}},65065:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return k}});function k(ce,Se){return ce[Se]}},34061:function(yn,yt,T){"use strict";T.d(yt,{F:function(){return M},H8:function(){return I},I8:function(){return W},km:function(){return h},oH:function(){return O},w$:function(){return m},zn:function(){return S}});var k=T(93664),ce=T(95190),Se=T(20439),le=T(62646),K=T(11592),p=T(2738),he=T(48736),oe=T(65065),o=["children"];function x(w,D){return"".concat(w,"-").concat(D)}function A(w){return w&&w.type&&w.type.isTreeNode}function h(w,D){return w!=null?w:D}function m(w){var D=w||{},re=D.title,ie=D._title,J=D.key,ue=D.children,ge=re||"title";return{title:ge,_title:ie||[ge],key:J||"key",children:ue||"children"}}function y(w,D){var re=new Map;function ie(J){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(J||[]).forEach(function(ge){var Ee=ge[D.key],Ne=ge[D.children];warning(Ee!=null,"Tree node must have a certain key: [".concat(ue).concat(Ee,"]"));var Y=String(Ee);warning(!re.has(Y)||Ee===null||Ee===void 0,"Same 'key' exist in the Tree: ".concat(Y)),re.set(Y,!0),ie(Ne,"".concat(ue).concat(Y," > "))})}ie(w)}function S(w){function D(re){var ie=(0,K.Z)(re);return ie.map(function(J){if(!A(J))return(0,he.ZP)(!J,"Tree/TreeNode can only accept TreeNode as children."),null;var ue=J.key,ge=J.props,Ee=ge.children,Ne=(0,le.Z)(ge,o),Y=(0,Se.Z)({key:ue},Ne),L=D(Ee);return L.length&&(Y.children=L),Y}).filter(function(J){return J})}return D(w)}function O(w,D,re){var ie=m(re),J=ie._title,ue=ie.key,ge=ie.children,Ee=new Set(D===!0?[]:D),Ne=[];function Y(L){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return L.map(function(H,ee){for(var j=x(V?V.pos:"0",ee),v=h(H[ue],j),g,U=0;U<J.length;U+=1){var te=J[U];if(H[te]!==void 0){g=H[te];break}}var Be=Object.assign((0,p.Z)(H,[].concat((0,ce.Z)(J),[ue,ge])),{title:g,key:v,parent:V,pos:j,children:null,data:H,isStart:[].concat((0,ce.Z)(V?V.isStart:[]),[ee===0]),isEnd:[].concat((0,ce.Z)(V?V.isEnd:[]),[ee===L.length-1])});return Ne.push(Be),D===!0||Ee.has(v)?Be.children=Y(H[ge]||[],Be):Be.children=[],Be})}return Y(w),Ne}function G(w,D,re){var ie={};(0,k.Z)(re)==="object"?ie=re:ie={externalGetKey:re},ie=ie||{};var J=ie,ue=J.childrenPropName,ge=J.externalGetKey,Ee=J.fieldNames,Ne=m(Ee),Y=Ne.key,L=Ne.children,V=ue||L,H;ge?typeof ge=="string"?H=function(v){return v[ge]}:typeof ge=="function"&&(H=function(v){return ge(v)}):H=function(v,g){return h(v[Y],g)};function ee(j,v,g,U){var te=j?j[V]:w,Be=j?x(g.pos,v):"0",Ge=j?[].concat((0,ce.Z)(U),[j]):[];if(j){var Qe=H(j,Be),et={node:j,index:v,pos:Be,key:Qe,parentPos:g.node?g.pos:null,level:g.level+1,nodes:Ge};D(et)}te&&te.forEach(function(gt,vt){ee(gt,vt,{node:j,pos:Be,level:g?g.level+1:-1},Ge)})}ee(null)}function W(w){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},re=D.initWrapper,ie=D.processEntity,J=D.onProcessFinished,ue=D.externalGetKey,ge=D.childrenPropName,Ee=D.fieldNames,Ne=arguments.length>2?arguments[2]:void 0,Y=ue||Ne,L={},V={},H={posEntities:L,keyEntities:V};return re&&(H=re(H)||H),G(w,function(ee){var j=ee.node,v=ee.index,g=ee.pos,U=ee.key,te=ee.parentPos,Be=ee.level,Ge=ee.nodes,Qe={node:j,nodes:Ge,index:v,key:U,pos:g,level:Be},et=h(U,g);L[g]=Qe,V[et]=Qe,Qe.parent=L[te],Qe.parent&&(Qe.parent.children=Qe.parent.children||[],Qe.parent.children.push(Qe)),ie&&ie(Qe,H)},{externalGetKey:Y,childrenPropName:ge,fieldNames:Ee}),J&&J(H),H}function I(w,D){var re=D.expandedKeys,ie=D.selectedKeys,J=D.loadedKeys,ue=D.loadingKeys,ge=D.checkedKeys,Ee=D.halfCheckedKeys,Ne=D.dragOverNodeKey,Y=D.dropPosition,L=D.keyEntities,V=(0,oe.Z)(L,w),H={eventKey:w,expanded:re.indexOf(w)!==-1,selected:ie.indexOf(w)!==-1,loaded:J.indexOf(w)!==-1,loading:ue.indexOf(w)!==-1,checked:ge.indexOf(w)!==-1,halfChecked:Ee.indexOf(w)!==-1,pos:String(V?V.pos:""),dragOver:Ne===w&&Y===0,dragOverGapTop:Ne===w&&Y===-1,dragOverGapBottom:Ne===w&&Y===1};return H}function M(w){var D=w.data,re=w.expanded,ie=w.selected,J=w.checked,ue=w.loaded,ge=w.loading,Ee=w.halfChecked,Ne=w.dragOver,Y=w.dragOverGapTop,L=w.dragOverGapBottom,V=w.pos,H=w.active,ee=w.eventKey,j=(0,Se.Z)((0,Se.Z)({},D),{},{expanded:re,selected:ie,checked:J,loaded:ue,loading:ge,halfChecked:Ee,dragOver:Ne,dragOverGapTop:Y,dragOverGapBottom:L,pos:V,active:H,key:ee});return"props"in j||Object.defineProperty(j,"props",{get:function(){return(0,he.ZP)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),w}}),j}},49658:function(yn,yt){"use strict";yt.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var T=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(T)||/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(T==null?void 0:T.substr(0,4))}},6790:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return Tt}});var k=T(14809),ce=T(93664),Se=T(20439),le=T(4635),K=T(50298),p=T(62646),he=T(92310),oe=T.n(he),o=T(29301),x=T(70425),A=T(34280),h=T(59301),m=T(4676),y=h.forwardRef(function(Ke,_e){var ve=Ke.height,F=Ke.offsetY,xe=Ke.offsetX,ke=Ke.children,$=Ke.prefixCls,R=Ke.onInnerResize,ne=Ke.innerProps,be=Ke.rtl,P=Ke.extra,C={},X={display:"flex",flexDirection:"column"};return F!==void 0&&(C={height:ve,position:"relative",overflow:"hidden"},X=(0,Se.Z)((0,Se.Z)({},X),{},(0,le.Z)((0,le.Z)((0,le.Z)((0,le.Z)((0,le.Z)({transform:"translateY(".concat(F,"px)")},be?"marginRight":"marginLeft",-xe),"position","absolute"),"left",0),"right",0),"top",0))),h.createElement("div",{style:C},h.createElement(o.Z,{onResize:function(Q){var se=Q.offsetHeight;se&&R&&R()}},h.createElement("div",(0,k.Z)({style:X,className:oe()((0,le.Z)({},"".concat($,"-holder-inner"),$)),ref:_e},ne),ke,P)))});y.displayName="Filler";var S=y;function O(Ke){var _e=Ke.children,ve=Ke.setRef,F=h.useCallback(function(xe){ve(xe)},[]);return h.cloneElement(_e,{ref:F})}function G(Ke,_e,ve,F,xe,ke,$,R){var ne=R.getKey;return Ke.slice(_e,ve+1).map(function(be,P){var C=_e+P,X=$(be,C,{style:{width:F},offsetX:xe}),q=ne(be);return h.createElement(O,{key:q,setRef:function(se){return ke(be,se)}},X)})}function W(Ke,_e,ve,F){var xe=ve-Ke,ke=_e-ve,$=Math.min(xe,ke)*2;if(F<=$){var R=Math.floor(F/2);return F%2?ve+R+1:ve-R}return xe>ke?ve-(F-ke):ve+(F-xe)}function I(Ke,_e,ve){var F=Ke.length,xe=_e.length,ke,$;if(F===0&&xe===0)return null;F<xe?(ke=Ke,$=_e):(ke=_e,$=Ke);var R={__EMPTY_ITEM__:!0};function ne(Q){return Q!==void 0?ve(Q):R}for(var be=null,P=Math.abs(F-xe)!==1,C=0;C<$.length;C+=1){var X=ne(ke[C]),q=ne($[C]);if(X!==q){be=C,P=P||X!==ne($[C+1]);break}}return be===null?null:{index:be,multiple:P}}function M(Ke,_e,ve){var F=h.useState(Ke),xe=(0,K.Z)(F,2),ke=xe[0],$=xe[1],R=h.useState(null),ne=(0,K.Z)(R,2),be=ne[0],P=ne[1];return h.useEffect(function(){var C=I(ke||[],Ke||[],_e);(C==null?void 0:C.index)!==void 0&&(ve==null||ve(C.index),P(Ke[C.index])),$(Ke)},[Ke]),[be]}var w=T(16089),D=(typeof navigator=="undefined"?"undefined":(0,ce.Z)(navigator))==="object"&&/Firefox/i.test(navigator.userAgent),re=D,ie=function(Ke,_e,ve,F){var xe=(0,h.useRef)(!1),ke=(0,h.useRef)(null);function $(){clearTimeout(ke.current),xe.current=!0,ke.current=setTimeout(function(){xe.current=!1},50)}var R=(0,h.useRef)({top:Ke,bottom:_e,left:ve,right:F});return R.current.top=Ke,R.current.bottom=_e,R.current.left=ve,R.current.right=F,function(ne,be){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,C=ne?be<0&&R.current.left||be>0&&R.current.right:be<0&&R.current.top||be>0&&R.current.bottom;return P&&C?(clearTimeout(ke.current),xe.current=!1):(!C||xe.current)&&$(),!xe.current&&C}};function J(Ke,_e,ve,F,xe,ke,$){var R=(0,h.useRef)(0),ne=(0,h.useRef)(null),be=(0,h.useRef)(null),P=(0,h.useRef)(!1),C=ie(_e,ve,F,xe);function X(Ie,De){if(w.Z.cancel(ne.current),!C(!1,De)){var Fe=Ie;if(!Fe._virtualHandled)Fe._virtualHandled=!0;else return;R.current+=De,be.current=De,re||Fe.preventDefault(),ne.current=(0,w.Z)(function(){var ze=P.current?10:1;$(R.current*ze,!1),R.current=0})}}function q(Ie,De){$(De,!0),re||Ie.preventDefault()}var Q=(0,h.useRef)(null),se=(0,h.useRef)(null);function me(Ie){if(Ke){w.Z.cancel(se.current),se.current=(0,w.Z)(function(){Q.current=null},2);var De=Ie.deltaX,Fe=Ie.deltaY,ze=Ie.shiftKey,je=De,Ue=Fe;(Q.current==="sx"||!Q.current&&ze&&Fe&&!De)&&(je=Fe,Ue=0,Q.current="sx");var bt=Math.abs(je),xt=Math.abs(Ue);Q.current===null&&(Q.current=ke&&bt>xt?"x":"y"),Q.current==="y"?X(Ie,Ue):q(Ie,je)}}function Ce(Ie){Ke&&(P.current=Ie.detail===be.current)}return[me,Ce]}function ue(Ke,_e,ve,F){var xe=h.useMemo(function(){return[new Map,[]]},[Ke,ve.id,F]),ke=(0,K.Z)(xe,2),$=ke[0],R=ke[1],ne=function(P){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:P,X=$.get(P),q=$.get(C);if(X===void 0||q===void 0)for(var Q=Ke.length,se=R.length;se<Q;se+=1){var me,Ce=Ke[se],Ie=_e(Ce);$.set(Ie,se);var De=(me=ve.get(Ie))!==null&&me!==void 0?me:F;if(R[se]=(R[se-1]||0)+De,Ie===P&&(X=se),Ie===C&&(q=se),X!==void 0&&q!==void 0)break}return{top:R[X-1]||0,bottom:R[q]}};return ne}var ge=T(99153),Ee=T(84851),Ne=function(){function Ke(){(0,ge.Z)(this,Ke),(0,le.Z)(this,"maps",void 0),(0,le.Z)(this,"id",0),(0,le.Z)(this,"diffRecords",new Map),this.maps=Object.create(null)}return(0,Ee.Z)(Ke,[{key:"set",value:function(ve,F){this.diffRecords.set(ve,this.maps[ve]),this.maps[ve]=F,this.id+=1}},{key:"get",value:function(ve){return this.maps[ve]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),Ke}(),Y=Ne;function L(Ke){var _e=parseFloat(Ke);return isNaN(_e)?0:_e}function V(Ke,_e,ve){var F=h.useState(0),xe=(0,K.Z)(F,2),ke=xe[0],$=xe[1],R=(0,h.useRef)(new Map),ne=(0,h.useRef)(new Y),be=(0,h.useRef)(0);function P(){be.current+=1}function C(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;P();var Q=function(){var Ce=!1;R.current.forEach(function(Ie,De){if(Ie&&Ie.offsetParent){var Fe=Ie.offsetHeight,ze=getComputedStyle(Ie),je=ze.marginTop,Ue=ze.marginBottom,bt=L(je),xt=L(Ue),it=Fe+bt+xt;ne.current.get(De)!==it&&(ne.current.set(De,it),Ce=!0)}}),Ce&&$(function(Ie){return Ie+1})};if(q)Q();else{be.current+=1;var se=be.current;Promise.resolve().then(function(){se===be.current&&Q()})}}function X(q,Q){var se=Ke(q),me=R.current.get(se);Q?(R.current.set(se,Q),C()):R.current.delete(se),!me!=!Q&&(Q?_e==null||_e(q):ve==null||ve(q))}return(0,h.useEffect)(function(){return P},[]),[X,C,ne.current,ke]}var H=14/15;function ee(Ke,_e,ve){var F=(0,h.useRef)(!1),xe=(0,h.useRef)(0),ke=(0,h.useRef)(0),$=(0,h.useRef)(null),R=(0,h.useRef)(null),ne,be=function(q){if(F.current){var Q=Math.ceil(q.touches[0].pageX),se=Math.ceil(q.touches[0].pageY),me=xe.current-Q,Ce=ke.current-se,Ie=Math.abs(me)>Math.abs(Ce);Ie?xe.current=Q:ke.current=se;var De=ve(Ie,Ie?me:Ce,!1,q);De&&q.preventDefault(),clearInterval(R.current),De&&(R.current=setInterval(function(){Ie?me*=H:Ce*=H;var Fe=Math.floor(Ie?me:Ce);(!ve(Ie,Fe,!0)||Math.abs(Fe)<=.1)&&clearInterval(R.current)},16))}},P=function(){F.current=!1,ne()},C=function(q){ne(),q.touches.length===1&&!F.current&&(F.current=!0,xe.current=Math.ceil(q.touches[0].pageX),ke.current=Math.ceil(q.touches[0].pageY),$.current=q.target,$.current.addEventListener("touchmove",be,{passive:!1}),$.current.addEventListener("touchend",P,{passive:!0}))};ne=function(){$.current&&($.current.removeEventListener("touchmove",be),$.current.removeEventListener("touchend",P))},(0,A.Z)(function(){return Ke&&_e.current.addEventListener("touchstart",C,{passive:!0}),function(){var X;(X=_e.current)===null||X===void 0||X.removeEventListener("touchstart",C),ne(),clearInterval(R.current)}},[Ke])}function j(Ke){return Math.floor(Math.pow(Ke,.5))}function v(Ke,_e){var ve="touches"in Ke?Ke.touches[0]:Ke;return ve[_e?"pageX":"pageY"]-window[_e?"scrollX":"scrollY"]}function g(Ke,_e,ve){h.useEffect(function(){var F=_e.current;if(Ke&&F){var xe=!1,ke,$,R=function(){w.Z.cancel(ke)},ne=function X(){R(),ke=(0,w.Z)(function(){ve($),X()})},be=function(q){if(!(q.target.draggable||q.button!==0)){var Q=q;Q._virtualHandled||(Q._virtualHandled=!0,xe=!0)}},P=function(){xe=!1,R()},C=function(q){if(xe){var Q=v(q,!1),se=F.getBoundingClientRect(),me=se.top,Ce=se.bottom;if(Q<=me){var Ie=me-Q;$=-j(Ie),ne()}else if(Q>=Ce){var De=Q-Ce;$=j(De),ne()}else R()}};return F.addEventListener("mousedown",be),F.ownerDocument.addEventListener("mouseup",P),F.ownerDocument.addEventListener("mousemove",C),function(){F.removeEventListener("mousedown",be),F.ownerDocument.removeEventListener("mouseup",P),F.ownerDocument.removeEventListener("mousemove",C),R()}}},[Ke])}var U=10;function te(Ke,_e,ve,F,xe,ke,$,R){var ne=h.useRef(),be=h.useState(null),P=(0,K.Z)(be,2),C=P[0],X=P[1];return(0,A.Z)(function(){if(C&&C.times<U){if(!Ke.current){X(function(z){return(0,Se.Z)({},z)});return}ke();var q=C.targetAlign,Q=C.originAlign,se=C.index,me=C.offset,Ce=Ke.current.clientHeight,Ie=!1,De=q,Fe=null;if(Ce){for(var ze=q||Q,je=0,Ue=0,bt=0,xt=Math.min(_e.length-1,se),it=0;it<=xt;it+=1){var Ft=xe(_e[it]);Ue=je;var Yt=ve.get(Ft);bt=Ue+(Yt===void 0?F:Yt),je=bt}for(var at=ze==="top"?me:Ce-me,Ut=xt;Ut>=0;Ut-=1){var Me=xe(_e[Ut]),Te=ve.get(Me);if(Te===void 0){Ie=!0;break}if(at-=Te,at<=0)break}switch(ze){case"top":Fe=Ue-me;break;case"bottom":Fe=bt-Ce+me;break;default:{var Re=Ke.current.scrollTop,B=Re+Ce;Ue<Re?De="top":bt>B&&(De="bottom")}}Fe!==null&&$(Fe),Fe!==C.lastTop&&(Ie=!0)}Ie&&X((0,Se.Z)((0,Se.Z)({},C),{},{times:C.times+1,targetAlign:De,lastTop:Fe}))}},[C,Ke.current]),function(q){if(q==null){R();return}if(w.Z.cancel(ne.current),typeof q=="number")$(q);else if(q&&(0,ce.Z)(q)==="object"){var Q,se=q.align;"index"in q?Q=q.index:Q=_e.findIndex(function(Ie){return xe(Ie)===q.key});var me=q.offset,Ce=me===void 0?0:me;X({times:0,index:Q,offset:Ce,originAlign:se})}}}var Be=h.forwardRef(function(Ke,_e){var ve=Ke.prefixCls,F=Ke.rtl,xe=Ke.scrollOffset,ke=Ke.scrollRange,$=Ke.onStartMove,R=Ke.onStopMove,ne=Ke.onScroll,be=Ke.horizontal,P=Ke.spinSize,C=Ke.containerSize,X=Ke.style,q=Ke.thumbStyle,Q=Ke.showScrollBar,se=h.useState(!1),me=(0,K.Z)(se,2),Ce=me[0],Ie=me[1],De=h.useState(null),Fe=(0,K.Z)(De,2),ze=Fe[0],je=Fe[1],Ue=h.useState(null),bt=(0,K.Z)(Ue,2),xt=bt[0],it=bt[1],Ft=!F,Yt=h.useRef(),at=h.useRef(),Ut=h.useState(Q),Me=(0,K.Z)(Ut,2),Te=Me[0],Re=Me[1],B=h.useRef(),z=function(){Q===!0||Q===!1||(clearTimeout(B.current),Re(!0),B.current=setTimeout(function(){Re(!1)},3e3))},de=ke-C||0,fe=C-P||0,pe=h.useMemo(function(){if(xe===0||de===0)return 0;var Rn=xe/de;return Rn*fe},[xe,de,fe]),Ve=function(Zn){Zn.stopPropagation(),Zn.preventDefault()},qe=h.useRef({top:pe,dragging:Ce,pageY:ze,startTop:xt});qe.current={top:pe,dragging:Ce,pageY:ze,startTop:xt};var mt=function(Zn){Ie(!0),je(v(Zn,be)),it(qe.current.top),$(),Zn.stopPropagation(),Zn.preventDefault()};h.useEffect(function(){var Rn=function(kt){kt.preventDefault()},Zn=Yt.current,In=at.current;return Zn.addEventListener("touchstart",Rn,{passive:!1}),In.addEventListener("touchstart",mt,{passive:!1}),function(){Zn.removeEventListener("touchstart",Rn),In.removeEventListener("touchstart",mt)}},[]);var Pt=h.useRef();Pt.current=de;var rn=h.useRef();rn.current=fe,h.useEffect(function(){if(Ce){var Rn,Zn=function(kt){var ft=qe.current,Kt=ft.dragging,_n=ft.pageY,Wn=ft.startTop;w.Z.cancel(Rn);var Oe=Yt.current.getBoundingClientRect(),Le=C/(be?Oe.width:Oe.height);if(Kt){var At=(v(kt,be)-_n)*Le,rt=Wn;!Ft&&be?rt-=At:rt+=At;var St=Pt.current,Rt=rn.current,Et=Rt?rt/Rt:0,Ot=Math.ceil(Et*St);Ot=Math.max(Ot,0),Ot=Math.min(Ot,St),Rn=(0,w.Z)(function(){ne(Ot,be)})}},In=function(){Ie(!1),R()};return window.addEventListener("mousemove",Zn,{passive:!0}),window.addEventListener("touchmove",Zn,{passive:!0}),window.addEventListener("mouseup",In,{passive:!0}),window.addEventListener("touchend",In,{passive:!0}),function(){window.removeEventListener("mousemove",Zn),window.removeEventListener("touchmove",Zn),window.removeEventListener("mouseup",In),window.removeEventListener("touchend",In),w.Z.cancel(Rn)}}},[Ce]),h.useEffect(function(){return z(),function(){clearTimeout(B.current)}},[xe]),h.useImperativeHandle(_e,function(){return{delayHidden:z}});var hn="".concat(ve,"-scrollbar"),qt={position:"absolute",visibility:Te?null:"hidden"},sn={position:"absolute",borderRadius:99,background:"var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))",cursor:"pointer",userSelect:"none"};return be?(Object.assign(qt,{height:8,left:0,right:0,bottom:0}),Object.assign(sn,(0,le.Z)({height:"100%",width:P},Ft?"left":"right",pe))):(Object.assign(qt,(0,le.Z)({width:8,top:0,bottom:0},Ft?"right":"left",0)),Object.assign(sn,{width:"100%",height:P,top:pe})),h.createElement("div",{ref:Yt,className:oe()(hn,(0,le.Z)((0,le.Z)((0,le.Z)({},"".concat(hn,"-horizontal"),be),"".concat(hn,"-vertical"),!be),"".concat(hn,"-visible"),Te)),style:(0,Se.Z)((0,Se.Z)({},qt),X),onMouseDown:Ve,onMouseMove:z},h.createElement("div",{ref:at,className:oe()("".concat(hn,"-thumb"),(0,le.Z)({},"".concat(hn,"-thumb-moving"),Ce)),style:(0,Se.Z)((0,Se.Z)({},sn),q),onMouseDown:mt}))}),Ge=Be,Qe=20;function et(){var Ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,_e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ve=Ke/_e*Ke;return isNaN(ve)&&(ve=0),ve=Math.max(ve,Qe),Math.floor(ve)}var gt=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],vt=[],we={overflowY:"auto",overflowAnchor:"none"};function _t(Ke,_e){var ve=Ke.prefixCls,F=ve===void 0?"rc-virtual-list":ve,xe=Ke.className,ke=Ke.height,$=Ke.itemHeight,R=Ke.fullHeight,ne=R===void 0?!0:R,be=Ke.style,P=Ke.data,C=Ke.children,X=Ke.itemKey,q=Ke.virtual,Q=Ke.direction,se=Ke.scrollWidth,me=Ke.component,Ce=me===void 0?"div":me,Ie=Ke.onScroll,De=Ke.onVirtualScroll,Fe=Ke.onVisibleChange,ze=Ke.innerProps,je=Ke.extraRender,Ue=Ke.styles,bt=Ke.showScrollBar,xt=bt===void 0?"optional":bt,it=(0,p.Z)(Ke,gt),Ft=h.useCallback(function(Dt){return typeof X=="function"?X(Dt):Dt==null?void 0:Dt[X]},[X]),Yt=V(Ft,null,null),at=(0,K.Z)(Yt,4),Ut=at[0],Me=at[1],Te=at[2],Re=at[3],B=!!(q!==!1&&ke&&$),z=h.useMemo(function(){return Object.values(Te.maps).reduce(function(Dt,wt){return Dt+wt},0)},[Te.id,Te.maps]),de=B&&P&&(Math.max($*P.length,z)>ke||!!se),fe=Q==="rtl",pe=oe()(F,(0,le.Z)({},"".concat(F,"-rtl"),fe),xe),Ve=P||vt,qe=(0,h.useRef)(),mt=(0,h.useRef)(),Pt=(0,h.useRef)(),rn=(0,h.useState)(0),hn=(0,K.Z)(rn,2),qt=hn[0],sn=hn[1],Rn=(0,h.useState)(0),Zn=(0,K.Z)(Rn,2),In=Zn[0],Nn=Zn[1],kt=(0,h.useState)(!1),ft=(0,K.Z)(kt,2),Kt=ft[0],_n=ft[1],Wn=function(){_n(!0)},Oe=function(){_n(!1)},Le={getKey:Ft};function At(Dt){sn(function(wt){var Xt;typeof Dt=="function"?Xt=Dt(wt):Xt=Dt;var Jt=$n(Xt);return qe.current.scrollTop=Jt,Jt})}var rt=(0,h.useRef)({start:0,end:Ve.length}),St=(0,h.useRef)(),Rt=M(Ve,Ft),Et=(0,K.Z)(Rt,1),Ot=Et[0];St.current=Ot;var Mt=h.useMemo(function(){if(!B)return{scrollHeight:void 0,start:0,end:Ve.length-1,offset:void 0};if(!de){var Dt;return{scrollHeight:((Dt=mt.current)===null||Dt===void 0?void 0:Dt.offsetHeight)||0,start:0,end:Ve.length-1,offset:void 0}}for(var wt=0,Xt,Jt,xn,Yn=Ve.length,tr=0;tr<Yn;tr+=1){var on=Ve[tr],wn=Ft(on),Bn=Te.get(wn),An=wt+(Bn===void 0?$:Bn);An>=qt&&Xt===void 0&&(Xt=tr,Jt=wt),An>qt+ke&&xn===void 0&&(xn=tr),wt=An}return Xt===void 0&&(Xt=0,Jt=0,xn=Math.ceil(ke/$)),xn===void 0&&(xn=Ve.length-1),xn=Math.min(xn+1,Ve.length-1),{scrollHeight:wt,start:Xt,end:xn,offset:Jt}},[de,B,qt,Ve,Re,ke]),Ct=Mt.scrollHeight,It=Mt.start,Zt=Mt.end,Nt=Mt.offset;rt.current.start=It,rt.current.end=Zt,h.useLayoutEffect(function(){var Dt=Te.getRecord();if(Dt.size===1){var wt=Array.from(Dt.keys())[0],Xt=Dt.get(wt),Jt=Ve[It];if(Jt&&Xt===void 0){var xn=Ft(Jt);if(xn===wt){var Yn=Te.get(wt),tr=Yn-$;At(function(on){return on+tr})}}}Te.resetRecord()},[Ct]);var ut=h.useState({width:0,height:ke}),Ae=(0,K.Z)(ut,2),Ze=Ae[0],He=Ae[1],Je=function(wt){He({width:wt.offsetWidth,height:wt.offsetHeight})},lt=(0,h.useRef)(),pt=(0,h.useRef)(),Lt=h.useMemo(function(){return et(Ze.width,se)},[Ze.width,se]),Gt=h.useMemo(function(){return et(Ze.height,Ct)},[Ze.height,Ct]),Qt=Ct-ke,tn=(0,h.useRef)(Qt);tn.current=Qt;function $n(Dt){var wt=Dt;return Number.isNaN(tn.current)||(wt=Math.min(wt,tn.current)),wt=Math.max(wt,0),wt}var Vt=qt<=0,fn=qt>=Qt,ln=In<=0,mn=In>=se,Wt=ie(Vt,fn,ln,mn),Bt=function(){return{x:fe?-In:In,y:qt}},zt=(0,h.useRef)(Bt()),an=(0,x.zX)(function(Dt){if(De){var wt=(0,Se.Z)((0,Se.Z)({},Bt()),Dt);(zt.current.x!==wt.x||zt.current.y!==wt.y)&&(De(wt),zt.current=wt)}});function un(Dt,wt){var Xt=Dt;wt?((0,m.flushSync)(function(){Nn(Xt)}),an()):At(Xt)}function cn(Dt){var wt=Dt.currentTarget.scrollTop;wt!==qt&&At(wt),Ie==null||Ie(Dt),an()}var En=function(wt){var Xt=wt,Jt=se?se-Ze.width:0;return Xt=Math.max(Xt,0),Xt=Math.min(Xt,Jt),Xt},jt=(0,x.zX)(function(Dt,wt){wt?((0,m.flushSync)(function(){Nn(function(Xt){var Jt=Xt+(fe?-Dt:Dt);return En(Jt)})}),an()):At(function(Xt){var Jt=Xt+Dt;return Jt})}),en=J(B,Vt,fn,ln,mn,!!se,jt),Qn=(0,K.Z)(en,2),Hn=Qn[0],Kn=Qn[1];ee(B,qe,function(Dt,wt,Xt,Jt){var xn=Jt;return Wt(Dt,wt,Xt)?!1:!xn||!xn._virtualHandled?(xn&&(xn._virtualHandled=!0),Hn({preventDefault:function(){},deltaX:Dt?wt:0,deltaY:Dt?0:wt}),!0):!1}),g(de,qe,function(Dt){At(function(wt){return wt+Dt})}),(0,A.Z)(function(){function Dt(Xt){var Jt=Vt&&Xt.detail<0,xn=fn&&Xt.detail>0;B&&!Jt&&!xn&&Xt.preventDefault()}var wt=qe.current;return wt.addEventListener("wheel",Hn,{passive:!1}),wt.addEventListener("DOMMouseScroll",Kn,{passive:!0}),wt.addEventListener("MozMousePixelScroll",Dt,{passive:!1}),function(){wt.removeEventListener("wheel",Hn),wt.removeEventListener("DOMMouseScroll",Kn),wt.removeEventListener("MozMousePixelScroll",Dt)}},[B,Vt,fn]),(0,A.Z)(function(){if(se){var Dt=En(In);Nn(Dt),an({x:Dt})}},[Ze.width,se]);var jn=function(){var wt,Xt;(wt=lt.current)===null||wt===void 0||wt.delayHidden(),(Xt=pt.current)===null||Xt===void 0||Xt.delayHidden()},er=te(qe,Ve,Te,$,Ft,function(){return Me(!0)},At,jn);h.useImperativeHandle(_e,function(){return{nativeElement:Pt.current,getScrollInfo:Bt,scrollTo:function(wt){function Xt(Jt){return Jt&&(0,ce.Z)(Jt)==="object"&&("left"in Jt||"top"in Jt)}Xt(wt)?(wt.left!==void 0&&Nn(En(wt.left)),er(wt.top)):er(wt)}}}),(0,A.Z)(function(){if(Fe){var Dt=Ve.slice(It,Zt+1);Fe(Dt,Ve)}},[It,Zt,Ve]);var Xn=ue(Ve,Ft,Te,$),_r=je==null?void 0:je({start:It,end:Zt,virtual:de,offsetX:In,offsetY:Nt,rtl:fe,getSize:Xn}),ar=G(Ve,It,Zt,se,In,Ut,C,Le),or=null;ke&&(or=(0,Se.Z)((0,le.Z)({},ne?"height":"maxHeight",ke),we),B&&(or.overflowY="hidden",se&&(or.overflowX="hidden"),Kt&&(or.pointerEvents="none")));var bn={};return fe&&(bn.dir="rtl"),h.createElement("div",(0,k.Z)({ref:Pt,style:(0,Se.Z)((0,Se.Z)({},be),{},{position:"relative"}),className:pe},bn,it),h.createElement(o.Z,{onResize:Je},h.createElement(Ce,{className:"".concat(F,"-holder"),style:or,ref:qe,onScroll:cn,onMouseEnter:jn},h.createElement(S,{prefixCls:F,height:Ct,offsetX:In,offsetY:Nt,scrollWidth:se,onInnerResize:Me,ref:mt,innerProps:ze,rtl:fe,extra:_r},ar))),de&&Ct>ke&&h.createElement(Ge,{ref:lt,prefixCls:F,scrollOffset:qt,scrollRange:Ct,rtl:fe,onScroll:un,onStartMove:Wn,onStopMove:Oe,spinSize:Gt,containerSize:Ze.height,style:Ue==null?void 0:Ue.verticalScrollBar,thumbStyle:Ue==null?void 0:Ue.verticalScrollBarThumb,showScrollBar:xt}),de&&se>Ze.width&&h.createElement(Ge,{ref:pt,prefixCls:F,scrollOffset:In,scrollRange:se,rtl:fe,onScroll:un,onStartMove:Wn,onStopMove:Oe,spinSize:Lt,containerSize:Ze.width,horizontal:!0,style:Ue==null?void 0:Ue.horizontalScrollBar,thumbStyle:Ue==null?void 0:Ue.horizontalScrollBarThumb,showScrollBar:xt}))}var ot=h.forwardRef(_t);ot.displayName="List";var nt=ot,Tt=nt},83145:function(yn,yt,T){"use strict";Object.defineProperty(yt,"__esModule",{value:!0}),yt.CopyToClipboard=void 0;var k=Se(T(59301)),ce=Se(T(25769));function Se(I){return I&&I.__esModule?I:{default:I}}function le(I){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?le=function(w){return typeof w}:le=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},le(I)}function K(I,M){var w=Object.keys(I);if(Object.getOwnPropertySymbols){var D=Object.getOwnPropertySymbols(I);M&&(D=D.filter(function(re){return Object.getOwnPropertyDescriptor(I,re).enumerable})),w.push.apply(w,D)}return w}function p(I){for(var M=1;M<arguments.length;M++){var w=arguments[M]!=null?arguments[M]:{};M%2?K(w,!0).forEach(function(D){G(I,D,w[D])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(w)):K(w).forEach(function(D){Object.defineProperty(I,D,Object.getOwnPropertyDescriptor(w,D))})}return I}function he(I,M){if(I==null)return{};var w=oe(I,M),D,re;if(Object.getOwnPropertySymbols){var ie=Object.getOwnPropertySymbols(I);for(re=0;re<ie.length;re++)D=ie[re],!(M.indexOf(D)>=0)&&Object.prototype.propertyIsEnumerable.call(I,D)&&(w[D]=I[D])}return w}function oe(I,M){if(I==null)return{};var w={},D=Object.keys(I),re,ie;for(ie=0;ie<D.length;ie++)re=D[ie],!(M.indexOf(re)>=0)&&(w[re]=I[re]);return w}function o(I,M){if(!(I instanceof M))throw new TypeError("Cannot call a class as a function")}function x(I,M){for(var w=0;w<M.length;w++){var D=M[w];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(I,D.key,D)}}function A(I,M,w){return M&&x(I.prototype,M),w&&x(I,w),I}function h(I,M){return M&&(le(M)==="object"||typeof M=="function")?M:y(I)}function m(I){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},m(I)}function y(I){if(I===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I}function S(I,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(M&&M.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),M&&O(I,M)}function O(I,M){return O=Object.setPrototypeOf||function(D,re){return D.__proto__=re,D},O(I,M)}function G(I,M,w){return M in I?Object.defineProperty(I,M,{value:w,enumerable:!0,configurable:!0,writable:!0}):I[M]=w,I}var W=function(I){S(M,I);function M(){var w,D;o(this,M);for(var re=arguments.length,ie=new Array(re),J=0;J<re;J++)ie[J]=arguments[J];return D=h(this,(w=m(M)).call.apply(w,[this].concat(ie))),G(y(D),"onClick",function(ue){var ge=D.props,Ee=ge.text,Ne=ge.onCopy,Y=ge.children,L=ge.options,V=k.default.Children.only(Y),H=(0,ce.default)(Ee,L);Ne&&Ne(Ee,H),V&&V.props&&typeof V.props.onClick=="function"&&V.props.onClick(ue)}),D}return A(M,[{key:"render",value:function(){var D=this.props,re=D.text,ie=D.onCopy,J=D.options,ue=D.children,ge=he(D,["text","onCopy","options","children"]),Ee=k.default.Children.only(ue);return k.default.cloneElement(Ee,p({},ge,{onClick:this.onClick}))}}]),M}(k.default.PureComponent);yt.CopyToClipboard=W,G(W,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(yn,yt,T){"use strict";var k=T(83145),ce=k.CopyToClipboard;ce.CopyToClipboard=ce,yn.exports=ce},76374:function(yn,yt,T){"use strict";var k=function(){if(typeof Map!="undefined")return Map;function Y(L,V){var H=-1;return L.some(function(ee,j){return ee[0]===V?(H=j,!0):!1}),H}return function(){function L(){this.__entries__=[]}return Object.defineProperty(L.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),L.prototype.get=function(V){var H=Y(this.__entries__,V),ee=this.__entries__[H];return ee&&ee[1]},L.prototype.set=function(V,H){var ee=Y(this.__entries__,V);~ee?this.__entries__[ee][1]=H:this.__entries__.push([V,H])},L.prototype.delete=function(V){var H=this.__entries__,ee=Y(H,V);~ee&&H.splice(ee,1)},L.prototype.has=function(V){return!!~Y(this.__entries__,V)},L.prototype.clear=function(){this.__entries__.splice(0)},L.prototype.forEach=function(V,H){H===void 0&&(H=null);for(var ee=0,j=this.__entries__;ee<j.length;ee++){var v=j[ee];V.call(H,v[1],v[0])}},L}()}(),ce=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Se=function(){return typeof T.g!="undefined"&&T.g.Math===Math?T.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),le=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Se):function(Y){return setTimeout(function(){return Y(Date.now())},1e3/60)}}(),K=2;function p(Y,L){var V=!1,H=!1,ee=0;function j(){V&&(V=!1,Y()),H&&g()}function v(){le(j)}function g(){var U=Date.now();if(V){if(U-ee<K)return;H=!0}else V=!0,H=!1,setTimeout(v,L);ee=U}return g}var he=20,oe=["top","right","bottom","left","width","height","size","weight"],o=typeof MutationObserver!="undefined",x=function(){function Y(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=p(this.refresh.bind(this),he)}return Y.prototype.addObserver=function(L){~this.observers_.indexOf(L)||this.observers_.push(L),this.connected_||this.connect_()},Y.prototype.removeObserver=function(L){var V=this.observers_,H=V.indexOf(L);~H&&V.splice(H,1),!V.length&&this.connected_&&this.disconnect_()},Y.prototype.refresh=function(){var L=this.updateObservers_();L&&this.refresh()},Y.prototype.updateObservers_=function(){var L=this.observers_.filter(function(V){return V.gatherActive(),V.hasActive()});return L.forEach(function(V){return V.broadcastActive()}),L.length>0},Y.prototype.connect_=function(){!ce||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),o?(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)},Y.prototype.disconnect_=function(){!ce||!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)},Y.prototype.onTransitionEnd_=function(L){var V=L.propertyName,H=V===void 0?"":V,ee=oe.some(function(j){return!!~H.indexOf(j)});ee&&this.refresh()},Y.getInstance=function(){return this.instance_||(this.instance_=new Y),this.instance_},Y.instance_=null,Y}(),A=function(Y,L){for(var V=0,H=Object.keys(L);V<H.length;V++){var ee=H[V];Object.defineProperty(Y,ee,{value:L[ee],enumerable:!1,writable:!1,configurable:!0})}return Y},h=function(Y){var L=Y&&Y.ownerDocument&&Y.ownerDocument.defaultView;return L||Se},m=re(0,0,0,0);function y(Y){return parseFloat(Y)||0}function S(Y){for(var L=[],V=1;V<arguments.length;V++)L[V-1]=arguments[V];return L.reduce(function(H,ee){var j=Y["border-"+ee+"-width"];return H+y(j)},0)}function O(Y){for(var L=["top","right","bottom","left"],V={},H=0,ee=L;H<ee.length;H++){var j=ee[H],v=Y["padding-"+j];V[j]=y(v)}return V}function G(Y){var L=Y.getBBox();return re(0,0,L.width,L.height)}function W(Y){var L=Y.clientWidth,V=Y.clientHeight;if(!L&&!V)return m;var H=h(Y).getComputedStyle(Y),ee=O(H),j=ee.left+ee.right,v=ee.top+ee.bottom,g=y(H.width),U=y(H.height);if(H.boxSizing==="border-box"&&(Math.round(g+j)!==L&&(g-=S(H,"left","right")+j),Math.round(U+v)!==V&&(U-=S(H,"top","bottom")+v)),!M(Y)){var te=Math.round(g+j)-L,Be=Math.round(U+v)-V;Math.abs(te)!==1&&(g-=te),Math.abs(Be)!==1&&(U-=Be)}return re(ee.left,ee.top,g,U)}var I=function(){return typeof SVGGraphicsElement!="undefined"?function(Y){return Y instanceof h(Y).SVGGraphicsElement}:function(Y){return Y instanceof h(Y).SVGElement&&typeof Y.getBBox=="function"}}();function M(Y){return Y===h(Y).document.documentElement}function w(Y){return ce?I(Y)?G(Y):W(Y):m}function D(Y){var L=Y.x,V=Y.y,H=Y.width,ee=Y.height,j=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,v=Object.create(j.prototype);return A(v,{x:L,y:V,width:H,height:ee,top:V,right:L+H,bottom:ee+V,left:L}),v}function re(Y,L,V,H){return{x:Y,y:L,width:V,height:H}}var ie=function(){function Y(L){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=re(0,0,0,0),this.target=L}return Y.prototype.isActive=function(){var L=w(this.target);return this.contentRect_=L,L.width!==this.broadcastWidth||L.height!==this.broadcastHeight},Y.prototype.broadcastRect=function(){var L=this.contentRect_;return this.broadcastWidth=L.width,this.broadcastHeight=L.height,L},Y}(),J=function(){function Y(L,V){var H=D(V);A(this,{target:L,contentRect:H})}return Y}(),ue=function(){function Y(L,V,H){if(this.activeObservations_=[],this.observations_=new k,typeof L!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=L,this.controller_=V,this.callbackCtx_=H}return Y.prototype.observe=function(L){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(L instanceof h(L).Element))throw new TypeError('parameter 1 is not of type "Element".');var V=this.observations_;V.has(L)||(V.set(L,new ie(L)),this.controller_.addObserver(this),this.controller_.refresh())}},Y.prototype.unobserve=function(L){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(L instanceof h(L).Element))throw new TypeError('parameter 1 is not of type "Element".');var V=this.observations_;V.has(L)&&(V.delete(L),V.size||this.controller_.removeObserver(this))}},Y.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},Y.prototype.gatherActive=function(){var L=this;this.clearActive(),this.observations_.forEach(function(V){V.isActive()&&L.activeObservations_.push(V)})},Y.prototype.broadcastActive=function(){if(this.hasActive()){var L=this.callbackCtx_,V=this.activeObservations_.map(function(H){return new J(H.target,H.broadcastRect())});this.callback_.call(L,V,L),this.clearActive()}},Y.prototype.clearActive=function(){this.activeObservations_.splice(0)},Y.prototype.hasActive=function(){return this.activeObservations_.length>0},Y}(),ge=typeof WeakMap!="undefined"?new WeakMap:new k,Ee=function(){function Y(L){if(!(this instanceof Y))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var V=x.getInstance(),H=new ue(L,V,this);ge.set(this,H)}return Y}();["observe","unobserve","disconnect"].forEach(function(Y){Ee.prototype[Y]=function(){var L;return(L=ge.get(this))[Y].apply(L,arguments)}});var Ne=function(){return typeof Se.ResizeObserver!="undefined"?Se.ResizeObserver:Ee}();yt.Z=Ne},98040:function(yn){yn.exports=function(){var yt=document.getSelection();if(!yt.rangeCount)return function(){};for(var T=document.activeElement,k=[],ce=0;ce<yt.rangeCount;ce++)k.push(yt.getRangeAt(ce));switch(T.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":T.blur();break;default:T=null;break}return yt.removeAllRanges(),function(){yt.type==="Caret"&&yt.removeAllRanges(),yt.rangeCount||k.forEach(function(Se){yt.addRange(Se)}),T&&T.focus()}}},93314:function(yn){"use strict";yn.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=="},37530:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return ce}});var k=T(58750);function ce(Se,le){var K=typeof Symbol!="undefined"&&Se[Symbol.iterator]||Se["@@iterator"];if(!K){if(Array.isArray(Se)||(K=(0,k.Z)(Se))||le&&Se&&typeof Se.length=="number"){K&&(Se=K);var p=0,he=function(){};return{s:he,n:function(){return p>=Se.length?{done:!0}:{done:!1,value:Se[p++]}},e:function(h){throw h},f:he}}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,o=!0,x=!1;return{s:function(){K=K.call(Se)},n:function(){var h=K.next();return o=h.done,h},e:function(h){x=!0,oe=h},f:function(){try{o||K.return==null||K.return()}finally{if(x)throw oe}}}}},15360:function(yn,yt,T){"use strict";T.d(yt,{ZP:function(){return Ki}});const k=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},ce=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Se},Se=Number.MAX_SAFE_INTEGER||9007199254740991;let le=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}({}),K=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 he={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},oe={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class o{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class x{constructor(e,t,n,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new o(e),this.fast_=new o(t),this.defaultTTFB_=r,this.ttfb_=new o(e)}update(e,t){const{slow_:n,fast_:r,ttfb_:i}=this;n.halfLife!==e&&(this.slow_=new o(e,n.getEstimate(),n.getTotalWeight())),r.halfLife!==t&&(this.fast_=new o(t,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new o(e,i.getEstimate(),i.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,r=e/1e3,i=n/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function A(a,e,t){return(e=O(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function h(){return h=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(a[n]=t[n])}return a},h.apply(null,arguments)}function m(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(a,r).enumerable})),t.push.apply(t,n)}return t}function y(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?m(Object(t),!0).forEach(function(n){A(a,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(t,n))})}return a}function S(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var n=t.call(a,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function O(a){var e=S(a,"string");return typeof e=="symbol"?e:e+""}class G{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const n=`[${e}]:`;this.trace=W,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}}const W=function(){},I={trace:W,debug:W,log:W,warn:W,info:W,error:W};function M(){return h({},I)}function w(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):W}function D(a,e,t){return e[a]?e[a].bind(e):w(a,t)}const re=M();function ie(a,e,t){const n=M();if(typeof console=="object"&&a===!0||typeof a=="object"){const r=["debug","log","info","warn","error"];r.forEach(i=>{n[i]=D(i,a,t)});try{n.log(`Debug logs enabled for "${e}" in hls.js version 1.6.5`)}catch(i){return M()}r.forEach(i=>{re[i]=D(i,a)})}else h(re,n);return n}const J=re;function ue(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function ge(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function Ee(a,e){const t=Object.keys(a),n=Object.keys(e),r=t.length,i=n.length;return!r||!i||r===i&&!t.some(s=>n.indexOf(s)===-1)}function Ne(a,e=!1){if(typeof TextDecoder!="undefined"){const u=new TextDecoder("utf-8").decode(a);if(e){const f=u.indexOf("\0");return f!==-1?u.substring(0,f):u}return u.replace(/\0/g,"")}const t=a.length;let n,r,i,s="",l=0;for(;l<t;){if(n=a[l++],n===0&&e)return s;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:s+=String.fromCharCode(n);break;case 12:case 13:r=a[l++],s+=String.fromCharCode((n&31)<<6|r&63);break;case 14:r=a[l++],i=a[l++],s+=String.fromCharCode((n&15)<<12|(r&63)<<6|(i&63)<<0);break}}return s}const Y={hexDump:function(a){let e="";for(let t=0;t<a.length;t++){let n=a[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}};function L(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var V={exports:{}},H;function ee(){return H||(H=1,function(a,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l={buildAbsoluteURL:function(c,u,f){if(f=f||{},c=c.trim(),u=u.trim(),!u){if(!f.alwaysNormalize)return c;var d=l.parseURL(c);if(!d)throw new Error("Error trying to parse base URL.");return d.path=l.normalizePath(d.path),l.buildURLFromParts(d)}var _=l.parseURL(u);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return f.alwaysNormalize?(_.path=l.normalizePath(_.path),l.buildURLFromParts(_)):u;var b=l.parseURL(c);if(!b)throw new Error("Error trying to parse base URL.");if(!b.netLoc&&b.path&&b.path[0]!=="/"){var E=r.exec(b.path);b.netLoc=E[1],b.path=E[2]}b.netLoc&&!b.path&&(b.path="/");var Z={scheme:b.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(Z.netLoc=b.netLoc,_.path[0]!=="/"))if(!_.path)Z.path=b.path,_.params||(Z.params=b.params,_.query||(Z.query=b.query));else{var N=b.path,ae=N.substring(0,N.lastIndexOf("/")+1)+_.path;Z.path=l.normalizePath(ae)}return Z.path===null&&(Z.path=f.alwaysNormalize?l.normalizePath(_.path):_.path),l.buildURLFromParts(Z)},parseURL:function(c){var u=n.exec(c);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(i,"");c.length!==(c=c.replace(s,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};a.exports=l})()}(V)),V.exports}var j=ee();class v{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var g={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class U{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,et(this,"stats")}setByteRange(e,t){const n=e.split("@",2);let r;n.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(n[1]),this._byteRange=[r,parseInt(n[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[g.AUDIO]:null,[g.VIDEO]:null,[g.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new v),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=j.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[g.AUDIO]=null,e[g.VIDEO]=null,e[g.AUDIOVIDEO]=null}}function te(a){return a.sn!=="initSegment"}class Be extends U{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange){const e=this.byteRange[0],t=this.byteRange[1];if(k(e)&&k(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const n=Object.keys(this.levelkeys);if(n.length===1)return this._decryptdata=this.levelkeys[n[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=k(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),n=t.length;if(n>1||n===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!k(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return 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,n,r,i,s=!1){const{elementaryStreams:l}=this,c=l[e];if(!c){l[e]={startPTS:t,endPTS:n,startDTS:r,endDTS:i,partial:s};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,n),c.startDTS=Math.min(c.startDTS,r),c.endDTS=Math.max(c.endDTS,i)}}class Ge extends U{constructor(e,t,n,r,i){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const s=e.enumeratedString("BYTERANGE");s&&this.setByteRange(s,i),i&&(this.fragOffset=i.fragOffset+i.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 Qe(a,e){const t=Object.getPrototypeOf(a);if(t){const n=Object.getOwnPropertyDescriptor(t,e);return n||Qe(t,e)}}function et(a,e){const t=Qe(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const gt=Math.pow(2,32)-1,vt=[].push,we={video:1,audio:2,id3:3,text:4};function _t(a){return String.fromCharCode.apply(null,a)}function ot(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function nt(a,e){const t=Ke(a,e);return t<0?4294967296+t:t}function Tt(a,e){let t=nt(a,e);return t*=Math.pow(2,32),t+=nt(a,e+4),t}function Ke(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function _e(a,e,t){a[e]=t>>24,a[e+1]=t>>16&255,a[e+2]=t>>8&255,a[e+3]=t&255}function ve(a){const e=a.byteLength;for(let t=0;t<e;){const n=nt(a,t);if(n>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=n>1?t+n:e}return!1}function F(a,e){const t=[];if(!e.length)return t;const n=a.byteLength;for(let r=0;r<n;){const i=nt(a,r),s=_t(a.subarray(r+4,r+8)),l=i>1?r+i:n;if(s===e[0])if(e.length===1)t.push(a.subarray(r+8,l));else{const c=F(a.subarray(r+8,l),e.slice(1));c.length&&vt.apply(t,c)}r=l}return t}function xe(a){const e=[],t=a[0];let n=8;const r=nt(a,n);n+=4;let i=0,s=0;t===0?(i=nt(a,n),s=nt(a,n+4),n+=8):(i=Tt(a,n),s=Tt(a,n+8),n+=16),n+=2;let l=a.length+s;const c=ot(a,n);n+=2;for(let u=0;u<c;u++){let f=n;const d=nt(a,f);f+=4;const _=d&2147483647;if((d&2147483648)>>>31===1)return J.warn("SIDX has hierarchical references (not supported)"),null;const E=nt(a,f);f+=4,e.push({referenceSize:_,subsegmentDuration:E,info:{duration:E/r,start:l,end:l+_-1}}),l+=_,f+=4,n=f}return{earliestPresentationTime:i,timescale:r,version:t,referencesCount:c,references:e}}function ke(a){const e=[],t=F(a,["moov","trak"]);for(let r=0;r<t.length;r++){const i=t[r],s=F(i,["tkhd"])[0];if(s){let l=s[0];const c=nt(s,l===0?12:20),u=F(i,["mdia","mdhd"])[0];if(u){l=u[0];const f=nt(u,l===0?12:20),d=F(i,["mdia","hdlr"])[0];if(d){const _=_t(d.subarray(8,12)),b={soun:g.AUDIO,vide:g.VIDEO}[_],E=F(i,["mdia","minf","stbl","stsd"])[0],Z=$(E);b?(e[c]={timescale:f,type:b,stsd:Z},e[b]=y({timescale:f,id:c},Z)):e[c]={timescale:f,type:_,stsd:Z}}}}}return F(a,["moov","mvex","trex"]).forEach(r=>{const i=nt(r,4),s=e[i];s&&(s.default={duration:nt(r,12),flags:nt(r,20)})}),e}function $(a){const e=a.subarray(8),t=e.subarray(86),n=_t(e.subarray(4,8));let r=n,i;const s=n==="enca"||n==="encv";if(s){const u=F(e,[n])[0].subarray(n==="enca"?28:78);F(u,["sinf"]).forEach(d=>{const _=F(d,["schm"])[0];if(_){const b=_t(_.subarray(4,8));if(b==="cbcs"||b==="cenc"){const E=F(d,["frma"])[0];E&&(r=_t(E))}}})}const l=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const c=F(t,["avcC"])[0];c&&c.length>3&&(r+="."+P(c[1])+P(c[2])+P(c[3]),i=R(l==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=F(e,[n])[0],u=F(c.subarray(28),["esds"])[0];if(u&&u.length>7){let f=4;if(u[f++]!==3)break;f=be(u,f),f+=2;const d=u[f++];if(d&128&&(f+=2),d&64&&(f+=u[f++]),u[f++]!==4)break;f=be(u,f);const _=u[f++];if(_===64)r+="."+P(_);else break;if(f+=12,u[f++]!==5)break;f=be(u,f);const b=u[f++];let E=(b&248)>>3;E===31&&(E+=1+((b&7)<<3)+((u[f]&224)>>5)),r+="."+E}break}case"hvc1":case"hev1":{const c=F(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],f=["","A","B","C"][u>>6],d=u&31,_=nt(c,2),b=(u&32)>>5?"H":"L",E=c[12],Z=c.subarray(6,12);r+="."+f+d,r+="."+ne(_).toString(16).toUpperCase(),r+="."+b+E;let N="";for(let ae=Z.length;ae--;){const Pe=Z[ae];(Pe||N)&&(N="."+Pe.toString(16).toUpperCase()+N)}r+=N}i=R(l=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=R(r,t)||r;break}case"vp09":{const c=F(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],f=c[5],d=c[6]>>4&15;r+="."+C(u)+"."+C(f)+"."+C(d)}break}case"av01":{const c=F(t,["av1C"])[0];if(c&&c.length>2){const u=c[1]>>>5,f=c[1]&31,d=c[2]>>>7?"H":"M",_=(c[2]&64)>>6,b=(c[2]&32)>>5,E=u===2&&_?b?12:10:_?10:8,Z=(c[2]&16)>>4,N=(c[2]&8)>>3,ae=(c[2]&4)>>2,Pe=c[2]&3;r+="."+u+"."+C(f)+d+"."+C(E)+"."+Z+"."+N+ae+Pe+"."+C(1)+"."+C(1)+"."+C(1)+"."+0,i=R("dav1",t)}break}}return{codec:r,encrypted:s,supplemental:i}}function R(a,e){const t=F(e,["dvvC"]),n=t.length?t[0]:F(e,["dvcC"])[0];if(n){const r=n[2]>>1&127,i=n[2]<<5&32|n[3]>>3&31;return a+"."+C(r)+"."+C(i)}}function ne(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function be(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function P(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function C(a){return(a<10?"0":"")+a}function X(a,e){if(!a||!e)return a;const t=e.keyId;return t&&e.isCommonEncryption&&F(a,["moov","trak"]).forEach(r=>{const s=F(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let l=F(s,["enca"]);const c=l.length>0;c||(l=F(s,["encv"])),l.forEach(u=>{const f=c?u.subarray(28):u.subarray(78);F(f,["sinf"]).forEach(_=>{const b=q(_);if(b){const E=b.subarray(8,24);E.some(Z=>Z!==0)||(J.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${Y.hexDump(E)} -> ${Y.hexDump(t)}`),b.set(t,8))}})})}),a}function q(a){const e=F(a,["schm"])[0];if(e){const t=_t(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return F(a,["schi","tenc"])[0]}return null}function Q(a,e,t){const n={},r=F(a,["moof","traf"]);for(let i=0;i<r.length;i++){const s=r[i],l=F(s,["tfhd"])[0],c=nt(l,4),u=e[c];if(!u)continue;const f=n[c]||(n[c]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type}),d=F(s,["tfdt"])[0];if(d){const ye=d[0];let $e=nt(d,4);ye===1&&($e===gt?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):($e*=gt+1,$e+=nt(d,8))),k($e)&&(!k(f.start)||$e<f.start)&&(f.start=$e)}const _=u.default,b=nt(l,0)|(_==null?void 0:_.flags);let E=(_==null?void 0:_.duration)||0;b&8&&(b&2?E=nt(l,12):E=nt(l,8));const Z=F(s,["trun"]);let N=f.start||0,ae=0,Pe=E;for(let ye=0;ye<Z.length;ye++){const $e=Z[ye],We=nt($e,4),ht=f.sampleCount;f.sampleCount+=We;const Ye=$e[3]&1,st=$e[3]&4,dt=$e[2]&1,Xe=$e[2]&2,$t=$e[2]&4,pn=$e[2]&8;let Vn=8,Dn=We;for(Ye&&(Vn+=4),st&&We&&(!($e[Vn+1]&1)&&f.keyFrameIndex===void 0&&(f.keyFrameIndex=ht),Vn+=4,dt?(Pe=nt($e,Vn),Vn+=4):Pe=E,Xe&&(Vn+=4),pn&&(Vn+=4),N+=Pe,ae+=Pe,Dn--);Dn--;)dt?(Pe=nt($e,Vn),Vn+=4):Pe=E,Xe&&(Vn+=4),$t&&($e[Vn+1]&1||f.keyFrameIndex===void 0&&(f.keyFrameIndex=f.sampleCount-(Dn+1),f.keyFrameStart=N),Vn+=4),pn&&(Vn+=4),N+=Pe,ae+=Pe;!ae&&E&&(ae+=E*We)}f.duration+=ae}if(!Object.keys(n).some(i=>n[i].duration)){let i=1/0,s=0;const l=F(a,["sidx"]);for(let c=0;c<l.length;c++){const u=xe(l[c]);if(u!=null&&u.references){i=Math.min(i,u.earliestPresentationTime/u.timescale);const f=u.references.reduce((d,_)=>d+_.info.duration||0,0);s=Math.max(s,f+u.earliestPresentationTime/u.timescale)}}s&&k(s)&&Object.keys(n).forEach(c=>{n[c].duration||(n[c].duration=s*n[c].timescale-n[c].start)})}return n}function se(a,e,t){F(e,["moof","traf"]).forEach(n=>{F(n,["tfhd"]).forEach(r=>{const i=nt(r,4),s=a[i];if(!s)return;const l=s.timescale||9e4;F(n,["tfdt"]).forEach(c=>{const u=c[0],f=t*l;if(f){let d=nt(c,4);if(u===0)d-=f,d=Math.max(d,0),_e(c,4,d);else{d*=Math.pow(2,32),d+=nt(c,8),d-=f,d=Math.max(d,0);const _=Math.floor(d/(gt+1)),b=Math.floor(d%(gt+1));_e(c,4,_),_e(c,8,b)}}})})})}function me(a){const e={valid:null,remainder:null},t=F(a,["moof"]);if(t.length<2)return e.remainder=a,e;const n=t[t.length-1];return e.valid=a.slice(0,n.byteOffset-8),e.remainder=a.slice(n.byteOffset-8),e}function Ce(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Ie(a,e){const t=[],n=e.samples,r=e.timescale,i=e.id;let s=!1;return F(n,["moof"]).map(c=>{const u=c.byteOffset-8;F(c,["traf"]).map(d=>{const _=F(d,["tfdt"]).map(b=>{const E=b[0];let Z=nt(b,4);return E===1&&(Z*=Math.pow(2,32),Z+=nt(b,8)),Z/r})[0];return _!==void 0&&(a=_),F(d,["tfhd"]).map(b=>{const E=nt(b,4),Z=nt(b,0)&16777215,N=(Z&1)!==0,ae=(Z&2)!==0,Pe=(Z&8)!==0;let ye=0;const $e=(Z&16)!==0;let We=0;const ht=(Z&32)!==0;let Ye=8;E===i&&(N&&(Ye+=8),ae&&(Ye+=4),Pe&&(ye=nt(b,Ye),Ye+=4),$e&&(We=nt(b,Ye),Ye+=4),ht&&(Ye+=4),e.type==="video"&&(s=De(e.codec)),F(d,["trun"]).map(st=>{const dt=st[0],Xe=nt(st,0)&16777215,$t=(Xe&1)!==0;let pn=0;const Vn=(Xe&4)!==0,Dn=(Xe&256)!==0;let Cn=0;const gn=(Xe&512)!==0;let kn=0;const Fn=(Xe&1024)!==0,Ht=(Xe&2048)!==0;let nn=0;const sr=nt(st,4);let qn=8;$t&&(pn=nt(st,qn),qn+=4),Vn&&(qn+=4);let vr=pn+u;for(let br=0;br<sr;br++){if(Dn?(Cn=nt(st,qn),qn+=4):Cn=ye,gn?(kn=nt(st,qn),qn+=4):kn=We,Fn&&(qn+=4),Ht&&(dt===0?nn=nt(st,qn):nn=Ke(st,qn),qn+=4),e.type===g.VIDEO){let Tr=0;for(;Tr<kn;){const Rr=nt(n,vr);if(vr+=4,Fe(s,n[vr])){const ei=n.subarray(vr,vr+Rr);ze(ei,s?2:1,a+nn/r,t)}vr+=Rr,Tr+=Rr+4}}a+=Cn/r}}))})})}),t}function De(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function Fe(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function ze(a,e,t,n){const r=je(a);let i=0;i+=e;let s=0,l=0,c=0;for(;i<r.length;){s=0;do{if(i>=r.length)break;c=r[i++],s+=c}while(c===255);l=0;do{if(i>=r.length)break;c=r[i++],l+=c}while(c===255);const u=r.length-i;let f=i;if(l<u)i+=l;else if(l>u){J.error(`Malformed SEI payload. ${l} is too small, only ${u} bytes left to parse.`);break}if(s===4){if(r[f++]===181){const _=ot(r,f);if(f+=2,_===49){const b=nt(r,f);if(f+=4,b===1195456820){const E=r[f++];if(E===3){const Z=r[f++],N=31&Z,ae=64&Z,Pe=ae?2+N*3:0,ye=new Uint8Array(Pe);if(ae){ye[0]=Z;for(let $e=1;$e<Pe;$e++)ye[$e]=r[f++]}n.push({type:E,payloadType:s,pts:t,bytes:ye})}}}}}else if(s===5&&l>16){const d=[];for(let E=0;E<16;E++){const Z=r[f++].toString(16);d.push(Z.length==1?"0"+Z:Z),(E===3||E===5||E===7||E===9)&&d.push("-")}const _=l-16,b=new Uint8Array(_);for(let E=0;E<_;E++)b[E]=r[f++];n.push({payloadType:s,pts:t,uuid:d.join(""),userData:Ne(b),userDataBytes:b})}}}function je(a){const e=a.byteLength,t=[];let n=1;for(;n<e-2;)a[n]===0&&a[n+1]===0&&a[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return a;const r=e-t.length,i=new Uint8Array(r);let s=0;for(n=0;n<r;s++,n++)s===t[0]&&(s++,t.shift()),i[n]=a[s];return i}function Ue(a){const e=a[0];let t="",n="",r=0,i=0,s=0,l=0,c=0,u=0;if(e===0){for(;_t(a.subarray(u,u+1))!=="\0";)t+=_t(a.subarray(u,u+1)),u+=1;for(t+=_t(a.subarray(u,u+1)),u+=1;_t(a.subarray(u,u+1))!=="\0";)n+=_t(a.subarray(u,u+1)),u+=1;n+=_t(a.subarray(u,u+1)),u+=1,r=nt(a,12),i=nt(a,16),l=nt(a,20),c=nt(a,24),u=28}else if(e===1){u+=4,r=nt(a,u),u+=4;const d=nt(a,u);u+=4;const _=nt(a,u);for(u+=4,s=Xo(2,32)*d+_,ce(s)||(s=Number.MAX_SAFE_INTEGER,J.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=nt(a,u),u+=4,c=nt(a,u),u+=4;_t(a.subarray(u,u+1))!=="\0";)t+=_t(a.subarray(u,u+1)),u+=1;for(t+=_t(a.subarray(u,u+1)),u+=1;_t(a.subarray(u,u+1))!=="\0";)n+=_t(a.subarray(u,u+1)),u+=1;n+=_t(a.subarray(u,u+1)),u+=1}const f=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:n,timeScale:r,presentationTime:s,presentationTimeDelta:i,eventDuration:l,id:c,payload:f}}function bt(a,...e){const t=e.length;let n=8,r=t;for(;r--;)n+=e[r].byteLength;const i=new Uint8Array(n);for(i[0]=n>>24&255,i[1]=n>>16&255,i[2]=n>>8&255,i[3]=n&255,i.set(a,4),r=0,n=8;r<t;r++)i.set(e[r],n),n+=e[r].byteLength;return i}function xt(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let n,r;n=0,r=new Uint8Array;let i;n>0?(i=new Uint8Array(4),e.length>0&&new DataView(i.buffer).setUint32(0,e.length,!1)):i=new Uint8Array;const s=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(s.buffer).setUint32(0,t.byteLength,!1),bt([112,115,115,104],new Uint8Array([n,0,0,0]),a,i,r,s,t||new Uint8Array)}function it(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let n=0;for(;n+32<t;){const r=new DataView(a,n),i=Ft(r);e.push(i),n+=i.size}}return e}function Ft(a){const e=a.getUint32(0),t=a.byteOffset,n=a.byteLength;if(n<e)return{offset:t,size:n};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const i=a.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:t,size:e};const s=a.buffer,l=Y.hexDump(new Uint8Array(s,t+12,16)),c=a.getUint32(28);let u=null,f=null;if(i===0){if(e-32<c||c<22)return{offset:t,size:e};f=new Uint8Array(s,t+32,c)}else if(i===1){if(!c||n<t+32+c*16+16)return{offset:t,size:e};u=[];for(let d=0;d<c;d++)u.push(new Uint8Array(s,t+32+d*16,16))}return{version:i,systemId:l,kids:u,data:f,offset:t,size:e}}const Yt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),at={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 Ut(a,e){const t=at[e];return!!t&&!!t[a.slice(0,4)]}function Me(a,e,t=!0){return!a.split(",").some(n=>!Te(n,e,t))}function Te(a,e,t=!0){var n;const r=ue(t);return(n=r==null?void 0:r.isTypeSupported(Re(a,e)))!=null?n:!1}function Re(a,e){return`${e}/mp4;codecs=${a}`}function B(a){if(a){const e=a.substring(0,4);return at.video[e]}return 2}function z(a){const e=Yt();return a.split(",").reduce((t,n)=>{const i=e&&De(n)?9:at.video[n];return i?(i*2+t)/(t?3:2):(at.audio[n]+t)/(t?2:1)},0)}const de={};function fe(a,e=!0){if(de[a])return de[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let r=0;r<t.length;r++){var n;if(Te(t[r],"audio",e))return de[a]=t[r],t[r];if(t[r]==="mp3"&&(n=ue(e))!=null&&n.isTypeSupported("audio/mpeg"))return""}return a}const pe=/flac|opus|mp4a\.40\.34/i;function Ve(a,e=!0){return a.replace(pe,t=>fe(t.toLowerCase(),e))}function qe(a,e){const t=[];if(a){const n=a.split(",");for(let r=0;r<n.length;r++)Ut(n[r],"video")||t.push(n[r])}return e&&t.push(e),t.join(",")}function mt(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let n=t.length;n--;)if(t[n].substring(0,4)===a.substring(0,4))return t[n]}return t[0]}}return e||a}function Pt(a){const e=a.split(",");for(let t=0;t<e.length;t++){const n=e[t].split(".");n.length>2&&n[0]==="avc1"&&(e[t]=`avc1.${parseInt(n[1]).toString(16)}${("000"+parseInt(n[2]).toString(16)).slice(-4)}`)}return e.join(",")}function rn(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let n=e.length;n>4&&n<10;n++)e[n]=t[n-4];return e.join(".")}return a}function hn(a){const e=ue(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 qt(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const sn={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Rn(a,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:a}}const Zn={};function In(a,e,t,n,r,i){const s=a.audioCodec?a.audioGroups:null,l=i==null?void 0:i.audioCodec,c=i==null?void 0:i.channels,u=c?parseInt(c):l?1/0:2;let f=null;if(s!=null&&s.length)try{s.length===1&&s[0]?f=e.groups[s[0]].channels:f=s.reduce((d,_)=>{if(_){const b=e.groups[_];if(!b)throw new Error(`Audio track group ${_} not found`);Object.keys(b.channels).forEach(E=>{d[E]=(d[E]||0)+b.channels[E]})}return d},{2:0})}catch(d){return!0}return a.videoCodec!==void 0&&(a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(n,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(r,8e6))||!!f&&k(u)&&Object.keys(f).some(d=>parseInt(d)>u)}function Nn(a,e,t){const n=a.videoCodec,r=a.audioCodec;if(!n&&!r||!t)return Promise.resolve(sn);const i=[];if(n){const s={width:a.width,height:a.height,bitrate:Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)),framerate:a.frameRate||30},l=a.videoRange;l!=="SDR"&&(s.transferFunction=l.toLowerCase());const c=n.split(","),u=navigator.userAgent;if(c.some(f=>De(f))&&Yt())return Promise.resolve(Rn(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${u})`),i));i.push.apply(i,c.map(f=>({type:"media-source",video:y(y({},s),{},{contentType:Re(rn(f),"video")})})))}return r&&a.audioGroups&&a.audioGroups.forEach(s=>{var l;s&&((l=e.groups[s])==null||l.tracks.forEach(c=>{if(c.groupId===s){const u=c.channels||"",f=parseFloat(u);k(f)&&f>2&&i.push.apply(i,r.split(",").map(d=>({type:"media-source",audio:{contentType:Re(d,"audio"),channels:""+f}})))}}))}),Promise.all(i.map(s=>{const l=kt(s);return Zn[l]||(Zn[l]=t.decodingInfo(s))})).then(s=>({supported:!s.some(l=>!l.supported),configurations:i,decodingInfoResults:s})).catch(s=>({supported:!1,configurations:i,decodingInfoResults:[],error:s}))}function kt(a){const{audio:e,video:t}=a,n=t||e;if(n){const r=qt(n.contentType);if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${r}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${r}`}return""}const ft=["NONE","TYPE-0","TYPE-1",null];function Kt(a){return ft.indexOf(a)>-1}const _n=["SDR","PQ","HLG"];function Wn(a){return!!a&&_n.indexOf(a)>-1}var Oe={No:"",Yes:"YES",v2:"v2"};function Le(a){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=a,r=n<e/2;return e&&r?t?Oe.v2:Oe.Yes:Oe.No}class At{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class rt{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(n=>!!n).map(n=>n.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const n=(t=e.supplemental)==null?void 0:t.videoCodec;n&&n!==e.videoCodec&&(this.codecSet+=`,${n.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return St(this._audioGroups,e)}hasSubtitleGroup(e){return St(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function St(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function Rt(){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 Et(a,e){let t=!1,n=[];if(a&&(t=a!=="SDR",n=[a]),e){n=e.allowedVideoRanges||_n.slice(0);const r=n.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&Rt(),t||(n=["SDR"])}return{preferHDR:t,allowedVideoRanges:n}}const Ot=a=>{const e=new WeakSet;return(t,n)=>{if(a&&(n=a(t,n)),typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}},Mt=(a,e)=>JSON.stringify(a,Ot(e));function Ct(a,e,t,n,r){const i=Object.keys(a),s=n==null?void 0:n.channels,l=n==null?void 0:n.audioCodec,c=r==null?void 0:r.videoCodec,u=s&&parseInt(s)===2;let f=!1,d=!1,_=1/0,b=1/0,E=1/0,Z=1/0,N=0,ae=[];const{preferHDR:Pe,allowedVideoRanges:ye}=Et(e,r);for(let st=i.length;st--;){const dt=a[i[st]];f||(f=dt.channels[2]>0),_=Math.min(_,dt.minHeight),b=Math.min(b,dt.minFramerate),E=Math.min(E,dt.minBitrate),ye.filter($t=>dt.videoRanges[$t]>0).length>0&&(d=!0)}_=k(_)?_:0,b=k(b)?b:0;const $e=Math.max(1080,_),We=Math.max(30,b);E=k(E)?E:t,t=Math.max(E,t),d||(e=void 0);const ht=i.length>1;return{codecSet:i.reduce((st,dt)=>{const Xe=a[dt];if(dt===st)return st;if(ae=d?ye.filter($t=>Xe.videoRanges[$t]>0):[],ht){if(Xe.minBitrate>t)return It(dt,`min bitrate of ${Xe.minBitrate} > current estimate of ${t}`),st;if(!Xe.hasDefaultAudio)return It(dt,"no renditions with default or auto-select sound found"),st;if(l&&dt.indexOf(l.substring(0,4))%5!==0)return It(dt,`audio codec preference "${l}" not found`),st;if(s&&!u){if(!Xe.channels[s])return It(dt,`no renditions with ${s} channel sound found (channels options: ${Object.keys(Xe.channels)})`),st}else if((!l||u)&&f&&Xe.channels[2]===0)return It(dt,"no renditions with stereo sound found"),st;if(Xe.minHeight>$e)return It(dt,`min resolution of ${Xe.minHeight} > maximum of ${$e}`),st;if(Xe.minFramerate>We)return It(dt,`min framerate of ${Xe.minFramerate} > maximum of ${We}`),st;if(!ae.some($t=>Xe.videoRanges[$t]>0))return It(dt,`no variants with VIDEO-RANGE of ${Mt(ae)} found`),st;if(c&&dt.indexOf(c.substring(0,4))%5!==0)return It(dt,`video codec preference "${c}" not found`),st;if(Xe.maxScore<N)return It(dt,`max score of ${Xe.maxScore} < selected max of ${N}`),st}return st&&(z(dt)>=z(st)||Xe.fragmentError>a[st].fragmentError)?st:(Z=Xe.minIndex,N=Xe.maxScore,dt)},void 0),videoRanges:ae,preferHDR:Pe,minFramerate:b,minBitrate:E,minIndex:Z}}function It(a,e){J.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function Zt(a){return a.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const r=t.channels||"2";return n.channels[r]=(n.channels[r]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Nt(a,e,t,n){return a.slice(t,n+1).reduce((r,i,s)=>{if(!i.codecSet)return r;const l=i.audioGroups;let c=r[i.codecSet];c||(r[i.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:s,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!l,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,i.bitrate);const u=Math.min(i.height,i.width);return c.minHeight=Math.min(c.minHeight,u),c.minFramerate=Math.min(c.minFramerate,i.frameRate),c.minIndex=Math.min(c.minIndex,s),c.maxScore=Math.max(c.maxScore,i.score),c.fragmentError+=i.fragmentError,c.videoRanges[i.videoRange]=(c.videoRanges[i.videoRange]||0)+1,l&&l.forEach(f=>{if(!f)return;const d=e.groups[f];d&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(_=>{c.channels[_]=(c.channels[_]||0)+d.channels[_]}))}),r},{})}function ut(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:n,channels:r,audioCodec:i}=a;return{lang:e,assocLang:t,characteristics:n,channels:r,audioCodec:i}}function Ae(a,e,t){if("attrs"in a){const n=e.indexOf(a);if(n!==-1)return n}for(let n=0;n<e.length;n++){const r=e[n];if(Ze(a,r,t))return n}return-1}function Ze(a,e,t){const{groupId:n,name:r,lang:i,assocLang:s,default:l}=a,c=a.forced;return(n===void 0||e.groupId===n)&&(r===void 0||e.name===r)&&(i===void 0||He(i,e.lang))&&(i===void 0||e.assocLang===s)&&(l===void 0||e.default===l)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||Je(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function He(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function Je(a,e=""){const t=a.split(","),n=e.split(",");return t.length===n.length&&!t.some(r=>n.indexOf(r)===-1)}function lt(a,e){const{audioCodec:t,channels:n}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function pt(a,e,t,n,r){const i=e[n],l=e.reduce((_,b,E)=>{const Z=b.uri;return(_[Z]||(_[Z]=[])).push(E),_},{})[i.uri];l.length>1&&(n=Math.max.apply(Math,l));const c=i.videoRange,u=i.frameRate,f=i.codecSet.substring(0,4),d=Lt(e,n,_=>{if(_.videoRange!==c||_.frameRate!==u||_.codecSet.substring(0,4)!==f)return!1;const b=_.audioGroups,E=t.filter(Z=>!b||b.indexOf(Z.groupId)!==-1);return Ae(a,E,r)>-1});return d>-1?d:Lt(e,n,_=>{const b=_.audioGroups,E=t.filter(Z=>!b||b.indexOf(Z.groupId)!==-1);return Ae(a,E,r)>-1})}function Lt(a,e,t){for(let n=e;n>-1;n--)if(t(a[n]))return n;for(let n=e+1;n<a.length;n++)if(t(a[n]))return n;return-1}function Gt(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Qt extends G{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var n;const{fragCurrent:r,partCurrent:i,hls:s}=this,{autoLevelEnabled:l,media:c}=s;if(!r||!c)return;const u=performance.now(),f=i?i.stats:r.stats,d=i?i.duration:r.duration,_=u-f.loading.start,b=s.minAutoLevel,E=r.level,Z=this._nextAutoLevel;if(f.aborted||f.loaded&&f.loaded===f.total||E<=b){this.clearTimer(),this._nextAutoLevel=-1;return}if(!l)return;const N=Z>-1&&Z!==E,ae=!!t||N;if(!ae&&(c.paused||!c.playbackRate||!c.readyState))return;const Pe=s.mainForwardBufferInfo;if(!ae&&Pe===null)return;const ye=this.bwEstimator.getEstimateTTFB(),$e=Math.abs(c.playbackRate);if(_<=Math.max(ye,1e3*(d/($e*2))))return;const We=Pe?Pe.len/$e:0,ht=f.loading.first?f.loading.first-f.loading.start:-1,Ye=f.loaded&&ht>-1,st=this.getBwEstimate(),dt=s.levels,Xe=dt[E],$t=Math.max(f.loaded,Math.round(d*(r.bitrate||Xe.averageBitrate)/8));let pn=Ye?_-ht:_;pn<1&&Ye&&(pn=Math.min(_,f.loaded*8/st));const Vn=Ye?f.loaded*1e3/pn:0,Dn=ye/1e3,Cn=Vn?($t-f.loaded)/Vn:$t*8/st+Dn;if(Cn<=We)return;const gn=Vn?Vn*8:st,kn=((n=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:n.live)===!0,Fn=this.hls.config.abrBandWidthUpFactor;let Ht=Number.POSITIVE_INFINITY,nn;for(nn=E-1;nn>b;nn--){const br=dt[nn].maxBitrate,Tr=!dt[nn].details||kn;if(Ht=this.getTimeToLoadFrag(Dn,gn,d*br,Tr),Ht<Math.min(We,d+Dn))break}if(Ht>=Cn||Ht>d*10)return;Ye?this.bwEstimator.sample(_-Math.min(ye,ht),f.loaded):this.bwEstimator.sampleTTFB(_);const sr=dt[nn].maxBitrate;this.getBwEstimate()*Fn>sr&&this.resetEstimator(sr);const qn=this.findBestLevel(sr,b,nn,0,We,1,1);qn>-1&&(nn=qn),this.warn(`Fragment ${r.sn}${i?" part "+i.index:""} of level ${E} is loading too slowly;
Fragment duration: ${r.duration.toFixed(3)}
Time to underbuffer: ${We.toFixed(3)} s
Estimated load time for current fragment: ${Cn.toFixed(3)} s
Estimated load time for down switch fragment: ${Ht.toFixed(3)} s
TTFB estimate: ${ht|0} ms
Current BW estimate: ${k(st)?st|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${nn} @ ${sr|0} bps`),s.nextLoadLevel=s.nextAutoLevel=nn,this.clearTimer();const vr=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===nn&&nn>0){const br=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${nn>0?"and switching down":""}
Fragment duration: ${r.duration.toFixed(3)} s
Time to underbuffer: ${br.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,nn>b){let Tr=this.findBestLevel(this.hls.levels[b].bitrate,b,nn,0,br,1,1);Tr===-1&&(Tr=b),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Tr,this.resetEstimator(this.hls.levels[Tr].bitrate)}}};N||Cn>Ht*2?vr():this.timer=self.setInterval(vr,Ht*1e3),s.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:i,stats:f})},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 x(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=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var r;this.fragCurrent=n,this.partCurrent=(r=t.part)!=null?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case K.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:r,partCurrent:i}=this;if(n&&r&&n.sn===r.sn&&n.level===r.level){const s=performance.now(),l=i?i.stats:n.stats,c=s-l.loading.start,u=l.loading.first?l.loading.first-l.loading.start:-1;if(l.loaded&&u>-1){const d=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(d,u),l.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,n,r){const i=e+n/t,s=r?e+this.lastLevelLoadSec:0;return i+s}onLevelLoaded(e,t){const n=this.hls.config,{loading:r}=t.stats,i=r.end-r.first;k(i)&&(this.lastLevelLoadSec=i/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){const r=n?n.stats:t.stats;if(t.type===oe.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const i=n?n.duration:t.duration,s=this.hls.levels[t.level],l=(s.loaded?s.loaded.bytes:0)+r.loaded,c=(s.loaded?s.loaded.duration:0)+i;s.loaded={bytes:l,duration:c},s.realBitrate=Math.round(8*l/c)}if(t.bitrateTest){const i={stats:r,frag:t,part:n,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,i),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:r}=t,i=r!=null&&r.stats.loaded?r.stats:n.stats;if(i.aborted||this.ignoreFragment(n))return;const s=i.parsing.end-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,i.loaded),i.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==oe.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,i=this.findBestLevel(n,t,e,0,r,1,1);if(i>-1)return i;const s=this.hls.firstLevel,l=Math.min(Math.max(s,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${l}`),l}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,n=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const i=n&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const s=this.hls.levels;if(s.length>Math.max(e,i)&&s[e].loadError<=s[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:r,config:i,minAutoLevel:s}=n,l=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let f=i.abrBandWidthFactor,d=i.abrBandWidthUpFactor;if(u){const N=this.findBestLevel(c,s,r,u,0,f,d);if(N>=0)return this.rebufferNotice=-1,N}let _=l?Math.min(l,i.maxStarvationDelay):i.maxStarvationDelay;if(!u){const N=this.bitrateTestDelay;N&&(_=(l?Math.min(l,i.maxLoadingDelay):i.maxLoadingDelay)-N,this.info(`bitrate test took ${Math.round(1e3*N)}ms, set first fragment max fetchDuration to ${Math.round(1e3*_)} ms`),f=d=1)}const b=this.findBestLevel(c,s,r,u,_,f,d);if(this.rebufferNotice!==b&&(this.rebufferNotice=b,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${b}`)),b>-1)return b;const E=n.levels[s],Z=n.loadLevelObj;return Z&&(E==null?void 0:E.bitrate)<Z.bitrate?s:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,r,i,s,l){var c;const u=r+i,f=this.lastLoadedFragLevel,d=f===-1?this.hls.firstLevel:f,{fragCurrent:_,partCurrent:b}=this,{levels:E,allAudioTracks:Z,loadLevel:N,config:ae}=this.hls;if(E.length===1)return 0;const Pe=E[d],ye=!!((c=this.hls.latestLevelDetails)!=null&&c.live),$e=N===-1||f===-1;let We,ht="SDR",Ye=(Pe==null?void 0:Pe.frameRate)||0;const{audioPreference:st,videoPreference:dt}=ae,Xe=this.audioTracksByGroup||(this.audioTracksByGroup=Zt(Z));let $t=-1;if($e){if(this.firstSelection!==-1)return this.firstSelection;const gn=this.codecTiers||(this.codecTiers=Nt(E,Xe,t,n)),kn=Ct(gn,ht,e,st,dt),{codecSet:Fn,videoRanges:Ht,minFramerate:nn,minBitrate:sr,minIndex:qn,preferHDR:vr}=kn;$t=qn,We=Fn,ht=vr?Ht[Ht.length-1]:Ht[0],Ye=nn,e=Math.max(e,sr),this.log(`picked start tier ${Mt(kn)}`)}else We=Pe==null?void 0:Pe.codecSet,ht=Pe==null?void 0:Pe.videoRange;const pn=b?b.duration:_?_.duration:0,Vn=this.bwEstimator.getEstimateTTFB()/1e3,Dn=[];for(let gn=n;gn>=t;gn--){var Cn;const kn=E[gn],Fn=gn>d;if(!kn)continue;if(ae.useMediaCapabilities&&!kn.supportedResult&&!kn.supportedPromise){const Tr=navigator.mediaCapabilities;typeof(Tr==null?void 0:Tr.decodingInfo)=="function"&&(In(kn,Xe,ht,Ye,e,st)||De(kn.videoCodec))?(kn.supportedPromise=Nn(kn,Xe,Tr),kn.supportedPromise.then(Rr=>{if(!this.hls)return;kn.supportedResult=Rr;const ei=this.hls.levels,si=ei.indexOf(kn);Rr.error?this.warn(`MediaCapabilities decodingInfo error: "${Rr.error}" for level ${si} ${Mt(Rr)}`):Rr.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${si} ${Mt(Rr)}`),si>-1&&ei.length>1&&(this.log(`Removing unsupported level ${si}`),this.hls.removeLevel(si),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):kn.supportedResult=sn}if((We&&kn.codecSet!==We||ht&&kn.videoRange!==ht||Fn&&Ye>kn.frameRate||!Fn&&Ye>0&&Ye<kn.frameRate||kn.supportedResult&&!((Cn=kn.supportedResult.decodingInfoResults)!=null&&Cn[0].smooth))&&(!$e||gn!==$t)){Dn.push(gn);continue}const Ht=kn.details,nn=(b?Ht==null?void 0:Ht.partTarget:Ht==null?void 0:Ht.averagetargetduration)||pn;let sr;Fn?sr=l*e:sr=s*e;const qn=pn&&r>=pn*2&&i===0?kn.averageBitrate:kn.maxBitrate,vr=this.getTimeToLoadFrag(Vn,sr,qn*nn,Ht===void 0);if(sr>=qn&&(gn===f||kn.loadError===0&&kn.fragmentError===0)&&(vr<=Vn||!k(vr)||ye&&!this.bitrateTestDelay||vr<u)){const Tr=this.forcedAutoLevel;return gn!==N&&(Tr===-1||Tr!==N)&&(Dn.length&&this.trace(`Skipped level(s) ${Dn.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${E[Dn[0]].codecs}" ${E[Dn[0]].videoRange}; not compatible with "${We}" ${ht}`),this.info(`switch candidate:${d}->${gn} adjustedbw(${Math.round(sr)})-bitrate=${Math.round(sr-qn)} ttfb:${Vn.toFixed(1)} avgDuration:${nn.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${vr.toFixed(1)} firstSelection:${$e} codecSet:${kn.codecSet} videoRange:${kn.videoRange} hls.loadLevel:${N}`)),$e&&(this.firstSelection=gn),gn}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}}const tn={search:function(a,e){let t=0,n=a.length-1,r=null,i=null;for(;t<=n;){r=(t+n)/2|0,i=a[r];const s=e(i);if(s>0)t=r+1;else if(s<0)n=r-1;else return i}return null}};function $n(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!k(e))return null;const n=a[0].programDateTime;if(e<(n||0))return null;const r=a[a.length-1].endProgramDateTime;if(e>=(r||0))return null;for(let i=0;i<a.length;++i){const s=a[i];if(mn(e,t,s))return s}return null}function Vt(a,e,t=0,n=0,r=.005){let i=null;if(a){i=e[1+a.sn-e[0].sn]||null;const l=a.endDTS-t;l>0&&l<15e-7&&(t+=15e-7),i&&a.level!==i.level&&i.end<=a.end&&(i=e[2+a.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(i=e[0]);if(i&&((!a||a.level===i.level)&&ln(t,n,i)===0||fn(i,a,Math.min(r,n))))return i;const s=tn.search(e,ln.bind(null,t,n));return s&&(s!==a||!i)?s:i}function fn(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((r,i)=>(i[0]==="INF"&&(r+=parseFloat(i[1])),r),t);return a.start<=n}return!1}function ln(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=a?1:t.start-n>a&&t.start?-1:0}function mn(a,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>a}function Wt(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let n=a.fragments;const{fragmentHint:r}=a;r&&(n=n.concat(r));let i;return tn.search(n,s=>s.cc<e?1:s.cc>e?-1:(i=s,s.end<=t?1:s.start>t?-1:0)),i||null}return null}function Bt(a){switch(a.details){case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_TIMEOUT:case K.LEVEL_LOAD_TIMEOUT:case K.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function zt(a,e){const t=Bt(e);return a.default[`${t?"timeout":"error"}Retry`]}function an(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function un(a){return y(y({},a),{errorRetry:null,timeoutRetry:null})}function cn(a,e,t,n){if(!a)return!1;const r=n==null?void 0:n.code,i=e<a.maxNumRetry&&(En(r)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,n,i):i}function En(a){return a===0&&navigator.onLine===!1||!!a&&(a<400||a>499)}var jt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},en={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Qn extends G{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(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,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===oe.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;const r=this.hls,i=t.context;switch(t.details){case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case K.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction=Hn();return}case K.FRAG_GAP:case K.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=jt.SendAlternateToPenaltyBox;return}case K.LEVEL_EMPTY_ERROR:case K.LEVEL_PARSING_ERROR:{var s,l;const u=t.parent===oe.MAIN?t.level:r.loadLevel;t.details===K.LEVEL_EMPTY_ERROR&&((s=t.context)!=null&&(l=s.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,u):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,u))}return;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:typeof(i==null?void 0:i.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.level));return;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.SUBTITLE_LOAD_ERROR:case K.SUBTITLE_TRACK_LOAD_TIMEOUT:if(i){const u=r.loadLevelObj;if(u&&(i.type===he.AUDIO_TRACK&&u.hasAudioGroup(i.groupId)||i.type===he.SUBTITLE_TRACK&&u.hasSubtitleGroup(i.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=jt.SendAlternateToPenaltyBox,t.errorAction.flags=en.MoveAllAlternatesMatchingHost;return}}return;case K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const u=r.loadLevelObj,f=u==null?void 0:u.attrs["HDCP-LEVEL"];f?t.errorAction={action:jt.SendAlternateToPenaltyBox,flags:en.MoveAllAlternatesMatchingHDCP,hdcpLevel:f}:this.keySystemError(t)}return;case K.BUFFER_ADD_CODEC_ERROR:case K.REMUX_ALLOC_ERROR:case K.BUFFER_APPEND_ERROR:if(!t.errorAction){var c;t.errorAction=this.getLevelSwitchAction(t,(c=t.level)!=null?c:r.loadLevel)}return;case K.INTERNAL_EXCEPTION:case K.BUFFER_APPENDING_ERROR:case K.BUFFER_FULL_ERROR:case K.LEVEL_SWITCH_ERROR:case K.BUFFER_STALLED_ERROR:case K.BUFFER_SEEK_OVER_HOLE:case K.BUFFER_NUDGE_ON_STALL:t.errorAction=Hn();return}t.type===le.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const n=this.hls,r=zt(n.config.playlistLoadPolicy,e),i=this.playlistError++;if(cn(r,i,Bt(e),e.response))return{action:jt.RetryRequest,flags:en.None,retryConfig:r,retryCount:i};const l=this.getLevelSwitchAction(e,t);return r&&(l.retryConfig=r,l.retryCount=i),l}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),r=t.levels[n],{fragLoadPolicy:i,keyLoadPolicy:s}=t.config,l=zt(e.details.startsWith("key")?s:i,e),c=t.levels.reduce((f,d)=>f+d.fragmentError,0);if(r&&(e.details!==K.FRAG_GAP&&r.fragmentError++,cn(l,c,Bt(e),e.response)))return{action:jt.RetryRequest,flags:en.None,retryConfig:l,retryCount:c};const u=this.getLevelSwitchAction(e,n);return l&&(u.retryConfig=l,u.retryCount=c),u}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const r=this.hls.levels[t];if(r){var i,s;const u=e.details;r.loadError++,u===K.BUFFER_APPEND_ERROR&&r.fragmentError++;let f=-1;const{levels:d,loadLevel:_,minAutoLevel:b,maxAutoLevel:E}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);const Z=(i=e.frag)==null?void 0:i.type,ae=(Z===oe.AUDIO&&u===K.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===K.BUFFER_ADD_CODEC_ERROR||u===K.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:ht})=>r.audioCodec!==ht),ye=e.sourceBufferName==="video"&&(u===K.BUFFER_ADD_CODEC_ERROR||u===K.BUFFER_APPEND_ERROR)&&d.some(({codecSet:ht,audioCodec:Ye})=>r.codecSet!==ht&&r.audioCodec===Ye),{type:$e,groupId:We}=(s=e.context)!=null?s:{};for(let ht=d.length;ht--;){const Ye=(ht+_)%d.length;if(Ye!==_&&Ye>=b&&Ye<=E&&d[Ye].loadError===0){var l,c;const st=d[Ye];if(u===K.FRAG_GAP&&Z===oe.MAIN&&e.frag){const dt=d[Ye].details;if(dt){const Xe=Vt(e.frag,dt.fragments,e.frag.start);if(Xe!=null&&Xe.gap)continue}}else{if($e===he.AUDIO_TRACK&&st.hasAudioGroup(We)||$e===he.SUBTITLE_TRACK&&st.hasSubtitleGroup(We))continue;if(Z===oe.AUDIO&&(l=r.audioGroups)!=null&&l.some(dt=>st.hasAudioGroup(dt))||Z===oe.SUBTITLE&&(c=r.subtitleGroups)!=null&&c.some(dt=>st.hasSubtitleGroup(dt))||ae&&r.audioCodec===st.audioCodec||!ae&&r.audioCodec!==st.audioCodec||ye&&r.codecSet===st.codecSet)continue}f=Ye;break}}if(f>-1&&n.loadLevel!==f)return e.levelRetry=!0,this.playlistError=0,{action:jt.SendAlternateToPenaltyBox,flags:en.None,nextAutoLevel:f}}return{action:jt.SendAlternateToPenaltyBox,flags:en.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case jt.DoNothing:break;case jt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==K.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 jt.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,n=e.errorAction;if(!n)return;const{flags:r,hdcpLevel:i,nextAutoLevel:s}=n;switch(r){case en.None:this.switchLevel(e,s);break;case en.MoveAllAlternatesMatchingHDCP:i&&(t.maxHdcpLevel=ft[ft.indexOf(i)-1],n.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}n.resolved||this.switchLevel(e,s)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===K.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const n=qt(e.mimeType),r=this.hls.levels;for(let i=r.length;i--;)r[i][`${e.sourceBufferName}Codec`]===n&&this.hls.removeLevel(i)}}}function Hn(a){const e={action:jt.DoNothing,flags:en.None};return a&&(e.resolved=!0),e}var Kn={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class jn{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(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.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.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let r=n.length;r--;){const i=n[r];if(!i)break;const s=i.end;if(i.start<=e&&s!==null&&e<=s)return i}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,n){const{fragments:r}=this,i=Object.keys(r);for(let s=i.length;s--;){const l=r[i[s]];if((l==null?void 0:l.body.type)===t&&(!n||l.buffered)){const c=l.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,n,r,i){this.timeRanges&&(this.timeRanges[e]=t);const s=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(l=>{const c=this.fragments[l];if(!c||s>=c.body.sn)return;if(!c.buffered&&(!c.loaded||i)){c.body.type===n&&this.removeFragment(c.body);return}const u=c.range[e];if(u){if(u.time.length===0){this.removeFragment(c.body);return}u.time.some(f=>{const d=!this.isTimeBuffered(f.startPTS,f.endPTS,t);return d&&this.removeFragment(c.body),d})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const n=e.frag,r=Xn(n),i=this.fragments[r];if(!i||i.buffered&&n.gap)return;const s=!n.relurl;Object.keys(t).forEach(l=>{const c=n.elementaryStreams[l];if(!c)return;const u=t[l],f=s||c.partial===!0;i.range[l]=this.getBufferedTimes(n,e.part,f,u)}),i.loaded=null,Object.keys(i.range).length?(i.buffered=!0,(i.body.endList=n.endList||i.body.endList)&&(this.endListFragments[i.body.type]=i),er(i)||this.removeParts(n.sn-1,n.type)):this.removeFragment(i.body)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=_r(n,r=>r.fragment.sn>=e))}fragBuffered(e,t){const n=Xn(e);let r=this.fragments[n];!r&&t&&(r=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,n,r){const i={time:[],partial:n},s=e.start,l=e.end,c=e.minEndPTS||l,u=e.maxStartPTS||s;for(let f=0;f<r.length;f++){const d=r.start(f)-this.bufferPadding,_=r.end(f)+this.bufferPadding;if(u>=d&&c<=_){i.time.push({startPTS:Math.max(s,r.start(f)),endPTS:Math.min(l,r.end(f))});break}else if(s<_&&l>d){const b=Math.max(s,r.start(f)),E=Math.min(l,r.end(f));E>b&&(i.partial=!0,i.time.push({startPTS:b,endPTS:E}))}else if(l<=d)break}return i}getPartialFragment(e){let t=null,n,r,i,s=0;const{bufferPadding:l,fragments:c}=this;return Object.keys(c).forEach(u=>{const f=c[u];f&&er(f)&&(r=f.body.start-l,i=f.body.end+l,e>=r&&e<=i&&(n=Math.min(e-r,i-e),s<=n&&(t=f.body,s=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||er(t))}getState(e){const t=Xn(e),n=this.fragments[t];return n?n.buffered?er(n)?Kn.PARTIAL:Kn.OK:Kn.APPENDING:Kn.NOT_LOADED}isTimeBuffered(e,t,n){let r,i;for(let s=0;s<n.length;s++){if(r=n.start(s)-this.bufferPadding,i=n.end(s)+this.bufferPadding,e>=r&&t<=i)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const n=t.frag,r=t.part?null:t,i=Xn(n);this.fragments[i]={body:n,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:r,timeRanges:i,type:s}=t;if(n.sn==="initSegment")return;const l=n.type;if(r){let u=this.activePartLists[l];u||(this.activePartLists[l]=u=[]),u.push(r)}this.timeRanges=i;const c=i[s];this.detectEvictedFragments(s,c,l,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Xn(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,n=Object.keys(t);if(!e)return n.length>0;for(let r=n.length;r--;){const i=t[n[r]];if((i==null?void 0:i.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,r,i){r&&!this.hasGaps||Object.keys(this.fragments).forEach(s=>{const l=this.fragments[s];if(!l)return;const c=l.body;c.type!==n||r&&!c.gap||c.start<t&&c.end>e&&(l.buffered||i)&&this.removeFragment(c)})}removeFragment(e){const t=Xn(e);e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const r=e.sn;this.activePartLists[e.type]=_r(n,i=>i.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e,t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const n=(e=this.hls)==null||(t=e.latestLevelDetails)==null?void 0:t.partList;n&&n.forEach(r=>r.clearElementaryStreamInfo())}}function er(a){var e,t,n;return a.buffered&&(a.body.gap||((e=a.range.video)==null?void 0:e.partial)||((t=a.range.audio)==null?void 0:t.partial)||((n=a.range.audiovideo)==null?void 0:n.partial))}function Xn(a){return`${a.type}_${a.level}_${a.sn}`}function _r(a,e){return a.filter(t=>{const n=e(t);return n||t.clearElementaryStreamInfo(),n})}var ar={cbc:0,ctr:1};class or{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case ar.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case ar.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 bn(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class Dt{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),n=new Uint32Array(4);for(let r=0;r<4;r++)n[r]=t.getUint32(r*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,r=n[0],i=n[1],s=n[2],l=n[3],c=this.invSubMix,u=c[0],f=c[1],d=c[2],_=c[3],b=new Uint32Array(256);let E=0,Z=0,N=0;for(N=0;N<256;N++)N<128?b[N]=N<<1:b[N]=N<<1^283;for(N=0;N<256;N++){let ae=Z^Z<<1^Z<<2^Z<<3^Z<<4;ae=ae>>>8^ae&255^99,e[E]=ae,t[ae]=E;const Pe=b[E],ye=b[Pe],$e=b[ye];let We=b[ae]*257^ae*16843008;r[E]=We<<24|We>>>8,i[E]=We<<16|We>>>16,s[E]=We<<8|We>>>24,l[E]=We,We=$e*16843009^ye*65537^Pe*257^E*16843008,u[ae]=We<<24|We>>>8,f[ae]=We<<16|We>>>16,d[ae]=We<<8|We>>>24,_[ae]=We,E?(E=Pe^b[b[b[$e^Pe]]],Z^=b[b[Z]]):E=Z=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,r=0;for(;r<t.length&&n;)n=t[r]===this.key[r],r++;if(n)return;this.key=t;const i=this.keySize=t.length;if(i!==4&&i!==6&&i!==8)throw new Error("Invalid aes key size="+i);const s=this.ksRows=(i+6+1)*4;let l,c;const u=this.keySchedule=new Uint32Array(s),f=this.invKeySchedule=new Uint32Array(s),d=this.sBox,_=this.rcon,b=this.invSubMix,E=b[0],Z=b[1],N=b[2],ae=b[3];let Pe,ye;for(l=0;l<s;l++){if(l<i){Pe=u[l]=t[l];continue}ye=Pe,l%i===0?(ye=ye<<8|ye>>>24,ye=d[ye>>>24]<<24|d[ye>>>16&255]<<16|d[ye>>>8&255]<<8|d[ye&255],ye^=_[l/i|0]<<24):i>6&&l%i===4&&(ye=d[ye>>>24]<<24|d[ye>>>16&255]<<16|d[ye>>>8&255]<<8|d[ye&255]),u[l]=Pe=(u[l-i]^ye)>>>0}for(c=0;c<s;c++)l=s-c,c&3?ye=u[l]:ye=u[l-4],c<4||l<=4?f[c]=ye:f[c]=E[d[ye>>>24]]^Z[d[ye>>>16&255]]^N[d[ye>>>8&255]]^ae[d[ye&255]],f[c]=f[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const r=this.keySize+6,i=this.invKeySchedule,s=this.invSBox,l=this.invSubMix,c=l[0],u=l[1],f=l[2],d=l[3],_=this.uint8ArrayToUint32Array_(n);let b=_[0],E=_[1],Z=_[2],N=_[3];const ae=new Int32Array(e),Pe=new Int32Array(ae.length);let ye,$e,We,ht,Ye,st,dt,Xe,$t,pn,Vn,Dn,Cn,gn;const kn=this.networkToHostOrderSwap;for(;t<ae.length;){for($t=kn(ae[t]),pn=kn(ae[t+1]),Vn=kn(ae[t+2]),Dn=kn(ae[t+3]),Ye=$t^i[0],st=Dn^i[1],dt=Vn^i[2],Xe=pn^i[3],Cn=4,gn=1;gn<r;gn++)ye=c[Ye>>>24]^u[st>>16&255]^f[dt>>8&255]^d[Xe&255]^i[Cn],$e=c[st>>>24]^u[dt>>16&255]^f[Xe>>8&255]^d[Ye&255]^i[Cn+1],We=c[dt>>>24]^u[Xe>>16&255]^f[Ye>>8&255]^d[st&255]^i[Cn+2],ht=c[Xe>>>24]^u[Ye>>16&255]^f[st>>8&255]^d[dt&255]^i[Cn+3],Ye=ye,st=$e,dt=We,Xe=ht,Cn=Cn+4;ye=s[Ye>>>24]<<24^s[st>>16&255]<<16^s[dt>>8&255]<<8^s[Xe&255]^i[Cn],$e=s[st>>>24]<<24^s[dt>>16&255]<<16^s[Xe>>8&255]<<8^s[Ye&255]^i[Cn+1],We=s[dt>>>24]<<24^s[Xe>>16&255]<<16^s[Ye>>8&255]<<8^s[st&255]^i[Cn+2],ht=s[Xe>>>24]<<24^s[Ye>>16&255]<<16^s[st>>8&255]<<8^s[dt&255]^i[Cn+3],Pe[t]=kn(ye^b),Pe[t+1]=kn(ht^E),Pe[t+2]=kn(We^Z),Pe[t+3]=kn($e^N),b=$t,E=pn,Z=Vn,N=Dn,t=t+4}return Pe.buffer}}class wt{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){const e=Xt(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function Xt(a){switch(a){case ar.cbc:return"AES-CBC";case ar.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const Jt=16;class xn{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(n){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?bn(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n,r){return this.useSoftware?new Promise((i,s)=>{const l=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(l,t,n,r);const c=this.flush();c?i(c.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n,r)}softwareDecrypt(e,t,n,r){const{currentIV:i,currentResult:s,remainderData:l}=this;if(r!==ar.cbc||t.byteLength!==16)return J.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),l&&(e=Ce(l,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;i&&(n=i);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new Dt),u.expandKey(t);const f=s;return this.currentResult=u.decrypt(c.buffer,0,n),this.currentIV=c.slice(-16).buffer,f||null}webCryptoDecrypt(e,t,n,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,r));this.key=t,this.fastAesKey=new wt(this.subtle,t,r)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new or(this.subtle,new Uint8Array(n),r).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(J.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,n,r)))}onWebCryptoError(e,t,n,r){const i=this.enableSoftwareAES;if(i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,r);const s=this.flush();if(s)return s.buffer}throw new Error("WebCrypto"+(i?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%Jt;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&(J.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Yn=Math.pow(2,17);class tr{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const n=e.url;if(!n)return Promise.reject(new An({type:le.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,i=r.fLoader,s=r.loader;return new Promise((l,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(E=>E[0]==="GAP")){c(wn(e));return}else e.gap=!1;const u=this.loader=i?new i(r):new s(r),f=on(e);e.loader=u;const d=un(r.fragLoadPolicy.default),_={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Yn};e.stats=u.stats;const b={onSuccess:(E,Z,N,ae)=>{this.resetLoader(e,u);let Pe=E.data;N.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(Pe.slice(0,16)),Pe=Pe.slice(16)),l({frag:e,part:null,payload:Pe,networkDetails:ae})},onError:(E,Z,N,ae)=>{this.resetLoader(e,u),c(new An({type:le.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:y({url:n,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:N,stats:ae}))},onAbort:(E,Z,N)=>{this.resetLoader(e,u),c(new An({type:le.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:N,stats:E}))},onTimeout:(E,Z,N)=>{this.resetLoader(e,u),c(new An({type:le.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${_.timeout}ms`),networkDetails:N,stats:E}))}};t&&(b.onProgress=(E,Z,N,ae)=>t({frag:e,part:null,payload:N,networkDetails:ae})),u.load(f,_,b)})}loadPart(e,t,n){this.abort();const r=this.config,i=r.fLoader,s=r.loader;return new Promise((l,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(wn(e,t));return}const u=this.loader=i?new i(r):new s(r),f=on(e,t);e.loader=u;const d=un(r.fragLoadPolicy.default),_={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Yn};t.stats=u.stats,u.load(f,_,{onSuccess:(b,E,Z,N)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const ae={frag:e,part:t,payload:b.data,networkDetails:N};n(ae),l(ae)},onError:(b,E,Z,N)=>{this.resetLoader(e,u),c(new An({type:le.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:y({url:f.url,data:void 0},b),error:new Error(`HTTP Error ${b.code} ${b.text}`),networkDetails:Z,stats:N}))},onAbort:(b,E,Z)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new An({type:le.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:Z,stats:b}))},onTimeout:(b,E,Z)=>{this.resetLoader(e,u),c(new An({type:le.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${_.timeout}ms`),networkDetails:Z,stats:b}))}})})}updateStatsFromPart(e,t){const n=e.stats,r=t.stats,i=r.total;if(n.loaded+=r.loaded,i){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(n.loaded/i),c),d=(c-u)*Math.round(n.loaded/u);n.total=n.loaded+d}else n.total=Math.max(n.loaded,n.total);const s=n.loading,l=r.loading;s.start?s.first+=l.first-l.start:(s.start=l.start,s.first=l.first),s.end=l.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function on(a,e=null){const t=e||a,n={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,i=t.byteRangeEndOffset;if(k(r)&&k(i)){var s;let l=r,c=i;if(a.sn==="initSegment"&&Bn((s=a.decryptdata)==null?void 0:s.method)){const u=i-r;u%16&&(c=i+(16-u%16)),r!==0&&(n.resetIV=!0,l=r-16)}n.rangeStart=l,n.rangeEnd=c}return n}function wn(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),n={type:le.MEDIA_ERROR,details:K.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(n.part=e),(e||a).stats.aborted=!0,new An(n)}function Bn(a){return a==="AES-128"||a==="AES-256"}class An extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class dr extends G{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 Tn{constructor(e,t,n,r=0,i=-1,s=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=zn(),this.buffering={audio:zn(),video:zn(),audiovideo:zn()},this.level=e,this.sn=t,this.id=n,this.size=r,this.part=i,this.partial=s}}function zn(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Jn={length:0,start:()=>0,end:()=>0};class dn{static isBuffered(e,t){if(e){const n=dn.getBuffered(e);for(let r=n.length;r--;)if(t>=n.start(r)&&t<=n.end(r))return!0}return!1}static bufferedRanges(e){if(e){const t=dn.getBuffered(e);return dn.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(e,t,n){if(e){const r=dn.bufferedRanges(e);if(r.length)return dn.bufferedInfo(r,t,n)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort((f,d)=>f.start-d.start||d.end-f.end);let r=-1,i=[];if(n)for(let f=0;f<e.length;f++){t>=e[f].start&&t<=e[f].end&&(r=f);const d=i.length;if(d){const _=i[d-1].end;e[f].start-_<n?e[f].end>_&&(i[d-1].end=e[f].end):i.push(e[f])}else i.push(e[f])}else i=e;let s=0,l,c=t,u=t;for(let f=0;f<i.length;f++){const d=i[f].start,_=i[f].end;if(r===-1&&t>=d&&t<=_&&(r=f),t+n>=d&&t<_)c=d,u=_,s=u-t;else if(t+n<d){l=d;break}}return{len:s,start:c||0,end:u||0,nextStart:l,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||Jn}catch(t){return J.log("failed to get media.buffered",t),Jn}}}const nr=/\{\$([a-zA-Z0-9-_]+)\}/g;function gr(a){return nr.test(a)}function cr(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(nr,n=>{const r=n.substring(2,n.length-1),i=t==null?void 0:t[r];return i===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),n):i})}return e}function xr(a,e,t){let n=a.variableList;n||(a.variableList=n={});let r,i;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const s=new self.URL(t).searchParams;if(s.has(r))i=s.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(s){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${s.message}`))}}else r=e.NAME,i=e.VALUE;r in n?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):n[r]=i||""}function Cr(a,e,t){const n=e.IMPORT;if(t&&n in t){let r=a.variableList;r||(a.variableList=r={}),r[n]=t[n]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}const Ir=/^(\d+)x(\d+)$/,Er=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Gn{constructor(e,t){typeof e=="string"&&(e=Gn.parseAttrList(e,t)),h(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const n=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)n[r]=parseInt(t.slice(r*2,r*2+2),16);return n}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((r,i)=>(r[i.toLowerCase()]=!0,r),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Ir.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n;const r={},i='"';for(Er.lastIndex=0;(n=Er.exec(e))!==null;){const s=n[1].trim();let l=n[2];const c=l.indexOf(i)===0&&l.lastIndexOf(i)===l.length-1;let u=!1;if(c)l=l.slice(1,-1);else switch(s){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(c||u))l=cr(t,l);else if(!u&&!c)switch(s){case"CLOSED-CAPTIONS":if(l==="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":J.warn(`${e}: attribute ${s} is missing quotes`)}r[s]=l}return r}}const zr="com.apple.hls.interstitial";function Or(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function Wr(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class wr{constructor(e,t,n=0){var r;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(r=t==null?void 0:t.tagOrder)!=null?r:n,t){const i=t.attr;for(const s in i)if(Object.prototype.hasOwnProperty.call(e,s)&&e[s]!==i[s]){J.warn(`DATERANGE tag attribute: "${s}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=s;break}e=h(new Gn({}),i,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);k(i.getTime())&&(this._endDate=i)}}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?(J.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(k(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===zr}get isValid(){return!!this.id&&!this._badValueForSameId&&k(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const ai=10;class ti{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}get hasProgramDateTime(){return this.fragments.length?k(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||ai}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let n=e.length;n--;)if(e[n].index>t)return e[n].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Mr(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function Hr(a){switch(a){case"AES-128":case"AES-256":return ar.cbc;case"AES-256-CTR":return ar.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function Kr(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Ur(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function Ar(a){const e=Ur(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Fr(a){const e=function(n,r,i){const s=n[r];n[r]=n[i],n[i]=s};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function Gr(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),r=n[n.length-1].split(",");if(r.length===2){const i=r[0]==="base64",s=r[1];i?(n.splice(-1,1),t=Kr(s)):t=Ar(s)}}return t}const lr=typeof self!="undefined"?self:void 0;var On={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},hr={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Sn(a){switch(a){case hr.FAIRPLAY:return On.FAIRPLAY;case hr.PLAYREADY:return On.PLAYREADY;case hr.WIDEVINE:return On.WIDEVINE;case hr.CLEARKEY:return On.CLEARKEY}}var Un={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Pn(a){if(a===Un.WIDEVINE)return On.WIDEVINE;if(a===Un.PLAYREADY)return On.PLAYREADY;if(a===Un.CENC||a===Un.CLEARKEY)return On.CLEARKEY}function Mn(a){switch(a){case On.FAIRPLAY:return hr.FAIRPLAY;case On.PLAYREADY:return hr.PLAYREADY;case On.WIDEVINE:return hr.WIDEVINE;case On.CLEARKEY:return hr.CLEARKEY}}function ur(a){const{drmSystems:e,widevineLicenseUrl:t}=a,n=e?[On.FAIRPLAY,On.WIDEVINE,On.PLAYREADY,On.CLEARKEY].filter(r=>!!e[r]):[];return!n[On.WIDEVINE]&&t&&n.push(On.WIDEVINE),n}const yr=function(a){return lr!=null&&(a=lr.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function vn(a,e,t,n){let r;switch(a){case On.FAIRPLAY:r=["cenc","sinf"];break;case On.WIDEVINE:case On.PLAYREADY:r=["cenc"];break;case On.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return Ln(r,e,t,n)}function Ln(a,e,t,n){return[{initDataTypes:a,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(i=>({contentType:`audio/mp4; codecs=${i}`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(i=>({contentType:`video/mp4; codecs=${i}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function pr(a){var e;return a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function rr(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),n=t.substring(t.indexOf("<"),t.length),s=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(s){const l=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(l){const c=Kr(l).subarray(0,16);return Fr(c),c}}return null}let mr={};class Nr{static clearKeyUriToKeyIdMap(){mr={}}constructor(e,t,n,r=[1],i=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=n,this.keyFormatVersions=r,this.iv=i,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Mr(e)}isSupported(){if(this.method){if(Mr(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case hr.FAIRPLAY:case hr.WIDEVINE:case hr.PLAYREADY:case hr.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(Mr(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(J.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const n=fi(e);return new Nr(this.method,this.uri,"identity",this.keyFormatVersions,n)}const t=Gr(this.uri);if(t)switch(this.keyFormat){case hr.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case hr.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=xt(n,null,t),this.keyId=rr(t);break}default:{let n=t.subarray(0,16);if(n.length!==16){const r=new Uint8Array(16);r.set(n,16-n.length),n=r}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n=mr[this.uri];if(!n){const r=Object.keys(mr).length%Number.MAX_SAFE_INTEGER;n=new Uint8Array(16),new DataView(n.buffer,12,4).setUint32(0,r),mr[this.uri]=n}this.keyId=n}return this}}function fi(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const Vr=/#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,Qr=/#EXT-X-MEDIA:(.*)/g,oi=/^#EXT(?:INF|-X-TARGETDURATION):/m,Si=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),cs=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 ni{static findGroup(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r.id===t)return r}}static resolve(e,t){return j.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return oi.test(e)}static parseMasterPlaylist(e,t){const n=gr(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},i=[];Vr.lastIndex=0;let s;for(;(s=Vr.exec(e))!=null;)if(s[1]){var l;const u=new Gn(s[1],r),f=cr(r,s[2]),d={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:ni.resolve(f,t)},_=u.decimalResolution("RESOLUTION");_&&(d.width=_.width,d.height=_.height),ki(u.CODECS,d);const b=u["SUPPLEMENTAL-CODECS"];b&&(d.supplemental={},ki(b,d.supplemental)),(l=d.unknownCodecs)!=null&&l.length||i.push(d),r.levels.push(d)}else if(s[3]){const u=s[3],f=s[4];switch(u){case"SESSION-DATA":{const d=new Gn(f,r),_=d["DATA-ID"];_&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[_]=d);break}case"SESSION-KEY":{const d=Ai(f,t,r);d.encrypted&&d.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(d)):J.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${f}"`);break}case"DEFINE":{{const d=new Gn(f,r);xr(r,d,t)}break}case"CONTENT-STEERING":{const d=new Gn(f,r);r.contentSteering={uri:ni.resolve(d["SERVER-URI"],t),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=Ji(f);break}}}const c=i.length>0&&i.length<r.levels.length;return r.levels=c?i:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,n){let r;const i={},s=n.levels,l={AUDIO:s.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:s.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(Qr.lastIndex=0;(r=Qr.exec(e))!==null;){const u=new Gn(r[1],n),f=u.TYPE;if(f){const d=l[f],_=i[f]||[];i[f]=_;const b=u.LANGUAGE,E=u["ASSOC-LANGUAGE"],Z=u.CHANNELS,N=u.CHARACTERISTICS,ae=u["INSTREAM-ID"],Pe={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||b||"",type:f,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:b,url:u.URI?ni.resolve(u.URI,t):""};if(E&&(Pe.assocLang=E),Z&&(Pe.channels=Z),N&&(Pe.characteristics=N),ae&&(Pe.instreamId=ae),d!=null&&d.length){const ye=ni.findGroup(d,Pe.groupId)||d[0];di(Pe,ye,"audioCodec"),di(Pe,ye,"textCodec")}_.push(Pe)}}return i}static parseLevelPlaylist(e,t,n,r,i,s){var l;const c={url:t},u=new ti(t),f=u.fragments,d=[];let _=null,b=0,E=0,Z=0,N=0,ae=0,Pe=null,ye=new Be(r,c),$e,We,ht,Ye=-1,st=!1,dt=null,Xe;if(Si.lastIndex=0,u.m3u8=e,u.hasVariableRefs=gr(e),((l=Si.exec(e))==null?void 0:l[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;($e=Si.exec(e))!==null;){st&&(st=!1,ye=new Be(r,c),ye.playlistOffset=Z,ye.start=Z,ye.sn=b,ye.cc=N,ae&&(ye.bitrate=ae),ye.level=n,_&&(ye.initSegment=_,_.rawProgramDateTime&&(ye.rawProgramDateTime=_.rawProgramDateTime,_.rawProgramDateTime=null),dt&&(ye.setByteRange(dt),dt=null)));const Dn=$e[1];if(Dn){ye.duration=parseFloat(Dn);const Cn=(" "+$e[2]).slice(1);ye.title=Cn||null,ye.tagList.push(Cn?["INF",Dn,Cn]:["INF",Dn])}else if($e[3]){if(k(ye.duration)){ye.playlistOffset=Z,ye.start=Z,ht&&Oi(ye,ht,u),ye.sn=b,ye.level=n,ye.cc=N,f.push(ye);const Cn=(" "+$e[3]).slice(1);ye.relurl=cr(u,Cn),Pi(ye,Pe,d),Pe=ye,Z+=ye.duration,b++,E=0,st=!0}}else{if($e=$e[0].match(cs),!$e){J.warn("No matches on slow regex match for level playlist!");continue}for(We=1;We<$e.length&&$e[We]===void 0;We++);const Cn=(" "+$e[We]).slice(1),gn=(" "+$e[We+1]).slice(1),kn=$e[We+2]?(" "+$e[We+2]).slice(1):null;switch(Cn){case"BYTERANGE":Pe?ye.setByteRange(gn,Pe):ye.setByteRange(gn);break;case"PROGRAM-DATE-TIME":ye.rawProgramDateTime=gn,ye.tagList.push(["PROGRAM-DATE-TIME",gn]),Ye===-1&&(Ye=f.length);break;case"PLAYLIST-TYPE":u.type&&li(u,Cn,$e),u.type=gn.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?li(u,Cn,$e):f.length>0&&Mi(u,Cn,$e),b=u.startSN=parseInt(gn);break;case"SKIP":{u.skippedSegments&&li(u,Cn,$e);const Fn=new Gn(gn,u),Ht=Fn.decimalInteger("SKIPPED-SEGMENTS");if(k(Ht)){u.skippedSegments+=Ht;for(let sr=Ht;sr--;)f.push(null);b+=Ht}const nn=Fn.enumeratedString("RECENTLY-REMOVED-DATERANGES");nn&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(nn.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&li(u,Cn,$e),u.targetduration=Math.max(parseInt(gn),1);break;case"VERSION":u.version!==null&&li(u,Cn,$e),u.version=parseInt(gn);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||li(u,Cn,$e),u.live=!1;break;case"#":(gn||kn)&&ye.tagList.push(kn?[gn,kn]:[gn]);break;case"DISCONTINUITY":N++,ye.tagList.push(["DIS"]);break;case"GAP":ye.gap=!0,ye.tagList.push([Cn]);break;case"BITRATE":ye.tagList.push([Cn,gn]),ae=parseInt(gn)*1e3,k(ae)?ye.bitrate=ae:ae=0;break;case"DATERANGE":{const Fn=new Gn(gn,u),Ht=new wr(Fn,u.dateRanges[Fn.ID],u.dateRangeTagCount);u.dateRangeTagCount++,Ht.isValid||u.skippedSegments?u.dateRanges[Ht.id]=Ht:J.warn(`Ignoring invalid DATERANGE tag: "${gn}"`),ye.tagList.push(["EXT-X-DATERANGE",gn]);break}case"DEFINE":{{const Fn=new Gn(gn,u);"IMPORT"in Fn?Cr(u,Fn,s):xr(u,Fn,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?li(u,Cn,$e):f.length>0&&Mi(u,Cn,$e),u.startCC=N=parseInt(gn);break;case"KEY":{const Fn=Ai(gn,t,u);if(Fn.isSupported()){if(Fn.method==="NONE"){ht=void 0;break}ht||(ht={}),ht[Fn.keyFormat]&&(ht=h({},ht)),ht[Fn.keyFormat]=Fn}else J.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${gn}"`);break}case"START":u.startTimeOffset=Ji(gn);break;case"MAP":{const Fn=new Gn(gn,u);if(ye.duration){const Ht=new Be(r,c);Vi(Ht,Fn,n,ht),_=Ht,ye.initSegment=_,_.rawProgramDateTime&&!ye.rawProgramDateTime&&(ye.rawProgramDateTime=_.rawProgramDateTime)}else{const Ht=ye.byteRangeEndOffset;if(Ht){const nn=ye.byteRangeStartOffset;dt=`${Ht-nn}@${nn}`}else dt=null;Vi(ye,Fn,n,ht),_=ye,st=!0}_.cc=N;break}case"SERVER-CONTROL":{Xe&&li(u,Cn,$e),Xe=new Gn(gn),u.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),u.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&li(u,Cn,$e);const Fn=new Gn(gn);u.partTarget=Fn.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Fn=u.partList;Fn||(Fn=u.partList=[]);const Ht=E>0?Fn[Fn.length-1]:void 0,nn=E++,sr=new Gn(gn,u),qn=new Ge(sr,ye,c,nn,Ht);Fn.push(qn),ye.duration+=qn.duration;break}case"PRELOAD-HINT":{const Fn=new Gn(gn,u);u.preloadHint=Fn;break}case"RENDITION-REPORT":{const Fn=new Gn(gn,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(Fn);break}default:J.warn(`line parsed but not handled: ${$e}`);break}}}Pe&&!Pe.relurl?(f.pop(),Z-=Pe.duration,u.partList&&(u.fragmentHint=Pe)):u.partList&&(Pi(ye,Pe,d),ye.cc=N,u.fragmentHint=ye,ht&&Oi(ye,ht,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const $t=f.length,pn=f[0],Vn=f[$t-1];if(Z+=u.skippedSegments*u.targetduration,Z>0&&$t&&Vn){u.averagetargetduration=Z/$t;const Dn=Vn.sn;u.endSN=Dn!=="initSegment"?Dn:0,u.live||(Vn.endList=!0),pn&&u.startCC===void 0&&(u.startCC=pn.cc),Ye>0&&(Gi(f,Ye),pn&&d.unshift(pn))}else u.endSN=0,u.startCC=0;return u.fragmentHint&&(Z+=u.fragmentHint.duration),u.totalduration=Z,d.length&&u.dateRangeTagCount&&pn&&_i(d,u),u.endCC=N,u}}function _i(a,e){const t=a.length;if(!t)return;const n=a[t-1],r=e.live?1/0:e.totalduration,i=Object.keys(e.dateRanges);for(let s=i.length;s--;){const l=e.dateRanges[i[s]],c=l.startDate.getTime();l.tagAnchor=n.ref;for(let u=t;u--;){const f=Qi(e,c,a,u,r);if(f!==-1){l.tagAnchor=e.fragments[f].ref;break}}}}function Qi(a,e,t,n,r){const i=t[n];if(i){const l=i.programDateTime;if(e>=l||n===0){var s;const c=(((s=t[n+1])==null?void 0:s.start)||r)-i.start;if(e<=l+c*1e3){const u=t[n].sn-a.startSN,f=a.fragments;if(f.length>t.length){const _=(t[n+1]||f[f.length-1]).sn-a.startSN;for(let b=_;b>u;b--){const E=f[b].programDateTime;if(e>=E&&e<E+f[b].duration*1e3)return b}}return u}}}return-1}function Ai(a,e,t){var n,r;const i=new Gn(a,t),s=(n=i.METHOD)!=null?n:"",l=i.URI,c=i.hexadecimalInteger("IV"),u=i.KEYFORMATVERSIONS,f=(r=i.KEYFORMAT)!=null?r:"identity";l&&i.IV&&!c&&J.error(`Invalid IV: ${i.IV}`);const d=l?ni.resolve(l,e):"",_=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Nr(s,d,f,_,c)}function Ji(a){const t=new Gn(a).decimalFloatingPoint("TIME-OFFSET");return k(t)?t:null}function ki(a,e){let t=(a||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const r=t.filter(i=>Ut(i,n));r.length&&(e[`${n}Codec`]=r.map(i=>i.split("/")[0]).join(","),t=t.filter(i=>r.indexOf(i)===-1))}),e.unknownCodecs=t}function di(a,e,t){const n=e[t];n&&(a[t]=n)}function Gi(a,e){let t=a[e];for(let n=e;n--;){const r=a[n];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function Pi(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function Vi(a,e,t,n){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",n&&(a.levelkeys=n),a.initSegment=null}function Oi(a,e,t){a.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&n.push(a)}function li(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Mi(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function zi(a,e){const t=e.startPTS;if(k(t)){let n=0,r;e.sn>a.sn?(n=t-a.start,r=a):(n=a.start-t,r=e),r.duration!==n&&r.setDuration(n)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.setStart(a.start+(a.minEndPTS-a.start)):e.setStart(a.start+a.duration):e.setStart(Math.max(a.start-e.duration,0))}function qi(a,e,t,n,r,i){n-t<=0&&(J.warn("Fragment should have a positive duration",e),n=t+e.duration,i=r+e.duration);let l=t,c=n;const u=e.startPTS,f=e.endPTS;if(k(u)){const N=Math.abs(u-t);k(e.deltaPTS)?e.deltaPTS=Math.max(N,e.deltaPTS):e.deltaPTS=N,l=Math.max(t,u),t=Math.min(t,u),r=Math.min(r,e.startDTS),c=Math.min(n,f),n=Math.max(n,f),i=Math.max(i,e.endDTS)}const d=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(n-e.start),e.startPTS=t,e.maxStartPTS=l,e.startDTS=r,e.endPTS=n,e.minEndPTS=c,e.endDTS=i;const _=e.sn;if(!a||_<a.startSN||_>a.endSN)return 0;let b;const E=_-a.startSN,Z=a.fragments;for(Z[E]=e,b=E;b>0;b--)zi(Z[b],Z[b-1]);for(b=E;b<Z.length-1;b++)zi(Z[b],Z[b+1]);return a.fragmentHint&&zi(Z[Z.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,d}function fs(a,e){if(a===e)return;let t=null;const n=a.fragments;for(let u=n.length-1;u>=0;u--){const f=n[u].initSegment;if(f){t=f;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let r;yi(a,e,(u,f,d,_)=>{if((!e.startCC||e.skippedSegments)&&f.cc!==u.cc){const b=u.cc-f.cc;for(let E=d;E<_.length;E++)_[E].cc+=b;e.endCC=_[_.length-1].cc}k(u.startPTS)&&k(u.endPTS)&&(f.setStart(f.startPTS=u.startPTS),f.startDTS=u.startDTS,f.maxStartPTS=u.maxStartPTS,f.endPTS=u.endPTS,f.endDTS=u.endDTS,f.minEndPTS=u.minEndPTS,f.setDuration(u.endPTS-u.startPTS),f.duration&&(r=f),e.PTSKnown=e.alignedSliding=!0),u.hasStreams&&(f.elementaryStreams=u.elementaryStreams),f.loader=u.loader,u.hasStats&&(f.stats=u.stats),u.initSegment&&(f.initSegment=u.initSegment,t=u.initSegment)});const i=e.fragments,s=e.fragmentHint?i.concat(e.fragmentHint):i;if(t&&s.forEach(u=>{var f;u&&(!u.initSegment||u.initSegment.relurl===((f=t)==null?void 0:f.relurl))&&(u.initSegment=t)}),e.skippedSegments){if(e.deltaUpdateFailed=i.some(u=>!u),e.deltaUpdateFailed){J.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let u=e.skippedSegments;u--;)i.shift();e.startSN=i[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=ds(a.dateRanges,e));const u=a.fragments.filter(f=>f.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let f=1;f<s.length;f++)s[f].programDateTime===null&&Pi(s[f],s[f-1],u);_i(u,e)}e.endCC=i[i.length-1].cc}if(!e.startCC){var l;const u=Lr(a,e.startSN-1);e.startCC=(l=u==null?void 0:u.cc)!=null?l:i[0].cc}Wi(a.partList,e.partList,(u,f)=>{f.elementaryStreams=u.elementaryStreams,f.stats=u.stats}),r?qi(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):ir(a,e),i.length&&(e.totalduration=e.edge-i[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const c=e.advancedDateTime;if(e.advanced&&c){const u=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=u),e.driftEndTime=c,e.driftEnd=u}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function ds(a,e){const{dateRanges:t,recentlyRemovedDateranges:n}=e,r=h({},a);n&&n.forEach(l=>{delete r[l]});const s=Object.keys(r).length;return s&&Object.keys(t).forEach(l=>{const c=r[l],u=new wr(t[l].attr,c);u.isValid?(r[l]=u,c||(u.tagOrder+=s)):J.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Mt(t[l].attr)}"`)}),r}function Wi(a,e,t){if(a&&e){let n=0;for(let r=0,i=a.length;r<=i;r++){const s=a[r],l=e[r+n];s&&l&&s.index===l.index&&s.fragment.sn===l.fragment.sn?t(s,l):n--}}}function yi(a,e,t){const n=e.skippedSegments,r=Math.max(a.startSN,e.startSN)-e.startSN,i=(a.fragmentHint?1:0)+(n?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,s=e.startSN-a.startSN,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let u=r;u<=i;u++){const f=c[s+u];let d=l[u];if(n&&!d&&f&&(d=e.fragments[u]=f),f&&d){if(t(f,d,u,l),f.url&&f.url!==d.url){e.playlistParsingError=fr(`media sequence mismatch ${d.sn}:`,a,e,f,d);return}else if(f.cc!==d.cc){e.playlistParsingError=fr(`discontinuity sequence mismatch (${f.cc}!=${d.cc})`,a,e,f,d);return}}}}function fr(a,e,t,n,r){return new Error(`${a} ${r.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function ir(a,e,t=!0){const n=e.startSN+e.skippedSegments-a.startSN,r=a.fragments,i=n>=0;let s=0;if(i&&n<r.length)s=r[n].start;else if(i&&e.startSN===a.endSN+1)s=a.fragmentEnd;else if(i&&t)s=a.fragmentStart+n*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)s=a.fragmentStart;else return;Br(e,s)}function Br(a,e){if(e){const t=a.fragments;for(let n=a.skippedSegments;n<t.length;n++)t[n].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function $r(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const n=a.fragments;if(n.length&&t*4>e){const i=n[n.length-1].duration*1e3;i<t&&(t=i)}}else t/=2;return Math.round(t)}function Lr(a,e,t){if(!a)return null;let n=a.fragments[e-a.startSN];return n||(n=a.fragmentHint,n&&n.sn===e)?n:e<a.startSN&&t&&t.sn===e?t:null}function kr(a,e,t){return a?ri(a.partList,e,t):null}function ri(a,e,t){if(a)for(let n=a.length;n--;){const r=a[n];if(r.index===t&&r.fragment.sn===e)return r}return null}function Jr(a){a.forEach((e,t)=>{var n;(n=e.details)==null||n.fragments.forEach(r=>{r.level=t,r.initSegment&&(r.initSegment.level=t)})})}function qr(a,e){for(let n=0,r=a.length;n<r;n++){var t;if(((t=a[n])==null?void 0:t.cc)===e)return a[n]}return null}function Ei(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function hi(a,e){if(a){const t=a.start+e;a.start=a.startPTS=t,a.endPTS=t+a.duration}}function Di(a,e){const t=e.fragments;for(let n=0,r=t.length;n<r;n++)hi(t[n],a);e.fragmentHint&&hi(e.fragmentHint,a),e.alignedSliding=!0}function Fi(a,e){a&&(xs(e,a),!e.alignedSliding&&a&&es(e,a),!e.alignedSliding&&a&&!e.skippedSegments&&ir(a,e,!1))}function xs(a,e){if(!Ei(e,a))return;const t=Math.min(e.endCC,a.endCC),n=qr(e.fragments,t),r=qr(a.fragments,t);if(!n||!r)return;J.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const i=n.start-r.start;Di(i,a)}function es(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,n=e.fragments;if(!t.length||!n.length)return;let r,i;const s=Math.min(e.endCC,a.endCC);e.startCC<s&&a.startCC<s&&(r=qr(n,s),i=qr(t,s)),(!r||!i)&&(r=n[Math.floor(n.length/2)],i=qr(t,r.cc)||t[Math.floor(t.length/2)]);const l=r.programDateTime,c=i.programDateTime;if(!l||!c)return;const u=(c-l)/1e3-(i.start-r.start);Di(u,a)}const Pr={toString:function(a){let e="";const t=a.length;for(let n=0;n<t;n++)e+=`[${a.start(n).toFixed(3)}-${a.end(n).toFixed(3)}]`;return e}},ct={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 dr{constructor(e,t,n,r,i){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=ct.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:s,fragCurrent:l,media:c,mediaBuffer:u,state:f}=this,d=c?c.currentTime:0,_=dn.bufferInfo(u||c,d,s.maxBufferHole);if(this.log(`media seeking to ${k(d)?d.toFixed(3):d}, state: ${f}`),this.state===ct.ENDED)this.resetLoadingState();else if(l){const b=s.maxFragLookUpTolerance,E=l.start-b,Z=l.start+l.duration+b;if(!_.len||Z<_.start||E>_.end){const N=d>Z;(d<E||N)&&(N&&l.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),l.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(d,1/0,this.playlistType,!0);const b=this.lastCurrentTime;if(d>b&&(this.lastCurrentTime=d),!this.loadingParts){const E=Math.max(_.end,d),Z=this.shouldLoadParts(this.getLevelDetails(),E);Z&&(this.log(`LL-Part loading ON after seeking to ${d.toFixed(2)} with buffer @${E.toFixed(2)}`),this.loadingParts=Z)}}!this.hls.hasEnoughToStart&&!_.len&&(this.log(`setting startPosition to ${d} because of seek before start`),this.nextLoadPosition=this.startPosition=d),this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=i,this.hls=e,this.fragmentLoader=new tr(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new xn(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===ct.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=ct.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const n=e.end||0,r=this.config.timelineOffset||0;if(n<=r)return!1;const i=e.buffered;this.config.maxBufferHole&&i&&i.length>1&&(e=dn.bufferedInfo(i,e.start,0));const s=e.nextStart;if(s&&s>r&&s<t.edge||this.media.currentTime<e.start)return!1;const c=t.partList;if(c!=null&&c.length){const f=c[c.length-1];return dn.isBuffered(this.media,f.start+f.duration/2)}const u=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;n.removeEventListener("seeking",this.onMediaSeeking),n.removeEventListener("ended",this.onMediaEnded),n.addEventListener("seeking",this.onMediaSeeking),n.addEventListener("ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===ct.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){const n=!!t.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),r.removeEventListener("seeking",this.onMediaSeeking),r.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=ct.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const r=i=>{const s=i.frag;if(this.fragContextChanged(s)){this.warn(`${s.type} sn: ${s.sn}${i.part?" part: "+i.part.index:""} of ${this.fragInfo(s,!1,i.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(s);return}s.stats.chunkCount++,this._handleFragmentLoadProgress(i)};this._doFragLoad(e,t,n,r).then(i=>{if(!i)return;const s=this.state,l=i.frag;if(this.fragContextChanged(l)){(s===ct.FRAG_LOADING||!this.fragCurrent&&s===ct.PARSING)&&(this.fragmentTracker.removeFragment(l),this.state=ct.IDLE);return}"payload"in i&&(this.log(`Loaded ${l.type} sn: ${l.sn} of ${this.playlistLabel()} ${l.level}`),this.hls.trigger(p.FRAG_LOADED,i)),this._handleFragmentLoadComplete(i)}).catch(i=>{this.state===ct.STOPPED||this.state===ct.ERROR||(this.warn(`Frag error: ${(i==null?void 0:i.message)||i}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===Kn.APPENDING){const i=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,i),l=Math.max(e.duration,s?s.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(l,e.duration))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===Kn.PARTIAL&&n.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,n=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:n};this.hls.trigger(p.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{const r=n==null?void 0:n.frag;if(!r||this.fragContextChanged(r)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:r}=this,{frag:i,payload:s}=n,l=i.decryptdata;if(s&&s.byteLength>0&&l!=null&&l.key&&l.iv&&Mr(l.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),l.key.buffer,l.iv.buffer,Hr(l.method)).catch(u=>{throw r.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:i}),u}).then(u=>{const f=self.performance.now();return r.trigger(p.FRAG_DECRYPTED,{frag:i,payload:u,stats:{tstart:c,tdecrypt:f}}),n.payload=u,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===ct.STOPPED||this.state===ct.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state!==ct.STOPPED&&(this.state=ct.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${n?Pr.toString(dn.getBuffered(n)):"(detached)"})`),te(e)){var r;if(e.type!==oe.SUBTITLE){const s=e.elementaryStreams;if(!Object.keys(s).some(l=>!!s[l])){this.state=ct.IDLE;return}}const i=(r=this.levels)==null?void 0:r[e.level];i!=null&&i.fragmentError&&(this.log(`Resetting level fragment error count of ${i.fragmentError} on frag buffered`),i.fragmentError=0)}this.state=ct.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:n,part:r,partsLoaded:i}=e,s=!i||i.length===0||i.some(c=>!c),l=new Tn(n.level,n.sn,n.stats.chunkCount+1,0,r?r.index:-1,!s);t.flush(l)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,r){var i;this.fragCurrent=e;const s=t==null?void 0:t.details;if(!this.levels||!s)throw new Error(`frag load aborted, missing level${s?"":" detail"}s`);let l=null;e.encrypted&&!((i=e.decryptdata)!=null&&i.key)?(this.log(`Loading key for ${e.sn} of [${s.startSN}-${s.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=ct.KEY_LOADING,this.fragCurrent=e,l=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(p.KEY_LOADED,d),this.state===ct.KEY_LOADING&&(this.state=ct.IDLE),d}),this.hls.trigger(p.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(l=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):e.encrypted||(l=this.keyLoader.loadClear(e,s.encryptedFragments),l&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(te(e)&&(!c||e.sn!==c.sn)){const d=this.shouldLoadParts(t.details,e.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=d)}if(n=Math.max(e.start,n||0),this.loadingParts&&te(e)){const d=s.partList;if(d&&r){n>e.end&&s.fragmentHint&&(e=s.fragmentHint);const _=this.getNextPart(d,e,n);if(_>-1){const b=d[_];e=this.fragCurrent=b.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${b.index} (${_}/${d.length-1}) of ${this.fragInfo(e,!1,b)}) cc: ${e.cc} [${s.startSN}-${s.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=b.start+b.duration,this.state=ct.FRAG_LOADING;let E;return l?E=l.then(Z=>!Z||this.fragContextChanged(Z.frag)?null:this.doFragPartsLoad(e,b,t,r)).catch(Z=>this.handleFragLoadError(Z)):E=this.doFragPartsLoad(e,b,t,r).catch(Z=>this.handleFragLoadError(Z)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:b,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):E}else if(!e.url||this.loadedEndOfParts(d,n))return Promise.resolve(null)}}if(te(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${s?"["+s.startSN+"-"+s.endSN+"]":""}, target: ${parseFloat(n.toFixed(3))}`),k(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ct.FRAG_LOADING;const u=this.config.progressive;let f;return u&&l?f=l.then(d=>!d||this.fragContextChanged(d==null?void 0:d.frag)?null:this.fragmentLoader.load(e,r)).catch(d=>this.handleFragLoadError(d)):f=Promise.all([this.fragmentLoader.load(e,u?r:void 0),l]).then(([d])=>(!u&&d&&r&&r(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):f}doFragPartsLoad(e,t,n,r){return new Promise((i,s)=>{var l;const c=[],u=(l=n.details)==null?void 0:l.partList,f=d=>{this.fragmentLoader.loadPart(e,d,r).then(_=>{c[d.index]=_;const b=_.part;this.hls.trigger(p.FRAG_LOADED,_);const E=kr(n.details,e.sn,d.index+1)||ri(u,e.sn,d.index+1);if(E)f(E);else return i({frag:e,part:b,partsLoaded:c})}).catch(s)};f(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===K.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:le.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==ct.PARSING){!this.fragCurrent&&this.state!==ct.STOPPED&&this.state!==ct.ERROR&&(this.state=ct.IDLE);return}const{frag:n,part:r,level:i}=t,s=self.performance.now();n.stats.parsing.end=s,r&&(r.stats.parsing.end=s);const l=this.getLevelDetails(),u=l&&n.sn>l.endSN||this.shouldLoadParts(l,n.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(n,r,i,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e!=null&&e.partList){var n;const i=e.partList[0],s=i.end+(((n=e.fragmentHint)==null?void 0:n.duration)||0);if(t>=s){var r;if((this.hls.hasEnoughToStart?((r=this.media)==null?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>i.start-i.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:r,sn:i,part:s}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${i} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const l=t[r],c=l.details,u=s>-1?kr(c,i,s):null,f=u?u.fragment:Lr(c,i,n);return f?(n&&n!==f&&(f.stats=n.stats),{frag:f,part:u,level:l}):null}bufferFragmentData(e,t,n,r,i){var s;if(!e||this.state!==ct.PARSING)return;const{data1:l,data2:c}=e;let u=l;if(l&&c&&(u=Ce(l,c)),!((s=u)!=null&&s.length))return;const f={type:e.type,frag:t,part:n,chunkMeta:r,parent:t.type,data:u};if(this.hls.trigger(p.BUFFER_APPENDING,f),e.dropped&&e.independent&&!n){if(i)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!dn.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,r=dn.bufferInfo(t,n,0),i=e.duration,s=Math.min(this.config.maxFragLookUpTolerance*2,i*.25),l=Math.max(Math.min(e.start-s,r.end-s),n+s);e.start-l>s&&this.flushMainBuffer(l,e.start)}getFwdBufferInfo(e,t){var n;const r=this.getLoadPosition();if(!k(r))return null;const s=this.lastCurrentTime>r||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,s)}getFwdBufferInfoAtPos(e,t,n,r){const i=dn.bufferInfo(e,t,r);if(i.len===0&&i.nextStart!==void 0){const s=this.fragmentTracker.getBufferedFrag(t,n);if(s&&(i.nextStart<=s.end||s.gap)){const l=Math.max(Math.min(i.nextStart,s.end)-t,r);return dn.bufferInfo(e,t,l)}}return i}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const n=this.config,r=Math.max(Math.min(e-t,n.maxBufferLength),t),i=Math.max(e-t*3,n.maxMaxBufferLength/2,r);return i>=r?(n.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e,t=oe.MAIN){var n;const r=(n=this.fragmentTracker)==null?void 0:n.getAppendedFrag(e,t);return r&&"fragment"in r?r.fragment:r}getNextFragment(e,t){const n=t.fragments,r=n.length;if(!r)return null;const{config:i}=this,s=n[0].start,l=i.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const d=i.initialLiveManifestSize;if(r<d)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${d})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<s){var u;l&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t);const _=this.hls.startPosition,b=this.hls.liveSyncPosition,E=c?(_!==-1&&_>=s?_:b)||c.start:e;this.log(`Setting startPosition to ${E} to match start frag at live edge. mainStart: ${_} liveSyncPosition: ${b} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=E}}else e<=s&&(c=n[0]);if(!c){const d=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,d,t)}let f=this.filterReplacedPrimary(c,t);if(!f&&c){const d=c.sn-t.startSN;f=this.filterReplacedPrimary(n[d+1]||null,t)}return this.mapToInitFragWhenRequired(f)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===Kn.OK||n===Kn.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,r,i){let s=null;if(e.gap&&(s=this.getNextFragment(this.nextLoadPosition,t),s&&!s.gap&&n.nextStart)){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,r,0);if(l!==null&&n.len+l.len>=i){const c=s.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,s}get primaryPrefetch(){if(jr(this.hls.config)){var e,t;if((e=this.hls.interstitialsManager)==null||(t=e.playingItem)==null?void 0:t.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(jr(this.hls.config)&&e.type!==oe.SUBTITLE){const n=this.hls.interstitialsManager,r=n==null?void 0:n.bufferingItem;if(r){const s=r.event;if(s){if(s.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&(t==null?void 0:t.live)===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}const i=n==null?void 0:n.playerQueue;if(i)for(let s=i.length;s--;){const l=i[s].interstitial;if(l.appendInPlace&&e.start>=l.startTime&&e.end<=l.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,n){let r=-1,i=!1,s=!0;for(let l=0,c=e.length;l<c;l++){const u=e[l];if(s=s&&!u.independent,r>-1&&n<u.start)break;const f=u.loaded;f?r=-1:(i||u.independent||s)&&u.fragment===t&&(r=l),i=f}return r}loadedEndOfParts(e,t){const n=e[e.length-1];return n&&t>n.start&&n.loaded}getInitialLiveFragment(e){const t=e.fragments,n=this.fragPrevious;let r=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),r=$n(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const i=n.sn+1;if(i>=e.startSN&&i<=e.endSN){const s=t[i-e.startSN];n.cc===s.cc&&(r=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=Wt(e,n.cc,n.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const i=this.hls.liveSyncPosition;i!==null&&(r=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,n){const{config:r}=this;let{fragPrevious:i}=this,{fragments:s,endSN:l}=n;const{fragmentHint:c}=n,{maxFragLookUpTolerance:u}=r,f=n.partList,d=!!(this.loadingParts&&f!=null&&f.length&&c);d&&c&&!this.bitrateTest&&f[f.length-1].fragment.sn===c.sn&&(s=s.concat(c),l=c.sn);let _;if(e<t){var b;const Z=e<this.lastCurrentTime||e>t-u||(b=this.media)!=null&&b.paused||!this.startFragRequested?0:u;_=Vt(i,s,e,Z)}else _=s[s.length-1];if(_){const E=_.sn-n.startSN,Z=this.fragmentTracker.getState(_);if((Z===Kn.OK||Z===Kn.PARTIAL&&_.gap)&&(i=_),i&&_.sn===i.sn&&(!d||f[0].fragment.sn>_.sn||!n.live&&!d)&&i&&_.level===i.level){const ae=s[E+1];_.sn<l&&this.fragmentTracker.getState(ae)!==Kn.OK?_=ae:_=null}}return _}alignPlaylists(e,t,n){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const i=e.fragmentStart,s=!t,l=e.alignedSliding&&k(i);if(s||!l&&!i){Fi(n,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),c}return i}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;n<t&&(n=-1);const r=this.timelineOffset;if(n===-1){const i=this.startTimeOffset!==null,s=i?this.startTimeOffset:e.startTimeOffset;s!==null&&k(s)?(n=t+s,s<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${s} found in ${i?"multivariant":"media"} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+r}this.nextLoadPosition=n+r}getLoadPosition(){var e;const{media:t}=this;let n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&te(e)&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==ct.FRAG_LOADING_WAITING_RETRY)&&(this.state=ct.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const E=this.getCurrentContext(t.chunkMeta);E&&(t.frag=E.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var r;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const i=t.details===K.FRAG_GAP;i&&this.fragmentTracker.fragBuffered(n,!0);const s=t.errorAction,{action:l,flags:c,retryCount:u=0,retryConfig:f}=s||{},d=!!s&&!!f,_=d&&l===jt.RetryRequest,b=d&&!s.resolved&&c===en.MoveAllAlternatesMatchingHost;if(!_&&b&&te(n)&&!n.endList)this.resetFragmentErrors(e),this.treatAsGap(n),s.resolved=!0;else if((_||b)&&u<f.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const E=an(f,u);this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${u+1}/${f.maxNumRetry} in ${E}ms`),s.resolved=!0,this.retryDate=self.performance.now()+E,this.state=ct.FRAG_LOADING_WAITING_RETRY}else if(f&&s)if(this.resetFragmentErrors(e),u<f.maxNumRetry)!i&&l!==jt.RemoveAlternatePermanently&&(s.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${u})`);return}else l===jt.SendAlternateToPenaltyBox?this.state=ct.WAITING_LEVEL:this.state=ct.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===ct.PARSING||this.state===ct.PARSED){const t=e.frag,n=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,n),i=r&&r.len>.5;i&&this.reduceMaxBufferLength(r.len,(t==null?void 0:t.duration)||10);const s=!i;return s&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(e){e===oe.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==ct.STOPPED&&(this.state=ct.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const r=dn.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,n),this.state===ct.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==ct.STOPPED&&(this.state=ct.IDLE)}resetStartWhenNotLoaded(e){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of ${this.playlistLabel()} ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,n,r){const i=n.details;if(!i){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,u)=>{const f=e.elementaryStreams[u];if(f){const d=f.endPTS-f.startPTS;if(d<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${d})`),c||!1;const _=r?0:qi(i,e,f.startPTS,f.endPTS,f.startDTS,f.endDTS);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:i,level:n,drift:_,type:u,frag:e,start:f.startPTS,end:f.endPTS}),!0}return c},!1)){var l;if(n.fragmentError===0&&this.treatAsGap(e,n),((l=this.transmuxer)==null?void 0:l.error)===null){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=ct.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===oe.MAIN?"level":"track"}fragInfo(e,t=!0,n){var r,i;return`${this.playlistLabel()} ${e.level} (${n?"part":"frag"}:[${((r=t&&!n?e.startPTS:(n||e).start)!=null?r:NaN).toFixed(3)}-${((i=t&&!n?e.endPTS:(n||e).end)!=null?i:NaN).toFixed(3)}]${n&&e.type==="main"?"INDEPENDENT="+(n.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function jr(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Yr{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=ts(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function ts(a,e){const t=new Uint8Array(e);let n=0;for(let r=0;r<a.length;r++){const i=a[r];t.set(i,n),n+=i.length}return t}var Hi={exports:{}},Ss;function ws(){return Ss||(Ss=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(c,u,f){this.fn=c,this.context=u,this.once=f||!1}function i(c,u,f,d,_){if(typeof f!="function")throw new TypeError("The listener must be a function");var b=new r(f,d||c,_),E=t?t+u:u;return c._events[E]?c._events[E].fn?c._events[E]=[c._events[E],b]:c._events[E].push(b):(c._events[E]=b,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],f,d;if(this._eventsCount===0)return u;for(d in f=this._events)e.call(f,d)&&u.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},l.prototype.listeners=function(u){var f=t?t+u:u,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var _=0,b=d.length,E=new Array(b);_<b;_++)E[_]=d[_].fn;return E},l.prototype.listenerCount=function(u){var f=t?t+u:u,d=this._events[f];return d?d.fn?1:d.length:0},l.prototype.emit=function(u,f,d,_,b,E){var Z=t?t+u:u;if(!this._events[Z])return!1;var N=this._events[Z],ae=arguments.length,Pe,ye;if(N.fn){switch(N.once&&this.removeListener(u,N.fn,void 0,!0),ae){case 1:return N.fn.call(N.context),!0;case 2:return N.fn.call(N.context,f),!0;case 3:return N.fn.call(N.context,f,d),!0;case 4:return N.fn.call(N.context,f,d,_),!0;case 5:return N.fn.call(N.context,f,d,_,b),!0;case 6:return N.fn.call(N.context,f,d,_,b,E),!0}for(ye=1,Pe=new Array(ae-1);ye<ae;ye++)Pe[ye-1]=arguments[ye];N.fn.apply(N.context,Pe)}else{var $e=N.length,We;for(ye=0;ye<$e;ye++)switch(N[ye].once&&this.removeListener(u,N[ye].fn,void 0,!0),ae){case 1:N[ye].fn.call(N[ye].context);break;case 2:N[ye].fn.call(N[ye].context,f);break;case 3:N[ye].fn.call(N[ye].context,f,d);break;case 4:N[ye].fn.call(N[ye].context,f,d,_);break;default:if(!Pe)for(We=1,Pe=new Array(ae-1);We<ae;We++)Pe[We-1]=arguments[We];N[ye].fn.apply(N[ye].context,Pe)}}return!0},l.prototype.on=function(u,f,d){return i(this,u,f,d,!1)},l.prototype.once=function(u,f,d){return i(this,u,f,d,!0)},l.prototype.removeListener=function(u,f,d,_){var b=t?t+u:u;if(!this._events[b])return this;if(!f)return s(this,b),this;var E=this._events[b];if(E.fn)E.fn===f&&(!_||E.once)&&(!d||E.context===d)&&s(this,b);else{for(var Z=0,N=[],ae=E.length;Z<ae;Z++)(E[Z].fn!==f||_&&!E[Z].once||d&&E[Z].context!==d)&&N.push(E[Z]);N.length?this._events[b]=N.length===1?N[0]:N:s(this,b)}return this},l.prototype.removeAllListeners=function(u){var f;return u?(f=t?t+u:u,this._events[f]&&s(this,f)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=t,l.EventEmitter=l,a.exports=l}(Hi)),Hi.exports}var Ts=ws(),Ri=L(Ts);const Ci="1.6.5",Ni={};function qo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function el(){const a=Ni[Ci];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),r={worker:new self.Worker(t),objectURL:t,clientCount:1};return Ni[Ci]=r,r}function tl(a){const e=Ni[a];if(e)return e.clientCount++,e;const t=new self.URL(a,self.location.href).href,r={worker:new self.Worker(t),scriptURL:t,clientCount:1};return Ni[a]=r,r}function nl(a){const e=Ni[a||Ci];if(e&&e.clientCount--===1){const{worker:n,objectURL:r}=e;delete Ni[a||Ci],r&&self.URL.revokeObjectURL(r),n.terminate()}}function Ta(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 Gs(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 As(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 hs(a,e){const t=e;let n=0;for(;Gs(a,e);){n+=10;const r=As(a,e+6);n+=r,Ta(a,e+10)&&(n+=10),e+=n}if(n>0)return a.subarray(t,t+n)}function rl(a,e,t,n){const r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],i=e[t+2],s=i>>2&15;if(s>12){const b=new Error(`invalid ADTS sampling index:${s}`);a.emit(p.ERROR,p.ERROR,{type:le.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!0,error:b,reason:b.message});return}const l=(i>>6&3)+1,c=e[t+3]>>6&3|(i&1)<<2,u="mp4a.40."+l,f=r[s];let d=s;(l===5||l===29)&&(d-=3);const _=[l<<3|(d&14)>>1,(d&1)<<7|c<<3];return J.log(`manifest codec:${n}, parsed codec:${u}, channels:${c}, rate:${f} (ADTS object type:${l} sampling index:${s})`),{config:_,samplerate:f,channelCount:c,codec:u,parsedCodec:u,manifestCodec:n}}function Aa(a,e){return a[e]===255&&(a[e+1]&246)===240}function Da(a,e){return a[e+1]&1?7:9}function Vs(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function il(a,e){return e+5<a.length}function Ds(a,e){return e+1<a.length&&Aa(a,e)}function sl(a,e){return il(a,e)&&Aa(a,e)&&Vs(a,e)<=a.length-e}function al(a,e){if(Ds(a,e)){const t=Da(a,e);if(e+t>=a.length)return!1;const n=Vs(a,e);if(n<=t)return!1;const r=e+n;return r===a.length||Ds(a,r)}return!1}function Ra(a,e,t,n,r){if(!a.samplerate){const i=rl(e,t,n,r);if(!i)return;h(a,i)}}function Ca(a){return 1024*9e4/a}function ol(a,e){const t=Da(a,e);if(e+t<=a.length){const n=Vs(a,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function Ia(a,e,t,n,r){const i=Ca(a.samplerate),s=n+r*i,l=ol(e,t);let c;if(l){const{frameLength:d,headerLength:_}=l,b=_+d,E=Math.max(0,t+b-e.length);E?(c=new Uint8Array(b-_),c.set(e.subarray(t+_,e.length),0)):c=e.subarray(t+_,t+b);const Z={unit:c,pts:s};return E||a.samples.push(Z),{sample:Z,length:b,missing:E}}const u=e.length-t;return c=new Uint8Array(u),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:s},length:u,missing:-1}}function ll(a,e){return Gs(a,e)&&As(a,e+6)+10<=a.length-e}function ul(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function zs(a,e=0,t=1/0){return cl(a,e,t,Uint8Array)}function cl(a,e,t,n){const r=fl(a);let i=1;"BYTES_PER_ELEMENT"in n&&(i=n.BYTES_PER_ELEMENT);const s=dl(a)?a.byteOffset:0,l=(s+a.byteLength)/i,c=(s+e)/i,u=Math.floor(Math.max(0,Math.min(c,l))),f=Math.floor(Math.min(u+Math.max(t,0),l));return new n(r,u,f-u)}function fl(a){return a instanceof ArrayBuffer?a:a.buffer}function dl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function hl(a){const e={key:a.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(a.size<2)return;if(a.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const n=a.data.subarray(1).indexOf(0);if(n===-1)return;const r=Ne(zs(a.data,1,n)),i=a.data[2+n],s=a.data.subarray(3+n).indexOf(0);if(s===-1)return;const l=Ne(zs(a.data,3+n,s));let c;return r==="-->"?c=Ne(zs(a.data,4+n+s)):c=ul(a.data.subarray(4+n+s)),e.mimeType=r,e.pictureType=i,e.description=l,e.data=c,e}function pl(a){if(a.size<2)return;const e=Ne(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function gl(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const n=Ne(a.data.subarray(t),!0);t+=n.length+1;const r=Ne(a.data.subarray(t));return{key:a.type,info:n,data:r}}const e=Ne(a.data.subarray(1));return{key:a.type,info:"",data:e}}function ml(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const n=Ne(a.data.subarray(t),!0);t+=n.length+1;const r=Ne(a.data.subarray(t));return{key:a.type,info:n,data:r}}const e=Ne(a.data);return{key:a.type,info:"",data:e}}function vl(a){return a.type==="PRIV"?pl(a):a.type[0]==="W"?ml(a):a.type==="APIC"?hl(a):gl(a)}function _l(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=As(a,4),n=10;return{type:e,size:t,data:a.subarray(n,n+t)}}const Rs=10,yl=10;function La(a){let e=0;const t=[];for(;Gs(a,e);){const n=As(a,e+6);a[e+5]>>6&1&&(e+=Rs),e+=Rs;const r=e+n;for(;e+yl<r;){const i=_l(a.subarray(e)),s=vl(i);s&&t.push(s),e+=i.size+Rs}Ta(a,e)&&(e+=Rs)}return t}function ka(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function El(a){if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}}function Ws(a){const e=La(a);for(let t=0;t<e.length;t++){const n=e[t];if(ka(n))return El(n)}}let ui=function(a){return a.audioId3="org.id3",a.dateRange="com.apple.quicktime.HLS",a.emsg="https://aomedia.org/emsg/ID3",a.misbklv="urn:misb:KLV:bin:1910.1",a}({});function wi(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Hs{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,n,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,n){}demux(e,t){this.cachedData&&(e=Ce(this.cachedData,e),this.cachedData=null);let n=hs(e,0),r=n?n.length:0,i;const s=this._audioTrack,l=this._id3Track,c=n?Ws(n):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&k(c))&&(this.basePTS=bl(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:ui.audioId3,duration:Number.POSITIVE_INFINITY});r<u;){if(this.canParse(e,r)){const f=this.appendFrame(s,e,r);f?(this.frameIndex++,this.lastPTS=f.sample.pts,r+=f.length,i=r):r=u}else ll(e,r)?(n=hs(e,r),l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:ui.audioId3,duration:Number.POSITIVE_INFINITY}),r+=n.length,i=r):r++;if(r===u&&i!==u){const f=e.slice(i);this.cachedData?this.cachedData=Ce(this.cachedData,f):this.cachedData=f}}return{audioTrack:s,videoTrack:wi(),id3Track:l,textTrack:wi()}}demuxSampleAes(e,t,n){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:wi(),id3Track:this._id3Track,textTrack:wi()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const bl=(a,e,t)=>{if(k(a))return a*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};let Cs=null;const xl=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Sl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],wl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Tl=[0,1,1,4];function Pa(a,e,t,n,r){if(t+24>e.length)return;const i=Oa(e,t);if(i&&t+i.frameLength<=e.length){const s=i.samplesPerFrame*9e4/i.sampleRate,l=n+r*s,c={unit:e.subarray(t,t+i.frameLength),pts:l,dts:l};return a.config=[],a.channelCount=i.channelCount,a.samplerate=i.sampleRate,a.samples.push(c),{sample:c,length:i.frameLength,missing:0}}}function Oa(a,e){const t=a[e+1]>>3&3,n=a[e+1]>>1&3,r=a[e+2]>>4&15,i=a[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&i!==3){const s=a[e+2]>>1&1,l=a[e+3]>>6,c=t===3?3-n:n===3?3:4,u=xl[c*14+r-1]*1e3,d=Sl[(t===3?0:t===2?1:2)*3+i],_=l===3?1:2,b=wl[t][n],E=Tl[n],Z=b*8*E,N=Math.floor(b*u/d+s)*E;if(Cs===null){const ye=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Cs=ye?parseInt(ye[1]):0}return!!Cs&&Cs<=87&&n===2&&u>=224e3&&l===0&&(a[e+3]=a[e+3]|128),{sampleRate:d,channelCount:_,frameLength:N,samplesPerFrame:Z}}}function js(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function Ma(a,e){return e+1<a.length&&js(a,e)}function Al(a,e){return js(a,e)&&4<=a.length-e}function Fa(a,e){if(e+1<a.length&&js(a,e)){const n=Oa(a,e);let r=4;n!=null&&n.frameLength&&(r=n.frameLength);const i=e+r;return i===a.length||Ma(a,i)}return!1}class Dl extends Hs{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const n=hs(e,0);let r=(n==null?void 0:n.length)||0;if(Fa(e,r))return!1;for(let i=e.length;r<i;r++)if(al(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return sl(e,t)}appendFrame(e,t,n){Ra(e,this.observer,t,n,e.manifestCodec);const r=Ia(e,t,n,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Na=(a,e)=>{let t=0,n=5;e+=n;const r=new Uint32Array(1),i=new Uint32Array(1),s=new Uint8Array(1);for(;n>0;){s[0]=a[e];const l=Math.min(n,8),c=8-l;i[0]=4278190080>>>24+c<<c,r[0]=(s[0]&i[0])>>c,t=t?t<<l|r[0]:r[0],e+=1,n-=l}return t};class Rl extends Hs{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const r=Ba(e,t,n,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=hs(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&Ws(t)!==void 0&&Na(e,n)<16}}function Ba(a,e,t,n,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const i=e[t+4]>>6;if(i>=3)return-1;const l=[48e3,44100,32e3][i],c=e[t+4]&63,f=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+i]*2;if(t+f>e.length)return-1;const d=e[t+6]>>5;let _=0;d===2?_+=2:(d&1&&d!==1&&(_+=2),d&4&&(_+=2));const b=(e[t+6]<<8|e[t+7])>>12-_&1,Z=[2,1,2,3,3,4,4,5][d]+b,N=e[t+5]>>3,ae=e[t+5]&7,Pe=new Uint8Array([i<<6|N<<1|ae>>2,(ae&3)<<6|d<<3|b<<2|c>>4,c<<4&224]),ye=1536/l*9e4,$e=n+r*ye,We=e.subarray(t,t+f);return a.config=Pe,a.channelCount=Z,a.samplerate=l,a.samples.push({unit:We,pts:$e}),f}class Cl extends Hs{resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=hs(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&Ws(t)!==void 0&&Na(e,n)<=16)return!1;for(let r=e.length;n<r;n++)if(Fa(e,n))return J.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Al(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return Pa(e,t,n,this.basePTS,this.frameIndex)}}const Il=/\/emsg[-/]ID3/i;class Ll{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,n,r){const i=this.videoTrack=wi("video",1),s=this.audioTrack=wi("audio",1),l=this.txtTrack=wi("text",1);if(this.id3Track=wi("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=ke(e);if(c.video){const{id:u,timescale:f,codec:d,supplemental:_}=c.video;i.id=u,i.timescale=l.timescale=f,i.codec=d,i.supplemental=_}if(c.audio){const{id:u,timescale:f,codec:d}=c.audio;s.id=u,s.timescale=f,s.codec=d}l.id=we.text,i.sampleDuration=0,i.duration=s.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return ve(e)}demux(e,t){this.timeOffset=t;let n=e;const r=this.videoTrack,i=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=Ce(this.remainderData,e));const l=me(n);this.remainderData=l.remainder,r.samples=l.valid||new Uint8Array}else r.samples=n;const s=this.extractID3Track(r,t);return i.samples=Ie(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return n.samples=Ie(e,t),{videoTrack:t,audioTrack:wi(),id3Track:r,textTrack:wi()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const r=F(e.samples,["emsg"]);r&&r.forEach(i=>{const s=Ue(i);if(Il.test(s.schemeIdUri)){const l=Ua(s,t);let c=s.eventDuration===4294967295?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=s.payload;n.samples.push({data:u,len:u.byteLength,dts:l,pts:l,type:ui.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&s.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const l=Ua(s,t);n.samples.push({data:s.payload,len:s.payload.byteLength,dts:l,pts:l,type:ui.misbklv,duration:Number.POSITIVE_INFINITY})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function Ua(a,e){return k(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class kl{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new xn(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,ar.cbc)}decryptAacSample(e,t,n){const r=e[t].unit;if(r.length<=16)return;const i=r.subarray(16,r.length-r.length%16),s=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);this.decryptBuffer(s).then(l=>{const c=new Uint8Array(l);r.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)})}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let r=0;for(let i=32;i<e.length-16;i+=160,r+=16)n.set(e.subarray(i,i+16),r);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let r=0;for(let i=32;i<e.length-16;i+=160,r+=16)e.set(n.subarray(r,r+16),i);return e}decryptAvcSample(e,t,n,r,i){const s=je(i.data),l=this.getAvcEncryptedData(s);this.decryptBuffer(l.buffer).then(c=>{i.data=this.getAvcDecryptedUnit(s,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,r)})}decryptAvcSamples(e,t,n,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){r();return}const i=e[t].units;for(;!(n>=i.length);n++){const s=i[n];if(!(s.data.length<=48||s.type!==1&&s.type!==5)&&(this.decryptAvcSample(e,t,n,r,s),!this.decrypter.isSync()))return}}}}class $a{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,r;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const i=n.units;r=i[i.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,r=n.length;if(r){const i=n[r-1];e.pts=i.pts,e.dts=i.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,n){const r=t.byteLength;let i=e.naluState||0;const s=i,l=[];let c=0,u,f,d,_=-1,b=0;for(i===-1&&(_=0,b=this.getNALuType(t,0),i=0,c=1);c<r;){if(u=t[c++],!i){i=u?0:1;continue}if(i===1){i=u?0:2;continue}if(!u)i=3;else if(u===1){if(f=c-i-1,_>=0){const E={data:t.subarray(_,f),type:b};l.push(E)}else{const E=this.getLastNalUnit(e.samples);E&&(s&&c<=4-s&&E.state&&(E.data=E.data.subarray(0,E.data.byteLength-s)),f>0&&(E.data=Ce(E.data,t.subarray(0,f)),E.state=0))}c<r?(d=this.getNALuType(t,c),_=c,b=d,i=0):i=-1}else i=0}if(_>=0&&i>=0){const E={data:t.subarray(_,r),type:b,state:i};l.push(E)}if(l.length===0){const E=this.getLastNalUnit(e.samples);E&&(E.data=Ce(E.data,t))}return e.naluState=i,l}}class ps{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,n=e.byteLength-t,r=new Uint8Array(4),i=Math.min(4,t);if(i===0)throw new Error("no bytes available");r.set(e.subarray(n,n+i)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=i*8,this.bytesAvailable-=i}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const n=this.word>>>32-t;if(e>32&&J.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?n<<t|this.readBits(t):n}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Ka extends $a{parsePES(e,t,n,r){const i=this.parseNALu(e,n.data,r);let s=this.VideoSample,l,c=!1;n.data=null,s&&i.length&&!e.audFound&&(this.pushAccessUnit(s,e),s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),i.forEach(u=>{var f,d;switch(u.type){case 1:{let Z=!1;l=!0;const N=u.data;if(c&&N.length>4){const ae=this.readSliceType(N);(ae===2||ae===4||ae===7||ae===9)&&(Z=!0)}if(Z){var _;(_=s)!=null&&_.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null)}s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.frame=!0,s.key=Z;break}case 5:l=!0,(f=s)!=null&&f.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null),s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.key=!0,s.frame=!0;break;case 6:{l=!0,ze(u.data,1,n.pts,t.samples);break}case 7:{var b,E;l=!0,c=!0;const Z=u.data,N=this.readSPS(Z);if(!e.sps||e.width!==N.width||e.height!==N.height||((b=e.pixelRatio)==null?void 0:b[0])!==N.pixelRatio[0]||((E=e.pixelRatio)==null?void 0:E[1])!==N.pixelRatio[1]){e.width=N.width,e.height=N.height,e.pixelRatio=N.pixelRatio,e.sps=[Z];const ae=Z.subarray(1,4);let Pe="avc1.";for(let ye=0;ye<3;ye++){let $e=ae[ye].toString(16);$e.length<2&&($e="0"+$e),Pe+=$e}e.codec=Pe}break}case 8:l=!0,e.pps=[u.data];break;case 9:l=!0,e.audFound=!0,(d=s)!=null&&d.frame&&(this.pushAccessUnit(s,e),s=null),s||(s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;case 12:l=!0;break;default:l=!1;break}s&&l&&s.units.push(u)}),r&&s&&(this.pushAccessUnit(s,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new ps(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n=8,r=8,i;for(let s=0;s<e;s++)r!==0&&(i=t.readEG(),r=(n+i+256)%256),n=r===0?n:r}readSPS(e){const t=new ps(e);let n=0,r=0,i=0,s=0,l,c,u;const f=t.readUByte.bind(t),d=t.readBits.bind(t),_=t.readUEG.bind(t),b=t.readBoolean.bind(t),E=t.skipBits.bind(t),Z=t.skipEG.bind(t),N=t.skipUEG.bind(t),ae=this.skipScalingList.bind(this);f();const Pe=f();if(d(5),E(3),f(),N(),Pe===100||Pe===110||Pe===122||Pe===244||Pe===44||Pe===83||Pe===86||Pe===118||Pe===128){const st=_();if(st===3&&E(1),N(),N(),E(1),b())for(c=st!==3?8:12,u=0;u<c;u++)b()&&(u<6?ae(16,t):ae(64,t))}N();const ye=_();if(ye===0)_();else if(ye===1)for(E(1),Z(),Z(),l=_(),u=0;u<l;u++)Z();N(),E(1);const $e=_(),We=_(),ht=d(1);ht===0&&E(1),E(1),b()&&(n=_(),r=_(),i=_(),s=_());let Ye=[1,1];if(b()&&b())switch(f()){case 1:Ye=[1,1];break;case 2:Ye=[12,11];break;case 3:Ye=[10,11];break;case 4:Ye=[16,11];break;case 5:Ye=[40,33];break;case 6:Ye=[24,11];break;case 7:Ye=[20,11];break;case 8:Ye=[32,11];break;case 9:Ye=[80,33];break;case 10:Ye=[18,11];break;case 11:Ye=[15,11];break;case 12:Ye=[64,33];break;case 13:Ye=[160,99];break;case 14:Ye=[4,3];break;case 15:Ye=[3,2];break;case 16:Ye=[2,1];break;case 255:{Ye=[f()<<8|f(),f()<<8|f()];break}}return{width:Math.ceil(($e+1)*16-n*2-r*2),height:(2-ht)*(We+1)*16-(ht?2:4)*(i+s),pixelRatio:Ye}}}class Za extends $a{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,r){const i=this.parseNALu(e,n.data,r);let s=this.VideoSample,l,c=!1;n.data=null,s&&i.length&&!e.audFound&&(this.pushAccessUnit(s,e),s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),i.forEach(u=>{var f,d;switch(u.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:s||(s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),s.frame=!0,l=!0;break;case 16:case 17:case 18:case 21:if(l=!0,c){var _;(_=s)!=null&&_.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null)}s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.key=!0,s.frame=!0;break;case 19:case 20:l=!0,(f=s)!=null&&f.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null),s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.key=!0,s.frame=!0;break;case 39:l=!0,ze(u.data,2,n.pts,t.samples);break;case 32:l=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=h(e.params,this.readVPS(u.data)),this.initVPS=u.data),e.vps=[u.data];break;case 33:if(l=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],u.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const b=this.readSPS(u.data);e.width=b.width,e.height=b.height,e.pixelRatio=b.pixelRatio,e.codec=b.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const E in b.params)e.params[E]=b.params[E]}this.pushParameterSet(e.sps,u.data,e.vps),s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.key=!0;break;case 34:if(l=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const b=this.readPPS(u.data);for(const E in b)e.params[E]=b[E]}this.pushParameterSet(e.pps,u.data,e.vps)}break;case 35:l=!0,e.audFound=!0,(d=s)!=null&&d.frame&&(this.pushAccessUnit(s,e),s=null),s||(s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;default:l=!1;break}s&&l&&s.units.push(u)}),r&&s&&(this.pushAccessUnit(s,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let n=0;for(let r=0;r<e.byteLength;r++)r>=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(t[n]=e[r],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new ps(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const n=t.readBits(3),r=t.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:r}}readSPS(e){const t=new ps(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const n=t.readBits(3);t.readBoolean();const r=t.readBits(2),i=t.readBoolean(),s=t.readBits(5),l=t.readUByte(),c=t.readUByte(),u=t.readUByte(),f=t.readUByte(),d=t.readUByte(),_=t.readUByte(),b=t.readUByte(),E=t.readUByte(),Z=t.readUByte(),N=t.readUByte(),ae=t.readUByte(),Pe=[],ye=[];for(let Sr=0;Sr<n;Sr++)Pe.push(t.readBoolean()),ye.push(t.readBoolean());if(n>0)for(let Sr=n;Sr<8;Sr++)t.readBits(2);for(let Sr=0;Sr<n;Sr++)Pe[Sr]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),ye[Sr]&&t.readUByte();t.readUEG();const $e=t.readUEG();$e==3&&t.skipBits(1);const We=t.readUEG(),ht=t.readUEG(),Ye=t.readBoolean();let st=0,dt=0,Xe=0,$t=0;Ye&&(st+=t.readUEG(),dt+=t.readUEG(),Xe+=t.readUEG(),$t+=t.readUEG());const pn=t.readUEG(),Vn=t.readUEG(),Dn=t.readUEG(),Cn=t.readBoolean();for(let Sr=Cn?0:n;Sr<=n;Sr++)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 Xr=0;Xr<4;Xr++)for(let vi=0;vi<(Xr===3?2:6);vi++)if(!t.readBoolean())t.readUEG();else{const xi=Math.min(64,1<<4+(Xr<<1));Xr>1&&t.readEG();for(let us=0;us<xi;us++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const Fn=t.readUEG();let Ht=0;for(let Sr=0;Sr<Fn;Sr++){let Xr=!1;if(Sr!==0&&(Xr=t.readBoolean()),Xr){Sr===Fn&&t.readUEG(),t.readBoolean(),t.readUEG();let vi=0;for(let Yi=0;Yi<=Ht;Yi++){const xi=t.readBoolean();let us=!1;xi||(us=t.readBoolean()),(xi||us)&&vi++}Ht=vi}else{const vi=t.readUEG(),Yi=t.readUEG();Ht=vi+Yi;for(let xi=0;xi<vi;xi++)t.readUEG(),t.readBoolean();for(let xi=0;xi<Yi;xi++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Sr=t.readUEG();for(let Xr=0;Xr<Sr;Xr++){for(let vi=0;vi<Dn+4;vi++)t.readBits(1);t.readBits(1)}}let sr=0,qn=1,vr=1,br=!0,Tr=1,Rr=0;t.readBoolean(),t.readBoolean();let ei=!1;if(t.readBoolean()){if(t.readBoolean()){const Xi=t.readUByte(),zo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Zs=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Xi>0&&Xi<16?(qn=zo[Xi-1],vr=Zs[Xi-1]):Xi===255&&(qn=t.readBits(16),vr=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(),ei=t.readBoolean(),ei&&(st+=t.readUEG(),dt+=t.readUEG(),Xe+=t.readUEG(),$t+=t.readUEG()),t.readBoolean()&&(Tr=t.readBits(32),Rr=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Zs=t.readBoolean(),Wo=t.readBoolean();let Es=!1;(Zs||Wo)&&(Es=t.readBoolean(),Es&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),Es&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Ho=0;Ho<=n;Ho++){br=t.readBoolean();const nf=br||t.readBoolean();let jo=!1;nf?t.readEG():jo=t.readBoolean();const Yo=jo?1:t.readUEG()+1;if(Zs)for(let bs=0;bs<Yo;bs++)t.readUEG(),t.readUEG(),Es&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Wo)for(let bs=0;bs<Yo;bs++)t.readUEG(),t.readUEG(),Es&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),sr=t.readUEG())}let Zi=We,Vo=ht;if(Ye||ei){let Sr=1,Xr=1;$e===1?Sr=Xr=2:$e==2&&(Sr=2),Zi=We-Sr*dt-Sr*st,Vo=ht-Xr*$t-Xr*Xe}const ef=r?["A","B","C"][r]:"",tf=l<<24|c<<16|u<<8|f;let Sa=0;for(let Sr=0;Sr<32;Sr++)Sa=(Sa|(tf>>Sr&1)<<31-Sr)>>>0;let wa=Sa.toString(16);return s===1&&wa==="2"&&(wa="6"),{codecString:`hvc1.${ef}${s}.${wa}.${i?"H":"L"}${ae}.B0`,params:{general_tier_flag:i,general_profile_idc:s,general_profile_space:r,general_profile_compatibility_flags:[l,c,u,f],general_constraint_indicator_flags:[d,_,b,E,Z,N],general_level_idc:ae,bit_depth:pn+8,bit_depth_luma_minus8:pn,bit_depth_chroma_minus8:Vn,min_spatial_segmentation_idc:sr,chroma_format_idc:$e,frame_rate:{fixed:br,fps:Rr/Tr}},width:Zi,height:Vo,pixelRatio:[qn,vr]}}readPPS(e){const t=new ps(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const r=t.readBoolean(),i=t.readBoolean();let s=1;return i&&r?s=0:i?s=3:r&&(s=2),{parallelismType:s}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Zr=188;class Bi{constructor(e,t,n,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.logger=r,this.videoParser=null}static probe(e,t){const n=Bi.syncOffset(e);return n>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),n!==-1}static syncOffset(e){const t=e.length;let n=Math.min(Zr*5,t-Zr)+1,r=0;for(;r<n;){let i=!1,s=-1,l=0;for(let c=r;c<t;c+=Zr)if(e[c]===71&&(t-c===Zr||e[c+Zr]===71)){if(l++,s===-1&&(s=c,s!==0&&(n=Math.min(s+Zr*99,e.length-Zr)+1)),i||(i=Ys(e,c)===0),i&&l>1&&(s===0&&l>2||c+Zr>n))return s}else{if(l)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:we[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Bi.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Bi.createTrack("audio",r),this._id3Track=Bi.createTrack("id3"),this._txtTrack=Bi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,r=!1){n||(this.sampleAes=null);let i;const s=this._videoTrack,l=this._audioTrack,c=this._id3Track,u=this._txtTrack;let f=s.pid,d=s.pesData,_=l.pid,b=c.pid,E=l.pesData,Z=c.pesData,N=null,ae=this.pmtParsed,Pe=this._pmtId,ye=e.length;if(this.remainderData&&(e=Ce(this.remainderData,e),ye=e.length,this.remainderData=null),ye<Zr&&!r)return this.remainderData=e,{audioTrack:l,videoTrack:s,id3Track:c,textTrack:u};const $e=Math.max(0,Bi.syncOffset(e));ye-=(ye-$e)%Zr,ye<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,ye,e.buffer.byteLength-ye));let We=0;for(let Ye=$e;Ye<ye;Ye+=Zr)if(e[Ye]===71){const st=!!(e[Ye+1]&64),dt=Ys(e,Ye),Xe=(e[Ye+3]&48)>>4;let $t;if(Xe>1){if($t=Ye+5+e[Ye+4],$t===Ye+Zr)continue}else $t=Ye+4;switch(dt){case f:if(st){if(d&&(i=ns(d,this.logger))){if(this.videoParser===null)switch(s.segmentCodec){case"avc":this.videoParser=new Ka;break;case"hevc":this.videoParser=new Za;break}this.videoParser!==null&&this.videoParser.parsePES(s,u,i,!1)}d={data:[],size:0}}d&&(d.data.push(e.subarray($t,Ye+Zr)),d.size+=Ye+Zr-$t);break;case _:if(st){if(E&&(i=ns(E,this.logger)))switch(l.segmentCodec){case"aac":this.parseAACPES(l,i);break;case"mp3":this.parseMPEGPES(l,i);break;case"ac3":this.parseAC3PES(l,i);break}E={data:[],size:0}}E&&(E.data.push(e.subarray($t,Ye+Zr)),E.size+=Ye+Zr-$t);break;case b:st&&(Z&&(i=ns(Z,this.logger))&&this.parseID3PES(c,i),Z={data:[],size:0}),Z&&(Z.data.push(e.subarray($t,Ye+Zr)),Z.size+=Ye+Zr-$t);break;case 0:st&&($t+=e[$t]+1),Pe=this._pmtId=Pl(e,$t);break;case Pe:{st&&($t+=e[$t]+1);const pn=Ol(e,$t,this.typeSupported,n,this.observer,this.logger);f=pn.videoPid,f>0&&(s.pid=f,s.segmentCodec=pn.segmentVideoCodec),_=pn.audioPid,_>0&&(l.pid=_,l.segmentCodec=pn.segmentAudioCodec),b=pn.id3Pid,b>0&&(c.pid=b),N!==null&&!ae&&(this.logger.warn(`MPEG-TS PMT found at ${Ye} after unknown PID '${N}'. Backtracking to sync byte @${$e} to parse all TS packets.`),N=null,Ye=$e-188),ae=this.pmtParsed=!0;break}case 17:case 8191:break;default:N=dt;break}}else We++;We>0&&Xs(this.observer,new Error(`Found ${We} TS packet/s that do not start with 0x47`),void 0,this.logger),s.pesData=d,l.pesData=E,c.pesData=Z;const ht={audioTrack:l,videoTrack:s,id3Track:c,textTrack:u};return r&&this.extractRemainingSamples(ht),ht}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:n,id3Track:r,textTrack:i}=e,s=n.pesData,l=t.pesData,c=r.pesData;let u;if(s&&(u=ns(s,this.logger))){if(this.videoParser===null)switch(n.segmentCodec){case"avc":this.videoParser=new Ka;break;case"hevc":this.videoParser=new Za;break}this.videoParser!==null&&(this.videoParser.parsePES(n,i,u,!0),n.pesData=null)}else n.pesData=s;if(l&&(u=ns(l,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 l!=null&&l.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=l;c&&(u=ns(c,this.logger))?(this.parseID3PES(r,u),r.pesData=null):r.pesData=c}demuxSampleAes(e,t,n){const r=this.demux(e,n,!0,!this.config.progressive),i=this.sampleAes=new kl(this.observer,this.config,t);return this.decrypt(r,i)}decrypt(e,t){return new Promise(n=>{const{audioTrack:r,videoTrack:i}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{i.samples?t.decryptAvcSamples(i.samples,0,0,()=>{n(e)}):n(e)}):i.samples&&t.decryptAvcSamples(i.samples,0,0,()=>{n(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let n=0;const r=this.aacOverFlow;let i=t.data;if(r){this.aacOverFlow=null;const d=r.missing,_=r.sample.unit.byteLength;if(d===-1)i=Ce(r.sample.unit,i);else{const b=_-d;r.sample.unit.set(i.subarray(0,d),b),e.samples.push(r.sample),n=r.missing}}let s,l;for(s=n,l=i.length;s<l-1&&!Ds(i,s);s++);if(s!==n){let d;const _=s<l-1;if(_?d=`AAC PES did not start with ADTS header,offset:${s}`:d="No ADTS header found in AAC PES",Xs(this.observer,new Error(d),_,this.logger),!_)return}Ra(e,this.observer,i,s,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(r){const d=Ca(e.samplerate);c=r.sample.pts+d}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,f;for(;s<l;)if(f=Ia(e,i,s,c,u),s+=f.length,f.missing){this.aacOverFlow=f;break}else for(u++;s<l-1&&!Ds(i,s);s++);}parseMPEGPES(e,t){const n=t.data,r=n.length;let i=0,s=0;const l=t.pts;if(l===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;s<r;)if(Ma(n,s)){const c=Pa(e,n,s,l,i);if(c)s+=c.length,i++;else break}else s++}parseAC3PES(e,t){{const n=t.data,r=t.pts;if(r===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const i=n.length;let s=0,l=0,c;for(;l<i&&(c=Ba(e,n,l,r,s++))>0;)l+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=h({},t,{type:this._videoTrack?ui.emsg:ui.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function Ys(a,e){return((a[e+1]&31)<<8)+a[e+2]}function Pl(a,e){return(a[e+10]&31)<<8|a[e+11]}function Ol(a,e,t,n,r,i){const s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},l=(a[e+1]&15)<<8|a[e+2],c=e+3+l-4,u=(a[e+10]&15)<<8|a[e+11];for(e+=12+u;e<c;){const f=Ys(a,e),d=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!n){Qs("ADTS AAC",i);break}case 15:s.audioPid===-1&&(s.audioPid=f);break;case 21:s.id3Pid===-1&&(s.id3Pid=f);break;case 219:if(!n){Qs("H.264",i);break}case 27:s.videoPid===-1&&(s.videoPid=f);break;case 3:case 4:!t.mpeg&&!t.mp3?i.log("MPEG audio found, not supported in this browser"):s.audioPid===-1&&(s.audioPid=f,s.segmentAudioCodec="mp3");break;case 193:if(!n){Qs("AC-3",i);break}case 129:t.ac3?s.audioPid===-1&&(s.audioPid=f,s.segmentAudioCodec="ac3"):i.log("AC-3 audio found, not supported in this browser");break;case 6:if(s.audioPid===-1&&d>0){let _=e+5,b=d;for(;b>2;){switch(a[_]){case 106:t.ac3!==!0?i.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=f,s.segmentAudioCodec="ac3");break}const Z=a[_+1]+2;_+=Z,b-=Z}}break;case 194:case 135:return Xs(r,new Error("Unsupported EC-3 in M2TS found"),void 0,i),s;case 36:s.videoPid===-1&&(s.videoPid=f,s.segmentVideoCodec="hevc",i.log("HEVC in M2TS found"));break}e+=d+5}return s}function Xs(a,e,t,n){n.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:le.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Qs(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function ns(a,e){let t=0,n,r,i,s,l;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=Ce(c[0],c[1]),c.splice(1,1);if(n=c[0],(n[0]<<16)+(n[1]<<8)+n[2]===1){if(r=(n[4]<<8)+n[5],r&&r>a.size-6)return null;const f=n[7];f&192&&(s=(n[9]&14)*536870912+(n[10]&255)*4194304+(n[11]&254)*16384+(n[12]&255)*128+(n[13]&254)/2,f&64?(l=(n[14]&14)*536870912+(n[15]&255)*4194304+(n[16]&254)*16384+(n[17]&255)*128+(n[18]&254)/2,s-l>60*9e4&&(e.warn(`${Math.round((s-l)/9e4)}s delta between PTS and DTS, align them`),s=l)):l=s),i=n[8];let d=i+9;if(a.size<=d)return null;a.size-=d;const _=new Uint8Array(a.size);for(let b=0,E=c.length;b<E;b++){n=c[b];let Z=n.byteLength;if(d)if(d>Z){d-=Z;continue}else n=n.subarray(d),Z-=d,d=0;_.set(n,t),t+=Z}return r&&(r-=i+3),{data:_,pts:s,dts:l,len:r}}return null}class Ml{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 Ui=Math.pow(2,32)-1;class tt{static init(){tt.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 tt.types)tt.types.hasOwnProperty(e)&&(tt.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);tt.HDLR_TYPES={video:t,audio:n};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);tt.STTS=tt.STSC=tt.STCO=i,tt.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),tt.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),tt.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),tt.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const s=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);tt.FTYP=tt.box(tt.types.ftyp,s,c,s,l),tt.DINF=tt.box(tt.types.dinf,tt.box(tt.types.dref,r))}static box(e,...t){let n=8,r=t.length;const i=r;for(;r--;)n+=t[r].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(e,4),r=0,n=8;r<i;r++)s.set(t[r],n),n+=t[r].byteLength;return s}static hdlr(e){return tt.box(tt.types.hdlr,tt.HDLR_TYPES[e])}static mdat(e){return tt.box(tt.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(Ui+1)),r=Math.floor(t%(Ui+1));return tt.box(tt.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return tt.box(tt.types.mdia,tt.mdhd(e.timescale||0,e.duration||0),tt.hdlr(e.type),tt.minf(e))}static mfhd(e){return tt.box(tt.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"?tt.box(tt.types.minf,tt.box(tt.types.smhd,tt.SMHD),tt.DINF,tt.stbl(e)):tt.box(tt.types.minf,tt.box(tt.types.vmhd,tt.VMHD),tt.DINF,tt.stbl(e))}static moof(e,t,n){return tt.box(tt.types.moof,tt.mfhd(e),tt.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=tt.trak(e[t]);return tt.box.apply(null,[tt.types.moov,tt.mvhd(e[0].timescale||0,e[0].duration||0)].concat(n).concat(tt.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=tt.trex(e[t]);return tt.box.apply(null,[tt.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(Ui+1)),r=Math.floor(t%(Ui+1)),i=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return tt.box(tt.types.mvhd,i)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let r,i;for(r=0;r<t.length;r++)i=t[r].flags,n[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return tt.box(tt.types.sdtp,n)}static stbl(e){return tt.box(tt.types.stbl,tt.stsd(e),tt.box(tt.types.stts,tt.STTS),tt.box(tt.types.stsc,tt.STSC),tt.box(tt.types.stsz,tt.STSZ),tt.box(tt.types.stco,tt.STCO))}static avc1(e){let t=[],n=[],r,i,s;for(r=0;r<e.sps.length;r++)i=e.sps[r],s=i.byteLength,t.push(s>>>8&255),t.push(s&255),t=t.concat(Array.prototype.slice.call(i));for(r=0;r<e.pps.length;r++)i=e.pps[r],s=i.byteLength,n.push(s>>>8&255),n.push(s&255),n=n.concat(Array.prototype.slice.call(i));const l=tt.box(tt.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),c=e.width,u=e.height,f=e.pixelRatio[0],d=e.pixelRatio[1];return tt.box(tt.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,tt.box(tt.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),tt.box(tt.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,d>>24,d>>16&255,d>>8&255,d&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 tt.box(tt.types.mp4a,tt.audioStsd(e),tt.box(tt.types.esds,tt.esds(e)))}static mp3(e){return tt.box(tt.types[".mp3"],tt.audioStsd(e))}static ac3(e){return tt.box(tt.types["ac-3"],tt.audioStsd(e),tt.box(tt.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return tt.box(tt.types.stsd,tt.STSD,tt.mp4a(e));if(t==="ac3"&&e.config)return tt.box(tt.types.stsd,tt.STSD,tt.ac3(e));if(t==="mp3"&&e.codec==="mp3")return tt.box(tt.types.stsd,tt.STSD,tt.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return tt.box(tt.types.stsd,tt.STSD,tt.avc1(e));if(t==="hevc"&&e.vps)return tt.box(tt.types.stsd,tt.STSD,tt.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,n=(e.duration||0)*(e.timescale||0),r=e.width||0,i=e.height||0,s=Math.floor(n/(Ui+1)),l=Math.floor(n%(Ui+1));return tt.box(tt.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,s>>24,s>>16&255,s>>8&255,s&255,l>>24,l>>16&255,l>>8&255,l&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,i>>8&255,i&255,0,0]))}static traf(e,t){const n=tt.sdtp(e),r=e.id,i=Math.floor(t/(Ui+1)),s=Math.floor(t%(Ui+1));return tt.box(tt.types.traf,tt.box(tt.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),tt.box(tt.types.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,i&255,s>>24,s>>16&255,s>>8&255,s&255])),tt.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,tt.box(tt.types.trak,tt.tkhd(e),tt.mdia(e))}static trex(e){const t=e.id;return tt.box(tt.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const n=e.samples||[],r=n.length,i=12+16*r,s=new Uint8Array(i);let l,c,u,f,d,_;for(t+=8+i,s.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),l=0;l<r;l++)c=n[l],u=c.duration,f=c.size,d=c.flags,_=c.cts,s.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,_>>>24&255,_>>>16&255,_>>>8&255,_&255],12+16*l);return tt.box(tt.types.trun,s)}static initSegment(e){tt.types||tt.init();const t=tt.moov(e);return Ce(tt.FTYP,t)}static hvc1(e){const t=e.params,n=[e.vps,e.sps,e.pps],r=4,i=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),r-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),n.length]);let s=i.length;for(let E=0;E<n.length;E+=1){s+=3;for(let Z=0;Z<n[E].length;Z+=1)s+=2+n[E][Z].length}const l=new Uint8Array(s);l.set(i,0),s=i.length;const c=n.length-1;for(let E=0;E<n.length;E+=1){l.set(new Uint8Array([32+E|(E===c?128:0),0,n[E].length]),s),s+=3;for(let Z=0;Z<n[E].length;Z+=1)l.set(new Uint8Array([n[E][Z].length>>8,n[E][Z].length&255]),s),s+=2,l.set(n[E][Z],s),s+=n[E][Z].length}const u=tt.box(tt.types.hvcC,l),f=e.width,d=e.height,_=e.pixelRatio[0],b=e.pixelRatio[1];return tt.box(tt.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,f>>8&255,f&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,tt.box(tt.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),tt.box(tt.types.pasp,new Uint8Array([_>>24,_>>16&255,_>>8&255,_&255,b>>24,b>>16&255,b>>8&255,b&255])))}}tt.types=void 0,tt.HDLR_TYPES=void 0,tt.STTS=void 0,tt.STSC=void 0,tt.STCO=void 0,tt.STSZ=void 0,tt.VMHD=void 0,tt.SMHD=void 0,tt.STSD=void 0,tt.FTYP=void 0,tt.DINF=void 0;const Ga=9e4;function Js(a,e,t=1,n=!1){const r=a*e*t;return n?Math.round(r):r}function Fl(a,e,t=1,n=!1){return Js(a,e,1/t,n)}function gs(a,e=!1){return Js(a,1e3,1/Ga,e)}function Nl(a,e=1){return Js(a,Ga,1/e)}const Bl=10*1e3,Ul=1024,$l=1152,Kl=1536;let rs=null,qs=null;function Va(a,e,t,n){return{duration:e,size:t,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class Is{constructor(e,t,n,r){if(this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.logger=r,this.ISGenerated=!1,rs===null){const s=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);rs=s?parseInt(s[1]):0}if(qs===null){const i=navigator.userAgent.match(/Safari\/(\d+)/i);qs=i?parseInt(i[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e[0].pts,r=e.reduce((i,s)=>{let l=s.pts,c=l-i;return c<-4294967296&&(t=!0,l=pi(l,n),c=l-i),c>0?i:l},n);return t&&this.logger.debug("PTS rollover detected"),r}remux(e,t,n,r,i,s,l,c){let u,f,d,_,b,E,Z=i,N=i;const ae=e.pid>-1,Pe=t.pid>-1,ye=t.samples.length,$e=e.samples.length>0,We=l&&ye>0||ye>1;if((!ae||$e)&&(!Pe||We)||this.ISGenerated||l){if(this.ISGenerated){var Ye,st,dt,Xe;const Dn=this.videoTrackConfig;(Dn&&(t.width!==Dn.width||t.height!==Dn.height||((Ye=t.pixelRatio)==null?void 0:Ye[0])!==((st=Dn.pixelRatio)==null?void 0:st[0])||((dt=t.pixelRatio)==null?void 0:dt[1])!==((Xe=Dn.pixelRatio)==null?void 0:Xe[1]))||!Dn&&We||this.nextAudioPts===null&&$e)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,i,s));const $t=this.isVideoContiguous;let pn=-1,Vn;if(We&&(pn=Zl(t.samples),!$t&&this.config.forceKeyFrameOnDiscontinuity))if(E=!0,pn>0){this.logger.warn(`[mp4-remuxer]: Dropped ${pn} out of ${ye} video samples due to a missing keyframe`);const Dn=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(pn),t.dropped+=pn,N+=(t.samples[0].pts-Dn)/t.inputTimeScale,Vn=N}else pn===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${ye} video samples`),E=!1);if(this.ISGenerated){if($e&&We){const Dn=this.getVideoStartPts(t.samples),gn=(pi(e.samples[0].pts,Dn)-Dn)/t.inputTimeScale;Z+=Math.max(0,gn),N+=Math.max(0,-gn)}if($e){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(e,t,i,s)),f=this.remuxAudio(e,Z,this.isAudioContiguous,s,Pe||We||c===oe.AUDIO?N:void 0),We){const Dn=f?f.endPTS-f.startPTS:0;t.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(e,t,i,s)),u=this.remuxVideo(t,N,$t,Dn)}}else We&&(u=this.remuxVideo(t,N,$t,0));u&&(u.firstKeyFrame=pn,u.independent=pn!==-1,u.firstKeyFramePTS=Vn)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(b=za(n,i,this._initPTS,this._initDTS)),r.samples.length&&(_=Wa(r,i,this._initPTS))),{audio:f,video:u,initSegment:d,independent:E,text:_,id3:b}}generateIS(e,t,n,r){const i=e.samples,s=t.samples,l=this.typeSupported,c={},u=this._initPTS;let f=!u||r,d="audio/mp4",_,b,E,Z;if(f&&(_=b=1/0),e.config&&i.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":l.mpeg?(d="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:d,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&l.mpeg?new Uint8Array(0):tt.initSegment([e]),metadata:{channelCount:e.channelCount}},f&&(Z=e.id,E=e.inputTimeScale,!u||E!==u.timescale?_=b=i[0].pts-Math.round(E*n):f=!1)}if(t.sps&&t.pps&&s.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:tt.initSegment([t]),metadata:{width:t.width,height:t.height}},f)if(Z=t.id,E=t.inputTimeScale,!u||E!==u.timescale){const N=this.getVideoStartPts(s),ae=Math.round(E*n);b=Math.min(b,pi(s[0].dts,N)-ae),_=Math.min(_,N-ae)}else f=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,f?(this._initPTS={baseTime:_,timescale:E},this._initDTS={baseTime:b,timescale:E}):_=E=void 0,{tracks:c,initPTS:_,timescale:E,trackId:Z}}remuxVideo(e,t,n,r){const i=e.inputTimeScale,s=e.samples,l=[],c=s.length,u=this._initPTS;let f=this.nextAvcDts,d=8,_=this.videoSampleDuration,b,E,Z=Number.POSITIVE_INFINITY,N=Number.NEGATIVE_INFINITY,ae=!1;if(!n||f===null){const Ht=t*i,nn=s[0].pts-pi(s[0].dts,s[0].pts);rs&&f!==null&&Math.abs(Ht-nn-f)<15e3?n=!0:f=Ht-nn}const Pe=u.baseTime*i/u.timescale;for(let Ht=0;Ht<c;Ht++){const nn=s[Ht];nn.pts=pi(nn.pts-Pe,f),nn.dts=pi(nn.dts-Pe,f),nn.dts<s[Ht>0?Ht-1:Ht].dts&&(ae=!0)}ae&&s.sort(function(Ht,nn){const sr=Ht.dts-nn.dts,qn=Ht.pts-nn.pts;return sr||qn}),b=s[0].dts,E=s[s.length-1].dts;const ye=E-b,$e=ye?Math.round(ye/(c-1)):_||e.inputTimeScale/30;if(n){const Ht=b-f,nn=Ht>$e,sr=Ht<-1;if((nn||sr)&&(nn?this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${gs(Ht,!0)} ms (${Ht}dts) hole between fragments detected at ${t.toFixed(3)}`):this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${gs(-Ht,!0)} ms (${Ht}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!sr||f>=s[0].pts||rs)){b=f;const qn=s[0].pts-Ht;if(nn)s[0].dts=b,s[0].pts=qn;else{let vr=!0;for(let br=0;br<s.length&&!(s[br].dts>qn&&vr);br++){const Tr=s[br].pts;if(s[br].dts-=Ht,s[br].pts-=Ht,br<s.length-1){const Rr=s[br+1].pts,ei=s[br].pts,si=Rr<=ei,Zi=Rr<=Tr;vr=si==Zi}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${gs(qn,!0)}/${gs(b,!0)}, delta: ${gs(Ht,!0)} ms`)}}b=Math.max(0,b);let We=0,ht=0,Ye=b;for(let Ht=0;Ht<c;Ht++){const nn=s[Ht],sr=nn.units,qn=sr.length;let vr=0;for(let br=0;br<qn;br++)vr+=sr[br].data.length;ht+=vr,We+=qn,nn.length=vr,nn.dts<Ye?(nn.dts=Ye,Ye+=$e/4|0||1):Ye=nn.dts,Z=Math.min(nn.pts,Z),N=Math.max(nn.pts,N)}E=s[c-1].dts;const st=ht+4*We+8;let dt;try{dt=new Uint8Array(st)}catch(Ht){this.observer.emit(p.ERROR,p.ERROR,{type:le.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:Ht,bytes:st,reason:`fail allocating video mdat ${st}`});return}const Xe=new DataView(dt.buffer);Xe.setUint32(0,st),dt.set(tt.types.mdat,4);let $t=!1,pn=Number.POSITIVE_INFINITY,Vn=Number.POSITIVE_INFINITY,Dn=Number.NEGATIVE_INFINITY,Cn=Number.NEGATIVE_INFINITY;for(let Ht=0;Ht<c;Ht++){const nn=s[Ht],sr=nn.units;let qn=0;for(let Tr=0,Rr=sr.length;Tr<Rr;Tr++){const ei=sr[Tr],si=ei.data,Zi=ei.data.byteLength;Xe.setUint32(d,Zi),d+=4,dt.set(si,d),d+=Zi,qn+=4+Zi}let vr;if(Ht<c-1)_=s[Ht+1].dts-nn.dts,vr=s[Ht+1].pts-nn.pts;else{const Tr=this.config,Rr=Ht>0?nn.dts-s[Ht-1].dts:$e;if(vr=Ht>0?nn.pts-s[Ht-1].pts:$e,Tr.stretchShortVideoTrack&&this.nextAudioPts!==null){const ei=Math.floor(Tr.maxBufferHole*i),si=(r?Z+r*i:this.nextAudioPts)-nn.pts;si>ei?(_=si-Rr,_<0?_=Rr:$t=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${si/90} ms to the next segment; using duration ${_/90} ms for the last video frame.`)):_=Rr}else _=Rr}const br=Math.round(nn.pts-nn.dts);pn=Math.min(pn,_),Dn=Math.max(Dn,_),Vn=Math.min(Vn,vr),Cn=Math.max(Cn,vr),l.push(Va(nn.key,_,qn,br))}if(l.length){if(rs){if(rs<70){const Ht=l[0].flags;Ht.dependsOn=2,Ht.isNonSync=0}}else if(qs&&Cn-Vn<Dn-pn&&$e/Dn<.025&&l[0].cts===0){this.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Ht=b;for(let nn=0,sr=l.length;nn<sr;nn++){const qn=Ht+l[nn].duration,vr=Ht+l[nn].cts;if(nn<sr-1){const br=qn+l[nn+1].cts;l[nn].duration=br-vr}else l[nn].duration=nn?l[nn-1].duration:$e;l[nn].cts=0,Ht=qn}}}_=$t||!_?$e:_,this.nextAvcDts=f=E+_,this.videoSampleDuration=_,this.isVideoContiguous=!0;const Fn={data1:tt.moof(e.sequenceNumber++,b,h(e,{samples:l})),data2:dt,startPTS:Z/i,endPTS:(N+_)/i,startDTS:b/i,endDTS:f/i,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Fn}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return $l;case"ac3":return Kl;default:return Ul}}remuxAudio(e,t,n,r,i){const s=e.inputTimeScale,l=e.samplerate?e.samplerate:s,c=s/l,u=this.getSamplesPerFrame(e),f=u*c,d=this._initPTS,_=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,b=[],E=i!==void 0;let Z=e.samples,N=_?0:8,ae=this.nextAudioPts||-1;const Pe=t*s,ye=d.baseTime*s/d.timescale;if(this.isAudioContiguous=n=n||Z.length&&ae>0&&(r&&Math.abs(Pe-ae)<9e3||Math.abs(pi(Z[0].pts-ye,Pe)-ae)<20*f),Z.forEach(function(gn){gn.pts=pi(gn.pts-ye,Pe)}),!n||ae<0){if(Z=Z.filter(gn=>gn.pts>=0),!Z.length)return;i===0?ae=0:r&&!E?ae=Math.max(0,Pe):ae=Z[0].pts}if(e.segmentCodec==="aac"){const gn=this.config.maxAudioFramesDrift;for(let kn=0,Fn=ae;kn<Z.length;kn++){const Ht=Z[kn],nn=Ht.pts,sr=nn-Fn,qn=Math.abs(1e3*sr/s);if(sr<=-gn*f&&E)kn===0&&(this.logger.warn(`Audio frame @ ${(nn/s).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*sr/s)} ms.`),this.nextAudioPts=ae=Fn=nn);else if(sr>=gn*f&&qn<Bl&&E){let vr=Math.round(sr/f);Fn=nn-vr*f,Fn<0&&(vr--,Fn+=f),kn===0&&(this.nextAudioPts=ae=Fn),this.logger.warn(`[mp4-remuxer]: Injecting ${vr} audio frame @ ${(Fn/s).toFixed(3)}s due to ${Math.round(1e3*sr/s)} ms gap.`);for(let br=0;br<vr;br++){const Tr=Math.max(Fn,0);let Rr=Ml.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Rr||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Rr=Ht.unit.subarray()),Z.splice(kn,0,{unit:Rr,pts:Tr}),Fn+=f,kn++}}Ht.pts=Fn,Fn+=f}}let $e=null,We=null,ht,Ye=0,st=Z.length;for(;st--;)Ye+=Z[st].unit.byteLength;for(let gn=0,kn=Z.length;gn<kn;gn++){const Fn=Z[gn],Ht=Fn.unit;let nn=Fn.pts;if(We!==null){const qn=b[gn-1];qn.duration=Math.round((nn-We)/c)}else if(n&&e.segmentCodec==="aac"&&(nn=ae),$e=nn,Ye>0){Ye+=N;try{ht=new Uint8Array(Ye)}catch(qn){this.observer.emit(p.ERROR,p.ERROR,{type:le.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:qn,bytes:Ye,reason:`fail allocating audio mdat ${Ye}`});return}_||(new DataView(ht.buffer).setUint32(0,Ye),ht.set(tt.types.mdat,4))}else return;ht.set(Ht,N);const sr=Ht.byteLength;N+=sr,b.push(Va(!0,u,sr,0)),We=nn}const dt=b.length;if(!dt)return;const Xe=b[b.length-1];this.nextAudioPts=ae=We+c*Xe.duration;const $t=_?new Uint8Array(0):tt.moof(e.sequenceNumber++,$e/c,h({},e,{samples:b}));e.samples=[];const pn=$e/s,Vn=ae/s,Cn={data1:$t,data2:ht,startPTS:pn,endPTS:Vn,startDTS:pn,endDTS:Vn,type:"audio",hasAudio:!0,hasVideo:!1,nb:dt};return this.isAudioContiguous=!0,Cn}}function pi(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 Zl(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function za(a,e,t,n){const r=a.samples.length;if(!r)return;const i=a.inputTimeScale;for(let l=0;l<r;l++){const c=a.samples[l];c.pts=pi(c.pts-t.baseTime*i/t.timescale,e*i)/i,c.dts=pi(c.dts-n.baseTime*i/n.timescale,e*i)/i}const s=a.samples;return a.samples=[],{samples:s}}function Wa(a,e,t){const n=a.samples.length;if(!n)return;const r=a.inputTimeScale;for(let s=0;s<n;s++){const l=a.samples[s];l.pts=pi(l.pts-t.baseTime*r/t.timescale,e*r)/r}a.samples.sort((s,l)=>s.pts-l.pts);const i=a.samples;return a.samples=[],{samples:i}}class Gl{constructor(e,t,n,r){this.logger=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1,this.logger=r}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,n,r){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(X(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=ke(e);r.audio&&(t=Ha(r.audio,g.AUDIO,this.logger)),r.video&&(n=Ha(r.video,g.VIDEO,this.logger));const i={};r.audio&&r.video?i.audiovideo={container:"video/mp4",codec:t+","+n,supplemental:r.video.supplemental,initSegment:e,id:"main"}:r.audio?i.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?i.video={container:"video/mp4",codec:n,supplemental:r.video.supplemental,initSegment:e,id:"main"}:this.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i}remux(e,t,n,r,i,s){var l,c;let{initPTS:u,lastEndTime:f}=this;const d={audio:void 0,video:void 0,text:r,id3:n,initSegment:void 0};k(f)||(f=this.lastEndTime=i||0);const _=t.samples;if(!(_!=null&&_.length))return d;const b={initPTS:void 0,timescale:void 0,trackId:void 0};let E=this.initData;if((l=E)!=null&&l.length||(this.generateInitSegment(_),E=this.initData),!((c=E)!=null&&c.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),d;this.emitInitSegment&&(b.tracks=this.initTracks,this.emitInitSegment=!1);const Z=Q(_,E,this.logger),N=E.audio?Z[E.audio.id]:null,ae=E.video?Z[E.video.id]:null,Pe=Ls(ae,1/0),ye=Ls(N,1/0),$e=Ls(ae,0,!0),We=Ls(N,0,!0);let ht,Ye=i,st=0;if(N&&(!ae||!u&&ye<Pe||u&&u.trackId===E.audio.id)?(b.trackId=E.audio.id,ht=N,st=We-ye):ae&&(b.trackId=E.video.id,ht=ae,st=$e-Pe),ht){const gn=ht.timescale;Ye=ht.start/gn,b.timescale=gn,u||(b.initPTS=ht.start-i*gn,this.initPTS=u={baseTime:b.initPTS,timescale:gn,trackId:b.trackId})}(s||!u)&&(Vl(u,Ye,i,st)||b.timescale!==u.timescale)&&(b.initPTS=Ye-i,u&&u.timescale===1&&this.logger.warn(`Adjusting initPTS @${i} from ${u.baseTime/u.timescale} to ${b.initPTS}`),this.initPTS=u={baseTime:b.initPTS,timescale:1});const dt=e?Ye-u.baseTime/u.timescale:f;se(E,_,u.baseTime/u.timescale);const Xe=dt+st;st>0?this.lastEndTime=Xe:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const $t=!!E.audio,pn=!!E.video;let Vn="";$t&&(Vn+="audio"),pn&&(Vn+="video");const Dn={data1:_,startPTS:dt,startDTS:dt,endPTS:Xe,endDTS:Xe,type:Vn,hasAudio:$t,hasVideo:pn,nb:1,dropped:0};d.audio=$t&&!pn?Dn:void 0,d.video=pn?Dn:void 0;const Cn=ae==null?void 0:ae.sampleCount;if(Cn){const gn=ae.keyFrameIndex,kn=gn!==-1;Dn.nb=Cn,Dn.dropped=gn===0||this.isVideoContiguous?0:kn?gn:Cn,Dn.independent=kn,Dn.firstKeyFrame=gn,kn&&ae.keyFrameStart&&(Dn.firstKeyFramePTS=ae.keyFrameStart-u.baseTime/u.timescale),this.isVideoContiguous||(d.independent=kn),this.isVideoContiguous||(this.isVideoContiguous=kn),Dn.dropped&&this.logger.warn(`fmp4 does not start with IDR: firstIDR ${gn}/${Cn} dropped: ${Dn.dropped} pts: ${Dn.firstKeyFramePTS||"NA"}`)}return d.initSegment=b,d.id3=za(n,i,u,u),r.samples.length&&(d.text=Wa(r,i,u)),d}}function Ls(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function Vl(a,e,t,n){if(a===null)return!0;const r=Math.max(n,1),i=e-a.baseTime/a.timescale;return Math.abs(i-t)>r}function Ha(a,e,t){const n=a==null?void 0:a.codec;return n&&n.length>4?n:e===g.AUDIO?n==="ec-3"||n==="ac-3"||n==="alac"?n:n==="fLaC"||n==="Opus"?Ve(n,!1):(t.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"):(t.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1")}let Ii;try{Ii=self.performance.now.bind(self.performance)}catch(a){Ii=Date.now}const ks=[{demux:Ll,remux:Gl},{demux:Bi,remux:Is},{demux:Dl,remux:Is},{demux:Cl,remux:Is}];ks.splice(2,0,{demux:Rl,remux:Is});class ja{constructor(e,t,n,r,i,s){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=n,this.id=i,this.logger=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,r){const i=n.transmuxing;i.executeStart=Ii();let s=new Uint8Array(e);const{currentTransmuxState:l,transmuxConfig:c}=this;r&&(this.currentTransmuxState=r);const{contiguous:u,discontinuity:f,trackSwitch:d,accurateTimeOffset:_,timeOffset:b,initSegmentChange:E}=r||l,{audioCodec:Z,videoCodec:N,defaultInitPts:ae,duration:Pe,initSegmentData:ye}=c,$e=zl(s,t);if($e&&Mr($e.method)){const st=this.getDecrypter(),dt=Hr($e.method);if(st.isSync()){let Xe=st.softwareDecrypt(s,$e.key.buffer,$e.iv.buffer,dt);if(n.part>-1){const pn=st.flush();Xe=pn&&pn.buffer}if(!Xe)return i.executeEnd=Ii(),ea(n);s=new Uint8Array(Xe)}else return this.asyncResult=!0,this.decryptionPromise=st.webCryptoDecrypt(s,$e.key.buffer,$e.iv.buffer,dt).then(Xe=>{const $t=this.push(Xe,null,n);return this.decryptionPromise=null,$t}),this.decryptionPromise}const We=this.needsProbing(f,d);if(We){const st=this.configureTransmuxer(s);if(st)return this.logger.warn(`[transmuxer] ${st.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:le.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:st,reason:st.message}),i.executeEnd=Ii(),ea(n)}(f||d||E||We)&&this.resetInitSegment(ye,Z,N,Pe,t),(f||E||We)&&this.resetInitialTimestamp(ae),u||this.resetContiguity();const ht=this.transmux(s,$e,b,_,n);this.asyncResult=ms(ht);const Ye=this.currentTransmuxState;return Ye.contiguous=!0,Ye.discontinuity=!1,Ye.trackSwitch=!1,i.executeEnd=Ii(),ht}flush(e){const t=e.transmuxing;t.executeStart=Ii();const{decrypter:n,currentTransmuxState:r,decryptionPromise:i}=this;if(i)return this.asyncResult=!0,i.then(()=>this.flush(e));const s=[],{timeOffset:l}=r;if(n){const d=n.flush();d&&s.push(this.push(d.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=Ii();const d=[ea(e)];return this.asyncResult?Promise.resolve(d):d}const f=c.flush(l);return ms(f)?(this.asyncResult=!0,f.then(d=>(this.flushRemux(s,d,e),s))):(this.flushRemux(s,f,e),this.asyncResult?Promise.resolve(s):s)}flushRemux(e,t,n){const{audioTrack:r,videoTrack:i,id3Track:s,textTrack:l}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?" part: "+n.part:""} of ${this.id===oe.MAIN?"level":"track"} ${n.level}`);const f=this.remuxer.remux(r,i,s,l,u,c,!0,this.id);e.push({remuxResult:f,chunkMeta:n}),n.transmuxing.executeEnd=Ii()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,r,i){const{demuxer:s,remuxer:l}=this;!s||!l||(s.resetInitSegment(e,t,n,r),l.resetInitSegment(e,t,n,i))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,r,i){let s;return t&&t.method==="SAMPLE-AES"?s=this.transmuxSampleAes(e,t,n,r,i):s=this.transmuxUnencrypted(e,n,r,i),s}transmuxUnencrypted(e,t,n,r){const{audioTrack:i,videoTrack:s,id3Track:l,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(i,s,l,c,t,n,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,n,r,i){return this.demuxer.demuxSampleAes(e,t,n).then(s=>({remuxResult:this.remuxer.remux(s.audioTrack,s.videoTrack,s.id3Track,s.textTrack,n,r,!1,this.id),chunkMeta:i}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:r}=this;let i;for(let d=0,_=ks.length;d<_;d++){var s;if((s=ks[d].demux)!=null&&s.probe(e,this.logger)){i=ks[d];break}}if(!i)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,c=this.remuxer,u=i.remux,f=i.demux;(!c||!(c instanceof u))&&(this.remuxer=new u(n,t,r,this.logger)),(!l||!(l instanceof f))&&(this.demuxer=new f(n,t,r,this.logger),this.probe=f.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new xn(this.config)),e}}function zl(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 ea=a=>({remuxResult:{},chunkMeta:a});function ms(a){return"then"in a&&a.then instanceof Function}class Wl{constructor(e,t,n,r,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=n,this.duration=r,this.defaultInitPts=i||null}}class Hl{constructor(e,t,n,r,i,s){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=n,this.trackSwitch=r,this.timeOffset=i,this.initSegmentChange=s}}let Ya=0;class Xa{constructor(e,t,n,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Ya++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const u=c.data,f=this.hls;if(!(!f||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var d;const _=(d=this.workerContext)==null?void 0:d.objectURL;_&&self.URL.revokeObjectURL(_);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{f.logger[u.data.logType]&&f.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,f.trigger(u.event,u.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const u=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(p.ERROR,{type:le.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const i=e.config;this.hls=e,this.id=t,this.useWorker=!!i.enableWorker,this.onTransmuxComplete=n,this.onFlush=r;const s=(c,u)=>{u=u||{},u.frag=this.frag||void 0,c===p.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(c,u)};this.observer=new Ri,this.observer.on(p.FRAG_DECRYPTED,s),this.observer.on(p.ERROR,s);const l=hn(i.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(i.workerPath||qo()){try{i.workerPath?(c.log(`loading Web Worker ${i.workerPath} for "${t}"`),this.workerContext=tl(i.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=el());const{worker:f}=this.workerContext;f.addEventListener("message",this.onWorkerMessage),f.addEventListener("error",this.onWorkerError),f.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:l,id:t,config:Mt(i)})}catch(f){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,f),this.terminateWorker(),this.error=null,this.transmuxer=new ja(this.observer,l,i,"",t,e.logger)}return}}this.transmuxer=new ja(this.observer,l,i,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Ya++;const t=this.hls.config,n=hn(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:n,id:this.id,config:Mt(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),nl(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,n,r,i,s,l,c,u,f){var d,_;u.transmuxing.start=self.performance.now();const{instanceNo:b,transmuxer:E}=this,Z=s?s.start:i.start,N=i.decryptdata,ae=this.frag,Pe=!(ae&&i.cc===ae.cc),ye=!(ae&&u.level===ae.level),$e=ae?u.sn-ae.sn:-1,We=this.part?u.part-this.part.index:-1,ht=$e===0&&u.id>1&&u.id===(ae==null?void 0:ae.stats.chunkCount),Ye=!ye&&($e===1||$e===0&&(We===1||ht&&We<=0)),st=self.performance.now();(ye||$e||i.stats.parsing.start===0)&&(i.stats.parsing.start=st),s&&(We||!Ye)&&(s.stats.parsing.start=st);const dt=!(ae&&((d=i.initSegment)==null?void 0:d.url)===((_=ae.initSegment)==null?void 0:_.url)),Xe=new Hl(Pe,Ye,c,ye,Z,dt);if(!Ye||Pe||dt){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${i.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===oe.MAIN?"level":"track"}: ${u.level} id: ${u.id}
discontinuity: ${Pe}
trackSwitch: ${ye}
contiguous: ${Ye}
accurateTimeOffset: ${c}
timeOffset: ${Z}
initSegmentChange: ${dt}`);const $t=new Wl(n,r,t,l,f);this.configureTransmuxer($t)}if(this.frag=i,this.part=s,this.workerContext)this.workerContext.worker.postMessage({instanceNo:b,cmd:"demux",data:e,decryptdata:N,chunkMeta:u,state:Xe},e instanceof ArrayBuffer?[e]:[]);else if(E){const $t=E.push(e,N,u,Xe);ms($t)?$t.then(pn=>{this.handleTransmuxComplete(pn)}).catch(pn=>{this.transmuxerError(pn,u,"transmuxer-interface push error")}):this.handleTransmuxComplete($t)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(n){const r=n.flush(e);ms(r)?r.then(i=>{this.handleFlushResult(i,e)}).catch(i=>{this.transmuxerError(i,e,"transmuxer-interface flush error")}):this.handleFlushResult(r,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Qa=100;class jl extends Dr{constructor(e,t,n){super(e,t,n,"audio-stream-controller",oe.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:n,initPTS:r,timescale:i}){if(n===oe.MAIN){const s=t.cc,l=this.fragCurrent;if(this.initPTS[s]={baseTime:r,timescale:i},this.log(`InitPTS for cc: ${s} found from main: ${r}/${i}`),this.mainAnchor=t,this.state===ct.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==s)&&this.syncWithAnchor(t,c==null?void 0:c.frag)}else!this.hls.hasEnoughToStart&&l&&l.cc!==s?(l.abortRequests(),this.syncWithAnchor(t,l)):this.state===ct.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var n;const r=((n=this.mainFragLoading)==null?void 0:n.frag)||null;if(t&&(r==null?void 0:r.cc)===t.cc)return;const i=(r||e).cc,s=this.getLevelDetails(),l=this.getLoadPosition(),c=Wt(s,i,l);c&&(this.log(`Waiting fragment cc (${t==null?void 0:t.cc}) cancelled because video is at cc ${e.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===ct.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=ct.STOPPED;return}const n=this.lastCurrentTime;this.stopLoad(),this.setInterval(Qa),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=ct.IDLE):this.state=ct.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case ct.IDLE:this.doTickIdle();break;case ct.WAITING_TRACK:{const{levels:t,trackId:n}=this,r=t==null?void 0:t[n],i=r==null?void 0:r.details;if(i&&!this.waitForLive(r)){if(this.waitForCdnTuneIn(i))break;this.state=ct.WAITING_INIT_PTS}break}case ct.FRAG_LOADING_WAITING_RETRY:{var e;const t=performance.now(),n=this.retryDate;if(!n||t>=n||(e=this.media)!=null&&e.seeking){const{levels:r,trackId:i}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((r==null?void 0:r[i])||null),this.state=ct.IDLE}break}case ct.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:n,part:r,cache:i,complete:s}=t,l=this.mainAnchor;if(this.initPTS[n.cc]!==void 0){this.waitingData=null,this.state=ct.FRAG_LOADING;const c=i.flush().buffer,u={frag:n,part:r,payload:c,networkDetails:null};this._handleFragmentLoadProgress(u),s&&super._handleFragmentLoadComplete(u)}else l&&l.cc!==t.frag.cc&&this.syncWithAnchor(l,t.frag)}else this.state=ct.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:n,media:r,trackId:i}=this,s=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!s.startFragPrefetch)||!(n!=null&&n[i]))return;const l=n[i],c=l.details;if(!c||this.waitForLive(l)||this.waitForCdnTuneIn(c)){this.state=ct.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,g.AUDIO,oe.AUDIO));const f=this.getFwdBufferInfo(u,oe.AUDIO);if(f===null)return;if(!this.switchingTrack&&this._streamEnded(f,c)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=ct.ENDED;return}const d=f.len,_=t.maxBufferLength,b=c.fragments,E=b[0].start,Z=this.getLoadPosition(),N=this.flushing?Z:f.end;if(this.switchingTrack&&r){const ye=Z;c.PTSKnown&&ye<E&&(f.end>E||f.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=E+.05)}if(d>=_&&!this.switchingTrack&&N<b[b.length-1].start)return;let ae=this.getNextFragment(N,c);if(ae&&this.isLoopLoading(ae,N)&&(ae=this.getNextFragmentLoopLoading(ae,c,f,oe.MAIN,_)),!ae){this.bufferFlushed=!0;return}let Pe=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&Pe&&te(ae)&&!ae.endList&&(!c.live||!this.loadingParts&&N<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(Pe)===Kn.OK&&(this.mainFragLoading=Pe=null),Pe&&te(Pe))){if(ae.start>Pe.end){const $e=this.fragmentTracker.getFragAtPos(N,oe.MAIN);$e&&$e.end>Pe.end&&(Pe=$e,this.mainFragLoading={frag:$e,targetBufferTime:null})}if(ae.start>Pe.end)return}this.loadFragment(ae,l,N)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(n=>new rt(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==ct.STOPPED&&(this.setInterval(Qa),this.state=ct.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(p.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;const{levels:r}=this,{details:i,id:s,groupId:l,track:c}=t;if(!r){this.warn(`Audio tracks reset while loading track ${s} "${c.name}" of "${l}"`);return}const u=this.mainDetails;if(!u||i.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==ct.STOPPED&&(this.state=ct.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${s} "${c.name}" of "${l}" loaded [${i.startSN},${i.endSN}]${i.lastPartSn?`[part-${i.lastPartSn}-${i.lastPartIndex}]`:""},duration:${i.totalduration}`);const f=r[s];let d=0;if(i.live||(n=f.details)!=null&&n.live){if(this.checkLiveUpdate(i),i.deltaUpdateFailed)return;if(f.details){var _;d=this.alignPlaylists(i,f.details,(_=this.levelLastLoaded)==null?void 0:_.details)}i.alignedSliding||(xs(i,u),i.alignedSliding||es(i,u),d=i.fragmentStart)}f.details=i,this.levelLastLoaded=f,this.startFragRequested||this.setStartPosition(u,d),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:i,id:s,groupId:t.groupId}),this.state===ct.WAITING_TRACK&&!this.waitForCdnTuneIn(i)&&(this.state=ct.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:r,payload:i}=e,{config:s,trackId:l,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const u=c[l];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const f=u.details;if(!f){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const d=s.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let _=this.transmuxer;_||(_=this.transmuxer=new Xa(this.hls,oe.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const b=this.initPTS[n.cc],E=(t=n.initSegment)==null?void 0:t.data;if(b!==void 0){const N=r?r.index:-1,ae=N!==-1,Pe=new Tn(n.level,n.sn,n.stats.chunkCount,i.byteLength,N,ae);_.push(i,E,d,"",n,r,f.totalduration,!1,Pe,b)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${f.startSN} ,${f.endSN}],track ${l}`);const{cache:Z}=this.waitingData=this.waitingData||{frag:n,part:r,cache:new Yr,complete:!1};Z.push(new Uint8Array(i)),this.state!==ct.STOPPED&&(this.state=ct.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===oe.MAIN&&te(t.frag)&&(this.mainFragLoading=t,this.state===ct.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:n,part:r}=t;if(n.type!==oe.AUDIO){!this.audioOnly&&n.type===oe.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?" p: "+r.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(te(n)){this.fragPrevious=n;const i=this.switchingTrack;i&&(this.bufferedTrack=i,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,y({},i)))}this.fragBufferedComplete(n,r),this.media&&this.tick()}onError(e,t){var n;if(t.fatal){this.state=ct.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(oe.AUDIO,t);break;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ct.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===he.AUDIO_TRACK&&(this.state=ct.IDLE);break;case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case K.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==g.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==g.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===ct.ENDED&&(this.state=ct.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,oe.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:r}=this,{remuxResult:i,chunkMeta:s}=e,l=this.getCurrentContext(s);if(!l){this.resetWhenMissingContext(s);return}const{frag:c,part:u,level:f}=l,{details:d}=f,{audio:_,text:b,id3:E,initSegment:Z}=i;if(this.fragContextChanged(c)||!d){this.fragmentTracker.removeFragment(c);return}if(this.state=ct.PARSING,this.switchingTrack&&_&&this.completeAudioSwitch(this.switchingTrack),Z!=null&&Z.tracks){const N=c.initSegment||c;this._bufferInitSegment(f,Z.tracks,N,s),r.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:n,tracks:Z.tracks})}if(_){const{startPTS:N,endPTS:ae,startDTS:Pe,endDTS:ye}=_;u&&(u.elementaryStreams[g.AUDIO]={startPTS:N,endPTS:ae,startDTS:Pe,endDTS:ye}),c.setElementaryStreamInfo(g.AUDIO,N,ae,Pe,ye),this.bufferFragmentData(_,c,u,s)}if(E!=null&&(t=E.samples)!=null&&t.length){const N=h({id:n,frag:c,details:d},E);r.trigger(p.FRAG_PARSING_METADATA,N)}if(b){const N=h({id:n,frag:c,details:d},b);r.trigger(p.FRAG_PARSING_USERDATA,N)}}_bufferInitSegment(e,t,n,r){if(this.state!==ct.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const i=t.audio;i.id=oe.AUDIO;const s=e.audioCodec;this.log(`Init audio buffer, container:${i.container}, codecs[level/parsed]=[${s}/${i.codec}]`),s&&s.split(",").length===1&&(i.levelCodec=s),this.hls.trigger(p.BUFFER_CODECS,t);const l=i.initSegment;if(l!=null&&l.byteLength){const c={type:"audio",frag:n,part:null,chunkMeta:r,parent:n.type,data:l};this.hls.trigger(p.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,n){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===Kn.NOT_LOADED||r===Kn.PARTIAL){var i;if(!te(e))this._loadInitSegment(e,t);else if((i=t.details)!=null&&i.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=ct.WAITING_INIT_PTS;const s=this.mainDetails;s&&s.fragmentStart!==t.details.fragmentStart&&es(t.details,s)}else super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:n,assocLang:r,characteristics:i,audioCodec:s,channels:l}=this.bufferedTrack;Ze({name:t,lang:n,assocLang:r,characteristics:i,audioCodec:s,channels:l},e,lt)||(Gt(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 ta extends G{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,n){const r=t==null?void 0:t.renditionReports;if(r){let i=-1;for(let s=0;s<r.length;s++){const l=r[s];let c;try{c=new self.URL(l.URI,t.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),c=l.URI||""}if(c===e){i=s;break}else c===e.substring(0,c.length)&&(i=s)}if(i!==-1){const s=r[i],l=parseInt(s["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let c=parseInt(s["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const f=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&f>t.partTarget&&(c+=1)}const u=n&&Le(n);return new At(l,c>=0?c:void 0,u)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}return e}playlistLoaded(e,t,n){const{details:r,stats:i}=t,s=self.performance.now(),l=i.loading.first?Math.max(0,s-i.loading.first):0;r.advancedDateTime=Date.now()-l;const c=this.hls.config.timelineOffset;if(c!==r.appliedTimelineOffset){const f=Math.max(c||0,0);r.appliedTimelineOffset=f,r.fragments.forEach(d=>{d.start=d.playlistOffset+f})}if(r.live||n!=null&&n.live){const f="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(n),n&&r.fragments.length>0){fs(n,r);const Pe=r.playlistParsingError;if(Pe){this.warn(Pe);const ye=this.hls;if(!ye.config.ignorePlaylistParsingErrors){var u;const{networkDetails:$e}=t;ye.trigger(p.ERROR,{type:le.NETWORK_ERROR,details:K.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:Pe,reason:Pe.message,level:t.level||void 0,parent:(u=r.fragments[0])==null?void 0:u.type,networkDetails:$e,stats:i});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=i.loading.start);const d=this.hls.mainForwardBufferInfo,_=d?d.end-d.len:0,b=(r.edge-_)*1e3,E=$r(r,b);if(r.requestScheduled+E<s?r.requestScheduled=s:r.requestScheduled+=E,this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),!this.canLoad||!r.live)return;let Z,N,ae;if(r.canBlockReload&&r.endSN&&r.advanced){const Pe=this.hls.config.lowLatencyMode,ye=r.lastPartSn,$e=r.endSN,We=r.lastPartIndex,ht=We!==-1,Ye=ye===$e;ht?Ye?(N=$e+1,ae=Pe?0:We):(N=ye,ae=Pe?We+1:r.maxPartIndex):N=$e+1;const st=r.age,dt=st+r.ageHeader;let Xe=Math.min(dt-r.partTarget,r.targetduration*1.5);if(Xe>0){if(dt>r.targetduration*3)this.log(`Playlist last advanced ${st.toFixed(2)}s ago. Omitting segment and part directives.`),N=void 0,ae=void 0;else if(n!=null&&n.tuneInGoal&&dt-r.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${Xe} with playlist age: ${r.age}`),Xe=0;else{const $t=Math.floor(Xe/r.targetduration);if(N+=$t,ae!==void 0){const pn=Math.round(Xe%r.targetduration/r.partTarget);ae+=pn}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${st.toFixed(2)}s goal: ${Xe} skip sn ${$t} to part ${ae}`)}r.tuneInGoal=Xe}if(Z=this.getDeliveryDirectives(r,t.deliveryDirectives,N,ae),Pe||!Ye){r.requestScheduled=s,this.loadingPlaylist(f,Z);return}}else(r.canBlockReload||r.canSkipUntil)&&(Z=this.getDeliveryDirectives(r,t.deliveryDirectives,N,ae));Z&&N!==void 0&&r.canBlockReload&&(r.requestScheduled=i.loading.first+Math.max(E-l*2,E/2)),this.scheduleLoading(f,Z,r)}else this.clearTimer()}scheduleLoading(e,t,n){const r=n||e.details;if(!r){this.loadingPlaylist(e,t);return}const i=self.performance.now(),s=r.requestScheduled;if(i>=s){this.loadingPlaylist(e,t);return}const l=s-i;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(l)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),l)}getDeliveryDirectives(e,t,n,r){let i=Le(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,r=t.part,i=Oe.No),new At(n,r,i)}checkRetry(e){const t=e.details,n=Bt(e),r=e.errorAction,{action:i,retryCount:s=0,retryConfig:l}=r||{},c=!!r&&!!l&&(i===jt.RetryRequest||!r.resolved&&i===jt.SendAlternateToPenaltyBox);if(c){var u;if(s>=l.maxNumRetry)return!1;if(n&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${l.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const f=an(l,s);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),f),this.warn(`Retrying playlist loading ${s+1}/${l.maxNumRetry} after "${t}" in ${f}ms`)}e.levelRetry=!0,r.resolved=!0}return c}}function Ja(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!vs(a[t].attrs,e[t].attrs))return!1;return!0}function vs(a,e,t){const n=a["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>a[r]!==e[r])}function na(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class Yl extends ta{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:n,groupId:r,details:i}=t,s=this.tracksInGroup[n];if(!s||s.groupId!==r){this.warn(`Audio track with id:${n} and group:${r} not found in active group ${s==null?void 0:s.groupId}`);return}const l=s.details;s.details=t.details,this.log(`Audio track ${n} "${s.name}" lang:${s.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,l)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const n=t.audioGroups||null,r=this.groupIds;let i=this.currentTrack;if(!n||(r==null?void 0:r.length)!==(n==null?void 0:n.length)||n!=null&&n.some(l=>(r==null?void 0:r.indexOf(l))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const l=this.tracks.filter(_=>!n||n.indexOf(_.groupId)!==-1);if(l.length)this.selectDefaultTrack&&!l.some(_=>_.default)&&(this.selectDefaultTrack=!1),l.forEach((_,b)=>{_.id=b});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=l;const c=this.hls.config.audioPreference;if(!i&&c){const _=Ae(c,l,lt);if(_>-1)i=l[_];else{const b=Ae(c,this.tracks);i=this.tracks[b]}}let u=this.findTrackId(i);u===-1&&i&&(u=this.findTrackId(null));const f={audioTracks:l};this.log(`Updating audio tracks, ${l.length} track(s) found in group(s): ${n==null?void 0:n.join(",")}`),this.hls.trigger(p.AUDIO_TRACKS_UPDATED,f);const d=this.trackId;if(u!==-1&&d===-1)this.setAudioTrack(u);else if(l.length&&d===-1){var s;const _=new Error(`No audio track selected for current audio group-ID(s): ${(s=this.groupIds)==null?void 0:s.join(",")} track count: ${l.length}`);this.warn(_.message),this.hls.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:_})}}}onError(e,t){t.fatal||!t.context||t.context.type===he.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const r=this.currentTrack;if(r&&Ze(e,r,lt))return r;const i=Ae(e,this.tracksInGroup,lt);if(i>-1){const s=this.tracksInGroup[i];return this.setAudioTrack(i),s}else if(r){let s=t.loadLevel;s===-1&&(s=t.firstAutoLevel);const l=pt(e,t.levels,n,s,lt);if(l===-1)return null;t.nextLoadLevel=l}if(e.channels||e.audioCodec){const s=Ae(e,n);if(s>-1)return n[s]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,r=t[e],i=r.details&&!r.details.live;if(e===this.trackId&&r===n&&i||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(p.AUDIO_TRACK_SWITCHING,y({},r)),i))return;const s=this.switchParams(r.url,n==null?void 0:n.details,r.details);this.loadPlaylist(s)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const r=t[n];if(!(this.selectDefaultTrack&&!r.default)&&(!e||Ze(e,r,lt)))return n}if(e){const{name:n,lang:r,assocLang:i,characteristics:s,audioCodec:l,channels:c}=e;for(let u=0;u<t.length;u++){const f=t[u];if(Ze({name:n,lang:r,assocLang:i,characteristics:s,audioCodec:l,channels:c},f,lt))return u}for(let u=0;u<t.length;u++){const f=t[u];if(vs(e.attrs,f.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const f=t[u];if(vs(e.attrs,f.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Gt(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,t),s=e.details,l=s==null?void 0:s.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${l&&s.live?" age "+l.toFixed(1)+(s.type?" "+s.type||0:""):""} ${i}`),this.hls.trigger(p.AUDIO_TRACK_LOADING,{url:i,id:n,groupId:r,deliveryDirectives:t||null,track:e})}}class Xl{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(this.queues===null||this.tracks===null)return;const r=this.queues[t];r.push(e),r.length===1&&!n&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const n={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const n={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const n=(t=e[0])==null?void 0:t.label;(n==="async-blocker"||n==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const r=t[0];try{r.execute()}catch(i){var n;if(r.onError(i),this.queues===null||this.tracks===null)return;const s=(n=this.tracks[e])==null?void 0:n.buffer;s!=null&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(e){var t,n;return(t=this.queues)!=null&&t[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const n=(t=this.tracks)==null?void 0:t[e],r=n==null?void 0:n.buffer;return r?`SourceBuffer${r.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(n=>n.label).join(", "))||""}}const qa=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,eo="HlsJsTrackRemovedError";class Ql extends Error{constructor(e){super(e),this.name=eo}}class Jl extends G{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=n=>{var r;this.hls&&((r=this.mediaSource)==null?void 0:r.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=n=>{const{media:r,mediaSource:i}=this;n&&this.log("Media source opened"),!(!r||!i)&&(i.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:r,mediaSource:i}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:r}=this;n!==r&&this.error(`Media element src was set while attaching MediaSource (${r} > ${n})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=ge(ue(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 n={};if(this.operationQueue){const i=this.isUpdating();i||this.operationQueue.removeBlockers();const s=this.isQueued();(i||s)&&this.warn(`Transfering MediaSource with${s?" operations in queue":""}${i?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?h(n,r.tracks):this.sourceBuffers.forEach(i=>{const[s]=i;s&&(n[s]=h({},this.tracks[s]),this.removeBuffer(s)),i[0]=i[1]=null}),{media:e,mediaSource:t,tracks:n}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var n;let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){const n=this.media=t.media,r=ue(this.appendSource);if(this.transferData=this.overrides=void 0,n&&r){const i=!!t.mediaSource;(i||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const s=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(s),i)this._objectUrl=n.src,this.attachTransferred();else{const l=this._objectUrl=self.URL.createObjectURL(s);if(this.appendSource)try{n.removeAttribute("src");const c=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||c&&s instanceof c,to(n),ql(n,l),n.load()}catch(c){n.src=l}else n.src=l}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,n;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(n=e.constructor)==null?void 0:n.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const n=this.tracks,r=t.tracks,i=r?Object.keys(r):null,s=i?i.length:0,l=()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()};if(r&&i&&s){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: ${Mt(n,(c,u)=>c==="initSegment"?void 0:u)};
transfer tracks: ${Mt(r,(c,u)=>c==="initSegment"?void 0:u)}}`),!Ee(r,n)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,u=this.details,f=Math.max(c,(u==null?void 0:u.fragments[0].start)||0);if(f-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${f}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(n)}") start time: ${f} currentTime: ${c}`),this.onMediaDetaching(p.MEDIA_DETACHING,{}),this.onMediaAttaching(p.MEDIA_ATTACHING,t),e.currentTime=f;return}this.transferData=void 0,i.forEach(c=>{const u=c,f=r[u];if(f){const d=f.buffer;if(d){const _=this.fragmentTracker,b=f.id;if(_.hasFragments(b)||_.hasParts(b)){const N=dn.getBuffered(d);_.detectEvictedFragments(u,N,b,null,!0)}const E=ra(u),Z=[u,d];this.sourceBuffers[E]=Z,d.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,f)}}}),l(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),l()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const n=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:r,mediaSource:i,_objectUrl:s}=this;if(i){if(this.log(`media source ${n?"transferring":"detaching"}`),n)this.sourceBuffers.forEach(([l])=>{l&&this.removeBuffer(l)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const l=i.readyState==="open";try{const c=i.sourceBuffers;for(let u=c.length;u--;)l&&c[u].abort(),i.removeSourceBuffer(c[u]);l&&i.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(i.removeEventListener("startstreaming",this._onStartStreaming),i.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),n||(s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(r.removeAttribute("src"),this.appendSource&&to(r),r.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 n=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),n)try{var r;(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(i){this.warn(`onBufferReset ${e}`,i)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[ra(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Xl(this.tracks)}onBufferCodecs(e,t){const n=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const i="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),s=!i&&this.sourceBufferCount&&this.media&&r.some(l=>!n[l]);if(i||s){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${r}" SourceBuffers`);return}r.forEach(l=>{var c,u,f;const d=t[l],{id:_,codec:b,levelCodec:E,container:Z,metadata:N,supplemental:ae}=d;let Pe=n[l];const ye=(c=this.transferData)==null||(u=c.tracks)==null?void 0:u[l],$e=ye!=null&&ye.buffer?ye:Pe,We=($e==null?void 0:$e.pendingCodec)||($e==null?void 0:$e.codec),ht=$e==null?void 0:$e.levelCodec;Pe||(Pe=n[l]={buffer:void 0,listeners:[],codec:b,supplemental:ae,container:Z,levelCodec:E,metadata:N,id:_});const Ye=mt(We,ht),st=Ye==null?void 0:Ye.replace(qa,"$1");let dt=mt(b,E);const Xe=(f=dt)==null?void 0:f.replace(qa,"$1");dt&&Ye&&st!==Xe&&(l.slice(0,5)==="audio"&&(dt=Ve(dt,this.appendSource)),this.log(`switching codec ${We} to ${dt}`),dt!==(Pe.pendingCodec||Pe.codec)&&(Pe.pendingCodec=dt),Pe.container=Z,this.appendChangeType(l,Z,dt))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,t,n){const r=`${t};codecs=${n}`,i={label:`change-type=${r}`,execute:()=>{const s=this.tracks[e];if(s){const l=s.buffer;l!=null&&l.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),l.changeType(r),s.codec=n,s.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:s=>{this.warn(`Failed to change ${e} SourceBuffer type`,s)}};this.append(i,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const n=e.start,r=n+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(n,oe.MAIN))==null?void 0:t.gap)===!0)return;const s={label:"block-audio",execute:()=>{var l;const c=this.tracks.video;(this.lastVideoAppendEnd>r||c!=null&&c.buffer&&dn.isBuffered(c.buffer,r)||((l=this.fragmentTracker.getAppendedFrag(r,oe.MAIN))==null?void 0:l.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:l=>{this.warn("Error executing block-audio operation",l)}};this.blockedAudioAppend={op:s,frag:e},this.append(s,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:n}=this,{data:r,type:i,parent:s,frag:l,part:c,chunkMeta:u}=t,f=u.buffering[i],d=l.sn,_=self.performance.now();f.start=_;const b=l.stats.buffering,E=c?c.stats.buffering:null;b.start===0&&(b.start=_),E&&E.start===0&&(E.start=_);const Z=n.audio;let N=!1;i==="audio"&&(Z==null?void 0:Z.container)==="audio/mpeg"&&(N=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const ae=this.tracks.video,Pe=ae==null?void 0:ae.buffer;if(Pe&&d!=="initSegment"){const We=c||l,ht=this.blockedAudioAppend;if(i==="audio"&&s!=="main"&&!this.blockedAudioAppend){const st=We.start+We.duration*.05,dt=Pe.buffered,Xe=this.currentOp("video");!dt.length&&!Xe?this.blockAudio(We):!Xe&&!dn.isBuffered(Pe,st)&&this.lastVideoAppendEnd<st&&this.blockAudio(We)}else if(i==="video"){const Ye=We.end;if(ht){const st=ht.frag.start;(Ye>st||Ye<this.lastVideoAppendEnd||dn.isBuffered(Pe,st))&&this.unblockAudio()}this.lastVideoAppendEnd=Ye}}const ye=(c||l).start,$e={label:`append-${i}`,execute:()=>{if(f.executeStart=self.performance.now(),N){const We=this.tracks[i];if(We){const ht=We.buffer;if(ht){const Ye=ye-ht.timestampOffset;Math.abs(Ye)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${ye} (delta: ${Ye}) sn: ${d})`),ht.timestampOffset=ye)}}}this.appendExecutor(r,i)},onStart:()=>{},onComplete:()=>{const We=self.performance.now();f.executeEnd=f.end=We,b.first===0&&(b.first=We),E&&E.first===0&&(E.first=We);const ht={};this.sourceBuffers.forEach(([Ye,st])=>{Ye&&(ht[Ye]=dn.getBuffered(st))}),this.appendErrors[i]=0,i==="audio"||i==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(p.BUFFER_APPENDED,{type:i,frag:l,part:c,chunkMeta:u,parent:l.type,timeRanges:ht})},onError:We=>{var ht;const Ye={type:le.MEDIA_ERROR,parent:l.type,details:K.BUFFER_APPEND_ERROR,sourceBufferName:i,frag:l,part:c,chunkMeta:u,error:We,err:We,fatal:!1},st=(ht=this.media)==null?void 0:ht.error;if(We.code===DOMException.QUOTA_EXCEEDED_ERR)Ye.details=K.BUFFER_FULL_ERROR;else if(We.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!st)Ye.errorAction=Hn(!0);else if(We.name===eo&&this.sourceBufferCount===0)Ye.errorAction=Hn(!0);else{const dt=++this.appendErrors[i];this.warn(`Failed ${dt}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${i}" sourceBuffer (${st||"no media error"})`),(dt>=this.hls.config.appendErrorMaxRetry||st)&&(Ye.fatal=!0)}this.hls.trigger(p.ERROR,Ye)}};this.append($e,i,this.isPending(this.tracks[i]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){const{type:n,startOffset:r,endOffset:i}=t;n?this.append(this.getFlushOp(n,r,i),n):this.sourceBuffers.forEach(([s])=>{s&&this.append(this.getFlushOp(s,r,i),s)})}onFragParsed(e,t){const{frag:n,part:r}=t,i=[],s=r?r.elementaryStreams:n.elementaryStreams;s[g.AUDIOVIDEO]?i.push("audiovideo"):(s[g.AUDIO]&&i.push("audio"),s[g.VIDEO]&&i.push("video"));const l=()=>{const c=self.performance.now();n.stats.buffering.end=c,r&&(r.stats.buffering.end=c);const u=r?r.stats:n.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:n,part:r,stats:u,id:n.type})};i.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(l,i).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t,n;return e&&(!((t=this.tracks[e])!=null&&t.ended)||((n=this.tracks[e])==null?void 0:n.ending))})}onBufferEos(e,t){var n;this.sourceBuffers.forEach(([s])=>{if(s){const l=this.tracks[s];(!t.type||t.type===s)&&(l.ending=!0,l.ended||(l.ended=!0,this.log(`${s} buffer reached EOS`)))}});const r=((n=this.overrides)==null?void 0:n.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([s])=>{var l;return s&&!((l=this.tracks[s])!=null&&l.ended)})&&(r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:s}=this;if(!s||s.readyState!=="open"){s&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${s.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),s.endOfStream(),this.hls.trigger(p.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(p.BUFFERED_TO_END,void 0)))}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){const e=this.getDurationAndRange();e&&this.blockUntilOpen(()=>this.updateMediaSource(e))}onError(e,t){if(t.details===K.BUFFER_APPEND_ERROR&&t.frag){var n;const r=(n=t.errorAction)==null?void 0:n.nextAutoLevel;k(r)&&r!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:n}=this;if(!n||t===null||!this.sourceBufferCount)return;const r=e.config,i=n.currentTime,s=t.levelTargetDuration,l=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(k(l)&&l>=0){const c=Math.max(l,s),u=Math.floor(i/s)*s-c;this.flushBackBuffer(i,s,u)}if(k(r.frontBufferFlushThreshold)&&r.frontBufferFlushThreshold>0){const c=Math.max(r.maxBufferLength,r.frontBufferFlushThreshold),u=Math.max(c,s),f=Math.floor(i/s)*s+u;this.flushFrontBuffer(i,s,f)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach(([r,i])=>{if(i){const l=dn.getBuffered(i);if(l.length>0&&n>l.start(0)){var s;this.hls.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:n});const c=this.tracks[r];if((s=this.details)!=null&&s.live)this.hls.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(c!=null&&c.ended){this.log(`Cannot flush ${r} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:r})}}})}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach(([r,i])=>{if(i){const s=dn.getBuffered(i),l=s.length;if(l<2)return;const c=s.start(l-1),u=s.end(l-1);if(n>c||e>=c&&e<=u)return;this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:t,mediaSource:n}=this;if(!t||!this.media||(n==null?void 0:n.readyState)!=="open")return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&t.live&&n.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),f=Math.max(u,r);return{duration:1/0,start:u,end:f}}return{duration:1/0}}const i=(e=this.overrides)==null?void 0:e.duration;if(i)return k(i)?{duration:i}:null;const s=this.media.duration,l=k(n.duration)?n.duration:0;return r>l&&r>s||!k(s)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:n}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(k(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),t!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${n}.`),r.setLiveSeekableRange(t,n)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Mt(n)}`),this.tracksReady){var r;const i=(r=this.transferData)==null?void 0:r.tracks;i&&Object.keys(i).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,n])=>{if(t){const r=this.tracks[t];e[t]={buffer:n,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.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:le.MEDIA_ERROR,details:K.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)throw new Error("createSourceBuffers called when mediaSource was null");for(const i in e){const s=i,l=e[s];if(this.isPending(l)){const c=this.getTrackCodec(l,s),u=`${l.container};codecs=${c}`;l.codec=c,this.log(`creating sourceBuffer(${u})${this.currentOp(s)?" Queued":""} ${Mt(l)}`);try{const f=n.addSourceBuffer(u),d=ra(s),_=[s,f];t[d]=_,l.buffer=f}catch(f){var r;this.error(`error while trying to add sourceBuffer: ${f.message}`),this.shiftAndExecuteNext(s),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[s],this.hls.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:f,sourceBufferName:s,mimeType:u,parent:l.id});return}this.trackSourceBuffer(s,l)}}this.bufferCreated()}getTrackCodec(e,t){const n=e.supplemental;let r=e.codec;n&&(t==="video"||t==="audiovideo")&&Me(n,"video")&&(r=qe(r,n));const i=mt(r,e.levelCodec);return i?t.slice(0,5)==="audio"?Ve(i,this.appendSource):i:""}trackSourceBuffer(e,t){const n=t.buffer;if(!n)return;const r=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:r,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(i,s)=>{const l=s.removedRanges;l!=null&&l.length&&this.hls.trigger(p.BUFFER_FLUSHED,{type:i})})}get mediaSrc(){var e,t;const n=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return n==null?void 0:n.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const n=this.currentOp(e);n&&(n.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var n;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${r}`,t),this.hls.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const i=this.currentOp(e);i&&i.onError(r)}removeExecutor(e,t,n){const{media:r,mediaSource:i}=this,s=this.tracks[e],l=s==null?void 0:s.buffer;if(!r||!i||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=k(r.duration)?r.duration:1/0,u=k(i.duration)?i.duration:1/0,f=Math.max(0,t),d=Math.min(n,c,u);d>f&&(!s.ending||s.ended)?(s.ended=!1,this.log(`Removing [${f},${d}] from the ${e} SourceBuffer`),l.remove(f,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.tracks[t],r=n==null?void 0:n.buffer;if(!r)throw new Ql(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,r.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:n}=this,r=t.map(s=>this.appendBlocker(s));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(s=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var n;const r=(n=this.tracks[t])==null?void 0:n.buffer;!r||r.updating||this.shiftAndExecuteNext(t)})}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,n){const r=this.tracks[e];if(!r)return;const i=r.buffer;if(!i)return;const s=n.bind(this,e);r.listeners.push({event:t,listener:s}),i.addEventListener(t,s)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const n=t.buffer;n&&(t.listeners.forEach(r=>{n.removeEventListener(r.event,r.listener)}),t.listeners.length=0)}}function to(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function ql(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function ra(a){return a==="audio"?1:0}class ia{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 n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&k(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const n=t.filter((r,i)=>this.isLevelAllowed(r)&&i<=e);return this.clientRect=null,ia.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const r=(l,c)=>c?l.width!==c.width||l.height!==c.height:!0;let i=e.length-1;const s=Math.max(t,n);for(let l=0;l<e.length;l+=1){const c=e[l];if((c.width>=s||c.height>=s)&&r(c,e[l+1])){i=l;break}}return i}}const ii={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},eu={HLS:"h"},_s={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},tu={[_s.OBJECT]:["br","d","ot","tb"],[_s.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[_s.SESSION]:["cid","pr","sf","sid","st","v"],[_s.STATUS]:["bs","rtp"]};class is{constructor(e,t){Array.isArray(e)&&(e=e.map(n=>n instanceof is?n:new is(n))),this.value=e,this.params=t}}const nu="Dict";function ru(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 iu(a,e,t,n){return new Error(`failed to ${a} "${ru(e)}" as ${t}`,{cause:n})}function Ti(a,e,t){return iu("serialize",a,e,t)}class no{constructor(e){this.description=e}}const ro="Bare Item",su="Boolean";function au(a){if(typeof a!="boolean")throw Ti(a,su);return a?"?1":"?0"}function ou(a){return btoa(String.fromCharCode(...a))}const lu="Byte Sequence";function uu(a){if(ArrayBuffer.isView(a)===!1)throw Ti(a,lu);return`:${ou(a)}:`}const cu="Integer";function fu(a){return a<-999999999999999||999999999999999<a}function io(a){if(fu(a))throw Ti(a,cu);return a.toString()}function du(a){return`@${io(a.getTime()/1e3)}`}function so(a,e){if(a<0)return-so(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const r=Math.floor(a*t);return(r%2===0?r:r+1)/t}else return Math.round(a*t)/t}const hu="Decimal";function pu(a){const e=so(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ti(a,hu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const gu="String",mu=/[\x00-\x1f\x7f]+/;function vu(a){if(mu.test(a))throw Ti(a,gu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function _u(a){return a.description||a.toString().slice(7,-1)}const yu="Token";function ao(a){const e=_u(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ti(e,yu);return e}function sa(a){switch(typeof a){case"number":if(!k(a))throw Ti(a,ro);return Number.isInteger(a)?io(a):pu(a);case"string":return vu(a);case"symbol":return ao(a);case"boolean":return au(a);case"object":if(a instanceof Date)return du(a);if(a instanceof Uint8Array)return uu(a);if(a instanceof no)return ao(a);default:throw Ti(a,ro)}}const Eu="Key";function aa(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw Ti(a,Eu);return a}function oa(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${aa(e)}`:`;${aa(e)}=${sa(t)}`).join("")}function oo(a){return a instanceof is?`${sa(a.value)}${oa(a.params)}`:sa(a)}function bu(a){return`(${a.value.map(oo).join(" ")})${oa(a.params)}`}function xu(a,e={whitespace:!0}){if(typeof a!="object")throw Ti(a,nu);const t=a instanceof Map?a.entries():Object.entries(a),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,i])=>{i instanceof is||(i=new is(i));let s=aa(r);return i.value===!0?s+=oa(i.params):(s+="=",Array.isArray(i.value)?s+=bu(i):s+=oo(i)),s}).join(`,${n}`)}function Su(a,e){return xu(a,e)}function wu(a){return a==="ot"||a==="sf"||a==="st"}function Tu(a){return typeof a=="number"?k(a):a!=null&&a!==""&&a!==!1}function Au(a,e){const t=new URL(a),n=new URL(e);if(t.origin!==n.origin)return a;const r=t.pathname.split("/").slice(1),i=n.pathname.split("/").slice(1,-1);for(;r[0]===i[0];)r.shift(),i.shift();for(;i.length;)i.shift(),r.unshift("..");return r.join("/")}const Ps=a=>Math.round(a),Du=(a,e)=>(e!=null&&e.baseUrl&&(a=Au(a,e.baseUrl)),encodeURIComponent(a)),Os=a=>Ps(a/100)*100,Ru={br:Ps,d:Ps,bl:Os,dl:Os,mtp:Os,nor:Du,rtp:Os,tb:Ps};function Cu(a,e){const t={};if(a==null||typeof a!="object")return t;const n=Object.keys(a).sort(),r=h({},Ru,e==null?void 0:e.formatters),i=e==null?void 0:e.filter;return n.forEach(s=>{if(i!=null&&i(s))return;let l=a[s];const c=r[s];c&&(l=c(l,e)),!(s==="v"&&l===1)&&(s=="pr"&&l===1||Tu(l)&&(wu(s)&&typeof l=="string"&&(l=new no(l)),t[s]=l))}),t}function lo(a,e={}){return a?Su(Cu(a,e),h({whitespace:!1},e)):""}function Iu(a,e={}){const t={};if(!a)return t;const n=Object.entries(a),r=Object.entries(tu).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=n.reduce((s,l)=>{var c,u;const[f,d]=l,_=((c=r.find(b=>b[1].includes(f)))===null||c===void 0?void 0:c[0])||_s.REQUEST;return(u=s[_])!==null&&u!==void 0||(s[_]={}),s[_][f]=d,s},{});return Object.entries(i).reduce((s,[l,c])=>(s[l]=lo(c,e),s),t)}function Lu(a,e,t){return h(a,Iu(e,t))}const ku="CMCD";function Pu(a,e={}){if(!a)return"";const t=lo(a,e);return`${ku}=${encodeURIComponent(t)}`}const uo=/CMCD=[^&#]+/;function Ou(a,e,t){const n=Pu(e,t);if(!n)return a;if(uo.test(a))return a.replace(uo,n);const r=a.includes("?")?"&":"?";return`${a}${r}${n}`}class Mu{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=r=>{try{this.apply(r,{ot:ii.MANIFEST,su:!this.initialized})}catch(i){this.hls.logger.warn("Could not generate manifest CMCD data.",i)}},this.applyFragmentData=r=>{try{const{frag:i,part:s}=r,l=this.hls.levels[i.level],c=this.getObjectType(i),u={d:(s||i).duration*1e3,ot:c};(c===ii.VIDEO||c===ii.AUDIO||c==ii.MUXED)&&(u.br=l.bitrate/1e3,u.tb=this.getTopBandwidth(c)/1e3,u.bl=this.getBufferLength(c));const f=s?this.getNextPart(s):this.getNextFrag(i);f!=null&&f.url&&f.url!==i.url&&(u.nor=f.url),this.apply(r,u)}catch(i){this.hls.logger.warn("Could not generate segment CMCD data.",i)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(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 n,r;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:eu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){h(t,this.createData());const n=t.ot===ii.INIT||t.ot===ii.VIDEO||t.ot===ii.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((s,l)=>(r.includes(l)&&(s[l]=t[l]),s),{}));const i={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),Lu(e.headers,t,i)):e.url=Ou(e.url,t,i)}getNextFrag(e){var t;const n=(t=this.hls.levels[e.level])==null?void 0:t.details;if(n){const r=e.sn-n.startSN;return n.fragments[r+1]}}getNextPart(e){var t,n;const{index:r,fragment:i}=e,s=(t=this.hls.levels[i.level])==null||(n=t.details)==null?void 0:n.partList;if(s){const{sn:l}=i;for(let c=s.length-1;c>=0;c--){const u=s[c];if(u.index===r&&u.fragment.sn===l)return s[c+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return ii.TIMED_TEXT;if(e.sn==="initSegment")return ii.INIT;if(t==="audio")return ii.AUDIO;if(t==="main")return this.hls.audioTracks.length?ii.VIDEO:ii.MUXED}getTopBandwidth(e){let t=0,n;const r=this.hls;if(e===ii.AUDIO)n=r.audioTracks;else{const i=r.maxAutoLevel,s=i>-1?i+1:r.levels.length;n=r.levels.slice(0,s)}return n.forEach(i=>{i.bitrate>t&&(t=i.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,n=e===ii.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:dn.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new n(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,s,l){t(i),this.loader.load(i,s,l)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new n(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,s,l){t(i),this.loader.load(i,s,l)}}}}const Fu=3e5;class Nu extends G{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(n=>n!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((n==null?void 0:n.action)===jt.SendAlternateToPenaltyBox&&n.flags===en.MoveAllAlternatesMatchingHost){const r=this.levels;let i=this._pathwayPriority,s=this.pathwayId;if(t.context){const{groupId:l,pathwayId:c,type:u}=t.context;l&&r?s=this.getPathwayForGroupId(l,u,s):c&&(s=c)}s in this.penalizedPathways||(this.penalizedPathways[s]=performance.now()),!i&&r&&(i=this.pathways()),i&&i.length>1&&(this.updatePathwayPriority(i),n.resolved=this.pathwayId!==s),n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${s} levels: ${r&&r.length} priorities: ${Mt(i)} penalized: ${Mt(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const n=this.penalizedPathways,r=performance.now();Object.keys(n).forEach(i=>{r-n[i]>Fu&&delete n[i]});for(let i=0;i<e.length;i++){const s=e[i];if(s in n)continue;if(s===this.pathwayId)return;const l=this.hls.nextLoadLevel,c=this.hls.levels[l];if(t=this.getLevelsForPathway(s),t.length>0){this.log(`Setting Pathway to "${s}"`),this.pathwayId=s,Jr(t),this.hls.trigger(p.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[l];c&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=l);break}}}getPathwayForGroupId(e,t,n){const r=this.getLevelsForPathway(n).concat(this.levels||[]);for(let i=0;i<r.length;i++)if(t===he.AUDIO_TRACK&&r[i].hasAudioGroup(e)||t===he.SUBTITLE_TRACK&&r[i].hasSubtitleGroup(e))return r[i].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},r={};e.forEach(i=>{const{ID:s,"BASE-ID":l,"URI-REPLACEMENT":c}=i;if(t.some(f=>f.pathwayId===s))return;const u=this.getLevelsForPathway(l).map(f=>{const d=new Gn(f.attrs);d["PATHWAY-ID"]=s;const _=d.AUDIO&&`${d.AUDIO}_clone_${s}`,b=d.SUBTITLES&&`${d.SUBTITLES}_clone_${s}`;_&&(n[d.AUDIO]=_,d.AUDIO=_),b&&(r[d.SUBTITLES]=b,d.SUBTITLES=b);const E=fo(f.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),Z=new rt({attrs:d,audioCodec:f.audioCodec,bitrate:f.bitrate,height:f.height,name:f.name,url:E,videoCodec:f.videoCodec,width:f.width});if(f.audioGroups)for(let N=1;N<f.audioGroups.length;N++)Z.addGroupId("audio",`${f.audioGroups[N]}_clone_${s}`);if(f.subtitleGroups)for(let N=1;N<f.subtitleGroups.length;N++)Z.addGroupId("text",`${f.subtitleGroups[N]}_clone_${s}`);return Z});t.push(...u),co(this.audioTracks,n,c,s),co(this.subtitleTracks,r,c,s)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let r;try{r=new self.URL(e)}catch(f){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const f=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+f)}const i={responseType:"json",url:r.href},s=t.steeringManifestLoadPolicy.default,l=s.errorRetry||s.timeoutRetry||{},c={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},u={onSuccess:(f,d,_,b)=>{this.log(`Loaded steering manifest: "${r}"`);const E=f.data;if((E==null?void 0:E.VERSION)!==1){this.log(`Steering VERSION ${E.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=E.TTL;const{"RELOAD-URI":Z,"PATHWAY-CLONES":N,"PATHWAY-PRIORITY":ae}=E;if(Z)try{this.uri=new self.URL(Z,r).href}catch(ye){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${Z}`);return}this.scheduleRefresh(this.uri||_.url),N&&this.clonePathways(N);const Pe={steeringManifest:E,url:r.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,Pe),ae&&this.updatePathwayPriority(ae)},onError:(f,d,_,b)=>{if(this.log(`Error loading steering manifest: ${f.code} ${f.text} (${d.url})`),this.stopLoad(),f.code===410){this.enabled=!1,this.log(`Steering manifest ${d.url} no longer available`);return}let E=this.timeToLoad*1e3;if(f.code===429){const Z=this.loader;if(typeof(Z==null?void 0:Z.getResponseHeader)=="function"){const N=Z.getResponseHeader("Retry-After");N&&(E=parseFloat(N)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,E)},onTimeout:(f,d,_)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(i,c,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const r=(n=this.hls)==null?void 0:n.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function co(a,e,t,n){a&&Object.keys(e).forEach(r=>{const i=a.filter(s=>s.groupId===r).map(s=>{const l=h({},s);return l.details=void 0,l.attrs=new Gn(l.attrs),l.url=l.attrs.URI=fo(s.url,s.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),l.groupId=l.attrs["GROUP-ID"]=e[r],l.attrs["PATHWAY-ID"]=n,l});a.push(...i)})}function fo(a,e,t,n){const{HOST:r,PARAMS:i,[t]:s}=n;let l;e&&(l=s==null?void 0:s[e],l&&(a=l));const c=new self.URL(a);return r&&!l&&(c.host=r),i&&Object.keys(i).sort().forEach(u=>{u&&c.searchParams.set(u,i[u])}),c.href}function ci(a,e,t){gi(a,e,t),a.addEventListener(e,t)}function gi(a,e,t){a.removeEventListener(e,t)}class ss extends G{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=ss.CDMCleanupPromise?[ss.CDMCleanupPromise]:[],this.onMediaEncrypted=t=>{const{initDataType:n,initData:r}=t,i=`"${t.type}" event: init data type: "${n}"`;if(this.debug(i),r!==null){if(!this.keyFormatPromise){let s=Object.keys(this.keySystemAccessPromises);s.length||(s=ur(this.config));const l=s.map(Mn).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(l)}this.keyFormatPromise.then(s=>{const l=Sn(s);let c,u;if(n==="sinf"){if(l!==On.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${n}" for selected key-system ${l}`);return}const E=_t(new Uint8Array(r));try{const Z=Kr(JSON.parse(E).sinf),N=q(Z);if(!N)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(N.subarray(8,24)),u=On.FAIRPLAY}catch(Z){this.warn(`${i} Failed to parse sinf: ${Z}`);return}}else{if(l!==On.WIDEVINE&&l!==On.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${n}" for selected key-system ${l}`);return}const E=it(r),Z=E.filter(ae=>!!ae.systemId&&Pn(ae.systemId)===l);Z.length>1&&this.warn(`${i} Using first of ${Z.length} pssh found for selected key-system ${l}`);const N=Z[0];if(!N){E.length===0||E.some(ae=>!ae.systemId)?this.warn(`${i} contains incomplete or invalid pssh data`):this.log(`ignoring ${i} for ${E.map(ae=>Pn(ae.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(u=Pn(N.systemId),N.version===0&&N.data)if(u===On.WIDEVINE){const ae=N.data.length-22;c=new Uint8Array(N.data.subarray(ae,ae+16))}else u===On.PLAYREADY&&(c=rr(N.data))}if(!u||!c)return;const f=Y.hexDump(c),{keyIdToKeySessionPromise:d,mediaKeySessions:_}=this;let b=d[f];for(let E=0;E<_.length;E++){const Z=_[E],N=Z.decryptdata;if(!N.keyId)continue;const ae=Y.hexDump(N.keyId);if(f===ae||N.uri.replace(/-/g,"").indexOf(f)!==-1){if(b=d[ae],N.pssh)break;delete d[ae],N.pssh=new Uint8Array(r),N.keyId=c,b=d[f]=b.then(()=>this.generateRequestWithPreferredKeySession(Z,n,r,"encrypted-event-key-match")),b.catch(Pe=>this.handleError(Pe));break}}if(!b){if(u!==l){this.log(`Ignoring "${t.type}" event with ${u} init data for selected key-system ${l}`);return}b=d[f]=this.getKeySystemSelectionPromise([u]).then(({keySystem:E,mediaKeys:Z})=>{var N;this.throwIfDestroyed();const ae=new Nr("ISO-23001-7",f,(N=Mn(E))!=null?N:"");return ae.pssh=new Uint8Array(r),ae.keyId=c,this.attemptSetMediaKeys(E,Z).then(()=>{this.throwIfDestroyed();const Pe=this.createMediaKeySessionContext({decryptdata:ae,keySystem:E,mediaKeys:Z});return this.generateRequestWithPreferredKeySession(Pe,n,r,"encrypted-event-no-match")})}),b.catch(E=>this.handleError(E))}})}},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:n}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===On.WIDEVINE&&n)return n}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(s,l,c)=>!!s&&c.indexOf(s)===l,r=t.map(s=>s.audioCodec).filter(n),i=t.map(s=>s.videoCodec).filter(n);return r.length+i.length===0&&i.push("avc1.42e01e"),new Promise((s,l)=>{const c=u=>{const f=u.shift();this.getMediaKeysPromise(f,r,i).then(d=>s({keySystem:f,mediaKeys:d})).catch(d=>{u.length?c(u):d instanceof mi?l(d):l(new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${n}`;return yr===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return n(e,t)}getMediaKeysPromise(e,t,n){const r=vn(e,t,n,this.config.drmSystemOptions),i=this.keySystemAccessPromises[e];let s=i==null?void 0:i.keySystemAccess;if(!s){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Mt(r)}`),s=this.requestMediaKeySystemAccess(e,r);const l=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`)}),s.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const u=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),l.mediaKeys=c.createMediaKeys().then(f=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,u.then(d=>d?this.setMediaKeysServerCertificate(f,e,d):f))),l.mediaKeys.catch(f=>{this.error(`Failed to create media-keys for "${e}"}: ${f}`)}),l.mediaKeys})}return s.then(()=>i.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${Y.hexDump(e.keyId||[])}`);const r=n.createSession(),i={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(i),i}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),i="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(n,i,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 Y.hexDump(e.keyId)}updateKeySession(e,t){var n;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${Y.hexDump(((n=e.decryptdata)==null?void 0:n.keyId)||[])}
} (data length: ${t&&t.byteLength})`),r.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Mn(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:n})=>this.attemptSetMediaKeys(t,n))}selectKeySystem(e){return new Promise((t,n)=>this.getKeySystemSelectionPromise(e).then(({keySystem:r})=>{const i=Mn(r);i?t(i):n(new Error(`Unable to find format for key-system "${r}"`))}).catch(n))}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=ur(this.config),n=e.map(Sn).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(n)}loadKey(e){const t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),r=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let i=this.keyIdToKeySessionPromise[n];return i||(i=this.getKeySystemForKeyPromise(t).then(({keySystem:l,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(l,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:c,decryptdata:t}))))),(this.keyIdToKeySessionPromise[n]=i.then(l=>{const c="cenc",u=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,c,u,"playlist-key")})).catch(l=>this.handleError(l))),i}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof mi?this.hls.trigger(p.ERROR,e.data):this.hls.trigger(p.ERROR,{type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){const r=Sn(e.keyFormat),i=r?[r]:ur(this.config);return this.attemptKeySystemAccess(i)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=ur(this.config)),e.length===0)throw new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Mt({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(n).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(i=>n.indexOf(i)===-1)})}generateRequestWithPreferredKeySession(e,t,n,r){var i,s;const l=(i=this.config.drmSystems)==null||(s=i[e.keySystem])==null?void 0:s.generateRequest;if(l)try{const E=l.call(this.hls,t,n,e);if(!E)throw new Error("Invalid response from configured generateRequest filter");t=E.initDataType,n=E.initData?E.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(E){var c;if(this.warn(E.message),(c=this.hls)!=null&&c.config.debug)throw E}if(n===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const u=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${u} (init data type: ${t} length: ${n?n.byteLength:null})`);const f=new Ri,d=e._onmessage=E=>{const Z=e.mediaKeysSession;if(!Z){f.emit("error",new Error("invalid state"));return}const{messageType:N,message:ae}=E;this.log(`"${N}" message event for session "${Z.sessionId}" message size: ${ae.byteLength}`),N==="license-request"||N==="license-renewal"?this.renewLicense(e,ae).catch(Pe=>{f.eventNames().length?f.emit("error",Pe):this.handleError(Pe)}):N==="license-release"?e.keySystem===On.FAIRPLAY&&(this.updateKeySession(e,Ur("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${N}"`)},_=e._onkeystatuseschange=E=>{if(!e.mediaKeysSession){f.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const N=e.keyStatus;f.emit("keyStatus",N),N==="expired"&&(this.warn(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e))};ci(e.mediaKeysSession,"message",d),ci(e.mediaKeysSession,"keystatuseschange",_);const b=new Promise((E,Z)=>{f.on("error",Z),f.on("keyStatus",N=>{N.startsWith("usable")?E():N==="output-restricted"?Z(new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):N==="internal-error"?Z(new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${N}"`)):N==="expired"?Z(new Error("key expired while generating request")):this.warn(`unhandled key status change "${N}"`)})});return e.mediaKeysSession.generateRequest(t,n).then(()=>{var E;this.log(`Request generated for key-session "${(E=e.mediaKeysSession)==null?void 0:E.sessionId}" keyId: ${u}`)}).catch(E=>{throw new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_SESSION,error:E,fatal:!1},`Error generating key-session request: ${E}`)}).then(()=>b).catch(E=>{throw f.removeAllListeners(),this.removeSession(e),E}).then(()=>(f.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,n)=>{if(typeof n=="string"&&typeof t=="object"){const r=n;n=t,t=r}this.log(`key status change "${t}" for keyStatuses keyId: ${Y.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${Y.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,n=t.loader,r=new n(t),i=this.getServerCertificateUrl(e);return i?(this.log(`Fetching server certificate for "${e}"`),new Promise((s,l)=>{const c={responseType:"arraybuffer",url:i},u=t.certLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(_,b,E,Z)=>{s(_.data)},onError:(_,b,E,Z)=>{l(new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:y({url:c.url,data:void 0},_)},`"${e}" certificate request failed (${i}). Status: ${_.code} (${_.text})`))},onTimeout:(_,b,E)=>{l(new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(_,b,E)=>{l(new Error("aborted"))}};r.load(c,f,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((r,i)=>{e.setServerCertificate(n).then(s=>{this.log(`setServerCertificate ${s?"success":"not supported by CDM"} (${n==null?void 0:n.byteLength}) on "${t}"`),r(e)}).catch(s=>{i(new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:s,fatal:!0},s.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(r=>{throw new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(n,"application/xml"),i=r.querySelectorAll("HttpHeader");if(i.length>0){let f;for(let d=0,_=i.length;d<_;d++){var s,l;f=i[d];const b=(s=f.querySelector("name"))==null?void 0:s.textContent,E=(l=f.querySelector("value"))==null?void 0:l.textContent;b&&E&&e.setRequestHeader(b,E)}}const c=r.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return Ur(atob(u))}setupLicenseXHR(e,t,n,r){const i=this.config.licenseXhrSetup;return i?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return i.call(this.hls,e,t,n,r)}).catch(s=>{if(!n.decryptdata)throw s;return e.open("POST",t,!0),i.call(this.hls,e,t,n,r)}).then(s=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:s||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((r,i)=>{const s=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${s}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return i(new Error("invalid state"));if(l.readyState===4)if(l.status===200){this._requestLicenseFailureCount=0;let c=l.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const u=this.config.licenseResponseCallback;if(u)try{c=u.call(this.hls,l,s,e)}catch(f){this.error(f)}r(c)}else{const c=n.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||l.status>=400&&l.status<500)i(new mi({type:le.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:l,response:{url:s,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${s}). Status: ${l.status} (${l.statusText})`));else{const f=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${f} attempts left`),this.requestLicense(e,t).then(r,i)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,s,e,t).then(({xhr:c,licenseChallenge:u})=>{e.keySystem==On.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,ci(n,"encrypted",this.onMediaEncrypted),ci(n,"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.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Nr.clearKeyUriToKeyIdMap();const r=n.length;ss.CDMCleanupPromise=Promise.all(n.map(i=>this.removeSession(i)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(i=>{var s;this.log(`Could not clear media keys: ${i}`),(s=this.hls)==null||s.trigger(p.ERROR,{type:le.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${i}`)})}))).catch(i=>{var s;this.log(`Could not close sessions and clear media keys: ${i}`),(s=this.hls)==null||s.trigger(p.ERROR,{type:le.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${i}`)})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const n=t.reduce((r,i)=>(r.indexOf(i.keyFormat)===-1&&r.push(i.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{drmSystemOptions:i}=this.config;return(pr(i)?new Promise((l,c)=>{self.setTimeout(()=>c(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(l)}):Promise.resolve()).catch(l=>{var c;this.log(`Could not remove session: ${l}`),(c=this.hls)==null||c.trigger(p.ERROR,{type:le.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${l}`)})}).then(()=>t.close()).catch(l=>{var c;this.log(`Could not close session: ${l}`),(c=this.hls)==null||c.trigger(p.ERROR,{type:le.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${l}`)})})}}}ss.CDMCleanupPromise=void 0;class mi extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}class Bu{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 n=this.hls.config;if(n.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){const r=performance.now();if(t){if(this.lastTime){const i=r-this.lastTime,s=n-this.lastDroppedFrames,l=t-this.lastDecodedFrames,c=1e3*s/i,u=this.hls;if(u.trigger(p.FPS_DROP,{currentDropped:s,currentDecoded:l,totalDroppedFrames:n}),c>0&&s>u.config.fpsDroppedMonitoringThreshold*l){let f=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+f),f>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=f)&&(f=f-1,u.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:f,droppedLevel:u.currentLevel}),u.autoLevelCapping=f,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function ho(a,e){let t;try{t=new Event("addtrack")}catch(n){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function po(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues&&!a.cues.getCueById(e.id))try{if(a.addCue(e),!a.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){J.debug(`[texttrack-utils]: ${n}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,a.addCue(r)}catch(r){J.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(a.mode=t)}function as(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let n=a.cues.length;n--;)e&&a.cues[n].removeEventListener("enter",e),a.removeCue(a.cues[n]);t==="disabled"&&(a.mode=t)}function la(a,e,t,n){const r=a.mode;if(r==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const i=$u(a.cues,e,t);for(let s=0;s<i.length;s++)(!n||n(i[s]))&&a.removeCue(i[s])}r==="disabled"&&(a.mode=r)}function Uu(a,e){if(e<=a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let n=0,r=t,i;for(;n<=r;)if(i=Math.floor((r+n)/2),e<a[i].startTime)r=i-1;else if(e>a[i].startTime&&n<t)n=i+1;else return i;return a[n].startTime-e<e-a[r].startTime?n:r}function $u(a,e,t){const n=[],r=Uu(a,e);if(r>-1)for(let i=r,s=a.length;i<s;i++){const l=a[i];if(l.startTime>=e&&l.endTime<=t)n.push(l);else if(l.startTime>t)return n}return n}function Ms(a){const e=[];for(let t=0;t<a.length;t++){const n=a[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(a[t])}return e}class Ku extends ta{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const n=Ms(this.media.textTracks);for(let i=0;i<n.length;i++)if(n[i].mode==="hidden")t=n[i];else if(n[i].mode==="showing"){t=n[i];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(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 n=this.media;if(!n)return;const r=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,r)return;Ms(n.textTracks).forEach(s=>{as(s)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:n,groupId:r,details:i}=t,s=this.tracksInGroup[n];if(!s||s.groupId!==r){this.warn(`Subtitle track with id:${n} and group:${r} not found in active group ${s==null?void 0:s.groupId}`);return}const l=s.details;s.details=t.details,this.log(`Subtitle track ${n} "${s.name}" lang:${s.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,l)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const n=t.subtitleGroups||null,r=this.groupIds;let i=this.currentTrack;if(!n||(r==null?void 0:r.length)!==(n==null?void 0:n.length)||n!=null&&n.some(s=>(r==null?void 0:r.indexOf(s))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const s=this.tracks.filter(f=>!n||n.indexOf(f.groupId)!==-1);if(s.length)this.selectDefaultTrack&&!s.some(f=>f.default)&&(this.selectDefaultTrack=!1),s.forEach((f,d)=>{f.id=d});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=s;const l=this.hls.config.subtitlePreference;if(!i&&l){this.selectDefaultTrack=!1;const f=Ae(l,s);if(f>-1)i=s[f];else{const d=Ae(l,this.tracks);i=this.tracks[d]}}let c=this.findTrackId(i);c===-1&&i&&(c=this.findTrackId(null));const u={subtitleTracks:s};this.log(`Updating subtitle tracks, ${s.length} track(s) found in "${n==null?void 0:n.join(",")}" group-id`),this.hls.trigger(p.SUBTITLE_TRACKS_UPDATED,u),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const i=t[r];if(!(n&&!i.default||!n&&!e)&&(!e||Ze(i,e)))return r}if(e){for(let r=0;r<t.length;r++){const i=t[r];if(vs(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const i=t[r];if(vs(e.attrs,i.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const r=t[n];if(na(r,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===he.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const n=this.currentTrack;if(n&&Ze(e,n))return n;const r=Ae(e,this.tracksInGroup);if(r>-1){const i=this.tracksInGroup[r];return this.setSubtitleTrack(r),i}else{if(n)return null;{const i=Ae(e,t);if(i>-1)return t[i]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,t),s=e.details,l=s==null?void 0:s.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${l&&s.live?" age "+l.toFixed(1)+(s.type?" "+s.type||0:""):""} ${i}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:i,id:n,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Ms(e.textTracks),n=this.currentTrack;let r;if(n&&(r=t.filter(i=>na(n,i))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(i=>{i.mode!=="disabled"&&i!==r&&(i.mode="disabled")}),r){const i=this.subtitleDisplay?"showing":"hidden";r.mode!==i&&(r.mode=i)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!k(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e});return}const i=!!r.details&&!r.details.live;if(e===this.trackId&&r===n&&i)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:s,groupId:l="",name:c,type:u,url:f}=r;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:s,groupId:l,name:c,type:u,url:f});const d=this.switchParams(r.url,n==null?void 0:n.details,r.details);this.loadPlaylist(d)}}function Zu(){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,r=>{const i=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?i:i&3|8).toString(16)})}}}function ys(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const os=.025;let Fs=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Gu(a,e,t){return`${a.identifier}-${t+1}-${ys(e)}`}class Vu{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const n=this.playoutLimit;return e<=0||isNaN(n)?!1:n===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>n}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return ua(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,n=ua(t,e);return t-n<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=k(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return ua(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)<os))}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"?Fs.Range:Fs.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 zu(this)}}function ua(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<os)?e.start:e.start+e.duration}function go(a,e,t){const n=new self.URL(a,t);return n.protocol!=="data:"&&n.searchParams.set("_HLS_primary_id",e),n}function ca(a,e){for(;(t=a.assetList[++e])!=null&&t.error;)var t;return e}function zu(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function ls(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Wu{constructor(e,t,n,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls.trigger(p.PLAYOUT_LIMIT_REACHED,{})};const i=this.hls=new e(t);this.interstitial=n,this.assetItem=r;let s=r.uri;try{s=go(s,t.primarySessionId).href}catch(c){}i.loadSource(s);const l=()=>{this.hasDetails=!0};i.once(p.LEVEL_LOADED,l),i.once(p.AUDIO_TRACK_LOADED,l),i.once(p.SUBTITLE_TRACK_LOADED,l),i.on(p.MEDIA_ATTACHING,(c,{media:u})=>{this.removeMediaListeners(),this.mediaAttached=u,this.interstitial.playoutLimit&&(u.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&i.on(p.BUFFER_APPENDED,()=>{const d=this.bufferedEnd;this.reachedPlayout(d)&&(this._bufferedEosTime=d,i.trigger(p.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){var e;return((e=this.interstitial)==null?void 0:e.appendInPlace)||!1}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const n=this.timelineOffset,r=dn.bufferInfo(e,n,0);return this.getAssetTime(r.end)>=this._bufferedEosTime-.02}reachedPlayout(e){const n=this.interstitial.playoutLimit;return this.startOffset+e>=n}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=dn.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;return e||0}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const n=e-t;if(Math.abs(n)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,n=this.duration;return Math.min(Math.max(0,e-t),n)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}resetDetails(){const e=this.hls;if(this.hasDetails){e.stopLoad();const t=n=>delete n.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){this.hls.on(e,t)}once(e,t,n){this.hls.once(e,t)}off(e,t,n){this.hls.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${ls(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const mo=.033;class Hu extends G{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((n,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,n+1):n,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);const r=this.items;if(r)for(r[n]||(t===void 0&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&(i=r[n])!=null&&i.event;){var i;n--}return n}findItemIndexAtTime(e,t){const n=this.items;if(n)for(let r=0;r<n.length;r++){let i=n[r];if(t&&t!=="primary"&&(i=i[t]),e===i.start||e>i.start&&e<i.end)return r}return-1}findJumpRestrictedIndex(e,t){const n=this.items;if(n)for(let r=e;r<=t&&n[r];r++){const i=n[r].event;if(i!=null&&i.restrictions.jump&&!i.appendInPlace)return r}return-1}findEventIndex(e){const t=this.items;if(t)for(let r=t.length;r--;){var n;if(((n=t[r].event)==null?void 0:n.identifier)===e)return r}return-1}findAssetIndex(e,t){const n=e.assetList,r=n.length;if(r>1)for(let i=0;i<r;i++){const s=n[i];if(!s.error){const l=s.timelineStart;if(t===l||t>l&&t<l+(s.duration||0))return i}}return 0}get assetIdAtEnd(){var e,t;const n=(e=this.items)==null||(t=e[this.length-1])==null?void 0:t.event;if(n){const r=n.assetList,i=r[r.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t){const n=e.main.details,{dateRanges:r}=n,i=this.events,s=this.parseDateRanges(r,{url:n.url},t),l=Object.keys(r),c=i?i.filter(u=>!l.includes(u.identifier)):[];s.length&&s.sort((u,f)=>{const d=u.cue.pre,_=u.cue.post,b=f.cue.pre,E=f.cue.post;if(d&&!b)return-1;if(b&&!d||_&&!E)return 1;if(E&&!_)return-1;if(!d&&!b&&!_&&!E){const Z=u.startTime,N=f.startTime;if(Z!==N)return Z-N}return u.dateRange.tagOrder-f.dateRange.tagOrder}),this.events=s,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[]){const n=this.events||[];if(n.length||t.length||this.length<2){const r=this.items,i=this.parseSchedule(n,e);(t.length||(r==null?void 0:r.length)!==i.length||i.some((l,c)=>Math.abs(l.playout.start-r[c].playout.start)>.005||Math.abs(l.playout.end-r[c].playout.end)>.005))&&(this.items=i,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,n){const r=[],i=Object.keys(e);for(let s=0;s<i.length;s++){const l=i[s],c=e[l];if(c.isInterstitial){let u=this.eventMap[l];u?u.setDateRange(c):(u=new Vu(c,t),this.eventMap[l]=u,n===!1&&(u.appendInPlace=n)),r.push(u)}}return r}parseSchedule(e,t){const n=[],r=t.main.details,i=r.live?1/0:r.edge;let s=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,u=0;if(e.forEach((f,d)=>{const _=f.cue.pre,b=f.cue.post,E=e[d-1]||null,Z=f.appendInPlace,N=b?i:f.startOffset,ae=f.duration,Pe=f.timelineOccupancy===Fs.Range?ae:0,ye=f.resumptionOffset,$e=(E==null?void 0:E.startTime)===N,We=N+f.cumulativeDuration;let ht=Z?We+ae:N+ye;if(_||!b&&N<=0){const st=u;u+=Pe,f.timelineStart=We;const dt=s;s+=ae,n.push({event:f,start:We,end:ht,playout:{start:dt,end:s},integrated:{start:st,end:u}})}else if(N<=i){if(!$e){const Xe=N-c;if(Xe>mo){const $t=c,pn=u;u+=Xe;const Vn=s;s+=Xe;const Dn={previousEvent:e[d-1]||null,nextEvent:f,start:$t,end:$t+Xe,playout:{start:Vn,end:s},integrated:{start:pn,end:u}};n.push(Dn)}else Xe>0&&E&&(E.cumulativeDuration+=Xe,n[n.length-1].end=N)}b&&(ht=We),f.timelineStart=We;const st=u;u+=Pe;const dt=s;s+=ae,n.push({event:f,start:We,end:ht,playout:{start:dt,end:s},integrated:{start:st,end:u}})}else return;const Ye=f.resumeTime;b||Ye>i?c=i:c=Ye}),c<i){var l;const f=c,d=u,_=i-c;u+=_;const b=s;s+=_,n.push({previousEvent:((l=n[n.length-1])==null?void 0:l.event)||null,nextEvent:null,start:c,end:f+_,playout:{start:b,end:s},integrated:{start:d,end:u}})}this.setDurations(i,s,u)}else n.push({previousEvent:null,nextEvent:null,start:0,end:i,playout:{start:0,end:i},integrated:{start:0,end:i}}),this.setDurations(i,i,i);return n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){const n=t.main.details,r=n.live?1/0:n.edge;let i=0,s=-1;e.forEach((l,c)=>{const u=l.cue.pre,f=l.cue.post,d=u?0:f?r:l.startTime;this.updateAssetDurations(l),s===d?l.cumulativeDuration=i:(i=0,s=d),!f&&l.snapOptions.in&&(l.resumeAnchor=Vt(null,n.fragments,l.startOffset+l.resumptionOffset,0,0)||void 0),l.appendInPlace&&!l.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(l,t)||(l.appendInPlace=!1)),!l.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<mo&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${l}`));const b=k(l.resumeOffset)?l.resumeOffset:l.duration;i+=b})}primaryCanResumeInPlaceAt(e,t){const n=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(n-r)>os?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${r}`),!1):t?!Object.keys(t).some(s=>{const l=t[s].details,c=l.edge;if(n>=c)return this.log(`"${e.identifier}" resumption ${n} past ${s} playlist end ${c}`),!1;const u=Vt(null,l.fragments,n);if(!u)return this.log(`"${e.identifier}" resumption ${n} does not align with any fragments in ${s} playlist (${l.fragStart}-${l.fragmentEnd})`),!0;const f=s==="audio"?.175:0;return Math.abs(u.start-n)<os+f||Math.abs(u.end-n)<os+f?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${s} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)}):(this.log(`"${e.identifier}" resumption ${n} can not be aligned with media (none selected)`),!1)}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let n=0,r=!1,i=!1;e.assetList.forEach((s,l)=>{const c=t+n;s.startOffset=n,s.timelineStart=c,r||(r=s.duration===null),i||(i=!!s.error);const u=s.error?0:s.duration||0;n+=u}),r&&!i?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function $i(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class ju{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const n=e.assetListUrl;let r;try{r=go(n,this.hls.sessionId,e.baseUrl)}catch(_){const b=this.assignAssetListError(e,K.ASSET_LIST_LOAD_ERROR,_,n);this.hls.trigger(p.ERROR,b);return}t&&r.protocol!=="data:"&&r.searchParams.set("_HLS_start_offset",""+t);const i=this.hls.config,s=i.loader,l=new s(i),c={responseType:"json",url:r.href},u=i.interstitialAssetListLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(_,b,E,Z)=>{const N=_.data,ae=N==null?void 0:N.ASSETS;if(!Array.isArray(ae)){const Pe=this.assignAssetListError(e,K.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),E.url,b,Z);this.hls.trigger(p.ERROR,Pe);return}e.assetListResponse=N,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:N,networkDetails:Z})},onError:(_,b,E,Z)=>{const N=this.assignAssetListError(e,K.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${_.code} ${_.text} (${b.url})`),b.url,Z,E);this.hls.trigger(p.ERROR,N)},onTimeout:(_,b,E)=>{const Z=this.assignAssetListError(e,K.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${b.url})`),b.url,_,E);this.hls.trigger(p.ERROR,Z)}};return l.load(c,f,d),this.hls.trigger(p.ASSET_LIST_LOADING,{event:e}),l}assignAssetListError(e,t,n,r,i,s){return e.error=n,{type:le.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:n,networkDetails:s,stats:i}}}function vo(a){a==null||a.play().catch(()=>{})}class Yu extends G{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled)return;const r=n-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const s=r<=-.01;this.timelinePos=n,this.bufferedPos=n;const l=this.playingItem;if(!l){this.checkBuffer();return}if(s&&this.schedule.resetErrorsInRange(n,n-r)&&this.updateSchedule(),this.checkBuffer(),s&&n<l.start||n>=l.end){var c;const _=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(l)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!s){const b=this.findItemIndex(l);if(_>b){const E=this.schedule.findJumpRestrictedIndex(b+1,_);if(E>b){this.setSchedulePosition(E);return}}}this.setSchedulePosition(_);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(l)){const _=l.event.assetList[0];_&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(n,_))}return}const f=u.timelineStart,d=u.duration||0;(s&&n<f||n>=f+d)&&this.setScheduleToAssetAtTime(n,u)},this.onTimeupdate=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled)return;if(n>this.timelinePos)this.timelinePos=n,n>this.bufferedPos&&this.checkBuffer();else return;const r=this.playingItem;if(!r||this.playingLastItem)return;if(n>=r.end){this.timelinePos=r.end;const l=this.findItemIndex(r);this.setSchedulePosition(l+1)}const i=this.playingAsset;if(!i)return;const s=i.timelineStart+(i.duration||0);n>=s&&this.setScheduleToAssetAtTime(n,i)},this.onScheduleUpdate=(n,r)=>{const i=this.schedule,s=this.playingItem,l=i.events||[],c=i.items||[],u=i.durations,f=n.map(E=>E.identifier),d=!!(l.length||f.length);(d||r)&&this.log(`INTERSTITIALS_UPDATED (${l.length}): ${l}
Schedule: ${c.map(E=>$i(E))} pos: ${this.timelinePos}`),f.length&&this.log(`Removed events ${f}`),this.playerQueue.forEach(E=>{if(E.interstitial.appendInPlace){const Z=E.assetItem.timelineStart,N=E.timelineOffset-Z;if(N)try{E.timelineOffset=Z}catch(ae){Math.abs(N)>os&&this.warn(`${ae} ("${E.assetId}" ${E.timelineOffset}->${Z})`)}}});let _=null;if(s){const E=this.updateItem(s,this.timelinePos);this.itemsMatch(s,E)&&(this.playingItem=E,this.waitingItem=this.endedItem=null,_=()=>this.trimInPlace(E,s))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const b=this.bufferingItem;if(b){const E=this.updateItem(b,this.bufferedPos);this.itemsMatch(b,E)?(this.bufferingItem=E,_||(_=()=>this.trimInPlace(E,b))):b.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(b.event,null))}if(n.forEach(E=>{E.assetList.forEach(Z=>{this.clearAssetPlayer(Z.identifier,null)})}),d||r){if(this.hls.trigger(p.INTERSTITIALS_UPDATED,{events:l.slice(0),schedule:c.slice(0),durations:u,removedIds:f}),this.isInterstitial(s)&&f.includes(s.event.identifier)){this.warn(`Interstitial "${s.event.identifier}" removed while playing`),this.primaryFallback(s.event);return}_&&_(),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new ju(e),this.schedule=new Hu(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;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.manager=null,this.hls=this.HlsPlayerClass=this.schedule=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){gi(e,"play",this.onPlay),gi(e,"pause",this.onPause),gi(e,"seeking",this.onSeeking),gi(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const n=this.media=t.media;ci(n,"seeking",this.onSeeking),ci(n,"timeupdate",this.onTimeupdate),ci(n,"play",this.onPlay),ci(n,"pause",this.onPause)}onMediaAttached(e,t){const n=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!r){this.clearScheduleState();const i=this.findItemIndex(n);this.setSchedulePosition(i)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const n=!!t.transferMedia,r=this.media;if(this.media=null,!n&&(r&&this.removeMediaListeners(r),this.detachedData)){const i=this.getBufferingPlayer();i&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,i.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,t=()=>e.bufferingItem||e.waitingItem,n=d=>d&&e.getAssetPlayer(d.identifier),r=(d,_,b,E,Z)=>{if(d){let N=d[_].start;const ae=d.event;if(ae){if(_==="playout"||ae.timelineOccupancy!==Fs.Point){const Pe=n(b);(Pe==null?void 0:Pe.interstitial)===ae&&(N+=Pe.assetItem.startOffset+Pe[Z])}}else{const Pe=E==="bufferedPos"?s():e[E];N+=Pe-d.start}return N}return 0},i=(d,_)=>{if(d!==0&&_!=="primary"&&e.schedule.length){var b;const E=e.schedule.findItemIndexAtTime(d),Z=(b=e.schedule.items)==null?void 0:b[E];if(Z){const N=Z[_].start-Z.start;return d+N}}return d},s=()=>{const d=e.bufferedPos;return d===Number.MAX_VALUE?l("primary"):Math.max(d,0)},l=d=>{var _;return(_=e.primaryDetails)!=null&&_.live?e.primaryDetails.edge:e.schedule.durations[d]},c=(d,_)=>{var b,E;const Z=e.effectivePlayingItem;if(Z!=null&&(b=Z.event)!=null&&b.restrictions.skip)return;e.log(`seek to ${d} "${_}"`);const N=e.effectivePlayingItem,ae=e.schedule.findItemIndexAtTime(d,_),Pe=(E=e.schedule.items)==null?void 0:E[ae],ye=e.getBufferingPlayer(),$e=ye==null?void 0:ye.interstitial,We=$e==null?void 0:$e.appendInPlace,ht=N&&e.itemsMatch(N,Pe);if(N&&(We||ht)){const st=n(e.playingAsset),dt=(st==null?void 0:st.media)||e.primaryMedia;if(dt){const Xe=_==="primary"?dt.currentTime:r(N,_,e.playingAsset,"timelinePos","currentTime"),$t=d-Xe,pn=(We?Xe:dt.currentTime)+$t;if(pn>=0&&(!st||We||pn<=st.duration)){dt.currentTime=pn;return}}}if(Pe){let st=d;if(_!=="primary"){const Xe=Pe[_].start,$t=d-Xe;st=Pe.start+$t}const dt=!e.isInterstitial(Pe);if((!e.isInterstitial(N)||N.event.appendInPlace)&&(dt||Pe.event.appendInPlace)){const Xe=e.media||(We?ye==null?void 0:ye.media:null);Xe&&(Xe.currentTime=st)}else if(N){const Xe=e.findItemIndex(N);if(ae>Xe){const pn=e.schedule.findJumpRestrictedIndex(Xe+1,ae);if(pn>Xe){e.setSchedulePosition(pn);return}}let $t=0;if(dt)e.timelinePos=st,e.checkBuffer();else{var Ye;const pn=Pe==null||(Ye=Pe.event)==null?void 0:Ye.assetList;if(pn){const Vn=d-(Pe[_]||Pe).start;for(let Dn=pn.length;Dn--;){const Cn=pn[Dn];if(Cn.duration&&Vn>=Cn.startOffset&&Vn<Cn.startOffset+Cn.duration){$t=Dn;break}}}}e.setSchedulePosition(ae,$t)}}},u=()=>{const d=e.effectivePlayingItem;if(e.isInterstitial(d))return d;const _=t();return e.isInterstitial(_)?_:null},f={get currentTime(){const d=u(),_=e.effectivePlayingItem;return _&&_===d?r(_,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-_.playout.start:0},set currentTime(d){const _=u(),b=e.effectivePlayingItem;b&&b===_&&c(d+b.playout.start,"playout")},get duration(){const d=u();return d?d.playout.end-d.playout.start:0},get assetPlayers(){var d;const _=(d=u())==null?void 0:d.event.assetList;return _?_.map(b=>e.getAssetPlayer(b.identifier)):[]},get playingIndex(){var d;const _=(d=u())==null?void 0:d.event;return _&&e.effectivePlayingAsset?_.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};this.manager={get events(){var d,_;return((d=e.schedule)==null||(_=d.events)==null?void 0:_.slice(0))||[]},get schedule(){var d,_;return((d=e.schedule)==null||(_=d.items)==null?void 0:_.slice(0))||[]},get interstitialPlayer(){return u()?f:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const d=t();return e.findItemIndex(d)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const d=e.effectivePlayingItem;return e.findItemIndex(d)},primary:{get bufferedEnd(){return s()},get currentTime(){const d=e.timelinePos;return d>0?d:0},set currentTime(d){c(d,"primary")},get duration(){return l("primary")},get seekableStart(){var d;return((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0}},integrated:{get bufferedEnd(){return r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(d){c(d,"integrated")},get duration(){return l("integrated")},get seekableStart(){var d;return i(((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0,"integrated")}},skip:()=>{const d=e.effectivePlayingItem,_=d==null?void 0:d.event;if(_&&!_.restrictions.skip){const b=e.findItemIndex(d);if(_.appendInPlace){const E=d.playout.start+d.event.duration;c(E+.001,"playout")}else e.advanceAfterAssetEnded(_,b,1/0)}}}}return this.manager}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,n=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!n?!1:this.findItemIndex(t)===n.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t,n;if(this.mediaSelection===null)return;const r=this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&!r.event.appendInPlace)return;let i=this.media;!i&&(e=this.bufferingItem)!=null&&(t=e.event)!=null&&t.appendInPlace&&(i=this.primaryMedia);const s=(n=i)==null?void 0:n.currentTime;if(!(s===void 0||!k(s)))return s}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){const n=e.interstitial.appendInPlace,r=e.media;if(n&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}const i=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Mt(i)}`),this.detachedData=i}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var n,r;if(e.media===t)return;let i=null;const s=this.hls,l=e!==s,c=l&&e.interstitial.appendInPlace,u=(n=this.detachedData)==null?void 0:n.mediaSource;let f;if(s.media)c&&(i=s.transferMedia(),this.detachedData=i),f="Primary";else if(u){const b=this.getBufferingPlayer();b?(i=b.transferMedia(),f=`${b}`):f="detached MediaSource"}else f="detached media";if(!i){if(u)i=this.detachedData,this.log(`using detachedData: MediaSource ${Mt(i)}`);else if(!this.detachedData||s.media===t){const b=this.playerQueue;b.length>1&&b.forEach(E=>{if(l&&E.interstitial.appendInPlace!==c){const Z=E.interstitial;this.clearInterstitial(E.interstitial,null),Z.appendInPlace=!1,Z.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${Z}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const d=i&&"mediaSource"in i&&((r=i.mediaSource)==null?void 0:r.readyState)!=="closed",_=d&&i?i:t;if(this.log(`${d?"transfering MediaSource":"attaching media"} to ${l?e:"Primary"} from ${f}`),_===i){const b=l&&e.assetId===this.schedule.assetIdAtEnd;_.overrides={duration:this.schedule.duration,endOfStream:!l||b,cueRemoval:!l}}e.attachMedia(_)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const n=this.timelinePos,r=this.effectivePlayingItem;if(n===-1){const i=this.hls.startPosition;if(this.timelinePos=i,t.length&&t[0].cue.pre){const s=e.findEventIndex(t[0].identifier);this.setSchedulePosition(s)}else if(i>=0||!this.primaryLive){const s=this.timelinePos=i>0?i:0,l=e.findItemIndexAtTime(s);this.setSchedulePosition(l)}}else if(r&&!this.playingItem){const i=e.findItemIndex(r);this.setSchedulePosition(i)}}advanceAfterAssetEnded(e,t,n){const r=ca(e,n);if(!e.isAssetPastPlayoutLimit(r))this.setSchedulePosition(t,r);else{const i=this.schedule.items;if(i){const s=t+1,l=i.length;if(s>=l){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.timelinePos=c,this.checkBuffer()),this.setSchedulePosition(s)}}}setScheduleToAssetAtTime(e,t){const n=this.schedule,r=t.parentIdentifier,i=n.getEvent(r);if(i){const s=n.findEventIndex(r),l=n.findAssetIndex(i,e);this.advanceAfterAssetEnded(i,s,l-1)}}setSchedulePosition(e,t){const n=this.schedule.items;if(!n||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${t}`);const r=e>=0?n[e]:null,i=this.playingItem,s=this.playingLastItem;if(this.isInterstitial(i)){var l;const u=i.event,f=this.playingAsset,d=f==null?void 0:f.identifier,_=d?this.getAssetPlayer(d):null;if(_&&d&&(!this.eventItemsMatch(i,r)||t!==void 0&&d!==((l=u.assetList)==null?void 0:l[t].identifier))){var c;const b=u.findAssetIndex(f);this.log(`INTERSTITIAL_ASSET_ENDED ${b+1}/${u.assetList.length} ${ls(f)}`),this.endedAsset=f,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:f,assetListIndex:b,event:u,schedule:n.slice(0),scheduleIndex:e,player:_}),this.retreiveMediaSource(d,r),_.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&_.detachMedia()}if(!this.eventItemsMatch(i,r)&&(this.endedItem=i,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${$i(i)}`),u.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:u,schedule:n.slice(0),scheduleIndex:e}),u.cue.once)){this.updateSchedule();const b=this.schedule.items;if(r&&b){const E=this.schedule.findItemIndex(r);this.advanceSchedule(E,b,t,i,s)}return}}this.advanceSchedule(e,n,t,i,s)}advanceSchedule(e,t,n,r,i){const s=e>=0?t[e]:null,l=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(u=>{const f=u.interstitial,d=this.schedule.findEventIndex(f.identifier);(d<e||d>e+1)&&this.clearInterstitial(f,s)}),this.isInterstitial(s)){this.timelinePos=Math.min(Math.max(this.timelinePos,s.start),s.end);const u=s.event;if(n===void 0){n=this.schedule.findAssetIndex(u,this.timelinePos);const b=ca(u,n-1);if(u.isAssetPastPlayoutLimit(b)){this.advanceAfterAssetEnded(u,e,n);return}n=b}const f=this.waitingItem;this.assetsBuffered(s,l)||this.setBufferingItem(s);let d=this.preloadAssets(u,n);if(this.eventItemsMatch(s,f||r)||(this.waitingItem=s,this.log(`INTERSTITIAL_STARTED ${$i(s)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(p.INTERSTITIAL_STARTED,{event:u,schedule:t.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=s;const _=u.assetList[n];if(!_){const b=t[e+1],E=this.media;b&&E&&!this.isInterstitial(b)&&E.currentTime<b.start&&(E.currentTime=this.timelinePos=b.start),this.advanceAfterAssetEnded(u,e,n||0);return}if(d||(d=this.getAssetPlayer(_.identifier)),d===null||d.destroyed){const b=u.assetList.length;this.warn(`asset ${n+1}/${b} player destroyed ${u}`),d=this.createAssetPlayer(u,_,n)}if(!this.eventItemsMatch(s,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(_))return;this.startAssetPlayer(d,n,t,e,l),this.shouldPlay&&vo(d.media)}else s!==null?(this.resumePrimary(s,e,r),this.shouldPlay&&vo(this.hls.media)):i&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e,t;return(e=this.mediaSelection)==null||(t=e.main)==null?void 0:t.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,n){var r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${$i(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let s=this.timelinePos;(s<e.start||s>=e.end)&&(s=this.getPrimaryResumption(e,t),this.timelinePos=s),this.attachPrimary(s,e)}if(!n)return;const i=this.schedule.items;i&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${$i(e)}`),this.hls.trigger(p.INTERSTITIALS_PRIMARY_RESUMED,{schedule:i.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const n=e.start;if(this.primaryLive){const r=this.primaryDetails;if(t===0)return this.hls.startPosition;if(r&&(n<r.fragmentStart||n>r.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:dn.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const r=this.primaryMedia;if(!r)return;const i=this.hls;i.media?this.checkBuffer():(this.transferMediaTo(i,r),n&&this.startLoadingPrimaryAt(e,n)),n||(this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){var n;const r=this.hls;!r.loadingEnabled||!r.media||Math.abs((((n=r.mainForwardBufferInfo)==null?void 0:n.start)||r.media.currentTime)-e)>.5?r.startLoad(e,t):r.bufferingEnabled||r.resumeBuffering()}onManifestLoading(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(p.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(p.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1)return;const n=this.hls.levels[t.level],r=y(y({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const n=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=y(y({},this.altSelection),{},{audio:n});return}const i=y(y({},r),{},{audio:n});this.mediaSelection=i}onSubtitleTrackUpdated(e,t){const n=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=y(y({},this.altSelection),{},{subtitles:n});return}const i=y(y({},r),{},{subtitles:n});this.mediaSelection=i}onAudioTrackSwitching(e,t){const n=ut(t);this.playerQueue.forEach(r=>r.hls.setAudioOption(t)||r.hls.setAudioOption(n))}onSubtitleTrackSwitch(e,t){const n=ut(t);this.playerQueue.forEach(r=>r.hls.setSubtitleOption(t)||t.id!==-1&&r.hls.setSubtitleOption(n))}onBufferCodecs(e,t){const n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let r=0;r<t.length;r++){const i=t[r];if(i.cue.post){var n;const s=this.schedule.findEventIndex(i.identifier),l=(n=this.schedule.items)==null?void 0:n[s];this.isInterstitial(l)&&this.eventItemsMatch(l,this.bufferingItem)&&this.bufferedToItem(l,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const n=this.findItemIndex(t);this.setSchedulePosition(n+1)}else this.shouldPlay=!1}updateItem(e,t){const n=this.schedule.items;if(e&&n){const r=this.findItemIndex(e,t);return n[r]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((i,s)=>{e.event.isAssetPastPlayoutLimit(s)&&this.clearAssetPlayer(i.identifier,null)});const n=e.end+.25,r=dn.bufferInfo(this.primaryMedia,n,0);(r.end>n||(r.nextStart||0)>n)&&(this.attachPrimary(n,null),this.flushFrontBuffer(n))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var n;return!!t&&(e===t||e.event.identifier===((n=t.event)==null?void 0:n.identifier))}findItemIndex(e,t){return e?this.schedule.findItemIndex(e,t):-1}updateSchedule(){const e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}checkBuffer(e){const t=this.schedule.items;if(!t)return;const n=dn.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=n.len<1),this.updateBufferedPos(n.end,t,e)}updateBufferedPos(e,t,n){const r=this.schedule,i=this.bufferingItem;if(this.bufferedPos>e)return;if(t.length===1&&this.itemsMatch(t[0],i)){this.bufferedPos=e;return}const s=this.playingItem,l=this.findItemIndex(s);let c=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var u,f;const d=this.findItemIndex(i),_=Math.min(d+1,t.length-1),b=t[_];if((c===-1&&i&&e>=i.end||(u=b.event)!=null&&u.appendInPlace&&e+.01>=b.start)&&(c=_),_-l>1&&(i==null||(f=i.event)==null?void 0:f.appendInPlace)===!1)return;if(this.bufferedPos=e,c>d&&c>l)this.bufferedToItem(b);else{const E=this.primaryDetails;this.primaryLive&&E&&e>E.edge-E.targetduration&&b.start<E.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(b)&&this.preloadAssets(b.event,0)}}else n&&s&&!this.itemsMatch(s,i)&&(c===l?this.bufferedToItem(s):c===l+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(r=>{const i=this.getAssetPlayer(r.identifier);return!(i!=null&&i.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,n=this.schedule;if(this.itemsMatch(e,t))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:r,events:i}=n;if(!r||!i)return t;const s=this.isInterstitial(e),l=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=l?l.remaining:t?t.end-this.timelinePos:0;this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${$i(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),this.playbackDisabled||(s?e.event.assetList.forEach(u=>{const f=this.getAssetPlayer(u.identifier);f&&f.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering()))),this.hls.trigger(p.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:i.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return t}bufferedToItem(e,t=0){const n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(n!==null){this.bufferingAsset=null;const r=this.detachedData;r?r.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){const n=e.event,r=n.assetList.length===0&&!n.assetListLoader,i=n.cue.once;if(r||!i){const s=this.preloadAssets(n,t);if(s!=null&&s.interstitial.appendInPlace){const l=n.assetList[t],c=this.primaryMedia;l&&c&&this.bufferAssetPlayer(s,c)}}}preloadAssets(e,t){const n=e.assetUrl,r=e.assetList.length,i=r===0&&!e.assetListLoader,s=e.cue.once;if(i){const c=e.timelineStart;if(e.appendInPlace){var l;const _=this.playingItem;!this.isInterstitial(_)&&(_==null||(l=_.nextEvent)==null?void 0:l.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let u,f=0;if(!this.playingItem&&this.primaryLive&&(f=this.hls.startPosition,f===-1&&(f=this.hls.liveSyncPosition||0)),f&&!(e.cue.pre||e.cue.post)){const _=f-c;_>0&&(u=Math.round(_*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:r} ${e}${u?` live-start: ${f} start-offset: ${u}`:""}`),n)return this.createAsset(e,0,0,c,e.duration,n);const d=this.assetListLoader.loadAssetList(e,u);d&&(e.assetListLoader=d)}else if(!s&&r){for(let c=t;c<r;c++){const u=e.assetList[c],f=this.getAssetPlayerQueueIndex(u.identifier);(f===-1||this.playerQueue[f].destroyed)&&!u.error&&this.createAssetPlayer(e,u,c)}return this.getAssetPlayer(e.assetList[t].identifier)}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(r=>{this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:r})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let n=0;n<e.length;n++)if(e[n].media===t)return e[n]}return null}createAsset(e,t,n,r,i,s){const l={parentIdentifier:e.identifier,identifier:Gu(e,s,t),duration:i,startOffset:n,timelineStart:r,uri:s};return this.createAssetPlayer(e,l,t)}createAssetPlayer(e,t,n){const r=this.hls,i=r.userConfig;let s=i.videoPreference;const l=r.loadLevelObj||r.levels[r.currentLevel];(s||l)&&(s=h({},s),l.videoCodec&&(s.videoCodec=l.videoCodec),l.videoRange&&(s.allowedVideoRanges=[l.videoRange]));const c=r.audioTracks[r.audioTrack],u=r.subtitleTracks[r.subtitleTrack];let f=0;if(this.primaryLive||e.appendInPlace){const ye=this.timelinePos-t.timelineStart;if(ye>1){const $e=t.duration;$e&&ye<$e&&(f=ye)}}const d=t.identifier,_=y(y({},i),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:f,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:c||i.audioPreference,subtitlePreference:u||i.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(_.timelineOffset=t.timelineStart));const b=_.cmcd;b!=null&&b.sessionId&&b.contentId&&(_.cmcd=h({},b,{contentId:ys(t.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);const E=new Wu(this.HlsPlayerClass,_,e,t);this.playerQueue.push(E),e.assetList[n]=t;const Z=ye=>{if(ye.live){const ht=new Error(`Interstitials MUST be VOD assets ${e}`),Ye={fatal:!0,type:le.OTHER_ERROR,details:K.INTERSTITIAL_ASSET_ITEM_ERROR,error:ht};this.handleAssetItemError(Ye,e,this.schedule.findEventIndex(e.identifier),n,ht.message);return}const $e=ye.edge-ye.fragmentStart,We=t.duration;(We===null||$e>We)&&(this.log(`Interstitial asset "${d}" duration change ${We} > ${$e}`),t.duration=$e,this.updateSchedule())};E.on(p.LEVEL_UPDATED,(ye,{details:$e})=>Z($e)),E.on(p.LEVEL_PTS_UPDATED,(ye,{details:$e})=>Z($e));const N=(ye,$e)=>{const We=this.getAssetPlayer(d);if(We&&$e.tracks){We.off(p.BUFFER_CODECS,N),We.tracks=$e.tracks;const ht=this.primaryMedia;this.bufferingAsset===We.assetItem&&ht&&!We.media&&this.bufferAssetPlayer(We,ht)}};E.on(p.BUFFER_CODECS,N);const ae=()=>{var ye;const $e=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${$e}`),!$e)return;const We=this.schedule.findEventIndex(e.identifier),ht=(ye=this.schedule.items)==null?void 0:ye[We];if(this.isInterstitial(ht)){const st=e.findAssetIndex(t),dt=ca(e,st);if(!e.isAssetPastPlayoutLimit(dt))this.bufferedToItem(ht,dt);else{var Ye;const Xe=(Ye=this.schedule.items)==null?void 0:Ye[We+1];Xe&&this.bufferedToItem(Xe)}}};E.on(p.BUFFERED_TO_END,ae);const Pe=ye=>()=>{if(!this.getAssetPlayer(d))return;this.shouldPlay=!0;const We=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,We,ye)};return E.once(p.MEDIA_ENDED,Pe(n)),E.once(p.PLAYOUT_LIMIT_REACHED,Pe(1/0)),E.on(p.ERROR,(ye,$e)=>{const We=this.getAssetPlayer(d);if($e.details===K.BUFFER_STALLED_ERROR){if(We!=null&&We.media){const ht=We.currentTime,Ye=We.duration-ht;ht&&e.appendInPlace&&Ye/We.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${d} ${e} at ${We.media.currentTime}`),ae()):(this.warn(`Stalled at ${ht} of ${ht+Ye} in asset ${d} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError($e,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${$e.error} ${e}`)}),E.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(d))return;const $e=new Error(`Asset player destroyed unexpectedly ${d}`),We={fatal:!0,type:le.OTHER_ERROR,details:K.INTERSTITIAL_ASSET_ITEM_ERROR,error:$e};this.handleAssetItemError(We,e,this.schedule.findEventIndex(e.identifier),n,$e.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${ls(t)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:E}),E}clearInterstitial(e,t){e.assetList.forEach(n=>{this.clearAssetPlayer(n.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){this.log(`clear asset player "${e}" toSegment: ${t&&$i(t)}`);const r=this.playerQueue[n];this.transferMediaFromPlayer(r,t),this.playerQueue.splice(n,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,n,r,i){const{interstitial:s,assetItem:l,assetId:c}=e,u=s.assetList.length,f=this.playingAsset;this.endedAsset=null,this.playingAsset=l,(!f||f.identifier!==c)&&(f&&(this.clearAssetPlayer(f.identifier,n[r]),delete f.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${ls(l)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_STARTED,{asset:l,assetListIndex:t,event:s,schedule:n.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,i)}bufferAssetPlayer(e,t){var n,r;const{interstitial:i,assetItem:s}=e,l=this.schedule.findEventIndex(i.identifier),c=(n=this.schedule.items)==null?void 0:n[l];if(!c)return;this.setBufferingItem(c),this.bufferingAsset=s;const u=this.getBufferingPlayer();if(u===e)return;const f=i.appendInPlace;if(f&&(u==null?void 0:u.interstitial.appendInPlace)===!1)return;const d=(u==null?void 0:u.tracks)||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(f&&s!==this.playingAsset){if(!e.tracks)return;if(d&&!Ee(d,e.tracks)){const _=new Error(`Asset ${ls(s)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),b={fatal:!0,type:le.OTHER_ERROR,details:K.INTERSTITIAL_ASSET_ITEM_ERROR,error:_},E=i.findAssetIndex(s);this.handleAssetItemError(b,i,l,E,_.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,n,r,i){if(e.details===K.BUFFER_STALLED_ERROR)return;const s=t.assetList[r];this.warn(`INTERSTITIAL_ASSET_ERROR ${s&&ls(s)} ${e.error}`);const l=s==null?void 0:s.identifier,c=this.getAssetPlayerQueueIndex(l),u=this.playerQueue[c]||null,f=this.schedule.items,d=h({},e,{fatal:!1,errorAction:Hn(!0),asset:s,assetListIndex:r,event:t,schedule:f,scheduleIndex:n,player:u});if(this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const _=this.playingAsset,b=new Error(i);if(s&&(this.clearAssetPlayer(l,null),s.error=b),!t.assetList.some(E=>!E.error))t.error=b;else if(t.appendInPlace){for(let E=r;E<t.assetList.length;E++)this.resetAssetPlayer(t.assetList[E].identifier);this.updateSchedule()}t.error?this.primaryFallback(t):_&&_.identifier===l&&this.advanceAfterAssetEnded(t,n,r)}primaryFallback(e){const t=e.timelineStart,n=this.effectivePlayingItem;if(this.updateSchedule(),n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${n?$i(n):"<none>"} error: ${e.error}`);let r=this.timelinePos;r===-1&&(r=this.hls.startPosition);const i=this.updateItem(n,r);this.itemsMatch(n,i)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));const s=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(s)}else this.checkStart()}onAssetListLoaded(e,t){var n;const r=t.event,i=r.identifier,s=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(i))return;const l=r.timelineStart,c=r.duration;let u=0;s.forEach((E,Z)=>{const N=parseFloat(E.DURATION);this.createAsset(r,Z,u,l+u,N,E.URI),u+=N}),r.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${c}) ${r}`);const f=this.waitingItem,d=(f==null?void 0:f.event.identifier)===i;this.updateSchedule();const _=(n=this.bufferingItem)==null?void 0:n.event;if(d){var b;const E=this.schedule.findEventIndex(i),Z=(b=this.schedule.items)==null?void 0:b[E];if(Z){if(!this.playingItem&&this.timelinePos>Z.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==E){r.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${r}`),this.primaryFallback(r);return}this.setBufferingItem(Z)}this.setSchedulePosition(E)}else if((_==null?void 0:_.identifier)===i&&_.appendInPlace){const E=r.assetList[0],Z=this.getAssetPlayer(E.identifier),N=this.primaryMedia;E&&Z&&N&&this.bufferAssetPlayer(Z,N)}}onError(e,t){switch(t.details){case K.ASSET_LIST_PARSING_ERROR:case K.ASSET_LIST_LOAD_ERROR:case K.ASSET_LIST_LOAD_TIMEOUT:{const n=t.interstitial;n&&this.primaryFallback(n);break}case K.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const _o=500;class Xu extends Dr{constructor(e,t,n){super(e,t,n,"subtitle-stream-controller",oe.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=ct.IDLE,this.setInterval(_o),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:n,success:r}=t;if(te(n)&&(this.fragPrevious=n),this.state=ct.IDLE,!r)return;const i=this.tracksBuffered[this.currentTrackId];if(!i)return;let s;const l=n.start;for(let u=0;u<i.length;u++)if(l>=i[u].start&&l<=i[u].end){s=i[u];break}const c=n.start+n.duration;s?s.end=c:(s={start:l,end:c},i.push(s)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:n,endOffset:r}=t;if(n===0&&r!==Number.POSITIVE_INFINITY){const i=r-1;if(i<=0)return;t.endOffsetSubtitles=Math.max(0,i),this.tracksBuffered.forEach(s=>{for(let l=0;l<s.length;){if(s[l].end<=i){s.shift();continue}else if(s[l].start<i)s[l].start=i;else break;l++}}),this.fragmentTracker.removeFragmentsInRange(n,i,oe.SUBTITLE)}}onError(e,t){const n=t.frag;(n==null?void 0:n.type)===oe.SUBTITLE&&(t.details===K.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==ct.STOPPED&&(this.state=ct.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Ja(this.levels,t)){this.levels=t.map(n=>new rt(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const r=new rt(n);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,oe.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==ct.STOPPED&&this.setInterval(_o)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:r,levels:i}=this,{details:s,id:l}=t;if(!i){this.warn(`Subtitle tracks were reset while loading level ${l}`);return}const c=i[l];if(l>=i.length||!c)return;this.log(`Subtitle track ${l} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(s.live||(n=c.details)!=null&&n.live){const d=this.mainDetails;if(s.deltaUpdateFailed||!d)return;const _=d.fragments[0];if(!c.details)s.hasProgramDateTime&&d.hasProgramDateTime?(es(s,d),u=s.fragmentStart):_&&(u=_.start,Br(s,u));else{var f;u=this.alignPlaylists(s,c.details,(f=this.levelLastLoaded)==null?void 0:f.details),u===0&&_&&(u=_.start,Br(s,u))}}c.details=s,this.levelLastLoaded=c,l===r&&(this.hls.trigger(p.SUBTITLE_TRACK_UPDATED,{details:s,id:l,groupId:t.groupId}),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===ct.IDLE&&(Vt(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,r=t.decryptdata,i=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&r!=null&&r.key&&r.iv&&Mr(r.method)){const s=performance.now();this.decrypter.decrypt(new Uint8Array(n),r.key.buffer,r.iv.buffer,Hr(r.method)).catch(l=>{throw i.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:t}),l}).then(l=>{const c=performance.now();i.trigger(p.FRAG_DECRYPTED,{frag:t,payload:l,stats:{tstart:s,tdecrypt:c}})}).catch(l=>{this.warn(`${l.name}: ${l.message}`),this.state=ct.IDLE})}}doTick(){if(!this.media){this.state=ct.IDLE;return}if(this.state===ct.IDLE){const{currentTrackId:e,levels:t}=this,n=t==null?void 0:t[e];if(!n||!t.length||!n.details||this.waitForLive(n))return;const{config:r}=this,i=this.getLoadPosition(),s=dn.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],i,r.maxBufferHole),{end:l,len:c}=s,u=n.details,f=this.hls.maxBufferLength+u.levelTargetDuration;if(c>f)return;const d=u.fragments,_=d.length,b=u.edge;let E=null;const Z=this.fragPrevious;if(l<b){const Pe=r.maxFragLookUpTolerance,ye=l>b-Pe?0:Pe;E=Vt(Z,d,Math.max(d[0].start,l),ye),!E&&Z&&Z.start<d[0].start&&(E=d[0])}else E=d[_-1];if(E=this.filterReplacedPrimary(E,n.details),!E)return;const N=E.sn-u.startSN,ae=d[N-1];if(ae&&ae.cc===E.cc&&this.fragmentTracker.getState(ae)===Kn.NOT_LOADED&&(E=ae),this.fragmentTracker.getState(E)===Kn.NOT_LOADED){const Pe=this.mapToInitFragWhenRequired(E);Pe&&this.loadFragment(Pe,n,l)}}}loadFragment(e,t,n){te(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Qu(this.tracksBuffered[this.currentTrackId]||[])}}class Qu{constructor(e){this.buffered=void 0;const t=(n,r,i)=>{if(r=r>>>0,r>i-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${i})`);return e[r][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}const Ju={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},yo=a=>String.fromCharCode(Ju[a]||a),bi=15,Li=100,qu={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},ec={17:2,18:4,21:6,22:8,23:10,19:13,20:15},tc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},nc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},rc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class ic{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;J.log(`${this.time} [${e}] ${n}`)}}}const ji=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class Eo{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let n=0;n<t.length;n++){const r=t[n];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class sc{constructor(){this.uchar=" ",this.penState=new Eo}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class ac{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Eo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Li;t++)this.chars.push(new sc);this.logger=e}equals(e){for(let t=0;t<Li;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Li;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Li;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>Li&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Li)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=yo(e);if(this.pos>=Li){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<Li;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let n=0;n<Li;n++){const r=this.chars[n].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class fa{constructor(e){this.rows=[],this.currRow=bi-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<bi;t++)this.rows.push(new ac(e));this.logger=e}reset(){for(let e=0;e<bi;e++)this.rows[e].clear();this.currRow=bi-1}equals(e){let t=!0;for(let n=0;n<bi;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<bi;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<bi;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 = "+Mt(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let l=0;l<bi;l++)this.rows[l].clear();const i=this.currRow+1-this.nrRollUpRows,s=this.lastOutputScreen;if(s){const l=s.rows[i].cueStartTime,c=this.logger.time;if(l!==null&&c!==null&&l<c)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(s.rows[i+u])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const i=e.indent,s=Math.max(i-1,0);n.setCursor(e.indent),e.color=n.chars[s].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Mt(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let n="",r=-1;for(let i=0;i<bi;i++){const s=this.rows[i].getTextString();s&&(r=i+1,e?t.push("Row "+r+": '"+s+"'"):t.push(s.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
`)),n}getTextAndFormat(){return this.rows}}class bo{constructor(e,t,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new fa(n),this.nonDisplayedMemory=new fa(n),this.lastOutputScreen=new fa(n),this.currRollUpRow=this.displayedMemory.rows[bi-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[bi-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const n=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[n]}this.logger.log(2,"MIDROW: "+Mt(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 xo{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=lc(),this.logger=void 0;const r=this.logger=new ic;this.channels=[null,new bo(e,t,r),new bo(e+1,n,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const r=t[n]&127,i=t[n+1]&127;let s=!1,l=null;if(r===0&&i===0)continue;this.logger.log(3,()=>"["+ji([t[n],t[n+1]])+"] -> ("+ji([r,i])+")");const c=this.cmdHistory;if(r>=16&&r<=31){if(oc(r,i,c)){Ns(null,null,c),this.logger.log(3,()=>"Repeated command ("+ji([r,i])+") is dropped");continue}Ns(r,i,this.cmdHistory),s=this.parseCmd(r,i),s||(s=this.parseMidrow(r,i)),s||(s=this.parsePAC(r,i)),s||(s=this.parseBackgroundAttributes(r,i))}else Ns(null,null,c);if(!s&&(l=this.parseChars(r,i),l)){const f=this.currentChannel;f&&f>0?this.channels[f].insertChars(l):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!s&&!l&&this.logger.log(2,()=>"Couldn't parse cleaned data "+ji([r,i])+" orig: "+ji([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(n||r))return!1;const i=e===20||e===21||e===23?1:2,s=this.channels[i];return e===20||e===21||e===28||e===29?t===32?s.ccRCL():t===33?s.ccBS():t===34?s.ccAOF():t===35?s.ccAON():t===36?s.ccDER():t===37?s.ccRU(2):t===38?s.ccRU(3):t===39?s.ccRU(4):t===40?s.ccFON():t===41?s.ccRDC():t===42?s.ccTR():t===43?s.ccRTD():t===44?s.ccEDM():t===45?s.ccCR():t===46?s.ccENM():t===47&&s.ccEOC():s.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[n];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+ji([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,i=(e===16||e===24)&&t>=64&&t<=95;if(!(r||i))return!1;const s=e<=23?1:2;t>=64&&t<=95?n=s===1?qu[e]:tc[e]:n=s===1?ec[e]:nc[e];const l=this.channels[s];return l?(l.setPAC(this.interpretPAC(n,t)),this.currentChannel=s,!0):!1}interpretPAC(e,t){let n;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,r.underline=(n&1)===1,n<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((n-16)/2)*4,r}parseChars(e,t){let n,r=null,i=null;if(e>=25?(n=2,i=e-8):(n=1,i=e),i>=17&&i<=19){let s;i===17?s=t+80:i===18?s=t+112:s=t+144,this.logger.log(2,()=>"Special char '"+yo(s)+"' in channel "+n),r=[s]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+ji(r).join(",")),r}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(n||r))return!1;let i;const s={};e===16||e===24?(i=Math.floor((t-32)/2),s.background=rc[i],t%2===1&&(s.background=s.background+"_semi")):t===45?s.background="transparent":(s.foreground="black",t===47&&(s.underline=!0));const l=e<=23?1:2;return this.channels[l].setBkgData(s),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Ns(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function Ns(a,e,t){t.a=a,t.b=e}function oc(a,e,t){return t.a===a&&t.b===e}function lc(){return{a:null,b:null}}var da=function(){if(lr!=null&&lr.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(l,c){if(typeof c!="string"||!Array.isArray(l))return!1;const u=c.toLowerCase();return~l.indexOf(u)?u:!1}function n(l){return t(a,l)}function r(l){return t(e,l)}function i(l,...c){let u=1;for(;u<arguments.length;u++){const f=arguments[u];for(const d in f)l[d]=f[d]}return l}function s(l,c,u){const f=this,d={enumerable:!0};f.hasBeenReset=!1;let _="",b=!1,E=l,Z=c,N=u,ae=null,Pe="",ye=!0,$e="auto",We="start",ht=50,Ye="middle",st=50,dt="middle";Object.defineProperty(f,"id",i({},d,{get:function(){return _},set:function(Xe){_=""+Xe}})),Object.defineProperty(f,"pauseOnExit",i({},d,{get:function(){return b},set:function(Xe){b=!!Xe}})),Object.defineProperty(f,"startTime",i({},d,{get:function(){return E},set:function(Xe){if(typeof Xe!="number")throw new TypeError("Start time must be set to a number.");E=Xe,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",i({},d,{get:function(){return Z},set:function(Xe){if(typeof Xe!="number")throw new TypeError("End time must be set to a number.");Z=Xe,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",i({},d,{get:function(){return N},set:function(Xe){N=""+Xe,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",i({},d,{get:function(){return ae},set:function(Xe){ae=Xe,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",i({},d,{get:function(){return Pe},set:function(Xe){const $t=n(Xe);if($t===!1)throw new SyntaxError("An invalid or illegal string was specified.");Pe=$t,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",i({},d,{get:function(){return ye},set:function(Xe){ye=!!Xe,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",i({},d,{get:function(){return $e},set:function(Xe){if(typeof Xe!="number"&&Xe!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");$e=Xe,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",i({},d,{get:function(){return We},set:function(Xe){const $t=r(Xe);if(!$t)throw new SyntaxError("An invalid or illegal string was specified.");We=$t,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",i({},d,{get:function(){return ht},set:function(Xe){if(Xe<0||Xe>100)throw new Error("Position must be between 0 and 100.");ht=Xe,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",i({},d,{get:function(){return Ye},set:function(Xe){const $t=r(Xe);if(!$t)throw new SyntaxError("An invalid or illegal string was specified.");Ye=$t,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",i({},d,{get:function(){return st},set:function(Xe){if(Xe<0||Xe>100)throw new Error("Size must be between 0 and 100.");st=Xe,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",i({},d,{get:function(){return dt},set:function(Xe){const $t=r(Xe);if(!$t)throw new SyntaxError("An invalid or illegal string was specified.");dt=$t,this.hasBeenReset=!0}})),f.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class uc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function So(a){function e(n,r,i,s){return(n|0)*3600+(r|0)*60+(i|0)+parseFloat(s||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 cc{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let r=0;r<n.length;++r)if(t===n[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function wo(a,e,t,n){const r=n?a.split(n):[a];for(const i in r){if(typeof r[i]!="string")continue;const s=r[i].split(t);if(s.length!==2)continue;const l=s[0],c=s[1];e(l,c)}}const ha=new da(0,0,""),Bs=ha.align==="middle"?"middle":"center";function fc(a,e,t){const n=a;function r(){const l=So(a);if(l===null)throw new Error("Malformed timestamp: "+n);return a=a.replace(/^[^\sa-zA-Z-]+/,""),l}function i(l,c){const u=new cc;wo(l,function(_,b){let E;switch(_){case"region":for(let Z=t.length-1;Z>=0;Z--)if(t[Z].id===b){u.set(_,t[Z].region);break}break;case"vertical":u.alt(_,b,["rl","lr"]);break;case"line":E=b.split(","),u.integer(_,E[0]),u.percent(_,E[0])&&u.set("snapToLines",!1),u.alt(_,E[0],["auto"]),E.length===2&&u.alt("lineAlign",E[1],["start",Bs,"end"]);break;case"position":E=b.split(","),u.percent(_,E[0]),E.length===2&&u.alt("positionAlign",E[1],["start",Bs,"end","line-left","line-right","auto"]);break;case"size":u.percent(_,b);break;case"align":u.alt(_,b,["start",Bs,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let f=u.get("line","auto");f==="auto"&&ha.line===-1&&(f=-1),c.line=f,c.lineAlign=u.get("lineAlign","start"),c.snapToLines=u.get("snapToLines",!0),c.size=u.get("size",100),c.align=u.get("align",Bs);let d=u.get("position","auto");d==="auto"&&ha.position===50&&(d=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=d}function s(){a=a.replace(/^\s+/,"")}if(s(),e.startTime=r(),s(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);a=a.slice(3),s(),e.endTime=r(),s(),i(a,e)}function To(a){return a.replace(/<br(?: \/)?>/gi,`
`)}class dc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new uc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function n(){let i=t.buffer,s=0;for(i=To(i);s<i.length&&i[s]!=="\r"&&i[s]!==`
`;)++s;const l=i.slice(0,s);return i[s]==="\r"&&++s,i[s]===`
`&&++s,t.buffer=i.slice(s),l}function r(i){wo(i,function(s,l){},/:/)}try{let i="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;i=n();const l=i.match(/^()?WEBVTT([ \t].*)?$/);if(!(l!=null&&l[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let s=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:i=n(),t.state){case"HEADER":/:/.test(i)?r(i):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new da(0,0,""),t.state="CUE",i.indexOf("-->")===-1){t.cue.id=i;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{fc(i,t.cue,t.regionList)}catch(l){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const l=i.indexOf("-->")!==-1;if(!i||l&&(s=!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+=i}continue;case"BADCUE":i||(t.state="ID")}}}catch(i){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 hc=/\r\n|\n\r|\n|\r/g,pa=function(e,t,n=0){return e.slice(n,n+t.length)===t},pc=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),i=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!k(t)||!k(n)||!k(r)||!k(i))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*r,t+=60*60*1e3*i,t};function ga(a,e,t){return ys(a.toString())+ys(e.toString())+ys(t)}const gc=function(e,t,n){let r=e[t],i=e[r.prevCC];if(!i||!i.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(s=i)!=null&&s.new;){var s;e.ccOffset+=r.start-i.start,r.new=!1,r=i,i=e[r.prevCC]}e.presentationOffset=n};function mc(a,e,t,n,r,i,s){const l=new dc,c=Ne(new Uint8Array(a)).trim().replace(hc,`
`).split(`
`),u=[],f=e?Nl(e.baseTime,e.timescale):0;let d="00:00.000",_=0,b=0,E,Z=!0;l.oncue=function(N){const ae=t[n];let Pe=t.ccOffset;const ye=(_-f)/9e4;if(ae!=null&&ae.new&&(b!==void 0?Pe=t.ccOffset=ae.start:gc(t,n,ye)),ye){if(!e){E=new Error("Missing initPTS for VTT MPEGTS");return}Pe=ye-t.presentationOffset}const $e=N.endTime-N.startTime,We=pi((N.startTime+Pe-b)*9e4,r*9e4)/9e4;N.startTime=Math.max(We,0),N.endTime=Math.max(We+$e,0);const ht=N.text.trim();N.text=decodeURIComponent(encodeURIComponent(ht)),N.id||(N.id=ga(N.startTime,N.endTime,ht)),N.endTime>0&&u.push(N)},l.onparsingerror=function(N){E=N},l.onflush=function(){if(E){s(E);return}i(u)},c.forEach(N=>{if(Z)if(pa(N,"X-TIMESTAMP-MAP=")){Z=!1,N.slice(16).split(",").forEach(ae=>{pa(ae,"LOCAL:")?d=ae.slice(6):pa(ae,"MPEGTS:")&&(_=parseInt(ae.slice(7)))});try{b=pc(d)/1e3}catch(ae){E=ae}return}else N===""&&(Z=!1);l.parse(N+`
`)}),l.flush()}const ma="stpp.ttml.im1t",Ao=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Do=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,vc={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ro(a,e,t,n){const r=F(new Uint8Array(a),["mdat"]);if(r.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const i=r.map(l=>Ne(l)),s=Fl(e.baseTime,1,e.timescale);try{i.forEach(l=>t(_c(l,s)))}catch(l){n(l)}}function _c(a,e){const r=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=Object.keys(i).reduce((d,_)=>(d[_]=r.getAttribute(`ttp:${_}`)||i[_],d),{}),l=r.getAttribute("xml:space")!=="preserve",c=Co(va(r,"styling","style")),u=Co(va(r,"layout","region")),f=va(r,"body","[begin]");return[].map.call(f,d=>{const _=Io(d,l);if(!_||!d.hasAttribute("begin"))return null;const b=ya(d.getAttribute("begin"),s),E=ya(d.getAttribute("dur"),s);let Z=ya(d.getAttribute("end"),s);if(b===null)throw Lo(d);if(Z===null){if(E===null)throw Lo(d);Z=b+E}const N=new da(b-e,Z-e,_);N.id=ga(N.startTime,N.endTime,N.text);const ae=u[d.getAttribute("region")],Pe=c[d.getAttribute("style")],ye=yc(ae,Pe,c),{textAlign:$e}=ye;if($e){const We=vc[$e];We&&(N.lineAlign=We),N.align=$e}return h(N,ye),N}).filter(d=>d!==null)}function va(a,e,t){const n=a.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function Co(a){return a.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function Io(a,e){return[].slice.call(a.childNodes).reduce((t,n,r)=>{var i;return n.nodeName==="br"&&r?t+`
`:(i=n.childNodes)!=null&&i.length?Io(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function yc(a,e,t){const n="http://www.w3.org/ns/ttml#styling";let r=null;const i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],s=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return s&&t.hasOwnProperty(s)&&(r=t[s]),i.reduce((l,c)=>{const u=_a(e,n,c)||_a(a,n,c)||_a(r,n,c);return u&&(l[c]=u),l},{})}function _a(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function Lo(a){return new Error(`Could not parse ttml timestamp ${a}`)}function ya(a,e){if(!a)return null;let t=So(a);return t===null&&(Ao.test(a)?t=Ec(a,e):Do.test(a)&&(t=bc(a,e))),t}function Ec(a,e){const t=Ao.exec(a),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function bc(a,e){const t=Do.exec(a),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class Us{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class xc{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=Oo(),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 Us(this,"textTrack1"),t=new Us(this,"textTrack2"),n=new Us(this,"textTrack3"),r=new Us(this,"textTrack4");this.cea608Parser1=new xo(1,e,t),this.cea608Parser2=new xo(3,n,r)}addCues(e,t,n,r,i){let s=!1;for(let l=i.length;l--;){const c=i[l],u=Sc(c[0],c[1],t,n);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],n),s=!0,u/(n-t)>.5))return}if(s||i.push([t,n]),this.config.renderTextTracksNatively){const l=this.captionsTracks[e];this.Cues.newCue(l,t,n,r)}else{const l=this.Cues.newCue(null,t,n,r);this.hls.trigger(p.CUES_PARSED,{type:"captions",cues:l,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:i}){const{unparsedVttFrags:s}=this;n===oe.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:i}),s.length&&(this.unparsedVttFrags=[],s.forEach(l=>{this.onFragLoaded(p.FRAG_LOADED,l)}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let r=0;r<n.textTracks.length;r++){const i=n.textTracks[r];if(Po(i,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return i}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:r}=this,{label:i,languageCode:s}=t[e],l=this.getExistingTrack(i,s);if(l)n[e]=l,as(n[e]),ho(n[e],r);else{const c=this.createTextTrack("captions",i,s);c&&(c[e]=!0,n[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,r={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,n){const r=this.media;if(r)return r.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const n=!!t.transferMedia;if(this.media=null,n)return;const{captionsTracks:r}=this;Object.keys(r).forEach(i=>{as(r[i]),delete r[i]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Oo(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let n=0;n<t.length;n++)as(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],r=n.some(i=>i.textCodec===ma);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(Ja(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const s=this.media,l=s?Ms(s.textTracks):null;if(this.tracks.forEach((c,u)=>{let f;if(l){let d=null;for(let _=0;_<l.length;_++)if(l[_]&&Po(l[_],c)){d=l[_],l[_]=null;break}d&&(f=d)}if(f)as(f);else{const d=ko(c);f=this.createTextTrack(d,c.name,c.lang),f&&(f.mode="disabled")}f&&this.textTracks.push(f)}),l!=null&&l.length){const c=l.filter(u=>u!==null).map(u=>u.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const s=this.tracks.map(l=>({label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}));this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:s})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const r=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!r)return;const i=`textTrack${r[1]}`,s=this.captionsProperties[i];s&&(s.label=n.name,n.lang&&(s.languageCode=n.lang),s.media=n)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===oe.MAIN){var n,r;const{cea608Parser1:i,cea608Parser2:s,lastSn:l}=this,{cc:c,sn:u}=t.frag,f=(n=(r=t.part)==null?void 0:r.index)!=null?n:-1;i&&s&&(u!==l+1||u===l&&f!==this.lastPartIndex+1||c!==this.lastCc)&&(i.reset(),s.reset()),this.lastCc=c,this.lastSn=u,this.lastPartIndex=f}}onFragLoaded(e,t){const{frag:n,payload:r}=t;if(n.type===oe.SUBTITLE)if(r.byteLength){const i=n.decryptdata,s="stats"in t;if(i==null||!i.encrypted||s){const l=this.tracks[n.level],c=this.vttCCs;c[n.cc]||(c[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),l&&l.textCodec===ma?this._parseIMSC1(n,r):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;Ro(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),n.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{n.logger.log(`Failed to parse IMSC1: ${r}`),n.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:n,payload:r}=e,{initPTS:i,unparsedVttFrags:s}=this,l=i.length-1;if(!i[n.cc]&&l===-1){s.push(e);return}const c=this.hls,u=(t=n.initSegment)!=null&&t.data?Ce(n.initSegment.data,new Uint8Array(r)).buffer:r;mc(u,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,f=>{this._appendCues(f,n.level),c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},f=>{const d=f.message==="Missing initPTS for VTT MPEGTS";d?s.push(e):this._fallbackToIMSC1(n,r),c.logger.log(`Failed to parse VTT cue: ${f}`),!(d&&l>n.cc)&&c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:f})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||Ro(t,this.initPTS[e.cc],()=>{n.textCodec=ma,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(i=>po(r,i))}else{const r=this.tracks[t];if(!r)return;const i=r.default?"default":"subtitles"+t;n.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:i})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===oe.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:r}=t;if(!(n.type===oe.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let i=0;i<r.length;i++){const s=r[i].bytes;if(s){this.cea608Parser1||this.initCea608Parsers();const l=this.extractCea608Data(s);this.cea608Parser1.addData(r[i].pts,l[0]),this.cea608Parser2.addData(r[i].pts,l[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:r,type:i}){const{media:s}=this;if(!(!s||s.currentTime<n)){if(!i||i==="video"){const{captionsTracks:l}=this;Object.keys(l).forEach(c=>la(l[c],t,n))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:l}=this;Object.keys(l).forEach(c=>la(l[c],t,r))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let r=2;for(let i=0;i<n;i++){const s=e[r++],l=127&e[r++],c=127&e[r++];if(l===0&&c===0)continue;if((4&s)!==0){const f=3&s;(f===0||f===1)&&(t[f].push(l),t[f].push(c))}}return t}}function ko(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Po(a,e){return!!a&&a.kind===ko(e)&&na(e,a)}function Sc(a,e,t,n){return Math.min(e,n)-Math.max(a,t)}function Oo(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const wc=/\s/,Tc={newCue(a,e,t,n){const r=[];let i,s,l,c,u;const f=self.VTTCue||self.TextTrackCue;for(let _=0;_<n.rows.length;_++)if(i=n.rows[_],l=!0,c=0,u="",!i.isEmpty()){var d;for(let Z=0;Z<i.chars.length;Z++)wc.test(i.chars[Z].uchar)&&l?c++:(u+=i.chars[Z].uchar,l=!1);i.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const b=To(u.trim()),E=ga(e,t,b);a!=null&&(d=a.cues)!=null&&d.getCueById(E)||(s=new f(e,t,b),s.id=E,s.line=_+1,s.align="left",s.position=10+Math.min(80,Math.floor(c*8/32)*10),r.push(s))}return a&&r.length&&(r.sort((_,b)=>_.line==="auto"||b.line==="auto"?0:_.line>8&&b.line>8?b.line-_.line:_.line-b.line),r.forEach(_=>po(a,_))),r}};function Ac(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const Dc=/(\d+)-(\d+)\/(\d+)/;class Mo{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||Lc,this.controller=new self.AbortController,this.stats=new v}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,n){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const i=Rc(e,this.controller.signal),s=e.responseType==="arraybuffer",l=s?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,i),self.clearTimeout(this.requestTimeout),t.timeout=c&&k(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(ms(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(d=>{var _;this.response=this.loader=d;const b=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},u-(b-r.loading.start)),!d.ok){const{status:Z,statusText:N}=d;throw new kc(N||"fetch, bad network response",Z,d)}r.loading.first=b,r.total=Ic(d.headers)||r.total;const E=(_=this.callbacks)==null?void 0:_.onProgress;return E&&k(t.highWaterMark)?this.loadProgressively(d,r,e,t.highWaterMark,E):s?d.arrayBuffer():e.responseType==="json"?d.json():d.text()}).then(d=>{var _,b;const E=this.response;if(!E)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const Z=d[l];Z&&(r.loaded=r.total=Z);const N={url:E.url,data:d,code:E.status},ae=(_=this.callbacks)==null?void 0:_.onProgress;ae&&!k(t.highWaterMark)&&ae(r,e,d,E),(b=this.callbacks)==null||b.onSuccess(N,r,e,E)}).catch(d=>{var _;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const b=d&&d.code||0,E=d?d.message:null;(_=this.callbacks)==null||_.onError({code:b,text:E},e,d?d.details:null,r)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,n,r=0,i){const s=new Yr,l=e.body.getReader(),c=()=>l.read().then(u=>{if(u.done)return s.dataLength&&i(t,n,s.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const f=u.value,d=f.length;return t.loaded+=d,d<r||s.dataLength?(s.push(f),s.dataLength>=r&&i(t,n,s.flush().buffer,e)):i(t,n,f.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function Rc(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(h({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function Cc(a){const e=Dc.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Ic(a){const e=a.get("Content-Range");if(e){const n=Cc(e);if(k(n))return n}const t=a.get("Content-Length");if(t)return parseInt(t)}function Lc(a,e){return new self.Request(a.url,e)}class kc extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const Pc=/^age:\s*[\d.]+\s*$/im;class Fo{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new v,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,n){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return i(n,t.url)}).catch(s=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),i(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(s=>{var l;(l=this.callbacks)==null||l.onError({code:n.status,text:s.message},t,n,r)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:s}=n.loadPolicy;if(r)for(const l in r)e.setRequestHeader(l,r[l]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),n.timeout=i&&k(i)?i:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const r=t.readyState,i=this.config;if(!n.aborted&&r>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const u=t.status,f=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const E=f!=null?f:t.response;if(E!=null){var s,l;n.loading.end=Math.max(self.performance.now(),n.loading.first);const Z=t.responseType==="arraybuffer"?E.byteLength:E.length;n.loaded=n.total=Z,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);const N=(s=this.callbacks)==null?void 0:s.onProgress;N&&N(n,e,E,t);const ae={url:t.responseURL,data:E,code:u};(l=this.callbacks)==null||l.onSuccess(ae,n,e,t);return}}const d=i.loadPolicy.errorRetry,_=n.retry,b={url:e.url,data:void 0,code:u};if(cn(d,_,!1,b))this.retry(d);else{var c;J.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(cn(e,t,!0))this.retry(e);else{var n;J.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=an(e,n.retry),n.retry++,J.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Pc.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Oc={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Mc=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:Fo,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Qt,bufferController:Jl,capLevelController:ia,errorController:Qn,fpsController:Bu,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:yr,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:Oc},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Fc()),{},{subtitleStreamController:Xu,subtitleTrackController:Ku,timelineController:xc,audioStreamController:jl,audioTrackController:Yl,emeController:ss,cmcdController:Mu,contentSteeringController:Nu,interstitialsController:Yu});function Fc(){return{cueHandler:Tc,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 Nc(a,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const n=Ea(a),r=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(s=>{const l=`${s==="level"?"playlist":s}LoadPolicy`,c=e[l]===void 0,u=[];i.forEach(f=>{const d=`${s}Loading${f}`,_=e[d];if(_!==void 0&&c){u.push(d);const b=n[l].default;switch(e[l]={default:b},f){case"TimeOut":b.maxLoadTimeMs=_,b.maxTimeToFirstByteMs=_;break;case"MaxRetry":b.errorRetry.maxNumRetry=_,b.timeoutRetry.maxNumRetry=_;break;case"RetryDelay":b.errorRetry.retryDelayMs=_,b.timeoutRetry.retryDelayMs=_;break;case"MaxRetryTimeout":b.errorRetry.maxRetryDelayMs=_,b.timeoutRetry.maxRetryDelayMs=_;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${l}": ${Mt(e[l])}`)}),y(y({},n),e)}function Ea(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(Ea):Object.keys(a).reduce((e,t)=>(e[t]=Ea(a[t]),e),{}):a}function Bc(a,e){const t=a.loader;t!==Mo&&t!==Fo?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):Ac()&&(a.loader=Mo,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const $s=2,Uc=.1,$c=.05,Kc=100;class Zc extends dr{constructor(e,t){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var n;(n=this.media)!=null&&n.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var n;this.ended=((n=this.media)==null?void 0:n.currentTime)||1,this.hls.trigger(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(Kc),this.mediaSource=t.mediaSource;const n=this.media=t.media;ci(n,"playing",this.onMediaPlaying),ci(n,"waiting",this.onMediaWaiting),ci(n,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:n}=this;n&&(gi(n,"playing",this.onMediaPlaying),gi(n,"waiting",this.onMediaWaiting),gi(n,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var n,r;const i=(n=this.hls)==null?void 0:n.config;if(!i)return;const s=this.media;if(!s)return;const{seeking:l}=s,c=this.seeking&&!l,u=!this.seeking&&l,f=s.paused&&!l||s.ended||s.playbackRate===0;if(this.seeking=l,e!==t){t&&(this.ended=0),this.moved=!0,l||(this.nudgeRetry=0,i.nudgeOnVideoHole&&!f&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(u||c){c&&this.stallResolved(e);return}if(f){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&s.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1}));return}if(!dn.getBuffered(s).length){this.nudgeRetry=0;return}const d=dn.bufferInfo(s,e,0),_=d.nextStart||0,b=this.fragmentTracker;if(l&&b&&this.hls){const ht=No(this.hls.inFlightFragments,e),Ye=d.len>$s,st=!_||ht||_-e>$s&&!b.getPartialFragment(e);if(Ye||st)return;this.moved=!1}const E=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&b){if(!(d.len>0)&&!_)return;const Ye=Math.max(_,d.start||0)-e,dt=!!(E!=null&&E.live)?E.targetduration*2:$s,Xe=b.getPartialFragment(e);if(Ye>0&&(Ye<=dt||Xe)){s.paused||this._trySkipBufferHole(Xe);return}}const Z=i.detectStallWithCurrentTimeMs,N=self.performance.now(),ae=this.waiting;let Pe=this.stalled;if(Pe===null)if(ae>0&&N-ae<Z)Pe=this.stalled=ae;else{this.stalled=N;return}const ye=N-Pe;if(!l&&(ye>=Z||ae)&&this.hls){var $e;if((($e=this.mediaSource)==null?void 0:$e.readyState)==="ended"&&!(E!=null&&E.live)&&Math.abs(e-((E==null?void 0:E.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(d),!this.media||!this.hls)return}const We=dn.bufferInfo(s,e,i.maxBufferHole);this._tryFixBufferStall(We,ye,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(p.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var n;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&r&&r.length>1&&e>r.end(0)){const i=dn.bufferedInfo(dn.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&t>=i.start){const s=dn.timeRangesToArray(r),l=dn.bufferedInfo(s,t,0).bufferedIndex;if(l>-1&&l<s.length-1){const c=dn.bufferedInfo(s,e,0).bufferedIndex,u=s[l].end,f=s[l+1].start;if((c===-1||c>l)&&f-u<1&&e-u<2){const d=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${f} buffered index: ${c}`);this.warn(d.message),this.media.currentTime+=1e-6;const _=this.fragmentTracker.getPartialFragment(e)||void 0,b=dn.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:_,buffer:b.len,bufferInfo:b})}}}}}_tryFixBufferStall(e,t,n){var r,i;const{fragmentTracker:s,media:l}=this,c=(r=this.hls)==null?void 0:r.config;if(!l||!s||!c)return;const u=(i=this.hls)==null?void 0:i.latestLevelDetails,f=s.getPartialFragment(n);if((f||u!=null&&u.live&&n<u.fragmentStart)&&(this._trySkipBufferHole(f)||!this.media))return;const d=e.buffered,_=this.adjacentTraversal(e,n);(d&&d.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-n<c.maxBufferHole||_))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const n=this.fragmentTracker,r=e.nextStart;if(n&&r){const i=n.getFragAtPos(t,oe.MAIN),s=n.getFragAtPos(r,oe.MAIN);if(i&&s)return s.sn-i.sn<2}return!1}_reportStall(e){const{hls:t,media:n,stallReported:r,stalled:i}=this;if(!r&&i!==null&&n&&t){this.stallReported=!0;const s=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${Mt(e)})`);this.warn(s.message),t.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len,bufferInfo:e,stalled:{start:i}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:n,media:r}=this,i=(t=this.hls)==null?void 0:t.config;if(!r||!n||!i)return 0;const s=r.currentTime,l=dn.bufferInfo(r,s,0),c=s<l.start?l.start:l.nextStart;if(c&&this.hls){const f=l.len<=i.maxBufferHole,d=l.len>0&&l.len<1&&r.readyState<3,_=c-s;if(_>0&&(f||d)){if(_>i.maxBufferHole){let E=!1;if(s===0){const Z=n.getAppendedFrag(0,oe.MAIN);Z&&c<Z.end&&(E=!0)}if(!E){const Z=e||n.getAppendedFrag(s,oe.MAIN);if(Z){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||No(this.hls.inFlightFragments,c))return 0;let ae=!1,Pe=Z.end;for(;Pe<c;){const ye=n.getPartialFragment(Pe);if(ye)Pe+=ye.duration;else{ae=!0;break}}if(ae)return 0}}}const b=Math.max(c+$c,s+Uc);if(this.warn(`skipping hole, adjusting currentTime from ${s} to ${b}`),this.moved=!0,r.currentTime=b,!(e!=null&&e.gap)){const E=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${b}`);this.hls.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:E,reason:E.message,frag:e||void 0,buffer:l.len,bufferInfo:l})}return b}}return 0}_tryNudgeBuffer(e){const{hls:t,media:n,nudgeRetry:r}=this,i=t==null?void 0:t.config;if(!n||!i)return 0;const s=n.currentTime;if(this.nudgeRetry++,r<i.nudgeMaxRetry){const l=s+(r+1)*i.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${s} to ${l}`);this.warn(c.message),n.currentTime=l,t.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const l=new Error(`Playhead still not moving while enough data buffered @${s} after ${i.nudgeMaxRetry} nudges`);this.error(l.message),t.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,error:l,fatal:!0,buffer:e.len,bufferInfo:e})}}}function No(a,e){const t=Bo(a.main);if(t&&t.start<=e)return t;const n=Bo(a.audio);return n&&n.start<=e?n:null}function Bo(a){if(!a)return null;switch(a.state){case ct.IDLE:case ct.STOPPED:case ct.ENDED:case ct.ERROR:return null}return a.frag}const Gc=.25;function ba(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Uo(a,e,t,n,r){let i=new a(e,t,"");try{i.value=n,r&&(i.type=r)}catch(s){i=new a(e,t,Mt(r?y({type:r},n):n))}return i}const Ks=(()=>{const a=ba();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Vc(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class zc{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!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.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.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 n;this.media=t.media,((n=t.overrides)==null?void 0:n.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){const e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&as(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const n=e[t];if(n.kind==="metadata"&&n.label==="id3")return ho(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:n,enableID3MetadataCues:r}}}=this;if(!n&&!r)return;const{samples:i}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const s=ba();if(s)for(let l=0;l<i.length;l++){const c=i[l].type;if(c===ui.emsg&&!n||!r)continue;const u=La(i[l].data);if(u){const f=i[l].pts;let d=f+i[l].duration;d>Ks&&(d=Ks),d-f<=0&&(d=f+Gc);for(let b=0;b<u.length;b++){const E=u[b];if(!ka(E)){this.updateId3CueEnds(f,c);const Z=Uo(s,f,d,E,c);Z&&this.id3Track.addCue(Z)}}}}}updateId3CueEnds(e,t){var n;const r=(n=this.id3Track)==null?void 0:n.cues;if(r)for(let i=r.length;i--;){const s=r[i];s.type===t&&s.startTime<e&&s.endTime===Ks&&(s.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:r}){const{id3Track:i,hls:s}=this;if(!s)return;const{config:{enableEmsgMetadataCues:l,enableID3MetadataCues:c}}=s;if(i&&(l||c)){let u;r==="audio"?u=f=>f.type===ui.audioId3&&c:r==="video"?u=f=>f.type===ui.emsg&&l:u=f=>f.type===ui.audioId3&&c||f.type===ui.emsg&&l,la(i,t,n,u)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:n}=this,{dateRanges:r}=e,i=Object.keys(r);let s=this.dateRangeCuesAppended;if(n&&t){var l;if((l=n.cues)!=null&&l.length){const f=Object.keys(s).filter(d=>!i.includes(d));for(let d=f.length;d--;){const _=f[d],b=s[_].cues;delete s[_],Object.keys(b).forEach(E=>{try{const Z=b[E];Z.removeEventListener("enter",this.onEventCueEnter),n.removeCue(Z)}catch(Z){}})}}else s=this.dateRangeCuesAppended={}}const c=e.fragments[e.fragments.length-1];if(i.length===0||!k(c==null?void 0:c.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const u=ba();for(let f=0;f<i.length;f++){const d=i[f],_=r[d],b=_.startTime,E=s[d],Z=(E==null?void 0:E.cues)||{};let N=(E==null?void 0:E.durationKnown)||!1,ae=Ks;const{duration:Pe,endDate:ye}=_;if(ye&&Pe!==null)ae=b+Pe,N=!0;else if(_.endOnNext&&!N){const We=i.reduce((ht,Ye)=>{if(Ye!==_.id){const st=r[Ye];if(st.class===_.class&&st.startDate>_.startDate&&(!ht||_.startDate<ht.startDate))return st}return ht},null);We&&(ae=We.startTime,N=!0)}const $e=Object.keys(_.attr);for(let We=0;We<$e.length;We++){const ht=$e[We];if(!Or(ht))continue;const Ye=Z[ht];if(Ye)N&&!E.durationKnown?Ye.endTime=ae:Math.abs(Ye.startTime-b)>.01&&(Ye.startTime=b,Ye.endTime=ae);else if(u){let st=_.attr[ht];Wr(ht)&&(st=Vc(st));const Xe=Uo(u,b,ae,{key:ht,data:st},ui.dateRange);Xe&&(Xe.id=d,this.id3Track.addCue(Xe),Z[ht]=Xe,this.hls.config.interstitialsController&&(ht==="X-ASSET-LIST"||ht==="X-ASSET-URL")&&Xe.addEventListener("enter",this.onEventCueEnter))}}s[d]={cues:Z,dateRange:_,durationKnown:N}}}}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,n=this.levelDetails;if(!t||!n)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:s}=this.config;if(!i||s===1||!n.live)return;const l=this.targetLatency;if(l===null)return;const c=r-l,u=Math.min(this.maxLatency,l+n.targetduration);if(c<u&&c>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,s)),_=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,b=Math.min(d,Math.max(1,_));this.changeMediaPlaybackRate(t,b)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:n,targetduration:r}=e,{liveSyncDuration:i,liveSyncDurationCount:s,lowLatencyMode:l}=this.config,c=this.hls.userConfig;let u=l&&n||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=i!==void 0?i:s*r);const f=r;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,f)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const n=this.levelDetails;if(n===null)return null;const r=n.edge,i=e-t-this.edgeStalled,s=r-n.totalduration,l=r-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(s,i),l)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(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 n;t.details===K.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var n,r;e.playbackRate!==t&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(r=this.targetLatency)==null?void 0:r.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class Hc extends ta{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 n=this.hls.config.preferManagedMediaSource,r=[],i={},s={};let l=!1,c=!1,u=!1;t.levels.forEach(f=>{const d=f.attrs;let{audioCodec:_,videoCodec:b}=f;_&&(f.audioCodec=_=Ve(_,n)||void 0),b&&(b=f.videoCodec=Pt(b));const{width:E,height:Z,unknownCodecs:N}=f;let ae=N?N.length:0;if(N)for(let Xe=ae;Xe--;){const $t=N[Xe];this.isAudioSupported($t)?(f.audioCodec=_=_?`${_},${$t}`:$t,ae--,at.audio[_.substring(0,4)]=2):this.isVideoSupported($t)&&(f.videoCodec=b=b?`${b},${$t}`:$t,ae--,at.video[b.substring(0,4)]=2)}if(l||(l=!!(E&&Z)),c||(c=!!b),u||(u=!!_),ae||_&&!this.isAudioSupported(_)||b&&!this.isVideoSupported(b)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:Pe,"FRAME-RATE":ye,"HDCP-LEVEL":$e,"PATHWAY-ID":We,RESOLUTION:ht,"VIDEO-RANGE":Ye}=d,dt=`${`${We||"."}-`}${f.bitrate}-${ht}-${ye}-${Pe}-${Ye}-${$e}`;if(i[dt])if(i[dt].uri!==f.url&&!f.attrs["PATHWAY-ID"]){const Xe=s[dt]+=1;f.attrs["PATHWAY-ID"]=new Array(Xe+1).join(".");const $t=this.createLevel(f);i[dt]=$t,r.push($t)}else i[dt].addGroupId("audio",d.AUDIO),i[dt].addGroupId("text",d.SUBTITLES);else{const Xe=this.createLevel(f);i[dt]=Xe,s[dt]=1,r.push(Xe)}}),this.filterAndSortMediaOptions(r,t,l,c,u)}createLevel(e){const t=new rt(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){const r=new Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(r.message),t.supportedResult=Rn(r,[])}return t}isAudioSupported(e){return Me(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Me(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,n,r,i){let s=[],l=[],c=e;if((n||r)&&i&&(c=c.filter(({videoCodec:N,videoRange:ae,width:Pe,height:ye})=>(!!N||!!(Pe&&ye))&&Wn(ae))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let N="no level with compatible codecs found in manifest",ae=N;t.levels.length&&(ae=`one or more CODECS in variant not supported: ${Mt(t.levels.map(ye=>ye.attrs.CODECS).filter((ye,$e,We)=>We.indexOf(ye)===$e))}`,this.warn(ae),N+=` (${ae})`);const Pe=new Error(N);this.hls.trigger(p.ERROR,{type:le.MEDIA_ERROR,details:K.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:Pe,reason:ae})}});return}t.audioTracks&&(s=t.audioTracks.filter(N=>!N.audioCodec||this.isAudioSupported(N.audioCodec)),$o(s)),t.subtitles&&(l=t.subtitles,$o(l));const u=c.slice(0);c.sort((N,ae)=>{if(N.attrs["HDCP-LEVEL"]!==ae.attrs["HDCP-LEVEL"])return(N.attrs["HDCP-LEVEL"]||"")>(ae.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&N.height!==ae.height)return N.height-ae.height;if(N.frameRate!==ae.frameRate)return N.frameRate-ae.frameRate;if(N.videoRange!==ae.videoRange)return _n.indexOf(N.videoRange)-_n.indexOf(ae.videoRange);if(N.videoCodec!==ae.videoCodec){const Pe=B(N.videoCodec),ye=B(ae.videoCodec);if(Pe!==ye)return ye-Pe}if(N.uri===ae.uri&&N.codecSet!==ae.codecSet){const Pe=z(N.codecSet),ye=z(ae.codecSet);if(Pe!==ye)return ye-Pe}return N.averageBitrate!==ae.averageBitrate?N.averageBitrate-ae.averageBitrate:0});let f=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let N=0;N<u.length;N++)if(u[N].pathwayId===c[0].pathwayId){f=u[N];break}}this._levels=c;for(let N=0;N<c.length;N++)if(c[N]===f){var d;this._firstLevel=N;const ae=f.bitrate,Pe=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${ae}`),((d=this.hls.userConfig)==null?void 0:d.abrEwmaDefaultEstimate)===void 0){const ye=Math.min(ae,this.hls.config.abrEwmaDefaultEstimateMax);ye>Pe&&Pe===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=ye)}break}const _=i&&!r,b=this.hls.config,E=!!(b.audioStreamController&&b.audioTrackController),Z={levels:c,audioTracks:s,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:i,video:r,altAudio:E&&!_&&s.some(N=>!!N.url)};this.hls.trigger(p.MANIFEST_PARSED,Z)}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 f=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(p.ERROR,{type:le.OTHER_ERROR,details:K.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:f,reason:f.message}),d)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,r=this.currentLevel,i=r?r.attrs["PATHWAY-ID"]:void 0,s=t[e],l=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,n===e&&r&&i===l)return;this.log(`Switching to level ${e} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${l?" with Pathway "+l:""} from level ${n}${i?" with Pathway "+i:""}`);const c={level:e,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(p.LEVEL_SWITCHING,c);const u=s.details;if(!u||u.live){const f=this.switchParams(s.uri,r==null?void 0:r.details,u);this.loadPlaylist(f)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),n=e.filter(r=>t.indexOf(r)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=n}}onError(e,t){t.fatal||!t.context||t.context.type===he.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===oe.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(i=>!!n[i]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var n;const{level:r,details:i}=t,s=t.levelInfo;if(!s){var l;this.warn(`Invalid level index ${r}`),(l=t.deliveryDirectives)!=null&&l.skip&&(i.deltaUpdateFailed=!0);return}if(s===this.currentLevel||t.withoutMultiVariant){s.fragmentError===0&&(s.loadError=0);let c=s.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(r,t,c)}else(n=t.deliveryDirectives)!=null&&n.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,i=e.attrs["PATHWAY-ID"],s=e.details,l=s==null?void 0:s.age;this.log(`Loading level index ${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${i?" Pathway "+i:""}${l&&s.live?" age "+l.toFixed(1)+(s.type?" "+s.type||0:""):""} ${n}`),this.hls.trigger(p.LEVEL_LOADING,{url:n,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const n=this._levels.filter((i,s)=>s!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(l=>l.level=-1)),!1));Jr(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const r=n.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(p.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(p.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function $o(a){const e={};a.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}function Ko(){return self.SourceBuffer||self.WebKitSourceBuffer}function Zo(){if(!ue())return!1;const e=Ko();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function jc(){if(!Zo())return!1;const a=ue();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(Re(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(Re(e,"audio"))))}function Yc(){var a;const e=Ko();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Xc=100;class Qc extends Dr{constructor(e,t,n){super(e,t,n,"stream-controller",oe.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const r=this.media,i=r?r.currentTime:null;if(i===null||!k(i)||(this.log(`Media seeked to ${i.toFixed(3)}`),!this.getBufferedFrag(i)))return;const s=this.getFwdBufferInfoAtPos(r,i,oe.MAIN,0);if(s===null||s.len===0){this.warn(`Main forward buffer length at ${i} on "seeked" event ${s?s.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:n,hls:r}=this;if(this.stopLoad(),this.setInterval(Xc),this.level=-1,!this.startFragRequested){let i=r.startLevel;i===-1&&(r.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=r.firstAutoLevel),r.nextLoadLevel=i,this.level=r.loadLevel,this._hasEnoughToStart=!!t}n>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=ct.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=ct.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case ct.WAITING_LEVEL:{const{levels:t,level:n}=this,r=t==null?void 0:t[n],i=r==null?void 0:r.details;if(i&&(!i.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(i))break;this.state=ct.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=ct.IDLE;break}break}case ct.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),n=this.retryDate;if(!n||t>=n||(e=this.media)!=null&&e.seeking){const{levels:r,level:i}=this,s=r==null?void 0:r[i];this.resetStartWhenNotLoaded(s||null),this.state=ct.IDLE}}break}this.state===ct.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:n,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[i]))return;const s=n[i],l=this.getMainFwdBufferInfo();if(l===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(l,c)){const Z={};this.altAudio===2&&(Z.type="video"),this.hls.trigger(p.BUFFER_EOS,Z),this.state=ct.ENDED;return}if(!this.buffering)return;e.loadLevel!==i&&e.manualLevel===-1&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=e.nextLoadLevel=i;const u=s.details;if(!u||this.state===ct.WAITING_LEVEL||this.waitForLive(s)){this.level=i,this.state=ct.WAITING_LEVEL,this.startFragRequested=!1;return}const f=l.len,d=this.getMaxBufferLength(s.maxBitrate);if(f>=d)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const _=this.backtrackFragment?this.backtrackFragment.start:l.end;let b=this.getNextFragment(_,u);if(this.couldBacktrack&&!this.fragPrevious&&b&&te(b)&&this.fragmentTracker.getState(b)!==Kn.OK){var E;const N=((E=this.backtrackFragment)!=null?E:b).sn-u.startSN,ae=u.fragments[N-1];ae&&b.cc===ae.cc&&(b=ae,this.fragmentTracker.removeFragment(ae))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(b&&this.isLoopLoading(b,_)){if(!b.gap){const N=this.audioOnly&&!this.altAudio?g.AUDIO:g.VIDEO,ae=(N===g.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;ae&&this.afterBufferFlushed(ae,N,oe.MAIN)}b=this.getNextFragmentLoopLoading(b,u,l,oe.MAIN,d)}b&&(b.initSegment&&!b.initSegment.data&&!this.bitrateTest&&(b=b.initSegment),this.loadFragment(b,s,_))}loadFragment(e,t,n){const r=this.fragmentTracker.getState(e);r===Kn.NOT_LOADED||r===Kn.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,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,oe.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let n;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const i=this.getLevelDetails();if(i!=null&&i.live){const l=this.getMainFwdBufferInfo();if(!l||l.len<i.targetduration*2)return}if(!t.paused&&e){const l=this.hls.nextLoadLevel,c=e[l],u=this.fragLastKbps;u&&this.fragCurrent?n=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:n=0}else n=0;const s=this.getBufferedFrag(t.currentTime+n);if(s){const l=this.followingBufferedFrag(s);if(l){this.abortCurrentFrag();const c=l.maxStartPTS?l.maxStartPTS:l.start,u=l.duration,f=Math.max(s.end,c+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(f,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 ct.KEY_LOADING:case ct.FRAG_LOADING:case ct.FRAG_LOADING_WAITING_RETRY:case ct.PARSING:case ct.PARSED:this.state=ct.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const n=t.media;ci(n,"playing",this.onMediaPlaying),ci(n,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:n}=this;n&&(gi(n,"playing",this.onMediaPlaying),gi(n,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(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 n=!1,r=!1;t.levels.forEach(i=>{const s=i.audioCodec;s&&(n=n||s.indexOf("mp4a.40.2")!==-1,r=r||s.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=n&&r&&!Yc(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:n}=this;if(!n||this.state!==ct.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=ct.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:r,startFragRequested:i}=this,s=t.level,l=t.details,c=l.totalduration;if(!r){this.warn(`Levels were reset while loading level ${s}`);return}this.log(`Level ${s} loaded [${l.startSN},${l.endSN}]${l.lastPartSn?`[part-${l.lastPartSn}-${l.lastPartIndex}]`:""}, cc [${l.startCC}, ${l.endCC}] duration:${c}`);const u=t.levelInfo,f=this.fragCurrent;f&&(this.state===ct.FRAG_LOADING||this.state===ct.FRAG_LOADING_WAITING_RETRY)&&f.level!==t.level&&f.loader&&this.abortCurrentFrag();let d=0;if(l.live||(n=u.details)!=null&&n.live){var _;if(this.checkLiveUpdate(l),l.deltaUpdateFailed)return;d=this.alignPlaylists(l,u.details,(_=this.levelLastLoaded)==null?void 0:_.details)}if(u.details=l,this.levelLastLoaded=u,i||this.setStartPosition(l,d),this.hls.trigger(p.LEVEL_UPDATED,{details:l,level:s}),this.state===ct.WAITING_LEVEL){if(this.waitForCdnTuneIn(l))return;this.state=ct.IDLE}i&&l.live&&this.synchronizeToLiveEdge(l),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const r=this.hls.liveSyncPosition,i=this.getLoadPosition(),s=e.fragmentStart,l=e.edge,c=i>=s-t.maxFragLookUpTolerance&&i<=l;if(r!==null&&n.duration>r&&(i<r||!c)){const f=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&n.readyState<4||i<l-f)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),n.readyState))if(this.warn(`Playback: ${i.toFixed(3)} is located too far from the end of live sliding playlist: ${l}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var u;const d=dn.bufferInfo(n,r,0);if(!(d!=null&&(u=d.buffered)!=null&&u.length)){n.currentTime=r;return}if(d.start<=i){n.currentTime=r;return}const{nextStart:b}=dn.bufferedInfo(d.buffered,i,0);b&&(n.currentTime=b)}else n.currentTime=r}}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:r,payload:i}=e,{levels:s}=this;if(!s){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const l=s[n.level];if(!l){this.warn(`Level ${n.level} not found on progress`);return}const c=l.details;if(!c){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const u=l.videoCodec,f=c.PTSKnown||!c.live,d=(t=n.initSegment)==null?void 0:t.data,_=this._getAudioCodec(l),b=this.transmuxer=this.transmuxer||new Xa(this.hls,oe.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),E=r?r.index:-1,Z=E!==-1,N=new Tn(n.level,n.sn,n.stats.chunkCount,i.byteLength,E,Z),ae=this.initPTS[n.cc];b.push(i,d,_,u,n,r,c.totalduration,f,N,ae)}onAudioTrackSwitching(e,t){const n=this.hls,r=this.altAudio===2;if(Gt(t.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const s=this.fragCurrent;s&&(this.log("Switching to main audio track, cancel main fragment load"),s.abortRequests(),this.fragmentTracker.removeFragment(s)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.fragmentTracker.removeAllFragments(),n.once(p.BUFFER_FLUSHED,()=>{var s;(s=this.hls)==null||s.trigger(p.AUDIO_TRACK_SWITCHED,t)}),n.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}n.trigger(p.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=Gt(t.url,this.hls);if(n){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){const n=t.tracks;let r,i,s=!1;for(const l in n){const c=n[l];if(c.id==="main"){if(i=l,r=c,l==="video"){const u=n[l];u&&(this.videoBuffer=u.buffer)}}else s=!0}s&&r?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:r}=t,i=n.type===oe.MAIN;if(i){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?" p: "+r.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===ct.PARSED&&(this.state=ct.IDLE);return}const l=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),te(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}const s=this.media;s&&(!this._hasEnoughToStart&&dn.getBuffered(s).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),i&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var n;if(t.fatal){this.state=ct.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(oe.MAIN,t);break;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ct.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===he.LEVEL&&(this.state=ct.IDLE);break;case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.resetLoadingState();break;case K.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=ct.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==g.AUDIO||!this.altAudio){const n=(t===g.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;n&&(this.afterBufferFlushed(n,t,oe.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const r=this.timelineOffset;r&&n&&(n+=r);const i=this.getLevelDetails(),s=dn.getBuffered(e),l=s.length?s.start(0):0,c=l-n,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<u||this.loadingParts&&c<2*((i==null?void 0:i.partTarget)||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),n+=c,this.startPosition=n),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${l}`),e.currentTime=n)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(n=>{const{hls:r}=this,i=n==null?void 0:n.frag;if(!i||this.fragContextChanged(i))return;t.fragmentError=0,this.state=ct.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const s=i.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),r.trigger(p.FRAG_LOADED,n),i.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const n=this.playlistType,{hls:r}=this,{remuxResult:i,chunkMeta:s}=e,l=this.getCurrentContext(s);if(!l){this.resetWhenMissingContext(s);return}const{frag:c,part:u,level:f}=l,{video:d,text:_,id3:b,initSegment:E}=i,{details:Z}=f,N=this.altAudio?void 0:i.audio;if(this.fragContextChanged(c)){this.fragmentTracker.removeFragment(c);return}if(this.state=ct.PARSING,E){if(E!=null&&E.tracks){const ye=c.initSegment||c;this._bufferInitSegment(f,E.tracks,ye,s),r.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:ye,id:n,tracks:E.tracks})}const ae=E.initPTS,Pe=E.timescale;k(ae)&&(this.initPTS[c.cc]={baseTime:ae,timescale:Pe},r.trigger(p.INIT_PTS_FOUND,{frag:c,id:n,initPTS:ae,timescale:Pe}))}if(d&&Z){N&&d.type==="audiovideo"&&this.logMuxedErr(c);const ae=Z.fragments[c.sn-1-Z.startSN],Pe=c.sn===Z.startSN,ye=!ae||c.cc>ae.cc;if(i.independent!==!1){const{startPTS:$e,endPTS:We,startDTS:ht,endDTS:Ye}=d;if(u)u.elementaryStreams[d.type]={startPTS:$e,endPTS:We,startDTS:ht,endDTS:Ye};else if(d.firstKeyFrame&&d.independent&&s.id===1&&!ye&&(this.couldBacktrack=!0),d.dropped&&d.independent){const st=this.getMainFwdBufferInfo(),dt=(st?st.end:this.getLoadPosition())+this.config.maxBufferHole,Xe=d.firstKeyFramePTS?d.firstKeyFramePTS:$e;if(!Pe&&dt<Xe-this.config.maxBufferHole&&!ye){this.backtrack(c);return}else ye&&(c.gap=!0);c.setElementaryStreamInfo(d.type,c.start,We,c.start,Ye,!0)}else Pe&&$e-(Z.appliedTimelineOffset||0)>$s&&(c.gap=!0);c.setElementaryStreamInfo(d.type,$e,We,ht,Ye),this.backtrackFragment&&(this.backtrackFragment=c),this.bufferFragmentData(d,c,u,s,Pe||ye)}else if(Pe||ye)c.gap=!0;else{this.backtrack(c);return}}if(N){const{startPTS:ae,endPTS:Pe,startDTS:ye,endDTS:$e}=N;u&&(u.elementaryStreams[g.AUDIO]={startPTS:ae,endPTS:Pe,startDTS:ye,endDTS:$e}),c.setElementaryStreamInfo(g.AUDIO,ae,Pe,ye,$e),this.bufferFragmentData(N,c,u,s)}if(Z&&b!=null&&(t=b.samples)!=null&&t.length){const ae={id:n,frag:c,details:Z,samples:b.samples};r.trigger(p.FRAG_PARSING_METADATA,ae)}if(Z&&_){const ae={id:n,frag:c,details:Z,samples:_.samples};r.trigger(p.FRAG_PARSING_USERDATA,ae)}}logMuxedErr(e){this.warn(`${te(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,r){if(this.state!==ct.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));const{audio:i,video:s,audiovideo:l}=t;if(i){let u=mt(i.codec,e.audioCodec);u==="mp4a"&&(u="mp4a.40.5");const f=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const d=i.metadata;d&&"channelCount"in d&&(d.channelCount||1)!==1&&f.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&f.indexOf("android")!==-1&&i.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),e.audioCodec&&e.audioCodec!==u&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${u}"`),i.levelCodec=u,i.id=oe.MAIN,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${u||""}/${e.audioCodec||""}/${i.codec}]`),delete t.audiovideo}if(s){s.levelCodec=e.videoCodec,s.id=oe.MAIN;const u=s.codec;if((u==null?void 0:u.length)===4)switch(u){case"hvc1":case"hev1":s.codec="hvc1.1.6.L120.90";break;case"av01":s.codec="av01.0.04M.08";break;case"avc1":s.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${s.codec!==u?" parsed-corrected="+s.codec:""}${s.supplemental?" supplemental="+s.supplemental:""}`),delete t.audiovideo}l&&(this.log(`Init audiovideo buffer, container:${l.container}, codecs[level/parsed]=[${e.codecs}/${l.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger(p.BUFFER_CODECS,t),!this.hls)return;c.forEach(u=>{const d=t[u].initSegment;d!=null&&d.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:u,data:d,frag:n,part:null,chunkMeta:r,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,oe.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,n=e==null?void 0:e[t];return n?this.getMaxBufferLength(n.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=ct.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(dn.isBuffered(e,n)?t=this.getAppendedFrag(n):dn.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,i=t.level;(!r||t.sn!==r.sn||r.level!==i)&&(this.fragPlaying=t,this.hls.trigger(p.FRAG_CHANGED,{frag:t}),(!r||r.level!==i)&&this.hls.trigger(p.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return k(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(k(t)){const n=this.getLevelDetails(),r=this.currentFrag||(n?Vt(null,n.fragments,t):null);if(r){const i=r.programDateTime;if(i!==null){const s=i+(t-r.start)*1e3;return new Date(s)}}}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 Jc{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[n].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=K.KEY_LOAD_ERROR,n,r,i){return new An({type:le.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:i,error:n,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length){const{sn:n,cc:r}=e;for(let i=0;i<t.length;i++){const s=t[i];if(r<=s.cc&&(n==="initSegment"||s.sn==="initSegment"||n<s.sn))return this.emeController.selectKeySystemFormat(s).then(l=>{if(s.setKeyFormat(l),this.emeController&&this.config.requireKeySystemAccessOnStart){const c=Sn(l);if(c)return this.emeController.getKeySystemAccess([c])}})}}else if(this.config.requireKeySystemAccessOnStart){const n=ur(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 n,r;t&&e.setKeyFormat(t);const i=e.decryptdata;if(!i){const u=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,K.KEY_LOAD_ERROR,u))}const s=i.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));let l=this.keyUriToKeyInfo[s];if((n=l)!=null&&n.decryptdata.key)return i.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if((r=l)!=null&&r.keyLoadPromise){var c;switch((c=l.mediaKeySessionContext)==null?void 0:c.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return l.keyLoadPromise.then(u=>(i.key=u.keyInfo.decryptdata.key,{frag:e,keyInfo:l}))}}switch(l=this.keyUriToKeyInfo[s]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return i.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(n);if(r)return(e.keyLoadPromise=r.then(i=>(e.mediaKeySessionContext=i,n))).catch(i=>{throw e.keyLoadPromise=null,i})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,r=n.loader,i=new r(n);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((s,l)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=n.keyLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(_,b,E,Z)=>{const{frag:N,keyInfo:ae,url:Pe}=E;if(!N.decryptdata||ae!==this.keyUriToKeyInfo[Pe])return l(this.createKeyLoadError(N,K.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),Z));ae.decryptdata.key=N.decryptdata.key=new Uint8Array(_.data),N.keyLoader=null,ae.loader=null,s({frag:N,keyInfo:ae})},onError:(_,b,E,Z)=>{this.resetLoader(b),l(this.createKeyLoadError(t,K.KEY_LOAD_ERROR,new Error(`HTTP Error ${_.code} loading key ${_.text}`),E,y({url:c.url,data:void 0},_)))},onTimeout:(_,b,E)=>{this.resetLoader(b),l(this.createKeyLoadError(t,K.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),E))},onAbort:(_,b,E)=>{this.resetLoader(b),l(this.createKeyLoadError(t,K.INTERNAL_ABORTED,new Error("key loading aborted"),E))}};i.load(c,f,d)})}resetLoader(e){const{frag:t,keyInfo:n,url:r}=e,i=n.loader;t.keyLoader===i&&(t.keyLoader=null,n.loader=null),delete this.keyUriToKeyInfo[r],i&&i.destroy()}}function Go(a){const{type:e}=a;switch(e){case he.AUDIO_TRACK:return oe.AUDIO;case he.SUBTITLE_TRACK:return oe.SUBTITLE;default:return oe.MAIN}}function xa(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class qc{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,n=t.pLoader,r=t.loader,i=n||r,s=new i(t);return this.loaders[e.type]=s,s}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:he.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:n,level:r,pathwayId:i,url:s,deliveryDirectives:l,levelInfo:c}=t;this.load({id:n,level:r,pathwayId:i,responseType:"text",type:he.LEVEL,url:s,deliveryDirectives:l,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:n,groupId:r,url:i,deliveryDirectives:s,track:l}=t;this.load({id:n,groupId:r,level:null,responseType:"text",type:he.AUDIO_TRACK,url:i,deliveryDirectives:s,levelOrTrack:l})}onSubtitleTrackLoading(e,t){const{id:n,groupId:r,url:i,deliveryDirectives:s,track:l}=t;this.load({id:n,groupId:r,level:null,responseType:"text",type:he.SUBTITLE_TRACK,url:i,deliveryDirectives:s,levelOrTrack:l})}onLevelsUpdated(e,t){const n=this.loaders[he.LEVEL];if(n){const r=n.context;r&&!t.levels.some(i=>i===r.levelOrTrack)&&(n.abort(),delete this.loaders[he.LEVEL])}}load(e){var t;const n=this.hls.config;let r=this.getInternalLoader(e);if(r){const u=this.hls.logger,f=r.context;if(f&&f.levelOrTrack===e.levelOrTrack&&(f.url===e.url||f.deliveryDirectives&&!e.deliveryDirectives)){f.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${f.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let i;if(e.type===he.MANIFEST?i=n.manifestLoadPolicy.default:i=h({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),k((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===he.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===he.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===he.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const f=u.partTarget,d=u.targetduration;if(f&&d){const _=Math.max(f*3,d*.8)*1e3;i=h({},i,{maxTimeToFirstByteMs:Math.min(_,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(_,i.maxTimeToFirstByteMs)})}}}const s=i.errorRetry||i.timeoutRetry||{},l={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0},c={onSuccess:(u,f,d,_)=>{const b=this.getInternalLoader(d);this.resetInternalLoader(d.type);const E=u.data;if(E.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,d,new Error("no EXTM3U delimiter"),_||null,f);return}f.parsing.start=performance.now(),ni.isMediaPlaylist(E)||d.type!==he.MANIFEST?this.handleTrackOrLevelPlaylist(u,f,d,_||null,b):this.handleMasterPlaylist(u,f,d,_)},onError:(u,f,d,_)=>{this.handleNetworkError(f,d,!1,u,_)},onTimeout:(u,f,d)=>{this.handleNetworkError(f,d,!0,void 0,u)}};r.load(e,l,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,r){const i=this.hls,s=e.data,l=xa(e,n),c=ni.parseMasterPlaylist(s,l);if(c.playlistParsingError){this.handleManifestParsingError(e,n,c.playlistParsingError,r,t);return}const{contentSteering:u,levels:f,sessionData:d,sessionKeys:_,startTimeOffset:b,variableList:E}=c;this.variableList=E;const{AUDIO:Z=[],SUBTITLES:N,"CLOSED-CAPTIONS":ae}=ni.parseMasterPlaylistMedia(s,l,c);Z.length&&!Z.some(ye=>!ye.url)&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),Z.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Gn({}),bitrate:0,url:""})),i.trigger(p.MANIFEST_LOADED,{levels:f,audioTracks:Z,subtitles:N,captions:ae,contentSteering:u,url:l,stats:t,networkDetails:r,sessionData:d,sessionKeys:_,startTimeOffset:b,variableList:E})}handleTrackOrLevelPlaylist(e,t,n,r,i){const s=this.hls,{id:l,level:c,type:u}=n,f=xa(e,n),d=k(c)?c:k(l)?l:0,_=Go(n),b=ni.parseLevelPlaylist(e.data,f,d,_,0,this.variableList);if(u===he.MANIFEST){const E={attrs:new Gn({}),bitrate:0,details:b,name:"",url:f};b.requestScheduled=t.loading.start+$r(b,0),s.trigger(p.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:f,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=b,this.handlePlaylistLoaded(b,e,t,n,r,i)}handleManifestParsingError(e,t,n,r,i){this.hls.trigger(p.ERROR,{type:le.NETWORK_ERROR,details:K.MANIFEST_PARSING_ERROR,fatal:t.type===he.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:r,stats:i})}handleNetworkError(e,t,n=!1,r,i){let s=`A network ${n?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===he.LEVEL?s+=`: ${e.level} id: ${e.id}`:(e.type===he.AUDIO_TRACK||e.type===he.SUBTITLE_TRACK)&&(s+=` id: ${e.id} group-id: "${e.groupId}"`);const l=new Error(s);this.hls.logger.warn(`[playlist-loader]: ${s}`);let c=K.UNKNOWN,u=!1;const f=this.getInternalLoader(e);switch(e.type){case he.MANIFEST:c=n?K.MANIFEST_LOAD_TIMEOUT:K.MANIFEST_LOAD_ERROR,u=!0;break;case he.LEVEL:c=n?K.LEVEL_LOAD_TIMEOUT:K.LEVEL_LOAD_ERROR,u=!1;break;case he.AUDIO_TRACK:c=n?K.AUDIO_TRACK_LOAD_TIMEOUT:K.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case he.SUBTITLE_TRACK:c=n?K.SUBTITLE_TRACK_LOAD_TIMEOUT:K.SUBTITLE_LOAD_ERROR,u=!1;break}f&&this.resetInternalLoader(e.type);const d={type:le.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:f,context:e,error:l,networkDetails:t,stats:i};if(r){const _=(t==null?void 0:t.url)||e.url;d.response=y({url:_,data:void 0},r)}this.hls.trigger(p.ERROR,d)}handlePlaylistLoaded(e,t,n,r,i,s){const l=this.hls,{type:c,level:u,id:f,groupId:d,deliveryDirectives:_}=r,b=xa(t,r),E=Go(r),Z=typeof r.level=="number"&&E===oe.MAIN?u:void 0;if(!e.fragments.length){const ae=e.playlistParsingError=new Error("No Segments found in Playlist");l.trigger(p.ERROR,{type:le.NETWORK_ERROR,details:K.LEVEL_EMPTY_ERROR,fatal:!1,url:b,error:ae,reason:ae.message,response:t,context:r,level:Z,parent:E,networkDetails:i,stats:n});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const N=e.playlistParsingError;if(N){if(this.hls.logger.warn(N),!l.config.ignorePlaylistParsingErrors){l.trigger(p.ERROR,{type:le.NETWORK_ERROR,details:K.LEVEL_PARSING_ERROR,fatal:!1,url:b,error:N,reason:N.message,response:t,context:r,level:Z,parent:E,networkDetails:i,stats:n});return}e.playlistParsingError=null}switch(e.live&&s&&(s.getCacheAge&&(e.ageHeader=s.getCacheAge()||0),(!s.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case he.MANIFEST:case he.LEVEL:l.trigger(p.LEVEL_LOADED,{details:e,levelInfo:r.levelOrTrack||l.levels[0],level:Z||0,id:f||0,stats:n,networkDetails:i,deliveryDirectives:_,withoutMultiVariant:c===he.MANIFEST});break;case he.AUDIO_TRACK:l.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:f||0,groupId:d||"",stats:n,networkDetails:i,deliveryDirectives:_});break;case he.SUBTITLE_TRACK:l.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:f||0,groupId:d||"",stats:n,networkDetails:i,deliveryDirectives:_});break}}}class Ki{static get version(){return Ci}static isMSESupported(){return Zo()}static isSupported(){return jc()}static getMediaSource(){return ue()}static get Events(){return p}static get MetadataSchema(){return ui}static get ErrorTypes(){return le}static get ErrorDetails(){return K}static get DefaultConfig(){return Ki.defaultConfig?Ki.defaultConfig:Mc}static set DefaultConfig(e){Ki.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 Ri,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),n=this.config=Nc(Ki.DefaultConfig,e,t);this.userConfig=e,n.progressive&&Bc(n,t);const{abrController:r,bufferController:i,capLevelController:s,errorController:l,fpsController:c}=n,u=new l(this),f=this.abrController=new r(this),d=new jn(this),_=n.interstitialsController,b=_?this.interstitialsController=new _(this,Ki):null,E=this.bufferController=new i(this,d),Z=this.capLevelController=new s(this),N=new c(this),ae=new qc(this),Pe=n.contentSteeringController,ye=Pe?new Pe(this):null,$e=this.levelController=new Hc(this,ye),We=new zc(this),ht=new Jc(this.config),Ye=this.streamController=new Qc(this,d,ht),st=this.gapController=new Zc(this,d);Z.setStreamController(Ye),N.setStreamController(Ye);const dt=[ae,$e,Ye];b&&dt.splice(1,0,b),ye&&dt.splice(1,0,ye),this.networkControllers=dt;const Xe=[f,E,st,Z,N,We,d];this.audioTrackController=this.createController(n.audioTrackController,dt);const $t=n.audioStreamController;$t&&dt.push(this.audioStreamController=new $t(this,d,ht)),this.subtitleTrackController=this.createController(n.subtitleTrackController,dt);const pn=n.subtitleStreamController;pn&&dt.push(this.subtititleStreamController=new pn(this,d,ht)),this.createController(n.timelineController,Xe),ht.emeController=this.emeController=this.createController(n.emeController,Xe),this.cmcdController=this.createController(n.cmcdController,Xe),this.latencyController=this.createController(Wc,Xe),this.coreComponents=Xe,dt.push(u);const Vn=u.onErrorOut;typeof Vn=="function"&&this.on(p.ERROR,Vn,u),this.on(p.MANIFEST_LOADED,ae.onManifestLoaded,ae)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,r){this._emitter.off(e,t,n,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const r=e===p.ERROR;this.trigger(p.ERROR,{type:le.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:r,event:e,error:n}),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 i=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(p.ERROR,{type:le.OTHER_ERROR,details:K.ATTACH_MEDIA_ERROR,fatal:!0,error:i});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,n=t?e.media:e,r=t?e:{media:n};this._media=n,this.trigger(p.MEDIA_ATTACHING,r)}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,n=this._url,r=this._url=j.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&n&&(n!==r||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 n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),!(!this.started||!this.networkControllers));n++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[oe.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[oe.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[oe.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=Zu()),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){Kt(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const n=e.length;for(let r=0;r<n;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,n)for(let i=r;i--;){const s=e[i].attrs["HDCP-LEVEL"];if(s&&s<=n)return i}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const n=Zt(t);return Nn(e,n,navigator.mediaCapabilities)}}Ki.defaultConfig=void 0},16722:function(yn,yt,T){"use strict";T.d(yt,{Z:function(){return oe}});const k=o=>typeof o=="object"&&o!=null&&o.nodeType===1,ce=(o,x)=>(!x||o!=="hidden")&&o!=="visible"&&o!=="clip",Se=(o,x)=>{if(o.clientHeight<o.scrollHeight||o.clientWidth<o.scrollWidth){const A=getComputedStyle(o,null);return ce(A.overflowY,x)||ce(A.overflowX,x)||(h=>{const m=(y=>{if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(S){return null}})(h);return!!m&&(m.clientHeight<h.scrollHeight||m.clientWidth<h.scrollWidth)})(o)}return!1},le=(o,x,A,h,m,y,S,O)=>y<o&&S>x||y>o&&S<x?0:y<=o&&O<=A||S>=x&&O>=A?y-o-h:S>x&&O<A||y<o&&O>A?S-x+m:0,K=o=>{const x=o.parentElement;return x==null?o.getRootNode().host||null:x},p=(o,x)=>{var A,h,m,y;if(typeof document=="undefined")return[];const{scrollMode:S,block:O,inline:G,boundary:W,skipOverflowHiddenElements:I}=x,M=typeof W=="function"?W:Ge=>Ge!==W;if(!k(o))throw new TypeError("Invalid target");const w=document.scrollingElement||document.documentElement,D=[];let re=o;for(;k(re)&&M(re);){if(re=K(re),re===w){D.push(re);break}re!=null&&re===document.body&&Se(re)&&!Se(document.documentElement)||re!=null&&Se(re,I)&&D.push(re)}const ie=(h=(A=window.visualViewport)==null?void 0:A.width)!=null?h:innerWidth,J=(y=(m=window.visualViewport)==null?void 0:m.height)!=null?y:innerHeight,{scrollX:ue,scrollY:ge}=window,{height:Ee,width:Ne,top:Y,right:L,bottom:V,left:H}=o.getBoundingClientRect(),{top:ee,right:j,bottom:v,left:g}=(Ge=>{const Qe=window.getComputedStyle(Ge);return{top:parseFloat(Qe.scrollMarginTop)||0,right:parseFloat(Qe.scrollMarginRight)||0,bottom:parseFloat(Qe.scrollMarginBottom)||0,left:parseFloat(Qe.scrollMarginLeft)||0}})(o);let U=O==="start"||O==="nearest"?Y-ee:O==="end"?V+v:Y+Ee/2-ee+v,te=G==="center"?H+Ne/2-g+j:G==="end"?L+j:H-g;const Be=[];for(let Ge=0;Ge<D.length;Ge++){const Qe=D[Ge],{height:et,width:gt,top:vt,right:we,bottom:_t,left:ot}=Qe.getBoundingClientRect();if(S==="if-needed"&&Y>=0&&H>=0&&V<=J&&L<=ie&&(Qe===w&&!Se(Qe)||Y>=vt&&V<=_t&&H>=ot&&L<=we))return Be;const nt=getComputedStyle(Qe),Tt=parseInt(nt.borderLeftWidth,10),Ke=parseInt(nt.borderTopWidth,10),_e=parseInt(nt.borderRightWidth,10),ve=parseInt(nt.borderBottomWidth,10);let F=0,xe=0;const ke="offsetWidth"in Qe?Qe.offsetWidth-Qe.clientWidth-Tt-_e:0,$="offsetHeight"in Qe?Qe.offsetHeight-Qe.clientHeight-Ke-ve:0,R="offsetWidth"in Qe?Qe.offsetWidth===0?0:gt/Qe.offsetWidth:0,ne="offsetHeight"in Qe?Qe.offsetHeight===0?0:et/Qe.offsetHeight:0;if(w===Qe)F=O==="start"?U:O==="end"?U-J:O==="nearest"?le(ge,ge+J,J,Ke,ve,ge+U,ge+U+Ee,Ee):U-J/2,xe=G==="start"?te:G==="center"?te-ie/2:G==="end"?te-ie:le(ue,ue+ie,ie,Tt,_e,ue+te,ue+te+Ne,Ne),F=Math.max(0,F+ge),xe=Math.max(0,xe+ue);else{F=O==="start"?U-vt-Ke:O==="end"?U-_t+ve+$:O==="nearest"?le(vt,_t,et,Ke,ve+$,U,U+Ee,Ee):U-(vt+et/2)+$/2,xe=G==="start"?te-ot-Tt:G==="center"?te-(ot+gt/2)+ke/2:G==="end"?te-we+_e+ke:le(ot,we,gt,Tt,_e+ke,te,te+Ne,Ne);const{scrollLeft:be,scrollTop:P}=Qe;F=ne===0?0:Math.max(0,Math.min(P+F/ne,Qe.scrollHeight-et/ne+$)),xe=R===0?0:Math.max(0,Math.min(be+xe/R,Qe.scrollWidth-gt/R+ke)),U+=P-F,te+=be-xe}Be.push({el:Qe,top:F,left:xe})}return Be},he=o=>o===!1?{block:"end",inline:"nearest"}:(x=>x===Object(x)&&Object.keys(x).length!==0)(o)?o:{block:"start",inline:"nearest"};function oe(o,x){if(!o.isConnected||!(m=>{let y=m;for(;y&&y.parentNode;){if(y.parentNode===document)return!0;y=y.parentNode instanceof ShadowRoot?y.parentNode.host:y.parentNode}return!1})(o))return;const A=(m=>{const y=window.getComputedStyle(m);return{top:parseFloat(y.scrollMarginTop)||0,right:parseFloat(y.scrollMarginRight)||0,bottom:parseFloat(y.scrollMarginBottom)||0,left:parseFloat(y.scrollMarginLeft)||0}})(o);if((m=>typeof m=="object"&&typeof m.behavior=="function")(x))return x.behavior(p(o,x));const h=typeof x=="boolean"||x==null?void 0:x.behavior;for(const{el:m,top:y,left:S}of p(o,he(x))){const O=y-A.top+A.bottom,G=S-A.left+A.right;m.scroll({top:O,left:G,behavior:h})}}}}]);
}());