|
|
!(function(){var wa=Math.pow;var cl=(Li,It,oe)=>new Promise((ce,De)=>{var Ze=S=>{try{q(oe.next(S))}catch(Te){De(Te)}},ge=S=>{try{q(oe.throw(S))}catch(Te){De(Te)}},q=S=>S.done?ce(S.value):Promise.resolve(S.value).then(Ze,ge);q((oe=oe.apply(Li,It)).next())});(self.webpackChunk=self.webpackChunk||[]).push([[7554],{65030:function(Li,It,oe){"use strict";oe.d(It,{Z:function(){return hn}});var ce=oe(33885),De=oe(42978),Ze=oe(75931),ge=oe(43403),q=oe(92310),S=oe.n(q),Te=oe(29301),P=oe(76846),f=oe(96452),re=oe(6089),R=oe(80402),k=oe(34280),T=oe(49658),M=oe(59301),O=oe(54476),Y=oe(77900),H=oe(8654);function j(Ne){var He=Ne.prefixCls,ve=Ne.align,it=Ne.arrow,_t=Ne.arrowPos,lt=it||{},ee=lt.className,xe=lt.content,Ke=_t.x,Xe=Ke===void 0?0:Ke,nt=_t.y,gt=nt===void 0?0:nt,Yt=M.useRef();if(!ve||!ve.points)return null;var dt={position:"absolute"};if(ve.autoArrow!==!1){var ke=ve.points[0],bt=ve.points[1],Gt=ke[0],Pt=ke[1],Ae=bt[0],Ce=bt[1];Gt===Ae||!["t","b"].includes(Gt)?dt.top=gt:Gt==="t"?dt.top=0:dt.bottom=0,Pt===Ce||!["l","r"].includes(Pt)?dt.left=Xe:Pt==="l"?dt.left=0:dt.right=0}return M.createElement("div",{ref:Yt,className:S()("".concat(He,"-arrow"),ee),style:dt},xe)}function U(Ne){var He=Ne.prefixCls,ve=Ne.open,it=Ne.zIndex,_t=Ne.mask,lt=Ne.motion;return _t?M.createElement(Y.default,(0,O.Z)({},lt,{motionAppear:!0,visible:ve,removeOnLeave:!0}),function(ee){var xe=ee.className;return M.createElement("div",{style:{zIndex:it},className:S()("".concat(He,"-mask"),xe)})}):null}var $=M.memo(function(Ne){var He=Ne.children;return He},function(Ne,He){return He.cache}),G=$,fe=M.forwardRef(function(Ne,He){var ve=Ne.popup,it=Ne.className,_t=Ne.prefixCls,lt=Ne.style,ee=Ne.target,xe=Ne.onVisibleChanged,Ke=Ne.open,Xe=Ne.keepDom,nt=Ne.fresh,gt=Ne.onClick,Yt=Ne.mask,dt=Ne.arrow,ke=Ne.arrowPos,bt=Ne.align,Gt=Ne.motion,Pt=Ne.maskMotion,Ae=Ne.forceRender,Ce=Ne.getPopupContainer,rt=Ne.autoDestroy,ut=Ne.portal,je=Ne.zIndex,kt=Ne.onMouseEnter,Tt=Ne.onMouseLeave,vt=Ne.onPointerEnter,Ot=Ne.onPointerDownCapture,jt=Ne.ready,Je=Ne.offsetX,Ft=Ne.offsetY,Le=Ne.offsetR,ye=Ne.offsetB,we=Ne.onAlign,K=Ne.onPrepare,W=Ne.stretch,ae=Ne.targetWidth,he=Ne.targetHeight,_e=typeof ve=="function"?ve():ve,st=Ke||Xe,ot=(Ce==null?void 0:Ce.length)>0,xt=M.useState(!Ce||!ot),Nt=(0,De.Z)(xt,2),Xt=Nt[0],vi=Nt[1];if((0,k.Z)(function(){!Xt&&ot&&ee&&vi(!0)},[Xt,ot,ee]),!Xt)return null;var ti="auto",St={left:"-1000vw",top:"-1000vh",right:ti,bottom:ti};if(jt||!Ke){var ii,Di=bt.points,Ei=bt.dynamicInset||((ii=bt._experimental)===null||ii===void 0?void 0:ii.dynamicInset),$i=Ei&&Di[0][1]==="r",pi=Ei&&Di[0][0]==="b";$i?(St.right=Le,St.left=ti):(St.left=Je,St.right=ti),pi?(St.bottom=ye,St.top=ti):(St.top=Ft,St.bottom=ti)}var mi={};return W&&(W.includes("height")&&he?mi.height=he:W.includes("minHeight")&&he&&(mi.minHeight=he),W.includes("width")&&ae?mi.width=ae:W.includes("minWidth")&&ae&&(mi.minWidth=ae)),Ke||(mi.pointerEvents="none"),M.createElement(ut,{open:Ae||st,getContainer:Ce&&function(){return Ce(ee)},autoDestroy:rt},M.createElement(U,{prefixCls:_t,open:Ke,zIndex:je,mask:Yt,motion:Pt}),M.createElement(Te.Z,{onResize:we,disabled:!Ke},function(Xi){return M.createElement(Y.default,(0,O.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Ae,leavedClassName:"".concat(_t,"-hidden")},Gt,{onAppearPrepare:K,onEnterPrepare:K,visible:Ke,onVisibleChanged:function(mn){var nn;Gt==null||(nn=Gt.onVisibleChanged)===null||nn===void 0||nn.call(Gt,mn),xe(mn)}}),function(an,mn){var nn=an.className,gr=an.style,Ci=S()(_t,nn,it);return M.createElement("div",{ref:(0,H.sQ)(Xi,He,mn),className:Ci,style:(0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)({"--arrow-x":"".concat(ke.x||0,"px"),"--arrow-y":"".concat(ke.y||0,"px")},St),mi),gr),{},{boxSizing:"border-box",zIndex:je},lt),onMouseEnter:kt,onMouseLeave:Tt,onPointerEnter:vt,onClick:gt,onPointerDownCapture:Ot},dt&&M.createElement(j,{prefixCls:_t,arrow:dt,arrowPos:ke,align:bt}),M.createElement(G,{cache:!Ke&&!nt},_e))})}))}),be=fe,Se=M.forwardRef(function(Ne,He){var ve=Ne.children,it=Ne.getTriggerDOMNode,_t=(0,H.Yr)(ve),lt=M.useCallback(function(xe){(0,H.mH)(He,it?it(xe):xe)},[it]),ee=(0,H.x1)(lt,(0,H.C4)(ve));return _t?M.cloneElement(ve,{ref:ee}):ve}),se=Se,Oe=M.createContext(null),We=Oe;function Be(Ne){return Ne?Array.isArray(Ne)?Ne:[Ne]:[]}function At(Ne,He,ve,it){return M.useMemo(function(){var _t=Be(ve!=null?ve:He),lt=Be(it!=null?it:He),ee=new Set(_t),xe=new Set(lt);return Ne&&(ee.has("hover")&&(ee.delete("hover"),ee.add("click")),xe.has("hover")&&(xe.delete("hover"),xe.add("click"))),[ee,xe]},[Ne,He,ve,it])}var te=oe(29194);function z(){var Ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],He=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ve=arguments.length>2?arguments[2]:void 0;return ve?Ne[0]===He[0]:Ne[0]===He[0]&&Ne[1]===He[1]}function X(Ne,He,ve,it){for(var _t=ve.points,lt=Object.keys(Ne),ee=0;ee<lt.length;ee+=1){var xe,Ke=lt[ee];if(z((xe=Ne[Ke])===null||xe===void 0?void 0:xe.points,_t,it))return"".concat(He,"-placement-").concat(Ke)}return""}function Q(Ne,He,ve,it){return He||(ve?{motionName:"".concat(Ne,"-").concat(ve)}:it?{motionName:it}:null)}function de(Ne){return Ne.ownerDocument.defaultView}function ie(Ne){for(var He=[],ve=Ne==null?void 0:Ne.parentElement,it=["hidden","scroll","clip","auto"];ve;){var _t=de(ve).getComputedStyle(ve),lt=_t.overflowX,ee=_t.overflowY,xe=_t.overflow;[lt,ee,xe].some(function(Ke){return it.includes(Ke)})&&He.push(ve),ve=ve.parentElement}return He}function A(Ne){var He=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(Ne)?He:Ne}function L(Ne){return A(parseFloat(Ne),0)}function V(Ne,He){var ve=(0,ce.Z)({},Ne);return(He||[]).forEach(function(it){if(!(it instanceof HTMLBodyElement||it instanceof HTMLHtmlElement)){var _t=de(it).getComputedStyle(it),lt=_t.overflow,ee=_t.overflowClipMargin,xe=_t.borderTopWidth,Ke=_t.borderBottomWidth,Xe=_t.borderLeftWidth,nt=_t.borderRightWidth,gt=it.getBoundingClientRect(),Yt=it.offsetHeight,dt=it.clientHeight,ke=it.offsetWidth,bt=it.clientWidth,Gt=L(xe),Pt=L(Ke),Ae=L(Xe),Ce=L(nt),rt=A(Math.round(gt.width/ke*1e3)/1e3),ut=A(Math.round(gt.height/Yt*1e3)/1e3),je=(ke-bt-Ae-Ce)*rt,kt=(Yt-dt-Gt-Pt)*ut,Tt=Gt*ut,vt=Pt*ut,Ot=Ae*rt,jt=Ce*rt,Je=0,Ft=0;if(lt==="clip"){var Le=L(ee);Je=Le*rt,Ft=Le*ut}var ye=gt.x+Ot-Je,we=gt.y+Tt-Ft,K=ye+gt.width+2*Je-Ot-jt-je,W=we+gt.height+2*Ft-Tt-vt-kt;ve.left=Math.max(ve.left,ye),ve.top=Math.max(ve.top,we),ve.right=Math.min(ve.right,K),ve.bottom=Math.min(ve.bottom,W)}}),ve}function pe(Ne){var He=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ve="".concat(He),it=ve.match(/^(.*)\%$/);return it?Ne*(parseFloat(it[1])/100):parseFloat(ve)}function ze(Ne,He){var ve=He||[],it=(0,De.Z)(ve,2),_t=it[0],lt=it[1];return[pe(Ne.width,_t),pe(Ne.height,lt)]}function at(){var Ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[Ne[0],Ne[1]]}function Bt(Ne,He){var ve=He[0],it=He[1],_t,lt;return ve==="t"?lt=Ne.y:ve==="b"?lt=Ne.y+Ne.height:lt=Ne.y+Ne.height/2,it==="l"?_t=Ne.x:it==="r"?_t=Ne.x+Ne.width:_t=Ne.x+Ne.width/2,{x:_t,y:lt}}function Me(Ne,He){var ve={t:"b",b:"t",l:"r",r:"l"};return Ne.map(function(it,_t){return _t===He?ve[it]||"c":it}).join("")}function Ht(Ne,He,ve,it,_t,lt,ee){var xe=M.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:_t[it]||{}}),Ke=(0,De.Z)(xe,2),Xe=Ke[0],nt=Ke[1],gt=M.useRef(0),Yt=M.useMemo(function(){return He?ie(He):[]},[He]),dt=M.useRef({}),ke=function(){dt.current={}};Ne||ke();var bt=(0,re.Z)(function(){if(He&&ve&&Ne){let fr=function(dr,nr){var ls=arguments.length>2&&arguments[2]!==void 0?arguments[2]:In,Pr=st.x+dr,Fs=st.y+nr,Gs=Pr+pi,As=Fs+$i,Sa=Math.max(Pr,ls.left),ni=Math.max(Fs,ls.top),Ti=Math.min(Gs,ls.right),Sn=Math.min(As,ls.bottom);return Math.max(0,(Ti-Sa)*(Sn-ni))},jn=function(){Pn=st.y+Ii,dn=Pn+$i,Ui=st.x+yi,Qi=Ui+pi};var Ae,Ce,rt,ut,je=He,kt=je.ownerDocument,Tt=de(je),vt=Tt.getComputedStyle(je),Ot=vt.position,jt=je.style.left,Je=je.style.top,Ft=je.style.right,Le=je.style.bottom,ye=je.style.overflow,we=(0,ce.Z)((0,ce.Z)({},_t[it]),lt),K=kt.createElement("div");(Ae=je.parentElement)===null||Ae===void 0||Ae.appendChild(K),K.style.left="".concat(je.offsetLeft,"px"),K.style.top="".concat(je.offsetTop,"px"),K.style.position=Ot,K.style.height="".concat(je.offsetHeight,"px"),K.style.width="".concat(je.offsetWidth,"px"),je.style.left="0",je.style.top="0",je.style.right="auto",je.style.bottom="auto",je.style.overflow="hidden";var W;if(Array.isArray(ve))W={x:ve[0],y:ve[1],width:0,height:0};else{var ae,he,_e=ve.getBoundingClientRect();_e.x=(ae=_e.x)!==null&&ae!==void 0?ae:_e.left,_e.y=(he=_e.y)!==null&&he!==void 0?he:_e.top,W={x:_e.x,y:_e.y,width:_e.width,height:_e.height}}var st=je.getBoundingClientRect(),ot=Tt.getComputedStyle(je),xt=ot.height,Nt=ot.width;st.x=(Ce=st.x)!==null&&Ce!==void 0?Ce:st.left,st.y=(rt=st.y)!==null&&rt!==void 0?rt:st.top;var Xt=kt.documentElement,vi=Xt.clientWidth,ti=Xt.clientHeight,St=Xt.scrollWidth,ii=Xt.scrollHeight,Di=Xt.scrollTop,Ei=Xt.scrollLeft,$i=st.height,pi=st.width,mi=W.height,Xi=W.width,an={left:0,top:0,right:vi,bottom:ti},mn={left:-Ei,top:-Di,right:St-Ei,bottom:ii-Di},nn=we.htmlRegion,gr="visible",Ci="visibleFirst";nn!=="scroll"&&nn!==Ci&&(nn=gr);var Ki=nn===Ci,wn=V(mn,Yt),Mi=V(an,Yt),In=nn===gr?Mi:wn,fn=Ki?Mi:In;je.style.left="auto",je.style.top="auto",je.style.right="0",je.style.bottom="0";var sr=je.getBoundingClientRect();je.style.left=jt,je.style.top=Je,je.style.right=Ft,je.style.bottom=Le,je.style.overflow=ye,(ut=je.parentElement)===null||ut===void 0||ut.removeChild(K);var gn=A(Math.round(pi/parseFloat(Nt)*1e3)/1e3),Xn=A(Math.round($i/parseFloat(xt)*1e3)/1e3);if(gn===0||Xn===0||(0,P.Sh)(ve)&&!(0,te.Z)(ve))return;var Ur=we.offset,wi=we.targetOffset,ai=ze(st,Ur),Re=(0,De.Z)(ai,2),$e=Re[0],ht=Re[1],et=ze(W,wi),wt=(0,De.Z)(et,2),Ct=wt[0],zt=wt[1];W.x-=Ct,W.y-=zt;var Wt=we.points||[],Pi=(0,De.Z)(Wt,2),ki=Pi[0],_n=Pi[1],oi=at(_n),Ri=at(ki),Ai=Bt(W,oi),Fi=Bt(st,Ri),Vi=(0,ce.Z)({},we),yi=Ai.x-Fi.x+$e,Ii=Ai.y-Fi.y+ht,Wi=fr(yi,Ii),Bi=fr(yi,Ii,Mi),bi=Bt(W,["t","l"]),Ji=Bt(st,["t","l"]),Gi=Bt(W,["b","r"]),Yi=Bt(st,["b","r"]),Rn=we.overflow||{},on=Rn.adjustX,Jn=Rn.adjustY,vn=Rn.shiftX,Tn=Rn.shiftY,Wn=function(nr){return typeof nr=="boolean"?nr:nr>=0},Pn,dn,Ui,Qi;jn();var br=Wn(Jn),ln=Ri[0]===oi[0];if(br&&Ri[0]==="t"&&(dn>fn.bottom||dt.current.bt)){var Oi=Ii;ln?Oi-=$i-mi:Oi=bi.y-Yi.y-ht;var or=fr(yi,Oi),xr=fr(yi,Oi,Mi);or>Wi||or===Wi&&(!Ki||xr>=Bi)?(dt.current.bt=!0,Ii=Oi,ht=-ht,Vi.points=[Me(Ri,0),Me(oi,0)]):dt.current.bt=!1}if(br&&Ri[0]==="b"&&(Pn<fn.top||dt.current.tb)){var Un=Ii;ln?Un+=$i-mi:Un=Gi.y-Ji.y-ht;var Lr=fr(yi,Un),rn=fr(yi,Un,Mi);Lr>Wi||Lr===Wi&&(!Ki||rn>=Bi)?(dt.current.tb=!0,Ii=Un,ht=-ht,Vi.points=[Me(Ri,0),Me(oi,0)]):dt.current.tb=!1}var er=Wn(on),Dr=Ri[1]===oi[1];if(er&&Ri[1]==="l"&&(Qi>fn.right||dt.current.rl)){var kr=yi;Dr?kr-=pi-Xi:kr=bi.x-Yi.x-$e;var wr=fr(kr,Ii),Nn=fr(kr,Ii,Mi);wr>Wi||wr===Wi&&(!Ki||Nn>=Bi)?(dt.current.rl=!0,yi=kr,$e=-$e,Vi.points=[Me(Ri,1),Me(oi,1)]):dt.current.rl=!1}if(er&&Ri[1]==="r"&&(Ui<fn.left||dt.current.lr)){var lr=yi;Dr?lr+=pi-Xi:lr=Gi.x-Ji.x-$e;var ur=fr(lr,Ii),Rr=fr(lr,Ii,Mi);ur>Wi||ur===Wi&&(!Ki||Rr>=Bi)?(dt.current.lr=!0,yi=lr,$e=-$e,Vi.points=[Me(Ri,1),Me(oi,1)]):dt.current.lr=!1}jn();var An=vn===!0?0:vn;typeof An=="number"&&(Ui<Mi.left&&(yi-=Ui-Mi.left-$e,W.x+Xi<Mi.left+An&&(yi+=W.x-Mi.left+Xi-An)),Qi>Mi.right&&(yi-=Qi-Mi.right-$e,W.x>Mi.right-An&&(yi+=W.x-Mi.right+An)));var ar=Tn===!0?0:Tn;typeof ar=="number"&&(Pn<Mi.top&&(Ii-=Pn-Mi.top-ht,W.y+mi<Mi.top+ar&&(Ii+=W.y-Mi.top+mi-ar)),dn>Mi.bottom&&(Ii-=dn-Mi.bottom-ht,W.y>Mi.bottom-ar&&(Ii+=W.y-Mi.bottom+ar)));var Sr=st.x+yi,cr=Sr+pi,hr=st.y+Ii,qi=hr+$i,fi=W.x,ji=fi+Xi,bn=W.y,li=bn+mi,zn=Math.max(Sr,fi),tr=Math.min(cr,ji),Cn=(zn+tr)/2,is=Cn-Sr,Tr=Math.max(hr,bn),_s=Math.min(qi,li),ns=(Tr+_s)/2,pn=ns-hr;ee==null||ee(He,Vi);var ir=sr.right-st.x-(yi+st.width),Yr=sr.bottom-st.y-(Ii+st.height);gn===1&&(yi=Math.round(yi),ir=Math.round(ir)),Xn===1&&(Ii=Math.round(Ii),Yr=Math.round(Yr));var vs={ready:!0,offsetX:yi/gn,offsetY:Ii/Xn,offsetR:ir/gn,offsetB:Yr/Xn,arrowX:is/gn,arrowY:pn/Xn,scaleX:gn,scaleY:Xn,align:Vi};nt(vs)}}),Gt=function(){gt.current+=1;var Ce=gt.current;Promise.resolve().then(function(){gt.current===Ce&&bt()})},Pt=function(){nt(function(Ce){return(0,ce.Z)((0,ce.Z)({},Ce),{},{ready:!1})})};return(0,k.Z)(Pt,[it]),(0,k.Z)(function(){Ne||Pt()},[Ne]),[Xe.ready,Xe.offsetX,Xe.offsetY,Xe.offsetR,Xe.offsetB,Xe.arrowX,Xe.arrowY,Xe.scaleX,Xe.scaleY,Xe.align,Gt]}var Dt=oe(94480);function ft(Ne,He,ve,it,_t){(0,k.Z)(function(){if(Ne&&He&&ve){let gt=function(){it(),_t()};var lt=He,ee=ve,xe=ie(lt),Ke=ie(ee),Xe=de(ee),nt=new Set([Xe].concat((0,Dt.Z)(xe),(0,Dt.Z)(Ke)));return nt.forEach(function(Yt){Yt.addEventListener("scroll",gt,{passive:!0})}),Xe.addEventListener("resize",gt,{passive:!0}),it(),function(){nt.forEach(function(Yt){Yt.removeEventListener("scroll",gt),Xe.removeEventListener("resize",gt)})}}},[Ne,He,ve])}var Si=oe(48736);function di(Ne,He,ve,it,_t,lt,ee,xe){var Ke=M.useRef(Ne);Ke.current=Ne;var Xe=M.useRef(!1);M.useEffect(function(){if(He&&it&&(!_t||lt)){var gt=function(){Xe.current=!1},Yt=function(rt){var ut;Ke.current&&!ee(((ut=rt.composedPath)===null||ut===void 0||(ut=ut.call(rt))===null||ut===void 0?void 0:ut[0])||rt.target)&&!Xe.current&&xe(!1)},dt=de(it);dt.addEventListener("pointerdown",gt,!0),dt.addEventListener("mousedown",Yt,!0),dt.addEventListener("contextmenu",Yt,!0);var ke=(0,f.A)(ve);if(ke&&(ke.addEventListener("mousedown",Yt,!0),ke.addEventListener("contextmenu",Yt,!0)),0)var bt,Gt,Pt,Ae;return function(){dt.removeEventListener("pointerdown",gt,!0),dt.removeEventListener("mousedown",Yt,!0),dt.removeEventListener("contextmenu",Yt,!0),ke&&(ke.removeEventListener("mousedown",Yt,!0),ke.removeEventListener("contextmenu",Yt,!0))}}},[He,ve,it,_t,lt]);function nt(){Xe.current=!0}return nt}var tn=["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 Kt(){var Ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ge.Z,He=M.forwardRef(function(ve,it){var _t=ve.prefixCls,lt=_t===void 0?"rc-trigger-popup":_t,ee=ve.children,xe=ve.action,Ke=xe===void 0?"hover":xe,Xe=ve.showAction,nt=ve.hideAction,gt=ve.popupVisible,Yt=ve.defaultPopupVisible,dt=ve.onPopupVisibleChange,ke=ve.afterPopupVisibleChange,bt=ve.mouseEnterDelay,Gt=ve.mouseLeaveDelay,Pt=Gt===void 0?.1:Gt,Ae=ve.focusDelay,Ce=ve.blurDelay,rt=ve.mask,ut=ve.maskClosable,je=ut===void 0?!0:ut,kt=ve.getPopupContainer,Tt=ve.forceRender,vt=ve.autoDestroy,Ot=ve.destroyPopupOnHide,jt=ve.popup,Je=ve.popupClassName,Ft=ve.popupStyle,Le=ve.popupPlacement,ye=ve.builtinPlacements,we=ye===void 0?{}:ye,K=ve.popupAlign,W=ve.zIndex,ae=ve.stretch,he=ve.getPopupClassNameFromAlign,_e=ve.fresh,st=ve.alignPoint,ot=ve.onPopupClick,xt=ve.onPopupAlign,Nt=ve.arrow,Xt=ve.popupMotion,vi=ve.maskMotion,ti=ve.popupTransitionName,St=ve.popupAnimation,ii=ve.maskTransitionName,Di=ve.maskAnimation,Ei=ve.className,$i=ve.getTriggerDOMNode,pi=(0,Ze.Z)(ve,tn),mi=vt||Ot||!1,Xi=M.useState(!1),an=(0,De.Z)(Xi,2),mn=an[0],nn=an[1];(0,k.Z)(function(){nn((0,T.Z)())},[]);var gr=M.useRef({}),Ci=M.useContext(We),Ki=M.useMemo(function(){return{registerSubPopup:function(Ti,Sn){gr.current[Ti]=Sn,Ci==null||Ci.registerSubPopup(Ti,Sn)}}},[Ci]),wn=(0,R.Z)(),Mi=M.useState(null),In=(0,De.Z)(Mi,2),fn=In[0],sr=In[1],gn=M.useRef(null),Xn=(0,re.Z)(function(ni){gn.current=ni,(0,P.Sh)(ni)&&fn!==ni&&sr(ni),Ci==null||Ci.registerSubPopup(wn,ni)}),Ur=M.useState(null),wi=(0,De.Z)(Ur,2),ai=wi[0],Re=wi[1],$e=M.useRef(null),ht=(0,re.Z)(function(ni){(0,P.Sh)(ni)&&ai!==ni&&(Re(ni),$e.current=ni)}),et=M.Children.only(ee),wt=(et==null?void 0:et.props)||{},Ct={},zt=(0,re.Z)(function(ni){var Ti,Sn,Hi=ai;return(Hi==null?void 0:Hi.contains(ni))||((Ti=(0,f.A)(Hi))===null||Ti===void 0?void 0:Ti.host)===ni||ni===Hi||(fn==null?void 0:fn.contains(ni))||((Sn=(0,f.A)(fn))===null||Sn===void 0?void 0:Sn.host)===ni||ni===fn||Object.values(gr.current).some(function(Ni){return(Ni==null?void 0:Ni.contains(ni))||ni===Ni})}),Wt=Q(lt,Xt,St,ti),Pi=Q(lt,vi,Di,ii),ki=M.useState(Yt||!1),_n=(0,De.Z)(ki,2),oi=_n[0],Ri=_n[1],Ai=gt!=null?gt:oi,Fi=(0,re.Z)(function(ni){gt===void 0&&Ri(ni)});(0,k.Z)(function(){Ri(gt||!1)},[gt]);var Vi=M.useRef(Ai);Vi.current=Ai;var yi=M.useRef([]);yi.current=[];var Ii=(0,re.Z)(function(ni){var Ti;Fi(ni),((Ti=yi.current[yi.current.length-1])!==null&&Ti!==void 0?Ti:Ai)!==ni&&(yi.current.push(ni),dt==null||dt(ni))}),Wi=M.useRef(),Bi=function(){clearTimeout(Wi.current)},bi=function(Ti){var Sn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Bi(),Sn===0?Ii(Ti):Wi.current=setTimeout(function(){Ii(Ti)},Sn*1e3)};M.useEffect(function(){return Bi},[]);var Ji=M.useState(!1),Gi=(0,De.Z)(Ji,2),Yi=Gi[0],Rn=Gi[1];(0,k.Z)(function(ni){(!ni||Ai)&&Rn(!0)},[Ai]);var on=M.useState(null),Jn=(0,De.Z)(on,2),vn=Jn[0],Tn=Jn[1],Wn=M.useState(null),Pn=(0,De.Z)(Wn,2),dn=Pn[0],Ui=Pn[1],Qi=function(Ti){Ui([Ti.clientX,Ti.clientY])},br=Ht(Ai,fn,st&&dn!==null?dn:ai,Le,we,K,xt),ln=(0,De.Z)(br,11),Oi=ln[0],or=ln[1],xr=ln[2],Un=ln[3],Lr=ln[4],rn=ln[5],er=ln[6],Dr=ln[7],kr=ln[8],wr=ln[9],Nn=ln[10],lr=At(mn,Ke,Xe,nt),ur=(0,De.Z)(lr,2),Rr=ur[0],An=ur[1],ar=Rr.has("click"),Sr=An.has("click")||An.has("contextMenu"),cr=(0,re.Z)(function(){Yi||Nn()}),hr=function(){Vi.current&&st&&Sr&&bi(!1)};ft(Ai,ai,fn,cr,hr),(0,k.Z)(function(){cr()},[dn,Le]),(0,k.Z)(function(){Ai&&!(we!=null&&we[Le])&&cr()},[JSON.stringify(K)]);var qi=M.useMemo(function(){var ni=X(we,lt,wr,st);return S()(ni,he==null?void 0:he(wr))},[wr,he,we,lt,st]);M.useImperativeHandle(it,function(){return{nativeElement:$e.current,popupElement:gn.current,forceAlign:cr}});var fi=M.useState(0),ji=(0,De.Z)(fi,2),bn=ji[0],li=ji[1],zn=M.useState(0),tr=(0,De.Z)(zn,2),Cn=tr[0],is=tr[1],Tr=function(){if(ae&&ai){var Ti=ai.getBoundingClientRect();li(Ti.width),is(Ti.height)}},_s=function(){Tr(),cr()},ns=function(Ti){Rn(!1),Nn(),ke==null||ke(Ti)},pn=function(){return new Promise(function(Ti){Tr(),Tn(function(){return Ti})})};(0,k.Z)(function(){vn&&(Nn(),vn(),Tn(null))},[vn]);function ir(ni,Ti,Sn,Hi){Ct[ni]=function(Ni){var zr;Hi==null||Hi(Ni),bi(Ti,Sn);for(var qn=arguments.length,Xr=new Array(qn>1?qn-1:0),rs=1;rs<qn;rs++)Xr[rs-1]=arguments[rs];(zr=wt[ni])===null||zr===void 0||zr.call.apply(zr,[wt,Ni].concat(Xr))}}(ar||Sr)&&(Ct.onClick=function(ni){var Ti;Vi.current&&Sr?bi(!1):!Vi.current&&ar&&(Qi(ni),bi(!0));for(var Sn=arguments.length,Hi=new Array(Sn>1?Sn-1:0),Ni=1;Ni<Sn;Ni++)Hi[Ni-1]=arguments[Ni];(Ti=wt.onClick)===null||Ti===void 0||Ti.call.apply(Ti,[wt,ni].concat(Hi))});var Yr=di(Ai,Sr,ai,fn,rt,je,zt,bi),vs=Rr.has("hover"),fr=An.has("hover"),jn,dr;vs&&(ir("onMouseEnter",!0,bt,function(ni){Qi(ni)}),ir("onPointerEnter",!0,bt,function(ni){Qi(ni)}),jn=function(Ti){(Ai||Yi)&&fn!==null&&fn!==void 0&&fn.contains(Ti.target)&&bi(!0,bt)},st&&(Ct.onMouseMove=function(ni){var Ti;(Ti=wt.onMouseMove)===null||Ti===void 0||Ti.call(wt,ni)})),fr&&(ir("onMouseLeave",!1,Pt),ir("onPointerLeave",!1,Pt),dr=function(){bi(!1,Pt)}),Rr.has("focus")&&ir("onFocus",!0,Ae),An.has("focus")&&ir("onBlur",!1,Ce),Rr.has("contextMenu")&&(Ct.onContextMenu=function(ni){var Ti;Vi.current&&An.has("contextMenu")?bi(!1):(Qi(ni),bi(!0)),ni.preventDefault();for(var Sn=arguments.length,Hi=new Array(Sn>1?Sn-1:0),Ni=1;Ni<Sn;Ni++)Hi[Ni-1]=arguments[Ni];(Ti=wt.onContextMenu)===null||Ti===void 0||Ti.call.apply(Ti,[wt,ni].concat(Hi))}),Ei&&(Ct.className=S()(wt.className,Ei));var nr=M.useRef(!1);nr.current||(nr.current=Tt||Ai||Yi);var ls=(0,ce.Z)((0,ce.Z)({},wt),Ct),Pr={},Fs=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Fs.forEach(function(ni){pi[ni]&&(Pr[ni]=function(){for(var Ti,Sn=arguments.length,Hi=new Array(Sn),Ni=0;Ni<Sn;Ni++)Hi[Ni]=arguments[Ni];(Ti=ls[ni])===null||Ti===void 0||Ti.call.apply(Ti,[ls].concat(Hi)),pi[ni].apply(pi,Hi)})});var Gs=M.cloneElement(et,(0,ce.Z)((0,ce.Z)({},ls),Pr)),As={x:rn,y:er},Sa=Nt?(0,ce.Z)({},Nt!==!0?Nt:{}):null;return M.createElement(M.Fragment,null,M.createElement(Te.Z,{disabled:!Ai,ref:ht,onResize:_s},M.createElement(se,{getTriggerDOMNode:$i},Gs)),nr.current&&M.createElement(We.Provider,{value:Ki},M.createElement(be,{portal:Ne,ref:Xn,prefixCls:lt,popup:jt,className:S()(Je,qi),style:Ft,target:ai,onMouseEnter:jn,onMouseLeave:dr,onPointerEnter:jn,zIndex:W,open:Ai,keepDom:Yi,fresh:_e,onClick:ot,onPointerDownCapture:Yr,mask:rt,motion:Wt,maskMotion:Pi,onVisibleChanged:ns,onPrepare:pn,forceRender:Tt,autoDestroy:mi,getPopupContainer:kt,align:wr,arrow:Sa,arrowPos:As,ready:Oi,offsetX:or,offsetY:xr,offsetR:Un,offsetB:Lr,onAlign:cr,stretch:ae,targetWidth:bn/Dr,targetHeight:Cn/kr})))});return He}var hn=Kt(ge.Z)},64018:function(){var Li,It,oe,ce=!1,De,Ze;window.PR_SHOULD_USE_CONTINUATION=!0;var ge,q;(function(){var S=window,Te=["break,continue,do,else,for,if,return,while"],P=[Te,"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"],f=[P,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],re=[f,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],R=[f,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],k=[f,"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"],T="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",M=[f,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],O="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",Y=[Te,"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"],H=[Te,"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"],j=[Te,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],U=[re,k,R,M,O,Y,H,j],$=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,G="str",fe="kwd",be="com",Se="typ",se="lit",Oe="pun",We="pln",Be="tag",At="dec",te="src",z="atn",X="atv",Q="nocode",de="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function ie(He){for(var ve=0,it=!1,_t=!1,lt=0,ee=He.length;lt<ee;++lt){var xe=He[lt];if(xe.ignoreCase)_t=!0;else if(/[a-z]/i.test(xe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){it=!0,_t=!1;break}}var Ke={b:8,t:9,n:10,v:11,f:12,r:13};function Xe(ke){var bt=ke.charCodeAt(0);if(bt!==92)return bt;var Gt=ke.charAt(1);return bt=Ke[Gt],bt||("0"<=Gt&&Gt<="7"?parseInt(ke.substring(1),8):Gt==="u"||Gt==="x"?parseInt(ke.substring(2),16):ke.charCodeAt(1))}function nt(ke){if(ke<32)return(ke<16?"\\x0":"\\x")+ke.toString(16);var bt=String.fromCharCode(ke);return bt==="\\"||bt==="-"||bt==="]"||bt==="^"?"\\"+bt:bt}function gt(ke){var bt=ke.substring(1,ke.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")),Gt=[],Pt=bt[0]==="^",Ae=["["];Pt&&Ae.push("^");for(var Ce=Pt?1:0,rt=bt.length;Ce<rt;++Ce){var ut=bt[Ce];if(/\\[bdsw]/i.test(ut))Ae.push(ut);else{var je=Xe(ut),kt;Ce+2<rt&&bt[Ce+1]==="-"?(kt=Xe(bt[Ce+2]),Ce+=2):kt=je,Gt.push([je,kt]),kt<65||je>122||(kt<65||je>90||Gt.push([Math.max(65,je)|32,Math.min(kt,90)|32]),kt<97||je>122||Gt.push([Math.max(97,je)&-33,Math.min(kt,122)&-33]))}}Gt.sort(function(jt,Je){return jt[0]-Je[0]||Je[1]-jt[1]});for(var Tt=[],vt=[],Ce=0;Ce<Gt.length;++Ce){var Ot=Gt[Ce];Ot[0]<=vt[1]+1?vt[1]=Math.max(vt[1],Ot[1]):Tt.push(vt=Ot)}for(var Ce=0;Ce<Tt.length;++Ce){var Ot=Tt[Ce];Ae.push(nt(Ot[0])),Ot[1]>Ot[0]&&(Ot[1]+1>Ot[0]&&Ae.push("-"),Ae.push(nt(Ot[1])))}return Ae.push("]"),Ae.join("")}function Yt(ke){for(var bt=ke.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")),Gt=bt.length,Pt=[],Ae=0,Ce=0;Ae<Gt;++Ae){var rt=bt[Ae];if(rt==="(")++Ce;else if(rt.charAt(0)==="\\"){var ut=+rt.substring(1);ut&&(ut<=Ce?Pt[ut]=-1:bt[Ae]=nt(ut))}}for(var Ae=1;Ae<Pt.length;++Ae)Pt[Ae]===-1&&(Pt[Ae]=++ve);for(var Ae=0,Ce=0;Ae<Gt;++Ae){var rt=bt[Ae];if(rt==="(")++Ce,Pt[Ce]||(bt[Ae]="(?:");else if(rt.charAt(0)==="\\"){var ut=+rt.substring(1);ut&&ut<=Ce&&(bt[Ae]="\\"+Pt[ut])}}for(var Ae=0;Ae<Gt;++Ae)bt[Ae]==="^"&&bt[Ae+1]!=="^"&&(bt[Ae]="");if(ke.ignoreCase&&it)for(var Ae=0;Ae<Gt;++Ae){var rt=bt[Ae],je=rt.charAt(0);rt.length>=2&&je==="["?bt[Ae]=gt(rt):je!=="\\"&&(bt[Ae]=rt.replace(/[a-zA-Z]/g,function(vt){var Ot=vt.charCodeAt(0);return"["+String.fromCharCode(Ot&-33,Ot|32)+"]"}))}return bt.join("")}for(var dt=[],lt=0,ee=He.length;lt<ee;++lt){var xe=He[lt];if(xe.global||xe.multiline)throw new Error(""+xe);dt.push("(?:"+Yt(xe)+")")}return new RegExp(dt.join("|"),_t?"gi":"g")}function A(He,ve){var it=/(?:^|\s)nocode(?:\s|$)/,_t=[],lt=0,ee=[],xe=0;function Ke(Xe){var nt=Xe.nodeType;if(nt==1){if(it.test(Xe.className))return;for(var gt=Xe.firstChild;gt;gt=gt.nextSibling)Ke(gt);var Yt=Xe.nodeName.toLowerCase();(Yt==="br"||Yt==="li")&&(_t[xe]=`
|
|
|
`,ee[xe<<1]=lt++,ee[xe++<<1|1]=Xe)}else if(nt==3||nt==4){var dt=Xe.nodeValue;dt.length&&(ve?dt=dt.replace(/\r\n?/g,`
|
|
|
`):dt=dt.replace(/[ \t\r\n]+/g," "),_t[xe]=dt,ee[xe<<1]=lt,lt+=dt.length,ee[xe++<<1|1]=Xe)}}return Ke(He),{sourceCode:_t.join("").replace(/\n$/,""),spans:ee}}function L(He,ve,it,_t,lt){if(it){var ee={sourceNode:He,pre:1,langExtension:null,numberLines:null,sourceCode:it,spans:null,basePos:ve,decorations:null};_t(ee),lt.push.apply(lt,ee.decorations)}}var V=/\S/;function pe(He){for(var ve=void 0,it=He.firstChild;it;it=it.nextSibling){var _t=it.nodeType;ve=_t===1?ve?He:it:_t===3&&V.test(it.nodeValue)?He:ve}return ve===He?void 0:ve}function ze(He,ve){var it={},_t;(function(){for(var xe=He.concat(ve),Ke=[],Xe={},nt=0,gt=xe.length;nt<gt;++nt){var Yt=xe[nt],dt=Yt[3];if(dt)for(var ke=dt.length;--ke>=0;)it[dt.charAt(ke)]=Yt;var bt=Yt[1],Gt=""+bt;Xe.hasOwnProperty(Gt)||(Ke.push(bt),Xe[Gt]=null)}Ke.push(/[\0-\uffff]/),_t=ie(Ke)})();var lt=ve.length,ee=function(xe){for(var Ke=xe.sourceCode,Xe=xe.basePos,nt=xe.sourceNode,gt=[Xe,We],Yt=0,dt=Ke.match(_t)||[],ke={},bt=0,Gt=dt.length;bt<Gt;++bt){var Pt=dt[bt],Ae=ke[Pt],Ce=void 0,rt;if(typeof Ae=="string")rt=!1;else{var ut=it[Pt.charAt(0)];if(ut)Ce=Pt.match(ut[1]),Ae=ut[0];else{for(var je=0;je<lt;++je)if(ut=ve[je],Ce=Pt.match(ut[1]),Ce){Ae=ut[0];break}Ce||(Ae=We)}rt=Ae.length>=5&&Ae.substring(0,5)==="lang-",rt&&!(Ce&&typeof Ce[1]=="string")&&(rt=!1,Ae=te),rt||(ke[Pt]=Ae)}var kt=Yt;if(Yt+=Pt.length,!rt)gt.push(Xe+kt,Ae);else{var Tt=Ce[1],vt=Pt.indexOf(Tt),Ot=vt+Tt.length;Ce[2]&&(Ot=Pt.length-Ce[2].length,vt=Ot-Tt.length);var jt=Ae.substring(5);L(nt,Xe+kt,Pt.substring(0,vt),ee,gt),L(nt,Xe+kt+vt,Tt,Si(jt,Tt),gt),L(nt,Xe+kt+Ot,Pt.substring(Ot),ee,gt)}}xe.decorations=gt};return ee}function at(He){var ve=[],it=[];He.tripleQuotedStrings?ve.push([G,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):He.multiLineStrings?ve.push([G,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ve.push([G,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),He.verbatimStrings&&it.push([G,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var _t=He.hashComments;_t&&(He.cStyleComments?(_t>1?ve.push([be,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ve.push([be,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),it.push([G,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ve.push([be,/^#[^\r\n]*/,null,"#"])),He.cStyleComments&&(it.push([be,/^\/\/[^\r\n]*/,null]),it.push([be,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var lt=He.regexLiterals;if(lt){var ee=lt>1?"":`
|
|
|
\r`,xe=ee?".":"[\\S\\s]",Ke="/(?=[^/*"+ee+"])(?:[^/\\x5B\\x5C"+ee+"]|\\x5C"+xe+"|\\x5B(?:[^\\x5C\\x5D"+ee+"]|\\x5C"+xe+")*(?:\\x5D|$))+/";it.push(["lang-regex",RegExp("^"+de+"("+Ke+")")])}var Xe=He.types;Xe&&it.push([Se,Xe]);var nt=(""+He.keywords).replace(/^ | $/g,"");nt.length&&it.push([fe,new RegExp("^(?:"+nt.replace(/[\s,]+/g,"|")+")\\b"),null]),ve.push([We,/^\s+/,null,` \r
|
|
|
\xA0`]);var gt="^.[^\\s\\w.$@'\"`/\\\\]*";return He.regexLiterals&&(gt+="(?!s*/)"),it.push([se,/^@[a-z_$][a-z_$@0-9]*/i,null],[Se,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[We,/^[a-z_$][a-z_$@0-9]*/i,null],[se,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[We,/^\\[\s\S]?/,null],[Oe,new RegExp(gt),null]),ze(ve,it)}var Bt=at({keywords:U,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Me(He,ve,it){for(var _t=/(?:^|\s)nocode(?:\s|$)/,lt=/\r\n?|\n/,ee=He.ownerDocument,xe=ee.createElement("li");He.firstChild;)xe.appendChild(He.firstChild);var Ke=[xe];function Xe(bt){var Gt=bt.nodeType;if(Gt==1&&!_t.test(bt.className))if(bt.nodeName==="br")nt(bt),bt.parentNode&&bt.parentNode.removeChild(bt);else for(var Pt=bt.firstChild;Pt;Pt=Pt.nextSibling)Xe(Pt);else if((Gt==3||Gt==4)&&it){var Ae=bt.nodeValue,Ce=Ae.match(lt);if(Ce){var rt=Ae.substring(0,Ce.index);bt.nodeValue=rt;var ut=Ae.substring(Ce.index+Ce[0].length);if(ut){var je=bt.parentNode;je.insertBefore(ee.createTextNode(ut),bt.nextSibling)}nt(bt),rt||bt.parentNode.removeChild(bt)}}}function nt(bt){for(;!bt.nextSibling;)if(bt=bt.parentNode,!bt)return;function Gt(Ce,rt){var ut=rt?Ce.cloneNode(!1):Ce,je=Ce.parentNode;if(je){var kt=Gt(je,1),Tt=Ce.nextSibling;kt.appendChild(ut);for(var vt=Tt;vt;vt=Tt)Tt=vt.nextSibling,kt.appendChild(vt)}return ut}for(var Pt=Gt(bt.nextSibling,0),Ae;(Ae=Pt.parentNode)&&Ae.nodeType===1;)Pt=Ae;Ke.push(Pt)}for(var gt=0;gt<Ke.length;++gt)Xe(Ke[gt]);ve===(ve|0)&&Ke[0].setAttribute("value",ve);var Yt=ee.createElement("ol");Yt.className="linenums";for(var dt=Math.max(0,ve-1|0)||0,gt=0,ke=Ke.length;gt<ke;++gt)xe=Ke[gt],xe.className="L"+(gt+dt)%10,xe.firstChild||xe.appendChild(ee.createTextNode("\xA0")),Yt.appendChild(xe);He.appendChild(Yt)}function Ht(He){var ve=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ve=ve&&+ve[1]<=8;var it=/\n/g,_t=He.sourceCode,lt=_t.length,ee=0,xe=He.spans,Ke=xe.length,Xe=0,nt=He.decorations,gt=nt.length,Yt=0;nt[gt]=lt;var dt,ke;for(ke=dt=0;ke<gt;)nt[ke]!==nt[ke+2]?(nt[dt++]=nt[ke++],nt[dt++]=nt[ke++]):ke+=2;for(gt=dt,ke=dt=0;ke<gt;){for(var bt=nt[ke],Gt=nt[ke+1],Pt=ke+2;Pt+2<=gt&&nt[Pt+1]===Gt;)Pt+=2;nt[dt++]=bt,nt[dt++]=Gt,ke=Pt}gt=nt.length=dt;var Ae=He.sourceNode,Ce="";Ae&&(Ce=Ae.style.display,Ae.style.display="none");try{for(var rt=null;Xe<Ke;){var ut=xe[Xe],je=xe[Xe+2]||lt,kt=nt[Yt+2]||lt,Pt=Math.min(je,kt),Tt=xe[Xe+1],vt;if(Tt.nodeType!==1&&(vt=_t.substring(ee,Pt))){ve&&(vt=vt.replace(it,"\r")),Tt.nodeValue=vt;var Ot=Tt.ownerDocument,jt=Ot.createElement("span");jt.className=nt[Yt+1];var Je=Tt.parentNode;Je.replaceChild(jt,Tt),jt.appendChild(Tt),ee<je&&(xe[Xe+1]=Tt=Ot.createTextNode(_t.substring(Pt,je)),Je.insertBefore(Tt,jt.nextSibling))}ee=Pt,ee>=je&&(Xe+=2),ee>=kt&&(Yt+=2)}}finally{Ae&&(Ae.style.display=Ce)}}var Dt={};function ft(He,ve){for(var it=ve.length;--it>=0;){var _t=ve[it];Dt.hasOwnProperty(_t)?S.console&&console.warn("cannot override language handler %s",_t):Dt[_t]=He}}function Si(He,ve){return He&&Dt.hasOwnProperty(He)||(He=/^\s*</.test(ve)?"default-markup":"default-code"),Dt[He]}ft(Bt,["default-code"]),ft(ze([],[[We,/^[^<?]+/],[At,/^<!\w[^>]*(?:>|$)/],[be,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[Oe,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ft(ze([[We,/^[\s]+/,null,` \r
|
|
|
`],[X,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[Be,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[z,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[Oe,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ft(ze([],[[X,/^[\s\S]+/]]),["uq.val"]),ft(at({keywords:re,hashComments:!0,cStyleComments:!0,types:$}),["c","cc","cpp","cxx","cyc","m"]),ft(at({keywords:"null,true,false"}),["json"]),ft(at({keywords:k,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:$}),["cs"]),ft(at({keywords:R,cStyleComments:!0}),["java"]),ft(at({keywords:j,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ft(at({keywords:Y,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ft(at({keywords:O,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ft(at({keywords:H,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ft(at({keywords:M,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ft(at({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ft(ze([],[[G,/^[\s\S]+/]]),["regex"]);function di(He){var ve=He.langExtension;try{var it=A(He.sourceNode,He.pre),_t=it.sourceCode;He.sourceCode=_t,He.spans=it.spans,He.basePos=0,Si(ve,_t)(He),Ht(He)}catch(lt){S.console&&console.log(lt&<.stack||lt)}}function tn(He,ve,it){var _t=it||!1,lt=ve||null,ee=document.createElement("div");ee.innerHTML="<pre>"+He+"</pre>",ee=ee.firstChild,_t&&Me(ee,_t,!0);var xe={langExtension:lt,numberLines:_t,sourceNode:ee,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return di(xe),ee.innerHTML}function Kt(He,ve){var it=ve||document.body,_t=it.ownerDocument||document;function lt(ut){return it.getElementsByTagName(ut)}for(var ee=[lt("pre"),lt("code"),lt("xmp")],xe=[],Ke=0;Ke<ee.length;++Ke)for(var Xe=0,nt=ee[Ke].length;Xe<nt;++Xe)xe.push(ee[Ke][Xe]);ee=null;var gt=Date;gt.now||(gt={now:function(){return+new Date}});var Yt=0,dt=/\blang(?:uage)?-([\w.]+)(?!\S)/,ke=/\bprettyprint\b/,bt=/\bprettyprinted\b/,Gt=/pre|xmp/i,Pt=/^code$/i,Ae=/^(?:pre|code|xmp)$/i,Ce={};function rt(){for(var ut=S.PR_SHOULD_USE_CONTINUATION?gt.now()+250:1/0;Yt<xe.length&>.now()<ut;Yt++){for(var je=xe[Yt],kt=Ce,Tt=je;Tt=Tt.previousSibling;){var vt=Tt.nodeType,Ot=(vt===7||vt===8)&&Tt.nodeValue;if(Ot?!/^\??prettify\b/.test(Ot):vt!==3||/\S/.test(Tt.nodeValue))break;if(Ot){kt={},Ot.replace(/\b(\w+)=([\w:.%+-]+)/g,function(ot,xt,Nt){kt[xt]=Nt});break}}var jt=je.className;if((kt!==Ce||ke.test(jt))&&!bt.test(jt)){for(var Je=!1,Ft=je.parentNode;Ft;Ft=Ft.parentNode){var Le=Ft.tagName;if(Ae.test(Le)&&Ft.className&&ke.test(Ft.className)){Je=!0;break}}if(!Je){je.className+=" prettyprinted";var ye=kt.lang;if(!ye){ye=jt.match(dt);var we;!ye&&(we=pe(je))&&Pt.test(we.tagName)&&(ye=we.className.match(dt)),ye&&(ye=ye[1])}var K;if(Gt.test(je.tagName))K=1;else{var W=je.currentStyle,ae=_t.defaultView,he=W?W.whiteSpace:ae&&ae.getComputedStyle?ae.getComputedStyle(je,null).getPropertyValue("white-space"):0;K=he&&he.substring(0,3)==="pre"}var _e=kt.linenums;(_e=_e==="true"||+_e)||(_e=jt.match(/\blinenums\b(?::(\d+))?/),_e=_e?_e[1]&&_e[1].length?+_e[1]:!0:!1),_e&&Me(je,_e,K);var st={langExtension:ye,sourceNode:je,numberLines:_e,pre:K,sourceCode:null,basePos:null,spans:null,decorations:null};di(st)}}}Yt<xe.length?S.setTimeout(rt,250):typeof He=="function"&&He()}rt()}var hn=S.PR={createSimpleLexer:ze,registerLangHandler:ft,sourceDecorator:at,PR_ATTRIB_NAME:z,PR_ATTRIB_VALUE:X,PR_COMMENT:be,PR_DECLARATION:At,PR_KEYWORD:fe,PR_LITERAL:se,PR_NOCODE:Q,PR_PLAIN:We,PR_PUNCTUATION:Oe,PR_SOURCE:te,PR_STRING:G,PR_TAG:Be,PR_TYPE:Se,prettyPrintOne:ce?S.prettyPrintOne=tn:ge=tn,prettyPrint:q=ce?S.prettyPrint=Kt:q=Kt},Ne=S.define;typeof Ne=="function"&&Ne.amd&&Ne("google-code-prettify",[],function(){return hn})})()},25769:function(Li,It,oe){"use strict";var ce=oe(98040),De={"text/plain":"Text","text/html":"Url",default:"Text"},Ze="Copy to clipboard: #{key}, Enter";function ge(S){var Te=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return S.replace(/#{\s*key\s*}/g,Te)}function q(S,Te){var P,f,re,R,k,T,M=!1;Te||(Te={}),P=Te.debug||!1;try{re=ce(),R=document.createRange(),k=document.getSelection(),T=document.createElement("span"),T.textContent=S,T.ariaHidden="true",T.style.all="unset",T.style.position="fixed",T.style.top=0,T.style.clip="rect(0, 0, 0, 0)",T.style.whiteSpace="pre",T.style.webkitUserSelect="text",T.style.MozUserSelect="text",T.style.msUserSelect="text",T.style.userSelect="text",T.addEventListener("copy",function(Y){if(Y.stopPropagation(),Te.format)if(Y.preventDefault(),typeof Y.clipboardData=="undefined"){P&&console.warn("unable to use e.clipboardData"),P&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var H=De[Te.format]||De.default;window.clipboardData.setData(H,S)}else Y.clipboardData.clearData(),Y.clipboardData.setData(Te.format,S);Te.onCopy&&(Y.preventDefault(),Te.onCopy(Y.clipboardData))}),document.body.appendChild(T),R.selectNodeContents(T),k.addRange(R);var O=document.execCommand("copy");if(!O)throw new Error("copy command was unsuccessful");M=!0}catch(Y){P&&console.error("unable to copy using execCommand: ",Y),P&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(Te.format||"text",S),Te.onCopy&&Te.onCopy(window.clipboardData),M=!0}catch(H){P&&console.error("unable to copy using clipboardData: ",H),P&&console.error("falling back to prompt"),f=ge("message"in Te?Te.message:Ze),window.prompt(f,S)}}finally{k&&(typeof k.removeRange=="function"?k.removeRange(R):k.removeAllRanges()),T&&document.body.removeChild(T),re()}return M}Li.exports=q},53184:function(Li,It,oe){"use strict";var ce,De;function Ze(ge,q,S){var Te=function(P,f){return ge.js_beautify(P,f)};return Te.js=ge.js_beautify,Te.css=q.css_beautify,Te.html=S.html_beautify,Te.js_beautify=ge.js_beautify,Te.css_beautify=q.css_beautify,Te.html_beautify=S.html_beautify,Te}ce=[oe(58553),oe(87804),oe(40998)],De=function(ge,q,S){return Ze(ge,q,S)}.apply(It,ce),De!==void 0&&(Li.exports=De)},87804:function(Li,It){var oe,ce;(function(){var De;(function(){"use strict";var ge=[,,function(P){function f(k){this.__parent=k,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=[]}f.prototype.clone_empty=function(){var k=new f(this.__parent);return k.set_indent(this.__indent_count,this.__alignment_count),k},f.prototype.item=function(k){return k<0?this.__items[this.__items.length+k]:this.__items[k]},f.prototype.has_match=function(k){for(var T=this.__items.length-1;T>=0;T--)if(this.__items[T].match(k))return!0;return!1},f.prototype.set_indent=function(k,T){this.is_empty()&&(this.__indent_count=k||0,this.__alignment_count=T||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},f.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)},f.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},f.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var k=this.__parent.current_line;return k.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),k.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),k.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,k.__items[0]===" "&&(k.__items.splice(0,1),k.__character_count-=1),!0}return!1},f.prototype.is_empty=function(){return this.__items.length===0},f.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},f.prototype.push=function(k){this.__items.push(k);var T=k.lastIndexOf(`
|
|
|
`);T!==-1?this.__character_count=k.length-T:this.__character_count+=k.length},f.prototype.pop=function(){var k=null;return this.is_empty()||(k=this.__items.pop(),this.__character_count-=k.length),k},f.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},f.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},f.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},f.prototype.toString=function(){var k="";return this.is_empty()?this.__parent.indent_empty_lines&&(k=this.__parent.get_indent_string(this.__indent_count)):(k=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),k+=this.__items.join("")),k};function re(k,T){this.__cache=[""],this.__indent_size=k.indent_size,this.__indent_string=k.indent_char,k.indent_with_tabs||(this.__indent_string=new Array(k.indent_size+1).join(k.indent_char)),T=T||"",k.indent_level>0&&(T=new Array(k.indent_level+1).join(this.__indent_string)),this.__base_string=T,this.__base_string_length=T.length}re.prototype.get_indent_size=function(k,T){var M=this.__base_string_length;return T=T||0,k<0&&(M=0),M+=k*this.__indent_size,M+=T,M},re.prototype.get_indent_string=function(k,T){var M=this.__base_string;return T=T||0,k<0&&(k=0,M=""),T+=k*this.__indent_size,this.__ensure_cache(T),M+=this.__cache[T],M},re.prototype.__ensure_cache=function(k){for(;k>=this.__cache.length;)this.__add_column()},re.prototype.__add_column=function(){var k=this.__cache.length,T=0,M="";this.__indent_size&&k>=this.__indent_size&&(T=Math.floor(k/this.__indent_size),k-=T*this.__indent_size,M=new Array(T+1).join(this.__indent_string)),k&&(M+=new Array(k+1).join(" ")),this.__cache.push(M)};function R(k,T){this.__indent_cache=new re(k,T),this.raw=!1,this._end_with_newline=k.end_with_newline,this.indent_size=k.indent_size,this.wrap_line_length=k.wrap_line_length,this.indent_empty_lines=k.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new f(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}R.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},R.prototype.get_line_number=function(){return this.__lines.length},R.prototype.get_indent_string=function(k,T){return this.__indent_cache.get_indent_string(k,T)},R.prototype.get_indent_size=function(k,T){return this.__indent_cache.get_indent_size(k,T)},R.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},R.prototype.add_new_line=function(k){return this.is_empty()||!k&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},R.prototype.get_code=function(k){this.trim(!0);var T=this.current_line.pop();T&&(T[T.length-1]===`
|
|
|
`&&(T=T.replace(/\n+$/g,"")),this.current_line.push(T)),this._end_with_newline&&this.__add_outputline();var M=this.__lines.join(`
|
|
|
`);return k!==`
|
|
|
`&&(M=M.replace(/[\n]/g,k)),M},R.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},R.prototype.set_indent=function(k,T){return k=k||0,T=T||0,this.next_line.set_indent(k,T),this.__lines.length>1?(this.current_line.set_indent(k,T),!0):(this.current_line.set_indent(),!1)},R.prototype.add_raw_token=function(k){for(var T=0;T<k.newlines;T++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(k.whitespace_before),this.current_line.push(k.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},R.prototype.add_token=function(k){this.__add_space_before_token(),this.current_line.push(k),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},R.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(" "))},R.prototype.remove_indent=function(k){for(var T=this.__lines.length;k<T;)this.__lines[k]._remove_indent(),k++;this.current_line._remove_wrap_indent()},R.prototype.trim=function(k){for(k=k===void 0?!1:k,this.current_line.trim();k&&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},R.prototype.just_added_newline=function(){return this.current_line.is_empty()},R.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},R.prototype.ensure_empty_line_above=function(k,T){for(var M=this.__lines.length-2;M>=0;){var O=this.__lines[M];if(O.is_empty())break;if(O.item(0).indexOf(k)!==0&&O.item(-1)!==T){this.__lines.splice(M+1,0,new f(this)),this.previous_line=this.__lines[this.__lines.length-2];break}M--}},P.exports.Output=R},,,,function(P){function f(k,T){this.raw_options=re(k,T),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",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"])}f.prototype._get_array=function(k,T){var M=this.raw_options[k],O=T||[];return typeof M=="object"?M!==null&&typeof M.concat=="function"&&(O=M.concat()):typeof M=="string"&&(O=M.split(/[^a-zA-Z0-9_\/\-]+/)),O},f.prototype._get_boolean=function(k,T){var M=this.raw_options[k],O=M===void 0?!!T:!!M;return O},f.prototype._get_characters=function(k,T){var M=this.raw_options[k],O=T||"";return typeof M=="string"&&(O=M.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),O},f.prototype._get_number=function(k,T){var M=this.raw_options[k];T=parseInt(T,10),isNaN(T)&&(T=0);var O=parseInt(M,10);return isNaN(O)&&(O=T),O},f.prototype._get_selection=function(k,T,M){var O=this._get_selection_list(k,T,M);if(O.length!==1)throw new Error("Invalid Option Value: The option '"+k+`' can only be one of the following values:
|
|
|
`+T+`
|
|
|
You passed in: '`+this.raw_options[k]+"'");return O[0]},f.prototype._get_selection_list=function(k,T,M){if(!T||T.length===0)throw new Error("Selection list cannot be empty.");if(M=M||[T[0]],!this._is_valid_selection(M,T))throw new Error("Invalid Default Value!");var O=this._get_array(k,M);if(!this._is_valid_selection(O,T))throw new Error("Invalid Option Value: The option '"+k+`' can contain only the following values:
|
|
|
`+T+`
|
|
|
You passed in: '`+this.raw_options[k]+"'");return O},f.prototype._is_valid_selection=function(k,T){return k.length&&T.length&&!k.some(function(M){return T.indexOf(M)===-1})};function re(k,T){var M={};k=R(k);var O;for(O in k)O!==T&&(M[O]=k[O]);if(T&&k[T])for(O in k[T])M[O]=k[T][O];return M}function R(k){var T={},M;for(M in k){var O=M.replace(/-/g,"_");T[O]=k[M]}return T}P.exports.Options=f,P.exports.normalizeOpts=R,P.exports.mergeOpts=re},,function(P){var f=RegExp.prototype.hasOwnProperty("sticky");function re(R){this.__input=R||"",this.__input_length=this.__input.length,this.__position=0}re.prototype.restart=function(){this.__position=0},re.prototype.back=function(){this.__position>0&&(this.__position-=1)},re.prototype.hasNext=function(){return this.__position<this.__input_length},re.prototype.next=function(){var R=null;return this.hasNext()&&(R=this.__input.charAt(this.__position),this.__position+=1),R},re.prototype.peek=function(R){var k=null;return R=R||0,R+=this.__position,R>=0&&R<this.__input_length&&(k=this.__input.charAt(R)),k},re.prototype.__match=function(R,k){R.lastIndex=k;var T=R.exec(this.__input);return T&&!(f&&R.sticky)&&T.index!==k&&(T=null),T},re.prototype.test=function(R,k){return k=k||0,k+=this.__position,k>=0&&k<this.__input_length?!!this.__match(R,k):!1},re.prototype.testChar=function(R,k){var T=this.peek(k);return R.lastIndex=0,T!==null&&R.test(T)},re.prototype.match=function(R){var k=this.__match(R,this.__position);return k?this.__position+=k[0].length:k=null,k},re.prototype.read=function(R,k,T){var M="",O;return R&&(O=this.match(R),O&&(M+=O[0])),k&&(O||!R)&&(M+=this.readUntil(k,T)),M},re.prototype.readUntil=function(R,k){var T="",M=this.__position;R.lastIndex=this.__position;var O=R.exec(this.__input);return O?(M=O.index,k&&(M+=O[0].length)):M=this.__input_length,T=this.__input.substring(this.__position,M),this.__position=M,T},re.prototype.readUntilAfter=function(R){return this.readUntil(R,!0)},re.prototype.get_regexp=function(R,k){var T=null,M="g";return k&&f&&(M="y"),typeof R=="string"&&R!==""?T=new RegExp(R,M):R&&(T=new RegExp(R.source,M)),T},re.prototype.get_literal_regexp=function(R){return RegExp(R.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},re.prototype.peekUntilAfter=function(R){var k=this.__position,T=this.readUntilAfter(R);return this.__position=k,T},re.prototype.lookBack=function(R){var k=this.__position-1;return k>=R.length&&this.__input.substring(k-R.length,k).toLowerCase()===R},P.exports.InputScanner=re},,,,,function(P){function f(re,R){re=typeof re=="string"?re:re.source,R=typeof R=="string"?R:R.source,this.__directives_block_pattern=new RegExp(re+/ beautify( \w+[:]\w+)+ /.source+R,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(re+/\sbeautify\signore:end\s/.source+R,"g")}f.prototype.get_directives=function(re){if(!re.match(this.__directives_block_pattern))return null;var R={};this.__directive_pattern.lastIndex=0;for(var k=this.__directive_pattern.exec(re);k;)R[k[1]]=k[2],k=this.__directive_pattern.exec(re);return R},f.prototype.readIgnored=function(re){return re.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=f},,function(P,f,re){var R=re(16).Beautifier,k=re(17).Options;function T(M,O){var Y=new R(M,O);return Y.beautify()}P.exports=T,P.exports.defaultOptions=function(){return new k}},function(P,f,re){var R=re(17).Options,k=re(2).Output,T=re(8).InputScanner,M=re(13).Directives,O=new M(/\/\*/,/\*\//),Y=/\r\n|[\r\n]/,H=/\r\n|[\r\n]/g,j=/\s/,U=/(?:\s|\n)+/g,$=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,G=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function fe(be,Se){this._source_text=be||"",this._options=new R(Se),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"]}fe.prototype.eatString=function(be){var Se="";for(this._ch=this._input.next();this._ch;){if(Se+=this._ch,this._ch==="\\")Se+=this._input.next();else if(be.indexOf(this._ch)!==-1||this._ch===`
|
|
|
`)break;this._ch=this._input.next()}return Se},fe.prototype.eatWhitespace=function(be){for(var Se=j.test(this._input.peek()),se=0;j.test(this._input.peek());)this._ch=this._input.next(),be&&this._ch===`
|
|
|
`&&(se===0||se<this._options.max_preserve_newlines)&&(se++,this._output.add_new_line(!0));return Se},fe.prototype.foundNestedPseudoClass=function(){for(var be=0,Se=1,se=this._input.peek(Se);se;){if(se==="{")return!0;if(se==="(")be+=1;else if(se===")"){if(be===0)return!1;be-=1}else if(se===";"||se==="}")return!1;Se++,se=this._input.peek(Se)}return!1},fe.prototype.print_string=function(be){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(be)},fe.prototype.preserveSingleSpace=function(be){be&&(this._output.space_before_token=!0)},fe.prototype.indent=function(){this._indentLevel++},fe.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},fe.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var be=this._source_text,Se=this._options.eol;Se==="auto"&&(Se=`
|
|
|
`,be&&Y.test(be||"")&&(Se=be.match(Y)[0])),be=be.replace(H,`
|
|
|
`);var se=be.match(/^[\t ]*/)[0];this._output=new k(this._options,se),this._input=new T(be),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var Oe=0,We=!1,Be=!1,At=!1,te=!1,z=!1,X=this._ch,Q=!1,de,ie,A;de=this._input.read(U),ie=de!=="",A=X,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),X=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var L=this._input.read($),V=O.get_directives(L);V&&V.ignore==="start"&&(L+=O.readIgnored(this._input)),this.print_string(L),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(G)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(ie),this.print_string(this._ch);var pe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);pe.match(/[ :]$/)&&(pe=this.eatString(": ").replace(/\s+$/,""),this.print_string(pe),this._output.space_before_token=!0),Oe===0&&pe.indexOf(":")!==-1&&(Be=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(ie),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ze=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ze.match(/[ :]$/)&&(ze=this.eatString(": ").replace(/\s+$/,""),this.print_string(ze),this._output.space_before_token=!0),Oe===0&&ze.indexOf(":")!==-1?(Be=!0,this.indent()):ze in this.NESTED_AT_RULE?(this._nestedLevel+=1,ze in this.CONDITIONAL_GROUP_RULE&&(At=!0)):Oe===0&&!Be&&(te=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(ie),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")Be&&(Be=!1,this.outdent()),te=!1,At?(At=!1,We=this._indentLevel>=this._nestedLevel):We=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&We&&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)):(A==="("?this._output.space_before_token=!1:A!==","&&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(),A==="{"&&this._output.trim(!0),Be&&(this.outdent(),Be=!1),this.print_string(this._ch),We=!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 at=0;at<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;at++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[at])){Q=!0;break}(We||At)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!te&&Oe===0?(this.print_string(":"),Be||(Be=!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 Bt=A==='"'||A==="'";this.preserveSingleSpace(Bt||ie),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")Q=!1,Oe===0?(Be&&(this.outdent(),Be=!1),te=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),Oe++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),Oe&&(Oe--,this.outdent()));else{var Me=!1;this._input.lookBack("with")&&(Me=!0),this.preserveSingleSpace(ie||Me),this.print_string(this._ch),Be&&A==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),z=!0):(this.eatWhitespace(),Oe++,this.indent())}else if(this._ch===")")Oe&&(Oe--,this.outdent()),z&&this._input.peek()===";"&&this._options.selector_separator_newline&&(z=!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&&(!Be||z)&&Oe===0&&!te?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!Be&&Oe===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&j.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(ie),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),j.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 Ht=A==='"'||A==="'";this.preserveSingleSpace(Ht||ie),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
|
`&&Q&&this._output.add_new_line()}var Dt=this._output.get_code(Se);return Dt},P.exports.Beautifier=fe},function(P,f,re){var R=re(6).Options;function k(T){R.call(this,T,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var M=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||M;var O=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var Y=0;Y<O.length;Y++)O[Y]!=="expand"?this.brace_style="collapse":this.brace_style=O[Y]}k.prototype=new R,P.exports.Options=k}],q={};function S(P){var f=q[P];if(f!==void 0)return f.exports;var re=q[P]={exports:{}};return ge[P](re,re.exports,S),re.exports}var Te=S(15);De=Te})();var Ze=De;oe=[],ce=function(){return{css_beautify:Ze}}.apply(It,oe),ce!==void 0&&(Li.exports=ce)})()},40998:function(Li,It,oe){var ce,De;(function(){var Ze;(function(){"use strict";var Te=[,,function(R){function k(O){this.__parent=O,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=[]}k.prototype.clone_empty=function(){var O=new k(this.__parent);return O.set_indent(this.__indent_count,this.__alignment_count),O},k.prototype.item=function(O){return O<0?this.__items[this.__items.length+O]:this.__items[O]},k.prototype.has_match=function(O){for(var Y=this.__items.length-1;Y>=0;Y--)if(this.__items[Y].match(O))return!0;return!1},k.prototype.set_indent=function(O,Y){this.is_empty()&&(this.__indent_count=O||0,this.__alignment_count=Y||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},k.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)},k.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},k.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var O=this.__parent.current_line;return O.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),O.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),O.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,O.__items[0]===" "&&(O.__items.splice(0,1),O.__character_count-=1),!0}return!1},k.prototype.is_empty=function(){return this.__items.length===0},k.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},k.prototype.push=function(O){this.__items.push(O);var Y=O.lastIndexOf(`
|
|
|
`);Y!==-1?this.__character_count=O.length-Y:this.__character_count+=O.length},k.prototype.pop=function(){var O=null;return this.is_empty()||(O=this.__items.pop(),this.__character_count-=O.length),O},k.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},k.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},k.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},k.prototype.toString=function(){var O="";return this.is_empty()?this.__parent.indent_empty_lines&&(O=this.__parent.get_indent_string(this.__indent_count)):(O=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),O+=this.__items.join("")),O};function T(O,Y){this.__cache=[""],this.__indent_size=O.indent_size,this.__indent_string=O.indent_char,O.indent_with_tabs||(this.__indent_string=new Array(O.indent_size+1).join(O.indent_char)),Y=Y||"",O.indent_level>0&&(Y=new Array(O.indent_level+1).join(this.__indent_string)),this.__base_string=Y,this.__base_string_length=Y.length}T.prototype.get_indent_size=function(O,Y){var H=this.__base_string_length;return Y=Y||0,O<0&&(H=0),H+=O*this.__indent_size,H+=Y,H},T.prototype.get_indent_string=function(O,Y){var H=this.__base_string;return Y=Y||0,O<0&&(O=0,H=""),Y+=O*this.__indent_size,this.__ensure_cache(Y),H+=this.__cache[Y],H},T.prototype.__ensure_cache=function(O){for(;O>=this.__cache.length;)this.__add_column()},T.prototype.__add_column=function(){var O=this.__cache.length,Y=0,H="";this.__indent_size&&O>=this.__indent_size&&(Y=Math.floor(O/this.__indent_size),O-=Y*this.__indent_size,H=new Array(Y+1).join(this.__indent_string)),O&&(H+=new Array(O+1).join(" ")),this.__cache.push(H)};function M(O,Y){this.__indent_cache=new T(O,Y),this.raw=!1,this._end_with_newline=O.end_with_newline,this.indent_size=O.indent_size,this.wrap_line_length=O.wrap_line_length,this.indent_empty_lines=O.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new k(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}M.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},M.prototype.get_line_number=function(){return this.__lines.length},M.prototype.get_indent_string=function(O,Y){return this.__indent_cache.get_indent_string(O,Y)},M.prototype.get_indent_size=function(O,Y){return this.__indent_cache.get_indent_size(O,Y)},M.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},M.prototype.add_new_line=function(O){return this.is_empty()||!O&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},M.prototype.get_code=function(O){this.trim(!0);var Y=this.current_line.pop();Y&&(Y[Y.length-1]===`
|
|
|
`&&(Y=Y.replace(/\n+$/g,"")),this.current_line.push(Y)),this._end_with_newline&&this.__add_outputline();var H=this.__lines.join(`
|
|
|
`);return O!==`
|
|
|
`&&(H=H.replace(/[\n]/g,O)),H},M.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},M.prototype.set_indent=function(O,Y){return O=O||0,Y=Y||0,this.next_line.set_indent(O,Y),this.__lines.length>1?(this.current_line.set_indent(O,Y),!0):(this.current_line.set_indent(),!1)},M.prototype.add_raw_token=function(O){for(var Y=0;Y<O.newlines;Y++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(O.whitespace_before),this.current_line.push(O.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},M.prototype.add_token=function(O){this.__add_space_before_token(),this.current_line.push(O),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},M.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(" "))},M.prototype.remove_indent=function(O){for(var Y=this.__lines.length;O<Y;)this.__lines[O]._remove_indent(),O++;this.current_line._remove_wrap_indent()},M.prototype.trim=function(O){for(O=O===void 0?!1:O,this.current_line.trim();O&&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},M.prototype.just_added_newline=function(){return this.current_line.is_empty()},M.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},M.prototype.ensure_empty_line_above=function(O,Y){for(var H=this.__lines.length-2;H>=0;){var j=this.__lines[H];if(j.is_empty())break;if(j.item(0).indexOf(O)!==0&&j.item(-1)!==Y){this.__lines.splice(H+1,0,new k(this)),this.previous_line=this.__lines[this.__lines.length-2];break}H--}},R.exports.Output=M},function(R){function k(T,M,O,Y){this.type=T,this.text=M,this.comments_before=null,this.newlines=O||0,this.whitespace_before=Y||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}R.exports.Token=k},,,function(R){function k(O,Y){this.raw_options=T(O,Y),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"])}k.prototype._get_array=function(O,Y){var H=this.raw_options[O],j=Y||[];return typeof H=="object"?H!==null&&typeof H.concat=="function"&&(j=H.concat()):typeof H=="string"&&(j=H.split(/[^a-zA-Z0-9_\/\-]+/)),j},k.prototype._get_boolean=function(O,Y){var H=this.raw_options[O],j=H===void 0?!!Y:!!H;return j},k.prototype._get_characters=function(O,Y){var H=this.raw_options[O],j=Y||"";return typeof H=="string"&&(j=H.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),j},k.prototype._get_number=function(O,Y){var H=this.raw_options[O];Y=parseInt(Y,10),isNaN(Y)&&(Y=0);var j=parseInt(H,10);return isNaN(j)&&(j=Y),j},k.prototype._get_selection=function(O,Y,H){var j=this._get_selection_list(O,Y,H);if(j.length!==1)throw new Error("Invalid Option Value: The option '"+O+`' can only be one of the following values:
|
|
|
`+Y+`
|
|
|
You passed in: '`+this.raw_options[O]+"'");return j[0]},k.prototype._get_selection_list=function(O,Y,H){if(!Y||Y.length===0)throw new Error("Selection list cannot be empty.");if(H=H||[Y[0]],!this._is_valid_selection(H,Y))throw new Error("Invalid Default Value!");var j=this._get_array(O,H);if(!this._is_valid_selection(j,Y))throw new Error("Invalid Option Value: The option '"+O+`' can contain only the following values:
|
|
|
`+Y+`
|
|
|
You passed in: '`+this.raw_options[O]+"'");return j},k.prototype._is_valid_selection=function(O,Y){return O.length&&Y.length&&!O.some(function(H){return Y.indexOf(H)===-1})};function T(O,Y){var H={};O=M(O);var j;for(j in O)j!==Y&&(H[j]=O[j]);if(Y&&O[Y])for(j in O[Y])H[j]=O[Y][j];return H}function M(O){var Y={},H;for(H in O){var j=H.replace(/-/g,"_");Y[j]=O[H]}return Y}R.exports.Options=k,R.exports.normalizeOpts=M,R.exports.mergeOpts=T},,function(R){var k=RegExp.prototype.hasOwnProperty("sticky");function T(M){this.__input=M||"",this.__input_length=this.__input.length,this.__position=0}T.prototype.restart=function(){this.__position=0},T.prototype.back=function(){this.__position>0&&(this.__position-=1)},T.prototype.hasNext=function(){return this.__position<this.__input_length},T.prototype.next=function(){var M=null;return this.hasNext()&&(M=this.__input.charAt(this.__position),this.__position+=1),M},T.prototype.peek=function(M){var O=null;return M=M||0,M+=this.__position,M>=0&&M<this.__input_length&&(O=this.__input.charAt(M)),O},T.prototype.__match=function(M,O){M.lastIndex=O;var Y=M.exec(this.__input);return Y&&!(k&&M.sticky)&&Y.index!==O&&(Y=null),Y},T.prototype.test=function(M,O){return O=O||0,O+=this.__position,O>=0&&O<this.__input_length?!!this.__match(M,O):!1},T.prototype.testChar=function(M,O){var Y=this.peek(O);return M.lastIndex=0,Y!==null&&M.test(Y)},T.prototype.match=function(M){var O=this.__match(M,this.__position);return O?this.__position+=O[0].length:O=null,O},T.prototype.read=function(M,O,Y){var H="",j;return M&&(j=this.match(M),j&&(H+=j[0])),O&&(j||!M)&&(H+=this.readUntil(O,Y)),H},T.prototype.readUntil=function(M,O){var Y="",H=this.__position;M.lastIndex=this.__position;var j=M.exec(this.__input);return j?(H=j.index,O&&(H+=j[0].length)):H=this.__input_length,Y=this.__input.substring(this.__position,H),this.__position=H,Y},T.prototype.readUntilAfter=function(M){return this.readUntil(M,!0)},T.prototype.get_regexp=function(M,O){var Y=null,H="g";return O&&k&&(H="y"),typeof M=="string"&&M!==""?Y=new RegExp(M,H):M&&(Y=new RegExp(M.source,H)),Y},T.prototype.get_literal_regexp=function(M){return RegExp(M.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},T.prototype.peekUntilAfter=function(M){var O=this.__position,Y=this.readUntilAfter(M);return this.__position=O,Y},T.prototype.lookBack=function(M){var O=this.__position-1;return O>=M.length&&this.__input.substring(O-M.length,O).toLowerCase()===M},R.exports.InputScanner=T},function(R,k,T){var M=T(8).InputScanner,O=T(3).Token,Y=T(10).TokenStream,H=T(11).WhitespacePattern,j={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},U=function($,G){this._input=new M($),this._options=G||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new H(this._input)};U.prototype.tokenize=function(){this._input.restart(),this.__tokens=new Y,this._reset();for(var $,G=new O(j.START,""),fe=null,be=[],Se=new Y;G.type!==j.EOF;){for($=this._get_next_token(G,fe);this._is_comment($);)Se.add($),$=this._get_next_token(G,fe);Se.isEmpty()||($.comments_before=Se,Se=new Y),$.parent=fe,this._is_opening($)?(be.push(fe),fe=$):fe&&this._is_closing($,fe)&&($.opened=fe,fe.closed=$,fe=be.pop(),$.parent=fe),$.previous=G,G.next=$,this.__tokens.add($),G=$}return this.__tokens},U.prototype._is_first_token=function(){return this.__tokens.isEmpty()},U.prototype._reset=function(){},U.prototype._get_next_token=function($,G){this._readWhitespace();var fe=this._input.read(/.+/g);return fe?this._create_token(j.RAW,fe):this._create_token(j.EOF,"")},U.prototype._is_comment=function($){return!1},U.prototype._is_opening=function($){return!1},U.prototype._is_closing=function($,G){return!1},U.prototype._create_token=function($,G){var fe=new O($,G,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return fe},U.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},R.exports.Tokenizer=U,R.exports.TOKEN=j},function(R){function k(T){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=T}k.prototype.restart=function(){this.__position=0},k.prototype.isEmpty=function(){return this.__tokens_length===0},k.prototype.hasNext=function(){return this.__position<this.__tokens_length},k.prototype.next=function(){var T=null;return this.hasNext()&&(T=this.__tokens[this.__position],this.__position+=1),T},k.prototype.peek=function(T){var M=null;return T=T||0,T+=this.__position,T>=0&&T<this.__tokens_length&&(M=this.__tokens[T]),M},k.prototype.add=function(T){this.__parent_token&&(T.parent=this.__parent_token),this.__tokens.push(T),this.__tokens_length+=1},R.exports.TokenStream=k},function(R,k,T){var M=T(12).Pattern;function O(Y,H){M.call(this,Y,H),H?this._line_regexp=this._input.get_regexp(H._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}O.prototype=new M,O.prototype.__set_whitespace_patterns=function(Y,H){Y+="\\t ",H+="\\n\\r",this._match_pattern=this._input.get_regexp("["+Y+H+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+H+"]")},O.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var Y=this._input.read(this._match_pattern);if(Y===" ")this.whitespace_before_token=" ";else if(Y){var H=this.__split(this._newline_regexp,Y);this.newline_count=H.length-1,this.whitespace_before_token=H[this.newline_count]}return Y},O.prototype.matching=function(Y,H){var j=this._create();return j.__set_whitespace_patterns(Y,H),j._update(),j},O.prototype._create=function(){return new O(this._input,this)},O.prototype.__split=function(Y,H){Y.lastIndex=0;for(var j=0,U=[],$=Y.exec(H);$;)U.push(H.substring(j,$.index)),j=$.index+$[0].length,$=Y.exec(H);return j<H.length?U.push(H.substring(j,H.length)):U.push(""),U},R.exports.WhitespacePattern=O},function(R){function k(T,M){this._input=T,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,M&&(this._starting_pattern=this._input.get_regexp(M._starting_pattern,!0),this._match_pattern=this._input.get_regexp(M._match_pattern,!0),this._until_pattern=this._input.get_regexp(M._until_pattern),this._until_after=M._until_after)}k.prototype.read=function(){var T=this._input.read(this._starting_pattern);return(!this._starting_pattern||T)&&(T+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),T},k.prototype.read_match=function(){return this._input.match(this._match_pattern)},k.prototype.until_after=function(T){var M=this._create();return M._until_after=!0,M._until_pattern=this._input.get_regexp(T),M._update(),M},k.prototype.until=function(T){var M=this._create();return M._until_after=!1,M._until_pattern=this._input.get_regexp(T),M._update(),M},k.prototype.starting_with=function(T){var M=this._create();return M._starting_pattern=this._input.get_regexp(T,!0),M._update(),M},k.prototype.matching=function(T){var M=this._create();return M._match_pattern=this._input.get_regexp(T,!0),M._update(),M},k.prototype._create=function(){return new k(this._input,this)},k.prototype._update=function(){},R.exports.Pattern=k},function(R){function k(T,M){T=typeof T=="string"?T:T.source,M=typeof M=="string"?M:M.source,this.__directives_block_pattern=new RegExp(T+/ beautify( \w+[:]\w+)+ /.source+M,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(T+/\sbeautify\signore:end\s/.source+M,"g")}k.prototype.get_directives=function(T){if(!T.match(this.__directives_block_pattern))return null;var M={};this.__directive_pattern.lastIndex=0;for(var O=this.__directive_pattern.exec(T);O;)M[O[1]]=O[2],O=this.__directive_pattern.exec(T);return M},k.prototype.readIgnored=function(T){return T.readUntilAfter(this.__directives_end_ignore_pattern)},R.exports.Directives=k},function(R,k,T){var M=T(12).Pattern,O={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function Y(H,j){M.call(this,H,j),this.__template_pattern=null,this._disabled=Object.assign({},O),this._excluded=Object.assign({},O),j&&(this.__template_pattern=this._input.get_regexp(j.__template_pattern),this._excluded=Object.assign(this._excluded,j._excluded),this._disabled=Object.assign(this._disabled,j._disabled));var U=new M(H);this.__patterns={handlebars_comment:U.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:U.starting_with(/{{{/).until_after(/}}}/),handlebars:U.starting_with(/{{/).until_after(/}}/),php:U.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:U.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:U.starting_with(/{%/).until_after(/%}/),django_value:U.starting_with(/{{/).until_after(/}}/),django_comment:U.starting_with(/{#/).until_after(/#}/),smarty:U.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:U.starting_with(/{\*/).until_after(/\*}/),smarty_literal:U.starting_with(/{literal}/).until_after(/{\/literal}/)}}Y.prototype=new M,Y.prototype._create=function(){return new Y(this._input,this)},Y.prototype._update=function(){this.__set_templated_pattern()},Y.prototype.disable=function(H){var j=this._create();return j._disabled[H]=!0,j._update(),j},Y.prototype.read_options=function(H){var j=this._create();for(var U in O)j._disabled[U]=H.templating.indexOf(U)===-1;return j._update(),j},Y.prototype.exclude=function(H){var j=this._create();return j._excluded[H]=!0,j._update(),j},Y.prototype.read=function(){var H="";this._match_pattern?H=this._input.read(this._starting_pattern):H=this._input.read(this._starting_pattern,this.__template_pattern);for(var j=this._read_template();j;)this._match_pattern?j+=this._input.read(this._match_pattern):j+=this._input.readUntil(this.__template_pattern),H+=j,j=this._read_template();return this._until_after&&(H+=this._input.readUntilAfter(this._until_pattern)),H},Y.prototype.__set_templated_pattern=function(){var H=[];this._disabled.php||H.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||H.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(H.push(this.__patterns.django._starting_pattern.source),H.push(this.__patterns.django_value._starting_pattern.source),H.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||H.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&H.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+H.join("|")+")")},Y.prototype._read_template=function(){var H="",j=this._input.peek();if(j==="<"){var U=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&U==="?"&&(H=H||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&U==="%"&&(H=H||this.__patterns.erb.read())}else j==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(H=H||this.__patterns.handlebars_comment.read(),H=H||this.__patterns.handlebars_unescaped.read(),H=H||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(H=H||this.__patterns.django_value.read()),this._excluded.django||(H=H||this.__patterns.django_comment.read(),H=H||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(H=H||this.__patterns.smarty_comment.read(),H=H||this.__patterns.smarty_literal.read(),H=H||this.__patterns.smarty.read()));return H},R.exports.TemplatablePattern=Y},,,,function(R,k,T){var M=T(19).Beautifier,O=T(20).Options;function Y(H,j,U,$){var G=new M(H,j,U,$);return G.beautify()}R.exports=Y,R.exports.defaultOptions=function(){return new O}},function(R,k,T){var M=T(20).Options,O=T(2).Output,Y=T(21).Tokenizer,H=T(21).TOKEN,j=/\r\n|[\r\n]/,U=/\r\n|[\r\n]/g,$=function(te,z){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=te.max_preserve_newlines,this.preserve_newlines=te.preserve_newlines,this._output=new O(te,z)};$.prototype.current_line_has_match=function(te){return this._output.current_line.has_match(te)},$.prototype.set_space_before_token=function(te,z){this._output.space_before_token=te,this._output.non_breaking_space=z},$.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},$.prototype.add_raw_token=function(te){this._output.add_raw_token(te)},$.prototype.print_preserved_newlines=function(te){var z=0;te.type!==H.TEXT&&te.previous.type!==H.TEXT&&(z=te.newlines?1:0),this.preserve_newlines&&(z=te.newlines<this.max_preserve_newlines+1?te.newlines:this.max_preserve_newlines+1);for(var X=0;X<z;X++)this.print_newline(X>0);return z!==0},$.prototype.traverse_whitespace=function(te){return te.whitespace_before||te.newlines?(this.print_preserved_newlines(te)||(this._output.space_before_token=!0),!0):!1},$.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},$.prototype.print_newline=function(te){this._output.add_new_line(te)},$.prototype.print_token=function(te){te.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(te.text))},$.prototype.indent=function(){this.indent_level++},$.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},$.prototype.get_full_indent=function(te){return te=this.indent_level+(te||0),te<1?"":this._output.get_indent_string(te)};var G=function(te){for(var z=null,X=te.next;X.type!==H.EOF&&te.closed!==X;){if(X.type===H.ATTRIBUTE&&X.text==="type"){X.next&&X.next.type===H.EQUALS&&X.next.next&&X.next.next.type===H.VALUE&&(z=X.next.next.text);break}X=X.next}return z},fe=function(te,z){var X=null,Q=null;return z.closed?(te==="script"?X="text/javascript":te==="style"&&(X="text/css"),X=G(z)||X,X.search("text/css")>-1?Q="css":X.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?Q="javascript":X.search(/(text|application|dojo)\/(x-)?(html)/)>-1?Q="html":X.search(/test\/null/)>-1&&(Q="null"),Q):null};function be(te,z){return z.indexOf(te)!==-1}function Se(te,z,X){this.parent=te||null,this.tag=z?z.tag_name:"",this.indent_level=X||0,this.parser_token=z||null}function se(te){this._printer=te,this._current_frame=null}se.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},se.prototype.record_tag=function(te){var z=new Se(this._current_frame,te,this._printer.indent_level);this._current_frame=z},se.prototype._try_pop_frame=function(te){var z=null;return te&&(z=te.parser_token,this._printer.indent_level=te.indent_level,this._current_frame=te.parent),z},se.prototype._get_frame=function(te,z){for(var X=this._current_frame;X&&te.indexOf(X.tag)===-1;){if(z&&z.indexOf(X.tag)!==-1){X=null;break}X=X.parent}return X},se.prototype.try_pop=function(te,z){var X=this._get_frame([te],z);return this._try_pop_frame(X)},se.prototype.indent_to_tag=function(te){var z=this._get_frame(te);z&&(this._printer.indent_level=z.indent_level)};function Oe(te,z,X,Q){this._source_text=te||"",z=z||{},this._js_beautify=X,this._css_beautify=Q,this._tag_stack=null;var de=new M(z,"html");this._options=de,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,5)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,8)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}Oe.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var te=this._source_text,z=this._options.eol;this._options.eol==="auto"&&(z=`
|
|
|
`,te&&j.test(te)&&(z=te.match(j)[0])),te=te.replace(U,`
|
|
|
`);var X=te.match(/^[\t ]*/)[0],Q={text:"",type:""},de=new We(this._options),ie=new $(this._options,X),A=new Y(te,this._options).tokenize();this._tag_stack=new se(ie);for(var L=null,V=A.next();V.type!==H.EOF;)V.type===H.TAG_OPEN||V.type===H.COMMENT?(L=this._handle_tag_open(ie,V,de,Q,A),de=L):V.type===H.ATTRIBUTE||V.type===H.EQUALS||V.type===H.VALUE||V.type===H.TEXT&&!de.tag_complete?L=this._handle_inside_tag(ie,V,de,Q):V.type===H.TAG_CLOSE?L=this._handle_tag_close(ie,V,de):V.type===H.TEXT?L=this._handle_text(ie,V,de):V.type===H.CONTROL_FLOW_OPEN?L=this._handle_control_flow_open(ie,V):V.type===H.CONTROL_FLOW_CLOSE?L=this._handle_control_flow_close(ie,V):ie.add_raw_token(V),Q=L,V=A.next();var pe=ie._output.get_code(z);return pe},Oe.prototype._handle_control_flow_open=function(te,z){var X={text:z.text,type:z.type};return te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),z.newlines?te.print_preserved_newlines(z):te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),te.print_token(z),te.indent(),X},Oe.prototype._handle_control_flow_close=function(te,z){var X={text:z.text,type:z.type};return te.deindent(),z.newlines?te.print_preserved_newlines(z):te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),te.print_token(z),X},Oe.prototype._handle_tag_close=function(te,z,X){var Q={text:z.text,type:z.type};return te.alignment_size=0,X.tag_complete=!0,te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),X.is_unformatted?te.add_raw_token(z):(X.tag_start_char==="<"&&(te.set_space_before_token(z.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&X.has_wrapped_attrs&&te.print_newline(!1)),te.print_token(z)),X.indent_content&&!(X.is_unformatted||X.is_content_unformatted)&&(te.indent(),X.indent_content=!1),!X.is_inline_element&&!(X.is_unformatted||X.is_content_unformatted)&&te.set_wrap_point(),Q},Oe.prototype._handle_inside_tag=function(te,z,X,Q){var de=X.has_wrapped_attrs,ie={text:z.text,type:z.type};return te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),X.is_unformatted?te.add_raw_token(z):X.tag_start_char==="{"&&z.type===H.TEXT?te.print_preserved_newlines(z)?(z.newlines=0,te.add_raw_token(z)):te.print_token(z):(z.type===H.ATTRIBUTE?te.set_space_before_token(!0):(z.type===H.EQUALS||z.type===H.VALUE&&z.previous.type===H.EQUALS)&&te.set_space_before_token(!1),z.type===H.ATTRIBUTE&&X.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(te.traverse_whitespace(z),de=de||z.newlines!==0),this._is_wrap_attributes_force&&X.attr_count>=this._options.wrap_attributes_min_attrs&&(Q.type!==H.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(te.print_newline(!1),de=!0)),te.print_token(z),de=de||te.previous_token_wrapped(),X.has_wrapped_attrs=de),ie},Oe.prototype._handle_text=function(te,z,X){var Q={text:z.text,type:"TK_CONTENT"};return X.custom_beautifier_name?this._print_custom_beatifier_text(te,z,X):X.is_unformatted||X.is_content_unformatted?te.add_raw_token(z):(te.traverse_whitespace(z),te.print_token(z)),Q},Oe.prototype._print_custom_beatifier_text=function(te,z,X){var Q=this;if(z.text!==""){var de=z.text,ie,A=1,L="",V="";X.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?ie=this._js_beautify:X.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?ie=this._css_beautify:X.custom_beautifier_name==="html"&&(ie=function(Ht,Dt){var ft=new Oe(Ht,Dt,Q._js_beautify,Q._css_beautify);return ft.beautify()}),this._options.indent_scripts==="keep"?A=0:this._options.indent_scripts==="separate"&&(A=-te.indent_level);var pe=te.get_full_indent(A);if(de=de.replace(/\n[ \t]*$/,""),X.custom_beautifier_name!=="html"&&de[0]==="<"&&de.match(/^(<!--|<!\[CDATA\[)/)){var ze=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(de);if(!ze){te.add_raw_token(z);return}L=pe+ze[1]+`
|
|
|
`,de=ze[4],ze[5]&&(V=pe+ze[5]),de=de.replace(/\n[ \t]*$/,""),(ze[2]||ze[3].indexOf(`
|
|
|
`)!==-1)&&(ze=ze[3].match(/[ \t]+$/),ze&&(z.whitespace_before=ze[0]))}if(de)if(ie){var at=function(){this.eol=`
|
|
|
`};at.prototype=this._options.raw_options;var Bt=new at;de=ie(pe+de,Bt)}else{var Me=z.whitespace_before;Me&&(de=de.replace(new RegExp(`
|
|
|
(`+Me+")?","g"),`
|
|
|
`)),de=pe+de.replace(/\n/g,`
|
|
|
`+pe)}L&&(de?de=L+de+`
|
|
|
`+V:de=L+V),te.print_newline(!1),de&&(z.text=de,z.whitespace_before="",z.newlines=0,te.add_raw_token(z),te.print_newline(!0))}},Oe.prototype._handle_tag_open=function(te,z,X,Q,de){var ie=this._get_tag_open_token(z);if((X.is_unformatted||X.is_content_unformatted)&&!X.is_empty_element&&z.type===H.TAG_OPEN&&!ie.is_start_tag?(te.add_raw_token(z),ie.start_tag_token=this._tag_stack.try_pop(ie.tag_name)):(te.traverse_whitespace(z),this._set_tag_position(te,z,ie,X,Q),ie.is_inline_element||te.set_wrap_point(),te.print_token(z)),ie.is_start_tag&&this._is_wrap_attributes_force){var A=0,L;do L=de.peek(A),L.type===H.ATTRIBUTE&&(ie.attr_count+=1),A+=1;while(L.type!==H.EOF&&L.type!==H.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(ie.alignment_size=z.text.length+1),!ie.tag_complete&&!ie.is_unformatted&&(te.alignment_size=ie.alignment_size),ie};var We=function(te,z,X){if(this.parent=z||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="",!X)this.tag_complete=!0;else{var Q;this.tag_start_char=X.text[0],this.text=X.text,this.tag_start_char==="<"?(Q=X.text.match(/^<([^\s>]*)/),this.tag_check=Q?Q[1]:""):(Q=X.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=Q?Q[1]:"",(X.text.startsWith("{{#>")||X.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&X.next!==null?this.tag_check=X.next.text.split(" ")[0]:this.tag_check=X.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),X.type===H.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||X.closed&&X.closed.text==="/>";var de=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(de=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!te.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(de)))}};Oe.prototype._get_tag_open_token=function(te){var z=new We(this._options,this._tag_stack.get_parser_token(),te);return z.alignment_size=this._options.wrap_attributes_indent_size,z.is_end_tag=z.is_end_tag||be(z.tag_check,this._options.void_elements),z.is_empty_element=z.tag_complete||z.is_start_tag&&z.is_end_tag,z.is_unformatted=!z.tag_complete&&be(z.tag_check,this._options.unformatted),z.is_content_unformatted=!z.is_empty_element&&be(z.tag_check,this._options.content_unformatted),z.is_inline_element=be(z.tag_name,this._options.inline)||this._options.inline_custom_elements&&z.tag_name.includes("-")||z.tag_start_char==="{",z},Oe.prototype._set_tag_position=function(te,z,X,Q,de){if(X.is_empty_element||(X.is_end_tag?X.start_tag_token=this._tag_stack.try_pop(X.tag_name):(this._do_optional_end_element(X)&&(X.is_inline_element||te.print_newline(!1)),this._tag_stack.record_tag(X),(X.tag_name==="script"||X.tag_name==="style")&&!(X.is_unformatted||X.is_content_unformatted)&&(X.custom_beautifier_name=fe(X.tag_check,z)))),be(X.tag_check,this._options.extra_liners)&&(te.print_newline(!1),te._output.just_added_blankline()||te.print_newline(!0)),X.is_empty_element){if(X.tag_start_char==="{"&&X.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),X.indent_content=!0;var ie=te.current_line_has_match(/{{#if/);ie||te.print_newline(!1)}X.tag_name==="!--"&&de.type===H.TAG_CLOSE&&Q.is_end_tag&&X.text.indexOf(`
|
|
|
`)===-1||(X.is_inline_element||X.is_unformatted||te.print_newline(!1),this._calcluate_parent_multiline(te,X))}else if(X.is_end_tag){var A=!1;A=X.start_tag_token&&X.start_tag_token.multiline_content,A=A||!X.is_inline_element&&!(Q.is_inline_element||Q.is_unformatted)&&!(de.type===H.TAG_CLOSE&&X.start_tag_token===Q)&&de.type!=="TK_CONTENT",(X.is_content_unformatted||X.is_unformatted)&&(A=!1),A&&te.print_newline(!1)}else X.indent_content=!X.custom_beautifier_name,X.tag_start_char==="<"&&(X.tag_name==="html"?X.indent_content=this._options.indent_inner_html:X.tag_name==="head"?X.indent_content=this._options.indent_head_inner_html:X.tag_name==="body"&&(X.indent_content=this._options.indent_body_inner_html)),!(X.is_inline_element||X.is_unformatted)&&(de.type!=="TK_CONTENT"||X.is_content_unformatted)&&te.print_newline(!1),this._calcluate_parent_multiline(te,X)},Oe.prototype._calcluate_parent_multiline=function(te,z){z.parent&&te._output.just_added_newline()&&!((z.is_inline_element||z.is_unformatted)&&z.parent.is_inline_element)&&(z.parent.multiline_content=!0)};var Be=["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"],At=["a","audio","del","ins","map","noscript","video"];Oe.prototype._do_optional_end_element=function(te){var z=null;if(!(te.is_empty_element||!te.is_start_tag||!te.parent)){if(te.tag_name==="body")z=z||this._tag_stack.try_pop("head");else if(te.tag_name==="li")z=z||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(te.tag_name==="dd"||te.tag_name==="dt")z=z||this._tag_stack.try_pop("dt",["dl"]),z=z||this._tag_stack.try_pop("dd",["dl"]);else if(te.parent.tag_name==="p"&&Be.indexOf(te.tag_name)!==-1){var X=te.parent.parent;(!X||At.indexOf(X.tag_name)===-1)&&(z=z||this._tag_stack.try_pop("p"))}else te.tag_name==="rp"||te.tag_name==="rt"?(z=z||this._tag_stack.try_pop("rt",["ruby","rtc"]),z=z||this._tag_stack.try_pop("rp",["ruby","rtc"])):te.tag_name==="optgroup"?z=z||this._tag_stack.try_pop("optgroup",["select"]):te.tag_name==="option"?z=z||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):te.tag_name==="colgroup"?z=z||this._tag_stack.try_pop("caption",["table"]):te.tag_name==="thead"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"])):te.tag_name==="tbody"||te.tag_name==="tfoot"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"]),z=z||this._tag_stack.try_pop("thead",["table"]),z=z||this._tag_stack.try_pop("tbody",["table"])):te.tag_name==="tr"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"]),z=z||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(te.tag_name==="th"||te.tag_name==="td")&&(z=z||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),z=z||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return te.parent=this._tag_stack.get_parser_token(),z}},R.exports.Beautifier=Oe},function(R,k,T){var M=T(6).Options;function O(Y){M.call(this,Y,"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"])}O.prototype=new M,R.exports.Options=O},function(R,k,T){var M=T(9).Tokenizer,O=T(9).TOKEN,Y=T(13).Directives,H=T(14).TemplatablePattern,j=T(12).Pattern,U={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:O.START,RAW:O.RAW,EOF:O.EOF},$=new Y(/<\!--/,/-->/),G=function(fe,be){M.call(this,fe,be),this._current_tag_name="";var Se=new H(this._input).read_options(this._options),se=new j(this._input);if(this.__patterns={word:Se.until(/[\n\r\t <]/),word_control_flow_close_excluded:Se.until(/[\n\r\t <}]/),single_quote:Se.until_after(/'/),double_quote:Se.until_after(/"/),attribute:Se.until(/[\n\r\t =>]|\/>/),element_name:Se.until(/[\n\r\t >\/]/),angular_control_flow_start:se.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:se.starting_with(/{{!--/).until_after(/--}}/),handlebars:se.starting_with(/{{/).until_after(/}}/),handlebars_open:se.until(/[\n\r\t }]/),handlebars_raw_close:se.until(/}}/),comment:se.starting_with(/<!--/).until_after(/-->/),cdata:se.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:se.starting_with(/<!\[/).until_after(/]>/),processing:se.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars"),this.__patterns.word_control_flow_close_excluded=this.__patterns.word_control_flow_close_excluded.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var Oe=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=se.matching(Oe).until_after(Oe)}};G.prototype=new M,G.prototype._is_comment=function(fe){return!1},G.prototype._is_opening=function(fe){return fe.type===U.TAG_OPEN||fe.type===U.CONTROL_FLOW_OPEN},G.prototype._is_closing=function(fe,be){return fe.type===U.TAG_CLOSE&&be&&((fe.text===">"||fe.text==="/>")&&be.text[0]==="<"||fe.text==="}}"&&be.text[0]==="{"&&be.text[1]==="{")||fe.type===U.CONTROL_FLOW_CLOSE&&fe.text==="}"&&be.text.endsWith("{")},G.prototype._reset=function(){this._current_tag_name=""},G.prototype._get_next_token=function(fe,be){var Se=null;this._readWhitespace();var se=this._input.peek();return se===null?this._create_token(U.EOF,""):(Se=Se||this._read_open_handlebars(se,be),Se=Se||this._read_attribute(se,fe,be),Se=Se||this._read_close(se,be),Se=Se||this._read_script_and_style(se,fe),Se=Se||this._read_control_flows(se,be),Se=Se||this._read_raw_content(se,fe,be),Se=Se||this._read_content_word(se,be),Se=Se||this._read_comment_or_cdata(se),Se=Se||this._read_processing(se),Se=Se||this._read_open(se,be),Se=Se||this._create_token(U.UNKNOWN,this._input.next()),Se)},G.prototype._read_comment_or_cdata=function(fe){var be=null,Se=null,se=null;if(fe==="<"){var Oe=this._input.peek(1);Oe==="!"&&(Se=this.__patterns.comment.read(),Se?(se=$.get_directives(Se),se&&se.ignore==="start"&&(Se+=$.readIgnored(this._input))):Se=this.__patterns.cdata.read()),Se&&(be=this._create_token(U.COMMENT,Se),be.directives=se)}return be},G.prototype._read_processing=function(fe){var be=null,Se=null,se=null;if(fe==="<"){var Oe=this._input.peek(1);(Oe==="!"||Oe==="?")&&(Se=this.__patterns.conditional_comment.read(),Se=Se||this.__patterns.processing.read()),Se&&(be=this._create_token(U.COMMENT,Se),be.directives=se)}return be},G.prototype._read_open=function(fe,be){var Se=null,se=null;return(!be||be.type===U.CONTROL_FLOW_OPEN)&&fe==="<"&&(Se=this._input.next(),this._input.peek()==="/"&&(Se+=this._input.next()),Se+=this.__patterns.element_name.read(),se=this._create_token(U.TAG_OPEN,Se)),se},G.prototype._read_open_handlebars=function(fe,be){var Se=null,se=null;return(!be||be.type===U.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&fe==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(Se=this.__patterns.handlebars_comment.read(),Se=Se||this.__patterns.handlebars.read(),se=this._create_token(U.COMMENT,Se)):(Se=this.__patterns.handlebars_open.read(),se=this._create_token(U.TAG_OPEN,Se))),se},G.prototype._read_control_flows=function(fe,be){var Se="",se=null;if(!this._options.templating.includes("angular"))return se;if(fe==="@"){if(Se=this.__patterns.angular_control_flow_start.read(),Se==="")return se;for(var Oe=Se.endsWith("(")?1:0,We=0;!(Se.endsWith("{")&&Oe===We);){var Be=this._input.next();if(Be===null)break;Be==="("?Oe++:Be===")"&&We++,Se+=Be}se=this._create_token(U.CONTROL_FLOW_OPEN,Se)}else fe==="}"&&be&&be.type===U.CONTROL_FLOW_OPEN&&(Se=this._input.next(),se=this._create_token(U.CONTROL_FLOW_CLOSE,Se));return se},G.prototype._read_close=function(fe,be){var Se=null,se=null;return be&&be.type===U.TAG_OPEN&&(be.text[0]==="<"&&(fe===">"||fe==="/"&&this._input.peek(1)===">")?(Se=this._input.next(),fe==="/"&&(Se+=this._input.next()),se=this._create_token(U.TAG_CLOSE,Se)):be.text[0]==="{"&&fe==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),se=this._create_token(U.TAG_CLOSE,"}}"))),se},G.prototype._read_attribute=function(fe,be,Se){var se=null,Oe="";if(Se&&Se.text[0]==="<")if(fe==="=")se=this._create_token(U.EQUALS,this._input.next());else if(fe==='"'||fe==="'"){var We=this._input.next();fe==='"'?We+=this.__patterns.double_quote.read():We+=this.__patterns.single_quote.read(),se=this._create_token(U.VALUE,We)}else Oe=this.__patterns.attribute.read(),Oe&&(be.type===U.EQUALS?se=this._create_token(U.VALUE,Oe):se=this._create_token(U.ATTRIBUTE,Oe));return se},G.prototype._is_content_unformatted=function(fe){return this._options.void_elements.indexOf(fe)===-1&&(this._options.content_unformatted.indexOf(fe)!==-1||this._options.unformatted.indexOf(fe)!==-1)},G.prototype._read_raw_content=function(fe,be,Se){var se="";if(Se&&Se.text[0]==="{")se=this.__patterns.handlebars_raw_close.read();else if(be.type===U.TAG_CLOSE&&be.opened.text[0]==="<"&&be.text[0]!=="/"){var Oe=be.opened.text.substr(1).toLowerCase();this._is_content_unformatted(Oe)&&(se=this._input.readUntil(new RegExp("</"+Oe+"[\\n\\r\\t ]*?>","ig")))}return se?this._create_token(U.TEXT,se):null},G.prototype._read_script_and_style=function(fe,be){if(be.type===U.TAG_CLOSE&&be.opened.text[0]==="<"&&be.text[0]!=="/"){var Se=be.opened.text.substr(1).toLowerCase();if(Se==="script"||Se==="style"){var se=this._read_comment_or_cdata(fe);if(se)return se.type=U.TEXT,se;var Oe=this._input.readUntil(new RegExp("</"+Se+"[\\n\\r\\t ]*?>","ig"));if(Oe)return this._create_token(U.TEXT,Oe)}}return null},G.prototype._read_content_word=function(fe,be){var Se="";return this._options.unformatted_content_delimiter&&fe===this._options.unformatted_content_delimiter[0]&&(Se=this.__patterns.unformatted_content_delimiter.read()),Se||(Se=be&&be.type===U.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),Se?this._create_token(U.TEXT,Se):null},R.exports.Tokenizer=G,R.exports.TOKEN=U}],P={};function f(R){var k=P[R];if(k!==void 0)return k.exports;var T=P[R]={exports:{}};return Te[R](T,T.exports,f),T.exports}var re=f(18);Ze=re})();var ge=Ze;if(1)ce=[oe,oe(58553),oe(87804)],De=function(Te){var P=oe(58553),f=oe(87804);return{html_beautify:function(re,R){return ge(re,R,P.js_beautify,f.css_beautify)}}}.apply(It,ce),De!==void 0&&(Li.exports=De);else var q,S})()},58553:function(Li,It){var oe,ce;(function(){var De;(function(){"use strict";var ge=[function(P,f,re){var R=re(1).Beautifier,k=re(5).Options;function T(M,O){var Y=new R(M,O);return Y.beautify()}P.exports=T,P.exports.defaultOptions=function(){return new k}},function(P,f,re){var R=re(2).Output,k=re(3).Token,T=re(4),M=re(5).Options,O=re(7).Tokenizer,Y=re(7).line_starters,H=re(7).positionable_operators,j=re(7).TOKEN;function U(L,V){return V.indexOf(L)!==-1}function $(L){return L.replace(/^\s+/g,"")}function G(L){for(var V={},pe=0;pe<L.length;pe++)V[L[pe].replace(/-/g,"_")]=L[pe];return V}function fe(L,V){return L&&L.type===j.RESERVED&&L.text===V}function be(L,V){return L&&L.type===j.RESERVED&&U(L.text,V)}var Se=["case","return","do","if","throw","else","await","break","continue","async"],se=["before-newline","after-newline","preserve-newline"],Oe=G(se),We=[Oe.before_newline,Oe.preserve_newline],Be={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function At(L,V){V.multiline_frame||V.mode===Be.ForInitializer||V.mode===Be.Conditional||L.remove_indent(V.start_line_index)}function te(L){L=L.replace(T.allLineBreaks,`
|
|
|
`);for(var V=[],pe=L.indexOf(`
|
|
|
`);pe!==-1;)V.push(L.substring(0,pe)),L=L.substring(pe+1),pe=L.indexOf(`
|
|
|
`);return L.length&&V.push(L),V}function z(L){return L===Be.ArrayLiteral}function X(L){return U(L,[Be.Expression,Be.ForInitializer,Be.Conditional])}function Q(L,V){for(var pe=0;pe<L.length;pe++){var ze=L[pe].trim();if(ze.charAt(0)!==V)return!1}return!0}function de(L,V){for(var pe=0,ze=L.length,at;pe<ze;pe++)if(at=L[pe],at&&at.indexOf(V)!==0)return!1;return!0}function ie(L,V){V=V||{},this._source_text=L||"",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 M(V)}ie.prototype.create_flags=function(L,V){var pe=0;L&&(pe=L.indentation_level,!this._output.just_added_newline()&&L.line_indent_level>pe&&(pe=L.line_indent_level));var ze={mode:V,parent:L,last_token:L?L.last_token:new k(j.START_BLOCK,""),last_word:L?L.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:pe,alignment:0,line_indent_level:L?L.line_indent_level:pe,start_line_index:this._output.get_line_number(),ternary_depth:0};return ze},ie.prototype._reset=function(L){var V=L.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new R(this._options,V),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Be.BlockStatement);var pe=new O(L,this._options);return this._tokens=pe.tokenize(),L},ie.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var L,V=this._reset(this._source_text),pe=this._options.eol;this._options.eol==="auto"&&(pe=`
|
|
|
`,V&&T.lineBreak.test(V||"")&&(pe=V.match(T.lineBreak)[0]));for(var ze=this._tokens.next();ze;)this.handle_token(ze),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ze,ze=this._tokens.next();return L=this._output.get_code(pe),L},ie.prototype.handle_token=function(L,V){L.type===j.START_EXPR?this.handle_start_expr(L):L.type===j.END_EXPR?this.handle_end_expr(L):L.type===j.START_BLOCK?this.handle_start_block(L):L.type===j.END_BLOCK?this.handle_end_block(L):L.type===j.WORD?this.handle_word(L):L.type===j.RESERVED?this.handle_word(L):L.type===j.SEMICOLON?this.handle_semicolon(L):L.type===j.STRING?this.handle_string(L):L.type===j.EQUALS?this.handle_equals(L):L.type===j.OPERATOR?this.handle_operator(L):L.type===j.COMMA?this.handle_comma(L):L.type===j.BLOCK_COMMENT?this.handle_block_comment(L,V):L.type===j.COMMENT?this.handle_comment(L,V):L.type===j.DOT?this.handle_dot(L):L.type===j.EOF?this.handle_eof(L):L.type===j.UNKNOWN?this.handle_unknown(L,V):this.handle_unknown(L,V)},ie.prototype.handle_whitespace_and_comments=function(L,V){var pe=L.newlines,ze=this._options.keep_array_indentation&&z(this._flags.mode);if(L.comments_before)for(var at=L.comments_before.next();at;)this.handle_whitespace_and_comments(at,V),this.handle_token(at,V),at=L.comments_before.next();if(ze)for(var Bt=0;Bt<pe;Bt+=1)this.print_newline(Bt>0,V);else if(this._options.max_preserve_newlines&&pe>this._options.max_preserve_newlines&&(pe=this._options.max_preserve_newlines),this._options.preserve_newlines&&pe>1){this.print_newline(!1,V);for(var Me=1;Me<pe;Me+=1)this.print_newline(!0,V)}};var A=["async","break","continue","return","throw","yield"];ie.prototype.allow_wrap_or_preserved_newline=function(L,V){if(V=V===void 0?!1:V,!this._output.just_added_newline()){var pe=this._options.preserve_newlines&&L.newlines||V,ze=U(this._flags.last_token.text,H)||U(L.text,H);if(ze){var at=U(this._flags.last_token.text,H)&&U(this._options.operator_position,We)||U(L.text,H);pe=pe&&at}if(pe)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(be(this._flags.last_token,A))return;this._output.set_wrap_point()}}},ie.prototype.print_newline=function(L,V){if(!V&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==j.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var pe=this._tokens.peek();this._flags.mode===Be.Statement&&!(this._flags.if_block&&fe(pe,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(L)&&(this._flags.multiline_frame=!0)},ie.prototype.print_token_line_indentation=function(L){this._output.just_added_newline()&&(this._options.keep_array_indentation&&L.newlines&&(L.text==="["||z(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(L.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))},ie.prototype.print_token=function(L){if(this._output.raw){this._output.add_raw_token(L);return}if(this._options.comma_first&&L.previous&&L.previous.type===j.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var V=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(V),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(L),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(L),this._output.non_breaking_space=!0,this._output.add_token(L.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},ie.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ie.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))},ie.prototype.set_mode=function(L){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,L),this._flags=this.create_flags(this._previous_flags,L),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ie.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Be.Statement&&At(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},ie.prototype.start_of_object_property=function(){return this._flags.parent.mode===Be.ObjectLiteral&&this._flags.mode===Be.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||be(this._flags.last_token,["get","set"]))},ie.prototype.start_of_statement=function(L){var V=!1;return V=V||be(this._flags.last_token,["var","let","const"])&&L.type===j.WORD,V=V||fe(this._flags.last_token,"do"),V=V||!(this._flags.parent.mode===Be.ObjectLiteral&&this._flags.mode===Be.Statement)&&be(this._flags.last_token,A)&&!L.newlines,V=V||fe(this._flags.last_token,"else")&&!(fe(L,"if")&&!L.comments_before),V=V||this._flags.last_token.type===j.END_EXPR&&(this._previous_flags.mode===Be.ForInitializer||this._previous_flags.mode===Be.Conditional),V=V||this._flags.last_token.type===j.WORD&&this._flags.mode===Be.BlockStatement&&!this._flags.in_case&&!(L.text==="--"||L.text==="++")&&this._last_last_text!=="function"&&L.type!==j.WORD&&L.type!==j.RESERVED,V=V||this._flags.mode===Be.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||be(this._flags.last_token,["get","set"])),V?(this.set_mode(Be.Statement),this.indent(),this.handle_whitespace_and_comments(L,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L,be(L,["do","for","if","while"])),!0):!1},ie.prototype.handle_start_expr=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L);var V=Be.Expression;if(L.text==="["){if(this._flags.last_token.type===j.WORD||this._flags.last_token.text===")"){be(this._flags.last_token,Y)&&(this._output.space_before_token=!0),this.print_token(L),this.set_mode(V),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}V=Be.ArrayLiteral,z(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()),U(this._flags.last_token.type,[j.START_EXPR,j.END_EXPR,j.WORD,j.OPERATOR,j.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===j.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,V=Be.ForInitializer):U(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,V=Be.Conditional):U(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&L.whitespace_before===""?this._output.space_before_token=!1:(U(this._flags.last_token.text,Y)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===j.EQUALS||this._flags.last_token.type===j.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L);else if(this._flags.last_token.type===j.WORD){this._output.space_before_token=!1;var pe=this._tokens.peek(-3);if(this._options.space_after_named_function&&pe){var ze=this._tokens.peek(-4);be(pe,["async","function"])||pe.text==="*"&&be(ze,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Be.ObjectLiteral?(pe.text==="{"||pe.text===","||pe.text==="*"&&(ze.text==="{"||ze.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(L);(this._flags.last_token.type===j.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(U(this._last_last_text,["function","yield"])||this._flags.mode===Be.ObjectLiteral&&U(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===j.START_BLOCK?this.print_newline():(this._flags.last_token.type===j.END_EXPR||this._flags.last_token.type===j.START_EXPR||this._flags.last_token.type===j.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===j.COMMA)&&this.allow_wrap_or_preserved_newline(L,L.newlines),this.print_token(L),this.set_mode(V),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},ie.prototype.handle_end_expr=function(L){for(;this._flags.mode===Be.Statement;)this.restore_mode();this.handle_whitespace_and_comments(L),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(L,L.text==="]"&&z(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===j.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(L),this.restore_mode(),At(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Be.Conditional&&(this._previous_flags.mode=Be.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},ie.prototype.handle_start_block=function(L){this.handle_whitespace_and_comments(L);var V=this._tokens.peek(),pe=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===j.END_EXPR?(this.set_mode(Be.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Be.BlockStatement):pe&&(U(pe.text,[":",","])&&U(V.type,[j.STRING,j.WORD,j.RESERVED])||U(V.text,["get","set","..."])&&U(pe.type,[j.WORD,j.RESERVED]))?U(this._last_last_text,["class","interface"])&&!U(pe.text,[":",","])?this.set_mode(Be.BlockStatement):this.set_mode(Be.ObjectLiteral):this._flags.last_token.type===j.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(Be.BlockStatement):U(this._flags.last_token.type,[j.EQUALS,j.START_EXPR,j.COMMA,j.OPERATOR])||be(this._flags.last_token,["return","throw","import","default"])?this.set_mode(Be.ObjectLiteral):this.set_mode(Be.BlockStatement),this._flags.last_token&&be(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var ze=!V.comments_before&&V.text==="}",at=ze&&this._flags.last_word==="function"&&this._flags.last_token.type===j.END_EXPR;if(this._options.brace_preserve_inline){var Bt=0,Me=null;this._flags.inline_frame=!0;do if(Bt+=1,Me=this._tokens.peek(Bt-1),Me.newlines){this._flags.inline_frame=!1;break}while(Me.type!==j.EOF&&!(Me.type===j.END_BLOCK&&Me.opened===L))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&L.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==j.OPERATOR&&(at||this._flags.last_token.type===j.EQUALS||be(this._flags.last_token,Se)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(z(this._previous_flags.mode)&&(this._flags.last_token.type===j.START_EXPR||this._flags.last_token.type===j.COMMA)&&((this._flags.last_token.type===j.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===j.COMMA||this._flags.last_token.type===j.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(L),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==j.OPERATOR&&this._flags.last_token.type!==j.START_EXPR&&(U(this._flags.last_token.type,[j.START_BLOCK,j.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(L),this.indent(),!ze&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},ie.prototype.handle_end_block=function(L){for(this.handle_whitespace_and_comments(L);this._flags.mode===Be.Statement;)this.restore_mode();var V=this._flags.last_token.type===j.START_BLOCK;this._flags.inline_frame&&!V?this._output.space_before_token=!0:this._options.brace_style==="expand"?V||this.print_newline():V||(z(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(L)},ie.prototype.handle_word=function(L){if(L.type===j.RESERVED){if(U(L.text,["set","get"])&&this._flags.mode!==Be.ObjectLiteral)L.type=j.WORD;else if(L.text==="import"&&U(this._tokens.peek().text,["(","."]))L.type=j.WORD;else if(U(L.text,["as","from"])&&!this._flags.import_block)L.type=j.WORD;else if(this._flags.mode===Be.ObjectLiteral){var V=this._tokens.peek();V.text===":"&&(L.type=j.WORD)}}if(this.start_of_statement(L)?be(this._flags.last_token,["var","let","const"])&&L.type===j.WORD&&(this._flags.declaration_statement=!0):L.newlines&&!X(this._flags.mode)&&(this._flags.last_token.type!==j.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==j.EQUALS&&(this._options.preserve_newlines||!be(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(L),this.print_newline()):this.handle_whitespace_and_comments(L),this._flags.do_block&&!this._flags.do_while)if(fe(L,"while")){this._output.space_before_token=!0,this.print_token(L),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&&fe(L,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===Be.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&be(L,["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(L),this._flags.in_case=!0;return}if((this._flags.last_token.type===j.COMMA||this._flags.last_token.type===j.START_EXPR||this._flags.last_token.type===j.EQUALS||this._flags.last_token.type===j.OPERATOR)&&!this.start_of_object_property()&&!(U(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===Be.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(L),fe(L,"function")){(U(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(U(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===j.OPERATOR))&&!this._output.just_added_blankline()&&!L.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===j.RESERVED||this._flags.last_token.type===j.WORD?be(this._flags.last_token,["get","set","new","export"])||be(this._flags.last_token,A)?this._output.space_before_token=!0:fe(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===j.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(X(this._flags.mode)||z(this._flags.mode))||this.print_newline(),this.print_token(L),this._flags.last_word=L.text;return}var pe="NONE";if(this._flags.last_token.type===j.END_BLOCK?this._previous_flags.inline_frame?pe="SPACE":be(L,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&L.newlines?pe="NEWLINE":(pe="SPACE",this._output.space_before_token=!0):pe="NEWLINE":this._flags.last_token.type===j.SEMICOLON&&this._flags.mode===Be.BlockStatement?pe="NEWLINE":this._flags.last_token.type===j.SEMICOLON&&X(this._flags.mode)?pe="SPACE":this._flags.last_token.type===j.STRING?pe="NEWLINE":this._flags.last_token.type===j.RESERVED||this._flags.last_token.type===j.WORD||this._flags.last_token.text==="*"&&(U(this._last_last_text,["function","yield"])||this._flags.mode===Be.ObjectLiteral&&U(this._last_last_text,["{",","]))?pe="SPACE":this._flags.last_token.type===j.START_BLOCK?this._flags.inline_frame?pe="SPACE":pe="NEWLINE":this._flags.last_token.type===j.END_EXPR&&(this._output.space_before_token=!0,pe="NEWLINE"),be(L,Y)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?pe="SPACE":pe="NEWLINE"),be(L,["else","catch","finally"]))if((!(this._flags.last_token.type===j.END_BLOCK&&this._previous_flags.mode===Be.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&L.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ze=this._output.current_line;ze.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else pe==="NEWLINE"?be(this._flags.last_token,Se)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&be(L,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==j.END_EXPR?(this._flags.last_token.type!==j.START_EXPR||!be(L,["var","let","const"]))&&this._flags.last_token.text!==":"&&(fe(L,"if")&&fe(L.previous,"else")?this._output.space_before_token=!0:this.print_newline()):be(L,Y)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&z(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():pe==="SPACE"&&(this._output.space_before_token=!0);L.previous&&(L.previous.type===j.WORD||L.previous.type===j.RESERVED)&&(this._output.space_before_token=!0),this.print_token(L),this._flags.last_word=L.text,L.type===j.RESERVED&&(L.text==="do"?this._flags.do_block=!0:L.text==="if"?this._flags.if_block=!0:L.text==="import"?this._flags.import_block=!0:this._flags.import_block&&fe(L,"from")&&(this._flags.import_block=!1))},ie.prototype.handle_semicolon=function(L){this.start_of_statement(L)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(L);for(var V=this._tokens.peek();this._flags.mode===Be.Statement&&!(this._flags.if_block&&fe(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(L)},ie.prototype.handle_string=function(L){L.text.startsWith("`")&&L.newlines===0&&L.whitespace_before===""&&(L.previous.text===")"||this._flags.last_token.type===j.WORD)||(this.start_of_statement(L)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(L),this._flags.last_token.type===j.RESERVED||this._flags.last_token.type===j.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===j.COMMA||this._flags.last_token.type===j.START_EXPR||this._flags.last_token.type===j.EQUALS||this._flags.last_token.type===j.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L):L.text.startsWith("`")&&this._flags.last_token.type===j.END_EXPR&&(L.previous.text==="]"||L.previous.text===")")&&L.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(L)},ie.prototype.handle_equals=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0},ie.prototype.handle_comma=function(L){this.handle_whitespace_and_comments(L,!0),this.print_token(L),this._output.space_before_token=!0,this._flags.declaration_statement?(X(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(L)):this._flags.mode===Be.ObjectLiteral||this._flags.mode===Be.Statement&&this._flags.parent.mode===Be.ObjectLiteral?(this._flags.mode===Be.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(L)},ie.prototype.handle_operator=function(L){var V=L.text==="*"&&(be(this._flags.last_token,["function","yield"])||U(this._flags.last_token.type,[j.START_BLOCK,j.COMMA,j.END_BLOCK,j.SEMICOLON])),pe=U(L.text,["-","+"])&&(U(this._flags.last_token.type,[j.START_BLOCK,j.START_EXPR,j.EQUALS,j.OPERATOR])||U(this._flags.last_token.text,Y)||this._flags.last_token.text===",");if(!this.start_of_statement(L)){var ze=!V;this.handle_whitespace_and_comments(L,ze)}if(L.text==="*"&&this._flags.last_token.type===j.DOT){this.print_token(L);return}if(L.text==="::"){this.print_token(L);return}if(U(L.text,["-","+"])&&this.start_of_object_property()){this.print_token(L);return}if(this._flags.last_token.type===j.OPERATOR&&U(this._options.operator_position,We)&&this.allow_wrap_or_preserved_newline(L),L.text===":"&&this._flags.in_case){this.print_token(L),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==j.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 at=!0,Bt=!0,Me=!1;if(L.text===":"?this._flags.ternary_depth===0?at=!1:(this._flags.ternary_depth-=1,Me=!0):L.text==="?"&&(this._flags.ternary_depth+=1),!pe&&!V&&this._options.preserve_newlines&&U(L.text,H)){var Ht=L.text===":",Dt=Ht&&Me,ft=Ht&&!Me;switch(this._options.operator_position){case Oe.before_newline:this._output.space_before_token=!ft,this.print_token(L),(!Ht||Dt)&&this.allow_wrap_or_preserved_newline(L),this._output.space_before_token=!0;return;case Oe.after_newline:this._output.space_before_token=!0,!Ht||Dt?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(L):this._output.space_before_token=!1,this.print_token(L),this._output.space_before_token=!0;return;case Oe.preserve_newline:ft||this.allow_wrap_or_preserved_newline(L),at=!(this._output.just_added_newline()||ft),this._output.space_before_token=at,this.print_token(L),this._output.space_before_token=!0;return}}if(V){this.allow_wrap_or_preserved_newline(L),at=!1;var Si=this._tokens.peek();Bt=Si&&U(Si.type,[j.WORD,j.RESERVED])}else if(L.text==="...")this.allow_wrap_or_preserved_newline(L),at=this._flags.last_token.type===j.START_BLOCK,Bt=!1;else if(U(L.text,["--","++","!","~"])||pe){if((this._flags.last_token.type===j.COMMA||this._flags.last_token.type===j.START_EXPR)&&this.allow_wrap_or_preserved_newline(L),at=!1,Bt=!1,L.newlines&&(L.text==="--"||L.text==="++"||L.text==="~")){var di=be(this._flags.last_token,Se)&&L.newlines;di&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(di,!0)}this._flags.last_token.text===";"&&X(this._flags.mode)&&(at=!0),this._flags.last_token.type===j.RESERVED?at=!0:this._flags.last_token.type===j.END_EXPR?at=!(this._flags.last_token.text==="]"&&(L.text==="--"||L.text==="++")):this._flags.last_token.type===j.OPERATOR&&(at=U(L.text,["--","-","++","+"])&&U(this._flags.last_token.text,["--","-","++","+"]),U(L.text,["+","-"])&&U(this._flags.last_token.text,["--","++"])&&(Bt=!0)),(this._flags.mode===Be.BlockStatement&&!this._flags.inline_frame||this._flags.mode===Be.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||at,this.print_token(L),this._output.space_before_token=Bt},ie.prototype.handle_block_comment=function(L,V){if(this._output.raw){this._output.add_raw_token(L),L.directives&&L.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(L.directives){this.print_newline(!1,V),this.print_token(L),L.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!T.newline.test(L.text)&&!L.newlines){this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0;return}else this.print_block_commment(L,V)},ie.prototype.print_block_commment=function(L,V){var pe=te(L.text),ze,at=!1,Bt=!1,Me=L.whitespace_before,Ht=Me.length;if(this.print_newline(!1,V),this.print_token_line_indentation(L),this._output.add_token(pe[0]),this.print_newline(!1,V),pe.length>1){for(pe=pe.slice(1),at=Q(pe,"*"),Bt=de(pe,Me),at&&(this._flags.alignment=1),ze=0;ze<pe.length;ze++)at?(this.print_token_line_indentation(L),this._output.add_token($(pe[ze]))):Bt&&pe[ze]?(this.print_token_line_indentation(L),this._output.add_token(pe[ze].substring(Ht))):(this._output.current_line.set_indent(-1),this._output.add_token(pe[ze])),this.print_newline(!1,V);this._flags.alignment=0}},ie.prototype.handle_comment=function(L,V){L.newlines?this.print_newline(!1,V):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(L),this.print_newline(!1,V)},ie.prototype.handle_dot=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),be(this._flags.last_token,Se)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(L,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(L)},ie.prototype.handle_unknown=function(L,V){this.print_token(L),L.text[L.text.length-1]===`
|
|
|
`&&this.print_newline(!1,V)},ie.prototype.handle_eof=function(L){for(;this._flags.mode===Be.Statement;)this.restore_mode();this.handle_whitespace_and_comments(L)},P.exports.Beautifier=ie},function(P){function f(k){this.__parent=k,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=[]}f.prototype.clone_empty=function(){var k=new f(this.__parent);return k.set_indent(this.__indent_count,this.__alignment_count),k},f.prototype.item=function(k){return k<0?this.__items[this.__items.length+k]:this.__items[k]},f.prototype.has_match=function(k){for(var T=this.__items.length-1;T>=0;T--)if(this.__items[T].match(k))return!0;return!1},f.prototype.set_indent=function(k,T){this.is_empty()&&(this.__indent_count=k||0,this.__alignment_count=T||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},f.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)},f.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},f.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var k=this.__parent.current_line;return k.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),k.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),k.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,k.__items[0]===" "&&(k.__items.splice(0,1),k.__character_count-=1),!0}return!1},f.prototype.is_empty=function(){return this.__items.length===0},f.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},f.prototype.push=function(k){this.__items.push(k);var T=k.lastIndexOf(`
|
|
|
`);T!==-1?this.__character_count=k.length-T:this.__character_count+=k.length},f.prototype.pop=function(){var k=null;return this.is_empty()||(k=this.__items.pop(),this.__character_count-=k.length),k},f.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},f.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},f.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},f.prototype.toString=function(){var k="";return this.is_empty()?this.__parent.indent_empty_lines&&(k=this.__parent.get_indent_string(this.__indent_count)):(k=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),k+=this.__items.join("")),k};function re(k,T){this.__cache=[""],this.__indent_size=k.indent_size,this.__indent_string=k.indent_char,k.indent_with_tabs||(this.__indent_string=new Array(k.indent_size+1).join(k.indent_char)),T=T||"",k.indent_level>0&&(T=new Array(k.indent_level+1).join(this.__indent_string)),this.__base_string=T,this.__base_string_length=T.length}re.prototype.get_indent_size=function(k,T){var M=this.__base_string_length;return T=T||0,k<0&&(M=0),M+=k*this.__indent_size,M+=T,M},re.prototype.get_indent_string=function(k,T){var M=this.__base_string;return T=T||0,k<0&&(k=0,M=""),T+=k*this.__indent_size,this.__ensure_cache(T),M+=this.__cache[T],M},re.prototype.__ensure_cache=function(k){for(;k>=this.__cache.length;)this.__add_column()},re.prototype.__add_column=function(){var k=this.__cache.length,T=0,M="";this.__indent_size&&k>=this.__indent_size&&(T=Math.floor(k/this.__indent_size),k-=T*this.__indent_size,M=new Array(T+1).join(this.__indent_string)),k&&(M+=new Array(k+1).join(" ")),this.__cache.push(M)};function R(k,T){this.__indent_cache=new re(k,T),this.raw=!1,this._end_with_newline=k.end_with_newline,this.indent_size=k.indent_size,this.wrap_line_length=k.wrap_line_length,this.indent_empty_lines=k.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new f(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}R.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},R.prototype.get_line_number=function(){return this.__lines.length},R.prototype.get_indent_string=function(k,T){return this.__indent_cache.get_indent_string(k,T)},R.prototype.get_indent_size=function(k,T){return this.__indent_cache.get_indent_size(k,T)},R.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},R.prototype.add_new_line=function(k){return this.is_empty()||!k&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},R.prototype.get_code=function(k){this.trim(!0);var T=this.current_line.pop();T&&(T[T.length-1]===`
|
|
|
`&&(T=T.replace(/\n+$/g,"")),this.current_line.push(T)),this._end_with_newline&&this.__add_outputline();var M=this.__lines.join(`
|
|
|
`);return k!==`
|
|
|
`&&(M=M.replace(/[\n]/g,k)),M},R.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},R.prototype.set_indent=function(k,T){return k=k||0,T=T||0,this.next_line.set_indent(k,T),this.__lines.length>1?(this.current_line.set_indent(k,T),!0):(this.current_line.set_indent(),!1)},R.prototype.add_raw_token=function(k){for(var T=0;T<k.newlines;T++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(k.whitespace_before),this.current_line.push(k.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},R.prototype.add_token=function(k){this.__add_space_before_token(),this.current_line.push(k),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},R.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(" "))},R.prototype.remove_indent=function(k){for(var T=this.__lines.length;k<T;)this.__lines[k]._remove_indent(),k++;this.current_line._remove_wrap_indent()},R.prototype.trim=function(k){for(k=k===void 0?!1:k,this.current_line.trim();k&&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},R.prototype.just_added_newline=function(){return this.current_line.is_empty()},R.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},R.prototype.ensure_empty_line_above=function(k,T){for(var M=this.__lines.length-2;M>=0;){var O=this.__lines[M];if(O.is_empty())break;if(O.item(0).indexOf(k)!==0&&O.item(-1)!==T){this.__lines.splice(M+1,0,new f(this)),this.previous_line=this.__lines[this.__lines.length-2];break}M--}},P.exports.Output=R},function(P){function f(re,R,k,T){this.type=re,this.text=R,this.comments_before=null,this.newlines=k||0,this.whitespace_before=T||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}P.exports.Token=f},function(P,f){var re="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",R="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",k="\\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",T="\\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",M="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",O="(?:"+M+"|["+re+k+"])",Y="(?:"+M+"|["+R+k+T+"])*";f.identifier=new RegExp(O+Y,"g"),f.identifierStart=new RegExp(O),f.identifierMatch=new RegExp("(?:"+M+"|["+R+k+T+"])+");var H=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;f.newline=/[\n\r\u2028\u2029]/,f.lineBreak=new RegExp(`\r
|
|
|
|`+f.newline.source),f.allLineBreaks=new RegExp(f.lineBreak.source,"g")},function(P,f,re){var R=re(6).Options,k=["before-newline","after-newline","preserve-newline"];function T(M){R.call(this,M,"js");var O=this.raw_options.brace_style||null;O==="expand-strict"?this.raw_options.brace_style="expand":O==="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 Y=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var H=0;H<Y.length;H++)Y[H]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=Y[H];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",k),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}T.prototype=new R,P.exports.Options=T},function(P){function f(k,T){this.raw_options=re(k,T),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",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"])}f.prototype._get_array=function(k,T){var M=this.raw_options[k],O=T||[];return typeof M=="object"?M!==null&&typeof M.concat=="function"&&(O=M.concat()):typeof M=="string"&&(O=M.split(/[^a-zA-Z0-9_\/\-]+/)),O},f.prototype._get_boolean=function(k,T){var M=this.raw_options[k],O=M===void 0?!!T:!!M;return O},f.prototype._get_characters=function(k,T){var M=this.raw_options[k],O=T||"";return typeof M=="string"&&(O=M.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),O},f.prototype._get_number=function(k,T){var M=this.raw_options[k];T=parseInt(T,10),isNaN(T)&&(T=0);var O=parseInt(M,10);return isNaN(O)&&(O=T),O},f.prototype._get_selection=function(k,T,M){var O=this._get_selection_list(k,T,M);if(O.length!==1)throw new Error("Invalid Option Value: The option '"+k+`' can only be one of the following values:
|
|
|
`+T+`
|
|
|
You passed in: '`+this.raw_options[k]+"'");return O[0]},f.prototype._get_selection_list=function(k,T,M){if(!T||T.length===0)throw new Error("Selection list cannot be empty.");if(M=M||[T[0]],!this._is_valid_selection(M,T))throw new Error("Invalid Default Value!");var O=this._get_array(k,M);if(!this._is_valid_selection(O,T))throw new Error("Invalid Option Value: The option '"+k+`' can contain only the following values:
|
|
|
`+T+`
|
|
|
You passed in: '`+this.raw_options[k]+"'");return O},f.prototype._is_valid_selection=function(k,T){return k.length&&T.length&&!k.some(function(M){return T.indexOf(M)===-1})};function re(k,T){var M={};k=R(k);var O;for(O in k)O!==T&&(M[O]=k[O]);if(T&&k[T])for(O in k[T])M[O]=k[T][O];return M}function R(k){var T={},M;for(M in k){var O=M.replace(/-/g,"_");T[O]=k[M]}return T}P.exports.Options=f,P.exports.normalizeOpts=R,P.exports.mergeOpts=re},function(P,f,re){var R=re(8).InputScanner,k=re(9).Tokenizer,T=re(9).TOKEN,M=re(13).Directives,O=re(4),Y=re(12).Pattern,H=re(14).TemplatablePattern;function j(Q,de){return de.indexOf(Q)!==-1}var U={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:T.START,RAW:T.RAW,EOF:T.EOF},$=new M(/\/\*/,/\*\//),G=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,fe=/[0-9]/,be=/[^\d\.]/,Se=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),se=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";se=se.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),se="\\?\\.(?!\\d) "+se,se=se.replace(/ /g,"|");var Oe=new RegExp(se),We="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),Be=We.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),At=new RegExp("^(?:"+Be.join("|")+")$"),te,z=function(Q,de){k.call(this,Q,de),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var ie=new Y(this._input),A=new H(this._input).read_options(this._options);this.__patterns={template:A,identifier:A.starting_with(O.identifier).matching(O.identifierMatch),number:ie.matching(G),punct:ie.matching(Oe),comment:ie.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:ie.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:ie.matching(/<!--/),html_comment_end:ie.matching(/-->/),include:ie.starting_with(/#include/).until_after(O.lineBreak),shebang:ie.starting_with(/#!/).until_after(O.lineBreak),xml:ie.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:A.until(/['\\\n\r\u2028\u2029]/),double_quote:A.until(/["\\\n\r\u2028\u2029]/),template_text:A.until(/[`\\$]/),template_expression:A.until(/[`}\\]/)}};z.prototype=new k,z.prototype._is_comment=function(Q){return Q.type===U.COMMENT||Q.type===U.BLOCK_COMMENT||Q.type===U.UNKNOWN},z.prototype._is_opening=function(Q){return Q.type===U.START_BLOCK||Q.type===U.START_EXPR},z.prototype._is_closing=function(Q,de){return(Q.type===U.END_BLOCK||Q.type===U.END_EXPR)&&de&&(Q.text==="]"&&de.text==="["||Q.text===")"&&de.text==="("||Q.text==="}"&&de.text==="{")},z.prototype._reset=function(){te=!1},z.prototype._get_next_token=function(Q,de){var ie=null;this._readWhitespace();var A=this._input.peek();return A===null?this._create_token(U.EOF,""):(ie=ie||this._read_non_javascript(A),ie=ie||this._read_string(A),ie=ie||this._read_pair(A,this._input.peek(1)),ie=ie||this._read_word(Q),ie=ie||this._read_singles(A),ie=ie||this._read_comment(A),ie=ie||this._read_regexp(A,Q),ie=ie||this._read_xml(A,Q),ie=ie||this._read_punctuation(),ie=ie||this._create_token(U.UNKNOWN,this._input.next()),ie)},z.prototype._read_word=function(Q){var de;if(de=this.__patterns.identifier.read(),de!=="")return de=de.replace(O.allLineBreaks,`
|
|
|
`),!(Q.type===U.DOT||Q.type===U.RESERVED&&(Q.text==="set"||Q.text==="get"))&&At.test(de)?(de==="in"||de==="of")&&(Q.type===U.WORD||Q.type===U.STRING)?this._create_token(U.OPERATOR,de):this._create_token(U.RESERVED,de):this._create_token(U.WORD,de);if(de=this.__patterns.number.read(),de!=="")return this._create_token(U.WORD,de)},z.prototype._read_singles=function(Q){var de=null;return Q==="("||Q==="["?de=this._create_token(U.START_EXPR,Q):Q===")"||Q==="]"?de=this._create_token(U.END_EXPR,Q):Q==="{"?de=this._create_token(U.START_BLOCK,Q):Q==="}"?de=this._create_token(U.END_BLOCK,Q):Q===";"?de=this._create_token(U.SEMICOLON,Q):Q==="."&&be.test(this._input.peek(1))?de=this._create_token(U.DOT,Q):Q===","&&(de=this._create_token(U.COMMA,Q)),de&&this._input.next(),de},z.prototype._read_pair=function(Q,de){var ie=null;return Q==="#"&&de==="{"&&(ie=this._create_token(U.START_BLOCK,Q+de)),ie&&(this._input.next(),this._input.next()),ie},z.prototype._read_punctuation=function(){var Q=this.__patterns.punct.read();if(Q!=="")return Q==="="?this._create_token(U.EQUALS,Q):Q==="?."?this._create_token(U.DOT,Q):this._create_token(U.OPERATOR,Q)},z.prototype._read_non_javascript=function(Q){var de="";if(Q==="#"){if(this._is_first_token()&&(de=this.__patterns.shebang.read(),de))return this._create_token(U.UNKNOWN,de.trim()+`
|
|
|
`);if(de=this.__patterns.include.read(),de)return this._create_token(U.UNKNOWN,de.trim()+`
|
|
|
`);Q=this._input.next();var ie="#";if(this._input.hasNext()&&this._input.testChar(fe)){do Q=this._input.next(),ie+=Q;while(this._input.hasNext()&&Q!=="#"&&Q!=="=");return Q==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(ie+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(ie+="{}",this._input.next(),this._input.next())),this._create_token(U.WORD,ie)}this._input.back()}else if(Q==="<"&&this._is_first_token()){if(de=this.__patterns.html_comment_start.read(),de){for(;this._input.hasNext()&&!this._input.testChar(O.newline);)de+=this._input.next();return te=!0,this._create_token(U.COMMENT,de)}}else if(te&&Q==="-"&&(de=this.__patterns.html_comment_end.read(),de))return te=!1,this._create_token(U.COMMENT,de);return null},z.prototype._read_comment=function(Q){var de=null;if(Q==="/"){var ie="";if(this._input.peek(1)==="*"){ie=this.__patterns.block_comment.read();var A=$.get_directives(ie);A&&A.ignore==="start"&&(ie+=$.readIgnored(this._input)),ie=ie.replace(O.allLineBreaks,`
|
|
|
`),de=this._create_token(U.BLOCK_COMMENT,ie),de.directives=A}else this._input.peek(1)==="/"&&(ie=this.__patterns.comment.read(),de=this._create_token(U.COMMENT,ie))}return de},z.prototype._read_string=function(Q){if(Q==="`"||Q==="'"||Q==='"'){var de=this._input.next();return this.has_char_escapes=!1,Q==="`"?de+=this._read_string_recursive("`",!0,"${"):de+=this._read_string_recursive(Q),this.has_char_escapes&&this._options.unescape_strings&&(de=X(de)),this._input.peek()===Q&&(de+=this._input.next()),de=de.replace(O.allLineBreaks,`
|
|
|
`),this._create_token(U.STRING,de)}return null},z.prototype._allow_regexp_or_xml=function(Q){return Q.type===U.RESERVED&&j(Q.text,["return","case","throw","else","do","typeof","yield"])||Q.type===U.END_EXPR&&Q.text===")"&&Q.opened.previous.type===U.RESERVED&&j(Q.opened.previous.text,["if","while","for"])||j(Q.type,[U.COMMENT,U.START_EXPR,U.START_BLOCK,U.START,U.END_BLOCK,U.OPERATOR,U.EQUALS,U.EOF,U.SEMICOLON,U.COMMA])},z.prototype._read_regexp=function(Q,de){if(Q==="/"&&this._allow_regexp_or_xml(de)){for(var ie=this._input.next(),A=!1,L=!1;this._input.hasNext()&&(A||L||this._input.peek()!==Q)&&!this._input.testChar(O.newline);)ie+=this._input.peek(),A?A=!1:(A=this._input.peek()==="\\",this._input.peek()==="["?L=!0:this._input.peek()==="]"&&(L=!1)),this._input.next();return this._input.peek()===Q&&(ie+=this._input.next(),ie+=this._input.read(O.identifier)),this._create_token(U.STRING,ie)}return null},z.prototype._read_xml=function(Q,de){if(this._options.e4x&&Q==="<"&&this._allow_regexp_or_xml(de)){var ie="",A=this.__patterns.xml.read_match();if(A){for(var L=A[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),V=L.indexOf("{")===0,pe=0;A;){var ze=!!A[1],at=A[2],Bt=!!A[A.length-1]||at.slice(0,8)==="![CDATA[";if(!Bt&&(at===L||V&&at.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ze?--pe:++pe),ie+=A[0],pe<=0)break;A=this.__patterns.xml.read_match()}return A||(ie+=this._input.match(/[\s\S]*/g)[0]),ie=ie.replace(O.allLineBreaks,`
|
|
|
`),this._create_token(U.STRING,ie)}}return null};function X(Q){for(var de="",ie=0,A=new R(Q),L=null;A.hasNext();)if(L=A.match(/([\s]|[^\\]|\\\\)+/g),L&&(de+=L[0]),A.peek()==="\\"){if(A.next(),A.peek()==="x")L=A.match(/x([0-9A-Fa-f]{2})/g);else if(A.peek()==="u")L=A.match(/u([0-9A-Fa-f]{4})/g),L||(L=A.match(/u\{([0-9A-Fa-f]+)\}/g));else{de+="\\",A.hasNext()&&(de+=A.next());continue}if(!L||(ie=parseInt(L[1],16),ie>126&&ie<=255&&L[0].indexOf("x")===0))return Q;ie>=0&&ie<32||ie>1114111?de+="\\"+L[0]:ie===34||ie===39||ie===92?de+="\\"+String.fromCharCode(ie):de+=String.fromCharCode(ie)}return de}z.prototype._read_string_recursive=function(Q,de,ie){var A,L;Q==="'"?L=this.__patterns.single_quote:Q==='"'?L=this.__patterns.double_quote:Q==="`"?L=this.__patterns.template_text:Q==="}"&&(L=this.__patterns.template_expression);for(var V=L.read(),pe="";this._input.hasNext();){if(pe=this._input.next(),pe===Q||!de&&O.newline.test(pe)){this._input.back();break}else pe==="\\"&&this._input.hasNext()?(A=this._input.peek(),A==="x"||A==="u"?this.has_char_escapes=!0:A==="\r"&&this._input.peek(1)===`
|
|
|
`&&this._input.next(),pe+=this._input.next()):ie&&(ie==="${"&&pe==="$"&&this._input.peek()==="{"&&(pe+=this._input.next()),ie===pe&&(Q==="`"?pe+=this._read_string_recursive("}",de,"`"):pe+=this._read_string_recursive("`",de,"${"),this._input.hasNext()&&(pe+=this._input.next())));pe+=L.read(),V+=pe}return V},P.exports.Tokenizer=z,P.exports.TOKEN=U,P.exports.positionable_operators=Se.slice(),P.exports.line_starters=We.slice()},function(P){var f=RegExp.prototype.hasOwnProperty("sticky");function re(R){this.__input=R||"",this.__input_length=this.__input.length,this.__position=0}re.prototype.restart=function(){this.__position=0},re.prototype.back=function(){this.__position>0&&(this.__position-=1)},re.prototype.hasNext=function(){return this.__position<this.__input_length},re.prototype.next=function(){var R=null;return this.hasNext()&&(R=this.__input.charAt(this.__position),this.__position+=1),R},re.prototype.peek=function(R){var k=null;return R=R||0,R+=this.__position,R>=0&&R<this.__input_length&&(k=this.__input.charAt(R)),k},re.prototype.__match=function(R,k){R.lastIndex=k;var T=R.exec(this.__input);return T&&!(f&&R.sticky)&&T.index!==k&&(T=null),T},re.prototype.test=function(R,k){return k=k||0,k+=this.__position,k>=0&&k<this.__input_length?!!this.__match(R,k):!1},re.prototype.testChar=function(R,k){var T=this.peek(k);return R.lastIndex=0,T!==null&&R.test(T)},re.prototype.match=function(R){var k=this.__match(R,this.__position);return k?this.__position+=k[0].length:k=null,k},re.prototype.read=function(R,k,T){var M="",O;return R&&(O=this.match(R),O&&(M+=O[0])),k&&(O||!R)&&(M+=this.readUntil(k,T)),M},re.prototype.readUntil=function(R,k){var T="",M=this.__position;R.lastIndex=this.__position;var O=R.exec(this.__input);return O?(M=O.index,k&&(M+=O[0].length)):M=this.__input_length,T=this.__input.substring(this.__position,M),this.__position=M,T},re.prototype.readUntilAfter=function(R){return this.readUntil(R,!0)},re.prototype.get_regexp=function(R,k){var T=null,M="g";return k&&f&&(M="y"),typeof R=="string"&&R!==""?T=new RegExp(R,M):R&&(T=new RegExp(R.source,M)),T},re.prototype.get_literal_regexp=function(R){return RegExp(R.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},re.prototype.peekUntilAfter=function(R){var k=this.__position,T=this.readUntilAfter(R);return this.__position=k,T},re.prototype.lookBack=function(R){var k=this.__position-1;return k>=R.length&&this.__input.substring(k-R.length,k).toLowerCase()===R},P.exports.InputScanner=re},function(P,f,re){var R=re(8).InputScanner,k=re(3).Token,T=re(10).TokenStream,M=re(11).WhitespacePattern,O={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},Y=function(H,j){this._input=new R(H),this._options=j||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new M(this._input)};Y.prototype.tokenize=function(){this._input.restart(),this.__tokens=new T,this._reset();for(var H,j=new k(O.START,""),U=null,$=[],G=new T;j.type!==O.EOF;){for(H=this._get_next_token(j,U);this._is_comment(H);)G.add(H),H=this._get_next_token(j,U);G.isEmpty()||(H.comments_before=G,G=new T),H.parent=U,this._is_opening(H)?($.push(U),U=H):U&&this._is_closing(H,U)&&(H.opened=U,U.closed=H,U=$.pop(),H.parent=U),H.previous=j,j.next=H,this.__tokens.add(H),j=H}return this.__tokens},Y.prototype._is_first_token=function(){return this.__tokens.isEmpty()},Y.prototype._reset=function(){},Y.prototype._get_next_token=function(H,j){this._readWhitespace();var U=this._input.read(/.+/g);return U?this._create_token(O.RAW,U):this._create_token(O.EOF,"")},Y.prototype._is_comment=function(H){return!1},Y.prototype._is_opening=function(H){return!1},Y.prototype._is_closing=function(H,j){return!1},Y.prototype._create_token=function(H,j){var U=new k(H,j,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return U},Y.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},P.exports.Tokenizer=Y,P.exports.TOKEN=O},function(P){function f(re){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=re}f.prototype.restart=function(){this.__position=0},f.prototype.isEmpty=function(){return this.__tokens_length===0},f.prototype.hasNext=function(){return this.__position<this.__tokens_length},f.prototype.next=function(){var re=null;return this.hasNext()&&(re=this.__tokens[this.__position],this.__position+=1),re},f.prototype.peek=function(re){var R=null;return re=re||0,re+=this.__position,re>=0&&re<this.__tokens_length&&(R=this.__tokens[re]),R},f.prototype.add=function(re){this.__parent_token&&(re.parent=this.__parent_token),this.__tokens.push(re),this.__tokens_length+=1},P.exports.TokenStream=f},function(P,f,re){var R=re(12).Pattern;function k(T,M){R.call(this,T,M),M?this._line_regexp=this._input.get_regexp(M._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}k.prototype=new R,k.prototype.__set_whitespace_patterns=function(T,M){T+="\\t ",M+="\\n\\r",this._match_pattern=this._input.get_regexp("["+T+M+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+M+"]")},k.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var T=this._input.read(this._match_pattern);if(T===" ")this.whitespace_before_token=" ";else if(T){var M=this.__split(this._newline_regexp,T);this.newline_count=M.length-1,this.whitespace_before_token=M[this.newline_count]}return T},k.prototype.matching=function(T,M){var O=this._create();return O.__set_whitespace_patterns(T,M),O._update(),O},k.prototype._create=function(){return new k(this._input,this)},k.prototype.__split=function(T,M){T.lastIndex=0;for(var O=0,Y=[],H=T.exec(M);H;)Y.push(M.substring(O,H.index)),O=H.index+H[0].length,H=T.exec(M);return O<M.length?Y.push(M.substring(O,M.length)):Y.push(""),Y},P.exports.WhitespacePattern=k},function(P){function f(re,R){this._input=re,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,R&&(this._starting_pattern=this._input.get_regexp(R._starting_pattern,!0),this._match_pattern=this._input.get_regexp(R._match_pattern,!0),this._until_pattern=this._input.get_regexp(R._until_pattern),this._until_after=R._until_after)}f.prototype.read=function(){var re=this._input.read(this._starting_pattern);return(!this._starting_pattern||re)&&(re+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),re},f.prototype.read_match=function(){return this._input.match(this._match_pattern)},f.prototype.until_after=function(re){var R=this._create();return R._until_after=!0,R._until_pattern=this._input.get_regexp(re),R._update(),R},f.prototype.until=function(re){var R=this._create();return R._until_after=!1,R._until_pattern=this._input.get_regexp(re),R._update(),R},f.prototype.starting_with=function(re){var R=this._create();return R._starting_pattern=this._input.get_regexp(re,!0),R._update(),R},f.prototype.matching=function(re){var R=this._create();return R._match_pattern=this._input.get_regexp(re,!0),R._update(),R},f.prototype._create=function(){return new f(this._input,this)},f.prototype._update=function(){},P.exports.Pattern=f},function(P){function f(re,R){re=typeof re=="string"?re:re.source,R=typeof R=="string"?R:R.source,this.__directives_block_pattern=new RegExp(re+/ beautify( \w+[:]\w+)+ /.source+R,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(re+/\sbeautify\signore:end\s/.source+R,"g")}f.prototype.get_directives=function(re){if(!re.match(this.__directives_block_pattern))return null;var R={};this.__directive_pattern.lastIndex=0;for(var k=this.__directive_pattern.exec(re);k;)R[k[1]]=k[2],k=this.__directive_pattern.exec(re);return R},f.prototype.readIgnored=function(re){return re.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=f},function(P,f,re){var R=re(12).Pattern,k={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function T(M,O){R.call(this,M,O),this.__template_pattern=null,this._disabled=Object.assign({},k),this._excluded=Object.assign({},k),O&&(this.__template_pattern=this._input.get_regexp(O.__template_pattern),this._excluded=Object.assign(this._excluded,O._excluded),this._disabled=Object.assign(this._disabled,O._disabled));var Y=new R(M);this.__patterns={handlebars_comment:Y.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:Y.starting_with(/{{{/).until_after(/}}}/),handlebars:Y.starting_with(/{{/).until_after(/}}/),php:Y.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:Y.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:Y.starting_with(/{%/).until_after(/%}/),django_value:Y.starting_with(/{{/).until_after(/}}/),django_comment:Y.starting_with(/{#/).until_after(/#}/),smarty:Y.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:Y.starting_with(/{\*/).until_after(/\*}/),smarty_literal:Y.starting_with(/{literal}/).until_after(/{\/literal}/)}}T.prototype=new R,T.prototype._create=function(){return new T(this._input,this)},T.prototype._update=function(){this.__set_templated_pattern()},T.prototype.disable=function(M){var O=this._create();return O._disabled[M]=!0,O._update(),O},T.prototype.read_options=function(M){var O=this._create();for(var Y in k)O._disabled[Y]=M.templating.indexOf(Y)===-1;return O._update(),O},T.prototype.exclude=function(M){var O=this._create();return O._excluded[M]=!0,O._update(),O},T.prototype.read=function(){var M="";this._match_pattern?M=this._input.read(this._starting_pattern):M=this._input.read(this._starting_pattern,this.__template_pattern);for(var O=this._read_template();O;)this._match_pattern?O+=this._input.read(this._match_pattern):O+=this._input.readUntil(this.__template_pattern),M+=O,O=this._read_template();return this._until_after&&(M+=this._input.readUntilAfter(this._until_pattern)),M},T.prototype.__set_templated_pattern=function(){var M=[];this._disabled.php||M.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||M.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||M.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||M.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(M.push(this.__patterns.django._starting_pattern.source),M.push(this.__patterns.django_value._starting_pattern.source),M.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||M.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&M.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+M.join("|")+")")},T.prototype._read_template=function(){var M="",O=this._input.peek();if(O==="<"){var Y=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&Y==="?"&&(M=M||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&Y==="%"&&(M=M||this.__patterns.erb.read())}else O==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(M=M||this.__patterns.handlebars_comment.read(),M=M||this.__patterns.handlebars_unescaped.read(),M=M||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(M=M||this.__patterns.django_value.read()),this._excluded.django||(M=M||this.__patterns.django_comment.read(),M=M||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(M=M||this.__patterns.smarty_comment.read(),M=M||this.__patterns.smarty_literal.read(),M=M||this.__patterns.smarty.read()));return M},P.exports.TemplatablePattern=T}],q={};function S(P){var f=q[P];if(f!==void 0)return f.exports;var re=q[P]={exports:{}};return ge[P](re,re.exports,S),re.exports}var Te=S(0);De=Te})();var Ze=De;oe=[],ce=function(){return{js_beautify:Ze}}.apply(It,oe),ce!==void 0&&(Li.exports=ce)})()},32834:function(Li){(function(It,oe){Li.exports=oe()})(this,function(){"use strict";function It(Le,ye){for(var we=0;we<ye.length;we++){var K=ye[we];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(Le,K.key,K)}}function oe(Le,ye,we){return ye&&It(Le.prototype,ye),we&&It(Le,we),Le}function ce(Le,ye){if(Le){if(typeof Le=="string")return De(Le,ye);var we=Object.prototype.toString.call(Le).slice(8,-1);if(we==="Object"&&Le.constructor&&(we=Le.constructor.name),we==="Map"||we==="Set")return Array.from(Le);if(we==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(we))return De(Le,ye)}}function De(Le,ye){(ye==null||ye>Le.length)&&(ye=Le.length);for(var we=0,K=new Array(ye);we<ye;we++)K[we]=Le[we];return K}function Ze(Le,ye){var we=typeof Symbol!="undefined"&&Le[Symbol.iterator]||Le["@@iterator"];if(we)return(we=we.call(Le)).next.bind(we);if(Array.isArray(Le)||(we=ce(Le))||ye&&Le&&typeof Le.length=="number"){we&&(Le=we);var K=0;return function(){return K>=Le.length?{done:!0}:{done:!1,value:Le[K++]}}}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 ge={exports:{}};function q(){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 S(Le){ge.exports.defaults=Le}ge.exports={defaults:q(),getDefaults:q,changeDefaults:S};var Te=/[&<>"']/,P=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,re=/[<>"']|&(?!#?\w+;)/g,R={"&":"&","<":"<",">":">",'"':""","'":"'"},k=function(ye){return R[ye]};function T(Le,ye){if(ye){if(Te.test(Le))return Le.replace(P,k)}else if(f.test(Le))return Le.replace(re,k);return Le}var M=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function O(Le){return Le.replace(M,function(ye,we){return we=we.toLowerCase(),we==="colon"?":":we.charAt(0)==="#"?we.charAt(1)==="x"?String.fromCharCode(parseInt(we.substring(2),16)):String.fromCharCode(+we.substring(1)):""})}var Y=/(^|[^\[])\^/g;function H(Le,ye){Le=Le.source||Le,ye=ye||"";var we={replace:function(W,ae){return ae=ae.source||ae,ae=ae.replace(Y,"$1"),Le=Le.replace(W,ae),we},getRegex:function(){return new RegExp(Le,ye)}};return we}var j=/[^\w:]/g,U=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function $(Le,ye,we){if(Le){var K;try{K=decodeURIComponent(O(we)).replace(j,"").toLowerCase()}catch(W){return null}if(K.indexOf("javascript:")===0||K.indexOf("vbscript:")===0||K.indexOf("data:")===0)return null}ye&&!U.test(we)&&(we=se(ye,we));try{we=encodeURI(we).replace(/%25/g,"%")}catch(W){return null}return we}var G={},fe=/^[^:]+:\/*[^/]*$/,be=/^([^:]+:)[\s\S]*$/,Se=/^([^:]+:\/*[^/]*)[\s\S]*$/;function se(Le,ye){G[" "+Le]||(fe.test(Le)?G[" "+Le]=Le+"/":G[" "+Le]=At(Le,"/",!0)),Le=G[" "+Le];var we=Le.indexOf(":")===-1;return ye.substring(0,2)==="//"?we?ye:Le.replace(be,"$1")+ye:ye.charAt(0)==="/"?we?ye:Le.replace(Se,"$1")+ye:Le+ye}var Oe={exec:function(){}};function We(Le){for(var ye=1,we,K;ye<arguments.length;ye++){we=arguments[ye];for(K in we)Object.prototype.hasOwnProperty.call(we,K)&&(Le[K]=we[K])}return Le}function Be(Le,ye){var we=Le.replace(/\|/g,function(ae,he,_e){for(var st=!1,ot=he;--ot>=0&&_e[ot]==="\\";)st=!st;return st?"|":" |"}),K=we.split(/ \|/),W=0;if(K.length>ye)K.splice(ye);else for(;K.length<ye;)K.push("");for(;W<K.length;W++)K[W]=K[W].trim().replace(/\\\|/g,"|");return K}function At(Le,ye,we){var K=Le.length;if(K===0)return"";for(var W=0;W<K;){var ae=Le.charAt(K-W-1);if(ae===ye&&!we)W++;else if(ae!==ye&&we)W++;else break}return Le.substr(0,K-W)}function te(Le,ye){if(Le.indexOf(ye[1])===-1)return-1;for(var we=Le.length,K=0,W=0;W<we;W++)if(Le[W]==="\\")W++;else if(Le[W]===ye[0])K++;else if(Le[W]===ye[1]&&(K--,K<0))return W;return-1}function z(Le){Le&&Le.sanitize&&!Le.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 X(Le,ye){if(ye<1)return"";for(var we="";ye>1;)ye&1&&(we+=Le),ye>>=1,Le+=Le;return we+Le}var Q={escape:T,unescape:O,edit:H,cleanUrl:$,resolveUrl:se,noopTest:Oe,merge:We,splitCells:Be,rtrim:At,findClosingBracket:te,checkSanitizeDeprecation:z,repeatString:X},de=ge.exports.defaults,ie=Q.rtrim,A=Q.splitCells,L=Q.escape,V=Q.findClosingBracket;function pe(Le,ye,we){var K=ye.href,W=ye.title?L(ye.title):null,ae=Le[1].replace(/\\([\[\]])/g,"$1");return Le[0].charAt(0)!=="!"?{type:"link",raw:we,href:K,title:W,text:ae}:{type:"image",raw:we,href:K,title:W,text:L(ae)}}function ze(Le,ye){var we=Le.match(/^(\s+)(?:```)/);if(we===null)return ye;var K=we[1];return ye.split(`
|
|
|
`).map(function(W){var ae=W.match(/^\s+/);if(ae===null)return W;var he=ae[0];return he.length>=K.length?W.slice(K.length):W}).join(`
|
|
|
`)}var at=function(){function Le(we){this.options=we||de}var ye=Le.prototype;return ye.space=function(K){var W=this.rules.block.newline.exec(K);if(W)return W[0].length>1?{type:"space",raw:W[0]}:{raw:`
|
|
|
`}},ye.code=function(K){var W=this.rules.block.code.exec(K);if(W){var ae=W[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:W[0],codeBlockStyle:"indented",text:this.options.pedantic?ae:ie(ae,`
|
|
|
`)}}},ye.fences=function(K){var W=this.rules.block.fences.exec(K);if(W){var ae=W[0],he=ze(ae,W[3]||"");return{type:"code",raw:ae,lang:W[2]?W[2].trim():W[2],text:he}}},ye.heading=function(K){var W=this.rules.block.heading.exec(K);if(W){var ae=W[2].trim();if(/#$/.test(ae)){var he=ie(ae,"#");(this.options.pedantic||!he||/ $/.test(he))&&(ae=he.trim())}return{type:"heading",raw:W[0],depth:W[1].length,text:ae}}},ye.nptable=function(K){var W=this.rules.block.nptable.exec(K);if(W){var ae={type:"table",header:A(W[1].replace(/^ *| *\| *$/g,"")),align:W[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:W[3]?W[3].replace(/\n$/,"").split(`
|
|
|
`):[],raw:W[0]};if(ae.header.length===ae.align.length){var he=ae.align.length,_e;for(_e=0;_e<he;_e++)/^ *-+: *$/.test(ae.align[_e])?ae.align[_e]="right":/^ *:-+: *$/.test(ae.align[_e])?ae.align[_e]="center":/^ *:-+ *$/.test(ae.align[_e])?ae.align[_e]="left":ae.align[_e]=null;for(he=ae.cells.length,_e=0;_e<he;_e++)ae.cells[_e]=A(ae.cells[_e],ae.header.length);return ae}}},ye.hr=function(K){var W=this.rules.block.hr.exec(K);if(W)return{type:"hr",raw:W[0]}},ye.blockquote=function(K){var W=this.rules.block.blockquote.exec(K);if(W){var ae=W[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:W[0],text:ae}}},ye.list=function(K){var W=this.rules.block.list.exec(K);if(W){var ae=W[0],he=W[2],_e=he.length>1,st={type:"list",raw:ae,ordered:_e,start:_e?+he.slice(0,-1):"",loose:!1,items:[]},ot=W[0].match(this.rules.block.item),xt=!1,Nt,Xt,vi,ti,St,ii,Di,Ei,$i,pi=ot.length;vi=this.rules.block.listItemStart.exec(ot[0]);for(var mi=0;mi<pi;mi++){if(Nt=ot[mi],ae=Nt,this.options.pedantic||($i=Nt.match(new RegExp("\\n\\s*\\n {0,"+(vi[0].length-1)+"}\\S")),$i&&(St=Nt.length-$i.index+ot.slice(mi+1).join(`
|
|
|
`).length,st.raw=st.raw.substring(0,st.raw.length-St),Nt=Nt.substring(0,$i.index),ae=Nt,pi=mi+1)),mi!==pi-1){if(ti=this.rules.block.listItemStart.exec(ot[mi+1]),this.options.pedantic?ti[1].length>vi[1].length:ti[1].length>=vi[0].length||ti[1].length>3){ot.splice(mi,2,ot[mi]+(!this.options.pedantic&&ti[1].length<vi[0].length&&!ot[mi].match(/\n$/)?"":`
|
|
|
`)+ot[mi+1]),mi--,pi--;continue}else(!this.options.pedantic||this.options.smartLists?ti[2][ti[2].length-1]!==he[he.length-1]:_e===(ti[2].length===1))&&(St=ot.slice(mi+1).join(`
|
|
|
`).length,st.raw=st.raw.substring(0,st.raw.length-St),mi=pi-1);vi=ti}Xt=Nt.length,Nt=Nt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~Nt.indexOf(`
|
|
|
`)&&(Xt-=Nt.length,Nt=this.options.pedantic?Nt.replace(/^ {1,4}/gm,""):Nt.replace(new RegExp("^ {1,"+Xt+"}","gm"),"")),Nt=ie(Nt,`
|
|
|
`),mi!==pi-1&&(ae=ae+`
|
|
|
`),ii=xt||/\n\n(?!\s*$)/.test(ae),mi!==pi-1&&(xt=ae.slice(-2)===`
|
|
|
|
|
|
`,ii||(ii=xt)),ii&&(st.loose=!0),this.options.gfm&&(Di=/^\[[ xX]\] /.test(Nt),Ei=void 0,Di&&(Ei=Nt[1]!==" ",Nt=Nt.replace(/^\[[ xX]\] +/,""))),st.items.push({type:"list_item",raw:ae,task:Di,checked:Ei,loose:ii,text:Nt})}return st}},ye.html=function(K){var W=this.rules.block.html.exec(K);if(W)return{type:this.options.sanitize?"paragraph":"html",raw:W[0],pre:!this.options.sanitizer&&(W[1]==="pre"||W[1]==="script"||W[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(W[0]):L(W[0]):W[0]}},ye.def=function(K){var W=this.rules.block.def.exec(K);if(W){W[3]&&(W[3]=W[3].substring(1,W[3].length-1));var ae=W[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:ae,raw:W[0],href:W[2],title:W[3]}}},ye.table=function(K){var W=this.rules.block.table.exec(K);if(W){var ae={type:"table",header:A(W[1].replace(/^ *| *\| *$/g,"")),align:W[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:W[3]?W[3].replace(/\n$/,"").split(`
|
|
|
`):[]};if(ae.header.length===ae.align.length){ae.raw=W[0];var he=ae.align.length,_e;for(_e=0;_e<he;_e++)/^ *-+: *$/.test(ae.align[_e])?ae.align[_e]="right":/^ *:-+: *$/.test(ae.align[_e])?ae.align[_e]="center":/^ *:-+ *$/.test(ae.align[_e])?ae.align[_e]="left":ae.align[_e]=null;for(he=ae.cells.length,_e=0;_e<he;_e++)ae.cells[_e]=A(ae.cells[_e].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},ye.lheading=function(K){var W=this.rules.block.lheading.exec(K);if(W)return{type:"heading",raw:W[0],depth:W[2].charAt(0)==="="?1:2,text:W[1]}},ye.paragraph=function(K){var W=this.rules.block.paragraph.exec(K);if(W)return{type:"paragraph",raw:W[0],text:W[1].charAt(W[1].length-1)===`
|
|
|
`?W[1].slice(0,-1):W[1]}},ye.text=function(K){var W=this.rules.block.text.exec(K);if(W)return{type:"text",raw:W[0],text:W[0]}},ye.escape=function(K){var W=this.rules.inline.escape.exec(K);if(W)return{type:"escape",raw:W[0],text:L(W[1])}},ye.tag=function(K,W,ae){var he=this.rules.inline.tag.exec(K);if(he)return!W&&/^<a /i.test(he[0])?W=!0:W&&/^<\/a>/i.test(he[0])&&(W=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:W,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):L(he[0]):he[0]}},ye.link=function(K){var W=this.rules.inline.link.exec(K);if(W){var ae=W[2].trim();if(!this.options.pedantic&&/^</.test(ae)){if(!/>$/.test(ae))return;var he=ie(ae.slice(0,-1),"\\");if((ae.length-he.length)%2===0)return}else{var _e=V(W[2],"()");if(_e>-1){var st=W[0].indexOf("!")===0?5:4,ot=st+W[1].length+_e;W[2]=W[2].substring(0,_e),W[0]=W[0].substring(0,ot).trim(),W[3]=""}}var xt=W[2],Nt="";if(this.options.pedantic){var Xt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(xt);Xt&&(xt=Xt[1],Nt=Xt[3])}else Nt=W[3]?W[3].slice(1,-1):"";return xt=xt.trim(),/^</.test(xt)&&(this.options.pedantic&&!/>$/.test(ae)?xt=xt.slice(1):xt=xt.slice(1,-1)),pe(W,{href:xt&&xt.replace(this.rules.inline._escapes,"$1"),title:Nt&&Nt.replace(this.rules.inline._escapes,"$1")},W[0])}},ye.reflink=function(K,W){var ae;if((ae=this.rules.inline.reflink.exec(K))||(ae=this.rules.inline.nolink.exec(K))){var he=(ae[2]||ae[1]).replace(/\s+/g," ");if(he=W[he.toLowerCase()],!he||!he.href){var _e=ae[0].charAt(0);return{type:"text",raw:_e,text:_e}}return pe(ae,he,ae[0])}},ye.emStrong=function(K,W,ae){ae===void 0&&(ae="");var he=this.rules.inline.emStrong.lDelim.exec(K);if(he&&!(he[3]&&ae.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 _e=he[1]||he[2]||"";if(!_e||_e&&(ae===""||this.rules.inline.punctuation.exec(ae))){var st=he[0].length-1,ot,xt,Nt=st,Xt=0,vi=he[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(vi.lastIndex=0,W=W.slice(-1*K.length+st);(he=vi.exec(W))!=null;)if(ot=he[1]||he[2]||he[3]||he[4]||he[5]||he[6],!!ot){if(xt=ot.length,he[3]||he[4]){Nt+=xt;continue}else if((he[5]||he[6])&&st%3&&!((st+xt)%3)){Xt+=xt;continue}if(Nt-=xt,!(Nt>0))return xt=Math.min(xt,xt+Nt+Xt),Math.min(st,xt)%2?{type:"em",raw:K.slice(0,st+he.index+xt+1),text:K.slice(1,st+he.index+xt)}:{type:"strong",raw:K.slice(0,st+he.index+xt+1),text:K.slice(2,st+he.index+xt-1)}}}}},ye.codespan=function(K){var W=this.rules.inline.code.exec(K);if(W){var ae=W[2].replace(/\n/g," "),he=/[^ ]/.test(ae),_e=/^ /.test(ae)&&/ $/.test(ae);return he&&_e&&(ae=ae.substring(1,ae.length-1)),ae=L(ae,!0),{type:"codespan",raw:W[0],text:ae}}},ye.br=function(K){var W=this.rules.inline.br.exec(K);if(W)return{type:"br",raw:W[0]}},ye.del=function(K){var W=this.rules.inline.del.exec(K);if(W)return{type:"del",raw:W[0],text:W[2]}},ye.autolink=function(K,W){var ae=this.rules.inline.autolink.exec(K);if(ae){var he,_e;return ae[2]==="@"?(he=L(this.options.mangle?W(ae[1]):ae[1]),_e="mailto:"+he):(he=L(ae[1]),_e=he),{type:"link",raw:ae[0],text:he,href:_e,tokens:[{type:"text",raw:he,text:he}]}}},ye.url=function(K,W){var ae;if(ae=this.rules.inline.url.exec(K)){var he,_e;if(ae[2]==="@")he=L(this.options.mangle?W(ae[0]):ae[0]),_e="mailto:"+he;else{var st;do st=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(st!==ae[0]);he=L(ae[0]),ae[1]==="www."?_e="http://"+he:_e=he}return{type:"link",raw:ae[0],text:he,href:_e,tokens:[{type:"text",raw:he,text:he}]}}},ye.inlineText=function(K,W,ae){var he=this.rules.inline.text.exec(K);if(he){var _e;return W?_e=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):L(he[0]):he[0]:_e=L(this.options.smartypants?ae(he[0]):he[0]),{type:"text",raw:he[0],text:_e}}},Le}(),Bt=Q.noopTest,Me=Q.edit,Ht=Q.merge,Dt={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:Bt,table:Bt,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};Dt._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Dt._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Dt.def=Me(Dt.def).replace("label",Dt._label).replace("title",Dt._title).getRegex(),Dt.bullet=/(?:[*+-]|\d{1,9}[.)])/,Dt.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Dt.item=Me(Dt.item,"gm").replace(/bull/g,Dt.bullet).getRegex(),Dt.listItemStart=Me(/^( *)(bull) */).replace("bull",Dt.bullet).getRegex(),Dt.list=Me(Dt.list).replace(/bull/g,Dt.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Dt.def.source+")").getRegex(),Dt._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",Dt._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Dt.html=Me(Dt.html,"i").replace("comment",Dt._comment).replace("tag",Dt._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Dt.paragraph=Me(Dt._paragraph).replace("hr",Dt.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",Dt._tag).getRegex(),Dt.blockquote=Me(Dt.blockquote).replace("paragraph",Dt.paragraph).getRegex(),Dt.normal=Ht({},Dt),Dt.gfm=Ht({},Dt.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*|$)"}),Dt.gfm.nptable=Me(Dt.gfm.nptable).replace("hr",Dt.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",Dt._tag).getRegex(),Dt.gfm.table=Me(Dt.gfm.table).replace("hr",Dt.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",Dt._tag).getRegex(),Dt.pedantic=Ht({},Dt.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Dt._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:Bt,paragraph:Me(Dt.normal._paragraph).replace("hr",Dt.hr).replace("heading",` *#{1,6} *[^
|
|
|
]`).replace("lheading",Dt.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ft={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Bt,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:Bt,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};ft._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ft.punctuation=Me(ft.punctuation).replace(/punctuation/g,ft._punctuation).getRegex(),ft.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,ft.escapedEmSt=/\\\*|\\_/g,ft._comment=Me(Dt._comment).replace("(?:-->|$)","-->").getRegex(),ft.emStrong.lDelim=Me(ft.emStrong.lDelim).replace(/punct/g,ft._punctuation).getRegex(),ft.emStrong.rDelimAst=Me(ft.emStrong.rDelimAst,"g").replace(/punct/g,ft._punctuation).getRegex(),ft.emStrong.rDelimUnd=Me(ft.emStrong.rDelimUnd,"g").replace(/punct/g,ft._punctuation).getRegex(),ft._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ft._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ft._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])?)+(?![-_])/,ft.autolink=Me(ft.autolink).replace("scheme",ft._scheme).replace("email",ft._email).getRegex(),ft._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ft.tag=Me(ft.tag).replace("comment",ft._comment).replace("attribute",ft._attribute).getRegex(),ft._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ft._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,ft._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ft.link=Me(ft.link).replace("label",ft._label).replace("href",ft._href).replace("title",ft._title).getRegex(),ft.reflink=Me(ft.reflink).replace("label",ft._label).getRegex(),ft.reflinkSearch=Me(ft.reflinkSearch,"g").replace("reflink",ft.reflink).replace("nolink",ft.nolink).getRegex(),ft.normal=Ht({},ft),ft.pedantic=Ht({},ft.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:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ft._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ft._label).getRegex()}),ft.gfm=Ht({},ft.normal,{escape:Me(ft.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),ft.gfm.url=Me(ft.gfm.url,"i").replace("email",ft.gfm._extended_email).getRegex(),ft.breaks=Ht({},ft.gfm,{br:Me(ft.br).replace("{2,}","*").getRegex(),text:Me(ft.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Si={block:Dt,inline:ft},di=at,tn=ge.exports.defaults,Kt=Si.block,hn=Si.inline,Ne=Q.repeatString;function He(Le){return Le.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 ve(Le){var ye="",we,K,W=Le.length;for(we=0;we<W;we++)K=Le.charCodeAt(we),Math.random()>.5&&(K="x"+K.toString(16)),ye+="&#"+K+";";return ye}var it=function(){function Le(we){this.tokens=[],this.tokens.links=Object.create(null),this.options=we||tn,this.options.tokenizer=this.options.tokenizer||new di,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var K={block:Kt.normal,inline:hn.normal};this.options.pedantic?(K.block=Kt.pedantic,K.inline=hn.pedantic):this.options.gfm&&(K.block=Kt.gfm,this.options.breaks?K.inline=hn.breaks:K.inline=hn.gfm),this.tokenizer.rules=K}Le.lex=function(K,W){var ae=new Le(W);return ae.lex(K)},Le.lexInline=function(K,W){var ae=new Le(W);return ae.inlineTokens(K)};var ye=Le.prototype;return ye.lex=function(K){return K=K.replace(/\r\n|\r/g,`
|
|
|
`).replace(/\t/g," "),this.blockTokens(K,this.tokens,!0),this.inline(this.tokens),this.tokens},ye.blockTokens=function(K,W,ae){W===void 0&&(W=[]),ae===void 0&&(ae=!0),this.options.pedantic&&(K=K.replace(/^ +$/gm,""));for(var he,_e,st,ot;K;){if(he=this.tokenizer.space(K)){K=K.substring(he.raw.length),he.type&&W.push(he);continue}if(he=this.tokenizer.code(K)){K=K.substring(he.raw.length),ot=W[W.length-1],ot&&ot.type==="paragraph"?(ot.raw+=`
|
|
|
`+he.raw,ot.text+=`
|
|
|
`+he.text):W.push(he);continue}if(he=this.tokenizer.fences(K)){K=K.substring(he.raw.length),W.push(he);continue}if(he=this.tokenizer.heading(K)){K=K.substring(he.raw.length),W.push(he);continue}if(he=this.tokenizer.nptable(K)){K=K.substring(he.raw.length),W.push(he);continue}if(he=this.tokenizer.hr(K)){K=K.substring(he.raw.length),W.push(he);continue}if(he=this.tokenizer.blockquote(K)){K=K.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],ae),W.push(he);continue}if(he=this.tokenizer.list(K)){for(K=K.substring(he.raw.length),st=he.items.length,_e=0;_e<st;_e++)he.items[_e].tokens=this.blockTokens(he.items[_e].text,[],!1);W.push(he);continue}if(he=this.tokenizer.html(K)){K=K.substring(he.raw.length),W.push(he);continue}if(ae&&(he=this.tokenizer.def(K))){K=K.substring(he.raw.length),this.tokens.links[he.tag]||(this.tokens.links[he.tag]={href:he.href,title:he.title});continue}if(he=this.tokenizer.table(K)){K=K.substring(he.raw.length),W.push(he);continue}if(he=this.tokenizer.lheading(K)){K=K.substring(he.raw.length),W.push(he);continue}if(ae&&(he=this.tokenizer.paragraph(K))){K=K.substring(he.raw.length),W.push(he);continue}if(he=this.tokenizer.text(K)){K=K.substring(he.raw.length),ot=W[W.length-1],ot&&ot.type==="text"?(ot.raw+=`
|
|
|
`+he.raw,ot.text+=`
|
|
|
`+he.text):W.push(he);continue}if(K){var xt="Infinite loop on byte: "+K.charCodeAt(0);if(this.options.silent){console.error(xt);break}else throw new Error(xt)}}return W},ye.inline=function(K){var W,ae,he,_e,st,ot,xt=K.length;for(W=0;W<xt;W++)switch(ot=K[W],ot.type){case"paragraph":case"text":case"heading":{ot.tokens=[],this.inlineTokens(ot.text,ot.tokens);break}case"table":{for(ot.tokens={header:[],cells:[]},_e=ot.header.length,ae=0;ae<_e;ae++)ot.tokens.header[ae]=[],this.inlineTokens(ot.header[ae],ot.tokens.header[ae]);for(_e=ot.cells.length,ae=0;ae<_e;ae++)for(st=ot.cells[ae],ot.tokens.cells[ae]=[],he=0;he<st.length;he++)ot.tokens.cells[ae][he]=[],this.inlineTokens(st[he],ot.tokens.cells[ae][he]);break}case"blockquote":{this.inline(ot.tokens);break}case"list":{for(_e=ot.items.length,ae=0;ae<_e;ae++)this.inline(ot.items[ae].tokens);break}}return K},ye.inlineTokens=function(K,W,ae,he){W===void 0&&(W=[]),ae===void 0&&(ae=!1),he===void 0&&(he=!1);var _e,st,ot=K,xt,Nt,Xt;if(this.tokens.links){var vi=Object.keys(this.tokens.links);if(vi.length>0)for(;(xt=this.tokenizer.rules.inline.reflinkSearch.exec(ot))!=null;)vi.includes(xt[0].slice(xt[0].lastIndexOf("[")+1,-1))&&(ot=ot.slice(0,xt.index)+"["+Ne("a",xt[0].length-2)+"]"+ot.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(xt=this.tokenizer.rules.inline.blockSkip.exec(ot))!=null;)ot=ot.slice(0,xt.index)+"["+Ne("a",xt[0].length-2)+"]"+ot.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(xt=this.tokenizer.rules.inline.escapedEmSt.exec(ot))!=null;)ot=ot.slice(0,xt.index)+"++"+ot.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;K;){if(Nt||(Xt=""),Nt=!1,_e=this.tokenizer.escape(K)){K=K.substring(_e.raw.length),W.push(_e);continue}if(_e=this.tokenizer.tag(K,ae,he)){K=K.substring(_e.raw.length),ae=_e.inLink,he=_e.inRawBlock;var ti=W[W.length-1];ti&&_e.type==="text"&&ti.type==="text"?(ti.raw+=_e.raw,ti.text+=_e.text):W.push(_e);continue}if(_e=this.tokenizer.link(K)){K=K.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,he)),W.push(_e);continue}if(_e=this.tokenizer.reflink(K,this.tokens.links)){K=K.substring(_e.raw.length);var St=W[W.length-1];_e.type==="link"?(_e.tokens=this.inlineTokens(_e.text,[],!0,he),W.push(_e)):St&&_e.type==="text"&&St.type==="text"?(St.raw+=_e.raw,St.text+=_e.text):W.push(_e);continue}if(_e=this.tokenizer.emStrong(K,ot,Xt)){K=K.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ae,he),W.push(_e);continue}if(_e=this.tokenizer.codespan(K)){K=K.substring(_e.raw.length),W.push(_e);continue}if(_e=this.tokenizer.br(K)){K=K.substring(_e.raw.length),W.push(_e);continue}if(_e=this.tokenizer.del(K)){K=K.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ae,he),W.push(_e);continue}if(_e=this.tokenizer.autolink(K,ve)){K=K.substring(_e.raw.length),W.push(_e);continue}if(!ae&&(_e=this.tokenizer.url(K,ve))){K=K.substring(_e.raw.length),W.push(_e);continue}if(_e=this.tokenizer.inlineText(K,he,He)){K=K.substring(_e.raw.length),_e.raw.slice(-1)!=="_"&&(Xt=_e.raw.slice(-1)),Nt=!0,st=W[W.length-1],st&&st.type==="text"?(st.raw+=_e.raw,st.text+=_e.text):W.push(_e);continue}if(K){var ii="Infinite loop on byte: "+K.charCodeAt(0);if(this.options.silent){console.error(ii);break}else throw new Error(ii)}}return W},oe(Le,null,[{key:"rules",get:function(){return{block:Kt,inline:hn}}}]),Le}(),_t=ge.exports.defaults,lt=Q.cleanUrl,ee=Q.escape,xe=function(){function Le(we){this.options=we||_t}var ye=Le.prototype;return ye.code=function(K,W,ae){var he=(W||"").match(/\S*/)[0];if(this.options.highlight){var _e=this.options.highlight(K,he);_e!=null&&_e!==K&&(ae=!0,K=_e)}return K=K.replace(/\n$/,"")+`
|
|
|
`,he?'<pre><code class="'+this.options.langPrefix+ee(he,!0)+'">'+(ae?K:ee(K,!0))+`</code></pre>
|
|
|
`:"<pre><code>"+(ae?K:ee(K,!0))+`</code></pre>
|
|
|
`},ye.blockquote=function(K){return`<blockquote>
|
|
|
`+K+`</blockquote>
|
|
|
`},ye.html=function(K){return K},ye.heading=function(K,W,ae,he){return this.options.headerIds?"<h"+W+' id="'+this.options.headerPrefix+he.slug(ae)+'">'+K+"</h"+W+`>
|
|
|
`:"<h"+W+">"+K+"</h"+W+`>
|
|
|
`},ye.hr=function(){return this.options.xhtml?`<hr/>
|
|
|
`:`<hr>
|
|
|
`},ye.list=function(K,W,ae){var he=W?"ol":"ul",_e=W&&ae!==1?' start="'+ae+'"':"";return"<"+he+_e+`>
|
|
|
`+K+"</"+he+`>
|
|
|
`},ye.listitem=function(K){return"<li>"+K+`</li>
|
|
|
`},ye.checkbox=function(K){return"<input "+(K?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ye.paragraph=function(K){return"<p>"+K+`</p>
|
|
|
`},ye.table=function(K,W){return W&&(W="<tbody>"+W+"</tbody>"),`<table>
|
|
|
<thead>
|
|
|
`+K+`</thead>
|
|
|
`+W+`</table>
|
|
|
`},ye.tablerow=function(K){return`<tr>
|
|
|
`+K+`</tr>
|
|
|
`},ye.tablecell=function(K,W){var ae=W.header?"th":"td",he=W.align?"<"+ae+' align="'+W.align+'">':"<"+ae+">";return he+K+"</"+ae+`>
|
|
|
`},ye.strong=function(K){return"<strong>"+K+"</strong>"},ye.em=function(K){return"<em>"+K+"</em>"},ye.codespan=function(K){return"<code>"+K+"</code>"},ye.br=function(){return this.options.xhtml?"<br/>":"<br>"},ye.del=function(K){return"<del>"+K+"</del>"},ye.link=function(K,W,ae){if(K=lt(this.options.sanitize,this.options.baseUrl,K),K===null)return ae;var he='<a href="'+ee(K)+'"';return W&&(he+=' title="'+W+'"'),he+=">"+ae+"</a>",he},ye.image=function(K,W,ae){if(K=lt(this.options.sanitize,this.options.baseUrl,K),K===null)return ae;var he='<img src="'+K+'" alt="'+ae+'"';return W&&(he+=' title="'+W+'"'),he+=this.options.xhtml?"/>":">",he},ye.text=function(K){return K},Le}(),Ke=function(){function Le(){}var ye=Le.prototype;return ye.strong=function(K){return K},ye.em=function(K){return K},ye.codespan=function(K){return K},ye.del=function(K){return K},ye.html=function(K){return K},ye.text=function(K){return K},ye.link=function(K,W,ae){return""+ae},ye.image=function(K,W,ae){return""+ae},ye.br=function(){return""},Le}(),Xe=function(){function Le(){this.seen={}}var ye=Le.prototype;return ye.serialize=function(K){return K.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},ye.getNextSafeSlug=function(K,W){var ae=K,he=0;if(this.seen.hasOwnProperty(ae)){he=this.seen[K];do he++,ae=K+"-"+he;while(this.seen.hasOwnProperty(ae))}return W||(this.seen[K]=he,this.seen[ae]=0),ae},ye.slug=function(K,W){W===void 0&&(W={});var ae=this.serialize(K);return this.getNextSafeSlug(ae,W.dryrun)},Le}(),nt=xe,gt=Ke,Yt=Xe,dt=ge.exports.defaults,ke=Q.unescape,bt=function(){function Le(we){this.options=we||dt,this.options.renderer=this.options.renderer||new nt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new gt,this.slugger=new Yt}Le.parse=function(K,W){var ae=new Le(W);return ae.parse(K)},Le.parseInline=function(K,W){var ae=new Le(W);return ae.parseInline(K)};var ye=Le.prototype;return ye.parse=function(K,W){W===void 0&&(W=!0);var ae="",he,_e,st,ot,xt,Nt,Xt,vi,ti,St,ii,Di,Ei,$i,pi,mi,Xi,an,mn=K.length;for(he=0;he<mn;he++)switch(St=K[he],St.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(St.tokens),St.depth,ke(this.parseInline(St.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(St.text,St.lang,St.escaped);continue}case"table":{for(vi="",Xt="",ot=St.header.length,_e=0;_e<ot;_e++)Xt+=this.renderer.tablecell(this.parseInline(St.tokens.header[_e]),{header:!0,align:St.align[_e]});for(vi+=this.renderer.tablerow(Xt),ti="",ot=St.cells.length,_e=0;_e<ot;_e++){for(Nt=St.tokens.cells[_e],Xt="",xt=Nt.length,st=0;st<xt;st++)Xt+=this.renderer.tablecell(this.parseInline(Nt[st]),{header:!1,align:St.align[st]});ti+=this.renderer.tablerow(Xt)}ae+=this.renderer.table(vi,ti);continue}case"blockquote":{ti=this.parse(St.tokens),ae+=this.renderer.blockquote(ti);continue}case"list":{for(ii=St.ordered,Di=St.start,Ei=St.loose,ot=St.items.length,ti="",_e=0;_e<ot;_e++)pi=St.items[_e],mi=pi.checked,Xi=pi.task,$i="",pi.task&&(an=this.renderer.checkbox(mi),Ei?pi.tokens.length>0&&pi.tokens[0].type==="text"?(pi.tokens[0].text=an+" "+pi.tokens[0].text,pi.tokens[0].tokens&&pi.tokens[0].tokens.length>0&&pi.tokens[0].tokens[0].type==="text"&&(pi.tokens[0].tokens[0].text=an+" "+pi.tokens[0].tokens[0].text)):pi.tokens.unshift({type:"text",text:an}):$i+=an),$i+=this.parse(pi.tokens,Ei),ti+=this.renderer.listitem($i,Xi,mi);ae+=this.renderer.list(ti,ii,Di);continue}case"html":{ae+=this.renderer.html(St.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(St.tokens));continue}case"text":{for(ti=St.tokens?this.parseInline(St.tokens):St.text;he+1<mn&&K[he+1].type==="text";)St=K[++he],ti+=`
|
|
|
`+(St.tokens?this.parseInline(St.tokens):St.text);ae+=W?this.renderer.paragraph(ti):ti;continue}default:{var nn='Token with "'+St.type+'" type was not found.';if(this.options.silent){console.error(nn);return}else throw new Error(nn)}}return ae},ye.parseInline=function(K,W){W=W||this.renderer;var ae="",he,_e,st=K.length;for(he=0;he<st;he++)switch(_e=K[he],_e.type){case"escape":{ae+=W.text(_e.text);break}case"html":{ae+=W.html(_e.text);break}case"link":{ae+=W.link(_e.href,_e.title,this.parseInline(_e.tokens,W));break}case"image":{ae+=W.image(_e.href,_e.title,_e.text);break}case"strong":{ae+=W.strong(this.parseInline(_e.tokens,W));break}case"em":{ae+=W.em(this.parseInline(_e.tokens,W));break}case"codespan":{ae+=W.codespan(_e.text);break}case"br":{ae+=W.br();break}case"del":{ae+=W.del(this.parseInline(_e.tokens,W));break}case"text":{ae+=W.text(_e.text);break}default:{var ot='Token with "'+_e.type+'" type was not found.';if(this.options.silent){console.error(ot);return}else throw new Error(ot)}}return ae},Le}(),Gt=it,Pt=bt,Ae=at,Ce=xe,rt=Ke,ut=Xe,je=Q.merge,kt=Q.checkSanitizeDeprecation,Tt=Q.escape,vt=ge.exports.getDefaults,Ot=ge.exports.changeDefaults,jt=ge.exports.defaults;function Je(Le,ye,we){if(typeof Le=="undefined"||Le===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Le!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Le)+", string expected");if(typeof ye=="function"&&(we=ye,ye=null),ye=je({},Je.defaults,ye||{}),kt(ye),we){var K=ye.highlight,W;try{W=Gt.lex(Le,ye)}catch(st){return we(st)}var ae=function(ot){var xt;if(!ot)try{ye.walkTokens&&Je.walkTokens(W,ye.walkTokens),xt=Pt.parse(W,ye)}catch(Nt){ot=Nt}return ye.highlight=K,ot?we(ot):we(null,xt)};if(!K||K.length<3||(delete ye.highlight,!W.length))return ae();var he=0;Je.walkTokens(W,function(st){st.type==="code"&&(he++,setTimeout(function(){K(st.text,st.lang,function(ot,xt){if(ot)return ae(ot);xt!=null&&xt!==st.text&&(st.text=xt,st.escaped=!0),he--,he===0&&ae()})},0))}),he===0&&ae();return}try{var _e=Gt.lex(Le,ye);return ye.walkTokens&&Je.walkTokens(_e,ye.walkTokens),Pt.parse(_e,ye)}catch(st){if(st.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,ye.silent)return"<p>An error occurred:</p><pre>"+Tt(st.message+"",!0)+"</pre>";throw st}}Je.options=Je.setOptions=function(Le){return je(Je.defaults,Le),Ot(Je.defaults),Je},Je.getDefaults=vt,Je.defaults=jt,Je.use=function(Le){var ye=je({},Le);if(Le.renderer&&function(){var K=Je.defaults.renderer||new Ce,W=function(_e){var st=K[_e];K[_e]=function(){for(var ot=arguments.length,xt=new Array(ot),Nt=0;Nt<ot;Nt++)xt[Nt]=arguments[Nt];var Xt=Le.renderer[_e].apply(K,xt);return Xt===!1&&(Xt=st.apply(K,xt)),Xt}};for(var ae in Le.renderer)W(ae);ye.renderer=K}(),Le.tokenizer&&function(){var K=Je.defaults.tokenizer||new Ae,W=function(_e){var st=K[_e];K[_e]=function(){for(var ot=arguments.length,xt=new Array(ot),Nt=0;Nt<ot;Nt++)xt[Nt]=arguments[Nt];var Xt=Le.tokenizer[_e].apply(K,xt);return Xt===!1&&(Xt=st.apply(K,xt)),Xt}};for(var ae in Le.tokenizer)W(ae);ye.tokenizer=K}(),Le.walkTokens){var we=Je.defaults.walkTokens;ye.walkTokens=function(K){Le.walkTokens(K),we&&we(K)}}Je.setOptions(ye)},Je.walkTokens=function(Le,ye){for(var we=Ze(Le),K;!(K=we()).done;){var W=K.value;switch(ye(W),W.type){case"table":{for(var ae=Ze(W.tokens.header),he;!(he=ae()).done;){var _e=he.value;Je.walkTokens(_e,ye)}for(var st=Ze(W.tokens.cells),ot;!(ot=st()).done;)for(var xt=ot.value,Nt=Ze(xt),Xt;!(Xt=Nt()).done;){var vi=Xt.value;Je.walkTokens(vi,ye)}break}case"list":{Je.walkTokens(W.items,ye);break}default:W.tokens&&Je.walkTokens(W.tokens,ye)}}},Je.parseInline=function(Le,ye){if(typeof Le=="undefined"||Le===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof Le!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(Le)+", string expected");ye=je({},Je.defaults,ye||{}),kt(ye);try{var we=Gt.lexInline(Le,ye);return ye.walkTokens&&Je.walkTokens(we,ye.walkTokens),Pt.parseInline(we,ye)}catch(K){if(K.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,ye.silent)return"<p>An error occurred:</p><pre>"+Tt(K.message+"",!0)+"</pre>";throw K}},Je.Parser=Pt,Je.parser=Pt.parse,Je.Renderer=Ce,Je.TextRenderer=rt,Je.Lexer=Gt,Je.lexer=Gt.lex,Je.Tokenizer=Ae,Je.Slugger=ut,Je.parse=Je;var Ft=Je;return Ft})},11690:function(Li){const It=/[&<>"']/,oe=/[&<>"']/g,ce=/[<>"']|&(?!#?\w+;)/,De=/[<>"']|&(?!#?\w+;)/g,Ze={"&":"&","<":"<",">":">",'"':""","'":"'"},ge=se=>Ze[se];function q(se,Oe){if(Oe){if(It.test(se))return se.replace(oe,ge)}else if(ce.test(se))return se.replace(De,ge);return se}const S=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Te(se){return se.replace(S,(Oe,We)=>(We=We.toLowerCase(),We==="colon"?":":We.charAt(0)==="#"?We.charAt(1)==="x"?String.fromCharCode(parseInt(We.substring(2),16)):String.fromCharCode(+We.substring(1)):""))}const P=/(^|[^\[])\^/g;function f(se,Oe){se=se.source||se,Oe=Oe||"";const We={replace:(Be,At)=>(At=At.source||At,At=At.replace(P,"$1"),se=se.replace(Be,At),We),getRegex:()=>new RegExp(se,Oe)};return We}const re=/[^\w:]/g,R=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(se,Oe,We){if(se){let Be;try{Be=decodeURIComponent(Te(We)).replace(re,"").toLowerCase()}catch(At){return null}if(Be.indexOf("javascript:")===0||Be.indexOf("vbscript:")===0||Be.indexOf("data:")===0)return null}Oe&&!R.test(We)&&(We=H(Oe,We));try{We=encodeURI(We).replace(/%25/g,"%")}catch(Be){return null}return We}const T={},M=/^[^:]+:\/*[^/]*$/,O=/^([^:]+:)[\s\S]*$/,Y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function H(se,Oe){T[" "+se]||(M.test(se)?T[" "+se]=se+"/":T[" "+se]=G(se,"/",!0)),se=T[" "+se];const We=se.indexOf(":")===-1;return Oe.substring(0,2)==="//"?We?Oe:se.replace(O,"$1")+Oe:Oe.charAt(0)==="/"?We?Oe:se.replace(Y,"$1")+Oe:se+Oe}const j={exec:function(){}};function U(se){let Oe=1,We,Be;for(;Oe<arguments.length;Oe++){We=arguments[Oe];for(Be in We)Object.prototype.hasOwnProperty.call(We,Be)&&(se[Be]=We[Be])}return se}function $(se,Oe){const We=se.replace(/\|/g,(te,z,X)=>{let Q=!1,de=z;for(;--de>=0&&X[de]==="\\";)Q=!Q;return Q?"|":" |"}),Be=We.split(/ \|/);let At=0;if(Be.length>Oe)Be.splice(Oe);else for(;Be.length<Oe;)Be.push("");for(;At<Be.length;At++)Be[At]=Be[At].trim().replace(/\\\|/g,"|");return Be}function G(se,Oe,We){const Be=se.length;if(Be===0)return"";let At=0;for(;At<Be;){const te=se.charAt(Be-At-1);if(te===Oe&&!We)At++;else if(te!==Oe&&We)At++;else break}return se.substr(0,Be-At)}function fe(se,Oe){if(se.indexOf(Oe[1])===-1)return-1;const We=se.length;let Be=0,At=0;for(;At<We;At++)if(se[At]==="\\")At++;else if(se[At]===Oe[0])Be++;else if(se[At]===Oe[1]&&(Be--,Be<0))return At;return-1}function be(se){se&&se.sanitize&&!se.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 Se(se,Oe){if(Oe<1)return"";let We="";for(;Oe>1;)Oe&1&&(We+=se),Oe>>=1,se+=se;return We+se}Li.exports={escape:q,unescape:Te,edit:f,cleanUrl:k,resolveUrl:H,noopTest:j,merge:U,splitCells:$,rtrim:G,findClosingBracket:fe,checkSanitizeDeprecation:be,repeatString:Se}},75918:function(Li,It,oe){"use strict";oe.d(It,{Wi:function(){return S},Z0:function(){return Te},aU:function(){return q},eZ:function(){return f},wY:function(){return P}});var ce=oe(4348),De=oe(69323),Ze=oe(13268),ge=function(re,R,k,T){function M(O){return O instanceof k?O:new k(function(Y){Y(O)})}return new(k||(k=Promise))(function(O,Y){function H($){try{U(T.next($))}catch(G){Y(G)}}function j($){try{U(T.throw($))}catch(G){Y(G)}}function U($){$.done?O($.value):M($.value).then(H,j)}U((T=T.apply(re,R||[])).next())})};class q extends De.JT{constructor(R,k="",T="",M=!0,O){super(),this._onDidChange=this._register(new ce.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=R,this._label=k,this._cssClass=T,this._enabled=M,this._actionCallback=O}get id(){return this._id}get label(){return this._label}set label(R){this._setLabel(R)}_setLabel(R){this._label!==R&&(this._label=R,this._onDidChange.fire({label:R}))}get tooltip(){return this._tooltip||""}set tooltip(R){this._setTooltip(R)}_setTooltip(R){this._tooltip!==R&&(this._tooltip=R,this._onDidChange.fire({tooltip:R}))}get class(){return this._cssClass}set class(R){this._setClass(R)}_setClass(R){this._cssClass!==R&&(this._cssClass=R,this._onDidChange.fire({class:R}))}get enabled(){return this._enabled}set enabled(R){this._setEnabled(R)}_setEnabled(R){this._enabled!==R&&(this._enabled=R,this._onDidChange.fire({enabled:R}))}get checked(){return this._checked}set checked(R){this._setChecked(R)}_setChecked(R){this._checked!==R&&(this._checked=R,this._onDidChange.fire({checked:R}))}run(R,k){return ge(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(R))})}}class S extends De.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new ce.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new ce.Q5),this.onDidRun=this._onDidRun.event}run(R,k){return ge(this,void 0,void 0,function*(){if(!R.enabled)return;this._onBeforeRun.fire({action:R});let T;try{yield this.runAction(R,k)}catch(M){T=M}this._onDidRun.fire({action:R,error:T})})}runAction(R,k){return ge(this,void 0,void 0,function*(){yield R.run(k)})}}class Te extends q{constructor(R){super(Te.ID,R,R?"separator text":"separator"),this.checked=!1,this.enabled=!1}}Te.ID="vs.actions.separator";class P{constructor(R,k,T,M){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=R,this.label=k,this.class=M,this._actions=T}get actions(){return this._actions}dispose(){}run(){return ge(this,void 0,void 0,function*(){})}}class f extends q{constructor(){super(f.ID,Ze.N("submenu.empty","(empty)"),void 0,!1)}}f.ID="vs.actions.empty"},76068:function(Li,It,oe){"use strict";oe.d(It,{ok:function(){return ce}});function ce(De,Ze){if(!De)throw new Error(Ze?`Assertion failed (${Ze})`:"Assertion Failed")}},52615:function(Li,It,oe){"use strict";oe.d(It,{CM:function(){return q},JL:function(){return S},dT:function(){return P},fK:function(){return ge},lA:function(){return Te}});var ce=oe(4348);class De{constructor(){this._icons=new Map,this._onDidRegister=new ce.Q5}add(re){const R=this._icons.get(re.id);R?re.description?R.description=re.description:console.error(`Duplicate registration of codicon ${re.id}`):(this._icons.set(re.id,re),this._onDidRegister.fire(re))}get(re){return this._icons.get(re)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Ze=new De,ge=Ze;function q(f,re){return new Te(f,re)}function S(f){return f?f.replace(/\$\((.*?)\)/g,(re,R)=>` ${R} `).trim():""}class Te{constructor(re,R,k){this.id=re,this.definition=R,this.description=k,Ze.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var P;(function(f){f.iconNameSegment="[A-Za-z0-9]+",f.iconNameExpression="[A-Za-z0-9\\-]+",f.iconModifierExpression="~[A-Za-z]+";const re=new RegExp(`^(${f.iconNameExpression})(${f.iconModifierExpression})?$`);function R(M){if(M instanceof Te)return["codicon","codicon-"+M.id];const O=re.exec(M.id);if(!O)return R(Te.error);let[,Y,H]=O;const j=["codicon","codicon-"+Y];return H&&j.push("codicon-modifier-"+H.substr(1)),j}f.asClassNameArray=R;function k(M){return R(M).join(" ")}f.asClassName=k;function T(M){return"."+R(M).join(".")}f.asCSSSelector=T})(P||(P={})),function(f){f.add=new f("add",{fontCharacter:"\\ea60"}),f.plus=new f("plus",f.add.definition),f.gistNew=new f("gist-new",f.add.definition),f.repoCreate=new f("repo-create",f.add.definition),f.lightbulb=new f("lightbulb",{fontCharacter:"\\ea61"}),f.lightBulb=new f("light-bulb",{fontCharacter:"\\ea61"}),f.repo=new f("repo",{fontCharacter:"\\ea62"}),f.repoDelete=new f("repo-delete",{fontCharacter:"\\ea62"}),f.gistFork=new f("gist-fork",{fontCharacter:"\\ea63"}),f.repoForked=new f("repo-forked",{fontCharacter:"\\ea63"}),f.gitPullRequest=new f("git-pull-request",{fontCharacter:"\\ea64"}),f.gitPullRequestAbandoned=new f("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),f.recordKeys=new f("record-keys",{fontCharacter:"\\ea65"}),f.keyboard=new f("keyboard",{fontCharacter:"\\ea65"}),f.tag=new f("tag",{fontCharacter:"\\ea66"}),f.tagAdd=new f("tag-add",{fontCharacter:"\\ea66"}),f.tagRemove=new f("tag-remove",{fontCharacter:"\\ea66"}),f.person=new f("person",{fontCharacter:"\\ea67"}),f.personFollow=new f("person-follow",{fontCharacter:"\\ea67"}),f.personOutline=new f("person-outline",{fontCharacter:"\\ea67"}),f.personFilled=new f("person-filled",{fontCharacter:"\\ea67"}),f.gitBranch=new f("git-branch",{fontCharacter:"\\ea68"}),f.gitBranchCreate=new f("git-branch-create",{fontCharacter:"\\ea68"}),f.gitBranchDelete=new f("git-branch-delete",{fontCharacter:"\\ea68"}),f.sourceControl=new f("source-control",{fontCharacter:"\\ea68"}),f.mirror=new f("mirror",{fontCharacter:"\\ea69"}),f.mirrorPublic=new f("mirror-public",{fontCharacter:"\\ea69"}),f.star=new f("star",{fontCharacter:"\\ea6a"}),f.starAdd=new f("star-add",{fontCharacter:"\\ea6a"}),f.starDelete=new f("star-delete",{fontCharacter:"\\ea6a"}),f.starEmpty=new f("star-empty",{fontCharacter:"\\ea6a"}),f.comment=new f("comment",{fontCharacter:"\\ea6b"}),f.commentAdd=new f("comment-add",{fontCharacter:"\\ea6b"}),f.alert=new f("alert",{fontCharacter:"\\ea6c"}),f.warning=new f("warning",{fontCharacter:"\\ea6c"}),f.search=new f("search",{fontCharacter:"\\ea6d"}),f.searchSave=new f("search-save",{fontCharacter:"\\ea6d"}),f.logOut=new f("log-out",{fontCharacter:"\\ea6e"}),f.signOut=new f("sign-out",{fontCharacter:"\\ea6e"}),f.logIn=new f("log-in",{fontCharacter:"\\ea6f"}),f.signIn=new f("sign-in",{fontCharacter:"\\ea6f"}),f.eye=new f("eye",{fontCharacter:"\\ea70"}),f.eyeUnwatch=new f("eye-unwatch",{fontCharacter:"\\ea70"}),f.eyeWatch=new f("eye-watch",{fontCharacter:"\\ea70"}),f.circleFilled=new f("circle-filled",{fontCharacter:"\\ea71"}),f.primitiveDot=new f("primitive-dot",{fontCharacter:"\\ea71"}),f.closeDirty=new f("close-dirty",{fontCharacter:"\\ea71"}),f.debugBreakpoint=new f("debug-breakpoint",{fontCharacter:"\\ea71"}),f.debugBreakpointDisabled=new f("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),f.debugHint=new f("debug-hint",{fontCharacter:"\\ea71"}),f.primitiveSquare=new f("primitive-square",{fontCharacter:"\\ea72"}),f.edit=new f("edit",{fontCharacter:"\\ea73"}),f.pencil=new f("pencil",{fontCharacter:"\\ea73"}),f.info=new f("info",{fontCharacter:"\\ea74"}),f.issueOpened=new f("issue-opened",{fontCharacter:"\\ea74"}),f.gistPrivate=new f("gist-private",{fontCharacter:"\\ea75"}),f.gitForkPrivate=new f("git-fork-private",{fontCharacter:"\\ea75"}),f.lock=new f("lock",{fontCharacter:"\\ea75"}),f.mirrorPrivate=new f("mirror-private",{fontCharacter:"\\ea75"}),f.close=new f("close",{fontCharacter:"\\ea76"}),f.removeClose=new f("remove-close",{fontCharacter:"\\ea76"}),f.x=new f("x",{fontCharacter:"\\ea76"}),f.repoSync=new f("repo-sync",{fontCharacter:"\\ea77"}),f.sync=new f("sync",{fontCharacter:"\\ea77"}),f.clone=new f("clone",{fontCharacter:"\\ea78"}),f.desktopDownload=new f("desktop-download",{fontCharacter:"\\ea78"}),f.beaker=new f("beaker",{fontCharacter:"\\ea79"}),f.microscope=new f("microscope",{fontCharacter:"\\ea79"}),f.vm=new f("vm",{fontCharacter:"\\ea7a"}),f.deviceDesktop=new f("device-desktop",{fontCharacter:"\\ea7a"}),f.file=new f("file",{fontCharacter:"\\ea7b"}),f.fileText=new f("file-text",{fontCharacter:"\\ea7b"}),f.more=new f("more",{fontCharacter:"\\ea7c"}),f.ellipsis=new f("ellipsis",{fontCharacter:"\\ea7c"}),f.kebabHorizontal=new f("kebab-horizontal",{fontCharacter:"\\ea7c"}),f.mailReply=new f("mail-reply",{fontCharacter:"\\ea7d"}),f.reply=new f("reply",{fontCharacter:"\\ea7d"}),f.organization=new f("organization",{fontCharacter:"\\ea7e"}),f.organizationFilled=new f("organization-filled",{fontCharacter:"\\ea7e"}),f.organizationOutline=new f("organization-outline",{fontCharacter:"\\ea7e"}),f.newFile=new f("new-file",{fontCharacter:"\\ea7f"}),f.fileAdd=new f("file-add",{fontCharacter:"\\ea7f"}),f.newFolder=new f("new-folder",{fontCharacter:"\\ea80"}),f.fileDirectoryCreate=new f("file-directory-create",{fontCharacter:"\\ea80"}),f.trash=new f("trash",{fontCharacter:"\\ea81"}),f.trashcan=new f("trashcan",{fontCharacter:"\\ea81"}),f.history=new f("history",{fontCharacter:"\\ea82"}),f.clock=new f("clock",{fontCharacter:"\\ea82"}),f.folder=new f("folder",{fontCharacter:"\\ea83"}),f.fileDirectory=new f("file-directory",{fontCharacter:"\\ea83"}),f.symbolFolder=new f("symbol-folder",{fontCharacter:"\\ea83"}),f.logoGithub=new f("logo-github",{fontCharacter:"\\ea84"}),f.markGithub=new f("mark-github",{fontCharacter:"\\ea84"}),f.github=new f("github",{fontCharacter:"\\ea84"}),f.terminal=new f("terminal",{fontCharacter:"\\ea85"}),f.console=new f("console",{fontCharacter:"\\ea85"}),f.repl=new f("repl",{fontCharacter:"\\ea85"}),f.zap=new f("zap",{fontCharacter:"\\ea86"}),f.symbolEvent=new f("symbol-event",{fontCharacter:"\\ea86"}),f.error=new f("error",{fontCharacter:"\\ea87"}),f.stop=new f("stop",{fontCharacter:"\\ea87"}),f.variable=new f("variable",{fontCharacter:"\\ea88"}),f.symbolVariable=new f("symbol-variable",{fontCharacter:"\\ea88"}),f.array=new f("array",{fontCharacter:"\\ea8a"}),f.symbolArray=new f("symbol-array",{fontCharacter:"\\ea8a"}),f.symbolModule=new f("symbol-module",{fontCharacter:"\\ea8b"}),f.symbolPackage=new f("symbol-package",{fontCharacter:"\\ea8b"}),f.symbolNamespace=new f("symbol-namespace",{fontCharacter:"\\ea8b"}),f.symbolObject=new f("symbol-object",{fontCharacter:"\\ea8b"}),f.symbolMethod=new f("symbol-method",{fontCharacter:"\\ea8c"}),f.symbolFunction=new f("symbol-function",{fontCharacter:"\\ea8c"}),f.symbolConstructor=new f("symbol-constructor",{fontCharacter:"\\ea8c"}),f.symbolBoolean=new f("symbol-boolean",{fontCharacter:"\\ea8f"}),f.symbolNull=new f("symbol-null",{fontCharacter:"\\ea8f"}),f.symbolNumeric=new f("symbol-numeric",{fontCharacter:"\\ea90"}),f.symbolNumber=new f("symbol-number",{fontCharacter:"\\ea90"}),f.symbolStructure=new f("symbol-structure",{fontCharacter:"\\ea91"}),f.symbolStruct=new f("symbol-struct",{fontCharacter:"\\ea91"}),f.symbolParameter=new f("symbol-parameter",{fontCharacter:"\\ea92"}),f.symbolTypeParameter=new f("symbol-type-parameter",{fontCharacter:"\\ea92"}),f.symbolKey=new f("symbol-key",{fontCharacter:"\\ea93"}),f.symbolText=new f("symbol-text",{fontCharacter:"\\ea93"}),f.symbolReference=new f("symbol-reference",{fontCharacter:"\\ea94"}),f.goToFile=new f("go-to-file",{fontCharacter:"\\ea94"}),f.symbolEnum=new f("symbol-enum",{fontCharacter:"\\ea95"}),f.symbolValue=new f("symbol-value",{fontCharacter:"\\ea95"}),f.symbolRuler=new f("symbol-ruler",{fontCharacter:"\\ea96"}),f.symbolUnit=new f("symbol-unit",{fontCharacter:"\\ea96"}),f.activateBreakpoints=new f("activate-breakpoints",{fontCharacter:"\\ea97"}),f.archive=new f("archive",{fontCharacter:"\\ea98"}),f.arrowBoth=new f("arrow-both",{fontCharacter:"\\ea99"}),f.arrowDown=new f("arrow-down",{fontCharacter:"\\ea9a"}),f.arrowLeft=new f("arrow-left",{fontCharacter:"\\ea9b"}),f.arrowRight=new f("arrow-right",{fontCharacter:"\\ea9c"}),f.arrowSmallDown=new f("arrow-small-down",{fontCharacter:"\\ea9d"}),f.arrowSmallLeft=new f("arrow-small-left",{fontCharacter:"\\ea9e"}),f.arrowSmallRight=new f("arrow-small-right",{fontCharacter:"\\ea9f"}),f.arrowSmallUp=new f("arrow-small-up",{fontCharacter:"\\eaa0"}),f.arrowUp=new f("arrow-up",{fontCharacter:"\\eaa1"}),f.bell=new f("bell",{fontCharacter:"\\eaa2"}),f.bold=new f("bold",{fontCharacter:"\\eaa3"}),f.book=new f("book",{fontCharacter:"\\eaa4"}),f.bookmark=new f("bookmark",{fontCharacter:"\\eaa5"}),f.debugBreakpointConditionalUnverified=new f("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),f.debugBreakpointConditional=new f("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),f.debugBreakpointConditionalDisabled=new f("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),f.debugBreakpointDataUnverified=new f("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),f.debugBreakpointData=new f("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),f.debugBreakpointDataDisabled=new f("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),f.debugBreakpointLogUnverified=new f("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),f.debugBreakpointLog=new f("debug-breakpoint-log",{fontCharacter:"\\eaab"}),f.debugBreakpointLogDisabled=new f("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),f.briefcase=new f("briefcase",{fontCharacter:"\\eaac"}),f.broadcast=new f("broadcast",{fontCharacter:"\\eaad"}),f.browser=new f("browser",{fontCharacter:"\\eaae"}),f.bug=new f("bug",{fontCharacter:"\\eaaf"}),f.calendar=new f("calendar",{fontCharacter:"\\eab0"}),f.caseSensitive=new f("case-sensitive",{fontCharacter:"\\eab1"}),f.check=new f("check",{fontCharacter:"\\eab2"}),f.checklist=new f("checklist",{fontCharacter:"\\eab3"}),f.chevronDown=new f("chevron-down",{fontCharacter:"\\eab4"}),f.dropDownButton=new f("drop-down-button",f.chevronDown.definition),f.chevronLeft=new f("chevron-left",{fontCharacter:"\\eab5"}),f.chevronRight=new f("chevron-right",{fontCharacter:"\\eab6"}),f.chevronUp=new f("chevron-up",{fontCharacter:"\\eab7"}),f.chromeClose=new f("chrome-close",{fontCharacter:"\\eab8"}),f.chromeMaximize=new f("chrome-maximize",{fontCharacter:"\\eab9"}),f.chromeMinimize=new f("chrome-minimize",{fontCharacter:"\\eaba"}),f.chromeRestore=new f("chrome-restore",{fontCharacter:"\\eabb"}),f.circleOutline=new f("circle-outline",{fontCharacter:"\\eabc"}),f.debugBreakpointUnverified=new f("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),f.circleSlash=new f("circle-slash",{fontCharacter:"\\eabd"}),f.circuitBoard=new f("circuit-board",{fontCharacter:"\\eabe"}),f.clearAll=new f("clear-all",{fontCharacter:"\\eabf"}),f.clippy=new f("clippy",{fontCharacter:"\\eac0"}),f.closeAll=new f("close-all",{fontCharacter:"\\eac1"}),f.cloudDownload=new f("cloud-download",{fontCharacter:"\\eac2"}),f.cloudUpload=new f("cloud-upload",{fontCharacter:"\\eac3"}),f.code=new f("code",{fontCharacter:"\\eac4"}),f.collapseAll=new f("collapse-all",{fontCharacter:"\\eac5"}),f.colorMode=new f("color-mode",{fontCharacter:"\\eac6"}),f.commentDiscussion=new f("comment-discussion",{fontCharacter:"\\eac7"}),f.compareChanges=new f("compare-changes",{fontCharacter:"\\eafd"}),f.creditCard=new f("credit-card",{fontCharacter:"\\eac9"}),f.dash=new f("dash",{fontCharacter:"\\eacc"}),f.dashboard=new f("dashboard",{fontCharacter:"\\eacd"}),f.database=new f("database",{fontCharacter:"\\eace"}),f.debugContinue=new f("debug-continue",{fontCharacter:"\\eacf"}),f.debugDisconnect=new f("debug-disconnect",{fontCharacter:"\\ead0"}),f.debugPause=new f("debug-pause",{fontCharacter:"\\ead1"}),f.debugRestart=new f("debug-restart",{fontCharacter:"\\ead2"}),f.debugStart=new f("debug-start",{fontCharacter:"\\ead3"}),f.debugStepInto=new f("debug-step-into",{fontCharacter:"\\ead4"}),f.debugStepOut=new f("debug-step-out",{fontCharacter:"\\ead5"}),f.debugStepOver=new f("debug-step-over",{fontCharacter:"\\ead6"}),f.debugStop=new f("debug-stop",{fontCharacter:"\\ead7"}),f.debug=new f("debug",{fontCharacter:"\\ead8"}),f.deviceCameraVideo=new f("device-camera-video",{fontCharacter:"\\ead9"}),f.deviceCamera=new f("device-camera",{fontCharacter:"\\eada"}),f.deviceMobile=new f("device-mobile",{fontCharacter:"\\eadb"}),f.diffAdded=new f("diff-added",{fontCharacter:"\\eadc"}),f.diffIgnored=new f("diff-ignored",{fontCharacter:"\\eadd"}),f.diffModified=new f("diff-modified",{fontCharacter:"\\eade"}),f.diffRemoved=new f("diff-removed",{fontCharacter:"\\eadf"}),f.diffRenamed=new f("diff-renamed",{fontCharacter:"\\eae0"}),f.diff=new f("diff",{fontCharacter:"\\eae1"}),f.discard=new f("discard",{fontCharacter:"\\eae2"}),f.editorLayout=new f("editor-layout",{fontCharacter:"\\eae3"}),f.emptyWindow=new f("empty-window",{fontCharacter:"\\eae4"}),f.exclude=new f("exclude",{fontCharacter:"\\eae5"}),f.extensions=new f("extensions",{fontCharacter:"\\eae6"}),f.eyeClosed=new f("eye-closed",{fontCharacter:"\\eae7"}),f.fileBinary=new f("file-binary",{fontCharacter:"\\eae8"}),f.fileCode=new f("file-code",{fontCharacter:"\\eae9"}),f.fileMedia=new f("file-media",{fontCharacter:"\\eaea"}),f.filePdf=new f("file-pdf",{fontCharacter:"\\eaeb"}),f.fileSubmodule=new f("file-submodule",{fontCharacter:"\\eaec"}),f.fileSymlinkDirectory=new f("file-symlink-directory",{fontCharacter:"\\eaed"}),f.fileSymlinkFile=new f("file-symlink-file",{fontCharacter:"\\eaee"}),f.fileZip=new f("file-zip",{fontCharacter:"\\eaef"}),f.files=new f("files",{fontCharacter:"\\eaf0"}),f.filter=new f("filter",{fontCharacter:"\\eaf1"}),f.flame=new f("flame",{fontCharacter:"\\eaf2"}),f.foldDown=new f("fold-down",{fontCharacter:"\\eaf3"}),f.foldUp=new f("fold-up",{fontCharacter:"\\eaf4"}),f.fold=new f("fold",{fontCharacter:"\\eaf5"}),f.folderActive=new f("folder-active",{fontCharacter:"\\eaf6"}),f.folderOpened=new f("folder-opened",{fontCharacter:"\\eaf7"}),f.gear=new f("gear",{fontCharacter:"\\eaf8"}),f.gift=new f("gift",{fontCharacter:"\\eaf9"}),f.gistSecret=new f("gist-secret",{fontCharacter:"\\eafa"}),f.gist=new f("gist",{fontCharacter:"\\eafb"}),f.gitCommit=new f("git-commit",{fontCharacter:"\\eafc"}),f.gitCompare=new f("git-compare",{fontCharacter:"\\eafd"}),f.gitMerge=new f("git-merge",{fontCharacter:"\\eafe"}),f.githubAction=new f("github-action",{fontCharacter:"\\eaff"}),f.githubAlt=new f("github-alt",{fontCharacter:"\\eb00"}),f.globe=new f("globe",{fontCharacter:"\\eb01"}),f.grabber=new f("grabber",{fontCharacter:"\\eb02"}),f.graph=new f("graph",{fontCharacter:"\\eb03"}),f.gripper=new f("gripper",{fontCharacter:"\\eb04"}),f.heart=new f("heart",{fontCharacter:"\\eb05"}),f.home=new f("home",{fontCharacter:"\\eb06"}),f.horizontalRule=new f("horizontal-rule",{fontCharacter:"\\eb07"}),f.hubot=new f("hubot",{fontCharacter:"\\eb08"}),f.inbox=new f("inbox",{fontCharacter:"\\eb09"}),f.issueClosed=new f("issue-closed",{fontCharacter:"\\eba4"}),f.issueReopened=new f("issue-reopened",{fontCharacter:"\\eb0b"}),f.issues=new f("issues",{fontCharacter:"\\eb0c"}),f.italic=new f("italic",{fontCharacter:"\\eb0d"}),f.jersey=new f("jersey",{fontCharacter:"\\eb0e"}),f.json=new f("json",{fontCharacter:"\\eb0f"}),f.kebabVertical=new f("kebab-vertical",{fontCharacter:"\\eb10"}),f.key=new f("key",{fontCharacter:"\\eb11"}),f.law=new f("law",{fontCharacter:"\\eb12"}),f.lightbulbAutofix=new f("lightbulb-autofix",{fontCharacter:"\\eb13"}),f.linkExternal=new f("link-external",{fontCharacter:"\\eb14"}),f.link=new f("link",{fontCharacter:"\\eb15"}),f.listOrdered=new f("list-ordered",{fontCharacter:"\\eb16"}),f.listUnordered=new f("list-unordered",{fontCharacter:"\\eb17"}),f.liveShare=new f("live-share",{fontCharacter:"\\eb18"}),f.loading=new f("loading",{fontCharacter:"\\eb19"}),f.location=new f("location",{fontCharacter:"\\eb1a"}),f.mailRead=new f("mail-read",{fontCharacter:"\\eb1b"}),f.mail=new f("mail",{fontCharacter:"\\eb1c"}),f.markdown=new f("markdown",{fontCharacter:"\\eb1d"}),f.megaphone=new f("megaphone",{fontCharacter:"\\eb1e"}),f.mention=new f("mention",{fontCharacter:"\\eb1f"}),f.milestone=new f("milestone",{fontCharacter:"\\eb20"}),f.mortarBoard=new f("mortar-board",{fontCharacter:"\\eb21"}),f.move=new f("move",{fontCharacter:"\\eb22"}),f.multipleWindows=new f("multiple-windows",{fontCharacter:"\\eb23"}),f.mute=new f("mute",{fontCharacter:"\\eb24"}),f.noNewline=new f("no-newline",{fontCharacter:"\\eb25"}),f.note=new f("note",{fontCharacter:"\\eb26"}),f.octoface=new f("octoface",{fontCharacter:"\\eb27"}),f.openPreview=new f("open-preview",{fontCharacter:"\\eb28"}),f.package_=new f("package",{fontCharacter:"\\eb29"}),f.paintcan=new f("paintcan",{fontCharacter:"\\eb2a"}),f.pin=new f("pin",{fontCharacter:"\\eb2b"}),f.play=new f("play",{fontCharacter:"\\eb2c"}),f.run=new f("run",{fontCharacter:"\\eb2c"}),f.plug=new f("plug",{fontCharacter:"\\eb2d"}),f.preserveCase=new f("preserve-case",{fontCharacter:"\\eb2e"}),f.preview=new f("preview",{fontCharacter:"\\eb2f"}),f.project=new f("project",{fontCharacter:"\\eb30"}),f.pulse=new f("pulse",{fontCharacter:"\\eb31"}),f.question=new f("question",{fontCharacter:"\\eb32"}),f.quote=new f("quote",{fontCharacter:"\\eb33"}),f.radioTower=new f("radio-tower",{fontCharacter:"\\eb34"}),f.reactions=new f("reactions",{fontCharacter:"\\eb35"}),f.references=new f("references",{fontCharacter:"\\eb36"}),f.refresh=new f("refresh",{fontCharacter:"\\eb37"}),f.regex=new f("regex",{fontCharacter:"\\eb38"}),f.remoteExplorer=new f("remote-explorer",{fontCharacter:"\\eb39"}),f.remote=new f("remote",{fontCharacter:"\\eb3a"}),f.remove=new f("remove",{fontCharacter:"\\eb3b"}),f.replaceAll=new f("replace-all",{fontCharacter:"\\eb3c"}),f.replace=new f("replace",{fontCharacter:"\\eb3d"}),f.repoClone=new f("repo-clone",{fontCharacter:"\\eb3e"}),f.repoForcePush=new f("repo-force-push",{fontCharacter:"\\eb3f"}),f.repoPull=new f("repo-pull",{fontCharacter:"\\eb40"}),f.repoPush=new f("repo-push",{fontCharacter:"\\eb41"}),f.report=new f("report",{fontCharacter:"\\eb42"}),f.requestChanges=new f("request-changes",{fontCharacter:"\\eb43"}),f.rocket=new f("rocket",{fontCharacter:"\\eb44"}),f.rootFolderOpened=new f("root-folder-opened",{fontCharacter:"\\eb45"}),f.rootFolder=new f("root-folder",{fontCharacter:"\\eb46"}),f.rss=new f("rss",{fontCharacter:"\\eb47"}),f.ruby=new f("ruby",{fontCharacter:"\\eb48"}),f.saveAll=new f("save-all",{fontCharacter:"\\eb49"}),f.saveAs=new f("save-as",{fontCharacter:"\\eb4a"}),f.save=new f("save",{fontCharacter:"\\eb4b"}),f.screenFull=new f("screen-full",{fontCharacter:"\\eb4c"}),f.screenNormal=new f("screen-normal",{fontCharacter:"\\eb4d"}),f.searchStop=new f("search-stop",{fontCharacter:"\\eb4e"}),f.server=new f("server",{fontCharacter:"\\eb50"}),f.settingsGear=new f("settings-gear",{fontCharacter:"\\eb51"}),f.settings=new f("settings",{fontCharacter:"\\eb52"}),f.shield=new f("shield",{fontCharacter:"\\eb53"}),f.smiley=new f("smiley",{fontCharacter:"\\eb54"}),f.sortPrecedence=new f("sort-precedence",{fontCharacter:"\\eb55"}),f.splitHorizontal=new f("split-horizontal",{fontCharacter:"\\eb56"}),f.splitVertical=new f("split-vertical",{fontCharacter:"\\eb57"}),f.squirrel=new f("squirrel",{fontCharacter:"\\eb58"}),f.starFull=new f("star-full",{fontCharacter:"\\eb59"}),f.starHalf=new f("star-half",{fontCharacter:"\\eb5a"}),f.symbolClass=new f("symbol-class",{fontCharacter:"\\eb5b"}),f.symbolColor=new f("symbol-color",{fontCharacter:"\\eb5c"}),f.symbolConstant=new f("symbol-constant",{fontCharacter:"\\eb5d"}),f.symbolEnumMember=new f("symbol-enum-member",{fontCharacter:"\\eb5e"}),f.symbolField=new f("symbol-field",{fontCharacter:"\\eb5f"}),f.symbolFile=new f("symbol-file",{fontCharacter:"\\eb60"}),f.symbolInterface=new f("symbol-interface",{fontCharacter:"\\eb61"}),f.symbolKeyword=new f("symbol-keyword",{fontCharacter:"\\eb62"}),f.symbolMisc=new f("symbol-misc",{fontCharacter:"\\eb63"}),f.symbolOperator=new f("symbol-operator",{fontCharacter:"\\eb64"}),f.symbolProperty=new f("symbol-property",{fontCharacter:"\\eb65"}),f.wrench=new f("wrench",{fontCharacter:"\\eb65"}),f.wrenchSubaction=new f("wrench-subaction",{fontCharacter:"\\eb65"}),f.symbolSnippet=new f("symbol-snippet",{fontCharacter:"\\eb66"}),f.tasklist=new f("tasklist",{fontCharacter:"\\eb67"}),f.telescope=new f("telescope",{fontCharacter:"\\eb68"}),f.textSize=new f("text-size",{fontCharacter:"\\eb69"}),f.threeBars=new f("three-bars",{fontCharacter:"\\eb6a"}),f.thumbsdown=new f("thumbsdown",{fontCharacter:"\\eb6b"}),f.thumbsup=new f("thumbsup",{fontCharacter:"\\eb6c"}),f.tools=new f("tools",{fontCharacter:"\\eb6d"}),f.triangleDown=new f("triangle-down",{fontCharacter:"\\eb6e"}),f.triangleLeft=new f("triangle-left",{fontCharacter:"\\eb6f"}),f.triangleRight=new f("triangle-right",{fontCharacter:"\\eb70"}),f.triangleUp=new f("triangle-up",{fontCharacter:"\\eb71"}),f.twitter=new f("twitter",{fontCharacter:"\\eb72"}),f.unfold=new f("unfold",{fontCharacter:"\\eb73"}),f.unlock=new f("unlock",{fontCharacter:"\\eb74"}),f.unmute=new f("unmute",{fontCharacter:"\\eb75"}),f.unverified=new f("unverified",{fontCharacter:"\\eb76"}),f.verified=new f("verified",{fontCharacter:"\\eb77"}),f.versions=new f("versions",{fontCharacter:"\\eb78"}),f.vmActive=new f("vm-active",{fontCharacter:"\\eb79"}),f.vmOutline=new f("vm-outline",{fontCharacter:"\\eb7a"}),f.vmRunning=new f("vm-running",{fontCharacter:"\\eb7b"}),f.watch=new f("watch",{fontCharacter:"\\eb7c"}),f.whitespace=new f("whitespace",{fontCharacter:"\\eb7d"}),f.wholeWord=new f("whole-word",{fontCharacter:"\\eb7e"}),f.window=new f("window",{fontCharacter:"\\eb7f"}),f.wordWrap=new f("word-wrap",{fontCharacter:"\\eb80"}),f.zoomIn=new f("zoom-in",{fontCharacter:"\\eb81"}),f.zoomOut=new f("zoom-out",{fontCharacter:"\\eb82"}),f.listFilter=new f("list-filter",{fontCharacter:"\\eb83"}),f.listFlat=new f("list-flat",{fontCharacter:"\\eb84"}),f.listSelection=new f("list-selection",{fontCharacter:"\\eb85"}),f.selection=new f("selection",{fontCharacter:"\\eb85"}),f.listTree=new f("list-tree",{fontCharacter:"\\eb86"}),f.debugBreakpointFunctionUnverified=new f("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),f.debugBreakpointFunction=new f("debug-breakpoint-function",{fontCharacter:"\\eb88"}),f.debugBreakpointFunctionDisabled=new f("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),f.debugStackframeActive=new f("debug-stackframe-active",{fontCharacter:"\\eb89"}),f.debugStackframeDot=new f("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),f.debugStackframe=new f("debug-stackframe",{fontCharacter:"\\eb8b"}),f.debugStackframeFocused=new f("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),f.debugBreakpointUnsupported=new f("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),f.symbolString=new f("symbol-string",{fontCharacter:"\\eb8d"}),f.debugReverseContinue=new f("debug-reverse-continue",{fontCharacter:"\\eb8e"}),f.debugStepBack=new f("debug-step-back",{fontCharacter:"\\eb8f"}),f.debugRestartFrame=new f("debug-restart-frame",{fontCharacter:"\\eb90"}),f.callIncoming=new f("call-incoming",{fontCharacter:"\\eb92"}),f.callOutgoing=new f("call-outgoing",{fontCharacter:"\\eb93"}),f.menu=new f("menu",{fontCharacter:"\\eb94"}),f.expandAll=new f("expand-all",{fontCharacter:"\\eb95"}),f.feedback=new f("feedback",{fontCharacter:"\\eb96"}),f.groupByRefType=new f("group-by-ref-type",{fontCharacter:"\\eb97"}),f.ungroupByRefType=new f("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),f.account=new f("account",{fontCharacter:"\\eb99"}),f.bellDot=new f("bell-dot",{fontCharacter:"\\eb9a"}),f.debugConsole=new f("debug-console",{fontCharacter:"\\eb9b"}),f.library=new f("library",{fontCharacter:"\\eb9c"}),f.output=new f("output",{fontCharacter:"\\eb9d"}),f.runAll=new f("run-all",{fontCharacter:"\\eb9e"}),f.syncIgnored=new f("sync-ignored",{fontCharacter:"\\eb9f"}),f.pinned=new f("pinned",{fontCharacter:"\\eba0"}),f.githubInverted=new f("github-inverted",{fontCharacter:"\\eba1"}),f.debugAlt=new f("debug-alt",{fontCharacter:"\\eb91"}),f.serverProcess=new f("server-process",{fontCharacter:"\\eba2"}),f.serverEnvironment=new f("server-environment",{fontCharacter:"\\eba3"}),f.pass=new f("pass",{fontCharacter:"\\eba4"}),f.stopCircle=new f("stop-circle",{fontCharacter:"\\eba5"}),f.playCircle=new f("play-circle",{fontCharacter:"\\eba6"}),f.record=new f("record",{fontCharacter:"\\eba7"}),f.debugAltSmall=new f("debug-alt-small",{fontCharacter:"\\eba8"}),f.vmConnect=new f("vm-connect",{fontCharacter:"\\eba9"}),f.cloud=new f("cloud",{fontCharacter:"\\ebaa"}),f.merge=new f("merge",{fontCharacter:"\\ebab"}),f.exportIcon=new f("export",{fontCharacter:"\\ebac"}),f.graphLeft=new f("graph-left",{fontCharacter:"\\ebad"}),f.magnet=new f("magnet",{fontCharacter:"\\ebae"}),f.notebook=new f("notebook",{fontCharacter:"\\ebaf"}),f.redo=new f("redo",{fontCharacter:"\\ebb0"}),f.checkAll=new f("check-all",{fontCharacter:"\\ebb1"}),f.pinnedDirty=new f("pinned-dirty",{fontCharacter:"\\ebb2"}),f.passFilled=new f("pass-filled",{fontCharacter:"\\ebb3"}),f.circleLargeFilled=new f("circle-large-filled",{fontCharacter:"\\ebb4"}),f.circleLargeOutline=new f("circle-large-outline",{fontCharacter:"\\ebb5"}),f.combine=new f("combine",{fontCharacter:"\\ebb6"}),f.gather=new f("gather",{fontCharacter:"\\ebb6"}),f.table=new f("table",{fontCharacter:"\\ebb7"}),f.variableGroup=new f("variable-group",{fontCharacter:"\\ebb8"}),f.typeHierarchy=new f("type-hierarchy",{fontCharacter:"\\ebb9"}),f.typeHierarchySub=new f("type-hierarchy-sub",{fontCharacter:"\\ebba"}),f.typeHierarchySuper=new f("type-hierarchy-super",{fontCharacter:"\\ebbb"}),f.gitPullRequestCreate=new f("git-pull-request-create",{fontCharacter:"\\ebbc"}),f.runAbove=new f("run-above",{fontCharacter:"\\ebbd"}),f.runBelow=new f("run-below",{fontCharacter:"\\ebbe"}),f.notebookTemplate=new f("notebook-template",{fontCharacter:"\\ebbf"}),f.debugRerun=new f("debug-rerun",{fontCharacter:"\\ebc0"}),f.workspaceTrusted=new f("workspace-trusted",{fontCharacter:"\\ebc1"}),f.workspaceUntrusted=new f("workspace-untrusted",{fontCharacter:"\\ebc2"}),f.workspaceUnspecified=new f("workspace-unspecified",{fontCharacter:"\\ebc3"}),f.terminalCmd=new f("terminal-cmd",{fontCharacter:"\\ebc4"}),f.terminalDebian=new f("terminal-debian",{fontCharacter:"\\ebc5"}),f.terminalLinux=new f("terminal-linux",{fontCharacter:"\\ebc6"}),f.terminalPowershell=new f("terminal-powershell",{fontCharacter:"\\ebc7"}),f.terminalTmux=new f("terminal-tmux",{fontCharacter:"\\ebc8"}),f.terminalUbuntu=new f("terminal-ubuntu",{fontCharacter:"\\ebc9"}),f.terminalBash=new f("terminal-bash",{fontCharacter:"\\ebca"}),f.arrowSwap=new f("arrow-swap",{fontCharacter:"\\ebcb"}),f.copy=new f("copy",{fontCharacter:"\\ebcc"}),f.personAdd=new f("person-add",{fontCharacter:"\\ebcd"}),f.filterFilled=new f("filter-filled",{fontCharacter:"\\ebce"}),f.wand=new f("wand",{fontCharacter:"\\ebcf"}),f.debugLineByLine=new f("debug-line-by-line",{fontCharacter:"\\ebd0"}),f.inspect=new f("inspect",{fontCharacter:"\\ebd1"}),f.layers=new f("layers",{fontCharacter:"\\ebd2"}),f.layersDot=new f("layers-dot",{fontCharacter:"\\ebd3"}),f.layersActive=new f("layers-active",{fontCharacter:"\\ebd4"}),f.compass=new f("compass",{fontCharacter:"\\ebd5"}),f.compassDot=new f("compass-dot",{fontCharacter:"\\ebd6"}),f.compassActive=new f("compass-active",{fontCharacter:"\\ebd7"}),f.azure=new f("azure",{fontCharacter:"\\ebd8"}),f.issueDraft=new f("issue-draft",{fontCharacter:"\\ebd9"}),f.gitPullRequestClosed=new f("git-pull-request-closed",{fontCharacter:"\\ebda"}),f.gitPullRequestDraft=new f("git-pull-request-draft",{fontCharacter:"\\ebdb"}),f.debugAll=new f("debug-all",{fontCharacter:"\\ebdc"}),f.debugCoverage=new f("debug-coverage",{fontCharacter:"\\ebdd"}),f.runErrors=new f("run-errors",{fontCharacter:"\\ebde"}),f.folderLibrary=new f("folder-library",{fontCharacter:"\\ebdf"}),f.debugContinueSmall=new f("debug-continue-small",{fontCharacter:"\\ebe0"}),f.beakerStop=new f("beaker-stop",{fontCharacter:"\\ebe1"}),f.graphLine=new f("graph-line",{fontCharacter:"\\ebe2"}),f.graphScatter=new f("graph-scatter",{fontCharacter:"\\ebe3"}),f.pieChart=new f("pie-chart",{fontCharacter:"\\ebe4"}),f.bracket=new f("bracket",f.json.definition),f.bracketDot=new f("bracket-dot",{fontCharacter:"\\ebe5"}),f.bracketError=new f("bracket-error",{fontCharacter:"\\ebe6"}),f.lockSmall=new f("lock-small",{fontCharacter:"\\ebe7"}),f.azureDevops=new f("azure-devops",{fontCharacter:"\\ebe8"}),f.verifiedFilled=new f("verified-filled",{fontCharacter:"\\ebe9"})}(Te||(Te={}))},79881:function(Li,It,oe){"use strict";oe.d(It,{B8:function(){return R},Cp:function(){return ge},F0:function(){return P},L6:function(){return re},VV:function(){return Te},b1:function(){return f},dL:function(){return Ze},ri:function(){return q}});class ce{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(T){setTimeout(()=>{throw T.stack?new Error(T.message+`
|
|
|
|
|
|
`+T.stack):T},0)}}emit(T){this.listeners.forEach(M=>{M(T)})}onUnexpectedError(T){this.unexpectedErrorHandler(T),this.emit(T)}onUnexpectedExternalError(T){this.unexpectedErrorHandler(T)}}const De=new ce;function Ze(k){Te(k)||De.onUnexpectedError(k)}function ge(k){Te(k)||De.onUnexpectedExternalError(k)}function q(k){if(k instanceof Error){let{name:T,message:M}=k;const O=k.stacktrace||k.stack;return{$isError:!0,name:T,message:M,stack:O}}return k}const S="Canceled";function Te(k){return k instanceof Error&&k.name===S&&k.message===S}function P(){const k=new Error(S);return k.name=k.message,k}function f(k){return k?new Error(`Illegal argument: ${k}`):new Error("Illegal argument")}function re(k){return k?new Error(`Illegal state: ${k}`):new Error("Illegal state")}class R extends Error{constructor(T){super("NotSupported"),T&&(this.message=T)}}},4348:function(Li,It,oe){"use strict";oe.d(It,{D0:function(){return R},E7:function(){return k},K3:function(){return re},Q5:function(){return f},ZD:function(){return T},ju:function(){return q}});var ce=oe(79881),De=oe(69323),Ze=oe(34502),ge=oe(95830),q;(function(M){M.None=()=>De.JT.None;function O(X){return(Q,de=null,ie)=>{let A=!1,L;return L=X(V=>{if(!A)return L?L.dispose():A=!0,Q.call(de,V)},null,ie),A&&L.dispose(),L}}M.once=O;function Y(X,Q){return fe((de,ie=null,A)=>X(L=>de.call(ie,Q(L)),null,A))}M.map=Y;function H(X,Q){return fe((de,ie=null,A)=>X(L=>{Q(L),de.call(ie,L)},null,A))}M.forEach=H;function j(X,Q){return fe((de,ie=null,A)=>X(L=>Q(L)&&de.call(ie,L),null,A))}M.filter=j;function U(X){return X}M.signal=U;function $(...X){return(Q,de=null,ie)=>(0,De.F8)(...X.map(A=>A(L=>Q.call(de,L),null,ie)))}M.any=$;function G(X,Q,de){let ie=de;return Y(X,A=>(ie=Q(ie,A),ie))}M.reduce=G;function fe(X){let Q;const de=new f({onFirstListenerAdd(){Q=X(de.fire,de)},onLastListenerRemove(){Q.dispose()}});return de.event}function be(X,Q,de=100,ie=!1,A){let L,V,pe,ze=0;const at=new f({leakWarningThreshold:A,onFirstListenerAdd(){L=X(Bt=>{ze++,V=Q(V,Bt),ie&&!pe&&(at.fire(V),V=void 0),clearTimeout(pe),pe=setTimeout(()=>{const Me=V;V=void 0,pe=void 0,(!ie||ze>1)&&at.fire(Me),ze=0},de)})},onLastListenerRemove(){L.dispose()}});return at.event}M.debounce=be;function Se(X,Q=(de,ie)=>de===ie){let de=!0,ie;return j(X,A=>{const L=de||!Q(A,ie);return de=!1,ie=A,L})}M.latch=Se;function se(X,Q){return[M.filter(X,Q),M.filter(X,de=>!Q(de))]}M.split=se;function Oe(X,Q=!1,de=[]){let ie=de.slice(),A=X(pe=>{ie?ie.push(pe):V.fire(pe)});const L=()=>{ie&&ie.forEach(pe=>V.fire(pe)),ie=null},V=new f({onFirstListenerAdd(){A||(A=X(pe=>V.fire(pe)))},onFirstListenerDidAdd(){ie&&(Q?setTimeout(L):L())},onLastListenerRemove(){A&&A.dispose(),A=null}});return V.event}M.buffer=Oe;class We{constructor(Q){this.event=Q}map(Q){return new We(Y(this.event,Q))}forEach(Q){return new We(H(this.event,Q))}filter(Q){return new We(j(this.event,Q))}reduce(Q,de){return new We(G(this.event,Q,de))}latch(){return new We(Se(this.event))}debounce(Q,de=100,ie=!1,A){return new We(be(this.event,Q,de,ie,A))}on(Q,de,ie){return this.event(Q,de,ie)}once(Q,de,ie){return O(this.event)(Q,de,ie)}}function Be(X){return new We(X)}M.chain=Be;function At(X,Q,de=ie=>ie){const ie=(...pe)=>V.fire(de(...pe)),A=()=>X.on(Q,ie),L=()=>X.removeListener(Q,ie),V=new f({onFirstListenerAdd:A,onLastListenerRemove:L});return V.event}M.fromNodeEventEmitter=At;function te(X,Q,de=ie=>ie){const ie=(...pe)=>V.fire(de(...pe)),A=()=>X.addEventListener(Q,ie),L=()=>X.removeEventListener(Q,ie),V=new f({onFirstListenerAdd:A,onLastListenerRemove:L});return V.event}M.fromDOMEventEmitter=te;function z(X){return new Promise(Q=>O(X)(Q))}M.toPromise=z})(q||(q={}));class S{constructor(O){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${O}_${S._idPool++}`}start(O){this._stopWatch=new ge.G(!0),this._listenerCount=O}stop(){if(this._stopWatch){const O=this._stopWatch.elapsed();this._elapsedOverall+=O,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${O.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}S._idPool=0;let Te=-1;class P{constructor(O,Y=Math.random().toString(18).slice(2,5)){this.customThreshold=O,this.name=Y,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(O){let Y=Te;if(typeof this.customThreshold=="number"&&(Y=this.customThreshold),Y<=0||O<Y)return;this._stacks||(this._stacks=new Map);const H=new Error().stack.split(`
|
|
|
`).slice(3).join(`
|
|
|
`),j=this._stacks.get(H)||0;if(this._stacks.set(H,j+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=Y*.5;let U,$=0;for(const[G,fe]of this._stacks)(!U||$<fe)&&(U=G,$=fe);console.warn(`[${this.name}] potential listener LEAK detected, having ${O} listeners already. MOST frequent listener (${$}):`),console.warn(U)}return()=>{const U=this._stacks.get(H)||0;this._stacks.set(H,U-1)}}}class f{constructor(O){var Y;this._disposed=!1,this._options=O,this._leakageMon=Te>0?new P(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((Y=this._options)===null||Y===void 0)&&Y._profName?new S(this._options._profName):void 0}get event(){return this._event||(this._event=(O,Y,H)=>{var j;this._listeners||(this._listeners=new Ze.S);const U=this._listeners.isEmpty();U&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const $=this._listeners.push(Y?[O,Y]:O);U&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,O,Y);const G=(j=this._leakageMon)===null||j===void 0?void 0:j.check(this._listeners.size),fe=(0,De.OF)(()=>{G&&G(),this._disposed||($(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return H instanceof De.SL?H.add(fe):Array.isArray(H)&&H.push(fe),fe}),this._event}fire(O){var Y,H;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Ze.S);for(let j of this._listeners)this._deliveryQueue.push([j,O]);for((Y=this._perfMon)===null||Y===void 0||Y.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[j,U]=this._deliveryQueue.shift();try{typeof j=="function"?j.call(void 0,U):j[0].call(j[1],U)}catch($){(0,ce.dL)($)}}(H=this._perfMon)===null||H===void 0||H.stop()}}dispose(){var O,Y,H,j,U;this._disposed||(this._disposed=!0,(O=this._listeners)===null||O===void 0||O.clear(),(Y=this._deliveryQueue)===null||Y===void 0||Y.clear(),(j=(H=this._options)===null||H===void 0?void 0:H.onLastListenerRemove)===null||j===void 0||j.call(H),(U=this._leakageMon)===null||U===void 0||U.dispose())}}class re extends f{constructor(O){super(O),this._isPaused=0,this._eventQueue=new Ze.S,this._mergeFn=O==null?void 0:O.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const O=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(O))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(O){this._listeners&&(this._isPaused!==0?this._eventQueue.push(O):super.fire(O))}}class R extends re{constructor(O){var Y;super(O),this._delay=(Y=O.delay)!==null&&Y!==void 0?Y:100}fire(O){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(O)}}class k{constructor(){this.buffers=[]}wrapEvent(O){return(Y,H,j)=>O(U=>{const $=this.buffers[this.buffers.length-1];$?$.push(()=>Y.call(H,U)):Y.call(H,U)},void 0,j)}bufferEvents(O){const Y=[];this.buffers.push(Y);const H=O();return this.buffers.pop(),Y.forEach(j=>j()),H}}class T{constructor(){this.listening=!1,this.inputEvent=q.None,this.inputEventListener=De.JT.None,this.emitter=new f({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(O){this.inputEvent=O,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=O(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Li,It,oe){"use strict";oe.d(It,{I:function(){return ce}});function ce(De){const Ze=this;let ge=!1,q;return function(){return ge||(ge=!0,q=De.apply(Ze,arguments)),q}}},88226:function(Li,It,oe){"use strict";oe.d(It,{$:function(){return ce}});var ce;(function(De){function Ze($){return $&&typeof $=="object"&&typeof $[Symbol.iterator]=="function"}De.is=Ze;const ge=Object.freeze([]);function q(){return ge}De.empty=q;function*S($){yield $}De.single=S;function Te($){return $||ge}De.from=Te;function P($){return!$||$[Symbol.iterator]().next().done===!0}De.isEmpty=P;function f($){return $[Symbol.iterator]().next().value}De.first=f;function re($,G){for(const fe of $)if(G(fe))return!0;return!1}De.some=re;function R($,G){for(const fe of $)if(G(fe))return fe}De.find=R;function*k($,G){for(const fe of $)G(fe)&&(yield fe)}De.filter=k;function*T($,G){let fe=0;for(const be of $)yield G(be,fe++)}De.map=T;function*M(...$){for(const G of $)for(const fe of G)yield fe}De.concat=M;function*O($){for(const G of $)for(const fe of G)yield fe}De.concatNested=O;function Y($,G,fe){let be=fe;for(const Se of $)be=G(be,Se);return be}De.reduce=Y;function*H($,G,fe=$.length){for(G<0&&(G+=$.length),fe<0?fe+=$.length:fe>$.length&&(fe=$.length);G<fe;G++)yield $[G]}De.slice=H;function j($,G=Number.POSITIVE_INFINITY){const fe=[];if(G===0)return[fe,$];const be=$[Symbol.iterator]();for(let Se=0;Se<G;Se++){const se=be.next();if(se.done)return[fe,De.empty()];fe.push(se.value)}return[fe,{[Symbol.iterator](){return be}}]}De.consume=j;function U($,G,fe=(be,Se)=>be===Se){const be=$[Symbol.iterator](),Se=G[Symbol.iterator]();for(;;){const se=be.next(),Oe=Se.next();if(se.done!==Oe.done)return!1;if(se.done)return!0;if(!fe(se.value,Oe.value))return!1}}De.equals=U})(ce||(ce={}))},69323:function(Li,It,oe){"use strict";oe.d(It,{B9:function(){return T},F8:function(){return M},JT:function(){return H},Jz:function(){return U},OF:function(){return O},SL:function(){return Y},Wf:function(){return k},XK:function(){return j},dk:function(){return re}});var ce=oe(17845),De=oe(88226);const Ze=!1;let ge=null;function q($){ge=$}if(Ze){const $="__is_disposable_tracked__";q(new class{trackDisposable(G){const fe=new Error("Potentially leaked disposable").stack;setTimeout(()=>{G[$]||console.log(fe)},3e3)}setParent(G,fe){if(G&&G!==H.None)try{G[$]=!0}catch(be){}}markAsDisposed(G){if(G&&G!==H.None)try{G[$]=!0}catch(fe){}}markAsSingleton(G){}})}function S($){return ge==null||ge.trackDisposable($),$}function Te($){ge==null||ge.markAsDisposed($)}function P($,G){ge==null||ge.setParent($,G)}function f($,G){if(ge)for(const fe of $)ge.setParent(fe,G)}function re($){return ge==null||ge.markAsSingleton($),$}class R extends Error{constructor(G){super(`Encountered errors while disposing of store. Errors: [${G.join(", ")}]`),this.errors=G}}function k($){return typeof $.dispose=="function"&&$.dispose.length===0}function T($){if(De.$.is($)){let G=[];for(const fe of $)if(fe)try{fe.dispose()}catch(be){G.push(be)}if(G.length===1)throw G[0];if(G.length>1)throw new R(G);return Array.isArray($)?[]:$}else if($)return $.dispose(),$}function M(...$){const G=O(()=>T($));return f($,G),G}function O($){const G=S({dispose:(0,ce.I)(()=>{Te(G),$()})});return G}class Y{constructor(){this._toDispose=new Set,this._isDisposed=!1,S(this)}dispose(){this._isDisposed||(Te(this),this._isDisposed=!0,this.clear())}clear(){try{T(this._toDispose.values())}finally{this._toDispose.clear()}}add(G){if(!G)return G;if(G===this)throw new Error("Cannot register a disposable on itself!");return P(G,this),this._isDisposed?Y.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(G),G}}Y.DISABLE_DISPOSED_WARNING=!1;class H{constructor(){this._store=new Y,S(this),P(this._store,this)}dispose(){Te(this),this._store.dispose()}_register(G){if(G===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(G)}}H.None=Object.freeze({dispose(){}});class j{constructor(){this._isDisposed=!1,S(this)}get value(){return this._isDisposed?void 0:this._value}set value(G){var fe;this._isDisposed||G===this._value||((fe=this._value)===null||fe===void 0||fe.dispose(),G&&P(G,this),this._value=G)}clear(){this.value=void 0}dispose(){var G;this._isDisposed=!0,Te(this),(G=this._value)===null||G===void 0||G.dispose(),this._value=void 0}clearAndLeak(){const G=this._value;return this._value=void 0,G&&P(G,null),G}}class U{constructor(G){this.object=G}dispose(){}}},34502:function(Li,It,oe){"use strict";oe.d(It,{S:function(){return De}});class ce{constructor(ge){this.element=ge,this.next=ce.Undefined,this.prev=ce.Undefined}}ce.Undefined=new ce(void 0);class De{constructor(){this._first=ce.Undefined,this._last=ce.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ce.Undefined}clear(){let ge=this._first;for(;ge!==ce.Undefined;){const q=ge.next;ge.prev=ce.Undefined,ge.next=ce.Undefined,ge=q}this._first=ce.Undefined,this._last=ce.Undefined,this._size=0}unshift(ge){return this._insert(ge,!1)}push(ge){return this._insert(ge,!0)}_insert(ge,q){const S=new ce(ge);if(this._first===ce.Undefined)this._first=S,this._last=S;else if(q){const P=this._last;this._last=S,S.prev=P,P.next=S}else{const P=this._first;this._first=S,S.next=P,P.prev=S}this._size+=1;let Te=!1;return()=>{Te||(Te=!0,this._remove(S))}}shift(){if(this._first!==ce.Undefined){const ge=this._first.element;return this._remove(this._first),ge}}pop(){if(this._last!==ce.Undefined){const ge=this._last.element;return this._remove(this._last),ge}}_remove(ge){if(ge.prev!==ce.Undefined&&ge.next!==ce.Undefined){const q=ge.prev;q.next=ge.next,ge.next.prev=q}else ge.prev===ce.Undefined&&ge.next===ce.Undefined?(this._first=ce.Undefined,this._last=ce.Undefined):ge.next===ce.Undefined?(this._last=this._last.prev,this._last.next=ce.Undefined):ge.prev===ce.Undefined&&(this._first=this._first.next,this._first.prev=ce.Undefined);this._size-=1}*[Symbol.iterator](){let ge=this._first;for(;ge!==ce.Undefined;)yield ge.element,ge=ge.next}}},23345:function(Li,It,oe){"use strict";oe.d(It,{$L:function(){return be},ED:function(){return U},IJ:function(){return G},OS:function(){return We},WE:function(){return se},dz:function(){return $},gn:function(){return Se},li:function(){return O},r:function(){return te},tY:function(){return fe},xS:function(){return Oe}});var ce=oe(97671),De;const Ze="en";let ge=!1,q=!1,S=!1,Te=!1,P=!1,f=!1,re=!1,R,k=null,T=null,M;const O=typeof self=="object"?self:typeof oe.g=="object"?oe.g:{};let Y;typeof O.vscode!="undefined"&&typeof O.vscode.process!="undefined"?Y=O.vscode.process:typeof ce!="undefined"&&(Y=ce);const H=typeof((De=Y==null?void 0:Y.versions)===null||De===void 0?void 0:De.electron)=="string"&&Y.type==="renderer";if(typeof navigator=="object"&&!H)M=navigator.userAgent,ge=M.indexOf("Windows")>=0,q=M.indexOf("Macintosh")>=0,re=(M.indexOf("Macintosh")>=0||M.indexOf("iPad")>=0||M.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,S=M.indexOf("Linux")>=0,f=!0,R=navigator.language,k=R;else if(typeof Y=="object"){ge=Y.platform==="win32",q=Y.platform==="darwin",S=Y.platform==="linux",Te=S&&!!Y.env.SNAP&&!!Y.env.SNAP_REVISION,R=Ze,k=Ze;const z=Y.env.VSCODE_NLS_CONFIG;if(z)try{const X=JSON.parse(z),Q=X.availableLanguages["*"];R=X.locale,k=Q||Ze,T=X._translationsConfigFile}catch(X){}P=!0}else console.error("Unable to resolve platform.");let j=0;q?j=1:ge?j=3:S&&(j=2);const U=ge,$=q,G=S,fe=P,be=f,Se=re,se=M,Oe=function(){if(O.setImmediate)return O.setImmediate.bind(O);if(typeof O.postMessage=="function"&&!O.importScripts){let Q=[];O.addEventListener("message",ie=>{if(ie.data&&ie.data.vscodeSetImmediateId)for(let A=0,L=Q.length;A<L;A++){const V=Q[A];if(V.id===ie.data.vscodeSetImmediateId){Q.splice(A,1),V.callback();return}}});let de=0;return ie=>{const A=++de;Q.push({id:A,callback:ie}),O.postMessage({vscodeSetImmediateId:A},"*")}}if(typeof(Y==null?void 0:Y.nextTick)=="function")return Y.nextTick.bind(Y);const X=Promise.resolve();return Q=>X.then(Q)}(),We=q||re?2:ge?1:3;let Be=!0,At=!1;function te(){if(!At){At=!0;const z=new Uint8Array(2);z[0]=1,z[1]=2,Be=new Uint16Array(z.buffer)[0]===513}return Be}},95830:function(Li,It,oe){"use strict";oe.d(It,{G:function(){return Ze}});var ce=oe(23345);const De=ce.li.performance&&typeof ce.li.performance.now=="function";class Ze{constructor(q){this._highResolution=De&&q,this._startTime=this._now(),this._stopTime=-1}static create(q=!0){return new Ze(q)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?ce.li.performance.now():Date.now()}}},82983:function(Li,It,oe){"use strict";oe.d(It,{$i:function(){return ze},C8:function(){return Dt},GF:function(){return R},HO:function(){return de},IO:function(){return k},K7:function(){return Ht},Kw:function(){return di},LC:function(){return O},Mh:function(){return Oe},P1:function(){return We},PJ:function(){return tn},Qe:function(){return at},R1:function(){return re},RP:function(){return V},S6:function(){return Kt},TT:function(){return U},Ut:function(){return A},V8:function(){return Y},WU:function(){return Ze},YK:function(){return At},YU:function(){return ge},ZG:function(){return Be},ZH:function(){return z},ab:function(){return Bt},c1:function(){return ft},df:function(){return be},ec:function(){return q},fi:function(){return hn},fy:function(){return S},j3:function(){return Te},j_:function(){return G},m5:function(){return ce},mK:function(){return fe},mr:function(){return T},oH:function(){return ve},oL:function(){return P},ok:function(){return se},ow:function(){return H},qq:function(){return Se},qu:function(){return j},rL:function(){return te},uS:function(){return Si},un:function(){return f},uq:function(){return M},vH:function(){return Q},xe:function(){return Me},zY:function(){return $}});function ce(ee){return!ee||typeof ee!="string"?!0:ee.trim().length===0}const De=/{(\d+)}/g;function Ze(ee,...xe){return xe.length===0?ee:ee.replace(De,function(Ke,Xe){const nt=parseInt(Xe,10);return isNaN(nt)||nt<0||nt>=xe.length?Ke:xe[nt]})}function ge(ee){return ee.replace(/[<>&]/g,function(xe){switch(xe){case"<":return"<";case">":return">";case"&":return"&";default:return xe}})}function q(ee){return ee.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function S(ee,xe=" "){const Ke=Te(ee,xe);return P(Ke,xe)}function Te(ee,xe){if(!ee||!xe)return ee;const Ke=xe.length;if(Ke===0||ee.length===0)return ee;let Xe=0;for(;ee.indexOf(xe,Xe)===Xe;)Xe=Xe+Ke;return ee.substring(Xe)}function P(ee,xe){if(!ee||!xe)return ee;const Ke=xe.length,Xe=ee.length;if(Ke===0||Xe===0)return ee;let nt=Xe,gt=-1;for(;gt=ee.lastIndexOf(xe,nt-1),!(gt===-1||gt+Ke!==nt);){if(gt===0)return"";nt=gt}return ee.substring(0,nt)}function f(ee){return ee.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function re(ee){return ee.replace(/\*/g,"")}function R(ee,xe,Ke={}){if(!ee)throw new Error("Cannot create regex from empty string");xe||(ee=q(ee)),Ke.wholeWord&&(/\B/.test(ee.charAt(0))||(ee="\\b"+ee),/\B/.test(ee.charAt(ee.length-1))||(ee=ee+"\\b"));let Xe="";return Ke.global&&(Xe+="g"),Ke.matchCase||(Xe+="i"),Ke.multiline&&(Xe+="m"),Ke.unicode&&(Xe+="u"),new RegExp(ee,Xe)}function k(ee){return ee.source==="^"||ee.source==="^$"||ee.source==="$"||ee.source==="^\\s*$"?!1:!!(ee.exec("")&&ee.lastIndex===0)}function T(ee){return(ee.global?"g":"")+(ee.ignoreCase?"i":"")+(ee.multiline?"m":"")+(ee.unicode?"u":"")}function M(ee){return ee.split(/\r\n|\r|\n/)}function O(ee){for(let xe=0,Ke=ee.length;xe<Ke;xe++){const Xe=ee.charCodeAt(xe);if(Xe!==32&&Xe!==9)return xe}return-1}function Y(ee,xe=0,Ke=ee.length){for(let Xe=xe;Xe<Ke;Xe++){const nt=ee.charCodeAt(Xe);if(nt!==32&&nt!==9)return ee.substring(xe,Xe)}return ee.substring(xe,Ke)}function H(ee,xe=ee.length-1){for(let Ke=xe;Ke>=0;Ke--){const Xe=ee.charCodeAt(Ke);if(Xe!==32&&Xe!==9)return Ke}return-1}function j(ee,xe){return ee<xe?-1:ee>xe?1:0}function U(ee,xe,Ke=0,Xe=ee.length,nt=0,gt=xe.length){for(;Ke<Xe&&nt<gt;Ke++,nt++){let ke=ee.charCodeAt(Ke),bt=xe.charCodeAt(nt);if(ke<bt)return-1;if(ke>bt)return 1}const Yt=Xe-Ke,dt=gt-nt;return Yt<dt?-1:Yt>dt?1:0}function $(ee,xe){return G(ee,xe,0,ee.length,0,xe.length)}function G(ee,xe,Ke=0,Xe=ee.length,nt=0,gt=xe.length){for(;Ke<Xe&&nt<gt;Ke++,nt++){let ke=ee.charCodeAt(Ke),bt=xe.charCodeAt(nt);if(ke===bt)continue;if(ke>=128||bt>=128)return U(ee.toLowerCase(),xe.toLowerCase(),Ke,Xe,nt,gt);fe(ke)&&(ke-=32),fe(bt)&&(bt-=32);const Gt=ke-bt;if(Gt!==0)return Gt}const Yt=Xe-Ke,dt=gt-nt;return Yt<dt?-1:Yt>dt?1:0}function fe(ee){return ee>=97&&ee<=122}function be(ee){return ee>=65&&ee<=90}function Se(ee,xe){return ee.length===xe.length&&G(ee,xe)===0}function se(ee,xe){const Ke=xe.length;return xe.length>ee.length?!1:G(ee,xe,0,Ke)===0}function Oe(ee,xe){let Ke,Xe=Math.min(ee.length,xe.length);for(Ke=0;Ke<Xe;Ke++)if(ee.charCodeAt(Ke)!==xe.charCodeAt(Ke))return Ke;return Xe}function We(ee,xe){let Ke,Xe=Math.min(ee.length,xe.length);const nt=ee.length-1,gt=xe.length-1;for(Ke=0;Ke<Xe;Ke++)if(ee.charCodeAt(nt-Ke)!==xe.charCodeAt(gt-Ke))return Ke;return Xe}function Be(ee){return 55296<=ee&&ee<=56319}function At(ee){return 56320<=ee&&ee<=57343}function te(ee,xe){return(ee-55296<<10)+(xe-56320)+65536}function z(ee,xe,Ke){const Xe=ee.charCodeAt(Ke);if(Be(Xe)&&Ke+1<xe){const nt=ee.charCodeAt(Ke+1);if(At(nt))return te(Xe,nt)}return Xe}function X(ee,xe){const Ke=ee.charCodeAt(xe-1);if(At(Ke)&&xe>1){const Xe=ee.charCodeAt(xe-2);if(Be(Xe))return te(Xe,Ke)}return Ke}function Q(ee,xe){const Ke=Ne.getInstance(),Xe=xe,nt=ee.length,gt=z(ee,nt,xe);xe+=gt>=65536?2:1;let Yt=Ke.getGraphemeBreakType(gt);for(;xe<nt;){const dt=z(ee,nt,xe),ke=Ke.getGraphemeBreakType(dt);if(hn(Yt,ke))break;xe+=dt>=65536?2:1,Yt=ke}return xe-Xe}function de(ee,xe){const Ke=Ne.getInstance(),Xe=xe,nt=X(ee,xe);xe-=nt>=65536?2:1;let gt=Ke.getGraphemeBreakType(nt);for(;xe>0;){const Yt=X(ee,xe),dt=Ke.getGraphemeBreakType(Yt);if(hn(dt,gt))break;xe-=Yt>=65536?2:1,gt=dt}return Xe-xe}const ie=/(?:[\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 A(ee){return ie.test(ee)}const L=/(?:[\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 V(ee){return L.test(ee)}const pe=/^[\t\n\r\x20-\x7E]*$/;function ze(ee){return pe.test(ee)}const at=/[\u2028\u2029]/;function Bt(ee){return at.test(ee)}function Me(ee){for(let xe=0,Ke=ee.length;xe<Ke;xe++)if(Ht(ee.charCodeAt(xe)))return!0;return!1}function Ht(ee){return ee=+ee,ee>=11904&&ee<=55215||ee>=63744&&ee<=64255||ee>=65281&&ee<=65374}function Dt(ee){return ee>=127462&&ee<=127487||ee===8986||ee===8987||ee===9200||ee===9203||ee>=9728&&ee<=10175||ee===11088||ee===11093||ee>=127744&&ee<=128591||ee>=128640&&ee<=128764||ee>=128992&&ee<=129003||ee>=129280&&ee<=129535||ee>=129648&&ee<=129750}const ft="\uFEFF";function Si(ee){return!!(ee&&ee.length>0&&ee.charCodeAt(0)===65279)}function di(ee,xe=!1){return ee?(xe&&(ee=ee.replace(/\\./g,"")),ee.toLowerCase()!==ee):!1}function tn(ee){return ee=ee%(2*26),ee<26?String.fromCharCode(97+ee):String.fromCharCode(65+ee-26)}function Kt(ee){return Ne.getInstance().getGraphemeBreakType(ee)}function hn(ee,xe){return ee===0?xe!==5&&xe!==7:ee===2&&xe===3?!1:ee===4||ee===2||ee===3||xe===4||xe===2||xe===3?!0:!(ee===8&&(xe===8||xe===9||xe===11||xe===12)||(ee===11||ee===9)&&(xe===9||xe===10)||(ee===12||ee===10)&&xe===10||xe===5||xe===13||xe===7||ee===1||ee===13&&xe===14||ee===6&&xe===6)}class Ne{constructor(){this._data=He()}static getInstance(){return Ne._INSTANCE||(Ne._INSTANCE=new Ne),Ne._INSTANCE}getGraphemeBreakType(xe){if(xe<32)return xe===10?3:xe===13?2:4;if(xe<127)return 0;const Ke=this._data,Xe=Ke.length/3;let nt=1;for(;nt<=Xe;)if(xe<Ke[3*nt])nt=2*nt;else if(xe>Ke[3*nt+1])nt=2*nt+1;else return Ke[3*nt+2];return 0}}Ne._INSTANCE=null;function He(){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 ve(ee,xe){if(ee===0)return 0;const Ke=it(ee,xe);if(Ke!==void 0)return Ke;const Xe=X(xe,ee);return ee-=_t(Xe),ee}function it(ee,xe){let Ke=X(xe,ee);for(ee-=_t(Ke);lt(Ke)||Ke===65039||Ke===8419;){if(ee===0)return;Ke=X(xe,ee),ee-=_t(Ke)}if(Dt(Ke)){if(ee>=0){const Xe=X(xe,ee);Xe===8205&&(ee-=_t(Xe))}return ee}}function _t(ee){return ee>=65536?2:1}function lt(ee){return 127995<=ee&&ee<=127999}},72999:function(Li,It,oe){"use strict";oe.d(It,{$E:function(){return O},$K:function(){return Te},D8:function(){return k},HD:function(){return De},IU:function(){return Y},Jp:function(){return P},Kn:function(){return Ze},cW:function(){return re},f6:function(){return H},hj:function(){return ge},jn:function(){return q},kJ:function(){return ce},mf:function(){return R},o8:function(){return S},p_:function(){return f},vE:function(){return j}});function ce(U){return Array.isArray(U)}function De(U){return typeof U=="string"}function Ze(U){return typeof U=="object"&&U!==null&&!Array.isArray(U)&&!(U instanceof RegExp)&&!(U instanceof Date)}function ge(U){return typeof U=="number"&&!isNaN(U)}function q(U){return U===!0||U===!1}function S(U){return typeof U=="undefined"}function Te(U){return!P(U)}function P(U){return S(U)||U===null}function f(U,$){if(!U)throw new Error($?`Unexpected type, expected '${$}'`:"Unexpected type")}function re(U){if(P(U))throw new Error("Assertion Failed: argument is undefined or null");return U}function R(U){return typeof U=="function"}function k(U,$){const G=Math.min(U.length,$.length);for(let fe=0;fe<G;fe++)T(U[fe],$[fe])}function T(U,$){if(De($)){if(typeof U!==$)throw new Error(`argument does not match constraint: typeof ${$}`)}else if(R($)){try{if(U instanceof $)return}catch(G){}if(!P(U)&&U.constructor===$||$.length===1&&$.call(void 0,U)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function M(U){let $=[],G=Object.getPrototypeOf(U);for(;Object.prototype!==G;)$=$.concat(Object.getOwnPropertyNames(G)),G=Object.getPrototypeOf(G);return $}function O(U){const $=[];for(const G of M(U))typeof U[G]=="function"&&$.push(G);return $}function Y(U,$){const G=be=>function(){const Se=Array.prototype.slice.call(arguments,0);return $(be,Se)};let fe={};for(const be of U)fe[be]=G(be);return fe}function H(U){return U===null?void 0:U}function j(U,$="Unreachable"){throw new Error($)}},13268:function(Li,It,oe){"use strict";oe.d(It,{N:function(){return De}});function ce(Ze,ge){let q;return ge.length===0?q=Ze:q=Ze.replace(/\{(\d+)\}/g,function(S,Te){const P=Te[0];return typeof ge[P]!="undefined"?ge[P]:S}),q}function De(Ze,ge,...q){return ce(ge,q)}},96236:function(Li,It,oe){"use strict";oe.d(It,{BH:function(){return Y},NZ:function(){return H},U8:function(){return j},co:function(){return O},eH:function(){return M},vr:function(){return T}});var ce=oe(75918),De=oe(52615),Ze=oe(4348),ge=oe(88226),q=oe(69323),S=oe(34502),Te=oe(35884),P=oe(90689),f=oe(16925),re=oe(49055),R=function(U,$,G,fe){var be=arguments.length,Se=be<3?$:fe===null?fe=Object.getOwnPropertyDescriptor($,G):fe,se;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Se=Reflect.decorate(U,$,G,fe);else for(var Oe=U.length-1;Oe>=0;Oe--)(se=U[Oe])&&(Se=(be<3?se(Se):be>3?se($,G,Se):se($,G))||Se);return be>3&&Se&&Object.defineProperty($,G,Se),Se},k=function(U,$){return function(G,fe){$(G,fe,U)}};function T(U){return U.command!==void 0}class M{constructor($){this.id=M._idPool++,this._debugName=$}}M._idPool=0,M.CommandPalette=new M("CommandPalette"),M.EditorContext=new M("EditorContext"),M.SimpleEditorContext=new M("SimpleEditorContext"),M.EditorContextCopy=new M("EditorContextCopy"),M.EditorContextPeek=new M("EditorContextPeek"),M.MenubarEditMenu=new M("MenubarEditMenu"),M.MenubarCopy=new M("MenubarCopy"),M.MenubarGoMenu=new M("MenubarGoMenu"),M.MenubarSelectionMenu=new M("MenubarSelectionMenu"),M.InlineCompletionsActions=new M("InlineCompletionsActions");const O=(0,f.yh)("menuService"),Y=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Ze.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:U=>U===M.CommandPalette}}addCommand(U){return this.addCommands(ge.$.single(U))}addCommands(U){for(const $ of U)this._commands.set($.id,$);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,q.OF)(()=>{let $=!1;for(const G of U)$=this._commands.delete(G.id)||$;$&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(U){return this._commands.get(U)}getCommands(){const U=new Map;return this._commands.forEach(($,G)=>U.set(G,$)),U}appendMenuItem(U,$){return this.appendMenuItems(ge.$.single({id:U,item:$}))}appendMenuItems(U){const $=new Set,G=new S.S;for(const{id:fe,item:be}of U){let Se=this._menuItems.get(fe);Se||(Se=new S.S,this._menuItems.set(fe,Se)),G.push(Se.push(be)),$.add(fe)}return this._onDidChangeMenu.fire($),(0,q.OF)(()=>{if(G.size>0){for(let fe of G)fe();this._onDidChangeMenu.fire($),G.clear()}})}getMenuItems(U){let $;return this._menuItems.has(U)?$=[...this._menuItems.get(U)]:$=[],U===M.CommandPalette&&this._appendImplicitItems($),$}_appendImplicitItems(U){const $=new Set;for(const G of U)T(G)&&($.add(G.command.id),G.alt&&$.add(G.alt.id));this._commands.forEach((G,fe)=>{$.has(fe)||U.push({command:G})})}};class H extends ce.wY{constructor($,G,fe,be){super(`submenuitem.${$.submenu.id}`,typeof $.title=="string"?$.title:$.title.value,[],"submenu"),this.item=$,this._menuService=G,this._contextKeyService=fe,this._options=be}get actions(){const $=[],G=this._menuService.createMenu(this.item.submenu,this._contextKeyService),fe=G.getActions(this._options);G.dispose();for(const[,be]of fe)be.length>0&&($.push(...be),$.push(new ce.Z0));return $.length&&$.pop(),$}}let j=class zp{constructor($,G,fe,be,Se){var se,Oe;if(this._commandService=Se,this.id=$.id,this.label=fe!=null&&fe.renderShortTitle&&$.shortTitle?typeof $.shortTitle=="string"?$.shortTitle:$.shortTitle.value:typeof $.title=="string"?$.title:$.title.value,this.tooltip=(Oe=typeof $.tooltip=="string"?$.tooltip:(se=$.tooltip)===null||se===void 0?void 0:se.value)!==null&&Oe!==void 0?Oe:"",this.enabled=!$.precondition||be.contextMatchesRules($.precondition),this.checked=void 0,$.toggled){const We=$.toggled.condition?$.toggled:{condition:$.toggled};this.checked=be.contextMatchesRules(We.condition),this.checked&&We.tooltip&&(this.tooltip=typeof We.tooltip=="string"?We.tooltip:We.tooltip.value),We.title&&(this.label=typeof We.title=="string"?We.title:We.title.value)}this.item=$,this.alt=G?new zp(G,void 0,fe,be,Se):void 0,this._options=fe,re.kS.isThemeIcon($.icon)&&(this.class=De.dT.asClassName($.icon))}dispose(){}run(...$){var G,fe;let be=[];return!((G=this._options)===null||G===void 0)&&G.arg&&(be=[...be,this._options.arg]),!((fe=this._options)===null||fe===void 0)&&fe.shouldForwardArgs&&(be=[...be,...$]),this._commandService.executeCommand(this.id,...be)}};j=R([k(3,P.i6),k(4,Te.H)],j)},35884:function(Li,It,oe){"use strict";oe.d(It,{H:function(){return Te},P:function(){return P}});var ce=oe(4348),De=oe(88226),Ze=oe(69323),ge=oe(34502),q=oe(72999),S=oe(16925);const Te=(0,S.yh)("commandService"),P=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new ce.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(f,re){if(!f)throw new Error("invalid command");if(typeof f=="string"){if(!re)throw new Error("invalid command");return this.registerCommand({id:f,handler:re})}if(f.description){const O=[];for(let H of f.description.args)O.push(H.constraint);const Y=f.handler;f.handler=function(H,...j){return(0,q.D8)(j,O),Y(H,...j)}}const{id:R}=f;let k=this._commands.get(R);k||(k=new ge.S,this._commands.set(R,k));let T=k.unshift(f),M=(0,Ze.OF)(()=>{T();const O=this._commands.get(R);O!=null&&O.isEmpty()&&this._commands.delete(R)});return this._onDidRegisterCommand.fire(R),M}registerCommandAlias(f,re){return P.registerCommand(f,(R,...k)=>R.get(Te).executeCommand(re,...k))}getCommand(f){const re=this._commands.get(f);if(!(!re||re.isEmpty()))return De.$.first(re)}getCommands(){const f=new Map;for(const re of this._commands.keys()){const R=this.getCommand(re);R&&f.set(re,R)}return f}};P.registerCommand("noop",()=>{})},90689:function(Li,It,oe){"use strict";oe.d(It,{Ao:function(){return Te},Eq:function(){return te},Fb:function(){return P},K8:function(){return Q},i6:function(){return At},uy:function(){return Be}});var ce=oe(23345),De=oe(82983),Ze=oe(16925);let ge=ce.WE||"";const q=new Map;q.set("false",!1),q.set("true",!0),q.set("isMac",ce.dz),q.set("isLinux",ce.IJ),q.set("isWindows",ce.ED),q.set("isWeb",ce.$L),q.set("isMacNative",ce.dz&&!ce.$L),q.set("isEdge",ge.indexOf("Edg/")>=0),q.set("isFirefox",ge.indexOf("Firefox")>=0),q.set("isChrome",ge.indexOf("Chrome")>=0),q.set("isSafari",ge.indexOf("Safari")>=0);const S=Object.prototype.hasOwnProperty;class Te{static has(A){return k.create(A)}static equals(A,L){return T.create(A,L)}static regex(A,L){return be.create(A,L)}static not(A){return H.create(A)}static and(...A){return Oe.create(A,null)}static or(...A){return We.create(A,null,!0)}static deserialize(A,L=!1){if(A)return this._deserializeOrExpression(A,L)}static _deserializeOrExpression(A,L){let V=A.split("||");return We.create(V.map(pe=>this._deserializeAndExpression(pe,L)),null,!0)}static _deserializeAndExpression(A,L){let V=A.split("&&");return Oe.create(V.map(pe=>this._deserializeOne(pe,L)),null)}static _deserializeOne(A,L){if(A=A.trim(),A.indexOf("!=")>=0){let V=A.split("!=");return Y.create(V[0].trim(),this._deserializeValue(V[1],L))}if(A.indexOf("==")>=0){let V=A.split("==");return T.create(V[0].trim(),this._deserializeValue(V[1],L))}if(A.indexOf("=~")>=0){let V=A.split("=~");return be.create(V[0].trim(),this._deserializeRegexValue(V[1],L))}if(A.indexOf(" in ")>=0){let V=A.split(" in ");return M.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(A)){const V=A.split(">=");return $.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(A)){const V=A.split(">");return U.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(A)){const V=A.split("<=");return fe.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(A)){const V=A.split("<");return G.create(V[0].trim(),V[1].trim())}return/^\!\s*/.test(A)?H.create(A.substr(1).trim()):k.create(A)}static _deserializeValue(A,L){if(A=A.trim(),A==="true")return!0;if(A==="false")return!1;let V=/^'([^']*)'$/.exec(A);return V?V[1].trim():A}static _deserializeRegexValue(A,L){if((0,De.m5)(A)){if(L)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let V=A.indexOf("/"),pe=A.lastIndexOf("/");if(V===pe||V<0){if(L)throw new Error(`bad regexp-value '${A}', missing /-enclosure`);return console.warn(`bad regexp-value '${A}', missing /-enclosure`),null}let ze=A.slice(V+1,pe),at=A[pe+1]==="i"?"i":"";try{return new RegExp(ze,at)}catch(Bt){if(L)throw new Error(`bad regexp-value '${A}', parse error: ${Bt}`);return console.warn(`bad regexp-value '${A}', parse error: ${Bt}`),null}}}function P(ie,A){const L=ie?ie.substituteConstants():void 0,V=A?A.substituteConstants():void 0;return!L&&!V?!0:!L||!V?!1:L.equals(V)}function f(ie,A){return ie.cmp(A)}class re{constructor(){this.type=0}cmp(A){return this.type-A.type}equals(A){return A.type===this.type}substituteConstants(){return this}evaluate(A){return!1}serialize(){return"false"}keys(){return[]}negate(){return R.INSTANCE}}re.INSTANCE=new re;class R{constructor(){this.type=1}cmp(A){return this.type-A.type}equals(A){return A.type===this.type}substituteConstants(){return this}evaluate(A){return!0}serialize(){return"true"}keys(){return[]}negate(){return re.INSTANCE}}R.INSTANCE=new R;class k{constructor(A,L){this.key=A,this.negated=L,this.type=2}static create(A,L=null){const V=q.get(A);return typeof V=="boolean"?V?R.INSTANCE:re.INSTANCE:new k(A,L)}cmp(A){return A.type!==this.type?this.type-A.type:z(this.key,A.key)}equals(A){return A.type===this.type?this.key===A.key:!1}substituteConstants(){const A=q.get(this.key);return typeof A=="boolean"?A?R.INSTANCE:re.INSTANCE:this}evaluate(A){return!!A.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=H.create(this.key,this)),this.negated}}class T{constructor(A,L,V){this.key=A,this.value=L,this.negated=V,this.type=4}static create(A,L,V=null){if(typeof L=="boolean")return L?k.create(A,V):H.create(A,V);const pe=q.get(A);return typeof pe=="boolean"?L===(pe?"true":"false")?R.INSTANCE:re.INSTANCE:new T(A,L,V)}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){const A=q.get(this.key);if(typeof A=="boolean"){const L=A?"true":"false";return this.value===L?R.INSTANCE:re.INSTANCE}return this}evaluate(A){return A.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Y.create(this.key,this.value,this)),this.negated}}class M{constructor(A,L){this.key=A,this.valueKey=L,this.type=10,this.negated=null}static create(A,L){return new M(A,L)}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.valueKey,A.key,A.valueKey)}equals(A){return A.type===this.type?this.key===A.key&&this.valueKey===A.valueKey:!1}substituteConstants(){return this}evaluate(A){const L=A.getValue(this.valueKey),V=A.getValue(this.key);return Array.isArray(L)?L.indexOf(V)>=0:typeof V=="string"&&typeof L=="object"&&L!==null?S.call(L,V):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=O.create(this)),this.negated}}class O{constructor(A){this._actual=A,this.type=11}static create(A){return new O(A)}cmp(A){return A.type!==this.type?this.type-A.type:this._actual.cmp(A._actual)}equals(A){return A.type===this.type?this._actual.equals(A._actual):!1}substituteConstants(){return this}evaluate(A){return!this._actual.evaluate(A)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class Y{constructor(A,L,V){this.key=A,this.value=L,this.negated=V,this.type=5}static create(A,L,V=null){if(typeof L=="boolean")return L?H.create(A,V):k.create(A,V);const pe=q.get(A);return typeof pe=="boolean"?L===(pe?"true":"false")?re.INSTANCE:R.INSTANCE:new Y(A,L,V)}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){const A=q.get(this.key);if(typeof A=="boolean"){const L=A?"true":"false";return this.value===L?re.INSTANCE:R.INSTANCE}return this}evaluate(A){return A.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=T.create(this.key,this.value,this)),this.negated}}class H{constructor(A,L){this.key=A,this.negated=L,this.type=3}static create(A,L=null){const V=q.get(A);return typeof V=="boolean"?V?re.INSTANCE:R.INSTANCE:new H(A,L)}cmp(A){return A.type!==this.type?this.type-A.type:z(this.key,A.key)}equals(A){return A.type===this.type?this.key===A.key:!1}substituteConstants(){const A=q.get(this.key);return typeof A=="boolean"?A?re.INSTANCE:R.INSTANCE:this}evaluate(A){return!A.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=k.create(this.key,this)),this.negated}}function j(ie,A){if(typeof ie=="string"){const L=parseFloat(ie);isNaN(L)||(ie=L)}return typeof ie=="string"||typeof ie=="number"?A(ie):re.INSTANCE}class U{constructor(A,L,V){this.key=A,this.value=L,this.negated=V,this.type=12}static create(A,L,V=null){return j(L,pe=>new U(A,pe,V))}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=fe.create(this.key,this.value,this)),this.negated}}class ${constructor(A,L,V){this.key=A,this.value=L,this.negated=V,this.type=13}static create(A,L,V=null){return j(L,pe=>new $(A,pe,V))}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=G.create(this.key,this.value,this)),this.negated}}class G{constructor(A,L,V){this.key=A,this.value=L,this.negated=V,this.type=14}static create(A,L,V=null){return j(L,pe=>new G(A,pe,V))}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=$.create(this.key,this.value,this)),this.negated}}class fe{constructor(A,L,V){this.key=A,this.value=L,this.negated=V,this.type=15}static create(A,L,V=null){return j(L,pe=>new fe(A,pe,V))}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=U.create(this.key,this.value,this)),this.negated}}class be{constructor(A,L){this.key=A,this.regexp=L,this.type=7,this.negated=null}static create(A,L){return new be(A,L)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.key<A.key)return-1;if(this.key>A.key)return 1;const L=this.regexp?this.regexp.source:"",V=A.regexp?A.regexp.source:"";return L<V?-1:L>V?1:0}equals(A){if(A.type===this.type){const L=this.regexp?this.regexp.source:"",V=A.regexp?A.regexp.source:"";return this.key===A.key&&L===V}return!1}substituteConstants(){return this}evaluate(A){let L=A.getValue(this.key);return this.regexp?this.regexp.test(L):!1}serialize(){const A=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${A}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Se.create(this)),this.negated}}class Se{constructor(A){this._actual=A,this.type=8}static create(A){return new Se(A)}cmp(A){return A.type!==this.type?this.type-A.type:this._actual.cmp(A._actual)}equals(A){return A.type===this.type?this._actual.equals(A._actual):!1}substituteConstants(){return this}evaluate(A){return!this._actual.evaluate(A)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function se(ie){let A=null;for(let L=0,V=ie.length;L<V;L++){const pe=ie[L].substituteConstants();if(ie[L]!==pe&&A===null){A=[];for(let ze=0;ze<L;ze++)A[ze]=ie[ze]}A!==null&&(A[L]=pe)}return A===null?ie:A}class Oe{constructor(A,L){this.expr=A,this.negated=L,this.type=6}static create(A,L){return Oe._normalizeArr(A,L)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.expr.length<A.expr.length)return-1;if(this.expr.length>A.expr.length)return 1;for(let L=0,V=this.expr.length;L<V;L++){const pe=f(this.expr[L],A.expr[L]);if(pe!==0)return pe}return 0}equals(A){if(A.type===this.type){if(this.expr.length!==A.expr.length)return!1;for(let L=0,V=this.expr.length;L<V;L++)if(!this.expr[L].equals(A.expr[L]))return!1;return!0}return!1}substituteConstants(){const A=se(this.expr);return A===this.expr?this:Oe.create(A,this.negated)}evaluate(A){for(let L=0,V=this.expr.length;L<V;L++)if(!this.expr[L].evaluate(A))return!1;return!0}static _normalizeArr(A,L){const V=[];let pe=!1;for(const ze of A)if(ze){if(ze.type===1){pe=!0;continue}if(ze.type===0)return re.INSTANCE;if(ze.type===6){V.push(...ze.expr);continue}V.push(ze)}if(V.length===0&&pe)return R.INSTANCE;if(V.length!==0){if(V.length===1)return V[0];V.sort(f);for(let ze=1;ze<V.length;ze++)V[ze-1].equals(V[ze])&&(V.splice(ze,1),ze--);if(V.length===1)return V[0];for(;V.length>1;){const ze=V[V.length-1];if(ze.type!==9)break;V.pop();const at=V.pop(),Bt=V.length===0,Me=We.create(ze.expr.map(Ht=>Oe.create([Ht,at],null)),null,Bt);Me&&(V.push(Me),V.sort(f))}return V.length===1?V[0]:new Oe(V,L)}}serialize(){return this.expr.map(A=>A.serialize()).join(" && ")}keys(){const A=[];for(let L of this.expr)A.push(...L.keys());return A}negate(){if(!this.negated){const A=[];for(let L of this.expr)A.push(L.negate());this.negated=We.create(A,this,!0)}return this.negated}}class We{constructor(A,L){this.expr=A,this.negated=L,this.type=9}static create(A,L,V){return We._normalizeArr(A,L,V)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.expr.length<A.expr.length)return-1;if(this.expr.length>A.expr.length)return 1;for(let L=0,V=this.expr.length;L<V;L++){const pe=f(this.expr[L],A.expr[L]);if(pe!==0)return pe}return 0}equals(A){if(A.type===this.type){if(this.expr.length!==A.expr.length)return!1;for(let L=0,V=this.expr.length;L<V;L++)if(!this.expr[L].equals(A.expr[L]))return!1;return!0}return!1}substituteConstants(){const A=se(this.expr);return A===this.expr?this:We.create(A,this.negated,!1)}evaluate(A){for(let L=0,V=this.expr.length;L<V;L++)if(this.expr[L].evaluate(A))return!0;return!1}static _normalizeArr(A,L,V){let pe=[],ze=!1;if(A){for(let at=0,Bt=A.length;at<Bt;at++){const Me=A[at];if(Me){if(Me.type===0){ze=!0;continue}if(Me.type===1)return R.INSTANCE;if(Me.type===9){pe=pe.concat(Me.expr);continue}pe.push(Me)}}if(pe.length===0&&ze)return re.INSTANCE;pe.sort(f)}if(pe.length!==0){if(pe.length===1)return pe[0];for(let at=1;at<pe.length;at++)pe[at-1].equals(pe[at])&&(pe.splice(at,1),at--);if(pe.length===1)return pe[0];if(V){for(let at=0;at<pe.length;at++)for(let Bt=at+1;Bt<pe.length;Bt++)Q(pe[at],pe[Bt])&&(pe.splice(Bt,1),Bt--);if(pe.length===1)return pe[0]}return new We(pe,L)}}serialize(){return this.expr.map(A=>A.serialize()).join(" || ")}keys(){const A=[];for(let L of this.expr)A.push(...L.keys());return A}negate(){if(!this.negated){let A=[];for(let L of this.expr)A.push(L.negate());for(;A.length>1;){const L=A.shift(),V=A.shift(),pe=[];for(const at of de(L))for(const Bt of de(V))pe.push(Oe.create([at,Bt],null));const ze=A.length===0;A.unshift(We.create(pe,null,ze))}this.negated=A[0]}return this.negated}}class Be extends k{constructor(A,L,V){super(A,null),this._defaultValue=L,typeof V=="object"?Be._info.push(Object.assign(Object.assign({},V),{key:A})):V!==!0&&Be._info.push({key:A,description:V,type:L!=null?typeof L:void 0})}static all(){return Be._info.values()}bindTo(A){return A.createKey(this.key,this._defaultValue)}getValue(A){return A.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(A){return T.create(this.key,A)}}Be._info=[];const At=(0,Ze.yh)("contextKeyService"),te="setContext";function z(ie,A){return ie<A?-1:ie>A?1:0}function X(ie,A,L,V){return ie<L?-1:ie>L?1:A<V?-1:A>V?1:0}function Q(ie,A){if(A.type===6&&ie.type!==9&&ie.type!==6){for(const pe of A.expr)if(ie.equals(pe))return!0}const L=ie.negate(),V=de(L).concat(de(A));V.sort(f);for(let pe=0;pe<V.length;pe++){const at=V[pe].negate();for(let Bt=pe+1;Bt<V.length;Bt++){const Me=V[Bt];if(at.equals(Me))return!0}}return!1}function de(ie){return ie.type===9?ie.expr:[ie]}},16925:function(Li,It,oe){"use strict";oe.d(It,{I8:function(){return ce},TG:function(){return De},jt:function(){return q},yh:function(){return ge}});var ce;(function(S){S.serviceIds=new Map,S.DI_TARGET="$di$target",S.DI_DEPENDENCIES="$di$dependencies";function Te(P){return P[S.DI_DEPENDENCIES]||[]}S.getServiceDependencies=Te})(ce||(ce={}));const De=ge("instantiationService");function Ze(S,Te,P,f){Te[ce.DI_TARGET]===Te?Te[ce.DI_DEPENDENCIES].push({id:S,index:P,optional:f}):(Te[ce.DI_DEPENDENCIES]=[{id:S,index:P,optional:f}],Te[ce.DI_TARGET]=Te)}function ge(S){if(ce.serviceIds.has(S))return ce.serviceIds.get(S);const Te=function(P,f,re){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ze(Te,P,re,!1)};return Te.toString=()=>S,ce.serviceIds.set(S,Te),Te}function q(S){return function(Te,P,f){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Ze(S,Te,f,!0)}}},44650:function(Li,It,oe){"use strict";oe.d(It,{B:function(){return ge}});var ce=oe(76068),De=oe(72999);class Ze{constructor(){this.data=new Map}add(S,Te){ce.ok(De.HD(S)),ce.ok(De.Kn(Te)),ce.ok(!this.data.has(S),"There is already an extension with this id"),this.data.set(S,Te)}as(S){return this.data.get(S)||null}}const ge=new Ze},66213:function(Li,It,oe){"use strict";oe.d(It,{e:function(){return ce}});var ce;(function(De){De.DARK="dark",De.LIGHT="light",De.HIGH_CONTRAST="hc"})(ce||(ce={}))},49055:function(Li,It,oe){"use strict";oe.d(It,{EN:function(){return f},IP:function(){return k},Ic:function(){return O},XE:function(){return Te},bB:function(){return Y},kS:function(){return re},m6:function(){return R}});var ce=oe(52615),De=oe(4348),Ze=oe(69323),ge=oe(16925),q=oe(44650),S=oe(66213);const Te=(0,ge.yh)("themeService");var P;(function(H){function j(U){return U&&typeof U=="object"&&typeof U.id=="string"}H.isThemeColor=j})(P||(P={}));function f(H){return{id:H}}var re;(function(H){function j(Se){return Se&&typeof Se=="object"&&typeof Se.id=="string"&&(typeof Se.color=="undefined"||P.isThemeColor(Se.color))}H.isThemeIcon=j;const U=new RegExp(`^\\$\\((${ce.dT.iconNameExpression}(?:${ce.dT.iconModifierExpression})?)\\)$`);function $(Se){const se=U.exec(Se);if(!se)return;let[,Oe]=se;return{id:Oe}}H.fromString=$;function G(Se,se){let Oe=Se.id;const We=Oe.lastIndexOf("~");return We!==-1&&(Oe=Oe.substring(0,We)),se&&(Oe=`${Oe}~${se}`),{id:Oe}}H.modify=G;function fe(Se,se){var Oe,We;return Se.id===se.id&&((Oe=Se.color)===null||Oe===void 0?void 0:Oe.id)===((We=se.color)===null||We===void 0?void 0:We.id)}H.isEqual=fe;function be(Se,se){return{id:Se.id,color:se?f(se):void 0}}H.asThemeIcon=be,H.asClassNameArray=ce.dT.asClassNameArray,H.asClassName=ce.dT.asClassName,H.asCSSSelector=ce.dT.asCSSSelector})(re||(re={}));function R(H){switch(H){case S.e.DARK:return"vs-dark";case S.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const k={ThemingContribution:"base.contributions.theming"};class T{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new De.Q5}onColorThemeChange(j){return this.themingParticipants.push(j),this.onThemingParticipantAddedEmitter.fire(j),(0,Ze.OF)(()=>{const U=this.themingParticipants.indexOf(j);this.themingParticipants.splice(U,1)})}getThemingParticipants(){return this.themingParticipants}}let M=new T;q.B.add(k.ThemingContribution,M);function O(H){return M.onColorThemeChange(H)}class Y extends Ze.JT{constructor(j){super(),this.themeService=j,this.theme=j.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(U=>this.onThemeChange(U)))}onThemeChange(j){this.theme=j,this.updateStyles()}updateStyles(){}}},16632:function(Li,It,oe){"use strict";var ce=oe(54476),De=oe(33885),Ze=oe(20068),ge=oe(42978),q=oe(75931),S=oe(92310),Te=oe.n(S),P=oe(18929),f=oe(59301),re=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],R=(0,f.forwardRef)(function(k,T){var M=k.prefixCls,O=M===void 0?"rc-checkbox":M,Y=k.className,H=k.style,j=k.checked,U=k.disabled,$=k.defaultChecked,G=$===void 0?!1:$,fe=k.type,be=fe===void 0?"checkbox":fe,Se=k.title,se=k.onChange,Oe=(0,q.Z)(k,re),We=(0,f.useRef)(null),Be=(0,f.useRef)(null),At=(0,P.Z)(G,{value:j}),te=(0,ge.Z)(At,2),z=te[0],X=te[1];(0,f.useImperativeHandle)(T,function(){return{focus:function(A){var L;(L=We.current)===null||L===void 0||L.focus(A)},blur:function(){var A;(A=We.current)===null||A===void 0||A.blur()},input:We.current,nativeElement:Be.current}});var Q=Te()(O,Y,(0,Ze.Z)((0,Ze.Z)({},"".concat(O,"-checked"),z),"".concat(O,"-disabled"),U)),de=function(A){U||("checked"in k||X(A.target.checked),se==null||se({target:(0,De.Z)((0,De.Z)({},k),{},{type:be,checked:A.target.checked}),stopPropagation:function(){A.stopPropagation()},preventDefault:function(){A.preventDefault()},nativeEvent:A.nativeEvent}))};return f.createElement("span",{className:Q,title:Se,style:H,ref:Be},f.createElement("input",(0,ce.Z)({},Oe,{className:"".concat(O,"-input"),ref:We,onChange:de,disabled:U,checked:!!z,type:be})),f.createElement("span",{className:"".concat(O,"-inner")}))});It.Z=R},96478:function(Li,It,oe){"use strict";oe.d(It,{Z:function(){return Se}});var ce=oe(54476),De=oe(20068),Ze=oe(42978),ge=oe(75931),q=oe(65030),S=oe(92310),Te=oe.n(S),P=oe(8654),f=oe(59301),re=oe(10228),R=oe(16089),k=re.Z.ESC,T=re.Z.TAB;function M(se){var Oe=se.visible,We=se.triggerRef,Be=se.onVisibleChange,At=se.autoFocus,te=se.overlayRef,z=f.useRef(!1),X=function(){if(Oe){var A,L;(A=We.current)===null||A===void 0||(L=A.focus)===null||L===void 0||L.call(A),Be==null||Be(!1)}},Q=function(){var A;return(A=te.current)!==null&&A!==void 0&&A.focus?(te.current.focus(),z.current=!0,!0):!1},de=function(A){switch(A.keyCode){case k:X();break;case T:{var L=!1;z.current||(L=Q()),L?A.preventDefault():X();break}}};f.useEffect(function(){return Oe?(window.addEventListener("keydown",de),At&&(0,R.Z)(Q,3),function(){window.removeEventListener("keydown",de),z.current=!1}):function(){z.current=!1}},[Oe])}var O=(0,f.forwardRef)(function(se,Oe){var We=se.overlay,Be=se.arrow,At=se.prefixCls,te=(0,f.useMemo)(function(){var X;return typeof We=="function"?X=We():X=We,X},[We]),z=(0,P.sQ)(Oe,(0,P.C4)(te));return f.createElement(f.Fragment,null,Be&&f.createElement("div",{className:"".concat(At,"-arrow")}),f.cloneElement(te,{ref:(0,P.Yr)(te)?z:void 0}))}),Y=O,H={adjustX:1,adjustY:1},j=[0,0],U={topLeft:{points:["bl","tl"],overflow:H,offset:[0,-4],targetOffset:j},top:{points:["bc","tc"],overflow:H,offset:[0,-4],targetOffset:j},topRight:{points:["br","tr"],overflow:H,offset:[0,-4],targetOffset:j},bottomLeft:{points:["tl","bl"],overflow:H,offset:[0,4],targetOffset:j},bottom:{points:["tc","bc"],overflow:H,offset:[0,4],targetOffset:j},bottomRight:{points:["tr","br"],overflow:H,offset:[0,4],targetOffset:j}},$=U,G=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function fe(se,Oe){var We,Be=se.arrow,At=Be===void 0?!1:Be,te=se.prefixCls,z=te===void 0?"rc-dropdown":te,X=se.transitionName,Q=se.animation,de=se.align,ie=se.placement,A=ie===void 0?"bottomLeft":ie,L=se.placements,V=L===void 0?$:L,pe=se.getPopupContainer,ze=se.showAction,at=se.hideAction,Bt=se.overlayClassName,Me=se.overlayStyle,Ht=se.visible,Dt=se.trigger,ft=Dt===void 0?["hover"]:Dt,Si=se.autoFocus,di=se.overlay,tn=se.children,Kt=se.onVisibleChange,hn=(0,ge.Z)(se,G),Ne=f.useState(),He=(0,Ze.Z)(Ne,2),ve=He[0],it=He[1],_t="visible"in se?Ht:ve,lt=f.useRef(null),ee=f.useRef(null),xe=f.useRef(null);f.useImperativeHandle(Oe,function(){return lt.current});var Ke=function(Pt){it(Pt),Kt==null||Kt(Pt)};M({visible:_t,triggerRef:xe,onVisibleChange:Ke,autoFocus:Si,overlayRef:ee});var Xe=function(Pt){var Ae=se.onOverlayClick;it(!1),Ae&&Ae(Pt)},nt=function(){return f.createElement(Y,{ref:ee,overlay:di,prefixCls:z,arrow:At})},gt=function(){return typeof di=="function"?nt:nt()},Yt=function(){var Pt=se.minOverlayWidthMatchTrigger,Ae=se.alignPoint;return"minOverlayWidthMatchTrigger"in se?Pt:!Ae},dt=function(){var Pt=se.openClassName;return Pt!==void 0?Pt:"".concat(z,"-open")},ke=f.cloneElement(tn,{className:Te()((We=tn.props)===null||We===void 0?void 0:We.className,_t&&dt()),ref:(0,P.Yr)(tn)?(0,P.sQ)(xe,(0,P.C4)(tn)):void 0}),bt=at;return!bt&&ft.indexOf("contextMenu")!==-1&&(bt=["click"]),f.createElement(q.Z,(0,ce.Z)({builtinPlacements:V},hn,{prefixCls:z,ref:lt,popupClassName:Te()(Bt,(0,De.Z)({},"".concat(z,"-show-arrow"),At)),popupStyle:Me,action:ft,showAction:ze,hideAction:bt,popupPlacement:A,popupAlign:de,popupTransitionName:X,popupAnimation:Q,popupVisible:_t,stretch:Yt()?"minWidth":"",popup:gt(),onPopupVisibleChange:Ke,onPopupClick:Xe,getPopupContainer:pe}),ke)}var be=f.forwardRef(fe),Se=be},66003:function(Li,It,oe){"use strict";oe.d(It,{Z:function(){return Te}});var ce=oe(75931),De=oe(33885),Ze=oe(76190),ge=oe(59301),q=["show"];function S(P,f){if(!f.max)return!0;var re=f.strategy(P);return re<=f.max}function Te(P,f){return ge.useMemo(function(){var re={};f&&(re.show=(0,Ze.Z)(f)==="object"&&f.formatter?f.formatter:!!f),re=(0,De.Z)((0,De.Z)({},re),P);var R=re,k=R.show,T=(0,ce.Z)(R,q);return(0,De.Z)((0,De.Z)({},T),{},{show:!!k,showFormatter:typeof k=="function"?k:void 0,strategy:T.strategy||function(M){return M.length}})},[P,f])}},36901:function(Li,It,oe){"use strict";oe.r(It),oe.d(It,{BaseInput:function(){return re},default:function(){return $}});var ce=oe(33885),De=oe(54476),Ze=oe(20068),ge=oe(76190),q=oe(92310),S=oe.n(q),Te=oe(59301),P=oe(30292),f=Te.forwardRef(function(G,fe){var be,Se,se,Oe=G.inputElement,We=G.children,Be=G.prefixCls,At=G.prefix,te=G.suffix,z=G.addonBefore,X=G.addonAfter,Q=G.className,de=G.style,ie=G.disabled,A=G.readOnly,L=G.focused,V=G.triggerFocus,pe=G.allowClear,ze=G.value,at=G.handleReset,Bt=G.hidden,Me=G.classes,Ht=G.classNames,Dt=G.dataAttrs,ft=G.styles,Si=G.components,di=G.onClear,tn=We!=null?We:Oe,Kt=(Si==null?void 0:Si.affixWrapper)||"span",hn=(Si==null?void 0:Si.groupWrapper)||"span",Ne=(Si==null?void 0:Si.wrapper)||"span",He=(Si==null?void 0:Si.groupAddon)||"span",ve=(0,Te.useRef)(null),it=function(rt){var ut;(ut=ve.current)!==null&&ut!==void 0&&ut.contains(rt.target)&&(V==null||V())},_t=(0,P.X3)(G),lt=(0,Te.cloneElement)(tn,{value:ze,className:S()((be=tn.props)===null||be===void 0?void 0:be.className,!_t&&(Ht==null?void 0:Ht.variant))||null}),ee=(0,Te.useRef)(null);if(Te.useImperativeHandle(fe,function(){return{nativeElement:ee.current||ve.current}}),_t){var xe=null;if(pe){var Ke=!ie&&!A&&ze,Xe="".concat(Be,"-clear-icon"),nt=(0,ge.Z)(pe)==="object"&&pe!==null&&pe!==void 0&&pe.clearIcon?pe.clearIcon:"\u2716";xe=Te.createElement("button",{type:"button",tabIndex:-1,onClick:function(rt){at==null||at(rt),di==null||di()},onMouseDown:function(rt){return rt.preventDefault()},className:S()(Xe,(0,Ze.Z)((0,Ze.Z)({},"".concat(Xe,"-hidden"),!Ke),"".concat(Xe,"-has-suffix"),!!te))},nt)}var gt="".concat(Be,"-affix-wrapper"),Yt=S()(gt,(0,Ze.Z)((0,Ze.Z)((0,Ze.Z)((0,Ze.Z)((0,Ze.Z)({},"".concat(Be,"-disabled"),ie),"".concat(gt,"-disabled"),ie),"".concat(gt,"-focused"),L),"".concat(gt,"-readonly"),A),"".concat(gt,"-input-with-clear-btn"),te&&pe&&ze),Me==null?void 0:Me.affixWrapper,Ht==null?void 0:Ht.affixWrapper,Ht==null?void 0:Ht.variant),dt=(te||pe)&&Te.createElement("span",{className:S()("".concat(Be,"-suffix"),Ht==null?void 0:Ht.suffix),style:ft==null?void 0:ft.suffix},xe,te);lt=Te.createElement(Kt,(0,De.Z)({className:Yt,style:ft==null?void 0:ft.affixWrapper,onClick:it},Dt==null?void 0:Dt.affixWrapper,{ref:ve}),At&&Te.createElement("span",{className:S()("".concat(Be,"-prefix"),Ht==null?void 0:Ht.prefix),style:ft==null?void 0:ft.prefix},At),lt,dt)}if((0,P.He)(G)){var ke="".concat(Be,"-group"),bt="".concat(ke,"-addon"),Gt="".concat(ke,"-wrapper"),Pt=S()("".concat(Be,"-wrapper"),ke,Me==null?void 0:Me.wrapper,Ht==null?void 0:Ht.wrapper),Ae=S()(Gt,(0,Ze.Z)({},"".concat(Gt,"-disabled"),ie),Me==null?void 0:Me.group,Ht==null?void 0:Ht.groupWrapper);lt=Te.createElement(hn,{className:Ae,ref:ee},Te.createElement(Ne,{className:Pt},z&&Te.createElement(He,{className:bt},z),lt,X&&Te.createElement(He,{className:bt},X)))}return Te.cloneElement(lt,{className:S()((Se=lt.props)===null||Se===void 0?void 0:Se.className,Q)||null,style:(0,ce.Z)((0,ce.Z)({},(se=lt.props)===null||se===void 0?void 0:se.style),de),hidden:Bt})}),re=f,R=oe(94480),k=oe(42978),T=oe(75931),M=oe(18929),O=oe(2738),Y=oe(66003),H=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],j=(0,Te.forwardRef)(function(G,fe){var be=G.autoComplete,Se=G.onChange,se=G.onFocus,Oe=G.onBlur,We=G.onPressEnter,Be=G.onKeyDown,At=G.onKeyUp,te=G.prefixCls,z=te===void 0?"rc-input":te,X=G.disabled,Q=G.htmlSize,de=G.className,ie=G.maxLength,A=G.suffix,L=G.showCount,V=G.count,pe=G.type,ze=pe===void 0?"text":pe,at=G.classes,Bt=G.classNames,Me=G.styles,Ht=G.onCompositionStart,Dt=G.onCompositionEnd,ft=(0,T.Z)(G,H),Si=(0,Te.useState)(!1),di=(0,k.Z)(Si,2),tn=di[0],Kt=di[1],hn=(0,Te.useRef)(!1),Ne=(0,Te.useRef)(!1),He=(0,Te.useRef)(null),ve=(0,Te.useRef)(null),it=function(Ft){He.current&&(0,P.nH)(He.current,Ft)},_t=(0,M.Z)(G.defaultValue,{value:G.value}),lt=(0,k.Z)(_t,2),ee=lt[0],xe=lt[1],Ke=ee==null?"":String(ee),Xe=(0,Te.useState)(null),nt=(0,k.Z)(Xe,2),gt=nt[0],Yt=nt[1],dt=(0,Y.Z)(V,L),ke=dt.max||ie,bt=dt.strategy(Ke),Gt=!!ke&&bt>ke;(0,Te.useImperativeHandle)(fe,function(){var Je;return{focus:it,blur:function(){var Le;(Le=He.current)===null||Le===void 0||Le.blur()},setSelectionRange:function(Le,ye,we){var K;(K=He.current)===null||K===void 0||K.setSelectionRange(Le,ye,we)},select:function(){var Le;(Le=He.current)===null||Le===void 0||Le.select()},input:He.current,nativeElement:((Je=ve.current)===null||Je===void 0?void 0:Je.nativeElement)||He.current}}),(0,Te.useEffect)(function(){Ne.current&&(Ne.current=!1),Kt(function(Je){return Je&&X?!1:Je})},[X]);var Pt=function(Ft,Le,ye){var we=Le;if(!hn.current&&dt.exceedFormatter&&dt.max&&dt.strategy(Le)>dt.max){if(we=dt.exceedFormatter(Le,{max:dt.max}),Le!==we){var K,W;Yt([((K=He.current)===null||K===void 0?void 0:K.selectionStart)||0,((W=He.current)===null||W===void 0?void 0:W.selectionEnd)||0])}}else if(ye.source==="compositionEnd")return;xe(we),He.current&&(0,P.rJ)(He.current,Ft,Se,we)};(0,Te.useEffect)(function(){if(gt){var Je;(Je=He.current)===null||Je===void 0||Je.setSelectionRange.apply(Je,(0,R.Z)(gt))}},[gt]);var Ae=function(Ft){Pt(Ft,Ft.target.value,{source:"change"})},Ce=function(Ft){hn.current=!1,Pt(Ft,Ft.currentTarget.value,{source:"compositionEnd"}),Dt==null||Dt(Ft)},rt=function(Ft){We&&Ft.key==="Enter"&&!Ne.current&&(Ne.current=!0,We(Ft)),Be==null||Be(Ft)},ut=function(Ft){Ft.key==="Enter"&&(Ne.current=!1),At==null||At(Ft)},je=function(Ft){Kt(!0),se==null||se(Ft)},kt=function(Ft){Ne.current&&(Ne.current=!1),Kt(!1),Oe==null||Oe(Ft)},Tt=function(Ft){xe(""),it(),He.current&&(0,P.rJ)(He.current,Ft,Se)},vt=Gt&&"".concat(z,"-out-of-range"),Ot=function(){var Ft=(0,O.Z)(G,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return Te.createElement("input",(0,De.Z)({autoComplete:be},Ft,{onChange:Ae,onFocus:je,onBlur:kt,onKeyDown:rt,onKeyUp:ut,className:S()(z,(0,Ze.Z)({},"".concat(z,"-disabled"),X),Bt==null?void 0:Bt.input),style:Me==null?void 0:Me.input,ref:He,size:Q,type:ze,onCompositionStart:function(ye){hn.current=!0,Ht==null||Ht(ye)},onCompositionEnd:Ce}))},jt=function(){var Ft=Number(ke)>0;if(A||dt.show){var Le=dt.showFormatter?dt.showFormatter({value:Ke,count:bt,maxLength:ke}):"".concat(bt).concat(Ft?" / ".concat(ke):"");return Te.createElement(Te.Fragment,null,dt.show&&Te.createElement("span",{className:S()("".concat(z,"-show-count-suffix"),(0,Ze.Z)({},"".concat(z,"-show-count-has-suffix"),!!A),Bt==null?void 0:Bt.count),style:(0,ce.Z)({},Me==null?void 0:Me.count)},Le),A)}return null};return Te.createElement(re,(0,De.Z)({},ft,{prefixCls:z,className:S()(de,vt),handleReset:Tt,value:Ke,focused:tn,triggerFocus:it,suffix:jt(),disabled:X,classes:at,classNames:Bt,styles:Me}),Ot())}),U=j,$=U},30292:function(Li,It,oe){"use strict";oe.d(It,{He:function(){return ce},X3:function(){return De},nH:function(){return q},rJ:function(){return ge}});function ce(S){return!!(S.addonBefore||S.addonAfter)}function De(S){return!!(S.prefix||S.suffix||S.allowClear)}function Ze(S,Te,P){var f=Te.cloneNode(!0),re=Object.create(S,{target:{value:f},currentTarget:{value:f}});return f.value=P,typeof Te.selectionStart=="number"&&typeof Te.selectionEnd=="number"&&(f.selectionStart=Te.selectionStart,f.selectionEnd=Te.selectionEnd),f.setSelectionRange=function(){Te.setSelectionRange.apply(Te,arguments)},re}function ge(S,Te,P,f){if(P){var re=Te;if(Te.type==="click"){re=Ze(Te,S,""),P(re);return}if(S.type!=="file"&&f!==void 0){re=Ze(Te,S,f),P(re);return}P(re)}}function q(S,Te){if(S){S.focus(Te);var P=Te||{},f=P.cursor;if(f){var re=S.value.length;switch(f){case"start":S.setSelectionRange(0,0);break;case"end":S.setSelectionRange(re,re);break;default:S.setSelectionRange(0,re)}}}}},28321:function(Li,It,oe){"use strict";oe.d(It,{iz:function(){return nn},ck:function(){return we},BW:function(){return wn},sN:function(){return we},Wd:function(){return an},ZP:function(){return ai},Xl:function(){return We}});var ce=oe(54476),De=oe(20068),Ze=oe(33885),ge=oe(94480),q=oe(42978),S=oe(75931),Te=oe(92310),P=oe.n(Te),f=oe(11780),re=oe(18929),R=oe(13697),k=oe(48736),T=oe(59301),M=oe(4676),O=T.createContext(null);function Y(Re,$e){return Re===void 0?null:"".concat(Re,"-").concat($e)}function H(Re){var $e=T.useContext(O);return Y($e,Re)}var j=oe(80547),U=["children","locked"],$=T.createContext(null);function G(Re,$e){var ht=(0,Ze.Z)({},Re);return Object.keys($e).forEach(function(et){var wt=$e[et];wt!==void 0&&(ht[et]=wt)}),ht}function fe(Re){var $e=Re.children,ht=Re.locked,et=(0,S.Z)(Re,U),wt=T.useContext($),Ct=(0,j.Z)(function(){return G(wt,et)},[wt,et],function(zt,Wt){return!ht&&(zt[0]!==Wt[0]||!(0,R.Z)(zt[1],Wt[1],!0))});return T.createElement($.Provider,{value:Ct},$e)}var be=[],Se=T.createContext(null);function se(){return T.useContext(Se)}var Oe=T.createContext(be);function We(Re){var $e=T.useContext(Oe);return T.useMemo(function(){return Re!==void 0?[].concat((0,ge.Z)($e),[Re]):$e},[$e,Re])}var Be=T.createContext(null),At=T.createContext({}),te=At,z=oe(29194);function X(Re){var $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,z.Z)(Re)){var ht=Re.nodeName.toLowerCase(),et=["input","select","textarea","button"].includes(ht)||Re.isContentEditable||ht==="a"&&!!Re.getAttribute("href"),wt=Re.getAttribute("tabindex"),Ct=Number(wt),zt=null;return wt&&!Number.isNaN(Ct)?zt=Ct:et&&zt===null&&(zt=0),et&&Re.disabled&&(zt=null),zt!==null&&(zt>=0||$e&&zt<0)}return!1}function Q(Re){var $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ht=(0,ge.Z)(Re.querySelectorAll("*")).filter(function(et){return X(et,$e)});return X(Re,$e)&&ht.unshift(Re),ht}var de=null;function ie(){de=document.activeElement}function A(){de=null}function L(){if(de)try{de.focus()}catch(Re){}}function V(Re,$e){if($e.keyCode===9){var ht=Q(Re),et=ht[$e.shiftKey?0:ht.length-1],wt=et===document.activeElement||Re===document.activeElement;if(wt){var Ct=ht[$e.shiftKey?ht.length-1:0];Ct.focus(),$e.preventDefault()}}}var pe=oe(10228),ze=oe(16089),at=pe.Z.LEFT,Bt=pe.Z.RIGHT,Me=pe.Z.UP,Ht=pe.Z.DOWN,Dt=pe.Z.ENTER,ft=pe.Z.ESC,Si=pe.Z.HOME,di=pe.Z.END,tn=[Me,Ht,at,Bt];function Kt(Re,$e,ht,et){var wt,Ct="prev",zt="next",Wt="children",Pi="parent";if(Re==="inline"&&et===Dt)return{inlineTrigger:!0};var ki=(0,De.Z)((0,De.Z)({},Me,Ct),Ht,zt),_n=(0,De.Z)((0,De.Z)((0,De.Z)((0,De.Z)({},at,ht?zt:Ct),Bt,ht?Ct:zt),Ht,Wt),Dt,Wt),oi=(0,De.Z)((0,De.Z)((0,De.Z)((0,De.Z)((0,De.Z)((0,De.Z)({},Me,Ct),Ht,zt),Dt,Wt),ft,Pi),at,ht?Wt:Pi),Bt,ht?Pi:Wt),Ri={inline:ki,horizontal:_n,vertical:oi,inlineSub:ki,horizontalSub:oi,verticalSub:oi},Ai=(wt=Ri["".concat(Re).concat($e?"":"Sub")])===null||wt===void 0?void 0:wt[et];switch(Ai){case Ct:return{offset:-1,sibling:!0};case zt:return{offset:1,sibling:!0};case Pi:return{offset:-1,sibling:!1};case Wt:return{offset:1,sibling:!1};default:return null}}function hn(Re){for(var $e=Re;$e;){if($e.getAttribute("data-menu-list"))return $e;$e=$e.parentElement}return null}function Ne(Re,$e){for(var ht=Re||document.activeElement;ht;){if($e.has(ht))return ht;ht=ht.parentElement}return null}function He(Re,$e){var ht=Q(Re,!0);return ht.filter(function(et){return $e.has(et)})}function ve(Re,$e,ht){var et=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Re)return null;var wt=He(Re,$e),Ct=wt.length,zt=wt.findIndex(function(Wt){return ht===Wt});return et<0?zt===-1?zt=Ct-1:zt-=1:et>0&&(zt+=1),zt=(zt+Ct)%Ct,wt[zt]}var it=function($e,ht){var et=new Set,wt=new Map,Ct=new Map;return $e.forEach(function(zt){var Wt=document.querySelector("[data-menu-id='".concat(Y(ht,zt),"']"));Wt&&(et.add(Wt),Ct.set(Wt,zt),wt.set(zt,Wt))}),{elements:et,key2element:wt,element2key:Ct}};function _t(Re,$e,ht,et,wt,Ct,zt,Wt,Pi,ki){var _n=T.useRef(),oi=T.useRef();oi.current=$e;var Ri=function(){ze.Z.cancel(_n.current)};return T.useEffect(function(){return function(){Ri()}},[]),function(Ai){var Fi=Ai.which;if([].concat(tn,[Dt,ft,Si,di]).includes(Fi)){var Vi=Ct(),yi=it(Vi,et),Ii=yi,Wi=Ii.elements,Bi=Ii.key2element,bi=Ii.element2key,Ji=Bi.get($e),Gi=Ne(Ji,Wi),Yi=bi.get(Gi),Rn=Kt(Re,zt(Yi,!0).length===1,ht,Fi);if(!Rn&&Fi!==Si&&Fi!==di)return;(tn.includes(Fi)||[Si,di].includes(Fi))&&Ai.preventDefault();var on=function(Qi){if(Qi){var br=Qi,ln=Qi.querySelector("a");ln!=null&&ln.getAttribute("href")&&(br=ln);var Oi=bi.get(Qi);Wt(Oi),Ri(),_n.current=(0,ze.Z)(function(){oi.current===Oi&&br.focus()})}};if([Si,di].includes(Fi)||Rn.sibling||!Gi){var Jn;!Gi||Re==="inline"?Jn=wt.current:Jn=hn(Gi);var vn,Tn=He(Jn,Wi);Fi===Si?vn=Tn[0]:Fi===di?vn=Tn[Tn.length-1]:vn=ve(Jn,Wi,Gi,Rn.offset),on(vn)}else if(Rn.inlineTrigger)Pi(Yi);else if(Rn.offset>0)Pi(Yi,!0),Ri(),_n.current=(0,ze.Z)(function(){yi=it(Vi,et);var Ui=Gi.getAttribute("aria-controls"),Qi=document.getElementById(Ui),br=ve(Qi,yi.elements);on(br)},5);else if(Rn.offset<0){var Wn=zt(Yi,!0),Pn=Wn[Wn.length-2],dn=Bi.get(Pn);Pi(Pn,!1),on(dn)}}ki==null||ki(Ai)}}function lt(Re){Promise.resolve().then(Re)}var ee="__RC_UTIL_PATH_SPLIT__",xe=function($e){return $e.join(ee)},Ke=function($e){return $e.split(ee)},Xe="rc-menu-more";function nt(){var Re=T.useState({}),$e=(0,q.Z)(Re,2),ht=$e[1],et=(0,T.useRef)(new Map),wt=(0,T.useRef)(new Map),Ct=T.useState([]),zt=(0,q.Z)(Ct,2),Wt=zt[0],Pi=zt[1],ki=(0,T.useRef)(0),_n=(0,T.useRef)(!1),oi=function(){_n.current||ht({})},Ri=(0,T.useCallback)(function(Bi,bi){var Ji=xe(bi);wt.current.set(Ji,Bi),et.current.set(Bi,Ji),ki.current+=1;var Gi=ki.current;lt(function(){Gi===ki.current&&oi()})},[]),Ai=(0,T.useCallback)(function(Bi,bi){var Ji=xe(bi);wt.current.delete(Ji),et.current.delete(Bi)},[]),Fi=(0,T.useCallback)(function(Bi){Pi(Bi)},[]),Vi=(0,T.useCallback)(function(Bi,bi){var Ji=et.current.get(Bi)||"",Gi=Ke(Ji);return bi&&Wt.includes(Gi[0])&&Gi.unshift(Xe),Gi},[Wt]),yi=(0,T.useCallback)(function(Bi,bi){return Bi.filter(function(Ji){return Ji!==void 0}).some(function(Ji){var Gi=Vi(Ji,!0);return Gi.includes(bi)})},[Vi]),Ii=function(){var bi=(0,ge.Z)(et.current.keys());return Wt.length&&bi.push(Xe),bi},Wi=(0,T.useCallback)(function(Bi){var bi="".concat(et.current.get(Bi)).concat(ee),Ji=new Set;return(0,ge.Z)(wt.current.keys()).forEach(function(Gi){Gi.startsWith(bi)&&Ji.add(wt.current.get(Gi))}),Ji},[]);return T.useEffect(function(){return function(){_n.current=!0}},[]),{registerPath:Ri,unregisterPath:Ai,refreshOverflowKeys:Fi,isSubPathKey:yi,getKeyPath:Vi,getKeys:Ii,getSubPathKeys:Wi}}function gt(Re){var $e=T.useRef(Re);$e.current=Re;var ht=T.useCallback(function(){for(var et,wt=arguments.length,Ct=new Array(wt),zt=0;zt<wt;zt++)Ct[zt]=arguments[zt];return(et=$e.current)===null||et===void 0?void 0:et.call.apply(et,[$e].concat(Ct))},[]);return Re?ht:void 0}var Yt=Math.random().toFixed(5).toString().slice(2),dt=0;function ke(Re){var $e=(0,re.Z)(Re,{value:Re}),ht=(0,q.Z)($e,2),et=ht[0],wt=ht[1];return T.useEffect(function(){dt+=1;var Ct="".concat(Yt,"-").concat(dt);wt("rc-menu-uuid-".concat(Ct))},[]),et}var bt=oe(67732),Gt=oe(83652),Pt=oe(42403),Ae=oe(158),Ce=oe(2738),rt=oe(8654);function ut(Re,$e,ht,et){var wt=T.useContext($),Ct=wt.activeKey,zt=wt.onActive,Wt=wt.onInactive,Pi={active:Ct===Re};return $e||(Pi.onMouseEnter=function(ki){ht==null||ht({key:Re,domEvent:ki}),zt(Re)},Pi.onMouseLeave=function(ki){et==null||et({key:Re,domEvent:ki}),Wt(Re)}),Pi}function je(Re){var $e=T.useContext($),ht=$e.mode,et=$e.rtl,wt=$e.inlineIndent;if(ht!=="inline")return null;var Ct=Re;return et?{paddingRight:Ct*wt}:{paddingLeft:Ct*wt}}function kt(Re){var $e=Re.icon,ht=Re.props,et=Re.children,wt;return $e===null||$e===!1?null:(typeof $e=="function"?wt=T.createElement($e,(0,Ze.Z)({},ht)):typeof $e!="boolean"&&(wt=$e),wt||et||null)}var Tt=["item"];function vt(Re){var $e=Re.item,ht=(0,S.Z)(Re,Tt);return Object.defineProperty(ht,"item",{get:function(){return(0,k.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),$e}}),ht}var Ot=["title","attribute","elementRef"],jt=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],Je=["active"],Ft=function(Re){(0,Pt.Z)(ht,Re);var $e=(0,Ae.Z)(ht);function ht(){return(0,bt.Z)(this,ht),$e.apply(this,arguments)}return(0,Gt.Z)(ht,[{key:"render",value:function(){var wt=this.props,Ct=wt.title,zt=wt.attribute,Wt=wt.elementRef,Pi=(0,S.Z)(wt,Ot),ki=(0,Ce.Z)(Pi,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,k.ZP)(!zt,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),T.createElement(f.Z.Item,(0,ce.Z)({},zt,{title:typeof Ct=="string"?Ct:void 0},ki,{ref:Wt}))}}]),ht}(T.Component),Le=T.forwardRef(function(Re,$e){var ht=Re.style,et=Re.className,wt=Re.eventKey,Ct=Re.warnKey,zt=Re.disabled,Wt=Re.itemIcon,Pi=Re.children,ki=Re.role,_n=Re.onMouseEnter,oi=Re.onMouseLeave,Ri=Re.onClick,Ai=Re.onKeyDown,Fi=Re.onFocus,Vi=(0,S.Z)(Re,jt),yi=H(wt),Ii=T.useContext($),Wi=Ii.prefixCls,Bi=Ii.onItemClick,bi=Ii.disabled,Ji=Ii.overflowDisabled,Gi=Ii.itemIcon,Yi=Ii.selectedKeys,Rn=Ii.onActive,on=T.useContext(te),Jn=on._internalRenderMenuItem,vn="".concat(Wi,"-item"),Tn=T.useRef(),Wn=T.useRef(),Pn=bi||zt,dn=(0,rt.x1)($e,Wn),Ui=We(wt),Qi=function(Nn){return{key:wt,keyPath:(0,ge.Z)(Ui).reverse(),item:Tn.current,domEvent:Nn}},br=Wt||Gi,ln=ut(wt,Pn,_n,oi),Oi=ln.active,or=(0,S.Z)(ln,Je),xr=Yi.includes(wt),Un=je(Ui.length),Lr=function(Nn){if(!Pn){var lr=Qi(Nn);Ri==null||Ri(vt(lr)),Bi(lr)}},rn=function(Nn){if(Ai==null||Ai(Nn),Nn.which===pe.Z.ENTER){var lr=Qi(Nn);Ri==null||Ri(vt(lr)),Bi(lr)}},er=function(Nn){Rn(wt),Fi==null||Fi(Nn)},Dr={};Re.role==="option"&&(Dr["aria-selected"]=xr);var kr=T.createElement(Ft,(0,ce.Z)({ref:Tn,elementRef:dn,role:ki===null?"none":ki||"menuitem",tabIndex:zt?null:-1,"data-menu-id":Ji&&yi?null:yi},(0,Ce.Z)(Vi,["extra"]),or,Dr,{component:"li","aria-disabled":zt,style:(0,Ze.Z)((0,Ze.Z)({},Un),ht),className:P()(vn,(0,De.Z)((0,De.Z)((0,De.Z)({},"".concat(vn,"-active"),Oi),"".concat(vn,"-selected"),xr),"".concat(vn,"-disabled"),Pn),et),onClick:Lr,onKeyDown:rn,onFocus:er}),Pi,T.createElement(kt,{props:(0,Ze.Z)((0,Ze.Z)({},Re),{},{isSelected:xr}),icon:br}));return Jn&&(kr=Jn(kr,Re,{selected:xr})),kr});function ye(Re,$e){var ht=Re.eventKey,et=se(),wt=We(ht);return T.useEffect(function(){if(et)return et.registerPath(ht,wt),function(){et.unregisterPath(ht,wt)}},[wt]),et?null:T.createElement(Le,(0,ce.Z)({},Re,{ref:$e}))}var we=T.forwardRef(ye),K=["className","children"],W=function($e,ht){var et=$e.className,wt=$e.children,Ct=(0,S.Z)($e,K),zt=T.useContext($),Wt=zt.prefixCls,Pi=zt.mode,ki=zt.rtl;return T.createElement("ul",(0,ce.Z)({className:P()(Wt,ki&&"".concat(Wt,"-rtl"),"".concat(Wt,"-sub"),"".concat(Wt,"-").concat(Pi==="inline"?"inline":"vertical"),et),role:"menu"},Ct,{"data-menu-list":!0,ref:ht}),wt)},ae=T.forwardRef(W);ae.displayName="SubMenuList";var he=ae,_e=oe(11592);function st(Re,$e){return(0,_e.Z)(Re).map(function(ht,et){if(T.isValidElement(ht)){var wt,Ct,zt=ht.key,Wt=(wt=(Ct=ht.props)===null||Ct===void 0?void 0:Ct.eventKey)!==null&&wt!==void 0?wt:zt,Pi=Wt==null;Pi&&(Wt="tmp_key-".concat([].concat((0,ge.Z)($e),[et]).join("-")));var ki={key:Wt,eventKey:Wt};return T.cloneElement(ht,ki)}return ht})}var ot=oe(65030),xt={adjustX:1,adjustY:1},Nt={topLeft:{points:["bl","tl"],overflow:xt},topRight:{points:["br","tr"],overflow:xt},bottomLeft:{points:["tl","bl"],overflow:xt},bottomRight:{points:["tr","br"],overflow:xt},leftTop:{points:["tr","tl"],overflow:xt},leftBottom:{points:["br","bl"],overflow:xt},rightTop:{points:["tl","tr"],overflow:xt},rightBottom:{points:["bl","br"],overflow:xt}},Xt={topLeft:{points:["bl","tl"],overflow:xt},topRight:{points:["br","tr"],overflow:xt},bottomLeft:{points:["tl","bl"],overflow:xt},bottomRight:{points:["tr","br"],overflow:xt},rightTop:{points:["tr","tl"],overflow:xt},rightBottom:{points:["br","bl"],overflow:xt},leftTop:{points:["tl","tr"],overflow:xt},leftBottom:{points:["bl","br"],overflow:xt}},vi=null;function ti(Re,$e,ht){if($e)return $e;if(ht)return ht[Re]||ht.other}var St={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function ii(Re){var $e=Re.prefixCls,ht=Re.visible,et=Re.children,wt=Re.popup,Ct=Re.popupStyle,zt=Re.popupClassName,Wt=Re.popupOffset,Pi=Re.disabled,ki=Re.mode,_n=Re.onVisibleChange,oi=T.useContext($),Ri=oi.getPopupContainer,Ai=oi.rtl,Fi=oi.subMenuOpenDelay,Vi=oi.subMenuCloseDelay,yi=oi.builtinPlacements,Ii=oi.triggerSubMenuAction,Wi=oi.forceSubMenuRender,Bi=oi.rootClassName,bi=oi.motion,Ji=oi.defaultMotions,Gi=T.useState(!1),Yi=(0,q.Z)(Gi,2),Rn=Yi[0],on=Yi[1],Jn=Ai?(0,Ze.Z)((0,Ze.Z)({},Xt),yi):(0,Ze.Z)((0,Ze.Z)({},Nt),yi),vn=St[ki],Tn=ti(ki,bi,Ji),Wn=T.useRef(Tn);ki!=="inline"&&(Wn.current=Tn);var Pn=(0,Ze.Z)((0,Ze.Z)({},Wn.current),{},{leavedClassName:"".concat($e,"-hidden"),removeOnLeave:!1,motionAppear:!0}),dn=T.useRef();return T.useEffect(function(){return dn.current=(0,ze.Z)(function(){on(ht)}),function(){ze.Z.cancel(dn.current)}},[ht]),T.createElement(ot.Z,{prefixCls:$e,popupClassName:P()("".concat($e,"-popup"),(0,De.Z)({},"".concat($e,"-rtl"),Ai),zt,Bi),stretch:ki==="horizontal"?"minWidth":null,getPopupContainer:Ri,builtinPlacements:Jn,popupPlacement:vn,popupVisible:Rn,popup:wt,popupStyle:Ct,popupAlign:Wt&&{offset:Wt},action:Pi?[]:[Ii],mouseEnterDelay:Fi,mouseLeaveDelay:Vi,onPopupVisibleChange:_n,forceRender:Wi,popupMotion:Pn,fresh:!0},et)}var Di=oe(77900);function Ei(Re){var $e=Re.id,ht=Re.open,et=Re.keyPath,wt=Re.children,Ct="inline",zt=T.useContext($),Wt=zt.prefixCls,Pi=zt.forceSubMenuRender,ki=zt.motion,_n=zt.defaultMotions,oi=zt.mode,Ri=T.useRef(!1);Ri.current=oi===Ct;var Ai=T.useState(!Ri.current),Fi=(0,q.Z)(Ai,2),Vi=Fi[0],yi=Fi[1],Ii=Ri.current?ht:!1;T.useEffect(function(){Ri.current&&yi(!1)},[oi]);var Wi=(0,Ze.Z)({},ti(Ct,ki,_n));et.length>1&&(Wi.motionAppear=!1);var Bi=Wi.onVisibleChanged;return Wi.onVisibleChanged=function(bi){return!Ri.current&&!bi&&yi(!0),Bi==null?void 0:Bi(bi)},Vi?null:T.createElement(fe,{mode:Ct,locked:!Ri.current},T.createElement(Di.default,(0,ce.Z)({visible:Ii},Wi,{forceRender:Pi,removeOnLeave:!1,leavedClassName:"".concat(Wt,"-hidden")}),function(bi){var Ji=bi.className,Gi=bi.style;return T.createElement(he,{id:$e,className:Ji,style:Gi},wt)}))}var $i=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],pi=["active"],mi=T.forwardRef(function(Re,$e){var ht=Re.style,et=Re.className,wt=Re.title,Ct=Re.eventKey,zt=Re.warnKey,Wt=Re.disabled,Pi=Re.internalPopupClose,ki=Re.children,_n=Re.itemIcon,oi=Re.expandIcon,Ri=Re.popupClassName,Ai=Re.popupOffset,Fi=Re.popupStyle,Vi=Re.onClick,yi=Re.onMouseEnter,Ii=Re.onMouseLeave,Wi=Re.onTitleClick,Bi=Re.onTitleMouseEnter,bi=Re.onTitleMouseLeave,Ji=(0,S.Z)(Re,$i),Gi=H(Ct),Yi=T.useContext($),Rn=Yi.prefixCls,on=Yi.mode,Jn=Yi.openKeys,vn=Yi.disabled,Tn=Yi.overflowDisabled,Wn=Yi.activeKey,Pn=Yi.selectedKeys,dn=Yi.itemIcon,Ui=Yi.expandIcon,Qi=Yi.onItemClick,br=Yi.onOpenChange,ln=Yi.onActive,Oi=T.useContext(te),or=Oi._internalRenderSubMenuItem,xr=T.useContext(Be),Un=xr.isSubPathKey,Lr=We(),rn="".concat(Rn,"-submenu"),er=vn||Wt,Dr=T.useRef(),kr=T.useRef(),wr=_n!=null?_n:dn,Nn=oi!=null?oi:Ui,lr=Jn.includes(Ct),ur=!Tn&&lr,Rr=Un(Pn,Ct),An=ut(Ct,er,Bi,bi),ar=An.active,Sr=(0,S.Z)(An,pi),cr=T.useState(!1),hr=(0,q.Z)(cr,2),qi=hr[0],fi=hr[1],ji=function(dr){er||fi(dr)},bn=function(dr){ji(!0),yi==null||yi({key:Ct,domEvent:dr})},li=function(dr){ji(!1),Ii==null||Ii({key:Ct,domEvent:dr})},zn=T.useMemo(function(){return ar||(on!=="inline"?qi||Un([Wn],Ct):!1)},[on,ar,Wn,qi,Ct,Un]),tr=je(Lr.length),Cn=function(dr){er||(Wi==null||Wi({key:Ct,domEvent:dr}),on==="inline"&&br(Ct,!lr))},is=gt(function(jn){Vi==null||Vi(vt(jn)),Qi(jn)}),Tr=function(dr){on!=="inline"&&br(Ct,dr)},_s=function(){ln(Ct)},ns=Gi&&"".concat(Gi,"-popup"),pn=T.useMemo(function(){return T.createElement(kt,{icon:on!=="horizontal"?Nn:void 0,props:(0,Ze.Z)((0,Ze.Z)({},Re),{},{isOpen:ur,isSubMenu:!0})},T.createElement("i",{className:"".concat(rn,"-arrow")}))},[on,Nn,Re,ur,rn]),ir=T.createElement("div",(0,ce.Z)({role:"menuitem",style:tr,className:"".concat(rn,"-title"),tabIndex:er?null:-1,ref:Dr,title:typeof wt=="string"?wt:null,"data-menu-id":Tn&&Gi?null:Gi,"aria-expanded":ur,"aria-haspopup":!0,"aria-controls":ns,"aria-disabled":er,onClick:Cn,onFocus:_s},Sr),wt,pn),Yr=T.useRef(on);if(on!=="inline"&&Lr.length>1?Yr.current="vertical":Yr.current=on,!Tn){var vs=Yr.current;ir=T.createElement(ii,{mode:vs,prefixCls:rn,visible:!Pi&&ur&&on!=="inline",popupClassName:Ri,popupOffset:Ai,popupStyle:Fi,popup:T.createElement(fe,{mode:vs==="horizontal"?"vertical":vs},T.createElement(he,{id:ns,ref:kr},ki)),disabled:er,onVisibleChange:Tr},ir)}var fr=T.createElement(f.Z.Item,(0,ce.Z)({ref:$e,role:"none"},Ji,{component:"li",style:ht,className:P()(rn,"".concat(rn,"-").concat(on),et,(0,De.Z)((0,De.Z)((0,De.Z)((0,De.Z)({},"".concat(rn,"-open"),ur),"".concat(rn,"-active"),zn),"".concat(rn,"-selected"),Rr),"".concat(rn,"-disabled"),er)),onMouseEnter:bn,onMouseLeave:li}),ir,!Tn&&T.createElement(Ei,{id:ns,open:ur,keyPath:Lr},ki));return or&&(fr=or(fr,Re,{selected:Rr,active:zn,open:ur,disabled:er})),T.createElement(fe,{onItemClick:is,mode:on==="horizontal"?"vertical":on,itemIcon:wr,expandIcon:Nn},fr)}),Xi=T.forwardRef(function(Re,$e){var ht=Re.eventKey,et=Re.children,wt=We(ht),Ct=st(et,wt),zt=se();T.useEffect(function(){if(zt)return zt.registerPath(ht,wt),function(){zt.unregisterPath(ht,wt)}},[wt]);var Wt;return zt?Wt=Ct:Wt=T.createElement(mi,(0,ce.Z)({ref:$e},Re),Ct),T.createElement(Oe.Provider,{value:wt},Wt)}),an=Xi,mn=oe(76190);function nn(Re){var $e=Re.className,ht=Re.style,et=T.useContext($),wt=et.prefixCls,Ct=se();return Ct?null:T.createElement("li",{role:"separator",className:P()("".concat(wt,"-item-divider"),$e),style:ht})}var gr=["className","title","eventKey","children"],Ci=T.forwardRef(function(Re,$e){var ht=Re.className,et=Re.title,wt=Re.eventKey,Ct=Re.children,zt=(0,S.Z)(Re,gr),Wt=T.useContext($),Pi=Wt.prefixCls,ki="".concat(Pi,"-item-group");return T.createElement("li",(0,ce.Z)({ref:$e,role:"presentation"},zt,{onClick:function(oi){return oi.stopPropagation()},className:P()(ki,ht)}),T.createElement("div",{role:"presentation",className:"".concat(ki,"-title"),title:typeof et=="string"?et:void 0},et),T.createElement("ul",{role:"group",className:"".concat(ki,"-list")},Ct))}),Ki=T.forwardRef(function(Re,$e){var ht=Re.eventKey,et=Re.children,wt=We(ht),Ct=st(et,wt),zt=se();return zt?Ct:T.createElement(Ci,(0,ce.Z)({ref:$e},(0,Ce.Z)(Re,["warnKey"])),Ct)}),wn=Ki,Mi=["label","children","key","type","extra"];function In(Re,$e,ht){var et=$e.item,wt=$e.group,Ct=$e.submenu,zt=$e.divider;return(Re||[]).map(function(Wt,Pi){if(Wt&&(0,mn.Z)(Wt)==="object"){var ki=Wt,_n=ki.label,oi=ki.children,Ri=ki.key,Ai=ki.type,Fi=ki.extra,Vi=(0,S.Z)(ki,Mi),yi=Ri!=null?Ri:"tmp-".concat(Pi);return oi||Ai==="group"?Ai==="group"?T.createElement(wt,(0,ce.Z)({key:yi},Vi,{title:_n}),In(oi,$e,ht)):T.createElement(Ct,(0,ce.Z)({key:yi},Vi,{title:_n}),In(oi,$e,ht)):Ai==="divider"?T.createElement(zt,(0,ce.Z)({key:yi},Vi)):T.createElement(et,(0,ce.Z)({key:yi},Vi,{extra:Fi}),_n,(!!Fi||Fi===0)&&T.createElement("span",{className:"".concat(ht,"-item-extra")},Fi))}return null}).filter(function(Wt){return Wt})}function fn(Re,$e,ht,et,wt){var Ct=Re,zt=(0,Ze.Z)({divider:nn,item:we,group:wn,submenu:an},et);return $e&&(Ct=In($e,zt,wt)),st(Ct,ht)}var sr=["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"],gn=[],Xn=T.forwardRef(function(Re,$e){var ht,et=Re,wt=et.prefixCls,Ct=wt===void 0?"rc-menu":wt,zt=et.rootClassName,Wt=et.style,Pi=et.className,ki=et.tabIndex,_n=ki===void 0?0:ki,oi=et.items,Ri=et.children,Ai=et.direction,Fi=et.id,Vi=et.mode,yi=Vi===void 0?"vertical":Vi,Ii=et.inlineCollapsed,Wi=et.disabled,Bi=et.disabledOverflow,bi=et.subMenuOpenDelay,Ji=bi===void 0?.1:bi,Gi=et.subMenuCloseDelay,Yi=Gi===void 0?.1:Gi,Rn=et.forceSubMenuRender,on=et.defaultOpenKeys,Jn=et.openKeys,vn=et.activeKey,Tn=et.defaultActiveFirst,Wn=et.selectable,Pn=Wn===void 0?!0:Wn,dn=et.multiple,Ui=dn===void 0?!1:dn,Qi=et.defaultSelectedKeys,br=et.selectedKeys,ln=et.onSelect,Oi=et.onDeselect,or=et.inlineIndent,xr=or===void 0?24:or,Un=et.motion,Lr=et.defaultMotions,rn=et.triggerSubMenuAction,er=rn===void 0?"hover":rn,Dr=et.builtinPlacements,kr=et.itemIcon,wr=et.expandIcon,Nn=et.overflowedIndicator,lr=Nn===void 0?"...":Nn,ur=et.overflowedIndicatorPopupClassName,Rr=et.getPopupContainer,An=et.onClick,ar=et.onOpenChange,Sr=et.onKeyDown,cr=et.openAnimation,hr=et.openTransitionName,qi=et._internalRenderMenuItem,fi=et._internalRenderSubMenuItem,ji=et._internalComponents,bn=(0,S.Z)(et,sr),li=T.useMemo(function(){return[fn(Ri,oi,gn,ji,Ct),fn(Ri,oi,gn,{},Ct)]},[Ri,oi,ji]),zn=(0,q.Z)(li,2),tr=zn[0],Cn=zn[1],is=T.useState(!1),Tr=(0,q.Z)(is,2),_s=Tr[0],ns=Tr[1],pn=T.useRef(),ir=ke(Fi),Yr=Ai==="rtl",vs=(0,re.Z)(on,{value:Jn,postState:function(Ln){return Ln||gn}}),fr=(0,q.Z)(vs,2),jn=fr[0],dr=fr[1],nr=function(Ln){var On=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Vr(){dr(Ln),ar==null||ar(Ln)}On?(0,M.flushSync)(Vr):Vr()},ls=T.useState(jn),Pr=(0,q.Z)(ls,2),Fs=Pr[0],Gs=Pr[1],As=T.useRef(!1),Sa=T.useMemo(function(){return(yi==="inline"||yi==="vertical")&&Ii?["vertical",Ii]:[yi,!1]},[yi,Ii]),ni=(0,q.Z)(Sa,2),Ti=ni[0],Sn=ni[1],Hi=Ti==="inline",Ni=T.useState(Ti),zr=(0,q.Z)(Ni,2),qn=zr[0],Xr=zr[1],rs=T.useState(Sn),Ea=(0,q.Z)(rs,2),ru=Ea[0],Za=Ea[1];T.useEffect(function(){Xr(Ti),Za(Sn),As.current&&(Hi?dr(Fs):nr(gn))},[Ti,Sn]);var Ls=T.useState(0),Hs=(0,q.Z)(Ls,2),Mn=Hs[0],ka=Hs[1],Ta=Mn>=tr.length-1||qn!=="horizontal"||Bi;T.useEffect(function(){Hi&&Gs(jn)},[jn]),T.useEffect(function(){return As.current=!0,function(){As.current=!1}},[]);var ys=nt(),Lo=ys.registerPath,Do=ys.unregisterPath,us=ys.refreshOverflowKeys,Ya=ys.isSubPathKey,su=ys.getKeyPath,cs=ys.getKeys,hl=ys.getSubPathKeys,au=T.useMemo(function(){return{registerPath:Lo,unregisterPath:Do}},[Lo,Do]),Co=T.useMemo(function(){return{isSubPathKey:Ya}},[Ya]);T.useEffect(function(){us(Ta?gn:tr.slice(Mn+1).map(function(Vn){return Vn.key}))},[Mn,Ta]);var Aa=(0,re.Z)(vn||Tn&&((ht=tr[0])===null||ht===void 0?void 0:ht.key),{value:vn}),Mo=(0,q.Z)(Aa,2),Ds=Mo[0],Io=Mo[1],Xa=gt(function(Vn){Io(Vn)}),Ro=gt(function(){Io(void 0)});(0,T.useImperativeHandle)($e,function(){return{list:pn.current,focus:function(Ln){var On,Vr=cs(),Gr=it(Vr,ir),eo=Gr.elements,oa=Gr.key2element,Bs=Gr.element2key,pl=He(pn.current,eo),Bo=Ds!=null?Ds:pl[0]?Bs.get(pl[0]):(On=tr.find(function(ml){return!ml.props.disabled}))===null||On===void 0?void 0:On.key,la=oa.get(Bo);if(Bo&&la){var No;la==null||(No=la.focus)===null||No===void 0||No.call(la,Ln)}}}});var fl=(0,re.Z)(Qi||[],{value:br,postState:function(Ln){return Array.isArray(Ln)?Ln:Ln==null?gn:[Ln]}}),bs=(0,q.Z)(fl,2),aa=bs[0],Po=bs[1],Ws=function(Ln){if(Pn){var On=Ln.key,Vr=aa.includes(On),Gr;Ui?Vr?Gr=aa.filter(function(oa){return oa!==On}):Gr=[].concat((0,ge.Z)(aa),[On]):Gr=[On],Po(Gr);var eo=(0,Ze.Z)((0,Ze.Z)({},Ln),{},{selectedKeys:Gr});Vr?Oi==null||Oi(eo):ln==null||ln(eo)}!Ui&&jn.length&&qn!=="inline"&&nr(gn)},Oo=gt(function(Vn){An==null||An(vt(Vn)),Ws(Vn)}),dl=gt(function(Vn,Ln){var On=jn.filter(function(Gr){return Gr!==Vn});if(Ln)On.push(Vn);else if(qn!=="inline"){var Vr=hl(Vn);On=On.filter(function(Gr){return!Vr.has(Gr)})}(0,R.Z)(jn,On,!0)||nr(On,!0)}),ou=function(Ln,On){var Vr=On!=null?On:!jn.includes(Ln);dl(Ln,Vr)},js=_t(qn,Ds,Yr,ir,pn,cs,su,Io,ou,Sr);T.useEffect(function(){ns(!0)},[]);var Ja=T.useMemo(function(){return{_internalRenderMenuItem:qi,_internalRenderSubMenuItem:fi}},[qi,fi]),Qa=qn!=="horizontal"||Bi?tr:tr.map(function(Vn,Ln){return T.createElement(fe,{key:Vn.key,overflowDisabled:Ln>Mn},Vn)}),Fo=T.createElement(f.Z,(0,ce.Z)({id:Fi,ref:pn,prefixCls:"".concat(Ct,"-overflow"),component:"ul",itemComponent:we,className:P()(Ct,"".concat(Ct,"-root"),"".concat(Ct,"-").concat(qn),Pi,(0,De.Z)((0,De.Z)({},"".concat(Ct,"-inline-collapsed"),ru),"".concat(Ct,"-rtl"),Yr),zt),dir:Ai,style:Wt,role:"menu",tabIndex:_n,data:Qa,renderRawItem:function(Ln){return Ln},renderRawRest:function(Ln){var On=Ln.length,Vr=On?tr.slice(-On):null;return T.createElement(an,{eventKey:Xe,title:lr,disabled:Ta,internalPopupClose:On===0,popupClassName:ur},Vr)},maxCount:qn!=="horizontal"||Bi?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Ln){ka(Ln)},onKeyDown:js},bn));return T.createElement(te.Provider,{value:Ja},T.createElement(O.Provider,{value:ir},T.createElement(fe,{prefixCls:Ct,rootClassName:zt,mode:qn,openKeys:jn,rtl:Yr,disabled:Wi,motion:_s?Un:null,defaultMotions:_s?Lr:null,activeKey:Ds,onActive:Xa,onInactive:Ro,selectedKeys:aa,inlineIndent:xr,subMenuOpenDelay:Ji,subMenuCloseDelay:Yi,forceSubMenuRender:Rn,builtinPlacements:Dr,triggerSubMenuAction:er,getPopupContainer:Rr,itemIcon:kr,expandIcon:wr,onItemClick:Oo,onOpenChange:dl},T.createElement(Be.Provider,{value:Co},Fo),T.createElement("div",{style:{display:"none"},"aria-hidden":!0},T.createElement(Se.Provider,{value:au},Cn)))))}),Ur=Xn,wi=Ur;wi.Item=we,wi.SubMenu=an,wi.ItemGroup=wn,wi.Divider=nn;var ai=wi},11780:function(Li,It,oe){"use strict";oe.d(It,{Z:function(){return ie}});var ce=oe(54476),De=oe(33885),Ze=oe(42978),ge=oe(75931),q=oe(59301),S=oe(92310),Te=oe.n(S),P=oe(29301),f=oe(34280),re=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],R=void 0;function k(A,L){var V=A.prefixCls,pe=A.invalidate,ze=A.item,at=A.renderItem,Bt=A.responsive,Me=A.responsiveDisabled,Ht=A.registerSize,Dt=A.itemKey,ft=A.className,Si=A.style,di=A.children,tn=A.display,Kt=A.order,hn=A.component,Ne=hn===void 0?"div":hn,He=(0,ge.Z)(A,re),ve=Bt&&!tn;function it(Ke){Ht(Dt,Ke)}q.useEffect(function(){return function(){it(null)}},[]);var _t=at&&ze!==R?at(ze,{index:Kt}):di,lt;pe||(lt={opacity:ve?0:1,height:ve?0:R,overflowY:ve?"hidden":R,order:Bt?Kt:R,pointerEvents:ve?"none":R,position:ve?"absolute":R});var ee={};ve&&(ee["aria-hidden"]=!0);var xe=q.createElement(Ne,(0,ce.Z)({className:Te()(!pe&&V,ft),style:(0,De.Z)((0,De.Z)({},lt),Si)},ee,He,{ref:L}),_t);return Bt&&(xe=q.createElement(P.Z,{onResize:function(Xe){var nt=Xe.offsetWidth;it(nt)},disabled:Me},xe)),xe}var T=q.forwardRef(k);T.displayName="Item";var M=T,O=oe(6089),Y=oe(4676),H=oe(16089);function j(A){if(typeof MessageChannel=="undefined")(0,H.Z)(A);else{var L=new MessageChannel;L.port1.onmessage=function(){return A()},L.port2.postMessage(void 0)}}function U(){var A=q.useRef(null),L=function(pe){A.current||(A.current=[],j(function(){(0,Y.unstable_batchedUpdates)(function(){A.current.forEach(function(ze){ze()}),A.current=null})})),A.current.push(pe)};return L}function $(A,L){var V=q.useState(L),pe=(0,Ze.Z)(V,2),ze=pe[0],at=pe[1],Bt=(0,O.Z)(function(Me){A(function(){at(Me)})});return[ze,Bt]}var G=q.createContext(null),fe=["component"],be=["className"],Se=["className"],se=function(L,V){var pe=q.useContext(G);if(!pe){var ze=L.component,at=ze===void 0?"div":ze,Bt=(0,ge.Z)(L,fe);return q.createElement(at,(0,ce.Z)({},Bt,{ref:V}))}var Me=pe.className,Ht=(0,ge.Z)(pe,be),Dt=L.className,ft=(0,ge.Z)(L,Se);return q.createElement(G.Provider,{value:null},q.createElement(M,(0,ce.Z)({ref:V,className:Te()(Me,Dt)},Ht,ft)))},Oe=q.forwardRef(se);Oe.displayName="RawItem";var We=Oe,Be=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],At="responsive",te="invalidate";function z(A){return"+ ".concat(A.length," ...")}function X(A,L){var V=A.prefixCls,pe=V===void 0?"rc-overflow":V,ze=A.data,at=ze===void 0?[]:ze,Bt=A.renderItem,Me=A.renderRawItem,Ht=A.itemKey,Dt=A.itemWidth,ft=Dt===void 0?10:Dt,Si=A.ssr,di=A.style,tn=A.className,Kt=A.maxCount,hn=A.renderRest,Ne=A.renderRawRest,He=A.suffix,ve=A.component,it=ve===void 0?"div":ve,_t=A.itemComponent,lt=A.onVisibleChange,ee=(0,ge.Z)(A,Be),xe=Si==="full",Ke=U(),Xe=$(Ke,null),nt=(0,Ze.Z)(Xe,2),gt=nt[0],Yt=nt[1],dt=gt||0,ke=$(Ke,new Map),bt=(0,Ze.Z)(ke,2),Gt=bt[0],Pt=bt[1],Ae=$(Ke,0),Ce=(0,Ze.Z)(Ae,2),rt=Ce[0],ut=Ce[1],je=$(Ke,0),kt=(0,Ze.Z)(je,2),Tt=kt[0],vt=kt[1],Ot=$(Ke,0),jt=(0,Ze.Z)(Ot,2),Je=jt[0],Ft=jt[1],Le=(0,q.useState)(null),ye=(0,Ze.Z)(Le,2),we=ye[0],K=ye[1],W=(0,q.useState)(null),ae=(0,Ze.Z)(W,2),he=ae[0],_e=ae[1],st=q.useMemo(function(){return he===null&&xe?Number.MAX_SAFE_INTEGER:he||0},[he,gt]),ot=(0,q.useState)(!1),xt=(0,Ze.Z)(ot,2),Nt=xt[0],Xt=xt[1],vi="".concat(pe,"-item"),ti=Math.max(rt,Tt),St=Kt===At,ii=at.length&&St,Di=Kt===te,Ei=ii||typeof Kt=="number"&&at.length>Kt,$i=(0,q.useMemo)(function(){var wi=at;return ii?gt===null&&xe?wi=at:wi=at.slice(0,Math.min(at.length,dt/ft)):typeof Kt=="number"&&(wi=at.slice(0,Kt)),wi},[at,ft,gt,Kt,ii]),pi=(0,q.useMemo)(function(){return ii?at.slice(st+1):at.slice($i.length)},[at,$i,ii,st]),mi=(0,q.useCallback)(function(wi,ai){var Re;return typeof Ht=="function"?Ht(wi):(Re=Ht&&(wi==null?void 0:wi[Ht]))!==null&&Re!==void 0?Re:ai},[Ht]),Xi=(0,q.useCallback)(Bt||function(wi){return wi},[Bt]);function an(wi,ai,Re){he===wi&&(ai===void 0||ai===we)||(_e(wi),Re||(Xt(wi<at.length-1),lt==null||lt(wi)),ai!==void 0&&K(ai))}function mn(wi,ai){Yt(ai.clientWidth)}function nn(wi,ai){Pt(function(Re){var $e=new Map(Re);return ai===null?$e.delete(wi):$e.set(wi,ai),$e})}function gr(wi,ai){vt(ai),ut(Tt)}function Ci(wi,ai){Ft(ai)}function Ki(wi){return Gt.get(mi($i[wi],wi))}(0,f.Z)(function(){if(dt&&typeof ti=="number"&&$i){var wi=Je,ai=$i.length,Re=ai-1;if(!ai){an(0,null);return}for(var $e=0;$e<ai;$e+=1){var ht=Ki($e);if(xe&&(ht=ht||0),ht===void 0){an($e-1,void 0,!0);break}if(wi+=ht,Re===0&&wi<=dt||$e===Re-1&&wi+Ki(Re)<=dt){an(Re,null);break}else if(wi+ti>dt){an($e-1,wi-ht-Je+Tt);break}}He&&Ki(0)+Je>dt&&K(null)}},[dt,Gt,Tt,Je,mi,$i]);var wn=Nt&&!!pi.length,Mi={};we!==null&&ii&&(Mi={position:"absolute",left:we,top:0});var In={prefixCls:vi,responsive:ii,component:_t,invalidate:Di},fn=Me?function(wi,ai){var Re=mi(wi,ai);return q.createElement(G.Provider,{key:Re,value:(0,De.Z)((0,De.Z)({},In),{},{order:ai,item:wi,itemKey:Re,registerSize:nn,display:ai<=st})},Me(wi,ai))}:function(wi,ai){var Re=mi(wi,ai);return q.createElement(M,(0,ce.Z)({},In,{order:ai,key:Re,item:wi,renderItem:Xi,itemKey:Re,registerSize:nn,display:ai<=st}))},sr={order:wn?st:Number.MAX_SAFE_INTEGER,className:"".concat(vi,"-rest"),registerSize:gr,display:wn},gn=hn||z,Xn=Ne?q.createElement(G.Provider,{value:(0,De.Z)((0,De.Z)({},In),sr)},Ne(pi)):q.createElement(M,(0,ce.Z)({},In,sr),typeof gn=="function"?gn(pi):gn),Ur=q.createElement(it,(0,ce.Z)({className:Te()(!Di&&pe,tn),style:di,ref:L},ee),$i.map(fn),Ei?Xn:null,He&&q.createElement(M,(0,ce.Z)({},In,{responsive:St,responsiveDisabled:!ii,order:st,className:"".concat(vi,"-suffix"),registerSize:Ci,display:!0,style:Mi}),He));return St?q.createElement(P.Z,{onResize:mn,disabled:!ii},Ur):Ur}var Q=q.forwardRef(X);Q.displayName="Overflow",Q.Item=We,Q.RESPONSIVE=At,Q.INVALIDATE=te;var de=Q,ie=de},29301:function(Li,It,oe){"use strict";oe.d(It,{Z:function(){return te}});var ce=oe(54476),De=oe(59301),Ze=oe(11592),ge=oe(48736),q=oe(33885),S=oe(76190),Te=oe(76846),P=oe(8654),f=De.createContext(null);function re(z){var X=z.children,Q=z.onBatchResize,de=De.useRef(0),ie=De.useRef([]),A=De.useContext(f),L=De.useCallback(function(V,pe,ze){de.current+=1;var at=de.current;ie.current.push({size:V,element:pe,data:ze}),Promise.resolve().then(function(){at===de.current&&(Q==null||Q(ie.current),ie.current=[])}),A==null||A(V,pe,ze)},[Q,A]);return De.createElement(f.Provider,{value:L},X)}var R=oe(76374),k=new Map;function T(z){z.forEach(function(X){var Q,de=X.target;(Q=k.get(de))===null||Q===void 0||Q.forEach(function(ie){return ie(de)})})}var M=new R.Z(T),O=null,Y=null;function H(z,X){k.has(z)||(k.set(z,new Set),M.observe(z)),k.get(z).add(X)}function j(z,X){k.has(z)&&(k.get(z).delete(X),k.get(z).size||(M.unobserve(z),k.delete(z)))}var U=oe(67732),$=oe(83652),G=oe(42403),fe=oe(158),be=function(z){(0,G.Z)(Q,z);var X=(0,fe.Z)(Q);function Q(){return(0,U.Z)(this,Q),X.apply(this,arguments)}return(0,$.Z)(Q,[{key:"render",value:function(){return this.props.children}}]),Q}(De.Component);function Se(z,X){var Q=z.children,de=z.disabled,ie=De.useRef(null),A=De.useRef(null),L=De.useContext(f),V=typeof Q=="function",pe=V?Q(ie):Q,ze=De.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),at=!V&&De.isValidElement(pe)&&(0,P.Yr)(pe),Bt=at?(0,P.C4)(pe):null,Me=(0,P.x1)(Bt,ie),Ht=function(){var di;return(0,Te.ZP)(ie.current)||(ie.current&&(0,S.Z)(ie.current)==="object"?(0,Te.ZP)((di=ie.current)===null||di===void 0?void 0:di.nativeElement):null)||(0,Te.ZP)(A.current)};De.useImperativeHandle(X,function(){return Ht()});var Dt=De.useRef(z);Dt.current=z;var ft=De.useCallback(function(Si){var di=Dt.current,tn=di.onResize,Kt=di.data,hn=Si.getBoundingClientRect(),Ne=hn.width,He=hn.height,ve=Si.offsetWidth,it=Si.offsetHeight,_t=Math.floor(Ne),lt=Math.floor(He);if(ze.current.width!==_t||ze.current.height!==lt||ze.current.offsetWidth!==ve||ze.current.offsetHeight!==it){var ee={width:_t,height:lt,offsetWidth:ve,offsetHeight:it};ze.current=ee;var xe=ve===Math.round(Ne)?Ne:ve,Ke=it===Math.round(He)?He:it,Xe=(0,q.Z)((0,q.Z)({},ee),{},{offsetWidth:xe,offsetHeight:Ke});L==null||L(Xe,Si,Kt),tn&&Promise.resolve().then(function(){tn(Xe,Si)})}},[]);return De.useEffect(function(){var Si=Ht();return Si&&!de&&H(Si,ft),function(){return j(Si,ft)}},[ie.current,de]),De.createElement(be,{ref:A},at?De.cloneElement(pe,{ref:Me}):pe)}var se=De.forwardRef(Se),Oe=se,We="rc-observer-key";function Be(z,X){var Q=z.children,de=typeof Q=="function"?[Q]:(0,Ze.Z)(Q);return de.map(function(ie,A){var L=(ie==null?void 0:ie.key)||"".concat(We,"-").concat(A);return De.createElement(Oe,(0,ce.Z)({},z,{key:L,ref:A===0?X:void 0}),ie)})}var At=De.forwardRef(Be);At.Collection=re;var te=At},29443:function(Li,It,oe){"use strict";oe.d(It,{Z:function(){return Pt}});var ce=oe(54476),De=oe(20068),Ze=oe(33885),ge=oe(42978),q=oe(76190),S=oe(75931),Te=oe(92310),P=oe.n(Te),f=oe(18929),re=oe(49658),R=oe(59301),k=(0,R.createContext)(null),T=oe(94480),M=oe(29301),O=oe(6089),Y=oe(8654),H=oe(16089),j=function(Ce){var rt=Ce.activeTabOffset,ut=Ce.horizontal,je=Ce.rtl,kt=Ce.indicator,Tt=kt===void 0?{}:kt,vt=Tt.size,Ot=Tt.align,jt=Ot===void 0?"center":Ot,Je=(0,R.useState)(),Ft=(0,ge.Z)(Je,2),Le=Ft[0],ye=Ft[1],we=(0,R.useRef)(),K=R.useCallback(function(ae){return typeof vt=="function"?vt(ae):typeof vt=="number"?vt:ae},[vt]);function W(){H.Z.cancel(we.current)}return(0,R.useEffect)(function(){var ae={};if(rt)if(ut){ae.width=K(rt.width);var he=je?"right":"left";jt==="start"&&(ae[he]=rt[he]),jt==="center"&&(ae[he]=rt[he]+rt.width/2,ae.transform=je?"translateX(50%)":"translateX(-50%)"),jt==="end"&&(ae[he]=rt[he]+rt.width,ae.transform="translateX(-100%)")}else ae.height=K(rt.height),jt==="start"&&(ae.top=rt.top),jt==="center"&&(ae.top=rt.top+rt.height/2,ae.transform="translateY(-50%)"),jt==="end"&&(ae.top=rt.top+rt.height,ae.transform="translateY(-100%)");return W(),we.current=(0,H.Z)(function(){ye(ae)}),W},[rt,ut,je,jt,K]),{style:Le}},U=j,$={width:0,height:0,left:0,top:0};function G(Ae,Ce,rt){return(0,R.useMemo)(function(){for(var ut,je=new Map,kt=Ce.get((ut=Ae[0])===null||ut===void 0?void 0:ut.key)||$,Tt=kt.left+kt.width,vt=0;vt<Ae.length;vt+=1){var Ot=Ae[vt].key,jt=Ce.get(Ot);if(!jt){var Je;jt=Ce.get((Je=Ae[vt-1])===null||Je===void 0?void 0:Je.key)||$}var Ft=je.get(Ot)||(0,Ze.Z)({},jt);Ft.right=Tt-Ft.left-Ft.width,je.set(Ot,Ft)}return je},[Ae.map(function(ut){return ut.key}).join("_"),Ce,rt])}function fe(Ae,Ce){var rt=R.useRef(Ae),ut=R.useState({}),je=(0,ge.Z)(ut,2),kt=je[1];function Tt(vt){var Ot=typeof vt=="function"?vt(rt.current):vt;Ot!==rt.current&&Ce(Ot,rt.current),rt.current=Ot,kt({})}return[rt.current,Tt]}var be=.1,Se=.01,se=20,Oe=Math.pow(.995,se);function We(Ae,Ce){var rt=(0,R.useState)(),ut=(0,ge.Z)(rt,2),je=ut[0],kt=ut[1],Tt=(0,R.useState)(0),vt=(0,ge.Z)(Tt,2),Ot=vt[0],jt=vt[1],Je=(0,R.useState)(0),Ft=(0,ge.Z)(Je,2),Le=Ft[0],ye=Ft[1],we=(0,R.useState)(),K=(0,ge.Z)(we,2),W=K[0],ae=K[1],he=(0,R.useRef)();function _e(vi){var ti=vi.touches[0],St=ti.screenX,ii=ti.screenY;kt({x:St,y:ii}),window.clearInterval(he.current)}function st(vi){if(je){var ti=vi.touches[0],St=ti.screenX,ii=ti.screenY;kt({x:St,y:ii});var Di=St-je.x,Ei=ii-je.y;Ce(Di,Ei);var $i=Date.now();jt($i),ye($i-Ot),ae({x:Di,y:Ei})}}function ot(){if(je&&(kt(null),ae(null),W)){var vi=W.x/Le,ti=W.y/Le,St=Math.abs(vi),ii=Math.abs(ti);if(Math.max(St,ii)<be)return;var Di=vi,Ei=ti;he.current=window.setInterval(function(){if(Math.abs(Di)<Se&&Math.abs(Ei)<Se){window.clearInterval(he.current);return}Di*=Oe,Ei*=Oe,Ce(Di*se,Ei*se)},se)}}var xt=(0,R.useRef)();function Nt(vi){var ti=vi.deltaX,St=vi.deltaY,ii=0,Di=Math.abs(ti),Ei=Math.abs(St);Di===Ei?ii=xt.current==="x"?ti:St:Di>Ei?(ii=ti,xt.current="x"):(ii=St,xt.current="y"),Ce(-ii,-ii)&&vi.preventDefault()}var Xt=(0,R.useRef)(null);Xt.current={onTouchStart:_e,onTouchMove:st,onTouchEnd:ot,onWheel:Nt},R.useEffect(function(){function vi(Di){Xt.current.onTouchStart(Di)}function ti(Di){Xt.current.onTouchMove(Di)}function St(Di){Xt.current.onTouchEnd(Di)}function ii(Di){Xt.current.onWheel(Di)}return document.addEventListener("touchmove",ti,{passive:!1}),document.addEventListener("touchend",St,{passive:!0}),Ae.current.addEventListener("touchstart",vi,{passive:!0}),Ae.current.addEventListener("wheel",ii,{passive:!1}),function(){document.removeEventListener("touchmove",ti),document.removeEventListener("touchend",St)}},[])}var Be=oe(34280);function At(Ae){var Ce=(0,R.useState)(0),rt=(0,ge.Z)(Ce,2),ut=rt[0],je=rt[1],kt=(0,R.useRef)(0),Tt=(0,R.useRef)();return Tt.current=Ae,(0,Be.o)(function(){var vt;(vt=Tt.current)===null||vt===void 0||vt.call(Tt)},[ut]),function(){kt.current===ut&&(kt.current+=1,je(kt.current))}}function te(Ae){var Ce=(0,R.useRef)([]),rt=(0,R.useState)({}),ut=(0,ge.Z)(rt,2),je=ut[1],kt=(0,R.useRef)(typeof Ae=="function"?Ae():Ae),Tt=At(function(){var Ot=kt.current;Ce.current.forEach(function(jt){Ot=jt(Ot)}),Ce.current=[],kt.current=Ot,je({})});function vt(Ot){Ce.current.push(Ot),Tt()}return[kt.current,vt]}var z={width:0,height:0,left:0,top:0,right:0};function X(Ae,Ce,rt,ut,je,kt,Tt){var vt=Tt.tabs,Ot=Tt.tabPosition,jt=Tt.rtl,Je,Ft,Le;return["top","bottom"].includes(Ot)?(Je="width",Ft=jt?"right":"left",Le=Math.abs(rt)):(Je="height",Ft="top",Le=-rt),(0,R.useMemo)(function(){if(!vt.length)return[0,0];for(var ye=vt.length,we=ye,K=0;K<ye;K+=1){var W=Ae.get(vt[K].key)||z;if(Math.floor(W[Ft]+W[Je])>Math.floor(Le+Ce)){we=K-1;break}}for(var ae=0,he=ye-1;he>=0;he-=1){var _e=Ae.get(vt[he].key)||z;if(_e[Ft]<Le){ae=he+1;break}}return ae>=we?[0,0]:[ae,we]},[Ae,Ce,ut,je,kt,Le,Ot,vt.map(function(ye){return ye.key}).join("_"),jt])}function Q(Ae){var Ce;return Ae instanceof Map?(Ce={},Ae.forEach(function(rt,ut){Ce[ut]=rt})):Ce=Ae,JSON.stringify(Ce)}var de="TABS_DQ";function ie(Ae){return String(Ae).replace(/"/g,de)}function A(Ae,Ce,rt,ut){return!(!rt||ut||Ae===!1||Ae===void 0&&(Ce===!1||Ce===null))}var L=R.forwardRef(function(Ae,Ce){var rt=Ae.prefixCls,ut=Ae.editable,je=Ae.locale,kt=Ae.style;return!ut||ut.showAdd===!1?null:R.createElement("button",{ref:Ce,type:"button",className:"".concat(rt,"-nav-add"),style:kt,"aria-label":(je==null?void 0:je.addAriaLabel)||"Add tab",onClick:function(vt){ut.onEdit("add",{event:vt})}},ut.addIcon||"+")}),V=L,pe=R.forwardRef(function(Ae,Ce){var rt=Ae.position,ut=Ae.prefixCls,je=Ae.extra;if(!je)return null;var kt,Tt={};return(0,q.Z)(je)==="object"&&!R.isValidElement(je)?Tt=je:Tt.right=je,rt==="right"&&(kt=Tt.right),rt==="left"&&(kt=Tt.left),kt?R.createElement("div",{className:"".concat(ut,"-extra-content"),ref:Ce},kt):null}),ze=pe,at=oe(96478),Bt=oe(28321),Me=oe(10228),Ht=R.forwardRef(function(Ae,Ce){var rt=Ae.prefixCls,ut=Ae.id,je=Ae.tabs,kt=Ae.locale,Tt=Ae.mobile,vt=Ae.more,Ot=vt===void 0?{}:vt,jt=Ae.style,Je=Ae.className,Ft=Ae.editable,Le=Ae.tabBarGutter,ye=Ae.rtl,we=Ae.removeAriaLabel,K=Ae.onTabClick,W=Ae.getPopupContainer,ae=Ae.popupClassName,he=(0,R.useState)(!1),_e=(0,ge.Z)(he,2),st=_e[0],ot=_e[1],xt=(0,R.useState)(null),Nt=(0,ge.Z)(xt,2),Xt=Nt[0],vi=Nt[1],ti=Ot.icon,St=ti===void 0?"More":ti,ii="".concat(ut,"-more-popup"),Di="".concat(rt,"-dropdown"),Ei=Xt!==null?"".concat(ii,"-").concat(Xt):null,$i=kt==null?void 0:kt.dropdownAriaLabel;function pi(Ci,Ki){Ci.preventDefault(),Ci.stopPropagation(),Ft.onEdit("remove",{key:Ki,event:Ci})}var mi=R.createElement(Bt.ZP,{onClick:function(Ki){var wn=Ki.key,Mi=Ki.domEvent;K(wn,Mi),ot(!1)},prefixCls:"".concat(Di,"-menu"),id:ii,tabIndex:-1,role:"listbox","aria-activedescendant":Ei,selectedKeys:[Xt],"aria-label":$i!==void 0?$i:"expanded dropdown"},je.map(function(Ci){var Ki=Ci.closable,wn=Ci.disabled,Mi=Ci.closeIcon,In=Ci.key,fn=Ci.label,sr=A(Ki,Mi,Ft,wn);return R.createElement(Bt.sN,{key:In,id:"".concat(ii,"-").concat(In),role:"option","aria-controls":ut&&"".concat(ut,"-panel-").concat(In),disabled:wn},R.createElement("span",null,fn),sr&&R.createElement("button",{type:"button","aria-label":we||"remove",tabIndex:0,className:"".concat(Di,"-menu-item-remove"),onClick:function(Xn){Xn.stopPropagation(),pi(Xn,In)}},Mi||Ft.removeIcon||"\xD7"))}));function Xi(Ci){for(var Ki=je.filter(function(sr){return!sr.disabled}),wn=Ki.findIndex(function(sr){return sr.key===Xt})||0,Mi=Ki.length,In=0;In<Mi;In+=1){wn=(wn+Ci+Mi)%Mi;var fn=Ki[wn];if(!fn.disabled){vi(fn.key);return}}}function an(Ci){var Ki=Ci.which;if(!st){[Me.Z.DOWN,Me.Z.SPACE,Me.Z.ENTER].includes(Ki)&&(ot(!0),Ci.preventDefault());return}switch(Ki){case Me.Z.UP:Xi(-1),Ci.preventDefault();break;case Me.Z.DOWN:Xi(1),Ci.preventDefault();break;case Me.Z.ESC:ot(!1);break;case Me.Z.SPACE:case Me.Z.ENTER:Xt!==null&&K(Xt,Ci);break}}(0,R.useEffect)(function(){var Ci=document.getElementById(Ei);Ci&&Ci.scrollIntoView&&Ci.scrollIntoView(!1)},[Xt]),(0,R.useEffect)(function(){st||vi(null)},[st]);var mn=(0,De.Z)({},ye?"marginRight":"marginLeft",Le);je.length||(mn.visibility="hidden",mn.order=1);var nn=P()((0,De.Z)({},"".concat(Di,"-rtl"),ye)),gr=Tt?null:R.createElement(at.Z,(0,ce.Z)({prefixCls:Di,overlay:mi,visible:je.length?st:!1,onVisibleChange:ot,overlayClassName:P()(nn,ae),mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:W},Ot),R.createElement("button",{type:"button",className:"".concat(rt,"-nav-more"),style:mn,"aria-haspopup":"listbox","aria-controls":ii,id:"".concat(ut,"-more"),"aria-expanded":st,onKeyDown:an},St));return R.createElement("div",{className:P()("".concat(rt,"-nav-operations"),Je),style:jt,ref:Ce},gr,R.createElement(V,{prefixCls:rt,locale:kt,editable:Ft}))}),Dt=R.memo(Ht,function(Ae,Ce){return Ce.tabMoving}),ft=function(Ce){var rt=Ce.prefixCls,ut=Ce.id,je=Ce.active,kt=Ce.focus,Tt=Ce.tab,vt=Tt.key,Ot=Tt.label,jt=Tt.disabled,Je=Tt.closeIcon,Ft=Tt.icon,Le=Ce.closable,ye=Ce.renderWrapper,we=Ce.removeAriaLabel,K=Ce.editable,W=Ce.onClick,ae=Ce.onFocus,he=Ce.onBlur,_e=Ce.onKeyDown,st=Ce.onMouseDown,ot=Ce.onMouseUp,xt=Ce.style,Nt=Ce.tabCount,Xt=Ce.currentPosition,vi="".concat(rt,"-tab"),ti=A(Le,Je,K,jt);function St(pi){jt||W(pi)}function ii(pi){pi.preventDefault(),pi.stopPropagation(),K.onEdit("remove",{key:vt,event:pi})}var Di=R.useMemo(function(){return Ft&&typeof Ot=="string"?R.createElement("span",null,Ot):Ot},[Ot,Ft]),Ei=R.useRef(null);R.useEffect(function(){kt&&Ei.current&&Ei.current.focus()},[kt]);var $i=R.createElement("div",{key:vt,"data-node-key":ie(vt),className:P()(vi,(0,De.Z)((0,De.Z)((0,De.Z)((0,De.Z)({},"".concat(vi,"-with-remove"),ti),"".concat(vi,"-active"),je),"".concat(vi,"-disabled"),jt),"".concat(vi,"-focus"),kt)),style:xt,onClick:St},R.createElement("div",{ref:Ei,role:"tab","aria-selected":je,id:ut&&"".concat(ut,"-tab-").concat(vt),className:"".concat(vi,"-btn"),"aria-controls":ut&&"".concat(ut,"-panel-").concat(vt),"aria-disabled":jt,tabIndex:jt?null:je?0:-1,onClick:function(mi){mi.stopPropagation(),St(mi)},onKeyDown:_e,onMouseDown:st,onMouseUp:ot,onFocus:ae,onBlur:he},kt&&R.createElement("div",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"Tab ".concat(Xt," of ").concat(Nt)),Ft&&R.createElement("span",{className:"".concat(vi,"-icon")},Ft),Ot&&Di),ti&&R.createElement("button",{type:"button",role:"tab","aria-label":we||"remove",tabIndex:je?0:-1,className:"".concat(vi,"-remove"),onClick:function(mi){mi.stopPropagation(),ii(mi)}},Je||K.removeIcon||"\xD7"));return ye?ye($i):$i},Si=ft,di=function(Ce,rt){var ut=Ce.offsetWidth,je=Ce.offsetHeight,kt=Ce.offsetTop,Tt=Ce.offsetLeft,vt=Ce.getBoundingClientRect(),Ot=vt.width,jt=vt.height,Je=vt.left,Ft=vt.top;return Math.abs(Ot-ut)<1?[Ot,jt,Je-rt.left,Ft-rt.top]:[ut,je,Tt,kt]},tn=function(Ce){var rt=Ce.current||{},ut=rt.offsetWidth,je=ut===void 0?0:ut,kt=rt.offsetHeight,Tt=kt===void 0?0:kt;if(Ce.current){var vt=Ce.current.getBoundingClientRect(),Ot=vt.width,jt=vt.height;if(Math.abs(Ot-je)<1)return[Ot,jt]}return[je,Tt]},Kt=function(Ce,rt){return Ce[rt?0:1]},hn=R.forwardRef(function(Ae,Ce){var rt=Ae.className,ut=Ae.style,je=Ae.id,kt=Ae.animated,Tt=Ae.activeKey,vt=Ae.rtl,Ot=Ae.extra,jt=Ae.editable,Je=Ae.locale,Ft=Ae.tabPosition,Le=Ae.tabBarGutter,ye=Ae.children,we=Ae.onTabClick,K=Ae.onTabScroll,W=Ae.indicator,ae=R.useContext(k),he=ae.prefixCls,_e=ae.tabs,st=(0,R.useRef)(null),ot=(0,R.useRef)(null),xt=(0,R.useRef)(null),Nt=(0,R.useRef)(null),Xt=(0,R.useRef)(null),vi=(0,R.useRef)(null),ti=(0,R.useRef)(null),St=Ft==="top"||Ft==="bottom",ii=fe(0,function(qi,fi){St&&K&&K({direction:qi>fi?"left":"right"})}),Di=(0,ge.Z)(ii,2),Ei=Di[0],$i=Di[1],pi=fe(0,function(qi,fi){!St&&K&&K({direction:qi>fi?"top":"bottom"})}),mi=(0,ge.Z)(pi,2),Xi=mi[0],an=mi[1],mn=(0,R.useState)([0,0]),nn=(0,ge.Z)(mn,2),gr=nn[0],Ci=nn[1],Ki=(0,R.useState)([0,0]),wn=(0,ge.Z)(Ki,2),Mi=wn[0],In=wn[1],fn=(0,R.useState)([0,0]),sr=(0,ge.Z)(fn,2),gn=sr[0],Xn=sr[1],Ur=(0,R.useState)([0,0]),wi=(0,ge.Z)(Ur,2),ai=wi[0],Re=wi[1],$e=te(new Map),ht=(0,ge.Z)($e,2),et=ht[0],wt=ht[1],Ct=G(_e,et,Mi[0]),zt=Kt(gr,St),Wt=Kt(Mi,St),Pi=Kt(gn,St),ki=Kt(ai,St),_n=Math.floor(zt)<Math.floor(Wt+Pi),oi=_n?zt-ki:zt-Pi,Ri="".concat(he,"-nav-operations-hidden"),Ai=0,Fi=0;St&&vt?(Ai=0,Fi=Math.max(0,Wt-oi)):(Ai=Math.min(0,oi-Wt),Fi=0);function Vi(qi){return qi<Ai?Ai:qi>Fi?Fi:qi}var yi=(0,R.useRef)(null),Ii=(0,R.useState)(),Wi=(0,ge.Z)(Ii,2),Bi=Wi[0],bi=Wi[1];function Ji(){bi(Date.now())}function Gi(){yi.current&&clearTimeout(yi.current)}We(Nt,function(qi,fi){function ji(bn,li){bn(function(zn){var tr=Vi(zn+li);return tr})}return _n?(St?ji($i,qi):ji(an,fi),Gi(),Ji(),!0):!1}),(0,R.useEffect)(function(){return Gi(),Bi&&(yi.current=setTimeout(function(){bi(0)},100)),Gi},[Bi]);var Yi=X(Ct,oi,St?Ei:Xi,Wt,Pi,ki,(0,Ze.Z)((0,Ze.Z)({},Ae),{},{tabs:_e})),Rn=(0,ge.Z)(Yi,2),on=Rn[0],Jn=Rn[1],vn=(0,O.Z)(function(){var qi=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tt,fi=Ct.get(qi)||{width:0,height:0,left:0,right:0,top:0};if(St){var ji=Ei;vt?fi.right<Ei?ji=fi.right:fi.right+fi.width>Ei+oi&&(ji=fi.right+fi.width-oi):fi.left<-Ei?ji=-fi.left:fi.left+fi.width>-Ei+oi&&(ji=-(fi.left+fi.width-oi)),an(0),$i(Vi(ji))}else{var bn=Xi;fi.top<-Xi?bn=-fi.top:fi.top+fi.height>-Xi+oi&&(bn=-(fi.top+fi.height-oi)),$i(0),an(Vi(bn))}}),Tn=(0,R.useState)(),Wn=(0,ge.Z)(Tn,2),Pn=Wn[0],dn=Wn[1],Ui=(0,R.useState)(!1),Qi=(0,ge.Z)(Ui,2),br=Qi[0],ln=Qi[1],Oi=_e.filter(function(qi){return!qi.disabled}).map(function(qi){return qi.key}),or=function(fi){var ji=Oi.indexOf(Pn||Tt),bn=Oi.length,li=(ji+fi+bn)%bn,zn=Oi[li];dn(zn)},xr=function(fi){var ji=fi.code,bn=vt&&St,li=Oi[0],zn=Oi[Oi.length-1];switch(ji){case"ArrowLeft":{St&&or(bn?1:-1);break}case"ArrowRight":{St&&or(bn?-1:1);break}case"ArrowUp":{fi.preventDefault(),St||or(-1);break}case"ArrowDown":{fi.preventDefault(),St||or(1);break}case"Home":{fi.preventDefault(),dn(li);break}case"End":{fi.preventDefault(),dn(zn);break}case"Enter":case"Space":{fi.preventDefault(),we(Tt,fi);break}case"Backspace":case"Delete":{var tr=Oi.indexOf(Pn),Cn=_e.find(function(Tr){return Tr.key===Pn}),is=A(Cn==null?void 0:Cn.closable,Cn==null?void 0:Cn.closeIcon,jt,Cn==null?void 0:Cn.disabled);is&&(fi.preventDefault(),fi.stopPropagation(),jt.onEdit("remove",{key:Pn,event:fi}),tr===Oi.length-1?or(-1):or(1));break}}},Un={};St?Un[vt?"marginRight":"marginLeft"]=Le:Un.marginTop=Le;var Lr=_e.map(function(qi,fi){var ji=qi.key;return R.createElement(Si,{id:je,prefixCls:he,key:ji,tab:qi,style:fi===0?void 0:Un,closable:qi.closable,editable:jt,active:ji===Tt,focus:ji===Pn,renderWrapper:ye,removeAriaLabel:Je==null?void 0:Je.removeAriaLabel,tabCount:Oi.length,currentPosition:fi+1,onClick:function(li){we(ji,li)},onKeyDown:xr,onFocus:function(){br||dn(ji),vn(ji),Ji(),Nt.current&&(vt||(Nt.current.scrollLeft=0),Nt.current.scrollTop=0)},onBlur:function(){dn(void 0)},onMouseDown:function(){ln(!0)},onMouseUp:function(){ln(!1)}})}),rn=function(){return wt(function(){var fi,ji=new Map,bn=(fi=Xt.current)===null||fi===void 0?void 0:fi.getBoundingClientRect();return _e.forEach(function(li){var zn,tr=li.key,Cn=(zn=Xt.current)===null||zn===void 0?void 0:zn.querySelector('[data-node-key="'.concat(ie(tr),'"]'));if(Cn){var is=di(Cn,bn),Tr=(0,ge.Z)(is,4),_s=Tr[0],ns=Tr[1],pn=Tr[2],ir=Tr[3];ji.set(tr,{width:_s,height:ns,left:pn,top:ir})}}),ji})};(0,R.useEffect)(function(){rn()},[_e.map(function(qi){return qi.key}).join("_")]);var er=At(function(){var qi=tn(st),fi=tn(ot),ji=tn(xt);Ci([qi[0]-fi[0]-ji[0],qi[1]-fi[1]-ji[1]]);var bn=tn(ti);Xn(bn);var li=tn(vi);Re(li);var zn=tn(Xt);In([zn[0]-bn[0],zn[1]-bn[1]]),rn()}),Dr=_e.slice(0,on),kr=_e.slice(Jn+1),wr=[].concat((0,T.Z)(Dr),(0,T.Z)(kr)),Nn=Ct.get(Tt),lr=U({activeTabOffset:Nn,horizontal:St,indicator:W,rtl:vt}),ur=lr.style;(0,R.useEffect)(function(){vn()},[Tt,Ai,Fi,Q(Nn),Q(Ct),St]),(0,R.useEffect)(function(){er()},[vt]);var Rr=!!wr.length,An="".concat(he,"-nav-wrap"),ar,Sr,cr,hr;return St?vt?(Sr=Ei>0,ar=Ei!==Fi):(ar=Ei<0,Sr=Ei!==Ai):(cr=Xi<0,hr=Xi!==Ai),R.createElement(M.Z,{onResize:er},R.createElement("div",{ref:(0,Y.x1)(Ce,st),role:"tablist","aria-orientation":St?"horizontal":"vertical",className:P()("".concat(he,"-nav"),rt),style:ut,onKeyDown:function(){Ji()}},R.createElement(ze,{ref:ot,position:"left",extra:Ot,prefixCls:he}),R.createElement(M.Z,{onResize:er},R.createElement("div",{className:P()(An,(0,De.Z)((0,De.Z)((0,De.Z)((0,De.Z)({},"".concat(An,"-ping-left"),ar),"".concat(An,"-ping-right"),Sr),"".concat(An,"-ping-top"),cr),"".concat(An,"-ping-bottom"),hr)),ref:Nt},R.createElement(M.Z,{onResize:er},R.createElement("div",{ref:Xt,className:"".concat(he,"-nav-list"),style:{transform:"translate(".concat(Ei,"px, ").concat(Xi,"px)"),transition:Bi?"none":void 0}},Lr,R.createElement(V,{ref:ti,prefixCls:he,locale:Je,editable:jt,style:(0,Ze.Z)((0,Ze.Z)({},Lr.length===0?void 0:Un),{},{visibility:Rr?"hidden":null})}),R.createElement("div",{className:P()("".concat(he,"-ink-bar"),(0,De.Z)({},"".concat(he,"-ink-bar-animated"),kt.inkBar)),style:ur}))))),R.createElement(Dt,(0,ce.Z)({},Ae,{removeAriaLabel:Je==null?void 0:Je.removeAriaLabel,ref:vi,prefixCls:he,tabs:wr,className:!Rr&&Ri,tabMoving:!!Bi})),R.createElement(ze,{ref:xt,position:"right",extra:Ot,prefixCls:he})))}),Ne=hn,He=R.forwardRef(function(Ae,Ce){var rt=Ae.prefixCls,ut=Ae.className,je=Ae.style,kt=Ae.id,Tt=Ae.active,vt=Ae.tabKey,Ot=Ae.children;return R.createElement("div",{id:kt&&"".concat(kt,"-panel-").concat(vt),role:"tabpanel",tabIndex:Tt?0:-1,"aria-labelledby":kt&&"".concat(kt,"-tab-").concat(vt),"aria-hidden":!Tt,style:je,className:P()(rt,Tt&&"".concat(rt,"-active"),ut),ref:Ce},Ot)}),ve=He,it=["renderTabBar"],_t=["label","key"],lt=function(Ce){var rt=Ce.renderTabBar,ut=(0,S.Z)(Ce,it),je=R.useContext(k),kt=je.tabs;if(rt){var Tt=(0,Ze.Z)((0,Ze.Z)({},ut),{},{panes:kt.map(function(vt){var Ot=vt.label,jt=vt.key,Je=(0,S.Z)(vt,_t);return R.createElement(ve,(0,ce.Z)({tab:Ot,key:jt,tabKey:jt},Je))})});return rt(Tt,Ne)}return R.createElement(Ne,ut)},ee=lt,xe=oe(77900),Ke=["key","forceRender","style","className","destroyInactiveTabPane"],Xe=function(Ce){var rt=Ce.id,ut=Ce.activeKey,je=Ce.animated,kt=Ce.tabPosition,Tt=Ce.destroyInactiveTabPane,vt=R.useContext(k),Ot=vt.prefixCls,jt=vt.tabs,Je=je.tabPane,Ft="".concat(Ot,"-tabpane");return R.createElement("div",{className:P()("".concat(Ot,"-content-holder"))},R.createElement("div",{className:P()("".concat(Ot,"-content"),"".concat(Ot,"-content-").concat(kt),(0,De.Z)({},"".concat(Ot,"-content-animated"),Je))},jt.map(function(Le){var ye=Le.key,we=Le.forceRender,K=Le.style,W=Le.className,ae=Le.destroyInactiveTabPane,he=(0,S.Z)(Le,Ke),_e=ye===ut;return R.createElement(xe.default,(0,ce.Z)({key:ye,visible:_e,forceRender:we,removeOnLeave:!!(Tt||ae),leavedClassName:"".concat(Ft,"-hidden")},je.tabPaneMotion),function(st,ot){var xt=st.style,Nt=st.className;return R.createElement(ve,(0,ce.Z)({},he,{prefixCls:Ft,id:rt,tabKey:ye,animated:Je,active:_e,style:(0,Ze.Z)((0,Ze.Z)({},K),xt),className:P()(W,Nt),ref:ot}))})})))},nt=Xe,gt=oe(48736);function Yt(){var Ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},Ce;return Ae===!1?Ce={inkBar:!1,tabPane:!1}:Ae===!0?Ce={inkBar:!0,tabPane:!1}:Ce=(0,Ze.Z)({inkBar:!0},(0,q.Z)(Ae)==="object"?Ae:{}),Ce.tabPaneMotion&&Ce.tabPane===void 0&&(Ce.tabPane=!0),!Ce.tabPaneMotion&&Ce.tabPane&&(Ce.tabPane=!1),Ce}var dt=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],ke=0,bt=R.forwardRef(function(Ae,Ce){var rt=Ae.id,ut=Ae.prefixCls,je=ut===void 0?"rc-tabs":ut,kt=Ae.className,Tt=Ae.items,vt=Ae.direction,Ot=Ae.activeKey,jt=Ae.defaultActiveKey,Je=Ae.editable,Ft=Ae.animated,Le=Ae.tabPosition,ye=Le===void 0?"top":Le,we=Ae.tabBarGutter,K=Ae.tabBarStyle,W=Ae.tabBarExtraContent,ae=Ae.locale,he=Ae.more,_e=Ae.destroyInactiveTabPane,st=Ae.renderTabBar,ot=Ae.onChange,xt=Ae.onTabClick,Nt=Ae.onTabScroll,Xt=Ae.getPopupContainer,vi=Ae.popupClassName,ti=Ae.indicator,St=(0,S.Z)(Ae,dt),ii=R.useMemo(function(){return(Tt||[]).filter(function(ai){return ai&&(0,q.Z)(ai)==="object"&&"key"in ai})},[Tt]),Di=vt==="rtl",Ei=Yt(Ft),$i=(0,R.useState)(!1),pi=(0,ge.Z)($i,2),mi=pi[0],Xi=pi[1];(0,R.useEffect)(function(){Xi((0,re.Z)())},[]);var an=(0,f.Z)(function(){var ai;return(ai=ii[0])===null||ai===void 0?void 0:ai.key},{value:Ot,defaultValue:jt}),mn=(0,ge.Z)(an,2),nn=mn[0],gr=mn[1],Ci=(0,R.useState)(function(){return ii.findIndex(function(ai){return ai.key===nn})}),Ki=(0,ge.Z)(Ci,2),wn=Ki[0],Mi=Ki[1];(0,R.useEffect)(function(){var ai=ii.findIndex(function($e){return $e.key===nn});if(ai===-1){var Re;ai=Math.max(0,Math.min(wn,ii.length-1)),gr((Re=ii[ai])===null||Re===void 0?void 0:Re.key)}Mi(ai)},[ii.map(function(ai){return ai.key}).join("_"),nn,wn]);var In=(0,f.Z)(null,{value:rt}),fn=(0,ge.Z)(In,2),sr=fn[0],gn=fn[1];(0,R.useEffect)(function(){rt||(gn("rc-tabs-".concat(ke)),ke+=1)},[]);function Xn(ai,Re){xt==null||xt(ai,Re);var $e=ai!==nn;gr(ai),$e&&(ot==null||ot(ai))}var Ur={id:sr,activeKey:nn,animated:Ei,tabPosition:ye,rtl:Di,mobile:mi},wi=(0,Ze.Z)((0,Ze.Z)({},Ur),{},{editable:Je,locale:ae,more:he,tabBarGutter:we,onTabClick:Xn,onTabScroll:Nt,extra:W,style:K,panes:null,getPopupContainer:Xt,popupClassName:vi,indicator:ti});return R.createElement(k.Provider,{value:{tabs:ii,prefixCls:je}},R.createElement("div",(0,ce.Z)({ref:Ce,id:rt,className:P()(je,"".concat(je,"-").concat(ye),(0,De.Z)((0,De.Z)((0,De.Z)({},"".concat(je,"-mobile"),mi),"".concat(je,"-editable"),Je),"".concat(je,"-rtl"),Di),kt)},St),R.createElement(ee,(0,ce.Z)({},wi,{renderTabBar:st})),R.createElement(nt,(0,ce.Z)({destroyInactiveTabPane:_e},Ur,{animated:Ei}))))}),Gt=bt,Pt=Gt},29125:function(Li,It,oe){"use strict";oe.d(It,{G:function(){return ge},Z:function(){return j}});var ce=oe(92310),De=oe.n(ce),Ze=oe(59301);function ge(U){var $=U.children,G=U.prefixCls,fe=U.id,be=U.overlayInnerStyle,Se=U.bodyClassName,se=U.className,Oe=U.style;return Ze.createElement("div",{className:De()("".concat(G,"-content"),se),style:Oe},Ze.createElement("div",{className:De()("".concat(G,"-inner"),Se),id:fe,role:"tooltip",style:be},typeof $=="function"?$():$))}var q=oe(54476),S=oe(33885),Te=oe(75931),P=oe(65030),f={shiftX:64,adjustY:1},re={adjustX:1,shiftY:!0},R=[0,0],k={left:{points:["cr","cl"],overflow:re,offset:[-4,0],targetOffset:R},right:{points:["cl","cr"],overflow:re,offset:[4,0],targetOffset:R},top:{points:["bc","tc"],overflow:f,offset:[0,-4],targetOffset:R},bottom:{points:["tc","bc"],overflow:f,offset:[0,4],targetOffset:R},topLeft:{points:["bl","tl"],overflow:f,offset:[0,-4],targetOffset:R},leftTop:{points:["tr","tl"],overflow:re,offset:[-4,0],targetOffset:R},topRight:{points:["br","tr"],overflow:f,offset:[0,-4],targetOffset:R},rightTop:{points:["tl","tr"],overflow:re,offset:[4,0],targetOffset:R},bottomRight:{points:["tr","br"],overflow:f,offset:[0,4],targetOffset:R},rightBottom:{points:["bl","br"],overflow:re,offset:[4,0],targetOffset:R},bottomLeft:{points:["tl","bl"],overflow:f,offset:[0,4],targetOffset:R},leftBottom:{points:["br","bl"],overflow:re,offset:[-4,0],targetOffset:R}},T=null,M=oe(80402),O=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],Y=function($,G){var fe=$.overlayClassName,be=$.trigger,Se=be===void 0?["hover"]:be,se=$.mouseEnterDelay,Oe=se===void 0?0:se,We=$.mouseLeaveDelay,Be=We===void 0?.1:We,At=$.overlayStyle,te=$.prefixCls,z=te===void 0?"rc-tooltip":te,X=$.children,Q=$.onVisibleChange,de=$.afterVisibleChange,ie=$.transitionName,A=$.animation,L=$.motion,V=$.placement,pe=V===void 0?"right":V,ze=$.align,at=ze===void 0?{}:ze,Bt=$.destroyTooltipOnHide,Me=Bt===void 0?!1:Bt,Ht=$.defaultVisible,Dt=$.getTooltipContainer,ft=$.overlayInnerStyle,Si=$.arrowContent,di=$.overlay,tn=$.id,Kt=$.showArrow,hn=Kt===void 0?!0:Kt,Ne=$.classNames,He=$.styles,ve=(0,Te.Z)($,O),it=(0,M.Z)(tn),_t=(0,Ze.useRef)(null);(0,Ze.useImperativeHandle)(G,function(){return _t.current});var lt=(0,S.Z)({},ve);"visible"in $&&(lt.popupVisible=$.visible);var ee=function(){return Ze.createElement(ge,{key:"content",prefixCls:z,id:it,bodyClassName:Ne==null?void 0:Ne.body,overlayInnerStyle:(0,S.Z)((0,S.Z)({},ft),He==null?void 0:He.body)},di)},xe=function(){var Xe=Ze.Children.only(X),nt=(Xe==null?void 0:Xe.props)||{},gt=(0,S.Z)((0,S.Z)({},nt),{},{"aria-describedby":di?it:null});return Ze.cloneElement(X,gt)};return Ze.createElement(P.Z,(0,q.Z)({popupClassName:De()(fe,Ne==null?void 0:Ne.root),prefixCls:z,popup:ee,action:Se,builtinPlacements:k,popupPlacement:pe,ref:_t,popupAlign:at,getPopupContainer:Dt,onPopupVisibleChange:Q,afterPopupVisibleChange:de,popupTransitionName:ie,popupAnimation:A,popupMotion:L,defaultPopupVisible:Ht,autoDestroy:Me,mouseLeaveDelay:Be,popupStyle:(0,S.Z)((0,S.Z)({},At),He==null?void 0:He.root),mouseEnterDelay:Oe,arrow:hn},lt),xe())},H=(0,Ze.forwardRef)(Y),j=H},49658:function(Li,It){"use strict";It.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var oe=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(oe)||/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(oe==null?void 0:oe.substr(0,4))}},83145:function(Li,It,oe){"use strict";Object.defineProperty(It,"__esModule",{value:!0}),It.CopyToClipboard=void 0;var ce=Ze(oe(59301)),De=Ze(oe(25769));function Ze(U){return U&&U.__esModule?U:{default:U}}function ge(U){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ge=function(G){return typeof G}:ge=function(G){return G&&typeof Symbol=="function"&&G.constructor===Symbol&&G!==Symbol.prototype?"symbol":typeof G},ge(U)}function q(U,$){var G=Object.keys(U);if(Object.getOwnPropertySymbols){var fe=Object.getOwnPropertySymbols(U);$&&(fe=fe.filter(function(be){return Object.getOwnPropertyDescriptor(U,be).enumerable})),G.push.apply(G,fe)}return G}function S(U){for(var $=1;$<arguments.length;$++){var G=arguments[$]!=null?arguments[$]:{};$%2?q(G,!0).forEach(function(fe){H(U,fe,G[fe])}):Object.getOwnPropertyDescriptors?Object.defineProperties(U,Object.getOwnPropertyDescriptors(G)):q(G).forEach(function(fe){Object.defineProperty(U,fe,Object.getOwnPropertyDescriptor(G,fe))})}return U}function Te(U,$){if(U==null)return{};var G=P(U,$),fe,be;if(Object.getOwnPropertySymbols){var Se=Object.getOwnPropertySymbols(U);for(be=0;be<Se.length;be++)fe=Se[be],!($.indexOf(fe)>=0)&&Object.prototype.propertyIsEnumerable.call(U,fe)&&(G[fe]=U[fe])}return G}function P(U,$){if(U==null)return{};var G={},fe=Object.keys(U),be,Se;for(Se=0;Se<fe.length;Se++)be=fe[Se],!($.indexOf(be)>=0)&&(G[be]=U[be]);return G}function f(U,$){if(!(U instanceof $))throw new TypeError("Cannot call a class as a function")}function re(U,$){for(var G=0;G<$.length;G++){var fe=$[G];fe.enumerable=fe.enumerable||!1,fe.configurable=!0,"value"in fe&&(fe.writable=!0),Object.defineProperty(U,fe.key,fe)}}function R(U,$,G){return $&&re(U.prototype,$),G&&re(U,G),U}function k(U,$){return $&&(ge($)==="object"||typeof $=="function")?$:M(U)}function T(U){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(G){return G.__proto__||Object.getPrototypeOf(G)},T(U)}function M(U){if(U===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return U}function O(U,$){if(typeof $!="function"&&$!==null)throw new TypeError("Super expression must either be null or a function");U.prototype=Object.create($&&$.prototype,{constructor:{value:U,writable:!0,configurable:!0}}),$&&Y(U,$)}function Y(U,$){return Y=Object.setPrototypeOf||function(fe,be){return fe.__proto__=be,fe},Y(U,$)}function H(U,$,G){return $ in U?Object.defineProperty(U,$,{value:G,enumerable:!0,configurable:!0,writable:!0}):U[$]=G,U}var j=function(U){O($,U);function $(){var G,fe;f(this,$);for(var be=arguments.length,Se=new Array(be),se=0;se<be;se++)Se[se]=arguments[se];return fe=k(this,(G=T($)).call.apply(G,[this].concat(Se))),H(M(fe),"onClick",function(Oe){var We=fe.props,Be=We.text,At=We.onCopy,te=We.children,z=We.options,X=ce.default.Children.only(te),Q=(0,De.default)(Be,z);At&&At(Be,Q),X&&X.props&&typeof X.props.onClick=="function"&&X.props.onClick(Oe)}),fe}return R($,[{key:"render",value:function(){var fe=this.props,be=fe.text,Se=fe.onCopy,se=fe.options,Oe=fe.children,We=Te(fe,["text","onCopy","options","children"]),Be=ce.default.Children.only(Oe);return ce.default.cloneElement(Be,S({},We,{onClick:this.onClick}))}}]),$}(ce.default.PureComponent);It.CopyToClipboard=j,H(j,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Li,It,oe){"use strict";var ce=oe(83145),De=ce.CopyToClipboard;De.CopyToClipboard=De,Li.exports=De},76374:function(Li,It,oe){"use strict";var ce=function(){if(typeof Map!="undefined")return Map;function te(z,X){var Q=-1;return z.some(function(de,ie){return de[0]===X?(Q=ie,!0):!1}),Q}return function(){function z(){this.__entries__=[]}return Object.defineProperty(z.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),z.prototype.get=function(X){var Q=te(this.__entries__,X),de=this.__entries__[Q];return de&&de[1]},z.prototype.set=function(X,Q){var de=te(this.__entries__,X);~de?this.__entries__[de][1]=Q:this.__entries__.push([X,Q])},z.prototype.delete=function(X){var Q=this.__entries__,de=te(Q,X);~de&&Q.splice(de,1)},z.prototype.has=function(X){return!!~te(this.__entries__,X)},z.prototype.clear=function(){this.__entries__.splice(0)},z.prototype.forEach=function(X,Q){Q===void 0&&(Q=null);for(var de=0,ie=this.__entries__;de<ie.length;de++){var A=ie[de];X.call(Q,A[1],A[0])}},z}()}(),De=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Ze=function(){return typeof oe.g!="undefined"&&oe.g.Math===Math?oe.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),ge=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Ze):function(te){return setTimeout(function(){return te(Date.now())},1e3/60)}}(),q=2;function S(te,z){var X=!1,Q=!1,de=0;function ie(){X&&(X=!1,te()),Q&&L()}function A(){ge(ie)}function L(){var V=Date.now();if(X){if(V-de<q)return;Q=!0}else X=!0,Q=!1,setTimeout(A,z);de=V}return L}var Te=20,P=["top","right","bottom","left","width","height","size","weight"],f=typeof MutationObserver!="undefined",re=function(){function te(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=S(this.refresh.bind(this),Te)}return te.prototype.addObserver=function(z){~this.observers_.indexOf(z)||this.observers_.push(z),this.connected_||this.connect_()},te.prototype.removeObserver=function(z){var X=this.observers_,Q=X.indexOf(z);~Q&&X.splice(Q,1),!X.length&&this.connected_&&this.disconnect_()},te.prototype.refresh=function(){var z=this.updateObservers_();z&&this.refresh()},te.prototype.updateObservers_=function(){var z=this.observers_.filter(function(X){return X.gatherActive(),X.hasActive()});return z.forEach(function(X){return X.broadcastActive()}),z.length>0},te.prototype.connect_=function(){!De||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),f?(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)},te.prototype.disconnect_=function(){!De||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},te.prototype.onTransitionEnd_=function(z){var X=z.propertyName,Q=X===void 0?"":X,de=P.some(function(ie){return!!~Q.indexOf(ie)});de&&this.refresh()},te.getInstance=function(){return this.instance_||(this.instance_=new te),this.instance_},te.instance_=null,te}(),R=function(te,z){for(var X=0,Q=Object.keys(z);X<Q.length;X++){var de=Q[X];Object.defineProperty(te,de,{value:z[de],enumerable:!1,writable:!1,configurable:!0})}return te},k=function(te){var z=te&&te.ownerDocument&&te.ownerDocument.defaultView;return z||Ze},T=be(0,0,0,0);function M(te){return parseFloat(te)||0}function O(te){for(var z=[],X=1;X<arguments.length;X++)z[X-1]=arguments[X];return z.reduce(function(Q,de){var ie=te["border-"+de+"-width"];return Q+M(ie)},0)}function Y(te){for(var z=["top","right","bottom","left"],X={},Q=0,de=z;Q<de.length;Q++){var ie=de[Q],A=te["padding-"+ie];X[ie]=M(A)}return X}function H(te){var z=te.getBBox();return be(0,0,z.width,z.height)}function j(te){var z=te.clientWidth,X=te.clientHeight;if(!z&&!X)return T;var Q=k(te).getComputedStyle(te),de=Y(Q),ie=de.left+de.right,A=de.top+de.bottom,L=M(Q.width),V=M(Q.height);if(Q.boxSizing==="border-box"&&(Math.round(L+ie)!==z&&(L-=O(Q,"left","right")+ie),Math.round(V+A)!==X&&(V-=O(Q,"top","bottom")+A)),!$(te)){var pe=Math.round(L+ie)-z,ze=Math.round(V+A)-X;Math.abs(pe)!==1&&(L-=pe),Math.abs(ze)!==1&&(V-=ze)}return be(de.left,de.top,L,V)}var U=function(){return typeof SVGGraphicsElement!="undefined"?function(te){return te instanceof k(te).SVGGraphicsElement}:function(te){return te instanceof k(te).SVGElement&&typeof te.getBBox=="function"}}();function $(te){return te===k(te).document.documentElement}function G(te){return De?U(te)?H(te):j(te):T}function fe(te){var z=te.x,X=te.y,Q=te.width,de=te.height,ie=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,A=Object.create(ie.prototype);return R(A,{x:z,y:X,width:Q,height:de,top:X,right:z+Q,bottom:de+X,left:z}),A}function be(te,z,X,Q){return{x:te,y:z,width:X,height:Q}}var Se=function(){function te(z){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=be(0,0,0,0),this.target=z}return te.prototype.isActive=function(){var z=G(this.target);return this.contentRect_=z,z.width!==this.broadcastWidth||z.height!==this.broadcastHeight},te.prototype.broadcastRect=function(){var z=this.contentRect_;return this.broadcastWidth=z.width,this.broadcastHeight=z.height,z},te}(),se=function(){function te(z,X){var Q=fe(X);R(this,{target:z,contentRect:Q})}return te}(),Oe=function(){function te(z,X,Q){if(this.activeObservations_=[],this.observations_=new ce,typeof z!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=z,this.controller_=X,this.callbackCtx_=Q}return te.prototype.observe=function(z){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(z instanceof k(z).Element))throw new TypeError('parameter 1 is not of type "Element".');var X=this.observations_;X.has(z)||(X.set(z,new Se(z)),this.controller_.addObserver(this),this.controller_.refresh())}},te.prototype.unobserve=function(z){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(z instanceof k(z).Element))throw new TypeError('parameter 1 is not of type "Element".');var X=this.observations_;X.has(z)&&(X.delete(z),X.size||this.controller_.removeObserver(this))}},te.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},te.prototype.gatherActive=function(){var z=this;this.clearActive(),this.observations_.forEach(function(X){X.isActive()&&z.activeObservations_.push(X)})},te.prototype.broadcastActive=function(){if(this.hasActive()){var z=this.callbackCtx_,X=this.activeObservations_.map(function(Q){return new se(Q.target,Q.broadcastRect())});this.callback_.call(z,X,z),this.clearActive()}},te.prototype.clearActive=function(){this.activeObservations_.splice(0)},te.prototype.hasActive=function(){return this.activeObservations_.length>0},te}(),We=typeof WeakMap!="undefined"?new WeakMap:new ce,Be=function(){function te(z){if(!(this instanceof te))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var X=re.getInstance(),Q=new Oe(z,X,this);We.set(this,Q)}return te}();["observe","unobserve","disconnect"].forEach(function(te){Be.prototype[te]=function(){var z;return(z=We.get(this))[te].apply(z,arguments)}});var At=function(){return typeof Ze.ResizeObserver!="undefined"?Ze.ResizeObserver:Be}();It.Z=At},98040:function(Li){Li.exports=function(){var It=document.getSelection();if(!It.rangeCount)return function(){};for(var oe=document.activeElement,ce=[],De=0;De<It.rangeCount;De++)ce.push(It.getRangeAt(De));switch(oe.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":oe.blur();break;default:oe=null;break}return It.removeAllRanges(),function(){It.type==="Caret"&&It.removeAllRanges(),It.rangeCount||ce.forEach(function(Ze){It.addRange(Ze)}),oe&&oe.focus()}}},80360:function(Li,It,oe){"use strict";oe.d(It,{ZP:function(){return Ba}});const ce=Number.isFinite||function(h){return typeof h=="number"&&isFinite(h)},De=Number.isSafeInteger||function(h){return typeof h=="number"&&Math.abs(h)<=Ze},Ze=Number.MAX_SAFE_INTEGER||9007199254740991;let ge=function(h){return h.NETWORK_ERROR="networkError",h.MEDIA_ERROR="mediaError",h.KEY_SYSTEM_ERROR="keySystemError",h.MUX_ERROR="muxError",h.OTHER_ERROR="otherError",h}({}),q=function(h){return h.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",h.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",h.KEY_SYSTEM_NO_SESSION="keySystemNoSession",h.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",h.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",h.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",h.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",h.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",h.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",h.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",h.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",h.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",h.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",h.MANIFEST_LOAD_ERROR="manifestLoadError",h.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",h.MANIFEST_PARSING_ERROR="manifestParsingError",h.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",h.LEVEL_EMPTY_ERROR="levelEmptyError",h.LEVEL_LOAD_ERROR="levelLoadError",h.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",h.LEVEL_PARSING_ERROR="levelParsingError",h.LEVEL_SWITCH_ERROR="levelSwitchError",h.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",h.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",h.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",h.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",h.FRAG_LOAD_ERROR="fragLoadError",h.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",h.FRAG_DECRYPT_ERROR="fragDecryptError",h.FRAG_PARSING_ERROR="fragParsingError",h.FRAG_GAP="fragGap",h.REMUX_ALLOC_ERROR="remuxAllocError",h.KEY_LOAD_ERROR="keyLoadError",h.KEY_LOAD_TIMEOUT="keyLoadTimeOut",h.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",h.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",h.BUFFER_APPEND_ERROR="bufferAppendError",h.BUFFER_APPENDING_ERROR="bufferAppendingError",h.BUFFER_STALLED_ERROR="bufferStalledError",h.BUFFER_FULL_ERROR="bufferFullError",h.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",h.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",h.ASSET_LIST_LOAD_ERROR="assetListLoadError",h.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",h.ASSET_LIST_PARSING_ERROR="assetListParsingError",h.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",h.INTERNAL_EXCEPTION="internalException",h.INTERNAL_ABORTED="aborted",h.ATTACH_MEDIA_ERROR="attachMediaError",h.UNKNOWN="unknown",h}({}),S=function(h){return h.MEDIA_ATTACHING="hlsMediaAttaching",h.MEDIA_ATTACHED="hlsMediaAttached",h.MEDIA_DETACHING="hlsMediaDetaching",h.MEDIA_DETACHED="hlsMediaDetached",h.MEDIA_ENDED="hlsMediaEnded",h.STALL_RESOLVED="hlsStallResolved",h.BUFFER_RESET="hlsBufferReset",h.BUFFER_CODECS="hlsBufferCodecs",h.BUFFER_CREATED="hlsBufferCreated",h.BUFFER_APPENDING="hlsBufferAppending",h.BUFFER_APPENDED="hlsBufferAppended",h.BUFFER_EOS="hlsBufferEos",h.BUFFERED_TO_END="hlsBufferedToEnd",h.BUFFER_FLUSHING="hlsBufferFlushing",h.BUFFER_FLUSHED="hlsBufferFlushed",h.MANIFEST_LOADING="hlsManifestLoading",h.MANIFEST_LOADED="hlsManifestLoaded",h.MANIFEST_PARSED="hlsManifestParsed",h.LEVEL_SWITCHING="hlsLevelSwitching",h.LEVEL_SWITCHED="hlsLevelSwitched",h.LEVEL_LOADING="hlsLevelLoading",h.LEVEL_LOADED="hlsLevelLoaded",h.LEVEL_UPDATED="hlsLevelUpdated",h.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",h.LEVELS_UPDATED="hlsLevelsUpdated",h.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",h.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",h.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",h.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",h.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",h.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",h.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",h.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",h.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",h.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",h.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",h.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",h.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",h.CUES_PARSED="hlsCuesParsed",h.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",h.INIT_PTS_FOUND="hlsInitPtsFound",h.FRAG_LOADING="hlsFragLoading",h.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",h.FRAG_LOADED="hlsFragLoaded",h.FRAG_DECRYPTED="hlsFragDecrypted",h.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",h.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",h.FRAG_PARSING_METADATA="hlsFragParsingMetadata",h.FRAG_PARSED="hlsFragParsed",h.FRAG_BUFFERED="hlsFragBuffered",h.FRAG_CHANGED="hlsFragChanged",h.FPS_DROP="hlsFpsDrop",h.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",h.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",h.ERROR="hlsError",h.DESTROYING="hlsDestroying",h.KEY_LOADING="hlsKeyLoading",h.KEY_LOADED="hlsKeyLoaded",h.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",h.BACK_BUFFER_REACHED="hlsBackBufferReached",h.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",h.ASSET_LIST_LOADING="hlsAssetListLoading",h.ASSET_LIST_LOADED="hlsAssetListLoaded",h.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",h.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",h.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",h.INTERSTITIAL_STARTED="hlsInterstitialStarted",h.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",h.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",h.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",h.INTERSTITIAL_ENDED="hlsInterstitialEnded",h.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",h.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",h.EVENT_CUE_ENTER="hlsEventCueEnter",h}({});var Te={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},P={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class f{constructor(t,n=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=n,this.totalWeight_=s}sample(t,n){const s=Math.pow(this.alpha_,t);this.estimate_=n*(1-s)+s*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class re{constructor(t,n,s,o=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_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new f(t),this.fast_=new f(n),this.defaultTTFB_=o,this.ttfb_=new f(t)}update(t,n){const{slow_:s,fast_:o,ttfb_:l}=this;s.halfLife!==t&&(this.slow_=new f(t,s.getEstimate(),s.getTotalWeight())),o.halfLife!==n&&(this.fast_=new f(n,o.getEstimate(),o.getTotalWeight())),l.halfLife!==t&&(this.ttfb_=new f(t,l.getEstimate(),l.getTotalWeight()))}sample(t,n){t=Math.max(t,this.minDelayMs_);const s=8*n,o=t/1e3,l=s/o;this.fast_.sample(o,l),this.slow_.sample(o,l)}sampleTTFB(t){const n=t/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(n,2)/2);this.ttfb_.sample(s,Math.max(t,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 R(h,t,n){return(t=Y(t))in h?Object.defineProperty(h,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):h[t]=n,h}function k(){return k=Object.assign?Object.assign.bind():function(h){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(h[s]=n[s])}return h},k.apply(null,arguments)}function T(h,t){var n=Object.keys(h);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(h);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(h,o).enumerable})),n.push.apply(n,s)}return n}function M(h){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?T(Object(n),!0).forEach(function(s){R(h,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(s){Object.defineProperty(h,s,Object.getOwnPropertyDescriptor(n,s))})}return h}function O(h,t){if(typeof h!="object"||!h)return h;var n=h[Symbol.toPrimitive];if(n!==void 0){var s=n.call(h,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(h)}function Y(h){var t=O(h,"string");return typeof t=="symbol"?t:t+""}class H{constructor(t,n){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 s=`[${t}]:`;this.trace=j,this.debug=n.debug.bind(null,s),this.log=n.log.bind(null,s),this.warn=n.warn.bind(null,s),this.info=n.info.bind(null,s),this.error=n.error.bind(null,s)}}const j=function(){},U={trace:j,debug:j,log:j,warn:j,info:j,error:j};function $(){return k({},U)}function G(h,t){const n=self.console[h];return n?n.bind(self.console,`${t?"["+t+"] ":""}[${h}] >`):j}function fe(h,t,n){return t[h]?t[h].bind(t):G(h,n)}const be=$();function Se(h,t,n){const s=$();if(typeof console=="object"&&h===!0||typeof h=="object"){const o=["debug","log","info","warn","error"];o.forEach(l=>{s[l]=fe(l,h,n)});try{s.log(`Debug logs enabled for "${t}" in hls.js version 1.6.13`)}catch(l){return $()}o.forEach(l=>{be[l]=fe(l,h)})}else k(be,s);return s}const se=be;function Oe(h=!0){return typeof self=="undefined"?void 0:(h||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function We(h){return typeof self!="undefined"&&h===self.ManagedMediaSource}function Be(h,t){const n=Object.keys(h),s=Object.keys(t),o=n.length,l=s.length;return!o||!l||o===l&&!n.some(u=>s.indexOf(u)===-1)}function At(h,t=!1){if(typeof TextDecoder!="undefined"){const g=new TextDecoder("utf-8").decode(h);if(t){const v=g.indexOf("\0");return v!==-1?g.substring(0,v):g}return g.replace(/\0/g,"")}const n=h.length;let s,o,l,u="",d=0;for(;d<n;){if(s=h[d++],s===0&&t)return u;if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(s);break;case 12:case 13:o=h[d++],u+=String.fromCharCode((s&31)<<6|o&63);break;case 14:o=h[d++],l=h[d++],u+=String.fromCharCode((s&15)<<12|(o&63)<<6|(l&63)<<0);break}}return u}function te(h){let t="";for(let n=0;n<h.length;n++){let s=h[n].toString(16);s.length<2&&(s="0"+s),t+=s}return t}function z(h){return Uint8Array.from(h.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function X(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var Q={exports:{}},de;function ie(){return de||(de=1,function(h,t){(function(n){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,o=/^(?=([^\/?#]*))\1([^]*)$/,l=/(?:\/|^)\.(?=\/)/g,u=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,d={buildAbsoluteURL:function(_,g,v){if(v=v||{},_=_.trim(),g=g.trim(),!g){if(!v.alwaysNormalize)return _;var y=d.parseURL(_);if(!y)throw new Error("Error trying to parse base URL.");return y.path=d.normalizePath(y.path),d.buildURLFromParts(y)}var x=d.parseURL(g);if(!x)throw new Error("Error trying to parse relative URL.");if(x.scheme)return v.alwaysNormalize?(x.path=d.normalizePath(x.path),d.buildURLFromParts(x)):g;var D=d.parseURL(_);if(!D)throw new Error("Error trying to parse base URL.");if(!D.netLoc&&D.path&&D.path[0]!=="/"){var C=o.exec(D.path);D.netLoc=C[1],D.path=C[2]}D.netLoc&&!D.path&&(D.path="/");var F={scheme:D.scheme,netLoc:x.netLoc,path:null,params:x.params,query:x.query,fragment:x.fragment};if(!x.netLoc&&(F.netLoc=D.netLoc,x.path[0]!=="/"))if(!x.path)F.path=D.path,x.params||(F.params=D.params,x.query||(F.query=D.query));else{var B=D.path,J=B.substring(0,B.lastIndexOf("/")+1)+x.path;F.path=d.normalizePath(J)}return F.path===null&&(F.path=v.alwaysNormalize?d.normalizePath(x.path):x.path),d.buildURLFromParts(F)},parseURL:function(_){var g=s.exec(_);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(l,"");_.length!==(_=_.replace(u,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};h.exports=d})()}(Q)),Q.exports}var A=ie();class L{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 V={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class pe{constructor(t){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof t=="string"&&(t={url:t}),this.base=t,Ht(this,"stats")}setByteRange(t,n){const s=t.split("@",2);let o;s.length===1?o=(n==null?void 0:n.byteRangeEndOffset)||0:o=parseInt(s[1]),this._byteRange=[o,parseInt(s[0])+o]}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={[V.AUDIO]:null,[V.VIDEO]:null,[V.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(t){this._streams=t}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new L),this._stats}set stats(t){this._stats=t}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=A.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[V.AUDIO]=null,t[V.VIDEO]=null,t[V.AUDIOVIDEO]=null}}function ze(h){return h.sn!=="initSegment"}class at extends pe{constructor(t,n){super(n),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=t}get byteLength(){if(this.hasStats){const t=this.stats.total;if(t)return t}if(this.byteRange.length){const t=this.byteRange[0],n=this.byteRange[1];if(ce(t)&&ce(n))return n-t}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(t){this._bitrate=t}get decryptdata(){var t;const{levelkeys:n}=this;if(!n||n.NONE)return null;if(n.identity)this._decryptdata||(this._decryptdata=n.identity.getDecryptData(this.sn));else if(!((t=this._decryptdata)!=null&&t.keyId)){const s=Object.keys(n);if(s.length===1){const o=this._decryptdata=n[s[0]]||null;o&&(this._decryptdata=o.getDecryptData(this.sn,n))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const t=ce(this.duration)?this.duration:0;return this.programDateTime+t*1e3}get encrypted(){var t;if((t=this._decryptdata)!=null&&t.encrypted)return!0;if(this.levelkeys){var n;const s=Object.keys(this.levelkeys),o=s.length;if(o>1||o===1&&(n=this.levelkeys[s[0]])!=null&&n.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(t){if(!ce(t)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=t}get ref(){return ze(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(t){this.setStart(this.start+t)}setStart(t){this.start=t,this._ref&&(this._ref.start=t)}setDuration(t){this.duration=t,this._ref&&(this._ref.duration=t)}setKeyFormat(t){const n=this.levelkeys;if(n){var s;const o=n[t];o&&!((s=this._decryptdata)!=null&&s.keyId)&&(this._decryptdata=o.getDecryptData(this.sn,n))}}abortRequests(){var t,n;(t=this.loader)==null||t.abort(),(n=this.keyLoader)==null||n.abort()}setElementaryStreamInfo(t,n,s,o,l,u=!1){const{elementaryStreams:d}=this,_=d[t];if(!_){d[t]={startPTS:n,endPTS:s,startDTS:o,endDTS:l,partial:u};return}_.startPTS=Math.min(_.startPTS,n),_.endPTS=Math.max(_.endPTS,s),_.startDTS=Math.min(_.startDTS,o),_.endDTS=Math.max(_.endDTS,l)}}class Bt extends pe{constructor(t,n,s,o,l){super(s),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=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=n,this.index=o;const u=t.enumeratedString("BYTERANGE");u&&this.setByteRange(u,l),l&&(this.fragOffset=l.fragOffset+l.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}function Me(h,t){const n=Object.getPrototypeOf(h);if(n){const s=Object.getOwnPropertyDescriptor(n,t);return s||Me(n,t)}}function Ht(h,t){const n=Me(h,t);n&&(n.enumerable=!0,Object.defineProperty(h,t,n))}const Dt=Math.pow(2,32)-1,ft=[].push,Si={video:1,audio:2,id3:3,text:4};function di(h){return String.fromCharCode.apply(null,h)}function tn(h,t){const n=h[t]<<8|h[t+1];return n<0?65536+n:n}function Kt(h,t){const n=Ne(h,t);return n<0?4294967296+n:n}function hn(h,t){let n=Kt(h,t);return n*=Math.pow(2,32),n+=Kt(h,t+4),n}function Ne(h,t){return h[t]<<24|h[t+1]<<16|h[t+2]<<8|h[t+3]}function He(h){const t=h.byteLength;for(let n=0;n<t;){const s=Kt(h,n);if(s>8&&h[n+4]===109&&h[n+5]===111&&h[n+6]===111&&h[n+7]===102)return!0;n=s>1?n+s:t}return!1}function ve(h,t){const n=[];if(!t.length)return n;const s=h.byteLength;for(let o=0;o<s;){const l=Kt(h,o),u=di(h.subarray(o+4,o+8)),d=l>1?o+l:s;if(u===t[0])if(t.length===1)n.push(h.subarray(o+8,d));else{const _=ve(h.subarray(o+8,d),t.slice(1));_.length&&ft.apply(n,_)}o=d}return n}function it(h){const t=[],n=h[0];let s=8;const o=Kt(h,s);s+=4;let l=0,u=0;n===0?(l=Kt(h,s),u=Kt(h,s+4),s+=8):(l=hn(h,s),u=hn(h,s+8),s+=16),s+=2;let d=h.length+u;const _=tn(h,s);s+=2;for(let g=0;g<_;g++){let v=s;const y=Kt(h,v);v+=4;const x=y&2147483647;if((y&2147483648)>>>31===1)return se.warn("SIDX has hierarchical references (not supported)"),null;const C=Kt(h,v);v+=4,t.push({referenceSize:x,subsegmentDuration:C,info:{duration:C/o,start:d,end:d+x-1}}),d+=x,v+=4,s=v}return{earliestPresentationTime:l,timescale:o,version:n,referencesCount:_,references:t}}function _t(h){const t=[],n=ve(h,["moov","trak"]);for(let o=0;o<n.length;o++){const l=n[o],u=ve(l,["tkhd"])[0];if(u){let d=u[0];const _=Kt(u,d===0?12:20),g=ve(l,["mdia","mdhd"])[0];if(g){d=g[0];const v=Kt(g,d===0?12:20),y=ve(l,["mdia","hdlr"])[0];if(y){const x=di(y.subarray(8,12)),D={soun:V.AUDIO,vide:V.VIDEO}[x],C=ve(l,["mdia","minf","stbl","stsd"])[0],F=lt(C);D?(t[_]={timescale:v,type:D,stsd:F},t[D]=M({timescale:v,id:_},F)):t[_]={timescale:v,type:x,stsd:F}}}}}return ve(h,["moov","mvex","trex"]).forEach(o=>{const l=Kt(o,4),u=t[l];u&&(u.default={duration:Kt(o,12),flags:Kt(o,20)})}),t}function lt(h){const t=h.subarray(8),n=t.subarray(86),s=di(t.subarray(4,8));let o=s,l;const u=s==="enca"||s==="encv";if(u){const g=ve(t,[s])[0].subarray(s==="enca"?28:78);ve(g,["sinf"]).forEach(y=>{const x=ve(y,["schm"])[0];if(x){const D=di(x.subarray(4,8));if(D==="cbcs"||D==="cenc"){const C=ve(y,["frma"])[0];C&&(o=di(C))}}})}const d=o;switch(o){case"avc1":case"avc2":case"avc3":case"avc4":{const _=ve(n,["avcC"])[0];_&&_.length>3&&(o+="."+Xe(_[1])+Xe(_[2])+Xe(_[3]),l=ee(d==="avc1"?"dva1":"dvav",n));break}case"mp4a":{const _=ve(t,[s])[0],g=ve(_.subarray(28),["esds"])[0];if(g&&g.length>7){let v=4;if(g[v++]!==3)break;v=Ke(g,v),v+=2;const y=g[v++];if(y&128&&(v+=2),y&64&&(v+=g[v++]),g[v++]!==4)break;v=Ke(g,v);const x=g[v++];if(x===64)o+="."+Xe(x);else break;if(v+=12,g[v++]!==5)break;v=Ke(g,v);const D=g[v++];let C=(D&248)>>3;C===31&&(C+=1+((D&7)<<3)+((g[v]&224)>>5)),o+="."+C}break}case"hvc1":case"hev1":{const _=ve(n,["hvcC"])[0];if(_&&_.length>12){const g=_[1],v=["","A","B","C"][g>>6],y=g&31,x=Kt(_,2),D=(g&32)>>5?"H":"L",C=_[12],F=_.subarray(6,12);o+="."+v+y,o+="."+xe(x).toString(16).toUpperCase(),o+="."+D+C;let B="";for(let J=F.length;J--;){const ne=F[J];(ne||B)&&(B="."+ne.toString(16).toUpperCase()+B)}o+=B}l=ee(d=="hev1"?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{o=ee(o,n)||o;break}case"vp09":{const _=ve(n,["vpcC"])[0];if(_&&_.length>6){const g=_[4],v=_[5],y=_[6]>>4&15;o+="."+nt(g)+"."+nt(v)+"."+nt(y)}break}case"av01":{const _=ve(n,["av1C"])[0];if(_&&_.length>2){const g=_[1]>>>5,v=_[1]&31,y=_[2]>>>7?"H":"M",x=(_[2]&64)>>6,D=(_[2]&32)>>5,C=g===2&&x?D?12:10:x?10:8,F=(_[2]&16)>>4,B=(_[2]&8)>>3,J=(_[2]&4)>>2,ne=_[2]&3;o+="."+g+"."+nt(v)+y+"."+nt(C)+"."+F+"."+B+J+ne+"."+nt(1)+"."+nt(1)+"."+nt(1)+"."+0,l=ee("dav1",n)}break}}return{codec:o,encrypted:u,supplemental:l}}function ee(h,t){const n=ve(t,["dvvC"]),s=n.length?n[0]:ve(t,["dvcC"])[0];if(s){const o=s[2]>>1&127,l=s[2]<<5&32|s[3]>>3&31;return h+"."+nt(o)+"."+nt(l)}}function xe(h){let t=0;for(let n=0;n<32;n++)t|=(h>>n&1)<<31-n;return t>>>0}function Ke(h,t){const n=t+5;for(;h[t++]&128&&t<n;);return t}function Xe(h){return("0"+h.toString(16).toUpperCase()).slice(-2)}function nt(h){return(h<10?"0":"")+h}function gt(h,t){if(!h||!t)return;const n=t.keyId;n&&t.isCommonEncryption&&dt(h,(s,o)=>{const l=s.subarray(8,24);l.some(u=>u!==0)||(se.log(`[eme] Patching keyId in 'enc${o?"a":"v"}>sinf>>tenc' box: ${te(l)} -> ${te(n)}`),s.set(n,8))})}function Yt(h){const t=[];return dt(h,n=>t.push(n.subarray(8,24))),t}function dt(h,t){ve(h,["moov","trak"]).forEach(s=>{const o=ve(s,["mdia","minf","stbl","stsd"])[0];if(!o)return;const l=o.subarray(8);let u=ve(l,["enca"]);const d=u.length>0;d||(u=ve(l,["encv"])),u.forEach(_=>{const g=d?_.subarray(28):_.subarray(78);ve(g,["sinf"]).forEach(y=>{const x=ke(y);x&&t(x,d)})})})}function ke(h){const t=ve(h,["schm"])[0];if(t){const n=di(t.subarray(4,8));if(n==="cbcs"||n==="cenc"){const s=ve(h,["schi","tenc"])[0];if(s)return s}}}function bt(h,t,n){const s={},o=ve(h,["moof","traf"]);for(let l=0;l<o.length;l++){const u=o[l],d=ve(u,["tfhd"])[0],_=Kt(d,4),g=t[_];if(!g)continue;s[_]||(s[_]={start:NaN,duration:0,sampleCount:0,timescale:g.timescale,type:g.type});const v=s[_],y=ve(u,["tfdt"])[0];if(y){const le=y[0];let Ee=Kt(y,4);le===1&&(Ee===Dt?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(Ee*=Dt+1,Ee+=Kt(y,8))),ce(Ee)&&(!ce(v.start)||Ee<v.start)&&(v.start=Ee)}const x=g.default,D=Kt(d,0)|(x==null?void 0:x.flags);let C=(x==null?void 0:x.duration)||0;D&8&&(D&2?C=Kt(d,12):C=Kt(d,8));const F=ve(u,["trun"]);let B=v.start||0,J=0,ne=C;for(let le=0;le<F.length;le++){const Ee=F[le],Ie=Kt(Ee,4),tt=v.sampleCount;v.sampleCount+=Ie;const Pe=Ee[3]&1,Ye=Ee[3]&4,qe=Ee[2]&1,Fe=Ee[2]&2,mt=Ee[2]&4,Zt=Ee[2]&8;let ui=8,xi=Ie;for(Pe&&(ui+=4),Ye&&Ie&&(!(Ee[ui+1]&1)&&v.keyFrameIndex===void 0&&(v.keyFrameIndex=tt),ui+=4,qe?(ne=Kt(Ee,ui),ui+=4):ne=C,Fe&&(ui+=4),Zt&&(ui+=4),B+=ne,J+=ne,xi--);xi--;)qe?(ne=Kt(Ee,ui),ui+=4):ne=C,Fe&&(ui+=4),mt&&(Ee[ui+1]&1||v.keyFrameIndex===void 0&&(v.keyFrameIndex=v.sampleCount-(xi+1),v.keyFrameStart=B),ui+=4),Zt&&(ui+=4),B+=ne,J+=ne;!J&&C&&(J+=C*Ie)}v.duration+=J}if(!Object.keys(s).some(l=>s[l].duration)){let l=1/0,u=0;const d=ve(h,["sidx"]);for(let _=0;_<d.length;_++){const g=it(d[_]);if(g!=null&&g.references){l=Math.min(l,g.earliestPresentationTime/g.timescale);const v=g.references.reduce((y,x)=>y+x.info.duration||0,0);u=Math.max(u,v+g.earliestPresentationTime/g.timescale)}}u&&ce(u)&&Object.keys(s).forEach(_=>{s[_].duration||(s[_].duration=u*s[_].timescale-s[_].start)})}return s}function Gt(h){const t={valid:null,remainder:null},n=ve(h,["moof"]);if(n.length<2)return t.remainder=h,t;const s=n[n.length-1];return t.valid=h.slice(0,s.byteOffset-8),t.remainder=h.slice(s.byteOffset-8),t}function Pt(h,t){const n=new Uint8Array(h.length+t.length);return n.set(h),n.set(t,h.length),n}function Ae(h,t){const n=[],s=t.samples,o=t.timescale,l=t.id;let u=!1;return ve(s,["moof"]).map(_=>{const g=_.byteOffset-8;ve(_,["traf"]).map(y=>{const x=ve(y,["tfdt"]).map(D=>{const C=D[0];let F=Kt(D,4);return C===1&&(F*=Math.pow(2,32),F+=Kt(D,8)),F/o})[0];return x!==void 0&&(h=x),ve(y,["tfhd"]).map(D=>{const C=Kt(D,4),F=Kt(D,0)&16777215,B=(F&1)!==0,J=(F&2)!==0,ne=(F&8)!==0;let le=0;const Ee=(F&16)!==0;let Ie=0;const tt=(F&32)!==0;let Pe=8;C===l&&(B&&(Pe+=8),J&&(Pe+=4),ne&&(le=Kt(D,Pe),Pe+=4),Ee&&(Ie=Kt(D,Pe),Pe+=4),tt&&(Pe+=4),t.type==="video"&&(u=Ce(t.codec)),ve(y,["trun"]).map(Ye=>{const qe=Ye[0],Fe=Kt(Ye,0)&16777215,mt=(Fe&1)!==0;let Zt=0;const ui=(Fe&4)!==0,xi=(Fe&256)!==0;let si=0;const Vt=(Fe&512)!==0;let ci=0;const ei=(Fe&1024)!==0,gi=(Fe&2048)!==0;let zi=0;const Ut=Kt(Ye,4);let qt=8;mt&&(Zt=Kt(Ye,qt),qt+=4),ui&&(qt+=4);let Zi=Zt+g;for(let Fn=0;Fn<Ut;Fn++){if(xi?(si=Kt(Ye,qt),qt+=4):si=le,Vt?(ci=Kt(Ye,qt),qt+=4):ci=Ie,ei&&(qt+=4),gi&&(qe===0?zi=Kt(Ye,qt):zi=Ne(Ye,qt),qt+=4),t.type===V.VIDEO){let _i=0;for(;_i<ci;){const xn=Kt(s,Zi);if(Zi+=4,rt(u,s[Zi])){const qr=s.subarray(Zi,Zi+xn);ut(qr,u?2:1,h+zi/o,n)}Zi+=xn,_i+=xn+4}}h+=si/o}}))})})}),n}function Ce(h){if(!h)return!1;const t=h.substring(0,4);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function rt(h,t){if(h){const n=t>>1&63;return n===39||n===40}else return(t&31)===6}function ut(h,t,n,s){const o=je(h);let l=0;l+=t;let u=0,d=0,_=0;for(;l<o.length;){u=0;do{if(l>=o.length)break;_=o[l++],u+=_}while(_===255);d=0;do{if(l>=o.length)break;_=o[l++],d+=_}while(_===255);const g=o.length-l;let v=l;if(d<g)l+=d;else if(d>g){se.error(`Malformed SEI payload. ${d} is too small, only ${g} bytes left to parse.`);break}if(u===4){if(o[v++]===181){const x=tn(o,v);if(v+=2,x===49){const D=Kt(o,v);if(v+=4,D===1195456820){const C=o[v++];if(C===3){const F=o[v++],B=31&F,J=64&F,ne=J?2+B*3:0,le=new Uint8Array(ne);if(J){le[0]=F;for(let Ee=1;Ee<ne;Ee++)le[Ee]=o[v++]}s.push({type:C,payloadType:u,pts:n,bytes:le})}}}}}else if(u===5&&d>16){const y=[];for(let C=0;C<16;C++){const F=o[v++].toString(16);y.push(F.length==1?"0"+F:F),(C===3||C===5||C===7||C===9)&&y.push("-")}const x=d-16,D=new Uint8Array(x);for(let C=0;C<x;C++)D[C]=o[v++];s.push({payloadType:u,pts:n,uuid:y.join(""),userData:At(D),userDataBytes:D})}}}function je(h){const t=h.byteLength,n=[];let s=1;for(;s<t-2;)h[s]===0&&h[s+1]===0&&h[s+2]===3?(n.push(s+2),s+=2):s++;if(n.length===0)return h;const o=t-n.length,l=new Uint8Array(o);let u=0;for(s=0;s<o;u++,s++)u===n[0]&&(u++,n.shift()),l[s]=h[u];return l}function kt(h){const t=h[0];let n="",s="",o=0,l=0,u=0,d=0,_=0,g=0;if(t===0){for(;di(h.subarray(g,g+1))!=="\0";)n+=di(h.subarray(g,g+1)),g+=1;for(n+=di(h.subarray(g,g+1)),g+=1;di(h.subarray(g,g+1))!=="\0";)s+=di(h.subarray(g,g+1)),g+=1;s+=di(h.subarray(g,g+1)),g+=1,o=Kt(h,12),l=Kt(h,16),d=Kt(h,20),_=Kt(h,24),g=28}else if(t===1){g+=4,o=Kt(h,g),g+=4;const y=Kt(h,g);g+=4;const x=Kt(h,g);for(g+=4,u=wa(2,32)*y+x,De(u)||(u=Number.MAX_SAFE_INTEGER,se.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),d=Kt(h,g),g+=4,_=Kt(h,g),g+=4;di(h.subarray(g,g+1))!=="\0";)n+=di(h.subarray(g,g+1)),g+=1;for(n+=di(h.subarray(g,g+1)),g+=1;di(h.subarray(g,g+1))!=="\0";)s+=di(h.subarray(g,g+1)),g+=1;s+=di(h.subarray(g,g+1)),g+=1}const v=h.subarray(g,h.byteLength);return{schemeIdUri:n,value:s,timeScale:o,presentationTime:u,presentationTimeDelta:l,eventDuration:d,id:_,payload:v}}function Tt(h,...t){const n=t.length;let s=8,o=n;for(;o--;)s+=t[o].byteLength;const l=new Uint8Array(s);for(l[0]=s>>24&255,l[1]=s>>16&255,l[2]=s>>8&255,l[3]=s&255,l.set(h,4),o=0,s=8;o<n;o++)l.set(t[o],s),s+=t[o].byteLength;return l}function vt(h,t,n){if(h.byteLength!==16)throw new RangeError("Invalid system id");let s,o;s=0,o=new Uint8Array;let l;s>0?(l=new Uint8Array(4),t.length>0&&new DataView(l.buffer).setUint32(0,t.length,!1)):l=new Uint8Array;const u=new Uint8Array(4);return n.byteLength>0&&new DataView(u.buffer).setUint32(0,n.byteLength,!1),Tt([112,115,115,104],new Uint8Array([s,0,0,0]),h,l,o,u,n)}function Ot(h){const t=[];if(h instanceof ArrayBuffer){const n=h.byteLength;let s=0;for(;s+32<n;){const o=new DataView(h,s),l=jt(o);t.push(l),s+=l.size}}return t}function jt(h){const t=h.getUint32(0),n=h.byteOffset,s=h.byteLength;if(s<t)return{offset:n,size:s};if(h.getUint32(4)!==1886614376)return{offset:n,size:t};const l=h.getUint32(8)>>>24;if(l!==0&&l!==1)return{offset:n,size:t};const u=h.buffer,d=te(new Uint8Array(u,n+12,16));let _=null,g=null,v=0;if(l===0)v=28;else{const x=h.getUint32(28);if(!x||s<32+x*16)return{offset:n,size:t};_=[];for(let D=0;D<x;D++)_.push(new Uint8Array(u,n+32+D*16,16));v=32+x*16}if(!v)return{offset:n,size:t};const y=h.getUint32(v);return t-32<y?{offset:n,size:t}:(g=new Uint8Array(u,n+v+4,y),{version:l,systemId:d,kids:_,data:g,offset:n,size:t})}const Je=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ft={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 Le(h,t){const n=Ft[t];return!!n&&!!n[h.slice(0,4)]}function ye(h,t,n=!0){return!h.split(",").some(s=>!we(s,t,n))}function we(h,t,n=!0){var s;const o=Oe(n);return(s=o==null?void 0:o.isTypeSupported(K(h,t)))!=null?s:!1}function K(h,t){return`${t}/mp4;codecs=${h}`}function W(h){if(h){const t=h.substring(0,4);return Ft.video[t]}return 2}function ae(h){const t=Je();return h.split(",").reduce((n,s)=>{const l=t&&Ce(s)?9:Ft.video[s];return l?(l*2+n)/(n?3:2):(Ft.audio[s]+n)/(n?2:1)},0)}const he={};function _e(h,t=!0){if(he[h])return he[h];const n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[h];for(let o=0;o<n.length;o++){var s;if(we(n[o],"audio",t))return he[h]=n[o],n[o];if(n[o]==="mp3"&&(s=Oe(t))!=null&&s.isTypeSupported("audio/mpeg"))return""}return h}const st=/flac|opus|mp4a\.40\.34/i;function ot(h,t=!0){return h.replace(st,n=>_e(n.toLowerCase(),t))}function xt(h,t){const n=[];if(h){const s=h.split(",");for(let o=0;o<s.length;o++)Le(s[o],"video")||n.push(s[o])}return t&&n.push(t),n.join(",")}function Nt(h,t){if(h&&(h.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(h)!==-1)&&(Xt(h,"audio")||Xt(h,"video")))return h;if(t){const n=t.split(",");if(n.length>1){if(h){for(let s=n.length;s--;)if(n[s].substring(0,4)===h.substring(0,4))return n[s]}return n[0]}}return t||h}function Xt(h,t){return Le(h,t)&&we(h,t)}function vi(h){const t=h.split(",");for(let n=0;n<t.length;n++){const s=t[n].split(".");s.length>2&&s[0]==="avc1"&&(t[n]=`avc1.${parseInt(s[1]).toString(16)}${("000"+parseInt(s[2]).toString(16)).slice(-4)}`)}return t.join(",")}function ti(h){if(h.startsWith("av01.")){const t=h.split("."),n=["0","111","01","01","01","0"];for(let s=t.length;s>4&&s<10;s++)t[s]=n[s-4];return t.join(".")}return h}function St(h){const t=Oe(h)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function ii(h){return h.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Di={supported:!0,powerEfficient:!0,smooth:!0},Ei={supported:!1,smooth:!1,powerEfficient:!1},$i={supported:!0,configurations:[],decodingInfoResults:[Di]};function pi(h,t){return{supported:!1,configurations:t,decodingInfoResults:[Ei],error:h}}function mi(h,t,n,s,o,l){const u=h.videoCodec,d=h.audioCodec?h.audioGroups:null,_=l==null?void 0:l.audioCodec,g=l==null?void 0:l.channels,v=g?parseInt(g):_?1/0:2;let y=null;if(d!=null&&d.length)try{d.length===1&&d[0]?y=t.groups[d[0]].channels:y=d.reduce((x,D)=>{if(D){const C=t.groups[D];if(!C)throw new Error(`Audio track group ${D} not found`);Object.keys(C.channels).forEach(F=>{x[F]=(x[F]||0)+C.channels[F]})}return x},{2:0})}catch(x){return!0}return u!==void 0&&(u.split(",").some(x=>Ce(x))||h.width>1920&&h.height>1088||h.height>1920&&h.width>1088||h.frameRate>Math.max(s,30)||h.videoRange!=="SDR"&&h.videoRange!==n||h.bitrate>Math.max(o,8e6))||!!y&&ce(v)&&Object.keys(y).some(x=>parseInt(x)>v)}function Xi(h,t,n,s={}){const o=h.videoCodec;if(!o&&!h.audioCodec||!n)return Promise.resolve($i);const l=[],u=an(h),d=u.length,_=mn(h,t,d>0),g=_.length;for(let v=d||1*g||1;v--;){const y={type:"media-source"};if(d&&(y.video=u[v%d]),g){y.audio=_[v%g];const x=y.audio.bitrate;y.video&&x&&(y.video.bitrate-=x)}l.push(y)}if(o){const v=navigator.userAgent;if(o.split(",").some(y=>Ce(y))&&Je())return Promise.resolve(pi(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${v})`),l))}return Promise.all(l.map(v=>{const y=Ci(v);return s[y]||(s[y]=n.decodingInfo(v))})).then(v=>({supported:!v.some(y=>!y.supported),configurations:l,decodingInfoResults:v})).catch(v=>({supported:!1,configurations:l,decodingInfoResults:[],error:v}))}function an(h){var t;const n=(t=h.videoCodec)==null?void 0:t.split(","),s=gr(h),o=h.width||640,l=h.height||480,u=h.frameRate||30,d=h.videoRange.toLowerCase();return n?n.map(_=>{const g={contentType:K(ti(_),"video"),width:o,height:l,bitrate:s,framerate:u};return d!=="sdr"&&(g.transferFunction=d),g}):[]}function mn(h,t,n){var s;const o=(s=h.audioCodec)==null?void 0:s.split(","),l=gr(h);return o&&h.audioGroups?h.audioGroups.reduce((u,d)=>{var _;const g=d?(_=t.groups[d])==null?void 0:_.tracks:null;return g?g.reduce((v,y)=>{if(y.groupId===d){const x=parseFloat(y.channels||"");o.forEach(D=>{const C={contentType:K(D,"audio"),bitrate:n?nn(D,l):l};x&&(C.channels=""+x),v.push(C)})}return v},u):u},[]):[]}function nn(h,t){if(t<=1)return 1;let n=128e3;return h==="ec-3"?n=768e3:h==="ac-3"&&(n=64e4),Math.min(t/2,n)}function gr(h){return Math.ceil(Math.max(h.bitrate*.9,h.averageBitrate)/1e3)*1e3||1}function Ci(h){let t="";const{audio:n,video:s}=h;if(s){const o=ii(s.contentType);t+=`${o}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(n){const o=ii(n.contentType);t+=`${s?"_":""}${o}_c${n.channels}`}return t}const Ki=["NONE","TYPE-0","TYPE-1",null];function wn(h){return Ki.indexOf(h)>-1}const Mi=["SDR","PQ","HLG"];function In(h){return!!h&&Mi.indexOf(h)>-1}var fn={No:"",Yes:"YES",v2:"v2"};function sr(h){const{canSkipUntil:t,canSkipDateRanges:n,age:s}=h,o=s<t/2;return t&&o?n?fn.v2:fn.Yes:fn.No}class gn{constructor(t,n,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=n,this.skip=s}addDirectives(t){const n=new self.URL(t);return this.msn!==void 0&&n.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&n.searchParams.set("_HLS_part",this.part.toString()),this.skip&&n.searchParams.set("_HLS_skip",this.skip),n.href}}class Xn{constructor(t){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=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter(s=>!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in t){var n;this.supplemental=t.supplemental;const s=(n=t.supplemental)==null?void 0:n.videoCodec;s&&s!==t.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.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(t){return Ur(this._audioGroups,t)}hasSubtitleGroup(t){return Ur(this._subtitleGroups,t)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(t,n){if(n){if(t==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(n)===-1&&s.push(n)}else if(t==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(n)===-1&&s.push(n)}}}get urlId(){return 0}set urlId(t){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var t;return(t=this.audioGroups)==null?void 0:t[0]}get textGroupId(){var t;return(t=this.subtitleGroups)==null?void 0:t[0]}addFallback(){}}function Ur(h,t){return!t||!h?!1:h.indexOf(t)!==-1}function wi(){if(typeof matchMedia=="function"){const h=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(h.media!==t.media)return h.matches===!0}return!1}function ai(h,t){let n=!1,s=[];if(h&&(n=h!=="SDR",s=[h]),t){s=t.allowedVideoRanges||Mi.slice(0);const o=s.join("")!=="SDR"&&!t.videoCodec;n=t.preferHDR!==void 0?t.preferHDR:o&&wi(),n||(s=["SDR"])}return{preferHDR:n,allowedVideoRanges:s}}const Re=h=>{const t=new WeakSet;return(n,s)=>{if(h&&(s=h(n,s)),typeof s=="object"&&s!==null){if(t.has(s))return;t.add(s)}return s}},$e=(h,t)=>JSON.stringify(h,Re(t));function ht(h,t,n,s,o){const l=Object.keys(h),u=s==null?void 0:s.channels,d=s==null?void 0:s.audioCodec,_=o==null?void 0:o.videoCodec,g=u&&parseInt(u)===2;let v=!1,y=!1,x=1/0,D=1/0,C=1/0,F=1/0,B=0,J=[];const{preferHDR:ne,allowedVideoRanges:le}=ai(t,o);for(let Ye=l.length;Ye--;){const qe=h[l[Ye]];v||(v=qe.channels[2]>0),x=Math.min(x,qe.minHeight),D=Math.min(D,qe.minFramerate),C=Math.min(C,qe.minBitrate),le.filter(mt=>qe.videoRanges[mt]>0).length>0&&(y=!0)}x=ce(x)?x:0,D=ce(D)?D:0;const Ee=Math.max(1080,x),Ie=Math.max(30,D);C=ce(C)?C:n,n=Math.max(C,n),y||(t=void 0);const tt=l.length>1;return{codecSet:l.reduce((Ye,qe)=>{const Fe=h[qe];if(qe===Ye)return Ye;if(J=y?le.filter(mt=>Fe.videoRanges[mt]>0):[],tt){if(Fe.minBitrate>n)return et(qe,`min bitrate of ${Fe.minBitrate} > current estimate of ${n}`),Ye;if(!Fe.hasDefaultAudio)return et(qe,"no renditions with default or auto-select sound found"),Ye;if(d&&qe.indexOf(d.substring(0,4))%5!==0)return et(qe,`audio codec preference "${d}" not found`),Ye;if(u&&!g){if(!Fe.channels[u])return et(qe,`no renditions with ${u} channel sound found (channels options: ${Object.keys(Fe.channels)})`),Ye}else if((!d||g)&&v&&Fe.channels[2]===0)return et(qe,"no renditions with stereo sound found"),Ye;if(Fe.minHeight>Ee)return et(qe,`min resolution of ${Fe.minHeight} > maximum of ${Ee}`),Ye;if(Fe.minFramerate>Ie)return et(qe,`min framerate of ${Fe.minFramerate} > maximum of ${Ie}`),Ye;if(!J.some(mt=>Fe.videoRanges[mt]>0))return et(qe,`no variants with VIDEO-RANGE of ${$e(J)} found`),Ye;if(_&&qe.indexOf(_.substring(0,4))%5!==0)return et(qe,`video codec preference "${_}" not found`),Ye;if(Fe.maxScore<B)return et(qe,`max score of ${Fe.maxScore} < selected max of ${B}`),Ye}return Ye&&(ae(qe)>=ae(Ye)||Fe.fragmentError>h[Ye].fragmentError)?Ye:(F=Fe.minIndex,B=Fe.maxScore,qe)},void 0),videoRanges:J,preferHDR:ne,minFramerate:D,minBitrate:C,minIndex:F}}function et(h,t){se.log(`[abr] start candidates with "${h}" ignored because ${t}`)}function wt(h){return h.reduce((t,n)=>{let s=t.groups[n.groupId];s||(s=t.groups[n.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(n);const o=n.channels||"2";return s.channels[o]=(s.channels[o]||0)+1,s.hasDefault=s.hasDefault||n.default,s.hasAutoSelect=s.hasAutoSelect||n.autoselect,s.hasDefault&&(t.hasDefaultAudio=!0),s.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Ct(h,t,n,s){return h.slice(n,s+1).reduce((o,l,u)=>{if(!l.codecSet)return o;const d=l.audioGroups;let _=o[l.codecSet];_||(o[l.codecSet]=_={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:u,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!d,fragmentError:0}),_.minBitrate=Math.min(_.minBitrate,l.bitrate);const g=Math.min(l.height,l.width);return _.minHeight=Math.min(_.minHeight,g),_.minFramerate=Math.min(_.minFramerate,l.frameRate),_.minIndex=Math.min(_.minIndex,u),_.maxScore=Math.max(_.maxScore,l.score),_.fragmentError+=l.fragmentError,_.videoRanges[l.videoRange]=(_.videoRanges[l.videoRange]||0)+1,d&&d.forEach(v=>{if(!v)return;const y=t.groups[v];y&&(_.hasDefaultAudio=_.hasDefaultAudio||t.hasDefaultAudio?y.hasDefault:y.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(y.channels).forEach(x=>{_.channels[x]=(_.channels[x]||0)+y.channels[x]}))}),o},{})}function zt(h){if(!h)return h;const{lang:t,assocLang:n,characteristics:s,channels:o,audioCodec:l}=h;return{lang:t,assocLang:n,characteristics:s,channels:o,audioCodec:l}}function Wt(h,t,n){if("attrs"in h){const s=t.indexOf(h);if(s!==-1)return s}for(let s=0;s<t.length;s++){const o=t[s];if(Pi(h,o,n))return s}return-1}function Pi(h,t,n){const{groupId:s,name:o,lang:l,assocLang:u,default:d}=h,_=h.forced;return(s===void 0||t.groupId===s)&&(o===void 0||t.name===o)&&(l===void 0||ki(l,t.lang))&&(l===void 0||t.assocLang===u)&&(d===void 0||t.default===d)&&(_===void 0||t.forced===_)&&(!("characteristics"in h)||_n(h.characteristics||"",t.characteristics))&&(n===void 0||n(h,t))}function ki(h,t="--"){return h.length===t.length?h===t:h.startsWith(t)||t.startsWith(h)}function _n(h,t=""){const n=h.split(","),s=t.split(",");return n.length===s.length&&!n.some(o=>s.indexOf(o)===-1)}function oi(h,t){const{audioCodec:n,channels:s}=h;return(n===void 0||(t.audioCodec||"").substring(0,4)===n.substring(0,4))&&(s===void 0||s===(t.channels||"2"))}function Ri(h,t,n,s,o){const l=t[s],d=t.reduce((x,D,C)=>{const F=D.uri;return(x[F]||(x[F]=[])).push(C),x},{})[l.uri];d.length>1&&(s=Math.max.apply(Math,d));const _=l.videoRange,g=l.frameRate,v=l.codecSet.substring(0,4),y=Ai(t,s,x=>{if(x.videoRange!==_||x.frameRate!==g||x.codecSet.substring(0,4)!==v)return!1;const D=x.audioGroups,C=n.filter(F=>!D||D.indexOf(F.groupId)!==-1);return Wt(h,C,o)>-1});return y>-1?y:Ai(t,s,x=>{const D=x.audioGroups,C=n.filter(F=>!D||D.indexOf(F.groupId)!==-1);return Wt(h,C,o)>-1})}function Ai(h,t,n){for(let s=t;s>-1;s--)if(n(h[s]))return s;for(let s=t+1;s<h.length;s++)if(n(h[s]))return s;return-1}function Fi(h,t){var n;return!!h&&h!==((n=t.loadLevelObj)==null?void 0:n.uri)}class Vi extends H{constructor(t){super("abr",t.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=n=>{var s;const{fragCurrent:o,partCurrent:l,hls:u}=this,{autoLevelEnabled:d,media:_}=u;if(!o||!_)return;const g=performance.now(),v=l?l.stats:o.stats,y=l?l.duration:o.duration,x=g-v.loading.start,D=u.minAutoLevel,C=o.level,F=this._nextAutoLevel;if(v.aborted||v.loaded&&v.loaded===v.total||C<=D){this.clearTimer(),this._nextAutoLevel=-1;return}if(!d)return;const B=F>-1&&F!==C,J=!!n||B;if(!J&&(_.paused||!_.playbackRate||!_.readyState))return;const ne=u.mainForwardBufferInfo;if(!J&&ne===null)return;const le=this.bwEstimator.getEstimateTTFB(),Ee=Math.abs(_.playbackRate);if(x<=Math.max(le,1e3*(y/(Ee*2))))return;const Ie=ne?ne.len/Ee:0,tt=v.loading.first?v.loading.first-v.loading.start:-1,Pe=v.loaded&&tt>-1,Ye=this.getBwEstimate(),qe=u.levels,Fe=qe[C],mt=Math.max(v.loaded,Math.round(y*(o.bitrate||Fe.averageBitrate)/8));let Zt=Pe?x-tt:x;Zt<1&&Pe&&(Zt=Math.min(x,v.loaded*8/Ye));const ui=Pe?v.loaded*1e3/Zt:0,xi=le/1e3,si=ui?(mt-v.loaded)/ui:mt*8/Ye+xi;if(si<=Ie)return;const Vt=ui?ui*8:Ye,ci=((s=(n==null?void 0:n.details)||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,ei=this.hls.config.abrBandWidthUpFactor;let gi=Number.POSITIVE_INFINITY,zi;for(zi=C-1;zi>D;zi--){const Fn=qe[zi].maxBitrate,_i=!qe[zi].details||ci;if(gi=this.getTimeToLoadFrag(xi,Vt,y*Fn,_i),gi<Math.min(Ie,y+xi))break}if(gi>=si||gi>y*10)return;Pe?this.bwEstimator.sample(x-Math.min(le,tt),v.loaded):this.bwEstimator.sampleTTFB(x);const Ut=qe[zi].maxBitrate;this.getBwEstimate()*ei>Ut&&this.resetEstimator(Ut);const qt=this.findBestLevel(Ut,D,zi,0,Ie,1,1);qt>-1&&(zi=qt),this.warn(`Fragment ${o.sn}${l?" part "+l.index:""} of level ${C} is loading too slowly;
|
|
|
Fragment duration: ${o.duration.toFixed(3)}
|
|
|
Time to underbuffer: ${Ie.toFixed(3)} s
|
|
|
Estimated load time for current fragment: ${si.toFixed(3)} s
|
|
|
Estimated load time for down switch fragment: ${gi.toFixed(3)} s
|
|
|
TTFB estimate: ${tt|0} ms
|
|
|
Current BW estimate: ${ce(Ye)?Ye|0:"Unknown"} bps
|
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
|
Switching to level ${zi} @ ${Ut|0} bps`),u.nextLoadLevel=u.nextAutoLevel=zi,this.clearTimer();const Zi=()=>{if(this.clearTimer(),this.fragCurrent===o&&this.hls.loadLevel===zi&&zi>0){const Fn=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${zi>0?"and switching down":""}
|
|
|
Fragment duration: ${o.duration.toFixed(3)} s
|
|
|
Time to underbuffer: ${Fn.toFixed(3)} s`),o.abortRequests(),this.fragCurrent=this.partCurrent=null,zi>D){let _i=this.findBestLevel(this.hls.levels[D].bitrate,D,zi,0,Fn,1,1);_i===-1&&(_i=D),this.hls.nextLoadLevel=this.hls.nextAutoLevel=_i,this.resetEstimator(this.hls.levels[_i].bitrate)}}};B||si>gi*2?Zi():this.timer=self.setInterval(Zi,gi*1e3),u.trigger(S.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:l,stats:v})},this.hls=t,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(t){t&&(this.log(`setting initial bwe to ${t}`),this.hls.config.abrEwmaDefaultEstimate=t),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const t=this.hls.config;return new re(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate)}registerListeners(){const{hls:t}=this;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.FRAG_LOADING,this.onFragLoading,this),t.on(S.FRAG_LOADED,this.onFragLoaded,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this),t.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.FRAG_LOADING,this.onFragLoading,this),t.off(S.FRAG_LOADED,this.onFragLoaded,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this),t.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.off(S.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(t,n){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(t,n){const s=n.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var o;this.fragCurrent=s,this.partCurrent=(o=n.part)!=null?o:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(t,n){this.clearTimer()}onError(t,n){if(!n.fatal)switch(n.details){case q.BUFFER_ADD_CODEC_ERROR:case q.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case q.FRAG_LOAD_TIMEOUT:{const s=n.frag,{fragCurrent:o,partCurrent:l}=this;if(s&&o&&s.sn===o.sn&&s.level===o.level){const u=performance.now(),d=l?l.stats:s.stats,_=u-d.loading.start,g=d.loading.first?d.loading.first-d.loading.start:-1;if(d.loaded&&g>-1){const y=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(_-Math.min(y,g),d.loaded)}else this.bwEstimator.sampleTTFB(_)}break}}}getTimeToLoadFrag(t,n,s,o){const l=t+s/n,u=o?t+this.lastLevelLoadSec:0;return l+u}onLevelLoaded(t,n){const s=this.hls.config,{loading:o}=n.stats,l=o.end-o.first;ce(l)&&(this.lastLevelLoadSec=l/1e3),n.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(n.levelInfo)}onFragLoaded(t,{frag:n,part:s}){const o=s?s.stats:n.stats;if(n.type===P.MAIN&&this.bwEstimator.sampleTTFB(o.loading.first-o.loading.start),!this.ignoreFragment(n)){if(this.clearTimer(),n.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const l=s?s.duration:n.duration,u=this.hls.levels[n.level],d=(u.loaded?u.loaded.bytes:0)+o.loaded,_=(u.loaded?u.loaded.duration:0)+l;u.loaded={bytes:d,duration:_},u.realBitrate=Math.round(8*d/_)}if(n.bitrateTest){const l={stats:o,frag:n,part:s,id:n.type};this.onFragBuffered(S.FRAG_BUFFERED,l),n.bitrateTest=!1}else this.lastLoadedFragLevel=n.level}}onFragBuffered(t,n){const{frag:s,part:o}=n,l=o!=null&&o.stats.loaded?o.stats:s.stats;if(l.aborted||this.ignoreFragment(s))return;const u=l.parsing.end-l.loading.start-Math.min(l.loading.first-l.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(u,l.loaded),l.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=u/1e3:this.bitrateTestDelay=0}ignoreFragment(t){return t.type!==P.MAIN||t.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:t,minAutoLevel:n}=this.hls,s=this.getBwEstimate(),o=this.hls.config.maxStarvationDelay,l=this.findBestLevel(s,n,t,0,o,1,1);if(l>-1)return l;const u=this.hls.firstLevel,d=Math.min(Math.max(u,n),t);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${u} clamped to ${d}`),d}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const t=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),o=this.lastLoadedFragLevel>-1;if(t!==-1&&(!s||!o||this.nextAutoLevelKey===this.getAutoLevelKey()))return t;const l=s&&o?this.getNextABRAutoLevel():this.firstAutoLevel;if(t!==-1){const u=this.hls.levels;if(u.length>Math.max(t,l)&&u[t].loadError<=u[l].loadError)return t}return this._nextAutoLevel=l,this.nextAutoLevelKey=this.getAutoLevelKey(),l}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:t,partCurrent:n,hls:s}=this;if(s.levels.length<=1)return s.loadLevel;const{maxAutoLevel:o,config:l,minAutoLevel:u}=s,d=n?n.duration:t?t.duration:0,_=this.getBwEstimate(),g=this.getStarvationDelay();let v=l.abrBandWidthFactor,y=l.abrBandWidthUpFactor;if(g){const B=this.findBestLevel(_,u,o,g,0,v,y);if(B>=0)return this.rebufferNotice=-1,B}let x=d?Math.min(d,l.maxStarvationDelay):l.maxStarvationDelay;if(!g){const B=this.bitrateTestDelay;B&&(x=(d?Math.min(d,l.maxLoadingDelay):l.maxLoadingDelay)-B,this.info(`bitrate test took ${Math.round(1e3*B)}ms, set first fragment max fetchDuration to ${Math.round(1e3*x)} ms`),v=y=1)}const D=this.findBestLevel(_,u,o,g,x,v,y);if(this.rebufferNotice!==D&&(this.rebufferNotice=D,this.info(`${g?"rebuffering expected":"buffer is empty"}, optimal quality level ${D}`)),D>-1)return D;const C=s.levels[u],F=s.loadLevelObj;return F&&(C==null?void 0:C.bitrate)<F.bitrate?u:s.loadLevel}getStarvationDelay(){const t=this.hls,n=t.media;if(!n)return 1/0;const s=n&&n.playbackRate!==0?Math.abs(n.playbackRate):1,o=t.mainForwardBufferInfo;return(o?o.len:0)/s}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(t,n,s,o,l,u,d){var _;const g=o+l,v=this.lastLoadedFragLevel,y=v===-1?this.hls.firstLevel:v,{fragCurrent:x,partCurrent:D}=this,{levels:C,allAudioTracks:F,loadLevel:B,config:J}=this.hls;if(C.length===1)return 0;const ne=C[y],le=!!((_=this.hls.latestLevelDetails)!=null&&_.live),Ee=B===-1||v===-1;let Ie,tt="SDR",Pe=(ne==null?void 0:ne.frameRate)||0;const{audioPreference:Ye,videoPreference:qe}=J,Fe=this.audioTracksByGroup||(this.audioTracksByGroup=wt(F));let mt=-1;if(Ee){if(this.firstSelection!==-1)return this.firstSelection;const Vt=this.codecTiers||(this.codecTiers=Ct(C,Fe,n,s)),ci=ht(Vt,tt,t,Ye,qe),{codecSet:ei,videoRanges:gi,minFramerate:zi,minBitrate:Ut,minIndex:qt,preferHDR:Zi}=ci;mt=qt,Ie=ei,tt=Zi?gi[gi.length-1]:gi[0],Pe=zi,t=Math.max(t,Ut),this.log(`picked start tier ${$e(ci)}`)}else Ie=ne==null?void 0:ne.codecSet,tt=ne==null?void 0:ne.videoRange;const Zt=D?D.duration:x?x.duration:0,ui=this.bwEstimator.getEstimateTTFB()/1e3,xi=[];for(let Vt=s;Vt>=n;Vt--){var si;const ci=C[Vt],ei=Vt>y;if(!ci)continue;if(J.useMediaCapabilities&&!ci.supportedResult&&!ci.supportedPromise){const _i=navigator.mediaCapabilities;typeof(_i==null?void 0:_i.decodingInfo)=="function"&&mi(ci,Fe,tt,Pe,t,Ye)?(ci.supportedPromise=Xi(ci,Fe,_i,this.supportedCache),ci.supportedPromise.then(xn=>{if(!this.hls)return;ci.supportedResult=xn;const qr=this.hls.levels,mr=qr.indexOf(ci);xn.error?this.warn(`MediaCapabilities decodingInfo error: "${xn.error}" for level ${mr} ${$e(xn)}`):xn.supported?xn.decodingInfoResults.some(os=>os.smooth===!1||os.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${mr} not smooth or powerEfficient: ${$e(xn)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${mr} ${$e(xn)}`),mr>-1&&qr.length>1&&(this.log(`Removing unsupported level ${mr}`),this.hls.removeLevel(mr),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(xn=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${xn}`)})):ci.supportedResult=$i}if((Ie&&ci.codecSet!==Ie||tt&&ci.videoRange!==tt||ei&&Pe>ci.frameRate||!ei&&Pe>0&&Pe<ci.frameRate||(si=ci.supportedResult)!=null&&(si=si.decodingInfoResults)!=null&&si.some(_i=>_i.smooth===!1))&&(!Ee||Vt!==mt)){xi.push(Vt);continue}const gi=ci.details,zi=(D?gi==null?void 0:gi.partTarget:gi==null?void 0:gi.averagetargetduration)||Zt;let Ut;ei?Ut=d*t:Ut=u*t;const qt=Zt&&o>=Zt*2&&l===0?ci.averageBitrate:ci.maxBitrate,Zi=this.getTimeToLoadFrag(ui,Ut,qt*zi,gi===void 0);if(Ut>=qt&&(Vt===v||ci.loadError===0&&ci.fragmentError===0)&&(Zi<=ui||!ce(Zi)||le&&!this.bitrateTestDelay||Zi<g)){const _i=this.forcedAutoLevel;return Vt!==B&&(_i===-1||_i!==B)&&(xi.length&&this.trace(`Skipped level(s) ${xi.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${C[xi[0]].codecs}" ${C[xi[0]].videoRange}; not compatible with "${Ie}" ${tt}`),this.info(`switch candidate:${y}->${Vt} adjustedbw(${Math.round(Ut)})-bitrate=${Math.round(Ut-qt)} ttfb:${ui.toFixed(1)} avgDuration:${zi.toFixed(1)} maxFetchDuration:${g.toFixed(1)} fetchDuration:${Zi.toFixed(1)} firstSelection:${Ee} codecSet:${ci.codecSet} videoRange:${ci.videoRange} hls.loadLevel:${B}`)),Ee&&(this.firstSelection=Vt),Vt}}return-1}set nextAutoLevel(t){const n=this.deriveNextAutoLevel(t);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}deriveNextAutoLevel(t){const{maxAutoLevel:n,minAutoLevel:s}=this.hls;return Math.min(Math.max(t,s),n)}}const yi={search:function(h,t){let n=0,s=h.length-1,o=null,l=null;for(;n<=s;){o=(n+s)/2|0,l=h[o];const u=t(l);if(u>0)n=o+1;else if(u<0)s=o-1;else return l}return null}};function Ii(h,t,n){if(t===null||!Array.isArray(h)||!h.length||!ce(t))return null;const s=h[0].programDateTime;if(t<(s||0))return null;const o=h[h.length-1].endProgramDateTime;if(t>=(o||0))return null;for(let l=0;l<h.length;++l){const u=h[l];if(Ji(t,n,u))return u}return null}function Wi(h,t,n=0,s=0,o=.005){let l=null;if(h){l=t[1+h.sn-t[0].sn]||null;const d=h.endDTS-n;d>0&&d<15e-7&&(n+=15e-7),l&&h.level!==l.level&&l.end<=h.end&&(l=t[2+h.sn-t[0].sn]||null)}else n===0&&t[0].start===0&&(l=t[0]);if(l&&((!h||h.level===l.level)&&bi(n,s,l)===0||Bi(l,h,Math.min(o,s))))return l;const u=yi.search(t,bi.bind(null,n,s));return u&&(u!==h||!l)?u:l}function Bi(h,t,n){if(t&&t.start===0&&t.level<h.level&&(t.endPTS||0)>0){const s=t.tagList.reduce((o,l)=>(l[0]==="INF"&&(o+=parseFloat(l[1])),o),n);return h.start<=s}return!1}function bi(h=0,t=0,n){if(n.start<=h&&n.start+n.duration>h)return 0;const s=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-s<=h?1:n.start-s>h&&n.start?-1:0}function Ji(h,t,n){const s=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-s>h}function Gi(h,t,n){if(h&&h.startCC<=t&&h.endCC>=t){let s=h.fragments;const{fragmentHint:o}=h;o&&(s=s.concat(o));let l;return yi.search(s,u=>u.cc<t?1:u.cc>t?-1:(l=u,u.end<=n?1:u.start>n?-1:0)),l||null}return null}function Yi(h){switch(h.details){case q.FRAG_LOAD_TIMEOUT:case q.KEY_LOAD_TIMEOUT:case q.LEVEL_LOAD_TIMEOUT:case q.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Rn(h){return h.details.startsWith("key")}function on(h){return Rn(h)&&!!h.frag&&!h.frag.decryptdata}function Jn(h,t){const n=Yi(t);return h.default[`${n?"timeout":"error"}Retry`]}function vn(h,t){const n=h.backoff==="linear"?1:Math.pow(2,t);return Math.min(n*h.retryDelayMs,h.maxRetryDelayMs)}function Tn(h){return M(M({},h),{errorRetry:null,timeoutRetry:null})}function Wn(h,t,n,s){if(!h)return!1;const o=s==null?void 0:s.code,l=t<h.maxNumRetry&&(Pn(o)||!!n);return h.shouldRetry?h.shouldRetry(h,t,n,s,l):l}function Pn(h){return dn(h)||!!h&&(h<400||h>499)}function dn(h){return h===0&&navigator.onLine===!1}var Ui={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Qi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class br extends H{constructor(t){super("error-controller",t.logger),this.hls=void 0,this.playlistError=0,this.hls=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on(S.ERROR,this.onError,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const t=this.hls;t&&(t.off(S.ERROR,this.onError,this),t.off(S.ERROR,this.onErrorOut,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(t){}stopLoad(){this.playlistError=0}getVariantLevelIndex(t){return(t==null?void 0:t.type)===P.MAIN?t.level:this.getVariantIndex()}getVariantIndex(){var t;const n=this.hls,s=n.currentLevel;return(t=n.loadLevelObj)!=null&&t.details||s===-1?n.loadLevel:s}variantHasKey(t,n){if(t){var s;if((s=t.details)!=null&&s.hasKey(n))return!0;const o=t.audioGroups;if(o)return this.hls.allAudioTracks.filter(u=>o.indexOf(u.groupId)>=0).some(u=>{var d;return(d=u.details)==null?void 0:d.hasKey(n)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(t,n){var s;if(n.fatal)return;const o=this.hls,l=n.context;switch(n.details){case q.FRAG_LOAD_ERROR:case q.FRAG_LOAD_TIMEOUT:case q.KEY_LOAD_ERROR:case q.KEY_LOAD_TIMEOUT:n.errorAction=this.getFragRetryOrSwitchAction(n);return;case q.FRAG_PARSING_ERROR:if((s=n.frag)!=null&&s.gap){n.errorAction=ln();return}case q.FRAG_GAP:case q.FRAG_DECRYPT_ERROR:{n.errorAction=this.getFragRetryOrSwitchAction(n),n.errorAction.action=Ui.SendAlternateToPenaltyBox;return}case q.LEVEL_EMPTY_ERROR:case q.LEVEL_PARSING_ERROR:{var u;const _=n.parent===P.MAIN?n.level:o.loadLevel;n.details===q.LEVEL_EMPTY_ERROR&&((u=n.context)!=null&&(u=u.levelDetails)!=null&&u.live)?n.errorAction=this.getPlaylistRetryOrSwitchAction(n,_):(n.levelRetry=!1,n.errorAction=this.getLevelSwitchAction(n,_))}return;case q.LEVEL_LOAD_ERROR:case q.LEVEL_LOAD_TIMEOUT:typeof(l==null?void 0:l.level)=="number"&&(n.errorAction=this.getPlaylistRetryOrSwitchAction(n,l.level));return;case q.AUDIO_TRACK_LOAD_ERROR:case q.AUDIO_TRACK_LOAD_TIMEOUT:case q.SUBTITLE_LOAD_ERROR:case q.SUBTITLE_TRACK_LOAD_TIMEOUT:if(l){const _=o.loadLevelObj;if(_&&(l.type===Te.AUDIO_TRACK&&_.hasAudioGroup(l.groupId)||l.type===Te.SUBTITLE_TRACK&&_.hasSubtitleGroup(l.groupId))){n.errorAction=this.getPlaylistRetryOrSwitchAction(n,o.loadLevel),n.errorAction.action=Ui.SendAlternateToPenaltyBox,n.errorAction.flags=Qi.MoveAllAlternatesMatchingHost;return}}return;case q.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:n.errorAction={action:Ui.SendAlternateToPenaltyBox,flags:Qi.MoveAllAlternatesMatchingHDCP};return;case q.KEY_SYSTEM_SESSION_UPDATE_FAILED:case q.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case q.KEY_SYSTEM_NO_SESSION:n.errorAction={action:Ui.SendAlternateToPenaltyBox,flags:Qi.MoveAllAlternatesMatchingKey};return;case q.BUFFER_ADD_CODEC_ERROR:case q.REMUX_ALLOC_ERROR:case q.BUFFER_APPEND_ERROR:if(!n.errorAction){var d;n.errorAction=this.getLevelSwitchAction(n,(d=n.level)!=null?d:o.loadLevel)}return;case q.INTERNAL_EXCEPTION:case q.BUFFER_APPENDING_ERROR:case q.BUFFER_FULL_ERROR:case q.LEVEL_SWITCH_ERROR:case q.BUFFER_STALLED_ERROR:case q.BUFFER_SEEK_OVER_HOLE:case q.BUFFER_NUDGE_ON_STALL:n.errorAction=ln();return}n.type===ge.KEY_SYSTEM_ERROR&&(n.levelRetry=!1,n.errorAction=ln())}getPlaylistRetryOrSwitchAction(t,n){const s=this.hls,o=Jn(s.config.playlistLoadPolicy,t),l=this.playlistError++;if(Wn(o,l,Yi(t),t.response))return{action:Ui.RetryRequest,flags:Qi.None,retryConfig:o,retryCount:l};const d=this.getLevelSwitchAction(t,n);return o&&(d.retryConfig=o,d.retryCount=l),d}getFragRetryOrSwitchAction(t){const n=this.hls,s=this.getVariantLevelIndex(t.frag),o=n.levels[s],{fragLoadPolicy:l,keyLoadPolicy:u}=n.config,d=Jn(Rn(t)?u:l,t),_=n.levels.reduce((v,y)=>v+y.fragmentError,0);if(o&&(t.details!==q.FRAG_GAP&&o.fragmentError++,!on(t)&&Wn(d,_,Yi(t),t.response)))return{action:Ui.RetryRequest,flags:Qi.None,retryConfig:d,retryCount:_};const g=this.getLevelSwitchAction(t,s);return d&&(g.retryConfig=d,g.retryCount=_),g}getLevelSwitchAction(t,n){const s=this.hls;n==null&&(n=s.loadLevel);const o=this.hls.levels[n];if(o){var l,u;const g=t.details;o.loadError++,g===q.BUFFER_APPEND_ERROR&&o.fragmentError++;let v=-1;const{levels:y,loadLevel:x,minAutoLevel:D,maxAutoLevel:C}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const F=(l=t.frag)==null?void 0:l.type,J=(F===P.AUDIO&&g===q.FRAG_PARSING_ERROR||t.sourceBufferName==="audio"&&(g===q.BUFFER_ADD_CODEC_ERROR||g===q.BUFFER_APPEND_ERROR))&&y.some(({audioCodec:tt})=>o.audioCodec!==tt),le=t.sourceBufferName==="video"&&(g===q.BUFFER_ADD_CODEC_ERROR||g===q.BUFFER_APPEND_ERROR)&&y.some(({codecSet:tt,audioCodec:Pe})=>o.codecSet!==tt&&o.audioCodec===Pe),{type:Ee,groupId:Ie}=(u=t.context)!=null?u:{};for(let tt=y.length;tt--;){const Pe=(tt+x)%y.length;if(Pe!==x&&Pe>=D&&Pe<=C&&y[Pe].loadError===0){var d,_;const Ye=y[Pe];if(g===q.FRAG_GAP&&F===P.MAIN&&t.frag){const qe=y[Pe].details;if(qe){const Fe=Wi(t.frag,qe.fragments,t.frag.start);if(Fe!=null&&Fe.gap)continue}}else{if(Ee===Te.AUDIO_TRACK&&Ye.hasAudioGroup(Ie)||Ee===Te.SUBTITLE_TRACK&&Ye.hasSubtitleGroup(Ie))continue;if(F===P.AUDIO&&(d=o.audioGroups)!=null&&d.some(qe=>Ye.hasAudioGroup(qe))||F===P.SUBTITLE&&(_=o.subtitleGroups)!=null&&_.some(qe=>Ye.hasSubtitleGroup(qe))||J&&o.audioCodec===Ye.audioCodec||le&&o.codecSet===Ye.codecSet||!J&&o.codecSet!==Ye.codecSet)continue}v=Pe;break}}if(v>-1&&s.loadLevel!==v)return t.levelRetry=!0,this.playlistError=0,{action:Ui.SendAlternateToPenaltyBox,flags:Qi.None,nextAutoLevel:v}}return{action:Ui.SendAlternateToPenaltyBox,flags:Qi.MoveAllAlternatesMatchingHost}}onErrorOut(t,n){var s;switch((s=n.errorAction)==null?void 0:s.action){case Ui.DoNothing:break;case Ui.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(n),!n.errorAction.resolved&&n.details!==q.FRAG_GAP?n.fatal=!0:/MediaSource readyState: ended/.test(n.error.message)&&(this.warn(`MediaSource ended after "${n.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case Ui.RetryRequest:break}if(n.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(t){const n=this.hls,s=t.errorAction;if(!s)return;const{flags:o}=s,l=s.nextAutoLevel;switch(o){case Qi.None:this.switchLevel(t,l);break;case Qi.MoveAllAlternatesMatchingHDCP:{const _=this.getVariantLevelIndex(t.frag),g=n.levels[_],v=g==null?void 0:g.attrs["HDCP-LEVEL"];if(s.hdcpLevel=v,v==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(v){n.maxHdcpLevel=Ki[Ki.indexOf(v)-1],s.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${n.maxHdcpLevel}" or lower`);break}}case Qi.MoveAllAlternatesMatchingKey:{const _=t.decryptdata;if(_){const g=this.hls.levels,v=g.length;for(let x=v;x--;)if(this.variantHasKey(g[x],_)){var u,d;this.log(`Banned key found in level ${x} (${g[x].bitrate}bps) or audio group "${(u=g[x].audioGroups)==null?void 0:u.join(",")}" (${(d=t.frag)==null?void 0:d.type} fragment) ${te(_.keyId||[])}`),g[x].fragmentError++,g[x].loadError++,this.log(`Removing level ${x} with key error (${t.error})`),this.hls.removeLevel(x)}const y=t.frag;if(this.hls.levels.length<v)s.resolved=!0;else if(y&&y.type!==P.MAIN){const x=y.decryptdata;x&&!_.matches(x)&&(s.resolved=!0)}}break}}s.resolved||this.switchLevel(t,l)}switchLevel(t,n){if(n!==void 0&&t.errorAction&&(this.warn(`switching to level ${n} after ${t.details}`),this.hls.nextAutoLevel=n,t.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,t.details===q.BUFFER_ADD_CODEC_ERROR&&t.mimeType&&t.sourceBufferName!=="audiovideo")){const s=ii(t.mimeType),o=this.hls.levels;for(let l=o.length;l--;)o[l][`${t.sourceBufferName}Codec`]===s&&(this.log(`Removing level ${l} for ${t.details} ("${s}" not supported)`),this.hls.removeLevel(l))}}}function ln(h){const t={action:Ui.DoNothing,flags:Qi.None};return h&&(t.resolved=!0),t}var Oi={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class or{constructor(t){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=t,this._registerListeners()}_registerListeners(){const{hls:t}=this;t&&(t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.BUFFER_APPENDED,this.onBufferAppended,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this),t.on(S.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.BUFFER_APPENDED,this.onBufferAppended,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this),t.off(S.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(t,n){const s=this.activePartLists[n];if(s)for(let o=s.length;o--;){const l=s[o];if(!l)break;if(l.start<=t&&t<=l.end&&l.loaded)return l}return this.getBufferedFrag(t,n)}getBufferedFrag(t,n){return this.getFragAtPos(t,n,!0)}getFragAtPos(t,n,s){const{fragments:o}=this,l=Object.keys(o);for(let u=l.length;u--;){const d=o[l[u]];if((d==null?void 0:d.body.type)===n&&(!s||d.buffered)){const _=d.body;if(_.start<=t&&t<=_.end)return _}}return null}detectEvictedFragments(t,n,s,o,l){this.timeRanges&&(this.timeRanges[t]=n);const u=(o==null?void 0:o.fragment.sn)||-1;Object.keys(this.fragments).forEach(d=>{const _=this.fragments[d];if(!_||u>=_.body.sn)return;if(!_.buffered&&(!_.loaded||l)){_.body.type===s&&this.removeFragment(_.body);return}const g=_.range[t];if(g){if(g.time.length===0){this.removeFragment(_.body);return}g.time.some(v=>{const y=!this.isTimeBuffered(v.startPTS,v.endPTS,n);return y&&this.removeFragment(_.body),y})}})}detectPartialFragments(t){const n=this.timeRanges;if(!n||t.frag.sn==="initSegment")return;const s=t.frag,o=Un(s),l=this.fragments[o];if(!l||l.buffered&&s.gap)return;const u=!s.relurl;Object.keys(n).forEach(d=>{const _=s.elementaryStreams[d];if(!_)return;const g=n[d],v=u||_.partial===!0;l.range[d]=this.getBufferedTimes(s,t.part,v,g)}),l.loaded=null,Object.keys(l.range).length?(l.buffered=!0,(l.body.endList=s.endList||l.body.endList)&&(this.endListFragments[l.body.type]=l),xr(l)||this.removeParts(s.sn-1,s.type)):this.removeFragment(l.body)}removeParts(t,n){const s=this.activePartLists[n];s&&(this.activePartLists[n]=Lr(s,o=>o.fragment.sn>=t))}fragBuffered(t,n){const s=Un(t);let o=this.fragments[s];!o&&n&&(o=this.fragments[s]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),o&&(o.loaded=null,o.buffered=!0)}getBufferedTimes(t,n,s,o){const l={time:[],partial:s},u=t.start,d=t.end,_=t.minEndPTS||d,g=t.maxStartPTS||u;for(let v=0;v<o.length;v++){const y=o.start(v)-this.bufferPadding,x=o.end(v)+this.bufferPadding;if(g>=y&&_<=x){l.time.push({startPTS:Math.max(u,o.start(v)),endPTS:Math.min(d,o.end(v))});break}else if(u<x&&d>y){const D=Math.max(u,o.start(v)),C=Math.min(d,o.end(v));C>D&&(l.partial=!0,l.time.push({startPTS:D,endPTS:C}))}else if(d<=y)break}return l}getPartialFragment(t){let n=null,s,o,l,u=0;const{bufferPadding:d,fragments:_}=this;return Object.keys(_).forEach(g=>{const v=_[g];v&&xr(v)&&(o=v.body.start-d,l=v.body.end+d,t>=o&&t<=l&&(s=Math.min(t-o,l-t),u<=s&&(n=v.body,u=s)))}),n}isEndListAppended(t){const n=this.endListFragments[t];return n!==void 0&&(n.buffered||xr(n))}getState(t){const n=Un(t),s=this.fragments[n];return s?s.buffered?xr(s)?Oi.PARTIAL:Oi.OK:Oi.APPENDING:Oi.NOT_LOADED}isTimeBuffered(t,n,s){let o,l;for(let u=0;u<s.length;u++){if(o=s.start(u)-this.bufferPadding,l=s.end(u)+this.bufferPadding,t>=o&&n<=l)return!0;if(n<=o)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(t,n){if(n.frag.sn==="initSegment"||n.frag.bitrateTest)return;const s=n.frag,o=n.part?null:n,l=Un(s);this.fragments[l]={body:s,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}onBufferAppended(t,n){const{frag:s,part:o,timeRanges:l,type:u}=n;if(s.sn==="initSegment")return;const d=s.type;if(o){let g=this.activePartLists[d];g||(this.activePartLists[d]=g=[]),g.push(o)}this.timeRanges=l;const _=l[u];this.detectEvictedFragments(u,_,d,o)}onFragBuffered(t,n){this.detectPartialFragments(n)}hasFragment(t){const n=Un(t);return!!this.fragments[n]}hasFragments(t){const{fragments:n}=this,s=Object.keys(n);if(!t)return s.length>0;for(let o=s.length;o--;){const l=n[s[o]];if((l==null?void 0:l.body.type)===t)return!0}return!1}hasParts(t){var n;return!!((n=this.activePartLists[t])!=null&&n.length)}removeFragmentsInRange(t,n,s,o,l){o&&!this.hasGaps||Object.keys(this.fragments).forEach(u=>{const d=this.fragments[u];if(!d)return;const _=d.body;_.type!==s||o&&!_.gap||_.start<n&&_.end>t&&(d.buffered||l)&&this.removeFragment(_)})}removeFragment(t){const n=Un(t);t.clearElementaryStreamInfo();const s=this.activePartLists[t.type];if(s){const o=t.sn;this.activePartLists[t.type]=Lr(s,l=>l.fragment.sn!==o)}delete this.fragments[n],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){var t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const n=(t=this.hls)==null||(t=t.latestLevelDetails)==null?void 0:t.partList;n&&n.forEach(s=>s.clearElementaryStreamInfo())}}function xr(h){var t,n,s;return h.buffered&&!!(h.body.gap||(t=h.range.video)!=null&&t.partial||(n=h.range.audio)!=null&&n.partial||(s=h.range.audiovideo)!=null&&s.partial)}function Un(h){return`${h.type}_${h.level}_${h.sn}`}function Lr(h,t){return h.filter(n=>{const s=t(n);return s||n.clearElementaryStreamInfo(),s})}var rn={cbc:0,ctr:1};class er{constructor(t,n,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=t,this.aesIV=n,this.aesMode=s}decrypt(t,n){switch(this.aesMode){case rn.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},n,t);case rn.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},n,t);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function Dr(h){const t=h.byteLength,n=t&&new DataView(h.buffer).getUint8(t-1);return n?h.slice(0,t-n):h}class kr{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_(t){const n=new DataView(t),s=new Uint32Array(4);for(let o=0;o<4;o++)s[o]=n.getUint32(o*4);return s}initTable(){const t=this.sBox,n=this.invSBox,s=this.subMix,o=s[0],l=s[1],u=s[2],d=s[3],_=this.invSubMix,g=_[0],v=_[1],y=_[2],x=_[3],D=new Uint32Array(256);let C=0,F=0,B=0;for(B=0;B<256;B++)B<128?D[B]=B<<1:D[B]=B<<1^283;for(B=0;B<256;B++){let J=F^F<<1^F<<2^F<<3^F<<4;J=J>>>8^J&255^99,t[C]=J,n[J]=C;const ne=D[C],le=D[ne],Ee=D[le];let Ie=D[J]*257^J*16843008;o[C]=Ie<<24|Ie>>>8,l[C]=Ie<<16|Ie>>>16,u[C]=Ie<<8|Ie>>>24,d[C]=Ie,Ie=Ee*16843009^le*65537^ne*257^C*16843008,g[J]=Ie<<24|Ie>>>8,v[J]=Ie<<16|Ie>>>16,y[J]=Ie<<8|Ie>>>24,x[J]=Ie,C?(C=ne^D[D[D[Ee^ne]]],F^=D[D[F]]):C=F=1}}expandKey(t){const n=this.uint8ArrayToUint32Array_(t);let s=!0,o=0;for(;o<n.length&&s;)s=n[o]===this.key[o],o++;if(s)return;this.key=n;const l=this.keySize=n.length;if(l!==4&&l!==6&&l!==8)throw new Error("Invalid aes key size="+l);const u=this.ksRows=(l+6+1)*4;let d,_;const g=this.keySchedule=new Uint32Array(u),v=this.invKeySchedule=new Uint32Array(u),y=this.sBox,x=this.rcon,D=this.invSubMix,C=D[0],F=D[1],B=D[2],J=D[3];let ne,le;for(d=0;d<u;d++){if(d<l){ne=g[d]=n[d];continue}le=ne,d%l===0?(le=le<<8|le>>>24,le=y[le>>>24]<<24|y[le>>>16&255]<<16|y[le>>>8&255]<<8|y[le&255],le^=x[d/l|0]<<24):l>6&&d%l===4&&(le=y[le>>>24]<<24|y[le>>>16&255]<<16|y[le>>>8&255]<<8|y[le&255]),g[d]=ne=(g[d-l]^le)>>>0}for(_=0;_<u;_++)d=u-_,_&3?le=g[d]:le=g[d-4],_<4||d<=4?v[_]=le:v[_]=C[y[le>>>24]]^F[y[le>>>16&255]]^B[y[le>>>8&255]]^J[y[le&255]],v[_]=v[_]>>>0}networkToHostOrderSwap(t){return t<<24|(t&65280)<<8|(t&16711680)>>8|t>>>24}decrypt(t,n,s){const o=this.keySize+6,l=this.invKeySchedule,u=this.invSBox,d=this.invSubMix,_=d[0],g=d[1],v=d[2],y=d[3],x=this.uint8ArrayToUint32Array_(s);let D=x[0],C=x[1],F=x[2],B=x[3];const J=new Int32Array(t),ne=new Int32Array(J.length);let le,Ee,Ie,tt,Pe,Ye,qe,Fe,mt,Zt,ui,xi,si,Vt;const ci=this.networkToHostOrderSwap;for(;n<J.length;){for(mt=ci(J[n]),Zt=ci(J[n+1]),ui=ci(J[n+2]),xi=ci(J[n+3]),Pe=mt^l[0],Ye=xi^l[1],qe=ui^l[2],Fe=Zt^l[3],si=4,Vt=1;Vt<o;Vt++)le=_[Pe>>>24]^g[Ye>>16&255]^v[qe>>8&255]^y[Fe&255]^l[si],Ee=_[Ye>>>24]^g[qe>>16&255]^v[Fe>>8&255]^y[Pe&255]^l[si+1],Ie=_[qe>>>24]^g[Fe>>16&255]^v[Pe>>8&255]^y[Ye&255]^l[si+2],tt=_[Fe>>>24]^g[Pe>>16&255]^v[Ye>>8&255]^y[qe&255]^l[si+3],Pe=le,Ye=Ee,qe=Ie,Fe=tt,si=si+4;le=u[Pe>>>24]<<24^u[Ye>>16&255]<<16^u[qe>>8&255]<<8^u[Fe&255]^l[si],Ee=u[Ye>>>24]<<24^u[qe>>16&255]<<16^u[Fe>>8&255]<<8^u[Pe&255]^l[si+1],Ie=u[qe>>>24]<<24^u[Fe>>16&255]<<16^u[Pe>>8&255]<<8^u[Ye&255]^l[si+2],tt=u[Fe>>>24]<<24^u[Pe>>16&255]<<16^u[Ye>>8&255]<<8^u[qe&255]^l[si+3],ne[n]=ci(le^D),ne[n+1]=ci(tt^C),ne[n+2]=ci(Ie^F),ne[n+3]=ci(Ee^B),D=mt,C=Zt,F=ui,B=xi,n=n+4}return ne.buffer}}class wr{constructor(t,n,s){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=t,this.key=n,this.aesMode=s}expandKey(){const t=Nn(this.aesMode);return this.subtle.importKey("raw",this.key,{name:t},!1,["encrypt","decrypt"])}}function Nn(h){switch(h){case rn.cbc:return"AES-CBC";case rn.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${h}`)}}const lr=16;class ur{constructor(t,{removePKCS7Padding:n=!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=t.enableSoftwareAES,this.removePKCS7Padding=n,n)try{const s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(s){}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:t,remainderData:n}=this;if(!t||n)return this.reset(),null;const s=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?Dr(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(t,n,s,o){return this.useSoftware?new Promise((l,u)=>{const d=ArrayBuffer.isView(t)?t:new Uint8Array(t);this.softwareDecrypt(d,n,s,o);const _=this.flush();_?l(_.buffer):u(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(t),n,s,o)}softwareDecrypt(t,n,s,o){const{currentIV:l,currentResult:u,remainderData:d}=this;if(o!==rn.cbc||n.byteLength!==16)return se.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),d&&(t=Pt(d,t),this.remainderData=null);const _=this.getValidChunk(t);if(!_.length)return null;l&&(s=l);let g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new kr),g.expandKey(n);const v=u;return this.currentResult=g.decrypt(_.buffer,0,s),this.currentIV=_.slice(-16).buffer,v||null}webCryptoDecrypt(t,n,s,o){if(this.key!==n||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,n,s,o));this.key=n,this.fastAesKey=new wr(this.subtle,n,o)}return this.fastAesKey.expandKey().then(l=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new er(this.subtle,new Uint8Array(s),o).decrypt(t.buffer,l)):Promise.reject(new Error("web crypto not initialized"))).catch(l=>(se.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${l.name}: ${l.message}`),this.onWebCryptoError(t,n,s,o)))}onWebCryptoError(t,n,s,o){const l=this.enableSoftwareAES;if(l){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,n,s,o);const u=this.flush();if(u)return u.buffer}throw new Error("WebCrypto"+(l?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(t){let n=t;const s=t.length-t.length%lr;return s!==t.length&&(n=t.slice(0,s),this.remainderData=t.slice(s)),n}logOnce(t){this.logEnabled&&(se.log(`[decrypter]: ${t}`),this.logEnabled=!1)}}const Rr=Math.pow(2,17);class An{constructor(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(t,n){const s=t.url;if(!s)return Promise.reject(new hr({type:ge.NETWORK_ERROR,details:q.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const o=this.config,l=o.fLoader,u=o.loader;return new Promise((d,_)=>{if(this.loader&&this.loader.destroy(),t.gap)if(t.tagList.some(C=>C[0]==="GAP")){_(Sr(t));return}else t.gap=!1;const g=this.loader=l?new l(o):new u(o),v=ar(t);t.loader=g;const y=Tn(o.fragLoadPolicy.default),x={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:t.sn==="initSegment"?1/0:Rr};t.stats=g.stats;const D={onSuccess:(C,F,B,J)=>{this.resetLoader(t,g);let ne=C.data;B.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(ne.slice(0,16)),ne=ne.slice(16)),d({frag:t,part:null,payload:ne,networkDetails:J})},onError:(C,F,B,J)=>{this.resetLoader(t,g),_(new hr({type:ge.NETWORK_ERROR,details:q.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:M({url:s,data:void 0},C),error:new Error(`HTTP Error ${C.code} ${C.text}`),networkDetails:B,stats:J}))},onAbort:(C,F,B)=>{this.resetLoader(t,g),_(new hr({type:ge.NETWORK_ERROR,details:q.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:B,stats:C}))},onTimeout:(C,F,B)=>{this.resetLoader(t,g),_(new hr({type:ge.NETWORK_ERROR,details:q.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${x.timeout}ms`),networkDetails:B,stats:C}))}};n&&(D.onProgress=(C,F,B,J)=>n({frag:t,part:null,payload:B,networkDetails:J})),g.load(v,x,D)})}loadPart(t,n,s){this.abort();const o=this.config,l=o.fLoader,u=o.loader;return new Promise((d,_)=>{if(this.loader&&this.loader.destroy(),t.gap||n.gap){_(Sr(t,n));return}const g=this.loader=l?new l(o):new u(o),v=ar(t,n);t.loader=g;const y=Tn(o.fragLoadPolicy.default),x={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Rr};n.stats=g.stats,g.load(v,x,{onSuccess:(D,C,F,B)=>{this.resetLoader(t,g),this.updateStatsFromPart(t,n);const J={frag:t,part:n,payload:D.data,networkDetails:B};s(J),d(J)},onError:(D,C,F,B)=>{this.resetLoader(t,g),_(new hr({type:ge.NETWORK_ERROR,details:q.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:n,response:M({url:v.url,data:void 0},D),error:new Error(`HTTP Error ${D.code} ${D.text}`),networkDetails:F,stats:B}))},onAbort:(D,C,F)=>{t.stats.aborted=n.stats.aborted,this.resetLoader(t,g),_(new hr({type:ge.NETWORK_ERROR,details:q.INTERNAL_ABORTED,fatal:!1,frag:t,part:n,error:new Error("Aborted"),networkDetails:F,stats:D}))},onTimeout:(D,C,F)=>{this.resetLoader(t,g),_(new hr({type:ge.NETWORK_ERROR,details:q.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:n,error:new Error(`Timeout after ${x.timeout}ms`),networkDetails:F,stats:D}))}})})}updateStatsFromPart(t,n){const s=t.stats,o=n.stats,l=o.total;if(s.loaded+=o.loaded,l){const _=Math.round(t.duration/n.duration),g=Math.min(Math.round(s.loaded/l),_),y=(_-g)*Math.round(s.loaded/g);s.total=s.loaded+y}else s.total=Math.max(s.loaded,s.total);const u=s.loading,d=o.loading;u.start?u.first+=d.first-d.start:(u.start=d.start,u.first=d.first),u.end=d.end}resetLoader(t,n){t.loader=null,this.loader===n&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),n.destroy()}}function ar(h,t=null){const n=t||h,s={frag:h,part:t,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},o=n.byteRangeStartOffset,l=n.byteRangeEndOffset;if(ce(o)&&ce(l)){var u;let d=o,_=l;if(h.sn==="initSegment"&&cr((u=h.decryptdata)==null?void 0:u.method)){const g=l-o;g%16&&(_=l+(16-g%16)),o!==0&&(s.resetIV=!0,d=o-16)}s.rangeStart=d,s.rangeEnd=_}return s}function Sr(h,t){const n=new Error(`GAP ${h.gap?"tag":"attribute"} found`),s={type:ge.MEDIA_ERROR,details:q.FRAG_GAP,fatal:!1,frag:h,error:n,networkDetails:null};return t&&(s.part=t),(t||h).stats.aborted=!0,new hr(s)}function cr(h){return h==="AES-128"||h==="AES-256"}class hr extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class qi extends H{constructor(t,n){super(t,n),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(t){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,t),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class fi{constructor(t,n,s,o=0,l=-1,u=!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=ji(),this.buffering={audio:ji(),video:ji(),audiovideo:ji()},this.level=t,this.sn=n,this.id=s,this.size=o,this.part=l,this.partial=u}}function ji(){return{start:0,executeStart:0,executeEnd:0,end:0}}const bn={length:0,start:()=>0,end:()=>0};class li{static isBuffered(t,n){if(t){const s=li.getBuffered(t);for(let o=s.length;o--;)if(n>=s.start(o)&&n<=s.end(o))return!0}return!1}static bufferedRanges(t){if(t){const n=li.getBuffered(t);return li.timeRangesToArray(n)}return[]}static timeRangesToArray(t){const n=[];for(let s=0;s<t.length;s++)n.push({start:t.start(s),end:t.end(s)});return n}static bufferInfo(t,n,s){if(t){const o=li.bufferedRanges(t);if(o.length)return li.bufferedInfo(o,n,s)}return{len:0,start:n,end:n,bufferedIndex:-1}}static bufferedInfo(t,n,s){n=Math.max(0,n),t.length>1&&t.sort((v,y)=>v.start-y.start||y.end-v.end);let o=-1,l=[];if(s)for(let v=0;v<t.length;v++){n>=t[v].start&&n<=t[v].end&&(o=v);const y=l.length;if(y){const x=l[y-1].end;t[v].start-x<s?t[v].end>x&&(l[y-1].end=t[v].end):l.push(t[v])}else l.push(t[v])}else l=t;let u=0,d,_=n,g=n;for(let v=0;v<l.length;v++){const y=l[v].start,x=l[v].end;if(o===-1&&n>=y&&n<=x&&(o=v),n+s>=y&&n<x)_=y,g=x,u=g-n;else if(n+s<y){d=y;break}}return{len:u,start:_||0,end:g||0,nextStart:d,buffered:t,bufferedIndex:o}}static getBuffered(t){try{return t.buffered||bn}catch(n){return se.log("failed to get media.buffered",n),bn}}}const zn=/\{\$([a-zA-Z0-9-_]+)\}/g;function tr(h){return zn.test(h)}function Cn(h,t){if(h.variableList!==null||h.hasVariableRefs){const n=h.variableList;return t.replace(zn,s=>{const o=s.substring(2,s.length-1),l=n==null?void 0:n[o];return l===void 0?(h.playlistParsingError||(h.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${o}"`)),s):l})}return t}function is(h,t,n){let s=h.variableList;s||(h.variableList=s={});let o,l;if("QUERYPARAM"in t){o=t.QUERYPARAM;try{const u=new self.URL(n).searchParams;if(u.has(o))l=u.get(o);else throw new Error(`"${o}" does not match any query parameter in URI: "${n}"`)}catch(u){h.playlistParsingError||(h.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${u.message}`))}}else o=t.NAME,l=t.VALUE;o in s?h.playlistParsingError||(h.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${o}"`)):s[o]=l||""}function Tr(h,t,n){const s=t.IMPORT;if(n&&s in n){let o=h.variableList;o||(h.variableList=o={}),o[s]=n[s]}else h.playlistParsingError||(h.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const _s=/^(\d+)x(\d+)$/,ns=/(.+?)=(".*?"|.*?)(?:,|$)/g;class pn{constructor(t,n){typeof t=="string"&&(t=pn.parseAttrList(t,n)),k(this,t)}get clientAttrs(){return Object.keys(this).filter(t=>t.substring(0,2)==="X-")}decimalInteger(t){const n=parseInt(this[t],10);return n>Number.MAX_SAFE_INTEGER?1/0:n}hexadecimalInteger(t){if(this[t]){let n=(this[t]||"0x").slice(2);n=(n.length&1?"0":"")+n;const s=new Uint8Array(n.length/2);for(let o=0;o<n.length/2;o++)s[o]=parseInt(n.slice(o*2,o*2+2),16);return s}return null}hexadecimalIntegerAsNumber(t){const n=parseInt(this[t],16);return n>Number.MAX_SAFE_INTEGER?1/0:n}decimalFloatingPoint(t){return parseFloat(this[t])}optionalFloat(t,n){const s=this[t];return s?parseFloat(s):n}enumeratedString(t){return this[t]}enumeratedStringList(t,n){const s=this[t];return(s?s.split(/[ ,]+/):[]).reduce((o,l)=>(o[l.toLowerCase()]=!0,o),n)}bool(t){return this[t]==="YES"}decimalResolution(t){const n=_s.exec(this[t]);if(n!==null)return{width:parseInt(n[1],10),height:parseInt(n[2],10)}}static parseAttrList(t,n){let s;const o={},l='"';for(ns.lastIndex=0;(s=ns.exec(t))!==null;){const u=s[1].trim();let d=s[2];const _=d.indexOf(l)===0&&d.lastIndexOf(l)===d.length-1;let g=!1;if(_)d=d.slice(1,-1);else switch(u){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":g=!0}if(n&&(_||g))d=Cn(n,d);else if(!g&&!_)switch(u){case"CLOSED-CAPTIONS":if(d==="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":se.warn(`${t}: attribute ${u} is missing quotes`)}o[u]=d}return o}}const ir="com.apple.hls.interstitial";function Yr(h){return h!=="ID"&&h!=="CLASS"&&h!=="CUE"&&h!=="START-DATE"&&h!=="DURATION"&&h!=="END-DATE"&&h!=="END-ON-NEXT"}function vs(h){return h==="SCTE35-OUT"||h==="SCTE35-IN"||h==="SCTE35-CMD"}class fr{constructor(t,n,s=0){var o;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=(n==null?void 0:n.tagAnchor)||null,this.tagOrder=(o=n==null?void 0:n.tagOrder)!=null?o:s,n){const l=n.attr;for(const u in l)if(Object.prototype.hasOwnProperty.call(t,u)&&t[u]!==l[u]){se.warn(`DATERANGE tag attribute: "${u}" does not match for tags with ID: "${t.ID}"`),this._badValueForSameId=u;break}t=k(new pn({}),l,t)}if(this.attr=t,n?(this._startDate=n._startDate,this._cue=n._cue,this._endDate=n._endDate,this._dateAtEnd=n._dateAtEnd):this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){const l=(n==null?void 0:n.endDate)||new Date(this.attr["END-DATE"]);ce(l.getTime())&&(this._endDate=l)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const t=this._cue;return t===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):t}get startTime(){const{tagAnchor:t}=this;return t===null||t.programDateTime===null?(se.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${t}`),NaN):t.start+(this.startDate.getTime()-t.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const t=this._endDate||this._dateAtEnd;if(t)return t;const n=this.duration;return n!==null?this._dateAtEnd=new Date(this._startDate.getTime()+n*1e3):null}get duration(){if("DURATION"in this.attr){const t=this.attr.decimalFloatingPoint("DURATION");if(ce(t))return t}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===ir}get isValid(){return!!this.id&&!this._badValueForSameId&&ce(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 jn=10;class dr{constructor(t){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=t}reloaded(t){if(!t){this.advanced=!0,this.updated=!0;return}const n=this.lastPartSn-t.lastPartSn,s=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!s||!!n||!this.live,this.advanced=this.endSN>t.endSN||n>0||n===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(t.misses*.6):this.misses=t.misses+1}hasKey(t){return this.encryptedFragments.some(n=>{let s=n.decryptdata;return s||(n.setKeyFormat(t.keyFormat),s=n.decryptdata),!!s&&t.matches(s)})}get hasProgramDateTime(){return this.fragments.length?ce(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||jn}get drift(){const t=this.driftEndTime-this.driftStartTime;return t>0?(this.driftEnd-this.driftStart)*1e3/t:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const t=this.partList;if(t){const n=this.lastPartIndex;if(n!==-1){for(let s=t.length;s--;)if(t[s].index>n)return t[s].index;return n}}return 0}get lastPartSn(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const t=this.partEnd-this.fragmentStart;return this.age>Math.max(t,this.totalduration)+this.levelTargetDuration}return!1}}function nr(h,t){return h.length===t.length?!h.some((n,s)=>n!==t[s]):!1}function ls(h,t){return!h&&!t?!0:!h||!t?!1:nr(h,t)}function Pr(h){return h==="AES-128"||h==="AES-256"||h==="AES-256-CTR"}function Fs(h){switch(h){case"AES-128":case"AES-256":return rn.cbc;case"AES-256-CTR":return rn.ctr;default:throw new Error(`invalid full segment method ${h}`)}}function Gs(h){return Uint8Array.from(atob(h),t=>t.charCodeAt(0))}function As(h){return Uint8Array.from(unescape(encodeURIComponent(h)),t=>t.charCodeAt(0))}function Sa(h){const t=As(h).subarray(0,16),n=new Uint8Array(16);return n.set(t,16-t.length),n}function ni(h){const t=function(s,o,l){const u=s[o];s[o]=s[l],s[l]=u};t(h,0,3),t(h,1,2),t(h,4,5),t(h,6,7)}function Ti(h){const t=h.split(":");let n=null;if(t[0]==="data"&&t.length===2){const s=t[1].split(";"),o=s[s.length-1].split(",");if(o.length===2){const l=o[0]==="base64",u=o[1];l?(s.splice(-1,1),n=Gs(u)):n=Sa(u)}}return n}const Sn=typeof self!="undefined"?self:void 0;var Hi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ni={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function zr(h){switch(h){case Ni.FAIRPLAY:return Hi.FAIRPLAY;case Ni.PLAYREADY:return Hi.PLAYREADY;case Ni.WIDEVINE:return Hi.WIDEVINE;case Ni.CLEARKEY:return Hi.CLEARKEY}}function qn(h){switch(h){case Hi.FAIRPLAY:return Ni.FAIRPLAY;case Hi.PLAYREADY:return Ni.PLAYREADY;case Hi.WIDEVINE:return Ni.WIDEVINE;case Hi.CLEARKEY:return Ni.CLEARKEY}}function Xr(h){const{drmSystems:t,widevineLicenseUrl:n}=h,s=t?[Hi.FAIRPLAY,Hi.WIDEVINE,Hi.PLAYREADY,Hi.CLEARKEY].filter(o=>!!t[o]):[];return!s[Hi.WIDEVINE]&&n&&s.push(Hi.WIDEVINE),s}const rs=function(h){return Sn!=null&&(h=Sn.navigator)!=null&&h.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Ea(h,t,n,s){let o;switch(h){case Hi.FAIRPLAY:o=["cenc","sinf"];break;case Hi.WIDEVINE:case Hi.PLAYREADY:o=["cenc"];break;case Hi.CLEARKEY:o=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${h}`)}return ru(o,t,n,s)}function ru(h,t,n,s){return[{initDataTypes:h,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:t.map(l=>({contentType:`audio/mp4; codecs=${l}`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:n.map(l=>({contentType:`video/mp4; codecs=${l}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function Za(h){var t;return!!h&&(h.sessionType==="persistent-license"||!!((t=h.sessionTypes)!=null&&t.some(n=>n==="persistent-license")))}function Ls(h){const t=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/2),n=String.fromCharCode.apply(null,Array.from(t)),s=n.substring(n.indexOf("<"),n.length),u=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(u){const d=u.childNodes[0]?u.childNodes[0].nodeValue:u.getAttribute("VALUE");if(d){const _=Gs(d).subarray(0,16);return ni(_),_}}return null}let Hs={};class Mn{static clearKeyUriToKeyIdMap(){Hs={}}static setKeyIdForUri(t,n){Hs[t]=n}constructor(t,n,s,o=[1],l=null,u){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=t,this.uri=n,this.keyFormat=s,this.keyFormatVersions=o,this.iv=l,this.encrypted=t?t!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Pr(t),u!=null&&u.startsWith("0x")&&(this.keyId=new Uint8Array(z(u)))}matches(t){return t.uri===this.uri&&t.method===this.method&&t.encrypted===this.encrypted&&t.keyFormat===this.keyFormat&&nr(t.keyFormatVersions,this.keyFormatVersions)&&ls(t.iv,this.iv)&&ls(t.keyId,this.keyId)}isSupported(){if(this.method){if(Pr(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Ni.FAIRPLAY:case Ni.WIDEVINE:case Ni.PLAYREADY:case Ni.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(t,n){if(!this.encrypted||!this.uri)return null;if(Pr(this.method)){let l=this.iv;return l||(typeof t!="number"&&(se.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0),l=ys(t)),new Mn(this.method,this.uri,"identity",this.keyFormatVersions,l)}if(this.keyId){const l=Hs[this.uri];if(l&&!nr(this.keyId,l)&&Mn.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const s=Ti(this.uri);if(s)switch(this.keyFormat){case Ni.WIDEVINE:if(this.pssh=s,!this.keyId){const l=Ot(s.buffer);if(l.length){var o;const u=l[0];this.keyId=(o=u.kids)!=null&&o.length?u.kids[0]:null}}this.keyId||(this.keyId=Ta(n));break;case Ni.PLAYREADY:{const l=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=vt(l,null,s),this.keyId=Ls(s);break}default:{let l=s.subarray(0,16);if(l.length!==16){const u=new Uint8Array(16);u.set(l,16-l.length),l=u}this.keyId=l;break}}if(!this.keyId||this.keyId.byteLength!==16){let l;l=ka(n),l||(l=Ta(n),l||(l=Hs[this.uri])),l&&(this.keyId=l,Mn.setKeyIdForUri(this.uri,l))}return this}}function ka(h){const t=h==null?void 0:h[Ni.WIDEVINE];return t?t.keyId:null}function Ta(h){const t=h==null?void 0:h[Ni.PLAYREADY];if(t){const n=Ti(t.uri);if(n)return Ls(n)}return null}function ys(h){const t=new Uint8Array(16);for(let n=12;n<16;n++)t[n]=h>>8*(15-n)&255;return t}const Lo=/#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,Do=/#EXT-X-MEDIA:(.*)/g,us=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ya=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),su=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 cs{static findGroup(t,n){for(let s=0;s<t.length;s++){const o=t[s];if(o.id===n)return o}}static resolve(t,n){return A.buildAbsoluteURL(n,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return us.test(t)}static parseMasterPlaylist(t,n){const s=tr(t),o={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},l=[];if(Lo.lastIndex=0,!t.startsWith("#EXTM3U"))return o.playlistParsingError=new Error("no EXTM3U delimiter"),o;let u;for(;(u=Lo.exec(t))!=null;)if(u[1]){var d;const g=new pn(u[1],o),v=Cn(o,u[2]),y={attrs:g,bitrate:g.decimalInteger("BANDWIDTH")||g.decimalInteger("AVERAGE-BANDWIDTH"),name:g.NAME,url:cs.resolve(v,n)},x=g.decimalResolution("RESOLUTION");x&&(y.width=x.width,y.height=x.height),Mo(g.CODECS,y);const D=g["SUPPLEMENTAL-CODECS"];D&&(y.supplemental={},Mo(D,y.supplemental)),(d=y.unknownCodecs)!=null&&d.length||l.push(y),o.levels.push(y)}else if(u[3]){const g=u[3],v=u[4];switch(g){case"SESSION-DATA":{const y=new pn(v,o),x=y["DATA-ID"];x&&(o.sessionData===null&&(o.sessionData={}),o.sessionData[x]=y);break}case"SESSION-KEY":{const y=Co(v,n,o);y.encrypted&&y.isSupported()?(o.sessionKeys===null&&(o.sessionKeys=[]),o.sessionKeys.push(y)):se.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${v}"`);break}case"DEFINE":{{const y=new pn(v,o);is(o,y,n)}break}case"CONTENT-STEERING":{const y=new pn(v,o);o.contentSteering={uri:cs.resolve(y["SERVER-URI"],n),pathwayId:y["PATHWAY-ID"]||"."};break}case"START":{o.startTimeOffset=Aa(v);break}}}const _=l.length>0&&l.length<o.levels.length;return o.levels=_?l:o.levels,o.levels.length===0&&(o.playlistParsingError=new Error("no levels found in manifest")),o}static parseMasterPlaylistMedia(t,n,s){let o;const l={},u=s.levels,d={AUDIO:u.map(g=>({id:g.attrs.AUDIO,audioCodec:g.audioCodec})),SUBTITLES:u.map(g=>({id:g.attrs.SUBTITLES,textCodec:g.textCodec})),"CLOSED-CAPTIONS":[]};let _=0;for(Do.lastIndex=0;(o=Do.exec(t))!==null;){const g=new pn(o[1],s),v=g.TYPE;if(v){const y=d[v],x=l[v]||[];l[v]=x;const D=g.LANGUAGE,C=g["ASSOC-LANGUAGE"],F=g.CHANNELS,B=g.CHARACTERISTICS,J=g["INSTREAM-ID"],ne={attrs:g,bitrate:0,id:_++,groupId:g["GROUP-ID"]||"",name:g.NAME||D||"",type:v,default:g.bool("DEFAULT"),autoselect:g.bool("AUTOSELECT"),forced:g.bool("FORCED"),lang:D,url:g.URI?cs.resolve(g.URI,n):""};if(C&&(ne.assocLang=C),F&&(ne.channels=F),B&&(ne.characteristics=B),J&&(ne.instreamId=J),y!=null&&y.length){const le=cs.findGroup(y,ne.groupId)||y[0];Ds(ne,le,"audioCodec"),Ds(ne,le,"textCodec")}x.push(ne)}}return l}static parseLevelPlaylist(t,n,s,o,l,u){var d;const _={url:n},g=new dr(n),v=g.fragments,y=[];let x=null,D=0,C=0,F=0,B=0,J=0,ne=null,le=new at(o,_),Ee,Ie,tt,Pe=-1,Ye=!1,qe=null,Fe;if(Ya.lastIndex=0,g.m3u8=t,g.hasVariableRefs=tr(t),((d=Ya.exec(t))==null?void 0:d[0])!=="#EXTM3U")return g.playlistParsingError=new Error("Missing format identifier #EXTM3U"),g;for(;(Ee=Ya.exec(t))!==null;){Ye&&(Ye=!1,le=new at(o,_),le.playlistOffset=F,le.setStart(F),le.sn=D,le.cc=B,J&&(le.bitrate=J),le.level=s,x&&(le.initSegment=x,x.rawProgramDateTime&&(le.rawProgramDateTime=x.rawProgramDateTime,x.rawProgramDateTime=null),qe&&(le.setByteRange(qe),qe=null)));const xi=Ee[1];if(xi){le.duration=parseFloat(xi);const si=(" "+Ee[2]).slice(1);le.title=si||null,le.tagList.push(si?["INF",xi,si]:["INF",xi])}else if(Ee[3]){if(ce(le.duration)){le.playlistOffset=F,le.setStart(F),tt&&fl(le,tt,g),le.sn=D,le.level=s,le.cc=B,v.push(le);const si=(" "+Ee[3]).slice(1);le.relurl=Cn(g,si),Xa(le,ne,y),ne=le,F+=le.duration,D++,C=0,Ye=!0}}else{if(Ee=Ee[0].match(su),!Ee){se.warn("No matches on slow regex match for level playlist!");continue}for(Ie=1;Ie<Ee.length&&Ee[Ie]===void 0;Ie++);const si=(" "+Ee[Ie]).slice(1),Vt=(" "+Ee[Ie+1]).slice(1),ci=Ee[Ie+2]?(" "+Ee[Ie+2]).slice(1):null;switch(si){case"BYTERANGE":ne?le.setByteRange(Vt,ne):le.setByteRange(Vt);break;case"PROGRAM-DATE-TIME":le.rawProgramDateTime=Vt,le.tagList.push(["PROGRAM-DATE-TIME",Vt]),Pe===-1&&(Pe=v.length);break;case"PLAYLIST-TYPE":g.type&&bs(g,si,Ee),g.type=Vt.toUpperCase();break;case"MEDIA-SEQUENCE":g.startSN!==0?bs(g,si,Ee):v.length>0&&aa(g,si,Ee),D=g.startSN=parseInt(Vt);break;case"SKIP":{g.skippedSegments&&bs(g,si,Ee);const ei=new pn(Vt,g),gi=ei.decimalInteger("SKIPPED-SEGMENTS");if(ce(gi)){g.skippedSegments+=gi;for(let Ut=gi;Ut--;)v.push(null);D+=gi}const zi=ei.enumeratedString("RECENTLY-REMOVED-DATERANGES");zi&&(g.recentlyRemovedDateranges=(g.recentlyRemovedDateranges||[]).concat(zi.split(" ")));break}case"TARGETDURATION":g.targetduration!==0&&bs(g,si,Ee),g.targetduration=Math.max(parseInt(Vt),1);break;case"VERSION":g.version!==null&&bs(g,si,Ee),g.version=parseInt(Vt);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":g.live||bs(g,si,Ee),g.live=!1;break;case"#":(Vt||ci)&&le.tagList.push(ci?[Vt,ci]:[Vt]);break;case"DISCONTINUITY":B++,le.tagList.push(["DIS"]);break;case"GAP":le.gap=!0,le.tagList.push([si]);break;case"BITRATE":le.tagList.push([si,Vt]),J=parseInt(Vt)*1e3,ce(J)?le.bitrate=J:J=0;break;case"DATERANGE":{const ei=new pn(Vt,g),gi=new fr(ei,g.dateRanges[ei.ID],g.dateRangeTagCount);g.dateRangeTagCount++,gi.isValid||g.skippedSegments?g.dateRanges[gi.id]=gi:se.warn(`Ignoring invalid DATERANGE tag: "${Vt}"`),le.tagList.push(["EXT-X-DATERANGE",Vt]);break}case"DEFINE":{{const ei=new pn(Vt,g);"IMPORT"in ei?Tr(g,ei,u):is(g,ei,n)}break}case"DISCONTINUITY-SEQUENCE":g.startCC!==0?bs(g,si,Ee):v.length>0&&aa(g,si,Ee),g.startCC=B=parseInt(Vt);break;case"KEY":{const ei=Co(Vt,n,g);if(ei.isSupported()){if(ei.method==="NONE"){tt=void 0;break}tt||(tt={});const gi=tt[ei.keyFormat];gi!=null&&gi.matches(ei)||(gi&&(tt=k({},tt)),tt[ei.keyFormat]=ei)}else se.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${Vt}"`);break}case"START":g.startTimeOffset=Aa(Vt);break;case"MAP":{const ei=new pn(Vt,g);if(le.duration){const gi=new at(o,_);Ro(gi,ei,s,tt),x=gi,le.initSegment=x,x.rawProgramDateTime&&!le.rawProgramDateTime&&(le.rawProgramDateTime=x.rawProgramDateTime)}else{const gi=le.byteRangeEndOffset;if(gi){const zi=le.byteRangeStartOffset;qe=`${gi-zi}@${zi}`}else qe=null;Ro(le,ei,s,tt),x=le,Ye=!0}x.cc=B;break}case"SERVER-CONTROL":{Fe&&bs(g,si,Ee),Fe=new pn(Vt),g.canBlockReload=Fe.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=Fe.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&Fe.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=Fe.optionalFloat("PART-HOLD-BACK",0),g.holdBack=Fe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{g.partTarget&&bs(g,si,Ee);const ei=new pn(Vt);g.partTarget=ei.decimalFloatingPoint("PART-TARGET");break}case"PART":{let ei=g.partList;ei||(ei=g.partList=[]);const gi=C>0?ei[ei.length-1]:void 0,zi=C++,Ut=new pn(Vt,g),qt=new Bt(Ut,le,_,zi,gi);ei.push(qt),le.duration+=qt.duration;break}case"PRELOAD-HINT":{const ei=new pn(Vt,g);g.preloadHint=ei;break}case"RENDITION-REPORT":{const ei=new pn(Vt,g);g.renditionReports=g.renditionReports||[],g.renditionReports.push(ei);break}default:se.warn(`line parsed but not handled: ${Ee}`);break}}}ne&&!ne.relurl?(v.pop(),F-=ne.duration,g.partList&&(g.fragmentHint=ne)):g.partList&&(Xa(le,ne,y),le.cc=B,g.fragmentHint=le,tt&&fl(le,tt,g)),g.targetduration||(g.playlistParsingError=new Error("Missing Target Duration"));const mt=v.length,Zt=v[0],ui=v[mt-1];if(F+=g.skippedSegments*g.targetduration,F>0&&mt&&ui){g.averagetargetduration=F/mt;const xi=ui.sn;g.endSN=xi!=="initSegment"?xi:0,g.live||(ui.endList=!0),Pe>0&&(Io(v,Pe),Zt&&y.unshift(Zt))}return g.fragmentHint&&(F+=g.fragmentHint.duration),g.totalduration=F,y.length&&g.dateRangeTagCount&&Zt&&hl(y,g),g.endCC=B,g}}function hl(h,t){let n=h.length;if(!n)if(t.hasProgramDateTime){const d=t.fragments[t.fragments.length-1];h.push(d),n++}else return;const s=h[n-1],o=t.live?1/0:t.totalduration,l=Object.keys(t.dateRanges);for(let d=l.length;d--;){const _=t.dateRanges[l[d]],g=_.startDate.getTime();_.tagAnchor=s.ref;for(let v=n;v--;){var u;if(((u=h[v])==null?void 0:u.sn)<t.startSN)break;const y=au(t,g,h,v,o);if(y!==-1){_.tagAnchor=t.fragments[y].ref;break}}}}function au(h,t,n,s,o){const l=n[s];if(l){const d=l.programDateTime;if(t>=d||s===0){var u;const _=(((u=n[s+1])==null?void 0:u.start)||o)-l.start;if(t<=d+_*1e3){const g=n[s].sn-h.startSN;if(g<0)return-1;const v=h.fragments;if(v.length>n.length){const x=(n[s+1]||v[v.length-1]).sn-h.startSN;for(let D=x;D>g;D--){const C=v[D].programDateTime;if(t>=C&&t<C+v[D].duration*1e3)return D}}return g}}}return-1}function Co(h,t,n){var s,o;const l=new pn(h,n),u=(s=l.METHOD)!=null?s:"",d=l.URI,_=l.hexadecimalInteger("IV"),g=l.KEYFORMATVERSIONS,v=(o=l.KEYFORMAT)!=null?o:"identity";d&&l.IV&&!_&&se.error(`Invalid IV: ${l.IV}`);const y=d?cs.resolve(d,t):"",x=(g||"1").split("/").map(Number).filter(Number.isFinite);return new Mn(u,y,v,x,_,l.KEYID)}function Aa(h){const n=new pn(h).decimalFloatingPoint("TIME-OFFSET");return ce(n)?n:null}function Mo(h,t){let n=(h||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const o=n.filter(l=>Le(l,s));o.length&&(t[`${s}Codec`]=o.map(l=>l.split("/")[0]).join(","),n=n.filter(l=>o.indexOf(l)===-1))}),t.unknownCodecs=n}function Ds(h,t,n){const s=t[n];s&&(h[n]=s)}function Io(h,t){let n=h[t];for(let s=t;s--;){const o=h[s];if(!o)return;o.programDateTime=n.programDateTime-o.duration*1e3,n=o}}function Xa(h,t,n){h.rawProgramDateTime?n.push(h):t!=null&&t.programDateTime&&(h.programDateTime=t.endProgramDateTime)}function Ro(h,t,n,s){h.relurl=t.URI,t.BYTERANGE&&h.setByteRange(t.BYTERANGE),h.level=n,h.sn="initSegment",s&&(h.levelkeys=s),h.initSegment=null}function fl(h,t,n){h.levelkeys=t;const{encryptedFragments:s}=n;(!s.length||s[s.length-1].levelkeys!==t)&&Object.keys(t).some(o=>t[o].isCommonEncryption)&&s.push(h)}function bs(h,t,n){h.playlistParsingError=new Error(`#EXT-X-${t} must not appear more than once (${n[0]})`)}function aa(h,t,n){h.playlistParsingError=new Error(`#EXT-X-${t} must appear before the first Media Segment (${n[0]})`)}function Po(h,t){const n=t.startPTS;if(ce(n)){let s=0,o;t.sn>h.sn?(s=n-h.start,o=h):(s=h.start-n,o=t),o.duration!==s&&o.setDuration(s)}else t.sn>h.sn?h.cc===t.cc&&h.minEndPTS?t.setStart(h.start+(h.minEndPTS-h.start)):t.setStart(h.start+h.duration):t.setStart(Math.max(h.start-t.duration,0))}function Ws(h,t,n,s,o,l,u){s-n<=0&&(u.warn("Fragment should have a positive duration",t),s=n+t.duration,l=o+t.duration);let _=n,g=s;const v=t.startPTS,y=t.endPTS;if(ce(v)){const J=Math.abs(v-n);h&&J>h.totalduration?u.warn(`media timestamps and playlist times differ by ${J}s for level ${t.level} ${h.url}`):ce(t.deltaPTS)?t.deltaPTS=Math.max(J,t.deltaPTS):t.deltaPTS=J,_=Math.max(n,v),n=Math.min(n,v),o=t.startDTS!==void 0?Math.min(o,t.startDTS):o,g=Math.min(s,y),s=Math.max(s,y),l=t.endDTS!==void 0?Math.max(l,t.endDTS):l}const x=n-t.start;t.start!==0&&t.setStart(n),t.setDuration(s-t.start),t.startPTS=n,t.maxStartPTS=_,t.startDTS=o,t.endPTS=s,t.minEndPTS=g,t.endDTS=l;const D=t.sn;if(!h||D<h.startSN||D>h.endSN)return 0;let C;const F=D-h.startSN,B=h.fragments;for(B[F]=t,C=F;C>0;C--)Po(B[C],B[C-1]);for(C=F;C<B.length-1;C++)Po(B[C],B[C+1]);return h.fragmentHint&&Po(B[B.length-1],h.fragmentHint),h.PTSKnown=h.alignedSliding=!0,x}function Oo(h,t,n){if(h===t)return;let s=null;const o=h.fragments;for(let v=o.length-1;v>=0;v--){const y=o[v].initSegment;if(y){s=y;break}}h.fragmentHint&&delete h.fragmentHint.endPTS;let l;js(h,t,(v,y,x,D)=>{if((!t.startCC||t.skippedSegments)&&y.cc!==v.cc){const C=v.cc-y.cc;for(let F=x;F<D.length;F++)D[F].cc+=C;t.endCC=D[D.length-1].cc}ce(v.startPTS)&&ce(v.endPTS)&&(y.setStart(y.startPTS=v.startPTS),y.startDTS=v.startDTS,y.maxStartPTS=v.maxStartPTS,y.endPTS=v.endPTS,y.endDTS=v.endDTS,y.minEndPTS=v.minEndPTS,y.setDuration(v.endPTS-v.startPTS),y.duration&&(l=y),t.PTSKnown=t.alignedSliding=!0),v.hasStreams&&(y.elementaryStreams=v.elementaryStreams),y.loader=v.loader,v.hasStats&&(y.stats=v.stats),v.initSegment&&(y.initSegment=v.initSegment,s=v.initSegment)});const u=t.fragments,d=t.fragmentHint?u.concat(t.fragmentHint):u;if(s&&d.forEach(v=>{var y;v&&(!v.initSegment||v.initSegment.relurl===((y=s)==null?void 0:y.relurl))&&(v.initSegment=s)}),t.skippedSegments){if(t.deltaUpdateFailed=u.some(v=>!v),t.deltaUpdateFailed){n.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let v=t.skippedSegments;v--;)u.shift();t.startSN=u[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=dl(h.dateRanges,t,n));const v=h.fragments.filter(y=>y.rawProgramDateTime);if(h.hasProgramDateTime&&!t.hasProgramDateTime)for(let y=1;y<d.length;y++)d[y].programDateTime===null&&Xa(d[y],d[y-1],v);hl(v,t)}t.endCC=u[u.length-1].cc}if(!t.startCC){var _;const v=Ln(h,t.startSN-1);t.startCC=(_=v==null?void 0:v.cc)!=null?_:u[0].cc}ou(h.partList,t.partList,(v,y)=>{y.elementaryStreams=v.elementaryStreams,y.stats=v.stats}),l?Ws(t,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS,n):Qa(h,t),u.length&&(t.totalduration=t.edge-u[0].start),t.driftStartTime=h.driftStartTime,t.driftStart=h.driftStart;const g=t.advancedDateTime;if(t.advanced&&g){const v=t.edge;t.driftStart||(t.driftStartTime=g,t.driftStart=v),t.driftEndTime=g,t.driftEnd=v}else t.driftEndTime=h.driftEndTime,t.driftEnd=h.driftEnd,t.advancedDateTime=h.advancedDateTime;t.requestScheduled===-1&&(t.requestScheduled=h.requestScheduled)}function dl(h,t,n){const{dateRanges:s,recentlyRemovedDateranges:o}=t,l=k({},h);o&&o.forEach(_=>{delete l[_]});const d=Object.keys(l).length;return d?(Object.keys(s).forEach(_=>{const g=l[_],v=new fr(s[_].attr,g);v.isValid?(l[_]=v,g||(v.tagOrder+=d)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${$e(s[_].attr)}"`)}),l):s}function ou(h,t,n){if(h&&t){let s=0;for(let o=0,l=h.length;o<=l;o++){const u=h[o],d=t[o+s];u&&d&&u.index===d.index&&u.fragment.sn===d.fragment.sn?n(u,d):s--}}}function js(h,t,n){const s=t.skippedSegments,o=Math.max(h.startSN,t.startSN)-t.startSN,l=(h.fragmentHint?1:0)+(s?t.endSN:Math.min(h.endSN,t.endSN))-t.startSN,u=t.startSN-h.startSN,d=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,_=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;for(let g=o;g<=l;g++){const v=_[u+g];let y=d[g];if(s&&!y&&v&&(y=t.fragments[g]=v),v&&y){n(v,y,g,d);const x=v.relurl,D=y.relurl;if(x&&eo(x,D)){t.playlistParsingError=Ja(`media sequence mismatch ${y.sn}:`,h,t,v,y);return}else if(v.cc!==y.cc){t.playlistParsingError=Ja(`discontinuity sequence mismatch (${v.cc}!=${y.cc})`,h,t,v,y);return}}}}function Ja(h,t,n,s,o){return new Error(`${h} ${o.url}
|
|
|
Playlist starting @${t.startSN}
|
|
|
${t.m3u8}
|
|
|
|
|
|
Playlist starting @${n.startSN}
|
|
|
${n.m3u8}`)}function Qa(h,t,n=!0){const s=t.startSN+t.skippedSegments-h.startSN,o=h.fragments,l=s>=0;let u=0;if(l&&s<o.length)u=o[s].start;else if(l&&t.startSN===h.endSN+1)u=h.fragmentEnd;else if(l&&n)u=h.fragmentStart+s*t.levelTargetDuration;else if(!t.skippedSegments&&t.fragmentStart===0)u=h.fragmentStart;else return;Fo(t,u)}function Fo(h,t){if(t){const n=h.fragments;for(let s=h.skippedSegments;s<n.length;s++)n[s].addStart(t);h.fragmentHint&&h.fragmentHint.addStart(t)}}function Vn(h,t=1/0){let n=1e3*h.targetduration;if(h.updated){const s=h.fragments;if(s.length&&n*4>t){const l=s[s.length-1].duration*1e3;l<n&&(n=l)}}else n/=2;return Math.round(n)}function Ln(h,t,n){if(!h)return null;let s=h.fragments[t-h.startSN];return s||(s=h.fragmentHint,s&&s.sn===t)?s:t<h.startSN&&n&&n.sn===t?n:null}function On(h,t,n){return h?Vr(h.partList,t,n):null}function Vr(h,t,n){if(h)for(let s=h.length;s--;){const o=h[s];if(o.index===n&&o.fragment.sn===t)return o}return null}function Gr(h){h.forEach((t,n)=>{var s;(s=t.details)==null||s.fragments.forEach(o=>{o.level=n,o.initSegment&&(o.initSegment.level=n)})})}function eo(h,t){return h!==t&&t?oa(h)!==oa(t):!1}function oa(h){return h.replace(/\?[^?]*$/,"")}function Bs(h,t){for(let s=0,o=h.length;s<o;s++){var n;if(((n=h[s])==null?void 0:n.cc)===t)return h[s]}return null}function pl(h,t){return!!(h&&t.startCC<h.endCC&&t.endCC>h.startCC)}function Bo(h,t){const n=h.start+t;h.startPTS=n,h.setStart(n),h.endPTS=n+h.duration}function la(h,t){const n=t.fragments;for(let s=0,o=n.length;s<o;s++)Bo(n[s],h);t.fragmentHint&&Bo(t.fragmentHint,h),t.alignedSliding=!0}function No(h,t){h&&(ml(t,h),t.alignedSliding||gl(t,h),!t.alignedSliding&&!t.skippedSegments&&Qa(h,t,!1))}function ml(h,t){if(!pl(t,h))return;const n=Math.min(t.endCC,h.endCC),s=Bs(t.fragments,n),o=Bs(h.fragments,n);if(!s||!o)return;se.log(`Aligning playlist at start of dicontinuity sequence ${n}`);const l=s.start-o.start;la(l,h)}function gl(h,t){if(!h.hasProgramDateTime||!t.hasProgramDateTime)return;const n=h.fragments,s=t.fragments;if(!n.length||!s.length)return;let o,l;const u=Math.min(t.endCC,h.endCC);t.startCC<u&&h.startCC<u&&(o=Bs(s,u),l=Bs(n,u)),(!o||!l)&&(o=s[Math.floor(s.length/2)],l=Bs(n,o.cc)||n[Math.floor(n.length/2)]);const d=o.programDateTime,_=l.programDateTime;if(!d||!_)return;const g=(_-d)/1e3-(l.start-o.start);la(g,h)}function Jr(h,t,n){Or(h,t,n),h.addEventListener(t,n)}function Or(h,t,n){h.removeEventListener(t,n)}const Ah={toString:function(h){let t="";const n=h.length;for(let s=0;s<n;s++)t+=`[${h.start(s).toFixed(3)}-${h.end(s).toFixed(3)}]`;return t}},pt={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 lu extends qi{constructor(t,n,s,o,l){super(o,t.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=pt.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:u,fragCurrent:d,media:_,mediaBuffer:g,state:v}=this,y=_?_.currentTime:0,x=li.bufferInfo(g||_,y,u.maxBufferHole),D=!x.len;if(this.log(`Media seeking to ${ce(y)?y.toFixed(3):y}, state: ${v}, ${D?"out of":"in"} buffer`),this.state===pt.ENDED)this.resetLoadingState();else if(d){const C=u.maxFragLookUpTolerance,F=d.start-C,B=d.start+d.duration+C;if(D||B<x.start||F>x.end){const J=y>B;(y<F||J)&&(J&&d.loader&&(this.log(`Cancelling fragment load for seek (sn: ${d.sn})`),d.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(_){this.fragmentTracker.removeFragmentsInRange(y,1/0,this.playlistType,!0);const C=this.lastCurrentTime;if(y>C&&(this.lastCurrentTime=y),!this.loadingParts){const F=Math.max(x.end,y),B=this.shouldLoadParts(this.getLevelDetails(),F);B&&(this.log(`LL-Part loading ON after seeking to ${y.toFixed(2)} with buffer @${F.toFixed(2)}`),this.loadingParts=B)}}this.hls.hasEnoughToStart||(this.log(`Setting ${D?"startPosition":"nextLoadPosition"} to ${y} for seek without enough to start`),this.nextLoadPosition=y,D&&(this.startPosition=y)),D&&this.state===pt.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=l,this.hls=t,this.fragmentLoader=new An(t.config),this.keyLoader=s,this.fragmentTracker=n,this.config=t.config,this.decrypter=new ur(t.config)}registerListeners(){const{hls:t}=this;t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(S.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(t){}stopLoad(){if(this.state===pt.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const t=this.fragCurrent;t!=null&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=pt.STOPPED}get startPositionValue(){const{nextLoadPosition:t,startPosition:n}=this;return n===-1&&t?t:n}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(t,n){if(n.live||!this.media)return!1;const s=t.end||0,o=this.config.timelineOffset||0;if(s<=o)return!1;const l=t.buffered;this.config.maxBufferHole&&l&&l.length>1&&(t=li.bufferedInfo(l,t.start,0));const u=t.nextStart;if(u&&u>o&&u<n.edge||this.media.currentTime<t.start)return!1;const _=n.partList;if(_!=null&&_.length){const v=_[_.length-1];return li.isBuffered(this.media,v.start+v.duration/2)}const g=n.fragments[n.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(g)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const t=this.config.timelineOffset;if(t){var n;return((n=this.getLevelDetails())==null?void 0:n.appliedTimelineOffset)||t}return 0}onMediaAttached(t,n){const s=this.media=this.mediaBuffer=n.media;Jr(s,"seeking",this.onMediaSeeking),Jr(s,"ended",this.onMediaEnded);const o=this.config;this.levels&&o.autoStartLoad&&this.state===pt.STOPPED&&this.startLoad(o.startPosition)}onMediaDetaching(t,n){const s=!!n.transferMedia,o=this.media;if(o!==null){if(o.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Or(o,"seeking",this.onMediaSeeking),Or(o,"ended",this.onMediaEnded),this.keyLoader&&!s&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,s){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(t,n){}onManifestLoaded(t,n){this.startTimeOffset=n.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=pt.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(t,n,s){this.startFragRequested=!0,this._loadFragForPlayback(t,n,s)}_loadFragForPlayback(t,n,s){const o=l=>{const u=l.frag;if(this.fragContextChanged(u)){this.warn(`${u.type} sn: ${u.sn}${l.part?" part: "+l.part.index:""} of ${this.fragInfo(u,!1,l.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(u);return}u.stats.chunkCount++,this._handleFragmentLoadProgress(l)};this._doFragLoad(t,n,s,o).then(l=>{if(!l)return;const u=this.state,d=l.frag;if(this.fragContextChanged(d)){(u===pt.FRAG_LOADING||!this.fragCurrent&&u===pt.PARSING)&&(this.fragmentTracker.removeFragment(d),this.state=pt.IDLE);return}"payload"in l&&(this.log(`Loaded ${d.type} sn: ${d.sn} of ${this.playlistLabel()} ${d.level}`),this.hls.trigger(S.FRAG_LOADED,l)),this._handleFragmentLoadComplete(l)}).catch(l=>{this.state===pt.STOPPED||this.state===pt.ERROR||(this.warn(`Frag error: ${(l==null?void 0:l.message)||l}`),this.resetFragmentLoading(t))})}clearTrackerIfNeeded(t){var n;const{fragmentTracker:s}=this;if(s.getState(t)===Oi.APPENDING){const l=t.type,u=this.getFwdBufferInfo(this.mediaBuffer,l),d=Math.max(t.duration,u?u.len:this.config.maxBufferLength),_=this.backtrackFragment;((_?t.sn-_.sn:0)===1||this.reduceMaxBufferLength(d,t.duration))&&s.removeFragment(t)}else((n=this.mediaBuffer)==null?void 0:n.buffered.length)===0?s.removeAllFragments():s.hasParts(t.type)&&(s.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),s.getState(t)===Oi.PARTIAL&&s.removeFragment(t))}checkLiveUpdate(t){if(t.updated&&!t.live){const n=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:n,part:null,stats:n.stats,id:n.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)}waitForLive(t){const n=t.details;return(n==null?void 0:n.live)&&n.type!=="EVENT"&&(this.levelLastLoaded!==t||n.expired)}flushMainBuffer(t,n,s=null){if(!(t-n))return;const o={startOffset:t,endOffset:n,type:s};this.hls.trigger(S.BUFFER_FLUSHING,o)}_loadInitSegment(t,n){this._doFragLoad(t,n).then(s=>{const o=s==null?void 0:s.frag;if(!o||this.fragContextChanged(o)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:o}=this,{frag:l,payload:u}=s,d=l.decryptdata;if(u&&u.byteLength>0&&d!=null&&d.key&&d.iv&&Pr(d.method)){const _=self.performance.now();return this.decrypter.decrypt(new Uint8Array(u),d.key.buffer,d.iv.buffer,Fs(d.method)).catch(g=>{throw o.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.FRAG_DECRYPT_ERROR,fatal:!1,error:g,reason:g.message,frag:l}),g}).then(g=>{const v=self.performance.now();return o.trigger(S.FRAG_DECRYPTED,{frag:l,payload:g,stats:{tstart:_,tdecrypt:v}}),s.payload=g,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===pt.STOPPED||this.state===pt.ERROR||(this.warn(s),this.resetFragmentLoading(t))})}completeInitSegmentLoad(t){const{levels:n}=this;if(!n)throw new Error("init load aborted, missing levels");const s=t.frag.stats;this.state!==pt.STOPPED&&(this.state=pt.IDLE),t.frag.data=new Uint8Array(t.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(t,n){var s,o;const l=t.tracks;if(l&&!n.encrypted&&((s=l.audio)!=null&&s.encrypted||(o=l.video)!=null&&o.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const u=this.media,d=new Error(`Encrypted track with no key in ${this.fragInfo(n)} (media ${u?"attached mediaKeys: "+u.mediaKeys:"detached"})`);return this.warn(d.message),!u||u.mediaKeys?!1:(this.hls.trigger(S.ERROR,{type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_NO_KEYS,fatal:!1,error:d,frag:n}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(t){const{fragCurrent:n}=this;return!t||!n||t.sn!==n.sn||t.level!==n.level}fragBufferedComplete(t,n){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${t.type} sn: ${t.sn}${n?" part: "+n.index:""} of ${this.fragInfo(t,!1,n)} > buffer:${s?Ah.toString(li.getBuffered(s)):"(detached)"})`),ze(t)){var o;if(t.type!==P.SUBTITLE){const u=t.elementaryStreams;if(!Object.keys(u).some(d=>!!u[d])){this.state=pt.IDLE;return}}const l=(o=this.levels)==null?void 0:o[t.level];l!=null&&l.fragmentError&&(this.log(`Resetting level fragment error count of ${l.fragmentError} on frag buffered`),l.fragmentError=0)}this.state=pt.IDLE}_handleFragmentLoadComplete(t){const{transmuxer:n}=this;if(!n)return;const{frag:s,part:o,partsLoaded:l}=t,u=!l||l.length===0||l.some(_=>!_),d=new fi(s.level,s.sn,s.stats.chunkCount+1,0,o?o.index:-1,!u);n.flush(d)}_handleFragmentLoadProgress(t){}_doFragLoad(t,n,s=null,o){var l;this.fragCurrent=t;const u=n.details;if(!this.levels||!u)throw new Error(`frag load aborted, missing level${u?"":" detail"}s`);let d=null;if(t.encrypted&&!((l=t.decryptdata)!=null&&l.key)){if(this.log(`Loading key for ${t.sn} of [${u.startSN}-${u.endSN}], ${this.playlistLabel()} ${t.level}`),this.state=pt.KEY_LOADING,this.fragCurrent=t,d=this.keyLoader.load(t).then(x=>{if(!this.fragContextChanged(x.frag))return this.hls.trigger(S.KEY_LOADED,x),this.state===pt.KEY_LOADING&&(this.state=pt.IDLE),x}),this.hls.trigger(S.KEY_LOADING,{frag:t}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else t.encrypted||(d=this.keyLoader.loadClear(t,u.encryptedFragments,this.startFragRequested),d&&this.log("[eme] blocking frag load until media-keys acquired"));const _=this.fragPrevious;if(ze(t)&&(!_||t.sn!==_.sn)){const x=this.shouldLoadParts(n.details,t.end);x!==this.loadingParts&&(this.log(`LL-Part loading ${x?"ON":"OFF"} loading sn ${_==null?void 0:_.sn}->${t.sn}`),this.loadingParts=x)}if(s=Math.max(t.start,s||0),this.loadingParts&&ze(t)){const x=u.partList;if(x&&o){s>u.fragmentEnd&&u.fragmentHint&&(t=u.fragmentHint);const D=this.getNextPart(x,t,s);if(D>-1){const C=x[D];t=this.fragCurrent=C.fragment,this.log(`Loading ${t.type} sn: ${t.sn} part: ${C.index} (${D}/${x.length-1}) of ${this.fragInfo(t,!1,C)}) cc: ${t.cc} [${u.startSN}-${u.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=C.start+C.duration,this.state=pt.FRAG_LOADING;let F;return d?F=d.then(B=>!B||this.fragContextChanged(B.frag)?null:this.doFragPartsLoad(t,C,n,o)).catch(B=>this.handleFragLoadError(B)):F=this.doFragPartsLoad(t,C,n,o).catch(B=>this.handleFragLoadError(B)),this.hls.trigger(S.FRAG_LOADING,{frag:t,part:C,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):F}else if(!t.url||this.loadedEndOfParts(x,s))return Promise.resolve(null)}}if(ze(t)&&this.loadingParts){var g;this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)} Check buffer at sn: ${t.sn} loaded parts: ${(g=u.partList)==null?void 0:g.filter(x=>x.loaded).map(x=>`[${x.start}-${x.end}]`)}`),this.loadingParts=!1}else if(!t.url)return Promise.resolve(null);this.log(`Loading ${t.type} sn: ${t.sn} of ${this.fragInfo(t,!1)}) cc: ${t.cc} ${"["+u.startSN+"-"+u.endSN+"]"}, target: ${parseFloat(s.toFixed(3))}`),ce(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=pt.FRAG_LOADING;const v=this.config.progressive;let y;return v&&d?y=d.then(x=>!x||this.fragContextChanged(x.frag)?null:this.fragmentLoader.load(t,o)).catch(x=>this.handleFragLoadError(x)):y=Promise.all([this.fragmentLoader.load(t,v?o:void 0),d]).then(([x])=>(!v&&o&&o(x),x)).catch(x=>this.handleFragLoadError(x)),this.hls.trigger(S.FRAG_LOADING,{frag:t,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):y}doFragPartsLoad(t,n,s,o){return new Promise((l,u)=>{var d;const _=[],g=(d=s.details)==null?void 0:d.partList,v=y=>{this.fragmentLoader.loadPart(t,y,o).then(x=>{_[y.index]=x;const D=x.part;this.hls.trigger(S.FRAG_LOADED,x);const C=On(s.details,t.sn,y.index+1)||Vr(g,t.sn,y.index+1);if(C)v(C);else return l({frag:t,part:D,partsLoaded:_})}).catch(u)};v(n)})}handleFragLoadError(t){if("data"in t){const n=t.data;n.frag&&n.details===q.INTERNAL_ABORTED?this.handleFragLoadAborted(n.frag,n.part):n.frag&&n.type===ge.KEY_SYSTEM_ERROR?(n.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(n.frag)):this.hls.trigger(S.ERROR,n)}else this.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:q.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const n=this.getCurrentContext(t);if(!n||this.state!==pt.PARSING){!this.fragCurrent&&this.state!==pt.STOPPED&&this.state!==pt.ERROR&&(this.state=pt.IDLE);return}const{frag:s,part:o,level:l}=n,u=self.performance.now();s.stats.parsing.end=u,o&&(o.stats.parsing.end=u);const d=this.getLevelDetails(),g=d&&s.sn>d.endSN||this.shouldLoadParts(d,s.end);g!==this.loadingParts&&(this.log(`LL-Part loading ${g?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=g),this.updateLevelTiming(s,o,l,t.partial)}shouldLoadParts(t,n){if(this.config.lowLatencyMode){if(!t)return this.loadingParts;if(t.partList){var s;const l=t.partList[0];if(l.fragment.type===P.SUBTITLE)return!1;const u=l.end+(((s=t.fragmentHint)==null?void 0:s.duration)||0);if(n>=u){var o;if((this.hls.hasEnoughToStart?((o=this.media)==null?void 0:o.currentTime)||this.lastCurrentTime:this.getLoadPosition())>l.start-l.fragment.duration)return!0}}}return!1}getCurrentContext(t){const{levels:n,fragCurrent:s}=this,{level:o,sn:l,part:u}=t;if(!(n!=null&&n[o]))return this.warn(`Levels object was unset while buffering fragment ${l} of ${this.playlistLabel()} ${o}. The current chunk will not be buffered.`),null;const d=n[o],_=d.details,g=u>-1?On(_,l,u):null,v=g?g.fragment:Ln(_,l,s);return v?(s&&s!==v&&(v.stats=s.stats),{frag:v,part:g,level:d}):null}bufferFragmentData(t,n,s,o,l){if(this.state!==pt.PARSING)return;const{data1:u,data2:d}=t;let _=u;if(d&&(_=Pt(u,d)),!_.length)return;const g=this.initPTS[n.cc],v=g?-g.baseTime/g.timescale:void 0,y={type:t.type,frag:n,part:s,chunkMeta:o,offset:v,parent:n.type,data:_};if(this.hls.trigger(S.BUFFER_APPENDING,y),t.dropped&&t.independent&&!s){if(l)return;this.flushBufferGap(n)}}flushBufferGap(t){const n=this.media;if(!n)return;if(!li.isBuffered(n,n.currentTime)){this.flushMainBuffer(0,t.start);return}const s=n.currentTime,o=li.bufferInfo(n,s,0),l=t.duration,u=Math.min(this.config.maxFragLookUpTolerance*2,l*.25),d=Math.max(Math.min(t.start-u,o.end-u),s+u);t.start-d>u&&this.flushMainBuffer(d,t.start)}getFwdBufferInfo(t,n){var s;const o=this.getLoadPosition();if(!ce(o))return null;const u=this.lastCurrentTime>o||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(t,o,n,u)}getFwdBufferInfoAtPos(t,n,s,o){const l=li.bufferInfo(t,n,o);if(l.len===0&&l.nextStart!==void 0){const u=this.fragmentTracker.getBufferedFrag(n,s);if(u&&(l.nextStart<=u.end||u.gap)){const d=Math.max(Math.min(l.nextStart,u.end)-n,o);return li.bufferInfo(t,n,d)}}return l}getMaxBufferLength(t){const{config:n}=this;let s;return t?s=Math.max(8*n.maxBufferSize/t,n.maxBufferLength):s=n.maxBufferLength,Math.min(s,n.maxMaxBufferLength)}reduceMaxBufferLength(t,n){const s=this.config,o=Math.max(Math.min(t-n,s.maxBufferLength),n),l=Math.max(t-n*3,s.maxMaxBufferLength/2,o);return l>=o?(s.maxMaxBufferLength=l,this.warn(`Reduce max buffer length to ${l}s`),!0):!1}getAppendedFrag(t,n=P.MAIN){const s=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(t,n):null;return s&&"fragment"in s?s.fragment:s}getNextFragment(t,n){const s=n.fragments,o=s.length;if(!o)return null;const{config:l}=this,u=s[0].start,d=l.lowLatencyMode&&!!n.partList;let _=null;if(n.live){const y=l.initialLiveManifestSize;if(o<y)return this.warn(`Not enough fragments to start playback (have: ${o}, need: ${y})`),null;if(!n.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||t<u){var g;d&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),_=this.getInitialLiveFragment(n);const x=this.hls.startPosition,D=this.hls.liveSyncPosition,C=_?(x!==-1&&x>=u?x:D)||_.start:t;this.log(`Setting startPosition to ${C} to match start frag at live edge. mainStart: ${x} liveSyncPosition: ${D} frag.start: ${(g=_)==null?void 0:g.start}`),this.startPosition=this.nextLoadPosition=C}}else t<=u&&(_=s[0]);if(!_){const y=this.loadingParts?n.partEnd:n.fragmentEnd;_=this.getFragmentAtPosition(t,y,n)}let v=this.filterReplacedPrimary(_,n);if(!v&&_){const y=_.sn-n.startSN;v=this.filterReplacedPrimary(s[y+1]||null,n)}return this.mapToInitFragWhenRequired(v)}isLoopLoading(t,n){const s=this.fragmentTracker.getState(t);return(s===Oi.OK||s===Oi.PARTIAL&&!!t.gap)&&this.nextLoadPosition>n}getNextFragmentLoopLoading(t,n,s,o,l){let u=null;if(t.gap&&(u=this.getNextFragment(this.nextLoadPosition,n),u&&!u.gap&&s.nextStart)){const d=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,o,0);if(d!==null&&s.len+d.len>=l){const _=u.sn;return this.loopSn!==_&&(this.log(`buffer full after gaps in "${o}" playlist starting at sn: ${_}`),this.loopSn=_),null}}return this.loopSn=void 0,u}get primaryPrefetch(){if(mc(this.config)){var t;if((t=this.hls.interstitialsManager)==null||(t=t.playingItem)==null?void 0:t.event)return!0}return!1}filterReplacedPrimary(t,n){if(!t)return t;if(mc(this.config)&&t.type!==P.SUBTITLE){const s=this.hls.interstitialsManager,o=s==null?void 0:s.bufferingItem;if(o){const u=o.event;if(u){if(u.appendInPlace||Math.abs(t.start-o.start)>1||o.start===0)return null}else if(t.end<=o.start&&(n==null?void 0:n.live)===!1||t.start>o.end&&o.nextEvent&&(o.nextEvent.appendInPlace||t.start-o.end>1))return null}const l=s==null?void 0:s.playerQueue;if(l)for(let u=l.length;u--;){const d=l[u].interstitial;if(d.appendInPlace&&t.start>=d.startTime&&t.end<=d.resumeTime)return null}}return t}mapToInitFragWhenRequired(t){return t!=null&&t.initSegment&&!t.initSegment.data&&!this.bitrateTest?t.initSegment:t}getNextPart(t,n,s){let o=-1,l=!1,u=!0;for(let d=0,_=t.length;d<_;d++){const g=t[d];if(u=u&&!g.independent,o>-1&&s<g.start)break;const v=g.loaded;v?o=-1:(l||(g.independent||u)&&g.fragment===n)&&(g.fragment!==n&&this.warn(`Need buffer at ${s} but next unloaded part starts at ${g.start}`),o=d),l=v}return o}loadedEndOfParts(t,n){let s;for(let o=t.length;o--;){if(s=t[o],!s.loaded)return!1;if(n>s.start)return!0}return!1}getInitialLiveFragment(t){const n=t.fragments,s=this.fragPrevious;let o=null;if(s){if(t.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),o=Ii(n,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!o){const l=s.sn+1;if(l>=t.startSN&&l<=t.endSN){const u=n[l-t.startSN];s.cc===u.cc&&(o=u,this.log(`Live playlist, switching playlist, load frag with next SN: ${o.sn}`))}o||(o=Gi(t,s.cc,s.end),o&&this.log(`Live playlist, switching playlist, load frag with same CC: ${o.sn}`))}}else{const l=this.hls.liveSyncPosition;l!==null&&(o=this.getFragmentAtPosition(l,this.bitrateTest?t.fragmentEnd:t.edge,t))}return o}getFragmentAtPosition(t,n,s){const{config:o}=this;let{fragPrevious:l}=this,{fragments:u,endSN:d}=s;const{fragmentHint:_}=s,{maxFragLookUpTolerance:g}=o,v=s.partList,y=!!(this.loadingParts&&v!=null&&v.length&&_);y&&!this.bitrateTest&&v[v.length-1].fragment.sn===_.sn&&(u=u.concat(_),d=_.sn);let x;if(t<n){var D;const F=t<this.lastCurrentTime||t>n-g||(D=this.media)!=null&&D.paused||!this.startFragRequested?0:g;x=Wi(l,u,t,F)}else x=u[u.length-1];if(x){const C=x.sn-s.startSN,F=this.fragmentTracker.getState(x);if((F===Oi.OK||F===Oi.PARTIAL&&x.gap)&&(l=x),l&&x.sn===l.sn&&(!y||v[0].fragment.sn>x.sn||!s.live)&&x.level===l.level){const J=u[C+1];x.sn<d&&this.fragmentTracker.getState(J)!==Oi.OK?x=J:x=null}}return x}alignPlaylists(t,n,s){const o=t.fragments.length;if(!o)return this.warn("No fragments in live playlist"),0;const l=t.fragmentStart,u=!n,d=t.alignedSliding&&ce(l);if(u||!d&&!l){No(s,t);const _=t.fragmentStart;return this.log(`Live playlist sliding: ${_.toFixed(2)} start-sn: ${n?n.startSN:"na"}->${t.startSN} fragments: ${o}`),_}return l}waitForCdnTuneIn(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,t.partTarget*3)}setStartPosition(t,n){let s=this.startPosition;s<n&&(s=-1);const o=this.timelineOffset;if(s===-1){const l=this.startTimeOffset!==null,u=l?this.startTimeOffset:t.startTimeOffset;u!==null&&ce(u)?(s=n+u,u<0&&(s+=t.edge),s=Math.min(Math.max(n,s),n+t.totalduration),this.log(`Setting startPosition to ${s} for start time offset ${u} found in ${l?"multivariant":"media"} playlist`),this.startPosition=s):t.live?(s=this.hls.liveSyncPosition||n,this.log(`Setting startPosition to -1 to start at live edge ${s}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=s=0),this.lastCurrentTime=s+o}this.nextLoadPosition=s+o}getLoadPosition(){var t;const{media:n}=this;let s=0;return(t=this.hls)!=null&&t.hasEnoughToStart&&n?s=n.currentTime:this.nextLoadPosition>=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(t,n){this.transmuxer&&t.type===this.playlistType&&ze(t)&&t.stats.aborted&&(this.log(`Fragment ${t.sn}${n?" part "+n.index:""} of ${this.playlistLabel()} ${t.level} was aborted`),this.resetFragmentLoading(t))}resetFragmentLoading(t){(!this.fragCurrent||!this.fragContextChanged(t)&&this.state!==pt.FRAG_LOADING_WAITING_RETRY)&&(this.state=pt.IDLE)}onFragmentOrKeyLoadError(t,n){var s;if(n.chunkMeta&&!n.frag){const J=this.getCurrentContext(n.chunkMeta);J&&(n.frag=J.frag)}const o=n.frag;if(!o||o.type!==t||!this.levels)return;if(this.fragContextChanged(o)){var l;this.warn(`Frag load error must match current frag to retry ${o.url} > ${(l=this.fragCurrent)==null?void 0:l.url}`);return}const u=n.details===q.FRAG_GAP;u&&this.fragmentTracker.fragBuffered(o,!0);const d=n.errorAction;if(!d){this.state=pt.ERROR;return}const{action:_,flags:g,retryCount:v=0,retryConfig:y}=d,x=!!y,D=x&&_===Ui.RetryRequest,C=x&&!d.resolved&&g===Qi.MoveAllAlternatesMatchingHost,F=(s=this.hls.latestLevelDetails)==null?void 0:s.live;if(!D&&C&&ze(o)&&!o.endList&&F&&!on(n))this.resetFragmentErrors(t),this.treatAsGap(o),d.resolved=!0;else if((D||C)&&v<y.maxNumRetry){var B;const J=dn((B=n.response)==null?void 0:B.code),ne=vn(y,v);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+ne,this.state=pt.FRAG_LOADING_WAITING_RETRY,d.resolved=!0,J){this.log("Waiting for connection (offline)"),this.retryDate=1/0,n.reason="offline";return}this.warn(`Fragment ${o.sn} of ${t} ${o.level} errored with ${n.details}, retrying loading ${v+1}/${y.maxNumRetry} in ${ne}ms`)}else if(y)if(this.resetFragmentErrors(t),v<y.maxNumRetry)!u&&_!==Ui.RemoveAlternatePermanently&&(d.resolved=!0);else{this.warn(`${n.details} reached or exceeded max retry (${v})`);return}else _===Ui.SendAlternateToPenaltyBox?this.state=pt.WAITING_LEVEL:this.state=pt.ERROR;this.tickImmediate()}checkRetryDate(){const t=self.performance.now(),n=this.retryDate,s=n===1/0;(!n||t>=n||s&&!dn(0))&&(s&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=pt.IDLE)}reduceLengthAndFlushBuffer(t){if(this.state===pt.PARSING||this.state===pt.PARSED){const n=t.frag,s=t.parent,o=this.getFwdBufferInfo(this.mediaBuffer,s),l=o&&o.len>.5;l&&this.reduceMaxBufferLength(o.len,(n==null?void 0:n.duration)||10);const u=!l;return u&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${s} buffer`),n&&(this.fragmentTracker.removeFragment(n),this.nextLoadPosition=n.start),this.resetLoadingState(),u}return!1}resetFragmentErrors(t){t===P.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==pt.STOPPED&&(this.state=pt.IDLE)}afterBufferFlushed(t,n,s){if(!t)return;const o=li.getBuffered(t);this.fragmentTracker.detectEvictedFragments(n,o,s),this.state===pt.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==pt.STOPPED&&(this.state=pt.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=this.levelLastLoaded,n=t?t.details:null;n!=null&&n.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(n,n.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(t){this.log(`Loading context changed while buffering sn ${t.sn} of ${this.playlistLabel()} ${t.level===-1?"<removed>":t.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(t=0){this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)}updateLevelTiming(t,n,s,o){const l=s.details;if(!l){this.warn("level.details undefined");return}if(!Object.keys(t.elementaryStreams).reduce((_,g)=>{const v=t.elementaryStreams[g];if(v){const y=v.endPTS-v.startPTS;if(y<=0)return this.warn(`Could not parse fragment ${t.sn} ${g} duration reliably (${y})`),_||!1;const x=o?0:Ws(l,t,v.startPTS,v.endPTS,v.startDTS,v.endDTS,this);return this.hls.trigger(S.LEVEL_PTS_UPDATED,{details:l,level:s,drift:x,type:g,frag:t,start:v.startPTS,end:v.endPTS}),!0}return _},!1)){var d;if(s.fragmentError===0&&this.treatAsGap(t,s),((d=this.transmuxer)==null?void 0:d.error)===null){const _=new Error(`Found no media in fragment ${t.sn} of ${this.playlistLabel()} ${t.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(_.message),this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.FRAG_PARSING_ERROR,fatal:!1,error:_,frag:t,reason:`Found no media in msn ${t.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=pt.PARSED,this.log(`Parsed ${t.type} sn: ${t.sn}${n?" part: "+n.index:""} of ${this.fragInfo(t,!1,n)})`),this.hls.trigger(S.FRAG_PARSED,{frag:t,part:n})}playlistLabel(){return this.playlistType===P.MAIN?"level":"track"}fragInfo(t,n=!0,s){var o,l;return`${this.playlistLabel()} ${t.level} (${s?"part":"frag"}:[${((o=n&&!s?t.startPTS:(s||t).start)!=null?o:NaN).toFixed(3)}-${((l=n&&!s?t.endPTS:(s||t).end)!=null?l:NaN).toFixed(3)}]${s&&t.type==="main"?"INDEPENDENT="+(s.independent?"YES":"NO"):""}`}treatAsGap(t,n){n&&n.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)}resetTransmuxer(){var t;(t=this.transmuxer)==null||t.reset()}recoverWorkerError(t){t.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(t){const n=this._state;n!==t&&(this._state=t,this.log(`${n}->${t}`))}get state(){return this._state}}function mc(h){return!!h.interstitialsController&&h.enableInterstitialPlayback!==!1}class gc{constructor(){this.chunks=[],this.dataLength=0}push(t){this.chunks.push(t),this.dataLength+=t.length}flush(){const{chunks:t,dataLength:n}=this;let s;if(t.length)t.length===1?s=t[0]:s=Hr(t,n);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function Hr(h,t){const n=new Uint8Array(t);let s=0;for(let o=0;o<h.length;o++){const l=h[o];n.set(l,s),s+=l.length}return n}var Ns={exports:{}},ua;function Lh(){return ua||(ua=1,function(h){var t=Object.prototype.hasOwnProperty,n="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(n=!1));function o(_,g,v){this.fn=_,this.context=g,this.once=v||!1}function l(_,g,v,y,x){if(typeof v!="function")throw new TypeError("The listener must be a function");var D=new o(v,y||_,x),C=n?n+g:g;return _._events[C]?_._events[C].fn?_._events[C]=[_._events[C],D]:_._events[C].push(D):(_._events[C]=D,_._eventsCount++),_}function u(_,g){--_._eventsCount===0?_._events=new s:delete _._events[g]}function d(){this._events=new s,this._eventsCount=0}d.prototype.eventNames=function(){var g=[],v,y;if(this._eventsCount===0)return g;for(y in v=this._events)t.call(v,y)&&g.push(n?y.slice(1):y);return Object.getOwnPropertySymbols?g.concat(Object.getOwnPropertySymbols(v)):g},d.prototype.listeners=function(g){var v=n?n+g:g,y=this._events[v];if(!y)return[];if(y.fn)return[y.fn];for(var x=0,D=y.length,C=new Array(D);x<D;x++)C[x]=y[x].fn;return C},d.prototype.listenerCount=function(g){var v=n?n+g:g,y=this._events[v];return y?y.fn?1:y.length:0},d.prototype.emit=function(g,v,y,x,D,C){var F=n?n+g:g;if(!this._events[F])return!1;var B=this._events[F],J=arguments.length,ne,le;if(B.fn){switch(B.once&&this.removeListener(g,B.fn,void 0,!0),J){case 1:return B.fn.call(B.context),!0;case 2:return B.fn.call(B.context,v),!0;case 3:return B.fn.call(B.context,v,y),!0;case 4:return B.fn.call(B.context,v,y,x),!0;case 5:return B.fn.call(B.context,v,y,x,D),!0;case 6:return B.fn.call(B.context,v,y,x,D,C),!0}for(le=1,ne=new Array(J-1);le<J;le++)ne[le-1]=arguments[le];B.fn.apply(B.context,ne)}else{var Ee=B.length,Ie;for(le=0;le<Ee;le++)switch(B[le].once&&this.removeListener(g,B[le].fn,void 0,!0),J){case 1:B[le].fn.call(B[le].context);break;case 2:B[le].fn.call(B[le].context,v);break;case 3:B[le].fn.call(B[le].context,v,y);break;case 4:B[le].fn.call(B[le].context,v,y,x);break;default:if(!ne)for(Ie=1,ne=new Array(J-1);Ie<J;Ie++)ne[Ie-1]=arguments[Ie];B[le].fn.apply(B[le].context,ne)}}return!0},d.prototype.on=function(g,v,y){return l(this,g,v,y,!1)},d.prototype.once=function(g,v,y){return l(this,g,v,y,!0)},d.prototype.removeListener=function(g,v,y,x){var D=n?n+g:g;if(!this._events[D])return this;if(!v)return u(this,D),this;var C=this._events[D];if(C.fn)C.fn===v&&(!x||C.once)&&(!y||C.context===y)&&u(this,D);else{for(var F=0,B=[],J=C.length;F<J;F++)(C[F].fn!==v||x&&!C[F].once||y&&C[F].context!==y)&&B.push(C[F]);B.length?this._events[D]=B.length===1?B[0]:B:u(this,D)}return this},d.prototype.removeAllListeners=function(g){var v;return g?(v=n?n+g:g,this._events[v]&&u(this,v)):(this._events=new s,this._eventsCount=0),this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prefixed=n,d.EventEmitter=d,h.exports=d}(Ns)),Ns.exports}var _c=Lh(),uu=X(_c);const $o="1.6.13",La={};function Dh(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Ch(){const h=La[$o];if(h)return h.clientCount++,h;const t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),n=self.URL.createObjectURL(t),o={worker:new self.Worker(n),objectURL:n,clientCount:1};return La[$o]=o,o}function Mh(h){const t=La[h];if(t)return t.clientCount++,t;const n=new self.URL(h,self.location.href).href,o={worker:new self.Worker(n),scriptURL:n,clientCount:1};return La[h]=o,o}function cu(h){const t=La[h||$o];if(t&&t.clientCount--===1){const{worker:s,objectURL:o}=t;delete La[h||$o],o&&self.URL.revokeObjectURL(o),s.terminate()}}function vc(h,t){return t+10<=h.length&&h[t]===51&&h[t+1]===68&&h[t+2]===73&&h[t+3]<255&&h[t+4]<255&&h[t+6]<128&&h[t+7]<128&&h[t+8]<128&&h[t+9]<128}function hu(h,t){return t+10<=h.length&&h[t]===73&&h[t+1]===68&&h[t+2]===51&&h[t+3]<255&&h[t+4]<255&&h[t+6]<128&&h[t+7]<128&&h[t+8]<128&&h[t+9]<128}function Ko(h,t){let n=0;return n=(h[t]&127)<<21,n|=(h[t+1]&127)<<14,n|=(h[t+2]&127)<<7,n|=h[t+3]&127,n}function to(h,t){const n=t;let s=0;for(;hu(h,t);){s+=10;const o=Ko(h,t+6);s+=o,vc(h,t+10)&&(s+=10),t+=s}if(s>0)return h.subarray(n,n+s)}function qs(h,t,n,s){const o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],l=t[n+2],u=l>>2&15;if(u>12){const D=new Error(`invalid ADTS sampling index:${u}`);h.emit(S.ERROR,S.ERROR,{type:ge.MEDIA_ERROR,details:q.FRAG_PARSING_ERROR,fatal:!0,error:D,reason:D.message});return}const d=(l>>6&3)+1,_=t[n+3]>>6&3|(l&1)<<2,g="mp4a.40."+d,v=o[u];let y=u;(d===5||d===29)&&(y-=3);const x=[d<<3|(y&14)>>1,(y&1)<<7|_<<3];return se.log(`manifest codec:${s}, parsed codec:${g}, channels:${_}, rate:${v} (ADTS object type:${d} sampling index:${u})`),{config:x,samplerate:v,channelCount:_,codec:g,parsedCodec:g,manifestCodec:s}}function fu(h,t){return h[t]===255&&(h[t+1]&246)===240}function du(h,t){return h[t+1]&1?7:9}function pu(h,t){return(h[t+3]&3)<<11|h[t+4]<<3|(h[t+5]&224)>>>5}function Ih(h,t){return t+5<h.length}function _l(h,t){return t+1<h.length&&fu(h,t)}function Rh(h,t){return Ih(h,t)&&fu(h,t)&&pu(h,t)<=h.length-t}function yc(h,t){if(_l(h,t)){const n=du(h,t);if(t+n>=h.length)return!1;const s=pu(h,t);if(s<=n)return!1;const o=t+s;return o===h.length||_l(h,o)}return!1}function bc(h,t,n,s,o){if(!h.samplerate){const l=qs(t,n,s,o);if(!l)return;k(h,l)}}function xc(h){return 1024*9e4/h}function Ph(h,t){const n=du(h,t);if(t+n<=h.length){const s=pu(h,t)-n;if(s>0)return{headerLength:n,frameLength:s}}}function wc(h,t,n,s,o){const l=xc(h.samplerate),u=s+o*l,d=Ph(t,n);let _;if(d){const{frameLength:y,headerLength:x}=d,D=x+y,C=Math.max(0,n+D-t.length);C?(_=new Uint8Array(D-x),_.set(t.subarray(n+x,t.length),0)):_=t.subarray(n+x,n+D);const F={unit:_,pts:u};return C||h.samples.push(F),{sample:F,length:D,missing:C}}const g=t.length-n;return _=new Uint8Array(g),_.set(t.subarray(n,t.length),0),{sample:{unit:_,pts:u},length:g,missing:-1}}function Oh(h,t){return hu(h,t)&&Ko(h,t+6)+10<=h.length-t}function Fh(h){return h instanceof ArrayBuffer?h:h.byteOffset==0&&h.byteLength==h.buffer.byteLength?h.buffer:new Uint8Array(h).buffer}function Cs(h,t=0,n=1/0){return Sc(h,t,n,Uint8Array)}function Sc(h,t,n,s){const o=ca(h);let l=1;"BYTES_PER_ELEMENT"in s&&(l=s.BYTES_PER_ELEMENT);const u=Bh(h)?h.byteOffset:0,d=(u+h.byteLength)/l,_=(u+t)/l,g=Math.floor(Math.max(0,Math.min(_,d))),v=Math.floor(Math.min(g+Math.max(n,0),d));return new s(o,g,v-g)}function ca(h){return h instanceof ArrayBuffer?h:h.buffer}function Bh(h){return h&&h.buffer instanceof ArrayBuffer&&h.byteLength!==void 0&&h.byteOffset!==void 0}function Ec(h){const t={key:h.type,description:"",data:"",mimeType:null,pictureType:null},n=3;if(h.size<2)return;if(h.data[0]!==n){console.log("Ignore frame with unrecognized character encoding");return}const s=h.data.subarray(1).indexOf(0);if(s===-1)return;const o=At(Cs(h.data,1,s)),l=h.data[2+s],u=h.data.subarray(3+s).indexOf(0);if(u===-1)return;const d=At(Cs(h.data,3+s,u));let _;return o==="-->"?_=At(Cs(h.data,4+s+u)):_=Fh(h.data.subarray(4+s+u)),t.mimeType=o,t.pictureType=l,t.description=d,t.data=_,t}function kc(h){if(h.size<2)return;const t=At(h.data,!0),n=new Uint8Array(h.data.subarray(t.length+1));return{key:h.type,info:t,data:n.buffer}}function Nh(h){if(h.size<2)return;if(h.type==="TXXX"){let n=1;const s=At(h.data.subarray(n),!0);n+=s.length+1;const o=At(h.data.subarray(n));return{key:h.type,info:s,data:o}}const t=At(h.data.subarray(1));return{key:h.type,info:"",data:t}}function Tc(h){if(h.type==="WXXX"){if(h.size<2)return;let n=1;const s=At(h.data.subarray(n),!0);n+=s.length+1;const o=At(h.data.subarray(n));return{key:h.type,info:s,data:o}}const t=At(h.data);return{key:h.type,info:"",data:t}}function $h(h){return h.type==="PRIV"?kc(h):h.type[0]==="W"?Tc(h):h.type==="APIC"?Ec(h):Nh(h)}function Kh(h){const t=String.fromCharCode(h[0],h[1],h[2],h[3]),n=Ko(h,4),s=10;return{type:t,size:n,data:h.subarray(s,s+n)}}const vl=10,Uh=10;function Ac(h){let t=0;const n=[];for(;hu(h,t);){const s=Ko(h,t+6);h[t+5]>>6&1&&(t+=vl),t+=vl;const o=t+s;for(;t+Uh<o;){const l=Kh(h.subarray(t)),u=$h(l);u&&n.push(u),t+=l.size+vl}vc(h,t)&&(t+=vl)}return n}function Lc(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"}function zh(h){if(h.data.byteLength===8){const t=new Uint8Array(h.data),n=t[3]&1;let s=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return s/=45,n&&(s+=4772185884e-2),Math.round(s)}}function mu(h){const t=Ac(h);for(let n=0;n<t.length;n++){const s=t[n];if(Lc(s))return zh(s)}}let hs=function(h){return h.audioId3="org.id3",h.dateRange="com.apple.quicktime.HLS",h.emsg="https://aomedia.org/emsg/ID3",h.misbklv="urn:misb:KLV:bin:1910.1",h}({});function xs(h="",t=9e4){return{type:h,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class gu{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(t,n,s,o){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(t){this.initPTS=t,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(t,n){return!1}appendFrame(t,n,s){}demux(t,n){this.cachedData&&(t=Pt(this.cachedData,t),this.cachedData=null);let s=to(t,0),o=s?s.length:0,l;const u=this._audioTrack,d=this._id3Track,_=s?mu(s):void 0,g=t.length;for((this.basePTS===null||this.frameIndex===0&&ce(_))&&(this.basePTS=Vh(_,n,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&d.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:hs.audioId3,duration:Number.POSITIVE_INFINITY});o<g;){if(this.canParse(t,o)){const v=this.appendFrame(u,t,o);v?(this.frameIndex++,this.lastPTS=v.sample.pts,o+=v.length,l=o):o=g}else Oh(t,o)?(s=to(t,o),d.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:hs.audioId3,duration:Number.POSITIVE_INFINITY}),o+=s.length,l=o):o++;if(o===g&&l!==g){const v=t.slice(l);this.cachedData?this.cachedData=Pt(this.cachedData,v):this.cachedData=v}}return{audioTrack:u,videoTrack:xs(),id3Track:d,textTrack:xs()}}demuxSampleAes(t,n,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(t){const n=this.cachedData;return n&&(this.cachedData=null,this.demux(n,0)),{audioTrack:this._audioTrack,videoTrack:xs(),id3Track:this._id3Track,textTrack:xs()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Vh=(h,t,n)=>{if(ce(h))return h*90;const s=n?n.baseTime*9e4/n.timescale:0;return t*9e4+s};let yl=null;const Gh=[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],Hh=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Uo=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],zo=[0,1,1,4];function _u(h,t,n,s,o){if(n+24>t.length)return;const l=Dc(t,n);if(l&&n+l.frameLength<=t.length){const u=l.samplesPerFrame*9e4/l.sampleRate,d=s+o*u,_={unit:t.subarray(n,n+l.frameLength),pts:d,dts:d};return h.config=[],h.channelCount=l.channelCount,h.samplerate=l.sampleRate,h.samples.push(_),{sample:_,length:l.frameLength,missing:0}}}function Dc(h,t){const n=h[t+1]>>3&3,s=h[t+1]>>1&3,o=h[t+2]>>4&15,l=h[t+2]>>2&3;if(n!==1&&o!==0&&o!==15&&l!==3){const u=h[t+2]>>1&1,d=h[t+3]>>6,_=n===3?3-s:s===3?3:4,g=Gh[_*14+o-1]*1e3,y=Hh[(n===3?0:n===2?1:2)*3+l],x=d===3?1:2,D=Uo[n][s],C=zo[s],F=D*8*C,B=Math.floor(D*g/y+u)*C;if(yl===null){const le=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);yl=le?parseInt(le[1]):0}return!!yl&&yl<=87&&s===2&&g>=224e3&&d===0&&(h[t+3]=h[t+3]|128),{sampleRate:y,channelCount:x,frameLength:B,samplesPerFrame:F}}}function vu(h,t){return h[t]===255&&(h[t+1]&224)===224&&(h[t+1]&6)!==0}function Cc(h,t){return t+1<h.length&&vu(h,t)}function Wh(h,t){return vu(h,t)&&4<=h.length-t}function bl(h,t){if(t+1<h.length&&vu(h,t)){const s=Dc(h,t);let o=4;s!=null&&s.frameLength&&(o=s.frameLength);const l=t+o;return l===h.length||Cc(h,l)}return!1}class jh extends gu{constructor(t,n){super(),this.observer=void 0,this.config=void 0,this.observer=t,this.config=n}resetInitSegment(t,n,s,o){super.resetInitSegment(t,n,s,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:n,duration:o,inputTimeScale:9e4,dropped:0}}static probe(t,n){if(!t)return!1;const s=to(t,0);let o=(s==null?void 0:s.length)||0;if(bl(t,o))return!1;for(let l=t.length;o<l;o++)if(yc(t,o))return n.log("ADTS sync word found !"),!0;return!1}canParse(t,n){return Rh(t,n)}appendFrame(t,n,s){bc(t,this.observer,n,s,t.manifestCodec);const o=wc(t,n,s,this.basePTS,this.frameIndex);if(o&&o.missing===0)return o}}const Mc=(h,t)=>{let n=0,s=5;t+=s;const o=new Uint32Array(1),l=new Uint32Array(1),u=new Uint8Array(1);for(;s>0;){u[0]=h[t];const d=Math.min(s,8),_=8-d;l[0]=4278190080>>>24+_<<_,o[0]=(u[0]&l[0])>>_,n=n?n<<d|o[0]:o[0],t+=1,s-=d}return n};class qh extends gu{constructor(t){super(),this.observer=void 0,this.observer=t}resetInitSegment(t,n,s,o){super.resetInitSegment(t,n,s,o),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:n,duration:o,inputTimeScale:9e4,dropped:0}}canParse(t,n){return n+64<t.length}appendFrame(t,n,s){const o=io(t,n,s,this.basePTS,this.frameIndex);if(o!==-1)return{sample:t.samples[t.samples.length-1],length:o,missing:0}}static probe(t){if(!t)return!1;const n=to(t,0);if(!n)return!1;const s=n.length;return t[s]===11&&t[s+1]===119&&mu(n)!==void 0&&Mc(t,s)<16}}function io(h,t,n,s,o){if(n+8>t.length||t[n]!==11||t[n+1]!==119)return-1;const l=t[n+4]>>6;if(l>=3)return-1;const d=[48e3,44100,32e3][l],_=t[n+4]&63,v=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][_*3+l]*2;if(n+v>t.length)return-1;const y=t[n+6]>>5;let x=0;y===2?x+=2:(y&1&&y!==1&&(x+=2),y&4&&(x+=2));const D=(t[n+6]<<8|t[n+7])>>12-x&1,F=[2,1,2,3,3,4,4,5][y]+D,B=t[n+5]>>3,J=t[n+5]&7,ne=new Uint8Array([l<<6|B<<1|J>>2,(J&3)<<6|y<<3|D<<2|_>>4,_<<4&224]),le=1536/d*9e4,Ee=s+o*le,Ie=t.subarray(n,n+v);return h.config=ne,h.channelCount=F,h.samplerate=d,h.samples.push({unit:Ie,pts:Ee}),v}class yu extends gu{resetInitSegment(t,n,s,o){super.resetInitSegment(t,n,s,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:n,duration:o,inputTimeScale:9e4,dropped:0}}static probe(t){if(!t)return!1;const n=to(t,0);let s=(n==null?void 0:n.length)||0;if(n&&t[s]===11&&t[s+1]===119&&mu(n)!==void 0&&Mc(t,s)<=16)return!1;for(let o=t.length;s<o;s++)if(bl(t,s))return se.log("MPEG Audio sync word found !"),!0;return!1}canParse(t,n){return Wh(t,n)}appendFrame(t,n,s){if(this.basePTS!==null)return _u(t,n,s,this.basePTS,this.frameIndex)}}const Zh=/\/emsg[-/]ID3/i;class Ic{constructor(t,n){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=n}resetTimeStamp(){}resetInitSegment(t,n,s,o){const l=this.videoTrack=xs("video",1),u=this.audioTrack=xs("audio",1),d=this.txtTrack=xs("text",1);if(this.id3Track=xs("id3",1),this.timeOffset=0,!(t!=null&&t.byteLength))return;const _=_t(t);if(_.video){const{id:g,timescale:v,codec:y,supplemental:x}=_.video;l.id=g,l.timescale=d.timescale=v,l.codec=y,l.supplemental=x}if(_.audio){const{id:g,timescale:v,codec:y}=_.audio;u.id=g,u.timescale=v,u.codec=y}d.id=Si.text,l.sampleDuration=0,l.duration=u.duration=o}resetContiguity(){this.remainderData=null}static probe(t){return He(t)}demux(t,n){this.timeOffset=n;let s=t;const o=this.videoTrack,l=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=Pt(this.remainderData,t));const d=Gt(s);this.remainderData=d.remainder,o.samples=d.valid||new Uint8Array}else o.samples=s;const u=this.extractID3Track(o,n);return l.samples=Ae(n,o),{videoTrack:o,audioTrack:this.audioTrack,id3Track:u,textTrack:this.txtTrack}}flush(){const t=this.timeOffset,n=this.videoTrack,s=this.txtTrack;n.samples=this.remainderData||new Uint8Array,this.remainderData=null;const o=this.extractID3Track(n,this.timeOffset);return s.samples=Ae(t,n),{videoTrack:n,audioTrack:xs(),id3Track:o,textTrack:xs()}}extractID3Track(t,n){const s=this.id3Track;if(t.samples.length){const o=ve(t.samples,["emsg"]);o&&o.forEach(l=>{const u=kt(l);if(Zh.test(u.schemeIdUri)){const d=Rc(u,n);let _=u.eventDuration===4294967295?Number.POSITIVE_INFINITY:u.eventDuration/u.timeScale;_<=.001&&(_=Number.POSITIVE_INFINITY);const g=u.payload;s.samples.push({data:g,len:g.byteLength,dts:d,pts:d,type:hs.emsg,duration:_})}else if(this.config.enableEmsgKLVMetadata&&u.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const d=Rc(u,n);s.samples.push({data:u.payload,len:u.payload.byteLength,dts:d,pts:d,type:hs.misbklv,duration:Number.POSITIVE_INFINITY})}})}return s}demuxSampleAes(t,n,s){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 Rc(h,t){return ce(h.presentationTime)?h.presentationTime/h.timeScale:t+h.presentationTimeDelta/h.timeScale}class Yh{constructor(t,n,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new ur(n,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,rn.cbc)}decryptAacSample(t,n,s){const o=t[n].unit;if(o.length<=16)return;const l=o.subarray(16,o.length-o.length%16),u=l.buffer.slice(l.byteOffset,l.byteOffset+l.length);this.decryptBuffer(u).then(d=>{const _=new Uint8Array(d);o.set(_,16),this.decrypter.isSync()||this.decryptAacSamples(t,n+1,s)}).catch(s)}decryptAacSamples(t,n,s){for(;;n++){if(n>=t.length){s();return}if(!(t[n].unit.length<32)&&(this.decryptAacSample(t,n,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(t){const n=Math.floor((t.length-48)/160)*16+16,s=new Int8Array(n);let o=0;for(let l=32;l<t.length-16;l+=160,o+=16)s.set(t.subarray(l,l+16),o);return s}getAvcDecryptedUnit(t,n){const s=new Uint8Array(n);let o=0;for(let l=32;l<t.length-16;l+=160,o+=16)t.set(s.subarray(o,o+16),l);return t}decryptAvcSample(t,n,s,o,l){const u=je(l.data),d=this.getAvcEncryptedData(u);this.decryptBuffer(d.buffer).then(_=>{l.data=this.getAvcDecryptedUnit(u,_),this.decrypter.isSync()||this.decryptAvcSamples(t,n,s+1,o)}).catch(o)}decryptAvcSamples(t,n,s,o){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;n++,s=0){if(n>=t.length){o();return}const l=t[n].units;for(;!(s>=l.length);s++){const u=l[s];if(!(u.data.length<=48||u.type!==1&&u.type!==5)&&(this.decryptAvcSample(t,n,s,o,u),!this.decrypter.isSync()))return}}}}class Pc{constructor(){this.VideoSample=null}createVideoSample(t,n,s){return{key:t,frame:!1,pts:n,dts:s,units:[],length:0}}getLastNalUnit(t){var n;let s=this.VideoSample,o;if((!s||s.units.length===0)&&(s=t[t.length-1]),(n=s)!=null&&n.units){const l=s.units;o=l[l.length-1]}return o}pushAccessUnit(t,n){if(t.units.length&&t.frame){if(t.pts===void 0){const s=n.samples,o=s.length;if(o){const l=s[o-1];t.pts=l.pts,t.dts=l.dts}else{n.dropped++;return}}n.samples.push(t)}}parseNALu(t,n,s){const o=n.byteLength;let l=t.naluState||0;const u=l,d=[];let _=0,g,v,y,x=-1,D=0;for(l===-1&&(x=0,D=this.getNALuType(n,0),l=0,_=1);_<o;){if(g=n[_++],!l){l=g?0:1;continue}if(l===1){l=g?0:2;continue}if(!g)l=3;else if(g===1){if(v=_-l-1,x>=0){const C={data:n.subarray(x,v),type:D};d.push(C)}else{const C=this.getLastNalUnit(t.samples);C&&(u&&_<=4-u&&C.state&&(C.data=C.data.subarray(0,C.data.byteLength-u)),v>0&&(C.data=Pt(C.data,n.subarray(0,v)),C.state=0))}_<o?(y=this.getNALuType(n,_),x=_,D=y,l=0):l=-1}else l=0}if(x>=0&&l>=0){const C={data:n.subarray(x,o),type:D,state:l};d.push(C)}if(d.length===0){const C=this.getLastNalUnit(t.samples);C&&(C.data=Pt(C.data,n))}return t.naluState=l,d}}class Da{constructor(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const t=this.data,n=this.bytesAvailable,s=t.byteLength-n,o=new Uint8Array(4),l=Math.min(4,n);if(l===0)throw new Error("no bytes available");o.set(t.subarray(s,s+l)),this.word=new DataView(o.buffer).getUint32(0),this.bitsAvailable=l*8,this.bytesAvailable-=l}skipBits(t){let n;t=Math.min(t,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,n=t>>3,t-=n<<3,this.bytesAvailable-=n,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}readBits(t){let n=Math.min(this.bitsAvailable,t);const s=this.word>>>32-n;if(t>32&&se.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=n,this.bitsAvailable>0)this.word<<=n;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return n=t-n,n>0&&this.bitsAvailable?s<<n|this.readBits(n):s}skipLZ(){let t;for(t=0;t<this.bitsAvailable;++t)if(this.word&2147483648>>>t)return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const t=this.skipLZ();return this.readBits(t+1)-1}readEG(){const t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class bu extends Pc{parsePES(t,n,s,o){const l=this.parseNALu(t,s.data,o);let u=this.VideoSample,d,_=!1;s.data=null,u&&l.length&&!t.audFound&&(this.pushAccessUnit(u,t),u=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),l.forEach(g=>{var v,y;switch(g.type){case 1:{let F=!1;d=!0;const B=g.data;if(_&&B.length>4){const J=this.readSliceType(B);(J===2||J===4||J===7||J===9)&&(F=!0)}if(F){var x;(x=u)!=null&&x.frame&&!u.key&&(this.pushAccessUnit(u,t),u=this.VideoSample=null)}u||(u=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),u.frame=!0,u.key=F;break}case 5:d=!0,(v=u)!=null&&v.frame&&!u.key&&(this.pushAccessUnit(u,t),u=this.VideoSample=null),u||(u=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),u.key=!0,u.frame=!0;break;case 6:{d=!0,ut(g.data,1,s.pts,n.samples);break}case 7:{var D,C;d=!0,_=!0;const F=g.data,B=this.readSPS(F);if(!t.sps||t.width!==B.width||t.height!==B.height||((D=t.pixelRatio)==null?void 0:D[0])!==B.pixelRatio[0]||((C=t.pixelRatio)==null?void 0:C[1])!==B.pixelRatio[1]){t.width=B.width,t.height=B.height,t.pixelRatio=B.pixelRatio,t.sps=[F];const J=F.subarray(1,4);let ne="avc1.";for(let le=0;le<3;le++){let Ee=J[le].toString(16);Ee.length<2&&(Ee="0"+Ee),ne+=Ee}t.codec=ne}break}case 8:d=!0,t.pps=[g.data];break;case 9:d=!0,t.audFound=!0,(y=u)!=null&&y.frame&&(this.pushAccessUnit(u,t),u=null),u||(u=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:d=!0;break;default:d=!1;break}u&&d&&u.units.push(g)}),o&&u&&(this.pushAccessUnit(u,t),this.VideoSample=null)}getNALuType(t,n){return t[n]&31}readSliceType(t){const n=new Da(t);return n.readUByte(),n.readUEG(),n.readUEG()}skipScalingList(t,n){let s=8,o=8,l;for(let u=0;u<t;u++)o!==0&&(l=n.readEG(),o=(s+l+256)%256),s=o===0?s:o}readSPS(t){const n=new Da(t);let s=0,o=0,l=0,u=0,d,_,g;const v=n.readUByte.bind(n),y=n.readBits.bind(n),x=n.readUEG.bind(n),D=n.readBoolean.bind(n),C=n.skipBits.bind(n),F=n.skipEG.bind(n),B=n.skipUEG.bind(n),J=this.skipScalingList.bind(this);v();const ne=v();if(y(5),C(3),v(),B(),ne===100||ne===110||ne===122||ne===244||ne===44||ne===83||ne===86||ne===118||ne===128){const Ye=x();if(Ye===3&&C(1),B(),B(),C(1),D())for(_=Ye!==3?8:12,g=0;g<_;g++)D()&&(g<6?J(16,n):J(64,n))}B();const le=x();if(le===0)x();else if(le===1)for(C(1),F(),F(),d=x(),g=0;g<d;g++)F();B(),C(1);const Ee=x(),Ie=x(),tt=y(1);tt===0&&C(1),C(1),D()&&(s=x(),o=x(),l=x(),u=x());let Pe=[1,1];if(D()&&D())switch(v()){case 1:Pe=[1,1];break;case 2:Pe=[12,11];break;case 3:Pe=[10,11];break;case 4:Pe=[16,11];break;case 5:Pe=[40,33];break;case 6:Pe=[24,11];break;case 7:Pe=[20,11];break;case 8:Pe=[32,11];break;case 9:Pe=[80,33];break;case 10:Pe=[18,11];break;case 11:Pe=[15,11];break;case 12:Pe=[64,33];break;case 13:Pe=[160,99];break;case 14:Pe=[4,3];break;case 15:Pe=[3,2];break;case 16:Pe=[2,1];break;case 255:{Pe=[v()<<8|v(),v()<<8|v()];break}}return{width:Math.ceil((Ee+1)*16-s*2-o*2),height:(2-tt)*(Ie+1)*16-(tt?2:4)*(l+u),pixelRatio:Pe}}}class xu extends Pc{constructor(...t){super(...t),this.initVPS=null}parsePES(t,n,s,o){const l=this.parseNALu(t,s.data,o);let u=this.VideoSample,d,_=!1;s.data=null,u&&l.length&&!t.audFound&&(this.pushAccessUnit(u,t),u=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),l.forEach(g=>{var v,y;switch(g.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:u||(u=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),u.frame=!0,d=!0;break;case 16:case 17:case 18:case 21:if(d=!0,_){var x;(x=u)!=null&&x.frame&&!u.key&&(this.pushAccessUnit(u,t),u=this.VideoSample=null)}u||(u=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),u.key=!0,u.frame=!0;break;case 19:case 20:d=!0,(v=u)!=null&&v.frame&&!u.key&&(this.pushAccessUnit(u,t),u=this.VideoSample=null),u||(u=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),u.key=!0,u.frame=!0;break;case 39:d=!0,ut(g.data,2,s.pts,n.samples);break;case 32:d=!0,t.vps||(typeof t.params!="object"&&(t.params={}),t.params=k(t.params,this.readVPS(g.data)),this.initVPS=g.data),t.vps=[g.data];break;case 33:if(d=!0,_=!0,t.vps!==void 0&&t.vps[0]!==this.initVPS&&t.sps!==void 0&&!this.matchSPS(t.sps[0],g.data)&&(this.initVPS=t.vps[0],t.sps=t.pps=void 0),!t.sps){const D=this.readSPS(g.data);t.width=D.width,t.height=D.height,t.pixelRatio=D.pixelRatio,t.codec=D.codecString,t.sps=[],typeof t.params!="object"&&(t.params={});for(const C in D.params)t.params[C]=D.params[C]}this.pushParameterSet(t.sps,g.data,t.vps),u||(u=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),u.key=!0;break;case 34:if(d=!0,typeof t.params=="object"){if(!t.pps){t.pps=[];const D=this.readPPS(g.data);for(const C in D)t.params[C]=D[C]}this.pushParameterSet(t.pps,g.data,t.vps)}break;case 35:d=!0,t.audFound=!0,(y=u)!=null&&y.frame&&(this.pushAccessUnit(u,t),u=null),u||(u=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;default:d=!1;break}u&&d&&u.units.push(g)}),o&&u&&(this.pushAccessUnit(u,t),this.VideoSample=null)}pushParameterSet(t,n,s){(s&&s[0]===this.initVPS||!s&&!t.length)&&t.push(n)}getNALuType(t,n){return(t[n]&126)>>>1}ebsp2rbsp(t){const n=new Uint8Array(t.byteLength);let s=0;for(let o=0;o<t.byteLength;o++)o>=2&&t[o]===3&&t[o-1]===0&&t[o-2]===0||(n[s]=t[o],s++);return new Uint8Array(n.buffer,0,s)}pushAccessUnit(t,n){super.pushAccessUnit(t,n),this.initVPS&&(this.initVPS=null)}readVPS(t){const n=new Da(t);n.readUByte(),n.readUByte(),n.readBits(4),n.skipBits(2),n.readBits(6);const s=n.readBits(3),o=n.readBoolean();return{numTemporalLayers:s+1,temporalIdNested:o}}readSPS(t){const n=new Da(this.ebsp2rbsp(t));n.readUByte(),n.readUByte(),n.readBits(4);const s=n.readBits(3);n.readBoolean();const o=n.readBits(2),l=n.readBoolean(),u=n.readBits(5),d=n.readUByte(),_=n.readUByte(),g=n.readUByte(),v=n.readUByte(),y=n.readUByte(),x=n.readUByte(),D=n.readUByte(),C=n.readUByte(),F=n.readUByte(),B=n.readUByte(),J=n.readUByte(),ne=[],le=[];for(let Dn=0;Dn<s;Dn++)ne.push(n.readBoolean()),le.push(n.readBoolean());if(s>0)for(let Dn=s;Dn<8;Dn++)n.readBits(2);for(let Dn=0;Dn<s;Dn++)ne[Dn]&&(n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte()),le[Dn]&&n.readUByte();n.readUEG();const Ee=n.readUEG();Ee==3&&n.skipBits(1);const Ie=n.readUEG(),tt=n.readUEG(),Pe=n.readBoolean();let Ye=0,qe=0,Fe=0,mt=0;Pe&&(Ye+=n.readUEG(),qe+=n.readUEG(),Fe+=n.readUEG(),mt+=n.readUEG());const Zt=n.readUEG(),ui=n.readUEG(),xi=n.readUEG(),si=n.readBoolean();for(let Dn=si?0:s;Dn<=s;Dn++)n.skipUEG(),n.skipUEG(),n.skipUEG();if(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.readBoolean()&&n.readBoolean())for(let ts=0;ts<4;ts++)for(let Os=0;Os<(ts===3?2:6);Os++)if(!n.readBoolean())n.readUEG();else{const ms=Math.min(64,1<<4+(ts<<1));ts>1&&n.readEG();for(let $a=0;$a<ms;$a++)n.readEG()}n.readBoolean(),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.skipUEG(),n.skipUEG(),n.readBoolean());const ei=n.readUEG();let gi=0;for(let Dn=0;Dn<ei;Dn++){let ts=!1;if(Dn!==0&&(ts=n.readBoolean()),ts){Dn===ei&&n.readUEG(),n.readBoolean(),n.readUEG();let Os=0;for(let xo=0;xo<=gi;xo++){const ms=n.readBoolean();let $a=!1;ms||($a=n.readBoolean()),(ms||$a)&&Os++}gi=Os}else{const Os=n.readUEG(),xo=n.readUEG();gi=Os+xo;for(let ms=0;ms<Os;ms++)n.readUEG(),n.readBoolean();for(let ms=0;ms<xo;ms++)n.readUEG(),n.readBoolean()}}if(n.readBoolean()){const Dn=n.readUEG();for(let ts=0;ts<Dn;ts++){for(let Os=0;Os<xi+4;Os++)n.readBits(1);n.readBits(1)}}let Ut=0,qt=1,Zi=1,Fn=!0,_i=1,xn=0;n.readBoolean(),n.readBoolean();let qr=!1;if(n.readBoolean()){if(n.readBoolean()){const wo=n.readUByte(),fh=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],So=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];wo>0&&wo<16?(qt=fh[wo-1],Zi=So[wo-1]):wo===255&&(qt=n.readBits(16),Zi=n.readBits(16))}if(n.readBoolean()&&n.readBoolean(),n.readBoolean()&&(n.readBits(3),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.readUByte(),n.readUByte())),n.readBoolean()&&(n.readUEG(),n.readUEG()),n.readBoolean(),n.readBoolean(),n.readBoolean(),qr=n.readBoolean(),qr&&(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG()),n.readBoolean()&&(_i=n.readBits(32),xn=n.readBits(32),n.readBoolean()&&n.readUEG(),n.readBoolean())){const So=n.readBoolean(),nl=n.readBoolean();let rl=!1;(So||nl)&&(rl=n.readBoolean(),rl&&(n.readUByte(),n.readBits(5),n.readBoolean(),n.readBits(5)),n.readBits(4),n.readBits(4),rl&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5));for(let sl=0;sl<=s;sl++){Fn=n.readBoolean();const f0=Fn||n.readBoolean();let dh=!1;f0?n.readEG():dh=n.readBoolean();const jf=dh?1:n.readUEG()+1;if(So)for(let jl=0;jl<jf;jl++)n.readUEG(),n.readUEG(),rl&&(n.readUEG(),n.readUEG()),n.skipBits(1);if(nl)for(let jl=0;jl<jf;jl++)n.readUEG(),n.readUEG(),rl&&(n.readUEG(),n.readUEG()),n.skipBits(1)}}n.readBoolean()&&(n.readBoolean(),n.readBoolean(),n.readBoolean(),Ut=n.readUEG())}let os=Ie,ta=tt;if(Pe){let Dn=1,ts=1;Ee===1?Dn=ts=2:Ee==2&&(Dn=2),os=Ie-Dn*qe-Dn*Ye,ta=tt-ts*mt-ts*Fe}const Na=o?["A","B","C"][o]:"",ia=d<<24|_<<16|g<<8|v;let es=0;for(let Dn=0;Dn<32;Dn++)es=(es|(ia>>Dn&1)<<31-Dn)>>>0;let Hl=es.toString(16);return u===1&&Hl==="2"&&(Hl="6"),{codecString:`hvc1.${Na}${u}.${Hl}.${l?"H":"L"}${J}.B0`,params:{general_tier_flag:l,general_profile_idc:u,general_profile_space:o,general_profile_compatibility_flags:[d,_,g,v],general_constraint_indicator_flags:[y,x,D,C,F,B],general_level_idc:J,bit_depth:Zt+8,bit_depth_luma_minus8:Zt,bit_depth_chroma_minus8:ui,min_spatial_segmentation_idc:Ut,chroma_format_idc:Ee,frame_rate:{fixed:Fn,fps:xn/_i}},width:os,height:ta,pixelRatio:[qt,Zi]}}readPPS(t){const n=new Da(this.ebsp2rbsp(t));n.readUByte(),n.readUByte(),n.skipUEG(),n.skipUEG(),n.skipBits(2),n.skipBits(3),n.skipBits(2),n.skipUEG(),n.skipUEG(),n.skipEG(),n.skipBits(2),n.readBoolean()&&n.skipUEG(),n.skipEG(),n.skipEG(),n.skipBits(4);const o=n.readBoolean(),l=n.readBoolean();let u=1;return l&&o?u=0:l?u=3:o&&(u=2),{parallelismType:u}}matchSPS(t,n){return String.fromCharCode.apply(null,t).substr(3)===String.fromCharCode.apply(null,n).substr(3)}}const Cr=188;class ha{constructor(t,n,s,o){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=t,this.config=n,this.typeSupported=s,this.logger=o,this.videoParser=null}static probe(t,n){const s=ha.syncOffset(t);return s>0&&n.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(t){const n=t.length;let s=Math.min(Cr*5,n-Cr)+1,o=0;for(;o<s;){let l=!1,u=-1,d=0;for(let _=o;_<n;_+=Cr)if(t[_]===71&&(n-_===Cr||t[_+Cr]===71)){if(d++,u===-1&&(u=_,u!==0&&(s=Math.min(u+Cr*99,t.length-Cr)+1)),l||(l=wu(t,_)===0),l&&d>1&&(u===0&&d>2||_+Cr>s))return u}else{if(d)return-1;break}o++}return-1}static createTrack(t,n){return{container:t==="video"||t==="audio"?"video/mp2t":void 0,type:t,id:Si[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:t==="audio"?n:void 0}}resetInitSegment(t,n,s,o){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=ha.createTrack("video"),this._videoTrack.duration=o,this._audioTrack=ha.createTrack("audio",o),this._id3Track=ha.createTrack("id3"),this._txtTrack=ha.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=n,this.videoCodec=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:t,_videoTrack:n,_id3Track:s}=this;t&&(t.pesData=null),n&&(n.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,n,s=!1,o=!1){s||(this.sampleAes=null);let l;const u=this._videoTrack,d=this._audioTrack,_=this._id3Track,g=this._txtTrack;let v=u.pid,y=u.pesData,x=d.pid,D=_.pid,C=d.pesData,F=_.pesData,B=null,J=this.pmtParsed,ne=this._pmtId,le=t.length;if(this.remainderData&&(t=Pt(this.remainderData,t),le=t.length,this.remainderData=null),le<Cr&&!o)return this.remainderData=t,{audioTrack:d,videoTrack:u,id3Track:_,textTrack:g};const Ee=Math.max(0,ha.syncOffset(t));le-=(le-Ee)%Cr,le<t.byteLength&&!o&&(this.remainderData=new Uint8Array(t.buffer,le,t.buffer.byteLength-le));let Ie=0;for(let Pe=Ee;Pe<le;Pe+=Cr)if(t[Pe]===71){const Ye=!!(t[Pe+1]&64),qe=wu(t,Pe),Fe=(t[Pe+3]&48)>>4;let mt;if(Fe>1){if(mt=Pe+5+t[Pe+4],mt===Pe+Cr)continue}else mt=Pe+4;switch(qe){case v:Ye&&(y&&(l=no(y,this.logger))&&(this.readyVideoParser(u.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(u,g,l,!1)),y={data:[],size:0}),y&&(y.data.push(t.subarray(mt,Pe+Cr)),y.size+=Pe+Cr-mt);break;case x:if(Ye){if(C&&(l=no(C,this.logger)))switch(d.segmentCodec){case"aac":this.parseAACPES(d,l);break;case"mp3":this.parseMPEGPES(d,l);break;case"ac3":this.parseAC3PES(d,l);break}C={data:[],size:0}}C&&(C.data.push(t.subarray(mt,Pe+Cr)),C.size+=Pe+Cr-mt);break;case D:Ye&&(F&&(l=no(F,this.logger))&&this.parseID3PES(_,l),F={data:[],size:0}),F&&(F.data.push(t.subarray(mt,Pe+Cr)),F.size+=Pe+Cr-mt);break;case 0:Ye&&(mt+=t[mt]+1),ne=this._pmtId=Su(t,mt);break;case ne:{Ye&&(mt+=t[mt]+1);const Zt=Eu(t,mt,this.typeSupported,s,this.observer,this.logger);v=Zt.videoPid,v>0&&(u.pid=v,u.segmentCodec=Zt.segmentVideoCodec),x=Zt.audioPid,x>0&&(d.pid=x,d.segmentCodec=Zt.segmentAudioCodec),D=Zt.id3Pid,D>0&&(_.pid=D),B!==null&&!J&&(this.logger.warn(`MPEG-TS PMT found at ${Pe} after unknown PID '${B}'. Backtracking to sync byte @${Ee} to parse all TS packets.`),B=null,Pe=Ee-188),J=this.pmtParsed=!0;break}case 17:case 8191:break;default:B=qe;break}}else Ie++;Ie>0&&Vo(this.observer,new Error(`Found ${Ie} TS packet/s that do not start with 0x47`),void 0,this.logger),u.pesData=y,d.pesData=C,_.pesData=F;const tt={audioTrack:d,videoTrack:u,id3Track:_,textTrack:g};return o&&this.extractRemainingSamples(tt),tt}flush(){const{remainderData:t}=this;this.remainderData=null;let n;return t?n=this.demux(t,-1,!1,!0):n={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(n),this.sampleAes?this.decrypt(n,this.sampleAes):n}extractRemainingSamples(t){const{audioTrack:n,videoTrack:s,id3Track:o,textTrack:l}=t,u=s.pesData,d=n.pesData,_=o.pesData;let g;if(u&&(g=no(u,this.logger))?(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(s,l,g,!0),s.pesData=null)):s.pesData=u,d&&(g=no(d,this.logger))){switch(n.segmentCodec){case"aac":this.parseAACPES(n,g);break;case"mp3":this.parseMPEGPES(n,g);break;case"ac3":this.parseAC3PES(n,g);break}n.pesData=null}else d!=null&&d.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),n.pesData=d;_&&(g=no(_,this.logger))?(this.parseID3PES(o,g),o.pesData=null):o.pesData=_}demuxSampleAes(t,n,s){const o=this.demux(t,s,!0,!this.config.progressive),l=this.sampleAes=new Yh(this.observer,this.config,n);return this.decrypt(o,l)}readyVideoParser(t){this.videoParser===null&&(t==="avc"?this.videoParser=new bu:t==="hevc"&&(this.videoParser=new xu))}decrypt(t,n){return new Promise(s=>{const{audioTrack:o,videoTrack:l}=t;o.samples&&o.segmentCodec==="aac"?n.decryptAacSamples(o.samples,0,()=>{l.samples?n.decryptAvcSamples(l.samples,0,0,()=>{s(t)}):s(t)}):l.samples&&n.decryptAvcSamples(l.samples,0,0,()=>{s(t)})})}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(t,n){let s=0;const o=this.aacOverFlow;let l=n.data;if(o){this.aacOverFlow=null;const y=o.missing,x=o.sample.unit.byteLength;if(y===-1)l=Pt(o.sample.unit,l);else{const D=x-y;o.sample.unit.set(l.subarray(0,y),D),t.samples.push(o.sample),s=o.missing}}let u,d;for(u=s,d=l.length;u<d-1&&!_l(l,u);u++);if(u!==s){let y;const x=u<d-1;if(x?y=`AAC PES did not start with ADTS header,offset:${u}`:y="No ADTS header found in AAC PES",Vo(this.observer,new Error(y),x,this.logger),!x)return}bc(t,this.observer,l,u,this.audioCodec);let _;if(n.pts!==void 0)_=n.pts;else if(o){const y=xc(t.samplerate);_=o.sample.pts+y}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let g=0,v;for(;u<d;)if(v=wc(t,l,u,_,g),u+=v.length,v.missing){this.aacOverFlow=v;break}else for(g++;u<d-1&&!_l(l,u);u++);}parseMPEGPES(t,n){const s=n.data,o=s.length;let l=0,u=0;const d=n.pts;if(d===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<o;)if(Cc(s,u)){const _=_u(t,s,u,d,l);if(_)u+=_.length,l++;else break}else u++}parseAC3PES(t,n){{const s=n.data,o=n.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const l=s.length;let u=0,d=0,_;for(;d<l&&(_=io(t,s,d,o,u++))>0;)d+=_}}parseID3PES(t,n){if(n.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=k({},n,{type:this._videoTrack?hs.emsg:hs.audioId3,duration:Number.POSITIVE_INFINITY});t.samples.push(s)}}function wu(h,t){return((h[t+1]&31)<<8)+h[t+2]}function Su(h,t){return(h[t+10]&31)<<8|h[t+11]}function Eu(h,t,n,s,o,l){const u={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},d=(h[t+1]&15)<<8|h[t+2],_=t+3+d-4,g=(h[t+10]&15)<<8|h[t+11];for(t+=12+g;t<_;){const v=wu(h,t),y=(h[t+3]&15)<<8|h[t+4];switch(h[t]){case 207:if(!s){Go("ADTS AAC",l);break}case 15:u.audioPid===-1&&(u.audioPid=v);break;case 21:u.id3Pid===-1&&(u.id3Pid=v);break;case 219:if(!s){Go("H.264",l);break}case 27:u.videoPid===-1&&(u.videoPid=v);break;case 3:case 4:!n.mpeg&&!n.mp3?l.log("MPEG audio found, not supported in this browser"):u.audioPid===-1&&(u.audioPid=v,u.segmentAudioCodec="mp3");break;case 193:if(!s){Go("AC-3",l);break}case 129:n.ac3?u.audioPid===-1&&(u.audioPid=v,u.segmentAudioCodec="ac3"):l.log("AC-3 audio found, not supported in this browser");break;case 6:if(u.audioPid===-1&&y>0){let x=t+5,D=y;for(;D>2;){switch(h[x]){case 106:n.ac3!==!0?l.log("AC-3 audio found, not supported in this browser for now"):(u.audioPid=v,u.segmentAudioCodec="ac3");break}const F=h[x+1]+2;x+=F,D-=F}}break;case 194:case 135:return Vo(o,new Error("Unsupported EC-3 in M2TS found"),void 0,l),u;case 36:u.videoPid===-1&&(u.videoPid=v,u.segmentVideoCodec="hevc",l.log("HEVC in M2TS found"));break}t+=y+5}return u}function Vo(h,t,n,s){s.warn(`parsing error: ${t.message}`),h.emit(S.ERROR,S.ERROR,{type:ge.MEDIA_ERROR,details:q.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:t,reason:t.message})}function Go(h,t){t.log(`${h} with AES-128-CBC encryption found in unencrypted stream`)}function no(h,t){let n=0,s,o,l,u,d;const _=h.data;if(!h||h.size===0)return null;for(;_[0].length<19&&_.length>1;)_[0]=Pt(_[0],_[1]),_.splice(1,1);if(s=_[0],(s[0]<<16)+(s[1]<<8)+s[2]===1){if(o=(s[4]<<8)+s[5],o&&o>h.size-6)return null;const v=s[7];v&192&&(u=(s[9]&14)*536870912+(s[10]&255)*4194304+(s[11]&254)*16384+(s[12]&255)*128+(s[13]&254)/2,v&64?(d=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,u-d>60*9e4&&(t.warn(`${Math.round((u-d)/9e4)}s delta between PTS and DTS, align them`),u=d)):d=u),l=s[8];let y=l+9;if(h.size<=y)return null;h.size-=y;const x=new Uint8Array(h.size);for(let D=0,C=_.length;D<C;D++){s=_[D];let F=s.byteLength;if(y)if(y>F){y-=F;continue}else s=s.subarray(y),F-=y,y=0;x.set(s,n),n+=F}return o&&(o-=l+3),{data:x,pts:u,dts:d,len:o}}return null}class Oc{static getSilentFrame(t,n){switch(t){case"mp4a.40.2":if(n===1)return new Uint8Array([0,200,0,128,35,128]);if(n===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(n===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(n===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(n===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(n===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(n===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(n===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(n===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 $s=Math.pow(2,32)-1;class Ve{static init(){Ve.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 t;for(t in Ve.types)Ve.types.hasOwnProperty(t)&&(Ve.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);const n=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]),s=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]);Ve.HDLR_TYPES={video:n,audio:s};const o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),l=new Uint8Array([0,0,0,0,0,0,0,0]);Ve.STTS=Ve.STSC=Ve.STCO=l,Ve.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Ve.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Ve.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Ve.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const u=new Uint8Array([105,115,111,109]),d=new Uint8Array([97,118,99,49]),_=new Uint8Array([0,0,0,1]);Ve.FTYP=Ve.box(Ve.types.ftyp,u,_,u,d),Ve.DINF=Ve.box(Ve.types.dinf,Ve.box(Ve.types.dref,o))}static box(t,...n){let s=8,o=n.length;const l=o;for(;o--;)s+=n[o].byteLength;const u=new Uint8Array(s);for(u[0]=s>>24&255,u[1]=s>>16&255,u[2]=s>>8&255,u[3]=s&255,u.set(t,4),o=0,s=8;o<l;o++)u.set(n[o],s),s+=n[o].byteLength;return u}static hdlr(t){return Ve.box(Ve.types.hdlr,Ve.HDLR_TYPES[t])}static mdat(t){return Ve.box(Ve.types.mdat,t)}static mdhd(t,n){n*=t;const s=Math.floor(n/($s+1)),o=Math.floor(n%($s+1));return Ve.box(Ve.types.mdhd,new Uint8Array([1,0,0,0,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,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255,85,196,0,0]))}static mdia(t){return Ve.box(Ve.types.mdia,Ve.mdhd(t.timescale||0,t.duration||0),Ve.hdlr(t.type),Ve.minf(t))}static mfhd(t){return Ve.box(Ve.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]))}static minf(t){return t.type==="audio"?Ve.box(Ve.types.minf,Ve.box(Ve.types.smhd,Ve.SMHD),Ve.DINF,Ve.stbl(t)):Ve.box(Ve.types.minf,Ve.box(Ve.types.vmhd,Ve.VMHD),Ve.DINF,Ve.stbl(t))}static moof(t,n,s){return Ve.box(Ve.types.moof,Ve.mfhd(t),Ve.traf(s,n))}static moov(t){let n=t.length;const s=[];for(;n--;)s[n]=Ve.trak(t[n]);return Ve.box.apply(null,[Ve.types.moov,Ve.mvhd(t[0].timescale||0,t[0].duration||0)].concat(s).concat(Ve.mvex(t)))}static mvex(t){let n=t.length;const s=[];for(;n--;)s[n]=Ve.trex(t[n]);return Ve.box.apply(null,[Ve.types.mvex,...s])}static mvhd(t,n){n*=t;const s=Math.floor(n/($s+1)),o=Math.floor(n%($s+1)),l=new Uint8Array([1,0,0,0,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,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&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 Ve.box(Ve.types.mvhd,l)}static sdtp(t){const n=t.samples||[],s=new Uint8Array(4+n.length);let o,l;for(o=0;o<n.length;o++)l=n[o].flags,s[o+4]=l.dependsOn<<4|l.isDependedOn<<2|l.hasRedundancy;return Ve.box(Ve.types.sdtp,s)}static stbl(t){return Ve.box(Ve.types.stbl,Ve.stsd(t),Ve.box(Ve.types.stts,Ve.STTS),Ve.box(Ve.types.stsc,Ve.STSC),Ve.box(Ve.types.stsz,Ve.STSZ),Ve.box(Ve.types.stco,Ve.STCO))}static avc1(t){let n=[],s=[],o,l,u;for(o=0;o<t.sps.length;o++)l=t.sps[o],u=l.byteLength,n.push(u>>>8&255),n.push(u&255),n=n.concat(Array.prototype.slice.call(l));for(o=0;o<t.pps.length;o++)l=t.pps[o],u=l.byteLength,s.push(u>>>8&255),s.push(u&255),s=s.concat(Array.prototype.slice.call(l));const d=Ve.box(Ve.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(s))),_=t.width,g=t.height,v=t.pixelRatio[0],y=t.pixelRatio[1];return Ve.box(Ve.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,_>>8&255,_&255,g>>8&255,g&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]),d,Ve.box(Ve.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ve.box(Ve.types.pasp,new Uint8Array([v>>24,v>>16&255,v>>8&255,v&255,y>>24,y>>16&255,y>>8&255,y&255])))}static esds(t){const n=t.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,...n,6,1,2])}static audioStsd(t){const n=t.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount||0,0,16,0,0,0,0,n>>8&255,n&255,0,0])}static mp4a(t){return Ve.box(Ve.types.mp4a,Ve.audioStsd(t),Ve.box(Ve.types.esds,Ve.esds(t)))}static mp3(t){return Ve.box(Ve.types[".mp3"],Ve.audioStsd(t))}static ac3(t){return Ve.box(Ve.types["ac-3"],Ve.audioStsd(t),Ve.box(Ve.types.dac3,t.config))}static stsd(t){const{segmentCodec:n}=t;if(t.type==="audio"){if(n==="aac")return Ve.box(Ve.types.stsd,Ve.STSD,Ve.mp4a(t));if(n==="ac3"&&t.config)return Ve.box(Ve.types.stsd,Ve.STSD,Ve.ac3(t));if(n==="mp3"&&t.codec==="mp3")return Ve.box(Ve.types.stsd,Ve.STSD,Ve.mp3(t))}else if(t.pps&&t.sps){if(n==="avc")return Ve.box(Ve.types.stsd,Ve.STSD,Ve.avc1(t));if(n==="hevc"&&t.vps)return Ve.box(Ve.types.stsd,Ve.STSD,Ve.hvc1(t))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${t.type} segment codec (${n}/${t.codec})`)}static tkhd(t){const n=t.id,s=(t.duration||0)*(t.timescale||0),o=t.width||0,l=t.height||0,u=Math.floor(s/($s+1)),d=Math.floor(s%($s+1));return Ve.box(Ve.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,0,0,0,0,u>>24,u>>16&255,u>>8&255,u&255,d>>24,d>>16&255,d>>8&255,d&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,o>>8&255,o&255,0,0,l>>8&255,l&255,0,0]))}static traf(t,n){const s=Ve.sdtp(t),o=t.id,l=Math.floor(n/($s+1)),u=Math.floor(n%($s+1));return Ve.box(Ve.types.traf,Ve.box(Ve.types.tfhd,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255])),Ve.box(Ve.types.tfdt,new Uint8Array([1,0,0,0,l>>24,l>>16&255,l>>8&255,l&255,u>>24,u>>16&255,u>>8&255,u&255])),Ve.trun(t,s.length+16+20+8+16+8+8),s)}static trak(t){return t.duration=t.duration||4294967295,Ve.box(Ve.types.trak,Ve.tkhd(t),Ve.mdia(t))}static trex(t){const n=t.id;return Ve.box(Ve.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,n){const s=t.samples||[],o=s.length,l=12+16*o,u=new Uint8Array(l);let d,_,g,v,y,x;for(n+=8+l,u.set([t.type==="video"?1:0,0,15,1,o>>>24&255,o>>>16&255,o>>>8&255,o&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0),d=0;d<o;d++)_=s[d],g=_.duration,v=_.size,y=_.flags,x=_.cts,u.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,y.isLeading<<2|y.dependsOn,y.isDependedOn<<6|y.hasRedundancy<<4|y.paddingValue<<1|y.isNonSync,y.degradPrio&61440,y.degradPrio&15,x>>>24&255,x>>>16&255,x>>>8&255,x&255],12+16*d);return Ve.box(Ve.types.trun,u)}static initSegment(t){Ve.types||Ve.init();const n=Ve.moov(t);return Pt(Ve.FTYP,n)}static hvc1(t){const n=t.params,s=[t.vps,t.sps,t.pps],o=4,l=new Uint8Array([1,n.general_profile_space<<6|(n.general_tier_flag?32:0)|n.general_profile_idc,n.general_profile_compatibility_flags[0],n.general_profile_compatibility_flags[1],n.general_profile_compatibility_flags[2],n.general_profile_compatibility_flags[3],n.general_constraint_indicator_flags[0],n.general_constraint_indicator_flags[1],n.general_constraint_indicator_flags[2],n.general_constraint_indicator_flags[3],n.general_constraint_indicator_flags[4],n.general_constraint_indicator_flags[5],n.general_level_idc,240|n.min_spatial_segmentation_idc>>8,255&n.min_spatial_segmentation_idc,252|n.parallelismType,252|n.chroma_format_idc,248|n.bit_depth_luma_minus8,248|n.bit_depth_chroma_minus8,0,parseInt(n.frame_rate.fps),o-1|n.temporal_id_nested<<2|n.num_temporal_layers<<3|(n.frame_rate.fixed?64:0),s.length]);let u=l.length;for(let C=0;C<s.length;C+=1){u+=3;for(let F=0;F<s[C].length;F+=1)u+=2+s[C][F].length}const d=new Uint8Array(u);d.set(l,0),u=l.length;const _=s.length-1;for(let C=0;C<s.length;C+=1){d.set(new Uint8Array([32+C|(C===_?128:0),0,s[C].length]),u),u+=3;for(let F=0;F<s[C].length;F+=1)d.set(new Uint8Array([s[C][F].length>>8,s[C][F].length&255]),u),u+=2,d.set(s[C][F],u),u+=s[C][F].length}const g=Ve.box(Ve.types.hvcC,d),v=t.width,y=t.height,x=t.pixelRatio[0],D=t.pixelRatio[1];return Ve.box(Ve.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,v>>8&255,v&255,y>>8&255,y&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]),g,Ve.box(Ve.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ve.box(Ve.types.pasp,new Uint8Array([x>>24,x>>16&255,x>>8&255,x&255,D>>24,D>>16&255,D>>8&255,D&255])))}}Ve.types=void 0,Ve.HDLR_TYPES=void 0,Ve.STTS=void 0,Ve.STSC=void 0,Ve.STCO=void 0,Ve.STSZ=void 0,Ve.VMHD=void 0,Ve.SMHD=void 0,Ve.STSD=void 0,Ve.FTYP=void 0,Ve.DINF=void 0;const Fc=9e4;function ku(h,t,n=1,s=!1){const o=h*t*n;return s?Math.round(o):o}function Xh(h,t,n=1,s=!1){return ku(h,t,1/n,s)}function Ca(h,t=!1){return ku(h,1e3,1/Fc,t)}function Qt(h,t=1){return ku(h,Fc,1/t)}function Ms(h){const{baseTime:t,timescale:n,trackId:s}=h;return`${t/n} (${t}/${n}) trackId: ${s}`}const Jh=10*1e3,Qh=1024,ss=1152,xl=1536;let ro=null,Bc=null;function ef(h,t,n,s){return{duration:t,size:n,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:h?2:1,isNonSync:h?0:1}}}class fa extends H{constructor(t,n,s,o){if(super("mp4-remuxer",o),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=n,this.typeSupported=s,this.ISGenerated=!1,ro===null){const u=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ro=u?parseInt(u[1]):0}if(Bc===null){const l=navigator.userAgent.match(/Safari\/(\d+)/i);Bc=l?parseInt(l[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(t){const n=this._initPTS;(!n||!t||t.trackId!==n.trackId||t.baseTime!==n.baseTime||t.timescale!==n.timescale)&&this.log(`Reset initPTS: ${n&&Ms(n)} > ${t&&Ms(t)}`),this._initPTS=this._initDTS=t}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(t){let n=!1;const s=t[0].pts,o=t.reduce((l,u)=>{let d=u.pts,_=d-l;return _<-4294967296&&(n=!0,d=pr(d,s),_=d-l),_>0?l:d},s);return n&&this.debug("PTS rollover detected"),o}remux(t,n,s,o,l,u,d,_){let g,v,y,x,D,C,F=l,B=l;const J=t.pid>-1,ne=n.pid>-1,le=n.samples.length,Ee=t.samples.length>0,Ie=d&&le>0||le>1;if((!J||Ee)&&(!ne||Ie)||this.ISGenerated||d){if(this.ISGenerated){var Pe,Ye,qe,Fe;const xi=this.videoTrackConfig;(xi&&(n.width!==xi.width||n.height!==xi.height||((Pe=n.pixelRatio)==null?void 0:Pe[0])!==((Ye=xi.pixelRatio)==null?void 0:Ye[0])||((qe=n.pixelRatio)==null?void 0:qe[1])!==((Fe=xi.pixelRatio)==null?void 0:Fe[1]))||!xi&&Ie||this.nextAudioTs===null&&Ee)&&this.resetInitSegment()}this.ISGenerated||(y=this.generateIS(t,n,l,u));const mt=this.isVideoContiguous;let Zt=-1,ui;if(Ie&&(Zt=gd(n.samples),!mt&&this.config.forceKeyFrameOnDiscontinuity))if(C=!0,Zt>0){this.warn(`Dropped ${Zt} out of ${le} video samples due to a missing keyframe`);const xi=this.getVideoStartPts(n.samples);n.samples=n.samples.slice(Zt),n.dropped+=Zt,B+=(n.samples[0].pts-xi)/n.inputTimeScale,ui=B}else Zt===-1&&(this.warn(`No keyframe found out of ${le} video samples`),C=!1);if(this.ISGenerated){if(Ee&&Ie){const xi=this.getVideoStartPts(n.samples),Vt=(pr(t.samples[0].pts,xi)-xi)/n.inputTimeScale;F+=Math.max(0,Vt),B+=Math.max(0,-Vt)}if(Ee){if(t.samplerate||(this.warn("regenerate InitSegment as audio detected"),y=this.generateIS(t,n,l,u)),v=this.remuxAudio(t,F,this.isAudioContiguous,u,ne||Ie||_===P.AUDIO?B:void 0),Ie){const xi=v?v.endPTS-v.startPTS:0;n.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),y=this.generateIS(t,n,l,u)),g=this.remuxVideo(n,B,mt,xi)}}else Ie&&(g=this.remuxVideo(n,B,mt,0));g&&(g.firstKeyFrame=Zt,g.independent=Zt!==-1,g.firstKeyFramePTS=ui)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(D=da(s,l,this._initPTS,this._initDTS)),o.samples.length&&(x=Nc(o,l,this._initPTS))),{audio:v,video:g,initSegment:y,independent:C,text:x,id3:D}}computeInitPts(t,n,s,o){const l=Math.round(s*n);let u=pr(t,l);if(u<l+n)for(this.log(`Adjusting PTS for rollover in timeline near ${(l-u)/n} ${o}`);u<l+n;)u+=8589934592;return u-l}generateIS(t,n,s,o){const l=t.samples,u=n.samples,d=this.typeSupported,_={},g=this._initPTS;let v=!g||o,y="audio/mp4",x,D,C,F=-1;if(v&&(x=D=1/0),t.config&&l.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":d.mpeg?(y="audio/mpeg",t.codec=""):d.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3";break}_.audio={id:"audio",container:y,codec:t.codec,initSegment:t.segmentCodec==="mp3"&&d.mpeg?new Uint8Array(0):Ve.initSegment([t]),metadata:{channelCount:t.channelCount}},v&&(F=t.id,C=t.inputTimeScale,!g||C!==g.timescale?x=D=this.computeInitPts(l[0].pts,C,s,"audio"):v=!1)}if(n.sps&&n.pps&&u.length){if(n.timescale=n.inputTimeScale,_.video={id:"main",container:"video/mp4",codec:n.codec,initSegment:Ve.initSegment([n]),metadata:{width:n.width,height:n.height}},v)if(F=n.id,C=n.inputTimeScale,!g||C!==g.timescale){const B=this.getVideoStartPts(u),J=pr(u[0].dts,B),ne=this.computeInitPts(J,C,s,"video"),le=this.computeInitPts(B,C,s,"video");D=Math.min(D,ne),x=Math.min(x,le)}else v=!1;this.videoTrackConfig={width:n.width,height:n.height,pixelRatio:n.pixelRatio}}if(Object.keys(_).length)return this.ISGenerated=!0,v?(g&&this.warn(`Timestamps at playlist time: ${o?"":"~"}${s} ${x/C} != initPTS: ${g.baseTime/g.timescale} (${g.baseTime}/${g.timescale}) trackId: ${g.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${x/C} (${x}/${C}) trackId: ${F}`),this._initPTS={baseTime:x,timescale:C,trackId:F},this._initDTS={baseTime:D,timescale:C,trackId:F}):x=C=void 0,{tracks:_,initPTS:x,timescale:C,trackId:F}}remuxVideo(t,n,s,o){const l=t.inputTimeScale,u=t.samples,d=[],_=u.length,g=this._initPTS,v=g.baseTime*l/g.timescale;let y=this.nextVideoTs,x=8,D=this.videoSampleDuration,C,F,B=Number.POSITIVE_INFINITY,J=Number.NEGATIVE_INFINITY,ne=!1;if(!s||y===null){const Ut=v+n*l,qt=u[0].pts-pr(u[0].dts,u[0].pts);ro&&y!==null&&Math.abs(Ut-qt-(y+v))<15e3?s=!0:y=Ut-qt-v}const le=y+v;for(let Ut=0;Ut<_;Ut++){const qt=u[Ut];qt.pts=pr(qt.pts,le),qt.dts=pr(qt.dts,le),qt.dts<u[Ut>0?Ut-1:Ut].dts&&(ne=!0)}ne&&u.sort(function(Ut,qt){const Zi=Ut.dts-qt.dts,Fn=Ut.pts-qt.pts;return Zi||Fn}),C=u[0].dts,F=u[u.length-1].dts;const Ee=F-C,Ie=Ee?Math.round(Ee/(_-1)):D||t.inputTimeScale/30;if(s){const Ut=C-le,qt=Ut>Ie,Zi=Ut<-1;if((qt||Zi)&&(qt?this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${Ca(Ut,!0)} ms (${Ut}dts) hole between fragments detected at ${n.toFixed(3)}`):this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${Ca(-Ut,!0)} ms (${Ut}dts) overlapping between fragments detected at ${n.toFixed(3)}`),!Zi||le>=u[0].pts||ro)){C=le;const Fn=u[0].pts-Ut;if(qt)u[0].dts=C,u[0].pts=Fn;else{let _i=!0;for(let xn=0;xn<u.length&&!(u[xn].dts>Fn&&_i);xn++){const qr=u[xn].pts;if(u[xn].dts-=Ut,u[xn].pts-=Ut,xn<u.length-1){const mr=u[xn+1].pts,os=u[xn].pts,ta=mr<=os,Na=mr<=qr;_i=ta==Na}}}this.log(`Video: Initial PTS/DTS adjusted: ${Ca(Fn,!0)}/${Ca(C,!0)}, delta: ${Ca(Ut,!0)} ms`)}}C=Math.max(0,C);let tt=0,Pe=0,Ye=C;for(let Ut=0;Ut<_;Ut++){const qt=u[Ut],Zi=qt.units,Fn=Zi.length;let _i=0;for(let xn=0;xn<Fn;xn++)_i+=Zi[xn].data.length;Pe+=_i,tt+=Fn,qt.length=_i,qt.dts<Ye?(qt.dts=Ye,Ye+=Ie/4|0||1):Ye=qt.dts,B=Math.min(qt.pts,B),J=Math.max(qt.pts,J)}F=u[_-1].dts;const qe=Pe+4*tt+8;let Fe;try{Fe=new Uint8Array(qe)}catch(Ut){this.observer.emit(S.ERROR,S.ERROR,{type:ge.MUX_ERROR,details:q.REMUX_ALLOC_ERROR,fatal:!1,error:Ut,bytes:qe,reason:`fail allocating video mdat ${qe}`});return}const mt=new DataView(Fe.buffer);mt.setUint32(0,qe),Fe.set(Ve.types.mdat,4);let Zt=!1,ui=Number.POSITIVE_INFINITY,xi=Number.POSITIVE_INFINITY,si=Number.NEGATIVE_INFINITY,Vt=Number.NEGATIVE_INFINITY;for(let Ut=0;Ut<_;Ut++){const qt=u[Ut],Zi=qt.units;let Fn=0;for(let qr=0,mr=Zi.length;qr<mr;qr++){const os=Zi[qr],ta=os.data,Na=os.data.byteLength;mt.setUint32(x,Na),x+=4,Fe.set(ta,x),x+=Na,Fn+=4+Na}let _i;if(Ut<_-1)D=u[Ut+1].dts-qt.dts,_i=u[Ut+1].pts-qt.pts;else{const qr=this.config,mr=Ut>0?qt.dts-u[Ut-1].dts:Ie;if(_i=Ut>0?qt.pts-u[Ut-1].pts:Ie,qr.stretchShortVideoTrack&&this.nextAudioTs!==null){const os=Math.floor(qr.maxBufferHole*l),ta=(o?B+o*l:this.nextAudioTs+v)-qt.pts;ta>os?(D=ta-mr,D<0?D=mr:Zt=!0,this.log(`It is approximately ${ta/90} ms to the next segment; using duration ${D/90} ms for the last video frame.`)):D=mr}else D=mr}const xn=Math.round(qt.pts-qt.dts);ui=Math.min(ui,D),si=Math.max(si,D),xi=Math.min(xi,_i),Vt=Math.max(Vt,_i),d.push(ef(qt.key,D,Fn,xn))}if(d.length){if(ro){if(ro<70){const Ut=d[0].flags;Ut.dependsOn=2,Ut.isNonSync=0}}else if(Bc&&Vt-xi<si-ui&&Ie/si<.025&&d[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Ut=C;for(let qt=0,Zi=d.length;qt<Zi;qt++){const Fn=Ut+d[qt].duration,_i=Ut+d[qt].cts;if(qt<Zi-1){const xn=Fn+d[qt+1].cts;d[qt].duration=xn-_i}else d[qt].duration=qt?d[qt-1].duration:Ie;d[qt].cts=0,Ut=Fn}}}D=Zt||!D?Ie:D;const ci=F+D;this.nextVideoTs=y=ci-v,this.videoSampleDuration=D,this.isVideoContiguous=!0;const zi={data1:Ve.moof(t.sequenceNumber++,C,k(t,{samples:d})),data2:Fe,startPTS:(B-v)/l,endPTS:(J+D-v)/l,startDTS:(C-v)/l,endDTS:y/l,type:"video",hasAudio:!1,hasVideo:!0,nb:d.length,dropped:t.dropped};return t.samples=[],t.dropped=0,zi}getSamplesPerFrame(t){switch(t.segmentCodec){case"mp3":return ss;case"ac3":return xl;default:return Qh}}remuxAudio(t,n,s,o,l){const u=t.inputTimeScale,d=t.samplerate?t.samplerate:u,_=u/d,g=this.getSamplesPerFrame(t),v=g*_,y=this._initPTS,x=t.segmentCodec==="mp3"&&this.typeSupported.mpeg,D=[],C=l!==void 0;let F=t.samples,B=x?0:8,J=this.nextAudioTs||-1;const ne=y.baseTime*u/y.timescale,le=ne+n*u;if(this.isAudioContiguous=s=s||F.length&&J>0&&(o&&Math.abs(le-(J+ne))<9e3||Math.abs(pr(F[0].pts,le)-(J+ne))<20*v),F.forEach(function(Vt){Vt.pts=pr(Vt.pts,le)}),!s||J<0){const Vt=F.length;if(F=F.filter(ci=>ci.pts>=0),Vt!==F.length&&this.warn(`Removed ${F.length-Vt} of ${Vt} samples (initPTS ${ne} / ${u})`),!F.length)return;l===0?J=0:o&&!C?J=Math.max(0,le-ne):J=F[0].pts-ne}if(t.segmentCodec==="aac"){const Vt=this.config.maxAudioFramesDrift;for(let ci=0,ei=J+ne;ci<F.length;ci++){const gi=F[ci],zi=gi.pts,Ut=zi-ei,qt=Math.abs(1e3*Ut/u);if(Ut<=-Vt*v&&C)ci===0&&(this.warn(`Audio frame @ ${(zi/u).toFixed(3)}s overlaps marker by ${Math.round(1e3*Ut/u)} ms.`),this.nextAudioTs=J=zi-ne,ei=zi);else if(Ut>=Vt*v&&qt<Jh&&C){let Zi=Math.round(Ut/v);for(ei=zi-Zi*v;ei<0&&Zi&&v;)Zi--,ei+=v;ci===0&&(this.nextAudioTs=J=ei-ne),this.warn(`Injecting ${Zi} audio frames @ ${((ei-ne)/u).toFixed(3)}s due to ${Math.round(1e3*Ut/u)} ms gap.`);for(let Fn=0;Fn<Zi;Fn++){let _i=Oc.getSilentFrame(t.parsedCodec||t.manifestCodec||t.codec,t.channelCount);_i||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),_i=gi.unit.subarray()),F.splice(ci,0,{unit:_i,pts:ei}),ei+=v,ci++}}gi.pts=ei,ei+=v}}let Ee=null,Ie=null,tt,Pe=0,Ye=F.length;for(;Ye--;)Pe+=F[Ye].unit.byteLength;for(let Vt=0,ci=F.length;Vt<ci;Vt++){const ei=F[Vt],gi=ei.unit;let zi=ei.pts;if(Ie!==null){const qt=D[Vt-1];qt.duration=Math.round((zi-Ie)/_)}else if(s&&t.segmentCodec==="aac"&&(zi=J+ne),Ee=zi,Pe>0){Pe+=B;try{tt=new Uint8Array(Pe)}catch(qt){this.observer.emit(S.ERROR,S.ERROR,{type:ge.MUX_ERROR,details:q.REMUX_ALLOC_ERROR,fatal:!1,error:qt,bytes:Pe,reason:`fail allocating audio mdat ${Pe}`});return}x||(new DataView(tt.buffer).setUint32(0,Pe),tt.set(Ve.types.mdat,4))}else return;tt.set(gi,B);const Ut=gi.byteLength;B+=Ut,D.push(ef(!0,g,Ut,0)),Ie=zi}const qe=D.length;if(!qe)return;const Fe=D[D.length-1];J=Ie-ne,this.nextAudioTs=J+_*Fe.duration;const mt=x?new Uint8Array(0):Ve.moof(t.sequenceNumber++,Ee/_,k({},t,{samples:D}));t.samples=[];const Zt=(Ee-ne)/u,ui=J/u,si={data1:mt,data2:tt,startPTS:Zt,endPTS:ui,startDTS:Zt,endDTS:ui,type:"audio",hasAudio:!0,hasVideo:!1,nb:qe};return this.isAudioContiguous=!0,si}}function pr(h,t){let n;if(t===null)return h;for(t<h?n=-8589934592:n=8589934592;Math.abs(h-t)>4294967296;)h+=n;return h}function gd(h){for(let t=0;t<h.length;t++)if(h[t].key)return t;return-1}function da(h,t,n,s){const o=h.samples.length;if(!o)return;const l=h.inputTimeScale;for(let d=0;d<o;d++){const _=h.samples[d];_.pts=pr(_.pts-n.baseTime*l/n.timescale,t*l)/l,_.dts=pr(_.dts-s.baseTime*l/s.timescale,t*l)/l}const u=h.samples;return h.samples=[],{samples:u}}function Nc(h,t,n){const s=h.samples.length;if(!s)return;const o=h.inputTimeScale;for(let u=0;u<s;u++){const d=h.samples[u];d.pts=pr(d.pts-n.baseTime*o/n.timescale,t*o)/o}h.samples.sort((u,d)=>u.pts-d.pts);const l=h.samples;return h.samples=[],{samples:l}}class $c extends H{constructor(t,n,s,o){super("passthrough-remuxer",o),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(t){this.lastEndTime=null;const n=this.initPTS;n&&t&&n.baseTime===t.baseTime&&n.timescale===t.timescale||(this.initPTS=t)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(t,n,s,o){this.audioCodec=n,this.videoCodec=s,this.generateInitSegment(t,o),this.emitInitSegment=!0}generateInitSegment(t,n){let{audioCodec:s,videoCodec:o}=this;if(!(t!=null&&t.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:l,video:u}=this.initData=_t(t);if(n)gt(t,n);else{const _=l||u;_!=null&&_.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${_.codec}")!`)}l&&(s=so(l,V.AUDIO,this)),u&&(o=so(u,V.VIDEO,this));const d={};l&&u?d.audiovideo={container:"video/mp4",codec:s+","+o,supplemental:u.supplemental,encrypted:u.encrypted,initSegment:t,id:"main"}:l?d.audio={container:"audio/mp4",codec:s,encrypted:l.encrypted,initSegment:t,id:"audio"}:u?d.video={container:"video/mp4",codec:o,supplemental:u.supplemental,encrypted:u.encrypted,initSegment:t,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=d}remux(t,n,s,o,l,u){var d,_;let{initPTS:g,lastEndTime:v}=this;const y={audio:void 0,video:void 0,text:o,id3:s,initSegment:void 0};ce(v)||(v=this.lastEndTime=l||0);const x=n.samples;if(!x.length)return y;const D={initPTS:void 0,timescale:void 0,trackId:void 0};let C=this.initData;if((d=C)!=null&&d.length||(this.generateInitSegment(x),C=this.initData),!((_=C)!=null&&_.length))return this.warn("Failed to generate initSegment."),y;this.emitInitSegment&&(D.tracks=this.initTracks,this.emitInitSegment=!1);const F=bt(x,C,this),B=C.audio?F[C.audio.id]:null,J=C.video?F[C.video.id]:null,ne=Ho(J,1/0),le=Ho(B,1/0),Ee=Ho(J,0,!0),Ie=Ho(B,0,!0);let tt=l,Pe=0;const Ye=B&&(!J||!g&&le<ne||g&&g.trackId===C.audio.id),qe=Ye?B:J;if(qe){const ei=qe.timescale,gi=qe.start-l*ei,zi=Ye?C.audio.id:C.video.id;tt=qe.start/ei,Pe=Ye?Ie-le:Ee-ne,(u||!g)&&(tf(g,tt,l,Pe)||ei!==g.timescale)&&(g&&this.warn(`Timestamps at playlist time: ${u?"":"~"}${l} ${gi/ei} != initPTS: ${g.baseTime/g.timescale} (${g.baseTime}/${g.timescale}) trackId: ${g.trackId}`),this.log(`Found initPTS at playlist time: ${l} offset: ${tt-l} (${gi}/${ei}) trackId: ${zi}`),g=null,D.initPTS=gi,D.timescale=ei,D.trackId=zi)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${l}`);g?(D.initPTS=g.baseTime,D.timescale=g.timescale,D.trackId=g.trackId):((!D.timescale||D.trackId===void 0||D.initPTS===void 0)&&(this.warn("Could not set initPTS"),D.initPTS=tt,D.timescale=1,D.trackId=-1),this.initPTS=g={baseTime:D.initPTS,timescale:D.timescale,trackId:D.trackId});const Fe=tt-g.baseTime/g.timescale,mt=Fe+Pe;Pe>0?this.lastEndTime=mt:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Zt=!!C.audio,ui=!!C.video;let xi="";Zt&&(xi+="audio"),ui&&(xi+="video");const si=(C.audio?C.audio.encrypted:!1)||(C.video?C.video.encrypted:!1),Vt={data1:x,startPTS:Fe,startDTS:Fe,endPTS:mt,endDTS:mt,type:xi,hasAudio:Zt,hasVideo:ui,nb:1,dropped:0,encrypted:si};y.audio=Zt&&!ui?Vt:void 0,y.video=ui?Vt:void 0;const ci=J==null?void 0:J.sampleCount;if(ci){const ei=J.keyFrameIndex,gi=ei!==-1;Vt.nb=ci,Vt.dropped=ei===0||this.isVideoContiguous?0:gi?ei:ci,Vt.independent=gi,Vt.firstKeyFrame=ei,gi&&J.keyFrameStart&&(Vt.firstKeyFramePTS=(J.keyFrameStart-g.baseTime)/g.timescale),this.isVideoContiguous||(y.independent=gi),this.isVideoContiguous||(this.isVideoContiguous=gi),Vt.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${ei}/${ci} dropped: ${Vt.dropped} start: ${Vt.firstKeyFramePTS||"NA"}`)}return y.initSegment=D,y.id3=da(s,l,g,g),o.samples.length&&(y.text=Nc(o,l,g)),y}}function Ho(h,t,n=!1){return(h==null?void 0:h.start)!==void 0?(h.start+(n?h.duration:0))/h.timescale:t}function tf(h,t,n,s){if(h===null)return!0;const o=Math.max(s,1),l=t-h.baseTime/h.timescale;return Math.abs(l-n)>o}function so(h,t,n){const s=h.codec;return s&&s.length>4?s:t===V.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?ot(s,!1):(n.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"):(n.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1")}let Ks;try{Ks=self.performance.now.bind(self.performance)}catch(h){Ks=Date.now}const Wo=[{demux:Ic,remux:$c},{demux:ha,remux:fa},{demux:jh,remux:fa},{demux:yu,remux:fa}];Wo.splice(2,0,{demux:qh,remux:fa});class Kc{constructor(t,n,s,o,l,u){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=t,this.typeSupported=n,this.config=s,this.id=l,this.logger=u}configure(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()}push(t,n,s,o){const l=s.transmuxing;l.executeStart=Ks();let u=new Uint8Array(t);const{currentTransmuxState:d,transmuxConfig:_}=this;o&&(this.currentTransmuxState=o);const{contiguous:g,discontinuity:v,trackSwitch:y,accurateTimeOffset:x,timeOffset:D,initSegmentChange:C}=o||d,{audioCodec:F,videoCodec:B,defaultInitPts:J,duration:ne,initSegmentData:le}=_,Ee=_d(u,n);if(Ee&&Pr(Ee.method)){const Ye=this.getDecrypter(),qe=Fs(Ee.method);if(Ye.isSync()){let Fe=Ye.softwareDecrypt(u,Ee.key.buffer,Ee.iv.buffer,qe);if(s.part>-1){const Zt=Ye.flush();Fe=Zt&&Zt.buffer}if(!Fe)return l.executeEnd=Ks(),Uc(s);u=new Uint8Array(Fe)}else return this.asyncResult=!0,this.decryptionPromise=Ye.webCryptoDecrypt(u,Ee.key.buffer,Ee.iv.buffer,qe).then(Fe=>{const mt=this.push(Fe,null,s);return this.decryptionPromise=null,mt}),this.decryptionPromise}const Ie=this.needsProbing(v,y);if(Ie){const Ye=this.configureTransmuxer(u);if(Ye)return this.logger.warn(`[transmuxer] ${Ye.message}`),this.observer.emit(S.ERROR,S.ERROR,{type:ge.MEDIA_ERROR,details:q.FRAG_PARSING_ERROR,fatal:!1,error:Ye,reason:Ye.message}),l.executeEnd=Ks(),Uc(s)}(v||y||C||Ie)&&this.resetInitSegment(le,F,B,ne,n),(v||C||Ie)&&this.resetInitialTimestamp(J),g||this.resetContiguity();const tt=this.transmux(u,Ee,D,x,s);this.asyncResult=wl(tt);const Pe=this.currentTransmuxState;return Pe.contiguous=!0,Pe.discontinuity=!1,Pe.trackSwitch=!1,l.executeEnd=Ks(),tt}flush(t){const n=t.transmuxing;n.executeStart=Ks();const{decrypter:s,currentTransmuxState:o,decryptionPromise:l}=this;if(l)return this.asyncResult=!0,l.then(()=>this.flush(t));const u=[],{timeOffset:d}=o;if(s){const y=s.flush();y&&u.push(this.push(y.buffer,null,t))}const{demuxer:_,remuxer:g}=this;if(!_||!g){n.executeEnd=Ks();const y=[Uc(t)];return this.asyncResult?Promise.resolve(y):y}const v=_.flush(d);return wl(v)?(this.asyncResult=!0,v.then(y=>(this.flushRemux(u,y,t),u))):(this.flushRemux(u,v,t),this.asyncResult?Promise.resolve(u):u)}flushRemux(t,n,s){const{audioTrack:o,videoTrack:l,id3Track:u,textTrack:d}=n,{accurateTimeOffset:_,timeOffset:g}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id===P.MAIN?"level":"track"} ${s.level}`);const v=this.remuxer.remux(o,l,u,d,g,_,!0,this.id);t.push({remuxResult:v,chunkMeta:s}),s.transmuxing.executeEnd=Ks()}resetInitialTimestamp(t){const{demuxer:n,remuxer:s}=this;!n||!s||(n.resetTimeStamp(t),s.resetTimeStamp(t))}resetContiguity(){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetContiguity(),n.resetNextTimestamp())}resetInitSegment(t,n,s,o,l){const{demuxer:u,remuxer:d}=this;!u||!d||(u.resetInitSegment(t,n,s,o),d.resetInitSegment(t,n,s,l))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(t,n,s,o,l){let u;return n&&n.method==="SAMPLE-AES"?u=this.transmuxSampleAes(t,n,s,o,l):u=this.transmuxUnencrypted(t,s,o,l),u}transmuxUnencrypted(t,n,s,o){const{audioTrack:l,videoTrack:u,id3Track:d,textTrack:_}=this.demuxer.demux(t,n,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(l,u,d,_,n,s,!1,this.id),chunkMeta:o}}transmuxSampleAes(t,n,s,o,l){return this.demuxer.demuxSampleAes(t,n,s).then(u=>({remuxResult:this.remuxer.remux(u.audioTrack,u.videoTrack,u.id3Track,u.textTrack,s,o,!1,this.id),chunkMeta:l}))}configureTransmuxer(t){const{config:n,observer:s,typeSupported:o}=this;let l;for(let y=0,x=Wo.length;y<x;y++){var u;if((u=Wo[y].demux)!=null&&u.probe(t,this.logger)){l=Wo[y];break}}if(!l)return new Error("Failed to find demuxer by probing fragment data");const d=this.demuxer,_=this.remuxer,g=l.remux,v=l.demux;(!_||!(_ instanceof g))&&(this.remuxer=new g(s,n,o,this.logger)),(!d||!(d instanceof v))&&(this.demuxer=new v(s,n,o,this.logger),this.probe=v.probe)}needsProbing(t,n){return!this.demuxer||!this.remuxer||t||n}getDecrypter(){let t=this.decrypter;return t||(t=this.decrypter=new ur(this.config)),t}}function _d(h,t){let n=null;return h.byteLength>0&&(t==null?void 0:t.key)!=null&&t.iv!==null&&t.method!=null&&(n=t),n}const Uc=h=>({remuxResult:{},chunkMeta:h});function wl(h){return"then"in h&&h.then instanceof Function}class Tu{constructor(t,n,s,o,l){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=n,this.initSegmentData=s,this.duration=o,this.defaultInitPts=l||null}}class vd{constructor(t,n,s,o,l,u){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=t,this.contiguous=n,this.accurateTimeOffset=s,this.trackSwitch=o,this.timeOffset=l,this.initSegmentChange=u}}let Sl=0;class zc{constructor(t,n,s,o){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Sl++,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=_=>{const g=_.data,v=this.hls;if(!(!v||!(g!=null&&g.event)||g.instanceNo!==this.instanceNo))switch(g.event){case"init":{var y;const x=(y=this.workerContext)==null?void 0:y.objectURL;x&&self.URL.revokeObjectURL(x);break}case"transmuxComplete":{this.handleTransmuxComplete(g.data);break}case"flush":{this.onFlush(g.data);break}case"workerLog":{v.logger[g.data.logType]&&v.logger[g.data.logType](g.data.message);break}default:{g.data=g.data||{},g.data.frag=this.frag,g.data.part=this.part,g.data.id=this.id,v.trigger(g.event,g.data);break}}},this.onWorkerError=_=>{if(!this.hls)return;const g=new Error(`${_.message} (${_.filename}:${_.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:q.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:g})};const l=t.config;this.hls=t,this.id=n,this.useWorker=!!l.enableWorker,this.onTransmuxComplete=s,this.onFlush=o;const u=(_,g)=>{g=g||{},g.frag=this.frag||void 0,_===S.ERROR&&(g=g,g.parent=this.id,g.part=this.part,this.error=g.error),this.hls.trigger(_,g)};this.observer=new uu,this.observer.on(S.FRAG_DECRYPTED,u),this.observer.on(S.ERROR,u);const d=St(l.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const _=this.hls.logger;if(l.workerPath||Dh()){try{l.workerPath?(_.log(`loading Web Worker ${l.workerPath} for "${n}"`),this.workerContext=Mh(l.workerPath)):(_.log(`injecting Web Worker for "${n}"`),this.workerContext=Ch());const{worker:v}=this.workerContext;v.addEventListener("message",this.onWorkerMessage),v.addEventListener("error",this.onWorkerError),v.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:d,id:n,config:$e(l)})}catch(v){_.warn(`Error setting up "${n}" Web Worker, fallback to inline`,v),this.terminateWorker(),this.error=null,this.transmuxer=new Kc(this.observer,d,l,"",n,t.logger)}return}}this.transmuxer=new Kc(this.observer,d,l,"",n,t.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const t=this.instanceNo;this.instanceNo=Sl++;const n=this.hls.config,s=St(n.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:t,typeSupported:s,id:this.id,config:$e(n)})}}terminateWorker(){if(this.workerContext){const{worker:t}=this.workerContext;this.workerContext=null,t.removeEventListener("message",this.onWorkerMessage),t.removeEventListener("error",this.onWorkerError),cu(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const n=this.transmuxer;n&&(n.destroy(),this.transmuxer=null)}const t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(t,n,s,o,l,u,d,_,g,v){var y,x;g.transmuxing.start=self.performance.now();const{instanceNo:D,transmuxer:C}=this,F=u?u.start:l.start,B=l.decryptdata,J=this.frag,ne=!(J&&l.cc===J.cc),le=!(J&&g.level===J.level),Ee=J?g.sn-J.sn:-1,Ie=this.part?g.part-this.part.index:-1,tt=Ee===0&&g.id>1&&g.id===(J==null?void 0:J.stats.chunkCount),Pe=!le&&(Ee===1||Ee===0&&(Ie===1||tt&&Ie<=0)),Ye=self.performance.now();(le||Ee||l.stats.parsing.start===0)&&(l.stats.parsing.start=Ye),u&&(Ie||!Pe)&&(u.stats.parsing.start=Ye);const qe=!(J&&((y=l.initSegment)==null?void 0:y.url)===((x=J.initSegment)==null?void 0:x.url)),Fe=new vd(ne,Pe,_,le,F,qe);if(!Pe||ne||qe){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${l.type} sn: ${g.sn}${g.part>-1?" part: "+g.part:""} ${this.id===P.MAIN?"level":"track"}: ${g.level} id: ${g.id}
|
|
|
discontinuity: ${ne}
|
|
|
trackSwitch: ${le}
|
|
|
contiguous: ${Pe}
|
|
|
accurateTimeOffset: ${_}
|
|
|
timeOffset: ${F}
|
|
|
initSegmentChange: ${qe}`);const mt=new Tu(s,o,n,d,v);this.configureTransmuxer(mt)}if(this.frag=l,this.part=u,this.workerContext)this.workerContext.worker.postMessage({instanceNo:D,cmd:"demux",data:t,decryptdata:B,chunkMeta:g,state:Fe},t instanceof ArrayBuffer?[t]:[]);else if(C){const mt=C.push(t,B,g,Fe);wl(mt)?mt.then(Zt=>{this.handleTransmuxComplete(Zt)}).catch(Zt=>{this.transmuxerError(Zt,g,"transmuxer-interface push error")}):this.handleTransmuxComplete(mt)}}flush(t){t.transmuxing.start=self.performance.now();const{instanceNo:n,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:n,cmd:"flush",chunkMeta:t});else if(s){const o=s.flush(t);wl(o)?o.then(l=>{this.handleFlushResult(l,t)}).catch(l=>{this.transmuxerError(l,t,"transmuxer-interface flush error")}):this.handleFlushResult(o,t)}}transmuxerError(t,n,s){this.hls&&(this.error=t,this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.FRAG_PARSING_ERROR,chunkMeta:n,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:t,err:t,reason:s}))}handleFlushResult(t,n){t.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(n)}configureTransmuxer(t){const{instanceNo:n,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:n,cmd:"configure",config:t}):s&&s.configure(t)}handleTransmuxComplete(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)}}const Vc=100;class yd extends lu{constructor(t,n,s){super(t,n,s,"audio-stream-controller",P.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:t}=this;t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(S.BUFFER_RESET,this.onBufferReset,this),t.on(S.BUFFER_CREATED,this.onBufferCreated,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(S.FRAG_LOADING,this.onFragLoading,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:t}=this;t&&(super.unregisterListeners(),t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(S.BUFFER_RESET,this.onBufferReset,this),t.off(S.BUFFER_CREATED,this.onBufferCreated,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(S.FRAG_LOADING,this.onFragLoading,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(t,{frag:n,id:s,initPTS:o,timescale:l,trackId:u}){if(s===P.MAIN){const d=n.cc,_=this.fragCurrent;if(this.initPTS[d]={baseTime:o,timescale:l,trackId:u},this.log(`InitPTS for cc: ${d} found from main: ${o/l} (${o}/${l}) trackId: ${u}`),this.mainAnchor=n,this.state===pt.WAITING_INIT_PTS){const g=this.waitingData;(!g&&!this.loadingParts||g&&g.frag.cc!==d)&&this.syncWithAnchor(n,g==null?void 0:g.frag)}else!this.hls.hasEnoughToStart&&_&&_.cc!==d?(_.abortRequests(),this.syncWithAnchor(n,_)):this.state===pt.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(t,n){var s;const o=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(n&&(o==null?void 0:o.cc)===n.cc)return;const l=(o||t).cc,u=this.getLevelDetails(),d=this.getLoadPosition(),_=Gi(u,l,d);_&&(this.log(`Syncing with main frag at ${_.start} cc ${_.cc}`),this.startFragRequested=!1,this.nextLoadPosition=_.start,this.resetLoadingState(),this.state===pt.IDLE&&this.doTickIdle())}startLoad(t,n){if(!this.levels){this.startPosition=t,this.state=pt.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(Vc),s>0&&t===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),t=s,this.state=pt.IDLE):this.state=pt.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}doTick(){switch(this.state){case pt.IDLE:this.doTickIdle();break;case pt.WAITING_TRACK:{const{levels:t,trackId:n}=this,s=t==null?void 0:t[n],o=s==null?void 0:s.details;if(o&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(o))break;this.state=pt.WAITING_INIT_PTS}break}case pt.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case pt.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:n,part:s,cache:o,complete:l}=t,u=this.mainAnchor;if(this.initPTS[n.cc]!==void 0){this.waitingData=null,this.state=pt.FRAG_LOADING;const d=o.flush().buffer,_={frag:n,part:s,payload:d,networkDetails:null};this._handleFragmentLoadProgress(_),l&&super._handleFragmentLoadComplete(_)}else u&&u.cc!==t.frag.cc&&this.syncWithAnchor(u,t.frag)}else this.state=pt.IDLE}}this.onTickEnd()}resetLoadingState(){const t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:t}=this;t!=null&&t.readyState&&(this.lastCurrentTime=t.currentTime)}doTickIdle(){var t;const{hls:n,levels:s,media:o,trackId:l}=this,u=n.config;if(!this.buffering||!o&&!this.primaryPrefetch&&(this.startFragRequested||!u.startFragPrefetch)||!(s!=null&&s[l]))return;const d=s[l],_=d.details;if(!_||this.waitForLive(d)||this.waitForCdnTuneIn(_)){this.state=pt.WAITING_TRACK,this.startFragRequested=!1;return}const g=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&g&&(this.bufferFlushed=!1,this.afterBufferFlushed(g,V.AUDIO,P.AUDIO));const v=this.getFwdBufferInfo(g,P.AUDIO);if(v===null)return;if(!this.switchingTrack&&this._streamEnded(v,_)){n.trigger(S.BUFFER_EOS,{type:"audio"}),this.state=pt.ENDED;return}const y=v.len,x=n.maxBufferLength,D=_.fragments,C=D[0].start,F=this.getLoadPosition(),B=this.flushing?F:v.end;if(this.switchingTrack&&o){const le=F;_.PTSKnown&&le<C&&(v.end>C||v.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),o.currentTime=C+.05)}if(y>=x&&!this.switchingTrack&&B<D[D.length-1].start)return;let J=this.getNextFragment(B,_);if(J&&this.isLoopLoading(J,B)&&(J=this.getNextFragmentLoopLoading(J,_,v,P.MAIN,x)),!J){this.bufferFlushed=!0;return}let ne=((t=this.mainFragLoading)==null?void 0:t.frag)||null;if(!this.audioOnly&&this.startFragRequested&&ne&&ze(J)&&!J.endList&&(!_.live||!this.loadingParts&&B<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(ne)===Oi.OK&&(this.mainFragLoading=ne=null),ne&&ze(ne))){if(J.start>ne.end){const Ee=this.fragmentTracker.getFragAtPos(B,P.MAIN);Ee&&Ee.end>ne.end&&(ne=Ee,this.mainFragLoading={frag:Ee,targetBufferTime:null})}if(J.start>ne.end)return}this.loadFragment(J,d,B)}onMediaDetaching(t,n){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(t,n)}onAudioTracksUpdated(t,{audioTracks:n}){this.resetTransmuxer(),this.levels=n.map(s=>new Xn(s))}onAudioTrackSwitching(t,n){const s=!!n.url;this.trackId=n.id;const{fragCurrent:o}=this;o&&(o.abortRequests(),this.removeUnbufferedFrags(o.start)),this.resetLoadingState(),s?(this.switchingTrack=n,this.flushAudioIfNeeded(n),this.state!==pt.STOPPED&&(this.setInterval(Vc),this.state=pt.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=n,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(t,n){this.mainDetails=n.details;const s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(S.AUDIO_TRACK_LOADED,s))}onAudioTrackLoaded(t,n){var s;const{levels:o}=this,{details:l,id:u,groupId:d,track:_}=n;if(!o){this.warn(`Audio tracks reset while loading track ${u} "${_.name}" of "${d}"`);return}const g=this.mainDetails;if(!g||l.endCC>g.endCC||g.expired){this.cachedTrackLoadedData=n,this.state!==pt.STOPPED&&(this.state=pt.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${u} "${_.name}" of "${d}" loaded [${l.startSN},${l.endSN}]${l.lastPartSn?`[part-${l.lastPartSn}-${l.lastPartIndex}]`:""},duration:${l.totalduration}`);const v=o[u];let y=0;if(l.live||(s=v.details)!=null&&s.live){if(this.checkLiveUpdate(l),l.deltaUpdateFailed)return;if(v.details){var x;y=this.alignPlaylists(l,v.details,(x=this.levelLastLoaded)==null?void 0:x.details)}l.alignedSliding||(ml(l,g),l.alignedSliding||gl(l,g),y=l.fragmentStart)}v.details=l,this.levelLastLoaded=v,this.startFragRequested||this.setStartPosition(g,y),this.hls.trigger(S.AUDIO_TRACK_UPDATED,{details:l,id:u,groupId:n.groupId}),this.state===pt.WAITING_TRACK&&!this.waitForCdnTuneIn(l)&&(this.state=pt.IDLE),this.tick()}_handleFragmentLoadProgress(t){var n;const s=t.frag,{part:o,payload:l}=t,{config:u,trackId:d,levels:_}=this;if(!_){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const g=_[d];if(!g){this.warn("Audio track is undefined on fragment load progress");return}const v=g.details;if(!v){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const y=u.defaultAudioCodec||g.audioCodec||"mp4a.40.2";let x=this.transmuxer;x||(x=this.transmuxer=new zc(this.hls,P.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const D=this.initPTS[s.cc],C=(n=s.initSegment)==null?void 0:n.data;if(D!==void 0){const B=o?o.index:-1,J=B!==-1,ne=new fi(s.level,s.sn,s.stats.chunkCount,l.byteLength,B,J);x.push(l,C,y,"",s,o,v.totalduration,!1,ne,D)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${v.startSN} ,${v.endSN}],track ${d}`);const{cache:F}=this.waitingData=this.waitingData||{frag:s,part:o,cache:new gc,complete:!1};F.push(new Uint8Array(l)),this.state!==pt.STOPPED&&(this.state=pt.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(t){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(t)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(t,n){this.bufferFlushed=this.flushing=!1;const s=n.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(t,n){!this.audioOnly&&n.frag.type===P.MAIN&&ze(n.frag)&&(this.mainFragLoading=n,this.state===pt.IDLE&&this.tick())}onFragBuffered(t,n){const{frag:s,part:o}=n;if(s.type!==P.AUDIO){!this.audioOnly&&s.type===P.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${o?" p: "+o.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(ze(s)){this.fragPrevious=s;const l=this.switchingTrack;l&&(this.bufferedTrack=l,this.switchingTrack=null,this.hls.trigger(S.AUDIO_TRACK_SWITCHED,M({},l)))}this.fragBufferedComplete(s,o),this.media&&this.tick()}onError(t,n){var s;if(n.fatal){this.state=pt.ERROR;return}switch(n.details){case q.FRAG_GAP:case q.FRAG_PARSING_ERROR:case q.FRAG_DECRYPT_ERROR:case q.FRAG_LOAD_ERROR:case q.FRAG_LOAD_TIMEOUT:case q.KEY_LOAD_ERROR:case q.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.AUDIO,n);break;case q.AUDIO_TRACK_LOAD_ERROR:case q.AUDIO_TRACK_LOAD_TIMEOUT:case q.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===pt.WAITING_TRACK&&((s=n.context)==null?void 0:s.type)===Te.AUDIO_TRACK&&(this.state=pt.IDLE);break;case q.BUFFER_ADD_CODEC_ERROR:case q.BUFFER_APPEND_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)||this.resetLoadingState();break;case q.BUFFER_FULL_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case q.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onBufferFlushing(t,{type:n}){n!==V.VIDEO&&(this.flushing=!0)}onBufferFlushed(t,{type:n}){if(n!==V.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===pt.ENDED&&(this.state=pt.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,n,P.AUDIO),this.tick())}}_handleTransmuxComplete(t){var n;const s="audio",{hls:o}=this,{remuxResult:l,chunkMeta:u}=t,d=this.getCurrentContext(u);if(!d){this.resetWhenMissingContext(u);return}const{frag:_,part:g,level:v}=d,{details:y}=v,{audio:x,text:D,id3:C,initSegment:F}=l;if(this.fragContextChanged(_)||!y){this.fragmentTracker.removeFragment(_);return}if(this.state=pt.PARSING,this.switchingTrack&&x&&this.completeAudioSwitch(this.switchingTrack),F!=null&&F.tracks){const B=_.initSegment||_;if(this.unhandledEncryptionError(F,_))return;this._bufferInitSegment(v,F.tracks,B,u),o.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:s,tracks:F.tracks})}if(x){const{startPTS:B,endPTS:J,startDTS:ne,endDTS:le}=x;g&&(g.elementaryStreams[V.AUDIO]={startPTS:B,endPTS:J,startDTS:ne,endDTS:le}),_.setElementaryStreamInfo(V.AUDIO,B,J,ne,le),this.bufferFragmentData(x,_,g,u)}if(C!=null&&(n=C.samples)!=null&&n.length){const B=k({id:s,frag:_,details:y},C);o.trigger(S.FRAG_PARSING_METADATA,B)}if(D){const B=k({id:s,frag:_,details:y},D);o.trigger(S.FRAG_PARSING_USERDATA,B)}}_bufferInitSegment(t,n,s,o){if(this.state!==pt.PARSING||(n.video&&delete n.video,n.audiovideo&&delete n.audiovideo,!n.audio))return;const l=n.audio;l.id=P.AUDIO;const u=t.audioCodec;this.log(`Init audio buffer, container:${l.container}, codecs[level/parsed]=[${u}/${l.codec}]`),u&&u.split(",").length===1&&(l.levelCodec=u),this.hls.trigger(S.BUFFER_CODECS,n);const d=l.initSegment;if(d!=null&&d.byteLength){const _={type:"audio",frag:s,part:null,chunkMeta:o,parent:s.type,data:d};this.hls.trigger(S.BUFFER_APPENDING,_)}this.tickImmediate()}loadFragment(t,n,s){const o=this.fragmentTracker.getState(t);if(this.switchingTrack||o===Oi.NOT_LOADED||o===Oi.PARTIAL){var l;if(!ze(t))this._loadInitSegment(t,n);else if((l=n.details)!=null&&l.live&&!this.initPTS[t.cc]){this.log(`Waiting for video PTS in continuity counter ${t.cc} of live stream before loading audio fragment ${t.sn} of level ${this.trackId}`),this.state=pt.WAITING_INIT_PTS;const u=this.mainDetails;u&&u.fragmentStart!==n.details.fragmentStart&&gl(n.details,u)}else super.loadFragment(t,n,s)}else this.clearTrackerIfNeeded(t)}flushAudioIfNeeded(t){if(this.media&&this.bufferedTrack){const{name:n,lang:s,assocLang:o,characteristics:l,audioCodec:u,channels:d}=this.bufferedTrack;Pi({name:n,lang:s,assocLang:o,characteristics:l,audioCodec:u,channels:d},t,oi)||(Fi(t.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=t)}}completeAudioSwitch(t){const{hls:n}=this;this.flushAudioIfNeeded(t),this.bufferedTrack=t,this.switchingTrack=null,n.trigger(S.AUDIO_TRACK_SWITCHED,M({},t))}}class Au extends H{constructor(t,n){super(n,t.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=t}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(t,n,s){const o=n==null?void 0:n.renditionReports;if(o){let l=-1;for(let u=0;u<o.length;u++){const d=o[u];let _;try{_=new self.URL(d.URI,n.url).href}catch(g){this.warn(`Could not construct new URL for Rendition Report: ${g}`),_=d.URI||""}if(_===t){l=u;break}else _===t.substring(0,_.length)&&(l=u)}if(l!==-1){const u=o[l],d=parseInt(u["LAST-MSN"])||n.lastPartSn;let _=parseInt(u["LAST-PART"])||n.lastPartIndex;if(this.hls.config.lowLatencyMode){const v=Math.min(n.age-n.partTarget,n.targetduration);_>=0&&v>n.partTarget&&(_+=1)}const g=s&&sr(s);return new gn(d,_>=0?_:void 0,g)}}}loadPlaylist(t){this.clearTimer()}loadingPlaylist(t,n){this.clearTimer()}shouldLoadPlaylist(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)}getUrlWithDirectives(t,n){if(n)try{return n.addDirectives(t)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return t}playlistLoaded(t,n,s){const{details:o,stats:l}=n,u=self.performance.now(),d=l.loading.first?Math.max(0,u-l.loading.first):0;o.advancedDateTime=Date.now()-d;const _=this.hls.config.timelineOffset;if(_!==o.appliedTimelineOffset){const v=Math.max(_||0,0);o.appliedTimelineOffset=v,o.fragments.forEach(y=>{y.setStart(y.playlistOffset+v)})}if(o.live||s!=null&&s.live){const v="levelInfo"in n?n.levelInfo:n.track;if(o.reloaded(s),s&&o.fragments.length>0){Oo(s,o,this);const ne=o.playlistParsingError;if(ne){this.warn(ne);const le=this.hls;if(!le.config.ignorePlaylistParsingErrors){var g;const{networkDetails:Ee}=n;le.trigger(S.ERROR,{type:ge.NETWORK_ERROR,details:q.LEVEL_PARSING_ERROR,fatal:!1,url:o.url,error:ne,reason:ne.message,level:n.level||void 0,parent:(g=o.fragments[0])==null?void 0:g.type,networkDetails:Ee,stats:l});return}o.playlistParsingError=null}}o.requestScheduled===-1&&(o.requestScheduled=l.loading.start);const y=this.hls.mainForwardBufferInfo,x=y?y.end-y.len:0,D=(o.edge-x)*1e3,C=Vn(o,D);if(o.requestScheduled+C<u?o.requestScheduled=u:o.requestScheduled+=C,this.log(`live playlist ${t} ${o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:o.updated?"UPDATED":"MISSED"}`),!this.canLoad||!o.live)return;let F,B,J;if(o.canBlockReload&&o.endSN&&o.advanced){const ne=this.hls.config.lowLatencyMode,le=o.lastPartSn,Ee=o.endSN,Ie=o.lastPartIndex,tt=Ie!==-1,Pe=le===Ee;tt?Pe?(B=Ee+1,J=ne?0:Ie):(B=le,J=ne?Ie+1:o.maxPartIndex):B=Ee+1;const Ye=o.age,qe=Ye+o.ageHeader;let Fe=Math.min(qe-o.partTarget,o.targetduration*1.5);if(Fe>0){if(qe>o.targetduration*3)this.log(`Playlist last advanced ${Ye.toFixed(2)}s ago. Omitting segment and part directives.`),B=void 0,J=void 0;else if(s!=null&&s.tuneInGoal&&qe-o.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${Fe} with playlist age: ${o.age}`),Fe=0;else{const mt=Math.floor(Fe/o.targetduration);if(B+=mt,J!==void 0){const Zt=Math.round(Fe%o.targetduration/o.partTarget);J+=Zt}this.log(`CDN Tune-in age: ${o.ageHeader}s last advanced ${Ye.toFixed(2)}s goal: ${Fe} skip sn ${mt} to part ${J}`)}o.tuneInGoal=Fe}if(F=this.getDeliveryDirectives(o,n.deliveryDirectives,B,J),ne||!Pe){o.requestScheduled=u,this.loadingPlaylist(v,F);return}}else(o.canBlockReload||o.canSkipUntil)&&(F=this.getDeliveryDirectives(o,n.deliveryDirectives,B,J));F&&B!==void 0&&o.canBlockReload&&(o.requestScheduled=l.loading.first+Math.max(C-d*2,C/2)),this.scheduleLoading(v,F,o)}else this.clearTimer()}scheduleLoading(t,n,s){const o=s||t.details;if(!o){this.loadingPlaylist(t,n);return}const l=self.performance.now(),u=o.requestScheduled;if(l>=u){this.loadingPlaylist(t,n);return}const d=u-l;this.log(`reload live playlist ${t.name||t.bitrate+"bps"} in ${Math.round(d)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(t,n),d)}getDeliveryDirectives(t,n,s,o){let l=sr(t);return n!=null&&n.skip&&t.deltaUpdateFailed&&(s=n.msn,o=n.part,l=fn.No),new gn(s,o,l)}checkRetry(t){const n=t.details,s=Yi(t),o=t.errorAction,{action:l,retryCount:u=0,retryConfig:d}=o||{},_=!!o&&!!d&&(l===Ui.RetryRequest||!o.resolved&&l===Ui.SendAlternateToPenaltyBox);if(_){var g;if(u>=d.maxNumRetry)return!1;if(s&&(g=t.context)!=null&&g.deliveryDirectives)this.warn(`Retrying playlist loading ${u+1}/${d.maxNumRetry} after "${n}" without delivery-directives`),this.loadPlaylist();else{const v=vn(d,u);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),v),this.warn(`Retrying playlist loading ${u+1}/${d.maxNumRetry} after "${n}" in ${v}ms`)}t.levelRetry=!0,o.resolved=!0}return _}}function nf(h,t){if(h.length!==t.length)return!1;for(let n=0;n<h.length;n++)if(!El(h[n].attrs,t[n].attrs))return!1;return!0}function El(h,t,n){const s=h["STABLE-RENDITION-ID"];return s&&!n?s===t["STABLE-RENDITION-ID"]:!(n||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(o=>h[o]!==t[o])}function jo(h,t){return t.label.toLowerCase()===h.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(h.lang||"").toLowerCase())}class un extends Au{constructor(t){super(t,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:t}=this;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.LEVEL_LOADING,this.onLevelLoading,this),t.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(S.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(t,n){this.tracks=n.audioTracks||[]}onAudioTrackLoaded(t,n){const{id:s,groupId:o,details:l}=n,u=this.tracksInGroup[s];if(!u||u.groupId!==o){this.warn(`Audio track with id:${s} and group:${o} not found in active group ${u==null?void 0:u.groupId}`);return}const d=u.details;u.details=n.details,this.log(`Audio track ${s} "${u.name}" lang:${u.lang} group:${o} loaded [${l.startSN}-${l.endSN}]`),s===this.trackId&&this.playlistLoaded(s,n,d)}onLevelLoading(t,n){this.switchLevel(n.level)}onLevelSwitching(t,n){this.switchLevel(n.level)}switchLevel(t){const n=this.hls.levels[t];if(!n)return;const s=n.audioGroups||null,o=this.groupIds;let l=this.currentTrack;if(!s||(o==null?void 0:o.length)!==(s==null?void 0:s.length)||s!=null&&s.some(d=>(o==null?void 0:o.indexOf(d))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const d=this.tracks.filter(x=>!s||s.indexOf(x.groupId)!==-1);if(d.length)this.selectDefaultTrack&&!d.some(x=>x.default)&&(this.selectDefaultTrack=!1),d.forEach((x,D)=>{x.id=D});else if(!l&&!this.tracksInGroup.length)return;this.tracksInGroup=d;const _=this.hls.config.audioPreference;if(!l&&_){const x=Wt(_,d,oi);if(x>-1)l=d[x];else{const D=Wt(_,this.tracks);l=this.tracks[D]}}let g=this.findTrackId(l);g===-1&&l&&(g=this.findTrackId(null));const v={audioTracks:d};this.log(`Updating audio tracks, ${d.length} track(s) found in group(s): ${s==null?void 0:s.join(",")}`),this.hls.trigger(S.AUDIO_TRACKS_UPDATED,v);const y=this.trackId;if(g!==-1&&y===-1)this.setAudioTrack(g);else if(d.length&&y===-1){var u;const x=new Error(`No audio track selected for current audio group-ID(s): ${(u=this.groupIds)==null?void 0:u.join(",")} track count: ${d.length}`);this.warn(x.message),this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:x})}}}onError(t,n){n.fatal||!n.context||n.context.type===Te.AUDIO_TRACK&&n.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}setAudioOption(t){const n=this.hls;if(n.config.audioPreference=t,t){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const o=this.currentTrack;if(o&&Pi(t,o,oi))return o;const l=Wt(t,this.tracksInGroup,oi);if(l>-1){const u=this.tracksInGroup[l];return this.setAudioTrack(l),u}else if(o){let u=n.loadLevel;u===-1&&(u=n.firstAutoLevel);const d=Ri(t,n.levels,s,u,oi);if(d===-1)return null;n.nextLoadLevel=d}if(t.channels||t.audioCodec){const u=Wt(t,s);if(u>-1)return s[u]}}}return null}setAudioTrack(t){const n=this.tracksInGroup;if(t<0||t>=n.length){this.warn(`Invalid audio track id: ${t}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,o=n[t],l=o.details&&!o.details.live;if(t===this.trackId&&o===s&&l||(this.log(`Switching to audio-track ${t} "${o.name}" lang:${o.lang} group:${o.groupId} channels:${o.channels}`),this.trackId=t,this.currentTrack=o,this.hls.trigger(S.AUDIO_TRACK_SWITCHING,M({},o)),l))return;const u=this.switchParams(o.url,s==null?void 0:s.details,o.details);this.loadPlaylist(u)}findTrackId(t){const n=this.tracksInGroup;for(let s=0;s<n.length;s++){const o=n[s];if(!(this.selectDefaultTrack&&!o.default)&&(!t||Pi(t,o,oi)))return s}if(t){const{name:s,lang:o,assocLang:l,characteristics:u,audioCodec:d,channels:_}=t;for(let g=0;g<n.length;g++){const v=n[g];if(Pi({name:s,lang:o,assocLang:l,characteristics:u,audioCodec:d,channels:_},v,oi))return g}for(let g=0;g<n.length;g++){const v=n[g];if(El(t.attrs,v.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return g}for(let g=0;g<n.length;g++){const v=n[g];if(El(t.attrs,v.attrs,["LANGUAGE"]))return g}}return-1}loadPlaylist(t){super.loadPlaylist();const n=this.currentTrack;this.shouldLoadPlaylist(n)&&Fi(n.url,this.hls)&&this.scheduleLoading(n,t)}loadingPlaylist(t,n){super.loadingPlaylist(t,n);const s=t.id,o=t.groupId,l=this.getUrlWithDirectives(t.url,n),u=t.details,d=u==null?void 0:u.age;this.log(`Loading audio-track ${s} "${t.name}" lang:${t.lang} group:${o}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${d&&u.live?" age "+d.toFixed(1)+(u.type?" "+u.type||0:""):""} ${l}`),this.hls.trigger(S.AUDIO_TRACK_LOADING,{url:l,id:s,groupId:o,deliveryDirectives:n||null,track:t})}}class Zn{constructor(t){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=t}destroy(){this.tracks=this.queues=null}append(t,n,s){if(this.queues===null||this.tracks===null)return;const o=this.queues[n];o.push(t),o.length===1&&!s&&this.executeNext(n)}appendBlocker(t){return new Promise(n=>{const s={label:"async-blocker",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,t)})}prependBlocker(t){return new Promise(n=>{if(this.queues){const s={label:"async-blocker-prepend",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[t].unshift(s)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(t=>{var n;const s=(n=t[0])==null?void 0:n.label;(s==="async-blocker"||s==="async-blocker-prepend")&&(t[0].execute(),t.splice(0,1))})}unblockAudio(t){if(this.queues===null)return;this.queues.audio[0]===t&&this.shiftAndExecuteNext("audio")}executeNext(t){if(this.queues===null||this.tracks===null)return;const n=this.queues[t];if(n.length){const o=n[0];try{o.execute()}catch(l){var s;if(o.onError(l),this.queues===null||this.tracks===null)return;const u=(s=this.tracks[t])==null?void 0:s.buffer;u!=null&&u.updating||this.shiftAndExecuteNext(t)}}}shiftAndExecuteNext(t){this.queues!==null&&(this.queues[t].shift(),this.executeNext(t))}current(t){var n;return((n=this.queues)==null?void 0:n[t][0])||null}toString(){const{queues:t,tracks:n}=this;return t===null||n===null?"<destroyed>":`
|
|
|
${this.list("video")}
|
|
|
${this.list("audio")}
|
|
|
${this.list("audiovideo")}}`}list(t){var n,s;return(n=this.queues)!=null&&n[t]||(s=this.tracks)!=null&&s[t]?`${t}: (${this.listSbInfo(t)}) ${this.listOps(t)}`:""}listSbInfo(t){var n;const s=(n=this.tracks)==null?void 0:n[t],o=s==null?void 0:s.buffer;return o?`SourceBuffer${o.updating?" updating":""}${s.ended?" ended":""}${s.ending?" ending":""}`:"none"}listOps(t){var n;return((n=this.queues)==null?void 0:n[t].map(s=>s.label).join(", "))||""}}const Ma=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Gc="HlsJsTrackRemovedError";class ws extends Error{constructor(t){super(t),this.name=Gc}}class rf extends H{constructor(t,n){super("buffer-controller",t.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=s=>{var o;this.hls&&((o=this.mediaSource)==null?void 0:o.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=s=>{const{media:o,mediaSource:l}=this;s&&this.log("Media source opened"),!(!o||!l)&&(l.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(S.MEDIA_ATTACHED,{media:o,mediaSource:l}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:o}=this;s!==o&&this.error(`Media element src was set while attaching MediaSource (${o} > ${s})`)},this.hls=t,this.fragmentTracker=n,this.appendSource=We(Oe(t.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:t}=this;t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.BUFFER_RESET,this.onBufferReset,this),t.on(S.BUFFER_APPENDING,this.onBufferAppending,this),t.on(S.BUFFER_CODECS,this.onBufferCodecs,this),t.on(S.BUFFER_EOS,this.onBufferEos,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.FRAG_PARSED,this.onFragParsed,this),t.on(S.FRAG_CHANGED,this.onFragChanged,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.BUFFER_RESET,this.onBufferReset,this),t.off(S.BUFFER_APPENDING,this.onBufferAppending,this),t.off(S.BUFFER_CODECS,this.onBufferCodecs,this),t.off(S.BUFFER_EOS,this.onBufferEos,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.FRAG_PARSED,this.onFragParsed,this),t.off(S.FRAG_CHANGED,this.onFragChanged,this),t.off(S.ERROR,this.onError,this)}transferMedia(){const{media:t,mediaSource:n}=this;if(!t)return null;const s={};if(this.operationQueue){const l=this.isUpdating();l||this.operationQueue.removeBlockers();const u=this.isQueued();(l||u)&&this.warn(`Transfering MediaSource with${u?" operations in queue":""}${l?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const o=this.transferData;return!this.sourceBufferCount&&o&&o.mediaSource===n?k(s,o.tracks):this.sourceBuffers.forEach(l=>{const[u]=l;u&&(s[u]=k({},this.tracks[u]),this.removeBuffer(u)),l[0]=l[1]=null}),{media:t,mediaSource:n,tracks:s}}initTracks(){const t={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=t,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(t,n){var s;let o=2;(n.audio&&!n.video||!n.altAudio)&&(o=1),this.bufferCodecEventsTotal=o,this.log(`${o} bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&o&&this.bufferCreated()}onMediaAttaching(t,n){const s=this.media=n.media;this.transferData=this.overrides=void 0;const o=Oe(this.appendSource);if(o){const l=!!n.mediaSource;(l||n.overrides)&&(this.transferData=n,this.overrides=n.overrides);const u=this.mediaSource=n.mediaSource||new o;if(this.assignMediaSource(u),l)this._objectUrl=s.src,this.attachTransferred();else{const d=this._objectUrl=self.URL.createObjectURL(u);if(this.appendSource)try{s.removeAttribute("src");const _=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||_&&u instanceof _,pa(s),sf(s,d),s.load()}catch(_){s.src=d}else s.src=d}s.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(t){var n,s;this.log(`${((n=this.transferData)==null?void 0:n.mediaSource)===t?"transferred":"created"} media source: ${(s=t.constructor)==null?void 0:s.name}`),t.addEventListener("sourceopen",this._onMediaSourceOpen),t.addEventListener("sourceended",this._onMediaSourceEnded),t.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.addEventListener("startstreaming",this._onStartStreaming),t.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const t=this.media,n=this.transferData;if(!n||!t)return;const s=this.tracks,o=n.tracks,l=o?Object.keys(o):null,u=l?l.length:0,d=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(o&&l&&u){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: ${$e(s,(_,g)=>_==="initSegment"?void 0:g)};
|
|
|
transfer tracks: ${$e(o,(_,g)=>_==="initSegment"?void 0:g)}}`),!Be(o,s)){n.mediaSource=null,n.tracks=void 0;const _=t.currentTime,g=this.details,v=Math.max(_,(g==null?void 0:g.fragments[0].start)||0);if(v-_>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${_} -> ${v}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(o)}"->"${Object.keys(s)}") start time: ${v} currentTime: ${_}`),this.onMediaDetaching(S.MEDIA_DETACHING,{}),this.onMediaAttaching(S.MEDIA_ATTACHING,n),t.currentTime=v;return}this.transferData=void 0,l.forEach(_=>{const g=_,v=o[g];if(v){const y=v.buffer;if(y){const x=this.fragmentTracker,D=v.id;if(x.hasFragments(D)||x.hasParts(D)){const B=li.getBuffered(y);x.detectEvictedFragments(g,B,D,null,!0)}const C=Hc(g),F=[g,y];this.sourceBuffers[C]=F,y.updating&&this.operationQueue&&this.operationQueue.prependBlocker(g),this.trackSourceBuffer(g,v)}}}),d(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),d()}get mediaSourceOpenOrEnded(){var t;const n=(t=this.mediaSource)==null?void 0:t.readyState;return n==="open"||n==="ended"}onMediaDetaching(t,n){const s=!!n.transferMedia;this.transferData=this.overrides=void 0;const{media:o,mediaSource:l,_objectUrl:u}=this;if(l){if(this.log(`media source ${s?"transferring":"detaching"}`),s)this.sourceBuffers.forEach(([d])=>{d&&this.removeBuffer(d)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const d=l.readyState==="open";try{const _=l.sourceBuffers;for(let g=_.length;g--;)d&&_[g].abort(),l.removeSourceBuffer(_[g]);d&&l.endOfStream()}catch(_){this.warn(`onMediaDetaching: ${_.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(l.removeEventListener("startstreaming",this._onStartStreaming),l.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}o&&(o.removeEventListener("emptied",this._onMediaEmptied),s||(u&&self.URL.revokeObjectURL(u),this.mediaSrc===u?(o.removeAttribute("src"),this.appendSource&&pa(o),o.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(S.MEDIA_DETACHED,n)}onBufferReset(){this.sourceBuffers.forEach(([t])=>{t&&this.resetBuffer(t)}),this.initTracks()}resetBuffer(t){var n;const s=(n=this.tracks[t])==null?void 0:n.buffer;if(this.removeBuffer(t),s)try{var o;(o=this.mediaSource)!=null&&o.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(s)}catch(l){this.warn(`onBufferReset ${t}`,l)}delete this.tracks[t]}removeBuffer(t){this.removeBufferListeners(t),this.sourceBuffers[Hc(t)]=[null,null];const n=this.tracks[t];n&&(n.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Zn(this.tracks)}onBufferCodecs(t,n){var s;const o=this.tracks,l=Object.keys(n);this.log(`BUFFER_CODECS: "${l}" (current SB count ${this.sourceBufferCount})`);const u="audiovideo"in n&&(o.audio||o.video)||o.audiovideo&&("audio"in n||"video"in n),d=!u&&this.sourceBufferCount&&this.media&&l.some(_=>!o[_]);if(u||d){this.warn(`Unsupported transition between "${Object.keys(o)}" and "${l}" SourceBuffers`);return}l.forEach(_=>{var g,v;const y=n[_],{id:x,codec:D,levelCodec:C,container:F,metadata:B,supplemental:J}=y;let ne=o[_];const le=(g=this.transferData)==null||(g=g.tracks)==null?void 0:g[_],Ee=le!=null&&le.buffer?le:ne,Ie=(Ee==null?void 0:Ee.pendingCodec)||(Ee==null?void 0:Ee.codec),tt=Ee==null?void 0:Ee.levelCodec;ne||(ne=o[_]={buffer:void 0,listeners:[],codec:D,supplemental:J,container:F,levelCodec:C,metadata:B,id:x});const Pe=Nt(Ie,tt),Ye=Pe==null?void 0:Pe.replace(Ma,"$1");let qe=Nt(D,C);const Fe=(v=qe)==null?void 0:v.replace(Ma,"$1");qe&&Pe&&Ye!==Fe&&(_.slice(0,5)==="audio"&&(qe=ot(qe,this.appendSource)),this.log(`switching codec ${Ie} to ${qe}`),qe!==(ne.pendingCodec||ne.codec)&&(ne.pendingCodec=qe),ne.container=F,this.appendChangeType(_,F,qe))}),(this.tracksReady||this.sourceBufferCount)&&(n.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!n.video&&((s=n.audio)==null?void 0:s.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((t,n)=>{const s=this.tracks[n];return t[n]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},t},{})}appendChangeType(t,n,s){const o=`${n};codecs=${s}`,l={label:`change-type=${o}`,execute:()=>{const u=this.tracks[t];if(u){const d=u.buffer;d!=null&&d.changeType&&(this.log(`changing ${t} sourceBuffer type to ${o}`),d.changeType(o),u.codec=s,u.container=n)}this.shiftAndExecuteNext(t)},onStart:()=>{},onComplete:()=>{},onError:u=>{this.warn(`Failed to change ${t} SourceBuffer type`,u)}};this.append(l,t,this.isPending(this.tracks[t]))}blockAudio(t){var n;const s=t.start,o=s+t.duration*.05;if(((n=this.fragmentTracker.getAppendedFrag(s,P.MAIN))==null?void 0:n.gap)===!0)return;const u={label:"block-audio",execute:()=>{var d;const _=this.tracks.video;(this.lastVideoAppendEnd>o||_!=null&&_.buffer&&li.isBuffered(_.buffer,o)||((d=this.fragmentTracker.getAppendedFrag(o,P.MAIN))==null?void 0:d.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:d=>{this.warn("Error executing block-audio operation",d)}};this.blockedAudioAppend={op:u,frag:t},this.append(u,"audio",!0)}unblockAudio(){const{blockedAudioAppend:t,operationQueue:n}=this;t&&n&&(this.blockedAudioAppend=null,n.unblockAudio(t.op))}onBufferAppending(t,n){const{tracks:s}=this,{data:o,type:l,parent:u,frag:d,part:_,chunkMeta:g,offset:v}=n,y=g.buffering[l],{sn:x,cc:D}=d,C=self.performance.now();y.start=C;const F=d.stats.buffering,B=_?_.stats.buffering:null;F.start===0&&(F.start=C),B&&B.start===0&&(B.start=C);const J=s.audio;let ne=!1;l==="audio"&&(J==null?void 0:J.container)==="audio/mpeg"&&(ne=!this.lastMpegAudioChunk||g.id===1||this.lastMpegAudioChunk.sn!==g.sn,this.lastMpegAudioChunk=g);const le=s.video,Ee=le==null?void 0:le.buffer;if(Ee&&x!=="initSegment"){const Pe=_||d,Ye=this.blockedAudioAppend;if(l==="audio"&&u!=="main"&&!this.blockedAudioAppend&&!(le.ending||le.ended)){const Fe=Pe.start+Pe.duration*.05,mt=Ee.buffered,Zt=this.currentOp("video");!mt.length&&!Zt?this.blockAudio(Pe):!Zt&&!li.isBuffered(Ee,Fe)&&this.lastVideoAppendEnd<Fe&&this.blockAudio(Pe)}else if(l==="video"){const qe=Pe.end;if(Ye){const Fe=Ye.frag.start;(qe>Fe||qe<this.lastVideoAppendEnd||li.isBuffered(Ee,Fe))&&this.unblockAudio()}this.lastVideoAppendEnd=qe}}const Ie=(_||d).start,tt={label:`append-${l}`,execute:()=>{var Pe;y.executeStart=self.performance.now();const Ye=(Pe=this.tracks[l])==null?void 0:Pe.buffer;Ye&&(ne?this.updateTimestampOffset(Ye,Ie,.1,l,x,D):v!==void 0&&ce(v)&&this.updateTimestampOffset(Ye,v,1e-6,l,x,D)),this.appendExecutor(o,l)},onStart:()=>{},onComplete:()=>{const Pe=self.performance.now();y.executeEnd=y.end=Pe,F.first===0&&(F.first=Pe),B&&B.first===0&&(B.first=Pe);const Ye={};this.sourceBuffers.forEach(([qe,Fe])=>{qe&&(Ye[qe]=li.getBuffered(Fe))}),this.appendErrors[l]=0,l==="audio"||l==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(S.BUFFER_APPENDED,{type:l,frag:d,part:_,chunkMeta:g,parent:d.type,timeRanges:Ye})},onError:Pe=>{var Ye;const qe={type:ge.MEDIA_ERROR,parent:d.type,details:q.BUFFER_APPEND_ERROR,sourceBufferName:l,frag:d,part:_,chunkMeta:g,error:Pe,err:Pe,fatal:!1},Fe=(Ye=this.media)==null?void 0:Ye.error;if(Pe.code===DOMException.QUOTA_EXCEEDED_ERR||Pe.name=="QuotaExceededError"||"quota"in Pe)qe.details=q.BUFFER_FULL_ERROR;else if(Pe.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Fe)qe.errorAction=ln(!0);else if(Pe.name===Gc&&this.sourceBufferCount===0)qe.errorAction=ln(!0);else{const mt=++this.appendErrors[l];this.warn(`Failed ${mt}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${l}" sourceBuffer (${Fe||"no media error"})`),(mt>=this.hls.config.appendErrorMaxRetry||Fe)&&(qe.fatal=!0)}this.hls.trigger(S.ERROR,qe)}};this.log(`queuing "${l}" append sn: ${x}${_?" p: "+_.index:""} of ${d.type===P.MAIN?"level":"track"} ${d.level} cc: ${D}`),this.append(tt,l,this.isPending(this.tracks[l]))}getFlushOp(t,n,s){return this.log(`queuing "${t}" remove ${n}-${s}`),{label:"remove",execute:()=>{this.removeExecutor(t,n,s)},onStart:()=>{},onComplete:()=>{this.hls.trigger(S.BUFFER_FLUSHED,{type:t})},onError:o=>{this.warn(`Failed to remove ${n}-${s} from "${t}" SourceBuffer`,o)}}}onBufferFlushing(t,n){const{type:s,startOffset:o,endOffset:l}=n;s?this.append(this.getFlushOp(s,o,l),s):this.sourceBuffers.forEach(([u])=>{u&&this.append(this.getFlushOp(u,o,l),u)})}onFragParsed(t,n){const{frag:s,part:o}=n,l=[],u=o?o.elementaryStreams:s.elementaryStreams;u[V.AUDIOVIDEO]?l.push("audiovideo"):(u[V.AUDIO]&&l.push("audio"),u[V.VIDEO]&&l.push("video"));const d=()=>{const _=self.performance.now();s.stats.buffering.end=_,o&&(o.stats.buffering.end=_);const g=o?o.stats:s.stats;this.hls.trigger(S.FRAG_BUFFERED,{frag:s,part:o,stats:g,id:s.type})};l.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(d,l).catch(_=>{this.warn(`Fragment buffered callback ${_}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(t,n){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([t])=>{if(t){const n=this.tracks[t];if(n)return!n.ended||n.ending}return!1})}onBufferEos(t,n){var s;this.sourceBuffers.forEach(([u])=>{if(u){const d=this.tracks[u];(!n.type||n.type===u)&&(d.ending=!0,d.ended||(d.ended=!0,this.log(`${u} buffer reached EOS`)))}});const o=((s=this.overrides)==null?void 0:s.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([u])=>{var d;return u&&!((d=this.tracks[u])!=null&&d.ended)})?o?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:u}=this;if(!u||u.readyState!=="open"){u&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${u.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),u.endOfStream(),this.hls.trigger(S.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(S.BUFFERED_TO_END,void 0)):n.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([t])=>{if(t!==null){const n=this.tracks[t];n&&(n.ending=!1)}})}onLevelUpdated(t,{details:n}){n.fragments.length&&(this.details=n,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const t=this.getDurationAndRange();t&&this.updateMediaSource(t)})}onError(t,n){if(n.details===q.BUFFER_APPEND_ERROR&&n.frag){var s;const o=(s=n.errorAction)==null?void 0:s.nextAutoLevel;ce(o)&&o!==n.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:t,details:n,media:s}=this;if(!s||n===null||!this.sourceBufferCount)return;const o=t.config,l=s.currentTime,u=n.levelTargetDuration,d=n.live&&o.liveBackBufferLength!==null?o.liveBackBufferLength:o.backBufferLength;if(ce(d)&&d>=0){const g=Math.max(d,u),v=Math.floor(l/u)*u-g;this.flushBackBuffer(l,u,v)}const _=o.frontBufferFlushThreshold;if(ce(_)&&_>0){const g=Math.max(o.maxBufferLength,_),v=Math.max(g,u),y=Math.floor(l/u)*u+v;this.flushFrontBuffer(l,u,y)}}flushBackBuffer(t,n,s){this.sourceBuffers.forEach(([o,l])=>{if(l){const d=li.getBuffered(l);if(d.length>0&&s>d.start(0)){var u;this.hls.trigger(S.BACK_BUFFER_REACHED,{bufferEnd:s});const _=this.tracks[o];if((u=this.details)!=null&&u.live)this.hls.trigger(S.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(_!=null&&_.ended){this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:o})}}})}flushFrontBuffer(t,n,s){this.sourceBuffers.forEach(([o,l])=>{if(l){const u=li.getBuffered(l),d=u.length;if(d<2)return;const _=u.start(d-1),g=u.end(d-1);if(s>_||t>=_&&t<=g)return;this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:_,endOffset:1/0,type:o})}})}getDurationAndRange(){var t;const{details:n,mediaSource:s}=this;if(!n||!this.media||(s==null?void 0:s.readyState)!=="open")return null;const o=n.edge;if(n.live&&this.hls.config.liveDurationInfinity){if(n.fragments.length&&s.setLiveSeekableRange){const g=Math.max(0,n.fragmentStart),v=Math.max(g,o);return{duration:1/0,start:g,end:v}}return{duration:1/0}}const l=(t=this.overrides)==null?void 0:t.duration;if(l)return ce(l)?{duration:l}:null;const u=this.media.duration,d=ce(s.duration)?s.duration:0;return o>d&&o>u||!ce(u)?{duration:o}:null}updateMediaSource({duration:t,start:n,end:s}){const o=this.mediaSource;!this.media||!o||o.readyState!=="open"||(o.duration!==t&&(ce(t)&&this.log(`Updating MediaSource duration to ${t.toFixed(3)}`),o.duration=t),n!==void 0&&s!==void 0&&(this.log(`MediaSource duration is set to ${o.duration}. Setting seekable range to ${n}-${s}.`),o.setLiveSeekableRange(n,s)))}get tracksReady(){const t=this.pendingTrackCount;return t>0&&(t>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:t,pendingTrackCount:n,tracks:s}=this;if(this.log(`checkPendingTracks (pending: ${n} codec events expected: ${t}) ${$e(s)}`),this.tracksReady){var o;const l=(o=this.transferData)==null?void 0:o.tracks;l&&Object.keys(l).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const t={};this.sourceBuffers.forEach(([n,s])=>{if(n){const o=this.tracks[n];t[n]={buffer:s,container:o.container,codec:o.codec,supplemental:o.supplemental,levelCodec:o.levelCodec,id:o.id,metadata:o.metadata}}}),this.hls.trigger(S.BUFFER_CREATED,{tracks:t}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([n])=>{this.executeNext(n)})}else{const t=new Error("could not create source buffer for media codec(s)");this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:t,reason:t.message})}}createSourceBuffers(){const{tracks:t,sourceBuffers:n,mediaSource:s}=this;if(!s)throw new Error("createSourceBuffers called when mediaSource was null");for(const l in t){const u=l,d=t[u];if(this.isPending(d)){const _=this.getTrackCodec(d,u),g=`${d.container};codecs=${_}`;d.codec=_,this.log(`creating sourceBuffer(${g})${this.currentOp(u)?" Queued":""} ${$e(d)}`);try{const v=s.addSourceBuffer(g),y=Hc(u),x=[u,v];n[y]=x,d.buffer=v}catch(v){var o;this.error(`error while trying to add sourceBuffer: ${v.message}`),this.shiftAndExecuteNext(u),(o=this.operationQueue)==null||o.removeBlockers(),delete this.tracks[u],this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:v,sourceBufferName:u,mimeType:g,parent:d.id});return}this.trackSourceBuffer(u,d)}}this.bufferCreated()}getTrackCodec(t,n){const s=t.supplemental;let o=t.codec;s&&(n==="video"||n==="audiovideo")&&ye(s,"video")&&(o=xt(o,s));const l=Nt(o,t.levelCodec);return l?n.slice(0,5)==="audio"?ot(l,this.appendSource):l:""}trackSourceBuffer(t,n){const s=n.buffer;if(!s)return;const o=this.getTrackCodec(n,t);this.tracks[t]={buffer:s,codec:o,container:n.container,levelCodec:n.levelCodec,supplemental:n.supplemental,metadata:n.metadata,id:n.id,listeners:[]},this.removeBufferListeners(t),this.addBufferListener(t,"updatestart",this.onSBUpdateStart),this.addBufferListener(t,"updateend",this.onSBUpdateEnd),this.addBufferListener(t,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(t,"bufferedchange",(l,u)=>{const d=u.removedRanges;d!=null&&d.length&&this.hls.trigger(S.BUFFER_FLUSHED,{type:l})})}get mediaSrc(){var t,n;const s=((t=this.media)==null||(n=t.querySelector)==null?void 0:n.call(t,"source"))||this.media;return s==null?void 0:s.src}onSBUpdateStart(t){const n=this.currentOp(t);n&&n.onStart()}onSBUpdateEnd(t){var n;if(((n=this.mediaSource)==null?void 0:n.readyState)==="closed"){this.resetBuffer(t);return}const s=this.currentOp(t);s&&(s.onComplete(),this.shiftAndExecuteNext(t))}onSBUpdateError(t,n){var s;const o=new Error(`${t} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${o}`,n),this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:o,fatal:!1});const l=this.currentOp(t);l&&l.onError(o)}updateTimestampOffset(t,n,s,o,l,u){const d=n-t.timestampOffset;Math.abs(d)>=s&&(this.log(`Updating ${o} SourceBuffer timestampOffset to ${n} (sn: ${l} cc: ${u})`),t.timestampOffset=n)}removeExecutor(t,n,s){const{media:o,mediaSource:l}=this,u=this.tracks[t],d=u==null?void 0:u.buffer;if(!o||!l||!d){this.warn(`Attempting to remove from the ${t} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(t);return}const _=ce(o.duration)?o.duration:1/0,g=ce(l.duration)?l.duration:1/0,v=Math.max(0,n),y=Math.min(s,_,g);y>v&&(!u.ending||u.ended)?(u.ended=!1,this.log(`Removing [${v},${y}] from the ${t} SourceBuffer`),d.remove(v,y)):this.shiftAndExecuteNext(t)}appendExecutor(t,n){const s=this.tracks[n],o=s==null?void 0:s.buffer;if(!o)throw new ws(`Attempting to append to the ${n} SourceBuffer, but it does not exist`);s.ending=!1,s.ended=!1,o.appendBuffer(t)}blockUntilOpen(t){if(this.isUpdating()||this.isQueued())this.blockBuffers(t).catch(n=>{this.warn(`SourceBuffer blocked callback ${n}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{t()}catch(n){this.warn(`Callback run without blocking ${this.operationQueue} ${n}`)}}isUpdating(){return this.sourceBuffers.some(([t,n])=>t&&n.updating)}isQueued(){return this.sourceBuffers.some(([t])=>t&&!!this.currentOp(t))}isPending(t){return!!t&&!t.buffer}blockBuffers(t,n=this.sourceBufferTypes){if(!n.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(t);const{operationQueue:s}=this,o=n.map(u=>this.appendBlocker(u));return n.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(o).then(u=>{s===this.operationQueue&&(t(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(t){t.forEach(n=>{var s;const o=(s=this.tracks[n])==null?void 0:s.buffer;!o||o.updating||this.shiftAndExecuteNext(n)})}append(t,n,s){this.operationQueue&&this.operationQueue.append(t,n,s)}appendBlocker(t){if(this.operationQueue)return this.operationQueue.appendBlocker(t)}currentOp(t){return this.operationQueue?this.operationQueue.current(t):null}executeNext(t){t&&this.operationQueue&&this.operationQueue.executeNext(t)}shiftAndExecuteNext(t){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(t)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((t,n)=>t+(this.isPending(this.tracks[n])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((t,[n])=>t+(n?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([t])=>t).filter(t=>!!t)}addBufferListener(t,n,s){const o=this.tracks[t];if(!o)return;const l=o.buffer;if(!l)return;const u=s.bind(this,t);o.listeners.push({event:n,listener:u}),l.addEventListener(n,u)}removeBufferListeners(t){const n=this.tracks[t];if(!n)return;const s=n.buffer;s&&(n.listeners.forEach(o=>{s.removeEventListener(o.event,o.listener)}),n.listeners.length=0)}}function pa(h){const t=h.querySelectorAll("source");[].slice.call(t).forEach(n=>{h.removeChild(n)})}function sf(h,t){const n=self.document.createElement("source");n.type="video/mp4",n.src=t,h.appendChild(n)}function Hc(h){return h==="audio"?1:0}class Wc{constructor(t){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=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(t){this.streamController=t}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:t}=this;t.on(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(S.BUFFER_CODECS,this.onBufferCodecs,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:t}=this;t.off(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(S.BUFFER_CODECS,this.onBufferCodecs,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(t,n){const s=this.hls.levels[n.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(t,n){this.media=n.media instanceof HTMLVideoElement?n.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(t,n){const s=this.hls;this.restrictedLevels=[],this.firstLevel=n.firstLevel,s.config.capLevelToPlayerSize&&n.video&&this.startCapping()}onLevelsUpdated(t,n){this.timer&&ce(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(t,n){this.hls.config.capLevelToPlayerSize&&n.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 t=this.hls.levels;if(t.length){const n=this.hls,s=this.getMaxLevel(t.length-1);s!==this.autoLevelCapping&&n.logger.log(`Setting autoLevelCapping to ${s}: ${t[s].height}p@${t[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),n.autoLevelCapping=s,n.autoLevelEnabled&&n.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=n.autoLevelCapping}}}getMaxLevel(t){const n=this.hls.levels;if(!n.length)return-1;const s=n.filter((o,l)=>this.isLevelAllowed(o)&&l<=t);return this.clientRect=null,Wc.getMaxLevelByMediaSize(s,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 t=this.media,n={width:0,height:0};if(t){const s=t.getBoundingClientRect();n.width=s.width,n.height=s.height,!n.width&&!n.height&&(n.width=s.right-s.left||t.width||0,n.height=s.bottom-s.top||t.height||0)}return this.clientRect=n,n}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(n){}return Math.min(t,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(t){return!this.restrictedLevels.some(s=>t.bitrate===s.bitrate&&t.width===s.width&&t.height===s.height)}static getMaxLevelByMediaSize(t,n,s){if(!(t!=null&&t.length))return-1;const o=(d,_)=>_?d.width!==_.width||d.height!==_.height:!0;let l=t.length-1;const u=Math.max(n,s);for(let d=0;d<t.length;d+=1){const _=t[d];if((_.width>=u||_.height>=u)&&o(_,t[d+1])){l=d;break}}return l}}const Fr={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Mt={HLS:"h"};class Is{constructor(t,n){Array.isArray(t)&&(t=t.map(s=>s instanceof Is?s:new Is(s))),this.value=t,this.params=n}}const Du="Dict";function Cu(h){return Array.isArray(h)?JSON.stringify(h):h instanceof Map?"Map{}":h instanceof Set?"Set{}":typeof h=="object"?JSON.stringify(h):String(h)}function Mu(h,t,n,s){return new Error(`failed to ${h} "${Cu(t)}" as ${n}`,{cause:s})}function Zs(h,t,n){return Mu("serialize",h,t,n)}class of{constructor(t){this.description=t}}const lf="Bare Item",Er="Boolean";function bd(h){if(typeof h!="boolean")throw Zs(h,Er);return h?"?1":"?0"}function jc(h){return btoa(String.fromCharCode(...h))}const Iu="Byte Sequence";function Ru(h){if(ArrayBuffer.isView(h)===!1)throw Zs(h,Iu);return`:${jc(h)}:`}const ao="Integer";function qo(h){return h<-999999999999999||999999999999999<h}function fs(h){if(qo(h))throw Zs(h,ao);return h.toString()}function oo(h){return`@${fs(h.getTime()/1e3)}`}function Wr(h,t){if(h<0)return-Wr(-h,t);const n=Math.pow(10,t);if(Math.abs(h*n%1-.5)<Number.EPSILON){const o=Math.floor(h*n);return(o%2===0?o:o+1)/n}else return Math.round(h*n)/n}const Ia="Decimal";function kl(h){const t=Wr(h,3);if(Math.floor(Math.abs(t)).toString().length>12)throw Zs(h,Ia);const n=t.toString();return n.includes(".")?n:`${n}.0`}const Ys="String",uf=/[\x00-\x1f\x7f]+/;function cf(h){if(uf.test(h))throw Zs(h,Ys);return`"${h.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function qc(h){return h.description||h.toString().slice(7,-1)}const xd="Token";function Mr(h){const t=qc(h);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t)===!1)throw Zs(t,xd);return t}function Rs(h){switch(typeof h){case"number":if(!ce(h))throw Zs(h,lf);return Number.isInteger(h)?fs(h):kl(h);case"string":return cf(h);case"symbol":return Mr(h);case"boolean":return bd(h);case"object":if(h instanceof Date)return oo(h);if(h instanceof Uint8Array)return Ru(h);if(h instanceof of)return Mr(h);default:throw Zs(h,lf)}}const wd="Key";function Pu(h){if(/^[a-z*][a-z0-9\-_.*]*$/.test(h)===!1)throw Zs(h,wd);return h}function Tl(h){return h==null?"":Object.entries(h).map(([t,n])=>n===!0?`;${Pu(t)}`:`;${Pu(t)}=${Rs(n)}`).join("")}function sn(h){return h instanceof Is?`${Rs(h.value)}${Tl(h.params)}`:Rs(h)}function Zo(h){return`(${h.value.map(sn).join(" ")})${Tl(h.params)}`}function lo(h,t={whitespace:!0}){if(typeof h!="object"||h==null)throw Zs(h,Du);const n=h instanceof Map?h.entries():Object.entries(h),s=t!=null&&t.whitespace?" ":"";return Array.from(n).map(([o,l])=>{l instanceof Is||(l=new Is(l));let u=Pu(o);return l.value===!0?u+=Tl(l.params):(u+="=",Array.isArray(l.value)?u+=Zo(l):u+=sn(l)),u}).join(`,${s}`)}function Al(h,t){return lo(h,t)}const Qe="CMCD-Object",_r="CMCD-Request",uo="CMCD-Session",Xs="CMCD-Status",Sd={br:Qe,ab:Qe,d:Qe,ot:Qe,tb:Qe,tpb:Qe,lb:Qe,tab:Qe,lab:Qe,url:Qe,pb:_r,bl:_r,tbl:_r,dl:_r,ltc:_r,mtp:_r,nor:_r,nrr:_r,rc:_r,sn:_r,sta:_r,su:_r,ttfb:_r,ttfbb:_r,ttlb:_r,cmsdd:_r,cmsds:_r,smrt:_r,df:_r,cs:_r,ts:_r,cid:uo,pr:uo,sf:uo,sid:uo,st:uo,v:uo,msd:uo,bs:Xs,bsd:Xs,cdn:Xs,rtp:Xs,bg:Xs,pt:Xs,ec:Xs,e:Xs},Ll={REQUEST:_r};function Ed(h){return Object.keys(h).reduce((t,n)=>{var s;return(s=h[n])===null||s===void 0||s.forEach(o=>t[o]=n),t},{})}function kd(h,t){const n={};if(!h)return n;const s=Object.keys(h),o=t?Ed(t):{};return s.reduce((l,u)=>{var d;const _=Sd[u]||o[u]||Ll.REQUEST,g=(d=l[_])!==null&&d!==void 0?d:l[_]={};return g[u]=h[u],l},n)}function jr(h){return["ot","sf","st","e","sta"].includes(h)}function Ra(h){return typeof h=="number"?ce(h):h!=null&&h!==""&&h!==!1}const Dl="event";function Ou(h,t){const n=new URL(h),s=new URL(t);if(n.origin!==s.origin)return h;const o=n.pathname.split("/").slice(1),l=s.pathname.split("/").slice(1,-1);for(;o[0]===l[0];)o.shift(),l.shift();for(;l.length;)l.shift(),o.unshift("..");return o.join("/")+n.search+n.hash}const Fu=h=>Math.round(h),Zc=(h,t)=>Array.isArray(h)?h.map(n=>Zc(n,t)):h instanceof Is&&typeof h.value=="string"?new Is(Zc(h.value,t),h.params):(t.baseUrl&&(h=Ou(h,t.baseUrl)),t.version===1?encodeURIComponent(h):h),Yo=h=>Fu(h/100)*100,Bu={br:Fu,d:Fu,bl:Yo,dl:Yo,mtp:Yo,nor:(h,t)=>{let n=h;return t.version>=2&&(h instanceof Is&&typeof h.value=="string"?n=new Is([h]):typeof h=="string"&&(n=[h])),Zc(n,t)},rtp:Yo,tb:Fu},Qr="request",Pa="response",Nu=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],hf=["e"],Yc=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function $u(h){return Yc.test(h)}function Ad(h){return Nu.includes(h)||hf.includes(h)||$u(h)}const ff=["d","dl","nor","ot","rtp","su"];function Ld(h){return Nu.includes(h)||ff.includes(h)||$u(h)}const df=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function Gn(h){return Nu.includes(h)||ff.includes(h)||df.includes(h)||$u(h)}const Dd=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function Cd(h){return Dd.includes(h)||$u(h)}const co={[Pa]:Gn,[Dl]:Ad,[Qr]:Ld};function pf(h,t={}){const n={};if(h==null||typeof h!="object")return n;const s=t.version||h.v||1,o=t.reportingMode||Qr,l=s===1?Cd:co[o];let u=Object.keys(h).filter(l);const d=t.filter;typeof d=="function"&&(u=u.filter(d));const _=o===Pa||o===Dl;_&&!u.includes("ts")&&u.push("ts"),s>1&&!u.includes("v")&&u.push("v");const g=k({},Bu,t.formatters),v={version:s,reportingMode:o,baseUrl:t.baseUrl};return u.sort().forEach(y=>{let x=h[y];const D=g[y];if(typeof D=="function"&&(x=D(x,v)),y==="v"){if(s===1)return;x=s}y=="pr"&&x===1||(_&&y==="ts"&&!ce(x)&&(x=Date.now()),Ra(x)&&(jr(y)&&typeof x=="string"&&(x=new of(x)),n[y]=x))}),n}function Cl(h,t={}){const n={};if(!h)return n;const s=pf(h,t),o=kd(s,t==null?void 0:t.customHeaderMap);return Object.entries(o).reduce((l,[u,d])=>{const _=Al(d,{whitespace:!1});return _&&(l[u]=_),l},n)}function Md(h,t,n){return k(h,Cl(t,n))}const mf="CMCD";function gf(h,t={}){return h?Al(pf(h,t),{whitespace:!1}):""}function Ml(h,t={}){if(!h)return"";const n=gf(h,t);return encodeURIComponent(n)}function Id(h,t={}){if(!h)return"";const n=Ml(h,t);return`${mf}=${n}`}const Xc=/CMCD=[^&#]+/;function Jc(h,t,n){const s=Id(t,n);if(!s)return h;if(Xc.test(h))return h.replace(Xc,s);const o=h.includes("?")?"&":"?";return`${h}${o}${s}`}class _f{constructor(t){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=o=>{try{this.apply(o,{ot:Fr.MANIFEST,su:!this.initialized})}catch(l){this.hls.logger.warn("Could not generate manifest CMCD data.",l)}},this.applyFragmentData=o=>{try{const{frag:l,part:u}=o,d=this.hls.levels[l.level],_=this.getObjectType(l),g={d:(u||l).duration*1e3,ot:_};(_===Fr.VIDEO||_===Fr.AUDIO||_==Fr.MUXED)&&(g.br=d.bitrate/1e3,g.tb=this.getTopBandwidth(_)/1e3,g.bl=this.getBufferLength(_));const v=u?this.getNextPart(u):this.getNextFrag(l);v!=null&&v.url&&v.url!==l.url&&(g.nor=v.url),this.apply(o,g)}catch(l){this.hls.logger.warn("Could not generate segment CMCD data.",l)}},this.hls=t;const n=this.config=t.config,{cmcd:s}=n;s!=null&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||t.sessionId,this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const t=this.hls;t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHED,this.onMediaDetached,this),t.on(S.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const t=this.hls;t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHED,this.onMediaDetached,this),t.off(S.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(t,n){this.media=n.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(t,n){var s,o;this.audioBuffer=(s=n.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(o=n.tracks.video)==null?void 0:o.buffer}createData(){var t;return{v:1,sf:Mt.HLS,sid:this.sid,cid:this.cid,pr:(t=this.media)==null?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(t,n={}){k(n,this.createData());const s=n.ot===Fr.INIT||n.ot===Fr.VIDEO||n.ot===Fr.MUXED;this.starved&&s&&(n.bs=!0,n.su=!0,this.starved=!1),n.su==null&&(n.su=this.buffering);const{includeKeys:o}=this;o&&(n=Object.keys(n).reduce((u,d)=>(o.includes(d)&&(u[d]=n[d]),u),{}));const l={baseUrl:t.url};this.useHeaders?(t.headers||(t.headers={}),Md(t.headers,n,l)):t.url=Jc(t.url,n,l)}getNextFrag(t){var n;const s=(n=this.hls.levels[t.level])==null?void 0:n.details;if(s){const o=t.sn-s.startSN;return s.fragments[o+1]}}getNextPart(t){var n;const{index:s,fragment:o}=t,l=(n=this.hls.levels[o.level])==null||(n=n.details)==null?void 0:n.partList;if(l){const{sn:u}=o;for(let d=l.length-1;d>=0;d--){const _=l[d];if(_.index===s&&_.fragment.sn===u)return l[d+1]}}}getObjectType(t){const{type:n}=t;if(n==="subtitle")return Fr.TIMED_TEXT;if(t.sn==="initSegment")return Fr.INIT;if(n==="audio")return Fr.AUDIO;if(n==="main")return this.hls.audioTracks.length?Fr.VIDEO:Fr.MUXED}getTopBandwidth(t){let n=0,s;const o=this.hls;if(t===Fr.AUDIO)s=o.audioTracks;else{const l=o.maxAutoLevel,u=l>-1?l+1:o.levels.length;s=o.levels.slice(0,u)}return s.forEach(l=>{l.bitrate>n&&(n=l.bitrate)}),n>0?n:NaN}getBufferLength(t){const n=this.media,s=t===Fr.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!n?NaN:li.bufferInfo(s,n.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:t}=this.config,n=this.applyPlaylistData,s=t||this.config.loader;return class{constructor(l){this.loader=void 0,this.loader=new s(l)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(l,u,d){n(l),this.loader.load(l,u,d)}}}createFragmentLoader(){const{fLoader:t}=this.config,n=this.applyFragmentData,s=t||this.config.loader;return class{constructor(l){this.loader=void 0,this.loader=new s(l)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(l,u,d){n(l),this.loader.load(l,u,d)}}}}const Rd=3e5;class Pd extends H{constructor(t){super("content-steering",t.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=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const t=this.hls;t&&(t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((t,n)=>(t.indexOf(n.pathwayId)===-1&&t.push(n.pathwayId),t),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(t){this.updatePathwayPriority(t)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const t=this.timeToLoad*1e3-(performance.now()-this.updated);if(t>0){this.scheduleRefresh(this.uri,t);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(t){const n=this.levels;n&&(this.levels=n.filter(s=>s!==t))}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(t,n){const{contentSteering:s}=n;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(t,n){this.audioTracks=n.audioTracks,this.subtitleTracks=n.subtitleTracks}onError(t,n){const{errorAction:s}=n;if((s==null?void 0:s.action)===Ui.SendAlternateToPenaltyBox&&s.flags===Qi.MoveAllAlternatesMatchingHost){const o=this.levels;let l=this._pathwayPriority,u=this.pathwayId;if(n.context){const{groupId:d,pathwayId:_,type:g}=n.context;d&&o?u=this.getPathwayForGroupId(d,g,u):_&&(u=_)}u in this.penalizedPathways||(this.penalizedPathways[u]=performance.now()),!l&&o&&(l=this.pathways()),l&&l.length>1&&(this.updatePathwayPriority(l),s.resolved=this.pathwayId!==u),n.details===q.BUFFER_APPEND_ERROR&&!n.fatal?s.resolved=!0:s.resolved||this.warn(`Could not resolve ${n.details} ("${n.error.message}") with content-steering for Pathway: ${u} levels: ${o&&o.length} priorities: ${$e(l)} penalized: ${$e(this.penalizedPathways)}`)}}filterParsedLevels(t){this.levels=t;let n=this.getLevelsForPathway(this.pathwayId);if(n.length===0){const s=t[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),n=this.getLevelsForPathway(s),this.pathwayId=s}return n.length!==t.length&&this.log(`Found ${n.length}/${t.length} levels in Pathway "${this.pathwayId}"`),n}getLevelsForPathway(t){return this.levels===null?[]:this.levels.filter(n=>t===n.pathwayId)}updatePathwayPriority(t){this._pathwayPriority=t;let n;const s=this.penalizedPathways,o=performance.now();Object.keys(s).forEach(l=>{o-s[l]>Rd&&delete s[l]});for(let l=0;l<t.length;l++){const u=t[l];if(u in s)continue;if(u===this.pathwayId)return;const d=this.hls.nextLoadLevel,_=this.hls.levels[d];if(n=this.getLevelsForPathway(u),n.length>0){this.log(`Setting Pathway to "${u}"`),this.pathwayId=u,Gr(n),this.hls.trigger(S.LEVELS_UPDATED,{levels:n});const g=this.hls.levels[d];_&&g&&this.levels&&(g.attrs["STABLE-VARIANT-ID"]!==_.attrs["STABLE-VARIANT-ID"]&&g.bitrate!==_.bitrate&&this.log(`Unstable Pathways change from bitrate ${_.bitrate} to ${g.bitrate}`),this.hls.nextLoadLevel=d);break}}}getPathwayForGroupId(t,n,s){const o=this.getLevelsForPathway(s).concat(this.levels||[]);for(let l=0;l<o.length;l++)if(n===Te.AUDIO_TRACK&&o[l].hasAudioGroup(t)||n===Te.SUBTITLE_TRACK&&o[l].hasSubtitleGroup(t))return o[l].pathwayId;return s}clonePathways(t){const n=this.levels;if(!n)return;const s={},o={};t.forEach(l=>{const{ID:u,"BASE-ID":d,"URI-REPLACEMENT":_}=l;if(n.some(v=>v.pathwayId===u))return;const g=this.getLevelsForPathway(d).map(v=>{const y=new pn(v.attrs);y["PATHWAY-ID"]=u;const x=y.AUDIO&&`${y.AUDIO}_clone_${u}`,D=y.SUBTITLES&&`${y.SUBTITLES}_clone_${u}`;x&&(s[y.AUDIO]=x,y.AUDIO=x),D&&(o[y.SUBTITLES]=D,y.SUBTITLES=D);const C=yf(v.uri,y["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",_),F=new Xn({attrs:y,audioCodec:v.audioCodec,bitrate:v.bitrate,height:v.height,name:v.name,url:C,videoCodec:v.videoCodec,width:v.width});if(v.audioGroups)for(let B=1;B<v.audioGroups.length;B++)F.addGroupId("audio",`${v.audioGroups[B]}_clone_${u}`);if(v.subtitleGroups)for(let B=1;B<v.subtitleGroups.length;B++)F.addGroupId("text",`${v.subtitleGroups[B]}_clone_${u}`);return F});n.push(...g),vf(this.audioTracks,s,_,u),vf(this.subtitleTracks,o,_,u)})}loadSteeringManifest(t){const n=this.hls.config,s=n.loader;this.loader&&this.loader.destroy(),this.loader=new s(n);let o;try{o=new self.URL(t)}catch(v){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${t}`);return}if(o.protocol!=="data:"){const v=(this.hls.bandwidthEstimate||n.abrEwmaDefaultEstimate)|0;o.searchParams.set("_HLS_pathway",this.pathwayId),o.searchParams.set("_HLS_throughput",""+v)}const l={responseType:"json",url:o.href},u=n.steeringManifestLoadPolicy.default,d=u.errorRetry||u.timeoutRetry||{},_={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:d.maxNumRetry||0,retryDelay:d.retryDelayMs||0,maxRetryDelay:d.maxRetryDelayMs||0},g={onSuccess:(v,y,x,D)=>{this.log(`Loaded steering manifest: "${o}"`);const C=v.data;if((C==null?void 0:C.VERSION)!==1){this.log(`Steering VERSION ${C.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=C.TTL;const{"RELOAD-URI":F,"PATHWAY-CLONES":B,"PATHWAY-PRIORITY":J}=C;if(F)try{this.uri=new self.URL(F,o).href}catch(le){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${F}`);return}this.scheduleRefresh(this.uri||x.url),B&&this.clonePathways(B);const ne={steeringManifest:C,url:o.toString()};this.hls.trigger(S.STEERING_MANIFEST_LOADED,ne),J&&this.updatePathwayPriority(J)},onError:(v,y,x,D)=>{if(this.log(`Error loading steering manifest: ${v.code} ${v.text} (${y.url})`),this.stopLoad(),v.code===410){this.enabled=!1,this.log(`Steering manifest ${y.url} no longer available`);return}let C=this.timeToLoad*1e3;if(v.code===429){const F=this.loader;if(typeof(F==null?void 0:F.getResponseHeader)=="function"){const B=F.getResponseHeader("Retry-After");B&&(C=parseFloat(B)*1e3)}this.log(`Steering manifest ${y.url} rate limited`);return}this.scheduleRefresh(this.uri||y.url,C)},onTimeout:(v,y,x)=>{this.log(`Timeout loading steering manifest (${y.url})`),this.scheduleRefresh(this.uri||y.url)}};this.log(`Requesting steering manifest: ${o}`),this.loader.load(l,_,g)}scheduleRefresh(t,n=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const o=(s=this.hls)==null?void 0:s.media;if(o&&!o.ended){this.loadSteeringManifest(t);return}this.scheduleRefresh(t,this.timeToLoad*1e3)},n)}}function vf(h,t,n,s){h&&Object.keys(t).forEach(o=>{const l=h.filter(u=>u.groupId===o).map(u=>{const d=k({},u);return d.details=void 0,d.attrs=new pn(d.attrs),d.url=d.attrs.URI=yf(u.url,u.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),d.groupId=d.attrs["GROUP-ID"]=t[o],d.attrs["PATHWAY-ID"]=s,d});h.push(...l)})}function yf(h,t,n,s){const{HOST:o,PARAMS:l,[n]:u}=s;let d;t&&(d=u==null?void 0:u[t],d&&(h=d));const _=new self.URL(h);return o&&!d&&(_.host=o),l&&Object.keys(l).sort().forEach(g=>{g&&_.searchParams.set(g,l[g])}),_.href}class Xo extends H{constructor(t){super("eme",t.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=Xo.CDMCleanupPromise?[Xo.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=n=>{const{initDataType:s,initData:o}=n,l=`"${n.type}" event: init data type: "${s}"`;if(this.debug(l),o!==null){if(!this.keyFormatPromise){let u=Object.keys(this.keySystemAccessPromises);u.length||(u=Xr(this.config));const d=u.map(qn).filter(_=>!!_);this.keyFormatPromise=this.getKeyFormatPromise(d)}this.keyFormatPromise.then(u=>{const d=zr(u);if(s!=="sinf"||d!==Hi.FAIRPLAY){this.log(`Ignoring "${n.type}" event with init data type: "${s}" for selected key-system ${d}`);return}let _;try{const D=di(new Uint8Array(o)),C=Gs(JSON.parse(D).sinf),F=ke(C);if(!F)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");_=new Uint8Array(F.subarray(8,24))}catch(D){this.warn(`${l} Failed to parse sinf: ${D}`);return}const g=te(_),{keyIdToKeySessionPromise:v,mediaKeySessions:y}=this;let x=v[g];for(let D=0;D<y.length;D++){const C=y[D],F=C.decryptdata;if(!F.keyId)continue;const B=te(F.keyId);if(nr(_,F.keyId)||F.uri.replace(/-/g,"").indexOf(g)!==-1){if(x=v[B],!x)continue;if(F.pssh)break;delete v[B],F.pssh=new Uint8Array(o),F.keyId=_,x=v[g]=x.then(()=>this.generateRequestWithPreferredKeySession(C,s,o,"encrypted-event-key-match")),x.catch(J=>this.handleError(J));break}}x||this.handleError(new Error(`Key ID ${g} not encountered in playlist. Key-system sessions ${y.length}.`))}).catch(u=>this.handleError(u))}},this.onWaitingForKey=n=>{this.log(`"${n.type}" event`)},this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(S.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(S.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(t){const{drmSystems:n,widevineLicenseUrl:s}=this.config,o=n==null?void 0:n[t];if(o)return o.licenseUrl;if(t===Hi.WIDEVINE&&s)return s}getLicenseServerUrlOrThrow(t){const n=this.getLicenseServerUrl(t);if(n===void 0)throw new Error(`no license server URL configured for key-system "${t}"`);return n}getServerCertificateUrl(t){const{drmSystems:n}=this.config,s=n==null?void 0:n[t];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){const n=this.hls.levels,s=(u,d,_)=>!!u&&_.indexOf(u)===d,o=n.map(u=>u.audioCodec).filter(s),l=n.map(u=>u.videoCodec).filter(s);return o.length+l.length===0&&l.push("avc1.42e01e"),new Promise((u,d)=>{const _=g=>{const v=g.shift();this.getMediaKeysPromise(v,o,l).then(y=>u({keySystem:v,mediaKeys:y})).catch(y=>{g.length?_(g):y instanceof Ss?d(y):d(new Ss({type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_NO_ACCESS,error:y,fatal:!0},y.message))})};_(t)})}requestMediaKeySystemAccess(t,n){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let o=`Configured requestMediaKeySystemAccess is not a function ${s}`;return rs===null&&self.location.protocol==="http:"&&(o=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(o))}return s(t,n)}getMediaKeysPromise(t,n,s){var o;const l=Ea(t,n,s,this.config.drmSystemOptions||{});let u=this.keySystemAccessPromises[t],d=(o=u)==null?void 0:o.keySystemAccess;if(!d){this.log(`Requesting encrypted media "${t}" key-system access with config: ${$e(l)}`),d=this.requestMediaKeySystemAccess(t,l);const _=u=this.keySystemAccessPromises[t]={keySystemAccess:d};return d.catch(g=>{this.log(`Failed to obtain access to key-system "${t}": ${g}`)}),d.then(g=>{this.log(`Access for key-system "${g.keySystem}" obtained`);const v=this.fetchServerCertificate(t);this.log(`Create media-keys for "${t}"`);const y=_.mediaKeys=g.createMediaKeys().then(x=>(this.log(`Media-keys created for "${t}"`),_.hasMediaKeys=!0,v.then(D=>D?this.setMediaKeysServerCertificate(x,t,D):x)));return y.catch(x=>{this.error(`Failed to create media-keys for "${t}"}: ${x}`)}),y})}return d.then(()=>u.mediaKeys)}createMediaKeySessionContext({decryptdata:t,keySystem:n,mediaKeys:s}){this.log(`Creating key-system session "${n}" keyId: ${te(t.keyId||[])} keyUri: ${t.uri}`);const o=s.createSession(),l={decryptdata:t,keySystem:n,mediaKeys:s,mediaKeysSession:o,keyStatus:"status-pending"};return this.mediaKeySessions.push(l),l}renewKeySession(t){const n=t.decryptdata;if(n.pssh){const s=this.createMediaKeySessionContext(t),o=Ku(n),l="cenc";this.keyIdToKeySessionPromise[o]=this.generateRequestWithPreferredKeySession(s,l,n.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(t)}updateKeySession(t,n){const s=t.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyId ${te(t.decryptdata.keyId||[])}
|
|
|
} (data length: ${n.byteLength})`),s.update(n)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(t=>({keySystem:t,hasMediaKeys:this.keySystemAccessPromises[t].hasMediaKeys})).filter(({hasMediaKeys:t})=>!!t).map(({keySystem:t})=>qn(t)).filter(t=>!!t)}getKeySystemAccess(t){return this.getKeySystemSelectionPromise(t).then(({keySystem:n,mediaKeys:s})=>this.attemptSetMediaKeys(n,s))}selectKeySystem(t){return new Promise((n,s)=>{this.getKeySystemSelectionPromise(t).then(({keySystem:o})=>{const l=qn(o);l?n(l):s(new Error(`Unable to find format for key-system "${o}"`))}).catch(s)})}selectKeySystemFormat(t){const n=Object.keys(t.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${t.sn} ${t.type}: ${t.level}) key formats ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)),this.keyFormatPromise}getKeyFormatPromise(t){const n=Xr(this.config),s=t.map(zr).filter(o=>!!o&&n.indexOf(o)!==-1);return this.selectKeySystem(s)}getKeyStatus(t){const{mediaKeySessions:n}=this;for(let s=0;s<n.length;s++){const o=Od(t,n[s]);if(o)return o}}loadKey(t){const n=t.keyInfo.decryptdata,s=Ku(n),o=this.bannedKeyIds[s];if(o||this.getKeyStatus(n)==="internal-error"){const d=ma(o||"internal-error",n);return this.handleError(d,t.frag),Promise.reject(d)}const l=`(keyId: ${s} format: "${n.keyFormat}" method: ${n.method} uri: ${n.uri})`;this.log(`Starting session for key ${l}`);const u=this.keyIdToKeySessionPromise[s];if(!u){const d=this.getKeySystemForKeyPromise(n).then(({keySystem:_,mediaKeys:g})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${l}`),this.attemptSetMediaKeys(_,g).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:_,mediaKeys:g,decryptdata:n}))))).then(_=>{const g="cenc",v=n.pssh?n.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(_,g,v,"playlist-key")});return d.catch(_=>this.handleError(_,t.frag)),this.keyIdToKeySessionPromise[s]=d,d}return u.catch(d=>{if(d instanceof Ss){const _=M({},d.data);this.getKeyStatus(n)==="internal-error"&&(_.decryptdata=n);const g=new Ss(_,d.message);this.handleError(g,t.frag)}}),u}throwIfDestroyed(t="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(t,n){if(this.hls)if(t instanceof Ss){n&&(t.data.frag=n);const s=t.data.decryptdata;this.error(`${t.message}${s?` (${te(s.keyId||[])})`:""}`),this.hls.trigger(S.ERROR,t.data)}else this.error(t.message),this.hls.trigger(S.ERROR,{type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0})}getKeySystemForKeyPromise(t){const n=Ku(t),s=this.keyIdToKeySessionPromise[n];if(!s){const o=zr(t.keyFormat),l=o?[o]:Xr(this.config);return this.attemptKeySystemAccess(l)}return s}getKeySystemSelectionPromise(t){if(t.length||(t=Xr(this.config)),t.length===0)throw new Ss({type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${$e({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(t)}attemptSetMediaKeys(t,n){if(this.mediaKeys===n)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${t}"`);const o=Promise.all(s).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(n)});return this.mediaKeys=n,this.setMediaKeysQueue.push(o),o.then(()=>{this.log(`Media-keys set for "${t}"`),s.push(o),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(l=>s.indexOf(l)===-1)})}generateRequestWithPreferredKeySession(t,n,s,o){var l;const u=(l=this.config.drmSystems)==null||(l=l[t.keySystem])==null?void 0:l.generateRequest;if(u)try{const C=u.call(this.hls,n,s,t);if(!C)throw new Error("Invalid response from configured generateRequest filter");n=C.initDataType,s=C.initData?C.initData:null,t.decryptdata.pssh=s?new Uint8Array(s):null}catch(C){if(this.warn(C.message),this.hls&&this.hls.config.debug)throw C}if(s===null)return this.log(`Skipping key-session request for "${o}" (no initData)`),Promise.resolve(t);const d=Ku(t.decryptdata),_=t.decryptdata.uri;this.log(`Generating key-session request for "${o}" keyId: ${d} URI: ${_} (init data type: ${n} length: ${s.byteLength})`);const g=new uu,v=t._onmessage=C=>{const F=t.mediaKeysSession;if(!F){g.emit("error",new Error("invalid state"));return}const{messageType:B,message:J}=C;this.log(`"${B}" message event for session "${F.sessionId}" message size: ${J.byteLength}`),B==="license-request"||B==="license-renewal"?this.renewLicense(t,J).catch(ne=>{g.eventNames().length?g.emit("error",ne):this.handleError(ne)}):B==="license-release"?t.keySystem===Hi.FAIRPLAY&&this.updateKeySession(t,As("acknowledged")).then(()=>this.removeSession(t)).catch(ne=>this.handleError(ne)):this.warn(`unhandled media key message type "${B}"`)},y=(C,F)=>{F.keyStatus=C;let B;C.startsWith("usable")?g.emit("resolved"):C==="internal-error"||C==="output-restricted"||C==="output-downscaled"?B=ma(C,F.decryptdata):C==="expired"?B=new Error(`key expired (keyId: ${d})`):C==="released"?B=new Error("key released"):C==="status-pending"||this.warn(`unhandled key status change "${C}" (keyId: ${d})`),B&&(g.eventNames().length?g.emit("error",B):this.handleError(B))},x=t._onkeystatuseschange=C=>{if(!t.mediaKeysSession){g.emit("error",new Error("invalid state"));return}const B=this.getKeyStatuses(t);if(!Object.keys(B).some(Ee=>B[Ee]!=="status-pending"))return;if(B[d]==="expired"){this.log(`Expired key ${$e(B)} in key-session "${t.mediaKeysSession.sessionId}"`),this.renewKeySession(t);return}let ne=B[d];if(ne)y(ne,t);else{var le;t.keyStatusTimeouts||(t.keyStatusTimeouts={}),(le=t.keyStatusTimeouts)[d]||(le[d]=self.setTimeout(()=>{if(!t.mediaKeysSession||!this.mediaKeys)return;const Ie=this.getKeyStatus(t.decryptdata);if(Ie&&Ie!=="status-pending")return this.log(`No status for keyId ${d} in key-session "${t.mediaKeysSession.sessionId}". Using session key-status ${Ie} from other session.`),y(Ie,t);this.log(`key status for ${d} in key-session "${t.mediaKeysSession.sessionId}" timed out after 1000ms`),ne="internal-error",y(ne,t)},1e3)),this.log(`No status for keyId ${d} (${$e(B)}).`)}};Jr(t.mediaKeysSession,"message",v),Jr(t.mediaKeysSession,"keystatuseschange",x);const D=new Promise((C,F)=>{g.on("error",F),g.on("resolved",C)});return t.mediaKeysSession.generateRequest(n,s).then(()=>{this.log(`Request generated for key-session "${t.mediaKeysSession.sessionId}" keyId: ${d} URI: ${_}`)}).catch(C=>{throw new Ss({type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_NO_SESSION,error:C,decryptdata:t.decryptdata,fatal:!1},`Error generating key-session request: ${C}`)}).then(()=>D).catch(C=>(g.removeAllListeners(),this.removeSession(t).then(()=>{throw C}))).then(()=>(g.removeAllListeners(),t))}getKeyStatuses(t){const n={};return t.mediaKeysSession.keyStatuses.forEach((s,o)=>{if(typeof o=="string"&&typeof s=="object"){const d=o;o=s,s=d}const l="buffer"in o?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):new Uint8Array(o);t.keySystem===Hi.PLAYREADY&&l.length===16&&ni(l);const u=te(l);s==="internal-error"&&(this.bannedKeyIds[u]=s),this.log(`key status change "${s}" for keyStatuses keyId: ${u} key-session "${t.mediaKeysSession.sessionId}"`),n[u]=s}),n}fetchServerCertificate(t){const n=this.config,s=n.loader,o=new s(n),l=this.getServerCertificateUrl(t);return l?(this.log(`Fetching server certificate for "${t}"`),new Promise((u,d)=>{const _={responseType:"arraybuffer",url:l},g=n.certLoadPolicy.default,v={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:(x,D,C,F)=>{u(x.data)},onError:(x,D,C,F)=>{d(new Ss({type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:C,response:M({url:_.url,data:void 0},x)},`"${t}" certificate request failed (${l}). Status: ${x.code} (${x.text})`))},onTimeout:(x,D,C)=>{d(new Ss({type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:C,response:{url:_.url,data:void 0}},`"${t}" certificate request timed out (${l})`))},onAbort:(x,D,C)=>{d(new Error("aborted"))}};o.load(_,v,y)})):Promise.resolve()}setMediaKeysServerCertificate(t,n,s){return new Promise((o,l)=>{t.setServerCertificate(s).then(u=>{this.log(`setServerCertificate ${u?"success":"not supported by CDM"} (${s.byteLength}) on "${n}"`),o(t)}).catch(u=>{l(new Ss({type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:u,fatal:!0},u.message))})})}renewLicense(t,n){return this.requestLicense(t,new Uint8Array(n)).then(s=>this.updateKeySession(t,new Uint8Array(s)).catch(o=>{throw new Ss({type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:t.decryptdata,error:o,fatal:!1},o.message)}))}unpackPlayReadyKeyMessage(t,n){const s=String.fromCharCode.apply(null,new Uint16Array(n.buffer));if(!s.includes("PlayReadyKeyMessage"))return t.setRequestHeader("Content-Type","text/xml; charset=utf-8"),n;const o=new DOMParser().parseFromString(s,"application/xml"),l=o.querySelectorAll("HttpHeader");if(l.length>0){let v;for(let y=0,x=l.length;y<x;y++){var u,d;v=l[y];const D=(u=v.querySelector("name"))==null?void 0:u.textContent,C=(d=v.querySelector("value"))==null?void 0:d.textContent;D&&C&&t.setRequestHeader(D,C)}}const _=o.querySelector("Challenge"),g=_==null?void 0:_.textContent;if(!g)throw new Error("Cannot find <Challenge> in key message");return As(atob(g))}setupLicenseXHR(t,n,s,o){const l=this.config.licenseXhrSetup;return l?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return l.call(this.hls,t,n,s,o)}).catch(u=>{if(!s.decryptdata)throw u;return t.open("POST",n,!0),l.call(this.hls,t,n,s,o)}).then(u=>(t.readyState||t.open("POST",n,!0),{xhr:t,licenseChallenge:u||o})):(t.open("POST",n,!0),Promise.resolve({xhr:t,licenseChallenge:o}))}requestLicense(t,n){const s=this.config.keyLoadPolicy.default;return new Promise((o,l)=>{const u=this.getLicenseServerUrlOrThrow(t.keySystem);this.log(`Sending license request to URL: ${u}`);const d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return l(new Error("invalid state"));if(d.readyState===4)if(d.status===200){this._requestLicenseFailureCount=0;let _=d.response;this.log(`License received ${_ instanceof ArrayBuffer?_.byteLength:_}`);const g=this.config.licenseResponseCallback;if(g)try{_=g.call(this.hls,d,u,t)}catch(v){this.error(v)}o(_)}else{const _=s.errorRetry,g=_?_.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>g||d.status>=400&&d.status<500)l(new Ss({type:ge.KEY_SYSTEM_ERROR,details:q.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:t.decryptdata,fatal:!0,networkDetails:d,response:{url:u,data:void 0,code:d.status,text:d.statusText}},`License Request XHR failed (${u}). Status: ${d.status} (${d.statusText})`));else{const v=g-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${v} attempts left`),this.requestLicense(t,n).then(o,l)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=d,this.setupLicenseXHR(d,u,t,n).then(({xhr:_,licenseChallenge:g})=>{t.keySystem==Hi.PLAYREADY&&(g=this.unpackPlayReadyKeyMessage(_,g)),_.send(g)}).catch(l)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(t,n){if(!this.config.emeEnabled)return;const s=n.media;this.media=s,Jr(s,"encrypted",this.onMediaEncrypted),Jr(s,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const t=this.media;t&&(Or(t,"encrypted",this.onMediaEncrypted),Or(t,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var t;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const n=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Mn.clearKeyUriToKeyIdMap();const o=s.length;Xo.CDMCleanupPromise=Promise.all(s.map(l=>this.removeSession(l)).concat((n==null||(t=n.setMediaKeys(null))==null?void 0:t.catch(l=>{this.log(`Could not clear media keys: ${l}`),this.hls&&this.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:q.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${l}`)})}))||Promise.resolve())).catch(l=>{this.log(`Could not close sessions and clear media keys: ${l}`),this.hls&&this.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:q.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${l}`)})}).then(()=>{o&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null,this.bannedKeyIds={}}onManifestLoaded(t,{sessionKeys:n}){if(!(!n||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=n.reduce((o,l)=>(o.indexOf(l.keyFormat)===-1&&o.push(l.keyFormat),o),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(t){const{mediaKeysSession:n,licenseXhr:s,decryptdata:o}=t;if(n){this.log(`Remove licenses and keys and close session "${n.sessionId}" keyId: ${te((o==null?void 0:o.keyId)||[])}`),t._onmessage&&(n.removeEventListener("message",t._onmessage),t._onmessage=void 0),t._onkeystatuseschange&&(n.removeEventListener("keystatuseschange",t._onkeystatuseschange),t._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;const l=this.mediaKeySessions.indexOf(t);l>-1&&this.mediaKeySessions.splice(l,1);const{keyStatusTimeouts:u}=t;u&&Object.keys(u).forEach(g=>self.clearTimeout(u[g]));const{drmSystemOptions:d}=this.config;return(Za(d)?new Promise((g,v)=>{self.setTimeout(()=>v(new Error("MediaKeySession.remove() timeout")),8e3),n.remove().then(g).catch(v)}):Promise.resolve()).catch(g=>{this.log(`Could not remove session: ${g}`),this.hls&&this.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:q.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${g}`)})}).then(()=>n.close()).catch(g=>{this.log(`Could not close session: ${g}`),this.hls&&this.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:q.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${g}`)})})}return Promise.resolve()}}Xo.CDMCleanupPromise=void 0;function Ku(h){if(!h)throw new Error("Could not read keyId of undefined decryptdata");if(h.keyId===null)throw new Error("keyId is null");return te(h.keyId)}function Od(h,t){if(h.keyId&&t.mediaKeysSession.keyStatuses.has(h.keyId))return t.mediaKeysSession.keyStatuses.get(h.keyId);if(h.matches(t.decryptdata))return t.keyStatus}class Ss extends Error{constructor(t,n){super(n),this.data=void 0,t.error||(t.error=new Error(n)),this.data=t,t.err=t.error}}function ma(h,t){const n=h==="output-restricted",s=n?q.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:q.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Ss({type:ge.KEY_SYSTEM_ERROR,details:s,fatal:!1,decryptdata:t},n?"HDCP level output restricted":`key status changed to "${h}"`)}class ho{constructor(t){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=t,this.registerListeners()}setStreamController(t){this.streamController=t}registerListeners(){this.hls.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(t,n){const s=this.hls.config;if(s.capLevelOnFPSDrop){const o=n.media instanceof self.HTMLVideoElement?n.media:null;this.media=o,o&&typeof o.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(t,n,s){const o=performance.now();if(n){if(this.lastTime){const l=o-this.lastTime,u=s-this.lastDroppedFrames,d=n-this.lastDecodedFrames,_=1e3*u/l,g=this.hls;if(g.trigger(S.FPS_DROP,{currentDropped:u,currentDecoded:d,totalDroppedFrames:s}),_>0&&u>g.config.fpsDroppedMonitoringThreshold*d){let v=g.currentLevel;g.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+v),v>0&&(g.autoLevelCapping===-1||g.autoLevelCapping>=v)&&(v=v-1,g.trigger(S.FPS_DROP_LEVEL_CAPPING,{level:v,droppedLevel:g.currentLevel}),g.autoLevelCapping=v,this.streamController.nextLevelSwitch())}}this.lastTime=o,this.lastDroppedFrames=s,this.lastDecodedFrames=n}}checkFPSInterval(){const t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){const n=t.getVideoPlaybackQuality();this.checkFPS(t,n.totalVideoFrames,n.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)}}function fo(h,t){let n;try{n=new Event("addtrack")}catch(s){n=document.createEvent("Event"),n.initEvent("addtrack",!1,!1)}n.track=h,t.dispatchEvent(n)}function Js(h,t){const n=h.mode;if(n==="disabled"&&(h.mode="hidden"),h.cues&&!h.cues.getCueById(t.id))try{if(h.addCue(t),!h.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(s){se.debug(`[texttrack-utils]: ${s}`);try{const o=new self.TextTrackCue(t.startTime,t.endTime,t.text);o.id=t.id,h.addCue(o)}catch(o){se.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${o}`)}}n==="disabled"&&(h.mode=n)}function ds(h,t){const n=h.mode;if(n==="disabled"&&(h.mode="hidden"),h.cues)for(let s=h.cues.length;s--;)t&&h.cues[s].removeEventListener("enter",t),h.removeCue(h.cues[s]);n==="disabled"&&(h.mode=n)}function Qs(h,t,n,s){const o=h.mode;if(o==="disabled"&&(h.mode="hidden"),h.cues&&h.cues.length>0){const l=zu(h.cues,t,n);for(let u=0;u<l.length;u++)(!s||s(l[u]))&&h.removeCue(l[u])}o==="disabled"&&(h.mode=o)}function Uu(h,t){if(t<=h[0].startTime)return 0;const n=h.length-1;if(t>h[n].endTime)return-1;let s=0,o=n,l;for(;s<=o;)if(l=Math.floor((o+s)/2),t<h[l].startTime)o=l-1;else if(t>h[l].startTime&&s<n)s=l+1;else return l;return h[s].startTime-t<t-h[o].startTime?s:o}function zu(h,t,n){const s=[],o=Uu(h,t);if(o>-1)for(let l=o,u=h.length;l<u;l++){const d=h[l];if(d.startTime>=t&&d.endTime<=n)s.push(d);else if(d.startTime>n)return s}return s}function po(h){const t=[];for(let n=0;n<h.length;n++){const s=h[n];(s.kind==="subtitles"||s.kind==="captions")&&s.label&&t.push(h[n])}return t}class Vu extends Au{constructor(t){super(t,"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 n=null;const s=po(this.media.textTracks);for(let l=0;l<s.length;l++)if(s[l].mode==="hidden")n=s[l];else if(s[l].mode==="showing"){n=s[l];break}const o=this.findTrackForTextTrack(n);this.subtitleTrack!==o&&this.setSubtitleTrack(o)},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(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:t}=this;t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.LEVEL_LOADING,this.onLevelLoading,this),t.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(S.ERROR,this.onError,this)}onMediaAttached(t,n){this.media=n.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(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,t)}onMediaDetaching(t,n){const s=this.media;if(!s)return;const o=!!n.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||s.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,o)return;po(s.textTracks).forEach(u=>{ds(u)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(t,n){this.tracks=n.subtitleTracks}onSubtitleTrackLoaded(t,n){const{id:s,groupId:o,details:l}=n,u=this.tracksInGroup[s];if(!u||u.groupId!==o){this.warn(`Subtitle track with id:${s} and group:${o} not found in active group ${u==null?void 0:u.groupId}`);return}const d=u.details;u.details=n.details,this.log(`Subtitle track ${s} "${u.name}" lang:${u.lang} group:${o} loaded [${l.startSN}-${l.endSN}]`),s===this.trackId&&this.playlistLoaded(s,n,d)}onLevelLoading(t,n){this.switchLevel(n.level)}onLevelSwitching(t,n){this.switchLevel(n.level)}switchLevel(t){const n=this.hls.levels[t];if(!n)return;const s=n.subtitleGroups||null,o=this.groupIds;let l=this.currentTrack;if(!s||(o==null?void 0:o.length)!==(s==null?void 0:s.length)||s!=null&&s.some(u=>(o==null?void 0:o.indexOf(u))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const u=this.tracks.filter(v=>!s||s.indexOf(v.groupId)!==-1);if(u.length)this.selectDefaultTrack&&!u.some(v=>v.default)&&(this.selectDefaultTrack=!1),u.forEach((v,y)=>{v.id=y});else if(!l&&!this.tracksInGroup.length)return;this.tracksInGroup=u;const d=this.hls.config.subtitlePreference;if(!l&&d){this.selectDefaultTrack=!1;const v=Wt(d,u);if(v>-1)l=u[v];else{const y=Wt(d,this.tracks);l=this.tracks[y]}}let _=this.findTrackId(l);_===-1&&l&&(_=this.findTrackId(null));const g={subtitleTracks:u};this.log(`Updating subtitle tracks, ${u.length} track(s) found in "${s==null?void 0:s.join(",")}" group-id`),this.hls.trigger(S.SUBTITLE_TRACKS_UPDATED,g),_!==-1&&this.trackId===-1&&this.setSubtitleTrack(_)}}findTrackId(t){const n=this.tracksInGroup,s=this.selectDefaultTrack;for(let o=0;o<n.length;o++){const l=n[o];if(!(s&&!l.default||!s&&!t)&&(!t||Pi(l,t)))return o}if(t){for(let o=0;o<n.length;o++){const l=n[o];if(El(t.attrs,l.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return o}for(let o=0;o<n.length;o++){const l=n[o];if(El(t.attrs,l.attrs,["LANGUAGE"]))return o}}return-1}findTrackForTextTrack(t){if(t){const n=this.tracksInGroup;for(let s=0;s<n.length;s++){const o=n[s];if(jo(o,t))return s}}return-1}onError(t,n){n.fatal||!n.context||n.context.type===Te.SUBTITLE_TRACK&&n.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(t){this.selectDefaultTrack=!1,this.setSubtitleTrack(t)}setSubtitleOption(t){if(this.hls.config.subtitlePreference=t,t){if(t.id===-1)return this.setSubtitleTrack(-1),null;const n=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,n.length){const s=this.currentTrack;if(s&&Pi(t,s))return s;const o=Wt(t,this.tracksInGroup);if(o>-1){const l=this.tracksInGroup[o];return this.setSubtitleTrack(o),l}else{if(s)return null;{const l=Wt(t,n);if(l>-1)return n[l]}}}}return null}loadPlaylist(t){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,t)}loadingPlaylist(t,n){super.loadingPlaylist(t,n);const s=t.id,o=t.groupId,l=this.getUrlWithDirectives(t.url,n),u=t.details,d=u==null?void 0:u.age;this.log(`Loading subtitle ${s} "${t.name}" lang:${t.lang} group:${o}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${d&&u.live?" age "+d.toFixed(1)+(u.type?" "+u.type||0:""):""} ${l}`),this.hls.trigger(S.SUBTITLE_TRACK_LOADING,{url:l,id:s,groupId:o,deliveryDirectives:n||null,track:t})}toggleTrackModes(){const{media:t}=this;if(!t)return;const n=po(t.textTracks),s=this.currentTrack;let o;if(s&&(o=n.filter(l=>jo(s,l))[0],o||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(n).forEach(l=>{l.mode!=="disabled"&&l!==o&&(l.mode="disabled")}),o){const l=this.subtitleDisplay?"showing":"hidden";o.mode!==l&&(o.mode=l)}}setSubtitleTrack(t){const n=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=t;return}if(t<-1||t>=n.length||!ce(t)){this.warn(`Invalid subtitle track id: ${t}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,o=n[t]||null;if(this.trackId=t,this.currentTrack=o,this.toggleTrackModes(),!o){this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:t});return}const l=!!o.details&&!o.details.live;if(t===this.trackId&&o===s&&l)return;this.log(`Switching to subtitle-track ${t}`+(o?` "${o.name}" lang:${o.lang} group:${o.groupId}`:""));const{id:u,groupId:d="",name:_,type:g,url:v}=o;this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:u,groupId:d,name:_,type:g,url:v});const y=this.switchParams(o.url,s==null?void 0:s.details,o.details);this.loadPlaylist(y)}}function Fd(){try{return crypto.randomUUID()}catch(h){try{const t=URL.createObjectURL(new Blob),n=t.toString();return URL.revokeObjectURL(t),n.slice(n.lastIndexOf("/")+1)}catch(t){let n=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,o=>{const l=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(o=="x"?l:l&3|8).toString(16)})}}}function Jo(h){let t=5381,n=h.length;for(;n;)t=t*33^h.charCodeAt(--n);return(t>>>0).toString()}const mo=.025;let Il=function(h){return h[h.Point=0]="Point",h[h.Range=1]="Range",h}({});function Bd(h,t,n){return`${h.identifier}-${n+1}-${Jo(t)}`}class bf{constructor(t,n){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=n,this.dateRange=t,this.setDateRange(t)}setDateRange(t){this.dateRange=t,this.resumeOffset=t.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=t.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=t.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=t.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var t;this.appendInPlaceStarted=!1,(t=this.assetListLoader)==null||t.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(t){var n;if(t>0&&t>=this.assetList.length)return!0;const s=this.playoutLimit;return t<=0||isNaN(s)?!1:s===0?!0:(((n=this.assetList[t])==null?void 0:n.startOffset)||0)>s}findAssetIndex(t){return this.assetList.indexOf(t)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const t=this.dateRange.startTime;if(this.snapOptions.out){const n=this.dateRange.tagAnchor;if(n)return Qc(t,n)}return t}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const t=this.dateRange.tagAnchor;if(t){const n=this.dateRange.startTime,s=Qc(n,t);return n-s<.1}return!1}get resumptionOffset(){const t=this.resumeOffset,n=ce(t)?t:this.duration;return this.cumulativeDuration+n}get resumeTime(){const t=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const n=this.resumeAnchor;if(n)return Qc(t,n)}return t}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)<mo))}set appendInPlace(t){if(this.appendInPlaceStarted){this.resetOnResume=!t;return}this.appendInPlaceDisabled=!t}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(t){this._timelineStart=t}get duration(){const t=this.playoutLimit;let n;return this._duration!==null?n=this._duration:this.dateRange.duration?n=this.dateRange.duration:n=this.dateRange.plannedDuration||0,!isNaN(t)&&t<n&&(n=t),n}set duration(t){this._duration=t}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Il.Range:Il.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 Nd(this)}}function Qc(h,t){return h-t.start<t.duration/2&&!(Math.abs(h-(t.start+t.duration))<mo)?t.start:t.start+t.duration}function xf(h,t,n){const s=new self.URL(h,n);return s.protocol!=="data:"&&s.searchParams.set("_HLS_primary_id",t),s}function eh(h,t){for(;(n=h.assetList[++t])!=null&&n.error;)var n;return t}function Nd(h){return`["${h.identifier}" ${h.cue.pre?"<pre>":h.cue.post?"<post>":""}${h.timelineStart.toFixed(2)}-${h.resumeTime.toFixed(2)}]`}function Qo(h){const t=h.timelineStart,n=h.duration||0;return`["${h.identifier}" ${t.toFixed(2)}-${(t+n).toFixed(2)}]`}class $d{constructor(t,n,s,o){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(S.PLAYOUT_LIMIT_REACHED,{})};const l=this.hls=new t(n);this.interstitial=s,this.assetItem=o;const u=()=>{this.hasDetails=!0};l.once(S.LEVEL_LOADED,u),l.once(S.AUDIO_TRACK_LOADED,u),l.once(S.SUBTITLE_TRACK_LOADED,u),l.on(S.MEDIA_ATTACHING,(d,{media:_})=>{this.removeMediaListeners(),this.mediaAttached=_,this.interstitial.playoutLimit&&(_.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&l.on(S.BUFFER_APPENDED,()=>{const v=this.bufferedEnd;this.reachedPlayout(v)&&(this._bufferedEosTime=v,l.trigger(S.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const t=this.hls;if(t)if(t.url)t.levels.length&&!t.started&&t.startLoad(-1,!0);else{let n=this.assetItem.uri;try{n=xf(n,t.config.primarySessionId||"").href}catch(s){}t.loadSource(n)}}bufferedInPlaceToEnd(t){var n;if(!this.appendInPlace)return!1;if((n=this.hls)!=null&&n.bufferedToEnd)return!0;if(!t)return!1;const s=Math.min(this._bufferedEosTime||1/0,this.duration),o=this.timelineOffset,l=li.bufferInfo(t,o,0);return this.getAssetTime(l.end)>=s-.02}reachedPlayout(t){const s=this.interstitial.playoutLimit;return this.startOffset+t>=s}get destroyed(){var t;return!((t=this.hls)!=null&&t.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var t;return((t=this.hls)==null?void 0:t.media)||null}get bufferedEnd(){const t=this.media||this.mediaAttached;if(!t)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const n=li.bufferInfo(t,t.currentTime,.001);return this.getAssetTime(n.end)}get currentTime(){const t=this.media||this.mediaAttached;return t?this.getAssetTime(t.currentTime):this._currentTime||0}get duration(){const t=this.assetItem.duration;if(!t)return 0;const n=this.interstitial.playoutLimit;if(n){const s=n-this.startOffset;if(s>0&&s<t)return s}return t}get remaining(){const t=this.duration;return t?Math.max(0,t-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var t;return((t=this.hls)==null?void 0:t.config.timelineOffset)||0}set timelineOffset(t){const n=this.timelineOffset;if(t!==n){const s=t-n;if(Math.abs(s)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=t}}}getAssetTime(t){const n=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,t-n),s)}removeMediaListeners(){const t=this.mediaAttached;t&&(this._currentTime=t.currentTime,this.bufferSnapShot(),t.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var t;(t=this.hls)!=null&&t.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(t){var n;this.loadSource(),(n=this.hls)==null||n.attachMedia(t)}detachMedia(){var t;this.removeMediaListeners(),this.mediaAttached=null,(t=this.hls)==null||t.detachMedia()}resumeBuffering(){var t;(t=this.hls)==null||t.resumeBuffering()}pauseBuffering(){var t;(t=this.hls)==null||t.pauseBuffering()}transferMedia(){var t;return this.bufferSnapShot(),((t=this.hls)==null?void 0:t.transferMedia())||null}resetDetails(){const t=this.hls;if(t&&this.hasDetails){t.stopLoad();const n=s=>delete s.details;t.levels.forEach(n),t.allAudioTracks.forEach(n),t.allSubtitleTracks.forEach(n),this.hasDetails=!1}}on(t,n,s){var o;(o=this.hls)==null||o.on(t,n)}once(t,n,s){var o;(o=this.hls)==null||o.once(t,n)}off(t,n,s){var o;(o=this.hls)==null||o.off(t,n)}toString(){var t;return`HlsAssetPlayer: ${Qo(this.assetItem)} ${(t=this.hls)==null?void 0:t.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const wf=.033;class Gu extends H{constructor(t,n){super("interstitials-sched",n),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=t}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(t=>t.reset()),this.events=this.items=null}resetErrorsInRange(t,n){return this.events?this.events.reduce((s,o)=>t<=o.startOffset&&n>o.startOffset?(delete o.error,s+1):s,0):0}get duration(){const t=this.items;return t?t[t.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(t){return t&&this.eventMap[t]||null}hasEvent(t){return t in this.eventMap}findItemIndex(t,n){if(t.event)return this.findEventIndex(t.event.identifier);let s=-1;t.nextEvent?s=this.findEventIndex(t.nextEvent.identifier)-1:t.previousEvent&&(s=this.findEventIndex(t.previousEvent.identifier)+1);const o=this.items;if(o)for(o[s]||(n===void 0&&(n=t.start),s=this.findItemIndexAtTime(n));s>=0&&(l=o[s])!=null&&l.event;){var l;s--}return s}findItemIndexAtTime(t,n){const s=this.items;if(s)for(let o=0;o<s.length;o++){let l=s[o];if(n&&n!=="primary"&&(l=l[n]),t===l.start||t>l.start&&t<l.end)return o}return-1}findJumpRestrictedIndex(t,n){const s=this.items;if(s)for(let o=t;o<=n&&s[o];o++){const l=s[o].event;if(l!=null&&l.restrictions.jump&&!l.appendInPlace)return o}return-1}findEventIndex(t){const n=this.items;if(n)for(let o=n.length;o--;){var s;if(((s=n[o].event)==null?void 0:s.identifier)===t)return o}return-1}findAssetIndex(t,n){const s=t.assetList,o=s.length;if(o>1)for(let l=0;l<o;l++){const u=s[l];if(!u.error){const d=u.timelineStart;if(n===d||n>d&&(n<d+(u.duration||0)||l===o-1))return l}}return 0}get assetIdAtEnd(){var t;const n=(t=this.items)==null||(t=t[this.length-1])==null?void 0:t.event;if(n){const s=n.assetList,o=s[s.length-1];if(o)return o.identifier}return null}parseInterstitialDateRanges(t,n){const s=t.main.details,{dateRanges:o}=s,l=this.events,u=this.parseDateRanges(o,{url:s.url},n),d=Object.keys(o),_=l?l.filter(g=>!d.includes(g.identifier)):[];u.length&&u.sort((g,v)=>{const y=g.cue.pre,x=g.cue.post,D=v.cue.pre,C=v.cue.post;if(y&&!D)return-1;if(D&&!y||x&&!C)return 1;if(C&&!x)return-1;if(!y&&!D&&!x&&!C){const F=g.startTime,B=v.startTime;if(F!==B)return F-B}return g.dateRange.tagOrder-v.dateRange.tagOrder}),this.events=u,_.forEach(g=>{this.removeEvent(g)}),this.updateSchedule(t,_)}updateSchedule(t,n=[],s=!1){const o=this.events||[];if(o.length||n.length||this.length<2){const l=this.items,u=this.parseSchedule(o,t);(s||n.length||(l==null?void 0:l.length)!==u.length||u.some((_,g)=>Math.abs(_.playout.start-l[g].playout.start)>.005||Math.abs(_.playout.end-l[g].playout.end)>.005))&&(this.items=u,this.onScheduleUpdate(n,l))}}parseDateRanges(t,n,s){const o=[],l=Object.keys(t);for(let u=0;u<l.length;u++){const d=l[u],_=t[d];if(_.isInterstitial){let g=this.eventMap[d];g?g.setDateRange(_):(g=new bf(_,n),this.eventMap[d]=g,s===!1&&(g.appendInPlace=s)),o.push(g)}}return o}parseSchedule(t,n){const s=[],o=n.main.details,l=o.live?1/0:o.edge;let u=0;if(t=t.filter(_=>!_.error&&!(_.cue.once&&_.hasPlayed)),t.length){this.resolveOffsets(t,n);let _=0,g=0;if(t.forEach((v,y)=>{const x=v.cue.pre,D=v.cue.post,C=t[y-1]||null,F=v.appendInPlace,B=D?l:v.startOffset,J=v.duration,ne=v.timelineOccupancy===Il.Range?J:0,le=v.resumptionOffset,Ee=(C==null?void 0:C.startTime)===B,Ie=B+v.cumulativeDuration;let tt=F?Ie+J:B+le;if(x||!D&&B<=0){const Ye=g;g+=ne,v.timelineStart=Ie;const qe=u;u+=J,s.push({event:v,start:Ie,end:tt,playout:{start:qe,end:u},integrated:{start:Ye,end:g}})}else if(B<=l){if(!Ee){const Fe=B-_;if(Fe>wf){const mt=_,Zt=g;g+=Fe;const ui=u;u+=Fe;const xi={previousEvent:t[y-1]||null,nextEvent:v,start:mt,end:mt+Fe,playout:{start:ui,end:u},integrated:{start:Zt,end:g}};s.push(xi)}else Fe>0&&C&&(C.cumulativeDuration+=Fe,s[s.length-1].end=B)}D&&(tt=Ie),v.timelineStart=Ie;const Ye=g;g+=ne;const qe=u;u+=J,s.push({event:v,start:Ie,end:tt,playout:{start:qe,end:u},integrated:{start:Ye,end:g}})}else return;const Pe=v.resumeTime;D||Pe>l?_=l:_=Pe}),_<l){var d;const v=_,y=g,x=l-_;g+=x;const D=u;u+=x,s.push({previousEvent:((d=s[s.length-1])==null?void 0:d.event)||null,nextEvent:null,start:_,end:v+x,playout:{start:D,end:u},integrated:{start:y,end:g}})}this.setDurations(l,u,g)}else s.push({previousEvent:null,nextEvent:null,start:0,end:l,playout:{start:0,end:l},integrated:{start:0,end:l}}),this.setDurations(l,l,l);return s}setDurations(t,n,s){this.durations={primary:t,playout:n,integrated:s}}resolveOffsets(t,n){const s=n.main.details,o=s.live?1/0:s.edge;let l=0,u=-1;t.forEach((d,_)=>{const g=d.cue.pre,v=d.cue.post,y=g?0:v?o:d.startTime;this.updateAssetDurations(d),u===y?d.cumulativeDuration=l:(l=0,u=y),!v&&d.snapOptions.in&&(d.resumeAnchor=Wi(null,s.fragments,d.startOffset+d.resumptionOffset,0,0)||void 0),d.appendInPlace&&!d.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(d,n)||(d.appendInPlace=!1)),!d.appendInPlace&&_+1<t.length&&t[_+1].startTime-t[_].resumeTime<wf&&(t[_+1].appendInPlace=!1,t[_+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${d}`));const D=ce(d.resumeOffset)?d.resumeOffset:d.duration;l+=D})}primaryCanResumeInPlaceAt(t,n){const s=t.resumeTime,o=t.startTime+t.resumptionOffset;return Math.abs(s-o)>mo?(this.log(`"${t.identifier}" resumption ${s} not aligned with estimated timeline end ${o}`),!1):!Object.keys(n).some(u=>{const d=n[u].details,_=d.edge;if(s>=_)return this.log(`"${t.identifier}" resumption ${s} past ${u} playlist end ${_}`),!1;const g=Wi(null,d.fragments,s);if(!g)return this.log(`"${t.identifier}" resumption ${s} does not align with any fragments in ${u} playlist (${d.fragStart}-${d.fragmentEnd})`),!0;const v=u==="audio"?.175:0;return Math.abs(g.start-s)<mo+v||Math.abs(g.end-s)<mo+v?!1:(this.log(`"${t.identifier}" resumption ${s} not aligned with ${u} fragment bounds (${g.start}-${g.end} sn: ${g.sn} cc: ${g.cc})`),!0)})}updateAssetDurations(t){if(!t.assetListLoaded)return;const n=t.timelineStart;let s=0,o=!1,l=!1;for(let u=0;u<t.assetList.length;u++){const d=t.assetList[u],_=n+s;d.startOffset=s,d.timelineStart=_,o||(o=d.duration===null),l||(l=!!d.error);const g=d.error?0:d.duration||0;s+=g}o&&!l?t.duration=Math.max(s,t.duration):t.duration=s}removeEvent(t){t.reset(),delete this.eventMap[t.identifier]}}function as(h){return`[${h.event?'"'+h.event.identifier+'"':"primary"}: ${h.start.toFixed(2)}-${h.end.toFixed(2)}]`}class go{constructor(t){this.hls=void 0,this.hls=t}destroy(){this.hls=null}loadAssetList(t,n){const s=t.assetListUrl;let o;try{o=xf(s,this.hls.sessionId,t.baseUrl)}catch(x){const D=this.assignAssetListError(t,q.ASSET_LIST_LOAD_ERROR,x,s);this.hls.trigger(S.ERROR,D);return}n&&o.protocol!=="data:"&&o.searchParams.set("_HLS_start_offset",""+n);const l=this.hls.config,u=l.loader,d=new u(l),_={responseType:"json",url:o.href},g=l.interstitialAssetListLoadPolicy.default,v={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:(x,D,C,F)=>{const B=x.data,J=B==null?void 0:B.ASSETS;if(!Array.isArray(J)){const ne=this.assignAssetListError(t,q.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),C.url,D,F);this.hls.trigger(S.ERROR,ne);return}t.assetListResponse=B,this.hls.trigger(S.ASSET_LIST_LOADED,{event:t,assetListResponse:B,networkDetails:F})},onError:(x,D,C,F)=>{const B=this.assignAssetListError(t,q.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${x.code} ${x.text} (${D.url})`),D.url,F,C);this.hls.trigger(S.ERROR,B)},onTimeout:(x,D,C)=>{const F=this.assignAssetListError(t,q.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${D.url})`),D.url,x,C);this.hls.trigger(S.ERROR,F)}};return d.load(_,v,y),this.hls.trigger(S.ASSET_LIST_LOADING,{event:t}),d}assignAssetListError(t,n,s,o,l,u){return t.error=s,{type:ge.NETWORK_ERROR,details:n,fatal:!1,interstitial:t,url:o,error:s,networkDetails:u,stats:l}}}function ea(h){h==null||h.play().catch(()=>{})}function Rl(h,t){return`[${h}] Advancing timeline position to ${t}`}class Sf extends H{constructor(t,n){super("interstitials",t.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 s=this.currentTime;if(s===void 0||this.playbackDisabled||!this.schedule)return;const o=s-this.timelinePos;if(Math.abs(o)<1/7056e5)return;const u=o<=-.01;this.timelinePos=s,this.bufferedPos=s;const d=this.playingItem;if(!d){this.checkBuffer();return}if(u&&this.schedule.resetErrorsInRange(s,s-o)&&this.updateSchedule(!0),this.checkBuffer(),u&&s<d.start||s>=d.end){var _;const D=this.findItemIndex(d);let C=this.schedule.findItemIndexAtTime(s);if(C===-1&&(C=D+(u?-1:1),this.log(`seeked ${u?"back ":""}to position not covered by schedule ${s} (resolving from ${D} to ${C})`)),!this.isInterstitial(d)&&(_=this.media)!=null&&_.paused&&(this.shouldPlay=!1),!u&&C>D){const F=this.schedule.findJumpRestrictedIndex(D+1,C);if(F>D){this.setSchedulePosition(F);return}}this.setSchedulePosition(C);return}const g=this.playingAsset;if(!g){if(this.playingLastItem&&this.isInterstitial(d)){const D=d.event.assetList[0];D&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,D))}return}const v=g.timelineStart,y=g.duration||0;if(u&&s<v||s>=v+y){var x;(x=d.event)!=null&&x.appendInPlace&&(this.clearInterstitial(d.event,d),this.flushFrontBuffer(s)),this.setScheduleToAssetAtTime(s,g)}},this.onTimeupdate=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;const o=this.playingItem;if(!o||this.playingLastItem)return;if(s>=o.end){this.timelinePos=o.end;const d=this.findItemIndex(o);this.setSchedulePosition(d+1)}const l=this.playingAsset;if(!l)return;const u=l.timelineStart+(l.duration||0);s>=u&&this.setScheduleToAssetAtTime(s,l)},this.onScheduleUpdate=(s,o)=>{const l=this.schedule;if(!l)return;const u=this.playingItem,d=l.events||[],_=l.items||[],g=l.durations,v=s.map(F=>F.identifier),y=!!(d.length||v.length);(y||o)&&this.log(`INTERSTITIALS_UPDATED (${d.length}): ${d}
|
|
|
Schedule: ${_.map(F=>as(F))} pos: ${this.timelinePos}`),v.length&&this.log(`Removed events ${v}`);let x=null,D=null;u&&(x=this.updateItem(u,this.timelinePos),this.itemsMatch(u,x)?this.playingItem=x:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const C=this.bufferingItem;if(C&&(D=this.updateItem(C,this.bufferedPos),this.itemsMatch(C,D)?this.bufferingItem=D:C.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(C.event,null))),s.forEach(F=>{F.assetList.forEach(B=>{this.clearAssetPlayer(B.identifier,null)})}),this.playerQueue.forEach(F=>{if(F.interstitial.appendInPlace){const B=F.assetItem.timelineStart,J=F.timelineOffset-B;if(J)try{F.timelineOffset=B}catch(ne){Math.abs(J)>mo&&this.warn(`${ne} ("${F.assetId}" ${F.timelineOffset}->${B})`)}}}),y||o){if(this.hls.trigger(S.INTERSTITIALS_UPDATED,{events:d.slice(0),schedule:_.slice(0),durations:g,removedIds:v}),this.isInterstitial(u)&&v.includes(u.event.identifier)){this.warn(`Interstitial "${u.event.identifier}" removed while playing`),this.primaryFallback(u.event);return}u&&this.trimInPlace(x,u),C&&D!==x&&this.trimInPlace(D,C),this.checkBuffer()}},this.hls=t,this.HlsPlayerClass=n,this.assetListLoader=new go(t),this.schedule=new Gu(this.onScheduleUpdate,t.logger),this.registerListeners()}registerListeners(){const t=this.hls;t&&(t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.on(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.on(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.on(S.BUFFER_APPENDED,this.onBufferAppended,this),t.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(S.BUFFERED_TO_END,this.onBufferedToEnd,this),t.on(S.MEDIA_ENDED,this.onMediaEnded,this),t.on(S.ERROR,this.onError,this),t.on(S.DESTROYING,this.onDestroying,this))}unregisterListeners(){const t=this.hls;t&&(t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.off(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.off(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.off(S.BUFFER_CODECS,this.onBufferCodecs,this),t.off(S.BUFFER_APPENDED,this.onBufferAppended,this),t.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(S.BUFFERED_TO_END,this.onBufferedToEnd,this),t.off(S.MEDIA_ENDED,this.onMediaEnded,this),t.off(S.ERROR,this.onError,this),t.off(S.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var t;(t=this.getBufferingPlayer())==null||t.resumeBuffering()}pauseBuffering(){var t;(t=this.getBufferingPlayer())==null||t.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const t=this.primaryMedia||this.media;t&&this.removeMediaListeners(t)}removeMediaListeners(t){Or(t,"play",this.onPlay),Or(t,"pause",this.onPause),Or(t,"seeking",this.onSeeking),Or(t,"timeupdate",this.onTimeupdate)}onMediaAttaching(t,n){const s=this.media=n.media;Jr(s,"seeking",this.onSeeking),Jr(s,"timeupdate",this.onTimeupdate),Jr(s,"play",this.onPlay),Jr(s,"pause",this.onPause)}onMediaAttached(t,n){const s=this.effectivePlayingItem,o=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!o){this.clearScheduleState();const l=this.findItemIndex(s);this.setSchedulePosition(l)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(t,n){const s=!!n.transferMedia,o=this.media;if(this.media=null,!s&&(o&&this.removeMediaListeners(o),this.detachedData)){const l=this.getBufferingPlayer();l&&(this.log(`Removing schedule state for detachedData and ${l}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,l.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const t=this,n=()=>t.bufferingItem||t.waitingItem,s=y=>y&&t.getAssetPlayer(y.identifier),o=(y,x,D,C,F)=>{if(y){let B=y[x].start;const J=y.event;if(J){if(x==="playout"||J.timelineOccupancy!==Il.Point){const ne=s(D);(ne==null?void 0:ne.interstitial)===J&&(B+=ne.assetItem.startOffset+ne[F])}}else{const ne=C==="bufferedPos"?u():t[C];B+=ne-y.start}return B}return 0},l=(y,x)=>{var D;if(y!==0&&x!=="primary"&&(D=t.schedule)!=null&&D.length){var C;const F=t.schedule.findItemIndexAtTime(y),B=(C=t.schedule.items)==null?void 0:C[F];if(B){const J=B[x].start-B.start;return y+J}}return y},u=()=>{const y=t.bufferedPos;return y===Number.MAX_VALUE?d("primary"):Math.max(y,0)},d=y=>{var x,D;return(x=t.primaryDetails)!=null&&x.live?t.primaryDetails.edge:((D=t.schedule)==null?void 0:D.durations[y])||0},_=(y,x)=>{var D,C;const F=t.effectivePlayingItem;if(F!=null&&(D=F.event)!=null&&D.restrictions.skip||!t.schedule)return;t.log(`seek to ${y} "${x}"`);const B=t.effectivePlayingItem,J=t.schedule.findItemIndexAtTime(y,x),ne=(C=t.schedule.items)==null?void 0:C[J],le=t.getBufferingPlayer(),Ee=le==null?void 0:le.interstitial,Ie=Ee==null?void 0:Ee.appendInPlace,tt=B&&t.itemsMatch(B,ne);if(B&&(Ie||tt)){const Pe=s(t.playingAsset),Ye=(Pe==null?void 0:Pe.media)||t.primaryMedia;if(Ye){const qe=x==="primary"?Ye.currentTime:o(B,x,t.playingAsset,"timelinePos","currentTime"),Fe=y-qe,mt=(Ie?qe:Ye.currentTime)+Fe;if(mt>=0&&(!Pe||Ie||mt<=Pe.duration)){Ye.currentTime=mt;return}}}if(ne){let Pe=y;if(x!=="primary"){const qe=ne[x].start,Fe=y-qe;Pe=ne.start+Fe}const Ye=!t.isInterstitial(ne);if((!t.isInterstitial(B)||B.event.appendInPlace)&&(Ye||ne.event.appendInPlace)){const qe=t.media||(Ie?le==null?void 0:le.media:null);qe&&(qe.currentTime=Pe)}else if(B){const qe=t.findItemIndex(B);if(J>qe){const mt=t.schedule.findJumpRestrictedIndex(qe+1,J);if(mt>qe){t.setSchedulePosition(mt);return}}let Fe=0;if(Ye)t.timelinePos=Pe,t.checkBuffer();else{const mt=ne.event.assetList,Zt=y-(ne[x]||ne).start;for(let ui=mt.length;ui--;){const xi=mt[ui];if(xi.duration&&Zt>=xi.startOffset&&Zt<xi.startOffset+xi.duration){Fe=ui;break}}}t.setSchedulePosition(J,Fe)}}},g=()=>{const y=t.effectivePlayingItem;if(t.isInterstitial(y))return y;const x=n();return t.isInterstitial(x)?x:null},v={get bufferedEnd(){const y=n(),x=t.bufferingItem;if(x&&x===y){var D;return o(x,"playout",t.bufferingAsset,"bufferedPos","bufferedEnd")-x.playout.start||((D=t.bufferingAsset)==null?void 0:D.startOffset)||0}return 0},get currentTime(){const y=g(),x=t.effectivePlayingItem;return x&&x===y?o(x,"playout",t.effectivePlayingAsset,"timelinePos","currentTime")-x.playout.start:0},set currentTime(y){const x=g(),D=t.effectivePlayingItem;D&&D===x&&_(y+D.playout.start,"playout")},get duration(){const y=g();return y?y.playout.end-y.playout.start:0},get assetPlayers(){var y;const x=(y=g())==null?void 0:y.event.assetList;return x?x.map(D=>t.getAssetPlayer(D.identifier)):[]},get playingIndex(){var y;const x=(y=g())==null?void 0:y.event;return x&&t.effectivePlayingAsset?x.findAssetIndex(t.effectivePlayingAsset):-1},get scheduleItem(){return g()}};return this.manager={get events(){var y;return((y=t.schedule)==null||(y=y.events)==null?void 0:y.slice(0))||[]},get schedule(){var y;return((y=t.schedule)==null||(y=y.items)==null?void 0:y.slice(0))||[]},get interstitialPlayer(){return g()?v:null},get playerQueue(){return t.playerQueue.slice(0)},get bufferingAsset(){return t.bufferingAsset},get bufferingItem(){return n()},get bufferingIndex(){const y=n();return t.findItemIndex(y)},get playingAsset(){return t.effectivePlayingAsset},get playingItem(){return t.effectivePlayingItem},get playingIndex(){const y=t.effectivePlayingItem;return t.findItemIndex(y)},primary:{get bufferedEnd(){return u()},get currentTime(){const y=t.timelinePos;return y>0?y:0},set currentTime(y){_(y,"primary")},get duration(){return d("primary")},get seekableStart(){var y;return((y=t.primaryDetails)==null?void 0:y.fragmentStart)||0}},integrated:{get bufferedEnd(){return o(n(),"integrated",t.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return o(t.effectivePlayingItem,"integrated",t.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(y){_(y,"integrated")},get duration(){return d("integrated")},get seekableStart(){var y;return l(((y=t.primaryDetails)==null?void 0:y.fragmentStart)||0,"integrated")}},skip:()=>{const y=t.effectivePlayingItem,x=y==null?void 0:y.event;if(x&&!x.restrictions.skip){const D=t.findItemIndex(y);if(x.appendInPlace){const C=y.playout.start+y.event.duration;_(C+.001,"playout")}else t.advanceAfterAssetEnded(x,D,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var t;const n=this.playingItem,s=(t=this.schedule)==null?void 0:t.items;return!this.playbackStarted||!n||!s?!1:this.findItemIndex(n)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var t,n;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let o=this.media;!o&&(t=this.bufferingItem)!=null&&(t=t.event)!=null&&t.appendInPlace&&(o=this.primaryMedia);const l=(n=o)==null?void 0:n.currentTime;if(!(l===void 0||!ce(l)))return l}get primaryMedia(){var t;return this.media||((t=this.detachedData)==null?void 0:t.media)||null}isInterstitial(t){return!!(t!=null&&t.event)}retreiveMediaSource(t,n){const s=this.getAssetPlayer(t);s&&this.transferMediaFromPlayer(s,n)}transferMediaFromPlayer(t,n){const s=t.interstitial.appendInPlace,o=t.media;if(s&&o===this.primaryMedia){if(this.bufferingAsset=null,(!n||this.isInterstitial(n)&&!n.event.appendInPlace)&&n&&o){this.detachedData={media:o};return}const l=t.transferMedia();this.log(`transfer MediaSource from ${t} ${$e(l)}`),this.detachedData=l}else n&&o&&(this.shouldPlay||(this.shouldPlay=!o.paused))}transferMediaTo(t,n){var s,o;if(t.media===n)return;let l=null;const u=this.hls,d=t!==u,_=d&&t.interstitial.appendInPlace,g=(s=this.detachedData)==null?void 0:s.mediaSource;let v;if(u.media)_&&(l=u.transferMedia(),this.detachedData=l),v="Primary";else if(g){const C=this.getBufferingPlayer();C?(l=C.transferMedia(),v=`${C}`):v="detached MediaSource"}else v="detached media";if(!l){if(g)l=this.detachedData,this.log(`using detachedData: MediaSource ${$e(l)}`);else if(!this.detachedData||u.media===n){const C=this.playerQueue;C.length>1&&C.forEach(F=>{if(d&&F.interstitial.appendInPlace!==_){const B=F.interstitial;this.clearInterstitial(F.interstitial,null),B.appendInPlace=!1,B.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${B}`)}}),this.hls.detachMedia(),this.detachedData={media:n}}}const y=l&&"mediaSource"in l&&((o=l.mediaSource)==null?void 0:o.readyState)!=="closed",x=y&&l?l:n;this.log(`${y?"transfering MediaSource":"attaching media"} to ${d?t:"Primary"} from ${v} (media.currentTime: ${n.currentTime})`);const D=this.schedule;if(x===l&&D){const C=d&&t.assetId===D.assetIdAtEnd;x.overrides={duration:D.duration,endOfStream:!d||C,cueRemoval:!d}}t.attachMedia(x)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const t=this.schedule,n=t==null?void 0:t.events;if(!n||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const s=this.timelinePos,o=this.effectivePlayingItem;if(s===-1){const l=this.hls.startPosition;if(this.log(Rl("checkStart",l)),this.timelinePos=l,n.length&&n[0].cue.pre){const u=t.findEventIndex(n[0].identifier);this.setSchedulePosition(u)}else if(l>=0||!this.primaryLive){const u=this.timelinePos=l>0?l:0,d=t.findItemIndexAtTime(u);this.setSchedulePosition(d)}}else if(o&&!this.playingItem){const l=t.findItemIndex(o);this.setSchedulePosition(l)}}advanceAssetBuffering(t,n){const s=t.event,o=s.findAssetIndex(n),l=eh(s,o);if(!s.isAssetPastPlayoutLimit(l))this.bufferedToEvent(t,l);else if(this.schedule){var u;const d=(u=this.schedule.items)==null?void 0:u[this.findItemIndex(t)+1];d&&this.bufferedToItem(d)}}advanceAfterAssetEnded(t,n,s){const o=eh(t,s);if(t.isAssetPastPlayoutLimit(o)){if(this.schedule){const l=this.schedule.items;if(l){const u=n+1,d=l.length;if(u>=d){this.setSchedulePosition(-1);return}const _=t.resumeTime;this.timelinePos<_&&(this.log(Rl("advanceAfterAssetEnded",_)),this.timelinePos=_,t.appendInPlace&&this.advanceInPlace(_),this.checkBuffer(this.bufferedPos<_)),this.setSchedulePosition(u)}}}else{if(t.appendInPlace){const l=t.assetList[o];l&&this.advanceInPlace(l.timelineStart)}this.setSchedulePosition(n,o)}}setScheduleToAssetAtTime(t,n){const s=this.schedule;if(!s)return;const o=n.parentIdentifier,l=s.getEvent(o);if(l){const u=s.findEventIndex(o),d=s.findAssetIndex(l,t);this.advanceAfterAssetEnded(l,u,d-1)}}setSchedulePosition(t,n){var s;const o=(s=this.schedule)==null?void 0:s.items;if(!o||this.playbackDisabled)return;const l=t>=0?o[t]:null;this.log(`setSchedulePosition ${t}, ${n} (${l&&as(l)}) pos: ${this.timelinePos}`);const u=this.waitingItem||this.playingItem,d=this.playingLastItem;if(this.isInterstitial(u)){const v=u.event,y=this.playingAsset,x=y==null?void 0:y.identifier,D=x?this.getAssetPlayer(x):null;if(D&&x&&(!this.eventItemsMatch(u,l)||n!==void 0&&x!==v.assetList[n].identifier)){var _;const C=v.findAssetIndex(y);if(this.log(`INTERSTITIAL_ASSET_ENDED ${C+1}/${v.assetList.length} ${Qo(y)}`),this.endedAsset=y,this.playingAsset=null,this.hls.trigger(S.INTERSTITIAL_ASSET_ENDED,{asset:y,assetListIndex:C,event:v,schedule:o.slice(0),scheduleIndex:t,player:D}),u!==this.playingItem){this.itemsMatch(u,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(v,this.findItemIndex(this.playingItem),C);return}this.retreiveMediaSource(x,l),D.media&&!((_=this.detachedData)!=null&&_.mediaSource)&&D.detachMedia()}if(!this.eventItemsMatch(u,l)&&(this.endedItem=u,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${v} ${as(u)}`),v.hasPlayed=!0,this.hls.trigger(S.INTERSTITIAL_ENDED,{event:v,schedule:o.slice(0),scheduleIndex:t}),v.cue.once)){var g;this.updateSchedule();const C=(g=this.schedule)==null?void 0:g.items;if(l&&C){const F=this.findItemIndex(l);this.advanceSchedule(F,C,n,u,d)}return}}this.advanceSchedule(t,o,n,u,d)}advanceSchedule(t,n,s,o,l){const u=this.schedule;if(!u)return;const d=n[t]||null,_=this.primaryMedia,g=this.playerQueue;if(g.length&&g.forEach(v=>{const y=v.interstitial,x=u.findEventIndex(y.identifier);(x<t||x>t+1)&&this.clearInterstitial(y,d)}),this.isInterstitial(d)){this.timelinePos=Math.min(Math.max(this.timelinePos,d.start),d.end);const v=d.event;if(s===void 0){s=u.findAssetIndex(v,this.timelinePos);const C=eh(v,s-1);if(v.isAssetPastPlayoutLimit(C)||v.appendInPlace&&this.timelinePos===d.end){this.advanceAfterAssetEnded(v,t,s);return}s=C}const y=this.waitingItem;this.assetsBuffered(d,_)||this.setBufferingItem(d);let x=this.preloadAssets(v,s);if(this.eventItemsMatch(d,y||o)||(this.waitingItem=d,this.log(`INTERSTITIAL_STARTED ${as(d)} ${v.appendInPlace?"append in place":""}`),this.hls.trigger(S.INTERSTITIAL_STARTED,{event:v,schedule:n.slice(0),scheduleIndex:t})),!v.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${v}`);return}if(v.assetListLoader&&(v.assetListLoader.destroy(),v.assetListLoader=void 0),!_){this.log(`Waiting for attachMedia to start Interstitial ${v}`);return}this.waitingItem=this.endedItem=null,this.playingItem=d;const D=v.assetList[s];if(!D){this.advanceAfterAssetEnded(v,t,s||0);return}if(x||(x=this.getAssetPlayer(D.identifier)),x===null||x.destroyed){const C=v.assetList.length;this.warn(`asset ${s+1}/${C} player destroyed ${v}`),x=this.createAssetPlayer(v,D,s),x.loadSource()}if(!this.eventItemsMatch(d,this.bufferingItem)&&v.appendInPlace&&this.isAssetBuffered(D))return;this.startAssetPlayer(x,s,n,t,_),this.shouldPlay&&ea(x.media)}else d?(this.resumePrimary(d,t,o),this.shouldPlay&&ea(this.hls.media)):l&&this.isInterstitial(o)&&(this.endedItem=null,this.playingItem=o,o.event.appendInPlace||this.attachPrimary(u.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var t;return(t=this.mediaSelection)==null?void 0:t.main.details}get primaryLive(){var t;return!!((t=this.primaryDetails)!=null&&t.live)}resumePrimary(t,n,s){var o,l;if(this.playingItem=t,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(t),this.log(`resuming ${as(t)}`),!((o=this.detachedData)!=null&&o.mediaSource)){let d=this.timelinePos;(d<t.start||d>=t.end)&&(d=this.getPrimaryResumption(t,n),this.log(Rl("resumePrimary",d)),this.timelinePos=d),this.attachPrimary(d,t)}if(!s)return;const u=(l=this.schedule)==null?void 0:l.items;u&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${as(t)}`),this.hls.trigger(S.INTERSTITIALS_PRIMARY_RESUMED,{schedule:u.slice(0),scheduleIndex:n}),this.checkBuffer())}getPrimaryResumption(t,n){const s=t.start;if(this.primaryLive){const o=this.primaryDetails;if(n===0)return this.hls.startPosition;if(o&&(s<o.fragmentStart||s>o.edge))return this.hls.liveSyncPosition||-1}return s}isAssetBuffered(t){const n=this.getAssetPlayer(t.identifier);return n!=null&&n.hls?n.hls.bufferedToEnd:li.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=t.timelineStart+(t.duration||0)}attachPrimary(t,n,s){n?this.setBufferingItem(n):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const o=this.primaryMedia;if(!o)return;const l=this.hls;l.media?this.checkBuffer():(this.transferMediaTo(l,o),s&&this.startLoadingPrimaryAt(t,s)),s||(this.log(Rl("attachPrimary",t)),this.timelinePos=t,this.startLoadingPrimaryAt(t,s))}startLoadingPrimaryAt(t,n){var s;const o=this.hls;!o.loadingEnabled||!o.media||Math.abs((((s=o.mainForwardBufferInfo)==null?void 0:s.start)||o.media.currentTime)-t)>.5?o.startLoad(t,n):o.bufferingEnabled||o.resumeBuffering()}onManifestLoading(){var t;this.stopLoad(),(t=this.schedule)==null||t.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(S.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(S.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(t,n){if(n.level===-1||!this.schedule)return;const s=this.hls.levels[n.level];if(!s.details)return;const o=M(M({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=o,this.schedule.parseInterstitialDateRanges(o,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(t,n){const s=this.hls.audioTracks[n.id],o=this.mediaSelection;if(!o){this.altSelection=M(M({},this.altSelection),{},{audio:s});return}const l=M(M({},o),{},{audio:s});this.mediaSelection=l}onSubtitleTrackUpdated(t,n){const s=this.hls.subtitleTracks[n.id],o=this.mediaSelection;if(!o){this.altSelection=M(M({},this.altSelection),{},{subtitles:s});return}const l=M(M({},o),{},{subtitles:s});this.mediaSelection=l}onAudioTrackSwitching(t,n){const s=zt(n);this.playerQueue.forEach(({hls:o})=>o&&(o.setAudioOption(n)||o.setAudioOption(s)))}onSubtitleTrackSwitch(t,n){const s=zt(n);this.playerQueue.forEach(({hls:o})=>o&&(o.setSubtitleOption(n)||n.id!==-1&&o.setSubtitleOption(s)))}onBufferCodecs(t,n){const s=n.tracks;s&&(this.requiredTracks=s)}onBufferAppended(t,n){this.checkBuffer()}onBufferFlushed(t,n){const s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){const o=this.timelinePos;this.bufferedPos=o,this.checkBuffer()}}onBufferedToEnd(t){if(!this.schedule)return;const n=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&n){for(let o=0;o<n.length;o++){const l=n[o];if(l.cue.post){var s;const u=this.schedule.findEventIndex(l.identifier),d=(s=this.schedule.items)==null?void 0:s[u];this.isInterstitial(d)&&this.eventItemsMatch(d,this.bufferingItem)&&this.bufferedToItem(d,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(t){const n=this.playingItem;if(!this.playingLastItem&&n){const s=this.findItemIndex(n);this.setSchedulePosition(s+1)}else this.shouldPlay=!1}updateItem(t,n){var s;const o=(s=this.schedule)==null?void 0:s.items;if(t&&o){const l=this.findItemIndex(t,n);return o[l]||null}return null}trimInPlace(t,n){if(this.isInterstitial(t)&&t.event.appendInPlace&&n.end-t.end>.25){t.event.assetList.forEach((l,u)=>{t.event.isAssetPastPlayoutLimit(u)&&this.clearAssetPlayer(l.identifier,null)});const s=t.end+.25,o=li.bufferInfo(this.primaryMedia,s,0);(o.end>s||(o.nextStart||0)>s)&&(this.log(`trim buffered interstitial ${as(t)} (was ${as(n)})`),this.attachPrimary(s,null,!0),this.flushFrontBuffer(s))}}itemsMatch(t,n){return!!n&&(t===n||t.event&&n.event&&this.eventItemsMatch(t,n)||!t.event&&!n.event&&this.findItemIndex(t)===this.findItemIndex(n))}eventItemsMatch(t,n){var s;return!!n&&(t===n||t.event.identifier===((s=n.event)==null?void 0:s.identifier))}findItemIndex(t,n){return t&&this.schedule?this.schedule.findItemIndex(t,n):-1}updateSchedule(t=!1){var n;const s=this.mediaSelection;s&&((n=this.schedule)==null||n.updateSchedule(s,[],t))}checkBuffer(t){var n;const s=(n=this.schedule)==null?void 0:n.items;if(!s)return;const o=li.bufferInfo(this.primaryMedia,this.timelinePos,0);t&&(this.bufferedPos=this.timelinePos),t||(t=o.len<1),this.updateBufferedPos(o.end,s,t)}updateBufferedPos(t,n,s){const o=this.schedule,l=this.bufferingItem;if(this.bufferedPos>t||!o)return;if(n.length===1&&this.itemsMatch(n[0],l)){this.bufferedPos=t;return}const u=this.playingItem,d=this.findItemIndex(u);let _=o.findItemIndexAtTime(t);if(this.bufferedPos<t){var g;const v=this.findItemIndex(l),y=Math.min(v+1,n.length-1),x=n[y];if((_===-1&&l&&t>=l.end||(g=x.event)!=null&&g.appendInPlace&&t+.01>=x.start)&&(_=y),this.isInterstitial(l)){const D=l.event;if(y-d>1&&D.appendInPlace===!1||D.assetList.length===0&&D.assetListLoader)return}if(this.bufferedPos=t,_>v&&_>d)this.bufferedToItem(x);else{const D=this.primaryDetails;this.primaryLive&&D&&t>D.edge-D.targetduration&&x.start<D.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(x)&&this.preloadAssets(x.event,0)}}else s&&u&&!this.itemsMatch(u,l)&&(_===d?this.bufferedToItem(u):_===d+1&&this.bufferedToItem(n[_]))}assetsBuffered(t,n){return t.event.assetList.length===0?!1:!t.event.assetList.some(o=>{const l=this.getAssetPlayer(o.identifier);return!(l!=null&&l.bufferedInPlaceToEnd(n))})}setBufferingItem(t){const n=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(t,n)&&s){const{items:o,events:l}=s;if(!o||!l)return n;const u=this.isInterstitial(t),d=this.getBufferingPlayer();this.bufferingItem=t,this.bufferedPos=Math.max(t.start,Math.min(t.end,this.timelinePos));const _=d?d.remaining:n?n.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${as(t)}`+(n?` (${_.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(u){const g=s.findAssetIndex(t.event,this.bufferedPos);t.event.assetList.forEach((v,y)=>{const x=this.getAssetPlayer(v.identifier);x&&(y===g&&x.loadSource(),x.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(g=>g.pauseBuffering());this.hls.trigger(S.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:l.slice(0),schedule:o.slice(0),bufferingIndex:this.findItemIndex(t),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==t&&(this.bufferingItem=t);return n}bufferedToItem(t,n=0){const s=this.setBufferingItem(t);if(!this.playbackDisabled){if(this.isInterstitial(t))this.bufferedToEvent(t,n);else if(s!==null){this.bufferingAsset=null;const o=this.detachedData;o?o.mediaSource?this.attachPrimary(t.start,t,!0):this.preloadPrimary(t):this.preloadPrimary(t)}}}preloadPrimary(t){const n=this.findItemIndex(t),s=this.getPrimaryResumption(t,n);this.startLoadingPrimaryAt(s)}bufferedToEvent(t,n){const s=t.event,o=s.assetList.length===0&&!s.assetListLoader,l=s.cue.once;if(o||!l){const u=this.preloadAssets(s,n);if(u!=null&&u.interstitial.appendInPlace){const d=this.primaryMedia;d&&this.bufferAssetPlayer(u,d)}}}preloadAssets(t,n){const s=t.assetUrl,o=t.assetList.length,l=o===0&&!t.assetListLoader,u=t.cue.once;if(l){const _=t.timelineStart;if(t.appendInPlace){var d;const x=this.playingItem;!this.isInterstitial(x)&&(x==null||(d=x.nextEvent)==null?void 0:d.identifier)===t.identifier&&this.flushFrontBuffer(_+.25)}let g,v=0;if(!this.playingItem&&this.primaryLive&&(v=this.hls.startPosition,v===-1&&(v=this.hls.liveSyncPosition||0)),v&&!(t.cue.pre||t.cue.post)){const x=v-_;x>0&&(g=Math.round(x*1e3)/1e3)}if(this.log(`Load interstitial asset ${n+1}/${s?1:o} ${t}${g?` live-start: ${v} start-offset: ${g}`:""}`),s)return this.createAsset(t,0,0,_,t.duration,s);const y=this.assetListLoader.loadAssetList(t,g);y&&(t.assetListLoader=y)}else if(!u&&o){for(let g=n;g<o;g++){const v=t.assetList[g],y=this.getAssetPlayerQueueIndex(v.identifier);(y===-1||this.playerQueue[y].destroyed)&&!v.error&&this.createAssetPlayer(t,v,g)}const _=t.assetList[n];if(_){const g=this.getAssetPlayer(_.identifier);return g&&g.loadSource(),g}}return null}flushFrontBuffer(t){const n=this.requiredTracks;if(!n)return;this.log(`Removing front buffer starting at ${t}`),Object.keys(n).forEach(o=>{this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:t,endOffset:1/0,type:o})})}getAssetPlayerQueueIndex(t){const n=this.playerQueue;for(let s=0;s<n.length;s++)if(t===n[s].assetId)return s;return-1}getAssetPlayer(t){const n=this.getAssetPlayerQueueIndex(t);return this.playerQueue[n]||null}getBufferingPlayer(){const{playerQueue:t,primaryMedia:n}=this;if(n){for(let s=0;s<t.length;s++)if(t[s].media===n)return t[s]}return null}createAsset(t,n,s,o,l,u){const d={parentIdentifier:t.identifier,identifier:Bd(t,u,n),duration:l,startOffset:s,timelineStart:o,uri:u};return this.createAssetPlayer(t,d,n)}createAssetPlayer(t,n,s){const o=this.hls,l=o.userConfig;let u=l.videoPreference;const d=o.loadLevelObj||o.levels[o.currentLevel];(u||d)&&(u=k({},u),d.videoCodec&&(u.videoCodec=d.videoCodec),d.videoRange&&(u.allowedVideoRanges=[d.videoRange]));const _=o.audioTracks[o.audioTrack],g=o.subtitleTracks[o.subtitleTrack];let v=0;if(this.primaryLive||t.appendInPlace){const Ee=this.timelinePos-n.timelineStart;if(Ee>1){const Ie=n.duration;Ie&&Ee<Ie&&(v=Ee)}}const y=n.identifier,x=M(M({},l),{},{maxMaxBufferLength:Math.min(180,o.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:o.sessionId,assetPlayerId:y,abrEwmaDefaultEstimate:o.bandwidthEstimate,interstitialsController:void 0,startPosition:v,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:u,audioPreference:_||l.audioPreference,subtitlePreference:g||l.subtitlePreference});t.appendInPlace&&(t.appendInPlaceStarted=!0,n.timelineStart&&(x.timelineOffset=n.timelineStart));const D=x.cmcd;D!=null&&D.sessionId&&D.contentId&&(x.cmcd=k({},D,{contentId:Jo(n.uri)})),this.getAssetPlayer(y)&&this.warn(`Duplicate date range identifier ${t} and asset ${y}`);const C=new $d(this.HlsPlayerClass,x,t,n);this.playerQueue.push(C),t.assetList[s]=n;let F=!0;const B=Ee=>{if(Ee.live){var Ie;const Ye=new Error(`Interstitials MUST be VOD assets ${t}`),qe={fatal:!0,type:ge.OTHER_ERROR,details:q.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ye},Fe=((Ie=this.schedule)==null?void 0:Ie.findEventIndex(t.identifier))||-1;this.handleAssetItemError(qe,t,Fe,s,Ye.message);return}const tt=Ee.edge-Ee.fragmentStart,Pe=n.duration;(F||Pe===null||tt>Pe)&&(F=!1,this.log(`Interstitial asset "${y}" duration change ${Pe} > ${tt}`),n.duration=tt,this.updateSchedule())};C.on(S.LEVEL_UPDATED,(Ee,{details:Ie})=>B(Ie)),C.on(S.LEVEL_PTS_UPDATED,(Ee,{details:Ie})=>B(Ie)),C.on(S.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const J=(Ee,Ie)=>{const tt=this.getAssetPlayer(y);if(tt&&Ie.tracks){tt.off(S.BUFFER_CODECS,J),tt.tracks=Ie.tracks;const Pe=this.primaryMedia;this.bufferingAsset===tt.assetItem&&Pe&&!tt.media&&this.bufferAssetPlayer(tt,Pe)}};C.on(S.BUFFER_CODECS,J);const ne=()=>{var Ee;const Ie=this.getAssetPlayer(y);if(this.log(`buffered to end of asset ${Ie}`),!Ie||!this.schedule)return;const tt=this.schedule.findEventIndex(t.identifier),Pe=(Ee=this.schedule.items)==null?void 0:Ee[tt];this.isInterstitial(Pe)&&this.advanceAssetBuffering(Pe,n)};C.on(S.BUFFERED_TO_END,ne);const le=Ee=>()=>{if(!this.getAssetPlayer(y)||!this.schedule)return;this.shouldPlay=!0;const tt=this.schedule.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,tt,Ee)};return C.once(S.MEDIA_ENDED,le(s)),C.once(S.PLAYOUT_LIMIT_REACHED,le(1/0)),C.on(S.ERROR,(Ee,Ie)=>{if(!this.schedule)return;const tt=this.getAssetPlayer(y);if(Ie.details===q.BUFFER_STALLED_ERROR){if(tt!=null&&tt.appendInPlace){this.handleInPlaceStall(t);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(Ie,t,this.schedule.findEventIndex(t.identifier),s,`Asset player error ${Ie.error} ${t}`)}),C.on(S.DESTROYING,()=>{if(!this.getAssetPlayer(y)||!this.schedule)return;const Ie=new Error(`Asset player destroyed unexpectedly ${y}`),tt={fatal:!0,type:ge.OTHER_ERROR,details:q.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ie};this.handleAssetItemError(tt,t,this.schedule.findEventIndex(t.identifier),s,Ie.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Qo(n)}`),this.hls.trigger(S.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:n,assetListIndex:s,event:t,player:C}),C}clearInterstitial(t,n){t.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,n)}),t.reset()}resetAssetPlayer(t){const n=this.getAssetPlayerQueueIndex(t);if(n!==-1){this.log(`reset asset player "${t}" after error`);const s=this.playerQueue[n];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(t,n){const s=this.getAssetPlayerQueueIndex(t);if(s!==-1){const o=this.playerQueue[s];this.log(`clear ${o} toSegment: ${n&&as(n)}`),this.transferMediaFromPlayer(o,n),this.playerQueue.splice(s,1),o.destroy()}}emptyPlayerQueue(){let t;for(;t=this.playerQueue.pop();)t.destroy();this.playerQueue=[]}startAssetPlayer(t,n,s,o,l){const{interstitial:u,assetItem:d,assetId:_}=t,g=u.assetList.length,v=this.playingAsset;this.endedAsset=null,this.playingAsset=d,(!v||v.identifier!==_)&&(v&&(this.clearAssetPlayer(v.identifier,s[o]),delete v.error),this.log(`INTERSTITIAL_ASSET_STARTED ${n+1}/${g} ${Qo(d)}`),this.hls.trigger(S.INTERSTITIAL_ASSET_STARTED,{asset:d,assetListIndex:n,event:u,schedule:s.slice(0),scheduleIndex:o,player:t})),this.bufferAssetPlayer(t,l)}bufferAssetPlayer(t,n){var s,o;if(!this.schedule)return;const{interstitial:l,assetItem:u}=t,d=this.schedule.findEventIndex(l.identifier),_=(s=this.schedule.items)==null?void 0:s[d];if(!_)return;t.loadSource(),this.setBufferingItem(_),this.bufferingAsset=u;const g=this.getBufferingPlayer();if(g===t)return;const v=l.appendInPlace;if(v&&(g==null?void 0:g.interstitial.appendInPlace)===!1)return;const y=(g==null?void 0:g.tracks)||((o=this.detachedData)==null?void 0:o.tracks)||this.requiredTracks;if(v&&u!==this.playingAsset){if(!t.tracks){this.log(`Waiting for track info before buffering ${t}`);return}if(y&&!Be(y,t.tracks)){const x=new Error(`Asset ${Qo(u)} SourceBuffer tracks ('${Object.keys(t.tracks)}') are not compatible with primary content tracks ('${Object.keys(y)}')`),D={fatal:!0,type:ge.OTHER_ERROR,details:q.INTERSTITIAL_ASSET_ITEM_ERROR,error:x},C=l.findAssetIndex(u);this.handleAssetItemError(D,l,d,C,x.message);return}}this.transferMediaTo(t,n)}handleInPlaceStall(t){const n=this.schedule,s=this.primaryMedia;if(!n||!s)return;const o=s.currentTime,l=n.findAssetIndex(t,o),u=t.assetList[l];if(u){const d=this.getAssetPlayer(u.identifier);if(d){const _=d.currentTime||o-u.timelineStart,g=d.duration-_;if(this.warn(`Stalled at ${_} of ${_+g} in ${d} ${t} (media.currentTime: ${o})`),_&&(g/s.playbackRate<.5||d.bufferedInPlaceToEnd(s))&&d.hls){const v=n.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,v,l)}}}}advanceInPlace(t){const n=this.primaryMedia;n&&n.currentTime<t&&(n.currentTime=t)}handleAssetItemError(t,n,s,o,l){if(t.details===q.BUFFER_STALLED_ERROR)return;const u=n.assetList[o]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${u&&Qo(u)} ${t.error}`),!this.schedule)return;const d=(u==null?void 0:u.identifier)||"",_=this.getAssetPlayerQueueIndex(d),g=this.playerQueue[_]||null,v=this.schedule.items,y=k({},t,{fatal:!1,errorAction:ln(!0),asset:u,assetListIndex:o,event:n,schedule:v,scheduleIndex:s,player:g});if(this.hls.trigger(S.INTERSTITIAL_ASSET_ERROR,y),!t.fatal)return;const x=this.playingAsset,D=this.bufferingAsset,C=new Error(l);if(u&&(this.clearAssetPlayer(d,null),u.error=C),!n.assetList.some(F=>!F.error))n.error=C;else for(let F=o;F<n.assetList.length;F++)this.resetAssetPlayer(n.assetList[F].identifier);this.updateSchedule(!0),n.error?this.primaryFallback(n):x&&x.identifier===d?this.advanceAfterAssetEnded(n,s,o):D&&D.identifier===d&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,D)}primaryFallback(t){const n=t.timelineStart,s=this.effectivePlayingItem;if(s){this.log(`Fallback to primary from event "${t.identifier}" start: ${n} pos: ${this.timelinePos} playing: ${as(s)} error: ${t.error}`);let o=this.timelinePos;o===-1&&(o=this.hls.startPosition);const l=this.updateItem(s,o);if(this.itemsMatch(s,l)&&this.clearInterstitial(t,null),t.appendInPlace&&(this.attachPrimary(n,null),this.flushFrontBuffer(n)),!this.schedule)return;const u=this.schedule.findItemIndexAtTime(o);this.setSchedulePosition(u)}else this.checkStart()}onAssetListLoaded(t,n){var s,o;const l=n.event,u=l.identifier,d=n.assetListResponse.ASSETS;if(!((s=this.schedule)!=null&&s.hasEvent(u)))return;const _=l.timelineStart,g=l.duration;let v=0;d.forEach((F,B)=>{const J=parseFloat(F.DURATION);this.createAsset(l,B,v,_+v,J,F.URI),v+=J}),l.duration=v,this.log(`Loaded asset-list with duration: ${v} (was: ${g}) ${l}`);const y=this.waitingItem,x=(y==null?void 0:y.event.identifier)===u;this.updateSchedule();const D=(o=this.bufferingItem)==null?void 0:o.event;if(x){var C;const F=this.schedule.findEventIndex(u),B=(C=this.schedule.items)==null?void 0:C[F];if(B){if(!this.playingItem&&this.timelinePos>B.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==F){l.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${l}`),this.updateSchedule(!0),this.primaryFallback(l);return}this.setBufferingItem(B)}this.setSchedulePosition(F)}else if((D==null?void 0:D.identifier)===u){const F=l.assetList[0];if(F){const B=this.getAssetPlayer(F.identifier);if(D.appendInPlace){const J=this.primaryMedia;B&&J&&this.bufferAssetPlayer(B,J)}else B&&B.loadSource()}}}onError(t,n){if(this.schedule)switch(n.details){case q.ASSET_LIST_PARSING_ERROR:case q.ASSET_LIST_LOAD_ERROR:case q.ASSET_LIST_LOAD_TIMEOUT:{const s=n.interstitial;s&&(this.updateSchedule(!0),this.primaryFallback(s));break}case q.BUFFER_STALLED_ERROR:{const s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const th=500;class Kd extends lu{constructor(t,n,s){super(t,n,s,"subtitle-stream-controller",P.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:t}=this;t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(t,n){this.stopLoad(),this.state=pt.IDLE,this.setInterval(th),this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(t,n){this.tracksBuffered=[],super.onMediaDetaching(t,n)}onLevelLoaded(t,n){this.mainDetails=n.details}onSubtitleFragProcessed(t,n){const{frag:s,success:o}=n;if(this.fragContextChanged(s)||(ze(s)&&(this.fragPrevious=s),this.state=pt.IDLE),!o)return;const l=this.tracksBuffered[this.currentTrackId];if(!l)return;let u;const d=s.start;for(let g=0;g<l.length;g++)if(d>=l[g].start&&d<=l[g].end){u=l[g];break}const _=s.start+s.duration;u?u.end=_:(u={start:d,end:_},l.push(u)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null),this.media&&this.tick()}onBufferFlushing(t,n){const{startOffset:s,endOffset:o}=n;if(s===0&&o!==Number.POSITIVE_INFINITY){const l=o-1;if(l<=0)return;n.endOffsetSubtitles=Math.max(0,l),this.tracksBuffered.forEach(u=>{for(let d=0;d<u.length;){if(u[d].end<=l){u.shift();continue}else if(u[d].start<l)u[d].start=l;else break;d++}}),this.fragmentTracker.removeFragmentsInRange(s,l,P.SUBTITLE)}}onError(t,n){const s=n.frag;(s==null?void 0:s.type)===P.SUBTITLE&&(n.details===q.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==pt.STOPPED&&(this.state=pt.IDLE))}onSubtitleTracksUpdated(t,{subtitleTracks:n}){if(this.levels&&nf(this.levels,n)){this.levels=n.map(s=>new Xn(s));return}this.tracksBuffered=[],this.levels=n.map(s=>{const o=new Xn(s);return this.tracksBuffered[o.id]=[],o}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,P.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(t,n){var s;if(this.currentTrackId=n.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const o=this.levels[this.currentTrackId];o!=null&&o.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,o&&this.state!==pt.STOPPED&&this.setInterval(th)}onSubtitleTrackLoaded(t,n){var s;const{currentTrackId:o,levels:l}=this,{details:u,id:d}=n;if(!l){this.warn(`Subtitle tracks were reset while loading level ${d}`);return}const _=l[d];if(d>=l.length||!_)return;this.log(`Subtitle track ${d} loaded [${u.startSN},${u.endSN}]${u.lastPartSn?`[part-${u.lastPartSn}-${u.lastPartIndex}]`:""},duration:${u.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let g=0;if(u.live||(s=_.details)!=null&&s.live){if(u.deltaUpdateFailed)return;const y=this.mainDetails;if(!y){this.startFragRequested=!1;return}const x=y.fragments[0];if(!_.details)u.hasProgramDateTime&&y.hasProgramDateTime?(gl(u,y),g=u.fragmentStart):x&&(g=x.start,Fo(u,g));else{var v;g=this.alignPlaylists(u,_.details,(v=this.levelLastLoaded)==null?void 0:v.details),g===0&&x&&(g=x.start,Fo(u,g))}y&&!this.startFragRequested&&this.setStartPosition(y,g)}_.details=u,this.levelLastLoaded=_,d===o&&(this.hls.trigger(S.SUBTITLE_TRACK_UPDATED,{details:u,id:d,groupId:n.groupId}),this.tick(),u.live&&!this.fragCurrent&&this.media&&this.state===pt.IDLE&&(Wi(null,u.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),_.details=void 0)))}_handleFragmentLoadComplete(t){const{frag:n,payload:s}=t,o=n.decryptdata,l=this.hls;if(!this.fragContextChanged(n)&&s&&s.byteLength>0&&o!=null&&o.key&&o.iv&&Pr(o.method)){const u=performance.now();this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer,Fs(o.method)).catch(d=>{throw l.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:n}),d}).then(d=>{const _=performance.now();l.trigger(S.FRAG_DECRYPTED,{frag:n,payload:d,stats:{tstart:u,tdecrypt:_}})}).catch(d=>{this.warn(`${d.name}: ${d.message}`),this.state=pt.IDLE})}}doTick(){if(!this.media){this.state=pt.IDLE;return}if(this.state===pt.IDLE){const{currentTrackId:t,levels:n}=this,s=n==null?void 0:n[t];if(!s||!n.length||!s.details||this.waitForLive(s))return;const{config:o}=this,l=this.getLoadPosition(),u=li.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],l,o.maxBufferHole),{end:d,len:_}=u,g=s.details,v=this.hls.maxBufferLength+g.levelTargetDuration;if(_>v)return;const y=g.fragments,x=y.length,D=g.edge;let C=null;const F=this.fragPrevious;if(d<D){const ne=o.maxFragLookUpTolerance,le=d>D-ne?0:ne;C=Wi(F,y,Math.max(y[0].start,d),le),!C&&F&&F.start<y[0].start&&(C=y[0])}else C=y[x-1];if(C=this.filterReplacedPrimary(C,s.details),!C)return;const B=C.sn-g.startSN,J=y[B-1];if(J&&J.cc===C.cc&&this.fragmentTracker.getState(J)===Oi.NOT_LOADED&&(C=J),this.fragmentTracker.getState(C)===Oi.NOT_LOADED){const ne=this.mapToInitFragWhenRequired(C);ne&&this.loadFragment(ne,s,d)}}}loadFragment(t,n,s){ze(t)?super.loadFragment(t,n,s):this._loadInitSegment(t,n)}get mediaBufferTimeRanges(){return new Ud(this.tracksBuffered[this.currentTrackId]||[])}}class Ud{constructor(t){this.buffered=void 0;const n=(s,o,l)=>{if(o=o>>>0,o>l-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${o}) is greater than the maximum bound (${l})`);return t[o][s]};this.buffered={get length(){return t.length},end(s){return n("end",s,t.length)},start(s){return n("start",s,t.length)}}}}const Ef={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},kf=h=>String.fromCharCode(Ef[h]||h),Us=15,ga=100,kn={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Hu={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Wu={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},zd={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Oa=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Tf{constructor(){this.time=null,this.verboseLevel=0}log(t,n){if(this.verboseLevel>=t){const s=typeof n=="function"?n():n;se.log(`${this.time} [${t}] ${s}`)}}}const Es=function(t){const n=[];for(let s=0;s<t.length;s++)n.push(t[s].toString(16));return n};class ih{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(t){const n=["foreground","underline","italics","background","flash"];for(let s=0;s<n.length;s++){const o=n[s];t.hasOwnProperty(o)&&(this[o]=t[o])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash}copy(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class rr{constructor(){this.uchar=" ",this.penState=new ih}reset(){this.uchar=" ",this.penState.reset()}setChar(t,n){this.uchar=t,this.penState.copy(n)}setPenState(t){this.penState.copy(t)}equals(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)}copy(t){this.uchar=t.uchar,this.penState.copy(t.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class Af{constructor(t){this.chars=[],this.pos=0,this.currPenState=new ih,this.cueStartTime=null,this.logger=void 0;for(let n=0;n<ga;n++)this.chars.push(new rr);this.logger=t}equals(t){for(let n=0;n<ga;n++)if(!this.chars[n].equals(t.chars[n]))return!1;return!0}copy(t){for(let n=0;n<ga;n++)this.chars[n].copy(t.chars[n])}isEmpty(){let t=!0;for(let n=0;n<ga;n++)if(!this.chars[n].isEmpty()){t=!1;break}return t}setCursor(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>ga&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=ga)}moveCursor(t){const n=this.pos+t;if(t>1)for(let s=this.pos+1;s<n+1;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(n)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(t){t>=144&&this.backSpace();const n=kf(t);if(this.pos>=ga){this.logger.log(0,()=>"Cannot insert "+t.toString(16)+" ("+n+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(n,this.currPenState),this.moveCursor(1)}clearFromPos(t){let n;for(n=t;n<ga;n++)this.chars[n].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const t=[];let n=!0;for(let s=0;s<ga;s++){const o=this.chars[s].uchar;o!==" "&&(n=!1),t.push(o)}return n?"":t.join("")}setPenStyles(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)}}class ju{constructor(t){this.rows=[],this.currRow=Us-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let n=0;n<Us;n++)this.rows.push(new Af(t));this.logger=t}reset(){for(let t=0;t<Us;t++)this.rows[t].clear();this.currRow=Us-1}equals(t){let n=!0;for(let s=0;s<Us;s++)if(!this.rows[s].equals(t.rows[s])){n=!1;break}return n}copy(t){for(let n=0;n<Us;n++)this.rows[n].copy(t.rows[n])}isEmpty(){let t=!0;for(let n=0;n<Us;n++)if(!this.rows[n].isEmpty()){t=!1;break}return t}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(t){this.rows[this.currRow].insertChar(t)}setPen(t){this.rows[this.currRow].setPenStyles(t)}moveCursor(t){this.rows[this.currRow].moveCursor(t)}setCursor(t){this.logger.log(2,"setCursor: "+t),this.rows[this.currRow].setCursor(t)}setPAC(t){this.logger.log(2,()=>"pacData = "+$e(t));let n=t.row-1;if(this.nrRollUpRows&&n<this.nrRollUpRows-1&&(n=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==n){for(let d=0;d<Us;d++)this.rows[d].clear();const l=this.currRow+1-this.nrRollUpRows,u=this.lastOutputScreen;if(u){const d=u.rows[l].cueStartTime,_=this.logger.time;if(d!==null&&_!==null&&d<_)for(let g=0;g<this.nrRollUpRows;g++)this.rows[n-this.nrRollUpRows+g+1].copy(u.rows[l+g])}}this.currRow=n;const s=this.rows[this.currRow];if(t.indent!==null){const l=t.indent,u=Math.max(l-1,0);s.setCursor(t.indent),t.color=s.chars[u].penState.foreground}const o={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(o)}setBkgData(t){this.logger.log(2,()=>"bkgData = "+$e(t)),this.backSpace(),this.setPen(t),this.insertChar(32)}setRollUpRows(t){this.nrRollUpRows=t}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const t=this.currRow+1-this.nrRollUpRows,n=this.rows.splice(t,1)[0];n.clear(),this.rows.splice(this.currRow,0,n),this.logger.log(2,"Rolling up")}getDisplayText(t){t=t||!1;const n=[];let s="",o=-1;for(let l=0;l<Us;l++){const u=this.rows[l].getTextString();u&&(o=l+1,t?n.push("Row "+o+": '"+u+"'"):n.push(u.trim()))}return n.length>0&&(t?s="["+n.join(" | ")+"]":s=n.join(`
|
|
|
`)),s}getTextAndFormat(){return this.rows}}class Lf{constructor(t,n,s){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=t,this.outputFilter=n,this.mode=null,this.verbose=0,this.displayedMemory=new ju(s),this.nonDisplayedMemory=new ju(s),this.lastOutputScreen=new ju(s),this.currRollUpRow=this.displayedMemory.rows[Us-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Us-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(t){this.outputFilter=t}setPAC(t){this.writeScreen.setPAC(t)}setBkgData(t){this.writeScreen.setBkgData(t)}setMode(t){t!==this.mode&&(this.mode=t,this.logger.log(2,()=>"MODE="+t),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=t)}insertChars(t){for(let s=0;s<t.length;s++)this.writeScreen.insertChar(t[s]);const n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>n+": "+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(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}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 t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}ccMIDROW(t){const n={flash:!1};if(n.underline=t%2===1,n.italics=t>=46,n.italics)n.foreground="white";else{const s=Math.floor(t/2)-16,o=["white","green","blue","cyan","red","yellow","magenta"];n.foreground=o[s]}this.logger.log(2,"MIDROW: "+$e(n)),this.writeScreen.setPen(n)}outputDataUpdate(t=!1){const n=this.logger.time;n!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=n:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,n,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:n),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}class nh{constructor(t,n,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Df(),this.logger=void 0;const o=this.logger=new Tf;this.channels=[null,new Lf(t,n,o),new Lf(t+1,s,o)]}getHandler(t){return this.channels[t].getHandler()}setHandler(t,n){this.channels[t].setHandler(n)}addData(t,n){this.logger.time=t;for(let s=0;s<n.length;s+=2){const o=n[s]&127,l=n[s+1]&127;let u=!1,d=null;if(o===0&&l===0)continue;this.logger.log(3,()=>"["+Es([n[s],n[s+1]])+"] -> ("+Es([o,l])+")");const _=this.cmdHistory;if(o>=16&&o<=31){if(el(o,l,_)){_o(null,null,_),this.logger.log(3,()=>"Repeated command ("+Es([o,l])+") is dropped");continue}_o(o,l,this.cmdHistory),u=this.parseCmd(o,l),u||(u=this.parseMidrow(o,l)),u||(u=this.parsePAC(o,l)),u||(u=this.parseBackgroundAttributes(o,l))}else _o(null,null,_);if(!u&&(d=this.parseChars(o,l),d)){const v=this.currentChannel;v&&v>0?this.channels[v].insertChars(d):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!u&&!d&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Es([o,l])+" orig: "+Es([n[s],n[s+1]]))}}parseCmd(t,n){const s=(t===20||t===28||t===21||t===29)&&n>=32&&n<=47,o=(t===23||t===31)&&n>=33&&n<=35;if(!(s||o))return!1;const l=t===20||t===21||t===23?1:2,u=this.channels[l];return t===20||t===21||t===28||t===29?n===32?u.ccRCL():n===33?u.ccBS():n===34?u.ccAOF():n===35?u.ccAON():n===36?u.ccDER():n===37?u.ccRU(2):n===38?u.ccRU(3):n===39?u.ccRU(4):n===40?u.ccFON():n===41?u.ccRDC():n===42?u.ccTR():n===43?u.ccRTD():n===44?u.ccEDM():n===45?u.ccCR():n===46?u.ccENM():n===47&&u.ccEOC():u.ccTO(n-32),this.currentChannel=l,!0}parseMidrow(t,n){let s=0;if((t===17||t===25)&&n>=32&&n<=47){if(t===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const o=this.channels[s];return o?(o.ccMIDROW(n),this.logger.log(3,()=>"MIDROW ("+Es([t,n])+")"),!0):!1}return!1}parsePAC(t,n){let s;const o=(t>=17&&t<=23||t>=25&&t<=31)&&n>=64&&n<=127,l=(t===16||t===24)&&n>=64&&n<=95;if(!(o||l))return!1;const u=t<=23?1:2;n>=64&&n<=95?s=u===1?kn[t]:Wu[t]:s=u===1?Hu[t]:zd[t];const d=this.channels[u];return d?(d.setPAC(this.interpretPAC(s,n)),this.currentChannel=u,!0):!1}interpretPAC(t,n){let s;const o={color:null,italics:!1,indent:null,underline:!1,row:t};return n>95?s=n-96:s=n-64,o.underline=(s&1)===1,s<=13?o.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(o.italics=!0,o.color="white"):o.indent=Math.floor((s-16)/2)*4,o}parseChars(t,n){let s,o=null,l=null;if(t>=25?(s=2,l=t-8):(s=1,l=t),l>=17&&l<=19){let u;l===17?u=n+80:l===18?u=n+112:u=n+144,this.logger.log(2,()=>"Special char '"+kf(u)+"' in channel "+s),o=[u]}else t>=32&&t<=127&&(o=n===0?[t]:[t,n]);return o&&this.logger.log(3,()=>"Char codes = "+Es(o).join(",")),o}parseBackgroundAttributes(t,n){const s=(t===16||t===24)&&n>=32&&n<=47,o=(t===23||t===31)&&n>=45&&n<=47;if(!(s||o))return!1;let l;const u={};t===16||t===24?(l=Math.floor((n-32)/2),u.background=Oa[l],n%2===1&&(u.background=u.background+"_semi")):n===45?u.background="transparent":(u.foreground="black",n===47&&(u.underline=!0));const d=t<=23?1:2;return this.channels[d].setBkgData(u),!0}reset(){for(let t=0;t<Object.keys(this.channels).length;t++){const n=this.channels[t];n&&n.reset()}_o(null,null,this.cmdHistory)}cueSplitAtTime(t){for(let n=0;n<this.channels.length;n++){const s=this.channels[n];s&&s.cueSplitAtTime(t)}}}function _o(h,t,n){n.a=h,n.b=t}function el(h,t,n){return n.a===h&&n.b===t}function Df(){return{a:null,b:null}}var Br=function(){if(Sn!=null&&Sn.VTTCue)return self.VTTCue;const h=["","lr","rl"],t=["start","middle","end","left","right"];function n(d,_){if(typeof _!="string"||!Array.isArray(d))return!1;const g=_.toLowerCase();return~d.indexOf(g)?g:!1}function s(d){return n(h,d)}function o(d){return n(t,d)}function l(d,..._){let g=1;for(;g<arguments.length;g++){const v=arguments[g];for(const y in v)d[y]=v[y]}return d}function u(d,_,g){const v=this,y={enumerable:!0};v.hasBeenReset=!1;let x="",D=!1,C=d,F=_,B=g,J=null,ne="",le=!0,Ee="auto",Ie="start",tt=50,Pe="middle",Ye=50,qe="middle";Object.defineProperty(v,"id",l({},y,{get:function(){return x},set:function(Fe){x=""+Fe}})),Object.defineProperty(v,"pauseOnExit",l({},y,{get:function(){return D},set:function(Fe){D=!!Fe}})),Object.defineProperty(v,"startTime",l({},y,{get:function(){return C},set:function(Fe){if(typeof Fe!="number")throw new TypeError("Start time must be set to a number.");C=Fe,this.hasBeenReset=!0}})),Object.defineProperty(v,"endTime",l({},y,{get:function(){return F},set:function(Fe){if(typeof Fe!="number")throw new TypeError("End time must be set to a number.");F=Fe,this.hasBeenReset=!0}})),Object.defineProperty(v,"text",l({},y,{get:function(){return B},set:function(Fe){B=""+Fe,this.hasBeenReset=!0}})),Object.defineProperty(v,"region",l({},y,{get:function(){return J},set:function(Fe){J=Fe,this.hasBeenReset=!0}})),Object.defineProperty(v,"vertical",l({},y,{get:function(){return ne},set:function(Fe){const mt=s(Fe);if(mt===!1)throw new SyntaxError("An invalid or illegal string was specified.");ne=mt,this.hasBeenReset=!0}})),Object.defineProperty(v,"snapToLines",l({},y,{get:function(){return le},set:function(Fe){le=!!Fe,this.hasBeenReset=!0}})),Object.defineProperty(v,"line",l({},y,{get:function(){return Ee},set:function(Fe){if(typeof Fe!="number"&&Fe!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Ee=Fe,this.hasBeenReset=!0}})),Object.defineProperty(v,"lineAlign",l({},y,{get:function(){return Ie},set:function(Fe){const mt=o(Fe);if(!mt)throw new SyntaxError("An invalid or illegal string was specified.");Ie=mt,this.hasBeenReset=!0}})),Object.defineProperty(v,"position",l({},y,{get:function(){return tt},set:function(Fe){if(Fe<0||Fe>100)throw new Error("Position must be between 0 and 100.");tt=Fe,this.hasBeenReset=!0}})),Object.defineProperty(v,"positionAlign",l({},y,{get:function(){return Pe},set:function(Fe){const mt=o(Fe);if(!mt)throw new SyntaxError("An invalid or illegal string was specified.");Pe=mt,this.hasBeenReset=!0}})),Object.defineProperty(v,"size",l({},y,{get:function(){return Ye},set:function(Fe){if(Fe<0||Fe>100)throw new Error("Size must be between 0 and 100.");Ye=Fe,this.hasBeenReset=!0}})),Object.defineProperty(v,"align",l({},y,{get:function(){return qe},set:function(Fe){const mt=o(Fe);if(!mt)throw new SyntaxError("An invalid or illegal string was specified.");qe=mt,this.hasBeenReset=!0}})),v.displayState=void 0}return u.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},u}();class Cf{decode(t,n){if(!t)return"";if(typeof t!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function rh(h){function t(s,o,l,u){return(s|0)*3600+(o|0)*60+(l|0)+parseFloat(u||0)}const n=h.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?t(n[2],n[3],0,n[4]):t(n[1],n[2],n[3],n[4]):null}class Et{constructor(){this.values=Object.create(null)}set(t,n){!this.get(t)&&n!==""&&(this.values[t]=n)}get(t,n,s){return s?this.has(t)?this.values[t]:n[s]:this.has(t)?this.values[t]:n}has(t){return t in this.values}alt(t,n,s){for(let o=0;o<s.length;++o)if(n===s[o]){this.set(t,n);break}}integer(t,n){/^-?\d+$/.test(n)&&this.set(t,parseInt(n,10))}percent(t,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){const s=parseFloat(n);if(s>=0&&s<=100)return this.set(t,s),!0}return!1}}function Hn(h,t,n,s){const o=s?h.split(s):[h];for(const l in o){if(typeof o[l]!="string")continue;const u=o[l].split(n);if(u.length!==2)continue;const d=u[0],_=u[1];t(d,_)}}const Mf=new Br(0,0,""),sh=Mf.align==="middle"?"middle":"center";function If(h,t,n){const s=h;function o(){const d=rh(h);if(d===null)throw new Error("Malformed timestamp: "+s);return h=h.replace(/^[^\sa-zA-Z-]+/,""),d}function l(d,_){const g=new Et;Hn(d,function(x,D){let C;switch(x){case"region":for(let F=n.length-1;F>=0;F--)if(n[F].id===D){g.set(x,n[F].region);break}break;case"vertical":g.alt(x,D,["rl","lr"]);break;case"line":C=D.split(","),g.integer(x,C[0]),g.percent(x,C[0])&&g.set("snapToLines",!1),g.alt(x,C[0],["auto"]),C.length===2&&g.alt("lineAlign",C[1],["start",sh,"end"]);break;case"position":C=D.split(","),g.percent(x,C[0]),C.length===2&&g.alt("positionAlign",C[1],["start",sh,"end","line-left","line-right","auto"]);break;case"size":g.percent(x,D);break;case"align":g.alt(x,D,["start",sh,"end","left","right"]);break}},/:/,/\s/),_.region=g.get("region",null),_.vertical=g.get("vertical","");let v=g.get("line","auto");v==="auto"&&Mf.line===-1&&(v=-1),_.line=v,_.lineAlign=g.get("lineAlign","start"),_.snapToLines=g.get("snapToLines",!0),_.size=g.get("size",100),_.align=g.get("align",sh);let y=g.get("position","auto");y==="auto"&&Mf.position===50&&(y=_.align==="start"||_.align==="left"?0:_.align==="end"||_.align==="right"?100:50),_.position=y}function u(){h=h.replace(/^\s+/,"")}if(u(),t.startTime=o(),u(),h.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);h=h.slice(3),u(),t.endTime=o(),u(),l(h,t)}function ah(h){return h.replace(/<br(?: \/)?>/gi,`
|
|
|
`)}class Pl{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Cf,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(t){const n=this;t&&(n.buffer+=n.decoder.decode(t,{stream:!0}));function s(){let l=n.buffer,u=0;for(l=ah(l);u<l.length&&l[u]!=="\r"&&l[u]!==`
|
|
|
`;)++u;const d=l.slice(0,u);return l[u]==="\r"&&++u,l[u]===`
|
|
|
`&&++u,n.buffer=l.slice(u),d}function o(l){Hn(l,function(u,d){},/:/)}try{let l="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;l=s();const d=l.match(/^()?WEBVTT([ \t].*)?$/);if(!(d!=null&&d[0]))throw new Error("Malformed WebVTT signature.");n.state="HEADER"}let u=!1;for(;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;switch(u?u=!1:l=s(),n.state){case"HEADER":/:/.test(l)?o(l):l||(n.state="ID");continue;case"NOTE":l||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){n.state="NOTE";break}if(!l)continue;if(n.cue=new Br(0,0,""),n.state="CUE",l.indexOf("-->")===-1){n.cue.id=l;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{If(l,n.cue,n.regionList)}catch(d){n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{const d=l.indexOf("-->")!==-1;if(!l||d&&(u=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
|
|
|
`),n.cue.text+=l}continue;case"BADCUE":l||(n.state="ID")}}}catch(l){n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const t=this;try{if((t.cue||t.state==="HEADER")&&(t.buffer+=`
|
|
|
|
|
|
`,t.parse()),t.state==="INITIAL"||t.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(n){t.onparsingerror&&t.onparsingerror(n)}return t.onflush&&t.onflush(),this}}const qu=/\r\n|\n\r|\n|\r/g,oh=function(t,n,s=0){return t.slice(s,s+n.length)===n},Vd=function(t){let n=parseInt(t.slice(-3));const s=parseInt(t.slice(-6,-4)),o=parseInt(t.slice(-9,-7)),l=t.length>9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!ce(n)||!ce(s)||!ce(o)||!ce(l))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${t}`);return n+=1e3*s,n+=60*1e3*o,n+=60*60*1e3*l,n};function Zu(h,t,n){return Jo(h.toString())+Jo(t.toString())+Jo(n)}const tl=function(t,n,s){let o=t[n],l=t[o.prevCC];if(!l||!l.new&&o.new){t.ccOffset=t.presentationOffset=o.start,o.new=!1;return}for(;(u=l)!=null&&u.new;){var u;t.ccOffset+=o.start-l.start,o.new=!1,o=l,l=t[o.prevCC]}t.presentationOffset=s};function Ir(h,t,n,s,o,l,u){const d=new Pl,_=At(new Uint8Array(h)).trim().replace(qu,`
|
|
|
`).split(`
|
|
|
`),g=[],v=t?Qt(t.baseTime,t.timescale):0;let y="00:00.000",x=0,D=0,C,F=!0;d.oncue=function(B){const J=n[s];let ne=n.ccOffset;const le=(x-v)/9e4;if(J!=null&&J.new&&(D!==void 0?ne=n.ccOffset=J.start:tl(n,s,le)),le){if(!t){C=new Error("Missing initPTS for VTT MPEGTS");return}ne=le-n.presentationOffset}const Ee=B.endTime-B.startTime,Ie=pr((B.startTime+ne-D)*9e4,o*9e4)/9e4;B.startTime=Math.max(Ie,0),B.endTime=Math.max(Ie+Ee,0);const tt=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(tt)),B.id||(B.id=Zu(B.startTime,B.endTime,tt)),B.endTime>0&&g.push(B)},d.onparsingerror=function(B){C=B},d.onflush=function(){if(C){u(C);return}l(g)},_.forEach(B=>{if(F)if(oh(B,"X-TIMESTAMP-MAP=")){F=!1,B.slice(16).split(",").forEach(J=>{oh(J,"LOCAL:")?y=J.slice(6):oh(J,"MPEGTS:")&&(x=parseInt(J.slice(7)))});try{D=Vd(y)/1e3}catch(J){C=J}return}else B===""&&(F=!1);d.parse(B+`
|
|
|
`)}),d.flush()}const vo="stpp.ttml.im1t",Yu=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Fa=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Ps={left:"start",center:"center",right:"end",start:"start",end:"end"};function Rf(h,t,n,s){const o=ve(new Uint8Array(h),["mdat"]);if(o.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const l=o.map(d=>At(d)),u=Xh(t.baseTime,1,t.timescale);try{l.forEach(d=>n(Ol(d,u)))}catch(d){s(d)}}function Ol(h,t){const o=new DOMParser().parseFromString(h,"text/xml").getElementsByTagName("tt")[0];if(!o)throw new Error("Invalid ttml");const l={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},u=Object.keys(l).reduce((y,x)=>(y[x]=o.getAttribute(`ttp:${x}`)||l[x],y),{}),d=o.getAttribute("xml:space")!=="preserve",_=lh(yo(o,"styling","style")),g=lh(yo(o,"layout","region")),v=yo(o,"body","[begin]");return[].map.call(v,y=>{const x=Pf(y,d);if(!x||!y.hasAttribute("begin"))return null;const D=ch(y.getAttribute("begin"),u),C=ch(y.getAttribute("dur"),u);let F=ch(y.getAttribute("end"),u);if(D===null)throw Of(y);if(F===null){if(C===null)throw Of(y);F=D+C}const B=new Br(D-t,F-t,x);B.id=Zu(B.startTime,B.endTime,B.text);const J=g[y.getAttribute("region")],ne=_[y.getAttribute("style")],le=Xu(J,ne,_),{textAlign:Ee}=le;if(Ee){const Ie=Ps[Ee];Ie&&(B.lineAlign=Ie),B.align=Ee}return k(B,le),B}).filter(y=>y!==null)}function yo(h,t,n){const s=h.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(n)):[]}function lh(h){return h.reduce((t,n)=>{const s=n.getAttribute("xml:id");return s&&(t[s]=n),t},{})}function Pf(h,t){return[].slice.call(h.childNodes).reduce((n,s,o)=>{var l;return s.nodeName==="br"&&o?n+`
|
|
|
`:(l=s.childNodes)!=null&&l.length?Pf(s,t):t?n+s.textContent.trim().replace(/\s+/g," "):n+s.textContent},"")}function Xu(h,t,n){const s="http://www.w3.org/ns/ttml#styling";let o=null;const l=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],u=h!=null&&h.hasAttribute("style")?h.getAttribute("style"):null;return u&&n.hasOwnProperty(u)&&(o=n[u]),l.reduce((d,_)=>{const g=uh(t,s,_)||uh(h,s,_)||uh(o,s,_);return g&&(d[_]=g),d},{})}function uh(h,t,n){return h&&h.hasAttributeNS(t,n)?h.getAttributeNS(t,n):null}function Of(h){return new Error(`Could not parse ttml timestamp ${h}`)}function ch(h,t){if(!h)return null;let n=rh(h);return n===null&&(Yu.test(h)?n=Fl(h,t):Fa.test(h)&&(n=Bl(h,t))),n}function Fl(h,t){const n=Yu.exec(h),s=(n[4]|0)+(n[5]|0)/t.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+s/t.frameRate}function Bl(h,t){const n=Fa.exec(h),s=Number(n[1]);switch(n[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/t.frameRate;case"t":return s/t.tickRate}return s}class il{constructor(t,n){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=n}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(t,n,s){(this.startTime===null||this.startTime>t)&&(this.startTime=t),this.endTime=n,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class bo{constructor(t){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=Ju(),this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.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}},t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(S.FRAG_LOADING,this.onFragLoading,this),t.on(S.FRAG_LOADED,this.onFragLoaded,this),t.on(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(S.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:t}=this;t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(S.FRAG_LOADING,this.onFragLoading,this),t.off(S.FRAG_LOADED,this.onFragLoaded,this),t.off(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(S.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const t=new il(this,"textTrack1"),n=new il(this,"textTrack2"),s=new il(this,"textTrack3"),o=new il(this,"textTrack4");this.cea608Parser1=new nh(1,t,n),this.cea608Parser2=new nh(3,s,o)}addCues(t,n,s,o,l){let u=!1;for(let d=l.length;d--;){const _=l[d],g=Bf(_[0],_[1],n,s);if(g>=0&&(_[0]=Math.min(_[0],n),_[1]=Math.max(_[1],s),u=!0,g/(s-n)>.5))return}if(u||l.push([n,s]),this.config.renderTextTracksNatively){const d=this.captionsTracks[t];this.Cues.newCue(d,n,s,o)}else{const d=this.Cues.newCue(null,n,s,o);this.hls.trigger(S.CUES_PARSED,{type:"captions",cues:d,track:t})}}onInitPtsFound(t,{frag:n,id:s,initPTS:o,timescale:l,trackId:u}){const{unparsedVttFrags:d}=this;s===P.MAIN&&(this.initPTS[n.cc]={baseTime:o,timescale:l,trackId:u}),d.length&&(this.unparsedVttFrags=[],d.forEach(_=>{this.initPTS[_.frag.cc]?this.onFragLoaded(S.FRAG_LOADED,_):this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:_.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(t,n){const{media:s}=this;if(s)for(let o=0;o<s.textTracks.length;o++){const l=s.textTracks[o];if(Ff(l,{name:t,lang:n,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return l}return null}createCaptionsTrack(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)}createNativeTrack(t){if(this.captionsTracks[t])return;const{captionsProperties:n,captionsTracks:s,media:o}=this,{label:l,languageCode:u}=n[t],d=this.getExistingTrack(l,u);if(d)s[t]=d,ds(s[t]),fo(s[t],o);else{const _=this.createTextTrack("captions",l,u);_&&(_[t]=!0,s[t]=_)}}createNonNativeTrack(t){if(this.nonNativeCaptionsTracks[t])return;const n=this.captionsProperties[t];if(!n)return;const s=n.label,o={_id:t,label:s,kind:"captions",default:n.media?!!n.media.default:!1,closedCaptions:n.media};this.nonNativeCaptionsTracks[t]=o,this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[o]})}createTextTrack(t,n,s){const o=this.media;if(o)return o.addTextTrack(t,n,s)}onMediaAttaching(t,n){this.media=n.media,n.mediaSource||this._cleanTracks()}onMediaDetaching(t,n){const s=!!n.transferMedia;if(this.media=null,s)return;const{captionsTracks:o}=this;Object.keys(o).forEach(l=>{ds(o[l]),delete o[l]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Ju(),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:t}=this;if(!t)return;const n=t.textTracks;if(n)for(let s=0;s<n.length;s++)ds(n[s])}onSubtitleTracksUpdated(t,n){const s=n.subtitleTracks||[],o=s.some(l=>l.textCodec===vo);if(this.config.enableWebVTT||o&&this.config.enableIMSC1){if(nf(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const u=this.media,d=u?po(u.textTracks):null;if(this.tracks.forEach((_,g)=>{let v;if(d){let y=null;for(let x=0;x<d.length;x++)if(d[x]&&Ff(d[x],_)){y=d[x],d[x]=null;break}y&&(v=y)}if(v)ds(v);else{const y=_a(_);v=this.createTextTrack(y,_.name,_.lang),v&&(v.mode="disabled")}v&&this.textTracks.push(v)}),d!=null&&d.length){const _=d.filter(g=>g!==null).map(g=>g.label);_.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${_.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const u=this.tracks.map(d=>({label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}));this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:u})}}}onManifestLoaded(t,n){this.config.enableCEA708Captions&&n.captions&&n.captions.forEach(s=>{const o=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!o)return;const l=`textTrack${o[1]}`,u=this.captionsProperties[l];u&&(u.label=s.name,s.lang&&(u.languageCode=s.lang),u.media=s)})}closedCaptionsForLevel(t){const n=this.hls.levels[t.level];return n==null?void 0:n.attrs["CLOSED-CAPTIONS"]}onFragLoading(t,n){if(this.enabled&&n.frag.type===P.MAIN){var s,o;const{cea608Parser1:l,cea608Parser2:u,lastSn:d}=this,{cc:_,sn:g}=n.frag,v=(s=(o=n.part)==null?void 0:o.index)!=null?s:-1;l&&u&&(g!==d+1||g===d&&v!==this.lastPartIndex+1||_!==this.lastCc)&&(l.reset(),u.reset()),this.lastCc=_,this.lastSn=g,this.lastPartIndex=v}}onFragLoaded(t,n){const{frag:s,payload:o}=n;if(s.type===P.SUBTITLE)if(o.byteLength){const l=s.decryptdata,u="stats"in n;if(l==null||!l.encrypted||u){const d=this.tracks[s.level],_=this.vttCCs;_[s.cc]||(_[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),d&&d.textCodec===vo?this._parseIMSC1(s,o):this._parseVTTs(n)}}else this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(t,n){const s=this.hls;Rf(n,this.initPTS[t.cc],o=>{this._appendCues(o,t.level),s.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},o=>{s.logger.log(`Failed to parse IMSC1: ${o}`),s.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:o})})}_parseVTTs(t){var n;const{frag:s,payload:o}=t,{initPTS:l,unparsedVttFrags:u}=this,d=l.length-1;if(!l[s.cc]&&d===-1){u.push(t);return}const _=this.hls,g=(n=s.initSegment)!=null&&n.data?Pt(s.initSegment.data,new Uint8Array(o)).buffer:o;Ir(g,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,v=>{this._appendCues(v,s.level),_.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},v=>{const y=v.message==="Missing initPTS for VTT MPEGTS";y?u.push(t):this._fallbackToIMSC1(s,o),_.logger.log(`Failed to parse VTT cue: ${v}`),!(y&&d>s.cc)&&_.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:v})})}_fallbackToIMSC1(t,n){const s=this.tracks[t.level];s.textCodec||Rf(n,this.initPTS[t.cc],()=>{s.textCodec=vo,this._parseIMSC1(t,n)},()=>{s.textCodec="wvtt"})}_appendCues(t,n){const s=this.hls;if(this.config.renderTextTracksNatively){const o=this.textTracks[n];if(!o||o.mode==="disabled")return;t.forEach(l=>Js(o,l))}else{const o=this.tracks[n];if(!o)return;const l=o.default?"default":"subtitles"+n;s.trigger(S.CUES_PARSED,{type:"subtitles",cues:t,track:l})}}onFragDecrypted(t,n){const{frag:s}=n;s.type===P.SUBTITLE&&this.onFragLoaded(S.FRAG_LOADED,n)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(t,n){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:s,samples:o}=n;if(!(s.type===P.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let l=0;l<o.length;l++){const u=o[l].bytes;if(u){this.cea608Parser1||this.initCea608Parsers();const d=this.extractCea608Data(u);this.cea608Parser1.addData(o[l].pts,d[0]),this.cea608Parser2.addData(o[l].pts,d[1])}}}onBufferFlushing(t,{startOffset:n,endOffset:s,endOffsetSubtitles:o,type:l}){const{media:u}=this;if(!(!u||u.currentTime<s)){if(!l||l==="video"){const{captionsTracks:d}=this;Object.keys(d).forEach(_=>Qs(d[_],n,s))}if(this.config.renderTextTracksNatively&&n===0&&o!==void 0){const{textTracks:d}=this;Object.keys(d).forEach(_=>Qs(d[_],n,o))}}}extractCea608Data(t){const n=[[],[]],s=t[0]&31;let o=2;for(let l=0;l<s;l++){const u=t[o++],d=127&t[o++],_=127&t[o++];if(d===0&&_===0)continue;if((4&u)!==0){const v=3&u;(v===0||v===1)&&(n[v].push(d),n[v].push(_))}}return n}}function _a(h){return h.characteristics&&/transcribes-spoken-dialog/gi.test(h.characteristics)&&/describes-music-and-sound/gi.test(h.characteristics)?"captions":"subtitles"}function Ff(h,t){return!!h&&h.kind===_a(t)&&jo(t,h)}function Bf(h,t,n,s){return Math.min(t,s)-Math.max(h,n)}function Ju(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const Nf=/\s/,Gd={newCue(h,t,n,s){const o=[];let l,u,d,_,g;const v=self.VTTCue||self.TextTrackCue;for(let x=0;x<s.rows.length;x++)if(l=s.rows[x],d=!0,_=0,g="",!l.isEmpty()){var y;for(let F=0;F<l.chars.length;F++)Nf.test(l.chars[F].uchar)&&d?_++:(g+=l.chars[F].uchar,d=!1);l.cueStartTime=t,t===n&&(n+=1e-4),_>=16?_--:_++;const D=ah(g.trim()),C=Zu(t,n,D);h!=null&&(y=h.cues)!=null&&y.getCueById(C)||(u=new v(t,n,D),u.id=C,u.line=x+1,u.align="left",u.position=10+Math.min(80,Math.floor(_*8/32)*10),o.push(u))}return h&&o.length&&(o.sort((x,D)=>x.line==="auto"||D.line==="auto"?0:x.line>8&&D.line>8?D.line-x.line:x.line-D.line),o.forEach(x=>Js(h,x))),o}};function Hd(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}const Wd=/(\d+)-(\d+)\/(\d+)/;class $f{constructor(t){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=t.fetchSetup||Zd,this.controller=new self.AbortController,this.stats=new L}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 t;this.abortInternal(),(t=this.callbacks)!=null&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(t,n,s){const o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();const l=jd(t,this.controller.signal),u=t.responseType==="arraybuffer",d=u?"byteLength":"length",{maxTimeToFirstByteMs:_,maxLoadTimeMs:g}=n.loadPolicy;this.context=t,this.config=n,this.callbacks=s,this.request=this.fetchSetup(t,l),self.clearTimeout(this.requestTimeout),n.timeout=_&&ce(_)?_:g,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(o,t,this.response))},n.timeout),(wl(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(y=>{var x;this.response=this.loader=y;const D=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(this.requestTimeout),n.timeout=g,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(o,t,this.response))},g-(D-o.loading.start)),!y.ok){const{status:F,statusText:B}=y;throw new Yd(B||"fetch, bad network response",F,y)}o.loading.first=D,o.total=qd(y.headers)||o.total;const C=(x=this.callbacks)==null?void 0:x.onProgress;return C&&ce(n.highWaterMark)?this.loadProgressively(y,o,t,n.highWaterMark,C):u?y.arrayBuffer():t.responseType==="json"?y.json():y.text()}).then(y=>{var x,D;const C=this.response;if(!C)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);const F=y[d];F&&(o.loaded=o.total=F);const B={url:C.url,data:y,code:C.status},J=(x=this.callbacks)==null?void 0:x.onProgress;J&&!ce(n.highWaterMark)&&J(o,t,y,C),(D=this.callbacks)==null||D.onSuccess(B,o,t,C)}).catch(y=>{var x;if(self.clearTimeout(this.requestTimeout),o.aborted)return;const D=y&&y.code||0,C=y?y.message:null;(x=this.callbacks)==null||x.onError({code:D,text:C},t,y?y.details:null,o)})}getCacheAge(){let t=null;if(this.response){const n=this.response.headers.get("age");t=n?parseFloat(n):null}return t}getResponseHeader(t){return this.response?this.response.headers.get(t):null}loadProgressively(t,n,s,o=0,l){const u=new gc,d=t.body.getReader(),_=()=>d.read().then(g=>{if(g.done)return u.dataLength&&l(n,s,u.flush().buffer,t),Promise.resolve(new ArrayBuffer(0));const v=g.value,y=v.length;return n.loaded+=y,y<o||u.dataLength?(u.push(v),u.dataLength>=o&&l(n,s,u.flush().buffer,t)):l(n,s,v.buffer,t),_()}).catch(()=>Promise.reject());return _()}}function jd(h,t){const n={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(k({},h.headers))};return h.rangeEnd&&n.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),n}function Kf(h){const t=Wd.exec(h);if(t)return parseInt(t[2])-parseInt(t[1])+1}function qd(h){const t=h.get("Content-Range");if(t){const s=Kf(t);if(ce(s))return s}const n=h.get("Content-Length");if(n)return parseInt(n)}function Zd(h,t){return new self.Request(h.url,t)}class Yd extends Error{constructor(t,n,s){super(t),this.code=void 0,this.details=void 0,this.code=n,this.details=s}}const Xd=/^age:\s*[\d.]+\s*$/im;class Uf{constructor(t){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=t&&t.xhrSetup||null,this.stats=new L,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,t.readyState!==4&&(this.stats.aborted=!0,t.abort()))}abort(){var t;this.abortInternal(),(t=this.callbacks)!=null&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(t,n,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=n,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:t,context:n}=this;if(!t||!n)return;const s=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0,o.aborted=!1;const l=this.xhrSetup;l?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return l(s,n.url)}).catch(u=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",n.url,!0),l(s,n.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,n,t)}).catch(u=>{var d;(d=this.callbacks)==null||d.onError({code:s.status,text:u.message},n,s,o)}):this.openAndSendXhr(s,n,t)}openAndSendXhr(t,n,s){t.readyState||t.open("GET",n.url,!0);const o=n.headers,{maxTimeToFirstByteMs:l,maxLoadTimeMs:u}=s.loadPolicy;if(o)for(const d in o)t.setRequestHeader(d,o[d]);n.rangeEnd&&t.setRequestHeader("Range","bytes="+n.rangeStart+"-"+(n.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=n.responseType,self.clearTimeout(this.requestTimeout),s.timeout=l&&ce(l)?l:u,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),t.send()}readystatechange(){const{context:t,loader:n,stats:s}=this;if(!t||!n)return;const o=n.readyState,l=this.config;if(!s.aborted&&o>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),l.timeout!==l.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),l.timeout=l.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),l.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),o===4)){self.clearTimeout(this.requestTimeout),n.onreadystatechange=null,n.onprogress=null;const g=n.status,v=n.responseType==="text"?n.responseText:null;if(g>=200&&g<300){const C=v!=null?v:n.response;if(C!=null){var u,d;s.loading.end=Math.max(self.performance.now(),s.loading.first);const F=n.responseType==="arraybuffer"?C.byteLength:C.length;s.loaded=s.total=F,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const B=(u=this.callbacks)==null?void 0:u.onProgress;B&&B(s,t,C,n);const J={url:n.responseURL,data:C,code:g};(d=this.callbacks)==null||d.onSuccess(J,s,t,n);return}}const y=l.loadPolicy.errorRetry,x=s.retry,D={url:t.url,data:void 0,code:g};if(Wn(y,x,!1,D))this.retry(y);else{var _;se.error(`${g} while loading ${t.url}`),(_=this.callbacks)==null||_.onError({code:g,text:n.statusText},t,n,s)}}}loadtimeout(){if(!this.config)return;const t=this.config.loadPolicy.timeoutRetry,n=this.stats.retry;if(Wn(t,n,!0))this.retry(t);else{var s;se.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const o=this.callbacks;o&&(this.abortInternal(),o.onTimeout(this.stats,this.context,this.loader))}}retry(t){const{context:n,stats:s}=this;this.retryDelay=vn(t,s.retry),s.retry++,se.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${n==null?void 0:n.url}, retrying ${s.retry}/${t.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(t){const n=this.stats;n.loaded=t.loaded,t.lengthComputable&&(n.total=t.total)}getCacheAge(){let t=null;if(this.loader&&Xd.test(this.loader.getAllResponseHeaders())){const n=this.loader.getResponseHeader("age");t=n?parseFloat(n):null}return t}getResponseHeader(t){return this.loader&&new RegExp(`^${t}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null}}const zf={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Jd=M(M({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:Uf,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Vi,bufferController:rf,capLevelController:Wc,errorController:br,fpsController:ho,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:rs,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:zf},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},Qd()),{},{subtitleStreamController:Kd,subtitleTrackController:Vu,timelineController:bo,audioStreamController:yd,audioTrackController:un,emeController:Xo,cmcdController:_f,contentSteeringController:Pd,interstitialsController:Sf});function Qd(){return{cueHandler:Gd,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 e0(h,t,n){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(t.liveMaxLatencyDurationCount!==void 0&&(t.liveSyncDurationCount===void 0||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(t.liveMaxLatencyDuration!==void 0&&(t.liveSyncDuration===void 0||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const s=Nl(h),o=["manifest","level","frag"],l=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return o.forEach(u=>{const d=`${u==="level"?"playlist":u}LoadPolicy`,_=t[d]===void 0,g=[];l.forEach(v=>{const y=`${u}Loading${v}`,x=t[y];if(x!==void 0&&_){g.push(y);const D=s[d].default;switch(t[d]={default:D},v){case"TimeOut":D.maxLoadTimeMs=x,D.maxTimeToFirstByteMs=x;break;case"MaxRetry":D.errorRetry.maxNumRetry=x,D.timeoutRetry.maxNumRetry=x;break;case"RetryDelay":D.errorRetry.retryDelayMs=x,D.timeoutRetry.retryDelayMs=x;break;case"MaxRetryTimeout":D.errorRetry.maxRetryDelayMs=x,D.timeoutRetry.maxRetryDelayMs=x;break}}}),g.length&&n.warn(`hls.js config: "${g.join('", "')}" setting(s) are deprecated, use "${d}": ${$e(t[d])}`)}),M(M({},s),t)}function Nl(h){return h&&typeof h=="object"?Array.isArray(h)?h.map(Nl):Object.keys(h).reduce((t,n)=>(t[n]=Nl(h[n]),t),{}):h}function Vf(h,t){const n=h.loader;n!==$f&&n!==Uf?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1):Hd()&&(h.loader=$f,h.progressive=!0,h.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}const $l=2,t0=.1,i0=.05,n0=100;class r0 extends qi{constructor(t,n){super("gap-controller",t.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1})}},this.hls=t,this.fragmentTracker=n,this.registerListeners()}registerListeners(){const{hls:t}=this;t&&(t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(t,n){this.setInterval(n0),this.mediaSource=n.mediaSource;const s=this.media=n.media;Jr(s,"playing",this.onMediaPlaying),Jr(s,"waiting",this.onMediaWaiting),Jr(s,"ended",this.onMediaEnded)}onMediaDetaching(t,n){this.clearInterval();const{media:s}=this;s&&(Or(s,"playing",this.onMediaPlaying),Or(s,"waiting",this.onMediaWaiting),Or(s,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(t,n){this.buffered=n.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var t;if(!((t=this.media)!=null&&t.readyState)||!this.hasBuffered)return;const n=this.media.currentTime;this.poll(n,this.lastCurrentTime),this.lastCurrentTime=n}poll(t,n){var s,o;const l=(s=this.hls)==null?void 0:s.config;if(!l)return;const u=this.media;if(!u)return;const{seeking:d}=u,_=this.seeking&&!d,g=!this.seeking&&d,v=u.paused&&!d||u.ended||u.playbackRate===0;if(this.seeking=d,t!==n){n&&(this.ended=0),this.moved=!0,d||(this.nudgeRetry=0,l.nudgeOnVideoHole&&!v&&t>n&&this.nudgeOnVideoHole(t,n)),this.waiting===0&&this.stallResolved(t);return}if(g||_){_&&this.stallResolved(t);return}if(v){this.nudgeRetry=0,this.stallResolved(t),!this.ended&&u.ended&&this.hls&&(this.ended=t||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1}));return}if(!li.getBuffered(u).length){this.nudgeRetry=0;return}const y=li.bufferInfo(u,t,0),x=y.nextStart||0,D=this.fragmentTracker;if(d&&D&&this.hls){const tt=Gf(this.hls.inFlightFragments,t),Pe=y.len>$l,Ye=!x||tt||x-t>$l&&!D.getPartialFragment(t);if(Pe||Ye)return;this.moved=!1}const C=(o=this.hls)==null?void 0:o.latestLevelDetails;if(!this.moved&&this.stalled!==null&&D){if(!(y.len>0)&&!x)return;const Pe=Math.max(x,y.start||0)-t,qe=!!(C!=null&&C.live)?C.targetduration*2:$l,Fe=Qu(t,D);if(Pe>0&&(Pe<=qe||Fe)){u.paused||this._trySkipBufferHole(Fe);return}}const F=l.detectStallWithCurrentTimeMs,B=self.performance.now(),J=this.waiting;let ne=this.stalled;if(ne===null)if(J>0&&B-J<F)ne=this.stalled=J;else{this.stalled=B;return}const le=B-ne;if(!d&&(le>=F||J)&&this.hls){var Ee;if(((Ee=this.mediaSource)==null?void 0:Ee.readyState)==="ended"&&!(C!=null&&C.live)&&Math.abs(t-((C==null?void 0:C.edge)||0))<1){if(this.ended)return;this.ended=t||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(y),!this.media||!this.hls)return}const Ie=li.bufferInfo(u,t,l.maxBufferHole);this._tryFixBufferStall(Ie,le,t)}stallResolved(t){const n=this.stalled;if(n&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-n;this.log(`playback not stuck anymore @${t}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(S.STALL_RESOLVED,{})}}nudgeOnVideoHole(t,n){var s;const o=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&o&&o.length>1&&t>o.end(0)){const l=li.bufferedInfo(li.timeRangesToArray(this.buffered.audio),t,0);if(l.len>1&&n>=l.start){const u=li.timeRangesToArray(o),d=li.bufferedInfo(u,n,0).bufferedIndex;if(d>-1&&d<u.length-1){const _=li.bufferedInfo(u,t,0).bufferedIndex,g=u[d].end,v=u[d+1].start;if((_===-1||_>d)&&v-g<1&&t-g<2){const y=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${t} hole: ${g} -> ${v} buffered index: ${_}`);this.warn(y.message),this.media.currentTime+=1e-6;let x=Qu(t,this.fragmentTracker);x&&"fragment"in x?x=x.fragment:x||(x=void 0);const D=li.bufferInfo(this.media,t,0);this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,frag:x,buffer:D.len,bufferInfo:D})}}}}}_tryFixBufferStall(t,n,s){var o,l;const{fragmentTracker:u,media:d}=this,_=(o=this.hls)==null?void 0:o.config;if(!d||!u||!_)return;const g=(l=this.hls)==null?void 0:l.latestLevelDetails,v=Qu(s,u);if((v||g!=null&&g.live&&s<g.fragmentStart)&&(this._trySkipBufferHole(v)||!this.media))return;const y=t.buffered,x=this.adjacentTraversal(t,s);(y&&y.length>1&&t.len>_.maxBufferHole||t.nextStart&&(t.nextStart-s<_.maxBufferHole||x))&&(n>_.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(t))}adjacentTraversal(t,n){const s=this.fragmentTracker,o=t.nextStart;if(s&&o){const l=s.getFragAtPos(n,P.MAIN),u=s.getFragAtPos(o,P.MAIN);if(l&&u)return u.sn-l.sn<2}return!1}_reportStall(t){const{hls:n,media:s,stallReported:o,stalled:l}=this;if(!o&&l!==null&&s&&n){this.stallReported=!0;const u=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${$e(t)})`);this.warn(u.message),n.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.BUFFER_STALLED_ERROR,fatal:!1,error:u,buffer:t.len,bufferInfo:t,stalled:{start:l}})}}_trySkipBufferHole(t){var n;const{fragmentTracker:s,media:o}=this,l=(n=this.hls)==null?void 0:n.config;if(!o||!s||!l)return 0;const u=o.currentTime,d=li.bufferInfo(o,u,0),_=u<d.start?d.start:d.nextStart;if(_&&this.hls){const v=d.len<=l.maxBufferHole,y=d.len>0&&d.len<1&&o.readyState<3,x=_-u;if(x>0&&(v||y)){if(x>l.maxBufferHole){let C=!1;if(u===0){const F=s.getAppendedFrag(0,P.MAIN);F&&_<F.end&&(C=!0)}if(!C&&t){var g;if(!((g=this.hls.loadLevelObj)!=null&&g.details)||Gf(this.hls.inFlightFragments,_))return 0;let B=!1,J=t.end;for(;J<_;){const ne=Qu(J,s);if(ne)J+=ne.duration;else{B=!0;break}}if(B)return 0}}const D=Math.max(_+i0,u+t0);if(this.warn(`skipping hole, adjusting currentTime from ${u} to ${D}`),this.moved=!0,o.currentTime=D,!(t!=null&&t.gap)){const C=new Error(`fragment loaded with buffer holes, seeking from ${u} to ${D}`),F={type:ge.MEDIA_ERROR,details:q.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:C,reason:C.message,buffer:d.len,bufferInfo:d};t&&("fragment"in t?F.part=t:F.frag=t),this.hls.trigger(S.ERROR,F)}return D}}return 0}_tryNudgeBuffer(t){const{hls:n,media:s,nudgeRetry:o}=this,l=n==null?void 0:n.config;if(!s||!l)return 0;const u=s.currentTime;if(this.nudgeRetry++,o<l.nudgeMaxRetry){const d=u+(o+1)*l.nudgeOffset,_=new Error(`Nudging 'currentTime' from ${u} to ${d}`);this.warn(_.message),s.currentTime=d,n.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.BUFFER_NUDGE_ON_STALL,error:_,fatal:!1,buffer:t.len,bufferInfo:t})}else{const d=new Error(`Playhead still not moving while enough data buffered @${u} after ${l.nudgeMaxRetry} nudges`);this.error(d.message),n.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.BUFFER_STALLED_ERROR,error:d,fatal:!0,buffer:t.len,bufferInfo:t})}}}function Gf(h,t){const n=Hf(h.main);if(n&&n.start<=t)return n;const s=Hf(h.audio);return s&&s.start<=t?s:null}function Hf(h){if(!h)return null;switch(h.state){case pt.IDLE:case pt.STOPPED:case pt.ENDED:case pt.ERROR:return null}return h.frag}function Qu(h,t){return t.getAppendedFrag(h,P.MAIN)||t.getPartialFragment(h)}const s0=.25;function hh(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function ec(h,t,n,s,o){let l=new h(t,n,"");try{l.value=s,o&&(l.type=o)}catch(u){l=new h(t,n,$e(o?M({type:o},s):s))}return l}const va=(()=>{const h=hh();try{h&&new h(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class a0{constructor(t){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(S.EVENT_CUE_ENTER,{})},this.hls=t,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:t}=this;t&&(t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(t,n){var s;this.media=n.media,((s=n.overrides)==null?void 0:s.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var t;const n=(t=this.hls)==null?void 0:t.latestLevelDetails;n&&this.updateDateRangeCues(n)}onMediaDetaching(t,n){this.media=null,!n.transferMedia&&(this.id3Track&&(this.removeCues&&ds(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(t){const n=this.getID3Track(t.textTracks);return n.mode="hidden",n}getID3Track(t){if(this.media){for(let n=0;n<t.length;n++){const s=t[n];if(s.kind==="metadata"&&s.label==="id3")return fo(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(t,n){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:s,enableID3MetadataCues:o}=this.hls.config;if(!s&&!o)return;const{samples:l}=n;this.id3Track||(this.id3Track=this.createTrack(this.media));const u=hh();if(u)for(let d=0;d<l.length;d++){const _=l[d].type;if(_===hs.emsg&&!s||!o)continue;const g=Ac(l[d].data),v=l[d].pts;let y=v+l[d].duration;y>va&&(y=va),y-v<=0&&(y=v+s0);for(let D=0;D<g.length;D++){const C=g[D];if(!Lc(C)){this.updateId3CueEnds(v,_);const F=ec(u,v,y,C,_);F&&this.id3Track.addCue(F)}}}}updateId3CueEnds(t,n){var s;const o=(s=this.id3Track)==null?void 0:s.cues;if(o)for(let l=o.length;l--;){const u=o[l];u.type===n&&u.startTime<t&&u.endTime===va&&(u.endTime=t)}}onBufferFlushing(t,{startOffset:n,endOffset:s,type:o}){const{id3Track:l,hls:u}=this;if(!u)return;const{config:{enableEmsgMetadataCues:d,enableID3MetadataCues:_}}=u;if(l&&(d||_)){let g;o==="audio"?g=v=>v.type===hs.audioId3&&_:o==="video"?g=v=>v.type===hs.emsg&&d:g=v=>v.type===hs.audioId3&&_||v.type===hs.emsg&&d,Qs(l,n,s,g)}}onLevelUpdated(t,{details:n}){this.updateDateRangeCues(n,!0)}onLevelPtsUpdated(t,n){Math.abs(n.drift)>.01&&this.updateDateRangeCues(n.details)}updateDateRangeCues(t,n){if(!this.hls||!this.media)return;const{assetPlayerId:s,timelineOffset:o,enableDateRangeMetadataCues:l,interstitialsController:u}=this.hls.config;if(!l)return;const d=hh();if(s&&o&&!u){const{fragmentStart:F,fragmentEnd:B}=t;let J=this.assetCue;J?(J.startTime=F,J.endTime=B):d&&(J=this.assetCue=ec(d,F,B,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),J&&(J.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(J),J.addEventListener("enter",this.onEventCueEnter)))}if(!t.hasProgramDateTime)return;const{id3Track:_}=this,{dateRanges:g}=t,v=Object.keys(g);let y=this.dateRangeCuesAppended;if(_&&n){var x;if((x=_.cues)!=null&&x.length){const F=Object.keys(y).filter(B=>!v.includes(B));for(let B=F.length;B--;){var D;const J=F[B],ne=(D=y[J])==null?void 0:D.cues;delete y[J],ne&&Object.keys(ne).forEach(le=>{const Ee=ne[le];if(Ee){Ee.removeEventListener("enter",this.onEventCueEnter);try{_.removeCue(Ee)}catch(Ie){}}})}}else y=this.dateRangeCuesAppended={}}const C=t.fragments[t.fragments.length-1];if(!(v.length===0||!ce(C==null?void 0:C.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let F=0;F<v.length;F++){const B=v[F],J=g[B],ne=J.startTime,le=y[B],Ee=(le==null?void 0:le.cues)||{};let Ie=(le==null?void 0:le.durationKnown)||!1,tt=va;const{duration:Pe,endDate:Ye}=J;if(Ye&&Pe!==null)tt=ne+Pe,Ie=!0;else if(J.endOnNext&&!Ie){const Fe=v.reduce((mt,Zt)=>{if(Zt!==J.id){const ui=g[Zt];if(ui.class===J.class&&ui.startDate>J.startDate&&(!mt||J.startDate<mt.startDate))return ui}return mt},null);Fe&&(tt=Fe.startTime,Ie=!0)}const qe=Object.keys(J.attr);for(let Fe=0;Fe<qe.length;Fe++){const mt=qe[Fe];if(!Yr(mt))continue;const Zt=Ee[mt];if(Zt)Ie&&!(le!=null&&le.durationKnown)?Zt.endTime=tt:Math.abs(Zt.startTime-ne)>.01&&(Zt.startTime=ne,Zt.endTime=tt);else if(d){let ui=J.attr[mt];vs(mt)&&(ui=z(ui));const si=ec(d,ne,tt,{key:mt,data:ui},hs.dateRange);si&&(si.id=B,this.id3Track.addCue(si),Ee[mt]=si,u&&(mt==="X-ASSET-LIST"||mt==="X-ASSET-URL")&&si.addEventListener("enter",this.onEventCueEnter))}}y[B]={cues:Ee,dateRange:J,durationKnown:Ie}}}}}class Kl{constructor(t){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:n}=this,s=this.levelDetails;if(!n||!s)return;this.currentTime=n.currentTime;const o=this.computeLatency();if(o===null)return;this._latency=o;const{lowLatencyMode:l,maxLiveSyncPlaybackRate:u}=this.config;if(!l||u===1||!s.live)return;const d=this.targetLatency;if(d===null)return;const _=o-d,g=Math.min(this.maxLatency,d+s.targetduration);if(_<g&&_>.05&&this.forwardBufferLength>1){const y=Math.min(2,Math.max(1,u)),x=Math.round(2/(1+Math.exp(-.75*_-this.edgeStalled))*20)/20,D=Math.min(y,Math.max(1,x));this.changeMediaPlaybackRate(n,D)}else n.playbackRate!==1&&n.playbackRate!==0&&this.changeMediaPlaybackRate(n,1)},this.hls=t,this.config=t.config,this.registerListeners()}get levelDetails(){var t;return((t=this.hls)==null?void 0:t.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:t}=this;if(t.liveMaxLatencyDuration!==void 0)return t.liveMaxLatencyDuration;const n=this.levelDetails;return n?t.liveMaxLatencyDurationCount*n.targetduration:0}get targetLatency(){const t=this.levelDetails;if(t===null||this.hls===null)return null;const{holdBack:n,partHoldBack:s,targetduration:o}=t,{liveSyncDuration:l,liveSyncDurationCount:u,lowLatencyMode:d}=this.config,_=this.hls.userConfig;let g=d&&s||n;(this._targetLatencyUpdated||_.liveSyncDuration||_.liveSyncDurationCount||g===0)&&(g=l!==void 0?l:u*o);const v=o;return g+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,v)}set targetLatency(t){this.stallCount=0,this.config.liveSyncDuration=t,this._targetLatencyUpdated=!0}get liveSyncPosition(){const t=this.estimateLiveEdge(),n=this.targetLatency;if(t===null||n===null)return null;const s=this.levelDetails;if(s===null)return null;const o=s.edge,l=t-n-this.edgeStalled,u=o-s.totalduration,d=o-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(u,l),d)}get drift(){const t=this.levelDetails;return t===null?1:t.drift}get edgeStalled(){const t=this.levelDetails;if(t===null)return 0;const n=(this.config.lowLatencyMode&&t.partTarget||t.targetduration)*3;return Math.max(t.age-n,0)}get forwardBufferLength(){const{media:t}=this,n=this.levelDetails;if(!t||!n)return 0;const s=t.buffered.length;return(s?t.buffered.end(s-1):n.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:t}=this;t&&(t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.ERROR,this.onError,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.ERROR,this.onError,this))}onMediaAttached(t,n){this.media=n.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(t,{details:n}){n.advanced&&this.onTimeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(t,n){var s;n.details===q.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(t,n){var s,o;t.playbackRate!==n&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(o=this.targetLatency)==null?void 0:o.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${t.playbackRate} to ${n}`),t.playbackRate=n)}estimateLiveEdge(){const t=this.levelDetails;return t===null?null:t.edge+t.age}computeLatency(){const t=this.estimateLiveEdge();return t===null?null:t-this.currentTime}}class Ul extends Au{constructor(t,n){super(t,"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=n,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this),t.on(S.ERROR,this.onError,this)}_unregisterListeners(){const{hls:t}=this;t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this),t.off(S.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(n=>{n.loadError=0,n.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(t,n){this.resetLevels()}onManifestLoaded(t,n){const s=this.hls.config.preferManagedMediaSource,o=[],l={},u={};let d=!1,_=!1,g=!1;n.levels.forEach(v=>{const y=v.attrs;let{audioCodec:x,videoCodec:D}=v;x&&(v.audioCodec=x=ot(x,s)||void 0),D&&(D=v.videoCodec=vi(D));const{width:C,height:F,unknownCodecs:B}=v,J=(B==null?void 0:B.length)||0;if(d||(d=!!(C&&F)),_||(_=!!D),g||(g=!!x),J||x&&!this.isAudioSupported(x)||D&&!this.isVideoSupported(D)){this.log(`Some or all CODECS not supported "${y.CODECS}"`);return}const{CODECS:ne,"FRAME-RATE":le,"HDCP-LEVEL":Ee,"PATHWAY-ID":Ie,RESOLUTION:tt,"VIDEO-RANGE":Pe}=y,qe=`${`${Ie||"."}-`}${v.bitrate}-${tt}-${le}-${ne}-${Pe}-${Ee}`;if(l[qe])if(l[qe].uri!==v.url&&!v.attrs["PATHWAY-ID"]){const Fe=u[qe]+=1;v.attrs["PATHWAY-ID"]=new Array(Fe+1).join(".");const mt=this.createLevel(v);l[qe]=mt,o.push(mt)}else l[qe].addGroupId("audio",y.AUDIO),l[qe].addGroupId("text",y.SUBTITLES);else{const Fe=this.createLevel(v);l[qe]=Fe,u[qe]=1,o.push(Fe)}}),this.filterAndSortMediaOptions(o,n,d,_,g)}createLevel(t){const n=new Xn(t),s=t.supplemental;if(s!=null&&s.videoCodec&&!this.isVideoSupported(s.videoCodec)){const o=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(o.message),n.supportedResult=pi(o,[])}return n}isAudioSupported(t){return ye(t,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(t){return ye(t,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(t,n,s,o,l){var u;let d=[],_=[],g=t;const v=((u=n.stats)==null?void 0:u.parsing)||{};if((s||o)&&l&&(g=g.filter(({videoCodec:ne,videoRange:le,width:Ee,height:Ie})=>(!!ne||!!(Ee&&Ie))&&In(le))),g.length===0){Promise.resolve().then(()=>{if(this.hls){let ne="no level with compatible codecs found in manifest",le=ne;n.levels.length&&(le=`one or more CODECS in variant not supported: ${$e(n.levels.map(Ie=>Ie.attrs.CODECS).filter((Ie,tt,Pe)=>Pe.indexOf(Ie)===tt))}`,this.warn(le),ne+=` (${le})`);const Ee=new Error(ne);this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:q.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:n.url,error:Ee,reason:le})}}),v.end=performance.now();return}n.audioTracks&&(d=n.audioTracks.filter(ne=>!ne.audioCodec||this.isAudioSupported(ne.audioCodec)),tc(d)),n.subtitles&&(_=n.subtitles,tc(_));const y=g.slice(0);g.sort((ne,le)=>{if(ne.attrs["HDCP-LEVEL"]!==le.attrs["HDCP-LEVEL"])return(ne.attrs["HDCP-LEVEL"]||"")>(le.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&ne.height!==le.height)return ne.height-le.height;if(ne.frameRate!==le.frameRate)return ne.frameRate-le.frameRate;if(ne.videoRange!==le.videoRange)return Mi.indexOf(ne.videoRange)-Mi.indexOf(le.videoRange);if(ne.videoCodec!==le.videoCodec){const Ee=W(ne.videoCodec),Ie=W(le.videoCodec);if(Ee!==Ie)return Ie-Ee}if(ne.uri===le.uri&&ne.codecSet!==le.codecSet){const Ee=ae(ne.codecSet),Ie=ae(le.codecSet);if(Ee!==Ie)return Ie-Ee}return ne.averageBitrate!==le.averageBitrate?ne.averageBitrate-le.averageBitrate:0});let x=y[0];if(this.steering&&(g=this.steering.filterParsedLevels(g),g.length!==y.length)){for(let ne=0;ne<y.length;ne++)if(y[ne].pathwayId===g[0].pathwayId){x=y[ne];break}}this._levels=g;for(let ne=0;ne<g.length;ne++)if(g[ne]===x){var D;this._firstLevel=ne;const le=x.bitrate,Ee=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${g.length} level(s) found, first bitrate: ${le}`),((D=this.hls.userConfig)==null?void 0:D.abrEwmaDefaultEstimate)===void 0){const Ie=Math.min(le,this.hls.config.abrEwmaDefaultEstimateMax);Ie>Ee&&Ee===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=Ie)}break}const C=l&&!o,F=this.hls.config,B=!!(F.audioStreamController&&F.audioTrackController),J={levels:g,audioTracks:d,subtitleTracks:_,sessionData:n.sessionData,sessionKeys:n.sessionKeys,firstLevel:this._firstLevel,stats:n.stats,audio:l,video:o,altAudio:B&&!C&&d.some(ne=>!!ne.url)};v.end=performance.now(),this.hls.trigger(S.MANIFEST_PARSED,J)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(t){const n=this._levels;if(n.length===0)return;if(t<0||t>=n.length){const v=new Error("invalid level idx"),y=t<0;if(this.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:q.LEVEL_SWITCH_ERROR,level:t,fatal:y,error:v,reason:v.message}),y)return;t=Math.min(t,n.length-1)}const s=this.currentLevelIndex,o=this.currentLevel,l=o?o.attrs["PATHWAY-ID"]:void 0,u=n[t],d=u.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=u,s===t&&o&&l===d)return;this.log(`Switching to level ${t} (${u.height?u.height+"p ":""}${u.videoRange?u.videoRange+" ":""}${u.codecSet?u.codecSet+" ":""}@${u.bitrate})${d?" with Pathway "+d:""} from level ${s}${l?" with Pathway "+l:""}`);const _={level:t,attrs:u.attrs,details:u.details,bitrate:u.bitrate,averageBitrate:u.averageBitrate,maxBitrate:u.maxBitrate,realBitrate:u.realBitrate,width:u.width,height:u.height,codecSet:u.codecSet,audioCodec:u.audioCodec,videoCodec:u.videoCodec,audioGroups:u.audioGroups,subtitleGroups:u.subtitleGroups,loaded:u.loaded,loadError:u.loadError,fragmentError:u.fragmentError,name:u.name,id:u.id,uri:u.uri,url:u.url,urlId:0,audioGroupIds:u.audioGroupIds,textGroupIds:u.textGroupIds};this.hls.trigger(S.LEVEL_SWITCHING,_);const g=u.details;if(!g||g.live){const v=this.switchParams(u.uri,o==null?void 0:o.details,g);this.loadPlaylist(v)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(t){this.manualLevelIndex=t,this._startLevel===void 0&&(this._startLevel=t),t!==-1&&(this.level=t)}get firstLevel(){return this._firstLevel}set firstLevel(t){this._firstLevel=t}get startLevel(){if(this._startLevel===void 0){const t=this.hls.config.startLevel;return t!==void 0?t:this.hls.firstAutoLevel}return this._startLevel}set startLevel(t){this._startLevel=t}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(t){if(this.steering){const n=this.steering.pathways(),s=t.filter(o=>n.indexOf(o)!==-1);if(t.length<1){this.warn(`pathwayPriority ${t} should contain at least one pathway from list: ${n}`);return}this.steering.pathwayPriority=s}}onError(t,n){n.fatal||!n.context||n.context.type===Te.LEVEL&&n.context.level===this.level&&this.checkRetry(n)}onFragBuffered(t,{frag:n}){if(n!==void 0&&n.type===P.MAIN){const s=n.elementaryStreams;if(!Object.keys(s).some(l=>!!s[l]))return;const o=this._levels[n.level];o!=null&&o.loadError&&(this.log(`Resetting level error count of ${o.loadError} on frag buffered`),o.loadError=0)}}onLevelLoaded(t,n){var s;const{level:o,details:l}=n,u=n.levelInfo;if(!u){var d;this.warn(`Invalid level index ${o}`),(d=n.deliveryDirectives)!=null&&d.skip&&(l.deltaUpdateFailed=!0);return}if(u===this.currentLevel||n.withoutMultiVariant){u.fragmentError===0&&(u.loadError=0);let _=u.details;_===n.details&&_.advanced&&(_=void 0),this.playlistLoaded(o,n,_)}else(s=n.deliveryDirectives)!=null&&s.skip&&(l.deltaUpdateFailed=!0)}loadPlaylist(t){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,t)}loadingPlaylist(t,n){super.loadingPlaylist(t,n);const s=this.getUrlWithDirectives(t.uri,n),o=this.currentLevelIndex,l=t.attrs["PATHWAY-ID"],u=t.details,d=u==null?void 0:u.age;this.log(`Loading level index ${o}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${l?" Pathway "+l:""}${d&&u.live?" age "+d.toFixed(1)+(u.type?" "+u.type||0:""):""} ${s}`),this.hls.trigger(S.LEVEL_LOADING,{url:s,level:o,levelInfo:t,pathwayId:t.attrs["PATHWAY-ID"],id:0,deliveryDirectives:n||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(t){this.level=t,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=t)}removeLevel(t){var n;if(this._levels.length===1)return;const s=this._levels.filter((l,u)=>u!==t?!0:(this.steering&&this.steering.removeLevel(l),l===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,l.details&&l.details.fragments.forEach(d=>d.level=-1)),!1));Gr(s),this._levels=s,this.currentLevelIndex>-1&&(n=this.currentLevel)!=null&&n.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const o=s.length-1;this._firstLevel=Math.min(this._firstLevel,o),this._startLevel&&(this._startLevel=Math.min(this._startLevel,o)),this.hls.trigger(S.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(t,{levels:n}){this._levels=n}checkMaxAutoUpdated(){const{autoLevelCapping:t,maxAutoLevel:n,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==n&&(this._maxAutoLevel=n,this.hls.trigger(S.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:n,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function tc(h){const t={};h.forEach(n=>{const s=n.groupId||"";n.id=t[s]=t[s]||0,t[s]++})}function ps(){return self.SourceBuffer||self.WebKitSourceBuffer}function Wf(){if(!Oe())return!1;const t=ps();return!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function"}function o0(){if(!Wf())return!1;const h=Oe();return typeof(h==null?void 0:h.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(t=>h.isTypeSupported(K(t,"video")))||["mp4a.40.2","fLaC"].some(t=>h.isTypeSupported(K(t,"audio"))))}function l0(){var h;const t=ps();return typeof(t==null||(h=t.prototype)==null?void 0:h.changeType)=="function"}const u0=100;class zl extends lu{constructor(t,n,s){super(t,n,s,"stream-controller",P.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 o=this.media,l=o?o.currentTime:null;if(l===null||!ce(l)||(this.log(`Media seeked to ${l.toFixed(3)}`),!this.getBufferedFrag(l)))return;const u=this.getFwdBufferInfoAtPos(o,l,P.MAIN,0);if(u===null||u.len===0){this.warn(`Main forward buffer length at ${l} on "seeked" event ${u?u.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:t}=this;t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(S.BUFFER_CREATED,this.onBufferCreated,this),t.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(S.BUFFER_CREATED,this.onBufferCreated,this),t.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(t,n){if(this.levels){const{lastCurrentTime:s,hls:o}=this;if(this.stopLoad(),this.setInterval(u0),this.level=-1,!this.startFragRequested){let l=o.startLevel;l===-1&&(o.config.testBandwidth&&this.levels.length>1?(l=0,this.bitrateTest=!0):l=o.firstAutoLevel),o.nextLoadLevel=l,this.level=o.loadLevel,this._hasEnoughToStart=!!n}s>0&&t===-1&&!n&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),t=s),this.state=pt.IDLE,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}else this._forceStartLoad=!0,this.state=pt.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case pt.WAITING_LEVEL:{const{levels:t,level:n}=this,s=t==null?void 0:t[n],o=s==null?void 0:s.details;if(o&&(!o.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(o))break;this.state=pt.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=pt.IDLE;break}break}case pt.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===pt.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var t;super.onTickEnd(),(t=this.media)!=null&&t.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:t,levelLastLoaded:n,levels:s,media:o}=this;if(n===null||!o&&!this.primaryPrefetch&&(this.startFragRequested||!t.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const l=this.buffering?t.nextLoadLevel:t.loadLevel;if(!(s!=null&&s[l]))return;const u=s[l],d=this.getMainFwdBufferInfo();if(d===null)return;const _=this.getLevelDetails();if(_&&this._streamEnded(d,_)){const F={};this.altAudio===2&&(F.type="video"),this.hls.trigger(S.BUFFER_EOS,F),this.state=pt.ENDED;return}if(!this.buffering)return;t.loadLevel!==l&&t.manualLevel===-1&&this.log(`Adapting to level ${l} from level ${this.level}`),this.level=t.nextLoadLevel=l;const g=u.details;if(!g||this.state===pt.WAITING_LEVEL||this.waitForLive(u)){this.level=l,this.state=pt.WAITING_LEVEL,this.startFragRequested=!1;return}const v=d.len,y=this.getMaxBufferLength(u.maxBitrate);if(v>=y)return;this.backtrackFragment&&this.backtrackFragment.start>d.end&&(this.backtrackFragment=null);const x=this.backtrackFragment?this.backtrackFragment.start:d.end;let D=this.getNextFragment(x,g);if(this.couldBacktrack&&!this.fragPrevious&&D&&ze(D)&&this.fragmentTracker.getState(D)!==Oi.OK){var C;const B=((C=this.backtrackFragment)!=null?C:D).sn-g.startSN,J=g.fragments[B-1];J&&D.cc===J.cc&&(D=J,this.fragmentTracker.removeFragment(J))}else this.backtrackFragment&&d.len&&(this.backtrackFragment=null);if(D&&this.isLoopLoading(D,x)){if(!D.gap){const B=this.audioOnly&&!this.altAudio?V.AUDIO:V.VIDEO,J=(B===V.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;J&&this.afterBufferFlushed(J,B,P.MAIN)}D=this.getNextFragmentLoopLoading(D,g,d,P.MAIN,y)}D&&(D.initSegment&&!D.initSegment.data&&!this.bitrateTest&&(D=D.initSegment),this.loadFragment(D,u,x))}loadFragment(t,n,s){const o=this.fragmentTracker.getState(t);o===Oi.NOT_LOADED||o===Oi.PARTIAL?ze(t)?this.bitrateTest?(this.log(`Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(t,n)):super.loadFragment(t,n,s):this._loadInitSegment(t,n):this.clearTrackerIfNeeded(t)}getBufferedFrag(t){return this.fragmentTracker.getBufferedFrag(t,P.MAIN)}followingBufferedFrag(t){return t?this.getBufferedFrag(t.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:t,media:n}=this;if(n!=null&&n.readyState){let s;const o=this.getAppendedFrag(n.currentTime);o&&o.start>1&&this.flushMainBuffer(0,o.start-1);const l=this.getLevelDetails();if(l!=null&&l.live){const d=this.getMainFwdBufferInfo();if(!d||d.len<l.targetduration*2)return}if(!n.paused&&t){const d=this.hls.nextLoadLevel,_=t[d],g=this.fragLastKbps;g&&this.fragCurrent?s=this.fragCurrent.duration*_.maxBitrate/(1e3*g)+1:s=0}else s=0;const u=this.getBufferedFrag(n.currentTime+s);if(u){const d=this.followingBufferedFrag(u);if(d){this.abortCurrentFrag();const _=d.maxStartPTS?d.maxStartPTS:d.start,g=d.duration,v=Math.max(u.end,_+Math.min(Math.max(g-this.config.maxFragLookUpTolerance,g*(this.couldBacktrack?.5:.125)),g*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(v,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case pt.KEY_LOADING:case pt.FRAG_LOADING:case pt.FRAG_LOADING_WAITING_RETRY:case pt.PARSING:case pt.PARSED:this.state=pt.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(t,n){super.flushMainBuffer(t,n,this.altAudio===2?"video":null)}onMediaAttached(t,n){super.onMediaAttached(t,n);const s=n.media;Jr(s,"playing",this.onMediaPlaying),Jr(s,"seeked",this.onMediaSeeked)}onMediaDetaching(t,n){const{media:s}=this;s&&(Or(s,"playing",this.onMediaPlaying),Or(s,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(t,n),!n.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(S.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(t,n){let s=!1,o=!1;for(let l=0;l<n.levels.length;l++){const u=n.levels[l].audioCodec;u&&(s=s||u.indexOf("mp4a.40.2")!==-1,o=o||u.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=s&&o&&!l0(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=n.levels,this.startFragRequested=!1}onLevelLoading(t,n){const{levels:s}=this;if(!s||this.state!==pt.IDLE)return;const o=n.levelInfo;(!o.details||o.details.live&&(this.levelLastLoaded!==o||o.details.expired)||this.waitForCdnTuneIn(o.details))&&(this.state=pt.WAITING_LEVEL)}onLevelLoaded(t,n){var s;const{levels:o,startFragRequested:l}=this,u=n.level,d=n.details,_=d.totalduration;if(!o){this.warn(`Levels were reset while loading level ${u}`);return}this.log(`Level ${u} loaded [${d.startSN},${d.endSN}]${d.lastPartSn?`[part-${d.lastPartSn}-${d.lastPartIndex}]`:""}, cc [${d.startCC}, ${d.endCC}] duration:${_}`);const g=n.levelInfo,v=this.fragCurrent;v&&(this.state===pt.FRAG_LOADING||this.state===pt.FRAG_LOADING_WAITING_RETRY)&&v.level!==n.level&&v.loader&&this.abortCurrentFrag();let y=0;if(d.live||(s=g.details)!=null&&s.live){var x;if(this.checkLiveUpdate(d),d.deltaUpdateFailed)return;y=this.alignPlaylists(d,g.details,(x=this.levelLastLoaded)==null?void 0:x.details)}if(g.details=d,this.levelLastLoaded=g,l||this.setStartPosition(d,y),this.hls.trigger(S.LEVEL_UPDATED,{details:d,level:u}),this.state===pt.WAITING_LEVEL){if(this.waitForCdnTuneIn(d))return;this.state=pt.IDLE}l&&d.live&&this.synchronizeToLiveEdge(d),this.tick()}synchronizeToLiveEdge(t){const{config:n,media:s}=this;if(!s)return;const o=this.hls.liveSyncPosition,l=this.getLoadPosition(),u=t.fragmentStart,d=t.edge,_=l>=u-n.maxFragLookUpTolerance&&l<=d;if(o!==null&&s.duration>o&&(l<o||!_)){const v=n.liveMaxLatencyDuration!==void 0?n.liveMaxLatencyDuration:n.liveMaxLatencyDurationCount*t.targetduration;if((!_&&s.readyState<4||l<d-v)&&(this._hasEnoughToStart||(this.nextLoadPosition=o),s.readyState))if(this.warn(`Playback: ${l.toFixed(3)} is located too far from the end of live sliding playlist: ${d}, reset currentTime to : ${o.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var g;const y=li.bufferInfo(s,o,0);if(!((g=y.buffered)!=null&&g.length)){s.currentTime=o;return}if(y.start<=l){s.currentTime=o;return}const{nextStart:D}=li.bufferedInfo(y.buffered,l,0);D&&(s.currentTime=D)}else s.currentTime=o}}_handleFragmentLoadProgress(t){var n;const s=t.frag,{part:o,payload:l}=t,{levels:u}=this;if(!u){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const d=u[s.level];if(!d){this.warn(`Level ${s.level} not found on progress`);return}const _=d.details;if(!_){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const g=d.videoCodec,v=_.PTSKnown||!_.live,y=(n=s.initSegment)==null?void 0:n.data,x=this._getAudioCodec(d),D=this.transmuxer=this.transmuxer||new zc(this.hls,P.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),C=o?o.index:-1,F=C!==-1,B=new fi(s.level,s.sn,s.stats.chunkCount,l.byteLength,C,F),J=this.initPTS[s.cc];D.push(l,y,x,g,s,o,_.totalduration,v,B,J)}onAudioTrackSwitching(t,n){const s=this.hls,o=this.altAudio===2;if(Fi(n.url,s))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 u=this.fragCurrent;u&&(this.log("Switching to main audio track, cancel main fragment load"),u.abortRequests(),this.fragmentTracker.removeFragment(u)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(o){this.fragmentTracker.removeAllFragments(),s.once(S.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(S.AUDIO_TRACK_SWITCHED,n)}),s.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(S.AUDIO_TRACK_SWITCHED,n)}}onAudioTrackSwitched(t,n){const s=Fi(n.url,this.hls);if(s){const o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=s?2:0,this.tick()}onBufferCreated(t,n){const s=n.tracks;let o,l,u=!1;for(const d in s){const _=s[d];if(_.id==="main"){if(l=d,o=_,d==="video"){const g=s[d];g&&(this.videoBuffer=g.buffer)}}else u=!0}u&&o?(this.log(`Alternate track found, use ${l}.buffered to schedule main fragment loading`),this.mediaBuffer=o.buffer):this.mediaBuffer=this.media}onFragBuffered(t,n){const{frag:s,part:o}=n,l=s.type===P.MAIN;if(l){if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${o?" p: "+o.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===pt.PARSED&&(this.state=pt.IDLE);return}const d=o?o.stats:s.stats;this.fragLastKbps=Math.round(8*d.total/(d.buffering.end-d.loading.first)),ze(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,o)}const u=this.media;u&&(!this._hasEnoughToStart&&li.getBuffered(u).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),l&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(t,n){var s;if(n.fatal){this.state=pt.ERROR;return}switch(n.details){case q.FRAG_GAP:case q.FRAG_PARSING_ERROR:case q.FRAG_DECRYPT_ERROR:case q.FRAG_LOAD_ERROR:case q.FRAG_LOAD_TIMEOUT:case q.KEY_LOAD_ERROR:case q.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.MAIN,n);break;case q.LEVEL_LOAD_ERROR:case q.LEVEL_LOAD_TIMEOUT:case q.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===pt.WAITING_LEVEL&&((s=n.context)==null?void 0:s.type)===Te.LEVEL&&(this.state=pt.IDLE);break;case q.BUFFER_ADD_CODEC_ERROR:case q.BUFFER_APPEND_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.resetLoadingState();break;case q.BUFFER_FULL_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case q.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onFragLoadEmergencyAborted(){this.state=pt.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(t,{type:n}){if(n!==V.AUDIO||!this.altAudio){const s=(n===V.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,n,P.MAIN),this.tick())}}onLevelsUpdated(t,n){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=n.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:t}=this;if(!t)return;const n=t.currentTime;let s=this.startPosition;if(s>=0&&n<s){if(t.seeking){this.log(`could not seek to ${s}, already seeking at ${n}`);return}const o=this.timelineOffset;o&&s&&(s+=o);const l=this.getLevelDetails(),u=li.getBuffered(t),d=u.length?u.start(0):0,_=d-s,g=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||_>0&&(_<g||this.loadingParts&&_<2*((l==null?void 0:l.partTarget)||0)))&&(this.log(`adjusting start position by ${_} to match buffer start`),s+=_,this.startPosition=s),n<s&&(this.log(`seek to target start position ${s} from current time ${n} buffer start ${d}`),t.currentTime=s)}}_getAudioCodec(t){let n=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&n&&(this.log("Swapping audio codec"),n.indexOf("mp4a.40.5")!==-1?n="mp4a.40.2":n="mp4a.40.5"),n}_loadBitrateTestFrag(t,n){t.bitrateTest=!0,this._doFragLoad(t,n).then(s=>{const{hls:o}=this,l=s==null?void 0:s.frag;if(!l||this.fragContextChanged(l))return;n.fragmentError=0,this.state=pt.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const u=l.stats;u.parsing.start=u.parsing.end=u.buffering.start=u.buffering.end=self.performance.now(),o.trigger(S.FRAG_LOADED,s),l.bitrateTest=!1}).catch(s=>{this.state===pt.STOPPED||this.state===pt.ERROR||(this.warn(s),this.resetFragmentLoading(t))})}_handleTransmuxComplete(t){const n=this.playlistType,{hls:s}=this,{remuxResult:o,chunkMeta:l}=t,u=this.getCurrentContext(l);if(!u){this.resetWhenMissingContext(l);return}const{frag:d,part:_,level:g}=u,{video:v,text:y,id3:x,initSegment:D}=o,{details:C}=g,F=this.altAudio?void 0:o.audio;if(this.fragContextChanged(d)){this.fragmentTracker.removeFragment(d);return}if(this.state=pt.PARSING,D){const B=D.tracks;if(B){const Ee=d.initSegment||d;if(this.unhandledEncryptionError(D,d))return;this._bufferInitSegment(g,B,Ee,l),s.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:Ee,id:n,tracks:B})}const J=D.initPTS,ne=D.timescale,le=this.initPTS[d.cc];if(ce(J)&&(!le||le.baseTime!==J||le.timescale!==ne)){const Ee=D.trackId;this.initPTS[d.cc]={baseTime:J,timescale:ne,trackId:Ee},s.trigger(S.INIT_PTS_FOUND,{frag:d,id:n,initPTS:J,timescale:ne,trackId:Ee})}}if(v&&C){F&&v.type==="audiovideo"&&this.logMuxedErr(d);const B=C.fragments[d.sn-1-C.startSN],J=d.sn===C.startSN,ne=!B||d.cc>B.cc;if(o.independent!==!1){const{startPTS:le,endPTS:Ee,startDTS:Ie,endDTS:tt}=v;if(_)_.elementaryStreams[v.type]={startPTS:le,endPTS:Ee,startDTS:Ie,endDTS:tt};else if(v.firstKeyFrame&&v.independent&&l.id===1&&!ne&&(this.couldBacktrack=!0),v.dropped&&v.independent){const Pe=this.getMainFwdBufferInfo(),Ye=(Pe?Pe.end:this.getLoadPosition())+this.config.maxBufferHole,qe=v.firstKeyFramePTS?v.firstKeyFramePTS:le;if(!J&&Ye<qe-this.config.maxBufferHole&&!ne){this.backtrack(d);return}else ne&&(d.gap=!0);d.setElementaryStreamInfo(v.type,d.start,Ee,d.start,tt,!0)}else J&&le-(C.appliedTimelineOffset||0)>$l&&(d.gap=!0);d.setElementaryStreamInfo(v.type,le,Ee,Ie,tt),this.backtrackFragment&&(this.backtrackFragment=d),this.bufferFragmentData(v,d,_,l,J||ne)}else if(J||ne)d.gap=!0;else{this.backtrack(d);return}}if(F){const{startPTS:B,endPTS:J,startDTS:ne,endDTS:le}=F;_&&(_.elementaryStreams[V.AUDIO]={startPTS:B,endPTS:J,startDTS:ne,endDTS:le}),d.setElementaryStreamInfo(V.AUDIO,B,J,ne,le),this.bufferFragmentData(F,d,_,l)}if(C&&x!=null&&x.samples.length){const B={id:n,frag:d,details:C,samples:x.samples};s.trigger(S.FRAG_PARSING_METADATA,B)}if(C&&y){const B={id:n,frag:d,details:C,samples:y.samples};s.trigger(S.FRAG_PARSING_USERDATA,B)}}logMuxedErr(t){this.warn(`${ze(t)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${t.url}`)}_bufferInitSegment(t,n,s,o){if(this.state!==pt.PARSING)return;this.audioOnly=!!n.audio&&!n.video,this.altAudio&&!this.audioOnly&&(delete n.audio,n.audiovideo&&this.logMuxedErr(s));const{audio:l,video:u,audiovideo:d}=n;if(l){const g=t.audioCodec;let v=Nt(l.codec,g);v==="mp4a"&&(v="mp4a.40.5");const y=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){v&&(v.indexOf("mp4a.40.5")!==-1?v="mp4a.40.2":v="mp4a.40.5");const x=l.metadata;x&&"channelCount"in x&&(x.channelCount||1)!==1&&y.indexOf("firefox")===-1&&(v="mp4a.40.5")}v&&v.indexOf("mp4a.40.5")!==-1&&y.indexOf("android")!==-1&&l.container!=="audio/mpeg"&&(v="mp4a.40.2",this.log(`Android: force audio codec to ${v}`)),g&&g!==v&&this.log(`Swapping manifest audio codec "${g}" for "${v}"`),l.levelCodec=v,l.id=P.MAIN,this.log(`Init audio buffer, container:${l.container}, codecs[selected/level/parsed]=[${v||""}/${g||""}/${l.codec}]`),delete n.audiovideo}if(u){u.levelCodec=t.videoCodec,u.id=P.MAIN;const g=u.codec;if((g==null?void 0:g.length)===4)switch(g){case"hvc1":case"hev1":u.codec="hvc1.1.6.L120.90";break;case"av01":u.codec="av01.0.04M.08";break;case"avc1":u.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${u.container}, codecs[level/parsed]=[${t.videoCodec||""}/${g}]${u.codec!==g?" parsed-corrected="+u.codec:""}${u.supplemental?" supplemental="+u.supplemental:""}`),delete n.audiovideo}d&&(this.log(`Init audiovideo buffer, container:${d.container}, codecs[level/parsed]=[${t.codecs}/${d.codec}]`),delete n.video,delete n.audio);const _=Object.keys(n);if(_.length){if(this.hls.trigger(S.BUFFER_CODECS,n),!this.hls)return;_.forEach(g=>{const y=n[g].initSegment;y!=null&&y.byteLength&&this.hls.trigger(S.BUFFER_APPENDING,{type:g,data:y,frag:s,part:null,chunkMeta:o,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const t=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(t,P.MAIN)}get maxBufferLength(){const{levels:t,level:n}=this,s=t==null?void 0:t[n];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=pt.IDLE}checkFragmentChanged(){const t=this.media;let n=null;if(t&&t.readyState>1&&t.seeking===!1){const s=t.currentTime;if(li.isBuffered(t,s)?n=this.getAppendedFrag(s):li.isBuffered(t,s+.1)&&(n=this.getAppendedFrag(s+.1)),n){this.backtrackFragment=null;const o=this.fragPlaying,l=n.level;(!o||n.sn!==o.sn||o.level!==l)&&(this.fragPlaying=n,this.hls.trigger(S.FRAG_CHANGED,{frag:n}),(!o||o.level!==l)&&this.hls.trigger(S.LEVEL_SWITCHED,{level:l}))}}}get nextLevel(){const t=this.nextBufferedFrag;return t?t.level:-1}get currentFrag(){var t;if(this.fragPlaying)return this.fragPlaying;const n=((t=this.media)==null?void 0:t.currentTime)||this.lastCurrentTime;return ce(n)?this.getAppendedFrag(n):null}get currentProgramDateTime(){var t;const n=((t=this.media)==null?void 0:t.currentTime)||this.lastCurrentTime;if(ce(n)){const s=this.getLevelDetails(),o=this.currentFrag||(s?Wi(null,s.fragments,n):null);if(o){const l=o.programDateTime;if(l!==null){const u=l+(n-o.start)*1e3;return new Date(u)}}}return null}get currentLevel(){const t=this.currentFrag;return t?t.level:-1}get nextBufferedFrag(){const t=this.currentFrag;return t?this.followingBufferedFrag(t):null}get forceStartLoad(){return this._forceStartLoad}}class c0 extends H{constructor(t,n){super("key-loader",n),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=t}abort(t){for(const s in this.keyIdToKeyInfo){const o=this.keyIdToKeyInfo[s].loader;if(o){var n;if(t&&t!==((n=o.context)==null?void 0:n.frag.type))return;o.abort()}}}detach(){for(const t in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[t];(n.mediaKeySessionContext||n.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[t]}}destroy(){this.detach();for(const t in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[t].loader;n&&n.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(t,n=q.KEY_LOAD_ERROR,s,o,l){return new hr({type:ge.NETWORK_ERROR,details:n,fatal:!1,frag:t,response:l,error:s,networkDetails:o})}loadClear(t,n,s){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(n.length)for(let o=0,l=n.length;o<l;o++){const u=n[o];if(t.cc<=u.cc&&(!ze(t)||!ze(u)||t.sn<u.sn)||!s&&o==l-1)return this.emeController.selectKeySystemFormat(u).then(d=>{if(!this.emeController)return;u.setKeyFormat(d);const _=zr(d);if(_)return this.emeController.getKeySystemAccess([_])})}if(this.config.requireKeySystemAccessOnStart){const o=Xr(this.config);if(o.length)return this.emeController.getKeySystemAccess(o)}}return null}load(t){return!t.decryptdata&&t.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(t).then(n=>this.loadInternal(t,n)):this.loadInternal(t)}loadInternal(t,n){var s,o;n&&t.setKeyFormat(n);const l=t.decryptdata;if(!l){const g=new Error(n?`Expected frag.decryptdata to be defined after setting format ${n}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(t,q.KEY_LOAD_ERROR,g))}const u=l.uri;if(!u)return Promise.reject(this.createKeyLoadError(t,q.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${u}"`)));const d=Vl(l);let _=this.keyIdToKeyInfo[d];if((s=_)!=null&&s.decryptdata.key)return l.key=_.decryptdata.key,Promise.resolve({frag:t,keyInfo:_});if(this.emeController&&(o=_)!=null&&o.keyLoadPromise)switch(this.emeController.getKeyStatus(_.decryptdata)){case"usable":case"usable-in-future":return _.keyLoadPromise.then(v=>{const{keyInfo:y}=v;return l.key=y.decryptdata.key,{frag:t,keyInfo:y}})}switch(this.log(`${this.keyIdToKeyInfo[d]?"Rel":"L"}oading${l.keyId?" keyId: "+te(l.keyId):""} URI: ${l.uri} from ${t.type} ${t.level}`),_=this.keyIdToKeyInfo[d]={decryptdata:l,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},l.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return l.keyFormat==="identity"?this.loadKeyHTTP(_,t):this.loadKeyEME(_,t);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(_,t);default:return Promise.reject(this.createKeyLoadError(t,q.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${l.method}"`)))}}loadKeyEME(t,n){const s={frag:n,keyInfo:t};if(this.emeController&&this.config.emeEnabled){var o;if(!t.decryptdata.keyId&&(o=n.initSegment)!=null&&o.data){const u=Yt(n.initSegment.data);if(u.length){const d=u[0];d.some(_=>_!==0)&&(this.log(`Using keyId found in init segment ${te(d)}`),t.decryptdata.keyId=d,Mn.setKeyIdForUri(t.decryptdata.uri,d))}}const l=this.emeController.loadKey(s);return(t.keyLoadPromise=l.then(u=>(t.mediaKeySessionContext=u,s))).catch(u=>{throw t.keyLoadPromise=null,"data"in u&&(u.data.frag=n),u})}return Promise.resolve(s)}loadKeyHTTP(t,n){const s=this.config,o=s.loader,l=new o(s);return n.keyLoader=t.loader=l,t.keyLoadPromise=new Promise((u,d)=>{const _={keyInfo:t,frag:n,responseType:"arraybuffer",url:t.decryptdata.uri},g=s.keyLoadPolicy.default,v={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:(x,D,C,F)=>{const{frag:B,keyInfo:J}=C,ne=Vl(J.decryptdata);if(!B.decryptdata||J!==this.keyIdToKeyInfo[ne])return d(this.createKeyLoadError(B,q.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),F));J.decryptdata.key=B.decryptdata.key=new Uint8Array(x.data),B.keyLoader=null,J.loader=null,u({frag:B,keyInfo:J})},onError:(x,D,C,F)=>{this.resetLoader(D),d(this.createKeyLoadError(n,q.KEY_LOAD_ERROR,new Error(`HTTP Error ${x.code} loading key ${x.text}`),C,M({url:_.url,data:void 0},x)))},onTimeout:(x,D,C)=>{this.resetLoader(D),d(this.createKeyLoadError(n,q.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),C))},onAbort:(x,D,C)=>{this.resetLoader(D),d(this.createKeyLoadError(n,q.INTERNAL_ABORTED,new Error("key loading aborted"),C))}};l.load(_,v,y)})}resetLoader(t){const{frag:n,keyInfo:s,url:o}=t,l=s.loader;n.keyLoader===l&&(n.keyLoader=null,s.loader=null);const u=Vl(s.decryptdata)||o;delete this.keyIdToKeyInfo[u],l&&l.destroy()}}function Vl(h){if(h.keyFormat!==Ni.FAIRPLAY){const t=h.keyId;if(t)return te(t)}return h.uri}function Gl(h){const{type:t}=h;switch(t){case Te.AUDIO_TRACK:return P.AUDIO;case Te.SUBTITLE_TRACK:return P.SUBTITLE;default:return P.MAIN}}function ya(h,t){let n=h.url;return(n===void 0||n.indexOf("data:")===0)&&(n=t.url),n}class h0{constructor(t){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=t,this.registerListeners()}startLoad(t){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:t}=this;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_LOADING,this.onLevelLoading,this),t.off(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(t){const n=this.hls.config,s=n.pLoader,o=n.loader,l=s||o,u=new l(n);return this.loaders[t.type]=u,u}getInternalLoader(t){return this.loaders[t.type]}resetInternalLoader(t){this.loaders[t]&&delete this.loaders[t]}destroyInternalLoaders(){for(const t in this.loaders){const n=this.loaders[t];n&&n.destroy(),this.resetInternalLoader(t)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(t,n){const{url:s}=n;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Te.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(t,n){const{id:s,level:o,pathwayId:l,url:u,deliveryDirectives:d,levelInfo:_}=n;this.load({id:s,level:o,pathwayId:l,responseType:"text",type:Te.LEVEL,url:u,deliveryDirectives:d,levelOrTrack:_})}onAudioTrackLoading(t,n){const{id:s,groupId:o,url:l,deliveryDirectives:u,track:d}=n;this.load({id:s,groupId:o,level:null,responseType:"text",type:Te.AUDIO_TRACK,url:l,deliveryDirectives:u,levelOrTrack:d})}onSubtitleTrackLoading(t,n){const{id:s,groupId:o,url:l,deliveryDirectives:u,track:d}=n;this.load({id:s,groupId:o,level:null,responseType:"text",type:Te.SUBTITLE_TRACK,url:l,deliveryDirectives:u,levelOrTrack:d})}onLevelsUpdated(t,n){const s=this.loaders[Te.LEVEL];if(s){const o=s.context;o&&!n.levels.some(l=>l===o.levelOrTrack)&&(s.abort(),delete this.loaders[Te.LEVEL])}}load(t){var n;const s=this.hls.config;let o=this.getInternalLoader(t);if(o){const g=this.hls.logger,v=o.context;if(v&&v.levelOrTrack===t.levelOrTrack&&(v.url===t.url||v.deliveryDirectives&&!t.deliveryDirectives)){v.url===t.url?g.log(`[playlist-loader]: ignore ${t.url} ongoing request`):g.log(`[playlist-loader]: ignore ${t.url} in favor of ${v.url}`);return}g.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`),o.abort()}let l;if(t.type===Te.MANIFEST?l=s.manifestLoadPolicy.default:l=k({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),o=this.createInternalLoader(t),ce((n=t.deliveryDirectives)==null?void 0:n.part)){let g;if(t.type===Te.LEVEL&&t.level!==null?g=this.hls.levels[t.level].details:t.type===Te.AUDIO_TRACK&&t.id!==null?g=this.hls.audioTracks[t.id].details:t.type===Te.SUBTITLE_TRACK&&t.id!==null&&(g=this.hls.subtitleTracks[t.id].details),g){const v=g.partTarget,y=g.targetduration;if(v&&y){const x=Math.max(v*3,y*.8)*1e3;l=k({},l,{maxTimeToFirstByteMs:Math.min(x,l.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(x,l.maxTimeToFirstByteMs)})}}}const u=l.errorRetry||l.timeoutRetry||{},d={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:u.maxNumRetry||0,retryDelay:u.retryDelayMs||0,maxRetryDelay:u.maxRetryDelayMs||0},_={onSuccess:(g,v,y,x)=>{const D=this.getInternalLoader(y);this.resetInternalLoader(y.type);const C=g.data;v.parsing.start=performance.now(),cs.isMediaPlaylist(C)||y.type!==Te.MANIFEST?this.handleTrackOrLevelPlaylist(g,v,y,x||null,D):this.handleMasterPlaylist(g,v,y,x)},onError:(g,v,y,x)=>{this.handleNetworkError(v,y,!1,g,x)},onTimeout:(g,v,y)=>{this.handleNetworkError(v,y,!0,void 0,g)}};o.load(t,d,_)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:t,startPosition:n},forceStartLoad:s}=this.hls;(t||s)&&(this.hls.logger.log(`${t?"auto":"force"} startLoad with configured startPosition ${n}`),this.hls.startLoad(n))}handleMasterPlaylist(t,n,s,o){const l=this.hls,u=t.data,d=ya(t,s),_=cs.parseMasterPlaylist(u,d);if(_.playlistParsingError){n.parsing.end=performance.now(),this.handleManifestParsingError(t,s,_.playlistParsingError,o,n);return}const{contentSteering:g,levels:v,sessionData:y,sessionKeys:x,startTimeOffset:D,variableList:C}=_;this.variableList=C,v.forEach(ne=>{const{unknownCodecs:le}=ne;if(le){const{preferManagedMediaSource:Ee}=this.hls.config;let{audioCodec:Ie,videoCodec:tt}=ne;for(let Pe=le.length;Pe--;){const Ye=le[Pe];ye(Ye,"audio",Ee)?(ne.audioCodec=Ie=Ie?`${Ie},${Ye}`:Ye,Ft.audio[Ie.substring(0,4)]=2,le.splice(Pe,1)):ye(Ye,"video",Ee)&&(ne.videoCodec=tt=tt?`${tt},${Ye}`:Ye,Ft.video[tt.substring(0,4)]=2,le.splice(Pe,1))}}});const{AUDIO:F=[],SUBTITLES:B,"CLOSED-CAPTIONS":J}=cs.parseMasterPlaylistMedia(u,d,_);F.length&&!F.some(le=>!le.url)&&v[0].audioCodec&&!v[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),F.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new pn({}),bitrate:0,url:""})),l.trigger(S.MANIFEST_LOADED,{levels:v,audioTracks:F,subtitles:B,captions:J,contentSteering:g,url:d,stats:n,networkDetails:o,sessionData:y,sessionKeys:x,startTimeOffset:D,variableList:C})}handleTrackOrLevelPlaylist(t,n,s,o,l){const u=this.hls,{id:d,level:_,type:g}=s,v=ya(t,s),y=ce(_)?_:ce(d)?d:0,x=Gl(s),D=cs.parseLevelPlaylist(t.data,v,y,x,0,this.variableList);if(g===Te.MANIFEST){const C={attrs:new pn({}),bitrate:0,details:D,name:"",url:v};D.requestScheduled=n.loading.start+Vn(D,0),u.trigger(S.MANIFEST_LOADED,{levels:[C],audioTracks:[],url:v,stats:n,networkDetails:o,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}n.parsing.end=performance.now(),s.levelDetails=D,this.handlePlaylistLoaded(D,t,n,s,o,l)}handleManifestParsingError(t,n,s,o,l){this.hls.trigger(S.ERROR,{type:ge.NETWORK_ERROR,details:q.MANIFEST_PARSING_ERROR,fatal:n.type===Te.MANIFEST,url:t.url,err:s,error:s,reason:s.message,response:t,context:n,networkDetails:o,stats:l})}handleNetworkError(t,n,s=!1,o,l){let u=`A network ${s?"timeout":"error"+(o?" (status "+o.code+")":"")} occurred while loading ${t.type}`;t.type===Te.LEVEL?u+=`: ${t.level} id: ${t.id}`:(t.type===Te.AUDIO_TRACK||t.type===Te.SUBTITLE_TRACK)&&(u+=` id: ${t.id} group-id: "${t.groupId}"`);const d=new Error(u);this.hls.logger.warn(`[playlist-loader]: ${u}`);let _=q.UNKNOWN,g=!1;const v=this.getInternalLoader(t);switch(t.type){case Te.MANIFEST:_=s?q.MANIFEST_LOAD_TIMEOUT:q.MANIFEST_LOAD_ERROR,g=!0;break;case Te.LEVEL:_=s?q.LEVEL_LOAD_TIMEOUT:q.LEVEL_LOAD_ERROR,g=!1;break;case Te.AUDIO_TRACK:_=s?q.AUDIO_TRACK_LOAD_TIMEOUT:q.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case Te.SUBTITLE_TRACK:_=s?q.SUBTITLE_TRACK_LOAD_TIMEOUT:q.SUBTITLE_LOAD_ERROR,g=!1;break}v&&this.resetInternalLoader(t.type);const y={type:ge.NETWORK_ERROR,details:_,fatal:g,url:t.url,loader:v,context:t,error:d,networkDetails:n,stats:l};if(o){const x=(n==null?void 0:n.url)||t.url;y.response=M({url:x,data:void 0},o)}this.hls.trigger(S.ERROR,y)}handlePlaylistLoaded(t,n,s,o,l,u){const d=this.hls,{type:_,level:g,levelOrTrack:v,id:y,groupId:x,deliveryDirectives:D}=o,C=ya(n,o),F=Gl(o);let B=typeof o.level=="number"&&F===P.MAIN?g:void 0;const J=t.playlistParsingError;if(J){if(this.hls.logger.warn(`${J} ${t.url}`),!d.config.ignorePlaylistParsingErrors){d.trigger(S.ERROR,{type:ge.NETWORK_ERROR,details:q.LEVEL_PARSING_ERROR,fatal:!1,url:C,error:J,reason:J.message,response:n,context:o,level:B,parent:F,networkDetails:l,stats:s});return}t.playlistParsingError=null}if(!t.fragments.length){const ne=t.playlistParsingError=new Error("No Segments found in Playlist");d.trigger(S.ERROR,{type:ge.NETWORK_ERROR,details:q.LEVEL_EMPTY_ERROR,fatal:!1,url:C,error:ne,reason:ne.message,response:n,context:o,level:B,parent:F,networkDetails:l,stats:s});return}switch(t.live&&u&&(u.getCacheAge&&(t.ageHeader=u.getCacheAge()||0),(!u.getCacheAge||isNaN(t.ageHeader))&&(t.ageHeader=0)),_){case Te.MANIFEST:case Te.LEVEL:if(B){if(!v)B=0;else if(v!==d.levels[B]){const ne=d.levels.indexOf(v);ne>-1&&(B=ne)}}d.trigger(S.LEVEL_LOADED,{details:t,levelInfo:v||d.levels[0],level:B||0,id:y||0,stats:s,networkDetails:l,deliveryDirectives:D,withoutMultiVariant:_===Te.MANIFEST});break;case Te.AUDIO_TRACK:d.trigger(S.AUDIO_TRACK_LOADED,{details:t,track:v,id:y||0,groupId:x||"",stats:s,networkDetails:l,deliveryDirectives:D});break;case Te.SUBTITLE_TRACK:d.trigger(S.SUBTITLE_TRACK_LOADED,{details:t,track:v,id:y||0,groupId:x||"",stats:s,networkDetails:l,deliveryDirectives:D});break}}}class Ba{static get version(){return $o}static isMSESupported(){return Wf()}static isSupported(){return o0()}static getMediaSource(){return Oe()}static get Events(){return S}static get MetadataSchema(){return hs}static get ErrorTypes(){return ge}static get ErrorDetails(){return q}static get DefaultConfig(){return Ba.defaultConfig?Ba.defaultConfig:Jd}static set DefaultConfig(t){Ba.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new uu,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 n=this.logger=Se(t.debug||!1,"Hls instance",t.assetPlayerId),s=this.config=e0(Ba.DefaultConfig,t,n);this.userConfig=t,s.progressive&&Vf(s,n);const{abrController:o,bufferController:l,capLevelController:u,errorController:d,fpsController:_}=s,g=new d(this),v=this.abrController=new o(this),y=new or(this),x=s.interstitialsController,D=x?this.interstitialsController=new x(this,Ba):null,C=this.bufferController=new l(this,y),F=this.capLevelController=new u(this),B=new _(this),J=new h0(this),ne=s.contentSteeringController,le=ne?new ne(this):null,Ee=this.levelController=new Ul(this,le),Ie=new a0(this),tt=new c0(this.config,this.logger),Pe=this.streamController=new zl(this,y,tt),Ye=this.gapController=new r0(this,y);F.setStreamController(Pe),B.setStreamController(Pe);const qe=[J,Ee,Pe];D&&qe.splice(1,0,D),le&&qe.splice(1,0,le),this.networkControllers=qe;const Fe=[v,C,Ye,F,B,Ie,y];this.audioTrackController=this.createController(s.audioTrackController,qe);const mt=s.audioStreamController;mt&&qe.push(this.audioStreamController=new mt(this,y,tt)),this.subtitleTrackController=this.createController(s.subtitleTrackController,qe);const Zt=s.subtitleStreamController;Zt&&qe.push(this.subtititleStreamController=new Zt(this,y,tt)),this.createController(s.timelineController,Fe),tt.emeController=this.emeController=this.createController(s.emeController,Fe),this.cmcdController=this.createController(s.cmcdController,Fe),this.latencyController=this.createController(Kl,Fe),this.coreComponents=Fe,qe.push(g);const ui=g.onErrorOut;typeof ui=="function"&&this.on(S.ERROR,ui,g),this.on(S.MANIFEST_LOADED,J.onManifestLoaded,J)}createController(t,n){if(t){const s=new t(this);return n&&n.push(s),s}return null}on(t,n,s=this){this._emitter.on(t,n,s)}once(t,n,s=this){this._emitter.once(t,n,s)}removeAllListeners(t){this._emitter.removeAllListeners(t)}off(t,n,s=this,o){this._emitter.off(t,n,s,o)}listeners(t){return this._emitter.listeners(t)}emit(t,n,s){return this._emitter.emit(t,n,s)}trigger(t,n){if(this.config.debug)return this.emit(t,t,n);try{return this.emit(t,t,n)}catch(s){if(this.logger.error("An internal error happened while handling event "+t+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const o=t===S.ERROR;this.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:q.INTERNAL_EXCEPTION,fatal:o,event:t,error:s}),this.triggeringException=!1}}return!1}listenerCount(t){return this._emitter.listenerCount(t)}destroy(){this.logger.log("destroy"),this.trigger(S.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(n=>n.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(n=>n.destroy()),this.coreComponents.length=0;const t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}attachMedia(t){if(!t||"media"in t&&!t.media){const l=new Error(`attachMedia failed: invalid argument (${t})`);this.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:q.ATTACH_MEDIA_ERROR,fatal:!0,error:l});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const n="media"in t,s=n?t.media:t,o=n?t:{media:s};this._media=s,this.trigger(S.MEDIA_ATTACHING,o)}detachMedia(){this.logger.log("detachMedia"),this.trigger(S.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const t=this.bufferController.transferMedia();return this.trigger(S.MEDIA_DETACHING,{transferMedia:t}),t}loadSource(t){this.stopLoad();const n=this.media,s=this._url,o=this._url=A.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${o}`),n&&s&&(s!==o||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(n)),this.trigger(S.MANIFEST_LOADING,{url:t})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(t=-1,n){this.logger.log(`startLoad(${t+(n?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let s=0;s<this.networkControllers.length&&(this.networkControllers[s].startLoad(t,n),!(!this.started||!this.networkControllers));s++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].stopLoad(),!(this.started||!this.networkControllers));t++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(t=>{t.resumeBuffering&&t.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(t=>{t.pauseBuffering&&t.pauseBuffering()}))}get inFlightFragments(){const t={[P.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(t[P.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(t[P.SUBTITLE]=this.subtititleStreamController.inFlightFrag),t}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const t=this._media,n=t==null?void 0:t.currentTime;this.detachMedia(),t&&(this.attachMedia(t),n&&this.startLoad(n))}removeLevel(t){this.levelController.removeLevel(t)}get sessionId(){let t=this._sessionId;return t||(t=this._sessionId=Fd()),t}get levels(){const t=this.levelController.levels;return t||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(t){this.logger.log(`set currentLevel:${t}`),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(t){this.logger.log(`set nextLevel:${t}`),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(t){this.logger.log(`set loadLevel:${t}`),this.levelController.manualLevel=t}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(t){this.levelController.nextLoadLevel=t}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(t){this.logger.log(`set firstLevel:${t}`),this.levelController.firstLevel=t}get startLevel(){const t=this.levelController.startLevel;return t===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t}set startLevel(t){this.logger.log(`set startLevel:${t}`),t!==-1&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(t){const n=!!t;n!==this.config.capLevelToPlayerSize&&(n?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=n)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimate():NaN}set bandwidthEstimate(t){this.abrController.resetEstimator(t)}get abrEwmaDefaultEstimate(){const{bwEstimator:t}=this.abrController;return t?t.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimateTTFB():NaN}set autoLevelCapping(t){this._autoLevelCapping!==t&&(this.logger.log(`set autoLevelCapping:${t}`),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(t){wn(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:t,config:{minAutoBitrate:n}}=this;if(!t)return 0;const s=t.length;for(let o=0;o<s;o++)if(t[o].maxBitrate>=n)return o;return 0}get maxAutoLevel(){const{levels:t,autoLevelCapping:n,maxHdcpLevel:s}=this;let o;if(n===-1&&t!=null&&t.length?o=t.length-1:o=n,s)for(let l=o;l--;){const u=t[l].attrs["HDCP-LEVEL"];if(u&&u<=s)return l}return o}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(t){this.abrController.nextAutoLevel=t}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(t){var n;return((n=this.audioTrackController)==null?void 0:n.setAudioOption(t))||null}setSubtitleOption(t){var n;return((n=this.subtitleTrackController)==null?void 0:n.setSubtitleOption(t))||null}get allAudioTracks(){const t=this.audioTrackController;return t?t.allAudioTracks:[]}get audioTracks(){const t=this.audioTrackController;return t?t.audioTracks:[]}get audioTrack(){const t=this.audioTrackController;return t?t.audioTrack:-1}set audioTrack(t){const n=this.audioTrackController;n&&(n.audioTrack=t)}get allSubtitleTracks(){const t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}get subtitleTracks(){const t=this.subtitleTrackController;return t?t.subtitleTracks:[]}get subtitleTrack(){const t=this.subtitleTrackController;return t?t.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(t){const n=this.subtitleTrackController;n&&(n.subtitleTrack=t)}get subtitleDisplay(){const t=this.subtitleTrackController;return t?t.subtitleDisplay:!1}set subtitleDisplay(t){const n=this.subtitleTrackController;n&&(n.subtitleDisplay=t)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(t){this.config.lowLatencyMode=t}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(t){this.latencyController.targetLatency=t}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(t){this.levelController.pathwayPriority=t}get bufferedToEnd(){var t;return!!((t=this.bufferController)!=null&&t.bufferedToEnd)}get interstitialsManager(){var t;return((t=this.interstitialsController)==null?void 0:t.interstitialsManager)||null}getMediaDecodingInfo(t,n=this.allAudioTracks){const s=wt(n);return Xi(t,s,navigator.mediaCapabilities)}}Ba.defaultConfig=void 0},48136:function(Li,It,oe){"use strict";var ce=Object.defineProperty,De=Object.defineProperties,Ze=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,Te=(e,i,r)=>i in e?ce(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,P=(e,i)=>{for(var r in i||(i={}))q.call(i,r)&&Te(e,r,i[r]);if(ge)for(var r of ge(i))S.call(i,r)&&Te(e,r,i[r]);return e},f=(e,i)=>De(e,Ze(i)),re=e=>typeof e=="symbol"?e:e+"",R=(e,i)=>{var r={};for(var a in e)q.call(e,a)&&i.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&ge)for(var a of ge(e))i.indexOf(a)<0&&S.call(e,a)&&(r[a]=e[a]);return r};function k(e){return Array.isArray(e)}var T={en:{"keyboard.tooltip.symbols":"\u7B26\u53F7","keyboard.tooltip.greek":"\u5E0C\u814A\u5B57\u6BCD","keyboard.tooltip.numeric":"\u6570\u5B57","keyboard.tooltip.alphabetic":"\u7F57\u9A6C\u5B57\u6BCD","tooltip.cut to clipboard":"\u526A\u5207\u5230\u526A\u8D34\u677F","tooltip.copy to clipboard":"\u590D\u5236\u5230\u526A\u8D34\u677F","tooltip.paste from clipboard":"\u7C98\u8D34","tooltip.redo":"\u91CD\u505A","tooltip.toggle virtual keyboard":"\u5207\u6362\u865A\u62DF\u952E\u76D8","tooltip.undo":"\u64A4\u6D88","menu.insert matrix":"\u63D2\u5165\u77E9\u9635","menu.borders":"\u77E9\u9635\u5206\u9694\u7B26","menu.array.add row above":"\u5728\u540E\u9762\u6DFB\u52A0\u884C","menu.array.add row below":"\u5728\u524D\u9762\u6DFB\u52A0\u884C","menu.array.add column after":"\u5728\u540E\u9762\u6DFB\u52A0\u5217r","menu.array.add column before":"\u5728\u524D\u9762\u6DFB\u52A0\u5217","menu.array.delete row":"\u5220\u9664\u884C","menu.array.delete rows":"\u5220\u9664\u9009\u5B9A\u884C","menu.array.delete column":"\u5220\u9664\u5217","menu.array.delete columns":"\u5220\u9664\u9009\u5B9A\u7684\u5217","menu.mode":"\u6A21\u5F0F","menu.mode-math":"\u6570\u5B66","menu.mode-text":"\u6587\u672C","menu.mode-latex":"LaTeX","tooltip.blackboard":"\u9ED1\u677F","tooltip.bold":"\u7C97\u4F53","tooltip.italic":"\u659C\u4F53","tooltip.fraktur":"Fraktur","tooltip.script":"\u811A\u672C","tooltip.caligraphic":"\u8349\u4E66","tooltip.typewriter":"\u6253\u5B57\u673A","tooltip.roman-upright":"\u7F57\u9A6C\u76F4\u7ACB","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u5B57\u4F53\u6837\u5F0F","menu.accent":"\u91CD\u97F3","menu.decoration":"\u88C5\u9970","menu.color":"\u989C\u8272","menu.background-color":"\u80CC\u666F","menu.evaluate":"\u8BA1\u7B97","menu.simplify":"\u7B80\u5316","menu.solve":"\u6C42\u89E3","menu.solve-for":"\u6C42\u89E3 %@","menu.cut":"\u526A\u5207","menu.copy":"\u590D\u5236","menu.copy-as-latex":"\u590D\u5236\u4E3A LaTeX","menu.copy-as-ascii-math":"\u590D\u5236\u4E3A ASCII Math","menu.copy-as-mathml":"\u590D\u5236\u4E3A MathML","menu.paste":"\u7C98\u8D34","menu.select-all":"\u5168\u9009","color.red":"\u7EA2\u8272","color.orange":"\u6A59\u8272","color.yellow":"\u9EC4\u8272","color.lime":"\u7EFF\u9EC4\u8272","color.green":"\u7EFF\u8272","color.teal":"\u9752\u8272","color.cyan":"\u84DD\u7EFF\u8272","color.blue":"\u84DD\u8272","color.indigo":"\u975B\u84DD\u8272","color.purple":"\u7D2B\u8272","color.magenta":"\u6D0B\u7EA2\u8272","color.black":"\u9ED1\u8272","color.dark-grey":"\u6DF1\u7070\u8272","color.grey":"\u7070\u8272","color.light-grey":"\u6D45\u7070\u8272","color.white":"\u767D\u8272"}};function M(){return"window"in globalThis&&"document"in globalThis}function O(){return"matchMedia"in window?window.matchMedia("(pointer: coarse)").matches:"ontouchstart"in window||navigator.maxTouchPoints>0}function Y(){return typeof navigator.vibrate=="function"}function H(){var e,i;if(!M())return"other";const r=(i=(e=navigator.userAgentData)==null?void 0:e.platform)!=null?i:navigator.platform;return/^mac/i.test(r)?navigator.maxTouchPoints===5?"ios":"macos":/^win/i.test(r)?"windows":/android/i.test(navigator.userAgent)?"android":/iphone|ipod|ipad/i.test(navigator.userAgent)?"ios":/\bcros\b/i.test(navigator.userAgent)?"chromeos":"other"}function j(){if(!M())return!0;if(/firefox/i.test(navigator.userAgent)){const e=navigator.userAgent.match(/firefox\/(\d+)/i);return e?parseInt(e[1])>=78:!1}if(/trident/i.test(navigator.userAgent))return!1;if(/edge/i.test(navigator.userAgent)){const e=navigator.userAgent.match(/edg\/(\d+)/i);return e?parseInt(e[1])>=79:!1}return!0}function U(){return HTMLElement.prototype.hasOwnProperty("popover")}var $={strings:T,_locale:"",_dirty:!1,_subscribers:[],_numberFormatter:void 0,get locale(){return $._locale||($._locale=M()?navigator.language.slice(0,5):"en-US"),$._locale},set locale(e){$._locale=e,$._numberFormatter=void 0,$.dirty=!0},get numberFormatter(){return $._numberFormatter||($._numberFormatter=new Intl.NumberFormat($.locale)),$._numberFormatter},merge(e,i){if(typeof e=="string"&&i)$.strings[e]=P(P({},$.strings[e]),i),$.dirty=!0;else for(const r of Object.keys(e))$.merge(r,e[r])},get dirty(){return $._dirty},set dirty(e){$._dirty||$._dirty===e||($._dirty=!0,setTimeout(()=>{$._dirty=!1,this._subscribers.forEach(i=>i==null?void 0:i())},0))},subscribe(e){return $._subscribers.push(e),$._subscribers.length-1},unsubscribe(e){e<0||e>=$._subscribers.length||($._subscribers[e]=void 0)},update(e){let i=e.querySelectorAll("[data-l10n-tooltip]");for(const r of i){const a=r.getAttribute("data-l10n-tooltip");if(a){const c=G(a);c&&r.setAttribute("data-tooltip",c)}}i=e.querySelectorAll("[data-l10n-arial-label]");for(const r of i){const a=r.getAttribute("data-l10n-arial-label");if(a){const c=G(a);c&&r.setAttribute("aria-label",c)}}}};function G(e,...i){if(e===void 0)return;let r="";const a=$.locale;$.strings[a]&&(r=$.strings[a][e]);const c=a.slice(0,2);if(!r&&$.strings[c]&&(r=$.strings[c][e]),r||(r=$.strings.en[e]),!r)return;const p=/(%@|%([0-9]+)\$@)/g;let m=p.exec(r),b=0;for(;m;){if(i[b++]){const E=m[2]?parseInt(m[2],10)-1:b-1;let I=i[E];typeof I=="number"&&(I=$.numberFormatter.format(I)),r=r.replace(m[1],I)}m=p.exec(r)}return r=r.replace(/%%/g,"%"),r}var fe={m0:"#3F3D99",m1:"#993D71",m2:"#998B3D",m3:"#3D9956",m4:"#3D5A99",m5:"#993D90",m6:"#996D3D",m7:"#43993D",m8:"#3D7999",m9:"#843D99"},be={blue:"#0072BD",orange:"#D95319",yellow:"#EDB120",purple:"#7E2F8E",green:"#77AC30",cyan:"#4DBEEE",red:"#A2142F"},Se={red:"#fbbbb6",orange:"#ffe0c2",yellow:"#fff1c2",lime:"#d0e8b9",green:"#bceac4",teal:"#b9f1f1",cyan:"#b8e5c9",blue:"#b6d9fb",indigo:"#d1c2f0",purple:"#e3baf8",magenta:"#f9c8e0",black:"#353535","dark-grey":"#8C8C8C",grey:"#D0D0D0","light-grey":"#F0F0F0",white:"#ffffff"},se={red:"#d7170b",orange:"#fe8a2b",yellow:"#ffc02b",lime:"#63b215",green:"#21ba3a",teal:"#17cfcf",cyan:"#13a7ec",blue:"#0d80f2",indigo:"#63c",purple:"#a219e6",magenta:"#eb4799",black:"#000","dark-grey":"#666",grey:"#A6A6A6","light-grey":"#d4d5d2",white:"#ffffff"},Oe={Red:"red",Orange:"orange",Yellow:"yellow",LimeGreen:"lime",Green:"green",TealBlue:"teal",Blue:"blue",Violet:"indigo",Purple:"purple",Magenta:"magenta",Black:"black",Gray:"grey",White:"white"},We={Apricot:"#FBB982",Aquamarine:"#00B5BE",Bittersweet:"#C04F17",Black:"#221E1F",Blue:"#2D2F92",BlueGreen:"#00B3B8",BlueViolet:"#473992",BrickRed:"#B6321C",Brown:"#792500",BurntOrange:"#F7921D",CadetBlue:"#74729A",CarnationPink:"#F282B4",Cerulean:"#00A2E3",CornflowerBlue:"#41B0E4",Cyan:"#00AEEF",Dandelion:"#FDBC42",DarkOrchid:"#A4538A",Emerald:"#00A99D",ForestGreen:"#009B55",Fuchsia:"#8C368C",Goldenrod:"#FFDF42",Gray:"#949698",Green:"#00A64F",GreenYellow:"#DFE674",JungleGreen:"#00A99A",Lavender:"#F49EC4",Limegreen:"#8DC73E",Magenta:"#EC008C",Mahogany:"#A9341F",Maroon:"#AF3235",Melon:"#F89E7B",MidnightBlue:"#006795",Mulberry:"#A93C93",NavyBlue:"#006EB8",OliveGreen:"#3C8031",Orange:"#F58137",OrangeRed:"#ED135A",Orchid:"#AF72B0",Peach:"#F7965A",Periwinkle:"#7977B8",PineGreen:"#008B72",Plum:"#92268F",ProcessBlue:"#00B0F0",Purple:"#99479B",RawSienna:"#974006",Red:"#ED1B23",RedOrange:"#F26035",RedViolet:"#A1246B",Rhodamine:"#EF559F",RoyalBlue:"#0071BC",RoyalPurple:"#613F99",RubineRed:"#ED017D",Salmon:"#F69289",SeaGreen:"#3FBC9D",Sepia:"#671800",SkyBlue:"#46C5DD",SpringGreen:"#C6DC67",Tan:"#DA9D76",TealBlue:"#00AEB3",Thistle:"#D883B7",Turquoise:"#00B4CE",Violet:"#58429B",VioletRed:"#EF58A0",White:"#FFFFFF",WildStrawberry:"#EE2967",Yellow:"#FFF200",YellowGreen:"#98CC70",YellowOrange:"#FAA21A"};function Be(e){var i,r,a,c,p,m;const b=e.split("!");let w,E,I,N=255,Z=255,ue=255,me=-1;const Ge=b.length>0&&b[0].startsWith("-");Ge&&(b[0]=b[0].slice(1));for(let Lt=0;Lt<b.length;Lt++){w=N,E=Z,I=ue;const Ue=(i=b[Lt].trim().match(/^([A-Za-z\d-]+)/))==null?void 0:i[1],ct=Ue==null?void 0:Ue.toLowerCase(),Rt=Ue&&(m=(p=(c=(a=(r=se[ct])!=null?r:se[Oe[Ue]])!=null?a:be[Ue])!=null?c:We[Ue])!=null?p:fe[Ue])!=null?m:b[Lt].trim();let yt=Rt.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if(yt!=null&&yt[1]&&yt[2]&&yt[3])N=Math.max(0,Math.min(255,Number.parseInt(yt[1],16))),Z=Math.max(0,Math.min(255,Number.parseInt(yt[2],16))),ue=Math.max(0,Math.min(255,Number.parseInt(yt[3],16)));else if(yt=Rt.match(/^#([\da-f]{3})$/i),yt!=null&&yt[1]){const Jt=Number.parseInt(yt[1][0],16),hi=Number.parseInt(yt[1][1],16),ri=Number.parseInt(yt[1][2],16);N=Math.max(0,Math.min(255,Jt*16+Jt)),Z=Math.max(0,Math.min(255,hi*16+hi)),ue=Math.max(0,Math.min(255,ri*16+ri))}else if(yt=Rt.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i),yt!=null&&yt[1]&&yt[2]&&yt[3])N=Math.max(0,Math.min(255,Number.parseInt(yt[1]))),Z=Math.max(0,Math.min(255,Number.parseInt(yt[2]))),ue=Math.max(0,Math.min(255,Number.parseInt(yt[3])));else return;me>=0&&(N=(1-me)*N+me*w,Z=(1-me)*Z+me*E,ue=(1-me)*ue+me*I,me=-1),Lt+1<b.length&&(me=Math.max(0,Math.min(100,Number.parseInt(b[++Lt])))/100)}return me>=0&&(N=me*N+(1-me)*w,Z=me*Z+(1-me)*E,ue=me*ue+(1-me)*I),Ge&&(N=255-N,Z=255-Z,ue=255-ue),"#"+("00"+Math.round(N).toString(16)).slice(-2)+("00"+Math.round(Z).toString(16)).slice(-2)+("00"+Math.round(ue).toString(16)).slice(-2)}function At(e){var i,r;return e=e.trim(),(r=(i=Se[e.toLowerCase()])!=null?i:Se[Oe[e]])!=null?r:Be(e)}function te(e){if(!e||e[0]!=="#")return;e=e.slice(1);let i;return e.length<=4?(i={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},e.length===4&&(i.a=parseInt(e[3]+e[3],16)/255)):(i={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},e.length===8&&(i.a=parseInt(e[6]+e[7],16)/255)),i&&i.a===void 0&&(i.a=1),i}function z(e,i,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?(i-e)*r+e:r<3?i:r<4?(i-e)*(4-r)+e:e}function X(e){let[i,r,a]=[e.h,e.s,e.l];i=(i+360)%360/60,a=Math.max(0,Math.min(a,1)),r=Math.max(0,Math.min(r,1));const c=a<=.5?a*(r+1):a+r-a*r,p=a*2-c;return{r:Math.round(255*z(p,c,i+2)),g:Math.round(255*z(p,c,i)),b:Math.round(255*z(p,c,i-2))}}function Q(e){return e<0?0:e>255?255:Math.round(e)}function de(e){const{r:i,g:r,b:a}=e;let c=((1<<24)+(Q(i)<<16)+(Q(r)<<8)+Q(a)).toString(16).slice(1);return c[0]===c[1]&&c[2]===c[3]&&c[4]===c[5]&&c[6]===c[7]&&(c=c[0]+c[2]+c[4]),"#"+c}function ie(e){let{r:i,g:r,b:a}=e;i=i/255,r=r/255,a=a/255;const c=Math.min(i,r,a),p=Math.max(i,r,a),m=p-c;let b,w;p===c?b=0:i===p?b=(r-a)/m:r===p?b=2+(a-i)/m:a===p&&(b=4+(i-r)/m),b=Math.min(b*60,360),b<0&&(b+=360);const E=(c+p)/2;return p===c?w=0:E<=.5?w=m/(p+c):w=m/(2-p-c),{h:b,s:w,l:E}}function A(e){let i=te(e);if(!i)return e;let{h:r,s:a,l:c}=ie(i);return a+=.1,c-=.1,de(X({h:r,s:a,l:c}))}var L={60:"\\lt",62:"\\gt",111:"o",38:"\\&",123:"\\lbrace",125:"\\rbrace",91:"\\lbrack",93:"\\rbrack",58:"\\colon",160:"~",172:"\\neg",183:"\\cdot",188:"\\frac{1}{4}",189:"\\frac{1}{2}",190:"\\frac{3}{4}",8304:"^{0}",8305:"^{i}",185:"^{1}",178:"^{2}",179:"^{3}",8224:"\\dagger",8225:"\\ddagger",8230:"\\ldots",8308:"^{4}",8309:"^{5}",8310:"^{6}",8311:"^{7}",8312:"^{8}",8313:"^{9}",8314:"^{+}",8315:"^{-}",8316:"^{=}",8319:"^{n}",8320:"_{0}",8321:"_{1}",8322:"_{2}",8323:"_{3}",8324:"_{4}",8325:"_{5}",8326:"_{6}",8327:"_{7}",8328:"_{8}",8329:"_{9}",8330:"_{+}",8331:"_{-}",8332:"_{=}",8336:"_{a}",8337:"_{e}",8338:"_{o}",8339:"_{x}",8242:"\\prime",39:"\\prime",8592:"\\gets",8594:"\\to",9651:"\\triangle",9661:"\\triangledown",8715:"\\owns",8727:"\\ast",8739:"\\vert",8741:"\\Vert",8743:"\\land",8744:"\\lor",8901:"\\cdot",8904:"\\bowtie",8800:"\\ne",8804:"\\le",8805:"\\ge",8869:"\\bot",10231:"\\biconditional",10232:"\\impliedby",10233:"\\implies",10234:"\\iff",8450:"\\mathbb{C}",8469:"\\mathbb{N}",8473:"\\mathbb{P}",8474:"\\mathbb{Q}",8477:"\\mathbb{R}",8484:"\\mathbb{Z}",8461:"\\mathbb{H}",8476:"\\Re",8465:"\\Im",42:"\\ast",11036:"\\square",9633:"\\square",8720:"\\coprod",8716:"\\not\\ni",9671:"\\diamond",8846:"\\uplus",8851:"\\sqcap",8852:"\\sqcup",8768:"\\wr",8750:"\\oint",8226:"\\textbullet",8722:"-",978:"\\Upsilon"},V={119893:8462,119965:8492,119968:8496,119969:8497,119971:8459,119972:8464,119975:8466,119976:8499,119981:8475,119994:8495,119996:8458,120004:8500,120070:8493,120075:8460,120076:8465,120085:8476,120093:8488,120122:8450,120127:8461,120133:8469,120135:8473,120136:8474,120137:8477,120145:8484},pe=[{start:119808,len:26,offset:65,style:"bold"},{start:119834,len:26,offset:97,style:"bold"},{start:119860,len:26,offset:65,style:"italic"},{start:119886,len:26,offset:97,style:"italic"},{start:119912,len:26,offset:65,style:"bolditalic"},{start:119938,len:26,offset:97,style:"bolditalic"},{start:119964,len:26,offset:65,variant:"script"},{start:119990,len:26,offset:97,variant:"script"},{start:120016,len:26,offset:65,variant:"script",style:"bold"},{start:120042,len:26,offset:97,variant:"script",style:"bold"},{start:120068,len:26,offset:65,variant:"fraktur"},{start:120094,len:26,offset:97,variant:"fraktur"},{start:120172,len:26,offset:65,variant:"fraktur",style:"bold"},{start:120198,len:26,offset:97,variant:"fraktur",style:"bold"},{start:120120,len:26,offset:65,variant:"double-struck"},{start:120146,len:26,offset:97,variant:"double-struck"},{start:120224,len:26,offset:65,variant:"sans-serif"},{start:120250,len:26,offset:97,variant:"sans-serif"},{start:120276,len:26,offset:65,variant:"sans-serif",style:"bold"},{start:120302,len:26,offset:97,variant:"sans-serif",style:"bold"},{start:120328,len:26,offset:65,variant:"sans-serif",style:"italic"},{start:120354,len:26,offset:97,variant:"sans-serif",style:"italic"},{start:120380,len:26,offset:65,variant:"sans-serif",style:"bolditalic"},{start:120406,len:26,offset:97,variant:"sans-serif",style:"bolditalic"},{start:120432,len:26,offset:65,variant:"monospace"},{start:120458,len:26,offset:97,variant:"monospace"},{start:120488,len:25,offset:913,style:"bold"},{start:120514,len:25,offset:945,style:"bold"},{start:120546,len:25,offset:913,style:"italic"},{start:120572,len:25,offset:945,style:"italic"},{start:120604,len:25,offset:913,style:"bolditalic"},{start:120630,len:25,offset:945,style:"bolditalic"},{start:120662,len:25,offset:913,variant:"sans-serif",style:"bold"},{start:120688,len:25,offset:945,variant:"sans-serif",style:"bold"},{start:120720,len:25,offset:913,variant:"sans-serif",style:"bolditalic"},{start:120746,len:25,offset:945,variant:"sans-serif",style:"bolditalic"},{start:120782,len:10,offset:48,variant:"main",style:"bold"},{start:120792,len:10,offset:48,variant:"double-struck"},{start:120803,len:10,offset:48,variant:"sans-serif"},{start:120812,len:10,offset:48,variant:"sans-serif",style:"bold"},{start:120822,len:10,offset:48,variant:"monospace"}];function ze(e,i,r){if(!/[A-Za-z\d]/.test(e)||(r==="up"&&(r=void 0),!i&&!r))return e;const a=e.codePointAt(0);if(a===void 0)return e;for(const c of pe)if((!i||c.variant===i)&&(!r||c.style===r)&&a>=c.offset&&a<c.offset+c.len){const p=c.start+a-c.offset;return String.fromCodePoint(V[p]||p)}return e}function at(e){var i;if((e<119808||e>120831)&&(e<8448||e>8527))return{char:String.fromCodePoint(e)};for(const r in V)if(V[r]===e){e=(i=r.codePointAt(0))!=null?i:0;break}for(const r of pe)if(e>=r.start&&e<r.start+r.len)return{char:String.fromCodePoint(e-r.start+r.offset),variant:r.variant,style:r.style};return{char:String.fromCodePoint(e)}}function Bt(e){var i;let r="";for(const a of e){if("{}<>[]$&#^_%:'\u02DC".includes(a)){r+=a;continue}const c=(i=a.codePointAt(0))!=null?i:0;let p=L[c];if(p)p.startsWith("\\")?r+=p+" ":r+=p;else{const{char:m,variant:b,style:w}=at(c);switch(p=m,b){case"double-struck":p=`\\mathbb{${p}}`;break;case"fraktur":p=`\\mathfrak{${p}}`;break;case"script":p=`\\mathscr{${p}}`;break;case"sans-serif":p=`\\mathsf{${p}}`;break;case"monospace":p=`\\mathtt{${p}}`;break;case"calligraphic":p=`\\mathcal{${p}}`;break}switch(w){case"bold":p=`\\mathbf{${p}}`;break;case"italic":p=`\\mathit{${p}}`;break;case"bolditalic":p=`\\mathbfit{${p}}`;break}r+=p}}return r}function Me(e){return e?Array.isArray(e)?e:typeof e=="object"&&"group"in e?e.group:[]:[]}var Ht={},Dt=P({},L),ft={},Si={},di={darr:"\\downarrow",dArr:"\\Downarrow",Darr:"\\Downarrow",lang:"\\langle",rang:"\\rangle",uarr:"\\uparrow",uArr:"\\Uparrow",Uarr:"\\Uparrow",N:"\\mathbb{N}",R:"\\mathbb{R}",Z:"\\mathbb{Z}",alef:"\\aleph",alefsym:"\\aleph",Alpha:"\\mathrm{A}",Beta:"\\mathrm{B}",bull:"\\bullet",Chi:"\\mathrm{X}",clubs:"\\clubsuit",cnums:"\\mathbb{C}",Complex:"\\mathbb{C}",Dagger:"\\ddagger",diamonds:"\\diamondsuit",empty:"\\emptyset",Epsilon:"\\mathrm{E}",Eta:"\\mathrm{H}",exist:"\\exists",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",Harr:"\\Leftrightarrow",hearts:"\\heartsuit",image:"\\Im",infin:"\\infty",Iota:"\\mathrm{I}",isin:"\\in",Kappa:"\\mathrm{K}",larr:"\\leftarrow",lArr:"\\Leftarrow",Larr:"\\Leftarrow",lrarr:"\\leftrightarrow",lrArr:"\\Leftrightarrow",Lrarr:"\\Leftrightarrow",Mu:"\\mathrm{M}",natnums:"\\mathbb{N}",Nu:"\\mathrm{N}",Omicron:"\\mathrm{O}",plusmn:"\\pm",rarr:"\\rightarrow",rArr:"\\Rightarrow",Rarr:"\\Rightarrow",real:"\\Re",reals:"\\mathbb{R}",Reals:"\\mathbb{R}",Rho:"\\mathrm{P}",sdot:"\\cdot",sect:"\\S",spades:"\\spadesuit",sub:"\\subset",sube:"\\subseteq",supe:"\\supseteq",Tau:"\\mathrm{T}",thetasym:"\\vartheta",weierp:"\\wp",Zeta:"\\mathrm{Z}"},tn={varGamma:"\\mathit{\\Gamma}",varDelta:"\\mathit{\\Delta}",varTheta:"\\mathit{\\Theta}",varLambda:"\\mathit{\\Lambda}",varXi:"\\mathit{\\Xi}",varPi:"\\mathit{\\Pi}",varSigma:"\\mathit{\\Sigma}",varUpsilon:"\\mathit{\\Upsilon}",varPhi:"\\mathit{\\Phi}",varPsi:"\\mathit{\\Psi}",varOmega:"\\mathit{\\Omega}",pmod:{def:"\\quad(\\operatorname{mod}\\ #1)",args:1,expand:!1,captureSelection:!1},mod:{def:"\\quad\\operatorname{mod}\\,\\,#1",args:1,expand:!1},bmod:{def:"\\;\\mathbin{\\operatorname{mod }}",expand:!1}},Kt={bra:{def:"\\mathinner{\\langle{#1}|}",args:1,captureSelection:!1},ket:{def:"\\mathinner{|{#1}\\rangle}",args:1,captureSelection:!1},braket:{def:"\\mathinner{\\langle{#1}\\rangle}",args:1,captureSelection:!1},set:{def:"\\mathinner{\\lbrace #1 \\rbrace}",args:1,captureSelection:!1},Bra:{def:"\\left\\langle #1\\right|",args:1,captureSelection:!1},Ket:{def:"\\left|#1\\right\\rangle",args:1,captureSelection:!1},Braket:{def:"\\left\\langle{#1}\\right\\rangle",args:1,captureSelection:!1},Set:{def:"\\left\\lbrace #1 \\right\\rbrace",args:1,captureSelection:!1}},hn={iff:{primitive:!0,captureSelection:!0,def:"\\;\u27FA\\;"},nicefrac:"^{#1}\\!\\!/\\!_{#2}",phase:{def:"\\enclose{phasorangle}{#1}",args:1,captureSelection:!1},rd:"\\mathrm{d}",rD:"\\mathrm{D}",doubleStruckCapitalN:"\\mathbb{N}",doubleStruckCapitalR:"\\mathbb{R}",doubleStruckCapitalQ:"\\mathbb{Q}",doubleStruckCapitalZ:"\\mathbb{Z}",doubleStruckCapitalP:"\\mathbb{P}",scriptCapitalE:"\\mathscr{E}",scriptCapitalH:"\\mathscr{H}",scriptCapitalL:"\\mathscr{L}",gothicCapitalC:"\\mathfrak{C}",gothicCapitalH:"\\mathfrak{H}",gothicCapitalI:"\\mathfrak{I}",gothicCapitalR:"\\mathfrak{R}",imaginaryI:"\\mathrm{i}",imaginaryJ:"\\mathrm{j}",exponentialE:"\\mathrm{e}",differentialD:"\\mathrm{d}",capitalDifferentialD:"\\mathrm{D}",mathstrut:{def:"\\vphantom{(}",primitive:!0},angl:"\\enclose{actuarial}{#1}",angln:"\\enclose{actuarial}{n}",anglr:"\\enclose{actuarial}{r}",anglk:"\\enclose{actuarial}{k}",mathtools:{primitive:!0,package:{ordinarycolon:":",vcentcolon:"\\mathrel{\\mathop\\ordinarycolon}",dblcolon:'{\\mathop{\\char"2237}}',coloneqq:'{\\mathop{\\char"2254}}',Coloneqq:'{\\mathop{\\char"2237\\char"3D}}',coloneq:'{\\mathop{\\char"3A\\char"2212}}',Coloneq:'{\\mathop{\\char"2237\\char"2212}}',eqqcolon:'{\\mathop{\\char"2255}}',Eqqcolon:'{\\mathop{\\char"3D\\char"2237}}',eqcolon:'{\\mathop{\\char"2239}}',Eqcolon:'{\\mathop{\\char"2212\\char"2237}}',colonapprox:'{\\mathop{\\char"003A\\char"2248}}',Colonapprox:'{\\mathop{\\char"2237\\char"2248}}',colonsim:'{\\mathop{\\char"3A\\char"223C}}',Colonsim:'{\\mathop{\\char"2237\\char"223C}}',colondash:"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",Colondash:"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"}},ratio:"\\vcentcolon",coloncolon:"\\dblcolon",colonequals:"\\coloneq",coloncolonequals:"\\Coloneq",equalscolon:"\\eqcolon",equalscoloncolon:"\\Eqcolon",colonminus:"\\colondash",coloncolonminus:"\\Colondash",minuscolon:"\\dashcolon",minuscoloncolon:"\\Dashcolon",coloncolonapprox:"\\Colonapprox",coloncolonsim:"\\Colonsim",simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",simcoloncolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcoloncolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",notni:"\\mathrel{\\char`\u220C}",limsup:"\\operatorname*{lim\\,sup}",liminf:"\\operatorname*{lim\\,inf}",injlim:"\\operatorname*{inj\\,lim}",projlim:"\\operatorname*{proj\\,lim}",varlimsup:"\\operatorname*{\\overline{lim}}",varliminf:"\\operatorname*{\\underline{lim}}",varinjlim:"\\operatorname*{\\underrightarrow{lim}}",varprojlim:"\\operatorname*{\\underleftarrow{lim}}",argmin:"\\operatorname*{arg\\,min}",argmax:"\\operatorname*{arg\\,max}",plim:"\\mathop{\\operatorname{plim}}\\limits",tripledash:{def:"\\vphantom{-}\\raise{4mu}{\\mkern1.5mu\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2mu}}",expand:!0},"braket.sty":{package:Kt},"amsmath.sty":{package:tn,primitive:!0},"texvc.sty":{package:di,primitive:!1}},Ne={" ":32,"\\!":33,"\\#":35,"\\$":36,"\\%":37,"\\&":38,"-":45,"\\textunderscore":95,"\\euro":8364,"\\maltese":10016,"\\{":123,"\\}":125,"\\textbraceleft":123,"\\textbraceright":125,"\\lbrace":123,"\\rbrace":125,"\\lbrack":91,"\\rbrack":93,"\\nobreakspace":160,"\\ldots":8230,"\\textellipsis":8230,"\\backslash":92,"`":8216,"'":8217,"``":8220,"''":8221,"\\degree":176,"\\textasciicircum":94,"\\textasciitilde":126,"\\textasteriskcentered":42,"\\textbackslash":92,"\\textbullet":8226,"\\textdollar":36,"\\textsterling":163,"\\textdagger":8224,"\\textdaggerdbl":8225,"\u2013":8211,"\u2014":8212,"\u2018":8216,"\u2019":8217,"\u201C":8220,"\u201D":8221,'"':8221,"\\ss":223,"\\ae":230,"\\oe":339,"\\AE":198,"\\OE":338,"\\O":216,"\\i":305,"\\j":567,"\\aa":229,"\\AA":197},He=/[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/,ve,it;j()?(ve=new RegExp("\\p{Letter}","u"),it=new RegExp("[0-9\\p{Letter}]","u")):(ve=/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/,it=/[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/);function _t(e,i,r="mord",a){i!==void 0&&(Ht[e]={definitionType:"symbol",type:r,variant:a,codepoint:i},Dt[i]||(Dt[i]=e))}function lt(e,i,r){if(typeof e=="string"){for(let a=0;a<e.length;a++){const c=e.charAt(a);_t(c,c.codePointAt(0))}return}for(const[a,c,p,m]of e)_t(a,c,p!=null?p:i,m!=null?m:r)}function ee(e,i){for(let r=e;r<=i;r++)_t(String.fromCodePoint(r),r)}function xe(e){var i;return(i=Si[e])!=null?i:null}function Ke(e,i){var r,a;if(i.length===0||i==="\\"||!i.startsWith("\\"))return[];const c=[];for(const m in ft)m.startsWith(i)&&!ft[m].infix&&c.push({match:m,frequency:(r=ft[m].frequency)!=null?r:0});for(const m in Ht)m.startsWith(i)&&c.push({match:m,frequency:(a=Ht[m].frequency)!=null?a:0});const p=i.substring(1);for(const m of Object.keys(e.options.macros))m.startsWith(p)&&c.push({match:"\\"+m,frequency:0});return c.sort((m,b)=>{var w,E;return m.frequency===b.frequency?m.match.length===b.match.length?m.match<b.match?-1:1:m.match.length-b.match.length:((w=b.frequency)!=null?w:0)-((E=m.frequency)!=null?E:0)}),c.map(m=>m.match)}function Xe(e){let i="auto";const r=e.match(/:([^=]+)/);return r&&(i=r[1].trim()),i}function nt(e){if(!e)return[];const i=[];let r=e.split("]");if(r[0].startsWith("[")){i.push({isOptional:!0,type:Xe(r[0].slice(1))});for(let a=1;a<=r.length;a++)i.push(...nt(r[a]))}else if(r=e.split("}"),r[0].startsWith("{")){i.push({isOptional:!1,type:Xe(r[0].slice(1))});for(let a=1;a<=r.length;a++)i.push(...nt(r[a]))}return i}function gt(e){if(!e)return"";let i="",r=!0;for(const a of e)typeof a.value=="string"?i+=a.value:r=!1;return r?i:""}function Yt(e,i){typeof e=="string"&&(e=[e]);const r={tabular:!1,params:[],createAtom:i};for(const a of e)Si[a]=r}function dt(e,i,r){typeof e=="string"&&(e=[e]);const c={tabular:!0,params:nt(i),createAtom:r};for(const p of e)Si[p]=c}function ke(e,i,r){var a,c;r||(r={});const p={definitionType:"function",params:nt(i),ifMode:r.ifMode,isFunction:(a=r.isFunction)!=null?a:!1,applyMode:r.applyMode,infix:(c=r.infix)!=null?c:!1,parse:r.parse,createAtom:r.createAtom,applyStyle:r.applyStyle,serialize:r.serialize,render:r.render};if(typeof e=="string")ft["\\"+e]=p;else for(const m of e)ft["\\"+m]=p}var bt;function Gt(e){return bt||(bt=Ae(hn)),e?Ae(P(P({},bt),e)):bt}function Pt(e,i){var r,a,c,p;if(typeof e=="string"){let m=0;const b=e;return/(^|[^\\])#1/.test(b)&&(m=1),/(^|[^\\])#2/.test(b)&&(m=2),/(^|[^\\])#3/.test(b)&&(m=3),/(^|[^\\])#4/.test(b)&&(m=4),/(^|[^\\])#5/.test(b)&&(m=5),/(^|[^\\])#6/.test(b)&&(m=6),/(^|[^\\])#7/.test(b)&&(m=7),/(^|[^\\])#8/.test(b)&&(m=8),/(^|[^\\])#9/.test(b)&&(m=9),{expand:(r=i==null?void 0:i.expand)!=null?r:!0,captureSelection:(a=i==null?void 0:i.captureSelection)!=null?a:!0,args:m,def:b}}return P({expand:(c=i==null?void 0:i.expand)!=null?c:!0,captureSelection:(p=i==null?void 0:i.captureSelection)!=null?p:!0,args:0},e)}function Ae(e){if(!e)return{};const i={};for(const r of Object.keys(e)){const a=e[r];if(a==null)delete i[r];else if(typeof a=="object"&&"package"in a)for(const c of Object.keys(a.package))i[c]=Pt(a.package[c],{expand:!a.primitive,captureSelection:a.captureSelection});else i[r]=Pt(a)}return i}function Ce(e,i="math"){if(!e||e.length===0)return null;let r=null;if(e.startsWith("\\")){if(r=ft[e],r)return!r.ifMode||r.ifMode===i?r:null;i==="math"?r=Ht[e]:Ne[e]&&(r={definitionType:"symbol",type:"mord",codepoint:Ne[e]})}else if(i==="math"){if(r=Ht[e],!r&&e.length===1){const a=ut("math",e.codePointAt(0));return a.startsWith("\\")?f(P({},Ce(a,"math")),{command:a}):null}}else Ne[e]?r={definitionType:"symbol",type:"mord",codepoint:Ne[e]}:i==="text"&&(r={definitionType:"symbol",type:"mord",codepoint:e.codePointAt(0)});return r!=null?r:null}function rt(e,i){if(!e.startsWith("\\"))return null;const r=e.slice(1);return i[r]}function ut(e,i){if(i===void 0)return"";if(e==="math"&&Dt[i])return Dt[i];if(e==="text"){const r=Object.keys(Ne).find(a=>Ne[a]===i);return r||String.fromCodePoint(i)}return String.fromCodePoint(i)}var je=[0,.68889,0,0,.72222],kt=[0,.68889,0,0,.66667],Tt=[0,.68889,0,0,.77778],vt=[0,.68889,0,0,.61111],Ot=[.16667,.68889,0,0,.77778],jt=[0,.68889,0,0,.55556],Je=[0,0,0,0,.25],Ft=[0,.825,0,0,2.33334],Le=[0,.9,0,0,2.33334],ye=[0,.68889,0,0,.54028],we=[-.03598,.46402,0,0,.5],K=[-.13313,.36687,0,0,1],W=[.01354,.52239,0,0,1],ae=[.01354,.52239,0,0,1.11111],he=[0,.54986,0,0,1],_e=[0,.69224,0,0,.5],st=[0,.43056,0,0,1],ot=[.08198,.58198,0,0,.77778],xt=[.19444,.69224,0,0,.41667],Nt=[.1808,.675,0,0,1],Xt=[.19444,.69224,0,0,.83334],vi=[.13667,.63667,0,0,1],ti=[-.064,.437,0,0,1.334],St=[.08167,.58167,0,0,.77778],ii=[0,.69224,0,0,.72222],Di=[0,.69224,0,0,.66667],Ei=[-.13313,.36687,0,0,.77778],$i=[.06062,.54986,0,0,.77778],pi=[0,.69224,0,0,.77778],mi=[.25583,.75583,0,0,.77778],Xi=[.25142,.75726,0,0,.77778],an=[.20576,.70576,0,0,.77778],mn=[.30274,.79383,0,0,.77778],nn=[.22958,.72958,0,0,.77778],gr=[.1808,.675,0,0,.77778],Ci=[.13667,.63667,0,0,.77778],Ki=[.13597,.63597,0,0,.77778],wn=[.03517,.54986,0,0,.77778],Mi=[0,.675,0,0,.77778],In=[.19444,.69224,0,0,.61111],fn=[0,.54986,0,0,.76042],sr=[0,.54986,0,0,.66667],gn=[.0391,.5391,0,0,.77778],Xn=[.03517,.54986,0,0,1.33334],Ur=[.38569,.88569,0,0,.77778],wi=[.23222,.74111,0,0,.77778],ai=[.19444,.69224,0,0,.77778],Re=[0,.37788,0,0,.5],$e=[0,.54986,0,0,.72222],ht=[0,.69224,0,0,.83334],et=[.11111,.69224,0,0,.66667],wt=[.26167,.75726,0,0,.77778],Ct=[.48256,.98256,0,0,.77778],zt=[.28481,.79383,0,0,.77778],Wt=[.08167,.58167,0,0,.22222],Pi=[.08167,.58167,0,0,.38889],ki=[0,.43056,.04028,0,.66667],_n=[.41951,.91951,0,0,.77778],oi=[.24982,.74947,0,0,.38865],Ri=[.08319,.58283,0,0,.75623],Ai=[0,.10803,0,0,.27764],Fi=[0,.47534,0,0,.50181],Vi=[.18906,.47534,0,0,.50181],yi=[0,.69141,0,0,.50181],Ii=[.24982,.74947,0,0,.27764],Wi=[0,.69141,0,0,.21471],Bi=[.25,.75,0,0,.44722],bi=[0,.64444,0,0,.575],Ji=[.08556,.58556,0,0,.89444],Gi=[0,.69444,0,0,.89444],Yi=[0,.68611,0,0,.9],Rn=[0,.68611,0,0,.86944],on=[.25,.75,0,0,.575],Jn=[.25,.75,0,0,.31944],vn=[0,.69444,0,0,.63889],Tn=[0,.69444,0,0,.31944],Wn=[0,.44444,0,0,.63889],Pn=[0,.44444,0,0,.51111],dn=[0,.69444,0,0,.575],Ui=[.13333,.63333,0,0,.89444],Qi=[0,.44444,0,0,.31944],br=[0,.69444,0,0,.86944],ln=[0,.68611,0,0,.69166],Oi=[0,.68611,0,0,.83055],or=[0,.68611,0,0,.89444],xr=[0,.69444,0,0,.60278],Un=[.19444,.69444,0,0,.51111],Lr=[0,.69444,0,0,.83055],rn=[-.10889,.39111,0,0,1.14999],er=[.19444,.69444,0,0,.575],Dr=[.19444,.69444,0,0,1.14999],kr=[.19444,.69444,0,0,.70277],wr=[.05556,.75,0,0,.575],Nn=[0,.68611,0,0,.95833],lr=[.08556,.58556,0,0,.76666],ur=[-.02639,.47361,0,0,.575],Rr=[0,.44444,0,0,.89444],An=[0,.55556,0,0,.76666],ar=[-.10889,.39111,0,0,.89444],Sr=[.00222,.50222,0,0,.89444],cr=[.19667,.69667,0,0,.89444],hr=[.08556,.58556,0,0,1.14999],qi=[0,.69444,0,0,.70277],fi=[-.02778,.47222,0,0,.575],ji=[.25,.75,0,0,.51111],bn=[-.13889,.36111,0,0,1.14999],li=[.19444,.69444,0,0,1.02222],zn=[.12963,.69444,0,0,.89444],tr=[.19444,.69444,0,0,.44722],Cn=[0,.64444,.13167,0,.59111],is=[.19444,.64444,.13167,0,.59111],Tr=[0,.68611,.17208,0,.8961],_s=[.19444,.44444,.105,0,.53222],ns=[0,.44444,.085,0,.82666],pn=[0,.69444,.06709,0,.59111],ir=[0,.69444,.12945,0,.35555],Yr=[0,.69444,0,0,.94888],vs=[0,.69444,.11472,0,.59111],fr=[0,.68611,.10778,0,.88555],jn=[0,.69444,.07939,0,.62055],dr=[0,.69444,.12417,0,.30667],nr=[0,.64444,.13556,0,.51111],ls=[.19444,.64444,.13556,0,.51111],Pr=[0,.68333,.16389,0,.74333],Fs=[.19444,.43056,.08847,0,.46],Gs=[0,.43056,.07514,0,.71555],As=[0,.69444,.06646,0,.51111],Sa=[0,.69444,0,0,.83129],ni=[0,.69444,.1225,0,.51111],Ti=[0,.68333,.09403,0,.76666],Sn=[0,.68333,.11111,0,.76666],Hi=[0,.69444,.06961,0,.51444],Ni=[0,.69444,0,0,.27778],zr=[.25,.75,0,0,.38889],qn=[0,.64444,0,0,.5],Xr=[0,.69444,0,0,.77778],rs=[0,.68333,0,0,.75],Ea=[0,.68333,0,0,.77778],ru=[0,.68333,0,0,.68056],Za=[0,.68333,0,0,.72222],Ls=[.25,.75,0,0,.5],Hs=[.25,.75,0,0,.27778],Mn=[0,.69444,0,0,.5],ka=[0,.69444,0,0,.55556],Ta=[0,.43056,0,0,.44445],ys=[0,.43056,0,0,.5],Lo=[.19444,.43056,0,0,.55556],Do=[0,.43056,0,0,.55556],us=[.08333,.58333,0,0,.77778],Ya=[0,.43056,0,0,.27778],su=[0,.66786,0,0,.27778],cs=[0,.69444,0,0,.75],hl=[0,.66786,0,0,.5],au=[0,.68333,0,0,.625],Co=[.19444,.69444,0,0,.44445],Aa=[0,.69444,0,0,.72222],Mo=[.19444,.69444,0,0,.5],Ds=[.19444,.69444,0,0,1],Io=[.011,.511,0,0,1.126],Xa=[.19444,.69444,0,0,.61111],Ro=[.05556,.75,0,0,.5],fl=[0,.68333,0,0,.83334],bs=[.0391,.5391,0,0,.66667],aa=[-.05555,.44445,0,0,.5],Po=[0,.43056,0,0,.77778],Ws=[0,.55556,0,0,.66667],Oo=[-.03625,.46375,0,0,.77778],dl=[-.01688,.48312,0,0,.77778],ou=[.0391,.5391,0,0,1],js=[0,.69444,0,0,.61111],Ja=[-.03472,.46528,0,0,.5],Qa=[.25,.75,0,0,.44445],Fo=[-.14236,.35764,0,0,1],Vn=[.244,.744,0,0,.412],Ln=[.19444,.69444,0,0,.88889],On=[.12963,.69444,0,0,.77778],Vr=[.19444,.69444,0,0,.38889],Gr=[.011,.511,0,0,1.638],eo=[.19444,.69444,0,0,0],oa=[0,.44444,0,0,.575],Bs=[.19444,.44444,0,0,.575],pl=[0,.68611,0,0,.75555],Bo=[0,.69444,0,0,.66759],la=[0,.68611,0,0,.80555],No=[0,.68611,.08229,0,.98229],ml=[0,.68611,0,0,.76666],gl=[0,.44444,0,0,.58472],Jr=[.19444,.44444,0,0,.6118],Or=[.19444,.43056,0,0,.5],Ah=[0,.68333,.02778,.08334,.76278],pt=[0,.68333,.08125,.05556,.83125],lu=[0,.43056,0,.05556,.48472],mc=[.19444,.43056,0,.08334,.51702],gc=[.25,.75,0,0,.42778],Hr=[0,.69444,0,0,.55],Ns=[0,.69444,0,0,.73334],ua=[0,.69444,0,0,.79445],Lh=[0,.69444,0,0,.51945],_c=[0,.69444,0,0,.70278],uu=[0,.69444,0,0,.76389],$o=[.25,.75,0,0,.34306],La=[0,.69444,0,0,.56111],Dh=[0,.69444,0,0,.25556],Ch=[.19444,.45833,0,0,.56111],Mh=[0,.45833,0,0,.56111],cu=[0,.69444,0,0,.30556],vc=[0,.69444,0,0,.58056],hu=[0,.69444,0,0,.67223],Ko=[0,.69444,0,0,.85556],to=[0,.69444,0,0,.55834],qs=[0,.65556,.11156,0,.5],fu=[0,.69444,.08094,0,.70834],du=[.17014,0,0,0,.44445],pu=[0,.69444,.0799,0,.5],Ih=[0,.69444,0,0,.73752],_l=[0,.69444,.09205,0,.5],Rh=[0,.69444,.09031,0,.77778],yc=[0,.69444,.07816,0,.27778],bc=[0,.69444,.00316,0,.5],xc=[.19444,.69444,0,0,.83334],Ph=[.05556,.75,0,0,.83334],wc=[0,.75,0,0,.5],Oh=[.125,.08333,0,0,.27778],Fh=[0,.08333,0,0,.27778],Cs=[0,.65556,0,0,.5],Sc=[0,.69444,0,0,.47222],ca=[0,.69444,0,0,.66667],Bh=[0,.69444,0,0,.59722],Ec=[0,.69444,0,0,.54167],kc=[0,.69444,0,0,.70834],Nh=[.25,.75,0,0,.28889],Tc=[0,.69444,0,0,.51667],$h=[0,.44444,0,0,.44445],Kh=[.19444,.44444,0,0,.51667],vl=[0,.44444,0,0,.38333],Uh=[0,.44444,0,0,.51667],Ac=[0,.69444,0,0,.83334],Lc=[.35001,.85,0,0,.45834],zh=[.35001,.85,0,0,.57778],mu=[.35001,.85,0,0,.41667],hs=[.35001,.85,0,0,.58334],xs=[0,.72222,0,0,.55556],gu=[1e-5,.6,0,0,.66667],Vh=[1e-5,.6,0,0,.77778],yl=[.25001,.75,0,0,.94445],Gh=[.306,.805,.19445,0,.47222],Hh=[.30612,.805,.19445,0,.47222],Uo=[.25001,.75,0,0,.83334],zo=[.35001,.85,0,0,.47222],_u=[.25001,.75,0,0,1.11111],Dc=[.65002,1.15,0,0,.59722],vu=[.65002,1.15,0,0,.81111],Cc=[.65002,1.15,0,0,.47222],Wh=[.65002,1.15,0,0,.66667],bl=[0,.75,0,0,1],jh=[.55001,1.05,0,0,1.27778],Mc=[.862,1.36,.44445,0,.55556],qh=[.86225,1.36,.44445,0,.55556],io=[.55001,1.05,0,0,1.11111],yu=[.65002,1.15,0,0,.52778],Zh=[.65002,1.15,0,0,.61111],Ic=[.55001,1.05,0,0,1.51112],Rc=[.95003,1.45,0,0,.73611],Yh=[.95003,1.45,0,0,1.04445],Pc=[.95003,1.45,0,0,.52778],Da=[.95003,1.45,0,0,.75],bu=[0,.75,0,0,1.44445],xu=[.95003,1.45,0,0,.58334],Cr=[1.25003,1.75,0,0,.79167],ha=[1.25003,1.75,0,0,1.27778],wu=[1.25003,1.75,0,0,.58334],Su=[1.25003,1.75,0,0,.80556],Eu=[0,.825,0,0,1.8889],Vo=[1.25003,1.75,0,0,.63889],Go=[.64502,1.155,0,0,.875],no=[1e-5,.6,0,0,.875],Oc=[-99e-5,.601,0,0,.66667],$s=[.64502,1.155,0,0,.66667],Ve=[1e-5,.9,0,0,.88889],Fc=[.65002,1.15,0,0,.88889],ku=[.90001,0,0,0,.88889],Xh=[-.00499,.605,0,0,1.05556],Ca=[0,.12,0,0,.45],Qt=[0,.61111,0,0,.525],Ms=[.08333,.69444,0,0,.525],Jh=[-.08056,.53055,0,0,.525],Qh=[-.05556,.55556,0,0,.525],ss=[0,.43056,0,0,.525],xl=[.22222,.43056,0,0,.525],ro=[0,0,0,0,.525],Bc={"AMS-Regular":{32:Je,65:je,66:kt,67:je,68:je,69:kt,70:vt,71:Tt,72:Tt,73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:Tt,76:kt,77:[0,.68889,0,0,.94445],78:je,79:Ot,80:vt,81:Ot,82:je,83:jt,84:kt,85:je,86:je,87:[0,.68889,0,0,1],88:je,89:je,90:kt,107:jt,160:Je,165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:jt,295:ye,710:Ft,732:Le,770:Ft,771:Le,989:St,1008:ki,8245:[0,.54986,0,0,.275],8463:ye,8487:je,8498:jt,8502:kt,8503:[0,.68889,0,0,.44445],8504:kt,8513:[0,.68889,0,0,.63889],8592:we,8594:we,8602:K,8603:K,8606:W,8608:W,8610:ae,8611:ae,8619:he,8620:he,8621:[-.13313,.37788,0,0,1.38889],8622:K,8624:_e,8625:_e,8630:st,8631:st,8634:ot,8635:ot,8638:xt,8639:xt,8642:xt,8643:xt,8644:Nt,8646:Nt,8647:Nt,8648:Xt,8649:Nt,8650:Xt,8651:W,8652:W,8653:K,8654:K,8655:K,8666:vi,8667:vi,8669:[-.13313,.37788,0,0,1],8672:ti,8674:ti,8705:[0,.825,0,0,.5],8708:jt,8709:St,8717:[0,.43056,0,0,.42917],8722:we,8724:[.08198,.69224,0,0,.77778],8726:St,8733:pi,8736:ii,8737:ii,8738:[.03517,.52239,0,0,.72222],8739:Wt,8740:[.25142,.74111,0,0,.27778],8741:Pi,8742:[.25142,.74111,0,0,.5],8756:Di,8757:Di,8764:Ei,8765:[-.13313,.37788,0,0,.77778],8769:Ei,8770:Oo,8774:mn,8776:dl,8778:St,8782:$i,8783:$i,8785:ot,8786:ot,8787:ot,8790:pi,8791:nn,8796:[.08198,.91667,0,0,.77778],8806:mi,8807:mi,8808:Xi,8809:Xi,8812:[.25583,.75583,0,0,.5],8814:an,8815:an,8816:mn,8817:mn,8818:nn,8819:nn,8822:gr,8823:gr,8828:Ci,8829:Ci,8830:nn,8831:nn,8832:an,8833:an,8840:mn,8841:mn,8842:Ki,8843:Ki,8847:wn,8848:wn,8858:ot,8859:ot,8861:ot,8862:Mi,8863:Mi,8864:Mi,8865:Mi,8872:[0,.69224,0,0,.61111],8873:ii,8874:[0,.69224,0,0,.88889],8876:vt,8877:vt,8878:je,8879:je,8882:wn,8883:wn,8884:Ci,8885:Ci,8888:[0,.54986,0,0,1.11111],8890:Lo,8891:In,8892:In,8901:[0,.54986,0,0,.27778],8903:St,8905:St,8906:St,8907:pi,8908:pi,8909:[-.03598,.46402,0,0,.77778],8910:fn,8911:fn,8912:wn,8913:wn,8914:sr,8915:sr,8916:Di,8918:gn,8919:gn,8920:Xn,8921:Xn,8922:Ur,8923:Ur,8926:Ci,8927:Ci,8928:mn,8929:mn,8934:wi,8935:wi,8936:wi,8937:wi,8938:an,8939:an,8940:mn,8941:mn,8994:ai,8995:ai,9416:[.15559,.69224,0,0,.90222],9484:_e,9488:_e,9492:Re,9496:Re,9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:Mi,9633:Mi,9650:$e,9651:$e,9654:wn,9660:$e,9661:$e,9664:wn,9674:et,9733:[.19444,.69224,0,0,.94445],10003:ht,10016:ht,10731:et,10846:[.19444,.75583,0,0,.61111],10877:Ci,10878:Ci,10885:mi,10886:mi,10887:Ki,10888:Ki,10889:wt,10890:wt,10891:Ct,10892:Ct,10901:Ci,10902:Ci,10933:Xi,10934:Xi,10935:wt,10936:wt,10937:wt,10938:wt,10949:mi,10950:mi,10955:zt,10956:zt,57350:Wt,57351:Pi,57352:St,57353:ki,57356:Xi,57357:Xi,57358:_n,57359:mn,57360:mn,57361:_n,57366:Xi,57367:Xi,57368:Xi,57369:Xi,57370:Ki,57371:Ki},"Caligraphic-Regular":{32:Je,65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:Je},"Fraktur-Regular":{32:Je,33:[0,.69141,0,0,.29574],34:Wi,38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:oi,41:oi,42:[0,.62119,0,0,.27764],43:Ri,44:Ai,45:Ri,46:Ai,47:[.24982,.74947,0,0,.50181],48:Fi,49:Fi,50:Fi,51:Vi,52:Vi,53:Vi,54:yi,55:Vi,56:yi,57:Vi,58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:Ii,93:Ii,94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:Je,8216:Wi,8217:Wi,58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:Je,33:[0,.69444,0,0,.35],34:xr,35:[.19444,.69444,0,0,.95833],36:wr,37:[.05556,.75,0,0,.95833],38:Gi,39:Tn,40:Bi,41:Bi,42:[0,.75,0,0,.575],43:Ui,44:[.19444,.15556,0,0,.31944],45:vl,46:[0,.15556,0,0,.31944],47:on,48:bi,49:bi,50:bi,51:bi,52:bi,53:bi,54:bi,55:bi,56:bi,57:bi,58:Qi,59:[.19444,.44444,0,0,.31944],60:Ji,61:ar,62:Ji,63:[0,.69444,0,0,.54305],64:Gi,65:Rn,66:[0,.68611,0,0,.81805],67:Oi,68:[0,.68611,0,0,.88194],69:pl,70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:Yi,73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:ln,77:[0,.68611,0,0,1.09166],78:Yi,79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:Rn,89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:Jn,92:on,93:Jn,94:dn,95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:vn,99:Pn,100:vn,101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:vn,105:Tn,106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:Tn,109:[0,.44444,0,0,.95833],110:Wn,111:oa,112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:Wn,118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:Pn,123:on,124:Jn,125:on,126:[.35,.34444,0,0,.575],160:Je,163:[0,.69444,0,0,.86853],168:dn,172:[0,.44444,0,0,.76666],176:br,177:Ui,184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:Ui,216:[.04861,.73472,0,0,.89444],223:Bh,230:[0,.44444,0,0,.83055],247:Ui,248:[.09722,.54167,0,0,.575],305:Qi,338:[0,.68611,0,0,1.16944],339:Rr,567:[.19444,.44444,0,0,.35139],710:dn,711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:dn,715:dn,728:dn,729:Tn,730:br,732:dn,733:dn,915:ln,916:Nn,920:or,923:la,926:ml,928:Yi,931:Oi,933:or,934:Oi,936:or,937:Oi,8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:Tn,8217:Tn,8220:xr,8221:xr,8224:Un,8225:Un,8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:Bo,8465:Lr,8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:Lr,8501:qi,8592:rn,8593:er,8594:rn,8595:er,8596:rn,8597:on,8598:Dr,8599:Dr,8600:Dr,8601:Dr,8636:rn,8637:rn,8640:rn,8641:rn,8656:rn,8657:kr,8658:rn,8659:kr,8660:rn,8661:[.25,.75,0,0,.70277],8704:vn,8706:[0,.69444,.06389,0,.62847],8707:vn,8709:wr,8711:Nn,8712:lr,8715:lr,8722:Ui,8723:Ui,8725:on,8726:on,8727:fi,8728:ur,8729:ur,8730:[.18,.82,0,0,.95833],8733:Rr,8734:[0,.44444,0,0,1.14999],8736:ii,8739:Jn,8741:on,8743:An,8744:An,8745:An,8746:An,8747:[.19444,.69444,.12778,0,.56875],8764:ar,8768:[.19444,.69444,0,0,.31944],8771:Sr,8776:[.02444,.52444,0,0,.89444],8781:Sr,8801:Sr,8804:cr,8805:cr,8810:hr,8811:hr,8826:Ji,8827:Ji,8834:Ji,8835:Ji,8838:cr,8839:cr,8846:An,8849:cr,8850:cr,8851:An,8852:An,8853:Ui,8854:Ui,8855:Ui,8856:Ui,8857:Ui,8866:qi,8867:qi,8868:Gi,8869:Gi,8900:ur,8901:[-.02639,.47361,0,0,.31944],8902:fi,8968:ji,8969:ji,8970:ji,8971:ji,8994:bn,8995:bn,9651:li,9657:fi,9661:li,9667:fi,9711:Dr,9824:zn,9825:zn,9826:zn,9827:zn,9837:[0,.75,0,0,.44722],9838:tr,9839:tr,10216:Bi,10217:Bi,10815:Yi,10927:cr,10928:cr,57376:eo},"Main-BoldItalic":{32:Je,33:[0,.69444,.11417,0,.38611],34:jn,35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:ir,40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:Cn,49:Cn,50:Cn,51:Cn,52:is,53:Cn,54:Cn,55:is,56:Cn,57:Cn,58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:vs,64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:Tr,73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:Tr,79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:pn,95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:_s,104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:_s,114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:Je,168:[0,.69444,.11473,0,.59111],176:Yr,184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:ns,248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:ns,567:[.19444,.44444,.04611,0,.385],710:pn,711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:ir,730:Yr,732:vs,733:vs,915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:Tr,931:[0,.68611,.11431,0,.82666],933:fr,934:[0,.68611,.05632,0,.82666],936:fr,937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:ir,8217:ir,8220:[0,.69444,.16772,0,.62055],8221:jn},"Main-Italic":{32:Je,33:dr,34:Hi,35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:dr,40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:nr,49:nr,50:nr,51:nr,52:ls,53:nr,54:nr,55:ls,56:nr,57:nr,58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:ni,64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:Pr,73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:Pr,79:Ti,80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:Pr,86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:As,95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:Fs,104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:Fs,114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:Je,168:[0,.66786,.10474,0,.51111],176:Sa,184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:Gs,248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:Gs,710:As,711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:Sa,732:[0,.66786,.11585,0,.51111],733:ni,915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:Ti,923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:Pr,931:[0,.68333,.12028,0,.71555],933:Sn,934:[0,.68333,.05986,0,.71555],936:Sn,937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:dr,8217:dr,8220:[0,.69444,.1685,0,.51444],8221:Hi,8463:ye},"Main-Regular":{32:Je,33:Ni,34:Mn,35:xc,36:Ro,37:Ph,38:Xr,39:Ni,40:zr,41:zr,42:wc,43:us,44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:Ls,48:qn,49:qn,50:qn,51:qn,52:qn,53:qn,54:qn,55:qn,56:qn,57:qn,58:Ya,59:[.19444,.43056,0,0,.27778],60:gn,61:Ei,62:gn,63:Sc,64:Xr,65:rs,66:[0,.68333,0,0,.70834],67:Za,68:[0,.68333,0,0,.76389],69:ru,70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:rs,73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:Ea,76:au,77:[0,.68333,0,0,.91667],78:rs,79:Ea,80:ru,81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:Za,85:rs,86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:rs,89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:Hs,92:Ls,93:Hs,94:Mn,95:[.31,.12056,.02778,0,.5],97:ys,98:ka,99:Ta,100:ka,101:Ta,102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:ka,105:su,106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:Ni,109:[0,.43056,0,0,.83334],110:Do,111:ys,112:Lo,113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:Do,118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:Ta,123:Ls,124:Hs,125:Ls,126:[.35,.31786,0,0,.5],160:Je,163:[0,.69444,0,0,.76909],167:Co,168:hl,172:[0,.43056,0,0,.66667],176:cs,177:us,182:Xa,184:du,198:[0,.68333,0,0,.90278],215:us,216:[.04861,.73194,0,0,.77778],223:Mn,230:[0,.43056,0,0,.72222],247:us,248:[.09722,.52778,0,0,.5],305:Ya,338:[0,.68333,0,0,1.01389],339:Po,567:[.19444,.43056,0,0,.30556],710:Mn,711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:Mn,715:Mn,728:Mn,729:su,730:cs,732:hl,733:Mn,915:au,916:fl,920:Ea,923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:rs,931:Za,933:Ea,934:Za,936:Ea,937:Za,8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:Ni,8217:Ni,8220:Mn,8221:Mn,8224:Co,8225:Co,8230:[0,.12,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:ye,8465:Aa,8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:Aa,8501:js,8592:K,8593:Mo,8594:K,8595:Mo,8596:K,8597:Ls,8598:Ds,8599:Ds,8600:Ds,8601:Ds,8614:[.011,.511,0,0,1],8617:Io,8618:Io,8636:K,8637:K,8640:K,8641:K,8652:[.011,.671,0,0,1],8656:K,8657:Xa,8658:K,8659:Xa,8660:K,8661:[.25,.75,0,0,.61111],8704:ka,8706:[0,.69444,.05556,.08334,.5309],8707:ka,8709:Ro,8711:fl,8712:bs,8715:bs,8722:us,8723:us,8725:Ls,8726:Ls,8727:Ja,8728:aa,8729:aa,8730:[.2,.8,0,0,.83334],8733:Po,8734:st,8736:ii,8739:Hs,8741:Ls,8743:Ws,8744:Ws,8745:Ws,8746:Ws,8747:[.19444,.69444,.11111,0,.41667],8764:Ei,8768:[.19444,.69444,0,0,.27778],8771:Oo,8773:[-.022,.589,0,0,1],8776:dl,8781:Oo,8784:[-.133,.67,0,0,.778],8801:Oo,8804:Ki,8805:Ki,8810:ou,8811:ou,8826:gn,8827:gn,8834:gn,8835:gn,8838:Ki,8839:Ki,8846:Ws,8849:Ki,8850:Ki,8851:Ws,8852:Ws,8853:us,8854:us,8855:us,8856:us,8857:us,8866:js,8867:js,8868:Xr,8869:Xr,8872:[.249,.75,0,0,.867],8900:aa,8901:[-.05555,.44445,0,0,.27778],8902:Ja,8904:[.005,.505,0,0,.9],8942:[.03,.9,0,0,.278],8943:[-.19,.31,0,0,1.172],8945:[-.1,.82,0,0,1.282],8968:Qa,8969:Qa,8970:Qa,8971:Qa,8994:Fo,8995:Fo,9136:Vn,9137:Vn,9651:Ln,9657:Ja,9661:Ln,9667:Ja,9711:Ds,9824:On,9825:On,9826:On,9827:On,9837:[0,.75,0,0,.38889],9838:Vr,9839:Vr,10216:zr,10217:zr,10222:Vn,10223:Vn,10229:[.011,.511,0,0,1.609],10230:Gr,10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:Gr,10815:rs,10927:Ki,10928:Ki,57376:eo},"Math-BoldItalic":{32:Je,48:oa,49:oa,50:oa,51:Bs,52:Bs,53:Bs,54:bi,55:Bs,56:bi,57:Bs,65:Rn,66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:No,73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:pl,77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:Bo,105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:gl,112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:Je,915:[0,.68611,.15972,0,.65694],916:Nn,920:[0,.68611,.03194,0,.86722],923:la,926:[0,.68611,.07458,0,.84125],928:No,931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:ml,936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:gl,960:[0,.44444,.03704,0,.68241],961:Jr,962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:Jr,1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:Je,48:ys,49:ys,50:ys,51:Or,52:Or,53:Or,54:qn,55:Or,56:qn,57:Or,65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:pt,73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:Ah,80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:lu,112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:Je,915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:Ah,923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:pt,931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:lu,960:[0,.43056,.03588,0,.57003],961:mc,962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:mc,1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:Je,33:[0,.69444,0,0,.36667],34:to,35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:cu,40:gc,41:gc,42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:Hr,49:Hr,50:Hr,51:Hr,52:Hr,53:Hr,54:Hr,55:Hr,56:Hr,57:Hr,58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:Lh,64:Ns,65:Ns,66:Ns,67:_c,68:ua,69:[0,.69444,0,0,.64167],70:js,71:Ns,72:ua,73:[0,.69444,0,0,.33056],74:Lh,75:uu,76:vc,77:[0,.69444,0,0,.97778],78:ua,79:ua,80:_c,81:[.10556,.69444,0,0,.79445],82:_c,83:js,84:Ns,85:uu,86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:Ns,89:[0,.69444,.0275,0,.73334],90:hu,91:$o,93:$o,94:Hr,95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:La,99:[0,.45833,0,0,.48889],100:La,101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:La,105:Dh,106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:Dh,109:[0,.45833,0,0,.86667],110:Mh,111:[0,.45833,0,0,.55],112:Ch,113:Ch,114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:Mh,118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:Je,168:Hr,176:Ns,180:Hr,184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:Hr,711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:Hr,729:cu,730:Ns,732:Hr,733:Hr,915:vc,916:[0,.69444,0,0,.91667],920:Ko,923:hu,926:Ns,928:ua,931:ua,933:Ko,934:ua,936:Ko,937:ua,8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:cu,8217:cu,8220:to,8221:to},"SansSerif-Italic":{32:Je,33:[0,.69444,.05733,0,.31945],34:bc,35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:yc,40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:Oh,45:[0,.44444,.01946,0,.33333],46:Fh,47:[.25,.75,.13164,0,.5],48:qs,49:qs,50:qs,51:qs,52:qs,53:qs,54:qs,55:qs,56:qs,57:qs,58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:ca,66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:fu,73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:Ec,77:[0,.69444,.08094,0,.875],78:fu,79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:pu,95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:Je,168:[0,.67937,.06385,0,.5],176:Ih,184:du,305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:pu,711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:_l,715:Mn,728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:Ih,732:[0,.67659,.08826,0,.5],733:_l,915:[0,.69444,.13372,0,.54167],916:Ac,920:[0,.69444,.07555,0,.77778],923:js,926:[0,.69444,.12816,0,.66667],928:fu,931:[0,.69444,.11983,0,.72222],933:Rh,934:[0,.69444,.04603,0,.72222],936:Rh,937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:yc,8217:yc,8220:[0,.69444,.14205,0,.5],8221:bc},"SansSerif-Regular":{32:Je,33:[0,.69444,0,0,.31945],34:Mn,35:xc,36:Ro,37:Ph,38:[0,.69444,0,0,.75834],39:Ni,40:zr,41:zr,42:wc,43:us,44:Oh,45:[0,.44444,0,0,.33333],46:Fh,47:Ls,48:Cs,49:Cs,50:Cs,51:Cs,52:Cs,53:Cs,54:Cs,55:Cs,56:Cs,57:Cs,58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:Sc,64:ca,65:ca,66:ca,67:vn,68:[0,.69444,0,0,.72223],69:Bh,70:[0,.69444,0,0,.56945],71:ca,72:kc,73:Ni,74:Sc,75:[0,.69444,0,0,.69445],76:Ec,77:[0,.69444,0,0,.875],78:kc,79:[0,.69444,0,0,.73611],80:vn,81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:ka,84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:ca,89:[0,.69444,.025,0,.66667],90:js,91:Nh,93:Nh,94:Mn,95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:Tc,99:$h,100:Tc,101:$h,102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:Tc,105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:Uh,111:[0,.44444,0,0,.5],112:Kh,113:Kh,114:[0,.44444,.01389,0,.34167],115:vl,116:[0,.57143,0,0,.36111],117:Uh,118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:Je,168:[0,.67937,0,0,.5],176:ca,184:du,305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:Mn,711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:Mn,715:Mn,728:Mn,729:[0,.67937,0,0,.27778],730:ca,732:[0,.67659,0,0,.5],733:Mn,915:Ec,916:Ac,920:Xr,923:js,926:ca,928:kc,931:Aa,933:Xr,934:Aa,936:Xr,937:Aa,8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:Ni,8217:Ni,8220:Mn,8221:Mn},"Script-Regular":{32:Je,65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:Je},"Size1-Regular":{32:Je,40:Lc,41:Lc,47:zh,91:mu,92:zh,93:mu,123:hs,125:hs,160:Je,710:xs,732:xs,770:xs,771:xs,8214:[-99e-5,.601,0,0,.77778],8593:gu,8595:gu,8657:Vh,8659:Vh,8719:yl,8720:yl,8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:Hh,8748:Gh,8749:Gh,8750:Hh,8896:Uo,8897:Uo,8898:Uo,8899:Uo,8968:zo,8969:zo,8970:zo,8971:zo,9168:Oc,10216:zo,10217:zo,10752:_u,10753:_u,10754:_u,10756:Uo,10758:Uo},"Size2-Regular":{32:Je,40:Dc,41:Dc,47:vu,91:Cc,92:vu,93:Cc,123:Wh,125:Wh,160:Je,710:bl,732:bl,770:bl,771:bl,8719:jh,8720:jh,8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:qh,8748:Mc,8749:Mc,8750:qh,8896:io,8897:io,8898:io,8899:io,8968:yu,8969:yu,8970:yu,8971:yu,10216:Zh,10217:Zh,10752:Ic,10753:Ic,10754:Ic,10756:io,10758:io},"Size3-Regular":{32:Je,40:Rc,41:Rc,47:Yh,91:Pc,92:Yh,93:Pc,123:Da,125:Da,160:Je,710:bu,732:bu,770:bu,771:bu,8730:[.95003,1.45,0,0,1],8968:xu,8969:xu,8970:xu,8971:xu,10216:Da,10217:Da},"Size4-Regular":{32:Je,40:Cr,41:Cr,47:ha,91:wu,92:ha,93:wu,123:Su,125:Su,160:Je,710:Eu,732:Eu,770:Eu,771:Eu,8730:[1.25003,1.75,0,0,1],8968:Vo,8969:Vo,8970:Vo,8971:Vo,9115:Go,9116:no,9117:Go,9118:Go,9119:no,9120:Go,9121:$s,9122:Oc,9123:$s,9124:$s,9125:Oc,9126:$s,9127:Ve,9128:Fc,9129:ku,9130:[0,.3,0,0,.88889],9131:Ve,9132:Fc,9133:ku,9143:[.88502,.915,0,0,1.05556],10216:Su,10217:Su,57344:Xh,57345:Xh,57680:Ca,57681:Ca,57682:Ca,57683:Ca},"Typewriter-Regular":{32:ro,33:Qt,34:Qt,35:Qt,36:Ms,37:Ms,38:Qt,39:Qt,40:Ms,41:Ms,42:[0,.52083,0,0,.525],43:Jh,44:[.13889,.125,0,0,.525],45:Jh,46:[0,.125,0,0,.525],47:Ms,48:Qt,49:Qt,50:Qt,51:Qt,52:Qt,53:Qt,54:Qt,55:Qt,56:Qt,57:Qt,58:ss,59:[.13889,.43056,0,0,.525],60:Qh,61:[-.19549,.41562,0,0,.525],62:Qh,63:Qt,64:Qt,65:Qt,66:Qt,67:Qt,68:Qt,69:Qt,70:Qt,71:Qt,72:Qt,73:Qt,74:Qt,75:Qt,76:Qt,77:Qt,78:Qt,79:Qt,80:Qt,81:[.13889,.61111,0,0,.525],82:Qt,83:Qt,84:Qt,85:Qt,86:Qt,87:Qt,88:Qt,89:Qt,90:Qt,91:Ms,92:Ms,93:Ms,94:Qt,95:[.09514,0,0,0,.525],96:Qt,97:ss,98:Qt,99:ss,100:Qt,101:ss,102:Qt,103:xl,104:Qt,105:Qt,106:[.22222,.61111,0,0,.525],107:Qt,108:Qt,109:ss,110:ss,111:ss,112:xl,113:xl,114:ss,115:ss,116:[0,.55358,0,0,.525],117:ss,118:ss,119:ss,120:ss,121:xl,122:ss,123:Ms,124:Ms,125:Ms,126:Qt,127:Qt,160:ro,176:Qt,184:[.19445,0,0,0,.525],305:ss,567:xl,711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:Qt,715:Qt,728:Qt,730:Qt,770:Qt,771:Qt,776:Qt,915:Qt,916:Qt,920:Qt,923:Qt,926:Qt,928:Qt,931:Qt,933:Qt,934:Qt,936:Qt,937:Qt,8216:Qt,8217:Qt,8242:Qt,9251:[.11111,.21944,0,0,.525]}},ef=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,fa=10,pr=.25,gd=1.2,da=.431,Nc={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[da,da,da],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.5,.732,.925],num2:[.394,.384,.5],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[pr,pr,pr],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04]},$c=[0,.5,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Ho=5,tf={"\xA0":" ","\u200B":" ",\u00C5:"A",\u00C7:"C",\u00D0:"D",\u00DE:"o",\u00E5:"a",\u00E7:"c",\u00F0:"d",\u00FE:"o",\u0410:"A",\u0411:"B",\u0412:"B",\u0413:"F",\u0414:"A",\u0415:"E",\u0416:"K",\u0417:"3",\u0418:"N",\u0419:"N",\u041A:"K",\u041B:"N",\u041C:"M",\u041D:"H",\u041E:"O",\u041F:"N",\u0420:"P",\u0421:"C",\u0422:"T",\u0423:"y",\u0424:"O",\u0425:"X",\u0426:"U",\u0427:"h",\u0428:"W",\u0429:"W",\u042A:"B",\u042B:"X",\u042C:"B",\u042D:"3",\u042E:"X",\u042F:"R",\u0430:"a",\u0431:"b",\u0432:"a",\u0433:"r",\u0434:"y",\u0435:"e",\u0436:"m",\u0437:"e",\u0438:"n",\u0439:"n",\u043A:"n",\u043B:"n",\u043C:"m",\u043D:"n",\u043E:"o",\u043F:"n",\u0440:"p",\u0441:"c",\u0442:"o",\u0443:"y",\u0444:"b",\u0445:"x",\u0446:"n",\u0447:"n",\u0448:"w",\u0449:"w",\u044A:"a",\u044B:"m",\u044C:"a",\u044D:"e",\u044E:"m",\u044F:"r"};function so(e,i){e===void 0&&(e=77);const r=Bc[i][e];if(r)return{defaultMetrics:!1,depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]};if(e===11034)return{defaultMetrics:!0,depth:.2,height:.8,italic:0,skew:0,width:.8};const a=String.fromCodePoint(e);if(a in tf)e=tf[a].codePointAt(0);else if(ef.test(a))return e=77,{defaultMetrics:!0,depth:.2,height:.9,italic:0,skew:0,width:1};return{defaultMetrics:!0,depth:.2,height:.7,italic:0,skew:0,width:.8}}var Ks={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],longrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],longleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],longleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],longrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],longleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],longleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],longRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716],longLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Wo={widehat1:[1062,239,.24],widehat2:[2364,300,.3],widehat3:[2364,360,.36],widehat4:[2364,420,.42],widecheck1:[1062,239,.24],widecheck2:[2364,300,.3],widecheck3:[2364,360,.36],widecheck4:[2364,420,.42],widetilde1:[600,260,.26],widetilde2:[1033,286,.286],widetilde3:[2339,306,.306],widetilde4:[2340,312,.34],overarc:[1061,159,.3],underarc:[1061,159,.3]},Kc={doubleleftarrow:`M262 157
|
|
|
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
|
|
|
0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
|
|
|
14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
|
|
|
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
|
|
|
157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
|
|
|
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
|
|
|
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
|
|
|
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
|
|
|
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
|
|
|
14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
|
|
|
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
|
|
|
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
|
|
|
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
|
|
|
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
|
|
|
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
|
|
|
135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
|
|
|
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
|
|
|
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
|
|
|
490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
|
|
|
1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
|
|
|
l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
|
|
|
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
|
|
|
5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
|
|
|
35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
|
|
|
0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
|
|
|
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,overarc:"M529 0c179 0 524 115 524 115 5 1 9 5 9 10 0 1-1 2-1 3l-4 22c-1 5-5 9-11 9h-2s-338-93-512-92c-174 0-513 92-513 92h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13 0 0 342-115 520-115z",underarc:`m 529 160
|
|
|
c -179 0 -524 -115 -524 -115
|
|
|
c -5 -1 -9 -5 -9 -10
|
|
|
c 0 -1 1 -2 1 -3
|
|
|
l 4 -22
|
|
|
c 1 -5 5 -9 11 -9
|
|
|
h 2
|
|
|
s 338 93 512 92
|
|
|
c 174 0 513 -92 513 -92
|
|
|
h 2
|
|
|
c 5 0 9 4 11 9
|
|
|
l 5 22
|
|
|
c 1 6 -2 12 -8 13
|
|
|
c 0 0 -342 115 -520 115
|
|
|
z
|
|
|
`,leftgroup:`M400000 80
|
|
|
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
|
|
|
435 0h399565z`,leftgroupunder:`M400000 262
|
|
|
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
|
|
|
435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
|
|
|
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
|
|
|
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
|
|
|
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
|
|
|
20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
|
|
|
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
|
|
|
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
|
|
|
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
|
|
|
5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
|
|
|
1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
|
|
|
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
|
|
|
10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
|
|
|
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
|
|
|
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
|
|
|
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
|
|
|
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
|
|
|
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
|
|
|
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
|
|
|
M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
|
|
|
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
|
|
|
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
|
|
|
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
|
|
|
M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
|
|
|
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
|
|
|
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
|
|
|
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
|
|
|
12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
|
|
|
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
|
|
|
53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
|
|
|
11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
|
|
|
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
|
|
|
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
|
|
|
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
|
|
|
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
|
|
|
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
|
|
|
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
|
|
|
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
|
|
|
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
|
|
|
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
|
|
|
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
|
|
|
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
|
|
|
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
|
|
|
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
|
|
|
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
|
|
|
11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
|
|
|
39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
|
|
|
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
|
|
|
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
|
|
|
151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
|
|
|
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
|
|
|
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
|
|
|
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
|
|
|
28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
|
|
|
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
|
|
|
3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
|
|
|
0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
|
|
|
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
|
|
|
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
|
|
|
69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
|
|
|
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
|
|
|
2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
|
|
|
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
|
|
|
8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
|
|
|
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
|
|
|
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
|
|
|
15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
|
|
|
8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
|
|
|
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
|
|
|
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
|
|
|
15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
|
|
|
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
|
|
|
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
|
|
|
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
|
|
|
1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
|
|
|
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
|
|
|
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
|
|
|
115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
|
|
|
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
|
|
|
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
|
|
|
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
|
|
|
10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
|
|
|
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
|
|
|
41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
|
|
|
18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
|
|
|
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
|
|
|
101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,widetilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
|
|
|
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
|
|
|
114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
|
|
|
4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
|
|
|
-68.267.847-113-73.952-191-73.952z`,widetilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
|
|
|
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
|
|
|
31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
|
|
|
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
|
|
|
181.476 676 181.476c-149 0-189-126.21-332-126.21z`,widetilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
|
|
|
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
|
|
|
411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
|
|
|
16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
|
|
|
-338 0-409-156.573-744-156.573z`,widetilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
|
|
|
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
|
|
|
177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
|
|
|
14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
|
|
|
-175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
|
|
|
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
|
|
|
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
|
|
|
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
|
|
|
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
|
|
|
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
|
|
|
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
|
|
|
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
|
|
|
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
|
|
|
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
|
|
|
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
|
|
|
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
|
|
|
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
|
|
|
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
|
|
|
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
|
|
|
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
|
|
|
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
|
|
|
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
|
|
|
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
|
|
|
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
|
|
|
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
|
|
|
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
|
|
|
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
|
|
|
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
|
|
|
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
|
|
|
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
|
|
|
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
|
|
|
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
|
|
|
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
|
|
|
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
|
|
|
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
|
|
|
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
|
|
|
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
|
|
|
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
|
|
|
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
|
|
|
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
|
|
|
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
|
|
|
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
|
|
|
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
|
|
|
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
|
|
|
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
|
|
|
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
|
|
|
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
|
|
|
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
|
|
|
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`};function _d(e){if(Wo[e]){const[E,I,N]=Wo[e],Z=`<span class="stretchy" style="height:${N}em"><svg width="100%" height="${N}em" viewBox="0 0 ${E} ${I}" preserveAspectRatio="none" ><path fill="currentcolor" d="${Kc[e]}"></path></svg></span>`;return`<span style="display:inline-block;height:${Math.floor(100*N/2)/100}em;min-width:0">${Z}</span>`}const[i,r,a,c]=Ks[e];let p,m;const b=a/1e3;i.length===3?(p=["slice-1-of-3","slice-2-of-3","slice-3-of-3"],m=["xMinYMin","xMidYMin","xMaxYMin"]):i.length===2?(p=["slice-1-of-2","slice-2-of-2"],m=["xMinYMin","xMaxYMin"]):(p=["slice-1-of-1"],m=[c]);const w=i.map((E,I)=>`<span class="${p[I]}" style=height:${b}em><svg width=400em height=${b}em viewBox="0 0 400000 ${a}" preserveAspectRatio="${m[I]} slice"><path fill="currentcolor" d="${Kc[E]}"></path></svg></span>`).join("");return`<span style="display:inline-block;height:${b}em;min-width:${r}em;">${w}</span>`}function Uc(e){return Ks[e]?Ks[e][2]/1e3:Wo[e][2]}function wl(e){const i=[];for(let r=0;r<e.length;r++){let a=e.charCodeAt(r);if(a===13&&e.charCodeAt(r+1)===10&&(a=10,r++),(a===13||a===12)&&(a=10),a===0&&(a=65533),a>=55296&&a<=56319){const c=e.charCodeAt(r+1);if(c>=56320&&c<=57343){const p=a-55296,m=c-56320;a=wa(2,16)+p*wa(2,10)+m,r++}}i.push(a)}return i}var Tu=8205,vd=[[Tu,1],[65038,2],[127995,5],[129456,4],[917536,96]],Sl,zc=[127462,127487];function Vc(e){var i;if(Sl===void 0){Sl={};for(const r of vd)for(let a=r[0];a<=r[0]+r[1]-1;a++)Sl[a]=!0}return(i=Sl[e])!=null?i:!1}function yd(e){return e>=zc[0]&&e<=zc[1]}function Au(e){if(/^[\u0020-\u00FF]*$/.test(e))return e;const i=[],r=wl(e);let a=0;for(;a<r.length;){const c=r[a++],p=r[a];if(p===Tu){const m=a-1;for(a+=2;r[a]===Tu;)a+=2;i.push(String.fromCodePoint(...r.slice(m,a-m+1)))}else if(Vc(p)){const m=a-1;for(;Vc(r[a]);)a+=r[a]===Tu?2:1;i.push(String.fromCodePoint(...r.slice(m,2*a-m-1)))}else yd(c)?(a+=1,i.push(String.fromCodePoint(...r.slice(a-2,2)))):i.push(String.fromCodePoint(c))}return i}var nf=class{constructor(e){this.obeyspaces=!1,this.pos=0,this.s=Au(e)}end(){return this.pos>=this.s.length}get(){return this.pos<this.s.length?this.s[this.pos++]:""}peek(){return this.s[this.pos]}match(e){const i=typeof this.s=="string"?e.exec(this.s.slice(this.pos)):e.exec(this.s.slice(this.pos).join(""));return i!=null&&i[0]?(this.pos+=i[0].length,i[0]):""}next(){if(this.end())return null;if(!this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]+/)||this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]/))return"<space>";const e=this.get();if(e==="\\"){if(!this.end()){let i=this.match(/^[a-zA-Z\*]+/);return i?this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]*/):i=this.get(),"\\"+i}}else{if(e==="{")return"<{>";if(e==="}")return"<}>";if(e==="^"){if(this.peek()==="^"){this.get();const i=this.match(/^(\^(\^(\^(\^[\da-f])?[\da-f])?[\da-f])?[\da-f])?[\da-f]{2}/);if(i)return String.fromCodePoint(Number.parseInt(i.slice(i.lastIndexOf("^")+1),16))}return e}else if(e==="#"){if(!this.end()){let i=!1;if(/[\d?@]/.test(this.peek())&&(i=!0,this.pos+1<this.s.length)){const r=this.s[this.pos+1];i=/[^\dA-Za-z]/.test(r)}return i?"#"+this.get():"#"}}else if(e==="$")return this.peek()==="$"?(this.get(),"<$$>"):"<$>"}return e}};function El(e,i){var r,a,c,p;const m=[];let b=e.next();if(b&&b!=="\\relax"){if(b==="\\noexpand")b=e.next(),b&&m.push(b);else if(b==="\\obeyspaces")e.obeyspaces=!0;else if(b==="\\bgroup")m.push("<{>");else if(b==="\\egroup")m.push("<}>");else if(b==="\\string"){if(b=e.next(),b)if(b.startsWith("\\"))for(const w of b)m.push(w==="\\"?"\\backslash":w);else b==="<{>"?m.push("\\{"):b==="<space>"?m.push("~"):b==="<}>"&&m.push("\\}")}else if(b==="\\csname"){for(;e.peek()==="<space>";)e.next();let w="",E=!1,I=[];do{if(I.length===0)if(/^#[\d?@]$/.test(e.peek())){const N=e.get().slice(1);I=jo((a=(r=i==null?void 0:i(N))!=null?r:i==null?void 0:i("?"))!=null?a:"\\placeholder{}",i),b=I[0]}else b=e.next(),I=b?[b]:[];E=I.length===0,!E&&b==="\\endcsname"&&(E=!0,I.shift()),E||(E=b==="<$>"||b==="<$$>"||b==="<{>"||b==="<}>"||typeof b=="string"&&b.length>1&&b.startsWith("\\")),E||(w+=I.shift())}while(!E);w&&m.push("\\"+w),m.push(...I)}else if(b!=="\\endcsname")if(b.length>1&&b.startsWith("#")){const w=b.slice(1);m.push(...jo((p=(c=i==null?void 0:i(w))!=null?c:i==null?void 0:i("?"))!=null?p:"\\placeholder{}",i))}else m.push(b)}return m}function jo(e,i=null){const r=[];let a="";for(const m of e.toString().split(/\r?\n/)){a&&r.push(a),a=" ";const b=m.match(/((?:\\%)|[^%])*/);b!==null&&r.push(b[0])}const c=new nf(Bt(r.join(""))),p=[];do p.push(...El(c,i));while(!c.end());return p}function un(e){let i="";const r=[];for(const a of e)a&&(i&&/^[a-zA-Z\*]/.test(a)&&r.push(i),r.push(a),/^\\[a-zA-Z]+\*?[\"\'][^\ ]+$/.test(a)&&r.push(" "),i=/\\[a-zA-Z]+\*?$/.test(a)?" ":"");return r.join("")}function Zn(e,...i){return console.assert(e.startsWith("\\")),i.length===0?e:un([e,...i.map(r=>`{${r}}`)])}function Ma(e){return un(e.map(i=>{var r;return(r={"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"}[i])!=null?r:i}))}var Gc=class Th{constructor(i){Th._registry[i]=this}static createAtom(i,r,a){return Th._registry[i].createAtom(r,Ce(r,i),a)}static serialize(i,r){var a;if(!i||i.length===0)return"";if((a=r.skipStyles)!=null&&a){const c=[];for(const p of rf(i)){const m=Th._registry[p[0].mode];c.push(...m.serialize(p,r))}return un(c)}return un(Wc(i,r))}static getFont(i,r,a){return Th._registry[i].getFont(r,a)}};Gc._registry={};var ws=Gc;function rf(e){const i=[];let r=[],a="NONE";for(const c of e)c.type!=="first"&&(c.mode!==a?(r.length>0&&i.push(r),r=[c],a=c.mode):r.push(c));return r.length>0&&i.push(r),i}function pa(e,i){const r=[];let a=[],c;for(const p of e)if(p.type!=="first"&&p.style){let m;i==="variant"?(m=p.style.variant,p.style.variantStyle&&p.style.variantStyle!=="up"&&(m+="-"+p.style.variantStyle)):m=p.style[i],m===c?a.push(p):(a.length>0&&r.push(a),a=[p],c=m)}return a.length>0&&r.push(a),r}function sf(e,i){var r;const{parent:a}=e[0],c=a==null?void 0:a.computedStyle.color,p=[];for(const m of rf(e)){const b=i.defaultMode;for(const w of pa(m,"color")){const E=w[0].computedStyle,I=ws._registry[w[0].mode].serialize(w,f(P({},i),{defaultMode:b==="text"?"text":"math"}));!i.skipStyles&&E.color&&E.color!=="none"&&(!a||c!==E.color)?p.push(Zn("\\textcolor",(r=E.verbatimColor)!=null?r:E.color,un(I))):p.push(un(I))}}return p}function Hc(e,i){const{parent:r}=e[0],a=r==null?void 0:r.computedStyle.backgroundColor;return pa(e,"backgroundColor").map(c=>{var p;if(c.length>0||c[0].type!=="box"){const m=c[0].computedStyle;if(m.backgroundColor&&m.backgroundColor!=="none"&&(!r||a!==m.backgroundColor))return Zn("\\colorbox",(p=m.verbatimBackgroundColor)!=null?p:m.backgroundColor,un(sf(c,f(P({},i),{defaultMode:"text"}))))}return un(sf(c,i))})}function Wc(e,i){if(e.length===0)return[];const{parent:r}=e[0],a=r==null?void 0:r.computedStyle.fontSize,c=[];for(const p of pa(e,"fontSize")){const m=p[0].computedStyle.fontSize,b=Hc(p,i);b&&(m&&m!=="auto"&&(!r||a!==m)?c.push(["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][m],...b):c.push(...b))}return c}function af(e){return e?{mord:"ord",mbin:"bin",mop:"op",mrel:"rel",mopen:"open",mclose:"close",mpunct:"punct",minner:"inner",spacing:"ignore",latex:"latex",composition:"inner",error:"inner",placeholder:"ord",supsub:"ignore"}[e]:void 0}function Fr(e){if(e.length===0)return"ord";const i=af(e[0].type),r=af(e[e.length-1].type);return i&&i===r?i:"ord"}function Lu(e,i){if(typeof e=="string")return e;if(typeof e=="number"){console.assert(Number.isFinite(e));const r=Math.ceil(100*e)/100;return r===0?"0":r.toString()+(i!=null?i:"")}return""}var Mt=class Vp{constructor(i,r){var a,c,p,m,b;if(typeof i=="number"?this.value=String.fromCodePoint(i):typeof i=="string"?this.value=i:k(i)?this.children=i.filter(E=>E!==null):i&&i instanceof Vp&&(this.children=[i]),this.children)for(const E of this.children)E.parent=this;this.type=(a=r==null?void 0:r.type)!=null?a:"ignore",this.isSelected=(r==null?void 0:r.isSelected)===!0,r!=null&&r.caret&&(this.caret=r.caret),this.classes=(c=r==null?void 0:r.classes)!=null?c:"",this.isTight=(p=r==null?void 0:r.isTight)!=null?p:!1,r!=null&&r.attributes&&(this.attributes=r.attributes);let w=r==null?void 0:r.fontFamily;r!=null&&r.style&&this.value&&(w=(b=ws.getFont((m=r.mode)!=null?m:"math",this,f(P({variant:"normal"},r.style),{letterShapeStyle:r.letterShapeStyle})))!=null?b:void 0),w||(w="Main-Regular"),this._height=0,this._depth=0,this._width=0,this.hasExplicitWidth=!1,this.skew=0,this.italic=0,this.maxFontSize=0,this.scale=1,(r==null?void 0:r.maxFontSize)!==void 0&&(this.maxFontSize=r.maxFontSize),Zs(this,w)}set atomID(i){i===void 0||i.length===0||(this.id=i)}selected(i){if(this.isSelected!==i&&(this.isSelected=i,this.children))for(const r of this.children)r.selected(i)}setStyle(i,r,a){if(r===void 0)return;const c=Lu(r,a);c.length>0&&(this.cssProperties||(this.cssProperties={}),this.cssProperties[i]=c)}setTop(i){Number.isFinite(i)&&Math.abs(i)>.01&&(this.cssProperties||(this.cssProperties={}),this.cssProperties.top=Lu(i,"em"),this.height-=i,this.depth+=i)}get left(){var i;return(i=this.cssProperties)!=null&&i["margin-left"]?Number.parseFloat(this.cssProperties["margin-left"]):0}set left(i){Number.isFinite(i)&&(i===0?this.cssProperties&&delete this.cssProperties["margin-left"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-left"]=Lu(i,"em")))}set right(i){Number.isFinite(i)&&(i===0?this.cssProperties&&delete this.cssProperties["margin-right"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-right"]=Lu(i,"em")))}set bottom(i){Number.isFinite(i)&&(i===0?this.cssProperties&&delete this.cssProperties["margin-bottom"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-bottom"]=Lu(i,"em")))}get width(){return this._width*this.scale}set width(i){this._width=i,this.hasExplicitWidth=!0}set softWidth(i){}get height(){return this._height*this.scale}set height(i){this._height=i}get depth(){return this._depth*this.scale}set depth(i){this._depth=i}wrap(i){const r=i.parent;if(!r)return this;i.isPhantom&&this.setStyle("opacity",0);const a=i.color;a&&a!==r.color&&this.setStyle("color",a);let c=i.backgroundColor;this.isSelected&&(c=A(c)),c&&c!==r.backgroundColor&&(this.setStyle("background-color",c),this.setStyle("display","inline-block"));const p=i.scalingFactor;return this.scale=p,this.skew*=p,this.italic*=p,this}toMarkup(){var i,r,a,c;let p=(i=this.value)!=null?i:"";if(this.children)for(const ue of this.children)p+=ue.toMarkup();let m="";if(this.svgBody)m=_d(this.svgBody);else if(this.svgOverlay){m='<span style="',m+="display: inline-block;",m+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`,m+=`vertical-align:${Math.floor(100*this.depth)/100}em;`,m+='">',m+=p,m+="</span>",m+='<svg style="position:absolute;overflow:visible;',m+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`;const ue=(r=this.cssProperties)==null?void 0:r.padding;ue?(m+=`top:${ue};`,m+=`left:${ue};`,m+=`width:calc(100% - 2 * ${ue} );`):m+="top:0;left:0;width:100%;",m+="z-index:2;",m+='"',this.svgStyle&&(m+=this.svgStyle),m+=` viewBox="0 0 ${Math.floor(100*this.width)/100} ${Math.floor(100*(this.height+this.depth))/100}"`,m+=`>${this.svgOverlay}</svg>`}let b="";const w=this.classes.split(" ");w.push((a={latex:"ML__raw-latex",placeholder:"ML__placeholder",error:"ML__error"}[this.type])!=null?a:""),this.caret==="latex"&&w.push("ML__latex-caret"),this.isSelected&&w.push("ML__selected");const E=w.length===1?w[0]:w.filter((ue,me,Ge)=>ue.length>0&&Ge.indexOf(ue)===me).join(" ");if(E.length>0&&(b+=` class="${E}"`),this.id&&(b+=` data-atom-id=${this.id}`),this.cssId&&(b+=` id="${this.cssId.replace(/ /g,"-")}" `),this.attributes&&(b+=" "+Object.keys(this.attributes).map(ue=>`${ue}="${this.attributes[ue]}"`).join(" ")),this.htmlData){const ue=this.htmlData.split(",");for(const me of ue){const Ge=me.match(/([^=]+)=(.+$)/);if(Ge){const Lt=Ge[1].trim().replace(/ /g,"-");Lt&&(b+=` data-${Lt}="${Ge[2]}" `)}else{const Lt=me.trim().replace(/ /g,"-");Lt&&(b+=` data-${Lt} `)}}}const I=(c=this.cssProperties)!=null?c:{};this.hasExplicitWidth&&I.width===void 0&&(I.width=`${Math.ceil(this._width*100)/100}em`);const N=Object.keys(I).map(ue=>`${ue}:${I[ue]}`);if(this.scale!==void 0&&this.scale!==1&&(p.length>0||m.length>0)&&N.push(`font-size: ${Math.ceil(this.scale*1e4)/100}%`),this.htmlStyle){const ue=this.htmlStyle.split(";");let me="";for(const Ge of ue){const Lt=Ge.match(/([^=]+):(.+$)/);if(Lt){const Ue=Lt[1].trim().replace(/ /g,"-");Ue&&(me+=`${Ue}:${Lt[2]};`)}}me&&(b+=` style="${me}"`)}N.length>0&&(b+=` style="${N.join(";")}"`);let Z="";return b.length>0||m.length>0?Z=`<span${b}>${p}${m}</span>`:Z=p,this.caret==="text"?Z+='<span class="ML__text-caret"></span>':this.caret==="math"&&(Z+='<span class="ML__caret"></span>'),Z}tryCoalesceWith(i){if(this.svgBody||!this.value||i.svgBody||!i.value)return!1;const r=this.children&&this.children.length>0,a=i.children&&i.children.length>0;if(r||a)return!1;if(i.cssProperties||this.cssProperties){for(const w of["border","border-left","border-right","border-right-width","left","margin","margin-left","margin-right","padding","position","width"])if(i.cssProperties&&w in i.cssProperties||this.cssProperties&&w in this.cssProperties)return!1}const c=this.cssProperties?Object.keys(this.cssProperties).length:0,p=i.cssProperties?Object.keys(i.cssProperties).length:0;if(c!==p)return!1;if(c>0){for(const w of Object.keys(this.cssProperties))if(this.cssProperties[w]!==i.cssProperties[w])return!1}const m=this.classes.trim().replace(/\s+/g," ").split(" "),b=i.classes.trim().replace(/\s+/g," ").split(" ");if(m.length!==b.length)return!1;m.sort(),b.sort();for(const[w,E]of m.entries())if(E==="vertical-separator"||E!==b[w])return!1;return this.value+=i.value,this.height=Math.max(this.height,i.height),this.depth=Math.max(this.depth,i.depth),this._width=this._width+i._width,this.maxFontSize=Math.max(this.maxFontSize,i.maxFontSize),this.italic=i.italic,!0}};function Is(e){if(!e||e.length===0)return[];e[0].children=Is(e[0].children);const i=[e[0]];for(let r=1;r<e.length;r++)i[i.length-1].tryCoalesceWith(e[r])||(e[r].children=Is(e[r].children),i.push(e[r]));return i}function Du(e){return e.children&&(e.children=Is(e.children)),e}function Cu(e,i){if(!e)return new Mt(null,i);const r=new Mt(null,{classes:"ML__strut",type:"ignore"});r.setStyle("height",Math.max(0,e.height),"em");const a=[r];if(e.depth!==0){const c=new Mt(null,{classes:"ML__strut--bottom",type:"ignore"});c.setStyle("height",e.height+e.depth,"em"),c.setStyle("vertical-align",-e.depth,"em"),a.push(c)}return a.push(e),new Mt(a,f(P({},i),{type:"lift"}))}function Mu(e){const i=Uc(e)/2,r=new Mt(null,{maxFontSize:0});return r.height=i+.166,r.depth=i-.166,r.svgBody=e,r}function Zs(e,i){var r;if(e.type==="latex"){e.height=.9,e.depth=.2,e._width=1;return}if(e.value){e.height=-1/0,e.depth=-1/0,e._width=0,e.skew=-1/0,e.italic=-1/0;for(let a=0;a<e.value.length;a++){const c=so(e.value.codePointAt(a),i);e.height=Math.max(e.height,c.height),e.depth=Math.max(e.depth,c.depth),e._width+=c.width,e.skew=c.skew,e.italic=c.italic}return}if(e.children&&e.children.length>0){let a=-1/0,c=-1/0,p=0;for(const m of e.children)m.height>a&&(a=m.height),m.depth>c&&(c=m.depth),p=Math.max(p,(r=m.maxFontSize)!=null?r:0);e.height=a,e.depth=c,e._width=e.children.reduce((m,b)=>m+b.width,0),e.maxFontSize=p}}function of(e){if("individualShift"in e){const i=e.individualShift;let r=i[0];const a=[r],c=-r.shift-r.box.depth;let p=c;for(let m=1;m<i.length;m++){const b=i[m],w=-b.shift-p-b.box.depth,E=w-(r.box.height+r.box.depth);p=p+w,a.push(E),a.push(b),r=b}return[a,c]}if("top"in e){let i=e.top;for(const r of e.children)i-=typeof r=="number"?r:r.box.height+r.box.depth;return[e.children,i]}else{if("bottom"in e)return[e.children,-e.bottom];if("firstBaseline"in e){const i=e.firstBaseline[0];if(typeof i=="number")throw new Error("First child must be an element.");return[e.firstBaseline,-i.box.depth]}else if("shift"in e){const i=e.children[0];if(typeof i=="number")throw new Error("First child must be an element.");return[e.children,-i.box.depth-e.shift]}}return[null,0]}function lf(e){var i;const[r,a]=of(e);if(!r)return[[],0,0];const c=new Mt(null,{classes:"pstrut"});let p=0;for(const me of r)if(typeof me!="number"){const Ge=me.box;p=Math.max(p,Ge.maxFontSize,Ge.height)}p+=2,c.height=p,c.setStyle("height",p,"em");const m=[];let b=a,w=a,E=a,I=0;for(const me of r){if(typeof me=="number")E+=me;else{const Ge=me.box,Lt=(i=me.classes)!=null?i:[],Ue=new Mt([c,Ge],{classes:Lt.join(" "),style:me.style});Ge.setStyle("height",Ge.height+Ge.depth,"em"),Ge.setStyle("display","inline-block"),Ue.setStyle("top",-p-E-Ge.depth,"em"),me.marginLeft&&Ue.setStyle("margin-left",me.marginLeft,"em"),me.marginRight&&Ue.setStyle("margin-right",me.marginRight,"em"),m.push(Ue),E+=Ge.height+Ge.depth,I=Math.max(I,Ue.width)}b=Math.min(b,E),w=Math.max(w,E)}m.forEach(me=>{me.softWidth=I});const N=new Mt(m,{classes:"vlist"});if(N.softWidth=I,N.height=w,N.setStyle("height",w,"em"),b>=0)return[[new Mt(N,{classes:"vlist-r"})],w,-b];const Z=new Mt(new Mt(null),{classes:"vlist"});Z.height=-b,Z.setStyle("height",-b,"em");const ue=new Mt(8203,{classes:"vlist-s",maxFontSize:0});return ue.softWidth=0,ue.height=0,ue.depth=0,[[new Mt([N,ue],{classes:"vlist-r"}),new Mt(Z,{classes:"vlist-r"})],w,-b]}var Er=class extends Mt{constructor(e,i){var r;const[a,c,p]=lf(e);super(a.length===1?a[0]:a,{type:i==null?void 0:i.type,classes:((r=i==null?void 0:i.classes)!=null?r:"")+" vlist-t"+(a.length===2?" vlist-t2":"")}),this.height=c,this.depth=p,this.softWidth=a.reduce((m,b)=>Math.max(m,b.width),0)}};function bd(e,i){var r,a,c,p,m;const b=e.metrics,w=new Mt(i.base),E=(r=i.baseShift)!=null?r:0,I=(a=i.slant)!=null?a:0;let N=0,Z=0;i.above&&(N=(c=i.aboveShift)!=null?c:Math.max(b.bigOpSpacing1,b.bigOpSpacing3-i.above.depth)),i.below&&(Z=(p=i.belowShift)!=null?p:Math.max(b.bigOpSpacing2,b.bigOpSpacing4-i.below.height));let ue=null;if(i.below&&i.above){const me=b.bigOpSpacing5+i.below.height+i.below.depth+Z+w.depth+E;ue=new Er({bottom:me,children:[b.bigOpSpacing5,{box:i.below,marginLeft:-I,classes:["ML__center"]},Z,{box:w,classes:["ML__center"]},N,{box:i.above,marginLeft:I,classes:["ML__center"]},b.bigOpSpacing5]}).wrap(e)}else if(i.below&&!i.above)ue=new Er({top:w.height-E,children:[b.bigOpSpacing5,{box:i.below,marginLeft:-I,classes:["ML__center"]},Z,{box:w,classes:["ML__center"]}]}).wrap(e);else if(!i.below&&i.above){const me=w.depth+E;ue=new Er({bottom:me,children:[{box:w,classes:["ML__center"]},N,{box:i.above,marginLeft:I,classes:["ML__center"]},b.bigOpSpacing5]}).wrap(e)}else{const me=w.depth+E;ue=new Er({bottom:me,children:[{box:w},b.bigOpSpacing5]}).wrap(e)}return new Mt(ue,{type:(m=i.type)!=null?m:"op"})}var jc=7,Iu=6,Ru=5,ao=4,qo=3,fs=2,oo=1,Wr=0,Ia=class{constructor(e,i,r){this.id=e,this.sizeDelta=i,this.cramped=r;const a={"-4":2,"-3":1,0:0}[i];this.metrics=Object.keys(Nc).reduce((c,p)=>f(P({},c),{[p]:Nc[p][a]}),{})}getFontSize(e){return Math.max(1,e+this.sizeDelta)}get sup(){return Ys[[Wr,oo,Wr,oo,fs,qo,fs,qo][this.id]]}get sub(){return Ys[[Wr,Wr,Wr,Wr,fs,fs,fs,fs][this.id]]}get fracNum(){return Ys[[Wr,oo,Wr,oo,fs,qo,ao,Ru][this.id]]}get fracDen(){return Ys[[Wr,Wr,Wr,Wr,fs,fs,ao,ao][this.id]]}get cramp(){return Ys[[Wr,Wr,fs,fs,ao,ao,Iu,Iu][this.id]]}get isTight(){return this.sizeDelta<0}},kl={7:new Ia(jc,0,!1),6:new Ia(Iu,0,!0),5:new Ia(Ru,0,!1),4:new Ia(ao,0,!0),3:new Ia(qo,-3,!1),2:new Ia(fs,-3,!0),1:new Ia(oo,-4,!1),0:new Ia(Wr,-4,!0)},Ys=f(P({},kl),{displaystyle:kl[jc],textstyle:kl[Ru],scriptstyle:kl[qo],scriptscriptstyle:kl[oo]});function uf(e,i){var r;if(!e)return 0;const a={pt:1,mm:7227/2540,cm:7227/254,ex:35271/8192,px:3/4,em:fa,bp:803/800,dd:1238/1157,pc:12,in:72.27,mu:10/18}[(r=e.unit)!=null?r:"pt"];if(Number.isFinite(i)){const c=wa(10,i);return Math.round(e.dimension/fa*a*c)/c}return e.dimension*a}function cf(e,i){if(e===null)return 0;const r=uf(e)/fa;if(Number.isFinite(i)){const a=wa(10,i);return Math.round(r*a)/a}return r}function qc(e){var i;return`${e.dimension}${(i=e.unit)!=null?i:"pt"}`}function xd(e){let i=qc(e.glue);return e.grow&&e.grow.dimension!==0&&(i+=` plus ${qc(e.grow)}`),e.shrink&&e.shrink.dimension!==0&&(i+=` minus ${qc(e.shrink)}`),i}function Mr(e){var i,r;if(e==null)return null;let a="";if("dimension"in e&&(a=`${e.dimension}${(i=e.unit)!=null?i:"pt"}`),"glue"in e&&(a=xd(e)),"number"in e)if(!("base"in e)||e.base==="decimal")a=Number(e.number).toString();else if(e.base==="alpha")a=`\`${String.fromCodePoint(e.number)}`;else{const c=Math.round(e.number)>>>0;e.base==="hexadecimal"?(a=Number(c).toString(16).toUpperCase(),c<=255?a=a.padStart(2,"0"):c<=65535?a=a.padStart(4,"0"):c<=16777215?a=a.padStart(6,"0"):a=a.padStart(8,"0"),a=`"${a}`):e.base==="octal"&&(a=Number(c).toString(8),c<=63?a=a.padStart(2,"0"):c<=30583?a=a.padStart(4,"0"):a=a.padStart(8,"0"),a=`'${a}`)}return"register"in e&&("factor"in e&&(e.factor===-1?a="-":e.factor!==1&&(a=Number(e.factor).toString())),"global"in e&&e.global&&(a+="\\global"),a+=`\\${e.register}`),"string"in e&&(a=e.string),(r=e.relax)!=null&&r&&(a+="\\relax"),a}function Rs(e,i){return e==null?null:"number"in e?f(P({},e),{number:e.number*i}):"register"in e?"factor"in e&&e.factor?f(P({},e),{factor:e.factor*i}):f(P({},e),{factor:i}):"dimension"in e?f(P({},e),{dimension:e.dimension*i}):"glue"in e?e.shrink&&e.grow?{glue:Rs(e.glue,i),shrink:Rs(e.shrink,i),grow:Rs(e.grow,i)}:e.shrink?{glue:Rs(e.glue,i),shrink:Rs(e.shrink,i)}:e.grow?{glue:Rs(e.glue,i),grow:Rs(e.grow,i)}:{glue:Rs(e.glue,i)}:null}var wd={"p@":{dimension:1},"z@":{dimension:0},maxdimen:{dimension:16383.99999},hfuzz:{dimension:.1},vfuzz:{dimension:.1},overfullrule:{dimension:5},hsize:{dimension:6.5,unit:"in"},vsize:{dimension:8.9,unit:"in"},parindent:{dimension:20},maxdepth:{dimension:4},splitmaxdepth:{register:"maxdimen"},boxmaxdepth:{register:"maxdimen"},delimitershortfall:{dimension:5},nulldelimiterspace:{dimension:1.2,unit:"pt"},scriptspace:{dimension:.5},topskip:{dimension:10},splittopskip:{dimension:10},normalbaselineskip:{dimension:12},normallineskip:{dimension:1},normallineskiplimit:{dimension:0},jot:{dimension:3},doublerulesep:{dimension:2},arrayrulewidth:{dimension:.4},arraycolsep:{dimension:5},fboxsep:{dimension:3},fboxrule:{dimension:.4},"z@skip":{glue:{dimension:0},shrink:{dimension:0},grow:{dimension:0}},hideskip:{glue:{dimension:-1e3},grow:{dimension:1,unit:"fill"}},"@flushglue":{glue:{dimension:0},grow:{dimension:1,unit:"fill"}},parskip:{glue:{dimension:0},grow:{dimension:1}},abovedisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},abovedisplayshortskip:{glue:{dimension:0},grow:{dimension:3}},belowdisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},belowdisplayshortskip:{glue:{dimension:7},grow:{dimension:3},shrink:{dimension:4}},parfillskip:{glue:{dimension:0},grow:{dimension:1,unit:"fil"}},thinmuskip:{glue:{dimension:3,unit:"mu"}},medmuskip:{glue:{dimension:4,unit:"mu"},grow:{dimension:2,unit:"mu"},shrink:{dimension:4,unit:"mu"}},thickmuskip:{glue:{dimension:5,unit:"mu"},grow:{dimension:5,unit:"mu"}},smallskipamount:{glue:{dimension:3},grow:{dimension:1},shrink:{dimension:1}},medskipamount:{glue:{dimension:6},grow:{dimension:2},shrink:{dimension:3}},bigskipamount:{glue:{dimension:12},grow:{dimension:2},shrink:{dimension:4}},pretolerance:100,tolerance:200,hbadness:1e3,vbadness:1e3,linepenalty:10,hyphenpenalty:50,exhyphenpenalty:50,binoppenalty:700,relpenalty:500,clubpenalty:150,widowpenalty:150,displaywidowpenalty:50,brokenpenalty:100,predisplaypenalty:1e4,doublehyphendemerits:1e4,finalhyphendemerits:5e3,adjdemerits:1e4,tracinglostchars:1,uchyph:1,delimiterfactor:901,defaulthyphenchar:"\\-",defaultskewchar:-1,newlinechar:-1,showboxbreadth:5,showboxdepth:3,errorcontextlines:5,interdisplaylinepenalty:100,interfootnotelinepenalty:100,baselineSkip:1.2,arraystretch:1,month:new Date().getMonth()+1,day:new Date().getDate(),year:new Date().getFullYear()};function Pu(){return P({},wd)}function Tl(){return{registers:Pu(),smartFence:!1,renderPlaceholder:void 0,placeholderSymbol:"\u25A2",letterShapeStyle:$.locale.startsWith("fr")?"french":"tex",minFontScale:0,colorMap:Be,backgroundColorMap:At,getMacro:e=>rt(e,Gt())}}var sn=class Gp{constructor(i,r){var a,c,p,m,b,w,E,I,N,Z,ue,me,Ge,Lt,Ue;let ct;i!=null&&i.parent?(this.parent=i.parent,ct=i.parent,this.registers={}):(ct=P(P({},Tl()),(a=i==null?void 0:i.from)!=null?a:{}),this.registers=ct.registers),ct.atomIdsSettings&&(this.atomIdsSettings=P({},ct.atomIdsSettings)),this.renderPlaceholder=ct.renderPlaceholder,this.isPhantom=(m=(p=i==null?void 0:i.isPhantom)!=null?p:(c=this.parent)==null?void 0:c.isPhantom)!=null?m:!1,this.letterShapeStyle=ct.letterShapeStyle,this.minFontScale=ct.minFontScale,r!=null&&r.color&&r.color!=="none"?this.color=r.color:this.color=(w=(b=this.parent)==null?void 0:b.color)!=null?w:"",r!=null&&r.backgroundColor&&r.backgroundColor!=="none"?this.backgroundColor=r.backgroundColor:this.backgroundColor=(I=(E=this.parent)==null?void 0:E.backgroundColor)!=null?I:"",r!=null&&r.fontSize&&r.fontSize!=="auto"&&r.fontSize!==((N=this.parent)==null?void 0:N.size)?this.size=r.fontSize:this.size=(ue=(Z=this.parent)==null?void 0:Z.size)!=null?ue:Ho;let Rt=(Ge=(me=this.parent)==null?void 0:me.mathstyle)!=null?Ge:Ys.displaystyle;if(typeof(i==null?void 0:i.mathstyle)=="string"){if(ct instanceof Gp)switch(i.mathstyle){case"cramp":Rt=Rt.cramp;break;case"superscript":Rt=Rt.sup;break;case"subscript":Rt=Rt.sub;break;case"numerator":Rt=Rt.fracNum;break;case"denominator":Rt=Rt.fracDen;break}switch(i.mathstyle){case"textstyle":Rt=Ys.textstyle;break;case"displaystyle":Rt=Ys.displaystyle;break;case"scriptstyle":Rt=Ys.scriptstyle;break;case"scriptscriptstyle":Rt=Ys.scriptscriptstyle;break;case"":case"auto":break}}this.mathstyle=Rt,this.smartFence=ct.smartFence,this.placeholderSymbol=ct.placeholderSymbol,this.colorMap=(Lt=ct.colorMap)!=null?Lt:yt=>yt,this.backgroundColorMap=(Ue=ct.backgroundColorMap)!=null?Ue:yt=>yt,this.getMacro=ct.getMacro,console.assert(this.parent!==void 0||this.registers!==void 0)}makeID(){if(!this.atomIdsSettings)return;if(this.atomIdsSettings.overrideID)return this.atomIdsSettings.overrideID;if(typeof this.atomIdsSettings.seed!="number")return`${Date.now().toString(36).slice(-2)}${Math.floor(Math.random()*1e5).toString(36)}`;const i=this.atomIdsSettings.seed.toString(36);return this.atomIdsSettings.seed+=1,i}scale(i){return i*this.effectiveFontSize}get scalingFactor(){return this.parent?this.effectiveFontSize/this.parent.effectiveFontSize:1}get isDisplayStyle(){return this.mathstyle.id===jc||this.mathstyle.id===Iu}get isCramped(){return this.mathstyle.cramped}get isTight(){return this.mathstyle.isTight}get metrics(){return this.mathstyle.metrics}get effectiveFontSize(){return Math.max($c[Math.max(1,this.size+this.mathstyle.sizeDelta)],this.minFontScale)}getRegister(i){var r;if((r=this.registers)!=null&&r[i])return this.registers[i];if(this.parent)return this.parent.getRegister(i)}getRegisterAsNumber(i){const r=this.getRegister(i);if(typeof r=="number")return r;if(typeof r=="string")return Number(r)}getRegisterAsGlue(i){var r;if((r=this.registers)!=null&&r[i]){const a=this.registers[i];return typeof a=="object"&&"glue"in a?a:typeof a=="object"&&"dimension"in a?{glue:{dimension:a.dimension}}:typeof a=="number"?{glue:{dimension:a}}:void 0}if(this.parent)return this.parent.getRegisterAsGlue(i)}getRegisterAsEm(i,r){return cf(this.getRegisterAsDimension(i),r)}getRegisterAsDimension(i){var r;if((r=this.registers)!=null&&r[i]){const a=this.registers[i];return typeof a=="object"&&"glue"in a?a.glue:typeof a=="object"&&"dimension"in a?a:typeof a=="number"?{dimension:a}:void 0}if(this.parent)return this.parent.getRegisterAsDimension(i)}setRegister(i,r){if(r===void 0){delete this.registers[i];return}this.registers[i]=r}evaluate(i){if(!i||!("register"in i))return i;let r=this;if("global"in i&&i.global)for(;r.parent;)r=r.parent;let a=1;"factor"in i&&i.factor!==1&&i.factor!==void 0&&(a=i.factor);const c=r.getRegister(i.register);if(c===void 0)return;if(typeof c=="string")return{string:Number(c).toString()+c};if(typeof c=="number")return{number:a*c};const p=r.evaluate(c);if(p!==void 0)return"string"in p?{string:Number(c).toString()+p.string}:"number"in p?{number:a*p.number}:"dimension"in p?f(P({},p),{dimension:a*p.dimension}):"glue"in p?f(P({},p),{glue:f(P({},p.glue),{dimension:a*p.glue.dimension}),shrink:p.shrink?f(P({},p.shrink),{dimension:a*p.shrink.dimension}):void 0,grow:p.grow?f(P({},p.grow),{dimension:a*p.grow.dimension}):void 0}):i}toDimension(i){const r=this.evaluate(i);return r===void 0?null:"dimension"in r?r:"glue"in r?r.glue:"number"in r?{dimension:r.number}:null}toEm(i,r){if(i===null)return 0;const a=this.toDimension(i);return a===null?0:uf(a,r)/fa}toNumber(i){if(i===null)return null;const r=this.evaluate(i);return r===void 0?null:"number"in r?r.number:"dimension"in r?r.dimension:"glue"in r?r.glue.dimension:"string"in r?Number(r.string):null}toColor(i){var r,a;if(i===null)return null;const c=this.evaluate(i);return c===void 0?null:"string"in c?(a=(r=this.colorMap)==null?void 0:r.call(this,c.string))!=null?a:c.string:null}toBackgroundColor(i){var r,a;if(i===null)return null;const c=this.evaluate(i);return c===void 0?null:"string"in c?(a=(r=this.backgroundColorMap)==null?void 0:r.call(this,c.string))!=null?a:c.string:null}},Zo=["body","above","below","superscript","subscript"];function lo(e){return typeof e=="string"&&Zo.includes(e)}function Al(e){return e!==void 0&&Array.isArray(e)&&e.length===2}var Qe=class To{constructor(i){var r,a,c,p,m,b;this.type=i.type,typeof i.value=="string"&&(this.value=i.value),this.command=(a=(r=i.command)!=null?r:this.value)!=null?a:"",this.mode=(c=i.mode)!=null?c:"math",i.isFunction&&(this.isFunction=!0),i.limits&&(this.subsupPlacement=i.limits),this.style=P({},i.style),this.displayContainsHighlight=(p=i.displayContainsHighlight)!=null?p:!1,this.captureSelection=(m=i.captureSelection)!=null?m:!1,this.skipBoundary=(b=i.skipBoundary)!=null?b:!1,i.verbatimLatex!==void 0&&i.verbatimLatex!==null&&(this.verbatimLatex=i.verbatimLatex),i.args&&(this.args=i.args),i.body&&(this.body=i.body),this._changeCounter=0}static createBox(i,r,a){var c;if(!r)return null;const p=_r(r),m=[];for(const w of p){const E=w[0].style,I=uo(i,w,{style:{color:E.color,backgroundColor:E.backgroundColor,fontSize:E.fontSize}});I&&m.push(I)}if(m.length===0)return null;const b=((c=a==null?void 0:a.classes)!=null?c:"").trim();return m.length===1&&!b&&!(a!=null&&a.type)?m[0].wrap(i):new Mt(m,{classes:b,type:a==null?void 0:a.type}).wrap(i)}static serialize(i,r){return ws.serialize(i,r)}static commonAncestor(i,r){if(i===r||i.parent===r.parent)return i.parent;const a=new WeakSet;let{parent:c}=i;for(;c;)a.add(c),c=c.parent;for(c=r.parent;c;){if(a.has(c))return c;c=c.parent}console.assert(!!c)}static fromJson(i){return typeof i=="string"?new To({type:"mord",value:i,mode:"math"}):new To(i)}get latexMode(){return this.mode==="math"?"math":"text"}toJson(){const i={};if(this.type&&(i.type=this.type),this.mode!=="math"&&(i.mode=this.mode),this.command&&this.command!==this.value&&(i.command=this.command),this.value!==void 0&&(i.value=this.value),this.style&&Object.keys(this.style).length>0&&(i.style=P({},this.style)),this.verbatimLatex!==void 0&&(i.verbatimLatex=this.verbatimLatex),this.subsupPlacement&&(i.subsupPlacement=this.subsupPlacement),this.explicitSubsupPlacement&&(i.explicitSubsupPlacement=!0),this.isFunction&&(i.isFunction=!0),this.displayContainsHighlight&&(i.displayContainsHighlight=!0),this.isExtensibleSymbol&&(i.isExtensibleSymbol=!0),this.skipBoundary&&(i.skipBoundary=!0),this.captureSelection&&(i.captureSelection=!0),this.args&&(i.args=Sd(this.args)),this._branches)for(const r of Object.keys(this._branches))this._branches[r]&&(i[r]=this._branches[r].filter(a=>a.type!=="first").map(a=>a.toJson()));return i.type==="mord"&&Object.keys(i).length===2&&"value"in i?i.value:i}get changeCounter(){return this.parent?this.parent.changeCounter:this._changeCounter}set isDirty(i){if(i){this.parent||this._changeCounter++,"verbatimLatex"in this&&(this.verbatimLatex=void 0),this._children=void 0;let{parent:r}=this;for(;r;)r.parent||r._changeCounter++,"verbatimLatex"in r&&(r.verbatimLatex=void 0),r._children=void 0,r=r.parent}}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Ce(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):this.body&&this.command?un([Zn(this.command,this.bodyToLatex(i)),this.supsubToLatex(i)]):this.body?un([this.bodyToLatex(i),this.supsubToLatex(i)]):!this.value||this.value==="\u200B"?"":this.command}bodyToLatex(i){var r;return ws.serialize(this.body,f(P({},i),{defaultMode:(r=i.defaultMode)!=null?r:this.latexMode}))}aboveToLatex(i){return ws.serialize(this.above,i)}belowToLatex(i){return ws.serialize(this.below,i)}supsubToLatex(i){let r="";if(i=f(P({},i),{defaultMode:"math"}),this.branch("subscript")!==void 0){const a=ws.serialize(this.subscript,i);a.length===0?r+="_{}":a.length===1?/^[0-9]$/.test(a)?r+=`_${a}`:r+=`_{${a}}`:r+=`_{${a}}`}if(this.branch("superscript")!==void 0){const a=ws.serialize(this.superscript,i);a.length===0?r+="^{}":a.length===1?a==="\u2032"?r+="^\\prime ":a==="\u2033"?r+="^\\doubleprime ":/^[0-9]$/.test(a)?r+=`^${a}`:r+=`^{${a}}`:r+=`^{${a}}`}return r}get treeDepth(){let i=1,r=this.parent;for(;r;)r=r.parent,i+=1;return i}get inCaptureSelection(){let i=this;for(;i;){if(i.captureSelection)return!0;i=i.parent}return!1}get parentPrompt(){let i=this.parent;for(;i;){if(i.type==="prompt"&&!i.captureSelection)return i;i=i.parent}return null}branch(i){if(lo(i)&&this._branches)return this._branches[i]}get branches(){if(!this._branches)return[];const i=[];for(const r of Zo)this._branches[r]&&i.push(r);return i}createBranch(i){return console.assert(lo(i)),lo(i)?(this._branches?this._branches[i]||(this._branches[i]=[this.makeFirstAtom(i)]):this._branches={[i]:[this.makeFirstAtom(i)]},this.isDirty=!0,this._branches[i]):[]}get row(){return Al(this.parentBranch)?this.parentBranch[0]:-1}get col(){return Al(this.parentBranch)?this.parentBranch[1]:-1}get body(){var i;return(i=this._branches)==null?void 0:i.body}set body(i){this.setChildren(i,"body")}get superscript(){var i;return(i=this._branches)==null?void 0:i.superscript}set superscript(i){this.setChildren(i,"superscript")}get subscript(){var i;return(i=this._branches)==null?void 0:i.subscript}set subscript(i){this.setChildren(i,"subscript")}get above(){var i;return(i=this._branches)==null?void 0:i.above}set above(i){this.setChildren(i,"above")}get below(){var i;return(i=this._branches)==null?void 0:i.below}set below(i){this.setChildren(i,"below")}get computedStyle(){var i,r;const a=typeof this.style.verbatimColor=="string",c=typeof this.style.verbatimBackgroundColor=="string",p=P(P({},(r=(i=this.parent)==null?void 0:i.computedStyle)!=null?r:{}),this.style);return delete p.variant,delete p.variantStyle,c||delete p.verbatimBackgroundColor,a||delete p.verbatimColor,p}applyStyle(i){this.isDirty=!0,this.style=P(P({},this.style),i),this.style.fontFamily==="none"&&delete this.style.fontFamily,this.style.fontShape==="auto"&&delete this.style.fontShape,this.style.fontSeries==="auto"&&delete this.style.fontSeries,this.style.color==="none"&&(delete this.style.color,delete this.style.verbatimColor),this.style.backgroundColor==="none"&&(delete this.style.backgroundColor,delete this.style.verbatimBackgroundColor),this.style.fontSize==="auto"&&delete this.style.fontSize;for(const r of this.children)r.applyStyle(i)}getInitialBaseElement(){var i,r,a;return this.hasEmptyBranch("body")?this:(console.assert(((i=this.body)==null?void 0:i[0].type)==="first"),(a=(r=this.body[1])==null?void 0:r.getInitialBaseElement())!=null?a:this)}getFinalBaseElement(){return this.hasEmptyBranch("body")?this:this.body[this.body.length-1].getFinalBaseElement()}isCharacterBox(){return this.type==="leftright"||this.type==="genfrac"||this.type==="subsup"||this.type==="delim"||this.type==="array"||this.type==="surd"?!1:this.getFinalBaseElement().type==="mord"}hasEmptyBranch(i){const r=this.branch(i);return r?(console.assert(r.length>0),console.assert(r[0].type==="first"),r.length===1):!0}setChildren(i,r){var a;if(!i||(console.assert(lo(r)),!lo(r)))return;console.assert(((a=i[0])==null?void 0:a.type)!=="first");const c=[this.makeFirstAtom(r),...i];this._branches?this._branches[r]=c:this._branches={[r]:c};for(const p of i)p.parent=this,p.parentBranch=r;this.isDirty=!0}makeFirstAtom(i){const r=new To({type:"first",mode:this.mode});return r.parent=this,r.parentBranch=i,r}addChild(i,r){console.assert(i.type!=="first"),this.createBranch(r).push(i),this.isDirty=!0,i.parent=this,i.parentBranch=r}addChildBefore(i,r){console.assert(r.parentBranch!==void 0);const a=this.createBranch(r.parentBranch);a.splice(a.indexOf(r),0,i),this.isDirty=!0,i.parent=this,i.parentBranch=r.parentBranch}addChildAfter(i,r){console.assert(r.parentBranch!==void 0);const a=this.createBranch(r.parentBranch);a.splice(a.indexOf(r)+1,0,i),this.isDirty=!0,i.parent=this,i.parentBranch=r.parentBranch}addChildren(i,r){const a=this.createBranch(r);for(const c of i)c.parent=this,c.parentBranch=r,a.push(c);this.isDirty=!0}addChildrenAfter(i,r){console.assert(i.length===0||i[0].type!=="first"),console.assert(r.parentBranch!==void 0);const a=this.createBranch(r.parentBranch);a.splice(a.indexOf(r)+1,0,...i),this.isDirty=!0;for(const c of i)c.parent=this,c.parentBranch=r.parentBranch;return i[i.length-1]}removeBranch(i){const r=this.branch(i);if(lo(i)&&(this._branches[i]=void 0),!r)return[];for(const a of r)a.parent=void 0,a.parentBranch=void 0;return console.assert(r[0].type==="first"),r.shift(),this.isDirty=!0,r}removeChild(i){if(console.assert(i.parent===this),i.type==="first")return;const r=this.branch(i.parentBranch),a=r.indexOf(i);console.assert(a>=0),r.splice(a,1),this.isDirty=!0,i.parent=void 0,i.parentBranch=void 0}get siblings(){return this.parent?this.parent.branch(this.parentBranch):[]}get firstSibling(){return this.siblings[0]}get lastSibling(){const{siblings:i}=this;return i[i.length-1]}get isFirstSibling(){return this===this.firstSibling}get isLastSibling(){return this===this.lastSibling}get hasNoSiblings(){return this.siblings.length===1}get leftSibling(){console.assert(this.parent!==void 0);const i=this.parent.branch(this.parentBranch);return i[i.indexOf(this)-1]}get rightSibling(){console.assert(this.parent!==void 0);const i=this.parent.branch(this.parentBranch);return i[i.indexOf(this)+1]}get hasChildren(){return!!(this._branches&&this.children.length>0)}get firstChild(){return console.assert(this.hasChildren),this.children[0]}get lastChild(){console.assert(this.hasChildren);const{children:i}=this;return i[i.length-1]}get children(){if(this._children)return this._children;if(!this._branches)return[];const i=[];for(const r of Zo)if(this._branches[r])for(const a of this._branches[r])i.push(...a.children),i.push(a);return this._children=i,i}render(i){if(this.type==="first"&&!i.atomIdsSettings)return null;const r=Ce(this.command,this.mode);if(r!=null&&r.render)return r.render(this,i);const a=new sn({parent:i},this.style);let c=this.createBox(a,{classes:this.parent?"":"ML__base"});return c?(!this.subsupPlacement&&(this.superscript||this.subscript)&&(c=this.attachSupsub(a,{base:c})),c.wrap(a)):null}attachSupsub(i,r){var a;const c=r.base,p=this.superscript,m=this.subscript;if(!p&&!m)return c;let b=null,w=null;const E=(a=r.isCharacterBox)!=null?a:this.isCharacterBox();let I=0;if(p){const Ge=new sn({parent:i,mathstyle:"superscript"});b=To.createBox(Ge,p),E||(I=c.height-i.metrics.supDrop*Ge.scalingFactor)}let N=0;if(m){const Ge=new sn({parent:i,mathstyle:"subscript"});w=To.createBox(Ge,m),E||(N=c.depth+i.metrics.subDrop*Ge.scalingFactor)}let Z;i.isDisplayStyle?Z=i.metrics.sup1:i.isCramped?Z=i.metrics.sup3:Z=i.metrics.sup2;const ue=.5/fa/i.scalingFactor;let me=null;if(w&&b){I=Math.max(I,Z,b.depth+.25*i.metrics.xHeight),N=Math.max(N,i.metrics.sub2);const Ge=i.metrics.defaultRuleThickness;if(I-b.depth-(w.height-N)<4*Ge){N=4*Ge-(I-b.depth)+w.height;const Ue=.8*i.metrics.xHeight-(I-b.depth);Ue>0&&(I+=Ue,N-=Ue)}const Lt=this.isExtensibleSymbol&&c.italic?-c.italic:0;me=new Er({individualShift:[{box:w,shift:N,marginLeft:Lt},{box:b,shift:-I}]}).wrap(i)}else w&&!b?(N=Math.max(N,i.metrics.sub1,w.height-.8*da),me=new Er({shift:N,children:[{box:w,marginRight:ue,marginLeft:this.isCharacterBox()?-c.italic:0}]})):!w&&b&&(I=Math.max(I,Z,b.depth+.25*da),me=new Er({shift:-I,children:[{box:b,marginRight:ue}]}));return new Mt([c,new Mt(me,{caret:this.caret,isSelected:this.isSelected,classes:"msubsup"})],{type:r.type})}attachLimits(i,r){const a=this.superscript?To.createBox(new sn({parent:i,mathstyle:"superscript"},this.style),this.superscript):null,c=this.subscript?To.createBox(new sn({parent:i,mathstyle:"subscript"},this.style),this.subscript):null;return!a&&!c?r.base.wrap(i):bd(i,f(P({},r),{above:a,below:c}))}bind(i,r){if(!r||i.isPhantom||this.value==="\u200B")return r;let a=this.parent;for(;a&&!a.captureSelection;)a=a.parent;return a!=null&&a.captureSelection||(this.id||(this.id=i.makeID()),r.atomID=this.id),r}createBox(i,r){var a,c,p,m;const b=(a=this.value)!=null?a:this.body,w=(c=r==null?void 0:r.boxType)!=null?c:af(this.type);let E=(p=r==null?void 0:r.classes)!=null?p:"";this.mode==="text"&&(E+=" ML__text");const I=typeof b=="string"||b===void 0?new Mt(b!=null?b:null,{type:w,isSelected:this.isSelected,mode:this.mode,maxFontSize:i.scalingFactor,style:f(P({variant:"normal"},this.style),{fontSize:Math.max(1,i.size+i.mathstyle.sizeDelta)}),letterShapeStyle:i.letterShapeStyle,classes:E}):(m=To.createBox(i,b,{type:w,classes:E}))!=null?m:new Mt(null);return i.isTight&&(I.isTight=!0),(this.mode!=="math"||this.style.variant==="main")&&(I.italic=0),I.right=I.italic,this.bind(i,I),this.caret&&!this.superscript&&!this.subscript&&(I.caret=this.caret),I}isDigit(){var i;return this.type==="mord"&&this.value?/^[\d,\.]$/.test(this.value):this.type==="group"&&((i=this.body)==null?void 0:i.length)===2?this.body[0].type==="first"&&this.body[1].value===",":!1}asDigit(){var i;return this.type==="mord"&&this.value&&/^[\d,\.]$/.test(this.value)?this.value:this.type==="group"&&((i=this.body)==null?void 0:i.length)===2&&this.body[0].type==="first"&&this.body[1].value===","?".":""}};function _r(e){let i;const r=[];let a=[];for(const c of e)if(!i&&!c.style)a.push(c);else{const p=c.computedStyle;i&&p.color===i.color&&p.backgroundColor===i.backgroundColor&&p.fontSize===i.fontSize?a.push(c):(a.length>0&&r.push(a),a=[c],i=p)}return a.length>0&&r.push(a),r}function uo(e,i,r){var a,c,p,m,b;if(!i||i.length===0)return null;const w=new sn({parent:e},r.style),E=!((a=w.atomIdsSettings)!=null&&a.groupNumbers);let I=[];if(i.length===1){const Z=i[0],ue=Z.render(w);ue&&(E&&Z.isSelected&&ue.selected(!0),I=[ue])}else{let Z="",ue=!0;for(const me of i){(c=w.atomIdsSettings)!=null&&c.groupNumbers&&Z&&(ue&&me.isDigit()||!ue&&Xs(me))&&(w.atomIdsSettings.overrideID=Z);const Ge=me.render(w);w.atomIdsSettings&&(w.atomIdsSettings.overrideID=void 0),Ge&&((p=w.atomIdsSettings)!=null&&p.groupNumbers&&((me.isDigit()||Xs(me))&&(!Z||ue!==me.isDigit())&&(ue=me.isDigit(),Z=(m=me.id)!=null?m:""),Z&&(!(me.isDigit()||Xs(me))||!me.hasEmptyBranch("superscript")||!me.hasEmptyBranch("subscript"))&&(Z="")),E&&me.isSelected&&Ge.selected(!0),I.push(Ge))}}if(I.length===0)return null;const N=new Mt(I,f(P({isTight:w.isTight},r),{type:(b=r.type)!=null?b:"lift"}));return N.isSelected=I.every(Z=>Z.isSelected),N.wrap(w)}function Xs(e){return e.mode==="text"}function Sd(e){return e.map(i=>i===null?"<null>":Array.isArray(i)&&i[0]instanceof Qe?{atoms:i.map(r=>r.toJson())}:typeof i=="object"&&"group"in i?{group:i.group.map(r=>r.toJson())}:i)}var Ll=class Hp extends Qe{constructor(i,r,a){super({type:"text",command:i,mode:"text",displayContainsHighlight:!0}),this.value=r,this.verbatimLatex=r,this.applyStyle(a)}static fromJson(i){return new Hp(i.command,i.value,i.style)}render(i){const r=this.createBox(i);return this.caret&&(r.caret=this.caret),r}_serialize(i){var r;return(r=this.verbatimLatex)!=null?r:ut("text",this.value.codePointAt(0))}};function Ed(e,i){if(e.direction===i.direction){const r=e.ranges.length;if(i.ranges.length===r){let a=0;for(;a<r&&kd(e.ranges[a],i.ranges[a])==="equal";)a++;return a===r?"equal":"different"}}return"different"}function kd(e,i){return e[0]===i[0]&&e[1]===i[1]?"equal":"different"}function jr(e){let i=1/0,r=-1/0;for(const a of e.ranges)i=Math.min(i,a[0],a[1]),r=Math.max(r,a[0],a[1]);return[i,r]}function Ra(e){return typeof e=="number"&&!Number.isNaN(e)}function Dl(e){return Array.isArray(e)&&e.length===2}function Ou(e){return e!=null&&typeof e=="object"&&"ranges"in e&&Array.isArray(e.ranges)}function Fu(e,i){const r=e.at(i);let a;if(r){a=r.mode;let c=r.parent;for(;!a&&c;)c&&(a=c.mode),c=c.parent}return a}function Zc(e,i){if(!i)return"";if(typeof i=="string")return i;if(!e||i.after===void 0)return i.value;let r=!1,a=!1,c=!1,p=!1,m=!1,b=!1,w=!1,E=!1,I=!1,N=!1,Z=!1,ue=!1,me=!1,Ge=!1,Lt=!1,Ue=e[0],ct=0;for(;Ue!=null&&Ue.type&&/^(subsup|placeholder)$/.test(Ue.type);)ct+=1,Ue=e[ct];return r=!Ue||Ue.type==="first",Ue&&(Ge=Ue.mode==="text",a=!Ge&&Ue.type==="mord"&&ve.test(Ue.value),c=!Ge&&Ue.type==="mord"&&/\d+$/.test(Ue.value),p=!Ge&&Ue.isFunction,m=Ue.type==="genfrac",b=Ue.type==="surd",w=Ue.type==="mbin",E=Ue.type==="mrel",I=Ue.type==="mop"||Ue.type==="operator"||Ue.type==="extensible-symbol",N=Ue.type==="mpunct"||Ue.type==="minner",Z=Ue.type==="array",ue=Ue.type==="mopen",me=Ue.type==="mclose"||Ue.type==="leftright",Lt=Ue.type==="space"),i.after.includes("nothing")&&r||i.after.includes("letter")&&a||i.after.includes("digit")&&c||i.after.includes("function")&&p||i.after.includes("frac")&&m||i.after.includes("surd")&&b||i.after.includes("binop")&&w||i.after.includes("relop")&&E||i.after.includes("operator")&&I||i.after.includes("punct")&&N||i.after.includes("array")&&Z||i.after.includes("openfence")&&ue||i.after.includes("closefence")&&me||i.after.includes("text")&&Ge||i.after.includes("space")&&Lt?i.value:""}function Yo(e,i,r){return r?Zc(e,r[i]):""}var Td={"&":"\\&","%":"\\%",$:"\\$","''":"^{\\doubleprime}","'''":"^{\\prime\\prime\\prime}","''''":"^{\\prime\\prime\\prime\\prime}",alpha:"\\alpha",delta:"\\delta",Delta:"\\Delta",pi:"\\pi",Pi:"\\Pi",theta:"\\theta",Theta:"\\Theta",ii:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryI"},jj:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryJ"},ee:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\exponentialE"},nabla:"\\nabla",grad:"\\nabla",del:"\\partial",deg:{after:"digit+space",value:"\\degree"},infty:"\\infty","\u221E":"\\infty",oo:{after:"nothing+digit+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\infty"},"\u2211":"\\sum",sum:"\\sum_{#?}^{#?}",int:"\\int_{#?}^{#?}",prod:"\\prod_{#?}^{#?}",sqrt:"\\sqrt{#?}","\u2206":"\\differentialD","\u2202":"\\differentialD",arcsin:"\\arcsin",arccos:"\\arccos",arctan:"\\arctan",arcsec:"\\arcsec",arccsc:"\\arccsc",arsinh:"\\arsinh",arcosh:"\\arcosh",artanh:"\\artanh",arcsech:"\\arcsech",arccsch:"\\arccsch",arg:"\\arg",ch:"\\ch",cosec:"\\cosec",cosh:"\\cosh",cot:"\\cot",cotg:"\\cotg",coth:"\\coth",csc:"\\csc",ctg:"\\ctg",cth:"\\cth",sec:"\\sec",sinh:"\\sinh",sh:"\\sh",tanh:"\\tanh",tg:"\\tg",th:"\\th",sin:"\\sin",cos:"\\cos",tan:"\\tan",lg:"\\lg",lb:"\\lb",log:"\\log",ln:"\\ln",exp:"\\exp",lim:"\\lim_{#?}",dx:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD x"},dy:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD y"},dt:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD t"},AA:"\\forall",EE:"\\exists","!EE":"\\nexists","&&":"\\land",xin:{after:"nothing+text+relop+punct+openfence+space",value:"x \\in"},sint:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\sin t"},in:{after:"nothing+letter+closefence",value:"\\in"},"!in":"\\notin",NN:"\\mathbb{N}",ZZ:"\\Z",QQ:"\\Q",RR:"\\R",CC:"\\C",xx:"\\times","+-":"\\pm","\u2260":"\\ne","!=":"\\ne","\u2265":"\\ge",">=":"\\ge","\u2264":"\\le","<=":"\\le","<<":"\\ll",">>":"\\gg","~~":"\\approx","\u2248":"\\approx","?=":"\\questeq","\xF7":"\\div","\xAC":"\\neg",":=":"\\coloneq","::":"\\Colon","(:":"\\langle",":)":"\\rangle",beta:"\\beta",chi:"\\chi",epsilon:"\\epsilon",varepsilon:"\\varepsilon",eta:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\eta"},gamma:"\\gamma",Gamma:"\\Gamma",iota:"\\iota",kappa:"\\kappa",lambda:"\\lambda",Lambda:"\\Lambda",mu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\mu"},nu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\nu"},\u00B5:"\\mu",phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\phi"},Phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Phi"},varphi:"\\varphi",psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\psi"},Psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Psi"},rho:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\rho"},sigma:"\\sigma",Sigma:"\\Sigma",tau:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\tau"},vartheta:"\\vartheta",upsilon:"\\upsilon",xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\xi"},Xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Xi"},zeta:"\\zeta",omega:"\\omega",Omega:"\\Omega",\u03A9:"\\omega",forall:"\\forall",exists:"\\exists","!exists":"\\nexists",":.":"\\therefore",liminf:"\\liminf_{#?}",limsup:"\\limsup_{#?}",argmin:"\\operatorname*{arg~min}_{#?}",argmax:"\\operatorname*{arg~max}_{#?}",det:"\\det",mod:"\\bmod{#?}","(mod":"\\pmod{#?}",max:"\\max",min:"\\min",erf:"\\operatorname{erf}",erfc:"\\operatorname{erfc}",bessel:"\\operatorname{bessel}",mean:"\\operatorname{mean}",median:"\\operatorname{median}",fft:"\\operatorname{fft}",lcm:"\\operatorname{lcm}",gcd:"\\operatorname{gcd}",randomReal:"\\operatorname{randomReal}",randomInteger:"\\operatorname{randomInteger}",Re:"\\operatorname{Re}",Im:"\\operatorname{Im}",mm:{after:"nothing+digit+operator",value:"\\operatorname{mm}"},cm:{after:"nothing+digit+operator",value:"\\operatorname{cm}"},km:{after:"nothing+digit+operator",value:"\\operatorname{km}"},kg:{after:"nothing+digit+operator",value:"\\operatorname{kg}"},"...":"\\ldots","+...":"+\\cdots","-...":"-\\cdots","->...":"\\to\\cdots","-->...":"\\longrightarrow\\cdots","->":"\\to","|->":"\\mapsto","-->":"\\longrightarrow","<--":"\\longleftarrow","=>":"\\Rightarrow","==>":"\\Longrightarrow","<=>":"\\Leftrightarrow","<->":"\\leftrightarrow","(.)":"\\odot","(+)":"\\oplus","(/)":"\\oslash","(*)":"\\otimes","(-)":"\\ominus","||":"\\Vert","*":"\\cdot","**":"\\star","***":"\\ast","//":"\\slash","\\\\":"\\backslash",setminus:"\\backslash","|><":"\\ltimes","><|":"\\rtimes","|><|":"\\bowtie","-:":"\\div",divide:"\\div","@":"\\circ","^^":"\\wedge","^^^":"\\bigwedge",vv:"\\vee",vvv:"\\bigvee",nn:"\\cap",nnn:"\\bigcap",uu:"\\cup",uuu:"\\bigcup","-=":"\\equiv","~=":"\\cong",lt:"<","lt=":"\\leq",gt:">","gt=":"\\geq","-<":"\\prec","-lt":"\\prec","-<=":"\\preceq",">-=":"\\succeq",prop:"\\propto",diamond:"\\diamond",square:"\\square",iff:"\\iff",sub:"\\subset",sup:"\\supset",sube:"\\subseteq",supe:"\\supseteq",uarr:"\\uparrow",darr:"\\downarrow",rarr:"\\rightarrow",rArr:"\\Rightarrow",larr:"\\leftarrow",lArr:"\\Leftarrow",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",aleph:"\\aleph",and:"\\land",or:"\\lor",not:"\\neg","_|_":"\\bot",TT:"\\top","|--":"\\vdash","|==":"\\models","|__":"\\lfloor","__|":"\\rfloor","|~":"\\lceil","~|":"\\rceil",">->":"\\rightarrowtail","->>":"\\twoheadrightarrow",">->>":"\\twoheadrightarrowtail",frac:"\\frac{#?}{#?}",cbrt:"\\sqrt[3]{#?}",nthroot:"\\sqrt[#?]{#?}"};function Bu(e,i){var r;let a=(r=i==null?void 0:i.format)!=null?r:"auto";return a==="auto"&&([a,e]=$u(e)),a==="ascii-math"?(e=e.replace(/\u2061/gu,""),e=e.replace(/\u3016/gu,"{"),e=e.replace(/\u3017/gu,"}"),e=e.replace(/([^\\])sinx/g,"$1\\sin x"),e=e.replace(/([^\\])cosx/g,"$1\\cos x "),e=e.replace(/\u2013/g,"-"),["ascii-math",Qr(e,{inlineShortcuts:i==null?void 0:i.inlineShortcuts})]):["latex",e]}function Qr(e,i){var r,a,c;if(!e)return"";let p=!1,m;const b=(r=i.inlineShortcuts)!=null?r:Td;if(!p&&(e.startsWith("^")||e.startsWith("_"))&&(m=Pa(e.slice(1),{inlineShortcuts:b,noWrap:!0}),e=e[0]+"{"+m.match+"}",e+=Qr(m.rest,i),p=!0),p||(m=e.match(/^(sqrt|\u221A)(.*)/),m&&(m=Pa(m[2],{inlineShortcuts:b,noWrap:!0}),e="\\sqrt{"+((a=m.match)!=null?a:"\\placeholder{}")+"}",e+=Qr(m.rest,i),p=!0)),p||(m=e.match(/^(\\cbrt|\u221B)(.*)/),m&&(m=Pa(m[2],{inlineShortcuts:b,noWrap:!0}),e="\\sqrt[3]{"+((c=m.match)!=null?c:"\\placeholder{}")+"}",e+=Qr(m.rest,i),p=!0)),p||(m=e.match(/^abs(.*)/),m&&(m=Pa(m[1],{inlineShortcuts:b,noWrap:!0}),e="\\left|"+m.match+"\\right|",e+=Qr(m.rest,i),p=!0)),p||(m=e.match(/^["”“](.*?)["”“](.*)/),m&&(e="\\text{"+m[1]+"}",e+=Qr(m[2],i),p=!0)),p||(m=e.match(/^([^a-zA-Z\(\{\[\_\^\\\s"]+)(.*)/),m&&(e=Nu(m[1],b),e+=Qr(m[2],i),p=!0)),!p&&/^([fgh])[^a-zA-Z]/.test(e)&&(m=Pa(e.slice(1),{inlineShortcuts:b,noWrap:!0}),e=e[1]==="("?e[0]+"\\left("+m.match+"\\right)":e[0]+m.match,e+=Qr(m.rest,i),p=!0),p||(m=e.match(/^([a-zA-Z]+)(.*)/),m&&(e=Nu(m[1],b),e+=Qr(m[2],i),p=!0)),!p)if(m=Pa(e,{inlineShortcuts:b,noWrap:!0}),m.match&&m.rest[0]==="/"){const w=Pa(m.rest.slice(1),{inlineShortcuts:b,noWrap:!0});w.match&&(e="\\frac{"+m.match+"}{"+w.match+"}"+Qr(w.rest,i)),p=!0}else m.match&&(e=e.startsWith("(")?"\\left("+m.match+"\\right)"+Qr(m.rest,i):m.match+Qr(m.rest,i),p=!0);return p||(m=e.match(/^(\s+)(.*)$/),m&&(e=" "+Qr(m[2],i),p=!0)),e}function Pa(e,i){let r="";e=e.trim();let a=e,c=e.charAt(0),p={"(":")","{":"}","[":"]"}[c];if(p){let m=1,b=1;for(;b<e.length&&m>0;)e[b]===c&&m++,e[b]===p&&m--,b++;m===0?(i.noWrap&&c==="("?r=Qr(e.substring(1,b-1),i):(c==="{"&&p==="}"&&(c="\\{",p="\\}"),r="\\left"+c+Qr(e.substring(1,b-1),i)+"\\right"+p),a=e.slice(Math.max(0,b))):(r=e.substring(1,b),a="")}else{let m=e.match(/^([a-zA-Z]+)/);if(m){let b=Yo(null,e,i.inlineShortcuts);if(b)return b=b.replace("_{#?}",""),b=b.replace("^{#?}",""),{match:b,rest:e.slice(b.length)}}if(m=e.match(/^([a-zA-Z])/),m)return{match:m[1],rest:e.slice(1)};if(m=e.match(/^(-)?\d+(\.\d*)?/),m)return{match:m[0],rest:e.slice(m[0].length)};/^\\(left|right)/.test(e)||(m=e.match(/^(\\[a-zA-Z]+)/),m&&(a=e.slice(m[1].length),r=m[1]))}return{match:r,rest:a}}function Nu(e,i){let r=Yo(null,e,i);return r?(r=r.replace("_{#?}",""),r=r.replace("^{#?}",""),r+=" "):r=e,r}var hf=[["\\[","\\]"],["\\(","\\)"],["$$","$$"],["$","$"],["\\begin{math}","\\end{math}"],["\\begin{displaymath}","\\end{displaymath}"],["\\begin{equation}","\\end{equation}"],["\\begin{equation*}","\\end{equation*}"]];function Yc(e){const i=e.trim();for(const r of hf)if(i.startsWith(r[0])&&i.endsWith(r[1]))return[!0,i.substring(r[0].length,i.length-r[1].length)];return[!1,e]}function $u(e){if(e=e.trim(),e.length<=1)return["latex",e];let i;return[i,e]=Yc(e),i?["latex",e]:e.startsWith("`")&&e.endsWith("`")?(e=e.substring(1,e.length-1),["ascii-math",e]):e.includes("\\")?["latex",e]:/\$.+\$/.test(e)?["latex",`\\text{${e}}`]:[void 0,e]}var Ad="$$",ff="$$",Ld=(e,i,r)=>(hf.some(a=>i.startsWith(a[0])&&i.endsWith(a[1]))||(i=`${Ad} ${i} ${ff}`),i),df=class md{constructor(i){md._modes[i]=this}static onPaste(i,r,a){var c;if(!r.contentEditable&&r.userSelect==="none")return r.model.announce("plonk"),!1;if(typeof a=="string"){const m=new DataTransfer;m.setData("text/plain",a),a=m}const p=new ClipboardEvent("paste",{clipboardData:a,cancelable:!0});return(c=r.host)!=null&&c.dispatchEvent(p)?md._modes[i].onPaste(r,a):!1}static copyToClipboard(i,r){if(!i.contentEditable&&i.userSelect==="none"){i.model.announce("plonk");return}const a=i.model,c=a.selectionIsCollapsed?[0,a.lastOffset]:jr(a.selection),p=a.getValue(c,r);navigator.clipboard.writeText(p).then(()=>{},()=>i.model.announce("plonk"))}static onCopy(i,r){var a;if(!r.clipboardData)return;if(!i.contentEditable&&i.userSelect==="none"){i.model.announce("plonk");return}const c=i.model,p=c.selectionIsCollapsed?[0,c.lastOffset]:jr(c.selection);let m=c.getAtoms(p);if(m.every(b=>b.mode==="text"||!b.mode))r.clipboardData.setData("text/plain",m.filter(b=>b instanceof Ll).map(b=>b.value).join(""));else if(m.every(b=>b.mode==="latex"))r.clipboardData.setData("text/plain",c.getAtoms(p,{includeChildren:!0}).map(b=>{var w;return(w=b.value)!=null?w:""}).join(""));else{let b;m.length===1&&m[0].verbatimLatex!==void 0?b=m[0].verbatimLatex:b=c.getValue(p,"latex-expanded"),r.clipboardData.setData("application/x-latex",b);try{r.clipboardData.setData("text/plain",i.options.onExport(i,b,p))}catch(w){}if(m.length===1){const w=m[0];(w.type==="root"||w.type==="group")&&(m=w.body.filter(E=>E.type!=="first"))}try{r.clipboardData.setData("application/json+mathlive",JSON.stringify(m.map(w=>w.toJson())))}catch(w){}if((a=window[Symbol.for("io.cortexjs.compute-engine")])!=null&&a.ComputeEngine){const w=window.MathfieldElement.computeEngine;if(w)try{const E=w.jsonSerializationOptions;w.jsonSerializationOptions={metadata:["latex"]};const I=w.parse(c.getValue(p,"latex-unstyled"));w.jsonSerializationOptions=E;const N=JSON.stringify(I.json);N&&r.clipboardData.setData("application/json",N)}catch(E){}}}r.preventDefault()}static insert(i,r,a={}){var c;const p=a.mode==="auto"?i.mode:(c=a.mode)!=null?c:i.mode;return md._modes[p].insert(i,r,a)}onPaste(i,r){return!1}insert(i,r,a){return!1}};df._modes={};var Gn=df,Dd=[{key:"left",command:"moveToPreviousChar"},{key:"right",command:"moveToNextChar"},{key:"up",command:"moveUp"},{key:"down",command:"moveDown"},{key:"shift+[ArrowLeft]",command:"extendSelectionBackward"},{key:"shift+[ArrowRight]",command:"extendSelectionForward"},{key:"shift+[ArrowUp]",command:"extendSelectionUpward"},{key:"shift+[ArrowDown]",command:"extendSelectionDownward"},{key:"[Backspace]",command:"deleteBackward"},{key:"alt+[Delete]",command:"deleteBackward"},{key:"[Delete]",command:"deleteForward"},{key:"alt+[Backspace]",command:"deleteForward"},{key:"alt+[ArrowLeft]",command:"moveToPreviousWord"},{key:"alt+[ArrowRight]",command:"moveToNextWord"},{key:"shift+alt+[ArrowLeft]",command:"extendToPreviousWord"},{key:"shift+alt+[ArrowRight]",command:"extendToNextWord"},{key:"ctrl+[ArrowLeft]",command:"moveToGroupStart"},{key:"ctrl+[ArrowRight]",command:"moveToGroupEnd"},{key:"shift+ctrl+[ArrowLeft]",command:"extendToGroupStart"},{key:"shift+ctrl+[ArrowRight]",command:"extendToGroupEnd"},{key:"[Home]",command:"moveToMathfieldStart"},{key:"cmd+[ArrowLeft]",command:"moveToMathfieldStart"},{key:"shift+[Home]",command:"extendToMathFieldStart"},{key:"shift+cmd+[ArrowLeft]",command:"extendToMathFieldStart"},{key:"[End]",command:"moveToMathfieldEnd"},{key:"cmd+[ArrowRight]",command:"moveToMathfieldEnd"},{key:"shift+[End]",command:"extendToMathFieldEnd"},{key:"shift+cmd+[ArrowRight]",command:"extendToMathFieldEnd"},{key:"[Pageup]",command:"moveToGroupStart"},{key:"[Pagedown]",command:"moveToGroupEnd"},{key:"[Tab]",command:"moveToNextGroup"},{key:"shift+[Tab]",command:"moveToPreviousGroup"},{key:"[Escape]",ifMode:"math",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"text",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"latex",command:["complete","complete",{selectItem:"true"}]},{key:"\\",ifMode:"math",command:["switchMode","latex","\\"]},{key:"[IntlBackslash]",ifMode:"math",command:["switchMode","latex","\\"]},{key:"[Tab]",ifMode:"latex",command:["complete","accept-suggestion"]},{key:"[Return]",ifMode:"latex",command:"complete"},{key:"[Enter]",ifMode:"latex",command:"complete"},{key:"shift+[Escape]",ifMode:"latex",command:["complete","reject"]},{key:"[ArrowDown]",ifMode:"latex",command:"nextSuggestion"},{key:"[ArrowUp]",ifMode:"latex",command:"previousSuggestion"},{key:"ctrl+a",ifPlatform:"!macos",command:"selectAll"},{key:"cmd+a",command:"selectAll"},{key:"[Cut]",command:"cutToClipboard"},{key:"[Copy]",command:"copyToClipboard"},{key:"[Paste]",command:"pasteFromClipboard"},{key:"[Clear]",command:"deleteBackward"},{key:"[Undo]",command:"undo"},{key:"[Redo]",command:"redo"},{key:"[EraseEof]",command:"deleteToGroupEnd"},{key:"ctrl+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"cmd+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"ctrl+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"cmd+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"ctrl+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"cmd+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"ctrl+z",ifPlatform:"!macos",command:"undo"},{key:"cmd+z",command:"undo"},{key:"ctrl+y",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+y",command:"redo"},{key:"shift+ctrl+z",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+z",command:"redo"},{key:"ctrl+b",ifPlatform:"macos",command:"moveToPreviousChar"},{key:"ctrl+f",ifPlatform:"macos",command:"moveToNextChar"},{key:"ctrl+p",ifPlatform:"macos",command:"moveUp"},{key:"ctrl+n",ifPlatform:"macos",command:"moveDown"},{key:"ctrl+a",ifPlatform:"macos",command:"moveToMathfieldStart"},{key:"ctrl+e",ifPlatform:"macos",command:"moveToMathfieldEnd"},{key:"shift+ctrl+b",ifPlatform:"macos",command:"extendSelectionBackward"},{key:"shift+ctrl+f",ifPlatform:"macos",command:"extendSelectionForward"},{key:"shift+ctrl+p",ifPlatform:"macos",command:"extendSelectionUpward"},{key:"shift+ctrl+n",ifPlatform:"macos",command:"extendSelectionDownward"},{key:"shift+ctrl+a",ifPlatform:"macos",command:"extendToMathFieldStart"},{key:"shift+ctrl+e",ifPlatform:"macos",command:"extendToMathFieldEnd"},{key:"alt+ctrl+b",ifPlatform:"macos",command:"moveToPreviousWord"},{key:"alt+ctrl+f",ifPlatform:"macos",command:"moveToNextWord"},{key:"shift+alt+ctrl+b",ifPlatform:"macos",command:"extendToPreviousWord"},{key:"shift+alt+ctrl+f",ifPlatform:"macos",command:"extendToNextWord"},{key:"ctrl+h",ifPlatform:"macos",command:"deleteBackward"},{key:"ctrl+d",ifPlatform:"macos",command:"deleteForward"},{key:"ctrl+l",ifPlatform:"macos",command:"scrollIntoView"},{key:"ctrl+[Digit2]",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"ctrl+[Digit5]",ifMode:"math",command:"moveToOpposite"},{key:"ctrl+[Digit6]",ifMode:"math",command:"moveToSuperscript"},{key:"ctrl+[Return]",ifMode:"math",command:"addRowAfter"},{key:"ctrl+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Return]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"alt+p",ifMode:"math",command:["insert","\\pi"]},{key:"alt+v",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"alt+o",ifMode:"math",command:["insert","\\emptyset"]},{key:"alt+d",ifMode:"math",command:["insert","\\differentialD"]},{key:"shift+alt+o",ifMode:"math",command:["insert","\\varnothing"]},{key:"shift+alt+d",ifMode:"math",command:["insert","\\partial"]},{key:"alt+[Backslash]",ifMode:"math",command:["insert","\\backslash"]},{key:"[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#?}{#@}"]},{key:"shift+alt+k",command:"toggleKeystrokeCaption"},{key:"alt+[Space]",command:"toggleContextMenu"},{key:"alt+shift+[Space]",command:"toggleVirtualKeyboard"},{key:"alt+ctrl+[ArrowUp]",command:["speak","all",{withHighlighting:!1}]},{key:"alt+ctrl+[ArrowDown]",command:["speak","selection",{withHighlighting:!1}]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["switchMode","text","",""]},{key:"shift+alt+[KeyT]",ifMode:"math",command:["switchMode","text","",""]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"text",command:["switchMode","math","",""]},{key:"shift+alt+[KeyT]",ifMode:"text",command:["switchMode","math","",""]},{key:"/",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+shift+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrack #0 \\right\\rbrack"]},{key:"ctrl+[Minus]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"moveToSubscript"},{key:"shift+alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrace #0 \\right\\rbrace"]},{key:"ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"shift+ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"shift+cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"ctrl+[Backspace]",ifMode:"math",command:"removeRow"},{key:"cmd+[Backspace]",ifMode:"math",command:"removeRow"},{key:"alt+[Tab]",ifMode:"math",command:"addColumnAfter"},{key:"shift+alt+[Tab]",ifMode:"math",command:"addColumnBefore"},{key:"alt+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Enter]",ifMode:"math",command:"addRowBefore"},{key:"alt+[Return]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Return]",ifMode:"math",command:"addRowBefore"},{key:"shift+[Backspace]",ifMode:"math",command:"removeColumn"},{key:"alt+[Digit5]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","$\\infty"]},{key:"alt+[Digit9]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","("]},{key:"alt+[Digit0]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert",")"]},{key:"alt+|",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","|"]},{key:"shift+[Backquote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\~"]},{key:"[Backquote]",ifLayout:["windows.french","linux.french"],ifMode:"math",command:["insert","^2"]},{key:"[Backquote]",ifLayout:["windows.german","linux.german"],ifMode:"math",command:["insert","^"]},{key:"[IntlBackslash]",ifLayout:["apple.german"],ifMode:"math",command:["insert","^"]}],Cd={"\\sqrt":["alt+v","ctrl+[Digit2]"],"\\pi":"alt+p","\\infty":"alt+[Digit5]","\\differentialD":"alt+d","\\partial":"shift+alt+d","\\frac":"Slash","\\emptyset":"alt+o","\\varnothing":"shift+alt+o","\\~":"~"};function co(e){var i;return((i=e.element)==null?void 0:i.mathfield)===e}function pf(e){var i,r;return(r=(i=e.querySelector(".ML__caret"))!=null?i:e.querySelector(".ML__text-caret"))!=null?r:e.querySelector(".ML__latex-caret")}function Cl(e){const i=pf(e);if(!i)return null;const r=i.getBoundingClientRect();return{x:r.right,y:r.bottom,height:r.height}}function Md(e){var i;if(!e.parent)return"root";let r=(i=e.parent.id)!=null?i:"";return r+=typeof e.parentBranch=="string"?"-"+e.parentBranch:`-${e.parentBranch[0]}/${e.parentBranch[0]}`,r}function mf(e,i,r){if(!i)return null;const a=e.field.getBoundingClientRect(),c=i.right-i.left,p=i.bottom-i.top,m=Math.ceil(i.left-a.left+e.field.scrollLeft*r),b=Math.ceil(i.top-a.top);return{left:m,right:m+c,top:b,bottom:b+p}}function gf(e){const i=e.getBoundingClientRect(),r=parseInt(getComputedStyle(e).marginRight),a={top:i.top-1,bottom:i.bottom,left:i.left,right:i.right-1+r};if(e.children.length===0||e.tagName.toUpperCase()==="SVG")return a;for(const c of e.children)if(c.nodeType===1&&"atomId"in c.dataset&&!c.classList.contains("pstrut")){const p=gf(c);a.left=Math.min(a.left,p.left),a.right=Math.max(a.right,p.right),a.top=Math.min(a.top,p.top),a.bottom=Math.max(a.bottom,p.bottom)}return a}function Ml(e,i){var r,a;if(!i.id)return null;let c=(a=(r=e.atomBoundsCache)==null?void 0:r.get(i.id))!=null?a:null;if(c!==null)return c;const p=e.field.querySelector(`[data-atom-id="${i.id}"]`);return c=p?gf(p):null,e.atomBoundsCache&&(c?e.atomBoundsCache.set(i.id,c):e.atomBoundsCache.delete(i.id)),c!=null?c:null}function Id(e,i,r){const a=new Map;for(const c of e.model.getAtoms(i,{includeChildren:!0})){if(r!=null&&r.excludeAtomsWithBackground&&c.style.backgroundColor)continue;const p=e.field,m=p.offsetWidth;let w=Math.floor(p.getBoundingClientRect().width)/m;w=isNaN(w)?1:w;const E=mf(e,Ml(e,c),w);if(E){const I=Md(c);if(a.has(I)){const N=a.get(I);a.set(I,{left:Math.min(N.left,E.left),right:Math.max(N.right,E.right),top:Math.min(N.top,E.top),bottom:Math.max(N.bottom,E.bottom)})}else a.set(I,E)}}return[...a.values()]}function Xc(e,i){return e.model.selection.ranges.reduce((r,a)=>r.concat(...Id(e,a,i)),[])}function Jc(e,i){return e==="*"||i==="none"?!0:i==="same-origin"?!window.origin||e===window.origin:typeof i=="function"?i(e):!1}function _f(e){let i=0,r=0;const a=e.offsetWidth,c=e.offsetHeight;for(;e instanceof HTMLElement;)i+=e.offsetTop,r+=e.offsetLeft,e=e.offsetParent;return new DOMRect(r,i,a,c)}var Rd=`@keyframes ML__caret-blink {
|
|
|
0%,
|
|
|
100% {
|
|
|
opacity: 1;
|
|
|
}
|
|
|
50% {
|
|
|
opacity: 0;
|
|
|
}
|
|
|
}
|
|
|
.ML__container {
|
|
|
display: inline-flex;
|
|
|
flex-flow: row;
|
|
|
justify-content: space-between;
|
|
|
align-items: flex-end;
|
|
|
min-height: 39px;
|
|
|
/* Need some room for the virtual keyboard toggle */
|
|
|
width: 100%;
|
|
|
/* Encourage browsers to consider allocating a hardware accelerated
|
|
|
layer for this element. */
|
|
|
isolation: isolate;
|
|
|
/* Prevent the browser from trying to interpret touch gestures in the field */
|
|
|
/* "Disabling double-tap to zoom removes the need for browsers to
|
|
|
delay the generation of click events when the user taps the screen." */
|
|
|
touch-action: none;
|
|
|
--_caret-color: var(--caret-color, hsl(var(--_hue), 40%, 49%));
|
|
|
--_selection-color: var(--selection-color, #000);
|
|
|
--_selection-background-color: var(--selection-background-color, hsl(var(--_hue), 70%, 85%));
|
|
|
--_text-highlight-background-color: var(--highlight-text, hsla(var(--_hue), 40%, 50%, 0.1));
|
|
|
--_contains-highlight-background-color: var(--contains-highlight-background-color, hsl(var(--_hue), 40%, 95%));
|
|
|
--_smart-fence-color: var(--smart-fence-color, currentColor);
|
|
|
--_smart-fence-opacity: var(--smart-fence-opacity, 0.5);
|
|
|
--_latex-color: var(--latex-color, hsl(var(--_hue), 80%, 40%));
|
|
|
--_correct-color: var(--correct-color, #10a000);
|
|
|
--_incorrect-color: var(--incorrect-color, #a01b00);
|
|
|
--_composition-background-color: var(--composition-background-color, #fff1c2);
|
|
|
--_composition-text-color: var(--composition-text-color, black);
|
|
|
--_composition-underline-color: var(--composition-underline-color, transparent);
|
|
|
}
|
|
|
/* This is the actual field content (formula) */
|
|
|
.ML__content {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
align-self: center;
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
padding: 2px 3px 2px 1px;
|
|
|
width: 100%;
|
|
|
}
|
|
|
.ML__virtual-keyboard-toggle,
|
|
|
.ML__menu-toggle {
|
|
|
box-sizing: border-box;
|
|
|
display: flex;
|
|
|
align-self: center;
|
|
|
align-items: center;
|
|
|
flex-shrink: 0;
|
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
|
width: 34px;
|
|
|
height: 34px;
|
|
|
padding: 0;
|
|
|
margin-right: 4px;
|
|
|
cursor: pointer;
|
|
|
/* Avoid some weird blinking with :hover */
|
|
|
border-radius: 8px;
|
|
|
border: 1px solid transparent;
|
|
|
transition: background 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
|
|
|
color: hsl(var(--_hue), 40%, 50%);
|
|
|
fill: currentColor;
|
|
|
background: transparent;
|
|
|
}
|
|
|
.ML__virtual-keyboard-toggle:hover,
|
|
|
.ML__menu-toggle:hover {
|
|
|
background: hsla(0, 0%, 70%, 0.3);
|
|
|
color: #333;
|
|
|
fill: currentColor;
|
|
|
}
|
|
|
.ML__virtual-keyboard-toggle > span,
|
|
|
.ML__menu-toggle > span {
|
|
|
display: flex;
|
|
|
align-self: center;
|
|
|
align-items: center;
|
|
|
}
|
|
|
/* The invisible element used to capture keyboard events. We're just trying
|
|
|
really hard to make sure it doesn't show. */
|
|
|
.ML__keyboard-sink {
|
|
|
display: inline-block;
|
|
|
resize: none;
|
|
|
outline: none;
|
|
|
border: none;
|
|
|
/* Need these for Microsoft Edge */
|
|
|
position: fixed;
|
|
|
clip: rect(0 0 0 0);
|
|
|
/* Need this to prevent iOS Safari from auto-zooming */
|
|
|
font-size: 1em;
|
|
|
font-family: KaTeX_Main;
|
|
|
line-height: 0.5;
|
|
|
/* On Chromium, if this is 0, no keyboard events are received */
|
|
|
}
|
|
|
[part="placeholder"] {
|
|
|
color: var(--neutral-400);
|
|
|
}
|
|
|
.ML__composition {
|
|
|
background: var(--_composition-background-color);
|
|
|
color: var(--_composition-text-color);
|
|
|
text-decoration: underline var(--_composition-underline-color);
|
|
|
}
|
|
|
.ML__caret::after {
|
|
|
content: '';
|
|
|
visibility: hidden;
|
|
|
width: 0;
|
|
|
display: inline-block;
|
|
|
height: 0.76em;
|
|
|
--_caret-width: clamp(2px, 0.08em, 10px);
|
|
|
border: none;
|
|
|
border-radius: calc(var(--_caret-width) / 2);
|
|
|
border-right: var(--_caret-width) solid var(--_caret-color);
|
|
|
margin-right: calc(-1 * var(--_caret-width));
|
|
|
position: relative;
|
|
|
left: -0.045em;
|
|
|
bottom: -0.05em;
|
|
|
animation: ML__caret-blink 1.05s step-end forwards infinite;
|
|
|
}
|
|
|
.ML__text-caret::after {
|
|
|
content: '';
|
|
|
visibility: hidden;
|
|
|
width: 0;
|
|
|
display: inline-block;
|
|
|
height: 0.76em;
|
|
|
--_caret-width: clamp(2px, 0.08em, 10px);
|
|
|
border: none;
|
|
|
border-radius: calc(var(--_caret-width) / 2);
|
|
|
border-right: var(--_caret-width) solid var(--_caret-color);
|
|
|
margin-right: calc(-1 * var(--_caret-width));
|
|
|
position: relative;
|
|
|
left: -0.045em;
|
|
|
bottom: -0.05em;
|
|
|
animation: ML__caret-blink 1.05s step-end forwards infinite;
|
|
|
}
|
|
|
.ML__latex-caret::after {
|
|
|
content: '';
|
|
|
visibility: hidden;
|
|
|
--_caret-width: clamp(2px, 0.08em, 10px);
|
|
|
border: none;
|
|
|
border-radius: calc(var(--_caret-width) / 2);
|
|
|
border-right: var(--_caret-width) solid var(--_latex-color);
|
|
|
margin-right: calc(-1 * var(--_caret-width));
|
|
|
position: relative;
|
|
|
left: -0.019em;
|
|
|
animation: ML__caret-blink 1.05s step-end forwards infinite;
|
|
|
}
|
|
|
.ML__focused .ML__latex-caret::after,
|
|
|
.ML__focused .ML__text-caret::after,
|
|
|
.ML__focused .ML__caret::after {
|
|
|
visibility: visible;
|
|
|
}
|
|
|
.ML__focused .ML__text {
|
|
|
background: var(--_text-highlight-background-color);
|
|
|
}
|
|
|
/* When using smartFence, the anticipated closing fence is displayed
|
|
|
with this style */
|
|
|
.ML__smart-fence__close {
|
|
|
opacity: var(--_smart-fence-opacity);
|
|
|
color: var(--_smart-fence-color);
|
|
|
}
|
|
|
.ML__selected,
|
|
|
.ML__focused .ML__selected .ML__contains-caret,
|
|
|
.ML__focused .ML__selected .ML__smart-fence__close,
|
|
|
.ML__focused .ML__selected .ML__placeholder {
|
|
|
color: var(--_selection-color);
|
|
|
opacity: 1;
|
|
|
}
|
|
|
.ML__selection {
|
|
|
box-sizing: border-box;
|
|
|
background: var(--_selection-background-color) !important;
|
|
|
}
|
|
|
.ML__contains-caret.ML__close,
|
|
|
.ML__contains-caret.ML__open,
|
|
|
.ML__contains-caret > .ML__close,
|
|
|
.ML__contains-caret > .ML__open,
|
|
|
.ML__contains-caret .ML__sqrt-sign,
|
|
|
.ML__contains-caret .ML__sqrt-line {
|
|
|
color: var(--_caret-color);
|
|
|
}
|
|
|
.ML__contains-highlight {
|
|
|
box-sizing: border-box;
|
|
|
background: transparent;
|
|
|
}
|
|
|
.ML__focused .ML__contains-highlight {
|
|
|
background: var(--_contains-highlight-background-color);
|
|
|
}
|
|
|
.ML__raw-latex {
|
|
|
font-family: 'Berkeley Mono', 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;
|
|
|
font-weight: 400;
|
|
|
font-size: 0.8em;
|
|
|
letter-spacing: -0.05em;
|
|
|
color: var(--_latex-color);
|
|
|
}
|
|
|
.ML__suggestion {
|
|
|
color: var(--neutral-500);
|
|
|
}
|
|
|
.ML__virtual-keyboard-toggle.is-visible.is-pressed:hover {
|
|
|
background: hsl(var(--_hue), 25%, 35%);
|
|
|
color: #fafafa;
|
|
|
fill: currentColor;
|
|
|
}
|
|
|
.ML__virtual-keyboard-toggle:focus {
|
|
|
outline: none;
|
|
|
border-radius: 8px;
|
|
|
border: 2px solid hsl(var(--_hue), 40%, 50%);
|
|
|
}
|
|
|
.ML__virtual-keyboard-toggle.is-pressed,
|
|
|
.ML__virtual-keyboard-toggle.is-active:hover,
|
|
|
.ML__virtual-keyboard-toggle.is-active {
|
|
|
background: hsl(var(--_hue), 25%, 35%);
|
|
|
color: #fafafa;
|
|
|
fill: currentColor;
|
|
|
}
|
|
|
/* Add an attribute 'data-tooltip' to automatically show a
|
|
|
tooltip over a element on hover.
|
|
|
*/
|
|
|
[data-tooltip] {
|
|
|
position: relative;
|
|
|
}
|
|
|
[data-tooltip]::after {
|
|
|
content: attr(data-tooltip);
|
|
|
position: absolute;
|
|
|
display: block;
|
|
|
z-index: 2;
|
|
|
pointer-events: none;
|
|
|
right: auto;
|
|
|
top: calc(-100% - 4px);
|
|
|
width: max-content;
|
|
|
max-width: 200px;
|
|
|
padding: 8px 8px;
|
|
|
border-radius: 4px;
|
|
|
background: #616161;
|
|
|
color: #fff;
|
|
|
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
|
|
text-align: center;
|
|
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
|
font-style: normal;
|
|
|
font-weight: 400;
|
|
|
font-size: 13px;
|
|
|
/* Phone */
|
|
|
opacity: 0;
|
|
|
transform: scale(0.5);
|
|
|
}
|
|
|
@media only screen and (max-width: 767px) {
|
|
|
[data-tooltip]::after {
|
|
|
padding: 8px 16px;
|
|
|
font-size: 16px;
|
|
|
}
|
|
|
}
|
|
|
menu [data-tooltip]::after {
|
|
|
left: 100%;
|
|
|
top: 0%;
|
|
|
}
|
|
|
menu .ML__base {
|
|
|
cursor: default;
|
|
|
}
|
|
|
/** Don't display if we're tracking, i.e. have the pointer down */
|
|
|
.tracking [data-tooltip]:hover::after {
|
|
|
/* Use visibility, not display. Display will remove the after from the DOM, and the override below will not work */
|
|
|
visibility: hidden;
|
|
|
}
|
|
|
/** But do display if tracking and inside a menu */
|
|
|
.tracking menu li[data-tooltip]:hover::after,
|
|
|
[data-tooltip]:hover::after {
|
|
|
visibility: visible;
|
|
|
opacity: 1;
|
|
|
transform: scale(1);
|
|
|
transition-property: opacity, scale;
|
|
|
transition-duration: 0.15s;
|
|
|
transition-delay: 1s;
|
|
|
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
|
|
|
}
|
|
|
.ML__prompt {
|
|
|
border-radius: 2px;
|
|
|
}
|
|
|
.ML__editablePromptBox {
|
|
|
outline: 1px solid #acacac;
|
|
|
border-radius: 2px;
|
|
|
z-index: -1;
|
|
|
}
|
|
|
.ML__focusedPromptBox {
|
|
|
outline: highlight auto 1px;
|
|
|
}
|
|
|
.ML__lockedPromptBox {
|
|
|
background-color: rgba(142, 142, 141, 0.4);
|
|
|
z-index: -1;
|
|
|
}
|
|
|
.ML__correctPromptBox {
|
|
|
outline: 1px solid var(--_correct-color);
|
|
|
box-shadow: 0 0 5px var(--_correct-color);
|
|
|
}
|
|
|
.ML__incorrectPromptBox {
|
|
|
outline: 1px solid var(--_incorrect-color);
|
|
|
box-shadow: 0 0 5px var(--_incorrect-color);
|
|
|
}
|
|
|
.variant-submenu {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
padding: 8px;
|
|
|
}
|
|
|
.variant-submenu [part=menu-item] {
|
|
|
font-size: 2rem;
|
|
|
text-align: center;
|
|
|
margin: 0;
|
|
|
}
|
|
|
.insert-matrix-submenu {
|
|
|
display: grid;
|
|
|
padding: 8px;
|
|
|
align-content: center;
|
|
|
justify-content: center;
|
|
|
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
|
}
|
|
|
.insert-matrix-submenu [part=menu-item] {
|
|
|
font-size: 21px;
|
|
|
border: none;
|
|
|
border-radius: 0;
|
|
|
line-height: 21px;
|
|
|
text-align: center;
|
|
|
padding: 0;
|
|
|
margin: 0;
|
|
|
}
|
|
|
.border-submenu [part=menu-item] {
|
|
|
font-size: 2rem;
|
|
|
line-height: 1.2;
|
|
|
text-align: center;
|
|
|
}
|
|
|
.swatches-submenu {
|
|
|
--_swatch-size: 2rem;
|
|
|
--_columns: 4;
|
|
|
display: flex;
|
|
|
flex-flow: wrap;
|
|
|
padding: 8px;
|
|
|
max-width: calc(var(--_columns) * (var(--_swatch-size) + 18px) + 16px);
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
.menu-swatch {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
box-sizing: border-box;
|
|
|
width: fit-content;
|
|
|
height: fit-content;
|
|
|
margin: 2px;
|
|
|
padding: 0;
|
|
|
background: var(--neutral-200);
|
|
|
}
|
|
|
.menu-swatch > .label {
|
|
|
padding: 0;
|
|
|
margin: 0;
|
|
|
line-height: 0;
|
|
|
}
|
|
|
.menu-swatch > .label > span {
|
|
|
display: inline-block;
|
|
|
margin: 6px;
|
|
|
min-width: var(--_swatch-size);
|
|
|
min-height: var(--_swatch-size);
|
|
|
border-radius: 50%;
|
|
|
}
|
|
|
.menu-swatch.active {
|
|
|
background: var(--neutral-100);
|
|
|
scale: 1.4;
|
|
|
}
|
|
|
.menu-swatch.active > .label > span {
|
|
|
border-radius: 2px;
|
|
|
}
|
|
|
.menu-swatch .ui-checkmark,
|
|
|
.menu-swatch .ui-mixedmark {
|
|
|
position: absolute;
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
color: white;
|
|
|
}
|
|
|
.menu-swatch.dark-contrast .ui-checkmark,
|
|
|
.menu-swatch.dark-contrast .ui-mixedmark {
|
|
|
color: #000;
|
|
|
}
|
|
|
`,Pd=`.ML__container {
|
|
|
min-height: auto !important;
|
|
|
--_hue: var(--hue, 212);
|
|
|
--_placeholder-color: var(--placeholder-color, hsl(var(--_hue), 40%, 49%));
|
|
|
--_placeholder-opacity: var(--placeholder-opacity, 0.4);
|
|
|
--_text-font-family: var(--text-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif);
|
|
|
}
|
|
|
.ML__sr-only {
|
|
|
position: absolute;
|
|
|
width: 1px;
|
|
|
height: 1px;
|
|
|
margin: -1px;
|
|
|
padding: 0;
|
|
|
overflow: hidden;
|
|
|
clip: rect(0, 0, 0, 0);
|
|
|
clip-path: inset(50%);
|
|
|
white-space: nowrap;
|
|
|
border: 0;
|
|
|
}
|
|
|
.ML__is-inline {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__base {
|
|
|
visibility: inherit;
|
|
|
display: inline-block;
|
|
|
position: relative;
|
|
|
cursor: text;
|
|
|
padding: 0;
|
|
|
margin: 0;
|
|
|
box-sizing: content-box;
|
|
|
border: 0;
|
|
|
outline: 0;
|
|
|
vertical-align: baseline;
|
|
|
font-weight: inherit;
|
|
|
font-family: inherit;
|
|
|
font-style: inherit;
|
|
|
text-decoration: none;
|
|
|
width: min-content;
|
|
|
}
|
|
|
.ML__strut,
|
|
|
.ML__strut--bottom {
|
|
|
display: inline-block;
|
|
|
min-height: 0.5em;
|
|
|
}
|
|
|
.ML__small-delim {
|
|
|
font-family: KaTeX_Main;
|
|
|
}
|
|
|
/* Text mode */
|
|
|
.ML__text {
|
|
|
font-family: var(--_text-font-family);
|
|
|
white-space: pre;
|
|
|
}
|
|
|
/* Use cmr for 'math upright' */
|
|
|
.ML__cmr {
|
|
|
font-family: KaTeX_Main;
|
|
|
font-style: normal;
|
|
|
}
|
|
|
.ML__mathit {
|
|
|
font-family: KaTeX_Math;
|
|
|
/* The KaTeX_Math font is italic by default, so the font-style below is only
|
|
|
useful when a fallback font is used
|
|
|
*/
|
|
|
font-style: italic;
|
|
|
}
|
|
|
.ML__mathbf {
|
|
|
font-family: KaTeX_Main;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
/* Lowercase greek symbols should stick to math font when \\mathbf is applied
|
|
|
to match TeX idiosyncratic behavior */
|
|
|
.lcGreek.ML__mathbf {
|
|
|
font-family: KaTeX_Math;
|
|
|
font-weight: normal;
|
|
|
}
|
|
|
.ML__mathbfit {
|
|
|
font-family: KaTeX_Math;
|
|
|
font-weight: bold;
|
|
|
font-style: italic;
|
|
|
}
|
|
|
.ML__ams {
|
|
|
font-family: KaTeX_AMS;
|
|
|
}
|
|
|
/* Blackboard */
|
|
|
.ML__bb {
|
|
|
font-family: KaTeX_AMS;
|
|
|
}
|
|
|
.ML__cal {
|
|
|
font-family: KaTeX_Caligraphic;
|
|
|
}
|
|
|
.ML__frak {
|
|
|
font-family: KaTeX_Fraktur;
|
|
|
}
|
|
|
.ML__tt {
|
|
|
font-family: KaTeX_Typewriter;
|
|
|
}
|
|
|
.ML__script {
|
|
|
font-family: KaTeX_Script;
|
|
|
}
|
|
|
.ML__sans {
|
|
|
font-family: KaTeX_SansSerif;
|
|
|
}
|
|
|
.ML__series_ul {
|
|
|
font-weight: 100;
|
|
|
}
|
|
|
.ML__series_el {
|
|
|
font-weight: 100;
|
|
|
}
|
|
|
.ML__series_l {
|
|
|
font-weight: 200;
|
|
|
}
|
|
|
.ML__series_sl {
|
|
|
font-weight: 300;
|
|
|
}
|
|
|
.ML__series_sb {
|
|
|
font-weight: 500;
|
|
|
}
|
|
|
.ML__bold,
|
|
|
.ML__boldsymbol {
|
|
|
font-weight: 700;
|
|
|
}
|
|
|
.ML__series_eb {
|
|
|
font-weight: 800;
|
|
|
}
|
|
|
.ML__series_ub {
|
|
|
font-weight: 900;
|
|
|
}
|
|
|
.ML__series_uc {
|
|
|
font-stretch: ultra-condensed;
|
|
|
}
|
|
|
.ML__series_ec {
|
|
|
font-stretch: extra-condensed;
|
|
|
}
|
|
|
.ML__series_c {
|
|
|
font-stretch: condensed;
|
|
|
}
|
|
|
.ML__series_sc {
|
|
|
font-stretch: semi-condensed;
|
|
|
}
|
|
|
.ML__series_sx {
|
|
|
font-stretch: semi-expanded;
|
|
|
}
|
|
|
.ML__series_x {
|
|
|
font-stretch: expanded;
|
|
|
}
|
|
|
.ML__series_ex {
|
|
|
font-stretch: extra-expanded;
|
|
|
}
|
|
|
.ML__series_ux {
|
|
|
font-stretch: ultra-expanded;
|
|
|
}
|
|
|
.ML__it {
|
|
|
font-style: italic;
|
|
|
}
|
|
|
.ML__shape_ol {
|
|
|
-webkit-text-stroke: 1px black;
|
|
|
text-stroke: 1px black;
|
|
|
color: transparent;
|
|
|
}
|
|
|
.ML__shape_sc {
|
|
|
font-variant: small-caps;
|
|
|
}
|
|
|
.ML__shape_sl {
|
|
|
font-style: oblique;
|
|
|
}
|
|
|
/* First level emphasis */
|
|
|
.ML__emph {
|
|
|
color: #bc2612;
|
|
|
}
|
|
|
/* Second level emphasis */
|
|
|
.ML__emph .ML__emph {
|
|
|
color: #0c7f99;
|
|
|
}
|
|
|
.ML__highlight {
|
|
|
color: #007cb2;
|
|
|
background: #edd1b0;
|
|
|
}
|
|
|
.ML__center {
|
|
|
text-align: center;
|
|
|
}
|
|
|
.ML__label_padding {
|
|
|
padding: 0 0.5em;
|
|
|
}
|
|
|
.ML__frac-line {
|
|
|
width: 100%;
|
|
|
min-height: 1px;
|
|
|
}
|
|
|
.ML__frac-line:after {
|
|
|
content: '';
|
|
|
display: block;
|
|
|
margin-top: max(-1px, -0.04em);
|
|
|
min-height: max(1px, 0.04em);
|
|
|
/* Ensure the line is visible when printing even if "turn off background images" is on*/
|
|
|
-webkit-print-color-adjust: exact;
|
|
|
print-color-adjust: exact;
|
|
|
/* There's a bug since Chrome 62 where
|
|
|
sub-pixel border lines don't draw at some zoom
|
|
|
levels (110%, 90%).
|
|
|
Setting the min-height used to work around it, but that workaround
|
|
|
broke in Chrome 84 or so.
|
|
|
Setting the background (and the min-height) seems to work for now.
|
|
|
*/
|
|
|
background: currentColor;
|
|
|
box-sizing: content-box;
|
|
|
/* Vuetify sets the box-sizing to inherit
|
|
|
causes the fraction line to not draw at all sizes (see #26) */
|
|
|
/* On some versions of Firefox on Windows, the line fails to
|
|
|
draw at some zoom levels, but setting the transform triggers
|
|
|
the hardware accelerated path, which works */
|
|
|
transform: translate(0, 0);
|
|
|
}
|
|
|
.ML__sqrt {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__sqrt-sign {
|
|
|
display: inline-block;
|
|
|
position: relative;
|
|
|
}
|
|
|
.ML__sqrt-line {
|
|
|
display: inline-block;
|
|
|
height: max(1px, 0.04em);
|
|
|
width: 100%;
|
|
|
}
|
|
|
.ML__sqrt-line:before {
|
|
|
content: '';
|
|
|
display: block;
|
|
|
margin-top: min(-1px, -0.04em);
|
|
|
min-height: max(1px, 0.04em);
|
|
|
/* Ensure the line is visible when printing even if "turn off background images" is on*/
|
|
|
-webkit-print-color-adjust: exact;
|
|
|
print-color-adjust: exact;
|
|
|
background: currentColor;
|
|
|
/* On some versions of Firefox on Windows, the line fails to
|
|
|
draw at some zoom levels, but setting the transform triggers
|
|
|
the hardware accelerated path, which works */
|
|
|
transform: translate(0, 0);
|
|
|
}
|
|
|
.ML__sqrt-line:after {
|
|
|
border-bottom-width: 1px;
|
|
|
content: ' ';
|
|
|
display: block;
|
|
|
margin-top: -0.1em;
|
|
|
}
|
|
|
.ML__sqrt-index {
|
|
|
margin-left: 0.27777778em;
|
|
|
margin-right: -0.55555556em;
|
|
|
}
|
|
|
.ML__delim-size1 {
|
|
|
font-family: KaTeX_Size1;
|
|
|
}
|
|
|
.ML__delim-size2 {
|
|
|
font-family: KaTeX_Size2;
|
|
|
}
|
|
|
.ML__delim-size3 {
|
|
|
font-family: KaTeX_Size3;
|
|
|
}
|
|
|
.ML__delim-size4 {
|
|
|
font-family: KaTeX_Size4;
|
|
|
}
|
|
|
.ML__delim-mult .delim-size1 > span {
|
|
|
font-family: KaTeX_Size1;
|
|
|
}
|
|
|
.ML__delim-mult .delim-size4 > span {
|
|
|
font-family: KaTeX_Size4;
|
|
|
}
|
|
|
.ML__accent-body > span {
|
|
|
font-family: KaTeX_Main;
|
|
|
width: 0;
|
|
|
}
|
|
|
.ML__accent-vec {
|
|
|
position: relative;
|
|
|
left: 0.24em;
|
|
|
}
|
|
|
/** The markup for a LaTeX formula, either in an editable mathfield or
|
|
|
in a static display.
|
|
|
*/
|
|
|
.ML__latex {
|
|
|
display: inline-block;
|
|
|
direction: ltr;
|
|
|
text-align: left;
|
|
|
text-indent: 0;
|
|
|
text-rendering: auto;
|
|
|
font-family: KaTeX_Main, 'Times New Roman', serif;
|
|
|
font-style: normal;
|
|
|
font-size-adjust: none;
|
|
|
font-stretch: normal;
|
|
|
font-variant-caps: normal;
|
|
|
letter-spacing: normal;
|
|
|
line-height: 1.2;
|
|
|
word-wrap: normal;
|
|
|
word-spacing: normal;
|
|
|
white-space: nowrap;
|
|
|
text-shadow: none;
|
|
|
-webkit-user-select: none;
|
|
|
user-select: none;
|
|
|
width: min-content;
|
|
|
}
|
|
|
.ML__latex .style-wrap {
|
|
|
position: relative;
|
|
|
}
|
|
|
.ML__latex .mfrac {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__latex .left-right {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__latex .vlist-t {
|
|
|
display: inline-table;
|
|
|
table-layout: fixed;
|
|
|
border-collapse: collapse;
|
|
|
}
|
|
|
.ML__latex .vlist-r {
|
|
|
display: table-row;
|
|
|
}
|
|
|
.ML__latex .vlist {
|
|
|
display: table-cell;
|
|
|
vertical-align: bottom;
|
|
|
position: relative;
|
|
|
}
|
|
|
.ML__latex .vlist > span {
|
|
|
display: block;
|
|
|
height: 0;
|
|
|
position: relative;
|
|
|
}
|
|
|
.ML__latex .vlist > span > span {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__latex .vlist > span > .pstrut {
|
|
|
overflow: hidden;
|
|
|
width: 0;
|
|
|
}
|
|
|
.ML__latex .vlist-t2 {
|
|
|
margin-right: -2px;
|
|
|
}
|
|
|
.ML__latex .vlist-s {
|
|
|
display: table-cell;
|
|
|
vertical-align: bottom;
|
|
|
font-size: 1px;
|
|
|
width: 2px;
|
|
|
min-width: 2px;
|
|
|
}
|
|
|
.ML__latex .msubsup {
|
|
|
text-align: left;
|
|
|
}
|
|
|
.ML__latex .negativethinspace {
|
|
|
display: inline-block;
|
|
|
margin-left: -0.16667em;
|
|
|
height: 0.71em;
|
|
|
}
|
|
|
.ML__latex .thinspace {
|
|
|
display: inline-block;
|
|
|
width: 0.16667em;
|
|
|
height: 0.71em;
|
|
|
}
|
|
|
.ML__latex .mediumspace {
|
|
|
display: inline-block;
|
|
|
width: 0.22222em;
|
|
|
height: 0.71em;
|
|
|
}
|
|
|
.ML__latex .thickspace {
|
|
|
display: inline-block;
|
|
|
width: 0.27778em;
|
|
|
height: 0.71em;
|
|
|
}
|
|
|
.ML__latex .enspace {
|
|
|
display: inline-block;
|
|
|
width: 0.5em;
|
|
|
height: 0.71em;
|
|
|
}
|
|
|
.ML__latex .quad {
|
|
|
display: inline-block;
|
|
|
width: 1em;
|
|
|
height: 0.71em;
|
|
|
}
|
|
|
.ML__latex .qquad {
|
|
|
display: inline-block;
|
|
|
width: 2em;
|
|
|
height: 0.71em;
|
|
|
}
|
|
|
.ML__latex .llap,
|
|
|
.ML__latex .rlap {
|
|
|
width: 0;
|
|
|
position: relative;
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__latex .llap > .inner,
|
|
|
.ML__latex .rlap > .inner {
|
|
|
position: absolute;
|
|
|
}
|
|
|
.ML__latex .llap > .fix,
|
|
|
.ML__latex .rlap > .fix {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__latex .llap > .inner {
|
|
|
right: 0;
|
|
|
}
|
|
|
.ML__latex .rlap > .inner {
|
|
|
left: 0;
|
|
|
}
|
|
|
.ML__latex .rule {
|
|
|
display: inline-block;
|
|
|
border: solid 0;
|
|
|
position: relative;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
.ML__latex .overline .overline-line,
|
|
|
.ML__latex .underline .underline-line {
|
|
|
width: 100%;
|
|
|
}
|
|
|
.ML__latex .overline .overline-line:before,
|
|
|
.ML__latex .underline .underline-line:before {
|
|
|
content: '';
|
|
|
border-bottom-style: solid;
|
|
|
border-bottom-width: max(1px, 0.04em);
|
|
|
-webkit-print-color-adjust: exact;
|
|
|
print-color-adjust: exact;
|
|
|
display: block;
|
|
|
}
|
|
|
.ML__latex .overline .overline-line:after,
|
|
|
.ML__latex .underline .underline-line:after {
|
|
|
border-bottom-style: solid;
|
|
|
border-bottom-width: max(1px, 0.04em);
|
|
|
-webkit-print-color-adjust: exact;
|
|
|
print-color-adjust: exact;
|
|
|
content: '';
|
|
|
display: block;
|
|
|
margin-top: -1px;
|
|
|
}
|
|
|
.ML__latex .stretchy {
|
|
|
display: block;
|
|
|
position: absolute;
|
|
|
width: 100%;
|
|
|
left: 0;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.ML__latex .stretchy:before,
|
|
|
.ML__latex .stretchy:after {
|
|
|
content: '';
|
|
|
}
|
|
|
.ML__latex .stretchy svg {
|
|
|
display: block;
|
|
|
position: absolute;
|
|
|
width: 100%;
|
|
|
height: inherit;
|
|
|
fill: currentColor;
|
|
|
stroke: currentColor;
|
|
|
fill-rule: nonzero;
|
|
|
fill-opacity: 1;
|
|
|
stroke-width: 1;
|
|
|
stroke-linecap: butt;
|
|
|
stroke-linejoin: miter;
|
|
|
stroke-miterlimit: 4;
|
|
|
stroke-dasharray: none;
|
|
|
stroke-dashoffset: 0;
|
|
|
stroke-opacity: 1;
|
|
|
}
|
|
|
.ML__latex .slice-1-of-2 {
|
|
|
display: inline-flex;
|
|
|
position: absolute;
|
|
|
left: 0;
|
|
|
width: 50.2%;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.ML__latex .slice-2-of-2 {
|
|
|
display: inline-flex;
|
|
|
position: absolute;
|
|
|
right: 0;
|
|
|
width: 50.2%;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.ML__latex .slice-1-of-3 {
|
|
|
display: inline-flex;
|
|
|
position: absolute;
|
|
|
left: 0;
|
|
|
width: 25.1%;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.ML__latex .slice-2-of-3 {
|
|
|
display: inline-flex;
|
|
|
position: absolute;
|
|
|
left: 25%;
|
|
|
width: 50%;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.ML__latex .slice-3-of-3 {
|
|
|
display: inline-flex;
|
|
|
position: absolute;
|
|
|
right: 0;
|
|
|
width: 25.1%;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.ML__latex .slice-1-of-1 {
|
|
|
display: inline-flex;
|
|
|
position: absolute;
|
|
|
width: 100%;
|
|
|
left: 0;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.ML__latex .nulldelimiter {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__latex .op-group {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__latex .op-symbol {
|
|
|
position: relative;
|
|
|
}
|
|
|
.ML__latex .op-symbol.small-op {
|
|
|
font-family: KaTeX_Size1;
|
|
|
}
|
|
|
.ML__latex .op-symbol.large-op {
|
|
|
font-family: KaTeX_Size2;
|
|
|
}
|
|
|
.ML__latex .mtable .vertical-separator {
|
|
|
display: inline-block;
|
|
|
min-width: 1px;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
.ML__latex .mtable .arraycolsep {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
.ML__latex .mtable .col-align-m > .vlist-t {
|
|
|
text-align: center;
|
|
|
}
|
|
|
.ML__latex .mtable .col-align-c > .vlist-t {
|
|
|
text-align: center;
|
|
|
}
|
|
|
.ML__latex .mtable .col-align-l > .vlist-t {
|
|
|
text-align: left;
|
|
|
}
|
|
|
.ML__latex .mtable .col-align-r > .vlist-t {
|
|
|
text-align: right;
|
|
|
}
|
|
|
.ML__error {
|
|
|
display: inline-block;
|
|
|
background-image: radial-gradient(ellipse at center, hsl(341, 100%, 40%), rgba(0, 0, 0, 0) 70%);
|
|
|
background-color: hsla(341, 100%, 40%, 0.1);
|
|
|
background-repeat: repeat-x;
|
|
|
background-size: 3px 3px;
|
|
|
padding-bottom: 3px;
|
|
|
background-position: 0 100%;
|
|
|
}
|
|
|
.ML__error > .ML__error {
|
|
|
background: transparent;
|
|
|
padding: 0;
|
|
|
}
|
|
|
.ML__placeholder {
|
|
|
color: var(--_placeholder-color);
|
|
|
opacity: var(--_placeholder-opacity);
|
|
|
padding-left: 0.4ex;
|
|
|
padding-right: 0.4ex;
|
|
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
|
}
|
|
|
.ML__notation {
|
|
|
position: absolute;
|
|
|
box-sizing: border-box;
|
|
|
line-height: 0;
|
|
|
}
|
|
|
/* This class is used to implement the \`\\mathtip\` and \`\\texttip\` commands
|
|
|
For UI elements, see \`[data-ML__tooltip]\`
|
|
|
*/
|
|
|
.ML__tooltip-container {
|
|
|
position: relative;
|
|
|
transform: scale(0);
|
|
|
}
|
|
|
.ML__tooltip-container .ML__tooltip-content {
|
|
|
position: fixed;
|
|
|
display: inline-table;
|
|
|
visibility: hidden;
|
|
|
z-index: 2;
|
|
|
width: max-content;
|
|
|
max-width: 400px;
|
|
|
padding: 12px 12px;
|
|
|
border-radius: 8px;
|
|
|
background: #616161;
|
|
|
--_selection-color: #fff;
|
|
|
color: #fff;
|
|
|
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
|
|
opacity: 0;
|
|
|
transition: opacity 0.15s cubic-bezier(0.4, 0, 1, 1);
|
|
|
}
|
|
|
.ML__tooltip-container .ML__tooltip-content .ML__text {
|
|
|
white-space: normal;
|
|
|
}
|
|
|
.ML__tooltip-container .ML__tooltip-content .ML__base {
|
|
|
display: contents;
|
|
|
}
|
|
|
.ML__tooltip-container:hover .ML__tooltip-content {
|
|
|
visibility: visible;
|
|
|
opacity: 1;
|
|
|
font-size: 0.75em;
|
|
|
transform: scale(1) translate(0, 3em);
|
|
|
}
|
|
|
`,vf=`#mathlive-environment-popover.is-visible {
|
|
|
visibility: visible;
|
|
|
}
|
|
|
#mathlive-environment-popover {
|
|
|
--_environment-panel-height: var(--environment-panel-height, 70px);
|
|
|
--_accent-color: var(--accent-color, #aaa);
|
|
|
--_background: var(--environment-panel-background, #fff);
|
|
|
--_button-background: var(--environment-panel-button-background, white);
|
|
|
--_button-background-hover: var(--environment-panel-button-background-hover, #f5f5f7);
|
|
|
--_button-background-active: var(--environment-panel-button-background-active, #f5f5f7);
|
|
|
--_button-text: var(--environment-panel-button-text, #e3e4e8);
|
|
|
position: absolute;
|
|
|
width: calc(var(--_environment-panel-height) * 2);
|
|
|
height: var(--_environment-panel-height);
|
|
|
border-radius: 4px;
|
|
|
border: 1.5px solid var(--_accent-color);
|
|
|
background-color: var(--_background);
|
|
|
box-shadow: 0 0 30px 0 var(--environment-shadow, rgba(0, 0, 0, 0.4));
|
|
|
pointer-events: all;
|
|
|
visibility: hidden;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__array-buttons {
|
|
|
height: calc(var(--_environment-panel-height) * 5/4);
|
|
|
width: calc(var(--_environment-panel-height) * 5/4);
|
|
|
margin-left: calc(0px - var(--_environment-panel-height) * 0.16);
|
|
|
margin-top: calc(0px - var(--_environment-panel-height) * 0.19);
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__array-buttons .font {
|
|
|
fill: white;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__array-buttons circle {
|
|
|
fill: #7f7f7f;
|
|
|
transition: fill 300ms;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__array-buttons .MLEP__array-insert-background {
|
|
|
fill-opacity: 1;
|
|
|
fill: var(--_background);
|
|
|
stroke: var(--_accent-color);
|
|
|
stroke-width: 3px;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__array-buttons line {
|
|
|
stroke: var(--_accent-color);
|
|
|
stroke-opacity: 0;
|
|
|
stroke-width: 40;
|
|
|
pointer-events: none;
|
|
|
transition: stroke-opacity 300ms;
|
|
|
stroke-linecap: round;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover circle {
|
|
|
fill: var(--_accent-color);
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover line {
|
|
|
stroke-opacity: 1;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls {
|
|
|
height: 100%;
|
|
|
width: 50%;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options {
|
|
|
width: var(--_environment-panel-height);
|
|
|
height: var(--_environment-panel-height);
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
flex-direction: row;
|
|
|
justify-content: space-around;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg {
|
|
|
pointer-events: all;
|
|
|
margin-top: 2px;
|
|
|
width: calc(var(--_environment-panel-height) / 3 * 28 / 24);
|
|
|
height: calc(var(--_environment-panel-height) / 3 - 2px);
|
|
|
border-radius: calc(var(--_environment-panel-height) / 25);
|
|
|
background-color: var(--_button-background);
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg:hover {
|
|
|
background-color: var(--_button-background-hover);
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path,
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg line {
|
|
|
stroke: var(--_button-text);
|
|
|
stroke-width: 2;
|
|
|
stroke-linecap: round;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg rect,
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path {
|
|
|
fill-opacity: 0;
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active {
|
|
|
pointer-events: none;
|
|
|
background-color: var(--_button-background-active);
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active path,
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active line {
|
|
|
stroke: var(--_accent-color);
|
|
|
}
|
|
|
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active circle {
|
|
|
fill: var(--_accent-color);
|
|
|
}
|
|
|
`,yf=`/* The element that display info while in latex mode */
|
|
|
#mathlive-suggestion-popover {
|
|
|
background-color: rgba(97, 97, 97);
|
|
|
color: #fff;
|
|
|
text-align: center;
|
|
|
border-radius: 8px;
|
|
|
position: fixed;
|
|
|
z-index: 1;
|
|
|
display: none;
|
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
|
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
|
|
|
}
|
|
|
#mathlive-suggestion-popover.top-tip::after {
|
|
|
content: '';
|
|
|
position: absolute;
|
|
|
top: -15px;
|
|
|
left: calc(50% - 15px);
|
|
|
width: 0;
|
|
|
height: 0;
|
|
|
border-left: 15px solid transparent;
|
|
|
border-right: 15px solid transparent;
|
|
|
border-bottom: 15px solid rgba(97, 97, 97);
|
|
|
font-size: 1rem;
|
|
|
}
|
|
|
#mathlive-suggestion-popover.bottom-tip::after {
|
|
|
content: '';
|
|
|
position: absolute;
|
|
|
bottom: -15px;
|
|
|
left: calc(50% - 15px);
|
|
|
width: 0;
|
|
|
height: 0;
|
|
|
border-left: 15px solid transparent;
|
|
|
border-right: 15px solid transparent;
|
|
|
border-top: 15px solid rgba(97, 97, 97);
|
|
|
font-size: 1rem;
|
|
|
}
|
|
|
#mathlive-suggestion-popover.is-animated {
|
|
|
transition: all 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
|
|
|
animation: ML__fade-in cubic-bezier(0, 0, 0.2, 1) 0.15s;
|
|
|
}
|
|
|
#mathlive-suggestion-popover.is-visible {
|
|
|
display: flex;
|
|
|
}
|
|
|
@keyframes ML__fade-in {
|
|
|
from {
|
|
|
opacity: 0;
|
|
|
}
|
|
|
to {
|
|
|
opacity: 1;
|
|
|
}
|
|
|
}
|
|
|
/* The wrapper class for the entire content of the popover panel */
|
|
|
#mathlive-suggestion-popover ul {
|
|
|
display: flex;
|
|
|
flex-flow: column;
|
|
|
list-style: none;
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
align-items: flex-start;
|
|
|
max-height: 400px;
|
|
|
overflow-y: auto;
|
|
|
}
|
|
|
#mathlive-suggestion-popover li {
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
|
justify-content: space-between;
|
|
|
margin: 8px;
|
|
|
padding: 8px;
|
|
|
width: calc(100% - 16px - 16px);
|
|
|
column-gap: 1em;
|
|
|
border-radius: 8px;
|
|
|
cursor: pointer;
|
|
|
/* Since the content can be clicked on, provide feedback on hover */
|
|
|
}
|
|
|
#mathlive-suggestion-popover li a {
|
|
|
color: #5ea6fd;
|
|
|
padding-top: 0.3em;
|
|
|
margin-top: 0.4em;
|
|
|
display: block;
|
|
|
}
|
|
|
#mathlive-suggestion-popover li a:hover {
|
|
|
color: #5ea6fd;
|
|
|
text-decoration: underline;
|
|
|
}
|
|
|
#mathlive-suggestion-popover li:hover,
|
|
|
#mathlive-suggestion-popover li.is-pressed,
|
|
|
#mathlive-suggestion-popover li.is-active {
|
|
|
background: rgba(255, 255, 255, 0.1);
|
|
|
}
|
|
|
/* The command inside a popover (inside a #mathlive-suggestion-popover) */
|
|
|
.ML__popover__command {
|
|
|
font-size: 1.6rem;
|
|
|
font-family: KaTeX_Main;
|
|
|
}
|
|
|
.ML__popover__current {
|
|
|
background: #5ea6fd;
|
|
|
color: #fff;
|
|
|
}
|
|
|
.ML__popover__latex {
|
|
|
font-family: 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;
|
|
|
align-self: center;
|
|
|
}
|
|
|
/* The keyboard shortcuts for a symbol as displayed in the popover */
|
|
|
.ML__popover__keybinding {
|
|
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
|
font-size: 0.8em;
|
|
|
opacity: 0.7;
|
|
|
}
|
|
|
/* Style for the character that joins the modifiers of a keyboard shortcut
|
|
|
(usually a "+" sign)*/
|
|
|
.ML__shortcut-join {
|
|
|
opacity: 0.5;
|
|
|
}
|
|
|
`,Xo=`/* The element that displays the keys as the user type them */
|
|
|
#mathlive-keystroke-caption-panel {
|
|
|
visibility: hidden;
|
|
|
/*min-width: 160px;*/
|
|
|
/*background-color: rgba(97, 97, 200, .95);*/
|
|
|
background: var(--secondary, hsl(var(--_hue), 19%, 26%));
|
|
|
border-color: var(--secondary-border, hsl(0, 0%, 91%));
|
|
|
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
|
|
|
text-align: center;
|
|
|
border-radius: 6px;
|
|
|
padding: 16px;
|
|
|
position: absolute;
|
|
|
z-index: 1;
|
|
|
display: flex;
|
|
|
flex-direction: row-reverse;
|
|
|
justify-content: center;
|
|
|
--keystroke: white;
|
|
|
--on-keystroke: #555;
|
|
|
--keystroke-border: #f7f7f7;
|
|
|
}
|
|
|
@media (prefers-color-scheme: dark) {
|
|
|
body:not([theme='light']) #mathlive-keystroke-caption-panel {
|
|
|
--keystroke: hsl(var(--_hue), 50%, 30%);
|
|
|
--on-keystroke: hsl(0, 0%, 98%);
|
|
|
--keystroke-border: hsl(var(--_hue), 50%, 25%);
|
|
|
}
|
|
|
}
|
|
|
body[theme='dark'] #mathlive-keystroke-caption-panel {
|
|
|
--keystroke: hsl(var(--_hue), 50%, 30%);
|
|
|
--on-keystroke: hsl(0, 0%, 98%);
|
|
|
--keystroke-border: hsl(var(--_hue), 50%, 25%);
|
|
|
}
|
|
|
#mathlive-keystroke-caption-panel > span {
|
|
|
min-width: 14px;
|
|
|
/*height: 8px;*/
|
|
|
margin: 0 8px 0 0;
|
|
|
padding: 4px;
|
|
|
background-color: var(--keystroke);
|
|
|
color: var(--on-keystroke);
|
|
|
fill: currentColor;
|
|
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
|
font-size: 1em;
|
|
|
border-radius: 6px;
|
|
|
border: 2px solid var(--keystroke-border);
|
|
|
/*box-shadow: 0 7px 14px rgba(0,0,0,0.25), 0 5px 5px rgba(0,0,0,0.22);*/
|
|
|
}
|
|
|
`,Ku=`.ML__keyboard {
|
|
|
--_keyboard-height: 0;
|
|
|
--_keyboard-zindex: var(--keyboard-zindex, 105);
|
|
|
--_accent-color: var(--keyboard-accent-color, #0c75d8);
|
|
|
--_background: var(--keyboard-background, #cacfd7);
|
|
|
--_border: var(--keyboard-border, #ddd);
|
|
|
--_padding-horizontal: var(--keyboard-padding-horizontal, 0px);
|
|
|
--_padding-top: var(--keyboard-padding-top, 5px);
|
|
|
--_padding-bottom: var(--keyboard-padding-bottom, 0px);
|
|
|
--_row-padding-left: var(--keyboard-row-padding-left, 0px);
|
|
|
--_row-padding-right: var(--keyboard-row-padding-right, 0px);
|
|
|
--_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);
|
|
|
--_toolbar-text-active: var(--keyboard-toolbar-text-active, var(--_accent-color));
|
|
|
--_toolbar-background: var(--keyboard-toolbar-background, transparent);
|
|
|
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);
|
|
|
--_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);
|
|
|
--_toolbar-font-size: var(--keyboard-toolbar-font-size, '135%');
|
|
|
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);
|
|
|
--_keycap-background: var(--keycap-background, white);
|
|
|
--_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);
|
|
|
--_keycap-background-active: var(--keycap-background-active, var(--_accent-color));
|
|
|
--_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));
|
|
|
--_keycap-border: var(--keycap-border, #e5e6e9);
|
|
|
--_keycap-border-bottom: var(--keycap-border-bottom, #8d8f92);
|
|
|
--_keycap-text: var(--keycap-text, #000);
|
|
|
--_keycap-text-active: var(--keycap-text-active, #fff);
|
|
|
--_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));
|
|
|
--_keycap-text-pressed: var(--keycap-text-pressed, #fff);
|
|
|
--_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));
|
|
|
--_keycap-primary-background: var(--keycap-primary-background, var(--_accent-color));
|
|
|
--_keycap-primary-text: var(--keycap-primary-text, #ddd);
|
|
|
--_keycap-primary-background-hover: var(--keycap-primary-background-hover, #0d80f2);
|
|
|
--_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);
|
|
|
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);
|
|
|
--_keycap-secondary-text: var(--keycap-secondary-text, #060707);
|
|
|
--_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);
|
|
|
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);
|
|
|
--_keycap-height: var(--keycap-height, 60px);
|
|
|
/* Keycap width (incl. margin) */
|
|
|
--_keycap-max-width: var(--keycap-max-width, 100px);
|
|
|
--_keycap-gap: var(--keycap-gap, 8px);
|
|
|
--_keycap-font-size: var(--keycap-font-size, clamp(16px, 4cqw, 24px));
|
|
|
--_keycap-small-font-size: var(--keycap-small-font-size, calc(var(--keycap-font-size) * 0.8));
|
|
|
--_keycap-extra-small-font-size: var(--keycap-extra-small-font-size, calc(var(--keycap-font-size) / 1.42));
|
|
|
--_variant-panel-background: var(--variant-panel-background, #fff);
|
|
|
--_variant-keycap-text: var(--variant-keycap-text, var(--_keycap-text));
|
|
|
--_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));
|
|
|
--_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));
|
|
|
--_variant-keycap-length: var(--variant-keycap-length, 70px);
|
|
|
--_variant-keycap-font-size: var(--variant-keycap-font-size, 30px);
|
|
|
--_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 12px);
|
|
|
--_keycap-shift-font-size: var(--keycap-shift-font-size, 16px);
|
|
|
--_keycap-shift-color: var(--keycap-shift-color, var(--_accent-color));
|
|
|
--_box-placeholder-color: var(--box-placeholder-color, var(--_accent-color));
|
|
|
--_box-placeholder-pressed-color: var(--box-placeholder-pressed-color, var(--keycap-text-pressed));
|
|
|
}
|
|
|
.is-math-mode .MLK__rows .if-text-mode,
|
|
|
.is-text-mode .MLK__rows .if-math-mode {
|
|
|
display: none;
|
|
|
}
|
|
|
.if-can-undo,
|
|
|
.if-can-redo,
|
|
|
.if-can-copy,
|
|
|
.if-can-cut,
|
|
|
.if-can-paste {
|
|
|
opacity: 0.4;
|
|
|
pointer-events: none;
|
|
|
}
|
|
|
.can-undo .if-can-undo,
|
|
|
.can-redo .if-can-redo,
|
|
|
.can-copy .if-can-copy,
|
|
|
.can-cut .if-can-cut,
|
|
|
.can-paste .if-can-paste {
|
|
|
opacity: 1;
|
|
|
pointer-events: all;
|
|
|
}
|
|
|
body > .ML__keyboard {
|
|
|
position: fixed;
|
|
|
--_padding-bottom: calc(var(--keyboard-padding-bottom, 0px) + env(safe-area-inset-bottom, 0));
|
|
|
}
|
|
|
body > .ML__keyboard.is-visible > .MLK__backdrop {
|
|
|
box-shadow: 0 -5px 6px rgba(0, 0, 0, 0.08);
|
|
|
border-top: 1px solid var(--_border);
|
|
|
}
|
|
|
body > .ML__keyboard.backdrop-is-transparent.is-visible > .MLK__backdrop {
|
|
|
box-shadow: none;
|
|
|
border: none;
|
|
|
}
|
|
|
body > .ML__keyboard.is-visible.animate > .MLK__backdrop {
|
|
|
transition: 0.28s cubic-bezier(0, 0, 0.2, 1);
|
|
|
transition-property: transform, opacity;
|
|
|
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
|
|
|
}
|
|
|
.ML__keyboard {
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
height: 100%;
|
|
|
width: 100%;
|
|
|
z-index: var(--_keyboard-zindex);
|
|
|
box-sizing: border-box;
|
|
|
outline: none;
|
|
|
border: none;
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
line-height: 1;
|
|
|
overflow-wrap: unset;
|
|
|
text-align: left;
|
|
|
vertical-align: baseline;
|
|
|
cursor: auto;
|
|
|
white-space: pre;
|
|
|
box-shadow: none;
|
|
|
opacity: 1;
|
|
|
transform: none;
|
|
|
pointer-events: none;
|
|
|
}
|
|
|
.ML__keyboard :where(div) {
|
|
|
box-sizing: border-box;
|
|
|
outline: none;
|
|
|
border: none;
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
line-height: 1;
|
|
|
overflow-wrap: unset;
|
|
|
text-align: left;
|
|
|
vertical-align: baseline;
|
|
|
cursor: auto;
|
|
|
white-space: pre;
|
|
|
box-shadow: none;
|
|
|
transform: none;
|
|
|
}
|
|
|
.MLK__backdrop {
|
|
|
position: absolute;
|
|
|
bottom: calc(-1 * var(--_keyboard-height));
|
|
|
width: 100%;
|
|
|
height: var(--_keyboard-height);
|
|
|
box-sizing: border-box;
|
|
|
padding-top: var(--_padding-top);
|
|
|
padding-bottom: var(--_padding-bottom);
|
|
|
padding-left: var(--_padding-horizontal);
|
|
|
padding-right: var(--_padding-horizontal);
|
|
|
opacity: 0;
|
|
|
visibility: hidden;
|
|
|
transform: translate(0, 0);
|
|
|
background: var(--_background);
|
|
|
}
|
|
|
.backdrop-is-transparent .MLK__backdrop {
|
|
|
background: transparent;
|
|
|
}
|
|
|
/* If a custom layout has a custom container/backdrop
|
|
|
(backdrop-is-transparent), make sure to let pointer event go through. */
|
|
|
.backdrop-is-transparent .MLK__plate {
|
|
|
background: transparent;
|
|
|
pointer-events: none;
|
|
|
}
|
|
|
/* If a custom layout has a custom container/backdrop, make sure to
|
|
|
allow pointer events on it. */
|
|
|
.backdrop-is-transparent .MLK__layer > div > div {
|
|
|
pointer-events: all;
|
|
|
}
|
|
|
.ML__keyboard.is-visible > .MLK__backdrop {
|
|
|
transform: translate(0, calc(-1 * var(--_keyboard-height)));
|
|
|
opacity: 1;
|
|
|
visibility: visible;
|
|
|
}
|
|
|
.caps-lock-indicator {
|
|
|
display: none;
|
|
|
width: 8px;
|
|
|
height: 8px;
|
|
|
background: #0cbc0c;
|
|
|
box-shadow: inset 0 0 4px 0 #13ca13, 0 0 4px 0 #a9ef48;
|
|
|
border-radius: 8px;
|
|
|
right: 8px;
|
|
|
top: 8px;
|
|
|
position: absolute;
|
|
|
}
|
|
|
.ML__keyboard.is-caps-lock .caps-lock-indicator {
|
|
|
display: block;
|
|
|
}
|
|
|
.ML__keyboard.is-caps-lock .shift {
|
|
|
background: var(--_keycap-background-active);
|
|
|
color: var(--_keycap-text-active);
|
|
|
}
|
|
|
.MLK__plate {
|
|
|
position: absolute;
|
|
|
top: var(--_padding-top);
|
|
|
left: var(--_padding-horizontal);
|
|
|
width: calc(100% - 2 * var(--_padding-horizontal));
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
box-sizing: border-box;
|
|
|
container-type: inline-size;
|
|
|
touch-action: none;
|
|
|
-webkit-user-select: none;
|
|
|
user-select: none;
|
|
|
pointer-events: all;
|
|
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
|
font-size: 16px;
|
|
|
/* Size of toolbar labels */
|
|
|
font-weight: 400;
|
|
|
text-shadow: none;
|
|
|
}
|
|
|
.ML__box-placeholder {
|
|
|
color: var(--_box-placeholder-color);
|
|
|
}
|
|
|
.MLK__tex {
|
|
|
font-family: KaTeX_Main, KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
|
|
|
}
|
|
|
.MLK__tex-math {
|
|
|
font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
|
|
|
font-style: italic;
|
|
|
}
|
|
|
.MLK__layer {
|
|
|
display: none;
|
|
|
outline: none;
|
|
|
}
|
|
|
.MLK__layer.is-visible {
|
|
|
display: flex;
|
|
|
flex-flow: column;
|
|
|
}
|
|
|
/* Keyboard layouts are made or rows of keys... */
|
|
|
.MLK__rows {
|
|
|
--_keycap-width: min(var(--_keycap-max-width), 10cqw);
|
|
|
display: flex;
|
|
|
flex-flow: column;
|
|
|
align-items: center;
|
|
|
border-collapse: separate;
|
|
|
clear: both;
|
|
|
border: 0;
|
|
|
margin: 0;
|
|
|
margin-bottom: var(--_keycap-gap);
|
|
|
gap: var(--_keycap-gap);
|
|
|
/* If the styling include, e.g., some shadows, they will be
|
|
|
cut off by the overflow. In that case, set the padding to
|
|
|
compensate. */
|
|
|
padding-left: var(--_row-padding-left);
|
|
|
padding-right: var(--_row-padding-right);
|
|
|
overflow: visible;
|
|
|
touch-action: none;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row {
|
|
|
display: flex;
|
|
|
flex-flow: row;
|
|
|
justify-content: center;
|
|
|
width: 100%;
|
|
|
gap: var(--_keycap-gap);
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
/* For the alignment of the text on some modifiers (e.g. shift) */
|
|
|
/* Extra spacing between two adjacent keys */
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .tex {
|
|
|
font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .tex-math {
|
|
|
font-family: KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .big-op {
|
|
|
font-size: calc(1.25 * var(--_keycap-font-size));
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .small {
|
|
|
font-size: var(--_keycap-small-font-size);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .bottom {
|
|
|
justify-content: flex-end;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .left {
|
|
|
align-items: flex-start;
|
|
|
padding-left: 12px;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .right {
|
|
|
align-items: flex-end;
|
|
|
padding-right: 12px;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .w0 {
|
|
|
width: 0;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .w5 {
|
|
|
width: calc(0.5 * var(--_keycap-width) - var(--_keycap-gap));
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .w15 {
|
|
|
width: calc(1.5 * var(--_keycap-width) - var(--_keycap-gap));
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .w20 {
|
|
|
width: calc(2 * var(--_keycap-width) - var(--_keycap-gap));
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .w40 {
|
|
|
width: calc(4 * var(--_keycap-width) - var(--_keycap-gap));
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .w50 {
|
|
|
width: calc(5 * var(--_keycap-width) - var(--_keycap-gap));
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .MLK__keycap.w50 {
|
|
|
font-size: 80%;
|
|
|
padding-top: 10px;
|
|
|
font-weight: 100;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .separator {
|
|
|
background: transparent;
|
|
|
border: none;
|
|
|
pointer-events: none;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .horizontal-rule {
|
|
|
height: 6px;
|
|
|
margin-top: 3px;
|
|
|
margin-bottom: 0;
|
|
|
width: 100%;
|
|
|
border-radius: 0;
|
|
|
border-top: var(--_horizontal-rule);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .ghost {
|
|
|
background: var(--_toolbar-background);
|
|
|
border: none;
|
|
|
color: var(--_toolbar-text);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .ghost:hover {
|
|
|
background: var(--_toolbar-background-hover);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .bigfnbutton {
|
|
|
font-size: var(--_keycap-extra-small-font-size);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .shift,
|
|
|
.MLK__rows > .MLK__row .action {
|
|
|
color: var(--_keycap-secondary-text);
|
|
|
background: var(--_keycap-secondary-background);
|
|
|
border-color: var(--_keycap-secondary-border);
|
|
|
border-bottom-color: var(--_keycap-secondary-border-bottom);
|
|
|
line-height: 0.8;
|
|
|
font-size: min(1rem, var(--_keycap-small-font-size));
|
|
|
font-weight: 600;
|
|
|
padding: 8px 12px 8px 12px;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .shift:hover,
|
|
|
.MLK__rows > .MLK__row .action:hover {
|
|
|
background: var(--_keycap-secondary-background-hover);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .action.primary {
|
|
|
background: var(--_keycap-primary-background);
|
|
|
color: var(--_keycap-primary-text);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .action.primary:hover {
|
|
|
background: var(--_keycap-primary-background-hover);
|
|
|
color: var(--_keycap-primary-text);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .shift.selected,
|
|
|
.MLK__rows > .MLK__row .action.selected {
|
|
|
color: var(--_toolbar-text-active);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .shift.selected.is-pressed,
|
|
|
.MLK__rows > .MLK__row .action.selected.is-pressed,
|
|
|
.MLK__rows > .MLK__row .shift.selected.is-active,
|
|
|
.MLK__rows > .MLK__row .action.selected.is-active {
|
|
|
color: white;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .warning {
|
|
|
background: #cd0030;
|
|
|
color: white;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row .warning svg.svg-glyph {
|
|
|
width: 24px;
|
|
|
height: 24px;
|
|
|
min-height: 24px;
|
|
|
}
|
|
|
/** A regular keycap
|
|
|
* Use the :where() pseudo-class to give it a very low specifity,
|
|
|
* so that it can be overriden by custom style.
|
|
|
*/
|
|
|
:where(.MLK__rows > .MLK__row div) {
|
|
|
display: flex;
|
|
|
flex-flow: column;
|
|
|
align-items: center;
|
|
|
justify-content: space-evenly;
|
|
|
width: calc(var(--_keycap-width) - var(--_keycap-gap));
|
|
|
height: var(--_keycap-height);
|
|
|
box-sizing: border-box;
|
|
|
padding: 0;
|
|
|
vertical-align: top;
|
|
|
text-align: center;
|
|
|
float: left;
|
|
|
color: var(--_keycap-text);
|
|
|
fill: currentColor;
|
|
|
font-size: var(--_keycap-font-size);
|
|
|
background: var(--_keycap-background);
|
|
|
border: 1px solid var(--_keycap-border);
|
|
|
border-bottom-color: var(--_keycap-border-bottom);
|
|
|
border-radius: 6px;
|
|
|
cursor: pointer;
|
|
|
touch-action: none;
|
|
|
/* Keys with a variants panel */
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
-webkit-user-select: none;
|
|
|
user-select: none;
|
|
|
-webkit-tap-highlight-color: transparent;
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div):hover {
|
|
|
overflow: visible;
|
|
|
background: var(--_keycap-background-hover);
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div) .ML__latex {
|
|
|
pointer-events: none;
|
|
|
touch-action: none;
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div) svg.svg-glyph {
|
|
|
margin: 8px 0;
|
|
|
width: 20px;
|
|
|
height: 20px;
|
|
|
min-height: 20px;
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div) svg.svg-glyph-lg {
|
|
|
margin: 8px 0;
|
|
|
width: 24px;
|
|
|
height: 24px;
|
|
|
min-height: 24px;
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div).MLK__tex-math {
|
|
|
font-size: 25px;
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div).is-pressed {
|
|
|
background: var(--_keycap-background-pressed);
|
|
|
color: var(--_keycap-text-pressed);
|
|
|
--_box-placeholder-color: var(--_box-placeholder-pressed-color);
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,
|
|
|
:where(.MLK__rows > .MLK__row div).action.is-active,
|
|
|
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,
|
|
|
:where(.MLK__rows > .MLK__row div).action.is-pressed {
|
|
|
z-index: calc(var(--_keyboard-zindex) - 5);
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active aside,
|
|
|
:where(.MLK__rows > .MLK__row div).action.is-active aside,
|
|
|
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed aside,
|
|
|
:where(.MLK__rows > .MLK__row div).action.is-pressed aside {
|
|
|
display: none;
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active .MLK__shift,
|
|
|
:where(.MLK__rows > .MLK__row div).action.is-active .MLK__shift,
|
|
|
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed .MLK__shift,
|
|
|
:where(.MLK__rows > .MLK__row div).action.is-pressed .MLK__shift {
|
|
|
display: none;
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div).shift.is-pressed,
|
|
|
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,
|
|
|
:where(.MLK__rows > .MLK__row div).action.is-pressed {
|
|
|
background: var(--_keycap-background-pressed);
|
|
|
color: var(--_keycap-text-pressed);
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div).shift.is-active,
|
|
|
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,
|
|
|
:where(.MLK__rows > .MLK__row div).action.is-active {
|
|
|
background: var(--_keycap-background-active);
|
|
|
color: var(--_keycap-text-active);
|
|
|
--_box-placeholder-color: var(--_box-placeholder-pressed-color);
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div) small {
|
|
|
color: var(--_keycap-secondary-text);
|
|
|
}
|
|
|
:where(.MLK__rows > .MLK__row div) aside {
|
|
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
|
font-size: 10px;
|
|
|
line-height: 10px;
|
|
|
color: var(--_keycap-secondary-text);
|
|
|
}
|
|
|
/* Add an attribute 'data-tooltip' to display a tooltip on hover.
|
|
|
Note there are a different set of tooltip rules for the keyboard toggle
|
|
|
(it's in a different CSS tree) */
|
|
|
.ML__keyboard [data-tooltip] {
|
|
|
position: relative;
|
|
|
}
|
|
|
.ML__keyboard [data-tooltip]::after {
|
|
|
position: absolute;
|
|
|
display: inline-table;
|
|
|
content: attr(data-tooltip);
|
|
|
top: inherit;
|
|
|
bottom: 100%;
|
|
|
width: max-content;
|
|
|
max-width: 200px;
|
|
|
padding: 8px 8px;
|
|
|
background: #616161;
|
|
|
color: #fff;
|
|
|
text-align: center;
|
|
|
z-index: 2;
|
|
|
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
|
|
border-radius: 2px;
|
|
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
|
font-weight: 400;
|
|
|
font-size: 12px;
|
|
|
transition: all 0.15s cubic-bezier(0.4, 0, 1, 1) 1s;
|
|
|
opacity: 0;
|
|
|
transform: scale(0.5);
|
|
|
}
|
|
|
.ML__keyboard [data-tooltip]:hover {
|
|
|
position: relative;
|
|
|
}
|
|
|
.ML__keyboard [data-tooltip]:hover::after {
|
|
|
opacity: 1;
|
|
|
transform: scale(1);
|
|
|
}
|
|
|
.MLK__toolbar {
|
|
|
align-self: center;
|
|
|
display: flex;
|
|
|
flex-flow: row;
|
|
|
justify-content: space-between;
|
|
|
width: 100%;
|
|
|
max-width: 996px;
|
|
|
min-height: 32px;
|
|
|
/* Icons for undo/redo, etc. */
|
|
|
}
|
|
|
.MLK__toolbar svg {
|
|
|
height: 20px;
|
|
|
width: 20px;
|
|
|
}
|
|
|
.MLK__toolbar > .left {
|
|
|
position: relative;
|
|
|
display: flex;
|
|
|
justify-content: flex-start;
|
|
|
flex-flow: row;
|
|
|
}
|
|
|
.MLK__toolbar > .right {
|
|
|
display: flex;
|
|
|
justify-content: flex-end;
|
|
|
flex-flow: row;
|
|
|
}
|
|
|
.MLK__toolbar > div > div {
|
|
|
/* "button" in the toolbar */
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
color: var(--_toolbar-text);
|
|
|
fill: currentColor;
|
|
|
background: var(--_toolbar-background);
|
|
|
font-size: var(--_toolbar-font-size);
|
|
|
padding: 4px 15px;
|
|
|
cursor: pointer;
|
|
|
width: max-content;
|
|
|
min-width: 42px;
|
|
|
min-height: 34px;
|
|
|
border: none;
|
|
|
padding-left: 10px;
|
|
|
padding-right: 10px;
|
|
|
padding-bottom: 8px;
|
|
|
padding-top: 8px;
|
|
|
margin-top: 0;
|
|
|
margin-bottom: 4px;
|
|
|
margin-left: 4px;
|
|
|
margin-right: 4px;
|
|
|
border-radius: 8px;
|
|
|
box-shadow: none;
|
|
|
border-bottom: 2px solid transparent;
|
|
|
}
|
|
|
.MLK__toolbar > div > div:not(.disabled):not(.selected):hover {
|
|
|
background: var(--_toolbar-background-hover);
|
|
|
}
|
|
|
.MLK__toolbar > div > div.disabled svg,
|
|
|
.MLK__toolbar > div > div.disabled:hover svg,
|
|
|
.MLK__toolbar > div > div.disabled.is-pressed svg {
|
|
|
color: var(--_toolbar-text);
|
|
|
opacity: 0.2;
|
|
|
}
|
|
|
.MLK__toolbar > div > div:hover,
|
|
|
.MLK__toolbar > div > div:active,
|
|
|
.MLK__toolbar > div > div.is-pressed,
|
|
|
.MLK__toolbar > div > div.is-active {
|
|
|
color: var(--_toolbar-text-active);
|
|
|
}
|
|
|
.MLK__toolbar > div > div.selected {
|
|
|
color: var(--_toolbar-text-active);
|
|
|
background: var(--_toolbar-background-selected);
|
|
|
border-radius: 0;
|
|
|
border-bottom-color: var(--_toolbar-text-active);
|
|
|
padding-bottom: 4px;
|
|
|
margin-bottom: 8px;
|
|
|
}
|
|
|
/* This is the element that displays variants on press+hold */
|
|
|
.MLK__variant-panel {
|
|
|
visibility: hidden;
|
|
|
position: fixed;
|
|
|
display: flex;
|
|
|
flex-flow: row wrap-reverse;
|
|
|
justify-content: center;
|
|
|
align-content: center;
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
bottom: auto;
|
|
|
top: 0;
|
|
|
box-sizing: content-box;
|
|
|
transform: none;
|
|
|
z-index: calc(var(--_keyboard-zindex) + 1);
|
|
|
touch-action: none;
|
|
|
max-width: 350px;
|
|
|
background: var(--_variant-panel-background);
|
|
|
text-align: center;
|
|
|
border-radius: 6px;
|
|
|
padding: 6px;
|
|
|
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
|
|
|
transition: none;
|
|
|
}
|
|
|
.MLK__variant-panel.is-visible {
|
|
|
visibility: visible;
|
|
|
}
|
|
|
.MLK__variant-panel.compact {
|
|
|
--_variant-keycap-length: var(--variant-keycap-length, 50px);
|
|
|
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
|
|
|
--_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 10px);
|
|
|
}
|
|
|
.MLK__variant-panel .item {
|
|
|
display: flex;
|
|
|
flex-flow: column;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
font-size: var(--_variant-keycap-font-size);
|
|
|
height: var(--_variant-keycap-length);
|
|
|
width: var(--_variant-keycap-length);
|
|
|
margin: 0;
|
|
|
box-sizing: border-box;
|
|
|
border-radius: 5px;
|
|
|
border: 1px solid transparent;
|
|
|
background: transparent;
|
|
|
pointer-events: all;
|
|
|
cursor: pointer;
|
|
|
color: var(--_variant-keycap-text);
|
|
|
fill: currentColor;
|
|
|
}
|
|
|
@media (max-height: 412px) {
|
|
|
.MLK__variant-panel .item {
|
|
|
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
|
|
|
--_variant-keycap-length: var(--variant-keycap-length, 50px);
|
|
|
}
|
|
|
}
|
|
|
.MLK__variant-panel .item .ML__latex {
|
|
|
pointer-events: none;
|
|
|
}
|
|
|
.MLK__variant-panel .item.is-active {
|
|
|
background: var(--_variant-keycap-background-active);
|
|
|
color: var(--_variant-keycap-text-active);
|
|
|
}
|
|
|
.MLK__variant-panel .item.is-pressed {
|
|
|
background: var(--_variant-keycap-background-pressed);
|
|
|
color: var(--_variant-keycap-text-pressed);
|
|
|
}
|
|
|
.MLK__variant-panel .item.small {
|
|
|
font-size: var(--_keycap-small-font-size);
|
|
|
}
|
|
|
.MLK__variant-panel .item.swatch-button {
|
|
|
box-sizing: border-box;
|
|
|
background: #fbfbfb;
|
|
|
}
|
|
|
.MLK__variant-panel .item.swatch-button > span {
|
|
|
display: inline-block;
|
|
|
margin: 6px;
|
|
|
width: calc(100% - 12px);
|
|
|
height: calc(100% - 12px);
|
|
|
border-radius: 50%;
|
|
|
}
|
|
|
.MLK__variant-panel .item.swatch-button:hover {
|
|
|
background: #f0f0f0;
|
|
|
}
|
|
|
.MLK__variant-panel .item.swatch-button:hover > span {
|
|
|
border-radius: 2px;
|
|
|
}
|
|
|
.MLK__variant-panel .item.box > div,
|
|
|
.MLK__variant-panel .item.box > span {
|
|
|
border: 1px dashed rgba(0, 0, 0, 0.24);
|
|
|
}
|
|
|
.MLK__variant-panel .item .warning {
|
|
|
min-height: 60px;
|
|
|
min-width: 60px;
|
|
|
background: #cd0030;
|
|
|
color: white;
|
|
|
padding: 5px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
border-radius: 5px;
|
|
|
}
|
|
|
.MLK__variant-panel .item .warning.is-pressed,
|
|
|
.MLK__variant-panel .item .warning.is-active {
|
|
|
background: red;
|
|
|
}
|
|
|
.MLK__variant-panel .item .warning svg.svg-glyph {
|
|
|
width: 50px;
|
|
|
height: 50px;
|
|
|
}
|
|
|
.MLK__variant-panel .item aside {
|
|
|
font-size: var(--_variant-keycap-aside-font-size);
|
|
|
line-height: 12px;
|
|
|
opacity: 0.78;
|
|
|
padding-top: 2px;
|
|
|
}
|
|
|
.MLK__keycap {
|
|
|
position: relative;
|
|
|
}
|
|
|
.MLK__shift {
|
|
|
display: block;
|
|
|
position: absolute;
|
|
|
right: 4px;
|
|
|
top: 4px;
|
|
|
font-size: var(--_keycap-shift-font-size);
|
|
|
color: var(--_keycap-shift-color);
|
|
|
}
|
|
|
.hide-shift .MLK__shift {
|
|
|
display: none;
|
|
|
}
|
|
|
@media (max-width: 414px) {
|
|
|
.MLK__variant-panel {
|
|
|
max-width: 350px;
|
|
|
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
|
|
|
--_variant-keycap-length: var(--variant-keycap-length, 50px);
|
|
|
}
|
|
|
}
|
|
|
/* @xs breakpoint: iPhone 5 */
|
|
|
@container (max-width: 414px) {
|
|
|
.MLK__rows {
|
|
|
--_keycap-gap: max(var(--_keycap-gap, 2px), 2px);
|
|
|
--_keycap-height: max(var(--_keycap-height), 42px);
|
|
|
--_keycap-width: min(min(var(--_keycap-max-width), 10cqw), 62px);
|
|
|
}
|
|
|
.MLK__toolbar > div > div {
|
|
|
font-size: 100%;
|
|
|
margin-left: 2px;
|
|
|
margin-right: 2px;
|
|
|
}
|
|
|
.MLK__rows .shift,
|
|
|
.MLK__rows .action {
|
|
|
font-size: 65%;
|
|
|
}
|
|
|
.MLK__rows .warning svg.svg-glyph {
|
|
|
width: 14px;
|
|
|
height: 14px;
|
|
|
min-height: 14px;
|
|
|
}
|
|
|
}
|
|
|
@container (max-width: 744px) {
|
|
|
.MLK__rows {
|
|
|
--_keycap-gap: max(var(--keycap-gap, 2px), 2px);
|
|
|
--_keycap-height: max(var(--keycap-height, 52px), 52px);
|
|
|
--_keycap-width: min(min(var(--_keycap-max-width), 10cqw), 62px);
|
|
|
}
|
|
|
.MLK__toolbar > div > div {
|
|
|
padding-left: 0;
|
|
|
padding-right: 0;
|
|
|
}
|
|
|
.MLK__tooltip::after {
|
|
|
padding: 8px 16px;
|
|
|
font-size: 16px;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row > div.fnbutton {
|
|
|
font-size: 16px;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row > div.bigfnbutton {
|
|
|
font-size: calc(var(--_keycap-extra-small-font-size) / 1.55);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row > div.small {
|
|
|
font-size: 13px;
|
|
|
}
|
|
|
.MLK__rows > .MLK__row > div > aside {
|
|
|
display: none;
|
|
|
}
|
|
|
.MLK__shift {
|
|
|
display: none;
|
|
|
}
|
|
|
}
|
|
|
/* Medium breakpoint: larger phones */
|
|
|
@container (max-width: 768px) {
|
|
|
.MLK__rows {
|
|
|
--_keycap-height: max(var(--keycap-height, 42px), 42px);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row > div > small {
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
}
|
|
|
@media (max-height: 768px) {
|
|
|
.MLK__rows {
|
|
|
--_keycap-height: max(var(--keycap-height, 42px), 42px);
|
|
|
}
|
|
|
.MLK__rows > .MLK__row > div > small {
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
}
|
|
|
@container (max-width: 1444px) {
|
|
|
.MLK__rows .if-wide {
|
|
|
display: none;
|
|
|
}
|
|
|
}
|
|
|
@media (prefers-color-scheme: dark) {
|
|
|
.ML__keyboard {
|
|
|
--_accent-color: var(--keyboard-accent-color, #0b5c9c);
|
|
|
--_background: var(--keyboard-background, #151515);
|
|
|
--_border: var(--keyboard-border, transparent);
|
|
|
--_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);
|
|
|
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);
|
|
|
--keyboard-toolbar-background-hover: #303030;
|
|
|
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);
|
|
|
--_keycap-background: var(--keycap-background, #1f2022);
|
|
|
--_keycap-background-hover: var(--keycap-background-hover, #2f3032);
|
|
|
--_keycap-border: var(--_keycap-border, transparent);
|
|
|
--_keycap-border-bottom: var(--_keycap-border-bottom, transparent);
|
|
|
--_keycap-text: var(--keycap-text, #e3e4e8);
|
|
|
--_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);
|
|
|
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);
|
|
|
--_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);
|
|
|
--keycap-secondary-border: transparent;
|
|
|
--keycap-secondary-border-bottom: transparent;
|
|
|
--_keycap-secondary-border: var(--keycap-secondary-border, transparent);
|
|
|
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);
|
|
|
--_variant-panel-background: var(--variant-panel-background, #303030);
|
|
|
--_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);
|
|
|
}
|
|
|
}
|
|
|
/* Same as the media query, but with a class */
|
|
|
[theme='dark'] .ML__keyboard {
|
|
|
--_accent-color: var(--keyboard-accent-color, #0b5c9c);
|
|
|
--_background: var(--keyboard-background, #151515);
|
|
|
--_border: var(--keyboard-border, transparent);
|
|
|
--_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);
|
|
|
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);
|
|
|
--keyboard-toolbar-background-hover: #303030;
|
|
|
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);
|
|
|
--_keycap-background: var(--keycap-background, #1f2022);
|
|
|
--_keycap-background-hover: var(--keycap-background-hover, #2f3032);
|
|
|
--_keycap-border: var(--_keycap-border, transparent);
|
|
|
--_keycap-border-bottom: var(--_keycap-border-bottom, transparent);
|
|
|
--_keycap-text: var(--keycap-text, #e3e4e8);
|
|
|
--_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);
|
|
|
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);
|
|
|
--_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);
|
|
|
--keycap-secondary-border: transparent;
|
|
|
--keycap-secondary-border-bottom: transparent;
|
|
|
--_keycap-secondary-border: var(--keycap-secondary-border, transparent);
|
|
|
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);
|
|
|
--_variant-panel-background: var(--variant-panel-background, #303030);
|
|
|
--_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);
|
|
|
}
|
|
|
[theme='light'] .ML__keyboard {
|
|
|
--_accent-color: var(--keyboard-accent-color, #0c75d8);
|
|
|
--_background: var(--keyboard-background, #cacfd7);
|
|
|
--_border: var(--keyboard-border, #ddd);
|
|
|
--_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);
|
|
|
--_toolbar-background: var(--keyboard-toolbar-background, transparent);
|
|
|
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);
|
|
|
--_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);
|
|
|
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);
|
|
|
--_keycap-background: var(--keycap-background, white);
|
|
|
--_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);
|
|
|
--_keycap-background-active: var(--keycap-background-active, var(--_accent-color));
|
|
|
--_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));
|
|
|
--_keycap-border: var(--_keycap-border, #e5e6e9);
|
|
|
--_keycap-border-bottom: var(--_keycap-border-bottom, #8d8f92);
|
|
|
--_keycap-text: var(--keycap-text, #000);
|
|
|
--_keycap-text-active: var(--keycap-text-active, #fff);
|
|
|
--_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));
|
|
|
--_keycap-text-pressed: var(--keycap-text-pressed, #fff);
|
|
|
--_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));
|
|
|
--_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);
|
|
|
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);
|
|
|
--_keycap-secondary-text: var(--keycap-secondary-text, #060707);
|
|
|
--_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);
|
|
|
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);
|
|
|
--_variant-panel-background: var(--variant-panel-background, #fff);
|
|
|
--_variant-keycap-text: var(--variant-keycap-textvar, var(--_keycap-text));
|
|
|
--_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));
|
|
|
--_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));
|
|
|
}
|
|
|
`,Od=`:host {
|
|
|
--primary-color: #5898ff;
|
|
|
--primary-color-dimmed: #c0c0f0;
|
|
|
--primary-color-dark: var(--blue-500);
|
|
|
--primary-color-light: var(--blue-100);
|
|
|
--primary-color-reverse: #ffffff;
|
|
|
--secondary-color: #ff8a65;
|
|
|
--secondary-color-dimmed: #f0d5c5;
|
|
|
--secondary-color-dark: var(--orange-500);
|
|
|
--secondary-color-light: var(--orange-100);
|
|
|
--secondary-color-reverse: #ffffff;
|
|
|
--link-color: #5898ff;
|
|
|
--link-color-dimmed: #c5c5c5;
|
|
|
--link-color-dark: #121212;
|
|
|
--link-color-light: #e2e2e2;
|
|
|
--link-color-reverse: #ffffff;
|
|
|
--semantic-blue: var(--blue-700);
|
|
|
--semantic-red: var(--red-400);
|
|
|
--semantic-orange: var(--orange-400);
|
|
|
--semantic-green: var(--green-700);
|
|
|
--neutral-100: #f5f5f5;
|
|
|
--neutral-200: #eeeeee;
|
|
|
--neutral-300: #e0e0e0;
|
|
|
--neutral-400: #bdbdbd;
|
|
|
--neutral-500: #9e9e9e;
|
|
|
--neutral-600: #757575;
|
|
|
--neutral-700: #616161;
|
|
|
--neutral-800: #424242;
|
|
|
--neutral-900: #212121;
|
|
|
--red-25: #fff8f7;
|
|
|
--red-50: #fff1ef;
|
|
|
--red-100: #ffeae6;
|
|
|
--red-200: #ffcac1;
|
|
|
--red-300: #ffa495;
|
|
|
--red-400: #ff7865;
|
|
|
--red-500: #f21c0d;
|
|
|
--red-600: #e50018;
|
|
|
--red-700: #d30024;
|
|
|
--red-800: #bd002c;
|
|
|
--red-900: #a1002f;
|
|
|
--orange-25: #fffbf8;
|
|
|
--orange-50: #fff7f1;
|
|
|
--orange-100: #fff3ea;
|
|
|
--orange-200: #ffe1c9;
|
|
|
--orange-300: #ffcca2;
|
|
|
--orange-400: #ffb677;
|
|
|
--orange-500: #fe9310;
|
|
|
--orange-600: #f58700;
|
|
|
--orange-700: #ea7c00;
|
|
|
--orange-800: #dc6d00;
|
|
|
--orange-900: #ca5b00;
|
|
|
--brown-25: #fff8ef;
|
|
|
--brown-50: #fff1df;
|
|
|
--brown-100: #ffe9ce;
|
|
|
--brown-200: #ebcca6;
|
|
|
--brown-300: #cdaf8a;
|
|
|
--brown-400: #af936f;
|
|
|
--brown-500: #856a47;
|
|
|
--brown-600: #7f5e34;
|
|
|
--brown-700: #78511f;
|
|
|
--brown-800: #6e4200;
|
|
|
--brown-900: #593200;
|
|
|
--yellow-25: #fffdf9;
|
|
|
--yellow-50: #fffcf2;
|
|
|
--yellow-100: #fffaec;
|
|
|
--yellow-200: #fff2ce;
|
|
|
--yellow-300: #ffe8ab;
|
|
|
--yellow-400: #ffdf85;
|
|
|
--yellow-500: #ffcf33;
|
|
|
--yellow-600: #f1c000;
|
|
|
--yellow-700: #dfb200;
|
|
|
--yellow-800: #c9a000;
|
|
|
--yellow-900: #ad8a00;
|
|
|
--lime-25: #f4ffee;
|
|
|
--lime-50: #e9ffdd;
|
|
|
--lime-100: #ddffca;
|
|
|
--lime-200: #a8fb6f;
|
|
|
--lime-300: #94e659;
|
|
|
--lime-400: #80d142;
|
|
|
--lime-500: #63b215;
|
|
|
--lime-600: #45a000;
|
|
|
--lime-700: #268e00;
|
|
|
--lime-800: #007417;
|
|
|
--lime-900: #005321;
|
|
|
--green-25: #f5fff5;
|
|
|
--green-50: #ebffea;
|
|
|
--green-100: #e0ffdf;
|
|
|
--green-200: #a7ffa7;
|
|
|
--green-300: #5afa65;
|
|
|
--green-400: #45e953;
|
|
|
--green-500: #17cf36;
|
|
|
--green-600: #00b944;
|
|
|
--green-700: #00a34a;
|
|
|
--green-800: #008749;
|
|
|
--green-900: #00653e;
|
|
|
--teal-25: #f3ffff;
|
|
|
--teal-50: #e6fffe;
|
|
|
--teal-100: #d9fffe;
|
|
|
--teal-200: #8dfffe;
|
|
|
--teal-300: #57f4f4;
|
|
|
--teal-400: #43e5e5;
|
|
|
--teal-500: #17cfcf;
|
|
|
--teal-600: #00c2c0;
|
|
|
--teal-700: #00b5b1;
|
|
|
--teal-800: #00a49e;
|
|
|
--teal-900: #009087;
|
|
|
--cyan-25: #f7fcff;
|
|
|
--cyan-50: #eff8ff;
|
|
|
--cyan-100: #e7f5ff;
|
|
|
--cyan-200: #c2e6ff;
|
|
|
--cyan-300: #95d5ff;
|
|
|
--cyan-400: #61c4ff;
|
|
|
--cyan-500: #13a7ec;
|
|
|
--cyan-600: #069eda;
|
|
|
--cyan-700: #0095c9;
|
|
|
--cyan-800: #0088b2;
|
|
|
--cyan-900: #0a7897;
|
|
|
--blue-25: #f7faff;
|
|
|
--blue-50: #eef5ff;
|
|
|
--blue-100: #e5f1ff;
|
|
|
--blue-200: #bfdbff;
|
|
|
--blue-300: #92c2ff;
|
|
|
--blue-400: #63a8ff;
|
|
|
--blue-500: #0d80f2;
|
|
|
--blue-600: #0077db;
|
|
|
--blue-700: #006dc4;
|
|
|
--blue-800: #0060a7;
|
|
|
--blue-900: #005086;
|
|
|
--indigo-25: #f8f7ff;
|
|
|
--indigo-50: #f1efff;
|
|
|
--indigo-100: #eae7ff;
|
|
|
--indigo-200: #ccc3ff;
|
|
|
--indigo-300: #ac99ff;
|
|
|
--indigo-400: #916aff;
|
|
|
--indigo-500: #63c;
|
|
|
--indigo-600: #5a21b2;
|
|
|
--indigo-700: #4e0b99;
|
|
|
--indigo-800: #3b0071;
|
|
|
--indigo-900: #220040;
|
|
|
--purple-25: #fbf7ff;
|
|
|
--purple-50: #f8f0ff;
|
|
|
--purple-100: #f4e8ff;
|
|
|
--purple-200: #e4c4ff;
|
|
|
--purple-300: #d49aff;
|
|
|
--purple-400: #c36aff;
|
|
|
--purple-500: #a219e6;
|
|
|
--purple-600: #9000c4;
|
|
|
--purple-700: #7c009f;
|
|
|
--purple-800: #600073;
|
|
|
--purple-900: #3d0043;
|
|
|
--magenta-25: #fff8fb;
|
|
|
--magenta-50: #fff2f6;
|
|
|
--magenta-100: #ffebf2;
|
|
|
--magenta-200: #ffcddf;
|
|
|
--magenta-300: #ffa8cb;
|
|
|
--magenta-400: #ff7fb7;
|
|
|
--magenta-500: #eb4799;
|
|
|
--magenta-600: #da3689;
|
|
|
--magenta-700: #c82179;
|
|
|
--magenta-800: #b00065;
|
|
|
--magenta-900: #8a004c;
|
|
|
}
|
|
|
@media (prefers-color-scheme: dark) {
|
|
|
:host {
|
|
|
--semantic-blue: var(--blue-700);
|
|
|
--semantic-red: var(--red-400);
|
|
|
--semantic-orange: var(--orange-400);
|
|
|
--semantic-green: var(--green-700);
|
|
|
--semantic-bg-blue: var(--blue-25);
|
|
|
--semantic-bg-red: var(--red-25);
|
|
|
--semantic-bg-orange: var(--orange-25);
|
|
|
--semantic-bg-green: var(--green-25);
|
|
|
--neutral-100: #121212;
|
|
|
--neutral-200: #424242;
|
|
|
--neutral-300: #616161;
|
|
|
--neutral-400: #757575;
|
|
|
--neutral-500: #9e9e9e;
|
|
|
--neutral-600: #bdbdbd;
|
|
|
--neutral-700: #e0e0e0;
|
|
|
--neutral-800: #eeeeee;
|
|
|
--neutral-900: #f5f5f5;
|
|
|
}
|
|
|
}
|
|
|
:host([theme='dark']) {
|
|
|
--semantic-blue: var(--blue-700);
|
|
|
--semantic-red: var(--red-400);
|
|
|
--semantic-orange: var(--orange-400);
|
|
|
--semantic-green: var(--green-700);
|
|
|
--semantic-bg-blue: var(--blue-25);
|
|
|
--semantic-bg-red: var(--red-25);
|
|
|
--semantic-bg-orange: var(--orange-25);
|
|
|
--semantic-bg-green: var(--green-25);
|
|
|
--neutral-100: #121212;
|
|
|
--neutral-200: #424242;
|
|
|
--neutral-300: #616161;
|
|
|
--neutral-400: #757575;
|
|
|
--neutral-500: #9e9e9e;
|
|
|
--neutral-600: #bdbdbd;
|
|
|
--neutral-700: #e0e0e0;
|
|
|
--neutral-800: #eeeeee;
|
|
|
--neutral-900: #f5f5f5;
|
|
|
}
|
|
|
/* @media (prefers-color-scheme: dark) {
|
|
|
:host {
|
|
|
--label-color: #fff;
|
|
|
--active-label-color: #000;
|
|
|
--menu-bg: #525252;
|
|
|
--active-bg: #5898ff;
|
|
|
--active-bg-dimmed: #5c5c5c;
|
|
|
}
|
|
|
} */
|
|
|
:host {
|
|
|
--ui-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
|
|
|
'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji',
|
|
|
'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
|
--ui-font-size: 14px;
|
|
|
--ui-line-height: 1.5;
|
|
|
--ui-letter-spacing: 0.007em;
|
|
|
--mono-font-family: 'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono',
|
|
|
'Source Code Pro', Menlo, Monaco, 'Courier New', monospace;
|
|
|
--ui-layer-1: var(--neutral-100);
|
|
|
--ui-layer-2: var(--neutral-200);
|
|
|
--ui-layer-3: var(--neutral-300);
|
|
|
--ui-layer-4: var(--neutral-400);
|
|
|
--ui-layer-5: var(--neutral-500);
|
|
|
--ui-layer-6: var(--neutral-600);
|
|
|
--ui-border-color: var(--primary-color);
|
|
|
--ui-border-radius: 4px;
|
|
|
--ui-text: var(--neutral-900);
|
|
|
--ui-text-secondary: var(--neutral-700);
|
|
|
--ui-text-placeholder: var(--neutral-500);
|
|
|
--ui-text-muted: var(--neutral-300);
|
|
|
/** A field is a UI element in which a user can type data, for
|
|
|
* example an input or textarea element.
|
|
|
*/
|
|
|
--ui-field-bg: var(--neutral-100);
|
|
|
--ui-field-bg-hover: var(--neutral-100);
|
|
|
--ui-field-bg-disabled: var(--neutral-300);
|
|
|
--ui-field-bg-invalid: var(--red-100);
|
|
|
--ui-field-bg-focus: var(--neutral-100);
|
|
|
--ui-field-border: 0.5px solid var(--border-color);
|
|
|
--ui-field-border-hover: 0.5px solid var(--border-color);
|
|
|
--ui-field-border-disabled: 0.5px solid var(--border-color);
|
|
|
--ui-field-border-invalid: 0.5px solid var(--border-color);
|
|
|
--ui-field-border-focus: 0.5px solid var(--border-color);
|
|
|
--ui-menu-bg: var(--neutral-100);
|
|
|
--ui-menu-text: var(--neutral-900);
|
|
|
--ui-menu-bg-hover: var(--neutral-200);
|
|
|
--ui-menu-text-hover: var(--neutral-900);
|
|
|
/** The \`active\` state is used for the state of menu items
|
|
|
* when they are selected.
|
|
|
*/
|
|
|
--ui-menu-bg-active: var(--primary-color);
|
|
|
--ui-menu-text-active: var(--primary-color-reverse);
|
|
|
/** The \`active-muted\` set is used for the state of
|
|
|
* submenus when they are open.
|
|
|
*/
|
|
|
--ui-menu-bg-active-muted: var(--neutral-300);
|
|
|
--ui-menu-text-active-muted: var(--neutral-900);
|
|
|
/* --ui-menu-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.302),
|
|
|
0 2px 6px 2px rgba(60, 64, 67, 0.149); */
|
|
|
--ui-menu-shadow: 0 0 2px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.2);
|
|
|
--ui-menu-divider: 0.5px solid #c7c7c7;
|
|
|
/* var(--neutral-300); */
|
|
|
--ui-menu-z-index: 10000;
|
|
|
--page-bg: var(--neutral-100);
|
|
|
--content-bg: var(--neutral-200);
|
|
|
}
|
|
|
@media (prefers-color-scheme: dark) {
|
|
|
:host {
|
|
|
--ui-menu-bg: var(--neutral-200);
|
|
|
}
|
|
|
}
|
|
|
:host([theme='dark']) {
|
|
|
--ui-menu-bg: var(--neutral-200);
|
|
|
}
|
|
|
/* PingFang SC is a macOS font. Microsoft Yahei is a Windows font.
|
|
|
Noto is a Linux/Android font.
|
|
|
*/
|
|
|
:lang(zh-cn),
|
|
|
:lang(zh-sg),
|
|
|
:lang(zh-my),
|
|
|
:lang(zh) {
|
|
|
--ui-font-family: -apple-system, system-ui, 'PingFang SC', 'Hiragino Sans GB',
|
|
|
'Noto Sans CJK SC', 'Noto Sans SC', 'Noto Sans', 'Microsoft Yahei UI',
|
|
|
'Microsoft YaHei New', 'Microsoft Yahei', '\u5FAE\u8F6F\u96C5\u9ED1', SimSun, '\u5B8B\u4F53',
|
|
|
STXihei, '\u534E\u6587\u7EC6\u9ED1', sans-serif;
|
|
|
}
|
|
|
:lang(zh-tw),
|
|
|
:lang(zh-hk),
|
|
|
:lang(zh-mo) {
|
|
|
--ui-font-family: -apple-system, system-ui, 'Noto Sans',
|
|
|
'Microsoft JhengHei UI', 'Microsoft JhengHei', '\u5FAE\u8EDF\u6B63\u9ED1\u9AD4', '\u65B0\u7D30\u660E\u9AD4',
|
|
|
'PMingLiU', '\u7D30\u660E\u9AD4', 'MingLiU', sans-serif;
|
|
|
}
|
|
|
:lang(ja),
|
|
|
:lang(ja-jp),
|
|
|
:lang(ja-jp-mac) {
|
|
|
--ui-font-family: -apple-system, system-ui, 'Hiragino Sans',
|
|
|
'Hiragino Kaku Gothic ProN', 'Noto Sans CJK JP', 'Noto Sans JP', 'Noto Sans',
|
|
|
'\u6E38\u30B4\u30B7\u30C3\u30AF', '\u6E38\u30B4\u30B7\u30C3\u30AF\u4F53', YuGothic, 'Yu Gothic', '\u30E1\u30A4\u30EA\u30AA', Meiryo,
|
|
|
'\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF', 'MS PGothic', sans-serif;
|
|
|
}
|
|
|
:lang(ko),
|
|
|
:lang(ko-kr),
|
|
|
:lang(ko-kr-std) {
|
|
|
--ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',
|
|
|
'Noto Sans', 'Malgun Gothic', '\uB9D1\uC740 \uACE0\uB515', 'Apple SD Gothic Neo',
|
|
|
'\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo', 'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif;
|
|
|
}
|
|
|
:lang(ko-kr-apple) {
|
|
|
--ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',
|
|
|
'Noto Sans', 'Apple SD Gothic Neo', '\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo',
|
|
|
'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif;
|
|
|
}
|
|
|
:lang(zh-cn),
|
|
|
:lang(zh-sg),
|
|
|
:lang(zh-my),
|
|
|
:lang(zh),
|
|
|
:lang(zh-tw),
|
|
|
:lang(zh-hk),
|
|
|
:lang(zh-mo),
|
|
|
:lang(ja),
|
|
|
:lang(ja-jp),
|
|
|
:lang(ja-jp-mac),
|
|
|
:lang(ko),
|
|
|
:lang(ko-kr),
|
|
|
:lang(ko-kr-std),
|
|
|
:lang(ko-kr-apple) {
|
|
|
--ui-font-size: 1rem;
|
|
|
--ui-line-height: 1.7;
|
|
|
--ui-letter-spacing: 0;
|
|
|
}
|
|
|
:dir(rtl) {
|
|
|
--ui-line-height: auto;
|
|
|
--ui-letter-spacing: 0;
|
|
|
}
|
|
|
`,Ss=`.ui-menu *,
|
|
|
.ui-menu ::before,
|
|
|
.ui-menu ::after {
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
.ui-menu {
|
|
|
display: none;
|
|
|
color-scheme: light dark;
|
|
|
-webkit-user-select: none;
|
|
|
/* Important: Safari iOS doesn't respect user-select */
|
|
|
user-select: none;
|
|
|
cursor: default;
|
|
|
-webkit-touch-callout: none;
|
|
|
-webkit-tap-highlight-color: rgba(0 0 0 0);
|
|
|
--active-label-color: #fff;
|
|
|
/* ui-menu-text-active */
|
|
|
--label-color: #121212;
|
|
|
/* ui-menu-text */
|
|
|
--menu-bg: #e2e2e2;
|
|
|
/* ui-menu-background */
|
|
|
--active-bg: #5898ff;
|
|
|
/* ui-menu-background-active */
|
|
|
--active-bg-dimmed: #c5c5c5;
|
|
|
/* ui-menu-background-active-muted */
|
|
|
}
|
|
|
/** Use the :where pseudo selector to make the specificity of the
|
|
|
* selector 0, so that it can be overridden by the user.
|
|
|
*/
|
|
|
:where(.ui-menu-container) {
|
|
|
position: absolute;
|
|
|
overflow: visible;
|
|
|
width: auto;
|
|
|
height: auto;
|
|
|
z-index: 10000;
|
|
|
border-radius: 8px;
|
|
|
background: var(--ui-menu-bg);
|
|
|
box-shadow: var(--ui-menu-shadow);
|
|
|
list-style: none;
|
|
|
padding: 6px 0 6px 0;
|
|
|
margin: 0;
|
|
|
user-select: none;
|
|
|
cursor: default;
|
|
|
color: var(--ui-menu-text);
|
|
|
font-weight: normal;
|
|
|
font-style: normal;
|
|
|
text-shadow: none;
|
|
|
text-transform: none;
|
|
|
letter-spacing: 0;
|
|
|
outline: none;
|
|
|
opacity: 1;
|
|
|
/* The [popover] elements have a 1px solid black border. Ugh. */
|
|
|
border: none;
|
|
|
width: fit-content;
|
|
|
height: fit-content;
|
|
|
}
|
|
|
:where(.ui-menu-container > li) {
|
|
|
display: flex;
|
|
|
flex-flow: row;
|
|
|
align-items: center;
|
|
|
padding: 1px 7px 1px 7px;
|
|
|
margin-top: 0;
|
|
|
margin-left: 6px;
|
|
|
margin-right: 6px;
|
|
|
border-radius: 4px;
|
|
|
white-space: nowrap;
|
|
|
position: relative;
|
|
|
outline: none;
|
|
|
fill: currentColor;
|
|
|
user-select: none;
|
|
|
cursor: default;
|
|
|
text-align: left;
|
|
|
color: inherit;
|
|
|
font-family: var(--ui-font-family);
|
|
|
font-size: var(--ui-font-size);
|
|
|
line-height: var(--ui-line-height);
|
|
|
letter-spacing: var(--ui-letter-spacing);
|
|
|
}
|
|
|
:where(.ui-menu-container > li > .label) {
|
|
|
appearance: none;
|
|
|
background: none;
|
|
|
outline: none;
|
|
|
width: 100%;
|
|
|
margin: 0;
|
|
|
padding: 1px 2px 1px 1px;
|
|
|
overflow: visible;
|
|
|
border: 1px solid transparent;
|
|
|
white-space: nowrap;
|
|
|
text-align: start;
|
|
|
}
|
|
|
:where(.ui-menu-container > li:has(.heading)) {
|
|
|
margin-top: 0.5em;
|
|
|
}
|
|
|
:where(.ui-menu-container > li > .label.heading) {
|
|
|
font-weight: bold;
|
|
|
opacity: 0.4;
|
|
|
}
|
|
|
:where(.ui-menu-container > li.indent > .label) {
|
|
|
margin-inline-start: 12px;
|
|
|
}
|
|
|
:where(.ui-menu-container > li > .label.indent) {
|
|
|
margin-inline-start: 12px;
|
|
|
}
|
|
|
:where(.ui-menu-container > li[role='divider']) {
|
|
|
border-bottom: 1px solid var(--ui-menu-divider);
|
|
|
border-radius: 0;
|
|
|
padding: 0;
|
|
|
margin-left: 15px;
|
|
|
margin-right: 15px;
|
|
|
padding-top: 5px;
|
|
|
margin-bottom: 5px;
|
|
|
width: calc(100% - 30px);
|
|
|
/** 100% - (margin-left + margin-right) */
|
|
|
}
|
|
|
:where(.ui-menu-container > li[aria-disabled='true']) {
|
|
|
opacity: 0.5;
|
|
|
}
|
|
|
:where(.ui-menu-container > li.active) {
|
|
|
background: var(--ui-menu-bg-active);
|
|
|
background: -apple-system-control-accent;
|
|
|
color: var(--ui-menu-text-active);
|
|
|
}
|
|
|
:where(.ui-menu-container > li.active.is-submenu-open) {
|
|
|
background: var(--ui-menu-bg-active-muted);
|
|
|
color: inherit;
|
|
|
}
|
|
|
:where(.ui-menu-container > li[aria-haspopup='true'] > .label) {
|
|
|
padding-inline-end: 0;
|
|
|
}
|
|
|
:where(.ui-menu-container > li[aria-haspopup='true'].active::after) {
|
|
|
color: var(--ui-menu-text-active);
|
|
|
}
|
|
|
/** Keyboard shortcut */
|
|
|
:where(.ui-menu-container > li > kbd) {
|
|
|
font-family: var(--ui-font-family);
|
|
|
margin-inline-start: 12px;
|
|
|
opacity: 0.4;
|
|
|
}
|
|
|
:where(.ui-menu-container > li.active > kbd) {
|
|
|
opacity: 0.85;
|
|
|
}
|
|
|
.ui-trailing-chevron {
|
|
|
display: flex;
|
|
|
margin-inline-start: 24px;
|
|
|
width: 10px;
|
|
|
height: 10px;
|
|
|
margin-bottom: 4px;
|
|
|
}
|
|
|
.ui-trailing-chevron:dir(rtl) {
|
|
|
transform: scaleX(-1);
|
|
|
}
|
|
|
.ui-checkmark {
|
|
|
display: flex;
|
|
|
margin-inline-end: -11px;
|
|
|
margin-inline-start: -4px;
|
|
|
margin-top: 2px;
|
|
|
width: 16px;
|
|
|
height: 16px;
|
|
|
}
|
|
|
.ui-mixedmark {
|
|
|
display: flex;
|
|
|
margin-inline-end: -11px;
|
|
|
margin-inline-start: -4px;
|
|
|
margin-top: 2px;
|
|
|
width: 16px;
|
|
|
height: 16px;
|
|
|
}
|
|
|
`,ma;function ho(e){let i="";switch(e){case"mathfield-element":i=`
|
|
|
:host { display: inline-block; background-color: field; color: fieldtext; border-width: 1px; border-style: solid; border-color: #acacac; border-radius: 2px; padding:4px;}
|
|
|
:host([hidden]) { display: none; }
|
|
|
:host([disabled]), :host([disabled]:focus), :host([disabled]:focus-within) { outline: none; opacity: .5; }
|
|
|
:host(:focus), :host(:focus-within) {
|
|
|
outline: Highlight auto 1px; /* For Firefox */
|
|
|
outline: -webkit-focus-ring-color auto 1px;
|
|
|
}
|
|
|
:host([readonly]:focus), :host([readonly]:focus-within),
|
|
|
:host([read-only]:focus), :host([read-only]:focus-within) {
|
|
|
outline: none;
|
|
|
}
|
|
|
@media (hover: none) and (pointer: coarse) {
|
|
|
:host(:not(:focus)) :first-child { pointer-events: none !important; }
|
|
|
}`;break;case"core":i=Pd;break;case"mathfield":i=Rd;break;case"environment-popover":i=vf;break;case"suggestion-popover":i=yf;break;case"keystroke-caption":i=Xo;break;case"virtual-keyboard":i=Ku;break;case"ui":i=Od;break;case"menu":i=Ss;break;default:debugger}return i}function fo(e){return ma||(ma={}),ma[e]||(ma[e]=new CSSStyleSheet,ma[e].replaceSync(ho(e))),ma[e]}var Js;function ds(e){var i;if(!("adoptedStyleSheets"in document)){if(window.document.getElementById(`mathlive-style-${e}`))return;const r=window.document.createElement("style");r.id=`mathlive-style-${e}`,r.append(window.document.createTextNode(ho(e))),window.document.head.appendChild(r);return}if(Js||(Js={}),((i=Js[e])!=null?i:0)!==0)Js[e]+=1;else{const r=fo(e);document.adoptedStyleSheets=[...document.adoptedStyleSheets,r],Js[e]=1}}function Qs(e){if("adoptedStyleSheets"in document&&Js!=null&&Js[e]&&(Js[e]-=1,Js[e]<=0)){const i=ma[e];document.adoptedStyleSheets=document.adoptedStyleSheets.filter(r=>r!==i)}}var Uu=class Wp extends Qe{constructor(i){var r;super(f(P({},i),{type:"accent",body:(r=i.body)!=null?r:void 0})),i.accentChar?this.accent=i.accentChar:this.svgAccent=i==null?void 0:i.svgAccent,this.skipBoundary=!0,this.captureSelection=!0}static fromJson(i){return new Wp(i)}toJson(){return f(P({},super.toJson()),{accentChar:this.accent,svgAccent:this.svgAccent})}render(i){var r;const a=new sn({parent:i,mathstyle:"cramp"},this.style),c=(r=Qe.createBox(a,this.body))!=null?r:new Mt("\u25A2",{style:this.style});let p=0;!this.hasEmptyBranch("body")&&this.body.length===2&&this.body[1].isCharacterBox()&&(p=c.skew);let m=Math.min(c.height,da),b;if(this.svgAccent)b=Mu(this.svgAccent),m=a.metrics.bigOpSpacing1-m;else if(this.accent){const E=new Mt(this.accent,{fontFamily:"Main-Regular"});E.italic=0;const I=this.accent===8407?" ML__accent-vec":"";b=new Mt(new Mt(E),{classes:"ML__accent-body"+I})}b=new Er({shift:0,children:[{box:new Mt(c)},-m,{box:b,marginLeft:c.left+2*p,classes:["ML__center"]}]});const w=new Mt(b,{type:"lift"});return this.caret&&(w.caret=this.caret),this.bind(a,w.wrap(a)),this.attachSupsub(a,{base:w})}},zu={"(":")","{":"}","[":"]","|":"|","\\lbrace":"\\rbrace","\\lparen":"\\rparen","\\{":"\\}","\\langle":"\\rangle","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\vert":"\\vert","\\lvert":"\\rvert","\\Vert":"\\Vert","\\lVert":"\\rVert","\\lbrack":"\\rbrack","\\ulcorner":"\\urcorner","\\llcorner":"\\lrcorner","\\lgroup":"\\rgroup","\\lmoustache":"\\rmoustache"},po=Object.fromEntries(Object.entries(zu).map(([e,i])=>[i,e]));function Vu(e){var i;return(i={"[":91,"]":93,"(":40,")":41,"\\mid":8739,"|":8739,"\u2223":8739,"\u2225":8741,"\\|":8739,"\\{":123,"\\}":125,"\\lbrace":123,"\\rbrace":125,"\\lparen":40,"\\rparen":41,"\\lbrack":91,"\\rbrack":93,"\\vert":8739,"\\lvert":8739,"\\mvert":8739,"\\rvert":8739,"\\Vert":8741,"\\lVert":8741,"\\mVert":8741,"\\rVert":8741,"\\parallel":8741,"\\shortparallel":8741,"\\langle":10216,"\\rangle":10217,"\\lfloor":8970,"\\rfloor":8971,"\\lceil":8968,"\\rceil":8969,"\\ulcorner":9484,"\\urcorner":9488,"\\llcorner":9492,"\\lrcorner":9496,"\\lgroup":10222,"\\rgroup":10223,"\\lmoustache":9136,"\\rmoustache":9137,"\\surd":8730}[e])!=null?i:e.codePointAt(0)}function Fd(e,i,r,a){var c;const m=new Mt(Vu(e),{fontFamily:"Main-Regular",isSelected:a.isSelected,classes:"ML__small-delim "+((c=a.classes)!=null?c:"")}).wrap(i);return r&&m.setTop((1-i.scalingFactor)*pr),m}function Jo(e,i,r,a,c){var p,m;const b=new sn({parent:a,mathstyle:"textstyle"},c==null?void 0:c.style),w=new Mt(Vu(e),{fontFamily:`Size${i}-Regular`,isSelected:c.isSelected,classes:((p=c.classes)!=null?p:"")+` ML__delim-size${i}`,type:(m=c.type)!=null?m:"ignore"}).wrap(b);return r&&w.setTop((1-b.scalingFactor)*pr),w}function mo(e,i,r,a,c){var p;let m,b,w,E;m=w=E=Vu(e),b=null;let I="Size1-Regular";e==="\\vert"||e==="\\lvert"||e==="\\rvert"||e==="\\mvert"||e==="\\mid"?w=m=E=8739:e==="\\Vert"||e==="\\lVert"||e==="\\rVert"||e==="\\mVert"||e==="\\|"?w=m=E=8741:e==="\\uparrow"?w=E=9168:e==="\\Uparrow"?w=E=8214:e==="\\downarrow"?m=w=9168:e==="\\Downarrow"?m=w=8214:e==="\\updownarrow"?(m=8593,w=9168,E=8595):e==="\\Updownarrow"?(m=8657,w=8214,E=8659):e==="["||e==="\\lbrack"?(m=9121,w=9122,E=9123,I="Size4-Regular"):e==="]"||e==="\\rbrack"?(m=9124,w=9125,E=9126,I="Size4-Regular"):e==="\\lfloor"||e==="\u230A"?(w=m=9122,E=9123,I="Size4-Regular"):e==="\\lceil"||e==="\u2308"?(m=9121,w=E=9122,I="Size4-Regular"):e==="\\rfloor"||e==="\u230B"?(w=m=9125,E=9126,I="Size4-Regular"):e==="\\rceil"||e==="\u2309"?(m=9124,w=E=9125,I="Size4-Regular"):e==="("||e==="\\lparen"?(m=9115,w=9116,E=9117,I="Size4-Regular"):e===")"||e==="\\rparen"?(m=9118,w=9119,E=9120,I="Size4-Regular"):e==="\\{"||e==="\\lbrace"?(m=9127,b=9128,E=9129,w=9130,I="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(m=9131,b=9132,E=9133,w=9130,I="Size4-Regular"):e==="\\lgroup"||e==="\u27EE"?(m=9127,E=9129,w=9130,I="Size4-Regular"):e==="\\rgroup"||e==="\u27EF"?(m=9131,E=9133,w=9130,I="Size4-Regular"):e==="\\lmoustache"||e==="\u23B0"?(m=9127,E=9133,w=9130,I="Size4-Regular"):e==="\\rmoustache"||e==="\u23B1"?(m=9131,E=9129,w=9130,I="Size4-Regular"):e==="\\surd"?(m=57345,E=9143,w=57344,I="Size4-Regular"):e==="\\ulcorner"?(m=9484,w=E=32):e==="\\urcorner"?(m=9488,w=E=32):e==="\\llcorner"?(E=9492,w=m=32):e==="\\lrcorner"&&(m=9496,w=m=32);const N=so(m,I),Z=N.height+N.depth,ue=so(w,I),me=ue.height+ue.depth,Ge=so(E,I),Lt=Ge.height+Ge.depth;let Ue=0,ct=1;if(b!==null){const $r=so(b,I);Ue=$r.height+$r.depth,ct=2}const Rt=Z+Lt+Ue,yt=Math.max(0,Math.ceil((i-Rt)/(ct*me))),Jt=Rt+yt*ct*me;let hi=pr;r&&(hi=hi*a.scalingFactor);const ri=Jt/2-hi,cn=.008,Bn=[];Bn.push({box:new Mt(E,{fontFamily:I})}),Bn.push(-cn);const $t=new Mt(w,{fontFamily:I});if(b===null)for(let $r=0;$r<yt;$r++)Bn.push({box:$t});else{for(let $r=0;$r<yt;$r++)Bn.push({box:$t});Bn.push(-cn),Bn.push({box:new Mt(b,{fontFamily:I})}),Bn.push(-cn);for(let $r=0;$r<yt;$r++)Bn.push({box:$t})}Bn.push(-cn),Bn.push({box:new Mt(m,{fontFamily:I})});let zs="";I==="Size1-Regular"?zs=" delim-size1":I==="Size4-Regular"&&(zs=" delim-size4");const Ga=new Er({bottom:ri,children:Bn},{classes:zs});return new Mt(Ga,f(P({},c!=null?c:{}),{classes:((p=c==null?void 0:c.classes)!=null?p:"")+" ML__delim-mult"}))}var Il=new Set(["(",")","\\lparen","\\rparen","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd","\u230A","\u230B","\u2308","\u2309"]),Bd=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\mvert","\\mid","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","\u27EE","\u27EF","\u23B0","\u23B1"]),bf=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Qc=[0,1.2,1.8,2.4,3];function xf(e,i,r,a){return e===void 0||e==="."?go(r,a.classes):(e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle"),Il.has(e)||bf.has(e)?Jo(e,i,!1,r,a):Bd.has(e)?mo(e,Qc[i],!1,r,a):(console.assert(!1,"Unknown delimiter '"+e+"'"),null))}var eh=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Nd=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"stack"}],Qo=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];function $d(e){return e.type==="small"?"Main-Regular":e.type==="large"?"Size"+e.size+"-Regular":(console.assert(e.type==="stack"),"Size4-Regular")}function wf(e,i,r,a){const c={"-4":0,"-3":1,0:2}[a.mathstyle.sizeDelta];for(let p=c;p<r.length&&r[p].type!=="stack";p++){const m=so(e,$d(r[p]));if(m.defaultMetrics)return{type:"small",mathstyle:"scriptstyle"};let b=m.height+m.depth;if(r[p].type==="small"&&(r[p].mathstyle==="scriptscriptstyle"?b*=Math.max($c[Math.max(1,a.size-2)],a.minFontScale):r[p].mathstyle==="scriptstyle"&&(b*=Math.max($c[Math.max(1,a.size-1)],a.minFontScale))),b>i)return r[p]}return r[r.length-1]}function Gu(e,i,r,a,c,p){if(!i||i.length===0||i===".")return go(c);i==="<"||i==="\\lt"?i="\\langle":(i===">"||i==="\\gt")&&(i="\\rangle");let m;bf.has(i)?m=eh:Il.has(i)?m=Qo:m=Nd;const b=wf(Vu(i),r,m,c),w=new sn({parent:c,mathstyle:b.mathstyle},p==null?void 0:p.style);return b.type==="small"?Fd(i,w,a,f(P({},p),{type:e})):b.type==="large"?Jo(i,b.size,a,w,f(P({},p),{type:e})):(console.assert(b.type==="stack"),mo(i,r,a,w,f(P({},p),{type:e})))}function as(e,i,r,a,c,p){if(i===".")return go(c,p==null?void 0:p.classes);const m=pr*c.scalingFactor,b=901,w=5/fa,E=Math.max(r-m,a+m),I=Math.max(E/500*b,2*E-w);return Gu(e,i,I,!0,c,p)}function go(e,i){const r=new Mt(null,{classes:" nulldelimiter "+(i!=null?i:""),type:"ignore"});return r.width=e.getRegisterAsEm("nulldelimiterspace"),r.wrap(new sn({parent:e,mathstyle:"textstyle"}))}var ea=class jp extends Qe{constructor(i){var r;super({type:"placeholder",command:"\\placeholder",mode:(r=i==null?void 0:i.mode)!=null?r:"math",style:i==null?void 0:i.style}),this.captureSelection=!0}static fromJson(i){return new jp(i)}toJson(){return super.toJson()}render(i){let r;return this.value=i.placeholderSymbol,typeof i.renderPlaceholder=="function"?r=i.renderPlaceholder(i):r=this.createBox(i),this.caret&&(r.classes+=" ML__placeholder-selected"),r}_serialize(i){return i.skipPlaceholders?"":"\\placeholder{}"}},Rl=["matrix","matrix*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*"],Sf=["cases","dcases","rcases"],th=["align","align*","aligned","gather","gathered","split"],Kd=["array","subequations","eqnarray"];function Ud(e){return Kd.concat(th).concat(Sf).concat(Rl).includes(e)}function Ef(e){return Rl.includes(e)}function kf(e){return Sf.includes(e)}function Us(e){return th.includes(e)}function ga(e,i,r){let a=0;for(const E of r)"align"in E&&(a+=1);let c=0;const p=[];for(const E of i){let I=0;for(c=Math.max(c,Math.min(E.length,a));I<E.length;){const N=[],Z=Math.min(E.length,I+a);for(;I<Z;){const ue=E[I];ue.length===0?N.push([new Qe({type:"first",mode:e.mode})]):ue[0].type!=="first"?N.push([new Qe({type:"first",mode:e.mode}),...ue]):(console.assert(!ue.slice(1).some(me=>me.type==="first")),N.push(ue)),I+=1}p.push(N)}}p.length>0&&p[p.length-1].length===1&&p[p.length-1][0].length===1&&p[p.length-1][0][0].type==="first"&&p.pop();const m=[];for(const E of p){if(E.length!==c)for(let I=E.length;I<c;I++)E.push([new Qe({type:"first",mode:e.mode}),new ea]);m.push(E)}let b=0,w=0;for(const E of m){w=0;for(const I of E){for(const N of I)N.parent=e,N.parentBranch=[b,w];w+=1}b+=1}return e.isDirty=!0,m}var kn=class qp extends Qe{constructor(i,r,a,c={}){var p;super({type:"array"}),this.environmentName=i,this.rowGaps=a,c.mathstyleName&&(this.mathstyleName=c.mathstyleName),c.columns&&(c.columns.length===0?this.colFormat=[{align:"l"}]:this.colFormat=c.columns),this.colFormat||(this.colFormat=[{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"}]),this.array=ga(this,r,this.colFormat),c.leftDelim&&(this.leftDelim=c.leftDelim),c.rightDelim&&(this.rightDelim=c.rightDelim),c.arraycolsep!==void 0&&(this.arraycolsep=c.arraycolsep),this.colSeparationType=c.colSeparationType,c.arraystretch!==void 0&&(this.arraystretch=c.arraystretch),this.minColumns=(p=c.minColumns)!=null?p:1}static fromJson(i){return new qp(i.environmentName,i.array,i.rowGaps,i)}toJson(){const i=f(P({},super.toJson()),{environmentName:this.environmentName,array:this.array.map(r=>r.map(a=>a.map(c=>c.toJson()))),rowGaps:this.rowGaps,columns:this.colFormat,colSeparationType:this.colSeparationType});return this.arraystretch!==void 0&&(i.arraystretch=this.arraystretch),this.arraycolsep!==void 0&&(i.arraycolsep=this.arraycolsep),this.leftDelim&&(i.leftDelim=this.leftDelim),this.rightDelim&&(i.rightDelim=this.rightDelim),i}branch(i){var r;if(Al(i))return(r=this.array[i[0]][i[1]])!=null?r:void 0}createBranch(i){var r;return Al(i)?(this.isDirty=!0,(r=this.branch(i))!=null?r:[]):[]}get rowCount(){return this.array.length}get colCount(){return this.array[0].length}get maxColumns(){return this.colFormat.filter(i=>!!i.align).length}removeBranch(i){if(lo(i))return super.removeBranch(i);const r=this.branch(i);return this.array[i[0]][i[1]]=void 0,r.forEach(a=>{a.parent=void 0,a.parentBranch=void 0}),console.assert(r[0].type==="first"),r.shift(),this.isDirty=!0,r}get hasChildren(){return this.children.length>0}get children(){const i=[];for(const r of this.array)for(const a of r)if(a)for(const c of a)i.push(...c.children),i.push(c);return[...i,...super.children]}render(i){var r,a,c,p,m,b;const w=new sn({parent:i,mathstyle:this.mathstyleName},this.style),E=w.getRegisterAsEm("arrayrulewidth"),I=w.getRegisterAsEm("arraycolsep"),N=w.getRegisterAsEm("doublerulesep"),Z=(a=(r=this.arraystretch)!=null?r:w.getRegisterAsNumber("arraystretch"))!=null?a:1;let ue=typeof this.arraycolsep=="number"?this.arraycolsep:I;this.colSeparationType==="small"&&(ue=.2778*(new sn({parent:i,mathstyle:"scriptstyle"}).scalingFactor/i.scalingFactor));const me=Z*gd,Ge=.7*me,Lt=.3*me;let Ue=0;const ct=[];let Rt=0;const yt=this.array.length;for(let Kn=0;Kn<yt;++Kn){const yr=this.array[Kn];Rt=Math.max(Rt,yr.length);const Kr=new sn({parent:w,mathstyle:this.mathstyleName},this.style);let Ha=Ge/Kr.scalingFactor,Wa=Lt/Kr.scalingFactor;const ja={cells:[],height:0,depth:0,pos:0};for(const xa of yr){const V0=(c=Qe.createBox(Kr,xa,{type:"ignore"}))!=null?c:new Mt(null,{type:"ignore"});Wa=Math.max(Wa,V0.depth),Ha=Math.max(Ha,V0.height),ja.cells.push(V0)}let qa=(p=cf(this.rowGaps[Kn]))!=null?p:0;qa>0&&(qa+=Lt,Wa=Math.max(Wa,qa),qa=0),Kn<yt-1&&!Ef(this.environmentName)&&this.environmentName!=="cases"&&this.environmentName!=="array"&&(Wa+=w.getRegisterAsEm("jot")),ja.height=Ha,ja.depth=Wa,Ue+=Ha,ja.pos=Ue,Ue+=Wa+qa,ct.push(ja)}const Jt=Ue/2+pr,hi=[];for(let Kn=0;Kn<Rt;Kn++){const yr=[];for(const Kr of ct){const Ha=Kr.cells[Kn];Ha.depth=Kr.depth,Ha.height=Kr.height,yr.push({box:Ha,shift:Kr.pos-Jt})}yr.length>0&&hi.push(new Er({individualShift:yr}))}const ri=[];let cn=!1,Bn=!1,$t=0,zs=!this.leftDelim;const{colFormat:Ga}=this;for(const Kn of Ga){if("align"in Kn&&$t>=hi.length)break;if("align"in Kn)cn?ri.push(Wu(2*ue)):(Bn||zs)&&ri.push(Wu(ue)),ri.push(new Mt(hi[$t],{classes:"col-align-"+Kn.align})),$t++,cn=!0,Bn=!1,zs=!1;else if("gap"in Kn){if(typeof Kn.gap=="number")ri.push(Wu(Kn.gap));else{const yr=zd(i,ct,Jt,Kn.gap);yr&&ri.push(yr)}cn=!1,Bn=!1,zs=!1}else if("separator"in Kn){const yr=new Mt(null,{classes:"vertical-separator"});yr.height=Ue,yr.setStyle("height",Ue,"em"),yr.setStyle("border-right",`${E}em ${Kn.separator} currentColor`),yr.setStyle("vertical-align",-(Ue-Jt),"em");let Kr=0;Bn?Kr=N-E:cn&&(Kr=ue-E),yr.left=Kr,ri.push(yr),cn=!1,Bn=!0,zs=!1}}cn&&!this.rightDelim&&ri.push(Wu(ue));const ra=new Mt(ri,{classes:"mtable"});if((!this.leftDelim||this.leftDelim===".")&&(!this.rightDelim||this.rightDelim==="."))return this.caret&&(ra.caret=this.caret),this.bind(i,ra);const $r=ra.height,Vs=ra.depth,Ts=this.bind(i,new Mt([this.bind(i,as("open",(m=this.leftDelim)!=null?m:".",$r,Vs,w,{isSelected:this.isSelected})),ra,this.bind(i,as("close",(b=this.rightDelim)!=null?b:".",$r,Vs,w,{isSelected:this.isSelected}))],{type:"ord"}));return Ts?(Ts.setStyle("display","inline-block"),this.caret&&(Ts.caret=this.caret),this.bind(i,this.attachSupsub(i,{base:Ts}))):null}_serialize(i){var r;const a=[];if(this.environmentName==="lines"?a.push("{\\displaylines"):a.push(`\\begin{${this.environmentName}}`),this.environmentName==="array"){if(a.push("{"),this.colFormat!==void 0)for(const c of this.colFormat)"align"in c&&typeof c.align=="string"?a.push(c.align):"separator"in c&&c.separator==="solid"?a.push("|"):"separator"in c&&c.separator==="dashed"&&a.push(":");a.push("}")}for(let c=0;c<this.array.length;c++){for(let p=0;p<this.array[c].length;p++)p>0&&a.push(" & "),a.push(Qe.serialize(this.array[c][p],i));if(c<this.array.length-1){const p=this.rowGaps[c];p!=null&&p.dimension?a.push(`\\\\[${p.dimension} ${(r=p.unit)!=null?r:"pt"}] `):a.push("\\\\ ")}}return this.environmentName==="lines"?a.push("}"):a.push(`\\end{${this.environmentName}}`),un(a)}getCell(i,r){return this.array[i][r]}setCell(i,r,a){console.assert(this.type==="array"&&Array.isArray(this.array)&&this.array[i][r]!==void 0);for(const p of this.array[i][r])p.parent=void 0,p.parentBranch=void 0;let c=a;(a.length===0||a[0].type!=="first")&&(c=[new Qe({type:"first",mode:this.mode}),...a]),this.array[i][r]=c;for(const p of c)p.parent=this,p.parentBranch=[i,r];this.isDirty=!0}addRowBefore(i){console.assert(this.type==="array"&&Array.isArray(this.array));const r=[];for(let a=0;a<this.colCount;a++)r.push(Hu(this));this.array.splice(i,0,r);for(let a=i;a<this.rowCount;a++)for(let c=0;c<this.colCount;c++){const p=this.array[a][c];if(p)for(const m of p)m.parentBranch=[a,c]}this.isDirty=!0}addRowAfter(i){console.assert(this.type==="array"&&Array.isArray(this.array));const r=[];for(let a=0;a<this.colCount;a++)r.push(Hu(this));this.array.splice(i+1,0,r);for(let a=i+1;a<this.rowCount;a++)for(let c=0;c<this.colCount;c++){const p=this.array[a][c];if(p)for(const m of p)m.parentBranch=[a,c]}this.isDirty=!0}removeRow(i){console.assert(this.type==="array"&&Array.isArray(this.array)&&this.rowCount>i);const r=this.array.splice(i,1);for(const a of r)for(const c of a)if(c)for(const p of c)p.parent=void 0,p.parentBranch=void 0;for(let a=i;a<this.rowCount;a++)for(let c=0;c<this.colCount;c++){const p=this.array[a][c];if(p)for(const m of p)m.parentBranch=[a,c]}this.isDirty=!0}addColumnBefore(i){console.assert(this.type==="array"&&Array.isArray(this.array));for(const r of this.array)r.splice(i,0,Hu(this));for(let r=0;r<this.rowCount;r++)for(let a=i;a<this.colCount;a++){const c=this.array[r][a];if(c)for(const p of c)p.parentBranch=[r,a]}this.isDirty=!0}addColumnAfter(i){console.assert(this.type==="array"&&Array.isArray(this.array));for(const r of this.array)r.splice(i+1,0,Hu(this));for(let r=0;r<this.rowCount;r++)for(let a=i+1;a<this.colCount;a++){const c=this.array[r][a];if(c)for(const p of c)p.parentBranch=[r,a]}this.isDirty=!0}addColumn(){this.addColumnAfter(this.colCount-1)}removeColumn(i){console.assert(this.type==="array"&&Array.isArray(this.array)&&this.colCount>i);for(const r of this.array){const a=r.splice(i,1);for(const c of a)if(c)for(const p of c)p.parent=void 0,p.parentBranch=void 0}for(let r=0;r<this.rowCount;r++)for(let a=i;a<this.colCount;a++){const c=this.array[r][a];if(c)for(const p of c)p.parentBranch=[r,a]}this.isDirty=!0}get cells(){const i=[];for(const r of this.array)for(const a of r)a&&i.push(a.filter(c=>c.type!=="first"));return i}};function Hu(e){const i=new Qe({type:"first",mode:e.mode});i.parent=e;const r=new ea;return r.parent=e,[i,r]}function Wu(e){const i=new Mt(null,{classes:"arraycolsep"});return i.width=e,i}function zd(e,i,r,a){if(!a)return null;const c=[];for(const p of i){const m=Qe.createBox(e,a,{type:"ignore"});m&&(m.depth=p.depth,m.height=p.height,c.push({box:m,shift:p.pos-r}))}return new Er({individualShift:c}).wrap(e)}var Oa=class Zp extends Qe{constructor(i){super({mode:i.mode,command:i.command,style:i.style,body:i.body,type:"box"}),this.framecolor=i.framecolor,this.backgroundcolor=i.backgroundcolor,this.padding=i.padding,this.offset=i.offset,this.border=i.border}static fromJson(i){return new Zp(i)}toJson(){return f(P({},super.toJson()),{framecolor:this.framecolor,backgroundcolor:this.backgroundcolor,padding:this.padding,offset:this.offset,border:this.border})}render(i){var r,a,c,p;const m=Qe.createBox(i,this.body,{type:"lift"});if(!m)return null;const b=i.toEm((r=this.offset)!=null?r:{dimension:0});m.depth+=b,m.setStyle("display","inline-block"),m.setStyle("position","relative"),m.setStyle("height",Math.floor(100*m.height+m.depth)/100,"em"),m.setStyle("vertical-align",-Math.floor(100*m.height)/100,"em");const w=new sn({parent:i},this.style),E=w.toEm((a=this.padding)!=null?a:{register:"fboxsep"}),I=new Mt(null,{classes:"ML__box"});I.height=m.height+E,I.depth=m.depth+E,I.setStyle("box-sizing","border-box"),I.setStyle("position","absolute"),I.setStyle("top",-E+.3,"em"),I.setStyle("left",0),I.setStyle("height",I.height+I.depth,"em"),I.setStyle("width","100%"),this.backgroundcolor&&I.setStyle("background-color",(c=w.toColor(this.backgroundcolor))!=null?c:"transparent"),this.framecolor&&I.setStyle("border",`${w.getRegisterAsEm("fboxrule",2)}em solid ${(p=w.toColor(this.framecolor))!=null?p:"black"}`),this.border&&I.setStyle("border",this.border);const N=new Mt([I,m],{type:"lift"});return N.setStyle("display","inline-block"),N.setStyle("position","relative"),N.setStyle("line-height",0),N.height=m.height+E+(b>0?b:0),N.depth=m.depth+E+(b<0?-b:0),N.setStyle("padding-left",E,"em"),N.setStyle("padding-right",E,"em"),N.setStyle("height",Math.floor(100*(m.height+m.depth+2*E+Math.abs(b)))/100,"em"),N.setStyle("margin-top",-E,"em"),N.setStyle("top",Math.floor(100*(m.depth-m.height+2*E-b))/100,"em"),N.setStyle("vertical-align",Math.floor(100*(m.depth+2*E))/100,"em"),this.caret&&(N.caret=this.caret),this.attachSupsub(i,{base:N})}_serialize(i){return i.skipStyles?un([this.bodyToLatex(i),this.supsubToLatex(i)]):super._serialize(i)}},Tf=class Yp extends Qe{constructor(i,r){var a;super({type:"composition",mode:(a=r==null?void 0:r.mode)!=null?a:"math",value:i})}static fromJson(i){return new Yp(i.value,i)}toJson(){return super.toJson()}get computedStyle(){return{}}render(i){const r=new Mt(this.value,{classes:"ML__composition",type:"composition"});return this.bind(i,r),this.caret&&(r.caret=this.caret),r}_serialize(i){return""}},Es=class Xp extends Qe{constructor(i){super({type:"error",value:i,command:i,mode:"math"}),this.verbatimLatex=i}static fromJson(i){return new Xp(i.command)}toJson(){return super.toJson()}render(i){const r=this.createBox(i,{classes:"ML__error"});return this.caret&&(r.caret=this.caret),r}},ih=class Jp extends Qe{constructor(i,r,a){super({type:"group",mode:r,style:a}),this.body=i,this.boxType=i.length>1?"ord":"ignore",this.skipBoundary=!0,this.displayContainsHighlight=!1,i&&i.length===1&&i[0].command===","&&(this.captureSelection=!0)}static fromJson(i){return new Jp(i.body,i.mode,i.style)}render(i){const r=Qe.createBox(i,this.body,{type:this.boxType});return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Ce(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):`{${this.bodyToLatex(i)}}`}},rr=class Qp extends Qe{constructor(i,r,a){super({type:"leftright",style:a.style,displayContainsHighlight:!0}),this.variant=i,this.body=r,this.leftDelim=a.leftDelim,this.rightDelim=a.rightDelim}static fromJson(i){var r;return new Qp((r=i.variant)!=null?r:"",i.body,i)}toJson(){const i=super.toJson();return this.variant&&(i.variant=this.variant),this.leftDelim&&(i.leftDelim=this.leftDelim),this.rightDelim&&(i.rightDelim=this.rightDelim),i}_serialize(i){var r,a;const c=this.matchingRightDelim();return this.variant==="left...right"?un(["\\left",(r=this.leftDelim)!=null?r:".",this.bodyToLatex(i),"\\right",c]):this.variant==="mleft...mright"?un(["\\mleft",(a=this.leftDelim)!=null?a:".",this.bodyToLatex(i),"\\mright",c]):un([!this.leftDelim||this.leftDelim==="."?"":this.leftDelim,this.bodyToLatex(i),c])}matchingRightDelim(){var i,r;if(this.rightDelim&&this.rightDelim!=="?")return this.rightDelim;const a=(i=this.leftDelim)!=null?i:".";return(r=zu[a])!=null?r:a}render(i){var r,a;const c=new sn({parent:i},this.style);console.assert(this.body!==void 0);const p=new sn({parent:i,mathstyle:"textstyle"},this.style),m=(r=Qe.createBox(c,this.body,{type:"inner"}))!=null?r:new Mt(null,{type:"inner"}),b=m.height/p.scalingFactor,w=m.depth/p.scalingFactor,E=[];if(this.leftDelim&&E.push(this.bind(p,as("open",this.leftDelim,b,w,p,{isSelected:this.isSelected,classes:"ML__open"+(this.containsCaret?" ML__contains-caret":""),mode:this.mode,style:this.style}))),m&&(Af(m.children,this,c,b,w),E.push(m)),this.rightDelim){let ue=this.containsCaret?" ML__contains-caret":"",me=this.rightDelim;me==="?"&&(c.smartFence?(me=this.matchingRightDelim(),ue+=" ML__smart-fence__close"):me="."),E.push(this.bind(p,as("close",me,b,w,p,{isSelected:this.isSelected,classes:ue+" ML__close",mode:this.mode,style:this.style})))}let I=this.variant==="mleft...mright";const N=this.leftSibling;N&&(!I&&N.isFunction&&(I=!0),!I&&N.type==="subsup"&&((a=N.leftSibling)!=null&&a.isFunction)&&(I=!0));const Z=new Mt(E,{type:I?"close":"inner",classes:"left-right"});return Z.setStyle("margin-top",`${-m.depth}em`),Z.setStyle("height",`${m.height+m.depth}em`),this.caret&&(Z.caret=this.caret),this.bind(c,Z.wrap(c))}};function Af(e,i,r,a,c){if(e)for(let p=0;p<e.length;p++){const m=e[p];m.type==="middle"?(e[p]=i.bind(r,as("inner",m.value,a,c,r,{isSelected:i.isSelected})),e[p].caret=m.caret,e[p].isSelected=m.isSelected,e[p].cssId=m.cssId,e[p].htmlData=m.htmlData,e[p].htmlStyle=m.htmlStyle,e[p].attributes=m.attributes,e[p].cssProperties=m.cssProperties):m.children&&Af(m.children,i,r,a,c)}}var ju=class em extends Qe{constructor(i,r){var a;super({type:"macro",command:i,style:r.style}),this.body=r.body,r.captureSelection===void 0?r.args?this.captureSelection=!1:this.captureSelection=!0:this.captureSelection=r.captureSelection,this.macroArgs=r.args,this.expand=(a=r.expand)!=null?a:!1}static fromJson(i){return new em(i.command,i)}toJson(){const i=super.toJson();return this.expand&&(i.expand=!0),this.captureSelection!==void 0&&(i.captureSelection=this.captureSelection),this.macroArgs&&(i.args=this.macroArgs),i}_serialize(i){var r;return i.expandMacro&&this.expand?this.bodyToLatex(i):this.command+((r=this.macroArgs)!=null?r:"")}render(i){const r=Qe.createBox(i,this.body);return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}},Lf=class tm extends Qe{constructor(){super({type:"macro-argument"})}static fromJson(i){return new tm}toJson(){return super.toJson()}_serialize(i){return""}render(i){return null}},nh=class im extends Qe{constructor(i,r,a=!1,c,p){var m;super({type:"prompt",mode:(m=p==null?void 0:p.mode)!=null?m:"math",style:p==null?void 0:p.style,command:"\\placeholder"}),this.body=c,this.correctness=r,this.placeholderId=i,this.locked=a,this.captureSelection=this.locked}static fromJson(i){return new im(i.placeholderId,i.correctness,i.locked,i.body,i)}toJson(){const i=super.toJson();return this.placeholderId&&(i.placeholderId=this.placeholderId),this.body||delete i.body,this.body&&(i.body=this.body.filter(r=>r.type!=="first").map(r=>r.toJson())),this.correctness&&(i.correctness=this.correctness),i.locked=this.locked,i}render(i){const r=new sn({parent:i}),a=r.getRegisterAsEm("fboxsep"),c=a,p=a,m=Qe.createBox(i,this.body);if(!m)return null;m.height||(m.height=r.metrics.xHeight),m.setStyle("vertical-align",-m.height,"em"),this.correctness==="correct"?m.setStyle("color","var(--correct-color, var(--ML__correct-color))"):this.correctness==="incorrect"&&m.setStyle("color","var(--incorrect-color, var(--ML__incorrect-color))");const b=new Mt(m,{type:"ord"});b.setStyle("display","inline-block"),b.setStyle("height",m.height+m.depth,"em"),b.setStyle("vertical-align",-p,"em");let w="ML__prompt ";this.locked?w+=" ML__lockedPromptBox ":w+=" ML__editablePromptBox ",this.correctness==="correct"?w+=" ML__correctPromptBox ":this.correctness==="incorrect"&&(w+=" ML__incorrectPromptBox "),this.containsCaret&&(w+=" ML__focusedPromptBox ");const E=new Mt(null,{classes:w,attributes:{part:"prompt"}});E.height=b.height+p,E.depth=b.depth+p,E.width=b.width+2*c,E.setStyle("box-sizing","border-box"),E.setStyle("position","absolute"),E.setStyle("height",b.height+b.depth+2*p,"em"),c===0&&E.setStyle("width","100%"),c!==0&&(E.setStyle("width",`calc(100% + ${2*c}em)`),E.setStyle("top",a,"em"),E.setStyle("left",-c,"em")),(!this.body||this.body.length===1)&&(E.width=3*c,E.setStyle("width",`calc(100% + ${3*c}em)`),E.setStyle("left",-1.5*c,"em"));let I="";this.correctness==="incorrect"&&(I+='<line x1="3%" y1="97%" x2="97%" y2="3%" stroke-width="0.5" stroke="var(--incorrect-color, var(--ML__incorrect-color))" stroke-linecap="round" />'),I&&(E.svgOverlay=I);const N=new Mt([E,b],{classes:"ML__prompt-atom"});return N.setStyle("position","relative"),N.setStyle("display","inline-block"),N.setStyle("line-height",0),N.height=b.height+p+.2,N.depth=b.depth+p,N.left=c,N.right=c,N.setStyle("height",b.height+p,"em"),N.setStyle("top",b.depth-b.height,"em"),N.setStyle("vertical-align",b.depth+p,"em"),N.setStyle("margin-left",.5,"em"),N.setStyle("margin-right",.5,"em"),this.caret&&(N.caret=this.caret),this.bind(r,this.attachSupsub(i,{base:N}))}_serialize(i){var r;const a=(r=this.bodyToLatex(i))!=null?r:"";if(i.skipPlaceholders)return a;let c="\\placeholder";return this.placeholderId&&(c+=`[${this.placeholderId}]`),this.correctness==="correct"?c+="[correct]":this.correctness==="incorrect"&&(c+="[incorrect]"),this.locked&&(c+="[locked]"),Zn(c,a)}},_o=class nm extends Qe{constructor(i){super({type:"subsup",style:i==null?void 0:i.style}),this.subsupPlacement="auto"}static fromJson(i){const r=new nm(i);for(const a of Zo)i[a]&&r.setChildren(i[a],a);return r}render(i){var r;const a=new sn({parent:i,isPhantom:!0}),c=this.leftSibling,p=(r=c.render(a))!=null?r:new Mt(null),m=new Mt(null);return m.height=p.height,m.depth=p.depth,this.attachSupsub(i,{base:m,isCharacterBox:c.isCharacterBox(),type:"ignore"})}_serialize(i){return this.supsubToLatex(i)}};function el(e){return e?!/^(<$$>|<$>|<space>|<{>|<}>|#[0-9\?]|\\.+)$/.test(e):!1}var Df=class{constructor(e,i,r){this.errors=[],this.index=0,this.endCount=0;var a,c,p,m;r!=null||(r={}),this.tokens=e,this.context=i instanceof sn&&!(r!=null&&r.parseMode)&&!r.mathstyle?i:new sn({from:i,mathstyle:r.mathstyle},r.style),this.args=(a=r.args)!=null?a:void 0,this.smartFence=this.context.smartFence,this.parsingContext={parent:void 0,mathlist:[],style:(c=r.style)!=null?c:{},parseMode:(p=r.parseMode)!=null?p:"math",mathstyle:(m=r.mathstyle)!=null?m:"displaystyle",tabular:!1}}beginContext(e){var i,r,a;const c=this.parsingContext,p={parent:c,mathlist:[],style:P({},c.style),parseMode:(i=e==null?void 0:e.mode)!=null?i:c.parseMode,mathstyle:(r=e==null?void 0:e.mathstyle)!=null?r:c.mathstyle,tabular:(a=e==null?void 0:e.tabular)!=null?a:!1};this.parsingContext=p}endContext(){this.parsingContext=this.parsingContext.parent}onError(e){this.errors.push(P({before:Ma(this.tokens.slice(this.index,this.index+10)),after:Ma(this.tokens.slice(Math.max(0,this.index-10),this.index))},e))}get mathlist(){return this.parsingContext.mathlist}set mathlist(e){this.parsingContext.mathlist=e}get parseMode(){return this.parsingContext.parseMode}set parseMode(e){this.parsingContext.parseMode=e}get tabularMode(){return this.parsingContext.tabular}get style(){let e=this.parsingContext;for(;e;){if(e.style)return P({},e.style);e=e.parent}return{}}set style(e){this.parsingContext.style=e}end(){return this.endCount++,this.index>=this.tokens.length||this.endCount>1e3}next(){this.index+=1}get(){return this.endCount=0,this.index<this.tokens.length?this.tokens[this.index++]:""}peek(){return this.tokens[this.index]}match(e){return this.tokens[this.index]===e?(this.index++,!0):!1}lastSubsupAtom(){let e;return this.mathlist.length>0&&(e=this.mathlist[this.mathlist.length-1],e.type==="subsup"||e.subsupPlacement!==void 0)||(e=new _o({style:this.style}),this.mathlist.push(e)),e}hasPattern(e){return e.test(this.tokens[this.index])}hasInfixCommand(){var e;const{index:i}=this;if(i<this.tokens.length&&this.tokens[i].startsWith("\\")){const r=Ce(this.tokens[i],this.parseMode);return!r||r.definitionType==="symbol"||r.ifMode&&!r.ifMode.includes(this.parseMode)?!1:(e=r.infix)!=null?e:!1}return!1}matchColumnSeparator(){return!this.tabularMode||this.peek()!=="&"?!1:(this.index++,!0)}matchRowSeparator(){if(!this.tabularMode)return!1;const e=this.peek();return e!=="\\\\"&&e!=="\\cr"&&e!=="\\tabularnewline"?!1:(this.index++,!0)}placeholder(){var e;const i=(e=this.args)==null?void 0:e.call(this,"?");return i?Br(i,{parseMode:this.parseMode,mathstyle:"textstyle"}):[new ea({mode:this.parseMode,style:this.style})]}skipWhitespace(){for(;this.match("<space>"););}skipUntilToken(e){let i=this.tokens[this.index];for(;i&&i!==e;)i=this.tokens[++this.index];i===e&&this.index++}skipFiller(){for(;this.match("\\relax")||this.match("<space>"););}matchKeyword(e){const i=this.index;let r=this.end(),a="";for(;!r;){const p=this.get();el(p)?(a+=p,r=this.end()||a.length>=e.length):r=!0}const c=e.toUpperCase()===a.toUpperCase();return c||(this.index=i),c}scanString(){let e="";for(;!this.end();){const i=this.peek();if(i==="]")return e;if(i==="<space>")e+=" ";else if(i.startsWith("\\"))this.onError({code:"unexpected-command-in-string"}),e+=i.substring(1);else if(el(i))e+=i;else return e;this.next()}return e}scanBalancedString(){let e="",i=this.end(),r=1;for(;!i;){const a=this.get();a==="<space>"?e+=" ":a==="<{>"?(e+="{",r+=1):a==="<}>"?(r-=1,r>0?e+="}":this.index-=1):a==="<$>"?e+="$":a==="<$$>"?e+="$$":e+=a,i=r===0||this.end()}return e}scanLiteralGroup(){var e;if(!this.match("<{>"))return"";let i="",r=1;for(;r>0&&!this.end();){const a=this.get();a==="<}>"?(r-=1,r>0&&(i+="}")):a==="<{>"?(r+=1,i+="{"):(/\\[a-zA-Z]+$/.test(i)&&/^[a-zA-Z]/.test(a)&&(i+=" "),i+=(e={"<space>":" ","<$$>":"$$","<$>":"$"}[a])!=null?e:a)}return i}scanNumber(e=!0){var i,r;let a=!1,c=this.peek();for(;c==="<space>"||c==="+"||c==="-";)this.get(),c==="-"&&(a=!a),c=this.peek();e=!!e;let p=10,m=/\d/;if(this.match("'"))p=8,m=/[0-7]/,e=!0;else if(this.match('"'))p=16,m=/[\dA-F]/,e=!0;else if(this.match("x"))p=16,m=/[\dA-Fa-f]/,e=!0;else if(this.match("`"))return c=this.get(),c?c.length===2&&c.startsWith("\\")?{number:(a?-1:1)*((i=c.codePointAt(1))!=null?i:0),base:"alpha"}:{number:(a?-1:1)*((r=c.codePointAt(0))!=null?r:0),base:"alpha"}:null;let b="";for(;this.hasPattern(m);)b+=this.get();if(!e&&(this.match(".")||this.match(",")))for(b+=".";this.hasPattern(m);)b+=this.get();const w=e?Number.parseInt(b,p):Number.parseFloat(b);return Number.isNaN(w)?null:{number:a?-w:w,base:p===16?"hexadecimal":p===8?"octal":"decimal"}}scanRegister(){var e;const i=this.index,r=this.scanNumber(!1);if(this.skipWhitespace(),this.match("\\relax"))return r;let a=!1;if(r===null)for(;;){const p=this.peek();if(p==="-")a=!a;else if(p!=="+")break;this.next(),this.skipWhitespace()}if(this.match("\\global")){this.skipWhitespace();const p=this.get();return p.startsWith("\\")?r?{register:p,global:!0,factor:(a?-1:1)*r.number}:a?{register:p,global:!0,factor:-1}:{register:p,global:!0}:(this.index=i,null)}let c=this.get();return c!=null&&c.startsWith("\\")?(c=c.substring(1),this.context.registers[c]?!a||r!==null?{register:c,factor:(a?-1:1)*((e=r==null?void 0:r.number)!=null?e:1)}:{register:c}:(this.index=i,null)):(this.index=i,null)}scanValue(){const e=this.scanRegister();if(e)return e;const i=this.index,r=this.scanGlueOrDimen();if(r&&("unit"in r||"glue"in r&&"unit"in r.glue))return r;this.index=i;const a=this.scanNumber();if(a)return a;if(this.end()||!el(this.peek()))return null;const c=this.scanString();return c.length>0?{string:c}:null}scanDimen(){const e=this.scanNumber(!1);if(e===null)return null;const i=e.number;this.skipWhitespace(),this.matchKeyword("true"),this.skipWhitespace();let r;return this.matchKeyword("pt")?r="pt":this.matchKeyword("mm")?r="mm":this.matchKeyword("cm")?r="cm":this.matchKeyword("ex")?r="ex":this.matchKeyword("px")?r="px":this.matchKeyword("em")?r="em":this.matchKeyword("bp")?r="bp":this.matchKeyword("dd")?r="dd":this.matchKeyword("pc")?r="pc":this.matchKeyword("in")?r="in":this.matchKeyword("mu")&&(r="mu"),r?{dimension:i,unit:r}:{dimension:i}}scanGlueOrDimen(){const e=this.scanDimen();if(e===null)return null;if(this.skipWhitespace(),this.match("\\relax"))return e;const i={glue:e};if(this.matchKeyword("plus")){const r=this.scanDimen();if(r)i.grow=r;else return i}if(this.skipWhitespace(),this.match("\\relax"))return i;if(this.skipWhitespace(),this.matchKeyword("minus")){const r=this.scanDimen();if(r)i.shrink=r;else return i}return!i.grow&&!i.shrink?e:i}scanColspec(){this.skipWhitespace();const e=[];for(;!this.end()&&!(this.peek()==="<}>"||this.peek()==="]");){const i=this.get();i==="c"||i==="r"||i==="l"?e.push({align:i}):i==="|"?e.push({separator:"solid"}):i===":"?e.push({separator:"dashed"}):i==="@"&&(this.match("<{>")&&(this.beginContext({mode:"math"}),e.push({gap:this.scan(r=>r==="<}>")}),this.endContext()),this.match("<}>")||this.onError({code:"unbalanced-braces"}))}return e}scanModeSet(){let e;if(this.match("\\(")&&(e="textstyle"),!e&&this.match("\\[")&&(e="displaystyle"),!e)return null;this.beginContext({mode:"math",mathstyle:e});const i=this.scan(r=>r===(e==="displaystyle"?"\\]":"\\)"));return this.match(e==="displaystyle"?"\\]":"\\)")||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanModeShift(){let e="";if(this.match("<$>")&&(e="<$>"),!e&&this.match("<$$>")&&(e="<$$>"),!e)return null;this.beginContext({mode:"math",mathstyle:"textstyle"});const i=this.scan(r=>r===e);return this.match(e)||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanEnvironment(){if(!this.match("\\begin"))return null;const e=this.scanArgument("string");if(!e)return null;const i=xe(e);if(!i)return this.onError({code:"unknown-environment",arg:e}),null;const r=[];if(i.params)for(const b of i.params)if(b.isOptional)r.push(this.scanOptionalArgument(b.type));else{const w=this.scanArgument(b.type);w||this.onError({code:"missing-argument",arg:e}),r.push(w)}this.beginContext({tabular:i.tabular});const a=[],c=[];let p=[],m=!1;do if(this.end()&&(this.onError({code:"unbalanced-environment",arg:e}),m=!0),!m&&this.match("\\end")&&(this.scanArgument("string")!==e&&this.onError({code:"unbalanced-environment",arg:e}),m=!0),!m)if(this.matchColumnSeparator())p.push(this.mathlist),this.mathlist=[];else if(this.matchRowSeparator()){p.push(this.mathlist),this.mathlist=[];let b=null;this.skipWhitespace(),this.match("[")&&(b=this.scanDimen(),this.skipWhitespace(),this.match("]")),c.push(b!=null?b:{dimension:0}),a.push(p),p=[]}else this.mathlist.push(...this.scan(b=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline"].includes(b)));while(!m);return p.push(this.mathlist),p.length>0&&a.push(p),this.endContext(),i.createAtom(e,a,c,r)}scanExpression(){const e=this.mathlist;if(this.mathlist=[],this.parseExpression()){const i=this.mathlist;return this.mathlist=e,i}return this.mathlist=e,null}scan(e){this.beginContext(),e||(e=m=>m==="<}>");let i="",r=null,a=[],c=null;for(;!this.end()&&!e(this.peek());)this.hasInfixCommand()&&!i?(i=this.get(),r=Ce(i,"math"),r&&(a=this.scanArguments(r)[1]),c=this.mathlist,this.mathlist=[]):this.parseExpression();let p;return i?(console.assert(!!r),a.unshift(this.mathlist),c&&a.unshift(c),p=[r.createAtom({command:i,args:a,style:this.style,mode:this.parseMode})]):p=this.mathlist,this.endContext(),p}scanGroup(){const e=this.index;if(!this.match("<{>"))return null;const i=this.scan(a=>a==="<}>");this.match("<}>")||this.onError({code:"unbalanced-braces"});const r=new ih(i,this.parseMode,this.style);return r.verbatimLatex=Ma(this.tokens.slice(e,this.index)),r}scanSmartFence(){if(this.skipWhitespace(),!this.match("("))return null;this.beginContext();let e=1;for(;!this.end()&&e!==0;)this.match("(")&&(e+=1),this.match(")")&&(e-=1),e!==0&&this.parseExpression();const i=new rr("",this.mathlist,{leftDelim:"(",rightDelim:e===0?")":"?"});return this.endContext(),i}scanDelim(){this.skipWhitespace();const e=this.peek();if(!e)return this.onError({code:"unexpected-end-of-string"}),null;if(!el(e)&&!e.startsWith("\\"))return null;this.next();const i=Ce(e,"math");return i?i.definitionType==="function"&&i.ifMode&&!i.ifMode.includes(this.parseMode)?(this.onError({code:"unexpected-delimiter",arg:e}),null):i.definitionType==="symbol"&&(i.type==="mopen"||i.type==="mclose")||/^(\.|\?|\||<|>|\\vert|\\Vert|\\\||\\surd|\\uparrow|\\downarrow|\\Uparrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\mid|\\mvert|\\mVert)$/.test(e)?e:(this.onError({code:"unexpected-delimiter",arg:e}),null):(this.onError({code:"unknown-command",arg:e}),null)}scanLeftRight(){var e;if(this.match("\\right"))return this.onError({code:"unbalanced-braces"}),new Es("\\right");if(this.match("\\mright"))return this.onError({code:"unbalanced-braces"}),new Es("\\mright");let i="\\right";if(!this.match("\\left")){if(!this.match("\\mleft"))return null;i="\\mright"}const r=this.scanDelim();if(!r)return this.onError({code:"unexpected-delimiter"}),new Es(i==="\\right"?"\\left":"\\mleft");for(this.beginContext();!this.end()&&!this.match(i);)this.parseExpression();const a=this.mathlist;this.endContext();const c=(e=this.scanDelim())!=null?e:".";return new rr(i==="\\right"?"left...right":"mleft...mright",a,{leftDelim:r,rightDelim:c,style:this.style})}parseSupSub(){if(this.parseMode!=="math")return!1;let e=this.peek();if(e!=="^"&&e!=="_"&&e!=="'")return!1;const i=this.lastSubsupAtom();for(;e==="^"||e==="_"||e==="'";)this.match("'")?this.match("'")?i.addChild(new Qe({type:"mord",command:"\\doubleprime",mode:"math",value:"\u2032\u2032"}),"superscript"):i.addChild(new Qe({type:"mord",command:"\\prime",mode:"math",value:"\u2032"}),"superscript"):(this.match("^")||this.match("_"))&&i.addChildren(Me(this.scanArgument("expression")),e==="_"?"subscript":"superscript"),e=this.peek();return!0}parseLimits(){if(this.parseMode!=="math")return!1;const e=this.match("\\limits"),i=!e&&this.match("\\nolimits"),r=!i&&!e&&this.match("\\displaylimits");if(!e&&!i&&!r)return!1;const a=this.mathlist.length>0?this.mathlist[this.mathlist.length-1]:null;return a===null?!1:(a.explicitSubsupPlacement=!0,e&&(a.subsupPlacement="over-under"),i&&(a.subsupPlacement="adjacent"),r&&(a.subsupPlacement="auto"),!0)}scanArguments(e){if(!(e!=null&&e.params))return[void 0,[]];let i;const r=[];let a=e.infix?2:0;for(;a<e.params.length;){const c=e.params[a];c.type==="rest"?r.push(this.scan(p=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(p))):c.isOptional?r.push(this.scanOptionalArgument(c.type)):c.type.endsWith("*")?i=c.type.slice(0,-1):r.push(this.scanArgument(c.type)),a+=1}return[i,r]}scanSymbolOrLiteral(){const e=this.peek();if(!e)return null;this.next();let i;if(el(e)){const r=ws.createAtom(this.parseMode,e,P({},this.style));return r?[r]:null}if(i=this.scanMacro(e),i)return[i];if(e.startsWith("\\")){const r=Ce(e,this.parseMode);if(!r)return this.onError({code:"unknown-command",arg:e}),[new Es(e)];if(r.definitionType==="symbol"){const a=P({},this.style);r.variant&&(a.variant=r.variant),i=new Qe({type:r.type,command:e,style:a,value:String.fromCodePoint(r.codepoint),mode:this.parseMode,verbatimLatex:e})}else{if(r.applyMode||r.applyStyle||r.infix)return this.onError({code:"invalid-command",arg:e}),[new Es(e)];r.createAtom&&(i=r.createAtom({command:e,args:[],style:this.style,mode:this.parseMode}))}}return i?[i]:null}scanArgument(e){var i;this.skipFiller();const r=this.parseMode;if(e==="auto"&&(e=r),!this.match("<{>")){if(e==="string")return this.scanString();if(e==="value")return this.scanValue();if(e==="delim")return(i=this.scanDelim())!=null?i:".";if(e==="expression")return this.scanExpression();if(e==="math"){e!==r&&this.beginContext({mode:"math"});const c=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),c}if(e==="text"){e!==r&&this.beginContext({mode:"text"});const c=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),c}return e==="balanced-string"||console.assert(!1),null}if(e==="text"){this.beginContext({mode:"text"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());const c=this.mathlist;return this.endContext(),{group:c}}if(e==="math"){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());const c=this.mathlist;return this.endContext(),{group:c}}let a=null;if(e==="expression"){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());const c=this.mathlist;return this.endContext(),{group:c}}return e==="string"?a=this.scanString():e==="balanced-string"?a=this.scanBalancedString():e==="colspec"?a=this.scanColspec():e==="value"&&(a=this.scanValue()),this.skipUntilToken("<}>"),a}scanOptionalArgument(e){if(e=e==="auto"?this.parseMode:e,this.skipFiller(),!this.match("["))return null;let i=null;for(;!this.end()&&!this.match("]");)if(e==="string")i=this.scanString();else if(e==="value")i=this.scanValue();else if(e==="colspec")i=this.scanColspec();else if(e==="bbox"){const r={},a=this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const c of a){const p=c.match(/^\s*([\d.]+)\s*([a-z]{2})/);if(p)r.padding={dimension:parseInt(p[1]),unit:p[2]};else{const m=c.match(/^\s*border\s*:\s*(.*)/);m?r.border=m[1]:r.backgroundcolor={string:c}}}i=r}else e==="math"&&(this.beginContext({mode:"math"}),i=this.mathlist.concat(this.scan(r=>r==="]")),this.endContext());return i}scanSymbolOrCommand(e){var i,r,a;if(e==="\\placeholder"){const b=this.scanOptionalArgument("string"),w=this.scanOptionalArgument("math"),E=Qe.serialize(w,{defaultMode:"math"});let I=[],N;!N&&E==="correct"?N="correct":!N&&E==="incorrect"?N="incorrect":E!==""&&(I=w);const Z=this.scanOptionalArgument("string")==="locked",ue=this.scanArgument("auto");let me;return ue&&Array.isArray(ue)&&ue.length>0?me=ue:ue&&typeof ue=="object"&&"group"in ue?me=ue.group:me=I,b?[new nh(b,N,Z,me!=null?me:I,{mode:this.parseMode,style:this.style})]:[new ea({mode:this.parseMode,style:this.style})]}if(e==="\\renewcommand"||e==="\\newcommand"||e==="\\providecommand"||e==="\\def"){const b=this.index,w=this.scanLiteralGroup()||this.next();if(!w)return null;if(this.context.registers[w.substring(1)]){const E=this.scanArgument("string");E!==null&&(this.context.registers[w.substring(1)]=E);const I=un([e,Ma(this.tokens.slice(b,this.index))]);return[new Qe({type:"text",value:"",verbatimLatex:I})]}}let c=this.scanMacro(e);if(c)return[c];const p=Ce(e,this.parseMode);if(!p)return this.parseMode==="text"?(/[a-zA-Z]/.test((i=this.peek())!=null?i:"")&&(e+=" "),[...e].map(b=>new Qe({type:"text",value:b,mode:"text",style:this.style}))):(this.onError({code:"unknown-command",arg:e}),[new Es(e)]);const m=this.index;if(p.definitionType==="symbol"){const b=P({},this.style);p.variant&&(b.variant=p.variant),c=new Qe({type:p.type,command:e,style:b,value:String.fromCodePoint(p.codepoint),mode:this.parseMode})}else{if(p.ifMode&&!p.ifMode.includes(this.parseMode))return[];const b=this.parseMode;p.applyMode&&(this.parseMode=p.applyMode);let w,E=[];if(p.parse?E=p.parse(this):[w,E]=this.scanArguments(p),this.parseMode=b,p.applyMode&&!p.applyStyle&&!p.createAtom)return Me(E[0]);if(p.infix)return this.onError({code:"too-many-infix-commands",arg:e}),null;if(typeof p.createAtom=="function")c=p.createAtom({command:e,args:E,style:this.style,mode:this.parseMode}),w&&(c.body=Me(this.scanArgument(w)));else if(typeof p.applyStyle=="function"){const I=P(P({},this.style),p.applyStyle(e,E,this.context)),N=this.parseMode;if(p.applyMode&&(this.parseMode=p.applyMode),w){const Z=this.style;this.style=I;const ue=this.scanArgument(w);return this.style=Z,this.parseMode=N,Me(ue)}this.style=I}else c=new Qe({type:"mord",command:(r=p.command)!=null?r:e,style:P({},this.style),value:e,mode:(a=p.applyMode)!=null?a:this.parseMode})}if(!c)return null;if(c instanceof Qe&&c.verbatimLatex===void 0&&!/^\\(llap|rlap|class|cssId|htmlData)$/.test(e)){const b=un([e,Ma(this.tokens.slice(m,this.index))]);b&&(c.verbatimLatex=b)}if(c.verbatimLatex===null&&(c.verbatimLatex=void 0),c.isFunction&&this.smartFence){const b=this.scanSmartFence();if(b)return[c,b]}return[c]}scanSymbolCommandOrLiteral(){const e=this.get();if(!e)return null;if(el(e)){const i=ws.createAtom(this.parseMode,e,P({},this.style));if(!i)return null;if(i.isFunction&&this.smartFence){const r=this.scanSmartFence();if(r)return[i,r]}return[i]}return e.startsWith("\\")?this.scanSymbolOrCommand(e):e==="<space>"?this.parseMode==="text"?[new Ll(" "," ",this.style)]:null:(e==="<}>"?this.onError({latex:"",code:"unbalanced-braces"}):this.onError({latex:"",code:"unexpected-token",arg:e}),null)}scanMacro(e){var i;const r=this.context.getMacro(e);if(!r)return null;const a=this.index,c=r.args,p={"?":(i=this.args)==null?void 0:i.call(this,"?")};for(let m=1;m<=c;m++){let b=this.scanLiteralGroup();if(!b){const w=this.index;this.scanExpression(),b=Ma(this.tokens.slice(w,this.index))}p[m]=b}return new ju(e,{expand:r.expand,captureSelection:r.captureSelection,args:a===this.index?null:Ma(this.tokens.slice(a,this.index)),style:this.parsingContext.style,body:Br(r.def,{context:this.context,parseMode:this.parseMode,args:m=>p[m],mathstyle:this.parsingContext.mathstyle,style:this.parsingContext.style})})}parseExpression(){var e,i,r,a;let c=(a=(r=(i=(e=this.scanEnvironment())!=null?e:this.scanModeShift())!=null?i:this.scanModeSet())!=null?r:this.scanGroup())!=null?a:this.scanLeftRight();if(c===null){if(this.parseSupSub()||this.parseLimits())return!0;c=this.scanSymbolCommandOrLiteral()}return c?(Array.isArray(c)?this.mathlist.push(...c):this.mathlist.push(c),!0):!1}};function Br(e,i){var r,a,c,p;const m=(r=i==null?void 0:i.args)!=null?r:void 0,b=new Df(jo(e,m),i==null?void 0:i.context,{args:m,mathstyle:(a=i==null?void 0:i.mathstyle)!=null?a:"displaystyle",parseMode:(c=i==null?void 0:i.parseMode)!=null?c:"math",style:(p=i==null?void 0:i.style)!=null?p:{}}),w=[];for(;!b.end();)w.push(...b.scan(()=>!1));return w}function Cf(e,i){var r;const a=new Df(jo(e,null),i==null?void 0:i.context,{mathstyle:"displaystyle",parseMode:(r=i==null?void 0:i.parseMode)!=null?r:"math"});for(;!a.end();)a.scan();return a.errors}var rh=class rm extends Qe{constructor(i,r){super({type:"chem"},{command:i,mode:"math"});const a=Hn.go(Et.go(r,i==="\\pu"?"pu":"ce"),!1);this.body=Br(a),this._verbatimLatex=i+"{"+r+"}",this.arg=r,this.captureSelection=!0}static fromJson(i){return new rm(i.command,i.arg)}set verbatimLatex(i){}get verbatimLatex(){return this._verbatimLatex}toJson(){return f(P({},super.toJson()),{arg:this.arg})}render(i){const r=Qe.createBox(i,this.body,{type:"inner"});return this.caret&&(r.caret=this.caret),this.bind(i,r)}_serialize(i){return console.assert(this.verbatimLatex!==void 0),this.verbatimLatex}};ke(["ce","pu"],"{chemformula:balanced-string}",{createAtom:e=>{var i;return new rh(e.command,(i=e.args[0])!=null?i:"")}});var Et={go:function(e,i){if(!e)return[];i===void 0&&(i="ce");var r="0",a={};a.parenthesisLevel=0,e=e.replace(/\n/g," "),e=e.replace(/[\u2212\u2013\u2014\u2010]/g,"-"),e=e.replace(/[\u2026]/g,"...");for(var c,p=10,m=[];;){c!==e?(p=10,c=e):p--;var b=Et.stateMachines[i],w=b.transitions[r]||b.transitions["*"];e:for(var E=0;E<w.length;E++){var I=Et.patterns.match_(w[E].pattern,e);if(I){for(var N=w[E].task,Z=0;Z<N.action_.length;Z++){var ue;if(b.actions[N.action_[Z].type_])ue=b.actions[N.action_[Z].type_](a,I.match_,N.action_[Z].option);else if(Et.actions[N.action_[Z].type_])ue=Et.actions[N.action_[Z].type_](a,I.match_,N.action_[Z].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+N.action_[Z].type_+")"];Et.concatArray(m,ue)}if(r=N.nextState||r,e.length>0){if(N.revisit||(e=I.remainder),!N.toContinue)break e}else return m}}if(p<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(e,i){if(i)if(Object.prototype.toString.call(i)==="[object Array]")for(var r=0;r<i.length;r++)e.push(i[r]);else e.push(i)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var i=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return i&&i[0]?{match_:i.slice(1),remainder:e.substr(i[0].length)}:null},"(-)(9)^(-9)":function(e){var i=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return i&&i[0]?{match_:i.slice(1),remainder:e.substr(i[0].length)}:null},"state of aggregation $":function(e){var i=Et.patterns.findObserveGroups(e,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(i&&i.remainder.match(/^($|[\s,;\)\]\}])/))return i;var r=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return r?{match_:r[0],remainder:e.substr(r[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return Et.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return Et.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return Et.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return Et.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return Et.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return Et.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return Et.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return Et.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return Et.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return Et.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return Et.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return Et.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return Et.patterns.findObserveGroups(e,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return Et.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return Et.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return Et.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return Et.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return Et.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return Et.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return Et.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return Et.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return Et.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return Et.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return Et.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return Et.patterns.findObserveGroups(e,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){var i;if(i=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/),i)return{match_:i[0],remainder:e.substr(i[0].length)};var r=Et.patterns.findObserveGroups(e,"","$","$","");return r&&(i=r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),i)?{match_:i[0],remainder:e.substr(i[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var i=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return i?{match_:i[0],remainder:e.substr(i[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,i,r,a,c,p,m,b,w,E){var I=function(Ue,ct){if(typeof ct=="string")return Ue.indexOf(ct)!==0?null:ct;var Rt=Ue.match(ct);return Rt?Rt[0]:null},N=function(Ue,ct,Rt){for(var yt=0;ct<Ue.length;){var Jt=Ue.charAt(ct),hi=I(Ue.substr(ct),Rt);if(hi!==null&&yt===0)return{endMatchBegin:ct,endMatchEnd:ct+hi.length};if(Jt==="{")yt++;else if(Jt==="}"){if(yt===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];yt--}ct++}return yt>0,null},Z=I(e,i);if(Z===null||(e=e.substr(Z.length),Z=I(e,r),Z===null))return null;var ue=N(e,Z.length,a||c);if(ue===null)return null;var me=e.substring(0,a?ue.endMatchEnd:ue.endMatchBegin);if(p||m){var Ge=this.findObserveGroups(e.substr(ue.endMatchEnd),p,m,b,w);if(Ge===null)return null;var Lt=[me,Ge.match_];return{match_:E?Lt.join(""):Lt,remainder:Ge.remainder}}else return{match_:me,remainder:e.substr(ue.endMatchEnd)}},match_:function(e,i){var r=Et.patterns.patterns[e];if(r===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if(typeof r=="function")return Et.patterns.patterns[e](i);var a=i.match(r);if(a){var c;return a[2]?c=[a[1],a[2]]:a[1]?c=a[1]:c=a[0],{match_:c,remainder:i.substr(a[0].length)}}return null}},actions:{"a=":function(e,i){e.a=(e.a||"")+i},"b=":function(e,i){e.b=(e.b||"")+i},"p=":function(e,i){e.p=(e.p||"")+i},"o=":function(e,i){e.o=(e.o||"")+i},"q=":function(e,i){e.q=(e.q||"")+i},"d=":function(e,i){e.d=(e.d||"")+i},"rm=":function(e,i){e.rm=(e.rm||"")+i},"text=":function(e,i){e.text_=(e.text_||"")+i},insert:function(e,i,r){return{type_:r}},"insert+p1":function(e,i,r){return{type_:r,p1:i}},"insert+p1+p2":function(e,i,r){return{type_:r,p1:i[0],p2:i[1]}},copy:function(e,i){return i},rm:function(e,i){return{type_:"rm",p1:i||""}},text:function(e,i){return Et.go(i,"text")},"{text}":function(e,i){var r=["{"];return Et.concatArray(r,Et.go(i,"text")),r.push("}"),r},"tex-math":function(e,i){return Et.go(i,"tex-math")},"tex-math tight":function(e,i){return Et.go(i,"tex-math tight")},bond:function(e,i,r){return{type_:"bond",kind_:r||i}},"color0-output":function(e,i){return{type_:"color0",color:i[0]}},ce:function(e,i){return Et.go(i)},"1/2":function(e,i){var r=[];i.match(/^[+\-]/)&&(r.push(i.substr(0,1)),i=i.substr(1));var a=i.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return a[1]=a[1].replace(/\$/g,""),r.push({type_:"frac",p1:a[1],p2:a[2]}),a[3]&&(a[3]=a[3].replace(/\$/g,""),r.push({type_:"tex-math",p1:a[3]})),r},"9,9":function(e,i){return Et.go(i,"9,9")}},createTransitions:function(e){var i,r,a,c,p={};for(i in e)for(r in e[i])for(a=r.split("|"),e[i][r].stateArray=a,c=0;c<a.length;c++)p[a[c]]=[];for(i in e)for(r in e[i])for(a=e[i][r].stateArray||[],c=0;c<a.length;c++){var m=e[i][r];if(m.action_){m.action_=[].concat(m.action_);for(var b=0;b<m.action_.length;b++)typeof m.action_[b]=="string"&&(m.action_[b]={type_:m.action_[b]})}else m.action_=[];for(var w=i.split("|"),E=0;E<w.length;E++)if(a[c]==="*")for(var I in p)p[I].push({pattern:w[E],task:m});else p[a[c]].push({pattern:w[E],task:m})}return p},stateMachines:{}};Et.stateMachines={ce:{transitions:Et.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(e,i){var r;if((e.d||"").match(/^[0-9]+$/)){var a=e.d;e.d=void 0,r=this.output(e),e.b=a}else r=this.output(e);return Et.actions["o="](e,i),r},"d= kv":function(e,i){e.d=i,e.dType="kv"},"charge or bond":function(e,i){if(e.beginsWithBond){var r=[];return Et.concatArray(r,this.output(e)),Et.concatArray(r,Et.actions.bond(e,i,"-")),r}else e.d=i},"- after o/d":function(e,i,r){var a=Et.patterns.match_("orbital",e.o||""),c=Et.patterns.match_("one lowercase greek letter $",e.o||""),p=Et.patterns.match_("one lowercase latin letter $",e.o||""),m=Et.patterns.match_("$one lowercase latin letter$ $",e.o||""),b=i==="-"&&(a&&a.remainder===""||c||p||m);b&&!e.a&&!e.b&&!e.p&&!e.d&&!e.q&&!a&&p&&(e.o="$"+e.o+"$");var w=[];return b?(Et.concatArray(w,this.output(e)),w.push({type_:"hyphen"})):(a=Et.patterns.match_("digits",e.d||""),r&&a&&a.remainder===""?(Et.concatArray(w,Et.actions["d="](e,i)),Et.concatArray(w,this.output(e))):(Et.concatArray(w,this.output(e)),Et.concatArray(w,Et.actions.bond(e,i,"-")))),w},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,i){return{type_:"state of aggregation",p1:Et.go(i,"o")}},comma:function(e,i){var r=i.replace(/\s*$/,""),a=r!==i;return a&&e.parenthesisLevel===0?{type_:"comma enumeration L",p1:r}:{type_:"comma enumeration M",p1:r}},output:function(e,i,r){var a;if(!e.r)a=[],!e.a&&!e.b&&!e.p&&!e.o&&!e.q&&!e.d&&!r||(e.sb&&a.push({type_:"entitySkip"}),!e.o&&!e.q&&!e.d&&!e.b&&!e.p&&r!==2?(e.o=e.a,e.a=void 0):!e.o&&!e.q&&!e.d&&(e.b||e.p)?(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):e.o&&e.dType==="kv"&&Et.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&e.dType==="kv"&&!e.q&&(e.dType=void 0),a.push({type_:"chemfive",a:Et.go(e.a,"a"),b:Et.go(e.b,"bd"),p:Et.go(e.p,"pq"),o:Et.go(e.o,"o"),q:Et.go(e.q,"pq"),d:Et.go(e.d,e.dType==="oxidation"?"oxidation":"bd"),dType:e.dType}));else{var c;e.rdt==="M"?c=Et.go(e.rd,"tex-math"):e.rdt==="T"?c=[{type_:"text",p1:e.rd||""}]:c=Et.go(e.rd);var p;e.rqt==="M"?p=Et.go(e.rq,"tex-math"):e.rqt==="T"?p=[{type_:"text",p1:e.rq||""}]:p=Et.go(e.rq),a={type_:"arrow",r:e.r,rd:c,rq:p}}for(var m in e)m!=="parenthesisLevel"&&m!=="beginsWithBond"&&delete e[m];return a},"oxidation-output":function(e,i){var r=["{"];return Et.concatArray(r,Et.go(i,"oxidation")),r.push("}"),r},"frac-output":function(e,i){return{type_:"frac-ce",p1:Et.go(i[0]),p2:Et.go(i[1])}},"overset-output":function(e,i){return{type_:"overset",p1:Et.go(i[0]),p2:Et.go(i[1])}},"underset-output":function(e,i){return{type_:"underset",p1:Et.go(i[0]),p2:Et.go(i[1])}},"underbrace-output":function(e,i){return{type_:"underbrace",p1:Et.go(i[0]),p2:Et.go(i[1])}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:Et.go(i[1])}},"r=":function(e,i){e.r=i},"rdt=":function(e,i){e.rdt=i},"rd=":function(e,i){e.rd=i},"rqt=":function(e,i){e.rqt=i},"rq=":function(e,i){e.rq=i},operator:function(e,i,r){return{type_:"operator",kind_:r||i}}}},a:{transitions:Et.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:Et.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:Et.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(e){if(e.text_){var i={type_:"text",p1:e.text_};for(var r in e)delete e[r];return i}}}},pq:{transitions:Et.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(e,i){return{type_:"state of aggregation subscript",p1:Et.go(i,"o")}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:Et.go(i[1],"pq")}}}},bd:{transitions:Et.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(e,i){return{type_:"color",color1:i[0],color2:Et.go(i[1],"bd")}}}},oxidation:{transitions:Et.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(e,i){return{type_:"roman numeral",p1:i||""}}}},"tex-math":{transitions:Et.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(e){if(e.o){var i={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return i}}}},"tex-math tight":{transitions:Et.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(e,i){e.o=(e.o||"")+"{"+i+"}"},output:function(e){if(e.o){var i={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return i}}}},"9,9":{transitions:Et.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:Et.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(e,i){var r=[];return i[0]==="+-"||i[0]==="+/-"?r.push("\\pm "):i[0]&&r.push(i[0]),i[1]&&(Et.concatArray(r,Et.go(i[1],"pu-9,9")),i[2]&&(i[2].match(/[,.]/)?Et.concatArray(r,Et.go(i[2],"pu-9,9")):r.push(i[2])),(i[3]||i[4])&&(i[3]==="e"||i[4]==="*"?r.push({type_:"cdot"}):r.push({type_:"times"}))),i[5]&&r.push("10^{"+i[5]+"}"),r},"number^":function(e,i){var r=[];return i[0]==="+-"||i[0]==="+/-"?r.push("\\pm "):i[0]&&r.push(i[0]),Et.concatArray(r,Et.go(i[1],"pu-9,9")),r.push("^{"+i[2]+"}"),r},operator:function(e,i,r){return{type_:"operator",kind_:r||i}},space:function(){return{type_:"pu-space-1"}},output:function(e){var i,r=Et.patterns.match_("{(...)}",e.d||"");r&&r.remainder===""&&(e.d=r.match_);var a=Et.patterns.match_("{(...)}",e.q||"");if(a&&a.remainder===""&&(e.q=a.match_),e.d&&(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.d=e.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var c={d:Et.go(e.d,"pu"),q:Et.go(e.q,"pu")};e.o==="//"?i={type_:"pu-frac",p1:c.d,p2:c.q}:(i=c.d,c.d.length>1||c.q.length>1?i.push({type_:" / "}):i.push({type_:"/"}),Et.concatArray(i,c.q))}else i=Et.go(e.d,"pu-2");for(var p in e)delete e[p];return i}}},"pu-2":{transitions:Et.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(e,i){e.rm+="^{"+i+"}"},space:function(){return{type_:"pu-space-2"}},output:function(e){var i=[];if(e.rm){var r=Et.patterns.match_("{(...)}",e.rm||"");r&&r.remainder===""?i=Et.go(r.match_,"pu"):i={type_:"rm",p1:e.rm}}for(var a in e)delete e[a];return i}}},"pu-9,9":{transitions:Et.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(e){var i=[];if(e.text_=e.text_||"",e.text_.length>4){var r=e.text_.length%3;r===0&&(r=3);for(var a=e.text_.length-3;a>0;a-=3)i.push(e.text_.substr(a,3)),i.push({type_:"1000 separator"});i.push(e.text_.substr(0,r)),i.reverse()}else i.push(e.text_);for(var c in e)delete e[c];return i},"output-o":function(e){var i=[];if(e.text_=e.text_||"",e.text_.length>4){for(var r=e.text_.length-3,a=0;a<r;a+=3)i.push(e.text_.substr(a,3)),i.push({type_:"1000 separator"});i.push(e.text_.substr(a))}else i.push(e.text_);for(var c in e)delete e[c];return i}}}};var Hn={go:function(e,i){if(!e)return"";for(var r="",a=!1,c=0;c<e.length;c++){var p=e[c];typeof p=="string"?r+=p:(r+=Hn._go2(p),p.type_==="1st-level escape"&&(a=!0))}return!i&&!a&&r&&(r="{"+r+"}"),r},_goInner:function(e){return e&&Hn.go(e,!0)},_go2:function(e){var i;switch(e.type_){case"chemfive":i="";var r={a:Hn._goInner(e.a),b:Hn._goInner(e.b),p:Hn._goInner(e.p),o:Hn._goInner(e.o),q:Hn._goInner(e.q),d:Hn._goInner(e.d)};r.a&&(r.a.match(/^[+\-]/)&&(r.a="{"+r.a+"}"),i+=r.a+"\\,"),(r.b||r.p)&&(i+="{\\vphantom{X}}",i+="^{\\hphantom{"+(r.b||"")+"}}_{\\hphantom{"+(r.p||"")+"}}",i+="{\\vphantom{X}}",i+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(r.b||"")+"}}",i+="_{\\vphantom{2}\\llap{\\smash[t]{"+(r.p||"")+"}}}"),r.o&&(r.o.match(/^[+\-]/)&&(r.o="{"+r.o+"}"),i+=r.o),e.dType==="kv"?((r.d||r.q)&&(i+="{\\vphantom{X}}"),r.d&&(i+="^{"+r.d+"}"),r.q&&(i+="_{\\smash[t]{"+r.q+"}}")):e.dType==="oxidation"?(r.d&&(i+="{\\vphantom{X}}",i+="^{"+r.d+"}"),r.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+r.q+"}}")):(r.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+r.q+"}}"),r.d&&(i+="{\\vphantom{X}}",i+="^{"+r.d+"}"));break;case"rm":i="\\mathrm{"+e.p1+"}";break;case"text":e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(" ","~").replace("-","\\text{-}"),i="\\mathrm{"+e.p1+"}"):i="\\text{"+e.p1+"}";break;case"roman numeral":i="\\mathrm{"+e.p1+"}";break;case"state of aggregation":i="\\mskip2mu "+Hn._goInner(e.p1);break;case"state of aggregation subscript":i="\\mskip1mu "+Hn._goInner(e.p1);break;case"bond":if(i=Hn._getBond(e.kind_),!i)throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var a="\\frac{"+e.p1+"}{"+e.p2+"}";i="\\mathchoice{\\textstyle"+a+"}{"+a+"}{"+a+"}{"+a+"}";break;case"pu-frac":var c="\\frac{"+Hn._goInner(e.p1)+"}{"+Hn._goInner(e.p2)+"}";i="\\mathchoice{\\textstyle"+c+"}{"+c+"}{"+c+"}{"+c+"}";break;case"tex-math":i=e.p1+" ";break;case"frac-ce":i="\\frac{"+Hn._goInner(e.p1)+"}{"+Hn._goInner(e.p2)+"}";break;case"overset":i="\\overset{"+Hn._goInner(e.p1)+"}{"+Hn._goInner(e.p2)+"}";break;case"underset":i="\\underset{"+Hn._goInner(e.p1)+"}{"+Hn._goInner(e.p2)+"}";break;case"underbrace":i="\\underbrace{"+Hn._goInner(e.p1)+"}_{"+Hn._goInner(e.p2)+"}";break;case"color":i="{\\color{"+e.color1+"}{"+Hn._goInner(e.color2)+"}}";break;case"color0":i="\\color{"+e.color+"}";break;case"arrow":var p={rd:Hn._goInner(e.rd),rq:Hn._goInner(e.rq)},m=Hn._getArrow(e.r);p.rd||p.rq?e.r==="<=>"||e.r==="<=>>"||e.r==="<<=>"||e.r==="<-->"?(m="\\long"+m,p.rd&&(m="\\overset{"+p.rd+"}{"+m+"}"),p.rq&&(e.r==="<-->"?m="\\underset{\\lower2mu{"+p.rq+"}}{"+m+"}":m="\\underset{\\lower6mu{"+p.rq+"}}{"+m+"}"),m=" {}\\mathrel{"+m+"}{} "):(p.rq&&(m+="[{"+p.rq+"}]"),m+="{"+p.rd+"}",m=" {}\\mathrel{\\x"+m+"}{} "):m=" {}\\mathrel{\\long"+m+"}{} ",i=m;break;case"operator":i=Hn._getOperator(e.kind_);break;case"1st-level escape":i=e.p1+" ";break;case"space":i=" ";break;case"entitySkip":i="~";break;case"pu-space-1":i="~";break;case"pu-space-2":i="\\mkern3mu ";break;case"1000 separator":i="\\mkern2mu ";break;case"commaDecimal":i="{,}";break;case"comma enumeration L":i="{"+e.p1+"}\\mkern6mu ";break;case"comma enumeration M":i="{"+e.p1+"}\\mkern3mu ";break;case"comma enumeration S":i="{"+e.p1+"}\\mkern1mu ";break;case"hyphen":i="\\text{-}";break;case"addition compound":i="\\,{\\cdot}\\,";break;case"electron dot":i="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":i="{\\times}";break;case"prime":i="\\prime ";break;case"cdot":i="\\cdot ";break;case"tight cdot":i="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":i="\\times ";break;case"circa":i="{\\sim}";break;case"^":i="uparrow";break;case"v":i="downarrow";break;case"ellipsis":i="\\ldots ";break;case"/":i="/";break;case" / ":i="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return i},_getArrow:function(e){switch(e){case"->":return"rightarrow";case"\u2192":return"rightarrow";case"\u27F6":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<-->":return"leftrightarrows";case"<=>":return"rightleftharpoons";case"\u21CC":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(e){switch(e){case"-":return"{-}";case"1":return"{-}";case"=":return"{=}";case"2":return"{=}";case"#":return"{\\equiv}";case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"~--":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"-~-":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(e){switch(e){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":return" {}\\approx{} ";case"$\\approx$":return" {}\\approx{} ";case"v":return" \\downarrow{} ";case"(v)":return" \\downarrow{} ";case"^":return" \\uparrow{} ";case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};function Mf(e){}function sh(e){}var If=class sm extends Qe{constructor(i){super(f(P({},i),{type:"delim"})),this.value=i.delim,this.size=i.size}static fromJson(i){return new sm(i)}toJson(){return f(P({},super.toJson()),{delim:this.value,size:this.size})}render(i){return new Mt(this.value,{type:"middle"})}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Ce(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):Zn(this.command,this.value)}},ah=class am extends Qe{constructor(i){super(f(P({},i),{type:"sizeddelim",value:i.delim})),this.delimType=i.delimType,this.size=i.size}static fromJson(i){return new am(i)}toJson(){return f(P({},super.toJson()),{delim:this.value,size:this.size,delimType:this.delimType})}render(i){let r=xf(this.value,this.size,i,{classes:{open:"mopen",close:"mclose"}[this.delimType],type:this.delimType,isSelected:this.isSelected});return r?(r=this.bind(i,r),this.caret&&(r.caret=this.caret),r):null}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Ce(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):Zn(this.command,this.value)}},Pl=class om extends Qe{constructor(i,r,a,c){var p,m;super({type:"enclose",command:i,style:c.style}),this.body=r,this.backgroundcolor=c.backgroundcolor,a.updiagonalarrow&&(a.updiagonalstrike=!1),a.box&&(a.left=!1,a.right=!1,a.bottom=!1,a.top=!1),this.notation=a,this.shadow=(p=c.shadow)!=null?p:"none",this.strokeWidth=(m=c.strokeWidth)!=null?m:"0.06em",this.strokeWidth||(this.strokeWidth="0.06em"),this.strokeStyle=c.strokeStyle,this.svgStrokeStyle=c.svgStrokeStyle,this.strokeColor=c.strokeColor,this.borderStyle=c.borderStyle,this.padding=c.padding,this.captureSelection=!1}static fromJson(i){return new om(i.command,i.body,i.notation,i)}toJson(){return f(P({},super.toJson()),{notation:this.notation,shadow:this.shadow,strokeWidth:this.strokeWidth,strokeStyle:this.strokeStyle,svgStrokeStyle:this.svgStrokeStyle,strokeColor:this.strokeColor,borderStyle:this.borderStyle,padding:this.padding})}_serialize(i){var r;if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const a=Ce(this.command,this.mode);if(a!=null&&a.serialize)return a.serialize(this,i);let c=(r=this.command)!=null?r:"";if(this.command==="\\enclose"){c+="{"+Object.keys(this.notation).join(" ")+"}";let p="",m="";this.backgroundcolor&&this.backgroundcolor!=="transparent"&&(p+=m+'mathbackground="'+this.backgroundcolor+'"',m=","),this.shadow&&this.shadow!=="auto"&&(p+=m+'shadow="'+this.shadow+'"',m=","),this.strokeWidth||this.strokeStyle!=="solid"?(p+=m+this.borderStyle,m=","):this.strokeColor&&this.strokeColor!=="currentColor"&&(p+=m+'mathcolor="'+this.strokeColor+'"',m=","),p&&(c+=`[${p}]`)}return Zn(c,this.bodyToLatex(i))}render(i){const r=new sn({parent:i},this.style),a=Qe.createBox(r,this.body);if(!a)return null;const c=oh(this.borderStyle),p=r.toEm(!this.padding||this.padding==="auto"?{register:"fboxsep"}:{string:this.padding});a.setStyle("position","relative"),a.setStyle("display","inline-block"),a.setStyle("top",p,"em"),a.setStyle("height",a.height+a.depth,"em"),a.setStyle("width",a.width,"em");const m=new Mt(null,{classes:"ML__notation"});let b=a.height+a.depth+2*p;const w=a.width+2*p;let E="";if(this.notation.horizontalstrike&&(E+=this.line(3,50,97,50)),this.notation.verticalstrike&&(E+=this.line(50,3,50,97)),this.notation.updiagonalstrike&&(E+=this.line(3,97,97,3)),this.notation.downdiagonalstrike&&(E+=this.line(3,3,97,97)),this.notation.updiagonalarrow){E+=this.line(p.toString(),(p+a.depth+a.height).toString(),(p+a.width).toString(),p.toString());const me=.03*Math.sqrt(w*w+b*b)*1,Ge=a.width*me,Lt=(a.depth+a.height)*me,Ue=p+a.width;let ct=p;ct+Lt-.4*Ge<0&&(ct=.4*Ge-Lt),E+='<polygon points="',E+=`${Ue},${ct} ${Ue-Ge-.4*Lt},${ct+Lt-.4*Ge} `,E+=`${Ue-.7*Ge},${ct+.7*Lt} ${Ue-Ge+.4*Lt},${ct+Lt+.4*Ge} `,E+=`${Ue},${ct}`,E+=`" stroke='none' fill="${this.strokeColor}"`,E+="/>"}let I=0;if(this.notation.phasorangle){const Z=Zu(r),ue=(a.height+a.depth+2*Z+p).toString(),me=(a.height+a.depth)/2;E+=this.line(p.toString(),ue,(p+me+a.width).toString(),ue),E+=this.line(p.toString(),ue,(p+me).toString(),(p-Z).toString()),b+=Z,I=me,a.left+=b/2-p}if(this.notation.longdiv){const Z=Zu(r);b+=Z,E+=this.line(p.toString(),p.toString(),(p+a.width).toString(),p.toString());const ue=.3;I=ue+Z,a.left+=ue+Z,a.setTop(p+Z),E+='<path d="',E+=`M ${p} ${p} a${ue} ${(a.depth+a.height+2*Z)/2}, 0, 1, 1, 0 ${a.depth+a.height+2*Z} "`,E+=` stroke-width="${Vd(r)}" stroke="${this.strokeColor}" fill="none"`,E+="/>"}if(m.width=a.width+2*p+I,m.height=a.height+p,m.depth=a.depth+p,m.setStyle("box-sizing","border-box"),m.setStyle("left",`calc(-${c} / 2 )`),m.setStyle("height",`${Math.floor(100*b)/100}em`),m.setStyle("top",`calc(${c} / 2 )`),this.backgroundcolor&&m.setStyle("background-color",this.backgroundcolor),this.notation.box&&m.setStyle("border","1px solid red"),this.notation.actuarial&&(m.setStyle("border-top",this.borderStyle),m.setStyle("border-right",this.borderStyle)),this.notation.madruwb&&(m.setStyle("border-bottom",this.borderStyle),m.setStyle("border-right",this.borderStyle)),this.notation.roundedbox&&(m.setStyle("border-radius","8px"),m.setStyle("border",this.borderStyle)),this.notation.circle&&(m.setStyle("border-radius","50%"),m.setStyle("border",this.borderStyle)),this.notation.top&&m.setStyle("border-top",this.borderStyle),this.notation.left&&m.setStyle("border-left",this.borderStyle),this.notation.right&&m.setStyle("border-right",this.borderStyle),this.notation.bottom&&m.setStyle("border-bottom",this.borderStyle),E){let Z="";this.shadow==="auto"&&(Z+="filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .7)) drop-shadow(1px 1px 2px #333)"),this.shadow!=="none"&&(Z+=`filter: drop-shadow(${this.shadow})`),Z+=` stroke-width="${this.strokeWidth}" stroke="${this.strokeColor}"`,Z+=' stroke-linecap="round"',this.svgStrokeStyle&&(Z+=` stroke-dasharray="${this.svgStrokeStyle}"`),m.svgStyle=Z,m.svgOverlay=E}const N=new Mt([m,a]);return N.setStyle("position","relative"),N.setStyle("vertical-align",p,"em"),N.setStyle("height",`${Math.floor(100*(a.height+a.depth+2*p))/100}em`),N.setStyle("display","inline-block"),N.height=m.height,N.depth=m.depth,N.width=m.width-2*p,N.left=p,N.right=p,this.caret&&(N.caret=this.caret),N.wrap(r)}line(i,r,a,c){return`<line x1="${qu(i)}" y1="${qu(r)}" x2="${qu(a)}" y2="${qu(c)}" vector-effect="non-scaling-stroke"></line>`}};function qu(e){return typeof e=="number"?`${Math.floor(100*e)/100}%`:e}function oh(e){if(!e)return"1px";const i=e.match(/([0-9][a-zA-Z\%]+)/);return i===null?"1px":i[1]}function Vd(e){return(Math.floor(100*e.metrics.sqrtRuleThickness/e.scalingFactor)/100/10).toString()+"em"}function Zu(e){const i=e.isDisplayStyle?da:e.metrics.defaultRuleThickness;return e.metrics.defaultRuleThickness+e.scalingFactor*i/4}var tl=class lm extends Qe{constructor(i,r,a){var c,p;super(f(P({},a),{type:"genfrac",displayContainsHighlight:!0})),this.above=i,this.below=r,this.hasBarLine=(c=a==null?void 0:a.hasBarLine)!=null?c:!0,this.continuousFraction=(p=a==null?void 0:a.continuousFraction)!=null?p:!1,this.numerPrefix=a==null?void 0:a.numerPrefix,this.denomPrefix=a==null?void 0:a.denomPrefix,this.mathstyleName=a==null?void 0:a.mathstyleName,this.leftDelim=a==null?void 0:a.leftDelim,this.rightDelim=a==null?void 0:a.rightDelim,this.fractionNavigationOrder=a==null?void 0:a.fractionNavigationOrder}static fromJson(i){return new lm(i.above,i.below,i)}toJson(){const i={};return this.continuousFraction&&(i.continuousFraction=!0),this.numerPrefix&&(i.numerPrefix=this.numerPrefix),this.denomPrefix&&(i.denomPrefix=this.denomPrefix),this.leftDelim&&(i.leftDelim=this.leftDelim),this.rightDelim&&(i.rightDelim=this.rightDelim),this.hasBarLine||(i.hasBarLine=!1),this.mathstyleName&&(i.mathstyleName=this.mathstyleName),this.fractionNavigationOrder&&(i.fractionNavigationOrder=this.fractionNavigationOrder),P(P({},super.toJson()),i)}get children(){if(this._children)return this._children;const i=[];if(this.fractionNavigationOrder==="denominator-numerator"){for(const r of this.below)i.push(...r.children),i.push(r);for(const r of this.above)i.push(...r.children),i.push(r)}else{for(const r of this.above)i.push(...r.children),i.push(r);for(const r of this.below)i.push(...r.children),i.push(r)}return this._children=i,i}render(i){var r,a;const c=new sn({parent:i,mathstyle:this.mathstyleName},this.style),p=c.metrics,m=new sn({parent:c,mathstyle:this.continuousFraction?"":"numerator"},this.style),b=this.numerPrefix?new Mt([new Mt(this.numerPrefix),Qe.createBox(m,this.above)],{isTight:m.isTight,type:"ignore"}):(r=Qe.createBox(m,this.above,{type:"ignore"}))!=null?r:new Mt(null,{type:"ignore"}),w=new sn({parent:c,mathstyle:this.continuousFraction?"":"denominator"},this.style),E=this.denomPrefix?new Mt([new Mt(this.denomPrefix),Qe.createBox(w,this.below,{type:"ignore"})]):(a=Qe.createBox(w,this.below,{type:"ignore"}))!=null?a:new Mt(null,{type:"ignore"}),I=this.hasBarLine?p.defaultRuleThickness:0;let N,Z=0,ue;c.isDisplayStyle?(N=m.metrics.num1,Z=I>0?3*I:7*I,ue=w.metrics.denom1):(I>0?(N=m.metrics.num2,Z=I):(N=m.metrics.num3,Z=3*p.defaultRuleThickness),ue=w.metrics.denom2);const me=[];this.isSelected&&me.push("ML__selected");const Ge=b.depth,Lt=E.height;let Ue;if(I<=0){const ri=N-Ge-(Lt-ue);ri<Z&&(N+=(Z-ri)/2,ue+=(Z-ri)/2),Ue=new Er({individualShift:[{box:b,shift:-N,classes:[...me,"ML__center"]},{box:E,shift:ue,classes:[...me,"ML__center"]}]}).wrap(c)}else{const ri=new Mt(null,{classes:"ML__frac-line",mode:this.mode,style:this.style});ri.softWidth=Math.max(b.width,E.width),ri.height=I/2,ri.depth=I/2;const cn=pr+I/2;N<Z+Ge+cn&&(N=Z+Ge+cn);const Bn=pr-I/2;ue<Z+Lt-Bn&&(ue=Z+Lt-Bn),Ue=new Er({individualShift:[{box:E,shift:ue,classes:[...me,"ML__center"]},{box:ri,shift:-Bn,classes:me},{box:b,shift:-N,classes:[...me,"ML__center"]}]}).wrap(c)}const ct=c.isDisplayStyle?p.delim1:p.delim2,Rt=this.leftDelim?this.bind(i,Gu("open",this.leftDelim,ct,!0,i,{style:this.style,mode:this.mode,isSelected:this.isSelected})):go(c,"open");let yt=null;this.continuousFraction?yt=new Mt(null,{type:"close"}):this.rightDelim?yt=this.bind(i,Gu("close",this.rightDelim,ct,!0,i,{style:this.style,mode:this.mode,isSelected:this.isSelected})):yt=go(c,"close");const Jt=new Mt([Rt,Ue,yt],{isTight:c.isTight,type:"inner",classes:"mfrac"}),hi=this.bind(i,Jt);return this.caret&&(hi.caret=this.caret),this.attachSupsub(i,{base:hi})}},Ir=class um extends Qe{constructor(i,r){var a;super({type:"latex",value:i,mode:"latex"}),this.isSuggestion=(a=r==null?void 0:r.isSuggestion)!=null?a:!1,this.isError=!1}static fromJson(i){const r=new um(i.value);return i.isSuggestion&&(r.isSuggestion=!0),i.isError&&(r.isError=!0),r}toJson(){const i={};return this.isSuggestion&&(i.isSuggestion=!0),this.isError&&(i.isError=!0),P({type:"latex",value:this.value},i)}get computedStyle(){return{}}render(i){const r=new Mt(this.value,{classes:this.isSuggestion?"ML__suggestion":this.isError?"ML__error":"",type:"latex",maxFontSize:1});return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}},vo=class cm extends Qe{constructor(i){super({type:"latexgroup",mode:"latex"}),this.body=[...i].map(r=>new Ir(r)),this.skipBoundary=!1}static fromJson(i){return new cm("")}toJson(){return super.toJson()}render(i){const r=Qe.createBox(i,this.body);return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}_serialize(i){var r,a;return(a=(r=this.body)==null?void 0:r.map(c=>c.value).join(""))!=null?a:""}},Yu=class hm extends Qe{constructor(i,r){super(f(P({},r),{type:"extensible-symbol",isFunction:r==null?void 0:r.isFunction})),this.value=i,this.variant=r==null?void 0:r.variant,this.subsupPlacement=r==null?void 0:r.limits}static fromJson(i){return new hm(i.symbol,i)}toJson(){const i=super.toJson();return this.variant&&(i.variant=this.variant),this.subsupPlacement&&(i.limits=this.subsupPlacement),this.isExtensibleSymbol&&(i.isExtensibleSymbol=!0),this.value&&(i.symbol=this.value),i}render(i){var r;const a=i.isDisplayStyle&&this.value!=="\\smallint",c=new Mt(this.value,{fontFamily:a?"Size2-Regular":"Size1-Regular",classes:"op-symbol "+(a?"large-op":"small-op"),type:"op",maxFontSize:i.scalingFactor,isSelected:this.isSelected});if(!c)return null;c.right=c.italic;const p=(c.height-c.depth)/2-pr*i.scalingFactor,m=c.italic;c.setTop(p);let b=c;if(this.superscript||this.subscript){const w=(r=this.subsupPlacement)!=null?r:"auto";b=w==="over-under"||w==="auto"&&i.isDisplayStyle?this.attachLimits(i,{base:c,baseShift:p,slant:m}):this.attachSupsub(i,{base:c})}return new Mt(this.bind(i,b),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(i)}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Ce(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,i);const a=[];return a.push(this.command),this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&a.push("\\limits"),this.subsupPlacement==="adjacent"&&a.push("\\nolimits"),this.subsupPlacement==="auto"&&a.push("\\displaylimits")),a.push(this.supsubToLatex(i)),un(a)}},Fa=class fm extends Qe{constructor(i){const r=i.body;super(f(P({},i),{type:"overlap",body:typeof r=="string"?[new Qe({value:r})]:r,style:i==null?void 0:i.style})),this.skipBoundary=!0,this.align=i==null?void 0:i.align,this.boxType=i==null?void 0:i.boxType}static fromJson(i){return new fm(i)}toJson(){const i={};return this.align&&(i.align=this.align),this.boxType&&(i.boxType=this.boxType),P(P({},super.toJson()),i)}render(i){const r=Qe.createBox(i,this.body,{classes:"inner"});return r?(this.caret&&(r.caret=this.caret),this.bind(i,new Mt([r,new Mt(null,{classes:"fix"})],{classes:this.align==="right"?"rlap":"llap",type:this.boxType}))):null}},Ps=class dm extends Qe{constructor(i){var r,a,c,p;super({type:"overunder",command:i.command,style:i.style,mode:i.mode,body:i.body,skipBoundary:(r=i.skipBoundary)!=null?r:!0}),this.subsupPlacement=i.supsubPlacement,this.svgAbove=i.svgAbove,this.svgBelow=i.svgBelow,this.svgBody=i.svgBody,this.above=i.above,this.below=i.below,this.boxType=(a=i.boxType)!=null?a:"ord",this.paddedBody=(c=i.paddedBody)!=null?c:!1,this.paddedLabels=(p=i.paddedLabels)!=null?p:!1}static fromJson(i){return new dm(i)}toJson(){const i=super.toJson();return this.skipBoundary||(i.skipBoundary=!1),this.subsupPlacement&&(i.subsupPlacement=this.subsupPlacement),this.svgAbove&&(i.svgAbove=this.svgAbove),this.svgBelow&&(i.svgBelow=this.svgBelow),this.svgBody&&(i.svgBody=this.svgBody),this.boxType!=="ord"&&(i.boxType=this.boxType),this.paddedBody&&(i.paddedBody=!0),this.paddedLabels&&(i.paddedLabels=!0),i}render(i){let r=this.svgBody?Mu(this.svgBody):Qe.createBox(i,this.body,{type:"ignore"});const a=new sn({parent:i,mathstyle:"scriptstyle"},this.style);let c=null;this.svgAbove?c=Mu(this.svgAbove):this.above&&(c=Qe.createBox(a,this.above,{type:"ignore"}));let p=null;this.svgBelow?p=Mu(this.svgBelow):this.below&&(p=Qe.createBox(a,this.below,{type:"ignore"})),this.paddedBody&&(r=new Mt([go(i,"open"),r,go(i,"close")],{type:"ignore"}));let m=Rf(i,{base:r,above:c,below:p,type:this.boxType==="bin"||this.boxType==="rel"?this.boxType:"ord",paddedAboveBelow:this.paddedLabels});return m?(this.subsupPlacement==="over-under"?m=this.attachLimits(i,{base:m,type:m.type}):m=this.attachSupsub(i,{base:m}),this.caret&&(m.caret=this.caret),this.bind(i,m)):null}};function Rf(e,i){if(!i.base)return null;if(!i.above&&!i.below){const b=new Mt(i.base,{type:i.type});return b.setStyle("position","relative"),b}let r=0;i.above&&(r=e.metrics.bigOpSpacing5);let a=null;const c=i.base,p=0,m=["ML__center"];if(i.paddedAboveBelow&&m.push("ML__label_padding"),i.below&&i.above){const b=e.metrics.bigOpSpacing5+i.below.height+i.below.depth+c.depth+p;a=new Er({bottom:b,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:m},{box:c,classes:["ML__center"]},r,{box:i.above,classes:m},e.metrics.bigOpSpacing5]})}else i.below?a=new Er({top:c.height-p,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:m},{box:c,classes:["ML__center"]}]}):i.above&&(a=new Er({bottom:c.depth+p,children:[{box:c,classes:["ML__center"]},r,{box:i.above,classes:m},e.metrics.bigOpSpacing5]}));return new Mt(a,{type:i.type})}var Ol=class pm extends Qe{constructor(i){var r,a,c,p;super(f(P({},i),{type:"phantom"})),this.captureSelection=!0,this.isInvisible=(r=i.isInvisible)!=null?r:!1,this.smashDepth=(a=i.smashDepth)!=null?a:!1,this.smashHeight=(c=i.smashHeight)!=null?c:!1,this.smashWidth=(p=i.smashWidth)!=null?p:!1}static fromJson(i){return new pm(i)}toJson(){const i={};return this.isInvisible&&(i.isInvisible=!0),this.smashDepth&&(i.smashDepth=!0),this.smashHeight&&(i.smashHeight=!0),this.smashWidth&&(i.smashWidth=!0),P(P({},super.toJson()),i)}render(i){const r=new sn({parent:i,isPhantom:!0});if(!this.smashDepth&&!this.smashHeight&&!this.smashWidth)return console.assert(this.isInvisible),Qe.createBox(r,this.body,{classes:"inner"});const a=Qe.createBox(this.isInvisible?r:i,this.body);if(!a)return null;if(this.smashWidth){const c=new Mt(null,{classes:"fix"});return new Mt([a,c],{classes:"rlap"}).wrap(i)}if(!this.smashHeight&&!this.smashDepth)return a;if(this.smashHeight&&(a.height=0),this.smashDepth&&(a.depth=0),a.children)for(const c of a.children)this.smashHeight&&(c.height=0),this.smashDepth&&(c.depth=0);return new Er({firstBaseline:[{box:a}]},{type:a.type}).wrap(i)}},yo=class mm extends Qe{constructor(i){var r;super(P({type:"spacing"},i)),this.width=i==null?void 0:i.width,this._braced=(r=i==null?void 0:i.braced)!=null?r:!1}static fromJson(i){return new mm(i)}toJson(){const i=super.toJson();return this.width!==void 0&&(i.width=this.width),this._braced&&(i.braced=!0),i}render(i){var r;if(this.command==="space")return new Mt(this.mode==="math"?null:" ");let a;if(this.width!==void 0)a=new Mt(null,{classes:"mspace"}),a.left=i.toEm(this.width);else{const c=(r={"\\qquad":"qquad","\\quad":"quad","\\enspace":"enspace","\\;":"thickspace","\\:":"mediumspace","\\>":"mediumspace","\\,":"thinspace","\\!":"negativethinspace"}[this.command])!=null?r:"mediumspace";a=new Mt(null,{classes:c})}return a=this.bind(i,a),this.caret&&(a.caret=this.caret),a}_serialize(i){var r;if(!i.expandMacro&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const a=Ce(this.command,this.mode);if(a!=null&&a.serialize)return a.serialize(this,i);const c=(r=this.command)!=null?r:"";return this.width===void 0?c:this._braced&&!("register"in this.width)?`${c}{${Mr(this.width)}}`:`${c}${Mr(this.width)}`}},lh=class gm extends Qe{constructor(i){var r;super(f(P({},i),{type:"surd",mode:(r=i.mode)!=null?r:"math",style:i.style,displayContainsHighlight:!0,body:i.body})),this.above=i.index}static fromJson(i){return new gm(f(P({},i),{index:i.above}))}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Ce(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,i);const a=this.command,c=this.bodyToLatex(i);return this.above&&!this.hasEmptyBranch("above")?Zn(`${a}[${this.aboveToLatex(i)}]`,c):/^[0-9]$/.test(c)?`${a}${c}`:Zn(a,c)}get children(){if(this._children)return this._children;const i=[];if(this.above)for(const r of this.above)i.push(...r.children),i.push(r);if(this.body)for(const r of this.body)i.push(...r.children),i.push(r);return this._children=i,i}render(i){var r;const a=new sn({parent:i,mathstyle:"cramp"},this.style),c=(r=Qe.createBox(a,this.body,{type:"inner"}))!=null?r:new Mt(null),p=a.scalingFactor,m=a.metrics.defaultRuleThickness/p,b=i.isDisplayStyle?da:m,w=new Mt(null,{classes:"ML__sqrt-line",style:this.style});w.height=m,w.softWidth=c.width;let E=p*(m+b/4);const N=Math.max(p*2*b,c.height+c.depth)+E+m,Z=new sn({parent:i},this.style),ue=this.bind(Z,new Mt(Gu("inner","\\surd",N,!1,Z,{isSelected:this.isSelected}),{isSelected:this.isSelected,classes:"ML__sqrt-sign",style:this.style}));if(!ue)return null;const me=ue.height+ue.depth-m;me>c.height+c.depth+E&&(E=(E+me-(c.height+c.depth))/2),ue.setTop(ue.height-c.height-E);const Ge=this.bind(i,new Er({firstBaseline:[{box:new Mt(c)},E-2*m,{box:w},m]})),Lt=Qe.createBox(new sn({parent:i,mathstyle:"scriptscriptstyle"}),this.above,{type:"ignore"});if(!Lt){const Rt=new Mt([ue,Ge],{classes:this.containsCaret?"ML__contains-caret":"",type:"inner"});return Rt.setStyle("display","inline-block"),Rt.setStyle("height",Rt.height+Rt.depth,"em"),this.caret&&(Rt.caret=this.caret),this.bind(i,Rt)}const Ue=new Er({shift:-.6*(Math.max(ue.height,Ge.height)-Math.max(ue.depth,Ge.depth)),children:[{box:Lt}]}),ct=new Mt([new Mt(Ue,{classes:"ML__sqrt-index",type:"ignore"}),ue,Ge],{type:"inner",classes:this.containsCaret?"ML__contains-caret":""});return ct.height=ue.height,ct.depth=ue.depth,this.caret&&(ct.caret=this.caret),this.bind(i,ct)}},Pf=class extends Mt{constructor(e){super(null,{type:"skip"}),this._width=e}toMarkup(){return`<span style="display:inline-block;width:${Math.ceil(this.width*100)/100}em"></span>`}};function Xu(e,i){if(!e.parent)return;const r=e.parent.children,a=r.indexOf(e);let c=a-1;for(;c>=0&&r[c].type==="ignore";)c-=1;if(c<0&&e.parent.parent&&e.parent.type==="lift"){Xu(e.parent,i);return}a>0&&r[a-1].type==="skip"?r[a-1].width+=i:r.splice(a,0,new Pf(i))}var uh={ord:{op:3,bin:4,rel:5,inner:3},op:{ord:3,op:3,rel:5,inner:3},bin:{ord:4,op:4,open:4,inner:4},rel:{ord:5,op:5,open:5,inner:5},close:{op:3,bin:4,rel:5,inner:3},punct:{ord:3,op:3,rel:3,open:3,punct:3,inner:3},inner:{ord:3,op:3,bin:4,rel:5,open:3,punct:3,inner:3}},Of={ord:{op:3},op:{ord:3,op:3},close:{op:3},inner:{op:3}};function ch(e){Bl(e,(i,r)=>{r.type==="bin"&&(!i||/^(middle|bin|op|rel|open|punct)$/.test(i.type))&&(r.type="ord"),(i==null?void 0:i.type)==="bin"&&/^(rel|close|punct)$/.test(r.type)&&(i.type="ord"),r.type!=="ignore"&&(i=r)})}function Fl(e,i){if(!e.children)return e;const r=e.children;ch(r);const a=i.getRegisterAsEm("thinmuskip"),c=i.getRegisterAsEm("medmuskip"),p=i.getRegisterAsEm("thickmuskip");return Bl(r,(m,b)=>{var w,E,I;if(!m)return;const N=m.type,Z=b.isTight?(w=Of[N])!=null?w:null:(E=uh[N])!=null?E:null,ue=(I=Z==null?void 0:Z[b.type])!=null?I:null;ue===3&&Xu(b,a),ue===4&&Xu(b,c),ue===5&&Xu(b,p)}),e}function Bl(e,i,r=void 0){if(!e)return r;e=[...e];for(const a of e)a.type==="lift"?r=Bl(a.children,i,r):a.type==="ignore"?Bl(a.children,i):(i(r,a),Bl(a.children,i),r=a);return r}var il=class _m extends Qe{constructor(i){super({type:"tooltip",command:i.command,mode:i.mode,style:i.style,body:i.body,displayContainsHighlight:!0}),this.tooltip=new Qe({type:"root",mode:i.content,body:i.tooltip,style:{}}),this.skipBoundary=!0,this.captureSelection=!1}static fromJson(i){return new _m(f(P({},i),{tooltip:_a(i.tooltip)}))}toJson(){var i;const r=(i=this.tooltip.body)==null?void 0:i.filter(a=>a.type!=="first").map(a=>a.toJson());return f(P({},super.toJson()),{tooltip:r})}render(i){const r=Qe.createBox(new sn,this.body);if(!r)return null;const a=new sn({parent:i,mathstyle:"displaystyle"},{fontSize:Ho}),c=Du(Fl(new Mt(this.tooltip.render(a),{classes:"ML__tooltip-content"}),a)),p=new Mt([c,r],{classes:"ML__tooltip-container"});return this.caret&&(p.caret=this.caret),this.bind(i,p)}},bo=class vm extends Qe{constructor(i,r){super(f(P({},r),{type:"operator",isFunction:r==null?void 0:r.isFunction})),this.value=i,this.variant=r==null?void 0:r.variant,this.variantStyle=r==null?void 0:r.variantStyle,this.subsupPlacement=r==null?void 0:r.limits}static fromJson(i){return new vm(i.symbol,i)}toJson(){const i=super.toJson();return this.variant&&(i.variant=this.variant),this.variantStyle&&(i.variantStyle=this.variantStyle),this.subsupPlacement&&(i.limits=this.subsupPlacement),this.value&&(i.symbol=this.value),i}render(i){var r;const a=new Mt(this.value,{type:"op",mode:"math",maxFontSize:i.scalingFactor,style:{variant:this.variant,variantStyle:this.variantStyle},isSelected:this.isSelected,letterShapeStyle:i.letterShapeStyle});let c=a;if(this.superscript||this.subscript){const p=(r=this.subsupPlacement)!=null?r:"auto";c=p==="over-under"||p==="auto"&&i.isDisplayStyle?this.attachLimits(i,{base:a}):this.attachSupsub(i,{base:a})}return new Mt(this.bind(i,c),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(i)}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Ce(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,i);const a=[this.command];return this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&a.push("\\limits"),this.subsupPlacement==="adjacent"&&a.push("\\nolimits"),this.subsupPlacement==="auto"&&a.push("\\displaylimits")),a.push(this.supsubToLatex(i)),un(a)}};function _a(e){if(k(e))return e.map(a=>_a(a));if(typeof e=="string")return Qe.fromJson(e);e=P({},e);for(const a of Zo)e[a]&&(e[a]=_a(e[a]));e.args&&(e.args=Ff(e.args)),e.array&&(e.array=_a(e.array));const i=e.type;let r;i==="accent"&&(r=Uu.fromJson(e)),i==="array"&&(r=kn.fromJson(e)),i==="box"&&(r=Oa.fromJson(e)),i==="chem"&&(r=rh.fromJson(e)),i==="composition"&&(r=Tf.fromJson(e)),i==="delim"&&(r=If.fromJson(e)),i==="enclose"&&(r=Pl.fromJson(e)),i==="error"&&(r=Es.fromJson(e)),i==="extensible-symbol"&&(r=Yu.fromJson(e)),i==="genfrac"&&(r=tl.fromJson(e)),i==="group"&&(r=ih.fromJson(e)),i==="latex"&&(r=Ir.fromJson(e)),i==="latexgroup"&&(r=vo.fromJson(e)),i==="leftright"&&(r=rr.fromJson(e)),i==="macro"&&(r=ju.fromJson(e)),i==="macro-argument"&&(r=Lf.fromJson(e)),i==="operator"&&(r=bo.fromJson(e)),i==="overlap"&&(r=Fa.fromJson(e)),i==="overunder"&&(r=Ps.fromJson(e)),i==="placeholder"&&(r=ea.fromJson(e)),i==="prompt"&&(r=nh.fromJson(e)),i==="phantom"&&(r=Ol.fromJson(e)),i==="sizeddelim"&&(r=ah.fromJson(e)),i==="spacing"&&(r=yo.fromJson(e)),i==="subsup"&&(r=_o.fromJson(e)),i==="surd"&&(r=lh.fromJson(e)),i==="text"&&(r=Ll.fromJson(e)),i==="tooltip"&&(r=il.fromJson(e)),r||(console.assert(!i||["first","mbin","mrel","mclose","minner","mop","mopen","mord","mpunct","root","space"].includes(i),`MathLive 0.98.5: an unexpected atom type "${i}" was encountered. Add new atom constructors to \`fromJson()\` in "atom.ts"`),r=Qe.fromJson(e));for(const a of Zo)e[a]&&r.setChildren(e[a],a);return e.verbatimLatex!==void 0&&(r.verbatimLatex=e.verbatimLatex),e.subsupPlacement&&(r.subsupPlacement=e.subsupPlacement),e.explicitSubsupPlacement&&(r.explicitSubsupPlacement=!0),e.isFunction&&(r.isFunction=!0),e.isExtensibleSymbol&&(r.isExtensibleSymbol=!0),e.skipBoundary&&(r.skipBoundary=!0),e.captureSelection&&(r.captureSelection=!0),r}function Ff(e){if(e&&Array.isArray(e))return e.map(i=>i==="<null>"?null:typeof i=="object"&&"group"in i?{group:i.group.map(r=>_a(r))}:typeof i=="object"&&"atoms"in i?i.atoms.map(r=>_a(r)):i)}var Bf={main:["Main-Regular","ML__cmr"],"main-italic":["Main-Italic","ML__cmr ML__it"],"main-bold":["Main-Bold","ML__cmr ML__bold"],"main-bolditalic":["Main-BoldItalic","ML__cmr ML__bold ML__it"],normal:["Main-Regular","ML__cmr"],"normal-bold":["Main-Bold","ML__mathbf"],"normal-italic":["Math-Italic","ML__mathit"],"normal-bolditalic":["Math-BoldItalic","ML__mathbfit"],ams:["AMS-Regular","ML__ams"],"ams-bold":["AMS-Regular","ML__ams"],"ams-italic":["AMS-Regular","ML__ams"],"ams-bolditalic":["AMS-Regular","ML__ams"],"sans-serif":["SansSerif-Regular","ML__sans"],"sans-serif-bold":["SansSerif-Regular","ML__sans ML__bold"],"sans-serif-italic":["SansSerif-Regular","ML__sans"],"sans-serif-bolditalic":["SansSerif-Regular","ML__sans"],calligraphic:["Caligraphic-Regular","ML__cal"],"calligraphic-bold":["Caligraphic-Regular","ML__cal ML__bold"],"calligraphic-italic":["Caligraphic-Regular","ML__cal ML__it"],"calligraphic-bolditalic":["Caligraphic-Regular","ML__cal ML__bold ML__it"],script:["Script-Regular","ML__script"],"script-bold":["Script-Regular","ML__script ML__bold"],"script-italic":["Script-Regular","ML__script ML__it"],"script-bolditalic":["Script-Regular","ML__script ML__bold ML__it"],fraktur:["Fraktur-Regular","ML__frak"],"fraktur-bold":["Fraktur-Regular","ML__frak"],"fraktur-italic":["Fraktur-Regular","ML__frak"],"fraktur-bolditalic":["Fraktur-Regular","ML__frak"],monospace:["Typewriter-Regular","ML__tt"],"monospace-bold":["Typewriter-Regular","ML__tt ML__bold"],"monospace-italic":["Typewriter-Regular","ML__tt ML__it"],"monospace-bolditalic":["Typewriter-Regular","ML__tt ML__bold ML__it"],"double-struck":["AMS-Regular","ML__bb"],"double-struck-bold":["AMS-Regular","ML__bb"],"double-struck-italic":["AMS-Regular","ML__bb"],"double-struck-bolditalic":["AMS-Regular","ML__bb"]},Ju={"double-struck":/^[A-Z ]$/,script:/^[A-Z ]$/,calligraphic:/^[\dA-Z ]$/,fraktur:/^[\dA-Za-z ]$|^[!"#$%&'()*+,\-./:;=?[]^’‘]$/,monospace:/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/,"sans-serif":/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/},Nf=/^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/,Gd=/^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/,Hd=[/^[a-z]$/,/^[A-Z]$/,Nf,Gd],Wd={iso:["it","it","it","it"],tex:["it","it","it","up"],french:["it","up","up","up"],upright:["up","up","up","up"]},$f=class extends ws{constructor(){super("math")}createAtom(e,i,r){var a,c,p,m;if(i===null)return new Qe({type:"mord",mode:"math",command:e,value:e,style:r});const b=window.MathfieldElement.isFunction((a=i.command)!=null?a:e);if(i.definitionType==="symbol"){const E=new Qe({type:(c=i.type)!=null?c:"mord",mode:"math",command:(p=i.command)!=null?p:e,value:String.fromCodePoint(i.codepoint),style:r});return b&&(E.isFunction=!0),e.startsWith("\\")&&(E.verbatimLatex=e),E}const w=new Qe({type:"mord",mode:"math",command:(m=i.command)!=null?m:e,value:e,style:r});return b&&(w.isFunction=!0),e.startsWith("\\")&&(w.verbatimLatex=e),w}serialize(e,i){const r=jd(e,f(P({},i),{defaultMode:"math"}));return r.length===0||i.defaultMode!=="text"?r:["$ ",...r," $"]}getFont(e,i){console.assert(i.variant!==void 0);let{variant:r}=i,{variantStyle:a}=i;r==="normal"&&!a&&/[\u00A3\u0131\u0237]/.test(e.value)&&(r="main",a="italic"),r==="normal"&&!a&&e.value.length===1&&Hd.forEach((b,w)=>{var E;b.test(e.value)&&Wd[(E=i.letterShapeStyle)!=null?E:"tex"][w]==="it"&&(a="italic")}),a==="up"&&(a=void 0);const c=a?r+"-"+a:r;console.assert(Bf[c]!==void 0);const[p,m]=Bf[c];return Ju[r]&&!Ju[r].test(e.value)?(e.value=ze(e.value,r,a),null):(Nf.test(e.value)&&(e.classes+=" lcGreek"),m&&(e.classes+=" "+m),p)}};function jd(e,i){const{parent:r}=e[0],a=Kf(r);return pa(e,"variant").map(c=>{const p=Kf(c[0]);let m="";p&&p!==a&&(m={calligraphic:"\\mathcal",fraktur:"\\mathfrak","double-struck":"\\mathbb",script:"\\mathscr",monospace:"\\mathtt","sans-serif":"\\mathsf",normal:"\\mathrm","normal-italic":"\\mathnormal","normal-bold":"\\mathbf","normal-bolditalic":"\\mathbfit",ams:"","ams-italic":"\\mathit","ams-bold":"\\mathbf","ams-bolditalic":"\\mathbfit",main:"","main-italic":"\\mathit","main-bold":"\\mathbf","main-bolditalic":"\\mathbfit"}[p],console.assert(m!==void 0));const b=un(c.map(w=>w._serialize(i)));return m?Zn(m,b):b})}function Kf(e){if(!e)return"";const{style:i}=e;if(i.variant===void 0)return"";let r=i.variant;return!["calligraphic","fraktur","double-struck","script","monospace","sans-serif"].includes(i.variant)&&i.variantStyle&&i.variantStyle!=="up"&&(r+="-"+i.variantStyle),r}new $f;function qd(e,i){return e.map(r=>r._serialize(i))}function Zd(e,i){return pa(e,"fontShape").map(r=>{const a=qd(r,i),{fontShape:c}=r[0].style;let p="";return c==="it"&&(p="\\textit"),c==="sl"&&(p="\\textsl"),c==="sc"&&(p="\\textsc"),c==="n"&&(p="\\textup"),!p&&c?`{${Zn("\\fontshape",c)}${un(a)}}`:p?Zn(p,un(a)):un(a)})}function Yd(e,i){return pa(e,"fontSeries").map(r=>{const a=Zd(r,i),{fontSeries:c}=r[0].style;let p="";return c==="b"&&(p="\\textbf"),c==="l"&&(p="\\textlf"),c==="m"&&(p="\\textmd"),c&&!p?`{${Zn("\\fontseries",c)}${un(a)}}`:p?Zn(p,un(a)):un(a)})}function Xd(e,i){return pa(e,"fontSize").map(r=>{var a,c;const p=Yd(r,i),m=(c=["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][(a=r[0].style.fontSize)!=null?a:""])!=null?c:"";return m?`${m} ${un(p)}`:un(p)})}function Uf(e,i,r){return pa(e,"fontFamily").map(a=>{var c,p;const m=Xd(a,i),b=(p={roman:"textrm",monospace:"texttt","sans-serif":"textsf"}[(c=a[0].style.fontFamily)!=null?c:""])!=null?p:"";return b?`\\${b}{${un(m)}}`:a[0].style.fontFamily?`{\\fontfamily{${a[0].style.fontFamily}} ${un(m)}}`:r?`\\text{${un(m)}}`:un(m)})}var zf={roman:"","sans-serif":"ML__sans",monospace:"ML__tt"},Jd=class extends ws{constructor(){super("text")}createAtom(e,i,r){return i&&i.definitionType==="symbol"?new Ll(e,String.fromCodePoint(i.codepoint),r!=null?r:{}):null}serialize(e,i){return Uf(e,f(P({},i),{defaultMode:"text"}),i.defaultMode!=="text")}getFont(e,i){var r,a,c,p,m;const{fontFamily:b}=i;if(zf[b]?e.classes+=" "+zf[b]:b&&e.setStyle("font-family",b),i.fontShape&&(e.classes+=" ",e.classes+=(r={it:"ML__it",sl:"ML__shape_sl",sc:"ML__shape_sc",ol:"ML__shape_ol"}[i.fontShape])!=null?r:""),i.fontSeries){const w=i.fontSeries.match(/(.?[lbm])?(.?[cx])?/);w&&(e.classes+=" ",e.classes+=(c={ul:"ML__series_ul",el:"ML__series_el",l:"ML__series_l",sl:"ML__series_sl",m:"",sb:"ML__series_sb",b:"ML__bold",eb:"ML__series_eb",ub:"ML__series_ub"}[(a=w[1])!=null?a:""])!=null?c:"",e.classes+=" ",e.classes+=(m={uc:"ML__series_uc",ec:"ML__series_ec",c:"ML__series_c",sc:"ML__series_sc",n:"",sx:"ML__series_sx",x:"ML__series_x",ex:"ML__series_ex",ux:"ML__series_ux"}[(p=w[2])!=null?p:""])!=null?m:"")}return"Main-Regular"}};new Jd;var Qd=class extends ws{constructor(){super("latex")}createAtom(e){return new Ir(e)}serialize(e,i){return e.filter(r=>r instanceof Ir&&!r.isSuggestion).map(r=>r.value)}getFont(){return null}};new Qd;var e0={id:"dvorak",locale:"en",displayName:"Dvorak",virtualLayout:"dvorak",platform:"",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["x","X","\u2248","\u02DB"],KeyC:["j","J","\u2206","\xD4"],KeyD:["e","E","\xB4","\xB4"],KeyE:[".",">","\u2265","\u02D8"],KeyF:["u","U","\xA8","\xA8"],KeyG:["i","I","\u02C6","\u02C6"],KeyH:["d","D","\u2202","\xCE"],KeyI:["c","C","\xE7","\xC7"],KeyJ:["h","H","\u02D9","\xD3"],KeyK:["t","T","\u2020","\u02C7"],KeyL:["n","N","\u02DC","\u02DC"],KeyM:["m","M","\xB5","\xC2"],KeyN:["b","B","\u222B","\u0131"],KeyO:["r","R","\xAE","\u2030"],KeyP:["l","L","\xAC","\xD2"],KeyQ:["'",'"',"\xE6","\xC6"],KeyR:["p","P","\u03C0","\u220F"],KeyS:["o","O","\xF8","\xD8"],KeyT:["y","Y","\xA5","\xC1"],KeyU:["g","G","\xA9","\u02DD"],KeyV:["k","K","\u02DA","\uF8FF"],KeyW:[",","<","\u2264","\xAF"],KeyX:["q","Q","\u0153","\u0152"],KeyY:["f","F","\u0192","\xCF"],KeyZ:[";",":","\u2026","\xDA"],Digit1:["1","!","\xA1","\u2044"],Digit2:["2","@","\u2122","\u20AC"],Digit3:["3","#","\xA3","\u2039"],Digit4:["4","$","\xA2","\u203A"],Digit5:["5","%","\u221E","\uFB01"],Digit6:["6","^","\xA7","\uFB02"],Digit7:["7","&","\xB6","\u2021"],Digit8:["8","*","\u2022","\xB0"],Digit9:["9","(","\xAA","\xB7"],Digit0:["0",")","\xBA","\u201A"],Space:[" "," "," "," "],Minus:["[","{","\u201C","\u201D"],Equal:["]","}","\u2018","\u2019"],BracketLeft:["/","?","\xF7","\xBF"],BracketRight:["=","+","\u2260","\xB1"],Backslash:["\\","|","\xAB","\xBB"],Semicolon:["s","S","\xDF","\xCD"],Quote:["-","_","\u2013","\u2014"],Backquote:["`","~","`","`"],Comma:["w","W","\u2211","\u201E"],Period:["v","V","\u221A","\u25CA"],Slash:["z","Z","\u03A9","\xB8"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["\xA7","\xB1","\xA7","\xB1"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},Nl={id:"apple.en-intl",displayName:"English (international)",virtualLayout:"qwerty",platform:"apple",locale:"en",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\u222B","\u0131"],KeyC:["c","C","\xE7","\xC7"],KeyD:["d","D","\u2202","\xCE"],KeyE:["e","E","\xB4","\xB4"],KeyF:["f","F","\u0192","\xCF"],KeyG:["g","G","\xA9","\u02DD"],KeyH:["h","H","\u02D9","\xD3"],KeyI:["i","I","\u02C6","\u02C6"],KeyJ:["j","J","\u2206","\xD4"],KeyK:["k","K","\u02DA","\uF8FF"],KeyL:["l","L","\xAC","\xD2"],KeyM:["m","M","\xB5","\xC2"],KeyN:["n","N","\u02DC","\u02DC"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\u0153","\u0152"],KeyR:["r","R","\xAE","\u2030"],KeyS:["s","S","\xDF","\xCD"],KeyT:["t","T","\u2020","\u02C7"],KeyU:["u","U","\xA8","\xA8"],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\u2211","\u201E"],KeyX:["x","X","\u2248","\u02DB"],KeyY:["y","Y","\xA5","\xC1"],KeyZ:["z","Z","\u03A9","\xB8"],Digit1:["1","!","\xA1","\u2044"],Digit2:["2","@","\u2122","\u20AC"],Digit3:["3","#","\xA3","\u2039"],Digit4:["4","$","\xA2","\u203A"],Digit5:["5","%","\u221E","\uFB01"],Digit6:["6","^","\xA7","\uFB02"],Digit7:["7","&","\xB6","\u2021"],Digit8:["8","*","\u2022","\xB0"],Digit9:["9","(","\xAA","\xB7"],Digit0:["0",")","\xBA","\u201A"],Space:[" "," "," "," "],Minus:["-","_","\u2013","\u2014"],Equal:["=","+","\u2260","\xB1"],BracketLeft:["[","{","\u201C","\u201D"],BracketRight:["]","}","\u2018","\u2019"],Backslash:["\\","|","\xAB","\xBB"],Semicolon:[";",":","\u2026","\xDA"],Quote:["'",'"',"\xE6","\xC6"],Backquote:["`","\u02DC","`","`"],Comma:[",","<","\u2264","\xAF"],Period:[".",">","\u2265","\u02D8"],Slash:["/","?","\xF7","\xBF"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["\xA7","\xB1","\xA7","\xB1"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},Vf={id:"windows.en-intl",displayName:"English (international)",platform:"windows",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","\xE1","\xC1"],KeyB:["b","B","",""],KeyC:["c","C","\xA9","\xA2"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\xE9","\xC9"],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","\xED","\xCD"],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","\xF8","\xD8"],KeyM:["m","M","\xB5",""],KeyN:["n","N","\xF1","\xD1"],KeyO:["o","O","\xF3","\xD3"],KeyP:["p","P","\xF6","\xD6"],KeyQ:["q","Q","\xE4","\xC4"],KeyR:["r","R","\xAE",""],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\xFE","\xDE"],KeyU:["u","U","\xFA","\xDA"],KeyV:["v","V","",""],KeyW:["w","W","\xE5","\xC5"],KeyX:["x","X","",""],KeyY:["y","Y","\xFC","\xDC"],KeyZ:["z","Z","\xE6","\xC6"],Digit1:["1","!","\xA1","\xB9"],Digit2:["2","@","\xB2",""],Digit3:["3","#","\xB3",""],Digit4:["4","$","\xA4","\xA3"],Digit5:["5","%","\u20AC",""],Digit6:["6","^","\xBC",""],Digit7:["7","&","\xBD",""],Digit8:["8","*","\xBE",""],Digit9:["9","(","\u2018",""],Digit0:["0",")","\u2019",""],Space:[" "," ","",""],Minus:["-","_","\xA5",""],Equal:["=","+","\xD7","\xF7"],BracketLeft:["[","{","\xAB",""],BracketRight:["]","}","\xBB",""],Backslash:["\\","|","\xAC","\xA6"],Semicolon:[";",":","\xB6","\xB0"],Quote:["'",'"',"\xB4","\xA8"],Backquote:["`","~","",""],Comma:[",","<","\xE7","\xC7"],Period:[".",">","",""],Slash:["/","?","\xBF",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["\\","|","",""]}},$l={id:"linux.en",displayName:"English",platform:"linux",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","a","A"],KeyB:["b","B","b","B"],KeyC:["c","C","c","C"],KeyD:["d","D","d","D"],KeyE:["e","E","e","E"],KeyF:["f","F","f","F"],KeyG:["g","G","g","G"],KeyH:["h","H","h","H"],KeyI:["i","I","i","I"],KeyJ:["j","J","j","J"],KeyK:["k","K","k","K"],KeyL:["l","L","l","L"],KeyM:["m","M","m","M"],KeyN:["n","N","n","N"],KeyO:["o","O","o","O"],KeyP:["p","P","p","P"],KeyQ:["q","Q","q","Q"],KeyR:["r","R","r","R"],KeyS:["s","S","s","S"],KeyT:["t","T","t","T"],KeyU:["u","U","u","U"],KeyV:["v","V","v","V"],KeyW:["w","W","w","W"],KeyX:["x","X","x","X"],KeyY:["y","Y","y","Y"],KeyZ:["z","Z","z","Z"],Digit1:["1","!","1","!"],Digit2:["2","@","2","@"],Digit3:["3","#","3","#"],Digit4:["4","$","4","$"],Digit5:["5","%","5","%"],Digit6:["6","^","6","^"],Digit7:["7","&","7","&"],Digit8:["8","*","8","*"],Digit9:["9","(","9","("],Digit0:["0",")","0",")"],Space:[" "," "," "," "],Minus:["-","_","-","_"],Equal:["=","+","=","+"],BracketLeft:["[","{","[","{"],BracketRight:["]","}","]","}"],Backslash:["\\","|","\\","|"],Semicolon:[";",":",";",":"],Quote:["'",'"',"'",'"'],Backquote:["`","~","`","~"],Comma:[",","<",",","<"],Period:[".",">",".",">"],Slash:["/","?","/","?"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}},t0={id:"apple.french",locale:"fr",displayName:"French",platform:"apple",virtualLayout:"azerty",score:0,mapping:{KeyA:["q","Q","\u2021","\u03A9"],KeyB:["b","B","\xDF","\u222B"],KeyC:["c","C","\xA9","\xA2"],KeyD:["d","D","\u2202","\u2206"],KeyE:["e","E","\xEA","\xCA"],KeyF:["f","F","\u0192","\xB7"],KeyG:["g","G","\uFB01","\uFB02"],KeyH:["h","H","\xCC","\xCE"],KeyI:["i","I","\xEE","\xEF"],KeyJ:["j","J","\xCF","\xCD"],KeyK:["k","K","\xC8","\xCB"],KeyL:["l","L","\xAC","|"],KeyM:[",","?","\u221E","\xBF"],KeyN:["n","N","~","\u0131"],KeyO:["o","O","\u0153","\u0152"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["a","A","\xE6","\xC6"],KeyR:["r","R","\xAE","\u201A"],KeyS:["s","S","\xD2","\u2211"],KeyT:["t","T","\u2020","\u2122"],KeyU:["u","U","\xBA","\xAA"],KeyV:["v","V","\u25CA","\u221A"],KeyW:["z","Z","\xC2","\xC5"],KeyX:["x","X","\u2248","\u2044"],KeyY:["y","Y","\xDA","\u0178"],KeyZ:["w","W","\u2039","\u203A"],Digit1:["&","1","\uF8FF","\xB4"],Digit2:["\xE9","2","\xEB","\u201E"],Digit3:['"',"3","\u201C","\u201D"],Digit4:["'","4","\u2018","\u2019"],Digit5:["(","5","{","["],Digit6:["\xA7","6","\xB6","\xE5"],Digit7:["\xE8","7","\xAB","\xBB"],Digit8:["!","8","\xA1","\xDB"],Digit9:["\xE7","9","\xC7","\xC1"],Digit0:["\xE0","0","\xF8","\xD8"],Space:[" "," "," "," "],Minus:[")","\xB0","}","]"],Equal:["-","_","\u2014","\u2013"],BracketLeft:["^","\xA8","\xF4","\xD4"],BracketRight:["$","*","\u20AC","\xA5"],Backslash:["`","\xA3","@","#"],Semicolon:["m","M","\xB5","\xD3"],Quote:["\xF9","%","\xD9","\u2030"],Backquote:["<",">","\u2264","\u2265"],Comma:[";",".","\u2026","\u2022"],Period:[":","/","\xF7","\\"],Slash:["=","+","\u2260","\xB1"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",".",",","."],IntlBackslash:["@","#","\u2022","\u0178"],NumpadEqual:["=","=","=","="]}},i0={id:"windows.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"windows",score:0,mapping:{KeyA:["q","Q","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:[",","?","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["a","A","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["z","Z","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["w","W","",""],Digit1:["&","1","",""],Digit2:["\xE9","2","~",""],Digit3:['"',"3","#",""],Digit4:["'","4","{",""],Digit5:["(","5","[",""],Digit6:["-","6","|",""],Digit7:["\xE8","7","`",""],Digit8:["_","8","\\",""],Digit9:["\xE7","9","^",""],Digit0:["\xE0","0","@",""],Space:[" "," ","",""],Minus:[")","\xB0","]",""],Equal:["=","+","}",""],BracketLeft:["^","\xA8","",""],BracketRight:["$","\xA3","\xA4",""],Backslash:["*","\xB5","",""],Semicolon:["m","M","",""],Quote:["\xF9","%","",""],Backquote:["\xB2","","",""],Comma:[";",".","",""],Period:[":","/","",""],Slash:["!","\xA7","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}},n0={id:"linux.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"linux",score:0,mapping:{KeyA:["q","Q","@","\u03A9"],KeyB:["b","B","\u201D","\u2019"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\xA2"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0309","\u031B"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:[",","?","\u0301","\u030B"],KeyN:["n","N","n","N"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["a","A","\xE6","\xC6"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201C","\u2018"],KeyW:["z","Z","\xAB","<"],KeyX:["x","X","\xBB",">"],KeyY:["y","Y","\u2190","\xA5"],KeyZ:["w","W","\u0142","\u0141"],Digit1:["&","1","\xB9","\xA1"],Digit2:["\xE9","2","~","\u215B"],Digit3:['"',"3","#","\xA3"],Digit4:["'","4","{","$"],Digit5:["(","5","[","\u215C"],Digit6:["-","6","|","\u215D"],Digit7:["\xE8","7","`","\u215E"],Digit8:["_","8","\\","\u2122"],Digit9:["\xE7","9","^","\xB1"],Digit0:["\xE0","0","@","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:[")","\xB0","]","\xBF"],Equal:["=","+","}","\u0328"],BracketLeft:["\u0302","\u0308","\u0308","\u030A"],BracketRight:["$","\xA3","\xA4","\u0304"],Backslash:["*","\xB5","\u0300","\u0306"],Semicolon:["m","M","\xB5","\xBA"],Quote:["\xF9","%","\u0302","\u030C"],Backquote:["\xB2","~","\xAC","\xAC"],Comma:[";",".","\u2500","\xD7"],Period:[":","/","\xB7","\xF7"],Slash:["!","\xA7","\u0323","\u0307"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"]}},r0={id:"apple.german",locale:"de",displayName:"German",virtualLayout:"qwertz",platform:"apple",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\u222B","\u2039"],KeyC:["c","C","\xE7","\xC7"],KeyD:["d","D","\u2202","\u2122"],KeyE:["e","E","\u20AC","\u2030"],KeyF:["f","F","\u0192","\xCF"],KeyG:["g","G","\xA9","\xCC"],KeyH:["h","H","\xAA","\xD3"],KeyI:["i","I","\u2044","\xDB"],KeyJ:["j","J","\xBA","\u0131"],KeyK:["k","K","\u2206","\u02C6"],KeyL:["l","L","@","\uFB02"],KeyM:["m","M","\xB5","\u02D8"],KeyN:["n","N","~","\u203A"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\xAB","\xBB"],KeyR:["r","R","\xAE","\xB8"],KeyS:["s","S","\u201A","\xCD"],KeyT:["t","T","\u2020","\u02DD"],KeyU:["u","U","\xA8","\xC1"],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\u2211","\u201E"],KeyX:["x","X","\u2248","\xD9"],KeyY:["z","Z","\u03A9","\u02C7"],KeyZ:["y","Y","\xA5","\u2021"],Digit1:["1","!","\xA1","\xAC"],Digit2:["2",'"',"\u201C","\u201D"],Digit3:["3","\xA7","\xB6","#"],Digit4:["4","$","\xA2","\xA3"],Digit5:["5","%","[","\uFB01"],Digit6:["6","&","]","^"],Digit7:["7","/","|","\\"],Digit8:["8","(","{","\u02DC"],Digit9:["9",")","}","\xB7"],Digit0:["0","=","\u2260","\xAF"],Space:[" "," "," "," "],Minus:["\xDF","?","\xBF","\u02D9"],Equal:["\xB4","`","'","\u02DA"],BracketLeft:["\xFC","\xDC","\u2022","\xB0"],BracketRight:["+","*","\xB1","\uF8FF"],Backslash:["#","'","\u2018","\u2019"],Semicolon:["\xF6","\xD6","\u0153","\u0152"],Quote:["\xE4","\xC4","\xE6","\xC6"],Backquote:["<",">","\u2264","\u2265"],Comma:[",",";","\u221E","\u02DB"],Period:[".",":","\u2026","\xF7"],Slash:["-","_","\u2013","\u2014"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",",",".","."],IntlBackslash:["^","\xB0","\u201E","\u201C"],NumpadEqual:["=","=","=","="]}},Gf={id:"windows.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","\xB5",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","@",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["z","Z","",""],KeyZ:["y","Y","",""],Digit1:["1","!","",""],Digit2:["2",'"',"\xB2",""],Digit3:["3","\xA7","\xB3",""],Digit4:["4","$","",""],Digit5:["5","%","",""],Digit6:["6","&","",""],Digit7:["7","/","{",""],Digit8:["8","(","[",""],Digit9:["9",")","]",""],Digit0:["0","=","}",""],Space:[" "," ","",""],Minus:["\xDF","?","\\","\u1E9E"],Equal:["\xB4","`","",""],BracketLeft:["\xFC","\xDC","",""],BracketRight:["+","*","~",""],Backslash:["#","'","",""],Semicolon:["\xF6","\xD6","",""],Quote:["\xE4","\xC4","",""],Backquote:["^","\xB0","",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","|",""]}},Hf={id:"linux.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","\xE6","\xC6"],KeyB:["b","B","\u201C","\u2018"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\u20AC"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0323","\u0307"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:["m","M","\xB5","\xBA"],KeyN:["n","N","\u201D","\u2019"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["q","Q","@","\u03A9"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\u017F","\u1E9E"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201E","\u201A"],KeyW:["w","W","\u0142","\u0141"],KeyX:["x","X","\xAB","\u2039"],KeyY:["z","Z","\u2190","\xA5"],KeyZ:["y","Y","\xBB","\u203A"],Digit1:["1","!","\xB9","\xA1"],Digit2:["2",'"',"\xB2","\u215B"],Digit3:["3","\xA7","\xB3","\xA3"],Digit4:["4","$","\xBC","\xA4"],Digit5:["5","%","\xBD","\u215C"],Digit6:["6","&","\xAC","\u215D"],Digit7:["7","/","{","\u215E"],Digit8:["8","(","[","\u2122"],Digit9:["9",")","]","\xB1"],Digit0:["0","=","}","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["\xDF","?","\\","\xBF"],Equal:["\u0301","\u0300","\u0327","\u0328"],BracketLeft:["\xFC","\xDC","\u0308","\u030A"],BracketRight:["+","*","~","\xAF"],Backslash:["#","'","\u2019","\u0306"],Semicolon:["\xF6","\xD6","\u030B","\u0323"],Quote:["\xE4","\xC4","\u0302","\u030C"],Backquote:["\u0302","\xB0","\u2032","\u2033"],Comma:[",",";","\xB7","\xD7"],Period:[".",":","\u2026","\xF7"],Slash:["-","_","\u2013","\u2014"],PrintScreen:["","","",""],PageUp:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",",","",","],IntlBackslash:["<",">","|","\u0331"],AltRight:["\r","\r","\r","\r"],MetaRight:[".",".",".","."]}},Qu={id:"apple.spanish",locale:"es",displayName:"Spanish ISO",platform:"apple",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\xDF",""],KeyC:["c","C","\xA9"," "],KeyD:["d","D","\u2202","\u2206"],KeyE:["e","E","\u20AC","\u20AC"],KeyF:["f","F","\u0192","\uFB01"],KeyG:["g","G","\uF8FF","\uFB02"],KeyH:["h","H","\u2122"," "],KeyI:["i","I"," "," "],KeyJ:["j","J","\xB6","\xAF"],KeyK:["k","K","\xA7","\u02C7"],KeyL:["l","L"," ","\u02D8"],KeyM:["m","M","\xB5","\u02DA"],KeyN:["n","N"," ","\u02D9"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\u0153","\u0152"],KeyR:["r","R","\xAE"," "],KeyS:["s","S","\u222B"," "],KeyT:["t","T","\u2020","\u2021"],KeyU:["u","U"," "," "],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\xE6","\xC6"],KeyX:["x","X","\u2211","\u203A"],KeyY:["y","Y","\xA5"," "],KeyZ:["z","Z","\u03A9","\u2039"],Digit1:["1","!","|","\u0131"],Digit2:["2",'"',"@","\u02DD"],Digit3:["3","\xB7","#","\u2022"],Digit4:["4","$","\xA2","\xA3"],Digit5:["5","%","\u221E","\u2030"],Digit6:["6","&","\xAC"," "],Digit7:["7","/","\xF7","\u2044"],Digit8:["8","(","\u201C","\u2018"],Digit9:["9",")","\u201D","\u2019"],Digit0:["0","=","\u2260","\u2248"],Space:[" "," "," "," "],Minus:["'","?","\xB4","\xB8"],Equal:["\xA1","\xBF","\u201A","\u02DB"],BracketLeft:["`","^","[","\u02C6"],BracketRight:["+","*","]","\xB1"],Backslash:["\xE7","\xC7","}","\xBB"],Semicolon:["\xF1","\xD1","~","\u02DC"],Quote:["\xB4","\xA8","{","\xAB"],Backquote:["<",">","\u2264","\u2265"],Comma:[",",";","\u201E",""],Period:[".",":","\u2026","\u2026"],Slash:["-","_","\u2013","\u2014"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[",",",",",",","],IntlBackslash:["\xBA","\xAA","\\","\xB0"]}},s0={id:"windows.spanish",locale:"es",displayName:"Spanish",platform:"windows",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["z","Z","",""],Digit1:["1","!","|",""],Digit2:["2",'"',"@",""],Digit3:["3","\xB7","#",""],Digit4:["4","$","~",""],Digit5:["5","%","\u20AC",""],Digit6:["6","&","\xAC",""],Digit7:["7","/","",""],Digit8:["8","(","",""],Digit9:["9",")","",""],Digit0:["0","=","",""],Space:[" "," ","",""],Minus:["'","?","",""],Equal:["\xA1","\xBF","",""],BracketLeft:["`","^","[",""],BracketRight:["+","*","]",""],Backslash:["\xE7","\xC7","}",""],Semicolon:["\xF1","\xD1","",""],Quote:["\xB4","\xA8","{",""],Backquote:["\xBA","\xAA","\\",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}},hh={id:"linux.spanish",locale:"es",displayName:"Spanish",platform:"linux",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","\xE6","\xC6"],KeyB:["b","B","\u201D","\u2019"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\xA2"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0309","\u031B"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:["m","M","\xB5","\xBA"],KeyN:["n","N","n","N"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["q","Q","@","\u03A9"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201C","\u2018"],KeyW:["w","W","\u0142","\u0141"],KeyX:["x","X","\xBB",">"],KeyY:["y","Y","\u2190","\xA5"],KeyZ:["z","Z","\xAB","<"],Digit1:["1","!","|","\xA1"],Digit2:["2",'"',"@","\u215B"],Digit3:["3","\xB7","#","\xA3"],Digit4:["4","$","~","$"],Digit5:["5","%","\xBD","\u215C"],Digit6:["6","&","\xAC","\u215D"],Digit7:["7","/","{","\u215E"],Digit8:["8","(","[","\u2122"],Digit9:["9",")","]","\xB1"],Digit0:["0","=","}","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["'","?","\\","\xBF"],Equal:["\xA1","\xBF","\u0303","~"],BracketLeft:["\u0300","\u0302","[","\u030A"],BracketRight:["+","*","]","\u0304"],Backslash:["\xE7","\xC7","}","\u0306"],Semicolon:["\xF1","\xD1","~","\u030B"],Quote:["\u0301","\u0308","{","{"],Backquote:["\xBA","\xAA","\\","\\"],Comma:[",",";","\u2500","\xD7"],Period:[".",":","\xB7","\xF7"],Slash:["-","_","\u0323","\u0307"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadEnter:["\r","\r","\r","\r"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}};function ec(e){const i=e.split("+"),r={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:i.pop()};return i.includes("shift")&&(r.shift=!0),i.includes("alt")&&(r.alt=!0),i.includes("ctrl")&&(r.ctrl=!0),i.includes("cmd")&&(r.cmd=!0),i.includes("win")&&(r.win=!0),i.includes("meta")&&(r.meta=!0),r}function va(e){let i="";return e.shift&&(i+="shift+"),e.alt&&(i+="alt+"),e.ctrl&&(i+="ctrl+"),e.cmd&&(i+="cmd+"),e.win&&(i+="win+"),e.meta&&(i+="meta+"),i+e.key}var a0={enter:"[Enter]",escape:"[Escape]",backspace:"[Backspace]",tab:"[Tab]",space:"[Space]",pausebreak:"[Pause]",insert:"[Insert]",home:"[Home]",pageup:"[PageUp]",delete:"[Delete]",end:"[End]",pagedown:"[PageDown]",right:"[ArrowRight]",left:"[ArrowLeft]",down:"[ArrowDown]",up:"[ArrowUp]",numpad0:"[Numpad0]",numpad1:"[Numpad1]",numpad2:"[Numpad2]",numpad3:"[Numpad3]",numpad4:"[Numpad4]",numpad5:"[Numpad5]",numpad6:"[Numpad6]",numpad7:"[Numpad7]",numpad8:"[Numpad8]",numpad9:"[Numpad9]",numpad_divide:"[NumpadDivide]",numpad_multiply:"[NumpadMultiply]",numpad_subtract:"[NumpadSubtract]",numpad_add:"[NumpadAdd]",numpad_decimal:"[NumpadDecimal]",numpad_separator:"[NumpadComma]",capslock:"[Capslock]",f1:"[F1]",f2:"[F2]",f3:"[F3]",f4:"[F4]",f5:"[F5]",f6:"[F6]",f7:"[F7]",f8:"[F8]",f9:"[F9]",f10:"[F10]",f11:"[F11]",f12:"[F12]",f13:"[F13]",f14:"[F14]",f15:"[F15]",f16:"[F16]",f17:"[F17]",f18:"[F18]",f19:"[F19]"},Kl=[],Ul;function tc(){switch(H()){case"macos":case"ios":return"apple";case"windows":return"windows"}return"linux"}function ps(e){(!e.platform||e.platform===tc())&&Kl.push(e)}function Wf(e,i){var r;const a={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:""};if(!e)return a;for(const[c,p]of Object.entries(i.mapping)){if(p[0]===e)return a.key=`[${c}]`,a;if(p[1]===e)return a.shift=!0,a.key=`[${c}]`,a;if(p[2]===e)return a.alt=!0,a.key=`[${c}]`,a;if(p[3]===e)return a.shift=!0,a.alt=!0,a.key=`[${c}]`,a}return a.key=(r=a0[e])!=null?r:"",a}function o0(e){if(e.code)return e;const i=Object.entries(zl().mapping);let r=!1,a=!1,c="";for(let p=0;p<4;p++){for(const[m,b]of i)if(b[p]===e.key){c=m,p===3?(r=!0,a=!0):p===2?r=!0:p===1&&(a=!0);break}if(c)break}return new KeyboardEvent(e.type,f(P({},e),{altKey:r,shiftKey:a,code:c}))}function l0(e){var i,r;if(!e||e.key==="Unidentified"||e.key==="Dead")return;const a=e.shiftKey&&e.altKey?3:e.altKey?2:e.shiftKey?1:0;for(const c of Kl)((i=c.mapping[e.code])==null?void 0:i[a])===e.key?c.score+=1:(r=c.mapping[e.code])!=null&&r[a]&&(c.score=0);Kl.sort((c,p)=>p.score-c.score)}function u0(e){Ul=Kl.find(i=>e.startsWith(i.locale))}function zl(){return Ul!=null?Ul:Kl[0]}function c0(){switch(tc()){case"apple":return Nl;case"windows":return Vf;case"linux":return $l}return Nl}switch(tc()){case"apple":ps(Nl),ps(t0),ps(Qu),ps(r0);break;case"windows":ps(Vf),ps(i0),ps(s0),ps(Gf);break;case"linux":ps($l),ps(n0),ps(hh),ps(Hf);break}ps(e0);function Vl(e){var i;const r=/macos|ios/.test(H()),a=e.split("+");let c="";for(const p of a)c&&(c+=r?"\u2009":'<span class="ML__shortcut-join">+</span>'),p.startsWith("[Key")?c+=p.slice(4,5):p.startsWith("Key")?c+=p.slice(3,4):p.startsWith("[Digit")?c+=p.slice(6,7):p.startsWith("Digit")?c+=p.slice(5,6):c+=(i={cmd:"\u2318",meta:r?"\u2318":"Ctrl",shift:r?"\u21E7":"Shift",alt:r?"\u2325":"Alt",ctrl:r?"\u2303":"Ctrl","\n":r?"\u23CE":"Return","[return]":r?"\u23CE":"Return","[enter]":r?"\u2324":"Enter","[tab]":r?"\u21E5":"Tab","[escape]":"Esc","[backspace]":r?"\u232B":"Backspace","[delete]":r?"\u2326":"Del","[pageup]":r?"\u21DE":"Page Up","[pagedown]":r?"\u21DF":"Page Down","[home]":r?"\u2912":"Home","[end]":r?"\u2913":"End","[space]":"Space","[equal]":"=","[minus]":"-","[comma]":",","[slash]":"/","[backslash]":"\\","[bracketleft]":"[","[bracketright]":"]",semicolon:";",period:".",comma:",",minus:"-",equal:"=",quote:"'",backslash:"\\",intlbackslash:"\\",backquote:"`",slash:"/",numpadmultiply:"* 🔢",numpaddivide:"/ 🔢",numpadsubtract:"- 🔢",numpadadd:"+ 🔢",numpaddecimal:". 🔢",numpadcomma:", 🔢",help:"help",left:"\u21E0",up:"\u21E1",right:"\u21E2",down:"\u21E3","[arrowleft]":"\u21E0","[arrowup]":"\u21E1","[arrowright]":"\u21E2","[arrowdown]":"\u21E3"}[p.toLowerCase()])!=null?i:p.toUpperCase();return c}function Gl(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return{x:e.clientX,y:e.clientY};if(e instanceof TouchEvent){const i=[...e.touches].reduce((a,c)=>({x:a.x+c.clientX,y:a.y+c.clientY}),{x:0,y:0}),r=e.touches.length;return{x:i.x/r,y:i.y/r}}}function ya(e){const i={alt:!1,control:!1,shift:!1,meta:!1};return(e instanceof MouseEvent||e instanceof PointerEvent||e instanceof TouchEvent||e instanceof KeyboardEvent)&&(e.altKey&&(i.alt=!0),e.ctrlKey&&(i.control=!0),e.metaKey&&(i.meta=!0),e.shiftKey&&(i.shift=!0)),i}function h0(e,i){return!e&&i||e&&!i?!1:!e||!i?!0:e.alt===i.alt&&e.control===i.control&&e.shift===i.shift&&e.meta===i.meta}var Ba=new Set(["Backquote","Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Minus","Equal","IntlYen","KeyQ","KeyW","KeyE","KeyR","KeyT","KeyY","KeyU","KeyI","KeyO","KeyP","BracketLeft","BracketRight","Backslash","KeyA","KeyS","KeyD","KeyF","KeyG","KeyH","KeyJ","KeyK","KeyL","Semicolon","Quote","IntlBackslash","KeyZ","KeyX","KeyC","KeyV","KeyB","KeyN","KeyM","Comma","Period","Slash","IntlRo","Space","Numpad0","Numpad1","Numpad2","Numpad3","Numpad4","Numpad5","Numpad6","Numpad7","Numpad8","Numpad9","NumpadAdd","NumpadComma","NumpadDecimal","NumpadDivide","NumpadEqual","NumpadHash","NumpadMultiply","NumpadParenLeft","NumpadParenRight","NumpadStar","NumpadSubstract"]);function h(e){return e.ctrlKey||e.metaKey||["Dead","Process"].includes(e.key)?!1:e.code===""?!0:Ba.has(e.code)}function t(){var e;let i=document.activeElement;for(;(e=i==null?void 0:i.shadowRoot)!=null&&e.activeElement;)i=i.shadowRoot.activeElement;return i}var n=class Ao{static get scrim(){return Ao._scrim||(Ao._scrim=new Ao),Ao._scrim}static open(i){Ao.scrim.open(i)}static close(){Ao.scrim.close()}static get state(){return Ao.scrim.state}static get element(){return Ao.scrim.element}constructor(i){var r,a;this.lightDismiss=(r=i==null?void 0:i.lightDismiss)!=null?r:!0,this.translucent=(a=i==null?void 0:i.translucent)!=null?a:!1,this.state="closed"}get element(){if(this._element)return this._element;const i=document.createElement("div");return i.setAttribute("role","presentation"),i.style.position="fixed",i.style.contain="content",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.zIndex="var(--scrim-zindex, 10099)",i.style.outline="none",this.translucent?(i.style.background="rgba(255, 255, 255, .2)",i.style.backdropFilter="contrast(40%)"):i.style.background="transparent",this._element=i,i}open(i){var r;if(this.state!=="closed")return;this.state="opening",this.onDismiss=i==null?void 0:i.onDismiss,this.savedActiveElement=t();const{element:a}=this;((r=i==null?void 0:i.root)!=null?r:document.body).appendChild(a),a.addEventListener("click",this),document.addEventListener("touchmove",this,!1),document.addEventListener("scroll",this,!1);const c=window.innerWidth-document.documentElement.clientWidth;this.savedMarginRight=document.body.style.marginRight,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden";const p=Number.parseFloat(getComputedStyle(document.body).marginRight);document.body.style.marginRight=`${p+c}px`,i!=null&&i.child&&a.append(i.child),this.state="open"}close(){var i,r,a,c;if(this.state!=="open"){console.assert(this.element.parentElement!==null);return}this.state="closing",typeof this.onDismiss=="function"&&this.onDismiss(),this.onDismiss=void 0;const{element:p}=this;p.removeEventListener("click",this),document.removeEventListener("touchmove",this,!1),document.removeEventListener("scroll",this,!1),p.remove(),document.body.style.overflow=(i=this.savedOverflow)!=null?i:"",document.body.style.marginRight=(r=this.savedMarginRight)!=null?r:"",t()!==this.savedActiveElement&&((c=(a=this.savedActiveElement)==null?void 0:a.focus)==null||c.call(a)),p.innerHTML="",this.state="closed"}handleEvent(i){this.lightDismiss&&(i.target===this._element&&i.type==="click"?(this.close(),i.preventDefault(),i.stopPropagation()):i.target===document&&(i.type==="touchmove"||i.type==="scroll")&&(this.close(),i.preventDefault(),i.stopPropagation()))}};function s(e,i,r){let a=null,c=null,p=!1,m=!1,b=!1;const w=new AbortController,E=w.signal;return e.addEventListener("keydown",I=>{if(p||I.key==="Process"||I.code==="CapsLock"||/(Control|Meta|Alt|Shift)(Left|Right)/.test(I.code)){a=null;return}a=I,c=null,r.onKeystroke(I)?e.textContent="":a=null},{capture:!0,signal:E}),e.addEventListener("keypress",I=>{p||(a&&c&&r.onKeystroke(a),c=I)},{capture:!0,signal:E}),e.addEventListener("compositionstart",I=>{e.textContent="",p=!0,r.onCompositionStart(I.data)},{capture:!0,signal:E}),e.addEventListener("compositionupdate",I=>{p&&r.onCompositionUpdate(I.data)},{capture:!0,signal:E}),e.addEventListener("compositionend",I=>{e.textContent="",p&&(p=!1,r.onCompositionEnd(I.data))},{capture:!0,signal:E}),e.addEventListener("beforeinput",I=>I.stopImmediatePropagation(),{signal:E}),e.addEventListener("input",I=>{var N;if(!p&&(e.textContent="",I.inputType!=="insertCompositionText")){if(I.inputType==="insertFromPaste"){I.preventDefault(),I.stopPropagation();return}r.onInput((N=I.data)!=null?N:""),I.preventDefault(),I.stopPropagation()}},{signal:E}),e.addEventListener("paste",I=>{e.focus({preventScroll:!0}),e.textContent="",r.onPaste(I)||I.preventDefault(),I.stopImmediatePropagation()},{signal:E}),e.addEventListener("cut",I=>r.onCut(I),{capture:!0,signal:E}),e.addEventListener("copy",I=>r.onCopy(I),{capture:!0,signal:E}),e.addEventListener("blur",I=>{var N,Z;if(((Z=(N=I.relatedTarget)==null?void 0:N._mathfield)==null?void 0:Z.element)===i){e.focus({preventScroll:!0}),I.preventDefault(),I.stopPropagation();return}const ue=n.state;if(ue==="open"||ue==="opening"){I.preventDefault(),I.stopPropagation();return}if(I.relatedTarget===I.target.getRootNode().host){I.preventDefault(),I.stopPropagation();return}b||m||(b=!0,a=null,c=null,r.onBlur(),b=!1)},{capture:!0,signal:E}),e.addEventListener("focus",I=>{b||m||(m=!0,r.onFocus(),m=!1)},{capture:!0,signal:E}),{dispose:()=>w.abort(),cancelComposition:()=>{p&&(e.blur(),requestAnimationFrame(()=>e.focus({preventScroll:!0})))},blur:()=>{typeof e.blur=="function"&&e.blur()},focus:()=>{!m&&typeof e.focus=="function"&&e.focus({preventScroll:!0})},hasFocus:()=>t()===e,setAriaLabel:I=>e.setAttribute("aria-label",I),setValue:I=>{var N;e.textContent=I,e.style.left="-1000px",(N=window.getSelection())==null||N.selectAllChildren(e)},moveTo:(I,N)=>{e.style.top=`${N}px`,e.style.left=`${I}px`}}}function o(e){var i;if(!e||!h(e))return"";let r;return e.key==="Unidentified"&&e.target&&(r=e.target.value),r=(i=r!=null?r:e.key)!=null?i:e.code,/^(Dead|Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(r)&&(r=""),r}function l(e){e=o0(e);const i=[];return e.ctrlKey&&i.push("ctrl"),e.metaKey&&i.push("meta"),e.altKey&&i.push("alt"),e.shiftKey&&i.push("shift"),i.length===0?`[${e.code}]`:(i.push(`[${e.code}]`),i.join("+"))}function u(e){if(M()){const i=H(),r=e.startsWith("!"),a=e.endsWith(i);if(r&&!a||!r&&a)return!0}return e==="!other"?!1:e==="other"}function d(e,i,r){if(e.length===0)return"";const a=va(ec(l(r))),c=va({key:r.key,shift:r.shiftKey,alt:r.altKey,ctrl:r.ctrlKey,meta:r.metaKey||r.ctrlKey&&/macos|ios/.test(H()),cmd:!1,win:!1});for(let p=e.length-1;p>=0;p--)if((e[p].key===a||e[p].key===c)&&(!e[p].ifMode||e[p].ifMode===i))return e[p].command;return""}function _(e){let i=e;return k(i)&&(i=i.length>0?i[0]+"("+i.slice(1).join("")+")":""),i}function g(e,i){let r=[];if(typeof i=="string"){const p=Cd[i];k(p)?r=p.slice():p&&r.push(p)}const a=_(i),c=new RegExp("^"+a.replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(const p of e)c.test(_(p.command))&&r.push(p.key);return r.map(Vl)}function v(e,i){if(e.ifPlatform&&!/^!?(macos|windows|android|ios|chromeos|other)$/.test(e.ifPlatform))throw new Error(`Unexpected platform "${e.ifPlatform}" for keybinding ${e.key}`);if(e.ifLayout!==void 0&&(i.score===0||!e.ifLayout.includes(i.id)))return;const r=ec(e.key);let a=e.ifPlatform;if(r.cmd){if(a&&a!=="macos"&&a!=="ios")throw new Error('Unexpected "cmd" modifier with platform "'+a+`"
|
|
|
"cmd" modifier can only be used with macOS or iOS platform.`);a||(a=H()==="ios"?"ios":"macos"),r.win=!1,r.cmd=!1,r.meta=!0}if(r.win){if(a&&a!=="windows")throw new Error('Unexpected "win" modifier with platform "'+a+`"
|
|
|
"win" modifier can only be used with Windows platform.`);a="windows",r.win=!1,r.cmd=!1,r.meta=!0}if(a&&!u(a))return;if(/^\[.+\]$/.test(r.key))return f(P({},e),{key:va(r)});const c=Wf(r.key,i);if(!c)return f(P({},e),{key:va(r)});if(c.shift&&r.shift||c.alt&&r.alt)throw new Error(`The keybinding ${e.key} (${y(e.command)}) is conflicting with the key combination ${va(c)} using the ${i.displayName} keyboard layout`);return c.shift=c.shift||r.shift,c.alt=c.alt||r.alt,c.meta=r.meta,c.ctrl=r.ctrl,f(P({},e),{key:va(c)})}function y(e){if(Array.isArray(e)){const i=[...e];return i.shift()+"("+i.map(r=>typeof r=="string"?`"${r}"`:r.toString()).join(", ")+")"}return e}function x(e,i){const r=[],a=[];for(const c of e)try{const p=v(c,i);if(!p)continue;const m=a.find(b=>b.key===p.key&&b.ifMode===p.ifMode);if(m)throw new Error(`Ambiguous key binding ${c.key} (${y(c.command)}) matches ${m.key} (${y(m.command)}) with the ${i.displayName} keyboard layout`);a.push(p)}catch(p){p instanceof Error&&r.push(p.message)}return[a,r]}var D=class extends Gn{constructor(){super("latex")}createAtom(e){return new Ir(e)}onPaste(e,i){if(!i)return!1;const r=typeof i=="string"?i:i.getData("application/x-latex")||i.getData("text/plain");return r&&e.model.contentWillChange({inputType:"insertFromPaste",data:r})?(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r)&&(e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),_i(e)),e.startRecording(),!0):!1}insert(e,i,r){if(!e.contentWillChange({data:i,inputType:"insertText"}))return!1;r||(r={}),r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder");const{silenceNotifications:a}=e;r.silenceNotifications&&(e.silenceNotifications=!0);const c=e.silenceNotifications;e.silenceNotifications=!0,r.insertionMode==="replaceSelection"&&!e.selectionIsCollapsed?e.deleteAtoms(jr(e.selection)):r.insertionMode==="replaceAll"?(e.root.setChildren([],"body"),e.position=0):r.insertionMode==="insertBefore"?e.collapseSelection("backward"):r.insertionMode==="insertAfter"&&e.collapseSelection("forward");const p=[];for(const w of i)He.test(w)&&p.push(new Ir(w));let m=e.at(e.position);if(m instanceof vo&&(m=m.lastChild),!(m.parent instanceof vo)){const w=new vo("");m.parent.addChildAfter(w,m),m=w.firstChild}const b=m.parent.addChildrenAfter(p,m);return e.silenceNotifications=c,r.selectionMode==="before"||(r.selectionMode==="item"?e.setSelection(e.anchor,e.offsetOf(b)):b&&(e.position=e.offsetOf(b))),e.contentDidChange({data:i,inputType:"insertText"}),e.silenceNotifications=a,!0}};function C(e){return e.atoms.find(i=>i.type==="latexgroup")}function F(e){var i,r;const a=e.atoms.find(c=>c.type==="latexgroup");return a?(r=(i=a.body)==null?void 0:i.filter(c=>c.type==="latex"))!=null?r:[]:[]}function B(e,i){var r;let a=0,c=!1;const p=Number.isFinite(i==null?void 0:i.before)?(r=i==null?void 0:i.before)!=null?r:0:e.lastOffset;for(;a<=p&&!c;){const w=e.at(a);c=w instanceof Ir&&w.isSuggestion,c||a++}if(!c)return[void 0,void 0];let m=a,b=!1;for(;m<=p&&!b;){const w=e.at(m);b=!(w instanceof Ir&&w.isSuggestion),b||m++}return[a-1,m-1]}new D;function J(e){const i=F(e.model).filter(r=>r.isSuggestion);if(i.length!==0){e.model.position=e.model.offsetOf(i[0].leftSibling);for(const r of i)r.parent.removeChild(r)}}function ne(e,i){var r;const{model:a}=e;J(e);for(const I of F(a))I.isError=!1;if(!a.selectionIsCollapsed||e.options.popoverPolicy==="off"){mt(e);return}const c=[];let p=a.at(a.position);for(;p&&p instanceof Ir&&/^[a-zA-Z\*]$/.test(p.value);)p=p.leftSibling;if(p&&p instanceof Ir&&p.value==="\\")for(c.push(p),p=p.rightSibling;p&&p instanceof Ir&&/^[a-zA-Z\*]$/.test(p.value);)c.push(p),p=p.rightSibling;const m=c.map(I=>I.value).join(""),b=Ke(e,m);if(b.length===0){if(/^\\[a-zA-Z\*]+$/.test(m))for(const I of c)I.isError=!0;mt(e);return}const w=(r=i==null?void 0:i.atIndex)!=null?r:0;e.suggestionIndex=w<0?b.length-1:w%b.length;const E=b[e.suggestionIndex];if(E!==m){const I=c[c.length-1];I.parent.addChildrenAfter([...E.slice(m.length-E.length)].map(N=>new Ir(N,{isSuggestion:!0})),I),mr(e,{interactive:!0})}Ye(e,b)}function le(e){const[i,r]=B(e,{before:e.position});if(i===void 0||r===void 0)return!1;let a=!1;return e.getAtoms([i,r]).forEach(c=>{c.isSuggestion&&(c.isSuggestion=!1,a=!0)}),a}function Ee(e,i="accept",r){var a,c;mt(e);const p=C(e.model);if(!p)return!1;if(i==="accept-suggestion"||i==="accept-all"){const E=F(e.model).filter(I=>I.isSuggestion);if(E.length!==0){for(const I of E)I.isSuggestion=!1;e.model.position=e.model.offsetOf(E[E.length-1])}if(i==="accept-suggestion")return E.length!==0}const b=F(e.model).filter(E=>!E.isSuggestion).map(E=>E.value).join(""),w=p.leftSibling;return p.parent.removeChild(p),e.model.position=e.model.offsetOf(w),e.switchMode((a=r==null?void 0:r.mode)!=null?a:"math"),i==="reject"||(Gn.insert(e.model,b,{selectionMode:(c=r==null?void 0:r.selectItem)!=null&&c?"item":"placeholder",format:"latex",mode:"math"}),e.snapshot(),e.model.announce("replacement"),e.switchMode("math")),!0}function Ie(e){var i;let r=document.getElementById(e);return r?r.dataset.refcount=Number(Number.parseInt((i=r.dataset.refcount)!=null?i:"0")+1).toString():(r=document.createElement("div"),r.setAttribute("aria-hidden","true"),r.dataset.refcount="1",r.id=e,document.body.append(r)),r}function tt(e){var i;const r=document.getElementById(e);if(!r)return;const a=Number.parseInt((i=r.getAttribute("data-refcount"))!=null?i:"0");a<=1?r.remove():r.dataset.refcount=Number(a-1).toString()}function Pe(e,i){const r=new sn({from:e.context}),a=new Qe({mode:"math",type:"root",body:Br(i,{context:r})}),c=Du(Fl(new Mt(a.render(r),{classes:"ML__base"}),r));return Cu(c,{classes:"ML__latex"}).toMarkup()}function Ye(e,i){var r;if(i.length===0){mt(e);return}let a="";for(const[p,m]of i.entries()){const b=m,w=Pe(e,m),E=g(e.keybindings,b).join("<br>");a+=`<li role="button" data-command="${b}" ${p===e.suggestionIndex?"class=ML__popover__current":""}><span class="ML__popover__latex">${b}</span><span class="ML__popover__command">${w}</span>`,E&&(a+=`<span class="ML__popover__keybinding">${E}</span>`),a+="</li>"}const c=Zt(e,`<ul>${a}</ul>`);qe()&&((r=c.querySelector(".ML__popover__current"))==null||r.scrollIntoView({block:"nearest",inline:"nearest"})),setTimeout(()=>{var p;c&&!qe()&&(c.classList.add("is-visible"),Fe(e),(p=c.querySelector(".ML__popover__current"))==null||p.scrollIntoView({block:"nearest",inline:"nearest"}))},32)}function qe(){const e=document.getElementById("mathlive-suggestion-popover");return e?e.classList.contains("is-visible"):!1}function Fe(e,i){var r;if(!e.element||e.element.mathfield!==e||!qe())return;if(((r=e.model.at(e.model.position))==null?void 0:r.type)!=="latex"){mt(e);return}if(i!=null&&i.deferred){setTimeout(()=>Fe(e),32);return}const a=Cl(e.field);if(!a)return;const c=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,p=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,m=window.innerWidth-document.documentElement.clientWidth,b=window.innerHeight-document.documentElement.clientHeight,w=window.mathVirtualKeyboard.boundingRect.height,E=document.getElementById("mathlive-suggestion-popover");a.x+E.offsetWidth/2>p-m?E.style.left=`${p-E.offsetWidth-m}px`:a.x-E.offsetWidth/2<0?E.style.left="0":E.style.left=`${a.x-E.offsetWidth/2}px`;const I=a.y-a.height;c-b-w-a.y<I?(E.classList.add("ML__popover--reverse-direction"),E.classList.remove("top-tip"),E.classList.add("bottom-tip"),E.style.top=`${a.y-a.height-E.offsetHeight-15}px`):(E.classList.remove("ML__popover--reverse-direction"),E.classList.add("top-tip"),E.classList.remove("bottom-tip"),E.style.top=`${a.y+15}px`)}function mt(e){e.suggestionIndex=0;const i=document.getElementById("mathlive-suggestion-popover");i&&(i.classList.remove("is-visible"),i.innerHTML="")}function Zt(e,i){let r=document.getElementById("mathlive-suggestion-popover");return r||(r=Ie("mathlive-suggestion-popover"),ds("suggestion-popover"),ds("core"),r.addEventListener("pointerdown",a=>a.preventDefault()),r.addEventListener("click",a=>{let c=a.target;for(;c&&!c.dataset.command;)c=c.parentElement;c&&(Ee(e,"reject"),Gn.insert(e.model,c.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),e.dirty=!0,e.focus())})),r.innerHTML=window.MathfieldElement.createHTML(i),r}function ui(){document.getElementById("mathlive-suggestion-popover")&&(tt("mathlive-suggestion-popover"),Qs("suggestion-popover"),Qs("core"))}function xi(){const e=String(new Error().stack).replace(/^Error.*\n/,"").split(`
|
|
|
`);if(e.length===0)return console.error(`Can't use relative paths to specify assets location because the sourcefile location could not be determined (unexpected stack trace format "${new Error().stack}").`),"";let i=e[1],r=i.match(/http.*\.ts[\?:]/);return r&&(i=e[2]),r=i.match(/(https?:.*):[0-9]+:[0-9]+/),r||(r=i.match(/at (.*(\.ts))[\?:]/),r||(r=i.match(/at (.*(\.mjs|\.js))[\?:]/))),r?r[1]:(console.error(e),console.error(`Can't use relative paths to specify assets location because the source file location could not be determined (unexpected location "${i}").`),"")}var si=null,Vt,ci,ei=((ci=(Vt=globalThis==null?void 0:globalThis.document)==null?void 0:Vt.currentScript)==null?void 0:ci.src)||xi();function gi(e){return cl(this,null,function*(){if(/^(?:[a-z+]+:)?\/\//i.test(e))return new URL(e).href;if(si===null)try{const i=yield fetch(ei,{method:"HEAD"});i.status===200&&(si=i.url)}catch(i){console.error(`Invalid URL "${e}" (relative to "${ei}")`)}return new URL(e,si!=null?si:ei).href})}function zi(e,i,r={}){return new FontFace(e,`url(${i}.woff2) format('woff2')`,r)}var Ut="not-loaded";function qt(){return cl(this,null,function*(){return Ut="not-loaded",Zi()})}function Zi(){return cl(this,null,function*(){var e;if(Ut!=="not-loaded")return;if(Ut="loading",(e=getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts"))!=null?e:!1){Ut="ready";return}if(document.body.classList.remove("ML__fonts-did-not-load"),"fonts"in document){const r=["KaTeX_Main","KaTeX_Math","KaTeX_AMS","KaTeX_Caligraphic","KaTeX_Fraktur","KaTeX_SansSerif","KaTeX_Script","KaTeX_Typewriter","KaTeX_Size1","KaTeX_Size2","KaTeX_Size3","KaTeX_Size4"],a=Array.from(document.fonts).map(m=>m.family);if(r.every(m=>a.includes(m))){Ut="ready";return}if(!window.MathfieldElement.fontsDirectory){Ut="not-loaded";return}const c=yield gi(window.MathfieldElement.fontsDirectory);if(!c){document.body.classList.add("ML__fonts-did-not-load"),Ut="error";return}const p=[["KaTeX_Main-Regular"],["KaTeX_Main-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_Main-Bold",{weight:"bold"}],["KaTeX_Main-Italic",{style:"italic"}],["KaTeX_Math-Italic",{style:"italic"}],["KaTeX_Math-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_AMS-Regular"],["KaTeX_Caligraphic-Regular"],["KaTeX_Caligraphic-Bold",{weight:"bold"}],["KaTeX_Fraktur-Regular"],["KaTeX_Fraktur-Bold",{weight:"bold"}],["KaTeX_SansSerif-Regular"],["KaTeX_SansSerif-Bold",{weight:"bold"}],["KaTeX_SansSerif-Italic",{style:"italic"}],["KaTeX_Script-Regular"],["KaTeX_Typewriter-Regular"],["KaTeX_Size1-Regular"],["KaTeX_Size2-Regular"],["KaTeX_Size3-Regular"],["KaTeX_Size4-Regular"]].map(m=>zi(m[0].replace(/-[a-zA-Z]+$/,""),`${c}/${m[0]}`,m[1]));try{(yield Promise.all(p.map(b=>{try{return b.load()}catch(w){}}))).forEach(b=>document.fonts.add(b)),Ut="ready";return}catch(m){console.error(`MathLive 0.98.5: The math fonts could not be loaded from "${c}"`,{cause:m}),document.body.classList.add("ML__fonts-did-not-load")}Ut="error"}})}function Fn(e){let i=0;for(let r=0;r<e.length;r++)i=i*31+e.charCodeAt(r),i=i|0;return Math.abs(i)}function _i(e,i){e&&(e.dirty||(e.dirty=!0,requestAnimationFrame(()=>{co(e)&&e.dirty&&(e.atomBoundsCache=new Map,mr(e,i),e.atomBoundsCache=void 0)})))}function xn(e,i){var r;i=i!=null?i:{};const a=new sn({from:f(P({},e.context),{atomIdsSettings:{seed:i.forHighlighting?Fn(Qe.serialize([e.model.root],{expandMacro:!1,defaultMode:e.options.defaultMode})):"random",groupNumbers:(r=i.forHighlighting)!=null?r:!1},letterShapeStyle:e.options.letterShapeStyle}),mathstyle:e.options.defaultMode==="inline-math"?"textstyle":"displaystyle"}),c=e.model.root.render(a);return Cu(Fl(c,a),{classes:e.hasEditablePrompts?"ML__latex ML__prompting":"ML__latex",attributes:{translate:"no","aria-hidden":"true"}})}function qr(e,i){const{model:r}=e;r.root.caret=void 0,r.root.isSelected=!1,r.root.containsCaret=!0;for(const c of r.atoms)c.caret=void 0,c.isSelected=!1,c.containsCaret=!1;if(r.selectionIsCollapsed){const c=r.at(r.position);c.caret=e.model.mode;let p=c.parent;for(;p;)p.containsCaret=!0,p=p.parent}else{const c=r.getAtoms(r.selection,{includeChildren:!0});for(const p of c)p.isSelected=!0}return xn(e,i).toMarkup()}function mr(e,i){if(!co(e))return;i!=null||(i={});const r=e.element.querySelector("[part=virtual-keyboard-toggle]");r&&(r.style.display=e.hasEditableContent?"":"none");const a=e.field;if(!a)return;const c=e.isSelectionEditable&&e.hasFocus(),p=a.classList.contains("ML__focused");p&&!c?a.classList.remove("ML__focused"):!p&&c&&a.classList.add("ML__focused");let m=qr(e,i);const b=e.element.querySelector("[part=menu-toggle]");if(b&&(e.model.atoms.length<=1||e.disabled||e.readOnly&&!e.hasEditableContent||e.userSelect==="none"?b.style.display="none":b.style.display=""),e.model.atoms.length<=1){const w=e.options.contentPlaceholder;w&&(m+=`<span part=placeholder class="ML__content-placeholder">${Nr(w)}</span>`)}a.innerHTML=window.MathfieldElement.createHTML(m),os(e,i.interactive),e.dirty=!1}function os(e,i){const r=e.field;if(!r)return;for(const b of r.querySelectorAll(".ML__selection, .ML__contains-highlight"))b.remove();!(i!=null&&i)&&Ut!=="error"&&Ut!=="ready"&&setTimeout(()=>{Ut==="ready"?os(e):setTimeout(()=>os(e),128)},32);const a=e.model,c=r.offsetWidth,p=r.getBoundingClientRect().width;let m=Math.floor(p)/c;if(m=isNaN(m)?1:m,a.selectionIsCollapsed){Fe(e,{deferred:!0});let b=a.at(a.position);for(;b&&b.type!=="prompt"&&!(b.containsCaret&&b.displayContainsHighlight);)b=b.parent;if(b!=null&&b.containsCaret&&b.displayContainsHighlight){const w=mf(e,Ml(e,b),m);if(w){w.left/=m,w.right/=m,w.top/=m,w.bottom/=m;const E=document.createElement("div");E.classList.add("ML__contains-highlight"),E.style.position="absolute",E.style.left=`${w.left+1}px`,E.style.top=`${Math.ceil(w.top)}px`,E.style.width=`${Math.ceil(w.right-w.left)}px`,E.style.height=`${Math.ceil(w.bottom-w.top)}px`,r.insertBefore(E,r.childNodes[0])}}return}for(const b of ta(Xc(e,{excludeAtomsWithBackground:!0}))){b.left/=m,b.right/=m,b.top/=m,b.bottom/=m;const w=document.createElement("div");w.classList.add("ML__selection"),w.style.position="absolute",w.style.left=`${b.left}px`,w.style.top=`${b.top}px`,w.style.width=`${Math.ceil(b.right-b.left)}px`,w.style.height=`${Math.ceil(b.bottom-b.top-1)}px`,r.insertBefore(w,r.childNodes[0])}}function ta(e){let i=[];for(const r of e){let a=!1;for(const c of i)if(r.left===c.left&&r.right===c.right&&r.top===c.top&&r.bottom===c.bottom){a=!0;break}a||i.push(r)}e=i,i=[];for(const r of e){let a=0;for(const c of e)if(r.left>=c.left&&r.right<=c.right&&r.top>=c.top&&r.bottom<=c.bottom&&(a+=1,a>1))break;a===1&&i.push(r)}return i}var Na=3,ia;function es(e,i){i=P({target:"mathfield",canUndo:!1,audioFeedback:void 0,changeContent:!1,changeSelection:!1},i!=null?i:{}),ia||(ia={});for(const r of Object.keys(e))console.assert(!ia[r],"Selector already defined: ",r),ia[r]=f(P({},i),{fn:e[r]})}function Hl(e){let i;if(Array.isArray(e)){if(e[0]==="performWithFeedback")return Hl(e[1]);i=e[0]}else i=e;return i=i.replace(/-\w/g,r=>r[1].toUpperCase()),ia[i]}function Wl(e){var i;return(i=Hl(e))==null?void 0:i.target}function Dn(e,i){var r;if(!i)return!1;let a,c=[],p=!1,m=!1;k(i)?(a=i[0],c=i.slice(1)):a=i,a=a.replace(/-\w/g,E=>E[1].toUpperCase());const b=ia[a],w=b==null?void 0:b.target;if(w==="model"){if(!e.isSelectionEditable&&(b!=null&&b.changeContent))return e.model.announce("plonk"),!1;/^(delete|add)/.test(a)&&(a!=="deleteBackward"&&e.flushInlineShortcutBuffer(),e.snapshot(a)),/^complete/.test(a)||J(e),ia[a].fn(e.model,...c),ne(e),m=!0,p=!0}else if(w==="virtual-keyboard")m=(r=window.mathVirtualKeyboard.executeCommand(i))!=null?r:!1,p=!0;else if(ia[a]){if(!e.isSelectionEditable&&(b!=null&&b.changeContent))return e.model.announce("plonk"),!1;/^(undo|redo)/.test(a)&&e.flushInlineShortcutBuffer(),m=ia[a].fn(e,...c),p=!0}else throw new Error(`Unknown command "${a}"`);return w!=="virtual-keyboard"&&(!e.model.selectionIsCollapsed||b!=null&&b.changeSelection&&i!=="deleteBackward")&&(e.flushInlineShortcutBuffer(),b!=null&&b.changeContent||e.stopCoalescingUndo(),e.defaultStyle={}),m&&_i(e),p}function ts(e,i){var r;if(!e)return!1;e.focus(),Op.keypressVibration&&Y()&&navigator.vibrate(Na);const a=Hl(i);window.MathfieldElement.playSound((r=a==null?void 0:a.audioFeedback)!=null?r:"keypress");const c=e.executeCommand(i);return e.scrollIntoView(),c}es({performWithFeedback:(e,i)=>ts(e,i)});function Os(e){return ne(e,{atIndex:e.suggestionIndex+1}),!1}function xo(e){return ne(e,{atIndex:e.suggestionIndex-1}),!1}es({complete:Ee},{target:"mathfield",audioFeedback:"return",canUndo:!0,changeContent:!0,changeSelection:!0}),es({nextSuggestion:Os,previousSuggestion:xo},{target:"mathfield",audioFeedback:"keypress",changeSelection:!0});var ms="mathlive#virtual-keyboard-message";function $a(e){var i;return e.type!=="message"?!1:((i=e.data)==null?void 0:i.type)===ms}var wo=class ym{constructor(){this.targetOrigin=window.origin,this.originValidator="none",this._boundingRect=new DOMRect(0,0,0,0),this._isShifted=!1,window.addEventListener("message",this),this.sendMessage("proxy-created"),this.listeners={}}static get singleton(){return this._singleton||(this._singleton=new ym),this._singleton}set alphabeticLayout(i){this.sendMessage("update-setting",{alphabeticLayout:i})}set layouts(i){this.sendMessage("update-setting",{layouts:i})}get normalizedLayouts(){return[]}set editToolbar(i){this.sendMessage("update-setting",{editToolbar:i})}set actionKeycap(i){this.sendMessage("update-setting",{actionKeycap:i})}set shiftKeycap(i){this.sendMessage("update-setting",{shiftKeycap:i})}set backspaceKeycap(i){this.sendMessage("update-setting",{backspaceKeycap:i})}set tabKeycap(i){this.sendMessage("update-setting",{tabKeycap:i})}set container(i){throw new Error("Container inside an iframe cannot be changed")}show(i){this.sendMessage("show",i)}hide(i){this.sendMessage("hide",i)}get isShifted(){return this._isShifted}get visible(){return this._boundingRect.height>0}set visible(i){i?this.show():this.hide()}get boundingRect(){return this._boundingRect}executeCommand(i){return this.sendMessage("execute-command",{command:i}),!0}updateToolbar(i){this.sendMessage("update-toolbar",i)}update(i){this.sendMessage("update-setting",i)}connect(){this.sendMessage("connect")}disconnect(){this.sendMessage("disconnect")}addEventListener(i,r,a){this.listeners[i]||(this.listeners[i]=new Set),this.listeners[i].has(r)||this.listeners[i].add(r)}dispatchEvent(i){return!this.listeners[i.type]||this.listeners[i.type].size===0?!0:(this.listeners[i.type].forEach(r=>{typeof r=="function"?r(i):r==null||r.handleEvent(i)}),!i.defaultPrevented)}removeEventListener(i,r,a){this.listeners[i]&&this.listeners[i].delete(r)}handleEvent(i){if($a(i)){if(!Jc(i.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${i.origin}) cannot be handled`,"SecurityError");this.handleMessage(i.data)}}handleMessage(i){const{action:r}=i;if(r==="execute-command"){const{command:a}=i;Wl(a)==="virtual-keyboard"&&this.executeCommand(a);return}if(r==="synchronize-proxy"){this._boundingRect=i.boundingRect,this._isShifted=i.isShifted;return}if(r==="geometry-changed"){this._boundingRect=i.boundingRect,this.dispatchEvent(new Event("geometrychange"));return}}sendMessage(i,r={}){if(!window.top)throw new DOMException("A frame does not have access to the top window and can\u2018t communicate with the keyboard. Review virtualKeyboardTargetOrigin and originValidator on mathfields embedded in an iframe","SecurityError");window.top.postMessage(P({type:ms,action:i},r),this.targetOrigin)}},fh={numeric:{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",rows:[[{latex:"x",shift:"y",variants:["y","z","t","r","x^2","x^n","x^{#?}","x_n","x_i","x_{#?}",{latex:"f(#?)",class:"small"},{latex:"g(#?)",class:"small"}]},{latex:"n",shift:"a",variants:["i","j","p","k","a","u"]},"[separator-5]","[7]","[8]","[9]","[/]","[separator-5]",{latex:"\\exponentialE",shift:"\\ln",variants:["\\exp","\\times 10^{#?}","\\ln","\\log_{10}","\\log"]},{latex:"\\imaginaryI",variants:["\\Re","\\Im","\\imaginaryJ","\\Vert #0 \\Vert"]},{latex:"\\pi",shift:"\\sin",variants:["\\prod",{latex:"\\theta",aside:"theta"},{latex:"\\rho",aside:"rho"},{latex:"\\tau",aside:"tau"},"\\sin","\\cos","\\tan"]}],[{label:"<",latex:"<",class:"hide-shift",shift:{latex:"\\le",label:"\u2264"}},{label:">",latex:">",class:"hide-shift",shift:{latex:"\\ge",label:"\u2265"}},"[separator-5]","[4]","[5]","[6]","[*]","[separator-5]",{class:"hide-shift",latex:"#@^2}",shift:"#@^{\\prime}}"},{latex:"#@^{#0}}",class:"hide-shift",shift:"#@_{#?}"},{class:"hide-shift",latex:"\\sqrt{#0}",shift:{latex:"\\sqrt[#0]{#?}}"}}],["[(]","[)]","[separator-5]","[1]","[2]","[3]","[-]","[separator-5]",{latex:"\\int^{\\infty}_{0}\\!#?\\,\\mathrm{d}x",class:"small hide-shift",shift:"\\int",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{class:"hide-shift",latex:"\\forall",shift:"\\exists"},{label:"[backspace]",width:1}],[{label:"[shift]",width:2},"[separator-5]","[0]","[.]","[=]","[+]","[separator-5]","[left]","[right]",{label:"[action]",width:1}]]},greek:{label:"αβγ",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.greek",rows:[[{label:"<i>φ</i>",class:"MLK__tex hide-shift",insert:"\\varphi",aside:"phi var.",shift:"\\Phi"},{label:"<i>ς</i>",class:"MLK__tex hide-shift",insert:"\\varsigma",aside:"sigma var.",shift:"\\Sigma"},{label:"<i>ϵ</i>",class:"MLK__tex hide-shift",insert:"\\epsilon",aside:"espilon",shift:'\\char"0190'},{label:"<i>ρ</i>",class:"MLK__tex hide-shift",insert:"\\rho",aside:"rho",shift:'\\char"3A1'},{label:"<i>τ</i>",class:"MLK__tex hide-shift",insert:"\\tau",aside:"tau",shift:'\\char"3A4'},{label:"<i>υ</i>",class:"MLK__tex hide-shift",insert:"\\upsilon",aside:"upsilon",shift:"\\Upsilon"},{label:"<i>θ</i>",class:"MLK__tex hide-shift",insert:"\\theta",aside:"theta",shift:"\\Theta"},{label:"<i>ι</i>",class:"MLK__tex hide-shift",insert:"\\iota",aside:"iota",shift:'\\char"399'},{label:"<i>ο</i>",class:"MLK__tex hide-shift",insert:"\\omicron",aside:"omicron",shift:'\\char"39F'},{label:"<i>π</i>",class:"MLK__tex hide-shift",insert:"\\pi",aside:"pi",shift:"\\Pi"}],["[separator-5]",{label:"<i>α</i>",class:"MLK__tex hide-shift",insert:"\\alpha",aside:"alpha",shift:'\\char"391'},{label:"<i>σ</i>",class:"MLK__tex hide-shift",insert:"\\sigma",aside:"sigma",shift:"\\Sigma"},{label:"<i>δ</i>",class:"MLK__tex hide-shift",insert:"\\delta",aside:"delta",shift:"\\Delta"},{latex:"\\phi",class:"MLK__tex hide-shift",insert:"\\phi",aside:"phi",shift:"\\Phi"},{label:"<i>γ</i>",class:"MLK__tex hide-shift",insert:"\\gamma",aside:"gamma",shift:"\\Gamma"},{label:"<i>η</i>",class:"MLK__tex hide-shift",insert:"\\eta",aside:"eta",shift:'\\char"397'},{label:"<i>ξ</i>",class:"MLK__tex hide-shift",insert:"\\xi",aside:"xi",shift:"\\Xi"},{label:"<i>κ</i>",class:"MLK__tex hide-shift",insert:"\\kappa",aside:"kappa",shift:"\\Kappa"},{label:"<i>λ</i>",class:"MLK__tex hide-shift",insert:"\\lambda",aside:"lambda",shift:"\\Lambda"},"[separator-5]"],["[shift]",{label:"<i>ζ</i>",class:"MLK__tex hide-shift",insert:"\\zeta",aside:"zeta",shift:'\\char"396'},{label:"<i>χ</i>",class:"MLK__tex hide-shift",insert:"\\chi",aside:"chi",shift:'\\char"3A7'},{label:"<i>ψ</i>",class:"MLK__tex hide-shift",insert:"\\psi",aside:"zeta",shift:"\\Psi"},{label:"<i>ω</i>",class:"MLK__tex hide-shift",insert:"\\omega",aside:"omega",shift:"\\Omega"},{label:"<i>β</i>",class:"MLK__tex hide-shift",insert:"\\beta",aside:"beta",shift:'\\char"392'},{label:"<i>ν</i>",class:"MLK__tex hide-shift",insert:"\\nu",aside:"nu",shift:'\\char"39D'},{label:"<i>μ</i>",class:"MLK__tex hide-shift",insert:"\\mu",aside:"mu",shift:'\\char"39C'},"[backspace]"],["[separator]",{label:"<i>ε</i>",class:"MLK__tex",insert:"\\varepsilon",aside:"espilon var."},{label:"<i>ϑ</i>",class:"MLK__tex",insert:"\\vartheta",aside:"theta var."},{label:"<i>ϰ</i>",class:"MLK__tex",insert:"\\varkappa",aside:"kappa var."},{label:"<i>ϖ</i>",class:"MLK__tex",insert:"\\varpi",aside:"pi var."},{label:"<i>ϱ</i>",class:"MLK__tex",insert:"\\varrho",aside:"rho var."},"[left]","[right]","[action]"]]},symbols:{label:"∞\u2260\u2208",labelClass:"MLK__tex",tooltip:"keyboard.tooltip.symbols",rows:[[{latex:"\\sin",shift:"\\sin^{-1}",variants:[{class:"small",latex:"\\sinh"},{class:"small",latex:"\\sin^{-1}"},{class:"small",latex:"\\arsinh"}]},"\\ln",{latex:"\\mathrm{abs}",insert:"\\mathrm{abs}\\left(#0\\right)"},{latex:"\\rarr",shift:"\\rArr",variants:[{latex:"\\implies",aside:"implies"},{latex:"\\to",aside:"to"},"\\dashv",{latex:"\\roundimplies",aside:"round implies"}]},{latex:"\\exists",variants:["\\nexists"],shift:"\\nexists"},{latex:"\\in",shift:"\\notin",variants:["\\notin","\\owns"]},"\\cup",{latex:"\\overrightarrow{#@}",shift:"\\overleftarrow{#@}",variants:["\\overleftarrow{#@}","\\bar{#@}","\\vec{#@}","\\hat{#@}","\\check{#@}","\\dot{#@}","\\ddot{#@}","\\mathring{#@}","\\breve{#@}","\\acute{#@}","\\tilde{#@}","\\grave{#@}"]},{class:"small",latex:"\\lim_{#?}",shift:"\\lim_{x\\to\\infty}",variants:[{class:"small",latex:"\\liminf_{#?}"},{class:"small",latex:"\\limsup_{#?}"}]},"\\exponentialE"],[{latex:"\\cos",shift:"\\cos^{-1}",variants:[{class:"small",latex:"\\cosh"},{class:"small",latex:"\\cos^{-1}"},{class:"small",latex:"\\arcosh"}]},{latex:"\\log",shift:"\\log_{10}",variants:["\\log_{#0}","\\log_{10}"]},"\\left\\vert#0\\right\\vert",{latex:"\\larr",shift:"\\lArr",variants:[{latex:"\\impliedby",aside:"implied by"},{latex:"\\gets",aside:"gets"},"\\lArr","\\vdash",{latex:"\\models",aside:"models"}]},{latex:"\\forall",shift:"\\lnot",variants:[{latex:"\\land",aside:"and"},{latex:"\\lor",aside:"or"},{latex:"\\oplus",aside:"xor"},{latex:"\\lnot",aside:"not"},{latex:"\\downarrow",aside:"nor"},{latex:"\\uparrow",aside:"nand"},{latex:"\\curlywedge",aside:"nor"},{latex:"\\bar\\curlywedge",aside:"nand"}]},{latex:"\\ni",shift:"\\not\\owns"},"\\cap",{latex:"\\overline{#@}",shift:"\\underline{#@}",variants:["\\overbrace{#@}","\\overlinesegment{#@}","\\overleftrightarrow{#@}","\\overrightarrow{#@}","\\overleftarrow{#@}","\\overgroup{#@}","\\underbrace{#@}","\\underlinesegment{#@}","\\underleftrightarrow{#@}","\\underrightarrow{#@}","\\underleftarrow{#@}","\\undergroup{#@}"]},{class:"hide-shift",latex:"\\int",shift:"\\iint",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\smallint",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\intop","\\iiint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\ointctrclockwise","\\intctrclockwise"]},{latex:"\\pi",shift:"\\tau",variants:["\\tau"]}],[{latex:"\\tan",shift:"\\tan^{-1}",variants:[{class:"small",latex:"\\tanh"},{class:"small",latex:"\\tan^{-1}"},{class:"small",latex:"\\artanh"},{class:"small",latex:"\\arctan"},{class:"small",latex:"\\arctg"},{class:"small",latex:"\\tg"}]},{latex:"\\exp",insert:"\\exp\\left(#0\\right)",variants:["\\exponentialE^{#0}"]},"\\left\\Vert#0\\right\\Vert",{latex:"\\lrArr",shift:"\\leftrightarrow",variants:[{latex:"\\iff",aside:"if and only if"},"\\leftrightarrow","\\leftrightarrows","\\Leftrightarrow",{latex:"^\\biconditional",aside:"biconditional"}]},{latex:"\\vert",shift:"!"},{latex:"#@^{\\complement}",aside:"complement",variants:[{latex:"\\setminus",aside:"set minus"},{latex:"\\smallsetminus",aside:"small set minus"}]},{latex:"\\subset",shift:"\\subseteq",variants:["\\subset","\\subseteq","\\subsetneq","\\varsubsetneq","\\subsetneqq","\\nsubset","\\nsubseteq","\\supset","\\supseteq","\\supsetneq","\\supsetneqq","\\nsupset","\\nsupseteq"]},{latex:"#@^{\\prime}",shift:"#@^{\\doubleprime}",variants:["#@^{\\doubleprime}","#@\\degree"]},{latex:"\\mathrm{d}",shift:"\\partial",variants:["\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{latex:"\\infty",variants:["\\aleph_0","\\aleph_1","\\omega","\\mathfrak{m}"]}],[{label:"[shift]",width:2},{class:"box",latex:",",shift:";",variants:[";","?"]},{class:"box",latex:"\\colon",shift:"\\Colon",variants:[{latex:"\\Colon",aside:"such that",class:"box"},{latex:":",aside:"ratio",class:"box"},{latex:"\\vdots",aside:"",class:"box"},{latex:"\\ddots",aside:"",class:"box"},{latex:"\\ldotp",aside:"low dot",class:"box"},{latex:"\\cdotp",aside:"center dot",class:"box"},{latex:"\\ldots",aside:"low ellipsis",class:"box"},{latex:"\\cdots",aside:"center ellipsis",class:"box"},{latex:"\\therefore",aside:"therefore",class:"box"},{latex:"\\because",aside:"because",class:"box"}]},{class:"box",latex:"\\cdot",aside:"centered dot",shift:"\\ast",variants:["\\circ","\\bigcirc","\\bullet","\\odot","\\oslash","\\circledcirc","\\ast","\\star","\\times","\\doteq","\\doteqdot"]},"[separator]","[left]","[right]",{label:"[backspace]",width:1,class:"action hide-shift"},{label:"[action]",width:1}]]},compact:{label:"compact",rows:[["[+]","[-]","[*]","[/]","[=]","[.]","[(]","[)]","\\sqrt{#0}","#@^{#?}"],["[1]","[2]","[3]","[4]","[5]","[6]","[7]","[8]","[9]","[0]"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]},minimalist:{label:"minimalist",layers:[{style:`
|
|
|
.minimalist-backdrop {
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
}
|
|
|
.minimalist-container {
|
|
|
--keycap-height: 40px;
|
|
|
--keycap-max-width: 53px;
|
|
|
--keycap-small-font-size: 12px;
|
|
|
background: var(--keyboard-background);
|
|
|
padding: 20px;
|
|
|
border-top-left-radius: 8px;
|
|
|
border-top-right-radius: 8px;
|
|
|
border: 1px solid var(--keyboard-border);
|
|
|
box-shadow: 0 0 32px rgb(0 0 0 / 30%);
|
|
|
}
|
|
|
`,backdrop:"minimalist-backdrop",container:"minimalist-container",rows:[["+","-","\\times",{latex:"\\frac{#@}{#0}",class:"small"},"=","[.]","(",")",{latex:"\\sqrt{#0}",class:"small"},{latex:"#@^{#?}",class:"small"}],["1","2","3","4","5","6","7","8","9","0"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]}]},"numeric-only":{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",id:"numeric-only",rows:[["7","8","9","[separator]",{label:"[backspace]",width:2}],["4","5","6","[separator]","[separator]","[separator]"],["1","2","3","[separator]","[separator]","[separator]"],["0",{label:"[.]",variants:[]},"-","[separator]","[left]","[right]"]]}},So={0:["\\varnothing","\\infty"],1:["\\frac{1}{#@}","#@^{-1}","\\times 10^{#?}","\\phi","\\imaginaryI"],2:["\\frac{1}{2}","#@^2","\\sqrt2","\\exponentialE"],3:["\\frac{1}{3}","#@^3","\\sqrt3","\\pi"],4:["\\frac{1}{4}","#@^4"],5:["\\frac{1}{5}","#@^5","\\sqrt5"],6:["\\frac{1}{6}","#@^6"],7:["\\frac{1}{7}","#@^7"],8:["\\frac{1}{8}","#@^8"],9:["\\frac{1}{9}","#@^9"],".":[".",",",";","\\colon"],",":["{,}",".",";","\\colon"],a:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"},"\xE0","\xE1","\xE2","\xE4","\xE6"],b:[{latex:"\\beth",aside:"beth"}],c:[{latex:"\\C",aside:"set of complex numbers"},"\xE7"],d:[{latex:"\\daleth",aside:"daleth"}],e:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn\u2019t"},"\xE8","\xE9","\xEA","\xEB"],g:[{latex:"\\gimel",aside:"gimel"}],h:[{latex:"\\hbar",aside:"h bar"},{latex:"\\hslash",aside:"h slash"}],i:[{latex:"\\imaginaryI",aside:"imaginary i"},"\xEC","\xED","\xEE","\xEF"],j:[{latex:"\\imaginaryJ",aside:"imaginary j"}],l:[{latex:"\\ell",aside:"ell"}],n:[{latex:"\\mathbb{N}",aside:"set of natural numbers"},"\xF1"],o:["\xF8","\u0153","\xF2","\xF3","\xF4","\xF6","\u0153"],p:[{latex:"\\mathbb{P}",aside:"set of primes"}],q:[{latex:"\\mathbb{Q}",aside:"set of rational numbers"}],r:[{latex:"\\mathbb{R}",aside:"set of real numbers"}],u:["\xF9","\xFA","\xFB","\xFC"],z:[{latex:"\\mathbb{Z}",aside:"set of integers"}],y:["\xFD","\xFF"],space:[{latex:'\\char"203A\\!\\char"2039',insert:"\\!",aside:"negative thin space<br>\u207B\xB3\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\,\\char"2039',insert:"\\,",aside:"thin space<br>\xB3\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\:\\char"2039',insert:"\\:",aside:"medium space<br>\u2074\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\;\\char"2039',insert:"\\;",aside:"thick space<br>\u2075\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\ \\char"2039',insert:"\\ ",aside:"\u2153 em"},{latex:'\\char"203A\\enspace\\char"2039',insert:"\\enspace",aside:"\xBD em"},{latex:'\\char"203A\\quad\\char"2039',insert:"\\quad",aside:"1 em"},{latex:'\\char"203A\\qquad\\char"2039',insert:"\\qquad",aside:"2 em"}]},nl;function rl(e,i){var r,a,c;const p=al.singleton;if(!p)return;const m=ic(e),b=(a=(r=p.getKeycap(m==null?void 0:m.id))==null?void 0:r.variants)!=null?a:"";if(typeof b=="string"&&!dh(b)||Array.isArray(b)&&b.length===0){i==null||i();return}const w={};let E="";for(const Ge of jf(b)){const Lt=H0(Ge),Ue=Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);w[Ue]=Lt;const[ct,Rt]=qf(Lt);E+=`<div id=${Ue} class="item ${Rt}">${ct}</div>`}const I=document.createElement("div");I.setAttribute("aria-hidden","true"),I.className="MLK__variant-panel",I.style.height="auto";const N=Object.keys(w).length;let Z=5;N===1?Z=1:N===2||N===4?Z=2:N===3||N===5||N===6?Z=3:N>=7&&N<14&&(Z=4),I.style.width=`calc(var(--variant-keycap-length) * ${Z} + 12px)`,I.innerHTML=Op.createHTML(E),n.open({root:(c=p==null?void 0:p.container)==null?void 0:c.querySelector(".ML__keyboard"),child:I}),nl=new AbortController;const{signal:ue}=nl,me=e==null?void 0:e.getBoundingClientRect();if(me){me.top-I.clientHeight<0&&(I.style.width="auto",N<=6?I.style.height="56px":N<=12?I.style.height="108px":N<=18?I.style.height="205px":I.classList.add("compact"));const Ge=Math.max(0,Math.min(window.innerWidth-I.offsetWidth,(me.left+me.right-I.offsetWidth)/2)),Lt=me.top-I.clientHeight+5;I.style.transform=`translate(${Ge}px, ${Lt}px)`,I.classList.add("is-visible"),requestAnimationFrame(()=>{I.addEventListener("pointerup",Ue=>{const ct=ic(Ue.target);!(ct!=null&&ct.id)||!w[ct.id]||(d0(w[ct.id]),sl(),i==null||i(),Ue.preventDefault())},{capture:!0,passive:!1,signal:ue}),I.addEventListener("pointerenter",Ue=>{const ct=ic(Ue.target);!(ct!=null&&ct.id)||!w[ct.id]||ct.classList.add("is-active")},{capture:!0,signal:ue}),I.addEventListener("pointerleave",Ue=>{const ct=ic(Ue.target);!(ct!=null&&ct.id)||!w[ct.id]||ct.classList.remove("is-active")},{capture:!0,signal:ue}),window.addEventListener("pointercancel",()=>{sl(),i==null||i()},{signal:ue}),window.addEventListener("pointerup",()=>{sl(),i==null||i()},{signal:ue})})}}function sl(){nl==null||nl.abort(),nl=null,n.state==="open"&&n.close()}function f0(e){if(e==="foreground-color"){const i=[];for(const r of Object.keys(se))i.push({class:"swatch-button",label:'<span style="border: 3px solid '+se[r]+'"></span>',command:["applyStyle",{color:r}]});return i}if(e==="background-color"){const i=[];for(const r of Object.keys(Se))i.push({class:"swatch-button",label:'<span style="background:'+Se[r]+'"></span>',command:["applyStyle",{backgroundColor:r}]});return i}}function dh(e){return So[e]!==void 0}function jf(e){var i;return typeof e!="string"?e:(So[e]||(So[e]=(i=f0(e))!=null?i:[]),So[e])}function jl(e){return typeof e=="string"?e:Object.entries(e).map(([i,r])=>`${i}:${r} !important`).join(";")}function Sm(e){return Object.keys(e).map(i=>`${i} {${jl(e[i])}}`).join("")}function ph(e){if(!e)return"";const i=new sn,r=new Qe({mode:"math",type:"root",body:Br(e,{context:i,args:c=>c==="@"?"{\\class{ML__box-placeholder}{\\blacksquare}}":"\\placeholder{}"})}),a=Du(Fl(new Mt(r.render(i),{classes:"ML__base"}),i));return Cu(a,{classes:"ML__latex"}).toMarkup()}function mh(e){var i;if(Array.isArray(e))return e.map(a=>mh(a)).flat();const r=typeof e=="string"?{markup:e}:e;return"rows"in r&&Array.isArray(r.rows)&&(r.rows=r.rows.map(a=>a.map(c=>H0(c)))),(i=r.id)!=null||(r.id="ML__layer_"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36)),[r]}function Em(){var e,i;let a=window.mathVirtualKeyboard.alphabeticLayout;if(a==="auto"){const b=zl();b&&(a=b.virtualLayout),(!a||a==="auto")&&(a=(e={fr:"azerty",be:"azerty",al:"qwertz",ba:"qwertz",cz:"qwertz",de:"qwertz",hu:"qwertz",sk:"qwertz",ch:"qwertz"}[$.locale.slice(0,2)])!=null?e:"qwerty")}const c={qwerty:["qwertyuiop"," asdfghjkl ","^zxcvbnm~"],azerty:["azertyuiop","qsdfghjklm","^ wxcvbn ~"],qwertz:["qwertzuiop"," asdfghjkl ","^yxcvbnm~"],dvorak:["^ pyfgcrl ","aoeuidhtns","qjkxbmwvz~"],colemak:[" qwfpgjluy ","arstdhneio","^zxcvbkm~"]},p=(i=c[a])!=null?i:c.qwerty,m=a==="azerty"?[[{label:"1",variants:"1"},{label:"2",shift:{latex:"\xE9"},variants:"2"},{label:"3",shift:{latex:"\xF9"},variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{label:"(",latex:"("},variants:"5"},{label:"6",shift:{label:")",latex:")"},variants:"6"},{label:"7",shift:{latex:"\xE8"},variants:"7"},{label:"8",shift:{latex:"\xEA"},variants:"8"},{label:"9",shift:{latex:"\xE7"},variants:"9"},{label:"0",shift:{latex:"\xE0"},variants:"0"}]]:[[{label:"1",variants:"1"},{label:"2",variants:"2"},{label:"3",variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{latex:"\\frac{#@}{#?}"},variants:"5"},{label:"6",shift:{latex:"#@^#?"},variants:"6"},{label:"7",variants:"7"},{label:"8",shift:{latex:"\\times"},variants:"8"},{label:"9",shift:{label:"(",latex:"("},variants:"9"},{label:"0",shift:{label:")",latex:")"},variants:"0"}]];for(const b of p){const w=[];for(const E of b)/[a-z]/.test(E)?w.push({label:E,class:"hide-shift",shift:{label:E.toUpperCase()},variants:dh(E)?E:void 0}):E==="~"?a!=="dvorak"?w.push("[backspace]"):w.push({label:"[backspace]",width:1}):E==="^"?w.push("[shift]"):E===" "&&w.push("[separator-5]");m.push(w)}return m.push(["[-]","[+]","[=]",{label:" ",width:1.5},{label:",",shift:";",variants:".",class:"hide-shift"},"[.]","[left]","[right]",{label:"[action]",width:1.5}]),{label:"abc",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.alphabetic",layers:mh({rows:m})}}function G0(e){if(e==="alphabetic")return Em();if(typeof e=="string")return console.assert(fh[e]!==void 0,`MathLive 0.98.5: unknown keyboard layout "${e}"`),G0(fh[e]);let i;if("rows"in e&&Array.isArray(e.rows)){console.assert(!("layers"in e||"markup"in e),'MathLive 0.98.5: when providing a "rows" property, "layers" and "markup" are ignored');const c=e,{rows:p}=c,m=R(c,["rows"]);i=f(P({},m),{layers:mh({rows:e.rows})})}else if("markup"in e&&typeof e.markup=="string"){const c=e,{markup:p}=c,m=R(c,["markup"]);i=f(P({},m),{layers:mh(e.markup)})}else i=P({},e),"layers"in e?i.layers=mh(e.layers):console.error('MathLive 0.98.5: provide either a "rows", "markup" or "layers" property');let r=!1,a=!1;for(const c of i.layers)if(c.rows)for(const p of c.rows.flat()){nc(p)&&(r=!0);const m=p.command;typeof m=="string"&&["undo","redo","cut","copy","paste"].includes(m)&&(a=!0)}return(!("displayShiftedKeycaps"in e)||e.displayShiftedKeycaps===void 0)&&(i.displayShiftedKeycaps=r),(!("displayEditToolbar"in e)||e.displayEditToolbar===void 0)&&(i.displayEditToolbar=!a),i}function km(e,i){var r,a;let c='<div class="left">';if(e.normalizedLayouts.length>1)for(const[p,m]of e.normalizedLayouts.entries()){const b=m,w=[p===i?"selected":"layer-switch"];b.tooltip&&w.push("MLK__tooltip"),b.labelClass&&w.push(...b.labelClass.split(" ")),c+=`<div class="${w.join(" ")}"`,b.tooltip&&(c+=" data-tooltip='"+((r=G(b.tooltip))!=null?r:b.tooltip)+"' "),p!==i&&(c+=`data-layer="${b.layers[0].id}"`),c+=`>${(a=b.label)!=null?a:"untitled"}</div>`}return c+="</div>",c}function Tm(e,i){let r="";if(e.editToolbar==="none")return"";const c=[];i.selectionIsCollapsed?c.push("undo","redo","pasteFromClipboard"):c.push("cutToClipboard","copyToClipboard","pasteFromClipboard");const p={undo:`<div class='action ${i.canUndo===!1?"disabled":""}'
|
|
|
data-command='"undo"'
|
|
|
data-tooltip='${G("tooltip.undo")}'>
|
|
|
<svg><use xlink:href='#svg-undo' /></svg>
|
|
|
</div>`,redo:`<div class='action ${i.canRedo===!1?"disabled":""}'
|
|
|
data-command='"redo"'
|
|
|
data-tooltip='${G("tooltip.redo")}'>
|
|
|
<svg><use xlink:href='#svg-redo' /></svg>
|
|
|
</div>`,cutToClipboard:`
|
|
|
<div class='action'
|
|
|
data-command='"cutToClipboard"'
|
|
|
data-tooltip='${G("tooltip.cut to clipboard")}'>
|
|
|
<svg><use xlink:href='#svg-cut' /></svg>
|
|
|
</div>
|
|
|
`,copyToClipboard:`
|
|
|
<div class='action'
|
|
|
data-command='"copyToClipboard"'
|
|
|
data-tooltip='${G("tooltip.copy to clipboard")}'>
|
|
|
<svg><use xlink:href='#svg-copy' /></svg>
|
|
|
</div>
|
|
|
`,pasteFromClipboard:`
|
|
|
<div class='action'
|
|
|
data-command='"pasteFromClipboard"'
|
|
|
data-tooltip='${G("tooltip.paste from clipboard")}'>
|
|
|
<svg><use xlink:href='#svg-paste' /></svg>
|
|
|
</div>
|
|
|
`};return r+=c.map(m=>p[m]).join(""),r}function Am(e){for(const i of e)Lm(i)}function Lm(e){const i=al.singleton;if(!i)return;const r={};if(!e.id){if(e.hasAttribute("data-label")&&(r.label=e.dataset.label),e.hasAttribute("data-latex")&&(r.latex=e.dataset.latex),e.hasAttribute("data-key")&&(r.key=e.dataset.key),e.hasAttribute("data-insert")&&(r.insert=e.dataset.insert),e.hasAttribute("data-variants")&&(r.variants=e.dataset.variants),e.hasAttribute("data-aside")&&(r.aside=e.dataset.aside),e.className&&(r.class=e.className),!r.label&&!r.latex&&!r.key&&!r.insert&&(r.latex=e.innerText,r.label=e.innerHTML),e.hasAttribute("data-command"))try{r.command=JSON.parse(e.dataset.command)}catch(a){}e.id=i.registerKeycap(r)}if(!e.innerHTML){const[a,c]=qf(r);e.innerHTML=window.MathfieldElement.createHTML(a)}}function Dm(){ds("virtual-keyboard"),ds("core"),Zi()}function Cm(){Qs("core"),Qs("virtual-keyboard")}var Mm=`<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
|
|
|
|
|
<symbol id="svg-delete-backward" viewBox="0 0 576 512">
|
|
|
<path d="M432.1 208.1L385.9 256L432.1 303C442.3 312.4 442.3 327.6 432.1 336.1C423.6 346.3 408.4 346.3 399 336.1L352 289.9L304.1 336.1C295.6 346.3 280.4 346.3 271 336.1C261.7 327.6 261.7 312.4 271 303L318.1 256L271 208.1C261.7 199.6 261.7 184.4 271 175C280.4 165.7 295.6 165.7 304.1 175L352 222.1L399 175C408.4 165.7 423.6 165.7 432.1 175C442.3 184.4 442.3 199.6 432.1 208.1V208.1zM512 64C547.3 64 576 92.65 576 128V384C576 419.3 547.3 448 512 448H205.3C188.3 448 172 441.3 160 429.3L9.372 278.6C3.371 272.6 0 264.5 0 256C0 247.5 3.372 239.4 9.372 233.4L160 82.75C172 70.74 188.3 64 205.3 64L512 64zM528 128C528 119.2 520.8 112 512 112H205.3C201 112 196.9 113.7 193.9 116.7L54.63 256L193.9 395.3C196.9 398.3 201 400 205.3 400H512C520.8 400 528 392.8 528 384V128z"/>
|
|
|
</symbol>
|
|
|
|
|
|
<symbol id="svg-shift" viewBox="0 0 384 512">
|
|
|
<path d="M2.438 252.3C7.391 264.2 19.06 272 32 272h80v160c0 26.51 21.49 48 48 48h64C250.5 480 272 458.5 272 432v-160H352c12.94 0 24.61-7.797 29.56-19.75c4.953-11.97 2.219-25.72-6.938-34.88l-160-176C208.4 35.13 200.2 32 192 32S175.6 35.13 169.4 41.38l-160 176C.2188 226.5-2.516 240.3 2.438 252.3zM192 86.63L313.4 224H224v208H160V224H70.63L192 86.63z"/>
|
|
|
</symbol>
|
|
|
|
|
|
<symbol id="svg-commit" viewBox="0 0 512 512">
|
|
|
<path d="M135 432.1l-128-128C2.344 300.3 0 294.2 0 288s2.344-12.28 7.031-16.97l128-128c9.375-9.375 24.56-9.375 33.94 0s9.375 24.56 0 33.94L81.94 264H464v-208C464 42.75 474.8 32 488 32S512 42.75 512 56V288c0 13.25-10.75 24-24 24H81.94l87.03 87.03c9.375 9.375 9.375 24.56 0 33.94S144.4 442.3 135 432.1z"/>
|
|
|
</symbol>
|
|
|
|
|
|
|
|
|
<symbol id="circle-plus" viewBox="0 0 512 512"><path d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM232 344c0 13.3 10.7 24 24 24s24-10.7 24-24V280h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H280V168c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H168c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"/></symbol>
|
|
|
|
|
|
<symbol id="svg-command" viewBox="0 0 640 512">
|
|
|
<path d="M34.495 36.465l211.051 211.05c4.686 4.686 4.686 12.284 0 16.971L34.495 475.535c-4.686 4.686-12.284 4.686-16.97 0l-7.071-7.07c-4.686-4.686-4.686-12.284 0-16.971L205.947 256 10.454 60.506c-4.686-4.686-4.686-12.284 0-16.971l7.071-7.07c4.686-4.687 12.284-4.687 16.97 0zM640 468v-10c0-6.627-5.373-12-12-12H300c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h328c6.627 0 12-5.373 12-12z"/>
|
|
|
</symbol>
|
|
|
|
|
|
<symbol id="svg-undo" viewBox="0 0 512 512">
|
|
|
<path d="M20 8h10c6.627 0 12 5.373 12 12v110.625C85.196 57.047 165.239 7.715 256.793 8.001 393.18 8.428 504.213 120.009 504 256.396 503.786 393.181 392.834 504 256 504c-63.926 0-122.202-24.187-166.178-63.908-5.113-4.618-5.354-12.561-.482-17.433l7.069-7.069c4.503-4.503 11.749-4.714 16.482-.454C150.782 449.238 200.935 470 256 470c117.744 0 214-95.331 214-214 0-117.744-95.331-214-214-214-82.862 0-154.737 47.077-190.289 116H180c6.627 0 12 5.373 12 12v10c0 6.627-5.373 12-12 12H20c-6.627 0-12-5.373-12-12V20c0-6.627 5.373-12 12-12z"/>
|
|
|
</symbol>
|
|
|
<symbol id="svg-redo" viewBox="0 0 512 512">
|
|
|
<path d="M492 8h-10c-6.627 0-12 5.373-12 12v110.625C426.804 57.047 346.761 7.715 255.207 8.001 118.82 8.428 7.787 120.009 8 256.396 8.214 393.181 119.166 504 256 504c63.926 0 122.202-24.187 166.178-63.908 5.113-4.618 5.354-12.561.482-17.433l-7.069-7.069c-4.503-4.503-11.749-4.714-16.482-.454C361.218 449.238 311.065 470 256 470c-117.744 0-214-95.331-214-214 0-117.744 95.331-214 214-214 82.862 0 154.737 47.077 190.289 116H332c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h160c6.627 0 12-5.373 12-12V20c0-6.627-5.373-12-12-12z"/>
|
|
|
</symbol>
|
|
|
<symbol id="svg-arrow-left" viewBox="0 0 320 512">
|
|
|
<path d="M206.7 464.6l-183.1-191.1C18.22 267.1 16 261.1 16 256s2.219-11.97 6.688-16.59l183.1-191.1c9.152-9.594 24.34-9.906 33.9-.7187c9.625 9.125 9.938 24.37 .7187 33.91L73.24 256l168 175.4c9.219 9.5 8.906 24.78-.7187 33.91C231 474.5 215.8 474.2 206.7 464.6z"/>
|
|
|
</symbol>
|
|
|
<symbol id="svg-arrow-right" viewBox="0 0 320 512">
|
|
|
<path d="M113.3 47.41l183.1 191.1c4.469 4.625 6.688 10.62 6.688 16.59s-2.219 11.97-6.688 16.59l-183.1 191.1c-9.152 9.594-24.34 9.906-33.9 .7187c-9.625-9.125-9.938-24.38-.7187-33.91l168-175.4L78.71 80.6c-9.219-9.5-8.906-24.78 .7187-33.91C88.99 37.5 104.2 37.82 113.3 47.41z"/>
|
|
|
</symbol>
|
|
|
<symbol id="svg-tab" viewBox="0 0 448 512">
|
|
|
<path d="M32 217.1c0-8.8 7.2-16 16-16h144v-93.9c0-7.1 8.6-10.7 13.6-5.7l143.5 143.1c6.3 6.3 6.3 16.4 0 22.7L205.6 410.4c-5 5-13.6 1.5-13.6-5.7v-93.9H48c-8.8 0-16-7.2-16-16v-77.7m-32 0v77.7c0 26.5 21.5 48 48 48h112v61.9c0 35.5 43 53.5 68.2 28.3l143.6-143c18.8-18.8 18.8-49.2 0-68L228.2 78.9c-25.1-25.1-68.2-7.3-68.2 28.3v61.9H48c-26.5 0-48 21.6-48 48zM436 64h-8c-6.6 0-12 5.4-12 12v360c0 6.6 5.4 12 12 12h8c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12z"/>
|
|
|
</symbol>
|
|
|
<symbol id="svg-paste" viewBox="0 0 512 512"><path d="M160 32c11.6 0 21.3 8.2 23.5 19.2C185 58.6 191.6 64 199.2 64H208c8.8 0 16 7.2 16 16V96H96V80c0-8.8 7.2-16 16-16h8.8c7.6 0 14.2-5.4 15.7-12.8C138.7 40.2 148.4 32 160 32zM64 64h2.7C65 69 64 74.4 64 80V96c0 17.7 14.3 32 32 32H224c17.7 0 32-14.3 32-32V80c0-5.6-1-11-2.7-16H256c17.7 0 32 14.3 32 32h32c0-35.3-28.7-64-64-64H210.6c-9-18.9-28.3-32-50.6-32s-41.6 13.1-50.6 32H64C28.7 32 0 60.7 0 96V384c0 35.3 28.7 64 64 64H192V416H64c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32zM288 480c-17.7 0-32-14.3-32-32V192c0-17.7 14.3-32 32-32h96v56c0 22.1 17.9 40 40 40h56V448c0 17.7-14.3 32-32 32H288zM416 165.3L474.7 224H424c-4.4 0-8-3.6-8-8V165.3zM448 512c35.3 0 64-28.7 64-64V235.9c0-12.7-5.1-24.9-14.1-33.9l-59.9-59.9c-9-9-21.2-14.1-33.9-14.1H288c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H448z"/></symbol>
|
|
|
<symbol id="svg-cut" viewBox="0 0 512 512"><path d="M485.6 444.2L333.6 314.9C326.9 309.2 326.1 299.1 331.8 292.4C337.5 285.6 347.6 284.8 354.4 290.5L506.4 419.8C513.1 425.5 513.9 435.6 508.2 442.4C502.5 449.1 492.4 449.9 485.6 444.2zM485.7 67.76C492.5 62.07 502.5 62.94 508.2 69.69C513.9 76.45 513.1 86.55 506.3 92.24L208.5 343.1C218.3 359.7 224 379.2 224 400C224 461.9 173.9 512 112 512C50.14 512 0 461.9 0 400C0 338.1 50.14 288 112 288C141.5 288 168.4 299.4 188.4 318.1L262.2 256L188.4 193.9C168.4 212.6 141.5 224 112 224C50.14 224 0 173.9 0 112C0 50.14 50.14 0 112 0C173.9 0 224 50.14 224 112C224 132.8 218.3 152.3 208.5 168.9L287 235.1L485.7 67.76zM32 112C32 156.2 67.82 192 112 192C156.2 192 192 156.2 192 112C192 67.82 156.2 32 112 32C67.82 32 32 67.82 32 112zM112 480C156.2 480 192 444.2 192 400C192 355.8 156.2 320 112 320C67.82 320 32 355.8 32 400C32 444.2 67.82 480 112 480z"/></symbol>
|
|
|
<symbol id="svg-copy" viewBox="0 0 512 512"><path d="M272 416C263.2 416 256 423.2 256 432V448c0 17.67-14.33 32-32 32H64c-17.67 0-32-14.33-32-32V192c0-17.67 14.33-32 32-32h112C184.8 160 192 152.8 192 144C192 135.2 184.8 128 176 128H63.99c-35.35 0-64 28.65-64 64l.0098 256C0 483.3 28.65 512 64 512h160c35.35 0 64-28.65 64-64v-16C288 423.2 280.8 416 272 416zM502.6 86.63l-77.25-77.25C419.4 3.371 411.2 0 402.7 0H288C252.7 0 224 28.65 224 64v256c0 35.35 28.65 64 64 64h160c35.35 0 64-28.65 64-64V109.3C512 100.8 508.6 92.63 502.6 86.63zM416 45.25L466.7 96H416V45.25zM480 320c0 17.67-14.33 32-32 32h-160c-17.67 0-32-14.33-32-32V64c0-17.67 14.33-32 32-32h96l.0026 64c0 17.67 14.33 32 32 32H480V320z"/>
|
|
|
</symbol>
|
|
|
<symbol id="svg-angle-double-right" viewBox="0 0 512 512"><path d="M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z"/>
|
|
|
</symbol>
|
|
|
<symbol id="svg-angle-double-left" viewBox="0 0 512 512"><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z"/>
|
|
|
</symbol>
|
|
|
<symbol id="svg-trash" viewBox="0 0 448 512">
|
|
|
<path d="M336 64l-33.6-44.8C293.3 7.1 279.1 0 264 0h-80c-15.1 0-29.3 7.1-38.4 19.2L112 64H24C10.7 64 0 74.7 0 88v2c0 3.3 2.7 6 6 6h26v368c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V96h26c3.3 0 6-2.7 6-6v-2c0-13.3-10.7-24-24-24h-88zM184 32h80c5 0 9.8 2.4 12.8 6.4L296 64H152l19.2-25.6c3-4 7.8-6.4 12.8-6.4zm200 432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V96h320v368zm-176-44V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm-80 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm160 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12z"/>
|
|
|
</symbol>
|
|
|
<symbol id="svg-keyboard-down" viewBox="0 0 576 512"><path d="M64 48c-8.8 0-16 7.2-16 16V240c0 8.8 7.2 16 16 16H512c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H64zM0 64C0 28.7 28.7 0 64 0H512c35.3 0 64 28.7 64 64V240c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM159 359c9.4-9.4 24.6-9.4 33.9 0l95 95 95-95c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L305 505c-4.5 4.5-10.6 7-17 7s-12.5-2.5-17-7L159 393c-9.4-9.4-9.4-24.6 0-33.9zm1-167c0-8.8 7.2-16 16-16H400c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V192zM120 88h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H120c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H200c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H280c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H360c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H440c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16z"/></symbol>
|
|
|
</svg>`;function Im(e){e.resetKeycapRegistry(),Dm();const i=document.createElement("div");i.className="ML__keyboard";const r=document.createElement("div");r.className="MLK__plate",r.innerHTML=window.MathfieldElement.createHTML(Mm+e.normalizedLayouts.map((m,b)=>Rm(e,m,b)).join(""));const a=document.createElement("div");a.className="MLK__backdrop",a.appendChild(r),i.appendChild(a),i.addEventListener("pointerdown",Om,{passive:!1});const c=i.querySelectorAll(".ML__edit-toolbar");if(c)for(const m of c)m.addEventListener("click",b=>{var w,E;let I=b.target,N="";for(;I&&!N;)N=(w=I==null?void 0:I.getAttribute("data-command"))!=null?w:"",I=(E=I==null?void 0:I.parentElement)!=null?E:null;N&&e.executeCommand(JSON.parse(N))});Am(i.querySelectorAll(".MLK__keycap, .action, .fnbutton, .bigfnbutton"));const p=i.querySelectorAll(".MLK__layer");console.assert(p.length>0,"No virtual keyboards available");for(const m of p)m.addEventListener("pointerdown",b=>b.preventDefault());return e.currentLayer=e.latentLayer,i}function Rm(e,i,r){const a=[];if(!("layers"in i))return"";for(const c of i.layers)a.push(`<div tabindex="-1" class="MLK__layer" id="${c.id}">`),(e.normalizedLayouts.length>1||i.displayEditToolbar)&&(a.push("<div class='MLK__toolbar' role='toolbar'>"),a.push(km(e,r)),i.displayEditToolbar&&a.push('<div class="ML__edit-toolbar right"></div>'),a.push("</div>")),a.push(Pm(e,c)),a.push("</div>");return a.join("")}function Pm(e,i){if(typeof i=="string")return i;let r="";if(typeof i.style=="string"?r+=`<style>${i.style}</style>`:typeof i.style=="object"&&(r+=`<style>${Sm(i.style)}</style>`),i.backdrop&&(r+=`<div class='${i.backdrop}'>`),i.container&&(r+=`<div class='${i.container}'>`),i.rows){r+="<div class=MLK__rows>";for(const a of i.rows){r+="<div dir='ltr' class=MLK__row>";for(const c of a)if(c){const p=e.registerKeycap(c),[m,b]=qf(c);/(^|\s)separator/.test(b)?r+=`<div class="${b}"`:r+=`<div tabindex="-1" id="${p}" class="${b}"`,c.tooltip&&(r+=` data-tooltip="${c.tooltip}"`),r+=`>${m}</div>`}r+="</div>"}r+="</div>"}else i.markup&&(r+=i.markup);return i.container&&(r+="</div>"),i.backdrop&&(r+="</div>"),r}function qf(e,i={shifted:!1}){var r,a,c,p,m,b,w;let E="",I=(r=e.class)!=null?r:"";if(i.shifted&&nc(e)&&(I+=" is-active"),i.shifted&&"shift"in e)typeof e.shift=="string"?E=ph(e.shift):typeof e.shift=="object"&&(E=e.shift.label?e.shift.label:(a=ph(e.shift.latex||e.shift.insert||"")||e.shift.key)!=null?a:""),typeof e.shift=="object"&&(I=(p=(c=e.shift.class)!=null?c:e.class)!=null?p:"");else{if(E=e.label?e.label:(m=ph(e.latex||e.insert||"")||e.key)!=null?m:"",e.shift){let N;typeof e.shift=="string"?N=ph(e.shift):e.shift.label?N=e.shift.label:N=(b=ph(e.shift.latex||e.shift.insert||"")||e.shift.key)!=null?b:"",E+=`<span class="MLK__shift">${N}</span>`}e.aside&&(E+=`<aside>${e.aside}</aside>`)}return e.layer&&!/layer-switch/.test(I)&&(I+=" layer-switch"),/(^|\s)(separator|action|shift|fnbutton|bigfnbutton)($|\s)/.test(I)||(I+=" MLK__keycap"),!/\bw[0-9]+\b/.test(I)&&e.width&&(I+=(w={0:" w0",.5:" w5",1.5:" w15",2:" w20",5:" w50"}[e.width])!=null?w:""),[E,I||"MLK__keycap"]}var ql={"[left]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-left /></svg>",command:["performWithFeedback","moveToPreviousChar"],shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-left /></svg>",command:["performWithFeedback","extendSelectionBackward"]}},"[right]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-right /></svg>",command:["performWithFeedback","moveToNextChar"],shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-right /></svg>",command:["performWithFeedback","extendSelectionForward"]}},"[up]":{class:"action hide-shift",label:"\u2191",command:["performWithFeedback","moveUp"],shift:{label:"\u219F",command:["performWithFeedback","extendSelectionUpward"]}},"[down]":{class:"action hide-shift",label:"\u2193",command:["performWithFeedback","moveDown"],shift:{label:"\u21A1",command:["performWithFeedback","extendSelectionDownward"]}},"[return]":{class:"action hide-shift",command:["performWithFeedback","commit"],shift:{command:["performWithFeedback","addRowAfter"]},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[action]":{class:"action hide-shift",command:["performWithFeedback","commit"],shift:{label:"<svg class=svg-glyph><use xlink:href=#circle-plus /></svg>",command:["performWithFeedback","addRowAfter"]},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[hr]":{class:"separator horizontal-rule"},"[hide-keyboard]":{class:"action",command:["hideVirtualKeyboard"],width:1.5,label:"<svg class=svg-glyph-lg><use xlink:href=#svg-keyboard-down /></svg>"},"[.]":{variants:".",command:["performWithFeedback","insertDecimalSeparator"],shift:",",class:"big-op hide-shift",label:"."},"[,]":{variants:",",command:["performWithFeedback","insertDecimalSeparator"],shift:".",class:"big-op hide-shift",label:","},"[+]":{variants:[{latex:"\\sum_{#0}^{#0}",class:"small"},"\\oplus"],latex:"+",label:"+",class:"big-op hide-shift",shift:{latex:"\\sum",insert:"\\sum",class:"small"}},"[-]":{variants:["\\pm","\\ominus"],latex:"-",label:"−",shift:"\\pm",class:"big-op hide-shift"},"[/]":{class:"big-op hide-shift",shift:{class:"",latex:"\\frac{1}{#@}"},variants:["/","\\div","\\%","\\oslash"],latex:"\\frac{#@}{#?}",label:"÷"},"[*]":{variants:[{latex:"\\prod_{#0}^{#0}",class:"small"},"\\otimes","\\cdot"],latex:"\\cdot",label:"×",shift:{latex:"\\times"},class:"big-op hide-shift"},"[=]":{variants:["\\neq","\\equiv","\\varpropto","\\thickapprox","\\lt","\\gt","\\le","\\ge"],latex:"=",label:"=",shift:{label:"\u2260",latex:"\\ne"},class:"big-op hide-shift"},"[backspace]":{class:"action bottom right hide-shift",width:1.5,command:["performWithFeedback","deleteBackward"],label:"<svg class=svg-glyph><use xlink:href=#svg-delete-backward /></svg>",shift:{class:"action warning",label:"<svg class=svg-glyph><use xlink:href=#svg-trash /></svg>",command:"deleteAll"}},"[undo]":{class:"ghost if-can-undo",command:"undo",label:"<svg class=svg-glyph><use xlink:href=#svg-undo /></svg>",tooltip:"tooltip.undo"},"[redo]":{class:"ghost if-can-redo",command:"redo",label:"<svg class=svg-glyph><use xlink:href=#svg-redo /></svg>",tooltip:"tooltip.redo"},"[(]":{variants:[{latex:"\\lbrack",key:"["},"\\langle","\\lfloor","\\lceil",{latex:"\\lbrace",key:"{"}],key:"(",label:"(",shift:{label:"[",key:"["},class:"hide-shift"},"[)]":{variants:[{latex:"\\rbrack",key:"]"},"\\rangle","\\rfloor","\\rceil",{latex:"\\rbrace",key:"]"}],key:")",label:")",shift:{label:"]",latex:"\\rbrack"},class:"hide-shift"},"[0]":{variants:"0",latex:"0",label:"0",shift:"\\infty",class:"hide-shift"},"[1]":{variants:"1",latex:"1",label:"1",shift:"#@^{-1}",class:"hide-shift"},"[2]":{variants:"2",latex:"2",label:"2",shift:"#@^2",class:"hide-shift"},"[3]":{variants:"3",latex:"3",label:"3",shift:"#@^3",class:"hide-shift"},"[4]":{variants:"4",latex:"4",label:"4",shift:"#@^4",class:"hide-shift"},"[5]":{variants:"5",latex:"5",label:"5",shift:"#@^5",class:"hide-shift"},"[6]":{variants:"6",latex:"6",label:"6",shift:"#@^6",class:"hide-shift"},"[7]":{variants:"7",latex:"7",label:"7",shift:"#@^7",class:"hide-shift"},"[8]":{variants:"8",latex:"8",label:"8",shift:"#@^8",class:"hide-shift"},"[9]":{variants:"9",latex:"9",label:"9",shift:"#@^9",class:"hide-shift"},"[separator-5]":{class:"separator",width:.5},"[separator]":{class:"separator"},"[separator-10]":{class:"separator"},"[separator-15]":{class:"separator",width:1.5},"[separator-20]":{class:"separator",width:2},"[separator-50]":{class:"separator",width:5},"[shift]":{class:"shift bottom left",width:1.5,label:"<span class=caps-lock-indicator></span><svg class=svg-glyph><use xlink:href=#svg-shift /></svg>"},"[foreground-color]":{variants:"foreground-color",command:["applyStyle",{color:"red"}],label:"<span style='border-radius: 50%;width:22px;height:22px; border: 3px solid #cc2428; box-sizing: border-box'>"},"[background-color]":{variants:"background-color",command:["applyStyle",{backgroundColor:"yellow"}],label:"<span style='border-radius: 50%;width:22px;height:22px; background:#fff590; box-sizing: border-box'></span>"}};function H0(e){var i;if(typeof e=="string"){if(e==="[.]"&&window.MathfieldElement.decimalSeparator===","&&(e="[,]"),!ql[e])return{latex:e};e={label:e}}let r;return"label"in e&&e.label&&ql[e.label]&&(r=f(P(P({},ql[e.label]),e),{label:ql[e.label].label})),"key"in e&&e.key&&ql[e.key]&&(r=f(P(P({},ql[e.key]),e),{key:ql[e.key].key})),r?(r.command==="insertDecimalSeparator"&&(r.label=(i=window.MathfieldElement.decimalSeparator)!=null?i:"."),e.label==="[action]"&&(r=P(P({},r),window.mathVirtualKeyboard.actionKeycap)),e.label==="[shift]"&&(r=P(P({},r),window.mathVirtualKeyboard.shiftKeycap)),e.label==="[backspace]"&&(r=P(P({},r),window.mathVirtualKeyboard.backspaceKeycap)),e.label==="[tab]"&&(r=P(P({},r),window.mathVirtualKeyboard.tabKeycap)),r):e}var gh;function Om(e){var i;if(e.button!==0)return;const r=al.singleton;if(!r)return;let a=e.target;for(;a&&!a.getAttribute("data-layer");)a=a.parentElement;if(a){r.currentLayer=(i=a.getAttribute("data-layer"))!=null?i:"",e.preventDefault();return}const c=ic(e.target);if(!(c!=null&&c.id))return;const p=r.getKeycap(c.id);if(!p)return;console.assert(e.type==="pointerdown");const m=new AbortController,b=m.signal;c.classList.add("is-pressed"),c.addEventListener("pointerenter",Zf(m),{capture:!0,signal:b}),c.addEventListener("pointerleave",Zf(m),{capture:!0,signal:b}),c.addEventListener("pointercancel",Zf(m),{signal:b}),c.addEventListener("pointerup",Zf(m),{signal:b}),nc(p)&&(c.classList.add("is-active"),r.shiftPressCount++),p.variants&&(gh&&clearTimeout(gh),gh=setTimeout(()=>{c.classList.contains("is-pressed")&&(c.classList.remove("is-pressed"),c.classList.add("is-active"),e.target&&"releasePointerCapture"in e.target&&e.target.releasePointerCapture(e.pointerId),rl(c,()=>{m.abort(),c==null||c.classList.remove("is-active")}))},300)),e.preventDefault()}function Zf(e){return i=>{const r=ic(i.target);if(!(r!=null&&r.id))return;const a=al.singleton;if(!a)return;const c=a.getKeycap(r.id);if(c){if(i.type==="pointerenter"&&i.target===r&&i.isPrimary&&r.classList.add("is-pressed"),i.type==="pointercancel"){r.classList.remove("is-pressed"),nc(c)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted)),e.abort();return}if(i.type==="pointerleave"&&i.target===r){r.classList.remove("is-pressed"),nc(c)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted));return}if(i.type==="pointerup"){gh&&clearTimeout(gh),nc(c)?r.classList.toggle("is-active",a.isShifted):r.classList.contains("is-pressed")&&(r.classList.remove("is-pressed"),a.isShifted&&c.shift?typeof c.shift=="string"?a.executeCommand(["insert",c.shift,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]):d0(c.shift):d0(c),a.shiftPressCount===1&&!i.shiftKey&&(a.shiftPressCount=0)),e.abort(),i.preventDefault();return}}}}function d0(e){var i;let r=e.command;!r&&e.insert&&(r=["insert",e.insert,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),!r&&e.key&&(r=["typedText",e.key,{focus:!0,feedback:!0,simulateKeystroke:!0}]),!r&&e.latex&&(r=["insert",e.latex,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),r||(r=["typedText",e.label,{focus:!0,feedback:!0,simulateKeystroke:!0}]),(i=al.singleton)==null||i.executeCommand(r)}function Fm(e){if(e.nodeType!==1)return!1;const i=e.classList;return i.contains("MLK__keycap")||i.contains("shift")||i.contains("action")||i.contains("fnbutton")||i.contains("bigfnbutton")}function ic(e){if(!e)return;let i=e;for(;i&&!Fm(i);)i=i.parentElement;return i!=null?i:void 0}function nc(e){return!!e.class&&/(^|\s)shift($|\s)/.test(e.class)}var al=class bm{constructor(){this.originalContainerBottomPadding=null,this.keycapRegistry={},this._shiftPressCount=0;var i,r,a;this.targetOrigin=window.origin,this.originValidator="none",this._alphabeticLayout="auto",this._layouts=Object.freeze(["default"]),this._editToolbar="default",this._container=(r=(i=window.document)==null?void 0:i.body)!=null?r:null,this._visible=!1,this._rebuilding=!1,this.observer=new ResizeObserver(c=>{this.adjustBoundingRect(),this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect})}),this.listeners={};try{(a=window.top)==null||a.addEventListener("message",this)}catch(c){window.addEventListener("message",this)}document.body.addEventListener("focusin",c=>{const p=c.target;p!=null&&p.isConnected&&setTimeout(()=>{const m=W0();m&&!m.readOnly&&m.mathVirtualKeyboardPolicy==="auto"&&O()&&this.show({animate:!0})},300)}),document.addEventListener("focusout",c=>{c.target.mathVirtualKeyboardPolicy!=="manual"&&setTimeout(()=>{W0()||this.hide()},300)})}get currentLayer(){var i,r,a;return(a=(r=(i=this._element)==null?void 0:i.querySelector(".MLK__layer.is-visible"))==null?void 0:r.id)!=null?a:""}set currentLayer(i){var r;if(!this._element){this.latentLayer=i;return}let a=i?this._element.querySelector(`#${i}.MLK__layer`):null;a||(a=this._element.querySelector(".MLK__layer")),a&&((r=this._element.querySelector(".MLK__layer.is-visible"))==null||r.classList.remove("is-visible"),a.classList.add("is-visible")),this.render()}get shiftPressCount(){return this._shiftPressCount}set shiftPressCount(i){var r;this._shiftPressCount=i>2||i<0?0:i,(r=this._element)==null||r.classList.toggle("is-caps-lock",this.shiftPressCount===2),this.render()}get isShifted(){return this._shiftPressCount>0}resetKeycapRegistry(){this.keycapRegistry={}}registerKeycap(i){const r="ML__k"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);return this.keycapRegistry[r]=i,r}getKeycap(i){return i?this.keycapRegistry[i]:void 0}getLayer(i){const r=this.normalizedLayouts;for(const a of r)for(const c of a.layers)if(c.id===i)return c}get alphabeticLayout(){return this._alphabeticLayout}set alphabeticLayout(i){this._alphabeticLayout=i,this.rebuild()}get actionKeycap(){return this._actionKeycap}set actionKeycap(i){this._actionKeycap=typeof i=="string"?{label:i}:i}get shiftKeycap(){return this._shiftKeycap}set shiftKeycap(i){this._shiftKeycap=typeof i=="string"?{label:i}:i}get backspaceKeycap(){return this._backspaceKeycap}set backspaceKeycap(i){this._backspaceKeycap=typeof i=="string"?{label:i}:i}get tabKeycap(){return this._tabKeycap}set tabKeycap(i){this._tabKeycap=typeof i=="string"?{label:i}:i}get layouts(){return this._layouts}set layouts(i){this.updateNormalizedLayouts(i),this.rebuild()}updateNormalizedLayouts(i){const r=Array.isArray(i)?[...i]:[i],a=r.findIndex(c=>c==="default");a>=0&&r.splice(a,1,"numeric","symbols","alphabetic","greek"),this._layouts=Object.freeze(r),this._normalizedLayouts=r.map(c=>G0(c))}get normalizedLayouts(){return this._normalizedLayouts||this.updateNormalizedLayouts(this._layouts),this._normalizedLayouts}get editToolbar(){return this._editToolbar}set editToolbar(i){this._editToolbar=i,this.rebuild()}get container(){return this._container}set container(i){this._container=i,this.rebuild()}static get singleton(){if(this._singleton===void 0)try{this._singleton=new bm}catch(i){this._singleton=null}return this._singleton}get style(){return this._style}addEventListener(i,r,a){this.listeners[i]||(this.listeners[i]=new Set),this.listeners[i].has(r)||this.listeners[i].add(r)}dispatchEvent(i){return!this.listeners[i.type]||this.listeners[i.type].size===0?!0:(this.listeners[i.type].forEach(r=>{typeof r=="function"?r(i):r==null||r.handleEvent(i)}),!i.defaultPrevented)}removeEventListener(i,r,a){this.listeners[i]&&this.listeners[i].delete(r)}get element(){return this._element}set element(i){var r;this._element!==i&&((r=this._element)==null||r.remove(),this._element=i)}get visible(){return this._visible}set visible(i){i?this.show():this.hide()}get boundingRect(){var i;if(!this._visible)return new DOMRect;const r=(i=this._element)==null?void 0:i.getElementsByClassName("MLK__plate")[0];return r?r.getBoundingClientRect():new DOMRect}adjustBoundingRect(){var i,r;const a=this.boundingRect.height;if(this.container===document.body){(i=this._element)==null||i.style.setProperty("--_keyboard-height",`calc(${a}px + var(--_padding-top) + var(--_padding-bottom) + env(safe-area-inset-bottom, 0))`);const c=a-1;this.container.style.paddingBottom=this.originalContainerBottomPadding?`calc(${this.originalContainerBottomPadding} + ${c}px)`:`${c}px`}else(r=this._element)==null||r.style.setProperty("--_keyboard-height",`${a}px`)}rebuild(){if(this._rebuilding||!this._element)return;this._rebuilding=!0;const i=this.currentLayer;requestAnimationFrame(()=>{this._rebuilding=!1,this._element&&(this._element.remove(),this._element=void 0),this.visible&&(this.buildAndAttachElement(),this.currentLayer=i,this.render(),this.adjustBoundingRect(),this._element.classList.add("is-visible"))})}render(){if(!this._element)return;const i=this.getLayer(this.currentLayer);this._element.classList.toggle("backdrop-is-transparent",!!(i&&(i.backdrop||i.container)));const r=this._element.querySelectorAll(".MLK__layer.is-visible .MLK__keycap, .MLK__layer.is-visible .action, .fnbutton, .MLK__layer.is-visible .bigfnbutton, .MLK__layer.is-visible .shift");if(r)for(const a of r){const c=this.getKeycap(a.id);if(c){const[p,m]=qf(c,{shifted:this.isShifted});a.innerHTML=window.MathfieldElement.createHTML(p),a.className=m}}}show(i){var r;if(this._visible)return;const a=this.container;if(a&&window.mathVirtualKeyboard&&this.stateWillChange(!0)){if(this._element||(this.buildAndAttachElement(),this.adjustBoundingRect()),!this._visible){const c=this._element.getElementsByClassName("MLK__plate")[0];if(c&&this.observer.observe(c),a===window.document.body){const p=a.style.paddingBottom;this.originalContainerBottomPadding=p;const m=c.offsetHeight-1;a.style.paddingBottom=p?`calc(${p} + ${m}px)`:`${m}px`}window.addEventListener("mouseup",this),window.addEventListener("blur",this),window.addEventListener("keydown",this,{capture:!0}),window.addEventListener("keyup",this,{capture:!0}),(r=this._element)==null||r.classList.toggle("is-caps-lock",this.shiftPressCount===2),this.currentLayer=this.latentLayer}this._visible=!0,i!=null&&i.animate?requestAnimationFrame(()=>{this._element&&(this._element.classList.add("animate"),this._element.addEventListener("transitionend",()=>{var c;return(c=this._element)==null?void 0:c.classList.remove("animate")},{once:!0}),this._element.classList.add("is-visible"),this.stateChanged())}):(this._element.classList.add("is-visible"),this.stateChanged())}}hide(i){var r;const a=this.container;if(a&&this._visible&&this.stateWillChange(!1)){if(this._visible=!1,this._element){this.latentLayer=this.currentLayer;const c=this._element.getElementsByClassName("MLK__plate")[0];c&&this.observer.unobserve(c),window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("keydown",this,{capture:!0}),window.removeEventListener("keyup",this,{capture:!0}),window.removeEventListener("contextmenu",this,{capture:!0}),sl(),Cm(),(r=this._element)==null||r.remove(),this._element=void 0,this.originalContainerBottomPadding!==null&&(a.style.paddingBottom=this.originalContainerBottomPadding)}this.stateChanged()}}get height(){var i,r;return(r=(i=this.element)==null?void 0:i.offsetHeight)!=null?r:0}buildAndAttachElement(){var i;console.assert(!this.element),this.element=Im(this),window.addEventListener("contextmenu",this,{capture:!0}),this.element.addEventListener("contextmenu",r=>{r.shiftKey||((r.ctrlKey||r.button===2)&&rl(r.target),r.preventDefault(),r.stopPropagation())},{capture:!0}),(i=this.container)==null||i.appendChild(this.element)}handleEvent(i){if($a(i)){if(!Jc(i.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${i.origin}) cannot be handled`,"SecurityError");i.data.action==="disconnect"?this.connectedMathfieldWindow=void 0:i.data.action!=="update-setting"&&i.data.action!=="proxy-created"&&i.data.action!=="execute-command"&&(console.assert(i.source!==void 0),this.connectedMathfieldWindow=i.source),this.handleMessage(i.data,i.source)}if(this._element)switch(i.type){case"mouseup":case"blur":document.body.style.userSelect="",this.shiftPressCount=0;break;case"contextmenu":i.button!==2&&i.preventDefault();break;case"keydown":{i.key==="Shift"&&!i.repeat&&(this.shiftPressCount=1);break}case"keyup":{(i.key==="Shift"||!i.getModifierState("Shift")&&this.shiftPressCount!==2)&&(this.shiftPressCount=0);break}}}handleMessage(i,r){const{action:a}=i;if(a==="execute-command"){const{command:c}=i,p=Wl(c);if(window.top!==void 0&&p!=="virtual-keyboard")return;this.executeCommand(c);return}if((a==="connect"||a==="show")&&this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},r),a!=="disconnect"&&window===window.top){if(a==="show"){typeof i.animate!="undefined"?this.show({animate:i.animate}):this.show();return}if(a==="hide"){typeof i.animate!="undefined"?this.hide({animate:i.animate}):this.hide();return}if(a==="update-setting"){i.alphabeticLayout&&(this.alphabeticLayout=i.alphabeticLayout),i.layouts&&(this.layouts=i.layouts),i.editToolbar&&(this.editToolbar=i.editToolbar);return}if(a==="proxy-created"){this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},r);return}}}sendMessage(i,r,a){if(a||(a=this.connectedMathfieldWindow),this.targetOrigin===null||this.targetOrigin==="null"||a===window){window.dispatchEvent(new MessageEvent("message",{source:window,data:P({type:ms,action:i},r)}));return}if(a)a.postMessage(P({type:ms,action:i},r),{targetOrigin:this.targetOrigin});else if(r.command&&this.dispatchEvent(new CustomEvent("math-virtual-keyboard-command",{detail:r.command})),i==="execute-command"&&Array.isArray(r.command)&&r.command[0]==="insert"){const c=r.command[1].split("");for(const p of c)this.dispatchEvent(new KeyboardEvent("keydown",{key:p,bubbles:!0})),this.dispatchEvent(new KeyboardEvent("keyup",{key:p,bubbles:!0}))}}stateWillChange(i){return this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle",{detail:{visible:i},bubbles:!0,cancelable:!0,composed:!0}))}stateChanged(){this.dispatchEvent(new Event("virtual-keyboard-toggle")),this._visible||(this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect}))}focus(){this.sendMessage("focus",{})}blur(){this.sendMessage("blur",{})}updateToolbar(i){const r=this._element;if(!r)return;r.classList.toggle("is-math-mode",i.mode==="math"),r.classList.toggle("is-text-mode",i.mode==="text"),r.classList.toggle("can-undo",i.canUndo),r.classList.toggle("can-redo",i.canRedo),r.classList.toggle("can-copy",!i.selectionIsCollapsed),r.classList.toggle("can-copy",!i.selectionIsCollapsed),r.classList.toggle("can-paste",!0);const a=r.querySelectorAll(".ML__edit-toolbar");if(a)for(const c of a)c.innerHTML=Tm(this,i)}update(i){this._style=i.style,this.updateToolbar(i)}connect(){this.connectedMathfieldWindow=window}disconnect(){this.connectedMathfieldWindow=void 0}executeCommand(i){let r,a=[],c=Wl(i);return k(i)?(r=i[0],r==="performWithFeedback"&&(i=i.slice(1),c=Wl(i)),a=i.slice(1)):r=i,r=r.replace(/-\w/g,p=>p[1].toUpperCase()),c==="virtual-keyboard"?ia[r].fn(void 0,...a):(this.sendMessage("execute-command",{command:i}),!1)}dispose(){window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("message",this)}};function W0(){var e,i;let r=t(),a=null;for(;r;){if("host"in r&&((i=(e=r.host)==null?void 0:e.tagName)==null?void 0:i.toLowerCase())==="math-field"){a=r.host;break}r=r.parentNode}return a}if(M()&&!("mathVirtualKeyboard"in window))if(window===window.top){const e=al.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>e})}else Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>wo.singleton,configurable:!0});function Yf(e){const i={};for(const r of Object.keys(e))switch(r){case"scriptDepth":const a=e.scriptDepth;if(k(a))i.scriptDepth=[a[0],a[1]];else if(typeof a=="number")i.scriptDepth=[a,a];else if(typeof a=="string"){const[p,m]=a.split(",").map(b=>parseInt(b.trim()));i.scriptDepth=[p,m]}else throw new TypeError("Unexpected value for scriptDepth");break;case"mathVirtualKeyboardPolicy":let c=e.mathVirtualKeyboardPolicy.toLowerCase();if(c==="sandboxed"){if(window!==window.top){const p=al.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>p})}c="manual"}i.mathVirtualKeyboardPolicy=c;break;case"letterShapeStyle":e.letterShapeStyle==="auto"?$.locale.startsWith("fr")?i.letterShapeStyle="french":i.letterShapeStyle="tex":i.letterShapeStyle=e.letterShapeStyle;break;case"defaultMode":["text","math","inline-math"].includes(e.defaultMode)?i.defaultMode=e.defaultMode:(console.error('MathLive 0.98.5: valid values for defaultMode are "text", "math" or "inline-math"'),i.defaultMode="math");break;case"macros":i.macros=Ae(e.macros);break;default:k(e[r])?i[r]=[...e[r]]:typeof e[r]=="object"&&!(e[r]instanceof Element)&&r!=="computeEngine"?i[r]=P({},e[r]):i[r]=e[r]}return i}function Zl(e,i){let r;typeof i=="string"?r=[i]:i===void 0?r=Object.keys(e):r=i;const a={};for(const c of r)e[c]===null?a[c]=null:k(e[c])?a[c]=[...e[c]]:typeof e[c]=="object"&&!(e[c]instanceof Element)&&c!=="computeEngine"?a[c]=P({},e[c]):a[c]=e[c];return typeof i=="string"?a[i]:a}function Xf(){return{readOnly:!1,defaultMode:"math",macros:{},registers:{},colorMap:Be,backgroundColorMap:At,letterShapeStyle:$.locale.startsWith("fr")?"french":"tex",minFontScale:0,smartMode:!1,smartFence:!0,smartSuperscript:!0,scriptDepth:[1/0,1/0],removeExtraneousParentheses:!0,isImplicitFunction:e=>["\\sin","\\cos","\\tan","\\arcsin","\\arccos","\\arctan","\\arcsec","\\arccsc","\\arsinh","\\arcosh","\\artanh","\\arcsech","\\arccsch","\\arg","\\ch","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\sec","\\sinh","\\sh","\\tanh","\\tg","\\th","\\lg","\\lb","\\log","\\ln"].includes(e),mathModeSpace:"",placeholderSymbol:"\u25A2",contentPlaceholder:"",popoverPolicy:"auto",environmentPopoverPolicy:"off",keybindings:Dd,inlineShortcuts:Td,inlineShortcutTimeout:0,mathVirtualKeyboardPolicy:"auto",virtualKeyboardTargetOrigin:window==null?void 0:window.origin,originValidator:"none",onInlineShortcut:()=>"",onScrollIntoView:null,onExport:Ld,value:""}}function j0(e){return e.defaultMode==="inline-math"?"math":e.defaultMode}function ol(e,i){!e||!i||(k(e)?e.forEach(r=>ol(r,i)):typeof e=="object"&&!e.style.color&&!e.style.backgroundColor&&!e.style.fontFamily&&!e.style.fontShape&&!e.style.fontSeries&&!e.style.fontSize&&!e.style.variant&&!e.style.variantStyle&&(e.applyStyle(i),ol(e.body,i),ol(e.above,i),ol(e.below,i),ol(e.subscript,i),ol(e.superscript,i)))}function p0(e,i,r,a){function c(m,b){for(const w of p)if(w.style[m]!==b)return!1;return!0}if(i=e.normalizeRange(i),i[0]===i[1])return!1;const p=e.getAtoms(i,{includeChildren:!0});a.operation==="toggle"&&(r.color&&c("color",r.color)&&(r.color="none",delete r.verbatimColor),r.backgroundColor&&c("backgroundColor",r.backgroundColor)&&(r.backgroundColor="none",delete r.verbatimBackgroundColor),r.fontFamily&&c("fontFamily",r.fontFamily)&&(r.fontFamily="none"),r.fontSeries&&c("fontSeries",r.fontSeries)&&(r.fontSeries="auto"),r.fontShape&&c("fontShape",r.fontShape)&&(r.fontShape="auto"),r.fontSize&&c("fontSize",r.fontSize)&&(r.fontSize=Ho),r.variant&&c("variant",r.variant)&&(r.variant="normal"),r.variantStyle&&c("variantStyle",r.variantStyle)&&(r.variantStyle=""));for(const m of p)m.applyStyle(r);return!0}function Bm(e,i){const r=e.at(e.position);if(r.type==="composition")r.value=i;else{const{caret:a}=r;r.caret=void 0;const c=new Tf(i,{mode:r.mode});c.caret=a,r.parent.addChildAfter(c,r),e.position+=1}}function Nm(e){const i=e.at(e.position);i.type==="composition"&&(i.parent.removeChild(i),e.position-=1)}Yt(["math","displaymath"],na),Yt("center",na),ke("displaylines","",{parse:e=>{const i=[];let r=[];e.beginContext({tabular:!0});do{if(e.end()||e.match("<}>"))break;e.matchColumnSeparator()||e.matchRowSeparator()?(i.push([r]),r=[]):r.push(...e.scan(a=>["<}>","&","\\cr","\\\\","\\tabularnewline"].includes(a)))}while(!0);return e.endContext(),i.push([r]),i},createAtom:e=>new kn("lines",e.args,[],{leftDelim:".",rightDelim:".",columns:[{align:"l"}]})}),dt("array","{columns:colspec}",(e,i,r,a)=>new kn(e,m0(i),r,{columns:a[0],mathstyleName:"textstyle"})),dt(["equation","equation*","subequations"],"",(e,i,r)=>new kn(e,m0(i),r,{columns:[{align:"c"}]})),dt(["multline","multline*"],"",na),dt(["align","align*","aligned","eqnarray"],"",na),dt("split","",na),dt(["gather","gathered"],"",na),dt(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],"[columns:colspec]",na),dt(["smallmatrix","smallmatrix*"],"[columns:colspec]",na),dt(["cases","dcases","rcases"],"",na);function $m(e){for(const i of e)for(const r of i)if(r.length>0)return!1;return!0}function m0(e,i=1){return $m(e)?Array(i).fill([[new Qe({type:"first"}),new ea]]):e.map(r=>r.length===0?[[new Qe({type:"first"})]]:r.map(a=>a.length===0?[new Qe({type:"first"})]:(a[0].type!=="first"&&a.unshift(new Qe({type:"first"})),a)))}function na(e,i=[[[]]],r=[],a=[]){switch(i=m0(i,["split","align","align*","aligned","eqnarray"].includes(e)?2:1),e){case"math":return new kn(e,i,r,{mathstyleName:"textstyle"});case"displaymath":return new kn(e,i,r,{mathstyleName:"textstyle"});case"center":return new kn(e,i,r,{columns:[{align:"c"}]});case"multline":case"multline*":return new kn(e,i,r,{columns:[{align:"m"}],leftDelim:".",rightDelim:"."});case"split":return new kn(e,i,r,{columns:[{align:"r"},{align:"l"}],minColumns:2});case"gather":case"gathered":return new kn(e,i,r,{columns:[{gap:.25},{align:"c"},{gap:0}]});case"pmatrix":case"pmatrix*":return new kn(e,i,r,{mathstyleName:"textstyle",leftDelim:"(",rightDelim:")",columns:Yl(a[0])});case"bmatrix":case"bmatrix*":return new kn(e,i,r,{mathstyleName:"textstyle",leftDelim:"[",rightDelim:"]",columns:Yl(a[0])});case"Bmatrix":case"Bmatrix*":return new kn(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\lbrace",rightDelim:"\\rbrace",columns:Yl(a[0])});case"vmatrix":case"vmatrix*":return new kn(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\vert",rightDelim:"\\vert",columns:Yl(a[0])});case"Vmatrix":case"Vmatrix*":return new kn(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\Vert",rightDelim:"\\Vert",columns:Yl(a[0])});case"matrix":case"matrix*":return new kn(e,i,r,{mathstyleName:"textstyle",leftDelim:".",rightDelim:".",columns:Yl(a==null?void 0:a[0])});case"smallmatrix":case"smallmatrix*":return new kn(e,i,r,{mathstyleName:"scriptstyle",columns:Yl(a==null?void 0:a[0]),colSeparationType:"small",arraystretch:.5});case"cases":case"dcases":return new kn(e,i,r,{mathstyleName:e==="dcases"?"displaystyle":"textstyle",arraystretch:1.2,leftDelim:"\\lbrace",rightDelim:".",columns:[{align:"l"},{gap:1},{align:"l"}]});case"rcases":return new kn(e,i,r,{arraystretch:1.2,leftDelim:".",rightDelim:"\\rbrace",columns:[{align:"l"},{gap:1},{align:"l"}]});case"lines":return new kn(e,i,r,{leftDelim:".",rightDelim:".",columns:[{align:"l"}]});case"align":case"align*":case"aligned":case"eqnarray":{let c=0;for(const b of i)c=Math.max(c,b.length);const p=[{gap:0},{align:"r"},{gap:.25},{align:"l"}];let m=2;for(;m<c;)p.push({gap:1},{align:"r"},{gap:.25},{align:"l"}),m+=2;return p.push({gap:0}),new kn(e,i,r,{arraycolsep:0,columns:p,minColumns:2})}}return new kn(e,i,r,{mathstyleName:"textstyle"})}function Yl(e){return e!=null?e:[{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"}]}function Km(e,i){let r=e.at(e.position);for(;r&&!(r.parent instanceof kn);)r=r.parent;if(r&&r.type==="array"&&r.environmentName,!r||!(r.parent instanceof kn)){const a=e.at(e.position);if(r=a,!r.parent.parent){let c=e.extractAtoms([e.position,e.lastOffset]),p=e.extractAtoms([0,e.position]);p.length===0&&(p=ed()),c.length===0&&(c=ed());let m;return i.endsWith("column")?(m=na("split",[[p,c]]),e.root=m,Xl(m,0,0)?Jl(e,m,0,0):Xl(m,0,1)?Jl(e,m,0,1):e.position=e.offsetOf(a)):(m=na("lines",[[p],[c]]),e.root=m,Xl(m,0,0)?Jl(e,m,0,0):Xl(m,1,0)?Jl(e,m,1,0):e.position=e.offsetOf(a)),[void 0,[0,0]]}if(r.parent instanceof rr){const c=r.parent;let p=e.extractAtoms([e.position,e.offsetOf(c.lastChild)]),m=e.extractAtoms([e.offsetOf(c.firstChild),e.position]);m.length===0&&(m=ed()),p.length===0&&(p=ed());let b="pmatrix";const w=c.leftDelim,E=c.rightDelim;w==="("&&(E===")"||E==="?")?b="pmatrix":(w==="["||w==="\\lbrack")&&(E==="]"||E==="\\rbrack"||E==="?")?b="bmatrix":w==="\\vert"&&E==="\\vert"?b="vmatrix":w==="\\Vert"&&E==="\\Vert"?b="Vmatrix":(w==="{"||w==="\\lbrace")&&(E==="."||E==="?")&&(b="cases");const I=na(b,i.endsWith("column")?[[m,p]]:[[m],[p]]);return c.parent.addChildBefore(I,c),c.parent.removeChild(c),Xl(I,0,0)?Jl(e,I,0,0):i.endsWith("column")?Xl(I,0,1)?Jl(e,I,0,1):e.position=e.offsetOf(r):Xl(I,1,0)?Jl(e,I,1,0):e.position=e.offsetOf(r),[void 0,[0,0]]}}return r&&r.parent instanceof kn?[r.parent,r.parentBranch]:[void 0,[0,0]]}function Xl(e,i,r){const a=e.getCell(i,r);return!a||a.length!==2?!1:a[1].type==="placeholder"}function Um(e,i,r,a){const c=i.getCell(r,a);return c?[e.offsetOf(c[0]),e.offsetOf(c[c.length-1])]:-1}function Jl(e,i,r,a){const c=Um(e,i,r,a);typeof c!="number"&&e.setSelection(c)}function Jf(e,i,r,a,c){const p=i.getCell(r,a);p&&e.setPositionHandlingPlaceholder(e.offsetOf(p[c==="start"?0:p.length-1]))}function Qf(e,i){const[r,[a,c]]=Km(e,i);if(r)switch(i){case"after row":r.addRowAfter(a),Jf(e,r,a+1,0,"end");break;case"after column":if(r.maxColumns<=r.colCount){e.announce("plonk");return}r.addColumnAfter(c),Jf(e,r,a,c+1,"end");break;case"before row":r.addRowBefore(a),Jf(e,r,a,0,"start");break;case"before column":if(r.maxColumns<=r.colCount){e.announce("plonk");return}r.addColumnBefore(c),Jf(e,r,a,c,"start");break}}function q0(e){return e.contentWillChange({inputType:"insertText"})?(Qf(e,"after row"),e.contentDidChange({inputType:"insertText"}),!0):!1}function zm(e){return e.contentWillChange({inputType:"insertText"})?(Qf(e,"before row"),e.contentDidChange({inputType:"insertText"}),!0):!1}function Z0(e){return e.contentWillChange({inputType:"insertText"})?(Qf(e,"after column"),e.contentDidChange({inputType:"insertText"}),!0):!1}function Vm(e){return e.contentWillChange({inputType:"insertText"})?(Qf(e,"before column"),e.contentDidChange({inputType:"insertText"}),!0):!1}function Y0(e,i){if(!e.contentWillChange({}))return!1;e.mathfield.snapshot();let r=".",a=".";switch(i){case"pmatrix":case"pmatrix*":r="(",a=")";break;case"bmatrix":case"bmatrix*":r="[",a="]";break;case"Bmatrix":case"Bmatrix*":r="\\lbrace",a="\\rbrace";break;case"vmatrix":case"vmatrix*":r="\\vert",a="\\vert";break;case"Vmatrix":case"Vmatrix*":r="\\Vert",a="\\Vert";break;case"matrix":case"matrix*":r=".",a=".";break;case"cases":case"dcases":r="\\lbrace";break;case"rcases":a="\\rbrace";break}const c=e.at(e.position),p=c.type==="array"?c:e.parentEnvironment;return p.environmentName=i,p.leftDelim=r,p.rightDelim=a,e.contentDidChange({}),!0}function X0(e,i){let r=e.at(e.position);for(;r&&!(Array.isArray(r.parentBranch)&&r.parent instanceof kn);)r=r.parent;if(Array.isArray(r==null?void 0:r.parentBranch)&&(r==null?void 0:r.parent)instanceof kn){const a=r.parent,c=r.parentBranch;let p;switch(i){case"row":if(a.rowCount>1){a.removeRow(c[0]);const m=a.getCell(Math.max(0,c[0]-1),c[1]);p=e.offsetOf(m[m.length-1])}break;case"column":if(a.colCount>a.minColumns){a.removeColumn(c[1]);const m=a.getCell(c[0],Math.max(0,c[1]-1));p=e.offsetOf(m[m.length-1])}break}p&&e.setPositionHandlingPlaceholder(p)}}function Gm(e){return e.contentWillChange({inputType:"deleteContent"})?(X0(e,"row"),e.contentDidChange({inputType:"deleteContent"}),!0):!1}function Hm(e){return e.contentWillChange({inputType:"deleteContent"})?(X0(e,"column"),e.contentDidChange({inputType:"deleteContent"}),!0):!1}es({addRowAfter:q0,addColumnAfter:Z0,addRowBefore:zm,addColumnBefore:Vm,removeRow:Gm,removeColumn:Hm,setEnvironment:Y0},{target:"model",canUndo:!0,changeContent:!0,changeSelection:!0});function ed(){return[new ea]}var J0=class xm{constructor(i){this.recording=!1,this.model=i,this.reset()}reset(){this.stack=[],this.index=-1,this.lastOp=""}startRecording(){this.recording=!0}stopRecording(){this.recording=!1}canUndo(){return this.index-1>=0}canRedo(){return this.stack.length-1>this.index}stopCoalescing(i){i&&this.index>=0&&(this.stack[this.index].selection=i),this.lastOp=""}undo(){return this.canUndo()?(this.model.setState(this.stack[this.index-1],{silenceNotifications:!1,type:"undo"}),this.index-=1,this.lastOp="",!0):!1}redo(){return this.canRedo()?(this.index+=1,this.model.setState(this.stack[this.index],{silenceNotifications:!1,type:"redo"}),this.lastOp="",!0):!1}pop(){this.canUndo()&&(this.stack.splice(this.index,this.stack.length-this.index),this.index-=1)}snapshot(i){return this.recording?(i&&i===this.lastOp&&this.pop(),this.stack.splice(this.index+1,this.stack.length-this.index-1),this.stack.push(this.model.getState()),this.index+=1,this.stack.length>xm.maximumDepth&&(this.stack.shift(),this.index-=1),this.lastOp=i!=null?i:"",!0):!1}};J0.maximumDepth=1e3;var Wm=J0;function g0(e,i,r){if(e.at(i).mode!=="text")return i;const a=r==="backward"?-1:1;let c;if(it.test(e.at(i).value)){let p=i,m;do m=e.at(p).mode==="text"&&it.test(e.at(p).value),p+=a;while(e.at(p)&&m);c=e.at(p)?p-2*a:p-a}else if(/\s/.test(e.at(i).value)){let p=i;for(;e.at(p)&&e.at(p).mode==="text"&&/\s/.test(e.at(p).value);)p+=a;if(!e.at(p))c=p-a;else{let m=!0;do m=e.at(p).mode==="text"&&!/\s/.test(e.at(p).value),p+=a;while(e.at(p)&&m);c=e.at(p)?p-2*a:p-a}}else{let p=i;for(;e.at(p)&&e.at(p).mode==="text"&&!/\s/.test(e.at(p).value);)p+=a;c=e.at(p)?p:p-a;let m=!0;for(;e.at(p)&&m;)m=e.at(p).mode==="text"&&/\s/.test(e.at(p).value),m&&(c=p),p+=a;c=e.at(p)?p-2*a:p-a}return c-(a>0?0:1)}function rc(e,i,r){var a,c,p,m,b,w,E;const I=e.position;(a=r==null?void 0:r.extend)!=null&&a||e.collapseSelection(i);let N=e.at(e.position);if(i==="forward"&&(N.type==="subsup"?(N=N.rightSibling,N||(N=e.at(e.position+1))):N=e.at(e.position+1)),!N)return e.announce("plonk"),!1;let Z=e.offsetOf(N);if(N instanceof Ll)Z=g0(e,Z,i);else if(N instanceof Ir)if(N.isSuggestion)for(console.assert(i==="forward");N&&N instanceof Ir;)N.isSuggestion=!1,Z=e.offsetOf(N),N=N.rightSibling;else if(i==="forward"){if(N=N.rightSibling,!N||!(N instanceof Ir))return e.announce("plonk"),!1;for(;N&&N instanceof Ir&&/[a-zA-Z\*]/.test(N.value);)Z=e.offsetOf(N),N=N.rightSibling}else{if(N=N.leftSibling,!N||!(N instanceof Ir))return e.announce("plonk"),!1;for(;N&&N instanceof Ir&&/[a-zA-Z\*]/.test(N.value);)Z=e.offsetOf(N),N=N.leftSibling}else if(i==="forward"&&N.type==="mopen"){let ue=0;do N.type==="mopen"?ue+=1:N.type==="mclose"&&(ue-=1),N=N.rightSibling;while(!N.isLastSibling&&ue!==0);Z=e.offsetOf(N.leftSibling)}else if(i==="backward"&&N.type==="mclose"){let ue=0;do N.type==="mopen"?ue+=1:N.type==="mclose"&&(ue-=1),N=N.leftSibling;while(!N.isFirstSibling&&ue!==0);Z=e.offsetOf(N)}else if(i==="backward")if(N.type==="first")for(;Z>0&&N.type==="first";)Z-=1,N=e.at(Z);else{const ue=N.type;N.type==="subsup"&&(Z=e.offsetOf(e.at(Z).leftSibling)),Z-=1;let me=(c=e.at(Z))==null?void 0:c.type;for(;Z>=0&&me===ue;)((p=e.at(Z))==null?void 0:p.type)==="subsup"?Z=e.offsetOf(e.at(Z).leftSibling):Z-=1,me=e.at(Z).type}else{const{type:ue}=N;let me=(m=e.at(Z))==null?void 0:m.type;const{lastOffset:Ge}=e;for(;Z<=Ge&&(me===ue||me==="subsup");){for(;((b=e.at(Z).rightSibling)==null?void 0:b.type)==="subsup";)Z=e.offsetOf(e.at(Z).rightSibling);Z+=1,me=(w=e.at(Z))==null?void 0:w.type}Z-=1}if((E=r==null?void 0:r.extend)!=null&&E){if(!e.setSelection(e.anchor,Z))return e.announce("plonk"),!1}else{if(Z===e.position)return e.announce("plonk"),!1;e.position=Z}return e.announce("move",I),e.mathfield.stopCoalescingUndo(),!0}function Ka(e,i,r){var a,c;if(r=r!=null?r:{extend:!1},e.mathfield.adoptStyle=i==="backward"?"right":"left",i!=="forward"){const[b,w]=B(e);b!==void 0&&w!==void 0&&e.deleteAtoms([b,w])}if(i==="upward")return qm(e,r);if(i==="downward")return Zm(e,r);if(r.extend){let b=td(e,e.position,i);b<0&&(b=0),b>e.lastOffset&&(b=e.lastOffset);const w=e.setSelection(e.anchor,b);return e.mathfield.stopCoalescingUndo(),w}if(e.selectionIsPlaceholder){e.collapseSelection(i);const b=Ka(e,i);return e.mathfield.stopCoalescingUndo(),b}let p=e.position;const m=p;if(e.collapseSelection(i)?(p=e.position,Q0(e,p)||(p=td(e,p,i))):p=td(e,p,i),p<0||p>e.lastOffset){let b=!0;return e.silenceNotifications||(b=(c=(a=e.mathfield.host)==null?void 0:a.dispatchEvent(new CustomEvent("move-out",{detail:{direction:i},cancelable:!0,bubbles:!0,composed:!0})))!=null?c:!0),b&&e.announce("plonk"),b}return e.setPositionHandlingPlaceholder(p),e.mathfield.stopCoalescingUndo(),e.announce("move",m),!0}function td(e,i,r){return i=i+(r==="forward"?1:-1),i<0||i>e.lastOffset||Q0(e,i)?i:td(e,i,r)}function Q0(e,i){var r;const a=e.at(i);let c=a.parent;for(;c&&!c.inCaptureSelection;)c=c.parent;return!(c!=null&&c.inCaptureSelection||(r=a.parent)!=null&&r.skipBoundary&&(!a.isFirstSibling&&a.isLastSibling||a.type==="first")||e.mathfield.hasEditablePrompts&&!a.parentPrompt)}function jm(e,i,r){let a=1/0,c=0;for(;c<i.length;c++){const p=_f(e.getHTMLElement(i[c])).right,m=Math.abs(r-p);if(m<=a)a=m;else break}return i[c-1]}function id(e,i,r,a,c){const p=e.mathfield.hasEditablePrompts,m=p?r.filter(E=>E.type==="prompt"&&!E.captureSelection):r,b=_f(e.mathfield.getHTMLElement(i)).right,w=e.offsetOf(jm(e.mathfield,m,b))-(p?1:0);if(a){const[E,I]=e.selection.ranges[0];let N;w<(c==="up"?E:I)?N={ranges:[[w,I]],direction:"backward"}:N={ranges:[[E,w]],direction:"forward"},e.setSelection(N)}else e.setPositionHandlingPlaceholder(w);e.announce(`move ${c}`)}function qm(e,i){var r,a;const c=(r=i==null?void 0:i.extend)!=null?r:!1;c||e.collapseSelection("backward");const p=()=>{var w,E;let I=!0;return e.silenceNotifications||(I=(E=(w=e.mathfield.host)==null?void 0:w.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"upward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?E:!0),e.announce(I?"plonk":"line"),I},m=e.at(e.position);let b=m;for(;b&&b.parentBranch!=="below"&&!(Array.isArray(b.parentBranch)&&b.parent instanceof kn);)b=b.parent;if(Array.isArray(b==null?void 0:b.parentBranch)&&b.parent instanceof kn){const w=b.parent;if(b.parentBranch[0]<1)return p();const E=b.parentBranch[0]-1,I=w.array[E][b.parentBranch[1]];if(!I.some(Z=>Z.type==="prompt"&&!Z.captureSelection)&&e.mathfield.hasEditablePrompts)return p();id(e,m,I,c,"up")}else if(b){const w=(a=b.parent.branch("above"))!=null?a:b.parent.createBranch("above");if(!w.some(I=>I.type==="prompt"&&I.placeholderId)&&e.mathfield.hasEditablePrompts)return p();id(e,m,w,c,"up")}else return p();return e.mathfield.stopCoalescingUndo(),!0}function Zm(e,i){var r,a;const c=(r=i==null?void 0:i.extend)!=null?r:!1;c||e.collapseSelection("forward");const p=()=>{var w,E;let I=!0;return e.silenceNotifications||(I=(E=(w=e.mathfield.host)==null?void 0:w.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"downward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?E:!0),e.announce(I?"plonk":"line"),I},m=e.at(e.position);let b=m;for(;b&&b.parentBranch!=="above"&&!(Array.isArray(b.parentBranch)&&b.parent instanceof kn);)b=b.parent;if(Array.isArray(b==null?void 0:b.parentBranch)&&b.parent instanceof kn){const w=b.parent;if(b.parentBranch[0]+1>w.array.length-1)return p();const E=b.parentBranch[0]+1,I=w.array[E][b.parentBranch[1]];if(!I.some(Z=>Z.type==="prompt"&&!Z.captureSelection)&&e.mathfield.hasEditablePrompts)return p();id(e,m,I,c,"down")}else if(b){const w=(a=b.parent.branch("below"))!=null?a:b.parent.createBranch("below");if(!w.some(I=>I.type==="prompt")&&e.mathfield.hasEditablePrompts)return p();id(e,m,w,c,"down")}else return p();return!0}function ep(e){const i=e.position,r=e.at(i).parent;return r!=null&&r.parent?(e.position=e.offsetOf(r),e.mathfield.stopCoalescingUndo(),e.announce("move",i),!0):(e.announce("plonk"),!1)}function Ym(e){let i=0,r=e.at(e.position),a=!1;for(;r;)(!r.hasEmptyBranch("superscript")||!r.hasEmptyBranch("subscript"))&&(i+=1),r.hasEmptyBranch("superscript")?r.hasEmptyBranch("subscript")||(a=!1):a=!0,r=r.parent;return a?i:0}function Xm(e){let i=0,r=e.at(e.position),a=!1;for(;r;)(!r.hasEmptyBranch("superscript")||!r.hasEmptyBranch("subscript"))&&(i+=1),r.hasEmptyBranch("superscript")?r.hasEmptyBranch("subscript")||(a=!0):a=!1,r=r.parent;return a?i:0}function tp(e){var i;if(e.collapseSelection(),Ym(e)>=e.mathfield.options.scriptDepth[1])return e.announce("plonk"),!1;let r=e.at(e.position);return r.subsupPlacement===void 0&&(((i=r.rightSibling)==null?void 0:i.type)!=="subsup"&&r.parent.addChildAfter(new _o({style:r.computedStyle}),r),r=r.rightSibling),r.createBranch("superscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(r.superscript[0]))),!0}function ip(e){var i;if(e.collapseSelection(),Xm(e)>=e.mathfield.options.scriptDepth[0])return e.announce("plonk"),!1;let r=e.at(e.position);return r.subsupPlacement===void 0&&(((i=e.at(e.position+1))==null?void 0:i.type)!=="subsup"&&r.parent.addChildAfter(new _o({style:e.at(e.position).computedStyle}),r),r=e.at(e.position+1)),r.createBranch("subscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(r.subscript[0]))),!0}function Jm(){function e(w){const E=[],I=[];return[...w.querySelectorAll(`input, select, textarea, a[href], button,
|
|
|
[tabindex], audio[controls], video[controls],
|
|
|
[contenteditable]:not([contenteditable="false"]), details>summary`)].filter(i).forEach((Z,ue)=>{const me=a(Z);me===0?E.push(Z):I.push({documentOrder:ue,tabIndex:me,node:Z})}),I.sort((Z,ue)=>Z.tabIndex===ue.tabIndex?Z.documentOrder-ue.documentOrder:Z.tabIndex-ue.tabIndex).map(Z=>Z.node).concat(E)}function i(w){return!(!r(w)||c(w)||a(w)<0)}function r(w){return!(w.disabled||w.type==="hidden"&&w.tagName.toUpperCase()==="INPUT"||b(w))}function a(w){var E;const I=Number.parseInt((E=w.getAttribute("tabindex"))!=null?E:"NaN",10);return Number.isNaN(I)?w.contentEditable==="true"||(w.nodeName==="AUDIO"||w.nodeName==="VIDEO")&&w.getAttribute("tabindex")===null?0:w.tabIndex:I}function c(w){return w.tagName.toUpperCase()==="INPUT"&&w.type==="radio"&&!m(w)}function p(w,E){for(const I of w)if(I.checked&&I.form===E)return I;return null}function m(w){var E;if(!w.name)return!0;const N=((E=w.form)!=null?E:w.ownerDocument).querySelectorAll('input[type="radio"][name="'+w.name+'"]'),Z=p(N,w.form);return!Z||Z===w}function b(w){if(!M()||w===document.activeElement||w.contains(document.activeElement))return!1;if(getComputedStyle(w).visibility==="hidden")return!0;const E=w.getBoundingClientRect();if(E.width===0||E.height===0)return!0;for(;w;){if(getComputedStyle(w).display==="none")return!0;w=w.parentElement}return!1}return M()?e(document.body):[]}function gs(e,i,r="forward"){const a=e.position;if(Array.isArray(i)){const c=e.offsetOf(i[0]),p=e.offsetOf(i[i.length-1]);return r==="forward"?e.setSelection(c,p):e.setSelection(p,c),e.announce("move",a),e.mathfield.stopCoalescingUndo(),!0}return r==="forward"?gs(e,[i.leftSibling,i]):gs(e,[i,i.leftSibling])}function ba(e,i){const r=e.position;if(typeof i=="number"&&(i=e.at(i)),i.type==="prompt")e.setSelection(e.offsetOf(i.firstChild),e.offsetOf(i.lastChild));else{const a=e.offsetOf(i);i.type==="placeholder"?e.setSelection(a-1,a):e.position=a}return e.announce("move",r),e.mathfield.stopCoalescingUndo(),!0}function nd(e,i,r=!0){var a,c;const p=i==="forward"?1:-1;e.at(e.anchor).type==="placeholder"&&Ka(e,i);let m;const b=e.at(e.anchor).parentPrompt;b?i==="forward"?m=e.offsetOf(b)+1:m=e.offsetOf(b.leftSibling):m=Math.max(e.position+p,0);const w=_0(e,m,i);if(!w||i==="forward"&&e.offsetOf(w)<m||i==="backward"&&e.offsetOf(w)>m){if(!r||!((c=(a=e.mathfield.host)==null?void 0:a.dispatchEvent(new CustomEvent("move-out",{detail:{direction:i},cancelable:!0,bubbles:!0,composed:!0})))==null||c))return e.announce("plonk"),!1;const I=Jm();if(!document.activeElement||I.length<=1)return e.announce("plonk"),!1;let N=I.indexOf(document.activeElement)+p;return N<0&&(N=I.length-1),N>=I.length&&(N=0),I[N].focus(),e.mathfield.stopCoalescingUndo(),!0}return ba(e,w),!0}function _0(e,i=0,r="forward"){return e.findAtom(a=>a.type==="placeholder"||a.type==="prompt"||!e.mathfield.readOnly&&a.treeDepth>2&&a.isFirstSibling&&a.isLastSibling,i,r)}es({moveToOpposite:e=>{const i={superscript:"subscript",subscript:"superscript",above:"below",below:"above"},r=e.at(e.position),{parent:a}=r;if(!a)return e.announce("plonk"),!1;const c=r.parentBranch;let p;if(typeof c=="string"&&(p=i[c]),!p){const b=r.subsupPlacement?ip(e):tp(e);return e.mathfield.stopCoalescingUndo(),b}a.branch(p)||a.createBranch(p);const m=e.setSelection(e.getBranchRange(e.offsetOf(a),p));return e.mathfield.stopCoalescingUndo(),m},moveBeforeParent:e=>{const{parent:i}=e.at(e.position);return i?(e.position=e.offsetOf(i),e.mathfield.stopCoalescingUndo(),!0):(e.announce("plonk"),!1)},moveAfterParent:e=>ep(e),moveToNextChar:e=>Ka(e,"forward"),moveToPreviousChar:e=>Ka(e,"backward"),moveUp:e=>Ka(e,"upward"),moveDown:e=>Ka(e,"downward"),moveToNextWord:e=>rc(e,"forward"),moveToPreviousWord:e=>rc(e,"backward"),moveToGroupStart:e=>{const i=e.offsetOf(e.at(e.position).firstSibling);return i===e.position?(e.announce("plonk"),!1):(e.position=i,e.mathfield.stopCoalescingUndo(),!0)},moveToGroupEnd:e=>{const i=e.offsetOf(e.at(e.position).lastSibling);return i===e.position?(e.announce("plonk"),!1):(e.position=i,e.mathfield.stopCoalescingUndo(),!0)},moveToNextGroup:e=>{var i,r,a,c;if(e.position===e.lastOffset&&e.anchor===e.lastOffset)return nd(e,"forward");const p=e.at(e.position);if(p.mode==="text"){if(e.selectionIsCollapsed){let Z=p;for(;Z&&Z.mode==="text";)Z=Z.leftSibling;let ue=p;for(;((i=ue.rightSibling)==null?void 0:i.mode)==="text";)ue=ue.rightSibling;if(Z&&ue)return gs(e,[Z,ue])}if(p.rightSibling.mode==="text"){let Z=p;for(;Z&&Z.mode==="text";)Z=Z.rightSibling;return Z?(ba(e,(r=Z.leftSibling)!=null?r:Z),e.mathfield.switchMode("math"),!0):ba(e,e.lastOffset)}}const b=e.at(e.anchor).parentPrompt,w=b?e.offsetOf(b)+1:Math.max(e.position+1,0),E=_0(e,w,"forward");if(E)return ba(e,E);const I=np(e,p,Z=>Z.type==="leftright"||Z.type==="text","forward");if(I){if(I.mode==="text"){let Z=I;for(;Z&&Z.mode==="text";)Z=Z.rightSibling;return gs(e,[(a=I.leftSibling)!=null?a:I,(c=Z.leftSibling)!=null?c:Z])}return gs(e,I)}const N=p.parent;if(N){if(N.type==="leftright"||N.type==="surd")return gs(e,N);if(p.parentBranch==="superscript"&&N.subscript)return gs(e,N.subscript);if(p.parentBranch==="above"&&N.below)return gs(e,N.below);if(p.parentBranch==="superscript"||p.parentBranch==="subscript")return ba(e,N);if(p.parentBranch==="above"||p.parentBranch==="below")return gs(e,N)}return ba(e,e.lastOffset)},moveToPreviousGroup:e=>{var i;if(e.position===0&&e.anchor===0)return nd(e,"backward");let r=e.at(e.position);const a=r.mode;if(a==="text"){if(e.selectionIsCollapsed){let b=r;for(;b&&b.mode==="text";)b=b.leftSibling;let w=r;for(;((i=w.rightSibling)==null?void 0:i.mode)==="text";)w=w.rightSibling;if(b&&w)return gs(e,[b,w])}for(;r&&r.mode==="text";)r=r.leftSibling;return r?ba(e,r):ba(e,0)}const c=e.at(e.anchor).parentPrompt,p=c?e.offsetOf(c.leftSibling):Math.max(e.position-1,0),m=_0(e,p,"backward");if(m)return ba(e,m);if(a==="math"){const b=np(e,r,E=>E.type==="leftright"||E.type==="text","backward");if(b){if(b.mode==="text"){let E=b;for(;E&&E.mode==="text";)E=E.leftSibling;return gs(e,[b,E])}return gs(e,b)}const w=r.parent;if(w){if(w.type==="leftright"||w.type==="surd")return gs(e,w);if(r.parentBranch==="subscript"&&w.superscript)return gs(e,w.superscript);if(r.parentBranch==="below"&&w.above)return gs(e,w.above);if(r.parentBranch==="superscript"||r.parentBranch==="subscript")return ba(e,w);if(r.parentBranch==="above"||r.parentBranch==="below")return gs(e,w)}return ba(e,0)}return!1},moveToMathfieldStart:e=>e.selectionIsCollapsed&&e.position===0?(e.announce("plonk"),!1):(e.position=0,e.mathfield.stopCoalescingUndo(),!0),moveToMathfieldEnd:e=>e.selectionIsCollapsed&&e.position===e.lastOffset?(e.announce("plonk"),!1):(e.position=e.lastOffset,e.mathfield.stopCoalescingUndo(),!0),moveToSuperscript:tp,moveToSubscript:ip},{target:"model",changeSelection:!0}),es({moveToNextPlaceholder:e=>nd(e,"forward"),moveToPreviousPlaceholder:e=>nd(e,"backward")},{target:"model",changeSelection:!0,audioFeedback:"return"});function np(e,i,r,a){if(a==="forward"){let p=i.rightSibling;for(;p&&!r(p);)p=p.rightSibling;return p}let c=i.leftSibling;for(;c&&!r(c);)c=c.leftSibling;return c}function rd(e,i,r){typeof i=="function"&&(r=i,i=1/0),i===void 0&&(i=1/0);let a=e.position,c=!1,p="";for(;!c;){const m=e.at(a);c=i===0||m===void 0||m.type==="first"||m.mode!=="math"||!(m.type&&/mord|mpunct|operator/.test(m.type)||m.type==="mop"&&/[a-zA-Z ]+/.test(m.value))||!m.hasEmptyBranch("superscript")||!m.hasEmptyBranch("subscript")||typeof r=="function"&&!r(m),c||(m.mode="text",m.command=m.value,m.verbatimLatex=void 0,p+=m.value),a-=1,i-=1}e.contentDidChange({data:p,inputType:"insertText"})}function Ql(e,i,r){typeof i=="function"&&(r=i,i=1/0),i===void 0&&(i=1/0);let a=e.position,c=!1;const p=[];for(;!c;){const m=e.at(a);c=i===0||!m||m.type==="first"||m.isFirstSibling||m.mode!=="text"||m.value===" "||typeof r=="function"&&!r(m),c||(p.push(Qe.serialize([m],{defaultMode:"math"})),m.mode="math"),a-=1,i-=1}v0(e),e.contentDidChange({data:un(p),inputType:"insertText"})}function v0(e){var i;let r=e.position-1;for(;r>=0&&((i=e.at(r))==null?void 0:i.mode)==="math";)r-=1;if(!(r<0)&&e.at(r).mode==="text"&&e.at(r).value===" "&&e.at(r-1).mode==="math"){e.at(r-1).parent.removeChild(e.at(r-1));const a=e.silenceNotifications;e.silenceNotifications=!0,e.position-=1,e.silenceNotifications=a,e.contentDidChange({inputType:"deleteContent"})}}function Qm(e){let i="",r=e.position,a=!1;for(;!a;){const c=e.at(r);a=!(c&&(c.mode==="text"||c.mode==="math"&&c.type&&/mord|mpunct/.test(c.type))),a||(i=c.value+i),r-=1}return i}function eg(e,i,r){const{model:a}=e;if(a.mode==="latex"||!a.at(a.position).isLastSibling||!r||!h(r))return!1;const c=o(r);if(!a.selectionIsCollapsed)return!!(e.model.mode==="text"&&/[/_^]/.test(c));const p=Qm(a)+c;if(e.model.mode==="text"){if(i==="Esc"||/[/\\]/.test(c))return!0;if(/[\^_]/.test(c))return/(^|\s)[a-zA-Z][^_]$/.test(p)&&Ql(a,1),!0;const m={")":"(","}":"{","]":"["}[c],{parent:b}=a.at(a.position);if(m&&b instanceof rr&&b.leftDelim===m)return!0;if(/(^|[^a-zA-Z])(a|I) $/.test(p))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(c))return!0;if(/(^|[^a-zA-Z'’])[a-zA-Z] $/.test(p))return Ql(a,1),!1;if(/\D\.[^\d\s]$/.test(p)){Ql(a,1);const w=a.at(a.position);return w.value="\u22C5",w.style.variant="normal",w.command="\\cdot",w.verbatimLatex=void 0,a.contentDidChange({data:"\\cdot",inputType:"insertText"}),!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(p)||/\.\d$/.test(p)||/\([\d+\-.]$/.test(p))return Ql(a,1),!0;if(/\([a-z][,;]$/.test(p))return Ql(a,2),!0;if(/[\d+\-=><*|]$/.test(c))return v0(a),!0}else{if(i==="[Space]")return rd(a,void 0,m=>/[a-z][:,;.]$/.test(m.value)),!0;if(/[a-zA-Z]{3,}$/.test(p)&&!/(dxd|abc|xyz|uvw)$/.test(p))return rd(a,void 0,m=>/[a-zA-Z]/.test(m.value)),!0;if(/(^|\W)(if)$/i.test(p))return rd(a,1),!0;if(/(\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5){3,}$/u.test(p)&&!/(αβγ)$/.test(p))return rd(a,void 0,m=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5)/u.test(m.value)),!0;if(c==="?"||c==="."&&!/[\d-+]\.$/.test(p))return!0}return!1}function tg(e,i){if(!e.isSelectionEditable||!e.keystrokeCaptionVisible)return;const r=rp(),a=e.element.getBoundingClientRect();r.style.left=`${a.left}px`,r.style.top=`${a.top-64}px`,r.innerHTML=window.MathfieldElement.createHTML("<span>"+(Vl(i)||i)+"</span>"+r.innerHTML),r.style.visibility="visible",setTimeout(()=>{r.childNodes.length>0&&r.childNodes[r.childNodes.length-1].remove(),r.childNodes.length===0&&(r.style.visibility="hidden")},3e3)}function ig(e){if(e.keystrokeCaptionVisible=!e.keystrokeCaptionVisible,e.keystrokeCaptionVisible){const i=rp();i.innerHTML=""}else{const i=Ie("mathlive-keystroke-caption-panel");i.style.visibility="hidden"}return!1}function rp(){const e=document.getElementById("mathlive-keystroke-caption-panel");return e||(ds("keystroke-caption"),ds("core"),Ie("mathlive-keystroke-caption-panel"))}function ng(){document.getElementById("mathlive-keystroke-caption-panel")&&(tt("mathlive-keystroke-caption-panel"),Qs("core"),Qs("keystroke-caption"))}function sp(e,i){var r,a,c;const{model:p}=e,m=l(i);if(i.isTrusted){l0(i);const ue=zl();e.keyboardLayout!==ue.id&&(e.keyboardLayout=ue.id,e._keybindings=void 0)}if(clearTimeout(e.inlineShortcutBufferFlushTimer),e.inlineShortcutBufferFlushTimer=0,tg(e,m),i.isTrusted&&i.defaultPrevented)return e.flushInlineShortcutBuffer(),!1;let b,w="",E;const I=e.inlineShortcutBuffer;if(e.isSelectionEditable){if(p.mode==="math")if(m==="[Backspace]")I.pop();else if(!h(i))e.flushInlineShortcutBuffer();else{const ue=o(i),me=[...(a=(r=I[I.length-1])==null?void 0:r.keystrokes)!=null?a:[],ue];I.push({state:p.getState(),keystrokes:me,leftSiblings:rg(e)});let Ge=0,Lt="";for(;!b&&Ge<me.length;)E=I.length-(me.length-Ge),Lt=me.slice(Ge).join(""),b=Yo(I[E].leftSiblings,Lt,e.options.inlineShortcuts),!b&&/^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(Lt)&&(b=e.options.onInlineShortcut(e,Lt)),Ge+=1;e.flushInlineShortcutBuffer({defer:!0})}e.options.smartMode&&(b?e.switchMode("math"):eg(e,m,i)&&(e.switchMode({math:"text",text:"math"}[p.mode]),w=""))}if(!b){if(w||(w=d(e.keybindings,p.mode,i)),!w&&(m==="[Enter]"||m==="[Return]")){let ue=!1;return p.contentWillChange({inputType:"insertLineBreak"})&&(e.host&&(ue=!e.host.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),ue||i.preventDefault&&(i.preventDefault(),i.stopPropagation()),p.contentDidChange({inputType:"insertLineBreak"})),ue}if((!w||m==="[Space]")&&p.mode==="math"){if(m==="[Space]"){if(e.adoptStyle="none",e.flushInlineShortcutBuffer(),e.options.mathModeSpace)return Gn.insert(p,e.options.mathModeSpace,{format:"latex",mode:"math"}),e.snapshot("insert-space"),w="",e.dirty=!0,e.scrollIntoView(),i.preventDefault&&(i.preventDefault(),i.stopPropagation()),!1;const ue=p.at(p.position+1),me=p.at(p.position-1);if((ue==null?void 0:ue.mode)==="text"||(me==null?void 0:me.mode)==="text")return Gn.insert(p," ",{mode:"text"}),e.snapshot("insert-space"),e.dirty=!0,e.scrollIntoView(),!1}(c=p.at(p.position))!=null&&c.isDigit()&&window.MathfieldElement.decimalSeparator===","&&o(i)===","&&(w="insertDecimalSeparator")}}if(!b&&!w){if(p.mathfield.smartFence){if(b0(p,o(i),e.effectiveStyle))return e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}else{const{parent:ue}=p.at(p.position);if(ue instanceof rr&&ue.rightDelim==="?"&&p.at(p.position).isLastSibling&&/^[)}\]|]$/.test(m))return e.snapshot(),ue.isDirty=!0,ue.rightDelim=m,p.position+=1,p.selectionDidChange(),p.contentDidChange({data:o(i),inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1;if(!p.selectionIsCollapsed){const me=o(i);if(me==="("||me==="{"||me==="["){const Ge={"(":"(","{":"\\lbrace","[":"\\lbrack"}[me],Lt={"(":")","{":"\\rbrace","[":"\\rbrack"}[me],[Ue,ct]=jr(p.selection);return e.snapshot(),p.position=ct,Gn.insert(p,Lt,{format:"latex"}),p.position=Ue,Gn.insert(p,Ge,{format:"latex"}),p.setSelection(Ue+1,ct+1),p.contentDidChange({data:me,inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}}}return!0}const N=p.at(Math.max(p.position,p.anchor)),{parent:Z}=N;if(w==="moveAfterParent"&&(Z==null?void 0:Z.type)==="leftright"&&N.isLastSibling&&e.options.smartFence&&b0(p,".",e.defaultStyle)&&(w="",_i(e)),e.keyboardDelegate.cancelComposition(),w)e.executeCommand(w);else if(b){const ue=e.effectiveStyle;p.setState(I[E].state);const me=I[I.length-1].keystrokes;for(const Ge of me)Gn.insert(p,Ge,{silenceNotifications:!0,style:ue});e.snapshot("insert-shortcut"),p.setState(I[E].state),p.deferNotifications({content:!0,selection:!0,data:b,type:"insertText"},()=>(Gn.insert(p,b,{format:"latex",style:ue}),v0(e.model),b.endsWith(" ")&&(e.switchMode("text"),Gn.insert(p," ",{style:ue,mode:"text"})),e.snapshot(),p.selectionIsCollapsed||e.flushInlineShortcutBuffer(),!0)),e.dirty=!0,p.announce("replacement")}return e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}function y0(e,i,r){const{model:a}=e;if(!e.isSelectionEditable){a.announce("plonk");return}r!=null||(r={}),r.focus&&e.focus(),r.feedback&&window.MathfieldElement.playSound("keypress"),typeof r.mode=="string"&&(e.switchMode(r.mode),e.snapshot());let c=Au(i);const p=window.mathVirtualKeyboard;if(p!=null&&p.isShifted&&(c=typeof c=="string"?c.toUpperCase():c.map(w=>w.toUpperCase())),r.simulateKeystroke){let w=!0;for(const E of c)sp(e,new KeyboardEvent("keypress",{key:E}))&&(w=!1);if(w)return}const m=a.at(a.position),b=P(P({},m.computedStyle),e.defaultStyle);if(a.selectionIsCollapsed||(a.deleteAtoms(jr(a.selection)),e.snapshot("delete")),a.mode==="latex")a.deferNotifications({content:!0,selection:!0,data:i,type:"insertText"},()=>{J(e);for(const w of c)Gn.insert(a,w);e.snapshot("insert-latex"),ne(e)});else if(a.mode==="text"){for(const w of c)Gn.insert(a,w,{style:b});e.snapshot("insert-text")}else if(a.mode==="math")for(const w of c)sg(e,w,b,m);e.dirty=!0,e.scrollIntoView()}function rg(e){const i=e.model,r=[];let a=i.at(Math.min(i.position,i.anchor));for(;a.type!=="first";)r.push(a),a=a.leftSibling;return r}function sg(e,i,r,a){const c=e.model;let p={"^":"moveToSuperscript",_:"moveToSubscript"," ":"moveAfterParent"}[i];if(i===" "&&e.options.mathModeSpace&&(p=["insert",e.options.mathModeSpace]),p){e.executeCommand(p);return}if(/\d/.test(i)&&e.options.smartSuperscript&&a.parentBranch==="superscript"&&a.parent.type!=="mop"&&a.parent.type!=="operator"&&a.parent.type!=="extensible-symbol"&&a.hasNoSiblings){ag(c),Gn.insert(c,i,{style:r}),e.snapshot(),ep(c),e.snapshot();return}if(/[a-zA-Z0-9]/.test(i)&&e.adoptStyle!=="none"){const m=e.adoptStyle==="left"?a:a.parent?a.rightSibling:null;(m==null?void 0:m.type)==="mord"&&/[a-zA-Z0-9]/.test(m.value)&&(r=P({},r),m.style.variant&&(r.variant=m.style.variant),m.style.variantStyle&&(r.variantStyle=m.style.variantStyle))}Gn.insert(c,i,{style:r}),e.snapshot(`insert-${c.at(c.position).type}`)}function ag(e){e.selectionIsCollapsed||(e.deleteAtoms(jr(e.selection)),e.mathfield.snapshot("delete"))}function b0(e,i,r){if(!i||e.mode!=="math")return!1;const a=e.at(e.position),{parent:c}=a,p={"(":"(",")":")","{":"\\lbrace","}":"\\rbrace","[":"\\lbrack","]":"\\rbrack","|":"|"}[i];if(!p)return!1;const m=po[p],b=zu[p];if(!e.selectionIsCollapsed){e.mathfield.snapshot();const[w,E]=jr(e.selection),I=e.extractAtoms([w,E]),N=c.addChildrenAfter([new rr("left...right",I,{leftDelim:p,rightDelim:b})],e.at(w));return e.setSelection(e.offsetOf(N.firstChild),e.offsetOf(N.lastChild)),e.mathfield.snapshot("insert-fence"),e.contentDidChange({data:p,inputType:"insertText"}),!0}if(p==="|"){const w=c instanceof rr?c.leftDelim+c.rightDelim:"";if(w==="\\lbrace\\rbrace"||w==="\\{\\}"||w==="\\lbrace?")return e.mathfield.snapshot(),Gn.insert(e,"\\,\\middle\\vert\\,",{format:"latex",style:r}),e.mathfield.snapshot("insert-fence"),e.contentDidChange({data:p,inputType:"insertText"}),!0}if(b){if(c instanceof rr&&c.firstChild===a&&(c.leftDelim==="?"||c.leftDelim==="."))return c.leftDelim=p,c.isDirty=!0,e.mathfield.snapshot(),e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;if(!(c instanceof rr)){let N=a;for(;N&&!(N.type==="mclose"&&N.value===b);)N=N.rightSibling;if(N){e.mathfield.snapshot();const Z=e.extractAtoms([e.offsetOf(a),e.offsetOf(N)]);return Z.pop(),c.addChildrenAfter([new rr("left...right",Z,{leftDelim:p,rightDelim:b})],a),e.position=e.offsetOf(c.firstChild)+1,e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}}const w=e.offsetOf(a.lastSibling);let E;for(E=e.position;E<=w;E++){const N=e.at(E);if(N instanceof rr&&(N.leftDelim==="?"||N.leftDelim===".")&&ap(p,N.rightDelim))break}const I=e.at(E);if(E<=w&&I instanceof rr){I.leftDelim=p,e.mathfield.snapshot();let N=e.extractAtoms([e.position,E-1]);return N=N.filter(Z=>Z.type!=="first"),I.addChildren(N,I.parentBranch),e.position+=1,e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}if(c instanceof rr&&(c.leftDelim==="?"||c.leftDelim===".")&&ap(p,c.rightDelim)){c.isDirty=!0,c.leftDelim=p,e.mathfield.snapshot();const N=e.extractAtoms([e.offsetOf(a.firstSibling),e.position]);for(const Z of N)c.parent.addChildBefore(Z,c);return e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}if(!(c instanceof rr&&c.leftDelim==="|")){if(e.mathfield.snapshot(),Gn.insert(e,`\\left${p}\\right?`,{format:"latex",style:r}),a.lastSibling.type!=="first"){const N=e.offsetOf(a.lastSibling),Z=e.extractAtoms([e.position,N]);e.at(e.position).body=Z,e.position-=1}return e.mathfield.snapshot("insert-fence"),!0}}if(m){let w=a;for(;w;){if(w.type==="mopen"&&w.value===m){e.mathfield.snapshot();const ue=w.leftSibling,me=e.extractAtoms([e.offsetOf(w.leftSibling),e.offsetOf(a)]);me.shift();const Ge=new rr("left...right",me,{leftDelim:m,rightDelim:p});return c.addChildrenAfter([Ge],ue),e.position=e.offsetOf(Ge),e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}w=w.leftSibling}if(c instanceof rr&&a.isLastSibling&&x0(c.leftDelim,p))return e.mathfield.snapshot(),c.isDirty=!0,c.rightDelim=p,e.position+=1,e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;const E=e.offsetOf(a.firstSibling);let I;for(I=e.position;I>=E;I--){const ue=e.at(I);if(ue instanceof rr&&(ue.rightDelim==="?"||ue.rightDelim===".")&&x0(ue.leftDelim,p))break}const N=e.at(I);if(I>=E&&N instanceof rr)return e.mathfield.snapshot(),N.rightDelim=p,N.addChildren(e.extractAtoms([I,e.position]),N.parentBranch),e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;if(c instanceof rr&&(c.rightDelim==="?"||c.rightDelim===".")&&x0(c.leftDelim,p))return e.mathfield.snapshot(),c.isDirty=!0,c.rightDelim=p,c.parent.addChildren(e.extractAtoms([e.position,e.offsetOf(a.lastSibling)]),c.parentBranch),e.position=e.offsetOf(c),e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;const Z=c.parent;return Z instanceof rr&&(Z.rightDelim==="?"||Z.rightDelim===".")&&e.at(e.position).isLastSibling?(e.position=e.offsetOf(Z),b0(e,p,r)):!1}return!1}function x0(e,i){return e?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e)?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i):zu[e]===i:!0}function ap(e,i){return i?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i)?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e):po[i]===e:!0}es({undo:e=>(e.undo(),!0),redo:e=>(e.redo(),!0),scrollIntoView:e=>(e.scrollIntoView(),!0),scrollToStart:e=>(e.field.scroll(0,0),!0),scrollToEnd:e=>{const i=e.field.getBoundingClientRect();return e.field.scroll(i.left-window.scrollX,0),!0},toggleKeystrokeCaption:ig,toggleContextMenu:e=>{const i=e.toggleContextMenu();return i||e.model.announce("plonk"),i},plonk:e=>(e.model.announce("plonk"),!0),switchMode:(e,i,r,a)=>(e.switchMode(i,r,a),!0),insert:(e,i,r)=>e.insert(i,r),typedText:(e,i,r)=>(y0(e,i,r),!0),insertDecimalSeparator:e=>{const i=e.model;return i.mode==="math"&&window.MathfieldElement.decimalSeparator===","&&i.at(Math.max(i.position,i.anchor)).isDigit()?(e.insert("{,}",{format:"latex"}),e.snapshot("insert-mord"),!0):(e.insert("."),!0)},commit:e=>{var i;return e.model.contentWillChange({inputType:"insertLineBreak"})&&((i=e.host)==null||i.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),e.model.contentDidChange({inputType:"insertLineBreak"})),!0},insertPrompt:(e,i,r)=>{const a=e.getPrompts();let c="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36),p=0;for(;a.includes(c)&&p<100;){if(p===99)return console.error("could not find a unique ID after 100 tries"),!1;c="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36),p++}return e.insert(`\\placeholder[${i!=null?i:c}]{}`,r),!0}}),es({copyToClipboard:e=>(e.focus(),e.model.selectionIsCollapsed&&e.select(),"queryCommandSupported"in document&&document.queryCommandSupported("copy")?document.execCommand("copy"):e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("copy",{bubbles:!0,composed:!0})),!1)},{target:"mathfield"}),es({cutToClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("cut")?document.execCommand("cut"):e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("cut",{bubbles:!0,composed:!0})),!0),pasteFromClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("paste")?(document.execCommand("paste"),!0):(navigator.clipboard.readText().then(i=>{i&&e.model.contentWillChange({inputType:"insertFromPaste",data:i})?(e.stopCoalescingUndo(),e.stopRecording(),e.insert(i,{mode:e.model.mode})&&(ne(e),e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),_i(e))):e.model.announce("plonk"),e.startRecording()}),!0))},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0});function og(e,i){e.flushInlineShortcutBuffer(),e.stopCoalescingUndo();const r=w0(e,i),{model:a}=e;return a.selectionIsCollapsed?(e.defaultStyle.fontSeries&&r.fontSeries===e.defaultStyle.fontSeries&&(r.fontSeries="auto"),r.fontShape&&r.fontShape===e.defaultStyle.fontShape&&(r.fontShape="auto"),r.color&&r.color===e.defaultStyle.color&&(r.color="none"),r.backgroundColor&&r.backgroundColor===e.defaultStyle.backgroundColor&&(r.backgroundColor="none"),r.fontSize&&r.fontSize===e.defaultStyle.fontSize&&(r.fontSize="auto"),e.defaultStyle=P(P({},e.defaultStyle),r)):e.model.deferNotifications({content:!0,type:"insertText"},()=>{a.selection.ranges.forEach(c=>p0(a,c,r,{operation:"toggle"})),e.snapshot("style-change")}),!0}es({applyStyle:og},{target:"mathfield",canUndo:!0,changeContent:!0});function w0(e,i){var r,a,c,p,m,b,w,E,I,N;const Z={};if(typeof i.color=="string"){const me=(a=e.colorMap((r=i.color)!=null?r:i.verbatimColor))!=null?a:"none";me!==i.color&&(Z.verbatimColor=(c=i.verbatimColor)!=null?c:i.color),Z.color=me}if(typeof i.backgroundColor=="string"){const me=(m=e.backgroundColorMap((p=i.backgroundColor)!=null?p:i.verbatimBackgroundColor))!=null?m:"none";me!==i.backgroundColor&&(Z.verbatimBackgroundColor=(b=i.verbatimBackgroundColor)!=null?b:i.backgroundColor),Z.backgroundColor=me}typeof i.fontFamily=="string"&&(Z.fontFamily=i.fontFamily),typeof i.series=="string"&&(Z.fontSeries=i.series),typeof i.fontSeries=="string"&&(Z.fontSeries=i.fontSeries.toLowerCase()),Z.fontSeries&&(Z.fontSeries=(w={bold:"b",medium:"m",normal:"m"}[Z.fontSeries])!=null?w:Z.fontSeries),typeof i.shape=="string"&&(Z.fontShape=i.shape),typeof i.fontShape=="string"&&(Z.fontShape=i.fontShape.toLowerCase()),Z.fontShape&&(Z.fontShape=(E={italic:"it",up:"n",upright:"n",normal:"n"}[Z.fontShape])!=null?E:Z.fontShape),i.variant&&(Z.variant=i.variant.toLowerCase()),i.variantStyle&&(Z.variantStyle=i.variantStyle.toLowerCase());const ue=(I=i.size)!=null?I:i.fontSize;return typeof ue=="number"?Z.fontSize=Math.max(1,Math.min(10,ue)):typeof ue=="string"&&(Z.fontSize=(N={size1:1,size2:2,size3:3,size4:4,size5:5,size6:6,size7:7,size8:8,size9:9,size10:10}[ue.toLowerCase()])!=null?N:{tiny:1,scriptsize:2,footnotesize:3,small:4,normal:5,normalsize:5,large:6,Large:7,LARGE:8,huge:9,Huge:10}[ue]),Z}function S0(e){let[i,r]=jr(e.selection);if(i=op(e,i,"backward"),r=op(e,r,"forward"),i===r){const a=e.at(i);if(a.type==="leftright")return e.setSelection(e.offsetOf(a.firstChild)-1,r);if(a.type==="first"&&(a.parent.type==="leftright"||a.parent.type==="surd"))return e.setSelection(i-1,e.offsetOf(a.parent.lastChild)+1);e.setSelection(i-1,r)}else e.setSelection(i,r);return!0}function op(e,i,r){var a,c,p;let m=e.at(i);if(!m)return i;const b=r==="forward"?1:-1;if(m.mode==="text"){for(;m&&!(m.mode!=="text"||!it.test(m.value));)i+=b,m=e.at(i);return r==="backward"?i-1:i}if(m.mode==="latex"){if(/[a-zA-Z\*]/.test(m.value))if(r==="backward")for(;m&&m.mode==="latex"&&m.value!=="\\"&&/[a-zA-Z]/.test(m.value);)i+=b,m=e.at(i);else for(;m&&m.mode==="latex"&&/[a-zA-Z\*]/.test(m.value);)i+=b,m=e.at(i);else if(m.value==="{"){if(r==="forward"){for(;m&&m.mode==="latex"&&m.value!=="}";)i+=b,m=e.at(i);return i}return i-1}else if(m.value==="}"){if(r==="backward"){for(;m&&m.mode==="latex"&&m.value!=="{";)i+=b,m=e.at(i);return i-1}return i}return i-1}if(m.mode==="math"){if(m.isDigit()){for(;(a=e.at(i+b))!=null&&a.isDigit();)i+=b;return r==="backward"?i-1:i}if(m.style.variant||m.style.variantStyle){let w=(c=e.at(i))==null?void 0:c.style;for(;w&&w.variant===m.style.variant&&w.variantStyle===m.style.variantStyle;)w=(p=e.at(i+b))==null?void 0:p.style,i+=b;return r==="backward"?i-1:i}return i}return i}es({selectGroup:e=>{const i=S0(e);return i||e.announce("plonk"),i},selectAll:e=>e.setSelection(0,e.lastOffset),extendSelectionForward:e=>Ka(e,"forward",{extend:!0}),extendSelectionBackward:e=>Ka(e,"backward",{extend:!0}),extendToNextWord:e=>rc(e,"forward",{extend:!0}),extendToPreviousWord:e=>rc(e,"backward",{extend:!0}),extendSelectionUpward:e=>Ka(e,"upward",{extend:!0}),extendSelectionDownward:e=>Ka(e,"downward",{extend:!0}),extendToNextBoundary:e=>rc(e,"forward",{extend:!0}),extendToPreviousBoundary:e=>rc(e,"backward",{extend:!0}),extendToGroupStart:e=>{const i=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).firstSibling));return i||e.announce("plonk"),i},extendToGroupEnd:e=>{const i=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).lastSibling));return i||e.announce("plonk"),i},extendToMathFieldStart:e=>{const i=e.setSelection(e.anchor,0);return i||e.announce("plonk"),i},extendToMathFieldEnd:e=>{const i=e.setSelection(e.anchor,e.lastOffset);return i||e.announce("plonk"),i}},{target:"model",changeSelection:!0});var eu=null,_h=0,sd=class sa{static start(i,r,a,c){var p;sa.element=i,(p=sa.controller)==null||p.abort(),sa.controller=new AbortController;const m={signal:sa.controller.signal};"PointerEvent"in window?(i.addEventListener("pointermove",a,m),i.addEventListener("pointerup",c,m),i.addEventListener("pointercancel",c,m),E0(r)&&(sa.pointerId=r.pointerId,i.setPointerCapture(r.pointerId))):(window.addEventListener("mousemove",a,m),window.addEventListener("blur",c,m),window.addEventListener("mouseup",c,m))}static stop(){var i;(i=sa.controller)==null||i.abort(),sa.controller=void 0,typeof sa.pointerId=="number"&&(sa.element.releasePointerCapture(sa.pointerId),sa.pointerId=void 0)}};function E0(e){return e!==null&&globalThis.PointerEvent!==void 0&&e instanceof PointerEvent}function lp(e,i){var r;if(i.buttons>1)return;e.atomBoundsCache=new Map;const a=e;let c,p=!1,m=!1,b="none",w=!1,E=!1;const I=i.clientX,N=i.clientY,Z=Date.now(),ue=a.field,me=setInterval(()=>{w?ue.scroll({top:0,left:ue.scrollLeft-16}):E&&ue.scroll({top:0,left:ue.scrollLeft+16})},32);function Ge(){sd.stop(),p=!1,clearInterval(me),e.element.classList.remove("tracking"),i&&i.preventDefault()}function Lt(ct){if(!a.hasFocus()){Ge();return}const Rt=ct.clientX,yt=ct.clientY,Jt=E0(ct)&&ct.pointerType==="touch"?20:5;if(Date.now()<Z+500&&Math.abs(I-Rt)<Jt&&Math.abs(N-yt)<Jt){ct.preventDefault(),ct.stopPropagation();return}const hi=ue.getBoundingClientRect();E=Rt>hi.right,w=Rt<hi.left;let ri=c;E0(ct)&&(ct.isPrimary||(ri=vh(a,ct.clientX,ct.clientY,{bias:0})));const cn=vh(a,Rt,yt,{bias:Rt<=I?Rt===I?0:-1:1});ri>=0&&cn>=0&&(a.model.extendSelectionTo(ri,cn),_i(e)),m&&S0(a.model)}eu&&Math.abs(eu.x-I)<5&&Math.abs(eu.y-N)<5&&Date.now()<eu.time+500?(_h+=1,eu.time=Z):(eu={x:I,y:N,time:Z},_h=1);const Ue=ue.getBoundingClientRect();if(I>=Ue.left&&I<=Ue.right&&N>=Ue.top&&N<=Ue.bottom){if(e.flushInlineShortcutBuffer(),e.adoptStyle="left",c=vh(e,I,N,{bias:0}),c>=0){if(e.element.classList.add("tracking"),i.shiftKey){const ct=e.model.selectionIsCollapsed;e.model.extendSelectionTo(e.model.anchor,c),le(e.model)||ct?b="all":b="selection"}else e.model.at(c).type==="placeholder"?(e.model.setSelection(c-1,c),b="selection"):((r=e.model.at(c).rightSibling)==null?void 0:r.type)==="placeholder"?(e.model.setSelection(c,c+1),b="selection"):(e.model.position=c,le(e.model)?b="all":b="selection");e.defaultStyle={},i.detail===3||_h>2?(Ge(),(i.detail===3||_h===3)&&(e.model.selection={ranges:[[0,e.model.lastOffset]]},b="all")):p||(p=!0,sd.start(ue,i,Lt,Ge),(i.detail===2||_h===2)&&(m=!0,S0(e.model),b="all"))}e.hasFocus()||(b="none",e.focus({preventScroll:!0}))}else eu=null;e.stopCoalescingUndo(),b!=="none"&&(e.model.selectionIsCollapsed&&(b="all"),_i(e)),i.preventDefault()}function lg(e,i,r){if(e>=r.left&&e<=r.right&&i>=r.top&&i<=r.bottom)return 0;const a=e-(r.left+r.right)/2,c=i-(r.top+r.bottom)/2;return a*a+c*c}function up(e,i,r,a,c){if(!r.id)return[1/0,null];if(i.has(r.id))return i.get(r.id);const p=Ml(e,r);if(!p)return[1/0,null];let m=[1/0,null];if(r.hasChildren&&!r.captureSelection&&a>=p.left&&a<=p.right)for(const b of r.children){const w=up(e,i,b,a,c);w[0]<=m[0]&&(m=w)}return m[1]||(m=[lg(a,c,p),r]),i.set(r.id,m),m}function ug(e,i,r){const[,a]=up(e,new Map,e.model.root,i,r);return a}function vh(e,i,r,a){var c;const p=e.field.querySelector(".ML__latex").getBoundingClientRect();if(!p)return 0;if(i>p.right||r>p.bottom+8)return e.model.lastOffset;if(i<p.left||r<p.top-8)return 0;a=a!=null?a:{},a.bias=(c=a.bias)!=null?c:0;let m=ug(e,i,r);const b=[];let w=m;for(;w;)b.unshift(w),w=w.parent;for(const I of b)if(I.captureSelection){m=I;break}let E=e.model.offsetOf(m);if(E<0)return-1;if(m.leftSibling)if(a.bias===0&&m.type!=="placeholder"){const I=Ml(e,m);I&&i<(I.left+I.right)/2&&(E=e.model.offsetOf(m.leftSibling))}else a.bias<0&&(E=e.model.offsetOf(m.leftSibling));return E}var cg=class extends Gn{constructor(){super("math")}onPaste(e,i){if(!i||!e.model.contentWillChange({data:typeof i=="string"?i:null,dataTransfer:typeof i=="string"?null:i,inputType:"insertFromPaste"}))return!1;let r="",a="auto",c=typeof i!="string"?i.getData("application/json+mathlive"):"";if(c)try{const p=JSON.parse(c);if(p&&Array.isArray(p)){e.snapshot();const m=_a(p),{model:b}=e;b.selectionIsCollapsed||b.deleteAtoms(jr(b.selection));const w=b.at(b.position);if(w.parent instanceof kn){console.assert(w.parentBranch!==void 0);const E=[];let I=[];m[0].type==="first"&&m.shift(),m[m.length-1].type==="first"&&m.pop();for(const me of m)me.type==="first"&&I.length>0?(E.push(I),I=[me]):I.push(me);I.length>0&&E.push(I);let N=Number(w.parentBranch[0]),Z=Number(w.parentBranch[1]);const ue=w.parent.maxColumns;for(;w.parent.colCount-Z<E.length&&w.parent.colCount<ue;)w.parent.addColumn();w.parent.addChildrenAfter(E[0],w);for(let me=1;me<E.length;me++)Z++,Z>=ue&&(Z=0,w.parent.addRowAfter(N),N++),w.parent.setCell(N,Z,E[me])}else w.parent.addChildrenAfter(m.filter(E=>E.type!=="first"),w);return b.position=b.offsetOf(m[m.length-1]),b.contentDidChange({inputType:"insertFromPaste"}),_i(e),!0}}catch(p){}if(c=typeof i!="string"?i.getData("application/json"):"",c&&window.MathfieldElement.computeEngine)try{const p=JSON.parse(c);if(typeof p=="object"&&"latex"in p&&p.latex&&(r=p.latex),!r){const m=window.MathfieldElement.computeEngine.box(p);m&&!m.has("Error")&&(r=m.latex)}r||(a="latex")}catch(p){}if(!r&&typeof i!="string"&&(r=i.getData("application/x-latex"),r&&(a="latex")),r||(r=typeof i=="string"?i:i.getData("text/plain")),r){let p;return[p,r]=Yc(r),a==="auto"&&p&&(a="latex"),e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r,{format:a})&&(e.startRecording(),e.snapshot("paste"),_i(e)),e.startRecording(),!0}return!1}insert(e,i,r){var a,c;const p=typeof i=="string"?i:(c=(a=window.MathfieldElement.computeEngine)==null?void 0:a.box(i).latex)!=null?c:"";if(!r.silenceNotifications&&!e.contentWillChange({data:p,inputType:"insertText"}))return!1;r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder"),r.format||(r.format="auto");const{silenceNotifications:m}=e;r.silenceNotifications&&(e.silenceNotifications=!0);const b=e.silenceNotifications;e.silenceNotifications=!0;const w={"?":"\\placeholder{}","@":"\\placeholder{}"};w[0]=r.insertionMode==="replaceAll"?"":e.getValue(e.selection,"latex-unstyled"),r.insertionMode==="replaceSelection"&&!e.selectionIsCollapsed?e.deleteAtoms(jr(e.selection)):r.insertionMode==="replaceAll"?(e.root.setChildren([],"body"),e.position=0):r.insertionMode==="insertBefore"?e.collapseSelection("backward"):r.insertionMode==="insertAfter"&&e.collapseSelection("forward"),!e.at(e.position).isLastSibling&&e.at(e.position+1).type==="placeholder"?e.deleteAtoms([e.position,e.position+1]):e.at(e.position).type==="placeholder"&&e.deleteAtoms([e.position-1,e.position]);let E=-1;w[0]?w["@"]=w[0]:typeof i=="string"&&/(^|[^\\])#@/.test(i)&&(E=fg(e),E>=0&&(w["@"]=e.getValue(E,e.position,"latex"))),w[0]||(w[0]=w["?"]);let I=!1;const N=Rt=>(I=!0,w[Rt]);let[Z,ue]=cp(e,i,N,r);if(!ue)return!1;const me=ue.length===1&&ue[0].type==="genfrac";me&&E>=0&&typeof e.mathfield.options.isImplicitFunction=="function"&&e.mathfield.options.isImplicitFunction(e.at(e.position).command)?(w["@"]=w["?"],I=!1,[Z,ue]=cp(e,i,N,r)):E>=0&&e.deleteAtoms([E,e.position]);const{parent:Ge}=e.at(e.position),Lt=Ge.hasEmptyBranch("body");if(me&&Z!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&Ge instanceof rr&&Ge.leftDelim==="("&&Lt){const Rt=Ge.parent,yt=Ge.parentBranch;Rt.removeChild(Ge),Rt.setChildren(ue,yt)}const Ue=e.at(e.position);Ue.parent.addChildrenAfter(ue,Ue),Z==="latex"&&typeof i=="string"&&(Ge==null?void 0:Ge.type)==="root"&&Lt&&!I&&(Ge.verbatimLatex=i),e.silenceNotifications=b;const ct=ue[ue.length-1];if(r.selectionMode==="placeholder"){const Rt=ue.flatMap(yt=>[yt,...yt.children]).find(yt=>yt.type==="placeholder");if(Rt){const yt=e.offsetOf(Rt);e.setSelection(yt-1,yt),e.announce("move")}else ct&&(e.position=e.offsetOf(ct))}else r.selectionMode==="before"||(r.selectionMode==="after"?ct&&(e.position=e.offsetOf(ct)):r.selectionMode==="item"&&e.setSelection(e.anchor,e.offsetOf(ct)));return e.contentDidChange({data:p,inputType:"insertText"}),e.silenceNotifications=m,!0}};function cp(e,i,r,a){var c;let p,m=[];if(typeof i!="string"||a.format==="math-json"){const b=window.MathfieldElement.computeEngine;if(!b)return["math-json",[]];[p,i]=["latex",b.box(i).latex],m=Br(i,{context:e.mathfield.context})}else typeof i=="string"&&a.format==="ascii-math"?([p,i]=Bu(i,{format:"ascii-math",inlineShortcuts:e.mathfield.options.inlineShortcuts}),m=Br(i,{context:e.mathfield.context}),p!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&ad(m)):(a.format==="auto"||(c=a.format)!=null&&c.startsWith("latex"))&&(a.format==="auto"&&([p,i]=Bu(i,{format:"auto",inlineShortcuts:e.mathfield.options.inlineShortcuts})),a.format==="latex"&&([,i]=Yc(i)),m=Br(i,{context:e.mathfield.context,args:r}),a.format!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&ad(m));return ol(m,a.style),[p!=null?p:"latex",m]}function hg(e){if(!e||(console.assert(e[0].type==="first"),e.length>1))return null;const i=e[0];return i instanceof rr&&i.leftDelim==="("&&i.rightDelim===")"?i.removeBranch("body"):null}function ad(e){if(e){for(let i=0;e[i];i++){const r=e[i];if(r instanceof rr&&r.leftDelim==="("){let a=0,c=0,p=0;for(let m=0;r.body[m];m++)r.body[m].type==="genfrac"&&(a++,c=m),p++;p===0&&a===1&&(e[i]=r.body[c])}}for(const i of e){for(const r of i.branches)if(!i.hasEmptyBranch(r)){ad(i.branch(r));const a=hg(i.branch(r));a&&i.setChildren(a,r)}if(i instanceof kn)for(const r of i.cells)ad(r)}}}function fg(e){let i=e.at(e.position);if(i.mode==="text"){for(;!i.isFirstSibling&&i.mode==="text";)i=i.leftSibling;return e.offsetOf(i)}const r=i;let a=!1;if(i.type==="mclose"){const c=po[i.value];for(;!i.isFirstSibling&&!(i.type==="mopen"&&i.value===c);)i=i.leftSibling;i.isFirstSibling||(i=i.leftSibling),a=!0}else i.type==="leftright"&&(i=i.leftSibling,a=!0);if(a)for(;!i.isFirstSibling&&(i.isFunction||hp(i));)i=i.leftSibling;else{const c=[];for(;!i.isFirstSibling&&(hp(i)||c.length>0);)i.type==="mclose"&&c.unshift(i.value),i.type==="mopen"&&c.length>0&&i.value===po[c[0]]&&c.shift(),i=i.leftSibling}return r===i?-1:e.offsetOf(i)}function hp(e){return e.isDigit()?!0:e.type&&/^(mord|surd|subsup|leftright|mop|mclose)$/.test(e.type)?!e.isExtensibleSymbol:!1}new cg;var dg=class extends Gn{constructor(){super("text")}onPaste(e,i){if(!i)return!1;const r=typeof i=="string"?i:i.getData("text/plain");return r&&e.model.contentWillChange({inputType:"insertFromPaste",data:r})?(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r)&&(e.model.contentDidChange({inputType:"insertFromPaste"}),e.startRecording(),e.snapshot("paste"),_i(e)),e.startRecording(),!0):!1}insert(e,i,r={}){if(!e.contentWillChange({data:i,inputType:"insertText"}))return!1;r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder"),r.format||(r.format="auto");const{silenceNotifications:a}=e;r.silenceNotifications&&(e.silenceNotifications=!0);const c=e.silenceNotifications;e.silenceNotifications=!0,r.insertionMode==="replaceSelection"&&!e.selectionIsCollapsed?e.deleteAtoms(jr(e.selection)):r.insertionMode==="replaceAll"?(e.root.setChildren([],"body"),e.position=0):r.insertionMode==="insertBefore"?e.collapseSelection("backward"):r.insertionMode==="insertAfter"&&e.collapseSelection("forward");const p=pg(i,e.mathfield.context);if(ol(p,r.style),!p)return!1;const m=e.at(e.position),b=m.parent.addChildrenAfter(p,m);return e.silenceNotifications=c,r.selectionMode==="before"||(r.selectionMode==="item"?e.setSelection(e.anchor,e.offsetOf(b)):b&&(e.position=e.offsetOf(b))),e.contentDidChange({data:i,inputType:"insertText"}),e.silenceNotifications=a,!0}};function pg(e,i){return e=e.replace(/\\/g,"\\textbackslash "),e=e.replace(/#/g,"\\#"),e=e.replace(/\$/g,"\\$"),e=e.replace(/%/g,"\\%"),e=e.replace(/&/g,"\\&"),e=e.replace(/_/g,"\\_"),e=e.replace(/{/g,"\\textbraceleft "),e=e.replace(/}/g,"\\textbraceright "),e=e.replace(/lbrace/g,"\\textbraceleft "),e=e.replace(/rbrace/g,"\\textbraceright "),e=e.replace(/\^/g,"\\textasciicircum "),e=e.replace(/~/g,"\\textasciitilde "),e=e.replace(/£/g,"\\textsterling "),Br(e,{context:i,parseMode:"text"})}new dg;function Ua(e){return{value:e.model.getValue(),selectionIsCollapsed:e.model.selectionIsCollapsed,canUndo:e.canUndo(),canRedo:e.canRedo(),style:e.selectionStyle,mode:e.model.mode}}var Yn=4,ks=20,Ar=2*(ks+Yn),od=(e,i)=>`
|
|
|
<line x1="${e+ks}" y1="${i+ks}"
|
|
|
x2="${e>i?e+ks:7*ks+10*Yn}"
|
|
|
y2="${e<i?i+ks:7*ks+10*Yn}"/>
|
|
|
<svg id="plus" viewBox="0 0 40 40" x="${e}" y="${i}" width="40" height="40">
|
|
|
<circle class="cls-2" cx="20" cy="20" r="20"/>
|
|
|
<path class="font" d="m33.33,20c0,1.84-1.49,3.34-3.33,3.34h-6.67v6.66c0,1.84-1.49,3.34-3.33,3.34s-3.34-1.5-3.34-3.34v-6.66h-6.66c-1.84,0-3.34-1.5-3.34-3.34s1.5-3.33,3.34-3.33h6.66v-6.67c0-1.84,1.5-3.33,3.34-3.33s3.33,1.49,3.33,3.33v6.67h6.67c1.84,0,3.33,1.49,3.33,3.33Z"/>
|
|
|
</svg>`,fp=(e,i)=>`
|
|
|
<line x1="${e+ks}" y1="${i+ks}"
|
|
|
x2="${e>i?e+ks:7*ks+10*Yn}"
|
|
|
y2="${e<i?i+ks:7*ks+10*Yn}"/>
|
|
|
<svg id="minus" viewBox="0 0 40 40" x="${e}" y="${i}" width="40" height="40">
|
|
|
<circle class="cls-2" cx="20" cy="20" r="20"/>
|
|
|
<path class="font" d="m33.33,20c0,1.84-1.49,3.33-3.33,3.33H10c-1.84,0-3.34-1.49-3.34-3.33s1.5-3.34,3.34-3.34h20c1.84,0,3.33,1.5,3.33,3.34Z"/>
|
|
|
</svg>`,ld=(e,i,r)=>`
|
|
|
<svg id="arrow" viewBox="0 0 40 40" x="${e}" y="${i}" width="40" height="40">
|
|
|
<circle class="cls-2" cx="20" cy="20" r="20"/>
|
|
|
<g transform="rotate(${r})" transform-origin="20 20">
|
|
|
<path class="font" d="m17.7,7.23h4.6c.52,0,.94.42.94.94v13.82c0,.52.42.94.94.94h3.39c.83,0,1.25,1.01.66,1.6l-7.56,7.56c-.37.37-.96.37-1.32,0l-7.56-7.56c-.59-.59-.17-1.6.66-1.6h3.39c.52,0,.94-.42.94-.94v-13.82c0-.52.42-.94.94-.94Z"/>
|
|
|
</g>
|
|
|
</svg>`,mg=`
|
|
|
<svg class="MLEP__array-buttons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
viewBox=
|
|
|
"-2 -2 ${8*ks+10*Yn+5} ${8*ks+10*Yn+5}">
|
|
|
<rect
|
|
|
class="MLEP__array-insert-background rows"
|
|
|
x="0"
|
|
|
y="${Ar+Yn}"
|
|
|
height="${3*Ar}"
|
|
|
width="${Ar}"
|
|
|
rx="${Ar/2}"/>
|
|
|
<rect
|
|
|
class="MLEP__array-insert-background columns"
|
|
|
x="${Ar+Yn}"
|
|
|
y="0"
|
|
|
height="${Ar}"
|
|
|
width="${3*Ar}"
|
|
|
rx="${Ar/2}"/>
|
|
|
<g data-command='"moveDown"'>
|
|
|
${ld(2*(Yn+Ar),2*Yn+3*Ar,0)}
|
|
|
</g>
|
|
|
<g data-command='"moveUp"'>
|
|
|
${ld(2*(Yn+Ar),2*Yn+Ar,180)}
|
|
|
</g>
|
|
|
<g data-command='"moveToNextWord"'>
|
|
|
${ld(2*Yn+3*Ar,2*(Yn+Ar),-90)}
|
|
|
</g>
|
|
|
<g data-command='"moveToPreviousWord"'>
|
|
|
${ld(2*Yn+Ar,2*(Yn+Ar),90)}
|
|
|
</g>
|
|
|
<g>
|
|
|
|
|
|
<g data-command='"addColumnBefore"'>
|
|
|
${od(2*Yn+Ar,Yn)}
|
|
|
</g>
|
|
|
<g data-command='"removeColumn"'>
|
|
|
${fp(2*Yn+2*Ar,Yn)}
|
|
|
</g>
|
|
|
<g data-command='"addColumnAfter"'>
|
|
|
${od(2*Yn+3*Ar,Yn)}
|
|
|
</g>
|
|
|
<g data-command='"addRowBefore"'>
|
|
|
${od(Yn,2*Yn+Ar)}
|
|
|
</g>
|
|
|
<g data-command='"removeRow"'>
|
|
|
${fp(Yn,2*Yn+2*Ar)}
|
|
|
</g>
|
|
|
<g data-command='"addRowAfter"'>
|
|
|
${od(Yn,2*Yn+3*Ar)}
|
|
|
</g>
|
|
|
</svg>`,gg=e=>`
|
|
|
<svg id="matrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
|
|
|
data-command='["setEnvironment","matrix"]'>
|
|
|
<rect class="cls-1" width="28" height="24"/>
|
|
|
<circle cx="10" cy="8" r="1"/>
|
|
|
<circle cx="14" cy="12" r="1"/>
|
|
|
<circle cx="18" cy="16" r="1"/></svg>`,_g=e=>`
|
|
|
<svg id="pmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
|
|
|
data-command='["setEnvironment","pmatrix"]'>
|
|
|
<rect class="cls-1" width="28" height="24"/>
|
|
|
<path class="cls-2" d="m6,4c-3.96,4.6-3.96,11.4,0,16"/>
|
|
|
<path class="cls-2" d="m22,4c3.96,4.6,3.96,11.4,0,16"/>
|
|
|
<circle cx="10" cy="8" r="1"/>
|
|
|
<circle cx="14" cy="12" r="1"/>
|
|
|
<circle cx="18" cy="16" r="1"/></svg>`,dp=e=>`
|
|
|
<svg id="Bmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
|
|
|
data-command='["setEnvironment","Bmatrix"]'>
|
|
|
<rect class="cls-1" width="28" height="24"/>
|
|
|
<path class="cls-2" d="m6,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>
|
|
|
<path class="cls-2" d="m22,4c1.1,0,2,.9,2,2v3c0,1.66.9,3,2,3-1.1,0-2,1.34-2,3v3c0,1.1-.9,2-2,2"/>
|
|
|
<circle cx="10" cy="8" r="1"/>
|
|
|
<circle cx="14" cy="12" r="1"/>
|
|
|
<circle cx="18" cy="16" r="1"/>
|
|
|
</svg>`,vg=e=>`
|
|
|
<svg id="bmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
|
|
|
data-command='["setEnvironment","bmatrix"]'>
|
|
|
<rect class="cls-1" width="28" height="24"/>
|
|
|
<path class="cls-2" d="m6,4h-3v16h3"/>
|
|
|
<path class="cls-2" d="m22,4h3v16h-3"/>
|
|
|
<circle cx="10" cy="8" r="1"/>
|
|
|
<circle cx="14" cy="12" r="1"/>
|
|
|
<circle cx="18" cy="16" r="1"/>
|
|
|
</svg>`,yg=e=>`
|
|
|
<svg id="vmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
|
|
|
data-command='["setEnvironment","vmatrix"]'>
|
|
|
<rect class="cls-1" width="28" height="24"/>
|
|
|
<circle cx="10" cy="8" r="1"/>
|
|
|
<circle cx="14" cy="12" r="1"/>
|
|
|
<circle cx="18" cy="16" r="1"/>
|
|
|
<line class="cls-2" x1="4" y1="4" x2="4" y2="20"/>
|
|
|
<line class="cls-2" x1="24" y1="4" x2="24" y2="20"/>
|
|
|
</svg>`,bg=e=>`
|
|
|
<svg id="Vmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="-3.5 -3 35 30"
|
|
|
data-command='["setEnvironment","Vmatrix"]'>
|
|
|
<rect class="cls-1" width="28" height="24"/>
|
|
|
<circle cx="10" cy="8" r="1"/>
|
|
|
<circle cx="14" cy="12" r="1"/>
|
|
|
<circle cx="18" cy="16" r="1"/>
|
|
|
<line class="cls-2" x1="6" y1="4" x2="6" y2="20"/>
|
|
|
<line class="cls-2" x1="22" y1="4" x2="22" y2="20"/>
|
|
|
<line class="cls-2" x1="2" y1="4" x2="2" y2="20"/>
|
|
|
<line class="cls-2" x1="26" y1="4" x2="26" y2="20"/>
|
|
|
</svg>`,xg=e=>`
|
|
|
<svg id="cases" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
|
|
|
data-command='["setEnvironment","cases"]'>
|
|
|
<rect class="cls-1" width="28" height="24"/>
|
|
|
<path class="cls-2" d="m10,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>
|
|
|
<circle cx="13" cy="8" r="1"/>
|
|
|
<circle cx="13" cy="16" r="1"/>
|
|
|
<circle cx="21" cy="8" r="1"/>
|
|
|
<circle cx="21" cy="16" r="1"/>
|
|
|
</svg>`,wg=e=>`
|
|
|
<svg id="rcases" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
|
|
|
data-command='["setEnvironment","rcases"]'>
|
|
|
<rect class="cls-1" width="28" height="24"/>
|
|
|
<path class="cls-2" d="m18,20c1.1,0,2-.9,2-2v-3c0-1.66.9-3,2-3-1.1,0-2-1.34-2-3v-3c0-1.1-.9-2-2-2"/>
|
|
|
<circle cx="15" cy="8" r="1"/>
|
|
|
<circle cx="15" cy="16" r="1"/>
|
|
|
<circle cx="7" cy="8" r="1"/>
|
|
|
<circle cx="7" cy="16" r="1"/>
|
|
|
</svg>`,k0={matrix:gg,pmatrix:_g,bmatrix:vg,Bmatrix:dp,vmatrix:yg,Vmatrix:bg},T0={cases:xg,rcases:wg,Bmatrix:dp};function Sg(e){var i,r;const a=(i=e.model.parentEnvironment)==null?void 0:i.array;if(!a)return;let c=0;a.forEach(me=>{(!c||me.length>c)&&(c=me.length)});let p=document.getElementById("mathlive-environment-popover");p||(p=Ie("mathlive-environment-popover"),ds("environment-popover"),ds("core"),p.setAttribute("aria-hidden","true"));let m;const b=p.querySelector(".MLEP__environment-controls");b?m=b:(m=document.createElement("div"),p.innerHTML="",p.appendChild(m)),m.className="MLEP__environment-controls",m.style.display="flex",m.style.width="100%",m.style.height="100%",m.style.boxSizing="border-box",m.innerHTML=mg;let w=[],E="";const I=e.model.parentEnvironment.environmentName;if(Ef(I)){const me=kg(I);E=k0[me]("active");const Ge=k0,{[me]:Lt}=Ge,Ue=R(Ge,[re(me)]);w=Object.values(Ue).map(ct=>ct("inactive"))}else if(kf(I)){const me=Tg(I);E=T0[me]("active");const Ge=T0,{[me]:Lt}=Ge,Ue=R(Ge,[re(me)]);w=Object.values(Ue).map(ct=>ct("inactive"))}else Us(I)&&(E=k0.matrix("active"),w=Object.values(T0).map(me=>me("inactive")));const N=document.createElement("div");N.className="MLEP__environment-delimiter-controls",N.style.display="flex",N.style.flexDirection="column",N.innerHTML=`
|
|
|
<div class='MLEP__array-delimiter-options'>
|
|
|
${E}
|
|
|
${w.join("")}
|
|
|
</div>`,E&&m.appendChild(N),m.querySelectorAll("[data-command]").forEach(me=>{const Ge=me.dataset.command;let Lt=Ge;try{Lt=JSON.parse(Ge)}catch(Ue){}me.addEventListener("mousedown",Ue=>Ue.preventDefault()),Lt&&me.addEventListener("click",()=>e.executeCommand(Lt))});const ue=(r=e.field)==null?void 0:r.getBoundingClientRect();ue&&(p.style.top=`${window.scrollY+(ue.top-p.clientHeight-15)}px`,p.style.left=`${ue.left+20}px`,p.classList.add("is-visible"))}function A0(){const e=document.getElementById("mathlive-environment-popover");e==null||e.classList.remove("is-visible")}function Eg(){document.getElementById("mathlive-environment-popover")&&(tt("mathlive-environment-popover"),Qs("environment-popover"),Qs("core"))}function ud(e){if(!e.hasFocus())return;let i=!1;if(e.model.mode==="math"){const r=e.model.parentEnvironment;if(r!=null&&r.array&&Ud(r.environmentName)){const a=e.options.environmentPopoverPolicy;i=a==="auto"||a==="on"}}i?Sg(e):A0()}function kg(e){return e.replace("*","")}function Tg(e){return e==="dcases"?"cases":e}function pp(e){const i=getComputedStyle(e).direction;return i==="ltr"||i==="rtl"?i:"ltr"}function mp(e,i,r){return i==="left"||i==="leading"&&r==="ltr"||i==="trailing"&&r==="rtl"?e.left:e.right}function L0(e,i,r,a){return r==="middle"?e-i/2:r==="start"&&a==="rtl"||r==="end"&&a==="ltr"||r==="top"||r==="right"?Math.max(0,e-i):e}function Ag(e,i,r,a){return r==="middle"?e-i/2:r==="start"&&a==="ltr"||r==="end"&&a==="rtl"||r==="top"||r==="right"?e:e-i}function Lg(e,i){var r,a,c;const p=(r=pp(e))!=null?r:"ltr";e.style.position="fixed",e.style.left="",e.style.top="",e.style.right="",e.style.bottom="",e.style.height="",e.style.width="";const m=e.getBoundingClientRect(),b=Number.isFinite(i.maxHeight)?Math.min(i.maxHeight,window.innerHeight):window.innerHeight;let w=Math.min(b,(a=i.height)!=null?a:m.height),E=L0(i.location.y,w,i.verticalPos,p);E+w>window.innerHeight-8&&(i.alternateLocation?(E=L0(i.alternateLocation.y,w,i.verticalPos,p),E+w>window.innerHeight-8&&(E=void 0)):E=void 0),Number.isFinite(E)||(E=Math.max(8,window.innerHeight-8-w),8+w>window.innerHeight-8&&(e.style.bottom="8px")),w=Math.min(E+w,window.innerHeight-8)-E;const I=Number.isFinite(i.maxWidth)?Math.min(i.maxWidth,window.innerWidth):window.innerWidth;let N=Math.min(I,(c=i.width)!=null?c:m.width),Z=L0(i.location.x,N,i.horizontalPos,p);Z+N>window.innerWidth-8&&(i.alternateLocation?(Z=Ag(i.alternateLocation.x,N,i.verticalPos,p),Z+N>window.innerWidth-8&&(Z=void 0)):Z=void 0),Number.isFinite(Z)||(Z=Math.max(8,window.innerWidth-8-N),8+N>window.innerWidth-8&&(e.style.right="8px")),N=Math.min(Z+N,window.innerWidth-8)-Z,p==="rtl"?e.style.right=`${Math.ceil(window.innerWidth-Z-N).toString()}px`:e.style.left=`${Math.ceil(Z).toString()}px`,e.style.top=`${Math.ceil(E).toString()}px`,w!==m.height&&(e.style.height=`${Math.ceil(w).toString()}px`),N!==m.width&&(e.style.width=`${Math.ceil(N).toString()}px`)}function Dg(e,i){return Math.hypot(i.x-e.x,i.y-e.y)}function sc(e){return"submenu"in e}function za(e){return"type"in e&&e.type==="command"||"onMenuSelect"in e||"id"in e}function D0(e){return"type"in e&&e.type==="divider"}function C0(e){return"type"in e&&e.type==="heading"}var gp={};function M0(e){let i=gp[e];if(!i){let r;switch(e){case"checkmark":r=`<span aria-hidden="true" class="ui-checkmark"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"></path></svg>
|
|
|
</span>`;break;case"trailing-chevron":r='<span aria-hidden="true" class="ui-trailing-chevron"><svg focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg></span>';break;case"mixedmark":r='<span aria-hidden="true" class="ui-mixedmark"><svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 512 512"><path fill="currentColor" d="M0 256c0-13.3 10.7-24 24-24H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H24c-13.3 0-24-10.7-24-24z"/></svg></span>'}if(r){const a=document.createElement("template");a.innerHTML=r,gp[e]=a,i=a}}if(i){if("content"in i)return i.content.cloneNode(!0);const r=document.createElement("svg");return r.innerHTML=i.innerHTML,r}}var _p=80,vp=class{constructor(e,i){this._element=null;var r;this.parentMenu=i,this._declaration=e,sc(e)?(this.type="submenu",this.submenu=new yp(e.submenu,{parentMenu:i,submenuClass:e.submenuClass,columnCount:e.columnCount})):this.type=(r=e.type)!=null?r:"command",this.hasCheck=za(e)&&e.checked!==void 0}get rootMenu(){return this.parentMenu.rootMenu}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}dispose(){var e,i;(e=this._abortController)==null||e.abort(),this._abortController=void 0,(i=this._element)==null||i.remove(),this._element=null,this.submenu&&this.submenu.dispose(),this.submenu=void 0}get menuItem(){return this._declaration}get label(){var e;return(e=this._label)!=null?e:""}set label(e){e===void 0&&(e=""),e!==this._label&&(this._label=e,this.dirty=!0)}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.dirty=!0)}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.element&&(e?this.element.removeAttribute("aria-disabled"):this.element.setAttribute("aria-disabled","true")),this.dirty=!0}get checked(){return this._checked}set checked(e){this._checked=e,this.dirty=!0}get tooltip(){return this._tooltip}set tooltip(e){e!==this._tooltip&&(this._tooltip=e,this.dirty=!0)}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){e!==this._ariaLabel&&(this._ariaLabel=e,this.dirty=!0)}get active(){var e,i;return(i=(e=this.element)==null?void 0:e.classList.contains("active"))!=null?i:!1}set active(e){this.element&&this.element.classList.toggle("active",e)}updateState(e){var i,r,a;const c=this._declaration;if(D0(c)){this.enabled=!1,this.checked=!1;return}C0(c)&&(this.enabled=!1,this.checked=!1,this.visible=!0),za(c)&&(this.checked=za(c)&&((i=ac(c.checked,e))!=null?i:!1)),(za(c)||sc(c))&&(this.enabled=(r=ac(c.enabled,e))!=null?r:!0,this.visible=(a=ac(c.visible,e))!=null?a:!0,this.visible&&this.enabled&&this.submenu&&(this.submenu.updateState(e),this.submenu.visible||(this.visible=!1))),(za(c)||C0(c)||sc(c))&&(this.label=ac(c.label,e),this.tooltip=ac(c.tooltip,e),this.ariaLabel=ac(c.ariaLabel,e)),this._element&&this.updateElement()}set dirty(e){console.assert(e===!0),e&&this.parentMenu&&(this.parentMenu.dirty=!0)}updateElement(){if(!this.visible||!this.element)return;const e=this.element;e.textContent="",this.enabled?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true"),this.checked===!0?(e.setAttribute("aria-checked","true"),e.append(M0("checkmark"))):this.checked==="mixed"?(e.setAttribute("aria-checked","mixed"),e.append(M0("mixedmark"))):e.removeAttribute("aria-checked"),this.ariaLabel&&e.setAttribute("aria-label",this.ariaLabel);const i=document.createElement("span");if(i.className=this.parentMenu.hasCheck?"label indent":"label",this.type==="heading"&&i.classList.add("heading"),i.innerHTML=this.label,e.append(i),this._tooltip&&e.setAttribute("data-tooltip",this._tooltip),za(this._declaration)&&this._declaration.keyboardShortcut){const r=document.createElement("kbd");r.innerHTML=Vl(this._declaration.keyboardShortcut),e.append(r)}this.type==="submenu"&&e.append(M0("trailing-chevron"))}get element(){if(this._element)return this._element;if(D0(this._declaration)){const r=document.createElement("li");return r.setAttribute("part","menu-divider"),r.setAttribute("role","divider"),this._element=r,r}const e=document.createElement("li");this._element=e,(za(this._declaration)||C0(this._declaration)||sc(this._declaration))&&this._declaration.class&&(e.className=this._declaration.class),e.setAttribute("part","menu-item"),e.setAttribute("tabindex","-1"),this.hasCheck?e.setAttribute("role","menuitemcheckbox"):e.setAttribute("role","menuitem"),this.type==="submenu"&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"));const i=this.abortController.signal;return e.addEventListener("pointerenter",this,{signal:i}),e.addEventListener("pointerleave",this,{signal:i}),e.addEventListener("pointerup",this,{signal:i}),e.addEventListener("click",this,{signal:i}),this._element}dispatchSelect(){if(!za(this._declaration))return;const e=new CustomEvent("menu-select",{cancelable:!0,bubbles:!0,detail:{modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data}});this.parentMenu.dispatchEvent(e)&&typeof this._declaration.onMenuSelect=="function"&&this._declaration.onMenuSelect({modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data})}handleEvent(e){var i;if(!(!this.visible||!this.enabled)){if(e.type==="click"){this.rootMenu.state==="modal"&&this.select(),e.stopPropagation(),e.preventDefault();return}if(e.type==="pointerenter"){const r=e;this.rootMenu.cancelDelayedOperation(),this.parentMenu.isSubmenuOpen&&((i=this.parentMenu.activeMenuItem)!=null&&i.movingTowardSubmenu(r))?this.rootMenu.scheduleOperation(()=>{this.parentMenu.activeMenuItem=this,this.openSubmenu()}):(this.parentMenu.activeMenuItem=this,this.openSubmenu({withDelay:!0}));return}if(e.type==="pointerleave"){this.rootMenu.activeSubmenu===this.parentMenu&&(this.parentMenu.activeMenuItem=null);return}if(e.type==="pointerup"){this.rootMenu.state!=="modal"&&this.select(),e.stopPropagation(),e.preventDefault();return}}}select(){if(this.rootMenu.cancelDelayedOperation(),this.type==="submenu"){this.openSubmenu();return}this.active=!1,setTimeout(()=>{this.active=!0,setTimeout(()=>{this.rootMenu.hide(),this.dispatchSelect()},_p)},_p)}openSubmenu(e){var i;if(this.type!=="submenu"||!this.element)return;if((i=e==null?void 0:e.withDelay)!=null&&i){this.rootMenu.scheduleOperation(()=>this.openSubmenu());return}const r=this.element.getBoundingClientRect(),a=pp(this.element);this.submenu.show({container:this.rootMenu.element.parentNode,location:{x:mp(r,"trailing",a),y:r.top-4},alternateLocation:{x:mp(r,"leading",a),y:r.top-4}})}movingTowardSubmenu(e){if(!this.element||this.type!=="submenu")return!1;const i=this.rootMenu.lastMoveEvent;if(!i)return!1;const r=e.timeStamp-i.timeStamp;if(r>500)return!1;const a=e.clientX-i.clientX;if(Cg(a,i.clientY-e.clientY,r)<=.2)return!1;let p="right";if(this.submenu.element){const m=this.submenu.element.getBoundingClientRect(),b=this.element.getBoundingClientRect();m.left<b.left+b.width/2&&(p="left")}return p==="right"?a>0:a<0}};function Cg(e,i,r){return Math.hypot(e,i)/r}function ac(e,i){return e===void 0||typeof e!="function"?e:(i!=null||(i={alt:!1,control:!1,shift:!1,meta:!1}),e(i))}var yp=class pc{constructor(i,r){this._element=null,this._activeMenuItem=null,this._dirty=!0;var a,c;this.parentMenu=(a=r==null?void 0:r.parentMenu)!=null?a:null,this._submenuClass=r==null?void 0:r.submenuClass,this.columnCount=(c=r==null?void 0:r.columnCount)!=null?c:1,this.isSubmenuOpen=!1,this.menuItems=i}get children(){return this._menuItems}set menuItems(i){const r=this.parentMenu;this.dispose(),this.parentMenu=r,i=[...i],this._menuItems=i.map(a=>a.onCreate?a.onCreate(a,this):new vp(a,this)),this.hasCheck=void 0,this.dirty=!0}dispose(){var i;this.hide(),this._element&&this._element.remove(),this._abortController&&this._abortController.abort(),(i=this._menuItems)==null||i.forEach(r=>r.dispose()),this._menuItems=[],this._activeMenuItem=null,this.parentMenu=null}handleEvent(i){if(i.type==="wheel"&&this._element){const r=i;this._element.scrollBy(0,r.deltaY),i.stopPropagation()}}dispatchEvent(i){return this.rootMenu.dispatchEvent(i)}get rootMenu(){return this.parentMenu.rootMenu}updateState(i){var r,a,c;this._menuItems.forEach(E=>E.updateState(i));const p=this.hasCheck;this.hasCheck=this._menuItems.some(E=>E.visible&&E.hasCheck),this.hasCheck!==p&&this._menuItems.forEach(E=>E.updateState(i));let m,b=0;for(const E of this._menuItems)E.type==="heading"?(m&&b===0&&(m.visible=!1),m=E,b=0):E.type==="divider"&&m?(m.visible=b>0,m=void 0,b=0):m&&E.visible&&(b+=1);m&&(m.visible=b>0);let w=!0;for(const E of this._menuItems)E.type==="divider"?(E.visible=!w,w=!0):E.visible&&(w=!1);(r=this.activeMenuItem)!=null&&r.visible||(this.activeMenuItem=null),!((a=this.activeMenuItem)!=null&&a.enabled)&&((c=this.activeMenuItem)==null?void 0:c.type)==="submenu"&&this._activeMenuItem.submenu.hide(),this._dirty=!1}get enabled(){return this.updateIfDirty(),this._menuItems.some(i=>i.type!=="divider"&&i.visible&&i.enabled)}get visible(){return this.updateIfDirty(),this._menuItems.some(i=>i.type!=="divider"&&i.visible)}set dirty(i){console.assert(i===!0),this._dirty!==i&&i&&this.parentMenu&&(this._dirty=!0,this.parentMenu.dirty=!0)}updateIfDirty(){this._dirty&&this.updateState(this.rootMenu.modifiers)}updateElement(){var i;if(this._element){this._element.textContent="";for(const{element:r,visible:a}of this._menuItems)r&&a&&this._element.append(r);(i=this._element.querySelector("li:first-of-type"))==null||i.setAttribute("tabindex","0")}}get element(){if(this._element)return this._element;const i=document.createElement("menu");i.setAttribute("role","menu"),i.setAttribute("tabindex","-1"),i.setAttribute("aria-orientation","vertical"),i.setAttribute("part","ui-menu-container"),this._submenuClass&&i.classList.add(this._submenuClass),i.classList.add("ui-menu-container"),this._abortController||(this._abortController=new AbortController);const r=this._abortController.signal;return i.addEventListener("focus",this,{signal:r}),i.addEventListener("wheel",this,{passive:!0,signal:r}),this._element=i,this.updateElement(),i}get activeMenuItem(){return this._activeMenuItem}set activeMenuItem(i){var r,a,c,p;if(this.rootMenu.cancelDelayedOperation(),i!==this._activeMenuItem){if(this.activeMenuItem){const m=this.activeMenuItem;m.active=!1,(r=m.submenu)==null||r.hide()}if(!((a=i==null?void 0:i.visible)==null||a)){this._activeMenuItem=null;return}this._activeMenuItem=i,i&&(i.active=!0)}i?(c=i.element)==null||c.focus({preventScroll:!0}):(p=this._element)==null||p.focus({preventScroll:!0})}get firstMenuItem(){this.updateIfDirty();let i=0,r=!1;const a=this._menuItems;for(;!r&&i<=a.length-1;){const c=a[i];r=c.type!=="divider"&&c.visible&&c.enabled,i+=1}return r?a[i-1]:null}get lastMenuItem(){this.updateIfDirty();const i=this._menuItems;let r=i.length-1,a=!1;for(;!a&&r>=0;){const c=i[r];a=c.type!=="divider"&&c.visible&&c.enabled,r-=1}return a?i[r+1]:null}nextMenuItem(i){if(i===0)return this._activeMenuItem;if(!this._activeMenuItem)return i>0?this.firstMenuItem:this.lastMenuItem;if(!this.firstMenuItem||!this.lastMenuItem||!this._activeMenuItem)return null;this.updateIfDirty();const r=this._menuItems.indexOf(this.firstMenuItem),a=this._menuItems.indexOf(this.lastMenuItem);let c=this._menuItems.indexOf(this._activeMenuItem),p=1;for(;c>=r&&c<=a;){c+=i>0?1:-1;const m=this._menuItems[c];if(!m)break;if(m.visible&&m.enabled){if(p===Math.abs(i))return this._menuItems[c];p+=1}}return i>0?this.lastMenuItem:this.firstMenuItem}getMenuItemColumn(i){this.updateIfDirty();const a=this._menuItems.filter(c=>c.visible&&c.enabled).indexOf(i);return a<0?-1:a%this.columnCount}static get collator(){return pc._collator||(pc._collator=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),pc._collator}findMenuItem(i){var r;this.updateIfDirty();const a=this._menuItems.filter(b=>b.type!=="divider"&&b.visible&&b.enabled);if(a.length===0)return null;const c=Math.max(...a.map(b=>b.label.length))-i.length;if(c<0)return null;let p=null,m=0;for(;m<c&&!p;)p=(r=a.find(b=>pc.collator.compare(i,b.label.substring(m,i.length))===0))!=null?r:null,m++;return p}show(i){return!this.visible||!i.container?!1:(this.updateElement(),i.container.appendChild(this.element),U()&&(this.element.popover="manual",this.element.showPopover()),i.location&&Lg(this.element,{location:i.location,alternateLocation:i.alternateLocation,verticalPos:"bottom",horizontalPos:"start"}),this.element.focus({preventScroll:!0}),this.parentMenu&&(this.parentMenu.openSubmenu=this),!0)}hide(){var i,r,a,c,p;this.openSubmenu=null,this.activeMenuItem=null,this.parentMenu&&(this.parentMenu.openSubmenu=null),U()&&((i=this._element)!=null&&i.popover)&&this.element.hidePopover(),(a=(r=this.parentMenu)==null?void 0:r.element)==null||a.focus(),(p=(c=this._element)==null?void 0:c.parentNode)==null||p.removeChild(this._element)}set openSubmenu(i){var r,a,c,p;const m=i!==null;((r=this.activeMenuItem)==null?void 0:r.type)==="submenu"&&((a=this.activeMenuItem.element)==null||a.setAttribute("aria-expanded",m.toString())),(p=(c=this.activeMenuItem)==null?void 0:c.element)==null||p.classList.toggle("is-submenu-open",m),this.isSubmenuOpen=m}},bp=class wm extends yp{constructor(i,r){var a;super(i),this.state="closed",this.typingBufferResetTimer=0,this.hysteresisTimer=0,this._updating=!1,this._host=(a=r==null?void 0:r.host)!=null?a:null,this.isDynamic=i.some(xp),this._modifiers={shift:!1,control:!1,alt:!1,meta:!1},this.typingBuffer="",this.state="closed"}get modifiers(){return this._modifiers}set modifiers(i){h0(this._modifiers,i)||(this._modifiers=i,this.dirty=!0)}get activeSubmenu(){let i=this;for(;i.isSubmenuOpen;)i=i.activeMenuItem.submenu;return i}set dirty(i){this._updating||(console.assert(i===!0),this._dirty!==i&&(this._dirty=!0,i&&setTimeout(()=>{this.updateState(this.modifiers),this.updateElement()})))}updateState(i){this._updating=!0,this.modifiers=i!=null?i:this.modifiers,super.updateState(this.modifiers),this._updating=!1}handleKeyupEvent(i){this.isDynamic&&(this.modifiers=ya(i)),i.stopImmediatePropagation()}handleKeydownEvent(i){var r,a,c;if(i.key==="Tab"||i.key==="Escape"){this.hide();return}this.isDynamic&&(this.modifiers=ya(i));let p=!0;const m=this.activeSubmenu,b=m.activeMenuItem;switch(i.key){case" ":case"Space":case"Return":case"Enter":b==null||b.select(ya(i));break;case"ArrowRight":if((b==null?void 0:b.type)==="submenu")b.select(ya(i)),this.activeSubmenu.activeMenuItem=this.activeSubmenu.firstMenuItem;else if(!b)m.activeMenuItem=m.firstMenuItem;else{const w=(r=m.getMenuItemColumn(b))!=null?r:-1;if(w>=0&&w<((a=m.columnCount)!=null?a:1)-1){const E=m.nextMenuItem(1);E&&(m.activeMenuItem=E)}}break;case"ArrowLeft":if(m===this.rootMenu)b||(m.activeMenuItem=m.firstMenuItem);else if((b&&(c=m.getMenuItemColumn(b))!=null?c:-1)<=0||!b){m.hide();const E=m.parentMenu.activeMenuItem;if(E){const{element:I}=E;I==null||I.focus(),I==null||I.classList.remove("is-submenu-open")}}else{const E=m.nextMenuItem(-1);E&&(m.activeMenuItem=E)}break;case"ArrowDown":m.activeMenuItem=m.nextMenuItem(m.columnCount);break;case"ArrowUp":m.activeMenuItem=m.nextMenuItem(-m.columnCount);break;case"Home":case"PageUp":m.activeMenuItem=m.firstMenuItem;break;case"End":case"PageDown":m.activeMenuItem=m.lastMenuItem;break;case"Backspace":if(this.typingBuffer&&(this.typingBuffer=this.typingBuffer.slice(0,-1),this.typingBuffer)){clearTimeout(this.typingBufferResetTimer);const w=m.findMenuItem(this.typingBuffer);w&&(m.activeMenuItem=w),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}break;default:if(h(i)){isFinite(this.typingBufferResetTimer)&&clearTimeout(this.typingBufferResetTimer),this.typingBuffer+=i.key;const w=m.findMenuItem(this.typingBuffer);w&&(m.activeMenuItem=w),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}else p=!1}p&&(i.preventDefault(),i.stopPropagation())}handleEvent(i){if(i.type==="keydown")this.handleKeydownEvent(i);else if(i.type==="keyup")this.handleKeyupEvent(i);else if(i.type==="pointermove")this.lastMoveEvent=i;else if(i.type==="pointerup"&&i.target===this.scrim)Number.isFinite(this.rootMenu._openTimestamp)&&Date.now()-this.rootMenu._openTimestamp<120?this.state="modal":this.state==="modal"&&this.hide();else if(i.type==="contextmenu"){i.preventDefault(),i.stopPropagation();return}super.handleEvent(i)}dispatchEvent(i){return this._host?this._host.dispatchEvent(i):!0}get scrim(){return n.element}connectScrim(i){const r=this.scrim;r.addEventListener("pointerup",this),r.addEventListener("contextmenu",this),r.addEventListener("keydown",this),r.addEventListener("keyup",this),r.addEventListener("pointermove",this),n.open({root:i,onDismiss:()=>this.hide()})}disconnectScrim(){const i=this.scrim;i.removeEventListener("pointerup",this),i.removeEventListener("contextmenu",this),i.removeEventListener("keydown",this),i.removeEventListener("keyup",this),i.removeEventListener("pointermove",this),n.state==="open"&&n.scrim.close()}get rootMenu(){return this}show(i){return this._onDismiss=i==null?void 0:i.onDismiss,i!=null&&i.modifiers&&(this.modifiers=i.modifiers),this.updateState(),this.connectScrim(i==null?void 0:i.target),super.show(f(P({},i),{container:this.scrim}))?(this._openTimestamp=Date.now(),this.state="open",!0):(this.disconnectScrim(),!1)}hide(){this.cancelDelayedOperation(),this.state!==void 0&&(this.state!=="closed"&&(this.activeMenuItem=null,n.element.parentElement.focus(),super.hide(),this.state="closed",this.disconnectScrim()),this._onDismiss&&(this._onDismiss(),this._onDismiss=void 0))}scheduleOperation(i){this.cancelDelayedOperation();const r=wm.SUBMENU_DELAY;if(r<=0){i();return}this.hysteresisTimer=setTimeout(()=>{this.hysteresisTimer=0,i()},r)}cancelDelayedOperation(){this.hysteresisTimer&&(clearTimeout(this.hysteresisTimer),this.hysteresisTimer=0)}};bp.SUBMENU_DELAY=120;var Mg=bp;function xp(e){return D0(e)?!1:typeof e.label=="function"||typeof e.ariaLabel=="function"||typeof e.tooltip=="function"||(za(e)||sc(e))&&(typeof e.enabled=="function"||typeof e.visible=="function")||za(e)&&typeof e.checked=="function"?!0:sc(e)?e.submenu.some(xp):!1}var cd=class{};cd.DELAY=300,cd.MAX_DISTANCE=10;function Ig(e){return new Promise((i,r)=>{const a=Gl(e);a||i(!1);let c=a;const p=setTimeout(()=>{m.abort(),i(Dg(c,a)<cd.MAX_DISTANCE)},cd.DELAY),m=new AbortController,b=m.signal;for(const w of["pointermove","pointerup","pointercancel"])window.addEventListener(w,E=>{if(E.type==="pointerup"||E.type==="pointercancel")clearTimeout(p),m.abort(),i(!1);else if(E.type==="pointermove"){const I=Gl(E);I&&(c=I)}},{passive:!0,signal:b})})}function wp(e,i,r){return cl(this,null,function*(){if(e.type==="contextmenu"){const a=e;if(r.show({target:i,location:Gl(a),modifiers:ya(a)}))return e.preventDefault(),e.stopPropagation(),!0}if(e.type==="keydown"){const a=e;if(a.code==="ContextMenu"||a.code==="F10"&&a.shiftKey){const c=i==null?void 0:i.getBoundingClientRect();if(c&&r.show({target:i,location:{x:Math.ceil(c.left+c.width/2),y:Math.ceil(c.top+c.height/2)},modifiers:ya(a)}))return e.preventDefault(),e.stopPropagation(),!0}}if(e.type==="pointerdown"&&e.pointerType!=="mouse"&&e.button===0){let a=e.target;for(;a&&i!==a;)a=a.parentNode;if(!a||!r.visible)return!1;const c=Gl(e);if(yield Ig(e))return r.state!=="closed"?!1:(r.show({target:i,location:c}),!0)}return!1})}var Sp={acute:714,grave:715,dot:729,ddot:168,mathring:730,tilde:126,bar:713,breve:728,check:711,hat:94,vec:8407};ke(Object.keys(Sp),"{body:auto}",{createAtom:e=>new Uu(f(P({},e),{body:Me(e.args[0]),accentChar:Sp[e.command.slice(1)]}))}),ke(["widehat","widecheck","widetilde"],"{body:auto}",{createAtom:e=>{const i=gt(Me(e.args[0]));return new Uu(f(P({},e),{body:Me(e.args[0]),svgAccent:e.command.slice(1)+(i.length>5?"4":["1","1","2","2","3","3"][i.length])}))}}),ke(["overarc","overparen","wideparen"],"{body:auto}",{createAtom:e=>new Uu(f(P({},e),{body:Me(e.args[0]),svgAccent:"overarc"}))}),ke(["underarc","underparen"],"{body:auto}",{createAtom:e=>new Ps(f(P({},e),{body:Me(e.args[0]),svgBelow:"underarc"}))}),ke("utilde","{body:auto}",{createAtom:e=>{const i=Me(e.args[0]),r=gt(i),a="widetilde"+(r.length>5?"4":["1","1","2","2","3","3"][r.length]);return new Ps(f(P({},e),{body:i,svgBelow:a,boxType:Fr(i)}))}}),ke("^","{:string}",{createAtom:e=>{var i;return new Qe(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={a:"\xE2",e:"\xEA",i:"\xEE",o:"\xF4",u:"\xFB",A:"\xC2",E:"\xCA",I:"\xCE",O:"\xD4",U:"\xDB"}[e.args[0]])!=null?i:"^"}))}}),ke("`","{:string}",{createAtom:e=>{var i;return new Qe(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={a:"\xE0",e:"\xE8",i:"\xEC",o:"\xF2",u:"\xF9",A:"\xC0",E:"\xC8",I:"\xCC",O:"\xD2",U:"\xD9"}[e.args[0]])!=null?i:"`"}))}}),ke("'","{:string}",{createAtom:e=>{var i;return new Qe(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={a:"\xE1",e:"\xE9",i:"\xED",o:"\xF3",u:"\xFA",A:"\xC1",E:"\xC9",I:"\xCD",O:"\xD3",U:"\xDA"}[e.args[0]])!=null?i:"'"}))}}),ke('"',"{:string}",{createAtom:e=>{var i,r;return new Qe(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:(i=e.args)!=null&&i[0]?(r={a:"\xE4",e:"\xEB",i:"\xEF",o:"\xF6",u:"\xFC",A:"\xC4",E:"\xCB",I:"\xCB",O:"\xD6",U:"\xDC"}[e.args[0]])!=null?r:'"'+e.args[0]:'"'}))}}),ke(".","{:string}",{createAtom:e=>{var i,r;return new Qe(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:(i=e.args)!=null&&i[0]?(r={a:"\u0227",e:"\u0117",i:"\u0307i",o:"\u022F",u:"\u0307u",A:"\u0226",E:"\u0116",I:"\u0130",O:"\u022E",U:"\u0307U"}[e.args[0]])!=null?r:"."+e.args[0]:"."}))}}),ke("=","{:string}",{createAtom:e=>{var i,r;return new Qe(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:(i=e.args)!=null&&i[0]?(r={a:"\u0101",e:"\u0113",i:"\u012B",o:"\u014D",u:"\u016B",A:"\u0100",E:"\u0112",I:"\u012A",O:"\u014C",U:"\u016A"}[e.args[0]])!=null?r:"="+e.args[0]:"="}))}}),ke("~","{:string}",{createAtom:e=>{var i;return new Qe(f(P({type:"mord"},e),{isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={n:"\xF1",N:"\xD1",a:"\xE3",o:"\xF5",A:"\xC3",O:"\xD5"}[e.args[0]])!=null?i:"\xB4"}))}}),ke("c","{:string}",{createAtom:e=>{var i;return new Qe(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={c:"\xE7",C:"\xC7"}[e.args[0]])!=null?i:""}))}}),ke("enclose","{notation:string}[style:string]{body:auto}",{createAtom:e=>{var i,r;const a=e.args,c={strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",backgroundcolor:"transparent",padding:"auto",shadow:"none",svgStrokeStyle:void 0,borderStyle:void 0,style:(i=e.style)!=null?i:{}};if(a[1]){const m=a[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const b of m){const w=b.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(w)c.strokeWidth=w[1],c.strokeStyle=w[2],c.strokeColor=w[3];else{const E=b.match(/\s*([a-z]*)\s*=\s*"(.*)"/);E&&(E[1]==="mathbackground"?c.backgroundcolor=E[2]:E[1]==="mathcolor"?c.strokeColor=E[2]:E[1]==="padding"?c.padding=E[2]:E[1]==="shadow"&&(c.shadow=E[2]))}}c.strokeStyle==="dashed"?c.svgStrokeStyle="5,5":c.strokeStyle==="dotted"&&(c.svgStrokeStyle="1,5")}c.borderStyle=`${c.strokeWidth} ${c.strokeStyle} ${c.strokeColor}`;const p={};return((r=a[0])!=null?r:"").split(/[, ]/).filter(m=>m.length>0).forEach(m=>{p[m.toLowerCase()]=!0}),new Pl(e.command,Me(a[2]),p,c)}}),ke("cancel","{body:auto}",{createAtom:e=>{var i;return new Pl(e.command,Me(e.args[0]),{updiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(i=e.style)!=null?i:{}})}}),ke("bcancel","{body:auto}",{createAtom:e=>{var i;return new Pl(e.command,Me(e.args[0]),{downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(i=e.style)!=null?i:{}})}}),ke("xcancel","{body:auto}",{createAtom:e=>{var i;return new Pl(e.command,Me(e.args[0]),{updiagonalstrike:!0,downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(i=e.style)!=null?i:{}})}}),ke(["overrightarrow","overleftarrow","Overrightarrow","overleftharpoon","overrightharpoon","overleftrightarrow","overlinesegment","overgroup"],"{:auto}",{createAtom:e=>{var i;return new Ps(f(P({},e),{body:Me((i=e.args)==null?void 0:i[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgAbove:e.command.slice(1)}))}}),ke("overbrace","{:auto}",{createAtom:e=>new Ps(f(P({},e),{body:Me(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgAbove:e.command.slice(1)}))}),ke(["underrightarrow","underleftarrow","underleftrightarrow","underlinesegment","undergroup"],"{:auto}",{createAtom:e=>new Ps(f(P({},e),{body:Me(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgBelow:e.command.slice(1)}))}),ke(["underbrace"],"{:auto}",{createAtom:e=>new Ps(f(P({},e),{body:Me(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgBelow:e.command.slice(1)}))}),ke(["xrightarrow","longrightarrow","xleftarrow","longleftarrow","xRightarrow","xLeftarrow","xleftharpoonup","xleftharpoondown","xrightharpoonup","xrightharpoondown","xlongequal","xtwoheadleftarrow","xtwoheadrightarrow","xleftrightarrow","longleftrightarrow","xLeftrightarrow","xrightleftharpoons","longrightleftharpoons","xleftrightharpoons","xhookleftarrow","xhookrightarrow","xmapsto","xtofrom","xleftrightarrows","longleftrightarrows","xRightleftharpoons","longRightleftharpoons","xLeftrightharpoons","longLeftrightharpoons"],"[:auto]{:auto}",{createAtom:e=>{var i,r,a,c,p;return new Ps(f(P({},e),{svgBody:e.command.slice(1),above:((r=Me((i=e.args)==null?void 0:i[1]))==null?void 0:r.length)===0?void 0:Me((a=e.args)==null?void 0:a[1]),below:(p=Me((c=e.args)==null?void 0:c[0]))!=null?p:null,skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,paddedLabels:!0,boxType:"rel"}))},serialize:(e,i)=>e.command+(e.hasEmptyBranch("below")?"":`[${e.belowToLatex(i)}]`)+`{${e.aboveToLatex(i)}}${e.supsubToLatex(i)}`}),ke(["arccos","arcsin","arctan","arctg","arcctg","arg","ch","cos","cosh","cot","cotg","coth","ctg","cth","csc","cosec","deg","dim","exp","gcd","hom","inf","ker","lb","lg","ln","log","Pr","sec","sh","sin","sinh","sup","tan","tanh","tg","th","arcsec","arccsc","arsinh","arcosh","artanh","arcsech","arccsch"],"",{isFunction:!0,ifMode:"math",createAtom:e=>new bo(e.command.slice(1),f(P({},e),{limits:"adjacent",isFunction:!0,variant:"main",variantStyle:"up"}))}),ke(["liminf","limsup"],"",{ifMode:"math",createAtom:e=>new bo({"\\liminf":"lim inf","\\limsup":"lim sup"}[e.command],f(P({},e),{limits:"over-under",variant:"main"}))}),ke(["lim","mod"],"",{ifMode:"math",createAtom:e=>new bo(e.command.slice(1),f(P({},e),{limits:"over-under",variant:"main"}))}),ke(["det","max","min"],"",{ifMode:"math",isFunction:!0,createAtom:e=>new bo(e.command.slice(1),f(P({},e),{limits:"over-under",isFunction:!0,variant:"main"}))}),ke(["ang"],"{:math}",{ifMode:"math",createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[0])})),serialize:(e,i)=>`\\ang{${e.bodyToLatex(i)}}`,render:(e,i)=>{const r=e.createBox(i),a=r.caret;r.caret=void 0;const c=new Mt("\xB0",{style:f(P({},e.style),{variant:"normal",variantStyle:"up"})});return new Mt([r,c],{type:"inner",isSelected:e.isSelected,caret:a})}}),ke("sqrt","[index:auto]{radicand:expression}",{ifMode:"math",createAtom:e=>new lh(f(P({},e),{body:Me(e.args[1]),index:e.args[0]?Me(e.args[0]):void 0}))}),ke(["frac","dfrac","tfrac","cfrac","binom","dbinom","tbinom"],"{:expression}{:expression}",{ifMode:"math",createAtom:e=>{const i=P({},e),r=e.command,a=e.args;switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":i.hasBarLine=!0;break;case"\\atopfrac":i.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":i.hasBarLine=!1,i.leftDelim="(",i.rightDelim=")";break;case"\\cfrac":i.hasBarLine=!0,i.continuousFraction=!0;break;default:}switch(r){case"\\dfrac":case"\\dbinom":i.mathstyleName="displaystyle";break;case"\\tfrac":case"\\tbinom":i.mathstyleName="textstyle";break;default:}return new tl(a[0]?Me(a[0]):[new ea],a[1]?Me(a[1]):[new ea],i)},serialize:(e,i)=>{const r=e.aboveToLatex(i),a=e.belowToLatex(i);return/^[0-9]$/.test(r)&&/^[0-9]$/.test(a)?`${e.command}${r}${a}`:Zn(e.command,r,a)}}),ke(["brace","brack"],"",{infix:!0,createAtom:e=>new tl(Me(e.args[0]),Me(e.args[1]),f(P({},e),{hasBarLine:!1,leftDelim:e.command==="\\brace"?"\\lbrace":"\\lbrack",rightDelim:e.command==="\\brace"?"\\rbrace":"\\rbrack"})),serialize:(e,i)=>un([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),ke(["over","atop","choose"],"",{infix:!0,createAtom:e=>{let i,r;const a=e.args;return e.command==="\\choose"&&(i="(",r=")"),new tl(Me(a[0]),Me(a[1]),f(P({},e),{hasBarLine:e.command==="\\over",leftDelim:i,rightDelim:r}))},serialize:(e,i)=>un([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),ke(["overwithdelims","atopwithdelims"],"{numer:auto}{denom:auto}{left-delim:delim}{right-delim:delim}",{infix:!0,createAtom:e=>{var i,r;const a=e.args;return new tl(Me(a[0]),Me(a[1]),f(P({},e),{leftDelim:(i=a[2])!=null?i:".",rightDelim:(r=a[3])!=null?r:".",hasBarLine:!1}))},serialize:(e,i)=>`${e.aboveToLatex(i)} ${e.command}${e.leftDelim}${e.rightDelim}${e.belowToLatex(i)}`}),ke("pdiff","{numerator}{denominator}",{ifMode:"math",createAtom:e=>new tl(Me(e.args[0]),Me(e.args[1]),f(P({},e),{hasBarLine:!0,numerPrefix:"\u2202",denomPrefix:"\u2202"}))}),ke(["sum","prod","bigcup","bigcap","coprod","bigvee","bigwedge","biguplus","bigotimes","bigoplus","bigodot","bigsqcup","intop"],"",{ifMode:"math",createAtom:e=>new Yu({coprod:"\u2210",bigvee:"\u22C1",bigwedge:"\u22C0",biguplus:"\u2A04",bigcap:"\u22C2",bigcup:"\u22C3",intop:"\u222B",prod:"\u220F",sum:"\u2211",bigotimes:"\u2A02",bigoplus:"\u2A01",bigodot:"\u2A00",bigsqcup:"\u2A06",smallint:"\u222B"}[e.command.slice(1)],f(P({},e),{limits:"auto",variant:"main"}))}),ke("smallint","",{ifMode:"math",createAtom:e=>new bo("\u222B",f(P({},e),{limits:"adjacent",variant:"main"}))});var Ep={int:"\u222B",iint:"\u222C",iiint:"\u222D",oint:"\u222E",oiint:"\u222F",oiiint:"\u2230",intclockwise:"\u2231",varointclockwise:"\u2232",ointctrclockwise:"\u2233",intctrclockwise:"\u2A11",sqcup:"\u2294",sqcap:"\u2293",uplus:"\u228E",wr:"\u2240",amalg:"\u2A3F",Cap:"\u22D2",Cup:"\u22D3",doublecap:"\u22D2",doublecup:"\u22D3"};ke(Object.keys(Ep),"",{ifMode:"math",createAtom:e=>{const i=e.command,r=Ep[i.slice(1)];return new Yu(r,f(P({},e),{limits:"adjacent",variant:{"\u22D2":"ams","\u22D3":"ams"}[r]}))}}),ke(["Re","Im"],"",{ifMode:"math",createAtom:e=>new bo({"\\Re":"\u211C","\\Im":"\u2111"}[e.command],f(P({},e),{limits:"adjacent",isFunction:!0,variant:"fraktur"}))}),ke("middle","{:delim}",{ifMode:"math",createAtom:e=>{var i;return new If(f(P({},e),{delim:(i=e.args[0])!=null?i:"|",size:1}))}}),ke("the","{:value}",{createAtom:e=>new Qe(f(P({},e),{captureSelection:!0,verbatimLatex:null})),render:(e,i)=>{var r;const a=new sn({parent:i},e.style);let c="";e.isSelected&&(c+=" ML__selected");const p=a.evaluate(e.args[0]);return new Mt(((r=Mr(p))!=null?r:"").split("").map(m=>new Mt(m,{type:"ord",classes:c,mode:e.mode,isSelected:e.isSelected,style:P({variant:"main"},e.style)})),{type:"lift",style:e.style,caret:e.caret,isSelected:e.isSelected,classes:c}).wrap(a)},serialize:e=>{var i;return`\\the${(i=Mr(e.args[0]))!=null?i:"\\relax"}`}}),ke("mathtip","{:auto}{:math}",{createAtom:e=>new il(f(P({},e),{body:Me(e.args[0]),tooltip:Me(e.args[1]),content:"math"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${Qe.serialize([e.tooltip],f(P({},i),{defaultMode:"math"}))}}`}),ke("texttip","{:auto}{:text}",{createAtom:e=>new il(f(P({},e),{body:Me(e.args[0]),tooltip:Me(e.args[1]),content:"text"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${Qe.serialize([e.tooltip],f(P({},i),{defaultMode:"text"}))}}`}),ke("error","{:math}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[0])})),serialize:(e,i)=>`\\error{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__error"})}),ke("ensuremath","{:math}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[0])})),serialize:(e,i)=>`${e.command}{${e.bodyToLatex(f(P({},i),{defaultMode:"math"}))}}`}),ke("color","{:value}",{applyStyle:(e,i,r)=>{var a,c;return{verbatimColor:(a=Mr(i[0]))!=null?a:void 0,color:r.toColor((c=i[0])!=null?c:{string:"red"})}}}),ke("textcolor","{:value}{content:auto*}",{applyStyle:(e,i,r)=>{var a,c;return{verbatimColor:(a=Mr(i[0]))!=null?a:void 0,color:r.toColor((c=i[0])!=null?c:{string:"red"})}}}),ke("boxed","{content:math}",{createAtom:e=>new Oa(f(P({},e),{body:Me(e.args[0]),framecolor:{string:"black"}}))}),ke("colorbox","{:value}{:text*}",{applyStyle:(e,i,r)=>{var a,c;return{verbatimBackgroundColor:(a=Mr(i[0]))!=null?a:void 0,backgroundColor:r.toBackgroundColor((c=i[0])!=null?c:{string:"yellow"})}}}),ke("fcolorbox","{frame-color:value}{background-color:value}{content:text}",{applyMode:"text",createAtom:e=>{var i,r;return new Oa(f(P({},e),{body:Me(e.args[2]),framecolor:(i=e.args[0])!=null?i:{string:"blue"},backgroundcolor:(r=e.args[1])!=null?r:{string:"yellow"}}))},serialize:(e,i)=>{var r,a;return i.skipStyles?e.bodyToLatex(f(P({},i),{defaultMode:"text"})):Zn(e.command,(r=Mr(e.framecolor))!=null?r:"",(a=Mr(e.backgroundcolor))!=null?a:"",e.bodyToLatex(f(P({},i),{defaultMode:"text"})))}}),ke("bbox","[:bbox]{body:auto}",{createAtom:e=>{var i;const r=e.args[0],a=Me(e.args[1]);return r?new Oa(f(P({},e),{body:a,padding:r.padding,border:r.border,backgroundcolor:(i=r.backgroundcolor)!=null?i:void 0})):new Oa(f(P({},e),{body:a}))},serialize:(e,i)=>{var r,a;if(i.skipStyles)return e.bodyToLatex(i);let c=e.command;if(Number.isFinite(e.padding)||e.border!==void 0||e.backgroundcolor!==void 0){const p=[];e.padding&&p.push((r=Mr(e.padding))!=null?r:""),e.border&&p.push(`border: ${e.border}`),e.backgroundcolor&&p.push((a=Mr(e.backgroundcolor))!=null?a:""),c+=`[${p.join(",")}]`}return Zn(c,e.bodyToLatex(i))}}),ke(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"],"{:rest}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[0])})),render:(e,i)=>{const r=new sn({parent:i,mathstyle:e.command.slice(1)},e.style),a=Qe.createBox(r,e.body,{type:"lift"});return e.caret&&(a.caret=e.caret),e.bind(i,a)},serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`{${un([e.command,e.bodyToLatex(i)])}}`}),ke(["tiny","scriptsize","footnotesize","small","normalsize","large","Large","LARGE","huge","Huge"],"",{applyStyle:e=>({fontSize:{"\\tiny":1,"\\scriptsize":2,"\\footnotesize":3,"\\small":4,"\\normalsize":5,"\\large":6,"\\Large":7,"\\LARGE":8,"\\huge":9,"\\Huge":10}[e]})}),ke("fontseries","{:string}",{ifMode:"text",applyStyle:(e,i)=>{var r;return{fontSeries:(r=i[0])!=null?r:"auto"}}}),ke("fontshape","{:string}",{ifMode:"text",applyStyle:(e,i)=>{var r;return{fontShape:(r=i[0])!=null?r:"auto"}}}),ke("fontfamily","{:string}",{ifMode:"text",applyStyle:(e,i)=>{var r;return{fontFamily:(r=i[0])!=null?r:"roman"}}}),ke("selectfont","",{ifMode:"text",applyStyle:()=>({})}),ke("bf","{:rest}",{applyStyle:()=>({fontSeries:"b",fontShape:"n",fontFamily:"roman"})}),ke(["boldsymbol","bm"],"{:math}",{applyMode:"math",createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[0])})),serialize:(e,i)=>`${e.command}{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__boldsymbol"})}),ke("bold","{:math*}",{applyMode:"math",applyStyle:()=>({variantStyle:"bold"})}),ke("bfseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),ke("mdseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),ke("upshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),ke("slshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),ke("scshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),ke("textbf","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),ke("textmd","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),ke("textup","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),ke("textnormal","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n",fontSeries:"m"})}),ke("textsl","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),ke("textit","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"it"})}),ke("textsc","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),ke("textrm","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"roman"})}),ke("textsf","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"sans-serif"})}),ke("texttt","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"monospace"})}),ke("mathbf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"bold"})}),ke("mathit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"italic"})}),ke("mathnormal","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"italic"})}),ke("mathbfit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"bolditalic"})}),ke("mathrm","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"up"})}),ke("mathsf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"sans-serif",variantStyle:"up"})}),ke("mathtt","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"monospace",variantStyle:"up"})}),ke("it","{:rest}",{applyStyle:()=>({fontSeries:"m",fontShape:"it",fontFamily:"roman",variantStyle:"italic"})}),ke("rmfamily","",{applyStyle:()=>({fontFamily:"roman"})}),ke("sffamily","",{applyStyle:()=>({fontFamily:"sans-serif"})}),ke("ttfamily","",{applyStyle:()=>({fontFamily:"monospace"})}),ke(["Bbb","mathbb"],"{:math*}",{applyStyle:()=>({variant:"double-struck",variantStyle:"up"})}),ke(["frak","mathfrak"],"{:math*}",{applyStyle:()=>({variant:"fraktur",variantStyle:"up"})}),ke("mathcal","{:math*}",{applyStyle:()=>({variant:"calligraphic",variantStyle:"up"})}),ke("mathscr","{:math*}",{applyStyle:()=>({variant:"script",variantStyle:"up"})}),ke("mbox","{:text}",{ifMode:"math",createAtom:e=>new Qe(f(P({},e),{type:"mord",body:Me(e.args[0]),mode:"math"})),serialize:(e,i)=>Zn("\\mbox",e.bodyToLatex(f(P({},i),{defaultMode:"text"})))}),ke("text","{:text}",{ifMode:"math",applyMode:"text"}),ke(["class","htmlClass"],"{name:string}{content:auto}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[1])})),serialize:(e,i)=>!e.args[0]||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`,render:(e,i)=>{var r;return e.createBox(i,{classes:(r=e.args[0])!=null?r:""})}}),ke(["cssId","htmlId"],"{id:string}{content:auto}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[1])})),serialize:(e,i)=>{var r;return!((r=e.args)!=null&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;const a=e.createBox(i);return a.cssId=(r=e.args[0])!=null?r:"",a}}),ke("htmlData","{data:string}{content:auto}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[1])})),serialize:(e,i)=>{var r;return!((r=e.args)!=null&&r[0])||i.skipStyles?e.bodyToLatex(i):`\\htmlData{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;const a=e.createBox(i);return a.htmlData=(r=e.args[0])!=null?r:"",a}}),ke(["style","htmlStyle"],"{data:string}{content:auto}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[1])})),serialize:(e,i)=>{var r;return!((r=e.args)!=null&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;const a=e.createBox(i);return a.htmlStyle=(r=e.args[0])!=null?r:"",a}}),ke("em","{:rest}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[0])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`{\\em ${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})}),ke("emph","{:auto}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[1])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\emph{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})});var kp={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}};ke(["bigl","Bigl","biggl","Biggl","bigr","Bigr","biggr","Biggr","bigm","Bigm","biggm","Biggm","big","Big","bigg","Bigg"],"{:delim}",{createAtom:e=>{var i;return new ah(f(P({},e),{delim:(i=e.args[0])!=null?i:".",size:kp[e.command].size,delimType:kp[e.command].mclass}))}}),ke(["hspace","hspace*"],"{width:value}",{createAtom:e=>{var i;return new yo(f(P({},e),{width:(i=e.args[0])!=null?i:{dimension:0}}))}}),ke(["mkern","kern","mskip","hskip","mspace"],"{width:value}",{createAtom:e=>{var i;return new yo(f(P({},e),{width:(i=e.args[0])!=null?i:{dimension:0}}))}}),ke("mathchoice","{:math}{:math}{:math}{:math}",{createAtom:e=>new Qe(e),render:(e,i)=>{let r=0;const a=i.mathstyle.id;(a===Ru||a===ao)&&(r=1),(a===qo||a===fs)&&(r=2),(a===oo||a===Wr)&&(r=3);const c=Me(e.args[r]);return Qe.createBox(i,c)},serialize:(e,i)=>`\\mathchoice{${Qe.serialize(e.args[0],i)}}{${Qe.serialize(e.args[1],i)}}{${Qe.serialize(e.args[2],i)}}{${Qe.serialize(e.args[3],i)}}`}),ke("mathop","{:auto}",{createAtom:e=>new Qe(f(P({},e),{type:"mop",body:Me(e.args[0]),limits:"over-under",isFunction:!0,captureSelection:!0})),render:(e,i)=>{var r;let a=Qe.createBox(i,e.body);if(e.superscript||e.subscript){const c=(r=e.subsupPlacement)!=null?r:"auto";a=c==="over-under"||c==="auto"&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return new Mt(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,i)=>{const r=[Zn(e.command,e.bodyToLatex(i))];return e.explicitSubsupPlacement&&(e.subsupPlacement==="over-under"&&r.push("\\limits"),e.subsupPlacement==="adjacent"&&r.push("\\nolimits"),e.subsupPlacement==="auto"&&r.push("\\displaylimits")),r.push(e.supsubToLatex(i)),un(r)}}),ke(["mathbin","mathrel","mathopen","mathclose","mathpunct","mathord","mathinner"],"{:auto}",{createAtom:e=>new Qe(f(P({},e),{type:{"\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[e.command],body:Me(e.args[0])}))}),ke(["operatorname","operatorname*"],"{operator:math}",{createAtom:e=>{const i=Me(e.args[0]).map(r=>{var a;return r.type!=="first"&&(r.type="mord",r.value=(a={"\u2217":"*","\u2212":"-"}[r.value])!=null?a:r.value,r.isFunction=!1,!r.style.variant&&!r.style.variantStyle&&(r.style.variant="main",r.style.variantStyle="up")),r});return new Qe(f(P({},e),{type:"mop",body:i,isFunction:!0,limits:e.command==="\\operatorname"?"adjacent":"over-under"}))},render:(e,i)=>{var r;let a=Qe.createBox(i,e.body);if(e.superscript||e.subscript){const c=(r=e.subsupPlacement)!=null?r:"auto";a=c==="over-under"||c==="auto"&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return e.caret&&(a.caret=e.caret),new Mt(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,i)=>{const r=[Zn(e.command,e.bodyToLatex(i))];return e.explicitSubsupPlacement&&(e.subsupPlacement==="over-under"&&r.push("\\limits"),e.subsupPlacement==="adjacent"&&r.push("\\nolimits"),e.subsupPlacement==="auto"&&r.push("\\displaylimits")),r.push(e.supsubToLatex(i)),un(r)}}),ke(["char","unicode"],"{charcode:value}",{createAtom:e=>new Qe(f(P({},e),{type:e.mode==="text"?"text":"mord"})),serialize:e=>{var i;return`${e.command}${Mr((i=e.args[0])!=null?i:{number:10067,base:"hexadecimal"})}`},render:(e,i)=>{let r=i.evaluate(e.args[0]);return(!r||!("number"in r))&&(r={number:10067,base:"hexadecimal"}),e.value=String.fromCodePoint(r.number),e.createBox(i)}}),ke("rule","[raise:value]{width:value}{thickness:value}",{createAtom:e=>new Qe(e),render:(e,i)=>{var r,a,c;const p=new sn({parent:i,mathstyle:"textstyle"},e.style),m=p.toEm((r=e.args[0])!=null?r:{dimension:0}),b=p.toEm((a=e.args[1])!=null?a:{dimension:10}),w=p.toEm((c=e.args[2])!=null?c:{dimension:10}),E=new Mt(null,{classes:"rule",type:"ord"});return E.width=b,E.height=w+m,E.depth=-m,E.setStyle("border-right-width",b,"em"),E.setStyle("border-top-width",w,"em"),E.setStyle("border-color",e.style.color),E.setStyle("vertical-align",m,"em"),e.isSelected&&E.setStyle("opacity","50%"),e.bind(p,E),e.caret&&(E.caret=e.caret),E.wrap(i)},serialize:e=>`\\rule${e.args[0]?`[${Mr(e.args[0])}]`:""}{${Mr(e.args[1])}}{${Mr(e.args[2])}}`}),ke(["overline","underline"],"{:auto}",{createAtom:e=>new Qe(f(P({},e),{body:Me(e.args[0])})),render:(e,i)=>{const r=e.command.substring(1),a=new sn({parent:i,mathstyle:"cramp"},e.style),c=Qe.createBox(a,e.body);if(!c)return null;const p=a.metrics.defaultRuleThickness/a.scalingFactor,m=new Mt(null,{classes:r+"-line"});m.height=p,m.maxFontSize=p*1.125*a.scalingFactor;let b;return r==="overline"?b=new Er({shift:0,children:[{box:c},3*p,{box:m},p]}):b=new Er({top:c.height,children:[p,{box:m},3*p,{box:c}]}),e.caret&&(b.caret=e.caret),new Mt(b,{classes:r,type:"ignore"})}}),ke("overset","{:auto}{base:auto}",{createAtom:e=>{const i=Me(e.args[1]);return new Ps(f(P({},e),{above:Me(e.args[0]),body:i,skipBoundary:!1,boxType:Fr(i)}))},serialize:(e,i)=>Zn(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),ke("underset","{:auto}{base:auto}",{createAtom:e=>{const i=Me(e.args[1]);return new Ps(f(P({},e),{below:Me(e.args[0]),body:i,skipBoundary:!1,boxType:Fr(i)}))},serialize:(e,i)=>Zn(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),ke("overunderset","{above:auto}{below:auto}{base:auto}",{createAtom:e=>{const i=Me(e.args[2]);return new Ps(f(P({},e),{above:Me(e.args[0]),below:Me(e.args[1]),body:i,skipBoundary:!1,boxType:Fr(i)}))},serialize:(e,i)=>Zn(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),ke(["stackrel","stackbin"],"[below:auto]{above:auto}{base:auto}",{createAtom:e=>new Ps(f(P({},e),{body:Me(e.args[2]),above:Me(e.args[1]),below:Me(e.args[0]),skipBoundary:!1,boxType:e.command==="\\stackrel"?"rel":"bin"})),serialize:(e,i)=>Zn(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),ke("smash","[:string]{:auto}",{createAtom:e=>{var i,r,a,c;return new Ol(f(P({},e),{body:Me(e.args[1]),smashHeight:(r=(i=e.args[0])==null?void 0:i.includes("t"))!=null?r:!0,smashDepth:(c=(a=e.args[0])==null?void 0:a.includes("b"))!=null?c:!0}))}}),ke(["vphantom"],"{:auto}",{createAtom:e=>new Ol(f(P({},e),{body:Me(e.args[0]),isInvisible:!0,smashWidth:!0}))}),ke(["hphantom"],"{:auto}",{createAtom:e=>new Ol(f(P({},e),{body:Me(e.args[0]),isInvisible:!0,smashHeight:!0,smashDepth:!0}))}),ke(["phantom"],"{:auto}",{createAtom:e=>new Ol(f(P({},e),{body:Me(e.args[0]),isInvisible:!0}))}),ke("not","{:math}",{createAtom:e=>{const i=Me(e.args[0]);return i.length===0?new Qe(f(P({},e),{type:"mrel",value:"\uE020"})):new Qe(f(P({},e),{body:[new Fa(f(P({},e),{body:"\uE020",align:"right"})),...i],captureSelection:!0}))},serialize:(e,i)=>{const r=e.args[0],a=r&&typeof r=="object"&&"group"in r;return e.value!=="\uE020"?a?`\\not{${Qe.serialize(r.group,i)}}`:`\\not${Qe.serialize(r,i)}`:a?"\\not{}":"\\not"},render:(e,i)=>{if(e.value)return e.createBox(i);const a=e.args[0]&&typeof e.args[0]=="object"&&"group"in e.args[0]?"ord":Fr(Me(e.args[0])),c=Qe.createBox(i,e.body,{type:a});return e.caret&&(c.caret=e.caret),e.bind(i,c)}}),ke(["ne","neq"],"",{createAtom:e=>new Qe(f(P({},e),{type:"mrel",body:[new Fa(f(P({},e),{body:"\uE020",align:"right",boxType:"rel"})),new Qe(f(P({},e),{value:"="}))],captureSelection:!0})),serialize:e=>e.command}),ke("rlap","{:auto}",{createAtom:e=>new Fa(f(P({},e),{body:Me(e.args[0]),align:"right"}))}),ke("llap","{:auto}",{createAtom:e=>new Fa(f(P({},e),{body:Me(e.args[0]),align:"left"}))}),ke("mathrlap","{:math}",{createAtom:e=>new Fa(f(P({},e),{body:Me(e.args[0]),align:"left"}))}),ke("mathllap","{:math}",{createAtom:e=>new Fa(f(P({},e),{body:Me(e.args[0]),align:"left"}))}),ke("raisebox","{:value}{:text}",{createAtom:e=>{var i;return new Oa(f(P({},e),{body:Me(e.args[1]),padding:{dimension:0},offset:(i=e.args[0])!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r;return Zn("\\raisebox",(r=Mr(e.offset))!=null?r:"0pt",e.bodyToLatex(i))}}),ke("raise","{:value}{:auto}",{createAtom:e=>{var i;return new Oa(f(P({},e),{body:Me(e.args[1]),padding:{dimension:0},offset:(i=e.args[0])!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r;return Zn("\\raise",(r=Mr(e.offset))!=null?r:"0pt",e.bodyToLatex(i))}}),ke("lower","{:value}{:auto}",{createAtom:e=>{var i;return new Oa(f(P({},e),{body:Me(e.args[1]),padding:{dimension:0},offset:(i=Rs(e.args[0],-1))!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r,a;return Zn("\\lower",(a=Mr(Rs((r=e.offset)!=null?r:{dimension:0},-1)))!=null?a:"0pt",e.bodyToLatex(i))}}),lt("0123456789/@.?!"),ee(65,90),ee(97,122),lt([["\\forall",8704],["\\exists",8707],["\\nexists",8708,"mord","ams"],["\\mid",8739,"mrel"],["\\top",8868],["\\bot",8869]]),lt([["\\#",35],["\\&",38],["\\parallelogram",9649],["\\spadesuit",9824],["\\heartsuit",9825],["\\diamondsuit",9826],["\\clubsuit",9827],["\\flat",9837],["\\natural",9838],["\\sharp",9839]]),lt([["\\backslash",92],["\\nabla",8711],["\\partial",8706],["\\ell",8467],["\\hbar",8463],["\\Q",81,"mord","double-struck"],["\\C",67,"mord","double-struck"],["\\P",80,"mord","double-struck"],["\\pounds",163],["\\euro",8364]]),lt([["\\rightarrow",8594],["\\to",8594],["\\leftarrow",8592],["\\gets",8592],["\\Rightarrow",8658],["\\Leftarrow",8656],["\\longrightarrow",10230],["\\longleftarrow",10229],["\\Longrightarrow",10233],["\\implies",10233],["\\Longleftarrow",10232],["\\impliedby",10232],["\\longleftrightarrow",10231],["\\biconditional",10231],["\\Longleftrightarrow",10234],["\\mapsto",8614],["\\longmapsto",10236],["\\uparrow",8593],["\\downarrow",8595],["\\Uparrow",8657],["\\Downarrow",8659],["\\updownarrow",8597],["\\Updownarrow",8661],["\\hookrightarrow",8618],["\\hookleftarrow",8617],["\\rightharpoonup",8640],["\\leftharpoonup",8636],["\\rightharpoondown",8641],["\\leftharpoondown",8637],["\\searrow",8600],["\\nearrow",8599],["\\swarrow",8601],["\\nwarrow",8598],["\\originalof",8886],["\\laplace",8886],["\\imageof",8887],["\\Laplace",8887]],"mrel"),lt([["\\mapsfrom",8612,"mrel"],["\\Mapsfrom",10502,"mrel"],["\\MapsTo",10503,"mrel"],["\\Yup",8516,"mord"],["\\lightning",8623,"mrel"],["\\leftarrowtriangle",8701,"mrel"],["\\rightarrowtriangle",8702,"mrel"],["\\leftrightarrowtriangle",8703,"mrel"],["\\boxdot",8865,"mbin"],["\\bigtriangleup",9651,"mbin"],["\\bigtriangledown",9661,"mbin"],["\\boxbar",9707,"mbin"],["\\Lbag",10181,"mopen"],["\\Rbag",10182,"mclose"],["\\llbracket",10214,"mopen"],["\\rrbracket",10215,"mclose"],["\\longmapsfrom",10235,"mrel"],["\\Longmapsfrom",10237,"mrel"],["\\Longmapsto",10238,"mrel"],["\\boxslash",10692,"mbin"],["\\boxbslash",10693,"mbin"],["\\boxast",10694,"mbin"],["\\boxcircle",10695,"mbin"],["\\boxbox",10696,"mbin"],["\\fatsemi",10783,"mop"],["\\leftslice",10918,"mrel"],["\\rightslice",10919,"mrel"],["\\interleave",10996,"mbin"],["\\biginterleave",11004,"mop"],["\\sslash",11005,"mbin"],["\\talloblong",11006,"mbin"]]),lt([["\\lbrace",123,"mopen"],["\\rbrace",125,"mclose"],["\\lparen",40,"mopen"],["\\rparen",41,"mclose"],["\\langle",10216,"mopen"],["\\rangle",10217,"mclose"],["\\lfloor",8970,"mopen"],["\\rfloor",8971,"mclose"],["\\lceil",8968,"mopen"],["\\rceil",8969,"mclose"],["\\vert",8739],["\\lvert",8739,"mopen"],["\\rvert",8739,"mclose"],["\\|",8741],["\\Vert",8741],["\\mVert",8741],["\\lVert",8741,"mopen"],["\\rVert",8741,"mclose"],["\\lbrack",91,"mopen"],["\\rbrack",93,"mclose"],["\\{",123,"mopen"],["\\}",125,"mclose"],["(",40,"mopen"],[")",41,"mclose"],["[",91,"mopen"],["]",93,"mclose"],["\\ulcorner",9484,"mopen","ams"],["\\urcorner",9488,"mclose","ams"],["\\llcorner",9492,"mopen","ams"],["\\lrcorner",9496,"mclose","ams"],["\\lgroup",10222,"mopen"],["\\rgroup",10223,"mclose"],["\\lmoustache",9136,"mopen"],["\\rmoustache",9137,"mclose"]]),lt([["\\dashrightarrow",8674],["\\dashleftarrow",8672],["\\Rrightarrow",8667],["\\Lleftarrow",8666],["\\leftrightarrows",8646],["\\rightleftarrows",8644],["\\curvearrowright",8631],["\\curvearrowleft",8630],["\\rightrightarrows",8649],["\\leftleftarrows",8647],["\\upuparrows",8648],["\\downdownarrows",8650],["\\vartriangle",9651],["\\triangleq",8796],["\\vartriangleleft",8882],["\\trianglelefteq",8884],["\\ntriangleleft",8938],["\\ntrianglelefteq",8940],["\\vartriangleright",8883],["\\trianglerighteq",8885],["\\ntriangleright",8939],["\\ntrianglerighteq",8941],["\\blacktriangleleft",9664],["\\blacktriangleright",9654],["\\leftarrowtail",8610],["\\rightarrowtail",8611],["\\looparrowright",8620],["\\looparrowleft",8619],["\\twoheadleftarrow",8606],["\\twoheadrightarrow",8608],["\\twoheadrightarrowtail",10518],["\\rightleftharpoons",8652],["\\leftrightharpoons",8651],["\\Rsh",8625],["\\Lsh",8624],["\\circlearrowright",8635],["\\circlearrowleft",8634],["\\restriction",8638],["\\upharpoonright",8638],["\\upharpoonleft",8639],["\\downharpoonright",8642],["\\downharpoonleft",8643],["\\rightsquigarrow",8669],["\\leadsto",8669],["\\leftrightsquigarrow",8621],["\\multimap",8888],["\\nleftarrow",8602],["\\nrightarrow",8603],["\\nRightarrow",8655],["\\nLeftarrow",8653],["\\nleftrightarrow",8622],["\\nLeftrightarrow",8654],["\\nvrightarrow",8696],["\\nvtwoheadrightarrow",10496],["\\nvrightarrowtail",10516],["\\nvtwoheadrightarrowtail",10519],["\\shortparallel",8741],["\\nless",8814],["\\nleqslant",57360],["\\lneq",10887],["\\lneqq",8808],["\\nleqq",57361],["\\lvertneqq",57356],["\\lnsim",8934],["\\lnapprox",10889],["\\nprec",8832],["\\npreceq",8928],["\\precnsim",8936],["\\precnapprox",10937],["\\nsim",8769],["\\nshortmid",57350],["\\nmid",8740],["\\nvdash",8876],["\\nvDash",8877],["\\ngtr",8815],["\\ngeqslant",57359],["\\ngeqq",57358],["\\gneq",10888],["\\gneqq",8809],["\\gvertneqq",57357],["\\gnsim",8935],["\\gnapprox",10890],["\\nsucc",8833],["\\nsucceq",8929],["\\succnsim",8937],["\\succnapprox",10938],["\\ncong",8774],["\\nshortparallel",57351],["\\nparallel",8742],["\\nVDash",8879],["\\nsupseteqq",57368],["\\supsetneq",8843],["\\varsupsetneq",57371],["\\supsetneqq",10956],["\\varsupsetneqq",57369],["\\nVdash",8878],["\\precneqq",10933],["\\succneqq",10934],["\\nsubseteqq",57366],["\\leqslant",10877],["\\geqslant",10878],["\\gtrsim",8819],["\\approxeq",8778],["\\thickapprox",8776],["\\lessapprox",10885],["\\gtrapprox",10886],["\\precapprox",10935],["\\succapprox",10936],["\\thicksim",8764],["\\succsim",8831],["\\precsim",8830],["\\backsim",8765],["\\eqsim",8770],["\\backsimeq",8909],["\\lesssim",8818],["\\nleq",8816],["\\ngeq",8817],["\\smallsmile",8995],["\\smallfrown",8994],["\\leqq",8806],["\\eqslantless",10901],["\\lll",8920],["\\lessgtr",8822],["\\lesseqgtr",8922],["\\lesseqqgtr",10891],["\\risingdotseq",8787],["\\fallingdotseq",8786],["\\subseteqq",10949],["\\Subset",8912],["\\sqsubset",8847],["\\preccurlyeq",8828],["\\curlyeqprec",8926],["\\vDash",8872],["\\Vvdash",8874],["\\bumpeq",8783],["\\Bumpeq",8782],["\\geqq",8807],["\\eqslantgtr",10902],["\\ggg",8921],["\\gtrless",8823],["\\gtreqless",8923],["\\gtreqqless",10892],["\\supseteqq",10950],["\\Supset",8913],["\\sqsupset",8848],["\\succcurlyeq",8829],["\\curlyeqsucc",8927],["\\Vdash",8873],["\\shortmid",8739],["\\between",8812],["\\pitchfork",8916],["\\varpropto",8733],["\\backepsilon",8717],["\\llless",8920],["\\gggtr",8921],["\\doteqdot",8785],["\\Doteq",8785],["\\eqcirc",8790],["\\circeq",8791],["\\therefore",8756],["\\because",8757]],"mrel","ams"),lt([["+",43],["-",8722],["\u2212",8722],["\\pm",177],["\\mp",8723],["*",8727],["\\times",215],["\\div",247],["\\divides",8739],["\\cdot",8901],["\\cap",8745],["\\cup",8746],["\\setminus",8726],["\\land",8743],["\\wedge",8743],["\\lor",8744],["\\vee",8744],["\\circ",8728],["\\bigcirc",9711],["\\bullet",8729],["\\oplus",8853],["\\ominus",8854],["\\otimes",8855],["\\odot",8857],["\\oslash",8856],["\\bigtriangleup",9651],["\\bigtriangledown",9661],["\\triangleleft",9667],["\\triangleright",9657],["\\And",38],["\\dagger",8224],["\\dag",8224],["\\ddag",8225],["\\ddagger",8225],["\\ast",8727],["\\star",8902],["\\bigstar",9733],["\\diamond",8900]],"mbin"),lt([["\\lhd",8882],["\\rhd",8883],["\\lessdot",8918],["\\gtrdot",8919],["\\ltimes",8905],["\\rtimes",8906],["\\leftthreetimes",8907],["\\rightthreetimes",8908],["\\intercal",8890],["\\dotplus",8724],["\\doublebarwedge",10846],["\\divideontimes",8903],["\\centerdot",8901],["\\smallsetminus",8726],["\\barwedge",8892],["\\veebar",8891],["\\nor",8891],["\\curlywedge",8911],["\\curlyvee",8910],["\\boxminus",8863],["\\boxplus",8862],["\\boxtimes",8864],["\\boxdot",8865],["\\circleddash",8861],["\\circledast",8859],["\\circledcirc",8858],["\\unlhd",8884],["\\unrhd",8885]],"mbin","ams"),lt([["\\surd",8730],["\\infty",8734],["\\prime",8242],["\\doubleprime",8243],["\\angle",8736],["`",8216],["\\$",36],["\\%",37],["\\_",95],["\\alpha",945],["\\beta",946],["\\gamma",947],["\\delta",948],["\\epsilon",1013],["\\varepsilon",949],["\\zeta",950],["\\eta",951],["\\theta",952],["\\vartheta",977],["\\iota",953],["\\kappa",954],["\\varkappa",1008,"mord","ams"],["\\lambda",955],["\\mu",956],["\\nu",957],["\\xi",958],["\\omicron",111],["\\pi",960],["\\varpi",982],["\\rho",961],["\\varrho",1009],["\\sigma",963],["\\varsigma",962],["\\tau",964],["\\phi",981],["\\varphi",966],["\\upsilon",965],["\\chi",967],["\\psi",968],["\\omega",969],["\\Gamma",915],["\\Delta",916],["\\Theta",920],["\\Lambda",923],["\\Xi",926],["\\Pi",928],["\\Sigma",931],["\\Upsilon",933],["\\Phi",934],["\\Psi",936],["\\Omega",937],["\\digamma",989,"mord","ams"],["\\emptyset",8709]]),lt([["=",61],["<",60],["\\lt",60],[">",62],["\\gt",62],["\\le",8804],["\\leq",8804],["\\ge",8805],["\\geq",8805],["\\ll",8810],["\\gg",8811],["\\coloneq",8788],["\\coloneqq",8788],["\\colonequals",8788],["\\measeq",8797],["\\eqdef",8798],["\\questeq",8799],[":",58],["\\cong",8773],["\\equiv",8801],["\\prec",8826],["\\preceq",10927],["\\succ",8827],["\\succeq",10928],["\\perp",8869],["\\propto",8733],["\\Colon",8759],["\\smile",8995],["\\frown",8994],["\\sim",8764],["\\doteq",8784],["\\bowtie",8904],["\\Join",8904],["\\asymp",8781],["\\sqsubseteq",8849],["\\sqsupseteq",8850],["\\approx",8776],["\\~",126],["\\leftrightarrow",8596],["\\Leftrightarrow",8660],["\\models",8872],["\\vdash",8866],["\\dashv",8867],["\\roundimplies",10608],["\\in",8712],["\\notin",8713],["\\ni",8715],["\\owns",8715],["\\subset",8834],["\\supset",8835],["\\subseteq",8838],["\\supseteq",8839],["\\differencedelta",8710],["\\mvert",8739],["\\parallel",8741],["\\simeq",8771]],"mrel"),lt([["\\lnot",172],["\\neg",172],["\\triangle",9651],["\\subsetneq",8842],["\\varsubsetneq",57370],["\\subsetneqq",10955],["\\varsubsetneqq",57367],["\\nsubset",8836],["\\nsupset",8837],["\\nsubseteq",8840],["\\nsupseteq",8841]],"mrel","ams"),lt([["\\wp",8472],["\\aleph",8501]]),lt([["\\blacktriangle",9650],["\\hslash",8463],["\\Finv",8498],["\\Game",8513],["\\eth",240],["\\mho",8487],["\\Bbbk",107],["\\yen",165],["\\square",9633],["\\Box",9633],["\\blacksquare",9632],["\\circledS",9416],["\\circledR",174],["\\triangledown",9661],["\\blacktriangledown",9660],["\\checkmark",10003],["\\diagup",9585],["\\measuredangle",8737],["\\sphericalangle",8738],["\\backprime",8245],["\\backdoubleprime",8246],["\\Diamond",9674],["\\lozenge",9674],["\\blacklozenge",10731],["\\varnothing",8709],["\\complement",8705],["\\maltese",10016],["\\beth",8502],["\\daleth",8504],["\\gimel",8503]],"mord","ams"),lt([["\\ ",160],["~",160]],"space"),ke(["!",",",":",";",">","enskip","enspace","quad","qquad"],"",{createAtom:e=>new yo(e)}),ke("space","",{createAtom:e=>new yo(e)}),lt([["\\colon",58],["\\cdotp",8901],["\\vdots",8942,"mord"],["\\ldotp",46],[",",44],[";",59]],"mpunct"),lt([["\\cdots",8943],["\\ddots",8945],["\\ldots",8230],["\\mathellipsis",8230]],"minner"),lt([["\\/",47],["|",8739,"mord"],["\\imath",305],["\\jmath",567],["\\degree",176],["'",8242],['"',8221]]);var Tp="<mo>⁡</mo>",hd="<mo>⁢</mo>";function fd(e){return e.replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function $n(e,i){return!e||!i.generateID?"":` extid="${e}"`}function Rg(e,i,r){var a,c,p,m,b,w,E,I,N,Z,ue;let me=!1;i=i!=null?i:e.atoms.length;let Ge="",Lt="",Ue=e.atoms[e.index];const ct=(c=(a=Ue.style)==null?void 0:a.variant)!=null?c:"",Rt=(m=(p=Ue.style)==null?void 0:p.variantStyle)!=null?m:"";let yt="";if(ct||Rt){const hi=ze(Ue.value,(b=Ue.style)==null?void 0:b.variant,(w=Ue.style)==null?void 0:w.variantStyle);if(hi!==Ue.value)return e.index+=1,Ge=`<mi${$n(Ue.id,r)}>${hi}</mi>`,Eo(Ge,e,r)||(e.mathML+=Ge,e.lastType="mi"),!0;yt=(E={upnormal:"normal",boldnormal:"bold",italicmain:"italic",bolditalicmain:"bold-italic","updouble-struck":"double-struck","double-struck":"double-struck",boldfraktur:"bold-fraktur",calligraphic:"script",upcalligraphic:"script",script:"script",boldscript:"bold-script",boldcalligraphic:"bold-script",fraktur:"fraktur","upsans-serif":"sans-serif","boldsans-serif":"bold-sans-serif","italicsans-serif":"sans-serif-italic","bolditalicsans-serif":"sans-serif-bold-italic",monospace:"monospace"}[Rt+ct])!=null?E:"",yt=` mathvariant="${yt}"`}const Jt={"\\exponentialE":"ⅇ","\\imaginaryI":"ⅈ","\\differentialD":"ⅆ","\\capitalDifferentialD":"ⅅ","\\alpha":"α","\\pi":"π","\\infty":"∞","\\forall":"∀","\\nexists":"∄","\\exists":"∃","\\hbar":"\u210F","\\cdotp":"\u22C5","\\ldots":"\u2026","\\cdots":"\u22EF","\\ddots":"\u22F1","\\vdots":"\u22EE","\\ldotp":"."};if(Ue.command==="!")return e.index+=1,Ge="<mo>!</mo>",Eo(Ge,e,r)||(e.mathML+=Ge,e.lastType="mo"),!0;if(Jt[Ue.command]){e.index+=1;let hi=`<mi${$n(Ue.id,r)}${yt}>${Jt[Ue.command]}</mi>`;return(e.lastType==="mi"||e.lastType==="mn"||e.lastType==="mtext"||e.lastType==="fence")&&(hi=hd+hi),Eo(hi,e,r)||(e.mathML+=hi,e.lastType="mi"),!0}if(Ue.command==="\\operatorname")Lt=oc(Ue.body),e.index+=1;else if(ct||Rt)for(;e.index<i&&(Ue.type==="mord"||Ue.type==="macro")&&!Ue.isDigit()&&ct===((N=(I=Ue.style)==null?void 0:I.variant)!=null?N:"")&&Rt===((ue=(Z=Ue.style)==null?void 0:Z.variantStyle)!=null?ue:"");)Lt+=oc([Ue]),e.index+=1,Ue=e.atoms[e.index];else(Ue.type==="mord"||Ue.type==="macro")&&!Ue.isDigit()&&(Lt+=oc([Ue]),e.index+=1);if(Lt.length>0){me=!0,Ge=`<mi${yt}>${Lt}</mi>`;const hi=e.lastType;Ge.endsWith(">f</mi>")||Ge.endsWith(">g</mi>")?(Ge+=Tp,e.lastType="applyfunction"):e.lastType=/^<mo>(.*)<\/mo>$/.test(Ge)?"mo":"mi",Eo(Ge,e,r)||((hi==="mi"||hi==="mn"||hi==="mtext"||hi==="fence")&&(Ge=hd+Ge),e.mathML+=Ge)}return me}function Pg(e){return e.index<e.atoms.length&&e.atoms[e.index].superscript&&e.atoms[e.index].type==="subsup"}function Og(e){let i=-1,r=e.index,a=!1,c=!1;for(;r<e.atoms.length&&!a&&!c;){const p=e.atoms[r];a=!p.isDigit(),c=!a&&p.superscript!==void 0,r++}return c&&(i=r-1),i}function Eo(e,i,r){var a;let c=i.atoms[i.index-1];if(!c)return!1;if(!c.superscript&&!c.subscript)if(((a=i.atoms[i.index])==null?void 0:a.type)==="subsup")c=i.atoms[i.index],i.index+=1;else return!1;const p=i.lastType;i.lastType="";const m=En(c.superscript,r);i.lastType="";const b=En(c.subscript,r);if(i.lastType=p,!m&&!b)return!1;let w="";return m&&b?w=`<msubsup>${e}${b}${m}</msubsup>`:m?w=`<msup>${e}${m}</msup>`:b&&(w=`<msub>${e}${b}</msub>`),i.mathML+=w,i.lastType="",!0}function Fg(e,i,r){i=i!=null?i:e.atoms.length;const a=e.index;let c="";for(;e.index<i&&e.atoms[e.index].mode==="text";)c+=e.atoms[e.index].value?e.atoms[e.index].value:" ",e.index+=1;return c.length>0?(e.mathML+=`<mtext ${$n(e.atoms[a].id,r)}>${c}</mtext>`,e.lastType="mtext",!0):!1}function Bg(e,i,r){i=i!=null?i:e.atoms.length;const a=e.index;let c="",p=Og(e);for(p>=0&&p<i&&(i=p);e.index<i&&e.atoms[e.index].isDigit();)c+=e.atoms[e.index].asDigit(),e.index+=1;return c.length<=0?!1:(c="<mn"+$n(e.atoms[a].id,r)+">"+c+"</mn>",p<0&&Pg(e)&&(p=e.index,e.index+=1),Eo(c,e,r)||(e.mathML+=c,e.lastType="mn"),!0)}function Ng(e,i,r){let a=!1;i=i!=null?i:e.atoms.length;let c="",p="";if(e.index<i&&e.atoms[e.index].type==="mopen"){let m=!1,b=0;const w=e.index;let E=-1,I=w+1;for(;I<i&&!m;)e.atoms[I].type==="mopen"?b+=1:e.atoms[I].type==="mclose"&&(b-=1),b===-1&&(m=!0,E=I),I+=1;m&&(c="<mrow>",c+=tu(e.atoms[w],r),c+=En(e.atoms,r,w+1,E),c+=tu(e.atoms[E],r),c+="</mrow>",e.index=E+1,(e.lastType==="mi"||e.lastType==="mn"||e.lastType==="mfrac"||e.lastType==="fence")&&(e.mathML+=hd),Eo(c,e,r)&&(a=!0,e.lastType="",c=""),p="fence")}return c.length>0&&(a=!0,e.mathML+=c,e.lastType=p),a}function $g(e,i,r){let a=!1;i=i!=null?i:e.atoms.length;let c="",p="";const m=e.atoms[e.index];if(!m)return!1;const b={"\\ne":"≠","\\neq":"&neq;","\\pm":"±","\\times":"×","\\colon":":","\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lbrack":"[","\\rbrack":"]","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"};if(b[m.command]){e.index+=1;const w=`<mo${$n(m.id,r)}>${b[m.command]}</mo>`;return Eo(w,e,r)||(e.mathML+=w,e.lastType="mo"),!0}if(e.index<i&&(m.type==="mbin"||m.type==="mrel"))c+=I0(e.atoms[e.index],r),e.index+=1,p="mo";else if(e.index<i&&(m.type==="mop"||m.type==="operator"||m.type==="extensible-symbol")){if(m.subsupPlacement==="over-under"&&(m.superscript||m.subscript)){const w=tu(m,r);return m.superscript&&m.subscript?(c+="<munderover>"+w,c+=En(m.subscript,r),c+=En(m.superscript,r),c+="</munderover>"):m.superscript?(c+="<mover>"+w,c+=En(m.superscript,r),c+="</mover>"):m.subscript&&(c+="<munder>"+w,c+=En(m.subscript,r),c+="</munder>"),e.mathML+=c,e.lastType="mo",e.index+=1,!0}{const w=e.atoms[e.index],E=w.value==="\\operatorname",I=E?'<mi class="MathML-Unit"'+$n(w.id,r)+">"+oc(w.value)+"</mi>":tu(w,r);c+=I,!E&&!/^<mo>(.*)<\/mo>$/.test(I)?(c+=Tp,p="applyfunction"):p=E?"mi":"mo"}(e.lastType==="mi"||e.lastType==="mn")&&!/^<mo>(.*)<\/mo>$/.test(c)&&(c=hd+c),e.index+=1}return c.length>0&&(a=!0,Eo(c,e,r)||(e.mathML+=c,e.lastType=p)),a}function En(e,i,r,a){i!=null||(i={});const c={atoms:[],index:r!=null?r:0,mathML:"",lastType:""};if(typeof e=="number"||typeof e=="boolean")c.mathML=e.toString();else if(typeof e=="string")c.mathML=e;else if(e instanceof Qe)c.mathML=I0(e,i);else if(Array.isArray(e)){c.atoms=e;let p=0;for(a=a||(e?e.length:0);c.index<a;)if(Fg(c,a,i)||Bg(c,a,i)||Rg(c,a,i)||$g(c,a,i)||Ng(c,a,i))p+=1;else if(c.index<a){let m=I0(c.atoms[c.index],i);c.lastType==="mn"&&m.length>0&&c.atoms[c.index].type==="genfrac"&&(m="<mo>⁤</mo>"+m),c.atoms[c.index].type==="genfrac"?c.lastType="mfrac":c.lastType="",c.index+=1,Eo(m,c,i)?p+=1:m.length>0&&(c.mathML+=m,p+=1)}p>1&&(c.mathML="<mrow>"+c.mathML+"</mrow>")}return c.mathML}function tu(e,i){let r="";const a=oc(e.value);return a&&(r="<mo"+$n(e.id,i)+">"+a+"</mo>"),r}function oc(e){if(!e)return"";if(typeof e=="string")return fd(e);if(!Array.isArray(e)&&typeof e.body=="string")return fd(e.body);let i="";for(const r of e)typeof r.value=="string"&&(i+=r.value);return fd(i)}function I0(e,i){var r,a,c,p,m,b,w,E,I,N,Z,ue,me,Ge,Lt,Ue,ct,Rt,yt,Jt,hi,ri;if(e.mode==="text")return`<mi${$n(e.id,i)}>${e.value}</mi>`;const cn={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",longleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",longrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overgroup:"\u23E0",undergroup:"\u23E1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21D2",xRightarrow:"\u21D2",overleftharpoon:"\u21BC",xleftharpoonup:"\u21BC",overrightharpoon:"\u21C0",xrightharpoonup:"\u21C0",xLeftarrow:"\u21D0",xLeftrightarrow:"\u21D4",xhookleftarrow:"\u21A9",xhookrightarrow:"\u21AA",xmapsto:"\u21A6",xrightharpoondown:"\u21C1",xleftharpoondown:"\u21BD",xrightleftharpoons:"\u21CC",longrightleftharpoons:"\u21CC",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xleftrightarrows:"\u21C4",xRightleftharpoons:"\u21CC",longRightleftharpoons:"\u21CC",xLeftrightharpoons:"\u21CB",longLeftrightharpoons:"\u21CB"},Bn={"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\>":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5};let $t="",zs="",Ga,ra,$r,Vs,Ts,Kn;const{command:yr}=e;if(e.command==="\\error")return`<merror${$n(e.id,i)}>${En(e.body,i)}</merror>`;const Kr={"\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\lbrack":"[","\\rbrack":"]","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"},Ha={"\\vec":"⃗","\\acute":"´","\\grave":"`","\\dot":"˙","\\ddot":"¨","\\tilde":"~","\\bar":"¯","\\breve":"˘","\\check":"ˇ","\\hat":"^"};switch(e.type){case"first":break;case"group":case"root":$t=En(e.body,i);break;case"array":if((e.leftDelim&&e.leftDelim!=="."||e.rightDelim&&e.rightDelim!==".")&&($t+="<mrow>",e.leftDelim&&e.leftDelim!=="."&&($t+="<mo>"+(Kr[e.leftDelim]||e.leftDelim)+"</mo>")),$t+="<mtable",e.colFormat){for($t+=' columnalign="',$r=0;$r<e.colFormat.length;$r++)e.colFormat[$r].align&&($t+={l:"left",c:"center",r:"right"}[e.colFormat[$r].align]+" ");$t+='"'}for($t+=">",ra=0;ra<e.array.length;ra++){for($t+="<mtr>",Ga=0;Ga<e.array[ra].length;Ga++)$t+="<mtd>"+En(e.array[ra][Ga],i)+"</mtd>";$t+="</mtr>"}$t+="</mtable>",(e.leftDelim&&e.leftDelim!=="."||e.rightDelim&&e.rightDelim!==".")&&(e.rightDelim&&e.rightDelim!=="."&&($t+="<mo>"+(Kr[e.leftDelim]||e.rightDelim)+"</mo>"),$t+="</mrow>");break;case"genfrac":(e.leftDelim||e.rightDelim)&&($t+="<mrow>"),e.leftDelim&&e.leftDelim!=="."&&($t+="<mo"+$n(e.id,i)+">"+(Kr[e.leftDelim]||e.leftDelim)+"</mo>"),e.hasBarLine?($t+="<mfrac>",$t+=En(e.above,i)||"<mi> </mi>",$t+=En(e.below,i)||"<mi> </mi>",$t+="</mfrac>"):($t+="<mtable"+$n(e.id,i)+">",$t+="<mtr>"+En(e.above,i)+"</mtr>",$t+="<mtr>"+En(e.below,i)+"</mtr>",$t+="</mtable>"),e.rightDelim&&e.rightDelim!=="."&&($t+="<mo"+$n(e.id,i)+">"+(Kr[e.rightDelim]||e.rightDelim)+"</mo>"),(e.leftDelim||e.rightDelim)&&($t+="</mrow>");break;case"surd":e.hasEmptyBranch("above")?($t+="<msqrt"+$n(e.id,i)+">",$t+=En(e.body,i),$t+="</msqrt>"):($t+="<mroot"+$n(e.id,i)+">",$t+=En(e.body,i),$t+=En(e.above,i),$t+="</mroot>");break;case"leftright":const Wa=e,ja=Wa.leftDelim;$t="<mrow>",ja&&ja!=="."&&($t+=`<mo${$n(e.id,i)}>${(r=Kr[ja])!=null?r:ja}</mo>`),e.body&&($t+=En(e.body,i));const qa=Wa.matchingRightDelim();qa&&qa!=="."&&($t+=`<mo${$n(e.id,i)}>${(a=Kr[qa])!=null?a:qa}</mo>`),$t+="</mrow>";break;case"sizeddelim":case"delim":$t+=`<mo${$n(e.id,i)}>${Kr[e.value]||e.value}</mo>`;break;case"accent":$t+='<mover accent="true"'+$n(e.id,i)+">",$t+=En(e.body,i),$t+="<mo>"+(Ha[yr]||e.accent)+"</mo>",$t+="</mover>";break;case"line":case"overlap":break;case"overunder":Ts=e.above,Vs=e.below,(e.svgAbove||Ts)&&(e.svgBelow||Vs)?Kn=e.body:Ts&&Ts.length>0?(Kn=e.body,(p=(c=e.body)==null?void 0:c[0])!=null&&p.below?(Vs=e.body[0].below,Kn=e.body[0].body):((b=(m=e.body)==null?void 0:m[0])==null?void 0:b.type)==="first"&&((E=(w=e.body)==null?void 0:w[1])!=null&&E.below)&&(Vs=e.body[1].below,Kn=e.body[1].body)):Vs&&Vs.length>0&&(Kn=e.body,(N=(I=e.body)==null?void 0:I[0])!=null&&N.above?(Ts=e.body[0].above,Kn=e.body[0].body):((ue=(Z=e.body)==null?void 0:Z[0])==null?void 0:ue.type)==="first"&&((Ge=(me=e.body)==null?void 0:me[1])!=null&&Ge.above)&&(Ts=e.body[1].overscript,Kn=e.body[1].body)),(e.svgAbove||Ts)&&(e.svgBelow||Vs)?($t+=`<munderover ${$n(e.id,i)}>`,$t+=(Lt=cn[e.svgBody])!=null?Lt:En(Kn,i),$t+=(Ue=cn[e.svgBelow])!=null?Ue:En(Vs,i),$t+=(ct=cn[e.svgAbove])!=null?ct:En(Ts,i),$t+="</munderover>"):e.svgAbove||Ts?($t+=`<mover ${$n(e.id,i)}>`+((Rt=cn[e.svgBody])!=null?Rt:En(Kn,i)),$t+=(yt=cn[e.svgAbove])!=null?yt:En(Ts,i),$t+="</mover>"):(e.svgBelow||Vs)&&($t+=`<munder ${$n(e.id,i)}>`+((Jt=cn[e.svgBody])!=null?Jt:En(Kn,i)),$t+=(hi=cn[e.svgBelow])!=null?hi:En(Vs,i),$t+="</munder>");break;case"placeholder":$t+="?";break;case"mord":{$t=typeof e.value=="string"?e.value:yr,yr==="\\char"?$t="&#x"+("000000"+e.args[0].number.toString(16)).slice(-4)+";":$t.length>0&&$t.startsWith("\\")&&(typeof e.value=="string"&&e.value.charCodeAt(0)>255?$t="&#x"+("000000"+e.value.charCodeAt(0).toString(16)).slice(-4)+";":typeof e.value=="string"?$t=e.value.charAt(0):(console.error("Did not expect this"),$t=""));const xa=/\d/.test($t)?"mn":"mi";$t=`<${xa}${$n(e.id,i)}>${fd($t)}</${xa}>`;break}case"mbin":case"mrel":case"minner":$t=tu(e,i);break;case"mpunct":$t='<mo separator="true"'+$n(e.id,i)+">"+yr+"</mo>";break;case"mop":case"operator":case"extensible-symbol":e.body!=="\u200B"&&($t="<mo"+$n(e.id,i)+">",$t+=yr==="\\operatorname"?e.body:yr||e.body,$t+="</mo>");break;case"box":$t='<menclose notation="box"',e.backgroundcolor&&($t+=' mathbackground="'+e.backgroundcolor+'"'),$t+=$n(e.id,i)+">"+En(e.body,i)+"</menclose>";break;case"spacing":$t+='<mspace width="'+((ri=Bn[yr])!=null?ri:0)+'em"/>';break;case"enclose":$t='<menclose notation="';for(const xa in e.notation)Object.prototype.hasOwnProperty.call(e.notation,xa)&&e.notation[xa]&&($t+=zs+xa,zs=" ");$t+=$n(e.id,i)+'">'+En(e.body,i)+"</menclose>";break;case"prompt":$t='<menclose notation="roundexbox""">'+En(e.body,i)+"</menclose>";break;case"space":$t+=" ";break;case"subsup":break;case"phantom":break;case"composition":break;case"rule":break;case"chem":break;case"mopen":$t+=tu(e,i);break;case"mclose":$t+=tu(e,i);break;case"macro":{const xa=e.command+oc(e.macroArgs);xa&&($t+=`<mo ${$n(e.id,i)}>${xa}</mo>`)}break;case"latexgroup":$t+=En(e.body,i);break;case"latex":$t+="<mtext"+$n(e.id,i)+">"+e.value+"</mtext>";break;case"tooltip":$t+=En(e.body,i);break;case"text":$t+=`<mtext ${$n(e.id,i)}x>${e.value}</mtext>`;break;default:if(e.command==="\\displaystyle")return`<mrow ${$n(e.id,i)} displaystyle="true">${En(e.body,i)}</mrow>`;if(e.command==="\\textstyle")return`<mrow ${$n(e.id,i)} displaystyle="false">${En(e.body,i)}</mrow>`;console.info("Unexpected element in conversion to MathML:",e)}return $t}var lc={"\\alpha":"alpha ","\\mu":"mew ","\\sigma":"sigma ","\\pi":"pie ","\\imaginaryI":"imaginary eye ","\\imaginaryJ":"imaginary jay ","\\sum":"Summation ","\\prod":"Product ","+":"plus ","-":"minus ",";":'<break time="150ms"/> semi-colon <break time="150ms"/>',",":'<break time="150ms"/> comma <break time="150ms"/>',"|":'<break time="150ms"/>Vertical bar<break time="150ms"/>',"(":'<break time="150ms"/>Open paren. <break time="150ms"/>',")":'<break time="150ms"/> Close paren. <break time="150ms"/>',"=":"equals ","<":"is less than ","\\lt":"is less than ","<=":"is less than or equal to ","\\le":"is less than or equal to ","\\gt":"is greater than ",">":"is greater than ","\\pm":"plus or minus","\\mp":"minus or plus","\\ge":"is greater than or equal to ","\\geq":"is greater than or equal to ","\\leq":"is less than or equal to ","\\ne":"is not equal to ","\\neq":"is not equal to ","!":"factorial ","\\sin":"sine ","\\cos":"cosine ","\u200B":"","\u2212":"minus ",":":'<break time="150ms"/> such that <break time="200ms"/> ',"\\colon":'<break time="150ms"/> such that <break time="200ms"/> ',"\\hbar":"etch bar ","\\iff":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\Longleftrightarrow":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\land":"and ","\\lor":"or ","\\neg":"not ","\\div":"divided by ","\\forall":"for all ","\\exists":"there exists ","\\nexists":"there does not exists ","\\in":"element of ","\\N":'the set <break time="150ms"/><say-as interpret-as="character">n</say-as>',"\\C":'the set <break time="150ms"/><say-as interpret-as="character">c</say-as>',"\\Z":'the set <break time="150ms"/><say-as interpret-as="character">z</say-as>',"\\Q":'the set <break time="150ms"/><say-as interpret-as="character">q</say-as>',"\\infty":"infinity ","\\nabla":"nabla ","\\partial":"partial derivative of ","\\cdot":"times ","\\cdots":"dot dot dot ","\\Rightarrow":"implies ","\\lparen":'<break time="150ms"/>open paren<break time="150ms"/>',"\\rparen":'<break time="150ms"/>close paren<break time="150ms"/>',"\\lbrace":'<break time="150ms"/>open brace<break time="150ms"/>',"\\{":'<break time="150ms"/>open brace<break time="150ms"/>',"\\rbrace":'<break time="150ms"/>close brace<break time="150ms"/>',"\\}":'<break time="150ms"/>close brace<break time="150ms"/>',"\\langle":'<break time="150ms"/>left angle bracket<break time="150ms"/>',"\\rangle":'<break time="150ms"/>right angle bracket<break time="150ms"/>',"\\lfloor":'<break time="150ms"/>open floor<break time="150ms"/>',"\\rfloor":'<break time="150ms"/>close floor<break time="150ms"/>',"\\lceil":'<break time="150ms"/>open ceiling<break time="150ms"/>',"\\rceil":'<break time="150ms"/>close ceiling<break time="150ms"/>',"\\vert":'<break time="150ms"/>vertical bar<break time="150ms"/>',"\\mvert":'<break time="150ms"/>divides<break time="150ms"/>',"\\lvert":'<break time="150ms"/>left vertical bar<break time="150ms"/>',"\\rvert":'<break time="150ms"/>right vertical bar<break time="150ms"/>',"\\lbrack":'<break time="150ms"/> open square bracket <break time="150ms"/>',"\\rbrack":'<break time="150ms"/> close square bracket <break time="150ms"/>',mm:"millimeters",cm:"centimeters",km:"kilometers",kg:"kilograms"},R0={array:"array",matrix:"matrix",pmatrix:"parenthesis matrix",bmatrix:"square brackets matrix",Bmatrix:"braces matrix",vmatrix:"bars matrix",Vmatrix:"double bars matrix","matrix*":"matrix",smallmatrix:"small matrix"};function Kg(e){let i="";return e.startsWith("\\")&&(i=" "+e.replace("\\","")+" "),i}function yh(e){let i=0;if(k(e))for(const r of e)r.type!=="first"&&(i+=1);return i===1}function Ug(e){if(k(e)){for(const i of e)if(i.type!=="first"&&i.id)return i.id.toString()}return""}function Ap(e){let i="";if(k(e))for(const r of e)r.type!=="first"&&typeof r.value=="string"&&(i+=r.value);return i}function zg(e){return e?e.map(i=>i.value).join(""):""}function en(e,i){var r,a,c,p,m;function b(I){return window.MathfieldElement.textToSpeechMarkup?/[a-z]/.test(I)?` <say-as interpret-as="character">${I}</say-as>`:/[A-Z]/.test(I)?`capital <say-as interpret-as="character">${I.toLowerCase()}</say-as>`:I:/[a-z]/.test(I)?" '"+I.toUpperCase()+"'":/[A-Z]/.test(I)?" 'capital "+I.toUpperCase()+"'":I}function w(I){return"<emphasis>"+I+"</emphasis>"}if(!i)return"";let E="";if(k(i)){let I=!1,N=!1;for(let Z=0;Z<i.length;Z++)i[Z].type!=="first"&&(i[Z].mode!=="text"&&(N=!1),Z<i.length-2&&i[Z].type==="mopen"&&i[Z+2].type==="mclose"&&i[Z+1].type==="mord"?(E+=" of ",E+=w(en(e,i[Z+1])),Z+=2):i[Z].mode==="text"?N?E+=(r=i[Z].value)!=null?r:" ":(N=!0,E+=en("text",i[Z])):i[Z].isDigit()?I?E+=i[Z].asDigit():(I=!0,E+=en(e,i[Z])):(I=!1,E+=en(e,i[Z])))}else if(i.mode==="text")i.id&&e==="math"&&(E+='<mark name="'+i.id.toString()+'"/>'),E+=i.value;else{i.id&&e==="math"&&(E+='<mark name="'+i.id.toString()+'"/>');let I="",N="",Z="",ue=!1;const{command:me}=i;switch(me){case"\\vec":return"vector "+en(e,i.body);case"\\acute":return en(e,i.body)+" acute";case"\\grave":return en(e,i.body)+" grave";case"\\dot":return"dot over"+en(e,i.body);case"\\ddot":return"double dot over"+en(e,i.body);case"\\mathring":return"ring over"+en(e,i.body);case"\\tilde":case"\\widetilde":return"tilde over"+en(e,i.body);case"\\bar":return en(e,i.body)+" bar";case"\\breve":return en(e,i.body)+" breve";case"\\check":case"\\widecheck":return"check over "+en(e,i.body);case"\\hat":case"\\widehat":return"hat over"+en(e,i.body);case"\\overarc":case"\\overparen":case"\\wideparen":return"arc over "+en(e,i.body);case"\\underarc":case"\\underparen":return"arc under "+en(e,i.body)}switch(i.type){case"prompt":const Ge=i.body.length>1?'start input . <break time="500ms"/> '+en(e,i.body)+'. <break time="500ms"/> end input':"blank";E+=' <break time="300ms"/> '+Ge+'. <break time="700ms"/>'+((a=i.correctness)!=null?a:"")+' . <break time="700ms"/> ';break;case"array":const Lt=i.array,Ue=i.environmentName;if(Object.keys(R0).includes(Ue)){E+=` begin ${R0[Ue]} `;for(let yt=0;yt<Lt.length;yt++){yt>0&&(E+=","),E+=` row ${yt+1} `;for(let Jt=0;Jt<Lt[yt].length;Jt++)Jt>0&&(E+=","),E+=` column ${Jt+1}: `,E+=en("math",Lt[yt][Jt])}E+=` end ${R0[Ue]} `}break;case"group":me==="\\ne"?E+=" not equal ":(me==="\\not"&&(E+=" not "),E+=en("math",i.body));break;case"root":E+=en("math",i.body);break;case"genfrac":if(I=en("math",i.above),N=en("math",i.below),yh(i.above)&&yh(i.below)){const Jt={"1/2":" half ","1/3":" one third ","2/3":" two third","1/4":" one quarter ","3/4":" three quarter ","1/5":" one fifth ","2/5":" two fifths ","3/5":" three fifths ","4/5":" four fifths ","1/6":" one sixth ","5/6":" five sixths ","1/8":" one eight ","3/8":" three eights ","5/8":" five eights ","7/8":" seven eights ","1/9":" one ninth ","2/9":" two ninths ","4/9":" four ninths ","5/9":" five ninths ","7/9":" seven ninths ","8/9":" eight ninths "}[Ap(i.above)+"/"+Ap(i.below)];Jt?E=Jt:E+=I+" over "+N}else E+=' the fraction <break time="150ms"/>'+I+' over <break time="150ms"/>'+N+'.<break time="150ms"/> End fraction.<break time="150ms"/>';break;case"surd":if(Z=en("math",i.body),i.hasEmptyBranch("above"))E+=yh(i.body)?" the square root of "+Z+" , ":' the square root of <break time="200ms"/>'+Z+'. <break time="200ms"/> End square root';else{let yt=en("math",i.above);yt=yt.trim();const Jt=yt.replace(/<mark([^/]*)\/>/g,"");Jt==="3"?E+=' the cube root of <break time="200ms"/>'+Z+'. <break time="200ms"/> End cube root':Jt==="n"?E+=' the nth root of <break time="200ms"/>'+Z+'. <break time="200ms"/> End root':E+=' the root with index: <break time="200ms"/>'+yt+', of <break time="200ms"/>'+Z+'. <break time="200ms"/> End root'}break;case"leftright":{const yt=i;E+=(c=yt.leftDelim?lc[yt.leftDelim]:void 0)!=null?c:yt.leftDelim,E+=en("math",i.body),E+=(p=yt.rightDelim?lc[yt.rightDelim]:void 0)!=null?p:yt.rightDelim}break;case"rule":break;case"overunder":break;case"overlap":break;case"macro":const ct=me.replace(/^\\/g,""),Rt=Gt()[ct];Rt&&(Rt!=null&&Rt.expand?E+=en("math",i.body):E+=`${ct} `);break;case"placeholder":E+="placeholder ";break;case"delim":case"sizeddelim":case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":{if(me==="\\mathbin"||me==="\\mathrel"||me==="\\mathopen"||me==="\\mathclose"||me==="\\mathpunct"||me==="\\mathord"||me==="\\mathinner"){E=en(e,i.body);break}let yt=i.isDigit()?i.asDigit():i.value,Jt=i.command;if((i.type==="delim"||i.type==="sizeddelim")&&(Jt=i.value,yt=Jt),e==="text")E+=yt;else{if(i.type==="mbin"&&(E+='<break time="150ms"/>'),yt){const hi=lc[yt]||(Jt?lc[Jt.trim()]:"");if(hi)E+=" "+hi;else{const ri=Jt?Kg(Jt.trim()):"";E+=ri||b(yt)}}else E+=en("math",i.body);i.type==="mbin"&&(E+='<break time="150ms"/>')}break}case"mop":case"operator":case"extensible-symbol":if(i.value!=="\u200B"){const yt=i.command;if(yt==="\\sum")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let Jt=en("math",i.superscript);Jt=Jt.trim();let hi=en("math",i.subscript);hi=hi.trim(),E+=' the summation from <break time="200ms"/>'+hi+'<break time="200ms"/> to <break time="200ms"/>'+Jt+'<break time="200ms"/> of <break time="150ms"/>',ue=!0}else if(i.hasEmptyBranch("subscript"))E+=" the summation of";else{let Jt=en("math",i.subscript);Jt=Jt.trim(),E+=' the summation from <break time="200ms"/>'+Jt+'<break time="200ms"/> of <break time="150ms"/>',ue=!0}else if(yt==="\\prod")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let Jt=en("math",i.superscript);Jt=Jt.trim();let hi=en("math",i.subscript);hi=hi.trim(),E+=' the product from <break time="200ms"/>'+hi+'<break time="200ms"/> to <break time="200ms"/>'+Jt+'<break time="200ms"/> of <break time="150ms"/>',ue=!0}else if(i.hasEmptyBranch("subscript"))E+=" the product of ";else{let Jt=en("math",i.subscript);Jt=Jt.trim(),E+=' the product from <break time="200ms"/>'+Jt+'<break time="200ms"/> of <break time="150ms"/>',ue=!0}else if(yt==="\\int")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let Jt=en("math",i.superscript);Jt=Jt.trim();let hi=en("math",i.subscript);hi=hi.trim(),E+=' the integral from <break time="200ms"/>'+w(hi)+'<break time="200ms"/> to <break time="200ms"/>'+w(Jt)+' <break time="200ms"/> of ',ue=!0}else E+=' the integral of <break time="200ms"/> ';else if(typeof i.value=="string"){const Jt=(m=lc[i.value])!=null?m:i.command?lc[i.command]:void 0;E+=Jt||" "+i.value}else i.command&&(i.command==="\\mathop"?E+=en("math",i.body):i.command==="\\operatorname"?E+=zg(i.body):E+=i.command.startsWith("\\")?" "+i.command.slice(1):" "+i.command)}break;case"enclose":Z=en("math",i.body),E+=" crossed out "+Z+". End crossed out.";break;case"space":case"spacing":break}if(!ue&&!i.hasEmptyBranch("superscript")){let Ge=en(e,i.superscript);Ge=Ge.trim();const Lt=Ge.replace(/<[^>]*>/g,"");if(yh(i.superscript)){if(e==="math"){const Ue=Ug(i.superscript);Ue&&(E+='<mark name="'+Ue+'"/>')}Lt==="\u2032"?E+=" prime ":Lt==="2"?E+=" squared ":Lt==="3"?E+=" cubed ":Number.isNaN(Number.parseInt(Lt))?E+=" to the "+Ge+"; ":E+=' to the <say-as interpret-as="ordinal">'+Lt+"</say-as> power; "}else Number.isNaN(Number.parseInt(Lt))?E+=" raised to the "+Ge+"; ":E+=' raised to the <say-as interpret-as="ordinal">'+Lt+"</say-as> power; "}if(!ue&&!i.hasEmptyBranch("subscript")){let Ge=en("math",i.subscript);Ge=Ge.trim(),E+=yh(i.subscript)?" sub "+Ge:" subscript "+Ge+". End subscript. "}}return E}function uc(e){var i,r;if(window.MathfieldElement.textToSpeechRules==="sre"&&("sre"in window||"SRE"in window)){const c=En(e);if(c){window.MathfieldElement.textToSpeechMarkup&&(window.MathfieldElement.textToSpeechRulesOptions=(i=window.MathfieldElement.textToSpeechRulesOptions)!=null?i:{},window.MathfieldElement.textToSpeechRulesOptions=f(P({},window.MathfieldElement.textToSpeechRulesOptions),{markup:window.MathfieldElement.textToSpeechMarkup}),window.MathfieldElement.textToSpeechRulesOptions.markup==="ssml"&&(window.MathfieldElement.textToSpeechRulesOptions=f(P({},window.MathfieldElement.textToSpeechRulesOptions),{markup:"ssml_step"})),window.MathfieldElement.textToSpeechRulesOptions=f(P({},window.MathfieldElement.textToSpeechRulesOptions),{rate:window.MathfieldElement.speechEngineRate}));const p=(r=window.SRE)!=null?r:window.sre.System.getInstance();window.MathfieldElement.textToSpeechRulesOptions&&p.setupEngine(window.MathfieldElement.textToSpeechRulesOptions);let m="";try{m=p.toSpeech(c)}catch(b){console.error("MathLive 0.98.5: `SRE.toSpeech()` runtime error",b)}return m}return""}let a=en("math",e);if(window.MathfieldElement.textToSpeechMarkup==="ssml"){let c="";window.MathfieldElement.speechEngineRate&&(c='<prosody rate="'+window.MathfieldElement.speechEngineRate+'">'),a='<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><amazon:auto-breaths>'+c+"<p><s>"+a+"</s></p>"+(c?"</prosody>":"")+"</amazon:auto-breaths></speak>"}else window.MathfieldElement.textToSpeechMarkup==="mac"&&H()==="macos"?a=a.replace(/<mark([^/]*)\/>/g,"").replace(/<emphasis>/g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(/<break time="(\d*)ms"\/>/g,"[[slc $1]]").replace(/<say-as[^>]*>/g,"").replace(/<\/say-as>/g,""):a=a.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return a}var bh={"\\ne":"\u2260","\\neq":"\u2260","\u2212":"-","-":"-","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\delta":"delta","\\epsilon":"epsilon","\\varepsilon":"varepsilon","\\zeta":"zeta","\\eta":"eta","\\theta":"theta","\\vartheta":"vartheta","\\iota":"iota","\\kappa":"kappa","\\lambda":"lambda","\\mu":"mu","\\nu":"nu","\\xi":"xi","\\pi":"pi","\\rho":"rho","\\sigma":"sigma","\\tau":"tau","\\upsilon":"upsilon","\\phi":"phi","\\varphi":"varphi","\\chi":"chi","\\psi":"psi","\\omega":"omega","\\Gamma":"Gamma","\\Delta":"Delta","\\Theta":"Theta","\\Lambda":"Lambda","\\Xi":"Xi","\\Pi":"Pi","\\Sigma":"Sigma","\\Phi":"Phi","\\Psi":"Psi","\\Omega":"Omega","\\exponentialE":"e","\\imaginaryI":"i","\\imaginaryJ":"j","\\!":" ","\\,":" ","\\:":" ","\\>":" ","\\;":" ","\\enskip":" ","\\enspace":" ","\\qquad":" ","\\quad":" ","\\infty":"oo"},xh={"\\pm":"+-","\\colon":":","\\vert":"|","\\Vert":"||","\\mid":"|","\\lbrack":"[","\\rbrack":"]","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"(:","\\rangle":":)","\\sum":" sum ","\\prod":" prod ","\\bigcap":" nnn ","\\bigcup":" uuu ","\\int":" int ","\\oint":" oint ","\\ge":">=","\\le":"<=","\\ne":"!=","\\neq":"!=","\\lt":"<","\\gt":">","\\gets":"<-","\\to":"->","\\land":" and ","\\lor":" or ","\\lnot":" not ","\\forall":" AA ","\\exists":" EE ","\\in":" in ","\\notin":" !in ","\\mapsto":"|->","\\implies":"=>","\\iff":"<=>","\\cdot":"*","\\ast":"**","\\star":"***","\\times":"xx","\\div":"-:","\\ltimes":"|><","\\rtimes":"><|","\\bowtie":"|><|","\\circ":"@"};function Vg(e){let i="";for(const r of e){const a=i[i.length-1];a!==void 0&&/\d/.test(a)&&/^\d/.test(r)&&(i+=" "),i+=r}return i}function vr(e){var i,r,a,c,p,m,b,w,E,I,N,Z,ue;if(!e)return"";if(k(e)){if(e.length===0)return"";if(e[0].mode==="latex")return e.map(vr).join("");if(e[0].mode==="text"){let Rt=0,yt="";for(;((i=e[Rt])==null?void 0:i.mode)==="text";)yt+=e[Rt].body?vr(e[Rt].body):e[Rt].value,Rt++;return`"${yt}" ${vr(e.slice(Rt))}`}let Ue=0;const ct=[];for(;e[Ue]&&e[Ue].mode==="math";){let Rt="";for(;e[Ue]&&e[Ue].type==="mord"&&/\d/.test(e[Ue].value);)Rt+=e[Ue++].value;Rt?ct.push(Rt):ct.push(vr(e[Ue++]))}return ct.push(vr(e.slice(Ue))),Vg(ct)}if(e.mode==="text")return`"${e.value}"`;let me="";const{command:Ge}=e;let Lt;if(Ge==="\\placeholder")return`(${vr(e.body)})`;switch(e.type){case"accent":const Ue={"\\vec":"vec","\\dot":"dot","\\ddot":"ddot","\\bar":"bar","\\hat":"hat","\\acute":"acute;","\\grave":"grave","\\tilde":"tilde","\\breve":"breave","\\check":"check"}[Ge];me=`${Ue!=null?Ue:""} ${vr(e.body)} `;break;case"first":return"";case"latexgroup":return e.body.map(ri=>ri.value).join("");case"group":case"root":me=(r=bh[Ge])!=null?r:vr(e.body);break;case"genfrac":{const ri=e;(ri.leftDelim||ri.rightDelim)&&(me=ri.leftDelim==="."||!ri.leftDelim?"{:":ri.leftDelim),ri.hasBarLine?(me+="(",me+=vr(ri.above),me+=")/(",me+=vr(ri.below),me+=")"):(me+="("+vr(ri.above)+"),",me+="("+vr(ri.below)+")"),(ri.leftDelim||ri.rightDelim)&&(me+=ri.rightDelim==="."||!ri.rightDelim?"{:":ri.rightDelim)}break;case"surd":me+=e.hasEmptyBranch("above")?"sqrt("+vr(e.body)+")":"root("+vr(e.above)+")("+vr(e.body)+")";break;case"latex":me=e.value;break;case"leftright":{const ri=e,cn=ri.leftDelim;me+=cn==="."||!cn?"{:":cn,me+=vr(ri.body);const Bn=ri.matchingRightDelim();me+=Bn==="."||!Bn?":}":Bn}break;case"sizeddelim":case"delim":me=e.value;break;case"overlap":break;case"overunder":break;case"mord":me=(c=(a=bh[Ge])!=null?a:Ge)!=null?c:typeof e.value=="string"?e.value:"",me.startsWith("\\")&&(me+=" "),Lt=Ge?Ge.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null,Lt?me=String.fromCodePoint(Number.parseInt("0x"+Lt[1])):me.length>0&&me.startsWith("\\")&&(me=typeof e.value=="string"?e.value.charAt(0):e.command),me=Gg(me,e.style);break;case"mbin":case"mrel":case"minner":me=(m=(p=bh[Ge])!=null?p:xh[Ge])!=null?m:e.value;break;case"mopen":case"mclose":me=e.value;break;case"mpunct":me=(b=xh[Ge])!=null?b:Ge;break;case"mop":case"operator":case"extensible-symbol":e.value!=="\u200B"&&(xh[Ge]?me=xh[Ge]:me=Ge==="\\operatorname"?vr(e.body):(w=e.value)!=null?w:Ge,me+=" ");break;case"array":const ct=e.array,Rt=e.environmentName,yt=(E={bmatrix:["[","]"],"bmatrix*":["[","]"]}[Rt])!=null?E:["(",")"],Jt=[];for(const ri of ct){const cn=[];for(const Bn of ri)cn.push(yt[0]+vr(Bn)+yt[1]);Jt.push(cn.join(","))}const hi=(I={bmatrix:["[","]"],"bmatrix*":["[","]"],cases:["{",":}"]}[Rt])!=null?I:["(",")"];me=hi[0]+Jt.join(",")+hi[1];break;case"box":break;case"spacing":me=(N=bh[Ge])!=null?N:" ";break;case"enclose":me="("+vr(e.body)+")";break;case"space":me=" ";break;case"subsup":me="";break;case"macro":me=(ue=(Z=bh[Ge])!=null?Z:xh[Ge])!=null?ue:vr(e.body);break}if(!e.hasEmptyBranch("subscript")){me+="_";const Ue=vr(e.subscript);me+=Ue.length!==1?`(${Ue})`:Ue}if(!e.hasEmptyBranch("superscript")){me+="^";const Ue=vr(e.superscript);me+=Ue.length!==1?`(${Ue})`:Ue}return me}function Gg(e,i){if(!i)return e;let r=e;return i.variant==="double-struck"&&(r=`bbb "${r}"`),i.variant==="script"&&(r=`cc "${r}"`),i.variant==="fraktur"&&(r=`fr "${r}"`),i.variant==="sans-serif"&&(r=`sf "${r}"`),i.variant==="monospace"&&(r=`tt "${r}"`),i.variantStyle==="bold"&&(r=`bb "${r}"`),i.color?`color({${i.color}})(${r})`:r}function Nr(e,i){var r,a;i!=null||(i={}),i.mathstyle=(r=i.mathstyle)!=null?r:"displaystyle";const c=new sn({from:f(P({},Tl()),{renderPlaceholder:()=>new Mt(160,{maxFontSize:1}),letterShapeStyle:(a=i==null?void 0:i.letterShapeStyle)!=null?a:"tex"}),mathstyle:i.mathstyle}),m=new Qe({mode:"math",type:"root",body:Br(e,{context:c,parseMode:"math",mathstyle:i.mathstyle})}).render(c);return m?(Du(Fl(m,c)),Cu(m,{classes:"ML__latex"}).toMarkup()):""}function P1(e){return Cf(e,{context:Tl()})}function Hg(e,i={}){return En(Br(e,{parseMode:"math",args:()=>"",mathstyle:"displaystyle"}),i)}function Wg(e){const i=Br(e,{parseMode:"math",mathstyle:"displaystyle"});return uc(i)}var dd;function jg(e){var i,r;if(!dd){const a=(i=globalThis[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:i.ComputeEngine;a?dd=new a:console.error(`MathLive 0.98.5: The CortexJS Compute Engine library is not available.
|
|
|
|
|
|
Load the library, for example with:
|
|
|
|
|
|
import "https://unpkg.com/@cortex-js/compute-engine?module"`)}return(r=dd==null?void 0:dd.box(e).latex)!=null?r:""}function O1(e,i="math"){return vr(new Qe({type:"root",body:Br(e,{parseMode:i})}))}function F1(e){return Bu(e,{format:"ascii-math"})[1]}function P0(e){if(typeof e=="string"){const i=qg(e);if(!i)throw new Error(`Invalid color: ${e}`);return i}return"C"in e?Yg(e):"a"in e?Lp(e):e}function cc(e){return e<0?0:e>255?255:Math.round(e)}function qg(e){if(!e||e[0]!=="#")return;e=e.slice(1);let i;return e.length<=4?(i={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},e.length===4&&(i.a=parseInt(e[3]+e[3],16)/255)):(i={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},e.length===8&&(i.a=parseInt(e[6]+e[7],16)/255)),i&&typeof i.a=="undefined"&&(i.a=1),i}function O0(e){const[i,r,a]=[e.L,e.C,e.H],c=a*Math.PI/180,p={L:i,a:r*Math.cos(c),b:r*Math.sin(c)};return e.alpha!==void 0&&(p.alpha=e.alpha),p}function Zg(e){const[i,r,a]=[e.L,e.a,e.b],c=Math.sqrt(r*r+a*a),m=Math.atan2(a,r)*180/Math.PI,b={L:i,C:c,H:m};return e.alpha!==void 0&&(b.alpha=e.alpha),b}function F0(e){const[i,r,a]=[e.L,e.a,e.b],c=Math.pow(.9999999984505198*i+.39633779217376786*r+.2158037580607588*a,3),p=Math.pow(1.00000000888176*i-.10556134232365635*r-.0638541747717059*a,3),m=Math.pow(i*1.000000054672411-.0894841820949657*r-1.2914855378640917*a,3),b=4.076741661347994*c-3.307711590408193*p+.230969928729428*m,w=-1.2684380040921763*c+2.6097574006633715*p-.3413193963102197*m,E=-.004196086541837188*c-.7034186144594493*p+1.7076147009309444*m,I=N=>{const Z=Math.abs(N);return Z<=.0031308?N*12.92:(Math.sign(N)||1)*(1.055*Math.pow(Z,1/2.4)-.055)};return[I(b),I(w),I(E)]}function B0(e){const[i,r,a]=e;return i>=0&&i<=1&&r>=0&&r<=1&&a>=0&&a<=1}function N0(e,i){let[r,a,c]=e;return r=cc(r*255),a=cc(a*255),c=cc(c*255),i!==void 0?{r,g:a,b:c,alpha:i}:{r,g:a,b:c}}function Lp(e){let[i,r,a]=F0(e);if(B0([i,r,a]))return N0([i,r,a],e.alpha);const c=Zg(e);if(c.C=0,[i,r,a]=F0(O0(c)),!B0([i,r,a]))return N0([i,r,a],e.alpha);let p=0,m=e.L,b=(p+m)/2;c.C=b;const w=.36/Math.pow(2,12);for(;m-p>w;)b=(p+m)/2,c.C=b,[i,r,a]=F0(O0(c)),B0([i,r,a])?p=b:m=b;return N0([i,r,a],e.alpha)}function Yg(e){return Lp(O0(e))}function Dp(e,i){const r=P0(e),a=P0(i),c=.56,p=.57,m=.62,b=.65,w=.022,E=1.414,I=.1,N=5e-4,Z=1.14,ue=.027,me=1.14,Ge=.027;function Lt(ri){return ri>=w?ri:ri+wa(w-ri,E)}function Ue(ri){return(ri<0?-1:1)*Math.pow(Math.abs(ri),2.4)}const ct=Lt(Ue(a.r/255)*.2126729+Ue(a.g/255)*.7151522+Ue(a.b/255)*.072175),Rt=Lt(Ue(r.r/255)*.2126729+Ue(r.g/255)*.7151522+Ue(r.b/255)*.072175);let yt,Jt,hi;return Math.abs(Rt-ct)<N?Jt=0:Rt>ct?(yt=wa(Rt,c)-wa(ct,p),Jt=yt*Z):(yt=wa(Rt,b)-wa(ct,m),Jt=yt*me),Math.abs(Jt)<I?hi=0:Jt>0?hi=Jt-Ge:hi=Jt+ue,hi*100}function Cp(e,i,r){r!=null||(r="#fff"),i!=null||(i="#000");const a=Dp(e,r),c=Dp(e,i);return Math.abs(a)>Math.abs(c)?r:i}function Xg(e){const i=P0(e);let r=((1<<24)+(cc(i.r)<<16)+(cc(i.g)<<8)+cc(i.b)).toString(16).slice(1);return i.alpha!==void 0&&i.alpha<1&&(r+=("00"+Math.round(i.alpha*255).toString(16)).slice(-2)),r[0]===r[1]&&r[2]===r[3]&&r[4]===r[5]&&r[6]===r[7]&&(r=r[0]+r[2]+r[4]+(i.alpha!==void 0&&i.alpha<1?r[6]:"")),"#"+r}function Qn(e){const i=Mp(e);let r="";for(const a of i){if(typeof a.value!="string")return"";r+=a.value}return r}function Mp(e){const r=e.model.selection.ranges;return r.length!==1?[]:e.model.getAtoms(r[0])}function Jg(e,i){const r=Mp(e);if(r.length!==1)return!1;const a=Ju[i];return a?!!a.test(r[0].value):!1}function Qg(e,i){return Qn(e).length>0}function e1(e){return[$0(e,"double-struck","mathbb","tooltip.blackboard"),$0(e,"fraktur","mathfrak","tooltip.fraktur"),$0(e,"calligraphic","mathcal","tooltip.caligraphic"),K0(e,"up","mathrm","tooltip.roman-upright"),K0(e,"bold","mathbf","tooltip.bold"),K0(e,"italic","mathit","tooltip.italic")]}function t1(e){return[{label:()=>Nr(`\\vec{${Qn(e)}}`),visible:()=>Qn(e).length===1,onMenuSelect:()=>e.insert("\\vec{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overrightarrow{${Qn(e)}}`),visible:()=>Qn(e).length>0,onMenuSelect:()=>e.insert("\\overrightarrow{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overleftarrow{${Qn(e)}}`),visible:()=>Qn(e).length>0,onMenuSelect:()=>e.insert("\\overleftarrow{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\dot{${Qn(e)}}`),visible:()=>Qn(e).length===1,onMenuSelect:()=>e.insert("\\dot{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\ddot{${Qn(e)}}`),visible:()=>Qn(e).length===1,onMenuSelect:()=>e.insert("\\ddot{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\bar{${Qn(e)}}`),visible:()=>Qn(e).length===1,onMenuSelect:()=>e.insert("\\bar{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overline{${Qn(e)}}`),visible:()=>Qn(e).length>0,onMenuSelect:()=>e.insert("\\overline{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overgroup{${Qn(e)}}`),visible:()=>Qn(e).length>0,onMenuSelect:()=>e.insert("\\overgroup{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overbrace{${Qn(e)}}`),visible:()=>Qn(e).length>0,onMenuSelect:()=>e.insert("\\overbrace{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\underline{${Qn(e)}}`),visible:()=>Qn(e).length>0,onMenuSelect:()=>e.insert("\\underline{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\undergroup{${Qn(e)}}`),visible:()=>Qn(e).length>0,onMenuSelect:()=>e.insert("\\undergroup{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\underbrace{${Qn(e)}}`),visible:()=>Qn(e).length>0,onMenuSelect:()=>e.insert("\\underbrace{#@}",{selectionMode:"item"})}]}function i1(e){return[{label:()=>Nr(`\\boxed{${e.getValue(e.model.selection)}}}`),onMenuSelect:()=>e.insert("\\boxed{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\bbox[5px, border: 2px solid red]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px solid red]{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\bbox[5px, border: 2px dashed black]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px dashed black]{#@}",{selectionMode:"item"})}]}function n1(e){const i=[];for(const r of Object.keys(Se))i.push({class:(Xg(Cp(Se[r]))==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${Se[r]} "></span>`,ariaLabel:()=>{var a;return(a=G(r))!=null?a:r},checked:()=>{var a;return{some:"mixed",all:!0}[(a=e.queryStyle({backgroundColor:r}))!=null?a:!1]},onMenuSelect:()=>{e.applyStyle({backgroundColor:r},{operation:"toggle"}),e.adoptStyle="none"}});return i}function r1(e){const i=[];for(const r of Object.keys(se))i.push({class:(Cp(se[r])==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${se[r]} "></span>`,ariaLabel:()=>{var a;return(a=G(r))!=null?a:r},checked:()=>{var a;return{some:"mixed",all:!0}[(a=e.queryStyle({color:r}))!=null?a:!1]},onMenuSelect:()=>{e.applyStyle({color:r},{operation:"toggle"}),e.adoptStyle="none"}});return i}var s1=class extends vp{constructor(e,i,r,a){super(e,i),this.row=r,this.col=a}set active(e){const i=this.parentMenu.children;if(e)for(const r of i)r.element.classList.toggle("active",r.row<=this.row&&r.col<=this.col);else for(const r of i)r.element.classList.remove("active")}};function a1(e){const i=[];for(let r=1;r<=5;r++)for(let a=1;a<=5;a++)i.push({onCreate:(c,p)=>new s1(c,p,r,a),label:"\u2610",tooltip:()=>G("tooltip.row-by-col",r,a),data:{row:r,col:a},onMenuSelect:()=>{e.insert(`\\begin{pmatrix}${Array(r).fill(Array(a).fill("#?").join(" & ")).join("\\\\")}\\end{pmatrix}`,{selectionMode:"item"})}});return i}function o1(e){return[{label:()=>G("menu.array.add row above"),id:"add-row-above",onMenuSelect:()=>e.executeCommand("addRowBefore"),visible:()=>iu(e)},{label:()=>G("menu.array.add row below"),id:"add-row-below",onMenuSelect:()=>e.executeCommand("addRowAfter"),visible:()=>iu(e)},{label:()=>G("menu.array.add column before"),id:"add-column-before",onMenuSelect:()=>e.executeCommand("addColumnBefore"),visible:()=>iu(e),enabled:()=>{const i=e.model.parentEnvironment;if(!i)return!1;const[r,a]=u1(e);return r<i.maxColumns}},{label:()=>G("menu.array.add column after"),id:"add-column-after",onMenuSelect:()=>e.executeCommand("addColumnAfter"),visible:()=>iu(e)},{type:"divider"},{label:()=>G("menu.array.delete row"),id:"delete-row",onMenuSelect:()=>e.executeCommand("removeRow"),visible:()=>iu(e)},{label:()=>G("menu.array.delete column"),id:"delete-column",onMenuSelect:()=>e.executeCommand("removeColumn"),visible:()=>iu(e)},{type:"divider"},{label:()=>G("menu.borders"),visible:()=>(l1(e)||iu(e))&&e.isSelectionEditable,submenu:[{label:" \u22F1 ",id:"environment-no-border",onMenuSelect:()=>wh(e,"matrix")},{label:"(\u22F1)",id:"environment-parentheses",onMenuSelect:()=>wh(e,"pmatrix")},{label:"[\u22F1]",id:"environment-brackets",onMenuSelect:()=>wh(e,"bmatrix")},{label:"|\u22F1|",id:"environment-bar",onMenuSelect:()=>wh(e,"vmatrix")},{label:"{\u22F1}",id:"environment-braces",onMenuSelect:()=>wh(e,"Bmatrix")}],submenuClass:"border-submenu"},{type:"divider"},{label:()=>G("menu.insert matrix"),id:"insert-matrix",visible:()=>e.isSelectionEditable,submenu:a1(e),submenuClass:"insert-matrix-submenu",columnCount:5},{label:()=>G("menu.mode"),id:"mode",visible:()=>e.isSelectionEditable&&e.model.selectionIsCollapsed,submenu:[{label:()=>G("menu.mode-math"),id:"mode-math",onMenuSelect:()=>{Ee(e,"accept-all"),e.executeCommand(["switchMode","math"])},checked:()=>e.model.mode==="math"},{label:()=>G("menu.mode-text"),id:"mode-text",onMenuSelect:()=>{Ee(e,"accept-all"),e.executeCommand(["switchMode","text"])},checked:()=>e.model.mode==="text"},{label:()=>G("menu.mode-latex"),id:"mode-latex",onMenuSelect:()=>e.executeCommand(["switchMode","latex"]),checked:()=>e.model.mode==="latex"}]},{type:"divider"},{label:()=>G("menu.font-style"),id:"variant",visible:()=>e.isSelectionEditable,submenu:e1(e),submenuClass:"variant-submenu"},{label:()=>G("menu.color"),id:"color",visible:()=>e.isSelectionEditable,submenu:r1(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>G("menu.background-color"),id:"background-color",visible:()=>e.isSelectionEditable,submenu:n1(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>G("menu.accent"),id:"accent",visible:()=>e.isSelectionEditable,submenu:t1(e),submenuClass:"variant-submenu"},{label:()=>G("menu.decoration"),id:"decoration",visible:()=>e.isSelectionEditable&&Qn(e).length>0,submenu:i1(e),submenuClass:"variant-submenu"},{type:"divider"},{label:()=>G("menu.evaluate"),id:"ce-evaluate",visible:()=>e.isSelectionEditable&&window.MathfieldElement.computeEngine!==null,onMenuSelect:()=>{const i=c1(e);if(!i){e.model.announce("plonk");return}e.model.selectionIsCollapsed?(e.model.position=e.model.lastOffset,e.insert(`=${i}`,{insertionMode:"insertAfter",selectionMode:"item"})):e.insert(i,{insertionMode:"replaceSelection",selectionMode:"item"})}},{label:()=>G("menu.simplify"),id:"ce-simplify",visible:()=>e.isSelectionEditable&&window.MathfieldElement.computeEngine!==null,onMenuSelect:()=>{var i,r;if(e.model.selectionIsCollapsed){const a=(i=e.expression)==null?void 0:i.simplify();if(e.model.position=e.model.lastOffset,!a){e.model.announce("plonk");return}e.insert(`=${a.latex}`,{insertionMode:"insertAfter",selectionMode:"item"})}else{const a=(r=window.MathfieldElement.computeEngine)==null?void 0:r.parse(e.getValue(e.model.selection)).simplify();if(!a){e.model.announce("plonk");return}e.insert(a.latex,{insertionMode:"replaceSelection",selectionMode:"item"})}}},{label:()=>{var i;if(window.MathfieldElement.computeEngine===null)return"";const r=(i=e.expression)==null?void 0:i.unknowns[0];return r?G("menu.solve-for",Nr(r)):G("menu.solve")},id:"ce-solve",visible:()=>{var i;return e.isSelectionEditable&&window.MathfieldElement.computeEngine!==null&&((i=e.expression)==null?void 0:i.unknowns.length)===1&&e.expression.unknowns[0]!=="Nothing"},onMenuSelect:()=>{var i;const r=e.expression,a=r==null?void 0:r.unknowns[0],c=(i=r.solve(a))==null?void 0:i.map(p=>{var m;return(m=p.simplify().latex)!=null?m:""});if(!c){e.model.announce("plonk");return}e.insert(`${a}=${c.length===1?c[0]:"\\left\\lbrace"+(c==null?void 0:c.join(", "))+"\\right\\rbrace"}`,{insertionMode:"replaceAll",selectionMode:"item"})}},{type:"divider"},{label:()=>G("menu.cut"),onMenuSelect:()=>e.executeCommand("cutToClipboard"),visible:()=>!e.options.readOnly&&e.isSelectionEditable,keyboardShortcut:"meta+X"},{label:()=>G("menu.copy"),id:"copy",submenu:[{label:()=>G("menu.copy-as-latex"),id:"copy-latex",onMenuSelect:()=>Gn.copyToClipboard(e,"latex"),keyboardShortcut:"meta+C"},{label:()=>G("menu.copy-as-ascii-math"),id:"copy-ascii-math",onMenuSelect:()=>Gn.copyToClipboard(e,"ascii-math")},{label:()=>G("menu.copy-as-mathml"),id:"copy-math-ml",onMenuSelect:()=>Gn.copyToClipboard(e,"math-ml")}]},{label:()=>G("menu.paste"),id:"paste",onMenuSelect:()=>e.executeCommand("pasteFromClipboard"),visible:()=>e.hasEditableContent,keyboardShortcut:"meta+V"},{label:()=>G("menu.select-all"),id:"select-all",keyboardShortcut:"meta+A",onMenuSelect:()=>e.executeCommand("selectAll")}]}function iu(e){var i;return!!((i=e.model.parentEnvironment)!=null&&i.array)}function l1(e){return e.model.at(e.model.position).type==="array"}function u1(e){var i;const r=(i=e.model.parentEnvironment)==null?void 0:i.array;return r?[r.length,r.reduce((a,c)=>Math.max(a,c.length),0)]:[0,0]}function wh(e,i){J(e),e.flushInlineShortcutBuffer(),Y0(e.model,i),_i(e)}function c1(e){var i,r;let a;if(e.model.selectionIsCollapsed?a=(i=window.MathfieldElement.computeEngine)==null?void 0:i.parse(e.getValue(),{canonical:!1}):a=(r=window.MathfieldElement.computeEngine)==null?void 0:r.parse(e.getValue(e.model.selection),{canonical:!1}),!a)return"";let c=a.evaluate();return c.isSame(a)&&(c=a.N()),c.latex}function $0(e,i,r,a){return{label:()=>Nr(`\\${r}{${Qn(e)}}`),tooltip:()=>{var c;return(c=G(a))!=null?c:a},visible:()=>Jg(e,i),checked:()=>{var c;return{some:"mixed",all:!0}[(c=e.queryStyle({variant:i}))!=null?c:!1]},onMenuSelect:()=>{e.applyStyle({variant:i},{operation:"toggle"}),e.adoptStyle="none"}}}function K0(e,i,r,a){return{label:()=>Nr(`\\${r}{${Qn(e)}}`),tooltip:()=>{var c;return(c=G(a))!=null?c:a},visible:()=>Qg(e,i),checked:()=>{var c;return{some:"mixed",all:!0}[(c=e.queryStyle({variantStyle:i}))!=null?c:!1]},onMenuSelect:()=>{e.applyStyle({variantStyle:i},{operation:"toggle"}),e.adoptStyle="none"}}}function hc(e,i){return e+uc(i)}es({speak:(e,i,r)=>h1(e,i,r)},{target:"mathfield"});function h1(e,i,r){var a,c;r=r!=null?r:{withHighlighting:!1};const{model:p}=e;function m(I){let N=null;switch(I){case"all":N=p.root;break;case"selection":N=p.getAtoms(p.selection);break;case"left":{N=p.getAtoms(p.offsetOf(p.at(p.position).leftSibling),p.position);break}case"right":{N=p.getAtoms(p.position,p.offsetOf(p.at(p.position).rightSibling));break}case"group":N=p.getAtoms(p.getSiblingsRange(p.position));break;case"parent":{const{parent:Z}=p.at(p.position);Z!=null&&Z.parent?N=Z:N=p.root;break}default:N=p.root}return N}function b(I){let N="";switch(I){case"all":console.log("Internal failure: speak all failed");break;case"selection":N="no selection";break;case"left":N="at start";break;case"right":N="at end";break;case"group":console.log("Internal failure: speak group failed");break;case"parent":N="no parent";break;default:console.log('unknown speak_ param value: "'+I+'"');break}return N}const w=m(i);if(w===null)return(c=(a=window.MathfieldElement).speakHook)==null||c.call(a,b(i)),!1;(r.withHighlighting||window.MathfieldElement.speechEngine==="amazon")&&(window.MathfieldElement.textToSpeechMarkup=window.sre&&window.MathfieldElement.textToSpeechRules==="sre"?"ssml_step":"ssml");const E=uc(w);return M()&&r.withHighlighting?(ul().readAloudMathfield=e,mr(e,{forHighlighting:!0}),window.MathfieldElement.readAloudHook&&window.MathfieldElement.readAloudHook(e.field,E)):window.MathfieldElement.speakHook&&window.MathfieldElement.speakHook(E),!1}function f1(e){var i,r;if(!M()){console.log("Speak:",e);return}if(!window.MathfieldElement.speechEngine||window.MathfieldElement.speechEngine==="local"){const a=new SpeechSynthesisUtterance(e);window.speechSynthesis.speak(a)}else if(window.MathfieldElement.speechEngine==="amazon")if(!("AWS"in window))console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");else{const a=new window.AWS.Polly({apiVersion:"2016-06-10"}),c={OutputFormat:"mp3",VoiceId:(i=window.MathfieldElement.speechEngineVoice)!=null?i:"Joanna",Engine:["Amy","Emma","Brian","Ivy","Joanna","Kendra","Kimberly","Salli","Joey","Justin","Matthew"].includes((r=window.MathfieldElement.speechEngineVoice)!=null?r:"Joanna")?"neural":"standard",Text:e,TextType:"ssml"};a.synthesizeSpeech(c,(p,m)=>{if(p)console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${p}`);else if(m!=null&&m.AudioStream){const b=new Uint8Array(m.AudioStream),w=new Blob([b.buffer],{type:"audio/mpeg"}),E=URL.createObjectURL(w);new Audio(E).play().catch(N=>console.log(N))}else console.log("polly.synthesizeSpeech():",m)})}else window.MathfieldElement.speechEngine==="google"&&console.error("MathLive 0.98.5: The Google speech engine is not supported yet. Please come again.")}function Ip(e){var i;let r;if(e.parent.type==="prompt")e.parentBranch==="body"&&(r="prompt");else if(e.parentBranch==="body")r=e.type&&(i={enclose:"cross out",leftright:"delimiter",surd:"square root",root:"math field",mop:"operator",first:"first"}[e.type])!=null?i:"parent";else if(e.parent.type==="genfrac"){if(e.parentBranch==="above")return"numerator";if(e.parentBranch==="below")return"denominator"}else e.parent.type==="surd"?e.parentBranch==="above"&&(r="index"):e.parentBranch==="superscript"?r="superscript":e.parentBranch==="subscript"&&(r="subscript");return r||console.log("unknown relationship"),r!=null?r:"parent"}function d1(e,i,r,a){let c="";if(i==="plonk")window.MathfieldElement.playSound("plonk"),e.flushInlineShortcutBuffer();else if(i==="delete")c=hc("deleted: ",a);else if(i==="focus"||i.includes("move"))c=p1(e.model,r)+(e.model.selectionIsCollapsed?"":"selected: ")+m1(e.model);else if(i==="replacement")c=hc("",e.model.at(e.model.position));else if(i==="line"){const p=hc("",e.model.root);e.keyboardDelegate.setAriaLabel(p)}else c=a?hc(i+" ",a):i;if(c){const p=e.ariaLiveText.textContent.includes("\xA0")?" \u202F ":" \xA0 ";e.ariaLiveText.textContent=c+p}}function p1(e,i){if(Number.isNaN(i))return"";const r=e.at(i);if(!r||r.treeDepth<=e.at(e.position).treeDepth)return"";let a="",c=r.parent;const p=e.at(e.position).parent;for(;c!==e.root&&c!==p;)a+=`out of ${Ip(c)};`,c=c.parent;return a}function m1(e){if(!e.selectionIsCollapsed)return hc("",e.getAtoms(e.selection));let i="";const r=e.at(e.position),a=Ip(r);return r.isFirstSibling&&(i=(a?"start of "+a:"unknown")+": "),r.isLastSibling?r.isFirstSibling||(i+=a?"end of "+a:"unknown"):i+=hc("",r),i}var g1=class{constructor(e,i,r){this.mathfield=e,this.mode=i,this.silenceNotifications=!1,this._selection={ranges:[[0,0]],direction:"none"},this._anchor=0,this._position=0,this.root=r}dispose(){this.mathfield=void 0}getState(){const e={ranges:[...this._selection.ranges]};return this.selection.direction&&this.selection.direction!=="none"&&(e.direction=this.selection.direction),{content:this.root.toJson(),selection:e,mode:this.mode}}setState(e,i){var r;const a=this.silenceNotifications;this.silenceNotifications=(r=i==null?void 0:i.silenceNotifications)!=null?r:!0;let c={};if((i==null?void 0:i.type)==="undo"&&(c={inputType:"historyUndo"}),(i==null?void 0:i.type)==="redo"&&(c={inputType:"historyRedo"}),this.contentWillChange(c)){const p=this.silenceNotifications;this.silenceNotifications=!0,this.mode=e.mode,this.root=_a(e.content),this.selection=e.selection,this.silenceNotifications=p,this.contentDidChange(c)}this.silenceNotifications=a}get atoms(){return this.root.children}get selection(){return this._selection}set selection(e){this.setSelection(e)}setSelection(e,i){return!this.mathfield.contentEditable&&this.mathfield.userSelect==="none"?!1:this.deferNotifications({selection:!0},()=>{var r,a,c;const p=this.normalizeSelection(e,i);if(p===void 0)throw new TypeError("Invalid selection");if(p.ranges.length===1&&p.ranges[0][0]===p.ranges[0][1]){const I=p.ranges[0][0];if(!this.mathfield.dirty&&!((r=this.at(I))!=null&&r.parentPrompt)&&this.mathfield.hasEditablePrompts){if((a=this.at(I-1))!=null&&a.parentPrompt){this._anchor=this.normalizeOffset(I-1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}if((c=this.at(I+1))!=null&&c.parentPrompt){this._anchor=this.normalizeOffset(I+1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}this._anchor=0,this._position=0,this._selection={ranges:[[0,0]]};return}this._anchor=I,this._position=I,this._selection=p;return}const m=jr(p);p.direction==="backward"?[this._position,this._anchor]=m:[this._anchor,this._position]=m;const b=this.at(m[0]+1),w=this.at(m[1]),E=Qe.commonAncestor(b,w);(E==null?void 0:E.type)==="array"&&b.parent===E&&w.parent===E?this._selection={ranges:[m],direction:p.direction}:this._selection={ranges:[m],direction:p.direction},console.assert(this._position>=0&&this._position<=this.lastOffset)})}setPositionHandlingPlaceholder(e){var i;const r=this.at(e);(r==null?void 0:r.type)==="placeholder"?this.setSelection(e-1,e):((i=r==null?void 0:r.rightSibling)==null?void 0:i.type)==="placeholder"?this.setSelection(e,e+1):this.position=e,r instanceof Ir&&r.isSuggestion&&(r.isSuggestion=!1),this.mathfield.stopCoalescingUndo()}get position(){return this._position}set position(e){this.setSelection(e,e)}get anchor(){return this._anchor}get selectionIsCollapsed(){return this._anchor===this._position}get selectionIsPlaceholder(){return Math.abs(this._anchor-this._position)===1?this.at(Math.max(this._anchor,this._position)).type==="placeholder":!1}collapseSelection(e="forward"){return this._anchor===this._position?!1:(e==="backward"?this.position=Math.min(this._anchor,this._position):this.position=Math.max(this._anchor,this._position),!0)}get lastOffset(){return this.atoms.length-1}at(e){return this.atoms[e]}offsetOf(e){return this.atoms.indexOf(e)}getSiblingsRange(e){const i=this.at(e),{parent:r}=i;if(!r)return[0,this.lastOffset];const a=i.parent.branch(i.parentBranch);return[this.offsetOf(a[0]),this.offsetOf(a[a.length-1])]}getBranchRange(e,i){const r=this.at(e).branch(i);return[this.offsetOf(r[0]),this.offsetOf(r[r.length-1])]}getAtoms(e,i,r){let a=r!=null?r:{};if(Ou(e)){if(a=i!=null?i:{},e.ranges.length>1)return e.ranges.reduce((E,I)=>[...E,...this.getAtoms(I,a)],[]);e=e.ranges[0]}let c,p;if(Ra(e)){if(c=e,!Ra(i))return[];p=i}else[c,p]=e,a=i!=null?i:{};if(!Number.isFinite(c))return[];a.includeChildren===void 0&&(a.includeChildren=!1),c<0&&(c=this.lastOffset-c+1),p<0&&(p=this.lastOffset-p+1);const m=Math.min(c,p)+1,b=Math.max(c,p);if(!a.includeChildren&&m===1&&b===this.lastOffset)return[this.root];let w=[];for(let E=m;E<=b;E++){const I=this.atoms[E];Rp(this,I,m,b)&&w.push(I)}return a.includeChildren||(w=w.filter(E=>{let I=!1,{parent:N}=E;for(;N&&!I;)I=Rp(this,N,m,b),N=N.parent;return!I})),w}getAllAtoms(e=0){const i=[],r=this.lastOffset;for(let a=e;a<=r;a++)i.push(this.atoms[a]);for(let a=0;a<e;a++)i.push(this.atoms[a]);return i}findAtom(e,i=0,r="forward"){let a;const c=this.lastOffset;if(r==="forward"){for(let p=i;p<=c;p++)if(a=this.atoms[p],e(a))return a;for(let p=0;p<i;p++)if(a=this.atoms[p],e(a))return a;return}for(let p=i;p>=0;p--)if(a=this.atoms[p],e(a))return a;for(let p=c;p>i;p--)if(a=this.atoms[p],e(a))return a}extractAtoms(e){let i=this.getAtoms(e);if(i.length===1&&!i[0].parent)if(i[0].type==="root")i=[...i[0].body],i.shift();else return i=this.root.cells.flat(),this.root=new Qe({type:"root",body:[]}),i;for(const r of i)r.parent.removeChild(r);return i}deleteAtoms(e){this.extractAtoms(e),this.position=e[0]}atomToString(e,i){const r=i!=null?i:"latex";if(r.startsWith("latex"))return Qe.serialize([e],{expandMacro:r==="latex-expanded",skipStyles:r==="latex-unstyled",skipPlaceholders:r==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode});if(r==="math-ml")return En(e);if(r==="spoken")return uc(e);if(r==="spoken-text"){const a=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="";const c=uc(e);return window.MathfieldElement.textToSpeechMarkup=a,c}if(r==="spoken-ssml"||r==="spoken-ssml-with-highlighting"){const a=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="ssml";const c=uc(e);return window.MathfieldElement.textToSpeechMarkup=a,c}return r==="ascii-math"?vr(e):(console.error(`MathLive 0.98.5: Unexpected format "${r}`),"")}getValue(e,i,r){if(e===void 0)return this.atomToString(this.root,"latex");if(typeof e=="string"&&e!=="math-json")return this.atomToString(this.root,e);let a,c;if(Ra(e)&&Ra(i)?(a=[this.normalizeRange([e,i])],c=r):Dl(e)?(a=[this.normalizeRange(e)],c=i):Ou(e)?(a=e.ranges,c=i):(a=[this.normalizeRange([0,-1])],c=e),c!=null||(c="latex"),c==="math-json"){if(!window.MathfieldElement.computeEngine)return window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`The CortexJS Compute Engine library is not available.
|
|
|
Load the library, for example with:
|
|
|
import "https://unpkg.com/@cortex-js/compute-engine?module"`),'["Error", "compute-engine-not-available"]';const p=this.getValue({ranges:a},"latex-unstyled");try{const m=window.MathfieldElement.computeEngine.parse(p);return JSON.stringify(m.json)}catch(m){return JSON.stringify(["Error",`'${m.toString()}'`])}}if(c.startsWith("latex")){const p={expandMacro:c==="latex-expanded",skipStyles:c==="latex-unstyled",skipPlaceholders:c==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode};return un(a.map(m=>Qe.serialize(this.getAtoms(m),p)))}return a.map(p=>this.getAtoms(p).map(m=>this.atomToString(m,c)).join("")).join("")}extendSelectionTo(e,i){return!this.mathfield.contentEditable&&this.mathfield.userSelect==="none"?!1:this.deferNotifications({selection:!0},()=>{const r=this.normalizeRange([e,i]);let[a,c]=r,{parent:p}=this.at(c);if(p&&(p.type==="genfrac"||p.type==="subsup"))for(;p!==this.root&&U0(this,p,[a,c]);)c=this.offsetOf(p),p=p.parent;for(p=this.at(a).parent;p!==this.root&&U0(this,p,[a,c]);)a=this.offsetOf(p.leftSibling),p=p.parent;if(p=this.at(c).parent,(p==null?void 0:p.type)==="genfrac")for(;p!==this.root&&U0(this,p,[a,c]);)c=this.offsetOf(p),console.assert(c>=0),p=p.parent;this._position=this.normalizeOffset(i),this._selection={ranges:[[a,c]],direction:"none"}})}announce(e,i,r=[]){var a,c;((c=(a=this.mathfield.host)==null?void 0:a.dispatchEvent(new CustomEvent("announce",{detail:{command:e,previousPosition:i,atoms:r},cancelable:!0,bubbles:!0,composed:!0})))!=null?c:!0)&&d1(this.mathfield,e,i,r)}deferNotifications(e,i){const r=this._selection,a=this._anchor,c=this._position,p=this.silenceNotifications;this.silenceNotifications=!0;const m=this.root.changeCounter;i();const b=this.root.changeCounter!==m,w=a!==this._anchor||c!==this._position||Ed(this._selection,r)==="different";return this.silenceNotifications=p,e.content&&b&&this.contentDidChange({inputType:e.type}),e.selection&&w&&this.selectionDidChange(),b||w}normalizeOffset(e){return e>0?e=Math.min(e,this.lastOffset):e<0&&(e=this.lastOffset+e+1),e}normalizeRange(e){let[i,r]=e;return i=this.normalizeOffset(i),r=this.normalizeOffset(r),i<r?[i,r]:[r,i]}normalizeSelection(e,i){var r;let a;if(Ra(e)){const c=this.normalizeOffset(e);if(Ra(i)){const p=this.normalizeOffset(i);a=c<=p?{ranges:[[c,p]],direction:"none"}:{ranges:[[p,c]],direction:"backward"}}else a={ranges:[[c,c]],direction:"none"}}else if(Dl(e)){const c=this.normalizeOffset(e[0]),p=this.normalizeOffset(e[1]);a=c<=p?{ranges:[[c,p]],direction:"none"}:{ranges:[[p,c]],direction:"backward"}}else Ou(e)&&(a={ranges:e.ranges.map(c=>this.normalizeRange(c)),direction:(r=e.direction)!=null?r:"none"});return console.assert(a!==void 0),a}get parentEnvironment(){let e=this.at(this.position).parent;if(e){for(;e.parent&&e.type!=="array";)e=e.parent;if(e.type==="array")return e}}get cell(){var e;let i=this.at(this.position);if(i){for(;i&&((e=i.parent)==null?void 0:e.type)!=="array";)i=i.parent;if(!(!(i!=null&&i.parent)||i.parent.type!=="array"))return i.parentBranch}}contentWillChange(e={}){if(this.silenceNotifications||!this.mathfield)return!0;const i=this.silenceNotifications;this.silenceNotifications=!0;const r=this.mathfield.onContentWillChange(e);return this.silenceNotifications=i,r}contentDidChange(e){var i;if(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ua(this.mathfield)),this.silenceNotifications||!this.mathfield.host||!this.mathfield)return;const r=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.host.dispatchEvent(new InputEvent("input",f(P({},e),{data:e.data?e.data:(i=e.inputType)!=null?i:"",bubbles:!0,composed:!0}))),this.silenceNotifications=r}selectionDidChange(){if(!this.mathfield||(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ua(this.mathfield)),this.silenceNotifications))return;const e=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.onSelectionDidChange(),this.silenceNotifications=e}};function Rp(e,i,r,a){const c=e.offsetOf(i);if(c<r||c>a)return!1;if(!i.hasChildren)return!0;const p=e.offsetOf(i.firstChild);if(p>=r&&p<=a){const m=e.offsetOf(i.lastChild);if(m>=r&&m<=a)return!0}return!1}function U0(e,i,r){if(!(i!=null&&i.hasChildren))return!1;const[a,c]=r,p=e.offsetOf(i.firstChild),m=e.offsetOf(i.lastChild);return p>=a&&p<=c&&m>=p&&m<=c}function Sh(e,i,r,a){var c,p,m,b,w,E;const I=r.parent;if(I&&r instanceof rr){const N=!a&&i==="forward"||a==="body"&&i==="backward";let Z=N?e.offsetOf(r.firstChild):e.offsetOf(r.lastChild);return N?r.rightDelim!=="?"&&r.rightDelim!=="."?(r.leftDelim=".",r.isDirty=!0):(I.addChildrenAfter(r.removeBranch("body"),r),I.removeChild(r),Z--):r.leftDelim!=="?"&&r.leftDelim!=="."?(r.rightDelim=".",r.isDirty=!0):(I.addChildrenAfter(r.removeBranch("body"),r),I.removeChild(r),Z--),e.position=Z,!0}if(I&&r.type==="surd"){if(i==="forward"&&!a||i==="backward"&&a==="body"){const N=r.leftSibling;r.hasChildren&&I.addChildrenAfter(r.removeBranch("body"),r),I.removeChild(r),e.position=e.offsetOf(N)}else i==="forward"&&a==="body"?e.position=e.offsetOf(r):!a&&i==="backward"?r.hasChildren?e.position=e.offsetOf(r.lastChild):(e.position=Math.max(0,e.offsetOf(r)-1),I.removeChild(r)):a==="above"&&(r.hasEmptyBranch("above")&&r.removeBranch("above"),i==="backward"?e.position=e.offsetOf(r.leftSibling):e.position=e.offsetOf(r.body[0]));return!0}if(I&&(r.type==="box"||r.type==="enclose")){const N=a&&i==="backward"||!a&&i==="forward"?r.leftSibling:r.lastChild;return I.addChildrenAfter(r.removeBranch("body"),r),I.removeChild(r),e.position=e.offsetOf(N),!0}if(r.type==="genfrac"||r.type==="overunder"){if(!a)return r.type==="overunder"&&r.hasEmptyBranch("body")||r.type==="genfrac"&&r.hasEmptyBranch("below")&&r.hasEmptyBranch("above")?!1:(e.position=e.offsetOf(i==="forward"?r.firstChild:r.lastChild),!0);const N=Eh.fractionNavigationOrder==="numerator-denominator"?"above":"below",Z=N==="above"?"below":"above";if(I&&(i==="forward"&&a===N||i==="backward"&&a===Z)){const ue=r.removeBranch(N),me=r.removeBranch(Z);return I.addChildrenAfter([...ue,...me],r),I.removeChild(r),e.position=e.offsetOf(ue.length>0?ue[ue.length-1]:me[0]),!0}return i==="backward"?e.position=e.offsetOf(r.leftSibling):e.position=e.offsetOf(r),!0}if(r.isExtensibleSymbol||r.type==="subsup"){if(!a&&i==="forward")return!1;if(!a){if(r.subscript||r.superscript){const N=i==="forward"?(m=(c=r.superscript)==null?void 0:c[0])!=null?m:(p=r.subscript)==null?void 0:p[0]:(E=(b=r.subscript)==null?void 0:b[0].lastSibling)!=null?E:(w=r.superscript)==null?void 0:w[0].lastSibling;return N&&(e.position=e.offsetOf(N)),!0}return!1}if(!r.hasChildren&&r.type==="subsup"){const N=i==="forward"?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);return r.parent.removeChild(r),e.position=N,!0}if(a==="superscript")if(i==="backward"){const N=e.offsetOf(r.firstChild)-1;console.assert(N>=0),e.position=N}else r.subscript?e.position=e.offsetOf(r.subscript[0]):e.position=e.offsetOf(r);else a==="subscript"&&(i==="backward"&&r.superscript?e.position=e.offsetOf(r.superscript[0].lastSibling):i==="backward"?e.position=e.offsetOf(r.firstChild)-1:e.position=e.offsetOf(r));if(a&&r.hasEmptyBranch(a)&&(r.removeBranch(a),r.type==="subsup"&&!r.subscript&&!r.superscript)){const N=i==="forward"?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);r.parent.removeChild(r),e.position=N}return!0}if((I==null?void 0:I.type)==="genfrac"&&!a&&r.type!=="first"){let N=e.offsetOf(r.leftSibling);return I.removeChild(r),I.hasEmptyBranch("above")&&I.hasEmptyBranch("below")?(N=e.offsetOf(I.leftSibling),I.parent.removeChild(I),e.announce("delete",void 0,[I]),e.position=N,!0):(e.announce("delete",void 0,[r]),e.position=N,!0)}if(i==="backward"&&((I==null?void 0:I.command)==="\\ln"||(I==null?void 0:I.command)==="\\log")&&r.parentBranch!=="body"){const N=e.offsetOf(I.leftSibling);return I.parent.removeChild(I),e.announce("delete",void 0,[I]),e.position=N,!0}return!1}function _1(e){return!e.mathfield.isSelectionEditable||!e.contentWillChange({inputType:"deleteContentBackward"})?!1:e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentBackward"},()=>{let i=e.at(e.position);if(!(i&&Sh(e,"backward",i))){if(i!=null&&i.isFirstSibling){if(Sh(e,"backward",i.parent,i.parentBranch))return;i=null}if(!i){e.announce("plonk");return}e.position=e.offsetOf(i.leftSibling),i.parent.removeChild(i),e.announce("delete",void 0,[i])}}):Va(e,jr(e.selection),"deleteContentBackward")}function v1(e){return!e.mathfield.isSelectionEditable||!e.contentWillChange({inputType:"deleteContentForward"})?!1:e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentForward"},()=>{var i,r;let a=e.at(e.position).rightSibling;if(a&&Sh(e,"forward",a))return;if(a){if(e.at(e.position).isLastSibling&&Sh(e,"forward",a.parent,a.parentBranch))return}else{if(a=e.at(e.position),a.isLastSibling&&Sh(e,"forward",a.parent,a.parentBranch))return;a=void 0}if(e.position===e.lastOffset||!a){e.announce("plonk");return}a.parent.removeChild(a);let c=(i=e.at(e.position))==null?void 0:i.rightSibling;for(;(c==null?void 0:c.type)==="subsup";)c.parent.removeChild(c),c=(r=e.at(e.position))==null?void 0:r.rightSibling;e.announce("delete",void 0,[a])}):Va(e,jr(e.selection),"deleteContentForward")}function Va(e,i,r){const a=e.getAtoms(i);if(a.length>0&&a[0].parent){let c=a[0].parent.firstChild;c.type==="first"&&(c=c.rightSibling);const p=a[a.length-1].parent.lastChild;let m=a[0];m.type==="first"&&(m=m.rightSibling);const b=a[a.length-1];if(m===c&&b===p){const w=a[0].parent;w.parent&&w.type!=="prompt"&&(i=[e.offsetOf(w.leftSibling),e.offsetOf(w)])}if(a.length===1&&a[0].type==="placeholder"&&a[0].parent.type==="genfrac"){const w=a[0].parent,E=a[0].parentBranch==="below"?"above":"below",I=e.offsetOf(w.leftSibling);return e.deferNotifications({content:!0,selection:!0,type:r},()=>{var N,Z;const ue=w.removeBranch(E);if(ue.length===1&&ue[0].type==="placeholder")(Z=w.parent)==null||Z.removeChild(w),e.position=Math.max(0,I);else{const me=w.parent.addChildrenAfter(ue,w);(N=w.parent)==null||N.removeChild(w),e.position=e.offsetOf(me)}})}}return e.deferNotifications({content:!0,selection:!0,type:r},()=>e.deleteAtoms(i))}es({deleteAll:e=>e.contentWillChange({inputType:"deleteContent"})&&Va(e,[0,-1],"deleteContent"),deleteForward:e=>v1(e),deleteBackward:e=>_1(e),deleteNextWord:e=>e.contentWillChange({inputType:"deleteWordForward"})&&Va(e,[e.anchor,g0(e,e.position,"forward")],"deleteWordForward"),deletePreviousWord:e=>e.contentWillChange({inputType:"deleteWordBackward"})&&Va(e,[e.anchor,g0(e,e.position,"backward")],"deleteWordBackward"),deleteToGroupStart:e=>e.contentWillChange({inputType:"deleteSoftLineBackward"})&&Va(e,[e.anchor,e.offsetOf(e.at(e.position).firstSibling)],"deleteSoftLineBackward"),deleteToGroupEnd:e=>e.contentWillChange({inputType:"deleteSoftLineForward"})&&Va(e,[e.anchor,e.offsetOf(e.at(e.position).lastSibling)],"deleteSoftLineForward"),deleteToMathFieldStart:e=>e.contentWillChange({inputType:"deleteHardLineBackward"})&&Va(e,[e.anchor,0],"deleteHardLineBackward"),deleteToMathFieldEnd:e=>e.contentWillChange({inputType:"deleteHardLineForward"})&&Va(e,[e.anchor,-1],"deleteHardLineForward")},{target:"model",audioFeedback:"delete",canUndo:!0,changeContent:!0,changeSelection:!0});var y1=`<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox="0 0 576 512" role="img" aria-label="${G("tooltip.toggle virtual keyboard")}"><path d="M528 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h480c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.823-7.177 16-16 16H48c-8.823 0-16-7.177-16-16V112c0-8.823 7.177-16 16-16h480c8.823 0 16 7.177 16 16v288zM168 268v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-336 80v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm384 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zM120 188v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-96 152v-8c0-6.627-5.373-12-12-12H180c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h216c6.627 0 12-5.373 12-12z"/></svg>`,b1=`<svg xmlns="http://www.w3.org/2000/svg" style="height: 18px;" viewBox="0 0 448 512" role="img" aria-label="${G("tooltip.menu")}"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`,x1=class{constructor(e,i){this.focusBlurInProgress=!1;var r,a,c;this.options=P(f(P({},Xf()),{macros:Gt(),registers:Pu()}),Yf(i)),this.eventController=new AbortController;const p=this.eventController.signal;i.eventSink&&(this.host=i.eventSink),this.element=e,e.mathfield=this,this.blurred=!0,this.keystrokeCaptionVisible=!1,this.suggestionIndex=0,this.inlineShortcutBuffer=[],this.inlineShortcutBufferFlushTimer=0,this.defaultStyle={},this.adoptStyle="left",this.options.defaultMode==="inline-math"?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline"),this.dirty=!1;let m=(a=(r=i.value)!=null?r:this.element.textContent)!=null?a:"";m=m.trim();const b=j0(this.options),w=new Qe({type:"root",mode:b,body:Br(m,{context:this.context})});this.model=new g1(this,b,w),this.undoManager=new Wm(this.model);const E=[];if(E.push("<span contenteditable=true aria-multiline=false part=keyboard-sink class=ML__keyboard-sink autocapitalize=off autocomplete=off autocorrect=off spellcheck=false inputmode=none tabindex=0></span>"),E.push('<span part=container class=ML__container aria-hidden=true style="visibility:hidden">'),E.push("<span part=content class=ML__content>"),E.push(qr(this)),E.push("</span>"),window.mathVirtualKeyboard&&(E.push(`<div part=virtual-keyboard-toggle class=ML__virtual-keyboard-toggle role=button ${this.hasEditableContent?"":'style="display:none;"'} data-l10n-tooltip="tooltip.toggle virtual keyboard">`),E.push(y1),E.push("</div>")),E.push('<div part=menu-toggle class=ML__menu-toggle role=button data-l10n-tooltip="tooltip.menu">'),E.push(b1),E.push("</div>"),E.push("</span>"),E.push("<span class=ML__sr-only>"),E.push("<span role=status aria-live=assertive aria-atomic=true></span>"),E.push("</span>"),this.element.innerHTML=window.MathfieldElement.createHTML(E.join("")),!this.element.children){console.error("%cMathLive 0.98.5: Something went wrong and the mathfield could not be created.%c\nIf you are using Vue, this may be because you are using the runtime-only build of Vue. Make sure to include `runtimeCompiler: true` in your Vue configuration. There may a warning from Vue in the log above.","color:red;font-family:system-ui;font-size:1.2rem;font-weight:bold","color:inherit;font-family:system-ui;font-size:inherit;font-weight:inherit");return}this._l10Subscription=$.subscribe(()=>$.update(this.element)),$.update(this.element),this.field=this.element.querySelector("[part=content]"),this.field.addEventListener("click",N=>N.stopImmediatePropagation(),{capture:!1,signal:p}),this.field.addEventListener("wheel",this,{passive:!1,signal:p}),"PointerEvent"in window?this.field.addEventListener("pointerdown",this,{signal:p}):this.field.addEventListener("mousedown",this,{signal:p}),(c=this.element.querySelector("[part=virtual-keyboard-toggle]"))==null||c.addEventListener("click",()=>{window.mathVirtualKeyboard.visible?window.mathVirtualKeyboard.hide():(window.mathVirtualKeyboard.show({animate:!0}),window.mathVirtualKeyboard.update(Ua(this)))},{signal:p}),this._menu=new Mg(o1(this),{host:this.host}),this.field.addEventListener("contextmenu",this,{signal:p});const I=this.element.querySelector("[part=menu-toggle]");I==null||I.addEventListener("pointerdown",N=>{if(N.currentTarget!==I||this._menu.state!=="closed")return;this.element.classList.add("tracking");const Z=I.getBoundingClientRect();this._menu.modifiers=ya(N),this._menu.show({target:I,location:{x:Z.left,y:Z.bottom},onDismiss:()=>this.element.classList.remove("tracking")}),N.preventDefault(),N.stopPropagation()},{signal:p}),(this.model.atoms.length<=1||this.disabled||this.readOnly&&!this.hasEditableContent||this.userSelect==="none")&&(I.style.display="none"),this.ariaLiveText=this.element.querySelector("[role=status]"),this.keyboardDelegate=s(this.element.querySelector(".ML__keyboard-sink"),this.element,this),window.addEventListener("resize",this,{signal:p}),document.addEventListener("scroll",this,{signal:p}),this.resizeObserver=new ResizeObserver(()=>_i(this)),this.resizeObserver.observe(this.field),window.mathVirtualKeyboard.addEventListener("virtual-keyboard-toggle",this,{signal:p}),Ul&&!$.locale.startsWith(Ul.locale)&&u0($.locale),Ut!=="ready"&&document.fonts.ready.then(()=>os(this)),e.querySelector("[part=container]").style.removeProperty("visibility"),this.undoManager.startRecording(),this.undoManager.snapshot("set-value")}get defaultStyle(){return this._defaultStyle}set defaultStyle(e){this._defaultStyle=e}get effectiveStyle(){if(this.adoptStyle==="none")return this.defaultStyle;const e=this.model.at(this.model.position),i=this.adoptStyle==="right"?e.rightSibling:e;if(!i)return this.defaultStyle;if(i.type==="group"){const r=i.branch("body");return!r||r.length<2?{}:this.adoptStyle==="right"?r[1].computedStyle:r[r.length-1].computedStyle}return i.computedStyle}connectToVirtualKeyboard(){this.connectedToVirtualKeyboard||(this.connectedToVirtualKeyboard=!0,window.addEventListener("message",this,{signal:this.eventController.signal}),window.mathVirtualKeyboard.connect(),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ua(this)),ud(this))}disconnectFromVirtualKeyboard(){this.connectedToVirtualKeyboard&&(window.removeEventListener("message",this),window.mathVirtualKeyboard.disconnect(),this.connectedToVirtualKeyboard=!1,A0())}showMenu(e){var i,r;const a=(r=(i=e==null?void 0:e.location)!=null?i:Cl(this.field))!=null?r:void 0,c=e==null?void 0:e.modifiers,p=this.element.querySelector("[part=container]");return this._menu.show({target:p,location:a,modifiers:c})}get colorMap(){return e=>{var i,r,a;return(a=(r=(i=this.options).colorMap)==null?void 0:r.call(i,e))!=null?a:Be(e)}}get backgroundColorMap(){return e=>{var i,r,a,c,p,m;return(m=(p=(r=(i=this.options).backgroundColorMap)==null?void 0:r.call(i,e))!=null?p:(c=(a=this.options).colorMap)==null?void 0:c.call(a,e))!=null?m:At(e)}}get smartFence(){var e;return(e=this.options.smartFence)!=null?e:!1}get readOnly(){var e;return(e=this.options.readOnly)!=null?e:!1}get disabled(){var e,i;return(i=(e=this.host)==null?void 0:e.disabled)!=null?i:!1}get contentEditable(){return this.host?this.host.getAttribute("contenteditable")!=="false":!1}get userSelect(){if(!this.host)return"";const e=getComputedStyle(this.host);return e.getPropertyValue("user-select")||e.getPropertyValue("-webkit-user-select")}get hasEditableContent(){return this.disabled||!this.contentEditable?!1:!this.readOnly||this.hasEditablePrompts}get hasEditablePrompts(){return this.readOnly&&!this.disabled&&this.contentEditable&&this.model.findAtom(e=>e.type==="prompt"&&!e.locked)!==void 0}get isSelectionEditable(){if(this.disabled||!this.contentEditable)return!1;if(!this.readOnly)return!0;const e=this.model.at(this.model.anchor),i=this.model.at(this.model.position),r=Qe.commonAncestor(e,i);return!!((r==null?void 0:r.type)==="prompt"||r!=null&&r.parentPrompt)}get letterShapeStyle(){var e;return(e=this.options.letterShapeStyle)!=null?e:"tex"}get minFontScale(){return this.options.minFontScale}get selectionStyle(){if(this.model.selectionIsCollapsed)return this.effectiveStyle;const e=this.model.getAtoms(this.model.selection);if(e.length===0)return{};const i=P({},e[0].style);for(const r of e)for(const[a,c]of Object.entries(r.style))i[a]!==c&&delete i[a];return i}queryStyle(e){const i=w0(this,e);"verbatimColor"in i&&delete i.verbatimColor,"verbatimBackgroundColor"in i&&delete i.verbatimBackgroundColor;const r=Object.keys(i).length;if(r===0)return"all";if(r>1){for(const w of Object.keys(i)){const E=this.queryStyle({[w]:i[w]});if(E==="none")return"none";if(E==="some")return"some"}return"all"}const a=Object.keys(i)[0],c=i[a];if(this.model.selectionIsCollapsed)return this.effectiveStyle[a]===c?"all":"none";const p=this.model.getAtoms(this.model.selection,{includeChildren:!0});let m=p.length;if(m===0)return"none";let b=0;for(const w of p){if(w.type==="first"){m-=1;continue}w.style[a]===c&&(b+=1)}return b===0?"none":b===m?"all":"some"}get keybindings(){var e,i;if(this._keybindings)return this._keybindings;const[r,a]=x(this.options.keybindings,(e=zl())!=null?e:c0());return((i=zl())==null?void 0:i.score)>0&&(this._keybindings=r,a.length>0&&console.error("MathLive 0.98.5: Invalid keybindings for current keyboard layout",a)),r}get menu(){return this._menu}setOptions(e){var i;this.options=P(P({},this.options),Yf(e)),this._keybindings=void 0,this.options.defaultMode==="inline-math"?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline");let r=this.options.defaultMode;r==="inline-math"&&(r="math"),((i=this.model.root.firstChild)==null?void 0:i.mode)!==r&&(this.model.root.firstChild.mode=r),this.options.readOnly&&this.hasFocus()&&window.mathVirtualKeyboard.visible&&this.executeCommand("hideVirtualKeyboard");const a=Qe.serialize([this.model.root],{expandMacro:!1,defaultMode:this.options.defaultMode});("macros"in e||this.model.getValue()!==a)&&Gn.insert(this.model,a,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",silenceNotifications:!0,mode:"math"}),("value"in e||"macros"in e||"registers"in e||"colorMap"in e||"backgroundColorMap"in e||"letterShapeStyle"in e||"minFontScale"in e||"readOnly"in e||"placeholderSymbol"in e)&&_i(this)}getOptions(e){return Zl(this.options,e)}getOption(e){return Zl(this.options,e)}handleEvent(e){return cl(this,null,function*(){var i;if(co(this)){if($a(e)){if(!Jc(e.origin,(i=this.options.originValidator)!=null?i:"none"))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");const{action:r}=e.data;if(r==="execute-command"){const a=e.data.command;if(Wl(a)==="virtual-keyboard")return;this.executeCommand(a)}else r==="update-state"||(r==="focus"?this.focus({preventScroll:!0}):r==="blur"&&this.blur());return}switch(e.type){case"focus":this.onFocus();break;case"blur":this.onBlur();break;case"mousedown":this.userSelect!=="none"&&lp(this,e);break;case"pointerdown":this.userSelect!=="none"&&(lp(this,e),e.shiftKey===!1&&(yield wp(e,this.element.querySelector("[part=container]"),this._menu))&&sd.stop());break;case"contextmenu":this.userSelect!=="none"&&e.shiftKey===!1&&(yield wp(e,this.element.querySelector("[part=container]"),this._menu))&&sd.stop();break;case"virtual-keyboard-toggle":this.hasFocus()&&ud(this);break;case"resize":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>co(this)&&this.onGeometryChange());break;case"scroll":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>co(this)&&this.onGeometryChange());break;case"wheel":this.onWheel(e);break;default:console.warn("Unexpected event type",e.type)}}})}dispose(){if(!co(this))return;$.unsubscribe(this._l10Subscription),this.keyboardDelegate.dispose(),this.keyboardDelegate=void 0,this.eventController.abort(),this.eventController=void 0,this.resizeObserver.disconnect(),window.mathVirtualKeyboard.removeEventListener("virtual-keyboard-toggle",this),this.disconnectFromVirtualKeyboard(),this.model.dispose();const e=this.element;delete e.mathfield,this.element=void 0,this.host=void 0,this.field=void 0,this.ariaLiveText=void 0,ng(),ui(),Eg()}flushInlineShortcutBuffer(e){if(e!=null||(e={defer:!1}),!e.defer){this.inlineShortcutBuffer=[],clearTimeout(this.inlineShortcutBufferFlushTimer),this.inlineShortcutBufferFlushTimer=0;return}this.options.inlineShortcutTimeout>0&&(clearTimeout(this.inlineShortcutBufferFlushTimer),this.inlineShortcutBufferFlushTimer=setTimeout(()=>this.flushInlineShortcutBuffer(),this.options.inlineShortcutTimeout))}executeCommand(e){return Wl(e)==="virtual-keyboard"?(this.focus({preventScroll:!0}),window.mathVirtualKeyboard.executeCommand(e),requestAnimationFrame(()=>window.mathVirtualKeyboard.update(Ua(this))),!1):Dn(this,e)}get errors(){return Cf(this.model.getValue(),{context:this.context})}getValue(e,i,r){return this.model.getValue(e,i,r)}setValue(e,i){var r;i=i!=null?i:{mode:"math"},i.insertionMode===void 0&&(i.insertionMode="replaceAll"),(i.format===void 0||i.format==="auto")&&(i.format="latex"),(i.mode===void 0||i.mode==="auto")&&(i.mode=(r=Fu(this.model,this.model.position))!=null?r:"math");const a=this.undoManager.canUndo();Gn.insert(this.model,e,i)&&(_i(this),a||this.undoManager.reset(),this.undoManager.snapshot("set-value"))}get expression(){const e=window.MathfieldElement.computeEngine;return e?e.box(e.parse(this.model.getValue("latex-unstyled"))):(console.error("MathLive 0.98.5: no compute engine available. Make sure the Compute Engine library is loaded."),null)}scrollIntoView(){var e;if(!this.element)return;if(this.host){if(this.options.onScrollIntoView)this.options.onScrollIntoView(this);else if(this.host.scrollIntoView({block:"nearest",inline:"nearest"}),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.container===window.document.body){const a=window.mathVirtualKeyboard.boundingRect,c=this.host.getBoundingClientRect();c.bottom>a.top&&((e=window.document.scrollingElement)==null||e.scrollBy(0,c.bottom-a.top+8))}}this.dirty&&mr(this,{interactive:!0});const i=this.field.getBoundingClientRect();let r=null;if(this.model.selectionIsCollapsed)r=Cl(this.field);else{const a=Xc(this);if(a.length>0){let c=-1/0,p=-1/0;for(const m of a)m.right>c&&(c=m.right),m.top<p&&(p=m.top);r={x:c+i.left-this.field.scrollLeft,y:p+i.top-this.field.scrollTop,height:0}}}if(this.host&&r){const a=this.host.getBoundingClientRect(),c=r.y;let p=this.host.scrollTop;c<a.top?p=c-a.top+this.host.scrollTop:c>a.bottom&&(p=c-a.bottom+this.host.scrollTop+r.height),this.host.scroll({top:p,left:0})}if(r){const a=r.x-window.scrollX;let c=this.field.scrollLeft;a<i.left?c=a-i.left+this.field.scrollLeft-20:a>i.right&&(c=a-i.right+this.field.scrollLeft+20),this.field.scroll({top:this.field.scrollTop,left:c})}}insert(e,i){return typeof e!="string"||e.length===0&&((i==null?void 0:i.insertionMode)==="insertBefore"||(i==null?void 0:i.insertionMode)==="insertAfter")||e.length===0&&this.model.selectionIsCollapsed?!1:(this.flushInlineShortcutBuffer(),i=i!=null?i:{mode:"math"},i.focus&&this.focus(),i.feedback&&(window.MathfieldElement.keypressVibration&&Y()&&navigator.vibrate(Na),window.MathfieldElement.playSound("keypress")),e==="\\\\"?q0(this.model):e==="&"?Z0(this.model):this.model.selectionIsCollapsed?Gn.insert(this.model,e,P({style:this.model.at(this.model.position).computedStyle},i)):Gn.insert(this.model,e,i),this.snapshot(`insert-${this.model.at(this.model.position).type}`),_i(this),i.scrollIntoView&&this.scrollIntoView(),!0)}switchMode(e,i="",r=""){var a;if(this.model.mode===e||!this.hasEditableContent||!this.contentEditable||this.disabled)return;const c=this.model.mode;if(this.model.mode=e,!((a=this.host)!=null&&a.dispatchEvent(new Event("mode-change",{bubbles:!0,composed:!0,cancelable:!0})))){this.model.mode=c;return}const p=this.model.mode,{model:m}=this;m.deferNotifications({content:!!r||!!i,selection:!0,type:"insertText"},()=>{let b=!1;if(this.flushInlineShortcutBuffer(),this.stopCoalescingUndo(),i&&e!=="latex"){const w=Br(i,{context:this.context,parseMode:e});m.collapseSelection("forward");const E=m.at(m.position);m.position=m.offsetOf(E.parent.addChildrenAfter(w,E)),b=!0}if(this.model.mode=e,e==="latex"){let w=m.selectionIsCollapsed;Ee(this,"accept");let E,I=m.at(m.position);if(w)E="\\";else{const Z=jr(m.selection);E=this.model.getValue(Z,"latex");const ue=this.model.extractAtoms(Z);ue.length===1&&ue[0].type==="placeholder"&&(E=i,w=!0),I=m.at(Z[0])}const N=new vo(E);I.parent.addChildAfter(N,I),w?m.position=m.offsetOf(N.lastChild):m.setSelection(m.offsetOf(N.firstChild),m.offsetOf(N.lastChild))}else F(m).forEach(w=>{w.isError=!1});if(r){const w=Br(r,{context:this.context,parseMode:p});m.collapseSelection("forward");const E=m.at(m.position);m.position=m.offsetOf(E.parent.addChildrenAfter(w,E)),b=!0}return _i(this),this.undoManager.snapshot(e==="latex"?"insert-latex":"insert"),b}),this.model.mode=e,window.mathVirtualKeyboard.update(Ua(this))}hasFocus(){return!this.blurred}focus(e){var i;this.hasFocus()||(this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),this.onFocus(),this.model.announce("line")),(i=e==null?void 0:e.preventScroll)!=null&&i||this.scrollIntoView()}blur(){this.disconnectFromVirtualKeyboard(),this.hasFocus()&&this.keyboardDelegate.blur()}select(){this.model.selection={ranges:[[0,this.model.lastOffset]]},this.focus()}applyStyle(e,i={}){var r,a;const c={operation:"set",silenceNotifications:!1};Dl(i)?c.range=i:(i.operation==="toggle"&&(c.operation="toggle"),c.range=i.range,c.silenceNotifications=(r=i.silenceNotifications)!=null?r:!1);const p=w0(this,e),m=(a=c.operation)!=null?a:"set";if(c.range===void 0&&this.model.selectionIsCollapsed){if(m==="set"){this.defaultStyle=P(P({},this.defaultStyle),p);return}const b=P({},this.defaultStyle);for(const w of Object.keys(p))b[w]===p[w]?(w==="color"&&delete b.verbatimColor,w==="backgroundColor"&&delete b.verbatimBackgroundColor,delete b[w]):b[w]=p[w];this.defaultStyle=b;return}this.model.deferNotifications({content:!c.silenceNotifications,type:"insertText"},()=>{if(c.range===void 0)for(const b of this.model.selection.ranges)p0(this.model,b,p,{operation:m});else p0(this.model,c.range,p,{operation:m})}),_i(this)}toggleContextMenu(){var e;return this._menu.visible?this._menu.state==="open"?(this._menu.hide(),!0):(this._menu.show({target:this.element.querySelector("[part=container]"),location:(e=this.getCaretPoint())!=null?e:void 0,onDismiss:()=>{var i;return(i=this.element)==null?void 0:i.focus()}}),!0):!1}getCaretPoint(){const e=Cl(this.field);return e?{x:e.x,y:e.y}:null}setCaretPoint(e,i){const r=vh(this,e,i,{bias:0});if(r<0)return!1;const a=this.model.position;return this.model.position=r,this.model.announce("move",a),_i(this),!0}getPrompt(e){const i=this.model.findAtom(r=>r.type==="prompt"&&r.placeholderId===e);return console.assert(i!==void 0,"MathLive 0.98.5: no prompts with matching ID found"),i}getPromptValue(e,i){const r=this.getPrompt(e);if(!r)return"";const a=this.model.offsetOf(r.firstChild),c=this.model.offsetOf(r.lastChild);return this.model.getValue(a,c,i)}getPrompts(e){return this.model.getAllAtoms().filter(i=>i.type!=="prompt"?!1:e?!(e.id&&i.placeholderId!==e.id||e.locked&&i.locked!==e.locked||e.correctness==="undefined"&&i.correctness||e.correctness&&i.correctness!==e.correctness):!0).map(i=>i.placeholderId)}setPromptValue(e,i,r){if(i!==void 0){const a=this.getPrompt(e);if(!a){console.error(`MathLive 0.98.5: unknown prompt ${e}`);return}const c=this.model.getBranchRange(this.model.offsetOf(a),"body");this.model.setSelection(c),this.insert(i,f(P({},r),{insertionMode:"replaceSelection"}))}r!=null&&r.silenceNotifications&&(this.valueOnFocus=this.getValue()),_i(this)}setPromptState(e,i,r){const a=this.getPrompt(e);if(!a){console.error(`MathLive 0.98.5: unknown prompt ${e}`);return}i==="undefined"?a.correctness=void 0:typeof i=="string"&&(a.correctness=i),typeof r=="boolean"&&(a.locked=r,a.captureSelection=r),_i(this)}getPromptState(e){const i=this.getPrompt(e);return i?[i.correctness,i.locked]:(console.error(`MathLive 0.98.5: unknown prompt ${e}`),[void 0,!0])}getPromptRange(e){const i=this.getPrompt(e);return i?this.model.getBranchRange(this.model.offsetOf(i),"body"):(console.error(`MathLive 0.98.5: unknown prompt ${e}`),[0,0])}canUndo(){return this.undoManager.canUndo()}canRedo(){return this.undoManager.canRedo()}popUndoStack(){this.undoManager.pop()}snapshot(e){var i;this.undoManager.snapshot(e)&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ua(this)),(i=this.host)==null||i.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"snapshot"}})))}stopCoalescingUndo(){this.undoManager.stopCoalescing(this.model.selection)}stopRecording(){this.undoManager.stopRecording()}startRecording(){this.undoManager.startRecording()}undo(){var e;this.undoManager.undo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ua(this)),(e=this.host)==null||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}redo(){var e;this.undoManager.redo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ua(this)),(e=this.host)==null||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}resetUndo(){var e;(e=this.undoManager)==null||e.reset()}onSelectionDidChange(){var e,i;const r=this.model;this.keyboardDelegate.setValue(r.getValue(this.model.selection,"latex-expanded"));{const a=r.at(r.position),c=(e=a.mode)!=null?e:j0(this.options);this.model.mode!==c&&(this.model.mode==="latex"?(Ee(this,"accept",{mode:c}),r.position=r.offsetOf(a)):this.switchMode(c))}(i=this.host)==null||i.dispatchEvent(new Event("selection-change",{bubbles:!0,composed:!0})),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ua(this)),ud(this)}onContentWillChange(e){var i,r,a;return(a=(r=this.host)==null?void 0:r.dispatchEvent(new InputEvent("beforeinput",f(P({},e),{data:e.data?e.data:(i=e.inputType)!=null?i:"",cancelable:!0,bubbles:!0,composed:!0}))))!=null?a:!0}onFocus(){this.focusBlurInProgress||!this.blurred||(this.focusBlurInProgress=!0,this.blurred=!1,this.keyboardDelegate.focus(),this.stopCoalescingUndo(),mr(this,{interactive:!0}),this.valueOnFocus=this.model.getValue(),this.hasEditablePrompts&&!this.model.at(this.model.anchor).parentPrompt&&this.executeCommand("moveToNextPlaceholder"),this.focusBlurInProgress=!1)}onBlur(){var e,i,r;if(this.focusBlurInProgress||this.blurred)return;this.focusBlurInProgress=!0,this.stopCoalescingUndo(),this.blurred=!0,this.ariaLiveText.textContent="",mt(this),this.model.getValue()!==this.valueOnFocus&&((e=this.host)==null||e.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),this.disconnectFromVirtualKeyboard(),(i=this.host)==null||i.dispatchEvent(new Event("blur",{bubbles:!1,composed:!0})),(r=this.host)==null||r.dispatchEvent(new UIEvent("focusout",{bubbles:!0,composed:!0})),_i(this),this.focusBlurInProgress=!1,A0();const a=new AbortController,c=a.signal;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&document.addEventListener("visibilitychange",()=>{co(this)&&document.visibilityState==="visible"&&this.focus({preventScroll:!0})},{once:!0,signal:c})},{once:!0,signal:c}),setTimeout(()=>a.abort(),100)}onInput(e){y0(this,e)}onKeystroke(e){return sp(this,e)}onCompositionStart(e){this.model.deleteAtoms(jr(this.model.selection));const i=Cl(this.field);i&&requestAnimationFrame(()=>{mr(this),this.keyboardDelegate.moveTo(i.x,i.y-i.height)})}onCompositionUpdate(e){Bm(this.model,e),_i(this)}onCompositionEnd(e){Nm(this.model),y0(this,e,{simulateKeystroke:!0})}onCut(e){if(!this.isSelectionEditable){this.model.announce("plonk");return}this.model.contentWillChange({inputType:"deleteByCut"})&&(this.stopCoalescingUndo(),Gn.onCopy(this,e),Va(this.model,jr(this.model.selection),"deleteByCut"),this.snapshot("cut"),_i(this))}onCopy(e){Gn.onCopy(this,e)}onPaste(e){let i=this.isSelectionEditable;return i&&(i=Gn.onPaste(this.model.at(this.model.position).mode,this,e.clipboardData)),i||this.model.announce("plonk"),e.preventDefault(),e.stopPropagation(),i}onGeometryChange(){this._menu.hide(),Fe(this),ud(this)}onWheel(e){const i=5*e.deltaX;if(!Number.isFinite(i)||i===0)return;const r=this.field;i<0&&r.scrollLeft===0||i>0&&r.offsetWidth+r.scrollLeft>=r.scrollWidth||(r.scrollBy({top:0,left:i}),e.preventDefault(),e.stopPropagation())}getHTMLElement(e){let i=e;for(;!i.id&&i.hasChildren;)i=e.children[0];return this.field.querySelector(`[data-atom-id="${i.id}"]`)}get context(){var e,i;return{registers:(e=this.options.registers)!=null?e:{},smartFence:this.smartFence,letterShapeStyle:this.letterShapeStyle,minFontScale:this.minFontScale,placeholderSymbol:(i=this.options.placeholderSymbol)!=null?i:"\u25A2",colorMap:r=>this.colorMap(r),backgroundColorMap:r=>this.backgroundColorMap(r),getMacro:r=>rt(r,this.options.macros),atomIdsSettings:{seed:"random",groupNumbers:!1}}}};function Pp(e){if(e&&(e.classList.remove("ML__highlight"),e.children))for(const i of e.children)Pp(i)}function z0(e,i){var r;e&&(!i||((r=e.dataset)==null?void 0:r.atomId)===i?(e.classList.add("ML__highlight"),e.children&&e.children.length>0&&[...e.children].forEach(a=>{a instanceof HTMLElement&&z0(a)})):(e.classList.remove("ML__highlight"),e.children&&e.children.length>0&&[...e.children].forEach(a=>{a instanceof HTMLElement&&z0(a,i)})))}function w1(e,i){var r;if(!M())return;if(window.MathfieldElement.speechEngine!=="amazon"){console.error("MathLive 0.98.5: Use Amazon TTS Engine for synchronized highlighting"),typeof window.MathfieldElement.speakHook=="function"&&window.MathfieldElement.speakHook(i);return}if(!window.AWS){console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");return}const a=new window.AWS.Polly({apiVersion:"2016-06-10"}),c={OutputFormat:"json",VoiceId:(r=window.MathfieldElement.speechEngineVoice)!=null?r:"Joanna",Engine:"standard",Text:i,TextType:"ssml",SpeechMarkTypes:["ssml"]};ul().readAloudElement=e,a.synthesizeSpeech(c,(p,m)=>{if(p){console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${p}`);return}if(!(m!=null&&m.AudioStream)){console.log("polly.synthesizeSpeech():",m);return}const b=new TextDecoder("utf-8").decode(new Uint8Array(m.AudioStream));ul().readAloudMarks=b.split(`
|
|
|
`).map(w=>w?JSON.parse(w):{}),ul().readAloudTokens=[];for(const w of ul().readAloudMarks)w.value&&ul().readAloudTokens.push(w.value);ul().readAloudCurrentMark="",c.OutputFormat="mp3",c.SpeechMarkTypes=[],a.synthesizeSpeech(c,(w,E)=>{if(w){console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech("${i}") error:${w}`);return}if(!(E!=null&&E.AudioStream))return;const I=new Uint8Array(E.AudioStream),N=new Blob([I.buffer],{type:"audio/mpeg"}),Z=URL.createObjectURL(N),ue=ul();ue.readAloudAudio?ue.readAloudAudio.pause():(ue.readAloudAudio=new Audio,ue.readAloudAudio.addEventListener("ended",()=>{const me=ue.readAloudMathfield;ue.readAloudStatus="ended",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),me?(mr(me),ue.readAloudElement=null,ue.readAloudMathfield=null,ue.readAloudTokens=[],ue.readAloudMarks=[],ue.readAloudCurrentMark=""):Pp(ue.readAloudElement)}),ue.readAloudAudio.addEventListener("timeupdate",()=>{let me="";const Ge=ue.readAloudAudio.currentTime*1e3+100;for(const Lt of ue.readAloudMarks)Lt.time<Ge&&(me=Lt.value);ue.readAloudCurrentMark!==me&&(ue.readAloudCurrentToken=me,me&&me===ue.readAloudFinalToken?ue.readAloudAudio.pause():(ue.readAloudCurrentMark=me,z0(ue.readAloudElement,ue.readAloudCurrentMark)))})),ue.readAloudAudio.src=Z,ue.readAloudStatus="playing",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),ue.readAloudAudio.play()})})}M()||console.error('MathLive 0.98.5: this version of the MathLive library is for use in the browser. A subset of the API is available on the server side in the "mathlive-ssr" library. If using server side rendering (with React for example) you may want to do a dynamic import of the MathLive library inside a `useEffect()` call.');var yn=new WeakMap,S1=.5,ll={letterShapeStyle:"mf.letterShapeStyle = ...",horizontalSpacingScale:'Removed. Use `"thinmuskip"`, `"medmuskip"`, and `"thickmuskip"` registers ',macros:"mf.macros = ...",registers:"mf.registers = ...",backgroundColorMap:"mf.backgroundColorMap = ...",colorMap:"mf.colorMap = ...",enablePopover:"mf.popoverPolicy = ...",mathModeSpace:"mf.mathModeSpace = ...",placeholderSymbol:"mf.placeholderSymbol = ...",readOnly:"mf.readOnly = ...",removeExtraneousParentheses:"mf.removeExtraneousParentheses = ...",scriptDepth:"mf.scriptDepth = ...",smartFence:"mf.smartFence = ...",smartMode:"mf.smartMode = ...",smartSuperscript:"mf.smartSuperscript = ...",inlineShortcutTimeout:"mf.inlineShortcutTimeout = ...",inlineShortcuts:"mf.inlineShortcuts = ...",keybindings:"mf.keybindings = ...",virtualKeyboardMode:"mf.mathVirtualKeyboardPolicy = ...",customVirtualKeyboardLayers:"mathVirtualKeyboard.layers = ...",customVirtualKeyboards:"mathVirtualKeyboard.layouts = ...",keypressSound:"mathVirtualKeyboard.keypressSound = ...",keypressVibration:"mathVirtualKeyboard.keypressVibration = ...",plonkSound:"mathVirtualKeyboard.plonkSound = ...",virtualKeyboardContainer:"mathVirtualKeyboard.container = ...",virtualKeyboardLayout:"mathVirtualKeyboard.alphabeticLayout = ...",virtualKeyboardTheme:"No longer supported",virtualKeyboardToggleGlyph:"No longer supported",virtualKeyboardToolbar:"mathVirtualKeyboard.editToolbar = ...",virtualKeyboards:"Use `mathVirtualKeyboard.layouts`",speechEngine:"`MathfieldElement.speechEngine`",speechEngineRate:"`MathfieldElement.speechEngineRate`",speechEngineVoice:"`MathfieldElement.speechEngineVoice`",textToSpeechMarkup:"`MathfieldElement.textToSpeechMarkup`",textToSpeechRules:"`MathfieldElement.textToSpeechRules`",textToSpeechRulesOptions:"`MathfieldElement.textToSpeechRulesOptions`",readAloudHook:"`MathfieldElement.readAloudHook`",speakHook:"`MathfieldElement.speakHook`",computeEngine:"`MathfieldElement.computeEngine`",fontsDirectory:"`MathfieldElement.fontsDirectory`",soundsDirectory:"`MathfieldElement.soundsDirectory`",createHTML:"`MathfieldElement.createHTML`",onExport:"`MathfieldElement.onExport`",onInlineShortcut:"`MathfieldElement.onInlineShortcut`",onScrollIntoView:"`MathfieldElement.onScrollIntoView`",locale:"MathfieldElement.locale = ...",strings:"MathfieldElement.strings = ...",decimalSeparator:"MathfieldElement.decimalSeparator = ...",fractionNavigationOrder:"MathfieldElement.fractionNavigationOrder = ..."},Zr=class nu extends HTMLElement{static get formAssociated(){return fc()}static get optionsAttributes(){return{"default-mode":"string","letter-shape-style":"string","min-font-scale":"number","popover-policy":"string","math-mode-space":"string","read-only":"boolean","remove-extraneous-parentheses":"on/off","smart-fence":"on/off","smart-mode":"on/off","smart-superscript":"on/off","inline-shortcut-timeout":"string","script-depth":"string",placeholder:"string","virtual-keyboard-target-origin":"string","math-virtual-keyboard-policy":"string"}}static get observedAttributes(){return[...Object.keys(this.optionsAttributes),"contenteditable","disabled","readonly","read-only"]}static get fontsDirectory(){return this._fontsDirectory}static set fontsDirectory(i){i!==this._fontsDirectory&&(this._fontsDirectory=i,qt())}get fontsDirectory(){throw new Error("Use MathfieldElement.fontsDirectory instead")}set fontsDirectory(i){throw new Error("Use MathfieldElement.fontsDirectory instead")}static get soundsDirectory(){return this._soundsDirectory}static set soundsDirectory(i){this._soundsDirectory=i,this.audioBuffers={}}get soundsDirectory(){throw new Error("Use MathfieldElement.soundsDirectory instead")}set soundsDirectory(i){throw new Error("Use MathfieldElement.soundsDirectory instead")}static get keypressSound(){return this._keypressSound}static set keypressSound(i){var r,a,c;this.audioBuffers={},i===null?this._keypressSound={spacebar:null,return:null,delete:null,default:null}:typeof i=="string"?this._keypressSound={spacebar:i,return:i,delete:i,default:i}:typeof i=="object"&&"default"in i&&(this._keypressSound={spacebar:(r=i.spacebar)!=null?r:i.default,return:(a=i.return)!=null?a:i.default,delete:(c=i.delete)!=null?c:i.default,default:i.default})}static get plonkSound(){return this._plonkSound}static set plonkSound(i){this.audioBuffers={},this._plonkSound=i}static get audioContext(){return this._audioContext||(this._audioContext=new AudioContext),this._audioContext}static get speechEngine(){return this._speechEngine}static set speechEngine(i){this._speechEngine=i}static get speechEngineRate(){return this._speechEngineRate}static set speechEngineRate(i){this._speechEngineRate=i}static get speechEngineVoice(){return this._speechEngineVoice}static set speechEngineVoice(i){this._speechEngineVoice=i}static get textToSpeechMarkup(){return this._textToSpeechMarkup}static set textToSpeechMarkup(i){this._textToSpeechMarkup=i}static get textToSpeechRules(){return this._textToSpeechRules}static set textToSpeechRules(i){this._textToSpeechRules=i}static get textToSpeechRulesOptions(){return this._textToSpeechRulesOptions}static set textToSpeechRulesOptions(i){this._textToSpeechRulesOptions=i}static get locale(){return $.locale}static set locale(i){i==="auto"&&(i=navigator.language.slice(0,5)),$.locale=i}get locale(){throw new Error("Use MathfieldElement.locale instead")}set locale(i){throw new Error("Use MathfieldElement.locale instead")}static get strings(){return $.strings}static set strings(i){$.merge(i)}get strings(){throw new Error("Use MathfieldElement.strings instead")}set strings(i){throw new Error("Use MathfieldElement.strings instead")}static get decimalSeparator(){return this._decimalSeparator}static set decimalSeparator(i){this._decimalSeparator=i,this._computeEngine&&(this._computeEngine.latexOptions.decimalMarker=this.decimalSeparator===","?"{,}":".")}get decimalSeparator(){throw new Error("Use MathfieldElement.decimalSeparator instead")}set decimalSeparator(i){throw new Error("Use MathfieldElement.decimalSeparator instead")}static get computeEngine(){var i,r;if(this._computeEngine===void 0){const a=(i=window[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:i.ComputeEngine;if(!a)return null;this._computeEngine=new a,this._computeEngine&&this.decimalSeparator===","&&(this._computeEngine.latexOptions.decimalMarker="{,}")}return(r=this._computeEngine)!=null?r:null}static set computeEngine(i){this._computeEngine=i}get computeEngine(){throw new Error("Use MathfieldElement.computeEngine instead")}set computeEngine(i){throw new Error("Use MathfieldElement.computeEngine instead")}static get isFunction(){return typeof this._isFunction!="function"?()=>!1:this._isFunction}static set isFunction(i){this._isFunction=i}static loadSound(i){return cl(this,null,function*(){delete this.audioBuffers[i];let r="";switch(i){case"keypress":r=this._keypressSound.default;break;case"return":r=this._keypressSound.return;break;case"spacebar":r=this._keypressSound.spacebar;break;case"delete":r=this._keypressSound.delete;break;case"plonk":r=this.plonkSound;break}if(typeof r!="string")return;r=r.trim();const a=this.soundsDirectory;if(!(a==null||a==="null"||r==="none"||r==="null"))try{const p=yield(yield fetch(yield gi(`${a}/${r}`))).arrayBuffer(),m=yield this.audioContext.decodeAudioData(p);this.audioBuffers[i]=m}catch(c){}})}static playSound(i){return cl(this,null,function*(){if((this.audioContext.state==="suspended"||this.audioContext.state==="interrupted")&&(yield this.audioContext.resume()),this.audioBuffers[i]||(yield this.loadSound(i)),!this.audioBuffers[i])return;const r=this.audioContext.createBufferSource();r.buffer=this.audioBuffers[i];const a=this.audioContext.createGain();a.gain.value=S1,r.connect(a).connect(this.audioContext.destination),r.start()})}constructor(i){if(super(),i){const r=[];for(const a of Object.keys(i))if(ll[a])if(ll[a].startsWith("mf."))if(ll[a].startsWith(`mf.${a}`))r.push(`Option \`${a}\` cannot be used as a constructor option. Use ${ll[a]}`);else{const c=ll[a].match(/([a-zA-Z]+) =/);r.push(`Option \`${a}\` has been renamed \`${c[1]}\``)}else r.push(`Option \`${a}\` cannot be used as a constructor option. Use ${ll[a]}`);if(r.length>0){console.group("%cMathLive 0.98.5: %cInvalid Options","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn("Some of the options passed to `new MathfieldElement(...)` are invalid. \n See https://cortexjs.io/mathlive/changelog/ for details.");for(const a of r)console.warn(a);console.groupEnd()}}if(fc()&&(this._internals=this.attachInternals(),this._internals.role="math",this._internals.ariaLabel="math input field",this._internals.ariaMultiLine="false"),this.attachShadow({mode:"open",delegatesFocus:!0}),this.shadowRoot&&"adoptedStyleSheets"in this.shadowRoot){this.shadowRoot.adoptedStyleSheets=[fo("core"),fo("mathfield"),fo("mathfield-element"),fo("ui"),fo("menu")],this.shadowRoot.appendChild(document.createElement("span"));const r=document.createElement("slot");r.style.display="none",this.shadowRoot.appendChild(r)}else this.shadowRoot.innerHTML="<style>"+ho("core")+ho("mathfield")+ho("mathfield-element")+ho("ui")+ho("menu")+'</style><span></span><slot style="display:none"></slot>';i&&this._setOptions(i),this.shadowRoot.addEventListener("slotchange",()=>{var r;const a=this.shadowRoot.querySelector("slot:not([name])");this.value=(r=a==null?void 0:a.assignedNodes().map(c=>c.nodeType===3?c.textContent:"").join("").trim())!=null?r:""})}showMenu(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.showMenu(i))!=null?a:!1}get mathVirtualKeyboard(){throw new Error("The `mathVirtualKeyboard` property is not available on the MathfieldElement. Use `window.mathVirtualKeyboard` instead.")}onPointerDown(){window.addEventListener("pointerup",i=>{var r;i.target===this&&!((r=this._mathfield)!=null&&r.disabled)&&this.dispatchEvent(new MouseEvent("click",{altKey:i.altKey,button:i.button,buttons:i.buttons,clientX:i.clientX,clientY:i.clientY,ctrlKey:i.ctrlKey,metaKey:i.metaKey,movementX:i.movementX,movementY:i.movementY,relatedTarget:i.relatedTarget,screenX:i.screenX,screenY:i.screenY,shiftKey:i.shiftKey}))},{once:!0})}getPromptValue(i,r){var a,c;return(c=(a=this._mathfield)==null?void 0:a.getPromptValue(i,r))!=null?c:""}setPromptValue(i,r,a){var c;(c=this._mathfield)==null||c.setPromptValue(i,r,a)}getPromptRange(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.getPromptRange(i))!=null?a:null}getPrompts(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.getPrompts(i))!=null?a:[]}get form(){var i;return(i=this._internals)==null?void 0:i.form}get name(){var i;return(i=this.getAttribute("name"))!=null?i:""}get type(){return this.localName}get mode(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.model.mode)!=null?r:this.defaultMode==="text"?"text":"math"}set mode(i){var r;(r=this._mathfield)==null||r.switchMode(i)}get expression(){if(this._mathfield)return window[Symbol.for("io.cortexjs.compute-engine")]?this._mathfield.expression:(console.error(`MathLive 0.98.5: The CortexJS Compute Engine library is not available.
|
|
|
|
|
|
Load the library, for example with:
|
|
|
|
|
|
import "https://unpkg.com/@cortex-js/compute-engine?module"`),null)}set expression(i){var r,a;if(!this._mathfield)return;const c=(a=(r=nu.computeEngine)==null?void 0:r.box(i).latex)!=null?a:null;c!==null&&this._mathfield.setValue(c),window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`MathLive 0.98.5: The CortexJS Compute Engine library is not available.
|
|
|
|
|
|
Load the library, for example with:
|
|
|
|
|
|
import "https://unpkg.com/@cortex-js/compute-engine?module"`)}get errors(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.errors)!=null?r:[]}_getOptions(i){return this._mathfield?Zl(this._mathfield.options,i):yn.has(this)?P({},Zl(P(P({},Xf()),Yf(yn.get(this).options)),i)):null}getOptions(i){return console.warn("%cMathLive 0.98.5: %cDeprecated Usage%c\n `mf.getOptions()` is deprecated. Read the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._mathfield?Zl(this._mathfield.options,i):yn.has(this)?Zl(P(P({},Xf()),Yf(yn.get(this).options)),i):null}reflectAttributes(){const i=Xf(),r=this._getOptions();Object.keys(nu.optionsAttributes).forEach(a=>{const c=ko(a);nu.optionsAttributes[a]==="on/off"?i[c]!==r[c]?this.setAttribute(a,r[c]?"on":"off"):this.removeAttribute(a):i[c]!==r[c]&&(nu.optionsAttributes[a]==="boolean"?r[c]?this.setAttribute(a,""):this.removeAttribute(a):(typeof r[c]=="string"||typeof r[c]=="number")&&this.setAttribute(a,r[c].toString()))})}getOption(i){return console.warn("%cMathLive 0.98.5: %cDeprecated Usage%c\n `mf.getOption()` is deprecated. Read the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._getOptions([i])[i]}_getOption(i){return this._getOptions([i])[i]}_setOptions(i){if(this._mathfield)this._mathfield.setOptions(i);else if(yn.has(this)){const r=P(P({},yn.get(this).options),i);yn.set(this,f(P({},yn.get(this)),{selection:{ranges:r.readOnly?[[0,0]]:[[0,-1]]},options:r}))}else yn.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:i,menuItems:void 0});this.reflectAttributes()}setOptions(i){console.group("%cMathLive 0.98.5: %cDeprecated Usage","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn(" `mf.setOptions()` is deprecated. Set the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.");for(const r of Object.keys(i))ll[r]&&console.warn(`\`mf.setOptions({${r}:...})\` -> ${ll[r]}`);console.groupEnd(),this._setOptions(i)}executeCommand(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.executeCommand(i))!=null?a:!1}getValue(i,r,a){var c,p;if(this._mathfield)return this._mathfield.model.getValue(i,r,a);if(yn.has(this)){let m,b,w;if(Ou(i)?([m,b]=i.ranges[0],w=r):Dl(i)?([m,b]=i,w=r):Ra(i)&&Ra(r)?(m=i,b=r,w=a):(m=0,b=-1,w=i),(w===void 0||w==="latex")&&m===0&&b===-1)return(p=(c=yn.get(this).value)!=null?c:this.textContent)!=null?p:""}return""}setValue(i,r){if(this._mathfield&&i!==void 0){r!=null||(r={silenceNotifications:!0,mode:"math"}),this._mathfield.setValue(i,r);return}if(yn.has(this)){const c=yn.get(this).options;yn.set(this,{value:i,selection:{ranges:[[-1,-1]],direction:"forward"},options:c,menuItems:void 0});return}const a=kh(this);yn.set(this,{value:i,selection:{ranges:[[-1,-1]],direction:"forward"},options:a,menuItems:void 0})}hasFocus(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.hasFocus())!=null?r:!1}focus(){var i;(i=this._mathfield)==null||i.focus()}blur(){var i;(i=this._mathfield)==null||i.blur()}select(){var i;(i=this._mathfield)==null||i.select()}insert(i,r){var a,c;return(c=(a=this._mathfield)==null?void 0:a.insert(i,r))!=null?c:!1}applyStyle(i,r){var a;return(a=this._mathfield)==null?void 0:a.applyStyle(i,r)}queryStyle(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.queryStyle(i))!=null?a:"none"}get caretPoint(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.getCaretPoint())!=null?r:null}set caretPoint(i){var r;i&&((r=this._mathfield)==null||r.setCaretPoint(i.x,i.y))}setCaretPoint(i,r){var a,c;return(c=(a=this._mathfield)==null?void 0:a.setCaretPoint(i,r))!=null?c:!1}offsetFromPoint(i,r,a){return this._mathfield?vh(this._mathfield,i,r,a):-1}hitboxFromOffset(i){if(!this._mathfield)return null;const r=this._mathfield.model.at(i);if(!r)return null;const a=Ml(this._mathfield,r);return a?new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top):null}resetUndo(){var i;(i=this._mathfield)==null||i.resetUndo()}canUndo(){return this._mathfield?this._mathfield.canUndo():!1}canRedo(){return this._mathfield?this._mathfield.canRedo():!1}handleEvent(i){var r,a,c,p;n.state==="closed"&&((a=(r=this._mathfield)==null?void 0:r.menu)==null?void 0:a.state)==="closed"&&(i.type==="pointerdown"&&this.onPointerDown(),i.type==="focus"&&((c=this._mathfield)==null||c.focus()),i.type==="blur"&&((p=this._mathfield)==null||p.blur()))}connectedCallback(){var i,r,a,c;const p=window.getComputedStyle(this),m=this.shadowRoot,b=p.userSelect!=="none";if(b)m.host.addEventListener("pointerdown",this,!0);else{const I=m.querySelector("span");I.style.pointerEvents="none"}m.host.addEventListener("focus",this,!0),m.host.addEventListener("blur",this,!0),fc()||(this.hasAttribute("role")||this.setAttribute("role","math"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","math input field"),this.setAttribute("aria-multiline","false")),b&&!this.hasAttribute("contenteditable")&&this.setAttribute("contenteditable","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const w=m.querySelector("slot:not([name])");if(w)try{this._style=w.assignedElements().filter(I=>I.tagName.toLowerCase()==="style").map(I=>I.textContent).join("")}catch(I){console.error(I)}if(this._style){const I=document.createElement("style");I.textContent=this._style,m.appendChild(I)}let E="";if(this.hasAttribute("value")?E=this.getAttribute("value"):E=(i=w==null?void 0:w.assignedNodes().map(I=>I.nodeType===3?I.textContent:"").join("").trim())!=null?i:"",this._mathfield=new x1(m.querySelector(":host > span"),f(P({},(a=(r=yn.get(this))==null?void 0:r.options)!=null?a:kh(this)),{eventSink:this,value:E})),!yn.has(this)){this.upgradeProperty("disabled"),this.upgradeProperty("readonly");for(const I of Object.keys(nu.optionsAttributes))this.upgradeProperty(ko(I))}if(!((c=this._mathfield)!=null&&c.model)){this._mathfield=null;return}if(yn.has(this)){const I=this._mathfield,N=yn.get(this),Z=N.menuItems;I.model.deferNotifications({content:!1,selection:!1},()=>{const ue=N.value;ue!==void 0&&I.setValue(ue),I.model.selection=N.selection,yn.delete(this)}),Z&&(this.menuItems=Z)}window.queueMicrotask(()=>{this.isConnected&&this.dispatchEvent(new Event("mount",{cancelable:!1,bubbles:!0,composed:!0}))}),Zi()}disconnectedCallback(){var i,r;if(this.shadowRoot.host.removeEventListener("pointerdown",this,!0),!this._mathfield)return;window.queueMicrotask(()=>this.dispatchEvent(new Event("unmount",{cancelable:!1,bubbles:!0,composed:!0})));const a=Zl(this._mathfield.options,Object.keys(nu.optionsAttributes).map(c=>ko(c)));yn.set(this,{value:this._mathfield.getValue(),selection:this._mathfield.model.selection,menuItems:(r=(i=this._mathfield.menu)==null?void 0:i.menuItems)!=null?r:void 0,options:a}),this._mathfield.dispose(),this._mathfield=null}upgradeProperty(i){if(this.hasOwnProperty(i)){const r=this[i];delete this[i],(i==="readonly"||i==="read-only")&&(i="readOnly"),this[i]=r}}attributeChangedCallback(i,r,a){if(r===a)return;const c=a!==null;switch(i){case"contenteditable":_i(this._mathfield);break;case"disabled":this.disabled=c;break;case"read-only":case"readonly":this.readOnly=c;break;default:}}get readonly(){return this.hasAttribute("readonly")||this.hasAttribute("read-only")}set readonly(i){const r=!!i;r?(this.setAttribute("readonly",""),fc()?this._internals.ariaReadOnly="true":this.setAttribute("aria-readonly","true"),this.setAttribute("aria-readonly","true")):(fc()?this._internals.ariaReadOnly="false":this.removeAttribute("aria-readonly"),this.removeAttribute("readonly"),this.removeAttribute("read-only")),this._setOptions({readOnly:r})}get disabled(){return this.hasAttribute("disabled")}set disabled(i){var r;const a=!!i;a?this.setAttribute("disabled",""):this.removeAttribute("disabled"),fc()?this._internals.ariaDisabled=a?"true":"false":this.setAttribute("aria-disabled",a?"true":"false"),a&&((r=this._mathfield)!=null&&r.hasFocus)&&window.mathVirtualKeyboard.visible&&this._mathfield.executeCommand("hideVirtualKeyboard")}get value(){return this.getValue()}set value(i){this.setValue(i)}get defaultMode(){return this._getOption("defaultMode")}set defaultMode(i){this._setOptions({defaultMode:i})}get macros(){return this._getOption("macros")}set macros(i){this._setOptions({macros:i})}get registers(){const i=this;return new Proxy({},{get:(r,a)=>{if(typeof a=="string")return i._getOption("registers")[a]},set(r,a,c){return typeof a!="string"?!1:(i._setOptions({registers:f(P({},i._getOption("registers")),{[a]:c})}),!0)}})}set registers(i){this._setOptions({registers:i})}get colorMap(){return this._getOption("colorMap")}set colorMap(i){this._setOptions({colorMap:i})}get backgroundColorMap(){return this._getOption("backgroundColorMap")}set backgroundColorMap(i){this._setOptions({backgroundColorMap:i})}get letterShapeStyle(){return this._getOption("letterShapeStyle")}set letterShapeStyle(i){this._setOptions({letterShapeStyle:i})}get minFontScale(){return this._getOption("minFontScale")}set minFontScale(i){this._setOptions({minFontScale:i})}get smartMode(){return this._getOption("smartMode")}set smartMode(i){this._setOptions({smartMode:i})}get smartFence(){return this._getOption("smartFence")}set smartFence(i){this._setOptions({smartFence:i})}get smartSuperscript(){return this._getOption("smartSuperscript")}set smartSuperscript(i){this._setOptions({smartSuperscript:i})}get scriptDepth(){return this._getOption("scriptDepth")}set scriptDepth(i){this._setOptions({scriptDepth:i})}get removeExtraneousParentheses(){return this._getOption("removeExtraneousParentheses")}set removeExtraneousParentheses(i){this._setOptions({removeExtraneousParentheses:i})}get mathModeSpace(){return this._getOption("mathModeSpace")}set mathModeSpace(i){this._setOptions({mathModeSpace:i})}get placeholderSymbol(){return this._getOption("placeholderSymbol")}set placeholderSymbol(i){this._setOptions({placeholderSymbol:i})}get popoverPolicy(){return this._getOption("popoverPolicy")}set popoverPolicy(i){this._setOptions({popoverPolicy:i})}get environmentPopoverPolicy(){return this._getOption("environmentPopoverPolicy")}set environmentPopoverPolicy(i){this._setOptions({environmentPopoverPolicy:i})}get menuItems(){var i,r,a;return this._mathfield?(i=this._mathfield.menu._menuItems.map(c=>c.menuItem))!=null?i:[]:(a=(r=yn.get(this))==null?void 0:r.menuItems)!=null?a:[]}set menuItems(i){var r;if(this._mathfield){const a=(r=this._mathfield.element)==null?void 0:r.querySelector("[part=menu-toggle]");a&&(a.style.display=i.length===0?"none":""),this._mathfield.menu.menuItems=i}yn.has(this)?yn.set(this,f(P({},yn.get(this)),{menuItems:i})):yn.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:kh(this),menuItems:i})}get mathVirtualKeyboardPolicy(){return this._getOption("mathVirtualKeyboardPolicy")}set mathVirtualKeyboardPolicy(i){this._setOptions({mathVirtualKeyboardPolicy:i})}get inlineShortcuts(){return this._getOption("inlineShortcuts")}set inlineShortcuts(i){this._setOptions({inlineShortcuts:i})}get inlineShortcutTimeout(){return this._getOption("inlineShortcutTimeout")}set inlineShortcutTimeout(i){this._setOptions({inlineShortcutTimeout:i})}get keybindings(){return this._getOption("keybindings")}set keybindings(i){this._setOptions({keybindings:i})}get onInlineShortcut(){return this._getOption("onInlineShortcut")}set onInlineShortcut(i){this._setOptions({onInlineShortcut:i})}get onScrollIntoView(){return this._getOption("onScrollIntoView")}set onScrollIntoView(i){this._setOptions({onScrollIntoView:i})}get onExport(){return this._getOption("onExport")}set onExport(i){this._setOptions({onExport:i})}get readOnly(){return this._getOption("readOnly")}set readOnly(i){this._setOptions({readOnly:i})}get isSelectionEditable(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.isSelectionEditable)!=null?r:!1}setPromptState(i,r,a){var c;(c=this._mathfield)==null||c.setPromptState(i,r,a)}getPromptState(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.getPromptState(i))!=null?a:[void 0,!0]}get virtualKeyboardTargetOrigin(){return this._getOption("virtualKeyboardTargetOrigin")}set virtualKeyboardTargetOrigin(i){this._setOptions({virtualKeyboardTargetOrigin:i})}get selection(){return this._mathfield?this._mathfield.model.selection:yn.has(this)?yn.get(this).selection:{ranges:[[0,0]],direction:"forward"}}set selection(i){if(typeof i=="number"&&(i={ranges:[[i,i]]}),this._mathfield){this._mathfield.model.selection=i,_i(this._mathfield);return}if(yn.has(this)){yn.set(this,f(P({},yn.get(this)),{selection:i}));return}yn.set(this,{value:void 0,selection:i,options:kh(this),menuItems:void 0})}get selectionIsCollapsed(){const i=this.selection;return i.ranges.length===1&&i.ranges[0][0]===i.ranges[0][1]}get position(){return this._mathfield?this._mathfield.model.position:yn.has(this)?yn.get(this).selection.ranges[0][0]:0}set position(i){if(this._mathfield&&(this._mathfield.model.position=i,_i(this._mathfield)),yn.has(this)){yn.set(this,f(P({},yn.get(this)),{selection:{ranges:[[i,i]]}}));return}yn.set(this,{value:void 0,selection:{ranges:[[i,i]]},options:kh(this),menuItems:void 0})}getOffsetDepth(i){var r,a;return this._mathfield?((a=(r=this._mathfield.model.at(i))==null?void 0:r.treeDepth)!=null?a:2)-2:0}get lastOffset(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.model.lastOffset)!=null?r:-1}};Zr.version="0.98.5",Zr._fontsDirectory="./fonts",Zr._soundsDirectory="./sounds",Zr.keypressVibration=!0,Zr._keypressSound={spacebar:"keypress-spacebar.wav",return:"keypress-return.wav",delete:"keypress-delete.wav",default:"keypress-standard.wav"},Zr._plonkSound="plonk.wav",Zr.audioBuffers={},Zr.createHTML=e=>e,Zr._speechEngineRate="100%",Zr._speechEngineVoice="Joanna",Zr._textToSpeechMarkup="",Zr._textToSpeechRules="mathlive",Zr._textToSpeechRulesOptions={},Zr.speakHook=f1,Zr.readAloudHook=w1,Zr._decimalSeparator=".",Zr.fractionNavigationOrder="numerator-denominator",Zr._isFunction=e=>{var i,r;const a=window.MathfieldElement.computeEngine;return(r=(i=a==null?void 0:a.parse(e).domain)==null?void 0:i.isFunction)!=null?r:!1};var Eh=Zr;function ko(e){return e.replace(/[^a-zA-Z\d]+(.)/g,(i,r)=>r.toUpperCase())}function kh(e){const i={readOnly:!1},r=Eh.optionsAttributes;return Object.keys(r).forEach(a=>{if(e.hasAttribute(a)){const c=e.getAttribute(a);a==="placeholder"?i.contentPlaceholder=c!=null?c:"":r[a]==="boolean"?i[ko(a)]=!0:r[a]==="on/off"?c==="on"?i[ko(a)]=!0:c==="off"?i[ko(a)]=!1:i[ko(a)]=void 0:r[a]==="number"?i[ko(a)]=Number.parseFloat(c!=null?c:"0"):i[ko(a)]=c}}),i}function fc(){return!(!("ElementInternals"in window)||!HTMLElement.prototype.attachInternals||!("role"in window.ElementInternals.prototype))}var Op=Eh,Fp,Bp,Np,$p;if(M()&&!((Fp=window.customElements)!=null&&Fp.get("math-field"))){(Np=window[Bp=Symbol.for("io.cortexjs.mathlive")])!=null||(window[Bp]={});const e=window[Symbol.for("io.cortexjs.mathlive")];e.version="0.98.5",window.MathfieldElement=Eh,($p=window.customElements)==null||$p.define("math-field",Eh)}function E1(e,i,r){let a=r,c=0;const p=e.length;for(;a<i.length;){const m=i[a];if(c<=0&&i.slice(a,a+p)===e)return a;m==="\\"?a++:m==="{"?c++:m==="}"&&c--,a++}return-1}function pd(e,i,r,a,c="latex"){const p=[];for(const m of e)if(m.type==="text"){const b=m.data;let w=!0,E=0,I;I=b.indexOf(i),I!==-1&&(E=I,E>0&&p.push({type:"text",data:b.slice(0,E)}),w=!1);let N=!1;for(;!N;){if(w){if(I=b.indexOf(i,E),I===-1){N=!0;break}E!==I&&p.push({type:"text",data:b.slice(E,I)}),E=I}else{if(I=E1(r,b,E+i.length),I===-1){N=!0;break}let Z=b.slice(E+i.length,I);c==="ascii-math"&&([,Z]=Bu(Z,{format:"ascii-math"})),p.push({type:"math",data:Z,rawData:b.slice(E,I+r.length),mathstyle:a}),E=I+r.length}w=!w}E<b.length&&p.push({type:"text",data:b.slice(E)})}else p.push(m);return p}function Kp(e,i,r){let a=[{type:"text",data:e}];return i!=null&&i.inline&&i.inline.forEach(([c,p])=>{a=pd(a,c,p,"textstyle")}),i!=null&&i.display&&i.display.forEach(([c,p])=>{a=pd(a,c,p,"displaystyle")}),r!=null&&r.inline&&r.inline.forEach(([c,p])=>{a=pd(a,c,p,"textstyle","ascii-math")}),r!=null&&r.display&&r.display.forEach(([c,p])=>{a=pd(a,c,p,"displaystyle","ascii-math")}),a}function k1(e,i){const r=document.createElement("span");r.setAttribute("translate","no");try{const a="<math xmlns='http://www.w3.org/1998/Math/MathML'>"+i.renderToMathML(e)+"</math>";r.innerHTML=window.MathfieldElement.createHTML(a)}catch(a){console.error(`MathLive 0.98.5: Could not convert "${e}"' to MathML with ${a}`),r.textContent=e}return r.className="ML__sr-only",r}function T1(e,i,r,a){try{const c=i.renderToMarkup(e,{mathstyle:r,format:"html"}),p=document.createElement("span");return p.dataset.latex=e,p.style.display=r==="displaystyle"?"flex":"inline-flex",p.setAttribute("aria-hidden","true"),p.setAttribute("translate","no"),p.innerHTML=window.MathfieldElement.createHTML(c),p}catch(c){if(console.error("Could not parse'"+e+"' with ",c),a)return document.createTextNode(e)}return null}function dc(e,i,r,a){var c;const p=T1(e,r,i||"textstyle",a),m=(c=r.renderAccessibleContent)!=null?c:"";if(p&&/\b(mathml|speakable-text)\b/i.test(m)){const b=document.createElement("span");if(/\bmathml\b/i.test(m)&&r.renderToMathML&&b.append(k1(e,r)),/\bspeakable-text\b/i.test(m)&&r.renderToSpeakableText){const w=document.createElement("span");w.setAttribute("translate","no");const E=r.renderToSpeakableText(e);w.innerHTML=window.MathfieldElement.createHTML(E),w.className="ML__sr-only",b.append(w)}return b.append(p),b}return p}function A1(e,i){var r,a,c;let p=null;if((r=i.TeX)!=null&&r.processEnvironments&&/^\s*\\begin/.test(e)){p=document.createDocumentFragment();const m=dc(e,"",i,!0);m&&p.appendChild(m)}else{if(!e.trim())return null;const m=Kp(e,(a=i.TeX)==null?void 0:a.delimiters,(c=i.asciiMath)==null?void 0:c.delimiters);if(m.length===1&&m[0].type==="text")return null;p=document.createDocumentFragment();for(const b of m)if(b.type==="text")p.appendChild(document.createTextNode(b.data));else{const w=dc(b.data,b.mathstyle==="textstyle"?"textstyle":"displaystyle",i,!0);w&&p.appendChild(w)}}return p}function Up(e,i){var r,a,c,p,m,b,w,E,I,N,Z,ue,me,Ge,Lt,Ue;if(e.childNodes.length===1&&e.childNodes[0].nodeType===3){const ct=(r=e.childNodes[0].textContent)!=null?r:"";if((a=i.TeX)!=null&&a.processEnvironments&&/^\s*\\begin/.test(ct)){e.textContent="";const yt=dc(ct,"",i,!0);yt&&e.append(yt);return}const Rt=Kp(ct,(c=i.TeX)==null?void 0:c.delimiters,(p=i.asciiMath)==null?void 0:p.delimiters);if(Rt.length===1&&Rt[0].type==="math"){e.textContent="";const yt=dc(Rt[0].data,Rt[0].mathstyle==="textstyle"?"textstyle":"displaystyle",i,!0);yt&&e.append(yt);return}if(Rt.length===1&&Rt[0].type==="text")return}for(let ct=e.childNodes.length-1;ct>=0;ct--){const Rt=e.childNodes[ct];if(Rt.nodeType===3){const yt=A1((m=Rt.textContent)!=null?m:"",i);yt&&(ct+=yt.childNodes.length-1,Rt.replaceWith(yt))}else if(Rt.nodeType===1){const yt=Rt,Jt=Rt.nodeName.toLowerCase();if(Jt==="script"){const hi=Rt;let ri;if((b=i.processScriptTypePattern)!=null&&b.test(hi.type))ri=(w=hi.textContent)!=null?w:"";else if((E=i.processMathJSONScriptTypePattern)!=null&&E.test(hi.type))try{ri=(N=i.serializeToLatex)==null?void 0:N.call(i,JSON.parse((I=hi.textContent)!=null?I:""))}catch(cn){console.error(cn)}if(ri){let cn="textstyle";for(const $t of hi.type.split(";")){const[zs,Ga]=$t.toLowerCase().split("=");zs.trim()==="mode"&&(cn=Ga.trim()==="display"?"displaystyle":"textstyle")}const Bn=dc(ri,cn,i,!0);Bn&&hi.parentNode.replaceChild(Bn,hi)}}else if(((ue=(Z=i.processClassPattern)==null?void 0:Z.test(yt.className))!=null?ue:!1)||!((Ge=(me=i.skipTags)==null?void 0:me.includes(Jt))!=null&&Ge||(Ue=(Lt=i.ignoreClassPattern)==null?void 0:Lt.test(yt.className))!=null&&Ue))if(e.childNodes.length===1&&e.childNodes[0].nodeType===3){const ri=e.textContent;e.textContent="";const cn=dc(ri!=null?ri:"","displaystyle",i,!0);cn&&e.append(cn)}else Up(yt,i)}}}var L1={skipTags:["math-field","noscript","style","textarea","pre","code","annotation","annotation-xml"],processScriptType:"math/tex",processMathJSONScriptType:"math/json",ignoreClass:"tex2jax_ignore",processClass:"tex2jax_process",renderAccessibleContent:"mathml",asciiMath:{delimiters:{inline:[["`","`"]]}},TeX:{processEnvironments:!0,delimiters:{inline:[["\\(","\\)"]],display:[["$$","$$"],["\\[","\\]"]]}}};function D1(e,i){var r,a,c,p;try{const m=P(P({},L1),i);m.ignoreClassPattern=new RegExp((r=m.ignoreClass)!=null?r:""),m.processClassPattern=new RegExp((a=m.processClass)!=null?a:""),m.processScriptTypePattern=new RegExp((c=m.processScriptType)!=null?c:""),m.processMathJSONScriptTypePattern=new RegExp((p=m.processMathJSONScriptType)!=null?p:""),Zi(),ds("core"),Up(e,m)}catch(m){m instanceof Error?console.error("renderMathInElement(): "+m.message):console.error("renderMathInElement(): Could not render math for element",e)}}function C1(e,i){const r=al.singleton;return r?(r.show(),sl(),r.currentLayer=i,r.render(),r.focus(),!0):!1}function M1(){const e=window.mathVirtualKeyboard;return e.visible?e.hide({animate:!0}):e.show({animate:!0}),!1}es({switchKeyboardLayer:C1,toggleVirtualKeyboard:M1,hideVirtualKeyboard:()=>(window.mathVirtualKeyboard.hide({animate:!0}),!1),showVirtualKeyboard:()=>(window.mathVirtualKeyboard.show({animate:!0}),!1)},{target:"virtual-keyboard"});function ul(){var e,i;return(i=globalThis[e=Symbol.for("io.cortexjs.mathlive")])!=null||(globalThis[e]={}),globalThis[Symbol.for("io.cortexjs.mathlive")]}function B1(){return console.warn("%cMathLive 0.98.5: %cmakeSharedVirtualKeyboard() is deprecated. \n Use `window.mathVirtualKeyboard` to access the virtual keyboard instance.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),window.mathVirtualKeyboard}function N1(e){R1(document.body,e)}function I1(e){if(typeof e=="string"){const i=document.getElementById(e);if(i===null)throw new Error(`The element with ID "${e}" could not be found.`);return i}return typeof e=="string"?null:e}function R1(e,i){var r,a,c,p;const m=I1(e);if(!m)return;const b=i!=null?i:{};(r=b.renderToMarkup)!=null||(b.renderToMarkup=Nr),(a=b.renderToMathML)!=null||(b.renderToMathML=Hg),(c=b.renderToSpeakableText)!=null||(b.renderToSpeakableText=Wg),(p=b.serializeToLatex)!=null||(b.serializeToLatex=jg),D1(m,b)}var $1={mathlive:"0.98.5"}}}]);
|
|
|
}()); |